/** Copyright (C) 2020-2026 Kedron Holdings LLC, All Rights Reserved. This file is part of Reactor.
 *  For info and license terms please see https://reactor.toggledbits.com/
 *  ------------------------------------------------------------------------------
*/
const a5_0x538eae = a5_0x2e4d;
(function (_0x36f8dd, _0x536e07) {
    const _0x1a42ad = a5_0x2e4d, _0x3edd3e = _0x36f8dd();
    while (!![]) {
        try {
            const _0x15275b = -parseInt(_0x1a42ad(0xc6)) / 0x1 + -parseInt(_0x1a42ad(0xd3)) / 0x2 + -parseInt(_0x1a42ad(0xb8)) / 0x3 * (parseInt(_0x1a42ad(0xcc)) / 0x4) + parseInt(_0x1a42ad(0xc8)) / 0x5 * (-parseInt(_0x1a42ad(0xdb)) / 0x6) + -parseInt(_0x1a42ad(0xc5)) / 0x7 * (-parseInt(_0x1a42ad(0xcb)) / 0x8) + parseInt(_0x1a42ad(0xb4)) / 0x9 + parseInt(_0x1a42ad(0xca)) / 0xa * (parseInt(_0x1a42ad(0xb5)) / 0xb);
            if (_0x15275b === _0x536e07)
                break;
            else
                _0x3edd3e['push'](_0x3edd3e['shift']());
        } catch (_0x510555) {
            _0x3edd3e['push'](_0x3edd3e['shift']());
        }
    }
}(a5_0x2f5c, 0x883f3));
const version = 0x6235, Logger = require(a5_0x538eae(0xb1)), Strategy = require(a5_0x538eae(0xda)), Data = require(a5_0x538eae(0xcf)), Observable = require(a5_0x538eae(0xd8)), {mixin} = require('./util.js'), {DataNotFoundException} = require(a5_0x538eae(0xb6));
var containers = new Map();
function a5_0x2e4d(_0x47db94, _0x40716c) {
    _0x47db94 = _0x47db94 - 0xaf;
    const _0x2f5ceb = a5_0x2f5c();
    let _0x2e4d48 = _0x2f5ceb[_0x47db94];
    return _0x2e4d48;
}
function a5_0x2f5c() {
    const _0x57cf29 = [
        '_strategy',
        'getDataObject',
        './Observable.js',
        'getInstance',
        './Strategy.js',
        '850152wJWPJO',
        'value',
        'exports',
        '_id',
        './Logger.js',
        'values',
        'set',
        '2479167fuSwYu',
        '11570669CAYyuH',
        './Exception',
        'has',
        '3KElrjd',
        'getDefaultLogger',
        '\x20already\x20exists',
        'undefined',
        '_getDataObject',
        '_saveDataObject',
        'sync',
        'Data\x20object\x20',
        'close',
        'get',
        'getID',
        'closeAll',
        'enumDataObjects',
        '7NeUfpl',
        '448503VKhIKO',
        'load',
        '25iZPynG',
        'hasDataObject',
        '10oHrzyI',
        '8479496EqnLDg',
        '166860BaLosF',
        '\x20in\x20container\x20',
        'exception',
        './Data.js',
        'delete',
        'toString',
        'saveDataObject',
        '1261068UpIvbA',
        'Invalid\x20strategy\x20argument',
        'Closing\x20container\x20%1'
    ];
    a5_0x2f5c = function () {
        return _0x57cf29;
    };
    return a5_0x2f5c();
}
class Container {
    constructor(_0x5d84fc, _0x2ceb10) {
        const _0x2c754d = a5_0x538eae;
        if (!(_0x2ceb10 instanceof Strategy))
            throw new TypeError(_0x2c754d(0xd4));
        this[_0x2c754d(0xd6)] = _0x2ceb10, this[_0x2c754d(0xb0)] = String(_0x5d84fc), containers[_0x2c754d(0xb3)](_0x5d84fc, this);
    }
    static ['getInstance'](_0x77cdf5, _0x384dff) {
        const _0x16a509 = a5_0x538eae;
        if (containers[_0x16a509(0xb7)](_0x77cdf5))
            return containers[_0x16a509(0xc1)](_0x77cdf5);
        return _0x384dff ? new Container(_0x77cdf5, _0x384dff) : undefined;
    }
    static [a5_0x538eae(0xc3)]() {
        const _0x2b53fb = a5_0x538eae;
        for (let _0x3fb7f8 of containers[_0x2b53fb(0xb2)]()) {
            Logger[_0x2b53fb(0xb9)]()['info'](_0x2b53fb(0xd5), _0x3fb7f8);
            try {
                _0x3fb7f8[_0x2b53fb(0xc0)]();
            } catch (_0x4a228b) {
                Logger[_0x2b53fb(0xb9)]()[_0x2b53fb(0xce)](_0x4a228b);
            }
        }
    }
    [a5_0x538eae(0xc2)]() {
        const _0x41e780 = a5_0x538eae;
        return this[_0x41e780(0xb0)];
    }
    [a5_0x538eae(0xd1)]() {
        return 'Container#' + this['_id'];
    }
    [a5_0x538eae(0xc9)](_0x4c9a23) {
        return this['_strategy']['hasDataObject'](_0x4c9a23);
    }
    [a5_0x538eae(0xc4)]() {
        const _0x3f420f = a5_0x538eae;
        return this[_0x3f420f(0xd6)][_0x3f420f(0xc4)]();
    }
    [a5_0x538eae(0xbe)]() {
        const _0x407fcd = a5_0x538eae;
        this['_strategy'][_0x407fcd(0xbe)]();
    }
    [a5_0x538eae(0xc0)]() {
        const _0x46a52b = a5_0x538eae;
        this['_strategy'][_0x46a52b(0xc0)](), this['_strategy'] = null, containers[_0x46a52b(0xd0)](this[_0x46a52b(0xb0)]);
    }
    [a5_0x538eae(0xbc)](_0x46f1e3, _0x697740, _0x380721) {
        const _0x3bd904 = a5_0x538eae;
        if (!(_0x46f1e3 instanceof Data)) {
            const _0x16803a = new TypeError('Container.getDataObject\x20expects\x20Data\x20as\x20first\x20argument');
            Logger[_0x3bd904(0xb9)]()[_0x3bd904(0xce)](_0x16803a);
            throw _0x16803a;
        }
        const _0x31996f = this[_0x3bd904(0xd6)][_0x3bd904(0xd7)](_0x46f1e3[_0x3bd904(0xc2)]());
        if (_0x3bd904(0xbb) !== typeof _0x31996f)
            return _0x46f1e3[_0x3bd904(0xc7)](_0x31996f);
        else {
            if (_0x3bd904(0xbb) !== typeof _0x697740)
                return _0x46f1e3[_0x3bd904(0xc7)]({
                    'value': _0x697740,
                    'tss': Date['now'](),
                    'tsc': 0x0
                });
            else
                throw new DataNotFoundException(this[_0x3bd904(0xc2)](), _0x46f1e3[_0x3bd904(0xc2)]());
        }
    }
    [a5_0x538eae(0xbd)](_0x1e065a, _0x54818d) {
        const _0x261c3a = a5_0x538eae;
        return this[_0x261c3a(0xd6)]['saveDataObject'](_0x1e065a[_0x261c3a(0xc2)](), _0x1e065a['extract'](), _0x54818d);
    }
    ['_createDataObject'](_0x5a98a9, _0x172e79) {
        const _0x1e3c40 = a5_0x538eae;
        if (this['hasDataObject'](_0x5a98a9))
            throw new ReferenceError(_0x1e3c40(0xbf) + _0x5a98a9 + _0x1e3c40(0xcd) + this[_0x1e3c40(0xb0)] + _0x1e3c40(0xba));
        let _0x2cb59c = Data[_0x1e3c40(0xd9)](this, _0x5a98a9, _0x172e79);
        return _0x2cb59c[_0x1e3c40(0xdc)] = _0x1e3c40(0xbb) === typeof _0x172e79 ? null : _0x172e79, this['_strategy'][_0x1e3c40(0xd2)](_0x5a98a9, _0x2cb59c['extract']()), _0x2cb59c;
    }
    ['_removeDataObject'](_0x114fc9) {
        const _0xa22b2 = a5_0x538eae;
        this[_0xa22b2(0xd6)]['removeDataObject'](_0x114fc9);
    }
}
mixin(Container, Observable), module[a5_0x538eae(0xaf)] = Container;