"use strict";
var __rest = (this && this.__rest) || function (s, e) {
    var t = {};
    for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
        t[p] = s[p];
    if (s != null && typeof Object.getOwnPropertySymbols === "function")
        for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
            if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
                t[p[i]] = s[p[i]];
        }
    return t;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.jsonToxml = void 0;
/* eslint-disable */
const util_1 = require("./util");
const blockUtil_1 = require("./blockUtil");
const cloneDeep_1 = require("lodash/cloneDeep");
const formatXml_1 = require("./formatXml");
let settings = {};
const excludeKeys = ['columns', 'columnsRender', 'formInstance', 'canEdit', 'staticOptions', 'remote'];
const defaultSettings = {
    formatOutput: true,
    formatTextNodes: false,
    indentString: '  ',
    ignore: [],
    replace: [],
    nodes: [],
    ///TODO: exceptions system
    exceptions: [],
    tagNameKey: 'type',
    tagNameKeyForBlock: 'name',
    childrenKey: 'elements',
    styleKey: 'data',
};
const formItemType = 'Form.Item';
const splitFormComponent = (obj) => {
    var _a;
    const childData = {};
    const parentData = {};
    let buildMode;
    Object.keys(obj.data).forEach(key => {
        if (key === 'formSettings') {
            parentData[key] = obj.data[key];
        }
        else if (key === 'settings') {
            childData[key] = (0, cloneDeep_1.default)(obj.data[key]);
            delete childData[key].visible;
            // 将控件的visible属性放至formitem内
            if (obj.data[key].visible) {
                if (!parentData[key]) {
                    parentData[key] = {};
                }
                parentData[key].visible = obj.data[key].visible;
            }
        }
        else {
            childData[key] = obj.data[key];
        }
    });
    // 将formItem name属性复制给child
    if (childData.formItemSettings) {
        buildMode = childData.formItemSettings.buildMode;
        childData.formItemSettings.name = (_a = parentData.formSettings) === null || _a === void 0 ? void 0 : _a.name;
    }
    if (childData.settings) {
        delete childData.settings.visible;
    }
    obj.data = childData;
    const formItem = {
        type: formItemType,
        elements: [obj],
        data: Object.assign(Object.assign({}, parentData), { settings: Object.assign({}, parentData.settings) }),
    };
    return formItem;
};
const splitPickerComponent = (obj) => {
    var _a, _b;
    const childData = {
        type: 'listItem',
        elements: [],
        data: {
            componentSettings: {
                text: (_b = (_a = obj.data) === null || _a === void 0 ? void 0 : _a.formItemSettings) === null || _b === void 0 ? void 0 : _b.placeholder,
                arrow: 'horizontal',
            },
        },
    };
    const parent = (0, cloneDeep_1.default)(obj);
    delete parent.data.formItemSettings.placeholder;
    parent.elements = [childData];
    return parent;
};
const splitRadioComponent = (obj) => {
    var _a;
    const parent = (0, cloneDeep_1.default)(obj);
    const { options = [] } = ((_a = obj.data) === null || _a === void 0 ? void 0 : _a.formItemSettings) || {};
    if (options.length > 0) {
        options.forEach((v) => {
            parent.elements.push({
                type: 'radio',
                elements: [],
                data: {
                    settings: {},
                    formItemSettings: {
                        value: v.value,
                        text: v.label,
                    },
                },
            });
        });
    }
    delete parent.data.formItemSettings.options;
    return parent;
};
// const splitTableColumn = (obj: any) => {
//   const { renders } = obj.data.columnSettings;
//   const { events = [] } = obj.data;
//   const childKey = Object.keys(renders)[0];
//   const childData: any = {
//     componentSettings: Object.values(renders)[0]
//   }
//   if (events.length > 0) {
//     childData.events = events;
//   }
//   const childItem = {
//     type: firstToUpper(childKey),
//     data: childData,
//   }
//   delete obj.data.columnSettings.renders;
//   delete obj.data.events;
//   obj.elements.push(childItem);
//   return obj;
// }
const transformTagName = (tagName) => {
    const name = util_1.tagNameMaps[tagName] ? util_1.tagNameMaps[tagName] : tagName;
    return name;
};
const judgeIfBlock = (json) => {
    var _a, _b;
    return json.type === 'document' && ((_b = (_a = json.data) === null || _a === void 0 ? void 0 : _a.blockSettings) === null || _b === void 0 ? void 0 : _b.isBlock) && !settings.ignoreBlock;
};
const getTagName = (json) => {
    var _a, _b;
    let tagName;
    if (judgeIfBlock(json)) {
        // block区块取name属性
        tagName = json[settings.tagNameKeyForBlock];
    }
    else if (json.type === 'rowCell') {
        // rowCell单元格取单元格内元素类型
        tagName = firstToUpper(((_b = (_a = json.data) === null || _a === void 0 ? void 0 : _a.componentSettings) === null || _b === void 0 ? void 0 : _b.renderType) || 'text');
    }
    else {
        // 其他取type属性
        tagName = firstToUpper(json[settings.tagNameKey]);
    }
    return transformTagName(tagName);
};
function convertToXml(json, depth) {
    const suffix = settings.formatOutput ? '\r\n' : '';
    // 区块名取name属性
    const tagNameKey = judgeIfBlock(json) ? settings.tagNameKeyForBlock : settings.tagNameKey;
    const tagName = getTagName(json);
    let xmlTag = '<' + tagName;
    let children = '';
    Object.keys(json).forEach((key) => {
        var _a, _b;
        if (key !== tagNameKey && Object.prototype.hasOwnProperty.call(json, key)) {
            if (key === settings.childrenKey && Array.isArray(json[key])) {
                // children
                json[key].forEach((item) => {
                    var _a, _b;
                    if (judgeIfBlock(item)) {
                        // block组件特殊处理
                        children += convertToXml(item, depth + 1);
                    }
                    else if (((_a = item.data) === null || _a === void 0 ? void 0 : _a.formItemSettings) &&
                        ((_b = item.data) === null || _b === void 0 ? void 0 : _b.formSettings) &&
                        ![formItemType, 'document'].includes(json.type) &&
                        item.type !== 'button') {
                        // 表单组件需要额外用FormItem包裹
                        let newItem = item;
                        if (item.type === 'picker') {
                            newItem = splitPickerComponent(item);
                        }
                        if (item.type === 'radioGroup') {
                            newItem = splitRadioComponent(item);
                        }
                        const formItem = splitFormComponent(newItem);
                        children += convertToXml(formItem, depth + 1);
                    }
                    else {
                        children += convertToXml(item, depth + 1);
                    }
                });
            }
            else if (key === settings.styleKey) {
                // style
                const styleProps = createStyleProperty(json[key], children, depth + 1, json.type);
                xmlTag += ` ${styleProps.style}`;
                children = styleProps.children;
            }
            else {
                // other property
                if (key === 'path') {
                    // block及其内部普通元素需要记载path路径
                    if ((json.type === 'document' && ((_b = (_a = json.data) === null || _a === void 0 ? void 0 : _a.blockSettings) === null || _b === void 0 ? void 0 : _b.isBlock)) || json.for) {
                        xmlTag += ` ${getPropertyName(key)}="${json[key]}"`;
                    }
                }
                else {
                    xmlTag += ` ${getPropertyName(key)}="${json[key]}"`;
                }
            }
        }
    });
    // close tag properly
    if (children !== '') {
        xmlTag += `> ${children} </${tagName}>${suffix}`;
    }
    else if (tagName === 'Link') {
        xmlTag += `></${tagName}>`;
    }
    else {
        xmlTag += ' />' + suffix;
    }
    return xmlTag;
}
const createRowCellStyleProperty = (obj = {}, children) => {
    let rowCellProps = '';
    Object.keys(obj).forEach((key) => {
        if (key !== 'renderType') {
            if (key === 'renderText') {
                children += `${obj[key]}`;
            }
            else if (typeof obj[key] === 'string') {
                rowCellProps += ` ${key}="${obj[key]}"`;
            }
        }
    });
    return {
        style: rowCellProps,
        children,
    };
};
const createStyleProperty = (style, children = '', depth = 0, elementType) => {
    let styleStr = '';
    let classStr = '';
    let childrenStyleStr = '';
    // let newChildren = children;
    Object.keys(style).forEach((key) => {
        if (Object.prototype.hasOwnProperty.call(style, key) && !excludeKeys.includes(key)) {
            if (util_1.settingKeys.includes(key)) {
                if (elementType === 'rowCell' && key === 'componentSettings') {
                    // rowCell内部属性需转换为标签
                    const styleProps = createRowCellStyleProperty(style[key], children);
                    childrenStyleStr += ` ${styleProps.style}`;
                    children = styleProps.children;
                }
                else {
                    const styleProps = createStyleProperty(style[key], children, depth, elementType);
                    childrenStyleStr += ` ${styleProps.style}`;
                    children = styleProps.children;
                }
            }
            else if (key === 'display') {
                classStr += ` ${createDisplayClassProperty(style[key])}`;
            }
            else if (key === 'horizontalAlign') {
                // classStr += ` ${createHorizontalClassProperty(style[key])}`;
            }
            else if (key === 'verticalAlign') {
                // classStr += ` ${createVerticalClassProperty(style[key])}`;
            }
            else if (key === 'horizontalAlignFlex') {
                // classStr += ` ${createHorizontalAlignClassProperty(style[key])}`;
            }
            else if (key === 'animation') {
                // styleStr += ` ${getAnimationProps(style[key])}`;
            }
            else if (key === 'background') {
                // styleStr += ` ${getBackGroundProps(style[key])}`;
            }
            else if (key === 'border') {
                // const { borderStyle, borderClass } = createBorderClassProperty(style[key]);
                // styleStr += ` ${borderStyle}`;
                // classStr += ` ${borderClass}`;
            }
            else if (key === 'cols') {
                styleStr += ` ${getColProps(style[key])}`;
            }
            else if (key === 'height') {
                styleStr += ` ${geHeightProps(style[key])}`;
            }
            else if (key === 'icon') {
                const iconProps = getIconProps(style[key], children, depth);
                styleStr += ` ${iconProps.style}`;
                children = iconProps.children;
            }
            else if (key === 'margin') {
                // classStr += ` ${createMarginClassProperty(style[key])}`;
            }
            else if (key === 'padding') {
                // classStr += ` ${createPaddingClassProperty(style[key])}`;
            }
            else if (key === 'shadow') {
                // styleStr += ` ${getShadowProps(style[key])}`;
            }
            else if (key === 'width') {
                styleStr += ` ${getWidthProps(style[key])}`;
            }
            else if (key === 'image') {
                styleStr += ` ${getImageProps(style[key])}`;
            }
            else if (key === 'text') {
                children = getTextProps(style[key]);
            }
            else if (key === 'events') {
                styleStr += ` ${getEventsRender(style[key])}`;
            }
            else if (key === 'dataSource') {
                const getVar = style[`${key}Variable`];
                styleStr += ` ${getPropertyName(key)}="{{${getVar || '[]'}}}"`;
            }
            else if (key === 'c-if') {
                styleStr += ` ${key}="{{${typeof style[key] === 'boolean' ? style[key] : transformDoubleToSingle(transformSpecialChar(style[key]))}}}"`;
            }
            else if (key === 'c-else') {
                styleStr = `${key}${styleStr}`;
            }
            else if (typeof style[key] === 'string') {
                if (style[key].length > 0 && !key.includes('Variable')) {
                    const propertyValue = getPropertyValue(key, style);
                    styleStr += ` ${getPropertyName(key)}="${propertyValue}"`;
                }
            }
            else if (style[key] && typeof style[key] === 'object') {
                if (Object.keys(style[key]).length > 0) {
                    let str = transformSpecialChar(JSON.stringify(style[key]));
                    // if (!Array.isArray(style[key])) {
                    //   // 对象类型转字符串后，需在最后一项末尾加 ","
                    //   str = str.replace(/(.*)}/,'$1,}');
                    // }
                    styleStr += ` ${getPropertyName(key)}="{{${transformDoubleToSingle(str)}}}"`;
                }
            }
            else if (key && style[key] !== null && style[key] !== undefined) {
                styleStr += ` ${getPropertyName(key)}="{{${style[key]}}}"`;
            }
        }
    });
    if (childrenStyleStr !== '') {
        styleStr += ` ${childrenStyleStr}`;
    }
    if (classStr && deleteSpace(classStr).length > 0) {
        styleStr = `class="${trim(classStr)}" ${trim(styleStr)}`;
    }
    return {
        style: trim(styleStr),
        children,
    };
};
const createDisplayClassProperty = (value) => {
    if (typeof value === 'string') {
        return value;
    }
    return '';
};
const createHorizontalClassProperty = (obj) => {
    return `text-${obj || `justify`}`;
};
const createHorizontalAlignClassProperty = (obj) => {
    const proName = obj.indexOf('-') > -1 ? obj.split('-')[1] : obj;
    return `items-${proName}`;
};
const createVerticalClassProperty = (obj) => {
    return `justify-${obj}`;
};
const getColProps = (obj) => {
    let colProps = '';
    if (obj.span) {
        colProps += `span="{{${obj.span}}}"`;
    }
    if (obj.offset) {
        colProps += ` offset="{{${obj.offset}}}"`;
    }
    return trim(colProps);
};
const getAnimationProps = (obj) => {
    let animationPropsStr = '';
    if (obj.name) {
        animationPropsStr += `animationName="${obj.name}"`;
    }
    if (obj.duration) {
        animationPropsStr += ` animationDuration="${obj.duration}"`;
    }
    if (obj.delay) {
        animationPropsStr += ` animationDelay="${obj.delay}"`;
    }
    if (obj.easing) {
        animationPropsStr += ` animationTimingFunction="${obj.easing}"`;
    }
    if (obj.offset) {
        animationPropsStr += ` animationOffset="${obj.offset}"`;
    }
    return trim(animationPropsStr);
};
const getImageProps = (obj) => {
    if (obj.file) {
        return `src="${obj.file.path}"`;
    }
    return '';
};
const getTextProps = (obj) => {
    let text = '';
    if (typeof obj === 'string') {
        // const suffix = '\r\n'
        text = obj;
    }
    else if (obj.document) {
        const { nodes = [] } = obj.document;
        nodes.forEach((node, index) => {
            text += `${node.nodes[0].leaves[0].text}${index < node.length - 1 ? ` \n` : ''}`;
        });
    }
    return text;
};
const getBackGroundProps = (obj) => {
    let backgroundPropsStr = '';
    if (obj.color) {
        backgroundPropsStr += `backgroundColor="${obj.color}"`;
    }
    if (obj.image) {
        if (obj.image.file) {
            const bgUrl = `/${obj.image.file.src.path}/${obj.image.file.src.fileName}`;
            backgroundPropsStr += ` backgroundImage="url(${bgUrl})"`;
        }
        if (obj.image.scaling) {
            backgroundPropsStr += ` backgroundSize="${obj.image.scaling}"`;
        }
        if (obj.image.position) {
            backgroundPropsStr += `backgroundPosition="${obj.image.position}"`;
        }
    }
    if (obj.hover) {
        backgroundPropsStr += ` hoverBackgroundColor="${obj.hover.color}"`;
    }
    return trim(backgroundPropsStr);
};
const createBorderClassProperty = (obj) => {
    let borderPropsStr = '';
    let borderStyleStr = '';
    if (obj.color) {
        borderStyleStr += `borderColor="${obj.color}"`;
    }
    if (obj.radius) {
        borderPropsStr += ` rounded-${obj.radius}px`;
    }
    if (obj.style) {
        borderPropsStr += ` border-${obj.style}`;
    }
    if (obj.width) {
        borderPropsStr += ` border-${obj.width}`;
    }
    if (obj.borders) {
        Object.keys(obj.borders).forEach((key) => {
            if (!obj.borders[key]) {
                const proName = obj.borders[key].split('')[0];
                borderPropsStr += ` border-${proName}-0`;
            }
        });
    }
    return {
        borderStyle: trim(borderStyleStr),
        borderClass: trim(borderPropsStr),
    };
};
const getIconProps = (obj, children = '', depth = 0) => {
    let iconPropsStr = '';
    let newChildren = children;
    if (obj.id) {
        const idValue = Array.isArray(obj.id) ? JSON.stringify(obj.id) : obj.id.toString();
        iconPropsStr += `iconId="${idValue.replace(/\"/g, "'")}"`;
    }
    if (obj.svg) {
        newChildren += `${obj.svg}`;
    }
    if (obj.width) {
        iconPropsStr += ` width="${obj.width}"`;
    }
    return {
        style: trim(iconPropsStr),
        children: newChildren,
    };
};
const geHeightProps = (obj) => {
    if (obj && obj.value) {
        return `height="${obj.value}"`;
    }
    return '';
};
const createMarginClassProperty = (obj) => {
    let marginPropsStr = '';
    if (obj.advanced) {
        Object.keys(obj.desktop).forEach((key) => {
            if (Number(obj.desktop[key]) !== 0) {
                marginPropsStr += ` m${key.charAt(0) !== 'a' ? key.charAt(0) : ''}-${obj.desktop[key]}`;
            }
        });
    }
    else if (Number(obj.desktop.all) !== 0) {
        marginPropsStr += `m-${obj.desktop.all}`;
    }
    return trim(marginPropsStr);
};
const createPaddingClassProperty = (obj) => {
    let paddingPropsStr = '';
    if (!obj.desktop)
        return paddingPropsStr;
    if (obj.advanced) {
        Object.keys(obj.desktop).forEach((key) => {
            if (Number(obj.desktop[key]) !== 0) {
                paddingPropsStr += ` p${key.charAt(0) !== 'a' ? key.charAt(0) : ''}-${obj.desktop[key]}`;
            }
        });
    }
    else if (Number(obj.desktop.all) !== 0) {
        paddingPropsStr += `p-${obj.desktop.all}`;
    }
    return trim(paddingPropsStr);
};
const getShadowProps = (obj) => {
    let shadowPropsStr = '';
    shadowPropsStr += `boxShadow="${obj.horizontal || 0}px ${obj.vertical || 0}px ${obj.blur || 0}px ${obj.spread || 0}px ${obj.color || `#000`}"`;
    return trim(shadowPropsStr);
};
const getWidthProps = (obj) => {
    if (obj && obj.value) {
        return `width="${obj.value}"`;
    }
    return '';
};
const getEventsRender = (events = []) => {
    let eventsPropsStr = '';
    if (events.length > 0) {
        events.forEach((event) => {
            eventsPropsStr += ` ${event.event}="{{this.${event.function}}}"`;
        });
    }
    return trim(eventsPropsStr);
};
const getPropertyName = (name) => {
    const re = /(-)(\w)/g;
    return name.replace(re, ($0, $1, $2) => $2.toUpperCase());
};
const getPropertyValue = (propertyName, obj) => {
    let val = obj[propertyName];
    if (typeof val === 'string') {
        val = transformSpecialChar(val);
        return val;
    }
    return '';
};
const transformSpecialChar = (str) => {
    // 特殊字符需要转义
    const mapKeys = Object.keys(util_1.transformCharMaps).filter((v) => str.includes(v));
    if (mapKeys.length > 0) {
        mapKeys.forEach((key) => {
            str = str.replace(new RegExp(key, 'g'), util_1.transformCharMaps[key]);
        });
    }
    return str;
};
const trim = (str) => {
    // return str.replace(/^\s+/, "").replace(/\s+$/, "");
    return str.replace(/^\s+/, '');
};
const deleteSpace = (str) => {
    return str.replace(/^\s+/, '').replace(/\s+$/, '');
};
// 将字符串双引号替换为单引号
const transformDoubleToSingle = (str) => {
    return str.replace(/\"/g, "'");
};
const firstToUpper = (str) => {
    // return str.toLowerCase().replace(/( |^)[a-z]/g,(L) => L.toUpperCase());
    return str.replace(/( |^)[a-z]/g, (L) => L.toUpperCase());
};
// 转换block区块元素
const transformBlockInData = (data) => {
    let target = {};
    const recurseFun = (element, json) => {
        let targetJson;
        const { elements = [] } = element, restAttrs = __rest(element, ["elements"]);
        if (element.type === 'document' && (0, blockUtil_1.judgeIfBlockElement)(element)) {
            // 当前元素为block根结点
            const newBlock = (0, cloneDeep_1.default)(element);
            newBlock.elements = [];
            json.elements.push(newBlock);
            const length = json.elements.length;
            targetJson = json.elements[length - 1];
        }
        else {
            let ifCommon = !(0, blockUtil_1.judgeIfBlockElement)(element); // 标记是否为不在block内的普通页面元素
            const parentBlock = (0, blockUtil_1.getBlockFromChildId)(data, element);
            if (parentBlock) {
                targetJson = json;
                if ((0, blockUtil_1.judgeIfBlockElement)(parentBlock)) {
                    ifCommon = false;
                    if (!(0, blockUtil_1.judgeIfBlockElement)(element)) {
                        // 在block内部的普通页面元素
                        json.elements.push(Object.assign(Object.assign({}, restAttrs), { for: parentBlock.name, elements: [] }));
                        const length = json.elements.length;
                        targetJson = json.elements[length - 1];
                    }
                }
            }
            if (ifCommon) {
                if (!json.elements) {
                    json.elements = [];
                    Object.keys(restAttrs).forEach((key) => {
                        json[key] = restAttrs[key];
                    });
                    targetJson = json;
                }
                else {
                    json.elements.push(Object.assign(Object.assign({}, restAttrs), { elements: [] }));
                    const length = json.elements.length;
                    targetJson = json.elements[length - 1];
                }
            }
        }
        elements.forEach((item) => {
            recurseFun(item, targetJson);
        });
    };
    recurseFun((0, cloneDeep_1.default)(data), target);
    return target;
};
// 对json二次处理，每层data外套一层Col
const addRowColInData = (data) => {
    let target = {};
    const recurseFun = (element, json) => {
        var _a, _b, _c, _d, _e;
        const { elements = [] } = element, restAttrs = __rest(element, ["elements"]);
        let targetJson;
        if (element.type === 'document' && element.path.length <= 1) {
            // 最外层doucument内加一层Row
            const row = {
                type: 'row',
                elements: [],
            };
            json.elements = [row];
            Object.keys(restAttrs).forEach((key) => {
                json[key] = restAttrs[key];
            });
            targetJson = json.elements[0];
        }
        else {
            // 其他所有组件(tableCell除外)外侧需要加一层Col
            if (!json.elements) {
                json.elements = [];
            }
            if (['headerCell', 'rowCell', 'button'].includes(element.type)) {
                (_b = (_a = element.data) === null || _a === void 0 ? void 0 : _a.settings) === null || _b === void 0 ? true : delete _b.cols;
                json.elements.push(element);
            }
            else if (element.type === 'if') {
                // if容器不需要添加
                targetJson = json;
            }
            else if ((_d = (_c = element.data) === null || _c === void 0 ? void 0 : _c.componentSettings) === null || _d === void 0 ? void 0 : _d.currentCondition) {
                // if内分支容器不需要添加Col
                json.elements.push(Object.assign(Object.assign({}, restAttrs), { elements: [] }));
                const length = json.elements.length;
                targetJson = json.elements[length - 1];
            }
            else {
                const { cols = util_1.defaultCols } = ((_e = element.data) === null || _e === void 0 ? void 0 : _e.settings) || {};
                const col = {
                    type: 'col',
                    data: { settings: { cols } },
                    elements: [
                        Object.assign(Object.assign({}, restAttrs), { elements: [] }),
                    ],
                };
                json.elements.push(col);
                const length = json.elements.length;
                targetJson = json.elements[length - 1].elements[0];
            }
        }
        elements.forEach((item, childIndex) => {
            var _a, _b, _c, _d;
            if (targetJson) {
                const child = (0, cloneDeep_1.default)(item);
                if (element.type === 'if') {
                    // if条件控件将属性放至child
                    child.data.componentSettings.currentCondition = (_b = (_a = element.data) === null || _a === void 0 ? void 0 : _a.componentSettings) === null || _b === void 0 ? void 0 : _b.currentCondition;
                    if (childIndex === 0) {
                        child.data.componentSettings['c-if'] = (_d = (_c = element.data) === null || _c === void 0 ? void 0 : _c.componentSettings) === null || _d === void 0 ? void 0 : _d.condition;
                    }
                    else {
                        child.data.componentSettings['c-else'] = true;
                    }
                }
                recurseFun(child, targetJson);
            }
        });
    };
    recurseFun((0, cloneDeep_1.default)(data), target);
    return target;
};
const jsonToxml = (json, ignoreBlock = false) => {
    settings = Object.assign(Object.assign({}, defaultSettings), { ignoreBlock });
    const handleBlockData = ignoreBlock ? json : transformBlockInData(json);
    const newData = addRowColInData(handleBlockData);
    // return convertToXml(newData, 0);
    return (0, formatXml_1.default)(convertToXml(newData, 0));
};
exports.jsonToxml = jsonToxml;
