@decaf-ts/as-graph 0.6.0 → 0.8.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.
- package/README.md +857 -27
- package/assets/i18n/en.json +3899 -15
- package/dist/as-graph.cjs +1 -1
- package/dist/as-graph.cjs.map +1 -1
- package/dist/as-graph.js +1 -1
- package/dist/as-graph.js.map +1 -1
- package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs +13 -0
- package/lib/cjs/dagster/DagsterGraphExecutionBackend.cjs.map +1 -1
- package/lib/cjs/dagster/capabilities.cjs +5 -0
- package/lib/cjs/dagster/capabilities.cjs.map +1 -1
- package/lib/cjs/engine/auth/GraphAuthValidator.cjs +19 -0
- package/lib/cjs/engine/auth/GraphAuthValidator.cjs.map +1 -1
- package/lib/cjs/engine/constants.cjs +61 -1
- package/lib/cjs/engine/constants.cjs.map +1 -1
- package/lib/cjs/engine/credentials/GraphNodeCredentials.cjs +158 -0
- package/lib/cjs/engine/credentials/GraphNodeCredentials.cjs.map +1 -0
- package/lib/cjs/engine/execution/GraphCodeMode.cjs +42 -0
- package/lib/cjs/engine/execution/GraphCodeMode.cjs.map +1 -1
- package/lib/cjs/engine/execution/GraphExecutionEngine.cjs +263 -71
- package/lib/cjs/engine/execution/GraphExecutionEngine.cjs.map +1 -1
- package/lib/cjs/engine/execution/GraphNodeEngineRequirements.cjs +33 -0
- package/lib/cjs/engine/execution/GraphNodeEngineRequirements.cjs.map +1 -0
- package/lib/cjs/engine/execution/GraphWebhookResponseRegistry.cjs +108 -0
- package/lib/cjs/engine/execution/GraphWebhookResponseRegistry.cjs.map +1 -0
- package/lib/cjs/engine/execution/LocalGraphExecutionBackend.cjs +53 -1
- package/lib/cjs/engine/execution/LocalGraphExecutionBackend.cjs.map +1 -1
- package/lib/cjs/engine/execution/index.cjs +1 -0
- package/lib/cjs/engine/execution/index.cjs.map +1 -1
- package/lib/cjs/engine/index.cjs +4 -0
- package/lib/cjs/engine/index.cjs.map +1 -1
- package/lib/cjs/engine/store/GraphDataTableModel.cjs +76 -0
- package/lib/cjs/engine/store/GraphDataTableModel.cjs.map +1 -0
- package/lib/cjs/engine/store/GraphDataTableRepository.cjs +324 -0
- package/lib/cjs/engine/store/GraphDataTableRepository.cjs.map +1 -0
- package/lib/cjs/engine/store/index.cjs +2 -0
- package/lib/cjs/engine/store/index.cjs.map +1 -1
- package/lib/cjs/engine/validation/GraphConnectionPolicyValidator.cjs +28 -0
- package/lib/cjs/engine/validation/GraphConnectionPolicyValidator.cjs.map +1 -1
- package/lib/cjs/engine/validation/GraphCredentialReferenceValidator.cjs +4 -2
- package/lib/cjs/engine/validation/GraphCredentialReferenceValidator.cjs.map +1 -1
- package/lib/cjs/engine/validation/GraphNodeInstanceValidator.cjs +29 -1
- package/lib/cjs/engine/validation/GraphNodeInstanceValidator.cjs.map +1 -1
- package/lib/cjs/engine/validation/GraphParameterValidator.cjs +6 -0
- package/lib/cjs/engine/validation/GraphParameterValidator.cjs.map +1 -1
- package/lib/cjs/engine/validation/GraphWorkflowDocumentValidator.cjs +6 -2
- package/lib/cjs/engine/validation/GraphWorkflowDocumentValidator.cjs.map +1 -1
- package/lib/cjs/mastra/MastraAgeVectorDriver.cjs +298 -0
- package/lib/cjs/mastra/MastraAgeVectorDriver.cjs.map +1 -0
- package/lib/cjs/mastra/MastraAgentBuilder.cjs +249 -0
- package/lib/cjs/mastra/MastraAgentBuilder.cjs.map +1 -0
- package/lib/cjs/mastra/MastraAgentModelAdapter.cjs +65 -0
- package/lib/cjs/mastra/MastraAgentModelAdapter.cjs.map +1 -0
- package/lib/cjs/mastra/MastraAgentProcessors.cjs +397 -0
- package/lib/cjs/mastra/MastraAgentProcessors.cjs.map +1 -0
- package/lib/cjs/mastra/MastraAgentStepHandler.cjs +332 -0
- package/lib/cjs/mastra/MastraAgentStepHandler.cjs.map +1 -0
- package/lib/cjs/mastra/MastraCapabilities.cjs +115 -0
- package/lib/cjs/mastra/MastraCapabilities.cjs.map +1 -1
- package/lib/cjs/mastra/MastraChannelResponse.cjs +162 -0
- package/lib/cjs/mastra/MastraChannelResponse.cjs.map +1 -0
- package/lib/cjs/mastra/MastraChannelTrigger.cjs +124 -0
- package/lib/cjs/mastra/MastraChannelTrigger.cjs.map +1 -0
- package/lib/cjs/mastra/MastraDefaultStepHandlers.cjs +240 -22
- package/lib/cjs/mastra/MastraDefaultStepHandlers.cjs.map +1 -1
- package/lib/cjs/mastra/MastraEnvironment.cjs +297 -0
- package/lib/cjs/mastra/MastraEnvironment.cjs.map +1 -0
- package/lib/cjs/mastra/MastraEvalModels.cjs +546 -0
- package/lib/cjs/mastra/MastraEvalModels.cjs.map +1 -0
- package/lib/cjs/mastra/MastraEventBridge.cjs +21 -1
- package/lib/cjs/mastra/MastraEventBridge.cjs.map +1 -1
- package/lib/cjs/mastra/MastraGraphExecutionBackend.cjs +414 -19
- package/lib/cjs/mastra/MastraGraphExecutionBackend.cjs.map +1 -1
- package/lib/cjs/mastra/MastraGraphExecutionModule.cjs +148 -0
- package/lib/cjs/mastra/MastraGraphExecutionModule.cjs.map +1 -0
- package/lib/cjs/mastra/MastraHitlStepHandler.cjs +67 -0
- package/lib/cjs/mastra/MastraHitlStepHandler.cjs.map +1 -0
- package/lib/cjs/mastra/MastraMcpTrigger.cjs +254 -0
- package/lib/cjs/mastra/MastraMcpTrigger.cjs.map +1 -0
- package/lib/cjs/mastra/MastraMemory.cjs +467 -0
- package/lib/cjs/mastra/MastraMemory.cjs.map +1 -0
- package/lib/cjs/mastra/MastraMetricsAdapter.cjs +279 -0
- package/lib/cjs/mastra/MastraMetricsAdapter.cjs.map +1 -0
- package/lib/cjs/mastra/MastraMetricsGateway.cjs +404 -0
- package/lib/cjs/mastra/MastraMetricsGateway.cjs.map +1 -0
- package/lib/cjs/mastra/MastraMetricsModels.cjs +498 -0
- package/lib/cjs/mastra/MastraMetricsModels.cjs.map +1 -0
- package/lib/cjs/mastra/MastraMetricsStatement.cjs +220 -0
- package/lib/cjs/mastra/MastraMetricsStatement.cjs.map +1 -0
- package/lib/cjs/mastra/MastraModelSchemaConverter.cjs +84 -0
- package/lib/cjs/mastra/MastraModelSchemaConverter.cjs.map +1 -0
- package/lib/cjs/mastra/MastraObservability.cjs +335 -0
- package/lib/cjs/mastra/MastraObservability.cjs.map +1 -0
- package/lib/cjs/mastra/MastraPersistence.cjs +545 -0
- package/lib/cjs/mastra/MastraPersistence.cjs.map +1 -0
- package/lib/cjs/mastra/MastraRagStepHandlers.cjs +927 -0
- package/lib/cjs/mastra/MastraRagStepHandlers.cjs.map +1 -0
- package/lib/cjs/mastra/MastraRunMetricsEndpoint.cjs +153 -0
- package/lib/cjs/mastra/MastraRunMetricsEndpoint.cjs.map +1 -0
- package/lib/cjs/mastra/MastraRunRecovery.cjs +94 -0
- package/lib/cjs/mastra/MastraRunRecovery.cjs.map +1 -0
- package/lib/cjs/mastra/MastraScheduleTrigger.cjs +115 -0
- package/lib/cjs/mastra/MastraScheduleTrigger.cjs.map +1 -0
- package/lib/cjs/mastra/MastraStorageWiring.cjs +125 -0
- package/lib/cjs/mastra/MastraStorageWiring.cjs.map +1 -0
- package/lib/cjs/mastra/MastraStructuredOutput.cjs +152 -0
- package/lib/cjs/mastra/MastraStructuredOutput.cjs.map +1 -0
- package/lib/cjs/mastra/MastraToolBuilder.cjs +73 -0
- package/lib/cjs/mastra/MastraToolBuilder.cjs.map +1 -0
- package/lib/cjs/mastra/MastraToolConfig.cjs +42 -0
- package/lib/cjs/mastra/MastraToolConfig.cjs.map +1 -0
- package/lib/cjs/mastra/MastraToolDecorator.cjs +99 -0
- package/lib/cjs/mastra/MastraToolDecorator.cjs.map +1 -0
- package/lib/cjs/mastra/MastraVectorStore.cjs +618 -0
- package/lib/cjs/mastra/MastraVectorStore.cjs.map +1 -0
- package/lib/cjs/mastra/MastraVoiceStepHandler.cjs +90 -0
- package/lib/cjs/mastra/MastraVoiceStepHandler.cjs.map +1 -0
- package/lib/cjs/mastra/MastraWorkflowCompiler.cjs +79 -15
- package/lib/cjs/mastra/MastraWorkflowCompiler.cjs.map +1 -1
- package/lib/cjs/mastra/MastraWorkflowManager.cjs +100 -50
- package/lib/cjs/mastra/MastraWorkflowManager.cjs.map +1 -1
- package/lib/cjs/mastra/index.cjs +40 -1
- package/lib/cjs/mastra/index.cjs.map +1 -1
- package/lib/cjs/mastra/nodes/MastraNodeRegistry.cjs +232 -0
- package/lib/cjs/mastra/nodes/MastraNodeRegistry.cjs.map +1 -0
- package/lib/cjs/mastra/nodes/index.cjs +29 -0
- package/lib/cjs/mastra/nodes/index.cjs.map +1 -0
- package/lib/cjs/mastra/nodes/types.cjs +4 -0
- package/lib/cjs/mastra/nodes/types.cjs.map +1 -0
- package/lib/cjs/mastra/types.cjs +126 -1
- package/lib/cjs/mastra/types.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphBackendHost.cjs +12 -4
- package/lib/cjs/nest/graph/GraphBackendHost.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphEngineController.cjs +18 -0
- package/lib/cjs/nest/graph/GraphEngineController.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphExecutionModule.cjs +35 -1
- package/lib/cjs/nest/graph/GraphExecutionModule.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphNodeCatalogueController.cjs +14 -0
- package/lib/cjs/nest/graph/GraphNodeCatalogueController.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphRunController.cjs +64 -6
- package/lib/cjs/nest/graph/GraphRunController.cjs.map +1 -1
- package/lib/cjs/nest/graph/GraphWorkflowController.cjs +34 -5
- package/lib/cjs/nest/graph/GraphWorkflowController.cjs.map +1 -1
- package/lib/cjs/nest/graph/main.cjs +83 -1
- package/lib/cjs/nest/graph/main.cjs.map +1 -1
- package/lib/cjs/node/agents/agent/node.cjs +189 -31
- package/lib/cjs/node/agents/agent/node.cjs.map +1 -1
- package/lib/cjs/node/agents/hitl/node.cjs +115 -0
- package/lib/cjs/node/agents/hitl/node.cjs.map +1 -0
- package/lib/cjs/node/agents/hooks/delegation/node.cjs +122 -0
- package/lib/cjs/node/agents/hooks/delegation/node.cjs.map +1 -0
- package/lib/cjs/node/agents/hooks/hook/node.cjs +120 -0
- package/lib/cjs/node/agents/hooks/hook/node.cjs.map +1 -0
- package/lib/cjs/node/agents/hooks/tool-deny/node.cjs +104 -0
- package/lib/cjs/node/agents/hooks/tool-deny/node.cjs.map +1 -0
- package/lib/cjs/node/agents/memory/memory/node.cjs +231 -0
- package/lib/cjs/node/agents/memory/memory/node.cjs.map +1 -0
- package/lib/cjs/node/agents/memory/memory-selector/node.cjs +101 -0
- package/lib/cjs/node/agents/memory/memory-selector/node.cjs.map +1 -0
- package/lib/cjs/node/agents/processors/guardrail/node.cjs +126 -0
- package/lib/cjs/node/agents/processors/guardrail/node.cjs.map +1 -0
- package/lib/cjs/node/agents/processors/input-processor/node.cjs +118 -0
- package/lib/cjs/node/agents/processors/input-processor/node.cjs.map +1 -0
- package/lib/cjs/node/agents/processors/output-processor/node.cjs +108 -0
- package/lib/cjs/node/agents/processors/output-processor/node.cjs.map +1 -0
- package/lib/cjs/node/agents/processors/types.cjs +68 -0
- package/lib/cjs/node/agents/processors/types.cjs.map +1 -0
- package/lib/cjs/node/agents/rag/chains/basic/node.cjs +103 -0
- package/lib/cjs/node/agents/rag/chains/basic/node.cjs.map +1 -0
- package/lib/cjs/node/agents/rag/chains/qa/node.cjs +124 -0
- package/lib/cjs/node/agents/rag/chains/qa/node.cjs.map +1 -0
- package/lib/cjs/node/agents/rag/chains/summarization/node.cjs +116 -0
- package/lib/cjs/node/agents/rag/chains/summarization/node.cjs.map +1 -0
- package/lib/cjs/node/agents/rag/chunking/node.cjs +222 -0
- package/lib/cjs/node/agents/rag/chunking/node.cjs.map +1 -0
- package/lib/cjs/node/agents/rag/embedding/node.cjs +110 -0
- package/lib/cjs/node/agents/rag/embedding/node.cjs.map +1 -0
- package/lib/cjs/node/agents/rag/information-extractor/node.cjs +115 -0
- package/lib/cjs/node/agents/rag/information-extractor/node.cjs.map +1 -0
- package/lib/cjs/node/agents/rag/langchain-code/node.cjs +113 -0
- package/lib/cjs/node/agents/rag/langchain-code/node.cjs.map +1 -0
- package/lib/cjs/node/agents/rag/rerank/node.cjs +112 -0
- package/lib/cjs/node/agents/rag/rerank/node.cjs.map +1 -0
- package/lib/cjs/node/agents/rag/retriever/node.cjs +120 -0
- package/lib/cjs/node/agents/rag/retriever/node.cjs.map +1 -0
- package/lib/cjs/node/agents/rag/structured-output-parser/node.cjs +121 -0
- package/lib/cjs/node/agents/rag/structured-output-parser/node.cjs.map +1 -0
- package/lib/cjs/node/agents/rag/vector-store/node.cjs +187 -0
- package/lib/cjs/node/agents/rag/vector-store/node.cjs.map +1 -0
- package/lib/cjs/node/agents/responses/discord/node.cjs +101 -0
- package/lib/cjs/node/agents/responses/discord/node.cjs.map +1 -0
- package/lib/cjs/node/agents/responses/slack/node.cjs +101 -0
- package/lib/cjs/node/agents/responses/slack/node.cjs.map +1 -0
- package/lib/cjs/node/agents/responses/teams/node.cjs +101 -0
- package/lib/cjs/node/agents/responses/teams/node.cjs.map +1 -0
- package/lib/cjs/node/agents/responses/telegram/node.cjs +101 -0
- package/lib/cjs/node/agents/responses/telegram/node.cjs.map +1 -0
- package/lib/cjs/node/agents/sandbox/node.cjs +135 -0
- package/lib/cjs/node/agents/sandbox/node.cjs.map +1 -0
- package/lib/cjs/node/agents/scorers/scorer/node.cjs +107 -0
- package/lib/cjs/node/agents/scorers/scorer/node.cjs.map +1 -0
- package/lib/cjs/node/agents/scorers/scorer-selector/node.cjs +100 -0
- package/lib/cjs/node/agents/scorers/scorer-selector/node.cjs.map +1 -0
- package/lib/cjs/node/agents/skills/skill/node.cjs +105 -0
- package/lib/cjs/node/agents/skills/skill/node.cjs.map +1 -0
- package/lib/cjs/node/agents/skills/skill-selector/node.cjs +98 -0
- package/lib/cjs/node/agents/skills/skill-selector/node.cjs.map +1 -0
- package/lib/cjs/node/agents/tools/tool/node.cjs +100 -0
- package/lib/cjs/node/agents/tools/tool/node.cjs.map +1 -0
- package/lib/cjs/node/agents/tools/tool-selector/node.cjs +99 -0
- package/lib/cjs/node/agents/tools/tool-selector/node.cjs.map +1 -0
- package/lib/cjs/node/agents/triggers/discord/node.cjs +101 -0
- package/lib/cjs/node/agents/triggers/discord/node.cjs.map +1 -0
- package/lib/cjs/node/agents/triggers/mcp-server/node.cjs +147 -0
- package/lib/cjs/node/agents/triggers/mcp-server/node.cjs.map +1 -0
- package/lib/cjs/node/agents/triggers/slack/node.cjs +101 -0
- package/lib/cjs/node/agents/triggers/slack/node.cjs.map +1 -0
- package/lib/cjs/node/agents/triggers/teams/node.cjs +101 -0
- package/lib/cjs/node/agents/triggers/teams/node.cjs.map +1 -0
- package/lib/cjs/node/agents/triggers/telegram/node.cjs +101 -0
- package/lib/cjs/node/agents/triggers/telegram/node.cjs.map +1 -0
- package/lib/cjs/node/agents/voice/node.cjs +107 -0
- package/lib/cjs/node/agents/voice/node.cjs.map +1 -0
- package/lib/cjs/node/agents/zones.cjs +43 -0
- package/lib/cjs/node/agents/zones.cjs.map +1 -0
- package/lib/cjs/node/comms/discord/node.cjs +384 -0
- package/lib/cjs/node/comms/discord/node.cjs.map +1 -0
- package/lib/cjs/node/comms/email-send/node.cjs +340 -0
- package/lib/cjs/node/comms/email-send/node.cjs.map +1 -0
- package/lib/cjs/node/comms/gmail/node.cjs +287 -0
- package/lib/cjs/node/comms/gmail/node.cjs.map +1 -0
- package/lib/cjs/node/comms/outlook/node.cjs +395 -0
- package/lib/cjs/node/comms/outlook/node.cjs.map +1 -0
- package/lib/cjs/node/comms/slack/node.cjs +276 -0
- package/lib/cjs/node/comms/slack/node.cjs.map +1 -0
- package/lib/cjs/node/comms/teams/node.cjs +231 -0
- package/lib/cjs/node/comms/teams/node.cjs.map +1 -0
- package/lib/cjs/node/comms/telegram/node.cjs +260 -0
- package/lib/cjs/node/comms/telegram/node.cjs.map +1 -0
- package/lib/cjs/node/comms/whatsapp/node.cjs +341 -0
- package/lib/cjs/node/comms/whatsapp/node.cjs.map +1 -0
- package/lib/cjs/node/credentials.cjs +103 -0
- package/lib/cjs/node/credentials.cjs.map +1 -0
- package/lib/cjs/node/data/aggregate/node.cjs +196 -0
- package/lib/cjs/node/data/aggregate/node.cjs.map +1 -0
- package/lib/cjs/node/data/compare-datasets/node.cjs +331 -0
- package/lib/cjs/node/data/compare-datasets/node.cjs.map +1 -0
- package/lib/cjs/node/data/data-table/node.cjs +265 -0
- package/lib/cjs/node/data/data-table/node.cjs.map +1 -0
- package/lib/cjs/node/data/date-time/node.cjs +180 -0
- package/lib/cjs/node/data/date-time/node.cjs.map +1 -0
- package/lib/cjs/node/data/filter/node.cjs +134 -0
- package/lib/cjs/node/data/filter/node.cjs.map +1 -0
- package/lib/cjs/node/data/item-lists/node.cjs +416 -0
- package/lib/cjs/node/data/item-lists/node.cjs.map +1 -0
- package/lib/cjs/node/data/limit/node.cjs +104 -0
- package/lib/cjs/node/data/limit/node.cjs.map +1 -0
- package/lib/cjs/node/data/merge/node.cjs +251 -0
- package/lib/cjs/node/data/merge/node.cjs.map +1 -0
- package/lib/cjs/node/data/remove-duplicates/node.cjs +141 -0
- package/lib/cjs/node/data/remove-duplicates/node.cjs.map +1 -0
- package/lib/cjs/node/data/rename-keys/node.cjs +139 -0
- package/lib/cjs/node/data/rename-keys/node.cjs.map +1 -0
- package/lib/cjs/node/data/set/node.cjs +148 -0
- package/lib/cjs/node/data/set/node.cjs.map +1 -0
- package/lib/cjs/node/data/sort/node.cjs +125 -0
- package/lib/cjs/node/data/sort/node.cjs.map +1 -0
- package/lib/cjs/node/data/split-out/node.cjs +140 -0
- package/lib/cjs/node/data/split-out/node.cjs.map +1 -0
- package/lib/cjs/node/data/summarize/node.cjs +155 -0
- package/lib/cjs/node/data/summarize/node.cjs.map +1 -0
- package/lib/cjs/node/data/support.cjs +403 -0
- package/lib/cjs/node/data/support.cjs.map +1 -0
- package/lib/cjs/node/data/transform-utils.cjs +719 -0
- package/lib/cjs/node/data/transform-utils.cjs.map +1 -0
- package/lib/cjs/node/devops/crypto/node.cjs +364 -0
- package/lib/cjs/node/devops/crypto/node.cjs.map +1 -0
- package/lib/cjs/node/devops/execute-command/node.cjs +201 -0
- package/lib/cjs/node/devops/execute-command/node.cjs.map +1 -0
- package/lib/cjs/node/devops/ftp/node.cjs +241 -0
- package/lib/cjs/node/devops/ftp/node.cjs.map +1 -0
- package/lib/cjs/node/devops/github/node.cjs +282 -0
- package/lib/cjs/node/devops/github/node.cjs.map +1 -0
- package/lib/cjs/node/devops/gitlab/node.cjs +273 -0
- package/lib/cjs/node/devops/gitlab/node.cjs.map +1 -0
- package/lib/cjs/node/devops/jwt/node.cjs +204 -0
- package/lib/cjs/node/devops/jwt/node.cjs.map +1 -0
- package/lib/cjs/node/flow/execute-sub-workflow/node.cjs +223 -0
- package/lib/cjs/node/flow/execute-sub-workflow/node.cjs.map +1 -0
- package/lib/cjs/node/index.cjs +508 -66
- package/lib/cjs/node/index.cjs.map +1 -1
- package/lib/cjs/node/io/airtable/node.cjs +318 -0
- package/lib/cjs/node/io/airtable/node.cjs.map +1 -0
- package/lib/cjs/node/io/confluence/node.cjs +253 -0
- package/lib/cjs/node/io/confluence/node.cjs.map +1 -0
- package/lib/cjs/node/io/convert-to-file/node.cjs +349 -0
- package/lib/cjs/node/io/convert-to-file/node.cjs.map +1 -0
- package/lib/cjs/node/io/extract-from-file/node.cjs +269 -0
- package/lib/cjs/node/io/extract-from-file/node.cjs.map +1 -0
- package/lib/cjs/node/io/file-support.cjs +311 -0
- package/lib/cjs/node/io/file-support.cjs.map +1 -0
- package/lib/cjs/node/io/google-calendar/node.cjs +359 -0
- package/lib/cjs/node/io/google-calendar/node.cjs.map +1 -0
- package/lib/cjs/node/io/google-docs/node.cjs +272 -0
- package/lib/cjs/node/io/google-docs/node.cjs.map +1 -0
- package/lib/cjs/node/io/google-sheets/node.cjs +267 -0
- package/lib/cjs/node/io/google-sheets/node.cjs.map +1 -0
- package/lib/cjs/node/io/graphql/node.cjs +169 -0
- package/lib/cjs/node/io/graphql/node.cjs.map +1 -0
- package/lib/cjs/node/io/html/node.cjs +275 -0
- package/lib/cjs/node/io/html/node.cjs.map +1 -0
- package/lib/cjs/node/io/html-extract/node.cjs +162 -0
- package/lib/cjs/node/io/html-extract/node.cjs.map +1 -0
- package/lib/cjs/node/io/html-support.cjs +246 -0
- package/lib/cjs/node/io/html-support.cjs.map +1 -0
- package/lib/cjs/node/io/http-request/node.cjs +415 -0
- package/lib/cjs/node/io/http-request/node.cjs.map +1 -0
- package/lib/cjs/node/io/jira/node.cjs +351 -0
- package/lib/cjs/node/io/jira/node.cjs.map +1 -0
- package/lib/cjs/node/io/markdown/node.cjs +229 -0
- package/lib/cjs/node/io/markdown/node.cjs.map +1 -0
- package/lib/cjs/node/io/microsoft-excel/node.cjs +261 -0
- package/lib/cjs/node/io/microsoft-excel/node.cjs.map +1 -0
- package/lib/cjs/node/io/microsoft-sharepoint/node.cjs +274 -0
- package/lib/cjs/node/io/microsoft-sharepoint/node.cjs.map +1 -0
- package/lib/cjs/node/io/read-binary-file/node.cjs +114 -0
- package/lib/cjs/node/io/read-binary-file/node.cjs.map +1 -0
- package/lib/cjs/node/io/read-binary-files/node.cjs +113 -0
- package/lib/cjs/node/io/read-binary-files/node.cjs.map +1 -0
- package/lib/cjs/node/io/read-pdf/node.cjs +206 -0
- package/lib/cjs/node/io/read-pdf/node.cjs.map +1 -0
- package/lib/cjs/node/io/read-write-file/node.cjs +314 -0
- package/lib/cjs/node/io/read-write-file/node.cjs.map +1 -0
- package/lib/cjs/node/io/respond-to-webhook/node.cjs +183 -0
- package/lib/cjs/node/io/respond-to-webhook/node.cjs.map +1 -0
- package/lib/cjs/node/io/spreadsheet-file/node.cjs +192 -0
- package/lib/cjs/node/io/spreadsheet-file/node.cjs.map +1 -0
- package/lib/cjs/node/io/write-binary-file/node.cjs +164 -0
- package/lib/cjs/node/io/write-binary-file/node.cjs.map +1 -0
- package/lib/cjs/node/io/xml/node.cjs +322 -0
- package/lib/cjs/node/io/xml/node.cjs.map +1 -0
- package/lib/cjs/node/manifests.cjs +322 -36
- package/lib/cjs/node/manifests.cjs.map +1 -1
- package/lib/cjs/node/storage/blob/azure/node.cjs +138 -0
- package/lib/cjs/node/storage/blob/azure/node.cjs.map +1 -0
- package/lib/cjs/node/storage/blob/base.cjs +321 -0
- package/lib/cjs/node/storage/blob/base.cjs.map +1 -0
- package/lib/cjs/node/storage/blob/gcs/node.cjs +126 -0
- package/lib/cjs/node/storage/blob/gcs/node.cjs.map +1 -0
- package/lib/cjs/node/storage/blob/s3/node.cjs +186 -0
- package/lib/cjs/node/storage/blob/s3/node.cjs.map +1 -0
- package/lib/cjs/node/storage/database/base.cjs +301 -0
- package/lib/cjs/node/storage/database/base.cjs.map +1 -0
- package/lib/cjs/node/storage/database/mssql/node.cjs +50 -0
- package/lib/cjs/node/storage/database/mssql/node.cjs.map +1 -0
- package/lib/cjs/node/storage/database/mysql/node.cjs +50 -0
- package/lib/cjs/node/storage/database/mysql/node.cjs.map +1 -0
- package/lib/cjs/node/storage/database/postgres/node.cjs +50 -0
- package/lib/cjs/node/storage/database/postgres/node.cjs.map +1 -0
- package/lib/cjs/node/storage/rabbitmq/node.cjs +252 -0
- package/lib/cjs/node/storage/rabbitmq/node.cjs.map +1 -0
- package/lib/cjs/node/storage/redis/node.cjs +340 -0
- package/lib/cjs/node/storage/redis/node.cjs.map +1 -0
- package/lib/cjs/node/storage/support.cjs +81 -0
- package/lib/cjs/node/storage/support.cjs.map +1 -0
- package/lib/cjs/node/triggers/error/node.cjs +108 -0
- package/lib/cjs/node/triggers/error/node.cjs.map +1 -0
- package/lib/cjs/node/triggers/execute-workflow/node.cjs +94 -0
- package/lib/cjs/node/triggers/execute-workflow/node.cjs.map +1 -0
- package/lib/cjs/node/triggers/postgres/node.cjs +244 -0
- package/lib/cjs/node/triggers/postgres/node.cjs.map +1 -0
- package/lib/cjs/node/triggers/rabbitmq/node.cjs +284 -0
- package/lib/cjs/node/triggers/rabbitmq/node.cjs.map +1 -0
- package/lib/cjs/node/triggers/redis/node.cjs +233 -0
- package/lib/cjs/node/triggers/redis/node.cjs.map +1 -0
- package/lib/cjs/node/triggers/sse/node.cjs +196 -0
- package/lib/cjs/node/triggers/sse/node.cjs.map +1 -0
- package/lib/cjs/node/triggers/support.cjs +107 -0
- package/lib/cjs/node/triggers/support.cjs.map +1 -0
- package/lib/cjs/node/triggers/workflow/node.cjs +193 -0
- package/lib/cjs/node/triggers/workflow/node.cjs.map +1 -0
- package/lib/cjs/ram/GraphRunEventModel.cjs +4 -0
- package/lib/cjs/ram/GraphRunEventModel.cjs.map +1 -1
- package/lib/cjs/shared/graph/GraphNodeModel.cjs +4 -0
- package/lib/cjs/shared/graph/GraphNodeModel.cjs.map +1 -1
- package/lib/cjs/shared/graph/GraphWorkflowModel.cjs +4 -0
- package/lib/cjs/shared/graph/GraphWorkflowModel.cjs.map +1 -1
- package/lib/cjs/shared/graph/catalog/GraphManifestCompiler.cjs +40 -0
- package/lib/cjs/shared/graph/catalog/GraphManifestCompiler.cjs.map +1 -1
- package/lib/cjs/shared/graph/catalog/GraphValueSchemaDerivation.cjs +20 -3
- package/lib/cjs/shared/graph/catalog/GraphValueSchemaDerivation.cjs.map +1 -1
- package/lib/cjs/shared/graph/category-styles.cjs +12 -0
- package/lib/cjs/shared/graph/category-styles.cjs.map +1 -1
- package/lib/cjs/typeorm/TypeormGraphAdapter.cjs +250 -0
- package/lib/cjs/typeorm/TypeormGraphAdapter.cjs.map +1 -0
- package/lib/cjs/typeorm/index.cjs +29 -0
- package/lib/cjs/typeorm/index.cjs.map +1 -0
- package/lib/cjs/workflows/boundary-value.workflow.cjs +38 -0
- package/lib/cjs/workflows/boundary-value.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/builders.cjs +47 -0
- package/lib/cjs/workflows/builders.cjs.map +1 -0
- package/lib/cjs/workflows/chat-agent.workflow.cjs +40 -0
- package/lib/cjs/workflows/chat-agent.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/error-boundary.workflow.cjs +54 -0
- package/lib/cjs/workflows/error-boundary.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/event-map.workflow.cjs +37 -0
- package/lib/cjs/workflows/event-map.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/foreach-break.workflow.cjs +58 -0
- package/lib/cjs/workflows/foreach-break.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/human-approval.workflow.cjs +44 -0
- package/lib/cjs/workflows/human-approval.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/if-switch.workflow.cjs +66 -0
- package/lib/cjs/workflows/if-switch.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/index.cjs +135 -0
- package/lib/cjs/workflows/index.cjs.map +1 -0
- package/lib/cjs/workflows/loops-while-until.workflow.cjs +76 -0
- package/lib/cjs/workflows/loops-while-until.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/manual-log.workflow.cjs +52 -0
- package/lib/cjs/workflows/manual-log.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/schedule-code.workflow.cjs +42 -0
- package/lib/cjs/workflows/schedule-code.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/types.cjs +4 -0
- package/lib/cjs/workflows/types.cjs.map +1 -0
- package/lib/cjs/workflows/value-templates.workflow.cjs +43 -0
- package/lib/cjs/workflows/value-templates.workflow.cjs.map +1 -0
- package/lib/cjs/workflows/webhook-form.workflow.cjs +48 -0
- package/lib/cjs/workflows/webhook-form.workflow.cjs.map +1 -0
- package/lib/esm/dagster/DagsterGraphExecutionBackend.js +13 -0
- package/lib/esm/dagster/DagsterGraphExecutionBackend.js.map +1 -1
- package/lib/esm/dagster/capabilities.js +5 -0
- package/lib/esm/dagster/capabilities.js.map +1 -1
- package/lib/esm/engine/auth/GraphAuthValidator.js +19 -0
- package/lib/esm/engine/auth/GraphAuthValidator.js.map +1 -1
- package/lib/esm/engine/constants.js +60 -0
- package/lib/esm/engine/constants.js.map +1 -1
- package/lib/esm/engine/credentials/GraphNodeCredentials.js +152 -0
- package/lib/esm/engine/credentials/GraphNodeCredentials.js.map +1 -0
- package/lib/esm/engine/execution/GraphCodeMode.js +40 -0
- package/lib/esm/engine/execution/GraphCodeMode.js.map +1 -1
- package/lib/esm/engine/execution/GraphExecutionBackend.js.map +1 -1
- package/lib/esm/engine/execution/GraphExecutionEngine.js +265 -73
- package/lib/esm/engine/execution/GraphExecutionEngine.js.map +1 -1
- package/lib/esm/engine/execution/GraphNodeEngineRequirements.js +28 -0
- package/lib/esm/engine/execution/GraphNodeEngineRequirements.js.map +1 -0
- package/lib/esm/engine/execution/GraphWebhookResponseRegistry.js +103 -0
- package/lib/esm/engine/execution/GraphWebhookResponseRegistry.js.map +1 -0
- package/lib/esm/engine/execution/LocalGraphExecutionBackend.js +54 -2
- package/lib/esm/engine/execution/LocalGraphExecutionBackend.js.map +1 -1
- package/lib/esm/engine/execution/index.js +1 -0
- package/lib/esm/engine/execution/index.js.map +1 -1
- package/lib/esm/engine/index.js +4 -0
- package/lib/esm/engine/index.js.map +1 -1
- package/lib/esm/engine/store/GraphDataTableModel.js +67 -0
- package/lib/esm/engine/store/GraphDataTableModel.js.map +1 -0
- package/lib/esm/engine/store/GraphDataTableRepository.js +314 -0
- package/lib/esm/engine/store/GraphDataTableRepository.js.map +1 -0
- package/lib/esm/engine/store/index.js +2 -0
- package/lib/esm/engine/store/index.js.map +1 -1
- package/lib/esm/engine/validation/GraphConnectionPolicyValidator.js +28 -0
- package/lib/esm/engine/validation/GraphConnectionPolicyValidator.js.map +1 -1
- package/lib/esm/engine/validation/GraphCredentialReferenceValidator.js +4 -2
- package/lib/esm/engine/validation/GraphCredentialReferenceValidator.js.map +1 -1
- package/lib/esm/engine/validation/GraphNodeInstanceValidator.js +29 -1
- package/lib/esm/engine/validation/GraphNodeInstanceValidator.js.map +1 -1
- package/lib/esm/engine/validation/GraphParameterValidator.js +6 -0
- package/lib/esm/engine/validation/GraphParameterValidator.js.map +1 -1
- package/lib/esm/engine/validation/GraphWorkflowDocumentValidator.js +6 -2
- package/lib/esm/engine/validation/GraphWorkflowDocumentValidator.js.map +1 -1
- package/lib/esm/mastra/MastraAgeVectorDriver.js +294 -0
- package/lib/esm/mastra/MastraAgeVectorDriver.js.map +1 -0
- package/lib/esm/mastra/MastraAgentBuilder.js +244 -0
- package/lib/esm/mastra/MastraAgentBuilder.js.map +1 -0
- package/lib/esm/mastra/MastraAgentModelAdapter.js +59 -0
- package/lib/esm/mastra/MastraAgentModelAdapter.js.map +1 -0
- package/lib/esm/mastra/MastraAgentProcessors.js +391 -0
- package/lib/esm/mastra/MastraAgentProcessors.js.map +1 -0
- package/lib/esm/mastra/MastraAgentStepHandler.js +327 -0
- package/lib/esm/mastra/MastraAgentStepHandler.js.map +1 -0
- package/lib/esm/mastra/MastraCapabilities.js +115 -0
- package/lib/esm/mastra/MastraCapabilities.js.map +1 -1
- package/lib/esm/mastra/MastraChannelResponse.js +154 -0
- package/lib/esm/mastra/MastraChannelResponse.js.map +1 -0
- package/lib/esm/mastra/MastraChannelTrigger.js +116 -0
- package/lib/esm/mastra/MastraChannelTrigger.js.map +1 -0
- package/lib/esm/mastra/MastraDefaultStepHandlers.js +240 -22
- package/lib/esm/mastra/MastraDefaultStepHandlers.js.map +1 -1
- package/lib/esm/mastra/MastraEnvironment.js +287 -0
- package/lib/esm/mastra/MastraEnvironment.js.map +1 -0
- package/lib/esm/mastra/MastraEvalModels.js +535 -0
- package/lib/esm/mastra/MastraEvalModels.js.map +1 -0
- package/lib/esm/mastra/MastraEventBridge.js +21 -1
- package/lib/esm/mastra/MastraEventBridge.js.map +1 -1
- package/lib/esm/mastra/MastraGraphExecutionBackend.js +414 -19
- package/lib/esm/mastra/MastraGraphExecutionBackend.js.map +1 -1
- package/lib/esm/mastra/MastraGraphExecutionModule.js +139 -0
- package/lib/esm/mastra/MastraGraphExecutionModule.js.map +1 -0
- package/lib/esm/mastra/MastraHitlStepHandler.js +62 -0
- package/lib/esm/mastra/MastraHitlStepHandler.js.map +1 -0
- package/lib/esm/mastra/MastraMcpTrigger.js +246 -0
- package/lib/esm/mastra/MastraMcpTrigger.js.map +1 -0
- package/lib/esm/mastra/MastraMemory.js +455 -0
- package/lib/esm/mastra/MastraMemory.js.map +1 -0
- package/lib/esm/mastra/MastraMetricsAdapter.js +273 -0
- package/lib/esm/mastra/MastraMetricsAdapter.js.map +1 -0
- package/lib/esm/mastra/MastraMetricsGateway.js +394 -0
- package/lib/esm/mastra/MastraMetricsGateway.js.map +1 -0
- package/lib/esm/mastra/MastraMetricsModels.js +486 -0
- package/lib/esm/mastra/MastraMetricsModels.js.map +1 -0
- package/lib/esm/mastra/MastraMetricsStatement.js +213 -0
- package/lib/esm/mastra/MastraMetricsStatement.js.map +1 -0
- package/lib/esm/mastra/MastraModelSchemaConverter.js +78 -0
- package/lib/esm/mastra/MastraModelSchemaConverter.js.map +1 -0
- package/lib/esm/mastra/MastraObservability.js +327 -0
- package/lib/esm/mastra/MastraObservability.js.map +1 -0
- package/lib/esm/mastra/MastraPersistence.js +530 -0
- package/lib/esm/mastra/MastraPersistence.js.map +1 -0
- package/lib/esm/mastra/MastraRagStepHandlers.js +920 -0
- package/lib/esm/mastra/MastraRagStepHandlers.js.map +1 -0
- package/lib/esm/mastra/MastraRunMetricsEndpoint.js +147 -0
- package/lib/esm/mastra/MastraRunMetricsEndpoint.js.map +1 -0
- package/lib/esm/mastra/MastraRunRecovery.js +89 -0
- package/lib/esm/mastra/MastraRunRecovery.js.map +1 -0
- package/lib/esm/mastra/MastraScheduleTrigger.js +110 -0
- package/lib/esm/mastra/MastraScheduleTrigger.js.map +1 -0
- package/lib/esm/mastra/MastraStorageWiring.js +119 -0
- package/lib/esm/mastra/MastraStorageWiring.js.map +1 -0
- package/lib/esm/mastra/MastraStructuredOutput.js +144 -0
- package/lib/esm/mastra/MastraStructuredOutput.js.map +1 -0
- package/lib/esm/mastra/MastraToolBuilder.js +68 -0
- package/lib/esm/mastra/MastraToolBuilder.js.map +1 -0
- package/lib/esm/mastra/MastraToolConfig.js +37 -0
- package/lib/esm/mastra/MastraToolConfig.js.map +1 -0
- package/lib/esm/mastra/MastraToolDecorator.js +92 -0
- package/lib/esm/mastra/MastraToolDecorator.js.map +1 -0
- package/lib/esm/mastra/MastraVectorStore.js +605 -0
- package/lib/esm/mastra/MastraVectorStore.js.map +1 -0
- package/lib/esm/mastra/MastraVoiceStepHandler.js +84 -0
- package/lib/esm/mastra/MastraVoiceStepHandler.js.map +1 -0
- package/lib/esm/mastra/MastraWorkflowCompiler.js +79 -15
- package/lib/esm/mastra/MastraWorkflowCompiler.js.map +1 -1
- package/lib/esm/mastra/MastraWorkflowManager.js +101 -51
- package/lib/esm/mastra/MastraWorkflowManager.js.map +1 -1
- package/lib/esm/mastra/index.js +40 -1
- package/lib/esm/mastra/index.js.map +1 -1
- package/lib/esm/mastra/nodes/MastraNodeRegistry.js +225 -0
- package/lib/esm/mastra/nodes/MastraNodeRegistry.js.map +1 -0
- package/lib/esm/mastra/nodes/index.js +12 -0
- package/lib/esm/mastra/nodes/index.js.map +1 -0
- package/lib/esm/mastra/nodes/types.js +2 -0
- package/lib/esm/mastra/nodes/types.js.map +1 -0
- package/lib/esm/mastra/types.js +125 -0
- package/lib/esm/mastra/types.js.map +1 -1
- package/lib/esm/nest/graph/GraphBackendHost.js +10 -2
- package/lib/esm/nest/graph/GraphBackendHost.js.map +1 -1
- package/lib/esm/nest/graph/GraphEngineController.js +19 -1
- package/lib/esm/nest/graph/GraphEngineController.js.map +1 -1
- package/lib/esm/nest/graph/GraphExecutionModule.js +35 -1
- package/lib/esm/nest/graph/GraphExecutionModule.js.map +1 -1
- package/lib/esm/nest/graph/GraphNodeCatalogueController.js +15 -1
- package/lib/esm/nest/graph/GraphNodeCatalogueController.js.map +1 -1
- package/lib/esm/nest/graph/GraphRunController.js +65 -7
- package/lib/esm/nest/graph/GraphRunController.js.map +1 -1
- package/lib/esm/nest/graph/GraphWorkflowController.js +35 -6
- package/lib/esm/nest/graph/GraphWorkflowController.js.map +1 -1
- package/lib/esm/nest/graph/main.js +83 -1
- package/lib/esm/nest/graph/main.js.map +1 -1
- package/lib/esm/node/agents/agent/node.js +189 -31
- package/lib/esm/node/agents/agent/node.js.map +1 -1
- package/lib/esm/node/agents/hitl/node.js +106 -0
- package/lib/esm/node/agents/hitl/node.js.map +1 -0
- package/lib/esm/node/agents/hooks/delegation/node.js +113 -0
- package/lib/esm/node/agents/hooks/delegation/node.js.map +1 -0
- package/lib/esm/node/agents/hooks/hook/node.js +111 -0
- package/lib/esm/node/agents/hooks/hook/node.js.map +1 -0
- package/lib/esm/node/agents/hooks/tool-deny/node.js +95 -0
- package/lib/esm/node/agents/hooks/tool-deny/node.js.map +1 -0
- package/lib/esm/node/agents/memory/memory/node.js +222 -0
- package/lib/esm/node/agents/memory/memory/node.js.map +1 -0
- package/lib/esm/node/agents/memory/memory-selector/node.js +92 -0
- package/lib/esm/node/agents/memory/memory-selector/node.js.map +1 -0
- package/lib/esm/node/agents/processors/guardrail/node.js +117 -0
- package/lib/esm/node/agents/processors/guardrail/node.js.map +1 -0
- package/lib/esm/node/agents/processors/input-processor/node.js +109 -0
- package/lib/esm/node/agents/processors/input-processor/node.js.map +1 -0
- package/lib/esm/node/agents/processors/output-processor/node.js +99 -0
- package/lib/esm/node/agents/processors/output-processor/node.js.map +1 -0
- package/lib/esm/node/agents/processors/types.js +64 -0
- package/lib/esm/node/agents/processors/types.js.map +1 -0
- package/lib/esm/node/agents/rag/chains/basic/node.js +94 -0
- package/lib/esm/node/agents/rag/chains/basic/node.js.map +1 -0
- package/lib/esm/node/agents/rag/chains/qa/node.js +115 -0
- package/lib/esm/node/agents/rag/chains/qa/node.js.map +1 -0
- package/lib/esm/node/agents/rag/chains/summarization/node.js +107 -0
- package/lib/esm/node/agents/rag/chains/summarization/node.js.map +1 -0
- package/lib/esm/node/agents/rag/chunking/node.js +211 -0
- package/lib/esm/node/agents/rag/chunking/node.js.map +1 -0
- package/lib/esm/node/agents/rag/embedding/node.js +101 -0
- package/lib/esm/node/agents/rag/embedding/node.js.map +1 -0
- package/lib/esm/node/agents/rag/information-extractor/node.js +106 -0
- package/lib/esm/node/agents/rag/information-extractor/node.js.map +1 -0
- package/lib/esm/node/agents/rag/langchain-code/node.js +104 -0
- package/lib/esm/node/agents/rag/langchain-code/node.js.map +1 -0
- package/lib/esm/node/agents/rag/rerank/node.js +103 -0
- package/lib/esm/node/agents/rag/rerank/node.js.map +1 -0
- package/lib/esm/node/agents/rag/retriever/node.js +111 -0
- package/lib/esm/node/agents/rag/retriever/node.js.map +1 -0
- package/lib/esm/node/agents/rag/structured-output-parser/node.js +112 -0
- package/lib/esm/node/agents/rag/structured-output-parser/node.js.map +1 -0
- package/lib/esm/node/agents/rag/vector-store/node.js +178 -0
- package/lib/esm/node/agents/rag/vector-store/node.js.map +1 -0
- package/lib/esm/node/agents/responses/discord/node.js +92 -0
- package/lib/esm/node/agents/responses/discord/node.js.map +1 -0
- package/lib/esm/node/agents/responses/slack/node.js +92 -0
- package/lib/esm/node/agents/responses/slack/node.js.map +1 -0
- package/lib/esm/node/agents/responses/teams/node.js +92 -0
- package/lib/esm/node/agents/responses/teams/node.js.map +1 -0
- package/lib/esm/node/agents/responses/telegram/node.js +92 -0
- package/lib/esm/node/agents/responses/telegram/node.js.map +1 -0
- package/lib/esm/node/agents/sandbox/node.js +125 -0
- package/lib/esm/node/agents/sandbox/node.js.map +1 -0
- package/lib/esm/node/agents/scorers/scorer/node.js +98 -0
- package/lib/esm/node/agents/scorers/scorer/node.js.map +1 -0
- package/lib/esm/node/agents/scorers/scorer-selector/node.js +91 -0
- package/lib/esm/node/agents/scorers/scorer-selector/node.js.map +1 -0
- package/lib/esm/node/agents/skills/skill/node.js +96 -0
- package/lib/esm/node/agents/skills/skill/node.js.map +1 -0
- package/lib/esm/node/agents/skills/skill-selector/node.js +89 -0
- package/lib/esm/node/agents/skills/skill-selector/node.js.map +1 -0
- package/lib/esm/node/agents/tools/tool/node.js +91 -0
- package/lib/esm/node/agents/tools/tool/node.js.map +1 -0
- package/lib/esm/node/agents/tools/tool-selector/node.js +90 -0
- package/lib/esm/node/agents/tools/tool-selector/node.js.map +1 -0
- package/lib/esm/node/agents/triggers/discord/node.js +92 -0
- package/lib/esm/node/agents/triggers/discord/node.js.map +1 -0
- package/lib/esm/node/agents/triggers/mcp-server/node.js +138 -0
- package/lib/esm/node/agents/triggers/mcp-server/node.js.map +1 -0
- package/lib/esm/node/agents/triggers/slack/node.js +92 -0
- package/lib/esm/node/agents/triggers/slack/node.js.map +1 -0
- package/lib/esm/node/agents/triggers/teams/node.js +92 -0
- package/lib/esm/node/agents/triggers/teams/node.js.map +1 -0
- package/lib/esm/node/agents/triggers/telegram/node.js +92 -0
- package/lib/esm/node/agents/triggers/telegram/node.js.map +1 -0
- package/lib/esm/node/agents/voice/node.js +98 -0
- package/lib/esm/node/agents/voice/node.js.map +1 -0
- package/lib/esm/node/agents/zones.js +39 -0
- package/lib/esm/node/agents/zones.js.map +1 -0
- package/lib/esm/node/comms/discord/node.js +375 -0
- package/lib/esm/node/comms/discord/node.js.map +1 -0
- package/lib/esm/node/comms/email-send/node.js +331 -0
- package/lib/esm/node/comms/email-send/node.js.map +1 -0
- package/lib/esm/node/comms/gmail/node.js +278 -0
- package/lib/esm/node/comms/gmail/node.js.map +1 -0
- package/lib/esm/node/comms/outlook/node.js +386 -0
- package/lib/esm/node/comms/outlook/node.js.map +1 -0
- package/lib/esm/node/comms/slack/node.js +267 -0
- package/lib/esm/node/comms/slack/node.js.map +1 -0
- package/lib/esm/node/comms/teams/node.js +222 -0
- package/lib/esm/node/comms/teams/node.js.map +1 -0
- package/lib/esm/node/comms/telegram/node.js +251 -0
- package/lib/esm/node/comms/telegram/node.js.map +1 -0
- package/lib/esm/node/comms/whatsapp/node.js +332 -0
- package/lib/esm/node/comms/whatsapp/node.js.map +1 -0
- package/lib/esm/node/credentials.js +96 -0
- package/lib/esm/node/credentials.js.map +1 -0
- package/lib/esm/node/data/aggregate/node.js +187 -0
- package/lib/esm/node/data/aggregate/node.js.map +1 -0
- package/lib/esm/node/data/compare-datasets/node.js +322 -0
- package/lib/esm/node/data/compare-datasets/node.js.map +1 -0
- package/lib/esm/node/data/data-table/node.js +256 -0
- package/lib/esm/node/data/data-table/node.js.map +1 -0
- package/lib/esm/node/data/date-time/node.js +171 -0
- package/lib/esm/node/data/date-time/node.js.map +1 -0
- package/lib/esm/node/data/filter/node.js +125 -0
- package/lib/esm/node/data/filter/node.js.map +1 -0
- package/lib/esm/node/data/item-lists/node.js +407 -0
- package/lib/esm/node/data/item-lists/node.js.map +1 -0
- package/lib/esm/node/data/limit/node.js +95 -0
- package/lib/esm/node/data/limit/node.js.map +1 -0
- package/lib/esm/node/data/merge/node.js +242 -0
- package/lib/esm/node/data/merge/node.js.map +1 -0
- package/lib/esm/node/data/remove-duplicates/node.js +132 -0
- package/lib/esm/node/data/remove-duplicates/node.js.map +1 -0
- package/lib/esm/node/data/rename-keys/node.js +130 -0
- package/lib/esm/node/data/rename-keys/node.js.map +1 -0
- package/lib/esm/node/data/set/node.js +139 -0
- package/lib/esm/node/data/set/node.js.map +1 -0
- package/lib/esm/node/data/sort/node.js +116 -0
- package/lib/esm/node/data/sort/node.js.map +1 -0
- package/lib/esm/node/data/split-out/node.js +131 -0
- package/lib/esm/node/data/split-out/node.js.map +1 -0
- package/lib/esm/node/data/summarize/node.js +146 -0
- package/lib/esm/node/data/summarize/node.js.map +1 -0
- package/lib/esm/node/data/support.js +386 -0
- package/lib/esm/node/data/support.js.map +1 -0
- package/lib/esm/node/data/transform-utils.js +702 -0
- package/lib/esm/node/data/transform-utils.js.map +1 -0
- package/lib/esm/node/devops/crypto/node.js +355 -0
- package/lib/esm/node/devops/crypto/node.js.map +1 -0
- package/lib/esm/node/devops/execute-command/node.js +192 -0
- package/lib/esm/node/devops/execute-command/node.js.map +1 -0
- package/lib/esm/node/devops/ftp/node.js +232 -0
- package/lib/esm/node/devops/ftp/node.js.map +1 -0
- package/lib/esm/node/devops/github/node.js +273 -0
- package/lib/esm/node/devops/github/node.js.map +1 -0
- package/lib/esm/node/devops/gitlab/node.js +264 -0
- package/lib/esm/node/devops/gitlab/node.js.map +1 -0
- package/lib/esm/node/devops/jwt/node.js +195 -0
- package/lib/esm/node/devops/jwt/node.js.map +1 -0
- package/lib/esm/node/flow/execute-sub-workflow/node.js +214 -0
- package/lib/esm/node/flow/execute-sub-workflow/node.js.map +1 -0
- package/lib/esm/node/index.js +444 -2
- package/lib/esm/node/index.js.map +1 -1
- package/lib/esm/node/io/airtable/node.js +309 -0
- package/lib/esm/node/io/airtable/node.js.map +1 -0
- package/lib/esm/node/io/confluence/node.js +244 -0
- package/lib/esm/node/io/confluence/node.js.map +1 -0
- package/lib/esm/node/io/convert-to-file/node.js +340 -0
- package/lib/esm/node/io/convert-to-file/node.js.map +1 -0
- package/lib/esm/node/io/extract-from-file/node.js +260 -0
- package/lib/esm/node/io/extract-from-file/node.js.map +1 -0
- package/lib/esm/node/io/file-support.js +299 -0
- package/lib/esm/node/io/file-support.js.map +1 -0
- package/lib/esm/node/io/google-calendar/node.js +350 -0
- package/lib/esm/node/io/google-calendar/node.js.map +1 -0
- package/lib/esm/node/io/google-docs/node.js +263 -0
- package/lib/esm/node/io/google-docs/node.js.map +1 -0
- package/lib/esm/node/io/google-sheets/node.js +258 -0
- package/lib/esm/node/io/google-sheets/node.js.map +1 -0
- package/lib/esm/node/io/graphql/node.js +160 -0
- package/lib/esm/node/io/graphql/node.js.map +1 -0
- package/lib/esm/node/io/html/node.js +266 -0
- package/lib/esm/node/io/html/node.js.map +1 -0
- package/lib/esm/node/io/html-extract/node.js +153 -0
- package/lib/esm/node/io/html-extract/node.js.map +1 -0
- package/lib/esm/node/io/html-support.js +206 -0
- package/lib/esm/node/io/html-support.js.map +1 -0
- package/lib/esm/node/io/http-request/node.js +406 -0
- package/lib/esm/node/io/http-request/node.js.map +1 -0
- package/lib/esm/node/io/jira/node.js +342 -0
- package/lib/esm/node/io/jira/node.js.map +1 -0
- package/lib/esm/node/io/markdown/node.js +217 -0
- package/lib/esm/node/io/markdown/node.js.map +1 -0
- package/lib/esm/node/io/microsoft-excel/node.js +252 -0
- package/lib/esm/node/io/microsoft-excel/node.js.map +1 -0
- package/lib/esm/node/io/microsoft-sharepoint/node.js +265 -0
- package/lib/esm/node/io/microsoft-sharepoint/node.js.map +1 -0
- package/lib/esm/node/io/read-binary-file/node.js +105 -0
- package/lib/esm/node/io/read-binary-file/node.js.map +1 -0
- package/lib/esm/node/io/read-binary-files/node.js +104 -0
- package/lib/esm/node/io/read-binary-files/node.js.map +1 -0
- package/lib/esm/node/io/read-pdf/node.js +164 -0
- package/lib/esm/node/io/read-pdf/node.js.map +1 -0
- package/lib/esm/node/io/read-write-file/node.js +305 -0
- package/lib/esm/node/io/read-write-file/node.js.map +1 -0
- package/lib/esm/node/io/respond-to-webhook/node.js +174 -0
- package/lib/esm/node/io/respond-to-webhook/node.js.map +1 -0
- package/lib/esm/node/io/spreadsheet-file/node.js +183 -0
- package/lib/esm/node/io/spreadsheet-file/node.js.map +1 -0
- package/lib/esm/node/io/write-binary-file/node.js +155 -0
- package/lib/esm/node/io/write-binary-file/node.js.map +1 -0
- package/lib/esm/node/io/xml/node.js +313 -0
- package/lib/esm/node/io/xml/node.js.map +1 -0
- package/lib/esm/node/manifests.js +286 -0
- package/lib/esm/node/manifests.js.map +1 -1
- package/lib/esm/node/storage/blob/azure/node.js +129 -0
- package/lib/esm/node/storage/blob/azure/node.js.map +1 -0
- package/lib/esm/node/storage/blob/base.js +311 -0
- package/lib/esm/node/storage/blob/base.js.map +1 -0
- package/lib/esm/node/storage/blob/gcs/node.js +117 -0
- package/lib/esm/node/storage/blob/gcs/node.js.map +1 -0
- package/lib/esm/node/storage/blob/s3/node.js +176 -0
- package/lib/esm/node/storage/blob/s3/node.js.map +1 -0
- package/lib/esm/node/storage/database/base.js +291 -0
- package/lib/esm/node/storage/database/base.js.map +1 -0
- package/lib/esm/node/storage/database/mssql/node.js +42 -0
- package/lib/esm/node/storage/database/mssql/node.js.map +1 -0
- package/lib/esm/node/storage/database/mysql/node.js +42 -0
- package/lib/esm/node/storage/database/mysql/node.js.map +1 -0
- package/lib/esm/node/storage/database/postgres/node.js +42 -0
- package/lib/esm/node/storage/database/postgres/node.js.map +1 -0
- package/lib/esm/node/storage/rabbitmq/node.js +243 -0
- package/lib/esm/node/storage/rabbitmq/node.js.map +1 -0
- package/lib/esm/node/storage/redis/node.js +331 -0
- package/lib/esm/node/storage/redis/node.js.map +1 -0
- package/lib/esm/node/storage/support.js +69 -0
- package/lib/esm/node/storage/support.js.map +1 -0
- package/lib/esm/node/triggers/error/node.js +99 -0
- package/lib/esm/node/triggers/error/node.js.map +1 -0
- package/lib/esm/node/triggers/execute-workflow/node.js +85 -0
- package/lib/esm/node/triggers/execute-workflow/node.js.map +1 -0
- package/lib/esm/node/triggers/postgres/node.js +235 -0
- package/lib/esm/node/triggers/postgres/node.js.map +1 -0
- package/lib/esm/node/triggers/rabbitmq/node.js +275 -0
- package/lib/esm/node/triggers/rabbitmq/node.js.map +1 -0
- package/lib/esm/node/triggers/redis/node.js +224 -0
- package/lib/esm/node/triggers/redis/node.js.map +1 -0
- package/lib/esm/node/triggers/sse/node.js +187 -0
- package/lib/esm/node/triggers/sse/node.js.map +1 -0
- package/lib/esm/node/triggers/support.js +99 -0
- package/lib/esm/node/triggers/support.js.map +1 -0
- package/lib/esm/node/triggers/workflow/node.js +184 -0
- package/lib/esm/node/triggers/workflow/node.js.map +1 -0
- package/lib/esm/ram/GraphRunEventModel.js +5 -1
- package/lib/esm/ram/GraphRunEventModel.js.map +1 -1
- package/lib/esm/shared/graph/GraphNodeModel.js +5 -1
- package/lib/esm/shared/graph/GraphNodeModel.js.map +1 -1
- package/lib/esm/shared/graph/GraphWorkflowModel.js +5 -1
- package/lib/esm/shared/graph/GraphWorkflowModel.js.map +1 -1
- package/lib/esm/shared/graph/catalog/GraphManifestCompiler.js +40 -0
- package/lib/esm/shared/graph/catalog/GraphManifestCompiler.js.map +1 -1
- package/lib/esm/shared/graph/catalog/GraphPortManifest.js.map +1 -1
- package/lib/esm/shared/graph/catalog/GraphValueSchemaDerivation.js +20 -3
- package/lib/esm/shared/graph/catalog/GraphValueSchemaDerivation.js.map +1 -1
- package/lib/esm/shared/graph/category-styles.js +12 -0
- package/lib/esm/shared/graph/category-styles.js.map +1 -1
- package/lib/esm/shared/graph/constants.js.map +1 -1
- package/lib/esm/typeorm/TypeormGraphAdapter.js +213 -0
- package/lib/esm/typeorm/TypeormGraphAdapter.js.map +1 -0
- package/lib/esm/typeorm/index.js +12 -0
- package/lib/esm/typeorm/index.js.map +1 -0
- package/lib/esm/workflows/boundary-value.workflow.js +34 -0
- package/lib/esm/workflows/boundary-value.workflow.js.map +1 -0
- package/lib/esm/workflows/builders.js +40 -0
- package/lib/esm/workflows/builders.js.map +1 -0
- package/lib/esm/workflows/chat-agent.workflow.js +36 -0
- package/lib/esm/workflows/chat-agent.workflow.js.map +1 -0
- package/lib/esm/workflows/error-boundary.workflow.js +50 -0
- package/lib/esm/workflows/error-boundary.workflow.js.map +1 -0
- package/lib/esm/workflows/event-map.workflow.js +33 -0
- package/lib/esm/workflows/event-map.workflow.js.map +1 -0
- package/lib/esm/workflows/foreach-break.workflow.js +54 -0
- package/lib/esm/workflows/foreach-break.workflow.js.map +1 -0
- package/lib/esm/workflows/human-approval.workflow.js +40 -0
- package/lib/esm/workflows/human-approval.workflow.js.map +1 -0
- package/lib/esm/workflows/if-switch.workflow.js +62 -0
- package/lib/esm/workflows/if-switch.workflow.js.map +1 -0
- package/lib/esm/workflows/index.js +116 -0
- package/lib/esm/workflows/index.js.map +1 -0
- package/lib/esm/workflows/loops-while-until.workflow.js +72 -0
- package/lib/esm/workflows/loops-while-until.workflow.js.map +1 -0
- package/lib/esm/workflows/manual-log.workflow.js +48 -0
- package/lib/esm/workflows/manual-log.workflow.js.map +1 -0
- package/lib/esm/workflows/schedule-code.workflow.js +38 -0
- package/lib/esm/workflows/schedule-code.workflow.js.map +1 -0
- package/lib/esm/workflows/types.js +2 -0
- package/lib/esm/workflows/types.js.map +1 -0
- package/lib/esm/workflows/value-templates.workflow.js +39 -0
- package/lib/esm/workflows/value-templates.workflow.js.map +1 -0
- package/lib/esm/workflows/webhook-form.workflow.js +44 -0
- package/lib/esm/workflows/webhook-form.workflow.js.map +1 -0
- package/lib/types/dagster/DagsterGraphExecutionBackend.d.cts +7 -0
- package/lib/types/dagster/DagsterGraphExecutionBackend.d.mts +7 -0
- package/lib/types/engine/auth/GraphAuthValidator.d.cts +13 -0
- package/lib/types/engine/auth/GraphAuthValidator.d.mts +13 -0
- package/lib/types/engine/constants.d.cts +60 -0
- package/lib/types/engine/constants.d.mts +60 -0
- package/lib/types/engine/credentials/GraphNodeCredentials.d.cts +145 -0
- package/lib/types/engine/credentials/GraphNodeCredentials.d.mts +145 -0
- package/lib/types/engine/execution/GraphCodeMode.d.cts +46 -0
- package/lib/types/engine/execution/GraphCodeMode.d.mts +46 -0
- package/lib/types/engine/execution/GraphExecutionBackend.d.cts +21 -0
- package/lib/types/engine/execution/GraphExecutionBackend.d.mts +21 -0
- package/lib/types/engine/execution/GraphExecutionEngine.d.cts +116 -4
- package/lib/types/engine/execution/GraphExecutionEngine.d.mts +116 -4
- package/lib/types/engine/execution/GraphNodeEngineRequirements.d.cts +24 -0
- package/lib/types/engine/execution/GraphNodeEngineRequirements.d.mts +24 -0
- package/lib/types/engine/execution/GraphWebhookResponseRegistry.d.cts +67 -0
- package/lib/types/engine/execution/GraphWebhookResponseRegistry.d.mts +67 -0
- package/lib/types/engine/execution/LocalGraphExecutionBackend.d.cts +12 -3
- package/lib/types/engine/execution/LocalGraphExecutionBackend.d.mts +12 -3
- package/lib/types/engine/execution/index.d.cts +1 -0
- package/lib/types/engine/execution/index.d.mts +1 -0
- package/lib/types/engine/index.d.cts +4 -0
- package/lib/types/engine/index.d.mts +4 -0
- package/lib/types/engine/store/GraphDataTableModel.d.cts +24 -0
- package/lib/types/engine/store/GraphDataTableModel.d.mts +24 -0
- package/lib/types/engine/store/GraphDataTableRepository.d.cts +136 -0
- package/lib/types/engine/store/GraphDataTableRepository.d.mts +136 -0
- package/lib/types/engine/store/index.d.cts +2 -0
- package/lib/types/engine/store/index.d.mts +2 -0
- package/lib/types/engine/types.d.cts +12 -0
- package/lib/types/engine/types.d.mts +12 -0
- package/lib/types/engine/validation/GraphConnectionPolicyValidator.d.cts +10 -0
- package/lib/types/engine/validation/GraphConnectionPolicyValidator.d.mts +10 -0
- package/lib/types/engine/validation/GraphNodeInstanceValidator.d.cts +11 -1
- package/lib/types/engine/validation/GraphNodeInstanceValidator.d.mts +11 -1
- package/lib/types/engine/validation/GraphParameterValidator.d.cts +1 -1
- package/lib/types/engine/validation/GraphParameterValidator.d.mts +1 -1
- package/lib/types/engine/validation/GraphWorkflowDocumentValidator.d.cts +7 -0
- package/lib/types/engine/validation/GraphWorkflowDocumentValidator.d.mts +7 -0
- package/lib/types/mastra/MastraAgeVectorDriver.d.cts +55 -0
- package/lib/types/mastra/MastraAgeVectorDriver.d.mts +55 -0
- package/lib/types/mastra/MastraAgentBuilder.d.cts +188 -0
- package/lib/types/mastra/MastraAgentBuilder.d.mts +188 -0
- package/lib/types/mastra/MastraAgentModelAdapter.d.cts +76 -0
- package/lib/types/mastra/MastraAgentModelAdapter.d.mts +76 -0
- package/lib/types/mastra/MastraAgentProcessors.d.cts +50 -0
- package/lib/types/mastra/MastraAgentProcessors.d.mts +50 -0
- package/lib/types/mastra/MastraAgentStepHandler.d.cts +128 -0
- package/lib/types/mastra/MastraAgentStepHandler.d.mts +128 -0
- package/lib/types/mastra/MastraCapabilities.d.cts +20 -0
- package/lib/types/mastra/MastraCapabilities.d.mts +20 -0
- package/lib/types/mastra/MastraChannelResponse.d.cts +64 -0
- package/lib/types/mastra/MastraChannelResponse.d.mts +64 -0
- package/lib/types/mastra/MastraChannelTrigger.d.cts +57 -0
- package/lib/types/mastra/MastraChannelTrigger.d.mts +57 -0
- package/lib/types/mastra/MastraDefaultStepHandlers.d.cts +53 -6
- package/lib/types/mastra/MastraDefaultStepHandlers.d.mts +53 -6
- package/lib/types/mastra/MastraEnvironment.d.cts +270 -0
- package/lib/types/mastra/MastraEnvironment.d.mts +270 -0
- package/lib/types/mastra/MastraEvalModels.d.cts +191 -0
- package/lib/types/mastra/MastraEvalModels.d.mts +191 -0
- package/lib/types/mastra/MastraEventBridge.d.cts +17 -0
- package/lib/types/mastra/MastraEventBridge.d.mts +17 -0
- package/lib/types/mastra/MastraGraphExecutionBackend.d.cts +108 -1
- package/lib/types/mastra/MastraGraphExecutionBackend.d.mts +108 -1
- package/lib/types/mastra/MastraGraphExecutionModule.d.cts +114 -0
- package/lib/types/mastra/MastraGraphExecutionModule.d.mts +114 -0
- package/lib/types/mastra/MastraHitlStepHandler.d.cts +18 -0
- package/lib/types/mastra/MastraHitlStepHandler.d.mts +18 -0
- package/lib/types/mastra/MastraMcpTrigger.d.cts +133 -0
- package/lib/types/mastra/MastraMcpTrigger.d.mts +133 -0
- package/lib/types/mastra/MastraMemory.d.cts +362 -0
- package/lib/types/mastra/MastraMemory.d.mts +362 -0
- package/lib/types/mastra/MastraMetricsAdapter.d.cts +216 -0
- package/lib/types/mastra/MastraMetricsAdapter.d.mts +216 -0
- package/lib/types/mastra/MastraMetricsGateway.d.cts +265 -0
- package/lib/types/mastra/MastraMetricsGateway.d.mts +265 -0
- package/lib/types/mastra/MastraMetricsModels.d.cts +175 -0
- package/lib/types/mastra/MastraMetricsModels.d.mts +175 -0
- package/lib/types/mastra/MastraMetricsStatement.d.cts +116 -0
- package/lib/types/mastra/MastraMetricsStatement.d.mts +116 -0
- package/lib/types/mastra/MastraModelSchemaConverter.d.cts +45 -0
- package/lib/types/mastra/MastraModelSchemaConverter.d.mts +45 -0
- package/lib/types/mastra/MastraObservability.d.cts +197 -0
- package/lib/types/mastra/MastraObservability.d.mts +197 -0
- package/lib/types/mastra/MastraPersistence.d.cts +241 -0
- package/lib/types/mastra/MastraPersistence.d.mts +241 -0
- package/lib/types/mastra/MastraRagStepHandlers.d.cts +137 -0
- package/lib/types/mastra/MastraRagStepHandlers.d.mts +137 -0
- package/lib/types/mastra/MastraRunMetricsEndpoint.d.cts +53 -0
- package/lib/types/mastra/MastraRunMetricsEndpoint.d.mts +53 -0
- package/lib/types/mastra/MastraRunRecovery.d.cts +26 -0
- package/lib/types/mastra/MastraRunRecovery.d.mts +26 -0
- package/lib/types/mastra/MastraScheduleTrigger.d.cts +20 -0
- package/lib/types/mastra/MastraScheduleTrigger.d.mts +20 -0
- package/lib/types/mastra/MastraStorageWiring.d.cts +71 -0
- package/lib/types/mastra/MastraStorageWiring.d.mts +71 -0
- package/lib/types/mastra/MastraStructuredOutput.d.cts +165 -0
- package/lib/types/mastra/MastraStructuredOutput.d.mts +165 -0
- package/lib/types/mastra/MastraToolBuilder.d.cts +70 -0
- package/lib/types/mastra/MastraToolBuilder.d.mts +70 -0
- package/lib/types/mastra/MastraToolConfig.d.cts +136 -0
- package/lib/types/mastra/MastraToolConfig.d.mts +136 -0
- package/lib/types/mastra/MastraToolDecorator.d.cts +47 -0
- package/lib/types/mastra/MastraToolDecorator.d.mts +47 -0
- package/lib/types/mastra/MastraVectorStore.d.cts +383 -0
- package/lib/types/mastra/MastraVectorStore.d.mts +383 -0
- package/lib/types/mastra/MastraVoiceStepHandler.d.cts +40 -0
- package/lib/types/mastra/MastraVoiceStepHandler.d.mts +40 -0
- package/lib/types/mastra/MastraWorkflowCompiler.d.cts +23 -8
- package/lib/types/mastra/MastraWorkflowCompiler.d.mts +23 -8
- package/lib/types/mastra/MastraWorkflowManager.d.cts +36 -28
- package/lib/types/mastra/MastraWorkflowManager.d.mts +36 -28
- package/lib/types/mastra/index.d.cts +40 -1
- package/lib/types/mastra/index.d.mts +40 -1
- package/lib/types/mastra/nodes/MastraNodeRegistry.d.cts +41 -0
- package/lib/types/mastra/nodes/MastraNodeRegistry.d.mts +41 -0
- package/lib/types/mastra/nodes/index.d.cts +11 -0
- package/lib/types/mastra/nodes/index.d.mts +11 -0
- package/lib/types/mastra/nodes/types.d.cts +57 -0
- package/lib/types/mastra/nodes/types.d.mts +57 -0
- package/lib/types/mastra/types.d.cts +365 -6
- package/lib/types/mastra/types.d.mts +365 -6
- package/lib/types/nest/graph/GraphEngineController.d.cts +19 -0
- package/lib/types/nest/graph/GraphEngineController.d.mts +19 -0
- package/lib/types/nest/graph/GraphExecutionModule.d.cts +17 -0
- package/lib/types/nest/graph/GraphExecutionModule.d.mts +17 -0
- package/lib/types/nest/graph/GraphNodeCatalogueController.d.cts +13 -0
- package/lib/types/nest/graph/GraphNodeCatalogueController.d.mts +13 -0
- package/lib/types/nest/graph/GraphRunController.d.cts +40 -4
- package/lib/types/nest/graph/GraphRunController.d.mts +40 -4
- package/lib/types/nest/graph/GraphWorkflowController.d.cts +26 -3
- package/lib/types/nest/graph/GraphWorkflowController.d.mts +26 -3
- package/lib/types/node/agents/agent/node.d.cts +72 -16
- package/lib/types/node/agents/agent/node.d.mts +72 -16
- package/lib/types/node/agents/hitl/node.d.cts +45 -0
- package/lib/types/node/agents/hitl/node.d.mts +45 -0
- package/lib/types/node/agents/hooks/delegation/node.d.cts +48 -0
- package/lib/types/node/agents/hooks/delegation/node.d.mts +48 -0
- package/lib/types/node/agents/hooks/hook/node.d.cts +45 -0
- package/lib/types/node/agents/hooks/hook/node.d.mts +45 -0
- package/lib/types/node/agents/hooks/tool-deny/node.d.cts +39 -0
- package/lib/types/node/agents/hooks/tool-deny/node.d.mts +39 -0
- package/lib/types/node/agents/memory/memory/node.d.cts +73 -0
- package/lib/types/node/agents/memory/memory/node.d.mts +73 -0
- package/lib/types/node/agents/memory/memory-selector/node.d.cts +34 -0
- package/lib/types/node/agents/memory/memory-selector/node.d.mts +34 -0
- package/lib/types/node/agents/processors/guardrail/node.d.cts +47 -0
- package/lib/types/node/agents/processors/guardrail/node.d.mts +47 -0
- package/lib/types/node/agents/processors/input-processor/node.d.cts +40 -0
- package/lib/types/node/agents/processors/input-processor/node.d.mts +40 -0
- package/lib/types/node/agents/processors/output-processor/node.d.cts +34 -0
- package/lib/types/node/agents/processors/output-processor/node.d.mts +34 -0
- package/lib/types/node/agents/processors/types.d.cts +45 -0
- package/lib/types/node/agents/processors/types.d.mts +45 -0
- package/lib/types/node/agents/rag/chains/basic/node.d.cts +36 -0
- package/lib/types/node/agents/rag/chains/basic/node.d.mts +36 -0
- package/lib/types/node/agents/rag/chains/qa/node.d.cts +44 -0
- package/lib/types/node/agents/rag/chains/qa/node.d.mts +44 -0
- package/lib/types/node/agents/rag/chains/summarization/node.d.cts +39 -0
- package/lib/types/node/agents/rag/chains/summarization/node.d.mts +39 -0
- package/lib/types/node/agents/rag/chunking/node.d.cts +73 -0
- package/lib/types/node/agents/rag/chunking/node.d.mts +73 -0
- package/lib/types/node/agents/rag/embedding/node.d.cts +37 -0
- package/lib/types/node/agents/rag/embedding/node.d.mts +37 -0
- package/lib/types/node/agents/rag/information-extractor/node.d.cts +39 -0
- package/lib/types/node/agents/rag/information-extractor/node.d.mts +39 -0
- package/lib/types/node/agents/rag/langchain-code/node.d.cts +36 -0
- package/lib/types/node/agents/rag/langchain-code/node.d.mts +36 -0
- package/lib/types/node/agents/rag/rerank/node.d.cts +39 -0
- package/lib/types/node/agents/rag/rerank/node.d.mts +39 -0
- package/lib/types/node/agents/rag/retriever/node.d.cts +42 -0
- package/lib/types/node/agents/rag/retriever/node.d.mts +42 -0
- package/lib/types/node/agents/rag/structured-output-parser/node.d.cts +35 -0
- package/lib/types/node/agents/rag/structured-output-parser/node.d.mts +35 -0
- package/lib/types/node/agents/rag/vector-store/node.d.cts +59 -0
- package/lib/types/node/agents/rag/vector-store/node.d.mts +59 -0
- package/lib/types/node/agents/responses/discord/node.d.cts +34 -0
- package/lib/types/node/agents/responses/discord/node.d.mts +34 -0
- package/lib/types/node/agents/responses/slack/node.d.cts +34 -0
- package/lib/types/node/agents/responses/slack/node.d.mts +34 -0
- package/lib/types/node/agents/responses/teams/node.d.cts +34 -0
- package/lib/types/node/agents/responses/teams/node.d.mts +34 -0
- package/lib/types/node/agents/responses/telegram/node.d.cts +34 -0
- package/lib/types/node/agents/responses/telegram/node.d.mts +34 -0
- package/lib/types/node/agents/sandbox/node.d.cts +47 -0
- package/lib/types/node/agents/sandbox/node.d.mts +47 -0
- package/lib/types/node/agents/scorers/scorer/node.d.cts +33 -0
- package/lib/types/node/agents/scorers/scorer/node.d.mts +33 -0
- package/lib/types/node/agents/scorers/scorer-selector/node.d.cts +33 -0
- package/lib/types/node/agents/scorers/scorer-selector/node.d.mts +33 -0
- package/lib/types/node/agents/skills/skill/node.d.cts +32 -0
- package/lib/types/node/agents/skills/skill/node.d.mts +32 -0
- package/lib/types/node/agents/skills/skill-selector/node.d.cts +33 -0
- package/lib/types/node/agents/skills/skill-selector/node.d.mts +33 -0
- package/lib/types/node/agents/tools/tool/node.d.cts +33 -0
- package/lib/types/node/agents/tools/tool/node.d.mts +33 -0
- package/lib/types/node/agents/tools/tool-selector/node.d.cts +33 -0
- package/lib/types/node/agents/tools/tool-selector/node.d.mts +33 -0
- package/lib/types/node/agents/triggers/discord/node.d.cts +40 -0
- package/lib/types/node/agents/triggers/discord/node.d.mts +40 -0
- package/lib/types/node/agents/triggers/mcp-server/node.d.cts +51 -0
- package/lib/types/node/agents/triggers/mcp-server/node.d.mts +51 -0
- package/lib/types/node/agents/triggers/slack/node.d.cts +40 -0
- package/lib/types/node/agents/triggers/slack/node.d.mts +40 -0
- package/lib/types/node/agents/triggers/teams/node.d.cts +40 -0
- package/lib/types/node/agents/triggers/teams/node.d.mts +40 -0
- package/lib/types/node/agents/triggers/telegram/node.d.cts +40 -0
- package/lib/types/node/agents/triggers/telegram/node.d.mts +40 -0
- package/lib/types/node/agents/voice/node.d.cts +34 -0
- package/lib/types/node/agents/voice/node.d.mts +34 -0
- package/lib/types/node/agents/zones.d.cts +30 -0
- package/lib/types/node/agents/zones.d.mts +30 -0
- package/lib/types/node/comms/discord/node.d.cts +67 -0
- package/lib/types/node/comms/discord/node.d.mts +67 -0
- package/lib/types/node/comms/email-send/node.d.cts +85 -0
- package/lib/types/node/comms/email-send/node.d.mts +85 -0
- package/lib/types/node/comms/gmail/node.d.cts +67 -0
- package/lib/types/node/comms/gmail/node.d.mts +67 -0
- package/lib/types/node/comms/outlook/node.d.cts +77 -0
- package/lib/types/node/comms/outlook/node.d.mts +77 -0
- package/lib/types/node/comms/slack/node.d.cts +65 -0
- package/lib/types/node/comms/slack/node.d.mts +65 -0
- package/lib/types/node/comms/teams/node.d.cts +49 -0
- package/lib/types/node/comms/teams/node.d.mts +49 -0
- package/lib/types/node/comms/telegram/node.d.cts +61 -0
- package/lib/types/node/comms/telegram/node.d.mts +61 -0
- package/lib/types/node/comms/whatsapp/node.d.cts +71 -0
- package/lib/types/node/comms/whatsapp/node.d.mts +71 -0
- package/lib/types/node/credentials.d.cts +43 -0
- package/lib/types/node/credentials.d.mts +43 -0
- package/lib/types/node/data/aggregate/node.d.cts +58 -0
- package/lib/types/node/data/aggregate/node.d.mts +58 -0
- package/lib/types/node/data/compare-datasets/node.d.cts +72 -0
- package/lib/types/node/data/compare-datasets/node.d.mts +72 -0
- package/lib/types/node/data/data-table/node.d.cts +86 -0
- package/lib/types/node/data/data-table/node.d.mts +86 -0
- package/lib/types/node/data/date-time/node.d.cts +49 -0
- package/lib/types/node/data/date-time/node.d.mts +49 -0
- package/lib/types/node/data/filter/node.d.cts +31 -0
- package/lib/types/node/data/filter/node.d.mts +31 -0
- package/lib/types/node/data/item-lists/node.d.cts +92 -0
- package/lib/types/node/data/item-lists/node.d.mts +92 -0
- package/lib/types/node/data/limit/node.d.cts +28 -0
- package/lib/types/node/data/limit/node.d.mts +28 -0
- package/lib/types/node/data/merge/node.d.cts +63 -0
- package/lib/types/node/data/merge/node.d.mts +63 -0
- package/lib/types/node/data/remove-duplicates/node.d.cts +47 -0
- package/lib/types/node/data/remove-duplicates/node.d.mts +47 -0
- package/lib/types/node/data/rename-keys/node.d.cts +35 -0
- package/lib/types/node/data/rename-keys/node.d.mts +35 -0
- package/lib/types/node/data/set/node.d.cts +52 -0
- package/lib/types/node/data/set/node.d.mts +52 -0
- package/lib/types/node/data/sort/node.d.cts +40 -0
- package/lib/types/node/data/sort/node.d.mts +40 -0
- package/lib/types/node/data/split-out/node.d.cts +30 -0
- package/lib/types/node/data/split-out/node.d.mts +30 -0
- package/lib/types/node/data/summarize/node.d.cts +44 -0
- package/lib/types/node/data/summarize/node.d.mts +44 -0
- package/lib/types/node/data/support.d.cts +177 -0
- package/lib/types/node/data/support.d.mts +177 -0
- package/lib/types/node/data/transform-utils.d.cts +236 -0
- package/lib/types/node/data/transform-utils.d.mts +236 -0
- package/lib/types/node/devops/crypto/node.d.cts +65 -0
- package/lib/types/node/devops/crypto/node.d.mts +65 -0
- package/lib/types/node/devops/execute-command/node.d.cts +55 -0
- package/lib/types/node/devops/execute-command/node.d.mts +55 -0
- package/lib/types/node/devops/ftp/node.d.cts +55 -0
- package/lib/types/node/devops/ftp/node.d.mts +55 -0
- package/lib/types/node/devops/github/node.d.cts +61 -0
- package/lib/types/node/devops/github/node.d.mts +61 -0
- package/lib/types/node/devops/gitlab/node.d.cts +61 -0
- package/lib/types/node/devops/gitlab/node.d.mts +61 -0
- package/lib/types/node/devops/jwt/node.d.cts +53 -0
- package/lib/types/node/devops/jwt/node.d.mts +53 -0
- package/lib/types/node/flow/execute-sub-workflow/node.d.cts +63 -0
- package/lib/types/node/flow/execute-sub-workflow/node.d.mts +63 -0
- package/lib/types/node/index.d.cts +230 -2
- package/lib/types/node/index.d.mts +230 -2
- package/lib/types/node/io/airtable/node.d.cts +73 -0
- package/lib/types/node/io/airtable/node.d.mts +73 -0
- package/lib/types/node/io/confluence/node.d.cts +49 -0
- package/lib/types/node/io/confluence/node.d.mts +49 -0
- package/lib/types/node/io/convert-to-file/node.d.cts +75 -0
- package/lib/types/node/io/convert-to-file/node.d.mts +75 -0
- package/lib/types/node/io/extract-from-file/node.d.cts +38 -0
- package/lib/types/node/io/extract-from-file/node.d.mts +38 -0
- package/lib/types/node/io/file-support.d.cts +118 -0
- package/lib/types/node/io/file-support.d.mts +118 -0
- package/lib/types/node/io/google-calendar/node.d.cts +65 -0
- package/lib/types/node/io/google-calendar/node.d.mts +65 -0
- package/lib/types/node/io/google-docs/node.d.cts +51 -0
- package/lib/types/node/io/google-docs/node.d.mts +51 -0
- package/lib/types/node/io/google-sheets/node.d.cts +77 -0
- package/lib/types/node/io/google-sheets/node.d.mts +77 -0
- package/lib/types/node/io/graphql/node.d.cts +46 -0
- package/lib/types/node/io/graphql/node.d.mts +46 -0
- package/lib/types/node/io/html/node.d.cts +68 -0
- package/lib/types/node/io/html/node.d.mts +68 -0
- package/lib/types/node/io/html-extract/node.d.cts +42 -0
- package/lib/types/node/io/html-extract/node.d.mts +42 -0
- package/lib/types/node/io/html-support.d.cts +69 -0
- package/lib/types/node/io/html-support.d.mts +69 -0
- package/lib/types/node/io/http-request/node.d.cts +107 -0
- package/lib/types/node/io/http-request/node.d.mts +107 -0
- package/lib/types/node/io/jira/node.d.cts +57 -0
- package/lib/types/node/io/jira/node.d.mts +57 -0
- package/lib/types/node/io/markdown/node.d.cts +61 -0
- package/lib/types/node/io/markdown/node.d.mts +61 -0
- package/lib/types/node/io/microsoft-excel/node.d.cts +45 -0
- package/lib/types/node/io/microsoft-excel/node.d.mts +45 -0
- package/lib/types/node/io/microsoft-sharepoint/node.d.cts +47 -0
- package/lib/types/node/io/microsoft-sharepoint/node.d.mts +47 -0
- package/lib/types/node/io/read-binary-file/node.d.cts +45 -0
- package/lib/types/node/io/read-binary-file/node.d.mts +45 -0
- package/lib/types/node/io/read-binary-files/node.d.cts +41 -0
- package/lib/types/node/io/read-binary-files/node.d.mts +41 -0
- package/lib/types/node/io/read-pdf/node.d.cts +40 -0
- package/lib/types/node/io/read-pdf/node.d.mts +40 -0
- package/lib/types/node/io/read-write-file/node.d.cts +41 -0
- package/lib/types/node/io/read-write-file/node.d.mts +41 -0
- package/lib/types/node/io/respond-to-webhook/node.d.cts +45 -0
- package/lib/types/node/io/respond-to-webhook/node.d.mts +45 -0
- package/lib/types/node/io/spreadsheet-file/node.d.cts +51 -0
- package/lib/types/node/io/spreadsheet-file/node.d.mts +51 -0
- package/lib/types/node/io/write-binary-file/node.d.cts +55 -0
- package/lib/types/node/io/write-binary-file/node.d.mts +55 -0
- package/lib/types/node/io/xml/node.d.cts +67 -0
- package/lib/types/node/io/xml/node.d.mts +67 -0
- package/lib/types/node/storage/blob/azure/node.d.cts +27 -0
- package/lib/types/node/storage/blob/azure/node.d.mts +27 -0
- package/lib/types/node/storage/blob/base.d.cts +83 -0
- package/lib/types/node/storage/blob/base.d.mts +83 -0
- package/lib/types/node/storage/blob/gcs/node.d.cts +27 -0
- package/lib/types/node/storage/blob/gcs/node.d.mts +27 -0
- package/lib/types/node/storage/blob/s3/node.d.cts +39 -0
- package/lib/types/node/storage/blob/s3/node.d.mts +39 -0
- package/lib/types/node/storage/database/base.d.cts +97 -0
- package/lib/types/node/storage/database/base.d.mts +97 -0
- package/lib/types/node/storage/database/mssql/node.d.cts +8 -0
- package/lib/types/node/storage/database/mssql/node.d.mts +8 -0
- package/lib/types/node/storage/database/mysql/node.d.cts +8 -0
- package/lib/types/node/storage/database/mysql/node.d.mts +8 -0
- package/lib/types/node/storage/database/postgres/node.d.cts +8 -0
- package/lib/types/node/storage/database/postgres/node.d.mts +8 -0
- package/lib/types/node/storage/rabbitmq/node.d.cts +55 -0
- package/lib/types/node/storage/rabbitmq/node.d.mts +55 -0
- package/lib/types/node/storage/redis/node.d.cts +68 -0
- package/lib/types/node/storage/redis/node.d.mts +68 -0
- package/lib/types/node/storage/support.d.cts +36 -0
- package/lib/types/node/storage/support.d.mts +36 -0
- package/lib/types/node/triggers/error/node.d.cts +34 -0
- package/lib/types/node/triggers/error/node.d.mts +34 -0
- package/lib/types/node/triggers/execute-workflow/node.d.cts +25 -0
- package/lib/types/node/triggers/execute-workflow/node.d.mts +25 -0
- package/lib/types/node/triggers/postgres/node.d.cts +54 -0
- package/lib/types/node/triggers/postgres/node.d.mts +54 -0
- package/lib/types/node/triggers/rabbitmq/node.d.cts +59 -0
- package/lib/types/node/triggers/rabbitmq/node.d.mts +59 -0
- package/lib/types/node/triggers/redis/node.d.cts +53 -0
- package/lib/types/node/triggers/redis/node.d.mts +53 -0
- package/lib/types/node/triggers/sse/node.d.cts +43 -0
- package/lib/types/node/triggers/sse/node.d.mts +43 -0
- package/lib/types/node/triggers/support.d.cts +41 -0
- package/lib/types/node/triggers/support.d.mts +41 -0
- package/lib/types/node/triggers/workflow/node.d.cts +46 -0
- package/lib/types/node/triggers/workflow/node.d.mts +46 -0
- package/lib/types/ram/GraphRunEventModel.d.cts +6 -0
- package/lib/types/ram/GraphRunEventModel.d.mts +6 -0
- package/lib/types/shared/graph/GraphNodeModel.d.cts +6 -0
- package/lib/types/shared/graph/GraphNodeModel.d.mts +6 -0
- package/lib/types/shared/graph/GraphWorkflowModel.d.cts +6 -0
- package/lib/types/shared/graph/GraphWorkflowModel.d.mts +6 -0
- package/lib/types/shared/graph/catalog/GraphPortManifest.d.cts +7 -0
- package/lib/types/shared/graph/catalog/GraphPortManifest.d.mts +7 -0
- package/lib/types/shared/graph/constants.d.cts +39 -0
- package/lib/types/shared/graph/constants.d.mts +39 -0
- package/lib/types/typeorm/TypeormGraphAdapter.d.cts +32 -0
- package/lib/types/typeorm/TypeormGraphAdapter.d.mts +32 -0
- package/lib/types/typeorm/index.d.cts +11 -0
- package/lib/types/typeorm/index.d.mts +11 -0
- package/lib/types/workflows/boundary-value.workflow.d.cts +3 -0
- package/lib/types/workflows/boundary-value.workflow.d.mts +3 -0
- package/lib/types/workflows/builders.d.cts +31 -0
- package/lib/types/workflows/builders.d.mts +31 -0
- package/lib/types/workflows/chat-agent.workflow.d.cts +3 -0
- package/lib/types/workflows/chat-agent.workflow.d.mts +3 -0
- package/lib/types/workflows/error-boundary.workflow.d.cts +3 -0
- package/lib/types/workflows/error-boundary.workflow.d.mts +3 -0
- package/lib/types/workflows/event-map.workflow.d.cts +3 -0
- package/lib/types/workflows/event-map.workflow.d.mts +3 -0
- package/lib/types/workflows/foreach-break.workflow.d.cts +3 -0
- package/lib/types/workflows/foreach-break.workflow.d.mts +3 -0
- package/lib/types/workflows/human-approval.workflow.d.cts +3 -0
- package/lib/types/workflows/human-approval.workflow.d.mts +3 -0
- package/lib/types/workflows/if-switch.workflow.d.cts +3 -0
- package/lib/types/workflows/if-switch.workflow.d.mts +3 -0
- package/lib/types/workflows/index.d.cts +37 -0
- package/lib/types/workflows/index.d.mts +37 -0
- package/lib/types/workflows/loops-while-until.workflow.d.cts +3 -0
- package/lib/types/workflows/loops-while-until.workflow.d.mts +3 -0
- package/lib/types/workflows/manual-log.workflow.d.cts +3 -0
- package/lib/types/workflows/manual-log.workflow.d.mts +3 -0
- package/lib/types/workflows/schedule-code.workflow.d.cts +3 -0
- package/lib/types/workflows/schedule-code.workflow.d.mts +3 -0
- package/lib/types/workflows/types.d.cts +32 -0
- package/lib/types/workflows/types.d.mts +32 -0
- package/lib/types/workflows/value-templates.workflow.d.cts +16 -0
- package/lib/types/workflows/value-templates.workflow.d.mts +16 -0
- package/lib/types/workflows/webhook-form.workflow.d.cts +3 -0
- package/lib/types/workflows/webhook-form.workflow.d.mts +3 -0
- package/package.json +283 -21
package/dist/as-graph.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{logParameterRegistry as e,Logging as t,LoggedEnvironment as o}from"@decaf-ts/logging";import{RenderingEngine as n,uimodel as r,uielement as i,uilistprop as a,uilistmodel as s,hidden as d}from"@decaf-ts/ui-decorators";import{Metadata as l,Decoration as c,apply as u,metadata as p,propMetadata as h,description as f,prop as g,DefaultFlavour as m}from"@decaf-ts/decoration";import{ValidationKeys as y,Model as w,required as b,type as v,date as I,model as E,option as N,min as k,max as O}from"@decaf-ts/decorator-validation";import{ValidationError as A,InternalError as x,NotFoundError as _}from"@decaf-ts/db-decorators";import{__decorate as S,__metadata as D}from"tslib";import{pk as P,column as R,index as $,table as C,BaseModel as T,ForbiddenError as L,Context as M,repository as j,Repository as G,AuthorizationError as U,service as F,Service as B,ClientBasedService as W,Adapter as q,ModelService as H,OrderDirection as K}from"@decaf-ts/core";import V from"isolated-vm";import*as z from"acorn";import*as J from"acorn-walk";import*as X from"typescript";import{createHash as Y}from"node:crypto";var Q,Z;y.REQUIRED,y.MIN,y.MIN_LENGTH,y.MAX,y.MAX_LENGTH,y.PATTERN,y.URL,y.STEP,y.DATE,y.EMAIL,y.PASSWORD,y.EQUALS,y.DIFF,y.LESS_THAN,y.LESS_THAN_OR_EQUAL,y.GREATER_THAN,y.GREATER_THAN_OR_EQUAL,(e=>{e.GRAPH="graph",e.NODE="graph.node",e.EDGE="graph.edge",e.PORT="graph.port",e.STATE="graph.state"})(Q||(Q={})),(e=>{e.INPUT="input",e.OUTPUT="output",e.CONNECTION="connection"})(Z||(Z={}));const ee={};function te(e,t={}){let o=e.width??96,n=e.height??96;for(const r of e.sizeRules??[]){if("parameterCount"!==r.type)continue;const e=t[r.parameter]??0;e>0&&("width"===r.dimension?o+=e*r.perItem:n+=e*r.perItem)}return{width:o,height:n}}function oe(e,t){ee[e]=t}function ne(e,t,o){const n=t?ee[t]:void 0;return n?.color?n.color:e||"#64748b"}function re(e,t,o){const n=t?ee[t]:void 0;return n?.icon?n.icon:e||"ti-pointer"}const ie=["skip","passThroughFirstInput","emitDefaults"];function ae(e){return ie.includes(e)}var se,de,le,ce;(e=>{e.PENDING="pending",e.PLANNING="planning",e.RUNNING="running",e.SUCCEEDED="succeeded",e.FAILED="failed",e.SKIPPED="skipped",e.CANCELLED="cancelled",e.CACHED="cached"})(se||(se={})),(e=>{e.IDLE="idle",e.RUNNING="running",e.BLOCKED="blocked",e.SUCCEEDED="succeeded",e.FAILED="failed",e.SKIPPED="skipped"})(de||(de={})),(e=>{e.NODE_ID="nodeId",e.WORKFLOW_ID="workflowId",e.RUN_ID="runId",e.USER="user",e.ROLES="roles",e.NAMESPACES="namespaces",e.ORGANIZATION="organization",e.IP="ip"})(le||(le={})),(e=>{e.WORKFLOW_STARTED="workflow.started",e.WORKFLOW_PLANNED="workflow.planned",e.WORKFLOW_COMPLETED="workflow.completed",e.WORKFLOW_FAILED="workflow.failed",e.WORKFLOW_CANCELLED="workflow.cancelled",e.WORKFLOW_SUSPENDED="workflow.suspended",e.WORKFLOW_RESUMED="workflow.resumed",e.NODE_QUEUED="node.queued",e.NODE_STARTED="node.started",e.NODE_OUTPUT="node.output",e.NODE_COMPLETED="node.completed",e.NODE_FAILED="node.failed",e.NODE_SKIPPED="node.skipped",e.NODE_CACHE_HIT="node.cacheHit",e.NODE_PINNED="node.pinned",e.NODE_UNPINNED="node.unpinned",e.NODE_STATE_CHANGED="node.stateChanged",e.EDGE_VALUE_ROUTED="edge.valueRouted",e.EDGE_STATE_CHANGED="edge.stateChanged",e.GRAPH_RUN_LOG="graph.run.log",e.LOOP_STARTED="loop.started",e.LOOP_ITERATION_STARTED="loop.iteration.started",e.LOOP_ITERATION_COMPLETED="loop.iteration.completed",e.LOOP_CONDITION_EVALUATED="loop.condition.evaluated",e.LOOP_COMPLETED="loop.completed",e.LOOP_LIMIT_REACHED="loop.limitReached",e.VALIDATION_STARTED="validation.started",e.VALIDATION_FAILED="validation.failed",e.VALIDATION_COMPLETED="validation.completed",e.STORE_READ="store.read",e.STORE_WRITE="store.write",e.STORE_DELETE="store.delete"})(ce||(ce={}));const ue={maxRequestBytes:4e6,maxConcurrentRuns:32,maxEventsPerRun:1e4,maxEventPayloadBytes:256e3,executionTimeoutMs:6e5,eventReplayWindowMs:3e5},pe=[ce.WORKFLOW_COMPLETED,ce.WORKFLOW_FAILED,ce.WORKFLOW_CANCELLED];function he(e){return pe.includes(e)}function fe(e){if(!Array.isArray(e))return;const t=e.filter(e=>"string"==typeof e&&e.length>0);return t.length?t:void 0}function ge(e){const t=l.constr(e);if("function"==typeof t)return t;const o=e.constructor;return"function"==typeof o?o:e}function me(e){if(null!=e)return"string"==typeof e?e:e+""}function ye(e,t,o){return me(e?.props?.label??e?.props?.name)??me(t?.name)??o??""}function we(e,t,o){const n=Ie(e,t);if(n?.model&&"function"==typeof n.model&&w.isModel(n.model))return n.model;const r=l.type(e,t);if("function"==typeof r&&w.isModel(r))return r;const i=l.getPropDesignTypes?.(e,t)?.designTypes||[];for(const e of i)if("function"==typeof e&&w.isModel(e))return e;const a=o?.[y.TYPE]?.customTypes||[];for(const e of a)if("function"==typeof e&&w.isModel(e))return e}function be(e,t){const o=[t,e.path??e.property].filter(Boolean).join(".");return{...e,path:o,children:e.children?.map(e=>be(e,o))}}function ve(e){const t=ge(e);return l.get(t,Q.NODE)}function Ie(e,t){const o=ge(e);return l.get(o,l.key(Q.PORT,t+""))}function Ee(e,t,o,n=new Set){const r=Ie(e,t);if(!r?.schema)return;const i=we(e,t,l.validationFor(e,t));if(!i)return;if(n.has(i))return[];const a=new Set(n);return a.add(e),a.add(i),Oe(i,a).filter(e=>e.direction===o)}function Ne(e,t,o=new Set){const n=Ie(e,t);if(!n)return;const r=l.validationFor(e,t),i=we(e,t,r);if(n.schema&&i)return;const a=w.uiElementOf(e,t)||void 0,s=w.uiDecorationOf(e,t,"uiprop"),d=l.type(e,t),c=me(n.type??r?.[y.TYPE]?.customTypes?.[0]?.name??a?.props?.type??s?.type??d?.name),u=(n.expand||i&&!o.has(i))&&i?(()=>{const n=new Set(o);return n.add(e),n.add(i),Oe(i,n).map(e=>be(e,t))})():void 0;return{property:t,path:t,direction:n.direction,name:t,label:ye(a,s,t),type:c?.toLowerCase(),required:!!r?.[y.REQUIRED],hidden:!!w.uiIsHidden(e,t),designType:d?.name,element:a,prop:s,validation:r,graph:n,connectionRules:n.connectionRules,composite:!!u?.length,children:u,model:i?.name}}function ke(e){return Oe(ge(e))}function Oe(e,t=new Set){const o=l.properties(e)||[],n=[];for(const r of o){const o=r+"",i=Ie(e,o);if(i?.schema){const r=Ee(e,o,i.direction,t);if(r){n.push(...r);continue}}const a=Ne(e,o,t);a&&n.push(a)}return n}function Ae(e){return e.flatMap(e=>e.children&&e.children.length?Ae(e.children):[e])}function xe(e){const t=ge(e),o=w.uiModelOf(t),n=ve(t)||{},r=o?.tag||t.name,i=ke(t),a=((e,t)=>{const o=t.portGroups||[],n=new Map(o.map(e=>[e.property,e])),r=[],i=l.properties(e)||[];for(const t of i){const o=t+"",i=Ie(e,o);if(!i?.schema)continue;if(!we(e,o,l.validationFor(e,o)))continue;const a=n.get(o);r.push(a?{...a,toggle:a.toggle??"all"}:{property:o,toggle:"all"})}for(const e of o)r.some(t=>t.property===e.property)||r.push(e);return r.length?r:void 0})(t,n),s=n.namespaces?.length?n.namespaces:(e=>{if(null==e)return[];let t,o=e;try{o=l.constr(e)}catch{o=e}try{t=l.get(o,"auth-namespace")}catch{t=void 0}return fe(t)??[]})(t),d=s.length?s:void 0;return{name:t.name,tag:r,kind:n.kind||r,category:n.category,color:n.color,effectiveColor:ne(n.color,n.category),group:n.group,height:n.height,icon:n.icon,effectiveIcon:re(n.icon,n.category),labels:n.labels||[],maxChildren:n.maxChildren,minWidth:n.minWidth,width:n.width,shape:n.shape,cornerRadius:n.cornerRadius,sizeRules:n.sizeRules,props:o?.props,ui:o,graph:n,ports:i,portGroups:a,namespaces:d}}const _e=new Set,Se=new Set;function De(e,t,o){return c.for(Q.NODE).define({decorator:(e,t,o)=>{const n={kind:t?.kind||e,...t};return t=>{const i=u(r(e,o),p(Q.NODE,n))(t);var a;return a=t,_e.add(a),i}},args:[e,t,o]}).apply()}function Pe(e,t){return c.for(Q.PORT).define({decorator:(e,t)=>(o,n)=>{const r={direction:e,...t};return u(h(l.key(Q.PORT,n),r))(o,n)},args:[e,t]}).apply()}function Re(e){return Pe(Z.INPUT,{...e,schema:!0})}function $e(e){return Pe(Z.OUTPUT,{...e,schema:!0})}function Ce(e){return Pe(Z.CONNECTION,e)}n.prototype.renderAsNode=(e,t,...o)=>xe(e),l.nodes=(()=>[..._e]).bind(l),l.workflows=(()=>[...Se]).bind(l);const Te=["__proto__","prototype","constructor"];function Le(e){return Te.includes(e)}function Me(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function je(e){return null===e||"string"==typeof e||"number"==typeof e&&Number.isFinite(e)||"boolean"==typeof e}function Ge(e){return!!je(e)||(Array.isArray(e)?e.every(e=>Ge(e)):!!Me(e)&&Reflect.ownKeys(e).every(t=>"string"==typeof t&&!Le(t)&&Ge(e[t])))}function Ue(e){if(void 0===e)return!1;if("number"==typeof e)return Number.isFinite(e);if("function"==typeof e)return!1;if(Ge(e))return!0;if(Array.isArray(e))return e.every(e=>Ue(e));if(Me(e)){const t=Reflect.ownKeys(e);for(const o of t){if("string"!=typeof o)return!1;if(Le(o))return!1;if(!Ue(e[o]))return!1}return!0}return!1}function Fe(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(e=>Fe(e));const t={};for(const[o,n]of Object.entries(e))t[o]=Fe(n);return t}const Be={string:"string",char:"string",text:"string",textarea:"string",radio:"string",select:"string",number:"number",integer:"number",float:"number",double:"number",decimal:"number",boolean:"boolean",bool:"boolean",checkbox:"boolean",array:"array",list:"array",set:"array",object:"object",model:"model",any:"any",unknown:"any",enum:"enum"},We={date:"date",datetime:"date-time","date-time":"date-time",duration:"duration"};function qe(e){return e?Be[e.toLowerCase()]??"any":"any"}function He(e,t){const o=e[t];if(o&&"object"==typeof o)return o.value}function Ke(e,t){const o=He(e,t);return"number"==typeof o&&Number.isFinite(o)?o:void 0}function Ve(e,t,o){const n=e??{},r=(e=>{const t=He(e,y.ENUM);if(Array.isArray(t)&&t.every(je))return t})(n);if(r)return{type:"enum",values:r};const i=(e=>{const t=e[y.TYPE],o=t?.customTypes?.[0],n="function"==typeof o?o.name:o?.name;if(n)return n})(n)??o;return i?{type:"model",name:i}:((e,t)=>{switch(qe(e)){case"string":{const t=(e=>{if(e)return We[e.toLowerCase()]})(e);return void 0!==t?{type:"string",format:t}:{type:"string"}}case"number":{const o={type:"number"};e&&"integer"===e.toLowerCase()&&(o.integer=!0);const n=Ke(t,y.MIN),r=Ke(t,y.MAX);return void 0!==n&&(o.min=n),void 0!==r&&(o.max=r),o}case"boolean":return{type:"boolean"};case"array":return((e,t)=>{const o={type:"array",items:ze(e,t)},n=Ke(e,y.MIN),r=Ke(e,y.MAX);return void 0!==n&&(o.minItems=n),void 0!==r&&(o.maxItems=r),o})(t,e);case"object":return{type:"object",properties:{}};case"enum":return{type:"enum",values:[]};case"model":return{type:"model",name:e??"any"};default:return{type:"any"}}})(t,n)}function ze(e,t){if((e=>{const t=e[y.LIST];return!!t?.clazz?.length})(e))return{type:"model",name:Je(e)};const o=He(e,y.TYPE);if("string"==typeof o){const e=qe(o);return"model"===e?{type:"model",name:o}:{type:e}}if(t&&"array"!==t){const e=qe(t);return"model"===e?{type:"model",name:t}:{type:e}}return{type:"any"}}function Je(e){const t=e[y.LIST],o=t?.clazz?.[0];if("function"!=typeof o)return"any";if(o.name)return o.name;try{const e=o();if("function"==typeof e&&e.name)return e.name}catch{return"any"}return"any"}function Xe(e){return"workflow"===e.scope}function Ye(e){return"node"===e.scope}function Qe(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"workflow"===t.scope?"string"==typeof t.port&&2===Reflect.ownKeys(t).length:"node"===t.scope&&"string"==typeof t.nodeId&&"string"==typeof t.port&&3===Reflect.ownKeys(t).length}function Ze(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e.mode;if("edge"===t)return 1===Reflect.ownKeys(e).length;if("literal"===t){const t=e.value;return 2===Object.keys(e).length&&Ge(t)}return"expression"===t&&2===Object.keys(e).length&&"string"==typeof e.expression}const et=["any","string","number","boolean","array","object","enum","model"];function tt(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&(e=>et.includes(e))(e.type)}function ot(e,t={seen:[]}){if(t.seen.includes(e))throw new A(`Document '${(e=>{const t=e?.id;return"string"==typeof t?t:"<unnamed document>"})(e)}' contains a loop body that references itself (cyclic document)`);if("string"!=typeof e.id||!e.id)throw new A("Document 'id' is required and must be a non-empty string");if("string"!=typeof e.name||!e.name)throw new A("Document 'name' is required and must be a non-empty string");const o=new Set;for(const t of[...e.inputs,...e.outputs]){if("string"!=typeof t.id||!t.id)throw new A("Workflow port 'id' is required and must be a non-empty string");if(o.has(t.id))throw new A(`Workflow port '${t.id}' is declared more than once; workflow port ids must be unique`);if(void 0!==t.schema&&!tt(t.schema))throw new A(`Workflow port '${t.id}' schema must be a valid GraphValueSchema`);o.add(t.id)}const n={seen:[...t.seen,e]},r=new Set;for(const t of e.nodes)nt(t,r);for(const t of e.nodes)t.loop&&rt(t,t.loop,n),t.errorBoundary&&it(t,t.errorBoundary,n);const i=new Set;for(const t of e.edges)st(t,i);for(const t of e.edges)dt(t.source,0,o,r,`Edge '${t.id}' source`),dt(t.target,0,o,r,`Edge '${t.id}' target`);if(void 0!==e.settings&&!Ue(e.settings))throw new A("Document settings must be JSON-safe (a map of JSON-safe values)");if(void 0!==e.metadata&&!Ue(e.metadata))throw new A("Document metadata must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys, or unsafe prototype keys are not allowed");if(void 0!==e.ui&&!Ue(e.ui))throw new A("Document ui must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys, or unsafe prototype keys are not allowed")}function nt(e,t){if("string"!=typeof e.id||!e.id)throw new A("Node 'id' is required and must be a non-empty string");if(t.has(e.id))throw new A(`Node id '${e.id}' is declared more than once; node ids must be unique`);if("string"!=typeof e.kind||!e.kind)throw new A(`Node '${e.id}' must declare a non-empty string 'kind'`);if(void 0===e.parameters||null===e.parameters)throw new A(`Node '${e.id}' parameters must be present (an empty object when there are none)`);if(t.add(e.id),e.inputBindings)for(const[t,o]of Object.entries(e.inputBindings)){if(Le(t))throw new A(`Node '${e.id}' input binding key '${t}' is not allowed (unsafe prototype-pollutant key)`);if(!Ze(o))throw new A(`Node '${e.id}' input binding for '${t}' must be a valid GraphInputBinding (edge, literal, or expression)`);if("literal"===o.mode&&!Ue(o.value))throw new A(`Node '${e.id}' literal binding for '${t}' must contain JSON-safe values`);if("expression"===o.mode&&!o.expression)throw new A(`Node '${e.id}' expression binding for '${t}' must contain a non-empty expression`)}if(e.outputBindings)for(const[t,o]of Object.entries(e.outputBindings)){if(Le(t))throw new A(`Node '${e.id}' output binding key '${t}' is not allowed (unsafe prototype-pollutant key)`);if(!o||"object"!=typeof o||Array.isArray(o))throw new A(`Node '${e.id}' output binding for '${t}' must be an object with enabled and alias settings`)}if(!Ue(e.parameters))throw new A(`Node '${e.id}' parameters must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys, or unsafe prototype keys are not allowed`);if(void 0!==e.state){if(!e.state||"object"!=typeof e.state||Array.isArray(e.state))throw new A(`Node '${e.id}' state must be an object when present`);if(!Ue(e.state))throw new A(`Node '${e.id}' state must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys, or unsafe prototype keys are not allowed`)}}function rt(e,t,o){if(!t.body||"object"!=typeof t.body)throw new A(`Node '${e.id}' loop configuration requires a body document`);if(ot(t.body,o),!(void 0===t.maxIterations||Number.isFinite(t.maxIterations)&&t.maxIterations>0))throw new A(`Node '${e.id}' loop maxIterations must be a positive number`);if(void 0!==t.timeoutMs&&("number"!=typeof t.timeoutMs||0>=t.timeoutMs))throw new A(`Node '${e.id}' loop timeoutMs must be a positive number in milliseconds`);if(void 0!==t.concurrency&&("number"!=typeof t.concurrency||0>=t.concurrency))throw new A(`Node '${e.id}' loop concurrency must be a positive number`);for(const o of[t.inputMappings,t.outputMappings])if(o)for(const[t,n]of Object.entries(o)){if(Le(t))throw new A(`Node '${e.id}' loop mapping key '${t}' is not allowed (unsafe prototype-pollutant key)`);at(n,e.id,t)}}function it(e,t,o){if(!t.try||"object"!=typeof t.try)throw new A(`Node '${e.id}' error-boundary configuration requires a try body document`);ot(t.try,o);for(const[n,r]of[["catch",t.catch],["finally",t.finally]])if(void 0!==r){if(!r||"object"!=typeof r)throw new A(`Node '${e.id}' error-boundary ${n} body must be a document`);ot(r,o)}}function at(e,t,o){if(!e||"object"!=typeof e)throw new A(`Node '${t}' loop mapping '${o}' must reference a workflow port, node port, literal, or expression`);switch(e.source){case"workflow":if("string"!=typeof e.port||!e.port)throw new A(`Node '${t}' loop mapping '${o}' referencing a workflow must reference a port identifier`);break;case"node":if("string"!=typeof e.nodeId||!e.nodeId||"string"!=typeof e.port||!e.port)throw new A(`Node '${t}' loop mapping '${o}' referencing a node must reference a node id and a port`);break;case"literal":if(!Ue(e.value))throw new A(`Node '${t}' loop mapping '${o}' literal references must be JSON-safe values`);break;case"expression":if("string"!=typeof e.expression||!e.expression)throw new A(`Node '${t}' loop mapping '${o}' expression references must be non-empty expressions`);break;default:throw new A(`Node '${t}' loop mapping '${o}' must use a workflow, node, literal, or expression reference source`)}}function st(e,t){if("string"!=typeof e.id||!e.id)throw new A("Edge 'id' is required and must be a non-empty string");if(t.has(e.id))throw new A(`Edge id '${e.id}' is declared more than once; edge ids must be unique`);if(!Qe(e.source))throw new A(`Edge '${e.id}' source endpoint is not a valid GraphEndpoint`);if(!Qe(e.target))throw new A(`Edge '${e.id}' target endpoint is not a valid GraphEndpoint`);if("data"!==e.type&&"connection"!==e.type)throw new A(`Edge '${e.id}' type '${e.type+""}' is not a valid edge type (data or connection are allowed)`);if(t.add(e.id),!Ue(e))throw new A(`Edge '${e.id}' contains values that are not JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys, or unsafe prototype keys are not allowed`)}function dt(e,t,o,n,r){if(Xe(e)){if(!o.has(e.port))throw new A(`${r} references workflow port '${e.port}' which is not declared on the document`)}else if(Ye(e)){if(!n.has(e.nodeId))throw new A(`${r} references node '${e.nodeId}' which is not part of the document`);if("string"!=typeof e.port||!e.port)throw new A(r+" node endpoints must reference a non-empty port identifier")}}const lt=["expression","template"],ct=["javascript","typescript","json","text"];function ut(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return!(!(e=>lt.includes(e))(t.mode)||"string"!=typeof t.expression||!t.expression||void 0!==t.language&&!(e=>ct.includes(e))(t.language)||void 0!==t.metadata&&!Ge(t.metadata))}function pt(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.id&&"string"==typeof t.name&&Array.isArray(t.inputs)&&Array.isArray(t.outputs)&&Array.isArray(t.nodes)&&Array.isArray(t.edges)}function ht(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.type&&(void 0===t.required||"boolean"==typeof t.required)&&(void 0===t.displayName||"string"==typeof t.displayName)&&(void 0===t.allowedOperations||Array.isArray(t.allowedOperations)&&t.allowedOperations.every(e=>"string"==typeof e))}const ft=["trigger","loop","branching","stateful","retryable","cancellable","parallel","resource"];function gt(e){return ft.includes(e)}function mt(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.kind&&"object"==typeof t.display&&Array.isArray(t.inputs)&&Array.isArray(t.outputs)&&Array.isArray(t.parameters)}function yt(e){if(!mt(e))throw new A("Graph node manifest does not conform to the required shape");if(!Ue(e))throw new A("Graph node manifest contains values that are not JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys or unsafe prototype keys are not allowed on manifests")}function wt(e){return yt(e),Fe(e)}function bt(e){if(!mt(e))throw new A("Serialized graph node manifest does not conform to the required shape");return Fe(e)}const vt=["loadOptions","listSearch","resourceLocator","resourceMapping","validateParameter","action"];function It(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.name&&(e=>vt.includes(e))(t.type)&&(void 0===t.parameter||"string"==typeof t.parameter)&&(void 0===t.dependencies||Array.isArray(t.dependencies)&&t.dependencies.every(e=>"string"==typeof e))}function Et(e){const t=e.element?.props?.value,o=t??e.prop?.value??e.validation?.defaultValue;if(void 0!==o&&"function"!=typeof o&&Ue(o))try{return JSON.parse(JSON.stringify(o))}catch{return}}function Nt(e){if(e.type&&e.type in We)return{type:"string",format:We[e.type]};const t=(e=>{for(const t of[e.graph?.type,e.element?.props?.type,e.prop?.type])if("string"==typeof t&&"any"!==qe(t))return t})(e);return t?Ve((e=>{if(!e)return;const t=Object.entries(e).filter(([e])=>e!==y.TYPE);return Object.fromEntries(t)})(e.validation),t):Ve(e.validation,e.type,e.model)}function kt(e){const t={};for(const[o,n]of Object.entries(e.graph?.metadata??{}))Ue(n)&&(t[o]=JSON.parse(JSON.stringify(n)));return Object.keys(t).length?t:void 0}function Ot(e){switch(e){case"output":return"output";case"connection":return"connection";default:return"input"}}function At(e){const t=e.graph?.handle;return"connection"!==e.direction&&"string"==typeof t&&t?t:e.path??e.property}function xt(e,t){const o={id:At(e),label:e.label,direction:Ot(e.direction),schema:Nt(e)};e.required&&(o.required=!0),e.hidden&&(o.hidden=!0);const n=e.graph?.category;"string"==typeof n&&(o.category=n),!0===e.graph?.userControlled&&(o.configurable=!0);const r=e.graph?.handle;"string"==typeof r&&(o.handle=r);const i=Mt(e.graph?.connectionRules)??t;i&&(o.connectionPolicy=i);const a=(e=>{const t=e.element;if(!t||!Ue(t))return;const o=t.tag;if("string"!=typeof o)return;const n=t.props;return{tag:o,serialize:!0===t.serialize,props:n&&"object"==typeof n&&!Array.isArray(n)?Fe(n):{}}})(e);a&&(o.element=a);const s=kt(e);return s&&(o.metadata=s),o}function _t(e){const t={type:"string",id:At(e),label:e.label,required:e.required};if(e.hidden)return((e,t)=>{const o={...t,type:"hidden"},n=Et(e);return void 0!==n&&(o.defaultValue=n),St(o)})(e,t);const o=Et(e);void 0!==o&&(t.defaultValue=o);const n=(e=>{const t=e.element?.props?.placeholder??e.prop?.placeholder;return"string"==typeof t?t:void 0})(e);n&&(t.placeholder=n);const r=kt(e);if(r&&(t.metadata=r),(e=>{const t=Rt(e);return"code"===t||"code-editor"===t})(e))return St({...t,type:"code",language:Tt(e)});const i=Nt(e);switch(i.type){case"number":{const o={...t,type:"number",integer:i.integer,min:i.min,max:i.max},n=Pt(e.validation?.step);return void 0!==n&&(o.step=n),St(o)}case"boolean":return St({...t,type:"boolean"});case"enum":return St({...t,type:"options",options:i.values.map(e=>({value:e,label:e+""}))});case"array":{const e={...t,type:"collection"};return void 0!==i.maxItems&&(e.maxItems=i.maxItems),St(e)}case"object":case"model":return St({...t,type:"object"});default:return St({...t,type:"string",multiline:!!$t(e)||void 0,pattern:Dt(e.validation?.pattern),minLength:Pt(e.validation?.minlength),maxLength:Pt(e.validation?.maxlength)})}}function St(e){const t=e;for(const e of Object.keys(t))void 0===t[e]&&delete t[e];return e}function Dt(e){const t=e?.value;return"string"==typeof t?t:void 0}function Pt(e){const t=e?.value;return"number"==typeof t&&Number.isFinite(t)?t:void 0}function Rt(e){const t=e.element?.tag;return"string"==typeof t&&t?t:void 0}function $t(e){return"textarea"===Rt(e)||"textarea"===(e=>{const t=e.element?.props?.type;return"string"==typeof t?t:void 0})(e)}const Ct=["javascript","typescript","json","text"];function Tt(e){const t=e.element?.props?.language;return"string"==typeof t&&Ct.includes(t)?t:"javascript"}function Lt(e,t){const o={name:t.name??e.name},n=e.graph?.metadata?.description??void 0;"string"==typeof n&&n&&(o.description=n);const r=t.category??e.category;"string"==typeof r&&r&&(o.category=r),"string"==typeof e.group&&e.group&&(o.group=e.group),Array.isArray(e.labels)&&(o.labels=e.labels.slice());const i=((e,t)=>{if(t.icon)return t.icon;const o=e.effectiveIcon??e.icon;return"string"==typeof o?{type:"catalogue",name:o}:{type:"catalogue",name:"ph:circuitry"}})(e,t);return i&&(o.icon=i),"string"==typeof e.color&&e.color&&(o.color=e.color),"number"==typeof e.width&&Number.isFinite(e.width)&&(o.width=e.width),"number"==typeof e.minWidth&&Number.isFinite(e.minWidth)&&(o.minWidth=e.minWidth),"number"==typeof e.height&&Number.isFinite(e.height)&&(o.height=e.height),"string"==typeof e.shape&&(o.shape=e.shape),"number"==typeof e.cornerRadius&&Number.isFinite(e.cornerRadius)&&(o.cornerRadius=e.cornerRadius),Array.isArray(e.sizeRules)&&(o.sizeRules=e.sizeRules),o}function Mt(e){if(!e)return;const t=e,o={};"boolean"==typeof t.allowSelf&&(o.allowSelf=t.allowSelf),"boolean"==typeof t.allowMultiple&&(o.allowMultiple=t.allowMultiple);const n=t.allowedKinds;Array.isArray(n)&&n.every(e=>"string"==typeof e)&&(o.allowedNodeKinds=n);const r=t.blockedKinds;Array.isArray(r)&&r.every(e=>"string"==typeof e)&&(o.blockedNodeKinds=r);const i=t.maxConnections;return"number"==typeof i&&Number.isFinite(i)&&(o.maxConnections=i),Object.keys(o).length?o:void 0}function jt(e,t={}){const o="function"==typeof e?e:e.constructor;if(!ve(o))throw new A(`Node '${o?.name??e+""}' is not decorated with @node and cannot produce a manifest`);const n=xe(o),r=Ae(ke(o)),i=[],a=[],s=[],d=[],l=Mt(n.graph?.connectionRules);for(const e of r)("connection"===e.direction?s:"output"===e.direction?a:i).push(xt(e,l)),"input"===e.direction&&d.push(_t(e));const c={kind:t.kind??n.kind??n.name,display:Lt(n,t),inputs:i,outputs:a,parameters:d};return s.length&&(c.connections=s),n.namespaces?.length&&(c.namespaces=n.namespaces.slice()),yt(c),c}var Gt,Ut;(e=>{e.READABILITY="readability",e.COMPACTNESS="compactness",e.BALANCED="balanced"})(Gt||(Gt={})),(e=>{e.TIGHT="tight",e.NORMAL="normal",e.COMFORTABLE="comfortable"})(Ut||(Ut={})),Ut.TIGHT,Ut.NORMAL,Ut.COMFORTABLE,Gt.READABILITY,Ut.COMFORTABLE,Gt.COMPACTNESS,Ut.TIGHT,Gt.BALANCED,Ut.NORMAL;let Ft=class extends T{constructor(e){super(e)}};S([P({type:String,generated:!1}),f("Unique graph run id"),i("ngx-decaf-crud-field",{label:"graph.run.id.label",readonly:!0}),D("design:type",String)],Ft.prototype,"runId",void 0),S([R(),b(),$(),f("Workflow document id the run executes"),a("workflowId"),i("ngx-decaf-crud-field",{label:"graph.run.workflowId.label"}),D("design:type",String)],Ft.prototype,"workflowId",void 0),S([R(),f("Owning user; absent for anonymous callers"),i("ngx-decaf-crud-field",{label:"graph.run.owner.label"}),D("design:type",String)],Ft.prototype,"owner",void 0),S([R(),b(),v(String),$(),f("Current run lifecycle status"),a("status"),i("ngx-decaf-crud-field",{label:"graph.run.status.label",readonly:!0}),D("design:type",String)],Ft.prototype,"status",void 0),S([R(),f("Fingerprint of the executed document"),i("ngx-decaf-crud-field",{label:"graph.run.fingerprint.label",readonly:!0}),D("design:type",String)],Ft.prototype,"documentFingerprint",void 0),S([R(),g(),f("Workflow input values keyed by input port id"),D("design:type",Object)],Ft.prototype,"inputs",void 0),S([R(),g(),f("Execution result, present on successful completion"),D("design:type",Object)],Ft.prototype,"result",void 0),S([R(),g(),f("Structured error payload, present on failure"),D("design:type",Object)],Ft.prototype,"error",void 0),S([I(),R(),f("Run creation timestamp"),D("design:type",Date)],Ft.prototype,"createdAt",void 0),S([I(),R(),f("Execution start timestamp, once it has started"),D("design:type",Date)],Ft.prototype,"startedAt",void 0),S([I(),R(),f("Terminal-state timestamp, once the run has finished"),D("design:type",Date)],Ft.prototype,"finishedAt",void 0),Ft=S([s("ngx-decaf-list-item",{icon:"ti-player-play"}),r("ngx-decaf-crud-form"),f("Persistable graph run lifecycle record"),C("graph_run"),E(),D("design:paramtypes",[Object])],Ft);let Bt=class extends T{constructor(e){super(e)}};S([P({type:String,generated:!1}),D("design:type",String)],Bt.prototype,"workflowId",void 0),S([R(),D("design:type",String)],Bt.prototype,"name",void 0),S([R(),D("design:type",Object)],Bt.prototype,"document",void 0),S([R(),D("design:type",String)],Bt.prototype,"owner",void 0),S([R(),D("design:type",Object)],Bt.prototype,"snapshot",void 0),Bt=S([C("graph_workflow"),E(),D("design:paramtypes",[Object])],Bt);let Wt=class extends T{constructor(e){super(e)}};S([P({type:String,generated:!1}),D("design:type",String)],Wt.prototype,"kind",void 0),S([R(),$(),D("design:type",String)],Wt.prototype,"name",void 0),S([R(),$(),D("design:type",String)],Wt.prototype,"category",void 0),S([R(),D("design:type",String)],Wt.prototype,"group",void 0),S([R(),D("design:type",String)],Wt.prototype,"description",void 0),S([R(),D("design:type",Object)],Wt.prototype,"manifest",void 0),Wt=S([C("graph_node"),E(),D("design:paramtypes",[Object])],Wt),oe("Trigger",{color:"#3b82f6",icon:"ti-bolt"}),oe("Flow Control",{color:"#f59e0b",icon:"ti-arrows-split-2"}),oe("Utility",{color:"#0d9488",icon:"ti-tool"}),oe("Loop",{color:"#eab308",icon:"ti-repeat"}),oe("Workflow",{color:"#f97316",icon:"ti-sitemap"}),oe("Pipeline",{color:"#0ea5e9",icon:"ti-git-merge"}),oe("Node",{color:"#8b5cf6",icon:"ti-point-filled"}),oe("Agent",{color:"#7c3aed",icon:"ti-robot"}),oe("model",{color:"#3b82f6",icon:"ti-cpu"}),oe("memory",{color:"#10b981",icon:"ti-database"}),oe("workspace",{color:"#f59e0b",icon:"ti-folder"});const qt=new Set;function Ht(e,t){return e.config[t]}function Kt(e){return Array.isArray(e)?e.map(e=>e+"").join(", "):e+""}(()=>{const t=[{key:le.NODE_ID,shouldInclude:e=>null!=Ht(e,le.NODE_ID),render:e=>Ht(e,le.NODE_ID)+""},{key:le.WORKFLOW_ID,shouldInclude:e=>null!=Ht(e,le.WORKFLOW_ID),render:e=>Ht(e,le.WORKFLOW_ID)+""},{key:le.RUN_ID,shouldInclude:e=>null!=Ht(e,le.RUN_ID),render:e=>Ht(e,le.RUN_ID)+""},{key:le.USER,shouldInclude:e=>null!=Ht(e,le.USER),render:e=>Ht(e,le.USER)+""},{key:le.ROLES,shouldInclude(e){const t=Ht(e,le.ROLES);return Array.isArray(t)&&t.length>0},render:e=>Kt(Ht(e,le.ROLES))},{key:le.NAMESPACES,shouldInclude(e){const t=Ht(e,le.NAMESPACES);return Array.isArray(t)&&t.length>0},render:e=>Kt(Ht(e,le.NAMESPACES))},{key:le.ORGANIZATION,shouldInclude:e=>null!=Ht(e,le.ORGANIZATION),render:e=>Ht(e,le.ORGANIZATION)+""},{key:le.IP,shouldInclude:e=>null!=Ht(e,le.IP),render:e=>Ht(e,le.IP)+""}];for(const o of t)qt.has(o.key)||(e.register(o),qt.add(o.key))})();const Vt="$workflow",zt="local",Jt=4,Xt=100,Yt=1e3,Qt=1e3,Zt=1e4,eo=3e4,to="graph.pinnable";var oo,no;(e=>{e.MANUAL="manual",e.AUTOMATIC="automatic",e.DISABLED="disabled"})(oo||(oo={})),(e=>{e.TRUTHY="truthy",e.FALSY="falsy",e.EQUALS="equals",e.NOT_EQUALS="notEquals",e.GREATER_THAN="greaterThan",e.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",e.LESS_THAN="lessThan",e.LESS_THAN_OR_EQUAL="lessThanOrEqual",e.EXISTS="exists",e.CUSTOM="custom"})(no||(no={}));const ro={FOREACH:"core.loop.foreach",WHILE:"core.loop.while",UNTIL:"core.loop.until"};class io extends x{constructor(e,t="GRAPH_EXECUTION_ERROR",o){super(e,io.name,500),this.graphCode=t,this.details=o,this.name=this.constructor.name}}class ao extends io{constructor(e){super("Graph workflow contains an unsupported cycle","GRAPH_CYCLE_ERROR",e)}}class so extends io{constructor(e,t){super(e,"GRAPH_INPUT_ERROR",t)}}class lo extends io{constructor(e,t){super(e,"GRAPH_LOOP_LIMIT_ERROR",t)}}class co extends io{constructor(e,t){super(e,"GRAPH_PINNING_ERROR",t)}}class uo extends io{constructor(e,t){super(e,"GRAPH_PORT_ERROR",t)}}class po extends io{constructor(e,t){super(e,"GRAPH_STORE_ERROR",t)}}class ho extends io{constructor(e,t){super(e,"GRAPH_TOPOLOGY_ERROR",t)}}class fo extends io{constructor(e){super("Break signal","GRAPH_BREAK_SIGNAL",{value:e}),this.isBreakSignal=!0,this.name="GraphBreakSignal"}}class go extends io{constructor(e){super(`Graph run '${e}' was cancelled`,"GRAPH_RUN_CANCELLED",{runId:e}),this.name=go.name}}class mo extends A{constructor(e){super(`Graph workflow document rejected with ${e.length} issue(s): ${e.map(e=>`${e.code} at ${e.path} (${e.message})`).join("; ")}`),this.name=mo.name,this.issues=e}}class yo{constructor(){this.observers=new Set}observe(e){return this.observers.add(e),()=>this.unObserve(e)}unObserve(e){this.observers.delete(e)}async updateObservers(e){await Promise.all(Array.from(this.observers).map(async t=>{try{await Promise.resolve(t.refresh(e))}catch{}}))}}class wo{constructor(){this.sequence=0}create(e){return{...e,id:this.createEventId(),sequence:++this.sequence,timestamp:new Date}}createEventId(){const e=globalThis.crypto;if(!e||"function"!=typeof e.randomUUID)throw new io("Cannot generate a graph event id: crypto.randomUUID is unavailable in this runtime","GRAPH_EVENT_ID_ERROR",{runtime:typeof globalThis.crypto});return e.randomUUID()}}function bo(e){if("string"!=typeof e)return;const t=e.trim();if(!t)return;const o=t.split(".");if(3!==o.length)return;const n=o[0].trim(),r=o[2].trim(),i=o[1].split(",").map(e=>e.trim()).filter(e=>e.length>0);return n&&r&&0!==i.length?{organization:n,departments:i,role:r}:void 0}function vo(e){return`${e.organization}.${e.departments.join(",")}.${e.role}`}function Io(e){if(!e||"string"!=typeof e.namespace||!e.parts)return!1;const t=bo(e.namespace);return!!t&&vo(t)===vo(e.parts)}function Eo(e,t){const o="string"==typeof e?e.trim():"";if(o){if(t)for(const e of t)if(e&&e.namespace===o&&Io(e))return e.parts;return bo(o)}}function No(e,t,o={},n){const r=Eo(e,n),i=Eo(t,n);return!(!r||!i)&&r.organization===i.organization&&r.role===i.role&&("exact"===(o.mode??"inherit")?r.departments.length===i.departments.length&&r.departments.every((e,t)=>e===i.departments[t]):r.departments.length<=i.departments.length&&r.departments.every((e,t)=>e===i.departments[t]))}function ko(e,t,o={},n){return e.filter(e=>!t.some(t=>No(t,e,o,n)))}function Oo(e){return e.filter(e=>void 0===bo(e))}function Ao(e,t){const o=new Set;for(const n of e){const e=Eo(n,t);e&&o.add(e.role)}return[...o]}function xo(e){if(!Array.isArray(e))return;const t=e.filter(e=>"string"==typeof e&&e.length>0);return t.length?t:void 0}function _o(e,t){try{const o=e.cache;if(o&&void 0!==o[t]&&null!==o[t])return o[t]}catch{}try{return e.get(t)}catch{return}}function So(e){if(!e)return{};const t={},o=e.user;"string"==typeof o&&o&&(t.user=o);const n=e.organization;"string"==typeof n&&n&&(t.organization=n);const r=e.ip;"string"==typeof r&&r&&(t.ip=r);const i=xo(e.roles);i&&(t.roles=i);const a=xo(e.namespaces);return a&&(t.namespaces=a,t.namespaceCache=Po(a)),t}function Do(e){return e?So({user:_o(e,"user"),organization:_o(e,"organization"),ip:_o(e,"ip"),roles:_o(e,"roles"),namespaces:_o(e,"namespaces")}):{}}function Po(e){const t=[];for(const o of e){const e=bo(o);e&&t.push({namespace:o,parts:e})}return t}function Ro(...e){const t={};for(const o of e)o&&(void 0!==o.user&&(t.user=o.user),void 0!==o.organization&&(t.organization=o.organization),void 0!==o.ip&&(t.ip=o.ip),void 0!==o.roles&&(t.roles=o.roles),void 0!==o.namespaces&&(t.namespaces=o.namespaces),void 0!==o.namespaces?t.namespaceCache=o.namespaceCache??Po(o.namespaces):void 0!==o.namespaceCache&&(t.namespaceCache=o.namespaceCache));return t}class $o{constructor(e={}){this.options=e}get enabled(){return!0===this.options.enabled}validate(e,o,n,r){if(!this.enabled)return;const i=r??this.options.logger??t.for("GraphAuth"),a=e.id||e.name||o.workflowId,s=(e=>{if(!e||"object"!=typeof e)return;const t=e.auth;return t&&"object"==typeof t&&!Array.isArray(t)?(e=>{if(!e)return;const t=fe(e.namespaces),o=fe(e.roles);if(!t&&!o)return;const n={};return t&&(n.namespaces=t),o&&(n.roles=o),n})(t):void 0})(e.metadata);this.assertGranted(`workflow '${a}'`,s?.namespaces??[],n,s?.roles??[],i);for(const e of o.nodes)this.assertGranted(`node '${e.id}'`,e.manifest.namespaces??[],n,[],i)}assertGranted(e,t,o,n,r){const i=o.namespaces??[],a=ko(t,i,this.options.match,o.namespaceCache),s=Ao(i,o.namespaceCache),d=n.filter(e=>!s.includes(e));if(0===a.length&&0===d.length)return;const l=[...new Set([...Oo(t),...Oo(i)])],c=[];throw a.length&&c.push("namespace(s) "+a.join(", ")),d.length&&c.push("role(s) "+d.join(", ")),r.warn(`Graph access denied for ${e} for user ${o.user??"anonymous"}: missing ${c.join(" and ")}${l.length?`; malformed namespace(s) ${l.join(", ")} failed closed`:""}`),new L(`Access to ${e} requires ${c.join(" and ")}`)}}class Co{constructor(e){this.baseOptions=e,this.inner=t.for("GraphRun").for(this.attributeConfig(e))}attributeConfig(e){return{[le.NODE_ID]:e.nodeId,[le.WORKFLOW_ID]:e.workflowId,[le.RUN_ID]:e.runId,[le.USER]:e.user??null,[le.ROLES]:e.roles,[le.NAMESPACES]:e.namespaces,[le.ORGANIZATION]:e.organization,[le.IP]:e.ip}}emit(e,t,o){const n="string"==typeof t?t:t instanceof Error?t.message:t+"",r={level:e,message:n,timestamp:(new Date).toISOString(),runId:this.baseOptions.runId,workflowId:this.baseOptions.workflowId,nodeId:this.baseOptions.nodeId,user:this.baseOptions.user??null};void 0!==this.baseOptions.roles&&(r.roles=this.baseOptions.roles),void 0!==this.baseOptions.namespaces&&(r.namespaces=this.baseOptions.namespaces),void 0!==this.baseOptions.organization&&(r.organization=this.baseOptions.organization),void 0!==this.baseOptions.ip&&(r.ip=this.baseOptions.ip),void 0!==o&&(r.payload=o),this.baseOptions.forward({type:ce.GRAPH_RUN_LOG,payload:r}).catch(()=>{}),{benchmark:(e,t)=>this.inner.benchmark(e,t),fatal:(e,t)=>this.inner.fatal(e,t),critical:(e,t)=>this.inner.critical(e,t),silly:(e,t)=>this.inner.silly(e,t),trace:(e,t)=>this.inner.trace(e,t),verbose:(e,t)=>this.inner.verbose(e,t),info:(e,t)=>this.inner.info(e,t),warn:(e,t)=>this.inner.warn(e,t),error:(e,t)=>this.inner.error(e,t),debug:(e,t)=>this.inner.debug(e,t)}[e](n,o)}benchmark(e,t){this.emit("benchmark",e,t)}fatal(e,t,o){this.emit("fatal",e,t??o)}critical(e,t,o){this.emit("critical",e,t??o)}silly(e,t,o){this.emit("silly",e,"object"==typeof t?t:o)}trace(e,t){this.emit("trace",e,t)}verbose(e,t,o){this.emit("verbose",e,"object"==typeof t?t:o)}info(e,t){this.emit("info",e,t)}error(e,t,o){this.emit("error",e,t??o)}warn(e,t){this.emit("warn",e,t)}debug(e,t){this.emit("debug",e,t)}action(e,t,o){this.inner.action(e,t,o)}setConfig(){}for(e,t,...o){return this}clear(){return this}get root(){return this.inner.root}}function To(e){if(!Array.isArray(e))return;const t=e.filter(e=>"string"==typeof e&&e.length>0);return t.length?t:void 0}class Lo extends M{constructor(e,t,o,n,r,i,a,s,d={},l,c,u){super(),this.runId=e,this.parentRunId=t,this.workflowId=o,this.document=n,this.node=r,this.manifest=i,this.path=a,this.emitFn=s,this.metadata=d,this.engine=l,this.abortSignal=c,this.limits=u;const p=So(d);this.accumulate({...p,operation:"execute"});const h="string"==typeof d?.user?d.user:null;this.runLogger=new Co({runId:e,workflowId:o,nodeId:r.id,user:h,roles:To(d?.roles),namespaces:To(d?.namespaces),organization:"string"==typeof d?.organization?d.organization:void 0,ip:"string"==typeof d?.ip?d.ip:void 0,forward:async e=>{await this.emit(e)}})}get logger(){return this.runLogger}get auth(){return Do(this)}async emit(e){await this.emitFn({...e,runId:this.runId,parentRunId:this.parentRunId,workflowId:this.workflowId,nodeId:this.node.id,path:e.path??this.path})}async progress(e){await this.emit({type:ce.NODE_OUTPUT,payload:e})}async log(e,t){await this.emit({type:ce.NODE_OUTPUT,payload:{message:e,payload:t}})}}class Mo{constructor(e,t,o,n){this.nodeResults=new Map,this.events=[],this.activeDataEdges=new Set,this.runId=e,this.plan=t,this.valueStore=o,this.eventFactory=n,this.startedAt=new Date}recordNodeResult(e){this.nodeResults.set(e.nodeId,e)}activateDataEdge(e){this.activeDataEdges.add(e)}isDataEdgeActive(e){return this.activeDataEdges.has(e)}appendEvent(e){this.events.push(e)}finish(){this.finishedAt=new Date}}function jo(e,t,o,n,r){const i=e.valueStore.getWorkflowValues(),a={};for(const[t,o]of e.nodeResults)a[t]=o;const s=[...e.events];return{runId:e.runId,workflowId:t.id||t.name,status:n,document:t,inputs:{...o},outputs:i,nodeResults:a,events:s,startedAt:e.startedAt,finishedAt:e.finishedAt,metadata:r}}class Go{constructor(e,t,o){this.emitter=e,this.eventFactory=t,this.options=o}get engine(){return this.options.engine}get codeSandboxEvaluator(){return this.options.codeSandboxEvaluator}get frame(){return this._frame}bindFrame(e){this._frame=e}async emit(e){const t=this.eventFactory.create({id:"",sequence:0,timestamp:new Date,runId:this.options.runId,parentRunId:this.options.parentRunId,workflowId:this.options.workflowId,type:ce.NODE_OUTPUT,path:this.options.path??[],...e});this._frame?.appendEvent(t),await this.emitter.updateObservers(t)}async updateObservers(e){await this.emitter.updateObservers(e)}}function Uo(e){const t=e.capabilities;return{codeMode:t?.codeMode??e.codeMode,workflows:{list:t?.workflows?.list??("function"==typeof e.listWorkflows?"supported":"not_supported"),get:t?.workflows?.get??("function"==typeof e.getWorkflow?"supported":"not_supported")}}}class Fo{static{this._cache={}}static register(e,t){return Fo._cache[e]=t,t}static get(e){const t=e??Fo._currentFlavour;if(t)return Fo._cache[t]}static getOrFail(e){const t=Fo.get(e);if(!t)throw new io(`No graph execution backend registered under '${e}'`,"GRAPH_EXECUTION_BACKEND_NOT_REGISTERED");return t}static get current(){return Fo.get()}static get currentFlavour(){return Fo._currentFlavour??zt}static setCurrent(e){Fo._currentFlavour=e}static list(){return Object.entries(Fo._cache).map(([e,t])=>({flavour:e,backend:t}))}static unregister(e){e&&(delete Fo._cache[e],Fo._currentFlavour===e&&(Fo._currentFlavour=void 0))}static clear(){for(const e of Object.keys(Fo._cache))delete Fo._cache[e];Fo._currentFlavour=void 0}}class Bo{evaluate(e,t){switch(e.op){case"eq":return this.resolveValue(e.left,t)===this.resolveValue(e.right,t);case"neq":return this.resolveValue(e.left,t)!==this.resolveValue(e.right,t);case"gt":return Number(this.resolveValue(e.left,t))>Number(this.resolveValue(e.right,t));case"gte":return Number(this.resolveValue(e.left,t))>=Number(this.resolveValue(e.right,t));case"lt":return Number(this.resolveValue(e.left,t))<Number(this.resolveValue(e.right,t));case"lte":return Number(this.resolveValue(e.left,t))<=Number(this.resolveValue(e.right,t));case"and":return e.conditions.every(e=>this.evaluate(e,t));case"or":return e.conditions.some(e=>this.evaluate(e,t));case"not":return!this.evaluate(e.condition,t);case"exists":return void 0!==this.resolveValue(e.value,t)&&null!==this.resolveValue(e.value,t);default:throw new io(`Unknown ConditionExpression op '${e.op}'`,"GRAPH_UNKNOWN_CONDITION_OP",{expr:e})}}resolveValue(e,t){if("const"in e)return e.const;if("path"in e&&!("step"in e))return this.resolvePath(e.path,t);if("step"in e&&"path"in e){const o=t?.nodes;if(o&&"object"==typeof o){const t=o[e.step];return this.resolvePath(e.path,t)}return this.resolvePath(e.path,t)}throw new io("Invalid ExprValue: must have `const`, `path`, or `step`+`path`","GRAPH_INVALID_EXPR_VALUE",{ref:e})}resolvePath(e,t){if(!e)return t;const o=e.split(".");let n=t;for(const e of o){if(null==n)return;n=n[e]}return n}}function Wo(e){return"object"==typeof e&&null!==e&&"type"in e&&"code"===e.type}function qo(e){return"object"==typeof e&&null!==e&&"op"in e&&"string"==typeof e.op}async function Ho(e,t,o){const n=o.engine?.codeSandboxEvaluator;if(!n)throw new io("Code conditions require a CodeSandboxEvaluator to be registered in GraphExecutionEngineConfig.codeSandboxEvaluator","GRAPH_CODE_SANDBOX_NOT_CONFIGURED",{code:e.code});await o.log("Evaluating code condition",{language:e.language??"javascript"});const r=o.metadata;return!!await n.evaluate({code:e.code,language:e.language,input:t,vars:r?.vars??void 0,item:r?.item,index:r?.index,nodes:r?.nodes??void 0,logger:o.logger,abortSignal:o.abortSignal})}function Ko(e,t,o){if(qo(e))return(new Bo).evaluate(e,t);throw((e,t)=>new io(`Unknown ${t??"flow"} condition type \u2014 must be ConditionExpression (op) or CodeCondition (type: 'code')`,"GRAPH_UNKNOWN_CONDITION_TYPE",{condition:e}))(e,o)}async function Vo(e,t,o){return Wo(e)?Ho(e,t.input,o):Ko(e,t.state,t.label)}function zo(e,t,o,n){if(e&&"object"==typeof e&&!n.has(e))if(n.add(e),Wo(e))o.push({nodeId:t,kind:"code-condition"});else if(ut(e))o.push({nodeId:t,kind:"value-template"});else if((e=>{if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"expression"===t.source&&"string"==typeof t.expression})(e))o.push({nodeId:t,kind:"expression-binding"});else if((e=>{if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.id&&"string"==typeof t.name&&Array.isArray(t.nodes)&&Array.isArray(t.edges)})(e))Xo(e,o,n);else if(Array.isArray(e))for(const r of e)zo(r,t,o,n);else for(const r of Object.keys(e))zo(e[r],t,o,n)}function Jo(e,t,o){const n=e.id;"core.utility.code"===e.kind&&t.push({nodeId:n,kind:"code-node",detail:e.kind});const r=e.inputBindings??{};for(const[e,o]of Object.entries(r))o&&"expression"===o.mode&&t.push({nodeId:n,kind:"expression-binding",detail:e});zo(e.parameters,n,t,o),zo(e.metadata,n,t,o),zo(e.state,n,t,o),zo(e.loop,n,t,o)}function Xo(e,t,o){for(const n of e.nodes??[])Jo(n,t,o)}function Yo(e){const t=[];return Xo(e,t,new Set),t}function Qo(e){return Yo(e).length>0}function Zo(e,t){if(!t)return{valid:!0};switch(t.type){case"any":default:return{valid:!0};case"string":return"string"!=typeof e?en("string"):{valid:!0};case"number":return"number"==typeof e&&Number.isFinite(e)?t.integer&&!Number.isInteger(e)?{valid:!1,message:"expected an integer number"}:void 0!==t.min&&e<t.min?{valid:!1,message:"expected a number >= "+t.min}:void 0!==t.max&&e>t.max?{valid:!1,message:"expected a number <= "+t.max}:{valid:!0}:en("number");case"boolean":return"boolean"!=typeof e?en("boolean"):{valid:!0};case"array":if(!Array.isArray(e))return en("array");if(void 0!==t.minItems&&e.length<t.minItems)return{valid:!1,message:`expected at least ${t.minItems} items`};if(void 0!==t.maxItems&&e.length>t.maxItems)return{valid:!1,message:`expected at most ${t.maxItems} items`};for(const o of e){const e=Zo(o,t.items);if(!e.valid)return e}return{valid:!0};case"object":case"model":{if(null===e||"object"!=typeof e||Array.isArray(e))return en(t.type);const o=t,n=o.properties;if(!n)return{valid:!0};for(const[t,o]of Object.entries(n))if(t in e){const n=Zo(e[t],o);if(!n.valid)return{valid:!1,message:`property '${t}': ${n.message}`}}if(o.required)for(const t of o.required)if(!(t in e))return{valid:!1,message:`missing required property '${t}'`};if(!1===o.additionalProperties)for(const t of Object.keys(e))if(!(t in n))return{valid:!1,message:`unexpected property '${t}'`};return{valid:!0}}case"enum":return t.values.some(t=>t===e)?{valid:!0}:{valid:!1,message:"value is not one of the enum values"}}}function en(e){return{valid:!1,message:`expected a ${e} value`}}function tn(e){if("string"==typeof e)return e.length>0;if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.credentialId&&t.credentialId.length>0&&(void 0===t.credentialType||"string"==typeof t.credentialType)}const on=new Set(["loop"]),nn=["secret","secrets","password","passwd","token","accessToken","refreshToken","apiKey","api_key","privateKey","credentials"];class rn{validate(e,t,o,n,r){this.validateParameters(e,t,o,n,r),this.validateMetadataKeys(e,t,o,n),this.validateDisabledBehavior(e,o,n),this.validateBindingShapes(e,t,o,n)}validateParameters(e,t,o,n,r){const i=!0===t.policies?.allowUndeclaredParameters,a=new Map(t.parameters.map(e=>[e.id,e]));for(const[r,s]of Object.entries(e.parameters??{})){const d=a.get(r);if(!d){i||o.push({code:"parameter.undeclared",path:`${n}.parameters.${r}`,message:`Node '${e.id}' sets parameter '${r}' which is not declared by kind '${t.kind}'`,nodeId:e.id,details:{kind:t.kind}});continue}if(void 0===s){o.push({code:"parameter.invalid",path:`${n}.parameters.${r}`,message:`Node '${e.id}' parameter '${r}' must not be undefined`,nodeId:e.id});continue}const l=this.checkParameterValue(s,d);l.valid||o.push({code:"parameter.type-mismatch",path:`${n}.parameters.${r}`,message:`Node '${e.id}' parameter '${r}' is invalid: ${l.message}`,nodeId:e.id,details:{expectedType:d.type}})}for(const i of t.parameters)void 0===(e.parameters??{})[i.id]&&(this.isParameterSatisfiedByInput(e,i.id,r)||(!0===i.required||(i.validation??[]).some(e=>"required"===e.kind))&&void 0===i.defaultValue&&o.push({code:"parameter.required-missing",path:`${n}.parameters.${i.id}`,message:`Node '${e.id}' is missing required parameter '${i.id}' declared by kind '${t.kind}'`,nodeId:e.id}))}isParameterSatisfiedByInput(e,t,o){return void 0!==(e.inputBindings??{})[t]||!0===o?.has(t)}checkParameterValue(e,t){if(ut(e))return{valid:!0};switch(t.type){case"string":case"code":case"expression":return"string"!=typeof e?en("string"):{valid:!0};case"number":return"number"==typeof e&&Number.isFinite(e)?{valid:!0}:en("number");case"boolean":return"boolean"!=typeof e?en("boolean"):{valid:!0};case"options":{const o=t.options;return o&&o.length&&!o.some(t=>t.value===e)?{valid:!1,message:"value is not one of the declared options"}:{valid:!0}}case"collection":return Array.isArray(e)?{valid:!0}:en("array");case"object":case"resourceLocator":return null===e||"object"!=typeof e||Array.isArray(e)?en("object"):{valid:!0};case"credential":return tn(e)?t.credentialType&&"object"==typeof e&&void 0!==e.credentialType&&e.credentialType!==t.credentialType?{valid:!1,message:`credential type '${e.credentialType}' does not match the declared type '${t.credentialType}'`}:{valid:!0}:{valid:!1,message:"credential parameters must hold a credential reference (credentialId), never a secret"};default:return{valid:!0}}}validateMetadataKeys(e,t,o,n){const r=t.metadata?.allowedInstanceMetadataKeys;for(const i of Object.keys(e.metadata??{}))on.has(i)?o.push({code:"metadata.key-not-allowed",path:`${n}.metadata.${i}`,message:`Node '${e.id}' metadata key '${i}' is reserved and must not be set directly`,nodeId:e.id}):Array.isArray(r)&&!r.includes(i)&&o.push({code:"metadata.key-not-allowed",path:`${n}.metadata.${i}`,message:`Node '${e.id}' metadata key '${i}' is not in the allowed metadata keys of kind '${t.kind}'`,nodeId:e.id})}validateDisabledBehavior(e,t,o){!0!==e.disabled&&!1!==e.disabled&&void 0!==e.disabled&&t.push({code:"disabled.invalid",path:o+".disabled",message:`Node '${e.id}' disabled flag must be a boolean`,nodeId:e.id});const n=(e.metadata??{}).disabledBehavior;void 0===n||ae(n)||t.push({code:"disabled.invalid-behavior",path:o+".metadata.disabledBehavior",message:`Node '${e.id}' disabled behavior '${n+""}' is not one of: ${ie.join(", ")}`,nodeId:e.id})}validateBindingShapes(e,t,o,n){for(const[r,i]of Object.entries(e.inputBindings??{})){if("literal"===i.mode){const a=t.inputs.find(e=>e.id===r);if(a?.schema){const t=Zo(i.value,a.schema);t.valid||o.push({code:"binding.literal-invalid",path:`${n}.inputBindings.${r}`,message:`Node '${e.id}' literal binding for '${r}' is schema-invalid: ${t.message}`,nodeId:e.id})}}"expression"!==i.mode||"string"==typeof i.expression&&i.expression.trim()||o.push({code:"binding.expression-invalid",path:`${n}.inputBindings.${r}`,message:`Node '${e.id}' expression binding for '${r}' must contain a non-empty expression`,nodeId:e.id})}}validateBindingSatisfaction(e,t,o,n,r,i={}){const a=new Set(o.filter(e=>"data"===e.type).map(e=>e.targetPort)),s=new Set(Object.entries(e.inputBindings??{}).map(([e])=>e));for(const t of a){const o=(e.inputBindings??{})[t];o&&"literal"===o.mode&&!0!==i.allowLiteralAndEdgeBindings&&n.push({code:"binding.conflict",path:`${r}.inputBindings.${t}`,message:`Node '${e.id}' input '${t}' has both an incoming edge and a literal binding`,nodeId:e.id})}for(const o of t.inputs)!0===o.required&&(a.has(o.id)||s.has(o.id)||void 0===(e.parameters??{})[o.id]&&n.push({code:"topology.required-input-unsatisfiable",path:r+".parameters",message:`Node '${e.id}' required input '${o.id}' has no incoming edge or binding`,nodeId:e.id,details:{port:o.id}}))}static disabledBehaviorOf(e,t){const o=(e.metadata??{}).disabledBehavior;if(ae(o))return o;const n=t?.disabledBehavior;return ae(n)?n:"skip"}}let an=class extends T{constructor(e){super(e)}};function sn(e){return[e.namespace??"default",e.workflowId,e.nodeId,e.version??"default",e.fingerprint].join(":")}function dn(e){return new an({id:sn(e.key),workflowId:e.key.workflowId,nodeId:e.key.nodeId,fingerprint:e.key.fingerprint,...void 0!==e.key.namespace?{namespace:e.key.namespace}:{},...void 0!==e.key.version?{version:e.key.version}:{},pinned:e.pinned,outputs:e.outputs,createdAt:new Date(e.createdAt),updatedAt:new Date(e.updatedAt),...e.expiresAt?{expiresAt:new Date(e.expiresAt)}:{},...e.metadata?{metadata:e.metadata}:{}})}function ln(e){return{key:{workflowId:e.workflowId,nodeId:e.nodeId,fingerprint:e.fingerprint,...void 0!==e.namespace?{namespace:e.namespace}:{},...void 0!==e.version?{version:e.version}:{}},outputs:e.outputs,pinned:e.pinned,createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString(),...e.expiresAt?{expiresAt:e.expiresAt.toISOString()}:{},...e.metadata?{metadata:e.metadata}:{}}}S([P({type:String,generated:!1}),D("design:type",String)],an.prototype,"id",void 0),S([R(),$(),D("design:type",String)],an.prototype,"workflowId",void 0),S([R(),$(),D("design:type",String)],an.prototype,"nodeId",void 0),S([R(),D("design:type",String)],an.prototype,"fingerprint",void 0),S([R(),D("design:type",String)],an.prototype,"namespace",void 0),S([R(),D("design:type",String)],an.prototype,"version",void 0),S([R(),D("design:type",Boolean)],an.prototype,"pinned",void 0),S([R(),D("design:type",Object)],an.prototype,"outputs",void 0),S([R(),D("design:type",Date)],an.prototype,"createdAt",void 0),S([R(),D("design:type",Date)],an.prototype,"updatedAt",void 0),S([R(),D("design:type",Date)],an.prototype,"expiresAt",void 0),S([R(),D("design:type",Object)],an.prototype,"metadata",void 0),an=S([C("graph_value"),E(),D("design:paramtypes",[Object])],an);let cn=class extends G{constructor(e){super(e,an,!0),this.runtimeValues=new Map}seedWorkflowInputs(e){this.runtimeValues.set(Vt,{...e})}setNodeOutputs(e,t){this.runtimeValues.set(e,{...t})}getPort(e,t){return this.runtimeValues.get(e)?.[t]}hasPort(e,t){return Object.prototype.hasOwnProperty.call(this.runtimeValues.get(e)??{},t)}setWorkflowOutput(e,t){const o=this.runtimeValues.get(Vt)??{};o[e]=t,this.runtimeValues.set(Vt,o)}getWorkflowValues(){return{...this.runtimeValues.get(Vt)??{}}}snapshot(){return Object.fromEntries(this.runtimeValues.entries())}async readCached(e,...t){try{return ln(await this.read(sn(e),...t))}catch{return}}async writeCached(e,t,...o){const n=sn(e);let r;try{r=await this.read(n,...o)}catch{r=void 0}r?await this.update(Object.assign(r,dn(t)),...o):await this.create(dn(t),...o)}async deleteCached(e,...t){try{await this.delete(sn(e),...t)}catch{}}async hasCached(e,...t){return void 0!==await this.readCached(e,...t)}async listCached(e,...t){return(await this.select().execute(...t)).map(e=>ln(e)).filter(t=>((e,t)=>!(void 0!==t.workflowId&&e.workflowId!==t.workflowId||void 0!==t.nodeId&&e.nodeId!==t.nodeId||void 0!==t.namespace&&e.namespace!==t.namespace||void 0!==t.version&&e.version!==t.version||void 0!==t.fingerprint&&e.fingerprint!==t.fingerprint))(t.key,e))}async clearRun(e,...t){const o=await this.select().execute(...t);for(const e of o)await this.delete(e.id,...t)}readRuntimeValues(e){return this.runtimeValues.get(e)}writeRuntimeValues(e,t){this.runtimeValues.set(e,{...t})}getAdapter(){return this.adapter}};function un(e){return new(0,G.forModel(an,e.alias).constructor)(e)}cn=S([j(an,m),D("design:paramtypes",[Function])],cn);class pn{static upstreamNodes(e,t,o=!1){const n=new Set,r=[e];for(;r.length;){const e=r.pop(),i=t.get(e)??[];for(const e of i)!o&&this.isBoundary(e.sourceNodeId)||n.has(e.sourceNodeId)||(n.add(e.sourceNodeId),r.push(e.sourceNodeId))}return n}static downstreamNodes(e,t,o=!1){const n=new Set,r=[e];for(;r.length;){const e=r.pop(),i=t.get(e)??[];for(const e of i)!o&&this.isBoundary(e.targetNodeId)||n.has(e.targetNodeId)||(n.add(e.targetNodeId),r.push(e.targetNodeId))}return n}static isBoundary(e){return"$workflow"===e}}class hn{constructor(e,t,o){this.store=e,this.policy=t,this.dependencyResolver=o}async pinNode(e){const t=e.plan,o=e.includeDependencies??!0?this.dependencyResolver.getPinSet(t,e.nodeId):new Set([e.nodeId]);for(const e of o){const o=t.nodes.find(t=>t.id===e);if(!o)throw new co(`Node '${e}' not found in plan`);if(!this.policy.canPin(o))throw new co(`Node '${e}' is not pinnable`,{nodeId:e})}const n=this.topologicalOrder(t,o);for(const o of n){const n=t.nodes.find(e=>e.id===o),r=e.result.nodeResults[o];if(!r||!r.outputs)throw new co(`Node '${o}' has no completed output to pin`);const i=r.inputs??{},a=this.dependencyFingerprints(t,o,e.result),s=this.createValueKey(e.document.id,n,i,a),d=(new Date).toISOString(),l={key:s,outputs:r.outputs,pinned:!0,createdAt:d,updatedAt:d,metadata:{...e.result.metadata,nodeId:o}};await this.store.writeCached(s,l)}}async unpinNode(e){const t={workflowId:e.document.id,nodeId:e.nodeId,fingerprint:e.fingerprint,namespace:e.namespace};await this.store.deleteCached(t)}async readPinnedValue(e,t,o,n,r){const i=this.createValueKey(e,t,o,n,r),a=await this.store.readCached(i);if(a&&a.pinned){if(a.expiresAt&&new Date(a.expiresAt)<new Date)return;return a}}createValueKey(e,t,o,n,r){return{workflowId:e,nodeId:t.id,fingerprint:this.computeFingerprint(e,t,o,n),namespace:r}}computeFingerprint(e,t,o,n){const r={workflowId:e,nodeId:t.id,nodeKind:t.kind,parameters:this.stableSerialize(t.instance.parameters??{}),inputBindings:this.stableSerialize(t.instance.inputBindings??{}),metadata:this.stableSerialize(this.relevantMetadata(t)),inputs:this.stableSerialize(o),dependencyFingerprints:this.stableSerialize(n)},i=this.stableSerialize(r);return this.simpleHash(i)}relevantMetadata(e){const t={...e.metadata??{}};return delete t.ui,delete t.position,delete t.visual,t}topologicalOrder(e,t){const o=[],n=new Set,r=i=>{if(n.has(i))return;n.add(i);const a=pn.upstreamNodes(i,e.incomingByNode,!1);for(const e of a)t.has(e)&&r(e);o.push(i)};for(const e of t)r(e);return o}dependencyFingerprints(e,t,o){const n=this.dependencyResolver.getDependencies(e,t),r={};for(const t of n){const n=e.nodes.find(e=>e.id===t);if(n){const i=o.nodeResults[t],a=i?.inputs??{},s=this.dependencyFingerprints(e,t,o);r[t]=this.computeFingerprint(e.workflowId,n,a,s)}}return r}stableSerialize(e){return null===e||"object"!=typeof e?JSON.stringify(e):Array.isArray(e)?`[${e.map(e=>this.stableSerialize(e)).join(",")}]`:`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${this.stableSerialize(e[t])}`).join(",")}}`}simpleHash(e){let t=0;for(let o=0;o<e.length;o++)t=(t<<5)-t+e.charCodeAt(o),t|=0;return`fp_${Math.abs(t).toString(16).padStart(8,"0")}_${e.length}`}}const fn={enabled:!0,strategy:"manual",includeDependencies:!0};function gn(e){return!0===e?.enabled&&"disabled"!==e.strategy}class mn{canPin(e){return gn(this.getPinningMetadata(e))}shouldUsePinnedValue(e){const t=this.getPinningMetadata(e);return!0===t.enabled&&"disabled"!==t.strategy}shouldAutoPin(e){const t=this.getPinningMetadata(e);return!0===t.enabled&&"automatic"===t.strategy}getPinningMetadata(e){const t=e.manifest.metadata?.pinnable??e.metadata?.pinnable;return t?{...fn,...t}:{...fn,enabled:!1}}}class yn{getDependencies(e,t){return pn.upstreamNodes(t,e.incomingByNode,!1)}getPinSet(e,t){const o=this.getDependencies(e,t);return o.add(t),o}}class wn{constructor(){this.local=!0,this.codeMode="hostSide",Fo.register(zt,this)}async initialize(e){this.valueAdapter=e.valueAdapter,this.codeSandboxEvaluator=e.codeSandboxEvaluator,this.workflowStore=e.workflowStore,this.engine=e.engine}get capabilities(){const e=this.workflowStore?"supported":"not_supported";return{codeMode:this.codeMode,workflows:{list:e,get:e}}}async listWorkflows(...e){const t=this.workflowStore;if(!t)throw new io("LocalGraphExecutionBackend has no workflowStore configured; workflow listing is not supported","GRAPH_BACKEND_WORKFLOWS_NOT_SUPPORTED");return(await t.listWorkflows(...e)).map(e=>({id:e.workflowId,...void 0!==e.name?{name:e.name}:{},...void 0!==e.updatedAt&&null!==e.updatedAt?{updatedAt:e.updatedAt}:{}}))}async getWorkflow(e,...t){const o=this.workflowStore;if(!o)throw new io("LocalGraphExecutionBackend has no workflowStore configured; workflow lookup is not supported","GRAPH_BACKEND_WORKFLOWS_NOT_SUPPORTED");return await o.getDocument(e,...t)}async seedWorkflows(e,...t){const o=this.workflowStore,n=o?.seedDocument??o?.saveDocument;if(!o||"function"!=typeof n)throw new io("LocalGraphExecutionBackend has no writable workflowStore configured; workflow seeding is not supported","GRAPH_BACKEND_SEED_NOT_SUPPORTED");const r=[];for(const i of e)null!==await n.call(o,i.id,i,...t)&&r.push({id:i.id,...void 0!==i.name?{name:i.name}:{}});return r}async execute(e){const{document:t,plan:o,inputs:n,options:r,events:i}=e,a=i,s=a.frame;if(!s)throw new io("LocalGraphExecutionBackend requires the frame-bound event sink created by GraphExecutionEngine","GRAPH_EXECUTION_FRAME_MISSING");const d=s.valueStore,l=s.runId,c=r.path??[],u=async e=>{await a.emit(e)};try{for(const e of o.layers)this.assertNotAborted(r),await this.executeLayer(s,o,e.nodes,r,u);this.assertNotAborted(r);const e=[...s.nodeResults.values()].find(e=>e.status===se.FAILED);if(e?.error)throw new io(e.error.message,e.error.code??"GRAPH_EXECUTION_ERROR",e.error.details);return s.finish(),await a.emit({type:ce.WORKFLOW_COMPLETED,runId:l,parentRunId:r.parentRunId,workflowId:o.workflowId,path:c,status:se.SUCCEEDED,payload:{outputs:d.getWorkflowValues()}}),jo(s,t,n,se.SUCCEEDED,r.metadata)}catch(e){if(e instanceof fo)throw s.finish(),e;s.finish();const i=this.toErrorPayload(e);return e instanceof go||!0===r.abortSignal?.aborted?(await a.emit({type:ce.WORKFLOW_CANCELLED,runId:l,parentRunId:r.parentRunId,workflowId:o.workflowId,path:c,status:se.CANCELLED,error:i}),jo(s,t,n,se.CANCELLED,r.metadata)):(await a.emit({type:ce.WORKFLOW_FAILED,runId:l,parentRunId:r.parentRunId,workflowId:o.workflowId,path:c,status:se.FAILED,error:i}),jo(s,t,n,se.FAILED,r.metadata))}}async executeLayer(e,t,o,n,r){const i=Math.max(1,n.concurrency??4),a=[...o];for(;a.length>0;){const o=a.splice(0,i);await Promise.all(o.map(o=>this.executeNode(e,t,o,n,r)))}}async executeNode(e,t,o,n,r){if(this.assertNotAborted(n),!this.isNodeActivated(e,t,o))return void await this.skipInactiveNode(e,t,o,n,r);if(!0===o.instance.disabled)return void await this.executeDisabledNode(e,t,o,n,r);const i=new Date,a=[...n.path??[],o.id];await r({type:ce.NODE_STARTED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:a,status:se.RUNNING}),this.emitNodeStateChanged(e,t,o,a,de.RUNNING,se.RUNNING,r);const s=await this.resolveNodeInputs(e,t,o,n);if(n.usePinnedValues){const n=await this.tryPinnedValue(e,t,o,s);if(n){e.valueStore.setNodeOutputs(o.id,n.outputs),this.routeOutgoingEdges(e,t,o,n.outputs,r);const d=new Date,l={nodeId:o.id,status:se.CACHED,inputs:s,outputs:n.outputs,startedAt:i,finishedAt:d,fromCache:!0,pinned:!0,events:[]};return e.recordNodeResult(l),await r({type:ce.NODE_CACHE_HIT,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:a,status:se.CACHED,payload:{outputs:n.outputs}}),await r({type:ce.NODE_COMPLETED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:a,status:se.SUCCEEDED,payload:{outputs:n.outputs,fromCache:!0}}),void this.emitNodeStateChanged(e,t,o,a,de.SUCCEEDED,se.SUCCEEDED,r)}}try{const d=new Lo(e.runId,n.parentRunId,t.workflowId,t.resolved.document,o.instance,o.manifest,a,r,n.metadata,this.engine,n.abortSignal,this.executionLimits(n)),l=await this.resolveNodeParameters(o,s,n),c={nodeId:o.id,kind:o.kind,inputs:s,parameters:l,credentials:this.collectCredentials(o),metadata:o.instance.metadata},u=await this.invokeExecutor(o,c,d),p=this.validateNodeOutputs(o,u??{});e.valueStore.setNodeOutputs(o.id,p),this.routeOutgoingEdges(e,t,o,p,r);const h=new Date,f={nodeId:o.id,status:se.SUCCEEDED,inputs:s,outputs:p,startedAt:i,finishedAt:h,events:[]};e.recordNodeResult(f),await r({type:ce.NODE_COMPLETED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:a,status:se.SUCCEEDED,payload:{outputs:p}}),this.emitNodeStateChanged(e,t,o,a,de.SUCCEEDED,se.SUCCEEDED,r)}catch(d){if(d instanceof fo)throw d;const l=new Date,c=this.toErrorPayload(d),u={nodeId:o.id,status:se.FAILED,inputs:s,error:c,startedAt:i,finishedAt:l,events:[]};if(e.recordNodeResult(u),await r({type:ce.NODE_FAILED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:a,status:se.FAILED,error:c}),this.emitNodeStateChanged(e,t,o,a,de.FAILED,se.FAILED,r),n.failFast??!0)throw d}}isNodeActivated(e,t,o){const n=(t.incomingByNode.get(o.id)??[]).filter(e=>"data"===e.type);return 0===n.length||n.some(t=>t.sourceNodeId===Vt||e.isDataEdgeActive(t.id))}async skipInactiveNode(e,t,o,n,r){const i=new Date,a=[...n.path??[],o.id];await r({type:ce.NODE_SKIPPED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:a,status:se.SKIPPED,payload:{reason:"branchNotSelected"}});const s={nodeId:o.id,status:se.SKIPPED,inputs:{},startedAt:i,finishedAt:new Date,events:[]};e.recordNodeResult(s),this.emitNodeStateChanged(e,t,o,a,de.SKIPPED,se.SKIPPED,r)}async executeDisabledNode(e,t,o,n,r){const i=new Date,a=[...n.path??[],o.id],s=rn.disabledBehaviorOf(o.instance,t.resolved.document.settings);if(await r({type:ce.NODE_SKIPPED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:a,status:se.SKIPPED,payload:{disabled:!0,behavior:s}}),"skip"===s){const n={nodeId:o.id,status:se.SKIPPED,inputs:{},startedAt:i,finishedAt:new Date,events:[]};return e.recordNodeResult(n),void this.emitNodeStateChanged(e,t,o,a,de.SKIPPED,se.SKIPPED,r)}const d=await this.resolveNodeInputs(e,t,o,n);let l;if("passThroughFirstInput"===s){const n=(t.incomingByNode.get(o.id)??[]).find(e=>"data"===e.type),r=o.manifest.outputs[0]?.id??"value",i=n?e.valueStore.getPort(n.sourceNodeId,n.sourcePort):Object.values(d)[0];l={[r]:i}}else{l={};for(const e of o.manifest.outputs)l[e.id]=e.metadata?.defaultValue}e.valueStore.setNodeOutputs(o.id,l),this.routeOutgoingEdges(e,t,o,l,r);const c={nodeId:o.id,status:se.SUCCEEDED,inputs:d,outputs:l,startedAt:i,finishedAt:new Date,events:[]};e.recordNodeResult(c),this.emitNodeStateChanged(e,t,o,a,de.SUCCEEDED,se.SUCCEEDED,r)}async invokeExecutor(e,t,o){return await e.executor.execute(t,o)}validateNodeOutputs(e,t){const o=e.manifest;if(!0===o.policies?.allowUnknownOutputs)return t;const n=new Set(o.outputs.map(e=>e.id)),r=Object.keys(t).filter(e=>!n.has(e));if(r.length>0)throw new io(`Node '${e.id}' of kind '${e.kind}' produced unknown output(s): ${r.join(", ")}`,"GRAPH_OUTPUT_VALIDATION_FAILED",{nodeId:e.id,unknownOutputs:r});const i=o.outputs.filter(e=>!0===e.required&&!(e.id in t)).map(e=>e.id);if(i.length>0)throw new io(`Node '${e.id}' of kind '${e.kind}' did not produce required output(s): ${i.join(", ")}`,"GRAPH_OUTPUT_VALIDATION_FAILED",{nodeId:e.id,missingRequired:i});return t}collectCredentials(e){const t={};for(const o of e.manifest.parameters){if("credential"!==o.type)continue;const n=(e.instance.parameters??{})[o.id];"string"==typeof n&&n.length>0?t[o.id]={credentialId:n,credentialType:o.credentialType??""}:tn(n)&&(t[o.id]={credentialId:n.credentialId,credentialType:n.credentialType})}const o=(e.instance.metadata??{}).credentials;if(o&&"object"==typeof o&&!Array.isArray(o))for(const[e,n]of Object.entries(o)){const o=n;"string"==typeof o&&o.length>0?t[e]={credentialId:o,credentialType:""}:tn(o)&&(t[e]={credentialId:o.credentialId,credentialType:o.credentialType})}return t}async resolveNodeInputs(e,t,o,n){const r={},i=(t.incomingByNode.get(o.id)??[]).filter(e=>"data"===e.type),a=new Map;for(const e of i){const t=a.get(e.targetPort)??[];t.push(e),a.set(e.targetPort,t)}for(const[t,o]of a)if(1===o.length)r[t]=e.valueStore.getPort(o[0].sourceNodeId,o[0].sourcePort);else{let n,i=!1;for(const t of o){const o=e.valueStore.getPort(t.sourceNodeId,t.sourcePort);r[t.sourcePort]=o,void 0!==o&&(n=o,i=!0)}i&&void 0===r[t]&&(r[t]=n)}const s=o.instance.inputBindings??{};for(const e of o.manifest.inputs){const t=s[e.id];if("literal"===t?.mode)r[e.id]=t.value;else if("expression"===t?.mode)r[e.id]=await this.evaluateExpressionBinding(o,t.expression,r,n);else if(void 0===r[e.id]){const t=e.metadata?.defaultValue;void 0!==t&&(r[e.id]=t)}}return r}async resolveNodeParameters(e,t,o){const n=e.instance.parameters??{},r={};for(const[i,a]of Object.entries(n))r[i]=ut(a)?await this.evaluateValueTemplate(a,e,t,o):a;return r}async evaluateValueTemplate(e,t,o,n){const r=this.codeSandboxEvaluator;if(!r)throw new io(`Value template on node '${t.id}' requires a CodeSandboxEvaluator to be registered in GraphExecutionEngineConfig.codeSandboxEvaluator`,"GRAPH_CODE_SANDBOX_NOT_CONFIGURED",{nodeId:t.id});const i=e.language??("expression"===e.mode?"javascript":"text"),a="template"===e.mode?(e=>`\`${e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\{\{\s*([\s\S]*?)\s*\}\}/g,(e,t)=>`\${${t}}`)}\``)(e.expression):e.expression,s=n.metadata;return await r.evaluate({code:a,language:"typescript"===i?"typescript":"javascript",input:o,vars:s?.vars??void 0,item:s?.item,index:s?.index,abortSignal:n.abortSignal})}async evaluateExpressionBinding(e,t,o,n){const r=this.codeSandboxEvaluator;if(!r)throw new io(`Expression binding on node '${e.id}' requires a CodeSandboxEvaluator to be registered in GraphExecutionEngineConfig.codeSandboxEvaluator`,"GRAPH_CODE_SANDBOX_NOT_CONFIGURED",{nodeId:e.id,expression:t});const i=n.metadata;return await r.evaluate({code:t,language:"javascript",input:o,vars:i?.vars??void 0,item:i?.item,index:i?.index,abortSignal:n.abortSignal})}async tryPinnedValue(e,t,o,n){if(!(new mn).shouldUsePinnedValue(o))return;const r=this.createPinningService(e),i=this.computeDependencyFingerprints(e,t,o.id);return r.readPinnedValue(t.workflowId,o,n,i)}computeDependencyFingerprints(e,t,o){const n=this.createPinningService(e),r=(new yn).getDependencies(t,o),i={};for(const o of r){const r=t.nodes.find(e=>e.id===o);if(r){const a=e.nodeResults.get(o),s=a?.inputs??{},d=this.computeDependencyFingerprints(e,t,o);i[o]=n.computeFingerprint(t.workflowId,r,s,d)}}return i}routeOutgoingEdges(e,t,o,n,r){const i=(t.outgoingByNode.get(o.id)??[]).filter(e=>"data"===e.type);for(const a of i){if(!Object.prototype.hasOwnProperty.call(n,a.sourcePort))continue;const i=n[a.sourcePort];e.activateDataEdge(a.id),a.targetNodeId===Vt&&e.valueStore.setWorkflowOutput(a.targetPort,i),this.emitEdgeStateChanged(e,t,o,a,de.SUCCEEDED,se.SUCCEEDED,r),r({type:ce.EDGE_VALUE_ROUTED,runId:e.runId,workflowId:t.workflowId,edgeId:a.id,nodeId:o.id,path:[],payload:{edge:a,value:i}}).catch(()=>{})}}emitNodeStateChanged(e,t,o,n,r,i,a){a({type:ce.NODE_STATE_CHANGED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:n,status:i,payload:{nodeId:o.id,state:r,runId:e.runId,workflowId:t.workflowId,status:i}}).catch(()=>{})}emitEdgeStateChanged(e,t,o,n,r,i,a){a({type:ce.EDGE_STATE_CHANGED,runId:e.runId,workflowId:t.workflowId,edgeId:n.id,nodeId:o.id,path:[],status:i,payload:{edgeId:n.id,state:r,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,status:i}}).catch(()=>{})}createPinningService(e){const t=un(e.valueStore.getAdapter()??this.valueAdapter);return new hn(t,new mn,new yn)}executionLimits(e){return{maxLoopIterations:e.maxLoopIterations??Qt,maxForeachIterations:e.maxForeachIterations??Zt}}assertNotAborted(e){if(!0===e.abortSignal?.aborted)throw new go(e.runId??"unknown")}toErrorPayload(e){return e instanceof Error?{name:e.name,message:e.message,stack:e.stack,code:e.graphCode??("number"==typeof e.code?e.code+"":e.code)}:{name:"UnknownError",message:e+""}}}class bn{constructor(e){this.catalogue=e}async resolveNodes(e,t,o,...n){const r=new Map;for(const[i,a]of e.entries()){const e=`nodes[${i}]`;if(this.catalogue.has(a.kind,...n))try{const e=await this.catalogue.resolveManifest(a.kind,a,o,...n),t=this.catalogue.getExecutor(a.kind,...n);r.set(a.id,{instance:a,manifest:e,executor:t})}catch(o){t.push({code:"kind.resolution-failed",path:e+".kind",message:`Node '${a.id}' kind '${a.kind}' failed to resolve: ${o.message}`,nodeId:a.id,details:{kind:a.kind}})}else t.push({code:"kind.unknown",path:e+".kind",message:`Node '${a.id}' references kind '${a.kind}' which is not registered in the backend catalogue`,nodeId:a.id,details:{kind:a.kind}})}return r}validateEffectivePorts(e,t,o,n){const r=!0===t.policies?.allowUndeclaredParameters,i=new Set(t.inputs.map(e=>e.id)),a=new Set(t.outputs.map(e=>e.id));for(const a of Object.keys(e.inputBindings??{}))r||i.has(a)||o.push({code:"binding.unknown-port",path:`${n}.inputBindings.${a}`,message:`Node '${e.id}' input binding '${a}' does not refer to an effective input port of kind '${t.kind}'`,nodeId:e.id,details:{effectiveInputs:[...i]}});for(const i of Object.keys(e.outputBindings??{}))r||a.has(i)||o.push({code:"binding.unknown-port",path:`${n}.outputBindings.${i}`,message:`Node '${e.id}' output binding '${i}' does not refer to an effective output port of kind '${t.kind}'`,nodeId:e.id,details:{effectiveOutputs:[...a]}})}}function vn(e,t,o="$"){const n=new Set;for(const t of e.edges)"node"===t.source.scope&&n.add(t.source.nodeId),"node"===t.target.scope&&n.add(t.target.nodeId);for(const r of e.nodes){n.has(r.id)||t.push({code:"topology.loose-node",path:`${o}.nodes[${r.id}]`,message:`Node '${r.id}' is connected to nothing; every node must participate in at least one edge`,nodeId:r.id});const e=r.loop?.body;e&&vn(e,t,`${o}.nodes[${r.id}].loop.body`)}}class In{resolveEdges(e,t,o){const n=new Set(e.inputs.map(e=>e.id)),r=new Set(e.outputs.map(e=>e.id)),i=[];for(const[a,s]of(e.edges??[]).entries()){const e=`edges[${a}]`,d=this.resolveEndpoint(s,"source",t,n,r,o,e),l=this.resolveEndpoint(s,"target",t,n,r,o,e);if(!d||!l)continue;if(!this.validateDirectionAndType(s,d,l,t,o,e))continue;const c={id:s.id,type:s.type,sourceNodeId:d.nodeId,sourcePort:d.port,targetNodeId:l.nodeId,targetPort:l.port,metadata:s.metadata,edge:s};void 0!==s.label&&(c.label=s.label),i.push(c)}return i}resolveEndpoint(e,t,o,n,r,i,a){const s=e[t];return Xe(s)?("source"===t?n.has(s.port):r.has(s.port))?{nodeId:Vt,port:s.port}:void i.push({code:"edge.unknown-port",path:`${a}.${t}`,message:`Edge '${e.id}' ${t} references workflow port '${s.port}' which is not declared on the document boundary`,edgeId:e.id,details:{scope:"workflow",port:s.port}}):Ye(s)?o.get(s.nodeId)?{nodeId:s.nodeId,port:s.port}:void i.push({code:"edge.unknown-node",path:`${a}.${t}`,message:`Edge '${e.id}' ${t} references node '${s.nodeId}' which is not part of the document or did not resolve`,edgeId:e.id,nodeId:s.nodeId}):void i.push({code:"edge.invalid-endpoint",path:`${a}.${t}`,message:`Edge '${e.id}' ${t} endpoint is not a valid GraphEndpoint`,edgeId:e.id})}validateDirectionAndType(e,t,o,n,r,i){let a=!0;const s=t.nodeId===Vt?void 0:n.get(t.nodeId),d=o.nodeId===Vt?void 0:n.get(o.nodeId),l=e=>!0===e?.manifest.policies?.allowUndeclaredParameters;if("data"===e.type)!s||l(s)||this.hasPortDirection(s,t.port,"output")||(this.pushPortIssue(e,"source",t,s,r,i),a=!1),!d||l(d)||this.hasPortDirection(d,o.port,"input")||(this.pushPortIssue(e,"target",o,d,r,i),a=!1);else{if(!s||!d)return r.push({code:"edge.boundary-routing",path:i,message:`Connection edge '${e.id}' must connect two node connection ports; the workflow boundary only routes data`,edgeId:e.id}),!1;if(!(l(s)||l(d)||this.hasPortDirection(s,t.port,"connection")&&this.hasPortDirection(d,o.port,"connection")))return r.push({code:"edge.type-mismatch",path:i,message:`Connection edge '${e.id}' endpoints must both be connection ports`,edgeId:e.id,details:{sourcePort:t.port,targetPort:o.port}}),!1}return a}hasPortDirection(e,t,o){return("input"===o?e.manifest.inputs:"output"===o?e.manifest.outputs:e.manifest.connections??[]).some(e=>e.id===t)}pushPortIssue(e,t,o,n,r,i){const a="source"===t?"output":"input";r.push({code:"data"===e.type?"edge.invalid-direction":"edge.type-mismatch",path:`${i}.${t}`,message:`Edge '${e.id}' ${t} port '${o.port}' on node '${o.nodeId}' is not an ${a} port of kind '${n.manifest.kind}'`,edgeId:e.id,nodeId:o.nodeId,details:{port:o.port,expected:a}})}}class En{validate(e,t){this.validateDuplicates(e.edges,t),this.validatePolicies(e,t)}validateDuplicates(e,t){const o=new Map;for(const n of e){const e=`${n.sourceNodeId}:${n.sourcePort}->${n.targetNodeId}:${n.targetPort}`,r=o.get(e);r?t.push({code:"connection.duplicate-edge",path:`edges[${n.id}]`,message:`Edge '${n.id}' duplicates the routing of edge '${r.id}' (${e})`,edgeId:n.id,details:{duplicateOf:r.id,routing:e}}):o.set(e,n)}}validatePolicies(e,t){const o=new Map;for(const t of e.edges){if("connection"!==t.type)continue;const e=`${t.targetNodeId}:${t.targetPort}`,n=o.get(e)??[];n.push(t),o.set(e,n)}for(const o of e.edges){if("connection"!==o.type)continue;const n=e.nodeById.get(o.targetNodeId),r=n?.manifest.connections?.find(e=>e.id===o.targetPort)?.connectionPolicy;this.validateEdgePolicy(o,e.nodeById,r,t)}for(const[n,r]of o){const o=n.lastIndexOf(":"),i=n.slice(0,o),a=n.slice(o+1),s=e.nodeById.get(i),d=s?.manifest.connections?.find(e=>e.id===a)?.connectionPolicy;if(!d)continue;const l=void 0!==d.maxConnections?d.maxConnections:!1===d.allowMultiple?1:1/0;r.length>l&&t.push({code:"connection.max-connections",path:`edges[${r[r.length-1].id}]`,message:`Connection port '${a}' on node '${i}' accepts at most ${l} connection(s) but has ${r.length}`,nodeId:i,edgeId:r[r.length-1].id,details:{port:a,max:l,actual:r.length}})}}validateEdgePolicy(e,t,o,n){if(e.sourceNodeId===e.targetNodeId&&!o?.allowSelf)return void n.push({code:"connection.self-connection",path:`edges[${e.id}]`,message:`Edge '${e.id}' connects node '${e.sourceNodeId}' to itself, which the target port policy does not allow`,edgeId:e.id,nodeId:e.sourceNodeId});if(!o)return;const r=t.get(e.sourceNodeId),i=r?.manifest.kind;if(!o.allowedNodeKinds?.length||i&&o.allowedNodeKinds.includes(i)||n.push({code:"connection.policy",path:`edges[${e.id}]`,message:`Connection edge '${e.id}' source kind '${i??"unknown"}' is not in the allowed node kinds of target port '${e.targetPort}'`,edgeId:e.id,nodeId:e.sourceNodeId,details:{allowedNodeKinds:o.allowedNodeKinds}}),i&&o.blockedNodeKinds?.includes(i)&&n.push({code:"connection.policy",path:`edges[${e.id}]`,message:`Connection edge '${e.id}' source kind '${i}' is blocked by target port '${e.targetPort}'`,edgeId:e.id,nodeId:e.sourceNodeId,details:{blockedNodeKinds:o.blockedNodeKinds}}),o.allowedPortCategories?.length){const t=r?.manifest.connections?.find(t=>t.id===e.sourcePort)?.category;t&&o.allowedPortCategories.includes(t)||n.push({code:"connection.policy",path:`edges[${e.id}]`,message:`Connection edge '${e.id}' source port '${e.sourcePort}' category '${t??"unknown"}' is not in the allowed port categories of target port '${e.targetPort}'`,edgeId:e.id,nodeId:e.sourceNodeId,details:{allowedPortCategories:o.allowedPortCategories}})}}}class Nn{constructor(e){this.authorizer=e}async validate(e,t,o,n){const r=this.collectReferences(e,t);for(const i of t.credentials??[]){const a=r.find(e=>void 0===e.credentialType||e.credentialType===i.type);if(a){if(this.checkType(a,i))o.push({code:"credential.type-mismatch",path:n,message:`Node '${e.id}' credential '${a.credentialId}' has type '${a.credentialType}' but kind '${t.kind}' requires '${i.type}'`,nodeId:e.id,details:{credentialType:a.credentialType??"",requiredType:i.type}});else if(this.authorizer){if(!await this.authorizer.hasCredential(a)){o.push({code:"credential.not-found",path:n,message:`Node '${e.id}' references credential '${a.credentialId}' which does not exist`,nodeId:e.id,details:{credentialId:a.credentialId}});continue}await this.authorizer.authorize(a,i)||o.push({code:"credential.unauthorized",path:n,message:`Node '${e.id}' is not authorized to use credential '${a.credentialId}'`,nodeId:e.id,details:{credentialId:a.credentialId}})}}else!1!==i.required&&o.push({code:"credential.missing",path:n,message:`Node '${e.id}' does not provide the required credential of type '${i.type}'`,nodeId:e.id,details:{credentialType:i.type}})}this.scanPlainSecrets(e,o,n)}collectReferences(e,t){const o=[];for(const n of t.parameters){if("credential"!==n.type)continue;const t=(e.parameters??{})[n.id];tn(t)&&o.push(this.normalize(t,n.credentialType))}const n=(e.metadata??{}).credentials;if(n&&"object"==typeof n&&!Array.isArray(n))for(const e of Object.values(n))tn(e)&&o.push(this.normalize(e));return o}normalize(e,t){return"string"==typeof e?{credentialId:e,credentialType:t??""}:{credentialId:e.credentialId,credentialType:e.credentialType??t??""}}checkType(e,t){return void 0!==e.credentialType&&e.credentialType!==t.type}scanPlainSecrets(e,t,o){const n=new Set(nn);for(const[r,i]of Object.entries(e.parameters??{}))this.scanPlainSecretValue(i,[r],e,o+".parameters",n,t);for(const[r,i]of Object.entries(e.metadata??{}))this.scanPlainSecretValue(i,[r],e,o+".metadata",n,t)}scanPlainSecretValue(e,t,o,n,r,i,a=0){const s=t[t.length-1];if(r.has(s))i.push({code:"credential.plain-secret",path:`${n}.${t.join(".")}`,message:`Node '${o.id}' carries plain secret material in '${t.join(".")}'; workflow documents may only hold credential references`,nodeId:o.id});else if(8>a&&null!==e)if(Array.isArray(e))for(const s of e)this.scanPlainSecretValue(s,[...t,"[]"],o,n,r,i,a+1);else if("object"==typeof e)for(const[s,d]of Object.entries(e))this.scanPlainSecretValue(d,[...t,s],o,n,r,i,a+1)}}class kn extends A{constructor(e,t=[]){super(e),this.issues=t,this.name=kn.name}}class On extends A{constructor(e,t){super(e),this.edgeId=t,this.name=On.name}}class An extends U{constructor(e){super(e),this.name=An.name}}const xn={maxDocumentBytes:2e6,maxNestingDepth:10,maxNodes:500,maxEdges:1e3},_n=["node","definition","executor","execute","ports","component"];function Sn(e){if(!e||"object"!=typeof e)return!1;const t=e;return pt(t.document)&&Array.isArray(t.nodes)&&Array.isArray(t.edges)&&t.nodeById instanceof Map&&t.incomingByNode instanceof Map&&t.outgoingByNode instanceof Map&&t.nodes.every(e=>null!==e&&"object"==typeof e&&"object"==typeof e.instance&&"object"==typeof e.manifest&&"object"==typeof e.executor)}function Dn(e,t){const o=[];for(const n of Object.keys(e))_n.includes(n)&&o.push({code:"document.forbidden-field",path:`${t}.${n}`,message:`Field '${n}' is not accepted in a canonical workflow document: node, definition, executor, execute, ports and component fields are rejected`,details:{field:n}});return o}class Pn{constructor(e){this.options=e,this.parameterValidator=new rn,this.edgeValidator=new In,this.connectionPolicyValidator=new En,this.nodeValidator=new bn(e.catalogue),this.credentialValidator=new Nn(e.credentialAuthorizer)}async validateOrThrow(e,...t){const o=await this.validate(e,0,...t);if(!o.valid||!o.resolved)throw new kn(`Graph workflow document '${e.id}' failed validation with ${o.issues.length} issue(s)`,o.issues);return o.resolved}async validate(e,t=0,...o){const n=[],r={...xn,...this.options.limits};if(!await this.validateStructure(e,r,t,n,...o))return{valid:!1,issues:n};const i=await this.nodeValidator.resolveNodes(e.nodes,n,this.options.resolutionContext,...o),a=e.nodes.filter(e=>i.has(e.id)).map(e=>i.get(e.id)),s=(e=>{const t=new Map;for(const o of e.edges??[]){if("data"!==o.type)continue;const e=o.target;if("node"!==e.scope)continue;const n=t.get(e.nodeId)??new Set;n.add(e.port),t.set(e.nodeId,n)}return t})(e);for(const e of a)this.parameterValidator.validate(e.instance,e.manifest,n,`nodes[${e.instance.id}]`,s.get(e.instance.id));for(const e of a)this.nodeValidator.validateEffectivePorts(e.instance,e.manifest,n,`nodes[${e.instance.id}]`);const d=this.edgeValidator.resolveEdges(e,i,n),l=new Map,c=new Map;for(const e of d){if(e.targetNodeId!==Vt){const t=l.get(e.targetNodeId)??[];t.push(e),l.set(e.targetNodeId,t)}if(e.sourceNodeId!==Vt){const t=c.get(e.sourceNodeId)??[];t.push(e),c.set(e.sourceNodeId,t)}}this.connectionPolicyValidator.validate({edges:d,nodeById:i},n),this.validateAcyclicity(a,d,e,n),vn(e,n);for(const e of a)this.parameterValidator.validateBindingSatisfaction(e.instance,e.manifest,l.get(e.instance.id)??[],n,`nodes[${e.instance.id}]`,{allowLiteralAndEdgeBindings:this.options.allowLiteralAndEdgeBindings});this.validateRequiredWorkflowOutputs(e,c,n);for(const e of a)await this.credentialValidator.validate(e.instance,e.manifest,n,`nodes[${e.instance.id}]`);return this.validateCapabilities(a,n),n.length>0?{valid:!1,issues:n}:{valid:!0,issues:n,resolved:{document:e,nodes:a,edges:d,nodeById:i,incomingByNode:l,outgoingByNode:c}}}async validateStructure(e,t,o,n,...r){if(!pt(e))return n.push({code:"document.shape",path:"$",message:"Payload is not a canonical GraphWorkflowDocument: id and name must be strings and inputs, outputs, nodes and edges must be arrays"}),!1;if(e.id&&e.id.trim()||n.push({code:"document.empty-id",path:"$.id",message:"Workflow document id must be a non-empty string"}),!Ue(e))return n.push({code:"document.json-unsafe",path:"$",message:"Document contains JSON-unsafe values: functions, class instances, undefined, NaN/Infinity, symbol keys and unsafe prototype keys are rejected"}),!1;n.push(...Dn(e,"$"));for(const t of[...e.inputs,...e.outputs])n.push(...Dn(t,"ports"));for(const t of e.nodes)n.push(...Dn(t,`nodes[${t.id}]`));for(const t of e.edges)n.push(...Dn(t,`edges[${t.id}]`));this.validateUniqueIds(e,n),this.validateLimits(e,t,o,n);try{ot(e)}catch(e){n.push({code:"document.structure",path:"$",message:e instanceof Error?e.message:e+""})}return await this.validateNestedBodies(e,o,n,...r),!0}validateUniqueIds(e,t){const o=new Set,n=new Set;for(const[r,i]of[["input",e.inputs],["output",e.outputs]]){const e="input"===r?o:n;for(const o of i)e.has(o.id)?t.push({code:"document.duplicate-port-id",path:`${"input"===r?"inputs":"outputs"}[${o.id}]`,message:`Workflow ${r} port '${o.id}' is declared more than once; workflow port ids must be unique`}):e.add(o.id)}const r=new Set;for(const o of e.nodes)r.has(o.id)?t.push({code:"document.duplicate-node-id",path:`nodes[${o.id}]`,message:`Node '${o.id}' is declared more than once; node ids must be unique`,nodeId:o.id}):r.add(o.id);const i=new Set;for(const o of e.edges)i.has(o.id)?t.push({code:"document.duplicate-edge-id",path:`edges[${o.id}]`,message:`Edge '${o.id}' is declared more than once; edge ids must be unique`,edgeId:o.id}):i.add(o.id)}validateLimits(e,t,o,n){e.nodes.length>t.maxNodes&&n.push({code:"document.limit.nodes",path:"$.nodes",message:`Document declares ${e.nodes.length} nodes; at most ${t.maxNodes} are allowed`,details:{count:e.nodes.length,limit:t.maxNodes}}),e.edges.length>t.maxEdges&&n.push({code:"document.limit.edges",path:"$.edges",message:`Document declares ${e.edges.length} edges; at most ${t.maxEdges} are allowed`,details:{count:e.edges.length,limit:t.maxEdges}}),o>t.maxNestingDepth&&n.push({code:"document.limit.depth",path:"$",message:`Document nests loop bodies ${o} levels deep; at most ${t.maxNestingDepth} levels are allowed`,details:{depth:o,limit:t.maxNestingDepth}});const r=Buffer.byteLength(JSON.stringify(e),"utf8");r>t.maxDocumentBytes&&n.push({code:"document.limit.size",path:"$",message:`Document serializes to ${r} bytes; at most ${t.maxDocumentBytes} bytes are allowed`,details:{bytes:r,limit:t.maxDocumentBytes}})}async validateNestedBodies(e,t,o,...n){for(const r of e.nodes){const e=[["loop.body",r.loop?.body],["errorBoundary.try",r.errorBoundary?.try],["errorBoundary.catch",r.errorBoundary?.catch],["errorBoundary.finally",r.errorBoundary?.finally]];for(const[i,a]of e){if(!a)continue;const e=await this.validate(a,t+1,...n);for(const t of e.issues)o.push({...t,path:`nodes[${r.id}].${i}.${t.path}`,nodeId:t.nodeId??r.id})}}}validateAcyclicity(e,t,o,n){const r=new Set(e.map(e=>e.instance.id)),i=new Map(e.map(e=>[e.instance.id,0]));for(const e of t)r.has(e.sourceNodeId)&&i.has(e.targetNodeId)&&i.set(e.targetNodeId,(i.get(e.targetNodeId)??0)+1);const a=[...i.entries()].filter(([,e])=>0===e).map(([e])=>e),s=[];for(;a.length>0;){const e=a.shift();s.push(e);for(const o of t){if(o.sourceNodeId!==e)continue;if(!i.has(o.targetNodeId))continue;const t=(i.get(o.targetNodeId)??1)-1;i.set(o.targetNodeId,t),0===t&&a.push(o.targetNodeId)}}if(s.length!==i.size){const e=[...i.keys()].filter(e=>!s.includes(e));n.push({code:"topology.cycle",path:"$.edges",message:`Workflow '${o.id}' contains an unsupported cycle involving node(s): ${e.join(", ")}`,details:{cyclicNodes:e}})}}validateRequiredWorkflowOutputs(e,t,o){const n=new Set;for(const e of t.values())for(const t of e)t.targetNodeId===Vt&&n.add(t.targetPort);for(const t of e.outputs)!0===t.required&&void 0===t.defaultValue&&(n.has(t.id)||o.push({code:"topology.required-output-unsatisfiable",path:`outputs[${t.id}]`,message:`Required workflow output '${t.id}' has no incoming edge from any node`}))}validateCapabilities(e,t){for(const o of e){const e=o.manifest;for(const n of e.capabilities??[])gt(n)||t.push({code:"capability.invalid",path:`nodes[${o.instance.id}]`,message:`Kind '${e.kind}' declares unknown capability '${n+""}'`,nodeId:o.instance.id,details:{capability:n+""}});!0!==e.policies?.allowUndeclaredParameters&&o.instance.loop&&((e.capabilities??[]).includes("loop")||t.push({code:"capability.loop-not-supported",path:`nodes[${o.instance.id}].loop`,message:`Node '${o.instance.id}' carries loop configuration but kind '${e.kind}' does not declare the 'loop' capability`,nodeId:o.instance.id}))}}}let Rn=class extends B{constructor(){super()}async plan(e,...t){const{log:o}=(await this.logCtx(t,"plan",!0)).for(this.plan);if(o.debug(`Planning resolved workflow '${e?.document?.id??"unknown"}'`),!Sn(e))throw new ho("GraphExecutionPlanner.plan accepts only a GraphResolvedWorkflow produced by the nine-stage validation gate; raw workflow definitions and inline node definitions are rejected",{received:(n=e,n&&"object"==typeof n?{reason:"input is not a GraphResolvedWorkflow",looksLikeWorkflowDefinition:"nodes"in n&&"relations"in n&&!("nodeById"in n),hasResolvedNodes:Array.isArray(n.nodes)}:{reason:"input is not an object"})});var n;const r=this.buildPlanNodes(e),i=this.buildPlanEdges(e),a=this.buildIncomingMap(i),s=this.buildOutgoingMap(i),d=this.topologicalLayers(r,i);return{resolved:e,workflowId:e.document.id||e.document.name,nodes:r,edges:i,layers:d,incomingByNode:a,outgoingByNode:s}}buildPlanNodes(e){return e.nodes.map(e=>({id:e.instance.id,kind:e.manifest.kind,instance:e.instance,manifest:e.manifest,executor:e.executor,inputPorts:e.manifest.inputs.map(e=>e.id),outputPorts:e.manifest.outputs.map(e=>e.id),connectionPorts:(e.manifest.connections??[]).map(e=>e.id),metadata:e.instance.metadata}))}buildPlanEdges(e){return e.edges.map(e=>({id:e.id,type:e.type,sourceNodeId:e.sourceNodeId,sourcePort:e.sourcePort,targetNodeId:e.targetNodeId,targetPort:e.targetPort,...void 0!==e.label?{label:e.label}:{},metadata:e.metadata}))}buildIncomingMap(e){const t=new Map;for(const o of e){if(o.targetNodeId===Vt)continue;const e=t.get(o.targetNodeId)??[];e.push(o),t.set(o.targetNodeId,e)}return t}buildOutgoingMap(e){const t=new Map;for(const o of e){if(o.sourceNodeId===Vt)continue;const e=t.get(o.sourceNodeId)??[];e.push(o),t.set(o.sourceNodeId,e)}return t}topologicalLayers(e,t){const o=e.filter(e=>e.id!==Vt),n=new Set(o.map(e=>e.id)),r=t.filter(e=>n.has(e.sourceNodeId)&&n.has(e.targetNodeId)),i=new Map;for(const e of o)i.set(e.id,0);for(const e of r)i.set(e.targetNodeId,(i.get(e.targetNodeId)??0)+1);const a=[],s=new Set;let d=o.filter(e=>0===(i.get(e.id)??0)),l=0;for(;d.length>0;){const e={index:l++,nodes:d};a.push(e);const t=[];for(const e of d){s.add(e.id);const n=r.filter(t=>t.sourceNodeId===e.id);for(const e of n){const n=(i.get(e.targetNodeId)??1)-1;if(i.set(e.targetNodeId,n),0===n&&!s.has(e.targetNodeId)){const n=o.find(t=>t.id===e.targetNodeId);n&&t.push(n)}}}d=t}if(s.size!==o.length){const e=o.filter(e=>!s.has(e.id)).map(e=>e.id);throw new ao({unplannedNodes:e,workflowId:o[0]?.manifest.kind})}return a}};Rn=S([F(),D("design:paramtypes",[])],Rn);const $n=new Set(["engine","valueAdapter","codeSandboxEvaluator","workflowStore"]);function Cn(e,t){const o={};for(const[n,r]of Object.entries(e??{}))$n.has(n)&&!t.has(n)||(o[n]=r);return o}class Tn extends W{constructor(){super()}async initialize(...e){const t=e[0];if(!t||"object"!=typeof t||!t.registry)return this._config=void 0,this._client=void 0,{config:void 0,client:void 0};const o=t.catalogue??t.registry.catalog,n=t.valueAdapter??q.current;if(!n)throw new io("GraphExecutionEngine requires a Decaf adapter for cached/pinned values: pass `valueAdapter` or configure one via `Adapter.setCurrent(...)`","GRAPH_VALUE_ADAPTER_MISSING");const r=t.backend??Fo.current??new wn,i={registry:t.registry,catalogue:o,planner:t.planner??new Rn,backend:r,valueAdapter:n,eventEmitter:t.eventEmitter??new yo,documentValidator:t.documentValidator??new Pn({catalogue:o,limits:t.documentLimits,credentialAuthorizer:t.credentialAuthorizer}),authValidator:new $o({enabled:!0===t.authEnabled,...t.authMatch?{match:t.authMatch}:{}}),...t.codeSandboxEvaluator?{codeSandboxEvaluator:t.codeSandboxEvaluator}:{}};this._config=t,this._client=i;const a=new Set(["engine","valueAdapter"]);t.codeSandboxEvaluator&&a.add("codeSandboxEvaluator"),t.workflowStore&&a.add("workflowStore");const s=Cn(r.config,a);if(await r.initialize({...s,valueAdapter:n,...t.codeSandboxEvaluator?{codeSandboxEvaluator:t.codeSandboxEvaluator}:{},...t.workflowStore?{workflowStore:t.workflowStore}:{},engine:this}),t.seedWorkflows&&t.seedWorkflows.length>0){const o=r.seedWorkflows;if("function"!=typeof o)throw new io(`Graph execution backend '${r.constructor?.name??"GraphExecutionBackend"}' does not support workflow seeding`,"GRAPH_BACKEND_SEED_NOT_SUPPORTED",{backend:r.constructor?.name??"GraphExecutionBackend"});await o.call(r,t.seedWorkflows,...e.slice(1))}return await(t.onEngineCreated?.(this)),{config:t,client:i}}get codeSandboxEvaluator(){return this.client.codeSandboxEvaluator}get emitter(){return this.client.eventEmitter}get planner(){return this.client.planner}get valueAdapter(){return this.client.valueAdapter}get defaultOptions(){return this.config.defaultOptions??{}}get documentValidator(){return this.client.documentValidator}observe(e){return this.emitter.observe(e)}unObserve(e){this.emitter.unObserve(e)}async dispatchEvent(e){await this.emitter.updateObservers(e)}async execute(e,t={},o={},...n){const{log:r,ctx:i}=(await this.logCtx(n,"execute",!0)).for(this.execute);r.debug(`Executing workflow '${e.id||e.name}'`);const a=this.mergeOptions(o);this.assertNotAborted(a);const s=Ro(Do(i),a.auth);a.auth=s,a.metadata={...a.metadata??{},...s};const d=a.runId??this.generateRunId();a.runId=d;const l=a.path??[],c=new wo,u=un(this.valueAdapter);u.seedWorkflowInputs(this.withWorkflowInputDefaults(e,t));const p=new Go(this.emitter,c,{runId:d,parentRunId:a.parentRunId,workflowId:e.id||e.name,path:l,engine:this,...this.codeSandboxEvaluator?{codeSandboxEvaluator:this.codeSandboxEvaluator}:{}});await p.emit({type:ce.VALIDATION_STARTED,status:se.PLANNING});const h=await this.documentValidator.validate(e,0,i);if(!h.valid||!h.resolved)throw await p.emit({type:ce.VALIDATION_FAILED,status:se.FAILED,payload:{issues:h.issues}}),new kn(`Graph workflow document '${e.id}' failed validation with ${h.issues.length} issue(s)`,h.issues);await p.emit({type:ce.VALIDATION_COMPLETED,status:se.PLANNING,payload:{issues:h.issues.length}}),this.assertNotAborted(a);const f=await this.planner.plan(h.resolved);this.client.authValidator.validate(e,f,s,r),r.debug(`Authorized workflow '${e.id||e.name}' for user ${s.user??"anonymous"}`),this.assertCodeModeSupported(e);const g=new Mo(d,f,u,c);return p.bindFrame(g),await p.emit({type:ce.WORKFLOW_STARTED,runId:d,parentRunId:a.parentRunId,workflowId:f.workflowId,path:l,status:se.RUNNING,payload:{inputs:t}}),await p.emit({type:ce.WORKFLOW_PLANNED,runId:d,parentRunId:a.parentRunId,workflowId:f.workflowId,path:l,status:se.PLANNING,payload:{layers:f.layers.length,nodes:f.nodes.length}}),await this.client.backend.execute({document:e,plan:f,inputs:t,options:a,events:p},...n)}get backend(){return this.client.backend}get backendCapabilities(){return Uo(this.client.backend)}async listWorkflows(...e){const t=this.client.backend;if("supported"!==Uo(t).workflows.list||"function"!=typeof t.listWorkflows)throw new io(`Graph execution backend '${this.backendName}' does not support workflow listing`,"GRAPH_BACKEND_WORKFLOWS_NOT_SUPPORTED",{backend:this.backendName});return await t.listWorkflows(...e)}async getWorkflow(e,...t){const o=this.client.backend;if("supported"!==Uo(o).workflows.get||"function"!=typeof o.getWorkflow)throw new io(`Graph execution backend '${this.backendName}' does not support workflow lookup`,"GRAPH_BACKEND_WORKFLOWS_NOT_SUPPORTED",{backend:this.backendName,workflowId:e});return await o.getWorkflow(e,...t)}async listEngineWorkflows(e,...t){const o=Fo.getOrFail(e);if("supported"!==Uo(o).workflows.list||"function"!=typeof o.listWorkflows)throw new io(`Graph execution backend '${e}' does not support workflow listing`,"GRAPH_BACKEND_WORKFLOWS_NOT_SUPPORTED",{backend:e});return await o.listWorkflows(...t)}async getEngineWorkflow(e,t,...o){const n=Fo.getOrFail(e);if("supported"!==Uo(n).workflows.get||"function"!=typeof n.getWorkflow)throw new io(`Graph execution backend '${e}' does not support workflow lookup`,"GRAPH_BACKEND_WORKFLOWS_NOT_SUPPORTED",{backend:e,workflowId:t});return await n.getWorkflow(t,...o)}get backendName(){return this.client.backend.constructor?.name??"GraphExecutionBackend"}assertCodeModeSupported(e){const t=this.client.backend;if(t.local)return;const o=Yo(e);if(0!==o.length){if("unsupported"===t.codeMode)throw new io(`Graph execution backend '${this.backendName}' does not support code-mode workflows`,"GRAPH_CODE_MODE_UNSUPPORTED_BACKEND",{backend:this.backendName,surfaces:o});if(!this.codeSandboxEvaluator)throw new io("Code-mode workflows require a CodeSandboxEvaluator to be registered in GraphExecutionEngineConfig.codeSandboxEvaluator","GRAPH_CODE_SANDBOX_NOT_CONFIGURED",{backend:this.backendName,surfaces:o})}}async pinNode(e){const t=this.createPinningService();await t.pinNode(e),await this.emitPinningEvent(e.nodeId,ce.NODE_PINNED)}async unpinNode(e){const t=this.createPinningService();await t.unpinNode(e),await this.emitPinningEvent(e.nodeId,ce.NODE_UNPINNED)}createPinningService(){const e=un(this.valueAdapter);return new hn(e,new mn,new yn)}async emitPinningEvent(e,t){const o=(new wo).create({id:"",sequence:0,timestamp:new Date,runId:"pinning",workflowId:"",type:t,nodeId:e,path:[]});await this.emitter.updateObservers(o)}withWorkflowInputDefaults(e,t){const o={...t};for(const t of e.inputs)void 0===o[t.id]&&void 0!==t.defaultValue&&(o[t.id]=t.defaultValue);return o}mergeOptions(e){return{concurrency:4,failFast:!0,validateInputs:!0,validateOutputs:!0,maxLoopIterations:Qt,maxForeachIterations:Zt,usePinnedValues:!0,writeThroughCache:!1,path:[],metadata:{},...this.defaultOptions,...e}}assertNotAborted(e){if(!0===e.abortSignal?.aborted)throw new go(e.runId??"unknown")}generateRunId(){const e=globalThis.crypto;if(!e||"function"!=typeof e.randomUUID)throw new io("Cannot generate a graph run id: crypto.randomUUID is unavailable in this runtime","GRAPH_RUN_ID_ERROR",{runtime:typeof globalThis.crypto});return e.randomUUID()}}const Ln=new Set(["process","require","module","exports","global","globalThis","Function","eval","fetch","XMLHttpRequest","WebSocket","Worker","Deno","Bun","__dispatch"]);class Mn extends W{constructor(){super()}async initialize(...e){const t=e[0]??{},o=t&&"object"==typeof t?t:{};return this._config=o,this._client=V,{config:o,client:V}}get defaultTimeoutMs(){return this.config.timeoutMs??1e3}get defaultMemoryMb(){return this.config.memoryMb??32}async evaluate(e,...t){(await this.logCtx(t,"evaluate",!0)).for(this.evaluate);const o=e.code;if(!o||"string"!=typeof o||0===o.trim().length)throw new io("Code sandbox received empty code","GRAPH_CODE_SANDBOX_EMPTY_CODE");const n=((e,t)=>"javascript"===t?e:X.transpileModule(e,{compilerOptions:{target:X.ScriptTarget.ES2022,module:X.ModuleKind.None,strict:!0,noEmitHelpers:!0,importHelpers:!1}}).outputText.replace(/^"use strict";\s*/,""))(o,e.language??"javascript");(e=>{if(e.length>1e5)throw new io("Code exceeds the maximum length of 100000 characters","GRAPH_CODE_SANDBOX_CODE_TOO_LONG",{length:e.length});let t;try{t=z.parse(`async function __validate() {\n${e}\n}`,{ecmaVersion:"latest",sourceType:"script"})}catch{try{t=z.parse(e,{ecmaVersion:"latest",sourceType:"module"})}catch(t){throw new io("Code failed to parse: "+t.message,"GRAPH_CODE_SANDBOX_PARSE_ERROR",{code:e,error:t.message})}}J.full(t,e=>{const t=e;if("ImportDeclaration"===t.type)throw new io("Imports are not allowed in Code nodes.","GRAPH_CODE_SANDBOX_FORBIDDEN_TOKEN",{token:"import"});if("ExportNamedDeclaration"===t.type||"ExportDefaultDeclaration"===t.type)throw new io("Exports are not allowed in Code nodes.","GRAPH_CODE_SANDBOX_FORBIDDEN_TOKEN",{token:"export"});if("Identifier"===t.type&&"string"==typeof t.name&&Ln.has(t.name))throw new io(`Identifier "${t.name}" is not allowed in Code nodes.`,"GRAPH_CODE_SANDBOX_FORBIDDEN_TOKEN",{token:t.name});if("NewExpression"===t.type&&"Function"===t.callee?.name)throw new io("new Function() is not allowed in Code nodes.","GRAPH_CODE_SANDBOX_FORBIDDEN_TOKEN",{token:"Function"});if("CallExpression"===t.type&&"eval"===t.callee?.name)throw new io("eval() is not allowed in Code nodes.","GRAPH_CODE_SANDBOX_FORBIDDEN_TOKEN",{token:"eval"})})})(n);const r=!(e=>/\breturn\b[\s;]/.test(e))(n),i=r?n.replace(/[\s;]+$/,""):n,a={$input:e.input??{},$vars:e.vars??{},$item:e.item,$index:e.index,$node:e.nodes??{},$output:void 0},s=Object.keys(a),d=r?`return (${i});`:i,l=`"use strict";\nasync function __userFunction(${s.join(", ")}) {\n${d}\n}\n__userFunction(${s.join(", ")}).then(function(__r) { return JSON.stringify({ v: __r }); });`,c=new V.Isolate({memoryLimit:this.defaultMemoryMb}),u=await c.createContext();try{const t=u.global;e.logger&&await this.injectConsole(u,e.logger);for(const[e,o]of Object.entries(a))await t.set(e,new V.ExternalCopy(void 0===o?null:o).copyInto());let o;try{o=await c.compileScript(l,{filename:"graph-code-node.js"})}catch(e){if(!r)throw new io("Code failed to compile: "+e.message,"GRAPH_CODE_SANDBOX_COMPILE_ERROR",{code:n,error:e.message});{const e=i,t=`"use strict";\nasync function __userFunction(${s.join(", ")}) {\n${e}\n}\n__userFunction(${s.join(", ")}).then(function(__r) { return JSON.stringify({ v: __r }); });`;try{o=await c.compileScript(t,{filename:"graph-code-node.js"})}catch(e){throw new io("Code failed to compile: "+e.message,"GRAPH_CODE_SANDBOX_COMPILE_ERROR",{code:n,error:e.message})}}}const d=e.timeoutMs??this.defaultTimeoutMs;let p;try{p=await this.runBounded(o,u,d,e.abortSignal)}catch(e){if(e instanceof io)throw e;const t=e.message;if(t.includes("timed out")||t.includes("timeout"))throw new io(`Code execution timed out after ${d} ms`,"GRAPH_CODE_SANDBOX_TIMEOUT",{timeoutMs:d});if(t.includes("memory")||t.includes("heap"))throw new io(`Code exceeded the memory limit of ${this.defaultMemoryMb} MB`,"GRAPH_CODE_SANDBOX_MEMORY_LIMIT",{memoryMb:this.defaultMemoryMb});throw new io("Code execution failed: "+t,"GRAPH_CODE_SANDBOX_RUNTIME_ERROR",{code:n,error:t})}if("string"!=typeof p)throw new io("Code sandbox returned an unexpected non-string result","GRAPH_CODE_SANDBOX_UNEXPECTED_RESULT",{result:p});return JSON.parse(p).v}finally{u.release(),c.dispose()}}async runBounded(e,t,o,n){const r=e.run(t,{timeout:o,promise:!0});r.catch(()=>{});const i=[r];let a,s;try{return i.push(new Promise((e,t)=>{a=setTimeout(()=>{t(new io(`Code execution timed out after ${o} ms`,"GRAPH_CODE_SANDBOX_TIMEOUT",{timeoutMs:o}))},o+100)})),n&&i.push(new Promise((e,t)=>{const r=()=>{const e="timeout"===n.reason;t(new io(e?`Code execution timed out after ${o} ms`:"Code execution aborted",e?"GRAPH_CODE_SANDBOX_TIMEOUT":"GRAPH_CODE_SANDBOX_ABORTED",{timeoutMs:o,reason:n.reason}))};n.aborted?r():(n.addEventListener("abort",r,{once:!0}),s=()=>n.removeEventListener("abort",r))})),await Promise.race(i)}finally{a&&clearTimeout(a),s?.()}}async injectConsole(e,t){const o=new V.Reference((e,o)=>{let n;try{n=JSON.parse(o)}catch{n=[o]}const r=n.map(e=>"string"==typeof e?e:JSON.stringify(e)).join(" "),i=1===n.length?n[0]:n;switch(e){case"log":case"info":default:t.info(r,i);break;case"warn":t.warn(r,i);break;case"error":t.error(r,i);break;case"debug":case"dir":case"dirxml":case"table":t.debug(r,i);break;case"trace":t.trace(r,i);break;case"group":case"groupCollapsed":t.debug("[group] "+r,i);break;case"groupEnd":t.debug("[groupEnd]",void 0);break;case"time":case"timeEnd":case"timeLog":case"count":case"countReset":t.debug(`[${e}] ${r}`,i);break;case"assert":n[0]||t.error("Assertion failed: "+r,i);case"clear":}});await e.evalClosure("\n function __ser() {\n var out = [];\n for (var i = 0; i < arguments.length; i++) {\n var a = arguments[i];\n try { out.push(typeof a === 'object' ? JSON.parse(JSON.stringify(a)) : a); }\n catch (e) { out.push(String(a)); }\n }\n return JSON.stringify(out);\n }\n function __call(level) {\n return function() {\n $0.applySync(undefined, [level, __ser.apply(null, arguments)]);\n };\n }\n globalThis.console = {\n log: __call('log'),\n info: __call('info'),\n warn: __call('warn'),\n error: __call('error'),\n debug: __call('debug'),\n trace: __call('trace'),\n dir: __call('dir'),\n dirxml: __call('dirxml'),\n table: __call('table'),\n group: __call('group'),\n groupCollapsed: __call('groupCollapsed'),\n groupEnd: __call('groupEnd'),\n time: __call('time'),\n timeEnd: __call('timeEnd'),\n timeLog: __call('timeLog'),\n assert: __call('assert'),\n count: __call('count'),\n countReset: __call('countReset'),\n clear: __call('clear')\n };\n ",[o]),o.release()}}class jn extends x{constructor(e){super(e,jn.name,500)}}class Gn extends _{constructor(e){super(e),this.name=Gn.name}}class Un extends _{constructor(e){super(e),this.name=Un.name}}class Fn{constructor(e,t,o={}){this.kind=e,this.declarations=new Map,this.implementations=new Map;for(const e of t){if("string"!=typeof e?.name||!e.name)throw new jn(`Method declaration for kind '${this.kind}' is missing a name`);if(this.declarations.has(e.name))throw new jn(`Kind '${this.kind}' declares duplicate method '${e.name}'`);this.declarations.set(e.name,e)}for(const[e,t]of Object.entries(o)){if("function"!=typeof t)throw new jn(`Method implementation '${e}' for kind '${this.kind}' is not a function`);if(!this.declarations.has(e))throw new jn(`Kind '${this.kind}' implements method '${e}' which is not declared by its manifest`);this.implementations.set(e,t)}for(const e of this.declarations.keys())if(!this.implementations.has(e))throw new jn(`Kind '${this.kind}' declares method '${e}' with no implementation`)}has(e){return this.declarations.has(e)}getDeclaration(e){const t=this.declarations.get(e);if(!t)throw new Un(`Kind '${this.kind}' does not declare method '${e}'`);return t}get(e){return this.getDeclaration(e),this.implementations.get(e)}list(){return[...this.declarations.values()].sort((e,t)=>e.name<t.name?-1:e.name>t.name?1:0)}}function Bn(e,t){if(!t)return;let o=e;for(const e of t.split(".")){if(!o||"object"!=typeof o)return;o=o[e]}return o}function Wn(e,t,o){const n=Bn(t,e.itemIdPath),r=e.itemLabelPath?Bn(t,e.itemLabelPath):void 0;return{id:"string"==typeof n&&n||"number"==typeof n&&Number.isFinite(n)&&n+""||o+"",label:"string"==typeof r?r:void 0}}function qn(e,t){switch(t){case"input":return e.inputs;case"output":return e.outputs;default:return e.connections}}function Hn(e,t){const o={inputs:[],outputs:[],connections:[]},n={input:new Set((e.inputs??[]).map(e=>e.id)),output:new Set((e.outputs??[]).map(e=>e.id)),connection:new Set((e.connections??[]).map(e=>e.id))},r=(e,t)=>{const o=n[e];return!o.has(t)&&(o.add(t),!0)};for(const n of e.dynamicPorts??[])if("repeatFromParameter"===n.type){const e=t[n.parameter];if(!Array.isArray(e))continue;const i=qn(o,n.direction);e.forEach((e,t)=>{const{id:o,label:a}=Wn(n,e,t),s=(d={id:o,index:t,label:a??o},n.portIdTemplate.replaceAll("${id}",d.id).replaceAll("${index}",d.index+"").replaceAll("${label}",d.label));var d;if(!r(n.direction,s))return;const l=n.defaultPort?Fe(n.defaultPort):{id:s,label:a??s,direction:n.direction};l.id=s,l.direction=n.direction,a&&(l.label=a),i.push(l)})}else if("togglePort"===n.type){if(t[n.parameter]!==n.equals)continue;const e=Fe(n.port);if(!r(e.direction,e.id))continue;qn(o,e.direction).push(e)}return o}function Kn(e,t){const o=Hn(e,t),n={kind:e.kind,display:e.display,inputs:[...e.inputs,...o.inputs],outputs:[...e.outputs,...o.outputs],parameters:e.parameters},r=[...e.connections??[],...o.connections];return r.length&&(n.connections=r),e.dynamicPorts?.length&&(n.dynamicPorts=e.dynamicPorts),e.credentials?.length&&(n.credentials=e.credentials),e.capabilities?.length&&(n.capabilities=e.capabilities),e.policies&&(n.policies=e.policies),e.metadata&&(n.metadata=e.metadata),e.namespaces?.length&&(n.namespaces=e.namespaces),Fe(n)}class Vn{async resolve(e,t,o,n,r){if(o){const i=await o(n,r);if(!(e=>{if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.kind&&"object"==typeof t.display&&null!==t.display&&Array.isArray(t.inputs)&&Array.isArray(t.outputs)&&Array.isArray(t.parameters)})(i))throw new jn(`resolveManifest provider for kind '${e}' returned a value that does not conform to GraphResolvedNodeManifest`);if(!Ue(i))throw new jn(`resolveManifest provider for kind '${e}' returned a non-JSON-safe resolved manifest`);const a=Fe(i);return!a.namespaces?.length&&t.namespaces?.length&&(a.namespaces=t.namespaces.slice()),a}return Kn(t,n.parameters??{})}}const zn=["edge","literal","expression"];function Jn(e){return zn.includes(e)}function Xn(e,t,o){if("string"!=typeof o||!o)throw new jn(`Manifest for kind '${e}' has a ${t} with an empty port id`);if(Le(o))throw new jn(`Manifest for kind '${e}' has a ${t} with unsafe port id '${o}'`)}let Yn=class extends B{constructor(){super(),this.entries=new Map,this.resolver=new Vn,this.fallbackContext=new M}withContext(e){return e[e.length-1]instanceof M?e:[this.fallbackContext]}register(e,t={},...o){const{log:n}=this.logCtx(this.withContext(o),"register").for(this.register);n.debug(`Registering graph node kind '${e?.manifest?.kind??"unknown"}'`),(e=>{if(!e||"object"!=typeof e)throw new jn("Graph node registration is required");if(!e.manifest||"object"!=typeof e.manifest)throw new jn("Graph node registration is missing a manifest");if(!e.executor||"function"!=typeof e.executor.execute)throw new jn(`Graph node registration for kind '${e.manifest?.kind+""}' is missing an executor`)})(e);const r=e.manifest;if("string"!=typeof r.kind||!r.kind.trim())throw new jn("Graph node manifest kind is required and must be a non-empty string");const i=r.kind;if(this.entries.has(i)&&!t.replace)throw new jn(`Graph node kind '${i}' is already registered; pass { replace: true } to replace it`);try{yt(r)}catch(e){throw new jn(`Manifest for kind '${i}' is not JSON-serializable: ${e.message}`)}((e,t)=>{const o=[["input",t.inputs],["output",t.outputs],["connection",t.connections??[]]];for(const[t,n]of o){const o=new Set;for(const r of n){if(Xn(e,t+" port",r?.id),o.has(r.id))throw new jn(`Manifest for kind '${e}' declares duplicate static ${t} port id '${r.id}'`);if(o.add(r.id),void 0!==r.defaultMode&&!Jn(r.defaultMode))throw new jn(`Manifest for kind '${e}' declares invalid default binding mode '${r.defaultMode+""}' on ${t} port '${r.id}'`)}}})(i,r);const a=((e,t)=>{const o=new Set;for(const n of t.parameters){const t=n?.id;if("string"!=typeof t||!t)throw new jn(`Manifest for kind '${e}' has a parameter with an empty id`);if(Le(t))throw new jn(`Manifest for kind '${e}' has a parameter with unsafe id '${t}'`);if(o.has(t))throw new jn(`Manifest for kind '${e}' declares duplicate parameter id '${t}'`);o.add(t)}return o})(i,r);((e,t,o)=>{for(const n of t.dynamicPorts??[]){if(!n||"string"!=typeof n.parameter||!n.parameter)throw new jn(`Manifest for kind '${e}' has a dynamic-port rule without a parameter reference`);if(!o.has(n.parameter))throw new jn(`Manifest for kind '${e}' has a dynamic-port rule referencing missing parameter '${n.parameter}'`);if("togglePort"===n.type){if(!n.port)throw new jn(`Manifest for kind '${e}' has a togglePort rule without a port`);Xn(e,"togglePort rule port",n.port.id)}if("repeatFromParameter"===n.type&&"string"!=typeof n.portIdTemplate)throw new jn(`Manifest for kind '${e}' has a repeatFromParameter rule without a portIdTemplate`)}})(i,r,a),((e,t)=>{for(const o of t.credentials??[]){if(!ht(o))throw new jn(`Manifest for kind '${e}' has a malformed credential requirement`);if(!o.type)throw new jn(`Manifest for kind '${e}' has a credential requirement with an empty type`)}})(i,r),((e,t)=>{for(const o of t.methods??[])if(!It(o))throw new jn(`Manifest for kind '${e}' has a malformed method declaration`)})(i,r);const s=new Fn(i,r.methods??[],e.methods??{});return this.entries.set(i,{registration:e,methods:s,placeholderManifest:!1}),this}registerExecutor(e,t,...o){const{log:n}=this.logCtx(this.withContext(o),"registerExecutor").for(this.registerExecutor);if(n.debug(`Registering graph executor for kind '${e}'`),"string"!=typeof e||!e.trim())throw new jn("Graph executor kind is required");if(!t||"function"!=typeof t.execute)throw new jn(`Executor registered for kind '${e}' is missing an execute method`);const r=this.entries.get(e);if(r)return r.registration={...r.registration,executor:t},this;const i={kind:e,display:{name:e},inputs:[],outputs:[],parameters:[],policies:{allowUndeclaredParameters:!0,allowUnknownOutputs:!0}};return this.entries.set(e,{registration:{manifest:i,executor:t},methods:new Fn(e,[],{}),placeholderManifest:!0}),this}unregister(e,...t){const{log:o}=this.logCtx(this.withContext(t),"unregister").for(this.unregister);return o.debug(`Unregistering graph node kind '${e}'`),this.entries.delete(e),this}has(e,...t){return this.logCtx(this.withContext(t),"has").for(this.has),this.entries.has(e)}entry(e){const t=this.entries.get(e);if(!t)throw new Gn(`No graph node kind '${e}' is registered in the catalogue`);return t}getManifest(e,...t){return this.logCtx(this.withContext(t),"getManifest").for(this.getManifest),Fe(this.entry(e).registration.manifest)}getExecutor(e,...t){return this.logCtx(this.withContext(t),"getExecutor").for(this.getExecutor),this.entry(e).registration.executor}getMethodDeclaration(e,t,...o){return this.logCtx(this.withContext(o),"getMethodDeclaration").for(this.getMethodDeclaration),this.entry(e).methods.getDeclaration(t)}getMethod(e,t,...o){return this.logCtx(this.withContext(o),"getMethod").for(this.getMethod),this.entry(e).methods.getDeclaration(t),this.entry(e).methods.get(t)}listMethodDeclarations(e,...t){return this.logCtx(this.withContext(t),"listMethodDeclarations").for(this.listMethodDeclarations),this.entry(e).methods.list()}listManifests(e,...t){this.logCtx(this.withContext(t),"listManifests").for(this.listManifests);const o=[...this.entries.keys()].sort(),n=e?.categories?.length?new Set(e.categories):void 0,r=e?.kinds?.length?new Set(e.kinds):void 0,i=[];for(const e of o){if(r&&!r.has(e))continue;const o=this.getManifest(e,...t);n&&!n.has(o.display.category??"")||i.push(o)}return i}listKinds(...e){return this.logCtx(this.withContext(e),"listKinds").for(this.listKinds),[...this.entries.keys()].sort()}get size(){return this.entries.size}async resolveManifest(e,t,o,...n){this.logCtx(this.withContext(n),"resolveManifest").for(this.resolveManifest);const r=this.entry(e);return this.resolver.resolve(e,r.registration.manifest,r.registration.resolveManifest,t,o)}};Yn=S([F(),D("design:paramtypes",[])],Yn);let Qn=class extends B{constructor(e=new Yn){super(),this.catalogue=e}get catalog(){return this.catalogue}register(e,t,...o){const{log:n}=this.logCtx(o,"register").for(this.register);if(n.debug(`Registering graph executor for kind '${e}'`),!e)throw new io("Graph executor kind is required");return this.catalogue.registerExecutor(e,t,...o),this}unregister(e,...t){const{log:o}=this.logCtx(t,"unregister").for(this.unregister);return o.debug(`Unregistering graph executor for kind '${e}'`),this.catalogue.unregister(e,...t),this}has(e,...t){return this.logCtx(t,"has").for(this.has),this.catalogue.has(e,...t)}resolve(e,...t){this.logCtx(t,"resolve").for(this.resolve);try{return this.catalogue.getExecutor(e,...t)}catch(t){if(t instanceof Gn)throw new io(`No graph executor registered for kind '${e}'`,"GRAPH_EXECUTOR_NOT_FOUND",{kind:e});throw t}}};Qn=S([F(),D("design:paramtypes",[Yn])],Qn);let Zn=class extends B{constructor(e,t){super(),this.registry=e,this.defaultExecutor=t}resolve(e,...t){const{log:o}=this.logCtx(t,"resolve").for(this.resolve);return o.debug(`Resolving graph executor for kind '${e}'`),this.registry.has(e,...t)?this.registry.resolve(e,...t):this.defaultExecutor?this.defaultExecutor:this.registry.resolve(e,...t)}};function er(e){return e}function tr(e){return e.methods??[]}function or(e){if(!e)return;const t={...e.metadata??{},...e.parameters??{},...e.state??{}};return e.loop&&(t.loop=e.loop),t}Zn=S([F(),D("design:paramtypes",[Function,Object])],Zn);class nr extends w{constructor(e){super(),w.fromModel(this,e)}execute(e,t){throw new io(`Graph node kind '${this.constructor.name}' does not implement execute`,"GRAPH_NODE_EXECUTE_NOT_IMPLEMENTED",{kind:this.constructor.name})}static applyMetadata(e){return null}static instantiate(e){return new this(e)}}let rr=class extends nr{execute(e,t){throw new fo(e.inputs.value)}};function ir(e){return e instanceof Error?{name:e.name,message:e.message,stack:e.stack,code:e.graphCode??("number"==typeof e.code?e.code+"":e.code)}:{name:"UnknownError",message:e+""}}S([b(),i("ngx-decaf-crud-field",{label:"graph.node.flow_control.break.fields.value.label",placeholder:"graph.node.flow_control.break.fields.value.placeholder",type:"textarea"}),Re({handle:"value"}),D("design:type",Object)],rr.prototype,"value",void 0),rr=S([De("core.flow.break",{kind:"core.flow.break",category:"Flow Control",color:"#f59e0b",icon:"ti-square-arrow-right",width:96,height:96,labels:["flow","break","loop","control"],metadata:{title:"graph.node.flow_control.break.name",description:"graph.node.flow_control.break.description"}}),E()],rr);let ar=class extends nr{async execute(e,t){const o=t.node.errorBoundary;if(!o?.try)return{result:e.inputs.value??e.inputs};const n=t.engine;if(!n)throw new io("errorBoundary node requires engine access","GRAPH_ENGINE_NOT_AVAILABLE");try{const r=await n.execute(o.try,e.inputs,{parentRunId:t.runId,path:[...t.path,"try"]}),i=Object.values(r.nodeResults).find(e=>e.status===se.FAILED);if(i)throw new io(i.error?.message??"error boundary try body failed",i.error?.code??"GRAPH_ERROR_BOUNDARY",i.error?.details);return{result:r.outputs.result??r.outputs}}catch(r){let i=r;if(o.catch){const a=await n.execute(o.catch,{...e.inputs,error:ir(r)},{parentRunId:t.runId,path:[...t.path,"catch"]});i=a.outputs.error??a.outputs}return{error:i}}finally{o.finally&&await n.execute(o.finally,e.inputs,{parentRunId:t.runId,path:[...t.path,"finally"]})}}};S([b(),i("ngx-decaf-crud-field",{label:"graph.node.flow_control.error_boundary.fields.value.label",placeholder:"graph.node.flow_control.error_boundary.fields.value.placeholder",type:"textarea"}),Re({handle:"value"}),D("design:type",Object)],ar.prototype,"value",void 0),S([$e({handle:"result"}),D("design:type",Object)],ar.prototype,"result",void 0),S([$e({handle:"error"}),D("design:type",Object)],ar.prototype,"error",void 0),ar=S([De("core.flow.errorBoundary",{kind:"core.flow.errorBoundary",category:"Flow Control",color:"#f59e0b",icon:"ti-shield-check",width:96,height:96,labels:["flow","error","try-catch"],metadata:{title:"graph.node.flow_control.error_boundary.name",description:"graph.node.flow_control.error_boundary.description",finally:!1}}),E()],ar);let sr=class extends nr{execute(e){const t=e.inputs.value??e.inputs;return!1===this.approved?{rejected:t}:{approved:t}}};S([b(),Re({handle:"value"}),D("design:type",Object)],sr.prototype,"value",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.human_approval.fields.message.label",placeholder:"graph.node.flow_control.human_approval.fields.message.placeholder",type:"textarea"}),Re({handle:"message",userControlled:!0}),D("design:type",String)],sr.prototype,"message",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.human_approval.fields.approved.label",type:"checkbox"}),Re({handle:"approved",userControlled:!0}),D("design:type",Boolean)],sr.prototype,"approved",void 0),S([$e({handle:"approved"}),D("design:type",Object)],sr.prototype,"approvedOut",void 0),S([$e({handle:"rejected"}),D("design:type",Object)],sr.prototype,"rejectedOut",void 0),sr=S([De("core.flow.humanApproval",{kind:"core.flow.humanApproval",category:"Flow Control",color:"#f59e0b",icon:"ti-user-check",width:96,height:96,labels:["flow","approval","suspend"],metadata:{title:"graph.node.flow_control.human_approval.name",description:"graph.node.flow_control.human_approval.description",approvers:[],timeoutMs:864e5}}),E()],sr);let dr=class extends nr{execute(e,t){const o=e.inputs,n=o.value??o;if(!this.condition)throw new io("If node has no condition configured","GRAPH_IF_NO_CONDITION",{input:o});if(Wo(this.condition))return Ho(this.condition,o,t).then(e=>this.route(e,n));const r=Ko(this.condition,((e,t)=>t===e||"object"!=typeof t||null===t||Array.isArray(t)?e:{...t,...e})(o,n),"if");return this.route(r,n)}route(e,t){if(e)return{then:t};if(!0===this.else)return{else:t};throw new io("If node condition evaluated to false and the else branch is disabled","GRAPH_IF_ELSE_DISABLED",{condition:this.condition})}};S([b(),i("ngx-decaf-crud-field",{label:"graph.node.flow_control.if.fields.value.label",placeholder:"graph.node.flow_control.if.fields.value.placeholder",type:"textarea"}),Re({handle:"value"}),D("design:type",Object)],dr.prototype,"value",void 0),S([b(),$e({handle:"then"}),D("design:type",Object)],dr.prototype,"then",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.if.fields.condition.label",placeholder:"graph.node.flow_control.if.fields.condition.placeholder",type:"code"}),Re({handle:"condition",userControlled:!0,type:"object"}),D("design:type",Object)],dr.prototype,"condition",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.if.fields.else.label",type:"checkbox"}),Re({handle:"else",userControlled:!0}),D("design:type",Boolean)],dr.prototype,"else",void 0),dr=S([De("core.flow.if",{kind:"core.flow.if",category:"Flow Control",color:"#f59e0b",icon:"ti-arrows-split-2",width:96,height:96,labels:["flow","conditional","branch"],metadata:{title:"graph.node.flow_control.if.name",description:"graph.node.flow_control.if.description"}}),E()],dr);let lr=class extends nr{async execute(e,t){const o=((e,t)=>{const o={cases:t.cases??[],defaultPort:t.defaultPort??"default",hasDefault:!0===t.hasDefault},n=e.node.metadata?.switch;return n&&Array.isArray(n.cases)?{cases:n.cases,defaultPort:n.defaultPort??o.defaultPort,hasDefault:!0===n.hasDefault||o.hasDefault}:o})(t,this),n=o.cases,r=e.inputs,i=r.value??r,a=((e,t)=>t===e||"object"!=typeof t||null===t||Array.isArray(t)?e:{...t,...e})(r,i);for(const e of n)if(await Vo(e.condition,{input:r,state:a,label:"switch case"},t))return{[e.outputPort]:i};if(!0!==o.hasDefault)throw new io("No switch case matched and default port is not enabled","GRAPH_SWITCH_NO_MATCH",{cases:n.map(e=>e.id)});const s=o.defaultPort??"default";return{[s]:i}}static applyMetadata(e){const t=xe(this),o=e.defaultPort??"default",n=!0===e.hasDefault,r=t.ports.filter(t=>!e.cases.some(e=>e.outputPort===t.property)),i=r.filter(e=>e.property!==o),a=r.find(e=>e.property===o),s=[...i,...e.cases.map(e=>({property:e.outputPort,name:e.label,direction:Z.OUTPUT,label:e.label,required:!1,hidden:!1,path:e.outputPort}))];return n&&a&&s.push(a),{ports:s,size:te(t,{cases:e.cases.length}),dataPatch:{switchMetadata:e}}}};S([b(),i("ngx-decaf-crud-field",{label:"graph.node.flow_control.switch.fields.value.label",placeholder:"graph.node.flow_control.switch.fields.value.placeholder",type:"textarea"}),Re({handle:"value"}),D("design:type",Object)],lr.prototype,"value",void 0),S([b(),$e({handle:"default"}),D("design:type",Object)],lr.prototype,"default",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.switch.fields.cases.label",type:"collection"}),D("design:type",Object)],lr.prototype,"cases",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.switch.fields.hasDefault.label",type:"checkbox"}),D("design:type",Boolean)],lr.prototype,"hasDefault",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.switch.fields.defaultPort.label",type:"text"}),D("design:type",String)],lr.prototype,"defaultPort",void 0),lr=S([De("core.flow.switch",{kind:"core.flow.switch",category:"Flow Control",color:"#f59e0b",icon:"ti-arrows-shuffle",width:120,height:140,sizeRules:[{type:"parameterCount",parameter:"cases",dimension:"height",perItem:24}],labels:["flow","switch","multi-branch"],metadata:{title:"graph.node.flow_control.switch.name",description:"graph.node.flow_control.switch.description"}}),E()],lr);const cr={maxDocumentBytes:2e6,maxNestingDepth:10,maxNodes:500,maxEdges:1e3},ur=o.accumulate({graph:{workflows:{limits:{...cr},allowAnonymousAccess:!1},execution:{maxCodeTimeoutMs:eo}}}),pr=1e3;function hr(e,t){const o="number"==typeof t?t:Number(t),n=Number.isFinite(o)&&o>0?o:eo,r="number"==typeof e?e:Number(e);return Number.isFinite(r)&&r>0?Math.min(Math.floor(r),n):1e3}const fr=["javascript","typescript"],gr="javascript";let mr=class extends w{constructor(){super(...arguments),this.language=gr}};S([b(),i("ngx-decaf-crud-field",{label:"graph.node.utility.code.fields.language.label",type:"select"}),N([...fr]),v(String),D("design:type",String)],mr.prototype,"language",void 0),S([b(),i("code-editor",{label:"graph.node.utility.code.fields.code.label",placeholder:"graph.node.utility.code.fields.code.placeholder"}),Re({handle:"code"}),D("design:type",String)],mr.prototype,"code",void 0),S([d(),Re({handle:"data"}),D("design:type",Object)],mr.prototype,"data",void 0),mr=S([E()],mr);let yr=class extends nr{async execute(e,t){const o=e.inputs,n=this.input,r=o.code??e.parameters?.code??n?.code??this.defaultCode,i=n?.language??gr;if(!r||"string"!=typeof r||0===r.trim().length)throw new so("Code node has no code to execute (input.code is empty)",{input:o});const a=t.engine?.codeSandboxEvaluator;if(!a)throw new io("Code node execution requires a CodeSandboxEvaluator to be registered in GraphExecutionEngineConfig.codeSandboxEvaluator","GRAPH_CODE_SANDBOX_NOT_CONFIGURED",{code:r});const s=ur.graph.execution?.maxCodeTimeoutMs,d="number"==typeof s&&Number.isFinite(s)&&s>0?s:eo,l=hr(this.timeoutMs,d),c=t.metadata,u={code:r,language:i,input:o,vars:c?.vars??void 0,item:c?.item,index:c?.index,nodes:c?.nodes??void 0,logger:t.logger,timeoutMs:l,abortSignal:t.abortSignal};await t.log("Executing code node",{language:i,length:r.length,timeoutMs:l});const p=await a.evaluate(u);return await t.log("Code node executed",{hasResult:void 0!==p}),{result:p}}};S([b(),Re({handle:"input",model:mr}),D("design:type",mr)],yr.prototype,"input",void 0),S([k(1),O(eo),i("ngx-decaf-crud-field",{label:"graph.node.utility.code.fields.timeoutMs.label",type:"number"}),Re({handle:"timeoutMs"}),D("design:type",Number)],yr.prototype,"timeoutMs",void 0),S([i("code-editor",{label:"graph.node.utility.code.fields.defaultCode.label",placeholder:"graph.node.utility.code.fields.defaultCode.placeholder"}),Re({handle:"defaultCode",userControlled:!0}),D("design:type",String)],yr.prototype,"defaultCode",void 0),S([b(),$e({handle:"result"}),D("design:type",Object)],yr.prototype,"result",void 0),yr=S([De("core.utility.code",{kind:"core.utility.code",category:"Utility",color:"#0d9488",icon:"ti-code",width:96,height:96,labels:["utility","code","sandbox","transform"],metadata:{title:"graph.node.utility.code.name",description:"graph.node.utility.code.description"}}),E()],yr);let wr=class extends nr{execute(e){return{value:e.inputs.value??e.inputs}}};S([b(),Re({handle:"value"}),D("design:type",Object)],wr.prototype,"value",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.utility.delay.fields.timeoutMs.label",type:"number"}),Re({handle:"timeoutMs"}),D("design:type",Number)],wr.prototype,"timeoutMs",void 0),S([b(),$e({handle:"value"}),D("design:type",Object)],wr.prototype,"valueOut",void 0),wr=S([De("core.flow.delay",{kind:"core.flow.delay",category:"Utility",color:"#0d9488",icon:"ti-clock-hour-4",width:96,height:96,labels:["flow","delay","wait"],metadata:{title:"graph.node.utility.delay.name",description:"graph.node.utility.delay.description"}}),E()],wr);let br=class extends nr{execute(e,t){const o=e.inputs.value,n=this.level??"info";return t.logger[n](this.message??"Log node",{value:o}),{value:o}}};S([b(),Re({handle:"value"}),D("design:type",Object)],br.prototype,"value",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.utility.log.fields.message.label",placeholder:"graph.node.utility.log.fields.message.placeholder",type:"textarea"}),Re({handle:"message"}),D("design:type",String)],br.prototype,"message",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.utility.log.fields.level.label",placeholder:"graph.node.utility.log.fields.level.placeholder",type:"text"}),Re({handle:"level",userControlled:!0}),D("design:type",String)],br.prototype,"level",void 0),S([b(),$e({handle:"value"}),D("design:type",Object)],br.prototype,"valueOut",void 0),br=S([De("core.flow.log",{kind:"core.flow.log",category:"Utility",color:"#0d9488",icon:"ti-terminal",width:96,height:96,labels:["flow","log","debug","utility"],metadata:{title:"graph.node.utility.log.name",description:"graph.node.utility.log.description"}}),E()],br);let vr=class extends nr{execute(e){return{result:{mapped:e.inputs.value??e.inputs}}}};S([b(),i("ngx-decaf-crud-field",{label:"graph.node.utility.map.fields.value.label",placeholder:"graph.node.utility.map.fields.value.placeholder",type:"textarea"}),Re({handle:"value"}),D("design:type",Object)],vr.prototype,"value",void 0),S([b(),$e({handle:"result"}),D("design:type",Object)],vr.prototype,"result",void 0),vr=S([De("core.utility.map",{kind:"core.utility.map",category:"Utility",color:"#0d9488",icon:"ti-arrows-right-left",width:96,height:96,labels:["utility","map","transform"],metadata:{title:"graph.node.utility.map.name",description:"graph.node.utility.map.description",mapper:{}}}),E()],vr);let Ir=class extends nr{execute(e,t){const o=e.inputs.value,n=this.level??"info";return t.logger[n](this.message??"Log node",{value:o}),{value:o}}};S([b(),Re({handle:"value"}),D("design:type",Object)],Ir.prototype,"value",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.utility.utility_log.fields.message.label",placeholder:"graph.node.utility.utility_log.fields.message.placeholder",type:"textarea"}),Re({handle:"message"}),D("design:type",String)],Ir.prototype,"message",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.utility.utility_log.fields.level.label",placeholder:"graph.node.utility.utility_log.fields.level.placeholder"}),Re({handle:"level",userControlled:!0,type:"string"}),D("design:type",String)],Ir.prototype,"level",void 0),S([b(),$e({handle:"value"}),D("design:type",Object)],Ir.prototype,"valueOut",void 0),Ir=S([De("core.utility.log",{kind:"core.utility.log",category:"Utility",color:"#0d9488",icon:"ti-terminal",width:96,height:96,labels:["utility","log","debug","observability"],metadata:{title:"graph.node.utility.utility_log.name",description:"graph.node.utility.utility_log.description"}}),E()],Ir);let Er=class extends nr{execute(e){return{message:e.inputs.message??null,sessionId:e.inputs.sessionId??null,userId:e.inputs.userId??null}}};S([b(),$e({handle:"message"}),D("design:type",String)],Er.prototype,"message",void 0),S([b(),$e({handle:"sessionId"}),D("design:type",String)],Er.prototype,"sessionId",void 0),S([b(),$e({handle:"userId"}),D("design:type",String)],Er.prototype,"userId",void 0),Er=S([De("core.trigger.chat",{kind:"core.trigger.chat",category:"Trigger",color:"#3b82f6",icon:"ti-message-circle",width:96,height:96,labels:["trigger","chat","entrypoint"],metadata:{title:"graph.node.trigger.chat.name",description:"graph.node.trigger.chat.description",trigger:{type:"chat"}}}),E()],Er);let Nr=class extends nr{execute(e){return{payload:e.inputs.payload??null}}};S([b(),$e({handle:"payload"}),D("design:type",Object)],Nr.prototype,"payload",void 0),Nr=S([De("core.trigger.event",{kind:"core.trigger.event",category:"Trigger",color:"#3b82f6",icon:"ti-broadcast",width:96,height:96,labels:["trigger","event","bus"],metadata:{title:"graph.node.trigger.event.name",description:"graph.node.trigger.event.description",trigger:{type:"event",topic:"default"}}}),E()],Nr);let kr=class extends nr{execute(e){return{payload:e.inputs.payload??null}}};S([b(),Re({handle:"schema"}),i("ngx-decaf-model-builder",{label:"graph.node.trigger.form.fields.schema.label",placeholder:"graph.node.trigger.form.fields.schema.placeholder"}),D("design:type",Object)],kr.prototype,"schema",void 0),S([b(),$e({handle:"payload"}),D("design:type",Object)],kr.prototype,"payload",void 0),kr=S([De("core.trigger.form",{kind:"core.trigger.form",category:"Trigger",color:"#3b82f6",icon:"ti-forms",width:96,height:96,labels:["trigger","form","public"],metadata:{title:"graph.node.trigger.form.name",description:"graph.node.trigger.form.description",trigger:{type:"form",fields:[]}}}),E()],kr);let Or=class extends nr{execute(e){return{payload:e.inputs.payload??null}}};S([b(),$e({handle:"payload"}),D("design:type",Object)],Or.prototype,"payload",void 0),Or=S([De("core.trigger.manual",{kind:"core.trigger.manual",category:"Trigger",color:"#3b82f6",icon:"ti-hand-click",width:96,height:96,labels:["trigger","manual","entrypoint"],metadata:{title:"graph.node.trigger.manual.name",description:"graph.node.trigger.manual.description",trigger:{type:"manual",inputSchema:{}}}}),E()],Or);let Ar=class extends nr{execute(e){return{payload:e.inputs.payload??null}}};S([b(),Re({handle:"cron"}),i("app-cron-selector-field",{label:"graph.node.trigger.schedule.fields.cron.label",placeholder:"graph.node.trigger.schedule.fields.cron.placeholder"}),D("design:type",String)],Ar.prototype,"cron",void 0),S([b(),$e({handle:"payload"}),D("design:type",Object)],Ar.prototype,"payload",void 0),Ar=S([De("core.trigger.schedule",{kind:"core.trigger.schedule",category:"Trigger",color:"#3b82f6",icon:"ti-calendar-time",width:96,height:96,labels:["trigger","schedule","cron"],metadata:{title:"graph.node.trigger.schedule.name",description:"graph.node.trigger.schedule.description",trigger:{type:"schedule",schedule:"0 * * * *",timezone:"UTC"}}}),E()],Ar);let xr=class extends nr{execute(e){return{payload:e.inputs.payload??null}}};S([b(),Re({handle:"schema"}),i("ngx-decaf-model-builder",{label:"graph.node.trigger.webhook.fields.schema.label",placeholder:"graph.node.trigger.webhook.fields.schema.placeholder"}),D("design:type",Object)],xr.prototype,"schema",void 0),S([b(),$e({handle:"payload"}),D("design:type",Object)],xr.prototype,"payload",void 0),xr=S([De("core.trigger.webhook",{kind:"core.trigger.webhook",category:"Trigger",color:"#3b82f6",icon:"ti-webhook",width:96,height:96,labels:["trigger","webhook","http"],metadata:{title:"graph.node.trigger.webhook.name",description:"graph.node.trigger.webhook.description",trigger:{type:"webhook",path:"/webhook",method:"POST",auth:"none",responseMode:"onReceived"}}}),E()],xr);let _r=class extends nr{execute(e){return{response:"[Agent response] "+(e.inputs.prompt??""),actions:[]}}};S([b(),i("ngx-decaf-crud-field",{label:"graph.node.agent.agent.fields.prompt.label",placeholder:"graph.node.agent.agent.fields.prompt.placeholder",type:"textarea"}),Re({handle:"prompt"}),D("design:type",String)],_r.prototype,"prompt",void 0),S([b(),$e({handle:"response"}),D("design:type",String)],_r.prototype,"response",void 0),S([b(),$e({handle:"actions"}),D("design:type",Array)],_r.prototype,"actions",void 0),S([Ce({category:"model",handle:"model"}),D("design:type",Object)],_r.prototype,"model",void 0),S([Ce({category:"memory",handle:"memory"}),D("design:type",Object)],_r.prototype,"memory",void 0),S([Ce({category:"workspace",handle:"workspace"}),D("design:type",Object)],_r.prototype,"workspace",void 0),_r=S([De("core.agent",{kind:"core.agent",category:"Agent",width:140,height:120,labels:["agent","ai","orchestrator"],metadata:{title:"graph.node.agent.agent.name",description:"graph.node.agent.agent.description",shape:"rectangle"}}),E()],_r);const Sr=[_r];function Dr(e,t,o,n){const r=t??o;if(null==e)return Math.min(o,r);const i=Number(e);if(!Number.isFinite(i)||0>=i)throw new so(n+" loop maxIterations must be a positive finite number");return Math.min(Math.floor(i),r)}function Pr(e,t,o){const n=t.node.loop,r=t.metadata?.loop;if(!n?.body&&!r?.body)throw new so(o+" node is missing loop configuration (instance.loop.body)");const i=t=>{const o=e[t]??n?.[t]??r?.[t],i=Number(o);return void 0!==o&&Number.isFinite(i)?i:void 0},a=t=>{const o=e[t]??r?.[t];return"string"==typeof o?o:void 0};return{body:n?.body??r?.body,maxIterations:i("maxIterations"),timeoutMs:i("timeoutMs"),concurrency:i("concurrency"),condition:e.condition??r?.condition,inputPort:a("inputPort"),outputPort:a("outputPort"),itemPort:a("itemPort"),resultPort:a("resultPort"),statePort:a("statePort"),slice:i("slice")}}let Rr=class extends nr{async execute(e,t){const o=Pr(this,t,"foreach"),n=e.inputs,r=n.items,i=Dr(o.maxIterations,t.limits?.maxForeachIterations,1e3,"foreach");if(!Array.isArray(r))throw new so("foreach input 'items' must be an array");const a=t.engine;if(!a)throw new io("foreach node requires engine access","GRAPH_ENGINE_NOT_AVAILABLE");const s=Number(n.slice??o.slice??1),d=Number.isFinite(s)&&s>0?Math.floor(s):1,l=d>1?Math.ceil(r.length/d):r.length;if(l>i)throw new lo(`foreach exceeded max iterations (${l} > ${i})`);const c=o.itemPort??"item",u=o.resultPort??"result",p=o.statePort??"state",h=o.body,f=[];let g=n.state,m=!1;await t.emit({type:ce.LOOP_STARTED});for(let e=0;l>e;e++){await t.emit({type:ce.LOOP_ITERATION_STARTED,iteration:e});const o=d>1?r.slice(e*d,e*d+d):r[e],n={[c]:o,index:e};d>1&&(n.slice=o),void 0!==g&&(n[p]=g);try{const r=await a.execute(h,n,{parentRunId:t.runId,path:[...t.path,"iteration:"+e],metadata:{item:o,index:e,slice:d},auth:t.auth},t);f.push(r.outputs[u]),void 0!==r.outputs[p]&&(g=r.outputs[p])}catch(o){if(o instanceof fo){const n=o.details?.value;void 0!==n&&f.push(n),m=!0,await t.emit({type:ce.LOOP_ITERATION_COMPLETED,iteration:e,metadata:{broken:!0}});break}throw o}await t.emit({type:ce.LOOP_ITERATION_COMPLETED,iteration:e})}await t.emit({type:ce.LOOP_COMPLETED,metadata:{broken:m}});const y={results:f,completed:f,iterations:f.length,broken:m};return void 0!==g&&(y[p]=g),y}};S([b(),i("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.items.label",placeholder:"graph.node.loop.foreach.fields.items.placeholder",type:"textarea"}),Re({handle:"items"}),D("design:type",Array)],Rr.prototype,"items",void 0),S([b(),i("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.slice.label",placeholder:"graph.node.loop.foreach.fields.slice.placeholder",type:"number"}),Re({handle:"slice"}),D("design:type",Number)],Rr.prototype,"slice",void 0),S([b(),$e({handle:"item"}),D("design:type",Object)],Rr.prototype,"item",void 0),S([b(),Ce({handle:"loop",connectionRules:{allowSelf:!0,maxConnections:1}}),D("design:type",Object)],Rr.prototype,"loop",void 0),S([b(),$e({handle:"completed"}),D("design:type",Array)],Rr.prototype,"completed",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.maxIterations.label",type:"number"}),Re({handle:"maxIterations",userControlled:!0}),D("design:type",Number)],Rr.prototype,"maxIterations",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.condition.label",type:"code"}),Re({handle:"condition",userControlled:!0}),D("design:type",Object)],Rr.prototype,"condition",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.itemPort.label",type:"text"}),Re({handle:"itemPort",userControlled:!0}),D("design:type",String)],Rr.prototype,"itemPort",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.resultPort.label",type:"text"}),Re({handle:"resultPort",userControlled:!0}),D("design:type",String)],Rr.prototype,"resultPort",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.statePort.label",type:"text"}),Re({handle:"statePort",userControlled:!0}),D("design:type",String)],Rr.prototype,"statePort",void 0),Rr=S([De("graph-foreach-loop-node",{kind:"core.loop.foreach",category:"Loop",color:"#eab308",icon:"ti-repeat",width:120,height:140,labels:["loop","iteration","foreach"],metadata:{title:"graph.node.loop.foreach.name",description:"graph.node.loop.foreach.description",loop:{maxIterations:100,itemPort:"item",resultPort:"result",slice:1}}}),E()],Rr);class $r{constructor(){this.expressionEvaluator=new Bo}evaluate(e,t){if(this.isConditionExpression(e))return this.expressionEvaluator.evaluate(e,t);const o=this.resolveValue(e.left,t),n=e.right;switch(e.type){case no.TRUTHY:return!!o;case no.FALSY:return!o;case no.EQUALS:return o===n;case no.NOT_EQUALS:return o!==n;case no.GREATER_THAN:return Number(o)>Number(n);case no.GREATER_THAN_OR_EQUAL:return Number(o)>=Number(n);case no.LESS_THAN:return Number(n)>Number(o);case no.LESS_THAN_OR_EQUAL:return Number(n)>=Number(o);case no.EXISTS:return null!=o;case no.CUSTOM:throw new io("Custom condition evaluators are not supported in v1","GRAPH_CUSTOM_CONDITION_UNSUPPORTED");default:throw new io(`Unknown condition type '${e.type}'`,"GRAPH_UNKNOWN_CONDITION_TYPE",{condition:e})}}async evaluateAsync(e,t,o,n){return Wo(e)?Ho(e,n,o):this.evaluate(e,t)}resolveValue(e,t){if(!e)return t;const o=e.split(".");let n=t;for(const e of o){if(null==n)return;n=n[e]}return n}isConditionExpression(e){return"string"==typeof e.op}}let Cr=class extends nr{async execute(e,t){const o=Pr(this,t,"until"),n=e.inputs,r=Dr(o.maxIterations,t.limits?.maxLoopIterations,100,"until"),i=o.condition;if(!i)throw new so("until node is missing a condition");const a=o.statePort??"state",s=o.inputPort??a,d=o.outputPort??a,l=o.body,c=t.engine;if(!c)throw new io("until node requires engine access","GRAPH_ENGINE_NOT_AVAILABLE");let u=n.state,p=0;await t.emit({type:ce.LOOP_STARTED});let h=!1;do{if(p>=r)throw await t.emit({type:ce.LOOP_LIMIT_REACHED,iteration:p}),new lo(`until loop exceeded max iterations (${r})`);await t.emit({type:ce.LOOP_ITERATION_STARTED,iteration:p}),u=(await c.execute(l,{[s]:u,iteration:p},{parentRunId:t.runId,path:[...t.path,"iteration:"+p],auth:t.auth},t)).outputs[d],await t.emit({type:ce.LOOP_ITERATION_COMPLETED,iteration:p});const e=await(new $r).evaluateAsync(i,u,t,{...n,state:u});await t.emit({type:ce.LOOP_CONDITION_EVALUATED,iteration:p,payload:{result:e}}),p++,h=e}while(!h);return await t.emit({type:ce.LOOP_COMPLETED}),{state:u,iterations:p}}};S([b(),i("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.state.label",placeholder:"graph.node.loop.until.fields.state.placeholder",type:"textarea"}),Re({handle:"state"}),D("design:type",Object)],Cr.prototype,"state",void 0),S([b(),$e({handle:"state"}),D("design:type",Object)],Cr.prototype,"stateOut",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.maxIterations.label",type:"number"}),Re({handle:"maxIterations",userControlled:!0}),D("design:type",Number)],Cr.prototype,"maxIterations",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.condition.label",type:"code"}),Re({handle:"condition",userControlled:!0}),D("design:type",Object)],Cr.prototype,"condition",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.statePort.label",type:"text"}),Re({handle:"statePort",userControlled:!0}),D("design:type",String)],Cr.prototype,"statePort",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.inputPort.label",type:"text"}),Re({handle:"inputPort",userControlled:!0}),D("design:type",String)],Cr.prototype,"inputPort",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.outputPort.label",type:"text"}),Re({handle:"outputPort",userControlled:!0}),D("design:type",String)],Cr.prototype,"outputPort",void 0),Cr=S([De("graph-until-loop-node",{kind:"core.loop.until",category:"Loop",color:"#eab308",icon:"ti-player-stop",width:96,height:96,labels:["loop","conditional","until"],metadata:{title:"graph.node.loop.until.name",description:"graph.node.loop.until.description",loop:{maxIterations:50,statePort:"state",condition:{type:"greaterThanOrEqual",left:"iteration",right:2}}}}),E()],Cr);let Tr=class extends nr{async execute(e,t){const o=Pr(this,t,"while"),n=e.inputs,r=Dr(o.maxIterations,t.limits?.maxLoopIterations,100,"while"),i=o.condition;if(!i)throw new so("while node is missing a condition");const a=o.statePort??"state",s=o.inputPort??a,d=o.outputPort??a,l=o.body,c=t.engine;if(!c)throw new io("while node requires engine access","GRAPH_ENGINE_NOT_AVAILABLE");let u=n.state,p=0;for(await t.emit({type:ce.LOOP_STARTED});await(new $r).evaluateAsync(i,u,t,{...n,state:u});){if(p>=r)throw await t.emit({type:ce.LOOP_LIMIT_REACHED,iteration:p}),new lo(`while loop exceeded max iterations (${r})`);await t.emit({type:ce.LOOP_CONDITION_EVALUATED,iteration:p,payload:{result:!0}}),await t.emit({type:ce.LOOP_ITERATION_STARTED,iteration:p}),u=(await c.execute(l,{[s]:u,iteration:p},{parentRunId:t.runId,path:[...t.path,"iteration:"+p],auth:t.auth},t)).outputs[d],await t.emit({type:ce.LOOP_ITERATION_COMPLETED,iteration:p}),p++}return await t.emit({type:ce.LOOP_COMPLETED}),{state:u,iterations:p}}};S([b(),i("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.state.label",placeholder:"graph.node.loop.while.fields.state.placeholder",type:"textarea"}),Re({handle:"state"}),D("design:type",Object)],Tr.prototype,"state",void 0),S([b(),$e({handle:"state"}),D("design:type",Object)],Tr.prototype,"stateOut",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.maxIterations.label",type:"number"}),Re({handle:"maxIterations",userControlled:!0}),D("design:type",Number)],Tr.prototype,"maxIterations",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.condition.label",type:"code"}),Re({handle:"condition",userControlled:!0}),D("design:type",Object)],Tr.prototype,"condition",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.statePort.label",type:"text"}),Re({handle:"statePort",userControlled:!0}),D("design:type",String)],Tr.prototype,"statePort",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.inputPort.label",type:"text"}),Re({handle:"inputPort",userControlled:!0}),D("design:type",String)],Tr.prototype,"inputPort",void 0),S([i("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.outputPort.label",type:"text"}),Re({handle:"outputPort",userControlled:!0}),D("design:type",String)],Tr.prototype,"outputPort",void 0),Tr=S([De("graph-while-loop-node",{kind:"core.loop.while",category:"Loop",color:"#eab308",icon:"ti-arrows-loop",width:96,height:96,labels:["loop","conditional","while"],metadata:{title:"graph.node.loop.while.name",description:"graph.node.loop.while.description",loop:{maxIterations:50,statePort:"state",condition:{type:"lessThan",left:"iteration",right:3}}}}),E()],Tr);let Lr=class extends nr{execute(e){const t=e.inputs;return{value:t?.value??null}}};S([$e({handle:"value",connectionRules:{allowMultiple:!0}}),D("design:type",Object)],Lr.prototype,"value",void 0),Lr=S([De("graph-input-value-node",{kind:"value",category:"Boundary",color:"#0f766e",icon:"ti-circle-plus",labels:["workflow","input","value"],metadata:{title:"graph.node.boundary.input.name",description:"graph.node.boundary.input.description"}}),E()],Lr);let Mr=class extends nr{execute(e){return{}}};function jr(e,t,o,n={}){return{id:e,label:t,direction:o,...n}}function Gr(e){const t=e,o=ve(t),n=o?.metadata?.title;return jt(t,n?{name:n}:{})}S([b(),Re({handle:"value"}),D("design:type",Object)],Mr.prototype,"value",void 0),Mr=S([De("graph-output-value-node",{kind:"result",category:"Boundary",color:"#0f766e",icon:"ti-circle-minus",width:96,height:96,labels:["workflow","output","value"],metadata:{title:"graph.node.boundary.output.name",description:"graph.node.boundary.output.description"}}),E()],Mr);const Ur={kind:"core.loop.foreach",capabilities:["loop"],display:{name:"graph.node.loop.foreach.name",description:"graph.node.loop.foreach.description",category:"Loop",color:"#eab308",icon:{type:"catalogue",name:"ti-repeat"},width:120,height:140,labels:["loop","iteration","foreach"]},inputs:[jr("items","graph.node.loop.foreach.ports.input.items.label","input",{required:!0,schema:{type:"array",items:{type:"any"}}}),jr("slice","graph.node.loop.foreach.ports.input.slice.label","input",{schema:{type:"number",integer:!0,min:1}}),jr("state","graph.node.loop.foreach.ports.input.state.label","input",{schema:{type:"any"}})],outputs:[jr("results","graph.node.loop.foreach.ports.output.results.label","output",{schema:{type:"array",items:{type:"any"}}}),jr("completed","graph.node.loop.foreach.ports.output.completed.label","output",{schema:{type:"array",items:{type:"any"}}}),jr("iterations","graph.node.loop.foreach.ports.output.iterations.label","output",{schema:{type:"number",integer:!0,min:0}}),jr("broken","graph.node.loop.foreach.ports.output.broken.label","output",{schema:{type:"boolean"}}),jr("state","graph.node.loop.foreach.ports.output.state.label","output",{schema:{type:"any"}})],parameters:[{type:"number",id:"maxIterations",label:"graph.node.loop.foreach.fields.maxIterations.label",integer:!0,min:1},{type:"object",id:"condition",label:"graph.node.loop.foreach.fields.condition.label"},{type:"string",id:"itemPort",label:"graph.node.loop.foreach.fields.itemPort.label"},{type:"string",id:"resultPort",label:"graph.node.loop.foreach.fields.resultPort.label"},{type:"string",id:"statePort",label:"graph.node.loop.foreach.fields.statePort.label"},{type:"number",id:"slice",label:"graph.node.loop.foreach.fields.slice.label",integer:!0,min:1}]},Fr={kind:"core.loop.while",capabilities:["loop"],display:{name:"graph.node.loop.while.name",description:"graph.node.loop.while.description",category:"Loop",color:"#eab308",icon:{type:"catalogue",name:"ti-arrows-loop"},width:120,height:140,labels:["loop","conditional","while"]},inputs:[jr("state","graph.node.loop.while.ports.input.state.label","input",{schema:{type:"any"}})],outputs:[jr("state","graph.node.loop.while.ports.output.state.label","output",{schema:{type:"any"}}),jr("iterations","graph.node.loop.while.ports.output.iterations.label","output",{schema:{type:"number",integer:!0,min:0}})],parameters:[{type:"number",id:"maxIterations",label:"graph.node.loop.while.fields.maxIterations.label",integer:!0,min:1},{type:"object",id:"condition",label:"graph.node.loop.while.fields.condition.label",required:!0},{type:"string",id:"statePort",label:"graph.node.loop.while.fields.statePort.label"},{type:"string",id:"inputPort",label:"graph.node.loop.while.fields.inputPort.label"},{type:"string",id:"outputPort",label:"graph.node.loop.while.fields.outputPort.label"}]},Br={kind:"core.loop.until",capabilities:["loop"],display:{name:"graph.node.loop.until.name",description:"graph.node.loop.until.description",category:"Loop",color:"#eab308",icon:{type:"catalogue",name:"ti-player-stop"},width:120,height:140,labels:["loop","conditional","until"]},inputs:[jr("state","graph.node.loop.until.ports.input.state.label","input",{schema:{type:"any"}})],outputs:[jr("state","graph.node.loop.until.ports.output.state.label","output",{schema:{type:"any"}}),jr("iterations","graph.node.loop.until.ports.output.iterations.label","output",{schema:{type:"number",integer:!0,min:0}})],parameters:[{type:"number",id:"maxIterations",label:"graph.node.loop.until.fields.maxIterations.label",integer:!0,min:1},{type:"object",id:"condition",label:"graph.node.loop.until.fields.condition.label",required:!0},{type:"string",id:"statePort",label:"graph.node.loop.until.fields.statePort.label"},{type:"string",id:"inputPort",label:"graph.node.loop.until.fields.inputPort.label"},{type:"string",id:"outputPort",label:"graph.node.loop.until.fields.outputPort.label"}]},Wr=[Gr(Lr),Gr(Mr),Gr(Or),Gr(xr),Gr(Ar),Gr(Nr),Gr(kr),Gr(Er),(qr=Gr(dr),{...qr,dynamicPorts:[{type:"togglePort",parameter:"else",equals:!0,port:{id:"else",label:"graph.node.flow_control.if.ports.output.else.label",direction:"output",schema:{type:"any"}}}]}),(e=>({...e,outputs:[],parameters:[...e.parameters,{type:"collection",id:"cases",label:"graph.node.flow_control.switch.fields.cases.label",required:!0,itemIdPath:"outputPort",itemLabelPath:"label"},{type:"boolean",id:"hasDefault",label:"graph.node.flow_control.switch.fields.hasDefault.label",defaultValue:!1},{type:"object",id:"switch",label:"graph.node.flow_control.switch.fields.switch.label",required:!1}],dynamicPorts:[{type:"repeatFromParameter",parameter:"cases",itemIdPath:"outputPort",itemLabelPath:"label",direction:"output",portIdTemplate:"${id}",defaultPort:{id:"case",label:"graph.node.flow_control.switch.ports.output.case.label",direction:"output",schema:{type:"any"}}},{type:"togglePort",parameter:"hasDefault",equals:!0,port:{id:"default",label:"graph.node.flow_control.switch.ports.output.default.label",direction:"output",schema:{type:"any"}}}]}))(Gr(lr)),Gr(vr),Gr(wr),Gr(ar),Gr(sr),Gr(yr),Gr(br),Gr(Ir),Gr(rr),Gr(_r),Ur,Fr,Br];var qr;const Hr=Object.fromEntries(Wr.map(e=>[e.kind,e])),Kr=[Or,xr,Ar,Nr,kr,Er],Vr=[dr,lr,wr,ar,sr,br,rr],zr=[yr,vr,Ir],Jr=[Rr,Tr,Cr],Xr=[Lr,Mr],Yr={value:Lr,result:Mr,"core.trigger.manual":Or,"core.trigger.webhook":xr,"core.trigger.schedule":Ar,"core.trigger.event":Nr,"core.trigger.form":kr,"core.trigger.chat":Er,"core.flow.if":dr,"core.flow.switch":lr,"core.utility.map":vr,"core.flow.delay":wr,"core.flow.errorBoundary":ar,"core.flow.humanApproval":sr,"core.utility.code":yr,"core.flow.log":br,"core.utility.log":Ir,"core.flow.break":rr,"core.agent":_r,"core.loop.foreach":Rr,"core.loop.while":Tr,"core.loop.until":Cr};function Qr(e){return{execute:(t,o)=>e.instantiate({...or(o.node),...t.parameters,...o.node.state??{}}).execute(t,o)}}function Zr(){const e=[];for(const[t,o]of Object.entries(Hr)){const n=Yr[t];n&&e.push(er({manifest:o,executor:Qr(n)}))}return e}function ei(e,...t){for(const o of Zr())e.register(o,{},...t);return e}class ti{resolve(e){const t=this.createValidator(e);return{name:e.name,required:e.required,validate:t}}resolveAll(e){const t={};for(const o of e)t[o.name]=this.resolve(o);return t}createValidator(e){switch((e.type??e.designType??"").toLowerCase()){case"string":return e=>"string"==typeof e;case"number":return e=>"number"==typeof e;case"boolean":return e=>"boolean"==typeof e;case"date":return e=>e instanceof Date||"string"==typeof e&&!isNaN(Date.parse(e));case"array":return e=>Array.isArray(e);case"bigint":return e=>"bigint"==typeof e;default:return()=>!0}}}class oi{constructor(e){this.resolver=e}validateWorkflowInputs(e,t){this.validatePorts(e.inputs,t,"workflow input")}validateWorkflowOutputs(e,t){this.validatePorts(e.outputs,t,"workflow output")}validateNodeInputs(e,t){const o=(e.ports??[]).filter(e=>"input"===e.direction);this.validatePorts(o,t,`node '${e.name}' input`)}validateNodeOutputs(e,t){const o=(e.ports??[]).filter(e=>"output"===e.direction);this.validatePorts(o,t,`node '${e.name}' output`)}validatePorts(e,t,o){if(e)for(const n of e){const e=Object.prototype.hasOwnProperty.call(t,n.name);if(n.required&&!e)throw new so(`Missing required ${o} port '${n.name}'`);if(e&&!this.resolver.resolve(n).validate(t[n.name]))throw new so(`Invalid value for ${o} port '${n.name}'`)}}}const ni=["node","definition","executor","execute","ports","component"];function ri(e,t,o,n){return{code:e,path:t,message:o,...void 0!==n?.nodeId?{nodeId:n.nodeId}:{},...void 0!==n?.edgeId?{edgeId:n.edgeId}:{},...n?.details?{details:n.details}:{}}}function ii(e,t){const o=[];for(const n of Object.keys(e))ni.includes(n)&&o.push(ri("document.forbidden-field",`${t}.${n}`,`Field '${n}' is not accepted in a canonical workflow document: node, definition, executor, execute, ports and component fields are rejected at the boundary`,{details:{field:n}}));return o}function ai(e,t){t.push(...ii(e,"$")),e.inputs.forEach((e,o)=>t.push(...ii(e,`inputs[${o}]`))),e.outputs.forEach((e,o)=>t.push(...ii(e,`outputs[${o}]`)));for(const o of e.nodes)t.push(...ii(o,`nodes[${o.id}]`)),o.loop&&(t.push(...ii(o.loop,`nodes[${o.id}].loop`)),ai(o.loop.body,t));for(const o of e.edges)t.push(...ii(o,`edges[${o.id}]`))}function si(e,t){const o=[];e.nodes.length>t.maxNodes&&o.push(ri("document.limit.nodes","$.nodes",`Document declares ${e.nodes.length} nodes; at most ${t.maxNodes} are allowed`,{details:{count:e.nodes.length,limit:t.maxNodes}})),e.edges.length>t.maxEdges&&o.push(ri("document.limit.edges","$.edges",`Document declares ${e.edges.length} edges; at most ${t.maxEdges} are allowed`,{details:{count:e.edges.length,limit:t.maxEdges}}));const n=di(e);n>t.maxNestingDepth&&o.push(ri("document.limit.depth","$.nodes",`Document nests loop bodies ${n} levels deep; at most ${t.maxNestingDepth} levels are allowed`,{details:{depth:n,limit:t.maxNestingDepth}}));const r=Buffer.byteLength(JSON.stringify(e),"utf8");return r>t.maxDocumentBytes&&o.push(ri("document.limit.size","$",`Document serializes to ${r} bytes; at most ${t.maxDocumentBytes} bytes are allowed`,{details:{bytes:r,limit:t.maxDocumentBytes}})),o}function di(e,t=0){let o=t;for(const n of e.nodes)n.loop?.body&&(o=Math.max(o,di(n.loop.body,t+1)));return o}async function li(e,t,...o){const n=[];for(const r of e.nodes)t.has(r.kind,...o)||n.push(ri("node.unknown-kind",`nodes[${r.id}].kind`,`Node '${r.id}' references kind '${r.kind}' which is not registered in the backend catalogue`,{nodeId:r.id,details:{kind:r.kind}})),r.loop?.body&&n.push(...await li(r.loop.body,t,...o));return n}async function ci(e,t={},...o){const n={...cr,...t.limits},r=[];if(!pt(e))return r.push(ri("document.shape","$","Payload is not a canonical GraphWorkflowDocument: id and name must be strings and inputs, outputs, nodes and edges must be arrays")),{valid:!1,issues:r};if(!Ue(e))return r.push(ri("document.json-unsafe","$","Document contains JSON-unsafe values: functions, class instances, undefined, NaN/Infinity, symbol keys and unsafe prototype keys (__proto__/prototype/constructor) are rejected")),{valid:!1,issues:r};ai(e,r),r.push(...(e=>{const t=[],o=new Set;for(const n of[...e.inputs,...e.outputs])o.has(n.id)?t.push(ri("document.duplicate-port-id",`ports[${n.id}]`,`Workflow port '${n.id}' is declared more than once; workflow port ids must be unique`)):o.add(n.id);const n=new Set;for(const o of e.nodes)n.has(o.id)?t.push(ri("document.duplicate-node-id",`nodes[${o.id}]`,`Node '${o.id}' is declared more than once; node ids must be unique`,{nodeId:o.id})):n.add(o.id);const r=new Set;for(const o of e.edges)r.has(o.id)?t.push(ri("document.duplicate-edge-id",`edges[${o.id}]`,`Edge '${o.id}' is declared more than once; edge ids must be unique`,{edgeId:o.id})):r.add(o.id);return t})(e)),r.push(...si(e,n)),vn(e,r);try{ot(e)}catch(e){const t=e instanceof A?e.message:e+"";r.push(ri("document.structure","$",t))}return t.catalogue&&r.push(...await li(e,t.catalogue,...o)),{valid:0===r.length,issues:r}}class ui{constructor(e,t){this.iteration=e,this.metadata=t}}function pi(e,t,o={}){const n=e?.owner??null;return!n||n===t||(null==t||""===t)&&!0===o.allowAnonymousAccess}function hi(e,t){return(e?.owner??null)===(t??null)}function fi(e,t,o){if(!hi(e,t))throw new L(`${o.resourceKind} '${o.resourceId}' is owned by another user`)}function gi(e,t,o){if(!pi(e,t,o))throw new L(`${o.resourceKind} '${o.resourceId}' is owned by another user`)}function mi(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e=>mi(e)).join(",")}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${mi(t[e])}`).join(",")}}`}function yi(e){return Y("sha256").update(mi(e)).digest("hex")}class wi{constructor(e={}){this.events=new Map,this.listeners=new Map,this.limits={...ue,...e}}async append(e){let t=this.events.get(e.runId);t||(t=[],this.events.set(e.runId,t)),t.push(e),this.enforceRetention(t);for(const t of this.listeners.get(e.runId)??[])try{t(e)}catch{}}async listAfter(e,t){const o=this.events.get(e);return o?o.filter(e=>e.sequence>t):[]}subscribe(e,t){let o=this.listeners.get(e);return o||(o=new Set,this.listeners.set(e,o)),o.add(t),()=>{o.delete(t),0===o.size&&this.listeners.delete(e)}}release(e){this.events.delete(e),this.listeners.delete(e)}enforceRetention(e){const t=this.limits.maxEventsPerRun;for(;e.length>t;){const t=e.findIndex(e=>!he(e.type));if(-1===t)break;e.splice(t,1)}}}function bi(e){return new Ft({runId:e.runId,workflowId:e.workflowId,...e.ownerUser?{owner:e.ownerUser}:{},status:e.status,...e.documentFingerprint?{documentFingerprint:e.documentFingerprint}:{},...void 0!==e.result?{result:vi(e.result)}:{},...e.error?{error:vi(e.error)}:{},createdAt:new Date(e.createdAt),...e.startedAt?{startedAt:new Date(e.startedAt)}:{},...e.finishedAt?{finishedAt:new Date(e.finishedAt)}:{}})}function vi(e){if(null!=e)return JSON.parse(JSON.stringify(e))}class Ii{constructor(){this.runs=new Map}async saveRun(e){this.runs.set(e.runId,{...e})}async readRun(e){const t=this.runs.get(e);return t?{...t}:null}async listRuns(e){return[...this.runs.values()].filter(t=>t.workflowId===e).map(e=>bi(e))}release(e){this.runs.delete(e)}}class Ei{constructor(e,t={}){this.sequences=new Map,this.chains=new Map,this.store=e,this.limits={...ue,...t}}async publish(e){const t=e.runId,o=(this.sequences.get(t)??0)+1;this.sequences.set(t,o);const n={...e,payload:this.limitPayload(e.payload),sequence:o,timestamp:(new Date).toISOString()},r=(this.chains.get(t)??Promise.resolve()).then(()=>this.store.append(n));return this.chains.set(t,r.catch(()=>{})),await r,n}lastSequence(e){return this.sequences.get(e)??0}release(e){this.sequences.delete(e),this.chains.delete(e)}limitPayload(e){if(void 0===e)return;let t;try{t=JSON.stringify(e)}catch{return{nonSerializable:!0}}return t.length>this.limits.maxEventPayloadBytes?{truncated:!0,reason:"event payload exceeds the configured byte limit",bytes:t.length}:e}}class Ni{constructor(e,t,o,n={},r={}){this.controllers=new Map,this.completions=new Map,this.timeouts=new Map,this.engine=e,this.runStore=t,this.publisher=o,this.hooks=n,this.limits={...ue,...r}}begin(e){const t=this.controllers.get(e);if(t)return t;const o=new AbortController;return this.controllers.set(e,o),o}abort(e,t){const o=this.controllers.get(e);return!!o&&(o.signal.aborted||o.abort(t),!0)}isAborted(e){return!0===this.controllers.get(e)?.signal.aborted}abortReason(e){const t=this.controllers.get(e)?.signal;if(t?.aborted)return"timeout"===t.reason?"timeout":"user"}waitFor(e){return this.completions.get(e)}schedule(e,t,o,...n){const r=this.completions.get(e.runId);if(r)return r;const i=this.runExecution({...e},t,o,...n).catch(async t=>{const o=ki(t);try{await this.emitTerminal({...e},ce.WORKFLOW_FAILED,o)}catch{}return await this.finalize({...e},"failed",void 0,o,...n)});return this.completions.set(e.runId,i),i}release(e){this.controllers.delete(e),this.completions.delete(e);const t=this.timeouts.get(e);t&&(clearTimeout(t),this.timeouts.delete(e)),this.publisher.release(e)}armTimeout(e){const t=setTimeout(()=>{this.timeouts.delete(e),this.abort(e,"timeout")},this.limits.executionTimeoutMs);this.timeouts.set(e,t)}async runExecution(e,t,o,...n){const r=e.runId;let i,a,s=!1;const d=this.engine.observe({refresh:async t=>{t.runId===r&&(t.error&&(i=t.error),he((await this.publisher.publish(this.envelopeOf(e,t))).type)?s=!0:t.type===ce.WORKFLOW_STARTED&&"validating"===e.status&&(e.status="running",await this.persist(e,...n)))}});this.armTimeout(r);try{if(this.isAborted(r)){const t={name:"GraphRunCancelledError",message:`Graph run '${r}' was cancelled before execution started`,code:"GRAPH_RUN_CANCELLED"};return i=t,await this.emitTerminal(e,ce.WORKFLOW_CANCELLED,t),s=!0,await this.finalize(e,"cancelled",void 0,t,...n)}let d,l;e.status="validating",e.startedAt=(new Date).toISOString(),await this.persist(e,...n);try{({document:d,fingerprint:l}=await t(...n)),e.documentFingerprint=l,await this.persist(e,...n)}catch(t){const o=ki(t);return i=o,s||(await this.emitTerminal(e,ce.WORKFLOW_FAILED,o),s=!0),await this.finalize(e,"failed",void 0,o,...n)}if(this.isAborted(r)){const t={name:"GraphRunCancelledError",message:`Graph run '${r}' was cancelled before execution started`,code:"GRAPH_RUN_CANCELLED"};return i=t,s||(await this.emitTerminal(e,ce.WORKFLOW_CANCELLED,t),s=!0),await this.finalize(e,"cancelled",void 0,t,...n)}try{a=await this.engine.execute(d,o,{runId:r,abortSignal:this.controllers.get(r)?.signal,metadata:{documentFingerprint:l}},...n)}catch(e){i=ki(e)}const c=this.abortReason(r);let u,p;return"timeout"===c?(u="failed",p=i??{name:"GraphRunTimeoutError",message:`Graph run '${r}' exceeded the configured execution timeout of ${this.limits.executionTimeoutMs}ms`,code:"GRAPH_RUN_TIMEOUT"}):"user"===c?(u="cancelled",p=i):a?.status===se.SUCCEEDED?u="succeeded":a?.status===se.CANCELLED?(u="cancelled",p=i):(u="failed",p=i??ki(new io(a?`Graph run '${r}' failed`:`Graph run '${r}' failed without a result`,"GRAPH_RUN_FAILED",{runId:r}))),s||await this.emitTerminal(e,"succeeded"===u?ce.WORKFLOW_COMPLETED:"cancelled"===u?ce.WORKFLOW_CANCELLED:ce.WORKFLOW_FAILED,p),await this.finalize(e,u,a,p,...n)}finally{d();const e=this.timeouts.get(r);e&&(clearTimeout(e),this.timeouts.delete(r))}}async emitTerminal(e,t,o){await this.publisher.publish({runId:e.runId,workflowId:e.workflowId,type:t,error:o})}async finalize(e,t,o,n,...r){e.status=t,o&&(e.result=o),n&&(e.error=n),e.startedAt||(e.startedAt=(new Date).toISOString()),e.finishedAt=(new Date).toISOString(),await this.persist(e,...r);try{await(this.hooks.onRunCompleted?.(e,o))}catch{}return e}async persist(e,...t){await this.runStore.saveRun({...e},...t)}envelopeOf(e,t){return{runId:e.runId,workflowId:t.workflowId??e.workflowId,type:t.type,nodeId:t.nodeId,edgeId:t.edgeId,payload:void 0===t.payload?void 0:Ge(t.payload)?t.payload:{nonSerializable:!0},error:t.error,parentRunId:t.parentRunId,path:t.path}}}function ki(e){return e instanceof Error?{name:e.name,message:e.message,stack:e.stack,code:e.graphCode??("number"==typeof e.code?e.code+"":e.code)}:{name:"UnknownError",message:e+""}}class Oi{constructor(e,t,o,n={}){this.activeByCaller=new Map,this.callerKeysByRun=new Map,this.releaseTimers=new Map,this.engine=e,this.runStore=t,this.eventStore=o,this.publisher=new Ei(o,n.limits),this.executor=new Ni(e,t,this.publisher,{onRunCompleted:n.onRunCompleted},n.limits),this.options={...n,limits:{...ue,...n.limits}}}get limits(){return this.options.limits}async createRun(e,t,o,...n){this.validateCreateRequest(e);const r=e.workflowId??e.workflow?.id??"";if(!r)throw new A("Graph run request must carry a workflow document with an id or a saved workflowId");if(e.workflowId&&!this.options.documentResolver)throw new A("Graph run requests by workflowId require a document resolver");const i=o??t??"anonymous",a=this.activeByCaller.get(i)??new Set;if(a.size>=this.options.limits.maxConcurrentRuns)throw new A(`Graph run rejected: the configured limit of ${this.options.limits.maxConcurrentRuns} concurrent runs per caller is exhausted`);const s=this.generateRunId(),d={runId:s,workflowId:r,ownerUser:t,status:"queued",createdAt:(new Date).toISOString()};this.executor.begin(s),await this.runStore.saveRun({...d},...n);const l=this.documentProviderFor(e,t);return a.add(s),this.activeByCaller.set(i,a),this.callerKeysByRun.set(s,i),this.executor.schedule(d,l,e.inputs??{},...n).catch(()=>{}).finally(()=>this.finishActiveRun(s)),d}async getRun(e,t,...o){const n=await this.runStore.readRun(e,...o);if(!n)throw new _(`No graph run found for runId '${e}'`);return this.assertOwnership(n,t),n}async listRunsByWorkflow(e,t,...o){return(await this.runStore.listRuns(e,...o)).filter(e=>pi({owner:e.owner},t,{allowAnonymousAccess:!0===this.options.allowAnonymousAccess})).sort((e,t)=>{const o=e.updatedAt instanceof Date?e.updatedAt.getTime():NaN,n=t.updatedAt instanceof Date?t.updatedAt.getTime():NaN;return(Number.isFinite(n)?n:0)-(Number.isFinite(o)?o:0)})}async cancelRun(e,t,...o){const n=await this.runStore.readRun(e,...o);if(!n)throw new _(`No graph run found for runId '${e}'`);return this.assertWriteOwnership(n,t),"succeeded"===(r=n.status)||"failed"===r||"cancelled"===r||(this.executor.abort(e,"user"),n.status="cancelled",n.finishedAt=(new Date).toISOString(),await this.runStore.saveRun({...n},...o)),n;var r}async resumeRun(e,t,o,...n){const r=await this.runStore.readRun(e,...n);if(!r)throw new _(`No graph run found for runId '${e}'`);this.assertWriteOwnership(r,o);const i=this.engine.backend,a=i.resume;if("function"!=typeof a)throw new io(`Graph execution backend '${i.constructor?.name??"GraphExecutionBackend"}' does not support resume`,"GRAPH_RESUME_UNSUPPORTED_BACKEND",{runId:e});let s;try{s=await a.call(i,e,t,...n)}catch(e){throw(d=e)instanceof io?new io(d.message,d.graphCode):d}var d;const l={...s,runId:e,caller:o};return await this.publisher.publish({runId:e,workflowId:r.workflowId,type:ce.WORKFLOW_RESUMED,payload:l}),l}async listEvents(e,t,o,...n){return await this.getRun(e,o,...n),this.eventStore.listAfter(e,t)}async subscribeEvents(e,t,o,...n){return await this.getRun(e,t,...n),this.eventStore.subscribe(e,o)}subscribeRunEvents(e,t){return this.eventStore.subscribe(e.runId,t)}async waitForRun(e,t,...o){const n=this.executor.waitFor(e);return n&&await n,this.getRun(e,t,...o)}async executeAndWait(e,t,o,...n){const r=await this.createRun(e,t,o,...n);return this.waitForRun(r.runId,t,...n)}release(e){this.finishActiveRun(e);const t=this.releaseTimers.get(e);t&&(clearTimeout(t),this.releaseTimers.delete(e)),this.executor.release(e),this.eventStore.release?.(e)}finishActiveRun(e){const t=this.callerKeysByRun.get(e);if(void 0!==t){this.callerKeysByRun.delete(e);const o=this.activeByCaller.get(t);o&&(o.delete(e),0===o.size&&this.activeByCaller.delete(t))}if(this.releaseTimers.has(e))return;const o=setTimeout(()=>{this.releaseTimers.delete(e),this.release(e)},this.options.limits.eventReplayWindowMs);o.unref?.(),this.releaseTimers.set(e,o)}validateCreateRequest(e){if(!e||"object"!=typeof e||Array.isArray(e))throw new A("Graph run request must be an object carrying either a workflow document or a workflowId plus inputs");const t=void 0!==e.workflow,o=void 0!==e.workflowId;if(t&&o)throw new A("Graph run request is ambiguous: supply either an unsaved workflow document or a saved workflowId, not both");if(!t&&!o)throw new A("Graph run request must supply either an unsaved workflow document or a saved workflowId");if(t&&!pt(e.workflow))throw new A("Graph run request carries a payload that is not a canonical GraphWorkflowDocument");if(void 0!==e.inputs&&!Ue(e.inputs))throw new A("Graph run inputs must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys and unsafe prototype keys (__proto__/prototype/constructor) are rejected");const n=(e=>{try{return JSON.stringify(e)?.length??0}catch{return Number.MAX_SAFE_INTEGER}})(e);if(n>this.options.limits.maxRequestBytes)throw new A(`Graph run request of ${n} bytes exceeds the configured limit of ${this.options.limits.maxRequestBytes} bytes`)}documentProviderFor(e,t){if(e.workflow){const t=e.workflow;return async()=>({document:t,fingerprint:yi(t)})}const o=e.workflowId;return async(...e)=>{const n=this.options.documentResolver;if(!n)throw new A("Graph run requests by workflowId require a document resolver");const r=await n.resolve(o,t,...e);return{document:r,fingerprint:yi(r)}}}assertOwnership(e,t){gi({owner:e.ownerUser},t,{allowAnonymousAccess:!0===this.options.allowAnonymousAccess,resourceKind:"Graph run",resourceId:e.runId})}assertWriteOwnership(e,t){fi({owner:e.ownerUser},t,{resourceKind:"Graph run",resourceId:e.runId})}generateRunId(){const e=globalThis.crypto;if(!e||"function"!=typeof e.randomUUID)throw new po("Cannot generate a graph run id: crypto.randomUUID is unavailable in this runtime",{runtime:typeof globalThis.crypto});return e.randomUUID()}}function Ai(e){if(!e)return;let t;try{t=e.cache?.user}catch{t=void 0}if(null==t)try{t=e.get("user")}catch{t=void 0}return"string"==typeof t&&t.length>0?t:void 0}function xi(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&pt(e.document)&&!pt(e)}function _i(e){return JSON.parse(JSON.stringify(e))}function Si(e){if(null==e)return 0;let t;try{t=e.getTime()}catch{return 0}return Number.isFinite(t)?t:0}let Di=class extends H{constructor(e){super(Bt),this.catalogue=e}get limits(){return{...cr,...ur.graph.workflows.limits??{}}}get allowAnonymousAccess(){return!0===ur.graph.workflows.allowAnonymousAccess}async saveDocument(e,t,...o){const{ctx:n,ctxArgs:r}=(await this.logCtx(o,"saveDocument",!0)).for(this.saveDocument);if(!pt(t))throw new A("Payload is not a canonical GraphWorkflowDocument: id and name must be strings and inputs, outputs, nodes and edges must be arrays");if(t.id!==e)throw new A(`Document id '${t.id}' does not match the workflow id '${e}' from the request path`);const i=await this.validateDocument(t,n);if(!i.valid)throw new mo(i.issues);const a=Ai(n),s=await this.readExistingForWrite(e,r);s&&this.assertWriteOwnership(e,s,a);const d=new Date;if(s)return s.name=t.name,s.document=_i(t),s.updatedAt=d,this.update(s,...r);const l=new Bt({workflowId:e,name:t.name,document:_i(t),...a?{owner:a}:{},updatedAt:d});return this.create(l,...r)}async seedDocument(e,t,...o){const{log:n,ctxArgs:r}=(await this.logCtx(o,"seedDocument",!0)).for(this.seedDocument);try{return await this.saveDocument(e,t,...r)}catch(t){if(t instanceof L)return n.warn(`Skipping boot seed of graph workflow '${e}': an existing row is owned by another user`),null;throw t}}async getDocument(e,...t){const{ctx:o,ctxArgs:n}=(await this.logCtx(t,"getDocument",!0)).for(this.getDocument);let r;try{r=await this.read(e,...n)}catch{r=null}if(!r)throw new _(`No graph workflow found for workflowId '${e}'`);if(this.assertOwnership(e,r,Ai(o)),r.document)return _i(r.document);throw new _(`Graph workflow '${e}' has no canonical document; legacy definition/state snapshots are no longer supported (DECAF-50 \xa74.26 R2-2)`)}async listWorkflows(...e){const{ctx:t,ctxArgs:o}=(await this.logCtx(e,"listWorkflows",!0)).for(this.listWorkflows),n=await this.listBy("workflowId",K.ASC,...o),r=Ai(t);return n.filter(e=>pi(e,r,{allowAnonymousAccess:this.allowAnonymousAccess})).sort((e,t)=>Si(t.updatedAt)-Si(e.updatedAt))}async assertAccess(e,...t){const{ctx:o,ctxArgs:n}=(await this.logCtx(t,"assertAccess",!0)).for(this.assertAccess);let r;try{r=await this.read(e,...n)}catch{r=null}if(!r)throw new _(`No graph workflow found for workflowId '${e}'`);return this.assertOwnership(e,r,Ai(o)),r}async validateDocument(e,...t){const{ctx:o}=(await this.logCtx(t,"validateDocument",!0)).for(this.validateDocument);return await ci(e,{limits:this.limits,...this.catalogue?{catalogue:this.catalogue}:{}},o)}async saveSnapshot(e,t,...o){const{ctx:n,ctxArgs:r}=(await this.logCtx(o,"saveSnapshot",!0)).for(this.saveSnapshot);if(!Ue(t))throw new A("Workflow snapshot payload must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys and unsafe prototype keys (__proto__/prototype/constructor) are rejected");if(!xi(t))throw new A("Workflow snapshots must wrap a canonical GraphWorkflowDocument ({ document, editor?, metadata? }): legacy definition/state snapshots are no longer accepted; save canonical documents via PUT /graph/workflows/{workflowId}");const i=Ai(n),a=await this.readExistingForWrite(e,r);a&&this.assertWriteOwnership(e,a,i);const s=new Date;if(a)return a.snapshot=t,await this.applyCanonicalWrapper(a,t,n),a.updatedAt=s,this.update(a,...r);const d=new Bt({workflowId:e,snapshot:t,...i?{owner:i}:{},updatedAt:s});return await this.applyCanonicalWrapper(d,t,n),this.create(d,...r)}async loadSnapshot(e,...t){const{ctx:o,ctxArgs:n}=(await this.logCtx(t,"loadSnapshot",!0)).for(this.loadSnapshot);try{const t=await this.read(e,...n);return this.assertOwnership(e,t,Ai(o)),t}catch{return null}}async readExistingForWrite(e,t){try{return await this.read(e,...t)}catch(e){if(e instanceof _)return null;throw e}}assertOwnership(e,t,o){gi(t??null,o??null,{allowAnonymousAccess:this.allowAnonymousAccess,resourceKind:"Graph workflow",resourceId:e})}assertWriteOwnership(e,t,o){fi(t??null,o??null,{resourceKind:"Graph workflow",resourceId:e})}async applyCanonicalWrapper(e,t,o){if(!xi(t))return;if(t.document.id!==e.workflowId)throw new A(`Document id '${t.document.id}' does not match the workflow id '${e.workflowId}' from the request path`);const n=await ci(t.document,{limits:this.limits,...this.catalogue?{catalogue:this.catalogue}:{}},o);if(!n.valid)throw new mo(n.issues);e.document=_i(t.document),e.name=t.document.name}};Di=S([F(Bt),D("design:paramtypes",[Function])],Di);let Pi=class extends H{constructor(){super(Ft)}async saveRun(e,...t){const{ctxArgs:o}=(await this.logCtx(t,"saveRun",!0)).for(this.saveRun),n=bi(e);let r;try{r=await super.read(e.runId,...o)}catch{r=null}if(r)return r.workflowId=n.workflowId,r.owner=n.owner,r.status=n.status,r.documentFingerprint=n.documentFingerprint,r.result=n.result,r.error=n.error,r.startedAt=n.startedAt,r.finishedAt=n.finishedAt,void await this.update(r,...o);await this.create(n,...o)}async readRun(e,...t){const{ctxArgs:o}=(await this.logCtx(t,"readRun",!0)).for(this.readRun);try{return(e=>{const t=e.result;return{runId:e.runId,workflowId:e.workflowId,ownerUser:e.owner??null,status:(o=e.status,"string"==typeof o&&["queued","validating","running","succeeded","failed","cancelled"].includes(o)?e.status:"failed"),createdAt:e.createdAt.toISOString(),...e.startedAt?{startedAt:e.startedAt.toISOString()}:{},...e.finishedAt?{finishedAt:e.finishedAt.toISOString()}:{},...t?{result:t}:{},...e.error?{error:e.error}:{},...e.documentFingerprint?{documentFingerprint:e.documentFingerprint}:{}};var o})(await super.read(e,...o))}catch{return null}}async listRuns(e,...t){const{ctxArgs:o}=(await this.logCtx(t,"listRuns",!0)).for(this.listRuns);return await this.findBy("workflowId",e,...o)}};Pi=S([F(Ft),D("design:paramtypes",[])],Pi);let Ri=class extends H{constructor(){super(Wt)}async upsertManifest(e,...t){const{ctxArgs:o}=(await this.logCtx(t,"upsertManifest",!0)).for(this.upsertManifest),n=(e=>new Wt({kind:e.kind,name:e.display?.name,category:e.display?.category,group:e.display?.group,description:e.display?.description,manifest:bt(wt(e))}))(e);let r;try{r=await this.read(n.kind,...o)}catch{r=void 0}return r?(r.name=n.name,r.category=n.category,r.group=n.group,r.description=n.description,r.manifest=n.manifest,await this.update(r,...o)):await this.create(n,...o)}async syncFromCatalogue(e,...t){const{ctxArgs:o}=(await this.logCtx(t,"syncFromCatalogue",!0)).for(this.syncFromCatalogue),n=e.listManifests(void 0,...o),r=[];for(const e of n)r.push(await this.upsertManifest(e,...o));return r}async listNodes(...e){const{ctxArgs:t}=(await this.logCtx(e,"listNodes",!0)).for(this.listNodes);return await this.listBy("kind",K.ASC,...t)}async listManifests(...e){return(await this.listNodes(...e)).map(e=>(e=>{if(!e.manifest)throw new A(`Graph node row '${e.kind}' has no manifest to convert`);return bt(wt(e.manifest))})(e))}async getNode(e,...t){const{ctxArgs:o}=(await this.logCtx(t,"getNode",!0)).for(this.getNode);try{return await this.read(e,...o)}catch{throw new _(`Graph node kind '${e}' is not registered`)}}};Ri=S([F(Wt),D("design:paramtypes",[])],Ri);class $i{map(e){const t={};for(const[o,n]of Object.entries(e.nodeResults))t[o]={status:n.status,startedAt:n.startedAt?.toISOString(),finishedAt:n.finishedAt?.toISOString(),error:n.error,outputs:n.outputs,fromCache:n.fromCache,pinned:n.pinned};const o={};for(const t of e.events)t.edgeId&&"edge.valueRouted"===t.type&&(o[t.edgeId]={status:se.SUCCEEDED,lastValue:t.payload?.value,updatedAt:t.timestamp.toISOString()});const n=[...e.events];return{runId:e.runId,status:e.status,nodes:t,edges:o,outputs:e.outputs,events:n}}}export{_r as AgentNode,rr as BreakFlowNode,Er as ChatTriggerNode,mr as CodeInputSchema,yr as CodeNode,Bo as ConditionExpressionEvaluator,cr as DEFAULT_GRAPH_WORKFLOW_DOCUMENT_LIMITS,xn as DEFAULT_GRAPH_WORKFLOW_VALIDATION_LIMITS,fn as DEFAULT_PINNING_METADATA,wr as DelayFlowNode,ar as ErrorBoundaryFlowNode,Nr as EventTriggerNode,kr as FormTriggerNode,Sr as GRAPH_AGENT_NODES,Xr as GRAPH_BOUNDARY_NODES,Yr as GRAPH_BUILT_IN_NODE_CLASSES_BY_KIND,Wr as GRAPH_BUILT_IN_NODE_MANIFESTS,Hr as GRAPH_BUILT_IN_NODE_MANIFESTS_BY_KIND,gr as GRAPH_CODE_DEFAULT_LANGUAGE,pr as GRAPH_CODE_DEFAULT_TIMEOUT_MS,fr as GRAPH_CODE_LANGUAGES,eo as GRAPH_CODE_MAX_TIMEOUT_MS,Jt as GRAPH_DEFAULT_CONCURRENCY,Yt as GRAPH_DEFAULT_MAX_FOREACH_ITERATIONS,Xt as GRAPH_DEFAULT_MAX_LOOP_ITERATIONS,_n as GRAPH_DOCUMENT_FORBIDDEN_FIELD_KEYS,Vr as GRAPH_FLOW_CONTROL_NODES,zt as GRAPH_LOCAL_EXECUTION_BACKEND,ro as GRAPH_LOOP_KIND,Jr as GRAPH_LOOP_NODES,Zt as GRAPH_MAX_FOREACH_ITERATIONS,Qt as GRAPH_MAX_LOOP_ITERATIONS,to as GRAPH_PINNING_METADATA_KEY,nn as GRAPH_PLAIN_SECRET_KEYS,Kr as GRAPH_TRIGGER_NODES,zr as GRAPH_UTILITY_NODES,Vt as GRAPH_WORKFLOW_BOUNDARY,ni as GRAPH_WORKFLOW_FORBIDDEN_FIELD_KEYS,$o as GraphAuthValidator,fo as GraphBreakSignal,$r as GraphConditionEvaluator,no as GraphConditionType,En as GraphConnectionPolicyValidator,On as GraphConnectionValidationError,An as GraphCredentialAuthorizationError,Nn as GraphCredentialReferenceValidator,ao as GraphCycleError,kn as GraphDocumentValidationError,In as GraphEdgeInstanceValidator,Go as GraphEngineEventSink,ur as GraphEnvironment,Fo as GraphExecutionBackendRegistry,Lo as GraphExecutionContext,Tn as GraphExecutionEngine,io as GraphExecutionError,yo as GraphExecutionEventEmitter,wo as GraphExecutionEventFactory,Mo as GraphExecutionFrame,Rn as GraphExecutionPlanner,$i as GraphExecutionSnapshotMapper,Rr as GraphForeachLoopNode,so as GraphInputError,Lr as GraphInputValueNode,ui as GraphLoopExecutionContext,lo as GraphLoopLimitError,nr as GraphNode,Yn as GraphNodeCatalogue,Qn as GraphNodeExecutorRegistry,Zn as GraphNodeExecutorResolver,bn as GraphNodeInstanceValidator,Vn as GraphNodeManifestResolver,Un as GraphNodeMethodNotFoundError,Fn as GraphNodeMethodRegistry,Ri as GraphNodeModelService,Gn as GraphNodeNotFoundError,jn as GraphNodeRegistrationError,Mr as GraphOutputValueNode,rn as GraphParameterValidator,yn as GraphPinningDependencyResolver,co as GraphPinningError,mn as GraphPinningPolicy,hn as GraphPinningService,oo as GraphPinningStrategy,uo as GraphPortError,ti as GraphPortSchemaResolver,go as GraphRunCancelledError,Ei as GraphRunEventPublisher,Ni as GraphRunExecutor,Pi as GraphRunModelService,Oi as GraphRunService,po as GraphStoreError,pn as GraphTopology,ho as GraphTopologyError,Cr as GraphUntilLoopNode,an as GraphValueModel,cn as GraphValueRepository,oi as GraphValueValidator,Tr as GraphWhileLoopNode,mo as GraphWorkflowDocumentRejectedError,Pn as GraphWorkflowDocumentValidator,Di as GraphWorkflowService,sr as HumanApprovalFlowNode,dr as IfFlowNode,wi as InMemoryGraphRunEventStore,Ii as InMemoryGraphRunStore,Mn as IsolatedVmCodeSandboxEvaluator,wn as LocalGraphExecutionBackend,br as LogFlowNode,Or as ManualTriggerNode,vr as MapNode,Ar as ScheduleTriggerNode,lr as SwitchFlowNode,Ir as UtilityLogNode,xr as WebhookTriggerNode,gi as assertGraphResourceOwnership,fi as assertGraphResourceWriteOwnership,jo as buildGraphExecutionResult,Zr as builtInGraphNodeRegistrations,pi as canAccessGraphResource,hi as canAccessGraphResourcePayload,Zo as checkGraphValueAgainstSchema,hr as clampGraphCodeTimeoutMs,vn as collectLooseNodeIssues,vo as composeGraphNamespace,un as createGraphValueRepository,tr as declaredGraphNodeMethods,bo as decomposeGraphNamespace,Po as decomposeGraphNamespaces,er as defineGraphNode,Yo as detectGraphCodeModeSurfaces,Ho as evaluateCodeCondition,Vo as evaluateCondition,Ko as evaluateConditionSync,Oo as findMalformedGraphNamespaces,ko as findUngrantedGraphNamespaces,So as graphAuthDataFromRecord,Do as graphAuthDataOf,Qo as graphDocumentHasCodeMode,No as graphNamespaceCovers,Eo as graphNamespacePartsOf,or as graphNodeConfig,Ao as graphRolesFromNamespaces,yi as graphRunDocumentFingerprint,Ai as graphWorkflowOwnerOf,Wo as isCodeCondition,qo as isConditionExpression,tn as isGraphCredentialReferenceLike,Io as isGraphNamespaceCacheEntryValid,Sn as isGraphResolvedWorkflow,gn as isPinnable,Ro as mergeGraphAuthData,ei as registerBuiltInGraphNodes,Uo as resolveGraphBackendCapabilities,Hn as resolveGraphDynamicPorts,Kn as resolveGraphNodeManifest,sn as serializeGraphValueKey,Cn as stripFacadeOwnedBackendConfig,ci as validateGraphWorkflowDocumentAtBoundary};
|
|
1
|
+
import{logParameterRegistry as e,Logging as t,LoggedEnvironment as o}from"@decaf-ts/logging";import{RenderingEngine as r,uimodel as n,uielement as i,uilistprop as a,uilistmodel as s,hidden as d}from"@decaf-ts/ui-decorators";import{Metadata as l,Decoration as c,apply as p,metadata as u,propMetadata as g,description as h,prop as f,DefaultFlavour as y}from"@decaf-ts/decoration";import{ValidationKeys as m,Model as b,required as w,type as v,date as x,model as I,option as _,min as E,max as A}from"@decaf-ts/decorator-validation";import{ValidationError as S,InternalError as R,NotFoundError as O}from"@decaf-ts/db-decorators";import{__decorate as k,__metadata as C}from"tslib";import{pk as N,column as T,index as P,table as D,BaseModel as j,noValidateOnUpdate as L,ForbiddenError as M,Context as G,repository as U,Repository as $,AuthorizationError as F,service as H,Service as B,Condition as q,OrderDirection as W,ClientBasedService as K,Adapter as V,ModelService as z}from"@decaf-ts/core";import Q from"isolated-vm";import*as J from"acorn";import*as X from"acorn-walk";import*as Y from"typescript";import{randomUUID as Z,createHash as ee}from"node:crypto";import{dirname as te,resolve as oe,relative as re,sep as ne,isAbsolute as ie,extname as ae,basename as se}from"node:path";import{homedir as de}from"node:os";import{realpathSync as le}from"node:fs";import{realpath as ce,readFile as pe,mkdir as ue,appendFile as ge,writeFile as he,glob as fe}from"node:fs/promises";import{TypeORMAdapter as ye}from"@decaf-ts/for-typeorm";import{RedisAdapter as me}from"@decaf-ts/integrations/redis";import{connect as be}from"amqplib";import{collectToBuffer as we}from"@decaf-ts/integrations/blob";import{S3BlobStoreService as ve}from"@decaf-ts/integrations/blob/s3";import{bootWithoutEnvironment as xe}from"@decaf-ts/integrations/shared/http";import{GcsBlobStoreService as Ie}from"@decaf-ts/integrations/blob/gcp";import{AzureBlobStoreService as _e}from"@decaf-ts/integrations/blob/azure";import{SlackService as Ee}from"@decaf-ts/integrations/comms/slack";import{TelegramService as Ae}from"@decaf-ts/integrations/comms/telegram";import{TeamsService as Se}from"@decaf-ts/integrations/comms/teams";import{GmailService as Re}from"@decaf-ts/integrations/comms/gmail";import{EmailService as Oe}from"@decaf-ts/integrations/comms/email";import{DiscordService as ke}from"@decaf-ts/integrations/comms/discord";import{WhatsAppService as Ce}from"@decaf-ts/integrations/comms/whatsapp";import{MicrosoftOutlookService as Ne}from"@decaf-ts/integrations/comms/outlook";import{GoogleSheetsService as Te}from"@decaf-ts/integrations/io/google-sheets";import{AirtableService as Pe}from"@decaf-ts/integrations/io/airtable";import{SpreadsheetService as De}from"@decaf-ts/integrations/io/spreadsheet";import{GraphqlService as je}from"@decaf-ts/integrations/io/graphql";import{MicrosoftExcelService as Le}from"@decaf-ts/integrations/io/microsoft-excel";import{ConfluenceService as Me}from"@decaf-ts/integrations/io/confluence";import{JiraService as Ge}from"@decaf-ts/integrations/io/jira";import{GoogleDocsService as Ue}from"@decaf-ts/integrations/io/google-docs";import{MicrosoftSharePointService as $e}from"@decaf-ts/integrations/io/microsoft-sharepoint";import{GoogleCalendarService as Fe}from"@decaf-ts/integrations/calendar/google-calendar";import*as He from"cheerio";import{convert as Be}from"html-to-text";import{marked as qe}from"marked";import We from"turndown";import{Parser as Ke,Builder as Ve}from"xml2js";import{GithubService as ze}from"@decaf-ts/integrations/devops/github";import{GitlabService as Qe}from"@decaf-ts/integrations/devops/gitlab";import{CryptoService as Je}from"@decaf-ts/crypto/integration/services/crypto";import{sign as Xe,verify as Ye,decodeJwtPayload as Ze}from"@decaf-ts/crypto/jwt";import{exec as et}from"node:child_process";import{Ssh2SftpService as tt}from"@decaf-ts/integrations/sftp";import{EventSource as ot}from"eventsource";import{Client as rt}from"pg";import"@mastra/core/storage";import"@mastra/memory";import"@mastra/libsql";import"@mastra/pg";var nt,it;m.REQUIRED,m.MIN,m.MIN_LENGTH,m.MAX,m.MAX_LENGTH,m.PATTERN,m.URL,m.STEP,m.DATE,m.EMAIL,m.PASSWORD,m.EQUALS,m.DIFF,m.LESS_THAN,m.LESS_THAN_OR_EQUAL,m.GREATER_THAN,m.GREATER_THAN_OR_EQUAL,(e=>{e.GRAPH="graph",e.NODE="graph.node",e.EDGE="graph.edge",e.PORT="graph.port",e.STATE="graph.state"})(nt||(nt={})),(e=>{e.INPUT="input",e.OUTPUT="output",e.CONNECTION="connection"})(it||(it={}));const at={};function st(e,t={}){let o=e.width??96,r=e.height??96;for(const n of e.sizeRules??[]){if("parameterCount"!==n.type)continue;const e=t[n.parameter]??0;e>0&&("width"===n.dimension?o+=e*n.perItem:r+=e*n.perItem)}return{width:o,height:r}}function dt(e,t){at[e]=t}function lt(e,t,o){const r=t?at[t]:void 0;return r?.color?r.color:e||"#64748b"}function ct(e,t,o){const r=t?at[t]:void 0;return r?.icon?r.icon:e||"ti-pointer"}const pt=["skip","passThroughFirstInput","emitDefaults"];function ut(e){return pt.includes(e)}var gt,ht,ft,yt;(e=>{e.PENDING="pending",e.PLANNING="planning",e.RUNNING="running",e.SUCCEEDED="succeeded",e.FAILED="failed",e.SKIPPED="skipped",e.CANCELLED="cancelled",e.CACHED="cached"})(gt||(gt={})),(e=>{e.IDLE="idle",e.RUNNING="running",e.BLOCKED="blocked",e.SUCCEEDED="succeeded",e.FAILED="failed",e.SKIPPED="skipped"})(ht||(ht={})),(e=>{e.NODE_ID="nodeId",e.WORKFLOW_ID="workflowId",e.RUN_ID="runId",e.USER="user",e.ROLES="roles",e.NAMESPACES="namespaces",e.ORGANIZATION="organization",e.IP="ip"})(ft||(ft={})),(e=>{e.WORKFLOW_STARTED="workflow.started",e.WORKFLOW_PLANNED="workflow.planned",e.WORKFLOW_COMPLETED="workflow.completed",e.WORKFLOW_FAILED="workflow.failed",e.WORKFLOW_CANCELLED="workflow.cancelled",e.WORKFLOW_SUSPENDED="workflow.suspended",e.WORKFLOW_RESUMED="workflow.resumed",e.NODE_QUEUED="node.queued",e.NODE_STARTED="node.started",e.NODE_OUTPUT="node.output",e.NODE_COMPLETED="node.completed",e.NODE_FAILED="node.failed",e.NODE_SKIPPED="node.skipped",e.NODE_CACHE_HIT="node.cacheHit",e.NODE_PINNED="node.pinned",e.NODE_UNPINNED="node.unpinned",e.NODE_STATE_CHANGED="node.stateChanged",e.EDGE_VALUE_ROUTED="edge.valueRouted",e.EDGE_STATE_CHANGED="edge.stateChanged",e.GRAPH_RUN_LOG="graph.run.log",e.LOOP_STARTED="loop.started",e.LOOP_ITERATION_STARTED="loop.iteration.started",e.LOOP_ITERATION_COMPLETED="loop.iteration.completed",e.LOOP_CONDITION_EVALUATED="loop.condition.evaluated",e.LOOP_COMPLETED="loop.completed",e.LOOP_LIMIT_REACHED="loop.limitReached",e.VALIDATION_STARTED="validation.started",e.VALIDATION_FAILED="validation.failed",e.VALIDATION_COMPLETED="validation.completed",e.STORE_READ="store.read",e.STORE_WRITE="store.write",e.STORE_DELETE="store.delete"})(yt||(yt={}));const mt={maxRequestBytes:4e6,maxConcurrentRuns:32,maxEventsPerRun:1e4,maxEventPayloadBytes:256e3,executionTimeoutMs:6e5,eventReplayWindowMs:3e5},bt=[yt.WORKFLOW_COMPLETED,yt.WORKFLOW_FAILED,yt.WORKFLOW_CANCELLED];function wt(e){return bt.includes(e)}function vt(e){if(!Array.isArray(e))return;const t=e.filter(e=>"string"==typeof e&&e.length>0);return t.length?t:void 0}function xt(e){if(!e||"object"!=typeof e)return;const t=e.auth;return t&&"object"==typeof t&&!Array.isArray(t)?(e=>{if(!e)return;const t=vt(e.namespaces),o=vt(e.roles);if(!t&&!o)return;const r={};return t&&(r.namespaces=t),o&&(r.roles=o),r})(t):void 0}function It(e){const t=l.constr(e);if("function"==typeof t)return t;const o=e.constructor;return"function"==typeof o?o:e}function _t(e){if(null!=e)return"string"==typeof e?e:e+""}function Et(e,t,o){return _t(e?.props?.label??e?.props?.name)??_t(t?.name)??o??""}function At(e,t,o){const r=Ot(e,t);if(r?.model&&"function"==typeof r.model&&b.isModel(r.model))return r.model;const n=l.type(e,t);if("function"==typeof n&&b.isModel(n))return n;const i=l.getPropDesignTypes?.(e,t)?.designTypes||[];for(const e of i)if("function"==typeof e&&b.isModel(e))return e;const a=o?.[m.TYPE]?.customTypes||[];for(const e of a)if("function"==typeof e&&b.isModel(e))return e}function St(e,t){const o=[t,e.path??e.property].filter(Boolean).join(".");return{...e,path:o,children:e.children?.map(e=>St(e,o))}}function Rt(e){const t=It(e);return l.get(t,nt.NODE)}function Ot(e,t){const o=It(e);return l.get(o,l.key(nt.PORT,t+""))}function kt(e,t,o,r=new Set){const n=Ot(e,t);if(!n?.schema)return;const i=At(e,t,l.validationFor(e,t));if(!i)return;if(r.has(i))return[];const a=new Set(r);return a.add(e),a.add(i),Tt(i,a).filter(e=>e.direction===o)}function Ct(e,t,o=new Set){const r=Ot(e,t);if(!r)return;const n=l.validationFor(e,t),i=At(e,t,n);if(r.schema&&i)return;const a=b.uiElementOf(e,t)||void 0,s=b.uiDecorationOf(e,t,"uiprop"),d=l.type(e,t),c=_t(r.type??n?.[m.TYPE]?.customTypes?.[0]?.name??a?.props?.type??s?.type??d?.name),p=(r.expand||i&&!o.has(i))&&i?(()=>{const r=new Set(o);return r.add(e),r.add(i),Tt(i,r).map(e=>St(e,t))})():void 0;return{property:t,path:t,direction:r.direction,name:t,label:Et(a,s,t),type:c?.toLowerCase(),required:!!n?.[m.REQUIRED],hidden:!!b.uiIsHidden(e,t),designType:d?.name,element:a,prop:s,validation:n,graph:r,connectionRules:r.connectionRules,composite:!!p?.length,children:p,model:i?.name}}function Nt(e){return Tt(It(e))}function Tt(e,t=new Set){const o=l.properties(e)||[],r=[];for(const n of o){const o=n+"",i=Ot(e,o);if(i?.schema){const n=kt(e,o,i.direction,t);if(n){r.push(...n);continue}}const a=Ct(e,o,t);a&&r.push(a)}return r}function Pt(e){return e.flatMap(e=>e.children&&e.children.length?Pt(e.children):[e])}function Dt(e){const t=It(e),o=b.uiModelOf(t),r=Rt(t)||{},n=o?.tag||t.name,i=Nt(t),a=((e,t)=>{const o=t.portGroups||[],r=new Map(o.map(e=>[e.property,e])),n=[],i=l.properties(e)||[];for(const t of i){const o=t+"",i=Ot(e,o);if(!i?.schema)continue;if(!At(e,o,l.validationFor(e,o)))continue;const a=r.get(o);n.push(a?{...a,toggle:a.toggle??"all"}:{property:o,toggle:"all"})}for(const e of o)n.some(t=>t.property===e.property)||n.push(e);return n.length?n:void 0})(t,r),s=r.namespaces?.length?r.namespaces:(e=>{if(null==e)return[];let t,o=e;try{o=l.constr(e)}catch{o=e}try{t=l.get(o,"auth-namespace")}catch{t=void 0}return vt(t)??[]})(t),d=s.length?s:void 0;return{name:t.name,tag:n,kind:r.kind||n,category:r.category,color:r.color,effectiveColor:lt(r.color,r.category),group:r.group,height:r.height,icon:r.icon,effectiveIcon:ct(r.icon,r.category),labels:r.labels||[],maxChildren:r.maxChildren,minWidth:r.minWidth,width:r.width,shape:r.shape,cornerRadius:r.cornerRadius,sizeRules:r.sizeRules,props:o?.props,ui:o,graph:r,ports:i,portGroups:a,namespaces:d}}const jt=new Set,Lt=new Set;function Mt(e,t,o){return c.for(nt.NODE).define({decorator:(e,t,o)=>{const r={kind:t?.kind||e,...t};return t=>{const i=p(n(e,o),u(nt.NODE,r))(t);var a;return a=t,jt.add(a),i}},args:[e,t,o]}).apply()}function Gt(e,t){return c.for(nt.PORT).define({decorator:(e,t)=>(o,r)=>{const n={direction:e,...t};return p(g(l.key(nt.PORT,r),n))(o,r)},args:[e,t]}).apply()}function Ut(e){return Gt(it.INPUT,{...e,schema:!0})}function $t(e){return Gt(it.OUTPUT,{...e,schema:!0})}function Ft(e){return Gt(it.CONNECTION,e)}r.prototype.renderAsNode=(e,t,...o)=>Dt(e),l.nodes=(()=>[...jt]).bind(l),l.workflows=(()=>[...Lt]).bind(l);const Ht=["__proto__","prototype","constructor"];function Bt(e){return Ht.includes(e)}function qt(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||null===t}function Wt(e){return null===e||"string"==typeof e||"number"==typeof e&&Number.isFinite(e)||"boolean"==typeof e}function Kt(e){return!!Wt(e)||(Array.isArray(e)?e.every(e=>Kt(e)):!!qt(e)&&Reflect.ownKeys(e).every(t=>"string"==typeof t&&!Bt(t)&&Kt(e[t])))}function Vt(e){if(void 0===e)return!1;if("number"==typeof e)return Number.isFinite(e);if("function"==typeof e)return!1;if(Kt(e))return!0;if(Array.isArray(e))return e.every(e=>Vt(e));if(qt(e)){const t=Reflect.ownKeys(e);for(const o of t){if("string"!=typeof o)return!1;if(Bt(o))return!1;if(!Vt(e[o]))return!1}return!0}return!1}function zt(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(e=>zt(e));const t={};for(const[o,r]of Object.entries(e))t[o]=zt(r);return t}const Qt={string:"string",char:"string",text:"string",textarea:"string",radio:"string",select:"string",number:"number",integer:"number",float:"number",double:"number",decimal:"number",boolean:"boolean",bool:"boolean",checkbox:"boolean",array:"array",list:"array",set:"array",object:"object",model:"model",any:"any",unknown:"any",enum:"enum"},Jt={date:"date",datetime:"date-time","date-time":"date-time",duration:"duration"},Xt={string:"string",number:"number",boolean:"boolean",array:"array",object:"object",date:"date"};function Yt(e){return e?Qt[e.toLowerCase()]??"any":"any"}function Zt(e){if(e)return Jt[e.toLowerCase()]}function eo(e,t){const o=e[t];if(o&&"object"==typeof o)return o.value}function to(e,t){const o=eo(e,t);return"number"==typeof o&&Number.isFinite(o)?o:void 0}function oo(e,t,o){const r=e??{},n=(e=>{const t=eo(e,m.ENUM);if(Array.isArray(t)&&t.every(Wt))return t})(r);if(n)return{type:"enum",values:n};const i=(e=>{const t=e[m.TYPE],o=t?.customTypes?.[0],r="function"==typeof o?o.name:o?.name;if(r)return r})(r);if(i){const e=Xt[i.toLowerCase()];if(!e)return{type:"model",name:i};const t=Zt(e);return void 0!==t?{type:"string",format:t}:ro(e,r)}return o?{type:"model",name:o}:ro(t,r)}function ro(e,t){switch(Yt(e)){case"string":{const t=Zt(e);return void 0!==t?{type:"string",format:t}:{type:"string"}}case"number":{const o={type:"number"};e&&"integer"===e.toLowerCase()&&(o.integer=!0);const r=to(t,m.MIN),n=to(t,m.MAX);return void 0!==r&&(o.min=r),void 0!==n&&(o.max=n),o}case"boolean":return{type:"boolean"};case"array":return((e,t)=>{const o={type:"array",items:no(e,t)},r=to(e,m.MIN),n=to(e,m.MAX);return void 0!==r&&(o.minItems=r),void 0!==n&&(o.maxItems=n),o})(t,e);case"object":return{type:"object",properties:{}};case"enum":return{type:"enum",values:[]};case"model":return{type:"model",name:e??"any"};default:return{type:"any"}}}function no(e,t){if((e=>{const t=e[m.LIST];return!!t?.clazz?.length})(e))return{type:"model",name:io(e)};const o=eo(e,m.TYPE);if("string"==typeof o){const e=Yt(o);return"model"===e?{type:"model",name:o}:{type:e}}if(t&&"array"!==t){const e=Yt(t);return"model"===e?{type:"model",name:t}:{type:e}}return{type:"any"}}function io(e){const t=e[m.LIST],o=t?.clazz?.[0];if("function"!=typeof o)return"any";if(o.name)return o.name;try{const e=o();if("function"==typeof e&&e.name)return e.name}catch{return"any"}return"any"}function ao(e){return"workflow"===e.scope}function so(e){return"node"===e.scope}function lo(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"workflow"===t.scope?"string"==typeof t.port&&2===Reflect.ownKeys(t).length:"node"===t.scope&&"string"==typeof t.nodeId&&"string"==typeof t.port&&3===Reflect.ownKeys(t).length}function co(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e.mode;if("edge"===t)return 1===Reflect.ownKeys(e).length;if("literal"===t){const t=e.value;return 2===Object.keys(e).length&&Kt(t)}return"expression"===t&&2===Object.keys(e).length&&"string"==typeof e.expression}const po=["any","string","number","boolean","array","object","enum","model"];function uo(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&(e=>po.includes(e))(e.type)}function go(e,t={seen:[]}){if(t.seen.includes(e))throw new S(`Document '${(e=>{const t=e?.id;return"string"==typeof t?t:"<unnamed document>"})(e)}' contains a loop body that references itself (cyclic document)`);if("string"!=typeof e.id||!e.id)throw new S("Document 'id' is required and must be a non-empty string");if("string"!=typeof e.name||!e.name)throw new S("Document 'name' is required and must be a non-empty string");const o=new Set;for(const t of[...e.inputs,...e.outputs]){if("string"!=typeof t.id||!t.id)throw new S("Workflow port 'id' is required and must be a non-empty string");if(o.has(t.id))throw new S(`Workflow port '${t.id}' is declared more than once; workflow port ids must be unique`);if(void 0!==t.schema&&!uo(t.schema))throw new S(`Workflow port '${t.id}' schema must be a valid GraphValueSchema`);o.add(t.id)}const r={seen:[...t.seen,e]},n=new Set;for(const t of e.nodes)ho(t,n);for(const t of e.nodes)t.loop&&fo(t,t.loop,r),t.errorBoundary&&yo(t,t.errorBoundary,r);const i=new Set;for(const t of e.edges)bo(t,i);for(const t of e.edges)wo(t.source,0,o,n,`Edge '${t.id}' source`),wo(t.target,0,o,n,`Edge '${t.id}' target`);if(void 0!==e.settings&&!Vt(e.settings))throw new S("Document settings must be JSON-safe (a map of JSON-safe values)");if(void 0!==e.metadata&&!Vt(e.metadata))throw new S("Document metadata must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys, or unsafe prototype keys are not allowed");if(void 0!==e.ui&&!Vt(e.ui))throw new S("Document ui must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys, or unsafe prototype keys are not allowed")}function ho(e,t){if("string"!=typeof e.id||!e.id)throw new S("Node 'id' is required and must be a non-empty string");if(t.has(e.id))throw new S(`Node id '${e.id}' is declared more than once; node ids must be unique`);if("string"!=typeof e.kind||!e.kind)throw new S(`Node '${e.id}' must declare a non-empty string 'kind'`);if(void 0===e.parameters||null===e.parameters)throw new S(`Node '${e.id}' parameters must be present (an empty object when there are none)`);if(t.add(e.id),e.inputBindings)for(const[t,o]of Object.entries(e.inputBindings)){if(Bt(t))throw new S(`Node '${e.id}' input binding key '${t}' is not allowed (unsafe prototype-pollutant key)`);if(!co(o))throw new S(`Node '${e.id}' input binding for '${t}' must be a valid GraphInputBinding (edge, literal, or expression)`);if("literal"===o.mode&&!Vt(o.value))throw new S(`Node '${e.id}' literal binding for '${t}' must contain JSON-safe values`);if("expression"===o.mode&&!o.expression)throw new S(`Node '${e.id}' expression binding for '${t}' must contain a non-empty expression`)}if(e.outputBindings)for(const[t,o]of Object.entries(e.outputBindings)){if(Bt(t))throw new S(`Node '${e.id}' output binding key '${t}' is not allowed (unsafe prototype-pollutant key)`);if(!o||"object"!=typeof o||Array.isArray(o))throw new S(`Node '${e.id}' output binding for '${t}' must be an object with enabled and alias settings`)}if(!Vt(e.parameters))throw new S(`Node '${e.id}' parameters must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys, or unsafe prototype keys are not allowed`);if(void 0!==e.state){if(!e.state||"object"!=typeof e.state||Array.isArray(e.state))throw new S(`Node '${e.id}' state must be an object when present`);if(!Vt(e.state))throw new S(`Node '${e.id}' state must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys, or unsafe prototype keys are not allowed`)}}function fo(e,t,o){if(!t.body||"object"!=typeof t.body)throw new S(`Node '${e.id}' loop configuration requires a body document`);if(go(t.body,o),!(void 0===t.maxIterations||Number.isFinite(t.maxIterations)&&t.maxIterations>0))throw new S(`Node '${e.id}' loop maxIterations must be a positive number`);if(void 0!==t.timeoutMs&&("number"!=typeof t.timeoutMs||0>=t.timeoutMs))throw new S(`Node '${e.id}' loop timeoutMs must be a positive number in milliseconds`);if(void 0!==t.concurrency&&("number"!=typeof t.concurrency||0>=t.concurrency))throw new S(`Node '${e.id}' loop concurrency must be a positive number`);for(const o of[t.inputMappings,t.outputMappings])if(o)for(const[t,r]of Object.entries(o)){if(Bt(t))throw new S(`Node '${e.id}' loop mapping key '${t}' is not allowed (unsafe prototype-pollutant key)`);mo(r,e.id,t)}}function yo(e,t,o){if(!t.try||"object"!=typeof t.try)throw new S(`Node '${e.id}' error-boundary configuration requires a try body document`);go(t.try,o);for(const[r,n]of[["catch",t.catch],["finally",t.finally]])if(void 0!==n){if(!n||"object"!=typeof n)throw new S(`Node '${e.id}' error-boundary ${r} body must be a document`);go(n,o)}}function mo(e,t,o){if(!e||"object"!=typeof e)throw new S(`Node '${t}' loop mapping '${o}' must reference a workflow port, node port, literal, or expression`);switch(e.source){case"workflow":if("string"!=typeof e.port||!e.port)throw new S(`Node '${t}' loop mapping '${o}' referencing a workflow must reference a port identifier`);break;case"node":if("string"!=typeof e.nodeId||!e.nodeId||"string"!=typeof e.port||!e.port)throw new S(`Node '${t}' loop mapping '${o}' referencing a node must reference a node id and a port`);break;case"literal":if(!Vt(e.value))throw new S(`Node '${t}' loop mapping '${o}' literal references must be JSON-safe values`);break;case"expression":if("string"!=typeof e.expression||!e.expression)throw new S(`Node '${t}' loop mapping '${o}' expression references must be non-empty expressions`);break;default:throw new S(`Node '${t}' loop mapping '${o}' must use a workflow, node, literal, or expression reference source`)}}function bo(e,t){if("string"!=typeof e.id||!e.id)throw new S("Edge 'id' is required and must be a non-empty string");if(t.has(e.id))throw new S(`Edge id '${e.id}' is declared more than once; edge ids must be unique`);if(!lo(e.source))throw new S(`Edge '${e.id}' source endpoint is not a valid GraphEndpoint`);if(!lo(e.target))throw new S(`Edge '${e.id}' target endpoint is not a valid GraphEndpoint`);if("data"!==e.type&&"connection"!==e.type)throw new S(`Edge '${e.id}' type '${e.type+""}' is not a valid edge type (data or connection are allowed)`);if(t.add(e.id),!Vt(e))throw new S(`Edge '${e.id}' contains values that are not JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys, or unsafe prototype keys are not allowed`)}function wo(e,t,o,r,n){if(ao(e)){if(!o.has(e.port))throw new S(`${n} references workflow port '${e.port}' which is not declared on the document`)}else if(so(e)){if(!r.has(e.nodeId))throw new S(`${n} references node '${e.nodeId}' which is not part of the document`);if("string"!=typeof e.port||!e.port)throw new S(n+" node endpoints must reference a non-empty port identifier")}}const vo=["expression","template"],xo=["javascript","typescript","json","text"];function Io(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return!(!(e=>vo.includes(e))(t.mode)||"string"!=typeof t.expression||!t.expression||void 0!==t.language&&!(e=>xo.includes(e))(t.language)||void 0!==t.metadata&&!Kt(t.metadata))}function _o(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.id&&"string"==typeof t.name&&Array.isArray(t.inputs)&&Array.isArray(t.outputs)&&Array.isArray(t.nodes)&&Array.isArray(t.edges)}function Eo(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.type&&(void 0===t.required||"boolean"==typeof t.required)&&(void 0===t.displayName||"string"==typeof t.displayName)&&(void 0===t.allowedOperations||Array.isArray(t.allowedOperations)&&t.allowedOperations.every(e=>"string"==typeof e))}const Ao=["trigger","loop","branching","stateful","retryable","cancellable","parallel","resource"];function So(e){return Ao.includes(e)}function Ro(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.kind&&"object"==typeof t.display&&Array.isArray(t.inputs)&&Array.isArray(t.outputs)&&Array.isArray(t.parameters)}function Oo(e){if(!Ro(e))throw new S("Graph node manifest does not conform to the required shape");if(!Vt(e))throw new S("Graph node manifest contains values that are not JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys or unsafe prototype keys are not allowed on manifests")}function ko(e){return Oo(e),zt(e)}function Co(e){if(!Ro(e))throw new S("Serialized graph node manifest does not conform to the required shape");return zt(e)}const No=["loadOptions","listSearch","resourceLocator","resourceMapping","validateParameter","action"];function To(e){if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.name&&(e=>No.includes(e))(t.type)&&(void 0===t.parameter||"string"==typeof t.parameter)&&(void 0===t.dependencies||Array.isArray(t.dependencies)&&t.dependencies.every(e=>"string"==typeof e))}function Po(e){const t=e.element?.props?.value,o=t??e.prop?.value??e.validation?.defaultValue;if(void 0!==o&&"function"!=typeof o&&Vt(o))try{return JSON.parse(JSON.stringify(o))}catch{return}}function Do(e){if(e.type&&e.type in Jt)return{type:"string",format:Jt[e.type]};const t=(e=>{for(const t of[e.graph?.type,e.element?.props?.type,e.prop?.type])if("string"==typeof t&&"any"!==Yt(t))return t})(e);return t?oo((e=>{if(!e)return;const t=Object.entries(e).filter(([e])=>e!==m.TYPE);return Object.fromEntries(t)})(e.validation),t):oo(e.validation,e.type,e.model)}function jo(e){const t={};for(const[o,r]of Object.entries(e.graph?.metadata??{}))Vt(r)&&(t[o]=JSON.parse(JSON.stringify(r)));return Object.keys(t).length?t:void 0}function Lo(e){switch(e){case"output":return"output";case"connection":return"connection";default:return"input"}}function Mo(e){const t=e.graph?.handle;return"connection"!==e.direction&&"string"==typeof t&&t?t:e.path??e.property}const Go=["top","bottom","left","right"],Uo=["start","center","end"];function $o(e,t){const o={id:Mo(e),label:e.label,direction:Lo(e.direction),schema:Do(e)};e.required&&(o.required=!0),e.hidden&&(o.hidden=!0);const r=e.graph?.category;"string"==typeof r&&(o.category=r);const n=(e=>{const t=e.graph?.zone;if(!t||"object"!=typeof t||Array.isArray(t))return;const o=t,r=o.side;if("string"!=typeof r||!Go.includes(r))return;const n={side:r},i=o.align;"string"==typeof i&&Uo.includes(i)&&(n.align=i);const a=o.order;return"number"==typeof a&&Number.isFinite(a)&&(n.order=a),n})(e);n&&(o.zone=n),!0===e.graph?.userControlled&&(o.configurable=!0);const i=e.graph?.handle;"string"==typeof i&&(o.handle=i);const a=Jo(e.graph?.connectionRules)??t;a&&(o.connectionPolicy=a);const s=(e=>{const t=e.element;if(!t||!Vt(t))return;const o=t.tag;if("string"!=typeof o)return;const r=t.props;return{tag:o,serialize:!0===t.serialize,props:r&&"object"==typeof r&&!Array.isArray(r)?zt(r):{}}})(e);s&&(o.element=s);const d=jo(e);return d&&(o.metadata=d),o}function Fo(e){const t={type:"string",id:Mo(e),label:e.label,required:e.required};if(e.hidden)return((e,t)=>{const o={...t,type:"hidden"},r=Po(e);return void 0!==r&&(o.defaultValue=r),Ho(o)})(e,t);const o=Po(e);void 0!==o&&(t.defaultValue=o);const r=(e=>{const t=e.element?.props?.placeholder??e.prop?.placeholder;return"string"==typeof t?t:void 0})(e);r&&(t.placeholder=r);const n=jo(e);if(n&&(t.metadata=n),(e=>{const t=Wo(e);return"code"===t||"code-editor"===t})(e))return Ho({...t,type:"code",language:zo(e)});const i=Do(e);switch(i.type){case"number":{const o={...t,type:"number",integer:i.integer,min:i.min,max:i.max},r=qo(e.validation?.step);return void 0!==r&&(o.step=r),Ho(o)}case"boolean":return Ho({...t,type:"boolean"});case"enum":return Ho({...t,type:"options",options:i.values.map(e=>({value:e,label:e+""}))});case"array":{const e={...t,type:"collection"};return void 0!==i.maxItems&&(e.maxItems=i.maxItems),Ho(e)}case"object":case"model":return Ho({...t,type:"object"});default:return Ho({...t,type:"string",multiline:!!Ko(e)||void 0,pattern:Bo(e.validation?.pattern),minLength:qo(e.validation?.minlength),maxLength:qo(e.validation?.maxlength)})}}function Ho(e){const t=e;for(const e of Object.keys(t))void 0===t[e]&&delete t[e];return e}function Bo(e){const t=e?.value;return"string"==typeof t?t:void 0}function qo(e){const t=e?.value;return"number"==typeof t&&Number.isFinite(t)?t:void 0}function Wo(e){const t=e.element?.tag;return"string"==typeof t&&t?t:void 0}function Ko(e){return"textarea"===Wo(e)||"textarea"===(e=>{const t=e.element?.props?.type;return"string"==typeof t?t:void 0})(e)}const Vo=["javascript","typescript","json","text"];function zo(e){const t=e.element?.props?.language;return"string"==typeof t&&Vo.includes(t)?t:"javascript"}function Qo(e,t){const o={name:t.name??e.name},r=e.graph?.metadata?.description??void 0;"string"==typeof r&&r&&(o.description=r);const n=t.category??e.category;"string"==typeof n&&n&&(o.category=n),"string"==typeof e.group&&e.group&&(o.group=e.group),Array.isArray(e.labels)&&(o.labels=e.labels.slice());const i=((e,t)=>{if(t.icon)return t.icon;const o=e.effectiveIcon??e.icon;return"string"==typeof o?{type:"catalogue",name:o}:{type:"catalogue",name:"ph:circuitry"}})(e,t);return i&&(o.icon=i),"string"==typeof e.color&&e.color&&(o.color=e.color),"number"==typeof e.width&&Number.isFinite(e.width)&&(o.width=e.width),"number"==typeof e.minWidth&&Number.isFinite(e.minWidth)&&(o.minWidth=e.minWidth),"number"==typeof e.height&&Number.isFinite(e.height)&&(o.height=e.height),"string"==typeof e.shape&&(o.shape=e.shape),"number"==typeof e.cornerRadius&&Number.isFinite(e.cornerRadius)&&(o.cornerRadius=e.cornerRadius),Array.isArray(e.sizeRules)&&(o.sizeRules=e.sizeRules),o}function Jo(e){if(!e)return;const t=e,o={};"boolean"==typeof t.allowSelf&&(o.allowSelf=t.allowSelf),"boolean"==typeof t.allowMultiple&&(o.allowMultiple=t.allowMultiple);const r=t.allowedKinds;Array.isArray(r)&&r.every(e=>"string"==typeof e)&&(o.allowedNodeKinds=r);const n=t.blockedKinds;Array.isArray(n)&&n.every(e=>"string"==typeof e)&&(o.blockedNodeKinds=n);const i=t.allowedPortCategories;Array.isArray(i)&&i.every(e=>"string"==typeof e)&&(o.allowedPortCategories=i);const a=t.maxConnections;return"number"==typeof a&&Number.isFinite(a)&&(o.maxConnections=a),Object.keys(o).length?o:void 0}function Xo(e,t={}){const o="function"==typeof e?e:e.constructor;if(!Rt(o))throw new S(`Node '${o?.name??e+""}' is not decorated with @node and cannot produce a manifest`);const r=Dt(o),n=Pt(Nt(o)),i=[],a=[],s=[],d=[],l=Jo(r.graph?.connectionRules);for(const e of n)("connection"===e.direction?s:"output"===e.direction?a:i).push($o(e,l)),"input"===e.direction&&d.push(Fo(e));const c={kind:t.kind??r.kind??r.name,display:Qo(r,t),inputs:i,outputs:a,parameters:d};return s.length&&(c.connections=s),r.namespaces?.length&&(c.namespaces=r.namespaces.slice()),Oo(c),c}var Yo,Zo;(e=>{e.READABILITY="readability",e.COMPACTNESS="compactness",e.BALANCED="balanced"})(Yo||(Yo={})),(e=>{e.TIGHT="tight",e.NORMAL="normal",e.COMFORTABLE="comfortable"})(Zo||(Zo={})),Zo.TIGHT,Zo.NORMAL,Zo.COMFORTABLE,Yo.READABILITY,Zo.COMFORTABLE,Yo.COMPACTNESS,Zo.TIGHT,Yo.BALANCED,Zo.NORMAL;let er=class extends j{constructor(e){super(e)}};k([N({type:String,generated:!1}),h("Unique graph run id"),i("ngx-decaf-crud-field",{label:"graph.run.id.label",readonly:!0}),C("design:type",String)],er.prototype,"runId",void 0),k([T(),w(),P(),h("Workflow document id the run executes"),a("workflowId"),i("ngx-decaf-crud-field",{label:"graph.run.workflowId.label"}),C("design:type",String)],er.prototype,"workflowId",void 0),k([T(),h("Owning user; absent for anonymous callers"),i("ngx-decaf-crud-field",{label:"graph.run.owner.label"}),C("design:type",String)],er.prototype,"owner",void 0),k([T(),w(),v(String),P(),h("Current run lifecycle status"),a("status"),i("ngx-decaf-crud-field",{label:"graph.run.status.label",readonly:!0}),C("design:type",String)],er.prototype,"status",void 0),k([T(),h("Fingerprint of the executed document"),i("ngx-decaf-crud-field",{label:"graph.run.fingerprint.label",readonly:!0}),C("design:type",String)],er.prototype,"documentFingerprint",void 0),k([T(),f(),h("Workflow input values keyed by input port id"),C("design:type",Object)],er.prototype,"inputs",void 0),k([T(),f(),h("Execution result, present on successful completion"),C("design:type",Object)],er.prototype,"result",void 0),k([T(),f(),h("Structured error payload, present on failure"),C("design:type",Object)],er.prototype,"error",void 0),k([x(),T(),h("Run creation timestamp"),C("design:type",Date)],er.prototype,"createdAt",void 0),k([x(),T(),h("Execution start timestamp, once it has started"),C("design:type",Date)],er.prototype,"startedAt",void 0),k([x(),T(),h("Terminal-state timestamp, once the run has finished"),C("design:type",Date)],er.prototype,"finishedAt",void 0),er=k([s("ngx-decaf-list-item",{icon:"ti-player-play"}),n("ngx-decaf-crud-form"),h("Persistable graph run lifecycle record"),D("graph_run"),I(),C("design:paramtypes",[Object])],er);let tr=class extends j{constructor(e){super(e)}};k([N({type:String,generated:!1}),C("design:type",String)],tr.prototype,"workflowId",void 0),k([T(),C("design:type",String)],tr.prototype,"name",void 0),k([T(),C("design:type",Object)],tr.prototype,"document",void 0),k([T(),C("design:type",String)],tr.prototype,"owner",void 0),k([T(),C("design:type",Object)],tr.prototype,"snapshot",void 0),k([L(),C("design:type",Date)],tr.prototype,"createdAt",void 0),tr=k([D("graph_workflow"),I(),C("design:paramtypes",[Object])],tr);let or=class extends j{constructor(e){super(e)}};k([N({type:String,generated:!1}),C("design:type",String)],or.prototype,"kind",void 0),k([T(),P(),C("design:type",String)],or.prototype,"name",void 0),k([T(),P(),C("design:type",String)],or.prototype,"category",void 0),k([T(),C("design:type",String)],or.prototype,"group",void 0),k([T(),C("design:type",String)],or.prototype,"description",void 0),k([T(),C("design:type",Object)],or.prototype,"manifest",void 0),k([L(),C("design:type",Date)],or.prototype,"createdAt",void 0),or=k([D("graph_node"),I(),C("design:paramtypes",[Object])],or),dt("Trigger",{color:"#3b82f6",icon:"ti-bolt"}),dt("Flow Control",{color:"#f59e0b",icon:"ti-arrows-split-2"}),dt("Utility",{color:"#0d9488",icon:"ti-tool"}),dt("Loop",{color:"#eab308",icon:"ti-repeat"}),dt("Workflow",{color:"#f97316",icon:"ti-sitemap"}),dt("Pipeline",{color:"#0ea5e9",icon:"ti-git-merge"}),dt("Node",{color:"#8b5cf6",icon:"ti-point-filled"}),dt("Agent",{color:"#7c3aed",icon:"ti-robot"}),dt("Data",{color:"#8b5cf6",icon:"ti-table"}),dt("IO",{color:"#0ea5e9",icon:"ti-world-www"}),dt("Storage",{color:"#0f766e",icon:"ti-database"}),dt("DevOps",{color:"#475569",icon:"ti-terminal-2"}),dt("Comms",{color:"#d946ef",icon:"ti-message-circle"}),dt("model",{color:"#3b82f6",icon:"ti-cpu"}),dt("memory",{color:"#10b981",icon:"ti-database"}),dt("workspace",{color:"#f59e0b",icon:"ti-folder"}),dt("tools",{color:"#0ea5e9",icon:"ti-tools"}),dt("hooks",{color:"#f97316",icon:"ti-webhook"}),dt("skill",{color:"#8b5cf6",icon:"ti-bulb"}),dt("sandbox",{color:"#14b8a6",icon:"ti-box"}),dt("scorers",{color:"#ec4899",icon:"ti-star"}),dt("embedding",{color:"#6366f1",icon:"ti-vector"});const rr=new Set;function nr(e,t){return e.config[t]}function ir(e){return Array.isArray(e)?e.map(e=>e+"").join(", "):e+""}(()=>{const t=[{key:ft.NODE_ID,shouldInclude:e=>null!=nr(e,ft.NODE_ID),render:e=>nr(e,ft.NODE_ID)+""},{key:ft.WORKFLOW_ID,shouldInclude:e=>null!=nr(e,ft.WORKFLOW_ID),render:e=>nr(e,ft.WORKFLOW_ID)+""},{key:ft.RUN_ID,shouldInclude:e=>null!=nr(e,ft.RUN_ID),render:e=>nr(e,ft.RUN_ID)+""},{key:ft.USER,shouldInclude:e=>null!=nr(e,ft.USER),render:e=>nr(e,ft.USER)+""},{key:ft.ROLES,shouldInclude(e){const t=nr(e,ft.ROLES);return Array.isArray(t)&&t.length>0},render:e=>ir(nr(e,ft.ROLES))},{key:ft.NAMESPACES,shouldInclude(e){const t=nr(e,ft.NAMESPACES);return Array.isArray(t)&&t.length>0},render:e=>ir(nr(e,ft.NAMESPACES))},{key:ft.ORGANIZATION,shouldInclude:e=>null!=nr(e,ft.ORGANIZATION),render:e=>nr(e,ft.ORGANIZATION)+""},{key:ft.IP,shouldInclude:e=>null!=nr(e,ft.IP),render:e=>nr(e,ft.IP)+""}];for(const o of t)rr.has(o.key)||(e.register(o),rr.add(o.key))})();const ar="$workflow",sr="local",dr="GRAPH_LOCAL_UNSUPPORTED_NODE_KIND",lr=4,cr=100,pr=1e3,ur=1e3,gr=1e4,hr=3e4,fr=3e5,yr=10485760,mr=5,br=6e4,wr=3e4,vr=1048576,xr=10,Ir=1e3,_r=1e4,Er=1048576,Ar=1e4,Sr="graph.pinnable";var Rr,Or;(e=>{e.MANUAL="manual",e.AUTOMATIC="automatic",e.DISABLED="disabled"})(Rr||(Rr={})),(e=>{e.TRUTHY="truthy",e.FALSY="falsy",e.EQUALS="equals",e.NOT_EQUALS="notEquals",e.GREATER_THAN="greaterThan",e.GREATER_THAN_OR_EQUAL="greaterThanOrEqual",e.LESS_THAN="lessThan",e.LESS_THAN_OR_EQUAL="lessThanOrEqual",e.EXISTS="exists",e.CUSTOM="custom"})(Or||(Or={}));const kr={FOREACH:"core.loop.foreach",WHILE:"core.loop.while",UNTIL:"core.loop.until"};class Cr extends R{constructor(e,t="GRAPH_EXECUTION_ERROR",o){super(e,Cr.name,500),this.graphCode=t,this.details=o,this.name=this.constructor.name}}class Nr extends Cr{constructor(e){super("Graph workflow contains an unsupported cycle","GRAPH_CYCLE_ERROR",e)}}class Tr extends Cr{constructor(e,t){super(e,"GRAPH_INPUT_ERROR",t)}}class Pr extends Cr{constructor(e,t){super(e,"GRAPH_LOOP_LIMIT_ERROR",t)}}class Dr extends Cr{constructor(e,t){super(e,"GRAPH_PINNING_ERROR",t)}}class jr extends Cr{constructor(e,t){super(e,"GRAPH_PORT_ERROR",t)}}class Lr extends Cr{constructor(e,t){super(e,"GRAPH_STORE_ERROR",t)}}class Mr extends Cr{constructor(e,t){super(e,"GRAPH_TOPOLOGY_ERROR",t)}}class Gr extends Cr{constructor(e){super("Break signal","GRAPH_BREAK_SIGNAL",{value:e}),this.isBreakSignal=!0,this.name="GraphBreakSignal"}}class Ur extends Cr{constructor(e){super(`Graph run '${e}' was cancelled`,"GRAPH_RUN_CANCELLED",{runId:e}),this.name=Ur.name}}class $r extends S{constructor(e){super(`Graph workflow document rejected with ${e.length} issue(s): ${e.map(e=>`${e.code} at ${e.path} (${e.message})`).join("; ")}`),this.name=$r.name,this.issues=e}}class Fr{constructor(){this.observers=new Set}observe(e){return this.observers.add(e),()=>this.unObserve(e)}unObserve(e){this.observers.delete(e)}async updateObservers(e){await Promise.all(Array.from(this.observers).map(async t=>{try{await Promise.resolve(t.refresh(e))}catch{}}))}}class Hr{constructor(){this.sequence=0}create(e){return{...e,id:this.createEventId(),sequence:++this.sequence,timestamp:new Date}}createEventId(){const e=globalThis.crypto;if(!e||"function"!=typeof e.randomUUID)throw new Cr("Cannot generate a graph event id: crypto.randomUUID is unavailable in this runtime","GRAPH_EVENT_ID_ERROR",{runtime:typeof globalThis.crypto});return e.randomUUID()}}function Br(e){if("string"!=typeof e)return;const t=e.trim();if(!t)return;const o=t.split(".");if(3!==o.length)return;const r=o[0].trim(),n=o[2].trim(),i=o[1].split(",").map(e=>e.trim()).filter(e=>e.length>0);return r&&n&&0!==i.length?{organization:r,departments:i,role:n}:void 0}function qr(e){return`${e.organization}.${e.departments.join(",")}.${e.role}`}function Wr(e){if(!e||"string"!=typeof e.namespace||!e.parts)return!1;const t=Br(e.namespace);return!!t&&qr(t)===qr(e.parts)}function Kr(e,t){const o="string"==typeof e?e.trim():"";if(o){if(t)for(const e of t)if(e&&e.namespace===o&&Wr(e))return e.parts;return Br(o)}}function Vr(e,t,o={},r){const n=Kr(e,r),i=Kr(t,r);return!(!n||!i)&&n.organization===i.organization&&n.role===i.role&&("exact"===(o.mode??"inherit")?n.departments.length===i.departments.length&&n.departments.every((e,t)=>e===i.departments[t]):n.departments.length<=i.departments.length&&n.departments.every((e,t)=>e===i.departments[t]))}function zr(e,t,o={},r){return e.filter(e=>!t.some(t=>Vr(t,e,o,r)))}function Qr(e){return e.filter(e=>void 0===Br(e))}function Jr(e,t){const o=new Set;for(const r of e){const e=Kr(r,t);e&&o.add(e.role)}return[...o]}function Xr(e){if(!Array.isArray(e))return;const t=e.filter(e=>"string"==typeof e&&e.length>0);return t.length?t:void 0}function Yr(e,t){try{const o=e.cache;if(o&&void 0!==o[t]&&null!==o[t])return o[t]}catch{}try{return e.get(t)}catch{return}}function Zr(e){if(!e)return{};const t={},o=e.user;"string"==typeof o&&o&&(t.user=o);const r=e.organization;"string"==typeof r&&r&&(t.organization=r);const n=e.ip;"string"==typeof n&&n&&(t.ip=n);const i=Xr(e.roles);i&&(t.roles=i);const a=Xr(e.namespaces);return a&&(t.namespaces=a,t.namespaceCache=tn(a)),t}function en(e){return e?Zr({user:Yr(e,"user"),organization:Yr(e,"organization"),ip:Yr(e,"ip"),roles:Yr(e,"roles"),namespaces:Yr(e,"namespaces")}):{}}function tn(e){const t=[];for(const o of e){const e=Br(o);e&&t.push({namespace:o,parts:e})}return t}function on(...e){const t={};for(const o of e)o&&(void 0!==o.user&&(t.user=o.user),void 0!==o.organization&&(t.organization=o.organization),void 0!==o.ip&&(t.ip=o.ip),void 0!==o.roles&&(t.roles=o.roles),void 0!==o.namespaces&&(t.namespaces=o.namespaces),void 0!==o.namespaces?t.namespaceCache=o.namespaceCache??tn(o.namespaces):void 0!==o.namespaceCache&&(t.namespaceCache=o.namespaceCache));return t}class rn{constructor(e={}){this.options=e}get enabled(){return!0===this.options.enabled}validate(e,o,r,n){if(!this.enabled)return;const i=n??this.options.logger??t.for("GraphAuth"),a=e.id||e.name||o.workflowId,s=xt(e.metadata);this.assertGranted(`workflow '${a}'`,s?.namespaces??[],r,s?.roles??[],i);for(const e of o.nodes)this.assertGranted(`node '${e.id}'`,e.manifest.namespaces??[],r,[],i)}validateWorkflowRead(e,o,r){if(!this.enabled)return;const n=r??this.options.logger??t.for("GraphAuth"),i=xt(e.metadata);this.assertGranted(`workflow '${e.id||e.name}'`,i?.namespaces??[],o,i?.roles??[],n)}assertGranted(e,t,o,r,n){const i=o.namespaces??[],a=zr(t,i,this.options.match,o.namespaceCache),s=Jr(i,o.namespaceCache),d=r.filter(e=>!s.includes(e));if(0===a.length&&0===d.length)return;const l=[...new Set([...Qr(t),...Qr(i)])],c=[];throw a.length&&c.push("namespace(s) "+a.join(", ")),d.length&&c.push("role(s) "+d.join(", ")),n.warn(`Graph access denied for ${e} for user ${o.user??"anonymous"}: missing ${c.join(" and ")}${l.length?`; malformed namespace(s) ${l.join(", ")} failed closed`:""}`),new M(`Access to ${e} requires ${c.join(" and ")}`)}}class nn{constructor(e){this.services=e}async resolve(e,t,o,r,n){if(!e){if(o)throw new Cr(`${r} node requires a credential of type '${t}'`,"GRAPH_CREDENTIAL_MISSING",{credentialType:t});return}if(e.credentialType&&e.credentialType!==t)throw new Cr(`${r} node credential has type '${e.credentialType}' but requires '${t}'`,"GRAPH_CREDENTIAL_TYPE_MISMATCH",{credentialId:e.credentialId,credentialType:e.credentialType});let i;try{i=await this.services.credentialService.getCredential(e.credentialId,n)}catch(t){throw new Cr(`${r} node credential '${e.credentialId}' could not be resolved`,"GRAPH_CREDENTIAL_NOT_FOUND",{credentialId:e.credentialId,cause:t instanceof Error?t.message:t+""})}if(!1===i.enabled)throw new Cr(`${r} node credential '${e.credentialId}' is disabled`,"GRAPH_CREDENTIAL_DISABLED",{credentialId:e.credentialId});if((e=>{if(!e)return!1;const t=e instanceof Date?e.getTime():Date.parse(e);return Number.isFinite(t)&&Date.now()>=t})(i.expiresAt))throw new Cr(`${r} node credential '${e.credentialId}' has expired`,"GRAPH_CREDENTIAL_EXPIRED",{credentialId:e.credentialId});if(i.credentialType&&i.credentialType!==t)throw new Cr(`${r} node credential '${e.credentialId}' has type '${i.credentialType}' but requires '${t}'`,"GRAPH_CREDENTIAL_TYPE_MISMATCH",{credentialId:e.credentialId,credentialType:i.credentialType});const a=this.secretServiceFor(i.provider,r),s=await a.retrieve(i.secretName,{},n);return await(this.services.credentialService.markCredentialUsed?.(e.credentialId,n).catch(()=>{})),(e=>{if(null!=e)return"string"==typeof e?e:e instanceof Uint8Array?(new TextDecoder).decode(e):"object"!=typeof e||Array.isArray(e)?e+"":e})(s)}secretServiceFor(e,t){if("model"===e)return this.services.modelSecretService;if("filesystem"===e){if(!this.services.fsSecretService)throw new Cr(`${t} node credential provider '${e}' requires a configured filesystem secret service`,"GRAPH_CREDENTIAL_SERVICE_UNAVAILABLE",{provider:e});return this.services.fsSecretService}throw new Cr(`${t} node credential provider '${e}' is not supported`,"GRAPH_CREDENTIAL_PROVIDER_UNSUPPORTED",{provider:e})}}async function an(e,t,o,r,n,i="credentialRef"){const a=t?.[i];if(!a){if(!r)return;throw new Cr(`${n} node requires a credential of type '${o}'`,"GRAPH_CREDENTIAL_MISSING",{credentialType:o})}const s=e?.engine,d=s?.nodeCredentials;if(!d)throw new Cr(n+" node requires ctx-bound credential services, but the engine has none configured","GRAPH_CREDENTIAL_SERVICE_UNAVAILABLE",{node:n,credentialType:o});return d.resolve(a,o,r,n,e)}class sn{constructor(e){this.baseOptions=e,this.inner=t.for("GraphRun").for(this.attributeConfig(e))}attributeConfig(e){return{[ft.NODE_ID]:e.nodeId,[ft.WORKFLOW_ID]:e.workflowId,[ft.RUN_ID]:e.runId,[ft.USER]:e.user??null,[ft.ROLES]:e.roles,[ft.NAMESPACES]:e.namespaces,[ft.ORGANIZATION]:e.organization,[ft.IP]:e.ip}}emit(e,t,o){const r="string"==typeof t?t:t instanceof Error?t.message:t+"",n={level:e,message:r,timestamp:(new Date).toISOString(),runId:this.baseOptions.runId,workflowId:this.baseOptions.workflowId,nodeId:this.baseOptions.nodeId,user:this.baseOptions.user??null};void 0!==this.baseOptions.roles&&(n.roles=this.baseOptions.roles),void 0!==this.baseOptions.namespaces&&(n.namespaces=this.baseOptions.namespaces),void 0!==this.baseOptions.organization&&(n.organization=this.baseOptions.organization),void 0!==this.baseOptions.ip&&(n.ip=this.baseOptions.ip),void 0!==o&&(n.payload=o),this.baseOptions.forward({type:yt.GRAPH_RUN_LOG,payload:n}).catch(()=>{}),{benchmark:(e,t)=>this.inner.benchmark(e,t),fatal:(e,t)=>this.inner.fatal(e,t),critical:(e,t)=>this.inner.critical(e,t),silly:(e,t)=>this.inner.silly(e,t),trace:(e,t)=>this.inner.trace(e,t),verbose:(e,t)=>this.inner.verbose(e,t),info:(e,t)=>this.inner.info(e,t),warn:(e,t)=>this.inner.warn(e,t),error:(e,t)=>this.inner.error(e,t),debug:(e,t)=>this.inner.debug(e,t)}[e](r,o)}benchmark(e,t){this.emit("benchmark",e,t)}fatal(e,t,o){this.emit("fatal",e,t??o)}critical(e,t,o){this.emit("critical",e,t??o)}silly(e,t,o){this.emit("silly",e,"object"==typeof t?t:o)}trace(e,t){this.emit("trace",e,t)}verbose(e,t,o){this.emit("verbose",e,"object"==typeof t?t:o)}info(e,t){this.emit("info",e,t)}error(e,t,o){this.emit("error",e,t??o)}warn(e,t){this.emit("warn",e,t)}debug(e,t){this.emit("debug",e,t)}action(e,t,o){this.inner.action(e,t,o)}setConfig(){}for(e,t,...o){return this}clear(){return this}get root(){return this.inner.root}}function dn(e){if(!Array.isArray(e))return;const t=e.filter(e=>"string"==typeof e&&e.length>0);return t.length?t:void 0}class ln extends G{constructor(e,t,o,r,n,i,a,s,d={},l,c,p){super(),this.runId=e,this.parentRunId=t,this.workflowId=o,this.document=r,this.node=n,this.manifest=i,this.path=a,this.emitFn=s,this.metadata=d,this.engine=l,this.abortSignal=c,this.limits=p;const u=Zr(d);this.accumulate({...u,operation:"execute"});const g="string"==typeof d?.user?d.user:null;this.runLogger=new sn({runId:e,workflowId:o,nodeId:n.id,user:g,roles:dn(d?.roles),namespaces:dn(d?.namespaces),organization:"string"==typeof d?.organization?d.organization:void 0,ip:"string"==typeof d?.ip?d.ip:void 0,forward:async e=>{await this.emit(e)}})}get logger(){return this.runLogger}get auth(){return en(this)}async emit(e){await this.emitFn({...e,runId:this.runId,parentRunId:this.parentRunId,workflowId:this.workflowId,nodeId:this.node.id,path:e.path??this.path})}async progress(e){await this.emit({type:yt.NODE_OUTPUT,payload:e})}async log(e,t){await this.emit({type:yt.NODE_OUTPUT,payload:{message:e,payload:t}})}}class cn{constructor(e,t,o,r){this.nodeResults=new Map,this.events=[],this.activeDataEdges=new Set,this.runId=e,this.plan=t,this.valueStore=o,this.eventFactory=r,this.startedAt=new Date}recordNodeResult(e){this.nodeResults.set(e.nodeId,e)}activateDataEdge(e){this.activeDataEdges.add(e)}isDataEdgeActive(e){return this.activeDataEdges.has(e)}appendEvent(e){this.events.push(e)}finish(){this.finishedAt=new Date}}function pn(e,t,o,r,n){const i=e.valueStore.getWorkflowValues(),a={};for(const[t,o]of e.nodeResults)a[t]=o;const s=[...e.events];return{runId:e.runId,workflowId:t.id||t.name,status:r,document:t,inputs:{...o},outputs:i,nodeResults:a,events:s,startedAt:e.startedAt,finishedAt:e.finishedAt,metadata:n}}class un{constructor(e,t,o){this.emitter=e,this.eventFactory=t,this.options=o}get engine(){return this.options.engine}get codeSandboxEvaluator(){return this.options.codeSandboxEvaluator}get frame(){return this._frame}bindFrame(e){this._frame=e}async emit(e){const t=this.eventFactory.create({id:"",sequence:0,timestamp:new Date,runId:this.options.runId,parentRunId:this.options.parentRunId,workflowId:this.options.workflowId,type:yt.NODE_OUTPUT,path:this.options.path??[],...e});this._frame?.appendEvent(t),await this.emitter.updateObservers(t)}async updateObservers(e){await this.emitter.updateObservers(e)}}function gn(e){const t=e.capabilities;return{codeMode:t?.codeMode??e.codeMode,workflows:{list:t?.workflows?.list??("function"==typeof e.listWorkflows?"supported":"not_supported"),get:t?.workflows?.get??("function"==typeof e.getWorkflow?"supported":"not_supported")}}}class hn{static{this._cache={}}static register(e,t){return hn._cache[e]=t,t}static get(e){const t=e??hn._currentFlavour;if(t)return hn._cache[t]}static getOrFail(e){const t=hn.get(e);if(!t)throw new Cr(`No graph execution backend registered under '${e}'`,"GRAPH_EXECUTION_BACKEND_NOT_REGISTERED");return t}static get current(){return hn.get()}static get currentFlavour(){return hn._currentFlavour??sr}static setCurrent(e){hn._currentFlavour=e}static list(){return Object.entries(hn._cache).map(([e,t])=>({flavour:e,backend:t}))}static unregister(e){e&&(delete hn._cache[e],hn._currentFlavour===e&&(hn._currentFlavour=void 0))}static clear(){for(const e of Object.keys(hn._cache))delete hn._cache[e];hn._currentFlavour=void 0}}class fn{evaluate(e,t){switch(e.op){case"eq":return this.resolveValue(e.left,t)===this.resolveValue(e.right,t);case"neq":return this.resolveValue(e.left,t)!==this.resolveValue(e.right,t);case"gt":return Number(this.resolveValue(e.left,t))>Number(this.resolveValue(e.right,t));case"gte":return Number(this.resolveValue(e.left,t))>=Number(this.resolveValue(e.right,t));case"lt":return Number(this.resolveValue(e.left,t))<Number(this.resolveValue(e.right,t));case"lte":return Number(this.resolveValue(e.left,t))<=Number(this.resolveValue(e.right,t));case"and":return e.conditions.every(e=>this.evaluate(e,t));case"or":return e.conditions.some(e=>this.evaluate(e,t));case"not":return!this.evaluate(e.condition,t);case"exists":return void 0!==this.resolveValue(e.value,t)&&null!==this.resolveValue(e.value,t);default:throw new Cr(`Unknown ConditionExpression op '${e.op}'`,"GRAPH_UNKNOWN_CONDITION_OP",{expr:e})}}resolveValue(e,t){if("const"in e)return e.const;if("path"in e&&!("step"in e))return this.resolvePath(e.path,t);if("step"in e&&"path"in e){const o=t?.nodes;if(o&&"object"==typeof o){const t=o[e.step];return this.resolvePath(e.path,t)}return this.resolvePath(e.path,t)}throw new Cr("Invalid ExprValue: must have `const`, `path`, or `step`+`path`","GRAPH_INVALID_EXPR_VALUE",{ref:e})}resolvePath(e,t){if(!e)return t;const o=e.split(".");let r=t;for(const e of o){if(null==r)return;r=r[e]}return r}}function yn(e){return"object"==typeof e&&null!==e&&"type"in e&&"code"===e.type}function mn(e){return"object"==typeof e&&null!==e&&"op"in e&&"string"==typeof e.op}async function bn(e,t,o){const r=o.engine?.codeSandboxEvaluator;if(!r)throw new Cr("Code conditions require a CodeSandboxEvaluator to be registered in GraphExecutionEngineConfig.codeSandboxEvaluator","GRAPH_CODE_SANDBOX_NOT_CONFIGURED",{code:e.code});await o.log("Evaluating code condition",{language:e.language??"javascript"});const n=o.metadata;return!!await r.evaluate({code:e.code,language:e.language,input:t,vars:n?.vars??void 0,item:n?.item,index:n?.index,nodes:n?.nodes??void 0,logger:o.logger,abortSignal:o.abortSignal})}function wn(e,t,o){if(mn(e))return(new fn).evaluate(e,t);throw((e,t)=>new Cr(`Unknown ${t??"flow"} condition type \u2014 must be ConditionExpression (op) or CodeCondition (type: 'code')`,"GRAPH_UNKNOWN_CONDITION_TYPE",{condition:e}))(e,o)}async function vn(e,t,o){return yn(e)?bn(e,t.input,o):wn(e,t.state,t.label)}function xn(e,t,o,r){if(e&&"object"==typeof e&&!r.has(e))if(r.add(e),yn(e))o.push({nodeId:t,kind:"code-condition"});else if(Io(e))o.push({nodeId:t,kind:"value-template"});else if((e=>{if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"expression"===t.source&&"string"==typeof t.expression})(e))o.push({nodeId:t,kind:"expression-binding"});else if((e=>{if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.id&&"string"==typeof t.name&&Array.isArray(t.nodes)&&Array.isArray(t.edges)})(e))_n(e,o,r);else if(Array.isArray(e))for(const n of e)xn(n,t,o,r);else for(const n of Object.keys(e))xn(e[n],t,o,r)}function In(e,t,o){const r=e.id;"core.utility.code"===e.kind&&t.push({nodeId:r,kind:"code-node",detail:e.kind});const n=e.inputBindings??{};for(const[e,o]of Object.entries(n))o&&"expression"===o.mode&&t.push({nodeId:r,kind:"expression-binding",detail:e});xn(e.parameters,r,t,o),xn(e.metadata,r,t,o),xn(e.state,r,t,o),xn(e.loop,r,t,o)}function _n(e,t,o){for(const r of e.nodes??[])In(r,t,o)}function En(e){const t=[];return _n(e,t,new Set),t}function An(e){return En(e).length>0}function Sn(e){return"value-template"!==e.kind}function Rn(e){return En(e).filter(Sn)}const On="core.agent";function kn(e,t){if(!t)return{valid:!0};switch(t.type){case"any":default:return{valid:!0};case"string":return"string"!=typeof e?Cn("string"):{valid:!0};case"number":return"number"==typeof e&&Number.isFinite(e)?t.integer&&!Number.isInteger(e)?{valid:!1,message:"expected an integer number"}:void 0!==t.min&&e<t.min?{valid:!1,message:"expected a number >= "+t.min}:void 0!==t.max&&e>t.max?{valid:!1,message:"expected a number <= "+t.max}:{valid:!0}:Cn("number");case"boolean":return"boolean"!=typeof e?Cn("boolean"):{valid:!0};case"array":if(!Array.isArray(e))return Cn("array");if(void 0!==t.minItems&&e.length<t.minItems)return{valid:!1,message:`expected at least ${t.minItems} items`};if(void 0!==t.maxItems&&e.length>t.maxItems)return{valid:!1,message:`expected at most ${t.maxItems} items`};for(const o of e){const e=kn(o,t.items);if(!e.valid)return e}return{valid:!0};case"object":case"model":{if(null===e||"object"!=typeof e||Array.isArray(e))return Cn(t.type);const o=t,r=o.properties;if(!r)return{valid:!0};for(const[t,o]of Object.entries(r))if(t in e){const r=kn(e[t],o);if(!r.valid)return{valid:!1,message:`property '${t}': ${r.message}`}}if(o.required)for(const t of o.required)if(!(t in e))return{valid:!1,message:`missing required property '${t}'`};if(!1===o.additionalProperties)for(const t of Object.keys(e))if(!(t in r))return{valid:!1,message:`unexpected property '${t}'`};return{valid:!0}}case"enum":return t.values.some(t=>t===e)?{valid:!0}:{valid:!1,message:"value is not one of the enum values"}}}function Cn(e){return{valid:!1,message:`expected a ${e} value`}}function Nn(e){if("string"==typeof e)return e.length>0;if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.credentialId&&t.credentialId.length>0&&(void 0===t.credentialType||"string"==typeof t.credentialType)}const Tn=new Set(["loop"]),Pn=["secret","secrets","password","passwd","token","accessToken","refreshToken","apiKey","api_key","privateKey","credentials","authorization","proxy-authorization","x-api-key","x-auth-token","cookie","set-cookie"];class Dn{validate(e,t,o,r,n){this.validateParameters(e,t,o,r,n),this.validateMetadataKeys(e,t,o,r),this.validateDisabledBehavior(e,o,r),this.validateBindingShapes(e,t,o,r)}validateParameters(e,t,o,r,n){const i=!0===t.policies?.allowUndeclaredParameters,a=new Map(t.parameters.map(e=>[e.id,e]));for(const[n,s]of Object.entries(e.parameters??{})){const d=a.get(n);if(!d){i||o.push({code:"parameter.undeclared",path:`${r}.parameters.${n}`,message:`Node '${e.id}' sets parameter '${n}' which is not declared by kind '${t.kind}'`,nodeId:e.id,details:{kind:t.kind}});continue}if(void 0===s){o.push({code:"parameter.invalid",path:`${r}.parameters.${n}`,message:`Node '${e.id}' parameter '${n}' must not be undefined`,nodeId:e.id});continue}const l=this.checkParameterValue(s,d);l.valid||o.push({code:"parameter.type-mismatch",path:`${r}.parameters.${n}`,message:`Node '${e.id}' parameter '${n}' is invalid: ${l.message}`,nodeId:e.id,details:{expectedType:d.type}})}for(const i of t.parameters)void 0===(e.parameters??{})[i.id]&&(this.isParameterSatisfiedByInput(e,i.id,n)||(!0===i.required||(i.validation??[]).some(e=>"required"===e.kind))&&void 0===i.defaultValue&&o.push({code:"parameter.required-missing",path:`${r}.parameters.${i.id}`,message:`Node '${e.id}' is missing required parameter '${i.id}' declared by kind '${t.kind}'`,nodeId:e.id}))}isParameterSatisfiedByInput(e,t,o){return void 0!==(e.inputBindings??{})[t]||!0===o?.has(t)}checkParameterValue(e,t){if(Io(e))return{valid:!0};switch(t.type){case"string":case"code":case"expression":return"string"!=typeof e?Cn("string"):{valid:!0};case"number":return"number"==typeof e&&Number.isFinite(e)?{valid:!0}:Cn("number");case"boolean":return"boolean"!=typeof e?Cn("boolean"):{valid:!0};case"options":{const o=t.options;return o&&o.length&&!o.some(t=>t.value===e)?{valid:!1,message:"value is not one of the declared options"}:{valid:!0}}case"collection":return Array.isArray(e)?{valid:!0}:Cn("array");case"object":case"resourceLocator":return null===e||"object"!=typeof e||Array.isArray(e)?Cn("object"):{valid:!0};case"credential":return Nn(e)?t.credentialType&&"object"==typeof e&&void 0!==e.credentialType&&e.credentialType!==t.credentialType?{valid:!1,message:`credential type '${e.credentialType}' does not match the declared type '${t.credentialType}'`}:{valid:!0}:{valid:!1,message:"credential parameters must hold a credential reference (credentialId), never a secret"};default:return{valid:!0}}}validateMetadataKeys(e,t,o,r){const n=t.metadata?.allowedInstanceMetadataKeys;for(const i of Object.keys(e.metadata??{}))Tn.has(i)?o.push({code:"metadata.key-not-allowed",path:`${r}.metadata.${i}`,message:`Node '${e.id}' metadata key '${i}' is reserved and must not be set directly`,nodeId:e.id}):Array.isArray(n)&&!n.includes(i)&&o.push({code:"metadata.key-not-allowed",path:`${r}.metadata.${i}`,message:`Node '${e.id}' metadata key '${i}' is not in the allowed metadata keys of kind '${t.kind}'`,nodeId:e.id})}validateDisabledBehavior(e,t,o){!0!==e.disabled&&!1!==e.disabled&&void 0!==e.disabled&&t.push({code:"disabled.invalid",path:o+".disabled",message:`Node '${e.id}' disabled flag must be a boolean`,nodeId:e.id});const r=(e.metadata??{}).disabledBehavior;void 0===r||ut(r)||t.push({code:"disabled.invalid-behavior",path:o+".metadata.disabledBehavior",message:`Node '${e.id}' disabled behavior '${r+""}' is not one of: ${pt.join(", ")}`,nodeId:e.id})}validateBindingShapes(e,t,o,r){for(const[n,i]of Object.entries(e.inputBindings??{})){if("literal"===i.mode){const a=t.inputs.find(e=>e.id===n);if(a?.schema){const t=kn(i.value,a.schema);t.valid||o.push({code:"binding.literal-invalid",path:`${r}.inputBindings.${n}`,message:`Node '${e.id}' literal binding for '${n}' is schema-invalid: ${t.message}`,nodeId:e.id})}}"expression"!==i.mode||"string"==typeof i.expression&&i.expression.trim()||o.push({code:"binding.expression-invalid",path:`${r}.inputBindings.${n}`,message:`Node '${e.id}' expression binding for '${n}' must contain a non-empty expression`,nodeId:e.id})}}validateBindingSatisfaction(e,t,o,r,n,i={}){const a=new Set(o.filter(e=>"data"===e.type).map(e=>e.targetPort)),s=new Set(Object.entries(e.inputBindings??{}).map(([e])=>e));for(const t of a){const o=(e.inputBindings??{})[t];o&&"literal"===o.mode&&!0!==i.allowLiteralAndEdgeBindings&&r.push({code:"binding.conflict",path:`${n}.inputBindings.${t}`,message:`Node '${e.id}' input '${t}' has both an incoming edge and a literal binding`,nodeId:e.id})}for(const o of t.inputs)!0===o.required&&(a.has(o.id)||s.has(o.id)||void 0===(e.parameters??{})[o.id]&&r.push({code:"topology.required-input-unsatisfiable",path:n+".parameters",message:`Node '${e.id}' required input '${o.id}' has no incoming edge or binding`,nodeId:e.id,details:{port:o.id}}))}static disabledBehaviorOf(e,t){const o=(e.metadata??{}).disabledBehavior;if(ut(o))return o;const r=t?.disabledBehavior;return ut(r)?r:"skip"}}let jn=class extends j{constructor(e){super(e)}};function Ln(e){return[e.namespace??"default",e.workflowId,e.nodeId,e.version??"default",e.fingerprint].join(":")}function Mn(e){return new jn({id:Ln(e.key),workflowId:e.key.workflowId,nodeId:e.key.nodeId,fingerprint:e.key.fingerprint,...void 0!==e.key.namespace?{namespace:e.key.namespace}:{},...void 0!==e.key.version?{version:e.key.version}:{},pinned:e.pinned,outputs:e.outputs,createdAt:new Date(e.createdAt),updatedAt:new Date(e.updatedAt),...e.expiresAt?{expiresAt:new Date(e.expiresAt)}:{},...e.metadata?{metadata:e.metadata}:{}})}function Gn(e){return{key:{workflowId:e.workflowId,nodeId:e.nodeId,fingerprint:e.fingerprint,...void 0!==e.namespace?{namespace:e.namespace}:{},...void 0!==e.version?{version:e.version}:{}},outputs:e.outputs,pinned:e.pinned,createdAt:e.createdAt.toISOString(),updatedAt:e.updatedAt.toISOString(),...e.expiresAt?{expiresAt:e.expiresAt.toISOString()}:{},...e.metadata?{metadata:e.metadata}:{}}}k([N({type:String,generated:!1}),C("design:type",String)],jn.prototype,"id",void 0),k([T(),P(),C("design:type",String)],jn.prototype,"workflowId",void 0),k([T(),P(),C("design:type",String)],jn.prototype,"nodeId",void 0),k([T(),C("design:type",String)],jn.prototype,"fingerprint",void 0),k([T(),C("design:type",String)],jn.prototype,"namespace",void 0),k([T(),C("design:type",String)],jn.prototype,"version",void 0),k([T(),C("design:type",Boolean)],jn.prototype,"pinned",void 0),k([T(),C("design:type",Object)],jn.prototype,"outputs",void 0),k([T(),C("design:type",Date)],jn.prototype,"createdAt",void 0),k([T(),C("design:type",Date)],jn.prototype,"updatedAt",void 0),k([T(),C("design:type",Date)],jn.prototype,"expiresAt",void 0),k([T(),C("design:type",Object)],jn.prototype,"metadata",void 0),jn=k([D("graph_value"),I(),C("design:paramtypes",[Object])],jn);let Un=class extends ${constructor(e){super(e,jn,!0),this.runtimeValues=new Map}seedWorkflowInputs(e){this.runtimeValues.set(ar,{...e})}setNodeOutputs(e,t){this.runtimeValues.set(e,{...t})}getPort(e,t){return this.runtimeValues.get(e)?.[t]}hasPort(e,t){return Object.prototype.hasOwnProperty.call(this.runtimeValues.get(e)??{},t)}setWorkflowOutput(e,t){const o=this.runtimeValues.get(ar)??{};o[e]=t,this.runtimeValues.set(ar,o)}getWorkflowValues(){return{...this.runtimeValues.get(ar)??{}}}snapshot(){return Object.fromEntries(this.runtimeValues.entries())}async readCached(e,...t){try{return Gn(await this.read(Ln(e),...t))}catch{return}}async writeCached(e,t,...o){const r=Ln(e);let n;try{n=await this.read(r,...o)}catch{n=void 0}n?await this.update(Object.assign(n,Mn(t)),...o):await this.create(Mn(t),...o)}async deleteCached(e,...t){try{await this.delete(Ln(e),...t)}catch{}}async hasCached(e,...t){return void 0!==await this.readCached(e,...t)}async listCached(e,...t){return(await this.select().execute(...t)).map(e=>Gn(e)).filter(t=>((e,t)=>!(void 0!==t.workflowId&&e.workflowId!==t.workflowId||void 0!==t.nodeId&&e.nodeId!==t.nodeId||void 0!==t.namespace&&e.namespace!==t.namespace||void 0!==t.version&&e.version!==t.version||void 0!==t.fingerprint&&e.fingerprint!==t.fingerprint))(t.key,e))}async clearRun(e,...t){const o=await this.select().execute(...t);for(const e of o)await this.delete(e.id,...t)}readRuntimeValues(e){return this.runtimeValues.get(e)}writeRuntimeValues(e,t){this.runtimeValues.set(e,{...t})}getAdapter(){return this.adapter}};function $n(e){return new(0,$.forModel(jn,e.alias).constructor)(e)}Un=k([U(jn,y),C("design:paramtypes",[Function])],Un);class Fn{static upstreamNodes(e,t,o=!1){const r=new Set,n=[e];for(;n.length;){const e=n.pop(),i=t.get(e)??[];for(const e of i)!o&&this.isBoundary(e.sourceNodeId)||r.has(e.sourceNodeId)||(r.add(e.sourceNodeId),n.push(e.sourceNodeId))}return r}static downstreamNodes(e,t,o=!1){const r=new Set,n=[e];for(;n.length;){const e=n.pop(),i=t.get(e)??[];for(const e of i)!o&&this.isBoundary(e.targetNodeId)||r.has(e.targetNodeId)||(r.add(e.targetNodeId),n.push(e.targetNodeId))}return r}static isBoundary(e){return"$workflow"===e}}class Hn{constructor(e,t,o){this.store=e,this.policy=t,this.dependencyResolver=o}async pinNode(e){const t=e.plan,o=e.includeDependencies??!0?this.dependencyResolver.getPinSet(t,e.nodeId):new Set([e.nodeId]);for(const e of o){const o=t.nodes.find(t=>t.id===e);if(!o)throw new Dr(`Node '${e}' not found in plan`);if(!this.policy.canPin(o))throw new Dr(`Node '${e}' is not pinnable`,{nodeId:e})}const r=this.topologicalOrder(t,o);for(const o of r){const r=t.nodes.find(e=>e.id===o),n=e.result.nodeResults[o];if(!n||!n.outputs)throw new Dr(`Node '${o}' has no completed output to pin`);const i=n.inputs??{},a=this.dependencyFingerprints(t,o,e.result),s=this.createValueKey(e.document.id,r,i,a),d=(new Date).toISOString(),l={key:s,outputs:n.outputs,pinned:!0,createdAt:d,updatedAt:d,metadata:{...e.result.metadata,nodeId:o}};await this.store.writeCached(s,l)}}async unpinNode(e){const t={workflowId:e.document.id,nodeId:e.nodeId,fingerprint:e.fingerprint,namespace:e.namespace};await this.store.deleteCached(t)}async readPinnedValue(e,t,o,r,n){const i=this.createValueKey(e,t,o,r,n),a=await this.store.readCached(i);if(a&&a.pinned){if(a.expiresAt&&new Date(a.expiresAt)<new Date)return;return a}}createValueKey(e,t,o,r,n){return{workflowId:e,nodeId:t.id,fingerprint:this.computeFingerprint(e,t,o,r),namespace:n}}computeFingerprint(e,t,o,r){const n={workflowId:e,nodeId:t.id,nodeKind:t.kind,parameters:this.stableSerialize(t.instance.parameters??{}),inputBindings:this.stableSerialize(t.instance.inputBindings??{}),metadata:this.stableSerialize(this.relevantMetadata(t)),inputs:this.stableSerialize(o),dependencyFingerprints:this.stableSerialize(r)},i=this.stableSerialize(n);return this.simpleHash(i)}relevantMetadata(e){const t={...e.metadata??{}};return delete t.ui,delete t.position,delete t.visual,t}topologicalOrder(e,t){const o=[],r=new Set,n=i=>{if(r.has(i))return;r.add(i);const a=Fn.upstreamNodes(i,e.incomingByNode,!1);for(const e of a)t.has(e)&&n(e);o.push(i)};for(const e of t)n(e);return o}dependencyFingerprints(e,t,o){const r=this.dependencyResolver.getDependencies(e,t),n={};for(const t of r){const r=e.nodes.find(e=>e.id===t);if(r){const i=o.nodeResults[t],a=i?.inputs??{},s=this.dependencyFingerprints(e,t,o);n[t]=this.computeFingerprint(e.workflowId,r,a,s)}}return n}stableSerialize(e){return null===e||"object"!=typeof e?JSON.stringify(e):Array.isArray(e)?`[${e.map(e=>this.stableSerialize(e)).join(",")}]`:`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${this.stableSerialize(e[t])}`).join(",")}}`}simpleHash(e){let t=0;for(let o=0;o<e.length;o++)t=(t<<5)-t+e.charCodeAt(o),t|=0;return`fp_${Math.abs(t).toString(16).padStart(8,"0")}_${e.length}`}}const Bn={enabled:!0,strategy:"manual",includeDependencies:!0};function qn(e){return!0===e?.enabled&&"disabled"!==e.strategy}class Wn{canPin(e){return qn(this.getPinningMetadata(e))}shouldUsePinnedValue(e){const t=this.getPinningMetadata(e);return!0===t.enabled&&"disabled"!==t.strategy}shouldAutoPin(e){const t=this.getPinningMetadata(e);return!0===t.enabled&&"automatic"===t.strategy}getPinningMetadata(e){const t=e.manifest.metadata?.pinnable??e.metadata?.pinnable;return t?{...Bn,...t}:{...Bn,enabled:!1}}}class Kn{getDependencies(e,t){return Fn.upstreamNodes(t,e.incomingByNode,!1)}getPinSet(e,t){const o=this.getDependencies(e,t);return o.add(t),o}}class Vn{constructor(){this.local=!0,this.codeMode="hostSide",hn.register(sr,this)}async initialize(e){this.valueAdapter=e.valueAdapter,this.codeSandboxEvaluator=e.codeSandboxEvaluator,this.workflowStore=e.workflowStore,this.engine=e.engine}get capabilities(){const e=this.workflowStore?"supported":"not_supported";return{codeMode:this.codeMode,workflows:{list:e,get:e}}}async listWorkflows(...e){const t=this.workflowStore;if(!t)throw new Cr("LocalGraphExecutionBackend has no workflowStore configured; workflow listing is not supported","GRAPH_BACKEND_WORKFLOWS_NOT_SUPPORTED");return(await t.listWorkflows(...e)).map(e=>({id:e.workflowId,...void 0!==e.name?{name:e.name}:{},...void 0!==e.updatedAt&&null!==e.updatedAt?{updatedAt:e.updatedAt}:{}}))}async getWorkflow(e,...t){const o=this.workflowStore;if(!o)throw new Cr("LocalGraphExecutionBackend has no workflowStore configured; workflow lookup is not supported","GRAPH_BACKEND_WORKFLOWS_NOT_SUPPORTED");const r=await o.getDocument(e,...t);return this.engine&&this.engine.assertWorkflowReadAccess(r,(e=>en((e=>{for(let t=e.length-1;t>=0;t-=1){const o=e[t];if(!o||"object"!=typeof o)continue;const r=o;if("function"==typeof r.get&&"function"==typeof r.accumulate&&void 0!==r.cache)return o}})(e)))(t)),r}async seedWorkflows(e,...t){const o=this.workflowStore,r=o?.seedDocument??o?.saveDocument;if(!o||"function"!=typeof r)throw new Cr("LocalGraphExecutionBackend has no writable workflowStore configured; workflow seeding is not supported","GRAPH_BACKEND_SEED_NOT_SUPPORTED");const n=[];for(const i of e)null!==await r.call(o,i.id,i,...t)&&n.push({id:i.id,...void 0!==i.name?{name:i.name}:{}});return n}async execute(e){const{document:t,plan:o,inputs:r,options:n,events:i}=e,a=i,s=a.frame;if(!s)throw new Cr("LocalGraphExecutionBackend requires the frame-bound event sink created by GraphExecutionEngine","GRAPH_EXECUTION_FRAME_MISSING");const d=s.valueStore,l=s.runId,c=n.path??[],p=async e=>{await a.emit(e)};try{for(const e of o.layers)this.assertNotAborted(n),await this.executeLayer(s,o,e.nodes,n,p);this.assertNotAborted(n);const e=[...s.nodeResults.values()].find(e=>e.status===gt.FAILED);if(e?.error)throw new Cr(e.error.message,e.error.code??"GRAPH_EXECUTION_ERROR",e.error.details);return s.finish(),await a.emit({type:yt.WORKFLOW_COMPLETED,runId:l,parentRunId:n.parentRunId,workflowId:o.workflowId,path:c,status:gt.SUCCEEDED,payload:{outputs:d.getWorkflowValues()}}),pn(s,t,r,gt.SUCCEEDED,n.metadata)}catch(e){if(e instanceof Gr)throw s.finish(),e;s.finish();const i=this.toErrorPayload(e);return e instanceof Ur||!0===n.abortSignal?.aborted?(await a.emit({type:yt.WORKFLOW_CANCELLED,runId:l,parentRunId:n.parentRunId,workflowId:o.workflowId,path:c,status:gt.CANCELLED,error:i}),pn(s,t,r,gt.CANCELLED,n.metadata)):(await a.emit({type:yt.WORKFLOW_FAILED,runId:l,parentRunId:n.parentRunId,workflowId:o.workflowId,path:c,status:gt.FAILED,error:i}),pn(s,t,r,gt.FAILED,n.metadata))}}async executeLayer(e,t,o,r,n){const i=Math.max(1,r.concurrency??4),a=[...o];for(;a.length>0;){const o=a.splice(0,i);await Promise.all(o.map(o=>this.executeNode(e,t,o,r,n)))}}async executeNode(e,t,o,r,n){if(this.assertNotAborted(r),!this.isNodeActivated(e,t,o))return void await this.skipInactiveNode(e,t,o,r,n);if(!0===o.instance.disabled)return void await this.executeDisabledNode(e,t,o,r,n);const i=new Date,a=[...r.path??[],o.id];await n({type:yt.NODE_STARTED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:a,status:gt.RUNNING}),this.emitNodeStateChanged(e,t,o,a,ht.RUNNING,gt.RUNNING,n);const s=await this.resolveNodeInputs(e,t,o,r);if(r.usePinnedValues){const r=await this.tryPinnedValue(e,t,o,s);if(r){e.valueStore.setNodeOutputs(o.id,r.outputs),this.routeOutgoingEdges(e,t,o,r.outputs,n);const d=new Date,l={nodeId:o.id,status:gt.CACHED,inputs:s,outputs:r.outputs,startedAt:i,finishedAt:d,fromCache:!0,pinned:!0,events:[]};return e.recordNodeResult(l),await n({type:yt.NODE_CACHE_HIT,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:a,status:gt.CACHED,payload:{outputs:r.outputs}}),await n({type:yt.NODE_COMPLETED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:a,status:gt.SUCCEEDED,payload:{outputs:r.outputs,fromCache:!0}}),void this.emitNodeStateChanged(e,t,o,a,ht.SUCCEEDED,gt.SUCCEEDED,n)}}try{const d=new ln(e.runId,r.parentRunId,t.workflowId,t.resolved.document,o.instance,o.manifest,a,n,r.metadata,this.engine,r.abortSignal,this.executionLimits(r)),l=await this.resolveNodeParameters(o,s,r),c={nodeId:o.id,kind:o.kind,inputs:s,parameters:l,credentials:this.collectCredentials(o),metadata:o.instance.metadata},p=await this.invokeExecutor(o,c,d),u=this.validateNodeOutputs(o,p??{});e.valueStore.setNodeOutputs(o.id,u),this.routeOutgoingEdges(e,t,o,u,n);const g=new Date,h={nodeId:o.id,status:gt.SUCCEEDED,inputs:s,outputs:u,startedAt:i,finishedAt:g,events:[]};e.recordNodeResult(h),await n({type:yt.NODE_COMPLETED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:a,status:gt.SUCCEEDED,payload:{outputs:u}}),this.emitNodeStateChanged(e,t,o,a,ht.SUCCEEDED,gt.SUCCEEDED,n)}catch(d){if(d instanceof Gr)throw d;const l=new Date,c=this.toErrorPayload(d),p={nodeId:o.id,status:gt.FAILED,inputs:s,error:c,startedAt:i,finishedAt:l,events:[]};if(e.recordNodeResult(p),await n({type:yt.NODE_FAILED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:a,status:gt.FAILED,error:c}),this.emitNodeStateChanged(e,t,o,a,ht.FAILED,gt.FAILED,n),r.failFast??!0)throw d}}isNodeActivated(e,t,o){const r=(t.incomingByNode.get(o.id)??[]).filter(e=>"data"===e.type);return 0===r.length||r.some(t=>t.sourceNodeId===ar||e.isDataEdgeActive(t.id))}async skipInactiveNode(e,t,o,r,n){const i=new Date,a=[...r.path??[],o.id];await n({type:yt.NODE_SKIPPED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:a,status:gt.SKIPPED,payload:{reason:"branchNotSelected"}});const s={nodeId:o.id,status:gt.SKIPPED,inputs:{},startedAt:i,finishedAt:new Date,events:[]};e.recordNodeResult(s),this.emitNodeStateChanged(e,t,o,a,ht.SKIPPED,gt.SKIPPED,n)}async executeDisabledNode(e,t,o,r,n){const i=new Date,a=[...r.path??[],o.id],s=Dn.disabledBehaviorOf(o.instance,t.resolved.document.settings);if(await n({type:yt.NODE_SKIPPED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:a,status:gt.SKIPPED,payload:{disabled:!0,behavior:s}}),"skip"===s){const r={nodeId:o.id,status:gt.SKIPPED,inputs:{},startedAt:i,finishedAt:new Date,events:[]};return e.recordNodeResult(r),void this.emitNodeStateChanged(e,t,o,a,ht.SKIPPED,gt.SKIPPED,n)}const d=await this.resolveNodeInputs(e,t,o,r);let l;if("passThroughFirstInput"===s){const r=(t.incomingByNode.get(o.id)??[]).find(e=>"data"===e.type),n=o.manifest.outputs[0]?.id??"value",i=r?e.valueStore.getPort(r.sourceNodeId,r.sourcePort):Object.values(d)[0];l={[n]:i}}else{l={};for(const e of o.manifest.outputs)l[e.id]=e.metadata?.defaultValue}e.valueStore.setNodeOutputs(o.id,l),this.routeOutgoingEdges(e,t,o,l,n);const c={nodeId:o.id,status:gt.SUCCEEDED,inputs:d,outputs:l,startedAt:i,finishedAt:new Date,events:[]};e.recordNodeResult(c),this.emitNodeStateChanged(e,t,o,a,ht.SUCCEEDED,gt.SUCCEEDED,n)}async invokeExecutor(e,t,o){if((r=e.kind)===On||r.startsWith(On+"."))throw new Cr(`Node '${e.id}' of kind '${e.kind}' requires the mastra engine, which the local backend does not provide`,dr,{nodeId:e.id,kind:e.kind,backend:sr});var r;return await e.executor.execute(t,o)}validateNodeOutputs(e,t){const o=e.manifest;if(!0===o.policies?.allowUnknownOutputs)return t;const r=new Set(o.outputs.map(e=>e.id)),n=Object.keys(t).filter(e=>!r.has(e));if(n.length>0)throw new Cr(`Node '${e.id}' of kind '${e.kind}' produced unknown output(s): ${n.join(", ")}`,"GRAPH_OUTPUT_VALIDATION_FAILED",{nodeId:e.id,unknownOutputs:n});const i=o.outputs.filter(e=>!0===e.required&&!(e.id in t)).map(e=>e.id);if(i.length>0)throw new Cr(`Node '${e.id}' of kind '${e.kind}' did not produce required output(s): ${i.join(", ")}`,"GRAPH_OUTPUT_VALIDATION_FAILED",{nodeId:e.id,missingRequired:i});return t}collectCredentials(e){const t={};for(const o of e.manifest.parameters){if("credential"!==o.type)continue;const r=(e.instance.parameters??{})[o.id];"string"==typeof r&&r.length>0?t[o.id]={credentialId:r,credentialType:o.credentialType??""}:Nn(r)&&(t[o.id]={credentialId:r.credentialId,credentialType:r.credentialType})}const o=(e.instance.metadata??{}).credentials;if(o&&"object"==typeof o&&!Array.isArray(o))for(const[e,r]of Object.entries(o)){const o=r;"string"==typeof o&&o.length>0?t[e]={credentialId:o,credentialType:""}:Nn(o)&&(t[e]={credentialId:o.credentialId,credentialType:o.credentialType})}return t}async resolveNodeInputs(e,t,o,r){const n={},i=(t.incomingByNode.get(o.id)??[]).filter(e=>"data"===e.type),a=new Map;for(const e of i){const t=a.get(e.targetPort)??[];t.push(e),a.set(e.targetPort,t)}for(const[t,o]of a)if(1===o.length)n[t]=e.valueStore.getPort(o[0].sourceNodeId,o[0].sourcePort);else{let r,i=!1;for(const t of o){const o=e.valueStore.getPort(t.sourceNodeId,t.sourcePort);n[t.sourcePort]=o,void 0!==o&&(r=o,i=!0)}i&&void 0===n[t]&&(n[t]=r)}const s=o.instance.inputBindings??{};for(const e of o.manifest.inputs){const t=s[e.id];if("literal"===t?.mode)n[e.id]=t.value;else if("expression"===t?.mode)n[e.id]=await this.evaluateExpressionBinding(o,t.expression,n,r);else if(void 0===n[e.id]){const t=e.metadata?.defaultValue;void 0!==t&&(n[e.id]=t)}}return n}async resolveNodeParameters(e,t,o){const r=e.instance.parameters??{},n={};for(const[i,a]of Object.entries(r))n[i]=Io(a)?await this.evaluateValueTemplate(a,e,t,o):a;return n}async evaluateValueTemplate(e,t,o,r){const n=this.codeSandboxEvaluator;if(!n)throw new Cr(`Value template on node '${t.id}' requires a CodeSandboxEvaluator to be registered in GraphExecutionEngineConfig.codeSandboxEvaluator`,"GRAPH_CODE_SANDBOX_NOT_CONFIGURED",{nodeId:t.id});const i=e.language??("expression"===e.mode?"javascript":"text"),a="template"===e.mode?(e=>`\`${e.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\{\{\s*([\s\S]*?)\s*\}\}/g,(e,t)=>`\${${t}}`)}\``)(e.expression):e.expression,s=r.metadata;return await n.evaluate({code:a,language:"typescript"===i?"typescript":"javascript",input:o,vars:s?.vars??void 0,item:s?.item,index:s?.index,abortSignal:r.abortSignal})}async evaluateExpressionBinding(e,t,o,r){const n=this.codeSandboxEvaluator;if(!n)throw new Cr(`Expression binding on node '${e.id}' requires a CodeSandboxEvaluator to be registered in GraphExecutionEngineConfig.codeSandboxEvaluator`,"GRAPH_CODE_SANDBOX_NOT_CONFIGURED",{nodeId:e.id,expression:t});const i=r.metadata;return await n.evaluate({code:t,language:"javascript",input:o,vars:i?.vars??void 0,item:i?.item,index:i?.index,abortSignal:r.abortSignal})}async tryPinnedValue(e,t,o,r){if(!(new Wn).shouldUsePinnedValue(o))return;const n=this.createPinningService(e),i=this.computeDependencyFingerprints(e,t,o.id);return n.readPinnedValue(t.workflowId,o,r,i)}computeDependencyFingerprints(e,t,o){const r=this.createPinningService(e),n=(new Kn).getDependencies(t,o),i={};for(const o of n){const n=t.nodes.find(e=>e.id===o);if(n){const a=e.nodeResults.get(o),s=a?.inputs??{},d=this.computeDependencyFingerprints(e,t,o);i[o]=r.computeFingerprint(t.workflowId,n,s,d)}}return i}routeOutgoingEdges(e,t,o,r,n){const i=(t.outgoingByNode.get(o.id)??[]).filter(e=>"data"===e.type);for(const a of i){if(!Object.prototype.hasOwnProperty.call(r,a.sourcePort))continue;const i=r[a.sourcePort];e.activateDataEdge(a.id),a.targetNodeId===ar&&e.valueStore.setWorkflowOutput(a.targetPort,i),this.emitEdgeStateChanged(e,t,o,a,ht.SUCCEEDED,gt.SUCCEEDED,n),n({type:yt.EDGE_VALUE_ROUTED,runId:e.runId,workflowId:t.workflowId,edgeId:a.id,nodeId:o.id,path:[],payload:{edge:a,value:i}}).catch(()=>{})}}emitNodeStateChanged(e,t,o,r,n,i,a){a({type:yt.NODE_STATE_CHANGED,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,path:r,status:i,payload:{nodeId:o.id,state:n,runId:e.runId,workflowId:t.workflowId,status:i}}).catch(()=>{})}emitEdgeStateChanged(e,t,o,r,n,i,a){a({type:yt.EDGE_STATE_CHANGED,runId:e.runId,workflowId:t.workflowId,edgeId:r.id,nodeId:o.id,path:[],status:i,payload:{edgeId:r.id,state:n,runId:e.runId,workflowId:t.workflowId,nodeId:o.id,status:i}}).catch(()=>{})}createPinningService(e){const t=$n(e.valueStore.getAdapter()??this.valueAdapter);return new Hn(t,new Wn,new Kn)}executionLimits(e){return{maxLoopIterations:e.maxLoopIterations??ur,maxForeachIterations:e.maxForeachIterations??gr}}assertNotAborted(e){if(!0===e.abortSignal?.aborted)throw new Ur(e.runId??"unknown")}toErrorPayload(e){return e instanceof Error?{name:e.name,message:e.message,stack:e.stack,code:e.graphCode??("number"==typeof e.code?e.code+"":e.code)}:{name:"UnknownError",message:e+""}}}const zn={execute:()=>{throw new Cr("A deployment-projection node cannot be executed by the facade; the backend must bind and run the authoritative deployment artifact","GRAPH_DEPLOYMENT_PROJECTION_NOT_EXECUTABLE")}};function Qn(e){return{kind:e,display:{name:e},inputs:[],outputs:[],parameters:[],policies:{allowUndeclaredParameters:!0,allowUnknownOutputs:!0}}}class Jn{constructor(e,t={}){this.catalogue=e,this.options=t}async resolveNodes(e,t,o,...r){const n=new Map;for(const[i,a]of e.entries()){const e=`nodes[${i}]`;if(this.catalogue.has(a.kind,...r))try{const e=await this.catalogue.resolveManifest(a.kind,a,o,...r),t=this.catalogue.getExecutor(a.kind,...r);n.set(a.id,{instance:a,manifest:e,executor:t})}catch(o){t.push({code:"kind.resolution-failed",path:e+".kind",message:`Node '${a.id}' kind '${a.kind}' failed to resolve: ${o.message}`,nodeId:a.id,details:{kind:a.kind}})}else{if(!0===this.options.deploymentProjection){n.set(a.id,{instance:a,manifest:Qn(a.kind),executor:zn});continue}t.push({code:"kind.unknown",path:e+".kind",message:`Node '${a.id}' references kind '${a.kind}' which is not registered in the backend catalogue`,nodeId:a.id,details:{kind:a.kind}})}}return n}validateEffectivePorts(e,t,o,r){const n=!0===t.policies?.allowUndeclaredParameters,i=new Set(t.inputs.map(e=>e.id)),a=new Set(t.outputs.map(e=>e.id));for(const a of Object.keys(e.inputBindings??{}))n||i.has(a)||o.push({code:"binding.unknown-port",path:`${r}.inputBindings.${a}`,message:`Node '${e.id}' input binding '${a}' does not refer to an effective input port of kind '${t.kind}'`,nodeId:e.id,details:{effectiveInputs:[...i]}});for(const i of Object.keys(e.outputBindings??{}))n||a.has(i)||o.push({code:"binding.unknown-port",path:`${r}.outputBindings.${i}`,message:`Node '${e.id}' output binding '${i}' does not refer to an effective output port of kind '${t.kind}'`,nodeId:e.id,details:{effectiveOutputs:[...a]}})}}function Xn(e,t,o="$"){const r=new Set;for(const t of e.edges)"node"===t.source.scope&&r.add(t.source.nodeId),"node"===t.target.scope&&r.add(t.target.nodeId);for(const n of e.nodes){r.has(n.id)||t.push({code:"topology.loose-node",path:`${o}.nodes[${n.id}]`,message:`Node '${n.id}' is connected to nothing; every node must participate in at least one edge`,nodeId:n.id});const e=n.loop?.body;e&&Xn(e,t,`${o}.nodes[${n.id}].loop.body`)}}class Yn{resolveEdges(e,t,o){const r=new Set(e.inputs.map(e=>e.id)),n=new Set(e.outputs.map(e=>e.id)),i=[];for(const[a,s]of(e.edges??[]).entries()){const e=`edges[${a}]`,d=this.resolveEndpoint(s,"source",t,r,n,o,e),l=this.resolveEndpoint(s,"target",t,r,n,o,e);if(!d||!l)continue;if(!this.validateDirectionAndType(s,d,l,t,o,e))continue;const c={id:s.id,type:s.type,sourceNodeId:d.nodeId,sourcePort:d.port,targetNodeId:l.nodeId,targetPort:l.port,metadata:s.metadata,edge:s};void 0!==s.label&&(c.label=s.label),i.push(c)}return i}resolveEndpoint(e,t,o,r,n,i,a){const s=e[t];return ao(s)?("source"===t?r.has(s.port):n.has(s.port))?{nodeId:ar,port:s.port}:void i.push({code:"edge.unknown-port",path:`${a}.${t}`,message:`Edge '${e.id}' ${t} references workflow port '${s.port}' which is not declared on the document boundary`,edgeId:e.id,details:{scope:"workflow",port:s.port}}):so(s)?o.get(s.nodeId)?{nodeId:s.nodeId,port:s.port}:void i.push({code:"edge.unknown-node",path:`${a}.${t}`,message:`Edge '${e.id}' ${t} references node '${s.nodeId}' which is not part of the document or did not resolve`,edgeId:e.id,nodeId:s.nodeId}):void i.push({code:"edge.invalid-endpoint",path:`${a}.${t}`,message:`Edge '${e.id}' ${t} endpoint is not a valid GraphEndpoint`,edgeId:e.id})}validateDirectionAndType(e,t,o,r,n,i){let a=!0;const s=t.nodeId===ar?void 0:r.get(t.nodeId),d=o.nodeId===ar?void 0:r.get(o.nodeId),l=e=>!0===e?.manifest.policies?.allowUndeclaredParameters;if("data"===e.type)!s||l(s)||this.hasPortDirection(s,t.port,"output")||(this.pushPortIssue(e,"source",t,s,n,i),a=!1),!d||l(d)||this.hasPortDirection(d,o.port,"input")||(this.pushPortIssue(e,"target",o,d,n,i),a=!1);else{if(!s||!d)return n.push({code:"edge.boundary-routing",path:i,message:`Connection edge '${e.id}' must connect two node connection ports; the workflow boundary only routes data`,edgeId:e.id}),!1;if(!(l(s)||l(d)||this.hasPortDirection(s,t.port,"connection")&&this.hasPortDirection(d,o.port,"connection")))return n.push({code:"edge.type-mismatch",path:i,message:`Connection edge '${e.id}' endpoints must both be connection ports`,edgeId:e.id,details:{sourcePort:t.port,targetPort:o.port}}),!1}return a}hasPortDirection(e,t,o){return("input"===o?e.manifest.inputs:"output"===o?e.manifest.outputs:e.manifest.connections??[]).some(e=>e.id===t)}pushPortIssue(e,t,o,r,n,i){const a="source"===t?"output":"input";n.push({code:"data"===e.type?"edge.invalid-direction":"edge.type-mismatch",path:`${i}.${t}`,message:`Edge '${e.id}' ${t} port '${o.port}' on node '${o.nodeId}' is not an ${a} port of kind '${r.manifest.kind}'`,edgeId:e.id,nodeId:o.nodeId,details:{port:o.port,expected:a}})}}class Zn{validate(e,t){this.validateDuplicates(e.edges,t),this.validatePolicies(e,t)}validateDuplicates(e,t){const o=new Map;for(const r of e){const e=`${r.sourceNodeId}:${r.sourcePort}->${r.targetNodeId}:${r.targetPort}`,n=o.get(e);n?t.push({code:"connection.duplicate-edge",path:`edges[${r.id}]`,message:`Edge '${r.id}' duplicates the routing of edge '${n.id}' (${e})`,edgeId:r.id,details:{duplicateOf:n.id,routing:e}}):o.set(e,r)}}validatePolicies(e,t){const o=new Map;for(const t of e.edges){if("connection"!==t.type)continue;const e=`${t.targetNodeId}:${t.targetPort}`,r=o.get(e)??[];r.push(t),o.set(e,r)}for(const o of e.edges){if("connection"!==o.type)continue;const r=e.nodeById.get(o.targetNodeId),n=r?.manifest.connections?.find(e=>e.id===o.targetPort)?.connectionPolicy;this.validateEdgePolicy(o,e.nodeById,n,t),this.validateCategoryMatch(o,e.nodeById,t)}for(const[r,n]of o){const o=r.lastIndexOf(":"),i=r.slice(0,o),a=r.slice(o+1),s=e.nodeById.get(i),d=s?.manifest.connections?.find(e=>e.id===a)?.connectionPolicy;if(!d)continue;const l=void 0!==d.maxConnections?d.maxConnections:!1===d.allowMultiple?1:1/0;n.length>l&&t.push({code:"connection.max-connections",path:`edges[${n[n.length-1].id}]`,message:`Connection port '${a}' on node '${i}' accepts at most ${l} connection(s) but has ${n.length}`,nodeId:i,edgeId:n[n.length-1].id,details:{port:a,max:l,actual:n.length}})}}validateCategoryMatch(e,t,o){const r=t.get(e.sourceNodeId),n=t.get(e.targetNodeId),i=r?.manifest.connections?.find(t=>t.id===e.sourcePort)?.category,a=n?.manifest.connections?.find(t=>t.id===e.targetPort)?.category;i&&a&&i!==a&&o.push({code:"connection.category-mismatch",path:`edges[${e.id}]`,message:`Connection edge '${e.id}' joins source port '${e.sourcePort}' (category '${i}') to target port '${e.targetPort}' (category '${a}'); connection categories must match`,edgeId:e.id,nodeId:e.sourceNodeId,details:{sourceCategory:i,targetCategory:a}})}validateEdgePolicy(e,t,o,r){if(e.sourceNodeId===e.targetNodeId&&!o?.allowSelf)return void r.push({code:"connection.self-connection",path:`edges[${e.id}]`,message:`Edge '${e.id}' connects node '${e.sourceNodeId}' to itself, which the target port policy does not allow`,edgeId:e.id,nodeId:e.sourceNodeId});if(!o)return;const n=t.get(e.sourceNodeId),i=n?.manifest.kind;if(!o.allowedNodeKinds?.length||i&&o.allowedNodeKinds.includes(i)||r.push({code:"connection.policy",path:`edges[${e.id}]`,message:`Connection edge '${e.id}' source kind '${i??"unknown"}' is not in the allowed node kinds of target port '${e.targetPort}'`,edgeId:e.id,nodeId:e.sourceNodeId,details:{allowedNodeKinds:o.allowedNodeKinds}}),i&&o.blockedNodeKinds?.includes(i)&&r.push({code:"connection.policy",path:`edges[${e.id}]`,message:`Connection edge '${e.id}' source kind '${i}' is blocked by target port '${e.targetPort}'`,edgeId:e.id,nodeId:e.sourceNodeId,details:{blockedNodeKinds:o.blockedNodeKinds}}),o.allowedPortCategories?.length){const t=n?.manifest.connections?.find(t=>t.id===e.sourcePort)?.category;t&&o.allowedPortCategories.includes(t)||r.push({code:"connection.policy",path:`edges[${e.id}]`,message:`Connection edge '${e.id}' source port '${e.sourcePort}' category '${t??"unknown"}' is not in the allowed port categories of target port '${e.targetPort}'`,edgeId:e.id,nodeId:e.sourceNodeId,details:{allowedPortCategories:o.allowedPortCategories}})}}}class ei{constructor(e){this.authorizer=e}async validate(e,t,o,r){const n=this.collectReferences(e,t);for(const i of t.credentials??[]){const a=n.find(e=>void 0===e.credentialType||e.credentialType===i.type);if(a){if(this.checkType(a,i))o.push({code:"credential.type-mismatch",path:r,message:`Node '${e.id}' credential '${a.credentialId}' has type '${a.credentialType}' but kind '${t.kind}' requires '${i.type}'`,nodeId:e.id,details:{credentialType:a.credentialType??"",requiredType:i.type}});else if(this.authorizer){if(!await this.authorizer.hasCredential(a)){o.push({code:"credential.not-found",path:r,message:`Node '${e.id}' references credential '${a.credentialId}' which does not exist`,nodeId:e.id,details:{credentialId:a.credentialId}});continue}await this.authorizer.authorize(a,i)||o.push({code:"credential.unauthorized",path:r,message:`Node '${e.id}' is not authorized to use credential '${a.credentialId}'`,nodeId:e.id,details:{credentialId:a.credentialId}})}}else!1!==i.required&&o.push({code:"credential.missing",path:r,message:`Node '${e.id}' does not provide the required credential of type '${i.type}'`,nodeId:e.id,details:{credentialType:i.type}})}this.scanPlainSecrets(e,o,r)}collectReferences(e,t){const o=[];for(const r of t.parameters){if("credential"!==r.type)continue;const t=(e.parameters??{})[r.id];Nn(t)&&o.push(this.normalize(t,r.credentialType))}const r=(e.metadata??{}).credentials;if(r&&"object"==typeof r&&!Array.isArray(r))for(const e of Object.values(r))Nn(e)&&o.push(this.normalize(e));return o}normalize(e,t){return"string"==typeof e?{credentialId:e,credentialType:t??""}:{credentialId:e.credentialId,credentialType:e.credentialType??t??""}}checkType(e,t){return void 0!==e.credentialType&&e.credentialType!==t.type}scanPlainSecrets(e,t,o){const r=new Set(Pn.map(e=>e.toLowerCase()));for(const[n,i]of Object.entries(e.parameters??{}))this.scanPlainSecretValue(i,[n],e,o+".parameters",r,t);for(const[n,i]of Object.entries(e.metadata??{}))this.scanPlainSecretValue(i,[n],e,o+".metadata",r,t)}scanPlainSecretValue(e,t,o,r,n,i,a=0){const s=t[t.length-1];if(n.has(s.toLowerCase()))i.push({code:"credential.plain-secret",path:`${r}.${t.join(".")}`,message:`Node '${o.id}' carries plain secret material in '${t.join(".")}'; workflow documents may only hold credential references`,nodeId:o.id});else if(8>a&&null!==e)if(Array.isArray(e))for(const s of e)this.scanPlainSecretValue(s,[...t,"[]"],o,r,n,i,a+1);else if("object"==typeof e)for(const[s,d]of Object.entries(e))this.scanPlainSecretValue(d,[...t,s],o,r,n,i,a+1)}}class ti extends S{constructor(e,t=[]){super(e),this.issues=t,this.name=ti.name}}class oi extends S{constructor(e,t){super(e),this.edgeId=t,this.name=oi.name}}class ri extends F{constructor(e){super(e),this.name=ri.name}}const ni={maxDocumentBytes:2e6,maxNestingDepth:10,maxNodes:500,maxEdges:1e3},ii=["node","definition","executor","execute","ports","component"];function ai(e){if(!e||"object"!=typeof e)return!1;const t=e;return _o(t.document)&&Array.isArray(t.nodes)&&Array.isArray(t.edges)&&t.nodeById instanceof Map&&t.incomingByNode instanceof Map&&t.outgoingByNode instanceof Map&&t.nodes.every(e=>null!==e&&"object"==typeof e&&"object"==typeof e.instance&&"object"==typeof e.manifest&&"object"==typeof e.executor)}function si(e,t){const o=[];for(const r of Object.keys(e))ii.includes(r)&&o.push({code:"document.forbidden-field",path:`${t}.${r}`,message:`Field '${r}' is not accepted in a canonical workflow document: node, definition, executor, execute, ports and component fields are rejected`,details:{field:r}});return o}class di{constructor(e){this.options=e,this.parameterValidator=new Dn,this.edgeValidator=new Yn,this.connectionPolicyValidator=new Zn,this.nodeValidator=new Jn(e.catalogue,{deploymentProjection:!0===e.deploymentProjection}),this.credentialValidator=new ei(e.credentialAuthorizer)}async validateOrThrow(e,...t){const o=await this.validate(e,0,...t);if(!o.valid||!o.resolved)throw new ti(`Graph workflow document '${e.id}' failed validation with ${o.issues.length} issue(s)`,o.issues);return o.resolved}async validate(e,t=0,...o){const r=[],n={...ni,...this.options.limits};if(!await this.validateStructure(e,n,t,r,...o))return{valid:!1,issues:r};const i=await this.nodeValidator.resolveNodes(e.nodes,r,this.options.resolutionContext,...o),a=e.nodes.filter(e=>i.has(e.id)).map(e=>i.get(e.id)),s=(e=>{const t=new Map;for(const o of e.edges??[]){if("data"!==o.type)continue;const e=o.target;if("node"!==e.scope)continue;const r=t.get(e.nodeId)??new Set;r.add(e.port),t.set(e.nodeId,r)}return t})(e);for(const e of a)this.parameterValidator.validate(e.instance,e.manifest,r,`nodes[${e.instance.id}]`,s.get(e.instance.id));for(const e of a)this.nodeValidator.validateEffectivePorts(e.instance,e.manifest,r,`nodes[${e.instance.id}]`);const d=this.edgeValidator.resolveEdges(e,i,r),l=new Map,c=new Map;for(const e of d){if(e.targetNodeId!==ar){const t=l.get(e.targetNodeId)??[];t.push(e),l.set(e.targetNodeId,t)}if(e.sourceNodeId!==ar){const t=c.get(e.sourceNodeId)??[];t.push(e),c.set(e.sourceNodeId,t)}}this.connectionPolicyValidator.validate({edges:d,nodeById:i},r),this.validateAcyclicity(a,d,e,r),!0!==this.options.deploymentProjection&&Xn(e,r);for(const e of a)this.parameterValidator.validateBindingSatisfaction(e.instance,e.manifest,l.get(e.instance.id)??[],r,`nodes[${e.instance.id}]`,{allowLiteralAndEdgeBindings:this.options.allowLiteralAndEdgeBindings});this.validateRequiredWorkflowOutputs(e,c,r);for(const e of a)await this.credentialValidator.validate(e.instance,e.manifest,r,`nodes[${e.instance.id}]`);return this.validateCapabilities(a,r),r.length>0?{valid:!1,issues:r}:{valid:!0,issues:r,resolved:{document:e,nodes:a,edges:d,nodeById:i,incomingByNode:l,outgoingByNode:c}}}async validateStructure(e,t,o,r,...n){if(!_o(e))return r.push({code:"document.shape",path:"$",message:"Payload is not a canonical GraphWorkflowDocument: id and name must be strings and inputs, outputs, nodes and edges must be arrays"}),!1;if(e.id&&e.id.trim()||r.push({code:"document.empty-id",path:"$.id",message:"Workflow document id must be a non-empty string"}),!Vt(e))return r.push({code:"document.json-unsafe",path:"$",message:"Document contains JSON-unsafe values: functions, class instances, undefined, NaN/Infinity, symbol keys and unsafe prototype keys are rejected"}),!1;r.push(...si(e,"$"));for(const t of[...e.inputs,...e.outputs])r.push(...si(t,"ports"));for(const t of e.nodes)r.push(...si(t,`nodes[${t.id}]`));for(const t of e.edges)r.push(...si(t,`edges[${t.id}]`));this.validateUniqueIds(e,r),this.validateLimits(e,t,o,r);try{go(e)}catch(e){r.push({code:"document.structure",path:"$",message:e instanceof Error?e.message:e+""})}return await this.validateNestedBodies(e,o,r,...n),!0}validateUniqueIds(e,t){const o=new Set,r=new Set;for(const[n,i]of[["input",e.inputs],["output",e.outputs]]){const e="input"===n?o:r;for(const o of i)e.has(o.id)?t.push({code:"document.duplicate-port-id",path:`${"input"===n?"inputs":"outputs"}[${o.id}]`,message:`Workflow ${n} port '${o.id}' is declared more than once; workflow port ids must be unique`}):e.add(o.id)}const n=new Set;for(const o of e.nodes)n.has(o.id)?t.push({code:"document.duplicate-node-id",path:`nodes[${o.id}]`,message:`Node '${o.id}' is declared more than once; node ids must be unique`,nodeId:o.id}):n.add(o.id);const i=new Set;for(const o of e.edges)i.has(o.id)?t.push({code:"document.duplicate-edge-id",path:`edges[${o.id}]`,message:`Edge '${o.id}' is declared more than once; edge ids must be unique`,edgeId:o.id}):i.add(o.id)}validateLimits(e,t,o,r){e.nodes.length>t.maxNodes&&r.push({code:"document.limit.nodes",path:"$.nodes",message:`Document declares ${e.nodes.length} nodes; at most ${t.maxNodes} are allowed`,details:{count:e.nodes.length,limit:t.maxNodes}}),e.edges.length>t.maxEdges&&r.push({code:"document.limit.edges",path:"$.edges",message:`Document declares ${e.edges.length} edges; at most ${t.maxEdges} are allowed`,details:{count:e.edges.length,limit:t.maxEdges}}),o>t.maxNestingDepth&&r.push({code:"document.limit.depth",path:"$",message:`Document nests loop bodies ${o} levels deep; at most ${t.maxNestingDepth} levels are allowed`,details:{depth:o,limit:t.maxNestingDepth}});const n=Buffer.byteLength(JSON.stringify(e),"utf8");n>t.maxDocumentBytes&&r.push({code:"document.limit.size",path:"$",message:`Document serializes to ${n} bytes; at most ${t.maxDocumentBytes} bytes are allowed`,details:{bytes:n,limit:t.maxDocumentBytes}})}async validateNestedBodies(e,t,o,...r){for(const n of e.nodes){const e=[["loop.body",n.loop?.body],["errorBoundary.try",n.errorBoundary?.try],["errorBoundary.catch",n.errorBoundary?.catch],["errorBoundary.finally",n.errorBoundary?.finally]];for(const[i,a]of e){if(!a)continue;const e=await this.validate(a,t+1,...r);for(const t of e.issues)o.push({...t,path:`nodes[${n.id}].${i}.${t.path}`,nodeId:t.nodeId??n.id})}}}validateAcyclicity(e,t,o,r){const n=new Set(e.map(e=>e.instance.id)),i=new Map(e.map(e=>[e.instance.id,0]));for(const e of t)n.has(e.sourceNodeId)&&i.has(e.targetNodeId)&&i.set(e.targetNodeId,(i.get(e.targetNodeId)??0)+1);const a=[...i.entries()].filter(([,e])=>0===e).map(([e])=>e),s=[];for(;a.length>0;){const e=a.shift();s.push(e);for(const o of t){if(o.sourceNodeId!==e)continue;if(!i.has(o.targetNodeId))continue;const t=(i.get(o.targetNodeId)??1)-1;i.set(o.targetNodeId,t),0===t&&a.push(o.targetNodeId)}}if(s.length!==i.size){const e=[...i.keys()].filter(e=>!s.includes(e));r.push({code:"topology.cycle",path:"$.edges",message:`Workflow '${o.id}' contains an unsupported cycle involving node(s): ${e.join(", ")}`,details:{cyclicNodes:e}})}}validateRequiredWorkflowOutputs(e,t,o){const r=new Set;for(const e of t.values())for(const t of e)t.targetNodeId===ar&&r.add(t.targetPort);for(const t of e.outputs)!0===t.required&&void 0===t.defaultValue&&(r.has(t.id)||o.push({code:"topology.required-output-unsatisfiable",path:`outputs[${t.id}]`,message:`Required workflow output '${t.id}' has no incoming edge from any node`}))}validateCapabilities(e,t){for(const o of e){const e=o.manifest;for(const r of e.capabilities??[])So(r)||t.push({code:"capability.invalid",path:`nodes[${o.instance.id}]`,message:`Kind '${e.kind}' declares unknown capability '${r+""}'`,nodeId:o.instance.id,details:{capability:r+""}});!0!==e.policies?.allowUndeclaredParameters&&o.instance.loop&&((e.capabilities??[]).includes("loop")||t.push({code:"capability.loop-not-supported",path:`nodes[${o.instance.id}].loop`,message:`Node '${o.instance.id}' carries loop configuration but kind '${e.kind}' does not declare the 'loop' capability`,nodeId:o.instance.id}))}}}let li=class extends B{constructor(){super()}async plan(e,...t){const{log:o}=(await this.logCtx(t,"plan",!0)).for(this.plan);if(o.debug(`Planning resolved workflow '${e?.document?.id??"unknown"}'`),!ai(e))throw new Mr("GraphExecutionPlanner.plan accepts only a GraphResolvedWorkflow produced by the nine-stage validation gate; raw workflow definitions and inline node definitions are rejected",{received:(r=e,r&&"object"==typeof r?{reason:"input is not a GraphResolvedWorkflow",looksLikeWorkflowDefinition:"nodes"in r&&"relations"in r&&!("nodeById"in r),hasResolvedNodes:Array.isArray(r.nodes)}:{reason:"input is not an object"})});var r;const n=this.buildPlanNodes(e),i=this.buildPlanEdges(e),a=this.buildIncomingMap(i),s=this.buildOutgoingMap(i),d=this.topologicalLayers(n,i);return{resolved:e,workflowId:e.document.id||e.document.name,nodes:n,edges:i,layers:d,incomingByNode:a,outgoingByNode:s}}buildPlanNodes(e){return e.nodes.map(e=>({id:e.instance.id,kind:e.manifest.kind,instance:e.instance,manifest:e.manifest,executor:e.executor,inputPorts:e.manifest.inputs.map(e=>e.id),outputPorts:e.manifest.outputs.map(e=>e.id),connectionPorts:(e.manifest.connections??[]).map(e=>e.id),metadata:e.instance.metadata}))}buildPlanEdges(e){return e.edges.map(e=>({id:e.id,type:e.type,sourceNodeId:e.sourceNodeId,sourcePort:e.sourcePort,targetNodeId:e.targetNodeId,targetPort:e.targetPort,...void 0!==e.label?{label:e.label}:{},metadata:e.metadata}))}buildIncomingMap(e){const t=new Map;for(const o of e){if(o.targetNodeId===ar)continue;const e=t.get(o.targetNodeId)??[];e.push(o),t.set(o.targetNodeId,e)}return t}buildOutgoingMap(e){const t=new Map;for(const o of e){if(o.sourceNodeId===ar)continue;const e=t.get(o.sourceNodeId)??[];e.push(o),t.set(o.sourceNodeId,e)}return t}topologicalLayers(e,t){const o=e.filter(e=>e.id!==ar),r=new Set(o.map(e=>e.id)),n=t.filter(e=>r.has(e.sourceNodeId)&&r.has(e.targetNodeId)),i=new Map;for(const e of o)i.set(e.id,0);for(const e of n)i.set(e.targetNodeId,(i.get(e.targetNodeId)??0)+1);const a=[],s=new Set;let d=o.filter(e=>0===(i.get(e.id)??0)),l=0;for(;d.length>0;){const e={index:l++,nodes:d};a.push(e);const t=[];for(const e of d){s.add(e.id);const r=n.filter(t=>t.sourceNodeId===e.id);for(const e of r){const r=(i.get(e.targetNodeId)??1)-1;if(i.set(e.targetNodeId,r),0===r&&!s.has(e.targetNodeId)){const r=o.find(t=>t.id===e.targetNodeId);r&&t.push(r)}}}d=t}if(s.size!==o.length){const e=o.filter(e=>!s.has(e.id)).map(e=>e.id);throw new Nr({unplannedNodes:e,workflowId:o[0]?.manifest.kind})}return a}};li=k([H(),C("design:paramtypes",[])],li);class ci{constructor(){this.pending=new Map}register(e,t){return this.cancel(e),new Promise((o,r)=>{const n={resolve:o};void 0!==t&&Number.isFinite(t)&&t>0&&(n.timer=setTimeout(()=>{this.pending.delete(e),r(new Cr(`No webhook response was produced for run '${e}' within ${t}ms`,"GRAPH_WEBHOOK_RESPONSE_TIMEOUT",{runId:e,timeoutMs:t}))},t),n.timer.unref?.()),this.pending.set(e,n)})}has(e){return this.pending.has(e)}deliver(e,t){const o=this.pending.get(e);return!!o&&(o.timer&&clearTimeout(o.timer),this.pending.delete(e),o.resolve(t),!0)}cancel(e){const t=this.pending.get(e);t&&(t.timer&&clearTimeout(t.timer),this.pending.delete(e))}clear(){for(const e of[...this.pending.keys()])this.cancel(e)}}let pi=class extends j{constructor(e){super(e)}};k([N({type:String,generated:!1}),C("design:type",String)],pi.prototype,"id",void 0),k([T(),P(),C("design:type",String)],pi.prototype,"tableName",void 0),k([T(),P(),C("design:type",String)],pi.prototype,"rowId",void 0),k([T(),C("design:type",Object)],pi.prototype,"data",void 0),k([T(),C("design:type",Date)],pi.prototype,"createdAt",void 0),k([T(),C("design:type",Date)],pi.prototype,"updatedAt",void 0),pi=k([D("graph_data_table"),I(),C("design:paramtypes",[Object])],pi);const ui=/^[A-Za-z0-9_.-]+$/;function gi(e,t){return`${e}:${t}`}function hi(e){if(!e||e.length>128||!ui.test(e))throw new Cr(`Data table name '${e}' is invalid`,"GRAPH_DATA_TABLE_INVALID_NAME",{tableName:e})}function fi(e){if(!e||e.length>256)throw new Cr(`Data table row id '${e}' is invalid`,"GRAPH_DATA_TABLE_INVALID_ROW_ID",{rowId:e})}function yi(e){let t;try{t=JSON.stringify(e)}catch{throw new Cr("Data table row payload is not JSON-serializable","GRAPH_DATA_TABLE_ROW_TOO_LARGE",{limitBytes:Er})}if(void 0===t)throw new Cr("Data table row payload is not JSON-serializable","GRAPH_DATA_TABLE_ROW_TOO_LARGE",{limitBytes:Er});const o=Buffer.byteLength(t,"utf8");if(o>Er)throw new Cr("Data table row payload exceeds the 1048576-byte limit","GRAPH_DATA_TABLE_ROW_TOO_LARGE",{bytes:o,limitBytes:Er})}function mi(e){return{...e.data,id:e.rowId}}let bi=class extends ${constructor(e){super(e,pi,!0)}async insertRow(e,t,o,...r){hi(e),fi(t),yi(o),await this.assertRowCapacity(e,...r);const n=new Date,i=new pi({id:gi(e,t),tableName:e,rowId:t,data:{...o},createdAt:n,updatedAt:n});return mi(await this.create(i,...r))}async upsertRow(e,t,o,...r){if(hi(e),fi(t),yi(o),!await this.readRow(e,t,...r))return this.insertRow(e,t,o,...r);const n=await this.read(gi(e,t),...r);return n.data={...o},n.updatedAt=new Date,mi(await this.update(n,...r))}async readRow(e,t,...o){hi(e),fi(t);try{return mi(await this.read(gi(e,t),...o))}catch{return}}async listRows(e,t,...o){hi(e);const r=void 0!==t&&Number.isFinite(t)&&t>=0?Math.floor(t):Ar;if(0===r)return[];const n=Math.min(r,Ar);return(await this.select().where(q.attr("tableName").eq(e)).orderBy("rowId",W.ASC).limit(n).execute(...o)).map(mi)}async assertRowCapacity(e,...t){if((await this.listRows(e,_r,...t)).length>=_r)throw new Cr(`Data table '${e}' reached the 10000-row limit`,"GRAPH_DATA_TABLE_ROW_LIMIT_EXCEEDED",{tableName:e,limit:_r})}async deleteRow(e,t,...o){hi(e),fi(t);try{return await this.delete(gi(e,t),...o),!0}catch{return!1}}async clearTable(e,...t){const o=await this.listRows(e,void 0,...t);for(const r of o)await this.deleteRow(e,r.id+"",...t);return o.length}};function wi(e){return new(0,$.forModel(pi,e.alias).constructor)(e)}bi=k([U(pi,y),C("design:paramtypes",[Function])],bi);const vi=new Set(["engine","valueAdapter","codeSandboxEvaluator","workflowStore"]);function xi(e){for(let t=e.length-1;t>=0;t-=1){const o=e[t];if(!o||"object"!=typeof o)continue;const r=o;if("function"==typeof r.get&&"function"==typeof r.accumulate&&void 0!==r.cache)return en(o)}return{}}function Ii(e,t){const o={};for(const[r,n]of Object.entries(e??{}))vi.has(r)&&!t.has(r)||(o[r]=n);return o}class _i extends K{constructor(){super(),this.webhookResponseRegistry=new ci,this.runSubWorkflowDepth=new Map,this.runRootId=new Map,this.rootChildRunCounts=new Map}async initialize(...e){const t=e[0];if(!t||"object"!=typeof t||!t.registry)return this._config=void 0,this._client=void 0,{config:void 0,client:void 0};const o=t.catalogue??t.registry.catalog,r=t.valueAdapter??V.current;if(!r)throw new Cr("GraphExecutionEngine requires a Decaf adapter for cached/pinned values: pass `valueAdapter` or configure one via `Adapter.setCurrent(...)`","GRAPH_VALUE_ADAPTER_MISSING");const n=t.backend??hn.current??new Vn;if("deployment"===n.documentValidation&&n.local)throw new Cr("A local execution backend cannot declare deployment document validation: deployment projection relaxes catalogue kind resolution and must stay bound to the remote backend that owns the authoritative deployment artifact","GRAPH_DEPLOYMENT_PROJECTION_REQUIRES_REMOTE_BACKEND");const i={registry:t.registry,catalogue:o,planner:t.planner??new li,backend:n,valueAdapter:r,eventEmitter:t.eventEmitter??new Fr,documentValidator:t.documentValidator??new di({catalogue:o,limits:t.documentLimits,credentialAuthorizer:t.credentialAuthorizer,deploymentProjection:"deployment"===n.documentValidation}),authValidator:new rn({enabled:!0===t.authEnabled,...t.authMatch?{match:t.authMatch}:{}}),...t.codeSandboxEvaluator?{codeSandboxEvaluator:t.codeSandboxEvaluator}:{},...t.nodeCredentials?{nodeCredentials:new nn(t.nodeCredentials)}:{}};this._config=t,this._client=i;const a=new Set(["engine","valueAdapter"]);t.codeSandboxEvaluator&&a.add("codeSandboxEvaluator"),t.workflowStore&&a.add("workflowStore");const s=Ii(n.config,a);if(await n.initialize({...s,valueAdapter:r,...t.codeSandboxEvaluator?{codeSandboxEvaluator:t.codeSandboxEvaluator}:{},...t.workflowStore?{workflowStore:t.workflowStore}:{},engine:this}),t.seedWorkflows&&t.seedWorkflows.length>0){const o=n.seedWorkflows;if("function"!=typeof o)throw new Cr(`Graph execution backend '${n.constructor?.name??"GraphExecutionBackend"}' does not support workflow seeding`,"GRAPH_BACKEND_SEED_NOT_SUPPORTED",{backend:n.constructor?.name??"GraphExecutionBackend"});await o.call(n,t.seedWorkflows,...e.slice(1))}return await(t.onEngineCreated?.(this)),{config:t,client:i}}get codeSandboxEvaluator(){return this.client.codeSandboxEvaluator}get nodeCredentials(){return this.client.nodeCredentials}get dataTableStore(){return this.dataTableRepository||(this.dataTableRepository=wi(this.valueAdapter)),this.dataTableRepository}get webhookResponses(){return this.webhookResponseRegistry}get emitter(){return this.client.eventEmitter}get planner(){return this.client.planner}get valueAdapter(){return this.client.valueAdapter}get defaultOptions(){return this.config.defaultOptions??{}}get documentValidator(){return this.client.documentValidator}async validateWorkflowDocument(e,...t){const{ctx:o}=(await this.logCtx(t,"validateWorkflowDocument",!0)).for(this.validateWorkflowDocument);return this.documentValidator.validate(e,0,o)}observe(e){return this.emitter.observe(e)}unObserve(e){this.emitter.unObserve(e)}async dispatchEvent(e){await this.emitter.updateObservers(e)}async execute(e,t={},o={},...r){const{log:n,ctx:i}=(await this.logCtx(r,"execute",!0)).for(this.execute);n.debug(`Executing workflow '${e.id||e.name}'`);const a=this.mergeOptions(o);this.assertNotAborted(a);const s=on(en(i),a.auth);a.auth=s,a.metadata={...a.metadata??{},...s};const d=a.runId??this.generateRunId();a.runId=d;const l=a.path??[];this.enterExecutionBudget(d,a);try{const o=new Hr,c=$n(this.valueAdapter);c.seedWorkflowInputs(this.withWorkflowInputDefaults(e,t));const p=new un(this.emitter,o,{runId:d,parentRunId:a.parentRunId,workflowId:e.id||e.name,path:l,engine:this,...this.codeSandboxEvaluator?{codeSandboxEvaluator:this.codeSandboxEvaluator}:{}});await p.emit({type:yt.VALIDATION_STARTED,status:gt.PLANNING});const u=await this.documentValidator.validate(e,0,i);if(!u.valid||!u.resolved)throw await p.emit({type:yt.VALIDATION_FAILED,status:gt.FAILED,payload:{issues:u.issues}}),new ti(`Graph workflow document '${e.id}' failed validation with ${u.issues.length} issue(s)`,u.issues);await p.emit({type:yt.VALIDATION_COMPLETED,status:gt.PLANNING,payload:{issues:u.issues.length}}),this.assertNotAborted(a);const g=await this.planner.plan(u.resolved);this.client.authValidator.validate(e,g,s,n),n.debug(`Authorized workflow '${e.id||e.name}' for user ${s.user??"anonymous"}`),this.assertCodeModeSupported(e);const h=new cn(d,g,c,o);return p.bindFrame(h),await p.emit({type:yt.WORKFLOW_STARTED,runId:d,parentRunId:a.parentRunId,workflowId:g.workflowId,path:l,status:gt.RUNNING,payload:{inputs:t}}),await p.emit({type:yt.WORKFLOW_PLANNED,runId:d,parentRunId:a.parentRunId,workflowId:g.workflowId,path:l,status:gt.PLANNING,payload:{layers:g.layers.length,nodes:g.nodes.length}}),await this.client.backend.execute({document:e,plan:g,inputs:t,options:a,events:p},...r)}finally{this.releaseExecutionBudget(d)}}get backend(){return this.client.backend}get backendCapabilities(){return gn(this.client.backend)}async listWorkflows(...e){const t=this.client.backend;if("supported"!==gn(t).workflows.list||"function"!=typeof t.listWorkflows)throw new Cr(`Graph execution backend '${this.backendName}' does not support workflow listing`,"GRAPH_BACKEND_WORKFLOWS_NOT_SUPPORTED",{backend:this.backendName});return await t.listWorkflows(...e)}async getWorkflow(e,...t){const o=this.client.backend;if("supported"!==gn(o).workflows.get||"function"!=typeof o.getWorkflow)throw new Cr(`Graph execution backend '${this.backendName}' does not support workflow lookup`,"GRAPH_BACKEND_WORKFLOWS_NOT_SUPPORTED",{backend:this.backendName,workflowId:e});const r=await o.getWorkflow(e,...t);return this.assertWorkflowReadAccess(r,xi(t)),r}assertWorkflowReadAccess(e,t,o){this.client.authValidator.validateWorkflowRead(e,t,o)}async listEngineWorkflows(e,...t){const o=hn.getOrFail(e);if("supported"!==gn(o).workflows.list||"function"!=typeof o.listWorkflows)throw new Cr(`Graph execution backend '${e}' does not support workflow listing`,"GRAPH_BACKEND_WORKFLOWS_NOT_SUPPORTED",{backend:e});return await o.listWorkflows(...t)}async getEngineWorkflow(e,t,...o){const r=hn.getOrFail(e);if("supported"!==gn(r).workflows.get||"function"!=typeof r.getWorkflow)throw new Cr(`Graph execution backend '${e}' does not support workflow lookup`,"GRAPH_BACKEND_WORKFLOWS_NOT_SUPPORTED",{backend:e,workflowId:t});const n=await r.getWorkflow(t,...o);return this.assertWorkflowReadAccess(n,xi(o)),n}get backendName(){return this.client.backend.constructor?.name??"GraphExecutionBackend"}assertCodeModeSupported(e){const t=this.client.backend;if(t.local)return;const o=Rn(e);if(0!==o.length){if("unsupported"===t.codeMode)throw new Cr(`Graph execution backend '${this.backendName}' does not support code-mode workflows`,"GRAPH_CODE_MODE_UNSUPPORTED_BACKEND",{backend:this.backendName,surfaces:o});if(!this.codeSandboxEvaluator)throw new Cr("Code-mode workflows require a CodeSandboxEvaluator to be registered in GraphExecutionEngineConfig.codeSandboxEvaluator","GRAPH_CODE_SANDBOX_NOT_CONFIGURED",{backend:this.backendName,surfaces:o})}}async pinNode(e){const t=this.createPinningService();await t.pinNode(e),await this.emitPinningEvent(e.nodeId,yt.NODE_PINNED)}async unpinNode(e){const t=this.createPinningService();await t.unpinNode(e),await this.emitPinningEvent(e.nodeId,yt.NODE_UNPINNED)}createPinningService(){const e=$n(this.valueAdapter);return new Hn(e,new Wn,new Kn)}async emitPinningEvent(e,t){const o=(new Hr).create({id:"",sequence:0,timestamp:new Date,runId:"pinning",workflowId:"",type:t,nodeId:e,path:[]});await this.emitter.updateObservers(o)}withWorkflowInputDefaults(e,t){const o={...t};for(const t of e.inputs)void 0===o[t.id]&&void 0!==t.defaultValue&&(o[t.id]=t.defaultValue);return o}mergeOptions(e){return{concurrency:4,failFast:!0,validateInputs:!0,validateOutputs:!0,maxLoopIterations:ur,maxForeachIterations:gr,usePinnedValues:!0,writeThroughCache:!1,path:[],metadata:{},...this.defaultOptions,...e}}assertNotAborted(e){if(!0===e.abortSignal?.aborted)throw new Ur(e.runId??"unknown")}enterExecutionBudget(e,t){const o=t.parentRunId,r=t.path??[],n="subworkflow"===r[r.length-1],i=r.filter(e=>"subworkflow"===e).length,a=o?this.runSubWorkflowDepth.get(o)??Math.max(0,i-(n?1:0)):0,s=o?a+(n?1:0):0,d=t.maxSubWorkflowDepth??10;if(s>d)throw new Cr(`Graph run '${e}' exceeds the maximum sub-workflow depth of ${d}`,"GRAPH_SUB_WORKFLOW_DEPTH_EXCEEDED",{runId:e,parentRunId:o,depth:s,maxDepth:d});if(!o)return this.runSubWorkflowDepth.set(e,s),this.runRootId.set(e,e),void this.rootChildRunCounts.set(e,0);const l=this.runRootId.get(o)??o,c=t.maxChildRuns??1e3;let p=this.rootChildRunCounts.get(l)??0;if(n){if(p+=1,p>c)throw new Cr(`Graph run '${l}' exceeds the maximum of ${c} sub-workflow child runs`,"GRAPH_SUB_WORKFLOW_CHILD_LIMIT_EXCEEDED",{runId:e,rootRunId:l,parentRunId:o,childCount:p,maxChildren:c});this.rootChildRunCounts.set(l,p)}this.runSubWorkflowDepth.set(e,s),this.runRootId.set(e,l)}releaseExecutionBudget(e){const t=this.runRootId.get(e);this.runSubWorkflowDepth.delete(e),this.runRootId.delete(e),t===e&&this.rootChildRunCounts.delete(e)}generateRunId(){const e=globalThis.crypto;if(!e||"function"!=typeof e.randomUUID)throw new Cr("Cannot generate a graph run id: crypto.randomUUID is unavailable in this runtime","GRAPH_RUN_ID_ERROR",{runtime:typeof globalThis.crypto});return e.randomUUID()}}const Ei=new Set(["process","require","module","exports","global","globalThis","Function","eval","fetch","XMLHttpRequest","WebSocket","Worker","Deno","Bun","__dispatch"]);class Ai extends K{constructor(){super()}async initialize(...e){const t=e[0]??{},o=t&&"object"==typeof t?t:{};return this._config=o,this._client=Q,{config:o,client:Q}}get defaultTimeoutMs(){return this.config.timeoutMs??1e3}get defaultMemoryMb(){return this.config.memoryMb??32}async evaluate(e,...t){(await this.logCtx(t,"evaluate",!0)).for(this.evaluate);const o=e.code;if(!o||"string"!=typeof o||0===o.trim().length)throw new Cr("Code sandbox received empty code","GRAPH_CODE_SANDBOX_EMPTY_CODE");const r=((e,t)=>"javascript"===t?e:Y.transpileModule(e,{compilerOptions:{target:Y.ScriptTarget.ES2022,module:Y.ModuleKind.None,strict:!0,noEmitHelpers:!0,importHelpers:!1}}).outputText.replace(/^"use strict";\s*/,""))(o,e.language??"javascript");(e=>{if(e.length>1e5)throw new Cr("Code exceeds the maximum length of 100000 characters","GRAPH_CODE_SANDBOX_CODE_TOO_LONG",{length:e.length});let t;try{t=J.parse(`async function __validate() {\n${e}\n}`,{ecmaVersion:"latest",sourceType:"script"})}catch{try{t=J.parse(e,{ecmaVersion:"latest",sourceType:"module"})}catch(t){throw new Cr("Code failed to parse: "+t.message,"GRAPH_CODE_SANDBOX_PARSE_ERROR",{code:e,error:t.message})}}X.full(t,e=>{const t=e;if("ImportDeclaration"===t.type)throw new Cr("Imports are not allowed in Code nodes.","GRAPH_CODE_SANDBOX_FORBIDDEN_TOKEN",{token:"import"});if("ExportNamedDeclaration"===t.type||"ExportDefaultDeclaration"===t.type)throw new Cr("Exports are not allowed in Code nodes.","GRAPH_CODE_SANDBOX_FORBIDDEN_TOKEN",{token:"export"});if("Identifier"===t.type&&"string"==typeof t.name&&Ei.has(t.name))throw new Cr(`Identifier "${t.name}" is not allowed in Code nodes.`,"GRAPH_CODE_SANDBOX_FORBIDDEN_TOKEN",{token:t.name});if("NewExpression"===t.type&&"Function"===t.callee?.name)throw new Cr("new Function() is not allowed in Code nodes.","GRAPH_CODE_SANDBOX_FORBIDDEN_TOKEN",{token:"Function"});if("CallExpression"===t.type&&"eval"===t.callee?.name)throw new Cr("eval() is not allowed in Code nodes.","GRAPH_CODE_SANDBOX_FORBIDDEN_TOKEN",{token:"eval"})})})(r);const n=!(e=>/\breturn\b[\s;]/.test(e))(r),i=n?r.replace(/[\s;]+$/,""):r,a={$input:e.input??{},$vars:e.vars??{},$item:e.item,$index:e.index,$node:e.nodes??{},$output:void 0},s=Object.keys(a),d=n?`return (${i});`:i,l=`"use strict";\nasync function __userFunction(${s.join(", ")}) {\n${d}\n}\n__userFunction(${s.join(", ")}).then(function(__r) { return JSON.stringify({ v: __r }); });`,c=new Q.Isolate({memoryLimit:this.defaultMemoryMb}),p=await c.createContext();try{const t=p.global;e.logger&&await this.injectConsole(p,e.logger);for(const[e,o]of Object.entries(a))await t.set(e,new Q.ExternalCopy(void 0===o?null:o).copyInto());let o;try{o=await c.compileScript(l,{filename:"graph-code-node.js"})}catch(e){if(!n)throw new Cr("Code failed to compile: "+e.message,"GRAPH_CODE_SANDBOX_COMPILE_ERROR",{code:r,error:e.message});{const e=i,t=`"use strict";\nasync function __userFunction(${s.join(", ")}) {\n${e}\n}\n__userFunction(${s.join(", ")}).then(function(__r) { return JSON.stringify({ v: __r }); });`;try{o=await c.compileScript(t,{filename:"graph-code-node.js"})}catch(e){throw new Cr("Code failed to compile: "+e.message,"GRAPH_CODE_SANDBOX_COMPILE_ERROR",{code:r,error:e.message})}}}const d=e.timeoutMs??this.defaultTimeoutMs;let u;try{u=await this.runBounded(o,p,d,e.abortSignal)}catch(e){if(e instanceof Cr)throw e;const t=e.message;if(t.includes("timed out")||t.includes("timeout"))throw new Cr(`Code execution timed out after ${d} ms`,"GRAPH_CODE_SANDBOX_TIMEOUT",{timeoutMs:d});if(t.includes("memory")||t.includes("heap"))throw new Cr(`Code exceeded the memory limit of ${this.defaultMemoryMb} MB`,"GRAPH_CODE_SANDBOX_MEMORY_LIMIT",{memoryMb:this.defaultMemoryMb});throw new Cr("Code execution failed: "+t,"GRAPH_CODE_SANDBOX_RUNTIME_ERROR",{code:r,error:t})}if("string"!=typeof u)throw new Cr("Code sandbox returned an unexpected non-string result","GRAPH_CODE_SANDBOX_UNEXPECTED_RESULT",{result:u});return JSON.parse(u).v}finally{p.release(),c.dispose()}}async runBounded(e,t,o,r){const n=e.run(t,{timeout:o,promise:!0});n.catch(()=>{});const i=[n];let a,s;try{return i.push(new Promise((e,t)=>{a=setTimeout(()=>{t(new Cr(`Code execution timed out after ${o} ms`,"GRAPH_CODE_SANDBOX_TIMEOUT",{timeoutMs:o}))},o+100)})),r&&i.push(new Promise((e,t)=>{const n=()=>{const e="timeout"===r.reason;t(new Cr(e?`Code execution timed out after ${o} ms`:"Code execution aborted",e?"GRAPH_CODE_SANDBOX_TIMEOUT":"GRAPH_CODE_SANDBOX_ABORTED",{timeoutMs:o,reason:r.reason}))};r.aborted?n():(r.addEventListener("abort",n,{once:!0}),s=()=>r.removeEventListener("abort",n))})),await Promise.race(i)}finally{a&&clearTimeout(a),s?.()}}async injectConsole(e,t){const o=new Q.Reference((e,o)=>{let r;try{r=JSON.parse(o)}catch{r=[o]}const n=r.map(e=>"string"==typeof e?e:JSON.stringify(e)).join(" "),i=1===r.length?r[0]:r;switch(e){case"log":case"info":default:t.info(n,i);break;case"warn":t.warn(n,i);break;case"error":t.error(n,i);break;case"debug":case"dir":case"dirxml":case"table":t.debug(n,i);break;case"trace":t.trace(n,i);break;case"group":case"groupCollapsed":t.debug("[group] "+n,i);break;case"groupEnd":t.debug("[groupEnd]",void 0);break;case"time":case"timeEnd":case"timeLog":case"count":case"countReset":t.debug(`[${e}] ${n}`,i);break;case"assert":r[0]||t.error("Assertion failed: "+n,i);case"clear":}});await e.evalClosure("\n function __ser() {\n var out = [];\n for (var i = 0; i < arguments.length; i++) {\n var a = arguments[i];\n try { out.push(typeof a === 'object' ? JSON.parse(JSON.stringify(a)) : a); }\n catch (e) { out.push(String(a)); }\n }\n return JSON.stringify(out);\n }\n function __call(level) {\n return function() {\n $0.applySync(undefined, [level, __ser.apply(null, arguments)]);\n };\n }\n globalThis.console = {\n log: __call('log'),\n info: __call('info'),\n warn: __call('warn'),\n error: __call('error'),\n debug: __call('debug'),\n trace: __call('trace'),\n dir: __call('dir'),\n dirxml: __call('dirxml'),\n table: __call('table'),\n group: __call('group'),\n groupCollapsed: __call('groupCollapsed'),\n groupEnd: __call('groupEnd'),\n time: __call('time'),\n timeEnd: __call('timeEnd'),\n timeLog: __call('timeLog'),\n assert: __call('assert'),\n count: __call('count'),\n countReset: __call('countReset'),\n clear: __call('clear')\n };\n ",[o]),o.release()}}class Si extends R{constructor(e){super(e,Si.name,500)}}class Ri extends O{constructor(e){super(e),this.name=Ri.name}}class Oi extends O{constructor(e){super(e),this.name=Oi.name}}class ki{constructor(e,t,o={}){this.kind=e,this.declarations=new Map,this.implementations=new Map;for(const e of t){if("string"!=typeof e?.name||!e.name)throw new Si(`Method declaration for kind '${this.kind}' is missing a name`);if(this.declarations.has(e.name))throw new Si(`Kind '${this.kind}' declares duplicate method '${e.name}'`);this.declarations.set(e.name,e)}for(const[e,t]of Object.entries(o)){if("function"!=typeof t)throw new Si(`Method implementation '${e}' for kind '${this.kind}' is not a function`);if(!this.declarations.has(e))throw new Si(`Kind '${this.kind}' implements method '${e}' which is not declared by its manifest`);this.implementations.set(e,t)}for(const e of this.declarations.keys())if(!this.implementations.has(e))throw new Si(`Kind '${this.kind}' declares method '${e}' with no implementation`)}has(e){return this.declarations.has(e)}getDeclaration(e){const t=this.declarations.get(e);if(!t)throw new Oi(`Kind '${this.kind}' does not declare method '${e}'`);return t}get(e){return this.getDeclaration(e),this.implementations.get(e)}list(){return[...this.declarations.values()].sort((e,t)=>e.name<t.name?-1:e.name>t.name?1:0)}}function Ci(e,t){if(!t)return;let o=e;for(const e of t.split(".")){if(!o||"object"!=typeof o)return;o=o[e]}return o}function Ni(e,t,o){const r=Ci(t,e.itemIdPath),n=e.itemLabelPath?Ci(t,e.itemLabelPath):void 0;return{id:"string"==typeof r&&r||"number"==typeof r&&Number.isFinite(r)&&r+""||o+"",label:"string"==typeof n?n:void 0}}function Ti(e,t){switch(t){case"input":return e.inputs;case"output":return e.outputs;default:return e.connections}}function Pi(e,t){const o={inputs:[],outputs:[],connections:[]},r={input:new Set((e.inputs??[]).map(e=>e.id)),output:new Set((e.outputs??[]).map(e=>e.id)),connection:new Set((e.connections??[]).map(e=>e.id))},n=(e,t)=>{const o=r[e];return!o.has(t)&&(o.add(t),!0)};for(const r of e.dynamicPorts??[])if("repeatFromParameter"===r.type){const e=t[r.parameter];if(!Array.isArray(e))continue;const i=Ti(o,r.direction);e.forEach((e,t)=>{const{id:o,label:a}=Ni(r,e,t),s=(d={id:o,index:t,label:a??o},r.portIdTemplate.replaceAll("${id}",d.id).replaceAll("${index}",d.index+"").replaceAll("${label}",d.label));var d;if(!n(r.direction,s))return;const l=r.defaultPort?zt(r.defaultPort):{id:s,label:a??s,direction:r.direction};l.id=s,l.direction=r.direction,a&&(l.label=a),i.push(l)})}else if("togglePort"===r.type){if(t[r.parameter]!==r.equals)continue;const e=zt(r.port);if(!n(e.direction,e.id))continue;Ti(o,e.direction).push(e)}return o}function Di(e,t){const o=Pi(e,t),r={kind:e.kind,display:e.display,inputs:[...e.inputs,...o.inputs],outputs:[...e.outputs,...o.outputs],parameters:e.parameters},n=[...e.connections??[],...o.connections];return n.length&&(r.connections=n),e.dynamicPorts?.length&&(r.dynamicPorts=e.dynamicPorts),e.credentials?.length&&(r.credentials=e.credentials),e.capabilities?.length&&(r.capabilities=e.capabilities),e.policies&&(r.policies=e.policies),e.metadata&&(r.metadata=e.metadata),e.namespaces?.length&&(r.namespaces=e.namespaces),zt(r)}class ji{async resolve(e,t,o,r,n){if(o){const i=await o(r,n);if(!(e=>{if(!e||"object"!=typeof e||Array.isArray(e))return!1;const t=e;return"string"==typeof t.kind&&"object"==typeof t.display&&null!==t.display&&Array.isArray(t.inputs)&&Array.isArray(t.outputs)&&Array.isArray(t.parameters)})(i))throw new Si(`resolveManifest provider for kind '${e}' returned a value that does not conform to GraphResolvedNodeManifest`);if(!Vt(i))throw new Si(`resolveManifest provider for kind '${e}' returned a non-JSON-safe resolved manifest`);const a=zt(i);return!a.namespaces?.length&&t.namespaces?.length&&(a.namespaces=t.namespaces.slice()),a}return Di(t,r.parameters??{})}}const Li=["edge","literal","expression"];function Mi(e){return Li.includes(e)}function Gi(e,t,o){if("string"!=typeof o||!o)throw new Si(`Manifest for kind '${e}' has a ${t} with an empty port id`);if(Bt(o))throw new Si(`Manifest for kind '${e}' has a ${t} with unsafe port id '${o}'`)}let Ui=class extends B{constructor(){super(),this.entries=new Map,this.resolver=new ji,this.fallbackContext=new G}withContext(e){return e[e.length-1]instanceof G?e:[this.fallbackContext]}register(e,t={},...o){const{log:r}=this.logCtx(this.withContext(o),"register").for(this.register);r.debug(`Registering graph node kind '${e?.manifest?.kind??"unknown"}'`),(e=>{if(!e||"object"!=typeof e)throw new Si("Graph node registration is required");if(!e.manifest||"object"!=typeof e.manifest)throw new Si("Graph node registration is missing a manifest");if(!e.executor||"function"!=typeof e.executor.execute)throw new Si(`Graph node registration for kind '${e.manifest?.kind+""}' is missing an executor`)})(e);const n=e.manifest;if("string"!=typeof n.kind||!n.kind.trim())throw new Si("Graph node manifest kind is required and must be a non-empty string");const i=n.kind;if(this.entries.has(i)&&!t.replace)throw new Si(`Graph node kind '${i}' is already registered; pass { replace: true } to replace it`);try{Oo(n)}catch(e){throw new Si(`Manifest for kind '${i}' is not JSON-serializable: ${e.message}`)}((e,t)=>{const o=[["input",t.inputs],["output",t.outputs],["connection",t.connections??[]]];for(const[t,r]of o){const o=new Set;for(const n of r){if(Gi(e,t+" port",n?.id),o.has(n.id))throw new Si(`Manifest for kind '${e}' declares duplicate static ${t} port id '${n.id}'`);if(o.add(n.id),void 0!==n.defaultMode&&!Mi(n.defaultMode))throw new Si(`Manifest for kind '${e}' declares invalid default binding mode '${n.defaultMode+""}' on ${t} port '${n.id}'`)}}})(i,n);const a=((e,t)=>{const o=new Set;for(const r of t.parameters){const t=r?.id;if("string"!=typeof t||!t)throw new Si(`Manifest for kind '${e}' has a parameter with an empty id`);if(Bt(t))throw new Si(`Manifest for kind '${e}' has a parameter with unsafe id '${t}'`);if(o.has(t))throw new Si(`Manifest for kind '${e}' declares duplicate parameter id '${t}'`);o.add(t)}return o})(i,n);((e,t,o)=>{for(const r of t.dynamicPorts??[]){if(!r||"string"!=typeof r.parameter||!r.parameter)throw new Si(`Manifest for kind '${e}' has a dynamic-port rule without a parameter reference`);if(!o.has(r.parameter))throw new Si(`Manifest for kind '${e}' has a dynamic-port rule referencing missing parameter '${r.parameter}'`);if("togglePort"===r.type){if(!r.port)throw new Si(`Manifest for kind '${e}' has a togglePort rule without a port`);Gi(e,"togglePort rule port",r.port.id)}if("repeatFromParameter"===r.type&&"string"!=typeof r.portIdTemplate)throw new Si(`Manifest for kind '${e}' has a repeatFromParameter rule without a portIdTemplate`)}})(i,n,a),((e,t)=>{for(const o of t.credentials??[]){if(!Eo(o))throw new Si(`Manifest for kind '${e}' has a malformed credential requirement`);if(!o.type)throw new Si(`Manifest for kind '${e}' has a credential requirement with an empty type`)}})(i,n),((e,t)=>{for(const o of t.methods??[])if(!To(o))throw new Si(`Manifest for kind '${e}' has a malformed method declaration`)})(i,n);const s=new ki(i,n.methods??[],e.methods??{});return this.entries.set(i,{registration:e,methods:s,placeholderManifest:!1}),this}registerExecutor(e,t,...o){const{log:r}=this.logCtx(this.withContext(o),"registerExecutor").for(this.registerExecutor);if(r.debug(`Registering graph executor for kind '${e}'`),"string"!=typeof e||!e.trim())throw new Si("Graph executor kind is required");if(!t||"function"!=typeof t.execute)throw new Si(`Executor registered for kind '${e}' is missing an execute method`);const n=this.entries.get(e);if(n)return n.registration={...n.registration,executor:t},this;const i={kind:e,display:{name:e},inputs:[],outputs:[],parameters:[],policies:{allowUndeclaredParameters:!0,allowUnknownOutputs:!0}};return this.entries.set(e,{registration:{manifest:i,executor:t},methods:new ki(e,[],{}),placeholderManifest:!0}),this}unregister(e,...t){const{log:o}=this.logCtx(this.withContext(t),"unregister").for(this.unregister);return o.debug(`Unregistering graph node kind '${e}'`),this.entries.delete(e),this}has(e,...t){return this.logCtx(this.withContext(t),"has").for(this.has),this.entries.has(e)}entry(e){const t=this.entries.get(e);if(!t)throw new Ri(`No graph node kind '${e}' is registered in the catalogue`);return t}getManifest(e,...t){return this.logCtx(this.withContext(t),"getManifest").for(this.getManifest),zt(this.entry(e).registration.manifest)}getExecutor(e,...t){return this.logCtx(this.withContext(t),"getExecutor").for(this.getExecutor),this.entry(e).registration.executor}getMethodDeclaration(e,t,...o){return this.logCtx(this.withContext(o),"getMethodDeclaration").for(this.getMethodDeclaration),this.entry(e).methods.getDeclaration(t)}getMethod(e,t,...o){return this.logCtx(this.withContext(o),"getMethod").for(this.getMethod),this.entry(e).methods.getDeclaration(t),this.entry(e).methods.get(t)}listMethodDeclarations(e,...t){return this.logCtx(this.withContext(t),"listMethodDeclarations").for(this.listMethodDeclarations),this.entry(e).methods.list()}listManifests(e,...t){this.logCtx(this.withContext(t),"listManifests").for(this.listManifests);const o=[...this.entries.keys()].sort(),r=e?.categories?.length?new Set(e.categories):void 0,n=e?.kinds?.length?new Set(e.kinds):void 0,i=[];for(const e of o){if(n&&!n.has(e))continue;const o=this.getManifest(e,...t);r&&!r.has(o.display.category??"")||i.push(o)}return i}listKinds(...e){return this.logCtx(this.withContext(e),"listKinds").for(this.listKinds),[...this.entries.keys()].sort()}get size(){return this.entries.size}async resolveManifest(e,t,o,...r){this.logCtx(this.withContext(r),"resolveManifest").for(this.resolveManifest);const n=this.entry(e);return this.resolver.resolve(e,n.registration.manifest,n.registration.resolveManifest,t,o)}};Ui=k([H(),C("design:paramtypes",[])],Ui);let $i=class extends B{constructor(e=new Ui){super(),this.catalogue=e}get catalog(){return this.catalogue}register(e,t,...o){const{log:r}=this.logCtx(o,"register").for(this.register);if(r.debug(`Registering graph executor for kind '${e}'`),!e)throw new Cr("Graph executor kind is required");return this.catalogue.registerExecutor(e,t,...o),this}unregister(e,...t){const{log:o}=this.logCtx(t,"unregister").for(this.unregister);return o.debug(`Unregistering graph executor for kind '${e}'`),this.catalogue.unregister(e,...t),this}has(e,...t){return this.logCtx(t,"has").for(this.has),this.catalogue.has(e,...t)}resolve(e,...t){this.logCtx(t,"resolve").for(this.resolve);try{return this.catalogue.getExecutor(e,...t)}catch(t){if(t instanceof Ri)throw new Cr(`No graph executor registered for kind '${e}'`,"GRAPH_EXECUTOR_NOT_FOUND",{kind:e});throw t}}};$i=k([H(),C("design:paramtypes",[Ui])],$i);let Fi=class extends B{constructor(e,t){super(),this.registry=e,this.defaultExecutor=t}resolve(e,...t){const{log:o}=this.logCtx(t,"resolve").for(this.resolve);return o.debug(`Resolving graph executor for kind '${e}'`),this.registry.has(e,...t)?this.registry.resolve(e,...t):this.defaultExecutor?this.defaultExecutor:this.registry.resolve(e,...t)}};function Hi(e){return e}function Bi(e){return e.methods??[]}function qi(e){if(!e)return;const t={...e.metadata??{},...e.parameters??{},...e.state??{}};return e.loop&&(t.loop=e.loop),t}Fi=k([H(),C("design:paramtypes",[Function,Object])],Fi);class Wi extends b{constructor(e){super(),b.fromModel(this,e)}execute(e,t){throw new Cr(`Graph node kind '${this.constructor.name}' does not implement execute`,"GRAPH_NODE_EXECUTE_NOT_IMPLEMENTED",{kind:this.constructor.name})}static applyMetadata(e){return null}static instantiate(e){return new this(e)}}let Ki=class extends Wi{execute(e,t){throw new Gr(e.inputs.value)}};function Vi(e){return e instanceof Error?{name:e.name,message:e.message,stack:e.stack,code:e.graphCode??("number"==typeof e.code?e.code+"":e.code)}:{name:"UnknownError",message:e+""}}k([w(),i("ngx-decaf-crud-field",{label:"graph.node.flow_control.break.fields.value.label",placeholder:"graph.node.flow_control.break.fields.value.placeholder",type:"textarea"}),Ut({handle:"value"}),C("design:type",Object)],Ki.prototype,"value",void 0),Ki=k([Mt("core.flow.break",{kind:"core.flow.break",category:"Flow Control",color:"#f59e0b",icon:"ti-square-arrow-right",width:96,height:96,labels:["flow","break","loop","control"],metadata:{title:"graph.node.flow_control.break.name",description:"graph.node.flow_control.break.description"}}),I()],Ki);let zi=class extends Wi{async execute(e,t){const o=t.node.errorBoundary;if(!o?.try)return{result:e.inputs.value??e.inputs};const r=t.engine;if(!r)throw new Cr("errorBoundary node requires engine access","GRAPH_ENGINE_NOT_AVAILABLE");try{const n=await r.execute(o.try,e.inputs,{parentRunId:t.runId,path:[...t.path,"try"]}),i=Object.values(n.nodeResults).find(e=>e.status===gt.FAILED);if(i)throw new Cr(i.error?.message??"error boundary try body failed",i.error?.code??"GRAPH_ERROR_BOUNDARY",i.error?.details);return{result:n.outputs.result??n.outputs}}catch(n){let i=n;if(o.catch){const a=await r.execute(o.catch,{...e.inputs,error:Vi(n)},{parentRunId:t.runId,path:[...t.path,"catch"]});i=a.outputs.error??a.outputs}return{error:i}}finally{o.finally&&await r.execute(o.finally,e.inputs,{parentRunId:t.runId,path:[...t.path,"finally"]})}}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.flow_control.error_boundary.fields.value.label",placeholder:"graph.node.flow_control.error_boundary.fields.value.placeholder",type:"textarea"}),Ut({handle:"value"}),C("design:type",Object)],zi.prototype,"value",void 0),k([$t({handle:"result"}),C("design:type",Object)],zi.prototype,"result",void 0),k([$t({handle:"error"}),C("design:type",Object)],zi.prototype,"error",void 0),zi=k([Mt("core.flow.errorBoundary",{kind:"core.flow.errorBoundary",category:"Flow Control",color:"#f59e0b",icon:"ti-shield-check",width:96,height:96,labels:["flow","error","try-catch"],metadata:{title:"graph.node.flow_control.error_boundary.name",description:"graph.node.flow_control.error_boundary.description",finally:!1}}),I()],zi);let Qi=class extends Wi{execute(e){const t=e.inputs.value??e.inputs;return!1===this.approved?{rejected:t}:{approved:t}}};k([w(),Ut({handle:"value"}),C("design:type",Object)],Qi.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.human_approval.fields.message.label",placeholder:"graph.node.flow_control.human_approval.fields.message.placeholder",type:"textarea"}),Ut({handle:"message",userControlled:!0}),C("design:type",String)],Qi.prototype,"message",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.human_approval.fields.approved.label",type:"checkbox"}),Ut({handle:"approved",userControlled:!0}),C("design:type",Boolean)],Qi.prototype,"approved",void 0),k([$t({handle:"approved"}),C("design:type",Object)],Qi.prototype,"approvedOut",void 0),k([$t({handle:"rejected"}),C("design:type",Object)],Qi.prototype,"rejectedOut",void 0),Qi=k([Mt("core.flow.humanApproval",{kind:"core.flow.humanApproval",category:"Flow Control",color:"#f59e0b",icon:"ti-user-check",width:96,height:96,labels:["flow","approval","suspend"],metadata:{title:"graph.node.flow_control.human_approval.name",description:"graph.node.flow_control.human_approval.description",approvers:[],timeoutMs:864e5}}),I()],Qi);let Ji=class extends Wi{execute(e,t){const o=e.inputs,r=o.value??o;if(!this.condition)throw new Cr("If node has no condition configured","GRAPH_IF_NO_CONDITION",{input:o});if(yn(this.condition))return bn(this.condition,o,t).then(e=>this.route(e,r));const n=wn(this.condition,((e,t)=>t===e||"object"!=typeof t||null===t||Array.isArray(t)?e:{...t,...e})(o,r),"if");return this.route(n,r)}route(e,t){if(e)return{then:t};if(!0===this.else)return{else:t};throw new Cr("If node condition evaluated to false and the else branch is disabled","GRAPH_IF_ELSE_DISABLED",{condition:this.condition})}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.flow_control.if.fields.value.label",placeholder:"graph.node.flow_control.if.fields.value.placeholder",type:"textarea"}),Ut({handle:"value"}),C("design:type",Object)],Ji.prototype,"value",void 0),k([w(),$t({handle:"then"}),C("design:type",Object)],Ji.prototype,"then",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.if.fields.condition.label",placeholder:"graph.node.flow_control.if.fields.condition.placeholder",type:"code"}),Ut({handle:"condition",userControlled:!0,type:"object"}),C("design:type",Object)],Ji.prototype,"condition",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.if.fields.else.label",type:"checkbox"}),Ut({handle:"else",userControlled:!0}),C("design:type",Boolean)],Ji.prototype,"else",void 0),Ji=k([Mt("core.flow.if",{kind:"core.flow.if",category:"Flow Control",color:"#f59e0b",icon:"ti-arrows-split-2",width:96,height:96,labels:["flow","conditional","branch"],metadata:{title:"graph.node.flow_control.if.name",description:"graph.node.flow_control.if.description"}}),I()],Ji);let Xi=class extends Wi{async execute(e,t){const o=((e,t)=>{const o={cases:t.cases??[],defaultPort:t.defaultPort??"default",hasDefault:!0===t.hasDefault},r=e.node.metadata?.switch;return r&&Array.isArray(r.cases)?{cases:r.cases,defaultPort:r.defaultPort??o.defaultPort,hasDefault:!0===r.hasDefault||o.hasDefault}:o})(t,this),r=o.cases,n=e.inputs,i=n.value??n,a=((e,t)=>t===e||"object"!=typeof t||null===t||Array.isArray(t)?e:{...t,...e})(n,i);for(const e of r)if(await vn(e.condition,{input:n,state:a,label:"switch case"},t))return{[e.outputPort]:i};if(!0!==o.hasDefault)throw new Cr("No switch case matched and default port is not enabled","GRAPH_SWITCH_NO_MATCH",{cases:r.map(e=>e.id)});const s=o.defaultPort??"default";return{[s]:i}}static applyMetadata(e){const t=Dt(this),o=e.defaultPort??"default",r=!0===e.hasDefault,n=t.ports.filter(t=>!e.cases.some(e=>e.outputPort===t.property)),i=n.filter(e=>e.property!==o),a=n.find(e=>e.property===o),s=[...i,...e.cases.map(e=>({property:e.outputPort,name:e.label,direction:it.OUTPUT,label:e.label,required:!1,hidden:!1,path:e.outputPort}))];return r&&a&&s.push(a),{ports:s,size:st(t,{cases:e.cases.length}),dataPatch:{switchMetadata:e}}}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.flow_control.switch.fields.value.label",placeholder:"graph.node.flow_control.switch.fields.value.placeholder",type:"textarea"}),Ut({handle:"value"}),C("design:type",Object)],Xi.prototype,"value",void 0),k([w(),$t({handle:"default"}),C("design:type",Object)],Xi.prototype,"default",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.switch.fields.cases.label",type:"collection"}),C("design:type",Object)],Xi.prototype,"cases",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.switch.fields.hasDefault.label",type:"checkbox"}),C("design:type",Boolean)],Xi.prototype,"hasDefault",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.switch.fields.defaultPort.label",type:"text"}),C("design:type",String)],Xi.prototype,"defaultPort",void 0),Xi=k([Mt("core.flow.switch",{kind:"core.flow.switch",category:"Flow Control",color:"#f59e0b",icon:"ti-arrows-shuffle",width:120,height:140,sizeRules:[{type:"parameterCount",parameter:"cases",dimension:"height",perItem:24}],labels:["flow","switch","multi-branch"],metadata:{title:"graph.node.flow_control.switch.name",description:"graph.node.flow_control.switch.description"}}),I()],Xi);const Yi={maxDocumentBytes:2e6,maxNestingDepth:10,maxNodes:500,maxEdges:1e3},Zi=o.accumulate({graph:{workflows:{limits:{...Yi},allowAnonymousAccess:!1},execution:{maxCodeTimeoutMs:hr}}}),ea=1e3;function ta(e,t){const o="number"==typeof t?t:Number(t),r=Number.isFinite(o)&&o>0?o:hr,n="number"==typeof e?e:Number(e);return Number.isFinite(n)&&n>0?Math.min(Math.floor(n),r):1e3}const oa=["javascript","typescript"],ra="javascript";let na=class extends b{constructor(){super(...arguments),this.language=ra}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.utility.code.fields.language.label",type:"select"}),_([...oa]),v(String),C("design:type",String)],na.prototype,"language",void 0),k([w(),i("code-editor",{label:"graph.node.utility.code.fields.code.label",placeholder:"graph.node.utility.code.fields.code.placeholder"}),Ut({handle:"code"}),C("design:type",String)],na.prototype,"code",void 0),k([d(),Ut({handle:"data"}),C("design:type",Object)],na.prototype,"data",void 0),na=k([I()],na);let ia=class extends Wi{async execute(e,t){const o=e.inputs,r=this.input,n=o.code??e.parameters?.code??r?.code??this.defaultCode,i=r?.language??ra;if(!n||"string"!=typeof n||0===n.trim().length)throw new Tr("Code node has no code to execute (input.code is empty)",{input:o});const a=t.engine?.codeSandboxEvaluator;if(!a)throw new Cr("Code node execution requires a CodeSandboxEvaluator to be registered in GraphExecutionEngineConfig.codeSandboxEvaluator","GRAPH_CODE_SANDBOX_NOT_CONFIGURED",{code:n});const s=Zi.graph.execution?.maxCodeTimeoutMs,d="number"==typeof s&&Number.isFinite(s)&&s>0?s:hr,l=ta(this.timeoutMs,d),c=t.metadata,p={code:n,language:i,input:o,vars:c?.vars??void 0,item:c?.item,index:c?.index,nodes:c?.nodes??void 0,logger:t.logger,timeoutMs:l,abortSignal:t.abortSignal};await t.log("Executing code node",{language:i,length:n.length,timeoutMs:l});const u=await a.evaluate(p);return await t.log("Code node executed",{hasResult:void 0!==u}),{result:u}}};k([w(),Ut({handle:"input",model:na}),C("design:type",na)],ia.prototype,"input",void 0),k([E(1),A(hr),i("ngx-decaf-crud-field",{label:"graph.node.utility.code.fields.timeoutMs.label",type:"number"}),Ut({handle:"timeoutMs"}),C("design:type",Number)],ia.prototype,"timeoutMs",void 0),k([i("code-editor",{label:"graph.node.utility.code.fields.defaultCode.label",placeholder:"graph.node.utility.code.fields.defaultCode.placeholder"}),Ut({handle:"defaultCode",userControlled:!0}),C("design:type",String)],ia.prototype,"defaultCode",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],ia.prototype,"result",void 0),ia=k([Mt("core.utility.code",{kind:"core.utility.code",category:"Utility",color:"#0d9488",icon:"ti-code",width:96,height:96,labels:["utility","code","sandbox","transform"],metadata:{title:"graph.node.utility.code.name",description:"graph.node.utility.code.description"}}),I()],ia);let aa=class extends Wi{execute(e){return{value:e.inputs.value??e.inputs}}};k([w(),Ut({handle:"value"}),C("design:type",Object)],aa.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.utility.delay.fields.timeoutMs.label",type:"number"}),Ut({handle:"timeoutMs"}),C("design:type",Number)],aa.prototype,"timeoutMs",void 0),k([w(),$t({handle:"value"}),C("design:type",Object)],aa.prototype,"valueOut",void 0),aa=k([Mt("core.flow.delay",{kind:"core.flow.delay",category:"Utility",color:"#0d9488",icon:"ti-clock-hour-4",width:96,height:96,labels:["flow","delay","wait"],metadata:{title:"graph.node.utility.delay.name",description:"graph.node.utility.delay.description"}}),I()],aa);let sa=class extends Wi{execute(e,t){const o=e.inputs.value,r=this.level??"info";return t.logger[r](this.message??"Log node",{value:o}),{value:o}}};k([w(),Ut({handle:"value"}),C("design:type",Object)],sa.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.utility.log.fields.message.label",placeholder:"graph.node.utility.log.fields.message.placeholder",type:"textarea"}),Ut({handle:"message"}),C("design:type",String)],sa.prototype,"message",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.utility.log.fields.level.label",placeholder:"graph.node.utility.log.fields.level.placeholder",type:"text"}),Ut({handle:"level",userControlled:!0}),C("design:type",String)],sa.prototype,"level",void 0),k([w(),$t({handle:"value"}),C("design:type",Object)],sa.prototype,"valueOut",void 0),sa=k([Mt("core.flow.log",{kind:"core.flow.log",category:"Utility",color:"#0d9488",icon:"ti-terminal",width:96,height:96,labels:["flow","log","debug","utility"],metadata:{title:"graph.node.utility.log.name",description:"graph.node.utility.log.description"}}),I()],sa);let da=class extends Wi{execute(e){return{result:{mapped:e.inputs.value??e.inputs}}}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.utility.map.fields.value.label",placeholder:"graph.node.utility.map.fields.value.placeholder",type:"textarea"}),Ut({handle:"value"}),C("design:type",Object)],da.prototype,"value",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],da.prototype,"result",void 0),da=k([Mt("core.utility.map",{kind:"core.utility.map",category:"Utility",color:"#0d9488",icon:"ti-arrows-right-left",width:96,height:96,labels:["utility","map","transform"],metadata:{title:"graph.node.utility.map.name",description:"graph.node.utility.map.description",mapper:{}}}),I()],da);let la=class extends Wi{execute(e,t){const o=e.inputs.value,r=this.level??"info";return t.logger[r](this.message??"Log node",{value:o}),{value:o}}};k([w(),Ut({handle:"value"}),C("design:type",Object)],la.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.utility.utility_log.fields.message.label",placeholder:"graph.node.utility.utility_log.fields.message.placeholder",type:"textarea"}),Ut({handle:"message"}),C("design:type",String)],la.prototype,"message",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.utility.utility_log.fields.level.label",placeholder:"graph.node.utility.utility_log.fields.level.placeholder"}),Ut({handle:"level",userControlled:!0,type:"string"}),C("design:type",String)],la.prototype,"level",void 0),k([w(),$t({handle:"value"}),C("design:type",Object)],la.prototype,"valueOut",void 0),la=k([Mt("core.utility.log",{kind:"core.utility.log",category:"Utility",color:"#0d9488",icon:"ti-terminal",width:96,height:96,labels:["utility","log","debug","observability"],metadata:{title:"graph.node.utility.utility_log.name",description:"graph.node.utility.utility_log.description"}}),I()],la);const ca=new Set(["__proto__","constructor","prototype"]);function pa(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function ua(e){return null==e?[]:(Array.isArray(e)?e:[e]).filter(e=>null!=e)}function ga(e,t){if(ca.has(t))throw new Cr(`Graph data path '${e}' contains the reserved segment '${t}'`,"GRAPH_DATA_UNSAFE_PATH",{path:e,segment:t})}function ha(e,t){return t?(e=>{const t=(e=>e.split(".").map(e=>e.trim()).filter(e=>e.length>0))(e);for(const o of t)ga(e,o);return t})(e):(ga(e,e),[e])}function fa(e,t,o=!0){if(!t)return e;const r=ha(t,o);let n=e;for(const e of r){if(!pa(n))return;n=n[e]}return n}function ya(e,t,o,r=!0){const n=ha(t,r);if(0===n.length)return;let i=e;for(let e=0;e<n.length-1;e++){const t=n[e],o=i[t];if(pa(o))i=o;else{const e={};i[t]=e,i=e}}i[n[n.length-1]]=o}function ma(e,t,o=!0){const r=ha(t,o);if(0===r.length)return;let n=e;for(let e=0;e<r.length-1;e++){const t=n[r[e]];if(!pa(t))return;n=t}delete n[r[r.length-1]]}function ba(e,t="json"){if(null==e)return e;switch(t){case"string":return e+"";case"number":{const t=Number(e);if(!Number.isFinite(t))throw new Cr(`Value '${e+""}' cannot be converted to a number`,"GRAPH_DATA_INVALID_NUMBER",{value:e});return t}case"boolean":return"string"==typeof e?"true"===e||"1"===e:!!e;case"array":return Array.isArray(e)?e:[e];case"object":return pa(e)?e:{};default:if("string"!=typeof e)return e;try{return JSON.parse(e)}catch{return e}}}function wa(e,t,o="auto"){const r=null==e,n=null==t;return r&&n?0:r?1:n?-1:"string"===o?(e+"").localeCompare(t+""):"number"===o?Number(e)-Number(t):"date"===o?new Date(e).getTime()-new Date(t).getTime():"number"==typeof e&&"number"==typeof t?e-t:"boolean"==typeof e&&"boolean"==typeof t?Number(e)-Number(t):(e+"").localeCompare(t+"")}function va(e,t){if(!t||"iso"===t)return e.toISOString();const o=(e,t=2)=>(e+"").padStart(t,"0"),r={yyyy:e.getUTCFullYear()+"",yy:(e.getUTCFullYear()+"").slice(-2),MM:o(e.getUTCMonth()+1),M:e.getUTCMonth()+1+"",dd:o(e.getUTCDate()),d:e.getUTCDate()+"",HH:o(e.getUTCHours()),H:e.getUTCHours()+"",mm:o(e.getUTCMinutes()),m:e.getUTCMinutes()+"",ss:o(e.getUTCSeconds()),s:e.getUTCSeconds()+"",SSS:o(e.getUTCMilliseconds(),3)};return t.replace(/yyyy|yy|MM|M|dd|d|HH|H|mm|m|ss|s|SSS/g,e=>r[e]??e)}function xa(e,t,o){const r=new Date(e.getTime());switch(o){case"seconds":r.setUTCSeconds(r.getUTCSeconds()+t);break;case"minutes":r.setUTCMinutes(r.getUTCMinutes()+t);break;case"hours":r.setUTCHours(r.getUTCHours()+t);break;case"days":r.setUTCDate(r.getUTCDate()+t);break;case"weeks":r.setUTCDate(r.getUTCDate()+7*t);break;case"months":r.setUTCMonth(r.getUTCMonth()+t);break;case"years":r.setUTCFullYear(r.getUTCFullYear()+t)}return r}function Ia(e){if(e instanceof Date){if(Number.isNaN(e.getTime()))throw new Cr("Date value is invalid","GRAPH_DATA_INVALID_DATE",{value:e});return e}if("number"==typeof e){const t=new Date(e);if(!Number.isNaN(t.getTime()))return t}if("string"==typeof e&&e.trim().length>0){const t=new Date(e);if(!Number.isNaN(t.getTime()))return t}throw new Cr("Date & Time node requires a valid date value","GRAPH_DATA_INVALID_DATE",{value:e})}function _a(e){return"undefined"!=typeof Buffer&&Buffer.isBuffer(e)||e instanceof Uint8Array||e instanceof ArrayBuffer}let Ea=class extends Wi{constructor(){super(...arguments),this.operation="current",this.amount=0,this.unit="days"}execute(e){const t=e.inputs.value??this.value;if(Array.isArray(t)){const e=t.filter(e=>null!=e).map(e=>this.convert(e));return{result:e.map(e=>e.result),iso:e.map(e=>e.iso),timestamp:e.map(e=>e.timestamp)}}const o=this.convert(t);return{result:o.result,iso:o.iso,timestamp:o.timestamp}}convert(e){let t;switch(this.operation){case"current":t=new Date;break;case"add":t=xa(Ia(e),this.amount??0,this.unit??"days");break;case"subtract":t=xa(Ia(e),-(this.amount??0),this.unit??"days");break;case"parse":case"format":t=Ia(e);break;default:throw new Cr(`Unsupported Date & Time operation '${this.operation+""}'`,"GRAPH_DATE_TIME_UNSUPPORTED_OPERATION",{operation:this.operation})}return{result:va(t,this.format),iso:t.toISOString(),timestamp:t.getTime()}}};k([Ut({handle:"value"}),C("design:type",Object)],Ea.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.date_time.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],Ea.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.date_time.fields.format.label",placeholder:"graph.node.data.date_time.fields.format.placeholder",type:"text"}),Ut({handle:"format",userControlled:!0}),C("design:type",String)],Ea.prototype,"format",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.date_time.fields.amount.label",type:"number"}),Ut({handle:"amount",userControlled:!0}),C("design:type",Number)],Ea.prototype,"amount",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.date_time.fields.unit.label",type:"select"}),Ut({handle:"unit",userControlled:!0}),C("design:type",String)],Ea.prototype,"unit",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],Ea.prototype,"result",void 0),k([$t({handle:"iso"}),C("design:type",String)],Ea.prototype,"iso",void 0),k([$t({handle:"timestamp"}),C("design:type",Number)],Ea.prototype,"timestamp",void 0),Ea=k([Mt("core.data.dateTime",{kind:"core.data.dateTime",category:"Data",color:"#8b5cf6",icon:"ti-calendar-time",width:96,height:96,labels:["data","date","time"],metadata:{title:"graph.node.data.date_time.name",description:"graph.node.data.date_time.description"}}),I()],Ea);let Aa=class extends Wi{constructor(){super(...arguments),this.operation="insert",this.tableName="default"}async execute(e,t){const o=t.engine?.dataTableStore;if(!o)throw new Cr("Data table node requires engine access","GRAPH_ENGINE_NOT_AVAILABLE");if(!this.tableName)throw new Cr("Data table node requires a table name","GRAPH_DATA_TABLE_NAME_REQUIRED");switch(this.operation){case"insert":return{result:await this.insertRows(e,o,t)};case"upsert":return{result:await this.upsertRows(e,o,t)};case"get":if(!this.rowId)throw new Cr("Data table 'get' requires a row id","GRAPH_DATA_TABLE_ROW_ID_REQUIRED");return{result:await o.readRow(this.tableName,this.rowId,t)??null};case"list":{const e=await o.listRows(this.tableName,this.limit,t);return{result:e,count:e.length}}case"delete":{if(!this.rowId)throw new Cr("Data table 'delete' requires a row id","GRAPH_DATA_TABLE_ROW_ID_REQUIRED");const e=await o.deleteRow(this.tableName,this.rowId,t);return{result:e,count:e?1:0}}case"clear":{const e=await o.clearTable(this.tableName,t);return{result:e,count:e}}default:throw new Cr(`Unsupported data table operation '${this.operation+""}'`,"GRAPH_DATA_TABLE_UNSUPPORTED_OPERATION",{operation:this.operation})}}rowsOf(e){const t=ua(e.inputs.value).filter(pa);return t.length>0?t:pa(this.row)?[this.row]:[]}async insertRows(e,t,o){const r=this.rowsOf(e),n=[];for(const e of r){const r=this.rowId??this.rowIdOf(e)??Z();n.push(await t.insertRow(this.tableName,r,e,o))}return n}async upsertRows(e,t,o){const r=this.rowsOf(e),n=[];for(const e of r){const r=this.rowId??this.rowIdOf(e)??Z();n.push(await t.upsertRow(this.tableName,r,e,o))}return n}rowIdOf(e){const t=e[this.rowIdField||"id"];return"string"==typeof t&&t.length>0?t:"number"==typeof t?t+"":void 0}};function Sa(e,t){return pa(t)?{...e,...t,item:t}:{...e,item:t}}k([Ut({handle:"value"}),C("design:type",Object)],Aa.prototype,"value",void 0),k([w(),i("ngx-decaf-crud-field",{label:"graph.node.data.data_table.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],Aa.prototype,"operation",void 0),k([w(),i("ngx-decaf-crud-field",{label:"graph.node.data.data_table.fields.tableName.label",placeholder:"graph.node.data.data_table.fields.tableName.placeholder",type:"text"}),Ut({handle:"tableName",userControlled:!0}),C("design:type",String)],Aa.prototype,"tableName",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.data_table.fields.rowId.label",placeholder:"graph.node.data.data_table.fields.rowId.placeholder",type:"text"}),Ut({handle:"rowId",userControlled:!0}),C("design:type",String)],Aa.prototype,"rowId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.data_table.fields.rowIdField.label",placeholder:"graph.node.data.data_table.fields.rowIdField.placeholder",type:"text"}),Ut({handle:"rowIdField",userControlled:!0}),C("design:type",String)],Aa.prototype,"rowIdField",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.data_table.fields.row.label",type:"json"}),Ut({handle:"row",userControlled:!0,type:"object"}),C("design:type",Object)],Aa.prototype,"row",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.data_table.fields.limit.label",type:"number"}),Ut({handle:"limit",userControlled:!0}),C("design:type",Number)],Aa.prototype,"limit",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],Aa.prototype,"result",void 0),k([$t({handle:"count"}),C("design:type",Number)],Aa.prototype,"count",void 0),Aa=k([Mt("core.data.dataTable",{kind:"core.data.dataTable",category:"Data",color:"#8b5cf6",icon:"ti-table",width:96,height:96,labels:["data","table","persistence"],metadata:{title:"graph.node.data.data_table.name",description:"graph.node.data.data_table.description"}}),I()],Aa);let Ra=class extends Wi{constructor(){super(...arguments),this.negate=!1}async execute(e,t){if(!this.condition)throw new Cr("Filter node has no condition configured","GRAPH_FILTER_NO_CONDITION");const o=ua(e.inputs.value),r=[];for(let n=0;n<o.length;n++){const i=o[n];await vn(this.condition,{input:{...e.inputs,item:i,index:n},state:Sa(e.inputs,i),label:"filter"},t)!==(!0===this.negate)&&r.push(i)}return{result:r}}};k([w(),Ut({handle:"value"}),C("design:type",Object)],Ra.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.filter.fields.condition.label",placeholder:"graph.node.data.filter.fields.condition.placeholder",type:"code"}),Ut({handle:"condition",userControlled:!0,type:"object"}),C("design:type",Object)],Ra.prototype,"condition",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.filter.fields.negate.label",type:"checkbox"}),Ut({handle:"negate",userControlled:!0}),C("design:type",Boolean)],Ra.prototype,"negate",void 0),k([w(),$t({handle:"result"}),C("design:type",Array)],Ra.prototype,"result",void 0),Ra=k([Mt("core.data.filter",{kind:"core.data.filter",category:"Data",color:"#8b5cf6",icon:"ti-filter",width:96,height:96,labels:["data","filter","condition"],metadata:{title:"graph.node.data.filter.name",description:"graph.node.data.filter.description"}}),I()],Ra);let Oa=class extends Wi{constructor(){super(...arguments),this.maxItems=1,this.keep="firstItems"}execute(e){const t=ua(e.inputs.value),o=Math.max(0,Math.floor(Number(this.maxItems??1)));return o<t.length?"lastItems"===this.keep?{result:t.slice(t.length-o)}:{result:t.slice(0,o)}:{result:t}}};function ka(e,t,o){const r={...e};for(const[e,n]of Object.entries(t))"keepFirst"===o&&Object.prototype.hasOwnProperty.call(r,e)||(r[e]=n);return r}k([w(),Ut({handle:"value"}),C("design:type",Object)],Oa.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.limit.fields.maxItems.label",type:"number"}),Ut({handle:"maxItems",userControlled:!0}),C("design:type",Number)],Oa.prototype,"maxItems",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.limit.fields.keep.label",type:"select"}),Ut({handle:"keep",userControlled:!0}),C("design:type",String)],Oa.prototype,"keep",void 0),k([w(),$t({handle:"result"}),C("design:type",Array)],Oa.prototype,"result",void 0),Oa=k([Mt("core.data.limit",{kind:"core.data.limit",category:"Data",color:"#8b5cf6",icon:"ti-arrows-bar-to-line",width:96,height:96,labels:["data","limit","slice"],metadata:{title:"graph.node.data.limit.name",description:"graph.node.data.limit.description"}}),I()],Oa);let Ca=class extends Wi{constructor(){super(...arguments),this.mode="append",this.combineBy="position",this.joinMode="inner",this.clashHandling="keepFirst"}execute(e){const t=ua(e.inputs.input),o=ua(e.inputs.input2);if("append"===this.mode)return{result:[...t,...o]};if("fields"===this.combineBy)return{result:this.mergeByFields(t,o)};const r=Math.max(t.length,o.length),n=[];for(let e=0;r>e;e++){if(e>=t.length){if("inner"===this.joinMode||"left"===this.joinMode)continue;n.push(o[e]);continue}if(e>=o.length){if("inner"===this.joinMode||"right"===this.joinMode)continue;n.push(t[e]);continue}const r=t[e],i=o[e];pa(r)&&pa(i)?n.push(ka(r,i,this.clashHandling)):n.push([r,i])}return{result:n}}mergeByFields(e,t){const o=this.joinField;if(!o)throw new Cr("Merge node in 'fields' mode requires a join field","GRAPH_MERGE_JOIN_FIELD_REQUIRED");const r=new Map;for(const e of t){if(!pa(e))continue;const t=fa(e,o);if(null==t)continue;const n=r.get(t);r.set(t,n?ka(n,e,this.clashHandling):e)}const n=[],i=new Set;for(const t of e){if(!pa(t)){"inner"!==this.joinMode&&"right"!==this.joinMode&&n.push(t);continue}const e=fa(t,o),a=r.get(e);a?(i.add(e),n.push(ka(t,a,this.clashHandling))):"inner"!==this.joinMode&&"right"!==this.joinMode&&n.push(t)}if("right"===this.joinMode||"outer"===this.joinMode)for(const[e,t]of r)i.has(e)||n.push(t);return n}};function Na(e,t,o){const r={...e};for(const e of t){if(!e||!e.from||!e.to||e.from===e.to)continue;const t=fa(r,e.from,o);void 0!==t&&(ma(r,e.from,o),ya(r,e.to,t,o))}return r}k([w(),Ut({handle:"input"}),C("design:type",Object)],Ca.prototype,"input",void 0),k([Ut({handle:"input2"}),C("design:type",Object)],Ca.prototype,"input2",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.merge.fields.mode.label",type:"select"}),Ut({handle:"mode",userControlled:!0}),C("design:type",String)],Ca.prototype,"mode",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.merge.fields.combineBy.label",type:"select"}),Ut({handle:"combineBy",userControlled:!0}),C("design:type",String)],Ca.prototype,"combineBy",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.merge.fields.joinMode.label",type:"select"}),Ut({handle:"joinMode",userControlled:!0}),C("design:type",String)],Ca.prototype,"joinMode",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.merge.fields.joinField.label",placeholder:"graph.node.data.merge.fields.joinField.placeholder",type:"text"}),Ut({handle:"joinField",userControlled:!0}),C("design:type",String)],Ca.prototype,"joinField",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.merge.fields.clashHandling.label",type:"select"}),Ut({handle:"clashHandling",userControlled:!0}),C("design:type",String)],Ca.prototype,"clashHandling",void 0),k([w(),$t({handle:"result"}),C("design:type",Array)],Ca.prototype,"result",void 0),Ca=k([Mt("core.data.merge",{kind:"core.data.merge",category:"Data",color:"#8b5cf6",icon:"ti-git-merge",width:96,height:96,labels:["data","merge","join"],metadata:{title:"graph.node.data.merge.name",description:"graph.node.data.merge.description"}}),I()],Ca);let Ta=class extends Wi{constructor(){super(...arguments),this.renames=[],this.dotNotation=!0}execute(e){const t=(this.renames??[]).filter(e=>e&&"string"==typeof e.from&&"string"==typeof e.to),o=e.inputs.value,r=!1!==this.dotNotation;return Array.isArray(o)?{result:o.filter(e=>null!=e).map(e=>pa(e)?Na(e,t,r):e)}:pa(o)?{result:Na(o,t,r)}:{result:ua(o)}}};k([w(),Ut({handle:"value"}),C("design:type",Object)],Ta.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.rename_keys.fields.renames.label",placeholder:"graph.node.data.rename_keys.fields.renames.placeholder",type:"collection"}),Ut({handle:"renames",userControlled:!0,type:"array"}),C("design:type",Array)],Ta.prototype,"renames",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.rename_keys.fields.dotNotation.label",type:"checkbox"}),Ut({handle:"dotNotation",userControlled:!0}),C("design:type",Boolean)],Ta.prototype,"dotNotation",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],Ta.prototype,"result",void 0),Ta=k([Mt("core.data.renameKeys",{kind:"core.data.renameKeys",category:"Data",color:"#8b5cf6",icon:"ti-key",width:96,height:96,labels:["data","rename","keys"],metadata:{title:"graph.node.data.rename_keys.name",description:"graph.node.data.rename_keys.description"}}),I()],Ta);let Pa=class extends Wi{constructor(){super(...arguments),this.assignments=[],this.includeOtherFields=!0,this.dotNotation=!0}execute(e){const t=e.inputs.value;return Array.isArray(t)?{result:t.filter(e=>null!=e).map(e=>this.applyTo(e))}:{result:this.applyTo(t)}}applyTo(e){const t=this.includeOtherFields?pa(e)?{...e}:void 0===e?{}:{value:e}:{};for(const e of this.assignments??[]){if(!e||"string"!=typeof e.name)continue;const o=ba(e.value,e.type??"json");null!=o&&ya(t,e.name,o,!1!==this.dotNotation)}return t}};k([w(),Ut({handle:"value"}),C("design:type",Object)],Pa.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.set.fields.assignments.label",placeholder:"graph.node.data.set.fields.assignments.placeholder",type:"collection"}),Ut({handle:"assignments",userControlled:!0,type:"array"}),C("design:type",Array)],Pa.prototype,"assignments",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.set.fields.includeOtherFields.label",type:"checkbox"}),Ut({handle:"includeOtherFields",userControlled:!0}),C("design:type",Boolean)],Pa.prototype,"includeOtherFields",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.set.fields.dotNotation.label",type:"checkbox"}),Ut({handle:"dotNotation",userControlled:!0}),C("design:type",Boolean)],Pa.prototype,"dotNotation",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],Pa.prototype,"result",void 0),Pa=k([Mt("core.data.set",{kind:"core.data.set",category:"Data",color:"#8b5cf6",icon:"ti-adjustments-horizontal",width:96,height:96,labels:["data","set","assign"],metadata:{title:"graph.node.data.set.name",description:"graph.node.data.set.description"}}),I()],Pa);let Da=class extends Wi{constructor(){super(...arguments),this.sortFields=[],this.valueType="auto",this.dotNotation=!0}execute(e){const t=[...ua(e.inputs.value)],o=(this.sortFields??[]).filter(e=>e&&"string"==typeof e.field);return 0===o.length||t.sort((e,t)=>{for(const r of o){const o=wa(fa(e,r.field,!1!==this.dotNotation),fa(t,r.field,!1!==this.dotNotation),this.valueType??"auto");if(0!==o)return"desc"===r.direction?-o:o}return 0}),{result:t}}};k([w(),Ut({handle:"value"}),C("design:type",Object)],Da.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.sort.fields.sortFields.label",placeholder:"graph.node.data.sort.fields.sortFields.placeholder",type:"collection"}),Ut({handle:"sortFields",userControlled:!0,type:"array"}),C("design:type",Array)],Da.prototype,"sortFields",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.sort.fields.valueType.label",type:"select"}),Ut({handle:"valueType",userControlled:!0}),C("design:type",String)],Da.prototype,"valueType",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.sort.fields.dotNotation.label",type:"checkbox"}),Ut({handle:"dotNotation",userControlled:!0}),C("design:type",Boolean)],Da.prototype,"dotNotation",void 0),k([w(),$t({handle:"result"}),C("design:type",Array)],Da.prototype,"result",void 0),Da=k([Mt("core.data.sort",{kind:"core.data.sort",category:"Data",color:"#8b5cf6",icon:"ti-sort-ascending",width:96,height:96,labels:["data","sort","order"],metadata:{title:"graph.node.data.sort.name",description:"graph.node.data.sort.description"}}),I()],Da);let ja=class extends Wi{constructor(){super(...arguments),this.field="",this.include="noOtherFields"}execute(e){if(!this.field)throw new Cr("Split Out node requires a field name","GRAPH_SPLIT_OUT_FIELD_REQUIRED");const t=ua(e.inputs.value),o=[];for(const e of t){const t=fa(e,this.field,!0);if(null==t)continue;const r=Array.isArray(t)?t:[t];for(const t of r){if(null==t)continue;if("allOtherFields"!==this.include){o.push(t);continue}const r=this.destinationField||this.field,n=pa(e)?{...e}:{};ma(n,this.field,!0),ya(n,r,t,!0),o.push(n)}}return{result:o}}};function La(e,t="Fields"){if(null==e)return[];if("string"==typeof e)return e.split(",").map(e=>e.trim()).filter(e=>e.length>0);if(Array.isArray(e))return e.filter(e=>"string"==typeof e).map(e=>e.trim()).filter(e=>e.length>0);throw new Cr(`The '${t}' parameter must be a comma-separated string or an array of strings`,"GRAPH_DATA_INVALID_FIELDS",{fieldName:t})}function Ma(e){return e.replace(/]/g,"").replace(/\[/g,"").replace(/"/g,"").replace(/[ .]/g,"_")}function Ga(e){const t=e=>Array.isArray(e)?e.map(t):e instanceof Date?e.toISOString():pa(e)?Object.keys(e).sort().reduce((o,r)=>(ga(r,r),o[r]=t(e[r]),o),{}):"number"==typeof e&&Number.isNaN(e)?"@NaN":void 0===e?"@undefined":"bigint"==typeof e?e.toString()+"n":e;return JSON.stringify(t(e))}function Ua(e,t){if(e===t)return!0;if("number"==typeof e&&"number"==typeof t&&Number.isNaN(e)&&Number.isNaN(t))return!0;if(e instanceof Date&&t instanceof Date)return e.getTime()===t.getTime();if(Array.isArray(e)&&Array.isArray(t))return e.length===t.length&&e.every((e,o)=>Ua(e,t[o]));if(pa(e)&&pa(t)){const o=Object.keys(e),r=Object.keys(t);return o.length===r.length&&o.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&Ua(e[o],t[o]))}return!1}function $a(e){return null==e||""===e||!1===e||(Array.isArray(e)?0===e.length:!!pa(e)&&0===Object.keys(e).length)}function Fa(e,t){if(null!==e&&null!==t&&typeof e==typeof t)return Ua(e,t);if($a(e)&&$a(t))return!0;if($a(e)&&void 0===t)return!0;if(void 0===e&&$a(t))return!0;if("number"==typeof e&&"string"==typeof t)return e.toString()===t;if("string"==typeof e&&"number"==typeof t)return e===t.toString();if(pa(e)&&"string"==typeof t)try{return Ua(e,JSON.parse(t))}catch{return!1}if("string"==typeof e&&pa(t))try{return Ua(JSON.parse(e),t)}catch{return!1}return Ua(e,t)}function Ha(e,t,o=[]){if(!pa(e)||Array.isArray(e))return o.length?[o.join(".")]:[];if(!t)return o.length?[o.join(".")]:Object.keys(e);const r=Object.keys(e);if(0===r.length)return o.length?[o.join(".")]:[];const n=[];for(const i of r){const r=e[i];if(pa(r)&&!Array.isArray(r)){const e=Ha(r,t,[...o,i]);0===e.length?n.push([...o,i].join(".")):n.push(...e)}else n.push([...o,i].join("."))}return n}function Ba(e,t,o){if(!pa(e)||Array.isArray(e))return e;const r={...e};for(const e of t)e&&ma(r,e,o);return r}function qa(e,t,o){if(!pa(e)||Array.isArray(e))return e;const r={};for(const n of t)ya(r,n,fa(e,n,o),o);return r}function Wa(e,t,o){return t.outputFieldName?t.outputFieldName:o&&e.includes(".")?e.split(".").pop()??e:e}function Ka(e,t,o={}){const r=!1!==o.dotNotation,n={},i=new Set;for(const a of t){const t=a?.field??a?.fieldToAggregate;if(!t)continue;const s=Wa(t,a,r);if(i.has(s))throw new Cr(`The '${s}' output field is used more than once`,"GRAPH_AGGREGATE_DUPLICATE_FIELD",{field:s});i.add(s);const d=[];for(const n of e){let e=fa(n,t,r);if(Array.isArray(e)&&!o.keepMissing)e=e.filter(e=>null!=e);else if(!o.keepMissing&&null==e)continue;Array.isArray(e)&&o.mergeLists?d.push(...e):d.push(e)}ya(n,s,d,r)}return n}function Va(e,t={}){const o=t.include??"allFields",r=t.fieldsToInclude??[],n=t.fieldsToExclude??[],i=[];for(const t of e){const e=pa(t)?{...t}:void 0===t?{}:{value:t},a=Object.keys(e);let s=a;"specifiedFields"===o?s=a.filter(e=>r.includes(e)):"allFieldsExcept"===o&&(s=a.filter(e=>!n.includes(e)));const d={};for(const t of s)ga(t,t),d[t]=e[t];Object.keys(d).length>0&&i.push(d)}return i}function za(e,t,o,r="auto"){const n=[...e],i=t.filter(e=>e&&"string"==typeof e.field);return 0===i.length||n.sort((e,t)=>{for(const n of i){const i=wa(fa(e,n.field,o),fa(t,n.field,o),r);if(0!==i)return"desc"===n.direction?-i:i}return 0}),n}function Qa(e,t,o={}){const r=!1!==o.dotNotation,n=[];for(const i of e){const e=fa(i,t,r);if(null==e)continue;const a=Array.isArray(e)?e:[e];for(const e of a){if(null==e)continue;if("allOtherFields"!==o.include){n.push(e);continue}const r=o.destinationField||t,a=pa(i)?{...i}:{};ma(a,t,!0),ya(a,r,e,!0),n.push(a)}}return n}function Ja(e,t={}){const o=!1!==t.dotNotation,r=t.compare??"allFields";let n;if("selectedFields"===r){if(n=La(t.fieldsToCompare,"Fields To Compare"),0===n.length)throw new Cr("No fields specified to compare on","GRAPH_REMOVE_DUPLICATES_FIELDS_REQUIRED");if(!e.some(e=>n.some(t=>void 0!==fa(e,t,o))))throw new Cr(`The fields '${n.join(", ")}' are not present in any input item`,"GRAPH_REMOVE_DUPLICATES_FIELD_MISSING",{fields:n})}else if("allFieldsExcept"===r){const r=La(t.fieldsToExclude,"Fields To Exclude");if(0===r.length)throw new Cr("No fields specified to exclude from comparison","GRAPH_REMOVE_DUPLICATES_FIELDS_REQUIRED");const i=new Set;for(const t of e)for(const e of Ha(t,o))i.add(e);n=Array.from(i).filter(e=>!r.includes(e))}else{const t=new Set;for(const r of e)for(const e of Ha(r,o))t.add(e);n=Array.from(t)}const i=[],a=[],s=new Set;for(const r of e){const e=pa(r)?Ga(n.map(e=>fa(r,e,o))):Ga(r);s.has(e)?a.push(r):(s.add(e),i.push(t.removeOtherFields?qa(r,n,o):r))}return{kept:i,discarded:a}}k([w(),Ut({handle:"value"}),C("design:type",Object)],ja.prototype,"value",void 0),k([w(),i("ngx-decaf-crud-field",{label:"graph.node.data.split_out.fields.field.label",placeholder:"graph.node.data.split_out.fields.field.placeholder",type:"text"}),Ut({handle:"field",userControlled:!0}),C("design:type",String)],ja.prototype,"field",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.split_out.fields.include.label",type:"select"}),Ut({handle:"include",userControlled:!0}),C("design:type",String)],ja.prototype,"include",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.split_out.fields.destinationField.label",placeholder:"graph.node.data.split_out.fields.destinationField.placeholder",type:"text"}),Ut({handle:"destinationField",userControlled:!0}),C("design:type",String)],ja.prototype,"destinationField",void 0),k([w(),$t({handle:"result"}),C("design:type",Array)],ja.prototype,"result",void 0),ja=k([Mt("core.data.splitOut",{kind:"core.data.splitOut",category:"Data",color:"#8b5cf6",icon:"ti-arrows-split-2",width:96,height:96,labels:["data","split","array"],metadata:{title:"graph.node.data.split_out.name",description:"graph.node.data.split_out.description"}}),I()],ja);const Xa={append:"appended_",average:"average_",concatenate:"concatenated_",count:"count_",countUnique:"unique_count_",max:"max_",min:"min_",sum:"sum_"};function Ya(e,t,o){const r=t.field??"",n=e.map(e=>r?fa(e,r,o):e),i=t.includeEmpty?n:n.filter(e=>!(e=>null==e||""===e)(e));switch(t.aggregation){case"append":return i;case"concatenate":{const e="other"===t.separator?t.customSeparator??"":t.separator??",";return i.map(e=>void 0===e?"undefined":"object"==typeof e?JSON.stringify(e):e+"").join(e)}case"average":{const e=i.filter(e=>"number"==typeof e&&Number.isFinite(e));return 0===e.length?null:e.reduce((e,t)=>e+t,0)/e.length}case"sum":return i.filter(e=>"number"==typeof e&&Number.isFinite(e)).reduce((e,t)=>e+t,0);case"min":{let e;for(const t of i)null!=t&&""!==t&&(void 0===e||e>t)&&(e=t);return e??null}case"max":{let e;for(const t of i)null!=t&&""!==t&&(void 0===e||t>e)&&(e=t);return e??null}case"countUnique":return new Set(i.map(e=>Ga(e))).size;default:return i.length}}function Za(e,t,o){const r={};for(const n of t){const t=n.field??"",i=Ma(`${Xa[n.aggregation]??"count_"}${t}`);ga(i,i),r[i]=Ya(e,n,o)}return r}function es(e){return void 0===e?"undefined":null===e?"null":"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e||"bigint"==typeof e?e+"":Ga(e)}function ts(e,t,o,r,n){if(o>=t.length)return[];const i=t[o],a=new Map;for(const t of e){let e=fa(t,i,r);if(e&&"object"==typeof e&&(e=JSON.stringify(e)),n&&"number"!=typeof e&&!e)continue;const o=Ga(e),s=a.get(o)??{value:e,items:[]};s.items.push(t),a.set(o,s)}const s=o===t.length-1;return Array.from(a.values()).map(e=>({field:i,value:e.value,...s?{items:e.items}:{children:ts(e.items,t,o+1,r,n)}}))}function os(e,t,o={}){const r=!1!==o.dotNotation,n=La(o.fieldsToSplitBy,"Fields To Split By"),i=o.outputFormat??"separateItems";if(!o.continueIfFieldNotFound)for(const o of t){const t=o.field??"";if(t&&!e.some(e=>void 0!==fa(e,t,r)))throw new Cr(`The field '${t}' does not exist in any items`,"GRAPH_SUMMARIZE_FIELD_NOT_FOUND",{field:t})}if(0===n.length)return[Za(e,t,r)];const a=ts(e,n,n.length>0?0:-1,r,!0===o.skipEmptySplitFields);if("singleItem"===i){const o=Za(e,t,r),n=(e,o)=>{for(const i of e){const e=Ma(i.field);ga(e,e);const a=o[e]??{};o[e]=a;const s=es(i.value);if(ga(s,s),i.children&&i.children.length>0){const e=a[s]??{};a[s]=e,n(i.children,e)}else i.items&&(a[s]=Za(i.items,t,r))}};return n(a,o),[o]}const s=[],d=(e,o,n)=>{for(const i of e){const e=[...o,i.field],a=[...n,i.value];if(i.children&&i.children.length>0)d(i.children,e,a);else if(i.items){const o=Za(i.items,t,r);e.forEach((e,t)=>{const r=Ma(e);ga(r,r),o[r]=a[t]}),s.push(o)}}};return d(a,[],[]),s}let rs=class extends Wi{constructor(){super(...arguments),this.aggregate="aggregateIndividualFields",this.fieldsToAggregate=[],this.destinationFieldName="data",this.include="allFields",this.mergeLists=!1,this.keepMissing=!1,this.disableDotNotation=!1}execute(e){const t=ua(e.inputs.value);if("aggregateAllItemData"===this.aggregate){const e=this.destinationFieldName||"data";return{result:{[e]:Va(t,{include:this.include,fieldsToInclude:La(this.fieldsToInclude,"Fields To Include"),fieldsToExclude:La(this.fieldsToExclude,"Fields To Exclude")})}}}const o=(this.fieldsToAggregate??[]).filter(e=>e&&(e.field||e.fieldToAggregate));if(0===o.length)throw new Cr("Aggregate node requires at least one field to aggregate","GRAPH_AGGREGATE_FIELDS_REQUIRED");return{result:Ka(t,o,{dotNotation:!0!==this.disableDotNotation,mergeLists:!0===this.mergeLists,keepMissing:!0===this.keepMissing})}}};k([w(),Ut({handle:"value"}),C("design:type",Object)],rs.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.aggregate.fields.aggregate.label",type:"select"}),Ut({handle:"aggregate",userControlled:!0}),C("design:type",String)],rs.prototype,"aggregate",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.aggregate.fields.fieldsToAggregate.label",placeholder:"graph.node.data.aggregate.fields.fieldsToAggregate.placeholder",type:"collection"}),Ut({handle:"fieldsToAggregate",userControlled:!0,type:"array"}),C("design:type",Array)],rs.prototype,"fieldsToAggregate",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.aggregate.fields.destinationFieldName.label",type:"text"}),Ut({handle:"destinationFieldName",userControlled:!0}),C("design:type",String)],rs.prototype,"destinationFieldName",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.aggregate.fields.include.label",type:"select"}),Ut({handle:"include",userControlled:!0}),C("design:type",String)],rs.prototype,"include",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.aggregate.fields.fieldsToInclude.label",placeholder:"graph.node.data.aggregate.fields.fieldsToInclude.placeholder",type:"text"}),Ut({handle:"fieldsToInclude",userControlled:!0}),C("design:type",Object)],rs.prototype,"fieldsToInclude",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.aggregate.fields.fieldsToExclude.label",placeholder:"graph.node.data.aggregate.fields.fieldsToExclude.placeholder",type:"text"}),Ut({handle:"fieldsToExclude",userControlled:!0}),C("design:type",Object)],rs.prototype,"fieldsToExclude",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.aggregate.fields.mergeLists.label",type:"checkbox"}),Ut({handle:"mergeLists",userControlled:!0}),C("design:type",Boolean)],rs.prototype,"mergeLists",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.aggregate.fields.keepMissing.label",type:"checkbox"}),Ut({handle:"keepMissing",userControlled:!0}),C("design:type",Boolean)],rs.prototype,"keepMissing",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.aggregate.fields.disableDotNotation.label",type:"checkbox"}),Ut({handle:"disableDotNotation",userControlled:!0}),C("design:type",Boolean)],rs.prototype,"disableDotNotation",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],rs.prototype,"result",void 0),rs=k([Mt("core.data.aggregate",{kind:"core.data.aggregate",category:"Data",color:"#8b5cf6",icon:"ti-box-multiple",width:96,height:96,labels:["data","aggregate","group"],metadata:{title:"graph.node.data.aggregate.name",description:"graph.node.data.aggregate.description"}}),I()],rs);let ns=class extends Wi{constructor(){super(...arguments),this.operation="concatenateItems",this.aggregate="aggregateIndividualFields",this.fieldsToAggregate=[],this.destinationFieldName="data",this.include="allFields",this.mergeLists=!1,this.keepMissing=!1,this.maxItems=1,this.keep="firstItems",this.compareMode="allFields",this.removeOtherFields=!1,this.sortFields=[],this.sortValueType="auto",this.field="",this.splitOutInclude="noOtherFields",this.fieldsToSummarize=[],this.outputFormat="separateItems",this.skipEmptySplitFields=!1,this.continueIfFieldNotFound=!1,this.disableDotNotation=!1}execute(e){const t=ua(e.inputs.value);switch(this.operation){case"limit":{const e=Math.max(0,Math.floor(Number(this.maxItems??1)));return{result:"lastItems"===this.keep?t.slice(Math.max(0,t.length-e)):t.slice(0,e)}}case"removeDuplicates":{const{kept:e,discarded:o}=Ja(t,{compare:this.compareMode,fieldsToExclude:this.fieldsToExclude,fieldsToCompare:this.fieldsToCompare,removeOtherFields:!0===this.removeOtherFields,dotNotation:!0!==this.disableDotNotation});return{result:e,discarded:o}}case"sort":return{result:za(t,this.sortFields??[],!0!==this.disableDotNotation,this.sortValueType??"auto")};case"splitOutItems":if(!this.field)throw new Cr("Item Lists node split out operation requires a field name","GRAPH_ITEM_LISTS_FIELD_REQUIRED");return{result:Qa(t,this.field,{include:this.splitOutInclude,destinationField:this.destinationField,dotNotation:!0!==this.disableDotNotation})};case"summarize":{const e=(this.fieldsToSummarize??[]).filter(e=>e&&"string"==typeof e.aggregation);if(0===e.length)throw new Cr("Item Lists node summarize operation requires at least one field","GRAPH_SUMMARIZE_FIELDS_REQUIRED");return{result:os(t,e,{fieldsToSplitBy:La(this.fieldsToSplitBy,"Fields To Split By"),outputFormat:this.outputFormat,skipEmptySplitFields:!0===this.skipEmptySplitFields,dotNotation:!0!==this.disableDotNotation,continueIfFieldNotFound:!0===this.continueIfFieldNotFound})}}case"concatenateItems":break;default:throw new Cr(`Item Lists operation '${this.operation+""}' is not supported`,"GRAPH_ITEM_LISTS_UNSUPPORTED_OPERATION",{operation:this.operation})}if("aggregateAllItemData"===this.aggregate){const e=this.destinationFieldName||"data";return{result:{[e]:Va(t,{include:this.include,fieldsToInclude:La(this.fieldsToInclude,"Fields To Include"),fieldsToExclude:La(this.fieldsToExclude,"Fields To Exclude")})}}}const o=(this.fieldsToAggregate??[]).filter(e=>e&&(e.field||e.fieldToAggregate));if(0===o.length)throw new Cr("Item Lists node concatenate operation requires at least one field","GRAPH_AGGREGATE_FIELDS_REQUIRED");return{result:Ka(t,o,{dotNotation:!0!==this.disableDotNotation,mergeLists:!0===this.mergeLists,keepMissing:!0===this.keepMissing})}}};function is(e){const t=e?.field1??e?.fieldA,o=e?.field2??e?.fieldB;if(t&&o)return{a:t,b:o}}function as(e){return pa(e)?Object.keys(e):[]}function ss(e,t,o,r){const n=pa(e)?e:{value:e},i=pa(t)?t:{value:t},a={};for(const e of o)a[e.a]=fa(n,e.a,r.dotNotation);const s=Array.from(new Set([...as(n),...as(i)])),d={},l={};for(const e of s){if(r.skipFields.includes(e))continue;const t=fa(n,e,r.dotNotation),o=fa(i,e,r.dotNotation);r.equals(t,o)?d[e]=t:l[e]={inputA:t,inputB:o}}return{keys:a,same:d,different:l}}k([w(),Ut({handle:"value"}),C("design:type",Object)],ns.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],ns.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.aggregate.label",type:"select"}),Ut({handle:"aggregate",userControlled:!0}),C("design:type",String)],ns.prototype,"aggregate",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.fieldsToAggregate.label",placeholder:"graph.node.data.item_lists.fields.fieldsToAggregate.placeholder",type:"collection"}),Ut({handle:"fieldsToAggregate",userControlled:!0,type:"array"}),C("design:type",Array)],ns.prototype,"fieldsToAggregate",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.destinationFieldName.label",type:"text"}),Ut({handle:"destinationFieldName",userControlled:!0}),C("design:type",String)],ns.prototype,"destinationFieldName",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.include.label",type:"select"}),Ut({handle:"include",userControlled:!0}),C("design:type",String)],ns.prototype,"include",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.fieldsToInclude.label",placeholder:"graph.node.data.item_lists.fields.fieldsToInclude.placeholder",type:"text"}),Ut({handle:"fieldsToInclude",userControlled:!0}),C("design:type",Object)],ns.prototype,"fieldsToInclude",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.fieldsToExclude.label",placeholder:"graph.node.data.item_lists.fields.fieldsToExclude.placeholder",type:"text"}),Ut({handle:"fieldsToExclude",userControlled:!0}),C("design:type",Object)],ns.prototype,"fieldsToExclude",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.mergeLists.label",type:"checkbox"}),Ut({handle:"mergeLists",userControlled:!0}),C("design:type",Boolean)],ns.prototype,"mergeLists",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.keepMissing.label",type:"checkbox"}),Ut({handle:"keepMissing",userControlled:!0}),C("design:type",Boolean)],ns.prototype,"keepMissing",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.maxItems.label",type:"number"}),Ut({handle:"maxItems",userControlled:!0}),C("design:type",Number)],ns.prototype,"maxItems",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.keep.label",type:"select"}),Ut({handle:"keep",userControlled:!0}),C("design:type",String)],ns.prototype,"keep",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.compareMode.label",type:"select"}),Ut({handle:"compareMode",userControlled:!0}),C("design:type",String)],ns.prototype,"compareMode",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.fieldsToCompare.label",placeholder:"graph.node.data.item_lists.fields.fieldsToCompare.placeholder",type:"text"}),Ut({handle:"fieldsToCompare",userControlled:!0}),C("design:type",Object)],ns.prototype,"fieldsToCompare",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.removeOtherFields.label",type:"checkbox"}),Ut({handle:"removeOtherFields",userControlled:!0}),C("design:type",Boolean)],ns.prototype,"removeOtherFields",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.sortFields.label",placeholder:"graph.node.data.item_lists.fields.sortFields.placeholder",type:"collection"}),Ut({handle:"sortFields",userControlled:!0,type:"array"}),C("design:type",Array)],ns.prototype,"sortFields",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.sortValueType.label",type:"select"}),Ut({handle:"sortValueType",userControlled:!0}),C("design:type",String)],ns.prototype,"sortValueType",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.field.label",placeholder:"graph.node.data.item_lists.fields.field.placeholder",type:"text"}),Ut({handle:"field",userControlled:!0}),C("design:type",String)],ns.prototype,"field",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.splitOutInclude.label",type:"select"}),Ut({handle:"splitOutInclude",userControlled:!0}),C("design:type",String)],ns.prototype,"splitOutInclude",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.destinationField.label",placeholder:"graph.node.data.item_lists.fields.destinationField.placeholder",type:"text"}),Ut({handle:"destinationField",userControlled:!0}),C("design:type",String)],ns.prototype,"destinationField",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.fieldsToSummarize.label",placeholder:"graph.node.data.item_lists.fields.fieldsToSummarize.placeholder",type:"collection"}),Ut({handle:"fieldsToSummarize",userControlled:!0,type:"array"}),C("design:type",Array)],ns.prototype,"fieldsToSummarize",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.fieldsToSplitBy.label",placeholder:"graph.node.data.item_lists.fields.fieldsToSplitBy.placeholder",type:"text"}),Ut({handle:"fieldsToSplitBy",userControlled:!0}),C("design:type",Object)],ns.prototype,"fieldsToSplitBy",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.outputFormat.label",type:"select"}),Ut({handle:"outputFormat",userControlled:!0}),C("design:type",String)],ns.prototype,"outputFormat",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.skipEmptySplitFields.label",type:"checkbox"}),Ut({handle:"skipEmptySplitFields",userControlled:!0}),C("design:type",Boolean)],ns.prototype,"skipEmptySplitFields",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.continueIfFieldNotFound.label",type:"checkbox"}),Ut({handle:"continueIfFieldNotFound",userControlled:!0}),C("design:type",Boolean)],ns.prototype,"continueIfFieldNotFound",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.item_lists.fields.disableDotNotation.label",type:"checkbox"}),Ut({handle:"disableDotNotation",userControlled:!0}),C("design:type",Boolean)],ns.prototype,"disableDotNotation",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],ns.prototype,"result",void 0),k([$t({handle:"discarded"}),C("design:type",Array)],ns.prototype,"discarded",void 0),ns=k([Mt("core.data.itemLists",{kind:"core.data.itemLists",category:"Data",color:"#8b5cf6",icon:"ti-list-details",width:96,height:96,labels:["data","list","items","transform"],metadata:{title:"graph.node.data.item_lists.name",description:"graph.node.data.item_lists.description"}}),I()],ns);let ds=class extends Wi{constructor(){super(...arguments),this.fieldsToMatch=[],this.resolve="includeBoth",this.multipleMatches="first",this.fuzzyCompare=!1,this.preferWhenMix="input1",this.disableDotNotation=!1}execute(e){const t=(this.fieldsToMatch??[]).map(is).filter(e=>void 0!==e);if(0===t.length)throw new Cr("Compare Datasets node requires at least one pair of fields to match on","GRAPH_COMPARE_DATASETS_MATCH_FIELDS_REQUIRED");const o=!0!==this.disableDotNotation,r=this.fuzzyCompare?Fa:Ua,n=La(this.skipFields,"Fields to Skip"),i=La(this.exceptWhenMix,"For Everything Except"),a=ua(e.inputs.input),s=ua(e.inputs.input2),d="all"===this.multipleMatches?"all":"first",l=this.resolve??"includeBoth",c=[],p=[],u=[],g=[],h=new Set;for(const e of a){if(t.map(t=>({field:t.b,value:fa(e,t.a,o)})).some(e=>void 0===e.value)){c.push(e);continue}const a=[];for(let n=0;n<s.length;n++){const i=s[n];if(t.every(t=>r(fa(e,t.a,o),fa(i,t.b,o)))&&(a.push({item:i,index:n}),"first"===d))break}if(0===a.length){c.push(e);continue}let g;for(const s of a){h.add(s.index);const a=Ba(e,n,o),d=Ba(s.item,n,o);if(r(a,d))void 0===g&&(g=this.fuzzyCompare&&"preferInput2"===l?s.item:e);else switch(l){case"preferInput1":u.push(e);break;case"preferInput2":u.push(s.item);break;case"mix":{const t="input2"===this.preferWhenMix?s.item:e,r="input2"===this.preferWhenMix?e:s.item;if(0===i.length){u.push(t);break}const n=pa(t)?{...t}:{value:t},a=pa(r)?r:{value:r};for(const e of i){const t=fa(a,e,o);if(!o){n[e]=t;continue}const r=e.split(".").filter(Boolean);let i=n;for(let e=0;e<r.length-1;e++){const t=i[r[e]];if(pa(t))i=t;else{const t={};i[r[e]]=t,i=t}}i[r[r.length-1]]=t}u.push(n);break}default:u.push(ss(e,s.item,t,{skipFields:n,dotNotation:o,equals:r}))}}void 0!==g&&p.push(g)}return s.forEach((e,t)=>{h.has(t)||g.push(e)}),{onlyInA:c,same:p,different:u,onlyInB:g}}};k([w(),Ut({handle:"input"}),C("design:type",Object)],ds.prototype,"input",void 0),k([w(),Ut({handle:"input2"}),C("design:type",Object)],ds.prototype,"input2",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.compare_datasets.fields.fieldsToMatch.label",placeholder:"graph.node.data.compare_datasets.fields.fieldsToMatch.placeholder",type:"collection"}),Ut({handle:"fieldsToMatch",userControlled:!0,type:"array"}),C("design:type",Array)],ds.prototype,"fieldsToMatch",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.compare_datasets.fields.resolve.label",type:"select"}),Ut({handle:"resolve",userControlled:!0}),C("design:type",String)],ds.prototype,"resolve",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.compare_datasets.fields.multipleMatches.label",type:"select"}),Ut({handle:"multipleMatches",userControlled:!0}),C("design:type",String)],ds.prototype,"multipleMatches",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.compare_datasets.fields.fuzzyCompare.label",type:"checkbox"}),Ut({handle:"fuzzyCompare",userControlled:!0}),C("design:type",Boolean)],ds.prototype,"fuzzyCompare",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.compare_datasets.fields.preferWhenMix.label",type:"select"}),Ut({handle:"preferWhenMix",userControlled:!0}),C("design:type",String)],ds.prototype,"preferWhenMix",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.compare_datasets.fields.exceptWhenMix.label",placeholder:"graph.node.data.compare_datasets.fields.exceptWhenMix.placeholder",type:"text"}),Ut({handle:"exceptWhenMix",userControlled:!0}),C("design:type",Object)],ds.prototype,"exceptWhenMix",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.compare_datasets.fields.skipFields.label",placeholder:"graph.node.data.compare_datasets.fields.skipFields.placeholder",type:"text"}),Ut({handle:"skipFields",userControlled:!0}),C("design:type",Object)],ds.prototype,"skipFields",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.compare_datasets.fields.disableDotNotation.label",type:"checkbox"}),Ut({handle:"disableDotNotation",userControlled:!0}),C("design:type",Boolean)],ds.prototype,"disableDotNotation",void 0),k([w(),$t({handle:"onlyInA"}),C("design:type",Array)],ds.prototype,"onlyInA",void 0),k([$t({handle:"same"}),C("design:type",Array)],ds.prototype,"same",void 0),k([$t({handle:"different"}),C("design:type",Array)],ds.prototype,"different",void 0),k([$t({handle:"onlyInB"}),C("design:type",Array)],ds.prototype,"onlyInB",void 0),ds=k([Mt("core.data.compareDatasets",{kind:"core.data.compareDatasets",category:"Data",color:"#8b5cf6",icon:"ti-git-compare",width:96,height:96,labels:["data","compare","diff","datasets"],metadata:{title:"graph.node.data.compare_datasets.name",description:"graph.node.data.compare_datasets.description"}}),I()],ds);let ls=class extends Wi{constructor(){super(...arguments),this.fieldsToSummarize=[],this.outputFormat="separateItems",this.skipEmptySplitFields=!1,this.disableDotNotation=!1,this.continueIfFieldNotFound=!1}execute(e){const t=ua(e.inputs.value),o=(this.fieldsToSummarize??[]).filter(e=>e&&"string"==typeof e.aggregation);if(0===o.length)throw new Cr("Summarize node requires at least one field to summarize","GRAPH_SUMMARIZE_FIELDS_REQUIRED");return{result:os(t,o,{fieldsToSplitBy:La(this.fieldsToSplitBy,"Fields To Split By"),outputFormat:this.outputFormat,skipEmptySplitFields:!0===this.skipEmptySplitFields,dotNotation:!0!==this.disableDotNotation,continueIfFieldNotFound:!0===this.continueIfFieldNotFound})}}};k([w(),Ut({handle:"value"}),C("design:type",Object)],ls.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.summarize.fields.fieldsToSummarize.label",placeholder:"graph.node.data.summarize.fields.fieldsToSummarize.placeholder",type:"collection"}),Ut({handle:"fieldsToSummarize",userControlled:!0,type:"array"}),C("design:type",Array)],ls.prototype,"fieldsToSummarize",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.summarize.fields.fieldsToSplitBy.label",placeholder:"graph.node.data.summarize.fields.fieldsToSplitBy.placeholder",type:"text"}),Ut({handle:"fieldsToSplitBy",userControlled:!0}),C("design:type",Object)],ls.prototype,"fieldsToSplitBy",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.summarize.fields.outputFormat.label",type:"select"}),Ut({handle:"outputFormat",userControlled:!0}),C("design:type",String)],ls.prototype,"outputFormat",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.summarize.fields.skipEmptySplitFields.label",type:"checkbox"}),Ut({handle:"skipEmptySplitFields",userControlled:!0}),C("design:type",Boolean)],ls.prototype,"skipEmptySplitFields",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.summarize.fields.disableDotNotation.label",type:"checkbox"}),Ut({handle:"disableDotNotation",userControlled:!0}),C("design:type",Boolean)],ls.prototype,"disableDotNotation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.summarize.fields.continueIfFieldNotFound.label",type:"checkbox"}),Ut({handle:"continueIfFieldNotFound",userControlled:!0}),C("design:type",Boolean)],ls.prototype,"continueIfFieldNotFound",void 0),k([w(),$t({handle:"result"}),C("design:type",Array)],ls.prototype,"result",void 0),ls=k([Mt("core.data.summarize",{kind:"core.data.summarize",category:"Data",color:"#8b5cf6",icon:"ti-chart-dots",width:96,height:96,labels:["data","summarize","pivot","aggregate"],metadata:{title:"graph.node.data.summarize.name",description:"graph.node.data.summarize.description"}}),I()],ls);let cs=class extends Wi{constructor(){super(...arguments),this.compareMode="allFields",this.removeOtherFields=!1,this.disableDotNotation=!1}execute(e){const t=ua(e.inputs.value),{kept:o,discarded:r}=Ja(t,{compare:this.compareMode,fieldsToExclude:this.fieldsToExclude,fieldsToCompare:this.fieldsToCompare,removeOtherFields:!0===this.removeOtherFields,dotNotation:!0!==this.disableDotNotation});return{result:o,discarded:r}}};function ps(e,t){if("string"==typeof e){if(e.startsWith("data:")){const t=e.indexOf(",");if(t>=0)return Buffer.from(e.slice(t+1),"base64").toString("utf8")}return"base64"===t?Buffer.from(e,"base64").toString("utf8"):e}if(_a(e))return(Buffer.isBuffer(e)?e:Buffer.from(e instanceof ArrayBuffer?new Uint8Array(e):e)).toString("utf8");if(pa(e)){if("string"==typeof e.data)return ps(e.data,t);if("string"==typeof e.content)return ps(e.content,t);throw new Cr("Extract from File node received an object without file content","GRAPH_EXTRACT_FROM_FILE_INVALID_INPUT")}throw new Cr("Extract from File node requires a file payload","GRAPH_EXTRACT_FROM_FILE_INVALID_INPUT",{valueType:typeof e})}k([w(),Ut({handle:"value"}),C("design:type",Object)],cs.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.remove_duplicates.fields.compareMode.label",type:"select"}),Ut({handle:"compareMode",userControlled:!0}),C("design:type",String)],cs.prototype,"compareMode",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.remove_duplicates.fields.fieldsToCompare.label",placeholder:"graph.node.data.remove_duplicates.fields.fieldsToCompare.placeholder",type:"text"}),Ut({handle:"fieldsToCompare",userControlled:!0}),C("design:type",Object)],cs.prototype,"fieldsToCompare",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.remove_duplicates.fields.fieldsToExclude.label",placeholder:"graph.node.data.remove_duplicates.fields.fieldsToExclude.placeholder",type:"text"}),Ut({handle:"fieldsToExclude",userControlled:!0}),C("design:type",Object)],cs.prototype,"fieldsToExclude",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.remove_duplicates.fields.removeOtherFields.label",type:"checkbox"}),Ut({handle:"removeOtherFields",userControlled:!0}),C("design:type",Boolean)],cs.prototype,"removeOtherFields",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.data.remove_duplicates.fields.disableDotNotation.label",type:"checkbox"}),Ut({handle:"disableDotNotation",userControlled:!0}),C("design:type",Boolean)],cs.prototype,"disableDotNotation",void 0),k([w(),$t({handle:"result"}),C("design:type",Array)],cs.prototype,"result",void 0),k([$t({handle:"discarded"}),C("design:type",Array)],cs.prototype,"discarded",void 0),cs=k([Mt("core.data.removeDuplicates",{kind:"core.data.removeDuplicates",category:"Data",color:"#8b5cf6",icon:"ti-copy-off",width:96,height:96,labels:["data","dedupe","duplicates","unique"],metadata:{title:"graph.node.data.remove_duplicates.name",description:"graph.node.data.remove_duplicates.description"}}),I()],cs);let us=class extends Wi{constructor(){super(...arguments),this.format="json",this.encoding="utf8",this.delimiter=",",this.headerRow=!0}execute(e){const t=ps(e.inputs.value,this.encoding??"utf8");switch(this.format){case"json":try{return{result:JSON.parse(t)}}catch(e){throw new Cr("Extract from File node could not parse JSON: "+(e instanceof Error?e.message:e+""),"GRAPH_EXTRACT_FROM_FILE_INVALID_JSON")}case"csv":{const e=((e,t,o)=>{const r=((e,t)=>{const o=[];let r=[],n="",i=!1;for(let a=0;a<e.length;a++){const s=e[a];i?'"'===s?'"'===e[a+1]?(n+='"',a++):i=!1:n+=s:'"'!==s?s!==t?"\n"!==s?"\r"!==s&&(n+=s):(r.push(n),o.push(r),r=[],n=""):(r.push(n),n=""):i=!0}return(n.length>0||r.length>0)&&(r.push(n),o.push(r)),o.filter(e=>e.length>1||(e[0]??"").trim().length>0)})(e,t);if(0===r.length)return[];const n=o?r[0]:r[0].map((e,t)=>"column"+t);return(o?r.slice(1):r).map(e=>{const t={};for(let o=0;o<n.length;o++)t[n[o]]=e[o]??"";return t})})(t,this.delimiter||",",!1!==this.headerRow);return{result:e,rows:e.length}}case"text":return{result:t};default:throw new Cr(`Unsupported file extraction format '${this.format+""}'`,"GRAPH_EXTRACT_FROM_FILE_UNSUPPORTED_FORMAT",{format:this.format})}}};k([w(),Ut({handle:"value"}),C("design:type",Object)],us.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.extract_from_file.fields.format.label",type:"select"}),Ut({handle:"format",userControlled:!0}),C("design:type",String)],us.prototype,"format",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.extract_from_file.fields.encoding.label",type:"select"}),Ut({handle:"encoding",userControlled:!0}),C("design:type",String)],us.prototype,"encoding",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.extract_from_file.fields.delimiter.label",type:"text"}),Ut({handle:"delimiter",userControlled:!0}),C("design:type",String)],us.prototype,"delimiter",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.extract_from_file.fields.headerRow.label",type:"checkbox"}),Ut({handle:"headerRow",userControlled:!0}),C("design:type",Boolean)],us.prototype,"headerRow",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],us.prototype,"result",void 0),k([$t({handle:"rows"}),C("design:type",Number)],us.prototype,"rows",void 0),us=k([Mt("core.io.extractFromFile",{kind:"core.io.extractFromFile",category:"IO",color:"#0ea5e9",icon:"ti-file-import",width:96,height:96,labels:["io","file","extract"],metadata:{title:"graph.node.io.extract_from_file.name",description:"graph.node.io.extract_from_file.description"}}),I()],us);const gs=new Set(["http:","https:"]);let hs=class extends Wi{constructor(){super(...arguments),this.url="",this.method="GET",this.responseFormat="json",this.failOnError=!1}async execute(e,t){if(!this.url)throw new Cr("HTTP Request node requires a URL","GRAPH_HTTP_URL_REQUIRED");let o;try{o=new URL(this.url)}catch{throw new Cr(`HTTP Request node URL '${this.url}' is invalid`,"GRAPH_HTTP_INVALID_URL",{url:this.url})}if(!gs.has(o.protocol))throw new Cr(`HTTP Request node protocol '${o.protocol}' is not allowed`,"GRAPH_HTTP_PROTOCOL_NOT_ALLOWED",{protocol:o.protocol});this.appendQuery(o);const r=this.method??"GET",n={};for(const[e,t]of Object.entries(this.headers??{}))"string"==typeof t&&e.trim().length>0&&(n[e.trim()]=t);const i=this.resolveBody(e,r);void 0!==i&&void 0===n["content-type"]&&(n["content-type"]="application/json");const a=this.resolveTimeoutMs(),s=new AbortController,d=setTimeout(()=>s.abort(),a);d.unref?.();const l=()=>s.abort();t.abortSignal?.addEventListener("abort",l,{once:!0});try{const{response:e,url:t}=await this.fetchFollowingRedirects(o,{method:r,headers:n,body:i,signal:s.signal}),a=await this.readCappedResponseText(e),d=Object.fromEntries(e.headers.entries()),l="text"===this.responseFormat?a:this.parseResponse(a);if(!0===this.failOnError&&!e.ok)throw new Cr("HTTP Request node received status "+e.status,"GRAPH_HTTP_REQUEST_FAILED",{status:e.status,url:t.toString()});return{result:l,status:e.status,headers:d}}catch(e){if(e instanceof Cr)throw e;if(s.signal.aborted)throw new Cr(`HTTP Request node timed out after ${a}ms`,"GRAPH_HTTP_REQUEST_TIMEOUT",{url:o.toString(),timeoutMs:a});throw new Cr("HTTP Request node failed: "+(e instanceof Error?e.message:e+""),"GRAPH_HTTP_REQUEST_FAILED",{url:o.toString()})}finally{clearTimeout(d),t.abortSignal?.removeEventListener("abort",l)}}resolveTimeoutMs(){const e=Number(this.timeoutMs);return Number.isFinite(e)&&e>0?Math.min(e,fr):3e4}async fetchFollowingRedirects(e,t){let o=e,r=t;for(let e=0;5>=e;e++){const t=await fetch(o,{...r,redirect:"manual"});if(!this.isRedirectStatus(t.status))return{response:t,url:o};const n=t.headers.get("location");if(!n)return{response:t,url:o};if(5===e)throw await this.discardResponseBody(t),new Cr("HTTP Request node exceeded the maximum of 5 redirects","GRAPH_HTTP_TOO_MANY_REDIRECTS",{url:o.toString(),maxRedirects:5});let i;try{i=new URL(n,o)}catch{throw await this.discardResponseBody(t),new Cr(`HTTP Request node redirect target '${n}' is invalid`,"GRAPH_HTTP_INVALID_URL",{location:n})}if(!gs.has(i.protocol))throw await this.discardResponseBody(t),new Cr(`HTTP Request node redirect protocol '${i.protocol}' is not allowed`,"GRAPH_HTTP_PROTOCOL_NOT_ALLOWED",{protocol:i.protocol,url:i.toString()});if(await this.discardResponseBody(t),303===t.status){r={...r,method:"GET",body:void 0};const e={...r.headers};for(const t of Object.keys(e))"content-type"===t.toLowerCase()&&delete e[t];r={...r,headers:e}}o=i}return{response:void 0,url:o}}isRedirectStatus(e){return 301===e||302===e||303===e||307===e||308===e}async discardResponseBody(e){try{await(e.body?.cancel())}catch{}}async readCappedResponseText(e){if(!e.body)return"";const t=e.body.getReader(),o=[];let r=0;try{for(;;){const{done:e,value:n}=await t.read();if(e)break;if(n){if(r+=n.byteLength,r>yr){try{await t.cancel()}catch{}throw new Cr("HTTP Request node response body exceeds the 10485760-byte limit","GRAPH_HTTP_RESPONSE_TOO_LARGE",{limitBytes:yr})}o.push(n)}}}finally{t.releaseLock?.()}return Buffer.concat(o.map(e=>Buffer.from(e))).toString("utf8")}appendQuery(e){for(const[t,o]of Object.entries(this.query??{}))if(null!=o)if(Array.isArray(o))for(const r of o)null!=r&&e.searchParams.append(t,r+"");else e.searchParams.append(t,o+"")}resolveBody(e,t){if("GET"===t||"HEAD"===t)return;const o=void 0!==this.body?this.body:e.inputs.value;return null!=o?"string"==typeof o||"undefined"!=typeof Buffer&&Buffer.isBuffer(o)||o instanceof Uint8Array?o:JSON.stringify(o):void 0}parseResponse(e){if(0===e.length)return null;try{return JSON.parse(e)}catch{return e}}};function fs(e,t){if("string"==typeof e){if(e.startsWith("data:")){const t=e.indexOf(",");return Buffer.from(e.slice(t+1),"base64")}return"base64"===t?Buffer.from(e,"base64"):Buffer.from(e,"utf8")}if(pa(e)){const o=e.data??e.content;if(void 0!==o)return fs(o,t)}if(_a(e))return Buffer.isBuffer(e)?e:Buffer.from(e instanceof ArrayBuffer?new Uint8Array(e):e);throw new Cr("Read PDF node requires a PDF file payload","GRAPH_READ_PDF_INVALID_INPUT",{valueType:typeof e})}k([Ut({handle:"value"}),C("design:type",Object)],hs.prototype,"value",void 0),k([w(),i("ngx-decaf-crud-field",{label:"graph.node.io.http_request.fields.url.label",placeholder:"graph.node.io.http_request.fields.url.placeholder",type:"text"}),Ut({handle:"url",userControlled:!0}),C("design:type",String)],hs.prototype,"url",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.http_request.fields.method.label",type:"select"}),Ut({handle:"method",userControlled:!0}),C("design:type",String)],hs.prototype,"method",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.http_request.fields.headers.label",type:"json"}),Ut({handle:"headers",userControlled:!0,type:"object"}),C("design:type",Object)],hs.prototype,"headers",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.http_request.fields.query.label",type:"json"}),Ut({handle:"query",userControlled:!0,type:"object"}),C("design:type",Object)],hs.prototype,"query",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.http_request.fields.body.label",type:"json"}),Ut({handle:"body",userControlled:!0,type:"object"}),C("design:type",Object)],hs.prototype,"body",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.http_request.fields.responseFormat.label",type:"select"}),Ut({handle:"responseFormat",userControlled:!0}),C("design:type",String)],hs.prototype,"responseFormat",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.http_request.fields.timeoutMs.label",type:"number"}),Ut({handle:"timeoutMs",userControlled:!0}),C("design:type",Number)],hs.prototype,"timeoutMs",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.http_request.fields.failOnError.label",type:"checkbox"}),Ut({handle:"failOnError",userControlled:!0}),C("design:type",Boolean)],hs.prototype,"failOnError",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],hs.prototype,"result",void 0),k([$t({handle:"status"}),C("design:type",Number)],hs.prototype,"status",void 0),k([$t({handle:"headers"}),C("design:type",Object)],hs.prototype,"headersOut",void 0),hs=k([Mt("core.io.httpRequest",{kind:"core.io.httpRequest",category:"IO",color:"#0ea5e9",icon:"ti-world-www",width:96,height:96,labels:["io","http","request"],metadata:{title:"graph.node.io.http_request.name",description:"graph.node.io.http_request.description"}}),I()],hs);let ys=class extends Wi{constructor(){super(...arguments),this.encoding="utf8"}async execute(e){const t=fs(e.inputs.value,this.encoding??"utf8");let o;try{o=await(import("pdf-parse"))}catch(e){throw new Cr("Read PDF node requires the 'pdf-parse' dependency: "+(e instanceof Error?e.message:e+""),"GRAPH_READ_PDF_DEPENDENCY_MISSING")}const r=o.PDFParse;if(!r)throw new Cr("Read PDF node could not resolve the PDF parser","GRAPH_READ_PDF_DEPENDENCY_MISSING");const n=new r({data:t,...this.password?{password:this.password}:{}});try{const e=await n.getText(),t=e.text??"",o=(e.pages??[]).map((e,t)=>({pageNumber:t+1,text:e.text??""}));return{result:t,pages:o}}catch(e){throw new Cr("Read PDF node failed to extract text: "+(e instanceof Error?e.message:e+""),"GRAPH_READ_PDF_FAILED")}finally{await(n.destroy?.())}}};k([w(),Ut({handle:"value"}),C("design:type",Object)],ys.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.read_pdf.fields.encoding.label",type:"select"}),Ut({handle:"encoding",userControlled:!0}),C("design:type",String)],ys.prototype,"encoding",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.read_pdf.fields.password.label",placeholder:"graph.node.io.read_pdf.fields.password.placeholder",type:"password"}),Ut({handle:"password",userControlled:!0}),C("design:type",String)],ys.prototype,"password",void 0),k([w(),$t({handle:"result"}),C("design:type",String)],ys.prototype,"result",void 0),k([$t({handle:"pages"}),C("design:type",Array)],ys.prototype,"pages",void 0),ys=k([Mt("core.io.readPDF",{kind:"core.io.readPDF",category:"IO",color:"#0ea5e9",icon:"ti-file-type-pdf",width:96,height:96,labels:["io","pdf","extract"],metadata:{title:"graph.node.io.read_pdf.name",description:"graph.node.io.read_pdf.description"}}),I()],ys);const ms=new Set(["workdocs"]);function bs(){return["/etc","/proc","/root",oe(de(),".ssh")]}function ws(e,t){const o=re(e,t);return""===o||!o.startsWith("..")&&!ie(o)}function vs(e,t,o){if(!ws(e,t))throw new Cr(`Read/Write Files from Disk node path '${o}' resolves outside the configured file IO base`,"GRAPH_READ_WRITE_FILE_PATH_FORBIDDEN",{path:o,base:e});for(const e of bs())if(ws(e,t))throw new Cr(`Read/Write Files from Disk node path '${o}' targets a forbidden directory`,"GRAPH_READ_WRITE_FILE_PATH_FORBIDDEN",{path:o});const r=re(e,t).split(ne).filter(Boolean);for(const e of r)if(ms.has(e.toLowerCase()))throw new Cr(`Read/Write Files from Disk node path '${o}' targets a forbidden directory`,"GRAPH_READ_WRITE_FILE_PATH_FORBIDDEN",{path:o,segment:e})}async function xs(e){let t=e;for(;;)try{return await ce(t)}catch{const e=te(t);if(e===t)return;t=e}}let Is=class extends Wi{constructor(){super(...arguments),this.operation="read",this.path="",this.encoding="utf8",this.append=!1,this.createDirectories=!1}async execute(e){if(!this.path)throw new Cr("Read/Write Files from Disk node requires a path","GRAPH_READ_WRITE_FILE_PATH_REQUIRED");if(this.path.includes("\0"))throw new Cr("Read/Write Files from Disk node path contains a NUL byte","GRAPH_READ_WRITE_FILE_INVALID_PATH",{path:this.path});const{base:t,candidate:o}=(e=>{const t=(()=>{const e=process.env.GRAPH_FILE_IO_BASE?.trim(),t=oe(e&&e.length>0?e:process.cwd());try{return le(t)}catch{return t}})();(e=>{if(!ie(e))return;const t=oe(e);for(const o of bs())if(ws(o,t))throw new Cr(`Read/Write Files from Disk node path '${e}' targets a forbidden directory`,"GRAPH_READ_WRITE_FILE_PATH_FORBIDDEN",{path:e})})(e);const o=e.replace(/^[/\\]+/,""),r=oe(t,o);return vs(t,r,e),{base:t,candidate:r}})(this.path);if("read"===this.operation){let e;try{e=await ce(o)}catch{throw new Cr(`Read/Write Files from Disk node path '${this.path}' does not exist`,"GRAPH_READ_WRITE_FILE_INVALID_PATH",{path:this.path})}vs(t,e,this.path);const r=await pe(e);return{result:"base64"===this.encoding?r.toString("base64"):r.toString("utf8"),bytes:r.byteLength}}const r=void 0!==this.content?this.content:e.inputs.value;if(null==r)throw new Cr("Read/Write Files from Disk node requires content to write","GRAPH_READ_WRITE_FILE_CONTENT_REQUIRED");const n="string"==typeof r?"base64"===this.encoding?Buffer.from(r,"base64"):Buffer.from(r,"utf8"):Buffer.isBuffer(r)?r:r instanceof Uint8Array?Buffer.from(r):Buffer.from(r+"","utf8"),i=await xs(o);i&&vs(t,i,this.path),this.createDirectories&&await ue(te(o),{recursive:!0}),vs(t,await ce(te(o)),this.path);const a=await xs(o);return a&&vs(t,a,this.path),this.append?await ge(o,n):await he(o,n),{result:{path:this.path,bytes:n.byteLength},bytes:n.byteLength}}};k([Ut({handle:"value"}),C("design:type",Object)],Is.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.read_write_file.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],Is.prototype,"operation",void 0),k([w(),i("ngx-decaf-crud-field",{label:"graph.node.io.read_write_file.fields.path.label",placeholder:"graph.node.io.read_write_file.fields.path.placeholder",type:"text"}),Ut({handle:"path",userControlled:!0}),C("design:type",String)],Is.prototype,"path",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.read_write_file.fields.encoding.label",type:"select"}),Ut({handle:"encoding",userControlled:!0}),C("design:type",String)],Is.prototype,"encoding",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.read_write_file.fields.content.label",type:"textarea"}),Ut({handle:"content",userControlled:!0}),C("design:type",String)],Is.prototype,"content",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.read_write_file.fields.append.label",type:"checkbox"}),Ut({handle:"append",userControlled:!0}),C("design:type",Boolean)],Is.prototype,"append",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.read_write_file.fields.createDirectories.label",type:"checkbox"}),Ut({handle:"createDirectories",userControlled:!0}),C("design:type",Boolean)],Is.prototype,"createDirectories",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],Is.prototype,"result",void 0),k([$t({handle:"bytes"}),C("design:type",Number)],Is.prototype,"bytes",void 0),Is=k([Mt("core.io.readWriteFile",{kind:"core.io.readWriteFile",category:"IO",color:"#0ea5e9",icon:"ti-device-floppy",width:96,height:96,labels:["io","file","disk"],metadata:{title:"graph.node.io.read_write_file.name",description:"graph.node.io.read_write_file.description"}}),I()],Is);let _s=class extends Wi{constructor(){super(...arguments),this.respondWith="firstIncomingItem",this.responseCode=200}async execute(e,t){const o=this.resolveBody(e),r={};for(const[e,t]of Object.entries(this.responseHeaders??{}))"string"==typeof t&&e.trim().length>0&&(r[e.trim()]=t);null!=o&&"string"!=typeof o&&void 0===r["content-type"]&&(r["content-type"]="application/json");const n={statusCode:this.responseCode??200,headers:r,body:o,runId:t.runId,respondedAt:(new Date).toISOString()},i=t.engine?.webhookResponses.deliver(t.runId,n)??!1;return await t.progress({...n,delivered:i}),{response:n,delivered:i}}resolveBody(e){const t=e.inputs.value;switch(this.respondWith){case"noData":return null;case"allIncomingItems":return ua(t);case"firstIncomingItem":return ua(t)[0]??null;case"text":return void 0===this.responseBody?null==t?"":t+"":this.responseBody+"";default:if("string"==typeof this.responseBody)try{return JSON.parse(this.responseBody)}catch{return this.responseBody}return void 0!==this.responseBody?this.responseBody:t??null}}};function Es(e){return e&&"object"==typeof e&&!Array.isArray(e)?e:void 0}function As(e){return"string"==typeof e&&e.trim().length>0?e.trim():void 0}function Ss(e,t=!1){if("boolean"==typeof e)return e;if("string"==typeof e){if("true"===e.toLowerCase())return!0;if("false"===e.toLowerCase())return!1}return t}function Rs(e){if("number"==typeof e&&Number.isFinite(e))return e;if("string"==typeof e&&e.trim().length>0){const t=Number(e);return Number.isFinite(t)?t:void 0}}function Os(e){return Array.isArray(e)?e:void 0}function ks(e,t){try{const t=Es(e);if(t)return t;const o=Es(JSON.parse(e));if(!o)throw Error("not an object");return o}catch{throw new Cr(t+" node credential must contain a JSON object","GRAPH_CREDENTIAL_INVALID_FORMAT",{node:t})}}function Cs(e,t){if(e){if("string"!=typeof e)return Array.isArray(e)?void 0:e;if(e.trim().startsWith("{"))try{const t=Es(JSON.parse(e));if(!t)throw Error("not an object");return t}catch{throw new Cr(t+" node credential must contain a JSON object","GRAPH_CREDENTIAL_INVALID_FORMAT",{node:t})}}}function Ns(e,t,o){const r=Cs(e,o);return r?As(r[t]):"token"===t&&"string"==typeof e?As(e):void 0}function Ts(e,t){return Ns(e,"token",t)}function Ps(e,t,o){if("string"==typeof e)return As(e);const r=Cs(e,o);if(r)for(const e of Array.isArray(t)?t:[t]){const t=As(r[e]);if(t)return t}}k([Ut({handle:"value"}),C("design:type",Object)],_s.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.respond_to_webhook.fields.respondWith.label",type:"select"}),Ut({handle:"respondWith",userControlled:!0}),C("design:type",String)],_s.prototype,"respondWith",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.respond_to_webhook.fields.responseCode.label",type:"number"}),Ut({handle:"responseCode",userControlled:!0}),C("design:type",Number)],_s.prototype,"responseCode",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.respond_to_webhook.fields.responseHeaders.label",type:"json"}),Ut({handle:"responseHeaders",userControlled:!0,type:"object"}),C("design:type",Object)],_s.prototype,"responseHeaders",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.respond_to_webhook.fields.responseBody.label",type:"json"}),Ut({handle:"responseBody",userControlled:!0,type:"object"}),C("design:type",Object)],_s.prototype,"responseBody",void 0),k([w(),$t({handle:"response"}),C("design:type",Object)],_s.prototype,"response",void 0),k([$t({handle:"delivered"}),C("design:type",Boolean)],_s.prototype,"delivered",void 0),_s=k([Mt("core.io.respondToWebhook",{kind:"core.io.respondToWebhook",category:"IO",color:"#0ea5e9",icon:"ti-corner-up-left",width:96,height:96,labels:["io","webhook","response"],metadata:{title:"graph.node.io.respond_to_webhook.name",description:"graph.node.io.respond_to_webhook.description"}}),I()],_s);const Ds={postgres:5432,mysql:3306,mssql:1433};class js extends Wi{constructor(){super(...arguments),this.ssl=!1,this.acceptSelfSigned=!1}dataSourceOptions(e,t,o,r,n){const i=Ss(this.ssl,!1),a=Ss(this.acceptSelfSigned,!1),s={host:e,port:t,database:o,username:r,password:n,entities:[],synchronize:!1};return"postgres"===this.driver?{...s,type:"postgres",ssl:!!i&&{rejectUnauthorized:!a}}:"mysql"===this.driver?{...s,type:"mysql",ssl:i?{}:void 0}:{...s,type:"mssql",options:{encrypt:i,trustServerCertificate:!i}}}async execute(e,t){const o=this.constructor.name,r=this.sql?.trim();if(!r)throw new Cr(o+" node requires a SQL statement","GRAPH_DATABASE_SQL_REQUIRED");const n=this.host?.trim(),i=this.database?.trim(),a=this.username?.trim();if(!n||!i||!a)throw new Cr(o+" node requires host, database, and username","GRAPH_DATABASE_CONNECTION_REQUIRED");const s=Ps(await an(t,e.credentials,this.credentialType,!1,o),["password","secret","token"],o),d=Os(this.parameters)??(Array.isArray(e.inputs.value)?e.inputs.value:[]),l=`as-graph-${this.driver}-${Date.now()}-${Math.random().toString(36).slice(2)}`,c=new ye(this.dataSourceOptions(n,Rs(this.port)??Ds[this.driver],i,a,s),l),p=new G;try{await c.initialize(p);const e=await c.raw({query:r,values:d},!0,p),{rows:t,rowCount:o}=(e=>{if(Array.isArray(e))return{rows:e,rowCount:e.length};const t=Es(e);if(!t)return{rows:[],rowCount:0};if(Array.isArray(t.recordsets)){const e=t.recordsets.flat(),o=t.rowsAffected;return{rows:e,rowCount:Array.isArray(o)?o.reduce((e,t)=>e+Number(t||0),0):e.length}}if(Array.isArray(t.rows)){const e=t.rows;return{rows:e,rowCount:Rs(t.rowCount)??e.length}}if(Array.isArray(t.recordset)){const e=t.recordset;return{rows:e,rowCount:e.length}}if(Array.isArray(t.data)){const e=t.data;return{rows:e,rowCount:Rs(t.count)??e.length}}return{rows:[],rowCount:Rs(t.affectedRows)??0}})(e);return{result:t,rows:t,rowCount:o}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`${o} node query failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_DATABASE_QUERY_FAILED",{driver:this.driver})}finally{await c.shutdown().catch(()=>{}),V.unregister(l)}}}k([w(),i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.host.label",type:"string"}),Ut({handle:"host",userControlled:!0}),C("design:type",String)],js.prototype,"host",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.port.label",type:"number"}),Ut({handle:"port",userControlled:!0}),C("design:type",Number)],js.prototype,"port",void 0),k([w(),i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.database.label",type:"string"}),Ut({handle:"database",userControlled:!0}),C("design:type",String)],js.prototype,"database",void 0),k([w(),i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.username.label",type:"string"}),Ut({handle:"username",userControlled:!0}),C("design:type",String)],js.prototype,"username",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.ssl.label",type:"boolean"}),Ut({handle:"ssl",userControlled:!0}),C("design:type",Boolean)],js.prototype,"ssl",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.acceptSelfSigned.label",type:"boolean"}),Ut({handle:"acceptSelfSigned",userControlled:!0}),C("design:type",Boolean)],js.prototype,"acceptSelfSigned",void 0),k([w(),i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.sql.label",type:"textarea"}),Ut({handle:"sql",userControlled:!0}),C("design:type",String)],js.prototype,"sql",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.parameters.label",type:"array"}),Ut({handle:"parameters",userControlled:!0}),C("design:type",Array)],js.prototype,"parameters",void 0),k([Ut({handle:"value"}),C("design:type",Object)],js.prototype,"value",void 0),k([w(),$t({handle:"result",type:"array"}),C("design:type",Array)],js.prototype,"result",void 0),k([$t({handle:"rows",type:"array"}),C("design:type",Array)],js.prototype,"rows",void 0),k([$t({handle:"rowCount",type:"number"}),C("design:type",Number)],js.prototype,"rowCount",void 0);let Ls=class extends js{constructor(){super(...arguments),this.driver="postgres",this.credentialType="postgres"}};Ls=k([Mt("core.storage.postgres",{kind:"core.storage.postgres",category:"Storage",color:"#336791",icon:"ti-database",width:96,height:96,labels:["storage","database","postgres","sql"],metadata:{title:"graph.node.storage.postgres.name",description:"graph.node.storage.postgres.description"}}),I()],Ls);let Ms=class extends js{constructor(){super(...arguments),this.driver="mysql",this.credentialType="mysql"}};Ms=k([Mt("core.storage.mySql",{kind:"core.storage.mySql",category:"Storage",color:"#00758f",icon:"ti-database",width:96,height:96,labels:["storage","database","mysql","sql"],metadata:{title:"graph.node.storage.my_sql.name",description:"graph.node.storage.my_sql.description"}}),I()],Ms);let Gs=class extends js{constructor(){super(...arguments),this.driver="mssql",this.credentialType="mssql"}};Gs=k([Mt("core.storage.microsoftSql",{kind:"core.storage.microsoftSql",category:"Storage",color:"#cc2927",icon:"ti-database",width:96,height:96,labels:["storage","database","mssql","sqlserver","sql"],metadata:{title:"graph.node.storage.microsoft_sql.name",description:"graph.node.storage.microsoft_sql.description"}}),I()],Gs);const Us=["get","set","delete","incr","keys","llen","lpop","rpop","lpush","rpush","publish","info"];function $s(e){if(null===e)return null;try{return JSON.parse(e)}catch{return e}}function Fs(e){return"string"==typeof e?e:null==e?"":JSON.stringify(e)}let Hs=class extends Wi{constructor(){super(...arguments),this.operation="get",this.tls=!1}async execute(e,t){const o=Us.includes(this.operation)?this.operation:"get",r=Ps(await an(t,e.credentials,"redis",!1,"Redis"),["password","secret","token"],"Redis"),n=As(this.host)??"localhost",i=Rs(this.port)??6379,a=As(this.key),s=As(this.prefix),d=e=>s?`${s}:${e}`:e,l=As(this.pattern),c=As(this.channel),p=this.value??e.inputs.value;if(!("info"===o||a||"keys"===o&&l||"publish"===o&&c))throw new Cr(`Redis node operation '${o}' requires a key`,"GRAPH_REDIS_KEY_REQUIRED",{operation:o});const u=`as-graph-redis-${Date.now()}-${Math.random().toString(36).slice(2)}`,g=new me({host:n,port:i,username:As(this.username),password:r,database:Rs(this.database),tls:!!this.tls||void 0},u);try{await g.initialize();const e=g.client;switch(o){case"get":return{result:$s(await e.get(d(a)))};case"set":{const t=Rs(this.ttlSeconds);return{result:await e.set(d(a),Fs(p),t&&t>0?{EX:Math.floor(t)}:void 0)}}case"delete":{const t=await e.del(d(a));return{result:t,count:t}}case"incr":{const t=await e.incr(d(a));return{result:t,count:t}}case"keys":{const t=await e.keys(d(l??a??"*"));return{result:t,count:t.length}}case"llen":{const t=await e.lLen(d(a));return{result:t,count:t}}case"lpop":return{result:$s(await e.lPop(d(a)))};case"rpop":return{result:$s(await e.rPop(d(a)))};case"lpush":{const t=await e.lPush(d(a),Fs(p));return{result:t,count:t}}case"rpush":{const t=await e.rPush(d(a),Fs(p));return{result:t,count:t}}case"publish":{const t=await e.publish(c??a,Fs(p));return{result:t,count:t}}default:return{result:await e.info(As(this.section))}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Redis node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_REDIS_OPERATION_FAILED",{operation:o})}finally{await g.shutdown().catch(()=>{}),V.unregister(u)}}};k([i("ngx-decaf-crud-field",{label:"graph.node.storage.redis.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],Hs.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.redis.fields.host.label",type:"string"}),Ut({handle:"host",userControlled:!0}),C("design:type",String)],Hs.prototype,"host",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.redis.fields.port.label",type:"number"}),Ut({handle:"port",userControlled:!0}),C("design:type",Number)],Hs.prototype,"port",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.redis.fields.username.label",type:"string"}),Ut({handle:"username",userControlled:!0}),C("design:type",String)],Hs.prototype,"username",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.redis.fields.database.label",type:"number"}),Ut({handle:"database",userControlled:!0}),C("design:type",Number)],Hs.prototype,"database",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.redis.fields.tls.label",type:"boolean"}),Ut({handle:"tls",userControlled:!0}),C("design:type",Boolean)],Hs.prototype,"tls",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.redis.fields.prefix.label",type:"string"}),Ut({handle:"prefix",userControlled:!0}),C("design:type",String)],Hs.prototype,"prefix",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.redis.fields.key.label",type:"string"}),Ut({handle:"key",userControlled:!0}),C("design:type",String)],Hs.prototype,"key",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.redis.fields.value.label",type:"textarea"}),Ut({handle:"value",userControlled:!0}),C("design:type",Object)],Hs.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.redis.fields.ttlSeconds.label",type:"number"}),Ut({handle:"ttlSeconds",userControlled:!0}),C("design:type",Number)],Hs.prototype,"ttlSeconds",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.redis.fields.pattern.label",type:"string"}),Ut({handle:"pattern",userControlled:!0}),C("design:type",String)],Hs.prototype,"pattern",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.redis.fields.channel.label",type:"string"}),Ut({handle:"channel",userControlled:!0}),C("design:type",String)],Hs.prototype,"channel",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.redis.fields.section.label",type:"string"}),Ut({handle:"section",userControlled:!0}),C("design:type",String)],Hs.prototype,"section",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],Hs.prototype,"result",void 0),k([$t({handle:"value"}),C("design:type",Object)],Hs.prototype,"valueOutput",void 0),k([$t({handle:"count",type:"number"}),C("design:type",Number)],Hs.prototype,"count",void 0),Hs=k([Mt("core.storage.redis",{kind:"core.storage.redis",category:"Storage",color:"#dc382d",icon:"ti-brand-redis",width:96,height:96,labels:["storage","redis","cache","keyvalue"],metadata:{title:"graph.node.storage.redis.name",description:"graph.node.storage.redis.description"}}),I()],Hs);const Bs=["queue","exchange"];let qs=class extends Wi{constructor(){super(...arguments),this.mode="queue",this.ssl=!1}async execute(e,t){const o=Bs.includes(this.mode)?this.mode:"queue",r=As(this.queue),n=As(this.exchange),i=As(this.routingKey)??"";if("queue"===o&&!r)throw new Cr("RabbitMQ node requires a queue when publishing to a queue","GRAPH_RABBITMQ_QUEUE_REQUIRED");if("exchange"===o&&!n)throw new Cr("RabbitMQ node requires an exchange when publishing to an exchange","GRAPH_RABBITMQ_EXCHANGE_REQUIRED");const a=Ps(await an(t,e.credentials,"rabbitmq",!1,"RabbitMQ"),["password","secret","token"],"RabbitMQ"),s=Ss(this.ssl,!1),d="string"==typeof(l=this.value??e.inputs.value??e.inputs.payload??e.inputs.message)?l:null==l?"":JSON.stringify(l);var l;let c,p;try{let e;if(c=await be({protocol:s?"amqps":"amqp",hostname:As(this.host)??"localhost",port:Rs(this.port)??(s?5671:5672),username:As(this.username)??"guest",password:a,vhost:As(this.vhost)??"/",heartbeat:10}),p=await c.createConfirmChannel(),"exchange"===o){const t=As(this.exchangeType)??"topic";await p.assertExchange(n,t,{durable:!0}),p.publish(n,i,Buffer.from(d,"utf8"),{contentType:"application/json",contentEncoding:"utf8"}),e=n}else await p.assertQueue(r,{durable:!0}),p.sendToQueue(r,Buffer.from(d,"utf8"),{contentType:"application/json",contentEncoding:"utf8"}),e=r;return await p.waitForConfirms(),{result:!0,target:e}}catch(e){if(e instanceof Cr)throw e;throw new Cr("RabbitMQ node publish failed: "+(e instanceof Error?e.message:e+""),"GRAPH_RABBITMQ_PUBLISH_FAILED",{mode:o})}finally{await(p?.close().catch(()=>{})),await(c?.close().catch(()=>{}))}}};k([Ut({handle:"mode",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.storage.rabbitmq.fields.mode.label",type:"select"}),C("design:type",String)],qs.prototype,"mode",void 0),k([Ut({handle:"queue",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.storage.rabbitmq.fields.queue.label",type:"string"}),C("design:type",String)],qs.prototype,"queue",void 0),k([Ut({handle:"exchange",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.storage.rabbitmq.fields.exchange.label",type:"string"}),C("design:type",String)],qs.prototype,"exchange",void 0),k([Ut({handle:"exchangeType",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.storage.rabbitmq.fields.exchangeType.label",type:"string"}),C("design:type",String)],qs.prototype,"exchangeType",void 0),k([Ut({handle:"routingKey",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.storage.rabbitmq.fields.routingKey.label",type:"string"}),C("design:type",String)],qs.prototype,"routingKey",void 0),k([Ut({handle:"host",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.storage.rabbitmq.fields.host.label",type:"string"}),C("design:type",String)],qs.prototype,"host",void 0),k([Ut({handle:"port",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.storage.rabbitmq.fields.port.label",type:"number"}),C("design:type",Number)],qs.prototype,"port",void 0),k([Ut({handle:"username",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.storage.rabbitmq.fields.username.label",type:"string"}),C("design:type",String)],qs.prototype,"username",void 0),k([Ut({handle:"vhost",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.storage.rabbitmq.fields.vhost.label",type:"string"}),C("design:type",String)],qs.prototype,"vhost",void 0),k([Ut({handle:"ssl",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.storage.rabbitmq.fields.ssl.label",type:"boolean"}),C("design:type",Boolean)],qs.prototype,"ssl",void 0),k([Ut({handle:"value",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.storage.rabbitmq.fields.value.label",type:"textarea"}),C("design:type",Object)],qs.prototype,"value",void 0),k([w(),$t({handle:"result",type:"boolean"}),C("design:type",Boolean)],qs.prototype,"result",void 0),k([$t({handle:"target"}),C("design:type",String)],qs.prototype,"target",void 0),qs=k([Mt("core.storage.rabbitmq",{kind:"core.storage.rabbitmq",category:"Storage",color:"#ff6600",icon:"ti-inbox",width:96,height:96,labels:["storage","rabbitmq","amqp","queue","publish"],metadata:{title:"graph.node.storage.rabbitmq.name",description:"graph.node.storage.rabbitmq.description"}}),I()],qs);const Ws=["put","get","delete","list","stat","has","url","copy"];class Ks extends Wi{constructor(){super(...arguments),this.operation="get",this.encoding="utf8",this.urlOperation="get"}async execute(e,t){const o=this.constructor.name,r=Ws.includes(this.operation)?this.operation:"get",n=As(this.key);if("list"!==r&&!n)throw new Cr(`${o} node operation '${r}' requires a key`,"GRAPH_BLOB_KEY_REQUIRED",{operation:r});const i=await an(t,e.credentials,this.credentialType,!1,o),a=await this.createService(i);try{switch(r){case"put":{const t=this.content??e.inputs.value,r=Es(this.metadataValues),i=await a.put(n,((e,t,o)=>{if("string"==typeof e)return"base64"===t?Buffer.from(e,"base64"):Buffer.from(e,"utf8");if(e instanceof Uint8Array)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);if(null==e)return Buffer.alloc(0);try{return Buffer.from(JSON.stringify(e),"utf8")}catch{throw new Cr(o+" node cannot encode the blob payload","GRAPH_BLOB_INVALID_PAYLOAD")}})(t,this.encoding,o),{contentType:As(this.contentType),metadata:r?Object.fromEntries(Object.entries(r).map(([e,t])=>[e,t+""])):void 0});return{result:i}}case"get":{const e=await a.get(n),t=await we(e.value),o="base64"===this.encoding?t.toString("base64"):t.toString("utf8");return{result:{key:e.key,uri:e.uri,provider:e.provider,sourceId:e.sourceId,metadata:e.metadata},value:o,contentLength:t.length,contentType:e.metadata.contentType}}case"delete":return await a.delete(n),{result:{key:n,deleted:!0}};case"list":{const e=Rs(this.limit);return{result:await a.list({prefix:As(this.prefix),limit:void 0===e?void 0:Math.max(0,Math.floor(e)),cursor:As(this.cursor)})}}case"stat":return{result:await a.stat(n)};case"has":return{result:await a.has(n)};case"url":{const e=Rs(this.expiresInSeconds);return{result:await a.url(n,{operation:this.urlOperation,expiresInSeconds:void 0===e?void 0:Math.max(0,Math.floor(e)),contentType:As(this.contentType)})}}case"copy":{const e=As(this.targetKey);if(!e)throw new Cr(o+" node copy operation requires a targetKey","GRAPH_BLOB_TARGET_KEY_REQUIRED");return{result:await a.copy(n,e,{contentType:As(this.contentType)})}}default:throw new Cr(`${o} node operation '${r}' is not supported`,"GRAPH_BLOB_OPERATION_NOT_SUPPORTED",{operation:r})}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`${o} node operation '${r}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_BLOB_OPERATION_FAILED",{operation:r})}finally{await a.shutdown().catch(()=>{})}}}k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],Ks.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.key.label",type:"string"}),Ut({handle:"key",userControlled:!0}),C("design:type",String)],Ks.prototype,"key",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.targetKey.label",type:"string"}),Ut({handle:"targetKey",userControlled:!0}),C("design:type",String)],Ks.prototype,"targetKey",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.content.label",type:"textarea"}),Ut({handle:"content",userControlled:!0}),C("design:type",Object)],Ks.prototype,"content",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.contentType.label",type:"string"}),Ut({handle:"contentType",userControlled:!0}),C("design:type",String)],Ks.prototype,"contentType",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.encoding.label",type:"select"}),Ut({handle:"encoding",userControlled:!0}),C("design:type",String)],Ks.prototype,"encoding",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.metadataValues.label",type:"object"}),Ut({handle:"metadataValues",userControlled:!0}),C("design:type",Object)],Ks.prototype,"metadataValues",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.prefix.label",type:"string"}),Ut({handle:"prefix",userControlled:!0}),C("design:type",String)],Ks.prototype,"prefix",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.cursor.label",type:"string"}),Ut({handle:"cursor",userControlled:!0}),C("design:type",String)],Ks.prototype,"cursor",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.limit.label",type:"number"}),Ut({handle:"limit",userControlled:!0}),C("design:type",Number)],Ks.prototype,"limit",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.urlOperation.label",type:"select"}),Ut({handle:"urlOperation",userControlled:!0}),C("design:type",String)],Ks.prototype,"urlOperation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.expiresInSeconds.label",type:"number"}),Ut({handle:"expiresInSeconds",userControlled:!0}),C("design:type",Number)],Ks.prototype,"expiresInSeconds",void 0),k([Ut({handle:"value"}),C("design:type",Object)],Ks.prototype,"value",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],Ks.prototype,"result",void 0),k([$t({handle:"value"}),C("design:type",String)],Ks.prototype,"valueOutput",void 0),k([$t({handle:"contentLength",type:"number"}),C("design:type",Number)],Ks.prototype,"contentLength",void 0),k([$t({handle:"contentType"}),C("design:type",String)],Ks.prototype,"contentTypeOutput",void 0);class Vs extends Ks{constructor(){super(...arguments),this.credentialType="s3",this.forcePathStyle=!1}async createService(e){const t=As(this.bucket);if(!t)throw new Cr("S3 node requires a bucket","GRAPH_BLOB_BUCKET_REQUIRED");const o=new ve;return await xe(o,((e,t)=>{const o=e?ks(e,"S3"):void 0;return{provider:"s3",bucket:t.bucket,sourceId:t.sourceId,region:t.region,endpoint:t.endpoint,prefix:t.prefix,forcePathStyle:t.forcePathStyle,credentials:o&&"string"==typeof o.accessKeyId?{accessKeyId:o.accessKeyId,secretAccessKey:(o.secretAccessKey??"")+"",sessionToken:As(o.sessionToken)}:void 0}})(e,{bucket:t,sourceId:As(this.sourceId)??"graph",region:As(this.region),endpoint:As(this.endpoint),prefix:As(this.prefix),forcePathStyle:this.forcePathStyle})),o}}k([w(),i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.bucket.label",type:"string"}),Ut({handle:"bucket",userControlled:!0}),C("design:type",String)],Vs.prototype,"bucket",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.sourceId.label",type:"string"}),Ut({handle:"sourceId",userControlled:!0}),C("design:type",String)],Vs.prototype,"sourceId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.region.label",type:"string"}),Ut({handle:"region",userControlled:!0}),C("design:type",String)],Vs.prototype,"region",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.endpoint.label",type:"string"}),Ut({handle:"endpoint",userControlled:!0}),C("design:type",String)],Vs.prototype,"endpoint",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.forcePathStyle.label",type:"boolean"}),Ut({handle:"forcePathStyle",userControlled:!0}),C("design:type",Boolean)],Vs.prototype,"forcePathStyle",void 0);let zs=class extends Vs{};zs=k([Mt("core.storage.s3",{kind:"core.storage.s3",category:"Storage",color:"#e25444",icon:"ti-bucket",width:96,height:96,labels:["storage","s3","blob","aws"],metadata:{title:"graph.node.storage.s3.name",description:"graph.node.storage.s3.description"}}),I()],zs);let Qs=class extends Vs{};Qs=k([Mt("core.storage.awsS3",{kind:"core.storage.awsS3",category:"Storage",color:"#ff9900",icon:"ti-brand-aws",width:96,height:96,labels:["storage","s3","blob","aws"],metadata:{title:"graph.node.storage.aws_s3.name",description:"graph.node.storage.aws_s3.description"}}),I()],Qs);let Js=class extends Ks{constructor(){super(...arguments),this.credentialType="gcs"}async createService(e){const t=As(this.bucket);if(!t)throw new Cr("Google Cloud Storage node requires a bucket","GRAPH_BLOB_BUCKET_REQUIRED");const o={provider:"gcs",bucket:t,sourceId:As(this.sourceId)??"graph",projectId:As(this.projectId),apiEndpoint:As(this.apiEndpoint),prefix:As(this.prefix),credentials:e?ks(e,"Google Cloud Storage"):void 0},r=new Ie;return await xe(r,o),r}};function Xs(e){if(!e)return;if("string"!=typeof e)return As(e.connectionString);const t=e.trim();return t.startsWith("{")?As(ks(t,"Azure Storage").connectionString):t}k([w(),i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.bucket.label",type:"string"}),Ut({handle:"bucket",userControlled:!0}),C("design:type",String)],Js.prototype,"bucket",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.sourceId.label",type:"string"}),Ut({handle:"sourceId",userControlled:!0}),C("design:type",String)],Js.prototype,"sourceId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.projectId.label",type:"string"}),Ut({handle:"projectId",userControlled:!0}),C("design:type",String)],Js.prototype,"projectId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.apiEndpoint.label",type:"string"}),Ut({handle:"apiEndpoint",userControlled:!0}),C("design:type",String)],Js.prototype,"apiEndpoint",void 0),Js=k([Mt("core.storage.googleCloudStorage",{kind:"core.storage.googleCloudStorage",category:"Storage",color:"#4285f4",icon:"ti-brand-google-cloud",width:96,height:96,labels:["storage","gcs","blob","google"],metadata:{title:"graph.node.storage.google_cloud_storage.name",description:"graph.node.storage.google_cloud_storage.description"}}),I()],Js);let Ys=class extends Ks{constructor(){super(...arguments),this.credentialType="azure-blob"}async createService(e){const t=As(this.container);if(!t)throw new Cr("Azure Storage node requires a container","GRAPH_BLOB_CONTAINER_REQUIRED");const o={provider:"azure-blob",container:t,sourceId:As(this.sourceId)??"graph",accountName:As(this.accountName),endpoint:As(this.endpoint),prefix:As(this.prefix),connectionString:Xs(e)},r=new _e;return await xe(r,o),r}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.container.label",type:"string"}),Ut({handle:"container",userControlled:!0}),C("design:type",String)],Ys.prototype,"container",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.sourceId.label",type:"string"}),Ut({handle:"sourceId",userControlled:!0}),C("design:type",String)],Ys.prototype,"sourceId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.accountName.label",type:"string"}),Ut({handle:"accountName",userControlled:!0}),C("design:type",String)],Ys.prototype,"accountName",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.storage.common.fields.endpoint.label",type:"string"}),Ut({handle:"endpoint",userControlled:!0}),C("design:type",String)],Ys.prototype,"endpoint",void 0),Ys=k([Mt("core.storage.azureStorage",{kind:"core.storage.azureStorage",category:"Storage",color:"#0078d4",icon:"ti-brand-azure",width:96,height:96,labels:["storage","azure","blob"],metadata:{title:"graph.node.storage.azure_storage.name",description:"graph.node.storage.azure_storage.description"}}),I()],Ys);const Zs=["postMessage","listConversations","getConversation","getUser"];let ed=class extends Wi{constructor(){super(...arguments),this.operation="postMessage"}async execute(e,t){const o=Zs.includes(this.operation)?this.operation:"postMessage";if(!this.operation)throw new Cr("Slack node requires an operation","GRAPH_SLACK_OPERATION_REQUIRED");const r=Ts(await an(t,e.credentials,"slack",!1,"Slack"),"Slack"),n=new Ee;try{switch(await xe(n,{token:r,baseUrl:this.baseUrl}),o){case"postMessage":{const t=this.channel,o=this.text??(e.inputs.value??"")+"";if(!t||!o)throw new Cr("Slack postMessage requires a channel and text","GRAPH_SLACK_MESSAGE_REQUIRED");const r=await n.postMessage({channel:t,text:o,blocks:Os(this.blocks),threadTs:this.threadTs,replyBroadcast:this.replyBroadcast,unfurlLinks:this.unfurlLinks,unfurlMedia:this.unfurlMedia});return{result:r,channel:r.channel,ts:r.ts}}case"listConversations":return{result:await n.listConversations({limit:Rs(this.limit),cursor:this.cursor,types:this.types,excludeArchived:this.excludeArchived})};case"getConversation":{if(!this.channel)throw new Cr("Slack getConversation requires a channel","GRAPH_SLACK_CHANNEL_REQUIRED");const e=await n.getConversation(this.channel);return{result:e,channel:e.id}}default:if(!this.userId)throw new Cr("Slack getUser requires a user ID","GRAPH_SLACK_USER_REQUIRED");return{result:await n.getUser(this.userId)}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Slack node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_SLACK_OPERATION_FAILED",{operation:o})}finally{await n.shutdown().catch(()=>{})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.comms.slack.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],ed.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.slack.fields.channel.label",type:"string"}),Ut({handle:"channel",userControlled:!0}),C("design:type",String)],ed.prototype,"channel",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.slack.fields.text.label",type:"textarea"}),Ut({handle:"text",userControlled:!0}),C("design:type",String)],ed.prototype,"text",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.slack.fields.blocks.label",type:"json"}),Ut({handle:"blocks",userControlled:!0}),C("design:type",Array)],ed.prototype,"blocks",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.slack.fields.threadTs.label",type:"string"}),Ut({handle:"threadTs",userControlled:!0}),C("design:type",String)],ed.prototype,"threadTs",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.slack.fields.limit.label",type:"number"}),Ut({handle:"limit",userControlled:!0}),C("design:type",Number)],ed.prototype,"limit",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.slack.fields.cursor.label",type:"string"}),Ut({handle:"cursor",userControlled:!0}),C("design:type",String)],ed.prototype,"cursor",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.slack.fields.types.label",type:"string"}),Ut({handle:"types",userControlled:!0}),C("design:type",String)],ed.prototype,"types",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.slack.fields.userId.label",type:"string"}),Ut({handle:"userId",userControlled:!0}),C("design:type",String)],ed.prototype,"userId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.slack.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],ed.prototype,"baseUrl",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.slack.fields.excludeArchived.label",type:"boolean"}),Ut({handle:"excludeArchived",userControlled:!0}),C("design:type",Boolean)],ed.prototype,"excludeArchived",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.slack.fields.replyBroadcast.label",type:"boolean"}),Ut({handle:"replyBroadcast",userControlled:!0}),C("design:type",Boolean)],ed.prototype,"replyBroadcast",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.slack.fields.unfurlLinks.label",type:"boolean"}),Ut({handle:"unfurlLinks",userControlled:!0}),C("design:type",Boolean)],ed.prototype,"unfurlLinks",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.slack.fields.unfurlMedia.label",type:"boolean"}),Ut({handle:"unfurlMedia",userControlled:!0}),C("design:type",Boolean)],ed.prototype,"unfurlMedia",void 0),k([$t({handle:"result"}),C("design:type",Object)],ed.prototype,"result",void 0),k([$t({handle:"channel",type:"string"}),C("design:type",String)],ed.prototype,"resultChannel",void 0),k([$t({handle:"ts",type:"string"}),C("design:type",String)],ed.prototype,"resultTs",void 0),ed=k([Mt("core.comms.slack",{kind:"core.comms.slack",category:"Comms",color:"#4a154b",icon:"ti-brand-slack",width:96,height:96,labels:["comms","slack","messaging","chat"],metadata:{title:"graph.node.comms.slack.name",description:"graph.node.comms.slack.description"}}),I()],ed);const td=["sendMessage","getMe","getUpdates","sendChatAction"];let od=class extends Wi{constructor(){super(...arguments),this.operation="sendMessage"}async execute(e,t){if(!this.operation)throw new Cr("Telegram node requires an operation","GRAPH_TELEGRAM_OPERATION_REQUIRED");const o=td.includes(this.operation)?this.operation:"sendMessage",r=Ts(await an(t,e.credentials,"telegram",!1,"Telegram"),"Telegram"),n=new Ae;try{switch(await xe(n,{token:r,baseUrl:this.baseUrl}),o){case"sendMessage":{const t=this.chatId,o=this.text??(e.inputs.value??"")+"";if(null==t||!o)throw new Cr("Telegram sendMessage requires a chat ID and text","GRAPH_TELEGRAM_MESSAGE_REQUIRED");const r=await n.sendMessage({chatId:t,text:o,parseMode:this.parseMode,disableNotification:this.disableNotification,disablePreview:this.disablePreview,replyToMessageId:Rs(this.replyToMessageId),messageThreadId:Rs(this.messageThreadId)});return{result:r,messageId:Rs(r?.message_id)}}case"getMe":return{result:await n.getMe()};case"getUpdates":return{result:await n.getUpdates({offset:Rs(this.offset),limit:Rs(this.limit),timeoutSeconds:Rs(this.timeoutSeconds)})};default:if(void 0===this.chatId||null===this.chatId)throw new Cr("Telegram sendChatAction requires a chat ID","GRAPH_TELEGRAM_CHAT_REQUIRED");return{result:await n.sendChatAction(this.chatId,this.action??"typing")}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Telegram node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_TELEGRAM_OPERATION_FAILED",{operation:o})}finally{await n.shutdown().catch(()=>{})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.comms.telegram.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],od.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.telegram.fields.chatId.label",type:"string"}),Ut({handle:"chatId",userControlled:!0}),C("design:type",Object)],od.prototype,"chatId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.telegram.fields.text.label",type:"textarea"}),Ut({handle:"text",userControlled:!0}),C("design:type",String)],od.prototype,"text",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.telegram.fields.parseMode.label",type:"select"}),Ut({handle:"parseMode",userControlled:!0}),C("design:type",String)],od.prototype,"parseMode",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.telegram.fields.disableNotification.label",type:"boolean"}),Ut({handle:"disableNotification",userControlled:!0}),C("design:type",Boolean)],od.prototype,"disableNotification",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.telegram.fields.disablePreview.label",type:"boolean"}),Ut({handle:"disablePreview",userControlled:!0}),C("design:type",Boolean)],od.prototype,"disablePreview",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.telegram.fields.replyToMessageId.label",type:"number"}),Ut({handle:"replyToMessageId",userControlled:!0}),C("design:type",Number)],od.prototype,"replyToMessageId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.telegram.fields.messageThreadId.label",type:"number"}),Ut({handle:"messageThreadId",userControlled:!0}),C("design:type",Number)],od.prototype,"messageThreadId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.telegram.fields.offset.label",type:"number"}),Ut({handle:"offset",userControlled:!0}),C("design:type",Number)],od.prototype,"offset",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.telegram.fields.limit.label",type:"number"}),Ut({handle:"limit",userControlled:!0}),C("design:type",Number)],od.prototype,"limit",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.telegram.fields.timeoutSeconds.label",type:"number"}),Ut({handle:"timeoutSeconds",userControlled:!0}),C("design:type",Number)],od.prototype,"timeoutSeconds",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.telegram.fields.action.label",type:"string"}),Ut({handle:"action",userControlled:!0}),C("design:type",String)],od.prototype,"action",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.telegram.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],od.prototype,"baseUrl",void 0),k([$t({handle:"result"}),C("design:type",Object)],od.prototype,"result",void 0),k([$t({handle:"messageId",type:"number"}),C("design:type",Number)],od.prototype,"messageId",void 0),od=k([Mt("core.comms.telegram",{kind:"core.comms.telegram",category:"Comms",color:"#229ed9",icon:"ti-brand-telegram",width:96,height:96,labels:["comms","telegram","messaging","bot"],metadata:{title:"graph.node.comms.telegram.name",description:"graph.node.comms.telegram.description"}}),I()],od);const rd=["sendWebhook","sendChannelMessage","listTeams","listChannels"];let nd=class extends Wi{constructor(){super(...arguments),this.operation="sendWebhook"}async execute(e,t){if(!this.operation)throw new Cr("Microsoft Teams node requires an operation","GRAPH_TEAMS_OPERATION_REQUIRED");const o=rd.includes(this.operation)?this.operation:"sendWebhook",r=await an(t,e.credentials,"teams",!1,"Microsoft Teams"),n=new Se;try{switch(await xe(n,{token:Ns(r,"token","Microsoft Teams"),webhookUrl:Ns(r,"webhookUrl","Microsoft Teams"),baseUrl:this.baseUrl}),o){case"sendWebhook":{const t=this.text??(e.inputs.value??"")+"";if(!t)throw new Cr("Microsoft Teams sendWebhook requires text","GRAPH_TEAMS_TEXT_REQUIRED");return{result:await n.sendWebhook({text:t,title:this.title,markdown:this.markdown})}}case"sendChannelMessage":if(!this.teamId||!this.channelId||!this.content)throw new Cr("Microsoft Teams sendChannelMessage requires teamId, channelId, and content","GRAPH_TEAMS_CHANNEL_MESSAGE_REQUIRED");return{result:await n.sendChannelMessage({teamId:this.teamId,channelId:this.channelId,content:this.content,contentType:this.contentType})};case"listTeams":return{result:await n.listTeams(Rs(this.limit))};default:if(!this.teamId)throw new Cr("Microsoft Teams listChannels requires a teamId","GRAPH_TEAMS_TEAM_REQUIRED");return{result:await n.listChannels(this.teamId)}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Microsoft Teams node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_TEAMS_OPERATION_FAILED",{operation:o})}finally{await n.shutdown().catch(()=>{})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.comms.teams.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],nd.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.teams.fields.text.label",type:"textarea"}),Ut({handle:"text",userControlled:!0}),C("design:type",String)],nd.prototype,"text",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.teams.fields.title.label",type:"string"}),Ut({handle:"title",userControlled:!0}),C("design:type",String)],nd.prototype,"title",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.teams.fields.markdown.label",type:"boolean"}),Ut({handle:"markdown",userControlled:!0}),C("design:type",Boolean)],nd.prototype,"markdown",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.teams.fields.teamId.label",type:"string"}),Ut({handle:"teamId",userControlled:!0}),C("design:type",String)],nd.prototype,"teamId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.teams.fields.channelId.label",type:"string"}),Ut({handle:"channelId",userControlled:!0}),C("design:type",String)],nd.prototype,"channelId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.teams.fields.content.label",type:"textarea"}),Ut({handle:"content",userControlled:!0}),C("design:type",String)],nd.prototype,"content",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.teams.fields.contentType.label",type:"select"}),Ut({handle:"contentType",userControlled:!0}),C("design:type",String)],nd.prototype,"contentType",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.teams.fields.limit.label",type:"number"}),Ut({handle:"limit",userControlled:!0}),C("design:type",Number)],nd.prototype,"limit",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.teams.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],nd.prototype,"baseUrl",void 0),k([$t({handle:"result"}),C("design:type",Object)],nd.prototype,"result",void 0),nd=k([Mt("core.comms.teams",{kind:"core.comms.teams",category:"Comms",color:"#6264a7",icon:"ti-brand-teams",width:96,height:96,labels:["comms","teams","microsoft","messaging"],metadata:{title:"graph.node.comms.teams.name",description:"graph.node.comms.teams.description"}}),I()],nd);const id=["send","list","get","labels"];let ad=class extends Wi{constructor(){super(...arguments),this.operation="send"}async execute(e,t){if(!this.operation)throw new Cr("Gmail node requires an operation","GRAPH_GMAIL_OPERATION_REQUIRED");const o=id.includes(this.operation)?this.operation:"send",r=await an(t,e.credentials,"gmail",!1,"Gmail"),n=new Re;try{switch(await xe(n,{token:Ts(r,"Gmail"),userId:this.userId??Ns(r,"userId","Gmail"),baseUrl:this.baseUrl}),o){case"send":{const t=this.from??Ns(r,"from","Gmail");if(!t||!this.to||!this.subject)throw new Cr("Gmail send requires from, to, and subject","GRAPH_GMAIL_MESSAGE_REQUIRED");const o=await n.send({from:t,to:this.to,cc:this.cc,bcc:this.bcc,subject:this.subject,text:this.text??(e.inputs.value??"")+"",html:this.html,replyTo:this.replyTo});return{result:o,id:o.id}}case"list":return{result:await n.listMessages({query:this.query,maxResults:Rs(this.maxResults),pageToken:this.pageToken,labelIds:Os(this.labelIds)?.map(String)})};case"get":if(!this.messageId)throw new Cr("Gmail get requires a message ID","GRAPH_GMAIL_MESSAGE_ID_REQUIRED");return{result:await n.getMessage(this.messageId,this.format??"full")};default:return{result:await n.listLabels()}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Gmail node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_GMAIL_OPERATION_FAILED",{operation:o})}finally{await n.shutdown().catch(()=>{})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.comms.gmail.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],ad.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.gmail.fields.userId.label",type:"string"}),Ut({handle:"userId",userControlled:!0}),C("design:type",String)],ad.prototype,"userId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.common.fields.from.label",type:"string"}),Ut({handle:"from",userControlled:!0}),C("design:type",String)],ad.prototype,"from",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.common.fields.to.label",type:"string"}),Ut({handle:"to",userControlled:!0}),C("design:type",Object)],ad.prototype,"to",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.common.fields.cc.label",type:"string"}),Ut({handle:"cc",userControlled:!0}),C("design:type",Object)],ad.prototype,"cc",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.common.fields.bcc.label",type:"string"}),Ut({handle:"bcc",userControlled:!0}),C("design:type",Object)],ad.prototype,"bcc",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.common.fields.subject.label",type:"string"}),Ut({handle:"subject",userControlled:!0}),C("design:type",String)],ad.prototype,"subject",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.common.fields.text.label",type:"textarea"}),Ut({handle:"text",userControlled:!0}),C("design:type",String)],ad.prototype,"text",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.common.fields.html.label",type:"textarea"}),Ut({handle:"html",userControlled:!0}),C("design:type",String)],ad.prototype,"html",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.common.fields.replyTo.label",type:"string"}),Ut({handle:"replyTo",userControlled:!0}),C("design:type",String)],ad.prototype,"replyTo",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.gmail.fields.query.label",type:"string"}),Ut({handle:"query",userControlled:!0}),C("design:type",String)],ad.prototype,"query",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.gmail.fields.maxResults.label",type:"number"}),Ut({handle:"maxResults",userControlled:!0}),C("design:type",Number)],ad.prototype,"maxResults",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.gmail.fields.pageToken.label",type:"string"}),Ut({handle:"pageToken",userControlled:!0}),C("design:type",String)],ad.prototype,"pageToken",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.gmail.fields.labelIds.label",type:"json"}),Ut({handle:"labelIds",userControlled:!0}),C("design:type",Array)],ad.prototype,"labelIds",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.gmail.fields.messageId.label",type:"string"}),Ut({handle:"messageId",userControlled:!0}),C("design:type",String)],ad.prototype,"messageId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.gmail.fields.format.label",type:"select"}),Ut({handle:"format",userControlled:!0}),C("design:type",String)],ad.prototype,"format",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.gmail.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],ad.prototype,"baseUrl",void 0),k([$t({handle:"result"}),C("design:type",Object)],ad.prototype,"result",void 0),k([$t({handle:"id",type:"string"}),C("design:type",String)],ad.prototype,"id",void 0),ad=k([Mt("core.comms.gmail",{kind:"core.comms.gmail",category:"Comms",color:"#ea4335",icon:"ti-brand-google",width:96,height:96,labels:["comms","gmail","email","google"],metadata:{title:"graph.node.comms.gmail.name",description:"graph.node.comms.gmail.description"}}),I()],ad);const sd=["send","listInbox","listImap"];let dd=class extends Wi{constructor(){super(...arguments),this.operation="send"}async execute(e,t){if(!this.operation)throw new Cr("Email Send node requires an operation","GRAPH_EMAIL_OPERATION_REQUIRED");const o=sd.includes(this.operation)?this.operation:"send",r=await an(t,e.credentials,"email",!1,"Email"),n=Cs(r,"Email"),i=r&&!n?r:void 0,a=new Oe;try{switch(await xe(a,{provider:this.provider??n?.provider,host:this.host??this.asCredentialString(n,"host"),port:Rs(this.port)??Rs(n?.port),secure:this.secure??Ss(n?.secure,!1),username:this.username??this.asCredentialString(n,"username"),password:this.asCredentialString(n,"password"),from:this.from??this.asCredentialString(n,"from"),token:i??this.asCredentialString(n,"token"),graphBaseUrl:this.graphBaseUrl??this.asCredentialString(n,"graphBaseUrl"),baseUrl:this.baseUrl}),o){case"send":{if(!this.to||!this.subject)throw new Cr("Email Send send requires to and subject","GRAPH_EMAIL_MESSAGE_REQUIRED");const t=await a.send({from:this.from??this.asCredentialString(n,"from")??"",to:this.to,cc:this.cc,bcc:this.bcc,subject:this.subject,text:this.text??(e.inputs.value??"")+"",html:this.html,replyTo:this.replyTo});return{result:t,messageId:t.messageId}}case"listInbox":return{result:await a.listInbox({mailbox:this.mailbox,limit:Rs(this.limit),since:this.since,subject:this.subjectFilter})};default:return{result:await a.listImapMessages({mailbox:this.mailbox,limit:Rs(this.limit),since:this.since,subject:this.subjectFilter})}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Email node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_EMAIL_OPERATION_FAILED",{operation:o})}finally{await a.shutdown().catch(()=>{})}}asCredentialString(e,t){const o=e?.[t];return"string"==typeof o&&o.trim().length>0?o.trim():void 0}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.comms.email_send.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],dd.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.email_send.fields.provider.label",type:"select"}),Ut({handle:"provider",userControlled:!0}),C("design:type",String)],dd.prototype,"provider",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.email_send.fields.host.label",type:"string"}),Ut({handle:"host",userControlled:!0}),C("design:type",String)],dd.prototype,"host",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.email_send.fields.port.label",type:"number"}),Ut({handle:"port",userControlled:!0}),C("design:type",Number)],dd.prototype,"port",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.email_send.fields.secure.label",type:"boolean"}),Ut({handle:"secure",userControlled:!0}),C("design:type",Boolean)],dd.prototype,"secure",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.email_send.fields.username.label",type:"string"}),Ut({handle:"username",userControlled:!0}),C("design:type",String)],dd.prototype,"username",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.common.fields.from.label",type:"string"}),Ut({handle:"from",userControlled:!0}),C("design:type",String)],dd.prototype,"from",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.common.fields.to.label",type:"string"}),Ut({handle:"to",userControlled:!0}),C("design:type",Object)],dd.prototype,"to",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.common.fields.cc.label",type:"string"}),Ut({handle:"cc",userControlled:!0}),C("design:type",Object)],dd.prototype,"cc",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.common.fields.bcc.label",type:"string"}),Ut({handle:"bcc",userControlled:!0}),C("design:type",Object)],dd.prototype,"bcc",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.common.fields.subject.label",type:"string"}),Ut({handle:"subject",userControlled:!0}),C("design:type",String)],dd.prototype,"subject",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.common.fields.text.label",type:"textarea"}),Ut({handle:"text",userControlled:!0}),C("design:type",String)],dd.prototype,"text",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.common.fields.html.label",type:"textarea"}),Ut({handle:"html",userControlled:!0}),C("design:type",String)],dd.prototype,"html",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.common.fields.replyTo.label",type:"string"}),Ut({handle:"replyTo",userControlled:!0}),C("design:type",String)],dd.prototype,"replyTo",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.email_send.fields.mailbox.label",type:"string"}),Ut({handle:"mailbox",userControlled:!0}),C("design:type",String)],dd.prototype,"mailbox",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.email_send.fields.limit.label",type:"number"}),Ut({handle:"limit",userControlled:!0}),C("design:type",Number)],dd.prototype,"limit",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.email_send.fields.since.label",type:"string"}),Ut({handle:"since",userControlled:!0}),C("design:type",String)],dd.prototype,"since",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.email_send.fields.subjectFilter.label",type:"string"}),Ut({handle:"subjectFilter",userControlled:!0}),C("design:type",String)],dd.prototype,"subjectFilter",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.email_send.fields.graphBaseUrl.label",type:"string"}),Ut({handle:"graphBaseUrl",userControlled:!0}),C("design:type",String)],dd.prototype,"graphBaseUrl",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.email_send.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],dd.prototype,"baseUrl",void 0),k([$t({handle:"result"}),C("design:type",Object)],dd.prototype,"result",void 0),k([$t({handle:"messageId",type:"string"}),C("design:type",String)],dd.prototype,"messageId",void 0),dd=k([Mt("core.comms.emailSend",{kind:"core.comms.emailSend",category:"Comms",color:"#0f766e",icon:"ti-mail",width:96,height:96,labels:["comms","email","smtp","imap"],metadata:{title:"graph.node.comms.email_send.name",description:"graph.node.comms.email_send.description"}}),I()],dd);const ld=["sendMessage","getMessage","listMessages","getChannel","listChannels","createChannel","deleteChannel","addReaction"];function cd(e){if(null==e||""===e)return;if(Array.isArray(e))return e;if("string"==typeof e)try{const t=JSON.parse(e);return Array.isArray(t)?t:[t]}catch{throw new Cr("Discord embeds must be a JSON array","GRAPH_DISCORD_EMBEDS_INVALID")}const t=Es(e);return t?[t]:void 0}let pd=class extends Wi{constructor(){super(...arguments),this.operation="sendMessage"}async execute(e,t){if(!this.operation)throw new Cr("Discord node requires an operation","GRAPH_DISCORD_OPERATION_REQUIRED");const o=ld.includes(this.operation)?this.operation:"sendMessage",r=await an(t,e.credentials,"discord",!1,"Discord"),n=new ke;try{switch(await xe(n,{token:Ts(r,"Discord"),baseUrl:this.baseUrl}),o){case"sendMessage":{if(!this.channelId)throw new Cr("Discord sendMessage requires a channelId","GRAPH_DISCORD_CHANNEL_REQUIRED");const t=this.content??(e.inputs.value??"")+"";if(!t)throw new Cr("Discord sendMessage requires content","GRAPH_DISCORD_CONTENT_REQUIRED");const o=await n.sendMessage({channelId:this.channelId,content:t,tts:this.tts,embeds:cd(this.embeds)}),r=Es(o);return{result:o,channelId:this.channelId,..."string"==typeof r?.id?{messageId:r.id}:{}}}case"getMessage":if(!this.channelId||!this.messageId)throw new Cr("Discord getMessage requires channelId and messageId","GRAPH_DISCORD_MESSAGE_REQUIRED");return{result:await n.getMessage(this.channelId,this.messageId),channelId:this.channelId,messageId:this.messageId};case"listMessages":if(!this.channelId)throw new Cr("Discord listMessages requires a channelId","GRAPH_DISCORD_CHANNEL_REQUIRED");return{result:await n.listMessages({channelId:this.channelId,limit:Rs(this.limit),before:this.before}),channelId:this.channelId};case"getChannel":if(!this.channelId)throw new Cr("Discord getChannel requires a channelId","GRAPH_DISCORD_CHANNEL_REQUIRED");return{result:await n.getChannel(this.channelId),channelId:this.channelId};case"listChannels":if(!this.guildId)throw new Cr("Discord listChannels requires a guildId","GRAPH_DISCORD_GUILD_REQUIRED");return{result:await n.listChannels(this.guildId)};case"createChannel":{if(!this.guildId||!this.name)throw new Cr("Discord createChannel requires guildId and name","GRAPH_DISCORD_CHANNEL_CREATE_REQUIRED");const e=await n.createChannel({guildId:this.guildId,name:this.name,type:Rs(this.channelType),topic:this.topic,parentId:this.parentId}),t=Es(e);return{result:e,..."string"==typeof t?.id?{channelId:t.id}:{}}}case"deleteChannel":if(!this.channelId)throw new Cr("Discord deleteChannel requires a channelId","GRAPH_DISCORD_CHANNEL_REQUIRED");return{result:await n.deleteChannel(this.channelId),channelId:this.channelId};default:if(!this.channelId||!this.messageId||!this.emoji)throw new Cr("Discord addReaction requires channelId, messageId, and emoji","GRAPH_DISCORD_REACTION_REQUIRED");return{result:await n.addReaction({channelId:this.channelId,messageId:this.messageId,emoji:this.emoji}),channelId:this.channelId,messageId:this.messageId}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Discord node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_DISCORD_OPERATION_FAILED",{operation:o})}finally{await n.shutdown().catch(()=>{})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.comms.discord.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],pd.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.discord.fields.channelId.label",type:"string"}),Ut({handle:"channelId",userControlled:!0}),C("design:type",String)],pd.prototype,"channelId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.discord.fields.guildId.label",type:"string"}),Ut({handle:"guildId",userControlled:!0}),C("design:type",String)],pd.prototype,"guildId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.discord.fields.messageId.label",type:"string"}),Ut({handle:"messageId",userControlled:!0}),C("design:type",String)],pd.prototype,"messageId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.discord.fields.content.label",type:"textarea"}),Ut({handle:"content",userControlled:!0}),C("design:type",String)],pd.prototype,"content",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.discord.fields.embeds.label",type:"textarea"}),Ut({handle:"embeds",userControlled:!0}),C("design:type",Object)],pd.prototype,"embeds",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.discord.fields.tts.label",type:"boolean"}),Ut({handle:"tts",userControlled:!0}),C("design:type",Boolean)],pd.prototype,"tts",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.discord.fields.name.label",type:"string"}),Ut({handle:"name",userControlled:!0}),C("design:type",String)],pd.prototype,"name",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.discord.fields.channelType.label",type:"number"}),Ut({handle:"channelType",userControlled:!0}),C("design:type",Number)],pd.prototype,"channelType",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.discord.fields.topic.label",type:"string"}),Ut({handle:"topic",userControlled:!0}),C("design:type",String)],pd.prototype,"topic",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.discord.fields.parentId.label",type:"string"}),Ut({handle:"parentId",userControlled:!0}),C("design:type",String)],pd.prototype,"parentId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.discord.fields.emoji.label",type:"string"}),Ut({handle:"emoji",userControlled:!0}),C("design:type",String)],pd.prototype,"emoji",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.discord.fields.limit.label",type:"number"}),Ut({handle:"limit",userControlled:!0}),C("design:type",Number)],pd.prototype,"limit",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.discord.fields.before.label",type:"string"}),Ut({handle:"before",userControlled:!0}),C("design:type",String)],pd.prototype,"before",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.discord.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],pd.prototype,"baseUrl",void 0),k([$t({handle:"result"}),C("design:type",Object)],pd.prototype,"result",void 0),k([$t({handle:"channelId",type:"string"}),C("design:type",String)],pd.prototype,"resultChannelId",void 0),k([$t({handle:"messageId",type:"string"}),C("design:type",String)],pd.prototype,"resultMessageId",void 0),pd=k([Mt("core.comms.discord",{kind:"core.comms.discord",category:"Comms",color:"#5865f2",icon:"ti-brand-discord",width:96,height:96,labels:["comms","discord","messaging","chat"],metadata:{title:"graph.node.comms.discord.name",description:"graph.node.comms.discord.description"}}),I()],pd);const ud=["sendText","sendTemplate","sendMedia","markAsRead","getMedia"];function gd(e){if(null==e||""===e)return;if(Array.isArray(e))return e;if("string"==typeof e)try{const t=JSON.parse(e);return Array.isArray(t)?t:[t]}catch{throw new Cr("WhatsApp template components must be a JSON array","GRAPH_WHATSAPP_COMPONENTS_INVALID")}const t=Es(e);return t?[t]:void 0}let hd=class extends Wi{constructor(){super(...arguments),this.operation="sendText"}async execute(e,t){if(!this.operation)throw new Cr("WhatsApp node requires an operation","GRAPH_WHATSAPP_OPERATION_REQUIRED");const o=ud.includes(this.operation)?this.operation:"sendText",r=await an(t,e.credentials,"whatsapp",!1,"WhatsApp"),n=new Ce;try{switch(await xe(n,{token:Ts(r,"WhatsApp"),phoneNumberId:this.phoneNumberId??Ns(r,"phoneNumberId","WhatsApp"),baseUrl:this.baseUrl}),o){case"sendText":{const t=this.text??(e.inputs.value??"")+"";if(!this.to||!t)throw new Cr("WhatsApp sendText requires to and text","GRAPH_WHATSAPP_TEXT_REQUIRED");const o=await n.sendText({to:this.to,text:t,previewUrl:this.previewUrl});return{result:o,...this.messageIdOf(o)}}case"sendTemplate":{if(!this.to||!this.templateName||!this.languageCode)throw new Cr("WhatsApp sendTemplate requires to, templateName, and languageCode","GRAPH_WHATSAPP_TEMPLATE_REQUIRED");const e=await n.sendTemplate({to:this.to,templateName:this.templateName,languageCode:this.languageCode,components:gd(this.components)});return{result:e,...this.messageIdOf(e)}}case"sendMedia":{if(!this.to||!this.mediaId&&!this.mediaUrl)throw new Cr("WhatsApp sendMedia requires to and a mediaId or mediaUrl","GRAPH_WHATSAPP_MEDIA_REQUIRED");const e=await n.sendMedia({to:this.to,type:this.mediaType??"image",mediaId:this.mediaId,link:this.mediaUrl,caption:this.caption,filename:this.filename});return{result:e,...this.messageIdOf(e)}}case"markAsRead":if(!this.messageId)throw new Cr("WhatsApp markAsRead requires a messageId","GRAPH_WHATSAPP_MESSAGE_REQUIRED");return{result:await n.markAsRead({messageId:this.messageId}),messageId:this.messageId};default:if(!this.mediaId)throw new Cr("WhatsApp getMedia requires a mediaId","GRAPH_WHATSAPP_MEDIA_REQUIRED");return{result:await n.getMedia(this.mediaId)}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`WhatsApp node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_WHATSAPP_OPERATION_FAILED",{operation:o})}finally{await n.shutdown().catch(()=>{})}}messageIdOf(e){const t=Es(e),o=t?.messages;if(Array.isArray(o)){const e=Es(o[0]);if("string"==typeof e?.id)return{messageId:e.id}}return{}}};k([i("ngx-decaf-crud-field",{label:"graph.node.comms.whatsapp.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],hd.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.whatsapp.fields.phoneNumberId.label",type:"string"}),Ut({handle:"phoneNumberId",userControlled:!0}),C("design:type",String)],hd.prototype,"phoneNumberId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.whatsapp.fields.to.label",type:"string"}),Ut({handle:"to",userControlled:!0}),C("design:type",String)],hd.prototype,"to",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.whatsapp.fields.text.label",type:"textarea"}),Ut({handle:"text",userControlled:!0}),C("design:type",String)],hd.prototype,"text",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.whatsapp.fields.previewUrl.label",type:"boolean"}),Ut({handle:"previewUrl",userControlled:!0}),C("design:type",Boolean)],hd.prototype,"previewUrl",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.whatsapp.fields.templateName.label",type:"string"}),Ut({handle:"templateName",userControlled:!0}),C("design:type",String)],hd.prototype,"templateName",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.whatsapp.fields.languageCode.label",type:"string"}),Ut({handle:"languageCode",userControlled:!0}),C("design:type",String)],hd.prototype,"languageCode",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.whatsapp.fields.components.label",type:"textarea"}),Ut({handle:"components",userControlled:!0}),C("design:type",Object)],hd.prototype,"components",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.whatsapp.fields.mediaType.label",type:"select"}),Ut({handle:"mediaType",userControlled:!0}),C("design:type",String)],hd.prototype,"mediaType",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.whatsapp.fields.mediaId.label",type:"string"}),Ut({handle:"mediaId",userControlled:!0}),C("design:type",String)],hd.prototype,"mediaId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.whatsapp.fields.mediaUrl.label",type:"string"}),Ut({handle:"mediaUrl",userControlled:!0}),C("design:type",String)],hd.prototype,"mediaUrl",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.whatsapp.fields.caption.label",type:"string"}),Ut({handle:"caption",userControlled:!0}),C("design:type",String)],hd.prototype,"caption",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.whatsapp.fields.filename.label",type:"string"}),Ut({handle:"filename",userControlled:!0}),C("design:type",String)],hd.prototype,"filename",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.whatsapp.fields.messageId.label",type:"string"}),Ut({handle:"messageId",userControlled:!0}),C("design:type",String)],hd.prototype,"messageId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.whatsapp.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],hd.prototype,"baseUrl",void 0),k([$t({handle:"result"}),C("design:type",Object)],hd.prototype,"result",void 0),k([$t({handle:"messageId",type:"string"}),C("design:type",String)],hd.prototype,"resultMessageId",void 0),hd=k([Mt("core.comms.whatsApp",{kind:"core.comms.whatsApp",category:"Comms",color:"#25d366",icon:"ti-brand-whatsapp",width:96,height:96,labels:["comms","whatsapp","messaging","meta"],metadata:{title:"graph.node.comms.whatsapp.name",description:"graph.node.comms.whatsapp.description"}}),I()],hd);const fd=["sendMail","listMessages","getMessage","listEvents","createEvent","deleteEvent"];function yd(e){if(null!=e&&""!==e){if(Array.isArray(e))return e.map(e=>(e+"").trim()).filter(e=>e.length>0);if("string"==typeof e){if(e.trim().startsWith("["))try{const t=JSON.parse(e);return Array.isArray(t)?t.map(e=>(e+"").trim()):void 0}catch{throw new Cr("Microsoft Outlook attendees must be a JSON array or a comma-separated list","GRAPH_OUTLOOK_ATTENDEES_INVALID")}return e.split(/[,;]/).map(e=>e.trim()).filter(e=>e.length>0)}}}let md=class extends Wi{constructor(){super(...arguments),this.operation="sendMail"}async execute(e,t){if(!this.operation)throw new Cr("Microsoft Outlook node requires an operation","GRAPH_OUTLOOK_OPERATION_REQUIRED");const o=fd.includes(this.operation)?this.operation:"sendMail",r=await an(t,e.credentials,"microsoft-outlook",!1,"Microsoft Outlook"),n=new Ne;try{switch(await xe(n,{token:Ts(r,"Microsoft Outlook"),baseUrl:this.baseUrl}),o){case"sendMail":{if(!this.to||!this.subject)throw new Cr("Microsoft Outlook sendMail requires to and subject","GRAPH_OUTLOOK_MAIL_REQUIRED");const t=this.body??(e.inputs.value??"")+"";return{result:await n.sendMail({to:this.to,cc:this.cc,bcc:this.bcc,subject:this.subject,body:t,contentType:this.contentType,saveToSentItems:this.saveToSentItems})}}case"listMessages":return{result:await n.listMessages({folderId:this.folderId,top:Rs(this.top),filter:this.filter,search:this.search})};case"getMessage":if(!this.messageId)throw new Cr("Microsoft Outlook getMessage requires a messageId","GRAPH_OUTLOOK_MESSAGE_REQUIRED");return{result:await n.getMessage(this.messageId),messageId:this.messageId};case"listEvents":return{result:await n.listEvents({top:Rs(this.top),filter:this.filter,search:this.search})};case"createEvent":{if(!this.subject||!this.start||!this.end)throw new Cr("Microsoft Outlook createEvent requires subject, start, and end","GRAPH_OUTLOOK_EVENT_REQUIRED");const e=await n.createEvent({subject:this.subject,start:this.start,end:this.end,timeZone:this.timeZone,body:this.body,location:this.location,attendees:yd(this.attendees)}),t=Es(e);return{result:e,..."string"==typeof t?.id?{eventId:t.id}:{}}}default:if(!this.eventId)throw new Cr("Microsoft Outlook deleteEvent requires an eventId","GRAPH_OUTLOOK_EVENT_REQUIRED");return{result:await n.deleteEvent(this.eventId),eventId:this.eventId}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Microsoft Outlook node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_OUTLOOK_OPERATION_FAILED",{operation:o})}finally{await n.shutdown().catch(()=>{})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],md.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.to.label",type:"string"}),Ut({handle:"to",userControlled:!0}),C("design:type",String)],md.prototype,"to",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.cc.label",type:"string"}),Ut({handle:"cc",userControlled:!0}),C("design:type",String)],md.prototype,"cc",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.bcc.label",type:"string"}),Ut({handle:"bcc",userControlled:!0}),C("design:type",String)],md.prototype,"bcc",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.subject.label",type:"string"}),Ut({handle:"subject",userControlled:!0}),C("design:type",String)],md.prototype,"subject",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.body.label",type:"textarea"}),Ut({handle:"body",userControlled:!0}),C("design:type",String)],md.prototype,"body",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.contentType.label",type:"select"}),Ut({handle:"contentType",userControlled:!0}),C("design:type",String)],md.prototype,"contentType",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.saveToSentItems.label",type:"boolean"}),Ut({handle:"saveToSentItems",userControlled:!0}),C("design:type",Boolean)],md.prototype,"saveToSentItems",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.folderId.label",type:"string"}),Ut({handle:"folderId",userControlled:!0}),C("design:type",String)],md.prototype,"folderId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.messageId.label",type:"string"}),Ut({handle:"messageId",userControlled:!0}),C("design:type",String)],md.prototype,"messageId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.eventId.label",type:"string"}),Ut({handle:"eventId",userControlled:!0}),C("design:type",String)],md.prototype,"eventId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.start.label",type:"string"}),Ut({handle:"start",userControlled:!0}),C("design:type",String)],md.prototype,"start",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.end.label",type:"string"}),Ut({handle:"end",userControlled:!0}),C("design:type",String)],md.prototype,"end",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.timeZone.label",type:"string"}),Ut({handle:"timeZone",userControlled:!0}),C("design:type",String)],md.prototype,"timeZone",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.location.label",type:"string"}),Ut({handle:"location",userControlled:!0}),C("design:type",String)],md.prototype,"location",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.attendees.label",type:"textarea"}),Ut({handle:"attendees",userControlled:!0}),C("design:type",Object)],md.prototype,"attendees",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.top.label",type:"number"}),Ut({handle:"top",userControlled:!0}),C("design:type",Number)],md.prototype,"top",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.filter.label",type:"string"}),Ut({handle:"filter",userControlled:!0}),C("design:type",String)],md.prototype,"filter",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.search.label",type:"string"}),Ut({handle:"search",userControlled:!0}),C("design:type",String)],md.prototype,"search",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.comms.microsoft_outlook.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],md.prototype,"baseUrl",void 0),k([$t({handle:"result"}),C("design:type",Object)],md.prototype,"result",void 0),k([$t({handle:"messageId",type:"string"}),C("design:type",String)],md.prototype,"resultMessageId",void 0),k([$t({handle:"eventId",type:"string"}),C("design:type",String)],md.prototype,"resultEventId",void 0),md=k([Mt("core.comms.microsoftOutlook",{kind:"core.comms.microsoftOutlook",category:"Comms",color:"#0078d4",icon:"ti-brand-office",width:96,height:96,labels:["comms","outlook","microsoft","email","calendar"],metadata:{title:"graph.node.comms.microsoft_outlook.name",description:"graph.node.comms.microsoft_outlook.description"}}),I()],md);const bd=["get","update","append","clear","create"];let wd=class extends Wi{constructor(){super(...arguments),this.operation="get"}async execute(e,t){if(!this.operation)throw new Cr("Google Sheets node requires an operation","GRAPH_GOOGLE_SHEETS_OPERATION_REQUIRED");const o=bd.includes(this.operation)?this.operation:"get",r=await an(t,e.credentials,"google-sheets",!1,"Google Sheets"),n=new Te;try{switch(await xe(n,{token:Ns(r,"token","Google Sheets"),apiKey:Ns(r,"apiKey","Google Sheets"),baseUrl:this.baseUrl}),o){case"get":{const e=await n.getValues(this.requireSpreadsheet(),this.requireRange());return{result:e,values:e.values,spreadsheetId:e.spreadsheetId,range:e.range}}case"update":case"append":{const e=this.requireValues(),t={spreadsheetId:this.requireSpreadsheet(),range:this.requireRange(),values:e,valueInputOption:this.valueInputOption??"USER_ENTERED"},r="update"===o?await n.updateValues(t):await n.appendValues(t);return{result:r,values:r.values,spreadsheetId:r.spreadsheetId,range:r.range}}case"clear":{const e=await n.clearValues(this.requireSpreadsheet(),this.requireRange());return{result:e,spreadsheetId:e.spreadsheetId,range:e.clearedRange}}default:{if(!this.title)throw new Cr("Google Sheets create requires a title","GRAPH_GOOGLE_SHEETS_TITLE_REQUIRED");const e=await n.createSpreadsheet(this.title);return{result:e,spreadsheetId:e.spreadsheetId}}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Google Sheets node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_GOOGLE_SHEETS_OPERATION_FAILED",{operation:o})}finally{await n.shutdown().catch(()=>{})}}requireSpreadsheet(){if(!this.spreadsheetId)throw new Cr("Google Sheets node requires a spreadsheet ID","GRAPH_GOOGLE_SHEETS_SPREADSHEET_REQUIRED");return this.spreadsheetId}requireRange(){if(!this.range)throw new Cr("Google Sheets node requires a range","GRAPH_GOOGLE_SHEETS_RANGE_REQUIRED");return this.range}requireValues(){if(!Array.isArray(this.values)||!this.values.every(e=>Array.isArray(e)))throw new Cr("Google Sheets node requires values as an array of rows","GRAPH_GOOGLE_SHEETS_VALUES_REQUIRED");return this.values}};k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_sheets.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],wd.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_sheets.fields.spreadsheetId.label",type:"string"}),Ut({handle:"spreadsheetId",userControlled:!0}),C("design:type",String)],wd.prototype,"spreadsheetId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_sheets.fields.range.label",type:"string"}),Ut({handle:"range",userControlled:!0}),C("design:type",String)],wd.prototype,"range",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_sheets.fields.values.label",type:"json"}),Ut({handle:"values",userControlled:!0}),C("design:type",Array)],wd.prototype,"values",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_sheets.fields.valueInputOption.label",type:"select"}),Ut({handle:"valueInputOption",userControlled:!0}),C("design:type",String)],wd.prototype,"valueInputOption",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_sheets.fields.title.label",type:"string"}),Ut({handle:"title",userControlled:!0}),C("design:type",String)],wd.prototype,"title",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_sheets.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],wd.prototype,"baseUrl",void 0),k([$t({handle:"result"}),C("design:type",Object)],wd.prototype,"result",void 0),k([$t({handle:"values",type:"array"}),C("design:type",Array)],wd.prototype,"outputValues",void 0),k([$t({handle:"spreadsheetId",type:"string"}),C("design:type",String)],wd.prototype,"outputSpreadsheetId",void 0),k([$t({handle:"range",type:"string"}),C("design:type",String)],wd.prototype,"outputRange",void 0),wd=k([Mt("core.io.googleSheets",{kind:"core.io.googleSheets",category:"IO",color:"#0f9d58",icon:"ti-brand-google",width:96,height:96,labels:["io","google","sheets","spreadsheet"],metadata:{title:"graph.node.io.google_sheets.name",description:"graph.node.io.google_sheets.description"}}),I()],wd);const vd=["list","get","create","update","delete"];let xd=class extends Wi{constructor(){super(...arguments),this.operation="list"}async execute(e,t){if(!this.operation)throw new Cr("Airtable node requires an operation","GRAPH_AIRTABLE_OPERATION_REQUIRED");const o=vd.includes(this.operation)?this.operation:"list",r=await an(t,e.credentials,"airtable",!1,"Airtable"),n=new Pe;try{switch(await xe(n,{token:Ns(r,"token","Airtable"),baseId:this.baseId??Ns(r,"baseId","Airtable"),baseUrl:this.baseUrl}),o){case"list":{const e=await n.listRecords({table:this.requireTable(),view:this.view,filterByFormula:this.filterByFormula,maxRecords:Rs(this.maxRecords),pageSize:Rs(this.pageSize),offset:this.offset,fields:Array.isArray(this.fields)?this.fields.map(String):void 0,sort:this.sortField?[{field:this.sortField,direction:this.sortDirection}]:void 0});return{result:e,records:e.records,offset:e.offset}}case"get":{const e=await n.getRecord(this.requireTable(),this.requireRecordId());return{result:e,records:[e]}}case"create":{const e=await n.createRecord({table:this.requireTable(),fields:this.requireRecordFields(),typecast:this.typecast});return{result:e,records:[e]}}case"update":{const e=await n.updateRecord({table:this.requireTable(),recordId:this.requireRecordId(),fields:this.requireRecordFields(),typecast:this.typecast});return{result:e,records:[e]}}default:return{result:await n.deleteRecord(this.requireTable(),this.requireRecordId())}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Airtable node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_AIRTABLE_OPERATION_FAILED",{operation:o})}finally{await n.shutdown().catch(()=>{})}}requireTable(){if(!this.table)throw new Cr("Airtable node requires a table","GRAPH_AIRTABLE_TABLE_REQUIRED");return this.table}requireRecordId(){if(!this.recordId)throw new Cr("Airtable node requires a record ID","GRAPH_AIRTABLE_RECORD_REQUIRED");return this.recordId}requireRecordFields(){const e=Es(this.recordFields);if(!e)throw new Cr("Airtable node requires recordFields as an object","GRAPH_AIRTABLE_FIELDS_REQUIRED");return e}};k([i("ngx-decaf-crud-field",{label:"graph.node.io.airtable.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],xd.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.airtable.fields.baseId.label",type:"string"}),Ut({handle:"baseId",userControlled:!0}),C("design:type",String)],xd.prototype,"baseId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.airtable.fields.table.label",type:"string"}),Ut({handle:"table",userControlled:!0}),C("design:type",String)],xd.prototype,"table",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.airtable.fields.recordId.label",type:"string"}),Ut({handle:"recordId",userControlled:!0}),C("design:type",String)],xd.prototype,"recordId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.airtable.fields.recordFields.label",type:"json"}),Ut({handle:"recordFields",userControlled:!0}),C("design:type",Object)],xd.prototype,"recordFields",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.airtable.fields.typecast.label",type:"boolean"}),Ut({handle:"typecast",userControlled:!0}),C("design:type",Boolean)],xd.prototype,"typecast",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.airtable.fields.view.label",type:"string"}),Ut({handle:"view",userControlled:!0}),C("design:type",String)],xd.prototype,"view",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.airtable.fields.filterByFormula.label",type:"string"}),Ut({handle:"filterByFormula",userControlled:!0}),C("design:type",String)],xd.prototype,"filterByFormula",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.airtable.fields.fields.label",type:"json"}),Ut({handle:"fields",userControlled:!0}),C("design:type",Array)],xd.prototype,"fields",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.airtable.fields.sortField.label",type:"string"}),Ut({handle:"sortField",userControlled:!0}),C("design:type",String)],xd.prototype,"sortField",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.airtable.fields.sortDirection.label",type:"select"}),Ut({handle:"sortDirection",userControlled:!0}),C("design:type",String)],xd.prototype,"sortDirection",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.airtable.fields.maxRecords.label",type:"number"}),Ut({handle:"maxRecords",userControlled:!0}),C("design:type",Number)],xd.prototype,"maxRecords",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.airtable.fields.pageSize.label",type:"number"}),Ut({handle:"pageSize",userControlled:!0}),C("design:type",Number)],xd.prototype,"pageSize",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.airtable.fields.offset.label",type:"string"}),Ut({handle:"offset",userControlled:!0}),C("design:type",String)],xd.prototype,"offset",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.airtable.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],xd.prototype,"baseUrl",void 0),k([$t({handle:"result"}),C("design:type",Object)],xd.prototype,"result",void 0),k([$t({handle:"records",type:"array"}),C("design:type",Array)],xd.prototype,"records",void 0),k([$t({handle:"offset",type:"string"}),C("design:type",String)],xd.prototype,"nextOffset",void 0),xd=k([Mt("core.io.airtable",{kind:"core.io.airtable",category:"IO",color:"#fcb400",icon:"ti-table",width:96,height:96,labels:["io","airtable","database","records"],metadata:{title:"graph.node.io.airtable.name",description:"graph.node.io.airtable.description"}}),I()],xd);const Id=["parse","write"];let _d=class extends Wi{constructor(){super(...arguments),this.spreadsheets=new De,this.operation="parse"}async execute(e){const t=Id.includes(this.operation)?this.operation:"parse";try{if("parse"===t){const t=this.content??e.inputs.value;if("string"!=typeof t)throw new Cr("Spreadsheet File parse requires text content","GRAPH_SPREADSHEET_CONTENT_REQUIRED");const o=this.spreadsheets.parse(t,{format:this.format,delimiter:this.delimiter,header:this.hasHeader});return{result:o,content:t,rows:o.rows,header:o.header}}const o=Array.isArray(this.rows)?this.rows:Array.isArray(e.inputs.value)?e.inputs.value:void 0;if(!o)throw new Cr("Spreadsheet File write requires rows as an array of arrays","GRAPH_SPREADSHEET_ROWS_REQUIRED");const r=this.spreadsheets.serialize(o,{format:this.format,delimiter:this.delimiter,header:Os(this.header)?.map(String)});return{result:r,content:r}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Spreadsheet File node operation '${t}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_SPREADSHEET_OPERATION_FAILED",{operation:t})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.io.spreadsheet_file.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],_d.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.spreadsheet_file.fields.format.label",type:"select"}),Ut({handle:"format",userControlled:!0}),C("design:type",String)],_d.prototype,"format",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.spreadsheet_file.fields.delimiter.label",type:"string"}),Ut({handle:"delimiter",userControlled:!0}),C("design:type",String)],_d.prototype,"delimiter",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.spreadsheet_file.fields.content.label",type:"textarea"}),Ut({handle:"content",userControlled:!0}),C("design:type",String)],_d.prototype,"content",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.spreadsheet_file.fields.rows.label",type:"json"}),Ut({handle:"rows",userControlled:!0}),C("design:type",Array)],_d.prototype,"rows",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.spreadsheet_file.fields.header.label",type:"json"}),Ut({handle:"header",userControlled:!0}),C("design:type",Array)],_d.prototype,"header",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.spreadsheet_file.fields.hasHeader.label",type:"boolean"}),Ut({handle:"hasHeader",userControlled:!0}),C("design:type",Boolean)],_d.prototype,"hasHeader",void 0),k([$t({handle:"result"}),C("design:type",Object)],_d.prototype,"result",void 0),k([$t({handle:"content",type:"string"}),C("design:type",String)],_d.prototype,"outputContent",void 0),k([$t({handle:"rows",type:"array"}),C("design:type",Array)],_d.prototype,"outputRows",void 0),k([$t({handle:"header",type:"array"}),C("design:type",Array)],_d.prototype,"outputHeader",void 0),_d=k([Mt("core.io.spreadsheetFile",{kind:"core.io.spreadsheetFile",category:"IO",color:"#217346",icon:"ti-file-spreadsheet",width:96,height:96,labels:["io","spreadsheet","csv","tsv","json"],metadata:{title:"graph.node.io.spreadsheet_file.name",description:"graph.node.io.spreadsheet_file.description"}}),I()],_d);const Ed=["query","mutation"];let Ad=class extends Wi{constructor(){super(...arguments),this.operation="query"}async execute(e,t){if(!this.operation)throw new Cr("GraphQL node requires an operation","GRAPH_GRAPHQL_OPERATION_REQUIRED");const o=Ed.includes(this.operation)?this.operation:"query",r=this.query??(e.inputs.value??"")+"";if(!r)throw new Cr("GraphQL node requires a query document","GRAPH_GRAPHQL_QUERY_REQUIRED");const n=await an(t,e.credentials,"graphql",!1,"GraphQL"),i=new je;try{await xe(i,{endpoint:this.endpoint??Ns(n,"endpoint","GraphQL"),token:Ns(n,"token","GraphQL")});const e=await i.request({query:r,variables:Es(this.variables),operationName:this.operationName});return e.errors&&e.errors.length>0?{result:e.data,errors:e.errors}:{result:e.data}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`GraphQL node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_GRAPHQL_OPERATION_FAILED",{operation:o})}finally{await i.shutdown().catch(()=>{})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.io.graphql.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],Ad.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.graphql.fields.endpoint.label",type:"string"}),Ut({handle:"endpoint",userControlled:!0}),C("design:type",String)],Ad.prototype,"endpoint",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.graphql.fields.query.label",type:"textarea"}),Ut({handle:"query",userControlled:!0}),C("design:type",String)],Ad.prototype,"query",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.graphql.fields.variables.label",type:"json"}),Ut({handle:"variables",userControlled:!0}),C("design:type",Object)],Ad.prototype,"variables",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.graphql.fields.operationName.label",type:"string"}),Ut({handle:"operationName",userControlled:!0}),C("design:type",String)],Ad.prototype,"operationName",void 0),k([$t({handle:"result"}),C("design:type",Object)],Ad.prototype,"result",void 0),k([$t({handle:"errors",type:"array"}),C("design:type",Array)],Ad.prototype,"errors",void 0),Ad=k([Mt("core.io.graphql",{kind:"core.io.graphql",category:"IO",color:"#e10098",icon:"ti-api",width:96,height:96,labels:["io","graphql","api","query"],metadata:{title:"graph.node.io.graphql.name",description:"graph.node.io.graphql.description"}}),I()],Ad);const Sd=["listWorksheets","getRange","updateRange","listTables","addTableRow"];function Rd(e){const t=(e=>{if(null==e||""===e)throw new Cr("Microsoft Excel operation requires values","GRAPH_EXCEL_VALUES_REQUIRED");if(Array.isArray(e))return e;if("string"==typeof e)try{const t=JSON.parse(e);if(Array.isArray(t))return t}catch{throw new Cr("Microsoft Excel values must be a JSON array","GRAPH_EXCEL_VALUES_INVALID")}throw new Cr("Microsoft Excel values must be a JSON array","GRAPH_EXCEL_VALUES_INVALID")})(e);return 0===t.length?[]:Array.isArray(t[0])?t:[t]}let Od=class extends Wi{constructor(){super(...arguments),this.operation="getRange"}async execute(e,t){if(!this.operation)throw new Cr("Microsoft Excel node requires an operation","GRAPH_EXCEL_OPERATION_REQUIRED");const o=Sd.includes(this.operation)?this.operation:"getRange",r=await an(t,e.credentials,"microsoft-excel",!1,"Microsoft Excel"),n=new Le;try{await xe(n,{token:Ts(r,"Microsoft Excel"),baseUrl:this.baseUrl});const e={itemId:this.itemId??"",driveId:this.driveId};switch(o){case"listWorksheets":return{result:await n.listWorksheets(e)};case"getRange":return{result:await n.getRange({...e,worksheet:this.worksheet??"",range:this.range??""})};case"updateRange":return{result:await n.updateRange({...e,worksheet:this.worksheet??"",range:this.range??"",values:Rd(this.values)})};case"listTables":return{result:await n.listTables(e)};default:{const t=Rd(this.values);return{result:await n.addTableRow({...e,tableId:this.tableId??"",values:t[0]??[]})}}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Microsoft Excel node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_EXCEL_OPERATION_FAILED",{operation:o})}finally{await n.shutdown().catch(()=>{})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.io.microsoft_excel.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],Od.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.microsoft_excel.fields.itemId.label",type:"string"}),Ut({handle:"itemId",userControlled:!0}),C("design:type",String)],Od.prototype,"itemId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.microsoft_excel.fields.driveId.label",type:"string"}),Ut({handle:"driveId",userControlled:!0}),C("design:type",String)],Od.prototype,"driveId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.microsoft_excel.fields.worksheet.label",type:"string"}),Ut({handle:"worksheet",userControlled:!0}),C("design:type",String)],Od.prototype,"worksheet",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.microsoft_excel.fields.range.label",type:"string"}),Ut({handle:"range",userControlled:!0}),C("design:type",String)],Od.prototype,"range",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.microsoft_excel.fields.values.label",type:"textarea"}),Ut({handle:"values",userControlled:!0}),C("design:type",Object)],Od.prototype,"values",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.microsoft_excel.fields.tableId.label",type:"string"}),Ut({handle:"tableId",userControlled:!0}),C("design:type",String)],Od.prototype,"tableId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.microsoft_excel.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],Od.prototype,"baseUrl",void 0),k([$t({handle:"result"}),C("design:type",Object)],Od.prototype,"result",void 0),Od=k([Mt("core.io.microsoftExcel",{kind:"core.io.microsoftExcel",category:"IO",color:"#217346",icon:"ti-file-spreadsheet",width:96,height:96,labels:["io","microsoft","excel","spreadsheet","onedrive"],metadata:{title:"graph.node.io.microsoft_excel.name",description:"graph.node.io.microsoft_excel.description"}}),I()],Od);const kd=["getPage","listSpaces","createPage","updatePage","deletePage","search"];let Cd=class extends Wi{constructor(){super(...arguments),this.operation="getPage"}async execute(e,t){if(!this.operation)throw new Cr("Confluence node requires an operation","GRAPH_CONFLUENCE_OPERATION_REQUIRED");const o=kd.includes(this.operation)?this.operation:"getPage",r=await an(t,e.credentials,"confluence",!1,"Confluence"),n=new Me;try{switch(await xe(n,{token:Ns(r,"token","Confluence"),username:Ns(r,"username","Confluence"),baseUrl:this.baseUrl??Ns(r,"baseUrl","Confluence")}),o){case"getPage":if(!this.pageId)throw new Cr("Confluence getPage requires a pageId","GRAPH_CONFLUENCE_PAGE_REQUIRED");return{result:await n.getPage(this.pageId)};case"listSpaces":return{result:await n.listSpaces(Rs(this.limit)??25)};case"createPage":if(!this.spaceKey||!this.title)throw new Cr("Confluence createPage requires spaceKey and title","GRAPH_CONFLUENCE_CREATE_REQUIRED");return{result:await n.createPage({spaceKey:this.spaceKey,title:this.title,body:this.body??"",parentId:this.parentId})};case"updatePage":if(!this.pageId||!this.title)throw new Cr("Confluence updatePage requires pageId and title","GRAPH_CONFLUENCE_UPDATE_REQUIRED");return{result:await n.updatePage({pageId:this.pageId,title:this.title,body:this.body??"",version:Rs(this.version)})};case"deletePage":if(!this.pageId)throw new Cr("Confluence deletePage requires a pageId","GRAPH_CONFLUENCE_PAGE_REQUIRED");return{result:await n.deletePage(this.pageId)};default:if(!this.cql)throw new Cr("Confluence search requires a cql query","GRAPH_CONFLUENCE_SEARCH_REQUIRED");return{result:await n.search({cql:this.cql,limit:Rs(this.limit)})}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Confluence node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_CONFLUENCE_OPERATION_FAILED",{operation:o})}finally{await n.shutdown().catch(()=>{})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.io.confluence.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],Cd.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.confluence.fields.pageId.label",type:"string"}),Ut({handle:"pageId",userControlled:!0}),C("design:type",String)],Cd.prototype,"pageId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.confluence.fields.spaceKey.label",type:"string"}),Ut({handle:"spaceKey",userControlled:!0}),C("design:type",String)],Cd.prototype,"spaceKey",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.confluence.fields.title.label",type:"string"}),Ut({handle:"title",userControlled:!0}),C("design:type",String)],Cd.prototype,"title",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.confluence.fields.body.label",type:"textarea"}),Ut({handle:"body",userControlled:!0}),C("design:type",String)],Cd.prototype,"body",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.confluence.fields.parentId.label",type:"string"}),Ut({handle:"parentId",userControlled:!0}),C("design:type",String)],Cd.prototype,"parentId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.confluence.fields.version.label",type:"number"}),Ut({handle:"version",userControlled:!0}),C("design:type",Number)],Cd.prototype,"version",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.confluence.fields.cql.label",type:"string"}),Ut({handle:"cql",userControlled:!0}),C("design:type",String)],Cd.prototype,"cql",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.confluence.fields.limit.label",type:"number"}),Ut({handle:"limit",userControlled:!0}),C("design:type",Number)],Cd.prototype,"limit",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.confluence.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],Cd.prototype,"baseUrl",void 0),k([$t({handle:"result"}),C("design:type",Object)],Cd.prototype,"result",void 0),Cd=k([Mt("core.io.confluence",{kind:"core.io.confluence",category:"IO",color:"#0052cc",icon:"ti-file-text",width:96,height:96,labels:["io","confluence","wiki","atlassian","documentation"],metadata:{title:"graph.node.io.confluence.name",description:"graph.node.io.confluence.description"}}),I()],Cd);const Nd=["createIssue","getIssue","updateIssue","deleteIssue","addComment","getTransitions","transitionIssue","search"];function Td(e,t,o){if(null==e||""===e)return;if("string"==typeof e){try{const t=Es(JSON.parse(e));if(t)return t}catch{}throw new Cr(`Jira ${o} must be a JSON object`,t)}const r=Es(e);if(r)return r;throw new Cr(`Jira ${o} must be a JSON object`,t)}let Pd=class extends Wi{constructor(){super(...arguments),this.operation="createIssue"}async execute(e,t){if(!this.operation)throw new Cr("Jira node requires an operation","GRAPH_JIRA_OPERATION_REQUIRED");const o=Nd.includes(this.operation)?this.operation:"createIssue",r=await an(t,e.credentials,"jira",!1,"Jira"),n=new Ge;try{switch(await xe(n,{token:Ns(r,"token","Jira"),username:Ns(r,"username","Jira"),baseUrl:this.baseUrl??Ns(r,"baseUrl","Jira")}),o){case"createIssue":{if(!this.projectKey||!this.summary)throw new Cr("Jira createIssue requires projectKey and summary","GRAPH_JIRA_CREATE_REQUIRED");const e=await n.createIssue({projectKey:this.projectKey,summary:this.summary,issueType:this.issueType,description:this.description,fields:Td(this.fields,"GRAPH_JIRA_FIELDS_INVALID","fields")}),t=Es(e);return{result:e,..."string"==typeof t?.key?{issueKey:t.key}:{}}}case"getIssue":if(!this.issueKey)throw new Cr("Jira getIssue requires an issueKey","GRAPH_JIRA_ISSUE_REQUIRED");return{result:await n.getIssue(this.issueKey),issueKey:this.issueKey};case"updateIssue":{if(!this.issueKey)throw new Cr("Jira updateIssue requires an issueKey","GRAPH_JIRA_ISSUE_REQUIRED");const e=Td(this.fields,"GRAPH_JIRA_FIELDS_REQUIRED","fields");if(!e)throw new Cr("Jira updateIssue requires fields","GRAPH_JIRA_FIELDS_REQUIRED");return{result:await n.updateIssue({issueKey:this.issueKey,fields:e}),issueKey:this.issueKey}}case"deleteIssue":if(!this.issueKey)throw new Cr("Jira deleteIssue requires an issueKey","GRAPH_JIRA_ISSUE_REQUIRED");return{result:await n.deleteIssue(this.issueKey),issueKey:this.issueKey};case"addComment":if(!this.issueKey||!this.comment)throw new Cr("Jira addComment requires issueKey and comment","GRAPH_JIRA_COMMENT_REQUIRED");return{result:await n.addComment({issueKey:this.issueKey,body:this.comment}),issueKey:this.issueKey};case"getTransitions":if(!this.issueKey)throw new Cr("Jira getTransitions requires an issueKey","GRAPH_JIRA_ISSUE_REQUIRED");return{result:await n.getTransitions(this.issueKey),issueKey:this.issueKey};case"transitionIssue":if(!this.issueKey||!this.transitionId)throw new Cr("Jira transitionIssue requires issueKey and transitionId","GRAPH_JIRA_TRANSITION_REQUIRED");return{result:await n.transitionIssue({issueKey:this.issueKey,transitionId:this.transitionId}),issueKey:this.issueKey};default:if(!this.jql)throw new Cr("Jira search requires a jql query","GRAPH_JIRA_SEARCH_REQUIRED");return{result:await n.search({jql:this.jql,maxResults:Rs(this.maxResults)})}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Jira node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_JIRA_OPERATION_FAILED",{operation:o})}finally{await n.shutdown().catch(()=>{})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.io.jira.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],Pd.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.jira.fields.projectKey.label",type:"string"}),Ut({handle:"projectKey",userControlled:!0}),C("design:type",String)],Pd.prototype,"projectKey",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.jira.fields.issueType.label",type:"string"}),Ut({handle:"issueType",userControlled:!0}),C("design:type",String)],Pd.prototype,"issueType",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.jira.fields.summary.label",type:"string"}),Ut({handle:"summary",userControlled:!0}),C("design:type",String)],Pd.prototype,"summary",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.jira.fields.description.label",type:"textarea"}),Ut({handle:"description",userControlled:!0}),C("design:type",String)],Pd.prototype,"description",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.jira.fields.issueKey.label",type:"string"}),Ut({handle:"issueKey",userControlled:!0}),C("design:type",String)],Pd.prototype,"issueKey",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.jira.fields.fields.label",type:"textarea"}),Ut({handle:"fields",userControlled:!0}),C("design:type",Object)],Pd.prototype,"fields",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.jira.fields.comment.label",type:"textarea"}),Ut({handle:"comment",userControlled:!0}),C("design:type",String)],Pd.prototype,"comment",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.jira.fields.transitionId.label",type:"string"}),Ut({handle:"transitionId",userControlled:!0}),C("design:type",String)],Pd.prototype,"transitionId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.jira.fields.jql.label",type:"string"}),Ut({handle:"jql",userControlled:!0}),C("design:type",String)],Pd.prototype,"jql",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.jira.fields.maxResults.label",type:"number"}),Ut({handle:"maxResults",userControlled:!0}),C("design:type",Number)],Pd.prototype,"maxResults",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.jira.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],Pd.prototype,"baseUrl",void 0),k([$t({handle:"result"}),C("design:type",Object)],Pd.prototype,"result",void 0),k([$t({handle:"issueKey",type:"string"}),C("design:type",String)],Pd.prototype,"resultIssueKey",void 0),Pd=k([Mt("core.io.jira",{kind:"core.io.jira",category:"IO",color:"#0052cc",icon:"ti-brand-jira",width:96,height:96,labels:["io","jira","issues","atlassian","project"],metadata:{title:"graph.node.io.jira.name",description:"graph.node.io.jira.description"}}),I()],Pd);const Dd=["createDocument","getDocument","appendText","replaceAllText","batchUpdate"];function jd(e){if(Array.isArray(e))return e;if("string"==typeof e&&e.trim().length>0)try{const t=JSON.parse(e);if(Array.isArray(t))return t}catch{}throw new Cr("Google Docs requests must be a JSON array","GRAPH_GOOGLE_DOCS_REQUESTS_INVALID")}let Ld=class extends Wi{constructor(){super(...arguments),this.operation="getDocument"}async execute(e,t){if(!this.operation)throw new Cr("Google Docs node requires an operation","GRAPH_GOOGLE_DOCS_OPERATION_REQUIRED");const o=Dd.includes(this.operation)?this.operation:"getDocument",r=await an(t,e.credentials,"google-docs",!1,"Google Docs"),n=new Ue;try{switch(await xe(n,{token:Ns(r,"token","Google Docs"),apiKey:Ns(r,"apiKey","Google Docs"),baseUrl:this.baseUrl}),o){case"createDocument":{if(!this.title)throw new Cr("Google Docs createDocument requires a title","GRAPH_GOOGLE_DOCS_TITLE_REQUIRED");const e=await n.createDocument(this.title),t=Es(e);return{result:e,..."string"==typeof t?.documentId?{documentId:t.documentId}:{}}}case"getDocument":if(!this.documentId)throw new Cr("Google Docs getDocument requires a documentId","GRAPH_GOOGLE_DOCS_DOCUMENT_REQUIRED");return{result:await n.getDocument(this.documentId),documentId:this.documentId};case"appendText":if(!this.documentId||!this.text)throw new Cr("Google Docs appendText requires documentId and text","GRAPH_GOOGLE_DOCS_TEXT_REQUIRED");return{result:await n.appendText(this.documentId,this.text),documentId:this.documentId};case"replaceAllText":if(!this.documentId||!this.findText)throw new Cr("Google Docs replaceAllText requires documentId and findText","GRAPH_GOOGLE_DOCS_REPLACE_REQUIRED");return{result:await n.replaceAllText({documentId:this.documentId,find:this.findText,replace:this.replaceText??"",matchCase:this.matchCase}),documentId:this.documentId};default:if(!this.documentId)throw new Cr("Google Docs batchUpdate requires a documentId","GRAPH_GOOGLE_DOCS_DOCUMENT_REQUIRED");return{result:await n.batchUpdate(this.documentId,jd(this.requests)),documentId:this.documentId}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Google Docs node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_GOOGLE_DOCS_OPERATION_FAILED",{operation:o})}finally{await n.shutdown().catch(()=>{})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_docs.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],Ld.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_docs.fields.documentId.label",type:"string"}),Ut({handle:"documentId",userControlled:!0}),C("design:type",String)],Ld.prototype,"documentId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_docs.fields.title.label",type:"string"}),Ut({handle:"title",userControlled:!0}),C("design:type",String)],Ld.prototype,"title",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_docs.fields.text.label",type:"textarea"}),Ut({handle:"text",userControlled:!0}),C("design:type",String)],Ld.prototype,"text",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_docs.fields.findText.label",type:"string"}),Ut({handle:"findText",userControlled:!0}),C("design:type",String)],Ld.prototype,"findText",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_docs.fields.replaceText.label",type:"string"}),Ut({handle:"replaceText",userControlled:!0}),C("design:type",String)],Ld.prototype,"replaceText",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_docs.fields.matchCase.label",type:"boolean"}),Ut({handle:"matchCase",userControlled:!0}),C("design:type",Boolean)],Ld.prototype,"matchCase",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_docs.fields.requests.label",type:"textarea"}),Ut({handle:"requests",userControlled:!0}),C("design:type",Object)],Ld.prototype,"requests",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_docs.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],Ld.prototype,"baseUrl",void 0),k([$t({handle:"result"}),C("design:type",Object)],Ld.prototype,"result",void 0),k([$t({handle:"documentId",type:"string"}),C("design:type",String)],Ld.prototype,"resultDocumentId",void 0),Ld=k([Mt("core.io.googleDocs",{kind:"core.io.googleDocs",category:"IO",color:"#4285f4",icon:"ti-brand-google",width:96,height:96,labels:["io","google","docs","document"],metadata:{title:"graph.node.io.google_docs.name",description:"graph.node.io.google_docs.description"}}),I()],Ld);const Md=["listSites","getSite","listLists","listItems","createListItem","listDriveItems"];let Gd=class extends Wi{constructor(){super(...arguments),this.operation="listSites"}async execute(e,t){if(!this.operation)throw new Cr("Microsoft SharePoint node requires an operation","GRAPH_SHAREPOINT_OPERATION_REQUIRED");const o=Md.includes(this.operation)?this.operation:"listSites",r=await an(t,e.credentials,"microsoft-sharepoint",!1,"Microsoft SharePoint"),n=new $e;try{switch(await xe(n,{token:Ts(r,"Microsoft SharePoint"),baseUrl:this.baseUrl}),o){case"listSites":return{result:await n.listSites(this.search??"*")};case"getSite":if(!this.siteId)throw new Cr("Microsoft SharePoint getSite requires a siteId","GRAPH_SHAREPOINT_SITE_REQUIRED");return{result:await n.getSite(this.siteId)};case"listLists":if(!this.siteId)throw new Cr("Microsoft SharePoint listLists requires a siteId","GRAPH_SHAREPOINT_SITE_REQUIRED");return{result:await n.listLists(this.siteId)};case"listItems":if(!this.siteId||!this.listId)throw new Cr("Microsoft SharePoint listItems requires siteId and listId","GRAPH_SHAREPOINT_LIST_REQUIRED");return{result:await n.listItems({siteId:this.siteId,listId:this.listId,top:Rs(this.top),filter:this.filter})};case"createListItem":{if(!this.siteId||!this.listId||!this.fields)throw new Cr("Microsoft SharePoint createListItem requires siteId, listId, and fields","GRAPH_SHAREPOINT_ITEM_REQUIRED");const e=(e=>{if(null==e||""===e)return;if("string"==typeof e){try{const t=Es(JSON.parse(e));if(t)return t}catch{}throw new Cr("Microsoft SharePoint fields must be a JSON object","GRAPH_SHAREPOINT_FIELDS_INVALID")}const t=Es(e);if(t)return t;throw new Cr("Microsoft SharePoint fields must be a JSON object","GRAPH_SHAREPOINT_FIELDS_INVALID")})(this.fields);if(!e)throw new Cr("Microsoft SharePoint createListItem requires fields","GRAPH_SHAREPOINT_ITEM_REQUIRED");return{result:await n.createListItem({siteId:this.siteId,listId:this.listId,fields:e})}}default:if(!this.siteId)throw new Cr("Microsoft SharePoint listDriveItems requires a siteId","GRAPH_SHAREPOINT_SITE_REQUIRED");return{result:await n.listDriveItems({siteId:this.siteId,itemId:this.itemId,top:Rs(this.top)})}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Microsoft SharePoint node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_SHAREPOINT_OPERATION_FAILED",{operation:o})}finally{await n.shutdown().catch(()=>{})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.io.microsoft_sharepoint.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],Gd.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.microsoft_sharepoint.fields.siteId.label",type:"string"}),Ut({handle:"siteId",userControlled:!0}),C("design:type",String)],Gd.prototype,"siteId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.microsoft_sharepoint.fields.listId.label",type:"string"}),Ut({handle:"listId",userControlled:!0}),C("design:type",String)],Gd.prototype,"listId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.microsoft_sharepoint.fields.itemId.label",type:"string"}),Ut({handle:"itemId",userControlled:!0}),C("design:type",String)],Gd.prototype,"itemId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.microsoft_sharepoint.fields.search.label",type:"string"}),Ut({handle:"search",userControlled:!0}),C("design:type",String)],Gd.prototype,"search",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.microsoft_sharepoint.fields.top.label",type:"number"}),Ut({handle:"top",userControlled:!0}),C("design:type",Number)],Gd.prototype,"top",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.microsoft_sharepoint.fields.filter.label",type:"string"}),Ut({handle:"filter",userControlled:!0}),C("design:type",String)],Gd.prototype,"filter",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.microsoft_sharepoint.fields.fields.label",type:"textarea"}),Ut({handle:"fields",userControlled:!0}),C("design:type",Object)],Gd.prototype,"fields",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.microsoft_sharepoint.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],Gd.prototype,"baseUrl",void 0),k([$t({handle:"result"}),C("design:type",Object)],Gd.prototype,"result",void 0),Gd=k([Mt("core.io.microsoftSharePoint",{kind:"core.io.microsoftSharePoint",category:"IO",color:"#036c70",icon:"ti-brand-office",width:96,height:96,labels:["io","microsoft","sharepoint","files","lists"],metadata:{title:"graph.node.io.microsoft_sharepoint.name",description:"graph.node.io.microsoft_sharepoint.description"}}),I()],Gd);const Ud=["listCalendars","listEvents","createEvent","getEvent","updateEvent","deleteEvent"];function $d(e){if(null!=e&&""!==e){if(Array.isArray(e))return e.map(e=>(e+"").trim()).filter(e=>e.length>0);if("string"==typeof e){if(e.trim().startsWith("["))try{const t=JSON.parse(e);return Array.isArray(t)?t.map(e=>(e+"").trim()):void 0}catch{throw new Cr("Google Calendar attendees must be a JSON array or a comma-separated list","GRAPH_GOOGLE_CALENDAR_ATTENDEES_INVALID")}return e.split(/[,;]/).map(e=>e.trim()).filter(e=>e.length>0)}}}let Fd=class extends Wi{constructor(){super(...arguments),this.operation="listEvents"}async execute(e,t){if(!this.operation)throw new Cr("Google Calendar node requires an operation","GRAPH_GOOGLE_CALENDAR_OPERATION_REQUIRED");const o=Ud.includes(this.operation)?this.operation:"listEvents",r=await an(t,e.credentials,"google-calendar",!1,"Google Calendar"),n=new Fe;try{switch(await xe(n,{token:Ns(r,"token","Google Calendar"),apiKey:Ns(r,"apiKey","Google Calendar"),calendarId:Ns(r,"calendarId","Google Calendar"),baseUrl:this.baseUrl}),o){case"listCalendars":return{result:await n.listCalendars()};case"listEvents":return{result:await n.listEvents({calendarId:this.calendarId,timeMin:this.timeMin,timeMax:this.timeMax,maxResults:Rs(this.maxResults),q:this.q,singleEvents:this.singleEvents})};case"createEvent":{if(!this.summary||!this.start||!this.end)throw new Cr("Google Calendar createEvent requires summary, start, and end","GRAPH_GOOGLE_CALENDAR_EVENT_REQUIRED");const e=await n.createEvent({calendarId:this.calendarId,summary:this.summary,description:this.description,location:this.location,start:this.start,end:this.end,timeZone:this.timeZone,attendees:$d(this.attendees)}),t=Es(e);return{result:e,..."string"==typeof t?.id?{eventId:t.id}:{}}}case"getEvent":if(!this.eventId)throw new Cr("Google Calendar getEvent requires an eventId","GRAPH_GOOGLE_CALENDAR_EVENT_REQUIRED");return{result:await n.getEvent(this.calendarId??"primary",this.eventId),eventId:this.eventId};case"updateEvent":if(!this.eventId)throw new Cr("Google Calendar updateEvent requires an eventId","GRAPH_GOOGLE_CALENDAR_EVENT_REQUIRED");return{result:await n.updateEvent(this.eventId,{calendarId:this.calendarId,summary:this.summary,description:this.description,location:this.location,start:this.start,end:this.end,timeZone:this.timeZone,attendees:$d(this.attendees)}),eventId:this.eventId};default:if(!this.eventId)throw new Cr("Google Calendar deleteEvent requires an eventId","GRAPH_GOOGLE_CALENDAR_EVENT_REQUIRED");return{result:await n.deleteEvent(this.calendarId??"primary",this.eventId),eventId:this.eventId}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Google Calendar node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_GOOGLE_CALENDAR_OPERATION_FAILED",{operation:o})}finally{await n.shutdown().catch(()=>{})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_calendar.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],Fd.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_calendar.fields.calendarId.label",type:"string"}),Ut({handle:"calendarId",userControlled:!0}),C("design:type",String)],Fd.prototype,"calendarId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_calendar.fields.eventId.label",type:"string"}),Ut({handle:"eventId",userControlled:!0}),C("design:type",String)],Fd.prototype,"eventId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_calendar.fields.summary.label",type:"string"}),Ut({handle:"summary",userControlled:!0}),C("design:type",String)],Fd.prototype,"summary",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_calendar.fields.description.label",type:"textarea"}),Ut({handle:"description",userControlled:!0}),C("design:type",String)],Fd.prototype,"description",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_calendar.fields.location.label",type:"string"}),Ut({handle:"location",userControlled:!0}),C("design:type",String)],Fd.prototype,"location",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_calendar.fields.start.label",type:"string"}),Ut({handle:"start",userControlled:!0}),C("design:type",String)],Fd.prototype,"start",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_calendar.fields.end.label",type:"string"}),Ut({handle:"end",userControlled:!0}),C("design:type",String)],Fd.prototype,"end",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_calendar.fields.timeZone.label",type:"string"}),Ut({handle:"timeZone",userControlled:!0}),C("design:type",String)],Fd.prototype,"timeZone",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_calendar.fields.attendees.label",type:"textarea"}),Ut({handle:"attendees",userControlled:!0}),C("design:type",Object)],Fd.prototype,"attendees",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_calendar.fields.timeMin.label",type:"string"}),Ut({handle:"timeMin",userControlled:!0}),C("design:type",String)],Fd.prototype,"timeMin",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_calendar.fields.timeMax.label",type:"string"}),Ut({handle:"timeMax",userControlled:!0}),C("design:type",String)],Fd.prototype,"timeMax",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_calendar.fields.maxResults.label",type:"number"}),Ut({handle:"maxResults",userControlled:!0}),C("design:type",Number)],Fd.prototype,"maxResults",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_calendar.fields.q.label",type:"string"}),Ut({handle:"q",userControlled:!0}),C("design:type",String)],Fd.prototype,"q",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_calendar.fields.singleEvents.label",type:"boolean"}),Ut({handle:"singleEvents",userControlled:!0}),C("design:type",Boolean)],Fd.prototype,"singleEvents",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.google_calendar.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],Fd.prototype,"baseUrl",void 0),k([$t({handle:"result"}),C("design:type",Object)],Fd.prototype,"result",void 0),k([$t({handle:"eventId",type:"string"}),C("design:type",String)],Fd.prototype,"resultEventId",void 0),Fd=k([Mt("core.io.googleCalendar",{kind:"core.io.googleCalendar",category:"IO",color:"#4285f4",icon:"ti-calendar-event",width:96,height:96,labels:["io","google","calendar","events","scheduling"],metadata:{title:"graph.node.io.google_calendar.name",description:"graph.node.io.google_calendar.description"}}),I()],Fd);const Hd=new Set(["workdocs"]);function Bd(){return["/etc","/proc","/root",oe(de(),".ssh")]}function qd(){const e=process.env.GRAPH_FILE_IO_BASE?.trim(),t=oe(e&&e.length>0?e:process.cwd());try{return le(t)}catch{return t}}function Wd(e,t){const o=re(e,t);return""===o||!o.startsWith("..")&&!ie(o)}function Kd(e,t,o){if(!Wd(e,t))throw new Cr(`File node path '${o}' resolves outside the configured file IO base`,"GRAPH_FILE_PATH_FORBIDDEN",{path:o,base:e});for(const e of Bd())if(Wd(e,t))throw new Cr(`File node path '${o}' targets a forbidden directory`,"GRAPH_FILE_PATH_FORBIDDEN",{path:o});const r=re(e,t).split(ne).filter(Boolean);for(const e of r)if(Hd.has(e.toLowerCase()))throw new Cr(`File node path '${o}' targets a forbidden directory`,"GRAPH_FILE_PATH_FORBIDDEN",{path:o,segment:e})}function Vd(e){if(e.includes("\0"))throw new Cr("File node path contains a NUL byte","GRAPH_FILE_INVALID_PATH",{path:e});const t=qd();(e=>{if(!ie(e))return;const t=oe(e);for(const o of Bd())if(Wd(o,t))throw new Cr(`File node path '${e}' targets a forbidden directory`,"GRAPH_FILE_PATH_FORBIDDEN",{path:e})})(e);const o=e.replace(/^[/\\]+/,""),r=oe(t,o);return Kd(t,r,e),{base:t,candidate:r}}async function zd(e){let t=e;for(;;)try{return await ce(t)}catch{const e=te(t);if(e===t)return;t=e}}const Qd={".csv":"text/csv",".gif":"image/gif",".htm":"text/html",".html":"text/html",".ics":"text/calendar",".jpeg":"image/jpeg",".jpg":"image/jpeg",".json":"application/json",".md":"text/markdown",".ods":"application/vnd.oasis.opendocument.spreadsheet",".pdf":"application/pdf",".png":"image/png",".rtf":"application/rtf",".svg":"image/svg+xml",".txt":"text/plain",".xls":"application/vnd.ms-excel",".xlsx":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".xml":"application/xml",".zip":"application/zip"};function Jd(e){return Qd[ae(e).toLowerCase()]??"application/octet-stream"}function Xd(e,t,o,r){const n={fileName:t,mimeType:r||Jd(t),byteLength:e.byteLength,data:e.toString("base64")};return void 0!==o&&(n.path=o),n}function Yd(e,t="utf8",o="data"){if("string"==typeof e){if(e.startsWith("data:")){const t=e.indexOf(",");if(t>=0)return Buffer.from(e.slice(t+1),"base64")}return"base64"===t?Buffer.from(e,"base64"):Buffer.from(e,"utf8")}if(_a(e))return Buffer.isBuffer(e)?e:Buffer.from(e instanceof ArrayBuffer?new Uint8Array(e):e);if(pa(e)){const r="auto"===t?"number"==typeof e.byteLength||"string"==typeof e.mimeType?"base64":"utf8":t;for(const t of[o,"data","content","value"])if(t&&void 0!==e[t]&&e[t]!==e)return Yd(e[t],r,o)}throw new Cr("File node requires a binary payload","GRAPH_BINARY_INPUT_REQUIRED",{valueType:typeof e})}async function Zd(e){const{base:t,candidate:o}=Vd(e);let r;try{r=await ce(o)}catch{throw new Cr(`File node path '${e}' does not exist`,"GRAPH_FILE_INVALID_PATH",{path:e})}Kd(t,r,e);const n=await pe(r);return{payload:Xd(n,se(o),e,Jd(o)),bytes:n.byteLength}}function el(e,t,o){const r=e;let n;switch(t.returnValue??"text"){case"attribute":n=t.attribute?r.attr(t.attribute):void 0;break;case"html":n=r.html()??void 0;break;case"value":{const e=r.val();n=void 0===e?void 0:Array.isArray(e)?e.join(","):e;break}default:n=((e,t)=>{const o=e;if(!t.skipSelectors)return o.text()||void 0;const r=t.skipSelectors.split(",").map(e=>e.trim()).filter(e=>e.length>0).map(e=>({selector:e,format:"skip"}));return Be(o.html()??"",{selectors:r})||void 0})(e,t)}if(void 0!==n)return((e,t)=>{if(void 0===e)return e;let o=e;return!1!==t.trimValues&&(o=o.trim()),t.cleanUpText&&(o=o.replace(/^\s+|\s+$/g,"").replace(/(\r\n|\n|\r)/gm,"").replace(/\s+/g," ")),o})(n,o)}function tl(e,t,o={}){const r=He.load(e),n={};for(const e of t){if(!e||"string"!=typeof e.cssSelector)continue;const t=e.key||e.cssSelector,i=r(e.cssSelector);if(e.returnArray){const a=[];i.each((t,n)=>{a.push(el(r(n),e,o))}),n[t]=a}else n[t]=el(i,e,o)}return n}function ol(e){if("string"==typeof e)return[e];if(Array.isArray(e))return e.flatMap(e=>ol(e));if(Buffer.isBuffer(e)||e instanceof Uint8Array)return[Buffer.from(e).toString("utf8")];if(e instanceof ArrayBuffer)return[Buffer.from(new Uint8Array(e)).toString("utf8")];if(pa(e))for(const t of["data","content","html","value"])if(void 0!==e[t]&&e[t]!==e)return ol(e[t]);return[]}function rl(e,t){return e.replace(/\{\{\s*([^}]+?)\s*\}\}/g,(e,o)=>{const r=(o+"").replace(/^\$json\.?/,"").trim(),n=fa(t,r,!0);return null==n?"":"object"==typeof n?JSON.stringify(n):n+""})}function nl(e,t={}){const o=e.map(e=>pa(e)?e:{value:e}),r=Array.from(new Set(o.flatMap(e=>Object.keys(e)))),n=t.customStyling?"":"style='border-spacing:0; font-family:helvetica,arial,sans-serif'",i=t.customStyling?"":"style='margin:0; padding:7px 20px 7px 0px; border-bottom:1px solid #eee; text-align:left; color:#888; font-weight:normal'",a=t.customStyling?"":"style='margin:0; padding:7px 20px 7px 0px; border-bottom:1px solid #eee'";let s=`<table ${n} ${t.tableAttributes??""}>`;t.caption&&(s+=`<caption>${t.caption}</caption>`),s+=`<thead ${i} ${t.headerAttributes??""}>`,s+="<tr>",s+=r.map(e=>`<th>${((e,t)=>t?e.split("_").filter(e=>e).map(e=>e[0].toUpperCase()+e.slice(1)).join(" "):e)(e,t.capitalize)}</th>`).join(""),s+="</tr></thead><tbody>";for(const e of o)s+=`<tr ${t.rowAttributes??""}>`,s+=r.map(o=>{const r=e[o];let n=`<td ${a} ${t.cellAttributes??""}>`;return n+="boolean"==typeof r?`<input type="checkbox" ${r?'checked="checked"':""}/>`:null==r?"":r+"",n+="</td>",n}).join(""),s+="</tr>";return s+="</tbody></table>",s}const il=["csv","html","toJson","toText","toBinary"];function al(e,t){if(null==e)return"";const o="object"==typeof e?JSON.stringify(e):e+"";return o.includes('"')||o.includes("\n")||o.includes("\r")||o.includes(t)?`"${o.replace(/"/g,'""')}"`:o}function sl(e,t){return Buffer.from(`${t?"\ufeff":""}${e}`,"utf8")}let dl=class extends Wi{constructor(){super(...arguments),this.operation="csv",this.binaryPropertyName="data",this.mode="once",this.delimiter=",",this.headerRow=!0,this.addBOM=!1,this.format=!1,this.dataIsBase64=!0,this.customStyling=!1,this.capitalize=!1}execute(e){if(!il.includes(this.operation))throw new Cr(`Convert to File operation '${this.operation}' is not supported`,"GRAPH_CONVERT_TO_FILE_UNSUPPORTED_OPERATION",{operation:this.operation});const t=ua(e.inputs.value).map(e=>pa(e)?e:{value:e});switch(this.operation){case"csv":{const e=((e,t,o)=>{const r=Array.from(new Set(e.flatMap(e=>Object.keys(e)))),n=[];o&&n.push(r.map(e=>al(e,t)).join(t));for(const o of e)n.push(r.map(e=>al(o[e],t)).join(t));return n.join("\n")})(t,this.delimiter||",",!1!==this.headerRow),o=Xd(sl(e,this.addBOM),this.fileName||"file.csv",void 0,"text/csv");return{result:o,content:e,bytes:o.byteLength}}case"html":{const e=`<!DOCTYPE html><html><body>${nl(t,{caption:this.caption,customStyling:!0===this.customStyling,capitalize:!0===this.capitalize})}</body></html>`,o=Xd(sl(e,this.addBOM),this.fileName||"file.html",void 0,"text/html");return{result:o,content:e,bytes:o.byteLength}}case"toText":{const e=this.textPayloads(t);return this.returnPayloads(e)}case"toBinary":{const e=this.binaryPayloads(t);return this.returnPayloads(e)}default:{if("each"===this.mode){const e=t.map(e=>Xd(sl(JSON.stringify(e,null,this.format?2:0),this.addBOM),this.fileName||"file.json",void 0,"application/json"));return this.returnPayloads(e)}const e=JSON.stringify(t,null,this.format?2:0),o=Xd(sl(e,this.addBOM),this.fileName||"file.json",void 0,"application/json");return{result:o,content:e,bytes:o.byteLength}}}}textPayloads(e){return e.map(e=>{const t=this.sourceProperty?fa(e,this.sourceProperty,!0):e.value??e;if(null==t)throw new Cr(`Convert to File node could not find '${this.sourceProperty}' in the input`,"GRAPH_CONVERT_TO_FILE_SOURCE_REQUIRED",{sourceProperty:this.sourceProperty});return Xd(sl("string"==typeof t?t:t+"",this.addBOM),this.fileName||"file.txt",void 0,"text/plain")})}binaryPayloads(e){return e.map(e=>{const t=this.sourceProperty?fa(e,this.sourceProperty,!0):e.data??e.value;if("string"!=typeof t)throw new Cr(`Convert to File node requires a base64 string in '${this.sourceProperty??"data"}'`,"GRAPH_CONVERT_TO_FILE_SOURCE_REQUIRED",{sourceProperty:this.sourceProperty});const o=t.startsWith("data:")?t.slice(t.indexOf(",")+1):t;return!1===this.dataIsBase64?Xd(Buffer.from(o,"utf8"),this.fileName||"file.bin",void 0,this.mimeType||"application/octet-stream"):Xd(Buffer.from(o,"base64"),this.fileName||"file.bin",void 0,this.mimeType||"application/octet-stream")})}returnPayloads(e){return 1===e.length?{result:e[0],bytes:e[0].byteLength}:{result:e,bytes:e.reduce((e,t)=>e+t.byteLength,0)}}};k([w(),Ut({handle:"value"}),C("design:type",Object)],dl.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.convert_to_file.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],dl.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.convert_to_file.fields.binaryPropertyName.label",type:"text"}),Ut({handle:"binaryPropertyName",userControlled:!0}),C("design:type",String)],dl.prototype,"binaryPropertyName",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.convert_to_file.fields.sourceProperty.label",placeholder:"graph.node.io.convert_to_file.fields.sourceProperty.placeholder",type:"text"}),Ut({handle:"sourceProperty",userControlled:!0}),C("design:type",String)],dl.prototype,"sourceProperty",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.convert_to_file.fields.mode.label",type:"select"}),Ut({handle:"mode",userControlled:!0}),C("design:type",String)],dl.prototype,"mode",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.convert_to_file.fields.fileName.label",placeholder:"graph.node.io.convert_to_file.fields.fileName.placeholder",type:"text"}),Ut({handle:"fileName",userControlled:!0}),C("design:type",String)],dl.prototype,"fileName",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.convert_to_file.fields.mimeType.label",type:"text"}),Ut({handle:"mimeType",userControlled:!0}),C("design:type",String)],dl.prototype,"mimeType",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.convert_to_file.fields.delimiter.label",type:"text"}),Ut({handle:"delimiter",userControlled:!0}),C("design:type",String)],dl.prototype,"delimiter",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.convert_to_file.fields.headerRow.label",type:"checkbox"}),Ut({handle:"headerRow",userControlled:!0}),C("design:type",Boolean)],dl.prototype,"headerRow",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.convert_to_file.fields.sheetName.label",type:"text"}),Ut({handle:"sheetName",userControlled:!0}),C("design:type",String)],dl.prototype,"sheetName",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.convert_to_file.fields.addBOM.label",type:"checkbox"}),Ut({handle:"addBOM",userControlled:!0}),C("design:type",Boolean)],dl.prototype,"addBOM",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.convert_to_file.fields.format.label",type:"checkbox"}),Ut({handle:"format",userControlled:!0}),C("design:type",Boolean)],dl.prototype,"format",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.convert_to_file.fields.dataIsBase64.label",type:"checkbox"}),Ut({handle:"dataIsBase64",userControlled:!0}),C("design:type",Boolean)],dl.prototype,"dataIsBase64",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.convert_to_file.fields.caption.label",type:"text"}),Ut({handle:"caption",userControlled:!0}),C("design:type",String)],dl.prototype,"caption",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.convert_to_file.fields.customStyling.label",type:"checkbox"}),Ut({handle:"customStyling",userControlled:!0}),C("design:type",Boolean)],dl.prototype,"customStyling",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.convert_to_file.fields.capitalize.label",type:"checkbox"}),Ut({handle:"capitalize",userControlled:!0}),C("design:type",Boolean)],dl.prototype,"capitalize",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],dl.prototype,"result",void 0),k([$t({handle:"content"}),C("design:type",String)],dl.prototype,"content",void 0),k([$t({handle:"bytes"}),C("design:type",Number)],dl.prototype,"bytes",void 0),dl=k([Mt("core.io.convertToFile",{kind:"core.io.convertToFile",category:"IO",color:"#0ea5e9",icon:"ti-file-arrow-right",width:96,height:96,labels:["io","file","convert","binary","csv","json"],metadata:{title:"graph.node.io.convert_to_file.name",description:"graph.node.io.convert_to_file.description"}}),I()],dl);let ll=class extends Wi{constructor(){super(...arguments),this.operation="generateHtmlTemplate",this.sourceData="json",this.dataPropertyName="data",this.extractionValues=[],this.trimValues=!0,this.cleanUpText=!1,this.customStyling=!1,this.capitalize=!1}execute(e){const t=e.inputs.value;switch(this.operation){case"extractHtmlContent":{const e=this.dataPropertyName||"data";let o;if(o="binary"===this.sourceData?[Yd(t,"base64",e).toString("utf8")]:pa(t)?ol(fa(t,e,!0)??t):ol(t),0===o.length)throw new Cr("HTML node requires HTML content to extract","GRAPH_HTML_INVALID_INPUT");const r=(this.extractionValues??[]).filter(e=>e&&"string"==typeof e.cssSelector);if(0===r.length)throw new Cr("HTML node requires at least one extraction value","GRAPH_HTML_EXTRACT_VALUES_REQUIRED");return{result:o.map(e=>tl(e,r,{trimValues:!1!==this.trimValues,cleanUpText:!0===this.cleanUpText}))}}case"convertToHtmlTable":{const e=nl(ua(t),{caption:this.caption,tableAttributes:this.tableAttributes,headerAttributes:this.headerAttributes,rowAttributes:this.rowAttributes,cellAttributes:this.cellAttributes,customStyling:!0===this.customStyling,capitalize:!0===this.capitalize});return{result:e,table:e}}default:if(!this.html)throw new Cr("HTML node requires a template to render","GRAPH_HTML_TEMPLATE_REQUIRED");return Array.isArray(t)?{result:t.filter(e=>null!=e).map(e=>rl(this.html,e))}:{result:rl(this.html,t)}}}};k([Ut({handle:"value"}),C("design:type",Object)],ll.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],ll.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html.fields.html.label",type:"textarea"}),Ut({handle:"html",userControlled:!0}),C("design:type",String)],ll.prototype,"html",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html.fields.sourceData.label",type:"select"}),Ut({handle:"sourceData",userControlled:!0}),C("design:type",String)],ll.prototype,"sourceData",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html.fields.dataPropertyName.label",placeholder:"graph.node.io.html.fields.dataPropertyName.placeholder",type:"text"}),Ut({handle:"dataPropertyName",userControlled:!0}),C("design:type",String)],ll.prototype,"dataPropertyName",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html.fields.extractionValues.label",placeholder:"graph.node.io.html.fields.extractionValues.placeholder",type:"collection"}),Ut({handle:"extractionValues",userControlled:!0,type:"array"}),C("design:type",Array)],ll.prototype,"extractionValues",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html.fields.trimValues.label",type:"checkbox"}),Ut({handle:"trimValues",userControlled:!0}),C("design:type",Boolean)],ll.prototype,"trimValues",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html.fields.cleanUpText.label",type:"checkbox"}),Ut({handle:"cleanUpText",userControlled:!0}),C("design:type",Boolean)],ll.prototype,"cleanUpText",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html.fields.caption.label",type:"text"}),Ut({handle:"caption",userControlled:!0}),C("design:type",String)],ll.prototype,"caption",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html.fields.tableAttributes.label",type:"text"}),Ut({handle:"tableAttributes",userControlled:!0}),C("design:type",String)],ll.prototype,"tableAttributes",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html.fields.headerAttributes.label",type:"text"}),Ut({handle:"headerAttributes",userControlled:!0}),C("design:type",String)],ll.prototype,"headerAttributes",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html.fields.rowAttributes.label",type:"text"}),Ut({handle:"rowAttributes",userControlled:!0}),C("design:type",String)],ll.prototype,"rowAttributes",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html.fields.cellAttributes.label",type:"text"}),Ut({handle:"cellAttributes",userControlled:!0}),C("design:type",String)],ll.prototype,"cellAttributes",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html.fields.customStyling.label",type:"checkbox"}),Ut({handle:"customStyling",userControlled:!0}),C("design:type",Boolean)],ll.prototype,"customStyling",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html.fields.capitalize.label",type:"checkbox"}),Ut({handle:"capitalize",userControlled:!0}),C("design:type",Boolean)],ll.prototype,"capitalize",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],ll.prototype,"result",void 0),k([$t({handle:"table"}),C("design:type",String)],ll.prototype,"table",void 0),ll=k([Mt("core.io.html",{kind:"core.io.html",category:"IO",color:"#0ea5e9",icon:"ti-brand-html5",width:96,height:96,labels:["io","html","template","table"],metadata:{title:"graph.node.io.html.name",description:"graph.node.io.html.description"}}),I()],ll);let cl=class extends Wi{constructor(){super(...arguments),this.sourceData="json",this.dataPropertyName="data",this.extractionValues=[],this.trimValues=!0,this.cleanUpText=!1}execute(e){const t=e.inputs.value,o=this.dataPropertyName||"data";let r;if(r="binary"===this.sourceData?[Yd(t,"base64",o).toString("utf8")]:pa(t)?ol(fa(t,o,!0)??t):ol(t),0===r.length)throw new Cr("HTML Extract node requires HTML content","GRAPH_HTML_EXTRACT_INVALID_INPUT");const n=(this.extractionValues??[]).filter(e=>e&&"string"==typeof e.cssSelector);if(0===n.length)throw new Cr("HTML Extract node requires at least one extraction value","GRAPH_HTML_EXTRACT_VALUES_REQUIRED");return{result:r.map(e=>tl(e,n,{trimValues:!1!==this.trimValues,cleanUpText:!0===this.cleanUpText}))}}};k([w(),Ut({handle:"value"}),C("design:type",Object)],cl.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html_extract.fields.sourceData.label",type:"select"}),Ut({handle:"sourceData",userControlled:!0}),C("design:type",String)],cl.prototype,"sourceData",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html_extract.fields.dataPropertyName.label",placeholder:"graph.node.io.html_extract.fields.dataPropertyName.placeholder",type:"text"}),Ut({handle:"dataPropertyName",userControlled:!0}),C("design:type",String)],cl.prototype,"dataPropertyName",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html_extract.fields.extractionValues.label",placeholder:"graph.node.io.html_extract.fields.extractionValues.placeholder",type:"collection"}),Ut({handle:"extractionValues",userControlled:!0,type:"array"}),C("design:type",Array)],cl.prototype,"extractionValues",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html_extract.fields.trimValues.label",type:"checkbox"}),Ut({handle:"trimValues",userControlled:!0}),C("design:type",Boolean)],cl.prototype,"trimValues",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.html_extract.fields.cleanUpText.label",type:"checkbox"}),Ut({handle:"cleanUpText",userControlled:!0}),C("design:type",Boolean)],cl.prototype,"cleanUpText",void 0),k([w(),$t({handle:"result"}),C("design:type",Array)],cl.prototype,"result",void 0),cl=k([Mt("core.io.htmlExtract",{kind:"core.io.htmlExtract",category:"IO",color:"#0ea5e9",icon:"ti-cut",width:96,height:96,labels:["io","html","extract","css"],metadata:{title:"graph.node.io.html_extract.name",description:"graph.node.io.html_extract.description"}}),I()],cl);let pl=class extends Wi{constructor(){super(...arguments),this.mode="htmlToMarkdown"}execute(e){const t=e.inputs.value,o="markdownToHtml"===this.mode?this.markdown??t:this.html??t;if("string"!=typeof o||0===o.length)throw new Cr(`Markdown node requires ${"markdownToHtml"===this.mode?"markdown":"HTML"} content`,"GRAPH_MARKDOWN_CONTENT_REQUIRED");let r;try{r="markdownToHtml"===this.mode?qe.parse(o):this.turndown().turndown(o)}catch(e){throw new Cr("Markdown node conversion failed: "+(e instanceof Error?e.message:e+""),"GRAPH_MARKDOWN_CONVERSION_FAILED")}if(!this.destinationKey)return{result:r,content:r};const n={};return ya(n,this.destinationKey,r,!0),{result:n,content:r}}turndown(){const e=new We({headingStyle:this.headingStyle??"atx",hr:this.hr??"---",bulletListMarker:this.bulletMarker??"*",codeBlockStyle:"fenced",fence:this.codeBlockFence??"```",emDelimiter:this.emDelimiter??"_",strongDelimiter:this.strongDelimiter??"**",linkStyle:this.linkStyle??"inlined"});for(const t of La(this.ignore,"Ignored Elements"))e.remove(t);return e}};k([Ut({handle:"value"}),C("design:type",Object)],pl.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.markdown.fields.mode.label",type:"select"}),Ut({handle:"mode",userControlled:!0}),C("design:type",String)],pl.prototype,"mode",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.markdown.fields.markdown.label",type:"textarea"}),Ut({handle:"markdown",userControlled:!0}),C("design:type",String)],pl.prototype,"markdown",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.markdown.fields.html.label",type:"textarea"}),Ut({handle:"html",userControlled:!0}),C("design:type",String)],pl.prototype,"html",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.markdown.fields.destinationKey.label",placeholder:"graph.node.io.markdown.fields.destinationKey.placeholder",type:"text"}),Ut({handle:"destinationKey",userControlled:!0}),C("design:type",String)],pl.prototype,"destinationKey",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.markdown.fields.headingStyle.label",type:"select"}),Ut({handle:"headingStyle",userControlled:!0}),C("design:type",String)],pl.prototype,"headingStyle",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.markdown.fields.hr.label",type:"text"}),Ut({handle:"hr",userControlled:!0}),C("design:type",String)],pl.prototype,"hr",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.markdown.fields.bulletMarker.label",type:"text"}),Ut({handle:"bulletMarker",userControlled:!0}),C("design:type",String)],pl.prototype,"bulletMarker",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.markdown.fields.codeBlockFence.label",type:"text"}),Ut({handle:"codeBlockFence",userControlled:!0}),C("design:type",String)],pl.prototype,"codeBlockFence",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.markdown.fields.emDelimiter.label",type:"text"}),Ut({handle:"emDelimiter",userControlled:!0}),C("design:type",String)],pl.prototype,"emDelimiter",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.markdown.fields.strongDelimiter.label",type:"text"}),Ut({handle:"strongDelimiter",userControlled:!0}),C("design:type",String)],pl.prototype,"strongDelimiter",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.markdown.fields.linkStyle.label",type:"select"}),Ut({handle:"linkStyle",userControlled:!0}),C("design:type",String)],pl.prototype,"linkStyle",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.markdown.fields.ignore.label",placeholder:"graph.node.io.markdown.fields.ignore.placeholder",type:"text"}),Ut({handle:"ignore",userControlled:!0}),C("design:type",Object)],pl.prototype,"ignore",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],pl.prototype,"result",void 0),k([$t({handle:"content"}),C("design:type",String)],pl.prototype,"content",void 0),pl=k([Mt("core.io.markdown",{kind:"core.io.markdown",category:"IO",color:"#0ea5e9",icon:"ti-markdown",width:96,height:96,labels:["io","markdown","html","convert"],metadata:{title:"graph.node.io.markdown.name",description:"graph.node.io.markdown.description"}}),I()],pl);const ul=10485760,gl=/<!ENTITY/i;let hl=class extends Wi{constructor(){super(...arguments),this.mode="xmlToJson",this.dataPropertyName="data",this.attrkey="$",this.charkey="_",this.explicitArray=!1,this.explicitRoot=!0,this.ignoreAttrs=!1,this.mergeAttrs=!0,this.normalize=!1,this.normalizeTags=!1,this.trim=!1,this.cdata=!1,this.headless=!1,this.rootName="root",this.allowSurrogateChars=!1}async execute(e){const t=e.inputs.value;if("xmlToJson"===this.mode){const e=this.xmlTextOf(t),o=Buffer.byteLength(e,"utf8");if(o>ul)throw new Cr(`XML input of ${o} bytes exceeds the 10485760-byte limit`,"GRAPH_XML_INPUT_TOO_LARGE",{byteLength:o,maxBytes:ul});if(gl.test(e))throw new Cr("XML input entity declarations are not allowed","GRAPH_XML_ENTITY_FORBIDDEN");const r=new Ke({attrkey:this.attrkey||"$",charkey:this.charkey||"_",explicitArray:!0===this.explicitArray,explicitRoot:!1!==this.explicitRoot,ignoreAttrs:!0===this.ignoreAttrs,mergeAttrs:!1!==this.mergeAttrs,normalize:!0===this.normalize,normalizeTags:!0===this.normalizeTags,trim:!0===this.trim});try{const t=await r.parseStringPromise(e);return{result:this.wrap(t)}}catch(e){throw new Cr("XML node could not parse XML: "+(e instanceof Error?e.message:e+""),"GRAPH_XML_PARSE_FAILED")}}const o=t;if(null==o)throw new Cr("XML node requires JSON data to convert","GRAPH_XML_INVALID_INPUT");const r=new Ve({attrkey:this.attrkey||"$",charkey:this.charkey||"_",headless:!0===this.headless,rootName:this.rootName||"root",cdata:!0===this.cdata,allowSurrogateChars:!0===this.allowSurrogateChars});try{return{result:this.wrap(r.buildObject(o))}}catch(e){throw new Cr("XML node could not build XML: "+(e instanceof Error?e.message:e+""),"GRAPH_XML_BUILD_FAILED")}}wrap(e){if(!this.destinationField)return e;const t={};return ya(t,this.destinationField,e,!0),t}xmlTextOf(e){if("string"==typeof e)return e;if(pa(e)){const t=this.dataPropertyName?fa(e,this.dataPropertyName,!0):void 0;if("string"==typeof t)return t}try{return Yd(e,"utf8",this.dataPropertyName||"data").toString("utf8")}catch{throw new Cr("XML node requires XML text to parse","GRAPH_XML_INVALID_INPUT")}}};k([w(),Ut({handle:"value"}),C("design:type",Object)],hl.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.xml.fields.mode.label",type:"select"}),Ut({handle:"mode",userControlled:!0}),C("design:type",String)],hl.prototype,"mode",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.xml.fields.dataPropertyName.label",placeholder:"graph.node.io.xml.fields.dataPropertyName.placeholder",type:"text"}),Ut({handle:"dataPropertyName",userControlled:!0}),C("design:type",String)],hl.prototype,"dataPropertyName",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.xml.fields.destinationField.label",placeholder:"graph.node.io.xml.fields.destinationField.placeholder",type:"text"}),Ut({handle:"destinationField",userControlled:!0}),C("design:type",String)],hl.prototype,"destinationField",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.xml.fields.attrkey.label",type:"text"}),Ut({handle:"attrkey",userControlled:!0}),C("design:type",String)],hl.prototype,"attrkey",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.xml.fields.charkey.label",type:"text"}),Ut({handle:"charkey",userControlled:!0}),C("design:type",String)],hl.prototype,"charkey",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.xml.fields.explicitArray.label",type:"checkbox"}),Ut({handle:"explicitArray",userControlled:!0}),C("design:type",Boolean)],hl.prototype,"explicitArray",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.xml.fields.explicitRoot.label",type:"checkbox"}),Ut({handle:"explicitRoot",userControlled:!0}),C("design:type",Boolean)],hl.prototype,"explicitRoot",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.xml.fields.ignoreAttrs.label",type:"checkbox"}),Ut({handle:"ignoreAttrs",userControlled:!0}),C("design:type",Boolean)],hl.prototype,"ignoreAttrs",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.xml.fields.mergeAttrs.label",type:"checkbox"}),Ut({handle:"mergeAttrs",userControlled:!0}),C("design:type",Boolean)],hl.prototype,"mergeAttrs",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.xml.fields.normalize.label",type:"checkbox"}),Ut({handle:"normalize",userControlled:!0}),C("design:type",Boolean)],hl.prototype,"normalize",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.xml.fields.normalizeTags.label",type:"checkbox"}),Ut({handle:"normalizeTags",userControlled:!0}),C("design:type",Boolean)],hl.prototype,"normalizeTags",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.xml.fields.trim.label",type:"checkbox"}),Ut({handle:"trim",userControlled:!0}),C("design:type",Boolean)],hl.prototype,"trim",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.xml.fields.cdata.label",type:"checkbox"}),Ut({handle:"cdata",userControlled:!0}),C("design:type",Boolean)],hl.prototype,"cdata",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.xml.fields.headless.label",type:"checkbox"}),Ut({handle:"headless",userControlled:!0}),C("design:type",Boolean)],hl.prototype,"headless",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.xml.fields.rootName.label",type:"text"}),Ut({handle:"rootName",userControlled:!0}),C("design:type",String)],hl.prototype,"rootName",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.xml.fields.allowSurrogateChars.label",type:"checkbox"}),Ut({handle:"allowSurrogateChars",userControlled:!0}),C("design:type",Boolean)],hl.prototype,"allowSurrogateChars",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],hl.prototype,"result",void 0),hl=k([Mt("core.io.xml",{kind:"core.io.xml",category:"IO",color:"#0ea5e9",icon:"ti-code",width:96,height:96,labels:["io","xml","json","convert"],metadata:{title:"graph.node.io.xml.name",description:"graph.node.io.xml.description"}}),I()],hl);let fl=class extends Wi{async execute(){const e=this.filePath||this.path;if(!e)throw new Cr("Read Binary File node requires a file path","GRAPH_READ_BINARY_FILE_PATH_REQUIRED");const{payload:t,bytes:o}=await Zd(e);return{result:t,fileName:t.fileName,mimeType:t.mimeType,bytes:o}}};k([Ut({handle:"value"}),C("design:type",Object)],fl.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.read_binary_file.fields.filePath.label",placeholder:"graph.node.io.read_binary_file.fields.filePath.placeholder",type:"text"}),Ut({handle:"filePath",userControlled:!0}),C("design:type",String)],fl.prototype,"filePath",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.read_binary_file.fields.path.label",placeholder:"graph.node.io.read_binary_file.fields.path.placeholder",type:"text"}),Ut({handle:"path",userControlled:!0}),C("design:type",String)],fl.prototype,"path",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],fl.prototype,"result",void 0),k([$t({handle:"fileName"}),C("design:type",String)],fl.prototype,"fileName",void 0),k([$t({handle:"mimeType"}),C("design:type",String)],fl.prototype,"mimeType",void 0),k([$t({handle:"bytes"}),C("design:type",Number)],fl.prototype,"bytes",void 0),fl=k([Mt("core.io.readBinaryFile",{kind:"core.io.readBinaryFile",category:"IO",color:"#0ea5e9",icon:"ti-file-download",width:96,height:96,labels:["io","file","binary","read"],metadata:{title:"graph.node.io.read_binary_file.name",description:"graph.node.io.read_binary_file.description"}}),I()],fl);let yl=class extends Wi{async execute(){const e=this.fileSelector||this.pattern;if(!e)throw new Cr("Read Binary Files node requires a file selector pattern","GRAPH_READ_BINARY_FILES_SELECTOR_REQUIRED");const t=await(async e=>{const t=qd(),o=e.replace(/^[/\\]+/,""),r=[];for await(const e of fe(o,{cwd:t}))r.push(e);r.sort();const n=[];for(const e of r){const{candidate:o}=Vd(e),r=await zd(o);r&&(Kd(t,r,e),n.push(e))}return n})(e),o=[];let r=0;for(const e of t){const{payload:t,bytes:n}=await Zd(e);o.push(t),r+=n}return{result:o,files:o.length,bytes:r}}};k([Ut({handle:"value"}),C("design:type",Object)],yl.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.read_binary_files.fields.fileSelector.label",placeholder:"graph.node.io.read_binary_files.fields.fileSelector.placeholder",type:"text"}),Ut({handle:"fileSelector",userControlled:!0}),C("design:type",String)],yl.prototype,"fileSelector",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.read_binary_files.fields.pattern.label",placeholder:"graph.node.io.read_binary_files.fields.pattern.placeholder",type:"text"}),Ut({handle:"pattern",userControlled:!0}),C("design:type",String)],yl.prototype,"pattern",void 0),k([w(),$t({handle:"result"}),C("design:type",Array)],yl.prototype,"result",void 0),k([$t({handle:"files"}),C("design:type",Number)],yl.prototype,"files",void 0),k([$t({handle:"bytes"}),C("design:type",Number)],yl.prototype,"bytes",void 0),yl=k([Mt("core.io.readBinaryFiles",{kind:"core.io.readBinaryFiles",category:"IO",color:"#0ea5e9",icon:"ti-files",width:96,height:96,labels:["io","file","binary","glob"],metadata:{title:"graph.node.io.read_binary_files.name",description:"graph.node.io.read_binary_files.description"}}),I()],yl);let ml=class extends Wi{constructor(){super(...arguments),this.dataPropertyName="data",this.encoding="auto",this.append=!1,this.createDirectories=!0}async execute(e){const t=this.fileName||this.path;if(!t)throw new Cr("Write Binary File node requires a file path","GRAPH_WRITE_BINARY_FILE_PATH_REQUIRED");const o=e.inputs.value;if(null==o)throw new Cr("Write Binary File node requires a binary payload","GRAPH_WRITE_BINARY_FILE_CONTENT_REQUIRED");const r=Yd(o,this.encoding??"utf8",this.dataPropertyName||"data"),n=await(async(e,t,o={})=>{const{base:r,candidate:n}=Vd(e),i=await zd(n);i&&Kd(r,i,e),o.createDirectories&&await ue(te(n),{recursive:!0}),Kd(r,await ce(te(n)),e);const a=await zd(n);return a&&Kd(r,a,e),o.append?await ge(n,t):await he(n,t),{path:e,bytes:t.byteLength}})(t,r,{append:!0===this.append,createDirectories:!1!==this.createDirectories});return{result:{fileName:t,path:n.path,bytes:n.bytes},bytes:n.bytes}}};k([w(),Ut({handle:"value"}),C("design:type",Object)],ml.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.write_binary_file.fields.fileName.label",placeholder:"graph.node.io.write_binary_file.fields.fileName.placeholder",type:"text"}),Ut({handle:"fileName",userControlled:!0}),C("design:type",String)],ml.prototype,"fileName",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.write_binary_file.fields.path.label",placeholder:"graph.node.io.write_binary_file.fields.path.placeholder",type:"text"}),Ut({handle:"path",userControlled:!0}),C("design:type",String)],ml.prototype,"path",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.write_binary_file.fields.dataPropertyName.label",type:"text"}),Ut({handle:"dataPropertyName",userControlled:!0}),C("design:type",String)],ml.prototype,"dataPropertyName",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.write_binary_file.fields.encoding.label",type:"select"}),Ut({handle:"encoding",userControlled:!0}),C("design:type",String)],ml.prototype,"encoding",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.write_binary_file.fields.append.label",type:"checkbox"}),Ut({handle:"append",userControlled:!0}),C("design:type",Boolean)],ml.prototype,"append",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.io.write_binary_file.fields.createDirectories.label",type:"checkbox"}),Ut({handle:"createDirectories",userControlled:!0}),C("design:type",Boolean)],ml.prototype,"createDirectories",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],ml.prototype,"result",void 0),k([$t({handle:"bytes"}),C("design:type",Number)],ml.prototype,"bytes",void 0),ml=k([Mt("core.io.writeBinaryFile",{kind:"core.io.writeBinaryFile",category:"IO",color:"#0ea5e9",icon:"ti-file-upload",width:96,height:96,labels:["io","file","binary","write"],metadata:{title:"graph.node.io.write_binary_file.name",description:"graph.node.io.write_binary_file.description"}}),I()],ml);const bl=["getRepo","listIssues","createIssue","commentIssue","listPullRequests"];let wl=class extends Wi{constructor(){super(...arguments),this.operation="getRepo"}async execute(e,t){if(!this.operation)throw new Cr("GitHub node requires an operation","GRAPH_GITHUB_OPERATION_REQUIRED");const o=bl.includes(this.operation)?this.operation:"getRepo",r=await an(t,e.credentials,"github",!1,"GitHub"),n=new ze;try{switch(await xe(n,{token:Ts(r,"GitHub"),owner:this.owner,repo:this.repo,baseUrl:this.baseUrl}),o){case"getRepo":return{result:await n.getRepository({owner:this.owner,repo:this.repo})};case"listIssues":return{result:await n.listIssues({owner:this.owner,repo:this.repo,state:this.state,limit:Rs(this.limit),page:Rs(this.page),labels:this.labels?.join(",")})};case"createIssue":{if(!this.title)throw new Cr("GitHub createIssue requires a title","GRAPH_GITHUB_TITLE_REQUIRED");const t=await n.createIssue({owner:this.owner,repo:this.repo,title:this.title,body:this.body??(e.inputs.value??"")+"",labels:Os(this.labels)?.map(String),assignees:Os(this.assignees)?.map(String)});return{result:t,number:t.number,url:t.htmlUrl}}case"commentIssue":{const e=Rs(this.number);if(!e||!this.body)throw new Cr("GitHub commentIssue requires an issue number and body","GRAPH_GITHUB_COMMENT_REQUIRED");const t=await n.commentOnIssue({owner:this.owner,repo:this.repo,number:e,body:this.body});return{result:t,number:e,url:t.htmlUrl}}default:return{result:await n.listPullRequests({owner:this.owner,repo:this.repo,state:this.state,limit:Rs(this.limit),page:Rs(this.page)})}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`GitHub node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_GITHUB_OPERATION_FAILED",{operation:o})}finally{await n.shutdown().catch(()=>{})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.devops.github.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],wl.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.github.fields.owner.label",type:"string"}),Ut({handle:"owner",userControlled:!0}),C("design:type",String)],wl.prototype,"owner",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.github.fields.repo.label",type:"string"}),Ut({handle:"repo",userControlled:!0}),C("design:type",String)],wl.prototype,"repo",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.github.fields.number.label",type:"number"}),Ut({handle:"number",userControlled:!0}),C("design:type",Number)],wl.prototype,"number",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.common.fields.title.label",type:"string"}),Ut({handle:"title",userControlled:!0}),C("design:type",String)],wl.prototype,"title",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.common.fields.body.label",type:"textarea"}),Ut({handle:"body",userControlled:!0}),C("design:type",String)],wl.prototype,"body",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.common.fields.labels.label",type:"json"}),Ut({handle:"labels",userControlled:!0}),C("design:type",Array)],wl.prototype,"labels",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.github.fields.assignees.label",type:"json"}),Ut({handle:"assignees",userControlled:!0}),C("design:type",Array)],wl.prototype,"assignees",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.common.fields.state.label",type:"select"}),Ut({handle:"state",userControlled:!0}),C("design:type",String)],wl.prototype,"state",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.common.fields.limit.label",type:"number"}),Ut({handle:"limit",userControlled:!0}),C("design:type",Number)],wl.prototype,"limit",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.common.fields.page.label",type:"number"}),Ut({handle:"page",userControlled:!0}),C("design:type",Number)],wl.prototype,"page",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.common.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],wl.prototype,"baseUrl",void 0),k([$t({handle:"result"}),C("design:type",Object)],wl.prototype,"result",void 0),k([$t({handle:"number",type:"number"}),C("design:type",Number)],wl.prototype,"issueNumber",void 0),k([$t({handle:"url",type:"string"}),C("design:type",String)],wl.prototype,"url",void 0),wl=k([Mt("core.devops.github",{kind:"core.devops.github",category:"DevOps",color:"#24292f",icon:"ti-brand-github",width:96,height:96,labels:["devops","github","git","issues"],metadata:{title:"graph.node.devops.github.name",description:"graph.node.devops.github.description"}}),I()],wl);const vl=["getProject","listIssues","createIssue","commentIssue","listMergeRequests"];let xl=class extends Wi{constructor(){super(...arguments),this.operation="getProject"}async execute(e,t){if(!this.operation)throw new Cr("GitLab node requires an operation","GRAPH_GITLAB_OPERATION_REQUIRED");const o=vl.includes(this.operation)?this.operation:"getProject",r=await an(t,e.credentials,"gitlab",!1,"GitLab"),n=new Qe;try{switch(await xe(n,{token:Ts(r,"GitLab"),projectId:this.projectId,baseUrl:this.baseUrl}),o){case"getProject":return{result:await n.getProject(this.projectId)};case"listIssues":return{result:await n.listIssues({projectId:this.projectId,state:this.state,limit:Rs(this.limit),page:Rs(this.page),labels:Os(this.labels)?.map(String).join(","),search:this.search})};case"createIssue":{if(!this.title)throw new Cr("GitLab createIssue requires a title","GRAPH_GITLAB_TITLE_REQUIRED");const t=await n.createIssue({projectId:this.projectId,title:this.title,description:this.body??(e.inputs.value??"")+"",labels:Os(this.labels)?.map(String).join(","),assigneeIds:Os(this.assigneeIds)?.map(Number)});return{result:t,iid:t.iid,url:t.webUrl}}case"commentIssue":{const e=Rs(this.iid);if(!e||!this.body)throw new Cr("GitLab commentIssue requires an issue IID and body","GRAPH_GITLAB_COMMENT_REQUIRED");const t=await n.commentOnIssue({projectId:this.projectId,iid:e,body:this.body});return{result:t,iid:e,url:t.webUrl}}default:return{result:await n.listMergeRequests({projectId:this.projectId,state:this.state,limit:Rs(this.limit),page:Rs(this.page),search:this.search})}}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`GitLab node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_GITLAB_OPERATION_FAILED",{operation:o})}finally{await n.shutdown().catch(()=>{})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.devops.gitlab.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],xl.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.gitlab.fields.projectId.label",type:"string"}),Ut({handle:"projectId",userControlled:!0}),C("design:type",String)],xl.prototype,"projectId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.gitlab.fields.iid.label",type:"number"}),Ut({handle:"iid",userControlled:!0}),C("design:type",Number)],xl.prototype,"iid",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.common.fields.title.label",type:"string"}),Ut({handle:"title",userControlled:!0}),C("design:type",String)],xl.prototype,"title",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.common.fields.body.label",type:"textarea"}),Ut({handle:"body",userControlled:!0}),C("design:type",String)],xl.prototype,"body",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.common.fields.labels.label",type:"json"}),Ut({handle:"labels",userControlled:!0}),C("design:type",Array)],xl.prototype,"labels",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.gitlab.fields.assigneeIds.label",type:"json"}),Ut({handle:"assigneeIds",userControlled:!0}),C("design:type",Array)],xl.prototype,"assigneeIds",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.common.fields.state.label",type:"select"}),Ut({handle:"state",userControlled:!0}),C("design:type",String)],xl.prototype,"state",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.gitlab.fields.search.label",type:"string"}),Ut({handle:"search",userControlled:!0}),C("design:type",String)],xl.prototype,"search",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.common.fields.limit.label",type:"number"}),Ut({handle:"limit",userControlled:!0}),C("design:type",Number)],xl.prototype,"limit",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.common.fields.page.label",type:"number"}),Ut({handle:"page",userControlled:!0}),C("design:type",Number)],xl.prototype,"page",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.common.fields.baseUrl.label",type:"string"}),Ut({handle:"baseUrl",userControlled:!0}),C("design:type",String)],xl.prototype,"baseUrl",void 0),k([$t({handle:"result"}),C("design:type",Object)],xl.prototype,"result",void 0),k([$t({handle:"iid",type:"number"}),C("design:type",Number)],xl.prototype,"issueIid",void 0),k([$t({handle:"url",type:"string"}),C("design:type",String)],xl.prototype,"url",void 0),xl=k([Mt("core.devops.gitlab",{kind:"core.devops.gitlab",category:"DevOps",color:"#fc6d26",icon:"ti-brand-gitlab",width:96,height:96,labels:["devops","gitlab","git","issues"],metadata:{title:"graph.node.devops.gitlab.name",description:"graph.node.devops.gitlab.description"}}),I()],xl);const Il={MD5:"md5",SHA1:"sha1",SHA256:"sha256",SHA384:"sha384",SHA512:"sha512","SHA3-256":"sha3-256","SHA3-384":"sha3-384","SHA3-512":"sha3-512"},_l=["hash","hmac","encrypt","decrypt","sign","verify","generate"];let El=class extends Wi{constructor(){super(...arguments),this.operation="hash",this.algorithm="SHA256",this.encoding="hex",this.keyType="rsa"}async execute(e,t){const o="Crypto",r=async r=>{const n=Ps(await an(t,e.credentials,"crypto",!0,o),r,o);if(!n)throw new Cr(o+" node credential must contain the required key material","GRAPH_CREDENTIAL_INVALID_FORMAT",{node:o});return n},n=_l.includes(this.operation)?this.operation:"hash",i=Il[this.algorithm]??Il.SHA256,a="base64"===this.encoding?"base64":"hex",s=()=>((e,t)=>{if("string"==typeof e)return e;if(null==e)throw new Cr(t+" node requires a payload","GRAPH_CRYPTO_PAYLOAD_REQUIRED");try{return JSON.stringify(e)}catch{throw new Cr(t+" node cannot serialize the payload","GRAPH_CRYPTO_INVALID_PAYLOAD")}})(this.payload??e.inputs.value,o),d=new Je;await d.boot();const l=d.client;try{switch(n){case"hash":return{result:l.createHash(i).update(s()).digest(a)};case"hmac":{const e=await r(["secret","key","password","token"]);return{result:l.createHmac(i,e).update(s()).digest(a)}}case"encrypt":{const e=await r(["secret","key","password","token"]);return{result:await d.encrypt(s(),e),encodings:["base64"]}}case"decrypt":{const e=await r(["secret","key","password","token"]),t=As(this.encryptedData);if(!t)throw new Cr("Crypto node decrypt requires encryptedData","GRAPH_CRYPTO_ENCRYPTED_DATA_REQUIRED");const o=As(this.salt);if(!o)throw new Cr("Crypto node decrypt requires the encryption salt","GRAPH_CRYPTO_SALT_REQUIRED");return{result:await d.decrypt(t,e,o)}}case"sign":{const e=await r(["privateKey","key","secret","token"]);return{result:l.createSign(i).update(s()).sign(e,a)}}case"verify":{const e=As(this.publicKey)??await r(["publicKey","key","secret","token"]),t=As(this.signature);if(!t)throw new Cr("Crypto node verify requires a signature","GRAPH_CRYPTO_SIGNATURE_REQUIRED");return{result:l.createVerify(i).update(s()).verify(e,t,a)}}case"generate":{const e=this.keyType??"rsa";return"ed25519"===e?{result:l.generateKeyPairSync("ed25519",{publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}})}:"ec"===e?{result:l.generateKeyPairSync("ec",{namedCurve:As(this.namedCurve)??"prime256v1",publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}})}:{result:l.generateKeyPairSync("rsa",{modulusLength:Math.max(2048,Math.floor(this.modulusLength??2048)),publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}})}}default:throw new Cr(`Crypto node operation '${n}' is not supported`,"GRAPH_CRYPTO_OPERATION_NOT_SUPPORTED",{operation:n})}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`Crypto node operation '${n}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_CRYPTO_OPERATION_FAILED",{operation:n})}finally{await d.shutdown().catch(()=>{})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.devops.crypto.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],El.prototype,"operation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.crypto.fields.algorithm.label",type:"select"}),Ut({handle:"algorithm",userControlled:!0}),C("design:type",String)],El.prototype,"algorithm",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.crypto.fields.encoding.label",type:"select"}),Ut({handle:"encoding",userControlled:!0}),C("design:type",String)],El.prototype,"encoding",void 0),k([Ut({handle:"value"}),C("design:type",Object)],El.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.crypto.fields.payload.label",type:"textarea"}),Ut({handle:"payload",userControlled:!0}),C("design:type",Object)],El.prototype,"payload",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.crypto.fields.encryptedData.label",type:"textarea"}),Ut({handle:"encryptedData",userControlled:!0}),C("design:type",String)],El.prototype,"encryptedData",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.crypto.fields.salt.label",type:"string"}),Ut({handle:"salt",userControlled:!0}),C("design:type",String)],El.prototype,"salt",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.crypto.fields.publicKey.label",type:"textarea"}),Ut({handle:"publicKey",userControlled:!0}),C("design:type",String)],El.prototype,"publicKey",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.crypto.fields.signature.label",type:"textarea"}),Ut({handle:"signature",userControlled:!0}),C("design:type",String)],El.prototype,"signature",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.crypto.fields.keyType.label",type:"select"}),Ut({handle:"keyType",userControlled:!0}),C("design:type",String)],El.prototype,"keyType",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.crypto.fields.modulusLength.label",type:"number"}),Ut({handle:"modulusLength",userControlled:!0}),C("design:type",Number)],El.prototype,"modulusLength",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.crypto.fields.namedCurve.label",type:"string"}),Ut({handle:"namedCurve",userControlled:!0}),C("design:type",String)],El.prototype,"namedCurve",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],El.prototype,"result",void 0),k([$t({handle:"encodings",type:"array"}),C("design:type",Array)],El.prototype,"encodings",void 0),El=k([Mt("core.devops.crypto",{kind:"core.devops.crypto",category:"DevOps",color:"#7c3aed",icon:"ti-lock",width:96,height:96,labels:["devops","crypto","hash","encrypt","sign"],metadata:{title:"graph.node.devops.crypto.name",description:"graph.node.devops.crypto.description"}}),I()],El);const Al=["sign","verify","decode"];let Sl=class extends Wi{constructor(){super(...arguments),this.operation="decode"}async execute(e,t){const o=Al.includes(this.operation)?this.operation:"decode",r=As(this.token)??As(e.inputs.value);if("sign"!==o&&!r)throw new Cr(`JWT node operation '${o}' requires a token`,"GRAPH_JWT_TOKEN_REQUIRED",{operation:o});try{if("sign"===o){const o=await an(t,e.credentials,"jwt",!0,"JWT"),r=(e=>{if("string"==typeof e&&e.trim().startsWith("{"))try{return Es(JSON.parse(e))??{}}catch{throw new Cr("JWT node claims must be a JSON object","GRAPH_JWT_INVALID_CLAIMS")}const t=Es(e);if(!t)throw new Cr("JWT node sign operation requires claims","GRAPH_JWT_CLAIMS_REQUIRED");return t})(this.claims??e.inputs.value),n={secret:o,expiry:As(this.expiry)??"1h"},i=await Xe(r,n);return{result:i,token:i}}if("verify"===o){const o=await an(t,e.credentials,"jwt",!1,"JWT"),n=As(this.verifyUrl);if(!o&&!n)throw new Cr("JWT node verify requires a secret credential or verifyUrl","GRAPH_JWT_VERIFICATION_NOT_CONFIGURED");const i=await Ye(r,{secret:"string"==typeof o?o:As(o?.secret),verifyUrl:n,clockToleranceSeconds:Rs(this.clockToleranceSeconds)});return{result:i,payload:i}}const n=Ze(r);return{result:n??null,payload:n??null}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`JWT node operation '${o}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_JWT_OPERATION_FAILED",{operation:o})}}};function Rl(e,t="utf8"){const o=Buffer.isBuffer(e)?e:Buffer.from(e??"",t);return o.length>vr?{value:o.subarray(0,vr).toString(t),truncated:!0}:{value:o.toString(t),truncated:!1}}k([i("ngx-decaf-crud-field",{label:"graph.node.devops.jwt.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],Sl.prototype,"operation",void 0),k([Ut({handle:"value"}),C("design:type",Object)],Sl.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.jwt.fields.token.label",type:"textarea"}),Ut({handle:"token",userControlled:!0}),C("design:type",String)],Sl.prototype,"token",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.jwt.fields.claims.label",type:"object"}),Ut({handle:"claims",userControlled:!0}),C("design:type",Object)],Sl.prototype,"claims",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.jwt.fields.expiry.label",type:"string"}),Ut({handle:"expiry",userControlled:!0}),C("design:type",String)],Sl.prototype,"expiry",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.jwt.fields.verifyUrl.label",type:"string"}),Ut({handle:"verifyUrl",userControlled:!0}),C("design:type",String)],Sl.prototype,"verifyUrl",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.jwt.fields.clockToleranceSeconds.label",type:"number"}),Ut({handle:"clockToleranceSeconds",userControlled:!0}),C("design:type",Number)],Sl.prototype,"clockToleranceSeconds",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],Sl.prototype,"result",void 0),k([$t({handle:"token"}),C("design:type",String)],Sl.prototype,"tokenOutput",void 0),k([$t({handle:"payload"}),C("design:type",Object)],Sl.prototype,"payload",void 0),Sl=k([Mt("core.devops.jwt",{kind:"core.devops.jwt",category:"DevOps",color:"#0f766e",icon:"ti-key",width:96,height:96,labels:["devops","jwt","token","auth"],metadata:{title:"graph.node.devops.jwt.name",description:"graph.node.devops.jwt.description"}}),I()],Sl);let Ol=class extends Wi{constructor(){super(...arguments),this.failOnError=!1}async execute(e,t){const o=As(this.command);if(!o)throw new Cr("Execute Command node requires a command","GRAPH_EXECUTE_COMMAND_REQUIRED");const r=Math.min(6e4,Math.max(1,Math.floor(Rs(this.timeoutMs)??3e4))),n=await new Promise(e=>{et(o,{timeout:r,maxBuffer:vr,cwd:As(this.cwd),shell:As(this.shell),signal:t.abortSignal,windowsHide:!0},(t,o,r)=>{const n=Rl(o),i=Rl(r),a=t?.code;e({stdout:n.value,stderr:i.value,exitCode:"number"==typeof a?a:t?null:0,error:t??void 0,truncated:n.truncated||i.truncated})})});if(n.error&&this.failOnError)throw new Cr("Execute Command node command failed: "+n.error.message,"GRAPH_EXECUTE_COMMAND_FAILED",{exitCode:n.exitCode});return{result:{stdout:n.stdout,stderr:n.stderr,exitCode:n.exitCode,truncated:n.truncated},stdout:n.stdout,stderr:n.stderr,exitCode:n.exitCode}}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.devops.execute_command.fields.command.label",type:"textarea"}),Ut({handle:"command",userControlled:!0}),C("design:type",String)],Ol.prototype,"command",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.execute_command.fields.cwd.label",type:"string"}),Ut({handle:"cwd",userControlled:!0}),C("design:type",String)],Ol.prototype,"cwd",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.execute_command.fields.shell.label",type:"string"}),Ut({handle:"shell",userControlled:!0}),C("design:type",String)],Ol.prototype,"shell",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.execute_command.fields.timeoutMs.label",type:"number"}),Ut({handle:"timeoutMs",userControlled:!0}),C("design:type",Number)],Ol.prototype,"timeoutMs",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.execute_command.fields.failOnError.label",type:"boolean"}),Ut({handle:"failOnError",userControlled:!0}),C("design:type",Boolean)],Ol.prototype,"failOnError",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],Ol.prototype,"result",void 0),k([$t({handle:"stdout"}),C("design:type",String)],Ol.prototype,"stdout",void 0),k([$t({handle:"stderr"}),C("design:type",String)],Ol.prototype,"stderr",void 0),k([$t({handle:"exitCode",type:"number"}),C("design:type",Object)],Ol.prototype,"exitCode",void 0),Ol=k([Mt("core.devops.executeCommand",{kind:"core.devops.executeCommand",category:"DevOps",color:"#334155",icon:"ti-terminal-2",width:96,height:96,labels:["devops","shell","command","process"],metadata:{title:"graph.node.devops.execute_command.name",description:"graph.node.devops.execute_command.description"}}),I()],Ol);const kl=["list","download","delete"];function Cl(e){if(!e)return{};if("string"!=typeof e)return{password:As(e.password),privateKey:As(e.privateKey),passphrase:As(e.passphrase)};if(!e.trim().startsWith("{"))return{password:e};const t=ks(e,"FTP");return{password:As(t.password),privateKey:As(t.privateKey),passphrase:As(t.passphrase)}}let Nl=class extends Wi{constructor(){super(...arguments),this.operation="list",this.encoding="utf8"}async execute(e,t){const o=As(this.host),r=As(this.username);if(!o||!r)throw new Cr("FTP node requires host and username","GRAPH_FTP_CONNECTION_REQUIRED");const n=kl.includes(this.operation)?this.operation:"list",i=As(this.path);if("list"!==n&&!i)throw new Cr(`FTP node operation '${n}' requires a path`,"GRAPH_FTP_PATH_REQUIRED",{operation:n});const a=await an(t,e.credentials,"sftp",!1,"FTP"),s={provider:"ssh2",sourceId:As(this.sourceId)??"graph",host:o,port:Rs(this.port)??22,username:r,remotePath:As(this.remotePath),...Cl(a)},d=new tt;try{if(await d.initialize(s),"list"===n)return{result:await d.list(i)};if("delete"===n)return await d.delete(i),{result:{path:i,deleted:!0}};const e=await d.fetch(i);return{result:{path:e.path,name:e.name,size:e.size},content:"base64"===this.encoding?e.content.toString("base64"):e.content.toString("utf8"),size:e.size}}catch(e){if(e instanceof Cr)throw e;throw new Cr(`FTP node operation '${n}' failed: ${e instanceof Error?e.message:e+""}`,"GRAPH_FTP_OPERATION_FAILED",{operation:n})}finally{await d.close().catch(()=>{})}}};k([i("ngx-decaf-crud-field",{label:"graph.node.devops.ftp.fields.operation.label",type:"select"}),Ut({handle:"operation",userControlled:!0}),C("design:type",String)],Nl.prototype,"operation",void 0),k([w(),i("ngx-decaf-crud-field",{label:"graph.node.devops.ftp.fields.host.label",type:"string"}),Ut({handle:"host",userControlled:!0}),C("design:type",String)],Nl.prototype,"host",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.ftp.fields.port.label",type:"number"}),Ut({handle:"port",userControlled:!0}),C("design:type",Number)],Nl.prototype,"port",void 0),k([w(),i("ngx-decaf-crud-field",{label:"graph.node.devops.ftp.fields.username.label",type:"string"}),Ut({handle:"username",userControlled:!0}),C("design:type",String)],Nl.prototype,"username",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.ftp.fields.sourceId.label",type:"string"}),Ut({handle:"sourceId",userControlled:!0}),C("design:type",String)],Nl.prototype,"sourceId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.ftp.fields.remotePath.label",type:"string"}),Ut({handle:"remotePath",userControlled:!0}),C("design:type",String)],Nl.prototype,"remotePath",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.ftp.fields.path.label",type:"string"}),Ut({handle:"path",userControlled:!0}),C("design:type",String)],Nl.prototype,"path",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.devops.ftp.fields.encoding.label",type:"select"}),Ut({handle:"encoding",userControlled:!0}),C("design:type",String)],Nl.prototype,"encoding",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],Nl.prototype,"result",void 0),k([$t({handle:"content"}),C("design:type",String)],Nl.prototype,"content",void 0),k([$t({handle:"size",type:"number"}),C("design:type",Number)],Nl.prototype,"size",void 0),Nl=k([Mt("core.devops.ftp",{kind:"core.devops.ftp",category:"DevOps",color:"#0ea5e9",icon:"ti-folder-symlink",width:96,height:96,labels:["devops","ftp","sftp","files"],metadata:{title:"graph.node.devops.ftp.name",description:"graph.node.devops.ftp.description"}}),I()],Nl);let Tl=class extends Wi{constructor(){super(...arguments),this.mode="once",this.inputPort="value"}async execute(e,t){const o=t.engine;if(!o)throw new Cr("Execute Sub-workflow node requires engine access","GRAPH_ENGINE_NOT_AVAILABLE");const r=await this.documentOf(o,t),n=this.inputPort||"value",i=e.inputs.value??e.inputs.input;if("perItem"===this.mode){const e=[];let a,s;for(const d of ua(i)){const i=await o.execute(r,{[n]:d},{parentRunId:t.runId,path:[...t.path,"subworkflow"],auth:t.auth,metadata:{...t.metadata,item:d}},t);e.push(i.outputs.result??i.outputs),a=i.outputs,s=i.runId}return{result:e,outputs:a,childRunId:s}}const a=await o.execute(r,{[n]:i},{parentRunId:t.runId,path:[...t.path,"subworkflow"],auth:t.auth,metadata:t.metadata},t);return{result:a.outputs.result??a.outputs,outputs:a.outputs,childRunId:a.runId}}async documentOf(e,t){if(pa(o=this.workflow)&&"string"==typeof o.id&&Array.isArray(o.nodes)&&Array.isArray(o.edges))return this.workflow;var o;const r=this.workflowId;if(!r)throw new Cr("Execute Sub-workflow node requires a workflow id or an inline workflow document","GRAPH_SUB_WORKFLOW_REQUIRED");try{return await e.getWorkflow(r,t)}catch(e){throw new Cr(`Execute Sub-workflow node could not resolve workflow '${r}': ${e instanceof Error?e.message:e+""}`,"GRAPH_SUB_WORKFLOW_NOT_FOUND",{workflowId:r})}}};k([Ut({handle:"value"}),C("design:type",Object)],Tl.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.execute_sub_workflow.fields.workflowId.label",placeholder:"graph.node.flow_control.execute_sub_workflow.fields.workflowId.placeholder",type:"text"}),Ut({handle:"workflowId",userControlled:!0}),C("design:type",String)],Tl.prototype,"workflowId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.execute_sub_workflow.fields.workflow.label",type:"json"}),Ut({handle:"workflow",userControlled:!0,type:"object"}),C("design:type",Object)],Tl.prototype,"workflow",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.execute_sub_workflow.fields.mode.label",type:"select"}),Ut({handle:"mode",userControlled:!0}),C("design:type",String)],Tl.prototype,"mode",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.flow_control.execute_sub_workflow.fields.inputPort.label",placeholder:"graph.node.flow_control.execute_sub_workflow.fields.inputPort.placeholder",type:"text"}),Ut({handle:"inputPort",userControlled:!0}),C("design:type",String)],Tl.prototype,"inputPort",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],Tl.prototype,"result",void 0),k([$t({handle:"outputs"}),C("design:type",Object)],Tl.prototype,"outputs",void 0),k([$t({handle:"childRunId"}),C("design:type",String)],Tl.prototype,"childRunId",void 0),Tl=k([Mt("core.flow.executeSubWorkflow",{kind:"core.flow.executeSubWorkflow",category:"Flow Control",color:"#f59e0b",icon:"ti-subtask",width:96,height:96,labels:["flow","workflow","subworkflow"],metadata:{title:"graph.node.flow_control.execute_sub_workflow.name",description:"graph.node.flow_control.execute_sub_workflow.description"}}),I()],Tl);let Pl=class extends Wi{execute(e){const t=e.inputs.payload;return{result:void 0!==t?t:e.inputs.value??e.inputs}}};k([Ut({handle:"payload"}),C("design:type",Object)],Pl.prototype,"payload",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.trigger.execute_workflow.fields.schema.label",placeholder:"graph.node.trigger.execute_workflow.fields.schema.placeholder",type:"json"}),Ut({handle:"schema",userControlled:!0,type:"object"}),C("design:type",Object)],Pl.prototype,"schema",void 0),k([w(),$t({handle:"result"}),C("design:type",Object)],Pl.prototype,"result",void 0),Pl=k([Mt("core.trigger.executeWorkflow",{kind:"core.trigger.executeWorkflow",category:"Trigger",color:"#3b82f6",icon:"ti-player-play",width:96,height:96,labels:["trigger","workflow","subworkflow"],metadata:{title:"graph.node.trigger.execute_workflow.name",description:"graph.node.trigger.execute_workflow.description",trigger:{type:"executeWorkflow"}}}),I()],Pl);let Dl=class extends Wi{execute(e){return{message:e.inputs.message??null,sessionId:e.inputs.sessionId??null,userId:e.inputs.userId??null}}};k([w(),$t({handle:"message"}),C("design:type",String)],Dl.prototype,"message",void 0),k([w(),$t({handle:"sessionId"}),C("design:type",String)],Dl.prototype,"sessionId",void 0),k([w(),$t({handle:"userId"}),C("design:type",String)],Dl.prototype,"userId",void 0),Dl=k([Mt("core.trigger.chat",{kind:"core.trigger.chat",category:"Trigger",color:"#3b82f6",icon:"ti-message-circle",width:96,height:96,labels:["trigger","chat","entrypoint"],metadata:{title:"graph.node.trigger.chat.name",description:"graph.node.trigger.chat.description",trigger:{type:"chat"}}}),I()],Dl);let jl=class extends Wi{execute(e){return{payload:e.inputs.payload??null}}};k([w(),$t({handle:"payload"}),C("design:type",Object)],jl.prototype,"payload",void 0),jl=k([Mt("core.trigger.event",{kind:"core.trigger.event",category:"Trigger",color:"#3b82f6",icon:"ti-broadcast",width:96,height:96,labels:["trigger","event","bus"],metadata:{title:"graph.node.trigger.event.name",description:"graph.node.trigger.event.description",trigger:{type:"event",topic:"default"}}}),I()],jl);let Ll=class extends Wi{execute(e){return{payload:e.inputs.payload??null}}};k([w(),Ut({handle:"schema"}),i("ngx-decaf-model-builder",{label:"graph.node.trigger.form.fields.schema.label",placeholder:"graph.node.trigger.form.fields.schema.placeholder"}),C("design:type",Object)],Ll.prototype,"schema",void 0),k([w(),$t({handle:"payload"}),C("design:type",Object)],Ll.prototype,"payload",void 0),Ll=k([Mt("core.trigger.form",{kind:"core.trigger.form",category:"Trigger",color:"#3b82f6",icon:"ti-forms",width:96,height:96,labels:["trigger","form","public"],metadata:{title:"graph.node.trigger.form.name",description:"graph.node.trigger.form.description",trigger:{type:"form",fields:[]}}}),I()],Ll);let Ml=class extends Wi{execute(e){return{payload:e.inputs.payload??null}}};k([w(),$t({handle:"payload"}),C("design:type",Object)],Ml.prototype,"payload",void 0),Ml=k([Mt("core.trigger.manual",{kind:"core.trigger.manual",category:"Trigger",color:"#3b82f6",icon:"ti-hand-click",width:96,height:96,labels:["trigger","manual","entrypoint"],metadata:{title:"graph.node.trigger.manual.name",description:"graph.node.trigger.manual.description",trigger:{type:"manual",inputSchema:{}}}}),I()],Ml);let Gl=class extends Wi{execute(e){return{payload:e.inputs.payload??null}}};k([w(),Ut({handle:"cron"}),i("app-cron-selector-field",{label:"graph.node.trigger.schedule.fields.cron.label",placeholder:"graph.node.trigger.schedule.fields.cron.placeholder"}),C("design:type",String)],Gl.prototype,"cron",void 0),k([w(),$t({handle:"payload"}),C("design:type",Object)],Gl.prototype,"payload",void 0),Gl=k([Mt("core.trigger.schedule",{kind:"core.trigger.schedule",category:"Trigger",color:"#3b82f6",icon:"ti-calendar-time",width:96,height:96,labels:["trigger","schedule","cron"],metadata:{title:"graph.node.trigger.schedule.name",description:"graph.node.trigger.schedule.description",trigger:{type:"schedule",schedule:"0 * * * *",timezone:"UTC"}}}),I()],Gl);let Ul=class extends Wi{execute(e){return{payload:e.inputs.payload??null}}};k([w(),Ut({handle:"schema"}),i("ngx-decaf-model-builder",{label:"graph.node.trigger.webhook.fields.schema.label",placeholder:"graph.node.trigger.webhook.fields.schema.placeholder"}),C("design:type",Object)],Ul.prototype,"schema",void 0),k([w(),$t({handle:"payload"}),C("design:type",Object)],Ul.prototype,"payload",void 0),Ul=k([Mt("core.trigger.webhook",{kind:"core.trigger.webhook",category:"Trigger",color:"#3b82f6",icon:"ti-webhook",width:96,height:96,labels:["trigger","webhook","http"],metadata:{title:"graph.node.trigger.webhook.name",description:"graph.node.trigger.webhook.description",trigger:{type:"webhook",path:"/webhook",method:"POST",auth:"none",responseMode:"onReceived"}}}),I()],Ul);let $l=class extends Wi{execute(e){const t=this.payload??e.inputs.payload??e.inputs.value??e.inputs,o=Es(t)??{value:t},r=Es(o.execution)??Es(e.inputs.execution),n=Es(o.workflow)??Es(e.inputs.workflow),i=Es(r?.error)??Es(o.error)??Es(e.inputs.error);return{payload:o,...r?{execution:r}:{},...n?{workflow:n}:{},...i?{error:i}:{}}}};k([Ut({handle:"payload",type:"object"}),C("design:type",Object)],$l.prototype,"payload",void 0),k([w(),$t({handle:"payload",type:"object"}),C("design:type",Object)],$l.prototype,"payloadOut",void 0),k([$t({handle:"execution",type:"object"}),C("design:type",Object)],$l.prototype,"execution",void 0),k([$t({handle:"workflow",type:"object"}),C("design:type",Object)],$l.prototype,"workflow",void 0),k([$t({handle:"error",type:"object"}),C("design:type",Object)],$l.prototype,"error",void 0),$l=k([Mt("core.trigger.error",{kind:"core.trigger.error",category:"Trigger",color:"#3b82f6",icon:"ti-alert-triangle",width:96,height:96,labels:["trigger","error","failure","workflow"],metadata:{title:"graph.node.trigger.error.name",description:"graph.node.trigger.error.description",trigger:{type:"error"}}}),I()],$l);const Fl={activate:"Workflow activated",update:"Workflow updated"};function Hl(e){if("string"!=typeof e)return;const t=e.trim().toLowerCase();return"activate"===t||"workflow activated"===t?"activate":"update"===t||"workflow updated"===t?"update":void 0}let Bl=class extends Wi{constructor(){super(...arguments),this.events=["activate"]}execute(e){const t=Es(this.payload??e.inputs.payload),o=this.event??e.inputs.event??t?.event??t?.workflow_event,r=(e=>{const t=(Array.isArray(e)?e:"string"==typeof e?e.split(","):[]).map(e=>Hl(e)).filter(e=>void 0!==e);return t.length?t:["activate"]})(this.events),n=void 0===o?r[0]:Hl(o);if(!n)throw new Cr(`Workflow trigger received an unsupported event '${o+""}'`,"GRAPH_WORKFLOW_TRIGGER_EVENT_INVALID",{event:o});if(!r.includes(n))throw new Cr(`Workflow trigger is not configured for the '${n}' event`,"GRAPH_WORKFLOW_TRIGGER_EVENT_NOT_CONFIGURED",{event:n,events:r});const i=this.timestamp??e.inputs.timestamp??("string"==typeof t?.timestamp?t.timestamp:void 0)??(new Date).toISOString(),a=this.workflowId??e.inputs.workflowId??("string"==typeof t?.workflow_id?t.workflow_id:void 0);return{payload:t??{event:Fl[n],timestamp:i,...a?{workflow_id:a}:{}},event:n,timestamp:i,...a?{workflowId:a}:{}}}};function ql(e){const t=Rs(e);return t&&t>0?Math.floor(t):3e4}function Wl(e,t){if(!t)return e;try{return JSON.parse(e)}catch{return e}}function Kl(e,t,o){return o instanceof Cr?o:new Cr(`${e} trigger failed: ${o instanceof Error?o.message:o+""}`,t,{cause:o instanceof Error?o.name:typeof o})}function Vl(e){if(e)try{Promise.resolve(e()).catch(()=>{})}catch{}}async function zl(e,t,o,r,n){let i,a;const s=e.abortSignal;let d;try{return await new Promise((e,l)=>{let c=!1;const p=e=>{c||(c=!0,e())};if(a=setTimeout(()=>p(()=>l(new Cr(n,r,{timeoutMs:t}))),t),s){if(d=()=>p(()=>l(new Cr("The trigger wait was aborted because the run was cancelled or timed out","GRAPH_TRIGGER_ABORTED"))),s.aborted)return void d();s.addEventListener("abort",d,{once:!0})}Promise.resolve(o(t=>p(()=>e(t)),e=>p(()=>l(e)))).then(e=>{i=e,c&&Vl(e)}).catch(e=>p(()=>l(e)))})}finally{a&&clearTimeout(a),d&&s&&s.removeEventListener("abort",d),Vl(i)}}function Ql(e){const t=e?.timestamp,o={contentType:e?.contentType,contentEncoding:e?.contentEncoding,correlationId:e?.correlationId,replyTo:e?.replyTo,messageId:e?.messageId,type:e?.type,appId:e?.appId,timestamp:t instanceof Date?t.toISOString():void 0===t?void 0:t+""};for(const[e,t]of Object.entries(o))void 0===t&&delete o[e];return o}k([w(),Ut({handle:"events",userControlled:!0,type:"array"}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.workflow.fields.events.label",type:"select"}),C("design:type",Array)],Bl.prototype,"events",void 0),k([Ut({handle:"event"}),C("design:type",Object)],Bl.prototype,"event",void 0),k([Ut({handle:"payload",type:"object"}),C("design:type",Object)],Bl.prototype,"payload",void 0),k([Ut({handle:"timestamp"}),C("design:type",Object)],Bl.prototype,"timestamp",void 0),k([Ut({handle:"workflowId"}),C("design:type",Object)],Bl.prototype,"workflowId",void 0),k([w(),$t({handle:"payload",type:"object"}),C("design:type",Object)],Bl.prototype,"payloadOut",void 0),k([$t({handle:"event"}),C("design:type",String)],Bl.prototype,"eventOut",void 0),k([$t({handle:"timestamp"}),C("design:type",String)],Bl.prototype,"timestampOut",void 0),k([$t({handle:"workflowId"}),C("design:type",String)],Bl.prototype,"workflowIdOut",void 0),Bl=k([Mt("core.trigger.workflow",{kind:"core.trigger.workflow",category:"Trigger",color:"#3b82f6",icon:"ti-git-branch",width:96,height:96,labels:["trigger","workflow","lifecycle","activate","update"],metadata:{title:"graph.node.trigger.workflow.name",description:"graph.node.trigger.workflow.description",trigger:{type:"workflow",events:["activate"]}}}),I()],Bl);let Jl=class extends Wi{constructor(){super(...arguments),this.ssl=!1,this.jsonParseBody=!1}async execute(e,t){const o=As(this.queue);if(!o)throw new Cr("RabbitMQ trigger requires a queue","GRAPH_RABBITMQ_TRIGGER_QUEUE_REQUIRED");const r=As(this.exchange),n=As(this.routingKey)??"",i=Ps(await an(t,e.credentials,"rabbitmq",!1,"RabbitMQ trigger"),["password","secret","token"],"RabbitMQ trigger"),a=Ss(this.ssl,!1),s=ql(this.timeoutMs);let d,l;try{d=await be({protocol:a?"amqps":"amqp",hostname:As(this.host)??"localhost",port:Rs(this.port)??(a?5671:5672),username:As(this.username)??"guest",password:i,vhost:As(this.vhost)??"/",heartbeat:10}),l=await d.createChannel(),await l.assertQueue(o,{durable:!0}),r&&(await l.assertExchange(r,As(this.exchangeType)??"topic",{durable:!0}),await l.bindQueue(o,r,n)),await l.prefetch(1);const e=await zl(t,s,async e=>{const r=await l.consume(o,t=>{if(!t)return;const o=t.content.toString("utf8");try{l.ack(t)}catch{}e({message:o,properties:Ql(t.properties)})},{noAck:!1});return await t.log("RabbitMQ trigger subscribed",{queue:o}),async()=>{await l.cancel(r.consumerTag).catch(()=>{})}},"GRAPH_TRIGGER_TIMEOUT",`RabbitMQ trigger received no message within ${s}ms`);return{payload:Wl(e.message,!0===this.jsonParseBody),message:e.message,queue:o,properties:e.properties}}catch(e){throw Kl("RabbitMQ","GRAPH_RABBITMQ_TRIGGER_FAILED",e)}finally{await(l?.close().catch(()=>{})),await(d?.close().catch(()=>{}))}}};k([w(),Ut({handle:"queue"}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.rabbitmq.fields.queue.label",placeholder:"queue-name",type:"string"}),C("design:type",String)],Jl.prototype,"queue",void 0),k([Ut({handle:"exchange",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.rabbitmq.fields.exchange.label",type:"string"}),C("design:type",String)],Jl.prototype,"exchange",void 0),k([Ut({handle:"exchangeType",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.rabbitmq.fields.exchangeType.label",type:"string"}),C("design:type",String)],Jl.prototype,"exchangeType",void 0),k([Ut({handle:"routingKey",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.rabbitmq.fields.routingKey.label",type:"string"}),C("design:type",String)],Jl.prototype,"routingKey",void 0),k([Ut({handle:"host",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.rabbitmq.fields.host.label",type:"string"}),C("design:type",String)],Jl.prototype,"host",void 0),k([Ut({handle:"port",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.rabbitmq.fields.port.label",type:"number"}),C("design:type",Number)],Jl.prototype,"port",void 0),k([Ut({handle:"username",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.rabbitmq.fields.username.label",type:"string"}),C("design:type",String)],Jl.prototype,"username",void 0),k([Ut({handle:"vhost",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.rabbitmq.fields.vhost.label",type:"string"}),C("design:type",String)],Jl.prototype,"vhost",void 0),k([Ut({handle:"ssl",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.rabbitmq.fields.ssl.label",type:"boolean"}),C("design:type",Boolean)],Jl.prototype,"ssl",void 0),k([Ut({handle:"jsonParseBody",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.rabbitmq.fields.jsonParseBody.label",type:"boolean"}),C("design:type",Boolean)],Jl.prototype,"jsonParseBody",void 0),k([Ut({handle:"timeoutMs",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.rabbitmq.fields.timeoutMs.label",type:"number"}),C("design:type",Number)],Jl.prototype,"timeoutMs",void 0),k([w(),$t({handle:"payload"}),C("design:type",Object)],Jl.prototype,"payload",void 0),k([$t({handle:"message"}),C("design:type",String)],Jl.prototype,"message",void 0),k([$t({handle:"queue"}),C("design:type",String)],Jl.prototype,"queueOutput",void 0),k([$t({handle:"properties",type:"object"}),C("design:type",Object)],Jl.prototype,"properties",void 0),Jl=k([Mt("core.trigger.rabbitmq",{kind:"core.trigger.rabbitmq",category:"Trigger",color:"#3b82f6",icon:"ti-inbox",width:96,height:96,labels:["trigger","rabbitmq","amqp","queue"],metadata:{title:"graph.node.trigger.rabbitmq.name",description:"graph.node.trigger.rabbitmq.description",trigger:{type:"rabbitmq",queue:"",jsonParseBody:!1}}}),I()],Jl);let Xl=class extends Wi{constructor(){super(...arguments),this.tls=!1,this.jsonParseBody=!1}async execute(e,t){const o=As(this.channels);if(!o)throw new Cr("Redis trigger requires at least one channel","GRAPH_REDIS_TRIGGER_CHANNELS_REQUIRED");const r=As(this.prefix),n=o.split(",").map(e=>e.trim()).filter(e=>e.length>0).map(e=>r?`${r}:${e}`:e);if(!n.length)throw new Cr("Redis trigger requires at least one channel","GRAPH_REDIS_TRIGGER_CHANNELS_REQUIRED");const i=Ps(await an(t,e.credentials,"redis",!1,"Redis trigger"),["password","secret","token"],"Redis trigger"),a=ql(this.timeoutMs),s=`as-graph-redis-trigger-${Date.now()}-${Math.random().toString(36).slice(2)}`,d=new me({host:As(this.host)??"localhost",port:Rs(this.port)??6379,username:As(this.username),password:i,database:Rs(this.database),tls:!!this.tls||void 0},s);try{await d.initialize();const e=d.client,o=await zl(t,a,async o=>{for(const t of n)await e.pSubscribe(t,(e,t)=>o({channel:t,message:e}));return await t.log("Redis trigger subscribed",{channels:n}),async()=>{await e.pUnsubscribe().catch(()=>{})}},"GRAPH_TRIGGER_TIMEOUT",`Redis trigger received no message within ${a}ms`);return{payload:Wl(o.message,!0===this.jsonParseBody),message:o.message,channel:o.channel}}catch(e){throw Kl("Redis","GRAPH_REDIS_TRIGGER_FAILED",e)}finally{await d.shutdown().catch(()=>{}),V.unregister(s)}}};k([w(),Ut({handle:"channels"}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.redis.fields.channels.label",placeholder:"graph.node.trigger.redis.fields.channels.placeholder",type:"string"}),C("design:type",String)],Xl.prototype,"channels",void 0),k([Ut({handle:"host",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.redis.fields.host.label",type:"string"}),C("design:type",String)],Xl.prototype,"host",void 0),k([Ut({handle:"port",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.redis.fields.port.label",type:"number"}),C("design:type",Number)],Xl.prototype,"port",void 0),k([Ut({handle:"username",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.redis.fields.username.label",type:"string"}),C("design:type",String)],Xl.prototype,"username",void 0),k([Ut({handle:"database",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.redis.fields.database.label",type:"number"}),C("design:type",Number)],Xl.prototype,"database",void 0),k([Ut({handle:"tls",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.redis.fields.tls.label",type:"boolean"}),C("design:type",Boolean)],Xl.prototype,"tls",void 0),k([Ut({handle:"prefix",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.redis.fields.prefix.label",type:"string"}),C("design:type",String)],Xl.prototype,"prefix",void 0),k([Ut({handle:"jsonParseBody",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.redis.fields.jsonParseBody.label",type:"boolean"}),C("design:type",Boolean)],Xl.prototype,"jsonParseBody",void 0),k([Ut({handle:"timeoutMs",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.redis.fields.timeoutMs.label",type:"number"}),C("design:type",Number)],Xl.prototype,"timeoutMs",void 0),k([w(),$t({handle:"payload"}),C("design:type",Object)],Xl.prototype,"payload",void 0),k([$t({handle:"message"}),C("design:type",String)],Xl.prototype,"message",void 0),k([$t({handle:"channel"}),C("design:type",String)],Xl.prototype,"channel",void 0),Xl=k([Mt("core.trigger.redis",{kind:"core.trigger.redis",category:"Trigger",color:"#3b82f6",icon:"ti-brand-redis",width:96,height:96,labels:["trigger","redis","pubsub","channel"],metadata:{title:"graph.node.trigger.redis.name",description:"graph.node.trigger.redis.description",trigger:{type:"redis",channels:"",jsonParseBody:!1}}}),I()],Xl);let Yl=class extends Wi{constructor(){super(...arguments),this.jsonParseBody=!0}async execute(e,t){const o=As(this.url);if(!o)throw new Cr("SSE trigger requires a URL","GRAPH_SSE_TRIGGER_URL_REQUIRED");let r;try{r=new URL(o)}catch{throw new Cr("SSE trigger URL is not a valid URL","GRAPH_SSE_TRIGGER_URL_INVALID")}const n=Ps(await an(t,e.credentials,"token",!1,"SSE trigger"),["token","secret","apiKey"],"SSE trigger"),{url:i,authorization:a}=(e=>{if(!e.username&&!e.password)return{url:e};const t=`${decodeURIComponent(e.username)}:${decodeURIComponent(e.password)}`,o=new URL(e.toString());return o.username="",o.password="",{url:o,authorization:"Basic "+Buffer.from(t,"utf8").toString("base64")}})(r),s=n?"Bearer "+n:a,d=ql(this.timeoutMs);let l;try{const e=await zl(t,d,(e,o)=>(l=new ot(i,{fetch:(e,t)=>fetch(e,{...t,headers:s?{...t.headers,Authorization:s}:t.headers})}),l.onopen=()=>{t.log("SSE trigger connected",{url:i.toString()}).catch(()=>{})},l.onmessage=t=>e({data:t.data,event:t.type||"message",id:t.lastEventId??""}),l.onerror=e=>{const t=void 0===e.code?"":` (HTTP ${e.code})`;o(new Cr(`SSE trigger connection failed${t}: ${e.message??"unknown error"}`,"GRAPH_SSE_TRIGGER_FAILED"))},()=>l?.close()),"GRAPH_TRIGGER_TIMEOUT",`SSE trigger received no event within ${d}ms`);return{payload:Wl(e.data,!1!==this.jsonParseBody),message:e.data,event:e.event,id:e.id}}catch(e){throw Kl("SSE","GRAPH_SSE_TRIGGER_FAILED",e)}finally{l?.close()}}};k([w(),Ut({handle:"url"}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.sse.fields.url.label",placeholder:"graph.node.trigger.sse.fields.url.placeholder",type:"string"}),C("design:type",String)],Yl.prototype,"url",void 0),k([Ut({handle:"jsonParseBody",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.sse.fields.jsonParseBody.label",type:"boolean"}),C("design:type",Boolean)],Yl.prototype,"jsonParseBody",void 0),k([Ut({handle:"timeoutMs",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.sse.fields.timeoutMs.label",type:"number"}),C("design:type",Number)],Yl.prototype,"timeoutMs",void 0),k([w(),$t({handle:"payload"}),C("design:type",Object)],Yl.prototype,"payload",void 0),k([$t({handle:"message"}),C("design:type",String)],Yl.prototype,"message",void 0),k([$t({handle:"event"}),C("design:type",String)],Yl.prototype,"event",void 0),k([$t({handle:"id"}),C("design:type",String)],Yl.prototype,"id",void 0),Yl=k([Mt("core.trigger.sse",{kind:"core.trigger.sse",category:"Trigger",color:"#3b82f6",icon:"ti-rss",width:96,height:96,labels:["trigger","sse","events","stream"],metadata:{title:"graph.node.trigger.sse.name",description:"graph.node.trigger.sse.description",trigger:{type:"sse",url:""}}}),I()],Yl);const Zl=/^[A-Za-z_][A-Za-z0-9_]*$/;let ec=class extends Wi{constructor(){super(...arguments),this.ssl=!1,this.acceptSelfSigned=!1,this.jsonParseBody=!1}async execute(e,t){const o=As(this.channel);if(!o)throw new Cr("Postgres trigger requires a channel","GRAPH_POSTGRES_TRIGGER_CHANNEL_REQUIRED");if(!Zl.test(o))throw new Cr(`Postgres trigger channel '${o}' is not a valid identifier`,"GRAPH_POSTGRES_TRIGGER_CHANNEL_INVALID",{channel:o});const r=As(this.database),n=As(this.username);if(!r||!n)throw new Cr("Postgres trigger requires a database and username","GRAPH_POSTGRES_TRIGGER_CONNECTION_REQUIRED");const i=Ps(await an(t,e.credentials,"postgres",!1,"Postgres trigger"),["password","secret","token"],"Postgres trigger"),a=Ss(this.ssl,!1),s=Ss(this.acceptSelfSigned,!1),d=ql(this.timeoutMs),l=new rt({host:As(this.host)??"localhost",port:Rs(this.port)??5432,database:r,user:n,password:i,ssl:!!a&&{rejectUnauthorized:!s}});try{await l.connect();const e=await zl(t,d,async e=>(l.on("notification",t=>{t.channel===o&&e({channel:t.channel,message:t.payload??""})}),await l.query(`LISTEN "${o}"`),await t.log("Postgres trigger listening",{channel:o}),async()=>{await l.query(`UNLISTEN "${o}"`).catch(()=>{})}),"GRAPH_TRIGGER_TIMEOUT",`Postgres trigger received no notification within ${d}ms`);return{payload:Wl(e.message,!0===this.jsonParseBody),message:e.message,channel:e.channel}}catch(e){throw Kl("Postgres","GRAPH_POSTGRES_TRIGGER_FAILED",e)}finally{await l.end().catch(()=>{})}}};k([Ut({handle:"host",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.postgres.fields.host.label",type:"string"}),C("design:type",String)],ec.prototype,"host",void 0),k([Ut({handle:"port",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.postgres.fields.port.label",type:"number"}),C("design:type",Number)],ec.prototype,"port",void 0),k([w(),Ut({handle:"database",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.postgres.fields.database.label",type:"string"}),C("design:type",String)],ec.prototype,"database",void 0),k([w(),Ut({handle:"username",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.postgres.fields.username.label",type:"string"}),C("design:type",String)],ec.prototype,"username",void 0),k([w(),Ut({handle:"channel"}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.postgres.fields.channel.label",placeholder:"graph.node.trigger.postgres.fields.channel.placeholder",type:"string"}),C("design:type",String)],ec.prototype,"channel",void 0),k([Ut({handle:"ssl",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.postgres.fields.ssl.label",type:"boolean"}),C("design:type",Boolean)],ec.prototype,"ssl",void 0),k([Ut({handle:"acceptSelfSigned",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.postgres.fields.acceptSelfSigned.label",type:"boolean"}),C("design:type",Boolean)],ec.prototype,"acceptSelfSigned",void 0),k([Ut({handle:"jsonParseBody",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.postgres.fields.jsonParseBody.label",type:"boolean"}),C("design:type",Boolean)],ec.prototype,"jsonParseBody",void 0),k([Ut({handle:"timeoutMs",userControlled:!0}),i("ngx-decaf-crud-field",{label:"graph.node.trigger.postgres.fields.timeoutMs.label",type:"number"}),C("design:type",Number)],ec.prototype,"timeoutMs",void 0),k([w(),$t({handle:"payload"}),C("design:type",Object)],ec.prototype,"payload",void 0),k([$t({handle:"message"}),C("design:type",String)],ec.prototype,"message",void 0),k([$t({handle:"channel"}),C("design:type",String)],ec.prototype,"channelOutput",void 0),ec=k([Mt("core.trigger.postgres",{kind:"core.trigger.postgres",category:"Trigger",color:"#3b82f6",icon:"ti-database",width:96,height:96,labels:["trigger","postgres","sql","listen","notify"],metadata:{title:"graph.node.trigger.postgres.name",description:"graph.node.trigger.postgres.description",trigger:{type:"postgres",channel:"",jsonParseBody:!1}}}),I()],ec);const tc={memory:"memory",scorers:"scorers",embedding:"embedding",hooks:"hooks",sandbox:"sandbox",tools:"tools",skill:"skill",inputProcessors:"inputProcessors",outputProcessors:"outputProcessors"},oc=["memory","scorers","embedding","hooks","sandbox","tools","skill","inputProcessors","outputProcessors"];let rc=class extends Wi{execute(e){throw new Cr("Node kind 'core.agent' requires the mastra engine, which the local backend does not provide",dr,{kind:"core.agent",backend:"local"})}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.agent.agent.fields.prompt.label",placeholder:"graph.node.agent.agent.fields.prompt.placeholder",type:"textarea"}),Ut({handle:"prompt"}),C("design:type",String)],rc.prototype,"prompt",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.agent.fields.name.label",placeholder:"graph.node.agent.agent.fields.name.placeholder",type:"text"}),Ut({handle:"name",userControlled:!0}),C("design:type",String)],rc.prototype,"name",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.agent.fields.description.label",type:"textarea"}),Ut({handle:"description",userControlled:!0}),C("design:type",String)],rc.prototype,"description",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.agent.fields.instructions.label",placeholder:"graph.node.agent.agent.fields.instructions.placeholder",type:"textarea"}),Ut({handle:"instructions",userControlled:!0}),C("design:type",String)],rc.prototype,"instructions",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.agent.fields.skillsFormat.label",type:"select"}),Ut({handle:"skillsFormat",userControlled:!0}),C("design:type",String)],rc.prototype,"skillsFormat",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.agent.fields.maxRetries.label",type:"number"}),Ut({handle:"maxRetries",userControlled:!0}),C("design:type",Number)],rc.prototype,"maxRetries",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.agent.fields.modelAdapter.label",type:"object"}),Ut({handle:"modelAdapter",userControlled:!0,type:"object"}),C("design:type",Object)],rc.prototype,"modelAdapter",void 0),k([i("ngx-decaf-model-builder",{label:"graph.node.agent.agent.fields.structuredOutput.label"}),Ut({handle:"structuredOutput",userControlled:!0,type:"object"}),C("design:type",Object)],rc.prototype,"structuredOutput",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.agent.fields.agentOptions.label",type:"object"}),Ut({handle:"agentOptions",userControlled:!0,type:"object"}),C("design:type",Object)],rc.prototype,"agentOptions",void 0),k([w(),$t({handle:"response"}),C("design:type",String)],rc.prototype,"response",void 0),k([w(),$t({handle:"actions"}),C("design:type",Array)],rc.prototype,"actions",void 0),k([Ft({category:"memory",handle:"memory",zone:{side:"bottom",align:"start",order:0}}),C("design:type",Object)],rc.prototype,"memory",void 0),k([Ft({category:"scorers",handle:"scorers",zone:{side:"top",align:"end",order:0}}),C("design:type",Object)],rc.prototype,"scorers",void 0),k([Ft({category:"embedding",handle:"embedding",zone:{side:"bottom",align:"end",order:0}}),C("design:type",Object)],rc.prototype,"embedding",void 0),k([Ft({category:"hooks",handle:"hooks",zone:{side:"top",align:"center",order:0}}),C("design:type",Object)],rc.prototype,"hooks",void 0),k([Ft({category:"sandbox",handle:"sandbox",zone:{side:"top",align:"center",order:1}}),C("design:type",Object)],rc.prototype,"sandbox",void 0),k([Ft({category:"tools",handle:"tools",zone:{side:"bottom",align:"center",order:0}}),C("design:type",Object)],rc.prototype,"tools",void 0),k([Ft({category:"skill",handle:"skill",zone:{side:"bottom",align:"center",order:1}}),C("design:type",Object)],rc.prototype,"skill",void 0),k([Ft({category:"inputProcessors",handle:"inputProcessors",zone:{side:"top",align:"center",order:2}}),C("design:type",Object)],rc.prototype,"inputProcessors",void 0),k([Ft({category:"outputProcessors",handle:"outputProcessors",zone:{side:"bottom",align:"center",order:2}}),C("design:type",Object)],rc.prototype,"outputProcessors",void 0),k([Ft({category:"model",handle:"model",zone:{side:"bottom",align:"start",order:1}}),C("design:type",Object)],rc.prototype,"model",void 0),k([Ft({category:"workspace",handle:"workspace",zone:{side:"bottom",align:"start",order:2}}),C("design:type",Object)],rc.prototype,"workspace",void 0),rc=k([Mt("core.agent",{kind:"core.agent",category:"Agent",width:168,height:132,labels:["agent","ai","orchestrator"],metadata:{title:"graph.node.agent.agent.name",description:"graph.node.agent.agent.description",shape:"rectangle"}}),I()],rc);const nc=[rc];let ic=class extends Wi{execute(e){return{resource:{type:"mastra.tool",toolId:this.toolId,description:this.description,input:e.inputs}}}};k([i("ngx-decaf-crud-field",{label:"graph.node.agent.tool.fields.toolId.label",placeholder:"graph.node.agent.tool.fields.toolId.placeholder",type:"text"}),Ut({handle:"toolId",userControlled:!0}),C("design:type",String)],ic.prototype,"toolId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.tool.fields.description.label",type:"textarea"}),Ut({handle:"description",userControlled:!0}),C("design:type",String)],ic.prototype,"description",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],ic.prototype,"resource",void 0),k([Ft({category:"tools",handle:"tool"}),C("design:type",Object)],ic.prototype,"tool",void 0),ic=k([Mt("core.agent.tool",{kind:"core.agent.tool",category:"Agent",width:128,height:112,labels:["agent","ai","tool"],metadata:{title:"graph.node.agent.tool.name",description:"graph.node.agent.tool.description",shape:"rectangle"}}),I()],ic);const ac=[ic];let sc=class extends Wi{execute(e){const t=e.inputs.decision??e.inputs.value,o=this.tools??[],r="string"==typeof t?t:o.length?o[0]:void 0;return{selected:r,resource:r?{type:"mastra.tool",toolId:r}:null}}};k([Ut({handle:"decision"}),C("design:type",Object)],sc.prototype,"decision",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.tool_selector.fields.tools.label",type:"text"}),Ut({handle:"tools",userControlled:!0}),C("design:type",Array)],sc.prototype,"tools",void 0),k([$t({handle:"selected"}),C("design:type",Object)],sc.prototype,"selectedOut",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],sc.prototype,"resource",void 0),k([Ft({category:"tools",handle:"tool"}),C("design:type",Object)],sc.prototype,"tool",void 0),sc=k([Mt("core.agent.toolSelector",{kind:"core.agent.toolSelector",category:"Agent",width:128,height:112,labels:["agent","ai","tool","selector"],metadata:{title:"graph.node.agent.tool_selector.name",description:"graph.node.agent.tool_selector.description",shape:"rectangle"}}),I()],sc);const dc=[sc];let lc=class extends Wi{execute(e){const t=e.inputs??{};return{toolName:t.toolName??this.toolName,input:t.input,output:t.output,error:t.error,value:t.value??t}}};k([i("ngx-decaf-crud-field",{label:"graph.node.agent.hook.fields.phase.label",type:"select"}),Ut({handle:"phase",userControlled:!0}),C("design:type",String)],lc.prototype,"phase",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.hook.fields.toolName.label",type:"text"}),Ut({handle:"toolName",userControlled:!0}),C("design:type",String)],lc.prototype,"toolName",void 0),k([w(),Ut({handle:"value"}),C("design:type",Object)],lc.prototype,"value",void 0),k([w(),$t({handle:"toolName"}),C("design:type",Object)],lc.prototype,"toolNameOut",void 0),k([$t({handle:"input"}),C("design:type",Object)],lc.prototype,"inputOut",void 0),k([$t({handle:"output"}),C("design:type",Object)],lc.prototype,"outputOut",void 0),k([$t({handle:"error"}),C("design:type",Object)],lc.prototype,"errorOut",void 0),k([$t({handle:"value"}),C("design:type",Object)],lc.prototype,"valueOut",void 0),k([Ft({category:"hooks",handle:"hook"}),C("design:type",Object)],lc.prototype,"hook",void 0),lc=k([Mt("core.agent.hook",{kind:"core.agent.hook",category:"Agent",width:128,height:112,labels:["agent","ai","hook"],metadata:{title:"graph.node.agent.hook.name",description:"graph.node.agent.hook.description",shape:"rectangle"}}),I()],lc);const cc=[lc];let pc=class extends Wi{execute(e){const t=e.inputs.value;return{proceed:!1,denied:!0,reason:this.reason,value:this.replacement??t}}};k([i("ngx-decaf-crud-field",{label:"graph.node.agent.tool_deny.fields.replacement.label",type:"textarea"}),Ut({handle:"replacement",userControlled:!0}),C("design:type",Object)],pc.prototype,"replacement",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.tool_deny.fields.reason.label",type:"text"}),Ut({handle:"reason",userControlled:!0}),C("design:type",String)],pc.prototype,"reason",void 0),k([Ut({handle:"value"}),C("design:type",Object)],pc.prototype,"value",void 0),k([$t({handle:"proceed"}),C("design:type",Boolean)],pc.prototype,"proceedOut",void 0),k([$t({handle:"value"}),C("design:type",Object)],pc.prototype,"valueOut",void 0),k([$t({handle:"denied"}),C("design:type",Boolean)],pc.prototype,"deniedOut",void 0),k([$t({handle:"reason"}),C("design:type",Object)],pc.prototype,"reasonOut",void 0),pc=k([Mt("core.agent.toolDeny",{kind:"core.agent.toolDeny",category:"Agent",width:112,height:96,labels:["agent","ai","hook","deny"],metadata:{title:"graph.node.agent.tool_deny.name",description:"graph.node.agent.tool_deny.description",shape:"rectangle"}}),I()],pc);const uc=[pc];let gc=class extends Wi{execute(e){const t=e.inputs??{};return{fromAgentId:t.fromAgentId,toAgentId:t.toAgentId??this.subAgentId,input:t.input,output:t.output,error:t.error,value:t.value??t}}};k([i("ngx-decaf-crud-field",{label:"graph.node.agent.delegation_hook.fields.phase.label",type:"select"}),Ut({handle:"phase",userControlled:!0}),C("design:type",String)],gc.prototype,"phase",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.delegation_hook.fields.subAgentId.label",type:"text"}),Ut({handle:"subAgentId",userControlled:!0}),C("design:type",String)],gc.prototype,"subAgentId",void 0),k([w(),Ut({handle:"value"}),C("design:type",Object)],gc.prototype,"value",void 0),k([$t({handle:"fromAgentId"}),C("design:type",Object)],gc.prototype,"fromAgentIdOut",void 0),k([$t({handle:"toAgentId"}),C("design:type",Object)],gc.prototype,"toAgentIdOut",void 0),k([$t({handle:"input"}),C("design:type",Object)],gc.prototype,"inputOut",void 0),k([$t({handle:"output"}),C("design:type",Object)],gc.prototype,"outputOut",void 0),k([$t({handle:"error"}),C("design:type",Object)],gc.prototype,"errorOut",void 0),k([$t({handle:"value"}),C("design:type",Object)],gc.prototype,"valueOut",void 0),k([Ft({category:"hooks",handle:"hook"}),C("design:type",Object)],gc.prototype,"hook",void 0),gc=k([Mt("core.agent.delegationHook",{kind:"core.agent.delegationHook",category:"Agent",width:128,height:112,labels:["agent","ai","hook","delegation"],metadata:{title:"graph.node.agent.delegation_hook.name",description:"graph.node.agent.delegation_hook.description",shape:"rectangle"}}),I()],gc);const hc=[gc];let fc=class extends Wi{execute(e){return{resource:{type:"mastra.skill",name:this.name,description:this.description,input:e.inputs}}}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.agent.skill.fields.name.label",type:"text"}),Ut({handle:"name",userControlled:!0}),C("design:type",String)],fc.prototype,"name",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.skill.fields.description.label",type:"textarea"}),Ut({handle:"description",userControlled:!0}),C("design:type",String)],fc.prototype,"description",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.skill.fields.instructions.label",type:"textarea"}),Ut({handle:"instructions",userControlled:!0}),C("design:type",String)],fc.prototype,"instructions",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],fc.prototype,"resource",void 0),k([Ft({category:"skill",handle:"skill"}),C("design:type",Object)],fc.prototype,"skill",void 0),fc=k([Mt("core.agent.skill",{kind:"core.agent.skill",category:"Agent",width:128,height:112,labels:["agent","ai","skill"],metadata:{title:"graph.node.agent.skill.name",description:"graph.node.agent.skill.description",shape:"rectangle"}}),I()],fc);const yc=[fc];let mc=class extends Wi{execute(e){const t=e.inputs.decision??e.inputs.value,o=this.skills??[],r="string"==typeof t?t:o.length?o[0]:void 0;return{selected:r,resource:r?{type:"mastra.skill",name:r}:null}}};k([Ut({handle:"decision"}),C("design:type",Object)],mc.prototype,"decision",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.skill_selector.fields.skills.label",type:"text"}),Ut({handle:"skills",userControlled:!0}),C("design:type",Array)],mc.prototype,"skills",void 0),k([$t({handle:"selected"}),C("design:type",Object)],mc.prototype,"selectedOut",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],mc.prototype,"resource",void 0),k([Ft({category:"skill",handle:"skill"}),C("design:type",Object)],mc.prototype,"skill",void 0),mc=k([Mt("core.agent.skillSelector",{kind:"core.agent.skillSelector",category:"Agent",width:128,height:112,labels:["agent","ai","skill","selector"],metadata:{title:"graph.node.agent.skill_selector.name",description:"graph.node.agent.skill_selector.description",shape:"rectangle"}}),I()],mc);const bc=[mc];function wc(e){const t=Zi.graph.execution?.maxCodeTimeoutMs;return ta(e,"number"==typeof t&&Number.isFinite(t)&&t>0?t:hr)}let vc=class extends Wi{execute(e){return{resource:{type:"mastra.sandbox",workingDirectory:this.workingDirectory,isolation:this.isolation,timeoutMs:wc(this.timeoutMs),input:e.inputs}}}};k([i("ngx-decaf-crud-field",{label:"graph.node.agent.sandbox.fields.workingDirectory.label",type:"text"}),Ut({handle:"workingDirectory",userControlled:!0}),C("design:type",String)],vc.prototype,"workingDirectory",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.sandbox.fields.isolation.label",type:"select"}),Ut({handle:"isolation",userControlled:!0}),C("design:type",String)],vc.prototype,"isolation",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.sandbox.fields.timeoutMs.label",type:"number"}),Ut({handle:"timeoutMs",userControlled:!0}),C("design:type",Number)],vc.prototype,"timeoutMs",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],vc.prototype,"resource",void 0),k([Ft({category:"sandbox",handle:"sandbox"}),C("design:type",Object)],vc.prototype,"sandbox",void 0),vc=k([Mt("core.agent.sandbox",{kind:"core.agent.sandbox",category:"Agent",width:128,height:112,labels:["agent","ai","sandbox","filesystem"],metadata:{title:"graph.node.agent.sandbox.name",description:"graph.node.agent.sandbox.description",shape:"rectangle"}}),I()],vc);const xc=[vc];let Ic=class extends Wi{execute(e){return{resource:{type:"mastra.scorer",id:this.scorerId,description:this.description,scorerType:this.scorerType,input:e.inputs}}}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.agent.scorer.fields.scorerId.label",type:"text"}),Ut({handle:"scorerId",userControlled:!0}),C("design:type",String)],Ic.prototype,"scorerId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.scorer.fields.description.label",type:"textarea"}),Ut({handle:"description",userControlled:!0}),C("design:type",String)],Ic.prototype,"description",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.scorer.fields.scorerType.label",type:"select"}),Ut({handle:"scorerType",userControlled:!0}),C("design:type",String)],Ic.prototype,"scorerType",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Ic.prototype,"resource",void 0),k([Ft({category:"scorers",handle:"scorer"}),C("design:type",Object)],Ic.prototype,"scorer",void 0),Ic=k([Mt("core.agent.scorer",{kind:"core.agent.scorer",category:"Agent",width:128,height:112,labels:["agent","ai","scorer","eval"],metadata:{title:"graph.node.agent.scorer.name",description:"graph.node.agent.scorer.description",shape:"rectangle"}}),I()],Ic);const _c=[Ic];let Ec=class extends Wi{execute(e){const t=e.inputs.decision??e.inputs.value,o=this.scorers??[],r="string"==typeof t?t:o.length?o[0]:void 0;return{selected:r,resource:r?{type:"mastra.scorer",id:r}:null}}};k([Ut({handle:"decision"}),C("design:type",Object)],Ec.prototype,"decision",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.scorer_selector.fields.scorers.label",type:"text"}),Ut({handle:"scorers",userControlled:!0}),C("design:type",Array)],Ec.prototype,"scorers",void 0),k([$t({handle:"selected"}),C("design:type",Object)],Ec.prototype,"selectedOut",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Ec.prototype,"resource",void 0),k([Ft({category:"scorers",handle:"scorer"}),C("design:type",Object)],Ec.prototype,"scorer",void 0),Ec=k([Mt("core.agent.scorerSelector",{kind:"core.agent.scorerSelector",category:"Agent",width:128,height:112,labels:["agent","ai","scorer","selector"],metadata:{title:"graph.node.agent.scorer_selector.name",description:"graph.node.agent.scorer_selector.description",shape:"rectangle"}}),I()],Ec);const Ac=[Ec];o.accumulate({mastra:{engine:{enabled:!0,terminalTimeoutMs:3e5},provider:{endpoint:"",model:""},credentials:{apiKeyEnv:"MASTRA_PROVIDER_API_KEY"},observability:{enabled:!0,serviceName:"as-graph-mastra",environment:"",langfuse:{endpoint:"https://cloud.langfuse.com",publicKeyEnv:"LANGFUSE_PUBLIC_KEY",secretKeyEnv:"LANGFUSE_SECRET_KEY"}},persistence:{replaysAdapter:"fs",cacheAdapter:"ram",pinsAdapter:"fs",fsRoot:"var/as-graph-mastra"}}});const Sc=[...Pn,"connectionString","dsn","pwd","passphrase","authToken"];function Rc(e,t,o,r=0){if(8>=r&&null!==e)if(Array.isArray(e))for(const n of e)Rc(n,t,o,r+1);else if("object"==typeof e)for(const[n,i]of Object.entries(e)){const e=[...t,n];if(Sc.includes(n))throw new Cr(`The '${o.provider}' ${o.surface} connection options carry plaintext credential material in '${e.join(".")}'; configs may only reference credentials by name through 'credentialRef', resolved by the host from the git-ignored .env.secret (gate C, SAA-911 F4)`,"GRAPH_MASTRA_PLAIN_CREDENTIAL_REFUSED",{provider:o.provider,id:o.id,key:n,path:e.join(".")});Rc(i,e,o,r+1)}}function Oc(e,t){Rc(e,[],t)}const kc=["memory","libsql","pg","mongodb","upstash","cloud","d1","dynamodb","convex","astra","redis"];function Cc(e){const t={type:"mastra.memory",provider:e.provider,id:e.id??e.provider};return void 0!==e.threadId&&(t.threadId=e.threadId),void 0!==e.resourceId&&(t.resourceId=e.resourceId),void 0!==e.lastMessages&&(t.lastMessages=e.lastMessages),void 0!==e.semanticRecall&&(t.semanticRecall=e.semanticRecall),void 0!==e.workingMemoryTemplate&&(t.workingMemory={enabled:!0,template:e.workingMemoryTemplate}),void 0!==e.generateTitle&&(t.generateTitle=e.generateTitle),void 0!==e.credentialRef&&(t.credentialRef=e.credentialRef),t}let Nc=class extends Wi{execute(e){return{resource:Cc(this.configOf(e))}}configOf(e){const t=this.provider??"memory";if(!kc.includes(t))throw new Cr(`Memory provider node '${e.nodeId}' declares unknown provider '${t+""}'`,"GRAPH_MASTRA_MEMORY_PROVIDER_UNKNOWN",{nodeId:e.nodeId,provider:t+""});const o=e.inputs.workingMemoryTemplate,r={provider:t};void 0!==this.memoryId&&(r.id=this.memoryId),void 0!==this.threadId&&(r.threadId=this.threadId),void 0!==this.resourceId&&(r.resourceId=this.resourceId),void 0!==this.lastMessages&&(r.lastMessages=this.lastMessages),void 0!==this.semanticRecall&&(r.semanticRecall=this.semanticRecall),void 0!==this.generateTitle&&(r.generateTitle=this.generateTitle),void 0!==this.memoryOptions&&(r.memoryOptions=this.memoryOptions),void 0!==this.connection&&(r.connection=this.connection),void 0!==this.credentialKey&&(r.credentialKey=this.credentialKey),void 0!==this.credentialRef&&(r.credentialRef=this.credentialRef);const n="string"==typeof o&&o.trim().length>0?o:this.workingMemoryTemplate;return"string"==typeof n&&n.trim().length>0&&(r.workingMemoryTemplate=n),r}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.agent.memory.fields.provider.label",type:"select"}),Ut({handle:"provider",userControlled:!0}),C("design:type",String)],Nc.prototype,"provider",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.memory.fields.memoryId.label",type:"text"}),Ut({handle:"memoryId",userControlled:!0}),C("design:type",String)],Nc.prototype,"memoryId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.memory.fields.threadId.label",placeholder:"graph.node.agent.memory.fields.threadId.placeholder",type:"text"}),Ut({handle:"threadId",userControlled:!0}),C("design:type",String)],Nc.prototype,"threadId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.memory.fields.resourceId.label",type:"text"}),Ut({handle:"resourceId",userControlled:!0}),C("design:type",String)],Nc.prototype,"resourceId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.memory.fields.lastMessages.label",type:"number"}),Ut({handle:"lastMessages",userControlled:!0}),C("design:type",Number)],Nc.prototype,"lastMessages",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.memory.fields.semanticRecall.label",type:"select"}),Ut({handle:"semanticRecall",userControlled:!0}),C("design:type",Boolean)],Nc.prototype,"semanticRecall",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.memory.fields.workingMemoryTemplate.label",placeholder:"graph.node.agent.memory.fields.workingMemoryTemplate.placeholder",type:"textarea"}),Ut({handle:"workingMemoryTemplate",userControlled:!0}),C("design:type",String)],Nc.prototype,"workingMemoryTemplate",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.memory.fields.generateTitle.label",type:"select"}),Ut({handle:"generateTitle",userControlled:!0}),C("design:type",Boolean)],Nc.prototype,"generateTitle",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.memory.fields.memoryOptions.label",type:"object"}),Ut({handle:"memoryOptions",userControlled:!0,type:"object"}),C("design:type",Object)],Nc.prototype,"memoryOptions",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.memory.fields.connection.label",type:"object"}),Ut({handle:"connection",userControlled:!0,type:"object"}),C("design:type",Object)],Nc.prototype,"connection",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.memory.fields.credentialRef.label",type:"text"}),Ut({handle:"credentialKey",userControlled:!0}),C("design:type",String)],Nc.prototype,"credentialKey",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.memory.fields.credentialRef.label",type:"object"}),Ut({handle:"credentialRef",userControlled:!0,type:"object"}),C("design:type",Object)],Nc.prototype,"credentialRef",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Nc.prototype,"resource",void 0),k([Ft({category:"memory",handle:"memory"}),C("design:type",Object)],Nc.prototype,"memory",void 0),Nc=k([Mt("core.agent.memory",{kind:"core.agent.memory",category:"Agent",width:140,height:120,labels:["agent","ai","memory"],metadata:{title:"graph.node.agent.memory.name",description:"graph.node.agent.memory.description",shape:"rectangle"}}),I()],Nc);let Tc=class extends Wi{execute(e){const t=e.inputs.decision??e.inputs.value,o=this.memories??[],r="string"==typeof t?t:o.length?o[0]:void 0;return{selected:r,resource:r?{type:"mastra.memory",id:r}:null}}};k([Ut({handle:"decision"}),C("design:type",Object)],Tc.prototype,"decision",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.memory_selector.fields.memories.label",type:"text"}),Ut({handle:"memories",userControlled:!0}),C("design:type",Array)],Tc.prototype,"memories",void 0),k([$t({handle:"selected"}),C("design:type",Object)],Tc.prototype,"selectedOut",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Tc.prototype,"resource",void 0),k([Ft({category:"memory",handle:"memory"}),C("design:type",Object)],Tc.prototype,"memory",void 0),Tc=k([Mt("core.agent.memorySelector",{kind:"core.agent.memorySelector",category:"Agent",width:128,height:112,labels:["agent","ai","memory","selector"],metadata:{title:"graph.node.agent.memory_selector.name",description:"graph.node.agent.memory_selector.description",shape:"rectangle"}}),I()],Tc);const Pc=[Tc];let Dc=class extends Wi{execute(e){const t=this.modelAdapter??{};return{resource:{type:"mastra.embedding",provider:t.provider,modelId:t.modelId,dimension:this.dimension,batchSize:this.batchSize,input:e.inputs}}}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.agent.embedding.fields.modelAdapter.label",type:"object"}),Ut({handle:"modelAdapter",userControlled:!0,type:"object"}),C("design:type",Object)],Dc.prototype,"modelAdapter",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.embedding.fields.dimension.label",type:"number"}),Ut({handle:"dimension",userControlled:!0}),C("design:type",Number)],Dc.prototype,"dimension",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.embedding.fields.batchSize.label",type:"number"}),Ut({handle:"batchSize",userControlled:!0}),C("design:type",Number)],Dc.prototype,"batchSize",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Dc.prototype,"resource",void 0),k([Ft({category:"embedding",handle:"embedding"}),C("design:type",Object)],Dc.prototype,"embedding",void 0),Dc=k([Mt("core.agent.embedding",{kind:"core.agent.embedding",category:"Agent",width:128,height:112,labels:["agent","ai","embedding","vector"],metadata:{title:"graph.node.agent.embedding.name",description:"graph.node.agent.embedding.description",shape:"rectangle"}}),I()],Dc);const jc=[Dc];let Lc=class extends Wi{execute(e){const t=this.provider??"memory",o={type:"mastra.vectorStore",provider:t,id:this.storeId??this.indexName??t};void 0!==this.indexName&&(o.indexName=this.indexName),void 0!==this.dimension&&(o.dimension=this.dimension),void 0!==this.metric&&(o.metric=this.metric),void 0!==this.embedding&&(Oc(this.embedding,{provider:t,id:this.storeId??this.indexName??t,surface:"vector store embedding"}),o.embedding=this.embedding),void 0!==this.credentialRef&&(o.credentialRef=this.credentialRef);const r=e.inputs.ids;return{resource:o,inserted:Array.isArray(r)?r:[],documents:e.inputs.documents??[]}}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.agent.vector_store.fields.provider.label",type:"select"}),Ut({handle:"provider",userControlled:!0}),C("design:type",String)],Lc.prototype,"provider",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.vector_store.fields.storeId.label",type:"text"}),Ut({handle:"storeId",userControlled:!0}),C("design:type",String)],Lc.prototype,"storeId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.vector_store.fields.indexName.label",type:"text"}),Ut({handle:"indexName",userControlled:!0}),C("design:type",String)],Lc.prototype,"indexName",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.vector_store.fields.dimension.label",type:"number"}),Ut({handle:"dimension",userControlled:!0}),C("design:type",Number)],Lc.prototype,"dimension",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.vector_store.fields.metric.label",type:"select"}),Ut({handle:"metric",userControlled:!0}),C("design:type",String)],Lc.prototype,"metric",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.embedding.fields.modelAdapter.label",type:"object"}),Ut({handle:"embedding",userControlled:!0,type:"object"}),C("design:type",Object)],Lc.prototype,"embedding",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.vector_store.fields.connection.label",type:"object"}),Ut({handle:"connection",userControlled:!0,type:"object"}),C("design:type",Object)],Lc.prototype,"connection",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.vector_store.fields.credentialRef.label",type:"text"}),Ut({handle:"credentialKey",userControlled:!0}),C("design:type",String)],Lc.prototype,"credentialKey",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.vector_store.fields.credentialRef.label",type:"object"}),Ut({handle:"credentialRef",userControlled:!0,type:"object"}),C("design:type",Object)],Lc.prototype,"credentialRef",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Lc.prototype,"resource",void 0),k([$t({handle:"inserted"}),C("design:type",Object)],Lc.prototype,"insertedOut",void 0),k([$t({handle:"documents"}),C("design:type",Object)],Lc.prototype,"documentsOut",void 0),Lc=k([Mt("core.agent.vectorStore",{kind:"core.agent.vectorStore",category:"Agent",width:140,height:120,labels:["agent","ai","vector-store","rag"],metadata:{title:"graph.node.agent.vector_store.name",description:"graph.node.agent.vector_store.description",shape:"rectangle"}}),I()],Lc);const Mc=[Lc];let Gc=class extends Wi{execute(e){const t=e.inputs.documents;return{documents:Array.isArray(t)?t:[],resource:{type:"mastra.retriever",topK:this.topK,indexName:this.indexName,store:e.inputs.store,input:e.inputs}}}};k([w(),Ut({handle:"store"}),C("design:type",Object)],Gc.prototype,"store",void 0),k([w(),Ut({handle:"query"}),C("design:type",Object)],Gc.prototype,"query",void 0),k([Ut({handle:"queryVector"}),C("design:type",Object)],Gc.prototype,"queryVector",void 0),k([Ut({handle:"filter",type:"object"}),C("design:type",Object)],Gc.prototype,"filter",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.retriever.fields.topK.label",type:"number"}),Ut({handle:"topK",userControlled:!0}),C("design:type",Number)],Gc.prototype,"topK",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.retriever.fields.indexName.label",type:"text"}),Ut({handle:"indexName",userControlled:!0}),C("design:type",String)],Gc.prototype,"indexName",void 0),k([w(),$t({handle:"documents"}),C("design:type",Object)],Gc.prototype,"documents",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Gc.prototype,"resource",void 0),Gc=k([Mt("core.agent.retriever",{kind:"core.agent.retriever",category:"Agent",width:128,height:112,labels:["agent","ai","retriever","rag"],metadata:{title:"graph.node.agent.retriever.name",description:"graph.node.agent.retriever.description",shape:"rectangle"}}),I()],Gc);const Uc=[Gc],$c=1e3,Fc=200;function Hc(e,t,o){if("number"!=typeof e||!Number.isFinite(e))return t;const r=Math.floor(e);return o>r?t:r}function Bc(e,t,o){if(e.length<=t)return e.length?[e]:[];const r=Math.max(1,t-o),n=[];for(let o=0;o<e.length;o+=r){const r=Math.min(o+t,e.length);if(n.push(e.slice(o,r)),r>=e.length)break}return n}function qc(e,t={}){if("string"!=typeof e||0===e.length)return[];const o=t.strategy??"recursive",r=Hc(t.chunkSize,1e3,1),n=Hc(t.chunkOverlap,200,0),i=Math.min(n,Math.max(0,r-1));if("character"===o)return Bc(e,r,i);if("token"===o){const t=e.split(/\s+/).filter(e=>e.length>0);if(0===t.length)return[];const o=Math.max(1,r-i),n=[];for(let e=0;e<t.length&&(n.push(t.slice(e,e+r).join(" ")),e+r<t.length);e+=o);return n}const a="markdown"===o?"\n#":t.separator??"\n\n",s=e.split(a),d=[];return s.forEach(e=>{const t=e.trim();t&&(t.length>r?d.push(...Bc(t,r,i)):d.push(t))}),d.length?d:Bc(e,r,i)}function Wc(e){const t=e.documents,o=[];if("string"==typeof e.text&&o.push(e.text),Array.isArray(t))for(const e of t)"string"==typeof e?o.push(e):e&&"object"==typeof e&&"string"==typeof e.text&&o.push(e.text);return o}let Kc=class extends Wi{execute(e){const t=Wc(e.inputs),o={strategy:this.strategy,chunkSize:this.chunkSize,chunkOverlap:this.chunkOverlap,separator:this.separator},r=t.flatMap(e=>qc(e,o));return{chunks:r,count:r.length}}};k([i("ngx-decaf-crud-field",{label:"graph.node.agent.chunking.fields.strategy.label",type:"select"}),Ut({handle:"strategy",userControlled:!0}),C("design:type",String)],Kc.prototype,"strategy",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.chunking.fields.chunkSize.label",type:"number"}),Ut({handle:"chunkSize",userControlled:!0}),C("design:type",Number)],Kc.prototype,"chunkSize",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.chunking.fields.chunkOverlap.label",type:"number"}),Ut({handle:"chunkOverlap",userControlled:!0}),C("design:type",Number)],Kc.prototype,"chunkOverlap",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.chunking.fields.separator.label",type:"text"}),Ut({handle:"separator",userControlled:!0}),C("design:type",String)],Kc.prototype,"separator",void 0),k([w(),$t({handle:"chunks"}),C("design:type",Object)],Kc.prototype,"chunks",void 0),k([$t({handle:"count"}),C("design:type",Object)],Kc.prototype,"countOut",void 0),Kc=k([Mt("core.agent.chunking",{kind:"core.agent.chunking",category:"Agent",width:128,height:112,labels:["agent","ai","chunking","rag"],metadata:{title:"graph.node.agent.chunking.name",description:"graph.node.agent.chunking.description",shape:"rectangle"}}),I()],Kc);const Vc=[Kc];let zc=class extends Wi{execute(e){const t=e.inputs.documents,o=Array.isArray(t)?t:[],r="number"==typeof this.topN&&this.topN>0?this.topN:void 0,n=this.modelAdapter??{};return{documents:void 0!==r?o.slice(0,r):o,resource:{type:"mastra.rerank",provider:n.provider,modelId:n.modelId,topN:r}}}};k([w(),Ut({handle:"documents"}),C("design:type",Object)],zc.prototype,"documents",void 0),k([Ut({handle:"query"}),C("design:type",Object)],zc.prototype,"query",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.rerank.fields.modelAdapter.label",type:"object"}),Ut({handle:"modelAdapter",userControlled:!0,type:"object"}),C("design:type",Object)],zc.prototype,"modelAdapter",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.rerank.fields.topN.label",type:"number"}),Ut({handle:"topN",userControlled:!0}),C("design:type",Number)],zc.prototype,"topN",void 0),k([w(),$t({handle:"documents"}),C("design:type",Object)],zc.prototype,"documentsOut",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],zc.prototype,"resource",void 0),zc=k([Mt("core.agent.rerank",{kind:"core.agent.rerank",category:"Agent",width:128,height:112,labels:["agent","ai","rerank","rag"],metadata:{title:"graph.node.agent.rerank.name",description:"graph.node.agent.rerank.description",shape:"rectangle"}}),I()],zc);const Qc=[zc];let Jc=class extends Wi{execute(e){const t=this.modelAdapter??{},o=e.inputs.context??e.inputs.documents,r=Array.isArray(o)?o:[];return{text:"string"==typeof e.inputs.text?e.inputs.text:"",sourceDocuments:this.returnSourceDocuments?r:[],resource:{type:"mastra.chain.qa",provider:t.provider,modelId:t.modelId,returnSourceDocuments:this.returnSourceDocuments??!1}}}};k([w(),Ut({handle:"query"}),C("design:type",Object)],Jc.prototype,"query",void 0),k([Ut({handle:"context"}),C("design:type",Object)],Jc.prototype,"context",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.chain.qa.fields.modelAdapter.label",type:"object"}),Ut({handle:"modelAdapter",userControlled:!0,type:"object"}),C("design:type",Object)],Jc.prototype,"modelAdapter",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.chain.qa.fields.promptTemplate.label",type:"textarea"}),Ut({handle:"promptTemplate",userControlled:!0}),C("design:type",String)],Jc.prototype,"promptTemplate",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.chain.qa.fields.returnSourceDocuments.label",type:"boolean"}),Ut({handle:"returnSourceDocuments",userControlled:!0}),C("design:type",Boolean)],Jc.prototype,"returnSourceDocuments",void 0),k([w(),$t({handle:"text"}),C("design:type",Object)],Jc.prototype,"text",void 0),k([$t({handle:"sourceDocuments"}),C("design:type",Object)],Jc.prototype,"sourceDocumentsOut",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Jc.prototype,"resource",void 0),Jc=k([Mt("core.agent.chain.qa",{kind:"core.agent.chain.qa",category:"Agent",width:128,height:112,labels:["agent","ai","chain","qa"],metadata:{title:"graph.node.agent.chain.qa.name",description:"graph.node.agent.chain.qa.description",shape:"rectangle"}}),I()],Jc);const Xc=[Jc];let Yc=class extends Wi{execute(e){const t=this.modelAdapter??{};return{text:"string"==typeof e.inputs.text?e.inputs.text:"",resource:{type:"mastra.chain.basic",provider:t.provider,modelId:t.modelId,promptTemplate:this.promptTemplate}}}};k([w(),Ut({handle:"input"}),C("design:type",Object)],Yc.prototype,"input",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.chain.basic.fields.modelAdapter.label",type:"object"}),Ut({handle:"modelAdapter",userControlled:!0,type:"object"}),C("design:type",Object)],Yc.prototype,"modelAdapter",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.chain.basic.fields.promptTemplate.label",type:"textarea"}),Ut({handle:"promptTemplate",userControlled:!0}),C("design:type",String)],Yc.prototype,"promptTemplate",void 0),k([w(),$t({handle:"text"}),C("design:type",Object)],Yc.prototype,"text",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Yc.prototype,"resource",void 0),Yc=k([Mt("core.agent.chain.basic",{kind:"core.agent.chain.basic",category:"Agent",width:128,height:112,labels:["agent","ai","chain","llm"],metadata:{title:"graph.node.agent.chain.basic.name",description:"graph.node.agent.chain.basic.description",shape:"rectangle"}}),I()],Yc);const Zc=[Yc];let ep=class extends Wi{execute(e){const t=this.modelAdapter??{},o=e.inputs.documents;return{text:"string"==typeof e.inputs.text?e.inputs.text:"",resource:{type:"mastra.chain.summarization",provider:t.provider,modelId:t.modelId,strategy:this.strategy??"stuff",documentCount:Array.isArray(o)?o.length:0}}}};k([w(),Ut({handle:"documents"}),C("design:type",Object)],ep.prototype,"documents",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.chain.summarization.fields.modelAdapter.label",type:"object"}),Ut({handle:"modelAdapter",userControlled:!0,type:"object"}),C("design:type",Object)],ep.prototype,"modelAdapter",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.chain.summarization.fields.strategy.label",type:"select"}),Ut({handle:"strategy",userControlled:!0}),C("design:type",String)],ep.prototype,"strategy",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.chain.summarization.fields.instructions.label",type:"textarea"}),Ut({handle:"instructions",userControlled:!0}),C("design:type",String)],ep.prototype,"instructions",void 0),k([w(),$t({handle:"text"}),C("design:type",Object)],ep.prototype,"text",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],ep.prototype,"resource",void 0),ep=k([Mt("core.agent.chain.summarization",{kind:"core.agent.chain.summarization",category:"Agent",width:128,height:112,labels:["agent","ai","chain","summarization"],metadata:{title:"graph.node.agent.chain.summarization.name",description:"graph.node.agent.chain.summarization.description",shape:"rectangle"}}),I()],ep);const tp=[ep];function op(e){if("string"!=typeof e||0===e.trim().length)return null;try{return JSON.parse(e)}catch{return null}}let rp=class extends Wi{execute(e){return{object:op(e.inputs.text??e.inputs.input),resource:{type:"mastra.structuredOutputParser",strict:this.strict??!1,hasSchema:void 0!==this.structuredOutput}}}};k([w(),Ut({handle:"text"}),C("design:type",Object)],rp.prototype,"text",void 0),k([i("ngx-decaf-model-builder",{label:"graph.node.agent.structured_output_parser.fields.structuredOutput.label"}),Ut({handle:"structuredOutput",userControlled:!0,type:"object"}),C("design:type",Object)],rp.prototype,"structuredOutput",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.structured_output_parser.fields.strict.label",type:"boolean"}),Ut({handle:"strict",userControlled:!0}),C("design:type",Boolean)],rp.prototype,"strict",void 0),k([w(),$t({handle:"object"}),C("design:type",Object)],rp.prototype,"object",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],rp.prototype,"resource",void 0),rp=k([Mt("core.agent.structuredOutputParser",{kind:"core.agent.structuredOutputParser",category:"Agent",width:128,height:112,labels:["agent","ai","parser","structured-output"],metadata:{title:"graph.node.agent.structured_output_parser.name",description:"graph.node.agent.structured_output_parser.description",shape:"rectangle"}}),I()],rp);const np=[rp];let ip=class extends Wi{execute(e){const t=this.modelAdapter??{};return{data:e.inputs.data??null,resource:{type:"mastra.informationExtractor",provider:t.provider,modelId:t.modelId,instructions:this.instructions,hasSchema:void 0!==this.structuredOutput}}}};k([w(),Ut({handle:"text"}),C("design:type",Object)],ip.prototype,"text",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.information_extractor.fields.modelAdapter.label",type:"object"}),Ut({handle:"modelAdapter",userControlled:!0,type:"object"}),C("design:type",Object)],ip.prototype,"modelAdapter",void 0),k([i("ngx-decaf-model-builder",{label:"graph.node.agent.information_extractor.fields.structuredOutput.label"}),Ut({handle:"structuredOutput",userControlled:!0,type:"object"}),C("design:type",Object)],ip.prototype,"structuredOutput",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.information_extractor.fields.instructions.label",type:"textarea"}),Ut({handle:"instructions",userControlled:!0}),C("design:type",String)],ip.prototype,"instructions",void 0),k([w(),$t({handle:"data"}),C("design:type",Object)],ip.prototype,"data",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],ip.prototype,"resource",void 0),ip=k([Mt("core.agent.informationExtractor",{kind:"core.agent.informationExtractor",category:"Agent",width:128,height:112,labels:["agent","ai","extractor","structured-output"],metadata:{title:"graph.node.agent.information_extractor.name",description:"graph.node.agent.information_extractor.description",shape:"rectangle"}}),I()],ip);const ap=[ip];let sp=class extends Wi{execute(e){return{output:e.inputs.input??null,resource:{type:"mastra.langchainCode",language:this.language??"javascript",mode:this.mode??"runOnce",hasCode:"string"==typeof this.code&&this.code.length>0}}}};k([w(),Ut({handle:"input"}),C("design:type",Object)],sp.prototype,"input",void 0),k([w(),i("ngx-decaf-crud-field",{label:"graph.node.agent.langchain_code.fields.code.label",type:"textarea"}),Ut({handle:"code",userControlled:!0}),C("design:type",String)],sp.prototype,"code",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.langchain_code.fields.language.label",type:"select"}),Ut({handle:"language",userControlled:!0}),C("design:type",String)],sp.prototype,"language",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.langchain_code.fields.mode.label",type:"select"}),Ut({handle:"mode",userControlled:!0}),C("design:type",String)],sp.prototype,"mode",void 0),k([$t({handle:"output"}),C("design:type",Object)],sp.prototype,"outputOut",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],sp.prototype,"resource",void 0),sp=k([Mt("core.agent.langchainCode",{kind:"core.agent.langchainCode",category:"Agent",width:128,height:112,labels:["agent","ai","code","glue"],metadata:{title:"graph.node.agent.langchain_code.name",description:"graph.node.agent.langchain_code.description",shape:"rectangle"}}),I()],sp);const dp=[sp],lp=["unicodeNormalizer","languageDetector","piiDetector","promptInjectionDetector","systemPromptScrubber","tokenCostControl","modelSelection"],cp=["tokenLimiter","toolCallFilter","regexFilter","responseCache","batchParts","providerHistoryCompat","cyberRefusalHandler","prefillErrorHandler","streamErrorRetry","unsupportedFileHandler"],pp=["moderation","piiDetector","promptInjectionDetector","regexFilter"];let up=class extends Wi{execute(e){return{resource:{type:"mastra.inputProcessor",processorType:this.processorType,options:this.options,input:e.inputs}}}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.agent.input_processor.fields.processorType.label",type:"select"}),Ut({handle:"processorType",userControlled:!0}),C("design:type",Object)],up.prototype,"processorType",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.input_processor.fields.options.label",type:"object"}),Ut({handle:"options",userControlled:!0,type:"object"}),C("design:type",Object)],up.prototype,"options",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.input_processor.fields.modelAdapter.label",type:"object"}),Ut({handle:"modelAdapter",userControlled:!0,type:"object"}),C("design:type",Object)],up.prototype,"modelAdapter",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],up.prototype,"resource",void 0),k([Ft({category:"inputProcessors",handle:"processors"}),C("design:type",Object)],up.prototype,"processors",void 0),up=k([Mt("core.agent.inputProcessor",{kind:"core.agent.inputProcessor",category:"Agent",width:128,height:112,labels:["agent","ai","processor","input"],metadata:{title:"graph.node.agent.input_processor.name",description:"graph.node.agent.input_processor.description",shape:"rectangle"}}),I()],up);const gp=[up];let hp=class extends Wi{execute(e){return{resource:{type:"mastra.outputProcessor",processorType:this.processorType,options:this.options,input:e.inputs}}}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.agent.output_processor.fields.processorType.label",type:"select"}),Ut({handle:"processorType",userControlled:!0}),C("design:type",Object)],hp.prototype,"processorType",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.output_processor.fields.options.label",type:"object"}),Ut({handle:"options",userControlled:!0,type:"object"}),C("design:type",Object)],hp.prototype,"options",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],hp.prototype,"resource",void 0),k([Ft({category:"outputProcessors",handle:"processors"}),C("design:type",Object)],hp.prototype,"processors",void 0),hp=k([Mt("core.agent.outputProcessor",{kind:"core.agent.outputProcessor",category:"Agent",width:128,height:112,labels:["agent","ai","processor","output"],metadata:{title:"graph.node.agent.output_processor.name",description:"graph.node.agent.output_processor.description",shape:"rectangle"}}),I()],hp);const fp=[hp];let yp=class extends Wi{execute(e){return{resource:{type:"mastra.guardrail",guardrailType:this.guardrailType,strategy:this.strategy,options:this.options,input:e.inputs}}}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.agent.guardrail.fields.guardrailType.label",type:"select"}),Ut({handle:"guardrailType",userControlled:!0}),C("design:type",Object)],yp.prototype,"guardrailType",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.guardrail.fields.strategy.label",type:"select"}),Ut({handle:"strategy",userControlled:!0}),C("design:type",String)],yp.prototype,"strategy",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.guardrail.fields.options.label",type:"object"}),Ut({handle:"options",userControlled:!0,type:"object"}),C("design:type",Object)],yp.prototype,"options",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.guardrail.fields.modelAdapter.label",type:"object"}),Ut({handle:"modelAdapter",userControlled:!0,type:"object"}),C("design:type",Object)],yp.prototype,"modelAdapter",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],yp.prototype,"resource",void 0),k([Ft({category:"outputProcessors",handle:"guardrail"}),C("design:type",Object)],yp.prototype,"guardrail",void 0),yp=k([Mt("core.agent.guardrail",{kind:"core.agent.guardrail",category:"Agent",width:128,height:112,labels:["agent","ai","guardrail","safety"],metadata:{title:"graph.node.agent.guardrail.name",description:"graph.node.agent.guardrail.description",shape:"rectangle"}}),I()],yp);const mp=[yp];let bp=class extends Wi{execute(e){throw new Cr("Node kind 'core.agent.hitl' requires the mastra engine, which the local backend does not provide",dr,{kind:"core.agent.hitl",backend:"local"})}};k([w(),Ut({handle:"value"}),C("design:type",Object)],bp.prototype,"value",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.hitl.fields.message.label",placeholder:"graph.node.agent.hitl.fields.message.placeholder",type:"textarea"}),Ut({handle:"message",userControlled:!0}),C("design:type",String)],bp.prototype,"message",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.hitl.fields.prompt.label",type:"textarea"}),Ut({handle:"prompt",userControlled:!0}),C("design:type",String)],bp.prototype,"prompt",void 0),k([w(),Ut({handle:"resumeSchema"}),i("ngx-decaf-model-builder",{label:"graph.node.agent.hitl.fields.resumeSchema.label",placeholder:"graph.node.agent.hitl.fields.resumeSchema.placeholder"}),C("design:type",Object)],bp.prototype,"resumeSchema",void 0),k([$t({handle:"approved"}),C("design:type",Object)],bp.prototype,"approvedOut",void 0),k([$t({handle:"rejected"}),C("design:type",Object)],bp.prototype,"rejectedOut",void 0),bp=k([Mt("core.agent.hitl",{kind:"core.agent.hitl",category:"Agent",width:128,height:112,labels:["agent","ai","hitl","suspend"],metadata:{title:"graph.node.agent.hitl.name",description:"graph.node.agent.hitl.description",shape:"rectangle"}}),I()],bp);const wp=[bp];let vp=class extends Wi{execute(e){throw new Cr("Node kind 'core.agent.trigger.mcp' requires the mastra engine, which the local backend does not provide",dr,{kind:"core.agent.trigger.mcp",backend:"local"})}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.agent.mcp_trigger.fields.serverId.label",placeholder:"graph.node.agent.mcp_trigger.fields.serverId.placeholder",type:"text"}),Ut({handle:"serverId",userControlled:!0}),C("design:type",String)],vp.prototype,"serverId",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.mcp_trigger.fields.title.label",type:"text"}),Ut({handle:"title",userControlled:!0}),C("design:type",String)],vp.prototype,"title",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.mcp_trigger.fields.instructions.label",type:"textarea"}),Ut({handle:"instructions",userControlled:!0}),C("design:type",String)],vp.prototype,"instructions",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.mcp_trigger.fields.transport.label",type:"select"}),Ut({handle:"transport",userControlled:!0}),C("design:type",String)],vp.prototype,"transport",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.mcp_trigger.fields.authMode.label",type:"select"}),Ut({handle:"authMode",userControlled:!0}),C("design:type",String)],vp.prototype,"authMode",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.mcp_trigger.fields.authCredentialRef.label",type:"object"}),Ut({handle:"authCredentialRef",userControlled:!0,type:"object"}),C("design:type",Object)],vp.prototype,"authCredentialRef",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.mcp_trigger.fields.pendingCap.label",type:"number"}),Ut({handle:"pendingCap",userControlled:!0}),C("design:type",Number)],vp.prototype,"pendingCap",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.mcp_trigger.fields.pendingTimeoutMs.label",type:"number"}),Ut({handle:"pendingTimeoutMs",userControlled:!0}),C("design:type",Number)],vp.prototype,"pendingTimeoutMs",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],vp.prototype,"resource",void 0),vp=k([Mt("core.agent.trigger.mcp",{kind:"core.agent.trigger.mcp",category:"Agent",width:128,height:112,labels:["agent","ai","trigger","mcp","server"],metadata:{title:"graph.node.agent.mcp_trigger.name",description:"graph.node.agent.mcp_trigger.description",shape:"rectangle"}}),I()],vp);const xp=[vp];let Ip=class extends Wi{execute(e){throw new Cr("Node kind 'core.agent.trigger.slack' requires the mastra engine, which the local backend does not provide",dr,{kind:"core.agent.trigger.slack",backend:"local"})}};k([w(),$t({handle:"message"}),C("design:type",Object)],Ip.prototype,"message",void 0),k([w(),$t({handle:"sessionId"}),C("design:type",Object)],Ip.prototype,"sessionId",void 0),k([w(),$t({handle:"userId"}),C("design:type",Object)],Ip.prototype,"userId",void 0),k([w(),$t({handle:"threadId"}),C("design:type",Object)],Ip.prototype,"threadId",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Ip.prototype,"resource",void 0),Ip=k([Mt("core.agent.trigger.slack",{kind:"core.agent.trigger.slack",category:"Agent",icon:"ti-brand-slack",width:96,height:96,labels:["agent","ai","trigger","channel","slack"],metadata:{title:"graph.node.agent.slack_trigger.name",description:"graph.node.agent.slack_trigger.description"}}),I()],Ip);const _p=[Ip];let Ep=class extends Wi{execute(e){throw new Cr("Node kind 'core.agent.trigger.discord' requires the mastra engine, which the local backend does not provide",dr,{kind:"core.agent.trigger.discord",backend:"local"})}};k([w(),$t({handle:"message"}),C("design:type",Object)],Ep.prototype,"message",void 0),k([w(),$t({handle:"sessionId"}),C("design:type",Object)],Ep.prototype,"sessionId",void 0),k([w(),$t({handle:"userId"}),C("design:type",Object)],Ep.prototype,"userId",void 0),k([w(),$t({handle:"threadId"}),C("design:type",Object)],Ep.prototype,"threadId",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Ep.prototype,"resource",void 0),Ep=k([Mt("core.agent.trigger.discord",{kind:"core.agent.trigger.discord",category:"Agent",icon:"ti-brand-discord",width:96,height:96,labels:["agent","ai","trigger","channel","discord"],metadata:{title:"graph.node.agent.discord_trigger.name",description:"graph.node.agent.discord_trigger.description"}}),I()],Ep);const Ap=[Ep];let Sp=class extends Wi{execute(e){throw new Cr("Node kind 'core.agent.trigger.telegram' requires the mastra engine, which the local backend does not provide",dr,{kind:"core.agent.trigger.telegram",backend:"local"})}};k([w(),$t({handle:"message"}),C("design:type",Object)],Sp.prototype,"message",void 0),k([w(),$t({handle:"sessionId"}),C("design:type",Object)],Sp.prototype,"sessionId",void 0),k([w(),$t({handle:"userId"}),C("design:type",Object)],Sp.prototype,"userId",void 0),k([w(),$t({handle:"threadId"}),C("design:type",Object)],Sp.prototype,"threadId",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Sp.prototype,"resource",void 0),Sp=k([Mt("core.agent.trigger.telegram",{kind:"core.agent.trigger.telegram",category:"Agent",icon:"ti-brand-telegram",width:96,height:96,labels:["agent","ai","trigger","channel","telegram"],metadata:{title:"graph.node.agent.telegram_trigger.name",description:"graph.node.agent.telegram_trigger.description"}}),I()],Sp);const Rp=[Sp];let Op=class extends Wi{execute(e){throw new Cr("Node kind 'core.agent.trigger.teams' requires the mastra engine, which the local backend does not provide",dr,{kind:"core.agent.trigger.teams",backend:"local"})}};k([w(),$t({handle:"message"}),C("design:type",Object)],Op.prototype,"message",void 0),k([w(),$t({handle:"sessionId"}),C("design:type",Object)],Op.prototype,"sessionId",void 0),k([w(),$t({handle:"userId"}),C("design:type",Object)],Op.prototype,"userId",void 0),k([w(),$t({handle:"threadId"}),C("design:type",Object)],Op.prototype,"threadId",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Op.prototype,"resource",void 0),Op=k([Mt("core.agent.trigger.teams",{kind:"core.agent.trigger.teams",category:"Agent",icon:"ti-brand-teams",width:96,height:96,labels:["agent","ai","trigger","channel","teams"],metadata:{title:"graph.node.agent.teams_trigger.name",description:"graph.node.agent.teams_trigger.description"}}),I()],Op);const kp=[Op];let Cp=class extends Wi{execute(e){throw new Cr("Node kind 'core.agent.response.slack' requires the mastra engine, which the local backend does not provide",dr,{kind:"core.agent.response.slack",backend:"local"})}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.agent.slack_response.fields.response.label",type:"textarea"}),Ut({handle:"response"}),C("design:type",Object)],Cp.prototype,"response",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.slack_response.fields.threadId.label",type:"text"}),Ut({handle:"threadId",userControlled:!0}),C("design:type",String)],Cp.prototype,"threadId",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Cp.prototype,"resource",void 0),Cp=k([Mt("core.agent.response.slack",{kind:"core.agent.response.slack",category:"Agent",icon:"ti-brand-slack",width:96,height:96,labels:["agent","ai","response","channel","slack"],metadata:{title:"graph.node.agent.slack_response.name",description:"graph.node.agent.slack_response.description"}}),I()],Cp);const Np=[Cp];let Tp=class extends Wi{execute(e){throw new Cr("Node kind 'core.agent.response.discord' requires the mastra engine, which the local backend does not provide",dr,{kind:"core.agent.response.discord",backend:"local"})}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.agent.discord_response.fields.response.label",type:"textarea"}),Ut({handle:"response"}),C("design:type",Object)],Tp.prototype,"response",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.discord_response.fields.threadId.label",type:"text"}),Ut({handle:"threadId",userControlled:!0}),C("design:type",String)],Tp.prototype,"threadId",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Tp.prototype,"resource",void 0),Tp=k([Mt("core.agent.response.discord",{kind:"core.agent.response.discord",category:"Agent",icon:"ti-brand-discord",width:96,height:96,labels:["agent","ai","response","channel","discord"],metadata:{title:"graph.node.agent.discord_response.name",description:"graph.node.agent.discord_response.description"}}),I()],Tp);const Pp=[Tp];let Dp=class extends Wi{execute(e){throw new Cr("Node kind 'core.agent.response.telegram' requires the mastra engine, which the local backend does not provide",dr,{kind:"core.agent.response.telegram",backend:"local"})}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.agent.telegram_response.fields.response.label",type:"textarea"}),Ut({handle:"response"}),C("design:type",Object)],Dp.prototype,"response",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.telegram_response.fields.threadId.label",type:"text"}),Ut({handle:"threadId",userControlled:!0}),C("design:type",String)],Dp.prototype,"threadId",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Dp.prototype,"resource",void 0),Dp=k([Mt("core.agent.response.telegram",{kind:"core.agent.response.telegram",category:"Agent",icon:"ti-brand-telegram",width:96,height:96,labels:["agent","ai","response","channel","telegram"],metadata:{title:"graph.node.agent.telegram_response.name",description:"graph.node.agent.telegram_response.description"}}),I()],Dp);const jp=[Dp];let Lp=class extends Wi{execute(e){throw new Cr("Node kind 'core.agent.response.teams' requires the mastra engine, which the local backend does not provide",dr,{kind:"core.agent.response.teams",backend:"local"})}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.agent.teams_response.fields.response.label",type:"textarea"}),Ut({handle:"response"}),C("design:type",Object)],Lp.prototype,"response",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.teams_response.fields.threadId.label",type:"text"}),Ut({handle:"threadId",userControlled:!0}),C("design:type",String)],Lp.prototype,"threadId",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Lp.prototype,"resource",void 0),Lp=k([Mt("core.agent.response.teams",{kind:"core.agent.response.teams",category:"Agent",icon:"ti-brand-teams",width:96,height:96,labels:["agent","ai","response","channel","teams"],metadata:{title:"graph.node.agent.teams_response.name",description:"graph.node.agent.teams_response.description"}}),I()],Lp);const Mp=[Lp];let Gp=class extends Wi{execute(e){throw new Cr("Node kind 'core.agent.voice' requires the mastra engine, which the local backend does not provide",dr,{kind:"core.agent.voice",backend:"local"})}};k([i("ngx-decaf-crud-field",{label:"graph.node.agent.voice.fields.speaker.label",type:"text"}),Ut({handle:"speaker",userControlled:!0}),C("design:type",String)],Gp.prototype,"speaker",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.voice.fields.speechModel.label",type:"object"}),Ut({handle:"speechModel",userControlled:!0,type:"object"}),C("design:type",Object)],Gp.prototype,"speechModel",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.agent.voice.fields.listeningModel.label",type:"object"}),Ut({handle:"listeningModel",userControlled:!0,type:"object"}),C("design:type",Object)],Gp.prototype,"listeningModel",void 0),k([w(),$t({handle:"resource"}),C("design:type",Object)],Gp.prototype,"resource",void 0),Gp=k([Mt("core.agent.voice",{kind:"core.agent.voice",category:"Agent",icon:"ti-volume-2",shape:"rounded",width:96,height:96,labels:["agent","ai","voice","speech"],metadata:{title:"graph.node.agent.voice.name",description:"graph.node.agent.voice.description"}}),I()],Gp);const Up=[Gp];function $p(e,t,o,r){const n=t??o;if(null==e)return Math.min(o,n);const i=Number(e);if(!Number.isFinite(i)||0>=i)throw new Tr(r+" loop maxIterations must be a positive finite number");return Math.min(Math.floor(i),n)}function Fp(e,t,o){const r=t.node.loop,n=t.metadata?.loop;if(!r?.body&&!n?.body)throw new Tr(o+" node is missing loop configuration (instance.loop.body)");const i=t=>{const o=e[t]??r?.[t]??n?.[t],i=Number(o);return void 0!==o&&Number.isFinite(i)?i:void 0},a=t=>{const o=e[t]??n?.[t];return"string"==typeof o?o:void 0};return{body:r?.body??n?.body,maxIterations:i("maxIterations"),timeoutMs:i("timeoutMs"),concurrency:i("concurrency"),condition:e.condition??n?.condition,inputPort:a("inputPort"),outputPort:a("outputPort"),itemPort:a("itemPort"),resultPort:a("resultPort"),statePort:a("statePort"),slice:i("slice")}}let Hp=class extends Wi{async execute(e,t){const o=Fp(this,t,"foreach"),r=e.inputs,n=r.items,i=$p(o.maxIterations,t.limits?.maxForeachIterations,1e3,"foreach");if(!Array.isArray(n))throw new Tr("foreach input 'items' must be an array");const a=t.engine;if(!a)throw new Cr("foreach node requires engine access","GRAPH_ENGINE_NOT_AVAILABLE");const s=Number(r.slice??o.slice??1),d=Number.isFinite(s)&&s>0?Math.floor(s):1,l=d>1?Math.ceil(n.length/d):n.length;if(l>i)throw new Pr(`foreach exceeded max iterations (${l} > ${i})`);const c=o.itemPort??"item",p=o.resultPort??"result",u=o.statePort??"state",g=o.body,h=[];let f=r.state,y=!1;await t.emit({type:yt.LOOP_STARTED});for(let e=0;l>e;e++){await t.emit({type:yt.LOOP_ITERATION_STARTED,iteration:e});const o=d>1?n.slice(e*d,e*d+d):n[e],r={[c]:o,index:e};d>1&&(r.slice=o),void 0!==f&&(r[u]=f);try{const n=await a.execute(g,r,{parentRunId:t.runId,path:[...t.path,"iteration:"+e],metadata:{item:o,index:e,slice:d},auth:t.auth},t);h.push(n.outputs[p]),void 0!==n.outputs[u]&&(f=n.outputs[u])}catch(o){if(o instanceof Gr){const r=o.details?.value;void 0!==r&&h.push(r),y=!0,await t.emit({type:yt.LOOP_ITERATION_COMPLETED,iteration:e,metadata:{broken:!0}});break}throw o}await t.emit({type:yt.LOOP_ITERATION_COMPLETED,iteration:e})}await t.emit({type:yt.LOOP_COMPLETED,metadata:{broken:y}});const m={results:h,completed:h,iterations:h.length,broken:y};return void 0!==f&&(m[u]=f),m}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.items.label",placeholder:"graph.node.loop.foreach.fields.items.placeholder",type:"textarea"}),Ut({handle:"items"}),C("design:type",Array)],Hp.prototype,"items",void 0),k([w(),i("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.slice.label",placeholder:"graph.node.loop.foreach.fields.slice.placeholder",type:"number"}),Ut({handle:"slice"}),C("design:type",Number)],Hp.prototype,"slice",void 0),k([w(),$t({handle:"item"}),C("design:type",Object)],Hp.prototype,"item",void 0),k([w(),Ft({handle:"loop",connectionRules:{allowSelf:!0,maxConnections:1}}),C("design:type",Object)],Hp.prototype,"loop",void 0),k([w(),$t({handle:"completed"}),C("design:type",Array)],Hp.prototype,"completed",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.maxIterations.label",type:"number"}),Ut({handle:"maxIterations",userControlled:!0}),C("design:type",Number)],Hp.prototype,"maxIterations",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.condition.label",type:"code"}),Ut({handle:"condition",userControlled:!0}),C("design:type",Object)],Hp.prototype,"condition",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.itemPort.label",type:"text"}),Ut({handle:"itemPort",userControlled:!0}),C("design:type",String)],Hp.prototype,"itemPort",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.resultPort.label",type:"text"}),Ut({handle:"resultPort",userControlled:!0}),C("design:type",String)],Hp.prototype,"resultPort",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.loop.foreach.fields.statePort.label",type:"text"}),Ut({handle:"statePort",userControlled:!0}),C("design:type",String)],Hp.prototype,"statePort",void 0),Hp=k([Mt("graph-foreach-loop-node",{kind:"core.loop.foreach",category:"Loop",color:"#eab308",icon:"ti-repeat",width:120,height:140,labels:["loop","iteration","foreach"],metadata:{title:"graph.node.loop.foreach.name",description:"graph.node.loop.foreach.description",loop:{maxIterations:100,itemPort:"item",resultPort:"result",slice:1}}}),I()],Hp);class Bp{constructor(){this.expressionEvaluator=new fn}evaluate(e,t){if(this.isConditionExpression(e))return this.expressionEvaluator.evaluate(e,t);const o=this.resolveValue(e.left,t),r=e.right;switch(e.type){case Or.TRUTHY:return!!o;case Or.FALSY:return!o;case Or.EQUALS:return o===r;case Or.NOT_EQUALS:return o!==r;case Or.GREATER_THAN:return Number(o)>Number(r);case Or.GREATER_THAN_OR_EQUAL:return Number(o)>=Number(r);case Or.LESS_THAN:return Number(r)>Number(o);case Or.LESS_THAN_OR_EQUAL:return Number(r)>=Number(o);case Or.EXISTS:return null!=o;case Or.CUSTOM:throw new Cr("Custom condition evaluators are not supported in v1","GRAPH_CUSTOM_CONDITION_UNSUPPORTED");default:throw new Cr(`Unknown condition type '${e.type}'`,"GRAPH_UNKNOWN_CONDITION_TYPE",{condition:e})}}async evaluateAsync(e,t,o,r){return yn(e)?bn(e,r,o):this.evaluate(e,t)}resolveValue(e,t){if(!e)return t;const o=e.split(".");let r=t;for(const e of o){if(null==r)return;r=r[e]}return r}isConditionExpression(e){return"string"==typeof e.op}}let qp=class extends Wi{async execute(e,t){const o=Fp(this,t,"until"),r=e.inputs,n=$p(o.maxIterations,t.limits?.maxLoopIterations,100,"until"),i=o.condition;if(!i)throw new Tr("until node is missing a condition");const a=o.statePort??"state",s=o.inputPort??a,d=o.outputPort??a,l=o.body,c=t.engine;if(!c)throw new Cr("until node requires engine access","GRAPH_ENGINE_NOT_AVAILABLE");let p=r.state,u=0;await t.emit({type:yt.LOOP_STARTED});let g=!1;do{if(u>=n)throw await t.emit({type:yt.LOOP_LIMIT_REACHED,iteration:u}),new Pr(`until loop exceeded max iterations (${n})`);await t.emit({type:yt.LOOP_ITERATION_STARTED,iteration:u}),p=(await c.execute(l,{[s]:p,iteration:u},{parentRunId:t.runId,path:[...t.path,"iteration:"+u],auth:t.auth},t)).outputs[d],await t.emit({type:yt.LOOP_ITERATION_COMPLETED,iteration:u});const e=await(new Bp).evaluateAsync(i,p,t,{...r,state:p});await t.emit({type:yt.LOOP_CONDITION_EVALUATED,iteration:u,payload:{result:e}}),u++,g=e}while(!g);return await t.emit({type:yt.LOOP_COMPLETED}),{state:p,iterations:u}}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.state.label",placeholder:"graph.node.loop.until.fields.state.placeholder",type:"textarea"}),Ut({handle:"state"}),C("design:type",Object)],qp.prototype,"state",void 0),k([w(),$t({handle:"state"}),C("design:type",Object)],qp.prototype,"stateOut",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.maxIterations.label",type:"number"}),Ut({handle:"maxIterations",userControlled:!0}),C("design:type",Number)],qp.prototype,"maxIterations",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.condition.label",type:"code"}),Ut({handle:"condition",userControlled:!0}),C("design:type",Object)],qp.prototype,"condition",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.statePort.label",type:"text"}),Ut({handle:"statePort",userControlled:!0}),C("design:type",String)],qp.prototype,"statePort",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.inputPort.label",type:"text"}),Ut({handle:"inputPort",userControlled:!0}),C("design:type",String)],qp.prototype,"inputPort",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.loop.until.fields.outputPort.label",type:"text"}),Ut({handle:"outputPort",userControlled:!0}),C("design:type",String)],qp.prototype,"outputPort",void 0),qp=k([Mt("graph-until-loop-node",{kind:"core.loop.until",category:"Loop",color:"#eab308",icon:"ti-player-stop",width:96,height:96,labels:["loop","conditional","until"],metadata:{title:"graph.node.loop.until.name",description:"graph.node.loop.until.description",loop:{maxIterations:50,statePort:"state",condition:{type:"greaterThanOrEqual",left:"iteration",right:2}}}}),I()],qp);let Wp=class extends Wi{async execute(e,t){const o=Fp(this,t,"while"),r=e.inputs,n=$p(o.maxIterations,t.limits?.maxLoopIterations,100,"while"),i=o.condition;if(!i)throw new Tr("while node is missing a condition");const a=o.statePort??"state",s=o.inputPort??a,d=o.outputPort??a,l=o.body,c=t.engine;if(!c)throw new Cr("while node requires engine access","GRAPH_ENGINE_NOT_AVAILABLE");let p=r.state,u=0;for(await t.emit({type:yt.LOOP_STARTED});await(new Bp).evaluateAsync(i,p,t,{...r,state:p});){if(u>=n)throw await t.emit({type:yt.LOOP_LIMIT_REACHED,iteration:u}),new Pr(`while loop exceeded max iterations (${n})`);await t.emit({type:yt.LOOP_CONDITION_EVALUATED,iteration:u,payload:{result:!0}}),await t.emit({type:yt.LOOP_ITERATION_STARTED,iteration:u}),p=(await c.execute(l,{[s]:p,iteration:u},{parentRunId:t.runId,path:[...t.path,"iteration:"+u],auth:t.auth},t)).outputs[d],await t.emit({type:yt.LOOP_ITERATION_COMPLETED,iteration:u}),u++}return await t.emit({type:yt.LOOP_COMPLETED}),{state:p,iterations:u}}};k([w(),i("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.state.label",placeholder:"graph.node.loop.while.fields.state.placeholder",type:"textarea"}),Ut({handle:"state"}),C("design:type",Object)],Wp.prototype,"state",void 0),k([w(),$t({handle:"state"}),C("design:type",Object)],Wp.prototype,"stateOut",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.maxIterations.label",type:"number"}),Ut({handle:"maxIterations",userControlled:!0}),C("design:type",Number)],Wp.prototype,"maxIterations",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.condition.label",type:"code"}),Ut({handle:"condition",userControlled:!0}),C("design:type",Object)],Wp.prototype,"condition",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.statePort.label",type:"text"}),Ut({handle:"statePort",userControlled:!0}),C("design:type",String)],Wp.prototype,"statePort",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.inputPort.label",type:"text"}),Ut({handle:"inputPort",userControlled:!0}),C("design:type",String)],Wp.prototype,"inputPort",void 0),k([i("ngx-decaf-crud-field",{label:"graph.node.loop.while.fields.outputPort.label",type:"text"}),Ut({handle:"outputPort",userControlled:!0}),C("design:type",String)],Wp.prototype,"outputPort",void 0),Wp=k([Mt("graph-while-loop-node",{kind:"core.loop.while",category:"Loop",color:"#eab308",icon:"ti-arrows-loop",width:96,height:96,labels:["loop","conditional","while"],metadata:{title:"graph.node.loop.while.name",description:"graph.node.loop.while.description",loop:{maxIterations:50,statePort:"state",condition:{type:"lessThan",left:"iteration",right:3}}}}),I()],Wp);let Kp=class extends Wi{execute(e){const t=e.inputs;return{value:t?.value??null}}};k([$t({handle:"value",connectionRules:{allowMultiple:!0}}),C("design:type",Object)],Kp.prototype,"value",void 0),Kp=k([Mt("graph-input-value-node",{kind:"value",category:"Boundary",color:"#0f766e",icon:"ti-circle-plus",labels:["workflow","input","value"],metadata:{title:"graph.node.boundary.input.name",description:"graph.node.boundary.input.description"}}),I()],Kp);let Vp=class extends Wi{execute(e){return{}}};function zp(e,t,o,r={}){return{id:e,label:t,direction:o,...r}}function Qp(e){const t=e,o=Rt(t),r=o?.metadata?.title;return Xo(t,r?{name:r}:{})}function Jp(e,t){const o=e,r=Rt(o),n=r?.metadata?.title;return Xo(o,{...n?{name:n}:{},icon:{type:"catalogue",name:t}})}function Xp(e,t,o){const r={type:"credential",id:"credentialRef",label:o,required:!1,credentialType:t};return{...e,parameters:[...e.parameters,r],credentials:[...(e.credentials??[]).filter(e=>e.type!==t),{type:t,required:!1}]}}k([w(),Ut({handle:"value"}),C("design:type",Object)],Vp.prototype,"value",void 0),Vp=k([Mt("graph-output-value-node",{kind:"result",category:"Boundary",color:"#0f766e",icon:"ti-circle-minus",width:96,height:96,labels:["workflow","output","value"],metadata:{title:"graph.node.boundary.output.name",description:"graph.node.boundary.output.description"}}),I()],Vp);const Yp={kind:"core.loop.foreach",capabilities:["loop"],display:{name:"graph.node.loop.foreach.name",description:"graph.node.loop.foreach.description",category:"Loop",color:"#eab308",icon:{type:"catalogue",name:"ti-repeat"},width:120,height:140,labels:["loop","iteration","foreach"]},inputs:[zp("items","graph.node.loop.foreach.ports.input.items.label","input",{required:!0,schema:{type:"array",items:{type:"any"}}}),zp("slice","graph.node.loop.foreach.ports.input.slice.label","input",{schema:{type:"number",integer:!0,min:1}}),zp("state","graph.node.loop.foreach.ports.input.state.label","input",{schema:{type:"any"}})],outputs:[zp("results","graph.node.loop.foreach.ports.output.results.label","output",{schema:{type:"array",items:{type:"any"}}}),zp("completed","graph.node.loop.foreach.ports.output.completed.label","output",{schema:{type:"array",items:{type:"any"}}}),zp("iterations","graph.node.loop.foreach.ports.output.iterations.label","output",{schema:{type:"number",integer:!0,min:0}}),zp("broken","graph.node.loop.foreach.ports.output.broken.label","output",{schema:{type:"boolean"}}),zp("state","graph.node.loop.foreach.ports.output.state.label","output",{schema:{type:"any"}})],parameters:[{type:"number",id:"maxIterations",label:"graph.node.loop.foreach.fields.maxIterations.label",integer:!0,min:1},{type:"object",id:"condition",label:"graph.node.loop.foreach.fields.condition.label"},{type:"string",id:"itemPort",label:"graph.node.loop.foreach.fields.itemPort.label"},{type:"string",id:"resultPort",label:"graph.node.loop.foreach.fields.resultPort.label"},{type:"string",id:"statePort",label:"graph.node.loop.foreach.fields.statePort.label"},{type:"number",id:"slice",label:"graph.node.loop.foreach.fields.slice.label",integer:!0,min:1}]},Zp={kind:"core.loop.while",capabilities:["loop"],display:{name:"graph.node.loop.while.name",description:"graph.node.loop.while.description",category:"Loop",color:"#eab308",icon:{type:"catalogue",name:"ti-arrows-loop"},width:120,height:140,labels:["loop","conditional","while"]},inputs:[zp("state","graph.node.loop.while.ports.input.state.label","input",{schema:{type:"any"}})],outputs:[zp("state","graph.node.loop.while.ports.output.state.label","output",{schema:{type:"any"}}),zp("iterations","graph.node.loop.while.ports.output.iterations.label","output",{schema:{type:"number",integer:!0,min:0}})],parameters:[{type:"number",id:"maxIterations",label:"graph.node.loop.while.fields.maxIterations.label",integer:!0,min:1},{type:"object",id:"condition",label:"graph.node.loop.while.fields.condition.label",required:!0},{type:"string",id:"statePort",label:"graph.node.loop.while.fields.statePort.label"},{type:"string",id:"inputPort",label:"graph.node.loop.while.fields.inputPort.label"},{type:"string",id:"outputPort",label:"graph.node.loop.while.fields.outputPort.label"}]},eu={kind:"core.loop.until",capabilities:["loop"],display:{name:"graph.node.loop.until.name",description:"graph.node.loop.until.description",category:"Loop",color:"#eab308",icon:{type:"catalogue",name:"ti-player-stop"},width:120,height:140,labels:["loop","conditional","until"]},inputs:[zp("state","graph.node.loop.until.ports.input.state.label","input",{schema:{type:"any"}})],outputs:[zp("state","graph.node.loop.until.ports.output.state.label","output",{schema:{type:"any"}}),zp("iterations","graph.node.loop.until.ports.output.iterations.label","output",{schema:{type:"number",integer:!0,min:0}})],parameters:[{type:"number",id:"maxIterations",label:"graph.node.loop.until.fields.maxIterations.label",integer:!0,min:1},{type:"object",id:"condition",label:"graph.node.loop.until.fields.condition.label",required:!0},{type:"string",id:"statePort",label:"graph.node.loop.until.fields.statePort.label"},{type:"string",id:"inputPort",label:"graph.node.loop.until.fields.inputPort.label"},{type:"string",id:"outputPort",label:"graph.node.loop.until.fields.outputPort.label"}]},tu=[Qp(Kp),Qp(Vp),Qp(Ea),Qp(Aa),Qp(Ra),Qp(Oa),Qp(Ca),Qp(Ta),Qp(Pa),Qp(Da),Qp(ja),Qp(rs),Qp(ns),Qp(ds),Qp(ls),Qp(cs),Qp(us),Qp(hs),Qp(ys),Qp(Is),Xp(Qp(Ls),"postgres","graph.node.storage.common.fields.credentialRef.label"),Xp(Qp(Ms),"mysql","graph.node.storage.common.fields.credentialRef.label"),Xp(Qp(Gs),"mssql","graph.node.storage.common.fields.credentialRef.label"),Xp(Qp(Hs),"redis","graph.node.storage.common.fields.credentialRef.label"),Xp(Qp(qs),"rabbitmq","graph.node.storage.common.fields.credentialRef.label"),Xp(Qp(zs),"s3","graph.node.storage.common.fields.credentialRef.label"),Xp(Qp(Qs),"s3","graph.node.storage.common.fields.credentialRef.label"),Xp(Qp(Js),"gcs","graph.node.storage.common.fields.credentialRef.label"),Xp(Qp(Ys),"azure-blob","graph.node.storage.common.fields.credentialRef.label"),Xp(Qp(El),"crypto","graph.node.devops.common.fields.credentialRef.label"),Xp(Qp(Sl),"jwt","graph.node.devops.common.fields.credentialRef.label"),(()=>{const e=Qp(Ol);return{...e,metadata:{...e.metadata??{},danger:!0,requiresOptIn:!0,dangerReason:"Executes arbitrary shell commands with the host process privileges; expose only behind an explicit operator opt-in."}}})(),Xp(Qp(Nl),"sftp","graph.node.devops.common.fields.credentialRef.label"),Xp(Qp(wl),"github","graph.node.devops.common.fields.credentialRef.label"),Xp(Qp(xl),"gitlab","graph.node.devops.common.fields.credentialRef.label"),Xp(Qp(ed),"slack","graph.node.comms.common.fields.credentialRef.label"),Xp(Qp(od),"telegram","graph.node.comms.common.fields.credentialRef.label"),Xp(Qp(nd),"teams","graph.node.comms.common.fields.credentialRef.label"),Xp(Qp(ad),"gmail","graph.node.comms.common.fields.credentialRef.label"),Xp(Qp(dd),"email","graph.node.comms.common.fields.credentialRef.label"),Xp(Qp(pd),"discord","graph.node.comms.common.fields.credentialRef.label"),Xp(Qp(hd),"whatsapp","graph.node.comms.common.fields.credentialRef.label"),Xp(Qp(md),"microsoft-outlook","graph.node.comms.common.fields.credentialRef.label"),Xp(Qp(wd),"google-sheets","graph.node.io.common.fields.credentialRef.label"),Xp(Qp(xd),"airtable","graph.node.io.common.fields.credentialRef.label"),Xp(Qp(Ad),"graphql","graph.node.io.common.fields.credentialRef.label"),Xp(Qp(Od),"microsoft-excel","graph.node.io.common.fields.credentialRef.label"),Xp(Qp(Cd),"confluence","graph.node.io.common.fields.credentialRef.label"),Xp(Qp(Pd),"jira","graph.node.io.common.fields.credentialRef.label"),Xp(Qp(Ld),"google-docs","graph.node.io.common.fields.credentialRef.label"),Xp(Qp(Gd),"microsoft-sharepoint","graph.node.io.common.fields.credentialRef.label"),Xp(Qp(Fd),"google-calendar","graph.node.io.common.fields.credentialRef.label"),Qp(_d),Qp(dl),Qp(ll),Qp(cl),Qp(pl),Qp(hl),Qp(fl),Qp(yl),Qp(ml),Qp(_s),Qp(Tl),Qp(Pl),Qp($l),Qp(Bl),Xp(Qp(Jl),"rabbitmq","graph.node.storage.common.fields.credentialRef.label"),Xp(Qp(Xl),"redis","graph.node.storage.common.fields.credentialRef.label"),Xp(Qp(Yl),"token","graph.node.storage.common.fields.credentialRef.label"),Xp(Qp(ec),"postgres","graph.node.storage.common.fields.credentialRef.label"),Qp(Ml),Qp(Ul),Qp(Gl),Qp(jl),Qp(Ll),Qp(Dl),(ou=Qp(Ji),{...ou,dynamicPorts:[{type:"togglePort",parameter:"else",equals:!0,port:{id:"else",label:"graph.node.flow_control.if.ports.output.else.label",direction:"output",schema:{type:"any"}}}]}),(e=>({...e,outputs:[],parameters:[...e.parameters,{type:"collection",id:"cases",label:"graph.node.flow_control.switch.fields.cases.label",required:!0,itemIdPath:"outputPort",itemLabelPath:"label"},{type:"boolean",id:"hasDefault",label:"graph.node.flow_control.switch.fields.hasDefault.label",defaultValue:!1},{type:"object",id:"switch",label:"graph.node.flow_control.switch.fields.switch.label",required:!1}],dynamicPorts:[{type:"repeatFromParameter",parameter:"cases",itemIdPath:"outputPort",itemLabelPath:"label",direction:"output",portIdTemplate:"${id}",defaultPort:{id:"case",label:"graph.node.flow_control.switch.ports.output.case.label",direction:"output",schema:{type:"any"}}},{type:"togglePort",parameter:"hasDefault",equals:!0,port:{id:"default",label:"graph.node.flow_control.switch.ports.output.default.label",direction:"output",schema:{type:"any"}}}]}))(Qp(Xi)),Qp(da),Qp(aa),Qp(zi),Qp(Qi),Qp(ia),Qp(sa),Qp(la),Qp(Ki),Qp(rc),Qp(ic),Qp(sc),Qp(lc),Qp(pc),Qp(gc),Qp(fc),Qp(mc),Qp(vc),Qp(Ic),Qp(Ec),Qp(Nc),Qp(Tc),Qp(Dc),Qp(Lc),Qp(Gc),Qp(Kc),Qp(zc),Qp(Jc),Qp(Yc),Qp(ep),Qp(rp),Qp(ip),Qp(sp),Qp(up),Qp(hp),Qp(yp),Qp(bp),Qp(vp),Jp(Ip,"ti-brand-slack"),Jp(Ep,"ti-brand-discord"),Jp(Sp,"ti-brand-telegram"),Jp(Op,"ti-brand-teams"),Jp(Cp,"ti-brand-slack"),Jp(Tp,"ti-brand-discord"),Jp(Dp,"ti-brand-telegram"),Jp(Lp,"ti-brand-teams"),Jp(Gp,"ti-volume-2"),Yp,Zp,eu];var ou;const ru=Object.fromEntries(tu.map(e=>[e.kind,e])),nu=[Ml,Ul,Gl,jl,Ll,Dl],iu=[Ji,Xi,aa,zi,Qi,sa,Ki],au=[ia,da,la],su=[Hp,Wp,qp],du=[Kp,Vp],lu=[ic,sc,lc,pc,gc,fc,mc,vc,Ic,Ec],cu=[Nc,Tc],pu=[Dc,Lc,Gc,Kc,zc,Jc,Yc,ep,rp,ip,sp],uu=[up,hp,yp],gu=[bp,vp],hu=[Ip,Ep,Sp,Op,Cp,Tp,Dp,Lp,Gp],fu=[Pa,Ca,Ra,ja,Ea,Aa,Oa,Da,Ta,rs,ns,ds,ls,cs],yu=[hs,_s,us,ys,Is,dl,ll,cl,pl,hl,fl,yl,ml],mu={value:Kp,result:Vp,"core.trigger.manual":Ml,"core.trigger.webhook":Ul,"core.trigger.schedule":Gl,"core.trigger.event":jl,"core.trigger.form":Ll,"core.trigger.chat":Dl,"core.flow.if":Ji,"core.flow.switch":Xi,"core.utility.map":da,"core.flow.delay":aa,"core.flow.errorBoundary":zi,"core.flow.humanApproval":Qi,"core.utility.code":ia,"core.flow.log":sa,"core.utility.log":la,"core.flow.break":Ki,"core.agent":rc,"core.agent.tool":ic,"core.agent.toolSelector":sc,"core.agent.hook":lc,"core.agent.toolDeny":pc,"core.agent.delegationHook":gc,"core.agent.skill":fc,"core.agent.skillSelector":mc,"core.agent.sandbox":vc,"core.agent.scorer":Ic,"core.agent.scorerSelector":Ec,"core.agent.memory":Nc,"core.agent.memorySelector":Tc,"core.agent.embedding":Dc,"core.agent.vectorStore":Lc,"core.agent.retriever":Gc,"core.agent.chunking":Kc,"core.agent.rerank":zc,"core.agent.chain.qa":Jc,"core.agent.chain.basic":Yc,"core.agent.chain.summarization":ep,"core.agent.structuredOutputParser":rp,"core.agent.informationExtractor":ip,"core.agent.langchainCode":sp,"core.agent.inputProcessor":up,"core.agent.outputProcessor":hp,"core.agent.guardrail":yp,"core.agent.hitl":bp,"core.agent.trigger.mcp":vp,"core.agent.trigger.slack":Ip,"core.agent.trigger.discord":Ep,"core.agent.trigger.telegram":Sp,"core.agent.trigger.teams":Op,"core.agent.response.slack":Cp,"core.agent.response.discord":Tp,"core.agent.response.telegram":Dp,"core.agent.response.teams":Lp,"core.agent.voice":Gp,"core.data.set":Pa,"core.data.merge":Ca,"core.data.filter":Ra,"core.data.splitOut":ja,"core.data.aggregate":rs,"core.data.itemLists":ns,"core.data.compareDatasets":ds,"core.data.summarize":ls,"core.data.removeDuplicates":cs,"core.data.dateTime":Ea,"core.data.dataTable":Aa,"core.data.limit":Oa,"core.data.sort":Da,"core.data.renameKeys":Ta,"core.io.httpRequest":hs,"core.io.respondToWebhook":_s,"core.io.extractFromFile":us,"core.io.readPDF":ys,"core.io.readWriteFile":Is,"core.storage.postgres":Ls,"core.storage.mySql":Ms,"core.storage.microsoftSql":Gs,"core.storage.redis":Hs,"core.storage.rabbitmq":qs,"core.storage.s3":zs,"core.storage.awsS3":Qs,"core.storage.googleCloudStorage":Js,"core.storage.azureStorage":Ys,"core.devops.crypto":El,"core.devops.jwt":Sl,"core.devops.executeCommand":Ol,"core.devops.ftp":Nl,"core.devops.github":wl,"core.devops.gitlab":xl,"core.comms.slack":ed,"core.comms.telegram":od,"core.comms.teams":nd,"core.comms.gmail":ad,"core.comms.emailSend":dd,"core.comms.discord":pd,"core.comms.whatsApp":hd,"core.comms.microsoftOutlook":md,"core.io.googleSheets":wd,"core.io.airtable":xd,"core.io.spreadsheetFile":_d,"core.io.graphql":Ad,"core.io.microsoftExcel":Od,"core.io.confluence":Cd,"core.io.jira":Pd,"core.io.googleDocs":Ld,"core.io.microsoftSharePoint":Gd,"core.io.googleCalendar":Fd,"core.io.convertToFile":dl,"core.io.html":ll,"core.io.htmlExtract":cl,"core.io.markdown":pl,"core.io.xml":hl,"core.io.readBinaryFile":fl,"core.io.readBinaryFiles":yl,"core.io.writeBinaryFile":ml,"core.flow.executeSubWorkflow":Tl,"core.trigger.executeWorkflow":Pl,"core.trigger.error":$l,"core.trigger.workflow":Bl,"core.trigger.rabbitmq":Jl,"core.trigger.redis":Xl,"core.trigger.sse":Yl,"core.trigger.postgres":ec,"core.loop.foreach":Hp,"core.loop.while":Wp,"core.loop.until":qp};function bu(e){return{execute:(t,o)=>e.instantiate({...qi(o.node),...t.parameters,...o.node.state??{}}).execute(t,o)}}function wu(){const e=[];for(const[t,o]of Object.entries(ru)){const r=mu[t];r&&e.push(Hi({manifest:o,executor:bu(r)}))}return e}function vu(e,...t){for(const o of wu())e.register(o,{},...t);return e}class xu{resolve(e){const t=this.createValidator(e);return{name:e.name,required:e.required,validate:t}}resolveAll(e){const t={};for(const o of e)t[o.name]=this.resolve(o);return t}createValidator(e){switch((e.type??e.designType??"").toLowerCase()){case"string":return e=>"string"==typeof e;case"number":return e=>"number"==typeof e;case"boolean":return e=>"boolean"==typeof e;case"date":return e=>e instanceof Date||"string"==typeof e&&!isNaN(Date.parse(e));case"array":return e=>Array.isArray(e);case"bigint":return e=>"bigint"==typeof e;default:return()=>!0}}}class Iu{constructor(e){this.resolver=e}validateWorkflowInputs(e,t){this.validatePorts(e.inputs,t,"workflow input")}validateWorkflowOutputs(e,t){this.validatePorts(e.outputs,t,"workflow output")}validateNodeInputs(e,t){const o=(e.ports??[]).filter(e=>"input"===e.direction);this.validatePorts(o,t,`node '${e.name}' input`)}validateNodeOutputs(e,t){const o=(e.ports??[]).filter(e=>"output"===e.direction);this.validatePorts(o,t,`node '${e.name}' output`)}validatePorts(e,t,o){if(e)for(const r of e){const e=Object.prototype.hasOwnProperty.call(t,r.name);if(r.required&&!e)throw new Tr(`Missing required ${o} port '${r.name}'`);if(e&&!this.resolver.resolve(r).validate(t[r.name]))throw new Tr(`Invalid value for ${o} port '${r.name}'`)}}}const _u=["node","definition","executor","execute","ports","component"];function Eu(e,t,o,r){return{code:e,path:t,message:o,...void 0!==r?.nodeId?{nodeId:r.nodeId}:{},...void 0!==r?.edgeId?{edgeId:r.edgeId}:{},...r?.details?{details:r.details}:{}}}function Au(e,t){const o=[];for(const r of Object.keys(e))_u.includes(r)&&o.push(Eu("document.forbidden-field",`${t}.${r}`,`Field '${r}' is not accepted in a canonical workflow document: node, definition, executor, execute, ports and component fields are rejected at the boundary`,{details:{field:r}}));return o}function Su(e,t){t.push(...Au(e,"$")),e.inputs.forEach((e,o)=>t.push(...Au(e,`inputs[${o}]`))),e.outputs.forEach((e,o)=>t.push(...Au(e,`outputs[${o}]`)));for(const o of e.nodes)t.push(...Au(o,`nodes[${o.id}]`)),o.loop&&(t.push(...Au(o.loop,`nodes[${o.id}].loop`)),Su(o.loop.body,t));for(const o of e.edges)t.push(...Au(o,`edges[${o.id}]`))}function Ru(e,t){const o=[];e.nodes.length>t.maxNodes&&o.push(Eu("document.limit.nodes","$.nodes",`Document declares ${e.nodes.length} nodes; at most ${t.maxNodes} are allowed`,{details:{count:e.nodes.length,limit:t.maxNodes}})),e.edges.length>t.maxEdges&&o.push(Eu("document.limit.edges","$.edges",`Document declares ${e.edges.length} edges; at most ${t.maxEdges} are allowed`,{details:{count:e.edges.length,limit:t.maxEdges}}));const r=Ou(e);r>t.maxNestingDepth&&o.push(Eu("document.limit.depth","$.nodes",`Document nests loop bodies ${r} levels deep; at most ${t.maxNestingDepth} levels are allowed`,{details:{depth:r,limit:t.maxNestingDepth}}));const n=Buffer.byteLength(JSON.stringify(e),"utf8");return n>t.maxDocumentBytes&&o.push(Eu("document.limit.size","$",`Document serializes to ${n} bytes; at most ${t.maxDocumentBytes} bytes are allowed`,{details:{bytes:n,limit:t.maxDocumentBytes}})),o}function Ou(e,t=0){let o=t;for(const r of e.nodes)r.loop?.body&&(o=Math.max(o,Ou(r.loop.body,t+1)));return o}async function ku(e,t,...o){const r=[];for(const n of e.nodes)t.has(n.kind,...o)||r.push(Eu("node.unknown-kind",`nodes[${n.id}].kind`,`Node '${n.id}' references kind '${n.kind}' which is not registered in the backend catalogue`,{nodeId:n.id,details:{kind:n.kind}})),n.loop?.body&&r.push(...await ku(n.loop.body,t,...o));return r}async function Cu(e,t={},...o){const r={...Yi,...t.limits},n=[];if(!_o(e))return n.push(Eu("document.shape","$","Payload is not a canonical GraphWorkflowDocument: id and name must be strings and inputs, outputs, nodes and edges must be arrays")),{valid:!1,issues:n};if(!Vt(e))return n.push(Eu("document.json-unsafe","$","Document contains JSON-unsafe values: functions, class instances, undefined, NaN/Infinity, symbol keys and unsafe prototype keys (__proto__/prototype/constructor) are rejected")),{valid:!1,issues:n};Su(e,n),n.push(...(e=>{const t=[],o=new Set;for(const r of[...e.inputs,...e.outputs])o.has(r.id)?t.push(Eu("document.duplicate-port-id",`ports[${r.id}]`,`Workflow port '${r.id}' is declared more than once; workflow port ids must be unique`)):o.add(r.id);const r=new Set;for(const o of e.nodes)r.has(o.id)?t.push(Eu("document.duplicate-node-id",`nodes[${o.id}]`,`Node '${o.id}' is declared more than once; node ids must be unique`,{nodeId:o.id})):r.add(o.id);const n=new Set;for(const o of e.edges)n.has(o.id)?t.push(Eu("document.duplicate-edge-id",`edges[${o.id}]`,`Edge '${o.id}' is declared more than once; edge ids must be unique`,{edgeId:o.id})):n.add(o.id);return t})(e)),n.push(...Ru(e,r)),Xn(e,n);try{go(e)}catch(e){const t=e instanceof S?e.message:e+"";n.push(Eu("document.structure","$",t))}return t.catalogue&&n.push(...await ku(e,t.catalogue,...o)),{valid:0===n.length,issues:n}}class Nu{constructor(e,t){this.iteration=e,this.metadata=t}}function Tu(e,t,o={}){const r=e?.owner??null;return!r||r===t||(null==t||""===t)&&!0===o.allowAnonymousAccess}function Pu(e,t){return(e?.owner??null)===(t??null)}function Du(e,t,o){if(!Pu(e,t))throw new M(`${o.resourceKind} '${o.resourceId}' is owned by another user`)}function ju(e,t,o){if(!Tu(e,t,o))throw new M(`${o.resourceKind} '${o.resourceId}' is owned by another user`)}function Lu(e){if(null===e||"object"!=typeof e)return JSON.stringify(e);if(Array.isArray(e))return`[${e.map(e=>Lu(e)).join(",")}]`;const t=e;return`{${Object.keys(t).filter(e=>void 0!==t[e]).sort().map(e=>`${JSON.stringify(e)}:${Lu(t[e])}`).join(",")}}`}function Mu(e){return ee("sha256").update(Lu(e)).digest("hex")}class Gu{constructor(e={}){this.events=new Map,this.listeners=new Map,this.limits={...mt,...e}}async append(e){let t=this.events.get(e.runId);t||(t=[],this.events.set(e.runId,t)),t.push(e),this.enforceRetention(t);for(const t of this.listeners.get(e.runId)??[])try{t(e)}catch{}}async listAfter(e,t){const o=this.events.get(e);return o?o.filter(e=>e.sequence>t):[]}subscribe(e,t){let o=this.listeners.get(e);return o||(o=new Set,this.listeners.set(e,o)),o.add(t),()=>{o.delete(t),0===o.size&&this.listeners.delete(e)}}release(e){this.events.delete(e),this.listeners.delete(e)}enforceRetention(e){const t=this.limits.maxEventsPerRun;for(;e.length>t;){const t=e.findIndex(e=>!wt(e.type));if(-1===t)break;e.splice(t,1)}}}function Uu(e){return new er({runId:e.runId,workflowId:e.workflowId,...e.ownerUser?{owner:e.ownerUser}:{},status:e.status,...e.documentFingerprint?{documentFingerprint:e.documentFingerprint}:{},...void 0!==e.result?{result:$u(e.result)}:{},...e.error?{error:$u(e.error)}:{},createdAt:new Date(e.createdAt),...e.startedAt?{startedAt:new Date(e.startedAt)}:{},...e.finishedAt?{finishedAt:new Date(e.finishedAt)}:{}})}function $u(e){if(null!=e)return JSON.parse(JSON.stringify(e))}class Fu{constructor(){this.runs=new Map}async saveRun(e){this.runs.set(e.runId,{...e})}async readRun(e){const t=this.runs.get(e);return t?{...t}:null}async listRuns(e){return[...this.runs.values()].filter(t=>t.workflowId===e).map(e=>Uu(e))}release(e){this.runs.delete(e)}}class Hu{constructor(e,t={}){this.sequences=new Map,this.chains=new Map,this.store=e,this.limits={...mt,...t}}async publish(e){const t=e.runId,o=(this.sequences.get(t)??0)+1;this.sequences.set(t,o);const r={...e,payload:this.limitPayload(e.payload),sequence:o,timestamp:(new Date).toISOString()},n=(this.chains.get(t)??Promise.resolve()).then(()=>this.store.append(r));return this.chains.set(t,n.catch(()=>{})),await n,r}lastSequence(e){return this.sequences.get(e)??0}release(e){this.sequences.delete(e),this.chains.delete(e)}limitPayload(e){if(void 0===e)return;let t;try{t=JSON.stringify(e)}catch{return{nonSerializable:!0}}return t.length>this.limits.maxEventPayloadBytes?{truncated:!0,reason:"event payload exceeds the configured byte limit",bytes:t.length}:e}}class Bu{constructor(e,t,o,r={},n={}){this.controllers=new Map,this.completions=new Map,this.timeouts=new Map,this.engine=e,this.runStore=t,this.publisher=o,this.hooks=r,this.limits={...mt,...n}}begin(e){const t=this.controllers.get(e);if(t)return t;const o=new AbortController;return this.controllers.set(e,o),o}abort(e,t){const o=this.controllers.get(e);return!!o&&(o.signal.aborted||o.abort(t),!0)}isAborted(e){return!0===this.controllers.get(e)?.signal.aborted}abortReason(e){const t=this.controllers.get(e)?.signal;if(t?.aborted)return"timeout"===t.reason?"timeout":"user"}waitFor(e){return this.completions.get(e)}schedule(e,t,o,...r){const n=this.completions.get(e.runId);if(n)return n;const i=this.runExecution({...e},t,o,...r).catch(async t=>{const o=qu(t);try{await this.emitTerminal({...e},yt.WORKFLOW_FAILED,o)}catch{}return await this.finalize({...e},"failed",void 0,o,...r)});return this.completions.set(e.runId,i),i}release(e){this.controllers.delete(e),this.completions.delete(e);const t=this.timeouts.get(e);t&&(clearTimeout(t),this.timeouts.delete(e)),this.publisher.release(e)}armTimeout(e){const t=setTimeout(()=>{this.timeouts.delete(e),this.abort(e,"timeout")},this.limits.executionTimeoutMs);this.timeouts.set(e,t)}async runExecution(e,t,o,...r){const n=e.runId;let i,a,s=!1;const d=this.engine.observe({refresh:async t=>{t.runId===n&&(t.error&&(i=t.error),wt((await this.publisher.publish(this.envelopeOf(e,t))).type)?s=!0:t.type===yt.WORKFLOW_STARTED&&"validating"===e.status&&(e.status="running",await this.persist(e,...r)))}});this.armTimeout(n);try{if(this.isAborted(n)){const t={name:"GraphRunCancelledError",message:`Graph run '${n}' was cancelled before execution started`,code:"GRAPH_RUN_CANCELLED"};return i=t,await this.emitTerminal(e,yt.WORKFLOW_CANCELLED,t),s=!0,await this.finalize(e,"cancelled",void 0,t,...r)}let d,l;e.status="validating",e.startedAt=(new Date).toISOString(),await this.persist(e,...r);try{({document:d,fingerprint:l}=await t(...r)),e.documentFingerprint=l,await this.persist(e,...r)}catch(t){const o=qu(t);return i=o,s||(await this.emitTerminal(e,yt.WORKFLOW_FAILED,o),s=!0),await this.finalize(e,"failed",void 0,o,...r)}if(this.isAborted(n)){const t={name:"GraphRunCancelledError",message:`Graph run '${n}' was cancelled before execution started`,code:"GRAPH_RUN_CANCELLED"};return i=t,s||(await this.emitTerminal(e,yt.WORKFLOW_CANCELLED,t),s=!0),await this.finalize(e,"cancelled",void 0,t,...r)}try{a=await this.engine.execute(d,o,{runId:n,abortSignal:this.controllers.get(n)?.signal,metadata:{documentFingerprint:l}},...r)}catch(e){i=qu(e)}const c=this.abortReason(n);let p,u;return"timeout"===c?(p="failed",u=i??{name:"GraphRunTimeoutError",message:`Graph run '${n}' exceeded the configured execution timeout of ${this.limits.executionTimeoutMs}ms`,code:"GRAPH_RUN_TIMEOUT"}):"user"===c?(p="cancelled",u=i):a?.status===gt.SUCCEEDED?p="succeeded":a?.status===gt.CANCELLED?(p="cancelled",u=i):(p="failed",u=i??qu(new Cr(a?`Graph run '${n}' failed`:`Graph run '${n}' failed without a result`,"GRAPH_RUN_FAILED",{runId:n}))),s||await this.emitTerminal(e,"succeeded"===p?yt.WORKFLOW_COMPLETED:"cancelled"===p?yt.WORKFLOW_CANCELLED:yt.WORKFLOW_FAILED,u),await this.finalize(e,p,a,u,...r)}finally{d();const e=this.timeouts.get(n);e&&(clearTimeout(e),this.timeouts.delete(n))}}async emitTerminal(e,t,o){await this.publisher.publish({runId:e.runId,workflowId:e.workflowId,type:t,error:o})}async finalize(e,t,o,r,...n){e.status=t,o&&(e.result=o),r&&(e.error=r),e.startedAt||(e.startedAt=(new Date).toISOString()),e.finishedAt=(new Date).toISOString(),await this.persist(e,...n);try{await(this.hooks.onRunCompleted?.(e,o))}catch{}return e}async persist(e,...t){await this.runStore.saveRun({...e},...t)}envelopeOf(e,t){return{runId:e.runId,workflowId:t.workflowId??e.workflowId,type:t.type,nodeId:t.nodeId,edgeId:t.edgeId,payload:void 0===t.payload?void 0:Kt(t.payload)?t.payload:{nonSerializable:!0},error:t.error,parentRunId:t.parentRunId,path:t.path}}}function qu(e){return e instanceof Error?{name:e.name,message:e.message,stack:e.stack,code:e.graphCode??("number"==typeof e.code?e.code+"":e.code)}:{name:"UnknownError",message:e+""}}class Wu{constructor(e,t,o,r={}){this.activeByCaller=new Map,this.callerKeysByRun=new Map,this.releaseTimers=new Map,this.engine=e,this.runStore=t,this.eventStore=o,this.publisher=new Hu(o,r.limits),this.executor=new Bu(e,t,this.publisher,{onRunCompleted:r.onRunCompleted},r.limits),this.options={...r,limits:{...mt,...r.limits}}}get limits(){return this.options.limits}async createRun(e,t,o,...r){this.validateCreateRequest(e);const n=e.workflowId??e.workflow?.id??"";if(!n)throw new S("Graph run request must carry a workflow document with an id or a saved workflowId");if(e.workflowId&&!this.options.documentResolver)throw new S("Graph run requests by workflowId require a document resolver");const i=o??t??"anonymous",a=this.activeByCaller.get(i)??new Set;if(a.size>=this.options.limits.maxConcurrentRuns)throw new S(`Graph run rejected: the configured limit of ${this.options.limits.maxConcurrentRuns} concurrent runs per caller is exhausted`);const s=this.generateRunId(),d={runId:s,workflowId:n,ownerUser:t,status:"queued",createdAt:(new Date).toISOString()};this.executor.begin(s),await this.runStore.saveRun({...d},...r);const l=this.documentProviderFor(e,t);return a.add(s),this.activeByCaller.set(i,a),this.callerKeysByRun.set(s,i),this.executor.schedule(d,l,e.inputs??{},...r).catch(()=>{}).finally(()=>this.finishActiveRun(s)),d}async getRun(e,t,...o){const r=await this.runStore.readRun(e,...o);if(!r)throw new O(`No graph run found for runId '${e}'`);return this.assertOwnership(r,t),r}async listRunsByWorkflow(e,t,...o){return(await this.runStore.listRuns(e,...o)).filter(e=>Tu({owner:e.owner},t,{allowAnonymousAccess:!0===this.options.allowAnonymousAccess})).sort((e,t)=>{const o=e.updatedAt instanceof Date?e.updatedAt.getTime():NaN,r=t.updatedAt instanceof Date?t.updatedAt.getTime():NaN;return(Number.isFinite(r)?r:0)-(Number.isFinite(o)?o:0)})}async cancelRun(e,t,...o){const r=await this.runStore.readRun(e,...o);if(!r)throw new O(`No graph run found for runId '${e}'`);return this.assertWriteOwnership(r,t),"succeeded"===(n=r.status)||"failed"===n||"cancelled"===n||(this.executor.abort(e,"user"),r.status="cancelled",r.finishedAt=(new Date).toISOString(),await this.runStore.saveRun({...r},...o)),r;var n}async resumeRun(e,t,o,...r){const n=await this.runStore.readRun(e,...r);if(!n)throw new O(`No graph run found for runId '${e}'`);this.assertWriteOwnership(n,o);const i=this.engine.backend,a=i.resume;if("function"!=typeof a)throw new Cr(`Graph execution backend '${i.constructor?.name??"GraphExecutionBackend"}' does not support resume`,"GRAPH_RESUME_UNSUPPORTED_BACKEND",{runId:e});let s;try{s=await a.call(i,e,t,...r)}catch(e){throw(d=e)instanceof Cr?new Cr(d.message,d.graphCode):d}var d;const l={...s,runId:e,caller:o};return await this.publisher.publish({runId:e,workflowId:n.workflowId,type:yt.WORKFLOW_RESUMED,payload:l}),l}async listEvents(e,t,o,...r){return await this.getRun(e,o,...r),this.eventStore.listAfter(e,t)}async subscribeEvents(e,t,o,...r){return await this.getRun(e,t,...r),this.eventStore.subscribe(e,o)}subscribeRunEvents(e,t){return this.eventStore.subscribe(e.runId,t)}async waitForRun(e,t,...o){const r=this.executor.waitFor(e);return r&&await r,this.getRun(e,t,...o)}async executeAndWait(e,t,o,...r){const n=await this.createRun(e,t,o,...r);return this.waitForRun(n.runId,t,...r)}release(e){this.finishActiveRun(e);const t=this.releaseTimers.get(e);t&&(clearTimeout(t),this.releaseTimers.delete(e)),this.executor.release(e),this.eventStore.release?.(e)}finishActiveRun(e){const t=this.callerKeysByRun.get(e);if(void 0!==t){this.callerKeysByRun.delete(e);const o=this.activeByCaller.get(t);o&&(o.delete(e),0===o.size&&this.activeByCaller.delete(t))}if(this.releaseTimers.has(e))return;const o=setTimeout(()=>{this.releaseTimers.delete(e),this.release(e)},this.options.limits.eventReplayWindowMs);o.unref?.(),this.releaseTimers.set(e,o)}validateCreateRequest(e){if(!e||"object"!=typeof e||Array.isArray(e))throw new S("Graph run request must be an object carrying either a workflow document or a workflowId plus inputs");const t=void 0!==e.workflow,o=void 0!==e.workflowId;if(t&&o)throw new S("Graph run request is ambiguous: supply either an unsaved workflow document or a saved workflowId, not both");if(!t&&!o)throw new S("Graph run request must supply either an unsaved workflow document or a saved workflowId");if(t&&!_o(e.workflow))throw new S("Graph run request carries a payload that is not a canonical GraphWorkflowDocument");if(void 0!==e.inputs&&!Vt(e.inputs))throw new S("Graph run inputs must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys and unsafe prototype keys (__proto__/prototype/constructor) are rejected");const r=(e=>{try{return JSON.stringify(e)?.length??0}catch{return Number.MAX_SAFE_INTEGER}})(e);if(r>this.options.limits.maxRequestBytes)throw new S(`Graph run request of ${r} bytes exceeds the configured limit of ${this.options.limits.maxRequestBytes} bytes`)}documentProviderFor(e,t){if(e.workflow){const t=e.workflow;return async()=>({document:t,fingerprint:Mu(t)})}const o=e.workflowId;return async(...e)=>{const r=this.options.documentResolver;if(!r)throw new S("Graph run requests by workflowId require a document resolver");const n=await r.resolve(o,t,...e);return{document:n,fingerprint:Mu(n)}}}assertOwnership(e,t){ju({owner:e.ownerUser},t,{allowAnonymousAccess:!0===this.options.allowAnonymousAccess,resourceKind:"Graph run",resourceId:e.runId})}assertWriteOwnership(e,t){Du({owner:e.ownerUser},t,{resourceKind:"Graph run",resourceId:e.runId})}generateRunId(){const e=globalThis.crypto;if(!e||"function"!=typeof e.randomUUID)throw new Lr("Cannot generate a graph run id: crypto.randomUUID is unavailable in this runtime",{runtime:typeof globalThis.crypto});return e.randomUUID()}}function Ku(e){if(!e)return;let t;try{t=e.cache?.user}catch{t=void 0}if(null==t)try{t=e.get("user")}catch{t=void 0}return"string"==typeof t&&t.length>0?t:void 0}function Vu(e){return!(!e||"object"!=typeof e||Array.isArray(e))&&_o(e.document)&&!_o(e)}function zu(e){return JSON.parse(JSON.stringify(e))}function Qu(e){if(null==e)return 0;let t;try{t=e.getTime()}catch{return 0}return Number.isFinite(t)?t:0}let Ju=class extends z{constructor(e){super(tr),this.catalogue=e}get limits(){return{...Yi,...Zi.graph.workflows.limits??{}}}get allowAnonymousAccess(){return!0===Zi.graph.workflows.allowAnonymousAccess}async saveDocument(e,t,...o){const{ctx:r,ctxArgs:n}=(await this.logCtx(o,"saveDocument",!0)).for(this.saveDocument);if(!_o(t))throw new S("Payload is not a canonical GraphWorkflowDocument: id and name must be strings and inputs, outputs, nodes and edges must be arrays");if(t.id!==e)throw new S(`Document id '${t.id}' does not match the workflow id '${e}' from the request path`);const i=await this.validateDocument(t,r);if(!i.valid)throw new $r(i.issues);const a=Ku(r),s=await this.readExistingForWrite(e,n);s&&this.assertWriteOwnership(e,s,a);const d=new Date;if(s)return s.name=t.name,s.document=zu(t),s.updatedAt=d,this.update(s,...n);const l=new tr({workflowId:e,name:t.name,document:zu(t),...a?{owner:a}:{},updatedAt:d});return this.create(l,...n)}async seedDocument(e,t,...o){const{log:r,ctxArgs:n}=(await this.logCtx(o,"seedDocument",!0)).for(this.seedDocument);try{return await this.saveDocument(e,t,...n)}catch(t){if(t instanceof M)return r.warn(`Skipping boot seed of graph workflow '${e}': an existing row is owned by another user`),null;throw t}}async getDocument(e,...t){const{ctx:o,ctxArgs:r}=(await this.logCtx(t,"getDocument",!0)).for(this.getDocument);let n;try{n=await this.read(e,...r)}catch{n=null}if(!n)throw new O(`No graph workflow found for workflowId '${e}'`);if(this.assertOwnership(e,n,Ku(o)),n.document)return zu(n.document);throw new O(`Graph workflow '${e}' has no canonical document; legacy definition/state snapshots are no longer supported (DECAF-50 \xa74.26 R2-2)`)}async listWorkflows(...e){const{ctx:t,ctxArgs:o}=(await this.logCtx(e,"listWorkflows",!0)).for(this.listWorkflows),r=await this.listBy("workflowId",W.ASC,...o),n=Ku(t);return r.filter(e=>Tu(e,n,{allowAnonymousAccess:this.allowAnonymousAccess})).sort((e,t)=>Qu(t.updatedAt)-Qu(e.updatedAt))}async assertAccess(e,...t){const{ctx:o,ctxArgs:r}=(await this.logCtx(t,"assertAccess",!0)).for(this.assertAccess);let n;try{n=await this.read(e,...r)}catch{n=null}if(!n)throw new O(`No graph workflow found for workflowId '${e}'`);return this.assertOwnership(e,n,Ku(o)),n}async validateDocument(e,...t){const{ctx:o}=(await this.logCtx(t,"validateDocument",!0)).for(this.validateDocument);return await Cu(e,{limits:this.limits,...this.catalogue?{catalogue:this.catalogue}:{}},o)}async saveSnapshot(e,t,...o){const{ctx:r,ctxArgs:n}=(await this.logCtx(o,"saveSnapshot",!0)).for(this.saveSnapshot);if(!Vt(t))throw new S("Workflow snapshot payload must be JSON-safe: functions, class instances, undefined, NaN/Infinity, symbol keys and unsafe prototype keys (__proto__/prototype/constructor) are rejected");if(!Vu(t))throw new S("Workflow snapshots must wrap a canonical GraphWorkflowDocument ({ document, editor?, metadata? }): legacy definition/state snapshots are no longer accepted; save canonical documents via PUT /graph/workflows/{workflowId}");const i=Ku(r),a=await this.readExistingForWrite(e,n);a&&this.assertWriteOwnership(e,a,i);const s=new Date;if(a)return a.snapshot=t,await this.applyCanonicalWrapper(a,t,r),a.updatedAt=s,this.update(a,...n);const d=new tr({workflowId:e,snapshot:t,...i?{owner:i}:{},updatedAt:s});return await this.applyCanonicalWrapper(d,t,r),this.create(d,...n)}async loadSnapshot(e,...t){const{ctx:o,ctxArgs:r}=(await this.logCtx(t,"loadSnapshot",!0)).for(this.loadSnapshot);try{const t=await this.read(e,...r);return this.assertOwnership(e,t,Ku(o)),t}catch{return null}}async readExistingForWrite(e,t){try{return await this.read(e,...t)}catch(e){if(e instanceof O)return null;throw e}}assertOwnership(e,t,o){ju(t??null,o??null,{allowAnonymousAccess:this.allowAnonymousAccess,resourceKind:"Graph workflow",resourceId:e})}assertWriteOwnership(e,t,o){Du(t??null,o??null,{resourceKind:"Graph workflow",resourceId:e})}async applyCanonicalWrapper(e,t,o){if(!Vu(t))return;if(t.document.id!==e.workflowId)throw new S(`Document id '${t.document.id}' does not match the workflow id '${e.workflowId}' from the request path`);const r=await Cu(t.document,{limits:this.limits,...this.catalogue?{catalogue:this.catalogue}:{}},o);if(!r.valid)throw new $r(r.issues);e.document=zu(t.document),e.name=t.document.name}};Ju=k([H(tr),C("design:paramtypes",[Function])],Ju);let Xu=class extends z{constructor(){super(er)}async saveRun(e,...t){const{ctxArgs:o}=(await this.logCtx(t,"saveRun",!0)).for(this.saveRun),r=Uu(e);let n;try{n=await super.read(e.runId,...o)}catch{n=null}if(n)return n.workflowId=r.workflowId,n.owner=r.owner,n.status=r.status,n.documentFingerprint=r.documentFingerprint,n.result=r.result,n.error=r.error,n.startedAt=r.startedAt,n.finishedAt=r.finishedAt,void await this.update(n,...o);await this.create(r,...o)}async readRun(e,...t){const{ctxArgs:o}=(await this.logCtx(t,"readRun",!0)).for(this.readRun);try{return(e=>{const t=e.result;return{runId:e.runId,workflowId:e.workflowId,ownerUser:e.owner??null,status:(o=e.status,"string"==typeof o&&["queued","validating","running","succeeded","failed","cancelled"].includes(o)?e.status:"failed"),createdAt:e.createdAt.toISOString(),...e.startedAt?{startedAt:e.startedAt.toISOString()}:{},...e.finishedAt?{finishedAt:e.finishedAt.toISOString()}:{},...t?{result:t}:{},...e.error?{error:e.error}:{},...e.documentFingerprint?{documentFingerprint:e.documentFingerprint}:{}};var o})(await super.read(e,...o))}catch{return null}}async listRuns(e,...t){const{ctxArgs:o}=(await this.logCtx(t,"listRuns",!0)).for(this.listRuns);return await this.findBy("workflowId",e,...o)}};Xu=k([H(er),C("design:paramtypes",[])],Xu);let Yu=class extends z{constructor(){super(or)}async upsertManifest(e,...t){const{ctxArgs:o}=(await this.logCtx(t,"upsertManifest",!0)).for(this.upsertManifest),r=(e=>new or({kind:e.kind,name:e.display?.name,category:e.display?.category,group:e.display?.group,description:e.display?.description,manifest:Co(ko(e))}))(e);let n;try{n=await this.read(r.kind,...o)}catch{n=void 0}return n?(n.name=r.name,n.category=r.category,n.group=r.group,n.description=r.description,n.manifest=r.manifest,await this.update(n,...o)):await this.create(r,...o)}async syncFromCatalogue(e,...t){const{ctxArgs:o}=(await this.logCtx(t,"syncFromCatalogue",!0)).for(this.syncFromCatalogue),r=e.listManifests(void 0,...o),n=[];for(const e of r)n.push(await this.upsertManifest(e,...o));return n}async listNodes(...e){const{ctxArgs:t}=(await this.logCtx(e,"listNodes",!0)).for(this.listNodes);return await this.listBy("kind",W.ASC,...t)}async listManifests(...e){return(await this.listNodes(...e)).map(e=>(e=>{if(!e.manifest)throw new S(`Graph node row '${e.kind}' has no manifest to convert`);return Co(ko(e.manifest))})(e))}async getNode(e,...t){const{ctxArgs:o}=(await this.logCtx(t,"getNode",!0)).for(this.getNode);try{return await this.read(e,...o)}catch{throw new O(`Graph node kind '${e}' is not registered`)}}};Yu=k([H(or),C("design:paramtypes",[])],Yu);class Zu{map(e){const t={};for(const[o,r]of Object.entries(e.nodeResults))t[o]={status:r.status,startedAt:r.startedAt?.toISOString(),finishedAt:r.finishedAt?.toISOString(),error:r.error,outputs:r.outputs,fromCache:r.fromCache,pinned:r.pinned};const o={};for(const t of e.events)t.edgeId&&"edge.valueRouted"===t.type&&(o[t.edgeId]={status:gt.SUCCEEDED,lastValue:t.payload?.value,updatedAt:t.timestamp.toISOString()});const r=[...e.events];return{runId:e.runId,status:e.status,nodes:t,edges:o,outputs:e.outputs,events:r}}}export{Yc as AgentBasicChainNode,Kc as AgentChunkingNode,gc as AgentDelegationHookNode,Dc as AgentEmbeddingNode,yp as AgentGuardrailNode,bp as AgentHitlNode,lc as AgentHookNode,ip as AgentInformationExtractorNode,up as AgentInputProcessorNode,sp as AgentLangChainCodeNode,Nc as AgentMemoryNode,Tc as AgentMemorySelectorNode,rc as AgentNode,hp as AgentOutputProcessorNode,Jc as AgentQaChainNode,zc as AgentRerankNode,Gc as AgentRetrieverNode,vc as AgentSandboxNode,Ic as AgentScorerNode,Ec as AgentScorerSelectorNode,fc as AgentSkillNode,mc as AgentSkillSelectorNode,rp as AgentStructuredOutputParserNode,ep as AgentSummarizationChainNode,pc as AgentToolDenyNode,ic as AgentToolNode,sc as AgentToolSelectorNode,Lc as AgentVectorStoreNode,Gp as AgentVoiceNode,rs as AggregateNode,xd as AirtableNode,Qs as AwsS3StorageNode,Ys as AzureStorageNode,Ki as BreakFlowNode,Dl as ChatTriggerNode,na as CodeInputSchema,ia as CodeNode,ds as CompareDatasetsNode,fn as ConditionExpressionEvaluator,Cd as ConfluenceNode,dl as ConvertToFileNode,El as CryptoNode,Yi as DEFAULT_GRAPH_WORKFLOW_DOCUMENT_LIMITS,ni as DEFAULT_GRAPH_WORKFLOW_VALIDATION_LIMITS,Bn as DEFAULT_PINNING_METADATA,Fc as DEFAULT_RAG_CHUNK_OVERLAP,$c as DEFAULT_RAG_CHUNK_SIZE,Aa as DataTableNode,Ea as DateTimeNode,aa as DelayFlowNode,Tp as DiscordChannelResponseNode,Ep as DiscordChannelTriggerNode,pd as DiscordNode,dd as EmailSendNode,zi as ErrorBoundaryFlowNode,$l as ErrorTriggerNode,jl as EventTriggerNode,Ol as ExecuteCommandNode,Tl as ExecuteSubWorkflowNode,Pl as ExecuteWorkflowTriggerNode,us as ExtractFromFileNode,Ra as FilterNode,Ll as FormTriggerNode,Nl as FtpNode,Zc as GRAPH_AGENT_BASIC_CHAIN_NODES,Vc as GRAPH_AGENT_CHUNKING_NODES,hc as GRAPH_AGENT_DELEGATION_HOOK_NODES,Pp as GRAPH_AGENT_DISCORD_RESPONSE_NODES,Ap as GRAPH_AGENT_DISCORD_TRIGGER_NODES,jc as GRAPH_AGENT_EMBEDDING_NODES,lu as GRAPH_AGENT_FAMILY_NODES,mp as GRAPH_AGENT_GUARDRAIL_NODES,wp as GRAPH_AGENT_HITL_NODES,cc as GRAPH_AGENT_HOOK_NODES,ap as GRAPH_AGENT_INFORMATION_EXTRACTOR_NODES,gp as GRAPH_AGENT_INPUT_PROCESSOR_NODES,dp as GRAPH_AGENT_LANGCHAIN_CODE_NODES,gu as GRAPH_AGENT_M5_NODES,hu as GRAPH_AGENT_M6_NODES,xp as GRAPH_AGENT_MCP_TRIGGER_NODES,cu as GRAPH_AGENT_MEMORY_NODES,Pc as GRAPH_AGENT_MEMORY_SELECTOR_NODES,nc as GRAPH_AGENT_NODES,fp as GRAPH_AGENT_OUTPUT_PROCESSOR_NODES,uu as GRAPH_AGENT_PROCESSOR_NODES,Xc as GRAPH_AGENT_QA_CHAIN_NODES,pu as GRAPH_AGENT_RAG_NODES,Qc as GRAPH_AGENT_RERANK_NODES,Uc as GRAPH_AGENT_RETRIEVER_NODES,xc as GRAPH_AGENT_SANDBOX_NODES,_c as GRAPH_AGENT_SCORER_NODES,Ac as GRAPH_AGENT_SCORER_SELECTOR_NODES,yc as GRAPH_AGENT_SKILL_NODES,bc as GRAPH_AGENT_SKILL_SELECTOR_NODES,Np as GRAPH_AGENT_SLACK_RESPONSE_NODES,_p as GRAPH_AGENT_SLACK_TRIGGER_NODES,np as GRAPH_AGENT_STRUCTURED_OUTPUT_PARSER_NODES,tp as GRAPH_AGENT_SUMMARIZATION_CHAIN_NODES,Mp as GRAPH_AGENT_TEAMS_RESPONSE_NODES,kp as GRAPH_AGENT_TEAMS_TRIGGER_NODES,jp as GRAPH_AGENT_TELEGRAM_RESPONSE_NODES,Rp as GRAPH_AGENT_TELEGRAM_TRIGGER_NODES,uc as GRAPH_AGENT_TOOL_DENY_NODES,ac as GRAPH_AGENT_TOOL_NODES,dc as GRAPH_AGENT_TOOL_SELECTOR_NODES,Mc as GRAPH_AGENT_VECTOR_STORE_NODES,Up as GRAPH_AGENT_VOICE_NODES,du as GRAPH_BOUNDARY_NODES,mu as GRAPH_BUILT_IN_NODE_CLASSES_BY_KIND,tu as GRAPH_BUILT_IN_NODE_MANIFESTS,ru as GRAPH_BUILT_IN_NODE_MANIFESTS_BY_KIND,ra as GRAPH_CODE_DEFAULT_LANGUAGE,ea as GRAPH_CODE_DEFAULT_TIMEOUT_MS,oa as GRAPH_CODE_LANGUAGES,hr as GRAPH_CODE_MAX_TIMEOUT_MS,fu as GRAPH_DATA_NODES,Ar as GRAPH_DATA_TABLE_MAX_LIST_ROWS,_r as GRAPH_DATA_TABLE_MAX_ROWS,Er as GRAPH_DATA_TABLE_MAX_ROW_BYTES,lr as GRAPH_DEFAULT_CONCURRENCY,pr as GRAPH_DEFAULT_MAX_FOREACH_ITERATIONS,cr as GRAPH_DEFAULT_MAX_LOOP_ITERATIONS,ii as GRAPH_DOCUMENT_FORBIDDEN_FIELD_KEYS,wr as GRAPH_EXECUTE_COMMAND_DEFAULT_TIMEOUT_MS,vr as GRAPH_EXECUTE_COMMAND_MAX_OUTPUT_BYTES,br as GRAPH_EXECUTE_COMMAND_MAX_TIMEOUT_MS,iu as GRAPH_FLOW_CONTROL_NODES,mr as GRAPH_HTTP_MAX_REDIRECTS,yr as GRAPH_HTTP_MAX_RESPONSE_BYTES,fr as GRAPH_HTTP_MAX_TIMEOUT_MS,yu as GRAPH_IO_NODES,sr as GRAPH_LOCAL_EXECUTION_BACKEND,dr as GRAPH_LOCAL_UNSUPPORTED_NODE_KIND,kr as GRAPH_LOOP_KIND,su as GRAPH_LOOP_NODES,Ir as GRAPH_MAX_CHILD_RUNS,gr as GRAPH_MAX_FOREACH_ITERATIONS,ur as GRAPH_MAX_LOOP_ITERATIONS,xr as GRAPH_MAX_SUB_WORKFLOW_DEPTH,Sr as GRAPH_PINNING_METADATA_KEY,Pn as GRAPH_PLAIN_SECRET_KEYS,nu as GRAPH_TRIGGER_NODES,au as GRAPH_UTILITY_NODES,ar as GRAPH_WORKFLOW_BOUNDARY,_u as GRAPH_WORKFLOW_FORBIDDEN_FIELD_KEYS,wl as GithubNode,xl as GitlabNode,ad as GmailNode,Fd as GoogleCalendarNode,Js as GoogleCloudStorageNode,Ld as GoogleDocsNode,wd as GoogleSheetsNode,rn as GraphAuthValidator,Gr as GraphBreakSignal,Bp as GraphConditionEvaluator,Or as GraphConditionType,Zn as GraphConnectionPolicyValidator,oi as GraphConnectionValidationError,ri as GraphCredentialAuthorizationError,ei as GraphCredentialReferenceValidator,Nr as GraphCycleError,pi as GraphDataTableModel,bi as GraphDataTableRepository,ti as GraphDocumentValidationError,Yn as GraphEdgeInstanceValidator,un as GraphEngineEventSink,Zi as GraphEnvironment,hn as GraphExecutionBackendRegistry,ln as GraphExecutionContext,_i as GraphExecutionEngine,Cr as GraphExecutionError,Fr as GraphExecutionEventEmitter,Hr as GraphExecutionEventFactory,cn as GraphExecutionFrame,li as GraphExecutionPlanner,Zu as GraphExecutionSnapshotMapper,Hp as GraphForeachLoopNode,Tr as GraphInputError,Kp as GraphInputValueNode,Nu as GraphLoopExecutionContext,Pr as GraphLoopLimitError,Wi as GraphNode,Ui as GraphNodeCatalogue,nn as GraphNodeCredentialResolver,$i as GraphNodeExecutorRegistry,Fi as GraphNodeExecutorResolver,Jn as GraphNodeInstanceValidator,ji as GraphNodeManifestResolver,Oi as GraphNodeMethodNotFoundError,ki as GraphNodeMethodRegistry,Yu as GraphNodeModelService,Ri as GraphNodeNotFoundError,Si as GraphNodeRegistrationError,Vp as GraphOutputValueNode,Dn as GraphParameterValidator,Kn as GraphPinningDependencyResolver,Dr as GraphPinningError,Wn as GraphPinningPolicy,Hn as GraphPinningService,Rr as GraphPinningStrategy,jr as GraphPortError,xu as GraphPortSchemaResolver,Ur as GraphRunCancelledError,Hu as GraphRunEventPublisher,Bu as GraphRunExecutor,Xu as GraphRunModelService,Wu as GraphRunService,Lr as GraphStoreError,Fn as GraphTopology,Mr as GraphTopologyError,qp as GraphUntilLoopNode,jn as GraphValueModel,Un as GraphValueRepository,Iu as GraphValueValidator,ci as GraphWebhookResponseRegistry,Wp as GraphWhileLoopNode,$r as GraphWorkflowDocumentRejectedError,di as GraphWorkflowDocumentValidator,Ju as GraphWorkflowService,Ad as GraphqlNode,cl as HtmlExtractNode,ll as HtmlNode,hs as HttpRequestNode,Qi as HumanApprovalFlowNode,Ji as IfFlowNode,Gu as InMemoryGraphRunEventStore,Fu as InMemoryGraphRunStore,Ai as IsolatedVmCodeSandboxEvaluator,ns as ItemListsNode,Pd as JiraNode,Sl as JwtNode,Oa as LimitNode,Vn as LocalGraphExecutionBackend,sa as LogFlowNode,tc as MASTRA_AGENT_ZONE,oc as MASTRA_AGENT_ZONES,pp as MASTRA_GUARDRAIL_TYPES,lp as MASTRA_INPUT_PROCESSOR_TYPES,cp as MASTRA_OUTPUT_PROCESSOR_TYPES,Ml as ManualTriggerNode,da as MapNode,pl as MarkdownNode,vp as McpServerTriggerNode,Ca as MergeNode,Od as MicrosoftExcelNode,md as MicrosoftOutlookNode,Gd as MicrosoftSharePointNode,Gs as MicrosoftSqlNode,Ms as MySqlNode,Ls as PostgresNode,ec as PostgresTriggerNode,qs as RabbitMqNode,Jl as RabbitMqTriggerNode,fl as ReadBinaryFileNode,yl as ReadBinaryFilesNode,ys as ReadPDFNode,Is as ReadWriteFileNode,Hs as RedisNode,Xl as RedisTriggerNode,cs as RemoveDuplicatesNode,Ta as RenameKeysNode,_s as RespondToWebhookNode,Vs as S3Node,zs as S3StorageNode,Gl as ScheduleTriggerNode,Pa as SetNode,Cp as SlackChannelResponseNode,Ip as SlackChannelTriggerNode,ed as SlackNode,Da as SortNode,ja as SplitOutNode,_d as SpreadsheetFileNode,Yl as SseTriggerNode,ls as SummarizeNode,Xi as SwitchFlowNode,Lp as TeamsChannelResponseNode,Op as TeamsChannelTriggerNode,nd as TeamsNode,Dp as TelegramChannelResponseNode,Sp as TelegramChannelTriggerNode,od as TelegramNode,la as UtilityLogNode,Ul as WebhookTriggerNode,hd as WhatsAppNode,Bl as WorkflowTriggerNode,ml as WriteBinaryFileNode,hl as XmlNode,ju as assertGraphResourceOwnership,Du as assertGraphResourceWriteOwnership,pn as buildGraphExecutionResult,wu as builtInGraphNodeRegistrations,Tu as canAccessGraphResource,Pu as canAccessGraphResourcePayload,kn as checkGraphValueAgainstSchema,qc as chunkText,ta as clampGraphCodeTimeoutMs,wc as clampSandboxTimeoutMs,Xn as collectLooseNodeIssues,qr as composeGraphNamespace,wi as createGraphDataTableRepository,$n as createGraphValueRepository,Bi as declaredGraphNodeMethods,Br as decomposeGraphNamespace,tn as decomposeGraphNamespaces,Hi as defineGraphNode,Rn as detectGraphCodeModeBlockingSurfaces,En as detectGraphCodeModeSurfaces,bn as evaluateCodeCondition,vn as evaluateCondition,wn as evaluateConditionSync,Wc as extractChunkTexts,Qr as findMalformedGraphNamespaces,zr as findUngrantedGraphNamespaces,Zr as graphAuthDataFromRecord,en as graphAuthDataOf,An as graphDocumentHasCodeMode,Vr as graphNamespaceCovers,Kr as graphNamespacePartsOf,qi as graphNodeConfig,Jr as graphRolesFromNamespaces,Mu as graphRunDocumentFingerprint,Ku as graphWorkflowOwnerOf,yn as isCodeCondition,mn as isConditionExpression,Sn as isGraphCodeModeBlockingSurface,Nn as isGraphCredentialReferenceLike,Wr as isGraphNamespaceCacheEntryValid,ai as isGraphResolvedWorkflow,qn as isPinnable,on as mergeGraphAuthData,vu as registerBuiltInGraphNodes,gn as resolveGraphBackendCapabilities,Pi as resolveGraphDynamicPorts,Di as resolveGraphNodeManifest,an as resolveNodeCredential,Ln as serializeGraphValueKey,Ii as stripFacadeOwnedBackendConfig,Cu as validateGraphWorkflowDocumentAtBoundary};
|
|
2
2
|
//# sourceMappingURL=as-graph.js.map
|