PageSourceSearch

https://qwdgvsd-real-cugan.hf.space/assets/index.d32483be.js

js qwdgvsd-real-cugan.hf.space collected 2026-10-03 10:21:39 UTC 39,733 bytes, 1 lines download raw bytes

1import{S as $,i as x,s as V,v as J,b as d,f as y,g as D,w as F,n as C,e as N,L as W,E as ce,aa as bt,H as E,ab as Ve,ag as Ge,Y as Ye,l as O,W as vt,z as kt,a as q,ae as pt,j as w,C as Z,k as v,D as K,B as yt,a7 as Be,I as Ct,ah as $e,J as he,c as j,m as A,o as S,a4 as De,ai as zt,d as U,A as ue,K as X,N as Y,t as be,h as Je,O as Mt,X as Tt,P as jt,Q as At,R as St,T as Bt}from"./index.06d85743.js";import{B as wt}from"./BlockLabel.23fe9ed2.js";import{I as Le}from"./Image.80afbf87.js";import{C as Dt,i as Lt,U as Rt,W as Et}from"./Webcam.2e319d36.js";import{I as Re,C as Nt,M as Ee}from"./ModifyUpload.fd98232b.js";import{U as qt}from"./Upload.10acfeba.js";import{B as Ft}from"./Block.324ba9b6.js";import{E as On}from"./Image.498007fd.js";import"./styles.ed3b21b5.js";function Ut(t){let e,n,i;return{c(){e=J("svg"),n=J("path"),i=J("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),D(e,n),D(e,i)},p:F,i:F,o:F,d(l){l&&C(e)}}}class Wt extends ${constructor(e){super(),x(this,e,null,Ut,V,{})}}function Ot(t){let e,n,i,l,u,r,o;return{c(){e=J("svg"),n=J("circle"),i=J("circle"),l=J("circle"),u=J("circle"),r=J("circle"),o=J("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),D(e,n),D(e,i),D(e,l),D(e,u),D(e,r),D(e,o)},p:F,i:F,o:F,d(s){s&&C(e)}}}class Ht extends ${constructor(e){super(),x(this,e,null,Ot,V,{})}}function Pt(t){let e,n;return{c(){e=J("svg"),n=J("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),D(e,n)},p:F,i:F,o:F,d(i){i&&C(e)}}}class xe extends ${constructor(e){super(),x(this,e,null,Pt,V,{})}}function Xt(t){let e,n;return{c(){e=N("img"),W(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&&!W(e.src,n=i[0])&&d(e,"src",n)},i:F,o:F,d(i){i&&C(e),t[2](null)}}}function Yt(t,e,n){let{image:i}=e,l;const u=ce();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 It extends ${constructor(e){super(),x(this,e,Yt,Xt,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 Jt=30;class Vt{constructor({radius:e=Jt,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=N("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=Ge(e,$e,{duration:50},!0)),n.run(1)}),i=!0)},o(l){n||(n=Ge(e,$e,{duration:50},!1)),n.run(0),i=!1},d(l){l&&C(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=N("canvas"),d(e,"key",n=t[56]),d(e,"class","inset-0 m-auto hover:cursor-none"),Ye(e,"display","block"),Ye(e,"position","absolute"),Ye(e,"z-index",t[57])},m(s,g){y(s,e,g),r(),l||(u=[O(e,"mousedown",t[56]==="interface"?t[6]:void 0),O(e,"mousemove",t[56]==="interface"?t[7]:void 0),O(e,"mouseup",t[56]==="interface"?t[8]:void 0),O(e,"mouseout",t[56]==="interface"?t[8]:void 0),O(e,"blur",t[56]==="interface"?t[8]:void 0),O(e,"touchstart",t[56]==="interface"?t[6]:void 0),O(e,"touchmove",t[56]==="interface"?t[7]:void 0),O(e,"touchend",t[56]==="interface"?t[8]:void 0),O(e,"touchcancel",t[56]==="interface"?t[8]:void 0),O(e,"click",vt(t[26]))],l=!0)},p(s,g){t=s,i!==t[56]&&(o(),i=t[56],r())},d(s){s&&C(e),o(),l=!1,kt(u)}}}function Zt(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=N("div"),u&&u.c(),n=q();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),D(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&&(Z(),v(u,1,1,()=>{u=null}),K()),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){v(u),l=!1},d(s){s&&C(e),u&&u.d(),yt(o,s),t[28](null),i()}}}let Kt="#aaa";function rt(t,e){return{x:t.x+(e.x-t.x)/2,y:t.y+(e.y-t.y)/2}}function Qt(t,e,n){let i;const l=ce();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,k,I=m,R=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 T={},b={},H=[],P=[],te=!0,ne=!0,ie=!1,p=!1,B=null,Q=null,ae=null,le=0;bt(async()=>{Object.keys(T).forEach(c=>{n(23,b[c]=T[c].getContext("2d"),b)}
1),await Be(),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(T.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(T.temp,0,0,m,a),me({lines:P.slice()}),se()},100)),n(25,B=new Vt({radius:g*.05,enabled:!0,initialPoint:{x:m/2,y:a/2}})),ae=new Lt((c,z,...M)=>{ve(c,z)}),ae.observe(Q),ge(),n(21,k=!0),requestAnimationFrame(()=>{re(),requestAnimationFrame(()=>{_e()})})});function re(){const c=m/2,z=a/2;B.update({x:c,y:z},{both:!0}),B.update({x:c,y:z},{both:!1}),te=!0,ne=!0}Ct(()=>{n(21,k=!1),ae.unobserve(Q)});function Ne(){const c=P.slice(0,-1);Ae(),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),(!P||!P.length)&&b.drawing.drawImage(T.temp,0,0,m,a)),me({lines:c}),n(4,le=c.length),P.length&&n(24,P=c),se()}let me=({lines:c})=>{c.forEach(z=>{const{points:M,brush_color:h,brush_radius:L}=z;ze({points:M,brush_color:h,brush_radius:L}),o==="mask"&&Me({points:M,brush_color:h,brush_radius:L}),H=M}),je({brush_color:s,brush_radius:g}),o==="mask"&&Te()},qe=c=>{c.preventDefault(),p=!0;const{x:z,y:M}=ye(c);c.touches&&c.touches.length>0&&B.update({x:z,y:M},{both:!0}),Ce(z,M),n(4,le+=1)},ke=c=>{c.preventDefault();const{x:z,y:M}=ye(c);Ce(z,M)},Fe=c=>{c.preventDefault(),ke(c),ie=!1,p=!1,je(),o==="mask"&&Te()},pe=0,we=0,Ie=0,ve=async()=>{if(m===pe&&a===we&&Ie===f)return;const c={width:m,height:a},z={height:f,width:f*(c.width/c.height)};await Promise.all([fe(T.interface,c,z),fe(T.drawing,c,z),fe(T.temp,c,z),fe(T.temp_fake,c,z),fe(T.mask,c,z,!1)]),n(9,g=20*(c.width/z.width)),ge({once:!0}),setTimeout(()=>{we=a,pe=m,Ie=f},100),_e()},fe=async(c,z,M,h=!0)=>{if(!k)return;await Be();const L=window.devicePixelRatio||1;c.width=z.width*(h?L:1),c.height=z.height*(h?L:1);const G=c.getContext("2d");h&&G.scale(L,L),c.style.width=`${M.width}px`,c.style.height=`${M.height}px`},ye=c=>{const z=T.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-z.left)/z.width*m,y:(h-z.top)/z.height*a}},Ce=(c,z)=>{B.update({x:c,y:z});const M=!B.isEnabled();(p&&!ie||M&&p)&&(ie=!0,H.push(B.brush.toObject())),ie&&(H.push(B.brush.toObject()),ze({points:H,brush_color:s,brush_radius:g}),o==="mask"&&Me({points:H,brush_color:s,brush_radius:g})),te=!0},ze=({points:c,brush_color:z,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=z,b),n(23,b.temp.lineWidth=M,b),!c||c.length<2))return;let h=c[0],L=c[1];b.temp.moveTo(L.x,L.y),b.temp.beginPath();for(var G=1,Xe=c.length;G<Xe;G++){var de=rt(h,L);b.temp.quadraticCurveTo(h.x,h.y,de.x,de.y),h=c[G],L=c[G+1]}b.temp.lineTo(h.x,h.y),b.temp.stroke()},Me=({points:c,brush_color:z,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],L=c[1];b.temp_fake.moveTo(L.x,L.y),b.temp_fake.beginPath();for(var G=1,Xe=c.length;G<Xe;G++){var de=rt(h,L);b.temp_fake.quadraticCurveTo(h.x,h.y,de.x,de.y),h=c[G],L=c[G+1]}b.temp_fake.lineTo(h.x,h.y),b.temp_fake.stroke()},Te=()=>{H.length<1||(H.length=0,b.mask.drawImage(T.temp_fake,0,0,m,a),se())},je=()=>{H.length<1||(P.push({points:H.slice(),brush_color:s,brush_radius:g}),o!=="mask"&&(H.length=0),b.drawing.drawImage(T.temp,0,0,m,a),se())},se=()=>{const c=Se();l("change",c)};function _e(){return n(24,P=[]),Ae(),n(4,le=0),!0}function Ae(){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,T.temp_fake.width,T.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 z=B.getPointerCoordinates(),M=B.getBrushCoordinates();Ue(b.interface,z,M),te=!1,ne=!1}c||window.requestAnimationFrame(()=>{ge()})},Ue=(c,z,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=Kt,c.arc(M.x,M.y,i,0,Math.PI*2,!0),c.fill()};function Se(){return o==="mask"?T.mask.toDataURL("image/jpg"):T.drawing.toDataURL("image/jpg")}function We(c){he.call(this,t,c)}function Oe(c,z){E[c?"unshift":"push"](()=>{T[z]=c,n(0,T)})}function He(c){E[c?"unshift":"push"](()=>{Q=c,n(3,Q)})}function Pe(){I=this.offsetWidth,R=this.offsetHeight,n(1,I),n(2,R)}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&&k&&!u&&_e(),t.$$.dirty[0]&31574017&&k&&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(T.temp,0,0,m,a),me({lines:P.slice()}),se()},50)),t.$$.dirty[0]&33554944&&B&&(re(),B.setRadius(g*.05)),t.$$.dirty[0]&98304&&(m||a)&&ve(),t.$$.dirty[0]&512&&(i=g*.075)},[T,I,R,Q,le,oe,qe,ke,Fe,g,u,r,o,s,_,m,a,f,Ne,_e,Se,k,ee,b,P,B,We,Oe,He,Pe]}class Ze extends ${constructor(e){super(),x(this,e,Qt,Zt,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 Gt(t){let e,n,i,l,u;return n=new Re({props:{Icon:Rt}}),n.$on("click",t[1]),l=new Re({props:{Icon:Nt}}),l.$on("click",t[2]),{c(){e=N("div"),j(n.$$.fragment),i=q(),j(l.$$.fragment),d(e,"class","z-50 top-2 right-2 justify-end flex gap-1 absolute")},m(r,o){y(r,e,o),A(n,e,null),D(e,i),A(l,e,null),u=!0},p:F,i(r){u||(w(n.$$.fragment,r),w(l.$$.fragment,r),u=!0)},o(r){v(n.$$.fragment,r),v(l.$$.fragment,r),u=!1},d(r){r&&C(e),S(n),S(l)}}}function $t(t){const e=ce();return[e,()=>e("undo"),()=>e("clear")]}class Ke extends ${constructor(e){super(),x(this,e,$t,Gt,V,{})}}function st(t){let e,n,i,l,u;return{c(){e=N("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),De(e,t[0]),l||(u=[O(e,"change",t[10]),O(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&&De(e,r[0])},d(r){r&&C(e),l=!1,kt(u)}}}function ut(t){let e,n,i,l;n=new Re({props:{Icon:Ht}}),n.$on("click",t[11]);let u=t[5]&&ot(t);return{c(){e=N("span"),j(n.$$.fragment),i=q(),u&&u.c(),d(e,"class","absolute top-6 right-0")},m(r,o){y(r,e,o),A(n,e,null),D(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){v(n.$$.fragment,r),l=!1},d(r){r&&C(e),S(n),u&&u.d()}}}function ot(t){let e,n,i;return{c(){e=N("input"),d(e,"class","absolute top-[-3px] right-6"),d(e,"type","color")},m(l,u){y(l,e,u),De(e,t[1]),n||(i=O(e,"input",t[12]),n=!0)},p(l,u){u&2&&De(e,l[1])},d(l){l&&C(e),n=!1,i()}}}function xt(t){let e,n,i,l,u,r;i=new Re({props:{Icon:Wt}}),i.$on("click",t[9]);let o=t[4]&&st(t),s=t[3]!=="mask"&&ut(t);return{c(){e=N("div"),n=N("span"),j(i.$$.fragment),l=q(),o&&o.c(),u=q(),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,_),D(e,n),A(i,n,null),D(n,l),o&&o.m(n,null),D(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&&(Z(),v(s,1,1,()=>{s=null}),K())},i(g){r||(w(i.$$.fragment,g),w(s),r=!0)},o(g){v(i.$$.fragment,g),v(s),r=!1},d(g){g&&C(e),S(i),o&&o.d(),s&&s.d()}}}function en(t,e,n){let i;ce();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=zt(this.value),n(0,r)}const k=()=>n(5,u=!u);
1function I(){o=this.value,n(1,o)}return t.$$set=R=>{"brush_radius"in R&&n(0,r=R.brush_radius),"brush_color"in R&&n(1,o=R.brush_color),"container_height"in R&&n(7,s=R.container_height),"img_width"in R&&n(2,g=R.img_width),"img_height"in R&&n(8,_=R.img_height),"mode"in R&&n(3,m=R.mode)},t.$$.update=()=>{t.$$.dirty&388&&n(6,i=s*(g/_))},[r,o,g,m,l,u,i,s,_,a,f,k,I]}class Qe 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=N("img"),d(e,"class","w-full h-full object-contain"),W(e.src,n=t[0].image||t[0])||d(e,"src",n),d(e,"alt",""),U(e,"scale-x-[-1]",t[4]==="webcam"&&t[10])},m(i,l){y(i,e,l)},p(i,l){l[0]&1&&!W(e.src,n=i[0].image||i[0])&&d(e,"src",n),l[0]&1040&&U(e,"scale-x-[-1]",i[4]==="webcam"&&i[10])},i:F,o:F,d(i){i&&C(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=q(),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&&(Z(),v(r,1,1,()=>{r=null}),K())},i(o){l||(w(r),l=!0)},o(o){v(r),l=!1},d(o){u.d(o),o&&C(n),r&&r.d(o),o&&C(i)}}}function ln(t){let e,n,i,l,u;return e=new Ee({props:{editable:!0}}),e.$on("edit",t[48]),e.$on("clear",t[24]),{c(){j(e.$$.fragment),n=q(),i=N("img"),d(i,"class","w-full h-full object-contain"),W(i.src,l=t[0])||d(i,"src",l),d(i,"alt",""),U(i,"scale-x-[-1]",t[4]==="webcam"&&t[10])},m(r,o){A(e,r,o),y(r,n,o),y(r,i,o),u=!0},p(r,o){(!u||o[0]&1&&!W(i.src,l=r[0]))&&d(i,"src",l),o[0]&1040&&U(i,"scale-x-[-1]",r[4]==="webcam"&&r[10])},i(r){u||(w(e.$$.fragment,r),u=!0)},o(r){v(e.$$.fragment,r),u=!1},d(r){S(e,r),r&&C(n),r&&C(i)}}}function rn(t){let e,n,i,l;return e=new It({props:{image:t[0]}}),e.$on("crop",t[25]),i=new Ee({}),i.$on("clear",t[47]),{c(){j(e.$$.fragment),n=q(),j(i.$$.fragment)},m(u,r){A(e,u,r),y(u,n,r),A(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){v(e.$$.fragment,u),v(i.$$.fragment,u),l=!1},d(u){S(e,u),u&&C(n),S(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&&(Z(),v(i,1,1,()=>{i=null}),K())},i(l){n||(w(i),n=!0)},o(l){v(i),n=!1},d(l){i&&i.d(l),l&&C(e)}}}function un(t){let e,n,i,l,u,r,o;e=new Ke({}),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 Ze({props:m}),E.push(()=>Y(l,"brush_radius",g)),E.push(()=>Y(l,"brush_color",_)),t[44](l),l.$on("change",t[25]),{c(){j(e.$$.fragment),n=q(),s&&s.c(),i=q(),j(l.$$.fragment)},m(a,f){A(e,a,f),y(a,n,f),s&&s.m(a,f),y(a,i,f),A(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&&(Z(),v(s,1,1,()=>{s=null}),K());const k={};f[0]&1&&(k.value=a[0]),f[0]&4096&&(k.mode=a[12]),f[0]&1081344&&(k.width=a[15]||a[20]),f[0]&540672&&(k.height=a[14]||a[19]),f[0]&589824&&(k.container_height=a[16]||a[19]),!u&&f[0]&131072&&(u=!0,k.brush_radius=a[17],X(()=>u=!1)),!r&&f[0]&4194304&&(r=!0,k.brush_color=a[22],X(()=>r=!1)),l.$set(k)},i(a){o||(w(e.$$.fragment,a),w(s),w(l.$$.fragment,a),o=!0)},o(a){v(e.$$.fragment,a),v(s),v(l.$$.fragment,a),o=!1},d(a){S(e,a),a&&C(n),s&&s.d(a),a&&C(i),t[44](null),S(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 qt({props:u}),E.push(()=>Y(e,"dragging",l)),e.$on("load",t[23]),{c(){j(e.$$.fragment)},m(r,o){A(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],X(()=>n=!1)),e.$set(s)}
1,i(r){i||(w(e.$$.fragment,r),i=!0)},o(r){v(e.$$.fragment,r),i=!1},d(r){S(e,r)}}}function at(t){let e,n,i,l;return{c(){e=N("img"),d(e,"class","absolute w-full h-full object-contain"),W(e.src,n=t[21]||t[0]?.image||t[0])||d(e,"src",n),d(e,"alt",""),U(e,"scale-x-[-1]",t[4]==="webcam"&&t[10])},m(u,r){y(u,e,r),t[49](e),i||(l=O(e,"load",t[26]),i=!0)},p(u,r){r[0]&2097153&&!W(e.src,n=u[21]||u[0]?.image||u[0])&&d(e,"src",n),r[0]&1040&&U(e,"scale-x-[-1]",u[4]==="webcam"&&u[10])},d(u){u&&C(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 Ze({props:m}),t[50](e),E.push(()=>Y(e,"brush_radius",g)),E.push(()=>Y(e,"brush_color",_)),e.$on("change",t[25]),u=new Ke({}),u.$on("undo",t[53]),u.$on("clear",t[27]);let a=(t[1]==="color-sketch"||t[1]==="sketch")&&_t(t);return{c(){j(e.$$.fragment),l=q(),j(u.$$.fragment),r=q(),a&&a.c(),o=ue()},m(f,k){A(e,f,k),y(f,l,k),A(u,f,k),y(f,r,k),a&&a.m(f,k),y(f,o,k),s=!0},p(f,k){const I={};k[0]&1&&(I.value=f[0]),k[0]&4096&&(I.mode=f[12]),k[0]&1081344&&(I.width=f[15]||f[20]),k[0]&540672&&(I.height=f[14]||f[19]),k[0]&589824&&(I.container_height=f[16]||f[19]),k[0]&262144&&(I.value_img=f[18]),k[0]&16&&(I.source=f[4]),!n&&k[0]&131072&&(n=!0,I.brush_radius=f[17],X(()=>n=!1)),!i&&k[0]&4194304&&(i=!0,I.brush_color=f[22],X(()=>i=!1)),e.$set(I),f[1]==="color-sketch"||f[1]==="sketch"?a?(a.p(f,k),k[0]&2&&w(a,1)):(a=_t(f),a.c(),w(a,1),a.m(o.parentNode,o)):a&&(Z(),v(a,1,1,()=>{a=null}),K())},i(f){s||(w(e.$$.fragment,f),w(u.$$.fragment,f),w(a),s=!0)},o(f){v(e.$$.fragment,f),v(u.$$.fragment,f),v(a),s=!1},d(f){t[50](null),S(e,f),f&&C(l),S(u,f),f&&C(r),a&&a.d(f),f&&C(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 Qe({props:o}),E.push(()=>Y(e,"brush_radius",u)),E.push(()=>Y(e,"brush_color",r)),{c(){j(e.$$.fragment)},m(s,g){A(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],X(()=>n=!1)),!i&&g[0]&4194304&&(i=!0,_.brush_color=s[22],X(()=>i=!1)),e.$set(_)},i(s){l||(w(e.$$.fragment,s),l=!0)},o(s){v(e.$$.fragment,s),l=!1},d(s){S(e,s)}}}function ct(t){let e,n;return e=new Et({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(){j(e.$$.fragment)},m(i,l){A(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){v(e.$$.fragment,i),n=!1},d(i){S(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 Qe({props:o}),E.push(()=>Y(e,"brush_radius",u)),E.push(()=>Y(e,"brush_color",r)),{c(){j(e.$$.fragment)},m(s,g){A(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],X(()=>n=!1)),!i&&g[0]&4194304&&(i=!0,_.brush_color=s[22],X(()=>i=!1)),e.$set(_)},i(s){l||(w(e.$$.fragment,s),l=!0)},o(s){v(e.$$.fragment,s),l=!1},d(s){S(e,s)}}}function an(t){let e,n;return{c(){e=N("img"),d(e,"class","w-full h-full object-contain"),W(e.src,n=t[0].image||t[0])||d(e,"src",n),d(e,"alt",""),U(e,"scale-x-[-1]",t[4]==="webcam"&&t[10])},m(i,l){y(i,e,l)},p(i,l){l[0]&1&&!W(e.src,n=i[0].image||i[0])&&d(e,"src",n),l[0]&1040&&U(e,"scale-x-[-1]",i[4]==="webcam"&&i[10])},i:F,o:F,d(i){i&&C(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=q(),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&&(Z(),v(r,1,1,()=>{r=null}),K())},i(o){l||(w(r),l=!0)},o(o){v(r),l=!1},d(o){u.d(o),o&&C(n),r&&r.d(o),o&&C(i)}}}function _n(t){let e,n,i,l,u;return e=new Ee({props:{editable:!0}}),e.$on("edit",t[29]),e.$on("clear",t[24]),{c(){j(e.$$.fragment),n=q(),i=N("img"),d(i,"class","w-full h-full object-contain"),W(i.src,l=t[0])||d(i,"src",l),d(i,"alt",""),U(i,"scale-x-[-1]",t[4]==="webcam"&&t[10])},m(r,o){A(e,r,o),y(r,n,o),y(r,i,o),u=!0},p(r,o){(!u||o[0]&1&&!W(i.src,l=r[0]))&&d(i,"src",l),o[0]&1040&&U(i,"scale-x-[-1]",r[4]==="webcam"&&r[10])},i(r){u||(w(e.$$.fragment,r),u=!0)},o(r){v(e.$$.fragment,r),u=!1},d(r){S(e,r),r&&C(n),r&&C(i)}}}function cn(t){let e,n,i,l;return e=new It({props:{image:t[0]}}),e.$on("crop",t[25]),i=new Ee({}),i.$on("clear",t[28]),{c(){j(e.$$.fragment),n=q(),j(i.$$.fragment)},m(u,r){A(e,u,r),y(u,n,r),A(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){v(e.$$.fragment,u),v(i.$$.fragment,u),l=!1},d(u){S(e,u),u&&C(n),S(i,u)}}}function hn(t){let e,n,i,l,u,r,o,s,g;return{c(){e=N("div"),n=be(t[5]),i=q(),l=N("span"),u=be("- "),r=be(t[6]),o=be(" -"),s=q(),g=be(t[7]),d(l,"class","text-gray-300"),d(e,"class","flex flex-col")},m(_,m){y(_,e,m),D(e,n),D(e,i),D(e,l),D(l,u),D(l,r),D(l,o),D(e,s),D(e,g)},p(_,m){m[0]&32&&Je(n,_[5]),m[0]&64&&Je(r,_[6]),m[0]&128&&Je(g,_[7])},i:F,o:F,d(_){_&&C(e)}}}function mt(t){let e,n,i,l;return{c(){e=N("img"),d(e,"class","absolute w-full h-full object-contain"),W(e.src,n=t[21]||t[0]?.image||t[0])||d(e,"src",n),d(e,"alt",""),U(e,"scale-x-[-1]",t[4]==="webcam"&&t[10])},m(u,r){y(u,e,r),t[30](e),i||(l=O(e,"load",t[26]),i=!0)},p(u,r){r[0]&2097153&&!W(e.src,n=u[21]||u[0]?.image||u[0])&&d(e,"src",n),r[0]&1040&&U(e,"scale-x-[-1]",u[4]==="webcam"&&u[10])},d(u){u&&C(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 Ze({props:m}),t[31](e),E.push(()=>Y(e,"brush_radius",g)),E.push(()=>Y(e,"brush_color",_)),e.$on("change",t[25]),u=new Ke({}
1),u.$on("undo",t[34]),u.$on("clear",t[27]);let a=(t[1]==="color-sketch"||t[1]==="sketch")&&dt(t);return{c(){j(e.$$.fragment),l=q(),j(u.$$.fragment),r=q(),a&&a.c(),o=ue()},m(f,k){A(e,f,k),y(f,l,k),A(u,f,k),y(f,r,k),a&&a.m(f,k),y(f,o,k),s=!0},p(f,k){const I={};k[0]&1&&(I.value=f[0]),k[0]&4096&&(I.mode=f[12]),k[0]&1081344&&(I.width=f[15]||f[20]),k[0]&540672&&(I.height=f[14]||f[19]),k[0]&589824&&(I.container_height=f[16]||f[19]),k[0]&262144&&(I.value_img=f[18]),k[0]&16&&(I.source=f[4]),!n&&k[0]&131072&&(n=!0,I.brush_radius=f[17],X(()=>n=!1)),!i&&k[0]&4194304&&(i=!0,I.brush_color=f[22],X(()=>i=!1)),e.$set(I),f[1]==="color-sketch"||f[1]==="sketch"?a?(a.p(f,k),k[0]&2&&w(a,1)):(a=dt(f),a.c(),w(a,1),a.m(o.parentNode,o)):a&&(Z(),v(a,1,1,()=>{a=null}),K())},i(f){s||(w(e.$$.fragment,f),w(u.$$.fragment,f),w(a),s=!0)},o(f){v(e.$$.fragment,f),v(u.$$.fragment,f),v(a),s=!1},d(f){t[31](null),S(e,f),f&&C(l),S(u,f),f&&C(r),a&&a.d(f),f&&C(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 Qe({props:o}),E.push(()=>Y(e,"brush_radius",u)),E.push(()=>Y(e,"brush_color",r)),{c(){j(e.$$.fragment)},m(s,g){A(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],X(()=>n=!1)),!i&&g[0]&4194304&&(i=!0,_.brush_color=s[22],X(()=>i=!1)),e.$set(_)},i(s){l||(w(e.$$.fragment,s),l=!0)},o(s){v(e.$$.fragment,s),l=!1},d(s){S(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):(Z(),v(r[_],1,1,()=>{r[_]=null}),K(),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){v(n),l=!1},d(s){r[e].d(s),s&&C(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:Le,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(){j(e.$$.fragment),n=q(),i=N("div"),u.c(),d(i,"data-testid","image"),Ve(()=>t[56].call(i)),U(i,"bg-gray-200",t[0]),U(i,"h-60",t[4]!=="webcam"||t[1]==="sketch"||t[1]==="color-sketch")},m(m,a){A(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:Le),a[0]&20&&(f.label=m[2]||(m[4]==="canvas"?"Sketch":"Image")),e.$set(f);let k=l;l=_(m),l===k?g[l].p(m,a):(Z(),v(g[k],1,1,()=>{g[k]=null}),K(),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&&U(i,"bg-gray-200",m[0]),a[0]&18&&U(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){v(e.$$.fragment,m),v(u),o=!1},d(m){S(e,m),m&&C(n),m&&C(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:k}=e,I;l&&(o==="upload"||o==="webcam")&&s==="sketch"&&(l={image:l,mask:null});function R({detail:h}){s==="color-sketch"?n(21,re=h):n(0,l=(o==="upload"||o==="webcam")&&s==="sketch"?{image:h,mask:null}:h)}function ee({detail:h}){n(0,l=null),n(21,re=void 0),T("clear")}
1async function oe({detail:h},L){B==="mask"?o==="webcam"&&L?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 Be(),T(a?"stream":"edit")}const T=ce();let b=!1;function H(h){const L=h.composedPath()[0];n(15,ne=L.naturalWidth),n(14,te=L.naturalHeight),n(16,ie=L.getBoundingClientRect().height)}async function P(){I.clear(),await Be(),n(0,l=null),n(21,re=void 0)}let te=0,ne=0,ie=0,p=20,B,Q,ae,le,re;const Ne=h=>(ee(h),n(1,s="editor")),me=()=>n(1,s="select");function qe(h){E[h?"unshift":"push"](()=>{Q=h,n(18,Q)})}function ke(h){E[h?"unshift":"push"](()=>{I=h,n(13,I)})}function Fe(h){p=h,n(17,p)}function pe(h){i=h,n(22,i),n(12,B),n(4,o),n(1,s)}const we=()=>I.undo();function Ie(h){p=h,n(17,p)}function ve(h){i=h,n(22,i),n(12,B),n(4,o),n(1,s)}function fe(h){b=h,n(11,b)}const ye=()=>I.undo(),Ce=()=>I.clear();function ze(h){p=h,n(17,p)}function Me(h){i=h,n(22,i),n(12,B),n(4,o),n(1,s)}function Te(h){p=h,n(17,p)}function je(h){i=h,n(22,i),n(12,B),n(4,o),n(1,s)}function se(h){E[h?"unshift":"push"](()=>{I=h,n(13,I)})}const _e=h=>s==="color-sketch"?R(h):oe(h,!0);function Ae(h){he.call(this,t,h)}const ge=h=>(ee(h),n(1,s="editor")),Ue=()=>n(1,s="select");function Se(h){E[h?"unshift":"push"](()=>{Q=h,n(18,Q)})}function We(h){E[h?"unshift":"push"](()=>{I=h,n(13,I)})}function Oe(h){p=h,n(17,p)}function He(h){i=h,n(22,i),n(12,B),n(4,o),n(1,s)}const Pe=()=>I.undo();function c(h){p=h,n(17,p)}function z(h){i=h,n(22,i),n(12,B),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,k=h.mirror_webcam)},t.$$.update=()=>{t.$$.dirty[0]&1&&T("change",l),t.$$.dirty[0]&2048&&T("drag",b),t.$$.dirty[0]&18&&(o==="canvas"&&s==="sketch"?n(12,B="bw-sketch"):s==="color-sketch"?n(12,B="color-sketch"):(o==="upload"||o==="webcam")&&s==="sketch"?n(12,B="mask"):n(12,B="editor")),t.$$.dirty[0]&4096&&n(22,i=B=="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,k,b,B,I,te,ne,ie,p,Q,ae,le,re,i,R,ee,oe,H,P,Ne,me,qe,ke,Fe,pe,we,Ie,ve,fe,ye,Ce,ze,Me,Te,je,se,_e,Ae,ge,Ue,Se,We,Oe,He,Pe,c,z,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=N("img"),d(e,"class","w-full h-full object-contain"),W(e.src,n=t[0])||d(e,"src",n),d(e,"alt","")},m(i,l){y(i,e,l)},p(i,l){l&1&&!W(e.src,n=i[0])&&d(e,"src",n)},i:F,o:F,d(i){i&&C(e)}}}function pn(t){let e,n,i,l;return i=new Le({}),{c(){e=N("div"),n=N("div"),j(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),D(e,n),A(i,n,null),l=!0},p:F,i(u){l||(w(i.$$.fragment,u),l=!0)},o(u){v(i.$$.fragment,u),l=!1},d(u){u&&C(e),S(i)}}}function wn(t){let e,n,i,l,u,r;e=new wt({props:{show_label:t[2],Icon:Le,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(){j(e.$$.fragment),n=q(),l.c(),u=ue()},m(_,m){A(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):(Z(),v(s[f],1,1,()=>{s[f]=null}),K(),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(_){v(e.$$.fragment,_),v(l),r=!1},d(_){S(e,_),_&&C(n),s[i].d(_),_&&C(u)}}}function In(t,e,n){let{value:i}=e,{label:l=void 0}=e,{show_label:u}=e;const r=ce();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 vn extends ${constructor(e){super(),x(this,e,In,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(()=>Y(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("error",t[21]),{c(){j(e.$$.fragment)},m(r,o){A(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],X(()=>n=!1)),e.$set(s)},i(r){i||(w(e.$$.fragment,r),i=!0)},o(r){v(e.$$.fragment,r),i=!1},d(r){S(e,r)}}}function Cn(t){let e,n;return e=new vn({props:{value:t[0],label:t[6],show_label:t[7]}}),{c(){j(e.$$.fragment)},m(i,l){A(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){v(e.$$.fragment,i),n=!1},d(i){S(e,i)}}}function zn(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 At({props:s});const g=[Cn,yn],_=[];function m(a,f){return a[12]==="static"?0:1}return i=m(t),l=_[i]=g[i](t),{c(){j(e.$$.fragment),n=q(),l.c(),u=ue()},m(a,f){A(e,a,f),y(a,n,f),_[i].m(a,f),y(a,u,f),r=!0},p(a,f){const k=f&2?St(o,[Bt(a[1])]):{};e.$set(k);let I=i;i=m(a),i===I?_[i].p(a,f):(Z(),v(_[I],1,1,()=>{_[I]=null}),K(),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){v(e.$$.fragment,a),v(l),r=!1},d(a){S(e,a),a&&C(n),_[i].d(a),a&&C(u)}}}function Mn(t){let e,n;return e=new Ft({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:[zn]},$$scope:{ctx:t}}}),{c(){j(e.$$.fragment)},m(i,l){A(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&8420339&&(u.$$scope={dirty:l,ctx:i}),e.$set(u)},i(i){n||(w(e.$$.fragment,i),n=!0)},o(i){v(e.$$.fragment,i),n=!1},d(i){S(e,i)}}}function Tn(t,e,n){let i;Mt(t,Tt,p=>n(14,i=p));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:k}=e,{loading_status:I}=e,{mode:R}=e;const ee=ce();let oe;function T(p){r=p,n(0,r)}function b(p){he.call(this,t,p)}function H(p){he.call(this,t,p)}function P(p){he.call(this,t,p)}function te(p){he.call(this,t,p)}const ne=({detail:p})=>n(13,oe=p),ie=({detail:p})=>{n(1,I=I||{}),n(1,I.status="error",I),n(1,I.message=p,I)};return t.$$set=p=>{"elem_id"in p&&n(2,l=p.elem_id),"visible"in p&&n(3,u=p.visible),"value"in p&&n(0,r=p.value),"source"in p&&n(4,o=p.source),"tool"in p&&n(5,s=p.tool),"label"in p&&n(6,g=p.label),"show_label"in p&&n(7,_=p.show_label),"streaming"in p&&n(8,m=p.streaming),"pending"in p&&n(9,a=p.pending),"style"in p&&n(10,f=p.style),"mirror_webcam"in p&&n(11,k=p.mirror_webcam),"loading_status"in p&&n(1,I=p.loading_status),"mode"in p&&n(12,R=p.mode)},t.$$.update=()=>{t.$$.dirty&1&&n(0,r=r||null),t.$$.dirty&1&&ee("change")},[r,I,l,u,o,s,g,_,m,a,f,k,R,oe,i,T,b,H,P,te,ne,ie]}class jn extends ${constructor(e){super(),x(this,e,Tn,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 qn=jn;const Fn=["static","dynamic"];
1export{qn as Component,On as ExampleComponent,Fn as modes};

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.