/* esm.sh - @iconify/utils@3.1.7/lib/svg/build */
import{defaultIconProps as y}from"../icon/defaults.mjs";import{defaultIconCustomisations as C}from"../customisations/defaults.mjs";import{calculateSize as b}from"./size.mjs";import{wrapSVGContent as I}from"./defs.mjs";var V=s=>s==="unset"||s==="undefined"||s==="none";function H(s,x){let n={...y,...s},g={...C,...x},t={left:n.left,top:n.top,width:n.width,height:n.height},u=n.body;[n,g].forEach(r=>{let o=[],F=r.hFlip,S=r.vFlip,e=r.rotate;F?S?e+=2:(o.push("translate("+(t.width+t.left).toString()+" "+(0-t.top).toString()+")"),o.push("scale(-1 1)"),t.top=t.left=0):S&&(o.push("translate("+(0-t.left).toString()+" "+(t.height+t.top).toString()+")"),o.push("scale(1 -1)"),t.top=t.left=0);let i;switch(e<0&&(e-=Math.floor(e/4)*4),e=e%4,e){case 1:i=t.height/2+t.top,o.unshift("rotate(90 "+i.toString()+" "+i.toString()+")");break;case 2:o.unshift("rotate(180 "+(t.width/2+t.left).toString()+" "+(t.height/2+t.top).toString()+")");break;case 3:i=t.width/2+t.left,o.unshift("rotate(-90 "+i.toString()+" "+i.toString()+")")}e%2===1&&(t.left!==t.top&&(i=t.left,t.left=t.top,t.top=i),t.width!==t.height&&(i=t.width,t.width=t.height,t.height=i)),o.length&&(u=I(u,'<g transform="'+o.join(" ")+'">',"</g>"))});let p=g.width,h=g.height,f=t.width,l=t.height,a,c;p===null?(c=h===null?"1em":h==="auto"?l:h,a=b(c,f/l)):(a=p==="auto"?f:p,c=h===null?b(a,l/f):h==="auto"?l:h);let d={},w=(r,o)=>{V(o)||(d[r]=o.toString())};w("width",a),w("height",c);let m=[t.left,t.top,f,l];return d.viewBox=m.join(" "),{attributes:d,viewBox:m,body:u}}export{H as iconToSVG,V as isUnsetKeyword};
//# sourceMappingURL=build.mjs.map