"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.WorksheetXform = void 0;
const utils_1 = require("../../../../../utils/utils.js");
const base_xform_1 = require("../base-xform.js");
class WorksheetXform extends base_xform_1.BaseXform {
    render(xmlStream, model) {
        xmlStream.leafNode("sheet", {
            name: model.name,
            sheetId: model.id,
            // Excel doesn't output state when it's 'visible' (default)
            state: model.state === "visible" ? undefined : model.state,
            "r:id": model.rId
        });
    }
    parseOpen(node) {
        if (node.name === "sheet") {
            this.model = {
                name: (0, utils_1.xmlDecode)(node.attributes.name),
                id: parseInt(node.attributes.sheetId, 10),
                state: node.attributes.state,
                rId: node.attributes["r:id"]
            };
            return true;
        }
        return false;
    }
    parseText() { }
    parseClose() {
        return false;
    }
}
exports.WorksheetXform = WorksheetXform;
