!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.TinySVG={})}(this,function(e){"use strict";function r(e,t){if(e.ownerDocument!==t.ownerDocument)try{return t.ownerDocument.importNode(e,!0)}catch(e){}return e}function a(e,t){return t.appendChild(r(e,t))}var o=2,s={"alignment-baseline":1,"baseline-shift":1,clip:1,"clip-path":1,"clip-rule":1,color:1,"color-interpolation":1,"color-interpolation-filters":1,"color-profile":1,"color-rendering":1,cursor:1,direction:1,display:1,"dominant-baseline":1,"enable-background":1,fill:1,"fill-opacity":1,"fill-rule":1,filter:1,"flood-color":1,"flood-opacity":1,font:1,"font-family":1,"font-size":o,"font-size-adjust":1,"font-stretch":1,"font-style":1,"font-variant":1,"font-weight":1,"glyph-orientation-horizontal":1,"glyph-orientation-vertical":1,"image-rendering":1,kerning:1,"letter-spacing":1,"lighting-color":1,marker:1,"marker-end":1,"marker-mid":1,"marker-start":1,mask:1,opacity:1,overflow:1,"pointer-events":1,"shape-rendering":1,"stop-color":1,"stop-opacity":1,stroke:1,"stroke-dasharray":1,"stroke-dashoffset":1,"stroke-linecap":1,"stroke-linejoin":1,"stroke-miterlimit":1,"stroke-opacity":1,"stroke-width":o,"text-anchor":1,"text-decoration":1,"text-rendering":1,"unicode-bidi":1,visibility:1,"word-spacing":1,"writing-mode":1};function c(e,t,r){var n=t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase(),i=s[n];i?(i===o&&"number"==typeof r&&(r=String(r)+"px"),e.style[n]=r):e.setAttributeNS(null,t,r)}function n(e,t,r){if("string"==typeof t){if(void 0===r)return n=e,s[i=t]?n.style[i]:n.getAttributeNS(null,i);c(e,t,r)}else!function(e,t){var r,n,i=Object.keys(t);for(r=0;n=i[r];r++)c(e,n,t[n])}(e,t);var n,i;return e}function i(e,t){if(e.indexOf)return e.indexOf(t);for(var r=0;r"+e+"",t=!0);var r,n,i=(r=e,(n=new DOMParser).async=!1,n.parseFromString(r,"text/xml"));if(!t)return i;for(var o=document.createDocumentFragment(),a=i.firstChild;a.firstChild;)o.appendChild(a.firstChild);return o}function v(e,t){var r;return r="<"===e.charAt(0)?(r=g(e).firstChild,document.importNode(r,!0)):document.createElementNS(d.svg,e),t&&n(r,t),r}var y=v("svg");function b(e,t){var r,n,i=Object.keys(t);for(r=0;n=i[r];r++)e[n]=t[n];return e}var w=/([&<>]{1})/g,x=/([\n\r"]{1})/g,k={"&":"&","<":"<",">":">",'"':"'"};function N(e,t){return e.replace(t,function(e,t){return k[t]||t})}function S(e,t){var r,n,i,o,a;switch(e.nodeType){case 3:t.push(N(e.textContent,w));break;case 1:if(t.push("<",e.tagName),e.hasAttributes())for(r=0,n=(i=e.attributes).length;r"),r=0,n=(a=e.childNodes).length;r")}else t.push("/>");break;case 8:t.push("\x3c!--",N(e.nodeValue,w),"--\x3e");break;case 4:t.push("");break;default:throw new Error("unable to handle node "+e.nodeType)}return t}function C(e,t){var r=g(t);if(p(e),t){"#document-fragment"!==r.nodeName&&(r=r.documentElement);for(var n,i=(n=r.childNodes,Array.prototype.slice.call(n)),o=0;o