import { SdCommonModule } from '@sd-angular/core/common';
import { __awaiter, __classPrivateFieldGet } from 'tslib';
import { Injectable, NgModule } from '@angular/core';
import JSZip from 'jszip';
import { CommonModule } from '@angular/common';

var _download;
class SdZipService {
    constructor() {
        this.zip = (args, fileName) => __awaiter(this, void 0, void 0, function* () {
            const jszip = new JSZip();
            for (const [idx, arg] of args.entries()) {
                jszip.file(arg.fileName || `File ${idx + 1}`, arg.blob);
            }
            yield __classPrivateFieldGet(this, _download).call(this, jszip, fileName);
        });
        _download.set(this, (zip, fileName) => __awaiter(this, void 0, void 0, function* () {
            const blob = yield zip.generateAsync({ type: 'blob' });
            SdUtility.downloadBlob(blob, fileName || 'sd-zip');
        }));
    }
}
_download = new WeakMap();
SdZipService.decorators = [
    { type: Injectable }
];
SdZipService.ctorParameters = () => [];

class SdZipModule {
}
SdZipModule.decorators = [
    { type: NgModule, args: [{
                imports: [
                    CommonModule,
                    SdCommonModule
                ],
                declarations: [],
                exports: [],
                providers: [
                    SdZipService
                ]
            },] }
];

/**
 * Generated bundle index. Do not edit.
 */

export { SdZipModule, SdZipService };
//# sourceMappingURL=sd-angular-core-zip.js.map
