PageSourceSearch

https://serdarhelli-sdf-stylegan-3d.hf.space/assets/index.6c3ab447.js

js serdarhelli-sdf-stylegan-3d.hf.space collected 2026-10-03 10:21:38 UTC 40,023 bytes, 2 lines download raw bytes

1import{S as $,i as x,s as V,w as Q,b as d,f as y,g as R,x as F,n as v,e as L,M as O,F as he,ad as bt,I as E,ae as Ve,ak as Ze,Y as He,l as W,W as It,A as kt,a as U,ai as pt,j as w,D as X,k as I,E as G,C as yt,aa as Re,J as vt,al as $e,K as ce,c as T,m as j,o as B,a8 as Se,am as Ct,d as q,B as ue,L as Y,O as H,t as be,h as Qe,P as Mt,Q as zt,X as Tt,R as jt,T as Bt,U as Rt,V as St}from"./index.68c8b051.js";import{B as wt}from"./BlockLabel.8f427405.js";import{I as De}from"./Image.7fd93f31.js";import{C as Dt,i as Et,U as Lt,W as Ut}from"./Webcam.8497d09c.js";import{I as Ee,C as Ft,M as Le}from"./ModifyUpload.0d58709d.js";import{U as Nt}from"./Upload.c4127bdc.js";import{E as On}from"./Image.1f76c976.js";function qt(t){let e,n,i;return{c(){e=Q("svg"),n=Q("path"),i=Q("path"),d(n,"d","M28.828 3.172a4.094 4.094 0 0 0-5.656 0L4.05 22.292A6.954 6.954 0 0 0 2 27.242V30h2.756a6.952 6.952 0 0 0 4.95-2.05L28.828 8.829a3.999 3.999 0 0 0 0-5.657zM10.91 18.26l2.829 2.829l-2.122 2.121l-2.828-2.828zm-2.619 8.276A4.966 4.966 0 0 1 4.756 28H4v-.759a4.967 4.967 0 0 1 1.464-3.535l1.91-1.91l2.829 2.828zM27.415 7.414l-12.261 12.26l-2.829-2.828l12.262-12.26a2.047 2.047 0 0 1 2.828 0a2 2 0 0 1 0 2.828z"),d(n,"fill","currentColor"),d(i,"d","M6.5 15a3.5 3.5 0 0 1-2.475-5.974l3.5-3.5a1.502 1.502 0 0 0 0-2.121a1.537 1.537 0 0 0-2.121 0L3.415 5.394L2 3.98l1.99-1.988a3.585 3.585 0 0 1 4.95 0a3.504 3.504 0 0 1 0 4.949L5.439 10.44a1.502 1.502 0 0 0 0 2.121a1.537 1.537 0 0 0 2.122 0l4.024-4.024L13 9.95l-4.025 4.024A3.475 3.475 0 0 1 6.5 15z"),d(i,"fill","currentColor"),d(e,"width","100%"),d(e,"height","100%"),d(e,"viewBox","0 0 32 32")},m(l,u){y(l,e,u),R(e,n),R(e,i)},p:F,i:F,o:F,d(l){l&&v(e)}}}class Ot extends ${constructor(e){super(),x(this,e,null,qt,V,{})}}function Wt(t){let e,n,i,l,u,r,o;return{c(){e=Q("svg"),n=Q("circle"),i=Q("circle"),l=Q("circle"),u=Q("circle"),r=Q("circle"),o=Q("path"),d(n,"cx","10"),d(n,"cy","12"),d(n,"r","2"),d(n,"fill","currentColor"),d(i,"cx","16"),d(i,"cy","9"),d(i,"r","2"),d(i,"fill","currentColor"),d(l,"cx","22"),d(l,"cy","12"),d(l,"r","2"),d(l,"fill","currentColor"),d(u,"cx","23"),d(u,"cy","18"),d(u,"r","2"),d(u,"fill","currentColor"),d(r,"cx","19"),d(r,"cy","23"),d(r,"r","2"),d(r,"fill","currentColor"),d(o,"fill","currentColor"),d(o,"d","M16.54 2A14 14 0 0 0 2 16a4.82 4.82 0 0 0 6.09 4.65l1.12-.31a3 3 0 0 1 3.79 2.9V27a3 3 0 0 0 3 3a14 14 0 0 0 14-14.54A14.05 14.05 0 0 0 16.54 2Zm8.11 22.31A11.93 11.93 0 0 1 16 28a1 1 0 0 1-1-1v-3.76a5 5 0 0 0-5-5a5.07 5.07 0 0 0-1.33.18l-1.12.31A2.82 2.82 0 0 1 4 16A12 12 0 0 1 16.47 4A12.18 12.18 0 0 1 28 15.53a11.89 11.89 0 0 1-3.35 8.79Z"),d(e,"width","100%"),d(e,"height","100%"),d(e,"viewBox","0 0 32 32")},m(s,g){y(s,e,g),R(e,n),R(e,i),R(e,l),R(e,u),R(e,r),R(e,o)},p:F,i:F,o:F,d(s){s&&v(e)}}}class Pt extends ${constructor(e){super(),x(this,e,null,Wt,V,{})}}function Jt(t){let e,n;return{c(){e=Q("svg"),n=Q("path"),d(n,"d","M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"),d(e,"xmlns","http://www.w3.org/2000/svg"),d(e,"width","100%"),d(e,"height","100%"),d(e,"viewBox","0 0 24 24"),d(e,"fill","none"),d(e,"stroke","currentColor"),d(e,"stroke-width","1.5"),d(e,"stroke-linecap","round"),d(e,"stroke-linejoin","round"),d(e,"class","feather feather-edit-2")},m(i,l){y(i,e,l),R(e,n)},p:F,i:F,o:F,d(i){i&&v(e)}}}class xe extends ${constructor(e){super(),x(this,e,null,Jt,V,{})}}function Yt(t){let e,n;return{c(){e=L("img"),O(e.src,n=t[0])||d(e,"src",n),d(e,"alt","")},m(i,l){y(i,e,l),t[2](e)},p(i,[l]){l&1&&!O(e.src,n=i[0])&&d(e,"src",n)},i:F,o:F,d(i){i&&v(e),t[2](null)}}}function Ht(t,e,n){let{image:i}=e,l;const u=he();bt(()=>{const o=new Dt(l,{autoCropArea:1,cropend(){const s=o.getCroppedCanvas().toDataURL();u("crop",s)}});return u("crop",i),()=>{o.destroy()}});function r(o){E[o?"unshift":"push"](()=>{l=o,n(1,l)})}return t.$$set=o=>{"image"in o&&n(0,i=o.image)},[i,l,r]}class At extends ${constructor(e){super(),x(this,e,Ht,Yt,V,{image:0})}}class et{constructor(e,n){this.x=e,this.y=n}}class tt extends et{update(e){this.x=e.x,this.y=e.y}moveByAngle(e,n){const i=e+Math.PI/2;this.x=this.x+Math.sin(i)*n,this.y=this.y-Math.cos(i)*n}equalsTo(e){return this.x===e.x&&this.y===e.y}getDifferenceTo(e){return new et(this.x-e.x,this.y-e.y)}getDistanceTo(e){const n=this.getDifferenceTo(e);return Math.sqrt(Math.pow(n.x,2)+Math.pow(n.y,2))}getAngleTo(e){const n=this.getDifferenceTo(e);return Math.atan2(n.y,n.x)}toObject(){return{x:this.x,y:this.y}}}const Qt=30;class Vt{constructor({radius:e=Qt,enabled:n=!0,initialPoint:i={x:0,y:0}}={}){this.radius=e,this._isEnabled=n,this.pointer=new tt(i.x,i.y),this.brush=new tt(i.x,i.y),this.angle=0,this.distance=0,this._hasMoved=!1}enable(){this._isEnabled=!0}disable(){this._isEnabled=!1}isEnabled(){return this._isEnabled}setRadius(e){this.radius=e}getRadius(){return this.radius}getBrushCoordinates(){return this.brush.toObject()}getPointerCoordinates(){return this.pointer.toObject()}getBrush(){return this.brush}getPointer(){return this.pointer}getAngle(){return this.angle}getDistance(){return this.distance}brushHasMoved(){return this._hasMoved}update(e,{both:n=!1}={}){return this._hasMoved=!1,this.pointer.equalsTo(e)&&!n?!1:(this.pointer.update(e),n?(this._hasMoved=!0,this.brush.update(e),!0):(this._isEnabled?(this.distance=this.pointer.getDistanceTo(this.brush),this.angle=this.pointer.getAngleTo(this.brush),this.distance>this.radius&&(this.brush.moveByAngle(this.angle,this.distance-this.radius),this._hasMoved=!0)):(this.distance=0,this.angle=0,this.brush.update(e),this._hasMoved=!0),!0))}}function nt(t,e,n){const i=t.slice();return i[56]=e[n].name,i[57]=e[n].zIndex,i[58]=e,i[59]=n,i}function it(t){let e,n,i;return{c(){e=L("div"),e.textContent="Start drawing",d(e,"class","absolute inset-0 flex items-center justify-center z-40 pointer-events-none touch-none text-gray-400 md:text-xl")},m(l,u){y(l,e,u),i=!0},i(l){i||(Ve(()=>{n||(n=Ze(e,$e,{duration:50},!0)),n.run(1)}),i=!0)},o(l){n||(n=Ze(e,$e,{duration:50},!1)),n.run(0),i=!1},d(l){l&&v(e),l&&n&&n.end()}}}function lt(t){let e,n,i=t[56],l,u;const r=()=>t[27](e,i),o=()=>t[27](null,i);return{c(){e=L("canvas"),d(e,"key",n=t[56]),d(e,"class","inset-0 m-auto hover:cursor-none"),He(e,"display","block"),He(e,"position","absolute"),He(e,"z-index",t[57])},m(s,g){y(s,e,g),r(),l||(u=[W(e,"mousedown",t[56]==="interface"?t[6]:void 0),W(e,"mousemove",t[56]==="interface"?t[7]:void 0),W(e,"mouseup",t[56]==="interface"?t[8]:void 0),W(e,"mouseout",t[56]==="interface"?t[8]:void 0),W(e,"blur",t[56]==="interface"?t[8]:void 0),W(e,"touchstart",t[56]==="interface"?t[6]:void 0),W(e,"touchmove",t[56]==="interface"?t[7]:void 0),W(e,"touchend",t[56]==="interface"?t[8]:void 0),W(e,"touchcancel",t[56]==="interface"?t[8]:void 0),W(e,"click",It(t[26]))],l=!0)},p(s,g){t=s,i!==t[56]&&(o(),i=t[56],r())},d(s){s&&v(e),o(),l=!1,kt(u)}}}function Xt(t){let e,n,i,l,u=t[4]===0&&it(),r=t[5],o=[];for(let s=0;s<r.length;s+=1)o[s]=lt(nt(t,r,s));return{c(){e=L("div"),u&&u.c(),n=U();for(let s=0;s<o.length;s+=1)o[s].c();d(e,"class","touch-none relative h-full w-full"),Ve(()=>t[29].call(e))},m(s,g){y(s,e,g),u&&u.m(e,null),R(e,n);for(let _=0;_<o.length;_+=1)o[_].m(e,null);t[28](e),i=pt(e,t[29].bind(e)),l=!0},p(s,g){if(s[4]===0?u?g[0]&16&&w(u,1):(u=it(),u.c(),w(u,1),u.m(e,n)):u&&(X(),I(u,1,1,()=>{u=null}),G()),g[0]&481){r=s[5];let _;for(_=0;_<r.length;_+=1){const m=nt(s,r,_);o[_]?o[_].p(m,g):(o[_]=lt(m),o[_].c(),o[_].m(e,null))}for(;_<o.length;_+=1)o[_].d(1);o.length=r.length}},i(s){l||(w(u),l=!0)},o(s){I(u),l=!1},d(s){s&&v(e),u&&u.d(),yt(o,s),t[28](null),i()}}}let Gt="#aaa";function rt(t,e){return{x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}}function Kt(t,e,n){let i;const l=he();let{value:u}=e,{value_img:r}=e,{mode:o="sketch"}=e,{brush_color:s="#0b0f19"}=e,{brush_radius:g=50}=e,{source:_}=e,{width:m=400}=e,{height:a=200}=e,{container_height:f=200}=e,p,A=m,D=a,ee;const oe=[{name:"interface",zIndex:15},{name:"drawing",zIndex:11},{name:"temp",zIndex:12},{name:"mask",zIndex:-1},{name:"temp_fake",zIndex:-2}];let z={},b={},P=[],J=[],te=!0,ne=!0,ie=!1,N=!1,k=null,K=null,ae=null,le=0;bt(async()=>{Object.keys(z).forEach(c=>{n(23,b[c]=z[c].getContext("2d"),b)}
1),await Re(),r&&(r.addEventListener("load",c=>{_==="webcam"?(b.temp.save(),b.temp.translate(m,0),b.temp.scale(-1,1),b.temp.drawImage(r,0,0),b.temp.restore()):b.temp.drawImage(r,0,0),b.drawing.drawImage(z.temp,0,0,m,a),se()}),setTimeout(()=>{_==="webcam"?(b.temp.save(),b.temp.translate(m,0),b.temp.scale(-1,1),b.temp.drawImage(r,0,0),b.temp.restore()):b.temp.drawImage(r,0,0),b.drawing.drawImage(z.temp,0,0,m,a),me({lines:J.slice()}),se()},100)),n(25,k=new Vt({radius:g*.05,enabled:!0,initialPoint:{x:m/2,y:a/2}})),ae=new Et((c,C,...M)=>{Ie(c,C)}),ae.observe(K),ge(),n(21,p=!0),requestAnimationFrame(()=>{re(),requestAnimationFrame(()=>{_e()})})});function re(){const c=m/2,C=a/2;k.update({x:c,y:C},{both:!0}),k.update({x:c,y:C},{both:!1}),te=!0,ne=!0}vt(()=>{n(21,p=!1),ae.unobserve(K)});function Ue(){const c=J.slice(0,-1);je(),r&&(_==="webcam"?(b.temp.save(),b.temp.translate(m,0),b.temp.scale(-1,1),b.temp.drawImage(r,0,0),b.temp.restore()):b.temp.drawImage(r,0,0),(!J||!J.length)&&b.drawing.drawImage(z.temp,0,0,m,a)),me({lines:c}),n(4,le=c.length),J.length&&n(24,J=c),se()}let me=({lines:c})=>{c.forEach(C=>{const{points:M,brush_color:h,brush_radius:S}=C;Ce({points:M,brush_color:h,brush_radius:S}),o==="mask"&&Me({points:M,brush_color:h,brush_radius:S}),P=M}),Te({brush_color:s,brush_radius:g}),o==="mask"&&ze()},Fe=c=>{c.preventDefault(),N=!0;const{x:C,y:M}=ye(c);c.touches&&c.touches.length>0&&k.update({x:C,y:M},{both:!0}),ve(C,M),n(4,le+=1)},ke=c=>{c.preventDefault();const{x:C,y:M}=ye(c);ve(C,M)},Ne=c=>{c.preventDefault(),ke(c),ie=!1,N=!1,Te(),o==="mask"&&ze()},pe=0,we=0,Ae=0,Ie=async()=>{if(m===pe&&a===we&&Ae===f)return;const c={width:m,height:a},C={height:f,width:f*(c.width/c.height)};await Promise.all([fe(z.interface,c,C),fe(z.drawing,c,C),fe(z.temp,c,C),fe(z.temp_fake,c,C),fe(z.mask,c,C,!1)]),n(9,g=20*(c.width/C.width)),ge({once:!0}),setTimeout(()=>{we=a,pe=m,Ae=f},100),_e()},fe=async(c,C,M,h=!0)=>{if(!p)return;await Re();const S=window.devicePixelRatio||1;c.width=C.width*(h?S:1),c.height=C.height*(h?S:1);const Z=c.getContext("2d");h&&Z.scale(S,S),c.style.width=`${M.width}px`,c.style.height=`${M.height}px`},ye=c=>{const C=z.interface.getBoundingClientRect();let M=c.clientX,h=c.clientY;return c.changedTouches&&c.changedTouches.length>0&&(M=c.changedTouches[0].clientX,h=c.changedTouches[0].clientY),{x:(M-C.left)/C.width*m,y:(h-C.top)/C.height*a}},ve=(c,C)=>{k.update({x:c,y:C});const M=!k.isEnabled();(N&&!ie||M&&N)&&(ie=!0,P.push(k.brush.toObject())),ie&&(P.push(k.brush.toObject()),Ce({points:P,brush_color:s,brush_radius:g}),o==="mask"&&Me({points:P,brush_color:s,brush_radius:g})),te=!0},Ce=({points:c,brush_color:C,brush_radius:M})=>{if(!c||c.length<2||(n(23,b.temp.lineJoin="round",b),n(23,b.temp.lineCap="round",b),n(23,b.temp.strokeStyle=C,b),n(23,b.temp.lineWidth=M,b),!c||c.length<2))return;let h=c[0],S=c[1];b.temp.moveTo(S.x,S.y),b.temp.beginPath();for(var Z=1,Ye=c.length;Z<Ye;Z++){var de=rt(h,S);b.temp.quadraticCurveTo(h.x,h.y,de.x,de.y),h=c[Z],S=c[Z+1]}b.temp.lineTo(h.x,h.y),b.temp.stroke()},Me=({points:c,brush_color:C,brush_radius:M})=>{if(!c||c.length<2)return;n(23,b.temp_fake.lineJoin="round",b),n(23,b.temp_fake.lineCap="round",b),n(23,b.temp_fake.strokeStyle="#fff",b),n(23,b.temp_fake.lineWidth=M,b);let h=c[0],S=c[1];b.temp_fake.moveTo(S.x,S.y),b.temp_fake.beginPath();for(var Z=1,Ye=c.length;Z<Ye;Z++){var de=rt(h,S);b.temp_fake.quadraticCurveTo(h.x,h.y,de.x,de.y),h=c[Z],S=c[Z+1]}b.temp_fake.lineTo(h.x,h.y),b.temp_fake.stroke()},ze=()=>{P.length<1||(P.length=0,b.mask.drawImage(z.temp_fake,0,0,m,a),se())},Te=()=>{P.length<1||(J.push({points:P.slice(),brush_color:s,brush_radius:g}),o!=="mask"&&(P.length=0),b.drawing.drawImage(z.temp,0,0,m,a),se())},se=()=>{const c=Be();l("change",c)};function _e(){return n(24,J=[]),je(),n(4,le=0),!0}function je(){ne=!0,b.temp.clearRect(0,0,m,a),n(23,b.temp.fillStyle=o==="mask"?"transparent":"#FFFFFF",b),b.temp.fillRect(0,0,m,a),o==="mask"&&(b.temp_fake.clearRect(0,0,z.temp_fake.width,z.temp_fake.height),b.mask.clearRect(0,0,m,a),n(23,b.mask.fillStyle="#000",b),b.mask.fillRect(0,0,m,a))}let ge=({once:c=!1}={})=>
1{if(te||ne){const C=k.getPointerCoordinates(),M=k.getBrushCoordinates();qe(b.interface,C,M),te=!1,ne=!1}c||window.requestAnimationFrame(()=>{ge()})},qe=(c,C,M)=>{c.clearRect(0,0,m,a),c.beginPath(),c.fillStyle=s,c.arc(M.x,M.y,g/2,0,Math.PI*2,!0),c.fill(),c.beginPath(),c.fillStyle=Gt,c.arc(M.x,M.y,i,0,Math.PI*2,!0),c.fill()};function Be(){return o==="mask"?z.mask.toDataURL("image/jpg"):z.drawing.toDataURL("image/jpg")}function Oe(c){ce.call(this,t,c)}function We(c,C){E[c?"unshift":"push"](()=>{z[C]=c,n(0,z)})}function Pe(c){E[c?"unshift":"push"](()=>{K=c,n(3,K)})}function Je(){A=this.offsetWidth,D=this.offsetHeight,n(1,A),n(2,D)}return t.$$set=c=>{"value"in c&&n(10,u=c.value),"value_img"in c&&n(11,r=c.value_img),"mode"in c&&n(12,o=c.mode),"brush_color"in c&&n(13,s=c.brush_color),"brush_radius"in c&&n(9,g=c.brush_radius),"source"in c&&n(14,_=c.source),"width"in c&&n(15,m=c.width),"height"in c&&n(16,a=c.height),"container_height"in c&&n(17,f=c.container_height)},t.$$.update=()=>{t.$$.dirty[0]&2098176&&p&&!u&&_e(),t.$$.dirty[0]&31574017&&p&&r!==ee&&(n(22,ee=r),_e(),setTimeout(()=>{_==="webcam"?(b.temp.save(),b.temp.translate(m,0),b.temp.scale(-1,1),b.temp.drawImage(r,0,0),b.temp.restore()):b.temp.drawImage(r,0,0),b.drawing.drawImage(z.temp,0,0,m,a),me({lines:J.slice()}),se()},50)),t.$$.dirty[0]&33554944&&k&&(re(),k.setRadius(g*.05)),t.$$.dirty[0]&98304&&(m||a)&&Ie(),t.$$.dirty[0]&512&&(i=g*.075)},[z,A,D,K,le,oe,Fe,ke,Ne,g,u,r,o,s,_,m,a,f,Ue,_e,Be,p,ee,b,J,k,Oe,We,Pe,Je]}class Xe extends ${constructor(e){super(),x(this,e,Kt,Xt,V,{value:10,value_img:11,mode:12,brush_color:13,brush_radius:9,source:14,width:15,height:16,container_height:17,undo:18,clear:19,get_image_data:20},null,[-1,-1])}get undo(){return this.$$.ctx[18]}get clear(){return this.$$.ctx[19]}get get_image_data(){return this.$$.ctx[20]}}function Zt(t){let e,n,i,l,u;return n=new Ee({props:{Icon:Lt}}),n.$on("click",t[1]),l=new Ee({props:{Icon:Ft}}),l.$on("click",t[2]),{c(){e=L("div"),T(n.$$.fragment),i=U(),T(l.$$.fragment),d(e,"class","z-50 top-2 right-2 justify-end flex gap-1 absolute")},m(r,o){y(r,e,o),j(n,e,null),R(e,i),j(l,e,null),u=!0},p:F,i(r){u||(w(n.$$.fragment,r),w(l.$$.fragment,r),u=!0)},o(r){I(n.$$.fragment,r),I(l.$$.fragment,r),u=!1},d(r){r&&v(e),B(n),B(l)}}}function $t(t){const e=he();return[e,()=>e("undo"),l=>{e("clear"),l.stopPropagation()}]}class Ge extends ${constructor(e){super(),x(this,e,$t,Zt,V,{})}}function st(t){let e,n,i,l,u;return{c(){e=L("input"),d(e,"class","absolute top-[2px] right-6"),d(e,"type","range"),d(e,"min",n=.5*(t[2]/t[6])),d(e,"max",i=75*(t[2]/t[6]))},m(r,o){y(r,e,o),Se(e,t[0]),l||(u=[W(e,"change",t[10]),W(e,"input",t[10])],l=!0)},p(r,o){o&68&&n!==(n=.5*(r[2]/r[6]))&&d(e,"min",n),o&68&&i!==(i=75*(r[2]/r[6]))&&d(e,"max",i),o&1&&Se(e,r[0])},d(r){r&&v(e),l=!1,kt(u)}}}function ut(t){let e,n,i,l;n=new Ee({props:{Icon:Pt}}),n.$on("click",t[11]);let u=t[5]&&ot(t);return{c(){e=L("span"),T(n.$$.fragment),i=U(),u&&u.c(),d(e,"class","absolute top-6 right-0")},m(r,o){y(r,e,o),j(n,e,null),R(e,i),u&&u.m(e,null),l=!0},p(r,o){r[5]?u?u.p(r,o):(u=ot(r),u.c(),u.m(e,null)):u&&(u.d(1),u=null)},i(r){l||(w(n.$$.fragment,r),l=!0)},o(r){I(n.$$.fragment,r),l=!1},d(r){r&&v(e),B(n),u&&u.d()}}}function ot(t){let e,n,i;return{c(){e=L("input"),d(e,"class","absolute top-[-3px] right-6"),d(e,"type","color")},m(l,u){y(l,e,u),Se(e,t[1]),n||(i=W(e,"input",t[12]),n=!0)},p(l,u){u&2&&Se(e,l[1])},d(l){l&&v(e),n=!1,i()}}}function xt(t){let e,n,i,l,u,r;i=new Ee({props:{Icon:Ot}}),i.$on("click",t[9]);let o=t[4]&&st(t),s=t[3]!=="mask"&&ut(t);return{c(){e=L("div"),n=L("span"),T(i.$$.fragment),l=U(),o&&o.c(),u=U(),s&&s.c(),d(n,"class","absolute top-0 right-0"),d(e,"class","z-50 top-10 right-2 justify-end flex gap-1 absolute")},m(g,_){y(g,e,_),R(e,n),j(i,n,null),R(n,l),o&&o.m(n,null),R(e,u),s&&s.m(e,null),r=!0},p(g,[_]){g[4]?o?o.p(g,_):(o=st(g),o.c(),o.m(n,null)):o&&(o.d(1),o=null),g[3]!=="mask"?s?(s.p(g,_),_&8&&w(s,1)):(s=ut(g),s.c(),w(s,1),s.m(e,null)):s&&(X(),I(s,1,1,()=>{s=null}),G())},i(g){r||(w(i.$$.fragment,g),w(s),r=!0)},o(g){I(i.$$.fragment,g),I(s),r=!1},d(g){g&&v(e),B(i),o&&o.d(),s&&s.d()}}}function en(t,e,n){let i;he();let l=!1,u=!1,{brush_radius:r=20}=e,{brush_color:o="#000"}=e,{container_height:s}=e,{img_width:g}=e,{img_height:_}=e,{mode:m="other"}=e;const a=()=>n(4,l=!l);function f(){r=Ct(this.value),n(0,r)}const p=()=>n(5,u=!u);
1function A(){o=this.value,n(1,o)}return t.$$set=D=>{"brush_radius"in D&&n(0,r=D.brush_radius),"brush_color"in D&&n(1,o=D.brush_color),"container_height"in D&&n(7,s=D.container_height),"img_width"in D&&n(2,g=D.img_width),"img_height"in D&&n(8,_=D.img_height),"mode"in D&&n(3,m=D.mode)},t.$$.update=()=>{t.$$.dirty&388&&n(6,i=s*(g/_))},[r,o,g,m,l,u,i,s,_,a,f,p,A]}class Ke extends ${constructor(e){super(),x(this,e,en,xt,V,{brush_radius:0,brush_color:1,container_height:7,img_width:2,img_height:8,mode:3})}}function tn(t){let e,n;return{c(){e=L("img"),d(e,"class","w-full h-full object-contain"),O(e.src,n=t[0].image||t[0])||d(e,"src",n),d(e,"alt",""),q(e,"scale-x-[-1]",t[4]==="webcam"&&t[10])},m(i,l){y(i,e,l)},p(i,l){l[0]&1&&!O(e.src,n=i[0].image||i[0])&&d(e,"src",n),l[0]&1040&&q(e,"scale-x-[-1]",i[4]==="webcam"&&i[10])},i:F,o:F,d(i){i&&v(e)}}}function nn(t){let e=t[21],n,i,l,u=at(t),r=t[15]>0&&ft(t);return{c(){u.c(),n=U(),r&&r.c(),i=ue()},m(o,s){u.m(o,s),y(o,n,s),r&&r.m(o,s),y(o,i,s),l=!0},p(o,s){s[0]&2097152&&V(e,e=o[21])?(u.d(1),u=at(o),u.c(),u.m(n.parentNode,n)):u.p(o,s),o[15]>0?r?(r.p(o,s),s[0]&32768&&w(r,1)):(r=ft(o),r.c(),w(r,1),r.m(i.parentNode,i)):r&&(X(),I(r,1,1,()=>{r=null}),G())},i(o){l||(w(r),l=!0)},o(o){I(r),l=!1},d(o){u.d(o),o&&v(n),r&&r.d(o),o&&v(i)}}}function ln(t){let e,n,i,l,u;return e=new Le({props:{editable:!0}}),e.$on("edit",t[48]),e.$on("clear",t[24]),{c(){T(e.$$.fragment),n=U(),i=L("img"),d(i,"class","w-full h-full object-contain"),O(i.src,l=t[0])||d(i,"src",l),d(i,"alt",""),q(i,"scale-x-[-1]",t[4]==="webcam"&&t[10])},m(r,o){j(e,r,o),y(r,n,o),y(r,i,o),u=!0},p(r,o){(!u||o[0]&1&&!O(i.src,l=r[0]))&&d(i,"src",l),o[0]&1040&&q(i,"scale-x-[-1]",r[4]==="webcam"&&r[10])},i(r){u||(w(e.$$.fragment,r),u=!0)},o(r){I(e.$$.fragment,r),u=!1},d(r){B(e,r),r&&v(n),r&&v(i)}}}function rn(t){let e,n,i,l;return e=new At({props:{image:t[0]}}),e.$on("crop",t[25]),i=new Le({}),i.$on("clear",t[47]),{c(){T(e.$$.fragment),n=U(),T(i.$$.fragment)},m(u,r){j(e,u,r),y(u,n,r),j(i,u,r),l=!0},p(u,r){const o={};r[0]&1&&(o.image=u[0]),e.$set(o)},i(u){l||(w(e.$$.fragment,u),w(i.$$.fragment,u),l=!0)},o(u){I(e.$$.fragment,u),I(i.$$.fragment,u),l=!1},d(u){B(e,u),u&&v(n),B(i,u)}}}function sn(t){let e,n,i=t[4]==="webcam"&&!t[21]&&ct(t);return{c(){i&&i.c(),e=ue()},m(l,u){i&&i.m(l,u),y(l,e,u),n=!0},p(l,u){l[4]==="webcam"&&!l[21]?i?(i.p(l,u),u[0]&2097168&&w(i,1)):(i=ct(l),i.c(),w(i,1),i.m(e.parentNode,e)):i&&(X(),I(i,1,1,()=>{i=null}),G())},i(l){n||(w(i),n=!0)},o(l){I(i),n=!1},d(l){i&&i.d(l),l&&v(e)}}}function un(t){let e,n,i,l,u,r,o;e=new Ge({}),e.$on("undo",t[38]),e.$on("clear",t[39]);let s=t[1]==="color-sketch"&&ht(t);function g(a){t[42](a)}function _(a){t[43](a)}let m={value:t[0],mode:t[12],width:t[15]||t[20],height:t[14]||t[19],container_height:t[16]||t[19]};return t[17]!==void 0&&(m.brush_radius=t[17]),t[22]!==void 0&&(m.brush_color=t[22]),l=new Xe({props:m}),E.push(()=>H(l,"brush_radius",g)),E.push(()=>H(l,"brush_color",_)),t[44](l),l.$on("change",t[25]),{c(){T(e.$$.fragment),n=U(),s&&s.c(),i=U(),T(l.$$.fragment)},m(a,f){j(e,a,f),y(a,n,f),s&&s.m(a,f),y(a,i,f),j(l,a,f),o=!0},p(a,f){a[1]==="color-sketch"?s?(s.p(a,f),f[0]&2&&w(s,1)):(s=ht(a),s.c(),w(s,1),s.m(i.parentNode,i)):s&&(X(),I(s,1,1,()=>{s=null}),G());const p={};f[0]&1&&(p.value=a[0]),f[0]&4096&&(p.mode=a[12]),f[0]&1081344&&(p.width=a[15]||a[20]),f[0]&540672&&(p.height=a[14]||a[19]),f[0]&589824&&(p.container_height=a[16]||a[19]),!u&&f[0]&131072&&(u=!0,p.brush_radius=a[17],Y(()=>u=!1)),!r&&f[0]&4194304&&(r=!0,p.brush_color=a[22],Y(()=>r=!1)),l.$set(p)},i(a){o||(w(e.$$.fragment,a),w(s),w(l.$$.fragment,a),o=!0)},o(a){I(e.$$.fragment,a),I(s),I(l.$$.fragment,a),o=!1},d(a){B(e,a),a&&v(n),s&&s.d(a),a&&v(i),t[44](null),B(l,a)}}}function on(t){let e,n,i;function l(r){t[37](r)}let u={filetype:"image/x-png,image/gif,image/jpeg",include_file_metadata:!1,disable_click:!!t[0],$$slots:{default:[mn]},$$scope:{ctx:t}};return t[11]!==void 0&&(u.dragging=t[11]),e=new Nt({props:u}),E.push(()=>H(e,"dragging",l)),e.$on("load",t[23]),{c(){T(e.$$.fragment)},m(r,o){j(e,r,o),i=!0},p(r,o){const s={};o[0]&1&&(s.disable_click=!!r[0]),o[0]&8386035|o[1]&134217728&&(s.$$scope={dirty:o,ctx:r}),!n&&o[0]&2048&&(n=!0,s.dragging=r[11],Y(()=>n=!1)),e.$set(s)}
1,i(r){i||(w(e.$$.fragment,r),i=!0)},o(r){I(e.$$.fragment,r),i=!1},d(r){B(e,r)}}}function at(t){let e,n,i,l;return{c(){e=L("img"),d(e,"class","absolute w-full h-full object-contain"),O(e.src,n=t[21]||t[0]?.image||t[0])||d(e,"src",n),d(e,"alt",""),q(e,"scale-x-[-1]",t[4]==="webcam"&&t[10])},m(u,r){y(u,e,r),t[49](e),i||(l=W(e,"load",t[26]),i=!0)},p(u,r){r[0]&2097153&&!O(e.src,n=u[21]||u[0]?.image||u[0])&&d(e,"src",n),r[0]&1040&&q(e,"scale-x-[-1]",u[4]==="webcam"&&u[10])},d(u){u&&v(e),t[49](null),i=!1,l()}}}function ft(t){let e,n,i,l,u,r,o,s;function g(f){t[51](f)}function _(f){t[52](f)}let m={value:t[0],mode:t[12],width:t[15]||t[20],height:t[14]||t[19],container_height:t[16]||t[19],value_img:t[18],source:t[4]};t[17]!==void 0&&(m.brush_radius=t[17]),t[22]!==void 0&&(m.brush_color=t[22]),e=new Xe({props:m}),t[50](e),E.push(()=>H(e,"brush_radius",g)),E.push(()=>H(e,"brush_color",_)),e.$on("change",t[25]),u=new Ge({}),u.$on("undo",t[53]),u.$on("clear",t[27]);let a=(t[1]==="color-sketch"||t[1]==="sketch")&&_t(t);return{c(){T(e.$$.fragment),l=U(),T(u.$$.fragment),r=U(),a&&a.c(),o=ue()},m(f,p){j(e,f,p),y(f,l,p),j(u,f,p),y(f,r,p),a&&a.m(f,p),y(f,o,p),s=!0},p(f,p){const A={};p[0]&1&&(A.value=f[0]),p[0]&4096&&(A.mode=f[12]),p[0]&1081344&&(A.width=f[15]||f[20]),p[0]&540672&&(A.height=f[14]||f[19]),p[0]&589824&&(A.container_height=f[16]||f[19]),p[0]&262144&&(A.value_img=f[18]),p[0]&16&&(A.source=f[4]),!n&&p[0]&131072&&(n=!0,A.brush_radius=f[17],Y(()=>n=!1)),!i&&p[0]&4194304&&(i=!0,A.brush_color=f[22],Y(()=>i=!1)),e.$set(A),f[1]==="color-sketch"||f[1]==="sketch"?a?(a.p(f,p),p[0]&2&&w(a,1)):(a=_t(f),a.c(),w(a,1),a.m(o.parentNode,o)):a&&(X(),I(a,1,1,()=>{a=null}),G())},i(f){s||(w(e.$$.fragment,f),w(u.$$.fragment,f),w(a),s=!0)},o(f){I(e.$$.fragment,f),I(u.$$.fragment,f),I(a),s=!1},d(f){t[50](null),B(e,f),f&&v(l),B(u,f),f&&v(r),a&&a.d(f),f&&v(o)}}}function _t(t){let e,n,i,l;function u(s){t[54](s)}function r(s){t[55](s)}let o={container_height:t[16]||t[19],img_width:t[15]||t[20],img_height:t[14]||t[19],mode:t[12]};return t[17]!==void 0&&(o.brush_radius=t[17]),t[22]!==void 0&&(o.brush_color=t[22]),e=new Ke({props:o}),E.push(()=>H(e,"brush_radius",u)),E.push(()=>H(e,"brush_color",r)),{c(){T(e.$$.fragment)},m(s,g){j(e,s,g),l=!0},p(s,g){const _={};g[0]&589824&&(_.container_height=s[16]||s[19]),g[0]&1081344&&(_.img_width=s[15]||s[20]),g[0]&540672&&(_.img_height=s[14]||s[19]),g[0]&4096&&(_.mode=s[12]),!n&&g[0]&131072&&(n=!0,_.brush_radius=s[17],Y(()=>n=!1)),!i&&g[0]&4194304&&(i=!0,_.brush_color=s[22],Y(()=>i=!1)),e.$set(_)},i(s){l||(w(e.$$.fragment,s),l=!0)},o(s){I(e.$$.fragment,s),l=!1},d(s){B(e,s)}}}function ct(t){let e,n;return e=new Ut({props:{streaming:t[8],pending:t[9],mirror_webcam:t[10]}}),e.$on("capture",t[45]),e.$on("stream",t[25]),e.$on("error",t[46]),{c(){T(e.$$.fragment)},m(i,l){j(e,i,l),n=!0},p(i,l){const u={};l[0]&256&&(u.streaming=i[8]),l[0]&512&&(u.pending=i[9]),l[0]&1024&&(u.mirror_webcam=i[10]),e.$set(u)},i(i){n||(w(e.$$.fragment,i),n=!0)},o(i){I(e.$$.fragment,i),n=!1},d(i){B(e,i)}}}function ht(t){let e,n,i,l;function u(s){t[40](s)}function r(s){t[41](s)}let o={container_height:t[16]||t[19],img_width:t[15]||t[20],img_height:t[14]||t[19]};return t[17]!==void 0&&(o.brush_radius=t[17]),t[22]!==void 0&&(o.brush_color=t[22]),e=new Ke({props:o}),E.push(()=>H(e,"brush_radius",u)),E.push(()=>H(e,"brush_color",r)),{c(){T(e.$$.fragment)},m(s,g){j(e,s,g),l=!0},p(s,g){const _={};g[0]&589824&&(_.container_height=s[16]||s[19]),g[0]&1081344&&(_.img_width=s[15]||s[20]),g[0]&540672&&(_.img_height=s[14]||s[19]),!n&&g[0]&131072&&(n=!0,_.brush_radius=s[17],Y(()=>n=!1)),!i&&g[0]&4194304&&(i=!0,_.brush_color=s[22],Y(()=>i=!1)),e.$set(_)},i(s){l||(w(e.$$.fragment,s),l=!0)},o(s){I(e.$$.fragment,s),l=!1},d(s){B(e,s)}}}function an(t){let e,n;return{c(){e=L("img"),d(e,"class","w-full h-full object-contain"),O(e.src,n=t[0].image||t[0])||d(e,"src",n),d(e,"alt",""),q(e,"scale-x-[-1]",t[4]==="webcam"&&t[10])},m(i,l){y(i,e,l)},p(i,l){l[0]&1&&!O(e.src,n=i[0].image||i[0])&&d(e,"src",n),l[0]&1040&&q(e,"scale-x-[-1]",i[4]==="webcam"&&i[10])},i:F,o:F,d(i){i&&v(e)}}}function fn(t){let e=t[21],n,i,l,u=mt(t),r=t[15]>0&&gt(t);return{c(){u.c(),n=U(),r&&r.c(),i=ue()},m(o,s){u.m(o,s),y(o,n,s),r&&r.m(o,s),y(o,i,s),l=!0},p(o,s){s[0]&2097152&&V(e,e=o[21])?(u.d(1),u=mt(o),u.c(),u.m(n.parentNode,n)):u.p(o,s),o[15]>0?r?(r.p(o,s),s[0]&32768&&w(r,1)):(r=gt(o),r.c(),w(r,1),r.m(i.parentNode,i)):r&&(X(),I(r,1,1,()=>{r=null}),G())},i(o){l||(w(r),l=!0)},o(o){I(r),l=!1},d(o){u.d(o),o&&v(n),r&&r.d(o),o&&v(i)}}}function _n(t){let e,n,i,l,u;return e=new Le({props:{editable:!0}}),e.$on("edit",t[29]),e.$on("clear",t[24]),{c(){T(e.$$.fragment),n=U(),i=L("img"),d(i,"class","w-full h-full object-contain"),O(i.src,l=t[0])||d(i,"src",l),d(i,"alt",""),q(i,"scale-x-[-1]",t[4]==="webcam"&&t[10])},m(r,o){j(e,r,o),y(r,n,o),y(r,i,o),u=!0},p(r,o){(!u||o[0]&1&&!O(i.src,l=r[0]))&&d(i,"src",l),o[0]&1040&&q(i,"scale-x-[-1]",r[4]==="webcam"&&r[10])},i(r){u||(w(e.$$.fragment,r),u=!0)},o(r){I(e.$$.fragment,r),u=!1},d(r){B(e,r),r&&v(n),r&&v(i)}}}function cn(t){let e,n,i,l;return e=new At({props:{image:t[0]}}),e.$on("crop",t[25]),i=new Le({}),i.$on("clear",t[28]),{c(){T(e.$$.fragment),n=U(),T(i.$$.fragment)},m(u,r){j(e,u,r),y(u,n,r),j(i,u,r),l=!0},p(u,r){const o={};r[0]&1&&(o.image=u[0]),e.$set(o)},i(u){l||(w(e.$$.fragment,u),w(i.$$.fragment,u),l=!0)},o(u){I(e.$$.fragment,u),I(i.$$.fragment,u),l=!1},d(u){B(e,u),u&&v(n),B(i,u)}}}function hn(t){let e,n,i,l,u,r,o,s,g;return{c(){e=L("div"),n=be(t[5]),i=U(),l=L("span"),u=be("- "),r=be(t[6]),o=be(" -"),s=U(),g=be(t[7]),d(l,"class","text-gray-300"),d(e,"class","flex flex-col")},m(_,m){y(_,e,m),R(e,n),R(e,i),R(e,l),R(l,u),R(l,r),R(l,o),R(e,s),R(e,g)},p(_,m){m[0]&32&&Qe(n,_[5]),m[0]&64&&Qe(r,_[6]),m[0]&128&&Qe(g,_[7])},i:F,o:F,d(_){_&&v(e)}}}function mt(t){let e,n,i,l;return{c(){e=L("img"),d(e,"class","absolute w-full h-full object-contain"),O(e.src,n=t[21]||t[0]?.image||t[0])||d(e,"src",n),d(e,"alt",""),q(e,"scale-x-[-1]",t[4]==="webcam"&&t[10])},m(u,r){y(u,e,r),t[30](e),i||(l=W(e,"load",t[26]),i=!0)},p(u,r){r[0]&2097153&&!O(e.src,n=u[21]||u[0]?.image||u[0])&&d(e,"src",n),r[0]&1040&&q(e,"scale-x-[-1]",u[4]==="webcam"&&u[10])},d(u){u&&v(e),t[30](null),i=!1,l()}}}function gt(t){let e,n,i,l,u,r,o,s;function g(f){t[32](f)}function _(f){t[33](f)}let m={value:t[0],mode:t[12],width:t[15]||t[20],height:t[14]||t[19],container_height:t[16]||t[19],value_img:t[18],source:t[4]};t[17]!==void 0&&(m.brush_radius=t[17]),t[22]!==void 0&&(m.brush_color=t[22]),e=new Xe({props:m}),t[31](e),E.push(()=>H(e,"brush_radius",g)),E.push(()=>H(e,"brush_color",_)),e.$on("change",t[25]),u=new Ge({}
1),u.$on("undo",t[34]),u.$on("clear",t[27]);let a=(t[1]==="color-sketch"||t[1]==="sketch")&&dt(t);return{c(){T(e.$$.fragment),l=U(),T(u.$$.fragment),r=U(),a&&a.c(),o=ue()},m(f,p){j(e,f,p),y(f,l,p),j(u,f,p),y(f,r,p),a&&a.m(f,p),y(f,o,p),s=!0},p(f,p){const A={};p[0]&1&&(A.value=f[0]),p[0]&4096&&(A.mode=f[12]),p[0]&1081344&&(A.width=f[15]||f[20]),p[0]&540672&&(A.height=f[14]||f[19]),p[0]&589824&&(A.container_height=f[16]||f[19]),p[0]&262144&&(A.value_img=f[18]),p[0]&16&&(A.source=f[4]),!n&&p[0]&131072&&(n=!0,A.brush_radius=f[17],Y(()=>n=!1)),!i&&p[0]&4194304&&(i=!0,A.brush_color=f[22],Y(()=>i=!1)),e.$set(A),f[1]==="color-sketch"||f[1]==="sketch"?a?(a.p(f,p),p[0]&2&&w(a,1)):(a=dt(f),a.c(),w(a,1),a.m(o.parentNode,o)):a&&(X(),I(a,1,1,()=>{a=null}),G())},i(f){s||(w(e.$$.fragment,f),w(u.$$.fragment,f),w(a),s=!0)},o(f){I(e.$$.fragment,f),I(u.$$.fragment,f),I(a),s=!1},d(f){t[31](null),B(e,f),f&&v(l),B(u,f),f&&v(r),a&&a.d(f),f&&v(o)}}}function dt(t){let e,n,i,l;function u(s){t[35](s)}function r(s){t[36](s)}let o={container_height:t[16]||t[19],img_width:t[15]||t[20],img_height:t[14]||t[19],mode:t[12]};return t[17]!==void 0&&(o.brush_radius=t[17]),t[22]!==void 0&&(o.brush_color=t[22]),e=new Ke({props:o}),E.push(()=>H(e,"brush_radius",u)),E.push(()=>H(e,"brush_color",r)),{c(){T(e.$$.fragment)},m(s,g){j(e,s,g),l=!0},p(s,g){const _={};g[0]&589824&&(_.container_height=s[16]||s[19]),g[0]&1081344&&(_.img_width=s[15]||s[20]),g[0]&540672&&(_.img_height=s[14]||s[19]),g[0]&4096&&(_.mode=s[12]),!n&&g[0]&131072&&(n=!0,_.brush_radius=s[17],Y(()=>n=!1)),!i&&g[0]&4194304&&(i=!0,_.brush_color=s[22],Y(()=>i=!1)),e.$set(_)},i(s){l||(w(e.$$.fragment,s),l=!0)},o(s){I(e.$$.fragment,s),l=!1},d(s){B(e,s)}}}function mn(t){let e,n,i,l;const u=[hn,cn,_n,fn,an],r=[];function o(s,g){return s[0]===null&&!s[21]||s[8]?0:s[1]==="select"?1:s[1]==="editor"?2:(s[1]==="sketch"||s[1]==="color-sketch")&&(s[0]!==null||s[21])?3:4}return e=o(t),n=r[e]=u[e](t),{c(){n.c(),i=ue()},m(s,g){r[e].m(s,g),y(s,i,g),l=!0},p(s,g){let _=e;e=o(s),e===_?r[e].p(s,g):(X(),I(r[_],1,1,()=>{r[_]=null}),G(),n=r[e],n?n.p(s,g):(n=r[e]=u[e](s),n.c()),w(n,1),n.m(i.parentNode,i))},i(s){l||(w(n),l=!0)},o(s){I(n),l=!1},d(s){r[e].d(s),s&&v(i)}}}function gn(t){let e,n,i,l,u,r,o;e=new wt({props:{show_label:t[3],Icon:t[4]==="canvas"?xe:De,label:t[2]||(t[4]==="canvas"?"Sketch":"Image")}});const s=[on,un,sn,rn,ln,nn,tn],g=[];function _(m,a){return m[4]==="upload"?0:m[4]==="canvas"?1:m[0]===null&&!m[21]||m[8]?2:m[1]==="select"?3:m[1]==="editor"?4:(m[1]==="sketch"||m[1]==="color-sketch")&&(m[0]!==null||m[21])?5:6}return l=_(t),u=g[l]=s[l](t),{c(){T(e.$$.fragment),n=U(),i=L("div"),u.c(),d(i,"data-testid","image"),Ve(()=>t[56].call(i)),q(i,"bg-gray-200",t[0]),q(i,"h-60",t[4]!=="webcam"||t[1]==="sketch"||t[1]==="color-sketch")},m(m,a){j(e,m,a),y(m,n,a),y(m,i,a),g[l].m(i,null),r=pt(i,t[56].bind(i)),o=!0},p(m,a){const f={};a[0]&8&&(f.show_label=m[3]),a[0]&16&&(f.Icon=m[4]==="canvas"?xe:De),a[0]&20&&(f.label=m[2]||(m[4]==="canvas"?"Sketch":"Image")),e.$set(f);let p=l;l=_(m),l===p?g[l].p(m,a):(X(),I(g[p],1,1,()=>{g[p]=null}),G(),u=g[l],u?u.p(m,a):(u=g[l]=s[l](m),u.c()),w(u,1),u.m(i,null)),a[0]&1&&q(i,"bg-gray-200",m[0]),a[0]&18&&q(i,"h-60",m[4]!=="webcam"||m[1]==="sketch"||m[1]==="color-sketch")},i(m){o||(w(e.$$.fragment,m),w(u),o=!0)},o(m){I(e.$$.fragment,m),I(u),o=!1},d(m){B(e,m),m&&v(n),m&&v(i),g[l].d(),r()}}}function dn(t,e,n){let i,{value:l}=e,{label:u=void 0}=e,{show_label:r}=e,{source:o="upload"}=e,{tool:s="editor"}=e,{drop_text:g="Drop an image file"}=e,{or_text:_="or"}=e,{upload_text:m="click to upload"}=e,{streaming:a=!1}=e,{pending:f=!1}=e,{mirror_webcam:p}=e,A;l&&(o==="upload"||o==="webcam")&&s==="sketch"&&(l={image:l,mask:null});function D({detail:h}){s==="color-sketch"?n(21,re=h):n(0,l=(o==="upload"||o==="webcam")&&s==="sketch"?{image:h,mask:null}:h),z("upload",h)}function ee({detail:h}){n(0,l=null),n(21,re=void 0),z("clear")}
1async function oe({detail:h},S){k==="mask"?o==="webcam"&&S?n(0,l={image:h,mask:null}):n(0,l={image:typeof l=="string"?l:l?.image||null,mask:h}):(o==="upload"||o==="webcam")&&s==="sketch"?n(0,l={image:h,mask:null}):n(0,l=h),await Re(),z(a?"stream":"edit")}const z=he();let b=!1;function P(h){const S=h.composedPath()[0];n(15,ne=S.naturalWidth),n(14,te=S.naturalHeight),n(16,ie=S.getBoundingClientRect().height)}async function J(){A.clear(),await Re(),n(0,l=null),n(21,re=void 0)}let te=0,ne=0,ie=0,N=20,k,K,ae,le,re;const Ue=h=>(ee(h),n(1,s="editor")),me=()=>n(1,s="select");function Fe(h){E[h?"unshift":"push"](()=>{K=h,n(18,K)})}function ke(h){E[h?"unshift":"push"](()=>{A=h,n(13,A)})}function Ne(h){N=h,n(17,N)}function pe(h){i=h,n(22,i),n(12,k),n(4,o),n(1,s)}const we=()=>A.undo();function Ae(h){N=h,n(17,N)}function Ie(h){i=h,n(22,i),n(12,k),n(4,o),n(1,s)}function fe(h){b=h,n(11,b)}const ye=()=>A.undo(),ve=()=>A.clear();function Ce(h){N=h,n(17,N)}function Me(h){i=h,n(22,i),n(12,k),n(4,o),n(1,s)}function ze(h){N=h,n(17,N)}function Te(h){i=h,n(22,i),n(12,k),n(4,o),n(1,s)}function se(h){E[h?"unshift":"push"](()=>{A=h,n(13,A)})}const _e=h=>s==="color-sketch"?D(h):oe(h,!0);function je(h){ce.call(this,t,h)}const ge=h=>(ee(h),n(1,s="editor")),qe=()=>n(1,s="select");function Be(h){E[h?"unshift":"push"](()=>{K=h,n(18,K)})}function Oe(h){E[h?"unshift":"push"](()=>{A=h,n(13,A)})}function We(h){N=h,n(17,N)}function Pe(h){i=h,n(22,i),n(12,k),n(4,o),n(1,s)}const Je=()=>A.undo();function c(h){N=h,n(17,N)}function C(h){i=h,n(22,i),n(12,k),n(4,o),n(1,s)}function M(){ae=this.offsetHeight,le=this.offsetWidth,n(19,ae),n(20,le)}return t.$$set=h=>{"value"in h&&n(0,l=h.value),"label"in h&&n(2,u=h.label),"show_label"in h&&n(3,r=h.show_label),"source"in h&&n(4,o=h.source),"tool"in h&&n(1,s=h.tool),"drop_text"in h&&n(5,g=h.drop_text),"or_text"in h&&n(6,_=h.or_text),"upload_text"in h&&n(7,m=h.upload_text),"streaming"in h&&n(8,a=h.streaming),"pending"in h&&n(9,f=h.pending),"mirror_webcam"in h&&n(10,p=h.mirror_webcam)},t.$$.update=()=>{t.$$.dirty[0]&1&&z("change",l),t.$$.dirty[0]&2048&&z("drag",b),t.$$.dirty[0]&18&&(o==="canvas"&&s==="sketch"?n(12,k="bw-sketch"):s==="color-sketch"?n(12,k="color-sketch"):(o==="upload"||o==="webcam")&&s==="sketch"?n(12,k="mask"):n(12,k="editor")),t.$$.dirty[0]&4096&&n(22,i=k=="mask"?"#000000":"#000"),t.$$.dirty[0]&1&&(l===null||l.image===null&&l.mask===null)&&n(21,re=void 0)},[l,s,u,r,o,g,_,m,a,f,p,b,k,A,te,ne,ie,N,K,ae,le,re,i,D,ee,oe,P,J,Ue,me,Fe,ke,Ne,pe,we,Ae,Ie,fe,ye,ve,Ce,Me,ze,Te,se,_e,je,ge,qe,Be,Oe,We,Pe,Je,c,C,M]}class bn extends ${constructor(e){super(),x(this,e,dn,gn,V,{value:0,label:2,show_label:3,source:4,tool:1,drop_text:5,or_text:6,upload_text:7,streaming:8,pending:9,mirror_webcam:10},null,[-1,-1])}}function kn(t){let e,n;return{c(){e=L("img"),d(e,"class","w-full h-full object-contain"),O(e.src,n=t[0])||d(e,"src",n),d(e,"alt","")},m(i,l){y(i,e,l)},p(i,l){l&1&&!O(e.src,n=i[0])&&d(e,"src",n)},i:F,o:F,d(i){i&&v(e)}}}function pn(t){let e,n,i,l;return i=new De({}),{c(){e=L("div"),n=L("div"),T(i.$$.fragment),d(n,"class","h-5 dark:text-white opacity-50"),d(e,"class","h-full min-h-[15rem] flex justify-center items-center")},m(u,r){y(u,e,r),R(e,n),j(i,n,null),l=!0},p:F,i(u){l||(w(i.$$.fragment,u),l=!0)},o(u){I(i.$$.fragment,u),l=!1},d(u){u&&v(e),B(i)}}}function wn(t){let e,n,i,l,u,r;e=new wt({props:{show_label:t[2],Icon:De,label:t[1]||"Image"}});const o=[pn,kn],s=[];function g(_,m){return _[0]===null?0:1}return i=g(t),l=s[i]=o[i](t),{c(){T(e.$$.fragment),n=U(),l.c(),u=ue()},m(_,m){j(e,_,m),y(_,n,m),s[i].m(_,m),y(_,u,m),r=!0},p(_,[m]){const a={};m&4&&(a.show_label=_[2]),m&2&&(a.label=_[1]||"Image"),e.$set(a);let f=i;i=g(_),i===f?s[i].p(_,m):(X(),I(s[f],1,1,()=>{s[f]=null}),G(),l=s[i],l?l.p(_,m):(l=s[i]=o[i](_),l.c()),w(l,1),l.m(u.parentNode,u))},i(_){r||(w(e.$$.fragment,_),w(l),r=!0)},o(_){I(e.$$.fragment,_),I(l),r=!1},d(_){B(e,_),_&&v(n),s[i].d(_),_&&v(u)}}}function An(t,e,n){let{value:i}=e,{label:l=void 0}=e,{show_label:u}=e;const r=he();return t.$$set=o=>{"value"in o&&n(0,i=o.value),"label"in o&&n(1,l=o.label),"show_label"in o&&n(2,u=o.show_label)},t.$$.update=()=>
1{t.$$.dirty&1&&i&&r("change",i)},[i,l,u]}class In extends ${constructor(e){super(),x(this,e,An,wn,V,{value:0,label:1,show_label:2})}}function yn(t){let e,n,i;function l(r){t[15](r)}let u={source:t[4],tool:t[5],label:t[6],show_label:t[7],pending:t[9],streaming:t[8],drop_text:t[14]("interface.drop_image"),or_text:t[14]("or"),upload_text:t[14]("interface.click_to_upload"),mirror_webcam:t[11]};return t[0]!==void 0&&(u.value=t[0]),e=new bn({props:u}),E.push(()=>H(e,"value",l)),e.$on("edit",t[16]),e.$on("clear",t[17]),e.$on("change",t[18]),e.$on("stream",t[19]),e.$on("drag",t[20]),e.$on("upload",t[21]),e.$on("error",t[22]),{c(){T(e.$$.fragment)},m(r,o){j(e,r,o),i=!0},p(r,o){const s={};o&16&&(s.source=r[4]),o&32&&(s.tool=r[5]),o&64&&(s.label=r[6]),o&128&&(s.show_label=r[7]),o&512&&(s.pending=r[9]),o&256&&(s.streaming=r[8]),o&16384&&(s.drop_text=r[14]("interface.drop_image")),o&16384&&(s.or_text=r[14]("or")),o&16384&&(s.upload_text=r[14]("interface.click_to_upload")),o&2048&&(s.mirror_webcam=r[11]),!n&&o&1&&(n=!0,s.value=r[0],Y(()=>n=!1)),e.$set(s)},i(r){i||(w(e.$$.fragment,r),i=!0)},o(r){I(e.$$.fragment,r),i=!1},d(r){B(e,r)}}}function vn(t){let e,n;return e=new In({props:{value:t[0],label:t[6],show_label:t[7]}}),{c(){T(e.$$.fragment)},m(i,l){j(e,i,l),n=!0},p(i,l){const u={};l&1&&(u.value=i[0]),l&64&&(u.label=i[6]),l&128&&(u.show_label=i[7]),e.$set(u)},i(i){n||(w(e.$$.fragment,i),n=!0)},o(i){I(e.$$.fragment,i),n=!1},d(i){B(e,i)}}}function Cn(t){let e,n,i,l,u,r;const o=[t[1]];let s={};for(let a=0;a<o.length;a+=1)s=jt(s,o[a]);e=new Bt({props:s});const g=[vn,yn],_=[];function m(a,f){return a[12]==="static"?0:1}return i=m(t),l=_[i]=g[i](t),{c(){T(e.$$.fragment),n=U(),l.c(),u=ue()},m(a,f){j(e,a,f),y(a,n,f),_[i].m(a,f),y(a,u,f),r=!0},p(a,f){const p=f&2?Rt(o,[St(a[1])]):{};e.$set(p);let A=i;i=m(a),i===A?_[i].p(a,f):(X(),I(_[A],1,1,()=>{_[A]=null}),G(),l=_[i],l?l.p(a,f):(l=_[i]=g[i](a),l.c()),w(l,1),l.m(u.parentNode,u))},i(a){r||(w(e.$$.fragment,a),w(l),r=!0)},o(a){I(e.$$.fragment,a),I(l),r=!1},d(a){B(e,a),a&&v(n),_[i].d(a),a&&v(u)}}}function Mn(t){let e,n;return e=new Mt({props:{visible:t[3],variant:t[12]==="dynamic"&&t[0]===null&&t[4]==="upload"?"dashed":"solid",color:t[13]?"green":"grey",padding:!1,elem_id:t[2],style:{height:t[10].height,width:t[10].width},$$slots:{default:[Cn]},$$scope:{ctx:t}}}),{c(){T(e.$$.fragment)},m(i,l){j(e,i,l),n=!0},p(i,[l]){const u={};l&8&&(u.visible=i[3]),l&4113&&(u.variant=i[12]==="dynamic"&&i[0]===null&&i[4]==="upload"?"dashed":"solid"),l&8192&&(u.color=i[13]?"green":"grey"),l&4&&(u.elem_id=i[2]),l&1024&&(u.style={height:i[10].height,width:i[10].width}),l&16808947&&(u.$$scope={dirty:l,ctx:i}),e.$set(u)},i(i){n||(w(e.$$.fragment,i),n=!0)},o(i){I(e.$$.fragment,i),n=!1},d(i){B(e,i)}}}function zn(t,e,n){let i;zt(t,Tt,k=>n(14,i=k));let{elem_id:l=""}=e,{visible:u=!0}=e,{value:r=null}=e,{source:o="upload"}=e,{tool:s="editor"}=e,{label:g}=e,{show_label:_}=e,{streaming:m}=e,{pending:a}=e,{style:f={}}=e,{mirror_webcam:p}=e,{loading_status:A}=e,{mode:D}=e;const ee=he();let oe;function z(k){r=k,n(0,r)}function b(k){ce.call(this,t,k)}function P(k){ce.call(this,t,k)}function J(k){ce.call(this,t,k)}function te(k){ce.call(this,t,k)}const ne=({detail:k})=>n(13,oe=k);function ie(k){ce.call(this,t,k)}const N=({detail:k})=>{n(1,A=A||{}),n(1,A.status="error",A),n(1,A.message=k,A)};return t.$$set=k=>{"elem_id"in k&&n(2,l=k.elem_id),"visible"in k&&n(3,u=k.visible),"value"in k&&n(0,r=k.value),"source"in k&&n(4,o=k.source),"tool"in k&&n(5,s=k.tool),"label"in k&&n(6,g=k.label),"show_label"in k&&n(7,_=k.show_label),"streaming"in k&&n(8,m=k.streaming),"pending"in k&&n(9,a=k.pending),"style"in k&&n(10,f=k.style),"mirror_webcam"in k&&n(11,p=k.mirror_webcam),"loading_status"in k&&n(1,A=k.loading_status),"mode"in k&&n(12,D=k.mode)},t.$$.update=()=>{t.$$.dirty&1&&n(0,r=r||null),t.$$.dirty&1&&ee("change")},[r,A,l,u,o,s,g,_,m,a,f,p,D,oe,i,z,b,P,J,te,ne,ie,N]}class Tn extends ${constructor(e){super(),x(this,e,zn,Mn,V,{elem_id:2,visible:3,value:0,source:4,tool:5,label:6,show_label:7,streaming:8,pending:9,style:10,mirror_webcam:11,loading_status:1,mode:12})}}var Ln=Tn;const Un=["static","dynamic"],Fn=t=>({type:"string",description:"image data as base64 string",example_data:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAACklEQVR4nGMAAQAABQABDQottAAAAABJRU5ErkJggg=="});
1export{Ln as Component,On as ExampleComponent,Fn as document,Un as modes};
2//# sourceMappingURL=index.6c3ab447.js.map

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.