import{a as L,t as P}from"./legacy.BFrtrUTY.js";import{p as A,b as d,u as S,a as k,g as t,d as g,e as B}from"./index.Chpxrmiw.js";import{b as E}from"./index-client.D0CpKjVb.js";import{g as R,r as U,a as s}from"./index.svelte_svelte_type_style_lang.oHDPoyLK.js";import{P as K}from"./SelectableBox.DAf3j8HI.js";var M=P('<canvas class="image transition-all hover:scale-105"></canvas>');function D(h,r){A(r,!0);const f=window.Image;let o=g(null),l=B(()=>r.sample.annotations);const e=new f;e.src=K+r.sample.file_path_abs;let c=g(!1);const p=2,_=2,x=()=>{if(t(o)){const a=t(o).getContext("2d"),b=R(t(l)),u=Array.from(b.keys());if(!a)return;a.clearRect(0,0,t(o).width,t(o).height),a.beginPath(),t(o).width=e.width*2,t(o).height=e.height*2,a.scale(p,_),a.drawImage(e,0,0),t(l).forEach(v=>{const{x:w,y:I,width:C,height:y,annotation_label:i}=v;if(i&&a){const n=u.indexOf(i.annotation_label_name);U({ctx:a,coords:{x:w,y:I,width:C,height:y},colors:{stroke:s(n,1).color,fill:s(n,.3).color,text:s(n,1).contrastColor,textBackground:s(n,.8).color},labelText:i.annotation_label_name})}}),a.closePath()}};e.onload=()=>{d(c,!0)},S(()=>{t(c)&&x()});var m=M();E(m,a=>d(o,a),()=>t(o)),L(h,m),k()}export{D as S};
