/*
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 * as tslib_1 from "tslib";
import { Base, fromEnum, markType } from "igniteui-angular-core";
import { XmlTextWriter } from "igniteui-angular-core";
import { Encoding } from "igniteui-angular-core";
import { DocCoreExtensions } from "./DocCoreExtensions";
/**
 * @hidden
 */
var RelationshipsWriter = /** @class */ (function (_super) {
    tslib_1.__extends(RelationshipsWriter, _super);
    function RelationshipsWriter() {
        return _super !== null && _super.apply(this, arguments) || this;
    }
    RelationshipsWriter.j = function (a, b) {
        var e_1, _a;
        {
            var c = new XmlTextWriter(0, b, Encoding.uTF8);
            try {
                c.ad("xml", "version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"");
                c.an("Relationships", RelationshipsWriter.c);
                try {
                    for (var _b = tslib_1.__values(fromEnum(a)), _c = _b.next(); !_c.done; _c = _b.next()) {
                        var d = _c.value;
                        c.an("Relationship", RelationshipsWriter.c);
                        c.h("Id", d.id);
                        c.h("Type", d.relationshipType);
                        if (d.targetMode == 1) {
                            c.h("Target", d.targetUri.originalString);
                            c.h("TargetMode", "External");
                        }
                        else {
                            c.h("Target", DocCoreExtensions.fixDirectoryPath(d.targetUri.toString()));
                        }
                        c.v();
                    }
                }
                catch (e_1_1) { e_1 = { error: e_1_1 }; }
                finally {
                    try {
                        if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
                    }
                    finally { if (e_1) throw e_1.error; }
                }
                c.v();
            }
            finally {
                if (c != null) {
                    c.dispose();
                }
            }
        }
    };
    RelationshipsWriter.$t = markType(RelationshipsWriter, 'RelationshipsWriter');
    RelationshipsWriter.c = "http://schemas.openxmlformats.org/package/2006/relationships";
    RelationshipsWriter.a = [RelationshipsWriter.c];
    return RelationshipsWriter;
}(Base));
export { RelationshipsWriter };
//# sourceMappingURL=RelationshipsWriter.js.map