import{S as E,i as T,s as p,f as k,m as S,h as A,b,t as j,c as m,d,l as F,j as D,e as g,q as w,u as v,v as C,w as B,x as G,o as I,A as K,K as L,C as M,I as O,L as z,M as H,F as J,E as N}from"./index.43a672aa.js";import{B as P}from"./BlockTitle.0dbc5573.js";import{B as Q}from"./Block.dd660513.js";import{S as R}from"./StatusTracker.a32689a5.js";function q(a,e,t){const l=a.slice();return l[9]=e[t],l[11]=t,l}function U(a){let e;return{c(){e=A(a[3])},m(t,l){m(t,e,l)},p(t,l){l&8&&D(e,t[3])},d(t){t&&g(e)}}}function y(a){let e,t,l,r,u,o=a[9]+"",n,_,h;function s(){return a[7](a[9])}return{c(){e=k("label"),t=k("input"),r=S(),u=k("span"),n=A(o),t.disabled=a[2],t.checked=l=a[0].includes(a[9]),b(t,"type","checkbox"),b(t,"name","test"),b(t,"class","gr-check-radio gr-checkbox"),b(u,"class","ml-2"),b(e,"class","flex items-center text-gray-700 text-sm space-x-2 border py-1.5 px-3 rounded-lg cursor-pointer bg-white shadow-sm checked:shadow-inner"),j(e,"!cursor-not-allowed",a[2])},m(f,i){m(f,e,i),d(e,t),d(e,r),d(e,u),d(u,n),_||(h=F(t,"change",s),_=!0)},p(f,i){a=f,i&4&&(t.disabled=a[2]),i&3&&l!==(l=a[0].includes(a[9]))&&(t.checked=l),i&2&&o!==(o=a[9]+"")&&D(n,o),i&4&&j(e,"!cursor-not-allowed",a[2])},d(f){f&&g(e),_=!1,h()}}}function V(a){let e,t,l,r;e=new P({props:{show_label:a[4],$$slots:{default:[U]},$$scope:{ctx:a}}});let u=a[1],o=[];for(let n=0;n<u.length;n+=1)o[n]=y(q(a,u,n));return{c(){w(e.$$.fragment),t=S(),l=k("div");for(let n=0;n<o.length;n+=1)o[n].c();b(l,"class","flex flex-wrap gap-2"),b(l,"data-testid","checkbox-group")},m(n,_){v(e,n,_),m(n,t,_),m(n,l,_);for(let h=0;h<o.length;h+=1)o[h].m(l,null);r=!0},p(n,[_]){const h={};if(_&16&&(h.show_label=n[4]),_&4104&&(h.$$scope={dirty:_,ctx:n}),e.$set(h),_&39){u=n[1];let s;for(s=0;s<u.length;s+=1){const f=q(n,u,s);o[s]?o[s].p(f,_):(o[s]=y(f),o[s].c(),o[s].m(l,null))}for(;s<o.length;s+=1)o[s].d(1);o.length=u.length}},i(n){r||(C(e.$$.fragment,n),r=!0)},o(n){B(e.$$.fragment,n),r=!1},d(n){G(e,n),n&&g(t),n&&g(l),I(o,n)}}}function W(a,e,t){let{value:l=[]}=e,{choices:r}=e,{disabled:u=!1}=e,{label:o}=e,{style:n=""}=e,{show_label:_}=e;const h=K(),s=i=>{l.includes(i)?l.splice(l.indexOf(i),1):l.push(i),h("change",l),t(0,l)},f=i=>s(i);return a.$$set=i=>{"value"in i&&t(0,l=i.value),"choices"in i&&t(1,r=i.choices),"disabled"in i&&t(2,u=i.disabled),"label"in i&&t(3,o=i.label),"style"in i&&t(6,n=i.style),"show_label"in i&&t(4,_=i.show_label)},[l,r,u,o,_,s,n,f]}class X extends E{constructor(e){super(),T(this,e,W,V,p,{value:0,choices:1,disabled:2,label:3,style:6,show_label:4})}}function Y(a){let e,t,l,r,u;const o=[a[7]];let n={};for(let s=0;s<o.length;s+=1)n=L(n,o[s]);e=new R({props:n});function _(s){a[8](s)}let h={choices:a[1],style:a[3],label:a[4],show_label:a[6],disabled:a[2]==="static"};return a[0]!==void 0&&(h.value=a[0]),l=new X({props:h}),M.push(()=>O(l,"value",_)),l.$on("change",a[9]),{c(){w(e.$$.fragment),t=S(),w(l.$$.fragment)},m(s,f){v(e,s,f),m(s,t,f),v(l,s,f),u=!0},p(s,f){const i=f&128?z(o,[H(s[7])]):{};e.$set(i);const c={};f&2&&(c.choices=s[1]),f&8&&(c.style=s[3]),f&16&&(c.label=s[4]),f&64&&(c.show_label=s[6]),f&4&&(c.disabled=s[2]==="static"),!r&&f&1&&(r=!0,c.value=s[0],J(()=>r=!1)),l.$set(c)},i(s){u||(C(e.$$.fragment,s),C(l.$$.fragment,s),u=!0)},o(s){B(e.$$.fragment,s),B(l.$$.fragment,s),u=!1},d(s){G(e,s),s&&g(t),G(l,s)}}}function Z(a){let e,t;return e=new Q({props:{form_position:a[5],type:"fieldset",$$slots:{default:[Y]},$$scope:{ctx:a}}}),{c(){w(e.$$.fragment)},m(l,r){v(e,l,r),t=!0},p(l,[r]){const u={};r&32&&(u.form_position=l[5]),r&1247&&(u.$$scope={dirty:r,ctx:l}),e.$set(u)},i(l){t||(C(e.$$.fragment,l),t=!0)},o(l){B(e.$$.fragment,l),t=!1},d(l){G(e,l)}}}function x(a,e,t){let{value:l=[]}=e,{choices:r}=e,{mode:u}=e,{style:o=""}=e,{label:n="Checkbox Group"}=e,{form_position:_="single"}=e,{show_label:h}=e,{loading_status:s}=e;function f(c){l=c,t(0,l)}function i(c){N.call(this,a,c)}return a.$$set=c=>{"value"in c&&t(0,l=c.value),"choices"in c&&t(1,r=c.choices),"mode"in c&&t(2,u=c.mode),"style"in c&&t(3,o=c.style),"label"in c&&t(4,n=c.label),"form_position"in c&&t(5,_=c.form_position),"show_label"in c&&t(6,h=c.show_label),"loading_status"in c&&t(7,s=c.loading_status)},[l,r,u,o,n,_,h,s,f,i]}class $ extends E{constructor(e){super(),T(this,e,x,Z,p,{value:0,choices:1,mode:2,style:3,label:4,form_position:5,show_label:6,loading_status:7})}}var ae=$;const ne=["static","dynamic"];export{ae as Component,ne as modes};
