// 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":{"nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","date":"Mon, 12 Oct 2026 04:53:29 GMT","cf-cache-status":"HIT","cross-origin-resource-policy":"cross-origin","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=BMaAtThCqoYzTrGOJ8peMDmPPcrmO%2FKlZK97WpWdUe0TcdEA6EjkEQrJb5ebmkiOAfchjSIuHlYPDerxlF6J53G%2BwEKqzyMMailNPwJNv1EwolAXT4sO43Q%3D\"}]}","cf-ray":"a493804d1898f3c4-IAD","alt-svc":"h3=\":443\"; ma=86400","access-control-expose-headers":"*","x-robots-tag":"noindex","vary":"Origin","accept-ranges":"bytes","access-control-allow-origin":"*","content-length":"1044","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';","x-content-type-options":"nosniff","etag":"\"243c373f1b78bf9cda22c8b82ac6b91c\"","x-jsr-backend":"modules","set-cookie":"__cf_bm=YzXsijvFRkoBBeenhhedmWXOJ7Z16lzm_QxFr2kCs3k-1791780809.7936232-1.0.1.1-ZJoq6ofs5Vil4QPN5CYYfaiaylLkdJW14aIiwSNc5eLeYxqx4ScanT1SOwOcHGbavM3zj4l1I4FqRiphNNg.XTYv0DFIUlZyaOo__eSFdWtbF2uZxMnGEVu3fGEQ5Asv; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Mon, 12 Oct 2026 05:23:29 GMT","age":"3939811","content-type":"text/typescript","cache-control":"public, max-age=31536000, immutable","server":"cloudflare"},"url":"https://jsr.io/@std/yaml/1.0.5/_type.ts","time":1791780809}