import { __esDecorate, __runInitializers } from "tslib";
import { RateLimitRule } from './RateLimitRule.js';
import { observed } from '../../decorators/observed.js';
let RateLimitingConfiguration = (() => {
    let _classSuper = EventTarget;
    let _rules_decorators;
    let _rules_initializers = [];
    let _rules_extraInitializers = [];
    return class RateLimitingConfiguration extends _classSuper {
        static {
            const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
            _rules_decorators = [observed({ deep: true })];
            __esDecorate(this, null, _rules_decorators, { kind: "accessor", name: "rules", static: false, private: false, access: { has: obj => "rules" in obj, get: obj => obj.rules, set: (obj, value) => { obj.rules = value; } }, metadata: _metadata }, _rules_initializers, _rules_extraInitializers);
            if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
        }
        #rules_accessor_storage = __runInitializers(this, _rules_initializers, void 0);
        get rules() { return this.#rules_accessor_storage; }
        set rules(value) { this.#rules_accessor_storage = value; }
        constructor(state = {}) {
            super();
            __runInitializers(this, _rules_extraInitializers);
            this.rules = state.rules?.map((rule) => new RateLimitRule(rule)) || [];
        }
        toJSON() {
            return {
                rules: this.rules.map((rule) => rule.toJSON()),
            };
        }
        notifyChange() {
            this.dispatchEvent(new Event('change'));
        }
    };
})();
export { RateLimitingConfiguration };
//# sourceMappingURL=RateLimitingConfiguration.js.map