// 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.

import type { Type } from "../_type.ts";

export const set: Type<"mapping", Record<PropertyKey, unknown>> = {
  tag: "tag:yaml.org,2002:set",
  kind: "mapping",
  construct: (data: Record<string, unknown>): Record<string, unknown> =>
    data !== null ? data : {},
  resolve: (data: Record<string, unknown>): boolean => {
    if (data === null) return true;
    return Object.values(data).every((it) => it === null);
  },
};

// denoCacheMetadata={"headers":{"cache-control":"public, max-age=31536000, immutable","cross-origin-resource-policy":"cross-origin","content-length":"693","x-content-type-options":"nosniff","x-jsr-backend":"modules","access-control-expose-headers":"*","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=a81Ab9hakdabzLrxX7HVJBAvyvL8TSywwOVwlljecMA3UZOglPR2NruP7Z0D%2FiikQ7T8NL%2FeYfyezePfu5XveaASVmx14st6m3YJ9rRRTPjlwt2vG%2Fiqi08%3D\"}]}","content-type":"text/typescript","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","cf-ray":"a223e6590e617db6-LAX","cf-cache-status":"HIT","x-robots-tag":"noindex","set-cookie":"__cf_bm=AQkmlUJam74IFcV1KtKgtkYbD9lrpX5FudLsvj2pzs4-1785241875.3750076-1.0.1.1-o5e.Led0aiMWOvMbbop9wCFAjKlOBKcX3Dnm52hHC.pcvNW9eC6.67oDB3e9z8N6vDn.EwkWyo66PJQOnZf.l9gFV2_mVsd7vxoM4LkyXlM6SOePVYYkaNAYbo8eqU0j; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT","etag":"\"38fc552247c2c8d419b2719703584e1d\"","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';","alt-svc":"h3=\":443\"; ma=86400","date":"Tue, 28 Jul 2026 12:31:15 GMT","age":"3983117","access-control-allow-origin":"*","server":"cloudflare","vary":"Origin","accept-ranges":"bytes"},"url":"https://jsr.io/@std/yaml/1.0.5/_type/set.ts","time":1785241875}