1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["6522"],{462776(e,r,t){t.d(r,{A:()=>a});let a=(0,t(417495).A)("hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]])},24725(e,r,t){t.d(r,{A:()=>a});let a=(0,t(417495).A)("mouse-pointer-2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]])},614381(e,r,t){t.d(r,{A:()=>a});let a=(0,t(417495).A)("octagon-alert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]])},843398(e,r,t){t.d(r,{A:()=>a});let a=(0,t(417495).A)("pipette",[["path",{d:"m12 9-8.414 8.414A2 2 0 0 0 3 18.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 3.828 21h1.344a2 2 0 0 0 1.414-.586L15 12",key:"1y3wsu"}],["path",{d:"m18 9 .4.4a1 1 0 1 1-3 3l-3.8-3.8a1 1 0 1 1 3-3l.4.4 3.4-3.4a1 1 0 1 1 3 3z",key:"110lr1"}],["path",{d:"m2 22 .414-.414",key:"jhxm08"}]])},60282(e,r,t){t.d(r,{A:()=>a});let a=(0,t(417495).A)("redo-2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]])},361072(e,r,t){t.d(r,{A:()=>a});let a=(0,t(417495).A)("undo-2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]])},450510(e,r,t){t.d(r,{A:()=>a});let a=(0,t(417495).A)("zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]])},443211(e,r,t){t.d(r,{d:()=>processNegativeSpace});var a=t(567319);function _array_like_to_array(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=Array(r);t<r;t++)a[t]=e[t];return a}function _array_with_holes(e){if(Array.isArray(e))return e}function _array_without_holes(e){if(Array.isArray(e))return _array_like_to_array(e)}function _iterable_to_array(e){if("u">typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _iterable_to_array_limit(e,r){var t,a,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),!r||o.length!==r);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}function _non_iterable_rest(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _non_iterable_spread(){throw TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array(e,r){return _array_with_holes(e)||_iterable_to_array_limit(e,r)||_unsupported_iterable_to_array(e,r)||_non_iterable_rest()}function _to_consumable_array(e){return _array_without_holes(e)||_iterable_to_array(e)||_unsupported_iterable_to_array(e)||_non_iterable_spread()}function _unsupported_iterable_to_array(e,r){if(e){if("string"==typeof e)return _array_like_to_array(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _array_like_to_array(e,r)}}function calculateThresholdFromSensitivity(e){return 0===e?2:Math.max(0,Math.min(50,.5*e))}function parseHexColor(e){var r=e.trim();if("#"!==r[0]&&(r="#".concat(r)),!/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(r))throw Error("Invalid hex color");
1if(4===r.length){var t=r[1],a=r[2],n=r[3];r="#".concat(t).concat(t).concat(a).concat(a).concat(n).concat(n)}return{r:parseInt(r.slice(1,3),16),g:parseInt(r.slice(3,5),16),b:parseInt(r.slice(5,7),16)}}function srgb2lin(e){var r=e/255;return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function rgb2xyz(e,r,t){var a=srgb2lin(e),n=srgb2lin(r),o=srgb2lin(t);return{X:.4124564*a+.3575761*n+.1804375*o,Y:.2126729*a+.7151522*n+.072175*o,Z:.0193339*a+.119192*n+.9503041*o}}function xyz2lab(e,r,t){var a=e/.95047,n=r/1,o=t/1.08883,i=24389/27,l=a>216/24389?Math.cbrt(a):(i*a+16)/116,s=n>216/24389?Math.cbrt(n):(i*n+16)/116;return{L:116*s-16,a:500*(l-s),b:200*(s-(o>216/24389?Math.cbrt(o):(i*o+16)/116))}}function rgb2lab(e,r,t){var a=rgb2xyz(e,r,t);return xyz2lab(a.X,a.Y,a.Z)}function deltaE76(e,r){var t=e.L-r.L,a=e.a-r.a,n=e.b-r.b;return Math.sqrt(t*t+a*a+n*n)}function deltaE2000(e,r){var t,a,n=e.L,o=e.a,i=e.b,l=r.L,s=r.a,u=r.b,c=Math.pow((Math.hypot(o,i)+Math.hypot(s,u))/2,7),d=.5*(1-Math.sqrt(c/(c+0x16bcc41e9))),f=(1+d)*o,h=(1+d)*s,m=Math.hypot(f,i),b=Math.hypot(h,u),p=180*Math.atan2(i,f)/Math.PI+360*(0>Math.atan2(i,f)),y=180*Math.atan2(u,h)/Math.PI+360*(0>Math.atan2(u,h));if(m*b==0)t=0;else{var g=y-p;t=180>=Math.abs(g)?g:g>180?g-360:g+360}var _=2*Math.sqrt(m*b)*Math.sin(t*Math.PI/360),v=(n+l)/2,x=(m+b)/2;if(m*b==0)a=p+y;else{var w=p+y;a=180>=Math.abs(p-y)?w/2:(w+(w<360?360:-360))/2}var k=1-.17*Math.cos((a-30)*Math.PI/180)+.24*Math.cos(2*a*Math.PI/180)+.32*Math.cos((3*a+6)*Math.PI/180)-.2*Math.cos((4*a-63)*Math.PI/180),j=-(2*Math.sqrt(Math.pow(x,7)/(Math.pow(x,7)+0x16bcc41e9)))*Math.sin(2*(30*Math.exp(-Math.pow((a-275)/25,2)))*Math.PI/180),C=(l-n)/(1+.015*Math.pow(v-50,2)/Math.sqrt(20+Math.pow(v-50,2))),A=(b-m)/(1+.045*x),S=_/(1+.015*x*k);return Math.sqrt(C*C+A*A+S*S+j*A*S)}function findDominantColors(e){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:function(){},o=e.width,i=e.height,l=e.data,s=[],u=[],c=0;c<i;c+=t)for(var d=0;d<o;d+=t){var f,h,m,b=(0,a.v)(d,c,o);if(0!==l[b+3]){var p=rgb2lab(null!=(f=l[b])?f:0,null!=(h=l[b+1])?h:0,null!=(m=l[b+2])?m:0);u.push(p)}}if(n("â Collect sampled pixels"),0===u.length)return s;var y=[],g=u[Math.floor(Math.random()*u.length)];g&&y.push(g);for(var _=1;_<Math.min(r,u.length);_+=1){for(var v=u.map(function(e){var r,t=(r=Math).min.apply(r,_to_consumable_array(y.map(function(r){return deltaE2000(e,r)})));return t*t}),x=Math.random()*v.reduce(function(e,r){return e+r},0),w=0,k=0;k<v.length;k+=1){var j=v[k];if(void 0!==j&&(x-=j)<=0){w=k;break}}var C=u[w];C&&y.push(C)}n("â Initialize cluster centers");for(var A=Array(u.length),S=Array(y.length),N=0;N<10;N+=1){for(var I=0;I<y.length;I+=1)S[I]={L:0,a:0,b:0,count:0};for(var M=0;M<u.length;M+=1){var T=u[M];if(T){for(var P=1/0,D=0,E=0;E<y.length;E+=1){var O=y[E];if(O){var R=deltaE2000(T,O);R<P&&(P=R,D=E)}}A[M]=D;var z=S[D];z&&(z.L+=T.L,z.a+=T.a,z.b+=T.b,z.count+=1)}}for(var L=!1,B=0;B<y.length;B+=1){var U=S[B],H=y[B];if(U&&H&&U.count>0){var F={L:U.L/U.count,a:U.a/U.count,b:U.b/U.count};deltaE2000(H,F)>.1&&(L=!0),y[B]=F}}if(!L)break}n("â Run k-means iterations");for(var $=Array(y.length).fill(0),q=0;q<i;q+=1)for(var G=0;G<o;G+=1){var W,K,V,Z,Q=(0,a.v)(G,q,o);if(0!==l[Q+3]){for(var X=rgb2lab(null!=(W=l[Q])?W:0,null!=(K=l[Q+1])?K:0,null!=(V=l[Q+2])?V:0),Y=1/0,J=0,ee=0;ee<y.length;ee+=1){var er=y[ee];if(er){var et=deltaE2000(X,er);et<Y&&(Y=et,J=ee)}}var ea=null!=(Z=$[J])?Z:0;$[J]=ea+1}}n("â Count actual pixels per cluster");for(var en=$.reduce(function(e,r){return e+r},0),eo=0;eo<y.length;eo+=1){var ei=$[eo],el=y[eo];ei&&ei>0&&el&&s.push({centroidLab:el,pixelCount:ei,percentage:ei/en*100})}return s.sort(function(e,r){return r.pixelCount-e.pixelCount}),n("â Create and sort final clusters"),s}function findNearestImageColor(e,r){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:18,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:500,n=null,o=1/0,i=!0,l=!1,s=void 0;try{for(var u,c=r[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var d=u.value;if(!(d.pixelCount<a)){var f=deltaE2000(e,d.centroidLab);f<=t&&f<o&&(o=f,n=d)}}}catch(e){l=!0,s=e}finally{try{i||null==c.return||c.return()}finally{if(l)throw s}}return n?n.centroidLab:null}function findNearTargetColor(e,r){for(var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e5,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:500,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:function(){}
1,l=e.width,s=e.height,u=e.data,c=Math.max(1,Math.ceil(Math.sqrt(l*s/t))),d=[],f=0,h=0;h<s;h+=c)for(var m=0;m<l;m+=c){var b,p,y,g=(0,a.v)(m,h,l);if(0!==u[g+3]){f+=1;var _=rgb2lab(null!=(b=u[g])?b:0,null!=(p=u[g+1])?p:0,null!=(y=u[g+2])?y:0);deltaE76(_,r)<=n&&d.push(_)}}if(i("â Fast near-target sampling"),d.length<o)return null;var v=Math.floor(.2*d.length);d.sort(function(e,r){return e.L-r.L});for(var x=0,w=0,k=0,j=0,C=v;C<d.length-v;C+=1){var A=d[C];A&&(x+=A.L,w+=A.a,k+=A.b,j+=1)}if(0===j)return null;var S={L:x/j,a:w/j,b:k/j};return S}function findConnectedComponents(e,r,t){var a=new Uint32Array(r*t),n=1;function floodFill(n,o,i){for(var l=[[n,o]],s=0;l.length>0;){var u=_sliced_to_array(l.pop(),2),c=u[0],d=u[1];if(!(c<0)&&!(c>=r)&&!(d<0)&&!(d>=t)){var f=d*r+c;0===e[f]&&0===a[f]&&(a[f]=i,s+=1,l.push([c+1,d],[c-1,d],[c,d+1],[c,d-1]))}}return s}for(var o=new Map,i=0;i<t;i+=1)for(var l=0;l<r;l+=1){var s=i*r+l;if(0===e[s]&&0===a[s]){var u=floodFill(l,i,n);o.set(n,u),n+=1}}return{labels:a,componentAreas:o}}function removeSmallComponents(e){for(var r=e.mask,t=e.width,a=e.minArea,n=r.length/t,o=findConnectedComponents(r,t,n),i=o.labels,l=o.componentAreas,s=new Uint8Array(r),u=0;u<t*n;u+=1){var c=i[u];if(void 0!==c&&c>0){var d=l.get(c);void 0!==d&&d<a&&(s[u]=1)}}return s}function processNegativeSpace(e){var r=performance.now(),printDuration=function(e){};if(!e.imageData)throw Error("Invalid input: imageData is required");if(!e.targetHexColor)throw Error("Invalid input: targetHexColor is required");var t=e.imageData,a=t.width,n=t.height,o=t.data;if(a<=0||n<=0)throw Error("Invalid input: image dimensions must be positive");printDuration("Validate inputs");try{k=parseHexColor(e.targetHexColor),j=rgb2lab(k.r,k.g,k.b)}catch(r){throw Error("Invalid hex color: ".concat(e.targetHexColor))}printDuration("Parse hex color and convert to Lab");var i=void 0!==e.sensitivity?e.sensitivity:25,l=calculateThresholdFromSensitivity(i);printDuration("Calculate threshold");var s=j,u=!1;1;var c,d=null;1;d=findNearTargetColor(e.imageData,j,1e5,10,500,printDuration);d&&(s=d,u=!0);printDuration("Hybrid color selection");var f={baseToleranceÎE00:6+4*((w=s).L/100),featherWidthÎE00:1+.5*(w.L/100),minAreaPixels:Math.round(80+40*(w.L/100))},h=f.featherWidthÎE00,m=f.minAreaPixels;printDuration("Calculate adaptive params");var b=new ImageData(new Uint8ClampedArray(o),a,n),p=b.data;printDuration("Create working copy of image data");for(var y=new Uint8Array(a*n),g=0;g<a*n;g+=1)y[g]=1;for(var _=0,v=0;v<n;v+=1)for(var x=0;x<a;x+=1){var w,k,j,C,A,S,N=v*a+x,I=4*N,M=p[I+3];0!==M&&(_+=1,deltaE2000(rgb2lab(null!=(C=p[I])?C:0,null!=(A=p[I+1])?A:0,null!=(S=p[I+2])?S:0),s)<=l&&(y[N]=0))}printDuration("Compute distances and apply threshold");var T=y;if(printDuration("Apply morphological operations"),T=removeSmallComponents({mask:T,width:a,minArea:m}),printDuration("Remove small components"),h>0){for(var P=new Float32Array(a*n),D=1;D<n-1;D+=1)for(var E=1;E<a-1;E+=1){var O=D*a+E;if(0===T[O]){for(var R=!1,z=-1;z<=1;z+=1){for(var L=-1;L<=1;L+=1)if((0!==L||0!==z)&&1===T[(D+z)*a+(E+L)]){R=!0;break}if(R)break}if(R){var B,U,H,F=Math.max(0,Math.min(1,(l-deltaE2000(rgb2lab(null!=(B=p[4*O])?B:0,null!=(U=p[4*O+1])?U:0,null!=(H=p[4*O+2])?H:0),s))/h));P[O]=1-F}else P[O]=0}else P[O]=1}for(var $=0;$<a*n;$+=1)if(0===T[$]){var q,G,W=null!=(q=p[4*$+3])?q:255,K=null!=(G=P[$])?G:1;p[4*$+3]=Math.round(W*K)}}else for(var V=0;V<a*n;V+=1)0===T[V]&&(p[4*V+3]=0);printDuration("Apply feathering");for(var Z=0,Q=0;Q<a*n;Q+=1)0===T[Q]&&(Z+=1);printDuration("Count final removed pixels");var X={removedPixelCount:Z,eligiblePixelCount:_,targetColorLab:j,effectiveThreshold:l,effectiveTargetLab:s,wasColorSnapped:u,sensitivity:i};return u&&(X.snapDistance=deltaE2000(j,s)),printDuration("Total processing time"),{imageData:b,mask:T,stats:X}}},478668(e,r,t){t.d(r,{V:()=>RefineActionBar});var a=t(483134),n=t(361072),o=t(60282),i=t(399769),l=t(449252),s=t(861016),u=t(479126),c=t(60307),d=t(807258);function asyncGeneratorStep(e,r,t,a,n,o,i){try{var l=e[o](i),s=l.value}catch(e){t(e);return}l.done?r(s):Promise.resolve(s).then(a,n)}function _async_to_generator(e){return function(){var r=this,t=arguments;return new Promise(function(a,n){var o=e.apply(r,t);function _next(e){asyncGeneratorStep(o,a,n,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(o,a,n,_next,_throw,"throw",e)}_next(void 0)})}}function _instanceof(e,r){return null!=r&&"u">typeof Symbol&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](e):e instanceof r}function _ts_generator(e,r){var t,a,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:verb(0)}),l(i,"throw",{value:verb(1)}),l(i,"return",{value:verb(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function verb(e){return function(r){return step([e,r])}}function step(l){if(t)throw TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(t=1,a&&(n=2&l[0]?a.return:l[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,l[1])).done)return n;switch(a=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,a=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){o.label=l[1];break}if(6===l[0]&&o.label<n[1]){o.label=n[1],n=l;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(l);break}n[2]&&o.ops.pop(),o.trys.pop();continue}l=r.call(e,o)}catch(e){l=[6,e],a=0}finally{t=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function RefineActionBar(e){var r=e.onCancel,t=e.onConfirm,f=e.placement,h=(0,i.uz)(),m=h.hasHistory,b=h.currentOperation,p=h.currentImageData,y=h.canUndo,g=h.canRedo,_=h.undo,v=h.redo,x=(0,u.Q)().isDesktop,w="back"===f?"back":"front",k=(0,i.sm)({side:w}),j=k.source,C=k.artworkId,A=(0,s.I)(w),S=m&&(null==b?void 0:b.type)!=="baseline"&&!A.isPending;return(0,a.jsxs)("div",{className:"absolute bottom-0 left-0 right-0 z-10 flex items-center justify-between bg-white p-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(d.$,{onPress:function(){C&&(0,c.Nw)(C),_()},isDisabled:!y||A.isPending,className:"box-border flex items-center justify-center rounded-lg border border-blue-700 bg-white px-3 py-2.5 text-base leading-6 text-blue-700 transition-all hover:bg-gray-50 disabled:cursor-not-allowed disabled:border-transparent disabled:bg-gray-100 disabled:text-gray-600 disabled:opacity-70 ".concat(x?"":"aspect-square"),"data-testid":"refine-undo","aria-label":"Undo (Cmd/Ctrl + Z)",size:"lg",variant:x?"outline":"icon",children:[(0,a.jsx)(n.A,{className:"size-5"}),x&&(0,a.jsx)("span",{className:"text-sm",children:"Undo"})]}),(0,a.jsxs)(d.$,{onPress:function(){C&&(0,c.VB)(C),v()},isDisabled:!g||A.isPending,className:"box-border flex items-center justify-center rounded-lg border border-blue-700 bg-white px-3 py-2.5 text-base leading-6 text-blue-700 transition-all hover:bg-gray-50 disabled:cursor-not-allowed disabled:border-transparent disabled:bg-gray-100 disabled:text-gray-600 disabled:opacity-70 ".concat(x?"":"aspect-square"),"data-testid":"refine-redo","aria-label":"Redo (Cmd/Ctrl + Shift + Z)",size:"lg",variant:x?"outline":"icon",children:[(0,a.jsx)(o.A,{className:"size-5"}),x&&(0,a.jsx)("span",{className:"text-sm",children:"Redo"})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(d.$,{"data-testid":"refine-cancel-button",variant:"link",className:"text-blue-700 no-underline hover:text-blue-800 hover:no-underline",onPress:function(){C&&(0,c.ub)(C),r()},isDisabled:A.isPending,children:"Cancel"}),(0,a.jsx)(d.$,{"data-testid":"refine-confirm-changes-button",className:"bg-blue-700 text-white hover:bg-blue-800 disabled:bg-blue-700/50",onPress:function(){return _async_to_generator(function(){var e,r,a,n,o,i,s,u;return _ts_generator(this,function(d){switch(d.label){case 0:if(!S||!(e=("full_enhancements"===j.enhancementTier?j.enhancedImage:null)?Number(C):void 0))return[2];d.label=1;case 1:if(d.trys.push([1,7,,8]),!(m&&p))return[3,4];return[4,fetch(p)];case 2:return[4,d.sent().blob()];case 3:return a=d.sent(),r={dtf_artwork_id:e,image:a,manual_edit:!0,remove_background:!1,start_new_edit:!1},[3,5];case 4:r={dtf_artwork_id:e,manual_edit:!1,remove_background:!1,start_new_edit:!1},d.label=5;case 5:return[4,A.mutateAsync(r)];case 6:return d.sent(),(0,c.Hp)(e),t(),[3,8];case 7:return console.error("Failed to save refine changes:",n=d.sent()),u=null!=(o=(0,l.d7)(n)?null==(s=n.response)||null==(i=s.data)?void 0:i.error:void 0)?o:_instanceof(n,Error)?n.message:String(n),(0,c.Hp)(e,u),(0,c.Ti)("refine_action_bar",u,{error:n,artworkId:e,component:"RefineActionBar"}),[3,8];case 8:return[2]}})})()},isDisabled:!S,children:A.isPending?"Saving...":"Confirm Changes"})]})]})}},972468(e,r,t){t.r(r),t.d(r,{RefineArtboard:()=>RefineArtboard});var a=t(483134),n=t(492624),o=t(293534),i=t(399769),l=t(816103),s=t(479126),u=t(60307),c=t(75236),d=t(502139),f=t(478668),h=t(72799),m=t(514281),b=t(358015),p=t(728590),y=t(624268);function _array_like_to_array(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=Array(r);t<r;t++)a[t]=e[t];return a}function _array_with_holes(e){if(Array.isArray(e))return e}function _iterable_to_array_limit(e,r){var t,a,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),!r||o.length!==r);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}function _non_iterable_rest(){throw TypeError("Invalid attempt to de
1structure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array(e,r){return _array_with_holes(e)||_iterable_to_array_limit(e,r)||_unsupported_iterable_to_array(e,r)||_non_iterable_rest()}function _unsupported_iterable_to_array(e,r){if(e){if("string"==typeof e)return _array_like_to_array(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _array_like_to_array(e,r)}}function RefineArtboard(e){var r=e.frontSurface,t=e.referenceBoundingBox,g=e.surface,_=e.enhancedImage,v=e.placement,x=_sliced_to_array((0,n.fp)(i.hM),2),w=x[0],k=x[1],j=_sliced_to_array((0,n.fp)(i.gP),2),C=j[0],A=j[1],S=_sliced_to_array((0,n.fp)(i.js),2),N=S[0],I=S[1],M=(0,l._8)(),T=M.zoom,P=M.setZoom,D=M.pan,E=M.setPan,O=(0,n.Xr)(i.gD),R=_sliced_to_array((0,o.useState)(null),2),z=R[0],L=R[1],B=(0,s.Q)().isDesktop,U=(0,c.M8)(),H=_sliced_to_array((0,o.useState)("erase"),2),F=H[0],$=H[1],q=(0,i.sm)({side:"back"===v?"back":"front"}).artworkId,G=(0,o.useRef)(!1),W=(0,n.md)(i.x0),K=(0,o.useCallback)(function(e){L(e)},[]),V=(0,o.useMemo)(function(){if(z){var e=g.boundingBox,r=z.scale,t=z.offsetX,a=z.offsetY;return{left:e.left*r+t,top:e.top*r+a,width:e.width*r,height:e.height*r}}},[g,z]);return((0,o.useEffect)(function(){"erase"!==F&&O(!1)},[F,O]),(0,o.useEffect)(function(){if(!w){G.current=!1;return}A({zoom:T,pan:D,backgroundType:N}),P(2),E({x:0,y:0}),q&&!G.current&&((0,u.oe)(q),G.current=!0)},[w,q]),w)?(0,a.jsx)(i.pS,{children:(0,a.jsx)("div",{className:B?"absolute inset-0 z-40":"bg-background fixed inset-0 z-50",children:(0,a.jsx)(d.Zp,{className:"h-full flex-1 overflow-hidden rounded-none lg:rounded-xl",children:(0,a.jsxs)(d.Wu,{className:"relative h-full p-0",children:[B?(0,a.jsx)(b.q,{backgroundType:N,onBackgroundTypeChange:I,activeTool:F,onToolChange:$}):(0,a.jsx)(p.$,{activeTool:F,onToolChange:$}),(0,a.jsx)(m.u,{surface:g,referenceBoundingBox:t,placement:v,artworkImage:null==_?void 0:_.image,frontSurface:r,backgroundType:N,activeTool:F,onShirtLoad:K,interactionMode:W,artworkId:q}),(0,a.jsx)(y.Te,{isActive:"erase"===F}),(0,a.jsx)(y.Uc,{isActive:"negative"===F,artworkId:q}),U&&V&&(0,a.jsx)(y.W8,{isActive:"refine"===F,artworkId:q,printableArea:V}),!B&&(0,a.jsx)(h.c,{backgroundType:N,onBackgroundTypeChange:I,maxZoom:10}),(0,a.jsx)(f.V,{onCancel:function(){C&&(P(C.zoom),E(C.pan),I(C.backgroundType)),k(!1)},onConfirm:function(){k(!1)},placement:v})]})})})}):null}},72799(e,r,t){t.d(r,{c:()=>RefineBottomToolbar});var a=t(483134),n=t(492624),o=t(399769),i=t(167456),l=t(674723),s=t(320344);function _array_like_to_array(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=Array(r);t<r;t++)a[t]=e[t];return a}function _array_with_holes(e){if(Array.isArray(e))return e}function _iterable_to_array_limit(e,r){var t,a,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),!r||o.length!==r);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}function _non_iterable_rest(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array(e,r){return _array_with_holes(e)||_iterable_to_array_limit(e,r)||_unsupported_iterable_to_array(e,r)||_non_iterable_rest()}function _unsupported_iterable_to_array(e,r){if(e){if("string"==typeof e)return _array_like_to_array(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _array_like_to_array(e,r)}}function RefineBottomToolbar(e){var r=e.backgroundType,t=e.onBackgroundTypeChange,u=e.maxZoom,c=_sliced_to_array((0,n.fp)(o.x0),2),d=c[0],f=c[1];return(0,a.jsxs)("div",{className:"bottom-14.5 absolute left-0 right-0 z-10 flex items-center justify-between px-4",children:[(0,a.jsx)(i.F,{value:r,onValueChange:t,forceFullWidth:!0}),(0,a.jsx)(l._,{value:d,onValueChange:f}),(0,a.jsx)(s.R,{maxZoom:void 0===u?10:u})]})}},715201(e,r,t){t.d(r,{S:()=>RefineBrushSizeSlider});var a=t(483134),n=t(492624),o=t(293534),i=t(399769);function RefineBrushSizeSlider(e){var r=e.brushSize,t=e.onBrushSizeChange,l=(0,n.Xr)(i.gD),s=(0,o.useRef)(!1);(0,o.useEffect)(function(){var handleMouseUp=function(){s.current&&(s.current=!1,l(!1))};return window.addEventListener("mouseup",handleMouseUp),window.addEventListener("touchend",handleMouseUp),function(){window.removeEventListener("mouseup",handleMouseUp),window.removeEventListener("touchend",handleMouseUp),l(!1)}},[l]);var handleMouseDown=function(){s.current=!0,l(!0)};return(0,a.jsx)("div",{onMouseEnter:function(){l(!0)},onMouseLeave:function(){s.current||l(!1)},children:(0,a.jsxs)("div",{className:"flex gap-2 rounded-b-lg p-2 px-4",children:[(0,a.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,a.jsx)("label",{htmlFor:"refine-erase-brush-size","data-testid":"refine-erase-brush-size-label",className:"text-xs font-medium text-gray-700",children:"Brush Size"}),(0,a.jsx)("input",{"data-testid":"refine-erase-brush-size",id:"refine-erase-brush-size",type:"range",min:1,max:100,step:1,value:r,onChange:function(e){return t(Number(e.target.value))},onMouseDown:handleMouseDown,onTouchStart:handleMouseDown,className:"design-lab-slider h-1 w-60 cursor-pointer appearance-none rounded-full bg-gray-200",style:{background:"linear-gradient(to right, #3b82f6 0%, #3b82f6 ".concat((r-1)/99*100,"%, #e5e7eb ").concat((r-1)/99*100,"%, #e5e7eb 100%)")}})]}),(0,a.jsx)("div",{className:"flex h-8 w-12 items-center justify-center rounded border border-gray-300 bg-gray-50 text-sm font-medium text-gray-800",children:r})]})})}},514281(e,r,t){t.d(r,{u:()=>RefineCanvasWithKeyboardShortcuts});var a=t(483134),n=t(816103),o=t(704685);function _define_property(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _object_spread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},a=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.forEach(function(r){_define_property(e,r,t[r])})}return e}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,a)}return t}function _object_spread_props(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEac
1h(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function RefineCanvasWithKeyboardShortcuts(e){var r=e.surface,t=e.referenceBoundingBox,i=e.placement,l=e.artworkImage,s=e.frontSurface,u=e.backgroundType,c=e.activeTool,d=e.onShirtLoad,f=e.interactionMode,h=e.artworkId,m=(0,o.P)(h).isSpaceHeld;return(0,a.jsx)(n.Hl,_object_spread_props(_object_spread(_object_spread_props(_object_spread({surface:r,referenceBoundingBox:t,placement:i,readonly:!1,artworkImage:l,onArtworkRemove:function(){}},s&&{frontSurface:s}),{backgroundType:u}),c&&{activeTool:c}),{onShirtLoad:d,interactionMode:f,isSpaceHeld:m}))}},358015(e,r,t){t.d(r,{q:()=>RefineDesktopControls});var a=t(483134),n=t(492624),o=t(399769),i=t(167456),l=t(674723),s=t(494867),u=t(320344);function _array_like_to_array(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=Array(r);t<r;t++)a[t]=e[t];return a}function _array_with_holes(e){if(Array.isArray(e))return e}function _iterable_to_array_limit(e,r){var t,a,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),!r||o.length!==r);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}function _non_iterable_rest(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array(e,r){return _array_with_holes(e)||_iterable_to_array_limit(e,r)||_unsupported_iterable_to_array(e,r)||_non_iterable_rest()}function _unsupported_iterable_to_array(e,r){if(e){if("string"==typeof e)return _array_like_to_array(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _array_like_to_array(e,r)}}function RefineDesktopControls(e){var r=e.backgroundType,t=e.onBackgroundTypeChange,c=e.activeTool,d=e.onToolChange,f=_sliced_to_array((0,n.fp)(o.x0),2),h=f[0],m=f[1];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(s.Q,{activeTool:c,onToolChange:d}),(0,a.jsxs)("div",{className:"pointer-events-auto absolute bottom-16 left-0 right-0 z-10 flex items-center justify-between px-6",children:[(0,a.jsx)(i.F,{value:r,onValueChange:t,forceFullWidth:!0}),(0,a.jsx)(l._,{value:h,onValueChange:m}),(0,a.jsx)(u.R,{maxZoom:10})]})]})}},728590(e,r,t){t.d(r,{$:()=>RefineHeader});var a=t(483134),n=t(494867);function RefineHeader(e){var r=e.activeTool,t=e.onToolChange;return(0,a.jsxs)("div",{className:"absolute left-0 right-0 top-0 z-10 flex flex-col",children:[(0,a.jsxs)("div",{className:"flex w-full items-center justify-between bg-white p-2 shadow-md",children:[(0,a.jsx)("div",{className:"flex-1",children:(0,a.jsx)("h2",{className:"text-lg font-medium text-gray-800",children:"Edit Artwork"})}),(0,a.jsx)("div",{className:"flex flex-1 justify-end"})]}),(0,a.jsx)("div",{className:"mt-2 w-full px-4",children:(0,a.jsx)(n.Q,{activeTool:r,onToolChange:t})})]})}},674723(e,r,t){t.d(r,{_:()=>RefineModeSelector});var a=t(483134),n=t(24725),o=t(462776),i=t(293534),l=t(60307),s=t(165980);function _array_like_to_array(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=Array(r);t<r;t++)a[t]=e[t];return a}function _array_with_holes(e){if(Array.isArray(e))return e}function _iterable_to_array_limit(e,r){var t,a,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),!r||o.length!==r);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}function _non_iterable_rest(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array(e,r){return _array_with_holes(e)||_iterable_to_array_limit(e,r)||_unsupported_iterable_to_array(e,r)||_non_iterable_rest()}function _unsupported_iterable_to_array(e,r){if(e){if("string"==typeof e)return _array_like_to_array(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _array_like_to_array(e,r)}}function RefineModeSelector(e){var r=e.value,t=e.onValueChange,u=[{id:"cursor",icon:n.A,label:"Cursor"},{id:"pan",icon:o.A,label:"Pan"}],c=(0,i.useCallback)(function(e){var r=_sliced_to_array(e,1)[0];if(r){var a=String(r);(0,l.LU)(a),t(a)}},[t]);return(0,a.jsx)("div",{className:"bg-background flex items-center gap-1 rounded-md border p-1 shadow-sm",children:(0,a.jsx)(s.O,{selectionMode:"single",disallowEmptySelection:!0,selectedKeys:[r],onSelectionChange:c,size:"sm",children:u.map(function(e){var r=e.id,t=e.icon,n=e.label;return(0,a.jsx)(s.d,{id:r,"aria-label":n,"data-testid":"refine-mode-".concat(r),children:(0,a.jsx)(t,{className:"size-5"})},r)})})})}},494867(e,r,t){t.d(r,{Q:()=>RefineToolTabs});var a=t(483134),n=t(492624),o=t(293534),i=t(997252),l=t(479126),s=t(75236),u=t(762855),c=t(399769);function RefineToolTabs(e){var r=e.activeTool,t=e.onToolChange,d=(0,n.md)(c.P2),f=(0,l.Q)().isDesktop,h=(0,s.M8)(),m=(0,o.useMemo)(function(){var e=[{id:"erase",label:"Erase",testId:"refine-tab-erase"},{id:"negative",label:"Remove Color",testId:"refine-tab-negative"}];return h&&e.push({id:"refine",label:"Edit Artwork",testId:"refine-tab-ai"}),e},[h]);return(0,a.jsx)("div",{className:(0,i.cn)("z-10 w-full max-w-3xl",f&&"absolute left-1/2 top-2 w-[92%] -translate-x-1/2"),children:(0,a.jsx)(u.ah,{tabs:m,activeTab:r,onTabChange:t,className:(0,i.cn)(d&&"pointer-events-none opacity-50"),ariaLabel:"Refine tools"})})}},859189(e,r,t){t.d(r,{B:()=>PromptForm});var a=t(483134),n=t(361072),o=t(60282),i=t(468192),l=t(240930),s=t(967888);function PromptForm(e){var r=e.prompt,t=e.onPromptChange,u=e.onGenerate,c=e.isLoading,d=void 0!==c&&c,f=e.error,h=e.isRefineMode,m=void 0!==h&&h,b=e.canUndo,p=e.canRedo,y=e.onUndo,g=e.onRedo,_=e.showCredits,v=(0,s.C)().aiCreditsBalance>0;return(0,a.jsxs)("div",{className:"flex flex-1 flex-col",children:[void 0!==_&&_?(0,a.jsx)(l.w$,{labelHtmlFor:"prompt"}):(0,a.jsx)("div",{className:"mb-1 flex items-center justify-between",children:(0,a.jsx)("label",{htmlFor:"prompt",className:"text-sm font-semibold leading-5 text-gray-700","data-testid":"prompt-label",children:"Your prompt"})}),(0,a.jsx)("textarea",{id:"prompt",value:r,onChange:function(e){return t(e.target.value)},placeholder:"e.g., A majestic lion wearing a crown, vintage comic book style",className:"mb-2 resize-none rounded-lg border border-gray-300 p-2 text-sm font-normal leading-5 placeholder-gray-400 focus:border-purple-500 focus:outline-none focus:ring-2 focus:ring-purple-200",rows:3,"data-testid":"prompt-textarea",autoFocus:!0}),(0,a.jsxs)("div",{className:"flex w-full items-center gap-2",children:[m&&y&&g&&(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)(i.$nd,{onPress:y,isDisabled:!(void 0!==b&&b)||d,className:"box-border flex h-11 items-center justify-center rounded-lg border border-blue-700 bg-white px-3 py-2.5 text-base leading-6 text-blue-700 transition-all hover:bg-gray-50 disabled:cursor-not-allowed disabled:border-transparent disabled:bg-gray-100 disabled:text-gray-400 disabled:opacity-50","data-testid":"undo-button","aria-label":"Undo (Cmd/Ctrl + Z)",children:(0,a.jsx)(n.A,{className:"size-5"})}),(0,a.jsx)(i.$nd,{onPress:g,isDisabled:!(void 0!==p&&p)||d,className:"box-border flex h-11 items-center justify-center rounded-lg border border-blue-700 bg-white px-3 py-2.5 text-base leading-6 text-blue-700 transition-all hover:bg-gray-50 disabled:cursor-not-allowed disabled:border-transparent disabled:bg-gray-100 disabled:text-gray-400 disabled:opacity-50","data-testid":"redo-button","aria-label":"Redo (Cmd/Ctrl + Shift + Z)",children:(0,a.jsx)(o.A,{className:"size-5"})})]}),(0,a.jsx)(i.$nd,{onPress:function(){r.trim()&&u(r)},isDisabled:!r.trim()||d||!v,className:"bg-cta-gradient hover:bg-cta-gradient-hover flex h-11 flex-1 items-center justify-center gap-2 rounded-lg py-2.5 text-center text-base font-semibold leading-6 text-white transition-all disabled:cursor-not-allowed disabled:opacity-70","data-testid":"generate-button",children:(0,l.RC)({isLoading:d,hasCredits:v,actionText:m?"Edit Artwork":"Generate",loadingText:m?"Thinking...":"Generating..."})})]}),(0,a.jsx)(l.Kw,{error:void 0===f?void 0:f,showNoCreditsMessage:!v})]})}},393662(e,r,t){t.d(r,{A:()=>RefinementFormMobile});var a=t(483134),n=t(361072),o=t(60282),i=t(468192),l=t(240930),s=t(967888);function RefinementFormMobile(e){var r=e.prompt,t=e.onPromptChange,u=e.onRefine,c=e.isLoading,d=void 0!==c&&c,f=e.error,h=e.canUndo,m=e.canRedo,b=e.onUndo,p=e.onRedo,y=(0,s.C)().aiCreditsBalance>0;return(0,a.jsxs)("div",{className:"flex flex-col",children:[(0,a.jsx)(l.w$,{labelHtmlFor:"refinement-prompt",testIdPrefix:"refinement"}),(0,a.jsx)("div",{className:"relative mx-0.5 mb-1 flex",children:(0,a.jsx)(i.TMX,{id:"refinement-prompt",value:r,onChange:function(e){return t(e.target.value)},placeholder:"e.g., A majestic lion wearing a crown, vintage comic book style",className:"box-border w-full resize-none rounded-lg border border-gray-300 p-2 text-base font-normal placeholder-gray-400 focus:border-purple-500 focus:outline-none focus:ring-2 focus:ring-purple-200",rows:3,"data-testid":"refinement-prompt-textarea",autoFocus:!0})}),(0,a.jsxs)("div",{className:"mx-0.5 mt-1 flex gap-2",children:[b&&p&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.$nd,{variant:"icon",onPress:b,isDisabled:!(void 0!==h&&h)||d,className:"box-border flex h-11 items-center justify-center rounded-lg border border-blue-700 bg-white px-3 py-2 text-sm text-blue-700 transition-all hover:bg-gray-50 disabled:cursor-not-allowed disabled:border-transparent disabled:bg-gray-100 disabled:text-gray-400 disabled:opacity-50","data-testid":"undo-button-mobile",children:(0,a.jsx)(n.A,{className:"size-5"})}),(0,a.jsx)(i.$nd,{variant:"icon",onPress:p,isDisabled:!(void 0!==m&&m)||d,className:"box-border flex h-11 items-center justify-center rounded-lg border border-blue-700 bg-white px-3 py-2 text-sm text-blue-700 transition-all hover:bg-gray-50 disabled:cursor-not-allowed disabled:border-transparent disabled:bg-gray-100 disabled:text-gray-400 disabled:opacity-50","data-testid":"redo-button-mobile",children:(0,a.jsx)(o.A,{className:"size-5"})})]}),(0,a.jsx)(i.$nd,{onPress:function(){r.trim()&&u(r)},isDisabled:!r.trim()||d||!y,className:"bg-cta-gradient hover:bg-cta-gradient-hover flex h-11 flex-1 items-center justify-center gap-2 rounded-lg py-2 text-center text-sm font-semibold text-white transition-all disabled:cursor-not-allowed disabled:opacity-70","data-testid":"refine-button",children:(0,l.RC)({isLoading:d,hasCredits:y,actionText:"Edit Artwork",loadingText:"Thinking..."})})]}),(0,a.jsx)(l.Kw,{error:void 0===f?void 0:f,showNoCreditsMessage:!y,compact:!0})]})}},488143(e,r,t){t.d(r,{Ap:()=>o.A,BW:()=>n.B,w1:()=>a.w});var a=t(820130),n=t(859189),o=t(393662);t(967888)},240930(e,r,t){t.d(r,{Kw:()=>ErrorMessage,RC:()=>getGenerateButtonContent,w$:()=>CreditsHeader});var a=t(483134),n=t(146047),o=t(450510),i=t(614381),l=t(967888);function CreditsHeader(e){var r=e.labelHtmlFor,t=e.testIdPrefix,n=(0,l.C)().aiCreditsBalance;return(0,a.jsx)("div",{className:"mb-1 flex items-center justify-between",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("label",{htmlFor:r,className:"h-full text-sm font-semibold text-gray-700","data-testid":"".concat(void 0===t?"prompt":t,"-label"),children:"Your prompt"}),(0,a.jsxs)("div",{className:"text-sm font-bold ".concat(n>0?"text-cta-gradient":"text-gray-400"),"data-testid":"credits-count",children:[n,"/5 remaining today"]})]})})}function getGenerateButtonContent(e){var r=e.isLoading,t=e.hasCredits,i=e.actionText,l=e.loadingText;return r?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(n.A,{className:"size-4 animate-spin"}),l||"".concat(i,"...")]}):t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.A,{className:"size-4 fill-white"}),i]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.A,{className:"size-4 fill-white opacity-50"}),"No Credits Remaining"]})}function ErrorMessage(e){var r=e.error,t=e.showNoCreditsMessage,n=e.compact;if(!r&&!(void 0!==t&&t))return null;var o=r||"You've used all your daily credits. More credits will be available tomorrow.";return void 0!==n&&n?(0,a.jsxs)("div",{className:"mt-1 flex items-center gap-3 rounded-lg border border-orange-200 bg-orange-50 px-2 py-1",children:[(0,a.jsx)(i.A,{className:"size-6 text-orange-600"}),(0,a.jsx)("p",{className:"text-xs font-normal text-gray-700",children:o})]}):(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-3 rounded-lg border border-orange-200 bg-orange-50 px-3 py-2",children:[(0,a.jsx)(i.A,{className:"size-6 text-orange-600"}),(0,a.jsx)("p",{className:"text-sm font-normal leading-[18px] text-gray-700",children:o})]})}},820130(e,r,t){t.d(r,{w:()=>useRefineAiImage});var a=t(286219),n=t(60307),o=t(449252),i=t(73925),l=t(299410),s=t(727754),u=t(967888);function asyncGeneratorStep(e,r,t,a,n,o,i){try{var l=e[o](i),s=l.value}catch(e){t(e);return}l.done?r(s):Promise.resolve(s).then(a,n)}function _async_to_generator(e){return function(){var r=this,t=arguments;return new Promise(function(a,n){var o=e.apply(r,t);function _next(e){asyncGeneratorStep(o,a,n,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(o,a,n,_next,_throw,"throw",e)}_next(void 0)})}}function _instanceof(e,r){return null!=r&&"u">typeof Symbol&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](e):e instanceof r}function _ts_generator(e,r){var t,a,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:verb(0)}),l(i,"throw",{value:verb(1)}),l(i,"return",{value:verb(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function verb(e){return function(r){return step([e,r])}}function step(l){if(t)throw TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(t=1,a&&(n=2&l[0]?a.return:l[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,l[1])).done)return n;switch(a=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,a=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){o.label=l[1];break}if(6===l[0]&&o.label<n[1]){o.label=n[1],n=l;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(l);break}n[2]&&o.ops.pop(),o.trys.pop();continue}l=r.call(e,o)}catch(e){l=[6,e],a=0}finally{t=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function isArtworkRefine(e){return"dtfArtworkId"in e}function getTrackingId(e){return isArtworkRefine(e)?Number(e.dtfArtworkId):Number(e.aiImageVersionId)}var trackRefinementCalled=function(e){var r=getTrackingId(e),t=e.refinementPrompt;isArtworkRefine(e)?(0,n.bd)(r,t):(0,n.dH)(r,t)},trackRefinementGenerated=function(e){var r=getTrackingId(e),t=e.refinementPrompt;isArtworkRefine(e)?(0,n.f9)(r,t):(0,n.tF)(r,t)},trackRefinementFailed=function(e,r){var t=getTrackingId(e),a=e.refinementPrompt;isArtworkRefine(e)?(0,n.bD)(t,a,r):(0,n.dh)(t,a,r)},refineAiImage=function(e){return _async_to_generator(function(){var r,t,a;return _ts_generator(this,function(n){switch(n.label){case 0:if(!isArtworkRefine(e))return[3,2];
1return(r=new FormData).append("refinement_prompt",e.refinementPrompt),r.append("image",e.image),r.append("dtf_artwork_id",e.dtfArtworkId),[4,i.default.aiImages.refine(r,{raw:!0,useAxiosForRequest:!0,headers:{"Content-Type":void 0},timeout:s.py})];case 1:return t=n.sent(),[2,(0,l.Tm)(t)];case 2:return[4,i.default.aiImages.refine((0,l.p8)({refinementPrompt:e.refinementPrompt,inputImageUrl:e.inputImageUrl,aiImageVersionId:e.aiImageVersionId}),{timeout:s.py,useAxiosForRequest:!0})];case 3:return a=n.sent(),[2,(0,l.Tm)(a)]}})})()};function useRefineAiImage(){var e=(0,u.C)().updateAiCreditsBalance;return(0,a.n)({mutationFn:refineAiImage,onMutate:trackRefinementCalled,onSuccess:function(r,t){e(r.remainingCredits),trackRefinementGenerated(t)},onError:function(r,t){var a,n,i=(_instanceof(r,Error)?r.message:void 0)||((0,o.d7)(r)?null==(n=r.response)||null==(a=n.data)?void 0:a.error:void 0)||"Unknown error";if((0,o.d7)(r)&&r.response){var s=(0,l.Tm)(r.response).remainingCredits;"number"==typeof s&&e(s)}trackRefinementFailed(t,i)}})}},967888(e,r,t){t.d(r,{C:()=>useTokenManagement});var a=t(802436),n=t(492624),o=t(75236);function _array_like_to_array(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=Array(r);t<r;t++)a[t]=e[t];return a}function _array_with_holes(e){if(Array.isArray(e))return e}function _iterable_to_array_limit(e,r){var t,a,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),!r||o.length!==r);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}function _non_iterable_rest(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array(e,r){return _array_with_holes(e)||_iterable_to_array_limit(e,r)||_unsupported_iterable_to_array(e,r)||_non_iterable_rest()}function _unsupported_iterable_to_array(e,r){if(e){if("string"==typeof e)return _array_like_to_array(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _array_like_to_array(e,r)}}var i=(0,a.eU)(void 0);function useTokenManagement(){var e,r=_sliced_to_array((0,n.fp)(i),2),t=r[0],a=r[1],l=(0,o.rC)();return{totalCredits:5,aiCreditsBalance:null!=(e=null!=t?t:l.aiCreditsBalance)?e:0,updateAiCreditsBalance:function(e){a(e)}}}},704685(e,r,t){t.d(r,{P:()=>useRefineKeyboardShortcuts});var a=t(293534),n=t(60307),o=t(399769);function _array_like_to_array(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=Array(r);t<r;t++)a[t]=e[t];return a}function _array_with_holes(e){if(Array.isArray(e))return e}function _iterable_to_array_limit(e,r){var t,a,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),!r||o.length!==r);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}function _non_iterable_rest(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array(e,r){return _array_with_holes(e)||_iterable_to_array_limit(e,r)||_unsupported_iterable_to_array(e,r)||_non_iterable_rest()}function _unsupported_iterable_to_array(e,r){if(e){if("string"==typeof e)return _array_like_to_array(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _array_like_to_array(e,r)}}function useRefineKeyboardShortcuts(e){var r=(0,o.uz)(),t=r.canUndo,i=r.canRedo,l=r.undo,s=r.redo,u=_sliced_to_array((0,a.useState)(!1),2),c=u[0],d=u[1],f=(0,a.useCallback)(function(r){var a=navigator.platform.toUpperCase().indexOf("MAC")>=0?r.metaKey:r.ctrlKey,o=r.target,u="INPUT"===o.tagName||"TEXTAREA"===o.tagName||o.isContentEditable;if("Space"===r.code&&!r.repeat&&!u){r.preventDefault(),d(!0),document.body.style.cursor="grab";return}if(a&&"z"===r.key&&!r.shiftKey){r.preventDefault(),t&&(e&&(0,n.Nw)(e),l());return}a&&"z"===r.key&&r.shiftKey&&(r.preventDefault(),i&&(e&&(0,n.VB)(e),s()))},[t,i,l,s,e]),h=(0,a.useCallback)(function(e){"Space"===e.code&&(e.preventDefault(),d(!1),document.body.style.cursor="")},[]),m=(0,a.useCallback)(function(){d(!1),document.body.style.cursor=""},[]);return(0,a.useEffect)(function(){return window.addEventListener("keydown",f),window.addEventListener("keyup",h),window.addEventListener("blur",m),function(){window.removeEventListener("keydown",f),window.removeEventListener("keyup",h),window.removeEventListener("blur",m),document.body.style.cursor=""}},[f,h,m]),{isSpaceHeld:c}}},446112(e,r,t){t.d(r,{V:()=>ColorComboBox});var a=t(483134),n=t(293534),o=t(207214),i=t(997252),l=t(527115);function _array_like_to_array(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=Array(r);t<r;t++)a[t]=e[t];return a}function _array_with_holes(e){if(Array.isArray(e))return e}function _iterable_to_array_limit(e,r){var t,a,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),!r||o.length!==r);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}function _non_iterable_rest(){throw TypeError("Invalid attempt to de
1structure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array(e,r){return _array_with_holes(e)||_iterable_to_array_limit(e,r)||_unsupported_iterable_to_array(e,r)||_non_iterable_rest()}function _unsupported_iterable_to_array(e,r){if(e){if("string"==typeof e)return _array_like_to_array(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _array_like_to_array(e,r)}}function ColorComboBox(e){var r=e.value,t=e.onChange,s=e.onColorChange,u=e.className,c=e.placeholder,d=e.size,f=e.dropdownPlacement,h=void 0===f?"bottom":f,m=e.selectedColorHex,b=e.dropdownWidth,p=_sliced_to_array((0,n.useState)(!1),2),y=p[0],g=p[1],_=_sliced_to_array((0,n.useState)(l.n),2),v=_[0],x=_[1],w=_sliced_to_array((0,n.useState)(-1),2),k=w[0],j=w[1],C=_sliced_to_array((0,n.useState)({left:0,width:0}),2),A=C[0],S=C[1],N=(0,n.useRef)(null),I=(0,n.useRef)(null),M=(0,n.useRef)(!1);(0,n.useEffect)(function(){var handleClickOutside=function(e){I.current&&!I.current.contains(e.target)&&N.current&&!N.current.contains(e.target)&&g(!1)};return document.addEventListener("mousedown",handleClickOutside),function(){return document.removeEventListener("mousedown",handleClickOutside)}},[]);var T=(0,n.useCallback)(function(){if(!M.current&&N.current){var e=N.current.getBoundingClientRect(),r=window.innerHeight;if("left"===h)S({bottom:r-e.bottom,left:e.left-256-8,width:256});else if("top"===h)S({bottom:r-e.top+4,left:e.left,width:e.width});else{var t=r-e.bottom-4-8;S({top:e.bottom+4,left:e.left,width:e.width,maxHeight:Math.min(t,240)})}M.current=!0}},[h]),P=(0,n.useCallback)(function(e){if(t(e),j(-1),/^#[0-9A-Fa-f]{6}$/.test(e))s(e);else{var r=l.N.find(function(r){return r.name.toLowerCase()===e.toLowerCase()});r&&s(r.hex)}if(e.trim()){var a=e.toLowerCase();x(l.N.filter(function(e){return e.name.toLowerCase().includes(a)||e.hex.toLowerCase().includes(a)}).sort(function(e,r){var t=e.name.toLowerCase(),n=r.name.toLowerCase(),o=e.hex.toLowerCase(),i=r.hex.toLowerCase(),l=+(t!==a&&o!==a),s=+(n!==a&&i!==a);if(l!==s)return l-s;var u=t.startsWith(a)||o.startsWith(a)?0:1,c=n.startsWith(a)||i.startsWith(a)?0:1;return u!==c?u-c:t.localeCompare(n)}).slice(0,15))}else x(l.n);T(),g(!0)},[t,s,T]),D=(0,n.useCallback)(function(e,r){var a;t(e),s(r),g(!1),j(-1),null==(a=N.current)||a.blur()},[t,s]),E=(0,n.useCallback)(function(e){if(!y){("ArrowDown"===e.key||"ArrowUp"===e.key)&&(e.preventDefault(),g(!0),j(0));return}if("ArrowDown"===e.key)e.preventDefault(),j(function(e){return e<v.length-1?e+1:e});else if("ArrowUp"===e.key)e.preventDefault(),j(function(e){return e>0?e-1:0});else if("Enter"===e.key){if(e.preventDefault(),k>=0&&k<v.length){var r=v[k];r&&D(r.name,r.hex)}}else"Escape"===e.key?(e.preventDefault(),g(!1),j(-1)):"Tab"===e.key&&(g(!1),j(-1))},[y,v,k,D]);(0,n.useEffect)(function(){if(k>=0&&I.current){var e=I.current.children[k];e&&e.scrollIntoView({block:"nearest",behavior:"smooth"})}},[k]),(0,n.useEffect)(function(){y||(M.current=!1)},[y]);var O=(0,i.cn)("fixed z-[100] max-h-60 overflow-auto rounded-lg border border-gray-200 bg-white shadow-lg",void 0===b?"w-full":b),R=m||"#ffffff",z=(0,n.useMemo)(function(){var e={left:"".concat(A.left,"px"),width:"".concat(A.width,"px")};return void 0!==A.bottom?e.bottom="".concat(A.bottom,"px"):void 0!==A.top&&(e.top="".concat(A.top,"px")),void 0!==A.maxHeight&&(e.maxHeight="".concat(A.maxHeight,"px")),e},[A]);return(0,a.jsxs)("div",{className:(0,i.cn)("relative overflow-visible",u),children:[(0,a.jsxs)("div",{className:"relative overflow-visible",children:[(0,a.jsx)("input",{ref:N,type:"text",value:r,onChange:function(e){return P(e.target.value)},onFocus:function(){x(l.n),j(-1),T(),g(!0)},onKeyDown:E,className:(0,i.cn)("w-full rounded-lg border border-gray-300 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500",{sm:"h-8 px-2 text-base",md:"h-9 px-3 text-base",lg:"h-10 px-3 text-base"}[void 0===d?"md":d],"pr-10"),placeholder:void 0===c?"white":c,"data-testid":"color-combobox-input"}),(0,a.jsx)("div",{className:"pointer-events-none absolute right-2 top-1/2 size-6 -translate-y-1/2 roun
1ded-full border border-gray-300",style:{backgroundColor:R}})]}),y&&v.length>0&&"u">typeof document&&(0,o.createPortal)((0,a.jsx)("div",{ref:I,className:O,style:z,"data-testid":"color-combobox-dropdown",children:v.map(function(e,t){var n=r.toLowerCase()===e.name.toLowerCase()||m&&m.toLowerCase()===e.hex.toLowerCase(),o=t===k;return(0,a.jsxs)("button",{type:"button",onClick:function(){return D(e.name,e.hex)},className:(0,i.cn)("flex w-full items-center gap-2 px-3 py-2 text-left text-sm hover:bg-gray-100",n&&"bg-blue-50",o&&"bg-gray-100"),"data-testid":"color-option-".concat(e.name),children:[(0,a.jsx)("div",{className:"size-4 shrink-0 rounded-full border border-gray-300",style:{backgroundColor:e.hex}}),(0,a.jsx)("span",{className:"capitalize",children:e.name}),(0,a.jsx)("span",{className:"ml-auto font-mono text-xs text-gray-500",children:e.hex})]},e.name)})}),document.body)]})}},276020(e,r,t){t.d(r,{T:()=>EraseTool});var a=t(483134),n=t(492624),o=t(293534),i=t(997252),l=t(399769),s=t(479126),u=t(75236),c=t(807258),d=t(28173),f=t(715201);function _array_like_to_array(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=Array(r);t<r;t++)a[t]=e[t];return a}function _array_with_holes(e){if(Array.isArray(e))return e}function _define_property(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function _iterable_to_array_limit(e,r){var t,a,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),!r||o.length!==r);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}function _non_iterable_rest(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _object_spread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{},a=Object.keys(t);"function"==typeof Object.getOwnPropertySymbols&&(a=a.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.forEach(function(r){_define_property(e,r,t[r])})}return e}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);r&&(a=a.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),t.push.apply(t,a)}return t}function _object_spread_props(e,r){return r=null!=r?r:{},Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}),e}function _sliced_to_array(e,r){return _array_with_holes(e)||_iterable_to_array_limit(e,r)||_unsupported_iterable_to_array(e,r)||_non_iterable_rest()}function _unsupported_iterable_to_array(e,r){if(e){if("string"==typeof e)return _array_like_to_array(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _array_like_to_array(e,r)}}var h=[{type:"quick-selection",label:"Erase with a Click",testId:"quick-selection-brush-button",tooltipText:"Click to remove an areaâsimilar colors around your selection will be erased automatically.",tooltipStorageKey:"quick-selection-brush-tooltip-seen"},{type:"manual",label:"Manual Brush",testId:"manual-brush-button",tooltipText:"Brush over the image to erase only the exact spots you cover.",tooltipStorageKey:"manual-brush-tooltip-seen"}];function EraseTool(e){var r=e.isActive,t=(0,s.Q)().isDesktop,m=_sliced_to_array((0,n.fp)(l.bk),2),b=m[0],p=m[1],y=_sliced_to_array((0,n.fp)(l.M8),2),g=y[0],_=y[1],v=(0,u.t6)(),x=_sliced_to_array((0,o.useState)(function(){var e={};return h.forEach(function(r){e[r.type]="true"===localStorage.getItem(r.tooltipStorageKey)}),e}),2),w=x[0],k=x[1];if(!r||!v)return null;var handleChangeTab=function(e){markTooltipAsSeen(g),_(e)},markTooltipAsSeen=function(e){k(function(r){return _object_spread_props(_object_spread({},r),_define_property({},e,!0))});var r=h.find(function(r){return r.type===e});r&&localStorage.setItem(r.tooltipStorageKey,"true")};return(0,a.jsxs)("div",{className:(0,i.cn)("bg-background absolute left-1/2 z-10 flex w-80 -translate-x-1/2 flex-col rounded-lg border border-gray-200 shadow-lg",t?"bottom-30":"bottom-26"),children:[(0,a.jsx)("div",{role:"tablist",className:"flex h-11 w-full items-center gap-1 rounded-lg bg-inherit p-1",children:h.map(function(e){var r;return(0,a.jsxs)(d.k,{isOpen:g===(r=e.type)&&!w[r],children:[(0,a.jsx)(c.$,{"data-selected":g===e.type||void 0,"data-testid":e.testId,onPress:function(){return handleChangeTab(e.type)},className:(0,i.cn)("h-9 flex-1 rounded-md px-3 py-1 text-xs font-medium",g===e.type?"bg-blue-700 text-white hover:bg-blue-800":"bg-transparent text-gray-700 hover:bg-gray-100"),children:e.label}),(0,a.jsx)(d.m,{placement:"top",className:"mx-3 max-w-xs text-pretty bg-blue-700 text-sm",onClose:function(){return markTooltipAsSeen(e.type)},offset:8,arrowClassName:"fill-blue-700",children:e.tooltipText})]},e.type)})}),"manual"===g&&(0,a.jsx)(f.S,{brushSize:b,onBrushSizeChange:p})]})}},690675(e,r,t){t.d(r,{U:()=>NegativeSpaceTool});var a=t(483134),n=t(843398),o=t(293534),i=t(997252),l=t(399769),s=t(479126),u=t(60307),c=t(77409),d=t(693080),f=t(807258),h=t(384234),m=t(443211),b=t(446112),p=t(527115);function _array_like_to_array(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=Array(r);t<r;t++)a[t]=e[t];return a}function _array_with_holes(e){if(Array.isArray(e))return e}function asyncGeneratorStep(e,r,t,a,n,o,i){try{var l=e[o](i),s=l.value}catch(e){t(e);return}l.done?r(s):Promise.resolve(s).then(a,n)}function _async_to_generator(e){return function(){var r=this,t=arguments;return new Promise(function(a,n){var o=e.apply(r,t);function _next(e){asyncGeneratorStep(o,a,n,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(o,a,n,_next,_throw,"throw",e)}_next(void 0)})}}function _iterable_to_array_limit(e,r){var t,a,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),!r||o.length!==r);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}function _non_iterable_rest(){throw TypeError("Invalid attempt to de
1structure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array(e,r){return _array_with_holes(e)||_iterable_to_array_limit(e,r)||_unsupported_iterable_to_array(e,r)||_non_iterable_rest()}function _unsupported_iterable_to_array(e,r){if(e){if("string"==typeof e)return _array_like_to_array(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _array_like_to_array(e,r)}}function _ts_generator(e,r){var t,a,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:verb(0)}),l(i,"throw",{value:verb(1)}),l(i,"return",{value:verb(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function verb(e){return function(r){return step([e,r])}}function step(l){if(t)throw TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(t=1,a&&(n=2&l[0]?a.return:l[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,l[1])).done)return n;switch(a=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,a=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){o.label=l[1];break}if(6===l[0]&&o.label<n[1]){o.label=n[1],n=l;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(l);break}n[2]&&o.ops.pop(),o.trys.pop();continue}l=r.call(e,o)}catch(e){l=[6,e],a=0}finally{t=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function NegativeSpaceTool(e){var r=e.isActive,t=e.artworkId,y=_sliced_to_array((0,o.useState)(20),2),g=y[0],_=y[1],v=_sliced_to_array((0,o.useState)("20"),2),x=v[0],w=v[1],k=_sliced_to_array((0,o.useState)("#ffffff"),2),j=k[0],C=k[1],A=_sliced_to_array((0,o.useState)("white"),2),S=A[0],N=A[1],I=_sliced_to_array((0,o.useState)(!1),2),M=I[0],T=I[1],P=_sliced_to_array((0,o.useState)(!1),2),D=P[0],E=P[1],O=_sliced_to_array((0,o.useState)(!0),2),R=O[0],z=O[1],L=_sliced_to_array((0,o.useState)(null),2),B=L[0],U=L[1],H=(0,s.Q)().isDesktop,F=(0,l.uz)(),$=F.currentImageData,q=F.pushOperation,G=F.updateLastOperation,W=F.currentOperation,K=F.entries,V=F.index,Z=F.setCurrentImageData,Q=(0,o.useRef)(null),X=(0,o.useMemo)(function(){return"EyeDropper"in window},[]),Y=(0,o.useCallback)(function(e){var r=p.N.find(function(r){return r.hex.toLowerCase()===e.toLowerCase()});return r?r.name:e},[]);(0,o.useEffect)(function(){N(Y(j))},[j,Y]),(0,o.useEffect)(function(){if(!r){Q.current,E(!1),z(!0),T(!1),U(null),Q.current=null;return}R&&$&&(Q.current=$,z(!1))},[r,$,!0,D,Z,R]),(0,o.useEffect)(function(){if(r){var e,t,a,n=K[V];(null==n?void 0:n.payload.type)==="negative-space"?U({imageData:n.payload.imageData,mask:(null==(e=n.payload.metadata)?void 0:e.mask)||new Uint8Array,stats:{removedPixelCount:(null==(t=n.payload.metadata)?void 0:t.removedPixels)||0,eligiblePixelCount:(null==(a=n.payload.metadata)?void 0:a.eligiblePixels)||0}}):(null==n?void 0:n.payload.imageData)&&U({imageData:n.payload.imageData,mask:new Uint8Array,stats:{removedPixelCount:0,eligiblePixelCount:0}})}},[r,K,V,!0,D]),(0,o.useEffect)(function(){r&&B&&_async_to_generator(function(){var e;return _ts_generator(this,function(r){switch(r.label){case 0:if(!(M&&B.mask.length>0))return Z(B.imageData),[2];return(e=new Image).src=B.imageData,[4,new Promise(function(r){e.onload=function(){var t=document.createElement("canvas");t.width=e.width,t.height=e.height;var a=t.getContext("2d");if(!a)return void r();for(var n=a.createImageData(t.width,t.height),o=0;o<B.mask.length;o+=1){var i=4*o,l=255*(0!==B.mask[o]);n.data[i]=l,n.data[i+1]=l,n.data[i+2]=l,n.data[i+3]=255}a.putImageData(n,0,0),Z(t.toDataURL("image/png")),r()}})];case 1:return r.sent(),[2]}})})()},[r,B,M,Z]);var J=(0,o.useCallback)(function(e){var r,a=e.result,n=e.color,o=e.sens,i=e.isUpdate,l={type:"negative-space",imageData:a.imageData,metadata:{dimensions:(null==W||null==(r=W.metadata)?void 0:r.dimensions)||{x:0,y:0,width:0,height:0},selectedColor:n,sensitivity:o,removedPixels:a.stats.removedPixelCount,eligiblePixels:a.stats.eligiblePixelCount,mask:a.mask},timestamp:Date.now()};i?G(l):(q(l),t&&(0,u.aZ)(t,"negative_space",{hex_color:n}))},[W,G,q,t,!0]),ee=(0,o.useCallback)(function(e,r,t){return _async_to_generator(function(){var a,n,o,i,l,s,u,f,h,b,p,y,g,_;return _ts_generator(this,function(v){switch(v.label){case 0:return v.trys.push([0,2,,3]),o=(null==(n=K[V])?void 0:n.payload.type)==="negative-space",a=t&&o?(null==(i=K[V-1])?void 0:i.payload.imageData)||$:(null==n?void 0:n.payload.imageData)||$,(l=new Image).src=a,[4,new Promise(function(e){l.onload=e})];case 1:if(v.sent(),u=(s=(0,d.x)(l)).width,f=s.height,u<=0||f<=0)return(0,c.w)({reason:"zero_dimensions",site:"NegativeSpaceTool.runTool",sourceW
1idth:u,sourceHeight:f}),[2];if((h=document.createElement("canvas")).width=u,h.height=f,!(b=h.getContext("2d")))throw Error("No context");if(!(0,d.L)({ctx:b,source:l,site:"NegativeSpaceTool.runTool",args:[0,0]}))return[2];return p=b.getImageData(0,0,h.width,h.height),y=(0,m.d)({imageData:p,targetHexColor:e,sensitivity:r}),(g=document.createElement("canvas")).width=y.imageData.width,g.height=y.imageData.height,null==(_=g.getContext("2d"))||_.putImageData(y.imageData,0,0),J({result:{imageData:g.toDataURL("image/png"),mask:y.mask,stats:y.stats},color:e,sens:r,isUpdate:t&&o}),[3,3];case 2:return console.error("Error in runTool:",v.sent()),[3,3];case 3:return[2]}})})()},[!0,K,V,$,J]),er=(0,o.useCallback)(function(e){N(e)},[]),et=(0,o.useCallback)(function(e){C(e),ee(e,g,!1)},[g,ee]),ea=(0,o.useCallback)(function(){return _async_to_generator(function(){var e;return _ts_generator(this,function(r){switch(r.label){case 0:if(!X)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,new window.EyeDropper().open()];case 2:return C((e=r.sent()).sRGBHex),N(e.sRGBHex),ee(e.sRGBHex,g,!1),[3,4];case 3:return r.sent(),[3,4];case 4:return[2]}})})()},[X,g,ee]),en=(0,o.useCallback)(function(e){if(""===e)return void w("");var r=Number(e);if(!Number.isNaN(r)&&!(r>100)){var t=Math.max(0,r);w(String(t)),_(t),ee(j,t,!0)}},[j,ee]),eo=(0,o.useCallback)(function(){""===x&&(w("0"),_(0),ee(j,0,!0))},[x,j,ee]),ei=((0,o.useCallback)(function(){B&&J({result:B,color:j,sens:g,isUpdate:!1})},[B,J,j,g]),(0,o.useCallback)(function(e){T(e)},[]));return r?H?(0,a.jsxs)("div",{className:(0,i.cn)("bg-background absolute left-1/2 z-10 flex -translate-x-1/2 items-center gap-5 rounded-lg border border-gray-200 px-4 py-3 shadow-lg","bottom-30"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 overflow-visible",children:[(0,a.jsx)("span",{className:"text-right text-xs text-gray-600",children:"Pick a Color"}),(0,a.jsx)(b.V,{value:S,onChange:er,onColorChange:et,selectedColorHex:j,dropdownPlacement:"left",dropdownWidth:"w-64",size:"md",className:"w-40",placeholder:"Enter color"}),X&&(0,a.jsx)(f.$,{variant:"outline",onPress:ea,className:"h-10 w-10 rounded-lg bg-white p-2","data-testid":"negative-space-eyedropper",children:(0,a.jsx)(n.A,{className:"size-5"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-right text-xs text-gray-600",children:"Sensitivity Percentage"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{type:"number",min:0,max:100,step:5,value:x,onChange:function(e){return en(e.target.value)},onBlur:eo,className:"h-10 w-20 rounded-lg border border-gray-300 bg-white px-3 pr-7 text-sm focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500","data-testid":"negative-space-sensitivity-input"}),(0,a.jsx)("span",{className:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-sm text-gray-600",children:"%"})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-30 text-right text-xs text-gray-600",children:"Preview Removed Background"}),(0,a.jsx)(h.d,{isSelected:M,onChange:ei,"data-testid":"preview-mask-toggle",size:"md"})]}),!1]}):(0,a.jsx)(a.Fragment,{children:(0,a.jsxs)("div",{className:(0,i.cn)("bg-background absolute left-1/2 z-10 flex w-[calc(100%-2rem)] max-w-md -translate-x-1/2 flex-col gap-3 rounded-lg border border-gray-200 p-2 shadow-lg","bottom-26"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"shrink-0 text-xs text-gray-600",children:"Pick a Color"}),(0,a.jsx)(b.V,{value:S,onChange:er,onColorChange:et,selectedColorHex:j,dropdownPlacement:"bottom",size:"md",className:"flex-1",placeholder:"Enter color"}),X&&(0,a.jsx)(f.$,{variant:"outline",onPress:ea,className:"h-10 w-10 shrink-0 rounded-lg bg-white p-2","data-testid":"negative-space-eyedropper-mobile",children:(0,a.jsx)(n.A,{className:"size-5"})})]}),(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-right text-xs text-gray-600",children:"Sensitivity Percentage"}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)("input",{type:"number",min:0,max:100,step:5,value:x,onChange:function(e){return en(e.target.value)},onBlur:eo,className:"w-18 h-10 rounded-lg border border-gray-300 bg-white px-3 pr-7 text-base focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500","data-testid":"negative-space-sensitivity-input-mobile"}),(0,a.jsx)("span",{className:"pointer-events-none absolute right-3 top-1/2 -translate-y-1/2 text-base text-gray-600",children:"%"})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"w-30 text-right text-xs text-gray-600",children:"Preview Removed Backgroun
1d"}),(0,a.jsx)(h.d,{isSelected:M,onChange:ei,"data-testid":"preview-mask-toggle-mobile",size:"md"})]})]}),!1]})}):null}},913353(e,r,t){t.d(r,{W:()=>RefineWithAITool});var a=t(483134),n=t(492624),o=t(293534),i=t(501244),l=t(479126),s=t(60307),u=t(399769),c=t(488143);function _array_like_to_array(e,r){(null==r||r>e.length)&&(r=e.length);for(var t=0,a=Array(r);t<r;t++)a[t]=e[t];return a}function _array_with_holes(e){if(Array.isArray(e))return e}function asyncGeneratorStep(e,r,t,a,n,o,i){try{var l=e[o](i),s=l.value}catch(e){t(e);return}l.done?r(s):Promise.resolve(s).then(a,n)}function _async_to_generator(e){return function(){var r=this,t=arguments;return new Promise(function(a,n){var o=e.apply(r,t);function _next(e){asyncGeneratorStep(o,a,n,_next,_throw,"next",e)}function _throw(e){asyncGeneratorStep(o,a,n,_next,_throw,"throw",e)}_next(void 0)})}}function _instanceof(e,r){return null!=r&&"u">typeof Symbol&&r[Symbol.hasInstance]?!!r[Symbol.hasInstance](e):e instanceof r}function _iterable_to_array_limit(e,r){var t,a,n=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o=[],i=!0,l=!1;try{for(n=n.call(e);!(i=(t=n.next()).done)&&(o.push(t.value),!r||o.length!==r);i=!0);}catch(e){l=!0,a=e}finally{try{i||null==n.return||n.return()}finally{if(l)throw a}}return o}}function _non_iterable_rest(){throw TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _sliced_to_array(e,r){return _array_with_holes(e)||_iterable_to_array_limit(e,r)||_unsupported_iterable_to_array(e,r)||_non_iterable_rest()}function _unsupported_iterable_to_array(e,r){if(e){if("string"==typeof e)return _array_like_to_array(e,r);var t=Object.prototype.toString.call(e).slice(8,-1);if("Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _array_like_to_array(e,r)}}function _ts_generator(e,r){var t,a,n,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),l=Object.defineProperty;return l(i,"next",{value:verb(0)}),l(i,"throw",{value:verb(1)}),l(i,"return",{value:verb(2)}),"function"==typeof Symbol&&l(i,Symbol.iterator,{value:function(){return this}}),i;function verb(e){return function(r){return step([e,r])}}function step(l){if(t)throw TypeError("Generator is already executing.");for(;i&&(i=0,l[0]&&(o=0)),o;)try{if(t=1,a&&(n=2&l[0]?a.return:l[0]?a.throw||((n=a.return)&&n.call(a),0):a.next)&&!(n=n.call(a,l[1])).done)return n;switch(a=0,n&&(l=[2&l[0],n.value]),l[0]){case 0:case 1:n=l;break;case 4:return o.label++,{value:l[1],done:!1};case 5:o.label++,a=l[1],l=[0];continue;case 7:l=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===l[0]||2===l[0])){o=0;continue}if(3===l[0]&&(!n||l[1]>n[0]&&l[1]<n[3])){o.label=l[1];break}if(6===l[0]&&o.label<n[1]){o.label=n[1],n=l;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(l);break}n[2]&&o.ops.pop(),o.trys.pop();continue}l=r.call(e,o)}catch(e){l=[6,e],a=0}finally{t=n=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function RefineWithAITool(e){var r=e.isActive,t=e.artworkId,d=e.printableArea,f=_sliced_to_array((0,o.useState)(""),2),h=f[0],m=f[1],b=_sliced_to_array((0,o.useState)(),2),p=b[0],y=b[1],g=(0,u.uz)(),_=g.currentImageData,v=g.pushOperation,x=g.currentOperation,w=(0,c.w1)(),k=(0,l.Q)().isDesktop,j=_sliced_to_array((0,n.fp)(u.P2),2),C=j[0],A=j[1],S=(0,i.$)().warmCache;if(!r)return null;var handleRefine=function(e){return _async_to_generator(function(){var r,a,n,o,i,l,u,c,f,h;return _ts_generator(this,function(b){switch(b.label){case 0:if(y(void 0),!_||!(null==x?void 0:x.metadata))throw Error("No image available for refinement");b.label=1;case 1:return b.trys.push([1,6,7,8]),A(!0),[4,fetch(_)];case 2:return[4,b.sent().blob()];case 3:return r=b.sent(),[4,w.mutateAsync({refinementPrompt:e.trim(),image:r,dtfArtworkId:t})];case 4:return[4,S([b.sent().url])];case 5:if(!(a=_sliced_to_array.apply(void 0,[b.sent(),1])[0]))throw Error("Failed to load refined image");
1return n=a.base64,i=(o=a.image).naturalWidth,l=o.naturalHeight/i,c=(u=Math.min(Math.min(d.width,d.height/l),i))*l,v({type:"ai-refine",imageData:n,metadata:{dimensions:{x:d.left+(d.width-u)/2,y:d.top,width:u,height:c}},timestamp:Date.now()}),m(""),[3,8];case 6:return h=_instanceof(f=b.sent(),Error)?f.message:"Couldn't generate the image, please try again.",(0,s.Ti)("refine_with_ai",h,{error:f,artworkId:t,component:"RefineWithAITool"}),y(h),[3,8];case 7:return A(!1),[7];case 8:return[2]}})})()};return(0,a.jsx)("div",{className:"pointer-events-none absolute z-10 ".concat(k?"left-1/2 top-16 w-[92%] max-w-3xl -translate-x-1/2":"left-1/2 top-28 w-[calc(100%-2rem)] max-w-lg -translate-x-1/2"),children:(0,a.jsx)("div",{className:"pointer-events-auto rounded-xl border border-gray-200 bg-white p-2 shadow-lg ".concat(k?"ml-auto w-full max-w-md":""),children:k?(0,a.jsx)(c.BW,{prompt:h,onPromptChange:m,onGenerate:handleRefine,isLoading:C,error:p,isRefineMode:!0,showCredits:!0}):(0,a.jsx)(c.Ap,{prompt:h,onPromptChange:m,onRefine:handleRefine,isLoading:C,error:p})})})}},527115(e,r,t){t.d(r,{N:()=>a,n:()=>n});var a=[{name:"aliceblue",hex:"#f0f8ff"},{name:"antiquewhite",hex:"#faebd7"},{name:"aqua",hex:"#00ffff"},{name:"aquamarine",hex:"#7fffd4"},{name:"azure",hex:"#f0ffff"},{name:"beige",hex:"#f5f5dc"},{name:"bisque",hex:"#ffe4c4"},{name:"black",hex:"#000000"},{name:"blanchedalmond",hex:"#ffebcd"},{name:"blue",hex:"#0000ff"},{name:"blueviolet",hex:"#8a2be2"},{name:"brown",hex:"#a52a2a"},{name:"burlywood",hex:"#deb887"},{name:"cadetblue",hex:"#5f9ea0"},{name:"chartreuse",hex:"#7fff00"},{name:"chocolate",hex:"#d2691e"},{name:"coral",hex:"#ff7f50"},{name:"cornflowerblue",hex:"#6495ed"},{name:"cornsilk",hex:"#fff8dc"},{name:"crimson",hex:"#dc143c"},{name:"cyan",hex:"#00ffff"},{name:"darkblue",hex:"#00008b"},{name:"darkcyan",hex:"#008b8b"},{name:"darkgoldenrod",hex:"#b8860b"},{name:"darkgray",hex:"#a9a9a9"},{name:"darkgrey",hex:"#a9a9a9"},{name:"darkgreen",hex:"#006400"},{name:"darkkhaki",hex:"#bdb76b"},{name:"darkmagenta",hex:"#8b008b"},{name:"darkolivegreen",hex:"#556b2f"},{name:"darkorange",hex:"#ff8c00"},{name:"darkorchid",hex:"#9932cc"},{name:"darkred",hex:"#8b0000"},{name:"darksalmon",hex:"#e9967a"},{name:"darkseagreen",hex:"#8fbc8f"},{name:"darkslateblue",hex:"#483d8b"},{name:"darkslategray",hex:"#2f4f4f"},{name:"darkslategrey",hex:"#2f4f4f"},{name:"darkturquoise",hex:"#00ced1"},{name:"darkviolet",hex:"#9400d3"},{name:"deeppink",hex:"#ff1493"},{name:"deepskyblue",hex:"#00bfff"},{name:"dimgray",hex:"#696969"},{name:"dimgrey",hex:"#696969"},{name:"dodgerblue",hex:"#1e90ff"},{name:"firebrick",hex:"#b22222"},{name:"floralwhite",hex:"#fffaf0"},{name:"forestgreen",hex:"#228b22"},{name:"fuchsia",hex:"#ff00ff"},{name:"gainsboro",hex:"#dcdcdc"},{name:"ghostwhite",hex:"#f8f8ff"},{name:"gold",hex:"#ffd700"},{name:"goldenrod",hex:"#daa520"},{name:"gray",hex:"#808080"},{name:"grey",hex:"#808080"},{name:"green",hex:"#008000"},{name:"greenyellow",hex:"#adff2f"},{name:"honeydew",hex:"#f0fff0"},{name:"hotpink",hex:"#ff69b4"},{name:"indianred",hex:"#cd5c5c"},{name:"indigo",hex:"#4b0082"},{name:"ivory",hex:"#fffff0"},{name:"khaki",hex:"#f0e68c"},{name:"lavender",hex:"#e6e6fa"},{name:"lavenderblush",hex:"#fff0f5"},{name:"lawngreen",hex:"#7cfc00"},{name:"lemonchiffon",hex:"#fffacd"},{name:"lightblue",hex:"#add8e6"},{name:"lightcoral",hex:"#f08080"},{name:"lightcyan",hex:"#e0ffff"},{name:"lightgoldenrodyellow",hex:"#fafad2"},{name:"lightgray",hex:"#d3d3d3"},{name:"lightgrey",hex:"#d3d3d3"},{name:"lightgreen",hex:"#90ee90"},{name:"lightpink",hex:"#ffb6c1"},{name:"lightsalmon",hex:"#ffa07a"},{name:"lightseagreen",hex:"#20b2aa"},{name:"lightskyblue",hex:"#87cefa"},{name:"lightslategray",hex:"#778899"},{name:"lightslategrey",hex:"#778899"},{name:"lightsteelblue",hex:"#b0c4de"},{name:"lightyellow",hex:"#ffffe0"},{name:"lime",hex:"#00ff00"},{name:"limegreen",hex:"#32cd32"},{name:"linen",hex:"#faf0e6"},{name:"magenta",hex:"#ff00ff"},{name:"maroon",hex:"#800000"},{name:"mediumaquamarine",hex:"#66cdaa"},{name:"mediumblue",hex:"#0000cd"},{name:"mediumorchid",hex:"#ba55d3"},{name:"mediumpurple",hex:"#9370db"},{name:"mediumseagreen",hex:"#3cb371"},{name:"mediumslateblue",hex:"#7b68ee"},{name:"mediumspringgreen",hex:"#00fa9a"},{name:"mediumturquoise",hex:"#48d1cc"},{name:"mediumvioletred",hex:"#c71585"},{name:"midnightblue",hex:"#191970"},{name:"mintcream",hex:"#f5fffa"},{name:"mistyrose",hex:"#ffe4e1"},{name:"moccasin",hex:"#ffe4b5"},{name:"navajowhite",hex:"#ffdead"},{name:"navy",hex:"#000080"},{name:"oldlace",hex:"#fdf5e6"},{name:"olive",hex:"#808000"},{name:"olivedrab",hex:"#6b8e23"},{name:"orange",hex:"#ffa500"},{name:"orangered",hex:"#ff4500"},{name:"orchid",hex:"#da70d6"},{name:"palegoldenrod",hex:"#eee8aa"},{name:"palegreen",hex:"#98fb98"},{name:"paleturquoise",hex:"#afeeee"},{name:"palevioletred",hex:"#db7093"},{name:"papayawhip",hex:"#ffefd5"},{name:"peachpuff",hex:"#ffdab9"},{name:"peru",hex:"#cd853f"},{name:"pink",hex:"#ffc0cb"},{name:"plum",hex:"#dda0dd"},{name:"powderblue",hex:"#b0e0e6"},{name:"purple",hex:"#800080"},{name:"rebeccapurple",hex:"#663399"},{name:"red",hex:"#ff0000"},{name:"rosybrown",hex:"#bc8f8f"},{name:"royalblue",hex:"#4169e1"},{name:"saddlebrown",hex:"#8b4513"},{name:"salmon",hex:"#fa8072"},{name:"sandybrown",hex:"#f4a460"},{name:"seagreen",hex:"#2e8b57"},{name:"seashell",hex:"#fff5ee"},{name:"sienna",hex:"#a0522d"},{name:"silver",hex:"#c0c0c0"},{name:"skyblue",hex:"#87ceeb"},{name:"slateblue",hex:"#6a5acd"},{name:"slategray",hex:"#708090"},{name:"slategrey",hex:"#708090"},{name:"snow",hex:"#fffafa"},{name:"springgreen",hex:"#00ff7f"},{name:"steelblue",hex:"#4682b4"},{name:"tan",hex:"#d2b48c"},{name:"teal",hex:"#008080"},{name:"thistle",hex:"#d8bfd8"},{name:"tomato",hex:"#ff6347"},{name:"turquoise",hex:"#40e0d0"},{name:"violet",hex:"#ee82ee"},{name:"wheat",hex:"#f5deb3"},{name:"white",hex:"#ffffff"},{name:"whitesmoke",hex:"#f5f5f5"},{name:"yellow",hex:"#ffff00"},{name:"yellowgreen",hex:"#9acd32"}],n=[{name:"white",hex:"#ffffff"},{name:"black",hex:"#000000"},{name:"red",hex:"#ff0000"},{name:"blue",hex:"#0000ff"},{name:"green",hex:"#008000"},{name:"yellow",hex:"#ffff00"},{name:"orange",hex:"#ffa500"},{name:"purple",hex:"#800080"},{name:"brown",hex:"#a52a2a"},{name:"navy",hex:"#000080"}]},624268(e,r,t){t.d(r,{Te:()=>a.T,Uc:()=>n.U,W8:()=>o.W});var a=t(276020),n=t(690675),o=t(913353)}}]);
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.