{"version":3,"file":"_httpFormDataReadBoolean.mjs","names":[],"sources":["../../src/internal/_httpFormDataReadBoolean.ts"],"sourcesContent":["/**\n * Read one form field as a boolean.\n *\n * An empty value is true, `true` and `1` are true, `false` and `0` are false,\n * `null` is null and other text is kept for the assertion to reject.\n *\n * @evidence contracts/common.md#principled-implementation A file is passed through, a missing field is absent, the text `null` is null, an empty value is true (a present flag), `true` and `1` are true, `false` and `0` are false, and any other text is returned for the validator to reject.\n * @evidence contracts/common.md#clear-and-simple-design One conditional chain.\n * @evidence contracts/common.md#prohibited-implementation-shortcuts The mapping is the form-data contract and not keyed on a field.\n * @evidence contracts/common.md#meaningful-documentation A comment states the mapping.\n */\nexport const _httpFormDataReadBoolean = (\n  input: string | File | null,\n): boolean | null | undefined =>\n  input instanceof File\n    ? (input as any)\n    : // `undefined` is as absent as `null`, which `FormData.get` returns; a\n      // stand-in that answers `undefined` must not throw on `.length`.\n      input === null || input === undefined\n      ? undefined\n      : input === \"null\"\n        ? null\n        : input.length === 0\n          ? true\n          : input === \"true\" || input === \"1\"\n            ? true\n            : input === \"false\" || input === \"0\"\n              ? false\n              : (input as any); // wrong type\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,4BACX,UAEA,iBAAiB,OACZ,QAGD,UAAU,QAAQ,UAAU,KAAA,IAC1B,KAAA,IACA,UAAU,SACR,OACA,MAAM,WAAW,IACf,OACA,UAAU,UAAU,UAAU,MAC5B,OACA,UAAU,WAAW,UAAU,MAC7B,QACC"}