/*
THIS INFRAGISTICS ULTIMATE SOFTWARE LICENSE  AGREEMENT ("AGREEMENT") LOCATED HERE:
https://www.infragistics.com/legal/license/igultimate-la
https://www.infragistics.com/legal/license/igultimate-eula
GOVERNS THE LICENSING, INSTALLATION AND USE OF INFRAGISTICS SOFTWARE. BY DOWNLOADING AND/OR INSTALLING AND USING INFRAGISTICS SOFTWARE:  you are indicating that you have read and understand this Agreement, and agree to be legally bound by it on behalf of the yourself and your company.
*/
import { ExternalEventWorkItem$1 } from "./ExternalEventWorkItem$1";
import { BaseError, Base, Stream, markType } from "igniteui-angular-core";
import { IZipEntry_$type } from "./IZipEntry";
import { IOPath } from "igniteui-angular-core";
import { MemoryStream } from "igniteui-angular-core";
import { WorkItem } from "./WorkItem";
import { stringReplace } from "igniteui-angular-core";
import * as JSZip from "jszip/dist/jszip";
/**
 * @hidden
 */
export class ZipEntry extends Base {
    constructor(a, ..._rest) {
        super();
        this.c = null;
        this.b = null;
        this._name = null;
        this._isDirectory = false;
        a = (a == void 0) ? 0 : a;
        switch (a) {
            case 0:
                {
                    let c = _rest[0];
                    this.c = c;
                    this.isDirectory = (this.c.dir);
                    this.name = (this.c.name);
                }
                break;
            case 1:
                {
                    let c = _rest[0];
                    let d = _rest[1];
                    this.name = c;
                    this.b = d;
                }
                break;
        }
    }
    get name() {
        return this._name;
    }
    set name(a) {
        this._name = a;
    }
    get isDirectory() {
        return this._isDirectory;
    }
    set isDirectory(a) {
        this._isDirectory = a;
    }
    static a(a, b, c) {
        return new ZipEntry(1, stringReplace(IOPath.combine1(b, a), '\\', '/'), c);
    }
    openReader() {
        if (this.c != null) {
            let a = (JSZip.support.uint8array);
            let b = new ExternalEventWorkItem$1(Stream.$);
            let c = a ? "uint8array" : "binarystring";
            let d = (e) => b.ag(new MemoryStream(2, e));
            let e = (f) => b.ag(null, new BaseError(1, f != null ? f.toString() : "Open ZipObject Error"));
            this.c.async(c).then(d, e);
            return b;
        }
        return WorkItem.g(Stream.$, this.b);
    }
}
ZipEntry.$t = markType(ZipEntry, 'ZipEntry', Base.$, [IZipEntry_$type]);
//# sourceMappingURL=ZipEntry.js.map