import{t as R,a as S,n as W,s as Q}from"./Bd4FQpE7.js";import{p as X,f as z,s as C,a as j,k as n,m as x,t as G,c as M,r as E,q as U,v as V}from"./Bj8SChEI.js";import{p as w,i as O,s as Y,c as q,b as Z}from"./ZhKyHBKW.js";import"./BBLiiV7J.js";import{u as $,c as e}from"./BAITReer.js";import{g as P,u as tt}from"./YrmfYsvT.js";import"./4LrpTdiC.js";import{S as et}from"./Cz2nfeI4.js";var ot=R("<!> <!>",1),at=R("<!> <!>",1);function dt(b,t){X(t,!0);const[c,m]=Y(),_=()=>q(f,"$taskMap",c),g=()=>q(d,"$customLabelColorsStore",c),s=w(t,"showLabel",3,!1),{taskMap:f}=$(),{customLabelColorsStore:d}=tt(),{x:r,y:h,width:u,height:i,annotation_label:{annotation_label_name:a},annotation_task_id:y}=t.annotation,l=x(()=>y&&_().has(y)?_().get(y).is_prediction:!1);let k=P(a,1);const v=x(()=>{var o;return((o=g()[a])==null?void 0:o.color)??P(a,1).color}),p=x(()=>{var o;return((o=g()[a])==null?void 0:o.color)??P(a,.4).color}),L=x(()=>{var o;return((o=g()[a])==null?void 0:o.alpha)*.4});var A=at(),F=z(A);{var H=o=>{it(o,{coordinates:[r,h],colorText:k,label:a,get isPrediction(){return n(l)}})};O(F,o=>{s()&&o(H)})}var I=C(F,2);{var J=o=>{var B=ot(),T=z(B);et(T,{get segmentation(){return t.annotation.segmentation__binary_mask__rle_row_wise},get width(){return t.imageWidth},get colorFill(){return n(p)},get opacity(){return n(L)}});var N=C(T,2);D(N,{bbox:[r,h,u,i],label:a,get colorStroke(){return n(v)},get colorFill(){return n(p)},get opacity(){return n(L)},get isPrediction(){return n(l)}}),S(o,B)},K=o=>{D(o,{bbox:[r,h,u,i],label:a,get colorStroke(){return n(v)},get colorFill(){return n(p)},get opacity(){return n(L)},get isPrediction(){return n(l)}})};O(I,o=>{t.annotation.segmentation__binary_mask__rle_row_wise?o(J):o(K,!1)})}S(b,A),j(),m()}var rt=W('<rect vector-effect="non-scaling-stroke" stroke-width="2" pointer-events="all"></rect>');function D(b,t){const c=w(t,"isPrediction",3,!1),[m,_,g,s]=t.bbox,f=c()?"5,5":"none",d=c()?.8:1;var r=rt();e(r,"x",m),e(r,"y",_),e(r,"width",g),e(r,"height",s),e(r,"stroke-opacity",d),e(r,"stroke-dasharray",f),G(()=>{e(r,"stroke",t.colorStroke),e(r,"fill",t.colorFill),e(r,"fill-opacity",t.opacity),e(r,"aria-label",t.label)}),S(b,r)}var nt=W('<g class="unscaled"><rect></rect><text class="annotation-label-text"> </text></g>');function it(b,t){X(t,!0);const c=w(t,"fontSize",3,14),m=w(t,"isPrediction",3,!1),[_,g]=t.coordinates;let s=U(null);const f=x(()=>{if(n(s))return n(s).getBBox()}),d=5,r=m()?.8:1,h=m()?"italic":"normal";var u=nt();e(u,"transform",`translate(${_}, ${g})`);var i=M(u);e(i,"opacity",r);var a=C(i);e(a,"x",d),e(a,"y",-5),e(a,"font-style",h);var y=M(a,!0);E(a),Z(a,l=>V(s,l),()=>n(s)),E(u),G(()=>{var l,k,v;e(i,"y",-((l=n(f))==null?void 0:l.height)),e(i,"width",((k=n(f))==null?void 0:k.width)+d*2),e(i,"height",(v=n(f))==null?void 0:v.height),e(i,"fill",t.colorText.color),e(a,"fill",t.colorText.contrastColor),e(a,"font-size",c()),Q(y,m()?`${t.label} (pred)`:t.label)}),S(b,u),j()}export{dt as S};
