"use strict";
var __cov_r87ZZ8YznXkxn6igoR4SYw = (Function('return this'))();
if (!__cov_r87ZZ8YznXkxn6igoR4SYw.global.__coverage__) { __cov_r87ZZ8YznXkxn6igoR4SYw.global.__coverage__ = {}; }
__cov_r87ZZ8YznXkxn6igoR4SYw = __cov_r87ZZ8YznXkxn6igoR4SYw.global.__coverage__;
if (!(__cov_r87ZZ8YznXkxn6igoR4SYw['/Users/levsun/Documents/svgo/lib/svgo/svg2js.js'])) {
   __cov_r87ZZ8YznXkxn6igoR4SYw['/Users/levsun/Documents/svgo/lib/svgo/svg2js.js'] = {"path":"/Users/levsun/Documents/svgo/lib/svgo/svg2js.js","s":{"1":0,"2":0,"3":0,"4":0,"5":1,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0},"b":{"1":[0,0],"2":[0,0]},"f":{"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0},"fnMap":{"1":{"name":"(anonymous_1)","line":21,"loc":{"start":{"line":21,"column":17},"end":{"line":21,"column":42}}},"2":{"name":"pushToContent","line":28,"loc":{"start":{"line":28,"column":4},"end":{"line":28,"column":36}}},"3":{"name":"(anonymous_3)","line":38,"loc":{"start":{"line":38,"column":20},"end":{"line":38,"column":38}}},"4":{"name":"(anonymous_4)","line":46,"loc":{"start":{"line":46,"column":34},"end":{"line":46,"column":49}}},"5":{"name":"(anonymous_5)","line":54,"loc":{"start":{"line":54,"column":20},"end":{"line":54,"column":38}}},"6":{"name":"(anonymous_6)","line":62,"loc":{"start":{"line":62,"column":18},"end":{"line":62,"column":34}}},"7":{"name":"(anonymous_7)","line":70,"loc":{"start":{"line":70,"column":20},"end":{"line":70,"column":35}}},"8":{"name":"(anonymous_8)","line":98,"loc":{"start":{"line":98,"column":17},"end":{"line":98,"column":32}}},"9":{"name":"(anonymous_9)","line":106,"loc":{"start":{"line":106,"column":21},"end":{"line":106,"column":32}}},"10":{"name":"(anonymous_10)","line":113,"loc":{"start":{"line":113,"column":18},"end":{"line":113,"column":30}}},"11":{"name":"(anonymous_11)","line":125,"loc":{"start":{"line":125,"column":16},"end":{"line":125,"column":27}}}},"statementMap":{"1":{"start":{"line":3,"column":0},"end":{"line":4,"column":31}},"2":{"start":{"line":6,"column":0},"end":{"line":13,"column":2}},"3":{"start":{"line":21,"column":0},"end":{"line":133,"column":2}},"4":{"start":{"line":23,"column":4},"end":{"line":26,"column":19}},"5":{"start":{"line":28,"column":4},"end":{"line":36,"column":5}},"6":{"start":{"line":30,"column":8},"end":{"line":30,"column":37}},"7":{"start":{"line":32,"column":8},"end":{"line":32,"column":64}},"8":{"start":{"line":34,"column":8},"end":{"line":34,"column":23}},"9":{"start":{"line":38,"column":4},"end":{"line":44,"column":6}},"10":{"start":{"line":40,"column":8},"end":{"line":42,"column":11}},"11":{"start":{"line":46,"column":4},"end":{"line":52,"column":6}},"12":{"start":{"line":48,"column":8},"end":{"line":50,"column":11}},"13":{"start":{"line":54,"column":4},"end":{"line":60,"column":6}},"14":{"start":{"line":56,"column":8},"end":{"line":58,"column":11}},"15":{"start":{"line":62,"column":4},"end":{"line":68,"column":6}},"16":{"start":{"line":64,"column":8},"end":{"line":66,"column":11}},"17":{"start":{"line":70,"column":4},"end":{"line":96,"column":6}},"18":{"start":{"line":72,"column":8},"end":{"line":76,"column":10}},"19":{"start":{"line":78,"column":8},"end":{"line":89,"column":9}},"20":{"start":{"line":79,"column":12},"end":{"line":79,"column":28}},"21":{"start":{"line":81,"column":12},"end":{"line":88,"column":13}},"22":{"start":{"line":82,"column":16},"end":{"line":87,"column":18}},"23":{"start":{"line":91,"column":8},"end":{"line":91,"column":35}},"24":{"start":{"line":92,"column":8},"end":{"line":92,"column":23}},"25":{"start":{"line":94,"column":8},"end":{"line":94,"column":25}},"26":{"start":{"line":98,"column":4},"end":{"line":104,"column":6}},"27":{"start":{"line":100,"column":8},"end":{"line":102,"column":11}},"28":{"start":{"line":106,"column":4},"end":{"line":111,"column":6}},"29":{"start":{"line":108,"column":8},"end":{"line":108,"column":20}},"30":{"start":{"line":109,"column":8},"end":{"line":109,"column":42}},"31":{"start":{"line":113,"column":4},"end":{"line":123,"column":6}},"32":{"start":{"line":118,"column":8},"end":{"line":118,"column":26}},"33":{"start":{"line":120,"column":8},"end":{"line":120,"column":39}},"34":{"start":{"line":121,"column":8},"end":{"line":121,"column":35}},"35":{"start":{"line":125,"column":4},"end":{"line":129,"column":6}},"36":{"start":{"line":127,"column":8},"end":{"line":127,"column":23}},"37":{"start":{"line":131,"column":4},"end":{"line":131,"column":28}}},"branchMap":{"1":{"line":32,"type":"binary-expr","locations":[{"start":{"line":32,"column":27},"end":{"line":32,"column":42}},{"start":{"line":32,"column":46},"end":{"line":32,"column":48}}]},"2":{"line":78,"type":"if","locations":[{"start":{"line":78,"column":8},"end":{"line":78,"column":8}},{"start":{"line":78,"column":8},"end":{"line":78,"column":8}}]}}};
}
__cov_r87ZZ8YznXkxn6igoR4SYw = __cov_r87ZZ8YznXkxn6igoR4SYw['/Users/levsun/Documents/svgo/lib/svgo/svg2js.js'];
__cov_r87ZZ8YznXkxn6igoR4SYw.s['1']++;
var SAX = require('sax'), JSAPI = require('./jsAPI');
__cov_r87ZZ8YznXkxn6igoR4SYw.s['2']++;
var config = {
        strict: true,
        trim: true,
        normalize: true,
        lowercase: true,
        xmlns: true,
        position: false
    };
__cov_r87ZZ8YznXkxn6igoR4SYw.s['3']++;
module.exports = function (data, callback) {
    __cov_r87ZZ8YznXkxn6igoR4SYw.f['1']++;
    __cov_r87ZZ8YznXkxn6igoR4SYw.s['4']++;
    var sax = SAX.parser(config.strict, config), root = {}, current = root, stack = [];
    function pushToContent(content) {
        __cov_r87ZZ8YznXkxn6igoR4SYw.f['2']++;
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['6']++;
        content = new JSAPI(content);
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['7']++;
        (current.content = (__cov_r87ZZ8YznXkxn6igoR4SYw.b['1'][0]++, current.content) || (__cov_r87ZZ8YznXkxn6igoR4SYw.b['1'][1]++, [])).push(content);
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['8']++;
        return content;
    }
    __cov_r87ZZ8YznXkxn6igoR4SYw.s['9']++;
    sax.ondoctype = function (doctype) {
        __cov_r87ZZ8YznXkxn6igoR4SYw.f['3']++;
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['10']++;
        pushToContent({ doctype: doctype });
    };
    __cov_r87ZZ8YznXkxn6igoR4SYw.s['11']++;
    sax.onprocessinginstruction = function (data) {
        __cov_r87ZZ8YznXkxn6igoR4SYw.f['4']++;
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['12']++;
        pushToContent({ processinginstruction: data });
    };
    __cov_r87ZZ8YznXkxn6igoR4SYw.s['13']++;
    sax.oncomment = function (comment) {
        __cov_r87ZZ8YznXkxn6igoR4SYw.f['5']++;
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['14']++;
        pushToContent({ comment: comment });
    };
    __cov_r87ZZ8YznXkxn6igoR4SYw.s['15']++;
    sax.oncdata = function (cdata) {
        __cov_r87ZZ8YznXkxn6igoR4SYw.f['6']++;
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['16']++;
        pushToContent({ cdata: cdata });
    };
    __cov_r87ZZ8YznXkxn6igoR4SYw.s['17']++;
    sax.onopentag = function (data) {
        __cov_r87ZZ8YznXkxn6igoR4SYw.f['7']++;
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['18']++;
        var elem = {
                elem: data.name,
                prefix: data.prefix,
                local: data.local
            };
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['19']++;
        if (Object.keys(data.attributes).length) {
            __cov_r87ZZ8YznXkxn6igoR4SYw.b['2'][0]++;
            __cov_r87ZZ8YznXkxn6igoR4SYw.s['20']++;
            elem.attrs = {};
            __cov_r87ZZ8YznXkxn6igoR4SYw.s['21']++;
            for (var name in data.attributes) {
                __cov_r87ZZ8YznXkxn6igoR4SYw.s['22']++;
                elem.attrs[name] = {
                    name: name,
                    value: data.attributes[name].value,
                    prefix: data.attributes[name].prefix,
                    local: data.attributes[name].local
                };
            }
        } else {
            __cov_r87ZZ8YznXkxn6igoR4SYw.b['2'][1]++;
        }
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['23']++;
        elem = pushToContent(elem);
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['24']++;
        current = elem;
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['25']++;
        stack.push(elem);
    };
    __cov_r87ZZ8YznXkxn6igoR4SYw.s['26']++;
    sax.ontext = function (text) {
        __cov_r87ZZ8YznXkxn6igoR4SYw.f['8']++;
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['27']++;
        pushToContent({ text: text });
    };
    __cov_r87ZZ8YznXkxn6igoR4SYw.s['28']++;
    sax.onclosetag = function () {
        __cov_r87ZZ8YznXkxn6igoR4SYw.f['9']++;
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['29']++;
        stack.pop();
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['30']++;
        current = stack[stack.length - 1];
    };
    __cov_r87ZZ8YznXkxn6igoR4SYw.s['31']++;
    sax.onerror = function (e) {
        __cov_r87ZZ8YznXkxn6igoR4SYw.f['10']++;
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['32']++;
        this.error = null;
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['33']++;
        callback({ error: e.message });
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['34']++;
        throw new Error(e.message);
    };
    __cov_r87ZZ8YznXkxn6igoR4SYw.s['35']++;
    sax.onend = function () {
        __cov_r87ZZ8YznXkxn6igoR4SYw.f['11']++;
        __cov_r87ZZ8YznXkxn6igoR4SYw.s['36']++;
        callback(root);
    };
    __cov_r87ZZ8YznXkxn6igoR4SYw.s['37']++;
    sax.write(data).close();
};
