"use strict";

Object.defineProperty(exports, "__esModule", {
    value: !0
}), exports.AutoFillService = void 0;

const rules_1 = require("./rules");

class AutoFillService {
    constructor() {
        this._rules = [], this._init();
    }
    _init() {
        this._rules = [ rules_1.dateRule, rules_1.numberRule, rules_1.extendNumberRule, rules_1.chnNumberRule, rules_1.chnWeek2Rule, rules_1.chnWeek3Rule, rules_1.loopSeriesRule, rules_1.otherRule ].sort(((a, b) => b.priority - a.priority));
    }
    registerRule(rule) {
        if (this._rules.find((r => r.type === rule.type))) throw new Error(`Registry rule failed, type '${rule.type}' already exist!`);
        const index = this._rules.findIndex((r => r.priority < rule.priority));
        this._rules.splice(-1 === index ? this._rules.length : index, 0, rule);
    }
    getRules() {
        return this._rules;
    }
}

exports.AutoFillService = AutoFillService;
//# sourceMappingURL=auto-fill-services.js.map