PageSourceSearch

https://svgmaker.io/_next/static/chunks/92289-fc80f2bee980666a.js

js svgmaker.io collected 2026-09-24 12:09:51 UTC 64,868 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[92289],{30387:(e,t,r)=>{r.d(t,{Am:()=>n,CD:()=>p,Lz:()=>s,Rb:()=>m,WN:()=>d,qC:()=>i,t$:()=>l,tN:()=>c,xD:()=>u});let n={};async function a(){try{let e=await fetch("/images/broken-placeholder.svg");if(!e.ok)throw Error("Failed to fetch broken placeholder: ".concat(e.status));return await e.text()}catch(e){return console.error("Error fetching broken placeholder:",e),'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><text x="12" y="12" text-anchor="middle">Error</text></svg>'}}async function o(){try{let e=await fetch("/images/unauthenticated-placeholder.svg");if(!e.ok)throw Error("Failed to fetch unauthenticated placeholder: ".concat(e.status));return await e.text()}catch(e){return console.error("Error fetching unauthenticated placeholder:",e),'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><text x="12" y="12" text-anchor="middle">Auth Required</text></svg>'}}async function i(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="generation-".concat(e);if(!t&&n[r])return n[r];try{let t=await fetch("/images/generated/".concat(e,"?mode=raw"),{headers:{Accept:"image/svg+xml,*/*"},cache:"no-store",credentials:"include"});if(!t.ok){if(401===t.status||403===t.status)return console.warn("Authentication or authorization error fetching SVG"),await o();throw Error("Failed to fetch SVG: ".concat(t.status," ").concat(t.statusText))}let a=await t.text();return n[r]=a,a}catch(e){return console.error("Error in fetchSvgContent:",e),await a()}}function s(e){let t=encodeURIComponent(e);return"data:image/svg+xml;charset=UTF-8,".concat(t)}function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"svgmaker";return t.includes(e)?t:"".concat(t,"-").concat(e)}function l(e){let t=new Blob([e],{type:"image/svg+xml"});return URL.createObjectURL(t)}function d(e,t){let r=URL.createObjectURL(e),n=document.createElement("a");n.href=r,n.download=t,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(r)}function m(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"svgmaker-editor";d(new Blob([e],{type:"image/svg+xml"}),"".concat(t,".svg"))}async function u(e){if(function(){try{return"ClipboardItem"in window&&"supports"in window.ClipboardItem&&window.ClipboardItem.supports("image/svg+xml")}catch(e){return!1}}())try{let t=new Blob([e],{type:"image/svg+xml"});return await navigator.clipboard.write([new window.ClipboardItem({"image/svg+xml":t})]),{success:!0,asImage:!0}}catch(e){console.warn("Failed to copy SVG as image, falling back to text:",e)}try{await navigator.clipboard.writeText(e);let t=!function(){let e=navigator.userAgent.toLowerCase();return e.includes("safari")&&!e.includes("chrome")&&!e.includes("firefox")}()?"SVG copied as text":"SVG copied as text (Safari limitation)";return{success:!0,asImage:!1,message:t}}catch(e){throw console.error("Failed to copy SVG:",e),Error("Failed to copy SVG to clipboard.")}}function p(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((r,n)=>{let{quality:a=.9,maxWidth:o=1024,maxHeight:i=1024}=t,s=new Image,c=new Blob([e],{type:"image/svg+xml;charset=utf-8"}),l=URL.createObjectURL(c);s.onload=()=>{let e=s.width,t=s.height;e>o&&(t=t*o/e,e=o),t>i&&(e=e*i/t,t=i);let c=document.createElement("canvas");c.width=e,c.height=t;let d=c.getContext("2d");if(!d)return URL.revokeObjectURL(l),n(Error("Failed to get canvas context"));d.drawImage(s,0,0,e,t),c.toBlob(a=>{URL.revokeObjectURL(l),a?r({blob:a,width:e,height:t}):n(Error("Canvas toBlob returned null"))},"image/webp",a)},s.onerror=()=>{URL.revokeObjectURL(l),n(Error("Failed to load SVG into image element"))},s.src=l})}},41856:(e,t,r)=>{function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8";if(!e||"string"!=typeof e)return console.error("encodeSvgToDataUrl: Invalid SVG text provided"),"";try{if("base64"===t){let t=btoa(unescape(encodeURIComponent(e)));return"data:image/svg+xml;base64,".concat(t)}{let t=encodeURIComponent(e);return"data:image/svg+xml;charset=UTF-8,".concat(t)}}catch(e){return console.error("encodeSvgToDataUrl: Error encoding SVG:",e),""}}function a(e){if(!e||"string"!=typeof e)return console.error("decodeSvgDataUrl: Invalid data URL provided"),null;if(!e.startsWith("data:image/svg+xml"))return console.warn("decodeSvgDataUrl: Not an SVG data URL"),null;try{let t=e.match(/^data:image\/svg\+xml;base64,(.+)$/);if(t)try{return atob(t[1])}catch(e){return console.error("decodeSvgDataUrl: Failed to decode base64:",e),null}let r=e.match(/^data:image\/svg\+xml;charset=UTF-8,(.+)$/i);if(r)try{return decodeURIComponent(r[1])}catch(e){return console.error("decodeSvgDataUrl: Failed to decode URI component:",e),null}let n=e.match(/^data:image\/svg\+xml,(.+)$/);if(n)try{return decodeURIComponent(n[1])}catch(e){return console.error("decodeSvgDataUrl: Failed to decode URI component:",e),null}let a=e.indexOf(",");if(-1!==a){let t=e.substring(a+1);try{return decodeURIComponent(t)}catch(e){try{return atob(t)}catch(e){return console.warn("decodeSvgDataUrl: Failed to decode content after comma"),null}}}return console.warn("decodeSvgDataUrl: Unable to extract SVG content from data URL"),null}catch(e){return console.error("decodeSvgDataUrl: Unexpected error during decoding:",e),null}}function o(e){if(!e||"string"!=typeof e)return console.error("ensureDataUrl: Invalid content provided"),"";if(e.startsWith("data:"))return e;if(e.trim().startsWith("<svg")||e.trim().startsWith("<?xml"))return n(e);let t=Math.min(e.length,100);return/^[A-Za-z0-9+/]*={0,2}$/.test(e.substring(0,t))?"data:image/svg+xml;base64,".concat(e):(console.warn("ensureDataUrl: Content does not appear to be SVG or base64, encoding as UTF-8"),n(e))}async function i(e){if(!e||"string"!=typeof e)return console.error("generateMinifiedDataUri: Invalid SVG text provided"),"";try{let t=await fetch("/api/optimize-svg",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({svgText:e})});if(!t.ok)throw Error("Failed to optimize SVG");let{optimizedSvgText:r}=await t.json();return n(r,"utf8")}catch(t){return console.error("generateMinifiedDataUri: Error optimizing/encoding SVG:",t),n(e,"utf8")}}function s(e){return e&&"string"==typeof e?n(e,"base64"):(console.error("generateBase64DataUri: Invalid SVG text provided"),"")}function c(e){return e&&"string"==typeof e?n(e,"utf8"):(console.error("generateEncodedDataUri: Invalid SVG text provided"),"")}r.d(t,{I:()=>c,Ph:()=>i,Tl:()=>s,UF:()=>o,V5:()=>n,mC:()=>a})},47261:(e,t,r)=>{async function n(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((n,a)=>{let o;if(!e||"string"!=typeof e)return void a(Error("Invalid SVG text: must be a non-empty string"));if(!window.Image)return void a(Error("Image conversion requires a browser environment"));let i=new window.Image;
1try{o="data:image/svg+xml;base64,".concat(btoa(unescape(encodeURIComponent(e))))}catch(e){a(Error("Failed to encode SVG: ".concat(e instanceof Error?e.message:"Unknown error")));return}i.onload=()=>{try{var e;let o=r.width||i.naturalWidth||1024,s=r.height||i.naturalHeight||1024;if(o<=0||s<=0)return void a(Error("Invalid dimensions: width and height must be positive"));let c=document.createElement("canvas");c.width=o,c.height=s;let l=c.getContext("2d");if(!l)return void a(Error("Failed to get canvas 2D context"));l.drawImage(i,0,0,o,s);let d={png:"image/png",jpg:"image/jpeg",webp:"image/webp",bmp:"image/png"}[t],m=(e=r.quality,"png"===t||"bmp"===t?"bmp"===t?1:void 0:void 0!==e?Math.max(0,Math.min(1,e)):({jpg:.92,webp:.9})[t]);c.toBlob(e=>{e?n({blob:e,width:o,height:s}):a(Error("Failed to create ".concat(t.toUpperCase()," blob from canvas")))},d,m)}catch(e){a(Error("Canvas operation failed: ".concat(e instanceof Error?e.message:"Unknown error")))}},i.onerror=()=>{a(Error("Failed to load SVG image for ".concat(t.toUpperCase()," conversion")))},i.src=o})}async function a(e,t){return n(e,"webp",t)}r.d(t,{_m:()=>n,rV:()=>a})},58752:(e,t,r)=>{r.d(t,{s:()=>a});var n=r(95155);let a=r(12115).forwardRef((e,t)=>{let{children:r,...a}=e;return(0,n.jsx)("span",{ref:t,...a,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...a.style},children:r})});a.displayName="VisuallyHidden"},92289:(e,t,r)=>{r.d(t,{F:()=>ev});var n=r(95155),a=r(12115),o=r(51834),i=r(58752),s=r(85626),c=r(25998),l=r(97950),d=r(95510),m=r(20063),u=r(71229);let p=(0,n.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",className:"w-5 h-5 mr-2",children:(0,n.jsx)("path",{d:"M5.75 3C4.24011 3 3 4.24011 3 5.75V18.25C3 18.983 3.29406 19.6507 3.76758 20.1455C3.83626 20.2508 3.93028 20.3371 4.04102 20.3965C4.51172 20.7729 5.10556 21 5.75 21H18.25C19.7599 21 21 19.7599 21 18.25V5.75C21 4.24011 19.7599 3 18.25 3H5.75ZM5.75 4.5H18.25C18.9491 4.5 19.5 5.05089 19.5 5.75V18.25C19.5 18.3479 19.4863 18.4422 19.4658 18.5332L13.5908 12.6592C13.1546 12.223 12.5774 12.0049 12 12.0049C11.4226 12.0049 10.8444 12.223 10.4082 12.6592L4.53418 18.5332C4.51367 18.4422 4.5 18.3479 4.5 18.25V5.75C4.5 5.05089 5.05089 4.5 5.75 4.5ZM15.25 6.5C14.5625 6.5 13.9519 6.78482 13.5645 7.2207C13.177 7.65659 13 8.20833 13 8.75C13 9.29167 13.177 9.84341 13.5645 10.2793C13.9519 10.7152 14.5625 11 15.25 11C15.9375 11 16.5481 10.7152 16.9355 10.2793C17.323 9.84341 17.5 9.29167 17.5 8.75C17.5 8.20833 17.323 7.65659 16.9355 7.2207C16.5481 6.78482 15.9375 6.5 15.25 6.5ZM15.25 8C15.5625 8 15.7019 8.09018 15.8145 8.2168C15.927 8.34341 16 8.54167 16 8.75C16 8.95833 15.927 9.15659 15.8145 9.2832C15.7019 9.40982 15.5625 9.5 15.25 9.5C14.9375 9.5 14.7981 9.40982 14.6855 9.2832C14.573 9.15659 14.5 8.95833 14.5 8.75C14.5 8.54167 14.573 8.34341 14.6855 8.2168C14.7981 8.09018 14.9375 8 15.25 8ZM12 13.4951C12.1902 13.4951 12.3805 13.5699 12.5303 13.7197L18.3047 19.4941C18.2861 19.4949 18.2688 19.5 18.25 19.5H5.75C5.7309 19.5 5.7132 19.495 5.69434 19.4941L11.4697 13.7197C11.6195 13.5699 11.8098 13.4951 12 13.4951Z"})}),g=(0,n.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",className:"w-5 h-5 mr-2",children:(0,n.jsx)("path",{d:"M10.75 5C10.0682 5 9.5 5.5682 9.5 6.25V6.5H3.83008C3.68823 6.20095 3.46448 5.94827 3.1848 5.77126C2.90512 5.59426 2.58098 5.5002 2.25 5.5C2.02019 5.5 1.79262 5.54526 1.5803 5.63321C1.36798 5.72116 1.17507 5.85006 1.01256 6.01256C0.850061 6.17507 0.721157 6.36798 0.633211 6.5803C0.545265 6.79262 0.5 7.02019 0.5 7.25C0.5 7.47981 0.545265 7.70738 0.633211 7.9197C0.721157 8.13202 0.850061 8.32493 1.01256 8.48744C1.17507 8.64994 1.36798 8.77884 1.5803 8.86679C1.79262 8.95473 2.02019 9 2.25 9C2.58082 8.99961 2.90475 8.90547 3.18424 8.72848C3.46373 8.55148 3.68732 8.2989 3.8291 8H7.03223C4.73368 9.52675 3.18245 12.08 3.02148 15H2.75C2.0682 15 1.5 15.5682 1.5 16.25V18.25C1.5 18.9318 2.0682 19.5 2.75 19.5H4.75C5.4318 19.5 6 18.9318 6 18.25V16.25C6 15.5682 5.4318 15 4.75 15H4.52148C4.72229 11.9482 6.73912 9.40632 9.5 8.43066V8.75C9.5 9.4318 10.0682 10 10.75 10H13.25C13.9318 10 14.5 9.4318 14.5 8.75V8.43359C17.2602 9.40943 19.2777 11.949 19.4785 15H19.25C18.5682 15 18 15.5682 18 16.25V18.25C18 18.9318 18.5682 19.5 19.25 19.5H21.25C21.9318 19.5 22.5 18.9318 22.5 18.25V16.25C22.5 15.5682 21.9318 15 21.25 15H20.9844C20.8217 12.0711 19.2419 9.52499 16.9297 8H20.1699C20.3118 8.29905 20.5355 8.55173 20.8152 8.72874C21.0949 8.90574 21.419 8.9998 21.75 9C21.9798 9 22.2074 8.95473 22.4197 8.86679C22.632 8.77884 22.8249 8.64994 22.9874 8.48744C23.1499 8.32493 23.2788 8.13202 23.3668 7.9197C23.4547 7.70738 23.5 7.47981 23.5 7.25C23.5 7.02019 23.4547 6.79262 23.3668 6.5803C23.2788 6.36798 23.1499 6.17507 22.9874 6.01256C22.8249 5.85006 22.632 5.72116 22.4197 5.63321C22.2074 5.54526 21.9798 5.5 21.75 5.5C21.4192 5.50039 21.0953 5.59453 20.8158 5.77152C20.5363 5.94852 20.3127 6.2011 20.1709 6.5H14.5V6.25C14.5 5.5682 13.9318 5 13.25 5H10.75ZM11 6.5H13V7.13574C12.9882 7.21179 12.9882 7.28919 13 7.36523V8.5H11V7.37305C11.0132 7.29253 11.0132 7.2104 11 7.12988V6.5ZM3 16.5H4.5V18H3V16.5ZM19.5 16.5H21V18H19.5V16.5Z"})}),h=(0,n.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2",children:[(0,n.jsx)("path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}),(0,n.jsx)("polyline",{points:"7,10 12,15 17,10"}),(0,n.jsx)("line",{x1:"12",x2:"12",y1:"15",y2:"3"})]}),f=(0,n.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-5 h-5 mr-2",children:(0,n.jsx)("path",{d:"M3 3h4v4H3zM9 3h4v4H9zM15 3h4v4h-4zM3 9h4v4H3zM9 9h4v4H9zM15 9h4v4h-4zM3 15h4v4H3zM9 15h4v4H9zM15 15h4v4h-4z"})}),x=(0,n.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5 mr-2",children:[(0,n.jsx)("path",{d:"M21 12C21 16.9706 16.9706 21 12 21C7.02944 21 3 16.9706 3 12C3 7.02944 7.02944 3 12 3",strokeLinecap:"round"}),(0,n.jsx)("path",{d:"M19 12C19 15.866 15.866 19 12 19C8.13401 19 5 15.866 5 12C5 8.13401 8.13401 5 12 5",strokeLinecap:"round"}),(0,n.jsx)("path",{d:"M16 12C16 14.2091 14.2091 16 12 16C9.79086 16 8 14.2091 8 12C8 9.79086 9.79086 8 12 8",strokeLinecap:"round"}),(0,n.jsx)("circle",{cx:"12",cy:"12",r:"1",fill:"currentColor"}),(0,n.jsx)("circle",{cx:"12",cy:"3",r:"1",fill:"currentColor"})]}),b=(0,n.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-5 h-5 mr-2",children:[(0,n.jsx)("circle",{cx:"12",cy:"12",r:"2",fill:"
1currentColor"}),(0,n.jsx)("ellipse",{cx:"12",cy:"12",rx:"7",ry:"3"}),(0,n.jsx)("ellipse",{cx:"12",cy:"12",rx:"7",ry:"3",transform:"rotate(60 12 12)"}),(0,n.jsx)("ellipse",{cx:"12",cy:"12",rx:"7",ry:"3",transform:"rotate(120 12 12)"})]}),y=(0,n.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-5 h-5 mr-2",children:[(0,n.jsx)("rect",{x:"5",y:"4",width:"14",height:"17",rx:"2"}),(0,n.jsx)("line",{x1:"9",y1:"8",x2:"15",y2:"8"}),(0,n.jsx)("line",{x1:"9",y1:"12",x2:"15",y2:"12"}),(0,n.jsx)("line",{x1:"9",y1:"16",x2:"13",y2:"16"})]}),v=(0,n.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5 mr-2",children:[(0,n.jsx)("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"}),(0,n.jsx)("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"})]}),w=(0,n.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-5 h-5 mr-2",children:[(0,n.jsx)("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"}),(0,n.jsx)("polyline",{points:"14 2 14 8 20 8"}),(0,n.jsx)("line",{x1:"9",y1:"13",x2:"15",y2:"13"}),(0,n.jsx)("line",{x1:"9",y1:"17",x2:"15",y2:"17"})]}),j=(0,n.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2",children:[(0,n.jsx)("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}),(0,n.jsx)("path",{d:"m4 16c-1.1 0-2-.9-2-2V6c0-1.1.9-2 2-2h8c1.1 0 2 .9 2 2"})]}),C=(0,n.jsx)("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"mr-2",children:(0,n.jsx)("path",{d:"M20 6L9 17l-5-5"})});var S=r(30387),k=r(47261),N=r(18720);function F(e){try{let t=new DOMParser().parseFromString(e,"image/svg+xml").querySelector("svg");if(!t)return{width:512,height:512,aspectRatio:1};let r=t.getAttribute("width"),n=t.getAttribute("height");if(r&&n){let e=parseFloat(r),t=parseFloat(n);if(!isNaN(e)&&!isNaN(t)&&e>0&&t>0)return{width:e,height:t,aspectRatio:e/t}}let a=t.getAttribute("viewBox");if(a){let e=a.split(/\s+/);if(4===e.length){let t=parseFloat(e[2]),r=parseFloat(e[3]);if(!isNaN(t)&&!isNaN(r)&&t>0&&r>0)return{width:t,height:r,aspectRatio:t/r}}}return{width:512,height:512,aspectRatio:1}}catch(e){return{width:512,height:512,aspectRatio:1}}}var R=r(41856),V=r(43322),E=r(42228);let M={class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","stroke-miterlimit":"strokeMiterlimit","stroke-dasharray":"strokeDasharray","stroke-dashoffset":"strokeDashoffset","fill-rule":"fillRule","fill-opacity":"fillOpacity","stroke-opacity":"strokeOpacity","clip-rule":"clipRule","clip-path":"clipPath","font-size":"fontSize","font-family":"fontFamily","font-weight":"fontWeight","font-style":"fontStyle","text-anchor":"textAnchor","text-decoration":"textDecoration","letter-spacing":"letterSpacing","word-spacing":"wordSpacing","baseline-shift":"baselineShift","dominant-baseline":"dominantBaseline","alignment-baseline":"alignmentBaseline","stop-color":"stopColor","stop-opacity":"stopOpacity","flood-color":"floodColor","flood-opacity":"floodOpacity","lighting-color":"lightingColor","marker-start":"markerStart","marker-mid":"markerMid","marker-end":"markerEnd","color-interpolation":"colorInterpolation","color-interpolation-filters":"colorInterpolationFilters","color-rendering":"colorRendering","image-rendering":"imageRendering","shape-rendering":"shapeRendering","text-rendering":"textRendering","enable-background":"enableBackground","paint-order":"paintOrder","vector-effect":"vectorEffect"},U={svg:"Svg",path:"Path",circle:"Circle",rect:"Rect",line:"Line",polygon:"Polygon",polyline:"Polyline",ellipse:"Ellipse",text:"Text",tspan:"TSpan",g:"G",defs:"Defs",linearGradient:"LinearGradient",radialGradient:"RadialGradient",stop:"Stop",clipPath:"ClipPath",mask:"Mask",use:"Use",symbol
1:"Symbol",image:"Image",pattern:"Pattern",filter:"Filter",feGaussianBlur:"FeGaussianBlur",feOffset:"FeOffset",feBlend:"FeBlend",feColorMatrix:"FeColorMatrix",feComponentTransfer:"FeComponentTransfer",feComposite:"FeComposite",feConvolveMatrix:"FeConvolveMatrix",feDiffuseLighting:"FeDiffuseLighting",feDisplacementMap:"FeDisplacementMap",feFlood:"FeFlood",feImage:"FeImage",feMerge:"FeMerge",feMorphology:"FeMorphology",feSpecularLighting:"FeSpecularLighting",feTile:"FeTile",feTurbulence:"FeTurbulence"};async function P(e){let t={multipass:!1,plugins:[{name:"preset-default",params:{overrides:{removeViewBox:!1}}},"cleanupIds","mergePaths"]};try{return(0,E.k)(e,t).data}catch(t){return console.error("SVGO optimization failed:",t),e}}function G(e,t){let r=[];for(let[t,n]of Object.entries(e)){if(t.startsWith("xmlns"))continue;if("style"===t){let e=function(e){let t=e.trim();if(!t)return"{}";let r=t.split(";").map(e=>e.trim()).filter(e=>e.length>0);if(0===r.length)return"{}";let n=[];for(let e of r){let t=e.indexOf(":");if(-1===t)continue;let r=e.slice(0,t).trim(),a=e.slice(t+1).trim();if(!r||!a)continue;let o=function(e){let t=e.match(/^-([a-z]+)-/);if(t){let r=t[1],n=r.charAt(0).toUpperCase()+r.slice(1),a=e.slice(t[0].length).replace(/-([a-z])/g,(e,t)=>t.toUpperCase());return n+a.charAt(0).toUpperCase()+a.slice(1)}return e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}(r),i=a.replace(/'/g,"\\'");n.push("".concat(o,": '").concat(i,"'"))}return 0===n.length?"{}":"{ ".concat(n.join(", ")," }")}(n);r.push("style={".concat(e,"}"));continue}let e=M[t]||t;if("true"===n||"false"===n||/^-?\d+(\.\d+)?$/.test(n)){r.push("".concat(e,"={").concat(n,"}"));continue}let a=n.replace(/"/g,'\\"');r.push("".concat(e,'="').concat(a,'"'))}return r.join(" ")}async function z(e,t){let{format:r,reactNative:n=!1,optimize:a=!0,componentName:o="SvgComponent"}=t;try{let t=e;a&&(t=await P(e));let i=await (0,V.parse)(t),s=function(e){let t=new Set;return!function e(r){r.name&&t.add(r.name),r.children&&r.children.length>0&&r.children.forEach(e)}(e),t}(i),c=n&&U[i.name]?U[i.name]:i.name,l=G(i.attributes,n),d=l?" ".concat(l):"",m=i.children?i.children.map(e=>(function e(t,r){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,a=" ".repeat(n);if("text"===t.type)return t.value||"";let o=r&&U[t.name]?U[t.name]:t.name,i=G(t.attributes,r),s=i?" ".concat(i):"";if(!t.children||0===t.children.length)return t.value?"".concat(a,"<").concat(o).concat(s,">").concat(t.value,"</").concat(o,">"):"".concat(a,"<").concat(o).concat(s," />");let c=t.children.map(t=>e(t,r,n+2));return["".concat(a,"<").concat(o).concat(s,">"),...c,"".concat(a,"</").concat(o,">")].join("\n")})(e,n,4)):[],u=function(e,t,r){let n='import * as React from "react";';if(e){let e=Array.from(t).map(e=>U[e]).filter(Boolean).filter((e,t,r)=>r.indexOf(e)===t).sort();if("tsx"===r){if(0===e.length)return"".concat(n,'\nimport { Svg, SvgProps } from "react-native-svg";');let t=[...e,"SvgProps"].sort();return"".concat(n,"\nimport { ").concat(t.join(", "),' } from "react-native-svg";')}return 0===e.length?"".concat(n,'\nimport { Svg } from "react-native-svg";'):"".concat(n,"\nimport { ").concat(e.join(", "),' } from "react-native-svg";')}return"tsx"===r?"".concat(n,'\nimport { SVGProps } from "react";'):n}(n,s,r);return{code:n?"tsx"===r?"".concat(u,"\n\nconst ").concat(o," = (props: SvgProps) => (\n  <").concat(c).concat(d," {...props}>\n").concat(m.join("\n"),"\n  </").concat(c,">\n);\n\nexport default ").concat(o,";\n"):"".concat(u,"\n\nconst ").concat(o," = (props) => (\n  <").concat(c).concat(d," {...props}>\n").concat(m.join("\n"),"\n  </").concat(c,">\n);\n\nexport default ").concat(o,";\n"):"tsx"===r?"".concat(u,"\n\nconst ").concat(o," = (props: SVGProps<SVGSVGElement>) => (\n  <").concat(c).concat(d," {...props}>\n").concat(m.join("\n"),"\n  </").concat(c,">\n);\n\nexport default ").concat(o,";\n"):"".concat(u,"\n\nconst ").concat(o," = (props) => (\n  <").concat(c).concat(d," {...props}>\n").concat(m.join("\n"),"\n  </").concat(c,">\n);\n\nexport default ").concat(o,";\n"),componentName:o,fileExtension:r}}catch(e){throw console.error("SVG to React conversion failed:",e),Error("Failed to convert SVG to React: ".concat(e instanceof Error?e.message:"Unknown error"))}}let L={plugins:[{name:"preset-default",params:{overrides:{removeViewBox:!1,cleanupIds:!1}}},"removeDoctype","removeXMLProcInst","removeComments","removeMetadata","removeEditorsNSData","cleanupAttrs","mergeStyles","inlineStyles","minifyStyles","convertStyleToAttrs","cleanupNumericValues","convertColors","removeUselessStrokeAndFill","removeUnusedNS","cleanupListOfValues","removeHiddenElems"]};async function I(e,t){let{format:r,optimize:n=!0}=t;switch(r){case"html-standalone":return await O(e,n);case"html-element":return await D(e,n);case"css-background":return await T(e,n);default:throw Error("Unsupported format: ".concat(r))}}async function O(e,t){let r=e;if(t)try{r=(0,E.k)(e,L).data}catch(t){console.error("SVG optimization failed, using original:",t),r=e}return{code:'<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta charset="UTF-8">\n  <meta name="viewport" content="width=device-width, initial-scale=1.0">\n  <title>SVG Image</title>\n  <style>\n    * {\n      margin: 0;\n      padding: 0;\n      box-sizing: border-box;\n    }\n\n    body {\n      display: flex;\n      justify-content: center;\n      align-items: center;\n      min-height: 100vh;\n      background-color: #f5f5f5;\n      font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;\n    }\n\n    svg {\n      max-width: 100%;\n      max-height: 100vh;\n      height: auto;\n      display: block;\n    }\n  </style>\n</head>\n<body>\n  '.concat(r,"\n</body>\n</html>"),fileExtension:"html"}}async function D(e,t){let r=e;if(t)try{r=(0,E.k)(e,L).data}catch(t){console.error("SVG optimization failed, using original:",t),r=e}return{code:r,fileExtension:"html"}}async function T(e,t){let r=e;if(t)try{r=(0,E.k)(e,L).data}catch(t){console.error("SVG optimization failed, using original:",t),r=e}let n=(0,R.V5)(r,"utf8");
1return{code:'/* SVG Background Image */\n/* Apply .svg-icon class to any element to use this SVG as background */\n\n.svg-icon {\n  background-image: url("'.concat(n,'");\n  background-size: contain;\n  background-repeat: no-repeat;\n  background-position: center;\n  width: 100%;\n  height: 100%;\n  display: inline-block;\n}\n\n/* Size variants */\n.svg-icon-sm {\n  width: 24px;\n  height: 24px;\n}\n\n.svg-icon-md {\n  width: 48px;\n  height: 48px;\n}\n\n.svg-icon-lg {\n  width: 96px;\n  height: 96px;\n}\n\n.svg-icon-xl {\n  width: 128px;\n  height: 128px;\n}\n'),fileExtension:"css"}}async function B(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{text:r="SVGMaker",fontSize:n=28,opacity:a=.4,color:o="grey",padding:i=64,useLogo:s=!0,logoSize:c=64}=t;try{let t,{xmlDeclaration:l,comments:d,svgContent:m}=function(e){let t=e.split("\n"),r=[],n=[],a=[];for(let e of t){let t=e.trim();if(t.startsWith("<?xml")){r.push(e);continue}if(t.startsWith("\x3c!--")){n.push(e);continue}a.push(e)}return{xmlDeclaration:r.join("\n"),comments:n,svgContent:a.join("\n")}}(e),u=await (0,V.parse)(m),p=function(e){let t,r=new DOMParser().parseFromString(e,"image/svg+xml").querySelector("svg");if(!r)throw Error("Invalid SVG: No SVG element found");let n=100,a=100,o=r.getAttribute("viewBox");if(o){let[e,r,i,s]=o.split(/\s+/).map(Number);t={x:e,y:r,width:i,height:s},n=i,a=s}else{let e=r.getAttribute("width"),t=r.getAttribute("height");e&&(n=parseFloat(e.replace(/[^\d.]/g,""))),t&&(a=parseFloat(t.replace(/[^\d.]/g,"")))}return{width:n,height:a,viewBox:t}}(e);if(s){let e=await fetch("/logo.svg"),r=await e.text(),n=await (0,V.parse)(r),o=p.width-i-c,s=p.height-i-c;t={name:"g",type:"element",value:"",attributes:{transform:"translate(".concat(o,", ").concat(s,") scale(").concat(c/1024,", ").concat(c/1024,")"),opacity:String(a),"pointer-events":"none","data-watermark":"svgmaker-logo"},children:n.children}}else{let e=p.width-i,s=p.height-i-5;t={name:"text",type:"element",value:"",attributes:{x:String(e),y:String(s),"font-family":"Arial, Helvetica, sans-serif","font-size":String(n),"font-weight":"bold",fill:o,opacity:String(a),"text-anchor":"end","dominant-baseline":"alphabetic","data-watermark-text":"svgmaker","text-shadow":"0 1px 2px rgba(0,0,0,0.5)",stroke:"rgba(0,0,0,0.3)","stroke-width":"0.5","pointer-events":"none",style:"user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none;"},children:[{name:"",type:"text",value:r,attributes:{},children:[]}]}}u.children.push(t);let g=(0,V.stringify)(u);return[l,...d,g].filter(Boolean).join("\n")}catch(e){throw console.error("Watermarking failed:",e),Error("Failed to apply watermark to SVG")}}var H=r(39948),A=r(23056);let W=/<svg\b[^>]*>/i,q=e=>RegExp("(?<![\\w-])".concat(e,"\\s*=\\s*[\"'][^\"']*[\"']"),"i"),J=(e,t)=>
1{var r;return null==(r=RegExp("(?<![\\w-])".concat(t,"\\s*=\\s*[\"']([^\"']*)[\"']"),"i").exec(e))?void 0:r[1]},Z=e=>{if(!e)return null;let t=/^\s*([+-]?[\d.]+)\s*(px)?\s*$/i.exec(e),r=t?Number(t[1]):NaN;return Number.isFinite(r)&&r>0?r:null},$=e=>String(Math.round(100*e)/100);function X(e){return e?e.replace(/-->/g,"→").replace(/--/g,"—").replace(/</g,"‹").replace(/>/g,"›").replace(/&/g,"&").replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g,"").trim():""}async function _(e){return new Promise((t,r)=>{let n=new FileReader;n.onloadend=()=>{"string"==typeof n.result?t(n.result):r(Error("Failed to convert blob to DataURL"))},n.onerror=()=>r(Error("Failed to read blob")),n.readAsDataURL(e)})}async function Q(e){try{await navigator.clipboard.write([new window.ClipboardItem({"image/png":e})])}catch(t){console.warn("Failed to copy PNG as image, trying data URL fallback:",t);try{let t=await Promise.resolve(e),r=await _(t);await navigator.clipboard.writeText(r)}catch(e){throw console.error("Both PNG copy methods failed:",t,e),Error("Failed to copy PNG to clipboard.")}}}async function Y(e,t){try{await fetch("/api/user-analytics",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e,format:t})})}catch(e){}}let K=e=>{let{format:t,selectedFormat:r,onClick:a,icon:o,label:i,hideOnMobile:s=!1}=e;return(0,n.jsxs)("button",{className:"flex items-center w-full p-3 mb-2 rounded-lg text-base font-medium transition-all max-sm:mb-0 max-sm:flex-1 max-sm:justify-center max-sm:text-sm ".concat(s?"max-sm:hidden":""," ").concat(r===t?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),onClick:a,children:[o," ",i]})},ee=e=>{let{selectedFormat:t,onFormatChange:r,mode:a}=e;return(0,n.jsxs)("div",{className:"w-80 min-w-[20rem] max-w-[20rem] border-r border-accent flex flex-col p-6 max-sm:w-full max-sm:min-w-full max-sm:max-w-full max-sm:border-r-0 max-sm:border-b max-sm:p-4 max-sm:pt-12 max-sm:flex-row max-sm:gap-2",children:[(0,n.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-4 max-sm:hidden",children:"copy"===a?"Copy formats":"Download formats"}),(0,n.jsx)(K,{format:"svg",selectedFormat:t,onClick:()=>r("svg"),icon:g,label:"SVG"}),(0,n.jsx)(K,{format:"png",selectedFormat:t,onClick:()=>r("png"),icon:p,label:"PNG"}),"download"===a&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(K,{format:"vector",selectedFormat:t,onClick:()=>r("vector"),icon:x,label:"More Vectors",hideOnMobile:!0}),(0,n.jsx)(K,{format:"jpg",selectedFormat:t,onClick:()=>r("jpg"),icon:f,label:"More Rasters",hideOnMobile:!0})]}),(0,n.jsx)(K,{format:"react",selectedFormat:t,onClick:()=>r("react"),icon:b,label:"React",hideOnMobile:!0}),(0,n.jsx)(K,{format:"react-native",selectedFormat:t,onClick:()=>r("react-native"),icon:y,label:"React Native",hideOnMobile:!0}),"copy"===a&&(0,n.jsx)(K,{format:"data-uri",selectedFormat:t,onClick:()=>r("data-uri"),icon:v,label:"Data URI",hideOnMobile:!0}),(0,n.jsx)(K,{format:"html-css",selectedFormat:t,onClick:()=>r("html-css"),icon:w,label:"HTML/CSS",hideOnMobile:!0})]})},et=e=>{let{value:t,selectedValue:r,onSelect:a,title:o,description:i,isPaidUser:s,isCommunityGallery:c,isProImage:l}=e,d=r===t,m=s||c&&!l;return(0,n.jsxs)("label",{className:"flex items-start justify-between p-4 cursor-pointer rounded-lg border transition-all duration-200 ".concat(d?"bg-secondary/20 border-primary/80":"bg-muted/30 border-muted-foreground/30 hover:bg-muted"),onClick:()=>a(t),children:[(0,n.jsxs)("div",{className:"flex items-start",children:[(0,n.jsx)("input",{type:"radio",name:"svg-option",checked:d,onChange:()=>a(t),className:"w-4 h-4 mr-3 mt-0.5 accent-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-sm font-medium text-foreground block",children:o}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground mt-1 block",children:i})]})]}),!s&&(0,n.jsx)("span",{className:"text-xs font-medium px-2 py-1 rounded-full border flex-shrink-0 ".concat(m?"bg-success/10 text-success border-success/30":"bg-primary/10 text-primary border-primary/30"),children:m?"Free":"Pro"})]})},er=e=>{let{svgOption:t,onSvgOptionChange:r,mode:a,isPaidUser:o,isCommunityGallery:i,isProImage:s}=e;return(0,n.jsxs)("div",{className:"space-y-3",children:[(0,n.jsx)(et,{value:"original",selectedValue:t,onSelect:r,title:"Pixel Perfect SVG",description:"An unaltered SVG generated by SVGMaker.",isPaidUser:o,isCommunityGallery:i,isProImage:s}),(0,n.jsx)(et,{value:"optimized",selectedValue:t,onSelect:r,title:"Optimized SVG",description:"Typically 10-30% smaller, keeps under Canva's 3 MB limit.",isPaidUser:o,isCommunityGallery:i,isProImage:s}),"download"===a&&(0,n.jsx)(et,{value:"svgz",selectedValue:t,onSelect:r,title:"Compressed SVG (.svgz)",description:"Typically 60-80% smaller, gzip-compressed.",isPaidUser:o,isCommunityGallery:i,isProImage:s})]})},en=e=>{let{selectedSize:t,selectedSizeOption:r,onSizeChange:a,onSizeOptionChange:o,getPresetDimensions:i,customWidthInput:s,customHeightInput:c,onCustomWidthChange:l,onCustomHeightChange:d,onCustomWidthBlur:m,onCustomHeightBlur:u,isWatermarkFreeMode:p,minCustomSize:g,maxCustomSize:h,isPaidUser:f,isCommunityGallery:x,isProImage:b}=e,y=f||x&&!b;return(0,n.jsxs)("div",{className:"space-y-3",children:[["low","medium","high"].map(e=>{let s=i(e);return(0,n.jsxs)("label",{className:"flex items-center justify-between py-3 px-4 cursor-pointer rounded-lg border border-muted-foreground
1/30 hover:bg-muted transition-all duration-200 ".concat(t===e&&"preset"===r?"bg-secondary/20 border-primary/80":"bg-muted/30"),children:[(0,n.jsxs)("div",{className:"flex items-center",children:[(0,n.jsx)("input",{type:"radio",name:"size-option",checked:t===e&&"preset"===r,onChange:()=>{a(e),o("preset")},className:"w-4 h-4 mr-3 accent-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background"}),(0,n.jsxs)("span",{className:"text-sm font-medium text-foreground",children:[e.charAt(0).toUpperCase()+e.slice(1)," (",s.width,"\xd7",s.height,")"]})]}),!f&&(0,n.jsx)("span",{className:"text-xs font-medium px-2 py-1 rounded-full ".concat(y?"bg-success/10 text-success border border-success/30":"bg-primary/10 text-primary border border-primary/30"),children:y?"Free":"Pro"})]},e)}),(0,n.jsx)("label",{className:"flex items-center justify-between py-3 px-4 cursor-pointer rounded-lg border border-muted-foreground/30 hover:bg-muted transition-all duration-200 ".concat("custom"===r?"bg-secondary/20 border-primary/80":"bg-muted/30"),children:(0,n.jsxs)("div",{className:"flex items-center gap-2 w-full",children:[(0,n.jsx)("input",{type:"radio",name:"size-option",checked:"custom"===r,onChange:()=>o("custom"),className:"w-4 h-4 accent-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background"}),(0,n.jsx)("span",{className:"text-sm font-medium text-foreground",children:"Custom size"}),!f&&(0,n.jsx)("span",{className:"text-xs font-medium px-2 py-1 rounded-full ".concat(y?"bg-success/10 text-success border border-success/30":"bg-primary/10 text-primary border border-primary/30"," ml-auto"),children:y?"Free":"Pro"})]})}),"custom"===r&&(0,n.jsxs)("div",{className:"mt-2 p-4 bg-muted rounded-lg border border-input flex items-center gap-3",children:[(0,n.jsx)("input",{type:"number",value:s,onChange:e=>l(e.target.value),onBlur:m,className:"w-20 px-2 py-1 border border-input bg-background text-foreground rounded-md text-sm focus:ring-2 focus:ring-ring focus:border-ring",disabled:!p,min:g,max:h,inputMode:"numeric"}),(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:"\xd7"}),(0,n.jsx)("input",{type:"number",value:c,onChange:e=>d(e.target.value),onBlur:u,className:"w-20 px-2 py-1 border border-input bg-background text-foreground rounded-md text-sm focus:ring-2 focus:ring-ring focus:border-ring",disabled:!p,min:g,max:h,inputMode:"numeric"}),(0,n.jsx)("span",{className:"text-sm text-muted-foreground",children:"px"})]})]})},ea=[{value:"pdf",label:"PDF",description:"Portable Document Format"},{value:"eps",label:"EPS",description:"Encapsulated PostScript"},{value:"ps",label:"PS",description:"PostScript"},{value:"dxf",label:"DXF",description:"Drawing Exchange Format"},{value:"ai",label:"AI",description:"Adobe Illustrator"}],eo=e=>{let{selectedVectorFormat:t,onFormatChange:r,isPaidUser:a,isCommunityGallery:o,isProImage:i}=e,s=a||o&&!i;return(0,n.jsx)("div",{className:"space-y-3",children:ea.map(e=>{let{value:o,label:i,description:c}=e;return(0,n.jsxs)("label",{className:"flex items-start justify-between p-4 cursor-pointer rounded-lg border transition-all duration-200 ".concat(t===o?"bg-secondary/20 border-primary/80":"bg-muted/30 border-muted-foreground/30 hover:bg-muted"),children:[(0,n.jsxs)("div",{className:"flex items-start",children:[(0,n.jsx)("input",{type:"radio",name:"vector-option",checked:t===o,onChange:()=>r(o),className:"w-4 h-4 mr-3 mt-0.5 accent-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-sm font-medium text-foreground block",children:i}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground mt-1 block",children:c})]})]}),!a&&(0,n.jsx)("span",{className:"text-xs font-medium px-2 py-1 rounded-full border flex-shrink-0 ".concat(s?"bg-success/10 text-success border-success/30":"bg-primary/10 text-primary border-primary/30"),children:s?"Free":"Pro"})]},o)})})},ei=[{value:"jpg",label:"JPG",description:"Lossy compression, smaller file size"},{value:"webp",label:"WEBP",description:"Modern format, better compression"},{value:"bmp",label:"BMP",description:"Uncompressed, largest file size"}],es=e=>
1{let{selectedRasterFormat:t,onFormatChange:r,isPaidUser:a,isCommunityGallery:o,isProImage:i}=e,s=a||o&&!i;return(0,n.jsx)("div",{className:"space-y-3",children:ei.map(e=>{let{value:o,label:i,description:c}=e;return(0,n.jsxs)("label",{className:"flex items-start justify-between p-4 cursor-pointer rounded-lg border transition-all duration-200 ".concat(t===o?"bg-secondary/20 border-primary/80":"bg-muted/30 border-muted-foreground/30 hover:bg-muted"),children:[(0,n.jsxs)("div",{className:"flex items-start",children:[(0,n.jsx)("input",{type:"radio",name:"raster-option",checked:t===o,onChange:()=>r(o),className:"w-4 h-4 mr-3 mt-0.5 accent-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-sm font-medium text-foreground block",children:i}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground mt-1 block",children:c})]})]}),!a&&(0,n.jsx)("span",{className:"text-xs font-medium px-2 py-1 rounded-full border flex-shrink-0 ".concat(s?"bg-success/10 text-success border-success/30":"bg-primary/10 text-primary border-primary/30"),children:s?"Free":"Pro"})]},o)})})}
1,ec=[{value:"jsx",label:"JSX",description:"JavaScript React component"},{value:"tsx",label:"TSX",description:"TypeScript React component with types"}],el=e=>{let{selectedReactFormat:t,onFormatChange:r,isPaidUser:a,isCommunityGallery:o,isProImage:i}=e,s=a||o&&!i;return(0,n.jsx)("div",{className:"space-y-3",children:ec.map(e=>{let{value:o,label:i,description:c}=e;return(0,n.jsxs)("label",{className:"flex items-start justify-between p-4 cursor-pointer rounded-lg border transition-all duration-200 ".concat(t===o?"bg-secondary/20 border-primary/80":"bg-muted/30 border-muted-foreground/30 hover:bg-muted"),children:[(0,n.jsxs)("div",{className:"flex items-start",children:[(0,n.jsx)("input",{type:"radio",name:"react-option",checked:t===o,onChange:()=>r(o),className:"w-4 h-4 mr-3 mt-0.5 accent-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-sm font-medium text-foreground block",children:i}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground mt-1 block",children:c})]})]}),!a&&(0,n.jsx)("span",{className:"text-xs font-medium px-2 py-1 rounded-full border flex-shrink-0 ".concat(s?"bg-success/10 text-success border-success/30":"bg-primary/10 text-primary border-primary/30"),children:s?"Free":"Pro"})]},o)})})}
1,ed=[{value:"jsx",label:"JSX",description:"JavaScript React Native component"},{value:"tsx",label:"TSX",description:"TypeScript React Native component with types"}],em=e=>{let{selectedReactNativeFormat:t,onFormatChange:r,isPaidUser:a,isCommunityGallery:o,isProImage:i}=e,s=a||o&&!i;return(0,n.jsx)("div",{className:"space-y-3",children:ed.map(e=>{let{value:o,label:i,description:c}=e;return(0,n.jsxs)("label",{className:"flex items-start justify-between p-4 cursor-pointer rounded-lg border transition-all duration-200 ".concat(t===o?"bg-secondary/20 border-primary/80":"bg-muted/30 border-muted-foreground/30 hover:bg-muted"),children:[(0,n.jsxs)("div",{className:"flex items-start",children:[(0,n.jsx)("input",{type:"radio",name:"react-native-option",checked:t===o,onChange:()=>r(o),className:"w-4 h-4 mr-3 mt-0.5 accent-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-sm font-medium text-foreground block",children:i}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground mt-1 block",children:c})]})]}),!a&&(0,n.jsx)("span",{className:"text-xs font-medium px-2 py-1 rounded-full border flex-shrink-0 ".concat(s?"bg-success/10 text-success border-success/30":"bg-primary/10 text-primary border-primary/30"),children:s?"Free":"Pro"})]},o)})})}
1,eu=[{value:"minified",label:"Minified",description:"Optimized + URI encoded (smallest)"},{value:"base64",label:"Base64",description:"Base64 encoded (more compatible)"},{value:"encoded",label:"Encoded",description:"URI component encoded (readable)"}],ep=e=>{let{selectedDataUriFormat:t,onFormatChange:r,isPaidUser:a,isCommunityGallery:o,isProImage:i}=e,s=a||o&&!i;return(0,n.jsx)("div",{className:"space-y-3",children:eu.map(e=>{let{value:o,label:i,description:c}=e;return(0,n.jsxs)("label",{className:"flex items-start justify-between p-4 cursor-pointer rounded-lg border transition-all duration-200 ".concat(t===o?"bg-secondary/20 border-primary/80":"bg-muted/30 border-muted-foreground/30 hover:bg-muted"),children:[(0,n.jsxs)("div",{className:"flex items-start",children:[(0,n.jsx)("input",{type:"radio",name:"data-uri-option",checked:t===o,onChange:()=>r(o),className:"w-4 h-4 mr-3 mt-0.5 accent-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-sm font-medium text-foreground block",children:i}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground mt-1 block",children:c})]})]}),!a&&(0,n.jsx)("span",{className:"text-xs font-medium px-2 py-1 rounded-full border flex-shrink-0 ".concat(s?"bg-success/10 text-success border-success/30":"bg-primary/10 text-primary border-primary/30"),children:s?"Free":"Pro"})]},o)})})},eg=[{value:"html-standalone",label:"Standalone HTML",description:"Complete HTML5 document with inline SVG"},{value:"html-element",label:"SVG Element Only",description:"Just the <svg> element for embedding"},{value:"css-background",label:"CSS Background",description:"Use SVG as background-image via class"}],eh=e=>{let{selectedHtmlCssFormat:t,onFormatChange:r,isPaidUser:a,isCommunityGallery:o,isProImage:i}=e,s=a||o&&!i;return(0,n.jsx)("div",{className:"space-y-3",children:eg.map(e=>{let{value:o,label:i,description:c}=e;return(0,n.jsxs)("label",{className:"flex items-start justify-between p-4 cursor-pointer rounded-lg border transition-all duration-200 ".concat(t===o?"bg-secondary/20 border-primary/80":"bg-muted/30 border-muted-foreground/30 hover:bg-muted"),children:[(0,n.jsxs)("div",{className:"flex items-start",children:[(0,n.jsx)("input",{type:"radio",name:"html-css-option",checked:t===o,onChange:()=>r(o),className:"w-4 h-4 mr-3 mt-0.5 accent-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background"}),(0,n.jsxs)("div",{children:[(0,n.jsx)("span",{className:"text-sm font-medium text-foreground block",children:i}),(0,n.jsx)("span",{className:"text-xs text-muted-foreground mt-1 block",children:c})]})]}),!a&&(0,n.jsx)("span",{className:"text-xs font-medium px-2 py-1 rounded-full border flex-shrink-0 ".concat(s?"bg-success/10 text-success border-success/30":"bg-primary/10 text-primary border-primary/30"),children:s?"Free":"Pro"})]},o)})})},ef=e=>{let{mode:t}=e;return(0,n.jsx)("div",{className:"mt-1 p-3 bg-secondary/20 border border-primary/80 rounded-lg",children:(0,n.jsxs)("div",{className:"flex items-start",children:[(0,n.jsx)("svg",{className:"w-5 h-5 text-primary mr-2 mt-0.5 flex-shrink-0",fill:"currentColor",viewBox:"0 0 20 20",children:(0,n.jsx)("path",{fillRule:"evenodd",d:"M11.562 3.266a.5.5 0 0 1 .876 0L14.39 8.01a1 1 0 0 0 1.516.294L18.72 5.92a.5.5 0 0 1 .745.597L16.934 20.29a1 1 0 0 1-.994.71H8.06a1 1 0 0 1-.994-.71L4.535 6.517a.5.5 0 0 1 .745-.597l2.814 2.384a1 1 0 0 0 1.516-.294z",clipRule:"evenodd"})}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("p",{className:"text-xs font-medium text-primary",children:["Upgrade to Pro to ","copy"===t?"copy":"download"]}),(0,n.jsxs)("p",{className:"text-xs text-secondary-foreground mt-1",children:["Purchase credits to access ","copy"===t?"copy":"download"," functionality."]})]})]})})};var ex=r(57680),eb=r(68854);let ey=e=>{let{mode:t,needsSignup:r,needsUpgrade:a,isCopySuccess:o,isProcessing:i,isSvgOptimizing:s,isSvgLoading:c,onAction:l,onSignup:d,onUpgrade:m}=e,u=i||s||c;return r?(0,n.jsx)("div",{className:"p-6 border-t border-accent flex-shrink-0 flex justify-end max-sm:p-4 max-sm:max-h-20",children:(0,n.jsx)("button",{className:"inline-flex items-center bg-primary text-primary-foreground py-2.5 px-5 rounded-lg text-sm font-semibold hover:bg-primary/80 transition-colors min-w-[200px] max-w-[240px] w-auto justify-center max-sm:w-full max-sm:min-w-full max-sm:max-w-full max-sm:text-sm max-sm:py-2",onClick:d,style:{lineHeight:1.25},children:"Sign Up to Download"})}):a?(0,n.jsx)("div",{className:"p-6 border-t border-accent flex-shrink-0 flex justify-end max-sm:p-4 max-sm:max-h-20",children:(0,n.jsxs)("button",{className:"inline-flex items-center bg-primary text-primary-foreground py-2.5 px-5 rounded-lg text-sm font-medium hover:bg-primary/80 transition-colors min-w-[200px] max-w-[240px] w-auto justify-center max-sm:w-full max-sm:min-w-full max-sm:max-w-full gap-2",onClick:m,style:{lineHeight:1.25},children:[(0,n.jsx)(eb.A,{className:"h-4 w-4"}),(0,n.jsx)("span",{className:"inline-block align-middle whitespace-nowrap max-sm:whitespace-normal",children:"Unlock all formats"})]})}):(0,n.jsx)("div",{className:"p-6 border-t border-accent flex-shrink-0 flex justify-end max-sm:p-4 max-sm:max-h-20",children:(0,n.jsx)("button",{className:"inline-flex items-center py-2.5 px-5 rounded-lg text-sm text-primary-foreground font-semibold transition-colors action-button min-w-[200px] max-w-[240px] w-auto justify-center max-sm:w-full max-sm:min-w-full max-sm:max-w-full max-sm:text-sm max-sm:py-2 ".concat(o?"bg-success":"bg-primary hover:bg-primary/80"),onClick:l,disabled:u,style:{lineHeight:1.25},children:"copy"===t?o?(0,n.jsxs)(n.Fragment,{children:[C,(0,n.jsx)("span",{className:"inline-block align-middle",children:"Copied"})]}):(0,n.jsxs)(n.Fragment,{children:[u?(0,n.jsx)(ex.A,{size:20,className:"animate-spin mr-2"}):j,(0,n.jsx)("span",{className:"inline-block align-middle",children:c?"Loading":u?"Copying":"Copy"})]}):(0,n.jsxs)(n.Fragment,{children:[u?(0,n.jsx)(ex.A,{size:20,className:"animate-spin mr-2"}):h,(0,n.jsx)("span",{className:"inline-block align-middle",children:c?"Loading":u?"Downloading":"Download"})]})})})},ev=e=>{let{open:t,onOpenChange:r,generationId:p,isPaidUser:g,filenamePrefix:h="svgmaker",mode:f="download",isCommunityGallery:x=!1,cacheBuster:b,isProImage:y=!1,initialSvgContent:v}=e,{trackSvgDownload:w}=(0,s.s)(),{authUser:j}=(0,l.P)(),{closeFullScreenEditor:C}=(0,d.h)(),V=(0,m.useRouter)(),[E,M]=(0,a.useState)(!1),{svgText:U,dimensions:P,generationMetadata:G,isSvgLoa
1ding:L,getCurrentRaster:O,getPresetDimensions:D}=function(e){let{open:t,generationId:r,cacheBuster:n,initialSvgContent:o}=e,[i,s]=(0,a.useState)(null),[c,l]=(0,a.useState)({width:512,height:512,aspectRatio:1}),[d,m]=(0,a.useState)({}),[u,p]=(0,a.useState)(!0),g=(0,a.useRef)(new Map);(0,a.useEffect)(()=>{if(t){if(s(null),p(!0),g.current.clear(),o){s(o),l(F(o)),p(!1),fetch("/api/generation/info?generationId=".concat(r)).then(e=>e.json()).then(e=>{e&&!e.error&&m({prompt:e.prompt||e.originalPrompt,quality:e.quality,type:e.type})}).catch(()=>{});return}(0,S.qC)(r,!0).then(e=>{s(e),l(F(e))}).catch(()=>{N.o.error("Failed to load SVG. Please try again.")}).finally(()=>{p(!1)}),fetch("/api/generation/info?generationId=".concat(r)).then(e=>e.json()).then(e=>{e&&!e.error&&m({prompt:e.prompt||e.originalPrompt,quality:e.quality,type:e.type})}).catch(e=>{console.log("Failed to fetch generation metadata:",e)})}},[t,r,n,o]);let h=(0,a.useCallback)(e=>{switch(e){case"low":return{width:Math.round(c.width/2),height:Math.round(c.height/2)};case"medium":default:return{width:c.width,height:c.height};case"high":return{width:2*c.width,height:2*c.height}}},[c]),f=(0,a.useCallback)((e,t,n,a)=>{let o,i;if("custom"===e)o=t,i=n;else{let e=h(a);o=e.width,i=e.height}let s="".concat(r,"-").concat(o,"x").concat(i);return{width:o,height:i,cacheKey:s}},[h,r]),x=(0,a.useCallback)(async(e,t,n)=>{var a;let o,s,l;if(void 0!==t&&void 0!==n?(o=t,s=n):(o=c.width,s=c.height),l="".concat(r,"-").concat(o,"x").concat(s),g.current.has(l)&&(null==(a=g.current.get(l))?void 0:a[e]))return g.current.get(l)[e];if(!i)throw Error("SVG not loaded");let d=(await (0,k._m)(i,e,{width:o,height:s,quality:"jpg"===e?.92:"webp"===e?.9:void 0})).blob;return g.current.has(l)||g.current.set(l,{}),g.current.get(l)[e]=d,d},[i,c,r]);return{svgText:i,dimensions:c,generationMetadata:d,isSvgLoading:u,getCurrentRaster:x,getPresetDimensions:h,getCurrentDimensionsAndCacheKey:f}}({open:t,generationId:p,cacheBuster:b,initialSvgContent:v}),{selectedFormat:T,setSelectedFormat:_,selectedSize:K,setSelectedSize:et,selectedSizeOption:ea,setSelectedSizeOption:ei,svgOption:ec,setSvgOption:ed,selectedRasterFormat:eu,setSelectedRasterFormat:eg,selectedVectorFormat:ex,setSelectedVectorFormat:eb,selectedReactFormat:ev,setSelectedReactFormat:ew,selectedReactNativeFormat:ej,setSelectedReactNativeFormat:eC,selectedDataUriFormat:eS,setSelectedDataUriFormat:ek,selectedHtmlCssFormat:eN,setSelectedHtmlCssFormat:eF,includeMetadata:eR,setIncludeMetadata:eV,isWatermarkFreeMode:eE}=function(e){let{mode:t,isPaidUser:r,isCommunityGallery:n}=e,[o,i]=(0,a.useState)("svg"),[s,c]=(0,a.useState)("medium"),[l,d]=(0,a.useState)("preset"),[m,u]=(0,a.useState)("original"),[p,g]=(0,a.useState)("jpg"),[h,f]=(0,a.useState)("pdf"),[x,b]=(0,a.useState)("jsx"),[y,v]=(0,a.useState)("jsx"),[w,j]=(0,a.useState)("minified"),[C,S]=(0,a.useState)("html-standalone"),[k,N]=(0,a.useState)(r||n),[F,R]=(0,a.useState)(()=>{try{let e=localStorage.getItem("download-include-metadata");return null===e||"true"===e}catch(e){return!0}});return(0,a.useEffect)(()=>{N(r||n)},[r,n]),(0,a.useEffect)(()=>{"copy"===t&&("jpg"===o||"vector"===o)&&i("png"),"copy"===t&&"svgz"===m&&u("original"),"download"===t&&"data-uri"===o&&i("svg")},[t,o,m]),{selectedFormat:o,setSelectedFormat:i,selectedSize:s,setSelectedSize:c,selectedSizeOption:l,setSelectedSizeOption:d,svgOption:m,setSvgOption:u,selectedRasterFormat:p,setSelectedRasterFormat:g,selectedVectorFormat:h,setSelectedVectorFormat:f,selectedReactFormat:x,setSelectedReactFormat:b,selectedReactNativeFormat:y,setSelectedReactNativeFormat:v,selectedDataUriFormat:w,setSelectedDataUriFormat:j,selectedHtmlCssFormat:C,setSelectedHtmlCssFormat:S,includeMetadata:F,setIncludeMetadata:e=>{R(e);try{localStorage.setItem("download-include-metadata",String(e))}catch(e){console.error("Failed to save metadata preference:",e)}},isWatermarkFreeMode:k}}({mode:f,isPaidUser:g,isCommunityGallery:x}),{customWidth:eM,customHeight:eU,customWidthInput:eP,customHeightInput:eG,handleCustomWidthChange:ez,handleCustomHeightChange:eL,clampCustomWidth:eI,clampCustomHeight:eO}=function(e){let{dimensions:t}=e,[r,n]=(0,a.useState)(t.width),[o,i]=(0,a.useState)(t.height),[s,c]=(0,a.useState)(r.toString()),[l,d]=(0,a.useState)(o.toString());(0,a.useEffect)(()=>{n(t.width),i(t.height),c(t.width.toString()),d(t.height.toString())},[t]);let m=(0,a.useCallback)(e=>{if(c(e),""===e)return;let r=Number(e);if(isNaN(r))return;n(r);let a=Math.round(r/t.aspectRatio);i(a),d(a.toString())},[t.aspectRatio]),u=(0,a.useCallback)(e=>{if(d(e),""===e)return;let r=Number(e);if(isNaN(r))return;i(r);let a=Math.round(r*t.aspectRatio);n(a),c(a.toString())},[t.aspectRatio]),p=(0,a.useCallback)(()=>{let e=Number(s);if(isNaN(e)||e<16){n(16),c("16");let e=Math.round(16/t.aspectRatio);i(e),d(e.toString());return}if(e>4096){n(4096),c("4096");let e=Math.round(4096/t.aspectRatio);i(e),d(e.toString());return}n(e),c(e.toString());let r=Math.round(e/t.aspectRatio);i(r),d(r.toString())},[s,t.aspectRatio]),g=(0,a.useCallback)(()=>{let e=Number(l);if(isNaN(e)||e<16){i(16),d("16");let e=Math.round(16*t.aspectRatio);n(e),c(e.toString());return}if(e>4096){i(4096),d("4096");let e=Math.round(4096*t.aspectRatio);n(e),c(e.toString());return}i(e),d(e.toString());let r=Math.round(e*t.aspectRatio);n(r),c(r.toString())},[l,t.aspectRatio]);return{customWidth:r,customHeight:o,customWidthInput:s,customHeightInput:l,handleCustomWidthChange:m,handleCustomHeightChange:u,clampCustomWidth:p,clampCustomHeight:g}}({dimensions:P}),{isProcessing:eD,isSvgOptimizing:eT,isCopySuccess:eB,getActionHandler:eH}=function(e){let{svgText:t,dimensions:r,generationId:n,filenamePrefix:o,isPaidUser:i,isCommunityGallery:s,mode:c,selectedFormat:l,svgOption:d,selectedRasterFormat:m,selectedVectorFormat:u,selectedReactFormat:p,selectedReactNativeFormat:g,selectedDataUriFormat:h,selectedHtmlCssFormat:f,selectedSize:x,selectedSizeOption:b,customWidth:y,customHeight:v,includeMetadata:w,generationMetadata:j,getPresetDimensions:C,getCurrentRaster:k,trackSvgDownload:F,onOpenChange:V}=e,[E,M]=(0,a.useState)(!1),[U,P]=(0,a.useState)(!1),[G,L]=(0,a.useState)(!1),O
1=(0,a.useCallback)(async(e,t,r,n)=>{let a=e;if(n&&w){let e={};j.quality&&(e.Quality=j.quality),j.type&&(e.Type=j.type),a=function(e,t,r){if((e=function(e){var t,r;let n=null==(t=W.exec(e))?void 0:t[0];if(!n)return e;let a=null==(r=J(n,"preserveAspectRatio"))?void 0:r.trim().toLowerCase();if("none"===a||(null==a?void 0:a.endsWith("slice")))return e;let o=(e=>{if(!e)return null;let t=e.trim().split(/[\s,]+/).map(Number);if(4!==t.length||t.some(e=>!Number.isFinite(e)))return null;let[,,r,n]=t;return r>0&&n>0?{width:r,height:n}:null})(J(n,"viewBox")),i=Z(J(n,"width")),s=Z(J(n,"height"));if(!o||!i||!s)return e;let c=o.width/o.height;if(Math.abs(i/s-c)/c<=.01)return e;let l=Math.min(i/o.width,s/o.height),d=n.replace(q("width"),()=>'width="'.concat($(o.width*l),'"')).replace(q("height"),()=>'height="'.concat($(o.height*l),'"'));return e.replace(n,()=>d)}(e)).includes("\x3c!-- Generated by SVGMaker")){let t=e.replace(/-->\s*<!--/g,"--\x3e\n\x3c!--");return(t=t.replace(/<!--\s*Revised Prompt:.*?-->\n?/g,"")).replace(/-->\s*(<svg)/g,"--\x3e\n$1")}if(-1===e.indexOf("<svg"))return e;try{let n=new H.A({ignoreAttributes:!1,preserveOrder:!0,commentPropName:"#comment",allowBooleanAttributes:!0,parseAttributeValue:!1,trimValues:!1,processEntities:!1}).parse(e),a=null,o=-1;for(let e=0;e<n.length;e++)if(n[e].svg){a=n[e],o=e;break}if(!a)return e;let i=[];if(i.push({"#comment":[{"#text":" Generated by SVGMaker - https://svgmaker.io "}]}),t){let e=X(t);i.push({"#comment":[{"#text":" Prompt: ".concat(e," ")}]})}return r&&Object.entries(r).forEach(e=>{let[t,r]=e,n=X(r);i.push({"#comment":[{"#text":" ".concat(t,": ").concat(n," ")}]})}),i.push({"#comment":[{"#text":" Created: ".concat(new Date().toISOString()," ")}]}),n.splice(o,0,...i),new A.A({ignoreAttributes:!1,preserveOrder:!0,commentPropName:"#comment",format:!1,suppressEmptyNode:!1,processEntities:!1}).build(n).replace(/\?>\s*<!--/g,"?>\n\x3c!--").replace(/-->\s*<!--/g,"--\x3e\n\x3c!--").replace(/-->\s*<svg/g,"--\x3e\n<svg")}catch(i){console.error("Error parsing SVG with fast-xml-parser, falling back to string manipulation:",i);let n=e.indexOf("<svg");if(-1===n)return e;let a=["\x3c!-- Generated by SVGMaker - https://svgmaker.io --\x3e"];if(t){let e=X(t);a.push("\x3c!-- Prompt: ".concat(e," --\x3e"))}r&&Object.entries(r).forEach(e=>{let[t,r]=e,n=X(r);a.push("\x3c!-- ".concat(t,": ").concat(n," --\x3e"))}),a.push("\x3c!-- Created: ".concat(new Date().toISOString()," --\x3e"));let o=a.join("\n")+"\n";return e.slice(0,n)+o+e.slice(n)}}(a,j.prompt,e)}if(t){P(!0);try{let e=await fetch("/api/optimize-svg",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({svgText:a})});if(!e.ok)throw Error("Failed to optimize SVG");let{optimizedSvgText:t}=await e.json();a=t}finally{P(!1)}}return r&&(a=await B(a)),a},[w,j]),D=(0,a.useCallback)(async()=>{if(!E&&t)try{if(M(!0),"png"===l||"jpg"===l){let e,t;if("png"===l)if("custom"===b)e=y,t=v;else{let r=C(x);e=r.width,t=r.height}else e=Math.round(r.width),t=Math.round(r.height);let a="".concat((0,S.tN)(n,o),"-").concat(e,"x").concat(t),i="jpg"===l?m:l,s=await k(i,e,t),c=URL.createObjectURL(s),d=document.createElement("a");d.href=c,d.download="".concat(a,".").concat(i),document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(c)}else{let e=(0,S.tN)(n,o);if("vector"===l){let r=await fetch("/api/convert-svg",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({svgText:t,format:u,filename:e})});if(!r.ok)throw Error("Failed to convert to ".concat(u));let n=await r.blob();(0,S.WN)(n,"".concat(e,".").concat(u))}else if("react"===l||"react-native"===l){let r="react"===l?p:g,{code:n,fileExtension:a}=await z(t,{format:r,reactNative:"react-native"===l,optimize:!0,componentName:"SvgComponent"}),o=new Blob([n],{type:"text/plain; charset=utf-8"});(0,S.WN)(o,"".concat(e,".").concat(a))}else if("html-css"===l){let{code:r,fileExtension:n}=await I(t,{format:f,optimize:!0}),a=new Blob([r],{type:"text/plain; charset=utf-8"});(0,S.WN)(a,"".concat(e,".").concat(n))}else if("svgz"===d){let r=await fetch("/api/optimize-svg",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({svgText:t,createSvgz:!0,filename:e})});if(!r.ok)throw Error("Failed to create svgz");let n=await r.blob();(0,S.WN)(n,"".concat(e,".svgz"))}else{let r="optimized"===d,n=!i&&!s,a="original"===d,o=await O(t,r,n,a),c=(0,S.t$)(o),l=document.createElement("a");l.href=c,l.download="".concat(e,".svg"),document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(c)}F(n)}V(!1);let e=l;"vector"===l?e=u:"jpg"===l?e=m:"svg"===l?"optimized"===d?e="optimized":"svgz"===d&&(e="svgz"):"react"===l?e="react-".concat(p):"react-native"===l?e="react-native-".concat(g):"data-uri"===l?e="data-uri-".concat(h):"html-css"===l&&(e=f),Y("download",e)}catch(e){console.error("Download failed:",e),N.o.error("Download failed. Please try again.")}finally{M(!1)}},[E,t,l,b,y,v,C,x,r,n,o,m,k,u,p,g,f,d,i,s,O,F,V,h]),T=(0,a.useCallback)(async()=>
1{if(!E)try{let e,t;if(M(!0),"custom"===b)e=y,t=v;else{let r=C(x);e=r.width,t=r.height}let r=k("png",e,t);await Q(r),L(!0),setTimeout(()=>L(!1),2e3),Y("copy","png")}catch(e){console.error("Error copying PNG:",e),N.o.error("Failed to copy PNG. Please try again.")}finally{M(!1)}},[E,k,b,y,v,C,x]),_=(0,a.useCallback)(async()=>{if(!E&&t)try{M(!0);let e="optimized"===d,r=!i&&!s,n="original"===d,a=await O(t,e,r,n),o=await (0,S.xD)(a);L(!0),setTimeout(()=>L(!1),2e3),o.message&&console.log("Copy success:",o.message),Y("copy","svg")}catch(e){console.error("Error copying SVG:",e),N.o.error("Failed to copy SVG. Please try again.")}finally{M(!1)}},[E,t,d,i,s,O]),K=(0,a.useCallback)(async()=>{if(!E&&t)try{M(!0);let e=await z(t,{format:p,reactNative:!1,optimize:!0,componentName:"SvgComponent"});await navigator.clipboard.writeText(e.code),L(!0),setTimeout(()=>L(!1),2e3),Y("copy","react-".concat(p))}catch(e){console.error("Error copying React code:",e),N.o.error(e instanceof Error?e.message:"Failed to copy React code. Please try again.")}finally{M(!1)}},[E,t,p]),ee=(0,a.useCallback)(async()=>{if(!E&&t)try{M(!0);let e=await z(t,{format:g,reactNative:!0,optimize:!0,componentName:"SvgComponent"});await navigator.clipboard.writeText(e.code),L(!0),setTimeout(()=>L(!1),2e3),Y("copy","react-native-".concat(g))}catch(e){console.error("Error copying React Native code:",e),N.o.error(e instanceof Error?e.message:"Failed to copy React Native code. Please try again.")}finally{M(!1)}},[E,t,g]),et=(0,a.useCallback)(async()=>{if(!E&&t)try{let e;switch(M(!0),h){case"minified":e=await (0,R.Ph)(t);break;case"base64":e=(0,R.Tl)(t);break;case"encoded":e=(0,R.I)(t);break;default:throw Error("Invalid Data URI format")}if(!e)throw Error("Failed to generate Data URI");await navigator.clipboard.writeText(e),L(!0),setTimeout(()=>L(!1),2e3),Y("copy","data-uri-".concat(h))}catch(e){console.error("Error copying Data URI:",e),N.o.error("Failed to copy Data URI. Please try again.")}finally{M(!1)}},[E,t,h]),er=(0,a.useCallback)(async()=>{if(!E&&t)try{M(!0);let e=await I(t,{format:f,optimize:!0});await navigator.clipboard.writeText(e.code),L(!0),setTimeout(()=>L(!1),2e3),Y("copy",f)}catch(e){console.error("Error copying HTML/CSS:",e),N.o.error(e instanceof Error?e.message:"Failed to copy HTML/CSS. Please try again.")}finally{M(!1)}},[E,t,f]),en=(0,a.useCallback)(()=>{if("copy"===c)switch(l){case"png":return T;case"svg":default:return _;case"react":return K;case"react-native":return ee;case"data-uri":return et;case"html-css":return er}return D},[c,l,T,_,K,ee,et,er,D]);return{isProcessing:E,isSvgOptimizing:U,isCopySuccess:G,handleDownload:D,handleCopyPng:T,handleCopySvg:_,handleCopyReact:K,handleCopyReactNative:ee,handleCopyDataUri:et,handleCopyHtmlCss:er,getActionHandler:en}}({svgText:U,dimensions:P,generationId:p,filenamePrefix:h,isPaidUser:g,isCommunityGallery:x,mode:f,selectedFormat:T,svgOption:ec,selectedRasterFormat:eu,selectedVectorFormat:ex,selectedReactFormat:ev,selectedReactNativeFormat:ej,selectedDataUriFormat:eS,selectedHtmlCssFormat:eN,selectedSize:K,selectedSizeOption:ea,customWidth:eM,customHeight:eU,includeMetadata:eR,generationMetadata:G,getPresetDimensions:D,getCurrentRaster:O,trackSvgDownload:w,onOpenChange:r}),eA=!g&&!x||!g&&x&&y,eW=!j&&x,eq=("png"===T||"jpg"===T||"svg"===T||"vector"===T||"react"===T||"react-native"===T||"data-uri"===T)&&!g&&(!x||y);return(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.lG,{open:t,onOpenChange:r,children:(0,n.jsxs)(o.Cf,{className:"max-w-2xl w-full p-0 overflow-hidden max-sm:max-w-[95vw] max-sm:h-[95vh]",onInteractOutside:u.l,children:[(0,n.jsxs)(i.s,{children:[(0,n.jsx)(o.L3,{children:"copy"===f?"Copy SVG":"Download SVG"}),(0,n.jsxs)(o.rr,{children:["Choose your preferred format and settings to"," ","copy"===f?"copy":"download"," the SVG image."]})]}),(0,n.jsxs)("div",{className:"flex h-[520px] max-sm:flex-col max-sm:h-full",children:[(0,n.jsx)(ee,{selectedFormat:T,onFormatChange:_,mode:f}),(0,n.jsxs)("div",{className:"max-w-xs w-full flex-none p-6 flex flex-col max-sm:max-w-full max-sm:p-4 max-sm:flex-1",children:[(0,n.jsx)("h3",{className:"text-lg font-semibold text-foreground mb-4",children:(()=>{switch(T){case"png":return"PNG Sizes";case"jpg":return"More Raster Options";
1case"vector":return"More Vector Options";case"react":return"React Code Options";case"react-native":return"React Native Options";case"data-uri":return"Data URI Options";case"html-css":return"HTML/CSS Export Options";default:return"SVG Options"}})()}),(0,n.jsx)("div",{className:"flex-1 overflow-y-auto",children:(()=>{let e={isPaidUser:g,isCommunityGallery:x,isProImage:y};switch(T){case"vector":return(0,n.jsx)(eo,{...e,selectedVectorFormat:ex,onFormatChange:eb});case"jpg":return(0,n.jsx)(es,{...e,selectedRasterFormat:eu,onFormatChange:eg});case"png":return(0,n.jsx)(en,{...e,selectedSize:K,selectedSizeOption:ea,onSizeChange:et,onSizeOptionChange:ei,getPresetDimensions:D,customWidthInput:eP,customHeightInput:eG,onCustomWidthChange:ez,onCustomHeightChange:eL,onCustomWidthBlur:eI,onCustomHeightBlur:eO,isWatermarkFreeMode:eE,minCustomSize:16,maxCustomSize:4096});case"react":return(0,n.jsx)(el,{...e,selectedReactFormat:ev,onFormatChange:ew});case"react-native":return(0,n.jsx)(em,{...e,selectedReactNativeFormat:ej,onFormatChange:eC});case"data-uri":return(0,n.jsx)(ep,{...e,selectedDataUriFormat:eS,onFormatChange:ek});case"html-css":return(0,n.jsx)(eh,{...e,selectedHtmlCssFormat:eN,onFormatChange:eF});default:return(0,n.jsx)(er,{...e,svgOption:ec,onSvgOptionChange:ed,mode:f})}})()}),eq&&(0,n.jsx)(ef,{mode:f}),"svg"===T&&"original"===ec&&!eW&&!eA&&(0,n.jsxs)("label",{className:"mt-3 flex items-center gap-2 text-sm text-foreground cursor-pointer hover:text-foreground transition-colors",children:[(0,n.jsx)("input",{type:"checkbox",checked:eR,onChange:e=>eV(e.target.checked),className:"w-4 h-4 accent-primary focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background rounded"}),(0,n.jsx)("span",{children:"Include Image Metadata"})]})]})]}),(0,n.jsx)(ey,{mode:f,needsSignup:eW,needsUpgrade:eA,isCopySuccess:eB,isProcessing:eD,isSvgOptimizing:eT,isSvgLoading:L,onAction:eH(),onSignup:()=>{r(!1),M(!0)},onUpgrade:()=>{r(!1),C(),V.push("/#pricing")}})]})}),(0,n.jsx)(c.U,{isOpen:E,onClose:()=>M(!1)})]})}},95510:(e,t,r)=>{r.d(t,{EditorProvider:()=>i,h:()=>s});var n=r(95155),a=r(12115);let o=(0,a.createContext)(void 0);function i(e){let{children:t}=e,[r,i]=(0,a.useState)(!1);return(0,n.jsx)(o.Provider,{value:{isFullScreenEditorOpen:r,setFullScreenEditorOpen:e=>{i(e)},closeFullScreenEditor:()=>{i(!1)}},children:t})}function s(){let e=(0,a.useContext)(o);if(void 0===e)throw Error("useEditor must be used within an EditorProvider");return e}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.