// 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":{"etag":"\"243c373f1b78bf9cda22c8b82ac6b91c\"","accept-ranges":"bytes","server":"cloudflare","access-control-allow-origin":"*","date":"Mon, 27 Jul 2026 03:21:21 GMT","content-type":"text/typescript","cf-ray":"a2188377faeed6fc-IAD","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","age":"3517114","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=a2i5kieql0tbWL1dOz%2Bwc4FpAsbhh8A7PrGfxbvagMZ3U2aAGAVXBq6iAIwFkurmY8lgECA1u5IK1%2F87iRhamRSkFMQA8RrbSUwfR5NmWZ2PDI6UJtGFynI%3D\"}]}","x-robots-tag":"noindex","vary":"Origin","content-length":"1044","cf-cache-status":"HIT","cache-control":"public, max-age=31536000, immutable","access-control-expose-headers":"*","x-content-type-options":"nosniff","set-cookie":"__cf_bm=5webOsNslW0YHNimEZSEU5uUS_lO2Syta4JI37QWAAI-1785122481.9311712-1.0.1.1-wg9QUfMT_lm8i869u2C6lxUnbu8WWB3yuhbYI7H21o2ePV8.4gNyO9YCXBTpNaErrkAerktxVX2doJsqHi4cR9ILSLpdlWWsXsNAJu_714G.bPnt5WNWElzAYtmrGj_B; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Mon, 27 Jul 2026 03:51:21 GMT","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","alt-svc":"h3=\":443\"; ma=86400"},"url":"https://jsr.io/@std/yaml/1.0.5/_type.ts","time":1785122481}