// 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":{"cf-cache-status":"HIT","content-length":"1044","vary":"Origin","x-jsr-backend":"modules","set-cookie":"__cf_bm=Sldfjf7.QKEuK94tykNry3t1t5krZcBmnYFjmYqV2Fs-1793595417.8091033-1.0.1.1-Xzu3i2MXsz6HHHDsUnafDunj9BEB__IZCrDmAHWHJBlnz4tX6Voa9EVnd2o8iK1PGemGkD5fZYU_sfKdRM0iSi8ACXz_ylXrvJ62g.q.KPE07yEHHbytYTHNdcGzA2KP; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Mon, 02 Nov 2026 05:26:57 GMT","etag":"\"243c373f1b78bf9cda22c8b82ac6b91c\"","date":"Mon, 02 Nov 2026 04:56:57 GMT","content-type":"text/typescript","accept-ranges":"bytes","access-control-allow-origin":"*","age":"5754419","cache-control":"public, max-age=31536000, immutable","access-control-expose-headers":"*","cross-origin-resource-policy":"cross-origin","x-robots-tag":"noindex","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","alt-svc":"h3=\":443\"; ma=86400","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=S86FAo4uClNsXDFf74AO1xlxwa9nXbGodbPVYOHE9%2FaoiixB%2FTJrzaH%2BTShbGpXlAe%2BFENwqNWjFYpViuHGPgigNaB3fBOz0gdKdcMeZneYDFBrPWIIoFik%3D\"}]}","cf-ray":"a5408e411ed4c655-IAD","server":"cloudflare","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"},"url":"https://jsr.io/@std/yaml/1.0.5/_type.ts","time":1793595417}