import{p as M,i as p,b as F,f as R,k as N,a as _,F as O,u as Q,g as U,r as Z}from"./i18n-Dnhn5Rxr.js";import{R as X,a as h,T as Y,X as b,W as S,V as i,aj as $,Y as d,t as T,a0 as P,a6 as ee,S as q,w as t,a5 as I}from"./index-DWyDLubb.js";import{G as ae}from"./utils.svelte-CCyS_0CY.js";import"./ScrollFade.svelte_svelte_type_style_lang-DPHOQHBm.js";import{L as V}from"./LineChart-pr5WctpY.js";import{B as te}from"./Block-J4oodUWp.js";import{B as le}from"./BlockLabel-CZd21Hkw.js";import{E as re}from"./Empty-BIB2W5at.js";import{I as se}from"./IconButtonWrapper-D0s9l4wW.js";import{S as oe}from"./index-CglBvmLb.js";import"./StreamingBar.svelte_svelte_type_style_lang-Y9omZ2gK.js";import"./clone-BkeCM4Nl.js";import"./snippet-BWgYNF9D.js";import"./Clear-BF6j078A.js";import"./html-Ih_5QVTo.js";import"./index-B_pwUImq.js";var ne=S('<h2 data-testid="label-output-value"> </h2>'),ie=S('<button><div class="inner-wrap svelte-g2cwl3"><meter aria-valuemin="0" aria-valuemax="100" class="bar svelte-g2cwl3" min="0" max="1"></meter> <dl class="label svelte-g2cwl3"><dt class="text svelte-g2cwl3"> </dt> <div class="line svelte-g2cwl3"></div> <dd class="confidence svelte-g2cwl3"> </dd></dl></div></button>'),de=S('<div class="container svelte-g2cwl3"><!> <!></div>');function ce(j,l){X(l,!0);let E=M(l,"color",3,void 0),e=M(l,"selectable",3,!1),f=M(l,"show_heading",3,!0);function w(o){return o.replace(/\s/g,"-")}var x=de(),g=i(x);{var k=o=>{var n=ne();let c,u;var r=i(n,!0);d(n),T(()=>{c=F(n,1,"output-class svelte-g2cwl3",null,c,{"no-confidence":!("confidences"in l.value)}),u=R(n,"",u,{"background-color":E()||"transparent"}),P(r,l.value.label)}),h(o,n)};p(g,o=>{(f()||!l.value.confidences)&&o(k)})}var y=b(g,2);{var G=o=>{var n=ee(),c=q(n);N(c,17,()=>l.value.confidences,Q,(u,r,a)=>{var s=ie();let m;s.__click=()=>{l.onselect?.({index:a,value:t(r).label})};var B=i(s),v=i(B),W=b(v,2),L=i(W),z=i(L,!0);d(L);var C=b(L,4),A=i(C);d(C),d(W),d(B),d(s),T((D,H,J,K)=>{m=F(s,1,"confidence-set group svelte-g2cwl3",null,m,{selectable:e()}),_(s,"data-testid",`${t(r).label}-confidence-set`),_(v,"aria-labelledby",D),_(v,"aria-label",t(r).label),_(v,"aria-valuenow",H),O(v,t(r).confidence),R(v,`width: ${t(r).confidence*100}%; background: var(--stat-background-fill);
						`),_(L,"id",J),P(z,t(r).label),P(A,`${K??""}%`)},[()=>w(`meter-text-${t(r).label}`),()=>Math.round(t(r).confidence*100),()=>w(`meter-text-${t(r).label}`),()=>Math.round(t(r).confidence*100)]),h(u,s)}),h(o,n)};p(y,o=>{typeof l.value=="object"&&l.value.confidences&&o(G)})}d(x),h(j,x),Y()}$(["click"]);var ue=S("<!> <!> <!> <!>",1);function je(j,l){X(l,!0);const E=Z(l,["$$slots","$$events","$$legacy"]),e=new ae(E);let f=I(()=>e.props.value.label);e.watch_for_change(),te(j,{test_id:"label",get visible(){return e.shared.visible},get elem_id(){return e.shared.elem_id},get elem_classes(){return e.shared.elem_classes},get container(){return e.shared.container},get scale(){return e.shared.scale},get min_width(){return e.shared.min_width},padding:!1,children:(w,x)=>{var g=ue(),k=q(g);oe(k,U({get autoscroll(){return e.shared.autoscroll},get i18n(){return e.i18n}},()=>e.shared.loading_status,{on_clear_status:()=>e.dispatch("clear_status",e.shared.loading_status)}));var y=b(k,2);{var G=a=>{se(a,{get buttons(){return e.props.buttons},on_custom_button_click:s=>{e.dispatch("custom_button_click",{id:s})}})};p(y,a=>{e.shared.show_label&&e.props.buttons&&e.props.buttons.length>0&&a(G)})}var o=b(y,2);{var n=a=>{{let s=I(()=>e.shared.label||e.i18n("label.label")),m=I(()=>e.shared.container===!1),B=I(()=>e.props.show_heading===!0);le(a,{get Icon(){return V},get label(){return t(s)},get disable(){return t(m)},get float(){return t(B)}})}};p(o,a=>{e.shared.show_label&&a(n)})}var c=b(o,2);{var u=a=>{ce(a,{onselect:s=>e.dispatch("select",s),get selectable(){return e.props._selectable},get value(){return e.props.value},get color(){return e.props.color},get show_heading(){return e.props.show_heading}})},r=a=>{re(a,{unpadded_box:!0,children:(s,m)=>{V(s)},$$slots:{default:!0}})};p(c,a=>{t(f)!==void 0&&t(f)!==null?a(u):a(r,!1)})}h(w,g)},$$slots:{default:!0}}),Y()}export{ce as BaseLabel,je as default};
