{"version":3,"sources":["../../src/knowledge-vault/index.ts","../../src/http/errors.ts","../../src/http/client.ts","../../src/regions/endpoints.ts","../../src/regions/resolver.ts","../../src/knowledge-vault/items.ts","../../src/knowledge-vault/client.ts"],"sourcesContent":["export { createKnowledgeVaultClient } from \"./client.js\"\nexport type { KnowledgeVaultClient, KnowledgeVaultClientConfig } from \"./client.js\"\nexport type {\n  IngestContentData,\n  KnowledgeVaultItem,\n  KnowledgeVaultUsage,\n  UpdateContentData,\n} from \"./types.js\"\n","/**\n * Base error class for all Contentstack SDK errors.\n * Every error includes an actionable message and relevant context.\n */\nexport class ContentstackError extends Error {\n  override readonly name: string = \"ContentstackError\"\n  readonly status?: number\n  readonly errorCode?: number\n  readonly errors?: Record<string, string[]>\n  readonly requestPath?: string\n\n  constructor(\n    message: string,\n    options?: {\n      status?: number\n      errorCode?: number\n      errors?: Record<string, string[]>\n      requestPath?: string\n      cause?: Error\n    },\n  ) {\n    super(message, options?.cause ? { cause: options.cause } : undefined)\n    this.status = options?.status\n    this.errorCode = options?.errorCode\n    this.errors = options?.errors\n    this.requestPath = options?.requestPath\n  }\n}\n\nexport class ContentstackAuthError extends ContentstackError {\n  override readonly name = \"ContentstackAuthError\"\n  override readonly status = 401\n}\n\nexport class ContentstackForbiddenError extends ContentstackError {\n  override readonly name = \"ContentstackForbiddenError\"\n  override readonly status = 403\n}\n\nexport class ContentstackNotFoundError extends ContentstackError {\n  override readonly name = \"ContentstackNotFoundError\"\n  override readonly status = 404\n}\n\nexport class ContentstackValidationError extends ContentstackError {\n  override readonly name = \"ContentstackValidationError\"\n  override readonly status: number\n\n  constructor(\n    message: string,\n    options?: {\n      status?: number\n      errorCode?: number\n      errors?: Record<string, string[]>\n      requestPath?: string\n      cause?: Error\n    },\n  ) {\n    super(message, options)\n    this.status = options?.status ?? 400\n  }\n}\n\nexport class ContentstackInvalidApiKeyError extends ContentstackError {\n  override readonly name = \"ContentstackInvalidApiKeyError\"\n  override readonly status = 412\n}\n\nexport class ContentstackRateLimitError extends ContentstackError {\n  override readonly name = \"ContentstackRateLimitError\"\n  override readonly status = 429\n  readonly retryAfter?: number\n\n  constructor(\n    message: string,\n    options?: {\n      errorCode?: number\n      errors?: Record<string, string[]>\n      requestPath?: string\n      cause?: Error\n      retryAfter?: number\n    },\n  ) {\n    super(message, { ...options, status: 429 })\n    this.retryAfter = options?.retryAfter\n  }\n}\n\nexport class ContentstackServerError extends ContentstackError {\n  override readonly name = \"ContentstackServerError\"\n}\n\nexport class ContentstackConfigError extends ContentstackError {\n  override readonly name = \"ContentstackConfigError\"\n}\n","import {\n  ContentstackAuthError,\n  ContentstackConfigError,\n  ContentstackError,\n  ContentstackForbiddenError,\n  ContentstackInvalidApiKeyError,\n  ContentstackNotFoundError,\n  ContentstackRateLimitError,\n  ContentstackServerError,\n  ContentstackValidationError,\n} from \"./errors.js\"\nimport type { HttpClientConfig, HttpResponse } from \"./types.js\"\n\nconst DEFAULT_TIMEOUT = 30_000\nconst DEFAULT_RETRY_LIMIT = 5\nconst DEFAULT_RETRY_DELAY = 300\nconst MAX_JITTER = 100\n\nexport class ContentstackHttpClient {\n  private readonly config: Required<\n    Pick<HttpClientConfig, \"baseUrl\" | \"timeout\" | \"retryOnError\" | \"retryLimit\" | \"retryDelay\">\n  > & {\n    headers: Record<string, string>\n    fetch: typeof globalThis.fetch\n    resolveHeaders?: HttpClientConfig[\"resolveHeaders\"]\n  }\n\n  constructor(config: HttpClientConfig) {\n    this.config = {\n      baseUrl: config.baseUrl,\n      headers: config.headers ?? {},\n      timeout: config.timeout ?? DEFAULT_TIMEOUT,\n      retryOnError: config.retryOnError ?? true,\n      retryLimit: config.retryLimit ?? DEFAULT_RETRY_LIMIT,\n      retryDelay: config.retryDelay ?? DEFAULT_RETRY_DELAY,\n      fetch: config.fetch ?? globalThis.fetch.bind(globalThis),\n      resolveHeaders: config.resolveHeaders,\n    }\n  }\n\n  async get<T>(path: string, params?: Record<string, string>): Promise<HttpResponse<T>> {\n    let url = `${this.config.baseUrl}${path}`\n    if (params) {\n      const searchParams = new URLSearchParams(params)\n      url += `?${searchParams.toString()}`\n    }\n    return this.request<T>(url, { method: \"GET\" }, path)\n  }\n\n  async post<T>(path: string, body?: unknown): Promise<HttpResponse<T>> {\n    const url = `${this.config.baseUrl}${path}`\n    return this.request<T>(\n      url,\n      {\n        method: \"POST\",\n        headers: { \"Content-Type\": \"application/json\" },\n        body: body !== undefined ? JSON.stringify(body) : undefined,\n      },\n      path,\n    )\n  }\n\n  async put<T>(path: string, body?: unknown): Promise<HttpResponse<T>> {\n    const url = `${this.config.baseUrl}${path}`\n    return this.request<T>(\n      url,\n      {\n        method: \"PUT\",\n        headers: { \"Content-Type\": \"application/json\" },\n        body: body !== undefined ? JSON.stringify(body) : undefined,\n      },\n      path,\n    )\n  }\n\n  async patch<T>(path: string, body?: unknown): Promise<HttpResponse<T>> {\n    const url = `${this.config.baseUrl}${path}`\n    return this.request<T>(\n      url,\n      {\n        method: \"PATCH\",\n        headers: { \"Content-Type\": \"application/json\" },\n        body: body !== undefined ? JSON.stringify(body) : undefined,\n      },\n      path,\n    )\n  }\n\n  async delete<T>(path: string): Promise<HttpResponse<T>> {\n    const url = `${this.config.baseUrl}${path}`\n    return this.request<T>(url, { method: \"DELETE\" }, path)\n  }\n\n  async postForm<T>(path: string, params: URLSearchParams): Promise<HttpResponse<T>> {\n    const url = `${this.config.baseUrl}${path}`\n    return this.request<T>(\n      url,\n      {\n        method: \"POST\",\n        headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n        body: params.toString(),\n      },\n      path,\n    )\n  }\n\n  async upload<T>(path: string, form: FormData): Promise<HttpResponse<T>> {\n    const url = `${this.config.baseUrl}${path}`\n    return this.request<T>(url, { method: \"POST\", body: form }, path)\n  }\n\n  /** Return a new client with additional headers merged */\n  withHeaders(headers: Record<string, string>): ContentstackHttpClient {\n    return new ContentstackHttpClient({\n      ...this.config,\n      headers: { ...this.config.headers, ...headers },\n    })\n  }\n\n  /** Return a new client with a different base URL */\n  withBaseUrl(baseUrl: string): ContentstackHttpClient {\n    return new ContentstackHttpClient({\n      ...this.config,\n      baseUrl,\n    })\n  }\n\n  private async request<T>(url: string, init: RequestInit, path: string): Promise<HttpResponse<T>> {\n    const headers = new Headers(this.config.headers)\n    const resolvedHeaders = await this.config.resolveHeaders?.()\n\n    if (resolvedHeaders) {\n      for (const [key, value] of Object.entries(resolvedHeaders)) {\n        headers.set(key, value)\n      }\n    }\n\n    if (init.headers) {\n      const initHeaders =\n        init.headers instanceof Headers\n          ? init.headers\n          : new Headers(init.headers as Record<string, string>)\n      initHeaders.forEach((value, key) => headers.set(key, value))\n    }\n\n    let lastError: Error | undefined\n    const maxAttempts = this.config.retryOnError ? this.config.retryLimit + 1 : 1\n\n    for (let attempt = 0; attempt < maxAttempts; attempt++) {\n      const controller = new AbortController()\n      const timeoutId = setTimeout(() => controller.abort(), this.config.timeout)\n\n      try {\n        const response = await this.config.fetch(url, {\n          ...init,\n          headers,\n          signal: controller.signal,\n        })\n\n        if (response.ok) {\n          const data = (await response.json().catch(() => ({}))) as T\n          return { data, status: response.status, headers: response.headers }\n        }\n\n        // Check if retryable\n        const isRetryable = response.status === 429 || response.status >= 500\n        if (isRetryable && this.config.retryOnError && attempt < maxAttempts - 1) {\n          const delay = this.calculateDelay(response, attempt)\n          await sleep(delay)\n          lastError = await this.createError(response, path)\n          continue\n        }\n\n        throw await this.createError(response, path)\n      } catch (error) {\n        if (error instanceof ContentstackError) {\n          throw error\n        }\n\n        if (error instanceof ContentstackConfigError) {\n          throw error\n        }\n\n        if (error instanceof DOMException && error.name === \"AbortError\") {\n          throw new ContentstackError(`Request timed out after ${this.config.timeout}ms`, {\n            requestPath: path,\n            cause: error,\n          })\n        }\n\n        throw new ContentstackError(\"Network request failed\", {\n          requestPath: path,\n          cause: error instanceof Error ? error : new Error(String(error)),\n        })\n      } finally {\n        clearTimeout(timeoutId)\n      }\n    }\n\n    // Should not reach here, but just in case\n    throw lastError ?? new ContentstackError(\"Request failed after retries\", { requestPath: path })\n  }\n\n  private calculateDelay(response: Response, attempt: number): number {\n    const retryAfter = response.headers.get(\"Retry-After\")\n    if (retryAfter) {\n      const seconds = Number.parseFloat(retryAfter)\n      if (!Number.isNaN(seconds)) {\n        return seconds * 1000\n      }\n    }\n\n    const jitter = Math.random() * MAX_JITTER\n    return this.config.retryDelay * 2 ** attempt + jitter\n  }\n\n  private async createError(response: Response, path: string): Promise<ContentstackError> {\n    let body: Record<string, unknown> = {}\n    try {\n      body = (await response.json()) as Record<string, unknown>\n    } catch {\n      // Response body may not be JSON\n    }\n\n    const message =\n      (body.error_message as string | undefined) ??\n      (body.error_description as string | undefined) ??\n      (body.message as string | undefined) ??\n      `HTTP ${response.status} error`\n    const errorCode = body.error_code as number | undefined\n    const errors = body.errors as Record<string, string[]> | undefined\n    const retryAfter = response.headers.get(\"Retry-After\")\n\n    const opts = { status: response.status, errorCode, errors, requestPath: path }\n\n    switch (response.status) {\n      case 400:\n        return new ContentstackValidationError(message, { ...opts, status: 400 })\n      case 401:\n        return new ContentstackAuthError(message, opts)\n      case 403:\n        return new ContentstackForbiddenError(message, opts)\n      case 404:\n        return new ContentstackNotFoundError(message, opts)\n      case 412:\n        return new ContentstackInvalidApiKeyError(message, opts)\n      case 422:\n        return new ContentstackValidationError(message, { ...opts, status: 422 })\n      case 429:\n        return new ContentstackRateLimitError(message, {\n          ...opts,\n          retryAfter: retryAfter ? Number.parseFloat(retryAfter) : undefined,\n        })\n      default:\n        if (response.status >= 500) {\n          return new ContentstackServerError(message, opts)\n        }\n        return new ContentstackError(message, opts)\n    }\n  }\n}\n\nfunction sleep(ms: number): Promise<void> {\n  return new Promise((resolve) => setTimeout(resolve, ms))\n}\n","import {\n  type ContentstackEndpoints as UpstreamEndpoints,\n  getContentstackEndpoints,\n  getRegionForString,\n} from \"@timbenniks/contentstack-endpoints\"\nimport type { ContentstackEndpoints, ContentstackRegion } from \"./resolver.js\"\n\n/** Brand Kit endpoints not available in upstream package — maintained locally */\nconst BRAND_KIT_URLS: Record<ContentstackRegion, { brandKit: string; brandKitAI: string }> = {\n  us: {\n    brandKit: \"https://brand-kits-api.contentstack.com\",\n    brandKitAI: \"https://ai.contentstack.com/brand-kits\",\n  },\n  eu: {\n    brandKit: \"https://eu-brand-kits-api.contentstack.com\",\n    brandKitAI: \"https://eu-ai.contentstack.com/brand-kits\",\n  },\n  au: {\n    brandKit: \"https://au-brand-kits-api.contentstack.com\",\n    brandKitAI: \"https://au-ai.contentstack.com/brand-kits\",\n  },\n  \"azure-na\": {\n    brandKit: \"https://azure-na-brand-kits-api.contentstack.com\",\n    brandKitAI: \"https://azure-na-ai.contentstack.com/brand-kits\",\n  },\n  \"azure-eu\": {\n    brandKit: \"https://azure-eu-brand-kits-api.contentstack.com\",\n    brandKitAI: \"https://azure-eu-ai.contentstack.com/brand-kits\",\n  },\n  \"gcp-na\": {\n    brandKit: \"https://gcp-na-brand-kits-api.contentstack.com\",\n    brandKitAI: \"https://gcp-na-ai.contentstack.com/brand-kits\",\n  },\n  \"gcp-eu\": {\n    brandKit: \"https://gcp-eu-brand-kits-api.contentstack.com\",\n    brandKitAI: \"https://gcp-eu-ai.contentstack.com/brand-kits\",\n  },\n}\n\nfunction mapEndpoints(\n  upstream: UpstreamEndpoints,\n  region: ContentstackRegion,\n  hostsOnly: boolean,\n): ContentstackEndpoints {\n  const bk = BRAND_KIT_URLS[region]\n  const stripProtocol = (url: string) => url.replace(/^https?:\\/\\//, \"\")\n\n  return Object.freeze({\n    cma: upstream.contentManagement ?? \"\",\n    cda: upstream.contentDelivery ?? \"\",\n    graphql: upstream.graphqlDelivery ?? \"\",\n    images: upstream.images ?? \"\",\n    app: upstream.application ?? \"\",\n    preview: upstream.preview ?? \"\",\n    graphqlPreview: upstream.graphqlPreview ?? \"\",\n    launch: upstream.launch ?? \"\",\n    personalizeEdge: upstream.personalizeEdge ?? \"\",\n    brandKit: hostsOnly ? stripProtocol(bk.brandKit) : bk.brandKit,\n    brandKitAI: hostsOnly ? stripProtocol(bk.brandKitAI) : bk.brandKitAI,\n    developerHub: hostsOnly\n      ? stripProtocol(upstream.developerHub ?? \"\")\n      : (upstream.developerHub ?? \"\"),\n  })\n}\n\nconst ALL_REGIONS: ContentstackRegion[] = [\n  \"us\",\n  \"eu\",\n  \"au\",\n  \"azure-na\",\n  \"azure-eu\",\n  \"gcp-na\",\n  \"gcp-eu\",\n]\n\nfunction buildEndpointMap(): Record<ContentstackRegion, ContentstackEndpoints> {\n  const map = {} as Record<ContentstackRegion, ContentstackEndpoints>\n  for (const region of ALL_REGIONS) {\n    map[region] = mapEndpoints(getContentstackEndpoints(region), region, false)\n  }\n  return Object.freeze(map)\n}\n\nfunction buildHostMap(): Record<ContentstackRegion, ContentstackEndpoints> {\n  const map = {} as Record<ContentstackRegion, ContentstackEndpoints>\n  for (const region of ALL_REGIONS) {\n    map[region] = mapEndpoints(getContentstackEndpoints(region, true), region, true)\n  }\n  return Object.freeze(map)\n}\n\nexport const ENDPOINT_MAP = buildEndpointMap()\nexport const HOST_MAP = buildHostMap()\n\n/** Check if a string is a valid region via the upstream package */\nexport function isValidRegion(input: string): boolean {\n  return getRegionForString(input) !== undefined\n}\n\n/** Map of extra aliases our SDK supports beyond what the upstream package handles */\nexport const EXTRA_ALIASES: Record<string, ContentstackRegion> = {\n  \"north-america\": \"us\",\n  europe: \"eu\",\n  australia: \"au\",\n}\n","import { ContentstackConfigError } from \"../http/errors.js\"\nimport { ENDPOINT_MAP, EXTRA_ALIASES, HOST_MAP, isValidRegion } from \"./endpoints.js\"\n\n/** All 7 Contentstack regions */\nexport type ContentstackRegion = \"us\" | \"eu\" | \"au\" | \"azure-na\" | \"azure-eu\" | \"gcp-na\" | \"gcp-eu\"\n\n/** Resolved endpoint URLs for a region */\nexport interface ContentstackEndpoints {\n  /** CMA base URL, e.g. \"https://api.contentstack.io\" */\n  cma: string\n  /** CDA REST base URL, e.g. \"https://cdn.contentstack.io\" */\n  cda: string\n  /** GraphQL CDA endpoint */\n  graphql: string\n  /** Asset/image delivery base URL */\n  images: string\n  /** Application URL (for OAuth), e.g. \"https://app.contentstack.com\" */\n  app: string\n  /** Preview API base URL */\n  preview: string\n  /** GraphQL preview endpoint */\n  graphqlPreview: string\n  /** Launch API base URL */\n  launch: string\n  /** Personalize edge endpoint */\n  personalizeEdge: string\n  /** Brand Kit Management API base URL */\n  brandKit: string\n  /** Brand Kit GenAI and Knowledge Vault base URL */\n  brandKitAI: string\n  /** Developer Hub (Marketplace) API base URL */\n  developerHub: string\n}\n\nconst VALID_REGIONS = new Set<string>(Object.keys(ENDPOINT_MAP))\n\n/**\n * Resolve all API endpoints for a Contentstack region.\n *\n * @example\n * ```ts\n * const endpoints = resolveEndpoints(\"eu\");\n * // endpoints.cma === \"https://eu-api.contentstack.com\"\n * // endpoints.app === \"https://eu-app.contentstack.com\"\n * ```\n */\nexport function resolveEndpoints(region: ContentstackRegion): ContentstackEndpoints {\n  return ENDPOINT_MAP[region]\n}\n\n/**\n * Resolve endpoints with https:// stripped (for SDK host parameters).\n *\n * @example\n * ```ts\n * const hosts = resolveHosts(\"eu\");\n * // hosts.cda === \"eu-cdn.contentstack.com\"\n * ```\n */\nexport function resolveHosts(region: ContentstackRegion): ContentstackEndpoints {\n  return HOST_MAP[region]\n}\n\n/**\n * Normalize region aliases: \"na\" → \"us\", \"NA\" → \"us\", etc.\n * Case-insensitive. Throws ContentstackConfigError for unknown regions.\n */\nexport function normalizeRegion(input: string): ContentstackRegion {\n  const lower = input.toLowerCase().trim()\n\n  if (VALID_REGIONS.has(lower)) {\n    return lower as ContentstackRegion\n  }\n\n  // Check extra aliases our SDK supports (north-america, europe, australia)\n  const extraAlias = EXTRA_ALIASES[lower]\n  if (extraAlias) {\n    return extraAlias\n  }\n\n  // Check aliases handled by the upstream package (na, us, aws-na, etc.)\n  if (isValidRegion(lower)) {\n    // The upstream package recognized it — map back to our canonical region\n    // \"na\" and \"us\" both map to the NA region which we call \"us\"\n    if (lower === \"na\" || lower === \"aws-na\" || lower === \"aws_na\") return \"us\"\n    if (lower === \"aws-eu\" || lower === \"aws_eu\") return \"eu\"\n    if (lower === \"aws-au\" || lower === \"aws_au\") return \"au\"\n    if (lower === \"azure_na\") return \"azure-na\"\n    if (lower === \"azure_eu\") return \"azure-eu\"\n    if (lower === \"gcp_na\") return \"gcp-na\"\n    if (lower === \"gcp_eu\") return \"gcp-eu\"\n  }\n\n  const validRegions = [...VALID_REGIONS].join(\", \")\n  const validAliases = [...Object.keys(EXTRA_ALIASES), \"na\", \"aws-na\", \"aws-eu\", \"aws-au\"].join(\n    \", \",\n  )\n  throw new ContentstackConfigError(\n    `Unknown region \"${input}\". Valid regions: ${validRegions}. Aliases: ${validAliases}.`,\n  )\n}\n\nexport { ContentstackConfigError }\n","import type { ContentstackHttpClient } from \"../http/client.js\"\nimport type {\n  IngestContentData,\n  KnowledgeVaultItem,\n  KnowledgeVaultUsage,\n  UpdateContentData,\n} from \"./types.js\"\n\nexport class KnowledgeVaultItemsClient {\n  constructor(private readonly http: ContentstackHttpClient) {}\n\n  async ingest(data: IngestContentData): Promise<KnowledgeVaultItem> {\n    const response = await this.http.post<{ data: KnowledgeVaultItem }>(\"/v1/knowledge-vault\", data)\n    return response.data.data\n  }\n\n  async update(itemUid: string, data: UpdateContentData): Promise<KnowledgeVaultItem> {\n    const response = await this.http.put<{ data: KnowledgeVaultItem }>(\n      `/v1/knowledge-vault/${itemUid}`,\n      data,\n    )\n    return response.data.data\n  }\n\n  async delete(itemUid: string): Promise<void> {\n    await this.http.delete(`/v1/knowledge-vault/${itemUid}`)\n  }\n\n  async getUsage(): Promise<KnowledgeVaultUsage> {\n    const response = await this.http.get<{ data: KnowledgeVaultUsage }>(\"/v1/knowledge-vault/usage\")\n    return response.data.data\n  }\n}\n","import { ContentstackHttpClient } from \"../http/client.js\"\nimport type { HttpClientConfig } from \"../http/types.js\"\nimport type { ContentstackRegion } from \"../regions/resolver.js\"\nimport { resolveEndpoints } from \"../regions/resolver.js\"\nimport { KnowledgeVaultItemsClient } from \"./items.js\"\n\nexport interface KnowledgeVaultClientConfig {\n  region: ContentstackRegion\n  organizationUid: string\n  brandKitUid: string\n  auth: { type: \"oauth\"; accessToken: string } | { type: \"authtoken\"; token: string }\n  httpOptions?: Partial<HttpClientConfig>\n}\n\nexport interface KnowledgeVaultClient {\n  items: KnowledgeVaultItemsClient\n}\n\nexport function createKnowledgeVaultClient(\n  config: KnowledgeVaultClientConfig,\n): KnowledgeVaultClient {\n  const endpoints = resolveEndpoints(config.region)\n\n  const headers: Record<string, string> = {\n    organization_uid: config.organizationUid,\n    brand_kit_uid: config.brandKitUid,\n  }\n\n  switch (config.auth.type) {\n    case \"oauth\":\n      headers.authorization = `Bearer ${config.auth.accessToken}`\n      break\n    case \"authtoken\":\n      headers.authtoken = config.auth.token\n      break\n  }\n\n  const http = new ContentstackHttpClient({\n    ...config.httpOptions,\n    baseUrl: config.httpOptions?.baseUrl ?? endpoints.brandKitAI,\n    headers: {\n      ...config.httpOptions?.headers,\n      ...headers,\n    },\n  })\n\n  return {\n    items: new KnowledgeVaultItemsClient(http),\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIO,IAAM,oBAAN,cAAgC,MAAM;AAAA,EACzB,OAAe;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EAET,YACE,SACA,SAOA;AACA,UAAM,SAAS,SAAS,QAAQ,EAAE,OAAO,QAAQ,MAAM,IAAI,MAAS;AACpE,SAAK,SAAS,SAAS;AACvB,SAAK,YAAY,SAAS;AAC1B,SAAK,SAAS,SAAS;AACvB,SAAK,cAAc,SAAS;AAAA,EAC9B;AACF;AAEO,IAAM,wBAAN,cAAoC,kBAAkB;AAAA,EACzC,OAAO;AAAA,EACP,SAAS;AAC7B;AAEO,IAAM,6BAAN,cAAyC,kBAAkB;AAAA,EAC9C,OAAO;AAAA,EACP,SAAS;AAC7B;AAEO,IAAM,4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