1import { d as _, e as M, p as U } from "./form-BcDj1t5Y.js"; 2import { p as L, A as N, o as E, k as W, H as z, C as J, O as q, l as Q, x as R, n as w, P, N as O, T as V } from "./index-CDyB1Hog.js"; 3import { i as X } from "./use-tree-walker-DC0osvAV.js"; 4import { K as Y, k as C } from "./XMarkIcon-C7ztHuKP.js"; 5import { K as Z, E as x } from "./consts-7Qk9bpse.js"; 6import { a5 as B, k as j, L as ee, G as k, g as u, ag as m, p as ae, z as le, a6 as F, F as re, a4 as te } from "./app-yg_pP4S4.js"; 7function oe(a, v) { 8 return a === v; 9} 10let D = /* @__PURE__ */ Symbol("RadioGroupContext"); 11function I(a) { 12 let v = te(D, null); 13 if (v === null) { 14 let b = new Error(`<${a} /> is missing a parent <RadioGroup /> component.`); 15 throw Error.captureStackTrace && Error.captureStackTrace(b, I), b; 16 } 17 return v; 18} 19let fe = B({ name: "RadioGroup", emits: { "update:modelValue": (a) => true }, props: { as: { type: [Object, String], default: "div" }, disabled: { type: [Boolean], default: false }, by: { type: [String, Function], default: () => oe }, modelValue: { type: [Object, String, Number, Boolean], default: void 0 }, defaultValue: { type: [Object, String, Number, Boolean], default: void 0 }, form: { type: String, optional: true }, name: { type: String, optional: true }, id: { type: String, default: null } }, inheritAttrs: false, setup(a, { emit: v, attrs: b, slots: $, expose: h }) { 20 var g; 21 let i = (g = a.id) != null ? g : `headlessui-radiogroup-${L()}`, d = k(null), o = k([]), y = x({ name: "RadioGroupLabel" }), S = C({ name: "RadioGroupDescription" }); 22 h({ el: d, $el: d }); 23 let [p, A] = _(u(() => a.modelValue), (e) => v("update:modelValue", e), u(() => a.defaultValue)), s = { options: o, value: p, disabled: u(() => a.disabled), firstOption: u(() => o.value.find((e) => !e.propsRef.disabled)), containsCheckedOption: u(() => o.value.some((e) => s.compare(m(e.propsRef.value), m(a.modelValue)))), compare(e, r) { 24 if (typeof a.by == "string") { 25 let l = a.by; 26 return (e == null ? void 0 : e[l]) === (r == null ? void 0 : r[l]); 27 } 28 return a.by(e, r); 29 }, change(e) { 30 var r; 31 if (a.disabled || s.compare(m(p.value), m(e))) return false; 32 let l = (r = o.value.find((n) => s.compare(m(n.propsRef.value), m(e)))) == null ? void 0 : r.propsRef; 33 return l != null && l.disabled ? false : (A(e), true); 34 }, registerOption(e) { 35 o.value.push(e), o.value = q(o.value, (r) => r.element); 36 }, unregisterOption(e) { 37 let r = o.value.findIndex((l) => l.id === e); 38 r !== -1 && o.value.splice(r, 1); 39 } }; 40 ae(D, s), X({ container: u(() => E(d)), accept(e) { 41 return e.getAttribute("role") === "radio" ? NodeFilter.FILTER_REJECT : e.hasAttribute("role") ? NodeFilter.FILTER_SKIP : NodeFilter.FILTER_ACCEPT; 42 }, walk(e) { 43 e.setAttribute("role", "none"); 44 } }); 45 function f(e) { 46 if (!d.value || !d.value.contains(e.target)) return; 47 let r = o.value.filter((l) => l.propsRef.disabled === false).map((l) => l.element); 48 switch (e.key) { 49 case R.Enter: 50 U(e.currentTarget); 51 break; 52 case R.ArrowLeft: 53 case R.ArrowUp: 54 if (e.preventDefault(), e.stopPropagation(), P(r, O.Previous | O.WrapAround) === V.Success) { 55 let l = o.value.find((n) => { 56 var t; 57 return n.element === ((t = w(d)) == null ? void 0 : t.activeElement); 58 }); 59 l && s.change(l.propsRef.value); 60 } 61 break; 62 case R.ArrowRight: 63 case R.ArrowDown: 64 if (e.preventDefault(), e.stopPropagation(), P(r, O.Next | O.WrapAround) === V.Success) { 65 let l = o.value.find((n) => { 66 var t; 67 return n.element === ((t = w(n.element)) == null ? void 0 : t.activeElement); 68 }); 69 l && s.change(l.propsRef.value); 70 } 71 break; 72 case R.Space: 73 { 74 e.preventDefault(), e.stopPropagation(); 75 let l = o.value.find((n) => { 76 var t; 77 return n.element === ((t = w(n.element)) == null ? void 0 : t.activeElement); 78 }); 79 l && s.change(l.propsRef.value); 80 } 81 break; 82 } 83 } 84 let c = u(() => { 85 var e; 86 return (e = E(d)) == null ? void 0 : e.closest("form"); 87 }); 88 return j(() => {
89 le([c], () => { 90 if (!c.value || a.defaultValue === void 0) return; 91 function e() { 92 s.change(a.defaultValue); 93 } 94 return c.value.addEventListener("reset", e), () => { 95 var r; 96 (r = c.value) == null || r.removeEventListener("reset", e); 97 }; 98 }, { immediate: true }); 99 }), () => { 100 let { disabled: e, name: r, form: l, ...n } = a, t = { ref: d, id: i, role: "radiogroup", "aria-labelledby": y.value, "aria-describedby": S.value, onKeydown: f }; 101 return F(re, [...r != null && p.value != null ? M({ [r]: p.value }).map(([G, T]) => F(W, z({ features: Q.Hidden, key: G, as: "input", type: "hidden", hidden: true, readOnly: true, form: l, disabled: e, name: G, value: T }))) : [], N({ ourProps: t, theirProps: { ...b, ...J(n, ["modelValue", "defaultValue", "by"]) }, slot: {}, attrs: b, slots: $, name: "RadioGroup" })]); 102 }; 103} }); 104var ne = ((a) => (a[a.Empty = 1] = "Empty", a[a.Active = 2] = "Active", a))(ne || {}); 105let ce = B({ name: "RadioGroupOption", props: { as: { type: [Object, String], default: "div" }, value: { type: [Object, String, Number, Boolean] }, disabled: { type: Boolean, default: false }, id: { type: String, default: null } }, setup(a, { attrs: v, slots: b, expose: $ }) { 106 var h; 107 let g = (h = a.id) != null ? h : `headlessui-radiogroup-option-${L()}`, i = I("RadioGroupOption"), d = x({ name: "RadioGroupLabel" }), o = C({ name: "RadioGroupDescription" }), y = k(null), S = u(() => ({ value: a.value, disabled: a.disabled })), p = k(1); 108 $({ el: y, $el: y }); 109 let A = u(() => E(y)); 110 j(() => i.registerOption({ id: g, element: A, propsRef: S })), ee(() => i.unregisterOption(g)); 111 let s = u(() => { 112 var t; 113 return ((t = i.firstOption.value) == null ? void 0 : t.id) === g; 114 }), f = u(() => i.disabled.value || a.disabled), c = u(() => i.compare(m(i.value.value), m(a.value))), e = u(() => f.value ? -1 : c.value || !i.containsCheckedOption.value && s.value ? 0 : -1); 115 function r() { 116 var t; 117 i.change(a.value) && (p.value |= 2, (t = E(y)) == null || t.focus()); 118 } 119 function l() { 120 p.value |= 2; 121 } 122 function n() { 123 p.value &= -3; 124 } 125 return () => { 126 let { value: t, disabled: G, ...T } = a, K = { checked: c.value, disabled: f.value, active: !!(p.value & 2) }, H = { id: g, ref: y, role: "radio", "aria-checked": c.value ? "true" : "false", "aria-labelledby": d.value, "aria-describedby": o.value, "aria-disabled": f.value ? true : void 0, tabIndex: e.value, onClick: f.value ? void 0 : r, onFocus: f.value ? void 0 : l, onBlur: f.value ? void 0 : n }; 127 return N({ ourProps: H, theirProps: T, slot: K, attrs: v, slots: b, name: "RadioGroupOption" }); 128 }; 129} }), me = Z, be = Y; 130export { 131 be as E, 132 ce as O, 133 fe as h, 134 me as k 135};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.