// 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":{"server":"cloudflare","vary":"Origin","cf-cache-status":"HIT","etag":"\"243c373f1b78bf9cda22c8b82ac6b91c\"","access-control-allow-origin":"*","date":"Tue, 28 Jul 2026 12:31:15 GMT","content-length":"1044","cache-control":"public, max-age=31536000, immutable","access-control-expose-headers":"*","cf-ray":"a223e6590e297db6-LAX","x-content-type-options":"nosniff","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-jsr-backend":"modules","set-cookie":"__cf_bm=LluJC5z1IIzA.rg01hBvxL14r4a0eXBGdOIaY5.zyRc-1785241875.3669918-1.0.1.1-3Dx5_djR5D29VKwS4ISJHMDjbM4BVMa.s2fb.Y7l00lzhrWDckqiGELvt2VasmuUr.9jHqDYz4akscxNOLpxGjhD8OYE.OVWmBMqSDUW6imZmnKDIHjq4CxeM58ImdDE; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=DfhBhDeVibOr0k67Jlr%2BTSsznm2%2BPjpHyOFirIlgNbOqPsDDLUYO7YU3DlOxeeWNMwI60AZp1qEvrIUyy6omTyrl1G%2FLWQ9TpmemJ3m8hCSboE%2FxtC0qwHo%3D\"}]}","accept-ranges":"bytes","alt-svc":"h3=\":443\"; ma=86400","age":"604784","content-type":"text/typescript","cross-origin-resource-policy":"cross-origin","x-robots-tag":"noindex"},"url":"https://jsr.io/@std/yaml/1.0.5/_type.ts","time":1785241875}