"use strict";
exports.__esModule = true;
exports.default = void 0;
var _xmldoc = require("xmldoc");
var _variableType = require("./helpers/variableType");
/**
* Strip unit postfix, parse number, but return undefined instead of NaN for bad input
*
* @param {string} textVal
* @returns {?number}
*/
const stripUnits = textVal => {
let n = parseFloat(textVal);
if (typeof n !== 'number' || isNaN(n)) {
return undefined;
}
return n;
};
/**
* Make sure it's valid XML and the root tag is , returns xmldoc DOM
*
* @param {string} svgString
* @returns {object}
*/
const parseSVG = svgString => {
let doc;
try {
doc = new _xmldoc.XmlDocument(svgString);
} catch (error) {
throw new Error('Invalid svg document (' + error + ')', {
cause: error
});
}
if (doc.name !== "svg") {
throw new Error('Invalid svg document (expected