"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DEFAULT_BEARISH_CONFIG = void 0;
exports.bearish = bearish;
exports.default = void 0;
var _BearishEngulfingPattern = _interopRequireWildcard(require("./BearishEngulfingPattern"));
var _BearishHarami = _interopRequireWildcard(require("./BearishHarami"));
var _BearishHaramiCross = _interopRequireWildcard(require("./BearishHaramiCross"));
var _EveningDojiStar = _interopRequireWildcard(require("./EveningDojiStar"));
var _EveningStar = _interopRequireWildcard(require("./EveningStar"));
var _BearishMarubozu = _interopRequireWildcard(require("./BearishMarubozu"));
var _ThreeBlackCrows = _interopRequireWildcard(require("./ThreeBlackCrows"));
var _BearishHammerStick = _interopRequireWildcard(require("./BearishHammerStick"));
var _BearishInvertedHammerStick = _interopRequireWildcard(require("./BearishInvertedHammerStick"));
var _HangingMan = _interopRequireWildcard(require("./HangingMan"));
var _HangingManUnconfirmed = _interopRequireWildcard(require("./HangingManUnconfirmed"));
var _ShootingStar = _interopRequireWildcard(require("./ShootingStar"));
var _ShootingStarUnconfirmed = _interopRequireWildcard(require("./ShootingStarUnconfirmed"));
var _TweezerTop = _interopRequireWildcard(require("./TweezerTop"));
var _CandlestickFinder = _interopRequireWildcard(require("./CandlestickFinder"));
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
/**
 * Configuration interface for Bearish patterns composite.
 * Only requires scale parameter since this is a composite pattern.
 */

/**
 * Default configuration for Bearish patterns composite.
 */
const DEFAULT_BEARISH_CONFIG = exports.DEFAULT_BEARISH_CONFIG = {
  ..._CandlestickFinder.DEFAULT_CANDLESTICK_CONFIG,
  ..._BearishEngulfingPattern.DEFAULT_BEARISH_ENGULFING_CONFIG,
  ..._BearishHarami.DEFAULT_BEARISH_HARAMI_CONFIG,
  ..._BearishHaramiCross.DEFAULT_BEARISH_HARAMI_CROSS_CONFIG,
  ..._EveningStar.DEFAULT_EVENING_STAR_CONFIG,
  ..._EveningDojiStar.DEFAULT_EVENING_DOJI_STAR_CONFIG,
  ..._BearishMarubozu.DEFAULT_BEARISH_MARUBOZU_CONFIG,
  ..._ThreeBlackCrows.DEFAULT_THREE_BLACK_CROWS_CONFIG,
  ..._BearishHammerStick.DEFAULT_BEARISH_HAMMER_STICK_CONFIG,
  ..._BearishInvertedHammerStick.DEFAULT_BEARISH_INVERTED_HAMMER_CONFIG,
  ..._HangingMan.DEFAULT_HANGING_MAN_CONFIG,
  ..._HangingManUnconfirmed.DEFAULT_HANGING_MAN_UNCONFIRMED_CONFIG,
  ..._ShootingStar.DEFAULT_SHOOTING_STAR_CONFIG,
  ..._ShootingStarUnconfirmed.DEFAULT_SHOOTING_STAR_UNCONFIRMED_CONFIG,
  ..._TweezerTop.DEFAULT_TWEEZER_TOP_CONFIG
};
class BearishPatterns extends _CandlestickFinder.default {
  bearishPatterns;
  constructor(config) {
    const finalConfig = {
      ...DEFAULT_BEARISH_CONFIG,
      ...config
    };
    super(finalConfig);
    this.name = 'Bearish Candlesticks';

    // Initialize all bearish patterns with their default configurations
    this.bearishPatterns = [new _BearishEngulfingPattern.default(config), new _BearishHarami.default(config), new _BearishHaramiCross.default(config), new _EveningDojiStar.default(config), new _EveningStar.default(config), new _BearishMarubozu.default(config), new _ThreeBlackCrows.default(config), new _BearishHammerStick.default(config), new _BearishInvertedHammerStick.default(config), new _HangingMan.default(config), new _HangingManUnconfirmed.default(config), new _ShootingStar.default(config), new _ShootingStarUnconfirmed.default(config), new _TweezerTop.default(config)];
  }
  hasPattern(data) {
    return this.bearishPatterns.reduce(function (state, pattern) {
      return state || pattern.hasPattern(data);
    }, false);
  }
}

/**
 * Detects any bearish candlestick pattern in the provided stock data.
 *
 * This function checks for multiple bearish candlestick patterns including:
 * - Bearish Engulfing Pattern
 * - Bearish Harami and Bearish Harami Cross
 * - Evening Star and Evening Doji Star
 * - Bearish Marubozu
 * - Three Black Crows
 * - Bearish Hammer Stick and Bearish Inverted Hammer Stick
 * - Hanging Man and Shooting Star patterns
 * - Tweezer Top
 *
 * @param data - Stock data containing OHLC values
 * @param config - Configuration object for pattern detection
 * @param config.scale - Scale parameter for approximateEqual function precision (default: 0.001)
 * @returns True if any bearish pattern is detected, false otherwise
 *
 * @example
 * ```typescript
 * // Using default configuration
 * const hasBearishPattern = bearish(stockData);
 *
 * // Using custom configuration
 * const hasBearishPattern = bearish(stockData, {
 *   scale: 0.002
 * });
 *
 * // Backward compatibility with scale parameter
 * const hasBearishPattern = bearish(stockData, { scale: 0.002 });
 * ```
 */
exports.default = BearishPatterns;
function bearish(data, config = DEFAULT_BEARISH_CONFIG) {
  return new BearishPatterns(config).hasPattern(data);
}
//# sourceMappingURL=Bearish.js.map