// Ported from js-yaml v3.13.1:
// https://github.com/nodeca/js-yaml/commit/665aadda42349dcae869f12040d9b10ef18d12da
// Copyright 2011-2015 by Vitaly Puzrin. All rights reserved. MIT license.
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// This module is browser compatible.

export type KindType = "sequence" | "scalar" | "mapping";
/**
 * The style variation for `styles` option of {@linkcode stringify}
 */
export type StyleVariant =
  | "lowercase"
  | "uppercase"
  | "camelcase"
  | "decimal"
  | "binary"
  | "octal"
  | "hexadecimal";

export type RepresentFn<D> = (data: D, style?: StyleVariant) => string;

// deno-lint-ignore no-explicit-any
export interface Type<K extends KindType, D = any> {
  tag: string;
  kind: K;
  predicate?: (data: unknown) => data is D;
  represent?: RepresentFn<D> | Record<string, RepresentFn<D>>;
  defaultStyle?: StyleVariant;
  // deno-lint-ignore no-explicit-any
  resolve: (data: any) => boolean;
  // deno-lint-ignore no-explicit-any
  construct: (data: any) => D;
}

// denoCacheMetadata={"headers":{"x-content-type-options":"nosniff","cache-control":"public, max-age=31536000, immutable","cf-ray":"a52b9e484e41f0a6-DFW","content-length":"1044","accept-ranges":"bytes","date":"Fri, 30 Oct 2026 15:57:53 GMT","access-control-allow-origin":"*","age":"5519860","etag":"\"243c373f1b78bf9cda22c8b82ac6b91c\"","content-security-policy":"default-src 'none'; script-src 'none'; style-src 'none'; img-src 'none'; font-src 'none'; connect-src 'none'; frame-src 'none'; object-src 'none'; frame-ancestors 'none'; sandbox; form-action 'none';","cross-origin-resource-policy":"cross-origin","x-jsr-backend":"modules","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","x-robots-tag":"noindex","alt-svc":"h3=\":443\"; ma=86400","content-type":"text/typescript","server":"cloudflare","access-control-expose-headers":"*","vary":"Origin","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=8F4MliFx1bdJBf2CdQMQ3lqEAkQhtm3u%2F2xEqKqQnV1zC0tnU6JJuPssaoS1L%2FA0NRcrDC1T6AALQxyFW2lb6c0A%2FaljXN1VWuJthqegcWIPUdgKwpxa0UM%3D\"}]}","cf-cache-status":"HIT","set-cookie":"__cf_bm=z8pqf3.CE4aN9CnPuadgOSNXdVwk3nXOnTfqeXtZGyg-1793375873.3802114-1.0.1.1-X4bH4gpV36J7aCXh_uReSXCFXJ5N75KjbSbkvKUPOIS9XLfMpe_PAo0ElJpSfuszjGTsLPWTXFHwPLeqHO9hd3QUbYB9Z5M72B0XolCIEVYirfWGRKQ6rjLWWgbJCtDZ; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Fri, 30 Oct 2026 16:27:53 GMT"},"url":"https://jsr.io/@std/yaml/1.0.5/_type.ts","time":1793375873}