import{S as E,i as T,s as z,e as k,k as G,d as H,a as h,t as S,b as d,f as g,l as A,g as O,h as m,o as w,q as v,u as C,v as y,w as B,m as F,z as I,B as J,H as K,E as L,D as M}from"./index.9fc31042.js";import{B as N}from"./Block.ddaaf792.js";import{B as P}from"./BlockTitle.1244283a.js";import{S as Q}from"./StatusTracker.14e5b2a2.js";function q(s,e,t){const l=s.slice();return l[9]=e[t],l[11]=t,l}function R(s){let e;return{c(){e=H(s[3])},m(t,l){d(t,e,l)},p(t,l){l&8&&O(e,t[3])},d(t){t&&m(e)}}}function D(s){let e,t,l,f,u,o=s[9]+"",n,a,i;function r(){return s[7](s[9])}return{c(){e=k("label"),t=k("input"),f=G(),u=k("span"),n=H(o),t.disabled=s[2],t.checked=l=s[0].includes(s[9]),h(t,"type","checkbox"),h(t,"name","test"),h(t,"class","rounded border-gray-300 text-blue-600 disabled:text-gray-400 disabled:cursor-not-allowed shadow-sm focus:border-blue-300 focus:ring focus:ring-offset-0 focus:ring-blue-200 focus:ring-opacity-50"),h(u,"class","ml-2"),h(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"),S(e,"!cursor-not-allowed",s[2])},m(b,c){d(b,e,c),g(e,t),g(e,f),g(e,u),g(u,n),a||(i=A(t,"change",r),a=!0)},p(b,c){s=b,c&4&&(t.disabled=s[2]),c&3&&l!==(l=s[0].includes(s[9]))&&(t.checked=l),c&2&&o!==(o=s[9]+"")&&O(n,o),c&4&&S(e,"!cursor-not-allowed",s[2])},d(b){b&&m(e),a=!1,i()}}}function U(s){let e,t,l,f;e=new P({props:{show_label:s[4],$$slots:{default:[R]},$$scope:{ctx:s}}});let u=s[1],o=[];for(let n=0;n<u.length;n+=1)o[n]=D(q(s,u,n));return{c(){w(e.$$.fragment),t=G(),l=k("div");for(let n=0;n<o.length;n+=1)o[n].c();h(l,"class","flex flex-wrap gap-2"),h(l,"data-testid","checkbox-group")},m(n,a){v(e,n,a),d(n,t,a),d(n,l,a);for(let i=0;i<o.length;i+=1)o[i].m(l,null);f=!0},p(n,[a]){const i={};if(a&16&&(i.show_label=n[4]),a&4104&&(i.$$scope={dirty:a,ctx:n}),e.$set(i),a&39){u=n[1];let r;for(r=0;r<u.length;r+=1){const b=q(n,u,r);o[r]?o[r].p(b,a):(o[r]=D(b),o[r].c(),o[r].m(l,null))}for(;r<o.length;r+=1)o[r].d(1);o.length=u.length}},i(n){f||(C(e.$$.fragment,n),f=!0)},o(n){y(e.$$.fragment,n),f=!1},d(n){B(e,n),n&&m(t),n&&m(l),F(o,n)}}}function V(s,e,t){let{value:l=[]}=e,{choices:f}=e,{disabled:u=!1}=e,{label:o}=e,{style:n=""}=e,{show_label:a}=e;const i=I(),r=c=>{l.includes(c)?l.splice(l.indexOf(c),1):l.push(c),i("change",l),t(0,l)},b=c=>r(c);return s.$$set=c=>{"value"in c&&t(0,l=c.value),"choices"in c&&t(1,f=c.choices),"disabled"in c&&t(2,u=c.disabled),"label"in c&&t(3,o=c.label),"style"in c&&t(6,n=c.style),"show_label"in c&&t(4,a=c.show_label)},[l,f,u,o,a,r,n,b]}class W extends E{constructor(e){super(),T(this,e,V,U,z,{value:0,choices:1,disabled:2,label:3,style:6,show_label:4})}}function X(s){let e,t,l,f,u;e=new Q({props:{tracked_status:s[7]}});function o(a){s[9](a)}let n={choices:s[1],style:s[3],label:s[4],show_label:s[6],disabled:s[2]==="static"};return s[0]!==void 0&&(n.value=s[0]),l=new W({props:n}),J.push(()=>K(l,"value",o)),l.$on("change",s[10]),{c(){w(e.$$.fragment),t=G(),w(l.$$.fragment)},m(a,i){v(e,a,i),d(a,t,i),v(l,a,i),u=!0},p(a,i){const r={};i&128&&(r.tracked_status=a[7]),e.$set(r);const b={};i&2&&(b.choices=a[1]),i&8&&(b.style=a[3]),i&16&&(b.label=a[4]),i&64&&(b.show_label=a[6]),i&4&&(b.disabled=a[2]==="static"),!f&&i&1&&(f=!0,b.value=a[0],L(()=>f=!1)),l.$set(b)},i(a){u||(C(e.$$.fragment,a),C(l.$$.fragment,a),u=!0)},o(a){y(e.$$.fragment,a),y(l.$$.fragment,a),u=!1},d(a){B(e,a),a&&m(t),B(l,a)}}}function Y(s){let e,t;return e=new N({props:{form_position:s[5],type:"fieldset",$$slots:{default:[X]},$$scope:{ctx:s}}}),{c(){w(e.$$.fragment)},m(l,f){v(e,l,f),t=!0},p(l,[f]){const u={};f&32&&(u.form_position=l[5]),f&2271&&(u.$$scope={dirty:f,ctx:l}),e.$set(u)},i(l){t||(C(e.$$.fragment,l),t=!0)},o(l){y(e.$$.fragment,l),t=!1},d(l){B(e,l)}}}function Z(s,e,t){let{value:l=[]}=e,{default_value:f=[]}=e,{choices:u}=e,{mode:o}=e,{style:n=""}=e,{label:a="Checkbox Group"}=e,{form_position:i="single"}=e,{show_label:r}=e,{loading_status:b}=e;f&&(l=f);function c(_){l=_,t(0,l)}function j(_){M.call(this,s,_)}return s.$$set=_=>{"value"in _&&t(0,l=_.value),"default_value"in _&&t(8,f=_.default_value),"choices"in _&&t(1,u=_.choices),"mode"in _&&t(2,o=_.mode),"style"in _&&t(3,n=_.style),"label"in _&&t(4,a=_.label),"form_position"in _&&t(5,i=_.form_position),"show_label"in _&&t(6,r=_.show_label),"loading_status"in _&&t(7,b=_.loading_status)},[l,u,o,n,a,i,r,b,f,c,j]}class x extends E{constructor(e){super(),T(this,e,Z,Y,z,{value:0,default_value:8,choices:1,mode:2,style:3,label:4,form_position:5,show_label:6,loading_status:7})}}var te=x;const se=["static","dynamic"];export{te as Component,se as modes};
