import{B as ke}from"./Block-DZqtZLFP.js";import"./MarkdownCode.svelte_svelte_type_style_lang-3tofWDHK.js";import"./IconButtonWrapper.svelte_svelte_type_style_lang-BOpxTcdu.js";import{B as ve}from"./BlockLabel-DqHge3FF.js";import{E as pe}from"./Empty-CxRQfWXb.js";import{I as ne,F as Be}from"./FullscreenButton-CqFNG1Hv.js";import{I as Ie}from"./IconButtonWrapper-Cg16aIPK.js";import{S as Me}from"./index-B1gfMDT9.js";import"./StreamingBar.svelte_svelte_type_style_lang-CDNxkBIr.js";import"./index-C7PS0jJm.js";import{r as Y}from"./file-url-DgijyRSD.js";/* empty css */import"./prism-python-qapVsvY8.js";import"./IconButton-B-aAVSzy.js";import"./Minimize-OAHZO2Ge.js";import"./Clear-By3xiIwg.js";import"./svelte/svelte.js";import"./context-TgWPFwN2.js";const{SvelteComponent:Se,append:L,assign:qe,attr:k,binding_callbacks:ze,check_outros:ie,create_component:q,destroy_component:z,destroy_each:se,detach:B,element:j,empty:ae,ensure_array_like:A,flush:w,get_spread_object:Ee,get_spread_update:Fe,group_outros:oe,init:Ne,insert:I,listen:C,mount_component:E,run_all:Pe,safe_not_equal:je,set_data:Ce,set_style:Z,space:P,src_url_equal:D,text:Le,toggle_class:S,transition_in:v,transition_out:p}=window.__gradio__svelte__internal;function $(t,e,n){const l=t.slice();return l[32]=e[n],l[34]=n,l}function y(t,e,n){const l=t.slice();return l[32]=e[n],l[34]=n,l}function We(t){let e,n,l,i,s,a,c,b,g;n=new Ie({props:{$$slots:{default:[De]},$$scope:{ctx:t}}});let h=A(t[15]?t[15]?.annotations:[]),f=[];for(let u=0;u{l=null}),ie())},i(i){n||(v(l),n=!0)},o(i){p(l),n=!1},d(i){i&&B(e),l&&l.d(i)}}}function ee(t){let e,n,l,i;return{c(){e=j("img"),k(e,"alt",n="segmentation mask identifying "+t[4]+" within the uploaded file"),k(e,"class","mask fit-height svelte-303fln"),D(e.src,l=t[32].image.url)||k(e,"src",l),k(e,"style",i=t[9]&&t[32].label in t[9]?null:`filter: hue-rotate(${Math.round(t[34]*360/t[15]?.annotations.length)}deg);`),S(e,"fit-height",!t[18]),S(e,"active",t[16]==t[32].label),S(e,"inactive",t[16]!=t[32].label&&t[16]!=null)},m(s,a){I(s,e,a)},p(s,a){a[0]&16&&n!==(n="segmentation mask identifying "+s[4]+" within the uploaded file")&&k(e,"alt",n),a[0]&32768&&!D(e.src,l=s[32].image.url)&&k(e,"src",l),a[0]&33280&&i!==(i=s[9]&&s[32].label in s[9]?null:`filter: hue-rotate(${Math.round(s[34]*360/s[15]?.annotations.length)}deg);`)&&k(e,"style",i),a[0]&262144&&S(e,"fit-height",!s[18]),a[0]&98304&&S(e,"active",s[16]==s[32].label),a[0]&98304&&S(e,"inactive",s[16]!=s[32].label&&s[16]!=null)},d(s){s&&B(e)}}}function le(t){let e,n=A(t[15].annotations),l=[];for(let i=0;i{_[F]=null}),ie(),c=_[a],c?c.p(r,m):(c=_[a]=f[a](r),c.c()),v(c,1),c.m(s,null))},i(r){b||(v(e.$$.fragment,r),v(l.$$.fragment,r),v(c),b=!0)},o(r){p(e.$$.fragment,r),p(l.$$.fragment,r),p(c),b=!1},d(r){r&&(B(n),B(i),B(s)),z(e,r),z(l,r),_[a].d()}}}function Je(t){let e,n;return e=new ke({props:{visible:t[2],elem_id:t[0],elem_classes:t[1],padding:!1,height:t[7],width:t[8],allow_overflow:!1,container:t[10],scale:t[11],min_width:t[12],$$slots:{default:[He]},$$scope:{ctx:t}}}),{c(){q(e.$$.fragment)},m(l,i){E(e,l,i),n=!0},p(l,i){const s={};i[0]&4&&(s.visible=l[2]),i[0]&1&&(s.elem_id=l[0]),i[0]&2&&(s.elem_classes=l[1]),i[0]&128&&(s.height=l[7]),i[0]&256&&(s.width=l[8]),i[0]&1024&&(s.container=l[10]),i[0]&2048&&(s.scale=l[11]),i[0]&4096&&(s.min_width=l[12]),i[0]&516856|i[1]&32&&(s.$$scope={dirty:i,ctx:l}),e.$set(s)},i(l){n||(v(e.$$.fragment,l),n=!0)},o(l){p(e.$$.fragment,l),n=!1},d(l){z(e,l)}}}function Ke(t,e,n){let{elem_id:l=""}=e,{elem_classes:i=[]}=e,{visible:s=!0}=e,{value:a=null}=e,c=null,b=null,{gradio:g}=e,{label:h=g.i18n("annotated_image.annotated_image")}=e,{show_label:f=!0}=e,{show_legend:_=!0}=e,{height:u}=e,{width:r}=e,{color_map:m}=e,{container:d=!0}=e,{scale:M=null}=e,{min_width:F=void 0}=e,G=null,{loading_status:R}=e,{show_fullscreen_button:T=!0}=e,H,U=!1,J=null;function K(o){n(16,G=o)}function O(){n(16,G=null)}function V(o,W){g.dispatch("select",{value:h,index:o})}const re=o=>n(18,U=o.detail);function ue(o){ze[o?"unshift":"push"](()=>{H=o,n(17,H)})}const fe=o=>K(o.label),_e=o=>K(o.label),me=()=>O(),ce=()=>O(),he=(o,W)=>V(o,W.label);return t.$$set=o=>{"elem_id"in o&&n(0,l=o.elem_id),"elem_classes"in o&&n(1,i=o.elem_classes),"visible"in o&&n(2,s=o.visible),"value"in o&&n(22,a=o.value),"gradio"in o&&n(3,g=o.gradio),"label"in o&&n(4,h=o.label),"show_label"in o&&n(5,f=o.show_label),"show_legend"in o&&n(6,_=o.show_legend),"height"in o&&n(7,u=o.height),"width"in o&&n(8,r=o.width),"color_map"in o&&n(9,m=o.color_map),"container"in o&&n(10,d=o.container),"scale"in o&&n(11,M=o.scale),"min_width"in o&&n(12,F=o.min_width),"loading_status"in o&&n(13,R=o.loading_status),"show_fullscreen_button"in o&&n(14,T=o.show_fullscreen_button)},t.$$.update=()=>{if(t.$$.dirty[0]&29360136)if(a!==c&&(n(23,c=a),g.dispatch("change")),a){const o={image:a.image,annotations:a.annotations.map(N=>({image:N.image,label:N.label}))};n(15,b=o);const W=Y(o.image.url),ge=Promise.all(o.annotations.map(N=>Y(N.image.url))),Q=Promise.all([W,ge]);n(24,J=Q),Q.then(([N,be])=>{if(J!==Q)return;const de={image:{...o.image,url:N??void 0},annotations:o.annotations.map((X,we)=>({...X,image:{...X.image,url:be[we]??void 0}}))};n(15,b=de)})}else n(15,b=null)},[l,i,s,g,h,f,_,u,r,m,d,M,F,R,T,b,G,H,U,K,O,V,a,c,J,re,ue,fe,_e,me,ce,he]}class al extends Se{constructor(e){super(),Ne(this,e,Ke,Je,je,{elem_id:0,elem_classes:1,visible:2,value:22,gradio:3,label:4,show_label:5,show_legend:6,height:7,width:8,color_map:9,container:10,scale:11,min_width:12,loading_status:13,show_fullscreen_button:14},null,[-1,-1])}get elem_id(){return this.$$.ctx[0]}set elem_id(e){this.$$set({elem_id:e}),w()}get elem_classes(){return this.$$.ctx[1]}set elem_classes(e){this.$$set({elem_classes:e}),w()}get visible(){return this.$$.ctx[2]}set visible(e){this.$$set({visible:e}),w()}get value(){return this.$$.ctx[22]}set value(e){this.$$set({value:e}),w()}get gradio(){return this.$$.ctx[3]}set gradio(e){this.$$set({gradio:e}),w()}get label(){return this.$$.ctx[4]}set label(e){this.$$set({label:e}),w()}get show_label(){return this.$$.ctx[5]}set show_label(e){this.$$set({show_label:e}),w()}get show_legend(){return this.$$.ctx[6]}set show_legend(e){this.$$set({show_legend:e}),w()}get height(){return this.$$.ctx[7]}set height(e){this.$$set({height:e}),w()}get width(){return this.$$.ctx[8]}set width(e){this.$$set({width:e}),w()}get color_map(){return this.$$.ctx[9]}set color_map(e){this.$$set({color_map:e}),w()}get container(){return this.$$.ctx[10]}set container(e){this.$$set({container:e}),w()}get scale(){return this.$$.ctx[11]}set scale(e){this.$$set({scale:e}),w()}get min_width(){return this.$$.ctx[12]}set min_width(e){this.$$set({min_width:e}),w()}get loading_status(){return this.$$.ctx[13]}set loading_status(e){this.$$set({loading_status:e}),w()}get show_fullscreen_button(){return this.$$.ctx[14]}set show_fullscreen_button(e){this.$$set({show_fullscreen_button:e}),w()}}export{al as default}; //# sourceMappingURL=Index-Ck2XvAlX.js.map