"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.equalFullLayout = exports.VerticalSmushing = exports.VerticalLineSupersmushing = exports.VerticalFitting = exports.UnderscoreVerticalSmushing = exports.UnderscoreHorizontalSmushing = exports.OppositePairHorizontalSmushing = exports.HorizontalSmushing = exports.HorizontalLineVerticalSmushing = exports.HorizontalFitting = exports.HierarchyVerticalSmushing = exports.HierarchyHorizontalSmushing = exports.HardblankHorizontalSmushing = exports.EqualCharacterVerticalSmushing = exports.EqualCharacterHorizontalSmushing = exports.BigXHorizontalSmushing = void 0;
exports.fromValue = fromValue;
exports.verticalSmushingRules = exports.values = exports.horizontalSmushingRules = void 0;

var C = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect-ts/core/Collections/Immutable/Chunk"));

var NA = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect-ts/core/Collections/Immutable/NonEmptyArray"));

var E = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect-ts/core/Either"));

var _Equal = /*#__PURE__*/require("@effect-ts/core/Equal");

var O = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("@effect-ts/core/Option"));

var _index = /*#__PURE__*/require("../../FigletException/index.js");

function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }

const EqualCharacterHorizontalSmushing = {
  _tag: "EqualCharacterHorizontalSmushing",
  value: 1
};
exports.EqualCharacterHorizontalSmushing = EqualCharacterHorizontalSmushing;
const UnderscoreHorizontalSmushing = {
  _tag: "UnderscoreHorizontalSmushing",
  value: 2
};
exports.UnderscoreHorizontalSmushing = UnderscoreHorizontalSmushing;
const HierarchyHorizontalSmushing = {
  _tag: "HierarchyHorizontalSmushing",
  value: 4
};
exports.HierarchyHorizontalSmushing = HierarchyHorizontalSmushing;
const OppositePairHorizontalSmushing = {
  _tag: "OppositePairHorizontalSmushing",
  value: 8
};
exports.OppositePairHorizontalSmushing = OppositePairHorizontalSmushing;
const BigXHorizontalSmushing = {
  _tag: "BigXHorizontalSmushing",
  value: 16
};
exports.BigXHorizontalSmushing = BigXHorizontalSmushing;
const HardblankHorizontalSmushing = {
  _tag: "HardblankHorizontalSmushing",
  value: 32
};
exports.HardblankHorizontalSmushing = HardblankHorizontalSmushing;
const HorizontalFitting = {
  _tag: "HorizontalFitting",
  value: 64
};
exports.HorizontalFitting = HorizontalFitting;
const HorizontalSmushing = {
  _tag: "HorizontalSmushing",
  value: 128
};
exports.HorizontalSmushing = HorizontalSmushing;
const EqualCharacterVerticalSmushing = {
  _tag: "EqualCharacterVerticalSmushing",
  value: 256
};
exports.EqualCharacterVerticalSmushing = EqualCharacterVerticalSmushing;
const UnderscoreVerticalSmushing = {
  _tag: "UnderscoreVerticalSmushing",
  value: 512
};
exports.UnderscoreVerticalSmushing = UnderscoreVerticalSmushing;
const HierarchyVerticalSmushing = {
  _tag: "HierarchyVerticalSmushing",
  value: 1024
};
exports.HierarchyVerticalSmushing = HierarchyVerticalSmushing;
const HorizontalLineVerticalSmushing = {
  _tag: "HorizontalLineVerticalSmushing",
  value: 2048
};
exports.HorizontalLineVerticalSmushing = HorizontalLineVerticalSmushing;
const VerticalLineSupersmushing = {
  _tag: "VerticalLineSupersmushing",
  value: 4096
};
exports.VerticalLineSupersmushing = VerticalLineSupersmushing;
const VerticalFitting = {
  _tag: "VerticalFitting",
  value: 8192
};
exports.VerticalFitting = VerticalFitting;
const VerticalSmushing = {
  _tag: "VerticalSmushing",
  value: 16384
};
exports.VerticalSmushing = VerticalSmushing;
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.
 */

exports.values = values;

function fromValue(requestedSettings) {
  if (requestedSettings < 0 || requestedSettings > 32767) {
    return E.left(NA.single(new _index.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.
 */


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

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

exports.verticalSmushingRules = verticalSmushingRules;
const equalFullLayout = /*#__PURE__*/(0, _Equal.makeEqual)((x, y) => x._tag === y._tag && x.value === y.value);
exports.equalFullLayout = equalFullLayout;
//# sourceMappingURL=index.js.map