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C,EAAE,CAAC,CAAC;SACzG;IACH,CAAC;CACF;AAjED,oCAiEC","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 IApiItemJson, type IApiItemOptions, type ApiItem, ApiItemKind } from '../items/ApiItem';\nimport { ApiClass, type IApiClassOptions, type IApiClassJson } from './ApiClass';\nimport { ApiEntryPoint, type IApiEntryPointOptions } from './ApiEntryPoint';\nimport { ApiMethod, type IApiMethodOptions } from './ApiMethod';\nimport { ApiModel } from './ApiModel';\nimport { ApiNamespace, type IApiNamespaceOptions } from './ApiNamespace';\nimport { ApiPackage, type IApiPackageOptions, type IApiPackageJson } from './ApiPackage';\nimport { ApiInterface, type IApiInterfaceOptions, type IApiInterfaceJson } from './ApiInterface';\nimport { ApiPropertySignature, type IApiPropertySignatureOptions } from './ApiPropertySignature';\nimport { ApiMethodSignature, type IApiMethodSignatureOptions } from './ApiMethodSignature';\nimport { ApiProperty, type IApiPropertyOptions } from './ApiProperty';\nimport { ApiEnumMember, type IApiEnumMemberOptions } from './ApiEnumMember';\nimport { ApiEnum, type IApiEnumOptions } from './ApiEnum';\nimport type { IApiPropertyItemJson } from '../items/ApiPropertyItem';\nimport { ApiConstructor, type IApiConstructorOptions } from './ApiConstructor';\nimport { ApiConstructSignature, type IApiConstructSignatureOptions } from './ApiConstructSignature';\nimport { ApiFunction, type IApiFunctionOptions } from './ApiFunction';\nimport { ApiCallSignature, type IApiCallSignatureOptions } from './ApiCallSignature';\nimport { ApiIndexSignature, type IApiIndexSignatureOptions } from './ApiIndexSignature';\nimport { ApiTypeAlias, type IApiTypeAliasOptions, type IApiTypeAliasJson } from './ApiTypeAlias';\nimport { ApiVariable, type IApiVariableOptions, type IApiVariableJson } from './ApiVariable';\nimport type { IApiDeclaredItemJson } from '../items/ApiDeclaredItem';\nimport type { DeserializerContext } from './DeserializerContext';\n\nexport class Deserializer {\n public static deserialize(context: DeserializerContext, jsonObject: IApiItemJson): ApiItem {\n const options: Partial<IApiItemOptions> = {};\n\n switch (jsonObject.kind) {\n case ApiItemKind.Class:\n ApiClass.onDeserializeInto(options, context, jsonObject as IApiClassJson);\n return new ApiClass(options as IApiClassOptions);\n case ApiItemKind.CallSignature:\n ApiCallSignature.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\n return new ApiCallSignature(options as IApiCallSignatureOptions);\n case ApiItemKind.Constructor:\n ApiConstructor.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\n return new ApiConstructor(options as IApiConstructorOptions);\n case ApiItemKind.ConstructSignature:\n ApiConstructSignature.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\n return new ApiConstructSignature(options as IApiConstructSignatureOptions);\n case ApiItemKind.EntryPoint:\n ApiEntryPoint.onDeserializeInto(options, context, jsonObject);\n return new ApiEntryPoint(options as IApiEntryPointOptions);\n case ApiItemKind.Enum:\n ApiEnum.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\n return new ApiEnum(options as IApiEnumOptions);\n case ApiItemKind.EnumMember:\n ApiEnumMember.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\n return new ApiEnumMember(options as IApiEnumMemberOptions);\n case ApiItemKind.Function:\n ApiFunction.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\n return new ApiFunction(options as IApiFunctionOptions);\n case ApiItemKind.IndexSignature:\n ApiIndexSignature.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\n return new ApiIndexSignature(options as IApiIndexSignatureOptions);\n case ApiItemKind.Interface:\n ApiInterface.onDeserializeInto(options, context, jsonObject as IApiInterfaceJson);\n return new ApiInterface(options as IApiInterfaceOptions);\n case ApiItemKind.Method:\n ApiMethod.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\n return new ApiMethod(options as IApiMethodOptions);\n case ApiItemKind.MethodSignature:\n ApiMethodSignature.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\n return new ApiMethodSignature(options as IApiMethodSignatureOptions);\n case ApiItemKind.Model:\n return new ApiModel();\n case ApiItemKind.Namespace:\n ApiNamespace.onDeserializeInto(options, context, jsonObject as IApiDeclaredItemJson);\n return new ApiNamespace(options as IApiNamespaceOptions);\n case ApiItemKind.Package:\n ApiPackage.onDeserializeInto(options, context, jsonObject as IApiPackageJson);\n return new ApiPackage(options as IApiPackageOptions);\n case ApiItemKind.Property:\n ApiProperty.onDeserializeInto(options, context, jsonObject as IApiPropertyItemJson);\n return new ApiProperty(options as IApiPropertyOptions);\n case ApiItemKind.PropertySignature:\n ApiPropertySignature.onDeserializeInto(options, context, jsonObject as IApiPropertyItemJson);\n return new ApiPropertySignature(options as IApiPropertySignatureOptions);\n case ApiItemKind.TypeAlias:\n ApiTypeAlias.onDeserializeInto(options, context, jsonObject as IApiTypeAliasJson);\n return new ApiTypeAlias(options as IApiTypeAliasOptions);\n case ApiItemKind.Variable:\n ApiVariable.onDeserializeInto(options, context, jsonObject as IApiVariableJson);\n return new ApiVariable(options as IApiVariableOptions);\n default:\n throw new Error(`Failed to deserialize unsupported API item type ${JSON.stringify(jsonObject.kind)}`);\n }\n }\n}\n"]} |