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AU,CAAC,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,EACrD;YACA,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;SACxC;QAED,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAC/F,CAAC;IAED;;OAEG;IACH,IAAW,IAAI;QACb,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;YAC5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SAC7D;QACD,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,UAAU,CAAC,UAAU,KAAK,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC;IACjE,CAAC;CACF;AApDD,0BAoDC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport type { DeclarationReference } from '@microsoft/tsdoc/lib-commonjs/beta/DeclarationReference';\nimport { Text } from '@rushstack/node-core-library';\n\n/** @public */\nexport enum ExcerptTokenKind {\n /**\n * Generic text without any special properties\n */\n Content = 'Content',\n\n /**\n * A reference to an API declaration\n */\n Reference = 'Reference'\n}\n\n/**\n * Used by {@link Excerpt} to indicate a range of indexes within an array of `ExcerptToken` objects.\n *\n * @public\n */\nexport interface IExcerptTokenRange {\n /**\n * The starting index of the span.\n */\n startIndex: number;\n\n /**\n * The index of the last member of the span, plus one.\n *\n * @remarks\n *\n * If `startIndex` and `endIndex` are the same number, then the span is empty.\n */\n endIndex: number;\n}\n\n/** @public */\nexport interface IExcerptToken {\n readonly kind: ExcerptTokenKind;\n text: string;\n canonicalReference?: string;\n}\n\n/**\n * Represents a fragment of text belonging to an {@link Excerpt} object.\n *\n * @public\n */\nexport class ExcerptToken {\n private readonly _kind: ExcerptTokenKind;\n private readonly _text: string;\n private readonly _canonicalReference: DeclarationReference | undefined;\n\n public constructor(kind: ExcerptTokenKind, text: string, canonicalReference?: DeclarationReference) {\n this._kind = kind;\n\n // Standardize the newlines across operating systems. Even though this may deviate from the actual\n // input source file that was parsed, it's useful because the newline gets serialized inside\n // a string literal in .api.json, which cannot be automatically normalized by Git.\n this._text = Text.convertToLf(text);\n this._canonicalReference = canonicalReference;\n }\n\n /**\n * Indicates the kind of token.\n */\n public get kind(): ExcerptTokenKind {\n return this._kind;\n }\n\n /**\n * The text fragment.\n */\n public get text(): string {\n return this._text;\n }\n\n /**\n * The hyperlink target for a token whose type is `ExcerptTokenKind.Reference`. For other token types,\n * this property will be `undefined`.\n */\n public get canonicalReference(): DeclarationReference | undefined {\n return this
|