"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/*!
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License.
 */
const groupMask_1 = require("./groupMask");
/**
 * A collection of user group IDs. Unlike in [[GroupMask]], users in these groups are **excluded** from this mask
 * instead of included.
 */
class InvertedGroupMask extends groupMask_1.GroupMask {
    /** @hidden */
    packed() {
        return ~super.packed();
    }
    /** @hidden */
    setPacked(value) {
        super.clear();
        const mapping = this.context.internal.userGroupMapping;
        if (!this.allowDefault) {
            value = value & ~this.getOrAddMapping('default');
        }
        for (const name of Object.keys(mapping)) {
            if ((value & this.getOrAddMapping(name)) === 0) {
                super.add(name);
            }
        }
        if (this.changedCallback) {
            this.changedCallback(this);
        }
    }
    /** Convert this from a mask containing everything but these groups to a mask containing only these groups. */
    invert() {
        return new groupMask_1.GroupMask(this.context, this);
    }
}
exports.InvertedGroupMask = InvertedGroupMask;
//# sourceMappingURL=invertedGroupMask.js.map