@cratis/screenplay-language 4.121.0 → 4.122.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/dist/ResponseAnalysis.d.ts +5 -0
- package/dist/ResponseAnalysis.d.ts.map +1 -1
- package/dist/bundles/chunk-4CLLEMBX.js +42 -0
- package/dist/bundles/chunk-4CLLEMBX.js.map +7 -0
- package/dist/bundles/index.js +44 -44
- package/dist/bundles/index.js.map +3 -3
- package/dist/bundles/sub-languages/projection/index.js +1 -1
- package/dist/completion-items.d.ts +3 -0
- package/dist/completion-items.d.ts.map +1 -1
- package/dist/completion-planner.d.ts.map +1 -1
- package/dist/diagnostic-codes.d.ts +15 -0
- package/dist/diagnostic-codes.d.ts.map +1 -1
- package/dist/hover-content.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/keyword-docs.d.ts.map +1 -1
- package/dist/language.d.ts.map +1 -1
- package/dist/response-analysis.d.ts.map +1 -1
- package/dist/symbols.d.ts +5 -0
- package/dist/symbols.d.ts.map +1 -1
- package/dist/validation.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/bundles/chunk-OPU6YCT3.js +0 -42
- package/dist/bundles/chunk-OPU6YCT3.js.map +0 -7
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../language.ts", "../../TypeReferenceSymbol.ts", "../../document-context.ts", "../../event-context-catalog.ts", "../../event-context.ts", "../../documentation-item.ts", "../../purpose-items.ts", "../../example-declaration-items.ts", "../../scope-items.ts", "../../completion-items.ts", "../../../../Compiler/Diagnostics/DiagnosticCodes.ts", "../../../../Compiler/Text/patterns.ts", "../../../../Compiler/Parsing/SourceLineSplitter.ts", "../../../../Compiler/Syntax/EventDeclarations.ts", "../../../../Compiler/Syntax/Operations.ts", "../../../../Compiler/Syntax/AuthoringProductionKind.ts", "../../../../Compiler/Syntax/AuthoringProductionResolver.ts", "../../../../Compiler/Syntax/DependencySources.ts", "../../../../Compiler/Syntax/ScreenplaySyntaxWalker.ts", "../../../../Compiler/Syntax/ExactNumber.ts", "../../../../Compiler/Text/StringLiteral.ts", "../../../../Compiler/Parsing/StructuredValueParser.ts", "../../../../Compiler/Parsing/ExpressionParser.ts", "../../../../Compiler/Parsing/IdentityValidator.ts", "../../../../Compiler/Syntax/EventSourceResolutionKind.ts", "../../../../Compiler/Syntax/EventSourceCatalog.ts", "../../../../Compiler/Syntax/ProductionDestinations.ts", "../../../../Compiler/Syntax/ExactMathFacts.ts", "../../../../Compiler/Parsing/ResponseDateValues.ts", "../../../../Compiler/Syntax/PersonaCallers.ts", "../../../../Compiler/Syntax/SpecificationCaseOrigin.ts", "../../../../Compiler/Parsing/LineText.ts", "../../../../Compiler/Diagnostics/SourceLocation.ts", "../../../../Compiler/Parsing/SourceLine.ts", "../../../../Compiler/Parsing/PropertyLineParser.ts", "../../../../Compiler/Parsing/SpecificationResponseParser.ts", "../../../../Compiler/Parsing/SpecificationCaseParser.ts", "../../../../Compiler/Parsing/SpecificationCommandExamples.ts", "../../../../Compiler/Parsing/ResponseValidator.ts", "../../../../Compiler/Parsing/CommandDestinationTypes.ts", "../../../../Compiler/Parsing/RefusalDeclarations.ts", "../../../../Compiler/Parsing/SpecificationCaseValidator.ts", "../../../../Compiler/Diagnostics/ProductionDestinationDiagnostics.ts", "../../../../Compiler/Parsing/ConstraintPropertyValidator.ts", "../../../../Compiler/Dependencies/DeclaredDependencyTargets.ts", "../../../../Compiler/Files/PlayPlacement.ts", "../../../../Compiler/Parsing/AuthorizeParser.ts", "../../../../Compiler/Parsing/CodeBlockParser.ts", "../../../../Compiler/Parsing/DescriptionParser.ts", "../../../../Compiler/Parsing/PurposeParser.ts", "../../../../Compiler/Parsing/DocumentationParser.ts", "../../../../Compiler/Parsing/DependsOnParser.ts", "../../../../Compiler/Parsing/FileImportParser.ts", "../../../../Compiler/Parsing/ConditionParser.ts", "../../../../Compiler/Parsing/GuardedActionParser.ts", "../../../../Compiler/Parsing/LineReader.ts", "../../../../Compiler/Syntax/InvalidSyntaxJson.ts", "../../../../Compiler/Syntax/SourceOptions.ts", "../../../../Compiler/Parsing/ParserContext.ts", "../../../../Compiler/Parsing/InteractionAlternatives.ts", "../../../../Compiler/Parsing/InputUses.ts", "../../../../Compiler/Text/SourceStreamNames.ts", "../../../../Compiler/Parsing/EventSourceParser.ts", "../../../../Compiler/Parsing/FileReferences.ts", "../../../../Compiler/Text/ImplementationHintText.ts", "../../../../Compiler/Parsing/ImplementationParser.ts", "../../../../Compiler/Parsing/OperationParser.ts", "../../../../Compiler/Parsing/SpecificationParser.ts", "../../../../Compiler/Parsing/SpecificationExampleParser.ts", "../../../../Compiler/Syntax/Structure.ts", "../../../../Compiler/Syntax/TranslationDirection.ts", "../../../../Compiler/Syntax/CaptureEventsSource.ts", "../../../../Compiler/Syntax/EventVisibility.ts", "../../../../Compiler/Syntax/PublicEventInvariants.ts", "../../../../Compiler/Text/ReservedWords.ts", "../../../../Compiler/Parsing/EventMetadataParser.ts", "../../../../Compiler/Parsing/DeclarationParsers.ts", "../../../../Compiler/Parsing/ProjectionExpressionParser.ts", "../../../../Compiler/Parsing/CaptureParser.ts", "../../../../Compiler/Parsing/CommandResponseParser.ts", "../../../../Compiler/Parsing/CommandReadSources.ts", "../../../../Compiler/Parsing/DependencySourceParser.ts", "../../../../Compiler/Parsing/ProducesParser.ts", "../../../../Compiler/Parsing/CommandParser.ts", "../../../../Compiler/Parsing/ConstraintParser.ts", "../../../../Compiler/Parsing/ProjectionParser.ts", "../../../../Compiler/Parsing/QueryParser.ts", "../../../../Compiler/Parsing/TriggerDataParser.ts", "../../../../Compiler/Parsing/ReactionParser.ts", "../../../../Compiler/Parsing/UiBindingParser.ts", "../../../../Compiler/Parsing/ScreenParser.ts", "../../../../Compiler/Parsing/SliceParser.ts", "../../../../Compiler/Parsing/FeatureBody.ts", "../../../../Compiler/Parsing/ModuleBody.ts", "../../../../Compiler/Files/AuthoredOrder.ts", "../../../../Compiler/Dependencies/DependencyKind.ts", "../../../../Compiler/Dependencies/InvalidDependencyQuery.ts", "../../../../Compiler/Dependencies/SliceReferences.ts", "../../../../Compiler/Dependencies/StronglyConnectedGroups.ts", "../../../../Compiler/Dependencies/DependencyGraph.ts", "../../../../Compiler/Dependencies/DeclaredDependencies.ts", "../../../../Compiler/Parsing/PublicEventUsageCollector.ts", "../../../../Compiler/Parsing/PublicEventMetadataValidator.ts", "../../../../Compiler/Parsing/PublicEventUsageValidator.ts", "../../../../Compiler/Parsing/SourceOptionsParser.ts", "../../../../Compiler/Parsing/InlineEventValidator.ts", "../../../../Compiler/Parsing/OperationValidator.ts", "../../../../Compiler/Parsing/IdentityParser.ts", "../../../../Compiler/Parsing/ConceptComplianceParser.ts", "../../../../Compiler/Parsing/PolicyParser.ts", "../../../../Compiler/Parsing/SeedParser.ts", "../../../../Compiler/Parsing/CompositionParser.ts", "../../../../Compiler/Parsing/ScreenplayParser.ts", "../../../../Compiler/Parsing/CommandStreamCandidates.ts", "../../../../Compiler/Syntax/StreamIdFormatter.ts", "../../../../Compiler/Parsing/CompositeStreamIdValidator.ts", "../../../../Compiler/Parsing/SpecificationRouteComparison.ts", "../../../../Compiler/Parsing/SpecificationStreamValidator.ts", "../../../../Compiler/Parsing/EventSourceValidator.ts", "../../../../Compiler/Parsing/ProjectionTargetValidator.ts", "../../../../Compiler/Parsing/IdentifierComplianceValidator.ts", "../../../../Compiler/Parsing/EventSubjectValidator.ts", "../../../../Compiler/Parsing/RefusalValueWalker.ts", "../../../../Compiler/Parsing/ReactionRefusalValidator.ts", "../../../../Compiler/Parsing/RedeliveryValues.ts", "../../../../Compiler/Parsing/SpecificationRedeliveryValidator.ts", "../../../../Compiler/Parsing/GuardedActionShadowing.ts", "../../../../Compiler/Parsing/GuardedActionValidator.ts", "../../../../Compiler/Parsing/PersonaCallerValidator.ts", "../../../../Compiler/Parsing/PurposeValidator.ts", "../../../../Compiler/Text/ordinalIgnoreCaseKey.ts", "../../../../Compiler/Files/TimelineOrder.ts", "../../../../Compiler/ScreenplayCompiler.ts", "../../../../Compiler/Authoring/QuickFixes.ts", "../../../../Compiler/Syntax/EventSourceReadConfidence.ts", "../../../../Compiler/Syntax/SyntaxInvariants.ts", "../../../../Compiler/Syntax/SyntaxCollections.ts", "../../../../Compiler/Syntax/SyntaxMemberContracts.ts", "../../../../Compiler/Syntax/LegacyWireProjection.ts", "../../../../Compiler/Syntax/SyntaxJson.ts", "../../../../Compiler/Files/PlayFolderMerge.ts", "../../../../Compiler/Files/PlayApplicationAssembly.ts", "../../bmp-word-characters.ts", "../../example-analysis.ts", "../../persona-analysis.ts", "../../dependency-target-analysis.ts", "../../response-analysis.ts", "../../file-references.ts", "../../event-analysis-source.ts", "../../symbols.ts", "../../production-destinations.ts", "../../diagnostic-codes.ts", "../../file-imports.ts", "../../inline-event-validation.ts", "../../validation.ts"],
|
|
4
|
+
"sourcesContent": ["// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { languages } from 'monaco-editor';\n\nexport type Monaco = typeof import('monaco-editor');\n\nexport const languageId = 'screenplay';\n\nexport const languageExtensionPoint: languages.ILanguageExtensionPoint = {\n id: languageId,\n extensions: ['.play'],\n aliases: ['Screenplay', 'screenplay', 'play'],\n mimetypes: ['text/x-screenplay'],\n};\n\n// Every word the parser dispatches on at the top level, inside a module, or inside a slice.\n// `for_LanguageService.when_comparing_keywords_against_the_parsers` derives that set from\n// ScreenplayParser and SliceParser and fails when this list has drifted from it, so a construct\n// added to the compiler cannot silently lose its highlighting and completion.\nexport const constructKeywords = [\n 'domain',\n 'import',\n 'concept',\n 'type',\n 'policy',\n 'purpose',\n 'persona',\n 'authentication',\n 'identity',\n 'module',\n 'layout',\n 'theme',\n 'ui',\n 'feature',\n 'slice',\n 'event',\n 'public',\n 'system',\n 'eventsource',\n 'operation',\n 'command',\n 'query',\n 'projection',\n 'capture',\n 'reaction',\n 'reducer',\n 'readmodel',\n 'trigger',\n 'screen',\n 'dialog',\n 'form',\n 'contribute',\n 'constraint',\n 'specification',\n 'case',\n 'parameter',\n 'example',\n 'seed',\n 'behavior',\n 'exposure',\n 'instance',\n];\n\n// Type modifiers are contextual, never excluded from property or declaration names.\nexport const typeModifierKeywords = ['optional'];\n\nexport const clauseKeywords = [\n 'depends',\n 'direction',\n 'inbound',\n 'outbound',\n 'description',\n 'documentation',\n 'template',\n 'profile',\n 'require',\n 'authenticated',\n 'role',\n 'claim',\n 'subject',\n 'authorize',\n 'validate',\n 'produces',\n 'reads', // A clause in command bodies and reaction trigger bodies; @reads remains a value.\n 'as',\n 'handler',\n 'performer',\n 'observable',\n 'identifier',\n 'reason',\n 'from',\n 'when',\n 'given',\n 'then',\n 'arguments',\n 'result',\n 'clock', // A specification step - 'given clock' and 'when clock' state an instant.\n 'exactly',\n 'error',\n 'message',\n 'not', // Unary policy negation, as well as 'not empty' validation.\n 'empty',\n 'rule',\n 'matches',\n 'all',\n 'max',\n 'min',\n 'length',\n 'today',\n 'true',\n 'false',\n 'and',\n 'or',\n 'by',\n 'filter',\n 'data',\n 'via',\n 'component',\n 'context',\n 'property',\n 'literal',\n 'icons',\n 'packages',\n 'outlet',\n 'display',\n 'scopes',\n 'reexposes',\n 'operations',\n 'items',\n 'toolbar',\n 'item',\n 'presentation',\n 'exposes',\n 'mode',\n 'oneWay',\n 'twoWay',\n 'null',\n 'propagate',\n 'clear',\n 'preserve',\n 'expected',\n 'action',\n 'navigate',\n 'to',\n 'label',\n 'section',\n 'table',\n 'summary',\n 'title',\n 'column',\n 'field',\n 'on',\n 'unique',\n 'file',\n 'concurrency',\n 'eventSource',\n 'sourceType',\n 'streamType',\n 'streamId',\n 'tag',\n 'for',\n 'readmodel',\n 'no',\n 'when',\n 'every',\n 'at',\n 'where',\n 'invokes',\n 'contains',\n 'starts',\n 'with',\n 'provider',\n // Interaction: the words a behavior body uses. The built-in interaction kinds ('click', 'submit', and\n // friends) are only reserved inside an `on` clause, so they are clause words rather than constructs -\n // an identifier of the same name elsewhere in a document remains an identifier.\n 'uses',\n 'parameter',\n 'order',\n 'open',\n 'close',\n 'refresh',\n 'set',\n 'notify',\n 'confirm',\n 'raise',\n 'interval',\n 'success',\n 'failure',\n 'click',\n 'double',\n 'select',\n 'submit',\n 'change',\n 'load',\n 'unload',\n 'enter',\n 'leave',\n 'info',\n 'warning',\n];\n\nexport const codeBlockTags = ['csharp', 'typescript', 'react', 'html', 'sql'];\n\n// The roots a `$context.` path can start with \u2014 the members of CommandContext and QueryContext.\nexport const contextRoots = [\n 'command',\n 'arguments',\n 'tenant',\n 'causedBy',\n 'causation',\n 'occurred',\n 'identity',\n];\n\nexport const causedByProperties = ['subject', 'name', 'userName'];\n\n// The properties a `$identity.` or `$context.identity.` path can name \u2014 the members of Identity. Everything after\n// `claims.` is the name of a claim rather than a member, so it is never checked.\nexport const identityProperties = ['id', 'name', 'userName', 'isAuthenticated', 'roles', 'claims'];\n\nexport const sliceTypes = ['StateChange', 'StateView', 'Automation', 'Translate'];\n\nexport const primitiveTypes = ['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime'];\n\nexport const conceptAttributes = ['pii', 'personal', 'secret'];\n\n// The lines that open a block with a body of their own. A line that is complete as written - a `domain`, a\n// `concept` or `query` with nothing under it, a `produces` of an existing event - is not one.\nexport const blockHeaderPattern = /^\\s*(?:module|feature|slice\\s+\\w+|type|command|event|readmodel|reducer|projection|capture|reaction|screen|dialog|form|contribute|specification|case|constraint|persona|policy|behavior|layout|theme|ui\\s+profile|trigger|authentication|identity|seed|system|eventsource|operation|screen\\s+template|dialog\\s+template|produces\\s+event|validate|handler|on)\\b[^=]*$/;\n\nexport const languageConfiguration: languages.LanguageConfiguration = {\n comments: {\n lineComment: '//',\n },\n brackets: [\n ['(', ')'],\n ['[', ']'],\n ],\n autoClosingPairs: [\n { open: '(', close: ')' },\n { open: '[', close: ']' },\n { open: '\"', close: '\"' },\n ],\n surroundingPairs: [\n { open: '(', close: ')' },\n { open: '[', close: ']' },\n { open: '\"', close: '\"' },\n ],\n folding: {\n offSide: true,\n },\n // A header that opens a block puts the cursor one level in on Enter, so what is typed - or suggested - starts at\n // the block's own indentation. IndentAction.Indent is 1.\n onEnterRules: [\n { beforeText: blockHeaderPattern, action: { indentAction: 1 as languages.IndentAction } },\n ],\n indentationRules: {\n increaseIndentPattern:\n /^\\s*(module|feature|slice|policy|persona|authentication|identity|provider|event|command|query|type|screen|projection|capture|reaction|trigger|constraint|specification|layout|template|validate|produces|handler|implementation(?=\\s*$)|performer|rule|section|action|otherwise(?=\\s*$|\\s+execute\\b)|concurrency|seed|for|when|then|arguments|result|every|at|invokes|on)\\b.*$/,\n // Dedents are always explicit in an offside language \u2014 never auto-dedent.\n decreaseIndentPattern: /(?!)/,\n },\n};\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nexport interface TypeReferenceSymbol {\n readonly name: string;\n readonly isCollection: boolean;\n readonly isOptional: boolean;\n}\n\nexport function typeReferenceSymbol(text: string): TypeReferenceSymbol {\n const match = /^([\\w.]+)(\\[\\])?(\\?|\\s+optional)?$/.exec(text);\n return { name: match?.[1] ?? text, isCollection: match?.[2] !== undefined, isOptional: match?.[3] !== undefined };\n}\n\nexport function typeReferenceText(type: TypeReferenceSymbol): string {\n return `${type.name}${type.isCollection ? '[]' : ''}${type.isOptional ? ' optional' : ''}`;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// Matches SourceLineSplitter.CommentStart: // inside a double-quoted string or a\n// backtick template is content; a backslash escapes the next character only in a string.\nexport function withoutComment(line: string): string {\n let inString = false;\n let inTemplate = false;\n for (let index = 0; index < line.length; index++) {\n const character = line[index];\n if (character === '\\\\' && inString && index + 1 < line.length) {\n index++;\n } else if (character === '\"' && !inTemplate) {\n inString = !inString;\n } else if (character === '`' && !inString) {\n inTemplate = !inTemplate;\n } else if (!inString && !inTemplate && character === '/' && line[index + 1] === '/') {\n return line.slice(0, index);\n }\n }\n return line;\n}\n\nexport function indentOf(line: string): number {\n return line.length - line.trimStart().length;\n}\n\nexport function firstWord(line: string): string {\n return line.trim().split(/\\s+/)[0] ?? '';\n}\n\n// Marks every line that is a code fence or lives inside one, so structural\n// scanning never mistakes inline C#/TypeScript/HTML for Screenplay.\nexport function fenceMap(lines: string[]): boolean[] {\n const map: boolean[] = new Array(lines.length).fill(false);\n let open = false;\n for (let index = 0; index < lines.length; index++) {\n if (/^\\s*```(?:[a-z]+)?\\s*$/.test(lines[index]) && (!open || /^\\s*```\\s*$/.test(lines[index]))) {\n map[index] = true;\n open = !open;\n continue;\n }\n map[index] = open;\n }\n return map;\n}\n\n// Walks upward from a position and returns the chain of enclosing block openers,\n// innermost first \u2014 e.g. ['command', 'slice', 'feature', 'module']. A block opener\n// is any less-indented line above; its first word names the construct (for layout\n// slots this is the slot name, which callers treat as an unknown construct).\nexport function enclosingChain(\n lines: string[],\n fences: boolean[],\n lineIndex: number,\n indent: number,\n): string[] {\n const chain: string[] = [];\n let currentIndent = indent;\n for (let index = lineIndex - 1; index >= 0 && currentIndent > 0; index--) {\n if (fences[index]) continue;\n const line = withoutComment(lines[index]);\n if (line.trim().length === 0) continue;\n const lineIndent = indentOf(line);\n if (lineIndent < currentIndent) {\n chain.push(firstWord(line));\n currentIndent = lineIndent;\n }\n }\n return chain;\n}\n\n// Returns the full trimmed text of the nearest enclosing block opener above a\n// position \u2014 the same line enclosingChain's first entry is derived from, but kept\n// whole rather than reduced to its first word. Used where the construct is not\n// identified by a fixed leading keyword, such as a validation rule line, whose\n// first word is the property it applies to rather than \"rule\".\nexport function nearestEnclosingLine(\n lines: string[],\n fences: boolean[],\n lineIndex: number,\n indent: number,\n): string | undefined {\n for (let index = lineIndex - 1; index >= 0 && indent > 0; index--) {\n if (fences[index]) continue;\n const line = withoutComment(lines[index]);\n if (line.trim().length === 0) continue;\n if (indentOf(line) < indent) {\n return line.trim();\n }\n }\n return undefined;\n}\n\n// Like enclosingChain, but keeps each opener whole - 'slice StateView Name' rather than 'slice' - innermost first.\nexport function enclosingHeaders(\n lines: string[],\n fences: boolean[],\n lineIndex: number,\n indent: number,\n): string[] {\n const headers: string[] = [];\n let currentIndent = indent;\n for (let index = lineIndex - 1; index >= 0 && currentIndent > 0; index--) {\n if (fences[index]) continue;\n const line = withoutComment(lines[index]);\n if (line.trim().length === 0) continue;\n const lineIndent = indentOf(line);\n if (lineIndent < currentIndent) {\n headers.push(line.trim());\n currentIndent = lineIndent;\n }\n }\n return headers;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// Generated from Cratis.Screenplay.Syntax.EventContextCatalog - do not edit by hand. The spec\n// Syntax/for_EventContextCatalog/when_holding_the_editor_catalog_to_it fails when this file drifts; rerun\n// it with SCREENPLAY_REGENERATE_EVENT_CONTEXT=1 to rewrite it.\n\nexport type EventContextMemberKind = 'value' | 'composite' | 'collection' | 'function';\n\nexport interface EventContextMember {\n readonly name: string;\n readonly type: string;\n readonly kind: EventContextMemberKind;\n readonly description: string;\n}\n\nexport interface EventContextPath extends EventContextMember {\n readonly path: string;\n}\n\nexport const eventContextRootType = 'EventContext';\n\n// The members of each type a path passes through, keyed by type name.\nexport const eventContextTypes: Readonly<Record<string, readonly EventContextMember[]>> = {\n 'EventContext': [\n { name: 'eventType', type: 'EventType', kind: 'composite', description: 'The type of the event - its identifier, generation and whether it is a tombstone.' },\n { name: 'eventSourceType', type: 'EventSourceType', kind: 'value', description: 'The type of the event source the event was appended to.' },\n { name: 'eventSourceId', type: 'EventSourceId', kind: 'value', description: 'The identifier of the event source the event was appended to - the value $eventSourceId resolves.' },\n { name: 'eventStreamType', type: 'EventStreamType', kind: 'value', description: 'The type of the event stream the event belongs to.' },\n { name: 'eventStreamId', type: 'EventStreamId', kind: 'value', description: 'The identifier of the event stream the event belongs to.' },\n { name: 'sequenceNumber', type: 'EventSequenceNumber', kind: 'value', description: 'The position of the event in its event sequence.' },\n { name: 'occurred', type: 'DateTimeOffset', kind: 'value', description: 'When the event occurred - the time it was appended unless one was given.' },\n { name: 'eventStore', type: 'EventStoreName', kind: 'value', description: 'The name of the event store the event belongs to.' },\n { name: 'namespace', type: 'EventStoreNamespaceName', kind: 'value', description: 'The namespace within the event store the event belongs to.' },\n { name: 'correlationId', type: 'CorrelationId', kind: 'value', description: 'The correlation identifier the event was appended with.' },\n { name: 'causation', type: 'IEnumerable<Causation>', kind: 'collection', description: 'The chain of causes that led to the event - a collection, not addressable below.' },\n { name: 'causedBy', type: 'Identity', kind: 'composite', description: 'The identity that caused the event.' },\n { name: 'tags', type: 'IEnumerable<Tag>', kind: 'collection', description: 'The tags the event was appended with - a collection, not addressable below.' },\n { name: 'hash', type: 'EventHash', kind: 'value', description: 'The hash of the event content.' },\n { name: 'observationState', type: 'EventObservationState', kind: 'value', description: 'Whether the observer sees the event for the first time or again on replay - differs between live processing and replay.' },\n { name: 'subject', type: 'Subject', kind: 'value', description: 'The compliance subject the event is about - the event source identifier unless one was given.' },\n { name: 'subjectIsEventSourceId', type: 'bool', kind: 'value', description: 'Whether the subject is the event source identifier.' },\n ],\n 'EventType': [\n { name: 'id', type: 'EventTypeId', kind: 'value', description: 'The identifier of the event type.' },\n { name: 'generation', type: 'EventTypeGeneration', kind: 'value', description: 'The generation of the event type.' },\n { name: 'tombstone', type: 'bool', kind: 'value', description: 'Whether the event is a tombstone event.' },\n ],\n 'EventSourceType': [\n { name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n ],\n 'EventSourceId': [\n { name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n ],\n 'EventStreamType': [\n { name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n ],\n 'EventStreamId': [\n { name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n ],\n 'EventSequenceNumber': [\n { name: 'value', type: 'ulong', kind: 'value', description: 'The underlying ulong value.' },\n ],\n 'DateTimeOffset': [\n { name: 'Week', type: 'int', kind: 'function', description: 'The ISO 8601 week of the year the value falls in.' },\n ],\n 'EventStoreName': [\n { name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n ],\n 'EventStoreNamespaceName': [\n { name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n ],\n 'CorrelationId': [\n { name: 'value', type: 'Guid', kind: 'value', description: 'The underlying Guid value.' },\n ],\n 'Identity': [\n { name: 'subject', type: 'string', kind: 'value', description: 'The subject identifier of the identity.' },\n { name: 'name', type: 'string', kind: 'value', description: 'The display name of the identity.' },\n { name: 'userName', type: 'string', kind: 'value', description: 'The user name of the identity.' },\n { name: 'onBehalfOf', type: 'Identity', kind: 'composite', description: 'The identity this identity acted on behalf of, if any - an identity with the same members.' },\n ],\n 'EventHash': [\n { name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n ],\n 'Subject': [\n { name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n ],\n 'EventTypeId': [\n { name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n ],\n 'EventTypeGeneration': [\n { name: 'value', type: 'uint', kind: 'value', description: 'The underlying uint value.' },\n ],\n};\n\n// Every path the catalog lists, depth first in declaration order.\nexport const eventContextPaths: readonly EventContextPath[] = [\n { path: 'eventType', name: 'eventType', type: 'EventType', kind: 'composite', description: 'The type of the event - its identifier, generation and whether it is a tombstone.' },\n { path: 'eventType.id', name: 'id', type: 'EventTypeId', kind: 'value', description: 'The identifier of the event type.' },\n { path: 'eventType.id.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n { path: 'eventType.generation', name: 'generation', type: 'EventTypeGeneration', kind: 'value', description: 'The generation of the event type.' },\n { path: 'eventType.generation.value', name: 'value', type: 'uint', kind: 'value', description: 'The underlying uint value.' },\n { path: 'eventType.tombstone', name: 'tombstone', type: 'bool', kind: 'value', description: 'Whether the event is a tombstone event.' },\n { path: 'eventSourceType', name: 'eventSourceType', type: 'EventSourceType', kind: 'value', description: 'The type of the event source the event was appended to.' },\n { path: 'eventSourceType.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n { path: 'eventSourceId', name: 'eventSourceId', type: 'EventSourceId', kind: 'value', description: 'The identifier of the event source the event was appended to - the value $eventSourceId resolves.' },\n { path: 'eventSourceId.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n { path: 'eventStreamType', name: 'eventStreamType', type: 'EventStreamType', kind: 'value', description: 'The type of the event stream the event belongs to.' },\n { path: 'eventStreamType.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n { path: 'eventStreamId', name: 'eventStreamId', type: 'EventStreamId', kind: 'value', description: 'The identifier of the event stream the event belongs to.' },\n { path: 'eventStreamId.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n { path: 'sequenceNumber', name: 'sequenceNumber', type: 'EventSequenceNumber', kind: 'value', description: 'The position of the event in its event sequence.' },\n { path: 'sequenceNumber.value', name: 'value', type: 'ulong', kind: 'value', description: 'The underlying ulong value.' },\n { path: 'occurred', name: 'occurred', type: 'DateTimeOffset', kind: 'value', description: 'When the event occurred - the time it was appended unless one was given.' },\n { path: 'occurred.Week', name: 'Week', type: 'int', kind: 'function', description: 'The ISO 8601 week of the year the value falls in.' },\n { path: 'eventStore', name: 'eventStore', type: 'EventStoreName', kind: 'value', description: 'The name of the event store the event belongs to.' },\n { path: 'eventStore.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n { path: 'namespace', name: 'namespace', type: 'EventStoreNamespaceName', kind: 'value', description: 'The namespace within the event store the event belongs to.' },\n { path: 'namespace.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n { path: 'correlationId', name: 'correlationId', type: 'CorrelationId', kind: 'value', description: 'The correlation identifier the event was appended with.' },\n { path: 'correlationId.value', name: 'value', type: 'Guid', kind: 'value', description: 'The underlying Guid value.' },\n { path: 'causation', name: 'causation', type: 'IEnumerable<Causation>', kind: 'collection', description: 'The chain of causes that led to the event - a collection, not addressable below.' },\n { path: 'causedBy', name: 'causedBy', type: 'Identity', kind: 'composite', description: 'The identity that caused the event.' },\n { path: 'causedBy.subject', name: 'subject', type: 'string', kind: 'value', description: 'The subject identifier of the identity.' },\n { path: 'causedBy.name', name: 'name', type: 'string', kind: 'value', description: 'The display name of the identity.' },\n { path: 'causedBy.userName', name: 'userName', type: 'string', kind: 'value', description: 'The user name of the identity.' },\n { path: 'causedBy.onBehalfOf', name: 'onBehalfOf', type: 'Identity', kind: 'composite', description: 'The identity this identity acted on behalf of, if any - an identity with the same members.' },\n { path: 'tags', name: 'tags', type: 'IEnumerable<Tag>', kind: 'collection', description: 'The tags the event was appended with - a collection, not addressable below.' },\n { path: 'hash', name: 'hash', type: 'EventHash', kind: 'value', description: 'The hash of the event content.' },\n { path: 'hash.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n { path: 'observationState', name: 'observationState', type: 'EventObservationState', kind: 'value', description: 'Whether the observer sees the event for the first time or again on replay - differs between live processing and replay.' },\n { path: 'subject', name: 'subject', type: 'Subject', kind: 'value', description: 'The compliance subject the event is about - the event source identifier unless one was given.' },\n { path: 'subject.value', name: 'value', type: 'string', kind: 'value', description: 'The underlying string value.' },\n { path: 'subjectIsEventSourceId', name: 'subjectIsEventSourceId', type: 'bool', kind: 'value', description: 'Whether the subject is the event source identifier.' },\n];\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// Reads the generated event-context catalog. Every editor surface that describes $eventContext - projection\n// completion and hover, and the host editor's context-variable docs and completions - goes through here, so\n// none of them carries a list of its own.\n\nimport { eventContextPaths, eventContextRootType, eventContextTypes } from './event-context-catalog';\nimport type { EventContextMember, EventContextPath } from './event-context-catalog';\n\nexport { eventContextPaths };\nexport type { EventContextMember, EventContextPath };\n\n/**\n * Whether a written path segment names a member. Mirrors EventContextMember.IsNamedBy in the compiler: a property\n * resolves camelCase or with only its first character uppercased; a function resolves by its exact name, with or\n * without parentheses.\n */\nexport function namesEventContextMember(member: EventContextMember, segment: string): boolean {\n if (member.kind === 'function') {\n return segment === member.name || segment === `${member.name}()`;\n }\n\n const declared = member.name[0].toUpperCase() + member.name.slice(1);\n return segment === declared || (segment.length > 0 && segment[0].toUpperCase() + segment.slice(1) === declared);\n}\n\n/** The members of the event context itself - the first segment of every path. */\nexport const eventContextMembers: readonly EventContextMember[] = eventContextTypes[eventContextRootType];\n\n/**\n * The members that may follow the given segments after `$eventContext.`, or undefined when the segments do not\n * resolve or stop at a collection or function, below which nothing is addressable.\n */\nexport function eventContextMembersAfter(segments: readonly string[]): readonly EventContextMember[] | undefined {\n let members = eventContextMembers;\n for (const segment of segments) {\n const member = members.find((candidate) => namesEventContextMember(candidate, segment));\n if (!member || member.kind === 'collection' || member.kind === 'function') {\n return undefined;\n }\n\n members = eventContextTypes[member.type] ?? [];\n }\n\n return members;\n}\n\n/** The member the given segments name, or undefined when they do not resolve. */\nexport function eventContextMemberAt(segments: readonly string[]): EventContextMember | undefined {\n if (segments.length === 0) {\n return undefined;\n }\n\n const members = eventContextMembersAfter(segments.slice(0, -1));\n return members?.find((member) => namesEventContextMember(member, segments[segments.length - 1]));\n}\n\n/** The outcome of resolving a path against the catalog. Mirrors EventContextPathStatus in the compiler. */\nexport type EventContextPathStatus = 'known' | 'missing' | 'unknownMember' | 'unknownSubPath' | 'belowCollection';\n\n/** A path resolved against the catalog. Mirrors EventContextPathResolution in the compiler. */\nexport interface EventContextPathResolution {\n readonly status: EventContextPathStatus;\n readonly member?: EventContextMember;\n readonly segment?: string;\n readonly expected: readonly EventContextMember[];\n}\n\n/**\n * Resolves a path, as written after `$eventContext.`, the way EventContextCatalog.Resolve in the compiler does, so the\n * editor reports what the compiler reports.\n */\nexport function resolveEventContextPath(path: string): EventContextPathResolution {\n let current: EventContextMember | undefined;\n let expected = eventContextMembers;\n for (const segment of path.split('.')) {\n if (segment.length === 0) {\n return { status: 'missing', member: current, expected };\n }\n\n if (current?.kind === 'collection') {\n return { status: 'belowCollection', member: current, segment, expected: [] };\n }\n\n const next = expected.find((member) => namesEventContextMember(member, segment));\n if (!next) {\n return { status: current ? 'unknownSubPath' : 'unknownMember', member: current, segment, expected };\n }\n\n current = next;\n expected = next.kind === 'function' ? [] : eventContextTypes[next.type] ?? [];\n }\n\n return { status: 'known', member: current, expected: [] };\n}\n\n/** Markdown describing $eventContext and its members, for hovers. */\nexport function describeEventContext(): string {\n return [\n '**$eventContext**',\n '',\n 'Metadata about the event being projected. Paths are checked against the event-context catalog; `causation` and `tags` are collections and cannot be addressed below.',\n '',\n '**Members:**',\n ...eventContextMembers.map((member) => `- \\`${member.name}\\` (${member.type}) - ${member.description}`),\n ].join('\\n');\n}\n\n/** Markdown describing one member of the event context, for hovers. */\nexport function describeEventContextMember(path: string, member: EventContextMember): string {\n const below = member.kind === 'collection' || member.kind === 'function' ? [] : eventContextTypes[member.type] ?? [];\n const lines = [`**$eventContext.${path}**: \\`${member.type}\\``, '', member.description];\n if (below.length > 0) {\n lines.push('', `**Members:** ${below.map((child) => `\\`${child.name}\\``).join(', ')}`);\n }\n\n return lines.join('\\n');\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { CompletionEntry } from './completion-items';\n\nexport const documentationItem: CompletionEntry = {\n label: 'documentation',\n insertText: 'documentation\\n ```markdown\\n ${1:Reasoning, assumptions or rejected alternatives}\\n ```',\n documentation: 'One nonempty authoring-only Markdown block; report-only (PLAY0270), with no executable effect.',\n};\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { CompletionEntry } from './completion-items';\n\nexport const purposeReferenceItem: CompletionEntry = { label: 'purpose', insertText: 'purpose ${1:Name}', documentation: 'Adds a declared processing purpose to the union covering this slice and its enclosing containers.' };\n\nexport const purposeItems: CompletionEntry[] = [\n { label: 'description', insertText: 'description \"${1:processing intent}\"', documentation: 'Describes the processing, not a legal verdict.' },\n { label: 'basis', insertText: 'basis ${1|consent,contract,legalObligation,vitalInterests,publicTask,legitimateInterests|}', documentation: 'One Art. 6(1) lawful basis, with an optional quoted reference.' },\n { label: 'interest', insertText: 'interest \"${1:legitimate interests pursued}\"', documentation: 'Statement accompanying basis legitimateInterests.' },\n { label: 'condition', insertText: 'condition ${1|explicitConsent,employmentLaw,vitalInterests,notForProfit,madePublic,legalClaims,substantialPublicInterest,healthCare,publicHealth,research|}', documentation: 'Art. 9(2) condition for special-category data.' },\n { label: 'authorization', insertText: 'authorization \"${1:authorization in law}\"', documentation: 'Art. 10 authorization for criminal-offence data.' },\n { label: 'subjects', insertText: 'subjects ${1:customer}', documentation: 'Comma-separated open identifiers for categories of data subjects.' },\n { label: 'retention', insertText: 'retention \"${1:period or criteria}\"', documentation: 'Declared retention, not enforced.' },\n { label: 'recipient', insertText: 'recipient \"${1:recipient category}\"', documentation: 'Repeatable recipient category.' },\n { label: 'transfer', insertText: 'transfer \"${1:destination}\" safeguard \"${2:safeguard}\"', documentation: 'Repeatable destination and safeguards.' },\n { label: 'erasure exception', insertText: 'erasure exception ${1|expression,legalObligation,publicTask,publicHealth,archiving,legalClaims|}', documentation: 'Declared Art. 17(3) exception; does not change Chronicle per-subject erasure.' },\n];\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { CompletionEntry } from './completion-items';\n\nexport const exampleDeclarationItems: CompletionEntry[] = [\n { label: 'example', insertText: 'example ${1:Name} : ${2:Type}\\n ${3:property} = ${4:value}', documentation: 'One possibly partial event, command or read-model fixture. Step assignments override its values; no implicit defaults.' },\n];\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { CompletionEntry } from './completion-items';\nimport { exampleDeclarationItems } from './example-declaration-items';\nimport { documentationItem } from './documentation-item';\nimport { purposeReferenceItem } from './purpose-items';\n\nconst interactions = ['click', 'double click', 'select', 'submit', 'change', 'load', 'unload', 'enter', 'leave'];\n\nconst interactionItems: CompletionEntry[] = [\n { label: 'on', insertText: 'on ${1|click,select,submit,change,load,unload,enter,leave|}\\n ${2:execute command}', documentation: 'Wires what happens on an interaction - a click, a submit, entering or leaving the screen.' },\n { label: 'uses', insertText: 'uses ${1:Behavior}', documentation: 'Attaches a named behavior declared at the top level.' },\n];\n\nexport const moduleScopeItems: CompletionEntry[] = [\n purposeReferenceItem,\n documentationItem,\n ...exampleDeclarationItems,\n { label: 'description', insertText: 'description \"${1:what this module is for}\"', documentation: 'A human-readable description.' },\n { label: 'authorize', insertText: 'authorize ${1:PolicyName}', documentation: 'Policies that must pass for everything in the module.' },\n { label: 'depends on', insertText: 'depends on ${1:Name}', documentation: 'Declares an allowed module or feature dependency. Opts this container into independent explicit-reference checks.' },\n { label: 'import \"\u2026\"', insertText: 'import \"${1:*/*.play}\"', documentation: 'Imports `.play` files into this module \u2014 their top level is the module\\'s body.' },\n { label: 'feature', insertText: 'feature ${1:Name}\\n ', documentation: 'Groups related slices into a vertical feature.' },\n { label: 'screen', insertText: 'screen ${1:Name}\\n data ${2:ReadModel} via query ${3:QueryName}', documentation: 'Declares a module-level UI screen.' },\n { label: 'screen template', insertText: 'screen template ${1:Name}\\n fits slot ${2:content}\\n\\n ${3:slot}', documentation: 'Declares a reusable screen shape that fits a slot of the shell.' },\n { label: 'dialog template', insertText: 'dialog template ${1:Name}\\n ${2:body}\\n ${3:actions}', documentation: 'Declares a reusable dialog shape that opens over the shell.' },\n { label: 'form', insertText: 'form ${1:Name} for ${2:Command}\\n field ${3:property} label \"${4:Label}\"', documentation: 'Declares a form bound to a command.' },\n { label: 'contribute', insertText: 'contribute to ${1:Navigation}\\n navigate to ${2:Screen}\\n label \"${3:Label}\"', documentation: 'Contributes an entry to a slot of the shell, such as navigation.' },\n ...interactionItems,\n];\n\nexport const featureScopeItems: CompletionEntry[] = [\n purposeReferenceItem,\n documentationItem,\n ...exampleDeclarationItems,\n { label: 'description', insertText: 'description \"${1:what this feature is for}\"', documentation: 'A human-readable description.' },\n { label: 'authorize', insertText: 'authorize ${1:PolicyName}', documentation: 'Policies that must pass for everything in the feature.' },\n { label: 'depends on', insertText: 'depends on ${1:Name}', documentation: 'Declares an allowed module or feature dependency. Sibling feature names resolve before module names.' },\n { label: 'import \"\u2026\"', insertText: 'import \"${1:*.play}\"', documentation: 'Imports `.play` files into this feature \u2014 their top level is the feature\\'s body.' },\n { label: 'feature', insertText: 'feature ${1:Name}\\n ', documentation: 'Declares a nested sub-feature.' },\n { label: 'slice StateChange', insertText: 'slice StateChange ${1:Name}\\n ', documentation: 'A command \u2192 events flow; something that changes the system.' },\n { label: 'slice StateView', insertText: 'slice StateView ${1:Name}\\n ', documentation: 'A query + projection + screen; something that reads the system.' },\n { label: 'slice Automation', insertText: 'slice Automation ${1:Name}\\n ', documentation: 'A reaction or reducer; something that runs when something happens.' },\n { label: 'slice Translate', insertText: 'slice Translate ${1:Name}\\n ', documentation: 'A capture; converts external data into events.' },\n { label: 'contribute', insertText: 'contribute to ${1:Navigation}\\n navigate to ${2:Screen}\\n label \"${3:Label}\"', documentation: 'Contributes an entry to a slot of the shell, such as navigation.' },\n ...interactionItems,\n];\n\nexport const readModelItems: CompletionEntry[] = [\n documentationItem,\n { label: 'description', insertText: 'description \"${1:what one instance holds}\"', documentation: 'A human-readable description.' },\n { label: 'file', insertText: 'file ${1:Path}', documentation: 'Names the file this read model is realized by.' },\n { label: 'property', insertText: '${1:property} ${2:Type}', documentation: 'A property of the read model \u2014 a name and a type reference.' },\n];\n\nexport const reducerItems: CompletionEntry[] = [\n { label: 'description', insertText: 'description \"${1:what the reducer does}\"', documentation: 'A human-readable description.' },\n { label: 'on', insertText: 'on ${1:EventType}\\n ```csharp\\n ${2}\\n ```', documentation: 'A rule applied when the event occurs, in code or from a file.' },\n];\n\nexport const formItems: CompletionEntry[] = [\n { label: 'description', insertText: 'description \"${1:input surface intent}\"', documentation: 'Report-only description of the form.' },\n { label: 'populate via query', insertText: 'populate via query ${1:Query} by ${2:parameter}', documentation: 'Fills the form from a query before it is shown.' },\n { label: 'populate from item', insertText: 'populate from item', documentation: 'Fills the form from the item the screen was opened for.' },\n { label: 'field', insertText: 'field ${1:property} label \"${2:Label}\"', documentation: 'A form field bound to a command property.' },\n ...interactionItems,\n];\n\nexport const contributeItems: CompletionEntry[] = [\n { label: 'navigate to', insertText: 'navigate to ${1:Screen}', documentation: 'The screen the entry opens.' },\n { label: 'label', insertText: 'label \"${1:Label}\"', documentation: 'The text of the entry.' },\n { label: 'order', insertText: 'order ${1:10}', documentation: 'Where the entry sits among the others; lower comes first.' },\n];\n\nexport const behaviorItems: CompletionEntry[] = [\n { label: 'description', insertText: 'description \"${1:what the behavior does}\"', documentation: 'A human-readable description.' },\n { label: 'parameter', insertText: 'parameter ${1:name} ${2:Type}', documentation: 'A value the behavior is given where it is attached.' },\n { label: 'order', insertText: 'order ${1:10}', documentation: 'The order behaviors attached to the same element run in.' },\n { label: 'on', insertText: 'on ${1|click,select,submit,change,load,unload,enter,leave|}\\n ${2:execute command}', documentation: 'Wires what happens on an interaction.' },\n];\n\nconst step = (label: string, insertText: string, documentation: string): CompletionEntry => ({ label, insertText, documentation });\n\n// What an interaction does, and what can follow an action's outcome.\nexport const actionStepItems: CompletionEntry[] = [\n step('execute', 'execute ${1:command}', 'Runs a command.'),\n step('navigate to', 'navigate to ${1:Screen}', 'Opens a screen.'),\n step('open', 'open ${1:Dialog}', 'Opens a dialog.'),\n step('close', 'close', 'Closes the dialog.'),\n step('refresh', 'refresh ${1:query}', 'Reloads a query.'),\n step('set', 'set ${1:name} ${2:value}', 'Sets a value.'),\n step('notify', 'notify ${1|info,warning,error|} \"${2:message}\"', 'Shows a notification.'),\n step('confirm', 'confirm ${1:message}\\n on success\\n ${2:execute command}', 'Asks before continuing.'),\n step('raise', 'raise ${1:Trigger}', 'Raises a trigger.'),\n];\n\nexport const outcomeItems: CompletionEntry[] = [\n step('on success', 'on success\\n ${1:notify info \"Done\"}', 'What happens when it succeeds.'),\n step('on failure', 'on failure\\n ${1:notify error \"Failed\"}', 'What happens when it fails.'),\n ...actionStepItems,\n];\n\nexport const personaItems: CompletionEntry[] = [\n { label: 'description', insertText: 'description \"${1:who they are}\"', documentation: 'A human-readable description.' },\n { label: 'policy', insertText: 'policy ${1:PolicyName}', documentation: 'A policy this persona holds.' },\n];\n\nexport const authenticationItems: CompletionEntry[] = [\n { label: 'provider', insertText: 'provider ${1:Name}', documentation: 'An identity provider.' },\n { label: 'provider (named)', insertText: 'provider ${1:Kind} name ${2:Name}', documentation: 'An identity provider of a kind, under its own name.' },\n];\n\nexport const seedItems: CompletionEntry[] = [\n { label: 'for', insertText: 'for ${1:\"event-source-id\"}\\n ${2:EventType}\\n ${3:property} = ${4:value}', documentation: 'Events to seed for one event source id.' },\n];\n\nexport const themeItems: CompletionEntry[] = [\n { label: 'compatible with', insertText: 'compatible with ${1:Package}', documentation: 'A component package the theme is compatible with.' },\n];\n\nexport const uiProfileItems: CompletionEntry[] = [\n { label: 'target platform', insertText: 'target platform ${1:web}', documentation: 'The platforms the profile is for.' },\n { label: 'target size', insertText: 'target size ${1|compact,regular|}', documentation: 'The screen sizes the profile is for.' },\n { label: 'packages', insertText: 'packages\\n ${1:Package}', documentation: 'The component packages the profile uses.' },\n { label: 'layout', insertText: 'layout ${1:Layout}', documentation: 'The layout of the profile.' },\n { label: 'theme', insertText: 'theme ${1:Theme}', documentation: 'The theme of the profile.' },\n];\n\nexport const layoutItems: CompletionEntry[] = [\n { label: 'slot', insertText: '${1:slot}', documentation: 'A named slot of the shell.' },\n { label: 'slot contributes', insertText: '${1:slot} contributes ${2:Name}', documentation: 'A slot other declarations contribute to, such as `navigation contributes Navigation`.' },\n { label: 'arrangement', insertText: 'arrangement flow\\n column\\n ${1:slot}', documentation: 'How the slots are placed.' },\n];\n\nexport const templateItems: CompletionEntry[] = [\n { label: 'fits slot', insertText: 'fits slot ${1:content}', documentation: 'The slot of the shell the template fits.' },\n ...layoutItems,\n { label: 'on', insertText: 'on ${1|enter,leave,load,unload|}\\n ${2:refresh query}', documentation: 'Wires what happens on an interaction.' },\n];\n\nexport const interactionNames = interactions;\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { DocumentSymbols } from './symbols';\nimport { documentationItem } from './documentation-item';\nimport { purposeReferenceItem } from './purpose-items';\n\nimport { eventContextPaths } from './event-context';\nimport { identityProperties } from './language';\nimport { exampleDeclarationItems } from './example-declaration-items';\n\nexport const optionalTypeItems: CompletionEntry[] = [\n { label: 'optional', insertText: 'optional', documentation: 'Allows the complete value, including a collection, to be absent.' },\n];\n\nexport interface CompletionEntry {\n label: string;\n insertText: string;\n documentation: string;\n sortText?: string;\n detail?: string;\n}\n\nconst fenced = (tag: string) => `\\`\\`\\`${tag}\\n\\${1}\\n\\`\\`\\``;\n\nexport { exampleDeclarationItems } from './example-declaration-items';\n\nexport const identityItems: CompletionEntry[] = [\n { label: 'description', insertText: 'description \"${1:caller details}\"', documentation: 'Describes the caller metadata.' },\n { label: 'detail from claim', insertText: '${1:detail} ${2:Type} from claim \"${3:claim}\"', documentation: 'One typed detail sourced from a token claim.' },\n { label: 'detail from query', insertText: '${1:detail} ${2:Type} from query ${3:Query} by \\\\$identity.id', documentation: 'A keyed, single-result query authorized without additional caller details.' },\n { label: 'detail from code', insertText: '${1:detail} ${2:Type}\\n ```csharp\\n ${3:return value;}\\n ```', documentation: 'An opaque inline source; authoring metadata, not executable.' },\n { label: 'detail from file', insertText: '${1:detail} ${2:Type}\\n file ${3:Path}', documentation: 'One file source; no refresh or cache directives.' },\n];\n\nexport function contextVariableEntries(symbols: DocumentSymbols): CompletionEntry[] {\n const details = [...new Map((symbols.identityDetails ?? []).map(detail => [detail.name, detail])).values()];\n return [...contextVariableItems, ...details.filter(detail => !identityProperties.includes(detail.name)).map(detail => ({ label: `$identity.${detail.name}`, insertText: `\\\\$identity.${detail.name}`, detail: detail.type, documentation: 'Declared caller detail. Authoring metadata only; executable reads report PLAY0268 until admitted (#600).' }))];\n}\n\nexport const topLevelItems: CompletionEntry[] = [\n { label: 'identity', insertText: 'identity\\n ${1:detail} ${2:Type} from claim \"${3:claim}\"', documentation: 'Typed additional caller details; authoring metadata only, at most one block per application.' },\n { label: 'purpose', insertText: 'purpose ${1:Name}\\n description \"${2:processing intent}\"\\n basis ${3|consent,contract,legalObligation,vitalInterests,publicTask,legitimateInterests|}', documentation: 'Report-only processing metadata. Not legal advice; referenced by module, feature and slice.' },\n ...exampleDeclarationItems,\n { label: 'eventsource', insertText: 'eventsource ${1:Name}\\n identifier ${2:Type}\\n stream ${3:Name}', documentation: 'Application-owned source with nested streams, admitted by ESM v8. Pin the stored name before renaming a source with stored events; Default is reserved.' },\n { label: 'system', insertText: 'system ${1:Name}\\n description \"${2:external system}\"', documentation: 'Application-scoped external system; not admitted by any supported executable model (ESM) version yet.' },\n { label: 'import', insertText: 'import ${1:Module}.${2:Type}', documentation: 'Imports a type from another module by its qualified name.' },\n { label: 'import from', insertText: 'import ${1:Module}.${2:Event} from \"${3:origin}\"', documentation: 'Imports a public event contract with a nonblank opaque origin, not a file path. An import has no local shape, so executable binding still refuses it with PLAY0268.' },\n { label: 'import \"\u2026\"', insertText: 'import \"${1:**/*.play}\"', documentation: 'Imports other `.play` files by path or glob, relative to this file\\'s folder, as whole documents of the application.' },\n { label: 'concept', insertText: 'concept ${1:Name} : ${2|Uuid,String,Int,Decimal,Bool,Date,DateTime|}', documentation: 'Declares a formalized value type wrapping a primitive.' },\n { label: 'concept (enum)', insertText: 'concept ${1:Name} : Enum\\n ${2:value}', documentation: 'Declares an enumeration concept with a fixed set of values.' },\n { label: 'concept (pii with reason)', insertText: 'concept ${1:Name} : ${2|String,Uuid,Int,Decimal,Bool,Date,DateTime|} pii\\n pii reason \"${3:why this value is personal data}\"', documentation: 'Declares a personal-data concept together with the reason it is personal data.' },\n { label: 'type', insertText: 'type ${1:Name}\\n ${2:property} ${3:Type}', documentation: 'Declares a composite value type \u2014 a named shape built from several properties.' },\n { label: 'policy', insertText: 'policy ${1:Name}\\n require ${2:authenticated}', documentation: 'Declares a named authorization rule for commands and queries.' },\n { label: 'module', insertText: 'module ${1:Name}\\n ', documentation: 'Declares the top-level namespace \u2014 maps to a bounded context.' },\n { label: 'domain', insertText: 'domain ${1:Name}', documentation: 'The domain the file belongs to \u2014 optional, at most one per file, before everything else.' },\n { label: 'persona', insertText: 'persona ${1:Name}\\n description \"${2:who they are}\"', documentation: 'A named role interacting with the application, with the policies it holds.' },\n { label: 'authentication', insertText: 'authentication\\n provider ${1:Name}\\n ${2:setting} ${3:value}', documentation: 'Declares the identity providers of the application \u2014 at most one block per file.' },\n { label: 'seed', insertText: 'seed\\n for ${1:EventSourceId}\\n ${2:EventType}', documentation: 'Declares events to seed into the event store per event source id.' },\n { label: 'layout', insertText: 'layout ${1:Name}\\n ${2:slot}', documentation: 'Declares the application shell with named slots.' },\n { label: 'theme', insertText: 'theme ${1:Name}\\n compatible with ${2:Package}', documentation: 'Declares a theme and the component packages it is compatible with.' },\n { label: 'ui profile', insertText: 'ui profile ${1:Name}\\n target platform ${2:web}\\n layout ${3:Layout}\\n theme ${4:Theme}', documentation: 'Binds a target platform and size to a layout, theme and component packages.' },\n { label: 'behavior', insertText: 'behavior ${1:Name}\\n on ${2:click}\\n ${3:execute command}', documentation: 'A named interaction wiring, attached to a screen, form or dialog with `uses`.' },\n { label: 'trigger', insertText: 'trigger ${1:Name}\\n ${2:property} ${3:Type}', documentation: 'Declares an integration signal a reaction can run on.' },\n];\n\nexport const operationItems: CompletionEntry[] = [\n { label: 'uses', insertText: 'uses ${1:System}', documentation: 'Exactly one application-scoped external system.' },\n { label: 'description', insertText: 'description \"${1:intent}\"', documentation: 'Describes operation intent, without requiring code.' },\n { label: 'input', insertText: '${1:input} ${2:Type}', documentation: 'Typed operation input; no identifier or generated modifier.' },\n { label: 'execute', insertText: 'execute\\n description \"${1:effect}\"', documentation: 'Optional execution intent; not admitted by any supported executable model (ESM) version yet.' },\n { label: 'compensate', insertText: 'compensate\\n description \"${1:undo intent}\"', documentation: 'Optional compensation intent; not admitted by any supported executable model (ESM) version yet.' },\n];\n\nexport const operationImplementationItems: CompletionEntry[] = [\n { label: 'hint', insertText: 'hint \"${1:implementation guidance}\"', documentation: 'Ordered authoring guidance; not an executable implementation role.' },\n { label: 'file', insertText: 'file ${1:Path}', documentation: 'Selects the phase\u2019s sole source attachment.' },\n ...['csharp', 'typescript', 'react', 'html', 'sql'].map(language => ({ label: language, insertText: fenced(language), documentation: 'Selects the phase\u2019s sole inline source; not admitted by any supported executable model (ESM) version yet.' })),\n];\n\nexport const operationPhaseItems: CompletionEntry[] = [\n { label: 'description', insertText: 'description \"${1:phase intent}\"', documentation: 'A description-only phase is valid, pending intent.' },\n { label: 'implementation', insertText: 'implementation\\n hint \"${1:guidance}\"', documentation: 'Hints with optional source; phase owns File/Code, wrapper owns hints only.' },\n ...operationImplementationItems.filter(item => item.label !== 'hint'),\n];\n\nexport const conceptItems: CompletionEntry[] = [\n { label: 'description', insertText: 'description \"${1:what this value represents}\"', documentation: 'Report-only authoring description; not a validation or compliance note.' },\n { label: 'file', insertText: 'file ${1:Path}', documentation: 'Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.' },\n { label: 'pii reason', insertText: 'pii reason \"${1:why this value is personal data}\"', documentation: 'A free-text concept note, not a lawful basis.' },\n { label: 'secret reason', insertText: 'secret reason \"${1:why this value is an operational secret}\"', documentation: 'Records why the secret marker applies.' },\n { label: 'secret scope', insertText: 'secret scope ${1|subject,namespace,global|}', documentation: 'Explicit encryption scope; omitted scope keeps Chronicle\u2019s Subject default.' },\n { label: 'pii special', insertText: 'pii special ${1|racialOrEthnicOrigin,politicalOpinions,religiousOrPhilosophicalBeliefs,tradeUnionMembership,genetic,biometric,health,sexLifeOrSexualOrientation|}', documentation: 'GDPR Art. 9(1) special category of personal data.' },\n { label: 'pii criminal', insertText: 'pii criminal', documentation: 'Personal data relating to criminal convictions and offenses (GDPR Art. 10).' },\n { label: 'validate', insertText: 'validate\\n ${1:not empty} message \"${2:message}\"', documentation: 'Validation rules that travel with the value everywhere it appears.' },\n];\n\nexport const typeItems: CompletionEntry[] = [\n { label: 'file', insertText: 'file ${1:Path}', documentation: 'Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.' },\n { label: 'description', insertText: 'description \"${1:what this shape represents}\"', documentation: 'A human-readable description of the type.' },\n { label: 'property', insertText: '${1:property} ${2:Type}', documentation: 'A property of the type \u2014 a name and a type reference.' },\n];\n\nexport const sliceItems: CompletionEntry[] = [\n purposeReferenceItem,\n documentationItem,\n ...exampleDeclarationItems,\n { label: 'operation', insertText: 'operation ${1:Name}\\n uses ${2:System}\\n ${3:input} ${4:Type}', documentation: 'Reusable slice-owned operation intent; not admitted by any supported executable model (ESM) version yet.' },\n { label: 'file', insertText: 'file ${1:Path}', documentation: 'Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.' },\n { label: 'public event', insertText: 'public event ${1:Name}\\n ${2:property} ${3:Type}', documentation: 'Declares a public event: a contract this application publishes. Admitted by ESM v9; an outbound Translate slice produces it through a projection that targets it.' },\n { label: 'event from', insertText: 'event ${1:Name} from \"${2:origin}\"\\n ${3:property} ${4:Type}', documentation: 'An event with an opaque origin naming the application that owns it, not a path or declaration reference. It is a public event admitted by ESM v9; consume it with a capture over source events.' },\n { label: 'direction', insertText: 'direction ${1|inbound,outbound|}', documentation: 'Translate direction, inbound or outbound, admitted by ESM v9. No transport or delivery guarantee is implied.' },\n { label: 'event', insertText: 'event ${1:Name}\\n ${2:property} ${3:Type}', documentation: 'Declares an event type \u2014 an immutable, past-tense fact.' },\n { label: 'event generation', insertText: 'event ${1:Name} generation ${2:2}\\n ${3:property} ${4:Type}', documentation: 'Declares a complete numbered event generation; start at 1 and do not skip a number.' },\n { label: 'command', insertText: 'command ${1:Name}\\n ${2:property} ${3:Type}', documentation: 'Declares a command \u2014 an imperative intent that produces events.' },\n { label: 'query', insertText: 'query ${1:Name} => ${2:ReadModel}', documentation: 'Declares a read-side entry point mapping to a return type.' },\n { label: 'query observable', insertText: 'query ${1:Name} => observable ${2:ReadModel}', documentation: 'Declares a live read \u2014 the query keeps pushing as the read model changes, instead of answering once.' },\n { label: 'readmodel', insertText: 'readmodel ${1:Name}\\n ${2:property} ${3:Type}', documentation: 'Declares the shape of a read model \u2014 its properties \u2014 that a projection, reducer or query fills and returns.' },\n { label: 'reducer', insertText: 'reducer ${1:Name} => ${2:ReadModel}\\n on ${3:EventType}\\n ```csharp\\n ${4}\\n ```', documentation: 'Declares a reducer building a read model from events with imperative code, for what a projection cannot express.' },\n { label: 'specification', insertText: 'specification ${1:Name}\\n given ${2:EventType}\\n when ${3:Command}\\n then ${4:EventType}', documentation: 'Given/when/then acceptance criteria for the slice.' },\n { label: 'projection', insertText: 'projection ${1:Name} => ${2:ReadModel}\\n from ${3:EventType}', documentation: 'Declares how events project into a read model (PDL).' },\n { label: 'capture', insertText: 'capture ${1:Name}\\n source ${2:api}', documentation: 'Declares a change data capture converting external data into events (CDL).' },\n { label: 'reaction', insertText: 'reaction ${1:Name}\\n when ${2:Trigger}', documentation: 'Declares behavior that runs when something happens.' },\n { label: 'screen', insertText: 'screen ${1:Name}\\n data ${2:ReadModel} via query ${3:QueryName}', documentation: 'Declares a UI screen.' },\n { label: 'constraint', insertText: 'constraint ${1:Name}\\n unique ${2:property} on ${3:EventType}', documentation: 'Declares a server-side rule enforced before events are committed.' },\n];\n\nexport const commandItems: CompletionEntry[] = [\n documentationItem,\n { label: 'property', insertText: '${1:property} ${2:Type}', documentation: 'An input of the command \u2014 a name and a type reference.' },\n { label: 'produces operation', insertText: 'produces operation ${1:Name}\\n uses ${2:System}\\n ${3:input} ${4:Type} = ${5:source}', documentation: 'Declares ordered operation intent; not admitted by any supported executable model (ESM) version yet (PLAY0268).' },\n { label: 'returns property', insertText: 'returns @${1:property}', documentation: 'Scalar response from a direct command property, only on acceptance. Executable as ESM v7.' },\n { label: 'returns block', insertText: 'returns\\n ${1:field} = ${2:property}', documentation: 'Unnamed record response with inferred or explicit field types, only on acceptance. Executable as ESM v7.' },\n { label: 'produces event', insertText: 'produces event ${1:Name}\\n ${2:property} ${3:Type} = ${4:source}', documentation: 'Declares a slice-owned generation-1 event and maps its properties. An omitted for uses the command identifier.' },\n { label: 'identifier property', insertText: '${1:property} ${2:Type} identifier', documentation: 'Marks the property a runtime resolves the event source id from. At most one per command.' },\n { label: 'authorize', insertText: 'authorize ${1:PolicyName}', documentation: 'References the policies that must pass for the command to execute.' },\n { label: 'reads', insertText: 'reads ${1:View} by ${2:property}', documentation: 'Declares a view the command consults. Executable binding is not yet supported.' },\n { label: 'reads as', insertText: 'reads ${1:View} as ${2:alias} by ${3:property}', documentation: 'Names one instance of a view; every instance needs a unique alias when reading the same view more than once.' },\n { label: 'validate', insertText: 'validate\\n ${1:property} not empty message \"${2:message}\"', documentation: 'Declarative validation rules with messages.' },\n { label: 'validate csharp', insertText: `validate\\n ${fenced('csharp')}`, documentation: 'Imperative validation in C#, yielding the message of every rule the artifact breaks.' },\n { label: 'produces', insertText: 'produces ${1:EventType}\\n ${2:property} = ${3:source}', documentation: 'Declares the event the command emits, with property mappings.' },\n { label: 'produces when', insertText: 'produces when ${1:condition}\\n ${2:EventType}\\n ${3:property} = ${4:source}', documentation: 'Conditionally emits an event when the condition holds.' },\n { label: 'description', insertText: 'description \"${1:what the command asks for}\"', documentation: 'A human-readable description.' },\n { label: 'concurrency', insertText: 'concurrency\\n ${1|eventSource,sourceType,streamType,streamId,events|}', documentation: 'The scope of the concurrency check made when the command appends events.' },\n { label: 'handler', insertText: 'handler\\n ', documentation: 'Fully imperative command implementation \u2014 file reference or inline C#, instead of produces.' },\n];\n\nexport const eventItems: CompletionEntry[] = [\n { label: 'property', insertText: '${1:property} ${2:Type}', documentation: 'A property of the event \u2014 a name and a type reference.' },\n { label: 'description', insertText: 'description \"${1:what happened}\"', documentation: 'Authoring metadata, as one line or a text/markdown fence.' },\n { label: 'documentation', insertText: 'documentation\\n ```markdown\\n ${1:Details}\\n ```', documentation: 'Authoring-only Markdown documentation.' },\n { label: 'id', insertText: 'id \"${1:OldName}\"', documentation: 'Preserves a previous persisted event name after a rename. Leave absent for new events.' },\n { label: 'tag', insertText: 'tag ${1:audit}', documentation: 'An event-type tag stamped on every occurrence.' },\n];\n\nexport const inlineEventItems: CompletionEntry[] = [\n ...eventItems,\n { label: 'for', insertText: 'for ${1:identifier}', documentation: 'Explicitly names the command identifier used as the event source.' },\n { label: 'property mapping', insertText: '${1:property} ${2:Type} = ${3:source}', documentation: 'Declares and maps an event property on one line.' },\n];\n\nexport const producesItems: CompletionEntry[] = [\n { label: 'when', insertText: 'when ${1:condition}', documentation: 'Guards the produced event with a condition.' },\n];\n\nexport const implementationItems: CompletionEntry[] = [\n { label: 'hint', insertText: 'hint \"${1:implementation guidance}\"', documentation: 'Ordered nonblank guidance for a handler implementation. Not an execution guarantee.' },\n { label: 'file', insertText: 'file ${1:Path}', documentation: 'Selects one existing model-relative attachment.' },\n ...['csharp', 'typescript', 'react', 'html', 'sql'].map(language => ({ label: language, insertText: fenced(language), documentation: 'Selects one inline payload. Handler execution remains unsupported.' })),\n];\n\nexport const handlerItems: CompletionEntry[] = [\n { label: 'implementation', insertText: 'implementation\\n hint \"${1:implementation guidance}\"', documentation: 'Handler-only implementation intent with optional file or tagged fence. With no payload it is pending.' },\n { label: 'file', insertText: 'file ${1:Path}', documentation: 'Delegates the command implementation to an external C# file.' },\n { label: 'csharp', insertText: fenced('csharp'), documentation: 'Inline C# returning the events to append.' },\n];\n\nexport const queryItems: CompletionEntry[] = [\n { label: 'description', insertText: 'description \"${1:what this query is trying to accomplish}\"', documentation: 'What the query is for, in prose \u2014 what a generator or reviewer works from.' },\n { label: 'by', insertText: 'by ${1:param} ${2:Type}', documentation: 'Declares the identifying parameter of the query.' },\n { label: 'filter', insertText: 'filter ${1:param} ${2:Type} optional', documentation: 'Declares an optional filter parameter supplied by the caller.' },\n { label: 'filter from context', insertText: 'filter ${1:param} ${2:Type} from $context.${3|tenant,causedBy.subject,occurred|}', documentation: 'Declares a parameter filled from the query context instead of the caller.' },\n { label: 'authorize', insertText: 'authorize ${1:PolicyName}', documentation: 'References the policies that must pass for the query to execute.' },\n { label: 'performer', insertText: 'performer\\n ', documentation: 'The code that performs the query \u2014 a file reference or an inline csharp/sql block.' },\n];\n\nexport const performerItems: CompletionEntry[] = [\n { label: 'file', insertText: 'file ${1:Path}', documentation: 'Delegates the query implementation to an external file.' },\n { label: 'csharp', insertText: fenced('csharp'), documentation: 'Inline C# returning the query result, with the QueryContext in scope as context.' },\n { label: 'sql', insertText: fenced('sql'), documentation: 'Inline SQL returning the query result.' },\n];\n\nexport const constraintItems: CompletionEntry[] = [\n { label: 'description', insertText: 'description \"${1:invariant intent}\"', documentation: 'Report-only description, distinct from the violation message.' },\n { label: 'unique', insertText: 'unique ${1:property} on ${2:EventType}', documentation: 'Enforces a unique property value across an event type.' },\n { label: 'unique event', insertText: 'unique event ${1:EventType}', documentation: 'Enforces that the event type occurs at most once per event source.' },\n { label: 'file', insertText: 'file ${1:Path}', documentation: 'Delegates the constraint to a custom C# implementation.' },\n];\n\nexport const reactionItems: CompletionEntry[] = [\n documentationItem,\n { label: 'description', insertText: 'description \"${1:what this reaction does}\"', documentation: 'What the reaction does \u2014 a complete statement of intent before any code exists.' },\n { label: 'when', insertText: 'when ${1:Trigger}', documentation: 'An event, a declared trigger or a host signal that sets the reaction off. A trigger needs no body.' },\n { label: 'every', insertText: 'every ${1:15} ${2|seconds,minutes,hours,days|}', documentation: 'Runs the reaction on an interval.' },\n { label: 'at', insertText: 'at ${1:08:00}', documentation: 'Runs the reaction at a time of day \u2014 every day unless narrowed with `on <Weekday>` or `on day <n>`.' },\n { label: 'where', insertText: 'where ${1:condition}', documentation: 'Narrows which occurrences actually run the reaction.' },\n];\n\nexport const reactionTriggerItems: CompletionEntry[] = [\n { label: 'reads', insertText: 'reads ${1:View}', documentation: 'The view this trigger consults. Optionally use `as <alias> by <trigger value>`; clock triggers take no values and cannot use `by`.' },\n { label: 'description', insertText: 'description \"${1:what this reaction does}\"', documentation: 'What this particular reaction does \u2014 enough on its own, with no file to point at.' },\n { label: 'produces', insertText: 'produces ${1:EventType}', documentation: 'An event the reaction appends.' },\n { label: 'invokes', insertText: 'invokes ${1:Command}', documentation: 'A command the reaction hands on. A command is asked for, not produced \u2014 it may still be rejected.' },\n { label: 'file', insertText: 'file ${1:Path}', documentation: 'Delegates the reaction to an external C# file.' },\n { label: 'csharp', insertText: fenced('csharp'), documentation: 'Inline C# returning event side effects.' },\n];\n\nconst refusalAvailability = 'Syntax-only; reaction refusal handling and redelivery are not yet executable (PLAY0268).';\n\nexport const invocationItems: CompletionEntry[] = [\n { label: 'on refused', insertText: 'on refused\\n acknowledge', documentation: `Handles validation and constraint refusals, not authorization. ${refusalAvailability}` },\n { label: 'on refused by validation', insertText: 'on refused by validation\\n acknowledge', documentation: `Handles validation refusals. ${refusalAvailability}` },\n { label: 'on refused by constraint', insertText: 'on refused by constraint ${1:Name}\\n acknowledge', documentation: `Handles a named constraint refusal; omit the name for any constraint. ${refusalAvailability}` },\n { label: 'on refused by authorization', insertText: 'on refused by authorization\\n acknowledge', documentation: `Explicitly handles unauthorized results, never Unsupported. ${refusalAvailability}` },\n];\n\nexport const refusalItems: CompletionEntry[] = [\n { label: 'acknowledge', insertText: 'acknowledge', documentation: `Acknowledges alone, without productions. ${refusalAvailability}` },\n { label: 'produces', insertText: 'produces ${1:Event}\\n ${2:reason} = \\\\$refusal.reason', documentation: `Records the refusal with ordinary event productions. ${refusalAvailability}` },\n];\n\nexport const triggerItems: CompletionEntry[] = [\n { label: 'file', insertText: 'file ${1:Path}', documentation: 'Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.' },\n { label: 'description', insertText: 'description \"${1:when this occurs}\"', documentation: 'What makes an occurrence of this trigger happen.' },\n { label: 'value', insertText: '${1:name} ${2:Type}', documentation: 'A value an occurrence hands the reaction. The type is optional.' },\n];\n\nexport const specificationItems: CompletionEntry[] = [\n { label: 'parameter', insertText: 'parameter ${1:name} ${2:Type}', documentation: 'One typed value, supplied exactly once by every case.' },\n { label: 'case', insertText: 'case ${1:Name}\\n ${2:parameter} = ${3:value}', documentation: 'One named complete set of concrete parameter values.' },\n { label: 'given caller as', insertText: 'given caller as ${1:Persona}', documentation: 'An authenticated deterministic witness of a top-level persona; no body. Use explicit callers for negation, ownership claims and implementations.' },\n { label: 'description', insertText: 'description \"${1:rule or case witnessed}\"', documentation: 'Authoring-only description of what this scenario demonstrates.' },\n { label: 'when redelivered', insertText: 'when redelivered ${1:Event} to ${2:Reaction}\\n for ${3:value}', documentation: `Selects exactly one given event occurrence for one event-trigger reaction; does not append it again. ${refusalAvailability}` },\n { label: 'given operation fails', insertText: 'given operation ${1:Name} fails', documentation: 'Failure fixture leaf; not admitted by any supported executable model (ESM) version yet (PLAY0268).' },\n { label: 'then operation', insertText: 'then operation ${1:Name}\\n ${2:input} = ${3:value}', documentation: 'Partial requested-operation assertion; not admitted by any supported executable model (ESM) version yet (PLAY0268).' },\n { label: 'then compensated', insertText: 'then compensated ${1:Name}', documentation: 'Compensation assertion leaf; not admitted by any supported executable model (ESM) version yet (PLAY0268).' },\n { label: 'file', insertText: 'file ${1:Path}', documentation: 'Names the repository relative file this declaration is realized by, so the document can be navigated back to the code.' },\n { label: 'given', insertText: 'given ${1:EventType}\\n ${2:property} = ${3:value}', documentation: 'Establishes prior state by replaying an event before the command runs.' },\n { label: 'given readmodel', insertText: 'given readmodel ${1:ReadModelType}\\n ${2:property} = ${3:value}', documentation: 'Establishes prior read model state directly.' },\n { label: 'when', insertText: 'when ${1:CommandType}\\n ${2:property} = ${3:value}', documentation: 'The command being exercised.' },\n { label: 'then', insertText: 'then ${1:EventType}\\n ${2:property} = ${3:value}', documentation: 'An event expected to be produced by the command.' },\n { label: 'then readmodel', insertText: 'then readmodel ${1:ReadModelType}\\n ${2:property} = ${3:value}', documentation: 'The read model state expected after the command.' },\n { label: 'then no readmodel', insertText: 'then no readmodel ${1:ReadModelType} for ${2:key}', documentation: 'Asserts that precisely one keyed read-model instance does not exist; another key may still be present.' },\n { label: 'then query', insertText: 'then query ${1:QueryName}\\n arguments\\n ${2:argument} = ${3:value}\\n result\\n ${4:property} = ${5:value}', documentation: 'The ordered query results expected for explicit arguments. Remove the result block to assert an empty result.' },\n { label: 'then error', insertText: 'then error', documentation: 'A rejection, for a reason this specification does not name.' },\n { label: 'then error \"...\"', insertText: 'then error \"${1:reason}\"', documentation: 'A rejection, for the named reason.' },\n { label: 'given clock', insertText: 'given clock \"${1:2026-10-05T08:00:00Z}\"', documentation: 'The instant the scenario happens at - the occurrence time of everything it does. At most once.' },\n { label: 'given capture', insertText: 'given capture ${1:Capture}\\n ${2:field} = ${3:value}', documentation: 'A record the capture\\'s source held before.' },\n { label: 'when clock', insertText: 'when clock \"${1:2026-10-05T09:00:00Z}\"', documentation: 'The clock reaches an instant, as the action.' },\n { label: 'when trigger', insertText: 'when trigger ${1:Trigger}\\n ${2:value} = ${3:value}', documentation: 'An application trigger fires, as the action.' },\n { label: 'when capture', insertText: 'when capture ${1:Capture}\\n ${2:field} = ${3:value}', documentation: 'The record a capture\\'s source holds now, as the action.' },\n { label: 'when query', insertText: 'when query ${1:Query}\\n ${2:argument} = ${3:value}', documentation: 'Performs a query, as the action.' },\n { label: 'then result', insertText: 'then result\\n ${1:property} = ${2:value}', documentation: 'One result the query performed by `when query` returns, in order.' },\n { label: 'then no result', insertText: 'then no result', documentation: 'The query performed by `when query` returns nothing.' },\n { label: 'then no events', insertText: 'then no events', documentation: 'Syntax-only assertion of no new events after a non-append action (PLAY0268); cannot accompany event, error or denial expectations.' },\n];\n\n// What follows a 'given', 'when' or 'then' already typed in a specification.\nexport const specificationStepItems: Record<'given' | 'when' | 'then', CompletionEntry[]> = {\n given: [\n { label: 'operation', insertText: 'operation ${1:Name} fails', documentation: 'Syntax-only failure fixture; no children.' },\n { label: 'clock', insertText: 'clock \"${1:2026-10-05T08:00:00Z}\"', documentation: 'The instant the scenario happens at - the occurrence time of everything it does.' },\n { label: 'capture', insertText: 'capture ${1:Capture}\\n ${2:field} = ${3:value}', documentation: 'A record the capture\\'s source held before. Repeat it for several records.' },\n { label: 'readmodel', insertText: 'readmodel ${1:ReadModelType}\\n ${2:property} = ${3:value}', documentation: 'Establishes prior read model state directly.' },\n { label: 'caller', insertText: 'caller\\n ${1:authenticated}', documentation: 'The identity the scenario runs as.' },\n ],\n when: [\n { label: 'redelivered', insertText: 'redelivered ${1:Event} to ${2:Reaction}\\n for ${3:value}', documentation: `Selects exactly one given event occurrence for one reaction. ${refusalAvailability}` },\n { label: 'clock', insertText: 'clock \"${1:2026-10-05T09:00:00Z}\"', documentation: 'The clock reaches an instant - what a scheduled reaction responds to.' },\n { label: 'trigger', insertText: 'trigger ${1:Trigger}\\n ${2:value} = ${3:value}', documentation: 'An application trigger fires, with the values it carries.' },\n { label: 'capture', insertText: 'capture ${1:Capture}\\n ${2:field} = ${3:value}', documentation: 'The record a capture\\'s source holds now.' },\n { label: 'query', insertText: 'query ${1:Query}\\n ${2:argument} = ${3:value}', documentation: 'Performs a query; assert what it returns with `then result` or `then no result`.' },\n { label: 'append', insertText: 'append ${1:EventType}\\n ${2:property} = ${3:value}', documentation: 'An event occurs, instead of a command being executed.' },\n ],\n then: [\n { label: 'operation', insertText: 'operation ${1:Name}\\n ${2:input} = ${3:value}', documentation: 'Syntax-only partial operation assertion; not admitted by any supported executable model (ESM) version yet.' },\n { label: 'compensated', insertText: 'compensated ${1:Name}', documentation: 'Syntax-only compensation assertion; no children.' },\n { label: 'returns value', insertText: 'returns ${1:value}', documentation: 'Scalar response expectation, compared by semantic value equality. Executable as ESM v7.' },\n { label: 'returns block', insertText: 'returns\\n ${1:field} = ${2:value}', documentation: 'Nonempty subset of response fields asserted by name. Executable as ESM v7.' },\n { label: 'result', insertText: 'result\\n ${1:property} = ${2:value}', documentation: 'One result the query performed by `when query` returns, in order.' },\n { label: 'result exactly', insertText: 'result exactly\\n ${1:property} = ${2:value}', documentation: 'One result, with every property asserted.' },\n { label: 'no result', insertText: 'no result', documentation: 'The query performed by `when query` returns nothing.' },\n { label: 'no events', insertText: 'no events', documentation: 'Syntax-only assertion of no new events after a non-append action; not yet executable (PLAY0268).' },\n { label: 'readmodel', insertText: 'readmodel ${1:ReadModelType}\\n ${2:property} = ${3:value}', documentation: 'The read model state expected afterwards.' },\n { label: 'error', insertText: 'error \"${1:reason}\"', documentation: 'A rejection, for the named reason.' },\n { label: 'denied', insertText: 'denied', documentation: 'The action is denied to the caller.' },\n ],\n};\n\nexport const namedRuleImplementationItems: CompletionEntry[] = [\n { label: 'hint', insertText: 'hint \"${1:predicate guidance}\"', documentation: 'Ordered nonblank authoring guidance. Does not execute or confirm the predicate.' },\n { label: 'file', insertText: 'file ${1:Path}', documentation: 'The sole named-rule predicate attachment.' },\n { label: 'csharp', insertText: fenced('csharp'), documentation: 'Opaque named-rule predicate returning a bool. Requires an admitting target.' },\n];\n\nexport const commandRuleItems: CompletionEntry[] = [\n { label: 'implementation', insertText: 'implementation\\n hint \"${1:predicate guidance}\"', documentation: 'Command named-rule intent with optional file or tagged fence. Pending intent cannot bind.' },\n ...namedRuleImplementationItems.filter(item => item.label !== 'hint'),\n];\n\nexport const ruleItems: CompletionEntry[] = [\n { label: 'file', insertText: 'file ${1:Path}', documentation: 'Gives the named predicate its implementation in an external C# file.' },\n { label: 'csharp', insertText: fenced('csharp'), documentation: 'Gives the named predicate its implementation as inline C# returning a bool.' },\n];\n\nexport const policyItems: CompletionEntry[] = [\n { label: 'description', insertText: 'description \"${1:authorization intent}\"', documentation: 'Report-only description; does not supply an implementation.' },\n { label: 'require authenticated', insertText: 'require authenticated', documentation: 'Requires an authenticated caller.' },\n { label: 'require role', insertText: 'require role \"${1:role}\"', documentation: 'Requires the caller to have a role.' },\n { label: 'require not role', insertText: 'require not role \"${1:role}\"', documentation: 'Excludes callers with a role. Add authenticated to require a signed-in caller.' },\n { label: 'require not claim', insertText: 'require not claim \"${1:claim}\" matches ${2:subject}', documentation: 'Requires that no claim value matches the subject or a value.' },\n { label: 'require claim', insertText: 'require claim \"${1:claim}\" matches ${2:subject}', documentation: 'Requires a claim to match the subject or a value.' },\n { label: 'csharp', insertText: fenced('csharp'), documentation: 'Fully custom policy logic in C#, returning a bool.' },\n];\n\nexport const validateItems: CompletionEntry[] = [\n { label: 'not empty', insertText: '${1:property} not empty message \"${2:message}\"', documentation: 'The property must have a value.' },\n { label: 'max', insertText: '${1:property} max ${2:500} message \"${3:message}\"', documentation: 'Maximum length or value.' },\n { label: 'min', insertText: '${1:property} min ${2:1} message \"${3:message}\"', documentation: 'Minimum length or value.' },\n { label: 'matches', insertText: '${1:property} matches \"${2:pattern}\" message \"${3:message}\"', documentation: 'The property must match a regular expression.' },\n { label: 'rule', insertText: '${1:property} rule ${2:PredicateName} message \"${3:message}\"', documentation: 'Names a predicate \u2014 optionally followed by an indented `file` reference or inline `csharp` block giving it a body; bare, it just states that a constraint exists.' },\n { label: '==', insertText: '${1:property} == ${2:value} message \"${3:message}\"', documentation: 'The property must equal the value.' },\n { label: '!=', insertText: '${1:property} != ${2:value} message \"${3:message}\"', documentation: 'The property must not equal the value.' },\n { label: 'length ==', insertText: '${1:property} length == ${2:3} message \"${3:message}\"', documentation: 'The property must have an exact length.' },\n { label: 'all >', insertText: '${1:collection}.${2:property} all > ${3:0} message \"${4:message}\"', documentation: 'Every element of a collection must satisfy the comparison.' },\n];\n\nexport const screenItems: CompletionEntry[] = [\n { label: 'description', insertText: 'description \"${1:screen intent}\"', documentation: 'Report-only description, not a localizable screen title.' },\n { label: 'data', insertText: 'data ${1:ReadModel} via query ${2:QueryName}', documentation: 'Binds a read model to the screen through a query.' },\n { label: 'action', insertText: 'action ${1:CommandName}', documentation: 'Makes a command available as an action on the screen.' },\n { label: 'action \"\u2026\"', insertText: 'action \"${1:Label}\"\\n when item.${2:status} == \"${3:open}\" execute ${4:CommandName}\\n otherwise hidden', documentation: 'One labeled button selecting the first matching command; hidden without a subject or match.' },\n { label: 'layout', insertText: 'layout ${1:LayoutName}', documentation: 'Uses a layout template and fills its slots.' },\n { label: 'section', insertText: 'section ${1:name}', documentation: 'A named structural section of the screen.' },\n { label: 'table', insertText: 'table ${1:name}\\n column ${2:property} label \"${3:text}\"', documentation: 'A table widget over a read model or collection.' },\n { label: 'summary', insertText: 'summary ${1:ReadModel}\\n field ${2:property} label \"${3:text}\"', documentation: 'A summary widget showing labeled fields.' },\n { label: 'title', insertText: 'title \"${1:text}\"', documentation: 'The title of the screen or section.' },\n { label: 'file', insertText: 'file ${1:Path}', documentation: 'Full external implementation \u2014 Stage uses the referenced file.' },\n { label: 'react', insertText: fenced('react'), documentation: 'Inline React/TSX component receiving the data contract as Props.' },\n { label: 'typescript', insertText: fenced('typescript'), documentation: 'Inline plain TypeScript.' },\n { label: 'html', insertText: fenced('html'), documentation: 'Inline static HTML.' },\n];\n\nexport const actionItems: CompletionEntry[] = [\n { label: 'navigate to', insertText: 'navigate to ${1:ScreenName}', documentation: 'Navigates to a screen after the action completes.' },\n { label: 'label', insertText: 'label \"${1:text}\"', documentation: 'The display label of the action.' },\n];\n\nexport const guardedActionItems: CompletionEntry[] = [\n { label: 'when \u2026 execute', insertText: 'when item.${1:status} == \"${2:open}\" execute ${3:CommandName}', documentation: 'First matching alternative selects the command; authorization never falls through.' },\n { label: 'otherwise hidden', insertText: 'otherwise hidden', documentation: 'Hides the action when no alternative matches; also the default.' },\n { label: 'otherwise execute', insertText: 'otherwise execute ${1:CommandName}', documentation: 'Selects a fallback command when no alternative matches and a subject exists.' },\n ...actionItems.filter(item => item.label !== 'label'),\n];\n\nexport const interactionActionItems: CompletionEntry[] = [\n { label: 'execute', insertText: 'execute ${1:CommandName}', documentation: 'Executes a command; denial never selects another alternative.' },\n { label: 'navigate to', insertText: 'navigate to ${1:ScreenName}', documentation: 'Navigates to the named screen.' },\n { label: 'open dialog', insertText: 'open dialog ${1:DialogTemplate}', documentation: 'Opens a dialog.' },\n { label: 'notify', insertText: 'notify info \"${1:Message}\"', documentation: 'Displays a message.' },\n { label: 'confirm', insertText: 'confirm \"${1:Message}\"\\n on success\\n execute ${2:CommandName}', documentation: 'Asks before continuing.' },\n { label: 'refresh', insertText: 'refresh ${1:QueryName}', documentation: 'Refreshes a query-backed element.' },\n];\n\nexport const interactionChoiceItems: CompletionEntry[] = [\n { label: 'when \u2026', insertText: 'when item.${1:status} == \"${2:open}\"\\n execute ${3:CommandName}', documentation: 'Selects a whole action list once against the rendered subject at gesture time.' },\n { label: 'otherwise', insertText: 'otherwise\\n notify info \"${1:Message}\"', documentation: 'Final fallback list; without a subject nothing runs, including fallback.' },\n ...interactionActionItems,\n];\n\nexport const actionArgumentItems: CompletionEntry[] = [\n { label: 'with \u2026 from', insertText: 'with ${1:property} from item.${2:property}', documentation: 'Explicit input binding for this command alternative, before same-name item fields or its form.' },\n];\n\nexport const tableItems: CompletionEntry[] = [\n { label: 'column', insertText: 'column ${1:property} label \"${2:text}\"', documentation: 'A column bound to a property.' },\n { label: 'on row-click', insertText: 'on row-click navigate to ${1:ScreenName} by ${2:param}', documentation: 'Navigates when a row is clicked.' },\n];\n\nexport const contextVariableItems: CompletionEntry[] = [\n ...identityProperties.map(property => ({\n label: `$identity.${property}${property === 'claims' ? '.' : ''}`,\n insertText: `$identity.${property}${property === 'claims' ? '.${1:name}' : ''}`,\n documentation: `The caller's ${property}, equivalent to $context.identity.${property}.`,\n })),\n { label: '$context.occurred', insertText: '$context.occurred', documentation: 'When the command or query was received.' },\n { label: '$context.tenant', insertText: '$context.tenant', documentation: 'The tenant the command or query is executing for.' },\n { label: '$context.command.', insertText: '$context.command.${1:property}', documentation: 'A property of the command being handled.' },\n { label: '$context.arguments.', insertText: '$context.arguments.${1:name}', documentation: 'An argument of the query being performed.' },\n { label: '$context.causedBy.subject', insertText: '$context.causedBy.subject', documentation: 'Subject of the identity that caused the command or query.' },\n { label: '$context.causedBy.name', insertText: '$context.causedBy.name', documentation: 'Display name of the identity that caused the command or query.' },\n { label: '$context.causedBy.userName', insertText: '$context.causedBy.userName', documentation: 'User name of the identity that caused the command or query.' },\n { label: '$context.causation.type', insertText: '$context.causation.type', documentation: 'What caused this \u2014 a command, a reactor, a schedule.' },\n { label: '$context.identity.id', insertText: '$context.identity.id', documentation: 'The identifier of the caller from the auth token.' },\n { label: '$context.identity.name', insertText: '$context.identity.name', documentation: 'The display name of the caller.' },\n { label: '$context.identity.userName', insertText: '$context.identity.userName', documentation: 'The user name of the caller.' },\n { label: '$context.identity.isAuthenticated', insertText: '$context.identity.isAuthenticated', documentation: 'Whether the caller is authenticated.' },\n { label: '$context.identity.roles', insertText: '$context.identity.roles', documentation: 'The roles the caller holds.' },\n { label: '$context.identity.claims.', insertText: '$context.identity.claims.${1:name}', documentation: 'The value of a claim the caller carries.' },\n { label: '$env.', insertText: '$env.${1:VAR_NAME}', documentation: 'An environment variable.' },\n // Every $eventContext path the event-context catalog lists, for projections - the underlying value of a concept\n // is left out, it reads the same as the member it belongs to.\n ...eventContextPaths\n .filter((path) => path.name !== 'value')\n .map((path) => ({ label: `$eventContext.${path.path}`, insertText: `$eventContext.${path.path}`, documentation: `${path.description} (PDL)` })),\n];\n\nexport { moduleScopeItems as moduleItems, featureScopeItems as featureItems } from './scope-items';\n\n// What a slice of each type can hold. A slice of an unknown type keeps everything.\nconst sliceMembers: Record<string, readonly string[]> = {\n StateChange: ['operation', 'file', 'description', 'event', 'event generation', 'command', 'constraint', 'screen', 'specification'],\n StateView: ['file', 'description', 'readmodel', 'query', 'query observable', 'projection', 'reducer', 'screen', 'specification', 'event', 'event generation'],\n Automation: ['operation', 'file', 'description', 'reaction', 'reducer', 'command', 'event', 'event generation', 'readmodel', 'specification'],\n Translate: ['file', 'description', 'capture', 'event', 'event generation', 'specification'],\n};\n\nexport function sliceItemsFor(sliceType: string | undefined): CompletionEntry[] {\n const members = sliceType ? sliceMembers[sliceType] : undefined;\n return members ? sliceItems.filter(item => item.label === 'purpose' || item.label === 'example' || item.label === 'documentation' || item.label === 'public event' || item.label === 'event from' || (item.label === 'direction' && sliceType === 'Translate') || members.includes(item.label)) : sliceItems;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// Shared diagnostic names, including the explicitly C#-only checks below. Catalogue membership does\n// not imply TypeScript validation support; see Documentation/screenplay/editor-diagnostics.md.\nexport const DiagnosticCodes = {\n InvalidIdentityDeclaration: 'PLAY0633',\n DuplicateIdentity: 'PLAY0634',\n InvalidIdentityDetail: 'PLAY0635',\n UnknownIdentitySource: 'PLAY0636',\n IdentityDetailWithoutSource: 'PLAY0637',\n IdentitySourceWithBody: 'PLAY0638',\n DuplicateIdentityDetail: 'PLAY0639',\n BuiltInIdentityDetail: 'PLAY0640',\n UnknownIdentityQuery: 'PLAY0641',\n InvalidIdentityQuery: 'PLAY0642',\n IdentityQueryWithoutKey: 'PLAY0643',\n InvalidIdentityQueryKey: 'PLAY0644',\n IdentityQueryAuthorizationDependency: 'PLAY0645',\n IdentityQueryTypeMismatch: 'PLAY0646',\n // C#-only whole-model public event boundaries; membership is not TypeScript validation support.\n CommandProducesPublicEvent: 'PLAY0607',\n PublicEventRequiresOutboundTranslation: 'PLAY0608',\n OutboundPublicEventCount: 'PLAY0609',\n ForeignPublicEventConsumer: 'PLAY0610',\n OutboundTranslationInput: 'PLAY0611',\n InboundTranslationOutput: 'PLAY0612',\n ForeignPublicEventProduced: 'PLAY0613',\n PublicTranslationRequiresDirection: 'PLAY0614',\n TranslationConstructDirection: 'PLAY0615',\n InboundTranslationInput: 'PLAY0616',\n OutboundTranslationOutput: 'PLAY0617',\n EventTargetOutsideOutboundTranslation: 'PLAY0618',\n EventsSourceOutsideInboundTranslation: 'PLAY0619',\n InvalidCaptureEventsSource: 'PLAY0620',\n // Syntax shared with C#; the reference checks (owners, instances, cycles, outlets, scopes, packages) are C#-only.\n InvalidExposureDeclaration: 'PLAY0621',\n UnknownExposureOwner: 'PLAY0622',\n ReExposureCycle: 'PLAY0623',\n ReExposureBroken: 'PLAY0624',\n InvalidInstanceContribution: 'PLAY0625',\n UnknownContributionInstance: 'PLAY0626',\n ContributionNotExposed: 'PLAY0627',\n ContributionTypeMismatch: 'PLAY0628',\n UnknownTemplateContentSlot: 'PLAY0629',\n UnknownNavigationOutlet: 'PLAY0630',\n TemplateScopeMismatch: 'PLAY0631',\n IncompatibleComponentPackage: 'PLAY0632',\n LegacyComplianceMarker: 'PLAY0565',\n UnknownComplianceMarker: 'PLAY0566',\n InvalidSecretScope: 'PLAY0567',\n DuplicateSecretScope: 'PLAY0568',\n SecretScopeIgnoredForPii: 'PLAY0569',\n InvalidPersonalDataQualifier: 'PLAY0570',\n DuplicateSpecialCategory: 'PLAY0571',\n InvalidPurposeDeclaration: 'PLAY0596',\n InvalidPurposeVocabulary: 'PLAY0597',\n DuplicatePurposeField: 'PLAY0598',\n DuplicatePurposeDeclaration: 'PLAY0599',\n UnknownPurpose: 'PLAY0600',\n PurposeInterestMismatch: 'PLAY0601',\n PersonalDataWithoutPurpose: 'PLAY0602',\n SpecialDataWithoutCondition: 'PLAY0603',\n CriminalDataWithoutAuthorization: 'PLAY0604',\n PurposeWithoutBasis: 'PLAY0605',\n UnusedPurpose: 'PLAY0606',\n // C#-only: opt-in completeness, scoped action/refusal reference validation, and semantic binding.\n ConflictingScreenDataBinding: 'PLAY0530',\n ScreenDataQueryMismatch: 'PLAY0531',\n ActionWithoutInputSurface: 'PLAY0532',\n CommandWithoutInputSurface: 'PLAY0533',\n ReadModelFieldWithoutOrigin: 'PLAY0534',\n QueryParameterNotHeldByView: 'PLAY0535',\n UnconsumedEvent: 'PLAY0536',\n UnreachableScreen: 'PLAY0537',\n UnknownActionSubjectField: 'PLAY0345',\n UnresolvedActionSubject: 'PLAY0346',\n UnreachableActionAlternative: 'PLAY0347',\n UnknownActionArgumentProperty: 'PLAY0348',\n UnreachableRefusalBranch: 'PLAY0540',\n InvalidRefusalValue: 'PLAY0541',\n UnknownRefusalConstraint: 'PLAY0542',\n UnknownRedeliveryReaction: 'PLAY0544',\n IndeterminateNegatedClaimTarget: 'PLAY0546',\n InvalidRefusalBranch: 'PLAY0538',\n InvalidRefusalBranchBody: 'PLAY0539',\n UnmatchedRedeliveredOccurrence: 'PLAY0543',\n InvalidNoEventsExpectation: 'PLAY0545',\n InvalidProducesDeclaration: 'PLAY0042',\n ProducesWhenWithoutEvent: 'PLAY0043',\n InvalidPropertyMapping: 'PLAY0044',\n DuplicateProducesTarget: 'PLAY0193',\n EventSourceIdInPayload: 'PLAY0469',\n ExplicitProducesTargetsRequired: 'PLAY0470',\n RedundantEventId: 'PLAY0471',\n InvalidEventId: 'PLAY0472',\n InlineEventCollision: 'PLAY0473',\n InlineEventOutsideCommand: 'PLAY0474',\n InlineEventGeneration: 'PLAY0475',\n ReservedProductionMetadata: 'PLAY0476',\n InvalidEventDocumentation: 'PLAY0477',\n OmittedProductionDestination: 'PLAY0478',\n UnknownConstraintProperty: 'PLAY0391',\n UnknownTopLevelConstruct: 'PLAY0001',\n InvalidDomainDeclaration: 'PLAY0002',\n DuplicateDomain: 'PLAY0003',\n DomainNotFirst: 'PLAY0004',\n InvalidImportDeclaration: 'PLAY0005',\n TabIndentation: 'PLAY0006',\n InvalidConceptDeclaration: 'PLAY0007',\n UnknownPrimitiveType: 'PLAY0008',\n InvalidEnumerationValue: 'PLAY0009',\n UnknownConceptDirective: 'PLAY0010',\n ValidateReadAsEnumerationBlock: 'PLAY0011',\n AttributeReasonWithoutAttribute: 'PLAY0012',\n DuplicateAttributeReason: 'PLAY0013',\n InvalidTypeDeclaration: 'PLAY0014',\n TypeWithoutProperties: 'PLAY0015',\n InvalidPropertyDeclaration: 'PLAY0016',\n IdentifierOutsideCommand: 'PLAY0017',\n InvalidEventDeclaration: 'PLAY0018',\n IdentifierOnEventProperty: 'PLAY0019',\n TagPropertyReadAsTag: 'PLAY0020',\n InvalidModuleDeclaration: 'PLAY0021',\n UnknownModuleDirective: 'PLAY0022',\n InvalidFeatureDeclaration: 'PLAY0023',\n UnknownFeatureDirective: 'PLAY0024',\n InvalidSliceDeclaration: 'PLAY0027',\n UnknownSliceType: 'PLAY0028',\n UnknownSliceDirective: 'PLAY0029',\n InvalidPersonaDeclaration: 'PLAY0030',\n InvalidPersonaPolicyReference: 'PLAY0031',\n UnknownPersonaDirective: 'PLAY0032',\n InvalidCommandDeclaration: 'PLAY0033',\n UnknownCommandDirective: 'PLAY0034',\n DuplicateCommandIdentifier: 'PLAY0036',\n InvalidQueryDeclaration: 'PLAY0047',\n UnknownQueryDirective: 'PLAY0048',\n InvalidQueryParameter: 'PLAY0049',\n InvalidProjectionDeclaration: 'PLAY0056',\n EmptyProjection: 'PLAY0057',\n UnknownProjectionDirective: 'PLAY0058',\n FromWithoutEvent: 'PLAY0061',\n InvalidEventReference: 'PLAY0062',\n InvalidJoinDeclaration: 'PLAY0063',\n JoinWithoutEvent: 'PLAY0064',\n InvalidChildrenDeclaration: 'PLAY0065',\n InvalidNestedDeclaration: 'PLAY0066',\n NestedBlockWithoutFrom: 'PLAY0067',\n InvalidRemoveDeclaration: 'PLAY0068',\n UnknownRemoveDirective: 'PLAY0069',\n InvalidClearDeclaration: 'PLAY0070',\n ClearWithOutsideNestedBlock: 'PLAY0071',\n InvalidSpecificationDeclaration: 'PLAY0094',\n UnknownSpecificationDirective: 'PLAY0095',\n InvalidSpecificationWhen: 'PLAY0096',\n DuplicateSpecificationWhen: 'PLAY0097',\n InvalidThenError: 'PLAY0098',\n InvalidReadModelStep: 'PLAY0099',\n InvalidEventStep: 'PLAY0100',\n InvalidSpecificationValue: 'PLAY0101',\n InvalidScreenDeclaration: 'PLAY0102',\n UnknownScreenDirective: 'PLAY0103',\n InvalidDataDirective: 'PLAY0104',\n InvalidActionDirective: 'PLAY0105',\n UnknownActionDirective: 'PLAY0106',\n InvalidNavigation: 'PLAY0107',\n InvalidScreenLayoutSlot: 'PLAY0108',\n InvalidTitleDirective: 'PLAY0109',\n UnknownTableDirective: 'PLAY0110',\n UnknownSummaryDirective: 'PLAY0111',\n AuthorizeWithoutPolicy: 'PLAY0122',\n InvalidPolicyReference: 'PLAY0123',\n InvalidConstraintDeclaration: 'PLAY0132',\n ConstraintWithoutRule: 'PLAY0133',\n InvalidConstraintBody: 'PLAY0134',\n DuplicateConstraintBody: 'PLAY0135',\n InvalidReactionDeclaration: 'PLAY0136',\n InvalidReactionTrigger: 'PLAY0137',\n ReactionWithoutTrigger: 'PLAY0138',\n InvalidValidateDeclaration: 'PLAY0140',\n InvalidValidationRule: 'PLAY0141',\n InvalidRuleName: 'PLAY0143',\n UnknownRuleImplementationDirective: 'PLAY0144',\n InvalidDescription: 'PLAY0145',\n EmptyDescription: 'PLAY0146',\n DuplicateDescription: 'PLAY0147',\n TagWithoutValue: 'PLAY0148',\n InvalidTagValue: 'PLAY0149',\n UnknownContextPath: 'PLAY0153',\n UnknownContextCausedByProperty: 'PLAY0154',\n UnknownContextIdentityProperty: 'PLAY0155',\n ExpectedCodeFence: 'PLAY0163',\n UnclosedCodeBlock: 'PLAY0164',\n DuplicateDeclaration: 'PLAY0168',\n RepeatedSingularDeclarationAcrossFiles: 'PLAY0172',\n RepeatedDeclarationAcrossFiles: 'PLAY0173',\n ConflictingDescriptionAcrossFiles: 'PLAY0174',\n UnexpectedTokenInAuthorize: 'PLAY0184',\n UnclosedAuthorizeGroup: 'PLAY0185',\n InvalidReadModelDeclaration: 'PLAY0186',\n InvalidInvokesDeclaration: 'PLAY0194',\n InvalidScopeDeclaration: 'PLAY0199',\n DuplicateScope: 'PLAY0200',\n InvalidIntervalTrigger: 'PLAY0249',\n InvalidScheduleTrigger: 'PLAY0250',\n DuplicateReactionTrigger: 'PLAY0253',\n InvalidSpecificationEventSource: 'PLAY0275',\n DuplicateSpecificationEventSource: 'PLAY0276',\n InvalidProjectionVariantDeclaration: 'PLAY0277',\n InvalidEntersOnDeclaration: 'PLAY0279',\n NestedProjectionVariantNotAllowed: 'PLAY0280',\n InvalidStructuredValue: 'PLAY0291',\n DuplicateStructuredValueMember: 'PLAY0294',\n ConflictingSpecificationActions: 'PLAY0358',\n InvalidSpecificationEventOrder: 'PLAY0359',\n InvalidValidationSeverity: 'PLAY0368',\n VariantRequiresEnteringEvent: 'PLAY0382',\n DuplicateProjectionVariant: 'PLAY0384',\n DuplicateVariantEnteringEvent: 'PLAY0385',\n InvalidSpecificationDenied: 'PLAY0388',\n DuplicateAuthorizationAcrossFiles: 'PLAY0394',\n FileConstraintOnlySupportsUniqueness: 'PLAY0396',\n LegacyInlineCodeFence: 'PLAY0397',\n InvalidEventGeneration: 'PLAY0446',\n InvalidFileImport: 'PLAY0454',\n FileImportMatchesNothing: 'PLAY0455',\n ImportedFileNotFound: 'PLAY0456',\n ConflictingImportPlacement: 'PLAY0457',\n ImportCycle: 'PLAY0458',\n ModuleInPlacedFile: 'PLAY0459',\n UnexpectedInPlacedFile: 'PLAY0460',\n InvalidSpecificationClock: 'PLAY0461',\n InvalidSpecificationTrigger: 'PLAY0462',\n InvalidSpecificationCapture: 'PLAY0463',\n InvalidSpecificationQueryAction: 'PLAY0464',\n InvalidSpecificationQuery: 'PLAY0265',\n UnknownSpecificationQueryDirective: 'PLAY0266',\n DuplicateSpecificationQueryArguments: 'PLAY0267',\n InvalidAbsentReadModelStep: 'PLAY0453',\n LegacyOptionalSuffix: 'PLAY0479',\n InvalidOptionalModifierOrder: 'PLAY0480',\n OptionalReadsNotSupported: 'PLAY0481',\n InvalidSpecificationCaller: 'PLAY0386',\n DuplicateSpecificationCallerOrDenied: 'PLAY0387',\n GeneratedPropertyOutsideCommand: 'PLAY0482',\n InvalidGeneratedType: 'PLAY0483',\n InvalidGeneratedModifierOrder: 'PLAY0484',\n DuplicateEventSubject: 'PLAY0590',\n InvalidSubjectType: 'PLAY0591',\n ProtectedSubjectType: 'PLAY0592',\n InvalidSubjectOwner: 'PLAY0593',\n ReadModelSubjectNotSupported: 'PLAY0594',\n InvalidSubjectModifierOrder: 'PLAY0595',\n GeneratedPropertySuppliedAsInput: 'PLAY0485',\n InvalidCommandResponse: 'PLAY0486',\n InvalidResponseSource: 'PLAY0487',\n DuplicateResponseField: 'PLAY0488',\n InvalidResponseShape: 'PLAY0489',\n InvalidGeneratedFixture: 'PLAY0490',\n InvalidReturnExpectation: 'PLAY0491',\n InvalidImplementationBlock: 'PLAY0492',\n InvalidImplementationHint: 'PLAY0493',\n ConflictingImplementationSources: 'PLAY0494',\n UnknownType: 'PLAY0165',\n InvalidSystemDeclaration: 'PLAY0495',\n InvalidOperationDeclaration: 'PLAY0496',\n InvalidProductionReference: 'PLAY0497',\n ProductionDeclarationCollision: 'PLAY0498',\n OperationOutsideCommand: 'PLAY0499',\n InvalidSystemReference: 'PLAY0500',\n InvalidOperationMapping: 'PLAY0501',\n InvalidOperationSpecification: 'PLAY0502',\n InvalidCaptureDeclaration: 'PLAY0078',\n UnknownCaptureDirective: 'PLAY0079',\n InvalidMapEntry: 'PLAY0080',\n InvalidTranslation: 'PLAY0081',\n InvalidSplitDeclaration: 'PLAY0082',\n InvalidSplitTarget: 'PLAY0083',\n InvalidAppendDeclaration: 'PLAY0084',\n UnknownAppendDirective: 'PLAY0085',\n WhenWithoutTrigger: 'PLAY0086',\n InvalidWhenClause: 'PLAY0087',\n InvalidWhenTransitionClause: 'PLAY0088',\n MixedWhenCombinators: 'PLAY0089',\n WhenCombinatorWithoutProperty: 'PLAY0090',\n UnknownCaptureBlockDirective: 'PLAY0091',\n InvalidCompositeKeyPart: 'PLAY0072',\n TemplateInCompositeKey: 'PLAY0073',\n EmptyCompositeKey: 'PLAY0074',\n InvalidProjectionMapping: 'PLAY0075',\n ExpectedLiteralValue: 'PLAY0150',\n InvalidExpression: 'PLAY0152',\n UnterminatedInterpolation: 'PLAY0157',\n UnterminatedTemplateExpression: 'PLAY0156',\n ProjectionDocumentWithoutProjection: 'PLAY0055',\n CaptureDocumentWithoutCapture: 'PLAY0077',\n SpecificationDocumentWithoutSpecification: 'PLAY0093',\n InvalidSeedDeclaration: 'PLAY0128',\n InvalidSeedGroup: 'PLAY0129',\n InvalidSeedEvent: 'PLAY0130',\n InvalidSeedPropertyAssignment: 'PLAY0131',\n InvalidPolicyDeclaration: 'PLAY0112',\n UnknownPolicyDirective: 'PLAY0113',\n PolicyWithoutRequirement: 'PLAY0114',\n ExpectedRoleName: 'PLAY0118',\n ExpectedClaimName: 'PLAY0119',\n ExpectedClaimMatches: 'PLAY0120',\n ExpectedClaimMatchTarget: 'PLAY0121',\n MixedPolicyImplementation: 'PLAY0440',\n RepeatedPolicyRequirement: 'PLAY0441',\n UnexpectedTokenInPolicyCondition: 'PLAY0115',\n ExpectedPolicyCondition: 'PLAY0116',\n UnclosedPolicyConditionGroup: 'PLAY0117',\n UnexpectedTokenInCondition: 'PLAY0158',\n ExpectedCondition: 'PLAY0159',\n ExpectedComparisonOperator: 'PLAY0161',\n ExpectedComparisonValue: 'PLAY0162',\n InvalidActionAlternative: 'PLAY0341',\n GuardedActionWithoutAlternatives: 'PLAY0342',\n MisplacedActionOtherwise: 'PLAY0343',\n UnsupportedActionConditionOperand: 'PLAY0344',\n InvalidInteractionArgument: 'PLAY0319',\n UnclosedConditionGroup: 'PLAY0160',\n InvalidNumericDirective: 'PLAY0508',\n DuplicateNumericDirective: 'PLAY0509',\n LateNumericDirective: 'PLAY0510',\n InexactNumericLiteral: 'PLAY0511',\n MixedNumericModes: 'PLAY0512',\n IncompatibleNumericSource: 'PLAY0513',\n EventFromLaterSlice: 'PLAY0516',\n TimelineCycleGroup: 'PLAY0517',\n InvalidSpecificationExample: 'PLAY0518',\n DuplicateSpecificationAssignment: 'PLAY0519',\n UnresolvedSpecificationExampleType: 'PLAY0520',\n SpecificationExampleNameCollision: 'PLAY0521',\n SpecificationExampleKindMismatch: 'PLAY0522',\n InvalidSpecificationExampleValue: 'PLAY0523',\n MissingSpecificationProperty: 'PLAY0524',\n UnadmittedSpecificationExampleValue: 'PLAY0525',\n InvalidSpecificationExampleBody: 'PLAY0526',\n AmbiguousReference: 'PLAY0198',\n InvalidSpecificationStream: 'PLAY0547',\n SpecificationStreamOnCommand: 'PLAY0548',\n InvalidSpecificationStreamRoute: 'PLAY0549',\n InvalidSpecificationStreamEventSource: 'PLAY0550',\n SpecificationStreamContradictsCommand: 'PLAY0551',\n InvalidDependencyTarget: 'PLAY0554',\n RepeatedDependencyDeclaration: 'PLAY0555',\n UndeclaredDependency: 'PLAY0552',\n UnusedDependencyDeclaration: 'PLAY0553',\n MutualDependencyDeclarations: 'PLAY0556',\n AuthorizationRefusalWithoutIdentity: 'PLAY0557',\n InvalidDocumentation: 'PLAY0558',\n ConflictingDocumentationAcrossFiles: 'PLAY0559',\n InvalidSpecificationCallerPersona: 'PLAY0572',\n UnsynthesizablePersonaCaller: 'PLAY0573',\n PersonaWithoutGate: 'PLAY0574',\n GateWithoutPersona: 'PLAY0575',\n AmbiguousPersonaCaller: 'PLAY0576',\n InvalidSpecificationParameter: 'PLAY0577',\n InvalidSpecificationCase: 'PLAY0578',\n DuplicateSpecificationParameter: 'PLAY0579',\n DuplicateSpecificationCase: 'PLAY0580',\n IncompleteSpecificationTable: 'PLAY0581',\n InvalidSpecificationCaseAssignment: 'PLAY0582',\n InvalidSpecificationCaseValue: 'PLAY0583',\n InvalidSpecificationCaseReference: 'PLAY0584',\n OptionalSpecificationParameterTarget: 'PLAY0585',\n SpecificationCaseNameCollision: 'PLAY0586',\n IncompatibleSpecificationParameterType: 'PLAY0587',\n UnusedSpecificationParameter: 'PLAY0588',\n SingularSpecificationTableExpansion: 'PLAY0589',\n UnsupportedInteractionAlternatives: 'PLAY0560',\n MixedInteractionAlternatives: 'PLAY0561',\n InteractionAlternativeWithoutActions: 'PLAY0562',\n InlineInteractionAlternative: 'PLAY0563',\n LegacyInteractionWhere: 'PLAY0564',\n InvalidEventSourceDeclaration: 'PLAY0503',\n InvalidCommandStream: 'PLAY0504',\n AmbiguousCommandStream: 'PLAY0505',\n UnsupportedStreamIdType: 'PLAY0506',\n RedundantSourceStreamId: 'PLAY0507',\n UnknownEvent: 'PLAY0166',\n UnknownReadModelProperty: 'PLAY0514',\n PiiNotSupportedOnIdentifier: 'PLAY0515',\n HandlerWithoutImplementation: 'PLAY0045',\n UnknownHandlerDirective: 'PLAY0046',\n CommandWithProducesAndHandler: 'PLAY0035',\n AbsoluteFileReference: 'PLAY0264',\n InvalidTriggerData: 'PLAY0246',\n} as const;\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nconst wordCharacters = '\\\\p{L}\\\\p{Mn}\\\\p{Nd}\\\\p{Pc}';\n\n// The characters .NET '\\s' matches. JavaScript '\\s' differs: it also accepts U+FEFF and not U+0085. Interpolate this\n// into newly modeled grammar that must agree with the C# parser.\nexport const dotNetWhitespace = '[\\\\u0009-\\\\u000d\\\\u0020\\\\u0085\\\\u00a0\\\\u1680\\\\u2000-\\\\u200a\\\\u2028\\\\u2029\\\\u202f\\\\u205f\\\\u3000]';\n\n// .NET Regex classifies UTF-16 code units: supplementary letters are not \\w. Use this\n// scoped helper only in newly modeled grammar, without changing established Legacy parsers.\nexport function nativePattern(source: string): RegExp {\n const word = `(?=[\\\\u0000-\\\\uFFFF])[${wordCharacters}]`;\n const classes = source.replace(/\\[([^\\]]*\\\\w[^\\]]*)\\]/g, (_match, body: string) => {\n const rest = body.replaceAll('\\\\w', '');\n return rest === '' ? `(?:${word})` : `(?:${word}|[${rest}])`;\n });\n return new RegExp(classes.replaceAll('\\\\w', `(?:${word})`), 'u');\n}\n\n// Builds a regular expression from a pattern written the way the C# parser writes it. In .NET '\\w' is a\n// Unicode word character; in JavaScript it is ASCII only, so it is rewritten to the same Unicode classes\n// and the expression runs in Unicode mode. '\\d' is likewise any Unicode decimal digit. Copying a C# pattern verbatim therefore keeps its meaning.\nexport function pattern(source: string): RegExp {\n let result = '';\n let inClass = false;\n for (let index = 0; index < source.length; index++) {\n const current = source[index];\n if (current === '\\\\' && index + 1 < source.length) {\n const next = source[index + 1];\n index++;\n if (next === 'w') {\n result += inClass ? wordCharacters : `[${wordCharacters}]`;\n } else if (next === 'd') {\n result += '\\\\p{Nd}';\n } else {\n result += `\\\\${next}`;\n }\n continue;\n }\n if (current === '[' && !inClass) {\n inClass = true;\n } else if (current === ']' && inClass) {\n inClass = false;\n }\n result += current;\n }\n return new RegExp(result, 'u');\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { dotNetWhitespace } from '../Text/patterns';\nimport { SourceLine } from './SourceLine';\n\nconst dependencyPrefix = new RegExp(`^depends${dotNetWhitespace}+on(?:${dotNetWhitespace}|$)`, 'u');\nconst dependencyTrailingWhitespace = new RegExp(`${dotNetWhitespace}+$`, 'u');\n\n// Splits a document into lines the way the C# SourceLineSplitter does: a line's indent is its leading\n// whitespace, and its content is what follows with any comment and trailing whitespace removed. A comment\n// starts at '//' (or '#' in the sub-languages that use it) outside a string or a template literal.\nexport function splitLines(source: string, hashComments = false, path?: string): SourceLine[] {\n const result: SourceLine[] = [];\n let number = 0;\n let offset = 0;\n for (const raw of source.split('\\n')) {\n number++;\n const line = raw.endsWith('\\r') ? raw.replace(/\\r+$/, '') : raw;\n const indent = line.length - line.trimStart().length;\n const body = stripComment(line.substring(indent), hashComments);\n // Dependency grammar follows .NET's whitespace exactly, including NEL but not FEFF.\n const content = dependencyPrefix.test(body) ? body.replace(dependencyTrailingWhitespace, '') : body.trimEnd();\n result.push(path === undefined\n ? { number, raw: line, indent, content, startOffset: offset }\n : { number, raw: line, indent, content, path, startOffset: offset });\n offset += raw.length + 1;\n }\n return result;\n}\n\n// The index a comment starts at in the text, or -1 when it has none.\nexport function commentStart(text: string, hashComments = false): number {\n let inString = false;\n let inTemplate = false;\n for (let index = 0; index < text.length; index++) {\n const current = text[index];\n if (current === '\\\\' && inString && index + 1 < text.length) {\n index++;\n } else if (current === '\"' && !inTemplate) {\n inString = !inString;\n } else if (current === '`' && !inString) {\n inTemplate = !inTemplate;\n } else if (!inString && !inTemplate) {\n if (current === '/' && index + 1 < text.length && text[index + 1] === '/') {\n return index;\n }\n if (hashComments && current === '#') {\n return index;\n }\n }\n }\n return -1;\n}\n\nfunction stripComment(text: string, hashComments: boolean): string {\n const comment = commentStart(text, hashComments);\n return comment < 0 ? text : text.substring(0, comment);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { EventSyntax } from './Declarations';\nimport { SliceSyntax } from './Structure';\n\n// An inline event belongs to its slice, not its command. Keep the authored tree intact.\nexport function eventDeclarations(slice: SliceSyntax): readonly EventSyntax[] {\n return [...slice.events, ...slice.commands.flatMap(command => command.produces).flatMap(produced => produced.inlineEvent === null ? [] : [produced.inlineEvent])];\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { OperationSyntax } from './OperationSyntax';\nimport { SliceSyntax } from './Structure';\n\nexport type { SystemSyntax } from './SystemSyntax';\nexport type { OperationSyntax } from './OperationSyntax';\nexport type { OperationPhaseSyntax } from './OperationPhaseSyntax';\n\nexport function operationDeclarations(slice: SliceSyntax): readonly OperationSyntax[] {\n return [...slice.operations ?? [], ...slice.commands.flatMap(command => command.produces).flatMap(production => production.inlineOperation == null ? [] : [production.inlineOperation])];\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nexport enum AuthoringProductionKind {\n Event = 'event',\n Operation = 'operation',\n Unresolved = 'unresolved',\n Ambiguous = 'ambiguous',\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { eventDeclarations } from './EventDeclarations';\nimport { EventSyntax } from './Declarations';\nimport { operationDeclarations } from './Operations';\nimport { ProducesSyntax } from './Reactions';\nimport { ApplicationSyntax, FeatureSyntax, SliceSyntax } from './Structure';\n\nimport { AuthoringProductionKind } from './AuthoringProductionKind';\nimport { AuthoringProductionDeclaration } from './AuthoringProductionDeclaration';\nimport { AuthoringProductionResolution } from './AuthoringProductionResolution';\n\nexport { AuthoringProductionKind } from './AuthoringProductionKind';\nexport type { AuthoringProductionDeclaration } from './AuthoringProductionDeclaration';\nexport type { AuthoringProductionResolution } from './AuthoringProductionResolution';\n\nexport class AuthoringProductionResolver {\n readonly declarations: AuthoringProductionDeclaration[] = [];\n readonly slices: { slice: SliceSyntax; scope: readonly string[] }[] = [];\n private readonly byName = new Map<string, AuthoringProductionDeclaration[]>();\n private readonly scopes = new Map<SliceSyntax, readonly string[]>();\n private readonly resolutions = new Map<SliceSyntax, Map<string, AuthoringProductionResolution>>();\n\n constructor(application: ApplicationSyntax, declarations?: readonly AuthoringProductionDeclaration[]) {\n const collect = (features: readonly FeatureSyntax[], parent: readonly string[]): void => {\n for (const feature of features) {\n const scope = [...parent, feature.name];\n for (const slice of feature.slices) this.slices.push({ slice, scope: [...scope, slice.name] });\n collect(feature.features, scope);\n }\n };\n application.modules.forEach(module => collect(module.features, [module.name]));\n for (const { slice, scope } of this.slices) {\n this.scopes.set(slice, scope);\n const events = new Map<string, EventSyntax[]>();\n for (const event of eventDeclarations(slice)) {\n const generations = events.get(event.name) ?? [];\n generations.push(event);\n events.set(event.name, generations);\n }\n // Historical shapes are one logical contract. Duplicate generations remain\n // competing declarations; never erase invalid collision evidence.\n const logicalEvents = [...events.values()].flatMap(generations => new Set(generations.map(event => event.generation)).size !== generations.length\n ? generations : [generations.reduce((latest, event) => latest.generation >= event.generation ? latest : event)]);\n this.declarations.push(...logicalEvents.map(node => ({ kind: AuthoringProductionKind.Event as const, name: node.name, node, scope })),\n ...operationDeclarations(slice).map(node => ({ kind: AuthoringProductionKind.Operation as const, name: node.name, node, scope })));\n }\n if (declarations !== undefined) this.declarations.splice(0, this.declarations.length, ...declarations);\n for (const entry of this.declarations) {\n const named = this.byName.get(entry.name) ?? [];\n named.push(entry);\n this.byName.set(entry.name, named);\n }\n }\n\n resolve(reference: string, slice: SliceSyntax): AuthoringProductionResolution {\n const scope = this.scopes.get(slice);\n if (scope === undefined) return { kind: AuthoringProductionKind.Unresolved, declaration: null, candidates: [] };\n const cache = this.resolutions.get(slice) ?? new Map<string, AuthoringProductionResolution>();\n const cached = cache.get(reference);\n if (cached !== undefined) return cached;\n const resolution = this.resolveFromScope(reference, scope);\n cache.set(reference, resolution);\n this.resolutions.set(slice, cache);\n return resolution;\n }\n\n resolveFromScope(reference: string, scope: readonly string[]): AuthoringProductionResolution {\n const candidates = this.candidates(reference, scope);\n return candidates.length === 1\n ? { kind: candidates[0].kind, declaration: candidates[0], candidates: [] }\n : { kind: candidates.length === 0 ? AuthoringProductionKind.Unresolved : AuthoringProductionKind.Ambiguous, declaration: null, candidates };\n }\n\n isOperation(production: ProducesSyntax, slice: SliceSyntax): boolean {\n return production.inlineOperation != null || this.resolve(production.event, slice).kind === AuthoringProductionKind.Operation;\n }\n\n isEventProduction(production: ProducesSyntax, slice: SliceSyntax): boolean {\n if (production.inlineOperation != null) return false;\n const resolution = this.resolve(production.event, slice);\n return resolution.kind !== AuthoringProductionKind.Operation && !(resolution.kind === AuthoringProductionKind.Ambiguous && resolution.candidates.some(candidate => candidate.kind === AuthoringProductionKind.Operation));\n }\n\n private candidates(reference: string, from: readonly string[]): AuthoringProductionDeclaration[] {\n const segments = reference.split('.').filter(segment => segment.length > 0);\n if (segments.length === 0) return [];\n const named = this.byName.get(segments.at(-1)!) ?? [];\n const qualifiers = segments.slice(0, -1);\n if (qualifiers.length > 0) return named.filter(entry => qualifiers.length <= entry.scope.length && qualifiers.every((value, index) => entry.scope[entry.scope.length - qualifiers.length + index] === value));\n for (let depth = from.length; depth >= 0; depth--) {\n const visible = named.filter(entry => depth <= entry.scope.length && from.slice(0, depth).every((value, index) => entry.scope[index] === value));\n if (visible.length > 0) return visible;\n }\n return [];\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ConcurrencySyntax } from './ConcurrencySyntax';\nimport { ReadsSyntax } from './ReadsSyntax';\nimport { ReducerSyntax } from './ReducerSyntax';\nimport { TriggerDataSyntax } from './TriggerDataSyntax';\nimport { SyntaxNode } from './SyntaxNode';\n\nexport type { ConcurrencySyntax } from './ConcurrencySyntax';\nexport type { ReadsSyntax } from './ReadsSyntax';\nexport type { ReducerSyntax } from './ReducerSyntax';\nexport type { ReducerRuleSyntax } from './ReducerRuleSyntax';\nexport type { FormSyntax } from './FormSyntax';\nexport type { FormPopulateViaQuerySyntax } from './FormPopulateViaQuerySyntax';\nexport type { TriggerDataSyntax } from './TriggerDataSyntax';\n\nexport interface DependencySources {\n readonly data?: readonly TriggerDataSyntax[];\n readonly reads?: readonly ReadsSyntax[];\n readonly concurrency?: ConcurrencySyntax | null;\n readonly reducers?: readonly ReducerSyntax[];\n}\n\n// These formerly opaque constructs are captured only for explicit syntax references, not realization.\n// Keep their partial payloads outside the narrowed wire contract and existing walker/board consumers.\n// Nodes and member names follow C#; none of this metadata claims executable admission.\nexport const dependencySources = new WeakMap<SyntaxNode, DependencySources>();\nexport const dependencySourcesOf = (node: SyntaxNode): DependencySources => dependencySources.get(node) ?? {};\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { IdentitySyntax } from './IdentitySyntax';\nimport { IdentityDetailSyntax } from './IdentityDetailSyntax';\nimport { IdentitySourceSyntax } from './IdentitySourceSyntax';\nimport { ClaimIdentitySourceSyntax } from './ClaimIdentitySourceSyntax';\nimport { QueryIdentitySourceSyntax } from './QueryIdentitySourceSyntax';\nimport { CodeIdentitySourceSyntax } from './CodeIdentitySourceSyntax';\nimport { FileIdentitySourceSyntax } from './FileIdentitySourceSyntax';\nimport { AuthorizeSyntax, PersonaSyntax, PolicyRequirementSyntax } from './Authorization';\nimport { CaptureAppendSyntax, CaptureChildrenSyntax, CaptureMapOperationSyntax, CaptureNestedSyntax, CaptureSourceSettingSyntax, CaptureSourceSyntax, CaptureSyntax } from './Captures';\nimport { CommandSyntax, ValidateSyntax, ValidationRuleSyntax } from './Commands';\nimport { ConstraintSyntax } from './Constraints';\nimport { ConditionSyntax } from './Conditions';\nimport { PolicyConditionSyntax, PolicySyntax } from './Policies';\nimport { SeedSyntax } from './Seeds';\nimport { ConceptSyntax, DomainSyntax, EventSyntax, ImportSyntax, PropertySyntax, ReadModelSyntax, TagSyntax, TypeRefSyntax, TypeSyntax } from './Declarations';\nimport { IdentityExpressionSyntax, ExpressionSyntax, ObjectMemberSyntax, PropertyMappingSyntax } from './Expressions';\nimport { JoinEventSyntax, KeySyntax, MappingSyntax, ProjectionBlockSyntax, ProjectionSyntax } from './Projections';\nimport { CommandStreamSyntax, EventSourceSyntax, EventStreamSyntax } from './EventSources';\nimport { QueryParameterSyntax, QuerySyntax } from './Queries';\nimport { InvocationRefusalSyntax } from './InvocationRefusalSyntax';\nimport { SpecificationRedeliverySyntax } from './SpecificationRedeliverySyntax';\nimport { InvokesSyntax, ProducesSyntax, ReactionSyntax, ReactionTriggerSyntax, TriggerSourceSyntax } from './Reactions';\nimport { InteractionArgumentSyntax, ScreenActionAlternativeSyntax, ScreenActionOtherwiseSyntax, ScreenDirectiveSyntax, ScreenGuardedActionSyntax, ScreenSyntax } from './Screens';\nimport {\n SpecificationExampleSyntax, SpecificationCaptureSyntax, SpecificationClockSyntax, SpecificationCommandSyntax, SpecificationEventSyntax, SpecificationQueryResultSyntax, SpecificationStreamSyntax, SpecificationNoStreamSyntax,\n SpecificationReadModelSyntax, SpecificationOperationFailureSyntax, SpecificationOperationSyntax, SpecificationCompensatedSyntax, SpecificationSyntax, SpecificationTriggerSyntax, SpecificationWhenQuerySyntax,\n} from './Specifications';\nimport { ApplicationSyntax, DependsOnSyntax, FeatureSyntax, FileImportSyntax, ModuleSyntax, SliceSyntax } from './Structure';\nimport { CommandResponseSyntax, PropertyResponseSourceSyntax, RecordCommandResponseSyntax, RecordSpecificationReturnSyntax, ResponseFieldSyntax, ScalarCommandResponseSyntax, ScalarSpecificationReturnSyntax, SpecificationReturnSyntax } from './Responses';\nimport { EventStreamIdPartSyntax } from './EventStreamIdPartSyntax';\nimport { SyntaxNode } from './SyntaxNode';\nimport { PurposeSyntax, PurposeReferenceSyntax, PurposeTransferSyntax } from './Purposes';\nimport { OperationSyntax, OperationPhaseSyntax, SystemSyntax } from './Operations';\nimport { CodeBlockSyntax, FileReferenceSyntax, HandlerSyntax, ImplementationSyntax, ImplementationHintSyntax } from './Implementations';\nimport { ReadsSyntax, ConcurrencySyntax, ReducerSyntax, ReducerRuleSyntax, FormSyntax, TriggerDataSyntax } from './DependencySources';\n\n// Walks a whole syntax tree, depth first, in the order the C# ScreenplaySyntaxWalker does. Every visit\n// method calls visitNode and then walks the node's children, so an emitter overrides only the nodes it\n// cares about - and calls the base method when it still wants the children walked.\nexport abstract class ScreenplaySyntaxWalker {\n visitNode(_node: SyntaxNode): void {}\n\n visitApplication(syntax: ApplicationSyntax): void {\n this.visitNode(syntax);\n if (syntax.domain !== null) this.visitDomain(syntax.domain);\n syntax.imports.forEach(node => this.visitImport(node));\n syntax.fileImports.forEach(node => this.visitFileImport(node));\n syntax.systems?.forEach(node => this.visitSystem(node));\n syntax.eventSources?.forEach(node => this.visitEventSource(node));\n syntax.concepts.forEach(node => this.visitConcept(node));\n syntax.types.forEach(node => this.visitType(node));\n syntax.personas.forEach(node => this.visitPersona(node));\n syntax.policies?.forEach(node => this.visitPolicy(node));\n syntax.exposures?.forEach(node => {\n this.visitNode(node);\n node.properties.forEach(property => this.visitNode(property));\n });\n syntax.instanceContributions?.forEach(node => {\n this.visitNode(node);\n node.contributions.forEach(contribution => {\n this.visitNode(contribution);\n if (contribution.value !== null) this.visitExpression(contribution.value);\n contribution.items.forEach(item => {\n this.visitNode(item);\n item.values.forEach(value => {\n this.visitNode(value);\n this.visitExpression(value.value);\n });\n });\n });\n });\n if (syntax.identity != null) this.visitIdentity(syntax.identity);\n syntax.purposes?.forEach(node => this.visitPurpose(node));\n syntax.seeds?.forEach(node => this.visitSeed(node));\n syntax.modules.forEach(node => this.visitModule(node));\n syntax.examples?.forEach(node => this.visitSpecificationExample(node));\n }\n\n visitIdentity(syntax: IdentitySyntax): void {\n this.visitNode(syntax);\n syntax.details.forEach(detail => this.visitIdentityDetail(detail));\n }\n\n visitIdentityDetail(syntax: IdentityDetailSyntax): void {\n this.visitNode(syntax);\n this.visitTypeRef(syntax.type);\n this.visitIdentitySource(syntax.source);\n }\n\n visitIdentitySource(syntax: IdentitySourceSyntax): void {\n switch (syntax.kind) {\n case 'ClaimIdentitySourceSyntax': this.visitClaimIdentitySource(syntax); break;\n case 'QueryIdentitySourceSyntax': this.visitQueryIdentitySource(syntax); break;\n case 'CodeIdentitySourceSyntax': this.visitCodeIdentitySource(syntax); break;\n case 'FileIdentitySourceSyntax': this.visitFileIdentitySource(syntax); break;\n default: this.visitNode(syntax); break;\n }\n }\n\n visitClaimIdentitySource(syntax: ClaimIdentitySourceSyntax): void { this.visitNode(syntax); }\n visitQueryIdentitySource(syntax: QueryIdentitySourceSyntax): void { this.visitNode(syntax); this.visitExpression(syntax.by); }\n visitCodeIdentitySource(syntax: CodeIdentitySourceSyntax): void { this.visitNode(syntax); this.visitCodeBlock(syntax.code); }\n visitFileIdentitySource(syntax: FileIdentitySourceSyntax): void { this.visitNode(syntax); this.visitFileReference(syntax.file); }\n\n visitPurpose(syntax: PurposeSyntax): void {\n this.visitNode(syntax);\n syntax.transfers.forEach(node => this.visitPurposeTransfer(node));\n }\n\n visitPurposeReference(syntax: PurposeReferenceSyntax): void { this.visitNode(syntax); }\n visitPurposeTransfer(syntax: PurposeTransferSyntax): void { this.visitNode(syntax); }\n\n visitPolicy(syntax: PolicySyntax): void {\n this.visitNode(syntax);\n if (syntax.condition !== null) this.visitPolicyCondition(syntax.condition);\n if (syntax.code !== null) this.visitCodeBlock(syntax.code);\n if (syntax.file !== null) this.visitFileReference(syntax.file);\n }\n\n visitPolicyCondition(syntax: PolicyConditionSyntax): void {\n this.visitNode(syntax);\n if (syntax.kind === 'ClaimConditionSyntax' && syntax.matches !== null) this.visitExpression(syntax.matches);\n if (syntax.kind === 'NotPolicyConditionSyntax') this.visitPolicyCondition(syntax.operand);\n if (syntax.kind === 'LogicalPolicyConditionSyntax') { this.visitPolicyCondition(syntax.left); this.visitPolicyCondition(syntax.right); }\n }\n\n visitSeed(syntax: SeedSyntax): void {\n this.visitNode(syntax);\n syntax.groups.forEach(group => {\n this.visitNode(group);\n group.events.forEach(event => { this.visitNode(event); event.properties.forEach(property => this.visitPropertyMapping(property)); });\n });\n }\n\n visitPersona(syntax: PersonaSyntax): void {\n this.visitNode(syntax);\n }\n\n visitAuthorize(syntax: AuthorizeSyntax): void {\n this.visitNode(syntax);\n this.visitPolicyRequirement(syntax.requirement);\n }\n\n visitPolicyRequirement(syntax: PolicyRequirementSyntax): void {\n this.visitNode(syntax);\n if (syntax.kind === 'LogicalPolicyRequirementSyntax') {\n this.visitPolicyRequirement(syntax.left);\n this.visitPolicyRequirement(syntax.right);\n }\n }\n\n visitDomain(syntax: DomainSyntax): void {\n this.visitNode(syntax);\n }\n\n visitImport(syntax: ImportSyntax): void {\n this.visitNode(syntax);\n }\n\n visitFileImport(syntax: FileImportSyntax): void {\n this.visitNode(syntax);\n }\n\n visitConcept(syntax: ConceptSyntax): void {\n this.visitNode(syntax);\n syntax.attributes.forEach(node => this.visitNode(node));\n syntax.validations?.forEach(node => this.visitValidate(node));\n }\n\n visitType(syntax: TypeSyntax): void {\n this.visitNode(syntax);\n syntax.properties.forEach(node => this.visitProperty(node));\n }\n\n visitDependsOn(syntax: DependsOnSyntax): void { this.visitNode(syntax); }\n\n visitModule(syntax: ModuleSyntax): void {\n this.visitNode(syntax);\n syntax.purposes?.forEach(node => this.visitPurposeReference(node));\n syntax.examples?.forEach(node => this.visitSpecificationExample(node));\n syntax.dependsOn?.forEach(node => this.visitDependsOn(node));\n syntax.fileImports.forEach(node => this.visitFileImport(node));\n if (syntax.authorize !== null) this.visitAuthorize(syntax.authorize);\n syntax.features.forEach(node => this.visitFeature(node));\n }\n\n visitFeature(syntax: FeatureSyntax): void {\n this.visitNode(syntax);\n syntax.purposes?.forEach(node => this.visitPurposeReference(node));\n syntax.examples?.forEach(node => this.visitSpecificationExample(node));\n syntax.dependsOn?.forEach(node => this.visitDependsOn(node));\n syntax.fileImports.forEach(node => this.visitFileImport(node));\n if (syntax.authorize !== null) this.visitAuthorize(syntax.authorize);\n syntax.features.forEach(node => this.visitFeature(node));\n syntax.slices.forEach(node => this.visitSlice(node));\n }\n\n visitSlice(syntax: SliceSyntax): void {\n this.visitNode(syntax);\n syntax.purposes?.forEach(node => this.visitPurposeReference(node));\n syntax.examples?.forEach(node => this.visitSpecificationExample(node));\n syntax.commands.forEach(node => this.visitCommand(node));\n syntax.operations?.forEach(node => this.visitOperation(node));\n syntax.events.forEach(node => this.visitEvent(node));\n syntax.constraints.forEach(node => this.visitConstraint(node));\n syntax.queries.forEach(node => this.visitQuery(node));\n syntax.projections.forEach(node => this.visitProjection(node));\n syntax.readModels.forEach(node => this.visitReadModel(node));\n syntax.captures.forEach(node => this.visitCapture(node));\n syntax.reactions.forEach(node => this.visitReaction(node));\n syntax.screens.forEach(node => this.visitScreen(node));\n syntax.specifications.forEach(node => this.visitSpecification(node));\n }\n\n // Explicit reference-only entry points. Default tree traversal remains the narrowed wire traversal;\n // dependency consumers opt into parser-owned side-table payloads rather than changing board visitors.\n visitTriggerData(syntax: TriggerDataSyntax): void {\n this.visitNode(syntax);\n if (syntax.type !== null) this.visitTypeRef(syntax.type);\n }\n visitReads(syntax: ReadsSyntax): void { this.visitNode(syntax); }\n visitConcurrency(syntax: ConcurrencySyntax): void { this.visitNode(syntax); }\n visitReducer(syntax: ReducerSyntax): void {\n this.visitNode(syntax);\n syntax.rules.forEach(node => this.visitReducerRule(node));\n }\n visitReducerRule(syntax: ReducerRuleSyntax): void {\n this.visitNode(syntax);\n if (syntax.file !== null) this.visitFileReference(syntax.file);\n if (syntax.code !== null) this.visitCodeBlock(syntax.code);\n }\n visitForm(syntax: FormSyntax): void {\n this.visitNode(syntax);\n if (syntax.populate !== null) this.visitNode(syntax.populate);\n syntax.fields.forEach(node => this.visitNode(node));\n syntax.columns?.forEach(node => this.visitNode(node));\n if (syntax.layout !== null && syntax.layout !== undefined) {\n this.visitNode(syntax.layout);\n syntax.layout.columns.forEach(column => {\n this.visitNode(column);\n if (column.width !== null) this.visitNode(column.width);\n if (column.minWidth !== null) this.visitNode(column.minWidth);\n if (column.maxWidth !== null) this.visitNode(column.maxWidth);\n });\n if (syntax.layout.columnGap !== null) this.visitNode(syntax.layout.columnGap);\n if (syntax.layout.rowGap !== null) this.visitNode(syntax.layout.rowGap);\n syntax.layout.placements.forEach(placement => {\n this.visitNode(placement);\n if (placement.width !== null) this.visitNode(placement.width);\n });\n }\n if (syntax.onSubmit !== null) this.visitScreenDirective(syntax.onSubmit);\n }\n\n visitCommand(syntax: CommandSyntax): void {\n this.visitNode(syntax);\n syntax.properties.forEach(node => this.visitProperty(node));\n if (syntax.authorize !== null) this.visitAuthorize(syntax.authorize);\n if (syntax.stream != null) this.visitCommandStream(syntax.stream);\n syntax.streamCandidates?.forEach(candidate => this.visitCommandStream(candidate));\n syntax.validations.forEach(node => this.visitValidate(node));\n syntax.produces.forEach(node => this.visitProduces(node));\n if (syntax.handler != null) this.visitHandler(syntax.handler);\n if (syntax.response != null) this.visitCommandResponse(syntax.response);\n }\n\n visitEventSource(syntax: EventSourceSyntax): void {\n this.visitNode(syntax);\n if (syntax.identifier !== null) this.visitTypeRef(syntax.identifier);\n syntax.streams.forEach(stream => this.visitEventStream(stream));\n }\n visitEventStream(syntax: EventStreamSyntax): void {\n this.visitNode(syntax);\n if (syntax.streamId !== null) this.visitTypeRef(syntax.streamId);\n syntax.streamIdParts.forEach(part => this.visitEventStreamIdPart(part));\n }\n visitEventStreamIdPart(syntax: EventStreamIdPartSyntax): void {\n this.visitNode(syntax);\n this.visitTypeRef(syntax.type);\n }\n visitCommandStream(syntax: CommandStreamSyntax): void {\n this.visitNode(syntax);\n if (syntax.streamId !== null) this.visitPropertyMapping(syntax.streamId);\n syntax.streamIdParts.forEach(part => this.visitPropertyMapping(part));\n if (syntax.propertyCandidate !== null) this.visitProperty(syntax.propertyCandidate);\n }\n\n visitSystem(syntax: SystemSyntax): void { this.visitNode(syntax); }\n visitOperation(syntax: OperationSyntax): void {\n this.visitNode(syntax);\n syntax.inputs.forEach(input => this.visitProperty(input));\n if (syntax.execute !== null) this.visitOperationPhase(syntax.execute);\n if (syntax.compensate !== null) this.visitOperationPhase(syntax.compensate);\n }\n visitOperationPhase(syntax: OperationPhaseSyntax): void {\n this.visitNode(syntax);\n if (syntax.implementation !== null) this.visitImplementation(syntax.implementation);\n if (syntax.file !== null) this.visitFileReference(syntax.file);\n if (syntax.code !== null) this.visitCodeBlock(syntax.code);\n }\n visitSpecificationOperationFailure(syntax: SpecificationOperationFailureSyntax): void { this.visitNode(syntax); }\n visitSpecificationCompensated(syntax: SpecificationCompensatedSyntax): void { this.visitNode(syntax); }\n visitSpecificationOperation(syntax: SpecificationOperationSyntax): void {\n this.visitNode(syntax);\n syntax.values.forEach(value => this.visitPropertyMapping(value));\n }\n\n visitHandler(syntax: HandlerSyntax): void {\n this.visitNode(syntax);\n if (syntax.implementation != null) this.visitImplementation(syntax.implementation);\n if (syntax.file !== null) this.visitFileReference(syntax.file);\n if (syntax.code !== null) this.visitCodeBlock(syntax.code);\n }\n\n visitImplementation(syntax: ImplementationSyntax): void {\n this.visitNode(syntax);\n syntax.hints.forEach(hint => this.visitImplementationHint(hint));\n }\n\n visitImplementationHint(syntax: ImplementationHintSyntax): void { this.visitNode(syntax); }\n visitFileReference(syntax: FileReferenceSyntax): void { this.visitNode(syntax); }\n visitCodeBlock(syntax: CodeBlockSyntax): void { this.visitNode(syntax); }\n\n visitCommandResponse(syntax: CommandResponseSyntax): void {\n if (syntax.kind === 'ScalarCommandResponseSyntax') this.visitScalarCommandResponse(syntax);\n else this.visitRecordCommandResponse(syntax);\n }\n\n visitScalarCommandResponse(syntax: ScalarCommandResponseSyntax): void {\n this.visitNode(syntax);\n this.visitPropertyResponseSource(syntax.source);\n }\n\n visitRecordCommandResponse(syntax: RecordCommandResponseSyntax): void {\n this.visitNode(syntax);\n syntax.fields.forEach(field => this.visitResponseField(field));\n }\n\n visitResponseField(syntax: ResponseFieldSyntax): void {\n this.visitNode(syntax);\n if (syntax.type !== null) this.visitTypeRef(syntax.type);\n this.visitPropertyResponseSource(syntax.source);\n }\n\n visitPropertyResponseSource(syntax: PropertyResponseSourceSyntax): void {\n this.visitNode(syntax);\n }\n\n visitSpecificationReturn(syntax: SpecificationReturnSyntax): void {\n if (syntax.kind === 'ScalarSpecificationReturnSyntax') this.visitScalarSpecificationReturn(syntax);\n else this.visitRecordSpecificationReturn(syntax);\n }\n\n visitScalarSpecificationReturn(syntax: ScalarSpecificationReturnSyntax): void {\n this.visitNode(syntax);\n this.visitExpression(syntax.value);\n }\n\n visitRecordSpecificationReturn(syntax: RecordSpecificationReturnSyntax): void {\n this.visitNode(syntax);\n syntax.fields.forEach(field => this.visitPropertyMapping(field));\n }\n\n visitValidate(syntax: ValidateSyntax): void {\n this.visitNode(syntax);\n if (syntax.kind === 'DeclarativeValidateSyntax') {\n syntax.rules.forEach(node => this.visitValidationRule(node));\n syntax.requirements?.forEach(node => { this.visitNode(node); this.visitCondition(node.condition); });\n } else if (syntax.code != null) this.visitCodeBlock(syntax.code);\n }\n\n visitValidationRule(syntax: ValidationRuleSyntax): void {\n this.visitNode(syntax);\n if (syntax.implementation != null) this.visitImplementation(syntax.implementation);\n if (syntax.value !== null) this.visitExpression(syntax.value);\n if (syntax.file !== null) this.visitFileReference(syntax.file);\n if (syntax.code !== null) this.visitCodeBlock(syntax.code);\n }\n\n visitEvent(syntax: EventSyntax): void {\n this.visitNode(syntax);\n syntax.properties.forEach(node => this.visitProperty(node));\n syntax.tags.forEach(node => this.visitTag(node));\n }\n\n visitTag(syntax: TagSyntax): void {\n this.visitNode(syntax);\n this.visitExpression(syntax.value);\n }\n\n visitReadModel(syntax: ReadModelSyntax): void {\n this.visitNode(syntax);\n syntax.properties.forEach(node => this.visitProperty(node));\n }\n\n visitConstraint(syntax: ConstraintSyntax): void {\n this.visitNode(syntax);\n if (syntax.kind === 'FileConstraintSyntax') this.visitNode(syntax.file);\n syntax.additionalRules.forEach(node => this.visitConstraint(node));\n }\n\n visitQuery(syntax: QuerySyntax): void {\n this.visitNode(syntax);\n this.visitTypeRef(syntax.returnType);\n if (syntax.by !== null) this.visitQueryParameter(syntax.by);\n syntax.filters.forEach(node => this.visitQueryParameter(node));\n if (syntax.authorize !== null) this.visitAuthorize(syntax.authorize);\n }\n\n visitQueryParameter(syntax: QueryParameterSyntax): void {\n this.visitNode(syntax);\n this.visitTypeRef(syntax.type);\n if (syntax.source != null) this.visitExpression(syntax.source);\n }\n\n visitKey(syntax: KeySyntax): void {\n this.visitNode(syntax);\n if (syntax.kind === 'ExpressionKeySyntax') this.visitExpression(syntax.expression);\n else syntax.parts.forEach(part => { this.visitNode(part); this.visitExpression(part.expression); });\n }\n\n visitProjection(syntax: ProjectionSyntax): void {\n this.visitNode(syntax);\n if (syntax.key != null) this.visitKey(syntax.key);\n syntax.blocks.forEach(node => this.visitProjectionBlock(node));\n }\n\n visitProjectionBlock(syntax: ProjectionBlockSyntax): void {\n this.visitNode(syntax);\n switch (syntax.kind) {\n case 'FromSyntax':\n syntax.events.forEach(node => { this.visitNode(node); if (node.key != null) this.visitExpression(node.key); });\n if (syntax.key != null) this.visitKey(syntax.key);\n if (syntax.parentKey != null) this.visitExpression(syntax.parentKey);\n syntax.mappings.forEach(node => this.visitMapping(node));\n break;\n case 'EverySyntax':\n case 'AllSyntax':\n syntax.mappings.forEach(node => this.visitMapping(node));\n break;\n case 'JoinSyntax':\n syntax.events.forEach(node => this.visitJoinEvent(node));\n break;\n case 'ProjectionVariantSyntax':\n syntax.entersOn.forEach(node => { this.visitNode(node); if (node.key != null) this.visitExpression(node.key); });\n syntax.blocks.forEach(node => this.visitProjectionBlock(node));\n break;\n case 'ChildrenSyntax':\n if (syntax.identifiedBy !== undefined) this.visitExpression(syntax.identifiedBy);\n syntax.blocks.forEach(node => this.visitProjectionBlock(node));\n break;\n case 'NestedSyntax':\n syntax.blocks.forEach(node => this.visitProjectionBlock(node));\n break;\n case 'RemoveWithSyntax':\n if (syntax.parentKey != null) this.visitExpression(syntax.parentKey);\n if (syntax.key != null) this.visitExpression(syntax.key);\n break;\n case 'RemoveViaJoinSyntax':\n if (syntax.key != null) this.visitExpression(syntax.key);\n break;\n }\n }\n\n visitJoinEvent(syntax: JoinEventSyntax): void {\n this.visitNode(syntax);\n syntax.mappings.forEach(node => this.visitMapping(node));\n }\n\n visitMapping(syntax: MappingSyntax): void {\n this.visitNode(syntax);\n if (syntax.source !== undefined) this.visitExpression(syntax.source);\n if (syntax.value !== undefined) this.visitExpression(syntax.value);\n }\n\n visitCondition(syntax: ConditionSyntax): void {\n this.visitNode(syntax);\n if (syntax.kind === 'ComparisonConditionSyntax') this.visitExpression(syntax.right);\n else { this.visitCondition(syntax.left); this.visitCondition(syntax.right); }\n }\n\n visitReaction(syntax: ReactionSyntax): void {\n this.visitNode(syntax);\n if (syntax.where != null) this.visitCondition(syntax.where);\n syntax.triggers.forEach(node => this.visitReactionTrigger(node));\n }\n\n visitReactionTrigger(syntax: ReactionTriggerSyntax): void {\n this.visitNode(syntax);\n this.visitTriggerSource(syntax.source);\n syntax.produces.forEach(node => this.visitProduces(node));\n syntax.invokes.forEach(node => this.visitInvokes(node));\n }\n\n visitProduces(syntax: ProducesSyntax): void {\n this.visitNode(syntax);\n if (syntax.when != null) this.visitCondition(syntax.when);\n if (syntax.inlineEvent !== null) this.visitEvent(syntax.inlineEvent);\n if (syntax.inlineOperation != null) this.visitOperation(syntax.inlineOperation);\n if (syntax.for !== null) this.visitExpression(syntax.for);\n syntax.mappings.forEach(node => this.visitPropertyMapping(node));\n syntax.tags.forEach(node => this.visitTag(node));\n }\n\n visitInvokes(syntax: InvokesSyntax): void {\n this.visitNode(syntax);\n syntax.mappings?.forEach(node => this.visitPropertyMapping(node));\n syntax.onRefused?.forEach(node => this.visitInvocationRefusal(node));\n }\n\n visitInvocationRefusal(syntax: InvocationRefusalSyntax): void {\n this.visitNode(syntax);\n syntax.produces.forEach(node => this.visitProduces(node));\n }\n\n visitCapture(syntax: CaptureSyntax): void {\n this.visitNode(syntax);\n if (syntax.source !== null) this.visitCaptureSource(syntax.source);\n syntax.map?.forEach(node => this.visitCaptureMap(node));\n syntax.appends.forEach(node => this.visitCaptureAppend(node));\n syntax.children.forEach(node => this.visitCaptureChildren(node));\n syntax.nested.forEach(node => this.visitCaptureNested(node));\n }\n\n visitCaptureSource(syntax: CaptureSourceSyntax): void {\n this.visitNode(syntax);\n syntax.settings.forEach(node => this.visitCaptureSourceSetting(node));\n }\n\n visitCaptureSourceSetting(syntax: CaptureSourceSettingSyntax): void {\n this.visitNode(syntax);\n }\n\n visitCaptureMap(syntax: CaptureMapOperationSyntax): void {\n this.visitNode(syntax);\n this.visitExpression(syntax.source);\n if (syntax.kind === 'CaptureMapEntrySyntax') syntax.translations.forEach(node => this.visitNode(node));\n }\n\n visitCaptureAppend(syntax: CaptureAppendSyntax): void {\n this.visitNode(syntax);\n if (syntax.when != null) this.visitNode(syntax.when);\n syntax.mappings?.forEach(node => this.visitPropertyMapping(node));\n syntax.tags?.forEach(node => this.visitTag(node));\n }\n\n visitCaptureChildren(syntax: CaptureChildrenSyntax): void {\n this.visitNode(syntax);\n syntax.map?.forEach(node => this.visitCaptureMap(node));\n syntax.appends.forEach(node => this.visitCaptureAppend(node));\n }\n\n visitCaptureNested(syntax: CaptureNestedSyntax): void {\n this.visitNode(syntax);\n syntax.map?.forEach(node => this.visitCaptureMap(node));\n syntax.appends.forEach(node => this.visitCaptureAppend(node));\n }\n\n visitTriggerSource(syntax: TriggerSourceSyntax): void {\n this.visitNode(syntax);\n }\n\n visitScreen(syntax: ScreenSyntax): void {\n this.visitNode(syntax);\n syntax.directives.forEach(node => this.visitScreenDirective(node));\n syntax.contributions?.forEach(contribution => {\n this.visitNode(contribution);\n contribution.directives.forEach(node => this.visitScreenDirective(node));\n });\n }\n\n visitScreenDirective(syntax: ScreenDirectiveSyntax): void {\n if (syntax.kind === 'ScreenGuardedActionSyntax') {\n this.visitScreenGuardedAction(syntax);\n return;\n }\n this.visitNode(syntax);\n switch (syntax.kind) {\n case 'ScreenDataSyntax':\n this.visitTypeRef(syntax.type);\n break;\n case 'ScreenActionSyntax':\n if (syntax.navigate !== null) this.visitScreenDirective(syntax.navigate);\n break;\n case 'ScreenNavigateSyntax':\n syntax.parameters.forEach(parameter => {\n this.visitNode(parameter);\n this.visitUiBinding(parameter.binding);\n });\n break;\n case 'ScreenTemplateReferenceSyntax':\n syntax.slots.forEach(slot => {\n this.visitNode(slot);\n slot.directives.forEach(node => this.visitScreenDirective(node));\n });\n break;\n case 'ScreenSectionSyntax':\n syntax.directives.forEach(node => this.visitScreenDirective(node));\n break;\n case 'ScreenTableSyntax':\n syntax.columns.forEach(node => this.visitNode(node));\n if (syntax.rowClick !== null) this.visitScreenDirective(syntax.rowClick);\n break;\n case 'ScreenSummarySyntax':\n syntax.fields.forEach(node => this.visitNode(node));\n break;\n case 'ScreenComponentSyntax':\n if (syntax.context !== null) this.visitUiBinding(syntax.context);\n syntax.properties.forEach(property => {\n this.visitNode(property);\n if (property.binding !== null) this.visitUiBinding(property.binding);\n if (property.value !== null) this.visitExpression(property.value);\n });\n syntax.exposes.forEach(exposed => {\n this.visitNode(exposed);\n this.visitUiBinding(exposed.binding);\n });\n syntax.presentation.forEach(node => this.visitNode(node));\n syntax.outlets.forEach(outlet => {\n this.visitNode(outlet);\n outlet.directives.forEach(node => this.visitScreenDirective(node));\n });\n break;\n case 'ScreenToolbarSyntax':\n syntax.items.forEach(item => {\n this.visitNode(item);\n item.parameters.forEach(parameter => {\n this.visitNode(parameter);\n this.visitUiBinding(parameter.binding);\n });\n item.presentation.forEach(node => this.visitNode(node));\n });\n break;\n case 'ScreenCodeSyntax':\n this.visitNode(syntax.code);\n break;\n }\n }\n\n visitScreenGuardedAction(syntax: ScreenGuardedActionSyntax): void {\n this.visitNode(syntax);\n syntax.alternatives.forEach(node => this.visitScreenActionAlternative(node));\n if (syntax.otherwise !== null) this.visitScreenActionOtherwise(syntax.otherwise);\n if (syntax.navigate !== null) this.visitScreenDirective(syntax.navigate);\n }\n\n visitScreenActionAlternative(syntax: ScreenActionAlternativeSyntax): void {\n this.visitNode(syntax);\n this.visitCondition(syntax.condition);\n syntax.arguments.forEach(node => this.visitInteractionArgument(node));\n }\n\n visitScreenActionOtherwise(syntax: ScreenActionOtherwiseSyntax): void {\n this.visitNode(syntax);\n syntax.arguments.forEach(node => this.visitInteractionArgument(node));\n }\n\n visitInteractionArgument(syntax: InteractionArgumentSyntax): void { this.visitNode(syntax); }\n\n visitSpecification(syntax: SpecificationSyntax): void {\n this.visitNode(syntax);\n syntax.examples?.forEach(node => this.visitSpecificationExample(node));\n syntax.parameters?.forEach(node => { this.visitNode(node); this.visitTypeRef(node.type); });\n syntax.cases?.forEach(node => { this.visitNode(node); node.values.forEach(value => this.visitPropertyMapping(value)); });\n if (syntax.givenClock !== null) this.visitSpecificationClock(syntax.givenClock);\n syntax.givenOperationFailures?.forEach(node => this.visitSpecificationOperationFailure(node));\n syntax.thenOperations?.forEach(node => this.visitSpecificationOperation(node));\n syntax.thenCompensated?.forEach(node => this.visitSpecificationCompensated(node));\n if (syntax.givenCallerPersona != null) this.visitNode(syntax.givenCallerPersona);\n if (syntax.givenCaller != null) {\n this.visitNode(syntax.givenCaller);\n syntax.givenCaller.claims.forEach(node => this.visitNode(node));\n }\n syntax.given.forEach(node => this.visitSpecificationEvent(node));\n syntax.givenReadModels.forEach(node => this.visitSpecificationReadModel(node));\n if (syntax.when !== null) this.visitSpecificationCommand(syntax.when);\n syntax.givenCaptures.forEach(node => this.visitSpecificationCapture(node));\n if (syntax.whenAppended !== null) this.visitSpecificationEvent(syntax.whenAppended);\n if (syntax.whenRedelivered != null) this.visitSpecificationRedelivery(syntax.whenRedelivered);\n if (syntax.whenClock !== null) this.visitSpecificationClock(syntax.whenClock);\n if (syntax.whenTrigger !== null) this.visitSpecificationTrigger(syntax.whenTrigger);\n if (syntax.whenCapture !== null) this.visitSpecificationCapture(syntax.whenCapture);\n if (syntax.whenQuery !== null) this.visitSpecificationWhenQuery(syntax.whenQuery);\n syntax.thenEvents.forEach(node => this.visitSpecificationEvent(node));\n syntax.thenReadModels.forEach(node => this.visitSpecificationReadModel(node));\n syntax.thenAbsentReadModels?.forEach(node => { this.visitNode(node); this.visitExpression(node.key); });\n syntax.thenQueries?.forEach(node => {\n this.visitNode(node);\n node.arguments.forEach(value => this.visitPropertyMapping(value));\n node.results.forEach(result => this.visitSpecificationQueryResult(result));\n });\n syntax.thenResults.forEach(node => this.visitSpecificationQueryResult(node));\n if (syntax.thenNoResult !== null) this.visitNode(syntax.thenNoResult);\n if (syntax.thenDenied != null) this.visitNode(syntax.thenDenied);\n if (syntax.thenReturns != null) this.visitSpecificationReturn(syntax.thenReturns);\n syntax.thenErrors.forEach(node => { this.visitNode(node); if (node.caseValue != null) this.visitExpression(node.caseValue); });\n }\n\n visitSpecificationRedelivery(syntax: SpecificationRedeliverySyntax): void {\n this.visitNode(syntax);\n if (syntax.for !== null) this.visitExpression(syntax.for);\n if (syntax.stream != null) this.visitSpecificationStream(syntax.stream);\n if (syntax.noStream != null) this.visitSpecificationNoStream(syntax.noStream);\n syntax.values.forEach(node => this.visitPropertyMapping(node));\n }\n\n visitSpecificationClock(syntax: SpecificationClockSyntax): void {\n this.visitNode(syntax);\n }\n\n visitSpecificationTrigger(syntax: SpecificationTriggerSyntax): void {\n this.visitNode(syntax);\n syntax.values.forEach(node => this.visitPropertyMapping(node));\n }\n\n visitSpecificationCapture(syntax: SpecificationCaptureSyntax): void {\n this.visitNode(syntax);\n syntax.record.forEach(node => this.visitPropertyMapping(node));\n }\n\n visitSpecificationWhenQuery(syntax: SpecificationWhenQuerySyntax): void {\n this.visitNode(syntax);\n syntax.arguments.forEach(node => this.visitPropertyMapping(node));\n }\n\n visitSpecificationQueryResult(syntax: SpecificationQueryResultSyntax): void {\n this.visitNode(syntax);\n syntax.properties.forEach(node => this.visitPropertyMapping(node));\n }\n\n visitSpecificationExample(syntax: SpecificationExampleSyntax): void {\n this.visitNode(syntax);\n if (syntax.for !== null) this.visitExpression(syntax.for);\n if (syntax.stream != null) this.visitSpecificationStream(syntax.stream);\n if (syntax.noStream != null) this.visitSpecificationNoStream(syntax.noStream);\n syntax.values.forEach(node => this.visitPropertyMapping(node));\n syntax.generatedValues.forEach(node => this.visitPropertyMapping(node));\n }\n\n visitSpecificationEvent(syntax: SpecificationEventSyntax): void {\n this.visitNode(syntax);\n if (syntax.stream != null) this.visitSpecificationStream(syntax.stream);\n if (syntax.noStream != null) this.visitSpecificationNoStream(syntax.noStream);\n syntax.values.forEach(node => this.visitPropertyMapping(node));\n if (syntax.for !== null) this.visitExpression(syntax.for);\n }\n\n visitSpecificationStream(syntax: SpecificationStreamSyntax): void {\n this.visitNode(syntax);\n if (syntax.streamId !== null) this.visitPropertyMapping(syntax.streamId);\n syntax.streamIdParts.forEach(part => this.visitPropertyMapping(part));\n }\n\n visitSpecificationNoStream(syntax: SpecificationNoStreamSyntax): void { this.visitNode(syntax); }\n\n visitSpecificationCommand(syntax: SpecificationCommandSyntax): void {\n this.visitNode(syntax);\n (syntax.generatedValues ?? []).forEach(fixture => this.visitPropertyMapping(fixture));\n syntax.values.forEach(node => this.visitPropertyMapping(node));\n if (syntax.for !== null) this.visitExpression(syntax.for);\n }\n\n visitSpecificationReadModel(syntax: SpecificationReadModelSyntax): void {\n this.visitNode(syntax);\n syntax.properties.forEach(node => this.visitPropertyMapping(node));\n }\n\n visitPropertyMapping(syntax: PropertyMappingSyntax): void {\n this.visitNode(syntax);\n this.visitExpression(syntax.source);\n }\n\n visitProperty(syntax: PropertySyntax): void {\n this.visitNode(syntax);\n this.visitTypeRef(syntax.type);\n }\n\n visitTypeRef(syntax: TypeRefSyntax): void {\n this.visitNode(syntax);\n }\n\n visitUiBinding(syntax: import('./Screens').UiBindingSyntax): void {\n this.visitNode(syntax);\n if (syntax.literal !== null) this.visitExpression(syntax.literal);\n }\n\n visitIdentityExpression(syntax: IdentityExpressionSyntax): void { this.visitNode(syntax); }\n\n visitExpression(syntax: ExpressionSyntax): void {\n if (syntax.kind === 'IdentityExpressionSyntax') { this.visitIdentityExpression(syntax); return; }\n this.visitNode(syntax);\n if (syntax.kind === 'ListExpressionSyntax') {\n syntax.items.forEach(item => this.visitExpression(item));\n } else if (syntax.kind === 'ObjectExpressionSyntax') {\n syntax.members.forEach(member => this.visitObjectMember(member));\n } else if (syntax.kind === 'TemplateExpressionSyntax') {\n syntax.parts.forEach(part => { this.visitNode(part); if (part.kind === 'TemplateInterpolationSyntax') this.visitExpression(part.expression); });\n }\n }\n\n visitObjectMember(syntax: ObjectMemberSyntax): void {\n this.visitNode(syntax);\n this.visitExpression(syntax.value);\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/** A lossless typed literal slot. The value is canonical fixed-point text, never a JavaScript number. */\nexport interface ExactNumber {\n readonly literalType: 'ExactNumber';\n readonly value: string;\n}\n\nconst maximumCoefficient = '79228162514264337593543950335';\n\ninterface ScannedNumber {\n readonly negative: boolean;\n readonly integer: string;\n readonly fraction: string;\n readonly exponent: number;\n}\n\n/** Reads a complete ASCII token in the normalized Decimal domain, without rounding or underflow. */\nexport function parseExactNumber(text: string): ExactNumber | undefined {\n const scanned = scan(text);\n if (scanned === undefined) return undefined;\n const digits = scanned.integer + scanned.fraction;\n let first = 0;\n while (first < digits.length && digits[first] === '0') first++;\n if (first === digits.length) return Object.freeze({ literalType: 'ExactNumber', value: '0' });\n let last = digits.length;\n while (digits[last - 1] === '0') last--;\n const scale = scanned.fraction.length - scanned.exponent - (digits.length - last);\n const appendedZeros = scale < 0 ? -scale : 0;\n if (scale > 28 || last - first + appendedZeros > maximumCoefficient.length) return undefined;\n // Only the bounded coefficient is materialized; the authored exponent never determines allocation.\n const coefficient = digits.substring(first, last) + '0'.repeat(appendedZeros);\n if (coefficient.length === maximumCoefficient.length && coefficient > maximumCoefficient) return undefined;\n const normalizedScale = Math.max(0, scale);\n const fixedPoint = normalizedScale === 0 ? coefficient\n : coefficient.length > normalizedScale\n ? `${coefficient.substring(0, coefficient.length - normalizedScale)}.${coefficient.substring(coefficient.length - normalizedScale)}`\n : `0.${'0'.repeat(normalizedScale - coefficient.length)}${coefficient}`;\n return Object.freeze({ literalType: 'ExactNumber', value: (scanned.negative ? '-' : '') + fixedPoint });\n}\n\n/** Recognizes the complete scalar grammar independently of representability. */\nexport function isExactNumberToken(text: string): boolean {\n return scan(text) !== undefined;\n}\n\nfunction scan(text: string): ScannedNumber | undefined {\n const negative = text.startsWith('-');\n const integerStart = negative ? 1 : 0;\n let position = integerStart;\n while (position < text.length && isDigit(text[position])) position++;\n if (position === integerStart) return undefined;\n const integer = text.substring(integerStart, position);\n let fraction = '';\n if (text[position] === '.') {\n const fractionStart = ++position;\n while (position < text.length && isDigit(text[position])) position++;\n if (position === fractionStart) return undefined;\n fraction = text.substring(fractionStart, position);\n }\n let exponent = 0;\n if (text[position] === 'e' || text[position] === 'E') {\n position++;\n const exponentNegative = text[position] === '-';\n if (text[position] === '+' || text[position] === '-') position++;\n const exponentStart = position;\n // Counts derived from this input cannot cancel an exponent beyond this bound.\n const limit = text.length + 29;\n while (position < text.length && isDigit(text[position])) {\n exponent = Math.min(limit, exponent * 10 + text.charCodeAt(position++) - 48);\n }\n if (position === exponentStart) return undefined;\n if (exponentNegative) exponent = -exponent;\n }\n return position === text.length ? { negative, integer, fraction, exponent } : undefined;\n}\n\nfunction isDigit(value: string): boolean {\n return value >= '0' && value <= '9';\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// The body of a double-quoted string literal: anything but a quote or a backslash, or an escape.\nexport const stringBodyPattern = '(?:[^\"\\\\\\\\]|\\\\\\\\.)*';\n\nconst escapes: Record<string, string> = { '\\\\': '\\\\', '\"': '\"', n: '\\n', r: '\\r', t: '\\t' };\n\n// Resolves the escapes the C# StringLiteral knows; an unknown escape keeps its backslash.\nexport function unescapeString(value: string): string {\n if (!value.includes('\\\\')) {\n return value;\n }\n let result = '';\n for (let index = 0; index < value.length; index++) {\n const escaped = index + 1 < value.length ? escapes[value[index + 1]] : undefined;\n if (value[index] === '\\\\' && escaped !== undefined) {\n result += escaped;\n index++;\n } else {\n result += value[index];\n }\n }\n return result;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ExpressionSyntax, ObjectMemberSyntax } from '../Syntax/Expressions';\nimport { parseExactNumber } from '../Syntax/ExactNumber';\nimport { ParserContext } from './ParserContext';\n\n// How deeply a structured value may nest - the C# compiler's JsonDocument limit.\nconst maximumDepth = 64;\n\n// A structured value that is not valid JSON. The message says why; the caller reports it.\nexport class InvalidStructuredValue extends Error {}\n\n// Reads an inline '{...}' or '[...]' value - the port of the C# StructuredValueParser. It is strict JSON, as\n// System.Text.Json reads it, and it keeps the first of two members with the same name and reports the\n// second, which JSON.parse would silently keep instead.\nexport class StructuredValueParser {\n #position = 0;\n\n constructor(private readonly text: string, private readonly start: SourceLocation, private readonly context?: ParserContext) {}\n\n parse(): ExpressionSyntax {\n const value = this.#value(0);\n this.#whitespace();\n if (this.#position < this.text.length) {\n throw new InvalidStructuredValue(`'${this.text[this.#position]}' is invalid after a single JSON value.`);\n }\n return value;\n }\n\n #value(depth: number): ExpressionSyntax {\n this.#whitespace();\n const location = this.#at();\n const current = this.text[this.#position];\n if (current === '[' || current === '{') {\n if (depth >= maximumDepth) {\n throw new InvalidStructuredValue(`The value nests deeper than ${maximumDepth} levels.`);\n }\n return current === '[' ? this.#list(depth, location) : this.#object(depth, location);\n }\n if (current === '\"') {\n return { kind: 'LiteralExpressionSyntax', value: this.#string(), location };\n }\n for (const [word, value] of [['true', true], ['false', false], ['null', null]] as const) {\n if (this.text.startsWith(word, this.#position)) {\n this.#position += word.length;\n return { kind: 'LiteralExpressionSyntax', value, location };\n }\n }\n return this.#number(location);\n }\n\n #list(depth: number, location: SourceLocation): ExpressionSyntax {\n this.#position++;\n const items: ExpressionSyntax[] = [];\n this.#whitespace();\n if (this.#take(']')) {\n return { kind: 'ListExpressionSyntax', items, location };\n }\n for (;;) {\n items.push(this.#value(depth + 1));\n this.#whitespace();\n if (this.#take(']')) {\n return { kind: 'ListExpressionSyntax', items, location };\n }\n this.#expect(',');\n }\n }\n\n #object(depth: number, location: SourceLocation): ExpressionSyntax {\n this.#position++;\n const members: ObjectMemberSyntax[] = [];\n const names = new Set<string>();\n this.#whitespace();\n if (this.#take('}')) {\n return { kind: 'ObjectExpressionSyntax', members, location };\n }\n for (;;) {\n this.#whitespace();\n const keyLocation = this.#at();\n if (this.text[this.#position] !== '\"') {\n throw new InvalidStructuredValue('Expected a property name in double quotes.');\n }\n const name = this.#string();\n this.#whitespace();\n this.#expect(':');\n const value = this.#value(depth + 1);\n if (names.has(name)) {\n this.context?.error(DiagnosticCodes.DuplicateStructuredValueMember, `Duplicate property '${name}' in structured value`, keyLocation);\n } else {\n names.add(name);\n members.push({ kind: 'ObjectMemberSyntax', name, value, location: keyLocation });\n }\n this.#whitespace();\n if (this.#take('}')) {\n return { kind: 'ObjectExpressionSyntax', members, location };\n }\n this.#expect(',');\n }\n }\n\n #string(): string {\n const end = this.#stringEnd(this.#position);\n const raw = this.text.substring(this.#position, end);\n this.#position = end;\n try {\n return JSON.parse(raw) as string;\n } catch {\n throw new InvalidStructuredValue(`${raw} is not a valid JSON string.`);\n }\n }\n\n #stringEnd(from: number): number {\n for (let index = from + 1; index < this.text.length; index++) {\n if (this.text[index] === '\\\\') {\n index++;\n } else if (this.text[index] === '\"') {\n return index + 1;\n }\n }\n throw new InvalidStructuredValue('A string is not closed.');\n }\n\n #number(location: SourceLocation): ExpressionSyntax {\n const match = /^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:[eE][+-]?\\d+)?/.exec(this.text.substring(this.#position));\n if (match === null) {\n throw new InvalidStructuredValue(`'${this.text[this.#position] ?? ''}' is an invalid start of a value.`);\n }\n this.#position += match[0].length;\n if (this.context?.sourceOptions.numericMode === 'exact') {\n const number = parseExactNumber(match[0]);\n if (number === undefined) {\n this.context.error(DiagnosticCodes.InexactNumericLiteral, 'Numeric literal is not exactly representable in the bounded Decimal domain.', location);\n return { kind: 'RawExpressionSyntax', text: match[0], location };\n }\n return { kind: 'LiteralExpressionSyntax', value: number, location };\n }\n const number = Number(match[0]);\n if (!Number.isFinite(number)) {\n throw new InvalidStructuredValue('JSON number is outside the finite Double range.');\n }\n return { kind: 'LiteralExpressionSyntax', value: number, location };\n }\n\n #at(): SourceLocation {\n return { ...this.start, column: this.start.column + this.#position };\n }\n\n #whitespace(): void {\n while (this.#position < this.text.length && ' \\t\\n\\r'.includes(this.text[this.#position])) {\n this.#position++;\n }\n }\n\n #take(character: string): boolean {\n if (this.text[this.#position] !== character) {\n return false;\n }\n this.#position++;\n return true;\n }\n\n #expect(character: string): void {\n if (!this.#take(character)) {\n throw new InvalidStructuredValue(`Expected '${character}' at position ${this.#position}.`);\n }\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ExpressionSyntax, LiteralExpressionSyntax } from '../Syntax/Expressions';\nimport { ExactNumber, isExactNumberToken, parseExactNumber } from '../Syntax/ExactNumber';\nimport { nativePattern, pattern } from '../Text/patterns';\nimport { unescapeString } from '../Text/StringLiteral';\nimport { ParserContext } from './ParserContext';\nimport { InvalidStructuredValue, StructuredValueParser } from './StructuredValueParser';\n\nconst pathPattern = pattern('^@?[A-Za-z_]\\\\w*(\\\\.@?[A-Za-z_$]\\\\w*)*$');\nconst nativePathPattern = nativePattern('^@?[A-Za-z_]\\\\w*(\\\\.@?[A-Za-z_$]\\\\w*)*$');\nconst numberPattern = pattern('^-?\\\\d+(\\\\.\\\\d+)?$');\nconst contextRoots = ['command', 'arguments', 'tenant', 'causedBy', 'causation', 'occurred', 'identity'];\nconst causedByProperties = ['subject', 'name', 'userName'];\nexport const identityProperties = ['id', 'name', 'userName', 'isAuthenticated', 'roles', 'claims'];\n\n// Reads the right-hand side of a mapping or a rule operand - the port of the C# ExpressionParser's\n// ParseMappingSource. With a context it also reports what the C# compiler reports while reading one: an\n// unknown $context path, and an inline structured value that is not valid JSON.\nexport function parseModeledMappingSource(text: string, location: SourceLocation, context: ParserContext): ExpressionSyntax {\n return parseMappingSource(text, location, context, true);\n}\n\nexport function parseMappingSource(text: string, location: SourceLocation, context?: ParserContext, nativeIdentifiers = false): ExpressionSyntax {\n text = text.trim();\n if (text === '$refusal' || text.startsWith('$refusal.')) {\n return { kind: 'RefusalExpressionSyntax', member: text === '$refusal' ? '' : text.substring('$refusal.'.length), location };\n }\n if (text === '$identity' || text === '$identity.') {\n context?.error(DiagnosticCodes.InvalidExpression, `Invalid expression '${text}'`, location);\n return { kind: 'RawExpressionSyntax', text, location };\n }\n if (text.startsWith('$identity.')) {\n const path = text.substring('$identity.'.length);\n if (context?.deferIdentityValidation !== true) warnOnUnknownIdentityProperty(path.split('.')[0], '$identity', location, context);\n return { kind: 'IdentityExpressionSyntax', path, location };\n }\n if (text.startsWith('$context.')) {\n const path = text.substring('$context.'.length);\n warnOnUnknownContextPath(path, location, context);\n return { kind: 'ContextExpressionSyntax', path, location };\n }\n if (text.startsWith('$env.')) {\n return { kind: 'EnvironmentExpressionSyntax', name: text.substring('$env.'.length), location };\n }\n if (text.startsWith('$strings.')) {\n return { kind: 'StringsExpressionSyntax', key: text.substring('$strings.'.length), location };\n }\n if (text.startsWith('$.')) {\n return { kind: 'SourceItemExpressionSyntax', path: text.substring('$.'.length), location };\n }\n if (text.startsWith('{') || text.startsWith('[')) {\n try {\n return new StructuredValueParser(text, location, context).parse();\n } catch (error) {\n if (!(error instanceof InvalidStructuredValue)) {\n throw error;\n }\n context?.error(DiagnosticCodes.InvalidStructuredValue, `Invalid inline structured value: ${error.message}`, location);\n return { kind: 'RawExpressionSyntax', text, location };\n }\n }\n const literal = context === undefined ? parseLiteral(text, location) : parseLiteral(text, location, context);\n if (literal !== undefined) {\n return literal;\n }\n if ((nativeIdentifiers || context?.sourceOptions.numericMode === 'exact' ? nativePathPattern : pathPattern).test(text)) {\n return { kind: 'PathExpressionSyntax', path: text, location };\n }\n return { kind: 'RawExpressionSyntax', text, location };\n}\n\nfunction warnOnUnknownContextPath(path: string, location: SourceLocation, context: ParserContext | undefined): void {\n const [root, member] = path.split('.');\n if (!contextRoots.includes(root)) {\n context?.warning(DiagnosticCodes.UnknownContextPath, `Unknown $context path '${path}' - expected one of ${contextRoots.join(', ')}`, location);\n } else if (member !== undefined && root === 'causedBy' && !causedByProperties.includes(member)) {\n context?.warning(DiagnosticCodes.UnknownContextCausedByProperty,\n `Unknown $context.causedBy property '${member}' - expected ${causedByProperties.join(', ')}`, location);\n } else if (member !== undefined && root === 'identity') {\n warnOnUnknownIdentityProperty(member, '$context.identity', location, context);\n }\n}\n\nfunction warnOnUnknownIdentityProperty(member: string, root: string, location: SourceLocation, context: ParserContext | undefined): void {\n if (!identityProperties.includes(member)) {\n context?.warning(DiagnosticCodes.UnknownContextIdentityProperty,\n `Unknown ${root} property '${member}' - expected ${identityProperties.join(', ')}`, location);\n }\n}\n\nexport function parseLiteral(text: string, location: SourceLocation): LiteralExpressionSyntax | undefined;\nexport function parseLiteral(text: string, location: SourceLocation, context: ParserContext): ExpressionSyntax | undefined;\nexport function parseLiteral(text: string, location: SourceLocation, context?: ParserContext): ExpressionSyntax | undefined {\n const literal = (value: string | number | boolean | null | ExactNumber): LiteralExpressionSyntax => ({ kind: 'LiteralExpressionSyntax', value, location });\n switch (text) {\n case 'true':\n return literal(true);\n case 'false':\n return literal(false);\n case 'null':\n return literal(null);\n }\n const quoted = text.length >= 2 && ((text.startsWith('\"') && text.endsWith('\"')) || (text.startsWith('\\'') && text.endsWith('\\'')));\n if (quoted) {\n return literal(unescapeString(text.substring(1, text.length - 1)));\n }\n if (context?.sourceOptions.numericMode === 'exact') {\n if (!isExactNumberToken(text)) return undefined;\n const number = parseExactNumber(text);\n if (number !== undefined) return literal(number);\n context.error(DiagnosticCodes.InexactNumericLiteral, 'Numeric literal is not exactly representable in the bounded Decimal domain.', location);\n return { kind: 'RawExpressionSyntax', text, location };\n }\n // .NET also parses digits from other scripts; JavaScript's Number does not, so such a number is left to\n // be read as raw text - a divergence no real document is expected to meet.\n if (numberPattern.test(text) && !Number.isNaN(Number(text))) {\n return literal(Number(text));\n }\n return undefined;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { AuthorizeSyntax, PolicyRequirementSyntax } from '../Syntax/Authorization';\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { dependencySourcesOf } from '../Syntax/DependencySources';\nimport { ExpressionSyntax, IdentityExpressionSyntax } from '../Syntax/Expressions';\nimport { ScreenplaySyntaxWalker } from '../Syntax/ScreenplaySyntaxWalker';\nimport { ApplicationSyntax, FeatureSyntax } from '../Syntax/Structure';\nimport { identityProperties } from './ExpressionParser';\nimport { ParserContext } from './ParserContext';\n\nexport function validateIdentity(application: ApplicationSyntax, context: ParserContext): void {\n const details = application.identity?.details ?? [];\n const names = new Set(details.map(detail => detail.name));\n const known = new Set(['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime', ...application.concepts.map(concept => concept.name), ...application.types.map(type => type.name), ...application.imports.map(imported => imported.qualifiedName.split('.').at(-1)!) ]);\n const resolver = new AuthoringProductionResolver(application);\n for (const { slice } of resolver.slices) {\n for (const model of slice.readModels) known.add(model.name);\n for (const projection of slice.projections) {\n // Match C# ProjectionBuiltReadModelNames: direct variants replace the builder's own output.\n const variants = projection.blocks.filter(block => block.kind === 'ProjectionVariantSyntax');\n for (const name of variants.length > 0 ? variants.map(variant => variant.name) : [projection.readModel ?? projection.name]) known.add(name);\n }\n for (const reducer of dependencySourcesOf(slice).reducers ?? []) known.add(reducer.readModel);\n }\n new IdentityPaths(names, context).visitApplication(application);\n const declared = new Set<string>();\n for (const detail of details) {\n if (declared.has(detail.name)) context.error(DiagnosticCodes.DuplicateIdentityDetail, `Duplicate identity detail '${detail.name}' - detail names must be unique`, detail.location);\n declared.add(detail.name);\n if (identityProperties.includes(detail.name)) context.error(DiagnosticCodes.BuiltInIdentityDetail, `Identity detail '${detail.name}' redeclares a built-in caller property`, detail.location);\n if (!known.has(detail.type.name)) context.warning(DiagnosticCodes.UnknownType, `Unknown type '${detail.type.name}' on identity detail '${detail.name}'`, detail.type.location);\n if (detail.source.kind !== 'QueryIdentitySourceSyntax') continue;\n const source = detail.source;\n if (!isTokenKey(source.by)) context.error(DiagnosticCodes.InvalidIdentityQueryKey, `Identity detail '${detail.name}' query key may reference only caller built-ins, claims or literals, never another detail`, source.by.location);\n const parts = source.query.split('.');\n const name = parts.at(-1)!;\n const qualifiers = parts.slice(0, -1);\n const queries = resolver.slices.flatMap(({ slice, scope }) => slice.queries.map(query => ({ query, scope }))).filter(entry => entry.query.name === name && qualifiers.length <= entry.scope.length && qualifiers.every((qualifier, index) => qualifier === entry.scope[entry.scope.length - qualifiers.length + index]));\n if (queries.length !== 1) {\n context.error(DiagnosticCodes.UnknownIdentityQuery, `Unknown or ambiguous identity query '${source.query}'`, source.location);\n continue;\n }\n const { query, scope } = queries[0];\n if (query.by === null || query.returnType.isCollection) context.error(DiagnosticCodes.InvalidIdentityQuery, `Identity query '${source.query}' must be keyed and return a single, possibly optional result`, source.location);\n if (query.returnType.name !== detail.type.name || detail.type.isCollection || query.returnType.isOptional && !detail.type.isOptional) context.error(DiagnosticCodes.IdentityQueryTypeMismatch, `Identity detail '${detail.name}' must match query '${source.query}' result type, including optionality`, detail.type.location);\n const authorizations: AuthorizeSyntax[] = query.authorize === null ? [] : [query.authorize];\n for (const module of application.modules.filter(module => module.name === scope[0])) {\n if (module.authorize !== null) authorizations.push(module.authorize);\n collectFeatureAuthorizations(module.features, scope.slice(1, -1), authorizations);\n }\n const policies = new Set(authorizations.flatMap(authorization => policyNames(authorization.requirement)));\n const dependency = new DetailReferences(names);\n for (const policy of (application.policies ?? []).filter(policy => policies.has(policy.name))) dependency.visitPolicy(policy);\n if (dependency.found.length > 0) context.error(DiagnosticCodes.IdentityQueryAuthorizationDependency, `Identity query '${source.query}' authorization depends on identity detail '${dependency.found[0].path.split('.')[0]}' - caller details cannot authorize their own resolution`, source.location);\n }\n}\n\nfunction isTokenKey(expression: ExpressionSyntax): boolean {\n if (expression.kind === 'LiteralExpressionSyntax') return true;\n if (expression.kind === 'IdentityExpressionSyntax') return identityProperties.includes(expression.path.split('.')[0]);\n return expression.kind === 'ContextExpressionSyntax' && expression.path.startsWith('identity.') && identityProperties.includes(expression.path.split('.')[1]);\n}\n\nfunction policyNames(requirement: PolicyRequirementSyntax): string[] {\n if (requirement.kind === 'PolicyReferenceSyntax') return [requirement.name];\n return [...policyNames(requirement.left), ...policyNames(requirement.right)];\n}\n\nfunction collectFeatureAuthorizations(features: readonly FeatureSyntax[], segments: readonly string[], result: AuthorizeSyntax[]): void {\n for (const feature of features.filter(feature => feature.name === segments[0])) {\n if (feature.authorize !== null) result.push(feature.authorize);\n collectFeatureAuthorizations(feature.features, segments.slice(1), result);\n }\n}\n\nclass IdentityPaths extends ScreenplaySyntaxWalker {\n constructor(private readonly details: ReadonlySet<string>, private readonly context: ParserContext) { super(); }\n override visitExpression(syntax: ExpressionSyntax): void {\n if (syntax.kind === 'ContextExpressionSyntax' && syntax.path.startsWith('identity.')) {\n const property = syntax.path.split('.')[1];\n if (!identityProperties.includes(property) && !this.context.diagnostics.some(diagnostic => diagnostic.code === DiagnosticCodes.UnknownContextIdentityProperty && diagnostic.location.line === syntax.location.line && diagnostic.location.column === syntax.location.column)) {\n this.context.warning(DiagnosticCodes.UnknownContextIdentityProperty, `Unknown $context.identity property '${property}' - expected ${identityProperties.join(', ')}`, syntax.location);\n }\n }\n super.visitExpression(syntax);\n }\n override visitIdentityExpression(syntax: IdentityExpressionSyntax): void {\n const property = syntax.path.split('.')[0];\n if (!this.details.has(property) && !identityProperties.includes(property)) this.context.warning(DiagnosticCodes.UnknownContextIdentityProperty, `Unknown $identity property '${property}' - expected ${[...identityProperties, ...this.details].join(', ')}`, syntax.location);\n }\n}\n\nclass DetailReferences extends ScreenplaySyntaxWalker {\n readonly found: IdentityExpressionSyntax[] = [];\n constructor(private readonly details: ReadonlySet<string>) { super(); }\n override visitIdentityExpression(syntax: IdentityExpressionSyntax): void {\n if (this.details.has(syntax.path.split('.')[0])) this.found.push(syntax);\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nexport enum EventSourceResolutionKind {\n Unique = 'unique',\n Ambiguous = 'ambiguous',\n NotFound = 'notFound',\n WrongKind = 'wrongKind',\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { EventSourceSyntax, EventSourceResolution, EventSourceResolutionKind } from './EventSources';\nimport { ApplicationSyntax } from './Structure';\n\nexport { type EventSourceResolution, EventSourceResolutionKind } from './EventSources';\n// Exact application/source/local-name keys only. Paths identify physical occurrences, not semantic ids.\nexport class EventSourceCatalog {\n private readonly sources = new Map<string, EventSourceSyntax[]>();\n private readonly otherNames: ReadonlySet<string>;\n\n constructor(application: ApplicationSyntax) {\n for (const source of application.eventSources ?? []) this.sources.set(source.name, [...this.sources.get(source.name) ?? [], source]);\n this.otherNames = new Set([...application.concepts, ...application.types].map(type => type.name));\n }\n\n resolve(source: string, stream: string): EventSourceResolution {\n const sources = this.sources.get(source) ?? [];\n const streams = sources.flatMap(parent => parent.streams).filter(candidate => candidate.name === stream);\n let kind: EventSourceResolutionKind;\n if (sources.length === 0) kind = this.otherNames.has(source) ? EventSourceResolutionKind.WrongKind : EventSourceResolutionKind.NotFound;\n else if (sources.length > 1 || streams.length > 1) kind = EventSourceResolutionKind.Ambiguous;\n else kind = streams.length === 1 ? EventSourceResolutionKind.Unique : EventSourceResolutionKind.NotFound;\n return { kind, sources, streams };\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { CommandSyntax } from './Commands';\nimport { ProductionDestinationContext } from './ProductionDestinationContext';\nimport { ProducesSyntax } from './Reactions';\n\nexport type { ProductionDestinationContext } from './ProductionDestinationContext';\n\nfunction eventProductions(command: CommandSyntax, context?: ProductionDestinationContext): readonly ProducesSyntax[] {\n return command.produces.filter(produced => produced.inlineOperation == null && (context === undefined || context.resolver.isEventProduction(produced, context.slice)));\n}\n\nexport function requiresExplicitDestinations(command: CommandSyntax, context?: ProductionDestinationContext): boolean {\n const events = eventProductions(command, context);\n const identifier = command.properties.find(property => property.isIdentifier)?.name;\n return events.some(produced => produced.for !== null && (produced.for.kind !== 'PathExpressionSyntax' || produced.for.path !== identifier)) ||\n (events.some(produced => produced.inlineEvent !== null && produced.for === null) &&\n events.some(produced => produced.inlineEvent === null && produced.for === null));\n}\n\n// No inference of runtime equality or legacy command-level destination promotion.\nexport function implicitDestination(command: CommandSyntax, produced: ProducesSyntax, context?: ProductionDestinationContext): string | undefined {\n const events = eventProductions(command, context);\n if (produced.inlineOperation != null || context !== undefined && !context.resolver.isEventProduction(produced, context.slice) || produced.for !== null || requiresExplicitDestinations(command, context)) return undefined;\n if (produced.inlineEvent === null) {\n return events.some(sibling => sibling.for !== null || sibling.inlineEvent !== null) ? undefined : 'new event source';\n }\n const identifiers = command.properties.filter(property => property.isIdentifier && !property.type.isOptional && !property.type.isCollection);\n return identifiers.length === 1 ? identifiers[0].name : undefined;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ExactNumber, parseExactNumber } from './ExactNumber';\n\n/** A malformed or noncanonical explicitly typed exact numeric value. */\nexport class InvalidExactNumber extends Error {}\n\n/** Validates typed values again at programmatic boundaries; readonly interfaces alone are not admission. */\nexport function canonicalExactText(number: ExactNumber): string {\n if (number.literalType !== 'ExactNumber' || typeof number.value !== 'string'\n || parseExactNumber(number.value)?.value !== number.value) {\n throw new InvalidExactNumber('Expected a canonical, bounded ExactNumber value.');\n }\n return number.value;\n}\n\nexport function exactEqual(left: ExactNumber, right: ExactNumber): boolean {\n return canonicalExactText(left) === canonicalExactText(right);\n}\n\nexport function exactIsIntegral(number: ExactNumber): boolean {\n return !canonicalExactText(number).includes('.');\n}\n\n/** Compares bounded canonical decimal strings without JavaScript numeric conversion. */\nexport function exactCompare(left: ExactNumber, right: ExactNumber): number {\n const leftText = canonicalExactText(left);\n const rightText = canonicalExactText(right);\n if (leftText === rightText) return 0;\n const leftNegative = leftText.startsWith('-');\n const rightNegative = rightText.startsWith('-');\n if (leftNegative !== rightNegative) return leftNegative ? -1 : 1;\n const [leftInteger, leftFraction = ''] = (leftNegative ? leftText.substring(1) : leftText).split('.');\n const [rightInteger, rightFraction = ''] = (rightNegative ? rightText.substring(1) : rightText).split('.');\n const direction = leftNegative ? -1 : 1;\n if (leftInteger.length !== rightInteger.length) return (leftInteger.length < rightInteger.length ? -1 : 1) * direction;\n if (leftInteger !== rightInteger) return (leftInteger < rightInteger ? -1 : 1) * direction;\n const length = Math.max(leftFraction.length, rightFraction.length);\n return (leftFraction.padEnd(length, '0') < rightFraction.padEnd(length, '0') ? -1 : 1) * direction;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nconst date = /^([0-9]{4})-([0-9]{2})-([0-9]{2})$/;\nconst dateTime = /^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:\\.[0-9]{1,7})?(?:Z|[+-]([0-9]{2}):([0-9]{2}))$/;\n\n// Only response/fixture compatibility uses this grammar; general literal parsing stays unchanged.\nexport function responseDateValue(text: string, includeTime: boolean): boolean {\n const match = (includeTime ? dateTime : date).exec(text);\n if (match === null || match[0].length !== text.length) return false;\n const year = Number(match[1]);\n const month = Number(match[2]);\n const day = Number(match[3]);\n const leap = year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);\n const days = [31, leap ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n if (year < 1 || month < 1 || month > 12 || day < 1 || day > days[month - 1]) return false;\n if (!includeTime) return true;\n if (Number(match[4]) > 23 || Number(match[5]) > 59 || Number(match[6]) > 59) return false;\n if (match[7] === undefined) return true;\n const hours = Number(match[7]);\n const minutes = Number(match[8]);\n return hours <= 14 && minutes <= 59 && (hours !== 14 || minutes === 0);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { PersonaSyntax } from './Authorization';\nimport { ApplicationSyntax } from './Structure';\nimport { PolicyConditionSyntax, PolicySyntax } from './Policies';\nimport { PersonaCallerContribution } from './PersonaCallerContribution';\nimport { PersonaCallerRefusal } from './PersonaCallerRefusal';\nimport { PersonaCallerResult } from './PersonaCallerResult';\nimport { SpecificationCallerClaimSyntax } from './Specifications';\n\nconst roleClaimType = 'http://schemas.microsoft.com/ws/2008/06/identity/claims/role';\nconst ordinal = (left: string, right: string): number => left < right ? -1 : left > right ? 1 : 0;\n// Ordinal casing never expands a character (for example sharp s into SS).\nconst claimTypeKey = (type: string): string => Array.from(type, character => {\n const upper = character.toUpperCase();\n return upper.length === character.length && character !== '\\u0131' && character !== '\\u017f' ? upper : character;\n}).join('');\n\nexport function synthesizePersonaCaller(persona: PersonaSyntax, application: ApplicationSyntax): PersonaCallerResult {\n const contributions: PersonaCallerContribution[] = [];\n const policies: PolicySyntax[] = [];\n const refused = (refusal: PersonaCallerRefusal): PersonaCallerResult => ({ caller: null, contributions, refusal });\n if (persona.policies.length === 0) return refused({ policy: null, reason: 'noPolicies', location: persona.location });\n for (const name of persona.policies) {\n const policy = (application.policies ?? []).find(policy => policy.name === name);\n if (!policy) return refused({ policy: name, reason: 'unresolvedPolicy', location: persona.location });\n if (policy.condition === null || policy.code !== null || policy.file !== null) return refused({ policy: name, reason: 'opaqueImplementation', location: policy.location });\n const not = negation(policy.condition);\n if (not) return refused({ policy: name, reason: 'negation', location: not.location });\n policies.push(policy);\n }\n for (const policy of policies) {\n const refusal = required(policy.condition!, policy.name, contributions);\n if (refusal) return refused(refusal);\n }\n for (const policy of policies) {\n const refusal = complete(policy.condition!, policy.name, contributions);\n if (refusal) return refused(refusal);\n }\n const roles = [...new Set(contributions.filter(atom => atom.kind === 'role').map(atom => atom.value))].sort(ordinal);\n const claims: SpecificationCallerClaimSyntax[] = [];\n for (const atom of contributions.filter(atom => atom.kind === 'claim')) {\n if (!claims.some(claim => claimTypeKey(claim.type) === claimTypeKey(atom.type!) && claim.value === atom.value)) {\n claims.push({ kind: 'SpecificationCallerClaimSyntax', type: atom.type!, value: atom.value, location: atom.location });\n }\n }\n claims.sort((left, right) => ordinal(claimTypeKey(left.type), claimTypeKey(right.type)) || ordinal(left.value, right.value));\n return { caller: { kind: 'SpecificationCallerSyntax', authenticated: true, roles, claims, location: persona.location }, contributions, refusal: null };\n}\n\nfunction negation(condition: PolicyConditionSyntax): PolicyConditionSyntax | null {\n return condition.kind === 'NotPolicyConditionSyntax' ? condition : condition.kind === 'LogicalPolicyConditionSyntax' ? negation(condition.left) ?? negation(condition.right) : null;\n}\n\nfunction atom(condition: PolicyConditionSyntax, policy: string, values: PersonaCallerContribution[]): PersonaCallerRefusal | null {\n switch (condition.kind) {\n case 'AuthenticatedConditionSyntax': values.push({ kind: 'authenticated', value: 'true', type: null, policy, location: condition.location }); return null;\n case 'RoleConditionSyntax': values.push({ kind: 'role', value: condition.role, type: null, policy, location: condition.location }); return null;\n case 'ClaimConditionSyntax':\n if (claimTypeKey(condition.claim) === claimTypeKey(roleClaimType)) return { policy, reason: 'roleClaim', location: condition.location };\n if (!condition.matchesSubject && condition.matches?.kind === 'LiteralExpressionSyntax' && typeof condition.matches.value === 'string') {\n values.push({ kind: 'claim', value: condition.matches.value, type: condition.claim, policy, location: condition.location }); return null;\n }\n }\n return { policy, reason: 'nonLiteralClaim', location: condition.location };\n}\n\nfunction required(condition: PolicyConditionSyntax, policy: string, values: PersonaCallerContribution[]): PersonaCallerRefusal | null {\n return condition.kind !== 'LogicalPolicyConditionSyntax' ? atom(condition, policy, values) : condition.operator === 'Or' ? null : required(condition.left, policy, values) ?? required(condition.right, policy, values);\n}\n\nfunction satisfied(condition: PolicyConditionSyntax, values: readonly PersonaCallerContribution[]): boolean {\n switch (condition.kind) {\n case 'AuthenticatedConditionSyntax': return true;\n case 'RoleConditionSyntax': return values.some(atom => atom.kind === 'role' && atom.value === condition.role);\n case 'ClaimConditionSyntax': {\n const target = condition.matches;\n return !condition.matchesSubject && target?.kind === 'LiteralExpressionSyntax' && values.some(atom => atom.kind === 'claim' && claimTypeKey(atom.type!) === claimTypeKey(condition.claim) && atom.value === target.value);\n }\n case 'LogicalPolicyConditionSyntax': return condition.operator === 'And' ? satisfied(condition.left, values) && satisfied(condition.right, values) : satisfied(condition.left, values) || satisfied(condition.right, values);\n default: return false;\n }\n}\n\nfunction complete(condition: PolicyConditionSyntax, policy: string, values: PersonaCallerContribution[]): PersonaCallerRefusal | null {\n if (condition.kind !== 'LogicalPolicyConditionSyntax') return satisfied(condition, values) ? null : atom(condition, policy, values);\n if (condition.operator === 'And') return complete(condition.left, policy, values) ?? complete(condition.right, policy, values);\n if (satisfied(condition, values)) return null;\n const left = [...values];\n const first = complete(condition.left, policy, left);\n if (first === null) { values.push(...left.slice(values.length)); return null; }\n const right = [...values];\n if (complete(condition.right, policy, right) !== null) return first;\n values.push(...right.slice(values.length));\n return null;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SpecificationSyntax } from './Specifications';\n\nexport interface SpecificationCaseOrigin {\n readonly table: string;\n readonly case: string;\n}\n\nexport const specificationCaseOrigins = new WeakMap<SpecificationSyntax, SpecificationCaseOrigin>();\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// The first space-separated word of a line's content - the keyword every construct is recognized by.\nexport const firstWord = (content: string): string => {\n const space = content.indexOf(' ');\n return space === -1 ? content : content.substring(0, space);\n};\n\n// Removes the '@' that lets an identifier read as a keyword ('@validate' names a property called validate).\nexport const unescapeIdentifier = (identifier: string): string => identifier.replaceAll('@', '');\n\n// Splits text on a separator that is not inside a string or a template literal.\nexport function splitTopLevel(text: string, separator: string): string[] {\n const parts: string[] = [];\n let start = 0;\n let inString = false;\n let inTemplate = false;\n for (let index = 0; index < text.length; index++) {\n const current = text[index];\n if (current === '\\\\' && inString && index + 1 < text.length) {\n index++;\n } else if (current === '\"' && !inTemplate) {\n inString = !inString;\n } else if (current === '`' && !inString) {\n inTemplate = !inTemplate;\n } else if (current === separator && !inString && !inTemplate) {\n parts.push(text.substring(start, index));\n start = index + 1;\n }\n }\n parts.push(text.substring(start));\n return parts;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// Where a syntax node or a diagnostic came from: a one-based line and column, and the file when the\n// document was compiled as part of a folder. Mirrors the C# SourceLocation record.\nexport interface SourceLocation {\n readonly line: number;\n readonly column: number;\n readonly path?: string;\n}\n\nexport const sourceLocation = (line: number, column: number, path?: string): SourceLocation =>\n path === undefined ? { line, column } : { line, column, path };\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SourceLocation, sourceLocation } from '../Diagnostics/SourceLocation';\n\n// One physical line of a document: its raw text, how far it is indented and what is left once comments and\n// trailing whitespace are gone. The offside rule reads nesting from the indent alone.\nexport interface SourceLine {\n readonly number: number;\n readonly raw: string;\n readonly indent: number;\n readonly content: string;\n readonly contentOffset?: number;\n readonly path?: string;\n readonly startOffset: number;\n}\n\nexport const isBlank = (line: SourceLine): boolean => line.content.length === 0;\n\n// The location of the line's first significant character.\nexport const locationOf = (line: SourceLine): SourceLocation => sourceLocation(line.number, line.indent + (line.contentOffset ?? 0) + 1, line.path);\n\n// The location of the line's first column, whatever its indent.\nexport const startOf = (line: SourceLine): SourceLocation => sourceLocation(line.number, 1, line.path);\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { PropertySyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { pattern } from '../Text/patterns';\nimport { ParserContext } from './ParserContext';\nimport { unescapeIdentifier } from './LineText';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst propertyPattern = pattern('^(@?[a-z_]\\\\w*)\\\\s+([\\\\w.]+(?:\\\\[\\\\])?(?:\\\\?|\\\\s+optional)?)(?:\\\\s+(generated))?(?:\\\\s+(identifier))?(?:\\\\s+(subject))?$');\nconst invalidGeneratedModifiers = pattern('^@?[a-z_]\\\\w*\\\\s+[\\\\w.]+(?:\\\\[\\\\])?\\\\??\\\\s+((?:optional|generated|identifier|subject)(?:\\\\s+(?:optional|generated|identifier|subject))*)$');\nconst reversedModifiers = pattern('^@?[a-z_]\\\\w*\\\\s+[\\\\w.]+(?:\\\\[\\\\])?\\\\s+identifier\\\\s+optional(?:\\\\s*=.*)?$');\n\n// A '<name> <Type>[[]][?] [identifier]' line, or undefined when the line does not have that shape.\nexport function tryParseProperty(line: SourceLine): PropertySyntax | undefined {\n const match = propertyPattern.exec(line.content);\n if (match === null) {\n return undefined;\n }\n const location = locationOf(line);\n return {\n kind: 'PropertySyntax',\n name: unescapeIdentifier(match[1]),\n type: parseTypeRef(match[2], { ...location, column: location.column + line.content.indexOf(match[2], match[1].length) }),\n isGenerated: match[3] !== undefined,\n nameWasEscaped: match[1].startsWith('@'),\n isIdentifier: match[4] !== undefined,\n ...(match[5] !== undefined ? { isSubject: true } : {}),\n location,\n };\n}\n\nexport function parseTypeRef(text: string, location: SourceLocation): TypeRefSyntax {\n const legacy = text.endsWith('?');\n const canonical = /\\soptional$/.test(text);\n const isOptional = legacy || canonical;\n if (isOptional) {\n text = text.substring(0, text.length - (legacy ? 1 : 'optional'.length)).trimEnd();\n }\n const isCollection = text.endsWith('[]');\n if (isCollection) {\n text = text.substring(0, text.length - 2);\n }\n return { kind: 'TypeRefSyntax', name: text, isCollection, isOptional, location };\n}\n\n// Unlike tryParseProperty, this is only called once the owner commits to a property position.\nexport function parseProperty(context: ParserContext, line: SourceLine): PropertySyntax | undefined {\n const property = tryParseProperty(line);\n if (property !== undefined) {\n reportLegacyOptionalSuffix(context, property.type, line);\n } else {\n reportInvalidModifierOrder(context, line);\n }\n return property;\n}\n\nexport function reportLegacyOptionalSuffix(context: ParserContext, type: TypeRefSyntax, line: SourceLine): void {\n context.claimField(line);\n const length = type.name.length + (type.isCollection ? 2 : 0);\n const offset = type.location.column - line.indent - 1 + length;\n if (type.isOptional && line.content[offset] === '?') {\n const name = type.name + (type.isCollection ? '[]' : '');\n context.information(DiagnosticCodes.LegacyOptionalSuffix, `Write '${name} optional' instead of '${name}?'.`, type.location);\n }\n}\n\nexport function reportInvalidModifierOrder(context: ParserContext, line: SourceLine): boolean {\n const subjectModifiers = invalidGeneratedModifiers.exec(line.content);\n if (subjectModifiers !== null && subjectModifiers[1].split(/\\s+/).includes('subject')) {\n context.error(DiagnosticCodes.InvalidSubjectModifierOrder, \"Write each modifier once in order: '<name> <Type> optional generated identifier subject'.\", locationOf(line));\n return true;\n }\n if (reversedModifiers.test(line.content)) {\n context.error(DiagnosticCodes.InvalidOptionalModifierOrder, \"Write 'optional' before 'identifier': '<name> <Type> optional identifier'.\", locationOf(line));\n return true;\n } else {\n const modifiers = invalidGeneratedModifiers.exec(line.content);\n if (modifiers !== null && modifiers[1].split(/\\s+/).some(modifier => modifier === 'generated' || modifier === 'identifier')) {\n context.error(DiagnosticCodes.InvalidGeneratedModifierOrder, \"Write each modifier once in order: '<name> <Type> optional generated identifier'.\", locationOf(line));\n return true;\n }\n }\n return false;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { SpecificationReturnSyntax } from '../Syntax/Responses';\nimport { pattern } from '../Text/patterns';\nimport { stringBodyPattern } from '../Text/StringLiteral';\nimport { parseMappingSource } from './ExpressionParser';\nimport { containsCaseReference, parseSpecificationValue } from './SpecificationCaseParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nexport const thenReturnsPrefix = pattern('^then\\\\s+returns\\\\b');\nexport const generatedFixturePrefix = pattern('^generated\\\\s+(?=\\\\S)(?![=])');\nexport const generatedFixturePattern = pattern('^generated\\\\s+([a-z_]\\\\w*)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst fieldPattern = pattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst quotedValue = pattern(`^(?:\"${stringBodyPattern}\"|'(?:[^'\\\\\\\\]|\\\\\\\\.)*')$`);\n\nexport function parseConcrete(context: ParserContext, text: string, location: SourceLocation, code: string): ExpressionSyntax | null {\n if (text.startsWith('case.')) return parseSpecificationValue(text, location, context);\n if (containsCaseReference(text)) context.error(DiagnosticCodes.InvalidSpecificationCaseReference, 'A case reference fills a whole value position; it cannot occur inside a structured value or expression.', location);\n if ((text.startsWith('\"') || text.startsWith(\"'\")) && !quotedValue.test(text)) {\n context.error(code, 'Expected exactly one concrete value.', location);\n return null;\n }\n const expression = parseMappingSource(text, location, context);\n if (!['LiteralExpressionSyntax', 'ObjectExpressionSyntax', 'ListExpressionSyntax'].includes(expression.kind) || (expression.kind === 'LiteralExpressionSyntax' && typeof expression.value === 'number' && !Number.isFinite(expression.value))) {\n context.error(code, 'Expected exactly one concrete literal or structured value, not an expression.', location);\n return null;\n }\n return expression;\n}\n\nexport function parseConcreteMapping(context: ParserContext, line: SourceLine, regex: RegExp, code: string): PropertyMappingSyntax | null {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(code, 'Expected a named fixture or assertion with exactly one concrete value.', locationOf(line));\n context.skipBlock(line.indent);\n return null;\n }\n const location = locationOf(line);\n const source = parseConcrete(context, match[2], { ...location, column: location.column + line.content.indexOf(match[2], line.content.indexOf('=') + 1) }, code);\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(code, 'A fixture or return field cannot have child directives.', locationOf(child));\n context.skipBlock(line.indent);\n }\n return source === null ? null : { kind: 'PropertyMappingSyntax', property: match[1], source, location };\n}\n\nexport function parseReturn(context: ParserContext, line: SourceLine): SpecificationReturnSyntax | null {\n const prefix = thenReturnsPrefix.exec(line.content)![0].length;\n const value = line.content.substring(prefix).trim();\n const location = locationOf(line);\n if (value.length > 0) {\n const concrete = parseConcrete(context, value, { ...location, column: location.column + line.content.indexOf(value, prefix) }, DiagnosticCodes.InvalidReturnExpectation);\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidReturnExpectation, 'A scalar return expectation cannot have child assertions.', locationOf(child));\n context.skipBlock(line.indent);\n }\n return concrete === null ? null : { kind: 'ScalarSpecificationReturnSyntax', value: concrete, location };\n }\n const fields: PropertyMappingSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const field = parseConcreteMapping(context, child, fieldPattern, DiagnosticCodes.InvalidReturnExpectation);\n if (field !== null) fields.push(field);\n }\n return { kind: 'RecordSpecificationReturnSyntax', fields, location };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { CaseValueExpressionSyntax, ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { SpecificationCaseSyntax, SpecificationParameterSyntax, SpecificationSyntax } from '../Syntax/Specifications';\nimport { pattern } from '../Text/patterns';\nimport { parseMappingSource } from './ExpressionParser';\nimport { ParserContext } from './ParserContext';\nimport { parseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { parseConcrete } from './SpecificationResponseParser';\n\nconst caseHeader = new RegExp(pattern('^case\\\\s+([A-Za-z_]\\\\w*)(?:\\\\s+(?<property>[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(?<value>.+))?$').source, 'du');\nconst assignment = pattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst reference = pattern('^case\\\\.([a-z_]\\\\w*)$');\n\nexport function containsCaseReference(text: string): boolean {\n return /\\bcase\\.[a-z_]\\w*/.test(text.replace(/\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'/g, ''));\n}\n\nexport function parseSpecificationValue(text: string, location: SourceLocation, context: ParserContext, nativeIdentifiers = false): ExpressionSyntax {\n if (!text.startsWith('case.')) {\n if (containsCaseReference(text)) context.error(DiagnosticCodes.InvalidSpecificationCaseReference, 'A case reference fills a whole value position; it cannot occur inside a structured value or expression.', location);\n return parseMappingSource(text, location, context, nativeIdentifiers);\n }\n const match = reference.exec(text);\n if (match === null) context.error(DiagnosticCodes.InvalidSpecificationCaseReference, \"A case reference fills a whole value position: 'case.<parameter>'.\", location);\n return { kind: 'CaseValueExpressionSyntax', parameter: match?.[1] ?? text.substring(5), location };\n}\n\nexport function parseParameter(context: ParserContext, line: SourceLine): SpecificationParameterSyntax | null {\n const offset = line.content.indexOf(' ') + 1;\n const property = offset > 0 ? parseProperty(context, { ...line, content: line.content.substring(offset), indent: line.indent + offset }) : undefined;\n if (property === undefined || property.isGenerated || property.isIdentifier) {\n context.error(DiagnosticCodes.InvalidSpecificationParameter, \"Expected 'parameter <name> <Type>', with optional collection and optional modifiers.\", locationOf(line));\n context.skipOpaqueBlock(line.indent);\n return null;\n }\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidSpecificationParameter, 'A parameter has no body or default.', locationOf(child));\n context.skipOpaqueBlock(line.indent);\n }\n return { kind: 'SpecificationParameterSyntax', name: property.name, type: property.type, location: locationOf(line) };\n}\n\nexport function parseCase(context: ParserContext, line: SourceLine): SpecificationCaseSyntax | null {\n const match = caseHeader.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationCase, \"Expected 'case <Name>' with at most one inline parameter assignment.\", locationOf(line));\n context.skipOpaqueBlock(line.indent);\n return null;\n }\n const values: PropertyMappingSyntax[] = [];\n const add = (property: string, text: string, owner: SourceLine) => {\n const location = locationOf(owner);\n const valueLocation = { ...location, column: location.column + owner.content.indexOf(text, owner.content.indexOf('=') + 1) };\n if (text.startsWith('case.')) {\n context.error(DiagnosticCodes.InvalidSpecificationCaseValue, 'A case assigns concrete values, not case references.', valueLocation);\n return;\n }\n const source = parseConcrete(context, text, valueLocation, DiagnosticCodes.InvalidSpecificationCaseValue);\n if (source !== null) values.push({ kind: 'PropertyMappingSyntax', property, source, location: owner === line ? { ...location, column: location.column + match.indices!.groups!.property[0] } : location });\n };\n if (match.groups?.property !== undefined) add(match.groups.property, match.groups.value, line);\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const value = assignment.exec(child.content);\n if (value === null) {\n context.error(DiagnosticCodes.InvalidSpecificationCaseAssignment, \"Expected '<parameter> = <concrete value>' in a case.\", locationOf(child));\n context.skipOpaqueBlock(child.indent);\n continue;\n }\n add(value[1], value[2], child);\n const nested = context.peekChild(child.indent);\n if (nested !== undefined) {\n context.error(DiagnosticCodes.InvalidSpecificationCaseValue, 'A case value must fit on one line.', locationOf(nested));\n context.skipOpaqueBlock(child.indent);\n }\n }\n return { kind: 'SpecificationCaseSyntax', name: match[1], values, location: locationOf(line) };\n}\n\nexport function caseReferences(value: unknown): CaseValueExpressionSyntax[] {\n if (Array.isArray(value)) return value.flatMap(caseReferences);\n if (value === null || typeof value !== 'object') return [];\n if ('kind' in value && value.kind === 'CaseValueExpressionSyntax') return [value as CaseValueExpressionSyntax];\n return Object.values(value).flatMap(caseReferences);\n}\n\nexport function validateTable(specification: SpecificationSyntax, context: ParserContext): void {\n const parameters = specification.parameters ?? [];\n const cases = specification.cases ?? [];\n if ((parameters.length === 0) !== (cases.length === 0)) context.error(DiagnosticCodes.IncompleteSpecificationTable, 'A specification table requires parameters and at least one case.', specification.location);\n parameters.forEach((parameter, index) => {\n if (parameters.slice(0, index).some(prior => prior.name === parameter.name)) context.error(DiagnosticCodes.DuplicateSpecificationParameter, `Parameter '${parameter.name}' is declared more than once.`, parameter.location);\n });\n cases.forEach((row, index) => {\n if (cases.slice(0, index).some(prior => prior.name === row.name)) context.error(DiagnosticCodes.DuplicateSpecificationCase, `Case '${row.name}' is declared more than once.`, row.location);\n for (const value of row.values.filter(value => !parameters.some(parameter => parameter.name === value.property))) context.error(DiagnosticCodes.InvalidSpecificationCaseAssignment, `Case '${row.name}' assigns undeclared parameter '${value.property}'.`, value.location);\n for (const parameter of parameters.filter(parameter => row.values.filter(value => value.property === parameter.name).length !== 1)) context.error(DiagnosticCodes.InvalidSpecificationCaseAssignment, `Case '${row.name}' must assign parameter '${parameter.name}' exactly once.`, row.location);\n });\n const references = caseReferences(specification);\n for (const value of references) {\n if (cases.length === 0 || !parameters.some(parameter => parameter.name === value.parameter)) context.error(DiagnosticCodes.InvalidSpecificationCaseReference, `Case reference '${value.parameter}' requires a declared parameter in a specification table.`, value.location);\n }\n for (const parameter of parameters.filter(parameter => !references.some(value => value.parameter === parameter.name))) context.warning(DiagnosticCodes.UnusedSpecificationParameter, `Parameter '${parameter.name}' is never referenced.`, parameter.location);\n for (const value of caseReferences(specification.whenRedelivered)) context.error(DiagnosticCodes.InvalidSpecificationCaseReference, 'Case references are not permitted in redelivery locators.', value.location);\n}\n\nexport function substituteCase<T>(value: T, row: SpecificationCaseSyntax, copies = new WeakMap<object, unknown>()): T {\n if (value !== null && typeof value === 'object' && copies.has(value)) return copies.get(value) as T;\n if (Array.isArray(value)) {\n const result = value.map(item => substituteCase(item, row, copies));\n copies.set(value, result);\n return result as T;\n }\n if (value === null || typeof value !== 'object' || !('kind' in value)) return value;\n if (value.kind === 'CaseValueExpressionSyntax') {\n const parameter = (value as unknown as CaseValueExpressionSyntax).parameter;\n return (row.values.find(value => value.property === parameter)?.source ?? value) as T;\n }\n const result = Object.fromEntries(Object.entries(value).map(([key, item]) => [key, substituteCase(item, row, copies)]));\n if (value.kind === 'SpecificationErrorSyntax' && 'caseValue' in value && value.caseValue !== undefined) {\n const source = result.caseValue as ExpressionSyntax;\n result.name = source.kind === 'LiteralExpressionSyntax' ? source.value : null;\n delete result.caseValue;\n }\n copies.set(value, result);\n return result as T;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { synthesizePersonaCaller } from '../Syntax/PersonaCallers';\nimport { specificationCaseOrigins } from '../Syntax/SpecificationCaseOrigin';\nimport { substituteCase } from './SpecificationCaseParser';\nimport { dependencySources, dependencySourcesOf } from '../Syntax/DependencySources';\nimport { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { EffectiveSpecification, EffectiveSpecificationStep, EffectiveSpecificationValue, EffectiveSpecificationApplication } from '../Syntax/EffectiveSpecification';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { SpecificationCommandSyntax, SpecificationEventSyntax, SpecificationReadModelSyntax } from '../Syntax/Specifications';\nimport { SpecificationExampleSyntax } from '../Syntax/SpecificationExampleSyntax';\nimport { ApplicationSyntax, FeatureSyntax } from '../Syntax/Structure';\n\n// Validators consume effective fixtures without changing the authored syntax.\n// Resolve the example at its use site, then its type at the declaration site.\nexport function specificationExamples(application: ApplicationSyntax) {\n const entries: { name: string; scope: readonly string[]; example?: SpecificationExampleSyntax; kind?: string }[] = [];\n const examples = (nodes: readonly SpecificationExampleSyntax[] | undefined, scope: readonly string[]) => {\n for (const example of nodes ?? []) entries.push({ name: example.name, scope, example });\n };\n const features = (nodes: readonly FeatureSyntax[], parent: readonly string[]) => {\n for (const feature of nodes) {\n const scope = [...parent, feature.name];\n examples(feature.examples, scope);\n for (const slice of feature.slices) {\n const scope = [...parent, feature.name, slice.name];\n examples(slice.examples, scope);\n for (const name of new Set(eventDeclarations(slice).map(event => event.name))) entries.push({ name, scope, kind: 'event' });\n for (const command of slice.commands) entries.push({ name: command.name, scope, kind: 'command' });\n for (const model of slice.readModels) entries.push({ name: model.name, scope, kind: 'readmodel' });\n }\n features(feature.features, scope);\n }\n };\n examples(application.examples, []);\n for (const node of [...application.concepts, ...application.types]) entries.push({ name: node.name, scope: [], kind: 'type' });\n for (const module of application.modules) { examples(module.examples, [module.name]); features(module.features, [module.name]); }\n const resolve = (reference: string, scope: readonly string[]) => {\n const candidates = (reference: string) => {\n const parts = reference.split('.');\n const named = entries.filter(entry => entry.name === parts.at(-1));\n const qualifiers = parts.slice(0, -1);\n if (qualifiers.length) return named.filter(entry => qualifiers.length <= entry.scope.length && qualifiers.every((part, index) => entry.scope[entry.scope.length - qualifiers.length + index] === part));\n for (let depth = scope.length; depth >= 0; depth--) {\n const visible = named.filter(entry => depth <= entry.scope.length && scope.slice(0, depth).every((part, index) => entry.scope[index] === part));\n if (visible.length) return visible;\n }\n return [];\n };\n let matches = candidates(reference);\n const imported = application.imports.filter(entry => entry.qualifiedName.split('.').at(-1) === reference);\n if (!matches.length && imported.length === 1) matches = candidates(imported[0].qualifiedName);\n return matches.length === 1 ? matches[0] : undefined;\n };\n const fixture = (reference: string, kind: string, scope: readonly string[]) => {\n const declaration = resolve(reference, scope);\n const example = declaration?.example;\n if (!example) return null;\n const type = resolve(example.type, declaration.scope);\n return type?.kind === kind ? { example, name: [...type.scope, type.name].join('.') } : null;\n };\n const merge = (inherited: readonly PropertyMappingSyntax[], authored: readonly PropertyMappingSyntax[]) => [...inherited.filter(value => !authored.some(replacement => replacement.property === value.property)), ...authored];\n return {\n resolvedExamples: entries.filter(entry => entry.example !== undefined).flatMap(entry => {\n const type = resolve(entry.example!.type, entry.scope);\n return type?.kind === undefined ? [] : [{ example: entry.example!, kind: type.kind, name: [...type.scope, type.name].join('.'), scope: type.scope }];\n }),\n eventStep: (step: SpecificationEventSyntax, role: string, scope: readonly string[]): EffectiveSpecificationStep => {\n const resolved = fixture(step.eventType, 'event', scope);\n const example = resolved?.example ?? null;\n const inherited = example?.stream ?? example?.noStream ?? null;\n const authored = step.stream ?? step.noStream ?? null;\n const route = authored ?? inherited;\n const effective = resolved === null ? step : { ...step, eventType: resolved.name, values: merge(example!.values, step.values), for: step.for ?? example!.for, stream: route?.kind === 'SpecificationStreamSyntax' ? route : null, noStream: route?.kind === 'SpecificationNoStreamSyntax' ? route : null };\n const values: EffectiveSpecificationValue[] = effective.values.map(value => {\n const prior = example?.values.find(prior => prior.property === value.property);\n const replacement = step.values.includes(value);\n return { property: value.property, value: value.source, origin: replacement ? prior === undefined ? 'authored' : 'override' : 'example', overriddenValue: replacement ? prior?.source ?? null : null };\n });\n if (effective.for !== null) values.push({ property: 'for', value: effective.for, origin: step.for === null ? 'example' : example?.for == null ? 'authored' : 'override', overriddenValue: step.for === null ? null : example?.for ?? null });\n return { role, authored: step, effective, example, values, route: route === null ? null : { value: route, origin: authored === null ? 'example' : inherited === null ? 'authored' : 'override', overriddenValue: authored === null ? null : inherited } };\n },\n command: (action: SpecificationCommandSyntax | null, scope: readonly string[]): SpecificationCommandSyntax | null => {\n if (!action) return action;\n const effective = fixture(action.commandType, 'command', scope);\n if (!effective) return action;\n const { example, name } = effective;\n return { ...action, commandType: name, values: merge(example.values, action.values), generatedValues: merge(example.generatedValues, action.generatedValues ?? []), for: action.for ?? example.for };\n },\n readModel: (step: SpecificationReadModelSyntax, scope: readonly string[]): SpecificationReadModelSyntax => {\n const effective = fixture(step.name, 'readmodel', scope);\n if (!effective) return step;\n return { ...step, name: effective.name, properties: merge(effective.example.values, step.properties) };\n },\n };\n}\n\nexport function specificationCommandExamples(application: ApplicationSyntax): (action: SpecificationCommandSyntax | null, scope: readonly string[]) => SpecificationCommandSyntax | null {\n return specificationExamples(application).command;\n}\n\nexport function expandSpecificationExamples(application: ApplicationSyntax): ApplicationSyntax {\n return expandEffectiveSpecificationExamples(application).application;\n}\n\nexport function expandEffectiveSpecificationExamples(application: ApplicationSyntax): EffectiveSpecificationApplication {\n const effective = specificationExamples(application);\n const specifications: EffectiveSpecification[] = [];\n const features = (nodes: readonly FeatureSyntax[], parent: readonly string[]): FeatureSyntax[] => nodes.map(feature => {\n const scope = [...parent, feature.name];\n return {\n ...feature,\n features: features(feature.features, scope),\n slices: feature.slices.map(slice => {\n const scope = [...parent, feature.name, slice.name];\n const expanded = { ...slice, specifications: slice.specifications.flatMap(specification => {\n const steps: EffectiveSpecificationStep[] = [];\n const event = (step: SpecificationEventSyntax, role: string): SpecificationEventSyntax => {\n const pair = effective.eventStep(step, role, scope);\n steps.push(pair);\n return pair.effective as SpecificationEventSyntax;\n };\n const persona = application.personas.find(persona => persona.name === specification.givenCallerPersona?.name);\n const caller = persona === undefined ? null : synthesizePersonaCaller(persona, application);\n const synthesizedCaller = caller?.caller == null ? null : { ...caller.caller, location: specification.givenCallerPersona!.location };\n if (synthesizedCaller !== null) {\n steps.push({ role: 'given caller', authored: specification.givenCallerPersona!, effective: synthesizedCaller, example: null, route: null,\n values: caller!.contributions.map(atom => ({ property: atom.type ?? atom.kind, value: { kind: 'LiteralExpressionSyntax', value: atom.kind === 'authenticated' ? true : atom.value, location: atom.location }, origin: 'persona', overriddenValue: null, persona: persona!.name, policy: atom.policy })) });\n }\n const result = {\n ...specification,\n ...(synthesizedCaller === null ? {} : { givenCaller: synthesizedCaller, givenCallerPersona: undefined }),\n given: specification.given.map(step => event(step, 'given')),\n givenReadModels: specification.givenReadModels.map(step => effective.readModel(step, scope)),\n when: effective.command(specification.when, scope),\n whenAppended: specification.whenAppended === null ? null : event(specification.whenAppended, 'when append'),\n thenEvents: specification.thenEvents.map(step => event(step, 'then')),\n thenReadModels: specification.thenReadModels.map(step => effective.readModel(step, scope)),\n };\n if ((specification.cases?.length ?? 0) === 0) {\n specifications.push({ authored: specification, effective: result, steps });\n return [result];\n }\n return specification.cases!.map(row => {\n const copies = new WeakMap<object, unknown>();\n const expanded = { ...substituteCase(result, row, copies), name: `${specification.name}_${row.name}`, parameters: [], cases: [] };\n specificationCaseOrigins.set(expanded, { table: specification.name, case: row.name });\n specifications.push({ authored: specification, effective: expanded, table: specification.name, case: row.name,\n steps: steps.map(step => ({ ...step, effective: substituteCase(step.effective, row, copies),\n values: step.values.map(value => value.value.kind === 'CaseValueExpressionSyntax'\n ? { ...value, value: substituteCase(value.value, row, copies), origin: 'case', caseParameter: value.value.parameter } : value),\n route: step.route === null ? null : { ...step.route, value: substituteCase(step.route.value, row, copies) } })) });\n return expanded;\n });\n }) };\n dependencySources.set(expanded, dependencySourcesOf(slice));\n return expanded;\n }),\n };\n });\n return { application: { ...application, modules: application.modules.map(module => ({ ...module, features: features(module.features, [module.name]) })) }, specifications };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { exactIsIntegral } from '../Syntax/ExactMathFacts';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { CommandSyntax } from '../Syntax/Commands';\nimport { ConceptSyntax, PropertySyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { PropertyResponseSourceSyntax, ResponseFieldSyntax } from '../Syntax/Responses';\nimport { SpecificationSyntax } from '../Syntax/Specifications';\nimport { ApplicationSyntax, FeatureSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { InputUse } from './InputUses';\nimport { ParserContext } from './ParserContext';\nimport { responseDateValue } from './ResponseDateValues';\nimport { specificationCommandExamples } from './SpecificationCommandExamples';\n\nconst primitiveTypes = new Set(['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime']);\ninterface ScopedCommand { command: CommandSyntax; scope: readonly string[] }\n\nexport function validateResponses(application: ApplicationSyntax, context: ParserContext, inputs: readonly InputUse[] = context.inputUses): void {\n const effectiveCommand = specificationCommandExamples(application);\n const slices: { slice: SliceSyntax; scope: readonly string[] }[] = [];\n const collect = (feature: FeatureSyntax, parent: readonly string[]): void => {\n const scope = [...parent, feature.name];\n feature.slices.forEach(slice => slices.push({ slice, scope: [...scope, slice.name] }));\n feature.features.forEach(child => collect(child, scope));\n };\n application.modules.forEach(module => module.features.forEach(feature => collect(feature, [module.name])));\n const commands = new Map<string, ScopedCommand[]>();\n const properties = new Map<CommandSyntax, Map<string, PropertySyntax>>();\n const responseFields = new Map<CommandSyntax, Map<string, ResponseFieldSyntax>>();\n for (const { slice, scope } of slices) {\n for (const command of slice.commands) {\n const entries = commands.get(command.name) ?? [];\n entries.push({ command, scope });\n commands.set(command.name, entries);\n properties.set(command, uniqueByName(command.properties));\n if (command.response?.kind === 'RecordCommandResponseSyntax') responseFields.set(command, uniqueByName(command.response.fields));\n }\n }\n const imports = new Map<string, string[]>();\n for (const imported of application.imports) {\n const name = imported.qualifiedName.split('.').at(-1)!;\n imports.set(name, [...(imports.get(name) ?? []), imported.qualifiedName]);\n }\n const resolved = new Map<string, CommandSyntax | null>();\n const resolve = (name: string, from: readonly string[]): CommandSyntax | null => {\n const key = `${from.join('.')}|${name}`;\n if (resolved.has(key)) return resolved.get(key)!;\n const imported = imports.get(name) ?? [];\n const local = commands.get(name.split('.').at(-1)!) ?? [];\n const reference = local.length === 0 && imported.length === 1 ? imported[0] : name;\n const segments = reference.split('.');\n let candidates = commands.get(segments.at(-1)!) ?? [];\n if (segments.length > 1) {\n const qualifiers = segments.slice(0, -1);\n candidates = candidates.filter(entry => qualifiers.length <= entry.scope.length && qualifiers.every((value, index) => entry.scope[entry.scope.length - qualifiers.length + index] === value));\n } else {\n for (let depth = from.length; depth >= 0; depth--) {\n const visible = candidates.filter(entry => depth <= entry.scope.length && from.slice(0, depth).every((value, index) => entry.scope[index] === value));\n if (visible.length > 0) { candidates = visible; break; }\n }\n }\n const command = candidates.length === 1 ? candidates[0].command : null;\n resolved.set(key, command);\n return command;\n };\n const concepts = uniqueByName(application.concepts);\n const conceptNames = new Set(application.concepts.map(concept => concept.name));\n const composites = new Map([...uniqueByName(application.types)].map(([name, type]) => [name, uniqueByName(type.properties)]));\n const readModels = new Set(slices.flatMap(entry => entry.slice.readModels.map(model => model.name)));\n const commandProperties = new Set([...properties.keys()].flatMap(command => [...command.properties]));\n const checkDeclarations = (declared: readonly PropertySyntax[]): void => {\n for (const property of declared) {\n if (property.isGenerated && !commandProperties.has(property)) context.error(DiagnosticCodes.GeneratedPropertyOutsideCommand, 'Generated properties can only be declared on commands.', property.location);\n }\n };\n // Only these typed declarations carry PropertySyntax. Do not pull the complete extensible walker\n // into every browser parser just to inspect their generated flags.\n const checkFeature = (feature: FeatureSyntax): void => {\n feature.features.forEach(checkFeature);\n for (const slice of feature.slices) {\n for (const command of slice.commands) {\n for (const production of command.produces) if (production.inlineEvent !== null) checkDeclarations(production.inlineEvent.properties);\n }\n slice.events.forEach(event => checkDeclarations(event.properties));\n slice.readModels.forEach(model => checkDeclarations(model.properties));\n for (const reaction of slice.reactions) {\n for (const trigger of reaction.triggers) {\n for (const production of trigger.produces) if (production.inlineEvent !== null) checkDeclarations(production.inlineEvent.properties);\n }\n }\n }\n };\n application.types.forEach(type => checkDeclarations(type.properties));\n application.modules.forEach(module => module.features.forEach(checkFeature));\n const validateSource = (source: PropertyResponseSourceSyntax, explicit: TypeRefSyntax | null, command: CommandSyntax): void => {\n const property = properties.get(command)!.get(source.property);\n if (property === undefined) {\n context.error(DiagnosticCodes.InvalidResponseSource, `Response source '${source.property}' must reference one direct command property.`, source.location);\n return;\n }\n const type = property.type;\n if (type.isCollection || readModels.has(type.name)) context.error(DiagnosticCodes.InvalidResponseShape, 'Collection and whole-read-model responses are not supported.', source.location);\n if (explicit !== null && (explicit.name !== type.name || explicit.isCollection !== type.isCollection || explicit.isOptional !== type.isOptional)) context.error(DiagnosticCodes.InvalidResponseShape, \"An explicit response field type must match its source's declared type, collection shape and optionality.\", explicit.location);\n };\n for (const command of properties.keys()) {\n for (const property of command.properties) {\n if (!property.isGenerated) continue;\n const concept = concepts.get(property.type.name);\n if (property.type.isOptional || property.type.isCollection || (concept === undefined ? primitiveTypes.has(property.type.name) || composites.has(property.type.name) || conceptNames.has(property.type.name) || readModels.has(property.type.name) : concept.type !== 'Uuid')) context.error(DiagnosticCodes.InvalidGeneratedType, 'A generated property must be a required, noncollection concept backed by Uuid.', property.location);\n }\n const response = command.response;\n if (response?.kind === 'ScalarCommandResponseSyntax') validateSource(response.source, null, command);\n else if (response?.kind === 'RecordCommandResponseSyntax') {\n if (response.fields.length === 0) context.error(DiagnosticCodes.InvalidCommandResponse, 'A response block requires at least one field.', response.location);\n const names = new Set<string>();\n for (const field of response.fields) {\n if (names.has(field.name)) context.error(DiagnosticCodes.DuplicateResponseField, `Duplicate response field '${field.name}'.`, field.location);\n names.add(field.name);\n validateSource(field.source, field.type, command);\n }\n }\n }\n const validateSpecification = (specification: SpecificationSyntax, scope: readonly string[]): void => {\n const action = effectiveCommand(specification.when, scope);\n const command = action === null ? null : resolve(action.commandType, scope);\n if (action !== null && command !== null) {\n const declared = properties.get(command)!;\n for (const input of action.values) {\n if (declared.get(input.property.split('.')[0])?.isGenerated) context.error(DiagnosticCodes.GeneratedPropertySuppliedAsInput, `Generated property '${input.property}' cannot be supplied as request or form input.`, input.location);\n }\n const identifiers = [...declared.values()].filter(property => property.isIdentifier);\n if (action.for !== null && identifiers.length === 1 && identifiers[0].isGenerated) {\n const type = identifiers[0].type;\n const known = primitiveTypes.has(type.name) || concepts.has(type.name) || composites.has(type.name);\n if (known && (type.isOptional || type.isCollection || concepts.get(type.name)?.type !== 'Uuid' || action.for.kind !== 'LiteralExpressionSyntax' || typeof action.for.value !== 'string' || !uuidValue(action.for.value))) {\n context.error(DiagnosticCodes.InvalidGeneratedFixture, \"A generated identifier fixture must supply one compatible concrete UUID value through 'for'.\", action.for.location);\n }\n }\n const names = new Set<string>();\n for (const fixture of action.generatedValues ?? []) {\n const property = declared.get(fixture.property);\n if (names.has(fixture.property) || property === undefined || !property.isGenerated || property.isIdentifier || !compatibleValue(fixture.source, property.type, concepts, composites)) context.error(DiagnosticCodes.InvalidGeneratedFixture, 'A generated fixture must uniquely supply a compatible value for a nonidentifier generated command property.', fixture.location);\n names.add(fixture.property);\n }\n }\n const expectation = specification.thenReturns;\n if (expectation == null) return;\n if (action === null || specification.thenErrors.length > 0 || specification.thenDenied != null) context.error(DiagnosticCodes.InvalidReturnExpectation, 'A return expectation requires a command action and cannot accompany an error or denial.', expectation.location);\n if (command === null) return;\n const response = command.response;\n const declared = properties.get(command)!;\n if (expectation.kind === 'ScalarSpecificationReturnSyntax' && response?.kind === 'ScalarCommandResponseSyntax' && declared.has(response.source.property)) {\n if (!compatibleValue(expectation.value, declared.get(response.source.property)!.type, concepts, composites)) context.error(DiagnosticCodes.InvalidReturnExpectation, \"The expected return value must match the response source's type.\", expectation.location);\n } else if (expectation.kind === 'RecordSpecificationReturnSyntax' && response?.kind === 'RecordCommandResponseSyntax') {\n if (expectation.fields.length === 0) context.error(DiagnosticCodes.InvalidReturnExpectation, 'A record return expectation requires at least one field.', expectation.location);\n const fields = responseFields.get(command)!;\n const asserted = new Set<string>();\n for (const field of expectation.fields) {\n const contract = fields.get(field.property);\n const property = contract === undefined ? undefined : declared.get(contract.source.property);\n if (asserted.has(field.property) || property === undefined || !compatibleValue(field.source, property.type, concepts, composites)) context.error(DiagnosticCodes.InvalidReturnExpectation, 'A return assertion must uniquely name a response field and supply a compatible concrete value.', field.location);\n asserted.add(field.property);\n }\n } else {\n context.error(DiagnosticCodes.InvalidReturnExpectation, \"The return expectation must match the command's scalar or record response shape.\", expectation.location);\n }\n };\n for (const { slice, scope } of slices) slice.specifications.forEach(specification => validateSpecification(specification, scope));\n for (const input of inputs) {\n if (input.isParameter === true) continue;\n const command = resolve(input.command, input.scope);\n if (command !== null && properties.get(command)!.get(input.property.split('.')[0])?.isGenerated) context.error(DiagnosticCodes.GeneratedPropertySuppliedAsInput, `Generated property '${input.property}' cannot be supplied as request or form input.`, input.location);\n }\n}\n\nexport function uniqueByName<T extends { readonly name: string }>(items: readonly T[]): Map<string, T> {\n const result = new Map<string, T>();\n const duplicates = new Set<string>();\n for (const item of items) {\n if (result.has(item.name)) duplicates.add(item.name);\n result.set(item.name, item);\n }\n duplicates.forEach(name => result.delete(name));\n return result;\n}\n\nexport function compatibleValue(value: ExpressionSyntax, type: TypeRefSyntax, concepts: ReadonlyMap<string, ConceptSyntax>, composites: ReadonlyMap<string, ReadonlyMap<string, PropertySyntax>>): boolean {\n if (value.kind === 'LiteralExpressionSyntax' && value.value === null) return type.isOptional;\n if (type.isCollection) return value.kind === 'ListExpressionSyntax' && value.items.every(item => compatibleValue(item, { ...type, isCollection: false, isOptional: false }, concepts, composites));\n const properties = composites.get(type.name);\n if (properties !== undefined) return value.kind === 'ObjectExpressionSyntax' && value.members.every(member => {\n const property = properties.get(member.name);\n return property !== undefined && compatibleValue(member.value, property.type, concepts, composites);\n });\n const concept = concepts.get(type.name);\n const primitive = concept?.type ?? type.name;\n if (concept?.type === 'Enum') return value.kind === 'LiteralExpressionSyntax' && typeof value.value === 'string' && concept.values.includes(value.value);\n if (value.kind === 'LiteralExpressionSyntax') {\n switch (primitive) {\n case 'Uuid': return typeof value.value === 'string' && uuidValue(value.value);\n case 'String': return typeof value.value === 'string';\n case 'Bool': return typeof value.value === 'boolean';\n case 'Int': return typeof value.value === 'number' ? Number.isFinite(value.value) && Number.isInteger(value.value) : typeof value.value === 'object' && value.value !== null && exactIsIntegral(value.value);\n case 'Decimal': return typeof value.value === 'number' ? Number.isFinite(value.value) : typeof value.value === 'object' && value.value !== null && value.value.literalType === 'ExactNumber';\n case 'Date': return typeof value.value === 'string' && responseDateValue(value.value, false);\n case 'DateTime': return typeof value.value === 'string' && responseDateValue(value.value, true);\n default: return !primitiveTypes.has(primitive);\n }\n }\n return !primitiveTypes.has(primitive) && concept === undefined;\n}\n\n// Shared with ResponseValueTypes.cs: 32 hex digits (N), hyphenated UUIDs (D), or D wrapped in\n// braces (B) / parentheses (P). Hex is case-insensitive; whitespace and X initializer notation\n// are not admitted in response/fixture values. The lookahead requires the true end, even after a newline.\nconst uuidValuePattern = /^(?:[0-9a-f]{32}|[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}|\\{[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\\}|\\([0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\\))(?![\\s\\S])/i;\n\nfunction uuidValue(text: string): boolean {\n return uuidValuePattern.test(text);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { CommandSyntax } from '../Syntax/Commands';\nimport { TypeRefSyntax } from '../Syntax/Declarations';\nimport { ProductionDestinationContext } from '../Syntax/ProductionDestinationContext';\nimport { implicitDestination } from '../Syntax/ProductionDestinations';\nimport { ProducesSyntax } from '../Syntax/Reactions';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { uniqueByName } from './ResponseValidator';\n\nexport function commandPathType(command: CommandSyntax, path: string, application: ApplicationSyntax): TypeRefSyntax | null {\n const composites = uniqueByName(application.types);\n let fields = command.properties;\n let result: TypeRefSyntax | null = null;\n let optional = false;\n let collection = false;\n for (const segment of path.split('.')) {\n const matches = fields.filter(field => field.name === segment);\n if (matches.length !== 1) return null;\n const type = matches[0].type;\n optional ||= type.isOptional;\n collection ||= type.isCollection;\n result = { ...type, isOptional: optional, isCollection: collection };\n fields = composites.get(type.name)?.properties ?? [];\n }\n return result;\n}\n\nexport function commandDestinationType(command: CommandSyntax, produced: ProducesSyntax, application: ApplicationSyntax, context: ProductionDestinationContext): TypeRefSyntax | null {\n const destination = produced.for?.kind === 'PathExpressionSyntax' ? produced.for.path : implicitDestination(command, produced, context);\n return destination === 'new event source'\n ? command.properties.find(property => property.isGenerated && property.isIdentifier)?.type ?? { kind: 'TypeRefSyntax', name: 'Uuid', isOptional: false, isCollection: false, location: produced.location }\n : destination === undefined ? null : commandPathType(command, destination, application);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { PropertySyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { ApplicationSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { uniqueByName } from './ResponseValidator';\n\nconst primitives = new Set(['String', 'Uuid', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime']);\n\n// The scoped declaration facts used by the C# refusal and redelivery consistency validators.\nexport class RefusalDeclarations {\n readonly slices: AuthoringProductionResolver['slices'];\n readonly types;\n readonly concepts;\n private readonly events;\n private readonly knownTypes: Set<string>;\n\n constructor(readonly application: ApplicationSyntax) {\n this.slices = new AuthoringProductionResolver(application).slices;\n this.types = uniqueByName(application.types);\n this.concepts = uniqueByName(application.concepts);\n this.knownTypes = new Set([...primitives, ...application.types.map(type => type.name), ...application.concepts.map(concept => concept.name)]);\n this.events = new Map(this.slices.map(({ slice }) => {\n const latest = new Map<string, ReturnType<typeof eventDeclarations>[number]>();\n for (const event of eventDeclarations(slice)) {\n if (!latest.has(event.name) || latest.get(event.name)!.generation < event.generation) latest.set(event.name, event);\n }\n return [slice, [...latest.values()]];\n }));\n }\n\n resolve<T extends { readonly name: string }>(name: string, from: SliceSyntax, select: (slice: SliceSyntax) => readonly T[]): { node: T; slice: SliceSyntax } | null {\n const entries = this.slices.flatMap(({ slice, scope }) => select(slice).map(node => ({ node, slice, scope })));\n const scope = this.slices.find(entry => entry.slice === from)?.scope ?? [];\n const candidates = (reference: string) => {\n const parts = reference.split('.');\n const named = entries.filter(entry => entry.node.name === parts.at(-1));\n const qualifiers = parts.slice(0, -1);\n if (qualifiers.length > 0) return named.filter(entry => qualifiers.length <= entry.scope.length && qualifiers.every((part, index) => entry.scope[entry.scope.length - qualifiers.length + index] === part));\n for (let depth = scope.length; depth >= 0; depth--) {\n const visible = named.filter(entry => depth <= entry.scope.length && scope.slice(0, depth).every((part, index) => entry.scope[index] === part));\n if (visible.length > 0) return visible;\n }\n return [];\n };\n let matches = candidates(name);\n if (matches.length === 0) {\n const imports = this.application.imports.filter(imported => imported.qualifiedName.split('.').at(-1) === name);\n if (imports.length === 1) matches = candidates(imports[0].qualifiedName);\n }\n return matches.length === 1 ? matches[0] : null;\n }\n\n event(name: string, from: SliceSyntax) {\n return this.resolve(name, from, slice => this.events.get(slice) ?? [])?.node ?? null;\n }\n\n property(properties: readonly PropertySyntax[] | null, path: string): PropertySyntax | null {\n const parts = path.split('.');\n for (const [index, part] of parts.entries()) {\n const matches: readonly PropertySyntax[] = properties?.filter(property => property.name === part) ?? [];\n if (matches.length !== 1) return null;\n const property = matches[0];\n if (index === parts.length - 1) return property;\n if (primitives.has(property.type.name) || this.concepts.has(property.type.name) && !this.application.types.some(type => type.name === property.type.name)) return null;\n properties = this.types.get(property.type.name)?.properties ?? null;\n }\n return null;\n }\n\n compatible(source: TypeRefSyntax, target: TypeRefSyntax): boolean | null {\n return this.knownTypes.has(source.name) && this.knownTypes.has(target.name)\n ? source.name === target.name && source.isCollection === target.isCollection && (!source.isOptional || target.isOptional) : null;\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { EventSyntax, PropertySyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { EventSourceCatalog } from '../Syntax/EventSourceCatalog';\nimport { EventSourceResolutionKind } from '../Syntax/EventSources';\nimport { SpecificationSyntax } from '../Syntax/Specifications';\nimport { commandDestinationType } from './CommandDestinationTypes';\nimport { ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { ApplicationSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\nimport { RefusalDeclarations } from './RefusalDeclarations';\nimport { compatibleValue } from './ResponseValidator';\nimport { specificationExamples } from './SpecificationCommandExamples';\n\nconst primitives = new Set(['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime']);\n\nexport function validateSpecificationCases(application: ApplicationSyntax, context: ParserContext, standaloneSpecifications?: readonly SpecificationSyntax[]): void {\n const declarations = new RefusalDeclarations(application);\n const examples = specificationExamples(application);\n const knownType = (name: string) => primitives.has(name) || declarations.concepts.has(name) || declarations.types.has(name);\n const composites = new Map([...declarations.types].map(([name, type]) => [name, new Map(type.properties.map(property => [property.name, property]))]));\n const owners = standaloneSpecifications === undefined ? declarations.slices : [{ scope: [], slice: {\n kind: 'SliceSyntax' as const, type: 'StateChange' as const, name: '', description: null, location: application.location,\n events: [], commands: [], queries: [], projections: [], captures: [], reactions: [], constraints: [], readModels: [], screens: [], specifications: standaloneSpecifications,\n } }];\n for (const { slice, scope } of owners) {\n const names = new Map<string, number>();\n for (const specification of slice.specifications) {\n const expandedNames = (specification.cases?.length ?? 0) === 0 ? [specification.name] : specification.cases!.map(row => `${specification.name}_${row.name}`);\n for (const name of expandedNames) names.set(name, (names.get(name) ?? 0) + 1);\n if ((specification.cases?.length ?? 0) > 0) names.set(specification.name, (names.get(specification.name) ?? 0) + 1);\n }\n for (const specification of slice.specifications) {\n for (const row of specification.cases ?? []) {\n if ((names.get(`${specification.name}_${row.name}`) ?? 0) > 1) context.error(DiagnosticCodes.SpecificationCaseNameCollision, `Case '${row.name}' derives specification '${specification.name}_${row.name}', which collides in this ${standaloneSpecifications === undefined ? 'slice' : 'document'}.`, row.location);\n }\n for (const parameter of specification.parameters ?? []) {\n if (standaloneSpecifications === undefined && !knownType(parameter.type.name)) context.error(DiagnosticCodes.IncompatibleSpecificationParameterType, `Parameter '${parameter.name}' has unknown type '${parameter.type.name}'.`, parameter.type.location);\n for (const row of specification.cases ?? []) {\n for (const assignment of row.values.filter(value => value.property === parameter.name)) {\n if (!compatibleValue(assignment.source, parameter.type, declarations.concepts, composites)) context.error(DiagnosticCodes.InvalidSpecificationCaseValue, `Case '${row.name}' parameter '${parameter.name}' requires a concrete value of type '${parameter.type.name}'.`, assignment.source.location);\n }\n }\n }\n const check = (expression: ExpressionSyntax | null, target: TypeRefSyntax | undefined, property: string) => {\n if (expression?.kind !== 'CaseValueExpressionSyntax' || target === undefined) return;\n const parameter = specification.parameters?.find(parameter => parameter.name === expression.parameter);\n if (parameter === undefined) return;\n if (parameter.type.isOptional && !target.isOptional) context.error(DiagnosticCodes.OptionalSpecificationParameterTarget, `Optional parameter '${parameter.name}' cannot supply required target '${property}'.`, expression.location);\n if (standaloneSpecifications !== undefined && (!knownType(parameter.type.name) || !knownType(target.name))) return;\n const sourceConcept = declarations.concepts.get(parameter.type.name);\n const targetConcept = declarations.concepts.get(target.name);\n const compatible = parameter.type.name === target.name || sourceConcept?.type !== 'Enum' && sourceConcept?.type === target.name || targetConcept?.type !== 'Enum' && targetConcept?.type === parameter.type.name;\n if (!compatible || parameter.type.isCollection !== target.isCollection) context.error(DiagnosticCodes.IncompatibleSpecificationParameterType, `Parameter '${parameter.name}' type '${parameter.type.name}' is incompatible with target '${property}' type '${target.name}'.`, expression.location);\n };\n const assignments = (values: readonly PropertyMappingSyntax[], properties: readonly PropertySyntax[] | null) => {\n for (const value of values) check(value.source, declarations.property(properties, value.property)?.type, value.property);\n };\n const command = examples.command(specification.when, scope);\n if (command !== null) {\n const properties = declarations.resolve(command.commandType, slice, slice => slice.commands)?.node.properties ?? null;\n assignments(command.values, properties);\n assignments(command.generatedValues ?? [], properties);\n check(command.for, properties?.find(property => property.isIdentifier)?.type, 'for');\n }\n if (command !== null && specification.thenReturns != null) {\n const declaration = declarations.resolve(command.commandType, slice, slice => slice.commands)?.node;\n const response = declaration?.response;\n if (specification.thenReturns.kind === 'ScalarSpecificationReturnSyntax' && response?.kind === 'ScalarCommandResponseSyntax') check(specification.thenReturns.value, declaration?.properties.find(property => property.name === response.source.property)?.type, 'value');\n if (specification.thenReturns.kind === 'RecordSpecificationReturnSyntax' && response?.kind === 'RecordCommandResponseSyntax') {\n for (const value of specification.thenReturns.fields) {\n const field = response.fields.find(field => field.name === value.property);\n check(value.source, field?.type ?? declaration?.properties.find(property => property.name === field?.source.property)?.type, value.property);\n }\n }\n }\n for (const authored of [...specification.given, ...specification.thenEvents, ...(specification.whenAppended === null ? [] : [specification.whenAppended])]) {\n const event = examples.eventStep(authored, 'given', scope).effective as typeof authored;\n assignments(event.values, declarations.event(event.eventType, slice)?.properties ?? null);\n const route = event.stream == null ? null : new EventSourceCatalog(application).resolve(event.stream.eventSource, event.stream.stream);\n const source = route?.kind === EventSourceResolutionKind.Unique ? route.sources[0] : undefined;\n const stream = route?.kind === EventSourceResolutionKind.Unique ? route.streams[0] : undefined;\n check(event.for, event.stream != null && source === undefined ? undefined : source?.identifier ?? eventDestinationType(event.eventType, slice, application, declarations), 'for');\n if (event.stream?.streamId != null) check(event.stream.streamId.source, stream?.streamId ?? undefined, 'streamId');\n for (const part of event.stream?.streamIdParts ?? []) check(part.source, stream?.streamIdParts.find(declaration => declaration.name === part.property)?.type, part.property);\n }\n for (const authored of [...specification.givenReadModels, ...specification.thenReadModels]) {\n const model = examples.readModel(authored, scope);\n assignments(model.properties, declarations.resolve(model.name, slice, slice => slice.readModels)?.node.properties ?? null);\n }\n if (specification.whenTrigger != null) {\n const trigger = (application.declaredTriggers ?? []).find(trigger => trigger.name === specification.whenTrigger!.trigger);\n for (const value of specification.whenTrigger.values) check(value.source, trigger?.data.find(property => property.name === value.property)?.type, value.property);\n }\n for (const error of specification.thenErrors) check(error.caseValue ?? null, { kind: 'TypeRefSyntax', name: 'String', isOptional: false, isCollection: false, location: error.location }, 'message');\n for (const absent of specification.thenAbsentReadModels ?? []) {\n const model = declarations.resolve(absent.name, slice, slice => slice.readModels)?.node;\n const keyed = declarations.slices.flatMap(({ slice: owner }) => owner.queries.filter(query => query.by !== null && declarations.resolve(query.returnType.name, owner, slice => slice.readModels)?.node === model));\n check(absent.key, model !== undefined && keyed.length === 1 ? keyed[0].by!.type : undefined, 'for');\n }\n for (const query of [...(specification.thenQueries ?? []), ...(specification.whenQuery === null ? [] : [specification.whenQuery])]) {\n const declaration = declarations.resolve(query.query, slice, slice => slice.queries);\n const parameters = declaration === null ? [] : [...(declaration.node.by === null ? [] : [declaration.node.by]), ...declaration.node.filters].map(parameter => ({ ...parameter, kind: 'PropertySyntax' as const, isIdentifier: false }));\n assignments(query.arguments, parameters);\n const properties = declaration === null ? null : declarations.resolve(declaration.node.returnType.name, declaration.slice, slice => slice.readModels)?.node.properties ?? null;\n const results = query.kind === 'SpecificationQuerySyntax' ? query.results : specification.thenResults;\n for (const result of results) assignments(result.properties, properties);\n }\n }\n }\n}\n\nfunction uniqueDestinationType(types: readonly TypeRefSyntax[]): TypeRefSyntax | undefined {\n const distinct = new Map(types.map(type => [JSON.stringify([type.name, type.isOptional, type.isCollection]), type]));\n return distinct.size === 1 ? [...distinct.values()][0] : undefined;\n}\n\nfunction eventDestinationType(reference: string, local: SliceSyntax, application: ApplicationSyntax, declarations: RefusalDeclarations): TypeRefSyntax | undefined {\n const resolver = new AuthoringProductionResolver(application);\n const event = declarations.event(reference, local);\n if (event === null) return undefined;\n const commandTypes = (event: EventSyntax, owners = declarations.slices): TypeRefSyntax[] => owners.flatMap(({ slice }) => slice.commands.flatMap(command => command.produces\n .filter(produced => resolver.isEventProduction(produced, slice) && declarations.event(produced.event, slice) === event)\n .map(produced => commandDestinationType(command, produced, application, { resolver, slice })).filter((type): type is TypeRefSyntax => type !== null)));\n const producerTypes = (event: EventSyntax, visited: Set<EventSyntax>): TypeRefSyntax[] => {\n if (visited.has(event)) return [];\n visited.add(event);\n const types = commandTypes(event);\n for (const { slice } of declarations.slices) {\n for (const trigger of slice.reactions.flatMap(reaction => reaction.triggers)) {\n const sourceName = trigger.source.kind === 'NamedTriggerSourceSyntax' ? trigger.source.name : undefined;\n const source = sourceName === undefined ? null : declarations.event(sourceName, slice);\n for (const produced of trigger.produces.filter(produced => declarations.event(produced.event, slice) === event)) {\n if (produced.for?.kind === 'PathExpressionSyntax') {\n const path = produced.for.path;\n const type = declarations.property(source?.properties ?? null, path)?.type ?? (sourceName === undefined ? undefined\n : (application.declaredTriggers ?? []).find(declared => declared.name === sourceName)?.data.find(property => property.name === path)?.type);\n if (type !== undefined) types.push(type);\n } else if (produced.for?.kind === 'LiteralExpressionSyntax') types.push({ kind: 'TypeRefSyntax', name: 'String', isOptional: false, isCollection: false, location: produced.location });\n else if (produced.for === null && source !== null) types.push(...producerTypes(source, visited));\n }\n }\n if (slice.captures.flatMap(capture => [...capture.appends, ...capture.children.flatMap(child => child.appends), ...capture.nested.flatMap(nested => nested.appends)]).some(append => declarations.event(append.event, slice) === event))\n types.push(uniqueDestinationType(commandTypes(event)) ?? { kind: 'TypeRefSyntax', name: 'String', isOptional: false, isCollection: false, location: event.location });\n }\n return types;\n };\n return uniqueDestinationType(commandTypes(event, declarations.slices.filter(owner => owner.slice === local))) ?? uniqueDestinationType(commandTypes(event)) ?? uniqueDestinationType(producerTypes(event, new Set()));\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { Diagnostic } from './Diagnostic';\nimport { DiagnosticCodes } from './DiagnosticCodes';\n\n// Routing advice is appended after source validation, as in the C# compiler. It changes no default.\nexport function productionDestinationDiagnostics(application: ApplicationSyntax): Diagnostic[] {\n const resolver = new AuthoringProductionResolver(application);\n return resolver.slices.flatMap(({ slice }) => slice.commands.flatMap(command => {\n const identifiers = command.properties.filter(property => property.isIdentifier && !property.type.isOptional && !property.type.isCollection);\n if (identifiers.length !== 1) return [];\n return command.produces.filter(production => resolver.isEventProduction(production, slice) && production.inlineEvent === null && production.when === null && production.for === null)\n .map(production => ({ severity: 'information' as const, code: DiagnosticCodes.OmittedProductionDestination,\n message: `Plain 'produces ${production.event}' omits its destination - use 'for ${identifiers[0].name}' to explicitly select the command's identifier.`, location: production.location }));\n }));\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\n\n// Mirrors ScreenplayValidator.ValidateConstraintProperties: direct fields only, across all generations.\n// Unknown/imported events, dotted paths and fields removed in a later generation remain C# binder checks.\nexport function validateConstraintProperties(application: ApplicationSyntax, context: ParserContext): void {\n const slices = new AuthoringProductionResolver(application).slices.map(entry => entry.slice);\n const events = slices.flatMap(eventDeclarations);\n for (const slice of slices) {\n for (const rule of slice.constraints.flatMap(constraint => [constraint, ...constraint.additionalRules])) {\n if (rule.kind !== 'UniquePropertyConstraintSyntax') continue;\n const declarations = events.filter(event => event.name === rule.event);\n if (declarations.length === 0) continue;\n for (const property of [rule.property, ...rule.additionalProperties]) {\n if (property.includes('.') || declarations.some(event => event.properties.some(field => field.name === property))) continue;\n context.error(DiagnosticCodes.UnknownConstraintProperty,\n `Constraint '${rule.name}' names property '${property}', which event '${rule.event}' does not declare.`, rule.location);\n }\n }\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ParserContext } from '../Parsing/ParserContext';\nimport { ApplicationSyntax, DependsOnSyntax, FeatureSyntax } from '../Syntax/Structure';\n\nexport interface DependencyContainer {\n readonly name: string;\n readonly scope: readonly string[];\n}\n\nconst same = (left: readonly string[], right: readonly string[]) => left.length === right.length && left.every((segment, index) => segment === right[index]);\nconst addressOf = (container: DependencyContainer) => [...container.scope, container.name].join('.');\n\n// Children sets only: siblings, ancestors' siblings, then root modules. Dotted references match suffixes.\nexport class DeclaredDependencyTargets {\n static containersOf(application: ApplicationSyntax): DependencyContainer[] {\n const containers: DependencyContainer[] = [];\n const inventory = (feature: FeatureSyntax, parent: readonly string[]): void => {\n containers.push({ name: feature.name, scope: parent });\n feature.features.forEach(child => inventory(child, [...parent, feature.name]));\n };\n for (const module of application.modules) {\n containers.push({ name: module.name, scope: [] });\n module.features.forEach(feature => inventory(feature, [module.name]));\n }\n return [...new Map(containers.map(container => [addressOf(container), container])).values()];\n }\n\n static candidates(from: readonly string[], containers: readonly DependencyContainer[]): { container: DependencyContainer; reference: string; tier: number | 'qualified' }[] {\n const owner = from.join('.');\n return containers.flatMap(container => {\n const address = addressOf(container);\n if (address === owner || address.startsWith(owner + '.') || owner.startsWith(address + '.')) return [];\n const parts = [...container.scope, container.name];\n for (let length = 1; length <= parts.length; length++) {\n const reference = parts.slice(-length).join('.');\n if (this.resolve(reference, from, containers).resolved !== container) continue;\n const tier: number | 'qualified' = length === 1 ? from.length - 1 - container.scope.length : 'qualified';\n return [{ container, reference, tier }];\n }\n return [];\n }).sort((left, right) => (left.tier === 'qualified' ? from.length : left.tier) - (right.tier === 'qualified' ? from.length : right.tier));\n }\n\n static resolve(reference: string, from: readonly string[], containers: readonly DependencyContainer[]): { resolved?: DependencyContainer; ambiguous: readonly DependencyContainer[] } {\n const segments = reference.split('.');\n if (segments.length > 1) {\n const matches = containers.filter(container => same([...container.scope, container.name].slice(-segments.length), segments));\n return matches.length === 1 ? { resolved: matches[0], ambiguous: [] } : { ambiguous: matches };\n }\n for (let depth = from.length - 1; depth >= 0; depth--) {\n const matches = containers.filter(container => container.name === reference && same(container.scope, from.slice(0, depth)));\n if (matches.length > 0) return matches.length === 1 ? { resolved: matches[0], ambiguous: [] } : { ambiguous: matches };\n }\n return { ambiguous: [] };\n }\n}\n\nexport function validateDependencyDeclarations(application: ApplicationSyntax, context: ParserContext): ApplicationSyntax {\n const hasDependencies = (container: { dependsOn?: readonly DependsOnSyntax[]; features: readonly FeatureSyntax[] }): boolean =>\n (container.dependsOn?.length ?? 0) > 0 || container.features.some(hasDependencies);\n if (!application.modules.some(hasDependencies)) return application;\n const containers = DeclaredDependencyTargets.containersOf(application);\n\n const seenByOwner = new Map<string, Set<string>>();\n const keep = (dependencies: readonly DependsOnSyntax[], from: readonly string[]): DependsOnSyntax[] => {\n const kept: DependsOnSyntax[] = [];\n const owner = from.join('.');\n if (!seenByOwner.has(owner)) seenByOwner.set(owner, new Set());\n const seen = seenByOwner.get(owner)!;\n for (const dependency of dependencies) {\n const resolution = DeclaredDependencyTargets.resolve(dependency.target, from, containers);\n const target = resolution.resolved === undefined ? undefined : addressOf(resolution.resolved);\n const key = target === undefined ? `text:${dependency.target}` : `resolved:${target}`;\n if (seen.has(key)) {\n context.warning(DiagnosticCodes.RepeatedDependencyDeclaration, `Dependency '${dependency.target}' is already declared on this container - this repeated declaration is ignored`, dependency.location);\n continue;\n }\n seen.add(key);\n kept.push(dependency);\n if (resolution.ambiguous.length > 0) {\n context.warning(DiagnosticCodes.AmbiguousReference, `Ambiguous dependency target '${dependency.target}' - candidates: ${resolution.ambiguous.map(addressOf).join(', ')}`, dependency.location);\n } else if (target === undefined || target === owner || target.startsWith(owner + '.') || owner.startsWith(target + '.')) {\n context.warning(DiagnosticCodes.InvalidDependencyTarget, `Invalid dependency target '${dependency.target}' on '${owner}' - the target must resolve to another module or feature, not self, an ancestor, or a descendant`, dependency.location);\n }\n }\n return kept;\n };\n const normalize = (feature: FeatureSyntax, parent: readonly string[]): FeatureSyntax => {\n const address = [...parent, feature.name];\n return { ...feature, dependsOn: keep(feature.dependsOn ?? [], address), features: feature.features.map(child => normalize(child, address)) };\n };\n return { ...application, modules: application.modules.map(module => ({ ...module, dependsOn: keep(module.dependsOn ?? [], [module.name]), features: module.features.map(feature => normalize(feature, [module.name])) })) };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// Where the top level of a .play file belongs: the module name followed by the names of the nested features,\n// outermost first, and empty for the application itself - the port of the C# PlayPlacement. A file is placed\n// by the import that brings it in: written inside 'module Ordering' and 'feature Orders', it places the\n// imported file at Ordering.Orders, so what the file declares at its top level is the body of that feature.\nexport type PlayPlacement = readonly string[];\n\n// The placement of a whole document - its top level is the application's.\nexport const documentPlacement: PlayPlacement = [];\n\n// Whether a file is a whole document rather than placed in a module or feature.\nexport const isDocumentPlacement = (placement: PlayPlacement): boolean => placement.length === 0;\n\n// The placement as it reads in a diagnostic, such as module 'Ordering' or feature 'Ordering.Orders'.\nexport function describePlacement(placement: PlayPlacement): string {\n if (placement.length === 0) return 'the application';\n if (placement.length === 1) return `module '${placement[0]}'`;\n return `feature '${placement.join('.')}'`;\n}\n\n// Whether one placement lies inside another, or is the same - the other's scope is a prefix of this one.\nexport const isWithinOrSame = (placement: PlayPlacement, other: PlayPlacement): boolean =>\n other.length <= placement.length && other.every((name, index) => name === placement[index]);\n\nexport const samePlacement = (left: PlayPlacement, right: PlayPlacement): boolean =>\n left.length === right.length && isWithinOrSame(left, right);\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { AuthorizeSyntax, LogicalOperator, PolicyRequirementSyntax } from '../Syntax/Authorization';\nimport { pattern } from '../Text/patterns';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst continuationPattern = pattern('^(?:(?:or|and)\\\\s+)?[A-Za-z_(][\\\\w\\\\s()]*$');\nconst tokenPattern = new RegExp(pattern('\\\\(|\\\\)|[A-Za-z_]\\\\w*').source, 'gu');\nconst namePattern = pattern('^[A-Z]\\\\w*$');\n\n// The port of the C# AuthorizeParser: the requirement may continue on the lines below the 'authorize', and\n// two operands written side by side are joined by an implicit 'and'.\nexport function parseAuthorize(context: ParserContext, line: SourceLine): AuthorizeSyntax | null {\n let text = line.content.substring('authorize'.length);\n for (let child = context.peekChild(line.indent); child !== undefined && continuationPattern.test(child.content); child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n text += ` ${child.content}`;\n }\n const tokens = tokenize(text);\n const location = locationOf(line);\n if (tokens.length === 0) {\n context.error(DiagnosticCodes.AuthorizeWithoutPolicy, 'Expected at least one policy after \\'authorize\\'', location);\n return null;\n }\n const parser = new RequirementParser(context, tokens, location);\n const requirement = parser.parse();\n return requirement === null ? null : { kind: 'AuthorizeSyntax', requirement, location };\n}\n\n// Several 'authorize' lines on one construct all have to hold, so they combine with 'and'.\nexport function combineAuthorize(first: AuthorizeSyntax | null, next: AuthorizeSyntax | null): AuthorizeSyntax | null {\n if (first === null) return next;\n if (next === null) return first;\n return {\n kind: 'AuthorizeSyntax',\n requirement: { kind: 'LogicalPolicyRequirementSyntax', left: first.requirement, operator: 'And', right: next.requirement, location: first.location },\n location: first.location,\n };\n}\n\nfunction tokenize(text: string): string[] {\n const tokens: string[] = [];\n for (const token of text.match(tokenPattern) ?? []) {\n if (tokens.length > 0 && isOperandEnd(tokens[tokens.length - 1]) && isOperandStart(token)) {\n tokens.push('and');\n }\n tokens.push(token);\n }\n return tokens;\n}\n\nconst isName = (token: string): boolean => token !== '(' && token !== ')' && token !== 'and' && token !== 'or';\nconst isOperandEnd = (token: string): boolean => token === ')' || isName(token);\nconst isOperandStart = (token: string): boolean => token === '(' || isName(token);\n\n// The port of the C# LogicalConditionParser: 'or' over 'and' over a group or a policy name.\nclass RequirementParser {\n #position = 0;\n\n constructor(private readonly context: ParserContext, private readonly tokens: readonly string[], private readonly location: SourceLocation) {}\n\n parse(): PolicyRequirementSyntax | null {\n const requirement = this.#or();\n if (requirement !== null && this.#position < this.tokens.length) {\n this.context.error(DiagnosticCodes.UnexpectedTokenInAuthorize, `Unexpected '${this.tokens[this.#position]}' in authorize`, this.location);\n }\n return requirement;\n }\n\n #or(): PolicyRequirementSyntax | null {\n return this.#chain('or', 'Or', () => this.#and());\n }\n\n #and(): PolicyRequirementSyntax | null {\n return this.#chain('and', 'And', () => this.#groupOrReference());\n }\n\n #chain(token: string, operator: LogicalOperator, operand: () => PolicyRequirementSyntax | null): PolicyRequirementSyntax | null {\n let left = operand();\n while (left !== null && this.tokens[this.#position] === token) {\n this.#position++;\n const right = operand();\n if (right === null) {\n return null;\n }\n left = { kind: 'LogicalPolicyRequirementSyntax', left, operator, right, location: this.location };\n }\n return left;\n }\n\n #groupOrReference(): PolicyRequirementSyntax | null {\n if (this.tokens[this.#position] !== '(') {\n return this.#reference();\n }\n this.#position++;\n const requirement = this.#or();\n if (this.tokens[this.#position] === ')') {\n this.#position++;\n } else {\n this.context.error(DiagnosticCodes.UnclosedAuthorizeGroup, 'Expected \\')\\' in authorize', this.location);\n }\n return requirement;\n }\n\n #reference(): PolicyRequirementSyntax | null {\n if (this.#position >= this.tokens.length) {\n this.context.error(DiagnosticCodes.AuthorizeWithoutPolicy, 'Expected a policy name', this.location);\n return null;\n }\n const token = this.tokens[this.#position++];\n if (!namePattern.test(token)) {\n this.context.error(DiagnosticCodes.InvalidPolicyReference, `Invalid policy reference '${token}' - policy names are PascalCase identifiers`, this.location);\n return null;\n }\n return { kind: 'PolicyReferenceSyntax', name: token, location: this.location };\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Reads the body of a fenced block that follows a directive, the way the C# CodeBlockParser does: the\n// opening fence is either on the directive's own line or the next deeper line, and the body runs to a line\n// holding only the closing fence. Body lines lose up to the opening fence's indent.\nexport function parseFencedText(context: ParserContext, opener: string, tagLine: SourceLine, allowMarkdown = false): string | null {\n const onTagLine = tagLine.content.startsWith('```');\n const open = onTagLine ? tagLine : context.reader.peekSignificant();\n const expectedFence = opener === 'description' ? '```text' : `\\`\\`\\`${opener}`;\n if (open === undefined || (open !== tagLine && open.indent <= tagLine.indent) ||\n (open.content !== expectedFence && !(allowMarkdown && opener === 'description' && open.content === '```markdown') && !(open.content === '```' && open !== tagLine))) {\n context.error(DiagnosticCodes.ExpectedCodeFence, `Expected an opening \\`\\`\\`${opener === 'description' ? 'text' : opener} fence after '${opener}'`, locationOf(tagLine));\n return null;\n }\n if (open !== tagLine) {\n context.reader.takeSignificant();\n }\n if (opener === 'description' && open.content === '```') {\n context.warning(DiagnosticCodes.LegacyInlineCodeFence, 'A bare description fence is deprecated - use \\'```text\\' instead', locationOf(open));\n }\n const code: string[] = [];\n for (;;) {\n const line = context.reader.takeRaw();\n if (line === undefined) {\n context.error(DiagnosticCodes.UnclosedCodeBlock, 'Unclosed inline code block - expected a closing ``` line', locationOf(open));\n break;\n }\n if (line.raw.trim() === '```') {\n break;\n }\n let strip = 0;\n while (strip < open.indent && strip < line.raw.length && line.raw[strip] === ' ') {\n strip++;\n }\n code.push(line.raw.substring(strip));\n }\n return code.join('\\n');\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { pattern } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { parseFencedText } from './CodeBlockParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst descriptionPattern = pattern(`^description\\\\s+\"(${stringBodyPattern})\"$`);\n\n// Reads 'description \"<text>\"' or a 'description' followed by a ```text fence. A construct keeps its first\n// description; a second one is reported and ignored.\nexport function parseDescription(context: ParserContext, line: SourceLine, existing: string | null, owner: string, allowMarkdown = false): string | null {\n if (line.content === 'description') {\n const text = parseFencedText(context, 'description', line, allowMarkdown);\n if (text === null) {\n return existing;\n }\n if (text.trim().length === 0) {\n context.error(DiagnosticCodes.EmptyDescription, `${owner} declares an empty description - the fenced block must contain text`, locationOf(line));\n return existing;\n }\n return keep(context, line, existing, owner, text);\n }\n const match = descriptionPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidDescription, `Invalid description '${line.content}' - expected 'description \"<text>\"'`, locationOf(line));\n return existing;\n }\n return keep(context, line, existing, owner, unescapeString(match[1]));\n}\n\nfunction keep(context: ParserContext, line: SourceLine, existing: string | null, owner: string, description: string): string | null {\n if (existing !== null) {\n context.error(DiagnosticCodes.DuplicateDescription, `${owner} already declares a description - at most one is allowed`, locationOf(line));\n return existing;\n }\n return description;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { PurposeReferenceSyntax, PurposeSyntax, PurposeTransferSyntax } from '../Syntax/Purposes';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { pattern } from '../Text/patterns';\nimport { parseDescription } from './DescriptionParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = pattern('^purpose\\\\s+([A-Za-z_]\\\\w*)$');\nconst vocabulary = pattern(`^(basis|condition)\\\\s+(\\\\w+)(?:\\\\s+\"(${stringBodyPattern})\")?$`);\nconst textField = pattern(`^(interest|authorization|retention|recipient)\\\\s+\"(${stringBodyPattern})\"$`);\nconst transfer = pattern(`^transfer\\\\s+\"(${stringBodyPattern})\"\\\\s+safeguard\\\\s+\"(${stringBodyPattern})\"$`);\nconst identifier = pattern('^[A-Za-z_]\\\\w*$');\nconst erasure = pattern('^erasure\\\\s+exception\\\\s+(\\\\w+)$');\nconst bases = ['consent', 'contract', 'legalObligation', 'vitalInterests', 'publicTask', 'legitimateInterests'];\nconst conditions = ['explicitConsent', 'employmentLaw', 'vitalInterests', 'notForProfit', 'madePublic', 'legalClaims', 'substantialPublicInterest', 'healthCare', 'publicHealth', 'research'];\nconst exceptions = ['expression', 'legalObligation', 'publicTask', 'publicHealth', 'archiving', 'legalClaims'];\n\nexport function parsePurpose(context: ParserContext, line: SourceLine): PurposeSyntax {\n const name = purposeName(context, line);\n let purpose: PurposeSyntax = { kind: 'PurposeSyntax', name, description: null, basis: null, basisReference: null, interest: null, condition: null, conditionReference: null, authorization: null, subjects: [], retention: null, recipients: [], transfers: [], erasureException: null, location: locationOf(line) };\n const seen = new Set<string>();\n const recipients: string[] = [];\n const transfers: PurposeTransferSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword !== 'recipient' && keyword !== 'transfer' && seen.has(keyword)) {\n context.error(DiagnosticCodes.DuplicatePurposeField, `Purpose '${name}' already declares '${keyword}' - at most one is allowed`, locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n seen.add(keyword);\n if (keyword === 'description') purpose = { ...purpose, description: parseDescription(context, child, purpose.description, `Purpose '${name}'`) };\n else if (keyword === 'basis' || keyword === 'condition') {\n const match = vocabulary.exec(child.content);\n const values = keyword === 'basis' ? bases : conditions;\n if (match === null || !values.includes(match[2])) {\n context.error(DiagnosticCodes.InvalidPurposeVocabulary, `Invalid ${keyword} in purpose '${name}' - expected ${values.join(', ')} with an optional quoted reference`, locationOf(child));\n } else {\n const reference = match[3] === undefined ? null : unescapeString(match[3]);\n purpose = keyword === 'basis' ? { ...purpose, basis: match[2], basisReference: reference } : { ...purpose, condition: match[2], conditionReference: reference };\n }\n } else if (keyword === 'interest' || keyword === 'authorization' || keyword === 'retention' || keyword === 'recipient') {\n const match = textField.exec(child.content);\n if (match === null) context.error(DiagnosticCodes.InvalidPurposeDeclaration, `Invalid purpose field '${child.content}' - expected '${keyword} \"<text>\"'`, locationOf(child));\n else if (keyword === 'recipient') recipients.push(unescapeString(match[2]));\n else purpose = { ...purpose, [keyword]: unescapeString(match[2]) };\n } else if (keyword === 'subjects') {\n const subjects = child.content.slice('subjects'.length).split(',').map(value => value.trim());\n if (subjects.every(value => identifier.test(value))) purpose = { ...purpose, subjects: [...new Set(subjects)] };\n else context.error(DiagnosticCodes.InvalidPurposeDeclaration, `Invalid purpose subjects '${child.content}' - expected comma-separated identifiers`, locationOf(child));\n } else if (keyword === 'erasure') {\n const match = erasure.exec(child.content);\n if (match !== null && exceptions.includes(match[1])) purpose = { ...purpose, erasureException: match[1] };\n else context.error(DiagnosticCodes.InvalidPurposeVocabulary, `Invalid erasure exception '${child.content}' - expected 'erasure exception ${exceptions.join('|')}'`, locationOf(child));\n } else if (keyword === 'transfer') {\n const match = transfer.exec(child.content);\n if (match === null) context.error(DiagnosticCodes.InvalidPurposeDeclaration, `Invalid transfer '${child.content}' - expected 'transfer \"<destination>\" safeguard \"<text>\"'`, locationOf(child));\n else transfers.push({ kind: 'PurposeTransferSyntax', destination: unescapeString(match[1]), safeguard: unescapeString(match[2]), location: locationOf(child) });\n } else {\n context.error(DiagnosticCodes.InvalidPurposeDeclaration, `Unexpected '${child.content}' in purpose '${name}'`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n return { ...purpose, recipients, transfers };\n}\n\nexport function parsePurposeReference(context: ParserContext, line: SourceLine, references: PurposeReferenceSyntax[]): void {\n const name = purposeName(context, line);\n if (name.length > 0 && !references.some(reference => reference.name === name)) references.push({ kind: 'PurposeReferenceSyntax', name, location: locationOf(line) });\n}\n\nfunction purposeName(context: ParserContext, line: SourceLine): string {\n const match = header.exec(line.content);\n if (match !== null) return match[1];\n context.error(DiagnosticCodes.InvalidPurposeDeclaration, `Invalid purpose declaration '${line.content}' - expected 'purpose <Name>'`, locationOf(line));\n return '';\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { parseFencedText } from './CodeBlockParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nexport function parseDocumentation(context: ParserContext, line: SourceLine, existing: string | null, owner: string, code: string = DiagnosticCodes.InvalidDocumentation): string | null {\n if (line.content !== 'documentation' || context.peekChild(line.indent)?.content !== '```markdown') {\n context.error(code, `${owner} documentation requires a fenced markdown block`, locationOf(line));\n context.skipOpaqueBlock(line.indent);\n return existing;\n }\n const text = parseFencedText(context, 'markdown', line);\n if (text === null || text.trim().length === 0 || existing !== null) {\n context.error(code, `${owner} accepts one nonempty documentation block`, locationOf(line));\n return existing;\n }\n return text;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { DependsOnSyntax } from '../Syntax/Structure';\nimport { dotNetWhitespace, nativePattern } from '../Text/patterns';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst declaration = nativePattern(`^depends${dotNetWhitespace}+on${dotNetWhitespace}+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)$`);\n\nexport function parseDependsOn(context: ParserContext, line: SourceLine, declarations: DependsOnSyntax[], errorCode: string): void {\n const target = declaration.exec(line.content)?.[1];\n if (target === undefined) {\n context.error(errorCode, `Invalid dependency declaration '${line.content}' - expected 'depends on <Name>'`, locationOf(line));\n context.skipBlock(line.indent);\n return;\n }\n if (declarations.some(dependency => dependency.target === target)) {\n context.warning(DiagnosticCodes.RepeatedDependencyDeclaration, `Dependency '${target}' is already declared on this container - this repeated declaration is ignored`, locationOf(line));\n return;\n }\n declarations.push({ kind: 'DependsOnSyntax', target, location: locationOf(line) });\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { FileImportSyntax } from '../Syntax/Structure';\nimport { pattern } from '../Text/patterns';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst fileImportPattern = pattern('^import\\\\s+\"([^\"\\\\\\\\]+)\"$');\nconst quotedPattern = pattern('^import\\\\s+\"');\n\n// Whether an 'import' line names files rather than a qualified name - its operand is quoted.\nexport const isFileImport = (content: string): boolean => quotedPattern.test(content);\n\n// An 'import \"<pattern>\"' line, or undefined when the line does not import files - the port of the C#\n// FileImportParser.TryParse.\nexport function tryParseFileImport(line: SourceLine): FileImportSyntax | undefined {\n const match = fileImportPattern.exec(line.content);\n return match === null ? undefined : { kind: 'FileImportSyntax', pattern: match[1], location: locationOf(line) };\n}\n\n// Parses a consumed 'import' line inside a module or feature, where only files can be imported.\nexport function parseFileImport(context: ParserContext, line: SourceLine, imports: FileImportSyntax[]): void {\n const fileImport = tryParseFileImport(line);\n if (fileImport !== undefined) {\n imports.push(fileImport);\n return;\n }\n context.error(DiagnosticCodes.InvalidFileImport,\n `Invalid import '${line.content}' - inside a module or feature, import names files: 'import \"<path or glob>\"'`, locationOf(line));\n context.skipBlock(line.indent);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ComparisonOperator, ConditionSyntax } from '../Syntax/Conditions';\nimport { dotNetWhitespace, nativePattern } from '../Text/patterns';\nimport { stringBodyPattern } from '../Text/StringLiteral';\nimport { parseModeledMappingSource as parseMappingSource } from './ExpressionParser';\nimport { ParserContext } from './ParserContext';\n\nconst operators: Record<string, ComparisonOperator> = { '==': 'Equal', '!=': 'NotEqual', '>': 'GreaterThan', '>=': 'GreaterThanOrEqual', '<': 'LessThan', '<=': 'LessThanOrEqual', contains: 'Contains', 'starts with': 'StartsWith' };\n\n// The existing C# condition grammar: comparisons, left-associative and/or, and grouped conditions.\n// Previously omitted Legacy operands gain structure, not new parser diagnostics.\nexport function parseCondition(context: ParserContext, text: string, location: SourceLocation, strict = false): ConditionSyntax | null {\n if (!strict) context = context.valueContext;\n const whitespace = strict ? dotNetWhitespace : '\\\\s';\n const numeric = context.sourceOptions.numericMode === 'exact' ? `-?[0-9]+(?:\\\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?(?=$|${whitespace}|[()])|` : '';\n const words = context.sourceOptions.numericMode === 'exact' && !strict ? '[\\\\w.$-]+|[^\\\\s]' : '[\\\\w.$-]+';\n const regex = new RegExp(nativePattern(`\"${stringBodyPattern}\"|==|!=|>=|<=|>|<|\\\\(|\\\\)|${numeric}${words}`).source, 'gu');\n if (strict) {\n const unsupported = text.replace(regex, '').replace(new RegExp(dotNetWhitespace, 'gu'), '');\n if (unsupported.length > 0) {\n context.error(DiagnosticCodes.UnsupportedActionConditionOperand, `Guarded action conditions contain unsupported character '${unsupported[0]}'`, location);\n return null;\n }\n }\n const tokens = text.match(regex) ?? [];\n let position = 0;\n const group = (): ConditionSyntax | null => {\n if (tokens[position] === '(') {\n position++;\n const condition = or();\n if (tokens[position] === ')') position++;\n else if (strict || context.sourceOptions.numericMode === 'exact') context.error(DiagnosticCodes.UnclosedConditionGroup, \"Expected ')' in condition\", location);\n return condition;\n }\n const left = tokens[position++];\n if (strict && left === undefined) {\n context.error(DiagnosticCodes.ExpectedCondition, 'Expected a condition', location);\n return null;\n }\n let operator = tokens[position++];\n if (operator === 'starts' && tokens[position] === 'with') { operator += ' with'; position++; }\n if (strict && !Object.hasOwn(operators, operator)) {\n context.error(DiagnosticCodes.ExpectedComparisonOperator, `Expected a comparison operator after '${left}'`, location);\n return null;\n }\n const right = tokens[position++];\n if (strict && right === undefined) {\n context.error(DiagnosticCodes.ExpectedComparisonValue, 'Expected a value to compare against', location);\n return null;\n }\n return left === undefined || right === undefined || operators[operator] === undefined ? null : { kind: 'ComparisonConditionSyntax', left, operator: operators[operator], right: parseMappingSource(right, location, context), location };\n };\n const and = (): ConditionSyntax | null => {\n let left = group();\n while (left !== null && tokens[position] === 'and') {\n position++;\n const right = group();\n if (right === null) return null;\n left = { kind: 'LogicalConditionSyntax', left, operator: 'And', right, location };\n }\n return left;\n };\n const or = (): ConditionSyntax | null => {\n let left = and();\n while (left !== null && tokens[position] === 'or') {\n position++;\n const right = and();\n if (right === null) return null;\n left = { kind: 'LogicalConditionSyntax', left, operator: 'Or', right, location };\n }\n return left;\n };\n const condition = or();\n if (strict || context.sourceOptions.numericMode === 'exact') {\n if (condition === null && !strict) context.error(DiagnosticCodes.ExpectedCondition, 'Expected a condition', location);\n else if (condition !== null && position < tokens.length) context.error(DiagnosticCodes.UnexpectedTokenInCondition, `Unexpected '${tokens[position]}' in condition`, location);\n }\n return condition;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ConditionSyntax } from '../Syntax/Conditions';\nimport { InteractionArgumentSyntax, ScreenActionAlternativeSyntax, ScreenActionOtherwiseSyntax, ScreenGuardedActionSyntax, ScreenNavigateSyntax } from '../Syntax/Screens';\nimport { dotNetWhitespace, pattern } from '../Text/patterns';\nimport { parseCondition } from './ConditionParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// .NET '.' stops only at LF; U+2028/U+2029 stay inside a CR/LF-delimited source line.\nconst alternative = pattern(`^when${dotNetWhitespace}+([^\\\\n]+)${dotNetWhitespace}+execute${dotNetWhitespace}+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$`);\nconst otherwise = pattern(`^otherwise${dotNetWhitespace}+execute${dotNetWhitespace}+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$`);\nconst argument = pattern(`^with${dotNetWhitespace}+([A-Za-z_]\\\\w*)${dotNetWhitespace}+from${dotNetWhitespace}+([^\\\\n]+)$`);\nconst itemPath = pattern('^item\\\\.[A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*$');\nconst bindingWhitespace = new RegExp(`^${dotNetWhitespace}+|${dotNetWhitespace}+$`, 'gu');\n\ntype ParseNavigate = (context: ParserContext, text: string, line: SourceLine) => ScreenNavigateSyntax | undefined;\n\nexport function parseGuardedAction(context: ParserContext, line: SourceLine, label: string, parseNavigate: ParseNavigate): ScreenGuardedActionSyntax {\n const alternatives: ScreenActionAlternativeSyntax[] = [];\n let fallback: ScreenActionOtherwiseSyntax | null = null;\n let navigate: ScreenNavigateSyntax | null = null;\n let sawOtherwise = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const match = alternative.exec(child.content);\n const fallbackMatch = otherwise.exec(child.content);\n if (match !== null) {\n if (sawOtherwise) context.error(DiagnosticCodes.MisplacedActionOtherwise, \"A 'when' alternative must precede 'otherwise'\", locationOf(child));\n const condition = parseCondition(context, match[1], locationOf(child), true);\n const args = parseArguments(context, child);\n if (condition !== null) {\n validateCondition(context, condition);\n alternatives.push({ kind: 'ScreenActionAlternativeSyntax', condition, command: match[2], arguments: args, location: locationOf(child) });\n }\n } else if (child.content === 'otherwise hidden' || fallbackMatch !== null) {\n if (sawOtherwise) context.error(DiagnosticCodes.MisplacedActionOtherwise, \"A guarded action permits only one 'otherwise'\", locationOf(child));\n sawOtherwise = true;\n if (fallbackMatch !== null) {\n fallback = { kind: 'ScreenActionOtherwiseSyntax', outcome: 'Execute', command: fallbackMatch[1], arguments: parseArguments(context, child), location: locationOf(child) };\n } else {\n fallback = { kind: 'ScreenActionOtherwiseSyntax', outcome: 'Hidden', command: null, arguments: [], location: locationOf(child) };\n for (let nested = context.peekChild(child.indent); nested !== undefined; nested = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n context.error(DiagnosticCodes.InvalidActionAlternative, \"'otherwise hidden' cannot declare command arguments\", locationOf(nested));\n context.skipBlock(nested.indent);\n }\n }\n } else if (firstWord(child.content) === 'navigate') {\n if (navigate !== null) context.error(DiagnosticCodes.InvalidActionAlternative, \"A guarded action permits only one 'navigate to'\", locationOf(child));\n navigate = parseNavigate(context, child.content, child) ?? null;\n } else {\n const isLabel = firstWord(child.content) === 'label';\n context.error(isLabel ? DiagnosticCodes.UnknownActionDirective : DiagnosticCodes.InvalidActionAlternative, isLabel\n ? \"A guarded action's header already supplies its label\"\n : `Unexpected '${child.content}' in guarded action - expected 'when <condition> execute <Command>', 'otherwise hidden', 'otherwise execute <Command>' or 'navigate to ...'`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n if (alternatives.length === 0) context.error(DiagnosticCodes.GuardedActionWithoutAlternatives, \"A guarded action must declare at least one 'when' alternative\", locationOf(line));\n return { kind: 'ScreenGuardedActionSyntax', label, alternatives, otherwise: fallback, navigate, location: locationOf(line) };\n}\n\nfunction parseArguments(context: ParserContext, line: SourceLine): InteractionArgumentSyntax[] {\n const args: InteractionArgumentSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const match = argument.exec(child.content);\n if (match !== null) args.push({ kind: 'InteractionArgumentSyntax', name: match[1], binding: match[2].replace(bindingWhitespace, ''), location: locationOf(child) });\n else {\n context.error(DiagnosticCodes.InvalidInteractionArgument, `Invalid argument '${child.content}' - expected 'with <name> from <binding>'`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n return args;\n}\n\nexport function validateCondition(context: ParserContext, condition: ConditionSyntax): void {\n if (condition.kind === 'LogicalConditionSyntax') {\n validateCondition(context, condition.left);\n validateCondition(context, condition.right);\n return;\n }\n const value = condition.right.kind === 'LiteralExpressionSyntax' ? condition.right.value : undefined;\n let supported = itemPath.test(condition.left) && condition.right.kind === 'LiteralExpressionSyntax';\n if (['GreaterThan', 'GreaterThanOrEqual', 'LessThan', 'LessThanOrEqual'].includes(condition.operator)) {\n supported &&= typeof value === 'number' || (typeof value === 'object' && value !== null);\n } else if (['Contains', 'StartsWith'].includes(condition.operator)) supported &&= typeof value === 'string';\n if (!supported) context.error(DiagnosticCodes.UnsupportedActionConditionOperand, \"Guarded action conditions compare 'item.<field>' with a literal; ordering requires a number and text operators require a string\", condition.location);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { isBlank, SourceLine } from './SourceLine';\n\n// Walks the lines of a document forward. Significant reads skip blank lines; a raw read takes the next line\n// as it is, which is how a fenced code block keeps its blank lines.\nexport class LineReader {\n #index = 0;\n\n constructor(private readonly lines: readonly SourceLine[]) {}\n\n get atEnd(): boolean {\n return this.lines.slice(this.#index).every(isBlank);\n }\n\n // Independent lookahead must not consume the committed parser's source.\n fork(): LineReader {\n const reader = new LineReader(this.lines);\n reader.#index = this.#index;\n return reader;\n }\n\n peekSignificant(): SourceLine | undefined {\n while (this.#index < this.lines.length && isBlank(this.lines[this.#index])) {\n this.#index++;\n }\n return this.#index < this.lines.length ? this.lines[this.#index] : undefined;\n }\n\n takeSignificant(): SourceLine {\n const line = this.peekSignificant();\n if (line === undefined) {\n throw new Error('There is no significant line left to take');\n }\n this.#index++;\n return line;\n }\n\n takeRaw(): SourceLine | undefined {\n return this.#index < this.lines.length ? this.lines[this.#index++] : undefined;\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nexport class InvalidSyntaxJson extends Error {}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { InvalidSyntaxJson } from './InvalidSyntaxJson';\n\nexport type NumericMode = 'legacy' | 'exact';\nexport interface SourceOptions { readonly numericMode: NumericMode; }\nexport const legacySourceOptions: SourceOptions = Object.freeze({ numericMode: 'legacy' });\nexport const exactSourceOptions: SourceOptions = Object.freeze({ numericMode: 'exact' });\nexport const invalidSourceOptions: SourceOptions = Object.freeze({ numericMode: 'invalid' as NumericMode });\n\n// Validate before selecting neutrality or a mode. Missing options are defaulted by the owning root,\n// not here: an explicitly present null/undefined/malformed assertion must never become Legacy.\nexport function validatedSourceOptions(value: unknown): SourceOptions {\n if (typeof value !== 'object' || value === null || (Object.getPrototypeOf(value) !== Object.prototype && Object.getPrototypeOf(value) !== null) || Reflect.ownKeys(value).length !== 1 || !Object.hasOwn(value, 'numericMode')) throw new InvalidSyntaxJson('Malformed source numeric options.');\n const mode = (value as { numericMode: unknown }).numericMode;\n if (mode !== 'legacy' && mode !== 'exact') throw new InvalidSyntaxJson('Malformed source numeric options.');\n return mode === 'exact' ? exactSourceOptions : legacySourceOptions;\n}\n\nconst authoredDocuments = new WeakSet<object>();\nexport function recordAuthoredDocument(root: object): void { authoredDocuments.add(root); }\nexport function isAuthoredDocument(root: object): boolean { return authoredDocuments.has(root); }\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { CommandStreamCandidates } from './CommandStreamCandidates';\nimport { SourceLocation, sourceLocation } from '../Diagnostics/SourceLocation';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { legacySourceOptions, SourceOptions } from '../Syntax/SourceOptions';\nimport { InputUse } from './InputUses';\nimport { LineReader } from './LineReader';\nimport { SourceLine } from './SourceLine';\n\n// What every parser shares while it reads one document: the line reader, the diagnostics found so far and\n// the file the document came from.\nexport class ParserContext {\n readonly #diagnostics: Diagnostic[] = [];\n // Authoring verification needs these committed values even though SyntaxJson omits them.\n readonly triggerData: PropertySyntax[] = [];\n readonly inputUses: InputUse[] = [];\n scope: readonly string[] = [];\n readonly languages: ReadonlySet<string>;\n sourceOptions: SourceOptions = legacySourceOptions;\n authoredDeclarations = false;\n deferIdentityValidation = false;\n streamCandidates?: CommandStreamCandidates;\n\n // Structural enrichment of formerly opaque Legacy fields must not add diagnostics. Exact operands\n // use the owning context so representability failures cannot turn into successful opaque syntax.\n get valueContext(): ParserContext {\n if (this.sourceOptions.numericMode === 'exact') return this;\n const context = new ParserContext(this.reader, this.path, this.languages);\n context.sourceOptions = this.sourceOptions;\n return context;\n }\n\n constructor(readonly reader: LineReader, readonly path?: string, languages: ReadonlySet<string> = new Set(['csharp', 'typescript', 'react', 'html', 'sql'])) {\n this.languages = languages;\n }\n\n get start(): SourceLocation {\n return sourceLocation(1, 1, this.path);\n }\n\n get diagnostics(): readonly Diagnostic[] {\n // Directive-shaped lines nobody claimed as a field are errors, wherever they sit.\n if (this.nestedNumericDirectives.size > 0 && this.sourceOptions.numericMode !== 'legacy' && this.reader.atEnd) {\n this.#diagnostics.push(...[...this.nestedNumericDirectives].sort((first, second) => first[0] - second[0]).map(entry => entry[1]));\n this.nestedNumericDirectives.clear();\n }\n return this.#diagnostics;\n }\n\n // Directive-shaped lines below the top level, keyed by line number, still unclaimed as a field.\n nestedNumericDirectives = new Map<number, Diagnostic>();\n\n claimField(line: SourceLine): void {\n this.nestedNumericDirectives.delete(line.number);\n }\n\n information(code: string, message: string, location: SourceLocation): void {\n this.#diagnostics.push({ severity: 'information', code, message, location });\n }\n\n error(code: string, message: string, location: SourceLocation): void {\n this.#diagnostics.push({ severity: 'error', code, message, location });\n }\n\n warning(code: string, message: string, location: SourceLocation): void {\n this.#diagnostics.push({ severity: 'warning', code, message, location });\n }\n\n // The next significant line when it is indented deeper than its parent - that is, when it belongs to\n // the parent's body under the offside rule.\n peekChild(parentIndent: number): SourceLine | undefined {\n const line = this.reader.peekSignificant();\n return line !== undefined && line.indent > parentIndent ? line : undefined;\n }\n\n // Skips the body of a construct, the way the C# parser does after reporting it.\n skipBlock(parentIndent: number): void {\n while (this.peekChild(parentIndent) !== undefined) {\n this.reader.takeSignificant();\n }\n }\n\n // Skips the body of a construct this compiler deliberately does not model. Unlike skipBlock it steps\n // over fenced code blocks whole, because a fenced line may be indented less than the block it is in -\n // reading it as significant would end the skip early and misread the code as Screenplay.\n skipOpaqueBlock(parentIndent: number): void {\n let child = this.peekChild(parentIndent);\n while (child !== undefined) {\n this.reader.takeSignificant();\n if (child.content.startsWith('```')) {\n this.skipFencedBody();\n }\n child = this.peekChild(parentIndent);\n }\n }\n\n // Takes the raw lines of a fenced block up to and including its closing fence.\n skipFencedBody(): void {\n for (let line = this.reader.takeRaw(); line !== undefined; line = this.reader.takeRaw()) {\n if (line.raw.trim() === '```') {\n return;\n }\n }\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { dotNetWhitespace, pattern } from '../Text/patterns';\nimport { parseCondition } from './ConditionParser';\nimport { validateCondition } from './GuardedActionParser';\nimport { firstWord } from './LineText';\nimport { LineReader } from './LineReader';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst inline = pattern(`^when${dotNetWhitespace}+([^\\\\n]+)${dotNetWhitespace}+execute${dotNetWhitespace}+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$`);\nconst trigger = pattern(`^on${dotNetWhitespace}+([^\\\\n]+)$`);\nconst where = pattern(`^where${dotNetWhitespace}+([^\\\\n]+)$`);\nconst actions = new Set(['execute', 'navigate', 'open', 'close', 'refresh', 'set', 'notify', 'confirm', 'raise']);\n\n// Interaction bodies remain opaque in the TS AST. Check their structure instead of silently accepting\n// alternatives the C# compiler refuses. Input collection supplies only significant, non-fenced lines.\nexport function validateInteractionBodies(context: ParserContext, lines: readonly SourceLine[]): void {\n for (let index = 0; index < lines.length; index++) {\n const header = lines[index];\n const on = trigger.exec(header.content);\n if (on === null || on[1].startsWith('row-click ')) continue;\n const body: SourceLine[] = [];\n for (let child = index + 1; child < lines.length && lines[child].indent > header.indent; child++) body.push(lines[child]);\n const children = body.filter(line => line.indent === body[0]?.indent);\n const branches = children.filter(line => ['when', 'otherwise'].includes(firstWord(line.content)));\n const supported = ['click', 'double click', 'select'].includes(on[1].trim());\n const guards = children.filter(line => where.test(line.content));\n let sawOtherwise = false;\n for (const branch of branches) {\n const isWhen = firstWord(branch.content) === 'when';\n const match = isWhen ? inline.exec(branch.content) : null;\n if (isWhen) {\n if (sawOtherwise) context.error(DiagnosticCodes.MisplacedActionOtherwise, \"A 'when' alternative must precede 'otherwise'\", locationOf(branch));\n const condition = parseCondition(context, match?.[1] ?? branch.content.slice(4).trim(), locationOf(branch), true);\n if (condition !== null) validateCondition(context, condition);\n if (match !== null) context.error(DiagnosticCodes.InlineInteractionAlternative, \"Interaction alternatives require an indented action list, not 'when <condition> execute <Command>'\", locationOf(branch));\n } else {\n if (sawOtherwise || branch.content !== 'otherwise') context.error(DiagnosticCodes.MisplacedActionOtherwise, \"An interaction permits one final block-form 'otherwise'\", locationOf(branch));\n sawOtherwise = true;\n }\n const position = body.indexOf(branch);\n const nested = body[position + 1];\n if (match === null && (nested === undefined || nested.indent <= branch.indent || !actions.has(firstWord(nested.content)))) {\n context.error(DiagnosticCodes.InteractionAlternativeWithoutActions, 'An interaction alternative requires a non-empty action list', locationOf(branch));\n }\n }\n if (branches.length > 0) {\n if (!supported) context.error(DiagnosticCodes.UnsupportedInteractionAlternatives, 'Interaction alternatives are only supported on click, double click and select', locationOf(header));\n if (guards.length > 0 || children.some(line => actions.has(firstWord(line.content)))) {\n context.error(DiagnosticCodes.MixedInteractionAlternatives, \"Interaction alternatives cannot mix with plain actions or 'where'\", locationOf(header));\n }\n if (!branches.some(line => firstWord(line.content) === 'when')) context.error(DiagnosticCodes.GuardedActionWithoutAlternatives, \"A guarded interaction requires at least one 'when' alternative\", locationOf(header));\n }\n if (supported) for (const guard of guards) deprecateWhere(context, guard);\n }\n}\n\nfunction deprecateWhere(context: ParserContext, line: SourceLine): void {\n const probe = new ParserContext(new LineReader([]));\n probe.sourceOptions = context.sourceOptions;\n const condition = parseCondition(probe, where.exec(line.content)![1].trim(), locationOf(line), true);\n if (condition !== null) validateCondition(probe, condition);\n const message = \"Opaque 'where' on click, double click and select is deprecated; use block-form 'when' item conditions\";\n if (condition !== null && probe.diagnostics.length === 0) context.warning(DiagnosticCodes.LegacyInteractionWhere, message, locationOf(line));\n else context.information(DiagnosticCodes.LegacyInteractionWhere, message, locationOf(line));\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { pattern } from '../Text/patterns';\nimport { firstWord, unescapeIdentifier } from './LineText';\nimport { validateInteractionBodies } from './InteractionAlternatives';\nimport { ParserContext } from './ParserContext';\nimport { parseDescription } from './DescriptionParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Typed authoring facts from bodies the TS syntax tree does not yet model. Never serialized as ESM.\nexport interface InputUse {\n readonly command: string;\n readonly property: string;\n readonly scope: readonly string[];\n readonly location: SourceLocation;\n readonly isParameter?: boolean;\n}\n\ninterface InputOwner { command: string; kind: 'form' | 'execute' | 'invokes' | 'other'; indent: number }\nconst form = pattern('^form\\\\s+[A-Za-z_]\\\\w*\\\\s+for\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst execution = pattern('^(execute|invokes)\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst field = pattern('^field\\\\s+([\\\\w.]+)(?:\\\\s|$)');\nconst argument = pattern('^with\\\\s+([A-Za-z_]\\\\w*)\\\\s+from\\\\s+.+$');\nconst mapping = pattern('^(@?[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*.+$');\nconst parameter = pattern('^parameter\\\\s+([A-Za-z_]\\\\w*)(?:\\\\s+([\\\\w.]+(?:\\\\[\\\\])?))?$');\nconst actionBoundaries = new Set(['refresh', 'navigate', 'open', 'close', 'set', 'notify', 'confirm', 'raise', 'on', 'when', 'otherwise']);\n\n// A single forward walk, tracking owners by indentation and skipping fences as opaque text.\nexport function collectInputUses(context: ParserContext, header: SourceLine): void {\n const owners: InputOwner[] = [];\n const parameters = new Set<string>();\n const inputs: InputUse[] = [];\n const isBehavior = firstWord(header.content) === 'behavior';\n let formDescription: string | null = null;\n const recognize = (line: SourceLine): void => {\n while (owners.length > 0 && owners[owners.length - 1].indent >= line.indent) owners.pop();\n const declared = isBehavior && owners.length === 0 ? parameter.exec(line.content) : null;\n if (declared !== null) parameters.add(declared[1]);\n const formMatch = form.exec(line.content);\n const execute = execution.exec(line.content);\n if (formMatch !== null) owners.push({ command: formMatch[1], kind: 'form', indent: line.indent });\n else if (execute !== null) owners.push({ command: execute[2], kind: execute[1] as 'execute' | 'invokes', indent: line.indent });\n else if (actionBoundaries.has(firstWord(line.content))) owners.push({ command: '', kind: 'other', indent: line.indent });\n else {\n const owner = owners.at(-1);\n if (owner === undefined || owner.kind === 'other') return;\n const supplied = (owner.kind === 'form' ? field : owner.kind === 'execute' ? argument : mapping).exec(line.content);\n if (supplied !== null) inputs.push({ command: owner.command, property: unescapeIdentifier(supplied[1]), scope: context.scope, location: locationOf(line) });\n }\n };\n recognize(header);\n const lines = [header];\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n while (owners.length > 0 && owners[owners.length - 1].indent >= child.indent) owners.pop();\n if (form.test(header.content) && firstWord(child.content) === 'description' && owners.at(-1)?.kind === 'form') {\n formDescription = parseDescription(context, child, formDescription, `Form '${header.content.split(pattern('\\\\s+'))[1]}'`);\n } else if (child.content.startsWith('```')) context.skipFencedBody();\n else {\n lines.push(child);\n recognize(child);\n }\n }\n validateInteractionBodies(context, lines);\n // Parameters may be declared after their bindings; commit facts once their scope is complete.\n for (const input of inputs) context.inputUses.push(parameters.has(input.command) ? { ...input, isParameter: true } : input);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { pattern } from './patterns';\n\n// .NET \\w admits Lu, Ll, Lt, Lm, Lo, Mn, Nd and Pc, evaluated per UTF-16 code unit.\n// The shared Unicode pattern supplies those categories; exclude surrogate code units so\n// a supplementary letter (or an unpaired surrogate) cannot become a new authored name.\n// This boundary is source/stream-only; existing unrelated name/type grammar is unchanged.\nexport function sourceStreamPattern(source: string): RegExp {\n return pattern(`(?![\\\\s\\\\S]*[\\\\uD800-\\\\uDFFF\\\\u{10000}-\\\\u{10FFFF}])${source}`);\n}\n\nconst identifier = sourceStreamPattern('^[A-Za-z_]\\\\w*(?![\\\\s\\\\S])');\nconst typeName = sourceStreamPattern('^[\\\\w.]+(?![\\\\s\\\\S])');\n\nexport function isSourceStreamName(value: unknown): value is string {\n return typeof value === 'string' && identifier.test(value);\n}\n\nexport function isSourceStreamTypeName(value: unknown): value is string {\n return typeof value === 'string' && typeName.test(value);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { TypeRefSyntax, PropertySyntax } from '../Syntax/Declarations';\nimport { CommandStreamSyntax, EventSourceSyntax, EventStreamSyntax, EventStreamIdPartSyntax } from '../Syntax/EventSources';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { pattern } from '../Text/patterns';\nimport { sourceStreamPattern } from '../Text/SourceStreamNames';\nimport { parseDescription } from './DescriptionParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseTypeRef, reportLegacyOptionalSuffix } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst pinPattern = pattern(`^id\\\\s+\"(${stringBodyPattern})\"$`);\nconst typeDirective = sourceStreamPattern('^(identifier|streamId)\\\\s+([\\\\w.]+(?:\\\\[\\\\])?(?:\\\\?|\\\\s+optional)?)$');\nconst sourceHeader = sourceStreamPattern('^eventsource\\\\s+([A-Za-z_]\\\\w*)$');\nconst streamHeader = sourceStreamPattern('^stream\\\\s+([A-Za-z_]\\\\w*)$');\n\nexport function parseEventSource(context: ParserContext, header: SourceLine): EventSourceSyntax {\n const name = sourceHeader.exec(header.content)?.[1] ?? '';\n if (name === '') invalid(context, header, \"Expected 'eventsource <Name>'.\");\n const streams: EventStreamSyntax[] = [];\n let identifier: TypeRefSyntax | null = null;\n let description: string | null = null;\n let id: string | null = null;\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n switch (firstWord(child.content)) {\n case 'stream': streams.push(parseEventStream(context, child)); break;\n case 'identifier': identifier = parseType(context, child, 'identifier', identifier); break;\n case 'description': description = parseDescription(context, child, description, `Event source '${name}'`, true); break;\n case 'id': id = parsePin(context, child, name, id); break;\n default: invalid(context, child, 'An event source accepts description, id, identifier and stream declarations.'); context.skipBlock(child.indent); break;\n }\n }\n return { kind: 'EventSourceSyntax', name, streams, identifier, description, id, location: locationOf(header) };\n}\n\nfunction parseEventStream(context: ParserContext, header: SourceLine): EventStreamSyntax {\n const name = streamHeader.exec(header.content)?.[1] ?? '';\n if (name === '') invalid(context, header, \"Expected 'stream <Name>'.\");\n let streamId: TypeRefSyntax | null = null;\n let streamIdParts: EventStreamIdPartSyntax[] = [];\n let declared = false;\n const directiveLocations: Record<string, ReturnType<typeof locationOf>> = {};\n let description: string | null = null;\n let id: string | null = null;\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n switch (firstWord(child.content)) {\n case 'streamId':\n if (declared) {\n invalid(context, child, \"Declare either one 'streamId <Type>' or one streamId part block.\");\n context.skipBlock(child.indent);\n } else if (child.content === 'streamId') {\n declared = true;\n directiveLocations.streamId = locationOf(child);\n streamIdParts = parseStreamIdParts(context, child);\n } else {\n streamId = parseType(context, child, 'streamId', streamId);\n declared = streamId !== null;\n }\n break;\n case 'description': description = parseDescription(context, child, description, `Stream '${name}'`, true); break;\n case 'id': id = parsePin(context, child, name, id); break;\n default: invalid(context, child, 'A stream accepts description, id and streamId declarations.'); context.skipBlock(child.indent); break;\n }\n }\n return { kind: 'EventStreamSyntax', name, streamId, streamIdParts, description, id, directiveLocations, location: locationOf(header) };\n}\n\nfunction parseType(context: ParserContext, line: SourceLine, keyword: string, previous: TypeRefSyntax | null): TypeRefSyntax | null {\n const match = typeDirective.exec(line.content);\n if (match === null || previous !== null) invalid(context, line, `Declare at most one '${keyword} <Type>'.`);\n else {\n previous = parseTypeRef(match[2], { ...locationOf(line), column: line.indent + 1 + line.content.indexOf(match[2], keyword.length) });\n reportLegacyOptionalSuffix(context, previous, line);\n }\n rejectChildren(context, line, DiagnosticCodes.InvalidEventSourceDeclaration);\n return previous;\n}\n\nfunction parsePin(context: ParserContext, line: SourceLine, name: string, previous: string | null): string | null {\n const match = pinPattern.exec(line.content);\n const value = match === null ? null : unescapeString(match[1]);\n if (value === null || value.trim() === '' || previous !== null) invalid(context, line, 'Declare at most one nonempty rename-only \\'id \"<old-name>\"\\'.');\n else {\n previous = value;\n if (value === name) context.information(DiagnosticCodes.RedundantSourceStreamId, 'The rename pin repeats the current name; omit it for a new declaration.', locationOf(line));\n }\n rejectChildren(context, line, DiagnosticCodes.InvalidEventSourceDeclaration);\n return previous;\n}\n\nexport function parseCommandStream(context: ParserContext, header: SourceLine, candidate: PropertySyntax, ambiguous: boolean): CommandStreamSyntax {\n const [eventSource, stream] = candidate.type.name.split('.');\n const route: CommandStreamSyntax = { kind: 'CommandStreamSyntax', eventSource, stream, streamId: null, streamIdParts: [], propertyCandidate: null, referenceLocation: candidate.type.location, referenceLength: candidate.type.name.length, location: locationOf(header) };\n if (ambiguous) {\n context.error(DiagnosticCodes.AmbiguousCommandStream, `'${header.content}' has both a property type and a stream route interpretation; neither is selected.`, locationOf(header));\n // Ordinary properties are leaves; preserve deeper legacy command members in this case.\n return { ...route, propertyCandidate: candidate };\n }\n let streamId: PropertyMappingSyntax | null = null;\n let streamIdParts: PropertyMappingSyntax[] = [];\n let block = false;\n const directiveLocations: Record<string, ReturnType<typeof locationOf>> = {};\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'streamId') {\n if (streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidCommandStream, \"Declare either one 'streamId = <source>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n } else {\n block = true;\n directiveLocations.streamId = locationOf(child);\n streamIdParts = parseRouteParts(context, child, DiagnosticCodes.InvalidCommandStream);\n }\n continue;\n }\n const match = /^streamId\\s*=\\s*(.+)$/.exec(child.content);\n if (match === null || streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidCommandStream, \"Declare either one 'streamId = <source>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n } else {\n const location = { ...locationOf(child), column: child.indent + 1 + child.content.indexOf(match[1], child.content.indexOf('=') + 1) };\n streamId = { kind: 'PropertyMappingSyntax', property: 'streamId', source: parseMappingSource(match[1], location, context), location: locationOf(child) };\n rejectChildren(context, child, DiagnosticCodes.InvalidCommandStream);\n }\n }\n return { ...route, streamId, streamIdParts, directiveLocations };\n}\n\nfunction parseStreamIdParts(context: ParserContext, header: SourceLine): EventStreamIdPartSyntax[] {\n const parts: EventStreamIdPartSyntax[] = [];\n const declaration = sourceStreamPattern('^([A-Za-z_]\\\\w*)\\\\s+([\\\\w.]+(?:\\\\[\\\\])?(?:\\\\?|\\\\s+optional)?)$');\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const match = declaration.exec(child.content);\n if (match === null) {\n invalid(context, child, \"Expected '<part> <Type>' without modifiers in a streamId part block.\");\n context.skipBlock(child.indent);\n continue;\n }\n const type = parseTypeRef(match[2], { ...locationOf(child), column: child.indent + 1 + child.content.indexOf(match[2], match[1].length) });\n reportLegacyOptionalSuffix(context, type, child);\n parts.push({ kind: 'EventStreamIdPartSyntax', name: match[1], type, location: locationOf(child) });\n rejectChildren(context, child, DiagnosticCodes.InvalidEventSourceDeclaration);\n }\n if (parts.length === 0) invalid(context, header, 'A streamId part block cannot be empty.');\n return parts;\n}\n\nexport function parseRouteParts(context: ParserContext, header: SourceLine, code: string): PropertyMappingSyntax[] {\n const parts: PropertyMappingSyntax[] = [];\n const mapping = sourceStreamPattern('^([A-Za-z_]\\\\w*)\\\\s*=(?!=|>)\\\\s*(.+)$');\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const match = mapping.exec(child.content);\n if (match === null) {\n context.error(code, \"Expected '<part> = <source>' in a streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const location = { ...locationOf(child), column: child.indent + 1 + child.content.indexOf(match[2], child.content.indexOf('=') + 1) };\n parts.push({ kind: 'PropertyMappingSyntax', property: match[1], source: parseMappingSource(match[2], location, context), location: locationOf(child) });\n rejectChildren(context, child, code);\n }\n if (parts.length === 0) context.error(code, 'A streamId part block cannot be empty.', locationOf(header));\n return parts;\n}\n\nfunction rejectChildren(context: ParserContext, line: SourceLine, code: string): void {\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(code, 'This directive cannot have children.', locationOf(child));\n context.skipBlock(line.indent);\n }\n}\n\nfunction invalid(context: ParserContext, line: SourceLine, message: string): void { context.error(DiagnosticCodes.InvalidEventSourceDeclaration, message, locationOf(line)); }\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { pattern } from '../Text/patterns';\nimport { firstWord } from './LineText';\nimport { SourceLine } from './SourceLine';\n\nconst typeReferencePattern = pattern('^[A-Za-z_]\\\\w*(?:\\\\[\\\\])?(?:\\\\?|\\\\s+optional)?$');\n\nconst pathOf = (line: SourceLine): string =>\n firstWord(line.content) === 'file' ? line.content.substring('file'.length).trim() : '';\n\n// A 'file <path>' directive. This compiler does not model file references; it only recognizes the line so\n// it is not misread as something else.\nexport const isFileDirective = (line: SourceLine): boolean => pathOf(line).length > 0;\n\n// Among properties 'file Path' is a property named file, so only a path that is not type-shaped counts.\nexport const isFileDirectiveAmongProperties = (line: SourceLine): boolean =>\n isFileDirective(line) && !typeReferencePattern.test(pathOf(line));\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// Unicode White_Space, matching C# Text/ImplementationHintText.cs. ECMAScript trim\n// differs at NEL and BOM. Only test blankness; never normalize authored hint text.\nconst whiteSpace = new Set([0x0020, 0x0085, 0x00a0, 0x1680, 0x2028, 0x2029, 0x202f, 0x205f, 0x3000]);\n\nexport function isBlankImplementationHint(text: string | null): boolean {\n if (text === null) return true;\n for (const character of text) {\n const code = character.charCodeAt(0);\n if (!((code >= 0x0009 && code <= 0x000d) || (code >= 0x2000 && code <= 0x200a) || whiteSpace.has(code))) return false;\n }\n return true;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { CodeBlockSyntax, FileReferenceSyntax, HandlerSyntax, ImplementationHintSyntax, ImplementationSyntax } from '../Syntax/Implementations';\nimport { isBlankImplementationHint } from '../Text/ImplementationHintText';\nimport { unescapeString } from '../Text/StringLiteral';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Match ImplementationHintText's White_Space set, not ECMAScript \\s. A hint stays on one CR/LF-delimited source line.\n// eslint-disable-next-line no-control-regex -- The shared whitespace set deliberately includes U+0009 through U+000D.\nconst hintPattern = new RegExp('^hint[\\\\u0009-\\\\u000d\\\\u0020\\\\u0085\\\\u00a0\\\\u1680\\\\u2000-\\\\u200a\\\\u2028\\\\u2029\\\\u202f\\\\u205f\\\\u3000]+\"((?:[^\"\\\\\\\\\\\\r\\\\n]|\\\\\\\\[^\\\\r\\\\n])*)\"$');\nexport const isFile = (line: SourceLine): boolean => firstWord(line.content) === 'file' && line.content.substring(4).trim().length > 0;\nexport const isCode = (context: ParserContext, line: SourceLine): boolean => line.content.startsWith('```') || context.languages.has(line.content);\n\nexport function parseFile(context: ParserContext, line: SourceLine): FileReferenceSyntax {\n const path = line.content.substring(4).trim();\n if (/^(?:[/\\\\]|[A-Za-z]:[/\\\\]|~[/\\\\])/.test(path)) {\n context.warning(DiagnosticCodes.AbsoluteFileReference, `'${path}' is an absolute path - a file reference is relative to the repository root, so it means the same thing on every machine`, locationOf(line));\n }\n return { kind: 'FileReferenceSyntax', path, location: locationOf(line) };\n}\n\nexport const isClosingCodeFence = (line: SourceLine): boolean => line.raw.trim() === '```';\n\nexport function parseCode(context: ParserContext, tag: SourceLine): CodeBlockSyntax | null {\n const language = tag.content.startsWith('```') ? tag.content.substring(3) : tag.content;\n if (!context.languages.has(language)) {\n context.error(DiagnosticCodes.ExpectedCodeFence, `Expected a registered language on the opening fence, not '${tag.content}'`, locationOf(tag));\n return null;\n }\n let open = tag;\n if (!tag.content.startsWith('```')) {\n context.warning(DiagnosticCodes.LegacyInlineCodeFence, `'${language}' on its own line is deprecated - use '\\`\\`\\`${language}' instead`, locationOf(tag));\n const next = context.reader.peekSignificant();\n if (next === undefined || next.indent <= tag.indent || (next.content !== '```' && next.content !== `\\`\\`\\`${language}`)) {\n context.error(DiagnosticCodes.ExpectedCodeFence, `Expected an opening \\`\\`\\`${language} fence after '${language}'`, locationOf(tag));\n return null;\n }\n open = context.reader.takeSignificant();\n }\n const lines: string[] = [];\n for (;;) {\n const line = context.reader.takeRaw();\n if (line === undefined) {\n context.error(DiagnosticCodes.UnclosedCodeBlock, 'Unclosed inline code block - expected a closing ``` line', locationOf(open));\n break;\n }\n if (isClosingCodeFence(line)) break;\n let strip = 0;\n while (strip < open.indent && line.raw[strip] === ' ') strip++;\n lines.push(line.raw.substring(strip));\n }\n return { kind: 'CodeBlockSyntax', language, code: lines.join('\\n'), location: locationOf(tag) };\n}\n\nexport function parseHandler(context: ParserContext, handler: SourceLine): HandlerSyntax | null {\n const body = context.peekChild(handler.indent);\n if (body === undefined) {\n context.error(DiagnosticCodes.HandlerWithoutImplementation, \"Expected a 'file' directive or an inline code block in the handler\", locationOf(handler));\n return null;\n }\n context.reader.takeSignificant();\n if (firstWord(body.content) === 'implementation') return parseImplementation(context, handler, body);\n const file = isFile(body) ? parseFile(context, body) : null;\n const code = file === null && isCode(context, body) ? parseCode(context, body) : null;\n if (file !== null || code !== null) {\n const extra = context.peekChild(handler.indent);\n if (extra !== undefined && firstWord(extra.content) === 'implementation') {\n context.error(DiagnosticCodes.ConflictingImplementationSources, 'A handler cannot mix wrapped and direct sources.', locationOf(extra));\n context.skipBlock(handler.indent);\n }\n return { kind: 'HandlerSyntax', file, code, implementation: null, location: locationOf(handler) };\n }\n context.error(DiagnosticCodes.UnknownHandlerDirective, `Unexpected '${body.content}' in handler - expected 'file <path>' or an inline code block`, locationOf(body));\n context.skipBlock(handler.indent);\n return null;\n}\n\nfunction parseImplementation(context: ParserContext, handler: SourceLine, wrapper: SourceLine): HandlerSyntax {\n const source = parseImplementationWrapper(context, wrapper);\n for (let extra = context.peekChild(handler.indent); extra !== undefined; extra = context.peekChild(handler.indent)) {\n context.reader.takeSignificant();\n context.error(firstWord(extra.content) === 'implementation' ? DiagnosticCodes.InvalidImplementationBlock : DiagnosticCodes.ConflictingImplementationSources,\n 'A handler has one implementation wrapper and cannot mix wrapped and direct sources.', locationOf(extra));\n if (isCode(context, extra)) parseCode(context, extra);\n else context.skipBlock(extra.indent);\n }\n return { kind: 'HandlerSyntax', ...source, location: locationOf(handler) };\n}\n\nexport function parseImplementationWrapper(context: ParserContext, wrapper: SourceLine): { file: FileReferenceSyntax | null; code: CodeBlockSyntax | null; implementation: ImplementationSyntax } {\n const hints: ImplementationHintSyntax[] = [];\n let file: FileReferenceSyntax | null = null;\n let code: CodeBlockSyntax | null = null;\n let hasPayload = false;\n if (wrapper.content !== 'implementation') context.error(DiagnosticCodes.InvalidImplementationBlock, \"Expected 'implementation' with no operand.\", locationOf(wrapper));\n for (let child = context.peekChild(wrapper.indent); child !== undefined; child = context.peekChild(wrapper.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'hint' || hintPattern.test(child.content)) {\n const match = hintPattern.exec(child.content);\n const text = match === null ? null : unescapeString(match[1]);\n if (isBlankImplementationHint(text)) context.error(DiagnosticCodes.InvalidImplementationHint, \"Expected 'hint' followed by one nonblank quoted string.\", locationOf(child));\n else hints.push({ kind: 'ImplementationHintSyntax', text: text!, location: locationOf(child) });\n const nested = context.peekChild(child.indent);\n if (nested !== undefined) {\n context.error(DiagnosticCodes.InvalidImplementationHint, 'A hint cannot have children.', locationOf(nested));\n context.skipBlock(child.indent);\n }\n } else if (isFile(child) || child.content.startsWith('```')) {\n if (hasPayload) context.error(DiagnosticCodes.ConflictingImplementationSources, 'An implementation has at most one file or inline payload.', locationOf(child));\n const parsedFile = isFile(child) ? parseFile(context, child) : null;\n const parsedCode = parsedFile === null ? parseCode(context, child) : null;\n if (!hasPayload) { file = parsedFile; code = parsedCode; }\n hasPayload = true;\n const nested = context.peekChild(child.indent);\n if (parsedFile !== null && nested !== undefined) {\n context.error(DiagnosticCodes.InvalidImplementationBlock, 'A file directive cannot have children.', locationOf(nested));\n context.skipBlock(child.indent);\n }\n } else {\n context.error(DiagnosticCodes.InvalidImplementationBlock, `Unexpected '${child.content}' in implementation - expected hint, file or a tagged fence.`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n return { file, code, implementation: { kind: 'ImplementationSyntax', hints, location: locationOf(wrapper) } };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { pattern } from '../Text/patterns';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { OperationPhaseSyntax, OperationSyntax, SystemSyntax } from '../Syntax/Operations';\nimport { parseDescription } from './DescriptionParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { isFileDirective } from './FileReferences';\nimport { parseCode, parseFile, parseImplementationWrapper } from './ImplementationParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseProperty, tryParseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst systemHeader = pattern('^system\\\\s+([A-Za-z_]\\\\w*)$');\nconst operationHeader = pattern('^operation\\\\s+([A-Za-z_]\\\\w*)$');\nconst inlineHeader = pattern('^produces\\\\s+operation\\\\s+([A-Za-z_]\\\\w*)$');\nconst usesPattern = pattern('^uses\\\\s+([A-Za-z_]\\\\w*)$');\nconst typedMapping = pattern('^(.+?)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst eventMetadata = new Set(['for', 'tag', 'generation', 'origin', 'documentation', 'namespace', 'sequence', 'correlation', 'causation', 'causedBy', 'occurred']);\n\nexport function rejectOperationChildren(context: ParserContext, line: SourceLine, code: string, message: string): void {\n const child = context.peekChild(line.indent);\n if (child === undefined) return;\n context.error(code, message, locationOf(child));\n context.skipBlock(line.indent);\n}\n\nexport function parseSystem(context: ParserContext, header: SourceLine): SystemSyntax {\n const match = systemHeader.exec(header.content);\n if (match === null) context.error(DiagnosticCodes.InvalidSystemDeclaration, \"Expected 'system <Name>'.\", locationOf(header));\n let description: string | null = null;\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'description') description = parseDescription(context, child, description, `System '${match?.[1] ?? ''}'`);\n else {\n context.error(DiagnosticCodes.InvalidSystemDeclaration, 'A system accepts only a description; abilities are not supported.', locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n return { kind: 'SystemSyntax', name: match?.[1] ?? '', description, location: locationOf(header) };\n}\n\nexport function parseOperation(context: ParserContext, header: SourceLine, inline = false): { operation: OperationSyntax; mappings: PropertyMappingSyntax[] } {\n const match = (inline ? inlineHeader : operationHeader).exec(header.content);\n const name = match?.[1] ?? '';\n if (match === null) context.error(DiagnosticCodes.InvalidOperationDeclaration, 'Expected an operation declaration with one name.', locationOf(header));\n let description: string | null = null;\n let uses: string | null = null;\n let usesLocation = locationOf(header);\n let execute: OperationPhaseSyntax | null = null;\n let compensate: OperationPhaseSyntax | null = null;\n const inputs: PropertySyntax[] = [];\n const mappings: PropertyMappingSyntax[] = [];\n const names = new Set<string>();\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const typed = typedMapping.exec(line.content);\n const propertyLine = inline && typed !== null ? { ...line, content: typed[1].trimEnd() } : line;\n if (typed === null && eventMetadata.has(firstWord(line.content))) {\n context.error(DiagnosticCodes.InvalidOperationDeclaration, 'Operations cannot declare event routing or metadata; escape a keyword-named input with @.', locationOf(line));\n context.skipBlock(line.indent);\n continue;\n }\n if (!usesPattern.test(line.content) && tryParseProperty(propertyLine) !== undefined) {\n const property = parseProperty(context, propertyLine)!;\n if (inline && typed === null) context.error(DiagnosticCodes.InvalidOperationMapping, \"An inline operation input requires '<property> <Type> = <source>'.\", locationOf(line));\n if (property.isSubject) context.error(DiagnosticCodes.InvalidSubjectOwner, 'The subject modifier is only valid on event properties, not operation inputs (decision 0008: one data subject per event).', locationOf(line));\n if (property.isIdentifier || property.isGenerated) context.error(DiagnosticCodes.InvalidOperationDeclaration, 'Operation inputs cannot be identifier or generated properties.', locationOf(line));\n if (names.has(property.name)) context.error(DiagnosticCodes.DuplicateDeclaration, `Operation '${name}' already declares input '${property.name}'.`, locationOf(line));\n names.add(property.name);\n inputs.push(property);\n if (inline && typed !== null) mappings.push({ kind: 'PropertyMappingSyntax', property: property.name, source: parseMappingSource(typed[2], { ...locationOf(line), column: line.indent + line.content.length - typed[2].length + 1 }, context), location: locationOf(line) });\n rejectOperationChildren(context, line, DiagnosticCodes.InvalidOperationDeclaration, 'An operation input cannot have children.');\n } else if (firstWord(line.content) === 'description') description = parseDescription(context, line, description, `Operation '${name}'`);\n else if (usesPattern.test(line.content)) {\n if (uses !== null) context.error(DiagnosticCodes.InvalidSystemReference, \"An operation declares exactly one 'uses <System>'.\", locationOf(line));\n else {\n uses = usesPattern.exec(line.content)![1];\n usesLocation = { ...locationOf(line), column: locationOf(line).column + line.content.indexOf(uses, 4) };\n }\n rejectOperationChildren(context, line, DiagnosticCodes.InvalidSystemReference, 'A system reference cannot have children.');\n } else if (line.content === 'execute' || line.content === 'compensate') {\n const phase = parseOperationPhase(context, line);\n if (line.content === 'execute') {\n if (execute !== null) context.error(DiagnosticCodes.InvalidOperationDeclaration, 'An operation declares execute at most once.', locationOf(line));\n else execute = phase;\n } else {\n if (compensate !== null) context.error(DiagnosticCodes.InvalidOperationDeclaration, 'An operation declares compensate at most once.', locationOf(line));\n else compensate = phase;\n }\n } else {\n context.error(DiagnosticCodes.InvalidOperationDeclaration, `Unexpected '${line.content}' in operation - expected uses, an input, description, execute or compensate.`, locationOf(line));\n context.skipBlock(line.indent);\n }\n }\n if (uses === null) context.error(DiagnosticCodes.InvalidSystemReference, \"An operation requires exactly one 'uses <System>'.\", locationOf(header));\n return { operation: { kind: 'OperationSyntax', name, uses: uses ?? '', usesLocation, inputs, description, execute, compensate, location: locationOf(header) }, mappings };\n}\n\nfunction parseOperationPhase(context: ParserContext, header: SourceLine): OperationPhaseSyntax {\n let description: string | null = null;\n let file: OperationPhaseSyntax['file'] = null;\n let code: OperationPhaseSyntax['code'] = null;\n let implementation: OperationPhaseSyntax['implementation'] = null;\n let sourceSelected = false;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (firstWord(line.content) === 'description') {\n description = parseDescription(context, line, description, `Operation phase '${header.content}'`);\n continue;\n }\n if (firstWord(line.content) === 'implementation') {\n if (sourceSelected) context.error(DiagnosticCodes.ConflictingImplementationSources, 'A phase cannot mix wrapped and direct sources or repeat its wrapper.', locationOf(line));\n const source = parseImplementationWrapper(context, line);\n if (!sourceSelected) { file = source.file; code = source.code; implementation = source.implementation; }\n sourceSelected = true;\n } else if (isFileDirective(line) || line.content.startsWith('```')) {\n if (sourceSelected) context.error(DiagnosticCodes.ConflictingImplementationSources, 'A phase has at most one file or inline payload.', locationOf(line));\n const parsedFile = isFileDirective(line) ? parseFile(context, line) : null;\n const parsedCode = parsedFile === null ? parseCode(context, line) : null;\n if (!sourceSelected) { file = parsedFile; code = parsedCode; }\n sourceSelected = true;\n if (parsedFile !== null) rejectOperationChildren(context, line, DiagnosticCodes.InvalidImplementationBlock, 'A file directive cannot have children.');\n } else {\n context.error(DiagnosticCodes.InvalidOperationDeclaration, 'A phase accepts description, file, a tagged fence or implementation.', locationOf(line));\n context.skipBlock(line.indent);\n }\n }\n return { kind: 'OperationPhaseSyntax', description, file, code, implementation, location: locationOf(header) };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { parseRouteParts } from './EventSourceParser';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport {\n SpecificationCaptureSyntax, SpecificationClockSyntax, SpecificationCommandSyntax, SpecificationErrorSyntax, SpecificationEventSyntax, SpecificationStreamSyntax, SpecificationNoStreamSyntax,\n SpecificationNoResultSyntax, SpecificationQueryResultSyntax, SpecificationReadModelSyntax, SpecificationSyntax, SpecificationTriggerSyntax,\n SpecificationWhenQuerySyntax, SpecificationCallerPersonaSyntax, SpecificationOperationFailureSyntax, SpecificationOperationSyntax, SpecificationCompensatedSyntax, SpecificationRedeliverySyntax,\n} from '../Syntax/Specifications';\nimport { SpecificationDeniedSyntax, SpecificationReturnSyntax } from '../Syntax/Responses';\nimport { dotNetWhitespace, nativePattern, pattern } from '../Text/patterns';\nimport { sourceStreamPattern } from '../Text/SourceStreamNames';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { containsCaseReference, parseCase, parseParameter, parseSpecificationValue as parseMappingSource, validateTable } from './SpecificationCaseParser';\nimport { parseDescription } from './DescriptionParser';\nimport { isFileDirective } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { addFixtureValue, addInlineValue } from './SpecificationExampleParser';\nimport { rejectOperationChildren } from './OperationParser';\nimport { generatedFixturePattern, generatedFixturePrefix, parseConcreteMapping, parseReturn, thenReturnsPrefix } from './SpecificationResponseParser';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { SpecificationAbsentReadModelSyntax, SpecificationCallerClaimSyntax, SpecificationCallerSyntax, SpecificationQuerySyntax } from '../Syntax/Specifications';\n\nconst operationStepPrefix = pattern('^(?:given\\\\s+operation|then\\\\s+(?:operation|compensated))(?:\\\\s|$)');\nconst operationStep = pattern('^(given operation|then operation|then compensated)\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)(\\\\s+fails)?$');\nconst header = pattern('^specification\\\\s+([A-Za-z_]\\\\w*)$');\nconst callerPersonaPattern = pattern('^given caller as ([A-Za-z_]\\\\w*)$');\nconst stepName = '([A-Z]\\\\w*(?:\\\\.\\\\w+)*)';\nconst inlineAssignment = '(?:\\\\s+(?<property>[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(?<value>.+))?';\nconst stepPattern = (prefix: string, exactly = ''): RegExp => nativePattern(`^${prefix}\\\\s+${stepName}${exactly}${inlineAssignment}$`.replaceAll('\\\\s', dotNetWhitespace));\nconst givenPattern = stepPattern('given');\nconst whenAppendPattern = stepPattern('when\\\\s+append');\nconst whenPattern = stepPattern('when');\nconst thenEventPattern = stepPattern('then');\nconst thenQueryPrefix = pattern('^then\\\\s+query\\\\b');\nconst readModelPrefix = pattern('^(?:given|then)\\\\s+readmodel\\\\b');\nconst givenReadModelPattern = stepPattern('given\\\\s+readmodel');\nconst thenReadModelPattern = stepPattern('then\\\\s+readmodel', '(?<exactly>\\\\s+exactly)?');\nconst thenNoPrefix = pattern('^then\\\\s+no\\\\b');\nconst thenErrorPattern = pattern(`^then\\\\s+error\\\\s+\"(${stringBodyPattern})\"$`);\nconst mappingPattern = pattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst nativeMappingPattern = nativePattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst givenClockPrefix = pattern('^given\\\\s+clock\\\\b');\nconst givenCapturePrefix = pattern('^given\\\\s+capture\\\\b');\nconst whenClockPrefix = pattern('^when\\\\s+clock\\\\b');\nconst whenTriggerPrefix = pattern('^when\\\\s+trigger\\\\b');\nconst whenCapturePrefix = pattern('^when\\\\s+capture\\\\b');\nconst whenQueryPrefix = pattern('^when\\\\s+query\\\\b');\nconst thenResultPrefix = pattern('^then\\\\s+result\\\\b');\nconst noResultPrefix = pattern('^then\\\\s+no\\\\s+result\\\\b');\nconst whenRedeliveredPrefix = nativePattern('^when\\\\s+redelivered\\\\b');\nconst whenRedeliveredPattern = nativePattern('^when\\\\s+redelivered\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)\\\\s+to\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst noEventsPrefix = pattern('^then\\\\s+no\\\\s+events\\\\b');\n\n// An instant in ISO 8601 - a date, a time to the minute or finer, and an explicit offset or Z - so the same text\n// means the same moment wherever the specification runs.\nconst clockPattern = pattern('^(given|when)\\\\s+clock\\\\s+\"(\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}(?::\\\\d{2}(?:\\\\.\\\\d+)?)?(?:Z|[+-]\\\\d{2}:\\\\d{2}))\"$');\nconst whenTriggerPattern = pattern('^when\\\\s+trigger\\\\s+([A-Za-z_]\\\\w*)$');\nconst capturePattern = pattern('^(?:given|when)\\\\s+capture\\\\s+([A-Za-z_]\\\\w*)$');\nconst whenQueryPattern = pattern('^when\\\\s+query\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst thenResultPattern = pattern('^then\\\\s+result(\\\\s+exactly)?$');\nconst thenAbsentReadModelPattern = nativePattern('^then\\\\s+no\\\\s+readmodel\\\\s+([A-Z]\\\\w*)\\\\s+for\\\\s+(.+)$');\nconst absentKeyStringPattern = nativePattern(`^(?:\"${stringBodyPattern}\"|'(?:[^'\\\\\\\\]|\\\\\\\\.)*')$`);\nconst thenQueryPattern = nativePattern('^then\\\\s+query\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)(\\\\s+exactly)?$');\n\ninterface SpecificationBody {\n given: SpecificationEventSyntax[];\n givenReadModels: SpecificationReadModelSyntax[];\n when: SpecificationCommandSyntax | null;\n whenAppended: SpecificationEventSyntax | null;\n whenRedelivered: SpecificationRedeliverySyntax | null;\n whenDeclared: boolean;\n thenEvents: SpecificationEventSyntax[];\n thenEventsInAnyOrder: boolean;\n thenNoEvents: boolean;\n noEventsLine?: SourceLine;\n thenReadModels: SpecificationReadModelSyntax[];\n thenErrors: SpecificationErrorSyntax[];\n thenAbsentReadModels: SpecificationAbsentReadModelSyntax[];\n thenQueries: SpecificationQuerySyntax[];\n givenClock: SpecificationClockSyntax | null;\n givenCaptures: SpecificationCaptureSyntax[];\n whenClock: SpecificationClockSyntax | null;\n whenTrigger: SpecificationTriggerSyntax | null;\n whenCapture: SpecificationCaptureSyntax | null;\n whenQuery: SpecificationWhenQuerySyntax | null;\n thenResults: SpecificationQueryResultSyntax[];\n thenNoResult: SpecificationNoResultSyntax | null;\n thenDenied: SpecificationDeniedSyntax | null;\n givenCaller: SpecificationCallerSyntax | null;\n givenCallerPersona?: SpecificationCallerPersonaSyntax;\n thenReturns: SpecificationReturnSyntax | null;\n givenOperationFailures: SpecificationOperationFailureSyntax[];\n thenOperations: SpecificationOperationSyntax[];\n thenCompensated: SpecificationCompensatedSyntax[];\n}\n\nexport function parseSpecification(context: ParserContext, line: SourceLine): SpecificationSyntax {\n const name = header.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidSpecificationDeclaration, `Invalid specification declaration '${line.content}' - expected 'specification <Name>'`, locationOf(line));\n }\n let description: string | null = null;\n const parameters: NonNullable<SpecificationSyntax['parameters']>[number][] = [];\n const cases: NonNullable<SpecificationSyntax['cases']>[number][] = [];\n const body: SpecificationBody = {\n givenOperationFailures: [], thenOperations: [], thenCompensated: [], thenAbsentReadModels: [], thenQueries: [],\n given: [], givenReadModels: [], when: null, whenAppended: null, whenRedelivered: null, whenDeclared: false,\n thenEvents: [], thenEventsInAnyOrder: false, thenNoEvents: false, thenReadModels: [], thenErrors: [],\n givenClock: null, givenCaptures: [], whenClock: null, whenTrigger: null, whenCapture: null, whenQuery: null, thenResults: [], thenNoResult: null, thenDenied: null, givenCaller: null, thenReturns: null,\n };\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (isFileDirective(child)) {\n continue;\n }\n if (parseOperationStep(context, child, body)) continue;\n // Absence assertions admit any whitespace after 'then'; every other directive keeps its first word.\n const keyword = thenNoPrefix.test(child.content) ? 'then' : firstWord(child.content);\n if (keyword === 'parameter') {\n const parameter = parseParameter(context, child);\n if (parameter !== null) parameters.push(parameter);\n } else if (keyword === 'case') {\n const row = parseCase(context, child);\n if (row !== null) cases.push(row);\n } else if (keyword === 'description') {\n description = parseDescription(context, child, description, `Specification '${name}'`);\n } else if (keyword === 'given') {\n parseGiven(context, child, body);\n } else if (keyword === 'when') {\n parseWhen(context, child, body, name);\n } else if (keyword === 'then') {\n parseThen(context, child, body);\n } else {\n context.error(DiagnosticCodes.UnknownSpecificationDirective, `Unexpected '${firstWord(child.content)}' in specification body`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n if (body.noEventsLine !== undefined && (body.whenAppended !== null || body.thenEvents.length > 0 || body.thenEventsInAnyOrder || body.thenErrors.length > 0 || body.thenDenied !== null)) {\n context.error(DiagnosticCodes.InvalidNoEventsExpectation,\n \"'then no events' cannot follow 'when append' or accompany event, event-order, error or denial expectations.\", locationOf(body.noEventsLine));\n }\n const { whenDeclared: _, noEventsLine: _noEventsLine, ...members } = body;\n const specification: SpecificationSyntax = { kind: 'SpecificationSyntax', sourceOptions: context.sourceOptions, name, description, ...members,\n ...(parameters.length === 0 ? {} : { parameters }), ...(cases.length === 0 ? {} : { cases }), location: locationOf(line) };\n validateTable(specification, context);\n return specification;\n}\n\nfunction parseOperationStep(context: ParserContext, line: SourceLine, body: SpecificationBody): boolean {\n if (!operationStepPrefix.test(line.content)) return false;\n const match = operationStep.exec(line.content);\n if (match === null || (match[1] === 'given operation') !== (match[3] !== undefined)) {\n context.error(DiagnosticCodes.InvalidOperationSpecification, \"Expected 'given operation <Name> fails', 'then operation <Name>' or 'then compensated <Name>'.\", locationOf(line));\n skipBody(context, line.indent);\n } else if (match[1] === 'then operation') {\n const values: PropertyMappingSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const value = parseConcreteMapping(context, child, mappingPattern, DiagnosticCodes.InvalidOperationSpecification);\n if (value !== null) values.push(value);\n }\n body.thenOperations.push({ kind: 'SpecificationOperationSyntax', operation: match[2], values, location: locationOf(line) });\n } else {\n rejectOperationChildren(context, line, DiagnosticCodes.InvalidOperationSpecification, 'Failure and compensation assertions cannot have children.');\n if (match[1] === 'given operation') body.givenOperationFailures.push({ kind: 'SpecificationOperationFailureSyntax', operation: match[2], location: locationOf(line) });\n else body.thenCompensated.push({ kind: 'SpecificationCompensatedSyntax', operation: match[2], location: locationOf(line) });\n }\n return true;\n}\n\nfunction parseGiven(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (givenClockPrefix.test(line.content)) {\n if (body.givenClock !== null) {\n context.error(DiagnosticCodes.InvalidSpecificationClock, 'A specification states its clock at most once.', locationOf(line));\n skipBody(context, line.indent);\n } else {\n body.givenClock = parseClock(context, line, 'given');\n }\n } else if (givenCapturePrefix.test(line.content)) {\n const capture = parseCapture(context, line, 'given');\n if (capture !== null) {\n body.givenCaptures.push(capture);\n }\n } else if (line.content.startsWith('given caller')) {\n if (body.givenCaller !== null || body.givenCallerPersona !== undefined) {\n context.error(DiagnosticCodes.DuplicateSpecificationCallerOrDenied, \"A specification has at most one 'given caller' block.\", locationOf(line));\n context.skipBlock(line.indent);\n } else if (line.content.startsWith('given caller as')) {\n const match = callerPersonaPattern.exec(line.content);\n if (match === null) context.error(DiagnosticCodes.InvalidSpecificationCallerPersona, \"Expected 'given caller as <Persona>'.\", locationOf(line));\n const child = context.peekChild(line.indent);\n if (child !== undefined) context.error(DiagnosticCodes.InvalidSpecificationCallerPersona, \"'given caller as <Persona>' has no body; use an explicit 'given caller' for refinements.\", locationOf(child));\n skipBody(context, line.indent);\n if (match !== null) body.givenCallerPersona = { kind: 'SpecificationCallerPersonaSyntax', name: match[1], location: locationOf(line) };\n } else {\n body.givenCaller = parseCaller(context, line);\n }\n } else if (readModelPrefix.test(line.content)) {\n const readModel = parseReadModelStep(context, line, givenReadModelPattern, 'given');\n if (readModel !== undefined) {\n body.givenReadModels.push(readModel);\n }\n } else {\n const event = parseEventStep(context, line, givenPattern, 'given');\n if (event !== undefined) {\n body.given.push(event);\n }\n }\n}\n\nconst callerRolePattern = pattern(`^role${dotNetWhitespace}+\"(${stringBodyPattern})\"$`);\nconst callerClaimPattern = pattern(`^claim${dotNetWhitespace}+\"(${stringBodyPattern})\"${dotNetWhitespace}*=${dotNetWhitespace}*\"(${stringBodyPattern})\"$`);\n\n// 'given caller' and the authenticated, role and claim lines under it.\nfunction parseCaller(context: ParserContext, line: SourceLine): SpecificationCallerSyntax | null {\n if (line.content !== 'given caller') {\n context.error(DiagnosticCodes.InvalidSpecificationCaller, \"Expected exactly 'given caller'.\", locationOf(line));\n context.skipBlock(line.indent);\n return null;\n }\n let authenticated = false;\n const roles: string[] = [];\n const claims: SpecificationCallerClaimSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const role = callerRolePattern.exec(child.content);\n const claim = callerClaimPattern.exec(child.content);\n if (child.content === 'authenticated' && !authenticated) {\n authenticated = true;\n } else if (role !== null) {\n roles.push(unescapeString(role[1]));\n } else if (claim !== null) {\n claims.push({ kind: 'SpecificationCallerClaimSyntax', type: unescapeString(claim[1]), value: unescapeString(claim[2]), location: locationOf(child) });\n } else {\n context.error(containsCaseReference(child.content) ? DiagnosticCodes.InvalidSpecificationCaseReference : DiagnosticCodes.InvalidSpecificationCaller, `Invalid caller fixture '${child.content}' - expected authenticated, role \"...\", or claim \"...\" = \"...\".`, locationOf(child));\n }\n }\n return { kind: 'SpecificationCallerSyntax', authenticated, roles, claims, location: locationOf(line) };\n}\n\nfunction parseWhen(context: ParserContext, line: SourceLine, body: SpecificationBody, name: string): void {\n const appends = line.content.startsWith('when append');\n if (body.whenDeclared) {\n const code = body.whenAppended !== null || appends ? DiagnosticCodes.ConflictingSpecificationActions : DiagnosticCodes.DuplicateSpecificationWhen;\n context.error(code, `Specification '${name}' already declares a 'when' - a specification can have at most one`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n body.whenDeclared = true;\n if (appends) {\n body.whenAppended = parseEventStep(context, line, whenAppendPattern, 'when append') ?? null;\n return;\n }\n if (whenRedeliveredPrefix.test(line.content)) {\n const match = whenRedeliveredPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnmatchedRedeliveredOccurrence, \"Expected 'when redelivered <Event> to <Reaction>'.\", locationOf(line));\n skipBody(context, line.indent);\n } else {\n body.whenRedelivered = { kind: 'SpecificationRedeliverySyntax', eventType: match[1], reaction: match[2], ...parseValuesWithEventSource(context, line, undefined, undefined, 'when redelivered'), location: locationOf(line) };\n }\n return;\n }\n if (whenClockPrefix.test(line.content)) {\n body.whenClock = parseClock(context, line, 'when');\n return;\n }\n if (whenTriggerPrefix.test(line.content)) {\n body.whenTrigger = parseNamedStep(context, line, whenTriggerPattern, DiagnosticCodes.InvalidSpecificationTrigger, 'when trigger', 'when trigger <Trigger>',\n (trigger, values) => ({ kind: 'SpecificationTriggerSyntax', trigger, values, location: locationOf(line) }));\n return;\n }\n if (whenCapturePrefix.test(line.content)) {\n body.whenCapture = parseCapture(context, line, 'when');\n return;\n }\n if (whenQueryPrefix.test(line.content)) {\n body.whenQuery = parseNamedStep(context, line, whenQueryPattern, DiagnosticCodes.InvalidSpecificationQueryAction, 'when query', 'when query <Query>',\n (query, values) => ({ kind: 'SpecificationWhenQuerySyntax', query, arguments: values, location: locationOf(line) }));\n return;\n }\n const match = whenPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationWhen, `Invalid 'when' declaration '${line.content}' - expected 'when <CommandType>' or 'when append <EventType>'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n const generatedValues: PropertyMappingSyntax[] = [];\n const values = parseValuesWithEventSource(context, line, generatedValues, match);\n body.when = { kind: 'SpecificationCommandSyntax', commandType: match[1], ...values, generatedValues, inlineProperty: match.groups?.property ?? null, location: locationOf(line) };\n}\n\nfunction parseThen(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n if (noEventsPrefix.test(line.content)) {\n if (line.content !== 'then no events' || body.thenNoEvents) {\n context.error(DiagnosticCodes.InvalidNoEventsExpectation, \"Expected one 'then no events' directive.\", locationOf(line));\n } else {\n body.thenNoEvents = true;\n body.noEventsLine = line;\n }\n const child = context.peekChild(line.indent);\n if (child !== undefined) context.error(DiagnosticCodes.InvalidNoEventsExpectation, \"'then no events' cannot have child mappings.\", locationOf(child));\n skipBody(context, line.indent);\n return;\n }\n if (thenReturnsPrefix.test(line.content)) {\n const expectation = parseReturn(context, line);\n if (body.thenReturns !== null) {\n context.error(DiagnosticCodes.InvalidReturnExpectation, 'A specification declares at most one return expectation.', locationOf(line));\n } else {\n body.thenReturns = expectation;\n }\n return;\n }\n if (line.content.startsWith('then events')) {\n if (line.content !== 'then events in any order' || body.thenEventsInAnyOrder) {\n context.error(DiagnosticCodes.InvalidSpecificationEventOrder, 'Expected one \\'then events in any order\\' directive.', locationOf(line));\n } else {\n body.thenEventsInAnyOrder = true;\n }\n skipBody(context, line.indent);\n return;\n }\n if (thenResultPrefix.test(line.content)) {\n parseResult(context, line, body);\n return;\n }\n if (noResultPrefix.test(line.content)) {\n if (line.content !== 'then no result' || body.thenNoResult !== null) {\n context.error(DiagnosticCodes.InvalidSpecificationQueryAction, 'Expected one \\'then no result\\' directive.', locationOf(line));\n } else {\n body.thenNoResult = { kind: 'SpecificationNoResultSyntax', location: locationOf(line) };\n }\n skipBody(context, line.indent);\n return;\n }\n if (line.content.startsWith('then denied')) {\n if (line.content !== 'then denied') {\n context.error(DiagnosticCodes.InvalidSpecificationDenied, 'Expected exactly \\'then denied\\'.', locationOf(line));\n skipBody(context, line.indent);\n } else if (body.thenDenied !== null) {\n context.error(DiagnosticCodes.DuplicateSpecificationCallerOrDenied, \"A specification has at most one 'then denied' outcome.\", locationOf(line));\n } else {\n body.thenDenied = { kind: 'SpecificationDeniedSyntax', location: locationOf(line) };\n }\n return;\n }\n if (line.content === 'then error') {\n body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: null, location: locationOf(line) });\n return;\n }\n if (line.content.startsWith('then error case.')) {\n const caseValue = parseMappingSource(line.content.substring(11), { ...locationOf(line), column: locationOf(line).column + 11 }, context);\n if (caseValue.kind === 'CaseValueExpressionSyntax') body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: null, caseValue, location: locationOf(line) });\n return;\n }\n const error = thenErrorPattern.exec(line.content);\n if (error !== null) {\n body.thenErrors.push({ kind: 'SpecificationErrorSyntax', name: unescapeString(error[1]), location: locationOf(line) });\n return;\n }\n if (firstWord(line.content.substring('then'.length).trim()) === 'error') {\n context.error(DiagnosticCodes.InvalidThenError, `Invalid 'then error' declaration '${line.content}' - expected 'then error' or 'then error \"<reason>\"'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n if (thenNoPrefix.test(line.content)) {\n // Legacy documents keep skipping these assertions silently; Exact mirrors the native diagnostics.\n if (context.sourceOptions.numericMode === 'exact') {\n const absent = parseAbsentReadModel(context, line);\n if (absent !== null) body.thenAbsentReadModels.push(absent);\n return;\n }\n const match = thenAbsentReadModelPattern.exec(line.content);\n if (match !== null && !match[2].endsWith(' exactly')) {\n const key = parseMappingSource(match[2].trim(), locationOf(line), context.valueContext);\n if (key.kind === 'LiteralExpressionSyntax' || key.kind === 'ObjectExpressionSyntax' || key.kind === 'CaseValueExpressionSyntax') body.thenAbsentReadModels.push({ kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key, location: locationOf(line) });\n }\n context.skipOpaqueBlock(line.indent);\n return;\n }\n if (thenQueryPrefix.test(line.content)) {\n // Legacy documents keep skipping malformed query bodies silently; Exact reports what the native parser reports.\n const exact = context.sourceOptions.numericMode === 'exact';\n const reject = (code: string, message: string, at: SourceLine): void => {\n if (!exact) return context.skipOpaqueBlock(at.indent);\n context.error(code, message, locationOf(at));\n context.skipBlock(at.indent);\n };\n const match = thenQueryPattern.exec(line.content);\n if (match === null) return reject(DiagnosticCodes.InvalidSpecificationQuery, `Invalid 'then query' declaration '${line.content}' - expected 'then query <Query> [exactly]'`, line);\n const args: PropertyMappingSyntax[] = [];\n const results: SpecificationQueryResultSyntax[] = [];\n let hasArguments = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'arguments' && !hasArguments) args.push(...parseValues(context.valueContext, child, true));\n else if (child.content === 'arguments') reject(DiagnosticCodes.DuplicateSpecificationQueryArguments, `Query assertion '${match[1]}' already declares arguments`, child);\n else if (child.content === 'result') results.push({ kind: 'SpecificationQueryResultSyntax', properties: parseValues(context.valueContext, child, true), exactly: false, location: locationOf(child) });\n else reject(DiagnosticCodes.UnknownSpecificationQueryDirective, `Unexpected '${firstWord(child.content)}' in 'then query' body - expected arguments or result`, child);\n hasArguments ||= child.content === 'arguments';\n }\n body.thenQueries.push({ kind: 'SpecificationQuerySyntax', query: match[1], arguments: args, results, exactly: match[2] !== undefined, location: locationOf(line) });\n return;\n }\n if (readModelPrefix.test(line.content)) {\n const readModel = parseReadModelStep(context, line, thenReadModelPattern, 'then');\n if (readModel !== undefined) {\n body.thenReadModels.push(readModel);\n }\n return;\n }\n const event = parseEventStep(context, line, thenEventPattern, 'then');\n if (event !== undefined) {\n body.thenEvents.push(event);\n }\n}\n\n// The Exact port of C# ParseAbsentReadModel: every malformed part is reported rather than dropped.\nfunction parseAbsentReadModel(context: ParserContext, line: SourceLine): SpecificationAbsentReadModelSyntax | null {\n const match = thenAbsentReadModelPattern.exec(line.content);\n if (match === null || match[2].endsWith(' exactly')) {\n context.error(DiagnosticCodes.InvalidAbsentReadModelStep, `Invalid absence assertion '${line.content}' - expected 'then no readmodel <ReadModelType> for <key>'`, locationOf(line));\n skipBody(context, line.indent);\n return null;\n }\n const keyText = match[2].trim();\n const validString = !(keyText.startsWith('\"') || keyText.startsWith(\"'\")) || absentKeyStringPattern.test(keyText);\n const key = validString ? parseMappingSource(keyText, locationOf(line), context.valueContext) : null;\n const concrete = key !== null && (key.kind === 'LiteralExpressionSyntax' || key.kind === 'ObjectExpressionSyntax' || key.kind === 'CaseValueExpressionSyntax');\n if (!concrete) context.error(DiagnosticCodes.InvalidAbsentReadModelStep, `Invalid absence key '${keyText}' - expected exactly one concrete value.`, locationOf(line));\n let hasChildren = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n context.error(DiagnosticCodes.InvalidAbsentReadModelStep, 'An absent read model assertion cannot have child mappings.', locationOf(child));\n hasChildren = true;\n }\n return hasChildren || !concrete ? null : { kind: 'SpecificationAbsentReadModelSyntax', name: match[1], key, location: locationOf(line) } as SpecificationAbsentReadModelSyntax;\n}\n\nfunction skipBody(context: ParserContext, indent: number): void {\n if (context.sourceOptions.numericMode !== 'exact') return context.skipBlock(indent);\n context.skipOpaqueBlock(indent);\n}\n\nfunction parseClock(context: ParserContext, line: SourceLine, keyword: string): SpecificationClockSyntax | null {\n const match = clockPattern.exec(line.content);\n skipBody(context, line.indent);\n if (match === null || match[1] !== keyword) {\n context.error(containsCaseReference(line.content) ? DiagnosticCodes.InvalidSpecificationCaseReference : DiagnosticCodes.InvalidSpecificationClock,\n `Invalid '${keyword} clock' - expected '${keyword} clock \"<ISO 8601 instant>\"', such as '${keyword} clock \"2026-10-05T08:00:00Z\"'`, locationOf(line));\n return null;\n }\n return { kind: 'SpecificationClockSyntax', instant: match[2], location: locationOf(line) };\n}\n\nfunction parseCapture(context: ParserContext, line: SourceLine, keyword: string): SpecificationCaptureSyntax | null {\n return parseNamedStep(context, line, capturePattern, DiagnosticCodes.InvalidSpecificationCapture, `${keyword} capture`, `${keyword} capture <Capture>`,\n (capture, record) => ({ kind: 'SpecificationCaptureSyntax', capture, record, location: locationOf(line) }));\n}\n\n// A step naming one thing on its header line, with '<field> = <value>' lines beneath it.\nfunction parseNamedStep<T>(\n context: ParserContext, line: SourceLine, regex: RegExp, code: string, keyword: string, expected: string,\n create: (name: string, values: PropertyMappingSyntax[]) => T): T | null {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(code, `Invalid '${keyword}' declaration '${line.content}' - expected '${expected}'`, locationOf(line));\n skipBody(context, line.indent);\n return null;\n }\n return create(match[1], parseValues(context, line));\n}\n\nfunction parseResult(context: ParserContext, line: SourceLine, body: SpecificationBody): void {\n const match = thenResultPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationQueryAction, `Invalid 'then result' declaration '${line.content}' - expected 'then result [exactly]'`, locationOf(line));\n skipBody(context, line.indent);\n return;\n }\n body.thenResults.push({ kind: 'SpecificationQueryResultSyntax', properties: parseValues(context, line), exactly: match[1] !== undefined, location: locationOf(line) });\n}\n\nfunction parseReadModelStep(context: ParserContext, line: SourceLine, regex: RegExp, keyword: string): SpecificationReadModelSyntax | undefined {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidReadModelStep, `Invalid '${keyword} readmodel' declaration '${line.content}' - expected '${keyword} readmodel <ReadModelType>'`, locationOf(line));\n skipBody(context, line.indent);\n return undefined;\n }\n return {\n kind: 'SpecificationReadModelSyntax',\n name: match[1],\n properties: parseValues(context, line, false, match),\n exactly: keyword === 'then' && match.groups?.exactly !== undefined,\n inlineProperty: match.groups?.property ?? null,\n location: locationOf(line),\n };\n}\n\nfunction parseEventStep(context: ParserContext, line: SourceLine, regex: RegExp, keyword: string): SpecificationEventSyntax | undefined {\n const match = regex.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidEventStep, `Invalid '${keyword}' declaration '${line.content}' - expected '${keyword} <EventType>'`, locationOf(line));\n skipBody(context, line.indent);\n return undefined;\n }\n return { kind: 'SpecificationEventSyntax', eventType: match[1], ...parseValuesWithEventSource(context, line, undefined, match, keyword), inlineProperty: match.groups?.property ?? null, location: locationOf(line) };\n}\n\nexport const specificationStream = sourceStreamPattern('^stream\\\\s+([A-Za-z_]\\\\w*)\\\\.([A-Za-z_]\\\\w*)$');\nconst specificationStreamId = pattern('^streamId\\\\s*=(?!=|>)\\\\s*(.+)$');\n\nfunction parseValuesWithEventSource(context: ParserContext, parent: SourceLine, generated?: PropertyMappingSyntax[], inline?: RegExpExecArray, eventKeyword?: string): { values: PropertyMappingSyntax[]; for: ExpressionSyntax | null; stream?: SpecificationStreamSyntax; noStream?: SpecificationNoStreamSyntax } {\n const values: PropertyMappingSyntax[] = [];\n addInlineValue(context, parent, inline, values);\n let eventSource: ExpressionSyntax | null = null;\n let stream: SpecificationStreamSyntax | undefined;\n let noStream: SpecificationNoStreamSyntax | undefined;\n let hasRoute = false;\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n if (generated !== undefined && generatedFixturePrefix.test(child.content)) {\n const fixture = parseConcreteMapping(context, child, generatedFixturePattern, DiagnosticCodes.InvalidGeneratedFixture);\n if (fixture !== null) generated.push(fixture);\n continue;\n }\n const mapping = mappingPattern.exec(child.content);\n if (mapping !== null) {\n addFixtureValue(context, values, mappingOf(context, child, mapping));\n } else if (firstWord(child.content) === 'stream' || child.content.startsWith('no stream')) {\n if (eventKeyword === undefined) {\n context.error(DiagnosticCodes.SpecificationStreamOnCommand, 'A command occurrence cannot declare a route; assert it on a then event.', locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n if (hasRoute) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, 'An event occurrence declares at most one stream or no stream directive.', locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const route = specificationStream.exec(child.content);\n if (child.content === 'no stream' && (eventKeyword === 'then' || eventKeyword === 'when redelivered')) {\n noStream = { kind: 'SpecificationNoStreamSyntax', location: locationOf(child) };\n hasRoute = true;\n rejectSpecificationRouteChildren(context, child);\n } else if (route !== null) {\n stream = parseSpecificationStream(context, child, route);\n hasRoute = true;\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Expected 'stream Source.Stream', or 'no stream' on a then event.\", locationOf(child));\n context.skipBlock(child.indent);\n }\n } else if (firstWord(child.content) === 'for') {\n const source = child.content.substring('for'.length).trim();\n if (source.length === 0) {\n context.error(DiagnosticCodes.InvalidSpecificationEventSource, 'Invalid event-source assertion \\'for\\' - expected \\'for <value>\\'', locationOf(child));\n } else if (eventSource !== null) {\n context.error(DiagnosticCodes.DuplicateSpecificationEventSource, 'A specification step can declare its event-source assertion only once', locationOf(child));\n } else {\n eventSource = parseMappingSource(source, locationOf(child), context);\n }\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child));\n }\n }\n return { values, for: eventSource, ...(stream === undefined ? {} : { stream }), ...(noStream === undefined ? {} : { noStream }) };\n}\n\nexport function parseSpecificationStream(context: ParserContext, header: SourceLine, route: RegExpExecArray): SpecificationStreamSyntax {\n let streamId: PropertyMappingSyntax | null = null;\n let streamIdParts: PropertyMappingSyntax[] = [];\n let block = false;\n const directiveLocations: Record<string, ReturnType<typeof locationOf>> = {};\n for (let child = context.peekChild(header.indent); child !== undefined; child = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'streamId') {\n if (streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Declare either one 'streamId = <literal>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n } else {\n block = true;\n directiveLocations.streamId = locationOf(child);\n streamIdParts = parseRouteParts(context, child, DiagnosticCodes.InvalidSpecificationStream).map(part => part.source.kind === 'PathExpressionSyntax' && part.source.path.startsWith('case.')\n ? { ...part, source: parseMappingSource(part.source.path, part.source.location, context) } : part);\n }\n continue;\n }\n const mapping = specificationStreamId.exec(child.content);\n if (mapping === null || streamId !== null || block) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Declare either one 'streamId = <literal>' mapping or one streamId part block.\", locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const location = { ...locationOf(child), column: child.indent + 1 + child.content.indexOf(mapping[1], child.content.indexOf('=') + 1) };\n streamId = { kind: 'PropertyMappingSyntax', property: 'streamId', source: parseMappingSource(mapping[1], location, context), location: locationOf(child) };\n rejectSpecificationRouteChildren(context, child);\n }\n return { kind: 'SpecificationStreamSyntax', eventSource: route[1], stream: route[2], streamId, streamIdParts, directiveLocations,\n referenceLocation: { ...locationOf(header), column: header.indent + 1 + header.content.indexOf(route[1], 'stream'.length) },\n referenceLength: route[1].length + 1 + route[2].length, location: locationOf(header) };\n}\n\nexport function rejectSpecificationRouteChildren(context: ParserContext, line: SourceLine): void {\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, 'This directive cannot have children.', locationOf(child));\n context.skipBlock(line.indent);\n }\n}\n\nfunction parseValues(context: ParserContext, parent: SourceLine, nativeIdentifiers = false, inline?: RegExpExecArray): PropertyMappingSyntax[] {\n const values: PropertyMappingSyntax[] = [];\n addInlineValue(context, parent, inline, values);\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n const mapping = (nativeIdentifiers || context.sourceOptions.numericMode === 'exact' ? nativeMappingPattern : mappingPattern).exec(child.content);\n if (mapping === null) {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child));\n continue;\n }\n addFixtureValue(context, values, mappingOf(context, child, mapping, nativeIdentifiers));\n }\n return values;\n}\n\nfunction mappingOf(context: ParserContext, line: SourceLine, match: RegExpExecArray, nativeIdentifiers = false): PropertyMappingSyntax {\n return { kind: 'PropertyMappingSyntax', property: match[1], source: parseMappingSource(match[2], locationOf(line), context, nativeIdentifiers), location: locationOf(line) };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { SpecificationNoStreamSyntax, SpecificationStreamSyntax, SpecificationExampleSyntax } from '../Syntax/Specifications';\nimport { dotNetWhitespace, nativePattern } from '../Text/patterns';\nimport { parseSpecificationStream, rejectSpecificationRouteChildren, specificationStream } from './SpecificationParser';\nimport { parseDescription } from './DescriptionParser';\nimport { caseReferences, parseSpecificationValue as parseMappingSource } from './SpecificationCaseParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { generatedFixturePattern, generatedFixturePrefix, parseConcrete, parseConcreteMapping } from './SpecificationResponseParser';\n\nconst header = nativePattern('^example\\\\s+([A-Z]\\\\w*)\\\\s*:\\\\s*([A-Z]\\\\w*(?:\\\\.\\\\w+)*)$'.replaceAll('\\\\s', dotNetWhitespace));\nconst mapping = nativePattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$'.replaceAll('\\\\s', dotNetWhitespace));\n\nexport function parseExample(context: ParserContext, line: SourceLine): SpecificationExampleSyntax {\n const match = header.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSpecificationExample, `Invalid example declaration '${line.content}' - expected 'example <Name> : <EventOrCommandOrReadModel>'`, locationOf(line));\n context.skipOpaqueBlock(line.indent);\n return { kind: 'SpecificationExampleSyntax', name: '', type: '', values: [], generatedValues: [], for: null, description: null, location: locationOf(line) };\n }\n const body = parseFixtureBody(context, line, undefined, true, match[1]);\n for (const reference of caseReferences(body)) context.error(DiagnosticCodes.InvalidSpecificationCaseReference, 'Case references are not permitted in example bodies.', reference.location);\n return { kind: 'SpecificationExampleSyntax', name: match[1], type: match[2], ...body, location: locationOf(line) };\n}\n\nexport function addInlineValue(context: ParserContext, line: SourceLine, match: RegExpExecArray | undefined, values: PropertyMappingSyntax[]): void {\n if (match?.groups?.property === undefined) return;\n const property = match.groups.property;\n const text = match.groups.value;\n const offset = line.content.length - text.length;\n const location = locationOf(line);\n const source = parseConcrete(context, text, { ...location, column: location.column + offset }, DiagnosticCodes.InvalidSpecificationValue);\n if (source !== null) values.push({ kind: 'PropertyMappingSyntax', property, source, location: { ...location, column: location.column + line.content.lastIndexOf(property, line.content.indexOf('=')) } });\n}\n\nexport function addFixtureValue(context: ParserContext, values: PropertyMappingSyntax[], value: PropertyMappingSyntax, other: readonly PropertyMappingSyntax[] = []): void {\n if ([...values, ...other].some(existing => existing.property === value.property)) {\n context.error(DiagnosticCodes.DuplicateSpecificationAssignment, `Property '${value.property}' is assigned more than once in this fixture - assign it only once, inline or indented`, value.location);\n return;\n }\n values.push(value);\n}\n\nexport function parseFixtureBody(context: ParserContext, parent: SourceLine, inline?: RegExpExecArray, allowGenerated = false, example?: string): {\n values: PropertyMappingSyntax[]; for: ExpressionSyntax | null; generatedValues: PropertyMappingSyntax[]; description: string | null;\n stream?: SpecificationStreamSyntax; noStream?: SpecificationNoStreamSyntax;\n} {\n const values: PropertyMappingSyntax[] = [];\n const generatedValues: PropertyMappingSyntax[] = [];\n let eventSource: ExpressionSyntax | null = null;\n let description: string | null = null;\n let stream: SpecificationStreamSyntax | undefined;\n let noStream: SpecificationNoStreamSyntax | undefined;\n addInlineValue(context, parent, inline, values);\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n if (example !== undefined && firstWord(child.content) === 'description') {\n description = parseDescription(context, child, description, `Example '${example}'`);\n continue;\n }\n if (allowGenerated && generatedFixturePrefix.test(child.content)) {\n const fixture = parseConcreteMapping(context, child, generatedFixturePattern, DiagnosticCodes.InvalidGeneratedFixture);\n if (fixture !== null) {\n // Preserve validator-owned PLAY0490 for existing generated step fixtures.\n if (example === undefined) generatedValues.push(fixture);\n else addFixtureValue(context, generatedValues, fixture, values);\n }\n continue;\n }\n const match = mapping.exec(child.content);\n if (example !== undefined && match === null && (firstWord(child.content) === 'stream' || child.content.startsWith('no stream'))) {\n const route = specificationStream.exec(child.content);\n if (stream !== undefined || noStream !== undefined) {\n context.error(DiagnosticCodes.InvalidSpecificationStream, 'An event occurrence declares at most one stream or no stream directive.', locationOf(child));\n context.skipOpaqueBlock(child.indent);\n } else if (child.content === 'no stream') {\n noStream = { kind: 'SpecificationNoStreamSyntax', location: locationOf(child) };\n rejectSpecificationRouteChildren(context, child);\n } else if (route !== null) {\n stream = parseSpecificationStream(context, child, route);\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationStream, \"Expected 'stream Source.Stream', or 'no stream' on an event example.\", locationOf(child));\n context.skipOpaqueBlock(child.indent);\n }\n continue;\n }\n if (match !== null) {\n addFixtureValue(context, values, { kind: 'PropertyMappingSyntax', property: match[1], source: parseMappingSource(match[2], locationOf(child), context), location: locationOf(child) }, generatedValues);\n } else if (firstWord(child.content) === 'for') {\n const source = child.content.substring('for'.length).trim();\n if (source.length === 0) context.error(DiagnosticCodes.InvalidSpecificationEventSource, \"Invalid event-source assertion 'for' - expected 'for <value>'\", locationOf(child));\n else if (eventSource !== null) context.error(DiagnosticCodes.DuplicateSpecificationEventSource, 'A specification step can declare its event-source assertion only once', locationOf(child));\n else eventSource = parseMappingSource(source, locationOf(child), context);\n } else {\n context.error(DiagnosticCodes.InvalidSpecificationValue, `Invalid property mapping '${child.content}' - expected '<property> = <value>'`, locationOf(child));\n }\n }\n return { values, for: eventSource, generatedValues, description, ...(stream === undefined ? {} : { stream }), ...(noStream === undefined ? {} : { noStream }) };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport type { IdentitySyntax } from './IdentitySyntax';\nimport type { ExposureSyntax, InstanceContributionsSyntax } from './CompositionSyntax';\nimport { AuthorizeSyntax, PersonaSyntax } from './Authorization';\nimport { CaptureSyntax } from './Captures';\nimport { CommandSyntax } from './Commands';\nimport { ConstraintSyntax } from './Constraints';\nimport { ConceptSyntax, DomainSyntax, EventSyntax, ImportSyntax, PropertySyntax, ReadModelSyntax, TypeSyntax } from './Declarations';\nimport { ProjectionSyntax } from './Projections';\nimport { PolicySyntax } from './Policies';\nimport { SeedSyntax } from './Seeds';\nimport { EventSourceSyntax } from './EventSources';\nimport { OperationSyntax, SystemSyntax } from './Operations';\nimport { QuerySyntax } from './Queries';\nimport { ReactionSyntax } from './Reactions';\nimport { ScreenSyntax } from './Screens';\nimport { SpecificationExampleSyntax, SpecificationSyntax } from './Specifications';\nimport { SyntaxNode } from './SyntaxNode';\nimport { SourceOptions } from './SourceOptions';\nimport { TranslationDirection } from './TranslationDirection';\nimport { PurposeReferenceSyntax, PurposeSyntax } from './Purposes';\n\n// The four kinds of slice. The names are the C# SliceType members, which is also how SyntaxJson writes them.\nexport type SliceType = 'StateChange' | 'StateView' | 'Automation' | 'Translate';\n\nexport const sliceTypes: readonly SliceType[] = ['StateChange', 'StateView', 'Automation', 'Translate'];\n\nexport interface SliceSyntax extends SyntaxNode {\n readonly purposes?: readonly PurposeReferenceSyntax[];\n readonly kind: 'SliceSyntax';\n readonly direction?: TranslationDirection | null;\n readonly documentation?: string | null;\n readonly examples?: readonly SpecificationExampleSyntax[];\n readonly type: SliceType;\n readonly name: string;\n readonly description: string | null;\n readonly events: readonly EventSyntax[];\n readonly operations?: readonly OperationSyntax[];\n readonly commands: readonly CommandSyntax[];\n readonly queries: readonly QuerySyntax[];\n readonly projections: readonly ProjectionSyntax[];\n readonly captures: readonly CaptureSyntax[];\n readonly reactions: readonly ReactionSyntax[];\n readonly constraints: readonly ConstraintSyntax[];\n readonly specifications: readonly SpecificationSyntax[];\n readonly readModels: readonly ReadModelSyntax[];\n readonly screens: readonly ScreenSyntax[];\n}\n\n// An 'import \"<pattern>\"' of other .play files. Where it is written decides where what it imports belongs:\n// at the top level of a document it brings in whole documents; inside a module or feature it places each\n// imported file there, so the file's top level is that module's or feature's body.\nexport interface FileImportSyntax extends SyntaxNode {\n readonly kind: 'FileImportSyntax';\n readonly pattern: string;\n}\n\nexport interface DependsOnSyntax extends SyntaxNode {\n readonly kind: 'DependsOnSyntax';\n readonly target: string;\n}\n\nexport interface FeatureSyntax extends SyntaxNode {\n readonly purposes?: readonly PurposeReferenceSyntax[];\n readonly dependsOn?: readonly DependsOnSyntax[];\n readonly kind: 'FeatureSyntax';\n readonly documentation?: string | null;\n readonly examples?: readonly SpecificationExampleSyntax[];\n readonly name: string;\n readonly description: string | null;\n readonly authorize: AuthorizeSyntax | null;\n readonly features: readonly FeatureSyntax[];\n readonly slices: readonly SliceSyntax[];\n readonly fileImports: readonly FileImportSyntax[];\n\n // Whether the feature is not written in the document but places it - the document was imported into\n // the feature, so its top level is the feature's body.\n readonly isPlacement: boolean;\n}\n\nexport interface ModuleSyntax extends SyntaxNode {\n readonly purposes?: readonly PurposeReferenceSyntax[];\n readonly dependsOn?: readonly DependsOnSyntax[];\n readonly kind: 'ModuleSyntax';\n readonly documentation?: string | null;\n readonly examples?: readonly SpecificationExampleSyntax[];\n readonly name: string;\n readonly description: string | null;\n readonly authorize: AuthorizeSyntax | null;\n readonly features: readonly FeatureSyntax[];\n readonly fileImports: readonly FileImportSyntax[];\n\n // Whether the module is not written in the document but places it - the document was imported into\n // the module, so its top level is the module's body.\n readonly isPlacement: boolean;\n}\n\nexport interface ApplicationSyntax extends SyntaxNode {\n readonly identity?: IdentitySyntax | null;\n readonly purposes?: readonly PurposeSyntax[];\n readonly kind: 'ApplicationSyntax';\n readonly examples?: readonly SpecificationExampleSyntax[];\n readonly sourceOptions?: SourceOptions;\n readonly domain: DomainSyntax | null;\n readonly policies?: readonly PolicySyntax[];\n readonly seeds?: readonly SeedSyntax[];\n readonly systems?: readonly SystemSyntax[];\n readonly eventSources?: readonly EventSourceSyntax[];\n readonly imports: readonly ImportSyntax[];\n readonly concepts: readonly ConceptSyntax[];\n readonly types: readonly TypeSyntax[];\n readonly modules: readonly ModuleSyntax[];\n readonly personas: readonly PersonaSyntax[];\n\n // Parser-owned typed trigger shapes for consistency checks, not part of the syntax wire projection.\n readonly declaredTriggers?: readonly { readonly name: string; readonly data: readonly PropertySyntax[] }[];\n\n // The files the document imports at its top level - whole documents, merged into the application.\n readonly fileImports: readonly FileImportSyntax[];\n\n // What layouts and templates expose, and what instances store for it - written only when present.\n readonly exposures?: readonly ExposureSyntax[];\n readonly instanceContributions?: readonly InstanceContributionsSyntax[];\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nexport enum TranslationDirection {\n Inbound = 'Inbound',\n Outbound = 'Outbound',\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { CaptureSourceSettingSyntax, CaptureSourceSyntax } from './Captures';\n\n/** The source kind of a capture that reads the public events of another application. */\nexport const eventsSourceKind = 'events';\n\n/** The setting that names one consumed event. */\nexport const fromSetting = 'from';\n\n/** Gets whether a capture source is `source events`. */\nexport function isEventsSource(source: CaptureSourceSyntax): boolean {\n return source.syntaxKind === eventsSourceKind;\n}\n\n/** Gets the `from <Event>` settings of an events source, in source order; empty for any other source. */\nexport function consumedEvents(source: CaptureSourceSyntax): readonly CaptureSourceSettingSyntax[] {\n return isEventsSource(source) ? source.settings.filter(setting => setting.name === fromSetting) : [];\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nexport enum EventVisibility {\n Private = 'Private',\n Public = 'Public',\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { EventSyntax, ImportSyntax } from './Declarations';\nimport { EventVisibility } from './EventVisibility';\nimport { SliceSyntax } from './Structure';\nimport { SyntaxNode } from './SyntaxNode';\nimport { TranslationDirection } from './TranslationDirection';\nimport { dotNetWhitespace } from '../Text/patterns';\n\n// .NET whitespace differs from ECMAScript trim at NEL and BOM. Never normalize opaque text.\nconst blankOrigin = new RegExp(`^${dotNetWhitespace}*$`);\nexport const isBlankPublicEventOrigin = (text: string): boolean => blankOrigin.test(text);\n\n// The native PublicEventInvariants contract, shared by source and transport validation.\nexport function publicEventMetadataError(node: SyntaxNode): string | undefined {\n if (node.kind === 'EventSyntax' || node.kind === 'ImportSyntax') {\n const declaration = node as EventSyntax | ImportSyntax;\n const visibility = declaration.visibility === undefined ? EventVisibility.Private : declaration.visibility;\n if (visibility !== EventVisibility.Private && visibility !== EventVisibility.Public) return 'Event visibility must be Private or Public.';\n if (declaration.origin != null && (typeof declaration.origin !== 'string' || isBlankPublicEventOrigin(declaration.origin))) return 'An event or import origin must be a nonblank quoted string.';\n if (declaration.origin != null && visibility !== EventVisibility.Public) return 'An event or import with an origin is a public contract.';\n if (node.kind === 'ImportSyntax' && visibility === EventVisibility.Public && declaration.origin == null) return 'A public contract import requires an origin.';\n }\n if (node.kind === 'SliceSyntax') {\n const slice = node as SliceSyntax;\n if (slice.direction != null && slice.type !== 'Translate') return 'Only a Translate slice may declare a direction.';\n if (slice.direction != null && slice.direction !== TranslationDirection.Inbound && slice.direction !== TranslationDirection.Outbound) return 'A translation direction must be Inbound or Outbound.';\n }\n return undefined;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/** First words reserved in a standalone event body, matching C# ReservedWords.EventBody. */\nexport const eventBodyReservedWords: readonly string[] = ['tag'];\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { pattern } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { parseDocumentation } from './DocumentationParser';\nimport { parseDescription } from './DescriptionParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst idPattern = pattern(`^id\\\\s+\"(${stringBodyPattern})\"$`);\n\nexport class EventMetadataParser {\n readonly value: { id: string | null; description: string | null; documentation: string | null } = { id: null, description: null, documentation: null };\n\n constructor(readonly name: string) {}\n\n tryParse(context: ParserContext, line: SourceLine): boolean {\n const location = locationOf(line);\n switch (firstWord(line.content)) {\n case 'id': {\n const match = idPattern.exec(line.content);\n const id = match === null ? '' : unescapeString(match[1]);\n if (id.trim().length === 0 || this.value.id !== null) {\n context.error(DiagnosticCodes.InvalidEventId, `Event '${this.name}' accepts one nonempty 'id \"<old-name>\"'`, location);\n } else {\n this.value.id = id;\n if (id === this.name) {\n context.information(DiagnosticCodes.RedundantEventId, `Event '${this.name}' already has this name as its identity - remove the redundant id`, location);\n }\n }\n return true;\n }\n case 'description':\n this.value.description = parseDescription(context, line, this.value.description, `Event '${this.name}'`, true);\n return true;\n case 'documentation':\n this.value.documentation = parseDocumentation(context, line, this.value.documentation, `Event '${this.name}'`, DiagnosticCodes.InvalidEventDocumentation);\n return true;\n default:\n return false;\n }\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { EventSyntax, PropertySyntax, ReadModelSyntax, TagSyntax, TypeSyntax } from '../Syntax/Declarations';\nimport { pattern } from '../Text/patterns';\nimport { EventVisibility } from '../Syntax/EventVisibility';\nimport { isBlankPublicEventOrigin } from '../Syntax/PublicEventInvariants';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { eventBodyReservedWords } from '../Text/ReservedWords';\nimport { parseDescription } from './DescriptionParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { EventMetadataParser } from './EventMetadataParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { isFileDirectiveAmongProperties } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseProperty, tryParseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst typeHeader = pattern('^type\\\\s+([A-Za-z_]\\\\w*)$');\nconst eventHeader = pattern(`^(?:(?<public>public)\\\\s+)?event\\\\s+(?<name>[A-Za-z_]\\\\w*)(?:\\\\s+generation\\\\s+(?<generation>[0-9]+))?(?:\\\\s+from\\\\s+\"(?<origin>${stringBodyPattern})\")?$`);\nconst readModelHeader = pattern('^readmodel\\\\s+([A-Za-z_]\\\\w*)$');\nconst maximumGeneration = 4294967295;\nconst typeShapedPattern = pattern('^[A-Z]\\\\w*(?:\\\\[\\\\])?(?:\\\\?|\\\\s+optional)?$');\nconst tagIdentifierPattern = pattern('^[A-Za-z_]\\\\w*$');\n\n// 'description' takes no type reference, so a line with property shape is a property named description.\nconst isDescription = (line: SourceLine): boolean => firstWord(line.content) === 'description' && tryParseProperty(line) === undefined;\n\nfunction withoutIdentifier(context: ParserContext, property: PropertySyntax, line: SourceLine, code: string, message: string): PropertySyntax {\n if (!property.isIdentifier) {\n return property;\n }\n context.error(code, message, locationOf(line));\n return { ...property, isIdentifier: false };\n}\n\nexport function parseType(context: ParserContext, header: SourceLine): TypeSyntax {\n const name = typeHeader.exec(header.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidTypeDeclaration, `Invalid type declaration '${header.content}' - expected 'type <Name>'`, locationOf(header));\n }\n const properties: PropertySyntax[] = [];\n let description: string | null = null;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (isDescription(line)) {\n description = parseDescription(context, line, description, `Type '${name}'`);\n continue;\n }\n if (isFileDirectiveAmongProperties(line)) {\n continue;\n }\n const property = parseProperty(context, line);\n if (property === undefined) {\n context.error(DiagnosticCodes.InvalidPropertyDeclaration, `Invalid property '${line.content}' - expected '<name> <Type>'`, locationOf(line));\n continue;\n }\n properties.push(withoutIdentifier(context, property, line, DiagnosticCodes.IdentifierOutsideCommand,\n `Property '${property.name}' of type '${name}' cannot be marked identifier - only a command property can be`));\n }\n if (properties.length === 0) {\n context.error(DiagnosticCodes.TypeWithoutProperties, `Type '${name}' must declare at least one property`, locationOf(header));\n }\n return { kind: 'TypeSyntax', name, properties, description, location: locationOf(header) };\n}\n\nexport function parseEvent(context: ParserContext, header: SourceLine): EventSyntax {\n const match = eventHeader.exec(header.content);\n const name = match?.groups?.name ?? '';\n if (match === null) {\n context.error(DiagnosticCodes.InvalidEventDeclaration, `Invalid event declaration '${header.content}' - expected '[public] event <Name> [generation <N>] [from \"<origin>\"]'`, locationOf(header));\n }\n const origin = match?.groups?.origin === undefined ? null : unescapeString(match.groups.origin);\n const visibility = match?.groups?.public !== undefined || origin !== null ? EventVisibility.Public : EventVisibility.Private;\n if (origin !== null && isBlankPublicEventOrigin(origin)) {\n context.error(DiagnosticCodes.InvalidEventDeclaration, 'An event origin must be a nonblank quoted string', locationOf(header));\n }\n const hasGenerationMarker = match?.groups?.generation !== undefined;\n let generation = 1;\n if (hasGenerationMarker) {\n const declared = Number(match!.groups!.generation);\n if (!Number.isSafeInteger(declared) || declared === 0 || declared >= maximumGeneration) {\n context.error(DiagnosticCodes.InvalidEventGeneration, `Event '${name}' must declare a generation between 1 and ${maximumGeneration - 1}`, locationOf(header));\n } else {\n generation = declared;\n }\n }\n const properties: PropertySyntax[] = [];\n const tags: TagSyntax[] = [];\n const metadata = new EventMetadataParser(name);\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (isFileDirectiveAmongProperties(line)) {\n continue;\n }\n if (eventBodyReservedWords.includes(firstWord(line.content))) {\n const tag = parseTag(context, line);\n if (tag !== undefined) {\n tags.push(tag);\n }\n continue;\n }\n const property = parseProperty(context, line);\n if (property === undefined) {\n if (!metadata.tryParse(context, line)) {\n context.error(DiagnosticCodes.InvalidPropertyDeclaration, `Invalid property '${line.content}' - expected '<name> <Type>'`, locationOf(line));\n }\n continue;\n }\n properties.push(withoutIdentifier(context, property, line, DiagnosticCodes.IdentifierOnEventProperty,\n `Property '${property.name}' of event '${name}' cannot be marked identifier - an event never carries its event source id`));\n }\n return { kind: 'EventSyntax', name, properties, tags, visibility, origin, generation, hasGenerationMarker, ...metadata.value, location: locationOf(header) };\n}\n\n// 'tag <value>' - the port of the C# TagParser, with the warning the C# EventParser gives for a tag whose\n// value looks like a type, which is almost always a property named tag written without its '@'.\nexport function parseTag(context: ParserContext, line: SourceLine, eventDeclaration = true): TagSyntax | undefined {\n const value = line.content.substring('tag'.length).trim();\n if (eventDeclaration && typeShapedPattern.test(value)) {\n context.warning(DiagnosticCodes.TagPropertyReadAsTag,\n `'${line.content}' declares a static tag with the value '${value}', not a property named 'tag' - write 'tag \"${value}\"' for the tag, or '@${line.content}' for the property`,\n locationOf(line));\n }\n if (value.length === 0) {\n context.error(DiagnosticCodes.TagWithoutValue, 'Expected a value after \\'tag\\' - an identifier, a string literal or a context expression', locationOf(line));\n return undefined;\n }\n if (tagIdentifierPattern.test(value)) {\n return { kind: 'TagSyntax', value: { kind: 'LiteralExpressionSyntax', value, location: locationOf(line) }, location: locationOf(line) };\n }\n const expression = parseMappingSource(value, locationOf(line), context);\n if (expression.kind === 'RawExpressionSyntax') {\n context.error(DiagnosticCodes.InvalidTagValue, `Invalid tag value '${value}' - expected an identifier, a string literal or a context expression`, locationOf(line));\n return undefined;\n }\n return { kind: 'TagSyntax', value: expression, location: locationOf(line) };\n}\n\nexport function parseReadModel(context: ParserContext, header: SourceLine): ReadModelSyntax {\n const name = readModelHeader.exec(header.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidReadModelDeclaration, `Invalid read model declaration '${header.content}' - expected 'readmodel <Name>'`, locationOf(header));\n }\n const properties: PropertySyntax[] = [];\n let description: string | null = null;\n let documentation: string | null = null;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (isDescription(line)) {\n description = parseDescription(context, line, description, `Read model '${name}'`);\n } else if (firstWord(line.content) === 'documentation' && tryParseProperty(line) === undefined) {\n documentation = parseDocumentation(context, line, documentation, `Read model '${name}'`);\n } else if (isFileDirectiveAmongProperties(line)) {\n continue;\n } else {\n const property = parseProperty(context, line);\n if (property === undefined) {\n context.error(DiagnosticCodes.InvalidPropertyDeclaration, `Invalid property '${line.content}' - expected '<name> <Type>'`, locationOf(line));\n continue;\n }\n properties.push(withoutIdentifier(context, property, line, DiagnosticCodes.IdentifierOutsideCommand,\n `Property '${property.name}' of read model '${name}' cannot be marked identifier - only a command property can be`));\n }\n }\n return { kind: 'ReadModelSyntax', name, properties, description, documentation, location: locationOf(header) };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ExpressionSyntax, TemplateInterpolationSyntax, TemplateTextSyntax } from '../Syntax/Expressions';\nimport { parseLiteral, parseModeledMappingSource as parseMappingSource } from './ExpressionParser';\nimport { ParserContext } from './ParserContext';\nimport { nativePattern as pattern } from '../Text/patterns';\n\nconst exactPath = pattern('^@?[A-Za-z_]\\\\w*(\\\\.@?[A-Za-z_$]\\\\w*)*$');\n\n// Mirrors C# ParseProjectionExpression, not a general expression or arithmetic parser. Diagnostics for\n// formerly omitted operands remain owned by C# on Legacy documents.\nexport function parseProjectionExpression(text: string, location: SourceLocation, context: ParserContext): ExpressionSyntax {\n context = context.valueContext;\n text = text.trim();\n if (text.startsWith('`')) {\n const parts: (TemplateTextSyntax | TemplateInterpolationSyntax)[] = [];\n if (!text.endsWith('`') || text.length < 2) {\n context.error(DiagnosticCodes.UnterminatedTemplateExpression, 'Unterminated template expression - expected a closing backtick', location);\n return { kind: 'TemplateExpressionSyntax', parts, location };\n }\n const inner = text.substring(1, text.length - 1);\n let start = 0;\n for (let index = 0; index < inner.length; index++) {\n if (inner[index] !== '$' || inner[index + 1] !== '{') continue;\n if (index > start) parts.push({ kind: 'TemplateTextSyntax', text: inner.substring(start, index), location });\n const end = inner.indexOf('}', index);\n if (end < 0) {\n context.error(DiagnosticCodes.UnterminatedInterpolation, 'Unterminated ${...} interpolation in template expression', location);\n return { kind: 'TemplateExpressionSyntax', parts, location };\n }\n parts.push({ kind: 'TemplateInterpolationSyntax', expression: parseProjectionExpression(inner.substring(index + 2, end), location, context), location });\n index = end;\n start = end + 1;\n }\n if (start < inner.length) parts.push({ kind: 'TemplateTextSyntax', text: inner.substring(start), location });\n return { kind: 'TemplateExpressionSyntax', parts, location };\n }\n const structured = text.startsWith('literal ') ? text.substring('literal '.length).trim() : text;\n if (context.sourceOptions.numericMode === 'exact' && (structured.startsWith('{') || structured.startsWith('['))) return parseMappingSource(structured, location, context);\n if (text.startsWith('literal ')) {\n const literal = parseLiteral(text.substring('literal '.length).trim(), location, context);\n if (literal !== undefined) return literal;\n context.error(DiagnosticCodes.ExpectedLiteralValue, `Expected a literal value after 'literal', got '${text.substring('literal '.length).trim()}'`, location);\n return { kind: 'RawExpressionSyntax', text, location };\n }\n if (text === '$refusal' || text.startsWith('$refusal.')) return { kind: 'RefusalExpressionSyntax', member: text === '$refusal' ? '' : text.substring('$refusal.'.length), location };\n if (text === '$eventSourceId') return { kind: 'EventSourceIdExpressionSyntax', location };\n if (text.startsWith('$eventContext.')) return { kind: 'EventContextExpressionSyntax', path: text.substring('$eventContext.'.length), location };\n if (text === '$causedBy') return { kind: 'CausedByExpressionSyntax', property: null, location };\n if (text.startsWith('$causedBy.')) return { kind: 'CausedByExpressionSyntax', property: text.substring('$causedBy.'.length), location };\n const literal = parseLiteral(text, location, context);\n if (literal !== undefined) return literal;\n if (exactPath.test(text)) return { kind: 'PathExpressionSyntax', path: text.replaceAll('@', ''), location };\n context.error(DiagnosticCodes.InvalidExpression, `Invalid expression '${text}'`, location);\n return { kind: 'RawExpressionSyntax', text, location };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { CaptureAppendSyntax, CaptureChildrenSyntax, CaptureMapOperationSyntax, CaptureNestedSyntax, CaptureSourceSettingSyntax, CaptureSourceSyntax, CaptureSyntax, CaptureTranslationSyntax, CaptureWhenSyntax } from '../Syntax/Captures';\nimport { eventsSourceKind, fromSetting } from '../Syntax/CaptureEventsSource';\nimport { TagSyntax } from '../Syntax/Declarations';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { nativePattern as pattern, pattern as legacyPattern } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { parseTag } from './DeclarationParsers';\nimport { parseModeledMappingSource as parseMappingSource } from './ExpressionParser';\nimport { firstWord, unescapeIdentifier } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseProjectionExpression } from './ProjectionExpressionParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// The grammar Legacy already modeled keeps its original patterns; native patterns apply to Exact documents.\nconst grammar = (source: string): { legacy: RegExp; native: RegExp } => ({ legacy: legacyPattern(source), native: pattern(source) });\nconst headerRules = grammar('^capture\\\\s+([A-Za-z_]\\\\w*)$');\nconst eventNameRules = /^[A-Za-z_][\\w.]*$/;\nconst appendRules = grammar('^append\\\\s+([A-Z]\\\\w*)$');\nconst childrenRules = grammar('^children\\\\s+([a-z_]\\\\w*)\\\\s+identified\\\\s+by\\\\s+([\\\\w.]+)$');\nconst nestedRules = grammar('^nested\\\\s+([\\\\w.]+)$');\nconst select = (context: ParserContext, rules: { legacy: RegExp; native: RegExp }): RegExp => context.sourceOptions.numericMode === 'exact' ? rules.native : rules.legacy;\nconst mappingPattern = pattern('^(@?[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst mapEntryPattern = pattern('^([a-z_]\\\\w*)\\\\s*=\\\\s*(.+)$');\nconst translationPattern = pattern(`^\"(${stringBodyPattern})\"\\\\s*=>\\\\s*(\\\\w+)$`);\nconst splitPattern = pattern(`^split\\\\s+(\\\\S+)\\\\s+by\\\\s+\"(${stringBodyPattern})\"$`);\nconst whenTokens = new RegExp(pattern(`\"${stringBodyPattern}\"|[\\\\w.]+`).source, 'gu');\nconst splitTarget = pattern('^[\\\\w.]+$');\n\n// A structural port of the existing capture grammar. Transition operands remain authored strings, as\n// C# models them; exact numeric mode is not admitted by any supported executable model (ESM) version yet (#285).\nexport function parseCapture(context: ParserContext, line: SourceLine): CaptureSyntax {\n // The events source is new grammar, so its violations reach the owning context rather than the quiet value context.\n const owner = context;\n context = context.valueContext;\n const name = select(context, headerRules).exec(line.content)?.[1] ?? '';\n if (name === '' && context.sourceOptions.numericMode === 'exact') context.error(DiagnosticCodes.InvalidCaptureDeclaration, `Invalid capture declaration '${line.content}' - expected 'capture <Name>'`, locationOf(line));\n let source: CaptureSourceSyntax | null = null;\n let key: string | null = null;\n const map: CaptureMapOperationSyntax[] = [];\n const appends: CaptureAppendSyntax[] = [];\n const children: CaptureChildrenSyntax[] = [];\n const nested: CaptureNestedSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n switch (firstWord(child.content)) {\n case 'source': source = parseSource(context, child, owner); break;\n case 'key': key = child.content.substring('key'.length).trim(); break;\n case 'map': map.push(...parseMap(context, child)); break;\n case 'append': pushAppend(context, child, appends); break;\n case 'children': {\n const match = select(context, childrenRules).exec(child.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidChildrenDeclaration, `Invalid children declaration '${child.content}' - expected 'children <collection> identified by <key>'`, locationOf(child)); context.skipOpaqueBlock(child.indent); break; }\n const body = mapAndAppends(context, child);\n if (match !== null) children.push({ kind: 'CaptureChildrenSyntax', property: match[1], identifiedBy: match[2], ...body, location: locationOf(child) });\n break;\n }\n case 'nested': {\n const match = select(context, nestedRules).exec(child.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidNestedDeclaration, `Invalid nested declaration '${child.content}' - expected 'nested <Property>'`, locationOf(child)); context.skipOpaqueBlock(child.indent); break; }\n const body = mapAndAppends(context, child);\n if (match !== null) nested.push({ kind: 'CaptureNestedSyntax', property: match[1], ...body, location: locationOf(child) });\n break;\n }\n default:\n context.error(DiagnosticCodes.UnknownCaptureDirective, `Unexpected '${child.content}' in capture body`, locationOf(child));\n context.skipOpaqueBlock(child.indent);\n }\n }\n return { kind: 'CaptureSyntax', sourceOptions: context.sourceOptions, name, source, key, map, appends, children, nested, location: locationOf(line) };\n}\n\nfunction parseSource(context: ParserContext, line: SourceLine, owner: ParserContext): CaptureSourceSyntax {\n const settings: CaptureSourceSettingSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const settingName = firstWord(child.content);\n settings.push({ kind: 'CaptureSourceSettingSyntax', name: settingName, value: child.content.substring(settingName.length).trim(), location: locationOf(child) });\n }\n const syntaxKind = line.content.substring('source'.length).trim();\n if (syntaxKind === eventsSourceKind) validateEventsSource(owner, line, settings);\n return { kind: 'CaptureSourceSyntax', syntaxKind, settings, location: locationOf(line) };\n}\n\nfunction validateEventsSource(context: ParserContext, line: SourceLine, settings: readonly CaptureSourceSettingSyntax[]): void {\n if (settings.length === 0) context.error(DiagnosticCodes.InvalidCaptureEventsSource, \"'source events' needs at least one 'from <Event>' line naming a public event to consume\", locationOf(line));\n const seen = new Set<string>();\n for (const setting of settings) {\n if (setting.name !== fromSetting) context.error(DiagnosticCodes.InvalidCaptureEventsSource, `'source events' accepts only 'from <Event>' lines, got '${setting.name}'`, setting.location);\n else if (!eventNameRules.test(setting.value)) context.error(DiagnosticCodes.InvalidCaptureEventsSource, `Invalid event '${setting.value}' - expected 'from <Event>', optionally qualified with dots`, setting.location);\n else if (seen.has(setting.value)) context.error(DiagnosticCodes.InvalidCaptureEventsSource, `Event '${setting.value}' is already consumed by this 'source events'`, setting.location);\n else seen.add(setting.value);\n }\n}\n\nfunction parseMap(context: ParserContext, line: SourceLine): CaptureMapOperationSyntax[] {\n const map: CaptureMapOperationSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const location = locationOf(child);\n if (firstWord(child.content) === 'split') {\n const match = splitPattern.exec(child.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidSplitDeclaration, `Invalid split operation '${child.content}' - expected 'split <property> by \"<separator>\"'`, location); context.skipOpaqueBlock(child.indent); continue; }\n const targets: string[] = [];\n for (let target = context.peekChild(child.indent); target !== undefined; target = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n if (splitTarget.test(target.content)) targets.push(target.content);\n else context.error(DiagnosticCodes.InvalidSplitTarget, `Invalid split target '${target.content}' - expected a property path`, locationOf(target));\n }\n if (match !== null) map.push({ kind: 'CaptureSplitSyntax', source: parseProjectionExpression(match[1], location, context), separator: unescapeString(match[2]), targets, location });\n continue;\n }\n const match = mapEntryPattern.exec(child.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidMapEntry, `Invalid map entry '${child.content}' - expected '<property> = <source> [translate]'`, location); context.skipOpaqueBlock(child.indent); continue; }\n const raw = match[2].trim();\n const closing = raw.startsWith('`') ? raw.indexOf('`', 1) : -1;\n const translate = raw.startsWith('`') ? closing >= 0 && raw.substring(closing + 1).trim() === 'translate' : raw.endsWith(' translate');\n const text = raw.startsWith('`') && closing >= 0 && (context.sourceOptions.numericMode !== 'exact' || translate || raw.substring(closing + 1).trim() === '') ? raw.substring(0, closing + 1) : translate ? raw.substring(0, raw.length - ' translate'.length).trimEnd() : raw;\n const translations: CaptureTranslationSyntax[] = [];\n if (translate) {\n for (let entry = context.peekChild(child.indent); entry !== undefined; entry = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n const translated = translationPattern.exec(entry.content);\n if (translated !== null) translations.push({ kind: 'CaptureTranslationSyntax', from: unescapeString(translated[1]), to: translated[2], location: locationOf(entry) });\n else context.error(DiagnosticCodes.InvalidTranslation, `Invalid translation '${entry.content}' - expected '\"<source>\" => <target>'`, locationOf(entry));\n }\n }\n map.push({ kind: 'CaptureMapEntrySyntax', property: match[1], source: parseProjectionExpression(text, location, context), translations, location });\n }\n return map;\n}\n\nfunction mapAndAppends(context: ParserContext, line: SourceLine): { map: CaptureMapOperationSyntax[]; appends: CaptureAppendSyntax[] } {\n let map: CaptureMapOperationSyntax[] = [];\n const appends: CaptureAppendSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'map') map = parseMap(context, child);\n else if (firstWord(child.content) === 'append') pushAppend(context, child, appends);\n else {\n context.error(DiagnosticCodes.UnknownCaptureBlockDirective, `Unexpected '${child.content}' in ${firstWord(line.content)} block - expected 'map' or 'append <EventType>'`, locationOf(child));\n context.skipOpaqueBlock(child.indent);\n }\n }\n return { map, appends };\n}\n\nfunction pushAppend(context: ParserContext, line: SourceLine, appends: CaptureAppendSyntax[]): void {\n const match = select(context, appendRules).exec(line.content);\n if (match === null) { context.error(DiagnosticCodes.InvalidAppendDeclaration, `Invalid append declaration '${line.content}' - expected 'append <EventType>'`, locationOf(line)); context.skipOpaqueBlock(line.indent); return; }\n const mappings: PropertyMappingSyntax[] = [];\n const tags: TagSyntax[] = [];\n let when: CaptureWhenSyntax | null = null;\n const mapping = (child: SourceLine, nested = false): void => {\n const location = locationOf(child);\n if (firstWord(child.content) === 'tag') {\n const tag = parseTag(context.valueContext, child, false);\n if (tag !== undefined) tags.push(tag);\n return;\n }\n const mapped = mappingPattern.exec(child.content);\n if (mapped !== null) mappings.push({ kind: 'PropertyMappingSyntax', property: unescapeIdentifier(mapped[1]), source: parseMappingSource(mapped[2], location, context.valueContext), location });\n else context.error(nested ? DiagnosticCodes.InvalidPropertyMapping : DiagnosticCodes.UnknownAppendDirective, `Unexpected '${child.content}' in append body`, location);\n };\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'when') {\n when = parseWhen(context, child);\n for (let value = context.peekChild(child.indent); value !== undefined; value = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n mapping(value, true);\n }\n } else mapping(child);\n }\n appends.push({ kind: 'CaptureAppendSyntax', event: match[1], when, mappings, tags, location: locationOf(line) });\n}\n\nfunction parseWhen(context: ParserContext, line: SourceLine): CaptureWhenSyntax | null {\n const trigger = line.content.substring('when'.length).trim();\n const location = locationOf(line);\n const value = (syntaxKind: CaptureWhenSyntax['syntaxKind'], properties: string[] = [], from: string | null = null, to: string | null = null, expression: string | null = null): CaptureWhenSyntax => ({ kind: 'CaptureWhenSyntax', syntaxKind, properties, fromValue: from, toValue: to, expression, location });\n if (trigger === 'added') return value('Added');\n if (trigger === 'removed') return value('Removed');\n if (trigger.startsWith('`')) {\n if (!trigger.endsWith('`') || trigger.length < 2) context.error(DiagnosticCodes.UnterminatedTemplateExpression, \"Unterminated template expression in 'when' - expected a closing backtick\", location);\n return value('Expression', [], null, null, trigger);\n }\n if (trigger.length === 0) { context.error(DiagnosticCodes.WhenWithoutTrigger, \"Expected a trigger after 'when'\", location); return null; }\n const tokens: string[] = [...(trigger.match(context.sourceOptions.numericMode === 'exact' ? new RegExp(`\"${stringBodyPattern}\"|[^\\\\s]+`, 'gu') : whenTokens) ?? [])];\n const unquote = (text: string): string => text.startsWith('\"') && text.endsWith('\"') ? unescapeString(text.substring(1, text.length - 1)) : text;\n if (tokens.length === 0) { context.error(DiagnosticCodes.InvalidWhenClause, `Invalid 'when' clause '${line.content}'`, location); return null; }\n if (tokens.length === 1) return value('PropertyChanged', [unquote(tokens[0])]);\n if (tokens[1] === 'from') {\n if (tokens.length === 5 && tokens[3] === 'to') return value('ValueTransition', [unquote(tokens[0])], unquote(tokens[2]), unquote(tokens[4]));\n context.error(DiagnosticCodes.InvalidWhenTransitionClause, `Invalid 'when ... from ... to ...' clause '${line.content}'`, location); return null;\n }\n if (tokens[1] !== 'or' && tokens[1] !== 'and') { context.error(DiagnosticCodes.InvalidWhenClause, `Invalid 'when' clause '${line.content}'`, location); return null; }\n if (tokens.length % 2 === 0) { context.error(DiagnosticCodes.WhenCombinatorWithoutProperty, `Expected a property after '${tokens[1]}'`, location); return null; }\n const properties = [unquote(tokens[0])];\n for (let index = 1; index < tokens.length - 1; index += 2) {\n if (tokens[index] !== tokens[1]) { context.error(DiagnosticCodes.MixedWhenCombinators, `Cannot mix 'and' and 'or' in a single 'when' clause '${line.content}'`, location); return null; }\n properties.push(unquote(tokens[index + 1]));\n }\n return value(tokens[1] === 'or' ? 'LogicalOr' : 'LogicalAnd', properties);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { CommandResponseSyntax, ResponseFieldSyntax } from '../Syntax/Responses';\nimport { pattern } from '../Text/patterns';\nimport { unescapeIdentifier } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseTypeRef, reportLegacyOptionalSuffix, tryParseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nexport const scalarResponsePattern = pattern('^returns\\\\s+(@?[A-Za-z_]\\\\w*)$');\nconst fieldPattern = pattern('^(@?[a-z_]\\\\w*)(?:\\\\s+([\\\\w.]+(?:\\\\[\\\\])?(?:\\\\?|\\\\s+optional)?))?\\\\s*=(?!=|>)\\\\s*(@?[a-z_]\\\\w*)$');\n\nexport function parseCommandResponse(context: ParserContext, line: SourceLine): CommandResponseSyntax | null {\n const location = locationOf(line);\n if (line.content !== 'returns') {\n const match = scalarResponsePattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidCommandResponse, \"Expected 'returns <property>' or an unconditional 'returns' block.\", location);\n context.skipBlock(line.indent);\n return null;\n }\n const child = context.peekChild(line.indent);\n if (child !== undefined) {\n context.error(DiagnosticCodes.InvalidCommandResponse, 'A scalar response cannot have child directives.', locationOf(child));\n context.skipBlock(line.indent);\n }\n // The operand capture ends the anchored match, so its offset cannot resolve inside 'returns'.\n const sourceOffset = match.index + match[0].length - match[1].length;\n return { kind: 'ScalarCommandResponseSyntax', source: { kind: 'PropertyResponseSourceSyntax', property: unescapeIdentifier(match[1]), location: { ...location, column: location.column + sourceOffset } }, location };\n }\n const fields: ResponseFieldSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const match = fieldPattern.exec(child.content);\n if (match === null) {\n const candidate = tryParseProperty({ ...child, content: child.content.split('=', 1)[0].trimEnd() });\n if (candidate?.isSubject) context.error(DiagnosticCodes.InvalidSubjectOwner, 'The subject modifier is only valid on event properties, not response fields (decision 0008: one data subject per event).', locationOf(child));\n else context.error(DiagnosticCodes.InvalidCommandResponse, \"Expected '<field> [<Type>] = <property>' in a response block.\", locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const fieldLocation = locationOf(child);\n const type = match[2] === undefined ? null : parseTypeRef(match[2], { ...fieldLocation, column: fieldLocation.column + child.content.indexOf(match[2], match[1].length) });\n if (type !== null) reportLegacyOptionalSuffix(context, type, child);\n fields.push({ kind: 'ResponseFieldSyntax', name: unescapeIdentifier(match[1]), type, source: { kind: 'PropertyResponseSourceSyntax', property: unescapeIdentifier(match[3]), location: { ...fieldLocation, column: fieldLocation.column + child.content.lastIndexOf(match[3]) } }, location: fieldLocation });\n const nested = context.peekChild(child.indent);\n if (nested !== undefined) {\n context.error(DiagnosticCodes.InvalidCommandResponse, 'A response field cannot have child directives.', locationOf(nested));\n context.skipBlock(child.indent);\n }\n }\n return { kind: 'RecordCommandResponseSyntax', fields, location };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { CommandSyntax } from '../Syntax/Commands';\n\n// Reads remain outside the narrowed TypeScript wire contract. Retain source evidence for\n// operation mapping checks without guessing that an unavailable state shape is a command field.\nexport const commandReadSources = new WeakMap<CommandSyntax, readonly { readModel: string; alias: string | null }[]>();\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ConcurrencySyntax, ReadsSyntax, ReducerRuleSyntax, ReducerSyntax } from '../Syntax/DependencySources';\nimport { dotNetWhitespace, nativePattern } from '../Text/patterns';\nimport { parseDescription } from './DescriptionParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Reference-only capture does not change the committed parser's diagnostics or opaque-block skipping.\n// Fork before reading a body: code, malformed operands and unsupported realization stay opaque.\nexport function captureReads(line: SourceLine): ReadsSyntax | undefined {\n const match = nativePattern(`^reads${dotNetWhitespace}+([A-Z]\\\\w*)(?:${dotNetWhitespace}+as${dotNetWhitespace}+([a-z_]\\\\w*))?(?:${dotNetWhitespace}+by${dotNetWhitespace}+([a-z_]\\\\w*))?$`).exec(line.content);\n if (match === null || ['as', 'by', 'reads'].includes(match[2])) return undefined;\n return { kind: 'ReadsSyntax', readModel: match[1], alias: match[2] ?? null, by: match[3] ?? null, location: locationOf(line) };\n}\n\nfunction fork(context: ParserContext): ParserContext {\n return new ParserContext(context.reader.fork(), context.path, context.languages);\n}\n\nexport function captureConcurrency(context: ParserContext, line: SourceLine): ConcurrencySyntax | undefined {\n if (line.content !== 'concurrency') return undefined;\n const body = fork(context);\n let eventSource = false;\n const dimensions: Record<string, string> = {};\n let eventTypes: string[] | undefined;\n for (let child = body.peekChild(line.indent); child !== undefined; child = body.peekChild(line.indent)) {\n body.reader.takeSignificant();\n // C# keeps walking every descendant of the header for recognized dimensions, even malformed\n // or duplicate ones. Only an unknown dimension skips its own descendants during recovery.\n switch (firstWord(child.content)) {\n case 'eventSource':\n if (child.content === 'eventSource') eventSource = true;\n break;\n case 'sourceType':\n case 'streamType':\n case 'streamId': {\n const dimension = nativePattern(`^(sourceType|streamType|streamId)${dotNetWhitespace}+([A-Za-z_]\\\\w*)$`).exec(child.content);\n if (dimension !== null) dimensions[dimension[1]] ??= dimension[2];\n break;\n }\n case 'events': {\n if (eventTypes !== undefined) break;\n const names = child.content.slice('events'.length).split(',').map(name => name.replace(new RegExp(`^${dotNetWhitespace}+|${dotNetWhitespace}+$`, 'gu'), '')).filter(Boolean);\n if (names.length > 0 && names.every(name => nativePattern('^[A-Z]\\\\w*$').test(name))) eventTypes = names;\n break;\n }\n default:\n body.skipBlock(child.indent);\n break;\n }\n }\n return { kind: 'ConcurrencySyntax', eventSource, eventSourceType: dimensions.sourceType ?? null, eventStreamType: dimensions.streamType ?? null, eventStreamId: dimensions.streamId ?? null, eventTypes: eventTypes ?? [], location: locationOf(line) };\n}\n\nexport function captureReducer(context: ParserContext, line: SourceLine): ReducerSyntax {\n const match = nativePattern(`^reducer${dotNetWhitespace}+([A-Za-z_]\\\\w*)${dotNetWhitespace}*=>${dotNetWhitespace}*([A-Za-z_]\\\\w*)$`).exec(line.content);\n const body = fork(context);\n const rules: ReducerRuleSyntax[] = [];\n for (let child = body.peekChild(line.indent); child !== undefined; child = body.peekChild(line.indent)) {\n body.reader.takeSignificant();\n if (firstWord(child.content) === 'description') {\n // Descriptions consume only their fenced text, never the following descendants. Diagnostics\n // stay on the fork, so reference capture does not change the committed parser's behavior.\n parseDescription(body, child, null, 'Reducer');\n continue;\n }\n const rule = nativePattern(`^on${dotNetWhitespace}+([A-Z]\\\\w*)$`).exec(child.content);\n if (rule !== null) rules.push({ kind: 'ReducerRuleSyntax', event: rule[1], file: null, code: null, description: null, location: locationOf(child) });\n body.skipOpaqueBlock(child.indent);\n }\n return { kind: 'ReducerSyntax', name: match?.[1] ?? '', readModel: match?.[2] ?? '', rules, description: null, location: locationOf(line) };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ConditionSyntax } from '../Syntax/Conditions';\nimport { parseCondition } from './ConditionParser';\nimport { PropertySyntax, TagSyntax } from '../Syntax/Declarations';\nimport { ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { ProducesSyntax } from '../Syntax/Reactions';\nimport { pattern } from '../Text/patterns';\nimport { parseTag } from './DeclarationParsers';\nimport { EventMetadataParser } from './EventMetadataParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { firstWord, unescapeIdentifier } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseOperation } from './OperationParser';\nimport { parseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst inlineOperationPrefix = pattern('^produces\\\\s+operation(?:\\\\s|$)');\nconst inlineHeader = pattern('^produces\\\\s+event\\\\s+([A-Za-z_]\\\\w*)(?:\\\\s+(generation)(?:\\\\s+.*)?)?$');\nconst plainHeader = pattern('^produces\\\\s+([A-Z]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)$');\nconst conditional = pattern('^produces\\\\s+when\\\\s+(.+)$');\nconst eventName = pattern('^[A-Z]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*$');\nconst targetPattern = pattern('^for\\\\s+(\\\\S.*)$');\nconst mappingPattern = pattern('^(@?[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst typedMappingPattern = pattern('^(.+?)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst reserved = new Set(['namespace', 'sequence', 'correlation', 'causation', 'causedBy', 'occurred']);\n\nexport function parseProduces(context: ParserContext, header: SourceLine, inCommand = false): ProducesSyntax | undefined {\n if (inlineOperationPrefix.test(header.content)) {\n if (!inCommand) {\n context.error(DiagnosticCodes.OperationOutsideCommand, 'Operations can only be produced by commands.', locationOf(header));\n context.skipOpaqueBlock(header.indent);\n return undefined;\n }\n const parsed = parseOperation(context, header, true);\n return { kind: 'ProducesSyntax', when: null, event: parsed.operation.name, targetLocation: { ...locationOf(header), column: header.indent + header.content.match(/^produces\\s+operation(?:\\s+|$)/)![0].length + 1 }, inlineEvent: null, inlineOperation: parsed.operation, mappings: parsed.mappings, for: null, tags: [], location: locationOf(header) };\n }\n const inline = inlineHeader.exec(header.content);\n let parent = header;\n let when: ConditionSyntax | null = null;\n let name: string;\n let targetColumn: number;\n if (inline !== null) {\n if (!inCommand) {\n context.error(DiagnosticCodes.InlineEventOutsideCommand, 'Inline events can only be declared inside commands', locationOf(header));\n context.skipOpaqueBlock(header.indent);\n return undefined;\n }\n if (inline[2] !== undefined) {\n context.error(DiagnosticCodes.InlineEventGeneration, 'Inline events are generation 1 - extract the event before declaring generations', locationOf(header));\n }\n name = inline[1];\n targetColumn = header.indent + header.content.match(/^produces\\s+event\\s+/)![0].length + 1;\n } else if (conditional.test(header.content)) {\n when = parseCondition(context, conditional.exec(header.content)![1], locationOf(header));\n const child = context.peekChild(header.indent);\n if (child === undefined || !eventName.test(child.content)) {\n context.error(DiagnosticCodes.ProducesWhenWithoutEvent, \"Expected an event name on the line after 'produces when'\", locationOf(header));\n context.skipOpaqueBlock(header.indent);\n return undefined;\n }\n context.reader.takeSignificant();\n parent = child;\n name = child.content;\n targetColumn = child.indent + 1;\n } else {\n const plain = plainHeader.exec(header.content);\n if (plain === null) {\n context.error(DiagnosticCodes.InvalidProducesDeclaration, `Invalid produces declaration '${header.content}' - expected 'produces <EventType>' or 'produces when <condition>'`, locationOf(header));\n context.skipOpaqueBlock(header.indent);\n return undefined;\n }\n name = plain[1];\n targetColumn = header.indent + header.content.match(/^produces\\s+/)![0].length + 1;\n }\n const properties: PropertySyntax[] = [];\n const propertyNames = new Set<string>();\n const mappings: PropertyMappingSyntax[] = [];\n const tags: TagSyntax[] = [];\n const metadata = new EventMetadataParser(name);\n let target: ExpressionSyntax | null = null;\n for (let line = context.peekChild(parent.indent); line !== undefined; line = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(line.content);\n const location = locationOf(line);\n if (reserved.has(keyword)) {\n context.error(DiagnosticCodes.ReservedProductionMetadata, `'${keyword}' is system-assigned production metadata and cannot be supplied here`, location);\n context.skipOpaqueBlock(line.indent);\n continue;\n }\n if (inline !== null && (keyword === 'generation' || keyword === 'origin')) {\n context.error(keyword === 'generation' ? DiagnosticCodes.InlineEventGeneration : DiagnosticCodes.ReservedProductionMetadata,\n keyword === 'generation' ? 'Inline events are generation 1 - extract the event before declaring generations' : 'An inline event is local to its command and cannot declare origin', location);\n context.skipOpaqueBlock(line.indent);\n continue;\n }\n if (keyword === 'tag') {\n const tag = parseTag(context, line, false);\n if (tag !== undefined) tags.push(tag);\n continue;\n }\n const forMatch = targetPattern.exec(line.content);\n if (forMatch !== null) {\n if (target !== null) {\n context.error(DiagnosticCodes.DuplicateProducesTarget, `'${parent.content}' already declares where it lands - an event is appended to one event source`, location);\n } else {\n target = parseMappingSource(forMatch[1], location, context);\n }\n continue;\n }\n const match = (inline === null ? mappingPattern : typedMappingPattern).exec(line.content);\n let property = match === null || inline === null ? undefined : parseProperty(context, { ...line, content: match[1].trimEnd() });\n if (match !== null && (inline === null || property !== undefined)) {\n if (property !== undefined) {\n if (property.isIdentifier) {\n context.error(DiagnosticCodes.IdentifierOnEventProperty, `Property '${property.name}' of event '${name}' cannot be marked identifier - an event never carries its event source id`, location);\n property = { ...property, isIdentifier: false };\n }\n const propertyName = property.name;\n if (propertyNames.has(propertyName)) {\n context.error(DiagnosticCodes.DuplicateDeclaration, `Event '${name}' already declares property '${property.name}'`, location);\n }\n propertyNames.add(propertyName);\n properties.push(property);\n }\n mappings.push({ kind: 'PropertyMappingSyntax', property: property?.name ?? unescapeIdentifier(match[1]), source: parseMappingSource(match[2], { ...location, column: line.indent + line.content.length - match[2].length + 1 }, context), location });\n } else if (inline === null || !metadata.tryParse(context, line)) {\n context.error(DiagnosticCodes.InvalidPropertyMapping, `Invalid ${inline === null ? '' : 'inline '}property mapping '${line.content}' - expected '<property>${inline === null ? '' : ' <Type>'} = <source>'`, location);\n }\n }\n if (parent !== header) context.skipBlock(header.indent);\n return {\n kind: 'ProducesSyntax', when, event: name, targetLocation: { ...locationOf(parent), column: targetColumn }, inlineOperation: null, mappings, for: target, tags: inline === null ? tags : [], location: locationOf(header),\n inlineEvent: inline === null ? null : { kind: 'EventSyntax', name, properties, tags, generation: 1, hasGenerationMarker: false, ...metadata.value, location: locationOf(header) },\n };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { RequirementSyntax } from '../Syntax/Conditions';\nimport { parseCondition } from './ConditionParser';\nimport { AuthorizeSyntax } from '../Syntax/Authorization';\nimport { CommandSyntax, ValidateSyntax, ValidationRuleKind, ValidationRuleSyntax, ValidationSeverity } from '../Syntax/Commands';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { CommandStreamSyntax } from '../Syntax/EventSources';\nimport { parseCommandStream } from './EventSourceParser';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { ProducesSyntax } from '../Syntax/Reactions';\nimport { CommandResponseSyntax } from '../Syntax/Responses';\nimport { pattern } from '../Text/patterns';\nimport { sourceStreamPattern } from '../Text/SourceStreamNames';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { combineAuthorize, parseAuthorize } from './AuthorizeParser';\nimport { parseCommandResponse, scalarResponsePattern } from './CommandResponseParser';\nimport { parseDescription } from './DescriptionParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { isCode, isFile, parseCode, parseFile, parseHandler, parseImplementationWrapper } from './ImplementationParser';\nimport { CodeBlockSyntax, FileReferenceSyntax, HandlerSyntax, ImplementationSyntax } from '../Syntax/Implementations';\nimport { parseMappingSource } from './ExpressionParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { commandReadSources } from './CommandReadSources';\nimport { dependencySources, ReadsSyntax, ConcurrencySyntax } from '../Syntax/DependencySources';\nimport { captureReads, captureConcurrency } from './DependencySourceParser';\nimport { parseProduces } from './ProducesParser';\nimport { reportInvalidModifierOrder, reportLegacyOptionalSuffix, tryParseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = pattern('^command\\\\s+([A-Za-z_]\\\\w*)$');\nconst routeHeader = sourceStreamPattern('^stream\\\\s+[A-Za-z_]\\\\w*\\\\.[A-Za-z_]\\\\w*$');\nconst severityPattern = pattern('\\\\bseverity\\\\s+(\\\\S+)$');\nconst messagePattern = pattern(`\\\\bmessage\\\\s+(?:\"(${stringBodyPattern})\"|(\\\\$strings\\\\.\\\\S*))$`);\nconst rulePattern = pattern('^([\\\\w.]+)\\\\s+(.+)$');\nconst operandPattern = pattern('^(not empty|length ==|all >=|all >|matches|max|min|rule|>=|<=|==|!=|>|<)\\\\s*(.*)$');\nconst ruleNamePattern = sourceStreamPattern('^[A-Za-z_]\\\\w*$');\nconst optionalReads = pattern('^reads\\\\s+[A-Z]\\\\w*\\\\s+optional(?:\\\\s|$)');\n\n// Every operand the pattern matches has a kind, so an operand never goes unrecognized here.\nconst operandKinds: Record<string, ValidationRuleKind> = {\n max: 'Max',\n min: 'Min',\n '>': 'GreaterThan',\n '>=': 'GreaterThanOrEqual',\n '<': 'LessThan',\n '<=': 'LessThanOrEqual',\n '==': 'Equal',\n '!=': 'NotEqual',\n 'length ==': 'Length',\n matches: 'Matches',\n 'all >': 'AllGreaterThan',\n 'all >=': 'AllGreaterThanOrEqual',\n};\n\nconst severities: Record<string, ValidationSeverity> = { information: 'Information', warning: 'Warning', error: 'Error' };\n\n// Command directives this compiler does not model. They are skipped whole.\nconst opaqueDirectives = new Set(['reads', 'concurrency']);\n\n// The bare directives cannot take a type reference, so a line with property shape is a property whatever\n// keyword it starts with - 'description String' declares a property called description.\nconst propertyShapedDirectives = new Set(['description', 'documentation', 'handler', 'concurrency']);\n\nexport function parseCommand(context: ParserContext, line: SourceLine): CommandSyntax {\n // Properties are leaves, not indentation owners. Resolve ambiguous returns spelling\n // before the committed pass decides whether its deeper lines belong to a response.\n const names = new Set<string>();\n const lookahead = new ParserContext(context.reader.fork(), context.path, context.languages);\n lookahead.sourceOptions = context.sourceOptions;\n lookahead.streamCandidates = context.streamCandidates;\n parseCommandBody(lookahead, line, undefined, names);\n return parseCommandBody(context, line, names);\n}\n\nfunction parseCommandBody(context: ParserContext, line: SourceLine, responseNames?: ReadonlySet<string>, discoveredNames?: Set<string>): CommandSyntax {\n const name = header.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidCommandDeclaration, `Invalid command declaration '${line.content}' - expected 'command <Name>'`, locationOf(line));\n }\n const properties: PropertySyntax[] = [];\n const responses: { line: SourceLine; candidate: PropertySyntax | null; response: CommandResponseSyntax | null }[] = [];\n let identifier: PropertySyntax | undefined;\n const validations: ValidateSyntax[] = [];\n const produces: ProducesSyntax[] = [];\n const reads: { readModel: string; alias: string | null }[] = [];\n const referenceReads: ReadsSyntax[] = [];\n let concurrency: ConcurrencySyntax | undefined;\n let description: string | null = null;\n let documentation: string | null = null;\n let authorize: AuthorizeSyntax | null = null;\n let handler: HandlerSyntax | null = null;\n let stream: CommandStreamSyntax | null = null;\n const streamCandidates: CommandStreamSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n const asProperty = tryParseProperty(child);\n if (asProperty !== undefined && (propertyShapedDirectives.has(keyword) || (keyword === 'validate' && child.content !== 'validate csharp'))) {\n identifier = addProperty(context, properties, asProperty, name, child, identifier);\n } else if (keyword === 'returns') {\n const scalar = scalarResponsePattern.exec(child.content);\n if (scalar !== null && !scalar[1].startsWith('@') && asProperty !== undefined) {\n if (responseNames === undefined) {\n properties.push(asProperty);\n responses.push({ line: child, candidate: asProperty, response: null });\n } else if (responseNames.has(asProperty.type.name)) {\n responses.push({ line: child, candidate: null, response: parseCommandResponse(context, child) });\n } else {\n identifier = addProperty(context, properties, asProperty, name, child, identifier);\n }\n } else if (asProperty !== undefined) {\n identifier = addProperty(context, properties, asProperty, name, child, identifier);\n } else if (reportInvalidModifierOrder(context, child)) {\n context.skipBlock(child.indent);\n } else {\n responses.push({ line: child, candidate: null, response: parseCommandResponse(context, child) });\n }\n } else if (keyword === 'stream' && routeHeader.test(child.content) && asProperty !== undefined && context.streamCandidates?.hasSource(asProperty.type.name.split('.')[0]) === true) {\n const [source, streamName] = asProperty.type.name.split('.');\n const ambiguous = context.streamCandidates.hasPropertyType(asProperty.type.name) && context.streamCandidates.hasUniqueStream(source, streamName);\n const route = parseCommandStream(context, child, asProperty, ambiguous);\n if (stream !== null || streamCandidates.length > 0) context.error(DiagnosticCodes.InvalidCommandStream, 'A command declares at most one stream route.', locationOf(child));\n if (ambiguous || stream !== null) streamCandidates.push(route);\n else stream = route;\n } else if (keyword === 'description') {\n description = parseDescription(context, child, description, `Command '${name}'`);\n } else if (keyword === 'documentation') {\n documentation = parseDocumentation(context, child, documentation, `Command '${name}'`);\n } else if (keyword === 'authorize') {\n authorize = combineAuthorize(authorize, parseAuthorize(context, child));\n } else if (keyword === 'validate') {\n const validate = parseValidate(context, child, 'command');\n if (validate !== undefined) {\n validations.push(validate);\n }\n } else if (keyword === 'produces') {\n const production = parseProduces(context, child, true);\n if (production !== undefined) produces.push(production);\n } else if (keyword === 'handler') {\n handler = parseHandler(context, child);\n } else if (opaqueDirectives.has(keyword)) {\n const reference = captureReads(child);\n if (reference !== undefined) referenceReads.push(reference);\n if (keyword === 'concurrency' && concurrency === undefined) concurrency = captureConcurrency(context, child);\n const read = /^reads\\s+([A-Z]\\w*)(?:\\s+as\\s+([a-z_]\\w*))?(?:\\s+by\\s+([a-z_]\\w*))?$/.exec(child.content);\n if (read !== null) reads.push({ readModel: read[1], alias: read[2] ?? null });\n if (optionalReads.test(child.content)) {\n context.error(DiagnosticCodes.OptionalReadsNotSupported, 'Optional reads are not yet supported (see #308).', locationOf(child));\n }\n context.skipOpaqueBlock(child.indent);\n } else if (asProperty !== undefined) {\n identifier = addProperty(context, properties, asProperty, name, child, identifier);\n } else {\n reportInvalidModifierOrder(context, child);\n context.error(DiagnosticCodes.UnknownCommandDirective, `Unexpected '${child.content}' in command body`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n const candidates = new Set(responses.flatMap(entry => entry.candidate === null ? [] : [entry.candidate]));\n const names = new Set(properties.filter(property => !candidates.has(property)).map(property => property.name));\n if (responses.some(entry => entry.candidate !== null && !names.has(entry.candidate.type.name) && entry.candidate.type.name !== 'returns')) names.add('returns');\n for (const name of names) discoveredNames?.add(name);\n let response: CommandResponseSyntax | null = null;\n const removed = new Set<PropertySyntax>();\n for (const entry of responses) {\n let parsed = entry.response;\n if (entry.candidate !== null) {\n if (!names.has(entry.candidate.type.name)) continue;\n removed.add(entry.candidate);\n parsed = { kind: 'ScalarCommandResponseSyntax', source: { kind: 'PropertyResponseSourceSyntax', property: entry.candidate.type.name, location: entry.candidate.type.location }, location: locationOf(entry.line) };\n }\n if (parsed === null) continue;\n if (response !== null) {\n context.error(DiagnosticCodes.InvalidCommandResponse, 'A command declares at most one unconditional response.', locationOf(entry.line));\n } else {\n response = parsed;\n }\n }\n if (handler !== null && produces.length > 0) {\n context.error(DiagnosticCodes.CommandWithProducesAndHandler, `Command '${name}' cannot declare both 'produces' and 'handler'`, locationOf(line));\n }\n const syntax: CommandSyntax = { kind: 'CommandSyntax', name, description, documentation, authorize, properties: properties.filter(property => !removed.has(property)), validations, produces, handler, response, stream, streamCandidates, location: locationOf(line) };\n commandReadSources.set(syntax, reads);\n dependencySources.set(syntax, { reads: referenceReads, concurrency });\n return syntax;\n}\n\nfunction addProperty(context: ParserContext, properties: PropertySyntax[], property: PropertySyntax, commandName: string, line: SourceLine, identifier: PropertySyntax | undefined): PropertySyntax | undefined {\n reportLegacyOptionalSuffix(context, property.type, line);\n if (property.isIdentifier && identifier !== undefined) {\n context.error(DiagnosticCodes.DuplicateCommandIdentifier, `Command '${commandName}' already marks '${identifier.name}' as identifier - only one property can be the identifier`, property.location);\n property = { ...property, isIdentifier: false };\n }\n properties.push(property);\n return identifier ?? (property.isIdentifier ? property : undefined);\n}\n\n// Reads a 'validate' block: declarative rules, or code - which is recognized but not modeled.\nexport function parseValidate(context: ParserContext, line: SourceLine, owner: 'command' | 'concept'): ValidateSyntax | undefined {\n if (line.content === 'validate') {\n const fence = context.peekChild(line.indent);\n if (fence !== undefined && fence.content.startsWith('```')) {\n context.reader.takeSignificant();\n const code = parseCode(context.valueContext, fence);\n if (code === null) context.skipFencedBody();\n return { kind: 'CodeValidateSyntax', code, location: locationOf(line) };\n }\n const rules: ValidationRuleSyntax[] = [];\n const requirements: RequirementSyntax[] = [];\n let wrapperIndent: number | undefined;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (owner === 'concept') {\n if (context.sourceOptions.numericMode === 'legacy' && child.content.startsWith('```')) { context.skipFencedBody(); continue; }\n if (wrapperIndent !== undefined && child.indent <= wrapperIndent) wrapperIndent = undefined;\n if (wrapperIndent !== undefined || firstWord(child.content) === 'implementation') {\n context.error(DiagnosticCodes.InvalidValidationRule, `Invalid validation rule '${child.content}'`, locationOf(child));\n wrapperIndent ??= child.indent;\n continue;\n }\n }\n if (firstWord(child.content) === 'require') {\n const condition = parseCondition(owner === 'concept' ? context.valueContext : context, child.content.substring('require'.length).trim(), locationOf(child));\n let message: string | null = null;\n let severity: ValidationSeverity = 'Error';\n let hasSeverity = false;\n for (let directive = context.peekChild(child.indent); directive !== undefined; directive = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n const matched = messagePattern.exec(directive.content);\n if (matched !== null && matched.index === 0) message = matched[1] !== undefined ? unescapeString(matched[1]) : matched[2];\n else if (firstWord(directive.content) === 'severity') {\n if (!hasSeverity) severity = severities[directive.content.substring('severity'.length).trim()] ?? 'Error';\n hasSeverity = true;\n } else context.skipOpaqueBlock(directive.indent);\n }\n if (condition !== null) requirements.push({ kind: 'RequirementSyntax', condition, message, severity, location: locationOf(child) });\n continue;\n }\n const rule = parseValidationRule(context, owner === 'concept' ? { ...child, content: `value ${child.content}` } : child, owner);\n if (rule !== undefined) {\n rules.push(rule);\n }\n }\n return { kind: 'DeclarativeValidateSyntax', rules, requirements, location: locationOf(line) };\n }\n if (line.content === 'validate csharp') {\n const code = parseCode(context.valueContext, { ...line, content: 'csharp' });\n if (code === null) context.skipOpaqueBlock(line.indent);\n return { kind: 'CodeValidateSyntax', code, location: locationOf(line) };\n }\n context.error(DiagnosticCodes.InvalidValidateDeclaration, `Invalid validate declaration '${line.content}' - expected 'validate' or 'validate csharp'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n}\n\nfunction parseValidationRule(context: ParserContext, line: SourceLine, owner: 'command' | 'concept'): ValidationRuleSyntax | undefined {\n const valueContext = owner === 'concept' ? context.valueContext : context;\n const { content: withSeverity, message } = splitMessage(line.content);\n const severity = splitSeverity(valueContext, line, withSeverity);\n if (severity === undefined) {\n return undefined;\n }\n const match = rulePattern.exec(severity.content);\n if (match === null) {\n valueContext.error(DiagnosticCodes.InvalidValidationRule, `Invalid validation rule '${line.content}'`, locationOf(line));\n return undefined;\n }\n const parsed = parseRule(valueContext, match[2], line);\n if (parsed === undefined) {\n return undefined;\n }\n const source = parsed.kind === 'Rule' ? parseRuleImplementation(context, line, owner === 'command') : { file: null, code: null, implementation: null };\n return {\n kind: 'ValidationRuleSyntax',\n property: match[1],\n rule: parsed.kind,\n value: parsed.value,\n message,\n severity: severity.severity,\n ...source,\n location: locationOf(line),\n };\n}\n\nfunction parseRuleImplementation(context: ParserContext, rule: SourceLine, commandOwner: boolean): { file: FileReferenceSyntax | null; code: CodeBlockSyntax | null; implementation: ImplementationSyntax | null } {\n const body = context.peekChild(rule.indent);\n if (body === undefined) return { file: null, code: null, implementation: null };\n context.reader.takeSignificant();\n const wrapped = commandOwner && firstWord(body.content) === 'implementation';\n const source = wrapped ? parseImplementationWrapper(context, body) : {\n file: isFile(body) ? parseFile(context, body) : null,\n code: !isFile(body) && isCode(context, body) ? parseCode(context, body) : null,\n implementation: null,\n };\n if (!wrapped && source.file === null && source.code === null) {\n context.error(DiagnosticCodes.UnknownRuleImplementationDirective, `Unexpected '${body.content}' in rule implementation - expected 'file <path>' or an inline code block`, locationOf(body));\n context.skipBlock(body.indent);\n }\n for (let extra = context.peekChild(rule.indent); extra !== undefined && (wrapped || (commandOwner && firstWord(extra.content) === 'implementation')); extra = context.peekChild(rule.indent)) {\n context.reader.takeSignificant();\n context.error(wrapped && firstWord(extra.content) === 'implementation' ? DiagnosticCodes.InvalidImplementationBlock : DiagnosticCodes.ConflictingImplementationSources,\n 'A named rule has one implementation wrapper and cannot mix wrapped and direct sources.', locationOf(extra));\n if (isCode(context, extra)) parseCode(context, extra);\n else context.skipBlock(extra.indent);\n }\n return source;\n}\n\nfunction splitMessage(content: string): { content: string; message: string | null } {\n const match = messagePattern.exec(content);\n if (match === null) {\n return { content, message: null };\n }\n const message = match[1] !== undefined ? unescapeString(match[1]) : match[2];\n return { content: content.substring(0, match.index).trimEnd(), message };\n}\n\nfunction splitSeverity(context: ParserContext, line: SourceLine, text: string): { content: string; severity: ValidationSeverity } | undefined {\n const match = severityPattern.exec(text);\n if (match === null) {\n return { content: text, severity: 'Error' };\n }\n const severity = severities[match[1]];\n if (severity === undefined) {\n context.error(DiagnosticCodes.InvalidValidationSeverity, `Unknown validation severity '${match[1]}' - expected information, warning or error`, locationOf(line));\n return undefined;\n }\n return { content: text.substring(0, match.index).trimEnd(), severity };\n}\n\nfunction parseRule(context: ParserContext, rule: string, line: SourceLine): { kind: ValidationRuleKind; value: ExpressionSyntax | null } | undefined {\n if (rule === 'not empty') {\n return { kind: 'NotEmpty', value: null };\n }\n const operand = operandPattern.exec(rule);\n if (operand === null) {\n context.error(DiagnosticCodes.InvalidValidationRule, `Invalid validation rule '${line.content}'`, locationOf(line));\n return undefined;\n }\n if (operand[1] === 'rule') {\n const name = operand[2].trim();\n if (!ruleNamePattern.test(name)) {\n context.error(DiagnosticCodes.InvalidRuleName, `Invalid rule name '${name}' in '${line.content}' - expected 'rule <Name>' with an identifier`, locationOf(line));\n return undefined;\n }\n return { kind: 'Rule', value: { kind: 'PathExpressionSyntax', path: name, location: locationOf(line) } };\n }\n return { kind: operandKinds[operand[1]], value: parseMappingSource(operand[2], locationOf(line), context) };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ConstraintSyntax } from '../Syntax/Constraints';\nimport { pattern } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { isFileDirective } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { parseDescription } from './DescriptionParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = pattern('^constraint\\\\s+([A-Za-z_]\\\\w*)$');\nconst uniqueEventPattern = pattern('^unique\\\\s+event\\\\s+([A-Z]\\\\w*)$');\nconst uniquePropertyPattern = pattern('^unique\\\\s+([a-z_][\\\\w.]*(?:\\\\s*,\\\\s*[a-z_][\\\\w.]*)*)\\\\s+on\\\\s+([A-Z]\\\\w*)$');\nconst releasePattern = pattern('^released\\\\s+by\\\\s+([A-Z]\\\\w*)$');\nconst messagePattern = pattern(`^message\\\\s+\"(${stringBodyPattern})\"$`);\n\nconst targetOf = (rule: ConstraintSyntax): string | undefined => rule.kind === 'FileConstraintSyntax' ? undefined : rule.event;\n\n// The port of the C# ConstraintParser: the first rule is the constraint, any further rules of the same kind\n// are its additional rules.\nexport function parseConstraint(context: ParserContext, line: SourceLine): ConstraintSyntax {\n const headerMatch = header.exec(line.content);\n if (headerMatch === null) {\n context.error(DiagnosticCodes.InvalidConstraintDeclaration, `Invalid constraint declaration '${line.content}' - expected 'constraint <Name>'`, locationOf(line));\n }\n const name = headerMatch?.[1] ?? firstWord(line.content);\n const rules: ConstraintSyntax[] = [];\n const releases: string[] = [];\n const releasedEvents = new Set<string>();\n const targets = new Set<string>();\n let message: string | null = null;\n let description: string | null = null;\n let ignoreCasing = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'description') {\n description = parseDescription(context, child, description, `Constraint '${name}'`);\n continue;\n }\n const release = releasePattern.exec(child.content);\n const text = messagePattern.exec(child.content);\n if (release !== null) {\n if (releasedEvents.has(release[1])) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' already releases with event '${release[1]}'`, locationOf(child));\n } else {\n releases.push(release[1]);\n releasedEvents.add(release[1]);\n }\n } else if (text !== null) {\n if (message !== null) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' already has a message`, locationOf(child));\n } else {\n message = unescapeString(text[1]);\n }\n } else if (child.content === 'ignore casing') {\n if (ignoreCasing) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' already ignores casing`, locationOf(child));\n }\n ignoreCasing = true;\n } else {\n addRule(context, name, child, rules, targets);\n }\n }\n for (const release of releases.filter(release => targets.has(release))) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' cannot target and release event '${release}'`, locationOf(line));\n }\n if (rules.length === 0) {\n context.error(DiagnosticCodes.ConstraintWithoutRule, `Constraint '${name}' must declare 'unique ... on ...', 'unique event ...' or 'file ...'`, locationOf(line));\n rules.push(rule(name, locationOf(line), { kind: 'UniqueEventConstraintSyntax', event: '' }));\n }\n if (rules[0].kind === 'FileConstraintSyntax' && (releases.length > 0 || message !== null || ignoreCasing)) {\n context.error(DiagnosticCodes.InvalidConstraintBody, `File constraint '${name}' cannot have declarative options`, locationOf(line));\n }\n return { ...rules[0], additionalRules: rules.slice(1), releasedBy: releases, message, ignoreCasing, description };\n}\n\nfunction addRule(context: ParserContext, name: string, line: SourceLine, rules: ConstraintSyntax[], targets: Set<string>): void {\n const parsed = parseRule(context, name, line);\n if (parsed === undefined) {\n return;\n }\n if (rules.length > 0 && (parsed.kind === 'FileConstraintSyntax' || rules[0].kind === 'FileConstraintSyntax' ||\n (parsed.kind === 'UniqueEventConstraintSyntax') !== (rules[0].kind === 'UniqueEventConstraintSyntax'))) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' cannot mix constraint kinds`, locationOf(line));\n return;\n }\n const target = targetOf(parsed);\n if (target !== undefined && targets.has(target)) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' already targets event '${target}'`, locationOf(line));\n return;\n }\n if (target !== undefined) targets.add(target);\n rules.push(parsed);\n}\n\nfunction parseRule(context: ParserContext, name: string, line: SourceLine): ConstraintSyntax | undefined {\n const location = locationOf(line);\n const uniqueEvent = uniqueEventPattern.exec(line.content);\n if (uniqueEvent !== null) {\n return rule(name, location, { kind: 'UniqueEventConstraintSyntax', event: uniqueEvent[1] });\n }\n const uniqueProperty = uniquePropertyPattern.exec(line.content);\n if (uniqueProperty !== null) {\n const properties = uniqueProperty[1].split(',').map(property => property.trim());\n if (new Set(properties).size !== properties.length) {\n context.error(DiagnosticCodes.DuplicateConstraintBody, `Constraint '${name}' repeats a property in its composite key`, location);\n return undefined;\n }\n return rule(name, location, { kind: 'UniquePropertyConstraintSyntax', property: properties[0], additionalProperties: properties.slice(1), event: uniqueProperty[2] });\n }\n if (isFileDirective(line)) {\n context.warning(DiagnosticCodes.FileConstraintOnlySupportsUniqueness, 'A file constraint can only declare unique constraints in Chronicle - declare them with \\'unique ...\\' so they are portable; a rule that is not uniqueness belongs in command validation or a \\'require\\' condition', location);\n const path = line.content.substring('file'.length).trim();\n return rule(name, location, { kind: 'FileConstraintSyntax', file: { kind: 'FileReferenceSyntax', path, location } });\n }\n context.error(DiagnosticCodes.InvalidConstraintBody, `Invalid constraint body '${line.content}'`, location);\n return undefined;\n}\n\ntype RuleShape =\n | { kind: 'UniqueEventConstraintSyntax'; event: string }\n | { kind: 'UniquePropertyConstraintSyntax'; property: string; additionalProperties: string[]; event: string }\n | { kind: 'FileConstraintSyntax'; file: { kind: 'FileReferenceSyntax'; path: string; location: ReturnType<typeof locationOf> } };\n\nfunction rule(name: string, location: ReturnType<typeof locationOf>, shape: RuleShape): ConstraintSyntax {\n return { ...shape, name, additionalRules: [], releasedBy: [], ignoreCasing: false, message: null, location } as ConstraintSyntax;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport {\n AutoMapMode, ChildrenSyntax, ClearWithSyntax, EventSpecSyntax, FromSyntax, JoinEventSyntax, JoinSyntax, MappingKind, MappingSyntax, NestedSyntax,\n KeyPartSyntax, KeySyntax, ProjectionBlockSyntax, ProjectionEntersOnSyntax, ProjectionSyntax, ProjectionVariantSyntax,\n} from '../Syntax/Projections';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { pattern } from '../Text/patterns';\nimport { parseProjectionExpression } from './ProjectionExpressionParser';\nimport { isFileDirective } from './FileReferences';\nimport { parseDescription } from './DescriptionParser';\nimport { firstWord, splitTopLevel, unescapeIdentifier } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = pattern('^projection\\\\s+(@?[\\\\w.]+)\\\\s*(?:=>\\\\s*([\\\\w.]+))?$');\nconst eventSpecPattern = pattern('^(@?[\\\\w.]+)(?:\\\\s+key\\\\s+(.+))?$');\nconst joinPattern = pattern('^join\\\\s+(@?[\\\\w.]+)\\\\s+on\\\\s+(@?[\\\\w.]+)$');\nconst withPattern = pattern('^with\\\\s+(@?[\\\\w.]+)$');\nconst childrenPattern = pattern('^children\\\\s+(@?[\\\\w.]+)\\\\s+identified\\\\s+by\\\\s+(.+)$');\nconst nestedPattern = pattern('^nested\\\\s+(@?[\\\\w.]+)$');\nconst removeWithPattern = pattern('^remove\\\\s+with\\\\s+(@?[\\\\w.]+)(?:\\\\s+key\\\\s+(.+))?$');\nconst removeViaJoinPattern = pattern('^remove\\\\s+via\\\\s+join\\\\s+on\\\\s+(@?[\\\\w.]+)(?:\\\\s+key\\\\s+(.+))?$');\nconst clearWithPattern = pattern('^clear\\\\s+with\\\\s+(@?[\\\\w.]+)$');\nconst variantPattern = pattern('^variant\\\\s+(@?[\\\\w.]+)\\\\s*$');\nconst entersOnPattern = pattern('^enters\\\\s+on\\\\s+(@?[\\\\w.]+)(?:\\\\s+key\\\\s+(.+))?$');\nconst keywordMappingPattern = pattern('^(increment|decrement|count|clear)\\\\s+(@?[$\\\\w.]+)$');\nconst arithmeticPattern = pattern('^(add|subtract)\\\\s+(@?[$\\\\w.]+)\\\\s+by\\\\s+(.+)$');\nconst setPattern = pattern('^set\\\\s+(@?[$\\\\w.]+)\\\\s+(?:=|to)\\\\s+(.+)$');\nconst assignmentPattern = pattern('^(@?[$\\\\w.@]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst keywordMappings: Record<string, MappingKind> = {\n increment: 'IncrementMappingSyntax',\n decrement: 'DecrementMappingSyntax',\n clear: 'ClearMappingSyntax',\n count: 'CountMappingSyntax',\n};\n\n// Reads a projection's structure: its name, the read model it builds, the events each block consumes, the\n// properties each mapping sets and where automap is turned on or off. Keys, and where a mapping takes its\n// value from, are recognized and skipped.\nexport function parseProjection(context: ParserContext, line: SourceLine): ProjectionSyntax {\n const match = header.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidProjectionDeclaration, `Invalid projection declaration '${line.content}' - expected 'projection <Name> [=> <ReadModel>]'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'ProjectionSyntax', sourceOptions: context.sourceOptions, name: firstWord(line.content), readModel: null, sequence: null, autoMap: 'Inherit', blocks: [], location: locationOf(line) };\n }\n const name = match[1];\n let sequence: string | null = null;\n let description: string | null = null;\n let autoMap: AutoMapMode = 'Inherit';\n let key: KeySyntax | null = null;\n const blocks: ProjectionBlockSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (isFileDirective(child)) {\n continue;\n }\n const keyword = firstWord(child.content);\n if (keyword === 'description') {\n description = parseDescription(context, child, description, `Projection '${name}'`);\n } else if (keyword === 'sequence') {\n sequence = child.content.substring('sequence'.length).trim();\n } else if (keyword === 'automap') {\n autoMap = 'Enabled';\n } else if (child.content === 'no automap') {\n autoMap = 'Disabled';\n } else if (keyword === 'key') {\n key = parseKey(context, child);\n } else if (keyword === 'variant') {\n blocks.push(parseVariant(context, child));\n } else {\n const block = parseBlock(context, child, false);\n if (block !== undefined) {\n blocks.push(block);\n }\n }\n }\n reportVariantConflicts(context, blocks, name);\n if (blocks.length === 0) {\n context.error(DiagnosticCodes.EmptyProjection, `Projection '${name}' must contain at least one directive`, locationOf(line));\n }\n return { kind: 'ProjectionSyntax', sourceOptions: context.sourceOptions, name, readModel: match[2] ?? null, sequence, autoMap, key, blocks, description, location: locationOf(line) };\n}\n\nfunction reportVariantConflicts(context: ParserContext, blocks: readonly ProjectionBlockSyntax[], name: string): void {\n // Grouped by name in the order each name first appears, as the C# parser reports them.\n const variants = blocks.filter((block): block is ProjectionVariantSyntax => block.kind === 'ProjectionVariantSyntax');\n const byName = new Map<string, ProjectionVariantSyntax[]>();\n variants.forEach(variant => byName.set(variant.name, [...(byName.get(variant.name) ?? []), variant]));\n for (const duplicate of [...byName.values()].flatMap(group => group.slice(1))) {\n context.error(DiagnosticCodes.DuplicateProjectionVariant, `Duplicate variant '${duplicate.name}' - a variant name is declared once`, duplicate.location);\n }\n const entering = new Set<string>();\n for (const entry of blocks.flatMap(block => block.kind === 'ProjectionVariantSyntax' ? block.entersOn : [])) {\n if (entry.event.length > 0 && entering.has(entry.event)) {\n context.error(DiagnosticCodes.DuplicateVariantEnteringEvent, `Entering event '${entry.event}' is claimed more than once in projection '${name}'`, entry.location);\n }\n entering.add(entry.event);\n }\n}\n\nfunction parseBlock(context: ParserContext, line: SourceLine, nestedScope: boolean): ProjectionBlockSyntax | undefined {\n const location = locationOf(line);\n switch (firstWord(line.content)) {\n case 'from':\n return parseFrom(context, line);\n case 'every': {\n let includeChildren = true;\n const { autoMap, mappings } = parseMappingBlock(context, line, child => {\n if (child.content !== 'exclude children') {\n return false;\n }\n includeChildren = false;\n return true;\n });\n return { kind: 'EverySyntax', includeChildren, autoMap, mappings, location };\n }\n case 'all': {\n const { autoMap, mappings } = parseMappingBlock(context, line);\n return { kind: 'AllSyntax', autoMap, mappings, location };\n }\n case 'join':\n return parseJoin(context, line);\n case 'children':\n return parseChildren(context, line);\n case 'nested':\n return parseNested(context, line);\n case 'remove':\n return parseRemove(context, line);\n case 'clear':\n if (!nestedScope) {\n context.error(DiagnosticCodes.ClearWithOutsideNestedBlock, '\\'clear with\\' is only valid inside a nested block', location);\n }\n return parseClearWith(context, line);\n default:\n context.error(DiagnosticCodes.UnknownProjectionDirective, `Unexpected '${firstWord(line.content)}' in projection body`, location);\n context.skipBlock(line.indent);\n return undefined;\n }\n}\n\nfunction parseFrom(context: ParserContext, line: SourceLine): FromSyntax {\n const events: EventSpecSyntax[] = [];\n for (const spec of splitTopLevel(line.content.substring('from'.length), ',')) {\n const text = spec.trim();\n if (text.length === 0) {\n context.error(DiagnosticCodes.FromWithoutEvent, 'Expected an event type after \\'from\\'', locationOf(line));\n continue;\n }\n const match = eventSpecPattern.exec(text);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidEventReference, `Invalid event reference '${text}'`, locationOf(line));\n continue;\n }\n events.push({ kind: 'EventSpecSyntax', event: unescapeIdentifier(match[1]), key: match[2] === undefined ? null : parseProjectionExpression(match[2], locationOf(line), context), location: locationOf(line) });\n }\n const mappings: MappingSyntax[] = [];\n let key: KeySyntax | null = null;\n let parentKey: ExpressionSyntax | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'key') key = parseKey(context, child);\n else if (keyword === 'parent') parentKey = parseProjectionExpression(child.content.substring('parent'.length), locationOf(child), context);\n else pushMapping(context, child, mappings);\n }\n return { kind: 'FromSyntax', events, key, parentKey, mappings, location: locationOf(line) };\n}\n\nfunction parseJoin(context: ParserContext, line: SourceLine): JoinSyntax {\n const match = joinPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidJoinDeclaration, `Invalid join declaration '${line.content}' - expected 'join <property> on <key>'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'JoinSyntax', property: '', on: '', events: [], location: locationOf(line) };\n }\n const events: JoinEventSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const withMatch = withPattern.exec(child.content);\n if (withMatch === null) {\n context.error(DiagnosticCodes.JoinWithoutEvent, `Expected 'with <EventType>' in join block, got '${child.content}'`, locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n const { autoMap, mappings } = parseMappingBlock(context, child);\n events.push({ kind: 'JoinEventSyntax', event: unescapeIdentifier(withMatch[1]), autoMap, mappings, location: locationOf(child) });\n }\n return { kind: 'JoinSyntax', property: unescapeIdentifier(match[1]), on: unescapeIdentifier(match[2]), events, location: locationOf(line) };\n}\n\nfunction parseChildren(context: ParserContext, line: SourceLine): ChildrenSyntax {\n const match = childrenPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidChildrenDeclaration, `Invalid children declaration '${line.content}' - expected 'children <collection> identified by <key>'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'ChildrenSyntax', property: '', autoMap: 'Inherit', blocks: [], location: locationOf(line) };\n }\n const { autoMap, blocks } = parseChildBlocks(context, line);\n return { kind: 'ChildrenSyntax', property: unescapeIdentifier(match[1]), identifiedBy: parseProjectionExpression(match[2], locationOf(line), context), autoMap, blocks, location: locationOf(line) };\n}\n\nfunction parseNested(context: ParserContext, line: SourceLine): NestedSyntax {\n const match = nestedPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidNestedDeclaration, `Invalid nested declaration '${line.content}' - expected 'nested <property>'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'NestedSyntax', property: '', autoMap: 'Inherit', blocks: [], location: locationOf(line) };\n }\n const property = unescapeIdentifier(match[1]);\n const { autoMap, blocks } = parseChildBlocks(context, line);\n if (!blocks.some(block => block.kind === 'FromSyntax')) {\n context.error(DiagnosticCodes.NestedBlockWithoutFrom, `Nested block '${property}' must contain at least one 'from' directive`, locationOf(line));\n }\n return { kind: 'NestedSyntax', property, autoMap, blocks, location: locationOf(line) };\n}\n\nfunction parseChildBlocks(context: ParserContext, line: SourceLine): { autoMap: AutoMapMode; blocks: ProjectionBlockSyntax[] } {\n const blocks: ProjectionBlockSyntax[] = [];\n let autoMap: AutoMapMode = 'Inherit';\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'automap') {\n autoMap = 'Enabled';\n continue;\n }\n if (child.content === 'no automap') {\n autoMap = 'Disabled';\n continue;\n }\n const block = parseBlock(context, child, true);\n if (block !== undefined) {\n blocks.push(block);\n }\n }\n return { autoMap, blocks };\n}\n\nfunction parseRemove(context: ParserContext, line: SourceLine): ProjectionBlockSyntax | undefined {\n const viaJoin = removeViaJoinPattern.exec(line.content);\n if (viaJoin !== null) {\n return { kind: 'RemoveViaJoinSyntax', event: unescapeIdentifier(viaJoin[1]), key: viaJoin[2] === undefined ? null : parseProjectionExpression(viaJoin[2], locationOf(line), context), location: locationOf(line) };\n }\n const match = removeWithPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidRemoveDeclaration, `Invalid remove declaration '${line.content}' - expected 'remove with <EventType>' or 'remove via join on <EventType>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n let parentKey: ExpressionSyntax | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'parent') {\n parentKey = parseProjectionExpression(child.content.substring('parent'.length), locationOf(child), context);\n } else {\n context.error(DiagnosticCodes.UnknownRemoveDirective, `Unexpected '${child.content}' in remove block - only 'parent' is allowed`, locationOf(child));\n }\n }\n return { kind: 'RemoveWithSyntax', event: unescapeIdentifier(match[1]), key: match[2] === undefined ? null : parseProjectionExpression(match[2], locationOf(line), context), parentKey, location: locationOf(line) };\n}\n\nfunction parseClearWith(context: ParserContext, line: SourceLine): ClearWithSyntax {\n const match = clearWithPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidClearDeclaration, `Invalid clear declaration '${line.content}' - expected 'clear with <EventType>'`, locationOf(line));\n return { kind: 'ClearWithSyntax', event: '', location: locationOf(line) };\n }\n return { kind: 'ClearWithSyntax', event: unescapeIdentifier(match[1]), location: locationOf(line) };\n}\n\nfunction parseVariant(context: ParserContext, line: SourceLine): ProjectionVariantSyntax {\n const match = variantPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidProjectionVariantDeclaration, `Invalid variant declaration '${line.content}' - expected 'variant <Name>'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'ProjectionVariantSyntax', name: firstWord(line.content), entersOn: [], blocks: [], location: locationOf(line) };\n }\n const name = unescapeIdentifier(match[1]);\n const entersOn: ProjectionEntersOnSyntax[] = [];\n const blocks: ProjectionBlockSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'enters') {\n entersOn.push(parseEntersOn(context, child));\n } else if (keyword === 'variant') {\n context.error(DiagnosticCodes.NestedProjectionVariantNotAllowed, 'A variant cannot be declared inside another variant', locationOf(child));\n context.skipBlock(child.indent);\n } else {\n const block = parseBlock(context, child, false);\n if (block !== undefined) {\n blocks.push(block);\n }\n }\n }\n if (entersOn.length === 0) {\n context.error(DiagnosticCodes.VariantRequiresEnteringEvent, `Variant '${name}' must declare at least one 'enters on' event`, locationOf(line));\n }\n return { kind: 'ProjectionVariantSyntax', name, entersOn, blocks, location: locationOf(line) };\n}\n\nfunction parseEntersOn(context: ParserContext, line: SourceLine): ProjectionEntersOnSyntax {\n const match = entersOnPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidEntersOnDeclaration, `Invalid 'enters on' declaration '${line.content}' - expected 'enters on <EventType> [key <expression>]'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'ProjectionEntersOnSyntax', event: '', key: null, location: locationOf(line) };\n }\n return { kind: 'ProjectionEntersOnSyntax', event: unescapeIdentifier(match[1]), key: match[2] === undefined ? null : parseProjectionExpression(match[2], locationOf(line), context), location: locationOf(line) };\n}\n\n// A key with a body is a composite key: its parts, then a closing '}' at the key's own indent.\nfunction parseKey(context: ParserContext, line: SourceLine): KeySyntax {\n const text = line.content.substring('key'.length).trim();\n if (context.peekChild(line.indent) === undefined) return { kind: 'ExpressionKeySyntax', expression: parseProjectionExpression(text, locationOf(line), context), location: locationOf(line) };\n const parts: KeyPartSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content === '}') continue;\n const match = assignmentPattern.exec(child.content);\n if (match === null) {\n if (context.sourceOptions.numericMode === 'exact') context.error(DiagnosticCodes.InvalidCompositeKeyPart, `Invalid composite key part '${child.content}' - expected '<property> = <expression>'`, locationOf(child));\n continue;\n }\n const expression = parseProjectionExpression(match[2], locationOf(child), context);\n if (context.sourceOptions.numericMode === 'exact' && expression.kind === 'TemplateExpressionSyntax') context.error(DiagnosticCodes.TemplateInCompositeKey, 'Template expressions are not allowed in composite keys', locationOf(child));\n parts.push({ kind: 'KeyPartSyntax', property: unescapeIdentifier(match[1]), expression, location: locationOf(child) });\n }\n const closing = context.reader.peekSignificant();\n if (closing !== undefined && closing.indent === line.indent && closing.content === '}') context.reader.takeSignificant();\n if (context.sourceOptions.numericMode === 'exact' && parts.length === 0) context.error(DiagnosticCodes.EmptyCompositeKey, 'Composite keys must contain at least one part', locationOf(line));\n return { kind: 'CompositeKeySyntax', type: text.replace(/\\{$/, '').trim(), parts, location: locationOf(line) };\n}\n\n// Mapping lines carry no body, so a mapping block is its direct children. The last automap setting wins;\n// a line 'extra' claims is not a mapping.\nfunction parseMappingBlock(context: ParserContext, line: SourceLine, extra: (child: SourceLine) => boolean = () => false): { autoMap: AutoMapMode; mappings: MappingSyntax[] } {\n let autoMap: AutoMapMode = 'Inherit';\n const mappings: MappingSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'automap') {\n autoMap = 'Enabled';\n } else if (child.content === 'no automap') {\n autoMap = 'Disabled';\n } else if (!extra(child)) {\n pushMapping(context, child, mappings);\n }\n }\n return { autoMap, mappings };\n}\n\n// The property one mapping line sets, and how - the port of the C# ParseMappingLine. Exact reports\n// malformed mappings; Legacy keeps the existing skip behavior.\nfunction pushMapping(context: ParserContext, line: SourceLine, mappings: MappingSyntax[]): void {\n const location = locationOf(line);\n const keyword = keywordMappingPattern.exec(line.content);\n if (keyword !== null) {\n if (keyword[1] !== 'clear' || keyword[2] !== 'with') {\n mappings.push({ kind: keywordMappings[keyword[1]], property: unescapeIdentifier(keyword[2]), location });\n } else if (context.sourceOptions.numericMode === 'exact') {\n context.error(DiagnosticCodes.InvalidProjectionMapping, `Invalid mapping '${line.content}' - 'clear with' is a block directive and needs an event type; to clear a property named 'with', write 'clear @with'`, location);\n }\n return;\n }\n const arithmetic = arithmeticPattern.exec(line.content);\n if (arithmetic !== null) {\n mappings.push({ kind: arithmetic[1] === 'add' ? 'AddMappingSyntax' : 'SubtractMappingSyntax', property: unescapeIdentifier(arithmetic[2]), value: parseProjectionExpression(arithmetic[3], location, context), location });\n return;\n }\n const assigned = setPattern.exec(line.content) ?? assignmentPattern.exec(line.content);\n if (assigned !== null) {\n mappings.push({ kind: 'SetMappingSyntax', property: unescapeIdentifier(assigned[1]), source: parseProjectionExpression(assigned[2], location, context), location });\n } else if (context.sourceOptions.numericMode === 'exact') {\n context.error(DiagnosticCodes.InvalidProjectionMapping, `Invalid mapping '${line.content}'`, location);\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { AuthorizeSyntax } from '../Syntax/Authorization';\nimport { QueryParameterSyntax, QuerySyntax } from '../Syntax/Queries';\nimport { pattern } from '../Text/patterns';\nimport { combineAuthorize, parseAuthorize } from './AuthorizeParser';\nimport { parseDescription } from './DescriptionParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseTypeRef, reportLegacyOptionalSuffix } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = pattern('^query\\\\s+([A-Za-z_]\\\\w*)\\\\s*=>\\\\s*(observable\\\\s+)?([\\\\w.]+(?:\\\\[\\\\])?(?:\\\\?|\\\\s+optional)?)$');\nconst parameterPattern = pattern('^([a-z_]\\\\w*)\\\\s+([\\\\w.]+(?:\\\\[\\\\])?(?:\\\\?|\\\\s+optional)?)(?:\\\\s+from\\\\s+(.+))?$');\nconst scopePattern = pattern('^scoped\\\\s+to\\\\s+([a-z_]\\\\w*)$');\n\n// Query directives this compiler does not model. They are skipped whole.\nconst opaqueDirectives = new Set(['performer']);\n\nexport function parseQuery(context: ParserContext, line: SourceLine): QuerySyntax {\n const match = header.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidQueryDeclaration, `Invalid query declaration '${line.content}' - expected 'query <Name> => [observable] <ReadModel>'`, locationOf(line));\n context.skipBlock(line.indent);\n return {\n kind: 'QuerySyntax', name: firstWord(line.content), returnType: parseTypeRef('', locationOf(line)), by: null, filters: [],\n description: null, isObservable: false, scope: null, authorize: null, location: locationOf(line),\n };\n }\n const name = match[1];\n const returnType = parseTypeRef(match[3], { ...locationOf(line), column: line.indent + 1 + match[0].length - match[3].length });\n // This one '?' has no equivalent keyword spelling: 'observable optional' is a live query\n // returning the type named 'optional'. It is neither deprecated nor a migration occurrence.\n if (!(match[2] === undefined && returnType.name === 'observable' && returnType.isOptional && !returnType.isCollection)) {\n reportLegacyOptionalSuffix(context, returnType, line);\n }\n let by: QueryParameterSyntax | null = null;\n const filters: QueryParameterSyntax[] = [];\n let description: string | null = null;\n let scope: string | null = null;\n let authorize: AuthorizeSyntax | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'description') {\n description = parseDescription(context, child, description, `Query '${name}'`);\n } else if (keyword === 'by') {\n const parameter = parseParameter(context, child, 'by');\n if (parameter !== undefined) {\n if (by !== null) {\n context.error(DiagnosticCodes.InvalidQueryParameter, `Query '${name}' already declares 'by' - a query can have at most one key parameter`, locationOf(child));\n }\n by = parameter;\n }\n } else if (keyword === 'filter') {\n const filter = parseParameter(context, child, 'filter');\n if (filter !== undefined) {\n filters.push(filter);\n }\n } else if (keyword === 'authorize') {\n authorize = combineAuthorize(authorize, parseAuthorize(context, child));\n } else if (keyword === 'scoped') {\n scope = parseScope(context, child, scope, name) ?? scope;\n } else if (opaqueDirectives.has(keyword)) {\n context.skipOpaqueBlock(child.indent);\n } else {\n context.error(DiagnosticCodes.UnknownQueryDirective, `Unexpected '${child.content}' in query body - expected description, by, filter, authorize, scoped or performer`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n return {\n kind: 'QuerySyntax',\n name,\n returnType,\n by,\n filters,\n description,\n isObservable: match[2] !== undefined,\n scope,\n authorize,\n location: locationOf(line),\n };\n}\n\nfunction parseParameter(context: ParserContext, line: SourceLine, keyword: string): QueryParameterSyntax | undefined {\n const match = parameterPattern.exec(line.content.substring(keyword.length).trim());\n if (match === null) {\n context.error(DiagnosticCodes.InvalidQueryParameter, `Invalid '${keyword}' parameter '${line.content}' - expected '${keyword} <name> <Type> [from <source>]'`, locationOf(line));\n return undefined;\n }\n const nameOffset = line.content.indexOf(match[1], keyword.length);\n const type = parseTypeRef(match[2], { ...locationOf(line), column: line.indent + 1 + line.content.indexOf(match[2], nameOffset + match[1].length) });\n reportLegacyOptionalSuffix(context, type, line);\n return { kind: 'QueryParameterSyntax', name: match[1], type, source: match[3] === undefined ? null : parseMappingSource(match[3], locationOf(line), context.valueContext), location: locationOf(line) };\n}\n\nfunction parseScope(context: ParserContext, line: SourceLine, existing: string | null, queryName: string): string | undefined {\n const match = scopePattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidScopeDeclaration, `Invalid scope declaration '${line.content}' - expected 'scoped to <scope>'`, locationOf(line));\n return undefined;\n }\n if (existing !== null) {\n context.error(DiagnosticCodes.DuplicateScope, `Query '${queryName}' already declares a scope - results are narrowed one way`, locationOf(line));\n return undefined;\n }\n return match[1];\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { pattern } from '../Text/patterns';\nimport { parseDescription } from './DescriptionParser';\nimport { isFileDirective } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseProperty } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst typedValue = pattern('^@?[a-z_]\\\\w*\\\\s+[\\\\w.]+');\n\n// Trigger values are kept as parser-owned diagnostic metadata, outside the syntax wire projection. Recognize their type spelling in\n// exactly the C# data positions, without scanning descriptions, attachments, code or mapping expressions.\nexport function parseTriggerData(context: ParserContext, line: SourceLine): void {\n const property = parseProperty(context, line);\n if (property !== undefined) {\n if (property.isGenerated) context.error(DiagnosticCodes.GeneratedPropertyOutsideCommand, 'Generated properties can only be declared on commands.', property.location);\n if (property.isSubject) context.error(DiagnosticCodes.InvalidSubjectOwner, 'The subject modifier is only valid on event properties, not trigger or reaction data properties (decision 0008: one data subject per event).', property.location);\n context.triggerData.push(property);\n return;\n }\n // Keep the existing opaque projection for other trigger values and implementation bodies.\n // Only optionality-shaped failures belong to this spelling change.\n if (typedValue.test(line.content) && /\\?|\\boptional\\b/.test(line.content)) {\n context.error(DiagnosticCodes.InvalidTriggerData, `Invalid trigger value '${line.content}' - expected '<name>' or '<name> <Type>'`, locationOf(line));\n }\n context.skipOpaqueBlock(line.indent);\n}\n\nexport function parseTriggerDeclaration(context: ParserContext, header: SourceLine): readonly PropertySyntax[] {\n const start = context.triggerData.length;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (firstWord(line.content) === 'description') {\n parseDescription(context, line, null, `Trigger '${header.content}'`);\n } else if (!isFileDirective(line)) {\n parseTriggerData(context, line);\n }\n }\n return context.triggerData.slice(start);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ConditionSyntax } from '../Syntax/Conditions';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { InvocationRefusalSyntax } from '../Syntax/InvocationRefusalSyntax';\nimport { parseCondition } from './ConditionParser';\nimport { parseModeledMappingSource as parseMappingSource } from './ExpressionParser';\nimport { DayOfWeek, IntervalUnit, InvokesSyntax, ProducesSyntax, ReactionSyntax, ReactionTriggerSyntax, TriggerSourceSyntax } from '../Syntax/Reactions';\nimport { nativePattern, pattern } from '../Text/patterns';\nimport { parseDescription } from './DescriptionParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { collectInputUses } from './InputUses';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseTriggerData } from './TriggerDataParser';\nimport { dependencySources, ReadsSyntax, TriggerDataSyntax } from '../Syntax/DependencySources';\nimport { captureReads } from './DependencySourceParser';\nimport { parseProduces } from './ProducesParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = pattern('^reaction\\\\s+([A-Za-z_]\\\\w*)$');\nconst whenPattern = pattern('^when\\\\s+([A-Za-z_]\\\\w*)$');\nconst everyPattern = pattern('^every\\\\s+(\\\\d+)\\\\s+(seconds?|minutes?|hours?|days?)$');\nconst atPattern = pattern('^at\\\\s+(\\\\d{2}:\\\\d{2})(?:\\\\s+on\\\\s+(?:(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday)|day\\\\s+(\\\\d{1,2})))?$');\nconst clauseKeywords = new Set(['when', 'every', 'at']);\nconst invokesPattern = pattern('^invokes\\\\s+([A-Z]\\\\w*)$');\nconst mappingPattern = nativePattern('^(@?[\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\nconst refusalPrefix = nativePattern('^on\\\\s+refused\\\\b(?=$|\\\\s+by\\\\b)');\nconst refusalHeader = nativePattern('^on\\\\s+refused(?:\\\\s+by\\\\s+(validation|constraint|authorization)(?:\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*))?)?$');\nconst optionalReads = pattern('^reads\\\\s+[A-Z]\\\\w*\\\\s+optional(?:\\\\s|$)');\n\nexport function parseReaction(context: ParserContext, line: SourceLine): ReactionSyntax {\n const name = header.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidReactionDeclaration, `Invalid reaction declaration '${line.content}' - expected 'reaction <Name>'`, locationOf(line));\n }\n let description: string | null = null;\n let documentation: string | null = null;\n let where: ConditionSyntax | null = null;\n const triggers: ReactionTriggerSyntax[] = [];\n const sources = new Set<string>();\n // A reaction whose only trigger is misspelled has no trigger, but saying so as well turns one mistake\n // into two diagnostics.\n let reported = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'description') {\n description = parseDescription(context, child, description, `Reaction '${name}'`);\n continue;\n }\n if (keyword === 'documentation') {\n documentation = parseDocumentation(context, child, documentation, `Reaction '${name}'`);\n continue;\n }\n if (keyword === 'where') {\n where = parseCondition(context, child.content.substring('where'.length).trim(), locationOf(child));\n continue;\n }\n if (refusalPrefix.test(child.content)) {\n context.error(DiagnosticCodes.InvalidRefusalBranch, \"A refusal branch belongs inside 'invokes <Command>'.\", locationOf(child));\n context.skipBlock(child.indent);\n reported = true;\n continue;\n }\n if (!clauseKeywords.has(keyword)) {\n context.error(DiagnosticCodes.InvalidReactionTrigger, `Expected a trigger in reaction body, got '${child.content}' - a reaction is set off by 'when <Name>', 'every <n> <unit>' or 'at <HH:mm>'`, locationOf(child));\n context.skipBlock(child.indent);\n reported = true;\n continue;\n }\n const source = parseTriggerSource(context, child);\n if (source === undefined) {\n reported = true;\n continue;\n }\n const key = sourceKey(source);\n if (sources.has(key)) {\n context.error(DiagnosticCodes.DuplicateReactionTrigger, `Reaction '${name}' already declares '${child.content}' - a second says nothing the first did not`, locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n sources.add(key);\n triggers.push(parseTrigger(context, child, source));\n }\n if (triggers.length === 0 && !reported) {\n context.error(DiagnosticCodes.ReactionWithoutTrigger, `Reaction '${name}' must declare at least one trigger - nothing sets it off`, locationOf(line));\n }\n return { kind: 'ReactionSyntax', name, description, documentation, where, triggers, location: locationOf(line) };\n}\n\n// What a trigger does - the events it produces and the commands it invokes - is read by name; its reads,\n// values and code are not modeled. The C# compiler remains the authority on whether what is skipped is valid.\nfunction parseTrigger(context: ParserContext, line: SourceLine, source: TriggerSourceSyntax): ReactionTriggerSyntax {\n let description: string | null = null;\n const produces: ProducesSyntax[] = [];\n const invokes: InvokesSyntax[] = [];\n const reads: ReadsSyntax[] = [];\n const data: TriggerDataSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'description') {\n description = parseDescription(context, child, description, `Trigger '${child.content}'`);\n } else if (keyword === 'produces') {\n const produced = parseProduces(context, child);\n if (produced !== undefined) {\n produces.push(produced);\n }\n } else if (keyword === 'invokes') {\n const match = invokesPattern.exec(child.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidInvokesDeclaration, `Invalid invokes declaration '${child.content}' - expected 'invokes <Command>'`, locationOf(child));\n context.skipBlock(child.indent);\n } else {\n const uses = new ParserContext(context.reader.fork(), context.path, context.languages);\n uses.scope = context.scope;\n uses.sourceOptions = context.sourceOptions;\n collectInputUses(uses, child);\n context.inputUses.push(...uses.inputUses);\n const mappings: PropertyMappingSyntax[] = [];\n const onRefused: InvocationRefusalSyntax[] = [];\n for (let value = context.peekChild(child.indent); value !== undefined; value = context.peekChild(child.indent)) {\n context.reader.takeSignificant();\n if (refusalPrefix.test(value.content)) {\n const refusal = parseRefusal(context, value);\n if (refusal !== undefined) onRefused.push(refusal);\n continue;\n }\n const mapped = mappingPattern.exec(value.content);\n if (mapped !== null) mappings.push({ kind: 'PropertyMappingSyntax', property: mapped[1].replaceAll('@', ''), source: parseMappingSource(mapped[2], locationOf(value), context.valueContext), location: locationOf(value) });\n else context.error(DiagnosticCodes.InvalidPropertyMapping, `Invalid property mapping '${value.content}' - expected '<property> = <source>'`, locationOf(value));\n }\n invokes.push({ kind: 'InvokesSyntax', command: match[1], mappings, onRefused, location: locationOf(child) });\n }\n } else if (refusalPrefix.test(child.content)) {\n context.error(DiagnosticCodes.InvalidRefusalBranch, \"A refusal branch belongs inside 'invokes <Command>'.\", locationOf(child));\n context.skipBlock(child.indent);\n } else if (keyword === 'reads' || keyword === 'file' || child.content === 'csharp' || child.content.startsWith('```')) {\n const read = captureReads(child);\n if (read !== undefined) reads.push(read);\n if (optionalReads.test(child.content)) {\n context.error(DiagnosticCodes.OptionalReadsNotSupported, 'Optional reads are not yet supported (see #308).', locationOf(child));\n }\n if (child.content.startsWith('```')) {\n context.skipFencedBody();\n }\n context.skipOpaqueBlock(child.indent);\n } else {\n const start = context.triggerData.length;\n parseTriggerData(context, child);\n for (const property of context.triggerData.slice(start)) data.push({ kind: 'TriggerDataSyntax', name: property.name, type: property.type, location: property.location });\n }\n }\n const syntax: ReactionTriggerSyntax = { kind: 'ReactionTriggerSyntax', source, description, produces, invokes, location: locationOf(line) };\n dependencySources.set(syntax, { reads, data });\n return syntax;\n}\n\nfunction parseRefusal(context: ParserContext, line: SourceLine): InvocationRefusalSyntax | undefined {\n const match = refusalHeader.exec(line.content);\n if (match === null || (match[2] !== undefined && match[1] !== 'constraint')) {\n context.error(DiagnosticCodes.InvalidRefusalBranch, \"Expected 'on refused [by validation | by constraint [<Name>] | by authorization]'.\", locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n const produces: ProducesSyntax[] = [];\n let acknowledge = false;\n let reported = false;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (child.content === 'acknowledge') {\n if (acknowledge || produces.length > 0 || context.peekChild(child.indent) !== undefined) {\n context.error(DiagnosticCodes.InvalidRefusalBranchBody, \"A refusal branch contains 'acknowledge' alone or one or more 'produces' blocks.\", locationOf(child));\n reported = true;\n }\n acknowledge = true;\n context.skipBlock(child.indent);\n } else if (firstWord(child.content) === 'produces') {\n if (acknowledge) {\n context.error(DiagnosticCodes.InvalidRefusalBranchBody, \"A refusal branch cannot combine 'acknowledge' and 'produces'.\", locationOf(child));\n reported = true;\n }\n const produced = parseProduces(context, child);\n if (produced !== undefined) produces.push(produced);\n else reported = true;\n } else {\n context.error(DiagnosticCodes.InvalidRefusalBranchBody, \"Expected 'acknowledge' or 'produces <Event>' in a refusal branch.\", locationOf(child));\n context.skipBlock(child.indent);\n reported = true;\n }\n }\n if (!acknowledge && produces.length === 0 && !reported) {\n context.error(DiagnosticCodes.InvalidRefusalBranchBody, 'A refusal branch must acknowledge or produce an event.', locationOf(line));\n }\n return { kind: 'InvocationRefusalSyntax', selector: match[1] ?? 'any', constraint: match[2] ?? null, acknowledge, produces, location: locationOf(line) };\n}\n\nfunction sourceKey(source: TriggerSourceSyntax): string {\n switch (source.kind) {\n case 'NamedTriggerSourceSyntax': return JSON.stringify([source.kind, source.name]);\n case 'IntervalTriggerSourceSyntax': return JSON.stringify([source.kind, source.amount, source.unit]);\n case 'ScheduleTriggerSourceSyntax': return JSON.stringify([source.kind, source.time, source.dayOfWeek, source.dayOfMonth]);\n }\n}\n\n// Reads a 'when', 'every' or 'at' clause - the port of the C# TriggerParser.ParseSource. The caller only\n// hands it a line starting with one of the three, so anything that is not 'when' or 'every' is 'at'.\nexport function parseTriggerSource(context: ParserContext, line: SourceLine): TriggerSourceSyntax | undefined {\n const location = locationOf(line);\n switch (firstWord(line.content)) {\n case 'when': {\n const match = whenPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidReactionTrigger, `Invalid trigger '${line.content}' - expected 'when <Name>'`, location);\n context.skipBlock(line.indent);\n return undefined;\n }\n return { kind: 'NamedTriggerSourceSyntax', name: match[1], location };\n }\n case 'every': {\n const match = everyPattern.exec(line.content);\n const amount = match === null ? NaN : Number(match[1]);\n if (match === null || !Number.isInteger(amount) || amount < 1 || amount > 2147483647) {\n context.error(DiagnosticCodes.InvalidIntervalTrigger, `Invalid interval '${line.content}' - expected 'every <n> <seconds|minutes|hours|days>'`, location);\n context.skipBlock(line.indent);\n return undefined;\n }\n return { kind: 'IntervalTriggerSourceSyntax', amount, unit: unitOf(match[2]), location };\n }\n default:\n return parseSchedule(context, line);\n }\n}\n\nfunction parseSchedule(context: ParserContext, line: SourceLine): TriggerSourceSyntax | undefined {\n const location = locationOf(line);\n const match = atPattern.exec(line.content);\n const time = match === null ? undefined : timeOf(match[1]);\n if (match === null || time === undefined) {\n context.error(DiagnosticCodes.InvalidScheduleTrigger, `Invalid schedule '${line.content}' - expected 'at <HH:mm>', optionally followed by 'on <Weekday>' or 'on day <n>'`, location);\n context.skipBlock(line.indent);\n return undefined;\n }\n if (match[3] !== undefined) {\n const day = Number(match[3]);\n if (day < 1 || day > 31) {\n context.error(DiagnosticCodes.InvalidScheduleTrigger, `Invalid day of month '${day}' in '${line.content}' - a day of the month is between 1 and 31`, location);\n context.skipBlock(line.indent);\n return undefined;\n }\n return { kind: 'ScheduleTriggerSourceSyntax', time, dayOfWeek: null, dayOfMonth: day, location };\n }\n return { kind: 'ScheduleTriggerSourceSyntax', time, dayOfWeek: (match[2] as DayOfWeek | undefined) ?? null, dayOfMonth: null, location };\n}\n\n// 'HH:mm' as SyntaxJson writes a TimeOnly, or undefined when it is not a time of day.\nfunction timeOf(text: string): string | undefined {\n const [hours, minutes] = text.split(':').map(Number);\n if (!(hours >= 0 && hours <= 23 && minutes >= 0 && minutes <= 59)) {\n return undefined;\n }\n return `${text}:00.0000000`;\n}\n\nfunction unitOf(text: string): IntervalUnit {\n switch (text.replace(/s+$/, '')) {\n case 'second':\n return 'Seconds';\n case 'minute':\n return 'Minutes';\n case 'hour':\n return 'Hours';\n default:\n return 'Days';\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { UiBindingSyntax } from '../Syntax/Screens';\nimport { parseMappingSource } from './ExpressionParser';\nimport { pattern } from '../Text/patterns';\nimport { ParserContext } from './ParserContext';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\n\nconst bindingHead = pattern('^(data|query|component)\\\\s+(\\\\S+)(.*)$');\nconst literalBindingHead = pattern('^literal\\\\s+(.+?)(?:\\\\s+(mode\\\\s+.+|null\\\\s+.+|expected\\\\s+.+))?$');\nconst qualifiedPath = pattern('^([A-Za-z_]\\\\w*)(?:\\\\.(.+))?$');\nconst requiredQualifiedPath = pattern('^(?:([A-Za-z_]\\\\w*)|\"([^\"\\\\\\\\]*(?:\\\\\\\\.[^\"\\\\\\\\]*)*)\")\\\\.(.+)$');\nconst mode = pattern('^mode\\\\s+(oneWay|twoWay)\\\\b(.*)$');\nconst nullBehavior = pattern('^null\\\\s+(propagate|clear|preserve)\\\\b(.*)$');\nconst expected = pattern('^expected\\\\s+(\\\\w+(?:\\\\.\\\\w+)*)(.*)$');\n\nexport function parseFromClause(context: ParserContext, text: string, location: SourceLocation): UiBindingSyntax {\n const trimmed = text.trim();\n const first = trimmed.split(/\\s+/, 1)[0];\n return first === 'data' || first === 'query' || first === 'component' || first === 'literal'\n ? parseUiBinding(context, `from ${trimmed}`, location)\n : parseUiBinding(context, trimmed, location);\n}\n\nexport function parseUiBinding(context: ParserContext, text: string, location: SourceLocation): UiBindingSyntax {\n const trimmed = text.trim();\n if (!trimmed.startsWith('from ')) {\n return withModifiers(context, create('DataContext', trimmed, location), '', location);\n }\n\n const body = trimmed.substring('from '.length).trim();\n if (body.startsWith('literal ')) {\n const literalHead = literalBindingHead.exec(body);\n if (literalHead === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid UI binding '${trimmed}' - expected 'from literal <value>'`, location);\n return { ...create('Invalid', body, location), rawText: trimmed };\n }\n return withModifiers(context, { ...create('Literal', '', location), literal: parseMappingSource(literalHead[1], location, context) }, literalHead[2] ?? '', location);\n }\n\n const head = bindingHead.exec(body);\n if (head === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid UI binding '${trimmed}' - expected 'from data <path>', 'from query <Query>[.<path>]', 'from component <id>.<path>' or 'from literal <value>'`, location);\n return { ...create('Invalid', body, location), rawText: trimmed };\n }\n\n const binding = parseBindingSource(context, head[1], head[2], trimmed, location);\n return withModifiers(context, binding, head[3], location);\n}\n\nfunction parseBindingSource(context: ParserContext, source: string, expression: string, raw: string, location: SourceLocation): UiBindingSyntax {\n if (source === 'data') return create('DataContext', expression, location);\n if (source === 'query') return queryBinding(context, expression, raw, location);\n\n return componentBinding(context, expression, raw, location);\n}\n\nfunction queryBinding(context: ParserContext, expression: string, raw: string, location: SourceLocation): UiBindingSyntax {\n const match = qualifiedPath.exec(expression);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid query binding '${raw}' - expected 'from query <Query>[.<path>]'.`, location);\n return { ...create('Invalid', expression, location), rawText: raw };\n }\n\n return { ...create('QueryResult', match[2] ?? '', location), query: match[1] };\n}\n\nfunction componentBinding(context: ParserContext, expression: string, raw: string, location: SourceLocation): UiBindingSyntax {\n const match = requiredQualifiedPath.exec(expression);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component binding '${raw}' - expected 'from component <stableInstanceId>.<outputPath>' or 'from component \"<stableInstanceId>\".<outputPath>'.`, location);\n return { ...create('Invalid', expression, location), rawText: raw };\n }\n\n const componentId = match[1] ?? match[2];\n const path = match[3];\n return { ...create('ComponentProperty', path, location), componentId, componentPropertyPath: path };\n}\n\nfunction withModifiers(context: ParserContext, binding: UiBindingSyntax, modifiers: string, location: SourceLocation): UiBindingSyntax {\n let next = binding;\n let rest = modifiers.trim();\n while (rest.length > 0) {\n const modeMatch = mode.exec(rest);\n if (modeMatch !== null) {\n next = { ...next, mode: modeMatch[1] === 'twoWay' ? 'TwoWay' : 'OneWay' };\n rest = modeMatch[2].trim();\n continue;\n }\n\n const nullMatch = nullBehavior.exec(rest);\n if (nullMatch !== null) {\n next = { ...next, nullBehavior: nullMatch[1] === 'clear' ? 'Clear' : nullMatch[1] === 'preserve' ? 'Preserve' : 'Propagate' };\n rest = nullMatch[2].trim();\n continue;\n }\n\n const expectedMatch = expected.exec(rest);\n if (expectedMatch !== null) {\n next = { ...next, expectedValueType: expectedMatch[1] };\n rest = expectedMatch[2].trim();\n continue;\n }\n\n context.error(DiagnosticCodes.UnknownScreenDirective, `Unsupported UI binding modifier '${rest}' - supported modifiers are 'mode oneWay|twoWay', 'null propagate|clear|preserve' and 'expected <Type>'.`, location);\n return { ...next, rawText: next.rawText ?? rest };\n }\n\n return next;\n}\n\nfunction create(bindingKind: UiBindingSyntax['bindingKind'], path: string, location: SourceLocation): UiBindingSyntax {\n return {\n kind: 'UiBindingSyntax',\n bindingKind,\n path,\n query: null,\n componentId: null,\n componentPropertyPath: null,\n mode: null,\n nullBehavior: null,\n expectedValueType: null,\n literal: null,\n rawText: null,\n location,\n };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport {\n ComponentExposedValueSyntax, ComponentOutletSyntax, ComponentPropertySyntax, PresentationValueSyntax,\n ScreenActionSyntax, ScreenGuardedActionSyntax, ScreenCodeSyntax, ScreenColumnSyntax, ScreenComponentSyntax, ScreenDataSyntax, ScreenDirectiveSyntax, ScreenFieldSyntax,\n ScreenNavigateSyntax, ScreenNavigationParameterSyntax, ScreenSectionSyntax, ScreenSlotSyntax, ScreenSummarySyntax, ScreenSyntax, ScreenTableSyntax,\n ScreenTemplateReferenceSyntax, ScreenTitleSyntax, ScreenToolbarSyntax, ToolbarItemKind, ToolbarItemSyntax,\n} from '../Syntax/Screens';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { pattern } from '../Text/patterns';\nimport { parseFencedText } from './CodeBlockParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { parseDescription } from './DescriptionParser';\nimport { isFileDirective } from './FileReferences';\nimport { parseGuardedAction } from './GuardedActionParser';\nimport { collectInputUses } from './InputUses';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseTypeRef } from './PropertyLineParser';\nimport { parseFromClause } from './UiBindingParser';\nimport { ScreenContributionSyntax } from '../Syntax/CompositionSyntax';\nimport { locationOf, SourceLine } from './SourceLine';\n\n// Parses 'screen' declarations the way the C# ScreenParser does - intent level directives, the template\n// whose slots they fill, and inline code. Interaction ('on' and 'uses') is recognized but not modeled.\n\nconst operand = `(?:\"(${stringBodyPattern})\"|(\\\\$strings\\\\.\\\\w+(?:\\\\.\\\\w+)*))`;\nconst header = pattern('^screen\\\\s+([A-Za-z_]\\\\w*)$');\nconst data = pattern('^data\\\\s+([\\\\w.]+(?:\\\\[\\\\])?)\\\\s+via\\\\s+query\\\\s+(\\\\w+(?:\\\\.\\\\w+)*)(?:\\\\s+by\\\\s+(\\\\w+))?$');\nconst action = pattern('^action\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst label = pattern(`^label\\\\s+${operand}$`);\nconst guardedAction = pattern(`^action\\\\s+${operand}$`);\nconst navigate = pattern('^navigate\\\\s+to\\\\s+(\\\\w+(?:\\\\.\\\\w+)*)(?:\\\\s+by\\\\s+(\\\\w+))?$');\nconst route = pattern(`^route\\\\s+${operand}$`);\nconst outletPattern = pattern('^outlet\\\\s+([A-Za-z_]\\\\w*)$');\nconst contributionPattern = pattern('^contribute\\\\s+to\\\\s+([A-Za-z_]\\\\w*)(?:\\\\s+order\\\\s+(-?\\\\d+))?$');\nconst parameter = pattern('^parameter\\\\s+([A-Za-z_]\\\\w*)\\\\s+from\\\\s+(.+)$');\nconst component = pattern('^component\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)\\\\s+([A-Za-z_]\\\\w*)$');\nconst stableId = pattern(`^id\\\\s+(?:\"(${stringBodyPattern})\"|(\\\\S+))$`);\nconst componentPropertyBinding = pattern('^property\\\\s+([\\\\w.]+)\\\\s+from\\\\s+(.+)$');\nconst componentPropertyLiteral = pattern('^property\\\\s+([\\\\w.]+)\\\\s*=\\\\s+(.+)$');\nconst exposes = pattern('^exposes\\\\s+([A-Za-z_]\\\\w*)\\\\s+from\\\\s+(.+)$');\nconst presentation = pattern(`^presentation\\\\s+([A-Za-z_]\\\\w*)\\\\s+${operand}$`);\nconst toolbarItem = pattern('^item\\\\s+([A-Za-z_]\\\\w*)\\\\s+(action|navigate|dialog)(?:\\\\s+to)?\\\\s+([A-Za-z_]\\\\w*(?:\\\\.\\\\w+)*)$');\nconst slot = pattern('^[a-z_]\\\\w*$');\nconst title = pattern(`^title\\\\s+${operand}$`);\nconst column = pattern(`^column\\\\s+([\\\\w.]+)(?:\\\\s+label\\\\s+${operand})?$`);\nconst rowClick = pattern('^on\\\\s+row-click\\\\s+(navigate\\\\s+to\\\\s+.+)$');\nconst field = pattern(`^field\\\\s+([\\\\w.]+)\\\\s+label\\\\s+${operand}$`);\n\nconst operandText = (match: RegExpExecArray, quotedGroup: number): string =>\n match[quotedGroup] !== undefined ? unescapeString(match[quotedGroup]) : match[quotedGroup + 1];\n\nconst isInteraction = (line: SourceLine): boolean => ['on', 'uses'].includes(firstWord(line.content));\n\nconst isCodeLine = (context: ParserContext, line: SourceLine): boolean => line.content.startsWith('```') || context.languages.has(line.content);\n\nexport function parseScreen(context: ParserContext, line: SourceLine): ScreenSyntax {\n const match = header.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidScreenDeclaration, `Invalid screen declaration '${line.content}' - expected 'screen <Name>'`, locationOf(line));\n }\n const directives: ScreenDirectiveSyntax[] = [];\n const contributions: ScreenContributionSyntax[] = [];\n let description: string | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'contribute') {\n const parsed = parseScreenContribution(context, child);\n if (parsed !== undefined) contributions.push(parsed);\n } else if (firstWord(child.content) === 'description') {\n description = parseDescription(context, child, description, `Screen '${match?.[1] ?? ''}'`);\n } else if (!isFileDirective(child)) {\n pushDirective(context, child, directives);\n }\n }\n return { kind: 'ScreenSyntax', name: match?.[1] ?? '', directives, description, ...(contributions.length > 0 ? { contributions } : {}), location: locationOf(line) };\n}\n\nfunction parseScreenContribution(context: ParserContext, line: SourceLine): ScreenContributionSyntax | undefined {\n const match = contributionPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid screen contribution '${line.content}' - expected 'contribute to <Point> [order <n>]'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n return { kind: 'ScreenContributionSyntax', contributionPoint: match[1], order: match[2] === undefined ? null : Number(match[2]), directives: parseDirectives(context, line), location: locationOf(line) };\n}\n\nfunction pushDirective(context: ParserContext, line: SourceLine, directives: ScreenDirectiveSyntax[]): void {\n const directive = parseDirective(context, line);\n if (directive !== undefined) {\n directives.push(directive);\n }\n}\n\nfunction parseDirectives(context: ParserContext, parent: SourceLine): ScreenDirectiveSyntax[] {\n const directives: ScreenDirectiveSyntax[] = [];\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n pushDirective(context, child, directives);\n }\n return directives;\n}\n\nfunction parseDirective(context: ParserContext, line: SourceLine): ScreenDirectiveSyntax | undefined {\n switch (firstWord(line.content)) {\n case 'data':\n return parseData(context, line);\n case 'action':\n return parseAction(context, line);\n case 'template':\n return parseTemplateReference(context, line);\n case 'section':\n return parseSection(context, line);\n case 'title':\n return parseTitle(context, line);\n case 'table':\n return parseTable(context, line);\n case 'summary':\n return parseSummary(context, line);\n case 'component':\n return parseComponent(context, line);\n case 'toolbar':\n return parseToolbar(context, line);\n case 'navigate':\n return parseNavigate(context, line.content, line);\n case 'on':\n collectInputUses(context, line);\n return { kind: 'ScreenBehaviorSyntax', location: locationOf(line) };\n case 'uses':\n context.skipOpaqueBlock(line.indent);\n return { kind: 'ScreenUsesBehaviorSyntax', location: locationOf(line) };\n default:\n if (isCodeLine(context, line)) {\n return parseCode(context, line);\n }\n context.error(DiagnosticCodes.UnknownScreenDirective, `Unexpected '${line.content}' in screen body`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n}\n\nfunction parseData(context: ParserContext, line: SourceLine): ScreenDataSyntax | undefined {\n const match = data.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidDataDirective, `Invalid data directive '${line.content}' - expected 'data <ReadModel> via query <Query> [by <param>]'`, locationOf(line));\n return undefined;\n }\n return { kind: 'ScreenDataSyntax', type: parseTypeRef(match[1], locationOf(line)), query: match[2], by: match[3] ?? null, location: locationOf(line) };\n}\n\nfunction parseAction(context: ParserContext, line: SourceLine): ScreenActionSyntax | ScreenGuardedActionSyntax | undefined {\n const guarded = guardedAction.exec(line.content);\n if (guarded !== null) return parseGuardedAction(context, line, operandText(guarded, 1), parseNavigate);\n const match = action.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidActionDirective, `Invalid action directive '${line.content}' - expected 'action <Command>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n let text: string | null = null;\n let target: ScreenNavigateSyntax | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const labelMatch = label.exec(child.content);\n if (labelMatch !== null) {\n text = operandText(labelMatch, 1);\n } else if (firstWord(child.content) === 'navigate') {\n target = parseNavigate(context, child.content, child) ?? null;\n } else {\n context.error(DiagnosticCodes.UnknownActionDirective, `Unexpected '${child.content}' in action - expected 'label \"...\"' or 'navigate to ...'`, locationOf(child));\n }\n }\n return { kind: 'ScreenActionSyntax', command: match[1], label: text, navigate: target, location: locationOf(line) };\n}\n\nfunction parseNavigate(context: ParserContext, text: string, line: SourceLine): ScreenNavigateSyntax | undefined {\n const match = navigate.exec(text);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidNavigation, `Invalid navigation '${text}' - expected 'navigate to <Screen> [by <param>]'`, locationOf(line));\n return undefined;\n }\n const parameters: ScreenNavigationParameterSyntax[] = [];\n let routeValue: string | null = null;\n let outletValue: string | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const parameterMatch = parameter.exec(child.content);\n if (parameterMatch !== null) {\n parameters.push({ kind: 'ScreenNavigationParameterSyntax', name: parameterMatch[1], binding: parseFromClause(context, parameterMatch[2], locationOf(child)), location: locationOf(child) });\n continue;\n }\n const routeMatch = route.exec(child.content);\n if (routeMatch !== null) {\n routeValue = operandText(routeMatch, 1);\n continue;\n }\n const outletMatch = outletPattern.exec(child.content);\n if (outletMatch !== null) {\n outletValue = outletMatch[1];\n continue;\n }\n context.error(DiagnosticCodes.InvalidNavigation, `Unexpected '${child.content}' in navigation - expected 'route \"...\"', 'outlet <name>' or 'parameter <name> from <binding>'`, locationOf(child));\n }\n return { kind: 'ScreenNavigateSyntax', screen: match[1], by: match[2] ?? null, route: routeValue, ...(outletValue === null ? {} : { outlet: outletValue }), parameters, location: locationOf(line) };\n}\n\nfunction parseTemplateReference(context: ParserContext, line: SourceLine): ScreenTemplateReferenceSyntax {\n const name = line.content.substring('template'.length).trim();\n const slots: ScreenSlotSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (!slot.test(child.content)) {\n context.error(DiagnosticCodes.InvalidScreenLayoutSlot, `Expected a slot name in template '${name}', got '${child.content}'`, locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n slots.push({ kind: 'ScreenSlotSyntax', name: child.content, directives: parseDirectives(context, child), location: locationOf(child) });\n }\n return { kind: 'ScreenTemplateReferenceSyntax', name, slots, location: locationOf(line) };\n}\n\nfunction parseSection(context: ParserContext, line: SourceLine): ScreenSectionSyntax {\n const name = line.content.substring('section'.length).trim();\n return { kind: 'ScreenSectionSyntax', name, directives: parseDirectives(context, line), location: locationOf(line) };\n}\n\nfunction parseTitle(context: ParserContext, line: SourceLine): ScreenTitleSyntax {\n const match = title.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidTitleDirective, `Invalid title directive '${line.content}' - expected 'title \"...\"'`, locationOf(line));\n return { kind: 'ScreenTitleSyntax', text: '', location: locationOf(line) };\n }\n return { kind: 'ScreenTitleSyntax', text: operandText(match, 1), location: locationOf(line) };\n}\n\nfunction parseTable(context: ParserContext, line: SourceLine): ScreenTableSyntax {\n const target = line.content.substring('table'.length).trim();\n const columns: ScreenColumnSyntax[] = [];\n let click: ScreenNavigateSyntax | null = null;\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const columnMatch = column.exec(child.content);\n const clickMatch = rowClick.exec(child.content);\n if (columnMatch !== null) {\n const labelled = columnMatch[2] !== undefined || columnMatch[3] !== undefined;\n columns.push({ kind: 'ScreenColumnSyntax', property: columnMatch[1], label: labelled ? operandText(columnMatch, 2) : null, location: locationOf(child) });\n } else if (clickMatch !== null) {\n click = parseNavigate(context, clickMatch[1], child) ?? null;\n } else if (firstWord(child.content) === 'on') {\n collectInputUses(context, child);\n } else if (isInteraction(child)) {\n context.skipOpaqueBlock(child.indent);\n } else {\n context.error(DiagnosticCodes.UnknownTableDirective, `Unexpected '${child.content}' in table - expected 'column ...', 'on row-click navigate to ...', 'on <trigger>' or 'uses <Behavior>'`, locationOf(child));\n }\n }\n return { kind: 'ScreenTableSyntax', target, columns, rowClick: click, location: locationOf(line) };\n}\n\nfunction parseSummary(context: ParserContext, line: SourceLine): ScreenSummarySyntax {\n const target = line.content.substring('summary'.length).trim();\n const fields: ScreenFieldSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const match = field.exec(child.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownSummaryDirective, `Unexpected '${child.content}' in summary - expected 'field <property> label \"...\"'`, locationOf(child));\n continue;\n }\n fields.push({ kind: 'ScreenFieldSyntax', property: match[1], label: operandText(match, 2), location: locationOf(child) });\n }\n return { kind: 'ScreenSummarySyntax', target, fields, location: locationOf(line) };\n}\n\n\nfunction parseComponent(context: ParserContext, line: SourceLine): ScreenComponentSyntax | undefined {\n const match = component.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component directive '${line.content}' - expected 'component <Package.Component> <name>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n\n let dataContext = null;\n let componentStableId = null;\n let icon = null;\n const properties: ComponentPropertySyntax[] = [];\n const exposedValues: ComponentExposedValueSyntax[] = [];\n const presentationValues: PresentationValueSyntax[] = [];\n const outlets: ComponentOutletSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n switch (firstWord(child.content)) {\n case 'context':\n dataContext = parseUiContext(context, child);\n break;\n case 'id':\n componentStableId = parseStableId(context, child);\n break;\n case 'property':\n parseComponentProperty(context, child, properties);\n break;\n case 'icon':\n icon = child.content.substring('icon'.length).trim();\n break;\n case 'presentation':\n parsePresentationValue(context, child, presentationValues);\n break;\n case 'exposes':\n parseExposedValue(context, child, exposedValues);\n break;\n case 'outlet':\n outlets.push({ kind: 'ComponentOutletSyntax', name: child.content.substring('outlet'.length).trim(), directives: parseDirectives(context, child), location: locationOf(child) });\n break;\n case 'on':\n collectInputUses(context, child);\n break;\n case 'uses':\n context.skipOpaqueBlock(child.indent);\n break;\n default:\n context.error(DiagnosticCodes.UnknownScreenDirective, `Unexpected '${child.content}' in component - expected context, id, property, icon, presentation, exposes, outlet, on or uses`, locationOf(child));\n context.skipBlock(child.indent);\n break;\n }\n }\n\n return { kind: 'ScreenComponentSyntax', component: match[1], name: match[2], stableId: componentStableId, context: dataContext, properties, exposes: exposedValues, presentation: presentationValues, icon, outlets, location: locationOf(line) };\n}\n\nfunction parseUiContext(context: ParserContext, line: SourceLine) {\n return parseUiBindingValue(context, line.content.substring('context'.length).trim(), line);\n}\n\nfunction parseComponentProperty(context: ParserContext, line: SourceLine, properties: ComponentPropertySyntax[]): void {\n const bound = componentPropertyBinding.exec(line.content);\n if (bound !== null) {\n properties.push({ kind: 'ComponentPropertySyntax', property: bound[1], binding: parseFromClause(context, bound[2], locationOf(line)), value: null, location: locationOf(line) });\n return;\n }\n const literal = componentPropertyLiteral.exec(line.content);\n if (literal !== null) {\n properties.push({ kind: 'ComponentPropertySyntax', property: literal[1], binding: null, value: parseMappingSource(literal[2], locationOf(line), context), location: locationOf(line) });\n return;\n }\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component property '${line.content}' - expected 'property <path> from <binding>' or 'property <path> = <literal|object|array|null>'`, locationOf(line));\n}\n\nfunction parseStableId(context: ParserContext, line: SourceLine): string | null {\n const match = stableId.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid component id '${line.content}' - expected 'id \"stable-id\"'`, locationOf(line));\n return null;\n }\n return operandText(match, 1);\n}\n\nfunction parseExposedValue(context: ParserContext, line: SourceLine, values: ComponentExposedValueSyntax[]): void {\n const match = exposes.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid exposed value '${line.content}' - expected 'exposes <name> from <binding>'`, locationOf(line));\n return;\n }\n values.push({ kind: 'ComponentExposedValueSyntax', name: match[1], binding: parseFromClause(context, match[2], locationOf(line)), location: locationOf(line) });\n}\n\nfunction parsePresentationValue(context: ParserContext, line: SourceLine, values: PresentationValueSyntax[]): void {\n const match = presentation.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid presentation value '${line.content}' - expected 'presentation <key> \"value\"'`, locationOf(line));\n return;\n }\n values.push({ kind: 'PresentationValueSyntax', name: match[1], value: operandText(match, 2), location: locationOf(line) });\n}\n\nfunction parseToolbar(context: ParserContext, line: SourceLine): ScreenToolbarSyntax {\n const name = line.content.substring('toolbar'.length).trim();\n const items: ToolbarItemSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const item = parseToolbarItem(context, child);\n if (item !== undefined) items.push(item);\n }\n return { kind: 'ScreenToolbarSyntax', name, items, location: locationOf(line) };\n}\n\nfunction parseToolbarItem(context: ParserContext, line: SourceLine): ToolbarItemSyntax | undefined {\n const match = toolbarItem.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.UnknownScreenDirective, `Invalid toolbar item '${line.content}' - expected 'item <name> action <Command>', 'item <name> navigate to <Screen>' or 'item <name> dialog <DialogTemplate>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n let itemLabel = null;\n let icon = null;\n const parameters: ScreenNavigationParameterSyntax[] = [];\n const presentationValues: PresentationValueSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const labelMatch = label.exec(child.content);\n if (labelMatch !== null) {\n itemLabel = operandText(labelMatch, 1);\n continue;\n }\n const parameterMatch = parameter.exec(child.content);\n if (parameterMatch !== null) {\n parameters.push({ kind: 'ScreenNavigationParameterSyntax', name: parameterMatch[1], binding: parseFromClause(context, parameterMatch[2], locationOf(child)), location: locationOf(child) });\n continue;\n }\n if (firstWord(child.content) === 'icon') {\n icon = child.content.substring('icon'.length).trim();\n continue;\n }\n parsePresentationValue(context, child, presentationValues);\n }\n const syntaxKind: ToolbarItemKind = match[2] === 'navigate' ? 'Navigate' : match[2] === 'dialog' ? 'Dialog' : 'Action';\n return { kind: 'ToolbarItemSyntax', name: match[1], syntaxKind, target: match[3], label: itemLabel, icon, parameters, presentation: presentationValues, location: locationOf(line) };\n}\n\nfunction parseUiBindingValue(context: ParserContext, text: string, line: SourceLine) {\n return parseFromClause(context, text, locationOf(line));\n}\n\nfunction parseCode(context: ParserContext, line: SourceLine): ScreenCodeSyntax | undefined {\n const language = line.content.startsWith('```') ? line.content.substring(3) : line.content;\n if (!context.languages.has(language)) {\n context.error(DiagnosticCodes.ExpectedCodeFence, `Expected a registered language on the opening fence, not '${line.content}'`, locationOf(line));\n return undefined;\n }\n if (!line.content.startsWith('```')) {\n context.warning(DiagnosticCodes.LegacyInlineCodeFence, `'${language}' on its own line is deprecated - use '\\`\\`\\`${language}' instead`, locationOf(line));\n }\n const code = parseFencedText(context, language, line);\n return code === null ? undefined : {\n kind: 'ScreenCodeSyntax',\n code: { kind: 'CodeBlockSyntax', language, code, location: locationOf(line) },\n location: locationOf(line),\n };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { CaptureSyntax } from '../Syntax/Captures';\nimport { CommandSyntax } from '../Syntax/Commands';\nimport { ConstraintSyntax } from '../Syntax/Constraints';\nimport { EventSyntax, ReadModelSyntax } from '../Syntax/Declarations';\nimport { ProjectionSyntax } from '../Syntax/Projections';\nimport { QuerySyntax } from '../Syntax/Queries';\nimport { ReactionSyntax } from '../Syntax/Reactions';\nimport { ScreenSyntax } from '../Syntax/Screens';\nimport { SpecificationExampleSyntax, SpecificationSyntax } from '../Syntax/Specifications';\nimport { SliceSyntax, SliceType, sliceTypes } from '../Syntax/Structure';\nimport { pattern } from '../Text/patterns';\nimport { TranslationDirection } from '../Syntax/TranslationDirection';\nimport { parseCapture } from './CaptureParser';\nimport { parseCommand } from './CommandParser';\nimport { dependencySources, ReducerSyntax } from '../Syntax/DependencySources';\nimport { captureReducer } from './DependencySourceParser';\nimport { parseConstraint } from './ConstraintParser';\nimport { parseEvent, parseReadModel } from './DeclarationParsers';\nimport { parseDescription } from './DescriptionParser';\nimport { PurposeReferenceSyntax } from '../Syntax/Purposes';\nimport { parsePurposeReference } from './PurposeParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { isFileDirective } from './FileReferences';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseOperation } from './OperationParser';\nimport { OperationSyntax } from '../Syntax/Operations';\nimport { parseProjection } from './ProjectionParser';\nimport { parseQuery } from './QueryParser';\nimport { parseReaction } from './ReactionParser';\nimport { parseScreen } from './ScreenParser';\nimport { parseExample } from './SpecificationExampleParser';\nimport { parseSpecification } from './SpecificationParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst header = pattern('^slice\\\\s+([A-Za-z]\\\\w*)\\\\s+([A-Za-z_]\\\\w*)$');\n\n// Slice members the C# compiler knows that this compiler does not model yet. They are skipped whole rather\n// than reported - the C# compiler and the editor diagnostics remain the authority on whether they are valid.\nconst opaqueMembers = new Set(['reducer']);\n\nexport function parseSlice(context: ParserContext, line: SourceLine): SliceSyntax {\n const match = header.exec(line.content);\n let type: SliceType = 'StateChange';\n let name = '';\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSliceDeclaration, `Invalid slice declaration '${line.content}' - expected 'slice <Type> <Name>'`, locationOf(line));\n } else {\n name = match[2];\n if ((sliceTypes as readonly string[]).includes(match[1])) {\n type = match[1] as SliceType;\n } else {\n context.error(DiagnosticCodes.UnknownSliceType, `Unknown slice type '${match[1]}' - expected StateChange, StateView, Automation or Translate`, locationOf(line));\n }\n }\n const previous = context.scope;\n context.scope = [...previous, name];\n let direction: TranslationDirection | null = null;\n let hasDirection = false;\n let description: string | null = null;\n let documentation: string | null = null;\n const events: EventSyntax[] = [];\n const operations: OperationSyntax[] = [];\n const commands: CommandSyntax[] = [];\n const queries: QuerySyntax[] = [];\n const projections: ProjectionSyntax[] = [];\n const reactions: ReactionSyntax[] = [];\n const captures: CaptureSyntax[] = [];\n const constraints: ConstraintSyntax[] = [];\n const specifications: SpecificationSyntax[] = [];\n const examples: SpecificationExampleSyntax[] = [];\n const purposes: PurposeReferenceSyntax[] = [];\n const readModels: ReadModelSyntax[] = [];\n const screens: ScreenSyntax[] = [];\n const reducers: ReducerSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (isFileDirective(child)) {\n continue;\n }\n const metadataWord = child.content.split(/[ \\t]/, 1)[0];\n const keyword = metadataWord === 'public' || metadataWord === 'direction' ? metadataWord : firstWord(child.content);\n if (keyword === 'description') {\n description = parseDescription(context, child, description, `Slice '${name}'`);\n } else if (keyword === 'documentation') {\n documentation = parseDocumentation(context, child, documentation, `Slice '${name}'`);\n } else if (keyword === 'purpose') {\n parsePurposeReference(context, child, purposes);\n } else if (keyword === 'operation') {\n operations.push(parseOperation(context, child).operation);\n } else if (keyword === 'direction') {\n const directionMatch = /^direction\\s+(inbound|outbound)$/.exec(child.content);\n if (hasDirection || type !== 'Translate' || directionMatch === null) {\n context.error(DiagnosticCodes.InvalidSliceDeclaration, 'Declare direction inbound or direction outbound once, inside a Translate slice only', locationOf(child));\n } else {\n direction = directionMatch[1] === 'inbound' ? TranslationDirection.Inbound : TranslationDirection.Outbound;\n }\n hasDirection = true;\n } else if (keyword === 'event' || keyword === 'public') {\n events.push(parseEvent(context, child));\n } else if (keyword === 'command') {\n commands.push(parseCommand(context, child));\n } else if (keyword === 'query') {\n queries.push(parseQuery(context, child));\n } else if (keyword === 'projection') {\n projections.push(parseProjection(context, child));\n } else if (keyword === 'capture') {\n captures.push(parseCapture(context, child));\n } else if (keyword === 'reaction') {\n reactions.push(parseReaction(context, child));\n } else if (keyword === 'constraint') {\n constraints.push(parseConstraint(context, child));\n } else if (keyword === 'example') {\n examples.push(parseExample(context, child));\n } else if (keyword === 'specification') {\n specifications.push(parseSpecification(context, child));\n } else if (keyword === 'readmodel') {\n readModels.push(parseReadModel(context, child));\n } else if (keyword === 'screen') {\n screens.push(parseScreen(context, child));\n } else if (opaqueMembers.has(keyword)) {\n reducers.push(captureReducer(context, child));\n context.skipOpaqueBlock(child.indent);\n } else {\n context.warning(DiagnosticCodes.UnknownSliceDirective, `Unknown construct '${keyword}' in slice '${name}'`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n context.scope = previous;\n const syntax: SliceSyntax = {\n kind: 'SliceSyntax', type, name, direction, description, documentation, examples, purposes, events, operations, commands, queries, projections, captures, reactions, constraints, specifications, readModels, screens,\n location: locationOf(line),\n };\n dependencySources.set(syntax, { reducers });\n return syntax;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { AuthorizeSyntax } from '../Syntax/Authorization';\nimport { SpecificationExampleSyntax } from '../Syntax/Specifications';\nimport { DependsOnSyntax, FeatureSyntax, FileImportSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { pattern } from '../Text/patterns';\nimport { combineAuthorize, parseAuthorize } from './AuthorizeParser';\nimport { parseDescription } from './DescriptionParser';\nimport { PurposeReferenceSyntax } from '../Syntax/Purposes';\nimport { parsePurposeReference } from './PurposeParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { parseDependsOn } from './DependsOnParser';\nimport { parseFileImport } from './FileImportParser';\nimport { collectInputUses } from './InputUses';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseExample } from './SpecificationExampleParser';\nimport { parseSlice } from './SliceParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst featurePattern = pattern('^feature\\\\s+([A-Za-z_]\\\\w*)$');\n\n// Feature members the C# compiler knows that this compiler does not model. They are skipped whole, not reported.\nconst opaqueFeatureMembers = new Set(['on', 'uses', 'contribute']);\n\n// What a feature body may hold, as it reads in a diagnostic.\nexport const featureBodyExpected = 'description, documentation, depends on <Name>, authorize, import, feature, slice, contribute, example, \\'on <trigger>\\' or \\'uses <Behavior>\\'';\n\n// Collects the body of a feature - written beneath a 'feature' header, or at the top level of a file imported\n// into the feature. The port of the C# FeatureBody.\nexport class FeatureBody {\n readonly #features: FeatureSyntax[] = [];\n readonly #slices: SliceSyntax[] = [];\n readonly #examples: SpecificationExampleSyntax[] = [];\n readonly #fileImports: FileImportSyntax[] = [];\n readonly #dependsOn: DependsOnSyntax[] = [];\n readonly #purposes: PurposeReferenceSyntax[] = [];\n #description: string | null = null;\n #documentation: string | null = null;\n #authorize: AuthorizeSyntax | null = null;\n\n constructor(readonly name: string) {}\n\n // Parses one already consumed line of the body; false when the line does not belong to a feature body,\n // and nothing was reported.\n tryParse(context: ParserContext, line: SourceLine): boolean {\n const keyword = firstWord(line.content);\n switch (keyword) {\n case 'description':\n this.#description = parseDescription(context, line, this.#description, `Feature '${this.name}'`);\n return true;\n case 'documentation':\n this.#documentation = parseDocumentation(context, line, this.#documentation, `Feature '${this.name}'`);\n return true;\n case 'depends':\n parseDependsOn(context, line, this.#dependsOn, DiagnosticCodes.UnknownFeatureDirective);\n return true;\n case 'purpose':\n parsePurposeReference(context, line, this.#purposes);\n return true;\n case 'authorize':\n this.#authorize = combineAuthorize(this.#authorize, parseAuthorize(context, line));\n return true;\n case 'import':\n parseFileImport(context, line, this.#fileImports);\n return true;\n case 'feature':\n this.#features.push(parseFeature(context, line));\n return true;\n case 'example':\n this.#examples.push(parseExample(context, line));\n return true;\n case 'slice':\n this.#slices.push(parseSlice(context, line));\n return true;\n default:\n if (opaqueFeatureMembers.has(keyword)) {\n collectInputUses(context, line);\n return true;\n }\n return false;\n }\n }\n\n // Builds the feature, located at its header or, when it only places an imported file, at that file.\n build(location: SourceLocation, isPlacement = false): FeatureSyntax {\n return {\n kind: 'FeatureSyntax',\n name: this.name,\n description: this.#description,\n documentation: this.#documentation,\n authorize: this.#authorize,\n dependsOn: this.#dependsOn,\n purposes: this.#purposes,\n features: this.#features,\n slices: this.#slices,\n examples: this.#examples,\n fileImports: this.#fileImports,\n isPlacement,\n location,\n };\n }\n}\n\n// Parses a feature from its already consumed header line.\nexport function parseFeature(context: ParserContext, line: SourceLine): FeatureSyntax {\n const name = featurePattern.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidFeatureDeclaration, `Invalid feature declaration '${line.content}' - expected 'feature <Name>'`, locationOf(line));\n }\n const body = new FeatureBody(name);\n const previous = context.scope;\n context.scope = [...previous, name];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (!body.tryParse(context, child)) {\n context.error(DiagnosticCodes.UnknownFeatureDirective, `Unexpected '${firstWord(child.content)}' in feature body - expected ${featureBodyExpected}`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n context.scope = previous;\n return body.build(locationOf(line));\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { AuthorizeSyntax } from '../Syntax/Authorization';\nimport { SpecificationExampleSyntax } from '../Syntax/Specifications';\nimport { DependsOnSyntax, FeatureSyntax, FileImportSyntax, ModuleSyntax } from '../Syntax/Structure';\nimport { pattern } from '../Text/patterns';\nimport { combineAuthorize, parseAuthorize } from './AuthorizeParser';\nimport { parseDescription } from './DescriptionParser';\nimport { PurposeReferenceSyntax } from '../Syntax/Purposes';\nimport { parsePurposeReference } from './PurposeParser';\nimport { parseDocumentation } from './DocumentationParser';\nimport { parseDependsOn } from './DependsOnParser';\nimport { parseFeature } from './FeatureBody';\nimport { parseFileImport } from './FileImportParser';\nimport { collectInputUses } from './InputUses';\nimport { firstWord } from './LineText';\nimport { parseExample } from './SpecificationExampleParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nexport const modulePattern = pattern('^module\\\\s+([A-Za-z_]\\\\w*)$');\n\n// Module members the C# compiler knows that this compiler does not model. They are skipped whole, not reported.\nconst opaqueModuleMembers = new Set(['on', 'uses', 'screen', 'dialog', 'form', 'contribute']);\n\n// What a module body may hold, as it reads in a diagnostic.\nexport const moduleBodyExpected = 'description, documentation, depends on <Name>, authorize, import, screen template, dialog template, form, contribute, feature, example, \\'on <trigger>\\' or \\'uses <Behavior>\\'';\n\n// Collects the body of a module - written beneath a 'module' header, or at the top level of a file imported\n// into the module. The port of the C# ModuleBody.\nexport class ModuleBody {\n readonly #features: FeatureSyntax[] = [];\n readonly #examples: SpecificationExampleSyntax[] = [];\n readonly #fileImports: FileImportSyntax[] = [];\n readonly #dependsOn: DependsOnSyntax[] = [];\n readonly #purposes: PurposeReferenceSyntax[] = [];\n #description: string | null = null;\n #documentation: string | null = null;\n #authorize: AuthorizeSyntax | null = null;\n\n constructor(readonly name: string) {}\n\n // Parses one already consumed line of the body; false when the line does not belong to a module body,\n // and nothing was reported.\n tryParse(context: ParserContext, line: SourceLine): boolean {\n const keyword = firstWord(line.content);\n switch (keyword) {\n case 'description':\n this.#description = parseDescription(context, line, this.#description, `Module '${this.name}'`);\n return true;\n case 'documentation':\n this.#documentation = parseDocumentation(context, line, this.#documentation, `Module '${this.name}'`);\n return true;\n case 'depends':\n parseDependsOn(context, line, this.#dependsOn, DiagnosticCodes.UnknownModuleDirective);\n return true;\n case 'purpose':\n parsePurposeReference(context, line, this.#purposes);\n return true;\n case 'authorize':\n this.#authorize = combineAuthorize(this.#authorize, parseAuthorize(context, line));\n return true;\n case 'import':\n parseFileImport(context, line, this.#fileImports);\n return true;\n case 'example':\n this.#examples.push(parseExample(context, line));\n return true;\n case 'feature':\n this.#features.push(parseFeature(context, line));\n return true;\n default:\n if (opaqueModuleMembers.has(keyword)) {\n collectInputUses(context, line);\n return true;\n }\n return false;\n }\n }\n\n // Parses the children of a header line into this body, reporting what does not belong in a module.\n parseChildren(context: ParserContext, line: SourceLine): void {\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (!this.tryParse(context, child)) {\n context.error(DiagnosticCodes.UnknownModuleDirective, `Unexpected '${firstWord(child.content)}' in module body - expected ${moduleBodyExpected}`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n }\n\n // Builds the module, located at its header or, when it only places an imported file, at that file.\n build(location: SourceLocation, isPlacement = false): ModuleSyntax {\n return {\n kind: 'ModuleSyntax',\n name: this.name,\n description: this.#description,\n documentation: this.#documentation,\n authorize: this.#authorize,\n dependsOn: this.#dependsOn,\n purposes: this.#purposes,\n features: this.#features,\n examples: this.#examples,\n fileImports: this.#fileImports,\n isPlacement,\n location,\n };\n }\n}\n\n// Parses a module from its already consumed header line.\nexport function parseModule(context: ParserContext, line: SourceLine): ModuleSyntax {\n const name = modulePattern.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidModuleDeclaration, `Invalid module declaration '${line.content}' - expected 'module <Name>'`, locationOf(line));\n }\n const body = new ModuleBody(name);\n const previous = context.scope;\n context.scope = [name];\n body.parseChildren(context, line);\n context.scope = previous;\n return body.build(locationOf(line));\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiscoveredImport, placementFrom } from '../Parsing/ImportDiscovery';\nimport { discoverImports, parseForAuthoring } from '../ScreenplayCompiler';\nimport { ApplicationSyntax, FeatureSyntax } from '../Syntax/Structure';\nimport { PlacedPlayDocument } from './PlayDocumentSource';\nimport { matchesPlayPattern, normalizePlayPath, resolvePlayPattern } from './PlayGlob';\nimport { samePlacement } from './PlayPlacement';\nimport { AuthoredDeclaration } from './AuthoredDeclaration';\n\n// Presentation metadata never enters syntax JSON, semantic bytes or identity. Merging and diagnostics\n// still use the original document order; only a consumer explicitly requesting authored order sees it.\nconst orders = new WeakMap<ApplicationSyntax, ReadonlyMap<string, number>>();\nexport const authoredOrderKey = (scope: readonly string[]): string => JSON.stringify(scope);\n\nexport function authoredOrderOf(application: ApplicationSyntax): ReadonlyMap<string, number> {\n return orders.get(application) ?? new Map();\n}\n\n// A board may narrow an application without changing the order of its remaining declarations.\nexport function copyAuthoredOrder(original: ApplicationSyntax, narrowed: ApplicationSyntax): ApplicationSyntax {\n const order = orders.get(original);\n if (order !== undefined) orders.set(narrowed, order);\n return narrowed;\n}\n\nfunction declarations(application: ApplicationSyntax): AuthoredDeclaration[] {\n const found: AuthoredDeclaration[] = [];\n const feature = (syntax: FeatureSyntax, outer: readonly string[]) => {\n const scope = [...outer, syntax.name];\n found.push({ scope, ...syntax.location, implicit: syntax.isPlacement, isContainer: true });\n syntax.features.forEach(child => feature(child, scope));\n syntax.slices.forEach(slice => found.push({ scope: [...scope, slice.name], ...slice.location, implicit: false, isContainer: false }));\n };\n application.modules.forEach(module => {\n found.push({ scope: [module.name], ...module.location, implicit: module.isPlacement, isContainer: true });\n module.features.forEach(child => feature(child, [module.name]));\n });\n return found;\n}\n\n// A root's explicit declarations, or those in an enclosing container's own named file, define container\n// order before globbed slice files that merely restate the same containers. Prefer the outer named\n// composite, then the shallower path; absent one, the text walk keeps the first explicit occurrence.\nfunction containerOwners(own: ReadonlyMap<string, readonly AuthoredDeclaration[]>, roots: ReadonlySet<string>): ReadonlyMap<string, string> {\n const owners = new Map<string, { path: string; priority: number; depth: number }>();\n for (const [path, declarations] of own) {\n const segments = path.split('/');\n const name = segments[segments.length - 1].slice(0, -5);\n for (const declaration of declarations.filter(declaration => declaration.isContainer && !declaration.implicit)) {\n const ancestor = declaration.scope.indexOf(name);\n if (!roots.has(path) && ancestor === -1) continue;\n const priority = roots.has(path) ? 0 : ancestor + 1;\n const key = authoredOrderKey(declaration.scope);\n const current = owners.get(key);\n if (current === undefined || priority < current.priority || (priority === current.priority && segments.length < current.depth)) {\n owners.set(key, { path, priority, depth: segments.length });\n }\n }\n }\n return new Map([...owners].map(([key, owner]) => [key, owner.path]));\n}\n\n// Walk text, not the merged tree: placement stubs must not claim the position of a declaration that is\n// written elsewhere. Expand an import only if it contributes the file's settled (deepest) placement.\nexport function recordAuthoredOrder(application: ApplicationSyntax, roots: readonly string[], documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>, parsed?: ReadonlyMap<string, ApplicationSyntax>, imports?: ReadonlyMap<string, readonly DiscoveredImport[]>): void {\n const files = new Map(documents.map(document => [document.path, document]));\n const own = new Map(documents.filter(document => document.isPlacementResolved !== false).map(document => [document.path, declarations(parsed?.get(document.path) ?? parseForAuthoring(document.source, document.path, document.placement, false, undefined, languages).value)]));\n const owners = containerOwners(own, new Set(roots.map(normalizePlayPath)));\n const explicit = new Set([...own.values()].flat().filter(declaration => !declaration.implicit).map(declaration => authoredOrderKey(declaration.scope)));\n const order = new Map<string, number>();\n const visited = new Set<string>();\n const visit = (path: string) => {\n const document = files.get(path);\n if (document === undefined || document.isPlacementResolved === false || visited.has(path)) return;\n visited.add(path);\n const entries = [\n ...(own.get(path) ?? []).filter(declaration => {\n const key = authoredOrderKey(declaration.scope);\n return (!declaration.implicit || !explicit.has(key)) && (!declaration.isContainer || !owners.has(key) || owners.get(key) === path);\n })\n .map(declaration => ({ line: declaration.line, column: declaration.column, run: () => {\n const key = authoredOrderKey(declaration.scope);\n if (!order.has(key)) order.set(key, order.size);\n } })),\n ...(imports?.get(path) ?? discoverImports(document.source, path, languages)).map(imported => ({\n ...imported.fileImport.location,\n run: () => {\n const placement = placementFrom(imported, document.placement);\n if (placement === undefined) return;\n const pattern = resolvePlayPattern(path, imported.fileImport.pattern);\n [...files.keys()].filter(target => target !== path && matchesPlayPattern(pattern, target)).sort().forEach(target => {\n if (samePlacement(files.get(target)!.placement, placement)) visit(target);\n });\n },\n })),\n ];\n entries.sort((left, right) => left.line - right.line || left.column - right.column).forEach(entry => entry.run());\n };\n roots.map(normalizePlayPath).forEach(path => {\n const document = files.get(path);\n // A broad root glob can discover a file before the import that actually places it.\n if (document?.placement.length === 0) visit(path);\n });\n orders.set(application, order);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// String values follow the C# graph's reference-role contract, like the compiler's syntax kind unions.\nexport const dependencyKinds = ['usesFactsFrom', 'reactsTo', 'decidesFrom', 'asks', 'shows', 'verifiedWith', 'outsideTheModel'] as const;\nexport type DependencyKind = typeof dependencyKinds[number];\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nexport class InvalidDependencyQuery extends Error {}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { PolicyReferenceSyntax } from '../Syntax/Authorization';\nimport { CommandSyntax } from '../Syntax/Commands';\nimport { ConstraintSyntax } from '../Syntax/Constraints';\nimport { TypeRefSyntax } from '../Syntax/Declarations';\nimport { dependencySourcesOf, ConcurrencySyntax, FormPopulateViaQuerySyntax, FormSyntax, ReadsSyntax, ReducerRuleSyntax } from '../Syntax/DependencySources';\nimport { EventSpecSyntax, JoinEventSyntax, ProjectionSyntax, ProjectionBlockSyntax, ProjectionVariantSyntax, ProjectionEntersOnSyntax, RemoveWithSyntax, RemoveViaJoinSyntax, ClearWithSyntax } from '../Syntax/Projections';\nimport { InvokesSyntax, NamedTriggerSourceSyntax, ReactionTriggerSyntax } from '../Syntax/Reactions';\nimport { ScreenActionAlternativeSyntax, ScreenActionOtherwiseSyntax, ScreenActionSyntax, ScreenDataSyntax, ScreenNavigateSyntax } from '../Syntax/Screens';\nimport { ScreenplaySyntaxWalker } from '../Syntax/ScreenplaySyntaxWalker';\nimport { SpecificationSyntax, SpecificationEventSyntax, SpecificationCommandSyntax, SpecificationRedeliverySyntax } from '../Syntax/Specifications';\nimport { SliceSyntax } from '../Syntax/Structure';\nimport { SyntaxNode } from '../Syntax/SyntaxNode';\nimport type { DependencyKind, SliceReference, SharedReference, CollectedSliceReferences } from './index';\n\nexport const referenceClassifications: Readonly<Record<string, DependencyKind | null>> = {\n from: 'usesFactsFrom', join: 'usesFactsFrom', remove: 'usesFactsFrom', removeViaJoin: 'usesFactsFrom',\n clear: 'usesFactsFrom', entersOn: 'usesFactsFrom', reduces: 'usesFactsFrom', uniqueEvent: 'usesFactsFrom',\n uniqueProperty: 'usesFactsFrom', concurrency: 'usesFactsFrom', trigger: 'reactsTo', reads: 'decidesFrom',\n invokes: 'asks', action: 'asks', actionAlternative: 'asks', actionOtherwise: 'asks', formCommand: 'asks', dataQuery: 'shows', populate: 'shows', navigate: 'shows',\n whenRedeliveredEvent: 'verifiedWith', redeliveryReaction: 'verifiedWith', refusalConstraint: null, refusalProduces: null,\n specificationEvent: 'verifiedWith', givenEvent: 'verifiedWith', whenAppendedEvent: 'verifiedWith', thenEvent: 'verifiedWith', whenCommand: 'verifiedWith',\n declares: null, uses: null, commandEventSource: null, commandStream: null, specificationEventSource: null, specificationStream: null, thenOperation: null,\n givenOperationFailure: null, thenCompensated: null, produces: null, authorizes: null, queryResult: null,\n dataReadModel: null, type: null, exampleType: null, contributes: null, template: null, specificationReadModel: null,\n thenAbsentReadModel: null, thenReadModel: null, givenReadModel: null, thenQuery: null,\n compositeKeyType: null, builds: null, buildsVariant: null, appends: null, seed: null,\n};\n// No resolution or expression/code interpretation: this is the same role inventory as C# SliceReferences.\nexport function sliceReferences(slice: SliceSyntax): CollectedSliceReferences {\n const collector = new SliceReferenceCollector();\n collector.visitSlice(slice);\n return { references: collector.references.sort((left, right) => left.location.line - right.location.line || left.location.column - right.location.column), shared: collector.shared };\n}\n\nexport function buildingReadModelReferences(slice: SliceSyntax, readModel: string): readonly SliceReference[] {\n const collector = new SliceReferenceCollector(readModel);\n slice.projections.forEach(projection => collector.visitProjection(projection));\n dependencySourcesOf(slice).reducers?.filter(reducer => reducer.readModel.toLowerCase() === readModel.toLowerCase()).forEach(reducer => collector.visitReducer(reducer));\n return collector.references;\n}\n\nfunction variants(blocks: readonly ProjectionBlockSyntax[]): ProjectionVariantSyntax[] {\n return blocks.flatMap(block => block.kind === 'ProjectionVariantSyntax' ? [block, ...variants(block.blocks)] : block.kind === 'ChildrenSyntax' || block.kind === 'NestedSyntax' ? variants(block.blocks) : []);\n}\n\nexport class SliceReferenceCollector extends ScreenplaySyntaxWalker {\n readonly references: SliceReference[] = [];\n readonly shared: SharedReference[] = [];\n private specification?: SpecificationSyntax;\n private projection = false;\n\n constructor(private readonly readModel?: string) { super(); }\n\n private matches(name: string): boolean { return name.toLowerCase() === this.readModel?.toLowerCase(); }\n\n override visitSlice(syntax: SliceSyntax): void {\n super.visitSlice(syntax);\n const sources = dependencySourcesOf(syntax);\n sources.reducers?.forEach(node => this.visitReducer(node));\n }\n override visitCommand(syntax: CommandSyntax): void {\n const sources = dependencySourcesOf(syntax);\n sources.reads?.forEach(node => this.visitReads(node));\n if (sources.concurrency != null) this.visitConcurrency(sources.concurrency);\n super.visitCommand(syntax);\n }\n override visitReactionTrigger(syntax: ReactionTriggerSyntax): void {\n const sources = dependencySourcesOf(syntax);\n sources.data?.forEach(node => this.visitTriggerData(node));\n sources.reads?.forEach(node => this.visitReads(node));\n super.visitReactionTrigger(syntax);\n }\n override visitProjection(syntax: ProjectionSyntax): void {\n if (this.readModel !== undefined) {\n const found = variants(syntax.blocks);\n if (found.length === 0 ? !this.matches(syntax.readModel ?? syntax.name) : !found.some(variant => this.matches(variant.name))) return;\n }\n this.projection = true;\n super.visitProjection(syntax);\n this.projection = false;\n }\n override visitSpecification(syntax: SpecificationSyntax): void {\n this.specification = syntax;\n super.visitSpecification(syntax);\n this.specification = undefined;\n }\n override visitNode(node: SyntaxNode): void {\n const add = (name: string, targetKind: SliceReference['targetKind'], role: string) => {\n this.references.push({ name, targetKind, role, kind: referenceClassifications[role]!, location: node.location, timeline: this.projection || ['trigger', 'reads', 'reduces'].includes(role) });\n };\n switch (node.kind) {\n case 'TypeRefSyntax': {\n const name = (node as TypeRefSyntax).name;\n if (!['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime'].includes(name)) this.shared.push({ kind: 'type', name });\n break;\n }\n case 'PolicyReferenceSyntax': this.shared.push({ kind: 'policy', name: (node as PolicyReferenceSyntax).name }); break;\n case 'EventSpecSyntax': add((node as EventSpecSyntax).event, 'Event', 'from'); break;\n case 'JoinEventSyntax': add((node as JoinEventSyntax).event, 'Event', 'join'); break;\n case 'RemoveWithSyntax': add((node as RemoveWithSyntax).event, 'Event', 'remove'); break;\n case 'RemoveViaJoinSyntax': add((node as RemoveViaJoinSyntax).event, 'Event', 'removeViaJoin'); break;\n case 'ClearWithSyntax': add((node as ClearWithSyntax).event, 'Event', 'clear'); break;\n case 'ProjectionEntersOnSyntax': add((node as ProjectionEntersOnSyntax).event, 'Event', 'entersOn'); break;\n case 'ReducerRuleSyntax': add((node as ReducerRuleSyntax).event, 'Event', 'reduces'); break;\n case 'UniqueEventConstraintSyntax': add((node as Extract<ConstraintSyntax, { kind: 'UniqueEventConstraintSyntax' }>).event, 'Event', 'uniqueEvent'); break;\n case 'UniquePropertyConstraintSyntax': add((node as Extract<ConstraintSyntax, { kind: 'UniquePropertyConstraintSyntax' }>).event, 'Event', 'uniqueProperty'); break;\n case 'NamedTriggerSourceSyntax': add((node as NamedTriggerSourceSyntax).name, 'Event', 'trigger'); break;\n case 'ReadsSyntax': add((node as ReadsSyntax).readModel, 'ReadModel', 'reads'); break;\n case 'InvokesSyntax': add((node as InvokesSyntax).command, 'Command', 'invokes'); break;\n case 'ScreenActionSyntax': add((node as ScreenActionSyntax).command, 'Command', 'action'); break;\n case 'ScreenActionAlternativeSyntax': add((node as ScreenActionAlternativeSyntax).command, 'Command', 'actionAlternative'); break;\n case 'ScreenActionOtherwiseSyntax': {\n const command = (node as ScreenActionOtherwiseSyntax).command;\n if (command !== null) add(command, 'Command', 'actionOtherwise');\n break;\n }\n case 'FormSyntax': add((node as FormSyntax).for, 'Command', 'formCommand'); break;\n case 'ScreenDataSyntax': add((node as ScreenDataSyntax).query, 'Query', 'dataQuery'); break;\n case 'FormPopulateViaQuerySyntax': add((node as FormPopulateViaQuerySyntax).query, 'Query', 'populate'); break;\n case 'ScreenNavigateSyntax': add((node as ScreenNavigateSyntax).screen, 'Screen', 'navigate'); break;\n case 'SpecificationEventSyntax': add((node as SpecificationEventSyntax).eventType, 'Event', this.specification?.given.includes(node as SpecificationEventSyntax) === true ? 'givenEvent' : this.specification?.whenAppended === node ? 'whenAppendedEvent' : 'thenEvent'); break;\n case 'SpecificationCommandSyntax': add((node as SpecificationCommandSyntax).commandType, 'Command', 'whenCommand'); break;\n case 'SpecificationRedeliverySyntax': {\n const redelivery = node as SpecificationRedeliverySyntax;\n add(redelivery.eventType, 'Event', 'whenRedeliveredEvent');\n add(redelivery.reaction, 'Reaction', 'redeliveryReaction');\n break;\n }\n case 'ConcurrencySyntax': (node as ConcurrencySyntax).eventTypes.forEach(name => add(name, 'Event', 'concurrency')); break;\n }\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// Deterministic Tarjan decomposition, shared by dependency queries and timeline diagnostics.\nexport function stronglyConnectedGroups(graph: ReadonlyMap<string, ReadonlySet<string>>): string[][] {\n const indices = new Map<string, number>();\n const low = new Map<string, number>();\n const stack: string[] = [];\n const active = new Set<string>();\n const groups: string[][] = [];\n const visit = (node: string) => {\n indices.set(node, indices.size);\n low.set(node, indices.get(node)!);\n stack.push(node);\n active.add(node);\n for (const next of [...graph.get(node)!].sort()) {\n if (!indices.has(next)) {\n visit(next);\n low.set(node, Math.min(low.get(node)!, low.get(next)!));\n } else if (active.has(next)) low.set(node, Math.min(low.get(node)!, indices.get(next)!));\n }\n if (low.get(node) !== indices.get(node)) return;\n const group: string[] = [];\n let member: string;\n do {\n member = stack.pop()!;\n active.delete(member);\n group.push(member);\n } while (member !== node);\n groups.push(group.sort());\n };\n for (const node of [...graph.keys()].sort()) if (!indices.has(node)) visit(node);\n return groups;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { authoredOrderKey, authoredOrderOf } from '../Files/AuthoredOrder';\nimport { expandSpecificationExamples } from '../Parsing/SpecificationCommandExamples';\nimport { dependencySourcesOf } from '../Syntax/DependencySources';\nimport { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { ProjectionBlockSyntax, ProjectionVariantSyntax } from '../Syntax/Projections';\nimport { ApplicationSyntax, FeatureSyntax, SliceSyntax } from '../Syntax/Structure';\nimport type { DependencyKind, DependencyNode, DependencyLevel, DependencyEvidence, DependencyEdge, UnresolvedDependency, ImpliedDependency, DependencyGroup, DependencyOrder, DependencyContainerOrder } from './index';\nimport { dependencyKinds } from './DependencyKind';\nimport { InvalidDependencyQuery } from './InvalidDependencyQuery';\nimport { SiblingEdge } from './SiblingEdge';\nimport { sliceReferences } from './SliceReferences';\nimport { stronglyConnectedGroups } from './StronglyConnectedGroups';\n\nconst orderingKinds: readonly string[] = ['usesFactsFrom', 'reactsTo', 'decidesFrom'];\nconst ordinal = (left: string, right: string): number => left < right ? -1 : left > right ? 1 : 0;\nconst declarationKey = (kind: string, name: string): string => JSON.stringify([kind, name.toLowerCase()]);\nconst nodeOf = (kind: DependencyLevel, address: string, scope: readonly string[], rank: number): DependencyNode => ({ kind, address, scope, rank, key: `${kind}:${address}` });\nconst compareNodes = (left: DependencyNode, right: DependencyNode): number => left.rank - right.rank || ordinal(left.key, right.key);\nconst distinctNodes = (nodes: Iterable<DependencyNode>): DependencyNode[] => [...new Map([...nodes].map(node => [node.key, node])).values()].sort(compareNodes);\nconst compareEvidence = (left: DependencyEvidence, right: DependencyEvidence): number => left.consumer.rank - right.consumer.rank || left.location.line - right.location.line || left.location.column - right.location.column || dependencyKinds.indexOf(left.kind) - dependencyKinds.indexOf(right.kind) || left.producer.rank - right.producer.rank || ordinal(left.location.path ?? '', right.location.path ?? '') || ordinal(left.role, right.role) || ordinal(left.name, right.name);\n\nfunction variants(blocks: readonly ProjectionBlockSyntax[]): ProjectionVariantSyntax[] {\n return blocks.flatMap(block => block.kind === 'ProjectionVariantSyntax' ? [block, ...variants(block.blocks)] : block.kind === 'ChildrenSyntax' || block.kind === 'NestedSyntax' ? variants(block.blocks) : []);\n}\n\n/** Presentation dependencies inferred from explicit syntax, independently of executable binding and identity. */\nexport class DependencyGraph {\n readonly orderSource: 'authored' | 'syntax';\n readonly edges: readonly DependencyEdge[];\n readonly unresolved: readonly UnresolvedDependency[];\n readonly excludedReferences: number;\n readonly unusedImports: readonly string[];\n private readonly modelNodes: DependencyNode[] = [];\n private readonly slices: { node: DependencyNode; syntax: SliceSyntax }[] = [];\n private readonly children = new Map<string, DependencyNode[]>();\n private readonly byKey = new Map<string, DependencyNode>();\n private readonly parents = new Map<string, DependencyNode>();\n private readonly root = nodeOf('application', '', [], -1);\n\n static for(application: ApplicationSyntax, ranks: ReadonlyMap<string, number> = authoredOrderOf(application)): DependencyGraph {\n return new DependencyGraph(application, ranks);\n }\n\n get nodes(): readonly DependencyNode[] { return this.modelNodes; }\n\n private constructor(application: ApplicationSyntax, ranks: ReadonlyMap<string, number>) {\n application = expandSpecificationExamples(application);\n this.orderSource = ranks.size > 0 ? 'authored' : 'syntax';\n this.children.set(this.root.key, []);\n const ordered = <T extends { name: string }>(items: readonly T[], parent: DependencyNode): T[] => items\n .map((syntax, index) => ({ syntax, index, rank: ranks.get(authoredOrderKey([...parent.scope, syntax.name])) ?? Number.MAX_SAFE_INTEGER }))\n .sort((left, right) => left.rank - right.rank || left.index - right.index).map(item => item.syntax);\n const feature = (syntax: FeatureSyntax, parent: DependencyNode) => {\n const node = this.add('feature', syntax.name, parent);\n for (const slice of ordered(syntax.slices, node)) this.slices.push({ node: this.add('slice', slice.name, node), syntax: slice });\n for (const child of ordered(syntax.features, node)) feature(child, node);\n };\n for (const module of ordered(application.modules, this.root)) {\n const node = this.add('module', module.name, this.root);\n for (const child of ordered(module.features, node)) feature(child, node);\n }\n const declarations = new Map<string, DependencyNode[]>();\n const builders = new Map<string, DependencyNode[]>();\n const declare = (inventory: Map<string, DependencyNode[]>, kind: string, name: string, node: DependencyNode) => {\n const key = declarationKey(kind, name);\n if (!inventory.has(key)) inventory.set(key, []);\n const owners = inventory.get(key)!;\n if (!owners.includes(node)) owners.push(node);\n const qualified = declarationKey(kind, [...node.scope, name].join('.'));\n if (!inventory.has(qualified)) inventory.set(qualified, []);\n const scopedOwners = inventory.get(qualified)!;\n if (!scopedOwners.includes(node)) scopedOwners.push(node);\n };\n for (const { node, syntax } of this.slices) {\n for (const event of eventDeclarations(syntax)) declare(declarations, 'Event', event.name, node);\n for (const command of syntax.commands) declare(declarations, 'Command', command.name, node);\n for (const reaction of syntax.reactions) declare(declarations, 'Reaction', reaction.name, node);\n for (const query of syntax.queries) declare(declarations, 'Query', query.name, node);\n for (const screen of syntax.screens) declare(declarations, 'Screen', screen.name, node);\n for (const readModel of syntax.readModels) declare(declarations, 'ReadModel', readModel.name, node);\n for (const projection of syntax.projections) {\n const found = variants(projection.blocks);\n if (found.length === 0) declare(builders, 'ReadModel', projection.readModel ?? projection.name, node);\n for (const variant of found) declare(builders, 'ReadModel', variant.name, node);\n }\n for (const reducer of dependencySourcesOf(syntax).reducers ?? []) declare(builders, 'ReadModel', reducer.readModel, node);\n }\n const foundations = new Set((application.declaredTriggers ?? []).map(trigger => trigger.name.toLowerCase()));\n const sharedTypes = new Set([...application.concepts, ...application.types].map(type => type.name.toLowerCase()));\n const sharedPolicies = new Set((application.policies ?? []).map(policy => policy.name.toLowerCase()));\n const imports = application.imports.filter(imported => imported.qualifiedName.includes('.')).slice().sort((left, right) => ordinal(left.location.path ?? '', right.location.path ?? '') || left.location.line - right.location.line || left.location.column - right.location.column || ordinal(left.qualifiedName, right.qualifiedName));\n const contexts = new Map<string, DependencyNode>();\n const evidence: DependencyEvidence[] = [];\n const unresolved: UnresolvedDependency[] = [];\n const usedImports = new Set<string>();\n let excluded = 0;\n for (const { node, syntax } of this.slices) {\n const collected = sliceReferences(syntax);\n excluded += collected.shared.filter(reference => (reference.kind === 'type' ? sharedTypes : sharedPolicies).has(reference.name.toLowerCase())).length;\n for (const reference of collected.references) {\n const key = declarationKey(reference.targetKind, reference.name);\n const inventory = reference.targetKind === 'ReadModel' && builders.has(key) ? builders : declarations;\n const candidates = inventory.get(key);\n if (candidates !== undefined && candidates.length > 0) {\n const producer = candidates[0];\n if (producer !== node) evidence.push({ consumer: node, producer, kind: reference.kind, role: reference.role, name: reference.name, ambiguous: candidates.length > 1, alternatives: candidates.slice(1), location: reference.location, testOnly: reference.kind === 'verifiedWith' });\n continue;\n }\n const imported = reference.targetKind === 'Event' ? imports.filter(imported => imported.qualifiedName.slice(imported.qualifiedName.lastIndexOf('.') + 1).toLowerCase() === reference.name.toLowerCase()) : [];\n if (imported.length > 0) {\n const matches: DependencyNode[] = [];\n for (const contract of imported) {\n usedImports.add(contract.qualifiedName);\n const contextName = contract.qualifiedName.slice(0, contract.qualifiedName.lastIndexOf('.'));\n const address = `context:${contextName}`;\n if (!contexts.has(address)) {\n const context = nodeOf('context', address, [contextName], this.modelNodes.length);\n this.modelNodes.push(context);\n contexts.set(address, context);\n }\n const context = contexts.get(address)!;\n if (!matches.includes(context)) matches.push(context);\n }\n evidence.push({ consumer: node, producer: matches[0], kind: 'outsideTheModel', role: reference.role, name: reference.name, ambiguous: matches.length > 1, alternatives: matches.slice(1), location: reference.location, testOnly: reference.kind === 'verifiedWith' });\n continue;\n }\n if (reference.role === 'trigger' && foundations.has(reference.name.toLowerCase())) {\n excluded++;\n continue;\n }\n unresolved.push({ consumer: node, kind: reference.kind, role: reference.role, name: reference.name, location: reference.location });\n }\n }\n const edgeGroups = new Map<string, DependencyEvidence[]>();\n for (const item of evidence.sort(compareEvidence)) {\n const key = JSON.stringify([item.consumer.key, item.producer.key, item.kind]);\n if (!edgeGroups.has(key)) edgeGroups.set(key, []);\n edgeGroups.get(key)!.push(item);\n }\n this.edges = [...edgeGroups.values()].map(group => ({ consumer: group[0].consumer, producer: group[0].producer, kind: group[0].kind, evidence: group }));\n this.unresolved = unresolved.sort((left, right) => left.consumer.rank - right.consumer.rank || left.location.line - right.location.line || left.location.column - right.location.column || dependencyKinds.indexOf(left.kind) - dependencyKinds.indexOf(right.kind) || ordinal(left.location.path ?? '', right.location.path ?? '') || ordinal(left.name, right.name));\n this.excludedReferences = excluded;\n this.unusedImports = [...new Set(imports.filter(imported => !usedImports.has(imported.qualifiedName)).map(imported => imported.qualifiedName))];\n }\n\n /** Aggregate any level pair, excluding equal and overlapping containers. Counts include capped evidence. */\n implied(from: string, to: string, kinds?: Iterable<string>, includeTestOnly = false, evidenceLimit = 3): ImpliedDependency[] {\n if (!['slice', 'feature', 'module'].includes(from)) throw new InvalidDependencyQuery(`Unsupported source level '${from}'.`);\n if (!['slice', 'feature', 'module', 'context'].includes(to)) throw new InvalidDependencyQuery(`Unsupported target level '${to}'.`);\n if (evidenceLimit < 0) throw new InvalidDependencyQuery('Evidence limit must not be negative.');\n const groups = new Map<string, { source: DependencyNode; target: DependencyNode; evidence: DependencyEvidence[] }>();\n for (const item of this.evidence(kinds, includeTestOnly)) {\n for (const source of this.at(item.consumer, from)) {\n for (const target of this.at(item.producer, to).filter(target => this.disjoint(source, target))) {\n const key = JSON.stringify([source.key, target.key]);\n if (!groups.has(key)) groups.set(key, { source, target, evidence: [] });\n groups.get(key)!.evidence.push(item);\n }\n }\n }\n return [...groups.values()].sort((left, right) => left.source.rank - right.source.rank || left.target.rank - right.target.rank || ordinal(left.source.key, right.source.key) || ordinal(left.target.key, right.target.key)).map(group => {\n const evidence = group.evidence.sort(compareEvidence);\n const byKind: Partial<Record<DependencyKind, number>> = {};\n for (const kind of dependencyKinds) {\n const count = evidence.filter(item => item.kind === kind).length;\n if (count > 0) byKind[kind] = count;\n }\n return { source: group.source, target: group.target, sliceEdges: new Set(evidence.map(item => JSON.stringify([item.consumer.key, item.producer.key]))).size, references: evidence.length, byKind, consumers: distinctNodes(evidence.map(item => item.consumer)), producers: distinctNodes(evidence.map(item => item.producer)), evidence: evidence.slice(0, evidenceLimit), evidenceCount: evidence.length, evidenceTruncated: evidence.length > evidenceLimit };\n });\n }\n\n /** Mutual dependencies at a single level; only story-ordering kinds can constrain cycles. */\n cycles(level: string, kinds?: Iterable<string>): DependencyGroup[] {\n if (!['slice', 'feature', 'module'].includes(level)) throw new InvalidDependencyQuery(`Unsupported cycle level '${level}'.`);\n const edges = this.implied(level, level, selectedOrderingKinds(kinds));\n const nodes = distinctNodes(edges.flatMap(edge => [edge.source, edge.target]));\n return groupsOf(adjacency(nodes, edges), nodes, null);\n }\n\n siblingGroups(kinds?: Iterable<string>): DependencyGroup[] {\n const edges = this.siblingEdges(kinds);\n return this.containers().flatMap(container => {\n const children = this.children.get(container.key)!;\n return groupsOf(adjacency(children, edges.filter(edge => edge.container === container)), children, container);\n });\n }\n\n /** Producers first via Kahn, preserving authored rank ties and cycle members' relative order. Never applied. */\n suggestedOrder(kinds?: Iterable<string>): DependencyOrder {\n const edges = this.siblingEdges(kinds);\n const suggestions: DependencyContainerOrder[] = [];\n for (const container of this.containers()) {\n const children = this.children.get(container.key)!;\n const local = edges.filter(edge => edge.container === container);\n const byKey = new Map(children.map(node => [node.key, node]));\n const groups = stronglyConnectedGroups(adjacency(children, local)).map(group => group.map(key => byKey.get(key)!).sort(compareNodes)).sort((left, right) => left[0].rank - right[0].rank);\n const membership = new Map(groups.flatMap((group, index) => group.map(node => [node.key, index] as const)));\n const dependencies = new Map(children.map(node => [node.key, new Set<string>()]));\n for (const edge of local) if (membership.get(edge.source.key) !== membership.get(edge.target.key)) dependencies.get(edge.source.key)!.add(edge.target.key);\n // Remove cycle-internal edges, not unrelated children. A cycle need not become contiguous.\n for (const group of groups) for (let index = 1; index < group.length; index++) dependencies.get(group[index].key)!.add(group[index - 1].key);\n const remaining = new Set(children.map(node => node.key));\n const ordered: DependencyNode[] = [];\n while (remaining.size > 0) {\n const ready = [...remaining].filter(key => dependencies.get(key)!.size === 0).sort((left, right) => compareNodes(byKey.get(left)!, byKey.get(right)!))[0];\n ordered.push(byKey.get(ready)!);\n remaining.delete(ready);\n for (const key of remaining) dependencies.get(key)!.delete(ready);\n }\n suggestions.push({ container, children: ordered, changed: children.some((node, index) => node !== ordered[index]) });\n }\n const orders = new Map(suggestions.map(item => [item.container.key, item.children]));\n const slices: DependencyNode[] = [];\n const walk = (node: DependencyNode) => {\n if (node.kind === 'slice') slices.push(node);\n else for (const child of [...orders.get(node.key)!].sort((left, right) => Number(left.kind !== 'slice') - Number(right.kind !== 'slice'))) walk(child);\n };\n walk(this.root);\n return { containers: suggestions, slices };\n }\n\n traverse(address: string, direction: string, kinds?: Iterable<string>, includeTestOnly = false): DependencyNode[] {\n if (direction !== 'incoming' && direction !== 'outgoing') throw new InvalidDependencyQuery(`Unsupported dependency direction '${direction}'.`);\n const links = this.evidence(kinds, includeTestOnly).map(item => direction === 'incoming' ? { source: item.producer, target: item.consumer } : { source: item.consumer, target: item.producer });\n const visited = new Set([address]);\n const queue = [address];\n const nodes: DependencyNode[] = [];\n for (let index = 0; index < queue.length; index++) {\n for (const link of links.filter(link => link.source.address === queue[index]).sort((left, right) => left.target.rank - right.target.rank)) {\n if (visited.has(link.target.address)) continue;\n visited.add(link.target.address);\n nodes.push(link.target);\n queue.push(link.target.address);\n }\n }\n return distinctNodes(nodes);\n }\n\n private add(kind: DependencyLevel, name: string, parent: DependencyNode): DependencyNode {\n const scope = [...parent.scope, name];\n const address = scope.join('.');\n const key = `${kind}:${address}`;\n const existing = this.byKey.get(key);\n if (existing !== undefined) return existing;\n const node = nodeOf(kind, address, scope, this.modelNodes.length);\n this.modelNodes.push(node);\n this.byKey.set(key, node);\n this.parents.set(key, parent);\n this.children.get(parent.key)!.push(node);\n if (kind !== 'slice') this.children.set(key, []);\n return node;\n }\n private ancestors(node: DependencyNode): DependencyNode[] {\n const ancestors: DependencyNode[] = [];\n for (let parent = this.parents.get(node.key); parent !== undefined; parent = this.parents.get(parent.key)) ancestors.push(parent);\n return ancestors;\n }\n private disjoint(left: DependencyNode, right: DependencyNode): boolean {\n return left.key !== right.key && !this.ancestors(left).includes(right) && !this.ancestors(right).includes(left);\n }\n private at(node: DependencyNode, level: string): DependencyNode[] { return [node, ...this.ancestors(node)].filter(node => node.kind === level); }\n private containers(): DependencyNode[] { return [this.root, ...this.modelNodes.filter(node => node.kind === 'module' || node.kind === 'feature')]; }\n private evidence(kinds: Iterable<string> | undefined, includeTestOnly: boolean): DependencyEvidence[] {\n const selected = selectedKinds(kinds);\n return this.edges.flatMap(edge => edge.evidence).filter(item => selected.has(item.kind) && (includeTestOnly || !item.testOnly));\n }\n private path(node: DependencyNode): DependencyNode[] { return [...this.ancestors(node).reverse(), node].filter(node => node !== this.root); }\n private siblingEdges(kinds?: Iterable<string>): SiblingEdge[] {\n const edges: SiblingEdge[] = [];\n for (const item of this.evidence(selectedOrderingKinds(kinds), false)) {\n const consumer = this.path(item.consumer);\n const producer = this.path(item.producer);\n let common = 0;\n while (common < consumer.length && common < producer.length && consumer[common].key === producer[common].key) common++;\n if (common === consumer.length || common === producer.length) continue;\n edges.push({ container: common === 0 ? this.root : consumer[common - 1], source: consumer[common], target: producer[common] });\n }\n return edges;\n }\n}\n\nfunction selectedKinds(kinds?: Iterable<string>): Set<string> {\n const selected = new Set(kinds ?? dependencyKinds);\n if ([...selected].some(kind => !(dependencyKinds as readonly string[]).includes(kind))) throw new InvalidDependencyQuery('Unsupported dependency kind.');\n return selected;\n}\nfunction selectedOrderingKinds(kinds?: Iterable<string>): string[] { return [...selectedKinds(kinds ?? orderingKinds)].filter(kind => orderingKinds.includes(kind)); }\nfunction adjacency(nodes: readonly DependencyNode[], edges: readonly { source: DependencyNode; target: DependencyNode }[]): Map<string, Set<string>> {\n const graph = new Map(nodes.map(node => [node.key, new Set<string>()]));\n for (const edge of edges) graph.get(edge.source.key)!.add(edge.target.key);\n return graph;\n}\nfunction groupsOf(graph: ReadonlyMap<string, ReadonlySet<string>>, nodes: readonly DependencyNode[], container: DependencyNode | null): DependencyGroup[] {\n const byKey = new Map(nodes.map(node => [node.key, node]));\n return stronglyConnectedGroups(graph).filter(group => group.length > 1).map(group => ({ container, members: distinctNodes(group.map(key => byKey.get(key)!)) })).sort((left, right) => left.members[0].rank - right.members[0].rank);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ParserContext } from '../Parsing/ParserContext';\nimport { ApplicationSyntax, DependsOnSyntax, FeatureSyntax } from '../Syntax/Structure';\nimport { DeclaredDependencyTargets } from './DeclaredDependencyTargets';\nimport { DependencyGraph } from './DependencyGraph';\nimport { DependencyEvidence, DependencyNode } from './index';\n\nexport interface DependencyDeclaration {\n readonly syntax: DependsOnSyntax;\n readonly resolved?: string;\n readonly status: 'used' | 'provisional' | 'unused' | 'invalid';\n}\nexport interface DeclaredDependencyEdge {\n readonly evidence: DependencyEvidence;\n readonly status: 'declared' | 'provisional' | 'undeclared';\n readonly coveringDeclarations: readonly DependsOnSyntax[];\n}\nexport interface CheckedDependencyContainer {\n readonly container: DependencyNode;\n readonly location: SourceLocation;\n readonly declarations: readonly DependencyDeclaration[];\n readonly edges: readonly DeclaredDependencyEdge[];\n}\nexport interface DeclaredDependencyReport {\n readonly containers: readonly CheckedDependencyContainer[];\n readonly diagnostics: readonly Diagnostic[];\n}\nconst countedKinds = ['usesFactsFrom', 'reactsTo', 'decidesFrom', 'asks', 'shows'];\nconst contains = (container: string, address: string): boolean => address === container || address.startsWith(container + '.');\nconst ordinal = (left: string, right: string): number => left < right ? -1 : left > right ? 1 : 0;\nconst orderedEvidence = (left: DependencyEvidence, right: DependencyEvidence): number => ordinal(left.location.path ?? '', right.location.path ?? '') || left.location.line - right.location.line || left.location.column - right.location.column || ordinal(left.kind, right.kind) || ordinal(left.consumer.address, right.consumer.address) || ordinal(left.producer.address, right.producer.address) || ordinal(left.role, right.role) || ordinal(left.name, right.name);\n\n/** Independent opt-in inventories; checks explicit reference coupling, never executable identity. */\nexport class DeclaredDependencies {\n static for(application: ApplicationSyntax): DeclaredDependencyReport {\n const owners = new Map<string, { location: SourceLocation; dependencies: DependsOnSyntax[] }>();\n const inventory = (scope: string[], syntax: { location: SourceLocation; dependsOn?: readonly DependsOnSyntax[]; features: readonly FeatureSyntax[] }) => {\n const address = scope.join('.');\n if (!owners.has(address)) owners.set(address, { location: syntax.location, dependencies: [] });\n owners.get(address)!.dependencies.push(...syntax.dependsOn ?? []);\n syntax.features.forEach(child => inventory([...scope, child.name], child));\n };\n application.modules.forEach(module => inventory([module.name], module));\n if (![...owners.values()].some(owner => owner.dependencies.length)) return { containers: [], diagnostics: [] };\n // Both twins use syntax order, not authored import ranks.\n const graph = DependencyGraph.for(application, new Map());\n const nodes = graph.nodes.filter(node => node.kind === 'module' || node.kind === 'feature');\n const targets = DeclaredDependencyTargets.containersOf(application);\n const resolve = (target: string, scope: readonly string[]) => {\n const resolved = DeclaredDependencyTargets.resolve(target, scope, targets).resolved;\n return resolved && [...resolved.scope, resolved.name].join('.');\n };\n const containers: CheckedDependencyContainer[] = [];\n const diagnostics: Diagnostic[] = [];\n const finding = (code: string, severity: Diagnostic['severity'], message: string, location: SourceLocation) => diagnostics.push({ code, severity, message, location });\n for (const container of nodes.filter(node => owners.get(node.address)!.dependencies.length)) {\n const owner = owners.get(container.address)!;\n const declarations = owner.dependencies.map(syntax => {\n const resolved = resolve(syntax.target, container.scope);\n const valid = resolved !== undefined && !contains(container.address, resolved) && !contains(resolved, container.address);\n return { syntax, resolved, status: valid ? 'unused' : 'invalid' } as { syntax: DependsOnSyntax; resolved?: string; status: DependencyDeclaration['status'] };\n });\n const edges: DeclaredDependencyEdge[] = [];\n const buckets = new Map<string, DependencyEvidence[]>();\n for (const evidence of graph.edges.flatMap(edge => edge.evidence).filter(item => countedKinds.includes(item.kind) && contains(container.address, item.consumer.address)).sort(orderedEvidence)) {\n const candidates = [evidence.producer, ...evidence.alternatives].filter(producer => !contains(container.address, producer.address) && !contains(producer.scope.slice(0, -1).join('.'), container.address));\n if (!candidates.length) continue;\n const covering = declarations.filter(declaration => declaration.status !== 'invalid' && candidates.some(candidate => contains(declaration.resolved!, candidate.address)));\n for (const declaration of covering) declaration.status = evidence.ambiguous && declaration.status !== 'used' ? 'provisional' : 'used';\n const status = evidence.ambiguous ? 'provisional' : covering.length ? 'declared' : 'undeclared';\n edges.push({ evidence, status, coveringDeclarations: covering.map(declaration => declaration.syntax) });\n if (status === 'undeclared') {\n const module = evidence.producer.scope[0];\n if (!buckets.has(module)) buckets.set(module, []);\n buckets.get(module)!.push(evidence);\n }\n }\n for (const evidence of buckets.values()) {\n let prefix = evidence[0].producer.scope.slice(0, -1);\n const mismatch = prefix.findIndex((segment, index) => evidence.some(item => index >= item.producer.scope.length - 1 || item.producer.scope[index] !== segment));\n if (mismatch >= 0) prefix = prefix.slice(0, mismatch);\n const target = prefix.join('.');\n const suggestedTargets = contains(container.address, target) || contains(target, container.address)\n ? [...new Set(evidence.map(item => item.producer.scope.slice(0, -1).map((_, index) => item.producer.scope.slice(0, index + 1).join('.'))\n .find(candidate => !contains(container.address, candidate) && !contains(candidate, container.address))!))]\n : [target];\n const details = evidence.map(item => `${item.kind} ${item.role} '${item.name}' at ${item.location.path ?? ''}:${item.location.line}:${item.location.column}`).join('; ');\n finding(DiagnosticCodes.UndeclaredDependency, 'warning', `Container '${container.address}' depends on '${suggestedTargets.join(\"', '\")}' without declaring ${suggestedTargets.length === 1 ? 'it' : 'them'} - evidence: ${details}`, owner.location);\n }\n for (const declaration of declarations) {\n if (declaration.status === 'unused') finding(DiagnosticCodes.UnusedDependencyDeclaration, 'information', `Dependency '${declaration.syntax.target}' on '${container.address}' is not used by any counted explicit reference`, declaration.syntax.location);\n if (declaration.status !== 'invalid' && owners.get(declaration.resolved!)!.dependencies.some(dependency => resolve(dependency.target, declaration.resolved!.split('.')) === container.address)) {\n finding(DiagnosticCodes.MutualDependencyDeclarations, 'information', `Containers '${container.address}' and '${declaration.resolved}' declare each other`, declaration.syntax.location);\n }\n }\n containers.push({ container, location: owner.location, declarations, edges });\n }\n return { containers, diagnostics };\n }\n\n static validate(application: ApplicationSyntax, context: ParserContext): void {\n for (const diagnostic of this.for(application).diagnostics) context[diagnostic.severity === 'warning' ? 'warning' : 'information'](diagnostic.code, diagnostic.message, diagnostic.location);\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { CommandSyntax } from '../Syntax/Commands';\nimport { CaptureAppendSyntax, CaptureSourceSyntax } from '../Syntax/Captures';\nimport { ConstraintSyntax } from '../Syntax/Constraints';\nimport { dependencySourcesOf, ReducerRuleSyntax } from '../Syntax/DependencySources';\nimport { ReducerSyntax } from '../Syntax/ReducerSyntax';\nimport { consumedEvents, isEventsSource } from '../Syntax/CaptureEventsSource';\nimport { AllSyntax, JoinEventSyntax, ProjectionBlockSyntax, ProjectionSyntax } from '../Syntax/Projections';\nimport { ProducesSyntax, ReactionTriggerSyntax } from '../Syntax/Reactions';\nimport { ScreenplaySyntaxWalker } from '../Syntax/ScreenplaySyntaxWalker';\nimport { SpecificationSyntax } from '../Syntax/Specifications';\nimport { SliceSyntax } from '../Syntax/Structure';\nimport { SyntaxNode } from '../Syntax/SyntaxNode';\n\n/** Operational event edges only: fixtures and assertions are not subscriptions or appends. */\nexport class PublicEventUsageCollector extends ScreenplaySyntaxWalker {\n private command = false;\n readonly uses: { name: string; node: SyntaxNode; output: boolean; command: boolean }[] = [];\n readonly allEvents: AllSyntax[] = [];\n /** The '=> Name' of each projection and reducer: a read model, or an event in an outbound translation. */\n readonly projectionTargets: { target: string; node: SyntaxNode }[] = [];\n readonly eventSources: CaptureSourceSyntax[] = [];\n\n override visitProjection(syntax: ProjectionSyntax): void {\n if (syntax.readModel != null) this.projectionTargets.push({ target: syntax.readModel, node: syntax });\n super.visitProjection(syntax);\n }\n override visitReducer(syntax: ReducerSyntax): void {\n this.projectionTargets.push({ target: syntax.readModel, node: syntax });\n super.visitReducer(syntax);\n }\n override visitCaptureSource(syntax: CaptureSourceSyntax): void {\n if (isEventsSource(syntax)) {\n this.eventSources.push(syntax);\n consumedEvents(syntax).forEach(setting => this.uses.push({ name: setting.value, node: setting, output: false, command: false }));\n }\n super.visitCaptureSource(syntax);\n }\n\n override visitSlice(syntax: SliceSyntax): void {\n super.visitSlice(syntax);\n dependencySourcesOf(syntax).reducers?.forEach(reducer => this.visitReducer(reducer));\n }\n override visitCommand(syntax: CommandSyntax): void {\n this.command = true;\n super.visitCommand(syntax);\n this.command = false;\n }\n override visitProduces(syntax: ProducesSyntax): void {\n if (syntax.inlineOperation == null) this.uses.push({ name: syntax.event, node: syntax, output: true, command: this.command });\n }\n override visitCaptureAppend(syntax: CaptureAppendSyntax): void { this.inputOrOutput(syntax.event, syntax, true); }\n override visitJoinEvent(syntax: JoinEventSyntax): void { this.inputOrOutput(syntax.event, syntax); }\n override visitReducerRule(syntax: ReducerRuleSyntax): void { this.inputOrOutput(syntax.event, syntax); }\n override visitConstraint(syntax: ConstraintSyntax): void {\n syntax.releasedBy.forEach(name => this.inputOrOutput(name, syntax));\n if (syntax.kind !== 'FileConstraintSyntax') this.inputOrOutput(syntax.event, syntax);\n super.visitConstraint(syntax);\n }\n override visitProjectionBlock(syntax: ProjectionBlockSyntax): void {\n switch (syntax.kind) {\n case 'FromSyntax': syntax.events.forEach(event => this.inputOrOutput(event.event, event)); break;\n case 'ClearWithSyntax':\n case 'RemoveWithSyntax':\n case 'RemoveViaJoinSyntax': this.inputOrOutput(syntax.event, syntax); break;\n case 'AllSyntax': this.allEvents.push(syntax); break;\n }\n super.visitProjectionBlock(syntax);\n }\n override visitReactionTrigger(syntax: ReactionTriggerSyntax): void {\n if (syntax.source.kind === 'NamedTriggerSourceSyntax') this.inputOrOutput(syntax.source.name, syntax.source);\n super.visitReactionTrigger(syntax);\n }\n override visitSpecification(_syntax: SpecificationSyntax): void {}\n\n private inputOrOutput(name: string, node: SyntaxNode, output = false): void {\n this.uses.push({ name, node, output, command: false });\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { publicEventMetadataError } from '../Syntax/PublicEventInvariants';\nimport { ScreenplaySyntaxWalker } from '../Syntax/ScreenplaySyntaxWalker';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { SyntaxNode } from '../Syntax/SyntaxNode';\nimport { ParserContext } from './ParserContext';\n\nclass PublicEventMetadataValidator extends ScreenplaySyntaxWalker {\n constructor(private readonly context: ParserContext) { super(); }\n\n override visitNode(node: SyntaxNode): void {\n const error = publicEventMetadataError(node);\n if (error === undefined) return;\n const code = node.kind === 'EventSyntax' ? DiagnosticCodes.InvalidEventDeclaration\n : node.kind === 'ImportSyntax' ? DiagnosticCodes.InvalidImportDeclaration : DiagnosticCodes.InvalidSliceDeclaration;\n this.context.error(code, error, node.location);\n }\n}\n\nexport function validatePublicEventMetadata(application: ApplicationSyntax, context: ParserContext): void {\n new PublicEventMetadataValidator(context).visitApplication(application);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { AuthoringProductionKind, AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { EventSyntax, ImportSyntax } from '../Syntax/Declarations';\nimport { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { EventVisibility } from '../Syntax/EventVisibility';\nimport { isEventsSource } from '../Syntax/CaptureEventsSource';\nimport { dependencySourcesOf } from '../Syntax/DependencySources';\nimport { ApplicationSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { SyntaxNode } from '../Syntax/SyntaxNode';\nimport { TranslationDirection } from '../Syntax/TranslationDirection';\nimport { ParserContext } from './ParserContext';\nimport { PublicEventUsageCollector } from './PublicEventUsageCollector';\nimport { validatePublicEventMetadata } from './PublicEventMetadataValidator';\n\n/** Validates public contract boundaries against the complete assembled declaration inventory. */\nexport function validatePublicEventUsage(application: ApplicationSyntax, context: ParserContext): void {\n validatePublicEventMetadata(application, context);\n const resolver = new AuthoringProductionResolver(application);\n if (!resolver.declarations.some(declaration => declaration.node.kind === 'EventSyntax' && ((declaration.node as EventSyntax).visibility === EventVisibility.Public || (declaration.node as EventSyntax).origin != null)) &&\n !application.imports.some(imported => imported.visibility === EventVisibility.Public || imported.origin != null) &&\n !resolver.slices.some(({ slice }) => slice.direction != null || usesEventSource(slice) || targetsEvent(slice, resolver))) return;\n const events = new AuthoringProductionResolver(application, resolver.declarations.filter(declaration => declaration.kind === AuthoringProductionKind.Event));\n for (const { slice, scope } of resolver.slices) validateSlice(application, slice, scope, resolver, events, context);\n for (const seed of application.seeds?.flatMap(seed => seed.groups.flatMap(group => group.events)) ?? []) {\n const contract = resolve(application, events, [], seed.event, seed, true, context);\n if (contract?.visibility !== EventVisibility.Public) continue;\n const code = contract.origin == null ? DiagnosticCodes.PublicEventRequiresOutboundTranslation : DiagnosticCodes.ForeignPublicEventProduced;\n context.error(code, `Seed cannot append public event '${seed.event}'; public production belongs to outbound translation, and foreign contracts cannot be produced locally.`, seed.location);\n }\n}\n\nfunction validateSlice(application: ApplicationSyntax, slice: SliceSyntax, scope: readonly string[], resolver: AuthoringProductionResolver, events: AuthoringProductionResolver, context: ParserContext): void {\n const collector = new PublicEventUsageCollector();\n collector.visitSlice(slice);\n const contracts: { node: EventSyntax | ImportSyntax; output: boolean }[] = [];\n const explicitOutbound = slice.type === 'Translate' && slice.direction === TranslationDirection.Outbound;\n const readModels = new Set(slice.readModels.map(readModel => readModel.name));\n for (const { target, node } of collector.projectionTargets) {\n // '=> Name' names a read model unless it resolves to an event: then the projection or reducer publishes that event.\n const contract = readModels.has(target) ? undefined : resolve(application, events, scope, target, node, false, context);\n if (contract === undefined) continue;\n if (!explicitOutbound) {\n context.error(DiagnosticCodes.EventTargetOutsideOutboundTranslation, `'${target}' is an event: a projection or reducer may only target an event in an explicitly outbound Translate slice.`, node.location);\n continue;\n }\n contracts.push({ node: contract, output: true });\n validateUse(slice, target, node, true, false, contract, context);\n }\n // An outbound slice with a capture is already refused as a whole by the translation-direction check below.\n if (!(slice.type === 'Translate' && slice.direction === TranslationDirection.Inbound) && !explicitOutbound) {\n for (const source of collector.eventSources) context.error(DiagnosticCodes.EventsSourceOutsideInboundTranslation, `'source events' reads another application's public events and belongs to a Translate slice with 'direction inbound', not '${slice.name}'.`, source.location);\n }\n for (const use of collector.uses) {\n const contract = resolve(application, use.node.kind === 'ProducesSyntax' ? resolver : events, scope, use.name, use.node, use.output, context);\n if (contract === undefined) continue;\n contracts.push({ node: contract, output: use.output });\n validateUse(slice, use.name, use.node, use.output, use.command, contract, context);\n }\n // 'all' subscribes to every event type; 'every' maps only the projection's existing inputs.\n for (const all of collector.allEvents) {\n const declarations = resolver.declarations.filter(declaration => declaration.kind === AuthoringProductionKind.Event).map(declaration => declaration.node as EventSyntax);\n for (const contract of [...declarations, ...application.imports.filter(imported => imported.visibility === EventVisibility.Public)]) {\n contracts.push({ node: contract, output: false });\n validateUse(slice, contract.kind === 'ImportSyntax' ? contract.qualifiedName : contract.name, all, false, false, contract, context);\n }\n }\n if (slice.type !== 'Translate') return;\n if (slice.direction == null && (eventDeclarations(slice).some(event => event.visibility === EventVisibility.Public) || contracts.some(contract => contract.node.visibility === EventVisibility.Public))) {\n context.error(DiagnosticCodes.PublicTranslationRequiresDirection, \"A Translate slice using public events requires an explicit 'direction inbound' or 'direction outbound'. Legacy translations without public metadata remain inbound.\", slice.location);\n }\n if (slice.direction !== TranslationDirection.Outbound) return;\n const outputs = new Set(contracts.filter(contract => contract.output && contract.node.visibility === EventVisibility.Public && contract.node.origin == null).map(contract => contract.node)).size;\n if (outputs !== 1) context.error(DiagnosticCodes.OutboundPublicEventCount, `Outbound Translate slice '${slice.name}' must produce exactly one local public event type; found ${outputs}.`, slice.location);\n for (const capture of slice.captures) context.error(DiagnosticCodes.TranslationConstructDirection, 'An outbound translation consumes private local events, not an external-data capture. Capture belongs to inbound translation.', capture.location);\n}\n\nfunction validateUse(slice: SliceSyntax, name: string, node: SyntaxNode, output: boolean, command: boolean, contract: EventSyntax | ImportSyntax, context: ParserContext): void {\n const foreign = contract.origin != null;\n const publicEvent = contract.visibility === EventVisibility.Public;\n const error = (code: string, message: string) => context.error(code, message, node.location);\n if (output) {\n if (command && publicEvent) error(DiagnosticCodes.CommandProducesPublicEvent, `Command cannot produce public event '${name}'; publish through an outbound Translate slice.`);\n if (slice.type === 'Translate' && slice.direction === TranslationDirection.Outbound && !publicEvent) error(DiagnosticCodes.OutboundTranslationOutput, `Outbound translation must produce its one local public event, not private event '${name}'.`);\n if (foreign) error(DiagnosticCodes.ForeignPublicEventProduced, `Foreign public event '${name}' cannot be produced locally; translate it into a private local event.`);\n if (publicEvent && !foreign && (slice.type !== 'Translate' || slice.direction !== TranslationDirection.Outbound)) error(DiagnosticCodes.PublicEventRequiresOutboundTranslation, `Local public event '${name}' may only be produced by an explicitly outbound Translate slice.`);\n if (slice.type === 'Translate' && (slice.direction ?? TranslationDirection.Inbound) === TranslationDirection.Inbound && (publicEvent || foreign)) error(DiagnosticCodes.InboundTranslationOutput, `Inbound translation must produce private local events, not '${name}'.`);\n } else {\n if (foreign && (slice.type !== 'Translate' || slice.direction !== TranslationDirection.Inbound)) error(DiagnosticCodes.ForeignPublicEventConsumer, `Foreign public event '${name}' may only be consumed by an explicitly inbound Translate slice.`);\n if (slice.type === 'Translate' && slice.direction === TranslationDirection.Outbound && (publicEvent || foreign)) error(DiagnosticCodes.OutboundTranslationInput, `Outbound translation must consume private local events, not '${name}'.`);\n if (slice.type === 'Translate' && slice.direction === TranslationDirection.Inbound && (!publicEvent || !foreign)) error(DiagnosticCodes.InboundTranslationInput, `Explicitly inbound translation must consume foreign public events, not '${name}'.`);\n }\n}\n\nfunction resolve(application: ApplicationSyntax, resolver: AuthoringProductionResolver, scope: readonly string[], name: string, use: SyntaxNode, output: boolean, context: ParserContext): EventSyntax | ImportSyntax | undefined {\n const resolution = resolver.resolveFromScope(name, scope);\n if (resolution.declaration?.node.kind === 'EventSyntax') return resolution.declaration.node as EventSyntax;\n if (resolution.kind === AuthoringProductionKind.Operation) return undefined;\n if (resolution.kind === AuthoringProductionKind.Ambiguous) {\n context.warning(DiagnosticCodes.AmbiguousReference, `Ambiguous event reference '${name}'; qualify it with its owning module, feature and slice.`, use.location);\n return undefined;\n }\n const imports = application.imports.filter(imported => imported.qualifiedName.split('.').at(-1) === name || imported.qualifiedName === name);\n if (imports.length === 1) {\n const imported = imports[0];\n const local = resolver.resolveFromScope(imported.qualifiedName, scope);\n if (local.declaration?.node.kind === 'EventSyntax') return local.declaration.node as EventSyntax;\n if (local.kind === AuthoringProductionKind.Ambiguous) {\n context.warning(DiagnosticCodes.AmbiguousReference, `Ambiguous imported event reference '${name}'; qualify its declaration.`, use.location);\n return undefined;\n }\n return imported.visibility === EventVisibility.Public ? imported : undefined;\n }\n if (imports.length > 1) context.warning(DiagnosticCodes.AmbiguousReference, `Ambiguous imported event reference '${name}'; use its qualified name.`, use.location);\n else if (((output && use.kind !== 'CaptureAppendSyntax') || use.kind === 'CaptureSourceSettingSyntax') && !context.diagnostics.some(diagnostic => diagnostic.code === DiagnosticCodes.UnknownEvent && diagnostic.location.path === use.location.path && diagnostic.location.line === use.location.line && diagnostic.location.column === use.location.column)) {\n context.warning(DiagnosticCodes.UnknownEvent, `Unknown event '${name}' - declare its contract before classifying its usage.`, use.location);\n }\n return undefined;\n}\n\nfunction usesEventSource(slice: SliceSyntax): boolean {\n return slice.captures.some(capture => capture.source != null && isEventsSource(capture.source));\n}\n\nfunction targetsEvent(slice: SliceSyntax, resolver: AuthoringProductionResolver): boolean {\n const targets = [...slice.projections.map(projection => projection.readModel), ...(dependencySourcesOf(slice).reducers ?? []).map(reducer => reducer.readModel)];\n return targets.some(target => target != null && resolver.declarations.some(declaration => declaration.kind === AuthoringProductionKind.Event && declaration.name === target));\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { exactSourceOptions, legacySourceOptions, NumericMode, SourceOptions } from '../Syntax/SourceOptions';\nimport { LineReader } from './LineReader';\nimport { isClosingCodeFence } from './ImplementationParser';\nimport { firstWord } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\nimport { commentStart } from './SourceLineSplitter';\n\n// Establishes options before entering any value grammar. This mirrors the C# physical-file prepass;\n// fences and property owners are not reinterpreted as numeric directives.\nexport function sourceContext(lines: readonly SourceLine[], path?: string, languages?: ReadonlySet<string>, hashComments = false): ParserContext {\n const prepared: SourceLine[] = [];\n const diagnostics: Diagnostic[] = [];\n let options: SourceOptions = legacySourceOptions;\n let seen = false;\n let contentSeen = false;\n let inFence = false;\n const nested = new Map<number, Diagnostic>();\n const registry = new ParserContext(new LineReader([]), path, languages).languages;\n for (const original of lines) {\n let line = original;\n if (line.number === 1 && line.raw.startsWith('\\uFEFF')) {\n const raw = line.raw.substring(1);\n const indent = raw.length - raw.trimStart().length;\n const comment = commentStart(raw.substring(indent), hashComments);\n line = { ...line, indent, contentOffset: 1, content: (comment < 0 ? raw.substring(indent) : raw.substring(indent, indent + comment)).trimEnd() };\n }\n if (inFence) {\n if (isClosingCodeFence(line)) inFence = false;\n prepared.push(line);\n continue;\n }\n if (line.content.startsWith('```') && (['```', '```text', '```markdown'].includes(line.content) || registry.has(line.content.substring(3)))) inFence = true;\n if (!inFence && line.indent === 0 && firstWord(line.content) === 'numbers') {\n const code = line.content !== 'numbers exact' ? DiagnosticCodes.InvalidNumericDirective : seen ? DiagnosticCodes.DuplicateNumericDirective : contentSeen ? DiagnosticCodes.LateNumericDirective : undefined;\n if (code !== undefined) {\n diagnostics.push({ severity: 'error', code, message: \"Expected one 'numbers exact' preamble before domain, imports and declarations.\", location: locationOf(line) });\n options = Object.freeze({ numericMode: 'invalid' as NumericMode });\n } else options = exactSourceOptions;\n seen = true;\n prepared.push({ ...line, content: '' });\n continue;\n }\n // A directive-shaped line below the top level is never a valid option, whichever construct owns the block.\n if (!inFence && line.indent > 0 && /^numbers(\\s+(exact|legacy))?$/.test(line.content)) nested.set(line.number, { severity: 'error', code: DiagnosticCodes.InvalidNumericDirective, message: \"Expected 'numbers exact' only as the document preamble, not inside a body.\", location: locationOf(line) });\n contentSeen ||= line.content.trim().length > 0;\n prepared.push(line);\n }\n const context = new ParserContext(new LineReader(seen ? prepared : lines), path, languages);\n context.sourceOptions = options;\n // Reported when reading ends, once every property owner has claimed the lines it models as fields.\n context.nestedNumericDirectives = nested;\n diagnostics.forEach(diagnostic => context.error(diagnostic.code, diagnostic.message, diagnostic.location));\n return context;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { requiresExplicitDestinations } from '../Syntax/ProductionDestinations';\nimport { ApplicationSyntax, FeatureSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\n\nexport function validateInlineEvents(application: ApplicationSyntax, context: ParserContext): void {\n const slices: SliceSyntax[] = [];\n const inFeature = (feature: FeatureSyntax): void => {\n slices.push(...feature.slices);\n feature.features.forEach(inFeature);\n };\n application.modules.forEach(module => module.features.forEach(inFeature));\n const eventCounts = new Map<string, number>();\n for (const event of slices.flatMap(eventDeclarations)) eventCounts.set(event.name, (eventCounts.get(event.name) ?? 0) + 1);\n const importedNames = new Set(application.imports.map(value => value.qualifiedName.split('.').at(-1)));\n const resolver = new AuthoringProductionResolver(application);\n for (const { slice, command } of slices.flatMap(slice => slice.commands.map(command => ({ slice, command })))) {\n const events = command.produces.filter(production => resolver.isEventProduction(production, slice));\n const identifier = command.properties.find(property => property.isIdentifier)?.name;\n const mixed = requiresExplicitDestinations(command, { resolver, slice });\n for (const production of events) {\n const inline = production.inlineEvent;\n if (inline !== null && ((eventCounts.get(inline.name) ?? 0) > 1 || importedNames.has(inline.name))) {\n context.error(DiagnosticCodes.InlineEventCollision, `Inline event '${inline.name}' collides with another event declaration or import`, production.location);\n }\n if (mixed && production.for === null) {\n context.error(DiagnosticCodes.ExplicitProducesTargetsRequired, `Production '${production.event}' in command '${command.name}' must state 'for' explicitly - every production must state 'for' when destinations differ`, production.location);\n }\n const destination = production.for?.kind === 'PathExpressionSyntax' ? production.for.path : production.for === null && inline !== null ? identifier : undefined;\n if (identifier === undefined || destination !== identifier) continue;\n for (const mapping of production.mappings.filter(mapping => mapping.source.kind === 'PathExpressionSyntax' && mapping.source.path === identifier)) {\n const message = `Event '${production.event}' copies command identifier '${identifier}' into payload property '${mapping.property}' although it already identifies the event source`;\n if (inline === null) context.information(DiagnosticCodes.EventSourceIdInPayload, message, mapping.location);\n else context.warning(DiagnosticCodes.EventSourceIdInPayload, message, mapping.location);\n }\n }\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { AuthoringProductionKind, AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { CommandSyntax } from '../Syntax/Commands';\nimport { PropertySyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { operationDeclarations, OperationSyntax } from '../Syntax/Operations';\nimport { SyntaxNode } from '../Syntax/SyntaxNode';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\nimport { commandReadSources } from './CommandReadSources';\nimport { compatibleValue, uniqueByName } from './ResponseValidator';\nimport { specificationCommandExamples } from './SpecificationCommandExamples';\n\nexport function validateOperations(application: ApplicationSyntax, context: ParserContext): void {\n const resolver = new AuthoringProductionResolver(application);\n const effectiveCommand = specificationCommandExamples(application);\n const concepts = uniqueByName(application.concepts);\n const composites = new Map([...uniqueByName(application.types)].map(([name, type]) => [name, uniqueByName(type.properties)]));\n const known = new Set(['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime', ...concepts.keys(), ...composites.keys()]);\n const imported = new Set(application.imports.map(entry => entry.qualifiedName.split('.').at(-1)!));\n const imports = new Map<string, string[]>();\n for (const entry of application.imports) {\n const name = entry.qualifiedName.split('.').at(-1)!;\n imports.set(name, [...imports.get(name) ?? [], entry.qualifiedName]);\n }\n const scoped = <T>(entries: readonly { name: string; scope: readonly string[]; node: T }[]) => {\n const byName = new Map<string, typeof entries[number][]>();\n const cache = new Map<string, T | null>();\n for (const entry of entries) {\n const named = byName.get(entry.name) ?? [];\n named.push(entry);\n byName.set(entry.name, named);\n }\n return (reference: string, from: readonly string[]): T | null => {\n const key = JSON.stringify([reference, from]);\n if (cache.has(key)) return cache.get(key)!;\n const candidates = (name: string) => {\n const segments = name.split('.');\n const named = byName.get(segments.at(-1)!) ?? [];\n const qualifiers = segments.slice(0, -1);\n if (qualifiers.length > 0) return named.filter(entry => qualifiers.length <= entry.scope.length && qualifiers.every((value, index) => entry.scope[entry.scope.length - qualifiers.length + index] === value));\n for (let depth = from.length; depth >= 0; depth--) {\n const visible = named.filter(entry => depth <= entry.scope.length && from.slice(0, depth).every((value, index) => entry.scope[index] === value));\n if (visible.length > 0) return visible;\n }\n return [];\n };\n let matches = candidates(reference);\n const imported = imports.get(reference) ?? [];\n if (matches.length === 0 && imported.length === 1) matches = candidates(imported[0]);\n const result = matches.length === 1 ? matches[0].node : null;\n cache.set(key, result);\n return result;\n };\n };\n const view = scoped(resolver.slices.flatMap(({ slice, scope }) => slice.readModels.map(node => ({ name: node.name, scope, node }))));\n const resolveCommand = scoped(resolver.slices.flatMap(({ slice, scope }) => slice.commands.map(command => ({ name: command.name, scope, node: { command, slice } }))));\n const systems = new Map<string, number>();\n for (const system of application.systems ?? []) {\n if (systems.has(system.name)) context.error(DiagnosticCodes.InvalidSystemDeclaration, `System '${system.name}' is declared more than once.`, system.location);\n systems.set(system.name, (systems.get(system.name) ?? 0) + 1);\n }\n const pathType = (properties: readonly PropertySyntax[], path: string, inheritOptionality = true): { type: TypeRefSyntax | null; missing: boolean } => {\n const [name, ...nested] = path.split('.');\n const matches = properties.filter(property => property.name === name);\n if (matches.length !== 1) return { type: null, missing: matches.length === 0 };\n const type = matches[0].type;\n if (nested.length === 0) return { type, missing: false };\n const next = composites.get(type.name);\n if (next === undefined) return { type: null, missing: known.has(type.name) };\n const resolved = pathType([...next.values()], nested.join('.'), inheritOptionality);\n return resolved.type === null ? resolved : { type: { ...resolved.type, isOptional: inheritOptionality && type.isOptional || resolved.type.isOptional, isCollection: type.isCollection || resolved.type.isCollection }, missing: false };\n };\n const covered = (type: TypeRefSyntax, path: string, mappings: ReadonlySet<string>, supplied: ReadonlySet<string>, seen = new Set<string>()): boolean => {\n if (mappings.has(path) || type.isOptional && !supplied.has(path)) return true;\n if (type.isCollection || seen.has(type.name)) return false;\n const properties = composites.get(type.name);\n if (properties === undefined) return supplied.has(path) && !known.has(type.name);\n return [...properties.values()].every(property => covered(property.type, `${path}.${property.name}`, mappings, supplied, new Set([...seen, type.name])));\n };\n const completeValue = (value: PropertyMappingSyntax['source'], type: TypeRefSyntax): boolean => {\n if (value.kind === 'ListExpressionSyntax' && type.isCollection) return value.items.every(item => completeValue(item, { ...type, isCollection: false, isOptional: false }));\n const properties = composites.get(type.name);\n if (value.kind !== 'ObjectExpressionSyntax' || properties === undefined) return true;\n return [...properties.values()].every(property => (property.type.isOptional || value.members.some(member => member.name === property.name)) && value.members.filter(member => member.name === property.name).every(member => completeValue(member.value, property.type)));\n };\n const concrete = (value: PropertyMappingSyntax['source']): boolean => {\n if (value.kind === 'LiteralExpressionSyntax') return typeof value.value !== 'number' || Number.isFinite(value.value);\n if (value.kind === 'ObjectExpressionSyntax') return value.members.every(member => concrete(member.value));\n return value.kind === 'ListExpressionSyntax' && value.items.every(concrete);\n };\n const validateMappings = (mappings: readonly PropertyMappingSyntax[], operation: OperationSyntax, command: CommandSyntax | null, required: boolean, scope: readonly string[]): void => {\n const names = new Set<string>();\n const allNames = new Set(mappings.map(mapping => mapping.property));\n const suppliedPaths = new Set<string>();\n for (const mapping of mappings) {\n const segments = mapping.property.split('.');\n for (let depth = 1; depth <= segments.length; depth++) suppliedPaths.add(segments.slice(0, depth).join('.'));\n }\n for (const mapping of mappings) {\n if (names.has(mapping.property)) context.error(DiagnosticCodes.InvalidOperationMapping, `Duplicate operation input mapping '${mapping.property}'.`, mapping.location);\n names.add(mapping.property);\n const target = pathType(operation.inputs, mapping.property, false);\n if (target.missing) context.error(DiagnosticCodes.InvalidOperationMapping, `Operation '${operation.name}' declares no input '${mapping.property}'.`, mapping.location);\n if (target.type === null) continue;\n const targetSegments = mapping.property.split('.');\n for (let depth = 1; depth < targetSegments.length; depth++) if (allNames.has(targetSegments.slice(0, depth).join('.')))\n context.error(DiagnosticCodes.InvalidOperationMapping, `Operation input mapping '${mapping.property}' overlaps a whole input mapping.`, mapping.location);\n if (command !== null && mapping.source.kind === 'PathExpressionSyntax') {\n let supplied = pathType(command.properties, mapping.source.path);\n const segments = mapping.source.path.split('.');\n const reads = (commandReadSources.get(command) ?? []).filter(read => (read.alias ?? read.readModel) === segments[0]);\n if (supplied.missing && reads.length > 0) {\n supplied = { type: null, missing: false };\n const resolvedView = reads.length === 1 ? view(reads[0].readModel, scope) : null;\n if (segments.length > 1 && resolvedView !== null) supplied = pathType(resolvedView.properties, segments.slice(1).join('.'));\n }\n if (supplied.missing) context.error(DiagnosticCodes.InvalidOperationMapping, `Command '${command.name}' declares no source '${mapping.source.path}'.`, mapping.source.location);\n const source = supplied.type;\n const type = target.type;\n if (source !== null && known.has(source.name) && known.has(type.name) && (source.name !== type.name || source.isCollection !== type.isCollection || source.isOptional && !type.isOptional))\n context.error(DiagnosticCodes.InvalidOperationMapping, `Source '${mapping.source.path}' is incompatible with input '${mapping.property}' of operation '${operation.name}'.`, mapping.source.location);\n } else if (['LiteralExpressionSyntax', 'ObjectExpressionSyntax', 'ListExpressionSyntax'].includes(mapping.source.kind)) {\n if (!compatibleValue(mapping.source, target.type, concepts, composites) || required && !completeValue(mapping.source, target.type)) context.error(DiagnosticCodes.InvalidOperationMapping, `Value is incompatible with input '${mapping.property}' of operation '${operation.name}'.`, mapping.source.location);\n }\n }\n if (required) for (const input of operation.inputs) {\n if (!covered(input.type, input.name, names, suppliedPaths)) context.error(DiagnosticCodes.InvalidOperationMapping, `Production of operation '${operation.name}' supplies no value for required input '${input.name}'.`, operation.location);\n }\n };\n for (const { slice, scope } of resolver.slices) {\n const operations = operationDeclarations(slice);\n const names = new Set(eventDeclarations(slice).map(event => event.name));\n for (const operation of operations) {\n if (names.has(operation.name)) context.error(DiagnosticCodes.ProductionDeclarationCollision, `Operation '${operation.name}' collides with another event or operation in slice '${slice.name}'.`, operation.location);\n names.add(operation.name);\n if (operation.uses.length > 0 && systems.get(operation.uses) !== 1) context.error(DiagnosticCodes.InvalidSystemReference, `Operation '${operation.name}' must use one declared system; '${operation.uses}' does not resolve uniquely.`, operation.usesLocation ?? operation.location);\n for (const input of operation.inputs) {\n if (!known.has(input.type.name) && !imported.has(input.type.name)) context.warning(DiagnosticCodes.UnknownType, `Unknown type '${input.type.name}' on input '${input.name}' of operation '${operation.name}'.`, input.type.location);\n }\n }\n for (const command of slice.commands) for (const production of command.produces) {\n const resolution = resolver.resolve(production.event, slice);\n if (resolution.kind === AuthoringProductionKind.Ambiguous && resolution.candidates.some(node => node.kind === AuthoringProductionKind.Operation)) context.error(DiagnosticCodes.InvalidProductionReference, `Production '${production.event}' is ambiguous.`, production.location);\n if (production.event.includes('.') && resolution.kind !== AuthoringProductionKind.Operation) context.error(DiagnosticCodes.InvalidProductionReference, 'Qualified productions are supported only for explicitly declared operations.', production.location);\n if (resolution.declaration?.node.kind !== 'OperationSyntax') continue;\n if (production.for !== null || production.tags.length > 0) context.error(DiagnosticCodes.InvalidOperationDeclaration, 'Operation productions cannot declare event destinations or tags.', production.location);\n validateMappings(production.mappings, resolution.declaration.node, command, true, scope);\n }\n for (const production of slice.reactions.flatMap(reaction => reaction.triggers).flatMap(trigger => trigger.produces)) {\n const resolution = resolver.resolve(production.event, slice);\n if (resolution.kind === AuthoringProductionKind.Ambiguous && resolution.candidates.some(node => node.kind === AuthoringProductionKind.Operation)) context.error(DiagnosticCodes.InvalidProductionReference, `Production '${production.event}' is ambiguous.`, production.location);\n if (production.event.includes('.') && resolver.resolve(production.event, slice).kind !== AuthoringProductionKind.Operation) context.error(DiagnosticCodes.InvalidProductionReference, 'Qualified productions are supported only for explicitly declared operations.', production.location);\n if (resolver.isOperation(production, slice)) context.error(DiagnosticCodes.OperationOutsideCommand, 'Operations can only be produced by commands.', production.location);\n }\n for (const specification of slice.specifications) {\n const steps = [...specification.givenOperationFailures ?? [], ...specification.thenOperations ?? [], ...specification.thenCompensated ?? []];\n if (steps.length === 0) continue;\n const command = resolveCommand(effectiveCommand(specification.when, scope)?.commandType ?? '', scope);\n if (command === null || specification.whenAppended !== null || specification.whenQuery !== null || specification.whenTrigger !== null || specification.whenClock !== null || specification.whenCapture !== null)\n context.error(DiagnosticCodes.InvalidOperationSpecification, 'Operation fixtures and assertions require a declared command action.', specification.location);\n const duplicates = new Map<SyntaxNode, Set<string>>();\n for (const step of steps) {\n if (step.kind === 'SpecificationOperationSyntax') for (const mapping of step.values) {\n if (!concrete(mapping.source)) context.error(DiagnosticCodes.InvalidOperationSpecification, 'Operation assertions require concrete input values.', mapping.source.location);\n }\n const node = resolver.resolve(step.operation, slice).declaration?.node;\n if (node?.kind !== 'OperationSyntax') {\n context.error(DiagnosticCodes.InvalidOperationSpecification, `'${step.operation}' does not resolve uniquely to a declared operation.`, step.location);\n continue;\n }\n const kinds = duplicates.get(node) ?? new Set<string>();\n if (kinds.has(step.kind)) context.error(DiagnosticCodes.InvalidOperationSpecification, `Duplicate operation step '${step.operation}'.`, step.location);\n kinds.add(step.kind);\n duplicates.set(node, kinds);\n if (step.kind === 'SpecificationCompensatedSyntax' && node.compensate === null) context.error(DiagnosticCodes.InvalidOperationSpecification, `Operation '${step.operation}' declares no compensation.`, step.location);\n if (command !== null && command.command.handler == null) {\n const produced = command.command.produces.map(production => resolver.resolve(production.event, command.slice));\n if (produced.every(result => result.kind === AuthoringProductionKind.Event || result.kind === AuthoringProductionKind.Operation) && !produced.some(result => result.declaration?.node === node))\n context.error(DiagnosticCodes.InvalidOperationSpecification, `Command '${command.command.name}' does not produce operation '${step.operation}'.`, step.location);\n }\n if (step.kind === 'SpecificationOperationSyntax') validateMappings(step.values, node, null, false, scope);\n }\n }\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { IdentitySyntax } from '../Syntax/IdentitySyntax';\nimport { IdentityDetailSyntax } from '../Syntax/IdentityDetailSyntax';\nimport { IdentitySourceSyntax } from '../Syntax/IdentitySourceSyntax';\nimport { pattern } from '../Text/patterns';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { parseDescription } from './DescriptionParser';\nimport { parseMappingSource } from './ExpressionParser';\nimport { isCode, isFile, parseCode, parseFile } from './ImplementationParser';\nimport { firstWord, unescapeIdentifier } from './LineText';\nimport { ParserContext } from './ParserContext';\nimport { parseTypeRef, reportLegacyOptionalSuffix } from './PropertyLineParser';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst detailPattern = pattern('^(@?[a-z_]\\\\w*)\\\\s+([\\\\w.]+(?:\\\\[\\\\])?(?:\\\\?|\\\\s+optional)?)(?:\\\\s+from\\\\s+(.+))?$');\nconst claimPattern = pattern(`^claim\\\\s+\"(${stringBodyPattern})\"$`);\nconst queryPattern = pattern('^query\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)(?:\\\\s+by\\\\s+(.+))?$');\n\nexport function parseIdentity(context: ParserContext, header: SourceLine, existing: IdentitySyntax | null): IdentitySyntax | null {\n if (header.content !== 'identity') {\n context.error(DiagnosticCodes.InvalidIdentityDeclaration, `Invalid identity declaration '${header.content}' - expected 'identity'`, locationOf(header));\n context.skipBlock(header.indent);\n return existing;\n }\n if (existing !== null) {\n context.error(DiagnosticCodes.DuplicateIdentity, 'The document already declares an identity block - a document can have at most one', locationOf(header));\n context.skipBlock(header.indent);\n return existing;\n }\n const details: IdentityDetailSyntax[] = [];\n let description: string | null = null;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (firstWord(line.content) === 'description') {\n description = parseDescription(context, line, description, 'Identity');\n continue;\n }\n const match = detailPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidIdentityDetail, `Invalid identity detail '${line.content}' - expected '<name> <Type> [from claim \"<name>\" | from query <Query> by <expression>]'`, locationOf(line));\n context.skipBlock(line.indent);\n continue;\n }\n const type = parseTypeRef(match[2], { ...locationOf(line), column: line.indent + 1 + line.content.indexOf(match[2], match[1].length) });\n reportLegacyOptionalSuffix(context, type, line);\n const source = match[3] !== undefined ? parseSource(context, line, match[3]) : parseEscape(context, line);\n if (source !== null) details.push({ kind: 'IdentityDetailSyntax', name: unescapeIdentifier(match[1]), type, source, location: locationOf(line) });\n rejectBody(context, line, match[3] !== undefined ? DiagnosticCodes.IdentitySourceWithBody : DiagnosticCodes.InvalidIdentityDetail);\n }\n return { kind: 'IdentitySyntax', details, description, location: locationOf(header) };\n}\n\nfunction parseSource(context: ParserContext, line: SourceLine, text: string): IdentitySourceSyntax | null {\n const claim = claimPattern.exec(text);\n if (claim !== null) return { kind: 'ClaimIdentitySourceSyntax', claim: unescapeString(claim[1]), location: locationOf(line) };\n const query = queryPattern.exec(text);\n if (query !== null) {\n if (query[2] === undefined) {\n context.error(DiagnosticCodes.IdentityQueryWithoutKey, \"An identity query source requires 'by <expression>'\", locationOf(line));\n return null;\n }\n return { kind: 'QueryIdentitySourceSyntax', query: query[1], by: parseMappingSource(query[2], locationOf(line), context), location: locationOf(line) };\n }\n const kind = firstWord(text);\n context.error(kind === 'claim' || kind === 'query' ? DiagnosticCodes.InvalidIdentityDetail : DiagnosticCodes.UnknownIdentitySource,\n `Invalid identity source '${text}' - expected 'claim \"<name>\"' or 'query <Query> by <expression>'`, locationOf(line));\n return null;\n}\n\nfunction parseEscape(context: ParserContext, detail: SourceLine): IdentitySourceSyntax | null {\n const body = context.peekChild(detail.indent);\n if (body === undefined) {\n context.error(DiagnosticCodes.IdentityDetailWithoutSource, 'An identity detail requires a claim, query, inline code block or file source', locationOf(detail));\n return null;\n }\n context.reader.takeSignificant();\n if (isFile(body)) {\n const file = parseFile(context, body);\n rejectBody(context, body, DiagnosticCodes.InvalidIdentityDetail);\n return { kind: 'FileIdentitySourceSyntax', file, location: locationOf(body) };\n }\n if (isCode(context, body)) {\n const code = parseCode(context, body);\n return code === null ? null : { kind: 'CodeIdentitySourceSyntax', code, location: locationOf(body) };\n }\n context.error(DiagnosticCodes.InvalidIdentityDetail, `Unexpected '${body.content}' under an identity detail - expected a file reference or inline code block`, locationOf(body));\n context.skipBlock(body.indent);\n return null;\n}\n\nfunction rejectBody(context: ParserContext, parent: SourceLine, code: string): void {\n for (let child = context.peekChild(parent.indent); child !== undefined; child = context.peekChild(parent.indent)) {\n context.reader.takeSignificant();\n context.error(code, `Unexpected '${child.content}' under an identity source - refresh and caching are the runtime's business; a detail has exactly one source`, locationOf(child));\n context.skipBlock(child.indent);\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ConceptAttributeSyntax } from '../Syntax/Declarations';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { pattern } from '../Text/patterns';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nexport const specialCategories = ['racialOrEthnicOrigin', 'politicalOpinions', 'religiousOrPhilosophicalBeliefs', 'tradeUnionMembership', 'genetic', 'biometric', 'health', 'sexLifeOrSexualOrientation'];\nconst directivePattern = pattern('^(@?[a-z_]\\\\w*)\\\\s+(reason|scope|special|criminal)(?:\\\\s+(.*))?$');\nconst reasonPattern = pattern(`^\"(${stringBodyPattern})\"$`);\n\nexport function complianceWireName(marker: string): string {\n const name = marker.replace(/^@/, '');\n return name === 'personal' ? 'pii' : name === 'secret' ? 'sensitive' : name;\n}\n\nexport function canonicalComplianceName(marker: string): string {\n const name = complianceWireName(marker);\n return name === 'sensitive' ? 'secret' : name;\n}\n\nexport function parseComplianceMarkers(context: ParserContext, line: SourceLine, text: string): ConceptAttributeSyntax[] {\n const markers = text.trim().split(/\\s+/).filter(marker => marker.length > 0);\n reportLegacy(context, line, markers);\n return markers.map(marker => {\n const name = complianceWireName(marker);\n if (!['pii', 'sensitive'].includes(name) || marker === '@personal' || marker === '@secret') {\n context.error(DiagnosticCodes.UnknownComplianceMarker, `Unknown concept marker '${marker}' - expected pii, personal or secret`, locationOf(line));\n }\n return { kind: 'ConceptAttributeSyntax', name, reason: null, scope: null, specialCategory: null, criminal: false, location: locationOf(line) };\n });\n}\n\nexport function parseComplianceDirective(context: ParserContext, line: SourceLine, concept: string, attributes: ConceptAttributeSyntax[]): boolean {\n const match = directivePattern.exec(line.content);\n if (match === null) return false;\n const [, marker, setting] = match;\n const value = match[3] ?? '';\n const name = complianceWireName(marker);\n const canonical = canonicalComplianceName(marker);\n reportLegacy(context, line, [marker]);\n if (!['pii', 'sensitive'].includes(name) || marker === '@personal' || marker === '@secret') {\n context.error(DiagnosticCodes.UnknownComplianceMarker, `Unknown concept marker '${marker}' - expected pii, personal or secret`, locationOf(line));\n return true;\n }\n const index = attributes.findIndex(attribute => attribute.name === name);\n if (index < 0) {\n context.error(DiagnosticCodes.AttributeReasonWithoutAttribute, `Concept '${concept}' declares '${canonical} ${setting}' without the marker - write 'concept ${concept} : <Type> ${canonical}'`, locationOf(line));\n return true;\n }\n const attribute = attributes[index];\n switch (setting) {\n case 'reason': {\n const reason = reasonPattern.exec(value);\n if (reason === null) {\n context.error(DiagnosticCodes.UnknownConceptDirective, `Invalid '${canonical} reason' - expected '${canonical} reason \"<text>\"'`, locationOf(line));\n return true;\n }\n if (attribute.reason !== null) {\n context.error(DiagnosticCodes.DuplicateAttributeReason, `Concept '${concept}' already declares a reason for '${canonical}' - at most one is allowed`, locationOf(line));\n return true;\n }\n attributes[index] = { ...attribute, reason: unescapeString(reason[1]) };\n return true;\n }\n case 'scope':\n if (name !== 'sensitive' || !['subject', 'namespace', 'global'].includes(value)) {\n context.error(DiagnosticCodes.InvalidSecretScope, `Invalid '${canonical} scope ${value}' - scope belongs to secret and must be subject, namespace or global`, locationOf(line));\n return true;\n }\n if (attribute.scope != null) {\n context.error(DiagnosticCodes.DuplicateSecretScope, `Concept '${concept}' already declares secret scope - at most one is allowed`, locationOf(line));\n return true;\n }\n attributes[index] = { ...attribute, scope: value };\n if (attributes.some(attribute => attribute.name === 'pii')) {\n context.warning(DiagnosticCodes.SecretScopeIgnoredForPii, `Concept '${concept}' is pii secret - secret scope is ignored because only Chronicle [PII] renders`, locationOf(line));\n }\n return true;\n case 'special':\n case 'criminal':\n if (name !== 'pii' || (setting === 'special' ? !specialCategories.includes(value) : value.length > 0)) {\n context.error(DiagnosticCodes.InvalidPersonalDataQualifier, `Invalid '${canonical} ${setting}${value.length > 0 ? ` ${value}` : ''}' - expected 'pii criminal' or 'pii special <category>' with category ${specialCategories.join(', ')}`, locationOf(line));\n return true;\n }\n if (setting === 'special' && attribute.specialCategory != null) {\n context.error(DiagnosticCodes.DuplicateSpecialCategory, `Concept '${concept}' already declares pii special - at most one is allowed`, locationOf(line));\n return true;\n }\n attributes[index] = setting === 'special' ? { ...attribute, specialCategory: value } : { ...attribute, criminal: true };\n return true;\n default:\n return false;\n }\n}\n\nfunction reportLegacy(context: ParserContext, line: SourceLine, markers: readonly string[]): void {\n if (markers.some(marker => ['@pii', 'sensitive', '@sensitive'].includes(marker))) {\n context.information(DiagnosticCodes.LegacyComplianceMarker, 'Legacy compliance spelling - use bare pii for personal data and secret for operational secrets; reason text is preserved', locationOf(line));\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { CodeBlockSyntax, FileReferenceSyntax } from '../Syntax/Implementations';\nimport { PolicyConditionSyntax, PolicySyntax } from '../Syntax/Policies';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { nativePattern as pattern } from '../Text/patterns';\nimport { parseModeledMappingSource as parseMappingSource } from './ExpressionParser';\nimport { parseCode, parseFile } from './ImplementationParser';\nimport { firstWord } from './LineText';\nimport { parseDescription } from './DescriptionParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst headerPattern = pattern('^policy\\\\s+([A-Za-z_]\\\\w*)$');\n\nexport function parsePolicy(context: ParserContext, header: SourceLine): PolicySyntax {\n const diagnosticContext = context;\n context = context.valueContext;\n const name = headerPattern.exec(header.content)?.[1] ?? '';\n if (name === '') context.error(DiagnosticCodes.InvalidPolicyDeclaration, `Invalid policy declaration '${header.content}' - expected 'policy <Name>'`, locationOf(header));\n let condition: PolicyConditionSyntax | null = null;\n let code: CodeBlockSyntax | null = null;\n let file: FileReferenceSyntax | null = null;\n let hasRequire = false;\n let description: string | null = null;\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n if (firstWord(line.content) === 'description') {\n description = parseDescription(diagnosticContext, line, description, `Policy '${name}'`);\n } else if (firstWord(line.content) === 'require') {\n let text = line.content.substring('require'.length).trim();\n for (let continuation = context.peekChild(line.indent); continuation !== undefined; continuation = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n text += ` ${continuation.content}`;\n }\n const tokens = tokenizePolicyCondition(context, text);\n // Negation is newly admitted syntax, not diagnostic-free enrichment of legacy fields.\n if (tokens.includes('not')) context = diagnosticContext;\n const parsed = parsePolicyCondition(context, tokens, locationOf(line));\n if (hasRequire) context.error(DiagnosticCodes.RepeatedPolicyRequirement, `Policy '${name}' has more than one require line; combine the conditions with and/or in one require`, locationOf(line));\n else condition = parsed;\n hasRequire = true;\n } else if (firstWord(line.content) === 'file') {\n const parsed = parseFile(context, line);\n if (code === null && file === null) file = parsed;\n else context.error(DiagnosticCodes.UnknownPolicyDirective, `Policy '${name}' must have only one implementation - a file reference or an inline code block, not both`, locationOf(line));\n } else if (line.content.startsWith('```') || context.languages.has(line.content)) {\n const parsed = parseCode(context, line);\n if (code === null && file === null) code = parsed;\n else context.error(DiagnosticCodes.UnknownPolicyDirective, `Policy '${name}' must have only one implementation - a file reference or an inline code block, not both`, locationOf(line));\n } else {\n context.error(DiagnosticCodes.UnknownPolicyDirective, `Unexpected '${line.content}' in policy body - expected 'require ...', 'file <path>' or an inline code block`, locationOf(line));\n context.skipOpaqueBlock(line.indent);\n }\n }\n if (condition !== null && (code !== null || file !== null)) context.error(DiagnosticCodes.MixedPolicyImplementation, `Policy '${name}' cannot combine 'require' with a file or inline code block`, locationOf(header));\n if (condition === null && code === null && file === null) context.error(DiagnosticCodes.PolicyWithoutRequirement, `Policy '${name}' must declare a 'require' condition, a file reference or an inline code block`, locationOf(header));\n return { kind: 'PolicySyntax', name, condition, code, file, description, location: locationOf(header) };\n}\n\nfunction tokenizePolicyCondition(context: ParserContext, text: string): string[] {\n const numeric = context.sourceOptions.numericMode === 'exact' ? '-?[0-9]+(?:\\\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?(?=$|[\\\\s()])|[\\\\w.$-]+|[^\\\\s]' : '[\\\\w.$]+';\n return [...(text.match(new RegExp(pattern(`\"${stringBodyPattern}\"|\\\\(|\\\\)|${numeric}`).source, 'gu')) ?? [])];\n}\n\nfunction parsePolicyCondition(context: ParserContext, tokens: string[], location: SourceLocation): PolicyConditionSyntax | null {\n const reportDiagnostics = context.sourceOptions.numericMode === 'exact' || tokens.includes('not');\n let position = 0;\n const quoted = (token: string | undefined): token is string => token !== undefined && token.startsWith('\"') && token.endsWith('\"');\n const unquote = (token: string): string => unescapeString(token.substring(1, token.length - 1));\n const group = (): PolicyConditionSyntax | null => {\n if (tokens[position] === 'not') {\n position++;\n const operand = group();\n return operand === null ? null : { kind: 'NotPolicyConditionSyntax', operand, location };\n }\n if (tokens[position] === '(') {\n position++;\n const result = or();\n if (tokens[position] === ')') position++;\n else if (reportDiagnostics) context.error(DiagnosticCodes.UnclosedPolicyConditionGroup, \"Expected ')' in policy condition\", location);\n return result;\n }\n const token = tokens[position++];\n if (token === 'authenticated') return { kind: 'AuthenticatedConditionSyntax', location };\n if (token !== 'role' && token !== 'claim') {\n context.error(token === undefined ? DiagnosticCodes.ExpectedPolicyCondition : DiagnosticCodes.UnexpectedTokenInPolicyCondition, token === undefined ? 'Expected a policy condition' : `Unexpected '${token}' in policy condition`, location);\n return null;\n }\n const name = tokens[position++];\n if (!quoted(name)) {\n context.error(token === 'role' ? DiagnosticCodes.ExpectedRoleName : DiagnosticCodes.ExpectedClaimName, `Expected a quoted ${token} name after '${token}'`, location);\n return null;\n }\n if (token === 'role') return { kind: 'RoleConditionSyntax', role: unquote(name), location };\n if (tokens[position++] !== 'matches') {\n context.error(DiagnosticCodes.ExpectedClaimMatches, \"Expected 'matches' after the claim name\", location);\n return null;\n }\n const target = tokens[position++];\n if (target === undefined) {\n context.error(DiagnosticCodes.ExpectedClaimMatchTarget, \"Expected 'subject' or a value after 'matches'\", location);\n return null;\n }\n return { kind: 'ClaimConditionSyntax', claim: unquote(name), matchesSubject: target === 'subject', matches: target === 'subject' ? null : parseMappingSource(target, location, context), location };\n };\n const and = (): PolicyConditionSyntax | null => {\n let left = group();\n while (left !== null && tokens[position] === 'and') { position++; const right = group(); if (right === null) return null; left = { kind: 'LogicalPolicyConditionSyntax', left, operator: 'And', right, location }; }\n return left;\n };\n const or = (): PolicyConditionSyntax | null => {\n let left = and();\n while (left !== null && tokens[position] === 'or') { position++; const right = and(); if (right === null) return null; left = { kind: 'LogicalPolicyConditionSyntax', left, operator: 'Or', right, location }; }\n return left;\n };\n const condition = or();\n if (reportDiagnostics) {\n if (condition !== null && position < tokens.length) context.error(DiagnosticCodes.UnexpectedTokenInPolicyCondition, `Unexpected '${tokens[position]}' in policy condition`, location);\n }\n return condition;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { SeedEventSyntax, SeedGroupSyntax, SeedSyntax } from '../Syntax/Seeds';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { nativePattern as pattern } from '../Text/patterns';\nimport { parseModeledMappingSource as parseMappingSource } from './ExpressionParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst forPattern = new RegExp(`^for\\\\s+\"(${stringBodyPattern})\"$`, 'u');\nconst eventPattern = pattern('^[A-Z]\\\\w*$');\nconst mappingPattern = pattern('^([\\\\w.]+)\\\\s*=(?!=|>)\\\\s*(.+)$');\n\nexport function parseSeed(context: ParserContext, header: SourceLine): SeedSyntax {\n const groups: SeedGroupSyntax[] = [];\n context = context.valueContext;\n if (header.content !== 'seed') {\n context.error(DiagnosticCodes.InvalidSeedDeclaration, `Invalid seed declaration '${header.content}' - expected 'seed'`, locationOf(header));\n context.skipOpaqueBlock(header.indent);\n return { kind: 'SeedSyntax', groups, location: locationOf(header) };\n }\n for (let group = context.peekChild(header.indent); group !== undefined; group = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const match = forPattern.exec(group.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidSeedGroup, `Invalid seed group '${group.content}' - expected 'for \"<event source id>\"'`, locationOf(group));\n context.skipOpaqueBlock(group.indent);\n continue;\n }\n const events: SeedEventSyntax[] = [];\n for (let event = context.peekChild(group.indent); event !== undefined; event = context.peekChild(group.indent)) {\n context.reader.takeSignificant();\n if (!eventPattern.test(event.content)) {\n context.error(DiagnosticCodes.InvalidSeedEvent, `Invalid seed event '${event.content}' - expected an event type name`, locationOf(event));\n context.skipOpaqueBlock(event.indent);\n continue;\n }\n const properties: PropertyMappingSyntax[] = [];\n for (let property = context.peekChild(event.indent); property !== undefined; property = context.peekChild(event.indent)) {\n context.reader.takeSignificant();\n const mapped = mappingPattern.exec(property.content);\n if (mapped !== null) properties.push({ kind: 'PropertyMappingSyntax', property: mapped[1], source: parseMappingSource(mapped[2], locationOf(property), context), location: locationOf(property) });\n else context.error(DiagnosticCodes.InvalidSeedPropertyAssignment, `Invalid property assignment '${property.content}' - expected '<property> = <value>'`, locationOf(property));\n }\n events.push({ kind: 'SeedEventSyntax', event: event.content, properties, location: locationOf(event) });\n }\n groups.push({ kind: 'SeedGroupSyntax', eventSourceId: unescapeString(match[1]), events, location: locationOf(group) });\n }\n return { kind: 'SeedSyntax', groups, location: locationOf(header) };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ContributedItemSyntax, ContributedItemValueSyntax, ExposedPropertySyntax, ExposureSyntax, InstanceContributionSyntax, InstanceContributionsSyntax } from '../Syntax/CompositionSyntax';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { pattern } from '../Text/patterns';\nimport { parseMappingSource } from './ExpressionParser';\nimport { ParserContext } from './ParserContext';\nimport { locationOf, SourceLine } from './SourceLine';\n\nconst component = `(?:([A-Za-z_]\\\\w*)|\"(${stringBodyPattern})\")\\\\.(\\\\w+(?:\\\\.\\\\w+)*)`;\nconst exposureHeader = pattern('^exposure\\\\s+for\\\\s+([A-Za-z_]\\\\w*)$');\nconst instanceHeader = pattern('^instance\\\\s+([A-Za-z_]\\\\w*)$');\nconst exposedProperty = pattern(`^property\\\\s+${component}(?:\\\\s+label\\\\s+\"(${stringBodyPattern})\")?(?:\\\\s+operations\\\\s+([\\\\w-]+(?:\\\\s*,\\\\s*[\\\\w-]+)*))?(?:\\\\s+fields\\\\s+(\\\\w+(?:\\\\s*,\\\\s*\\\\w+)*))?(?:\\\\s+reexposes\\\\s+([A-Za-z_]\\\\w*))?$`);\nconst setPattern = pattern(`^set\\\\s+${component}\\\\s*=\\\\s*(.+)$`);\nconst itemsPattern = pattern(`^items\\\\s+${component}$`);\nconst itemPattern = pattern(`^item\\\\s+(?:([A-Za-z_][\\\\w-]*)|\"(${stringBodyPattern})\")$`);\nconst itemValuePattern = pattern('^([A-Za-z_]\\\\w*)\\\\s*=\\\\s*(.+)$');\nconst operations = ['add', 'remove', 'reorder', 'edit-fields'];\nconst exposedPropertyShape = '\\'property <component>.<path> [label \"<text>\"] [operations <add|remove|reorder|edit-fields>, ...] [fields <field>, ...] [reexposes <Owner>]\\'';\n\nconst reference = (match: RegExpExecArray, group: number): string => match[group] ?? unescapeString(match[group + 1]);\nconst list = (text: string): string[] => text.trim() === 'none' ? [] : text.split(',').map(entry => entry.trim()).filter(entry => entry.length > 0);\n\n// 'exposure for <Owner>' - the port of the C# CompositionParser.ParseExposure.\nexport function parseExposure(context: ParserContext, header: SourceLine): ExposureSyntax {\n const match = exposureHeader.exec(header.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidExposureDeclaration, `Invalid exposure declaration '${header.content}' - expected 'exposure for <Owner>'`, locationOf(header));\n }\n const properties: ExposedPropertySyntax[] = [];\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const property = parseExposedProperty(context, line);\n if (property !== undefined) properties.push(property);\n }\n return { kind: 'ExposureSyntax', owner: match?.[1] ?? header.content, properties, location: locationOf(header) };\n}\n\n// 'instance <Instance>' - the port of the C# CompositionParser.ParseInstance.\nexport function parseInstance(context: ParserContext, header: SourceLine): InstanceContributionsSyntax {\n const match = instanceHeader.exec(header.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidInstanceContribution, `Invalid instance declaration '${header.content}' - expected 'instance <Screen or Template>'`, locationOf(header));\n }\n const contributions: InstanceContributionSyntax[] = [];\n for (let line = context.peekChild(header.indent); line !== undefined; line = context.peekChild(header.indent)) {\n context.reader.takeSignificant();\n const contribution = parseContribution(context, line);\n if (contribution !== undefined) contributions.push(contribution);\n }\n return { kind: 'InstanceContributionsSyntax', instance: match?.[1] ?? header.content, contributions, location: locationOf(header) };\n}\n\nfunction parseExposedProperty(context: ParserContext, line: SourceLine): ExposedPropertySyntax | undefined {\n const match = exposedProperty.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidExposureDeclaration, `Invalid exposed property '${line.content}' - expected ${exposedPropertyShape}`, locationOf(line));\n return undefined;\n }\n const granted = match[5] === undefined ? [] : list(match[5]);\n const unknown = granted.find(operation => !operations.includes(operation));\n if (unknown !== undefined) {\n context.error(DiagnosticCodes.InvalidExposureDeclaration, `Unknown collection operation '${unknown}' - expected add, remove, reorder, edit-fields or none`, locationOf(line));\n return undefined;\n }\n return {\n kind: 'ExposedPropertySyntax',\n component: reference(match, 1),\n path: match[3],\n label: match[4] === undefined ? null : unescapeString(match[4]),\n isCollection: match[5] !== undefined,\n operations: granted,\n restrictsFields: match[6] !== undefined,\n editableFields: match[6] === undefined ? [] : list(match[6]),\n reExposes: match[7] ?? null,\n location: locationOf(line)\n };\n}\n\nfunction parseContribution(context: ParserContext, line: SourceLine): InstanceContributionSyntax | undefined {\n const set = setPattern.exec(line.content);\n if (set !== null) {\n context.skipBlock(line.indent);\n return { kind: 'InstanceContributionSyntax', component: reference(set, 1), path: set[3], value: parseMappingSource(set[4], locationOf(line), context), items: [], location: locationOf(line) };\n }\n const items = itemsPattern.exec(line.content);\n if (items !== null) {\n const parsed: ContributedItemSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const item = parseItem(context, child);\n if (item !== undefined) parsed.push(item);\n }\n return { kind: 'InstanceContributionSyntax', component: reference(items, 1), path: items[3], value: null, items: parsed, location: locationOf(line) };\n }\n context.error(DiagnosticCodes.InvalidInstanceContribution, `Invalid instance contribution '${line.content}' - expected 'set <component>.<path> = <value>' or 'items <component>.<path>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n}\n\nfunction parseItem(context: ParserContext, line: SourceLine): ContributedItemSyntax | undefined {\n const match = itemPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidInstanceContribution, `Invalid contributed item '${line.content}' - expected 'item <id>'`, locationOf(line));\n context.skipBlock(line.indent);\n return undefined;\n }\n const values: ContributedItemValueSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const value = itemValuePattern.exec(child.content);\n if (value === null) {\n context.error(DiagnosticCodes.InvalidInstanceContribution, `Invalid item value '${child.content}' - expected '<field> = <value>'`, locationOf(child));\n context.skipBlock(child.indent);\n continue;\n }\n values.push({ kind: 'ContributedItemValueSyntax', field: value[1], value: parseMappingSource(value[2], locationOf(child), context), location: locationOf(child) });\n }\n return { kind: 'ContributedItemSyntax', id: reference(match, 1), values, location: locationOf(line) };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { IdentitySyntax } from '../Syntax/IdentitySyntax';\nimport { parseIdentity } from './IdentityParser';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { recordAuthoredDocument } from '../Syntax/SourceOptions';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { describePlacement, documentPlacement, isDocumentPlacement, PlayPlacement } from '../Files/PlayPlacement';\nimport { PersonaSyntax } from '../Syntax/Authorization';\nimport { ConceptSyntax, DomainSyntax, ImportSyntax, TypeSyntax } from '../Syntax/Declarations';\nimport { SpecificationExampleSyntax } from '../Syntax/Specifications';\nimport { ApplicationSyntax, FeatureSyntax, FileImportSyntax, ModuleSyntax } from '../Syntax/Structure';\nimport { parseTriggerDeclaration } from './TriggerDataParser';\nimport { pattern } from '../Text/patterns';\nimport { parseComplianceDirective, parseComplianceMarkers } from './ConceptComplianceParser';\nimport { parseType } from './DeclarationParsers';\nimport { ValidateSyntax } from '../Syntax/Commands';\nimport { parseValidate } from './CommandParser';\nimport { parseDescription } from './DescriptionParser';\nimport { FeatureBody, featureBodyExpected } from './FeatureBody';\nimport { isFileImport, parseFileImport } from './FileImportParser';\nimport { isFileDirective } from './FileReferences';\nimport { collectInputUses } from './InputUses';\nimport { firstWord, unescapeIdentifier } from './LineText';\nimport { ModuleBody, moduleBodyExpected, modulePattern, parseModule } from './ModuleBody';\nimport { ParserContext } from './ParserContext';\nimport { PolicySyntax } from '../Syntax/Policies';\nimport { parsePolicy } from './PolicyParser';\nimport { PurposeSyntax } from '../Syntax/Purposes';\nimport { parsePurpose } from './PurposeParser';\nimport { SeedSyntax } from '../Syntax/Seeds';\nimport { parseSeed } from './SeedParser';\nimport { parseSystem } from './OperationParser';\nimport { EventVisibility } from '../Syntax/EventVisibility';\nimport { isBlankPublicEventOrigin } from '../Syntax/PublicEventInvariants';\nimport { stringBodyPattern, unescapeString } from '../Text/StringLiteral';\nimport { SystemSyntax } from '../Syntax/Operations';\nimport { EventSourceSyntax } from '../Syntax/EventSources';\nimport { parseEventSource } from './EventSourceParser';\nimport { parseExposure, parseInstance } from './CompositionParser';\nimport { ExposureSyntax, InstanceContributionsSyntax } from '../Syntax/CompositionSyntax';\nimport { parseExample } from './SpecificationExampleParser';\nimport { locationOf, SourceLine, startOf } from './SourceLine';\n\nconst domainPattern = pattern('^domain\\\\s+([A-Za-z_]\\\\w*(?:\\\\.[A-Za-z_]\\\\w*)*)$');\nconst importPattern = pattern(`^import\\\\s+([\\\\w.]+)(?:\\\\s+from\\\\s+\"(?<origin>${stringBodyPattern})\")?$`);\nconst conceptPattern = pattern('^concept\\\\s+(\\\\w+)\\\\s*:\\\\s*(\\\\w+)((?:\\\\s+@?\\\\w+)*)$');\nconst enumValuePattern = pattern('^@?[a-z_]\\\\w*$');\nconst personaPattern = pattern('^persona\\\\s+([A-Za-z_]\\\\w*)$');\nconst personaPolicyPattern = pattern('^policy\\\\s+([A-Za-z_]\\\\w*)$');\nconst tabIndentPattern = /^[ ]*\\t/;\nconst primitiveTypes = ['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime'];\n\n// Top-level, module and feature constructs the C# compiler knows that this compiler does not model. They\n// are skipped whole, not reported.\nconst opaqueTopLevel = new Set(['policy', 'authentication', 'seed', 'ui', 'theme', 'trigger', 'layout', 'behavior']);\n\n// What belongs in a module or feature body; at the top level of a whole document it gets a hint saying so.\nconst bodyKeywords = new Set(['slice', 'feature', 'description', 'documentation', 'authorize', 'screen', 'dialog', 'form', 'contribute', 'on', 'uses']);\n\n// Parses one document into its application syntax - the port of the C# ScreenplayParser. The placement says\n// where the document's top level belongs: the application, unless an import placed it in a module or feature.\nexport function parseApplication(context: ParserContext, lines: readonly SourceLine[], placement: PlayPlacement = documentPlacement): ApplicationSyntax {\n context.deferIdentityValidation = true;\n warnOnTabIndentation(context, lines);\n const moduleBody = placement.length === 1 ? new ModuleBody(placement[0]) : undefined;\n const featureBody = placement.length > 1 ? new FeatureBody(placement[placement.length - 1]) : undefined;\n const placedBody = moduleBody ?? featureBody;\n let identity: IdentitySyntax | null = null;\n let domain: DomainSyntax | null = null;\n const imports: ImportSyntax[] = [];\n const fileImports: FileImportSyntax[] = [];\n const concepts: ConceptSyntax[] = [];\n const types: TypeSyntax[] = [];\n const systems: SystemSyntax[] = [];\n const eventSources: EventSourceSyntax[] = [];\n const modules: ModuleSyntax[] = [];\n const personas: PersonaSyntax[] = [];\n const policies: PolicySyntax[] = [];\n const purposes: PurposeSyntax[] = [];\n const seeds: SeedSyntax[] = [];\n const examples: SpecificationExampleSyntax[] = [];\n const declaredTriggers: NonNullable<ApplicationSyntax['declaredTriggers']>[number][] = [];\n const exposures: ExposureSyntax[] = [];\n const instanceContributions: InstanceContributionsSyntax[] = [];\n let sawOtherConstruct = false;\n for (let line = context.reader.peekSignificant(); line !== undefined; line = context.reader.peekSignificant()) {\n context.reader.takeSignificant();\n const keyword = firstWord(line.content);\n if (keyword === 'domain') {\n context.authoredDeclarations = true;\n domain = parseDomain(context, line, domain, sawOtherConstruct);\n continue;\n }\n // The C# parser asks whether anything was declared before the domain, so an import it rejected,\n // a file import and an unknown construct do not count.\n sawOtherConstruct ||= declaresConstruct(keyword, line, placement);\n context.authoredDeclarations ||= keyword !== 'import' && declaresConstruct(keyword, line, placement);\n if (keyword === 'import' && isFileImport(line.content)) {\n // A top level import belongs to whatever the document's top level is - the application, or the\n // module or feature the document was itself imported into.\n if (placedBody !== undefined) {\n placedBody.tryParse(context, line);\n } else {\n parseFileImport(context, line, fileImports);\n }\n } else if (keyword === 'import') {\n const match = importPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidImportDeclaration, `Invalid import '${line.content}' - expected 'import <Qualified.Name> [from \"<origin>\"]'`, locationOf(line));\n } else {\n const origin = match.groups?.origin === undefined ? null : unescapeString(match.groups.origin);\n if (origin !== null && isBlankPublicEventOrigin(origin)) {\n context.error(DiagnosticCodes.InvalidImportDeclaration, 'An import origin must be a nonblank quoted string', locationOf(line));\n }\n imports.push({ kind: 'ImportSyntax', qualifiedName: match[1], origin, visibility: origin === null ? EventVisibility.Private : EventVisibility.Public, location: locationOf(line) });\n }\n } else if (keyword === 'example') {\n if (placedBody !== undefined) placedBody.tryParse(context, line);\n else examples.push(parseExample(context, line));\n } else if (keyword === 'eventsource') {\n eventSources.push(parseEventSource(context, line));\n } else if (keyword === 'system') {\n systems.push(parseSystem(context, line));\n } else if (keyword === 'concept') {\n concepts.push(parseConcept(context, line));\n } else if (keyword === 'type') {\n types.push(parseType(context, line));\n } else if (keyword === 'module' && !isDocumentPlacement(placement)) {\n parseModuleInPlacedFile(context, line, placement, moduleBody);\n } else if (keyword === 'module') {\n modules.push(parseModule(context, line));\n } else if (keyword === 'persona') {\n personas.push(parsePersona(context, line));\n } else if (keyword === 'seed') {\n seeds.push(parseSeed(context.valueContext, line));\n } else if (keyword === 'purpose' && placedBody !== undefined) {\n placedBody.tryParse(context, line);\n } else if (keyword === 'purpose') {\n purposes.push(parsePurpose(context, line));\n } else if (keyword === 'identity') {\n identity = parseIdentity(context, line, identity);\n } else if (keyword === 'policy') {\n // Legacy policies were opaque: enrich their structure without adding diagnostics.\n policies.push(parsePolicy(context, line));\n } else if (keyword === 'exposure') {\n exposures.push(parseExposure(context, line));\n } else if (keyword === 'instance') {\n instanceContributions.push(parseInstance(context, line));\n } else if (keyword === 'trigger') {\n const data = parseTriggerDeclaration(context, line);\n const name = /^trigger\\s+([A-Za-z_]\\w*)$/.exec(line.content)?.[1];\n if (name !== undefined) declaredTriggers.push({ name, data });\n } else if (opaqueTopLevel.has(keyword)) {\n if (keyword === 'behavior' || keyword === 'layout') collectInputUses(context, line);\n else context.skipOpaqueBlock(line.indent);\n } else if (placedBody?.tryParse(context, line) !== true) {\n reportUnexpectedTopLevel(context, line, placement);\n }\n }\n if (moduleBody !== undefined) {\n modules.unshift(moduleBody.build(context.start, true));\n } else if (featureBody !== undefined) {\n modules.unshift(place(placement, featureBody.build(context.start, true), context.start));\n }\n const root: ApplicationSyntax = { kind: 'ApplicationSyntax', ...(identity === null ? {} : { identity }), sourceOptions: context.sourceOptions, domain, imports, concepts, types, systems, eventSources, examples, modules, personas, policies, purposes, seeds, declaredTriggers, fileImports, ...(exposures.length > 0 ? { exposures } : {}), ...(instanceContributions.length > 0 ? { instanceContributions } : {}), location: context.start };\n if (context.authoredDeclarations) recordAuthoredDocument(root);\n return root;\n}\n\nfunction declaresConstruct(keyword: string, line: SourceLine, placement: PlayPlacement): boolean {\n if (keyword === 'import') {\n return importPattern.test(line.content);\n }\n if (keyword === 'module') {\n return isDocumentPlacement(placement);\n }\n if (keyword === 'identity') return line.content === 'identity';\n return keyword === 'purpose' || keyword === 'example' || keyword === 'exposure' || keyword === 'instance' || keyword === 'eventsource' || keyword === 'system' || keyword === 'concept' || keyword === 'type' || keyword === 'persona' || opaqueTopLevel.has(keyword);\n}\n\nfunction parseModuleInPlacedFile(context: ParserContext, line: SourceLine, placement: PlayPlacement, moduleBody: ModuleBody | undefined): void {\n const name = modulePattern.exec(line.content)?.[1] ?? '';\n\n // Restating the module a file is placed in says nothing new, so its body simply joins the placement.\n if (moduleBody !== undefined && name === placement[0]) {\n context.authoredDeclarations = true;\n moduleBody.parseChildren(context, line);\n return;\n }\n context.error(DiagnosticCodes.ModuleInPlacedFile,\n `This file is imported into ${describePlacement(placement)}, so it cannot declare module '${name}' - import it at the top level of a document instead`, locationOf(line));\n context.skipBlock(line.indent);\n}\n\nfunction reportUnexpectedTopLevel(context: ParserContext, line: SourceLine, placement: PlayPlacement): void {\n const word = firstWord(line.content);\n if (!isDocumentPlacement(placement)) {\n const expected = placement.length === 1 ? moduleBodyExpected : featureBodyExpected;\n context.error(DiagnosticCodes.UnexpectedInPlacedFile,\n `Unexpected '${word}' in a file imported into ${describePlacement(placement)} - expected an application declaration or ${expected}`, locationOf(line));\n } else {\n const hint = bodyKeywords.has(word)\n ? ` - '${word}' belongs in a module or feature; wrap it in one, or import this file from inside one`\n : ' - expected domain, import, concept, type, policy, persona, authentication, identity, module, seed, trigger, behavior, ui profile, theme or layout';\n context.error(DiagnosticCodes.UnknownTopLevelConstruct, `Unexpected '${word}' at the top level${hint}`, locationOf(line));\n }\n context.skipBlock(line.indent);\n}\n\n// Wraps the feature a file is placed in in the features and module around it, each marked as a placement.\nfunction place(placement: PlayPlacement, innermost: FeatureSyntax, start: SourceLocation): ModuleSyntax {\n let feature = innermost;\n for (let index = placement.length - 2; index >= 1; index--) {\n feature = {\n kind: 'FeatureSyntax', name: placement[index], description: null, authorize: null,\n features: [feature], slices: [], fileImports: [], isPlacement: true, location: start,\n };\n }\n return {\n kind: 'ModuleSyntax', name: placement[0], description: null, authorize: null,\n features: [feature], fileImports: [], isPlacement: true, location: start,\n };\n}\n\nfunction parseDomain(context: ParserContext, line: SourceLine, existing: DomainSyntax | null, sawOtherConstruct: boolean): DomainSyntax | null {\n const match = domainPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidDomainDeclaration, `Invalid domain declaration '${line.content}' - expected 'domain <Qualified.Name>'`, locationOf(line));\n return existing;\n }\n if (existing !== null) {\n context.error(DiagnosticCodes.DuplicateDomain, 'The document already declares a domain - a document can have at most one', locationOf(line));\n return existing;\n }\n if (sawOtherConstruct) {\n context.error(DiagnosticCodes.DomainNotFirst, '\\'domain\\' must be declared before any other construct', locationOf(line));\n }\n return { kind: 'DomainSyntax', name: match[1], location: locationOf(line) };\n}\n\nfunction warnOnTabIndentation(context: ParserContext, lines: readonly SourceLine[]): void {\n let inFence = false;\n for (const line of lines) {\n if (line.raw.trimStart().startsWith('```')) {\n inFence = !inFence;\n continue;\n }\n if (!inFence && tabIndentPattern.test(line.raw)) {\n context.warning(DiagnosticCodes.TabIndentation, 'Screenplay is indentation based - use spaces, not tabs', startOf(line));\n }\n }\n}\n\nfunction parseConcept(context: ParserContext, line: SourceLine): ConceptSyntax {\n const match = conceptPattern.exec(line.content);\n if (match === null) {\n context.error(DiagnosticCodes.InvalidConceptDeclaration, `Invalid concept declaration '${line.content}' - expected 'concept <Name> : <Type>'`, locationOf(line));\n context.skipBlock(line.indent);\n return { kind: 'ConceptSyntax', name: firstWord(line.content), type: '', attributes: [], values: [], location: locationOf(line) };\n }\n const [, name, type, attributeText] = match;\n const attributes = parseComplianceMarkers(context, line, attributeText);\n if (type !== 'Enum' && !primitiveTypes.includes(type)) {\n context.error(DiagnosticCodes.UnknownPrimitiveType, `Unknown primitive type '${type}' - expected ${primitiveTypes.join(', ')} or Enum`, locationOf(line));\n }\n const values: string[] = [];\n let description: string | null = null;\n const validations: ValidateSyntax[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n if (firstWord(child.content) === 'description' && (type !== 'Enum' || child.content !== 'description' || context.peekChild(child.indent)?.content.startsWith('```') === true)) {\n description = parseDescription(context, child, description, `Concept '${name}'`);\n } else if (isFileDirective(child)) {\n continue;\n } else if (firstWord(child.content) === 'validate') {\n if (type === 'Enum' && child.content === 'validate' && context.peekChild(child.indent) === undefined) {\n context.warning(DiagnosticCodes.ValidateReadAsEnumerationBlock,\n `'validate' in enumeration concept '${name}' declares an empty validate block, not a value named 'validate' - write '@validate' for the value`,\n locationOf(child));\n }\n const parsed = parseValidate(context, child, 'concept');\n if (parsed !== undefined) validations.push(parsed);\n } else if (parseComplianceDirective(context, child, name, attributes)) {\n // Compliance directives are modeled by their original concept marker.\n } else if (type === 'Enum' && enumValuePattern.test(child.content)) {\n values.push(unescapeIdentifier(child.content));\n } else if (type === 'Enum') {\n context.error(DiagnosticCodes.InvalidEnumerationValue, `Invalid enum value '${child.content}' - expected an identifier`, locationOf(child));\n } else {\n context.error(DiagnosticCodes.UnknownConceptDirective, `Unexpected '${child.content}' in concept body - expected validate, 'file <path>' or '<attribute> reason \"<text>\"'`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n return { kind: 'ConceptSyntax', name, type, attributes, values, validations, description, location: locationOf(line) };\n}\n\n// 'persona <Name>' with an optional description and the policies it holds - the port of the C# ParsePersona.\nfunction parsePersona(context: ParserContext, line: SourceLine): PersonaSyntax {\n const name = personaPattern.exec(line.content)?.[1] ?? '';\n if (name === '') {\n context.error(DiagnosticCodes.InvalidPersonaDeclaration, `Invalid persona declaration '${line.content}' - expected 'persona <Name>'`, locationOf(line));\n }\n let description: string | null = null;\n const policies: string[] = [];\n for (let child = context.peekChild(line.indent); child !== undefined; child = context.peekChild(line.indent)) {\n context.reader.takeSignificant();\n const keyword = firstWord(child.content);\n if (keyword === 'description') {\n description = parseDescription(context, child, description, `Persona '${name}'`);\n } else if (keyword === 'policy') {\n const policy = personaPolicyPattern.exec(child.content);\n if (policy === null) {\n context.error(DiagnosticCodes.InvalidPersonaPolicyReference, `Invalid policy reference '${child.content}' - expected 'policy <Name>'`, locationOf(child));\n } else {\n policies.push(policy[1]);\n }\n } else {\n context.error(DiagnosticCodes.UnknownPersonaDirective, `Unexpected '${keyword}' in persona body - expected description or policy`, locationOf(child));\n context.skipBlock(child.indent);\n }\n }\n return { kind: 'PersonaSyntax', name, description, policies, location: locationOf(line) };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { documentPlacement, PlayPlacement } from '../Files/PlayPlacement';\nimport { sourceContext } from './SourceOptionsParser';\nimport { parseApplication } from './ScreenplayParser';\nimport { SourceLine } from './SourceLine';\n\n// One noncommitting real parse per immutable document, without stream candidates. Commands retain\n// legacy properties; the parser owns leaf/block/fence rules. Capture never calls itself recursively.\nexport class CommandStreamCandidates {\n private constructor(private readonly sources: ReadonlyMap<string, readonly (readonly string[])[]>, private readonly qualifiedTypes: ReadonlySet<string>) {}\n\n hasSource(name: string): boolean { return this.sources.has(name); }\n hasPropertyType(name: string): boolean { return this.qualifiedTypes.has(name); }\n hasUniqueStream(source: string, stream: string): boolean {\n const parents = this.sources.get(source);\n return parents?.length === 1 && parents[0].filter(name => name === stream).length === 1;\n }\n\n static capture(documents: Iterable<readonly SourceLine[]>, placement: PlayPlacement = documentPlacement, languages?: ReadonlySet<string>): CommandStreamCandidates {\n return this.capturePlaced([...documents].map(lines => ({ lines, placement })), languages);\n }\n\n static capturePlaced(documents: Iterable<{ readonly lines: readonly SourceLine[]; readonly placement: PlayPlacement }>, languages?: ReadonlySet<string>): CommandStreamCandidates {\n const sources = new Map<string, string[][]>();\n const types = new Set<string>();\n const imports = new Set<string>();\n for (const { lines, placement } of documents) {\n const context = sourceContext(lines, lines[0]?.path, languages);\n context.scope = placement;\n const application = parseApplication(context, lines, placement);\n for (const type of application.types) types.add(type.name);\n for (const concept of application.concepts) types.add(concept.name);\n for (const imported of application.imports) imports.add(imported.qualifiedName);\n for (const source of application.eventSources ?? []) {\n sources.set(source.name, [...sources.get(source.name) ?? [], source.streams.map(stream => stream.name)]);\n }\n }\n const qualified = new Set([...imports].filter(name => types.has(name.substring(name.lastIndexOf('.') + 1))));\n return new CommandStreamCandidates(sources, qualified);\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n/** A value-free reason why a portable stream identity cannot be formatted. */\nexport enum StreamIdFormatFailure {\n Empty = 'Empty', NotNfc = 'NotNfc', LoneSurrogate = 'LoneSurrogate', OutOfRange = 'OutOfRange',\n NotIntegral = 'NotIntegral', MalformedUuid = 'MalformedUuid', Arity = 'Arity', Escape = 'Escape', Noncanonical = 'Noncanonical',\n}\n\nexport type StreamIdScalarKind = 'String' | 'Uuid' | 'Int';\nexport type StreamIdFormatResult = { readonly value: string; readonly failure: null } | { readonly value: null; readonly failure: StreamIdFormatFailure };\n\n/** Formats text without rewriting its identity. */\nexport function tryFormatText(value: string): StreamIdFormatResult {\n if (value.length === 0) return { value: null, failure: StreamIdFormatFailure.Empty };\n if (/[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]/u.test(value)) return { value: null, failure: StreamIdFormatFailure.LoneSurrogate };\n if (value.normalize('NFC') !== value) return { value: null, failure: StreamIdFormatFailure.NotNfc };\n return { value, failure: null };\n}\n\n/** Accepts only authored N, D, B and P UUID forms, returning lowercase D. */\nexport function tryFormatUuidText(value: string): StreamIdFormatResult {\n if (!/^(?:[0-9a-f]{32}|[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}|\\{[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\\}|\\([0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}\\))(?![\\s\\S])/i.test(value)) return { value: null, failure: StreamIdFormatFailure.MalformedUuid };\n const hex = value.replace(/[{}()-]/g, '').toLowerCase();\n return { value: `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`, failure: null };\n}\n\n/** Formats an integer losslessly; only Double numeric mode imposes the safe-integer bound. */\nexport function tryFormatInteger(value: bigint | number, doubleBound = typeof value === 'number'): StreamIdFormatResult {\n if (typeof value === 'number' && !Number.isInteger(value)) return { value: null, failure: StreamIdFormatFailure.NotIntegral };\n const integer = BigInt(value);\n if (doubleBound && (integer < -9007199254740991n || integer > 9007199254740991n)) return { value: null, failure: StreamIdFormatFailure.OutOfRange };\n return { value: integer.toString(), failure: null };\n}\n\n/** A diagnostic message that never contains the value. */\nexport function streamIdFailureMessage(failure: StreamIdFormatFailure): string {\n switch (failure) {\n case StreamIdFormatFailure.Empty: return 'A stream id text literal cannot be empty.';\n case StreamIdFormatFailure.NotNfc: return 'A stream id text literal must be Unicode NFC.';\n case StreamIdFormatFailure.LoneSurrogate: return 'A stream id text literal cannot contain lone UTF-16 surrogates.';\n case StreamIdFormatFailure.OutOfRange: return 'A stream id integer literal must be between -9007199254740991 and 9007199254740991 in Double numeric mode.';\n case StreamIdFormatFailure.NotIntegral: return 'A stream id integer must be a finite integral value.';\n case StreamIdFormatFailure.MalformedUuid: return 'A stream id UUID must use N, D, B or P form.';\n case StreamIdFormatFailure.Arity: return 'A composite stream id must match the declared part count of at least two.';\n case StreamIdFormatFailure.Escape: return 'A composite stream id permits only %25 and %7C escapes.';\n case StreamIdFormatFailure.Noncanonical: return 'A composite stream id part must use canonical scalar spelling.';\n }\n}\n\n/** Encodes already formatted parts in declaration order. */\nexport function encodeComposite(parts: readonly string[]): string {\n return parts.map(part => part.replaceAll('%', '%25').replaceAll('|', '%7C')).join('|');\n}\n\n/** Decodes once, then checks canonical scalar spelling. Never repairs an identity. */\nexport function tryDecodeComposite(value: string, kinds: readonly StreamIdScalarKind[], doubleBound = true): { readonly parts: readonly string[] | null; readonly failure: StreamIdFormatFailure | null } {\n const encoded = value.split('|');\n if (kinds.length < 2 || encoded.length !== kinds.length) return { parts: null, failure: StreamIdFormatFailure.Arity };\n const parts: string[] = [];\n for (let index = 0; index < encoded.length; index++) {\n const component = encoded[index];\n if (/%(?!25|7C)/u.test(component)) return { parts: null, failure: StreamIdFormatFailure.Escape };\n const decoded = component.replace(/%25|%7C/g, escape => escape === '%25' ? '%' : '|');\n let formatted: StreamIdFormatResult;\n if (kinds[index] === 'String') formatted = tryFormatText(decoded);\n else if (kinds[index] === 'Uuid') formatted = tryFormatUuidText(decoded);\n else if (/^-?[0-9]+$(?![\\s\\S])/u.test(decoded)) formatted = tryFormatInteger(BigInt(decoded), doubleBound);\n else return { parts: null, failure: StreamIdFormatFailure.Noncanonical };\n if (formatted.failure !== null) return { parts: null, failure: formatted.failure };\n if (formatted.value !== decoded) return { parts: null, failure: StreamIdFormatFailure.Noncanonical };\n parts.push(decoded);\n }\n return { parts, failure: null };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { TypeRefSyntax } from '../Syntax/Declarations';\nimport { EventStreamSyntax } from '../Syntax/EventSources';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { ParserContext } from './ParserContext';\n\nexport function validateStreamIdParts(stream: EventStreamSyntax, mappings: readonly PropertyMappingSyntax[], scalar: boolean, location: SourceLocation, code: string, context: ParserContext, validate: (mapping: PropertyMappingSyntax, target: TypeRefSyntax) => void): void {\n if (scalar) {\n context.error(code, 'A composite stream requires a streamId part block, not a scalar mapping.', location);\n return;\n }\n const parts = stream.streamIdParts;\n for (const part of parts.filter(part => !mappings.some(mapping => mapping.property === part.name)))\n context.error(code, `Stream id part '${part.name}' requires a mapping.`, location);\n const names = new Set<string>();\n for (const mapping of mappings) {\n const part = parts.find(part => part.name === mapping.property);\n if (part === undefined) context.error(code, `Unknown stream id part '${mapping.property}'.`, mapping.location);\n else if (names.has(mapping.property)) context.error(code, `Stream id part '${mapping.property}' is mapped more than once.`, mapping.location);\n else {\n names.add(mapping.property);\n validate(mapping, part.type);\n }\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { TypeRefSyntax } from '../Syntax/Declarations';\nimport { EventSourceCatalog } from '../Syntax/EventSourceCatalog';\nimport { EventSourceResolutionKind } from '../Syntax/EventSources';\nimport { formatStreamIdLiteral } from './EventSourceValidator';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { SpecificationStreamSyntax, SpecificationNoStreamSyntax } from '../Syntax/Specifications';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { compatibleValue, uniqueByName } from './ResponseValidator';\n\nexport function formatSpecificationStreamId(expression: ExpressionSyntax | null | undefined, type: TypeRefSyntax, application: ApplicationSyntax): string | null {\n const concepts = uniqueByName(application.concepts);\n const composites = uniqueByName(application.types);\n const properties = new Map([...composites].map(([name, type]) => [name, uniqueByName(type.properties)]));\n if (expression?.kind !== 'LiteralExpressionSyntax' || !compatibleValue(expression, type, concepts, properties)) return null;\n const primitive = concepts.get(type.name)?.type ?? type.name;\n return ['String', 'Uuid', 'Int'].includes(primitive) ? formatStreamIdLiteral(expression, type, application)?.value ?? null : null;\n}\n\nexport function matchesSpecificationRoute(given: SpecificationStreamSyntax | null | undefined, expected: SpecificationStreamSyntax | null | undefined, noStream: SpecificationNoStreamSyntax | null | undefined, application: ApplicationSyntax): boolean | null {\n if (noStream != null) return given == null;\n if (expected == null) return true;\n if (given == null) return false;\n const catalog = new EventSourceCatalog(application);\n const actual = catalog.resolve(given.eventSource, given.stream);\n const target = catalog.resolve(expected.eventSource, expected.stream);\n if (actual.kind !== EventSourceResolutionKind.Unique || target.kind !== EventSourceResolutionKind.Unique) return null;\n if (actual.sources[0] !== target.sources[0] || actual.streams[0] !== target.streams[0]) return false;\n const stream = target.streams[0];\n const compare = (left: ExpressionSyntax | null | undefined, right: ExpressionSyntax | null | undefined, type: TypeRefSyntax): boolean | null => {\n const first = formatSpecificationStreamId(left, type, application);\n const second = formatSpecificationStreamId(right, type, application);\n return first === null || second === null ? null : first === second;\n };\n if (stream.streamIdParts.length > 0) {\n if (given.streamId !== null || expected.streamId !== null || given.streamIdParts.length !== stream.streamIdParts.length || expected.streamIdParts.length !== stream.streamIdParts.length) return null;\n const comparisons = stream.streamIdParts.map(part => {\n const left = given.streamIdParts.filter(mapping => mapping.property === part.name);\n const right = expected.streamIdParts.filter(mapping => mapping.property === part.name);\n return left.length === 1 && right.length === 1 ? compare(left[0].source, right[0].source, part.type) : null;\n });\n return comparisons.includes(false) ? false : comparisons.includes(null) ? null : true;\n }\n if (given.streamIdParts.length > 0 || expected.streamIdParts.length > 0) return null;\n if (stream.streamId === null) return given.streamId === null && expected.streamId === null ? true : null;\n return compare(given.streamId?.source, expected.streamId?.source, stream.streamId);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { CommandSyntax } from '../Syntax/Commands';\nimport { EventSyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { EventSourceCatalog } from '../Syntax/EventSourceCatalog';\nimport { EventSourceResolutionKind } from '../Syntax/EventSources';\nimport { formatSpecificationStreamId } from './SpecificationRouteComparison';\nimport { streamIdFailureMessage } from '../Syntax/StreamIdFormatter';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { commandDestinationType } from './CommandDestinationTypes';\nimport { formatStreamIdLiteral } from './EventSourceValidator';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { validateStreamIdParts } from './CompositeStreamIdValidator';\nimport { ParserContext } from './ParserContext';\nimport { LineReader } from './LineReader';\nimport { compatibleValue, uniqueByName } from './ResponseValidator';\nimport { expandEffectiveSpecificationExamples, specificationExamples } from './SpecificationCommandExamples';\nimport { SpecificationEventSyntax } from '../Syntax/Specifications';\n\ninterface Producer { event: EventSyntax; command: CommandSyntax | null; type: TypeRefSyntax | null }\n\nexport function validateSpecificationStreams(application: ApplicationSyntax, context: ParserContext): void {\n const rows = new AuthoringProductionResolver(application).slices.flatMap(({ slice }) => slice.specifications.flatMap(specification => specification.cases ?? []));\n if (rows.length === 0) return validateRoutes(application, context);\n const sink = new ParserContext(new LineReader([]));\n validateRoutes(application, sink);\n const reported = new Set<string>();\n const distinct = new Set<string>();\n for (const diagnostic of sink.diagnostics) {\n const key = JSON.stringify([diagnostic.code, diagnostic.location.path, diagnostic.location.line, diagnostic.location.column, diagnostic.message]);\n if (distinct.has(key)) continue;\n distinct.add(key);\n const row = diagnostic.code === DiagnosticCodes.InvalidSpecificationStreamRoute ? rows.find(row => row.values.some(value => value.source.location.line === diagnostic.location.line && value.source.location.column === diagnostic.location.column && value.source.location.path === diagnostic.location.path)) : undefined;\n if (row === undefined) context.error(diagnostic.code, diagnostic.message, diagnostic.location);\n else {\n const key = JSON.stringify(diagnostic.location);\n if (!reported.has(key)) context.error(diagnostic.code, `Case '${row.name}': ${diagnostic.message}`, diagnostic.location);\n reported.add(key);\n }\n }\n}\n\nfunction validateRoutes(application: ApplicationSyntax, context: ParserContext): void {\n const examples = specificationExamples(application).resolvedExamples;\n const expansion = expandEffectiveSpecificationExamples(application);\n application = expansion.application;\n const resolver = new AuthoringProductionResolver(application);\n const declarationSteps = new Set<SpecificationEventSyntax>();\n const exampleSpecifications = examples.flatMap(entry => {\n if (entry.kind !== 'event') {\n if ((entry.kind === 'command' || entry.kind === 'readmodel') && (entry.example.stream != null || entry.example.noStream != null))\n context.error(DiagnosticCodes.InvalidSpecificationExampleBody, \"only event examples carry routes; a command's route comes from its declaration, and read models have none\", (entry.example.stream ?? entry.example.noStream)!.location);\n return [];\n }\n const node: SpecificationEventSyntax = { kind: 'SpecificationEventSyntax', eventType: entry.name, values: entry.example.values, for: entry.example.for, stream: entry.example.stream, noStream: entry.example.noStream, location: entry.example.location };\n declarationSteps.add(node);\n return [{ scope: entry.scope, specification: { when: null, given: [], whenAppended: null, thenEvents: [node], whenRedelivered: null } }];\n });\n const catalog = new EventSourceCatalog(application);\n const concepts = uniqueByName(application.concepts);\n const composites = uniqueByName(application.types);\n const properties = new Map([...composites].map(([name, type]) => [name, uniqueByName(type.properties)]));\n const compatible = (value: Parameters<typeof compatibleValue>[0], type: TypeRefSyntax): boolean => compatibleValue(value, type, concepts, properties);\n const known = new Set(['String', 'Uuid', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime', ...concepts.keys(), ...composites.keys()]);\n const nominallyCompatible = (source: TypeRefSyntax, target: TypeRefSyntax): boolean | null => known.has(source.name) && known.has(target.name)\n ? source.name === target.name && source.isCollection === target.isCollection && (!source.isOptional || target.isOptional) : null;\n const formatStreamId = (expression: ExpressionSyntax | null | undefined, type: TypeRefSyntax): string | null => formatSpecificationStreamId(expression, type, application);\n const eventOf = (reference: string, slice: typeof resolver.slices[number]['slice']): EventSyntax | null => {\n const declared = resolver.resolve(reference, slice).declaration;\n return declared?.node.kind === 'EventSyntax' ? declared.node : null;\n };\n const producers: Producer[] = [];\n for (const { slice } of resolver.slices) {\n for (const command of slice.commands) for (const produced of command.produces) {\n if (!resolver.isEventProduction(produced, slice)) continue;\n const event = eventOf(produced.event, slice);\n if (event === null) continue;\n const type = commandDestinationType(command, produced, application, { resolver, slice });\n producers.push({ event, command, type });\n }\n for (const produced of slice.reactions.flatMap(reaction => reaction.triggers).flatMap(trigger => trigger.produces)) {\n const event = eventOf(produced.event, slice);\n if (event !== null) producers.push({ event, command: null, type: null });\n }\n for (const capture of slice.captures) for (const appended of [...capture.appends, ...capture.children.flatMap(child => child.appends), ...capture.nested.flatMap(nested => nested.appends)]) {\n const event = eventOf(appended.event, slice);\n if (event !== null) producers.push({ event, command: null, type: null });\n }\n }\n const validationSpecifications = [\n ...exampleSpecifications.flatMap(entry => resolver.slices.filter(owner => owner.scope.join('.') === entry.scope.join('.')).map(({ slice, scope }) => ({ slice, scope, specification: entry.specification }))),\n ...resolver.slices.flatMap(({ slice, scope }) => slice.specifications.map(specification => ({ slice, scope, specification })))\n ];\n for (const { slice, scope, specification } of validationSpecifications) {\n const commands = resolver.slices.flatMap(entry => entry.slice.commands.map(command => ({ command, scope: entry.scope })));\n const parts = specification.when?.commandType.split('.') ?? [];\n const qualifiers = parts.slice(0, -1);\n const candidates = commands.filter(entry => entry.command.name === parts.at(-1) && qualifiers.every((segment, index) => entry.scope[entry.scope.length - qualifiers.length + index] === segment));\n let command: CommandSyntax | null = qualifiers.length > 0 && candidates.length === 1 ? candidates[0].command : null;\n for (let depth = scope.length; qualifiers.length === 0 && depth >= 0 && command === null; depth--) {\n const visible = candidates.filter(entry => scope.slice(0, depth).every((segment, index) => entry.scope[index] === segment));\n if (visible.length > 0) { command = visible.length === 1 ? visible[0].command : null; break; }\n }\n const occurrences = [...specification.given.map(node => ({ node, required: true, expected: false })),\n ...(specification.whenAppended === null ? [] : [{ node: specification.whenAppended, required: true, expected: false }]),\n ...specification.thenEvents.map(node => ({ node, required: false, expected: !declarationSteps.has(node) })),\n ...(specification.whenRedelivered == null ? [] : [{ node: { ...specification.whenRedelivered, kind: 'SpecificationEventSyntax' as const }, required: false, expected: false }])];\n for (const { node, required, expected } of occurrences) {\n const step = expansion.specifications.flatMap(pair => pair.steps).find(step => step.effective === node);\n const validateRoute = step?.route?.origin !== 'example';\n const validateFor = validateRoute || node.for !== step?.example?.for;\n const contextualError = (code: string, message: string, location: typeof node.location): void => {\n context.error(code, step?.example == null ? message : `${message} Example '${step.example.name}' is used here.`, step?.example == null ? location : step.authored.location);\n };\n if (node.stream == null && node.noStream == null) continue;\n if (required && node.noStream != null)\n contextualError(DiagnosticCodes.InvalidSpecificationStream, \"Expected 'stream Source.Stream', or 'no stream' on a then event.\", node.noStream.location);\n let identifier: TypeRefSyntax | null = null;\n const event = eventOf(node.eventType, slice);\n const eventProducers = producers.filter(producer => producer.event === event);\n if (node.stream != null) {\n const route = node.stream;\n const resolution = catalog.resolve(route.eventSource, route.stream);\n if (resolution.kind !== EventSourceResolutionKind.Unique) {\n const state = { ambiguous: 'Ambiguous', notFound: 'NotFound', wrongKind: 'WrongKind' }[resolution.kind];\n if (validateRoute) context.error(DiagnosticCodes.InvalidSpecificationStreamRoute, `Stream '${route.eventSource}.${route.stream}' is ${state}; routing requires one physical source and stream.`, route.location);\n continue;\n }\n const source = resolution.sources[0];\n const stream = resolution.streams[0];\n const validateLiteral = (mapping: PropertyMappingSyntax, target: TypeRefSyntax | null): void => {\n const value = mapping.source;\n const formatted = formatStreamIdLiteral(value, target, application);\n if (formatted?.failure != null) context.error(DiagnosticCodes.InvalidSpecificationStreamRoute, streamIdFailureMessage(formatted.failure), value.location);\n else if (value.kind !== 'LiteralExpressionSyntax' || value.value === null || target !== null && !compatible(value, target))\n context.error(DiagnosticCodes.InvalidSpecificationStreamRoute, \"A specification stream id needs a nonempty concrete scalar literal compatible with the stream's declared type.\", value.location);\n };\n if (!validateRoute) { /* The authored example's route is checked once at its declaration. */ }\n else if (stream.streamIdParts.length > 0)\n validateStreamIdParts(stream, route.streamIdParts, route.streamId !== null, route.location, DiagnosticCodes.InvalidSpecificationStreamRoute, context, validateLiteral);\n else if (route.streamIdParts.length > 0)\n context.error(DiagnosticCodes.InvalidSpecificationStreamRoute, 'A streamId part block requires a composite stream.', route.location);\n else {\n if ((stream.streamId === null) !== (route.streamId === null))\n context.error(DiagnosticCodes.InvalidSpecificationStreamRoute, stream.streamId === null ? 'An unkeyed stream cannot take a streamId mapping.' : 'This keyed stream requires a streamId mapping.', route.location);\n if (route.streamId !== null) validateLiteral(route.streamId, stream.streamId);\n }\n identifier = source.identifier;\n if (identifier === null) {\n const types = eventProducers.map(producer => producer.type);\n const distinct = new Set(types.filter(type => type !== null).map(type => `${type.name}:${type.isOptional}:${type.isCollection}`));\n if (types.length === 0 || types.some(type => type === null) || distinct.size !== 1) {\n if (validateRoute) context.error(DiagnosticCodes.InvalidSpecificationStreamEventSource, `Declare an identifier on source '${source.name}'; the event's producers do not supply one unambiguous destination type.`, route.location);\n } else identifier = types[0];\n }\n let inheritedIdentityIsInvalid = false;\n if (step?.example?.stream != null && node.for !== null && node.for === step.example.for) {\n const prior = catalog.resolve(step.example.stream.eventSource, step.example.stream.stream);\n if (prior.kind === EventSourceResolutionKind.Unique) {\n const types = eventProducers.map(producer => producer.type);\n const distinct = new Set(types.filter(type => type !== null).map(type => `${type.name}:${type.isOptional}:${type.isCollection}`));\n const priorIdentifier = prior.sources[0].identifier ?? (types.length > 0 && !types.some(type => type === null) && distinct.size === 1 ? types[0] : null);\n if (priorIdentifier !== null)\n inheritedIdentityIsInvalid = node.for.kind !== 'LiteralExpressionSyntax' || node.for.value === null || priorIdentifier.isCollection || priorIdentifier.isOptional || !compatible(node.for, priorIdentifier);\n }\n }\n if (required && node.for === null)\n contextualError(DiagnosticCodes.InvalidSpecificationStreamEventSource, \"A routed given or when append event requires 'for <literal>'.\", route.location);\n else if (validateFor && !inheritedIdentityIsInvalid && node.for !== null && (node.for.kind !== 'LiteralExpressionSyntax' || node.for.value === null || identifier !== null && (identifier.isCollection || identifier.isOptional || !compatible(node.for, identifier))))\n contextualError(DiagnosticCodes.InvalidSpecificationStreamEventSource, \"A routed event's for value must be a concrete literal compatible with the source's identifier type.\", node.for.location);\n }\n if (!expected || command === null || eventProducers.length === 0 || eventProducers.some(producer => producer.command !== command)) continue;\n const commandRoute = command.stream?.propertyCandidate === null ? command.stream : null;\n let contradicts = node.noStream != null ? commandRoute != null : commandRoute == null || commandRoute.eventSource !== node.stream!.eventSource || commandRoute.stream !== node.stream!.stream;\n if (!contradicts && node.stream != null && commandRoute != null) {\n const resolution = catalog.resolve(node.stream.eventSource, node.stream.stream);\n const stream = resolution.kind === EventSourceResolutionKind.Unique ? resolution.streams[0] : null;\n if (stream !== null && stream.streamIdParts.length > 0) {\n if (commandRoute.streamId === null && node.stream.streamId === null && commandRoute.streamIdParts.length > 0 && node.stream.streamIdParts.length > 0) {\n for (const part of stream.streamIdParts) {\n const actual = commandRoute.streamIdParts.filter(mapping => mapping.property === part.name);\n const expected = node.stream.streamIdParts.filter(mapping => mapping.property === part.name);\n if (actual.length !== 1 || expected.length !== 1) continue;\n const actualId = formatStreamId(actual[0].source, part.type);\n const expectedId = formatStreamId(expected[0].source, part.type);\n if (actualId !== null && expectedId !== null && actualId !== expectedId) contradicts = true;\n }\n }\n } else if (stream?.streamId != null && commandRoute.streamIdParts.length === 0 && node.stream.streamIdParts.length === 0) {\n const actualId = formatStreamId(commandRoute.streamId?.source, stream.streamId);\n const expectedId = formatStreamId(node.stream.streamId?.source, stream.streamId);\n if (actualId !== null && expectedId !== null && actualId !== expectedId) contradicts = true;\n }\n }\n if (node.for?.kind === 'LiteralExpressionSyntax' && eventProducers.every(producer => producer.type !== null &&\n (identifier !== null ? nominallyCompatible(producer.type, identifier) === false : !compatible(node.for!, producer.type)))) contradicts = true;\n if (contradicts) contextualError(DiagnosticCodes.SpecificationStreamContradictsCommand, 'The expected event route contradicts its only producer, the command under test.', (node.stream ?? node.noStream)!.location);\n }\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { PropertySyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { EventSourceCatalog } from '../Syntax/EventSourceCatalog';\nimport { EventSourceResolutionKind } from '../Syntax/EventSources';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { ExpressionSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { StreamIdFormatResult, streamIdFailureMessage, tryFormatInteger, tryFormatText, tryFormatUuidText } from '../Syntax/StreamIdFormatter';\nimport { commandDestinationType } from './CommandDestinationTypes';\nimport { validateStreamIdParts } from './CompositeStreamIdValidator';\nimport { ParserContext } from './ParserContext';\nimport { compatibleValue, uniqueByName } from './ResponseValidator';\nimport { validateSpecificationStreams } from './SpecificationStreamValidator';\n\nconst primitives = new Set(['String', 'Uuid', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime']);\n\nexport function supportsStreamIdentity(type: TypeRefSyntax, application: ApplicationSyntax): boolean {\n const concepts = application.concepts.filter(concept => concept.name === type.name);\n const primitive = concepts.length === 1 ? concepts[0].type : concepts.length === 0 && primitives.has(type.name) ? type.name : null;\n return primitive === 'String' || primitive === 'Uuid' || primitive === 'Int' && concepts.length === 1 && concepts[0].values.length === 0;\n}\n\nexport function formatStreamIdLiteral(expression: ExpressionSyntax | null | undefined, type: TypeRefSyntax | null, application: ApplicationSyntax): StreamIdFormatResult | null {\n if (expression?.kind !== 'LiteralExpressionSyntax') return null;\n const value = expression.value;\n const primitive = type === null ? null : uniqueByName(application.concepts).get(type.name)?.type ?? type.name;\n if (typeof value === 'string') return primitive === 'Uuid' ? tryFormatUuidText(value) : tryFormatText(value);\n if (typeof value === 'number') return tryFormatInteger(value);\n if (typeof value === 'object' && value !== null && value.literalType === 'ExactNumber') {\n if (value.value.includes('.')) return tryFormatInteger(NaN);\n return tryFormatInteger(BigInt(value.value), false);\n }\n return null;\n}\n\nexport function validateEventSources(application: ApplicationSyntax, context: ParserContext): void {\n const concepts = uniqueByName(application.concepts);\n const composites = uniqueByName(application.types);\n const known = new Set([...primitives, ...concepts.keys(), ...composites.keys()]);\n const compositeProperties = new Map([...composites].map(([name, type]) => [name, uniqueByName(type.properties)]));\n const compatible = (source: TypeRefSyntax, target: TypeRefSyntax): boolean | null => known.has(source.name) && known.has(target.name)\n ? source.name === target.name && source.isCollection === target.isCollection && (!source.isOptional || target.isOptional) : null;\n const validateType = (type: TypeRefSyntax | null, streamId: boolean): void => {\n if (type === null) return;\n if (type.isOptional || type.isCollection || application.types.some(composite => composite.name === type.name)) {\n context.error(DiagnosticCodes.InvalidEventSourceDeclaration, 'Identifier and streamId declarations require a nonoptional scalar value type.', type.location);\n return;\n }\n const named = application.concepts.filter(concept => concept.name === type.name);\n const primitive = named.length === 1 ? named[0].type : named.length === 0 && primitives.has(type.name) ? type.name : null;\n if (streamId && primitive !== null && !supportsStreamIdentity(type, application))\n context.error(DiagnosticCodes.UnsupportedStreamIdType, 'Stream ids support text and UUID values and their nominal concepts, plus integer-backed concepts; other types need a future portable formatter.', type.location);\n if (primitive === null && !application.imports.some(imported => imported.qualifiedName === type.name || imported.qualifiedName.split('.').at(-1) === type.name))\n context.warning(DiagnosticCodes.UnknownType, `Unknown type '${type.name}' in event source declaration.`, type.location);\n };\n const names = new Set<string>();\n for (const source of application.eventSources ?? []) {\n if (names.has(source.name)) context.error(DiagnosticCodes.InvalidEventSourceDeclaration, `Event source '${source.name}' has multiple physical declarations.`, source.location);\n names.add(source.name);\n validateType(source.identifier, false);\n const streams = new Set<string>();\n for (const stream of source.streams) {\n if (streams.has(stream.name)) context.error(DiagnosticCodes.InvalidEventSourceDeclaration, `Stream '${source.name}.${stream.name}' has multiple declarations under this source.`, stream.location);\n streams.add(stream.name);\n validateType(stream.streamId, true);\n const parts = stream.streamIdParts;\n if (parts.length > 0) {\n if (parts.length < 2) context.error(DiagnosticCodes.InvalidEventSourceDeclaration, 'A composite stream id requires at least two named parts.', stream.directiveLocations?.streamId ?? stream.location);\n for (const name of new Set(parts.map(part => part.name))) {\n for (const duplicate of parts.filter(part => part.name === name).slice(1))\n context.error(DiagnosticCodes.InvalidEventSourceDeclaration, `Stream id part '${duplicate.name}' is declared more than once.`, duplicate.location);\n }\n for (const part of parts) validateType(part.type, true);\n }\n }\n }\n const pathProperty = (properties: readonly PropertySyntax[] | null, path: string): { property: PropertySyntax | null; missing: boolean } => {\n const [name, ...remaining] = path.split('.');\n if (properties === null) return { property: null, missing: false };\n const matches = properties.filter(property => property.name === name);\n if (matches.length !== 1) return { property: null, missing: matches.length === 0 };\n const property = matches[0];\n if (remaining.length === 0) return { property, missing: false };\n if (primitives.has(property.type.name) || concepts.has(property.type.name) && !composites.has(property.type.name)) return { property: null, missing: true };\n const resolved = pathProperty(composites.get(property.type.name)?.properties ?? null, remaining.join('.'));\n return resolved.property === null ? resolved : { property: { ...resolved.property, type: { ...resolved.property.type, isCollection: property.type.isCollection || resolved.property.type.isCollection, isOptional: property.type.isOptional || resolved.property.type.isOptional } }, missing: false };\n };\n const catalog = new EventSourceCatalog(application);\n const resolver = new AuthoringProductionResolver(application);\n for (const { slice } of resolver.slices) for (const command of slice.commands) {\n const route = command.stream;\n if (route == null || route.propertyCandidate !== null) continue;\n const resolution = catalog.resolve(route.eventSource, route.stream);\n if (resolution.kind !== EventSourceResolutionKind.Unique) {\n const state = { ambiguous: 'Ambiguous', notFound: 'NotFound', wrongKind: 'WrongKind' }[resolution.kind];\n context.error(DiagnosticCodes.InvalidCommandStream, `Stream '${route.eventSource}.${route.stream}' is ${state}; routing requires one physical source and stream.`, route.location);\n continue;\n }\n const source = resolution.sources[0];\n const stream = resolution.streams[0];\n const identifiers = command.properties.filter(property => property.isIdentifier);\n if (source.identifier !== null && identifiers.length === 1 && compatible(identifiers[0].type, source.identifier) === false)\n context.error(DiagnosticCodes.InvalidCommandStream, `Command identifier '${identifiers[0].name}' does not have the source's nominal identifier type '${source.identifier.name}'. The stream does not supply a destination.`, identifiers[0].location);\n for (const produced of command.produces.filter(produced => resolver.isEventProduction(produced, slice))) {\n if (source.identifier === null) continue;\n const destination = commandDestinationType(command, produced, application, { resolver, slice });\n if (destination === null) continue;\n if (produced.for === null && produced.inlineEvent !== null && identifiers.length === 1 && compatible(identifiers[0].type, source.identifier) === false) continue;\n const allocated = produced.for === null && produced.inlineEvent === null && !command.properties.some(property => property.isGenerated && property.isIdentifier);\n const primitive = concepts.get(source.identifier.name)?.type ?? (primitives.has(source.identifier.name) ? source.identifier.name : null);\n const matches = allocated ? primitive === null ? null : primitive === 'Uuid' : compatible(destination, source.identifier);\n if (matches === false) context.error(DiagnosticCodes.InvalidCommandStream, `Command production destination does not have the source's nominal identifier type '${source.identifier.name}'. The stream does not supply a destination.`, produced.for?.location ?? produced.location);\n }\n const validateMapping = (mapping: PropertyMappingSyntax, target: TypeRefSyntax): void => {\n const expression = mapping.source;\n if (expression.kind === 'PathExpressionSyntax') {\n const resolved = pathProperty(command.properties, expression.path);\n if (resolved.missing || resolved.property !== null && compatible(resolved.property.type, target) === false)\n context.error(DiagnosticCodes.InvalidCommandStream, `Stream id source '${expression.path}' is absent or incompatible with nominal type '${target.name}'.`, expression.location);\n } else if (expression.kind === 'LiteralExpressionSyntax' && expression.value !== null) {\n const formatted = formatStreamIdLiteral(expression, target, application);\n if (formatted?.failure != null) context.error(DiagnosticCodes.InvalidCommandStream, streamIdFailureMessage(formatted.failure), expression.location);\n else if (!compatibleValue(expression, target, concepts, compositeProperties)) context.error(DiagnosticCodes.InvalidCommandStream, `Stream id value is incompatible with nominal type '${target.name}'.`, expression.location);\n } else if (['RawExpressionSyntax', 'ObjectExpressionSyntax', 'ListExpressionSyntax'].includes(expression.kind) || expression.kind === 'LiteralExpressionSyntax' && expression.value === null)\n context.error(DiagnosticCodes.InvalidCommandStream, 'A stream id needs a scalar value source, not a raw expression, collection or absence.', expression.location);\n };\n if (stream.streamIdParts.length > 0) {\n validateStreamIdParts(stream, route.streamIdParts, route.streamId !== null, route.location, DiagnosticCodes.InvalidCommandStream, context, validateMapping);\n continue;\n }\n if (route.streamIdParts.length > 0) {\n context.error(DiagnosticCodes.InvalidCommandStream, 'A streamId part block requires a composite stream.', route.location);\n continue;\n }\n if (stream.streamId === null && route.streamId !== null || stream.streamId !== null && route.streamId === null)\n context.error(DiagnosticCodes.InvalidCommandStream, stream.streamId === null ? 'An unkeyed stream cannot take a streamId mapping.' : 'This keyed stream requires a streamId mapping.', route.location);\n if (stream.streamId === null || route.streamId === null) continue;\n validateMapping(route.streamId, stream.streamId);\n }\n validateSpecificationStreams(application, context);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { AuthoringProductionKind, AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { ProjectionBlockSyntax } from '../Syntax/Projections';\nimport { ApplicationSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\nimport { uniqueByName } from './ResponseValidator';\n\nexport function validateProjectionTargets(application: ApplicationSyntax, context: ParserContext): void {\n const resolver = new AuthoringProductionResolver(application);\n const slices = resolver.slices;\n const imported = new Set(application.imports.map(entry => entry.qualifiedName));\n const events = new Set([...slices.flatMap(({ slice }) => eventDeclarations(slice).map(event => event.name)), ...application.imports.map(entry => entry.qualifiedName.split('.').at(-1)!)]);\n const types = uniqueByName(application.types);\n const scalar = new Set(['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime', ...application.concepts.map(concept => concept.name)].filter(name => !types.has(name)));\n const property = (properties: readonly PropertySyntax[] | null, path: string): { value: PropertySyntax | null; missing: boolean } => {\n const [name, ...rest] = path.split('.');\n if (properties === null) return { value: null, missing: false };\n const matches = properties.filter(entry => entry.name === name);\n if (matches.length !== 1) return { value: null, missing: matches.length === 0 };\n const value = matches[0];\n if (rest.length === 0) return { value, missing: false };\n if (scalar.has(value.type.name)) return { value: null, missing: true };\n return property(types.get(value.type.name)?.properties ?? null, rest.join('.'));\n };\n const views = slices.flatMap(({ slice, scope }) => slice.readModels.map(node => ({ node, scope })));\n const viewProperties = (reference: string, scope: readonly string[]): readonly PropertySyntax[] | null => {\n const candidates = (name: string) => {\n const segments = name.split('.');\n const named = views.filter(entry => entry.node.name === segments.at(-1));\n const qualifiers = segments.slice(0, -1);\n if (qualifiers.length > 0) return named.filter(entry => qualifiers.length <= entry.scope.length && qualifiers.every((value, index) => entry.scope[entry.scope.length - qualifiers.length + index] === value));\n for (let depth = scope.length; depth >= 0; depth--) {\n const visible = named.filter(entry => depth <= entry.scope.length && scope.slice(0, depth).every((value, index) => entry.scope[index] === value));\n if (visible.length > 0) return visible;\n }\n return [];\n };\n let matches = candidates(reference);\n const imports = application.imports.filter(entry => entry.qualifiedName.split('.').at(-1) === reference);\n if (matches.length === 0 && imports.length === 1) matches = candidates(imports[0].qualifiedName);\n return matches.length === 1 ? matches[0].node.properties : null;\n };\n const unknownEvent = (name: string, location: SourceLocation, slice: SliceSyntax): void => {\n const resolution = resolver.resolve(name, slice);\n const declared = events.has(name) || imported.has(name) || resolution.declaration?.kind === AuthoringProductionKind.Event || resolution.candidates.some(candidate => candidate.kind === AuthoringProductionKind.Event);\n if (!declared) context.warning(DiagnosticCodes.UnknownEvent, `Unknown event '${name}' - declare it with 'event ${name}'`, location);\n };\n const removals = (blocks: readonly ProjectionBlockSyntax[], slice: SliceSyntax): void => {\n for (const block of blocks) {\n if (block.kind === 'RemoveWithSyntax' || block.kind === 'RemoveViaJoinSyntax') unknownEvent(block.event, block.location, slice);\n if ('blocks' in block) removals(block.blocks, slice);\n }\n };\n const reported = new Set<string>();\n const walk = (blocks: readonly ProjectionBlockSyntax[], properties: readonly PropertySyntax[] | null, element = false, effectiveHandlers = false): void => {\n const validate = (path: string, location: SourceLocation) => {\n const resolved = property(properties, path);\n const key = JSON.stringify([location.path, location.line, location.column]);\n if (resolved.missing && !reported.has(key)) {\n reported.add(key);\n context.warning(DiagnosticCodes.UnknownReadModelProperty, `Projection target '${path}' is not a declared ${element ? 'element' : 'read-model'} property`, location);\n }\n return resolved.value;\n };\n // An 'every' without local handlers only cascades into the element scopes.\n const ownsEvents = effectiveHandlers || blocks.some(block => block.kind === 'FromSyntax' || block.kind === 'JoinSyntax' || block.kind === 'AllSyntax');\n for (const block of blocks) {\n const mappings = block.kind === 'EverySyntax' && !ownsEvents ? [] : 'mappings' in block ? block.mappings : block.kind === 'JoinSyntax' ? block.events.flatMap(event => event.mappings) : [];\n for (const mapping of mappings) validate(mapping.property, mapping.location);\n if (block.kind === 'ChildrenSyntax' || block.kind === 'NestedSyntax') {\n const target = validate(block.property, block.location);\n walk(block.blocks, target === null ? null : types.get(target.type.name)?.properties ?? null, true);\n }\n }\n };\n for (const { slice } of slices) {\n for (const projection of slice.projections) removals(projection.blocks, slice);\n for (const capture of slice.captures) {\n for (const append of [...capture.appends, ...capture.children.flatMap(child => child.appends), ...capture.nested.flatMap(child => child.appends)]) unknownEvent(append.event, append.location, slice);\n }\n }\n for (const { slice, scope } of slices) {\n for (const projection of slice.projections) {\n const variants = projection.blocks.filter(block => block.kind === 'ProjectionVariantSyntax');\n if (variants.length === 0) walk(projection.blocks, viewProperties(projection.readModel ?? projection.name, scope));\n for (const variant of variants) {\n const properties = viewProperties(variant.name, scope);\n walk(projection.blocks.filter(block => block.kind === 'ChildrenSyntax' || block.kind === 'NestedSyntax'), properties);\n // Lowering combines shared handlers and turns entering events into From handlers.\n const ownsEvents = variant.entersOn.length > 0 || projection.blocks.some(block => block.kind === 'FromSyntax' || block.kind === 'JoinSyntax' || block.kind === 'AllSyntax');\n walk(variant.blocks, properties, false, ownsEvents);\n }\n }\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { PropertySyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { EventSourceCatalog } from '../Syntax/EventSourceCatalog';\nimport { EventSourceResolutionKind } from '../Syntax/EventSources';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { dependencySourcesOf } from '../Syntax/DependencySources';\nimport { ParserContext } from './ParserContext';\nimport { uniqueByName } from './ResponseValidator';\n\nexport function validateIdentifierCompliance(application: ApplicationSyntax, context: ParserContext): void {\n const personal = new Set(application.concepts.filter(concept => concept.attributes.some(attribute => attribute.name === 'pii')).map(concept => concept.name));\n const sensitive = new Set(application.concepts.filter(concept => concept.attributes.some(attribute => attribute.name === 'sensitive')).map(concept => concept.name));\n const types = uniqueByName(application.types);\n const resolver = new AuthoringProductionResolver(application);\n const imports = new Set(application.imports.map(imported => imported.qualifiedName.split('.').at(-1)!));\n const declaredTriggers = new Map<string, (readonly PropertySyntax[])[]>();\n for (const declared of application.declaredTriggers ?? []) {\n const shapes = declaredTriggers.get(declared.name) ?? [];\n shapes.push(declared.data);\n declaredTriggers.set(declared.name, shapes);\n }\n const validate = (type: TypeRefSyntax, location: SourceLocation, position = 'an event source identifier'): void => {\n if (personal.has(type.name) || sensitive.has(type.name)) {\n const attribute = personal.has(type.name) ? 'pii' : 'secret';\n context.error(DiagnosticCodes.PiiNotSupportedOnIdentifier, `Concept '${type.name}' is ${attribute} and cannot be ${position} - use a surrogate Uuid identifier and keep the ${attribute} value as a property`, location);\n }\n };\n const property = (properties: readonly PropertySyntax[], path: string): PropertySyntax | null => {\n const [name, ...rest] = path.split('.');\n const matches = properties.filter(entry => entry.name === name);\n if (matches.length !== 1) return null;\n const value = matches[0];\n if (rest.length === 0) return value;\n return property(types.get(value.type.name)?.properties ?? [], rest.join('.'));\n };\n for (const source of application.eventSources ?? []) {\n if (source.identifier != null) validate(source.identifier, source.identifier.location);\n for (const stream of source.streams) {\n if (stream.streamId !== null) validate(stream.streamId, stream.streamId.location, 'a stream id');\n for (const part of stream.streamIdParts) validate(part.type, part.type.location, `a stream id part '${part.name}'`);\n }\n }\n const catalog = new EventSourceCatalog(application);\n for (const { slice } of resolver.slices) {\n for (const command of slice.commands) {\n for (const entry of command.properties.filter(entry => entry.isIdentifier)) validate(entry.type, entry.location);\n for (const route of [...(command.stream ? [command.stream] : []), ...command.streamCandidates ?? []].filter(route => route.propertyCandidate === null)) {\n const resolution = catalog.resolve(route.eventSource, route.stream);\n const stream = resolution.kind === EventSourceResolutionKind.Unique ? resolution.streams[0] : undefined;\n const mappings = [\n ...(route.streamId === null ? [] : [{ mapping: route.streamId, target: stream?.streamId }]),\n ...route.streamIdParts.map(mapping => ({ mapping, target: stream?.streamIdParts.find(part => part.name === mapping.property)?.type })),\n ];\n for (const { mapping, target } of mappings) {\n if (mapping.source.kind !== 'PathExpressionSyntax') continue;\n const entry = property(command.properties, mapping.source.path);\n if (entry === null) continue;\n // The same protected concept has already been reported at its resolved declaration.\n if (entry.type.name === target?.name && (personal.has(entry.type.name) || sensitive.has(entry.type.name))) continue;\n validate(entry.type, mapping.source.location, 'a stream id route mapping');\n }\n }\n for (const production of command.produces.filter(production => resolver.isEventProduction(production, slice))) {\n if (production.for?.kind !== 'PathExpressionSyntax') continue;\n const entry = property(command.properties, production.for.path);\n if (entry !== null && !entry.isIdentifier) validate(entry.type, production.for.location);\n }\n }\n for (const trigger of slice.reactions.flatMap(reaction => reaction.triggers)) {\n if (trigger.source.kind !== 'NamedTriggerSourceSyntax') continue;\n const resolution = resolver.resolve(trigger.source.name, slice);\n const event = resolution.declaration?.node;\n const clauseData = (dependencySourcesOf(trigger).data ?? []).flatMap<PropertySyntax>(datum => datum.type === null ? [] : [{ kind: 'PropertySyntax', name: datum.name, type: datum.type, isIdentifier: false, location: datum.location }]);\n const shapes = [event?.kind === 'EventSyntax' ? event.properties : [], clauseData];\n if (event?.kind !== 'EventSyntax' && !imports.has(trigger.source.name)) {\n shapes.push(...declaredTriggers.get(trigger.source.name) ?? []);\n }\n for (const production of trigger.produces.filter(production => resolver.isEventProduction(production, slice))) {\n if (production.for?.kind !== 'PathExpressionSyntax') continue;\n // Check clause-local types alongside the occurrence selected by event-first reaction resolution.\n const path = production.for.path;\n const entry = shapes.map(properties => property(properties, path)).find(entry => entry !== null && (personal.has(entry.type.name) || sensitive.has(entry.type.name)));\n if (entry != null) validate(entry.type, production.for.location);\n }\n }\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { AuthoringProductionResolver } from '../Syntax/AuthoringProductionResolver';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { supportsStreamIdentity } from './EventSourceValidator';\nimport { ParserContext } from './ParserContext';\n\nexport function validateEventSubjects(application: ApplicationSyntax, context: ParserContext): void {\n const refuse = (properties: readonly PropertySyntax[], owner: string): void => {\n for (const property of properties.filter(property => property.isSubject))\n context.error(DiagnosticCodes.InvalidSubjectOwner, `The subject modifier is only valid on event properties, not ${owner} properties (decision 0008: one data subject per event).`, property.location);\n };\n for (const type of application.types) refuse(type.properties, 'type');\n for (const { slice } of new AuthoringProductionResolver(application).slices) {\n for (const command of slice.commands) refuse(command.properties, 'command');\n for (const model of slice.readModels) for (const property of model.properties.filter(property => property.isSubject))\n context.error(DiagnosticCodes.ReadModelSubjectNotSupported, 'Read model subject marks are not yet supported. Chronicle resolves read model subjects and reserves _subject, __subject and __subjects; Screenplay support is tracked in #559.', property.location);\n for (const event of eventDeclarations(slice)) {\n const subjects = event.properties.filter(property => property.isSubject);\n for (const extra of subjects.slice(1))\n context.error(DiagnosticCodes.DuplicateEventSubject, `Event '${event.name}' has one data subject (decision 0008); '${extra.name}' is an extra mark after '${subjects[0].name}'. Choose one subject; no automatic repair is safe.`, extra.location);\n for (const property of subjects) {\n const type = property.type;\n if (type.isOptional) {\n context.error(DiagnosticCodes.InvalidSubjectType, 'A subject must be required: a null value silently falls back to the event source.', property.location);\n continue;\n }\n if (type.isCollection || application.types.some(composite => composite.name === type.name)) {\n context.error(DiagnosticCodes.InvalidSubjectType, 'A subject must be a scalar identity, not a collection or composite type.', property.location);\n continue;\n }\n const concepts = application.concepts.filter(concept => concept.name === type.name);\n if (concepts.some(concept => concept.attributes.some(attribute => ['pii', 'sensitive'].includes(attribute.name))))\n context.error(DiagnosticCodes.ProtectedSubjectType, `Subject concept '${type.name}' is pii or secret. EventContext.Subject is stored in plaintext; use a surrogate Uuid identity.`, property.location);\n const primitive = concepts.length === 1 ? concepts[0].type : concepts.length === 0 && ['String', 'Uuid', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime'].includes(type.name) ? type.name : null;\n if (concepts.length === 0 && primitive === null && application.imports.some(imported => imported.qualifiedName === type.name || imported.qualifiedName.split('.').at(-1) === type.name))\n context.warning(DiagnosticCodes.UnknownType, `Unknown type shape '${type.name}' for subject property '${property.name}'; imported subject identity rules cannot be verified.`, property.location);\n if (concepts.some(concept => concept.type === 'Enum') || primitive !== null && !supportsStreamIdentity(type, application))\n context.error(DiagnosticCodes.InvalidSubjectType, 'Subjects support String, Uuid and their concepts, plus Int-backed concepts; bare Int, enums, Decimal, Bool, Date and DateTime are refused.', property.location);\n }\n }\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { PropertySyntax, TypeRefSyntax } from '../Syntax/Declarations';\nimport { ExpressionSyntax, ObjectMemberSyntax, PropertyMappingSyntax } from '../Syntax/Expressions';\nimport { InvocationRefusalSyntax } from '../Syntax/InvocationRefusalSyntax';\nimport { ProducesSyntax } from '../Syntax/Reactions';\nimport { ScreenplaySyntaxWalker } from '../Syntax/ScreenplaySyntaxWalker';\nimport { SliceSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\nimport { RefusalDeclarations } from './RefusalDeclarations';\n\nexport class RefusalValueWalker extends ScreenplaySyntaxWalker {\n private slice: SliceSyntax | null = null;\n private branch: InvocationRefusalSyntax | null = null;\n private properties: readonly PropertySyntax[] | null = null;\n private target: TypeRefSyntax | null = null;\n private mapping = false;\n\n constructor(private readonly declarations: RefusalDeclarations, private readonly context: ParserContext) { super(); }\n\n visitSlice(syntax: SliceSyntax): void {\n this.slice = syntax;\n super.visitSlice(syntax);\n this.slice = null;\n }\n\n visitInvocationRefusal(syntax: InvocationRefusalSyntax): void {\n this.branch = syntax;\n super.visitInvocationRefusal(syntax);\n this.branch = null;\n }\n\n visitProduces(syntax: ProducesSyntax): void {\n if (this.branch === null || this.slice === null) { super.visitProduces(syntax); return; }\n this.visitNode(syntax);\n if (syntax.for !== null) this.visitExpression(syntax.for);\n if (syntax.when != null) this.visitCondition(syntax.when);\n syntax.tags.forEach(tag => this.visitTag(tag));\n this.properties = this.declarations.event(syntax.event, this.slice)?.properties ?? null;\n syntax.mappings.forEach(mapping => this.visitPropertyMapping(mapping));\n this.properties = null;\n }\n\n visitPropertyMapping(syntax: PropertyMappingSyntax): void {\n this.mapping = this.branch !== null;\n this.target = this.declarations.property(this.properties, syntax.property)?.type ?? null;\n super.visitPropertyMapping(syntax);\n this.target = null;\n this.mapping = false;\n }\n\n visitObjectMember(syntax: ObjectMemberSyntax): void {\n const parent = this.target;\n this.target = this.declarations.property(parent === null ? null : this.declarations.types.get(parent.name)?.properties ?? null, syntax.name)?.type ?? null;\n super.visitObjectMember(syntax);\n this.target = parent;\n }\n\n visitExpression(syntax: ExpressionSyntax): void {\n if (syntax.kind === 'RefusalExpressionSyntax') {\n if (!this.mapping || this.branch === null || !['reason', 'constraint', 'message'].includes(syntax.member) || syntax.member === 'constraint' && this.branch.selector !== 'constraint') {\n this.context.error(DiagnosticCodes.InvalidRefusalValue, `'$refusal.${syntax.member}' is only available in a refusal branch's event mapping; constraint requires 'by constraint'.`, syntax.location);\n } else if (this.target !== null && (this.target.isCollection || this.declarations.compatible({ ...this.target, name: 'String', isOptional: false, isCollection: false }, this.target) === false && !this.declarations.application.concepts.some(concept => concept.name === this.target!.name && concept.type === 'String'))) {\n this.context.error(DiagnosticCodes.InvalidRefusalValue, `'$refusal.${syntax.member}' is a String value, incompatible with '${this.target.name}'.`, syntax.location);\n }\n }\n const parent = this.target;\n if (syntax.kind === 'ListExpressionSyntax' && parent !== null) this.target = { ...parent, isCollection: false };\n super.visitExpression(syntax);\n this.target = parent;\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { InvocationRefusalSyntax } from '../Syntax/InvocationRefusalSyntax';\nimport { ApplicationSyntax, FeatureSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\nimport { RefusalDeclarations } from './RefusalDeclarations';\nimport { RefusalValueWalker } from './RefusalValueWalker';\nimport { expandSpecificationExamples } from './SpecificationCommandExamples';\n\n// Invocations have no identity declaration until #383; keep that decision separate from authorization gating.\nfunction invocationHasNoDeclaredIdentity(): boolean { return true; }\n\nfunction authorizationGatedSlices(application: ApplicationSyntax): Set<SliceSyntax> {\n const slices = new Set<SliceSyntax>();\n const collect = (feature: FeatureSyntax, inherited: boolean): void => {\n const gated = inherited || feature.authorize !== null;\n if (gated) feature.slices.forEach(slice => slices.add(slice));\n feature.features.forEach(child => collect(child, gated));\n };\n application.modules.forEach(module => module.features.forEach(feature => collect(feature, module.authorize !== null)));\n return slices;\n}\n\nexport function validateReactionRefusals(application: ApplicationSyntax, context: ParserContext): void {\n const declarations = new RefusalDeclarations(expandSpecificationExamples(application));\n new RefusalValueWalker(declarations, context).visitApplication(declarations.application);\n const gatedSlices = authorizationGatedSlices(declarations.application);\n for (const { slice } of declarations.slices) {\n const constraintOf = (name: string) => declarations.resolve(name, slice, owner => owner.constraints);\n const sameConstraint = (left: string, right: string) => left === right || constraintOf(left) !== null && constraintOf(left)?.node === constraintOf(right)?.node;\n const covers = (previous: InvocationRefusalSyntax, branch: InvocationRefusalSyntax) =>\n previous.selector === 'any' && ['any', 'validation', 'constraint'].includes(branch.selector) ||\n previous.selector === branch.selector && (previous.selector !== 'constraint' || previous.constraint === null || branch.constraint !== null && sameConstraint(previous.constraint, branch.constraint));\n for (const invocation of slice.reactions.flatMap(reaction => reaction.triggers).flatMap(trigger => trigger.invokes)) {\n const invoked = declarations.resolve(invocation.command, slice, owner => owner.commands);\n const authorizationGated = invoked !== null && (invoked.node.authorize !== null || gatedSlices.has(invoked.slice));\n const earlier: InvocationRefusalSyntax[] = [];\n for (const branch of invocation.onRefused ?? []) {\n if (earlier.some(previous => covers(previous, branch))) context.warning(DiagnosticCodes.UnreachableRefusalBranch, 'This refusal selector is covered by an earlier branch; the first matching branch wins.', branch.location);\n earlier.push(branch);\n if (branch.selector === 'authorization' && invocationHasNoDeclaredIdentity() && authorizationGated) {\n context.warning(DiagnosticCodes.AuthorizationRefusalWithoutIdentity,\n `Command '${invocation.command}' is authorization-gated, but this invocation has no declared identity. This authorization refusal branch always fires in the reference runner because there is no caller; Arc runs reactor commands as the system. Declare an invoking identity once supported (#383).`,\n branch.location);\n }\n if (branch.constraint === null) continue;\n const constraint = constraintOf(branch.constraint);\n if (constraint === null) {\n context.error(DiagnosticCodes.UnknownRefusalConstraint, `Unknown or ambiguous refusal constraint '${branch.constraint}'.`, branch.location);\n continue;\n }\n if (invoked === null || invoked.node.handler !== null) continue;\n const rules = [constraint.node, ...constraint.node.additionalRules];\n if (rules.some(rule => rule.kind === 'FileConstraintSyntax')) continue;\n const targets = rules.map(rule => rule.kind === 'FileConstraintSyntax' ? null : declarations.event(rule.event, constraint.slice));\n const productions = invoked.node.produces.map(produced => declarations.event(produced.event, invoked.slice));\n if (targets.every(target => target !== null) && productions.every(produced => produced !== null) && !targets.some(target => productions.includes(target)))\n context.warning(DiagnosticCodes.UnreachableRefusalBranch, `Constraint '${branch.constraint}' targets none of the events produced by '${invocation.command}'.`, branch.location);\n }\n }\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { TypeRefSyntax } from '../Syntax/Declarations';\nimport { canonicalExactText } from '../Syntax/ExactMathFacts';\nimport { ExpressionSyntax } from '../Syntax/Expressions';\nimport { RefusalDeclarations } from './RefusalDeclarations';\nimport { RedeliveryValue } from './RedeliveryValue';\n\n// Undefined means undecidable, not the authored null literal. Mirror TryValue in the C#\n// specification consistency validator, including nominal enums and structured fixture values.\nexport function redeliveryValue(expression: ExpressionSyntax, type: TypeRefSyntax | null, declarations: RefusalDeclarations): RedeliveryValue | undefined {\n const concept = type === null || type.isCollection ? undefined : declarations.concepts.get(type.name);\n const enumeration = concept !== undefined && concept.type === 'Enum' ? concept : null;\n const member = (text: string) => enumeration !== null && text.startsWith(`${enumeration.name}.`) ? text.substring(enumeration.name.length + 1) : text;\n if (type?.isCollection && expression.kind === 'ListExpressionSyntax' && declarations.compatible({ ...type, isCollection: false }, { ...type, isCollection: false }) === true) {\n const items = expression.items.map(item => redeliveryValue(item, { ...type, isCollection: false, isOptional: false }, declarations));\n return items.some(item => item === undefined) ? undefined : { canonical: `[${items.map(canonical).join(',')}]` };\n }\n const properties = type === null ? undefined : declarations.types.get(type.name)?.properties;\n if (type !== null && !type.isCollection && expression.kind === 'ObjectExpressionSyntax' && properties !== undefined) {\n const members = expression.members.map(item => {\n const property = declarations.property(properties, item.name);\n return { name: item.name, value: property === null ? undefined : redeliveryValue(item.value, property.type, declarations) };\n });\n return members.some(item => item.value === undefined) ? undefined : { canonical: `{${members.sort((left, right) => left.name < right.name ? -1 : left.name > right.name ? 1 : 0).map(item => `${JSON.stringify(item.name)}:${canonical(item.value)}`).join(',')}}` };\n }\n if (expression.kind === 'LiteralExpressionSyntax') return enumeration !== null && typeof expression.value === 'string' ? member(expression.value) : expression.value;\n if (expression.kind === 'PathExpressionSyntax' && enumeration !== null) return member(expression.path);\n return undefined;\n}\n\nfunction canonical(value: RedeliveryValue | undefined): string {\n if (typeof value === 'object' && value !== null) return 'canonical' in value ? value.canonical : canonicalExactText(value);\n return JSON.stringify(value)!;\n}\n\nexport function sameRedeliveryValue(left: ExpressionSyntax, right: ExpressionSyntax, type: TypeRefSyntax | null, declarations: RefusalDeclarations): boolean | null {\n const first = redeliveryValue(left, type, declarations);\n const second = redeliveryValue(right, type, declarations);\n if (first === undefined || second === undefined) return null;\n return canonical(first) === canonical(second);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { EventSyntax } from '../Syntax/Declarations';\nimport { SpecificationRedeliverySyntax } from '../Syntax/SpecificationRedeliverySyntax';\nimport { SpecificationEventSyntax } from '../Syntax/Specifications';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\nimport { RefusalDeclarations } from './RefusalDeclarations';\nimport { sameRedeliveryValue } from './RedeliveryValues';\nimport { matchesSpecificationRoute } from './SpecificationRouteComparison';\nimport { expandSpecificationExamples } from './SpecificationCommandExamples';\n\nexport function validateSpecificationRedelivery(application: ApplicationSyntax, context: ParserContext): void {\n application = expandSpecificationExamples(application);\n const declarations = new RefusalDeclarations(application);\n for (const { slice } of declarations.slices) for (const specification of slice.specifications) {\n const action = specification.whenRedelivered;\n if (action == null) continue;\n const event = declarations.event(action.eventType, slice);\n const reaction = declarations.resolve(action.reaction, slice, owner => owner.reactions);\n if (reaction === null || event === null || !reaction.node.triggers.some(trigger => trigger.source.kind === 'NamedTriggerSourceSyntax' && declarations.event(trigger.source.name, reaction.slice) === event)) {\n context.error(DiagnosticCodes.UnknownRedeliveryReaction, `Reaction '${action.reaction}' must resolve unambiguously and observe event '${action.eventType}'.`, action.location);\n continue;\n }\n const candidates = specification.given.filter(given => declarations.event(given.eventType, slice) === event).map(given => matches(given, action, event, declarations, application));\n const count = candidates.filter(match => match === true).length;\n if (candidates.some(match => match === null))\n context.error(DiagnosticCodes.UnmatchedRedeliveredOccurrence, `Cannot locate redelivery of '${action.eventType}' uniquely: a given source or locator value is not decidable; use 'for', values, 'stream' or 'no stream'.`, action.location);\n else if (count !== 1)\n context.error(DiagnosticCodes.UnmatchedRedeliveredOccurrence, `Redelivery of '${action.eventType}' matches ${count} given occurrences; use 'for', values, 'stream' or 'no stream' to identify exactly one.`, action.location);\n }\n}\n\nfunction matches(given: SpecificationEventSyntax, action: SpecificationRedeliverySyntax, event: EventSyntax, declarations: RefusalDeclarations, application: ApplicationSyntax): boolean | null {\n const comparisons: (boolean | null)[] = [];\n if (action.for !== null) comparisons.push(given.for === null ? null : sameRedeliveryValue(action.for, given.for, null, declarations));\n for (const locator of action.values) {\n const values = given.values.filter(value => value.property === locator.property);\n comparisons.push(values.length === 1 ? sameRedeliveryValue(locator.source, values[0].source, declarations.property(event.properties, locator.property)?.type ?? null, declarations) : null);\n }\n comparisons.push(matchesSpecificationRoute(given.stream, action.stream, action.noStream, application));\n return comparisons.includes(false) ? false : comparisons.includes(null) ? null : true;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ConditionSyntax } from '../Syntax/Conditions';\nimport { ScreenGuardedActionSyntax } from '../Syntax/Screens';\nimport { ParserContext } from './ParserContext';\n\nconst maximumDisjuncts = 64;\n\n// Proves shadowing by comparison-set inclusion, bounding each DNF expansion to 64 disjuncts.\nexport function validateGuardedActionShadowing(action: ScreenGuardedActionSyntax, context: ParserContext): void {\n const earlier: ReadonlySet<string>[] = [];\n for (const alternative of action.alternatives) {\n const terms = normalize(alternative.condition);\n if (terms === null) continue;\n if (terms.length > 0 && terms.every(term => earlier.some(previous => [...previous].every(comparison => term.has(comparison))))) {\n context.warning(DiagnosticCodes.UnreachableActionAlternative, `Alternative executing '${alternative.command}' is shadowed by earlier alternatives in this action`, alternative.location);\n }\n earlier.push(...terms);\n }\n}\n\nfunction normalize(condition: ConditionSyntax): ReadonlySet<string>[] | null {\n if (condition.kind === 'ComparisonConditionSyntax') {\n if (condition.right.kind !== 'LiteralExpressionSyntax') return null;\n const value = condition.right.value;\n // Preserve literal type as well as value (null, text, Boolean, Double or exact Decimal).\n const comparison = JSON.stringify([condition.left, condition.operator, typeof value, value !== null && typeof value === 'object' ? value.value : typeof value === 'number' ? String(value) : value]);\n return [new Set([comparison])];\n }\n const left = normalize(condition.left);\n const right = normalize(condition.right);\n if (left === null || right === null) return null;\n if (condition.operator === 'Or') return left.length + right.length > maximumDisjuncts ? null : [...left, ...right];\n if (left.length * right.length > maximumDisjuncts) return null;\n return left.flatMap(first => right.map(second => new Set([...first, ...second])));\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { ComparisonConditionSyntax, ConditionSyntax } from '../Syntax/Conditions';\nimport { PropertySyntax } from '../Syntax/Declarations';\nimport { InteractionArgumentSyntax, ScreenDataSyntax, ScreenDirectiveSyntax, ScreenGuardedActionSyntax } from '../Syntax/Screens';\nimport { ApplicationSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { validateGuardedActionShadowing } from './GuardedActionShadowing';\nimport { ParserContext } from './ParserContext';\nimport { RefusalDeclarations } from './RefusalDeclarations';\n\nconst primitives = new Set(['Uuid', 'String', 'Int', 'Decimal', 'Bool', 'Date', 'DateTime']);\n\n// Resolves known subject and input shapes without guessing imported or ambiguous declarations.\nexport function validateGuardedActions(application: ApplicationSyntax, context: ParserContext): void {\n const declarations = new RefusalDeclarations(application);\n for (const { slice } of declarations.slices) {\n for (const screen of slice.screens) validateContainer(screen.directives, [], slice, declarations, context);\n }\n}\n\nfunction validateContainer(directives: readonly ScreenDirectiveSyntax[], inherited: readonly ScreenDataSyntax[], slice: SliceSyntax, declarations: RefusalDeclarations, context: ParserContext): void {\n const local = directives.filter(directive => directive.kind === 'ScreenDataSyntax');\n const subjects = local.length === 0 ? inherited : local;\n for (const directive of directives) {\n switch (directive.kind) {\n case 'ScreenGuardedActionSyntax':\n validateAction(directive, subjects, slice, declarations, context);\n break;\n case 'ScreenSectionSyntax':\n validateContainer(directive.directives, subjects, slice, declarations, context);\n break;\n case 'ScreenTemplateReferenceSyntax':\n for (const slot of directive.slots) validateContainer(slot.directives, subjects, slice, declarations, context);\n break;\n }\n }\n}\n\nfunction viewProperties(name: string, slice: SliceSyntax, declarations: RefusalDeclarations): readonly PropertySyntax[] | null {\n return declarations.resolve(name, slice, candidate => candidate.readModels)?.node.properties ?? null;\n}\n\nfunction validateAction(action: ScreenGuardedActionSyntax, subjects: readonly ScreenDataSyntax[], slice: SliceSyntax, declarations: RefusalDeclarations, context: ParserContext): void {\n const properties = subjects.length === 1 ? viewProperties(subjects[0].type.name, slice, declarations) : null;\n if (subjects.length !== 1) {\n context.warning(DiagnosticCodes.UnresolvedActionSubject, \"A guarded action requires exactly one nearest 'data' subject; no data or equally near data bindings leave 'item' unresolved\", action.location);\n }\n for (const alternative of action.alternatives) {\n for (const comparison of comparisons(alternative.condition)) validateItemPath(comparison.left, comparison.location, properties, slice, declarations, context);\n validateArguments(alternative.command, alternative.arguments, properties, slice, declarations, context);\n }\n if (action.otherwise?.command != null) validateArguments(action.otherwise.command, action.otherwise.arguments, properties, slice, declarations, context);\n validateGuardedActionShadowing(action, context);\n}\n\nfunction validateArguments(commandName: string, arguments_: readonly InteractionArgumentSyntax[], properties: readonly PropertySyntax[] | null, slice: SliceSyntax, declarations: RefusalDeclarations, context: ParserContext): void {\n const command = declarations.resolve(commandName, slice, candidate => candidate.commands)?.node;\n for (const argument of arguments_) {\n const inputs = command?.properties.filter(property => property.name === argument.name);\n if (inputs?.length === 0) context.warning(DiagnosticCodes.UnknownActionArgumentProperty, `Command '${commandName}' has no argument property '${argument.name}'`, argument.location);\n const subjectProperty = validateItemPath(argument.binding, argument.location, properties, slice, declarations, context, true);\n if (inputs?.length === 1 && subjectProperty !== null && inputs[0].type.isCollection !== subjectProperty.type.isCollection) {\n context.warning(DiagnosticCodes.UnknownActionArgumentProperty, `Command argument '${commandName}.${argument.name}' and subject field '${argument.binding}' must have matching collection cardinality`, argument.location);\n }\n }\n}\n\nfunction validateItemPath(path: string, location: SourceLocation, properties: readonly PropertySyntax[] | null, slice: SliceSyntax, declarations: RefusalDeclarations, context: ParserContext, allowTerminalCollection = false): PropertySyntax | null {\n if (!path.startsWith('item.') || properties === null) return null;\n const segments = path.substring('item.'.length).split('.');\n for (const [index, segment] of segments.entries()) {\n const matches: readonly PropertySyntax[] = properties.filter(property => property.name === segment);\n if (matches.length === 0 || (matches.length === 1 && matches[0].type.isCollection && (!allowTerminalCollection || index < segments.length - 1))) {\n context.warning(DiagnosticCodes.UnknownActionSubjectField, `Unknown or collection-valued subject field '${path}' - guarded actions require an item field path`, location);\n return null;\n }\n if (matches.length !== 1) return null;\n if (index === segments.length - 1) return matches[0];\n const type = matches[0].type;\n properties = declarations.types.get(type.name)?.properties ?? viewProperties(type.name, slice, declarations);\n if (properties === null) {\n if (primitives.has(type.name) || declarations.application.concepts.some(concept => concept.name === type.name) && !declarations.application.types.some(composite => composite.name === type.name)) {\n context.warning(DiagnosticCodes.UnknownActionSubjectField, `Subject field '${path}' continues past scalar '${segment}'`, location);\n }\n return null;\n }\n }\n return null;\n}\n\nfunction comparisons(condition: ConditionSyntax): readonly ComparisonConditionSyntax[] {\n return condition.kind === 'ComparisonConditionSyntax' ? [condition] : [...comparisons(condition.left), ...comparisons(condition.right)];\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { ApplicationSyntax, FeatureSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\n\nexport function validatePersonaCallers(application: ApplicationSyntax, context: ParserContext): void {\n const personas = application.personas.map(persona => persona.name);\n const visit = (features: readonly FeatureSyntax[]): void => {\n for (const feature of features) {\n visit(feature.features);\n for (const slice of feature.slices) {\n for (const specification of slice.specifications) {\n const reference = specification.givenCallerPersona;\n if (reference != null) {\n const count = personas.filter(name => name === reference.name).length;\n if (count !== 1) context.error(DiagnosticCodes.InvalidSpecificationCallerPersona, `${count === 0 ? 'Unknown' : 'Ambiguous'} persona '${reference.name}' - declared personas: ${personas.join(', ')}.`, reference.location);\n }\n }\n }\n }\n };\n for (const module of application.modules) visit(module.features);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { PurposeReferenceSyntax } from '../Syntax/Purposes';\nimport { ApplicationSyntax, FeatureSyntax } from '../Syntax/Structure';\nimport { ParserContext } from './ParserContext';\n\nexport function validatePurposes(application: ApplicationSyntax, context: ParserContext): void {\n const known = new Set<string>();\n for (const purpose of application.purposes ?? []) {\n if (known.has(purpose.name)) context.error(DiagnosticCodes.DuplicatePurposeDeclaration, `Duplicate purpose '${purpose.name}' - a purpose is declared once`, purpose.location);\n known.add(purpose.name);\n }\n for (const purpose of application.purposes ?? []) {\n if (purpose.interest !== null && purpose.basis !== 'legitimateInterests') context.warning(DiagnosticCodes.PurposeInterestMismatch, `Purpose '${purpose.name}' declares an interest without basis legitimateInterests`, purpose.location);\n else if (purpose.basis === 'legitimateInterests' && !purpose.interest?.trim()) context.warning(DiagnosticCodes.PurposeInterestMismatch, `Purpose '${purpose.name}' with basis legitimateInterests has no interest statement (Art. 13(1)(d))`, purpose.location);\n }\n const references: PurposeReferenceSyntax[] = [];\n const collect = (feature: FeatureSyntax): void => {\n references.push(...feature.purposes ?? [], ...feature.slices.flatMap(slice => slice.purposes ?? []));\n feature.features.forEach(collect);\n };\n for (const module of application.modules) {\n references.push(...module.purposes ?? []);\n module.features.forEach(collect);\n }\n for (const reference of references) {\n if (!known.has(reference.name)) context.warning(DiagnosticCodes.UnknownPurpose, `Unknown purpose '${reference.name}' - declare it with 'purpose ${reference.name}'`, reference.location);\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// .NET OrdinalIgnoreCase uses simple uppercase, not lowercase or full (expanding) uppercase.\n// It keeps dotless i and long s distinct from ASCII I and S. Greek letters with a subscript\n// iota have a single-character uppercase that JavaScript's full casing expands instead.\nexport function ordinalIgnoreCaseKey(value: string): string {\n return Array.from(value, character => {\n if (character === '\\u0131' || character === '\\u017f') return character;\n const code = character.codePointAt(0)!;\n if ((code >= 0x1f80 && code <= 0x1f87) || (code >= 0x1f90 && code <= 0x1f97) || (code >= 0x1fa0 && code <= 0x1fa7)) return String.fromCodePoint(code + 8);\n if (code === 0x1fb3) return '\\u1fbc';\n if (code === 0x1fc3) return '\\u1fcc';\n if (code === 0x1ff3) return '\\u1ffc';\n const upper = character.toUpperCase();\n return Array.from(upper).length === 1 ? upper : character;\n }).join('');\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { eventDeclarations } from '../Syntax/EventDeclarations';\nimport { buildingReadModelReferences, sliceReferences } from '../Dependencies/SliceReferences';\nimport { DependencyGraph } from '../Dependencies/DependencyGraph';\nimport { stronglyConnectedGroups } from '../Dependencies/StronglyConnectedGroups';\nimport { ApplicationSyntax, FeatureSyntax, SliceSyntax } from '../Syntax/Structure';\nimport { authoredOrderKey, authoredOrderOf } from './AuthoredOrder';\nimport { ordinalIgnoreCaseKey } from '../Text/ordinalIgnoreCaseKey';\n\ninterface Slice {\n syntax: SliceSyntax;\n scope: readonly string[];\n identity: readonly string[];\n index: number;\n}\ninterface Reference { event: string; location: SourceLocation; readModel: boolean }\ninterface Edge extends Reference { consumer: Slice; producer: Slice; left: string; right: string; container: string }\n\n// This pass only observes syntax. Its ranks and graph never enter the persisted model.\nexport function timelineOrderDiagnostics(application: ApplicationSyntax): Diagnostic[] {\n const order = authoredOrderOf(application);\n const ordered = <T extends { name: string }>(items: readonly T[], outer: readonly string[]): T[] => items\n .map(syntax => ({ syntax, rank: order.get(authoredOrderKey([...outer, syntax.name])) ?? Number.MAX_SAFE_INTEGER }))\n .sort((left, right) => left.rank - right.rank).map(item => item.syntax);\n const slices: Slice[] = [];\n const feature = (syntax: FeatureSyntax, outer: readonly string[]) => {\n const scope = [...outer, syntax.name];\n for (const slice of ordered(syntax.slices, scope)) slices.push({ syntax: slice, scope: [...scope, slice.name], identity: [...scope.map(name => `container:${name}`), `slice:${slice.name}`], index: slices.length });\n for (const child of ordered(syntax.features, scope)) feature(child, scope);\n };\n for (const module of ordered(application.modules, [])) {\n for (const child of ordered(module.features, [module.name])) feature(child, [module.name]);\n }\n const produced = new Map(slices.map(slice => [slice, new Set([\n ...eventDeclarations(slice.syntax).map(event => ordinalIgnoreCaseKey(event.name)),\n ...slice.syntax.commands.flatMap(command => command.produces.map(value => ordinalIgnoreCaseKey(value.event))),\n ...slice.syntax.reactions.flatMap(reaction => reaction.triggers.flatMap(trigger => trigger.produces.map(value => ordinalIgnoreCaseKey(value.event)))),\n ])]));\n const producers = new Map<string, Slice>();\n for (const slice of slices) {\n for (const event of eventDeclarations(slice.syntax)) {\n const name = ordinalIgnoreCaseKey(event.name);\n if (!producers.has(name)) producers.set(name, slice);\n }\n }\n // Use decidesFrom resolution, including builder preference and declaration fallback.\n const byScope = new Map<string, Slice>();\n for (const slice of slices) {\n const key = authoredOrderKey(slice.scope);\n if (!byScope.has(key)) byScope.set(key, slice);\n }\n const readers = new Map<string, Slice>();\n for (const decision of DependencyGraph.for(application, order).edges.filter(edge => edge.kind === 'decidesFrom')) {\n for (const reference of decision.evidence) {\n const key = authoredOrderKey([...decision.consumer.scope, reference.name.toLowerCase()]);\n if (!readers.has(key)) readers.set(key, byScope.get(authoredOrderKey(decision.producer.scope))!);\n }\n }\n const edges: Edge[] = [];\n for (const consumer of slices) {\n const seen = new Set<string>();\n const references = sliceReferences(consumer.syntax).references.filter(reference => reference.timeline)\n .map(reference => ({ event: reference.name, location: reference.location, readModel: reference.targetKind === 'ReadModel' }));\n for (const reference of references) {\n const name = ordinalIgnoreCaseKey(reference.event);\n const key = `${reference.readModel ? 'ReadModel' : 'Event'}:${name}`;\n if (seen.has(key)) continue;\n seen.add(key);\n const producer = reference.readModel ? readers.get(authoredOrderKey([...consumer.scope, reference.event.toLowerCase()])) : producers.get(name);\n if (producer === undefined || producer === consumer) continue;\n let common = 0;\n while (common < consumer.scope.length && common < producer.scope.length && consumer.identity[common] === producer.identity[common]) common++;\n if (common === consumer.scope.length || common === producer.scope.length) continue;\n // At the lowest common container, the reader's whole child supplies feedback\n // only for builders of the read model being read.\n // Exclude this read before SCC grouping, not just backward-edge emission.\n if (reference.readModel) {\n const side = consumer.identity.slice(0, common + 1);\n const facts = new Set(slices.filter(slice => side.every((name, index) => slice.identity[index] === name)).flatMap(slice => [...produced.get(slice)!]));\n if (buildingReadModelReferences(producer.syntax, reference.event).some(value => value.timeline && value.kind === 'usesFactsFrom' && value.targetKind === 'Event' && facts.has(ordinalIgnoreCaseKey(value.name)))) continue;\n }\n edges.push({ ...reference, consumer, producer, container: authoredOrderKey(consumer.identity.slice(0, common)), left: consumer.identity[common], right: producer.identity[common] });\n }\n }\n const compare = (left: Edge, right: Edge) => left.consumer.index - right.consumer.index || left.location.line - right.location.line || left.location.column - right.location.column;\n const suppressed = new Set<Edge>();\n const findings: { edge: Edge; diagnostic: Diagnostic }[] = [];\n for (const container of new Set(edges.map(edge => edge.container))) {\n const local = edges.filter(edge => edge.container === container);\n const graph = new Map<string, Set<string>>();\n for (const edge of local) {\n if (!graph.has(edge.left)) graph.set(edge.left, new Set());\n if (!graph.has(edge.right)) graph.set(edge.right, new Set());\n graph.get(edge.left)!.add(edge.right);\n }\n for (const group of stronglyConnectedGroups(graph).filter(group => group.length > 1)) {\n const members = new Set(group);\n const internal = local.filter(edge => members.has(edge.left) && members.has(edge.right));\n internal.forEach(edge => suppressed.add(edge));\n const first = internal.filter(edge => edge.consumer.index < edge.producer.index).sort(compare)[0];\n if (first === undefined) continue;\n const memberIndex = (member: string) => Math.min(...internal.flatMap(edge => [edge.consumer, edge.producer]).filter(slice => {\n const scope = JSON.parse(container) as string[];\n return slice.identity[scope.length] === member;\n }).map(slice => slice.index));\n group.sort((left, right) => memberIndex(left) - memberIndex(right));\n findings.push({ edge: first, diagnostic: { severity: 'information', code: DiagnosticCodes.TimelineCycleGroup, message: `Timeline group ${group.map(member => `${member.startsWith('slice:') ? 'slice' : container === authoredOrderKey([]) ? 'module' : 'feature'} '${member.slice(member.indexOf(':') + 1)}'`).join(', ')} depend on each other's events or read models; reordering these members cannot make every dependency flow left to right.`, location: first.location } });\n }\n }\n for (const edge of edges) {\n if (edge.consumer.index >= edge.producer.index || suppressed.has(edge)) continue;\n const parent = edge.consumer.scope.slice(0, -1);\n const ownSubFeature = edge.producer.scope.length > edge.consumer.scope.length && parent.every((name, index) => edge.producer.scope[index] === name);\n const consequence = ownSubFeature ? ' The producer is in the consumer\\'s own sub-feature; this cannot be fixed by reordering.' : ' Consider drawing the producer before the consumer.';\n const use = edge.readModel ? `reads read model '${edge.event}' built by` : `uses event '${edge.event}' produced by`;\n findings.push({ edge, diagnostic: { severity: 'information', code: DiagnosticCodes.EventFromLaterSlice, message: `Slice '${edge.consumer.syntax.name}' ${use} slice '${edge.producer.syntax.name}' drawn after it.${consequence}`, location: edge.location } });\n }\n return findings.sort((left, right) => compare(left.edge, right.edge)).map(finding => finding.diagnostic);\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { validateIdentity } from './Parsing/IdentityValidator';\nimport { Diagnostic } from './Diagnostics/Diagnostic';\nimport { validateSpecificationCases } from './Parsing/SpecificationCaseValidator';\nimport { expandSpecificationExamples } from './Parsing/SpecificationCommandExamples';\nimport { productionDestinationDiagnostics } from './Diagnostics/ProductionDestinationDiagnostics';\nimport { validateConstraintProperties } from './Parsing/ConstraintPropertyValidator';\nimport { validateDependencyDeclarations } from './Dependencies/DeclaredDependencyTargets';\nimport { DeclaredDependencies } from './Dependencies/DeclaredDependencies';\nimport { documentPlacement, PlayPlacement } from './Files/PlayPlacement';\nimport { DiscoveredImport, discoverImports as discoverImportsIn } from './Parsing/ImportDiscovery';\nimport { InputUse } from './Parsing/InputUses';\nimport { validateResponses } from './Parsing/ResponseValidator';\nimport { validatePublicEventUsage } from './Parsing/PublicEventUsageValidator';\nimport { sourceContext } from './Parsing/SourceOptionsParser';\nimport { validateInlineEvents } from './Parsing/InlineEventValidator';\nimport { validateOperations } from './Parsing/OperationValidator';\nimport { CommandStreamCandidates } from './Parsing/CommandStreamCandidates';\nimport { validateEventSources } from './Parsing/EventSourceValidator';\nimport { validateProjectionTargets } from './Parsing/ProjectionTargetValidator';\nimport { validateIdentifierCompliance } from './Parsing/IdentifierComplianceValidator';\nimport { validateEventSubjects } from './Parsing/EventSubjectValidator';\nimport { validateReactionRefusals } from './Parsing/ReactionRefusalValidator';\nimport { validateSpecificationRedelivery } from './Parsing/SpecificationRedeliveryValidator';\nimport { validateGuardedActions } from './Parsing/GuardedActionValidator';\nimport { validatePersonaCallers } from './Parsing/PersonaCallerValidator';\nimport { validatePurposes } from './Parsing/PurposeValidator';\nimport { parseApplication } from './Parsing/ScreenplayParser';\nimport { splitLines } from './Parsing/SourceLineSplitter';\nimport { PropertySyntax } from './Syntax/Declarations';\nimport { ApplicationSyntax } from './Syntax/Structure';\nimport { ApplicationSyntaxVisitor } from './Syntax/Visitors';\nimport { ProjectionSyntax } from './Syntax/Projections';\nimport { CaptureSyntax } from './Syntax/Captures';\nimport { SpecificationExampleSyntax, SpecificationSyntax } from './Syntax/Specifications';\nimport { SyntaxNode } from './Syntax/SyntaxNode';\nimport { ParserContext } from './Parsing/ParserContext';\nimport { parseProjection } from './Parsing/ProjectionParser';\nimport { parseCapture } from './Parsing/CaptureParser';\nimport { parseSpecification } from './Parsing/SpecificationParser';\nimport { parseExample } from './Parsing/SpecificationExampleParser';\nimport { firstWord } from './Parsing/LineText';\nimport { SourceLine, locationOf } from './Parsing/SourceLine';\nimport { DiagnosticCodes } from './Diagnostics/DiagnosticCodes';\nimport { timelineOrderDiagnostics } from './Files/TimelineOrder';\n\n// What compiling produced: the syntax tree, and the diagnostics found on the way. A tree is always\n// produced, so a document with errors still shows everything that could be read.\nexport interface CompilationResult<T> {\n readonly value: T;\n readonly diagnostics: readonly Diagnostic[];\n readonly success: boolean;\n}\n\n// Parses one .play document - the TypeScript counterpart of the C# ScreenplayCompiler.Parse. The path, when\n// given, is carried on every source location so a folder of documents can be merged and still point back\n// at the file each node came from. A placement says the document's top level belongs to the module or\n// feature an import placed it in: that module and feature are in the tree, marked as placements, holding what\n// the document declares at its top level.\nexport function parse(source: string, path?: string, placement: PlayPlacement = documentPlacement): CompilationResult<ApplicationSyntax> {\n const { value, diagnostics, success } = parseForAuthoring(source, path, placement);\n return { value, diagnostics, success };\n}\n\n// Additive authoring view: do not widen TypeRefSyntax or the cross-compiler SyntaxJson projection.\nexport function parseForAuthoring(source: string, path?: string, placement: PlayPlacement = documentPlacement, validateResponseContracts = true, streamCandidates?: CommandStreamCandidates, languages?: ReadonlySet<string>): CompilationResult<ApplicationSyntax> & { readonly triggerData: readonly PropertySyntax[]; readonly inputUses: readonly InputUse[] } {\n const lines = splitLines(source, false, path);\n const context = sourceContext(lines, path, languages);\n context.scope = placement;\n context.streamCandidates = streamCandidates ?? CommandStreamCandidates.capture([lines], placement, languages);\n let value = parseApplication(context, lines, placement);\n // Folder assembly validates declaration-dependent contracts once against the merged inventory.\n if (validateResponseContracts) {\n validateIdentity(value, context);\n validatePurposes(value, context);\n validateInlineEvents(value, context);\n validateConstraintProperties(value, context);\n validateOperations(value, context);\n validatePublicEventUsage(value, context);\n validateSpecificationCases(value, context);\n const effective = expandSpecificationExamples(value);\n validateResponses(effective, context);\n validateEventSources(value, context);\n validateProjectionTargets(value, context);\n validateIdentifierCompliance(effective, context);\n validateEventSubjects(value, context);\n validateReactionRefusals(value, context);\n validateSpecificationRedelivery(value, context);\n validateGuardedActions(value, context);\n validatePersonaCallers(value, context);\n value = validateDependencyDeclarations(value, context);\n DeclaredDependencies.validate(value, context);\n for (const diagnostic of productionDestinationDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n for (const diagnostic of timelineOrderDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n }\n return {\n value,\n diagnostics: context.diagnostics,\n triggerData: context.triggerData,\n inputUses: context.inputUses,\n success: !context.diagnostics.some(diagnostic => diagnostic.severity === 'error'),\n };\n}\n\n/** Checks public boundaries on programmatically authored or decoded assembled syntax. */\nexport function publicEventDiagnostics(application: ApplicationSyntax): readonly Diagnostic[] {\n const context = sourceContext([], application.location.path);\n validatePublicEventUsage(application, context);\n return context.diagnostics;\n}\n\n// Parses a document and hands its syntax tree to a visitor - the counterpart of the C#\n// ScreenplayCompiler.Compile<T>(source, visitor). The visitor runs even when there are errors, over\n// everything that could be read.\nexport function compile<T>(source: string, visitor: ApplicationSyntaxVisitor<T>, path?: string): CompilationResult<T> {\n const parsed = parse(source, path);\n return { value: visitor.visit(parsed.value), diagnostics: parsed.diagnostics, success: parsed.success };\n}\n\n// Finds the files a document imports and where in it each import is written - each import with the module\n// and feature names around it, outermost first. Diagnostics are not collected; parsing the document reports them.\nexport function discoverImports(source: string, path?: string, languages?: ReadonlySet<string>): DiscoveredImport[] {\n const lines = splitLines(source, false, path);\n return discoverImportsIn(sourceContext(lines, path, languages));\n}\n\n// Additive entry points preserve the caller's registry; none can select numeric mode externally.\nexport function parseWithLanguages(source: string, languages: ReadonlySet<string>, path?: string, placement: PlayPlacement = documentPlacement): CompilationResult<ApplicationSyntax> {\n const { value, diagnostics, success } = parseForAuthoring(source, path, placement, true, undefined, languages);\n return { value, diagnostics, success };\n}\n\nexport function parseProjectionSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly ProjectionSyntax[]> {\n return parseSourceFamily(source, 'projection', parseProjection, path, languages);\n}\n\nexport function parseCaptureSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly CaptureSyntax[]> {\n return parseSourceFamily(source, 'capture', parseCapture, path, languages);\n}\n\nexport function parseSpecificationSource(source: string, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly SpecificationSyntax[]> {\n return parseSourceFamily(source, 'specification', parseSpecification, path, languages);\n}\n\nfunction parseSourceFamily<T extends SyntaxNode>(source: string, keyword: string, read: (context: ParserContext, line: SourceLine) => T, path?: string, languages?: ReadonlySet<string>): CompilationResult<readonly T[]> {\n const context = sourceContext(splitLines(source, true, path), path, languages, true);\n const value: T[] = [];\n const examples: SpecificationExampleSyntax[] = [];\n for (let line = context.reader.peekSignificant(); line !== undefined; line = context.reader.peekSignificant()) {\n context.reader.takeSignificant();\n if (keyword === 'specification' && firstWord(line.content) === 'example') examples.push(parseExample(context, line));\n else if (line.content.startsWith(keyword)) value.push(read(context, line));\n else {\n context.error(DiagnosticCodes.UnknownTopLevelConstruct, `Expected '${keyword}', got '${line.content}'`, locationOf(line));\n context.skipOpaqueBlock(line.indent);\n }\n }\n if (context.sourceOptions.numericMode === 'exact' && value.length === 0 && context.diagnostics.length === 0) {\n const code = keyword === 'projection' ? DiagnosticCodes.ProjectionDocumentWithoutProjection : keyword === 'capture' ? DiagnosticCodes.CaptureDocumentWithoutCapture : DiagnosticCodes.SpecificationDocumentWithoutSpecification;\n context.error(code, `Document must contain at least one ${keyword}`, context.start);\n }\n const roots = keyword === 'specification' && examples.length > 0 ? value.map(node => ({ ...node, examples })) : value;\n if (keyword === 'specification') {\n const application = parseApplication(sourceContext([], path, languages), [], documentPlacement);\n validateSpecificationCases({ ...application, examples }, context, roots as unknown as SpecificationSyntax[]);\n }\n return { value: roots, diagnostics: context.diagnostics, success: !context.diagnostics.some(diagnostic => diagnostic.severity === 'error') };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { PlayPlacement } from '../Files/PlayPlacement';\nimport { commentStart, splitLines } from '../Parsing/SourceLineSplitter';\nimport { parseForAuthoring } from '../ScreenplayCompiler';\nimport { EventSyntax } from '../Syntax/Declarations';\nimport { SliceSyntax } from '../Syntax/Structure';\nimport { TranslationDirection } from '../Syntax/TranslationDirection';\nimport { ScreenplaySyntaxWalker } from '../Syntax/ScreenplaySyntaxWalker';\nimport { pattern } from '../Text/patterns';\nimport { QuickFixCandidate } from './QuickFixCandidate';\n\nexport interface QuickFixEdit {\n readonly start: number;\n readonly length: number;\n readonly text: string;\n}\n\nexport interface QuickFix {\n readonly diagnosticCode: string;\n readonly title: string;\n readonly scope: 'occurrence' | 'document';\n readonly edits: readonly QuickFixEdit[];\n}\n\nexport interface QuickFixOptions {\n readonly line?: number;\n readonly placement?: PlayPlacement;\n readonly diagnosticCode?: string;\n}\n\nexport function isQuickFixDiagnostic(code: unknown): code is string {\n return code === DiagnosticCodes.LegacyOptionalSuffix || code === DiagnosticCodes.LegacyComplianceMarker || code === DiagnosticCodes.RedundantEventId || code === DiagnosticCodes.PublicTranslationRequiresDirection;\n}\n\n// Diagnostics point at the complete type, not at the suffix. Never derive edits from message text.\nexport function legacyOptionalTypeLength(line: string, diagnostic: Diagnostic): number {\n if (diagnostic.code !== DiagnosticCodes.LegacyOptionalSuffix) return 0;\n return /^[\\p{L}\\p{Mn}\\p{Nd}\\p{Pc}.]+(?:\\[\\])?\\?/u.exec(line.slice(diagnostic.location.column - 1))?.[0].length ?? 0;\n}\n\nexport function findQuickFixes(source: string, options: QuickFixOptions = {}): QuickFix[] {\n return prepareQuickFixes(source, options)(options.line, options.diagnosticCode);\n}\n\n// One immutable buffer version owns the analysis and document verdict. Cursor moves reuse them;\n// single-occurrence verdicts have a bounded cache. Range requests verify the independent recipes\n// together once per version, rather than reparsing N times for N intersecting markers.\nexport function prepareQuickFixes(source: string, options: Pick<QuickFixOptions, 'placement'> = {}): (line?: number | readonly { line: number; diagnosticCode: string }[], diagnosticCode?: string) => QuickFix[] {\n const original = parseForAuthoring(source, undefined, options.placement);\n // PLAY0614 and the public-event boundary errors that follow from a missing direction are errors the repair itself removes,\n // so a document whose only errors are public-event boundary errors stays repairable.\n const publicEventCodes: ReadonlySet<string> = new Set(Array.from({ length: 14 }, (_, index) => `PLAY0${607 + index}`));\n const acceptable = (parsed: ReturnType<typeof parseForAuthoring>): boolean => parsed.success || parsed.diagnostics.every(diagnostic => diagnostic.severity !== 'error' || publicEventCodes.has(diagnostic.code));\n const errorCodes = (parsed: ReturnType<typeof parseForAuthoring>): Set<string> => new Set(parsed.diagnostics.filter(diagnostic => diagnostic.severity === 'error').map(diagnostic => diagnostic.code));\n if (!acceptable(original)) return () => [];\n const lines = splitLines(source);\n const eventsByLine = new Map<number, EventSyntax>();\n const slicesByLine = new Map<number, SliceSyntax>();\n // Index inline and standalone declarations once, without scanning the tree per diagnostic.\n const walker = new class extends ScreenplaySyntaxWalker {\n override visitEvent(event: EventSyntax): void { eventsByLine.set(event.location.line, event); }\n override visitSlice(slice: SliceSyntax): void { slicesByLine.set(slice.location.line, slice); super.visitSlice(slice); }\n }();\n walker.visitApplication(original.value);\n const counts = new Map<string, number>();\n const byLine = new Map<number, QuickFixCandidate>();\n const events = new Map<number, EventSyntax>();\n let event: EventSyntax | undefined;\n for (const line of lines) {\n event = eventsByLine.get(line.number) ?? event;\n if (event !== undefined) events.set(line.number, event);\n }\n for (const diagnostic of original.diagnostics) {\n counts.set(diagnostic.code, (counts.get(diagnostic.code) ?? 0) + 1);\n const line = lines[diagnostic.location.line - 1];\n const length = legacyOptionalTypeLength(line.raw, diagnostic);\n if (length > 0) {\n byLine.set(line.number, { line: line.number, fix: { diagnosticCode: diagnostic.code, title: \"Use 'optional' instead of '?'\", scope: 'occurrence', edits: [{ start: line.startOffset + diagnostic.location.column + length - 2, length: 1, text: ' optional' }] } });\n } else if (diagnostic.code === DiagnosticCodes.LegacyComplianceMarker) {\n const edit = complianceMarkerEdit(line.raw, line.startOffset);\n if (edit !== undefined) byLine.set(line.number, { line: line.number, fix: { diagnosticCode: diagnostic.code, title: 'Use bare pii and secret compliance markers', scope: 'occurrence', edits: [edit] } });\n } else if (diagnostic.code === DiagnosticCodes.PublicTranslationRequiresDirection) {\n // PLAY0614 is only reported on the declaration line of a Translate slice that has no direction.\n const slice = slicesByLine.get(line.number)!;\n // Offer a direction only when exactly one is consistent with the slice: the other would add errors.\n const indent = /^\\s*/.exec(line.raw)![0];\n const ending = source.includes('\\r\\n') ? '\\r\\n' : '\\n';\n const candidates = [TranslationDirection.Inbound, TranslationDirection.Outbound].map(direction => ({ direction, text: `${ending}${indent} direction ${direction === TranslationDirection.Inbound ? 'inbound' : 'outbound'}` }))\n .filter(candidate => {\n // The insertion point is the end of an existing line, so the edit is always in bounds.\n const edited = applyQuickFixEdits(source, [{ start: line.startOffset + line.raw.length, length: 0, text: candidate.text }])!;\n const parsed = parseForAuthoring(edited, undefined, options.placement);\n const originalCodes = errorCodes(original);\n // Valid when the missing-direction error is gone and the direction introduces no kind of error the document lacked.\n return acceptable(parsed) && ![...errorCodes(parsed)].some(code => code === DiagnosticCodes.PublicTranslationRequiresDirection || !originalCodes.has(code));\n });\n if (candidates.length === 1) {\n const [{ direction, text }] = candidates;\n byLine.set(line.number, { line: line.number, fix: { diagnosticCode: diagnostic.code, title: `Declare 'direction ${direction === TranslationDirection.Inbound ? 'inbound' : 'outbound'}'`, scope: 'occurrence', edits: [{ start: line.startOffset + line.raw.length, length: 0, text }] },\n change: { node: slice, replacement: { ...slice, direction } as SliceSyntax } });\n }\n } else if (diagnostic.code === DiagnosticCodes.RedundantEventId && commentStart(line.raw) < 0) {\n const declaration = events.get(line.number);\n if (declaration?.id !== declaration?.name || declaration === undefined) continue;\n byLine.set(line.number, { line: line.number, fix: { diagnosticCode: diagnostic.code, title: 'Remove the redundant event id', scope: 'occurrence', edits: [{ start: line.startOffset, length: (lines[line.number]?.startOffset ?? source.length) - line.startOffset, text: '' }] },\n change: { node: declaration, replacement: { ...declaration, id: null } as EventSyntax } });\n }\n }\n const spellingCodes = [DiagnosticCodes.LegacyOptionalSuffix, DiagnosticCodes.LegacyComplianceMarker];\n const syntax = verificationShape(original);\n const verified = new Map<number, QuickFix | undefined>();\n let rangeVerdicts: Map<number, QuickFix> | undefined;\n const documentChecked = new Set<string>();\n const documentFixes = new Map<string, QuickFix>();\n const verify = (fix: QuickFix, change?: QuickFixCandidate['change']): QuickFix | undefined => {\n const candidate = applyQuickFixEdits(source, fix.edits);\n if (candidate === undefined) return undefined;\n const parsed = parseForAuthoring(candidate, undefined, options.placement);\n if (!acceptable(parsed) || verificationShape(parsed) !== (change === undefined ? syntax : verificationShape(original, [change]))) return undefined;\n return parsed.diagnostics.filter(diagnostic => diagnostic.code === fix.diagnosticCode).length === (counts.get(fix.diagnosticCode) ?? 0) - fix.edits.length ? fix : undefined;\n };\n return (line, diagnosticCode) => {\n const requests = typeof line === 'number' || line === undefined ? undefined : line;\n const selectedCodes = spellingCodes.filter(code => requests === undefined ? diagnosticCode === undefined || diagnosticCode === code : requests.some(request => request.diagnosticCode === code));\n for (const code of selectedCodes.filter(code => !documentChecked.has(code))) {\n const candidates = [...byLine.values()].filter(candidate => candidate.fix.diagnosticCode === code);\n if (candidates.length > 0) {\n const fix = verify({ diagnosticCode: code, title: code === DiagnosticCodes.LegacyOptionalSuffix ? \"Use 'optional' throughout this document\" : 'Use bare pii and secret throughout this document', scope: 'document', edits: candidates.flatMap(candidate => candidate.fix.edits) });\n if (fix !== undefined) documentFixes.set(code, fix);\n }\n documentChecked.add(code);\n }\n const documents = selectedCodes.flatMap(code => documentFixes.has(code) ? [documentFixes.get(code)!] : []);\n if (requests !== undefined) {\n if (rangeVerdicts === undefined) {\n rangeVerdicts = new Map();\n // Source order gives ordered, non-overlapping edits without sorting. Recipes replace\n // distinct nodes/lines; the batch must preserve every other modeled member and remove\n // exactly the expected diagnostics before any of its occurrence edits can be offered.\n const candidates = lines.flatMap(line => byLine.has(line.number) ? [byLine.get(line.number)!] : []);\n const edits = candidates.flatMap(candidate => candidate.fix.edits);\n const candidateSource = applyQuickFixEdits(source, edits);\n if (edits.length > 0 && candidateSource !== undefined) {\n const parsed = parseForAuthoring(candidateSource, undefined, options.placement);\n const changes = candidates.flatMap(candidate => candidate.change === undefined ? [] : [candidate.change]);\n if (acceptable(parsed) && verificationShape(parsed) === verificationShape(original, changes)) {\n const remaining = new Map<string, number>();\n const removed = new Map<string, number>();\n for (const diagnostic of parsed.diagnostics) remaining.set(diagnostic.code, (remaining.get(diagnostic.code) ?? 0) + 1);\n for (const candidate of candidates) removed.set(candidate.fix.diagnosticCode, (removed.get(candidate.fix.diagnosticCode) ?? 0) + candidate.fix.edits.length);\n if ([...removed].every(([code, count]) => (remaining.get(code) ?? 0) === (counts.get(code) ?? 0) - count)) {\n for (const candidate of candidates) rangeVerdicts.set(candidate.line, candidate.fix);\n }\n }\n }\n }\n const selected = new Map<number, QuickFix>();\n for (const request of requests) {\n const fix = rangeVerdicts.get(request.line);\n if (fix?.diagnosticCode === request.diagnosticCode) selected.set(request.line, fix);\n }\n return [...selected.values(), ...documents];\n }\n const occurrenceLine = typeof line === 'number' ? line : undefined;\n const selected = occurrenceLine === undefined ? undefined : byLine.get(occurrenceLine);\n let occurrenceFix: QuickFix | undefined;\n if (selected !== undefined && occurrenceLine !== undefined && (diagnosticCode === undefined || selected.fix.diagnosticCode === diagnosticCode)) {\n if (!verified.has(occurrenceLine)) {\n if (verified.size === 32) verified.delete(verified.keys().next().value!);\n verified.set(occurrenceLine, verify(selected.fix, selected.change));\n }\n occurrenceFix = verified.get(occurrenceLine);\n }\n return [...(occurrenceFix === undefined ? [] : [occurrenceFix]), ...documents];\n };\n}\n\nfunction complianceMarkerEdit(raw: string, startOffset: number): QuickFixEdit | undefined {\n // Restrict rewriting to the suffix or leading directive marker, never comments or quoted reasons.\n const header = pattern('^(\\\\s*concept\\\\s+\\\\w+\\\\s*:\\\\s*\\\\w+)((?:[^\\\\S\\\\r\\\\n]+@?\\\\w+)*)').exec(raw);\n if (header !== null) {\n const suffix = header[2];\n const text = suffix.replace(/@pii\\b|@?sensitive\\b/g, marker => marker === '@pii' ? 'pii' : 'secret');\n return text === suffix ? undefined : { start: startOffset + header[1].length, length: suffix.length, text };\n }\n const directive = pattern('^(\\\\s*)(@pii|@?sensitive)\\\\b').exec(raw);\n return directive === null ? undefined : { start: startOffset + directive[1].length, length: directive[2].length, text: directive[2] === '@pii' ? 'pii' : 'secret' };\n}\n\nfunction verificationShape(parsed: ReturnType<typeof parseForAuthoring>, changes: readonly NonNullable<QuickFixCandidate['change']>[] = []): string {\n // Compare every modeled member (including trigger data), ignoring only source locations. A recipe\n // may replace only its original node; no other id or destination is normalized away.\n const replacements = new Map(changes.map(change => [change.node, change.replacement]));\n return JSON.stringify([parsed.value, parsed.triggerData], (key, value: unknown) => ['location', 'usesLocation', 'targetLocation'].includes(key) ? undefined : replacements.get(value as NonNullable<QuickFixCandidate['change']>['node']) ?? value);\n}\n\n// One forward pass; applying N edits by repeatedly slicing the document would be quadratic.\nexport function applyQuickFixEdits(source: string, edits: readonly QuickFixEdit[]): string | undefined {\n const parts: string[] = [];\n let end = 0;\n for (const edit of edits) {\n if (edit.start < end || edit.start < 0 || edit.length < 0 || edit.start + edit.length > source.length) return undefined;\n parts.push(source.slice(end, edit.start), edit.text);\n end = edit.start + edit.length;\n }\n parts.push(source.slice(end));\n return parts.join('');\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { EventSourceSyntax } from './EventSources';\n\n// Physical source-only read confidence; it never grants editing or executable identity.\nexport class EventSourceReadConfidence {\n private readonly sources = new Map<string, { source: EventSourceSyntax; placementResolved: boolean }[]>();\n\n constructor(sources: readonly { source: EventSourceSyntax; placementResolved: boolean }[], private readonly complete: boolean) {\n for (const entry of sources) this.sources.set(entry.source.name, [...this.sources.get(entry.source.name) ?? [], entry]);\n }\n\n static hasUnknownExtent(diagnostics: readonly Diagnostic[]) {\n return diagnostics.some(diagnostic => diagnostic.severity === 'error' && ['PLAY0001', 'PLAY0503', 'PLAY0164'].includes(diagnostic.code));\n }\n\n resolve(source: string, stream?: string) {\n const parents = this.sources.get(source) ?? [];\n const streams = stream === undefined ? [] : parents.flatMap(parent => parent.source.streams).filter(child => child.name === stream);\n const ambiguous = parents.length > 1 || streams.length > 1;\n const incomplete = !this.complete || parents.some(parent => !parent.placementResolved);\n const state = ambiguous ? 'ambiguous' : incomplete ? 'incomplete' : parents.length === 1 && (stream === undefined || streams.length === 1) ? 'unique' : 'notFound';\n const reasons: string[] = [];\n if (parents.length > 1) reasons.push('Multiple physical parent sources claim the exact name.');\n if (streams.length > 1) reasons.push('Multiple physical streams claim the exact parent and local name.');\n if (parents.some(parent => !parent.placementResolved)) reasons.push('A physical parent has unresolved import placement.');\n if (!this.complete) reasons.push('Physical source extent or placement is incomplete; missing declarations cannot be excluded.');\n return { state, sources: parents.map(parent => parent.source), streams, reasons };\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { CommandSyntax, ValidationRuleSyntax } from './Commands';\nimport { ConceptSyntax } from './Declarations';\nimport { CommandStreamSyntax, EventSourceSyntax, EventStreamSyntax, EventStreamIdPartSyntax } from './EventSources';\nimport { PropertyMappingSyntax } from './Expressions';\nimport { HandlerSyntax, ImplementationSyntax, ImplementationHintSyntax } from './Implementations';\nimport { InvalidSyntaxJson } from './InvalidSyntaxJson';\nimport { publicEventMetadataError } from './PublicEventInvariants';\nimport { OperationPhaseSyntax } from './Operations';\nimport { ProducesSyntax } from './Reactions';\nimport { SyntaxNode } from './SyntaxNode';\nimport { SpecificationEventSyntax, SpecificationStreamSyntax } from './Specifications';\nimport { isBlankImplementationHint } from '../Text/ImplementationHintText';\nimport { isSourceStreamName, isSourceStreamTypeName, sourceStreamPattern } from '../Text/SourceStreamNames';\n\n// .NET \\w is evaluated per UTF-16 code unit, so a supplementary-plane letter is not a name character.\nconst ruleNamePattern = sourceStreamPattern('^[A-Za-z_]\\\\w*$');\n\nconst hasKind = (value: unknown, kind: string): boolean => typeof value === 'object' && value !== null && !Array.isArray(value) && (value as SyntaxNode).kind === kind;\nconst refuse = (message: string): never => { throw new InvalidSyntaxJson(message); };\nconst collection = (value: unknown, kind: string, message: string): void => {\n if (!Array.isArray(value)) return refuse(message);\n // Indexed, so no caller-overridable iteration method or iterator is consulted.\n for (let position = 0; position < value.length; position++) if (!hasKind(value[position], kind)) refuse(message);\n};\n\n// The native ImplementationInvariants / OperationInvariants / EventSourceInvariants contracts.\n// Shared by the isolated strict reader and the writer, without pulling the transport schema into Monaco.\nexport function validateSyntaxInvariants(node: SyntaxNode): void {\n const metadataError = publicEventMetadataError(node);\n if (metadataError !== undefined) refuse(metadataError);\n if (node.kind === 'ConceptSyntax') {\n const concept = node as ConceptSyntax;\n for (const validation of concept.validations ?? []) {\n if (validation.kind === 'DeclarativeValidateSyntax' && validation.rules.some(rule => rule.implementation != null)) refuse('Implementation wrappers on named rules are supported only on commands.');\n }\n }\n if (node.kind === 'ValidationRuleSyntax') {\n const rule = node as ValidationRuleSyntax;\n if (rule.implementation != null) {\n if (!hasKind(rule.implementation, 'ImplementationSyntax')) refuse('A named rule requires an ImplementationSyntax wrapper.');\n if (rule.rule !== 'Rule' || rule.value?.kind !== 'PathExpressionSyntax' || !hasKind(rule.value, 'PathExpressionSyntax') || typeof rule.value.path !== 'string' || ruleNamePattern.exec(rule.value.path)?.[0] !== rule.value.path) refuse('An implementation wrapper requires a valid named rule.');\n if (rule.file != null && rule.code != null) refuse('A named rule has at most one file or inline payload.');\n // Native typed transport enforces these payload members in both numeric modes.\n if (rule.file != null && (!hasKind(rule.file, 'FileReferenceSyntax') || typeof rule.file.path !== 'string')) refuse('A named rule file requires a FileReferenceSyntax payload with a string path.');\n if (rule.code != null && (!hasKind(rule.code, 'CodeBlockSyntax') || typeof rule.code.language !== 'string' || typeof rule.code.code !== 'string')) refuse('A named rule inline payload requires a CodeBlockSyntax with string language and code.');\n validateSyntaxInvariants(rule.implementation);\n }\n }\n if (node.kind === 'ProducesSyntax') {\n const production = node as ProducesSyntax;\n const operation = production.inlineOperation;\n if (operation != null) {\n if (production.inlineEvent != null) refuse('A production cannot declare both an event and an operation.');\n if (production.when != null || production.event !== operation.name || production.for != null || (production.tags ?? []).length > 0) refuse('An inline operation requires a matching unconditional target without event metadata.');\n collection(operation.inputs, 'PropertySyntax', 'Operation inputs must be a collection of properties.');\n collection(production.mappings, 'PropertyMappingSyntax', 'Production mappings must be a collection of mappings.');\n if (operation.inputs.length !== production.mappings.length) refuse('Inline operation inputs and mappings must correspond in order.');\n for (let position = 0; position < operation.inputs.length; position++) if (operation.inputs[position].name !== production.mappings[position].property) refuse('Inline operation inputs and mappings must correspond in order.');\n }\n }\n if (node.kind === 'OperationPhaseSyntax') {\n const phase = node as OperationPhaseSyntax;\n if (phase.file != null && phase.code != null) refuse('An operation phase has at most one file or inline payload.');\n if (phase.implementation != null) validateSyntaxInvariants(phase.implementation);\n }\n if (node.kind === 'HandlerSyntax') {\n const handler = node as HandlerSyntax;\n // Native transport keeps old unwrapped structural handlers; only the new wrapper is admitted here.\n if (handler.implementation != null && handler.file != null && handler.code != null) refuse('A handler has at most one file or inline payload.');\n }\n if (node.kind === 'ImplementationSyntax') {\n const implementation = node as ImplementationSyntax;\n collection(implementation.hints, 'ImplementationHintSyntax', 'Implementation hints must be a collection of nonblank hints.');\n for (let position = 0; position < implementation.hints.length; position++) validateSyntaxInvariants(implementation.hints[position]);\n }\n if (node.kind === 'ImplementationHintSyntax') {\n const hint = node as ImplementationHintSyntax;\n if (typeof hint.text !== 'string' || isBlankImplementationHint(hint.text)) refuse('An implementation hint must be nonblank.');\n }\n validateSourceStream(node);\n}\n\nfunction validateSourceStream(node: SyntaxNode): void {\n const name = (value: string): void => { if (!isSourceStreamName(value)) refuse('Event source and stream names must be identifiers.'); };\n const mappings = (scalar: PropertyMappingSyntax | null, parts: PropertyMappingSyntax[]): void => {\n collection(parts, 'PropertyMappingSyntax', 'Stream id part mappings must be a collection.');\n if (scalar !== null && parts.length > 0) refuse('A route cannot map both scalar and composite stream ids.');\n parts.forEach(part => name(part.property));\n };\n if (node.kind === 'ApplicationSyntax') {\n const sources = (node as unknown as { eventSources?: unknown }).eventSources;\n if (sources !== undefined) collection(sources, 'EventSourceSyntax', 'Event sources must be a collection of event source nodes without null elements.');\n }\n if (node.kind === 'EventSourceSyntax' || node.kind === 'EventStreamSyntax') {\n const declaration = node as EventSourceSyntax | EventStreamSyntax;\n name(declaration.name);\n if (declaration.id !== null && (typeof declaration.id !== 'string' || declaration.id.trim() === '')) refuse('A rename pin must be nonempty.');\n const type = declaration.kind === 'EventSourceSyntax' ? declaration.identifier : declaration.streamId;\n if (type !== null && !hasKind(type, 'TypeRefSyntax')) refuse('Source identifiers and stream ids require type reference nodes.');\n if (type !== null && (type.isCollection || type.isOptional)) refuse('Source identifiers and stream ids require nonoptional scalar type references.');\n if (type !== null && !isSourceStreamTypeName(type.name)) refuse('Source identifiers and stream ids require an exact type reference name.');\n if (declaration.kind === 'EventSourceSyntax') collection(declaration.streams, 'EventStreamSyntax', 'Event streams must contain event stream nodes without null elements.');\n else {\n collection(declaration.streamIdParts, 'EventStreamIdPartSyntax', 'Stream id parts must be a collection.');\n if (declaration.streamId !== null && declaration.streamIdParts.length > 0) refuse('A stream cannot declare both scalar and composite stream ids.');\n declaration.streamIdParts.forEach(part => validateSourceStream(part));\n }\n }\n if (node.kind === 'EventStreamIdPartSyntax') {\n const part = node as EventStreamIdPartSyntax;\n name(part.name);\n if (!hasKind(part.type, 'TypeRefSyntax')) refuse('A stream id part requires a type.');\n if (part.type.isOptional || part.type.isCollection) refuse('Source identifiers and stream ids require nonoptional scalar type references.');\n if (!isSourceStreamTypeName(part.type.name)) refuse('Source identifiers and stream ids require an exact type reference name.');\n }\n if (node.kind === 'CommandSyntax') {\n const command = node as CommandSyntax;\n if (command.stream?.propertyCandidate != null) refuse('The authoritative command stream cannot contain an ambiguous property candidate.');\n if (command.stream != null && !hasKind(command.stream, 'CommandStreamSyntax')) refuse('The authoritative command stream must be a command stream node.');\n if (command.streamCandidates !== undefined) collection(command.streamCandidates, 'CommandStreamSyntax', 'Command stream candidates must be a collection without null elements.');\n const candidates = command.streamCandidates ?? [];\n for (let position = 0; position < candidates.length; position++) {\n const rejected = candidates[position];\n validateSourceStream(rejected);\n if (rejected.propertyCandidate === null && command.stream == null) refuse('A duplicate route candidate requires an authoritative route.');\n if (rejected.propertyCandidate !== null) for (let index = 0; index < command.properties.length; index++) if (command.properties[index] === rejected.propertyCandidate) refuse('An ambiguous property is owned only by its stream candidate.');\n }\n }\n if (node.kind === 'SpecificationEventSyntax' || node.kind === 'SpecificationExampleSyntax' || node.kind === 'SpecificationRedeliverySyntax') {\n const occurrence = node as SpecificationEventSyntax;\n if (occurrence.stream != null && occurrence.noStream != null) refuse('An event occurrence cannot declare both stream and no stream.');\n if (occurrence.stream != null && !hasKind(occurrence.stream, 'SpecificationStreamSyntax')) refuse('A specification stream requires a specification stream node.');\n if (occurrence.noStream != null && !hasKind(occurrence.noStream, 'SpecificationNoStreamSyntax')) refuse('An unrouted expectation requires a specification no stream node.');\n }\n if (node.kind === 'SpecificationStreamSyntax') {\n const route = node as SpecificationStreamSyntax;\n name(route.eventSource);\n name(route.stream);\n if (route.streamId !== null && route.streamId.property !== 'streamId') refuse('A specification stream maps only streamId.');\n mappings(route.streamId, route.streamIdParts);\n }\n if (node.kind === 'CommandStreamSyntax') {\n const route = node as CommandStreamSyntax;\n name(route.eventSource);\n name(route.stream);\n if (route.streamId !== null && route.streamId.property !== 'streamId') refuse('A command stream maps only streamId.');\n mappings(route.streamId, route.streamIdParts);\n const candidate = route.propertyCandidate;\n if (candidate !== null && (candidate.name !== 'stream' || candidate.type.name !== `${route.eventSource}.${route.stream}` || candidate.type.isCollection || candidate.type.isOptional || candidate.isGenerated || candidate.isIdentifier || route.streamId !== null || route.streamIdParts.length > 0)) refuse('An ambiguous route must retain its exact unmodified property candidate, without selecting nested routing.');\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// Generated from C# SyntaxSchema; all typed member contracts are native-owned.\nexport const syntaxCollections = {\"kinds\":[\"AddMappingSyntax\",\"AllSyntax\",\"ApplicationSyntax\",\"ApplicationTriggerInteractionTriggerSyntax\",\"ArrangementContainerSyntax\",\"ArrangementOverrideSyntax\",\"ArrangementSlotSyntax\",\"ArrangementSyntax\",\"AuthenticatedConditionSyntax\",\"AuthenticationProviderSyntax\",\"AuthenticationSyntax\",\"AuthorizeSyntax\",\"BehaviorArgumentSyntax\",\"BehaviorParameterSyntax\",\"BehaviorSyntax\",\"BuiltInInteractionTriggerSyntax\",\"CaptureAppendSyntax\",\"CaptureChildrenSyntax\",\"CaptureMapEntrySyntax\",\"CaptureNestedSyntax\",\"CaptureSourceSettingSyntax\",\"CaptureSourceSyntax\",\"CaptureSplitSyntax\",\"CaptureSyntax\",\"CaptureTranslationSyntax\",\"CaptureWhenSyntax\",\"CausedByExpressionSyntax\",\"CaseValueExpressionSyntax\",\"ChildrenSyntax\",\"ClaimConditionSyntax\",\"ClaimIdentitySourceSyntax\",\"CodeIdentitySourceSyntax\",\"FileIdentitySourceSyntax\",\"IdentitySyntax\",\"IdentityDetailSyntax\",\"QueryIdentitySourceSyntax\",\"ClearMappingSyntax\",\"ClearWithSyntax\",\"CloseDialogActionSyntax\",\"CodeBlockSyntax\",\"ComponentExposedValueSyntax\",\"ComponentOutletSyntax\",\"ComponentPropertySyntax\",\"CodeValidateSyntax\",\"CommandSyntax\",\"CommandStreamSyntax\",\"ComparisonConditionSyntax\",\"CompositeKeySyntax\",\"ConceptAttributeSyntax\",\"ConceptSyntax\",\"ConcurrencySyntax\",\"ConfirmActionSyntax\",\"ContextExpressionSyntax\",\"IdentityExpressionSyntax\",\"ContributionSyntax\",\"CountMappingSyntax\",\"DeclarativeValidateSyntax\",\"DecrementMappingSyntax\",\"DialogTemplateSyntax\",\"DomainSyntax\",\"EnvironmentExpressionSyntax\",\"EventContextExpressionSyntax\",\"EventInteractionTriggerSyntax\",\"EventSourceIdExpressionSyntax\",\"EventSourceSyntax\",\"EventStreamIdPartSyntax\",\"EventStreamSyntax\",\"EventSpecSyntax\",\"EventSyntax\",\"EverySyntax\",\"ExecuteCommandActionSyntax\",\"ExpressionKeySyntax\",\"FeatureSyntax\",\"FileConstraintSyntax\",\"FileImportSyntax\",\"FileReferenceSyntax\",\"FormColumnSyntax\",\"ExposureSyntax\",\"ExposedPropertySyntax\",\"InstanceContributionsSyntax\",\"InstanceContributionSyntax\",\"ContributedItemSyntax\",\"ContributedItemValueSyntax\",\"ScreenContributionSyntax\",\"TemplateSlotContentSyntax\",\"CommandFormLayoutSyntax\",\"FormLayoutColumnSyntax\",\"FormFieldPlacementSyntax\",\"FormWidthSyntax\",\"FormFieldSyntax\",\"FormPopulateFromItemSyntax\",\"FormPopulateViaQuerySyntax\",\"FormSyntax\",\"FromSyntax\",\"HandlerSyntax\",\"ImplementationSyntax\",\"ImplementationHintSyntax\",\"SystemSyntax\",\"OperationSyntax\",\"OperationPhaseSyntax\",\"SpecificationExampleSyntax\",\"SpecificationParameterSyntax\",\"SpecificationCaseSyntax\",\"SpecificationOperationFailureSyntax\",\"SpecificationOperationSyntax\",\"SpecificationCompensatedSyntax\",\"ImportSyntax\",\"IncrementMappingSyntax\",\"InteractionAlternativeSyntax\",\"InteractionOtherwiseSyntax\",\"InteractionArgumentSyntax\",\"InteractionBindingSyntax\",\"IntervalInteractionTriggerSyntax\",\"IntervalTriggerSourceSyntax\",\"InvokesSyntax\",\"InvocationRefusalSyntax\",\"JoinEventSyntax\",\"JoinSyntax\",\"KeyPartSyntax\",\"LayoutSyntax\",\"ListExpressionSyntax\",\"LiteralExpressionSyntax\",\"LogicalConditionSyntax\",\"LogicalPolicyConditionSyntax\",\"LogicalPolicyRequirementSyntax\",\"ModuleSyntax\",\"NamedTriggerSourceSyntax\",\"NavigateActionSyntax\",\"NavigateBackActionSyntax\",\"NestedSyntax\",\"NotPolicyConditionSyntax\",\"NotifyActionSyntax\",\"OpenDialogActionSyntax\",\"ObjectExpressionSyntax\",\"ObjectMemberSyntax\",\"PathExpressionSyntax\",\"PerformerSyntax\",\"PersonaSyntax\",\"PlaceSyntax\",\"PolicyReferenceSyntax\",\"PolicySyntax\",\"PurposeSyntax\",\"PurposeReferenceSyntax\",\"PurposeTransferSyntax\",\"ProducesSyntax\",\"ProjectionEntersOnSyntax\",\"ProjectionSyntax\",\"ProjectionVariantSyntax\",\"PresentationValueSyntax\",\"PropertyMappingSyntax\",\"PropertySyntax\",\"PropertyResponseSourceSyntax\",\"ResponseFieldSyntax\",\"ScalarCommandResponseSyntax\",\"RecordCommandResponseSyntax\",\"ScalarSpecificationReturnSyntax\",\"RecordSpecificationReturnSyntax\",\"QueryParameterSyntax\",\"QuerySyntax\",\"RaiseTriggerActionSyntax\",\"RawExpressionSyntax\",\"ReactionSyntax\",\"ReactionTriggerSyntax\",\"RefusalExpressionSyntax\",\"ReadModelSyntax\",\"ReadsSyntax\",\"ReducerRuleSyntax\",\"ReducerSyntax\",\"RefreshQueryActionSyntax\",\"RemoveViaJoinSyntax\",\"RemoveWithSyntax\",\"RequirementSyntax\",\"RoleConditionSyntax\",\"ScheduleTriggerSourceSyntax\",\"ScreenActionSyntax\",\"ScreenNavigationParameterSyntax\",\"ScreenGuardedActionSyntax\",\"ScreenActionAlternativeSyntax\",\"ScreenActionOtherwiseSyntax\",\"ScreenBehaviorSyntax\",\"ScreenCodeSyntax\",\"ScreenComponentSyntax\",\"ScreenColumnSyntax\",\"ScreenDataSyntax\",\"ScreenFieldSyntax\",\"ScreenNavigateSyntax\",\"ScreenSectionSyntax\",\"ScreenSlotSyntax\",\"ScreenSummarySyntax\",\"ScreenSyntax\",\"ScreenTableSyntax\",\"ScreenTemplateReferenceSyntax\",\"ScreenTemplateSyntax\",\"ScreenTitleSyntax\",\"ScreenToolbarSyntax\",\"ScreenUsesBehaviorSyntax\",\"SeedEventSyntax\",\"SeedGroupSyntax\",\"SeedSyntax\",\"SetMappingSyntax\",\"TemplateAssignmentSyntax\",\"TemplateExposedValueSyntax\",\"TemplateOutletSyntax\",\"SetStateActionSyntax\",\"SliceSyntax\",\"SlotSyntax\",\"SourceItemExpressionSyntax\",\"SpecificationAbsentReadModelSyntax\",\"SpecificationCallerClaimSyntax\",\"SpecificationCallerPersonaSyntax\",\"SpecificationCallerSyntax\",\"SpecificationCaptureSyntax\",\"SpecificationClockSyntax\",\"SpecificationCommandSyntax\",\"SpecificationDeniedSyntax\",\"SpecificationErrorSyntax\",\"SpecificationEventSyntax\",\"SpecificationNoResultSyntax\",\"SpecificationStreamSyntax\",\"SpecificationNoStreamSyntax\",\"SpecificationQueryResultSyntax\",\"SpecificationQuerySyntax\",\"SpecificationReadModelSyntax\",\"SpecificationRedeliverySyntax\",\"SpecificationSyntax\",\"SpecificationTriggerSyntax\",\"SpecificationWhenQuerySyntax\",\"StringsExpressionSyntax\",\"SubtractMappingSyntax\",\"TagSyntax\",\"ToolbarItemSyntax\",\"TemplateExpressionSyntax\",\"TemplateInterpolationSyntax\",\"TemplateTextSyntax\",\"ThemeSyntax\",\"TriggerDataSyntax\",\"TriggerSyntax\",\"TypeRefSyntax\",\"TypeSyntax\",\"UiBindingSyntax\",\"UiProfileSyntax\",\"UniqueEventConstraintSyntax\",\"UniquePropertyConstraintSyntax\",\"DependsOnSyntax\",\"UsesBehaviorSyntax\",\"ValidationRuleSyntax\",\"VariantSyntax\"],\"names\":[\"property\",\"value\",\"autoMap\",\"mappings\",\"authentication\",\"behaviors\",\"concepts\",\"domain\",\"eventSources\",\"examples\",\"exposures\",\"fileImports\",\"identity\",\"imports\",\"instanceContributions\",\"layouts\",\"modules\",\"personas\",\"policies\",\"purposes\",\"seeds\",\"sourceOptions\",\"numericMode\",\"systems\",\"templates\",\"themes\",\"triggers\",\"types\",\"uiProfiles\",\"triggerName\",\"children\",\"columns\",\"gap\",\"grow\",\"rows\",\"span\",\"syntaxKind\",\"height\",\"root\",\"width\",\"growFactor\",\"name\",\"mode\",\"overrides\",\"variants\",\"alias\",\"providers\",\"requirement\",\"type\",\"bindings\",\"description\",\"file\",\"order\",\"parameters\",\"event\",\"tags\",\"when\",\"appends\",\"identifiedBy\",\"map\",\"source\",\"translations\",\"settings\",\"separator\",\"targets\",\"key\",\"nested\",\"from\",\"to\",\"expression\",\"fromValue\",\"properties\",\"toValue\",\"parameter\",\"blocks\",\"claim\",\"matches\",\"matchesSubject\",\"code\",\"details\",\"by\",\"query\",\"arguments\",\"onFailure\",\"onResult\",\"onSuccess\",\"language\",\"binding\",\"directives\",\"authorize\",\"concurrency\",\"documentation\",\"handler\",\"produces\",\"reads\",\"response\",\"stream\",\"streamCandidates\",\"validations\",\"eventSource\",\"propertyCandidate\",\"streamId\",\"streamIdParts\",\"left\",\"operator\",\"right\",\"parts\",\"criminal\",\"reason\",\"scope\",\"specialCategory\",\"attributes\",\"values\",\"eventSourceType\",\"eventStreamId\",\"eventStreamType\",\"eventTypes\",\"message\",\"messageIsLiteral\",\"path\",\"contributionPoint\",\"label\",\"navigate\",\"requirements\",\"rules\",\"arrangement\",\"category\",\"content\",\"displayName\",\"exposes\",\"outlets\",\"restrictsScopes\",\"scopes\",\"slots\",\"templateType\",\"usedBehaviors\",\"eventName\",\"id\",\"identifier\",\"streams\",\"generation\",\"hasGenerationMarker\",\"origin\",\"visibility\",\"includeChildren\",\"command\",\"contributions\",\"dependsOn\",\"features\",\"isPlacement\",\"slices\",\"additionalRules\",\"ignoreCasing\",\"releasedBy\",\"pattern\",\"owner\",\"component\",\"editableFields\",\"isCollection\",\"operations\",\"reExposes\",\"restrictsFields\",\"instance\",\"items\",\"field\",\"slot\",\"columnGap\",\"placements\",\"rowGap\",\"index\",\"maxWidth\",\"minWidth\",\"column\",\"columnSpan\",\"row\",\"rowSpan\",\"unit\",\"composeUsing\",\"columnMode\",\"fields\",\"for\",\"generationMode\",\"layout\",\"onSubmit\",\"populate\",\"events\",\"parentKey\",\"implementation\",\"hints\",\"text\",\"compensate\",\"execute\",\"inputs\",\"uses\",\"generatedValues\",\"noStream\",\"operation\",\"qualifiedName\",\"actions\",\"condition\",\"alternatives\",\"otherwise\",\"trigger\",\"amount\",\"onRefused\",\"acknowledge\",\"constraint\",\"selector\",\"on\",\"literalType\",\"dialogTemplates\",\"forms\",\"screenTemplates\",\"screen\",\"operand\",\"level\",\"dialogTemplate\",\"members\",\"hidden\",\"sizeHeight\",\"sizeWidth\",\"slotName\",\"x\",\"y\",\"authorization\",\"basis\",\"basisReference\",\"conditionReference\",\"erasureException\",\"interest\",\"recipients\",\"retention\",\"subjects\",\"transfers\",\"destination\",\"safeguard\",\"inlineEvent\",\"inlineOperation\",\"readModel\",\"sequence\",\"entersOn\",\"isGenerated\",\"isIdentifier\",\"isSubject\",\"filters\",\"isObservable\",\"performer\",\"returnType\",\"where\",\"data\",\"invokes\",\"member\",\"severity\",\"role\",\"dayOfMonth\",\"dayOfWeek\",\"time\",\"outcome\",\"behavior\",\"context\",\"icon\",\"presentation\",\"stableId\",\"outlet\",\"route\",\"target\",\"rowClick\",\"fitsSlot\",\"eventSourceId\",\"groups\",\"captures\",\"commands\",\"constraints\",\"direction\",\"projections\",\"queries\",\"reactions\",\"readModels\",\"reducers\",\"screens\",\"specifications\",\"contributes\",\"authenticated\",\"claims\",\"roles\",\"capture\",\"record\",\"instant\",\"commandType\",\"inlineProperty\",\"caseValue\",\"eventType\",\"exactly\",\"results\",\"reaction\",\"cases\",\"given\",\"givenCaller\",\"givenCallerPersona\",\"givenCaptures\",\"givenClock\",\"givenOperationFailures\",\"givenReadModels\",\"thenAbsentReadModels\",\"thenCompensated\",\"thenDenied\",\"thenErrors\",\"thenEvents\",\"thenEventsInAnyOrder\",\"thenNoEvents\",\"thenNoResult\",\"thenOperations\",\"thenQueries\",\"thenReadModels\",\"thenResults\",\"thenReturns\",\"whenAppended\",\"whenCapture\",\"whenClock\",\"whenQuery\",\"whenRedelivered\",\"whenTrigger\",\"compatibleWith\",\"isOptional\",\"bindingKind\",\"componentId\",\"componentPropertyPath\",\"expectedValueType\",\"literal\",\"nullBehavior\",\"rawText\",\"defaultSizeClass\",\"icons\",\"packages\",\"platforms\",\"theme\",\"additionalProperties\",\"rule\",\"places\"],\"rules\":[[\"string\"],[\"ref\",26,27,52,53,60,61,63,120,121,133,135,160,163,206,227,231],[\"object\",[[0,0,true],[1,1,true]]],[\"enum\",\"Inherit\",\"Disabled\",\"Enabled\"],[\"ref\",0,36,55,57,107,199,228],[\"array\",4],[\"object\",[[2,3,true],[3,5,false]]],[\"ref\",10],[\"null\"],[\"union\",7,8],[\"ref\",14],[\"array\",10],[\"ref\",49],[\"array\",12],[\"ref\",59],[\"union\",14,8],[\"ref\",64],[\"array\",16],[\"ref\",100],[\"array\",18],[\"ref\",77],[\"array\",20],[\"ref\",74],[\"array\",22],[\"ref\",33],[\"union\",24,8],[\"ref\",106],[\"array\",26],[\"ref\",79],[\"array\",28],[\"ref\",119],[\"array\",30],[\"union\",31,8],[\"ref\",125],[\"array\",33],[\"ref\",137],[\"array\",35],[\"union\",36,8],[\"ref\",140],[\"array\",38],[\"ref\",141],[\"array\",40],[\"ref\",198],[\"array\",42],[\"union\",43,8],[\"enum\",\"legacy\",\"exact\"],[\"object\",[[22,45,true]]],[\"ref\",97],[\"array\",47],[\"ref\",200],[\"array\",49],[\"ref\",234],[\"array\",51],[\"union\",52,8],[\"ref\",236],[\"array\",54],[\"union\",55,8],[\"ref\",238],[\"array\",57],[\"union\",58,8],[\"ref\",240],[\"array\",60],[\"union\",61,8],[\"object\",[[4,9,false],[5,11,false],[6,13,false],[7,15,false],[8,17,false],[9,19,false],[10,21,false],[11,23,false],[12,25,false],[13,27,false],[14,29,false],[15,32,false],[16,34,false],[17,37,false],[18,39,false],[19,41,false],[20,44,false],[21,46,false],[23,48,false],[24,50,false],[25,53,false],[26,56,false],[27,59,false],[28,62,false]]],[\"object\",[[29,0,true]]],[\"ref\",4,6],[\"array\",65],[\"integer\",-2147483648,2147483647],[\"union\",67,8],[\"number\"],[\"union\",69,8],[\"enum\",\"Flat\",\"Row\",\"Column\",\"Grid\"],[\"object\",[[30,66,false],[31,68,false],[32,68,false],[33,70,false],[34,68,false],[35,68,false],[36,71,true]]],[\"union\",0,8],[\"object\",[[37,73,false],[38,65,true],[39,73,false]]],[\"boolean\"],[\"object\",[[33,75,false],[40,70,false],[37,68,false],[41,0,true],[35,68,false],[39,68,false]]],[\"enum\",\"Flow\",\"Freeform\"],[\"ref\",5],[\"array\",78],[\"union\",79,8],[\"union\",65,8],[\"ref\",246],[\"array\",82],[\"union\",83,8],[\"object\",[[42,77,true],[43,80,false],[38,81,false],[44,84,false]]],[\"object\",[]],[\"object\",[[45,73,false],[41,0,true]]],[\"ref\",9],[\"array\",88],[\"object\",[[46,89,false]]],[\"ref\",124,139],[\"object\",[[47,91,true]]],[\"object\",[[41,0,true],[1,0,true]]],[\"ref\",237],[\"union\",94,8],[\"object\",[[41,0,true],[48,95,false]]],[\"ref\",111],[\"array\",97],[\"ref\",75],[\"union\",99,8],[\"ref\",13],[\"array\",101],[\"object\",[[49,98,false],[50,73,false],[51,100,false],[41,73,false],[52,68,false],[53,102,false]]],[\"enum\",\"Click\",\"DoubleClick\",\"Select\",\"Submit\",\"Change\",\"Load\",\"Unload\",\"Enter\",\"Leave\",\"Unknown\"],[\"object\",[[36,104,true]]],[\"ref\",149],[\"array\",106],[\"ref\",229],[\"array\",108],[\"union\",109,8],[\"ref\",25],[\"union\",111,8],[\"object\",[[54,0,true],[3,107,false],[55,110,false],[56,112,false]]],[\"ref\",16],[\"array\",114],[\"ref\",18,22],[\"array\",116],[\"object\",[[57,115,false],[58,0,true],[59,117,false],[0,0,true]]],[\"ref\",24],[\"array\",119],[\"object\",[[0,0,true],[60,1,true],[61,120,false]]],[\"object\",[[57,115,false],[59,117,false],[0,0,true]]],[\"ref\",20],[\"array\",123],[\"object\",[[62,124,false],[36,0,true]]],[\"array\",0],[\"object\",[[63,0,true],[60,1,true],[64,126,false]]],[\"ref\",17],[\"array\",128],[\"ref\",19],[\"array\",130],[\"ref\",21],[\"union\",132,8],[\"object\",[[57,115,false],[30,129,false],[65,73,false],[59,117,false],[41,0,true],[66,131,false],[60,133,false],[21,46,false]]],[\"object\",[[67,0,true],[68,0,true]]],[\"enum\",\"PropertyChanged\",\"Added\",\"Removed\",\"Changed\",\"LogicalOr\",\"LogicalAnd\",\"ValueTransition\",\"Expression\"],[\"object\",[[69,73,false],[70,73,false],[71,126,false],[36,136,true],[72,73,false]]],[\"object\",[[0,73,false]]],[\"object\",[[73,0,true]]],[\"ref\",1,28,37,69,93,117,129,147,169,170],[\"array\",140],[\"object\",[[2,3,true],[74,141,false],[58,1,true],[0,0,true]]],[\"union\",1,8],[\"object\",[[75,0,true],[76,143,false],[77,75,true]]],[\"object\",[[75,0,true]]],[\"ref\",39],[\"object\",[[78,146,true]]],[\"object\",[[51,99,true]]],[\"ref\",34],[\"array\",149],[\"object\",[[50,73,false],[79,150,false]]],[\"ref\",30,31,32,35],[\"object\",[[41,0,true],[60,152,true],[48,94,true]]],[\"object\",[[80,1,true],[81,0,true]]],[\"object\",[[0,0,true]]],[\"object\",[[54,0,true]]],[\"ref\",110],[\"array\",157],[\"ref\",38,51,70,127,128,131,132,159,168,203],[\"array\",159],[\"object\",[[82,158,false],[83,160,false],[84,160,false],[85,160,false]]],[\"object\",[[78,0,true],[86,0,true]]],[\"ref\",239],[\"object\",[[87,163,true],[41,0,true]]],[\"ref\",174,176,179,180,181,183,185,186,187,188,190,191,193,194,195],[\"array\",165],[\"object\",[[88,166,false],[41,0,true]]],[\"union\",163,8],[\"object\",[[87,168,false],[0,0,true],[1,143,false]]],[\"ref\",11],[\"union\",170,8],[\"ref\",50],[\"union\",172,8],[\"ref\",94],[\"union\",174,8],[\"ref\",144],[\"array\",176],[\"ref\",150],[\"array\",178],[\"ref\",165],[\"array\",180],[\"union\",181,8],[\"ref\",153,154],[\"union\",183,8],[\"ref\",45],[\"union\",185,8],[\"array\",185],[\"ref\",43,56],[\"array\",188],[\"object\",[[89,171,false],[90,173,false],[50,73,false],[91,73,false],[92,175,false],[41,0,true],[93,177,false],[71,179,false],[94,182,false],[95,184,false],[96,186,false],[97,187,false],[98,189,false]]],[\"union\",178,8],[\"union\",106,8],[\"object\",[[99,0,true],[100,191,false],[96,0,true],[101,192,false],[102,107,false]]],[\"enum\",\"Equal\",\"NotEqual\",\"GreaterThan\",\"GreaterThanOrEqual\",\"LessThan\",\"LessThanOrEqual\",\"Contains\",\"StartsWith\"],[\"object\",[[103,0,true],[104,194,true],[105,1,true]]],[\"ref\",118],[\"array\",196],[\"object\",[[106,197,false],[48,0,true]]],[\"object\",[[107,75,false],[41,0,true],[108,73,false],[109,73,false],[110,73,false]]],[\"ref\",48],[\"array\",200],[\"union\",189,8],[\"object\",[[111,201,false],[50,73,false],[51,100,false],[41,0,true],[48,0,true],[98,202,false],[112,126,false]]],[\"object\",[[99,75,true],[113,73,false],[114,73,false],[115,73,false],[116,126,false]]],[\"object\",[[82,158,false],[117,0,true],[118,75,true],[83,160,false],[84,160,false],[85,160,false]]],[\"object\",[[119,0,true]]],[\"ref\",185],[\"union\",207,8],[\"object\",[[120,0,true],[121,73,false],[122,208,false],[52,68,false]]],[\"ref\",171],[\"array\",210],[\"union\",211,8],[\"ref\",245],[\"array\",213],[\"object\",[[123,212,false],[124,214,false]]],[\"ref\",7],[\"union\",216,8],[\"ref\",84],[\"array\",218],[\"ref\",201],[\"array\",220],[\"ref\",202],[\"array\",222],[\"ref\",205],[\"array\",224],[\"ref\",244],[\"array\",226],[\"object\",[[125,217,false],[5,11,false],[126,73,false],[127,219,false],[50,73,false],[128,73,false],[129,221,false],[41,0,true],[130,223,false],[131,75,false],[132,126,false],[133,225,false],[134,73,false],[135,227,false]]],[\"object\",[[41,0,true]]],[\"object\",[[136,0,true]]],[\"ref\",66],[\"array\",231],[\"object\",[[50,73,false],[137,73,false],[138,95,false],[41,0,true],[139,232,false]]],[\"object\",[[41,0,true],[48,94,true]]],[\"ref\",65],[\"array\",235],[\"object\",[[50,73,false],[137,73,false],[41,0,true],[101,95,false],[102,236,false]]],[\"object\",[[54,0,true],[65,143,false]]],[\"integer\",0,4294967295],[\"enum\",\"Private\",\"Public\"],[\"object\",[[50,73,false],[91,73,false],[51,100,false],[140,239,false],[141,75,false],[137,73,false],[41,0,true],[142,73,false],[71,179,false],[55,110,false],[143,240,false]]],[\"object\",[[2,3,true],[144,75,true],[3,5,false]]],[\"object\",[[82,158,false],[145,0,true],[83,160,false],[84,160,false],[85,160,false]]],[\"object\",[[69,1,true]]],[\"ref\",54],[\"array\",245],[\"union\",246,8],[\"ref\",243],[\"array\",248],[\"ref\",72],[\"array\",250],[\"ref\",142],[\"array\",252],[\"ref\",204],[\"array\",254],[\"object\",[[89,171,false],[5,11,false],[146,247,false],[147,249,false],[50,73,false],[91,73,false],[9,19,false],[148,251,false],[11,23,false],[149,75,true],[41,0,true],[19,253,false],[150,255,false],[24,50,false],[135,227,false]]],[\"ref\",73,241,242],[\"array\",257],[\"object\",[[151,258,false],[50,73,false],[51,99,true],[152,75,true],[117,73,false],[41,0,true],[153,126,false]]],[\"object\",[[154,0,true]]],[\"object\",[[121,73,false],[0,0,true]]],[\"ref\",78],[\"array\",262],[\"object\",[[155,0,true],[71,263,false]]],[\"object\",[[156,0,true],[157,126,false],[158,75,true],[121,73,false],[159,126,false],[119,0,true],[160,73,false],[161,75,true]]],[\"ref\",80],[\"array\",266],[\"object\",[[146,267,false],[162,0,true]]],[\"ref\",81],[\"array\",269],[\"object\",[[156,0,true],[163,270,false],[119,0,true],[1,143,false]]],[\"ref\",82],[\"array\",272],[\"object\",[[137,0,true],[112,273,false]]],[\"object\",[[164,0,true],[1,1,true]]],[\"object\",[[120,0,true],[88,166,false],[52,68,false]]],[\"object\",[[88,166,false],[165,0,true]]],[\"ref\",88],[\"union\",278,8],[\"ref\",86],[\"array\",280],[\"ref\",87],[\"array\",282],[\"object\",[[166,279,false],[31,281,false],[167,283,false],[168,279,false]]],[\"object\",[[169,67,true],[170,279,false],[171,279,false],[39,279,false]]],[\"object\",[[172,67,true],[173,68,false],[164,0,true],[174,67,true],[175,68,false],[39,279,false]]],[\"enum\",\"Fraction\",\"Pixels\",\"Percent\",\"Auto\"],[\"object\",[[176,287,true],[1,70,false]]],[\"object\",[[177,73,false],[67,73,false],[121,73,false],[0,0,true]]],[\"object\",[[80,73,false],[81,0,true]]],[\"enum\",\"Unspecified\",\"Auto\",\"Manual\"],[\"ref\",76],[\"array\",292],[\"ref\",89],[\"array\",294],[\"ref\",85],[\"union\",296,8],[\"ref\",90,91],[\"union\",298,8],[\"object\",[[5,11,false],[178,291,true],[31,293,false],[50,73,false],[179,295,false],[180,0,true],[181,291,true],[182,297,false],[41,0,true],[183,208,false],[184,299,false],[135,227,false]]],[\"ref\",67],[\"array\",301],[\"ref\",47,71],[\"union\",303,8],[\"object\",[[185,302,false],[65,304,false],[3,5,false],[186,143,false]]],[\"union\",146,8],[\"ref\",95],[\"union\",307,8],[\"object\",[[78,306,false],[51,100,false],[187,308,false]]],[\"ref\",96],[\"array\",310],[\"object\",[[188,311,false]]],[\"object\",[[189,0,true]]],[\"object\",[[50,73,false],[41,0,true]]],[\"ref\",99],[\"union\",315,8],[\"object\",[[190,316,false],[50,73,false],[191,316,false],[192,179,false],[41,0,true],[193,0,true]]],[\"object\",[[78,306,false],[50,73,false],[51,100,false],[187,308,false]]],[\"ref\",219],[\"union\",319,8],[\"ref\",218],[\"union\",321,8],[\"object\",[[50,73,false],[180,143,false],[194,107,false],[41,0,true],[195,320,false],[96,322,false],[48,0,true],[112,107,false]]],[\"object\",[[41,0,true],[112,107,false]]],[\"object\",[[196,0,true]]],[\"object\",[[196,0,true],[112,107,false]]],[\"object\",[[142,73,false],[197,0,true],[143,240,false]]],[\"ref\",46,122],[\"object\",[[198,160,false],[199,328,true]]],[\"object\",[[198,160,false]]],[\"object\",[[87,0,true],[41,0,true]]],[\"ref\",108],[\"array\",332],[\"ref\",109],[\"union\",334,8],[\"ref\",3,15,62,112],[\"object\",[[198,160,false],[200,333,false],[199,73,false],[201,335,false],[202,336,true]]],[\"enum\",\"Seconds\",\"Minutes\",\"Hours\",\"Days\"],[\"object\",[[203,67,true],[176,338,true]]],[\"ref\",115],[\"array\",340],[\"object\",[[145,0,true],[3,107,false],[204,341,false]]],[\"object\",[[205,75,true],[206,73,false],[93,177,false],[207,0,true]]],[\"object\",[[2,3,true],[54,0,true],[3,5,false]]],[\"ref\",116],[\"array\",345],[\"object\",[[185,346,false],[208,0,true],[0,0,true]]],[\"object\",[[69,1,true],[0,0,true]]],[\"object\",[[125,217,false],[5,11,false],[126,73,false],[129,221,false],[41,0,true],[130,223,false],[131,75,false],[132,126,false],[133,225,false],[134,73,false],[135,227,false]]],[\"array\",1],[\"object\",[[163,350,false]]],[\"union\",0,75,8],[\"number\",-1.7976931348623157E+308,1.7976931348623157E+308],[\"enum\",\"Int32\",\"Int64\",\"Decimal\",\"Single\"],[\"string\",\"^-?[0-9]\\u002B(\\\\.[0-9]\\u002B)?([Ee][\\u002B-]?[0-9]\\u002B)?$\"],[\"object\",[[209,354,true],[1,355,true]]],[\"const\",\"ExactNumber\"],[\"string\",\"^(?:0|-?(?:[1-9][0-9]{0,28}|(?:0|[1-9][0-9]{0,28})\\\\.[0-9]{0,27}[1-9]))$\"],[\"object\",[[209,357,true],[1,358,true]]],[\"union\",352,353,356,359],[\"object\",[[1,360,false]]],[\"enum\",\"And\",\"Or\"],[\"object\",[[103,328,true],[104,362,true],[105,328,true]]],[\"ref\",8,29,123,130,172],[\"object\",[[103,364,true],[104,362,true],[105,364,true]]],[\"object\",[[103,91,true],[104,362,true],[105,91,true]]],[\"ref\",58],[\"array\",367],[\"union\",368,8],[\"ref\",92],[\"array\",370],[\"union\",371,8],[\"ref\",192],[\"array\",373],[\"object\",[[89,171,false],[5,11,false],[146,247,false],[147,249,false],[50,73,false],[210,369,false],[91,73,false],[9,19,false],[148,251,false],[11,23,false],[211,372,false],[149,75,true],[41,0,true],[19,253,false],[212,374,false],[24,50,false],[135,227,false]]],[\"object\",[[82,158,false],[83,160,false],[84,160,false],[85,160,false],[213,0,true]]],[\"object\",[[2,3,true],[74,141,false],[0,0,true]]],[\"object\",[[214,364,true]]],[\"enum\",\"Info\",\"Warning\",\"Error\",\"Unknown\"],[\"object\",[[82,158,false],[215,379,true],[117,0,true],[118,75,true],[83,160,false],[84,160,false],[85,160,false]]],[\"object\",[[82,158,false],[216,0,true],[83,160,false],[84,160,false],[85,160,false]]],[\"ref\",134],[\"array\",382],[\"object\",[[217,383,false]]],[\"object\",[[41,0,true],[1,1,true]]],[\"object\",[[78,306,false],[51,100,false]]],[\"object\",[[50,73,false],[41,0,true],[18,126,false]]],[\"object\",[[218,75,false],[219,73,false],[220,73,false],[221,0,true],[222,68,false],[223,68,false]]],[\"union\",364,8],[\"object\",[[78,306,false],[199,389,false],[50,73,false],[51,100,false],[41,0,true]]],[\"ref\",143],[\"array\",391],[\"object\",[[224,73,false],[225,73,false],[226,73,false],[199,73,false],[227,73,false],[50,73,false],[228,73,false],[229,73,false],[41,0,true],[230,126,false],[231,73,false],[232,126,false],[233,392,false]]],[\"object\",[[234,0,true],[235,0,true]]],[\"ref\",68],[\"union\",395,8],[\"ref\",98],[\"union\",397,8],[\"union\",328,8],[\"object\",[[54,0,true],[180,143,false],[236,396,false],[237,398,false],[3,107,false],[55,110,false],[56,399,false]]],[\"object\",[[2,3,true],[74,141,false],[50,73,false],[51,100,false],[65,304,false],[41,0,true],[238,73,false],[239,73,false],[21,46,false]]],[\"ref\",145],[\"array\",402],[\"object\",[[74,141,false],[240,403,false],[41,0,true]]],[\"object\",[[0,0,true],[60,1,true]]],[\"object\",[[241,75,false],[242,75,false],[243,75,false],[41,0,true],[48,94,true]]],[\"ref\",151],[\"object\",[[41,0,true],[60,407,true],[48,95,false]]],[\"object\",[[60,407,true]]],[\"ref\",152],[\"array\",410],[\"object\",[[179,411,false]]],[\"object\",[[1,1,true]]],[\"object\",[[179,107,false]]],[\"object\",[[41,0,true],[60,143,false],[48,94,true]]],[\"ref\",157],[\"union\",416,8],[\"array\",416],[\"ref\",136],[\"union\",419,8],[\"object\",[[89,171,false],[80,417,false],[50,73,false],[244,418,false],[245,75,false],[41,0,true],[246,420,false],[247,94,true],[109,73,false]]],[\"object\",[[82,158,false],[83,160,false],[84,160,false],[85,160,false],[202,0,true]]],[\"ref\",162],[\"array\",423],[\"object\",[[50,73,false],[91,73,false],[41,0,true],[26,424,false],[248,399,false]]],[\"ref\",235],[\"array\",426],[\"ref\",114],[\"array\",428],[\"union\",429,8],[\"union\",177,8],[\"ref\",113,126,173],[\"object\",[[78,306,false],[249,427,false],[50,73,false],[51,100,false],[250,430,false],[93,431,false],[94,182,false],[60,432,true]]],[\"object\",[[251,0,true]]],[\"object\",[[50,73,false],[91,73,false],[51,100,false],[41,0,true],[71,179,false]]],[\"object\",[[45,73,false],[80,73,false],[238,0,true]]],[\"object\",[[78,306,false],[50,73,false],[54,0,true],[51,100,false]]],[\"ref\",166],[\"array\",438],[\"object\",[[50,73,false],[41,0,true],[238,0,true],[124,439,false]]],[\"object\",[[82,158,false],[83,160,false],[84,160,false],[85,160,false],[81,0,true]]],[\"object\",[[54,0,true],[65,143,false],[186,143,false]]],[\"enum\",\"Error\",\"Information\",\"Warning\"],[\"object\",[[199,328,true],[117,73,false],[252,443,true]]],[\"object\",[[253,0,true]]],[\"enum\",\"Sunday\",\"Monday\",\"Tuesday\",\"Wednesday\",\"Thursday\",\"Friday\",\"Saturday\"],[\"union\",446,8],[\"string\",\"^([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9](\\\\.[0-9]{1,7})?$\"],[\"object\",[[254,68,false],[255,447,false],[256,448,true]]],[\"object\",[[145,0,true],[121,73,false],[122,208,false]]],[\"ref\",177],[\"array\",451],[\"ref\",178],[\"union\",453,8],[\"object\",[[200,452,false],[121,0,true],[122,208,false],[201,454,false]]],[\"object\",[[82,158,false],[145,0,true],[199,328,true]]],[\"enum\",\"Hidden\",\"Execute\",\"Unknown\"],[\"object\",[[82,158,false],[145,73,false],[257,457,true]]],[\"object\",[[258,10,true]]],[\"ref\",40],[\"array\",460],[\"ref\",41],[\"array\",462],[\"ref\",148],[\"array\",464],[\"ref\",42],[\"array\",466],[\"object\",[[5,11,false],[156,0,true],[259,168,false],[129,461,false],[260,73,false],[41,0,true],[130,463,false],[261,465,false],[71,467,false],[262,73,false],[135,227,false]]],[\"object\",[[80,73,false],[81,0,true],[48,94,true]]],[\"object\",[[121,0,true],[0,0,true]]],[\"ref\",175],[\"array\",471],[\"object\",[[80,73,false],[263,73,false],[53,472,false],[264,73,false],[213,0,true]]],[\"ref\",184],[\"array\",474],[\"object\",[[179,475,false],[265,0,true]]],[\"ref\",83],[\"array\",477],[\"object\",[[146,478,false],[50,73,false],[88,166,false],[51,100,false],[41,0,true]]],[\"ref\",182],[\"array\",480],[\"object\",[[5,11,false],[31,481,false],[266,208,false],[265,0,true],[135,227,false]]],[\"ref\",187],[\"array\",483],[\"object\",[[41,0,true],[133,484,false]]],[\"object\",[[125,217,false],[5,11,false],[126,73,false],[127,219,false],[50,73,false],[128,73,false],[129,221,false],[267,73,false],[41,0,true],[130,223,false],[131,75,false],[132,126,false],[133,225,false],[134,73,false],[135,227,false]]],[\"ref\",230],[\"array\",487],[\"object\",[[163,488,false],[41,0,true]]],[\"object\",[[193,226,true]]],[\"object\",[[54,0,true],[71,107,false]]],[\"ref\",196],[\"array\",492],[\"object\",[[268,0,true],[185,493,false]]],[\"ref\",197],[\"array\",495],[\"object\",[[269,496,false]]],[\"object\",[[82,158,false],[83,160,false],[84,160,false],[85,160,false],[265,0,true],[1,0,true]]],[\"ref\",23],[\"array\",499],[\"ref\",44],[\"array\",501],[\"enum\",\"Inbound\",\"Outbound\"],[\"union\",503,8],[\"array\",395],[\"array\",397],[\"ref\",146],[\"array\",507],[\"ref\",158],[\"array\",509],[\"ref\",161],[\"array\",511],[\"ref\",164],[\"array\",513],[\"union\",514,8],[\"ref\",167],[\"array\",516],[\"union\",517,8],[\"ref\",189],[\"array\",519],[\"ref\",224],[\"array\",521],[\"enum\",\"StateChange\",\"StateView\",\"Automation\",\"Translate\"],[\"object\",[[270,500,false],[271,502,false],[272,258,false],[50,73,false],[273,504,false],[91,73,false],[185,505,false],[9,19,false],[51,100,false],[41,0,true],[159,506,false],[274,508,false],[19,253,false],[275,510,false],[276,512,false],[277,515,false],[278,518,false],[279,520,false],[280,522,false],[24,50,false],[48,523,true]]],[\"object\",[[281,73,false],[41,0,true]]],[\"object\",[[65,1,true],[41,0,true]]],[\"object\",[[48,0,true],[1,0,true]]],[\"ref\",208],[\"array\",528],[\"object\",[[282,75,true],[283,529,false],[284,126,false]]],[\"object\",[[285,0,true],[286,107,false]]],[\"object\",[[287,0,true]]],[\"object\",[[288,0,true],[180,143,false],[194,107,false],[289,73,false],[112,107,false]]],[\"ref\",27],[\"union\",534,8],[\"object\",[[290,535,false],[41,73,false]]],[\"object\",[[291,0,true],[180,143,false],[289,73,false],[195,320,false],[96,322,false],[112,107,false]]],[\"object\",[[99,0,true],[96,0,true],[101,192,false],[102,107,false]]],[\"object\",[[292,75,true],[71,107,false]]],[\"ref\",220],[\"array\",540],[\"object\",[[82,107,false],[292,75,true],[81,0,true],[293,541,false]]],[\"object\",[[292,75,true],[289,73,false],[41,0,true],[71,107,false]]],[\"object\",[[291,0,true],[180,143,false],[195,320,false],[294,0,true],[96,322,false],[112,107,false]]],[\"ref\",102],[\"array\",545],[\"ref\",216],[\"array\",547],[\"ref\",210],[\"union\",549,8],[\"ref\",209],[\"union\",551,8],[\"ref\",211],[\"array\",553],[\"ref\",212],[\"union\",555,8],[\"ref\",103],[\"array\",557],[\"ref\",222],[\"array\",559],[\"union\",560,8],[\"ref\",101],[\"array\",562],[\"ref\",207],[\"array\",564],[\"ref\",105],[\"array\",566],[\"ref\",214],[\"union\",568,8],[\"ref\",215],[\"array\",570],[\"ref\",217],[\"union\",572,8],[\"ref\",104],[\"array\",574],[\"ref\",221],[\"array\",576],[\"ref\",155,156],[\"union\",578,8],[\"ref\",213],[\"union\",580,8],[\"union\",547,8],[\"union\",553,8],[\"ref\",226],[\"union\",584,8],[\"ref\",223],[\"union\",586,8],[\"ref\",225],[\"union\",588,8],[\"object\",[[295,546,false],[50,73,false],[9,19,false],[51,100,false],[296,548,false],[297,550,false],[298,552,false],[299,554,false],[300,556,false],[301,558,false],[302,561,false],[41,0,true],[53,563,false],[21,46,false],[303,565,false],[304,567,false],[305,569,false],[306,571,false],[307,548,false],[308,75,true],[309,75,false],[310,573,false],[311,575,false],[312,577,false],[313,561,false],[314,541,false],[315,579,false],[56,581,false],[316,582,false],[317,583,false],[318,556,false],[319,585,false],[320,587,false],[321,589,false]]],[\"object\",[[202,0,true],[112,107,false]]],[\"object\",[[82,107,false],[81,0,true]]],[\"object\",[[65,0,true]]],[\"enum\",\"Unknown\",\"Action\",\"Navigate\",\"Dialog\"],[\"object\",[[260,73,false],[121,73,false],[41,0,true],[53,472,false],[261,465,false],[36,594,true],[265,0,true]]],[\"ref\",232,233],[\"array\",596],[\"object\",[[106,597,false]]],[\"object\",[[322,126,false],[41,0,true]]],[\"object\",[[249,427,false],[50,73,false],[51,100,false],[41,0,true]]],[\"object\",[[158,75,true],[323,75,true],[41,0,true]]],[\"object\",[[50,73,false],[51,100,false],[41,0,true],[71,179,false]]],[\"enum\",\"Invalid\",\"DataContext\",\"QueryResult\",\"ComponentProperty\",\"Literal\"],[\"enum\",\"OneWay\",\"TwoWay\"],[\"union\",604,8],[\"enum\",\"Propagate\",\"Clear\",\"Preserve\"],[\"union\",606,8],[\"object\",[[324,603,true],[325,73,false],[326,73,false],[327,73,false],[328,143,false],[42,605,false],[329,607,false],[119,0,true],[81,73,false],[330,73,false]]],[\"object\",[[331,73,false],[332,126,false],[182,73,false],[41,0,true],[333,126,false],[334,126,false],[335,73,false]]],[\"object\",[[151,258,false],[50,73,false],[54,0,true],[152,75,true],[117,73,false],[41,0,true],[153,126,false]]],[\"object\",[[336,126,false],[151,258,false],[50,73,false],[54,0,true],[152,75,true],[117,73,false],[41,0,true],[0,0,true],[153,126,false]]],[\"object\",[[265,0,true]]],[\"ref\",12],[\"array\",613],[\"object\",[[82,614,false],[258,0,true]]],[\"enum\",\"NotEmpty\",\"Max\",\"Min\",\"GreaterThan\",\"GreaterThanOrEqual\",\"LessThan\",\"LessThanOrEqual\",\"Equal\",\"Length\",\"Matches\",\"AllGreaterThan\",\"AllGreaterThanOrEqual\",\"Rule\",\"NotEqual\"],[\"object\",[[78,306,false],[51,100,false],[187,308,false],[117,73,false],[0,0,true],[337,616,true],[252,443,true],[1,143,false]]],[\"ref\",138],[\"array\",618],[\"object\",[[37,0,true],[338,619,false],[39,0,true]]]],\"contracts\":[2,6,63,64,72,74,76,85,86,87,90,92,93,96,103,105,113,118,121,122,93,125,127,134,135,137,138,139,142,144,145,147,148,151,153,154,155,156,161,162,164,167,169,147,190,193,195,198,199,203,204,205,206,206,209,155,215,155,228,229,229,206,230,86,233,234,237,238,241,242,243,244,256,259,260,206,261,264,265,268,271,274,275,276,277,284,285,286,288,289,86,290,300,305,309,312,313,314,317,318,323,234,324,325,326,325,327,155,329,330,331,337,339,339,342,343,344,347,348,349,351,361,363,365,366,375,229,376,161,377,378,380,381,384,385,206,386,387,388,229,390,393,229,394,400,238,401,404,93,405,406,155,408,409,412,413,414,415,421,422,313,425,433,434,435,436,437,440,441,238,442,444,445,449,450,164,455,456,458,459,147,468,261,469,470,473,167,167,476,479,482,485,486,313,489,490,491,494,497,405,229,96,229,498,524,525,206,526,527,229,530,531,532,533,86,536,537,86,538,86,539,542,543,544,590,591,592,593,2,413,595,598,244,313,599,96,600,601,602,608,609,610,611,612,615,617,620]} as const;\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { InvalidSyntaxJson } from './InvalidSyntaxJson';\nimport { syntaxCollections } from './SyntaxCollections';\nimport { SyntaxNode } from './SyntaxNode';\n\ntype Member = readonly [name: number, rule: number, required: boolean];\ntype Rule = readonly [type: string, ...arguments: unknown[]];\nconst rules: readonly Rule[] = syntaxCollections.rules;\nconst patterns = new Map<number, RegExp>(rules.flatMap(([type, expression], index) => type === 'string' && typeof expression === 'string' ? [[index, new RegExp(expression, 'u')] as const] : []));\nconst contracts = new Map<string, readonly Member[]>(syntaxCollections.kinds.map((kind, index) => [kind, rules[syntaxCollections.contracts[index]][1] as readonly Member[]]));\nconst names = new Map<string, ReadonlySet<string>>([...contracts].map(([kind, members]) => [kind, new Set(['kind', ...members.map(([name]) => syntaxCollections.names[name])])]));\nconst object = (value: unknown): value is Record<string, unknown> => typeof value === 'object' && value !== null && !Array.isArray(value);\n\n// One indexed native-owned contract is shared by restoration and Exact typed writing. Defaults may\n// be omitted, but present values cannot change their primitive width, enum, or node base kind.\nexport function validateSyntaxMembers(node: SyntaxNode): void {\n const members = contracts.get(node.kind);\n if (!Object.hasOwn(node, 'kind') || members === undefined || !matchesMembers(node as unknown as Record<string, unknown>, members)) throw new InvalidSyntaxJson(`Invalid typed members for syntax kind '${node.kind}'.`);\n}\n\n// Closed-world writing is opt-in for feature-owned shapes, not a change to older Legacy nodes.\n// Source-only members are the writer's existing metadata omissions, never additional wire members.\nexport function validateClosedSyntaxMembers(node: SyntaxNode, sourceOnlyMembers: ReadonlySet<string>): void {\n const known = syntaxMemberNames(node.kind);\n for (const member of Object.keys(node)) {\n if (!known.has(member) && !sourceOnlyMembers.has(member)) throw new InvalidSyntaxJson(`Unknown member '${member}' for syntax kind '${node.kind}'.`);\n }\n}\n\nexport function syntaxMemberNames(kind: string): ReadonlySet<string> {\n const members = names.get(kind);\n if (members === undefined) throw new InvalidSyntaxJson(`Unknown syntax kind '${kind}'.`);\n return members;\n}\n\nfunction matchesMembers(value: Record<string, unknown>, members: readonly Member[]): boolean {\n return members.every(([name, rule, required]) => Object.hasOwn(value, syntaxCollections.names[name]) ? matches(value[syntaxCollections.names[name]], rule) : !required);\n}\n\n// Array.every skips holes, so each index is inspected: a hole is never a valid element.\nfunction allIndicesMatch(items: readonly unknown[], rule: number): boolean {\n for (let position = 0; position < items.length; position++) {\n if (!Object.hasOwn(items, position) || !matches(items[position], rule)) return false;\n }\n return true;\n}\n\nfunction matches(value: unknown, index: number): boolean {\n const [type, ...args] = rules[index];\n switch (type) {\n case 'ref': return object(value) && typeof value.kind === 'string' && args.some(kind => syntaxCollections.kinds[kind as number] === value.kind);\n case 'union':\n case 'one': {\n const count = args.reduce<number>((count, rule) => count + (matches(value, rule as number) ? 1 : 0), 0);\n return type === 'one' ? count === 1 : count > 0;\n }\n case 'const': return value === args[0];\n case 'enum': return args.includes(value);\n case 'null': return value === null;\n case 'array': return Array.isArray(value) && allIndicesMatch(value, args[0] as number);\n case 'object': return object(value) && Object.keys(value).every(name => (args[0] as readonly Member[]).some(([key]) => syntaxCollections.names[key] === name)) && matchesMembers(value, args[0] as readonly Member[]);\n case 'integer':\n case 'number': return typeof value === 'number' && Number.isFinite(value) && (type !== 'integer' || Number.isInteger(value)) && (args.length === 0 || (value >= (args[0] as number) && value <= (args[1] as number) && !(type === 'integer' && args[0] === 0 && Object.is(value, -0))));\n case 'string': return typeof value === 'string' && (args.length === 0 || patterns.get(index)!.test(value));\n default: return type === 'boolean' && typeof value === 'boolean';\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ValidationRuleSyntax } from './Commands';\nimport { SpecificationSyntax } from './Specifications';\nimport { SyntaxNode } from './SyntaxNode';\n\n// The members the syntax tree gained with exact numeric source. The internal tree keeps them for every\n// document, but an unmarked (Legacy) document writes the wire form it always had, so these are left out of it.\n// Exact documents write the complete expanded form.\nconst additions: Readonly<Record<string, ReadonlySet<string>>> = Object.fromEntries(\n ('ApplicationSyntax:policies,seeds;ConceptSyntax:validations;DeclarativeValidateSyntax:requirements;CodeValidateSyntax:code;' +\n 'CaptureAppendSyntax:when,mappings,tags;CaptureChildrenSyntax:map;CaptureNestedSyntax:map;CaptureSyntax:map;EventSpecSyntax:key;' +\n 'FromSyntax:key,parentKey;ChildrenSyntax:identifiedBy;RemoveWithSyntax:key,parentKey;RemoveViaJoinSyntax:key;ProjectionEntersOnSyntax:key;' +\n 'ProjectionSyntax:key;QueryParameterSyntax:source;ProducesSyntax:when;InvokesSyntax:mappings;ReactionSyntax:where;' +\n 'SpecificationSyntax:thenAbsentReadModels,thenQueries').split(';').map(entry => entry.split(':')).map(([kind, members]) => [kind, new Set(members.split(','))]));\n\n// Every projection mapping kind, but not the always-modeled PropertyMappingSyntax.\nconst mappingKind = /^(?:Set|Clear|Increment|Decrement|Count|Add|Subtract)MappingSyntax$/;\n\nexport function isExactOnlyMember(kind: string, member: string): boolean {\n return additions[kind]?.has(member) === true || (mappingKind.test(kind) && (member === 'source' || member === 'value'));\n}\n\nexport function isLegacyOmittedMember(node: SyntaxNode, member: string): boolean {\n // Legacy never modeled unwrapped rule payloads. Only an explicit wrapper opts into rule intent on wire.\n // A caller is only written when the specification states one; Legacy never wrote the member when it was absent.\n if (node.kind === 'SpecificationSyntax' && member === 'givenCaller') return (node as SpecificationSyntax).givenCaller == null;\n return isExactOnlyMember(node.kind, member) || (node.kind === 'ValidationRuleSyntax' && (node as ValidationRuleSyntax).implementation == null && (member === 'code' || member === 'file' || member === 'implementation'));\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { SyntaxNode } from './SyntaxNode';\nimport { InvalidSyntaxJson } from './InvalidSyntaxJson';\nimport { isExactNumberToken, parseExactNumber } from './ExactNumber';\nimport { validateSyntaxInvariants } from './SyntaxInvariants';\nimport { syntaxMemberNames, validateClosedSyntaxMembers, validateSyntaxMembers } from './SyntaxMemberContracts';\nimport { ValidationRuleSyntax } from './Commands';\nimport { isLegacyOmittedMember } from './LegacyWireProjection';\nimport { legacySourceOptions, validatedSourceOptions } from './SourceOptions';\n\n// Returned record objects have null prototypes.\nexport type SyntaxJsonValue = string | number | boolean | null | SyntaxJsonValue[] | { [member: string]: SyntaxJsonValue };\n\nconst isNode = (value: unknown): value is SyntaxNode =>\n typeof value === 'object' && value !== null && typeof (value as { kind?: unknown }).kind === 'string';\nconst omitted = new Set(['kind', 'location', 'targetLocation', 'referenceLocation', 'referenceLength', 'nameWasEscaped', 'declaredTriggers', 'directiveLocations']);\nconst sourceRoots = new Set(['ApplicationSyntax', 'ProjectionSyntax', 'CaptureSyntax', 'SpecificationSyntax']);\n\n// The canonical JSON form of a syntax tree, the same form the C# SyntaxJson writes: 'kind' first, then the\n// members in ordinal order, with source locations left out. Because a node only carries the members this\n// compiler models, the result is the C# form narrowed to those members.\nexport function toSyntaxJson(node: SyntaxNode): SyntaxJsonValue {\n const detached = snapshot(node);\n validateNumbers(detached, 'legacy', 0);\n return write(detached);\n}\n\n// The enriched internal tree written completely, Legacy members included. Not a wire form: it exists so the\n// walker and other tree consumers can be held to every node the parser builds.\nexport function toCompleteSyntaxJson(node: SyntaxNode): SyntaxJsonValue {\n const detached = snapshot(node);\n validateNumbers(detached, 'legacy', 0);\n return write(detached, 'legacy', true);\n}\n\n// Read caller-owned properties only once, before validation. Both validation and projection see the same\n// detached data; accessors, proxies and shared references cannot change it between passes.\nfunction snapshot(value: unknown): unknown {\n const copies = new WeakMap<object, unknown>();\n const pending: (() => void)[] = [];\n // Schedule depth-first reads without consuming the call stack, including for ignored metadata.\n function detach(value: unknown): unknown {\n if (typeof value !== 'object' || value === null) return value;\n if (copies.has(value)) return copies.get(value);\n if (Array.isArray(value)) {\n const items = dataArray<unknown>();\n copies.set(value, items);\n const length = value.length;\n for (let index = length - 1; index >= 0; index--) pending.push(() => {\n items[index] = detach(Object.hasOwn(value, index) ? value[index] : undefined);\n });\n return items;\n }\n const copy = Object.create(null) as Record<string, unknown>;\n copies.set(value, copy);\n const names = Object.keys(value);\n // Node identity also accepts inherited, hidden and class-getter kinds; read it just once.\n if (!names.includes('kind') && 'kind' in value) names.unshift('kind');\n for (let index = names.length - 1; index >= 0; index--) pending.push(() => {\n const name = names[index];\n const member = (value as Record<string, unknown>)[name];\n if (name === 'sourceOptions') pending.push(() => {\n // Source option contracts also reject exotic prototypes and hidden/symbol members. Preserve\n // that rejected shape as data rather than sanitizing it into an apparently valid option record.\n if (typeof member === 'object' && member !== null &&\n ((Object.getPrototypeOf(member) !== Object.prototype && Object.getPrototypeOf(member) !== null) || Reflect.ownKeys(member).length !== Object.keys(member).length)) {\n copy[name] = Object.assign(Object.create(null), { numericMode: 'invalid' });\n }\n });\n copy[name] = detach(member);\n });\n return copy;\n }\n const detached = detach(value);\n while (pending.length > 0) pending.pop()!();\n return detached;\n}\n\nfunction dataArray<T>(): T[] {\n const items: T[] = [];\n // JSON.stringify consults inherited toJSON even on plain arrays. Shadow that hook without changing\n // their indexed JSON bytes or normal Array prototype (including for existing tree consumers).\n Object.defineProperty(items, 'toJSON', { value: undefined });\n return items;\n}\n\nfunction write(value: unknown, owningMode = 'legacy', complete = false): SyntaxJsonValue {\n if (Array.isArray(value)) {\n // A fresh plain array: never map (Symbol.species) or serialize through a caller-supplied hook.\n const items = dataArray<SyntaxJsonValue>();\n for (let index = 0; index < value.length; index++) items.push(write(value[index], owningMode, complete));\n return items;\n }\n if (isNode(value)) {\n if (sourceRoots.has(value.kind)) owningMode = validatedSourceOptions((value as unknown as { sourceOptions?: unknown }).sourceOptions ?? legacySourceOptions).numericMode;\n validateSyntaxInvariants(value);\n // #307 shapes are closed in both modes, before any projection can hide unknown members.\n if (value.kind === 'ImplementationSyntax' || value.kind === 'ImplementationHintSyntax') validateClosedSyntaxMembers(value, omitted);\n if (value.kind === 'ValidationRuleSyntax') {\n const rule = value as ValidationRuleSyntax;\n if (rule.implementation != null) {\n if (rule.file != null) validateClosedSyntaxMembers(rule.file, omitted);\n if (rule.code != null) validateClosedSyntaxMembers(rule.code, omitted);\n }\n }\n const result = Object.create(null) as { [member: string]: SyntaxJsonValue };\n result.kind = value.kind;\n const structural = { ...value } as unknown as Record<string, unknown>;\n if (value.kind === 'ApplicationSyntax' && structural.eventSources === undefined) structural.eventSources = [];\n if (value.kind === 'CommandSyntax' && structural.stream === undefined) structural.stream = null;\n if (value.kind === 'CommandSyntax' && structural.streamCandidates === undefined) structural.streamCandidates = [];\n const known = owningMode === 'exact' ? syntaxMemberNames(value.kind) : undefined;\n const members = Object.keys(structural).filter(member => (known === undefined || known.has(member)) && !(owningMode === 'legacy' && !complete && isLegacyOmittedMember(value, member)) && !omitted.has(member) && !(value.kind === 'OperationSyntax' && member === 'usesLocation')).sort(ordinal);\n for (const member of members) {\n const memberValue = structural[member];\n if (value.kind === 'ApplicationSyntax' && member === 'identity' && memberValue == null) continue;\n if ((value.kind === 'EventSyntax' || value.kind === 'ImportSyntax') && ((member === 'visibility' && memberValue === 'Private') || (member === 'origin' && memberValue == null))) continue;\n if (value.kind === 'SliceSyntax' && member === 'direction' && memberValue == null) continue;\n if (value.kind === 'ConceptAttributeSyntax' && (member === 'scope' || member === 'specialCategory') && memberValue == null) continue;\n if (value.kind === 'ConceptAttributeSyntax' && member === 'criminal' && memberValue === false) continue;\n if (value.kind === 'PropertySyntax' && member === 'isSubject' && memberValue === false) continue;\n if (member === 'description' && memberValue == null && ['ConceptSyntax', 'PolicySyntax', 'FileConstraintSyntax', 'UniqueEventConstraintSyntax', 'UniquePropertyConstraintSyntax', 'ProjectionSyntax', 'ScreenSyntax', 'FormSyntax'].includes(value.kind)) continue;\n if (member === 'documentation' && value.kind !== 'EventSyntax' && memberValue == null) continue;\n if (value.kind === 'SpecificationSyntax' && member === 'description' && memberValue == null) continue;\n if (member === 'dependsOn' && (value.kind === 'ModuleSyntax' || value.kind === 'FeatureSyntax') && Array.isArray(memberValue) && memberValue.length === 0) continue;\n if (member === 'sourceOptions' && (memberValue as { numericMode?: string } | undefined)?.numericMode === 'legacy') continue;\n if ((member === 'examples' || value.kind === 'SpecificationSyntax' && (member === 'parameters' || member === 'cases')) && Array.isArray(memberValue) && memberValue.length === 0) continue;\n if (value.kind === 'SpecificationErrorSyntax' && member === 'caseValue' && memberValue == null) continue;\n if (member === 'purposes' && Array.isArray(memberValue) && memberValue.length === 0) continue;\n if (member === 'inlineProperty' && memberValue == null) continue;\n if ((value.kind === 'SpecificationExampleSyntax' || value.kind === 'SpecificationRedeliverySyntax') && (member === 'stream' || member === 'noStream') && memberValue == null) continue;\n if (value.kind === 'SpecificationSyntax' && member === 'thenNoEvents' && memberValue === false) continue;\n if (value.kind === 'SpecificationSyntax' && member === 'whenRedelivered' && memberValue == null) continue;\n if (value.kind === 'InvokesSyntax' && member === 'onRefused' && Array.isArray(memberValue) && memberValue.length === 0) continue;\n result[member] = write(memberValue, owningMode, complete);\n }\n return result;\n }\n if (value === undefined) return null;\n if (typeof value !== 'object' || value === null) return value as SyntaxJsonValue;\n const record = value as Record<string, unknown>;\n // The ordered ExactNumber form, whatever the input key order; other objects are copied without any toJSON hook.\n const copy = Object.create(null) as { [member: string]: SyntaxJsonValue };\n if (record.literalType === 'ExactNumber') {\n copy.literalType = 'ExactNumber';\n copy.value = record.value as string;\n return copy;\n }\n for (const name of Object.keys(record)) if (name !== 'toJSON' && record[name] !== undefined) copy[name] = write(record[name], owningMode, complete);\n return copy;\n}\n\nfunction validateNumbers(value: unknown, owningMode: string, depth: number): void {\n if (depth > 96 && owningMode === 'exact') throw new InvalidSyntaxJson('Syntax nesting exceeds the supported depth of 96.');\n if (Array.isArray(value)) { for (let index = 0; index < value.length; index++) validateNumbers(value[index], owningMode, depth + 1); return; }\n if (typeof value !== 'object' || value === null) return;\n const node = value as Record<string, unknown>;\n if (sourceRoots.has(node.kind as string) || Object.hasOwn(node, 'sourceOptions')) {\n // Omission is Legacy on every complete source root, never inheritance from its container.\n const options = Object.hasOwn(node, 'sourceOptions') ? validatedSourceOptions(node.sourceOptions) : legacySourceOptions;\n if (depth > 0 && owningMode !== options.numericMode) throw new InvalidSyntaxJson('Conflicting source numeric options.');\n owningMode = options.numericMode;\n }\n if (depth === 0 && owningMode === 'exact' && !sourceRoots.has(node.kind as string)) throw new InvalidSyntaxJson('Exact syntax requires a complete source root.');\n if (owningMode === 'exact' && isNode(node)) validateSyntaxMembers(node);\n if (node.kind === 'RawExpressionSyntax' && owningMode === 'exact' && typeof node.text === 'string' && isExactNumberToken(node.text)) throw new InvalidSyntaxJson('An exact numeric operand must be an explicit ExactNumber, not opaque numeric text.');\n if (node.kind === 'LiteralExpressionSyntax' && Object.hasOwn(node, 'value')) {\n if (owningMode === 'exact' && (typeof node.value === 'number' || (node.value !== null && !['string', 'boolean', 'object'].includes(typeof node.value)))) throw new InvalidSyntaxJson('Exact source requires supported primitive values or an explicit ExactNumber literal.');\n if (typeof node.value === 'object' && node.value !== null) {\n const literal = node.value as { literalType?: unknown; value?: unknown };\n if (literal.literalType === 'ExactNumber') {\n if (owningMode !== 'exact' || typeof literal.value !== 'string' || parseExactNumber(literal.value)?.value !== literal.value || Object.keys(literal).length !== 2) throw new InvalidSyntaxJson('Malformed or incompatible ExactNumber literal.');\n } else if (owningMode === 'exact') throw new InvalidSyntaxJson('Exact source refuses old or plain object literal insertion.');\n }\n }\n const known = owningMode === 'exact' && isNode(node) ? syntaxMemberNames(node.kind) : undefined;\n for (const [name, member] of Object.entries(node)) if ((known === undefined || known.has(name) || (isNode(member) && sourceRoots.has(member.kind))) && name !== 'location' && name !== 'targetLocation' && name !== 'usesLocation') validateNumbers(member, owningMode, depth + 1);\n}\n\nfunction ordinal(left: string, right: string): number {\n return left < right ? -1 : left > right ? 1 : 0;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { validateIdentity } from '../Parsing/IdentityValidator';\nimport { ParserContext } from '../Parsing/ParserContext';\nimport { LineReader } from '../Parsing/LineReader';\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { DiagnosticCodes } from '../Diagnostics/DiagnosticCodes';\nimport { SourceLocation } from '../Diagnostics/SourceLocation';\nimport { combineAuthorize } from '../Parsing/AuthorizeParser';\nimport { CompilationResult } from '../ScreenplayCompiler';\nimport { AuthorizeSyntax, PersonaSyntax } from '../Syntax/Authorization';\nimport { ConceptSyntax, TypeSyntax } from '../Syntax/Declarations';\nimport { ApplicationSyntax, FeatureSyntax, ModuleSyntax } from '../Syntax/Structure';\nimport { toSyntaxJson } from '../Syntax/SyntaxJson';\nimport { invalidSourceOptions, isAuthoredDocument, legacySourceOptions, SourceOptions, validatedSourceOptions } from '../Syntax/SourceOptions';\nimport { InvalidSyntaxJson } from '../Syntax/InvalidSyntaxJson';\n\n// \"The documents of a folder are one document\": modules and features with the same name combine, and a\n// name declared in two files is reported - the port of the C# PlayFolderMerge for what this compiler\n// models. The semantic validation the C# merge runs afterwards is not ported.\nexport function mergeDocuments(documents: readonly CompilationResult<ApplicationSyntax>[]): CompilationResult<ApplicationSyntax> {\n const diagnostics: Diagnostic[] = [];\n const applications = documents.map(document => document.value);\n const options = new Map<ApplicationSyntax, SourceOptions>();\n let invalid = false;\n for (const application of applications) {\n try {\n options.set(application, Object.hasOwn(application, 'sourceOptions') ? validatedSourceOptions(application.sourceOptions) : legacySourceOptions);\n } catch (failure) {\n if (!(failure instanceof InvalidSyntaxJson)) throw failure;\n invalid = true;\n diagnostics.push(error(DiagnosticCodes.IncompatibleNumericSource, failure.message, application.location));\n }\n }\n const asserted = applications.filter(application => options.get(application)?.numericMode === 'exact' || hasDeclarations(application));\n let sourceOptions = options.get(asserted[0]) ?? legacySourceOptions;\n for (const application of asserted.slice(1)) {\n if (options.get(application)?.numericMode !== sourceOptions.numericMode) {\n invalid = true;\n diagnostics.push(error(DiagnosticCodes.MixedNumericModes, 'Declaration-bearing documents and marked import barrels must independently select the same numeric mode.', application.location));\n }\n }\n if (invalid) sourceOptions = invalidSourceOptions;\n const named = new Map<string, SourceLocation>();\n const concepts = declaredInOneFile<ConceptSyntax>(applications.flatMap(application => application.concepts), 'declaration of', diagnostics, undefined, named);\n const types = declaredInOneFile<TypeSyntax>(applications.flatMap(application => application.types), 'declaration of', diagnostics, undefined, named);\n const identities = applications.flatMap(application => application.identity == null ? [] : [application.identity]);\n for (const extra of identities.slice(1)) diagnostics.push(error(DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles,\n `The folder already declares an identity block in '${describe(identities[0].location.path)}' - a folder compiles to one application, which can have at most one`, extra.location));\n const domains = applications.map(application => application.domain).filter(domain => domain !== null);\n for (const extra of domains.slice(1)) {\n diagnostics.push(error(DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles,\n `The folder already declares a domain in '${describe(domains[0].location.path)}' - a folder compiles to one application, which can have at most one`, extra.location));\n }\n // Modules merge before personas are claimed, so the diagnostics come in the order the C# merge reports them.\n const modules = mergeModules(applications.flatMap(application => application.modules), diagnostics);\n const personas = declaredInOneFile<PersonaSyntax>(applications.flatMap(application => application.personas), 'persona', diagnostics);\n const value: ApplicationSyntax = {\n kind: 'ApplicationSyntax',\n sourceOptions,\n ...(identities.length === 0 ? {} : { identity: identities[0] }),\n domain: domains[0] ?? null,\n imports: firstOfEach(applications.flatMap(application => application.imports), item => item.qualifiedName),\n concepts,\n types,\n examples: applications.flatMap(application => application.examples ?? []),\n systems: applications.flatMap(application => application.systems ?? []),\n purposes: declaredInOneFile(applications.flatMap(application => application.purposes ?? []), 'purpose', diagnostics),\n eventSources: applications.flatMap(application => application.eventSources ?? []),\n declaredTriggers: applications.flatMap(application => application.declaredTriggers ?? []),\n modules,\n personas,\n policies: applications.flatMap(application => application.policies ?? []),\n seeds: applications.flatMap(application => application.seeds ?? []),\n fileImports: applications.flatMap(application => application.fileImports),\n ...presentOnly('exposures', applications.flatMap(application => application.exposures ?? [])),\n ...presentOnly('instanceContributions', applications.flatMap(application => application.instanceContributions ?? [])),\n location: applications[0]?.location ?? { line: 1, column: 1 },\n };\n const identityContext = new ParserContext(new LineReader([]));\n validateIdentity(value, identityContext);\n diagnostics.push(...identityContext.diagnostics);\n const all = [...documents.flatMap(document => document.diagnostics), ...diagnostics];\n return { value, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error') };\n}\n\nfunction hasDeclarations(application: ApplicationSyntax): boolean {\n if (isAuthoredDocument(application)) return true;\n if (application.identity != null || application.domain !== null || application.concepts.length > 0 || application.types.length > 0 || application.personas.length > 0 || (application.policies?.length ?? 0) > 0 || (application.purposes?.length ?? 0) > 0 || (application.seeds?.length ?? 0) > 0 || (application.systems?.length ?? 0) > 0 || (application.eventSources?.length ?? 0) > 0 || (application.examples?.length ?? 0) > 0) return true;\n const feature = (node: FeatureSyntax): boolean => !node.isPlacement || (node.examples?.length ?? 0) > 0 || node.slices.length > 0 || node.features.some(feature);\n return application.modules.some(module => !module.isPlacement || (module.examples?.length ?? 0) > 0 || module.features.some(feature));\n}\n\nfunction mergeModules(modules: readonly ModuleSyntax[], diagnostics: Diagnostic[]): ModuleSyntax[] {\n return groupByName(modules).map(placedLast).map(parts => parts.length === 1 ? { ...parts[0], isPlacement: false, features: parts[0].features.map(unplaced) } : {\n ...parts[0],\n isPlacement: false,\n fileImports: parts.flatMap(part => part.fileImports),\n examples: parts.flatMap(part => part.examples ?? []),\n purposes: firstOfEach(parts.flatMap(part => part.purposes ?? []), reference => reference.name),\n description: firstDescription(parts, `module '${parts[0].name}'`, diagnostics),\n documentation: firstDocumentation(parts, `module '${parts[0].name}'`, diagnostics),\n authorize: combineAuthorization(parts.map(part => part.authorize), `module '${parts[0].name}'`, diagnostics),\n dependsOn: groupDependencies(parts),\n features: mergeFeatures(parts.flatMap(part => part.features), diagnostics),\n });\n}\n\nfunction mergeFeatures(features: readonly FeatureSyntax[], diagnostics: Diagnostic[]): FeatureSyntax[] {\n return groupByName(features).map(placedLast).map(parts => parts.length === 1 ? unplaced(parts[0]) : {\n ...parts[0],\n isPlacement: false,\n fileImports: parts.flatMap(part => part.fileImports),\n examples: parts.flatMap(part => part.examples ?? []),\n purposes: firstOfEach(parts.flatMap(part => part.purposes ?? []), reference => reference.name),\n description: firstDescription(parts, `feature '${parts[0].name}'`, diagnostics),\n documentation: firstDocumentation(parts, `feature '${parts[0].name}'`, diagnostics),\n authorize: combineAuthorization(parts.map(part => part.authorize), `feature '${parts[0].name}'`, diagnostics),\n dependsOn: groupDependencies(parts),\n features: mergeFeatures(parts.flatMap(part => part.features), diagnostics),\n slices: declaredInOneFile(parts.flatMap(part => part.slices), 'slice', diagnostics, `feature '${parts[0].name}'`),\n });\n}\n\n// Dependencies accumulate in path order, independently of which header owns the container.\nfunction groupDependencies(parts: readonly (ModuleSyntax | FeatureSyntax)[]) {\n return [...parts].sort((left, right) => (left.location.path ?? '') < (right.location.path ?? '') ? -1 : (left.location.path ?? '') > (right.location.path ?? '') ? 1 : 0).flatMap(part => part.dependsOn ?? []);\n}\n\n// Where a module or feature is written comes before files merely placed in it, so the merged one is located\n// at its declaration. Within each kind, path order is kept.\nfunction placedLast<T extends { readonly isPlacement: boolean }>(parts: readonly T[]): T[] {\n return [...parts.filter(part => !part.isPlacement), ...parts.filter(part => part.isPlacement)];\n}\n\n// Once merged, a feature is the feature - whether a file was placed in it no longer says anything.\nfunction unplaced(feature: FeatureSyntax): FeatureSyntax {\n return { ...feature, isPlacement: false, features: feature.features.map(unplaced) };\n}\n\n// Combines the gates files declare on one module or feature with 'and', never weakening an earlier one. The\n// same gate repeated in another file says nothing new and is reported and left out.\nfunction combineAuthorization(declarations: readonly (AuthorizeSyntax | null)[], owner: string, diagnostics: Diagnostic[]): AuthorizeSyntax | null {\n const kept: AuthorizeSyntax[] = [];\n for (const authorization of declarations.filter(declaration => declaration !== null)) {\n const first = kept.find(earlier => earlier.location.path !== authorization.location.path\n && JSON.stringify(toSyntaxJson(earlier)) === JSON.stringify(toSyntaxJson(authorization)));\n if (first !== undefined) {\n diagnostics.push(warning(DiagnosticCodes.DuplicateAuthorizationAcrossFiles,\n `An identical authorization is already declared on the ${owner} in '${describe(first.location.path)}' - this repeated gate is ignored`, authorization.location));\n continue;\n }\n kept.push(authorization);\n }\n return kept.reduce<AuthorizeSyntax | null>((combined, next) => combineAuthorize(combined, next), null);\n}\n\nfunction firstOfEach<T>(items: readonly T[], key: (item: T) => string): T[] {\n const seen = new Set<string>();\n return items.filter(item => !seen.has(key(item)) && seen.add(key(item)) !== undefined);\n}\n\n// Groups by name, keeping the order each name first appears in.\nfunction groupByName<T extends { readonly name: string }>(items: readonly T[]): T[][] {\n const groups = new Map<string, T[]>();\n for (const item of items) {\n groups.set(item.name, [...(groups.get(item.name) ?? []), item]);\n }\n return [...groups.values()];\n}\n\nfunction firstDocumentation(parts: readonly { documentation?: string | null; location: SourceLocation }[], owner: string, diagnostics: Diagnostic[]): string | null {\n const documented = parts.filter(part => part.documentation != null);\n for (const disagreeing of documented.slice(1).filter(part => part.documentation !== documented[0].documentation)) {\n diagnostics.push(warning(DiagnosticCodes.ConflictingDocumentationAcrossFiles,\n `The ${owner} is already documented in '${describe(documented[0].location.path)}' - keeping that documentation`, disagreeing.location));\n }\n return documented[0]?.documentation ?? null;\n}\n\nfunction firstDescription(parts: readonly { description: string | null; location: SourceLocation }[], owner: string, diagnostics: Diagnostic[]): string | null {\n const described = parts.filter(part => part.description !== null);\n for (const disagreeing of described.slice(1).filter(part => part.description !== described[0].description)) {\n diagnostics.push(warning(DiagnosticCodes.ConflictingDescriptionAcrossFiles,\n `The ${owner} is already described in '${describe(described[0].location.path)}' - keeping that description`, disagreeing.location));\n }\n return described[0]?.description ?? null;\n}\n\n// Keeps the first declaration of each name; one in another file with the same name is reported and dropped.\n// A repeat within one file is left for that file's own checks.\nfunction declaredInOneFile<T extends { readonly name: string; readonly location: SourceLocation }>(\n declarations: readonly T[], keyword: string, diagnostics: Diagnostic[], within?: string, claimed = new Map<string, SourceLocation>()): T[] {\n const kept: T[] = [];\n for (const declaration of declarations) {\n const first = claimed.get(declaration.name);\n if (first !== undefined && first.path !== declaration.location.path) {\n diagnostics.push(error(DiagnosticCodes.RepeatedDeclarationAcrossFiles,\n `Duplicate ${keyword} '${declaration.name}'${within === undefined ? '' : ` in ${within}`} - already declared in '${describe(first.path)}'`, declaration.location));\n continue;\n }\n if (first === undefined) {\n claimed.set(declaration.name, declaration.location);\n }\n kept.push(declaration);\n }\n return kept;\n}\n\nconst describe = (path: string | undefined): string => path ?? 'another file';\nconst error = (code: string, message: string, location: SourceLocation): Diagnostic => ({ severity: 'error', code, message, location });\nconst warning = (code: string, message: string, location: SourceLocation): Diagnostic => ({ severity: 'warning', code, message, location });\n\n// Composition members are written only when a document declares them, matching the C# canonical JSON.\nfunction presentOnly<TKey extends string, TValue>(key: TKey, values: readonly TValue[]): Partial<Record<TKey, readonly TValue[]>> {\n return values.length === 0 ? {} : { [key]: values } as Partial<Record<TKey, readonly TValue[]>>;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { Diagnostic } from '../Diagnostics/Diagnostic';\nimport { validateSpecificationCases } from '../Parsing/SpecificationCaseValidator';\nimport { expandSpecificationExamples } from '../Parsing/SpecificationCommandExamples';\nimport { productionDestinationDiagnostics } from '../Diagnostics/ProductionDestinationDiagnostics';\nimport { validateConstraintProperties } from '../Parsing/ConstraintPropertyValidator';\nimport { validateDependencyDeclarations } from '../Dependencies/DeclaredDependencyTargets';\nimport { DeclaredDependencies } from '../Dependencies/DeclaredDependencies';\nimport { validateInlineEvents } from '../Parsing/InlineEventValidator';\nimport { LineReader } from '../Parsing/LineReader';\nimport { CommandStreamCandidates } from '../Parsing/CommandStreamCandidates';\nimport { validateEventSources } from '../Parsing/EventSourceValidator';\nimport { validateProjectionTargets } from '../Parsing/ProjectionTargetValidator';\nimport { validateIdentifierCompliance } from '../Parsing/IdentifierComplianceValidator';\nimport { validateEventSubjects } from '../Parsing/EventSubjectValidator';\nimport { validateReactionRefusals } from '../Parsing/ReactionRefusalValidator';\nimport { validateSpecificationRedelivery } from '../Parsing/SpecificationRedeliveryValidator';\nimport { validateGuardedActions } from '../Parsing/GuardedActionValidator';\nimport { validatePersonaCallers } from '../Parsing/PersonaCallerValidator';\nimport { validatePurposes } from '../Parsing/PurposeValidator';\nimport { splitLines } from '../Parsing/SourceLineSplitter';\nimport { ParserContext } from '../Parsing/ParserContext';\nimport { validateResponses } from '../Parsing/ResponseValidator';\nimport { validatePublicEventUsage } from '../Parsing/PublicEventUsageValidator';\nimport { validateOperations } from '../Parsing/OperationValidator';\nimport { CompilationResult, discoverImports, parseForAuthoring } from '../ScreenplayCompiler';\nimport { ApplicationSyntax } from '../Syntax/Structure';\nimport { EventSourceSyntax } from '../Syntax/EventSources';\nimport { EventSourceReadConfidence } from '../Syntax/EventSourceReadConfidence';\nimport { mergeDocuments } from './PlayFolderMerge';\nimport { inMemoryDocumentSource, PlacedPlayDocument, PlayDocumentSource } from './PlayDocumentSource';\nimport { normalizePlayPath } from './PlayGlob';\nimport { resolveImports } from './PlayImports';\nimport { recordAuthoredOrder } from './AuthoredOrder';\nimport { selectOrderingRoot } from './OrderingRoot';\nimport { timelineOrderDiagnostics } from './TimelineOrder';\n\n// One .play document of a folder: its path relative to the folder, and its text.\nexport interface PlayFileSource {\n readonly path: string;\n readonly source: string;\n}\n\n// One application compiled from documents: the documents that make it up, each with where its top level\n// belongs, and the merged syntax with every diagnostic - resolving, parsing and merging.\nexport interface ApplicationCompilation extends CompilationResult<ApplicationSyntax> {\n readonly documents: readonly PlacedPlayDocument[];\n}\n\n// Assembles one application from documents - following their imports from the roots, parsing each where it is\n// placed, and merging the lot. The port of the C# PlayApplicationAssembly.Compile.\nexport function assembleApplication(roots: Iterable<string>, source: PlayDocumentSource, languages?: ReadonlySet<string>, presentationRoot?: string | null): ApplicationCompilation {\n const rootPaths = [...roots];\n const { documents, diagnostics } = resolveImports(rootPaths, source, languages);\n const { result: merged, syntax } = parsePlacedDocumentsWithSyntax(documents, languages);\n // Resolution owns its import inventory; share one discovery between the presentation passes.\n const imports = new Map(documents.map(document => [document.path, discoverImports(document.source, document.path, languages)]));\n const orderingRoot = presentationRoot === null ? undefined : selectOrderingRoot(presentationRoot === undefined ? rootPaths : [presentationRoot], documents, languages, imports);\n if (orderingRoot !== undefined) recordAuthoredOrder(merged.value, [orderingRoot], documents, languages, syntax, imports);\n const timeline = orderingRoot === undefined ? [] : timelineOrderDiagnostics(merged.value);\n const all = [...diagnostics, ...merged.diagnostics, ...timeline];\n return { ...merged, documents, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error') };\n}\n\n// Parses documents whose source identities and placements are already known (for example unsaved\n// editor buffers), then validates contracts against the merged declaration inventory.\nexport function parsePlacedDocuments(documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>): CompilationResult<ApplicationSyntax> & {\n readonly physicalEventSources: readonly { source: EventSourceSyntax; placementResolved: boolean }[];\n readonly sourceInventoryComplete: boolean;\n} {\n return parsePlacedDocumentsWithSyntax(documents, languages).result;\n}\n\nfunction parsePlacedDocumentsWithSyntax(documents: readonly PlacedPlayDocument[], languages?: ReadonlySet<string>) {\n const candidates = CommandStreamCandidates.capturePlaced(documents.filter(document => document.isPlacementResolved !== false).map(document => ({ lines: splitLines(document.source, false, document.path), placement: document.placement })), languages);\n const physical = documents.map(document => parseForAuthoring(document.source, document.path, document.isPlacementResolved === false ? [] : document.placement, false, candidates, languages));\n const physicalEventSources = physical.flatMap((result, index) => (result.value.eventSources ?? []).map(source => ({ source, placementResolved: documents[index].isPlacementResolved !== false })));\n const sourceInventoryComplete = documents.every(document => document.isPlacementResolved !== false) && physical.every(result => !EventSourceReadConfidence.hasUnknownExtent(result.diagnostics));\n const parsed = physical.map((result, index) => documents[index].isPlacementResolved === false ? { ...result, value: { ...result.value, eventSources: [] } } : result);\n const merged = mergeDocuments(parsed);\n const context = new ParserContext(new LineReader([]), undefined, languages);\n if (merged.value.sourceOptions !== undefined) context.sourceOptions = merged.value.sourceOptions;\n validateSpecificationCases(merged.value, context);\n const effective = expandSpecificationExamples(merged.value);\n validateEventSources(merged.value, context);\n validateOperations(merged.value, context);\n validatePublicEventUsage(merged.value, context);\n validateInlineEvents(merged.value, context);\n validateConstraintProperties(merged.value, context);\n validateResponses(effective, context, parsed.flatMap(document => document.inputUses));\n validateProjectionTargets(merged.value, context);\n validateIdentifierCompliance(effective, context);\n validateEventSubjects(merged.value, context);\n validateReactionRefusals(merged.value, context);\n validateSpecificationRedelivery(merged.value, context);\n validateGuardedActions(merged.value, context);\n validatePersonaCallers(merged.value, context);\n validatePurposes(merged.value, context);\n const value = validateDependencyDeclarations(merged.value, context);\n DeclaredDependencies.validate(value, context);\n for (const diagnostic of productionDestinationDiagnostics(value)) context.information(diagnostic.code, diagnostic.message, diagnostic.location);\n const existing = merged.diagnostics;\n const reported = new Set(existing.map(diagnosticKey));\n const all = [...existing, ...context.diagnostics.filter(diagnostic => !reported.has(diagnosticKey(diagnostic)))];\n return {\n result: { ...merged, value, diagnostics: all, success: !all.some(diagnostic => diagnostic.severity === 'error'), physicalEventSources, sourceInventoryComplete },\n syntax: new Map(parsed.map((result, index) => [documents[index].path, result.value])),\n };\n}\n\nfunction diagnosticKey(diagnostic: Diagnostic): string {\n return JSON.stringify([diagnostic.code, diagnostic.location.path, diagnostic.location.line, diagnostic.location.column]);\n}\n\n// Compiles documents held in memory, keyed by portable path, as one application. Without roots every\n// document is a root, in ordinal order of its path - a folder compiled as one application, where a file an\n// import places in a module or feature is placed there. With roots, only those documents and what they import\n// make up the application - a single file compiled with its imports followed. The default sort compares\n// UTF-16 code units, which is the C# ordinal order.\nexport function compileApplication(documents: ReadonlyMap<string, string>, roots?: readonly string[], languages?: ReadonlySet<string>, presentationRoot?: string | null): ApplicationCompilation {\n const normalized = new Map([...documents].map(([path, source]) => [normalizePlayPath(path), source]));\n return assembleApplication(roots ?? [...normalized.keys()].sort(), inMemoryDocumentSource(normalized), languages, presentationRoot);\n}\n\n// Compiles the documents of a folder as one application - the counterpart of the C# CompileFolder. Every\n// document is a root, read in ordinal order of its relative path as the C# compiler reads them, so a merge\n// keeps the same first declaration in either language; one an import places in a module or feature is\n// placed there.\nexport function parseFolder(files: readonly PlayFileSource[], languages?: ReadonlySet<string>): ApplicationCompilation {\n return compileApplication(new Map(files.map(file => [file.path, file.source])), undefined, languages);\n}\n\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// .NET regex \\w accepts these categories per UTF-16 code unit, not supplementary code points.\n// Monarch discards a rule's /u flag. Expand just this class into BMP ranges rather than enabling\n// Unicode mode for the entire grammar (which would change legacy regexes and embedded languages).\nconst word = /[\\p{L}\\p{Mn}\\p{Nd}\\p{Pc}]/u;\nconst escape = (value: number) => `\\\\u${value.toString(16).padStart(4, '0')}`;\nfunction ranges(): string {\n let result = '';\n for (let value = 0; value <= 0xffff; value++) {\n if (!word.test(String.fromCharCode(value))) continue;\n const start = value;\n while (value < 0xffff && word.test(String.fromCharCode(value + 1))) value++;\n result += escape(start) + (value > start ? `-${escape(value)}` : '');\n }\n return result;\n}\nexport const bmpWordCharacters = ranges();\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ApplicationSyntax, eventDeclarations, ExpressionSyntax, FeatureSyntax, PropertyMappingSyntax, SpecificationExampleSyntax, SpecificationSyntax } from '@cratis/screenplay-compiler';\nimport { CompletionEntry, specificationStepItems } from './completion-items';\nimport { ExampleAnalysis } from './ExampleAnalysis';\nimport { FixtureKind } from './FixtureKind';\nimport { withoutComment } from './document-context';\nimport { bmpWordCharacters } from './bmp-word-characters';\n\nconst exampleTypePrefix = new RegExp(`^\\\\s*example\\\\s+[A-Z][${bmpWordCharacters}]*\\\\s*:\\\\s*([${bmpWordCharacters}.]*)$`);\nconst fixtureStepPrefix = new RegExp(`^\\\\s*(given|when|then)\\\\s+(?:(readmodel|append)\\\\s+)?([${bmpWordCharacters}.]*)$`);\n\n// Editor-only projection of parser-owned fixtures. It does not bind, execute, supply defaults,\n// or publish ESM. Scoped candidates use the same nearest-shared-prefix rule as the compiler.\nexport function exampleAnalysis(syntax: unknown, path: string, lines: string[], range: (line: number) => number[], hiddenScopes: ReadonlySet<string>, diagnostics: readonly { severity: string; code: string }[]): ExampleAnalysis {\n const application = syntax as ApplicationSyntax;\n const declarations: { name: string; scope: readonly string[]; fixtureKind?: FixtureKind; example?: SpecificationExampleSyntax }[] = [];\n const rejected = diagnostics.some(diagnostic => diagnostic.severity === 'error')\n ? diagnostics.some(diagnostic => diagnostic.code === 'PLAY0519') ? '**Invalid duplicate assignments; no effective values selected.**' : '**Invalid source; no effective values selected.**'\n : null;\n const contexts = new Map<number, readonly string[]>();\n const specifications: { node: SpecificationSyntax; scope: readonly string[] }[] = [];\n const own = (node: { location: { path?: string; line: number } }, scope: readonly string[]) => {\n if (node.location.path === path && node.location.line > 0) for (const line of range(node.location.line - 1)) contexts.set(line, scope);\n };\n const examples = (nodes: readonly SpecificationExampleSyntax[] | undefined, scope: readonly string[]) => {\n for (const example of nodes ?? []) { declarations.push({ name: example.name, scope, example }); own(example, scope); }\n };\n examples(application.examples, []);\n declarations.push(...[...application.concepts, ...application.types].map(node => ({ name: node.name, scope: [] })));\n const features = (nodes: readonly FeatureSyntax[], parent: readonly string[]) => {\n for (const feature of nodes) {\n const scope = [...parent, feature.name];\n own(feature, scope);\n examples(feature.examples, scope);\n for (const slice of feature.slices) {\n const scope = [...parent, feature.name, slice.name];\n own(slice, scope);\n examples(slice.examples, scope);\n const events = new Map<string, ReturnType<typeof eventDeclarations>[number][]>();\n for (const event of eventDeclarations(slice)) events.set(event.name, [...events.get(event.name) ?? [], event]);\n for (const generations of events.values()) {\n const latest = Math.max(...generations.map(event => event.generation));\n declarations.push(...generations.filter(event => event.generation === latest).map(event => ({ name: event.name, scope, fixtureKind: FixtureKind.Event })));\n }\n declarations.push(...slice.commands.map(node => ({ name: node.name, scope, fixtureKind: FixtureKind.Command })),\n ...slice.readModels.map(node => ({ name: node.name, scope, fixtureKind: FixtureKind.ReadModel })));\n for (const node of slice.specifications) { specifications.push({ node, scope }); own(node, scope); examples(node.examples, scope); }\n }\n features(feature.features, scope);\n }\n };\n for (const module of application.modules) {\n own(module, [module.name]);\n examples(module.examples, [module.name]);\n features(module.features, [module.name]);\n }\n const candidates = (reference: string, scope: readonly string[]) => {\n const parts = reference.split('.');\n const named = declarations.filter(node => node.name === parts.at(-1));\n const qualifiers = parts.slice(0, -1);\n if (qualifiers.length) return named.filter(node => qualifiers.length <= node.scope.length && qualifiers.every((part, index) => node.scope[node.scope.length - qualifiers.length + index] === part));\n for (let depth = scope.length; depth >= 0; depth--) {\n const visible = named.filter(node => depth <= node.scope.length && scope.slice(0, depth).every((part, index) => node.scope[index] === part));\n if (visible.length) return visible;\n }\n return [];\n };\n const unique = (reference: string, scope: readonly string[]) => {\n const matches = candidates(reference, scope);\n return matches.length === 1 ? matches[0] : undefined;\n };\n const kind = (node: typeof declarations[number]): FixtureKind | undefined => node.example ? unique(node.example.type, node.scope)?.fixtureKind : node.fixtureKind;\n const display = (node: typeof declarations[number]) => [...node.scope.filter(part => !hiddenScopes.has(part)), node.name].join('.');\n const targets = (scope: readonly string[], expected?: FixtureKind, typesOnly = false, prefix = ''): CompletionEntry[] => declarations.flatMap(node => {\n const fixtureKind = kind(node);\n if (!fixtureKind || (expected && fixtureKind !== expected) || (typesOnly && node.example)) return [];\n // A full scope-qualified spelling is the fallback for a shadowed declaration. Never\n // suggest a name that resolves to a competitor or an ambiguous declaration.\n const full = [...node.scope, node.name].join('.');\n const name = unique(node.name, scope) === node ? node.name : full;\n if (unique(name, scope) !== node) return [];\n const qualifiers = prefix.split('.').slice(0, -1).join('.');\n if (qualifiers && !full.endsWith(`${qualifiers}.${node.name}`)) return [];\n if (name === full && node.scope.some(part => hiddenScopes.has(part)) && unique(node.name, scope) !== node) return [];\n return [{ label: unique(node.name, scope) === node ? node.name : display(node), insertText: qualifiers ? node.name : name,\n documentation: node.example ? `Example of ${node.example.type}. Step assignments override example values; no implicit defaults.` : `Declared ${fixtureKind}.` }];\n });\n const effective = (example: SpecificationExampleSyntax | undefined, values: readonly PropertyMappingSyntax[], generated: readonly PropertyMappingSyntax[], destination: ExpressionSyntax | null, authoredRoute?: Pick<SpecificationExampleSyntax, 'stream' | 'noStream'>) => {\n if (rejected) return rejected;\n const merge = (base: readonly PropertyMappingSyntax[], overrides: readonly PropertyMappingSyntax[], prefix = '') => {\n if (new Set(base.map(value => value.property)).size !== base.length || new Set(overrides.map(value => value.property)).size !== overrides.length) return null;\n const result = new Map(base.map(value => [value.property, { value, origin: 'example', replaced: undefined as PropertyMappingSyntax | undefined }]));\n for (const value of overrides) {\n const replaced = result.get(value.property)?.value;\n result.delete(value.property);\n result.set(value.property, { value, origin: replaced ? 'override' : 'authored', replaced });\n }\n return [...result.values()].map(({ value, origin, replaced }) => `${prefix}${value.property} = ${expressionText(value.source)} \u2014 ${origin}${origin === 'example' ? ` ${example!.name}` : ''}${replaced ? ` (replaces ${expressionText(replaced.source)} from ${example!.name})` : ''}`);\n };\n const properties = merge(example?.values ?? [], values);\n const fixtures = merge(example?.generatedValues ?? [], generated, 'generated ');\n if (!properties || !fixtures) return '**Invalid duplicate assignments; no effective values selected.**';\n const selected = destination ?? example?.for;\n const priorRoute = example?.stream ?? example?.noStream;\n const replacementRoute = authoredRoute?.stream ?? authoredRoute?.noStream;\n const route = replacementRoute ?? priorRoute;\n const routeText = (value: NonNullable<typeof route>): string => value.kind === 'SpecificationNoStreamSyntax' ? 'no stream' :\n `stream ${value.eventSource}.${value.stream}${value.streamId ? ` streamId = ${expressionText(value.streamId.source)}` : value.streamIdParts.length ? ` streamId ${value.streamIdParts.map(part => `${part.property} = ${expressionText(part.source)}`).join(', ')}` : ''}`;\n const routing = route ? [`${routeText(route)} \u2014 ${replacementRoute ? priorRoute ? `override (replaces ${routeText(priorRoute)} from ${example!.name})` : 'authored' : `example ${example!.name}`}`] : [];\n return [...properties, ...fixtures, ...routing, ...(selected ? [`for ${expressionText(selected)} \u2014 ${destination ? example?.for ? `override (replaces ${expressionText(example.for)} from ${example.name})` : 'authored' : `example ${example!.name}`}`] : [])].join('\\n');\n };\n const hovers = new Map<number, { start: number; length: number; content: string }>();\n for (const declaration of declarations.filter(node => node.example?.location.path === path)) {\n const example = declaration.example!;\n const line = example.location.line - 1;\n const prefix = withoutComment(lines[line] ?? '').match(/^\\s*example\\s+/)?.[0];\n if (prefix) hovers.set(line, { start: prefix.length + 1, length: example.name.length, content: `**example ${display(declaration)} : ${example.type}**\\n\\n${kind(declaration) ? effective(example, [], [], null) : 'Unresolved or ambiguous type; no effective values selected.'}` });\n }\n for (const { node, scope } of specifications) {\n const steps = [\n ...node.given.map(step => ({ step, name: step.eventType, expected: FixtureKind.Event, values: step.values, generated: [], destination: step.for, prefix: /^\\s*given\\s+/ })),\n ...node.givenReadModels.map(step => ({ step, name: step.name, expected: FixtureKind.ReadModel, values: step.properties, generated: [], destination: null, prefix: /^\\s*given\\s+readmodel\\s+/ })),\n ...(node.when ? [{ step: node.when, name: node.when.commandType, expected: FixtureKind.Command, values: node.when.values, generated: node.when.generatedValues ?? [], destination: node.when.for, prefix: /^\\s*when\\s+/ }] : []),\n ...(node.whenAppended ? [{ step: node.whenAppended, name: node.whenAppended.eventType, expected: FixtureKind.Event, values: node.whenAppended.values, generated: [], destination: node.whenAppended.for, prefix: /^\\s*when\\s+append\\s+/ }] : []),\n ...node.thenEvents.map(step => ({ step, name: step.eventType, expected: FixtureKind.Event, values: step.values, generated: [], destination: step.for, prefix: /^\\s*then\\s+/ })),\n ...node.thenReadModels.map(step => ({ step, name: step.name, expected: FixtureKind.ReadModel, values: step.properties, generated: [], destination: null, prefix: /^\\s*then\\s+readmodel\\s+/ })),\n ];\n for (const { step, name, expected, values, generated, destination, prefix } of steps.filter(entry => entry.step.location.path === path)) {\n const resolved = unique(name, scope);\n const competing = candidates(name, scope).some(node => node.example);\n if (!resolved?.example && (resolved || !competing)) continue;\n const line = step.location.line - 1;\n const start = withoutComment(lines[line] ?? '').match(prefix)?.[0].length;\n if (start === undefined) continue;\n const content = !resolved ? '**Ambiguous example; no effective values selected.**' : kind(resolved) !== expected ? '**Example kind mismatch; no effective values selected.**'\n : `**${expected} ${resolved.example?.type ?? name}${resolved.example ? ` \u2014 example ${display(resolved)}` : ''}**\\n\\n${effective(resolved.example, values, generated, destination, 'eventType' in step ? step : undefined)}\\n\\nAuthored fixture values, not execution results. Matching is unchanged.`;\n hovers.set(line, { start: start + 1, length: name.length, content });\n }\n }\n return {\n eventExamples: declarations.filter(declaration => declaration.example?.location.path === path && kind(declaration) === FixtureKind.Event).map(declaration => declaration.example!),\n completions(line, before) {\n const scope = contexts.get(line) ?? [];\n const header = before.match(exampleTypePrefix);\n if (header) return targets(scope, undefined, true, header[1]);\n // A parser-rejected incomplete step still belongs to its specification's range.\n const inSpecification = specifications.some(({ node }) => node.location.path === path && range(node.location.line - 1).includes(line));\n if (!inSpecification) return null;\n const step = before.match(fixtureStepPrefix);\n if (!step) return null;\n if (['clock', 'caller', 'capture', 'trigger', 'query', 'result', 'error', 'denied', 'returns', 'no', 'operation', 'compensated'].includes(step[3])) return null;\n const expected = step[2] === 'readmodel' ? FixtureKind.ReadModel : step[2] === 'append' || step[1] !== 'when' ? FixtureKind.Event : FixtureKind.Command;\n const entries = targets(scope, expected, false, step[3]);\n // Keep the existing planner's keyword behavior when there are no fixture targets.\n if (!entries.length) return null;\n return step[2] ? entries : [...specificationStepItems[step[1] as 'given' | 'when' | 'then'], ...entries];\n },\n hover(line, start, end) {\n const hover = hovers.get(line);\n return hover && start >= hover.start && end <= hover.start + hover.length ? hover.content : null;\n },\n };\n}\n\nfunction expressionText(expression: ExpressionSyntax): string {\n switch (expression.kind) {\n case 'LiteralExpressionSyntax': return typeof expression.value === 'object' && expression.value !== null ? expression.value.value : JSON.stringify(expression.value);\n case 'ListExpressionSyntax': return `[${expression.items.map(expressionText).join(', ')}]`;\n case 'ObjectExpressionSyntax': return `{ ${expression.members.map(member => `${JSON.stringify(member.name)}: ${expressionText(member.value)}`).join(', ')} }`;\n case 'RawExpressionSyntax': return expression.text;\n case 'CaseValueExpressionSyntax': return `case.${expression.parameter}`;\n case 'PathExpressionSyntax': return expression.path;\n case 'ContextExpressionSyntax': return `$context.${expression.path}`;\n case 'IdentityExpressionSyntax': return `$identity.${expression.path}`;\n case 'EventContextExpressionSyntax': return `$eventContext.${expression.path}`;\n case 'RefusalExpressionSyntax': return `$refusal.${expression.member}`;\n case 'EventSourceIdExpressionSyntax': return '$eventSourceId';\n case 'CausedByExpressionSyntax': return `$causedBy${expression.property ? `.${expression.property}` : ''}`;\n case 'EnvironmentExpressionSyntax': return `$env.${expression.name}`;\n case 'StringsExpressionSyntax': return `$strings.${expression.key}`;\n case 'SourceItemExpressionSyntax': return `$.${expression.path}`;\n case 'TemplateExpressionSyntax': return '`' + expression.parts.map(part => part.kind === 'TemplateTextSyntax' ? part.text : '${' + expressionText(part.expression) + '}').join('') + '`';\n }\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ApplicationSyntax, synthesizePersonaCaller } from '@cratis/screenplay-compiler';\nimport { CompletionEntry } from './completion-items';\nimport { withoutComment } from './document-context';\nimport { bmpWordCharacters } from './bmp-word-characters';\n\nconst callerPrefix = new RegExp(`^\\\\s*given caller as\\\\s+[${bmpWordCharacters}]*$`);\nconst personaLine = new RegExp(`^\\\\s*(?:given caller as|persona)\\\\s+([A-Za-z_][${bmpWordCharacters}]*)\\\\s*$`);\n\nexport function personaAnalysis(syntax: unknown, lines: string[]) {\n const application = syntax as ApplicationSyntax;\n const results = new Map(application.personas.map(persona => [persona.name, synthesizePersonaCaller(persona, application)]));\n return {\n completions(_line: number, before: string): CompletionEntry[] | null {\n if (withoutComment(before).length < before.length || !callerPrefix.test(before)) return null;\n return application.personas.map(persona => ({ label: persona.name, insertText: persona.name, documentation: 'Authenticated deterministic witness of this persona. Negation, needed nonliteral claims, role-URI claims, implementations and policyless personas require an explicit caller.' }));\n },\n hover(line: number, start: number, end: number): string | null {\n const text = withoutComment(lines[line] ?? '');\n const match = personaLine.exec(text);\n if (!match || text.slice(start - 1, end - 1) !== match[1]) return null;\n const result = results.get(match[1]);\n if (!result) return null;\n if (result.refusal) return `**${match[1]} caller** \u2014 ${result.refusal.reason}${result.refusal.policy ? ` in policy ${result.refusal.policy}` : ''}. Use an explicit \\`given caller\\`.`;\n return `**${match[1]} caller** \u2014 authenticated.\\n\\nRoles: ${result.caller!.roles.map(role => JSON.stringify(role)).join(', ') || '(none)'}.\\n\\nClaims: ${result.caller!.claims.map(claim => `${JSON.stringify(claim.type)} = ${JSON.stringify(claim.value)}`).join(', ') || '(none)'}.\\n\\nContributions: ${result.contributions.map(atom => `${atom.policy}: ${atom.kind}${atom.type ? ` ${JSON.stringify(atom.type)}` : ''} ${JSON.stringify(atom.value)}`).join('; ')}. This witnesses one deterministic minimal caller, not every caller fitting the persona.`;\n },\n };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { ApplicationSyntax, DeclaredDependencyTargets, FeatureSyntax } from '@cratis/screenplay-compiler';\nimport { CompletionEntry } from './completion-items';\n\n// Keep compiler-owned resolution private to this cached analysis. Its public shape only contains\n// editor entries, never compiler syntax or container types.\nexport function dependencyTargetAnalysis(syntax: unknown, localSyntax: unknown, path: string, range: (line: number) => number[], hiddenScopes: ReadonlySet<string>): {\n completions(line: number, qualifier: string, placement?: readonly string[]): CompletionEntry[];\n} {\n const application = syntax as ApplicationSyntax;\n const local = localSyntax as ApplicationSyntax;\n const containers = DeclaredDependencyTargets.containersOf(application).filter(container => ![...container.scope, container.name].some(part => hiddenScopes.has(part)));\n const contexts = new Map<number, readonly string[]>();\n const declared = new Map<string, { target: string; path?: string; line: number }[]>();\n const inventory = (nodes: readonly { name: string; location: { path?: string; line: number }; dependsOn?: readonly { target: string; location: { path?: string; line: number } }[]; features: readonly FeatureSyntax[] }[], parent: readonly string[], sourceLocal: boolean): void => {\n for (const node of nodes) {\n const address = [...parent, node.name];\n if (sourceLocal) {\n if (node.location.path === path && node.location.line > 0) for (const line of range(node.location.line - 1)) contexts.set(line, address);\n } else {\n const key = address.join('.');\n declared.set(key, [...declared.get(key) ?? [], ...(node.dependsOn ?? []).map(dependency => ({ target: dependency.target, ...dependency.location }))]);\n }\n inventory(node.features, address, sourceLocal);\n }\n };\n inventory(application.modules, [], false);\n inventory(local.modules, [], true);\n return {\n completions(line, qualifier, placement) {\n const from = contexts.get(line) ?? placement;\n if (!from?.length || from.some(part => hiddenScopes.has(part)) || !containers.some(container => [...container.scope, container.name].join('.') === from.join('.'))) return [];\n const existing = new Set((declared.get(from.join('.')) ?? []).filter(dependency => dependency.path !== path || dependency.line !== line + 1)\n .map(dependency => DeclaredDependencyTargets.resolve(dependency.target, from, containers).resolved));\n return DeclaredDependencyTargets.candidates(from, containers).flatMap(({ container, reference, tier }) => {\n if (existing.has(container)) return [];\n const address = [...container.scope, container.name].join('.');\n if (qualifier) {\n // A typed qualification may be longer than the shortest candidate spelling.\n reference = qualifier + container.name;\n if (DeclaredDependencyTargets.resolve(reference, from, containers).resolved !== container) return [];\n }\n const relation = container.scope.length === 0 ? 'module'\n : tier === 0 ? 'sibling feature'\n : tier !== 'qualified' ? `feature of ${container.scope.join('.')}` : `feature in ${container.scope.join('.')}`;\n const order = containers.indexOf(container);\n return [{ label: qualifier ? container.name : reference, insertText: qualifier ? container.name : reference,\n documentation: `${address} \u2014 ${relation}.`, detail: relation,\n sortText: `${String(tier === 'qualified' ? from.length : tier).padStart(6, '0')}:${String(order).padStart(6, '0')}` }];\n });\n },\n };\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { AuthoringProductionKind, AuthoringProductionResolver, CommandSyntax, Diagnostic, EventSourceReadConfidence, FeatureSyntax, OperationSyntax, parseForAuthoring, parsePlacedDocuments, SpecificationSyntax } from '@cratis/screenplay-compiler';\nimport { fenceMap, indentOf, withoutComment } from './document-context';\nimport { AuthoredSpecificationEvent } from './AuthoredSpecificationEvent';\nimport { ResponseAnalysis } from './ResponseAnalysis';\nimport { ExampleAnalysis } from './ExampleAnalysis';\nimport { exampleAnalysis } from './example-analysis';\nimport { personaAnalysis } from './persona-analysis';\nimport { dependencyTargetAnalysis } from './dependency-target-analysis';\nimport { EventSourceAnalysis } from './EventSourceAnalysis';\nimport { AuthoredCommandRoute } from './AuthoredCommandRoute';\nimport { AuthoringDocument } from './AuthoringDocument';\nimport { OperationAnalysis, OperationDeclaration, OperationReference } from './OperationAnalysis';\n\n// Public editor shapes are structural: packed declarations never expose the private compiler.\nexport type { AuthoringDocument } from './AuthoringDocument';\nexport type { AnalysisLocation } from './AnalysisLocation';\nexport type { AnalysisDiagnostic } from './AnalysisDiagnostic';\nexport type { AnalysisType } from './AnalysisType';\nexport type { AnalysisCommand } from './AnalysisCommand';\nexport type { AnalysisSpecification } from './AnalysisSpecification';\nexport type { CommandResponseSymbol } from './CommandResponseSymbol';\nexport type { ResponseFieldSymbol } from './ResponseFieldSymbol';\nexport type { ResponseSourceSymbol } from './ResponseSourceSymbol';\nexport type { ResponseAnalysis } from './ResponseAnalysis';\n\nexport const responseAvailability = 'Executable as ESM v7. Generated values require fixtures in reference execution; other unadmitted constructs still prevent binding.';\n\n// A bounded revision cache shared by symbols, validation, completion and hover. Index typed nodes\n// once, not by reparsing the document for each command or response field.\nconst revisions = new Map<string, ReturnType<typeof analyze>>();\n\nfunction authoringSource(lines: string[], headers: readonly string[]) {\n const fences = fenceMap(lines);\n const roots = lines.flatMap((line, index) => !fences[index] && indentOf(line) === 0 && /^\\w/.test(line) ? [line.split(/\\s+/)[0]] : []);\n if (roots.includes('module') || !roots.some(root => ['feature', 'slice', 'command', 'event', 'operation', 'reaction', 'specification'].includes(root))) {\n return { source: lines.join('\\n'), locations: lines.map((_, index) => ({ line: index + 1, column: 0 })) };\n }\n // Isolated slice/command fragments are a supported editor input. Global declarations stay global.\n const globals: number[] = [];\n const body: number[] = [];\n let global = false;\n lines.forEach((line, index) => {\n if (!fences[index] && indentOf(line) === 0 && /^\\w/.test(line)) global = /^(?:concept|type|import|domain|system|eventsource|policy|persona|identity)\\b/.test(line);\n (global ? globals : body).push(index);\n });\n const depth = roots.includes('feature') ? 1 : roots.includes('slice') ? 2 : 3;\n const wrappers = headers.slice(0, depth);\n const source = [...globals.map(index => lines[index]), ...wrappers, ...body.map(index => ' '.repeat(depth * 2) + lines[index])].join('\\n');\n const locations = [...globals.map(index => ({ line: index + 1, column: 0 })), ...wrappers.map(() => ({ line: 0, column: 0 })), ...body.map(index => ({ line: index + 1, column: depth * 2 }))];\n return { source, locations };\n}\n\nfunction analyze(lines: string[], otherSources: readonly (string | AuthoringDocument)[], placement?: readonly string[], path = 'current.play', isPlacementResolved = true): ResponseAnalysis & { readonly operations: OperationAnalysis; readonly eventSources: EventSourceAnalysis; readonly examples: ExampleAnalysis; readonly personas: ReturnType<typeof personaAnalysis>; readonly dependencies: ReturnType<typeof dependencyTargetAnalysis> } {\n const others = otherSources.map((document, index) => typeof document === 'string' ? { path: `other-${index}.play`, source: document } : document).filter(document => document.path !== path);\n const documents: AuthoringDocument[] = [{ path, source: lines.join('\\n'), placement, isPlacementResolved }, ...others];\n // Modules/features merge, but slices are real declarations: equal slice names discard later\n // documents. Share only fresh synthetic module/feature names, with a distinct synthetic slice\n // per fragment. This retains all commands for normal (including ambiguous) scope resolution,\n // without combining source texts or renaming real declarations/explicit placements. Reserve\n // source/placement names once so even a real Editor.Authoring.Fragment cannot collide.\n const names = new Set(documents.flatMap(document => [...document.source.matchAll(/\\w+/g)].map(match => match[0]).concat(document.placement ?? [])));\n const fresh = (prefix: string): string => {\n let name = prefix;\n for (let suffix = 1; names.has(name); suffix++) name = `${prefix}${suffix}`;\n names.add(name);\n return name;\n };\n const module = fresh('EditorAuthoring');\n const feature = fresh('FragmentFeature');\n const syntheticScopes = new Set([module, feature]);\n const preparedDocuments = documents.map((document, index) => {\n const sourceLines = index === 0 ? lines : document.source.split('\\n');\n const fragment = fresh(`Fragment${index}`);\n syntheticScopes.add(fragment);\n const prepared = document.placement?.length ? { source: document.source, locations: sourceLines.map((_, line) => ({ line: line + 1, column: 0 })) }\n : authoringSource(sourceLines, [`module ${module}`, ` feature ${feature}`, ` slice StateChange ${fragment}`]);\n return { ...document, ...prepared, placement: document.placement ?? [] };\n });\n const prepared = preparedDocuments[0];\n const locations = new Map(preparedDocuments.map(document => [document.path, document.locations]));\n // Put the buffer after its supplied context so duplicate real declarations are reported at\n // the current source, not silently dropped from its source-local diagnostic view.\n const parsed = parsePlacedDocuments([...preparedDocuments.slice(1), prepared]);\n const commands = new Map<number, CommandSyntax>();\n const specifications = new Map<number, SpecificationSyntax>();\n const visited = new WeakSet<object>();\n const walk = (value: unknown): void => {\n if (value === null || typeof value !== 'object' || visited.has(value)) return;\n visited.add(value);\n if (Array.isArray(value)) { value.forEach(walk); return; }\n const node = value as Record<string, unknown>;\n // Source locations also occur as standalone members (usesLocation, targetLocation).\n // Mutate each original identity once: shared locations must not be shifted twice.\n if (typeof node.path === 'string' && typeof node.line === 'number' && typeof node.column === 'number') {\n const original = locations.get(node.path)?.[node.line - 1];\n if (original) { node.line = original.line; node.column = Math.max(1, node.column - original.column); }\n return;\n }\n for (const child of Object.values(node)) walk(child);\n if ((node.location as { path?: string; line: number } | undefined)?.path === path) {\n if (node.kind === 'CommandSyntax') commands.set((node.location as { line: number }).line - 1, value as CommandSyntax);\n if (node.kind === 'SpecificationSyntax') specifications.set((node.location as { line: number }).line - 1, value as SpecificationSyntax);\n }\n };\n walk(parsed.value);\n walk(parsed.physicalEventSources);\n // Fragment wrappers must not turn an unread original root into confidence evidence.\n // Retain the parser's unknown-owner diagnostic at its original physical root location.\n for (const diagnostic of parsed.diagnostics) walk(diagnostic.location);\n const unknownFragmentExtent = parsed.diagnostics.some(diagnostic => {\n if (!['PLAY0022', 'PLAY0024', 'PLAY0029'].includes(diagnostic.code)) return false;\n const document = preparedDocuments.find(document => document.path === diagnostic.location.path);\n const original = documents.find(document => document.path === diagnostic.location.path)?.source.split('\\n')[diagnostic.location.line - 1];\n return document?.locations.some(location => location.line === 0) && original !== undefined && indentOf(original) === 0;\n });\n const diagnostics: Diagnostic[] = parsed.diagnostics.filter(diagnostic => diagnostic.location.path === path).flatMap(diagnostic => {\n walk(diagnostic.location);\n return diagnostic.location.line > 0 ? [diagnostic] : [];\n });\n const productions = new AuthoringProductionResolver(parsed.value);\n const operationProductionLines = new Set(productions.slices.flatMap(({ slice }) => [...slice.commands.flatMap(command => command.produces), ...slice.reactions.flatMap(reaction => reaction.triggers).flatMap(trigger => trigger.produces)]\n .filter(production => production.location.path === path && !productions.isEventProduction(production, slice))\n .map(production => production.location.line - 1)));\n // Rejected inline operation declarations have no syntax node, but the core parser still owns\n // the command-only kind fact. Retain it rather than suggesting an event declaration repair.\n for (const diagnostic of diagnostics) if (diagnostic.code === 'PLAY0499') operationProductionLines.add(diagnostic.location.line - 1);\n const declarations: OperationDeclaration[] = productions.declarations.filter(declaration => declaration.kind === AuthoringProductionKind.Operation)\n .map(declaration => ({ ...declaration.node as OperationSyntax, scope: declaration.scope.filter(segment => !syntheticScopes.has(segment)) }));\n const contexts = new Map<number, { scope: readonly string[]; commandLine?: number; operation?: OperationDeclaration; production?: OperationReference }>();\n // Index source ownership once per revision. Typed headers, not keyword-shaped properties,\n // define the ranges; greater-indented legacy properties remain leaves.\n const fences = fenceMap(lines);\n const range = (start: number): number[] => {\n const result: number[] = [];\n const indent = indentOf(lines[start]);\n for (let line = start; line < lines.length; line++) {\n if (line > start && !fences[line] && withoutComment(lines[line]).trim() && indentOf(lines[line]) <= indent) break;\n result.push(line);\n }\n return result;\n };\n for (const { slice, scope } of productions.slices) {\n if (slice.location.path === path && slice.location.line > 0) for (const line of range(slice.location.line - 1)) contexts.set(line, { scope });\n for (const specification of slice.specifications.filter(specification => specification.location.path === path && specification.location.line > 0)) {\n for (const line of range(specification.location.line - 1)) contexts.set(line, { scope });\n }\n for (const command of slice.commands.filter(command => command.location.path === path && command.location.line > 0)) {\n for (const line of range(command.location.line - 1)) contexts.set(line, { scope, commandLine: command.location.line - 1 });\n }\n }\n const declarationScopes = new Map(productions.declarations.map(declaration => [declaration.node.location, declaration.scope]));\n for (const operation of declarations.filter(operation => operation.location.path === path)) {\n const scope = declarationScopes.get(operation.location)!;\n for (const line of range(operation.location.line - 1)) contexts.set(line, { ...contexts.get(line), scope, operation });\n }\n const declarationsByLocation = new Map(declarations.map(declaration => [declaration.location, declaration]));\n const referenceLocation = (location: { path?: string; line: number; column: number }, name: string) => {\n const source = withoutComment(lines[location.line - 1] ?? '');\n const prefix = source.slice(location.column - 1).match(/^(?:given\\s+operation|then\\s+(?:operation|compensated))\\s+/)?.[0];\n return prefix && source.slice(location.column - 1 + prefix.length, location.column - 1 + prefix.length + name.length) === name\n ? { ...location, column: location.column + prefix.length } : location;\n };\n const references: OperationReference[] = [];\n for (const { slice } of productions.slices) {\n for (const command of slice.commands) for (const production of command.produces) {\n if (production.location.path !== path) continue;\n const resolved = productions.resolve(production.event, slice);\n const declaration = resolved.declaration ? declarationsByLocation.get(resolved.declaration.node.location) ?? null : null;\n const reference = { name: production.event, location: production.location, targetLocation: production.targetLocation ?? production.location, kind: resolved.kind, declaration, mappings: production.mappings };\n references.push(reference);\n if (resolved.kind === AuthoringProductionKind.Operation) {\n for (const line of range(production.location.line - 1)) {\n const context = contexts.get(line);\n if (context) contexts.set(line, { ...context, production: reference });\n }\n }\n }\n for (const specification of slice.specifications) {\n for (const step of [...specification.givenOperationFailures ?? [], ...specification.thenOperations ?? [], ...specification.thenCompensated ?? []]) {\n if (step.location.path !== path) continue;\n const resolved = productions.resolve(step.operation, slice);\n references.push({ name: step.operation, location: step.location, targetLocation: referenceLocation(step.location, step.operation), kind: resolved.kind,\n declaration: resolved.declaration ? declarationsByLocation.get(resolved.declaration.node.location) ?? null : null,\n mappings: [] });\n }\n }\n }\n const operations: OperationAnalysis = { declarations, systems: parsed.value.systems ?? [], references, contexts, types: parsed.value.types, concepts: parsed.value.concepts,\n targets: scope => {\n const slice = productions.slices.find(entry => entry.scope.length === scope.length && entry.scope.every((part, index) => part === scope[index]))?.slice;\n if (!slice) return [];\n return declarations.flatMap(declaration => {\n const name = productions.resolve(declaration.name, slice).declaration?.node.location === declaration.location\n ? declaration.name : [...declaration.scope, declaration.name].join('.');\n return productions.resolve(name, slice).kind === AuthoringProductionKind.Operation &&\n productions.resolve(name, slice).declaration?.node.location === declaration.location ? [{ name, declaration }] : [];\n });\n }\n };\n const sourceDeclarations = parsed.physicalEventSources.map(entry => entry.source);\n const sourceCatalog = new EventSourceReadConfidence(parsed.physicalEventSources, parsed.sourceInventoryComplete && !unknownFragmentExtent);\n const resolutions = new Map<string, ReturnType<EventSourceReadConfidence['resolve']>>();\n const resolve = (source: string, stream?: string) => {\n const key = JSON.stringify([source, stream]);\n let result = resolutions.get(key);\n if (!result) { result = sourceCatalog.resolve(source, stream); resolutions.set(key, result); }\n return { ...result, source: result.state === 'unique' ? result.sources[0] : undefined, stream: result.state === 'unique' ? result.streams[0] : undefined };\n };\n const importedTypeReferences = new Set(parsed.value.imports.map(imported => imported.qualifiedName));\n const targets = sourceDeclarations.flatMap(source => {\n return source.streams.filter(stream => resolve(source.name, stream.name).state === 'unique' && !importedTypeReferences.has(`${source.name}.${stream.name}`)).map(stream => ({ name: `${source.name}.${stream.name}`, source, stream }));\n });\n const sourceContexts = new Map<number, { command?: CommandSyntax; event?: AuthoredSpecificationEvent; expectation?: boolean; route?: AuthoredCommandRoute; source?: typeof sourceDeclarations[number]; stream?: typeof sourceDeclarations[number]['streams'][number] }>();\n const routes: AuthoredCommandRoute[] = [];\n for (const command of commands.values()) {\n for (const line of range(command.location.line - 1)) sourceContexts.set(line, { command });\n for (const member of [...command.produces, ...command.validations, ...(command.handler ? [command.handler] : [])])\n for (const line of range(member.location.line - 1)) sourceContexts.delete(line);\n // Retained ambiguity candidates are not selected authored routes.\n if (command.stream) {\n routes.push(command.stream);\n for (const line of range(command.stream.location.line - 1)) sourceContexts.set(line, { command, route: command.stream });\n }\n }\n const examples = exampleAnalysis(parsed.value, path, lines, range, syntheticScopes, parsed.diagnostics);\n const routeOwners = [\n ...[...specifications.values()].flatMap(specification => [\n ...specification.given.map(event => ({ event, expectation: false })),\n ...(specification.whenAppended ? [{ event: specification.whenAppended, expectation: false }] : []),\n ...specification.thenEvents.map(event => ({ event, expectation: true })),\n ...(specification.whenRedelivered ? [{ event: specification.whenRedelivered, expectation: true }] : [])\n ]),\n ...(examples.eventExamples ?? []).map(event => ({ event, expectation: true }))\n ];\n for (const context of routeOwners) {\n const event = context.event;\n for (const line of range(event.location.line - 1)) sourceContexts.set(line, context);\n if (event.stream) {\n routes.push(event.stream);\n for (const line of range(event.stream.location.line - 1)) sourceContexts.set(line, { ...context, route: event.stream });\n }\n }\n for (const source of sourceDeclarations.filter(source => source.location.path === path)) {\n for (const line of range(source.location.line - 1)) sourceContexts.set(line, { source });\n for (const stream of source.streams) for (const line of range(stream.location.line - 1)) sourceContexts.set(line, { source, stream });\n }\n const ambiguousCandidates = [...commands.values()].flatMap(command => command.streamCandidates ?? []).filter(candidate => candidate.propertyCandidate !== null);\n const eventSources: EventSourceAnalysis = { declarations: sourceDeclarations, routes, ambiguousCandidates, contexts: sourceContexts, targets, resolve };\n let dependencyAnalysis: ReturnType<typeof dependencyTargetAnalysis> | undefined;\n const dependencies: ReturnType<typeof dependencyTargetAnalysis> = {\n completions(line, qualifier, placement) {\n if (dependencyAnalysis === undefined) {\n // Merging restated headers retains the first header's location. Index physical typed\n // headers only when needed, so later fragments still own their incomplete lines.\n const localDependencies = parseForAuthoring(prepared.source, path, prepared.placement, false).value;\n const remapDependencyHeaders = (node: typeof localDependencies.modules[number] | FeatureSyntax): void => {\n walk(node.location);\n node.features.forEach(remapDependencyHeaders);\n };\n localDependencies.modules.forEach(remapDependencyHeaders);\n dependencyAnalysis = dependencyTargetAnalysis(parsed.value, localDependencies, path, range, syntheticScopes);\n }\n return dependencyAnalysis.completions(line, qualifier, placement);\n },\n };\n const identityDetails = (parsed.value.identity?.details ?? []).map(detail => ({ name: detail.name, type: `${detail.type.name}${detail.type.isCollection ? '[]' : ''}${detail.type.isOptional ? ' optional' : ''}`, line: detail.location.line - 1 }));\n return { identityDetails, commands, specifications, diagnostics, operationProductionLines, operations, eventSources, examples, personas: personaAnalysis(parsed.value, lines), dependencies };\n}\n\nexport function responseAnalysis(lines: string[], otherSources: readonly (string | AuthoringDocument)[] = [], placement?: readonly string[], path = 'current.play', isPlacementResolved = true): ResponseAnalysis & { readonly operations: OperationAnalysis; readonly eventSources: EventSourceAnalysis; readonly examples: ExampleAnalysis; readonly personas: ReturnType<typeof personaAnalysis>; readonly dependencies: ReturnType<typeof dependencyTargetAnalysis> } {\n const key = JSON.stringify([lines, otherSources, placement, path, isPlacementResolved]);\n let analysis = revisions.get(key);\n if (analysis === undefined) {\n analysis = analyze(lines, otherSources, placement, path, isPlacementResolved);\n if (revisions.size >= 16) revisions.delete(revisions.keys().next().value!);\n revisions.set(key, analysis);\n }\n return analysis;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { fenceMap, firstWord, indentOf } from './document-context';\n\n// The keyword the directive opens with \u2014 the single word the language points at a file with.\nexport const fileReferenceKeyword = 'file';\n\n// A `file <path>` directive, with the path exactly as written and the span it occupies on its line.\n// The span is measured against the raw line, and its columns are one-based like every other position\n// this package reports, so an editor places a range on it the same way it does a validation issue.\nexport interface FileReference {\n path: string;\n line: number;\n startColumn: number;\n endColumn: number;\n}\n\n// `file String` is a property named `file`; `file Invoices/Register.cs` is the directive. The two are\n// told apart by shape, the way the compiler tells them apart: a type reference is a bare identifier,\n// so anything carrying a separator or an extension is a path and nothing else. The property wins the\n// tie, because a document that used the name before the directive existed keeps meaning what it meant.\nconst typeReferencePattern = /^[A-Za-z_]\\w*(?:\\[\\])?(?:\\?|\\s+optional)?$/;\n\n// A path naming a place on one machine rather than a place in the repository. The compiler warns about\n// these; nothing here rejects one, so a resolver can still probe it and come up empty on other machines.\nconst absolutePathPattern = /^(?:[/\\\\]|[A-Za-z]:[/\\\\]|~[/\\\\])/;\n\nexport function isAbsoluteFileReferencePath(path: string): boolean {\n return absolutePathPattern.test(path);\n}\n\n// Drops a trailing `//` comment without cutting into a string or a template, mirroring how the\n// compiler strips one before it reads the line.\nfunction withoutComment(text: string): string {\n let inString = false;\n let inTemplate = false;\n\n for (let index = 0; index < text.length; index++) {\n const current = text[index];\n if (current === '\\\\' && inString && index + 1 < text.length) {\n index++;\n } else if (current === '\"' && !inTemplate) {\n inString = !inString;\n } else if (current === '`' && !inString) {\n inTemplate = !inTemplate;\n } else if (!inString && !inTemplate && current === '/' && text[index + 1] === '/') {\n return text.slice(0, index);\n }\n }\n\n return text;\n}\n\n// The `file` directive on a single line, or undefined when the line is not one. Callers that scan a\n// whole document go through fileReferences instead, so code fences are accounted for.\nexport function fileReferenceOn(line: string, lineIndex: number): FileReference | undefined {\n const indent = indentOf(line);\n const content = withoutComment(line.slice(indent)).trimEnd();\n if (firstWord(content) !== fileReferenceKeyword) return undefined;\n\n const afterKeyword = content.slice(fileReferenceKeyword.length);\n const path = afterKeyword.trim();\n\n // A bare `file` leaves the word available as a name to whatever the enclosing block reads a bare\n // word as, and a bare identifier after it is a property type rather than a path.\n if (path.length === 0 || typeReferencePattern.test(path)) return undefined;\n\n const separatorLength = afterKeyword.length - afterKeyword.trimStart().length;\n const startColumn = indent + fileReferenceKeyword.length + separatorLength + 1;\n return { path, line: lineIndex, startColumn, endColumn: startColumn + path.length };\n}\n\n// Every `file` directive in a document, in document order. Lines inside a code fence are skipped, so\n// a `file` line in an inline C# or TypeScript block is never mistaken for one of ours.\nexport function fileReferences(lines: string[]): FileReference[] {\n const fences = fenceMap(lines);\n const references: FileReference[] = [];\n\n for (let index = 0; index < lines.length; index++) {\n if (fences[index]) continue;\n const reference = fileReferenceOn(lines[index], index);\n if (reference) references.push(reference);\n }\n\n return references;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { withoutComment } from './document-context';\n\n// Match SourceLineSplitter: comments begin outside strings/templates; fenced bodies remain opaque.\nexport function eventAnalysisSource(lines: string[]): string[] {\n let fenced = false;\n return lines.map(line => {\n if (fenced) {\n if (line.trim() === '```') fenced = false;\n return line;\n }\n const text = withoutComment(line);\n if (/^\\s*```(?:[a-z]+)?\\s*$/.test(text)) fenced = true;\n return text.trimEnd();\n });\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { EventVisibility, eventBodyReservedWords, unescapeString } from '@cratis/screenplay-compiler';\nimport { fenceMap, indentOf } from './document-context';\nimport { eventAnalysisSource } from './event-analysis-source';\nimport { CommandResponseSymbol, responseAnalysis } from './response-analysis';\nimport { fileReferenceOn } from './file-references';\nimport { clauseKeywords } from './language';\nimport { AuthoringDocument } from './AuthoringDocument';\nimport { AuthoredEventSource } from './AuthoredEventSource';\nimport { ProductionSymbol } from './ProductionSymbol';\nimport { TypeReferenceSymbol, typeReferenceSymbol } from './TypeReferenceSymbol';\n\nexport interface PropertySymbol {\n name: string;\n type: string;\n typeReference?: TypeReferenceSymbol;\n // Exact spelling and UTF-16 columns in the authoring source, independent of normalization.\n sourceType?: { text: string; startColumn: number; endColumn: number };\n isIdentifier: boolean;\n isGenerated?: boolean;\n isSubject?: boolean;\n line: number;\n}\n\nexport interface ConceptSymbol {\n name: string;\n primitive: string;\n attributes: string[];\n attributeReasons: Record<string, string>;\n enumValues: string[];\n line: number;\n}\n\nexport interface TypeSymbol {\n name: string;\n properties: PropertySymbol[];\n line: number;\n}\n\nexport interface PolicySymbol {\n name: string;\n requires: string[];\n line: number;\n}\n\nexport interface EventSymbol {\n // Public editor declarations stay structural; the compiler is privately bundled.\n visibility?: 'Private' | 'Public';\n origin?: string;\n name: string;\n generation?: number;\n inline?: boolean;\n properties: PropertySymbol[];\n line: number;\n}\n\nexport interface CommandSymbol extends NamedSymbol {\n properties: PropertySymbol[];\n reads?: ReadSymbol[];\n produces?: ProductionSymbol[];\n productionHeaders?: number[];\n response?: CommandResponseSymbol | null;\n}\n\nexport interface ReadSymbol {\n view: string;\n alias?: string;\n by?: string;\n line: number;\n}\n\nexport interface NamedSymbol {\n name: string;\n line: number;\n}\n\nexport interface QuerySymbol extends NamedSymbol {\n returnType: string;\n returnTypeReference?: TypeReferenceSymbol;\n parameters: PropertySymbol[];\n}\n\nexport interface ImportSymbol {\n qualifiedName: string;\n shortName: string;\n line: number;\n}\n\nexport interface DocumentSymbols {\n identityDetails?: readonly { readonly name: string; readonly type: string; readonly line: number }[];\n authoringSources?: readonly string[];\n authoringPath?: string;\n authoringPlacement?: readonly string[];\n authoringPlacementResolved?: boolean;\n authoringDocuments?: readonly AuthoringDocument[];\n eventSources?: readonly AuthoredEventSource[];\n imports: ImportSymbol[];\n concepts: ConceptSymbol[];\n types: TypeSymbol[];\n policies: PolicySymbol[];\n events: EventSymbol[];\n commands: CommandSymbol[];\n queries: QuerySymbol[];\n screens: NamedSymbol[];\n triggers: NamedSymbol[];\n}\n\nconst conceptPattern = /^concept\\s+(\\w+)\\s*:\\s*(\\w+)((?:\\s+@\\w+)*)\\s*$/;\nconst propertyPattern = /^\\s*(@?[a-z_]\\w*)\\s+([\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?)(\\s+generated)?(\\s+identifier)?(\\s+subject)?\\s*$/;\nconst attributeReasonPattern = /^([a-z_]\\w*)\\s+reason\\s+\"((?:[^\"\\\\]|\\\\.)*)\"\\s*$/;\nconst readPattern = /^\\s*reads\\s+([A-Z]\\w*)(?:\\s+as\\s+([a-z_]\\w*))?(?:\\s+by\\s+([a-z_]\\w*))?\\s*$/;\nconst commandReserved = ['authorize', 'produces', 'reads'];\n// AuthorizeParser's continuation pattern, including the compiler's Unicode word characters.\nconst authorizationContinuation = /^(?:(?:or|and)\\s+)?[A-Za-z_(][\\p{L}\\p{Mn}\\p{Nd}\\p{Pc}\\s()]*$/u;\n// Use the compiler's contextual inventory, not the global completion vocabulary.\nconst eventReserved = eventBodyReservedWords;\nconst inlineEventReserved = ['tag', 'for', 'generation', 'origin', 'namespace', 'sequence', 'correlation', 'causation', 'causedBy', 'occurred'];\nconst queryParameterPattern =\n /^\\s*(?:by|filter)\\s+([a-z_]\\w*)\\s+([\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?)(?:\\s+from\\s+.+)?\\s*$/;\n\n// Property-shaped clauses depend on their owner. Commands reserve only authorize,\n// produces and reads; bare directives such as description and handler can be properties.\n// The @ escape always denotes a property, and 'as' keeps its established property meaning.\nexport function propertyTypeReference(property: PropertySymbol): TypeReferenceSymbol {\n return property.typeReference ?? typeReferenceSymbol(property.type);\n}\n\nfunction sourceTypeAt(line: string, startColumn: number): NonNullable<PropertySymbol['sourceType']> {\n const text = line.slice(startColumn - 1).match(/^[\\p{L}\\p{Mn}\\p{Nd}\\p{Pc}.]+(?:\\[\\])?(?:\\?|\\s+optional\\b)?/u)?.[0] ?? '';\n return { text, startColumn, endColumn: startColumn + text.length };\n}\n\nfunction propertiesIn(lines: string[], body: number[], reserved: readonly string[]): PropertySymbol[] {\n return body\n .map((index) => ({ index, match: lines[index].match(propertyPattern) }))\n .filter((entry): entry is { index: number; match: RegExpMatchArray } => entry.match !== null)\n .filter(({ match }) => match[1].startsWith('@') || match[1] === 'as' || !reserved.includes(match[1]))\n .map(({ index, match }) => ({\n name: match[1].replace(/^@/, ''),\n type: match[2],\n typeReference: typeReferenceSymbol(match[2]),\n sourceType: sourceTypeAt(lines[index], lines[index].match(/^\\s*\\S+\\s+/)![0].length + 1),\n isIdentifier: match[4] !== undefined,\n ...(match[3] !== undefined ? { isGenerated: true } : {}),\n ...(match[5] !== undefined ? { isSubject: true } : {}),\n line: index,\n }));\n}\n\nfunction collectBody(lines: string[], fences: boolean[], start: number, indent: number): number[] {\n const body: number[] = [];\n for (let index = start + 1; index < lines.length; index++) {\n if (fences[index]) {\n continue;\n }\n const line = lines[index];\n if (line.trim().length === 0) continue;\n if (indentOf(line) <= indent) break;\n body.push(index);\n }\n return body;\n}\n\n// Event/production parsers accept every greater indent, not just the smallest child indent.\n// Command block directives own their nested lines; properties do not. Fenced prose is never syntax.\nexport function directBody(lines: string[], fences: boolean[], start: number, indent: number): number[] {\n const body = collectBody(lines, fences, start, indent).filter(index => !fences[index] && !/^\\s*(?:\\/\\/|#)/.test(lines[index]));\n if (!/^\\s*command\\b/.test(lines[start])) return body;\n let blockIndent: number | undefined;\n let authorization = false;\n return body.filter(index => {\n const childIndent = indentOf(lines[index]);\n const text = lines[index].trim();\n // AuthorizeParser owns only consecutive deeper lines with requirement shape.\n // Unlike opaque blocks, a nonmatching line returns control to CommandParser.\n if (blockIndent !== undefined && childIndent > blockIndent &&\n (!authorization || authorizationContinuation.test(text))) return false;\n const property = text !== 'validate csharp' && propertiesIn(lines, [index], commandReserved).length > 0;\n // Description consumes only a quoted value or a fence (already excluded above).\n const leaf = property || /^description(?:\\s|$)/.test(text);\n blockIndent = leaf ? undefined : childIndent;\n authorization = /^authorize(?:\\s|$)/.test(text);\n return true;\n });\n}\n\nconst symbolRevisions = new Map<string, DocumentSymbols>();\n\nexport function scanDocument(lines: string[]): DocumentSymbols {\n const source = lines.join('\\n');\n const cached = symbolRevisions.get(source);\n if (cached) return cached;\n const analysis = responseAnalysis(lines);\n const symbols: DocumentSymbols = {\n ...(analysis.identityDetails?.length ? { identityDetails: analysis.identityDetails } : {}),\n authoringSources: [source],\n eventSources: analysis.eventSources.declarations,\n imports: [],\n concepts: [],\n types: [],\n policies: [],\n events: [],\n commands: [],\n queries: [],\n screens: [],\n triggers: [],\n };\n // One normalization pass for every declaration, including comments on fence openers.\n lines = eventAnalysisSource(lines);\n const fences = fenceMap(lines);\n const eventLines = lines;\n const eventFences = fences;\n // Typed inline mappings share property syntax once their source expression is removed.\n // Do this once, never once per inline event.\n const eventPropertyLines = lines.map(line => line.replace(/\\s*=(?!=|>).*/, ''));\n\n for (let index = 0; index < lines.length; index++) {\n if (fences[index]) continue;\n const line = lines[index];\n const trimmed = line.trim();\n const indent = indentOf(line);\n\n const importMatch = eventLines[index].trim().match(/^import\\s+([\\w.]+)(?:\\s+from\\s+\"(?:[^\"\\\\]|\\\\.)*\")?\\s*$/);\n if (importMatch && indent === 0) {\n const qualifiedName = importMatch[1];\n const shortName = qualifiedName.split('.').pop() ?? qualifiedName;\n symbols.imports.push({ qualifiedName, shortName, line: index });\n continue;\n }\n\n const conceptMatch = trimmed.match(conceptPattern);\n if (conceptMatch) {\n const body = collectBody(lines, fences, index, indent).map((i) => lines[i].trim());\n const attributeReasons: Record<string, string> = {};\n for (const line of body) {\n const reason = line.match(attributeReasonPattern);\n if (reason && attributeReasons[reason[1]] === undefined) {\n attributeReasons[reason[1]] = reason[2];\n }\n }\n const enumValues =\n conceptMatch[2] === 'Enum'\n ? body.filter((line) => !attributeReasonPattern.test(line))\n : [];\n symbols.concepts.push({\n name: conceptMatch[1],\n primitive: conceptMatch[2],\n attributes: conceptMatch[3].trim().split(/\\s+/).filter(Boolean),\n attributeReasons,\n enumValues,\n line: index,\n });\n continue;\n }\n\n const typeMatch = trimmed.match(/^type\\s+(\\w+)\\s*$/);\n if (typeMatch) {\n symbols.types.push({\n name: typeMatch[1],\n properties: propertiesIn(lines, collectBody(lines, fences, index, indent), clauseKeywords),\n line: index,\n });\n continue;\n }\n\n const policyMatch = trimmed.match(/^policy\\s+(\\w+)\\s*$/);\n if (policyMatch) {\n const requires = collectBody(lines, fences, index, indent)\n .filter((i) => !fences[i])\n .map((i) => lines[i].trim());\n symbols.policies.push({ name: policyMatch[1], requires, line: index });\n continue;\n }\n\n const eventMatch = eventLines[index].trim().match(/^(?:(?:produces|(?<public>public))\\s+)?event\\s+(?<name>\\w+)(?:\\s+generation\\s+(?<generation>\\d+))?(?:\\s+from\\s+(?<origin>\"(?:[^\"\\\\]|\\\\.)*\"))?\\s*$/);\n if (eventMatch) {\n const inline = trimmed.startsWith('produces ');\n const body = directBody(eventLines, eventFences, index, indent);\n // Standalone events distinguish file metadata from properties by path shape.\n const propertyBody = inline ? body : body.filter(line => fileReferenceOn(eventLines[line], line) === undefined);\n symbols.events.push({\n name: eventMatch.groups!.name,\n ...(eventMatch.groups!.generation ? { generation: Number(eventMatch.groups!.generation) } : {}),\n ...(eventMatch.groups!.public || eventMatch.groups!.origin ? { visibility: EventVisibility.Public } : {}),\n ...(eventMatch.groups!.origin ? { origin: unescapeString(eventMatch.groups!.origin.slice(1, -1)) } : {}),\n inline,\n properties: propertiesIn(inline ? eventPropertyLines : eventLines,\n propertyBody, inline ? inlineEventReserved : eventReserved),\n line: index,\n });\n continue;\n }\n\n const command = analysis.commands.get(index);\n if (command) {\n // A command property is a leaf, not an indentation owner. Share the parser-shaped\n // body with properties, productions, advice and destination hints.\n const body = directBody(lines, fences, index, indent);\n const productionHeaders = body.filter(line => /^\\s*produces\\b/.test(lines[line]) && !analysis.operationProductionLines?.has(line));\n symbols.commands.push({\n name: command.name,\n properties: command.properties.map(property => ({\n name: property.name,\n type: `${property.type.name}${property.type.isCollection ? '[]' : ''}${property.type.isOptional ? ' optional' : ''}`,\n typeReference: { name: property.type.name, isCollection: property.type.isCollection, isOptional: property.type.isOptional },\n sourceType: sourceTypeAt(lines[property.type.location.line - 1], property.type.location.column),\n isIdentifier: property.isIdentifier || /\\sidentifier\\s*$/.test(lines[property.location.line - 1]),\n ...(property.isGenerated ? { isGenerated: true } : {}),\n line: property.location.line - 1,\n })),\n response: command.response,\n productionHeaders,\n produces: productionHeaders.flatMap(line => {\n const header = eventLines[line].trim();\n const inline = /^produces\\s+event\\b/.test(header);\n const conditional = /^produces\\s+when\\b/.test(header);\n const eventLine = conditional ? directBody(eventLines, eventFences, line, indentOf(eventLines[line]))[0] : line;\n if (eventLine === undefined) return [];\n const name = conditional ? eventLines[eventLine].trim() : header.match(inline ? /^produces\\s+event\\s+([A-Za-z_]\\w*)(?:\\s+generation\\s+\\d+)?\\s*$/ : /^produces\\s+([A-Z]\\w*)\\s*$/)?.[1];\n if (name === undefined || !/^[A-Za-z_]\\w*$/.test(name)) return [];\n const children = directBody(eventLines, eventFences, eventLine, indentOf(eventLines[eventLine]));\n const targets = children.map(index => eventLines[index].trim().match(/^for(?:\\s+(.*))?$/)).filter(match => match !== null);\n // Empty or repeated targets are uncertain, not implicit destinations.\n const target = targets.length === 0 ? undefined : targets.length === 1 ? targets[0][1] ?? '' : '';\n const mappings = children.flatMap(index => {\n const match = eventLines[index].trim().match(inline ? /^(@?[a-z_]\\w*)\\s+[\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?\\s*=(?!=|>)\\s*(.+)$/ : /^(@?[\\w.]+)\\s*=(?!=|>)\\s*(.+)$/);\n return match === null ? [] : [{ name: match[1].replace(/^@/, ''), source: match[2], line: index }];\n });\n return [{ name, inline, conditional, line, target, mappings }];\n }),\n reads: body.filter((line) => !fences[line])\n .map((line) => ({ line, match: lines[line].match(readPattern) }))\n .filter((entry): entry is { line: number; match: RegExpMatchArray } => entry.match !== null)\n .map(({ line, match }) => ({\n view: match[1],\n ...(match[2] ? { alias: match[2] } : {}),\n ...(match[3] ? { by: match[3] } : {}),\n line,\n })),\n line: index,\n });\n continue;\n }\n\n // The return type shape is the compiler's, dots and all - QueryParser's\n // ^query\\s+([A-Za-z_]\\w*)\\s*=>\\s*(observable\\s+)?([\\w.]+(?:\\[\\])?\\??)$. A narrower one here\n // silently drops the query from the symbol table, and with it every check and completion that\n // reads from it.\n const queryMatch = trimmed.match(/^query\\s+(\\w+)\\s*=>\\s*(?:observable\\s+)?([\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?)\\s*$/);\n if (queryMatch) {\n // The return type names a read model, which no construct declares \u2014 only the\n // 'by' and 'filter' parameters resolve against the document's own types.\n const parameters = collectBody(lines, fences, index, indent)\n .map((i) => ({ index: i, match: lines[i].match(queryParameterPattern) }))\n .filter(\n (entry): entry is { index: number; match: RegExpMatchArray } =>\n entry.match !== null,\n )\n .map(({ index: line, match }) => ({\n name: match[1],\n type: match[2],\n typeReference: typeReferenceSymbol(match[2]),\n sourceType: sourceTypeAt(lines[line], lines[line].match(/^\\s*(?:by|filter)\\s+\\S+\\s+/)![0].length + 1),\n isIdentifier: false,\n line,\n }));\n symbols.queries.push({\n name: queryMatch[1],\n returnType: queryMatch[2],\n returnTypeReference: typeReferenceSymbol(queryMatch[2]),\n parameters,\n line: index,\n });\n continue;\n }\n\n const screenMatch = trimmed.match(/^screen\\s+(\\w+)\\s*$/);\n if (screenMatch) {\n symbols.screens.push({ name: screenMatch[1], line: index });\n continue;\n }\n\n const triggerMatch = trimmed.match(/^trigger\\s+(\\w+)\\s*$/);\n if (triggerMatch && indent === 0) {\n symbols.triggers.push({ name: triggerMatch[1], line: index });\n }\n }\n\n if (symbolRevisions.size >= 16) symbolRevisions.delete(symbolRevisions.keys().next().value!);\n symbolRevisions.set(source, symbols);\n return symbols;\n}\n\n// The symbols of several documents as one - what an application spread over files declares. Lines refer to\n// the document each symbol came from, so the result names things; it does not locate them.\nexport function mergeSymbols(...documents: DocumentSymbols[]): DocumentSymbols {\n return {\n ...(documents.some(document => document.identityDetails?.length) ? { identityDetails: documents.flatMap(document => document.identityDetails ?? []) } : {}),\n authoringSources: documents.flatMap(document => document.authoringSources ?? []),\n ...(documents.some(document => document.authoringDocuments) ? { authoringDocuments: documents.flatMap(document => document.authoringDocuments ?? []) } : {}),\n eventSources: documents.flatMap(document => document.eventSources ?? []),\n imports: documents.flatMap((document) => document.imports),\n concepts: documents.flatMap((document) => document.concepts),\n types: documents.flatMap((document) => document.types),\n policies: documents.flatMap((document) => document.policies),\n events: documents.flatMap((document) => document.events),\n commands: documents.flatMap((document) => document.commands),\n queries: documents.flatMap((document) => document.queries),\n screens: documents.flatMap((document) => document.screens),\n triggers: documents.flatMap((document) => document.triggers),\n };\n}\n\n// Name scans are not physical input documents. Keep the host's authoritative paths separate,\n// and let responseAnalysis replace the current document with this buffer exactly once.\nexport function symbolsForBuffer(lines: string[], application?: DocumentSymbols): DocumentSymbols {\n const path = application?.authoringPath ?? 'current.play';\n const current = application?.authoringDocuments?.find(document => document.path === path);\n return { ...mergeSymbols(scanDocument(lines), application ?? mergeSymbols()),\n authoringDocuments: application?.authoringDocuments,\n authoringPath: path,\n authoringPlacement: application?.authoringPlacement ?? current?.placement,\n authoringPlacementResolved: application?.authoringPlacementResolved ?? current?.isPlacementResolved,\n };\n}\n\nexport function knownEventNames(symbols: DocumentSymbols): string[] {\n return [\n ...symbols.events.map((event) => event.name),\n ...symbols.imports.map((imported) => imported.shortName),\n ];\n}\n\n// The built-in host signals, which have no declaration to scan for because every application has them.\nexport const builtInTriggerNames = ['Startup', 'Shutdown'];\n\n// What a reaction's `when` may name: an event, a declared trigger, or a host signal. The compiler resolves\n// the three in that order, and the editor offers them the same way rather than guessing which was meant.\nexport function knownTriggerNames(symbols: DocumentSymbols): string[] {\n return [\n ...knownEventNames(symbols),\n ...symbols.triggers.map((trigger) => trigger.name),\n ...builtInTriggerNames,\n ];\n}\n\n// Everything a property type reference can resolve to \u2014 the primitives, the declared\n// concepts and types, and the short names of the imports.\nexport function knownTypeNames(symbols: DocumentSymbols, primitives: readonly string[]): string[] {\n return [\n ...primitives,\n ...symbols.concepts.map((concept) => concept.name),\n ...symbols.types.map((type) => type.name),\n ...symbols.imports.map((imported) => imported.shortName),\n ];\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DestinationHint } from './DestinationHint';\nimport { eventAnalysisSource } from './event-analysis-source';\nimport { CommandSymbol, DocumentSymbols, propertyTypeReference, scanDocument } from './symbols';\nimport { responseAnalysis } from './response-analysis';\n\nexport function productionDestinations(command: CommandSymbol): { identifier?: string; mixed: boolean } {\n const identifiers = command.properties.filter(property => property.isIdentifier && !propertyTypeReference(property).isOptional && !propertyTypeReference(property).isCollection);\n const identifier = identifiers.length === 1 ? identifiers[0].name : undefined;\n const productions = command.produces ?? [];\n const mixed = productions.some(production => production.target !== undefined && production.target !== identifier) ||\n (productions.some(production => production.inline && production.target === undefined) &&\n productions.some(production => !production.inline && production.target === undefined));\n return { identifier, mixed };\n}\n\n// Shared by both editor adapters. Never suggest that a legacy allocated source is the command identifier.\nexport function destinationHints(lines: string[], application?: DocumentSymbols): DestinationHint[] {\n const analysis = responseAnalysis(lines, application?.authoringDocuments ?? application?.authoringSources, application?.authoringPlacement, application?.authoringPath);\n const source = eventAnalysisSource(lines);\n return scanDocument(source).commands.map(command => ({ ...command,\n produces: command.produces?.filter(production => !analysis.operationProductionLines?.has(production.line) && analysis.operations.references.some(reference => reference.location.line - 1 === production.line && reference.kind === 'event')),\n productionHeaders: command.productionHeaders?.filter(line => !analysis.operationProductionLines?.has(line)),\n })).flatMap(command => {\n const { identifier, mixed } = productionDestinations(command);\n if (mixed || command.productionHeaders?.length !== command.produces?.length) return [];\n const hasPromotedDestination = command.produces?.some(sibling => sibling.target !== undefined || sibling.inline);\n return (command.produces ?? []).flatMap(production => {\n if (production.target !== undefined || (production.inline && (identifier === undefined || /\\bgeneration\\b/.test(source[production.line])))) return [];\n // A sibling destination can promote the command default in the legacy binder.\n if (!production.inline && hasPromotedDestination) return [];\n return [{ line: production.line, column: source[production.line].length + 1, label: production.inline ? `for ${identifier}` : 'for <new event source>' }];\n });\n });\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\n// The PLAY codes the editor reports. Every one of them mirrors a condition the compiler checks and\n// carries the compiler's own code for it, so the same problem is called the same thing whether it was\n// found by the CLI or by a squiggle - see Documentation/screenplay/diagnostics.md for the catalogue.\n//\n// A code is only ever added here for a condition the compiler can also report. The editor makes a few\n// structural checks the compiler does not - the capture and projection validators are where they live -\n// and those stay codeless deliberately: minting a PLAY number for something no compiler run can emit\n// would make the catalogue describe two different tools.\nexport const diagnosticCodes = {\n repeatedSingularDeclarationAcrossFiles: 'PLAY0172',\n invalidIdentityDeclaration: 'PLAY0633',\n duplicateIdentity: 'PLAY0634',\n invalidIdentityDetail: 'PLAY0635',\n unknownIdentitySource: 'PLAY0636',\n identityDetailWithoutSource: 'PLAY0637',\n identitySourceWithBody: 'PLAY0638',\n duplicateIdentityDetail: 'PLAY0639',\n builtInIdentityDetail: 'PLAY0640',\n unknownIdentityQuery: 'PLAY0641',\n invalidIdentityQuery: 'PLAY0642',\n identityQueryWithoutKey: 'PLAY0643',\n invalidIdentityQueryKey: 'PLAY0644',\n identityQueryAuthorizationDependency: 'PLAY0645',\n identityQueryTypeMismatch: 'PLAY0646',\n // Preserve supplied C# whole-model diagnostics; these checks are not yet run by the editor.\n commandProducesPublicEvent: 'PLAY0607',\n publicEventRequiresOutboundTranslation: 'PLAY0608',\n outboundPublicEventCount: 'PLAY0609',\n foreignPublicEventConsumer: 'PLAY0610',\n outboundTranslationInput: 'PLAY0611',\n inboundTranslationOutput: 'PLAY0612',\n foreignPublicEventProduced: 'PLAY0613',\n publicTranslationRequiresDirection: 'PLAY0614',\n translationConstructDirection: 'PLAY0615',\n inboundTranslationInput: 'PLAY0616',\n outboundTranslationOutput: 'PLAY0617',\n eventTargetOutsideOutboundTranslation: 'PLAY0618',\n eventsSourceOutsideInboundTranslation: 'PLAY0619',\n invalidCaptureEventsSource: 'PLAY0620',\n invalidDescription: 'PLAY0145',\n emptyDescription: 'PLAY0146',\n duplicateDescription: 'PLAY0147',\n unknownConceptDirective: 'PLAY0010',\n attributeReasonWithoutAttribute: 'PLAY0012',\n duplicateAttributeReason: 'PLAY0013',\n legacyComplianceMarker: 'PLAY0565',\n unknownComplianceMarker: 'PLAY0566',\n invalidSecretScope: 'PLAY0567',\n duplicateSecretScope: 'PLAY0568',\n secretScopeIgnoredForPii: 'PLAY0569',\n invalidPersonalDataQualifier: 'PLAY0570',\n duplicateSpecialCategory: 'PLAY0571',\n invalidPurposeDeclaration: 'PLAY0596',\n invalidPurposeVocabulary: 'PLAY0597',\n duplicatePurposeField: 'PLAY0598',\n duplicatePurposeDeclaration: 'PLAY0599',\n unknownPurpose: 'PLAY0600',\n purposeInterestMismatch: 'PLAY0601',\n personalDataWithoutPurpose: 'PLAY0602',\n specialDataWithoutCondition: 'PLAY0603',\n criminalDataWithoutAuthorization: 'PLAY0604',\n purposeWithoutBasis: 'PLAY0605',\n unusedPurpose: 'PLAY0606',\n duplicateEventSubject: 'PLAY0590',\n invalidSubjectType: 'PLAY0591',\n protectedSubjectType: 'PLAY0592',\n invalidSubjectOwner: 'PLAY0593',\n readModelSubjectNotSupported: 'PLAY0594',\n invalidSubjectModifierOrder: 'PLAY0595',\n // Supplied compiler diagnostics are preserved, even for checks only the C# tool can run.\n // See Documentation/screenplay/editor-diagnostics.md for the validation boundary.\n conflictingScreenDataBinding: 'PLAY0530',\n screenDataQueryMismatch: 'PLAY0531',\n actionWithoutInputSurface: 'PLAY0532',\n commandWithoutInputSurface: 'PLAY0533',\n readModelFieldWithoutOrigin: 'PLAY0534',\n queryParameterNotHeldByView: 'PLAY0535',\n unconsumedEvent: 'PLAY0536',\n unreachableScreen: 'PLAY0537',\n invalidSpecificationCallerPersona: 'PLAY0572',\n unsynthesizablePersonaCaller: 'PLAY0573',\n personaWithoutGate: 'PLAY0574',\n gateWithoutPersona: 'PLAY0575',\n ambiguousPersonaCaller: 'PLAY0576',\n invalidSpecificationParameter: 'PLAY0577',\n invalidSpecificationCase: 'PLAY0578',\n duplicateSpecificationParameter: 'PLAY0579',\n duplicateSpecificationCase: 'PLAY0580',\n incompleteSpecificationTable: 'PLAY0581',\n invalidSpecificationCaseAssignment: 'PLAY0582',\n invalidSpecificationCaseValue: 'PLAY0583',\n invalidSpecificationCaseReference: 'PLAY0584',\n optionalSpecificationParameterTarget: 'PLAY0585',\n specificationCaseNameCollision: 'PLAY0586',\n incompatibleSpecificationParameterType: 'PLAY0587',\n unusedSpecificationParameter: 'PLAY0588',\n singularSpecificationTableExpansion: 'PLAY0589',\n invalidActionAlternative: 'PLAY0341',\n guardedActionWithoutAlternatives: 'PLAY0342',\n misplacedActionOtherwise: 'PLAY0343',\n unsupportedActionConditionOperand: 'PLAY0344',\n unknownActionSubjectField: 'PLAY0345',\n unresolvedActionSubject: 'PLAY0346',\n unreachableActionAlternative: 'PLAY0347',\n unknownActionArgumentProperty: 'PLAY0348',\n invalidRefusalBranch: 'PLAY0538',\n invalidRefusalBranchBody: 'PLAY0539',\n unreachableRefusalBranch: 'PLAY0540',\n invalidRefusalValue: 'PLAY0541',\n unknownRefusalConstraint: 'PLAY0542',\n unmatchedRedeliveredOccurrence: 'PLAY0543',\n unknownRedeliveryReaction: 'PLAY0544',\n invalidNoEventsExpectation: 'PLAY0545',\n indeterminateNegatedClaimTarget: 'PLAY0546',\n invalidAbsentReadModelStep: 'PLAY0453',\n unknownConstraintProperty: 'PLAY0391',\n invalidSpecificationExample: 'PLAY0518',\n duplicateSpecificationAssignment: 'PLAY0519',\n unknownReadModelProperty: 'PLAY0514',\n piiNotSupportedOnIdentifier: 'PLAY0515',\n invalidEventSourceDeclaration: 'PLAY0503',\n invalidCommandStream: 'PLAY0504',\n invalidSpecificationStream: 'PLAY0547',\n specificationStreamOnCommand: 'PLAY0548',\n invalidSpecificationStreamRoute: 'PLAY0549',\n invalidSpecificationStreamEventSource: 'PLAY0550',\n specificationStreamContradictsCommand: 'PLAY0551',\n ambiguousCommandStream: 'PLAY0505',\n unsupportedStreamIdType: 'PLAY0506',\n redundantSourceStreamId: 'PLAY0507',\n eventFromLaterSlice: 'PLAY0516',\n timelineCycleGroup: 'PLAY0517',\n invalidSpecificationExampleBody: 'PLAY0526',\n undeclaredDependency: 'PLAY0552',\n unusedDependencyDeclaration: 'PLAY0553',\n invalidDependencyTarget: 'PLAY0554',\n repeatedDependencyDeclaration: 'PLAY0555',\n mutualDependencyDeclarations: 'PLAY0556',\n authorizationRefusalWithoutIdentity: 'PLAY0557',\n invalidDocumentation: 'PLAY0558',\n conflictingDocumentationAcrossFiles: 'PLAY0559',\n unsupportedInteractionAlternatives: 'PLAY0560',\n mixedInteractionAlternatives: 'PLAY0561',\n interactionAlternativeWithoutActions: 'PLAY0562',\n inlineInteractionAlternative: 'PLAY0563',\n legacyInteractionWhere: 'PLAY0564',\n ambiguousReference: 'PLAY0198',\n invalidImplementationBlock: 'PLAY0492',\n invalidImplementationHint: 'PLAY0493',\n conflictingImplementationSources: 'PLAY0494',\n eventSourceIdInPayload: 'PLAY0469',\n explicitProducesTargetsRequired: 'PLAY0470',\n redundantEventId: 'PLAY0471',\n invalidEventId: 'PLAY0472',\n inlineEventCollision: 'PLAY0473',\n inlineEventOutsideCommand: 'PLAY0474',\n inlineEventGeneration: 'PLAY0475',\n reservedProductionMetadata: 'PLAY0476',\n invalidEventDocumentation: 'PLAY0477',\n tabIndentation: 'PLAY0006',\n unknownPrimitiveType: 'PLAY0008',\n unknownSliceType: 'PLAY0028',\n duplicateCommandIdentifier: 'PLAY0036',\n unknownContextPath: 'PLAY0153',\n unknownContextCausedByProperty: 'PLAY0154',\n unknownContextIdentityProperty: 'PLAY0155',\n unclosedCodeBlock: 'PLAY0164',\n unknownType: 'PLAY0165',\n unknownEvent: 'PLAY0166',\n unknownPolicy: 'PLAY0167',\n duplicateDeclaration: 'PLAY0168',\n unknownEventContextMember: 'PLAY0295',\n unknownEventContextPath: 'PLAY0296',\n eventContextPathBelowCollection: 'PLAY0297',\n missingEventContextPath: 'PLAY0298',\n unresolvedDynamicKeySource: 'PLAY0299',\n invalidFileImport: 'PLAY0454',\n omittedProductionDestination: 'PLAY0478',\n legacyOptionalSuffix: 'PLAY0479',\n invalidOptionalModifierOrder: 'PLAY0480',\n optionalReadsNotSupported: 'PLAY0481',\n unavailableResponseExecution: 'PLAY0268',\n generatedPropertyOutsideCommand: 'PLAY0482',\n invalidGeneratedType: 'PLAY0483',\n invalidGeneratedModifierOrder: 'PLAY0484',\n generatedPropertyInput: 'PLAY0485',\n invalidCommandResponse: 'PLAY0486',\n invalidResponseSource: 'PLAY0487',\n duplicateResponseField: 'PLAY0488',\n invalidResponseShape: 'PLAY0489',\n invalidGeneratedFixture: 'PLAY0490',\n invalidReturnExpectation: 'PLAY0491',\n} as const;\n\nexport type DiagnosticCode = (typeof diagnosticCodes)[keyof typeof diagnosticCodes];\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { fenceMap, indentOf } from './document-context';\n\n// An `import \"<path or glob>\"` of other .play files, with the pattern exactly as written and the span it\n// occupies between the quotes. Columns are one-based like every other position this package reports.\nexport interface FileImport {\n pattern: string;\n line: number;\n startColumn: number;\n endColumn: number;\n}\n\n// The compiler's own shape for a file import (FileImportParser): a quoted operand without quotes or escapes.\nconst fileImportPattern = /^import(\\s+)\"([^\"\\\\]+)\"\\s*(?:\\/\\/.*)?$/;\nconst quotedImportPattern = /^import\\s+\"/;\n\n// Whether a line imports files rather than a qualified name - its operand is quoted.\nexport function isFileImportLine(line: string): boolean {\n return quotedImportPattern.test(line.trim());\n}\n\n// The file import on a single line, or undefined when the line is not a well-formed one.\nexport function fileImportOn(line: string, lineIndex: number): FileImport | undefined {\n const indent = indentOf(line);\n const match = line.slice(indent).match(fileImportPattern);\n if (!match) return undefined;\n const startColumn = indent + 'import'.length + match[1].length + 2;\n return { pattern: match[2], line: lineIndex, startColumn, endColumn: startColumn + match[2].length };\n}\n\n// Every well-formed file import in a document, in document order, skipping code fences.\nexport function fileImports(lines: string[]): FileImport[] {\n const fences = fenceMap(lines);\n const found: FileImport[] = [];\n for (let index = 0; index < lines.length; index++) {\n if (fences[index]) continue;\n const fileImport = fileImportOn(lines[index], index);\n if (fileImport) found.push(fileImport);\n }\n return found;\n}\n\nconst folderOf = (path: string): string[] => path.split('/').slice(0, -1);\n\nfunction relativeTo(from: readonly string[], path: string): string {\n const segments = path.split('/');\n let common = 0;\n while (common < from.length && common < segments.length - 1 && from[common] === segments[common]) common++;\n return [...from.slice(common).map(() => '..'), ...segments.slice(common)].join('/');\n}\n\n// What an import written in a document can name: every other .play file, relative to the document's folder;\n// a glob for the files directly in each folder holding one; and a glob for everything beneath each folder on\n// the way to them. Paths are portable ('/' separated) and relative to one root, the way the compiler resolves them.\nexport function importablePaths(documentPath: string, files: readonly string[]): string[] {\n const from = folderOf(documentPath);\n const paths = new Set<string>();\n for (const file of files.filter((candidate) => candidate !== documentPath && candidate.toLowerCase().endsWith('.play'))) {\n const relative = relativeTo(from, file);\n const folders = folderOf(relative);\n paths.add(relative);\n paths.add([...folders, '*.play'].join('/'));\n for (let depth = 0; depth <= folders.length; depth++) {\n paths.add([...folders.slice(0, depth), '**', '*.play'].join('/'));\n }\n }\n return [...paths].sort();\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCode, diagnosticCodes } from './diagnostic-codes';\nimport { fenceMap, indentOf } from './document-context';\nimport { productionDestinations } from './production-destinations';\nimport { eventAnalysisSource } from './event-analysis-source';\nimport { directBody, DocumentSymbols } from './symbols';\nimport type { ValidationIssue, ValidationSeverity } from './validation';\n\nconst reserved = new Set(['namespace', 'sequence', 'correlation', 'causation', 'causedBy', 'occurred']);\nconst quotedId = /^id\\s+\"((?:[^\"\\\\]|\\\\.)*)\"$/;\n\nexport function validateInlineEvents(lines: string[], symbols: DocumentSymbols, application: DocumentSymbols, operationProductionLines: ReadonlySet<number> = new Set()): ValidationIssue[] {\n lines = eventAnalysisSource(lines);\n const issues: ValidationIssue[] = [];\n const fences = fenceMap(lines);\n const documentationBlocks = nonemptyMarkdownBlocks(lines, fences);\n const commandProductions = new Set(symbols.commands.flatMap(command => command.productionHeaders ?? []));\n const eventCounts = new Map<string, number>();\n const importedNames = new Set<string>();\n for (const document of [symbols, application]) {\n for (const event of document.events) eventCounts.set(event.name, (eventCounts.get(event.name) ?? 0) + 1);\n for (const imported of document.imports) importedNames.add(imported.shortName);\n }\n const report = (line: number, code: DiagnosticCode, message: string, severity: ValidationSeverity = 'error') => {\n issues.push({ line, startColumn: indentOf(lines[line]) + 1, endColumn: lines[line].length + 1, code, message, severity });\n };\n for (const event of symbols.events) {\n const body = directBody(lines, fences, event.line, indentOf(lines[event.line]));\n if (event.inline) {\n const properties = new Set<string>();\n for (const property of event.properties) {\n if (properties.has(property.name)) report(property.line, diagnosticCodes.duplicateDeclaration, `Event '${event.name}' already declares property '${property.name}'.`);\n properties.add(property.name);\n }\n if (!commandProductions.has(event.line)) report(event.line, diagnosticCodes.inlineEventOutsideCommand, 'Inline events can only be declared inside commands.');\n if (event.generation !== undefined) report(event.line, diagnosticCodes.inlineEventGeneration, 'Inline events are generation 1; extract the event before declaring generations.');\n if ((eventCounts.get(event.name) ?? 0) > 1 || importedNames.has(event.name)) {\n report(event.line, diagnosticCodes.inlineEventCollision, `Inline event '${event.name}' collides with another declaration or import.`);\n }\n }\n let hasId = false;\n let hasDocumentation = false;\n for (const index of body) {\n const text = lines[index].trim();\n const keyword = text.split(/\\s+/)[0];\n if (event.inline && keyword === 'generation') report(index, diagnosticCodes.inlineEventGeneration, 'Inline events are generation 1; extract the event before declaring generations.');\n if (event.inline && keyword === 'origin') report(index, diagnosticCodes.reservedProductionMetadata, 'An inline event is local to its command and cannot declare origin.');\n // Property-shaped metadata names stay properties, whether standalone or typed mappings.\n if (/^(?:id|description|documentation)\\s+[\\w.]+(?:\\[\\])?(?:\\?|\\s+optional)?(?:\\s*=.*)?$/.test(text)) continue;\n if (keyword === 'id') {\n const match = text.match(quotedId);\n if (hasId || match === null || match[1].trim().length === 0) report(index, diagnosticCodes.invalidEventId, 'Expected one nonempty id \"<old-name>\".');\n else if (match[1] === event.name) report(index, diagnosticCodes.redundantEventId, 'This id repeats the event name; remove it.', 'information');\n hasId = true;\n }\n if (keyword === 'documentation') {\n let next = index + 1;\n while (next < lines.length && lines[next].trim().length === 0) next++;\n if (hasDocumentation || text !== 'documentation' || lines[next]?.trim() !== '```markdown' || indentOf(lines[next]) <= indentOf(lines[index]) ||\n !documentationBlocks.has(next)) {\n report(index, diagnosticCodes.invalidEventDocumentation, 'Expected one nonempty fenced markdown documentation block.');\n }\n hasDocumentation = true;\n }\n }\n }\n // Also cover reaction productions without a backward ancestry walk per metadata line.\n const productionIndents: { indent: number; event: boolean }[] = [];\n for (let index = 0; index < lines.length; index++) {\n if (fences[index] || lines[index].trim().length === 0) continue;\n const indent = indentOf(lines[index]);\n while (productionIndents.length > 0 && productionIndents[productionIndents.length - 1].indent >= indent) productionIndents.pop();\n const keyword = lines[index].trim().split(/\\s+/)[0];\n if (reserved.has(keyword) && productionIndents.at(-1)?.event) {\n report(index, diagnosticCodes.reservedProductionMetadata, `'${keyword}' is system-assigned production metadata.`);\n }\n if (keyword === 'produces') productionIndents.push({ indent, event: !operationProductionLines.has(index) && !/^\\s*produces\\s+operation\\b/.test(lines[index]) });\n }\n for (const command of symbols.commands) {\n const { identifier, mixed } = productionDestinations(command);\n for (const production of command.produces ?? []) {\n if (mixed && production.target === undefined) report(production.line, diagnosticCodes.explicitProducesTargetsRequired, `Production '${production.name}' must state for explicitly when destinations differ.`);\n const destination = production.target ?? (production.inline ? identifier : undefined);\n if (identifier === undefined || destination !== identifier) continue;\n for (const mapping of production.mappings.filter(mapping => mapping.source === identifier)) {\n report(mapping.line, diagnosticCodes.eventSourceIdInPayload, `The payload copies '${identifier}', which already identifies the event source.`, production.inline ? 'warning' : 'information');\n }\n }\n }\n return issues;\n}\n\n// Record complete, nonempty Markdown fences once. Validation must not scan a suffix\n// for every documentation directive, especially while its opener is still being typed.\nfunction nonemptyMarkdownBlocks(lines: string[], fences: boolean[]): Set<number> {\n const blocks = new Set<number>();\n let opening: number | undefined;\n let content = false;\n for (let index = 0; index < lines.length; index++) {\n if (!fences[index]) continue;\n const text = lines[index].trim();\n if (opening === undefined) {\n opening = index;\n content = false;\n } else if (text === '```') {\n if (content && lines[opening].trim() === '```markdown') blocks.add(opening);\n opening = undefined;\n } else if (text.length > 0) {\n content = true;\n }\n }\n return blocks;\n}\n", "// Copyright (c) Cratis. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n\nimport { DiagnosticCodes, legacyOptionalTypeLength } from '@cratis/screenplay-compiler';\nimport { AnalysisDiagnostic, responseAnalysis } from './response-analysis';\nimport { validateInlineEvents } from './inline-event-validation';\nimport { causedByProperties, contextRoots, identityProperties, primitiveTypes, sliceTypes } from './language';\nimport { DiagnosticCode, diagnosticCodes } from './diagnostic-codes';\nimport { enclosingChain, fenceMap, indentOf } from './document-context';\nimport { eventAnalysisSource } from './event-analysis-source';\nimport { resolveEventContextPath } from './event-context';\nimport {\n DocumentSymbols,\n PropertySymbol,\n propertyTypeReference,\n knownEventNames,\n knownTypeNames,\n mergeSymbols,\n scanDocument,\n symbolsForBuffer,\n} from './symbols';\nimport { fileImportOn, isFileImportLine } from './file-imports';\n\nexport type ValidationSeverity = 'error' | 'warning' | 'information';\n\nexport interface ValidationIssue {\n line: number;\n startColumn: number;\n endColumn: number;\n message: string;\n severity: ValidationSeverity;\n\n // The compiler code for this condition, absent on the structural checks the editor makes and the\n // compiler does not. See ./diagnostic-codes.ts.\n code?: DiagnosticCode;\n}\n\n// What a document is validated against beyond itself.\nexport interface ValidationContext {\n // What the rest of the application declares - the other .play files of a folder, or the files an import\n // brings in - so a name declared in another file is not reported unknown. Merge the scanned symbols of\n // those files with mergeSymbols. The document's own declarations are always known.\n application?: DocumentSymbols;\n placement?: readonly string[];\n path?: string;\n compilerDiagnostics?: readonly AnalysisDiagnostic[];\n}\n\nfunction issue(\n severity: ValidationSeverity,\n line: number,\n startColumn: number,\n length: number,\n message: string,\n code: DiagnosticCode,\n): ValidationIssue {\n return { severity, message, line, startColumn, endColumn: startColumn + length, code };\n}\n\nfunction tokenIssue(\n severity: ValidationSeverity,\n line: number,\n text: string,\n token: string,\n message: string,\n code: DiagnosticCode,\n): ValidationIssue {\n const column = text.indexOf(token) + 1;\n return issue(severity, line, column, token.length, message, code);\n}\n\n// Reports every property whose type reference names nothing the document declares, and\n// every command that marks more than one property as its identifier.\nfunction validateDeclarations(lines: string[], symbols: DocumentSymbols, application: DocumentSymbols): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n const types = new Set([...knownTypeNames(symbols, primitiveTypes), ...knownTypeNames(application, [])]);\n\n const checkProperties = (properties: PropertySymbol[], owner: string) => {\n for (const property of properties.filter(\n (candidate) => !types.has(propertyTypeReference(candidate).name),\n )) {\n const bare = propertyTypeReference(property).name;\n issues.push(\n issue(\n 'warning',\n property.line,\n property.sourceType!.startColumn,\n property.sourceType!.text.length,\n bare === 'optional'\n ? `Unknown type 'optional' on '${property.name}' of ${owner} \u2014 did you forget the type before 'optional'?`\n : `Unknown type '${bare}' on '${property.name}' of ${owner} \u2014 declare it with 'concept ${bare} : <Primitive>' or 'type ${bare}'.`,\n diagnosticCodes.unknownType,\n ),\n );\n }\n };\n\n for (const type of symbols.types) checkProperties(type.properties, `type '${type.name}'`);\n for (const event of symbols.events) checkProperties(event.properties, `event '${event.name}'`);\n for (const query of symbols.queries) checkProperties(query.parameters, `query '${query.name}'`);\n for (const command of symbols.commands) {\n checkProperties(command.properties, `command '${command.name}'`);\n const identifiers = command.properties.filter((property) => property.isIdentifier);\n for (const extra of identifiers.slice(1)) {\n issues.push(\n tokenIssue(\n 'error',\n extra.line,\n lines[extra.line],\n 'identifier',\n `Command '${command.name}' already marks '${identifiers[0].name}' as identifier \u2014 only one property can be the identifier.`,\n diagnosticCodes.duplicateCommandIdentifier,\n ),\n );\n }\n }\n\n const declared = new Map<string, number>();\n for (const declaration of [...symbols.concepts, ...symbols.types]) {\n const first = declared.get(declaration.name);\n if (first === undefined) {\n declared.set(declaration.name, declaration.line);\n continue;\n }\n issues.push(\n tokenIssue(\n 'error',\n declaration.line,\n lines[declaration.line],\n declaration.name,\n `Duplicate declaration of '${declaration.name}' \u2014 concept and type names must be unique.`,\n diagnosticCodes.duplicateDeclaration,\n ),\n );\n }\n\n return issues;\n}\n\n// Validates a Screenplay document without any editor dependency \u2014 both the Monaco\n// service and the VSCode extension adapt these issues to their marker/diagnostic APIs.\n//\n// The checks read the document line by line, never as a whole document's top level, so a file an import\n// places in a module or feature - holding slices or features at its top level - validates as it is written.\n// Where it is placed, and whether its imports resolve, is the compiler's to say.\nexport function validateLines(lines: string[], context: ValidationContext = {}): ValidationIssue[] {\n const fences = fenceMap(lines);\n const scanned = scanDocument(lines);\n const application = context.application ?? mergeSymbols();\n const input = symbolsForBuffer(lines, { ...application, authoringPath: context.path ?? application.authoringPath, authoringPlacement: context.placement ?? application.authoringPlacement });\n const analysis = responseAnalysis(lines, input.authoringDocuments ?? input.authoringSources?.filter(source => source !== lines.join('\\n')), input.authoringPlacement, input.authoringPath, input.authoringPlacementResolved);\n const routeLines = new Set(analysis.eventSources.routes.map(route => route.location.line - 1));\n const symbols = { ...scanned, commands: scanned.commands.map(command => ({ ...command,\n properties: command.properties.filter(property => !routeLines.has(property.line)),\n produces: command.produces?.filter(production => !analysis.operationProductionLines?.has(production.line)),\n productionHeaders: command.productionHeaders?.filter(line => !analysis.operationProductionLines?.has(line)),\n })) };\n const events = new Set([...knownEventNames(symbols), ...knownEventNames(application)]);\n const policies = new Set([...symbols.policies, ...application.policies].map((policy) => policy.name));\n const issues: ValidationIssue[] = validateDeclarations(lines, symbols, application);\n issues.push(...validateProductionDestinations(lines, symbols));\n // One parser pass covers committed types, including query results and trigger data, without\n // speculative property scans mistaking tags, paths, strings or code for optionality.\n const optionalCodes = new Set<string>([DiagnosticCodes.LegacyOptionalSuffix, DiagnosticCodes.InvalidOptionalModifierOrder, DiagnosticCodes.OptionalReadsNotSupported]);\n const policyCodes = new Set<string>([DiagnosticCodes.UnexpectedTokenInPolicyCondition, DiagnosticCodes.ExpectedPolicyCondition, DiagnosticCodes.UnclosedPolicyConditionGroup, DiagnosticCodes.ExpectedRoleName, DiagnosticCodes.ExpectedClaimName, DiagnosticCodes.ExpectedClaimMatches, DiagnosticCodes.ExpectedClaimMatchTarget]);\n const consistencyCodes = new Set<string>([DiagnosticCodes.UnknownEvent, DiagnosticCodes.UnknownReadModelProperty, DiagnosticCodes.PiiNotSupportedOnIdentifier]);\n const timelineCodes = new Set<string>([DiagnosticCodes.EventFromLaterSlice, DiagnosticCodes.TimelineCycleGroup]);\n const dependencyCodes = new Set<string>([DiagnosticCodes.UndeclaredDependency, DiagnosticCodes.UnusedDependencyDeclaration, DiagnosticCodes.InvalidDependencyTarget, DiagnosticCodes.RepeatedDependencyDeclaration, DiagnosticCodes.MutualDependencyDeclarations, DiagnosticCodes.AmbiguousReference]);\n // These parser diagnostics must reach the marker adapter. C#-only completeness and reference\n // checks are not synthesized here, but are preserved when a caller supplies compiler diagnostics.\n const authoringCodes = new Set<string>([DiagnosticCodes.InvalidEventDeclaration, DiagnosticCodes.InvalidImportDeclaration, DiagnosticCodes.InvalidSliceDeclaration, DiagnosticCodes.InvalidDescription, DiagnosticCodes.DuplicateDescription, DiagnosticCodes.EmptyDescription,DiagnosticCodes.DuplicateEventSubject, DiagnosticCodes.InvalidSubjectType, DiagnosticCodes.ProtectedSubjectType, DiagnosticCodes.InvalidSubjectOwner, DiagnosticCodes.ReadModelSubjectNotSupported, DiagnosticCodes.InvalidSubjectModifierOrder, DiagnosticCodes.UnsupportedInteractionAlternatives, DiagnosticCodes.MixedInteractionAlternatives, DiagnosticCodes.InteractionAlternativeWithoutActions, DiagnosticCodes.InlineInteractionAlternative, DiagnosticCodes.LegacyInteractionWhere, DiagnosticCodes.InvalidSpecificationParameter, DiagnosticCodes.InvalidSpecificationCase, DiagnosticCodes.DuplicateSpecificationParameter, DiagnosticCodes.DuplicateSpecificationCase, DiagnosticCodes.IncompleteSpecificationTable, DiagnosticCodes.InvalidSpecificationCaseAssignment, DiagnosticCodes.InvalidSpecificationCaseValue, DiagnosticCodes.InvalidSpecificationCaseReference, DiagnosticCodes.OptionalSpecificationParameterTarget, DiagnosticCodes.SpecificationCaseNameCollision, DiagnosticCodes.IncompatibleSpecificationParameterType, DiagnosticCodes.UnusedSpecificationParameter, DiagnosticCodes.SingularSpecificationTableExpansion, DiagnosticCodes.InvalidSpecificationCallerPersona, DiagnosticCodes.UnsynthesizablePersonaCaller, DiagnosticCodes.PersonaWithoutGate, DiagnosticCodes.GateWithoutPersona, DiagnosticCodes.AmbiguousPersonaCaller, DiagnosticCodes.InvalidDocumentation, DiagnosticCodes.ConflictingDocumentationAcrossFiles, DiagnosticCodes.InvalidAbsentReadModelStep, DiagnosticCodes.UnknownConstraintProperty, DiagnosticCodes.OmittedProductionDestination, DiagnosticCodes.InvalidSpecificationExample, DiagnosticCodes.DuplicateSpecificationAssignment]);\n const complianceCodes = new Set<string>([DiagnosticCodes.InvalidPurposeDeclaration, DiagnosticCodes.InvalidPurposeVocabulary, DiagnosticCodes.DuplicatePurposeField, DiagnosticCodes.DuplicatePurposeDeclaration, DiagnosticCodes.UnknownPurpose, DiagnosticCodes.PurposeInterestMismatch, DiagnosticCodes.PersonalDataWithoutPurpose, DiagnosticCodes.SpecialDataWithoutCondition, DiagnosticCodes.CriminalDataWithoutAuthorization, DiagnosticCodes.PurposeWithoutBasis, DiagnosticCodes.UnusedPurpose, DiagnosticCodes.UnknownConceptDirective, DiagnosticCodes.AttributeReasonWithoutAttribute, DiagnosticCodes.DuplicateAttributeReason, DiagnosticCodes.LegacyComplianceMarker, DiagnosticCodes.UnknownComplianceMarker, DiagnosticCodes.InvalidSecretScope, DiagnosticCodes.DuplicateSecretScope, DiagnosticCodes.SecretScopeIgnoredForPii, DiagnosticCodes.InvalidPersonalDataQualifier, DiagnosticCodes.DuplicateSpecialCategory]);\n const compilerUnknownEventLines = new Set<number>();\n for (const diagnostic of context.compilerDiagnostics ?? analysis.diagnostics) {\n const identityType = diagnostic.code === DiagnosticCodes.UnknownType && (analysis.identityDetails ?? []).some(detail => detail.line === diagnostic.location.line - 1);\n const identityDuplicate = diagnostic.code === DiagnosticCodes.RepeatedSingularDeclarationAcrossFiles && diagnostic.message.includes('identity block');\n if (!identityType && !identityDuplicate && !complianceCodes.has(diagnostic.code) && !optionalCodes.has(diagnostic.code) && !policyCodes.has(diagnostic.code) && !consistencyCodes.has(diagnostic.code) && !timelineCodes.has(diagnostic.code) && !dependencyCodes.has(diagnostic.code) && !authoringCodes.has(diagnostic.code) && diagnostic.code !== DiagnosticCodes.InvalidSpecificationExampleBody && diagnostic.code !== DiagnosticCodes.UnknownRuleImplementationDirective && diagnostic.code !== DiagnosticCodes.InvalidValidationRule && diagnostic.code !== DiagnosticCodes.RepeatedDeclarationAcrossFiles && !/^PLAY049[0-9]$|^PLAY050[0-7]$|^PLAY054[7-9]$|^PLAY055[01]$|^PLAY048[2-9]$|^PLAY004[56]$|^PLAY053[0-9]$|^PLAY054[0-6]$|^PLAY034[1-8]$|^PLAY0557$|^PLAY060[7-9]$|^PLAY061[0-9]$|^PLAY0620$|^PLAY063[3-9]$|^PLAY064[0-6]$/.test(diagnostic.code)) continue;\n const line = diagnostic.location.line - 1;\n if (diagnostic.code === DiagnosticCodes.OmittedProductionDestination && issues.some(existing => existing.code === diagnostic.code && existing.line === line)) continue;\n if (diagnostic.code === DiagnosticCodes.UnknownEvent) {\n if (compilerUnknownEventLines.has(line)) continue;\n compilerUnknownEventLines.add(line);\n }\n const length = legacyOptionalTypeLength(lines[line], diagnostic) || lines[line].length - diagnostic.location.column + 1;\n issues.push(issue(diagnostic.severity, line, diagnostic.location.column, length, diagnostic.message, diagnostic.code as DiagnosticCode));\n }\n\n const checkEvent = (line: number, text: string, name: string) => {\n if (!events.has(name) && !compilerUnknownEventLines.has(line)) {\n issues.push(\n tokenIssue(\n 'warning',\n line,\n text,\n name,\n `Unknown event type '${name}' \u2014 declare it in a slice or import it.`,\n diagnosticCodes.unknownEvent,\n ),\n );\n }\n };\n\n let authorizeIndent = -1;\n\n for (let index = 0; index < lines.length; index++) {\n const line = lines[index];\n const trimmed = line.trim();\n\n if (fences[index] || trimmed.length === 0) continue;\n\n const leading = line.match(/^[ ]*(\\t+)/);\n if (leading) {\n issues.push(\n issue(\n 'warning',\n index,\n leading[0].length - leading[1].length + 1,\n leading[1].length,\n 'Screenplay is indentation-based \u2014 use spaces, not tabs.',\n diagnosticCodes.tabIndentation,\n ),\n );\n }\n\n // Policy references continue on indented lines below an authorize clause.\n if (authorizeIndent >= 0) {\n if (\n indentOf(line) > authorizeIndent &&\n /^(?:or\\s+)?[A-Z]\\w*(?:\\s+or\\s+[A-Z]\\w*)*$/.test(trimmed)\n ) {\n for (const name of trimmed.split(/\\s+/).filter((token) => token !== 'or')) {\n if (!policies.has(name)) {\n issues.push(\n tokenIssue(\n 'warning',\n index,\n line,\n name,\n `Unknown policy '${name}' \u2014 declare it with 'policy ${name}'.`,\n diagnosticCodes.unknownPolicy,\n ),\n );\n }\n }\n continue;\n }\n authorizeIndent = -1;\n }\n\n const fileImportIssue = validateImport(lines, fences, index);\n if (fileImportIssue) issues.push(fileImportIssue);\n\n const slice = trimmed.match(/^slice\\s+(\\w+)/);\n if (slice && !sliceTypes.includes(slice[1])) {\n issues.push(\n tokenIssue(\n 'error',\n index,\n line,\n slice[1],\n `Unknown slice type '${slice[1]}' \u2014 expected ${sliceTypes.join(', ')}.`,\n diagnosticCodes.unknownSliceType,\n ),\n );\n }\n\n const concept = trimmed.match(/^concept\\s+\\w+\\s*:\\s*(\\w+)/);\n if (concept && concept[1] !== 'Enum' && !primitiveTypes.includes(concept[1])) {\n issues.push(\n tokenIssue(\n 'error',\n index,\n line,\n concept[1],\n `Unknown primitive type '${concept[1]}' \u2014 expected ${primitiveTypes.join(', ')} or Enum.`,\n diagnosticCodes.unknownPrimitiveType,\n ),\n );\n }\n\n const authorize = trimmed.match(/^authorize\\s+(.*)$/);\n if (authorize) {\n authorizeIndent = indentOf(line);\n for (const name of authorize[1].split(/\\s+/).filter((token) => token !== 'or' && token.length > 0)) {\n if (!policies.has(name)) {\n issues.push(\n tokenIssue(\n 'warning',\n index,\n line,\n name,\n `Unknown policy '${name}' \u2014 declare it with 'policy ${name}'.`,\n diagnosticCodes.unknownPolicy,\n ),\n );\n }\n }\n }\n\n const reactsOn = trimmed.match(/^on\\s+([A-Z]\\w*)\\s*$/);\n if (reactsOn) checkEvent(index, line, reactsOn[1]);\n\n const produces = trimmed.match(/^produces\\s+([A-Z]\\w*)\\s*$/);\n if (produces && !analysis.operationProductionLines?.has(index)) checkEvent(index, line, produces[1]);\n\n if (/^produces\\s+when\\b/.test(trimmed) && !analysis.operationProductionLines?.has(index)) {\n for (let next = index + 1; next < lines.length; next++) {\n const candidate = lines[next];\n if (fences[next] || candidate.trim().length === 0) continue;\n if (indentOf(candidate) > indentOf(line)) {\n const name = candidate.trim().match(/^([A-Z]\\w*)\\s*$/);\n if (name) checkEvent(next, candidate, name[1]);\n }\n break;\n }\n }\n\n const uniqueEvent = trimmed.match(/^unique\\s+event\\s+([A-Z]\\w*)/);\n if (uniqueEvent) checkEvent(index, line, uniqueEvent[1]);\n\n const uniqueProperty = trimmed.match(/^unique\\s+[a-z_]\\w*\\s+on\\s+([A-Z]\\w*)/);\n if (uniqueProperty) checkEvent(index, line, uniqueProperty[1]);\n\n // Every $identity. path must name a member of the caller; anything after 'claims.' is a claim name.\n // A bare $identity is left to the compilers, which see it only where an expression is expected.\n for (const path of line.match(/\\$identity\\.[\\w.]+/g) ?? []) {\n const member = path.substring('$identity.'.length).split('.')[0];\n const knownIdentity = [...identityProperties, ...(analysis.identityDetails ?? []).map(detail => detail.name)];\n if (!knownIdentity.includes(member)) {\n issues.push(tokenIssue('warning', index, line, path,\n `Unknown $identity property '${member}' \u2014 expected ${knownIdentity.join(', ')}.`,\n diagnosticCodes.unknownContextIdentityProperty));\n }\n }\n\n // Every $context. path must name something CommandContext or QueryContext carries.\n for (const path of line.match(/\\$context\\.[\\w.]+/g) ?? []) {\n const segments = path.substring('$context.'.length).split('.');\n if (!contextRoots.includes(segments[0])) {\n issues.push(\n tokenIssue(\n 'warning',\n index,\n line,\n path,\n `Unknown $context path '${segments.join('.')}' \u2014 expected one of ${contextRoots.join(', ')}.`,\n diagnosticCodes.unknownContextPath,\n ),\n );\n } else if (\n segments[0] === 'causedBy' &&\n segments.length > 1 &&\n !causedByProperties.includes(segments[1])\n ) {\n issues.push(\n tokenIssue(\n 'warning',\n index,\n line,\n path,\n `Unknown $context.causedBy property '${segments[1]}' \u2014 expected ${causedByProperties.join(', ')}.`,\n diagnosticCodes.unknownContextCausedByProperty,\n ),\n );\n } else if (\n segments[0] === 'identity' &&\n segments.length > 1 &&\n !identityProperties.includes(segments[1])\n ) {\n issues.push(\n tokenIssue(\n 'warning',\n index,\n line,\n path,\n `Unknown $context.identity property '${segments[1]}' \u2014 expected ${identityProperties.join(', ')}.`,\n diagnosticCodes.unknownContextIdentityProperty,\n ),\n );\n }\n }\n }\n\n issues.push(...validateEventContextPaths(lines, fences));\n issues.push(...validateInlineEvents(lines, symbols, application, analysis.operationProductionLines));\n\n const fenceLines = lines\n .map((line, index) => ({ line, index }))\n .filter(({ line }) => /^\\s*```(?:[a-z]+)?\\s*$/.test(line));\n if (fenceLines.length % 2 === 1) {\n const last = fenceLines[fenceLines.length - 1];\n issues.push(\n issue(\n 'error',\n last.index,\n 1,\n last.line.length + 1,\n 'Unclosed inline code block \u2014 expected a closing ``` line.',\n diagnosticCodes.unclosedCodeBlock,\n ),\n );\n }\n\n return issues;\n}\n\n// This is advice, not a semantic default: accepting the typed workspace repair changes routing.\nfunction validateProductionDestinations(lines: string[], symbols: DocumentSymbols): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n lines = eventAnalysisSource(lines);\n for (const command of symbols.commands) {\n const identifiers = command.properties.filter(property => property.isIdentifier && !propertyTypeReference(property).isOptional && !propertyTypeReference(property).isCollection);\n if (identifiers.length !== 1) continue;\n for (const production of command.produces ?? []) {\n if (production.inline || production.conditional || production.target !== undefined) continue;\n const line = production.line;\n issues.push(issue('information', line, indentOf(lines[line]) + 1, lines[line].trim().length,\n `Plain 'produces ${production.name}' omits its destination \u2014 use 'for ${identifiers[0].name}' to explicitly select the command's identifier.`,\n diagnosticCodes.omittedProductionDestination));\n }\n }\n return issues;\n}\n\n// Inside a module or feature an import names files, and a quoted import anywhere has the compiler's shape.\nfunction validateImport(lines: string[], fences: boolean[], index: number): ValidationIssue | undefined {\n const line = lines[index];\n const trimmed = line.trim().replace(/\\s*\\/\\/.*$/, '');\n if (!/^import\\b/.test(trimmed) || fileImportOn(line, index)) return undefined;\n const indent = indentOf(line);\n const inBody = indent > 0 && ['module', 'feature'].includes(enclosingChain(lines, fences, index, indent)[0]);\n if (!inBody && !isFileImportLine(line)) return undefined;\n return issue(\n 'error',\n index,\n indent + 1,\n trimmed.length,\n `Invalid import '${trimmed}' \u2014 inside a module or feature, import names files: 'import \"<path or glob>\"'.`,\n diagnosticCodes.invalidFileImport,\n );\n}\n\n// A mapping target: the first word of a mapping line, after the keyword that opens it if there is one.\nconst mappingTarget = /^(?:(?:increment|decrement|count|clear|add|subtract|set)\\s+)?@?([$\\w.]+)(?=\\s|=|$)/;\n\n// Every $eventContext.<path> - in an expression or as the dynamic key of a mapping target - checked against the\n// event-context catalog the way the compiler checks it (Parsing/EventContextPathValidator.cs).\nexport function validateEventContextPaths(lines: string[], fences: boolean[]): ValidationIssue[] {\n const issues: ValidationIssue[] = [];\n const names = (members: readonly { name: string }[]) => members.map((member) => member.name).join(', ');\n\n for (let index = 0; index < lines.length; index++) {\n const line = lines[index];\n if (fences[index]) continue;\n\n for (const match of line.matchAll(/(\\.)?\\$eventContext((?:\\.(?:\\w+(?:\\(\\))?)?)*)/g)) {\n const token = match[0].substring(match[1]?.length ?? 0);\n const written = match[2];\n if (written.length === 0) {\n // A bare $eventContext names nothing only as a dynamic key; in an expression the compiler rejects it as invalid.\n if (match[1]) {\n issues.push(issue('error', index, (match.index ?? 0) + 2, token.length, `'$eventContext' names no member - expected one of ${names(resolveEventContextPath('').expected)}.`, diagnosticCodes.missingEventContextPath));\n }\n continue;\n }\n\n const path = written.substring(1);\n const resolution = resolveEventContextPath(path);\n const column = (match.index ?? 0) + (match[1]?.length ?? 0) + 1;\n switch (resolution.status) {\n case 'missing':\n issues.push(issue('error', index, column, token.length, `'$eventContext.${path}' names no member - expected one of ${names(resolution.expected)}.`, diagnosticCodes.missingEventContextPath));\n break;\n case 'unknownMember':\n issues.push(issue('warning', index, column, token.length, `Unknown event context member '${resolution.segment}' in '$eventContext.${path}' - expected one of ${names(resolution.expected)}.`, diagnosticCodes.unknownEventContextMember));\n break;\n case 'unknownSubPath': {\n const has = resolution.expected.length === 0 ? 'no members to address' : `members ${names(resolution.expected)}`;\n issues.push(issue('warning', index, column, token.length, `Unknown event context path '$eventContext.${path}' - '${resolution.member?.name}' (${resolution.member?.type}) has ${has}.`, diagnosticCodes.unknownEventContextPath));\n break;\n }\n case 'belowCollection':\n issues.push(issue('error', index, column, token.length, `'$eventContext.${path}' cannot resolve - '${resolution.member?.name}' is a collection (${resolution.member?.type}) and cannot be addressed below.`, diagnosticCodes.eventContextPathBelowCollection));\n break;\n }\n }\n\n // Only $eventContext resolves in a dynamic key; any other $ source is kept as the literal key text.\n const target = line.trim().match(mappingTarget)?.[1];\n const source = target?.match(/\\.\\$(\\w+)/)?.[1];\n if (target && source && source !== 'eventContext') {\n issues.push(tokenIssue('warning', index, line, target, `Dynamic dictionary key '$${source}' in '${target}' is never resolved - only '$eventContext.<path>' is, so the literal text '$${source}' becomes the key.`, diagnosticCodes.unresolvedDynamicKeySource));\n }\n }\n\n return issues;\n}\n"],
|
|
5
|
+
"mappings": "wCAOO,IAAMA,GAAa,aAEbC,GAA4D,CACrE,GAAID,GACJ,WAAY,CAAC,OAAO,EACpB,QAAS,CAAC,aAAc,aAAc,MAAM,EAC5C,UAAW,CAAC,mBAAmB,CACnC,EAMaE,GAAoB,CAC7B,SACA,SACA,UACA,OACA,SACA,UACA,UACA,iBACA,WACA,SACA,SACA,QACA,KACA,UACA,QACA,QACA,SACA,SACA,cACA,YACA,UACA,QACA,aACA,UACA,WACA,UACA,YACA,UACA,SACA,SACA,OACA,aACA,aACA,gBACA,OACA,YACA,UACA,OACA,WACA,WACA,UACJ,EAKO,IAAMC,GAAiB,CAC1B,UACA,YACA,UACA,WACA,cACA,gBACA,WACA,UACA,UACA,gBACA,OACA,QACA,UACA,YACA,WACA,WACA,QACA,KACA,UACA,YACA,aACA,aACA,SACA,OACA,OACA,QACA,OACA,YACA,SACA,QACA,UACA,QACA,UACA,MACA,QACA,OACA,UACA,MACA,MACA,MACA,SACA,QACA,OACA,QACA,MACA,KACA,KACA,SACA,OACA,MACA,YACA,UACA,WACA,UACA,QACA,WACA,SACA,UACA,SACA,YACA,aACA,QACA,UACA,OACA,eACA,UACA,OACA,SACA,SACA,OACA,YACA,QACA,WACA,WACA,SACA,WACA,KACA,QACA,UACA,QACA,UACA,QACA,SACA,QACA,KACA,SACA,OACA,cACA,cACA,aACA,aACA,WACA,MACA,MACA,YACA,KACA,OACA,QACA,KACA,QACA,UACA,WACA,SACA,OACA,WAIA,OACA,YACA,QACA,OACA,QACA,UACA,MACA,SACA,UACA,QACA,WACA,UACA,UACA,QACA,SACA,SACA,SACA,SACA,OACA,SACA,QACA,QACA,OACA,SACJ,EAEaC,GAAgB,CAAC,SAAU,aAAc,QAAS,OAAQ,KAAK,EAG/DC,GAAe,CACxB,UACA,YACA,SACA,WACA,YACA,WACA,UACJ,EAEaC,GAAqB,CAAC,UAAW,OAAQ,UAAU,EAInDC,GAAqB,CAAC,KAAM,OAAQ,WAAY,kBAAmB,QAAS,QAAQ,EAEpFC,GAAa,CAAC,cAAe,YAAa,aAAc,WAAW,EAEnEC,GAAiB,CAAC,OAAQ,SAAU,MAAO,UAAW,OAAQ,OAAQ,UAAU,EAEhFC,GAAoB,CAAC,MAAO,WAAY,QAAQ,EAIhDC,GAAqB,uWAErBC,GAAyD,CAClE,SAAU,CACN,YAAa,IACjB,EACA,SAAU,CACN,CAAC,IAAK,GAAG,EACT,CAAC,IAAK,GAAG,CACb,EACA,iBAAkB,CACd,CAAE,KAAM,IAAK,MAAO,GAAI,EACxB,CAAE,KAAM,IAAK,MAAO,GAAI,EACxB,CAAE,KAAM,IAAK,MAAO,GAAI,CAC5B,EACA,iBAAkB,CACd,CAAE,KAAM,IAAK,MAAO,GAAI,EACxB,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perties", "sliceTypes", "primitiveTypes", "conceptAttributes", "blockHeaderPattern", "languageConfiguration", "typeReferenceSymbol", "text", "match", "__name", "typeReferenceText", "type", "withoutComment", "line", "inString", "inTemplate", "index", "character", "__name", "indentOf", "firstWord", "fenceMap", "lines", "map", "open", "enclosingChain", "fences", "lineIndex", "indent", "chain", "currentIndent", "lineIndent", "nearestEnclosingLine", "enclosingHeaders", "headers", "eventContextRootType", "eventContextTypes", "eventContextPaths", "namesEventContextMember", "member", "segment", "declared", "__name", "eventContextMembers", "eventContextTypes", "eventContextRootType", "eventContextMembersAfter", "segments", "members", "candidate", "eventContextMemberAt", "resolveEventContextPath", "path", "current", "expected", "next", "describeEventContext", "describeEventContextMember", "below", "lines", "child", "documentationItem", "purposeReferenceItem", "purposeItems", "exampleDeclarationItems", "interactionItems", "moduleScopeItems", "purposeReferenceItem", "documentationItem", "exampleDeclarationItems", "featureScopeItems", "readModelItems", "reducerItems", "formItems", "contributeItems", "behaviorItems", "step", "__name", "label", "insertText", "documentation", "actionStepItems", "outcomeItems", "personaItems", "authenticationItems", "seedItems", "themeItems", "uiProfileItems", "layoutItems", "templateItems", "optionalTypeItems", "fenced", "__name", "tag", "identityItems", "contextVariableEntries", "symbols", "details", "detail", "contextVariableItems", "identityProperties", "topLevelItems", "exampleDeclarationItems", "operationItems", "operationImplementationItems", "language", "operationPhaseItems", "item", "conceptItems", "typeItems", "sliceItems", "purposeReferenceItem", "documentationItem", "commandItems", "eventItems", "inlineEventItems", "producesItems", "implementationItems", "handlerItems", "queryItems", "performerItems", "constraintItems", "reactionItems", "reactionTriggerItems", "refusalAvailability", "invocationItems", "refusalItems", "triggerItems", "specificationItems", "specificationStepItems", "namedRuleImplementationItems", "commandRuleItems", "ruleItems", "policyItems", "validateItems", "screenItems", "actionItems", "guardedActionItems", "interactionActionItems", "interactionChoiceItems", "actionArgumentItems", "tableItems", "property", "eventContextPaths", "path", "sliceMembers", "sliceItemsFor", "sliceType", "members", "DiagnosticCodes", "wordCharacters", "dotNetWhitespace", "nativePattern", "source", "word", "classes", "_match", "body", "rest", "__name", "pattern", "result", "inClass", "index", "current", "next", "dependencyPrefix", "dotNetWhitespace", "dependencyTrailingWhitespace", "splitLines", "source", "hashComments", "path", "result", "number", "offset", "raw", "line", "indent", "body", "stripComment", "content", "__name", "commentStart", "text", "inString", "inTemplate", "index", "current", "comment", "eventDeclarations", "slice", "command", "produced", "__name", "operationDeclarations", "slice", "command", "production", "__name", "AuthoringProductionKind", "AuthoringProductionResolver", "__name", "application", "declarations", "collect", "features", "parent", "feature", "scope", "slice", "module", "events", "event", "eventDeclarations", "generations", "logicalEvents", "latest", "node", "AuthoringProductionKind", "operationDeclarations", "entry", "named", "reference", "cache", "cached", "resolution", "candidates", "production", "candidate", "from", "segments", "segment", "qualifiers", "value", "index", "depth", "visible", "dependencySources", "dependencySourcesOf", "__name", "node", "ScreenplaySyntaxWalker", "__name", "_node", "syntax", "node", "property", "contribution", "item", "value", "detail", "group", "event", "column", "placement", "candidate", "stream", "part", "input", "hint", "field", "parameter", "slot", "exposed", "outlet", "result", "fixture", "member", "maximumCoefficient", "parseExactNumber", "text", "scanned", "scan", "digits", "first", "last", "scale", "appendedZeros", "coefficient", "normalizedScale", "fixedPoint", "__name", "isExactNumberToken", "negative", "integerStart", "position", "isDigit", "integer", "fraction", "fractionStart", "exponent", "exponentNegative", "exponentStart", "limit", "value", "stringBodyPattern", "escapes", "unescapeString", "value", "result", "index", "escaped", "__name", "maximumDepth", "InvalidStructuredValue", "__name", "StructuredValueParser", "#position", "text", "start", "context", "value", "#value", "#whitespace", "depth", "location", "#at", "current", "#list", "#object", "#string", "word", "#number", "items", "#take", "#expect", "members", "names", "keyLocation", "name", "DiagnosticCodes", "end", "#stringEnd", "raw", "from", "index", "match", "number", "parseExactNumber", "character", "pathPattern", "pattern", "nativePathPattern", "nativePattern", "numberPattern", "contextRoots", "causedByProperties", "identityProperties", "parseModeledMappingSource", "text", "location", "context", "parseMappingSource", "__name", "nativeIdentifiers", "DiagnosticCodes", "path", "warnOnUnknownIdentityProperty", "warnOnUnknownContextPath", "StructuredValueParser", "error", "InvalidStructuredValue", "literal", "parseLiteral", "root", "member", "value", "unescapeString", "isExactNumberToken", "number", "parseExactNumber", "validateIdentity", "application", "context", "details", "names", "detail", "known", "concept", "type", "imported", "resolver", "AuthoringProductionResolver", "slice", "model", "projection", "variants", "block", "name", "variant", "reducer", "dependencySourcesOf", "IdentityPaths", "declared", "DiagnosticCodes", "identityProperties", "source", "isTokenKey", "parts", "qualifiers", "queries", "scope", "query", "entry", "qualifier", "index", "authorizations", "module", "collectFeatureAuthorizations", "policies", "authorization", "policyNames", "dependency", "DetailReferences", "policy", "__name", "expression", "requirement", "features", "segments", "result", "feature", "ScreenplaySyntaxWalker", "syntax", "property", "diagnostic", "EventSourceResolutionKind", "EventSourceCatalog", "__name", "application", "source", "type", "stream", "sources", "streams", "parent", "candidate", "kind", "EventSourceResolutionKind", "eventProductions", "command", "context", "produced", "__name", "requiresExplicitDestinations", "events", "identifier", "property", "implicitDestination", "sibling", "identifiers", "InvalidExactNumber", "__name", "canonicalExactText", "number", "parseExactNumber", "exactIsIntegral", "number", "canonicalExactText", "__name", "date", "dateTime", "responseDateValue", "text", "includeTime", "match", "year", "month", "day", "days", "hours", "minutes", "__name", "roleClaimType", "ordinal", "__name", "left", "right", "claimTypeKey", "type", "character", "upper", "synthesizePersonaCaller", "persona", "application", "contributions", "policies", "refused", "refusal", "name", "policy", "not", "negation", "required", "complete", "roles", "atom", "claims", "claim", "condition", "values", "satisfied", "target", "first", "specificationCaseOrigins", "firstWord", "__name", "content", "space", "unescapeIdentifier", "identifier", "splitTopLevel", "text", "separator", "parts", "start", "inString", "inTemplate", "index", "current", "sourceLocation", "__name", "line", "column", "path", "isBlank", "__name", "line", "locationOf", "sourceLocation", "startOf", "propertyPattern", "pattern", "invalidGeneratedModifiers", "reversedModifiers", "tryParseProperty", "line", "match", "location", "locationOf", "unescapeIdentifier", "parseTypeRef", "__name", "text", "legacy", "canonical", "isOptional", "isCollection", "parseProperty", "context", "property", "reportLegacyOptionalSuffix", "reportInvalidModifierOrder", "type", "length", "offset", "name", "DiagnosticCodes", "subjectModifiers", "modifiers", "modifier", "thenReturnsPrefix", "pattern", "generatedFixturePrefix", "generatedFixturePattern", "fieldPattern", "quotedValue", "stringBodyPattern", "parseConcrete", "context", "text", "location", "code", "parseSpecificationValue", "containsCaseReference", "DiagnosticCodes", "expression", "parseMappingSource", "__name", "parseConcreteMapping", "line", "regex", "match", "locationOf", "source", "child", "parseReturn", "prefix", "value", "concrete", "fields", "field", "caseHeader", "pattern", "assignment", "reference", "containsCaseReference", "text", "__name", "parseSpecificationValue", "location", "context", "nativeIdentifiers", "DiagnosticCodes", "parseMappingSource", "match", "parseParameter", "line", "offset", "property", "parseProperty", "locationOf", "child", "parseCase", "values", "add", "owner", "valueLocation", "source", "parseConcrete", "value", "nested", "caseReferences", "validateTable", "specification", "parameters", "cases", "parameter", "index", "prior", "row", "references", "substituteCase", "copies", "result", "item", "key", "specificationExamples", "application", "entries", "examples", "__name", "nodes", "scope", "example", "features", "parent", "feature", "slice", "name", "eventDeclarations", "event", "command", "model", "node", "module", "resolve", "reference", "candidates", "parts", "named", "entry", "qualifiers", "part", "index", "depth", "visible", "matches", "imported", "fixture", "kind", "declaration", "type", "merge", "inherited", "authored", "value", "replacement", "step", "role", "resolved", "route", "effective", "values", "prior", "action", "specificationCommandExamples", "expandSpecificationExamples", "expandEffectiveSpecificationExamples", "specifications", "expanded", "specification", "steps", "pair", "persona", "caller", "synthesizePersonaCaller", "synthesizedCaller", "atom", "result", "row", "copies", "substituteCase", "specificationCaseOrigins", "dependencySources", "dependencySourcesOf", "primitiveTypes", "validateResponses", "application", "context", "inputs", "effectiveCommand", "specificationCommandExamples", "slices", "collect", "__name", "feature", "parent", "scope", "slice", "child", "module", "commands", "properties", "responseFields", "command", "entries", "uniqueByName", "imports", "imported", "name", "resolved", "resolve", "from", "key", "segments", "candidates", "qualifiers", "entry", "value", "index", "depth", "visible", "concepts", "conceptNames", "concept", "composites", "type", "readModels", "model", "commandProperties", "checkDeclarations", "declared", "property", "DiagnosticCodes", "checkFeature", "production", "event", "reaction", "trigger", "validateSource", "source", "explicit", "response", "names", "field", "validateSpecification", "specification", "action", "input", "identifiers", "uuidValue", "fixture", "compatibleValue", "expectation", "fields", "asserted", "contract", "items", "result", "duplicates", "item", "member", "primitive", "exactIsIntegral", "responseDateValue", "uuidValuePattern", "text", "commandPathType", "command", "path", "application", "composites", "uniqueByName", "fields", "result", "optional", "collection", "segment", "matches", "field", "type", "__name", "commandDestinationType", "produced", "context", "destination", "implicitDestination", "property", "primitives", "RefusalDeclarations", "__name", "application", "AuthoringProductionResolver", "uniqueByName", "type", "concept", "slice", "latest", "event", "eventDeclarations", "name", "from", "select", "entries", "scope", "node", "entry", "candidates", "reference", "parts", "named", "qualifiers", "part", "index", "depth", "visible", "matches", "imports", "imported", "properties", "path", "property", "source", "target", "primitives", "validateSpecificationCases", "application", "context", "standaloneSpecifications", "declarations", "RefusalDeclarations", "examples", "specificationExamples", "knownType", "__name", "name", "composites", "type", "property", "owners", "slice", "scope", "names", "specification", "expandedNames", "row", "DiagnosticCodes", "parameter", "assignment", "value", "compatibleValue", "check", "expression", "target", "sourceConcept", "targetConcept", "assignments", "values", "properties", "command", "declaration", "response", "field", "authored", "event", "route", "EventSourceCatalog", "source", "EventSourceResolutionKind", "stream", "eventDestinationType", "part", "model", "trigger", "error", "absent", "keyed", "owner", "query", "parameters", "results", "result", "uniqueDestinationType", "types", "distinct", "reference", "local", "resolver", "AuthoringProductionResolver", "commandTypes", "produced", "commandDestinationType", "producerTypes", "visited", "reaction", "sourceName", "path", "declared", "capture", "child", "nested", "append", "productionDestinationDiagnostics", "application", "resolver", "AuthoringProductionResolver", "slice", "command", "identifiers", "property", "production", "DiagnosticCodes", "__name", "validateConstraintProperties", "application", "context", "slices", "AuthoringProductionResolver", "entry", "events", "eventDeclarations", "slice", "rule", "constraint", "declarations", "event", "property", "field", "DiagnosticCodes", "__name", "same", "__name", "left", "right", "segment", "index", "addressOf", "container", "DeclaredDependencyTargets", "application", "containers", "inventory", "feature", "parent", "child", "module", "from", "owner", "address", "parts", "length", "reference", "tier", "segments", "matches", "depth", "validateDependencyDeclarations", "context", "hasDependencies", "seenByOwner", "keep", "dependencies", "kept", "seen", "dependency", "resolution", "target", "key", "DiagnosticCodes", "normalize", "documentPlacement", "isDocumentPlacement", "__name", "placement", "describePlacement", "continuationPattern", "pattern", "tokenPattern", "namePattern", "parseAuthorize", "context", "line", "text", "child", "tokens", "tokenize", "location", "locationOf", "DiagnosticCodes", "requirement", "RequirementParser", "__name", "combineAuthorize", "first", "next", "token", "isOperandEnd", "isOperandStart", "isName", "#position", "#or", "#chain", "#and", "#groupOrReference", "operator", "operand", "left", "right", "#reference", "parseFencedText", "context", "opener", "tagLine", "allowMarkdown", "open", "expectedFence", "DiagnosticCodes", "locationOf", "code", "line", "strip", "__name", "descriptionPattern", "pattern", "stringBodyPattern", "parseDescription", "context", "line", "existing", "owner", "allowMarkdown", "text", "parseFencedText", "DiagnosticCodes", "locationOf", "keep", "match", "unescapeString", "__name", "description", "header", "pattern", "vocabulary", "stringBodyPattern", "textField", "transfer", "identifier", "erasure", "bases", "conditions", "exceptions", "parsePurpose", "context", "line", "name", "purposeName", "purpose", "locationOf", "seen", "recipients", "transfers", "child", "keyword", "firstWord", "DiagnosticCodes", "parseDescription", "match", "values", "reference", "unescapeString", "subjects", "value", "__name", "parsePurposeReference", "references", "parseDocumentation", "context", "line", "existing", "owner", "code", "DiagnosticCodes", "locationOf", "text", "parseFencedText", "__name", "declaration", "nativePattern", "dotNetWhitespace", "parseDependsOn", "context", "line", "declarations", "errorCode", "target", "locationOf", "dependency", "DiagnosticCodes", "__name", "fileImportPattern", "pattern", "quotedPattern", "isFileImport", "__name", "content", "tryParseFileImport", "line", "match", "locationOf", "parseFileImport", "context", "imports", "fileImport", "DiagnosticCodes", "operators", "parseCondition", "context", "text", "location", "strict", "whitespace", "dotNetWhitespace", "numeric", "words", "regex", "nativePattern", "stringBodyPattern", "unsupported", "DiagnosticCodes", "tokens", "position", "group", "__name", "condition", "or", "left", "operator", "right", "parseModeledMappingSource", "and", "alternative", "pattern", "dotNetWhitespace", "otherwise", "argument", "itemPath", "bindingWhitespace", "parseGuardedAction", "context", "line", "label", "parseNavigate", "alternatives", "fallback", "navigate", "sawOtherwise", "child", "match", "fallbackMatch", "DiagnosticCodes", "locationOf", "condition", "parseCondition", "args", "parseArguments", "validateCondition", "nested", "firstWord", "isLabel", "__name", "value", "supported", "LineReader", "_LineReader", "__name", "#index", "lines", "isBlank", "reader", "line", "InvalidSyntaxJson", "__name", "legacySourceOptions", "exactSourceOptions", "invalidSourceOptions", "validatedSourceOptions", "value", "InvalidSyntaxJson", "mode", "__name", "authoredDocuments", "recordAuthoredDocument", "root", "isAuthoredDocument", "ParserContext", "_ParserContext", "__name", "#diagnostics", "legacySourceOptions", "context", "reader", "path", "languages", "sourceLocation", "first", "second", "entry", "line", "code", "message", "location", "parentIndent", "child", "inline", "pattern", "dotNetWhitespace", "trigger", "where", "actions", "validateInteractionBodies", "context", "lines", "index", "header", "on", "body", "child", "children", "line", "branches", "firstWord", "supported", "guards", "sawOtherwise", "branch", "isWhen", "match", "DiagnosticCodes", "locationOf", "condition", "parseCondition", "validateCondition", "position", "nested", "guard", "deprecateWhere", "__name", "probe", "ParserContext", "LineReader", "message", "form", "pattern", "execution", "field", "argument", "mapping", "parameter", "actionBoundaries", "collectInputUses", "context", "header", "owners", "parameters", "inputs", "isBehavior", "firstWord", "formDescription", "recognize", "__name", "line", "declared", "formMatch", "execute", "owner", "supplied", "unescapeIdentifier", "locationOf", "lines", "child", "parseDescription", "validateInteractionBodies", "input", "sourceStreamPattern", "source", "pattern", "__name", "identifier", "typeName", "isSourceStreamName", "value", "isSourceStreamTypeName", "pinPattern", "pattern", "stringBodyPattern", "typeDirective", "sourceStreamPattern", "sourceHeader", "streamHeader", "parseEventSource", "context", "header", "name", "invalid", "streams", "identifier", "description", "id", "child", "firstWord", "parseEventStream", "parseType", "parseDescription", "parsePin", "locationOf", "__name", "streamId", "streamIdParts", "declared", "directiveLocations", "parseStreamIdParts", "line", "keyword", "previous", "match", "parseTypeRef", "reportLegacyOptionalSuffix", "rejectChildren", "DiagnosticCodes", "value", "unescapeString", "parseCommandStream", "candidate", "ambiguous", "eventSource", "stream", "route", "block", "parseRouteParts", "location", "parseMappingSource", "parts", "declaration", "type", "code", "mapping", "message", "typeReferencePattern", "pattern", "pathOf", "__name", "line", "firstWord", "isFileDirective", "isFileDirectiveAmongProperties", "whiteSpace", "isBlankImplementationHint", "text", "character", "code", "__name", "hintPattern", "isFile", "__name", "line", "firstWord", "isCode", "context", "parseFile", "path", "DiagnosticCodes", "locationOf", "isClosingCodeFence", "parseCode", "tag", "language", "open", "next", "lines", "strip", "parseHandler", "handler", "body", "parseImplementation", "file", "code", "extra", "wrapper", "source", "parseImplementationWrapper", "hints", "hasPayload", "child", "match", "text", "unescapeString", "isBlankImplementationHint", "nested", "parsedFile", "parsedCode", "systemHeader", "pattern", "operationHeader", "inlineHeader", "usesPattern", "typedMapping", "eventMetadata", "rejectOperationChildren", "context", "line", "code", "message", "child", "locationOf", "__name", "parseSystem", "header", "match", "DiagnosticCodes", "description", "firstWord", "parseDescription", "parseOperation", "inline", "name", "uses", "usesLocation", "execute", "compensate", "inputs", "mappings", "names", "typed", "propertyLine", "tryParseProperty", "property", "parseProperty", "parseMappingSource", "phase", "parseOperationPhase", "file", "implementation", "sourceSelected", "source", "parseImplementationWrapper", "isFileDirective", "parsedFile", "parseFile", "parsedCode", "parseCode", "operationStepPrefix", "pattern", "operationStep", "header", "callerPersonaPattern", "stepName", "inlineAssignment", "stepPattern", "__name", "prefix", "exactly", "nativePattern", "dotNetWhitespace", "givenPattern", "whenAppendPattern", "whenPattern", "thenEventPattern", "thenQueryPrefix", "readModelPrefix", "givenReadModelPattern", "thenReadModelPattern", "thenNoPrefix", "thenErrorPattern", "stringBodyPattern", "mappingPattern", "nativeMappingPattern", "givenClockPrefix", "givenCapturePrefix", "whenClockPrefix", "whenTriggerPrefix", "whenCapturePrefix", "whenQueryPrefix", "thenResultPrefix", "noResultPrefix", "whenRedeliveredPrefix", "whenRedeliveredPattern", "noEventsPrefix", "clockPattern", "whenTriggerPattern", "capturePattern", "whenQueryPattern", "thenResultPattern", "thenAbsentReadModelPattern", "absentKeyStringPattern", "thenQueryPattern", "parseSpecification", "context", "line", "name", "DiagnosticCodes", "locationOf", "description", "parameters", "cases", "body", "child", "isFileDirective", "parseOperationStep", "keyword", "firstWord", "parameter", "parseParameter", "row", "parseCase", "parseDescription", "parseGiven", "parseWhen", "parseThen", "_", "_noEventsLine", "members", "specification", "validateTable", "match", "skipBody", "values", "value", "parseConcreteMapping", "rejectOperationChildren", "parseClock", "capture", "parseCapture", "parseCaller", "readModel", "parseReadModelStep", "event", "parseEventStep", "callerRolePattern", "callerClaimPattern", "authenticated", "roles", "claims", "role", "claim", "unescapeString", "containsCaseReference", "appends", "code", "parseValuesWithEventSource", "parseNamedStep", "trigger", "query", "generatedValues", "thenReturnsPrefix", "expectation", "parseReturn", "parseResult", "caseValue", "parseSpecificationValue", "error", "absent", "parseAbsentReadModel", "key", "exact", "reject", "message", "at", "args", "results", "hasArguments", "parseValues", "keyText", "concrete", "hasChildren", "indent", "record", "regex", "expected", "create", "specificationStream", "sourceStreamPattern", "specificationStreamId", "parent", "generated", "inline", "eventKeyword", "addInlineValue", "eventSource", "stream", "noStream", "hasRoute", "generatedFixturePrefix", "fixture", "generatedFixturePattern", "mapping", "addFixtureValue", "mappingOf", "route", "rejectSpecificationRouteChildren", "parseSpecificationStream", "source", "streamId", "streamIdParts", "block", "directiveLocations", "parseRouteParts", "part", "location", "nativeIdentifiers", "header", "nativePattern", "dotNetWhitespace", "mapping", "parseExample", "context", "line", "match", "DiagnosticCodes", "locationOf", "body", "parseFixtureBody", "reference", "caseReferences", "__name", "addInlineValue", "values", "property", "text", "offset", "location", "source", "parseConcrete", "addFixtureValue", "value", "other", "existing", "parent", "inline", "allowGenerated", "example", "generatedValues", "eventSource", "description", "stream", "noStream", "child", "firstWord", "parseDescription", "generatedFixturePrefix", "fixture", "parseConcreteMapping", "generatedFixturePattern", "route", "specificationStream", "rejectSpecificationRouteChildren", "parseSpecificationStream", "parseSpecificationValue", "sliceTypes", "TranslationDirection", "eventsSourceKind", "fromSetting", "isEventsSource", "source", "__name", "consumedEvents", "setting", "EventVisibility", "blankOrigin", "dotNetWhitespace", "isBlankPublicEventOrigin", "__name", "text", "publicEventMetadataError", "node", "declaration", "visibility", "EventVisibility", "slice", "TranslationDirection", "eventBodyReservedWords", "idPattern", "pattern", "stringBodyPattern", "EventMetadataParser", "__name", "name", "context", "line", "location", "locationOf", "firstWord", "match", "id", "unescapeString", "DiagnosticCodes", "parseDescription", "parseDocumentation", "typeHeader", "pattern", "eventHeader", "stringBodyPattern", "readModelHeader", "maximumGeneration", "typeShapedPattern", "tagIdentifierPattern", "isDescription", "__name", "line", "firstWord", "tryParseProperty", "withoutIdentifier", "context", "property", "code", "message", "locationOf", "parseType", "header", "name", "DiagnosticCodes", "properties", "description", "parseDescription", "isFileDirectiveAmongProperties", "parseProperty", "parseEvent", "match", "origin", "unescapeString", "visibility", "EventVisibility", "isBlankPublicEventOrigin", "hasGenerationMarker", "generation", "declared", "tags", "metadata", "EventMetadataParser", "eventBodyReservedWords", "tag", "parseTag", "eventDeclaration", "value", "expression", "parseMappingSource", "parseReadModel", "documentation", "parseDocumentation", "exactPath", "nativePattern", "parseProjectionExpression", "text", "location", "context", "parts", "DiagnosticCodes", "inner", "start", "index", "end", "structured", "parseModeledMappingSource", "literal", "parseLiteral", "__name", "grammar", "__name", "source", "pattern", "nativePattern", "headerRules", "eventNameRules", "appendRules", "childrenRules", "nestedRules", "select", "context", "rules", "mappingPattern", "mapEntryPattern", "translationPattern", "stringBodyPattern", "splitPattern", "whenTokens", "splitTarget", "parseCapture", "line", "owner", "name", "DiagnosticCodes", "locationOf", "key", "map", "appends", "children", "nested", "child", "firstWord", "parseSource", "parseMap", "pushAppend", "match", "body", "mapAndAppends", "settings", "settingName", "syntaxKind", "eventsSourceKind", "validateEventsSource", "seen", "setting", "fromSetting", "location", "targets", "target", "parseProjectionExpression", "unescapeString", "raw", "closing", "translate", "text", "translations", "entry", "translated", "mappings", "tags", "when", "mapping", "tag", "parseTag", "mapped", "unescapeIdentifier", "parseModeledMappingSource", "parseWhen", "value", "trigger", "properties", "from", "to", "expression", "tokens", "unquote", "index", "scalarResponsePattern", "pattern", "fieldPattern", "parseCommandResponse", "context", "line", "location", "locationOf", "match", "DiagnosticCodes", "child", "sourceOffset", "unescapeIdentifier", "fields", "tryParseProperty", "fieldLocation", "type", "parseTypeRef", "reportLegacyOptionalSuffix", "nested", "__name", "commandReadSources", "captureReads", "line", "match", "nativePattern", "dotNetWhitespace", "locationOf", "__name", "fork", "context", "ParserContext", "captureConcurrency", "body", "eventSource", "dimensions", "eventTypes", "child", "firstWord", "dimension", "names", "name", "captureReducer", "rules", "parseDescription", "rule", "inlineOperationPrefix", "pattern", "inlineHeader", "plainHeader", "conditional", "eventName", "targetPattern", "mappingPattern", "typedMappingPattern", "reserved", "parseProduces", "context", "header", "inCommand", "DiagnosticCodes", "locationOf", "parsed", "parseOperation", "inline", "parent", "when", "name", "targetColumn", "parseCondition", "child", "plain", "properties", "propertyNames", "mappings", "tags", "metadata", "EventMetadataParser", "target", "line", "keyword", "firstWord", "location", "tag", "parseTag", "forMatch", "parseMappingSource", "match", "property", "parseProperty", "propertyName", "unescapeIdentifier", "__name", "header", "pattern", "routeHeader", "sourceStreamPattern", "severityPattern", "messagePattern", "stringBodyPattern", "rulePattern", "operandPattern", "ruleNamePattern", "optionalReads", "operandKinds", "severities", "opaqueDirectives", "propertyShapedDirectives", "parseCommand", "context", "line", "names", "lookahead", "ParserContext", "parseCommandBody", "__name", "responseNames", "discoveredNames", "name", "DiagnosticCodes", "locationOf", "properties", "responses", "identifier", "validations", "produces", "reads", "referenceReads", "concurrency", "description", "documentation", "authorize", "handler", "stream", "streamCandidates", "child", "keyword", "firstWord", "asProperty", "tryParseProperty", "addProperty", "scalar", "scalarResponsePattern", "parseCommandResponse", "reportInvalidModifierOrder", "source", "streamName", "ambiguous", "route", "parseCommandStream", "parseDescription", "parseDocumentation", "combineAuthorize", "parseAuthorize", "validate", "parseValidate", "production", "parseProduces", "parseHandler", "reference", "captureReads", "captureConcurrency", "read", "candidates", "entry", "property", "response", "removed", "parsed", "syntax", "commandReadSources", "dependencySources", "commandName", "reportLegacyOptionalSuffix", "owner", "fence", "code", "parseCode", "rules", "requirements", "wrapperIndent", "condition", "parseCondition", "message", "severity", "hasSeverity", "directive", "matched", "unescapeString", "rule", "parseValidationRule", "valueContext", "withSeverity", "splitMessage", "splitSeverity", "match", "parseRule", "parseRuleImplementation", "commandOwner", "body", "wrapped", "parseImplementationWrapper", "isFile", "parseFile", "isCode", "extra", "content", "text", "operand", "parseMappingSource", "header", "pattern", "uniqueEventPattern", "uniquePropertyPattern", "releasePattern", "messagePattern", "stringBodyPattern", "targetOf", "__name", "rule", "parseConstraint", "context", "line", "headerMatch", "DiagnosticCodes", "locationOf", "name", "firstWord", "rules", "releases", "releasedEvents", "targets", "message", "description", "ignoreCasing", "child", "parseDescription", "release", "text", "unescapeString", "addRule", "parsed", "parseRule", "target", "location", "uniqueEvent", "uniqueProperty", "properties", "property", "isFileDirective", "path", "shape", "header", "pattern", "eventSpecPattern", "joinPattern", "withPattern", "childrenPattern", "nestedPattern", "removeWithPattern", "removeViaJoinPattern", "clearWithPattern", "variantPattern", "entersOnPattern", "keywordMappingPattern", "arithmeticPattern", "setPattern", "assignmentPattern", "keywordMappings", "parseProjection", "context", "line", "match", "DiagnosticCodes", "locationOf", "firstWord", "name", "sequence", "description", "autoMap", "key", "blocks", "child", "isFileDirective", "keyword", "parseDescription", "parseKey", "parseVariant", "block", "parseBlock", "reportVariantConflicts", "__name", "variants", "byName", "variant", "duplicate", "group", "entering", "entry", "nestedScope", "location", "parseFrom", "includeChildren", "mappings", "parseMappingBlock", "parseJoin", "parseChildren", "parseNested", "parseRemove", "parseClearWith", "events", "spec", "splitTopLevel", "text", "unescapeIdentifier", "parseProjectionExpression", "parentKey", "pushMapping", "withMatch", "parseChildBlocks", "property", "viaJoin", "entersOn", "parseEntersOn", "parts", "expression", "closing", "extra", "arithmetic", "assigned", "header", "pattern", "parameterPattern", "scopePattern", "opaqueDirectives", "parseQuery", "context", "line", "match", "DiagnosticCodes", "locationOf", "firstWord", "parseTypeRef", "name", "returnType", "reportLegacyOptionalSuffix", "by", "filters", "description", "scope", "authorize", "child", "keyword", "parseDescription", "parameter", "parseParameter", "filter", "combineAuthorize", "parseAuthorize", "parseScope", "__name", "nameOffset", "type", "parseMappingSource", "existing", "queryName", "typedValue", "pattern", "parseTriggerData", "context", "line", "property", "parseProperty", "DiagnosticCodes", "locationOf", "__name", "parseTriggerDeclaration", "header", "start", "firstWord", "parseDescription", "isFileDirective", "header", "pattern", "whenPattern", "everyPattern", "atPattern", "clauseKeywords", "invokesPattern", "mappingPattern", "nativePattern", "refusalPrefix", "refusalHeader", "optionalReads", "parseReaction", "context", "line", "name", "DiagnosticCodes", "locationOf", "description", "documentation", "where", "triggers", "sources", "reported", "child", "keyword", "firstWord", "parseDescription", "parseDocumentation", "parseCondition", "source", "parseTriggerSource", "key", "sourceKey", "parseTrigger", "__name", "produces", "invokes", "reads", "data", "produced", "parseProduces", "match", "uses", "ParserContext", "collectInputUses", "mappings", "onRefused", "value", "refusal", "parseRefusal", "mapped", "parseModeledMappingSource", "read", "captureReads", "start", "parseTriggerData", "property", "syntax", "dependencySources", "acknowledge", "location", "amount", "unitOf", "parseSchedule", "time", "timeOf", "day", "text", "hours", "minutes", "bindingHead", "pattern", "literalBindingHead", "qualifiedPath", "requiredQualifiedPath", "mode", "nullBehavior", "expected", "parseFromClause", "context", "text", "location", "trimmed", "first", "parseUiBinding", "__name", "withModifiers", "create", "body", "literalHead", "DiagnosticCodes", "parseMappingSource", "head", "binding", "parseBindingSource", "source", "expression", "raw", "queryBinding", "componentBinding", "match", "componentId", "path", "modifiers", "next", "rest", "modeMatch", "nullMatch", "expectedMatch", "bindingKind", "operand", "stringBodyPattern", "header", "pattern", "data", "action", "label", "guardedAction", "navigate", "route", "outletPattern", "contributionPattern", "parameter", "component", "stableId", "componentPropertyBinding", "componentPropertyLiteral", "exposes", "presentation", "toolbarItem", "slot", "title", "column", "rowClick", "field", "operandText", "__name", "match", "quotedGroup", "unescapeString", "isInteraction", "line", "firstWord", "isCodeLine", "context", "parseScreen", "DiagnosticCodes", "locationOf", "directives", "contributions", "description", "child", "parsed", "parseScreenContribution", "parseDescription", "isFileDirective", "pushDirective", "parseDirectives", "directive", "parseDirective", "parent", "parseData", "parseAction", "parseTemplateReference", "parseSection", "parseTitle", "parseTable", "parseSummary", "parseComponent", "parseToolbar", "parseNavigate", "collectInputUses", "parseCode", "parseTypeRef", "guarded", "parseGuardedAction", "text", "target", "labelMatch", "parameters", "routeValue", "outletValue", "parameterMatch", "parseFromClause", "routeMatch", "outletMatch", "name", "slots", "columns", "click", "columnMatch", "clickMatch", "labelled", "fields", "dataContext", "componentStableId", "icon", "properties", "exposedValues", "presentationValues", "outlets", "parseUiContext", "parseStableId", "parseComponentProperty", "parsePresentationValue", "parseExposedValue", "parseUiBindingValue", "bound", "literal", "parseMappingSource", "values", "items", "item", "parseToolbarItem", "itemLabel", "syntaxKind", "language", "code", "parseFencedText", "header", "pattern", "opaqueMembers", "parseSlice", "context", "line", "match", "type", "name", "DiagnosticCodes", "locationOf", "sliceTypes", "previous", "direction", "hasDirection", "description", "documentation", "events", "operations", "commands", "queries", "projections", "reactions", "captures", "constraints", "specifications", "examples", "purposes", "readModels", "screens", "reducers", "child", "isFileDirective", "metadataWord", "keyword", "firstWord", "parseDescription", "parseDocumentation", "parsePurposeReference", "parseOperation", "directionMatch", "TranslationDirection", "parseEvent", "parseCommand", "parseQuery", "parseProjection", "parseCapture", "parseReaction", "parseConstraint", "parseExample", "parseSpecification", "parseReadModel", "parseScreen", "captureReducer", "syntax", "dependencySources", "__name", "featurePattern", "pattern", "opaqueFeatureMembers", "featureBodyExpected", "FeatureBody", "__name", "#features", "#slices", "#examples", "#fileImports", "#dependsOn", "#purposes", "#description", "#documentation", "#authorize", "name", "context", "line", "keyword", "firstWord", "parseDescription", "parseDocumentation", "parseDependsOn", "DiagnosticCodes", "parsePurposeReference", "combineAuthorize", "parseAuthorize", "parseFileImport", "parseFeature", "parseExample", "parseSlice", "collectInputUses", "location", "isPlacement", "locationOf", "body", "previous", "child", "modulePattern", "pattern", "opaqueModuleMembers", "moduleBodyExpected", "ModuleBody", "__name", "#features", "#examples", "#fileImports", "#dependsOn", "#purposes", "#description", "#documentation", "#authorize", "name", "context", "line", "keyword", "firstWord", "parseDescription", "parseDocumentation", "parseDependsOn", "DiagnosticCodes", "parsePurposeReference", "combineAuthorize", "parseAuthorize", "parseFileImport", "parseExample", "parseFeature", "collectInputUses", "child", "locationOf", "location", "isPlacement", "parseModule", "body", "previous", "orders", "authoredOrderKey", "__name", "scope", "authoredOrderOf", "application", "dependencyKinds", "InvalidDependencyQuery", "__name", "referenceClassifications", "sliceReferences", "slice", "collector", "SliceReferenceCollector", "left", "right", "__name", "buildingReadModelReferences", "readModel", "projection", "dependencySourcesOf", "reducer", "variants", "blocks", "block", "ScreenplaySyntaxWalker", "name", "syntax", "node", "sources", "found", "variant", "add", "targetKind", "role", "command", "redelivery", "stronglyConnectedGroups", "graph", "indices", "low", "stack", "active", "groups", "visit", "__name", "node", "next", "group", "member", "orderingKinds", "ordinal", "__name", "left", "right", "declarationKey", "kind", "name", "nodeOf", "address", "scope", "rank", "compareNodes", "distinctNodes", "nodes", "node", "compareEvidence", "dependencyKinds", "variants", "blocks", "block", "DependencyGraph", "_DependencyGraph", "application", "ranks", "authoredOrderOf", "expandSpecificationExamples", "ordered", "items", "parent", "syntax", "index", "authoredOrderKey", "item", "feature", "slice", "child", "module", "declarations", "builders", "declare", "inventory", "key", "owners", "qualified", "scopedOwners", "event", "eventDeclarations", "command", "reaction", "query", "screen", "readModel", "projection", "found", "variant", "reducer", "dependencySourcesOf", "foundations", "trigger", "sharedTypes", "type", "sharedPolicies", "policy", "imports", "imported", "contexts", "evidence", "unresolved", "usedImports", "excluded", "collected", "sliceReferences", "reference", "candidates", "producer", "matches", "contract", "contextName", "context", "edgeGroups", "group", "from", "to", "kinds", "includeTestOnly", "evidenceLimit", "InvalidDependencyQuery", "groups", "source", "target", "byKind", "count", "level", "edges", "selectedOrderingKinds", "edge", "groupsOf", "adjacency", "container", "children", "suggestions", "local", "byKey", "stronglyConnectedGroups", "membership", "dependencies", "remaining", "ready", "orders", "slices", "walk", "direction", "links", "visited", "queue", "link", "existing", "ancestors", "selected", "selectedKinds", "consumer", "common", "graph", "countedKinds", "contains", "__name", "container", "address", "ordinal", "left", "right", "orderedEvidence", "DeclaredDependencies", "application", "owners", "inventory", "scope", "syntax", "child", "module", "owner", "graph", "DependencyGraph", "nodes", "node", "targets", "DeclaredDependencyTargets", "resolve", "target", "resolved", "containers", "diagnostics", "finding", "code", "severity", "message", "location", "declarations", "valid", "edges", "buckets", "evidence", "edge", "item", "candidates", "producer", "covering", "declaration", "candidate", "status", "prefix", "mismatch", "segment", "index", "suggestedTargets", "_", "details", "DiagnosticCodes", "dependency", "context", "diagnostic", "PublicEventUsageCollector", "ScreenplaySyntaxWalker", "__name", "syntax", "isEventsSource", "consumedEvents", "setting", "dependencySourcesOf", "reducer", "name", "event", "_syntax", "node", "output", "PublicEventMetadataValidator", "ScreenplaySyntaxWalker", "__name", "context", "node", "error", "publicEventMetadataError", "code", "DiagnosticCodes", "validatePublicEventMetadata", "application", "validatePublicEventUsage", "application", "context", "validatePublicEventMetadata", "resolver", "AuthoringProductionResolver", "declaration", "EventVisibility", "imported", "slice", "usesEventSource", "targetsEvent", "events", "AuthoringProductionKind", "scope", "validateSlice", "seed", "group", "contract", "resolve", "code", "DiagnosticCodes", "__name", "collector", "PublicEventUsageCollector", "contracts", "explicitOutbound", "TranslationDirection", "readModels", "readModel", "target", "node", "validateUse", "source", "use", "all", "declarations", "eventDeclarations", "event", "outputs", "capture", "name", "output", "command", "foreign", "publicEvent", "error", "message", "resolution", "imports", "local", "diagnostic", "isEventsSource", "projection", "dependencySourcesOf", "reducer", "sourceContext", "lines", "path", "languages", "hashComments", "prepared", "diagnostics", "options", "legacySourceOptions", "seen", "contentSeen", "inFence", "nested", "registry", "ParserContext", "LineReader", "original", "line", "raw", "indent", "comment", "commentStart", "isClosingCodeFence", "firstWord", "code", "DiagnosticCodes", "locationOf", "exactSourceOptions", "context", "diagnostic", "__name", "validateInlineEvents", "application", "context", "slices", "inFeature", "__name", "feature", "module", "eventCounts", "event", "eventDeclarations", "importedNames", "value", "resolver", "AuthoringProductionResolver", "slice", "command", "events", "production", "identifier", "property", "mixed", "requiresExplicitDestinations", "inline", "DiagnosticCodes", "destination", "mapping", "message", "validateOperations", "application", "context", "resolver", "AuthoringProductionResolver", "effectiveCommand", "specificationCommandExamples", "concepts", "uniqueByName", "composites", "name", "type", "known", "imported", "entry", "imports", "scoped", "__name", "entries", "byName", "cache", "named", "reference", "from", "key", "candidates", "segments", "qualifiers", "value", "index", "depth", "visible", "matches", "result", "view", "slice", "scope", "node", "resolveCommand", "command", "systems", "system", "DiagnosticCodes", "pathType", "properties", "path", "inheritOptionality", "nested", "property", "next", "resolved", "covered", "mappings", "supplied", "seen", "completeValue", "item", "member", "concrete", "validateMappings", "operation", "required", "names", "allNames", "mapping", "suppliedPaths", "target", "targetSegments", "reads", "commandReadSources", "read", "resolvedView", "source", "compatibleValue", "input", "operations", "operationDeclarations", "eventDeclarations", "event", "production", "resolution", "AuthoringProductionKind", "reaction", "trigger", "specification", "steps", "duplicates", "step", "kinds", "produced", "detailPattern", "pattern", "claimPattern", "stringBodyPattern", "queryPattern", "parseIdentity", "context", "header", "existing", "DiagnosticCodes", "locationOf", "details", "description", "line", "firstWord", "parseDescription", "match", "type", "parseTypeRef", "reportLegacyOptionalSuffix", "source", "parseSource", "parseEscape", "unescapeIdentifier", "rejectBody", "__name", "text", "claim", "unescapeString", "query", "parseMappingSource", "kind", "detail", "body", "isFile", "file", "parseFile", "isCode", "code", "parseCode", "parent", "child", "specialCategories", "directivePattern", "pattern", "reasonPattern", "stringBodyPattern", "complianceWireName", "marker", "name", "__name", "canonicalComplianceName", "parseComplianceMarkers", "context", "line", "text", "markers", "reportLegacy", "DiagnosticCodes", "locationOf", "parseComplianceDirective", "concept", "attributes", "match", "setting", "value", "canonical", "index", "attribute", "reason", "unescapeString", "headerPattern", "nativePattern", "parsePolicy", "context", "header", "diagnosticContext", "name", "DiagnosticCodes", "locationOf", "condition", "code", "file", "hasRequire", "description", "line", "firstWord", "parseDescription", "text", "continuation", "tokens", "tokenizePolicyCondition", "parsed", "parsePolicyCondition", "parseFile", "parseCode", "__name", "numeric", "stringBodyPattern", "location", "reportDiagnostics", "position", "quoted", "token", "unquote", "unescapeString", "group", "operand", "result", "or", "target", "parseModeledMappingSource", "and", "left", "right", "forPattern", "stringBodyPattern", "eventPattern", "nativePattern", "mappingPattern", "parseSeed", "context", "header", "groups", "DiagnosticCodes", "locationOf", "group", "match", "events", "event", "properties", "property", "mapped", "parseModeledMappingSource", "unescapeString", "__name", "component", "stringBodyPattern", "exposureHeader", "pattern", "instanceHeader", "exposedProperty", "setPattern", "itemsPattern", "itemPattern", "itemValuePattern", "operations", "exposedPropertyShape", "reference", "__name", "match", "group", "unescapeString", "list", "text", "entry", "parseExposure", "context", "header", "DiagnosticCodes", "locationOf", "properties", "line", "property", "parseExposedProperty", "parseInstance", "contributions", "contribution", "parseContribution", "granted", "unknown", "operation", "set", "parseMappingSource", "items", "parsed", "child", "item", "parseItem", "values", "value", "domainPattern", "pattern", "importPattern", "stringBodyPattern", "conceptPattern", "enumValuePattern", "personaPattern", "personaPolicyPattern", "tabIndentPattern", "primitiveTypes", "opaqueTopLevel", "bodyKeywords", "parseApplication", "context", "lines", "placement", "documentPlacement", "warnOnTabIndentation", "moduleBody", "ModuleBody", "featureBody", "FeatureBody", "placedBody", "identity", "domain", "imports", "fileImports", "concepts", "types", "systems", "eventSources", "modules", "personas", "policies", "purposes", "seeds", "examples", "declaredTriggers", "exposures", "instanceContributions", "sawOtherConstruct", "line", "keyword", "firstWord", "parseDomain", "declaresConstruct", "isFileImport", "parseFileImport", "match", "DiagnosticCodes", "locationOf", "origin", "unescapeString", "isBlankPublicEventOrigin", "EventVisibility", "parseExample", "parseEventSource", "parseSystem", "parseConcept", "parseType", "isDocumentPlacement", "parseModuleInPlacedFile", "parseModule", "parsePersona", "parseSeed", "parsePurpose", "parseIdentity", "parsePolicy", "parseExposure", "parseInstance", "data", "parseTriggerDeclaration", "name", "collectInputUses", "reportUnexpectedTopLevel", "place", "root", "recordAuthoredDocument", "__name", "modulePattern", "describePlacement", "word", "hint", "expected", "moduleBodyExpected", "featureBodyExpected", "innermost", "start", "feature", "index", "existing", "inFence", "startOf", "type", "attributeText", "attributes", "parseComplianceMarkers", "values", "description", "validations", "child", "parseDescription", "isFileDirective", "parsed", "parseValidate", "parseComplianceDirective", "unescapeIdentifier", "policy", "CommandStreamCandidates", "_CommandStreamCandidates", "__name", "sources", "qualifiedTypes", "name", "source", "stream", "parents", "documents", "placement", "documentPlacement", "languages", "lines", "types", "imports", "context", "sourceContext", "application", "parseApplication", "type", "concept", "imported", "qualified", "StreamIdFormatFailure", "tryFormatText", "value", "__name", "tryFormatUuidText", "hex", "tryFormatInteger", "doubleBound", "integer", "streamIdFailureMessage", "failure", "validateStreamIdParts", "stream", "mappings", "scalar", "location", "code", "context", "validate", "parts", "part", "mapping", "names", "__name", "formatSpecificationStreamId", "expression", "type", "application", "concepts", "uniqueByName", "composites", "properties", "name", "compatibleValue", "primitive", "formatStreamIdLiteral", "__name", "matchesSpecificationRoute", "given", "expected", "noStream", "catalog", "EventSourceCatalog", "actual", "target", "EventSourceResolutionKind", "stream", "compare", "left", "right", "first", "second", "comparisons", "part", "mapping", "validateSpecificationStreams", "application", "context", "rows", "AuthoringProductionResolver", "slice", "specification", "validateRoutes", "sink", "ParserContext", "LineReader", "reported", "distinct", "diagnostic", "key", "row", "DiagnosticCodes", "value", "__name", "examples", "specificationExamples", "expansion", "expandEffectiveSpecificationExamples", "resolver", "declarationSteps", "exampleSpecifications", "entry", "node", "catalog", "EventSourceCatalog", "concepts", "uniqueByName", "composites", "properties", "name", "type", "compatible", "compatibleValue", "known", "nominallyCompatible", "source", "target", "formatStreamId", "expression", "formatSpecificationStreamId", "eventOf", "reference", "declared", "producers", "command", "produced", "event", "commandDestinationType", "reaction", "trigger", "capture", "appended", "child", "nested", "validationSpecifications", "owner", "scope", "commands", "parts", "qualifiers", "candidates", "segment", "index", "depth", "visible", "occurrences", "required", "expected", "step", "pair", "validateRoute", "validateFor", "contextualError", "code", "message", "location", "identifier", "eventProducers", "producer", "route", "resolution", "EventSourceResolutionKind", "state", "stream", "validateLiteral", "mapping", "formatted", "formatStreamIdLiteral", "streamIdFailureMessage", "validateStreamIdParts", "types", "inheritedIdentityIsInvalid", "prior", "priorIdentifier", "commandRoute", "contradicts", "part", "actual", "actualId", "expectedId", "primitives", "supportsStreamIdentity", "type", "application", "concepts", "concept", "primitive", "__name", "formatStreamIdLiteral", "expression", "value", "uniqueByName", "tryFormatUuidText", "tryFormatText", "tryFormatInteger", "validateEventSources", "context", "composites", "known", "compositeProperties", "name", "compatible", "source", "target", "validateType", "streamId", "composite", "DiagnosticCodes", "named", "imported", "names", "streams", "stream", "parts", "part", "duplicate", "pathProperty", "properties", "path", "remaining", "matches", "property", "resolved", "catalog", "EventSourceCatalog", "resolver", "AuthoringProductionResolver", "slice", "command", "route", "resolution", "EventSourceResolutionKind", "state", "identifiers", "produced", "destination", "commandDestinationType", "allocated", "validateMapping", "mapping", "formatted", "streamIdFailureMessage", "compatibleValue", "validateStreamIdParts", "validateSpecificationStreams", "validateProjectionTargets", "application", "context", "resolver", "AuthoringProductionResolver", "slices", "imported", "entry", "events", "slice", "eventDeclarations", "event", "types", "uniqueByName", "scalar", "concept", "name", "property", "__name", "properties", "path", "rest", "matches", "value", "views", "scope", "node", "viewProperties", "reference", "candidates", "segments", "named", "qualifiers", "index", "depth", "visible", "imports", "unknownEvent", "location", "resolution", "AuthoringProductionKind", "candidate", "DiagnosticCodes", "removals", "blocks", "block", "reported", "walk", "element", "effectiveHandlers", "validate", "resolved", "key", "ownsEvents", "mappings", "mapping", "target", "projection", "capture", "append", "child", "variants", "variant", "validateIdentifierCompliance", "application", "context", "personal", "concept", "attribute", "sensitive", "types", "uniqueByName", "resolver", "AuthoringProductionResolver", "imports", "imported", "declaredTriggers", "declared", "shapes", "validate", "__name", "type", "location", "position", "DiagnosticCodes", "property", "properties", "path", "name", "rest", "matches", "entry", "value", "source", "stream", "part", "catalog", "EventSourceCatalog", "slice", "command", "route", "resolution", "EventSourceResolutionKind", "mappings", "mapping", "target", "production", "trigger", "reaction", "event", "clauseData", "dependencySourcesOf", "datum", "validateEventSubjects", "application", "context", "refuse", "__name", "properties", "owner", "property", "DiagnosticCodes", "type", "slice", "AuthoringProductionResolver", "command", "model", "event", "eventDeclarations", "subjects", "extra", "composite", "concepts", "concept", "attribute", "primitive", "imported", "supportsStreamIdentity", "RefusalValueWalker", "ScreenplaySyntaxWalker", "__name", "declarations", "context", "syntax", "tag", "mapping", "parent", "DiagnosticCodes", "concept", "invocationHasNoDeclaredIdentity", "__name", "authorizationGatedSlices", "application", "slices", "collect", "feature", "inherited", "gated", "slice", "child", "module", "validateReactionRefusals", "context", "declarations", "RefusalDeclarations", "expandSpecificationExamples", "RefusalValueWalker", "gatedSlices", "constraintOf", "name", "owner", "sameConstraint", "left", "right", "covers", "previous", "branch", "invocation", "reaction", "trigger", "invoked", "authorizationGated", "earlier", "DiagnosticCodes", "constraint", "rules", "rule", "targets", "productions", "produced", "target", "redeliveryValue", "expression", "type", "declarations", "concept", "enumeration", "member", "__name", "text", "items", "item", "canonical", "properties", "members", "property", "left", "right", "value", "canonicalExactText", "sameRedeliveryValue", "first", "second", "validateSpecificationRedelivery", "application", "context", "expandSpecificationExamples", "declarations", "RefusalDeclarations", "slice", "specification", "action", "event", "reaction", "owner", "trigger", "DiagnosticCodes", "candidates", "given", "matches", "count", "match", "__name", "comparisons", "sameRedeliveryValue", "locator", "values", "value", "matchesSpecificationRoute", "maximumDisjuncts", "validateGuardedActionShadowing", "action", "context", "earlier", "alternative", "terms", "normalize", "term", "previous", "comparison", "DiagnosticCodes", "__name", "condition", "value", "left", "right", "first", "second", "primitives", "validateGuardedActions", "application", "context", "declarations", "RefusalDeclarations", "slice", "screen", "validateContainer", "__name", "directives", "inherited", "local", "directive", "subjects", "validateAction", "slot", "viewProperties", "name", "candidate", "action", "properties", "DiagnosticCodes", "alternative", "comparison", "comparisons", "validateItemPath", "validateArguments", "validateGuardedActionShadowing", "commandName", "arguments_", "command", "argument", "inputs", "property", "subjectProperty", "path", "location", "allowTerminalCollection", "segments", "index", "segment", "matches", "type", "concept", "composite", "condition", "validatePersonaCallers", "application", "context", "personas", "persona", "visit", "__name", "features", "feature", "slice", "specification", "reference", "count", "name", "DiagnosticCodes", "module", "validatePurposes", "application", "context", "known", "purpose", "DiagnosticCodes", "references", "collect", "__name", "feature", "slice", "module", "reference", "ordinalIgnoreCaseKey", "value", "character", "code", "upper", "__name", "timelineOrderDiagnostics", "application", "order", "authoredOrderOf", "ordered", "__name", "items", "outer", "syntax", "authoredOrderKey", "left", "right", "item", "slices", "feature", "scope", "slice", "name", "child", "module", "produced", "eventDeclarations", "event", "ordinalIgnoreCaseKey", "command", "value", "reaction", "trigger", "producers", "byScope", "key", "readers", "decision", "DependencyGraph", "edge", "reference", "edges", "consumer", "seen", "references", "sliceReferences", "producer", "common", "side", "facts", "index", "buildingReadModelReferences", "compare", "suppressed", "findings", "container", "local", "graph", "group", "stronglyConnectedGroups", "members", "internal", "first", "memberIndex", "member", "DiagnosticCodes", "parent", "consequence", "use", "finding", "parseForAuthoring", "source", "path", "placement", "documentPlacement", "validateResponseContracts", "streamCandidates", "languages", "lines", "splitLines", "context", "sourceContext", "CommandStreamCandidates", "value", "parseApplication", "validateIdentity", "validatePurposes", "validateInlineEvents", "validateConstraintProperties", "validateOperations", "validatePublicEventUsage", "validateSpecificationCases", "effective", "expandSpecificationExamples", "validateResponses", "validateEventSources", "validateProjectionTargets", "validateIdentifierCompliance", "validateEventSubjects", "validateReactionRefusals", "validateSpecificationRedelivery", "validateGuardedActions", "validatePersonaCallers", "validateDependencyDeclarations", "DeclaredDependencies", "diagnostic", "productionDestinationDiagnostics", "timelineOrderDiagnostics", "__name", "isQuickFixDiagnostic", "code", "DiagnosticCodes", "__name", "legacyOptionalTypeLength", "line", "diagnostic", "prepareQuickFixes", "source", "options", "original", "parseForAuthoring", "publicEventCodes", "_", "index", "acceptable", "__name", "parsed", "diagnostic", "errorCodes", "lines", "splitLines", "eventsByLine", "slicesByLine", "ScreenplaySyntaxWalker", "event", "slice", "counts", "byLine", "events", "line", "length", "legacyOptionalTypeLength", "DiagnosticCodes", "edit", "complianceMarkerEdit", "indent", "ending", "candidates", "TranslationDirection", "direction", "candidate", "edited", "applyQuickFixEdits", "originalCodes", "code", "text", "commentStart", "declaration", "spellingCodes", "syntax", "verificationShape", "verified", "rangeVerdicts", "documentChecked", "documentFixes", "verify", "fix", "change", "diagnosticCode", "requests", "selectedCodes", "request", "documents", "edits", "candidateSource", "changes", "remaining", "removed", "count", "selected", "occurrenceLine", "occurrenceFix", "raw", "startOffset", "header", "pattern", "suffix", "marker", "directive", "replacements", "key", "value", "parts", "end", "EventSourceReadConfidence", "__name", "sources", "complete", "entry", "diagnostics", "diagnostic", "source", "stream", "parents", "streams", "parent", "child", "ambiguous", "incomplete", "state", "reasons", "ruleNamePattern", "sourceStreamPattern", "hasKind", "__name", "value", "kind", "refuse", "message", "InvalidSyntaxJson", "collection", "position", "validateSyntaxInvariants", "node", "metadataError", "publicEventMetadataError", "concept", "validation", "rule", "production", "operation", "phase", "handler", "implementation", "hint", "isBlankImplementationHint", "validateSourceStream", "name", "isSourceStreamName", "mappings", "scalar", "parts", "part", "sources", "declaration", "type", "isSourceStreamTypeName", "command", "candidates", "rejected", "index", "occurrence", "route", "candidate", "syntaxCollections", "rules", "syntaxCollections", "patterns", "type", "expression", "index", "contracts", "kind", "names", "members", "name", "object", "__name", "value", "validateSyntaxMembers", "node", "matchesMembers", "InvalidSyntaxJson", "validateClosedSyntaxMembers", "sourceOnlyMembers", "known", "syntaxMemberNames", "member", "rule", "required", "matches", "allIndicesMatch", "items", "position", "args", "count", "key", "additions", "entry", "kind", "members", "mappingKind", "isExactOnlyMember", "member", "__name", "isLegacyOmittedMember", "node", "isNode", "__name", "value", "omitted", "sourceRoots", "toSyntaxJson", "node", "detached", "snapshot", "validateNumbers", "write", "snapshot", "value", "copies", "pending", "detach", "items", "dataArray", "length", "index", "copy", "names", "name", "member", "__name", "detached", "write", "owningMode", "complete", "isNode", "sourceRoots", "validatedSourceOptions", "legacySourceOptions", "validateSyntaxInvariants", "validateClosedSyntaxMembers", "omitted", "rule", "result", "structural", "known", "syntaxMemberNames", "members", "isLegacyOmittedMember", "ordinal", "memberValue", "record", "validateNumbers", "depth", "InvalidSyntaxJson", "node", "options", "validateSyntaxMembers", "isExactNumberToken", "literal", "parseExactNumber", "left", "right", "mergeDocuments", "documents", "diagnostics", "applications", "document", "options", "invalid", "application", "validatedSourceOptions", "legacySourceOptions", "failure", "InvalidSyntaxJson", "error", "DiagnosticCodes", "asserted", "hasDeclarations", "sourceOptions", "invalidSourceOptions", "named", "concepts", "declaredInOneFile", "types", "identities", "extra", "describe", "domains", "domain", "modules", "mergeModules", "personas", "value", "firstOfEach", "item", "presentOnly", "identityContext", "ParserContext", "LineReader", "validateIdentity", "all", "diagnostic", "__name", "isAuthoredDocument", "feature", "node", "module", "groupByName", "placedLast", "parts", "unplaced", "part", "reference", "firstDescription", "firstDocumentation", "combineAuthorization", "groupDependencies", "mergeFeatures", "features", "left", "right", "declarations", "owner", "kept", "authorization", "declaration", "first", "earlier", "toSyntaxJson", "warning", "combined", "next", "combineAuthorize", "items", "key", "seen", "groups", "documented", "disagreeing", "described", "keyword", "within", "claimed", "path", "code", "message", "location", "values", "parsePlacedDocuments", "documents", "languages", "parsePlacedDocumentsWithSyntax", "__name", "candidates", "CommandStreamCandidates", "document", "splitLines", "physical", "parseForAuthoring", "physicalEventSources", "result", "index", "source", "sourceInventoryComplete", "EventSourceReadConfidence", "parsed", "merged", "mergeDocuments", "context", "ParserContext", "LineReader", "validateSpecificationCases", "effective", "expandSpecificationExamples", "validateEventSources", "validateOperations", "validatePublicEventUsage", "validateInlineEvents", "validateConstraintProperties", "validateResponses", "validateProjectionTargets", "validateIdentifierCompliance", "validateEventSubjects", "validateReactionRefusals", "validateSpecificationRedelivery", "validateGuardedActions", "validatePersonaCallers", "validatePurposes", "value", "validateDependencyDeclarations", "DeclaredDependencies", "diagnostic", "productionDestinationDiagnostics", "existing", "reported", "diagnosticKey", "all", "word", "escape", "__name", "value", "ranges", "result", "start", "bmpWordCharacters", "exampleTypePrefix", "bmpWordCharacters", "fixtureStepPrefix", "exampleAnalysis", "syntax", "path", "lines", "range", "hiddenScopes", "diagnostics", "application", "declarations", "rejected", "diagnostic", "contexts", "specifications", "own", "__name", "node", "scope", "line", "examples", "nodes", "example", "features", "parent", "feature", "slice", "events", "event", "eventDeclarations", "generations", "latest", "module", "candidates", "reference", "parts", "named", "qualifiers", "part", "index", "depth", "visible", "unique", "matches", "kind", "display", "targets", "expected", "typesOnly", "prefix", "fixtureKind", "full", "name", "effective", "values", "generated", "destination", "authoredRoute", "merge", "base", "overrides", "value", "result", "replaced", "origin", "expressionText", "properties", "fixtures", "selected", "priorRoute", "replacementRoute", "route", "routeText", "routing", "hovers", "declaration", "withoutComment", "steps", "step", "entry", "resolved", "competing", "start", "content", "before", "header", "entries", "specificationStepItems", "end", "hover", "expression", "member", "callerPrefix", "bmpWordCharacters", "personaLine", "personaAnalysis", "syntax", "lines", "application", "results", "persona", "synthesizePersonaCaller", "_line", "before", "withoutComment", "line", "start", "end", "text", "match", "result", "role", "claim", "atom", "__name", "dependencyTargetAnalysis", "syntax", "localSyntax", "path", "range", "hiddenScopes", "application", "local", "containers", "DeclaredDependencyTargets", "container", "part", "contexts", "declared", "inventory", "__name", "nodes", "parent", "sourceLocal", "node", "address", "line", "key", "dependency", "qualifier", "placement", "from", "existing", "reference", "tier", "relation", "order", "responseAvailability", "revisions", "authoringSource", "lines", "headers", "fences", "fenceMap", "roots", "line", "index", "indentOf", "root", "_", "globals", "body", "global", "depth", "wrappers", "source", "locations", "__name", "analyze", "otherSources", "placement", "path", "isPlacementResolved", "others", "document", "documents", "names", "match", "fresh", "prefix", "name", "suffix", "module", "feature", "syntheticScopes", "preparedDocuments", "sourceLines", "fragment", "prepared", "parsed", "parsePlacedDocuments", "commands", "specifications", "visited", "walk", "value", "node", "original", "child", "diagnostic", "unknownFragmentExtent", "location", "diagnostics", "productions", "AuthoringProductionResolver", "operationProductionLines", "slice", "command", "reaction", "trigger", "production", "declarations", "declaration", "AuthoringProductionKind", "segment", "contexts", "range", "start", "result", "indent", "withoutComment", "scope", "specification", "declarationScopes", "operation", "declarationsByLocation", "referenceLocation", "references", "resolved", "reference", "context", "step", "operations", "entry", "part", "sourceDeclarations", "sourceCatalog", "EventSourceReadConfidence", "resolutions", "resolve", "stream", "key", "importedTypeReferences", "imported", "targets", "sourceContexts", "routes", "member", "examples", "exampleAnalysis", "routeOwners", "event", "ambiguousCandidates", "candidate", "eventSources", "dependencyAnalysis", "dependencies", "qualifier", "localDependencies", "parseForAuthoring", "remapDependencyHeaders", "dependencyTargetAnalysis", "detail", "personaAnalysis", "responseAnalysis", "analysis", "fileReferenceKeyword", "typeReferencePattern", "absolutePathPattern", "isAbsoluteFileReferencePath", "path", "__name", "withoutComment", "text", "inString", "inTemplate", "index", "current", "fileReferenceOn", "line", "lineIndex", "indent", "indentOf", "content", "firstWord", "afterKeyword", "separatorLength", "startColumn", "fileReferences", "lines", "fences", "fenceMap", "references", "reference", "eventAnalysisSource", "lines", "fenced", "line", "text", "withoutComment", "__name", "conceptPattern", "propertyPattern", "attributeReasonPattern", "readPattern", "commandReserved", "authorizationContinuation", "eventReserved", "eventBodyReservedWords", "inlineEventReserved", "queryParameterPattern", "propertyTypeReference", "property", "typeReferenceSymbol", "__name", "sourceTypeAt", "line", "startColumn", "text", "propertiesIn", "lines", "body", "reserved", "index", "entry", "match", "collectBody", "fences", "start", "indent", "indentOf", "directBody", "blockIndent", "authorization", "childIndent", "symbolRevisions", "scanDocument", "source", "cached", "analysis", "responseAnalysis", "symbols", "eventAnalysisSource", "fenceMap", "eventLines", "eventFences", "eventPropertyLines", "trimmed", "importMatch", "qualifiedName", "shortName", "conceptMatch", "i", "attributeReasons", "reason", "enumValues", "typeMatch", "clauseKeywords", "policyMatch", "requires", "eventMatch", "inline", "propertyBody", "fileReferenceOn", "EventVisibility", "unescapeString", "command", "productionHeaders", "header", "conditional", "eventLine", "name", "children", "targets", "target", "mappings", "queryMatch", "parameters", "screenMatch", "triggerMatch", "mergeSymbols", "documents", "document", "symbolsForBuffer", "application", "path", "current", "knownEventNames", "event", "imported", "builtInTriggerNames", "knownTriggerNames", "trigger", "knownTypeNames", "primitives", "concept", "type", "productionDestinations", "command", "identifiers", "property", "propertyTypeReference", "identifier", "productions", "mixed", "production", "__name", "destinationHints", "lines", "application", "analysis", "responseAnalysis", "source", "eventAnalysisSource", "scanDocument", "reference", "line", "hasPromotedDestination", "sibling", "diagnosticCodes", "fileImportPattern", "quotedImportPattern", "isFileImportLine", "line", "__name", "fileImportOn", "lineIndex", "indent", "indentOf", "match", "startColumn", "fileImports", "lines", "fences", "fenceMap", "found", "index", "fileImport", "folderOf", "path", "relativeTo", "from", "segments", "common", "importablePaths", "documentPath", "files", "paths", "file", "candidate", "relative", "folders", "depth", "reserved", "quotedId", "validateInlineEvents", "lines", "symbols", "application", "operationProductionLines", "eventAnalysisSource", "issues", "fences", "fenceMap", "documentationBlocks", "nonemptyMarkdownBlocks", "commandProductions", "command", "eventCounts", "importedNames", "document", "event", "imported", "report", "__name", "line", "code", "message", "severity", "indentOf", "body", "directBody", "properties", "property", "diagnosticCodes", "hasId", "hasDocumentation", "index", "text", "keyword", "match", "next", "productionIndents", "indent", "identifier", "mixed", "productionDestinations", "production", "destination", "mapping", "blocks", "opening", "content", "issue", "severity", "line", "startColumn", "length", "message", "code", "__name", "tokenIssue", "text", "token", "column", "validateDeclarations", "lines", "symbols", "application", "issues", "types", "knownTypeNames", "primitiveTypes", "checkProperties", "properties", "owner", "property", "candidate", "propertyTypeReference", "bare", "diagnosticCodes", "type", "event", "query", "command", "identifiers", "extra", "declared", "declaration", "validateLines", "context", "fences", "fenceMap", "scanned", "scanDocument", "mergeSymbols", "input", "symbolsForBuffer", "analysis", "responseAnalysis", "source", "routeLines", "route", "production", "events", "knownEventNames", "policies", "policy", "validateProductionDestinations", "optionalCodes", "DiagnosticCodes", "policyCodes", "consistencyCodes", "timelineCodes", "dependencyCodes", "authoringCodes", "complianceCodes", "compilerUnknownEventLines", "diagnostic", "identityType", "detail", "identityDuplicate", "existing", "legacyOptionalTypeLength", "checkEvent", "name", "authorizeIndent", "index", "trimmed", "leading", "indentOf", "fileImportIssue", "validateImport", "slice", "sliceTypes", "concept", "authorize", "reactsOn", "produces", "next", "uniqueEvent", "uniqueProperty", "path", "member", "knownIdentity", "identityProperties", "segments", "contextRoots", "causedByProperties", "validateEventContextPaths", "validateInlineEvents", "fenceLines", "last", "eventAnalysisSource", "fileImportOn", "indent", "enclosingChain", "isFileImportLine", "mappingTarget", "names", "members", "match", "written", "resolveEventContextPath", "resolution", "has", "target"]
|
|
7
|
+
}
|