import{e as g,V as h}from"./VisuallyHidden-0BfmsMPn.js";import{d as c,m as o,B,o as n,g as p,N as d,a as f,j as E,F as m,n as V}from"./app-bWy6VYs1.js";var k=c({inheritAttrs:!1,__name:"VisuallyHiddenInputBubble",props:{name:{type:String,required:!0},value:{type:null,required:!0},checked:{type:Boolean,required:!1,default:void 0},required:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},feature:{type:String,required:!1,default:"fully-hidden"}},setup(i){const e=i,{primitiveElement:s,currentElement:l}=g(),t=o(()=>e.checked??e.value);return B(t,(r,a)=>{if(!l.value)return;const u=l.value,_=window.HTMLInputElement.prototype,v=Object.getOwnPropertyDescriptor(_,"value").set;if(v&&r!==a){const b=new Event("input",{bubbles:!0}),q=new Event("change",{bubbles:!0});v.call(u,r),u.dispatchEvent(b),u.dispatchEvent(q)}}),(r,a)=>(n(),p(h,d({ref_key:"primitiveElement",ref:s},{...e,...r.$attrs},{as:"input"}),null,16))}}),y=k,A=c({inheritAttrs:!1,__name:"VisuallyHiddenInput",props:{name:{type:String,required:!0},value:{type:null,required:!0},checked:{type:Boolean,required:!1,default:void 0},required:{type:Boolean,required:!1},disabled:{type:Boolean,required:!1},feature:{type:String,required:!1,default:"fully-hidden"}},setup(i){const e=i,s=o(()=>typeof e.value=="object"&&Array.isArray(e.value)&&e.value.length===0&&e.required),l=o(()=>typeof e.value=="string"||typeof e.value=="number"||typeof e.value=="boolean"||e.value===null||e.value===void 0?[{name:e.name,value:e.value}]:typeof e.value=="object"&&Array.isArray(e.value)?e.value.flatMap((t,r)=>typeof t=="object"?Object.entries(t).map(([a,u])=>({name:`${e.name}[${r}][${a}]`,value:u})):{name:`${e.name}[${r}]`,value:t}):e.value!==null&&typeof e.value=="object"&&!Array.isArray(e.value)?Object.entries(e.value).map(([t,r])=>({name:`${e.name}[${t}]`,value:r})):[]);return(t,r)=>(n(),f(m,null,[E(" We render single input if it's required "),s.value?(n(),p(y,d({key:t.name},{...e,...t.$attrs},{name:t.name,value:t.value}),null,16,["name","value"])):(n(!0),f(m,{key:1},V(l.value,a=>(n(),p(y,d({key:a.name},{ref_for:!0},{...e,...t.$attrs},{name:a.name,value:a.value}),null,16,["name","value"]))),128))],2112))}}),j=A;export{j as V};
