import * as C from "@effect-ts/core/Collections/Immutable/Chunk";
import * as NA from "@effect-ts/core/Collections/Immutable/NonEmptyArray";
import * as E from "@effect-ts/core/Either";
import { makeEqual } from "@effect-ts/core/Equal";
import * as O from "@effect-ts/core/Option";
import { FigHeaderError } from "../../FigletException/index.mjs";
export const EqualCharacterHorizontalSmushing = {
  _tag: "EqualCharacterHorizontalSmushing",
  value: 1
};
export const UnderscoreHorizontalSmushing = {
  _tag: "UnderscoreHorizontalSmushing",
  value: 2
};
export const HierarchyHorizontalSmushing = {
  _tag: "HierarchyHorizontalSmushing",
  value: 4
};
export const OppositePairHorizontalSmushing = {
  _tag: "OppositePairHorizontalSmushing",
  value: 8
};
export const BigXHorizontalSmushing = {
  _tag: "BigXHorizontalSmushing",
  value: 16
};
export const HardblankHorizontalSmushing = {
  _tag: "HardblankHorizontalSmushing",
  value: 32
};
export const HorizontalFitting = {
  _tag: "HorizontalFitting",
  value: 64
};
export const HorizontalSmushing = {
  _tag: "HorizontalSmushing",
  value: 128
};
export const EqualCharacterVerticalSmushing = {
  _tag: "EqualCharacterVerticalSmushing",
  value: 256
};
export const UnderscoreVerticalSmushing = {
  _tag: "UnderscoreVerticalSmushing",
  value: 512
};
export const HierarchyVerticalSmushing = {
  _tag: "HierarchyVerticalSmushing",
  value: 1024
};
export const HorizontalLineVerticalSmushing = {
  _tag: "HorizontalLineVerticalSmushing",
  value: 2048
};
export const VerticalLineSupersmushing = {
  _tag: "VerticalLineSupersmushing",
  value: 4096
};
export const VerticalFitting = {
  _tag: "VerticalFitting",
  value: 8192
};
export const VerticalSmushing = {
  _tag: "VerticalSmushing",
  value: 16384
};
export const values = /*#__PURE__*/C.from([EqualCharacterHorizontalSmushing, UnderscoreHorizontalSmushing, HierarchyHorizontalSmushing, OppositePairHorizontalSmushing, BigXHorizontalSmushing, HardblankHorizontalSmushing, HorizontalFitting, HorizontalSmushing, EqualCharacterVerticalSmushing, UnderscoreVerticalSmushing, HierarchyVerticalSmushing, HorizontalLineVerticalSmushing, VerticalLineSupersmushing, VerticalFitting, VerticalSmushing]); // -----------------------------------------------------------------------------
// Constructors
// -----------------------------------------------------------------------------

/**
 * Obtains the list of requested settings starting from the provided value.
 *
 * @param requestedSettings The number representing the `FullLayout`
 * @return The `FullLayout` that corresponds to the given numeric value.
 */

export function fromValue(requestedSettings) {
  if (requestedSettings < 0 || requestedSettings > 32767) {
    return E.left(NA.single(new FigHeaderError({
      message: `FullLayout needs a value between 0 and 32767, inclusive, but received "${requestedSettings}"`
    })));
  }

  const result = C.collect_(values, setting => (setting.value & requestedSettings) !== 0 ? O.some(setting) : O.none);
  return E.right(result);
}
/**
 * The settings that correspond to horizontal smushing.
 */

export const horizontalSmushingRules = /*#__PURE__*/C.from([EqualCharacterHorizontalSmushing, UnderscoreHorizontalSmushing, HierarchyHorizontalSmushing, OppositePairHorizontalSmushing, BigXHorizontalSmushing, HardblankHorizontalSmushing]);
/**
 * The settings that correspond to vertical smushing.
 */

export const verticalSmushingRules = /*#__PURE__*/C.from([EqualCharacterVerticalSmushing, UnderscoreVerticalSmushing, HierarchyVerticalSmushing, HorizontalLineVerticalSmushing, VerticalLineSupersmushing]); // -----------------------------------------------------------------------------
// Instances
// -----------------------------------------------------------------------------

export const equalFullLayout = /*#__PURE__*/makeEqual((x, y) => x._tag === y._tag && x.value === y.value);
//# sourceMappingURL=index.mjs.map