export default class InlineNode {
    constructor(arena) {
        this.arena = arena;
        this.hasParent = false;
        this.hasChildren = false;
        this.hasText = false;
        this.inline = true;
        this.single = false;
        this.attributes = {};
    }
    getHtml() {
        return this.arena.getTemplate(undefined, '', this.attributes);
    }
    getAttributesString() {
        let str = '';
        this.arena.attributes.forEach((attr) => {
            str += ` ${attr}`;
        });
        Object.entries(this.attributes).forEach(([name, value]) => {
            if (typeof value === 'boolean') {
                if (value) {
                    str += ` ${name}`;
                }
            }
            else if (typeof value === 'string') {
                const escapedValue = value.toString()
                    .replace(/&/g, '&amp;')
                    .replace(/'/g, '&apos;')
                    .replace(/"/g, '&quot;')
                    .replace(/</g, '&lt;')
                    .replace(/>/g, '&gt;');
                str += ` ${name}="${escapedValue}"`;
            }
        });
        return str;
    }
    getTags() {
        const attrs = this.getAttributesString();
        const tag = this.arena.tag.toLowerCase();
        return [`<${tag.toLowerCase()}${attrs}>`, `</${tag.toLowerCase()}>`];
    }
    getOutputHtml() {
        return this.arena.getOutputTemplate('', this.attributes);
    }
    setAttribute(name, value) {
        this.attributes[name] = value;
    }
    getAttribute(name) {
        return this.attributes[name] || '';
    }
    clone() {
        const newNode = new InlineNode(this.arena);
        Object.entries(this.attributes).forEach(([name, value]) => {
            newNode.setAttribute(name, value);
        });
        return newNode;
    }
}
//# sourceMappingURL=InlineNode.js.map