@opengis/form 0.0.19 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- (function(I,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@opengis/core")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core"],t):(I=typeof globalThis<"u"?globalThis:I||self,t(I.FormBuilder={},I.Vue,I.OpenGISCore))})(this,function(I,t,X){"use strict";const wt={class:"w-full relative"},Et={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},Vt={key:0,class:"text-red-500 text-[14px]"},Ct={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Bt=t.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""}},setup(a){return(e,s)=>(t.openBlock(),t.createElementBlock("div",wt,[e.ua||e.label?(t.openBlock(),t.createElementBlock("div",Et,[t.createElementVNode("span",null,t.toDisplayString(e.ua||e.label),1),e.item?.rules?.includes("required")?(t.openBlock(),t.createElementBlock("span",Vt,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"default",t.normalizeProps(t.guardReactiveProps(e.$attrs))),e.error?(t.openBlock(),t.createElementBlock("span",Ct,t.toDisplayString(e.error),1)):t.createCommentVNode("",!0)]))}}),vt={class:"w-full relative flex flex-row items-center gap-2"},St={key:0,class:"text-sm text-gray-900 font-medium flex shrink-0 w-3/12 max-w-[250px]"},Nt={key:0,class:"text-red-500 text-[14px]"},Ft={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Mt=t.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""}},setup(a){return(e,s)=>(t.openBlock(),t.createElementBlock("div",vt,[e.item?.type!=="html"?(t.openBlock(),t.createElementBlock("span",St,[t.createTextVNode(t.toDisplayString(e.ua||e.label)+" ",1),e.item?.rules?.includes("required")&&(e.ua||e.label)?(t.openBlock(),t.createElementBlock("span",Nt,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"default",t.normalizeProps(t.guardReactiveProps(e.$attrs))),e.error?(t.openBlock(),t.createElementBlock("span",Ft,t.toDisplayString(e.error),1)):t.createCommentVNode("",!0)]))}}),At={class:"w-full relative"},$t={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Dt={default:Bt,horizontal:Mt,inline:t.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""}},setup(a){return(e,s)=>(t.openBlock(),t.createElementBlock("div",At,[t.renderSlot(e.$slots,"default",t.normalizeProps(t.guardReactiveProps(e.$attrs))),e.error?(t.openBlock(),t.createElementBlock("span",$t,t.toDisplayString(e.error),1)):t.createCommentVNode("",!0)]))}})};function Q(a){return{inputClass:t.computed(()=>{const s=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${a?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return a?.size==="sm"?`${s}h-[32px]`:`${s}h-[38px]`})}}const It=["placeholder","disabled"],ve=t.defineComponent({__name:"vs-input-text",props:t.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,{inputClass:s}=Q(e.style),n=t.useModel(a,"modelValue");return(r,l)=>t.withDirectives((t.openBlock(),t.createElementBlock("input",{type:"text","onUpdate:modelValue":l[0]||(l[0]=o=>n.value=o),placeholder:r.placeholder,disabled:r.disabled,class:t.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f]",[t.unref(s),{"!border-red-600":r.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,It)),[[t.vModelText,n.value]])}}),Lt=["placeholder"],Te=t.defineComponent({__name:"vs-input-number",props:t.mergeModels({style:{default:()=>({})},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,{inputClass:s}=Q(e.style),n=t.useModel(a,"modelValue");return(r,l)=>t.withDirectives((t.openBlock(),t.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":l[0]||(l[0]=o=>n.value=o),placeholder:r.placeholder,class:t.normalizeClass(["py-1.5 px-3 block w-full",[t.unref(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,Lt)),[[t.vModelText,n.value]])}}),$=(a,e)=>{const s=a.__vccOpts||a;for(const[n,r]of e)s[n]=r;return s},Tt={},Rt={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function Ot(a,e){return t.openBlock(),t.createElementBlock("svg",Rt,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const zt=$(Tt,[["render",Ot]]),jt={class:"flex items-center gap-[4px]"},Ut=["value","id","disabled"],Pt=["for"],Ht={class:"text-[14px] text-gray-700 flex items-center gap-x-1 ml-1 dark:text-neutral-400"},qt=t.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(a,{emit:e}){const s=e,n=a,r=t.computed({get:()=>n.modelValue,set:l=>s("update:modelValue",l)});return(l,o)=>(t.openBlock(),t.createElementBlock("div",jt,[t.withDirectives(t.createElementVNode("input",{type:"checkbox",value:l.value,"onUpdate:modelValue":o[0]||(o[0]=i=>r.value=i),class:t.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":l.disabled}]),id:l.id,disabled:l.disabled},null,10,Ut),[[t.vModelCheckbox,r.value]]),t.createElementVNode("label",{for:l.id,class:t.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":l.disabled}])},[t.createElementVNode("div",{class:t.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[r.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",l.error?"border-red-600":""]])},[t.createVNode(zt,{height:"12",width:"12"})],2),t.createElementVNode("span",Ht,[t.renderSlot(l.$slots,"default",{},()=>[t.createTextVNode(t.toDisplayString(l.label),1)])])],10,Pt)]))}}),Gt=["name","value","disabled"],Kt={class:"flex items-center gap-[6px] text-[14px]"},Zt={key:0,class:"text-[16px]"},Yt=["src"],Jt=t.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(a,{emit:e}){const s=a,n=e,r=t.computed({get:()=>s.modelValue,set:i=>{n("update:modelValue",i)}}),l=t.computed(()=>Array.isArray(r.value)?r.value.includes(s.value):r.value===!0||r.value===s.value),o=t.computed(()=>s.style?.size==="xs"?"p-1.5 text-xs":s.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(i,u)=>(t.openBlock(),t.createElementBlock("label",{class:t.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[o.value,l.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[t.withDirectives(t.createElementVNode("input",{type:"checkbox",class:"hidden",name:i.id,value:i.value,"onUpdate:modelValue":u[0]||(u[0]=c=>r.value=c),disabled:i.disabled},null,8,Gt),[[t.vModelCheckbox,r.value]]),t.createElementVNode("span",Kt,[i.icon||i.imgUrl?(t.openBlock(),t.createElementBlock("span",Zt,[i.icon?(t.openBlock(),t.createElementBlock("i",{key:0,class:t.normalizeClass(i.icon)},null,2)):t.createCommentVNode("",!0),i.imgUrl?(t.openBlock(),t.createElementBlock("img",{key:1,src:i.imgUrl,width:"16",height:"16",alt:"icon"},null,8,Yt)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.renderSlot(i.$slots,"default",{},()=>[t.createTextVNode(t.toDisplayString(i.label),1)])])],2))}}),Wt={class:"flex items-center"},Re=t.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(a,{emit:e}){const s=a,n=e,r=`radio-${Math.floor(Math.random()*1e4)}`,l=t.computed({get:()=>Array.isArray(s.modelValue)?Array.isArray(s.modelValue)&&s.modelValue.includes(s.value):s.modelValue,set:i=>{if(Array.isArray(s.modelValue)){let u=[...s.modelValue];i?u.includes(s.value)||u.push(s.value):u=u.filter(c=>c!==s.value),n("update:modelValue",u)}else n("update:modelValue",i)}}),o=t.ref(`vs-checkbox-${s.view||"default"}`);return(i,u)=>(t.openBlock(),t.createElementBlock("div",Wt,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.value==="vs-checkbox-buttons"?t.unref(Jt):t.unref(qt)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:l.value,"onUpdate:modelValue":u[0]||(u[0]=c=>l.value=c),id:r,icon:i.icon,imgUrl:i.imgUrl,style:t.normalizeStyle(i.style),error:i.error},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),Xt={},Qt={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function es(a,e){return t.openBlock(),t.createElementBlock("svg",Qt,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const ts=$(Xt,[["render",es]]),ss={},ns={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function rs(a,e){return t.openBlock(),t.createElementBlock("svg",ns,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M12 9h.01"},null,-1),t.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),t.createElementVNode("path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z"},null,-1)]))}const ls=$(ss,[["render",rs]]),as={key:0,class:"flex items-start gap-x-1"},os={key:0,class:"text-red-500 text-[14px]"},is=["title"],us=["disabled"],Se=t.defineComponent({__name:"vs-input-switcher",props:t.mergeModels({rules:{default:()=>[]},view:{default:"checkbox"},label:{default:""},i:{default:""},text:{default:""},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,s=t.useModel(a,"modelValue");return(n,r)=>e.view==="checkbox"?(t.openBlock(),t.createElementBlock("div",as,[t.createVNode(Re,{modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=l=>s.value=l),label:n.text,error:n.error||""},null,8,["modelValue","label","error"]),n.rules?.includes("required")?(t.openBlock(),t.createElementBlock("span",os,"*")):t.createCommentVNode("",!0),n.i?(t.openBlock(),t.createElementBlock("button",{key:1,class:"cursor-pointer",title:n.i,onClick:r[1]||(r[1]=t.withModifiers(()=>{},["prevent"]))},[t.createVNode(t.unref(ls),{class:"text-gray-500 w-[14px] h-[14px]"})],8,is)):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[s.value?`bg-${n.style?.primaryColor||"blue"}-500`:"bg-stone-200",n.customClass]]),disabled:n.disabled,onClick:r[2]||(r[2]=l=>s.value=!s.value)},[t.createElementVNode("span",{"data-state":"checked",class:t.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[s.value?"translate-x-4":"translate-x-0"]])},null,2)],10,us))}}),ds=["innerHTML"],Ne=t.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(a){return(e,s)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(e.customClass),innerHTML:e.html?e.html:e.text},null,10,ds))}}),cs=["placeholder","disabled","name"],Oe=t.defineComponent({__name:"vs-input-mask",props:t.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,{inputClass:s}=Q(e.style),n=t.useModel(a,"modelValue"),r=t.ref(null);let l=null;return t.onMounted(async()=>{if(r.value){const{default:o}=await Promise.resolve().then(()=>no);l=o(r.value,{mask:e.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1,placeholderChar:e.placeholder}),l.on("accept",()=>{n.value=e.unmask?l.unmaskedValue:l.value}),l.on("complete",()=>{n.value=e.unmask?l.unmaskedValue:l.value}),l.value=n.value??""}}),t.onBeforeUnmount(()=>{l?.destroy()}),t.watch(()=>e.mask,o=>{l&&l.updateOptions({mask:o,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),t.watch(n,o=>{l&&l.unmaskedValue!==o&&(l.value=o||"")}),(o,i)=>(t.openBlock(),t.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:r,placeholder:o.placeholder,disabled:o.disabled,name:o.name,class:t.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f]",[t.unref(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,cs))}}),ps={class:"relative w-full bg-white rounded-lg"},hs=["placeholder","disabled"],ze=t.defineComponent({__name:"vs-input-email",props:t.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,{inputClass:s}=Q(e.style),n=t.useModel(a,"modelValue");return(r,l)=>(t.openBlock(),t.createElementBlock("div",ps,[l[1]||(l[1]=t.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),t.withDirectives(t.createElementVNode("input",{type:"email","onUpdate:modelValue":l[0]||(l[0]=o=>n.value=o),placeholder:r.placeholder,disabled:r.disabled,class:t.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f]",[t.unref(s),{"!border-red-600":r.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,hs),[[t.vModelText,n.value]])]))}}),ms=["value","disabled"],fs={class:"text-[13px] text-gray-700"},gs=t.defineComponent({__name:"vs-input-radio-default",props:t.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=t.useModel(a,"modelValue");return(s,n)=>(t.openBlock(),t.createElementBlock("label",{class:t.normalizeClass(["flex items-center gap-0",[s.customClass]])},[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":n[0]||(n[0]=r=>e.value=r),type:"radio",value:s.value,disabled:s.disabled,class:"hidden"},null,8,ms),[[t.vModelRadio,e.value]]),t.createElementVNode("span",{class:t.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${s.style?.primaryColor||"blue"}-500`,s.disabled?"opacity-50 cursor-not-allowed":""]])},[e.value==s.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${s.style?.primaryColor||"blue"}-500`]])},null,2)):t.createCommentVNode("",!0)],2),t.createElementVNode("span",fs,t.toDisplayString(s.text),1)],2))}}),ks=["value","disabled"],bs={class:"text-[13px] text-gray-700"},ys={"vs-input-radio-default":gs,"vs-input-radio-buttons":t.defineComponent({__name:"vs-input-radio-buttons",props:t.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=t.useModel(a,"modelValue");return(s,n)=>(t.openBlock(),t.createElementBlock("label",{class:t.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[e.value==s.value?`ring-2 ring-ring ring-${s.style?.primaryColor||"blue"}-500`:"",s.customClass]])},[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":n[0]||(n[0]=r=>e.value=r),type:"radio",value:s.value,disabled:s.disabled,class:"hidden"},null,8,ks),[[t.vModelRadio,e.value]]),t.createElementVNode("span",bs,t.toDisplayString(s.text),1)],2))}})},Fe=t.defineComponent({__name:"vs-input-radio",props:t.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,s=t.useModel(a,"modelValue"),n=t.computed(()=>ys[`vs-input-radio-${e.view}`]);return(r,l)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass([r.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.options,o=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(n.value),t.mergeProps({key:o?.id,text:o.text,value:o.id.toString(),checked:s.value===o.id,modelValue:s.value,"onUpdate:modelValue":l[0]||(l[0]=i=>s.value=i)},{ref_for:!0},r.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),je=$(t.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(a,{emit:e}){const s=a,n=e,r=t.ref([]),l=t.reactive({}),o=d=>d?.value||d?.id||d?.text||d,i=d=>d.text||String(d),u=d=>`lg:col-span-${d||12}`,c=async()=>{try{const d=await fetch(`/api/suggest/${s.data}`).then(h=>h.json());r.value=d?.data||d}catch(d){console.error(d)}};return t.watch(()=>s.modelValue,d=>{if(typeof d=="boolean"&&r.value.length===1){const h=o(r.value[0]);l[h]=d}else if(Array.isArray(d)){const h=new Set(d);r.value.forEach(p=>{if(!p.disabled){const _=o(p);l[_]=h.has(_)}})}},{immediate:!0}),t.watch(l,()=>{if(!r.value.length){n("update:modelValue",null);return}const d=Object.entries(l).filter(([,h])=>h).map(([h])=>h);n("update:modelValue",d.length===0?null:d)},{deep:!0}),t.onMounted(()=>{if(s.data)c().then(()=>{if(typeof s.modelValue=="boolean"&&r.value.length===1){const d=o(r.value[0]);l[d]=s.modelValue}else if(Array.isArray(s.modelValue)){const d=new Set(s.modelValue);r.value.forEach(h=>{if(!h.disabled){const p=o(h);l[p]=d.has(p)}})}});else if(r.value=s.options,typeof s.modelValue=="boolean"&&r.value.length===1){const d=o(r.value[0]);l[d]=s.modelValue}else if(Array.isArray(s.modelValue)){const d=new Set(s.modelValue);r.value.forEach(h=>{if(!h.disabled){const p=o(h);l[p]=d.has(p)}})}}),(d,h)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["p-0 w-full gap-[6px]",[d.position==="vertical"?"flex-col":"",d.colSpan?"grid":"flex justify-start"]])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,p=>(t.openBlock(),t.createBlock(Re,{modelValue:l[o(p)],"onUpdate:modelValue":_=>l[o(p)]=_,value:o(p),class:t.normalizeClass(u(d.colSpan)),disabled:p.disabled,label:i(p),key:o(p),icon:p?.icon,imgUrl:p?.imgUrl,option:p,view:d.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-54f9e19c"]]),xs=["placeholder","disabled"],Ue=t.defineComponent({__name:"vs-input-date1",props:t.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,{inputClass:s}=Q(e.style),n=t.useModel(a,"modelValue");return(r,l)=>t.withDirectives((t.openBlock(),t.createElementBlock("input",{type:"date","onUpdate:modelValue":l[0]||(l[0]=o=>n.value=o),placeholder:r.placeholder,disabled:r.disabled,class:t.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f]",[t.unref(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,xs)),[[t.vModelText,n.value]])}}),_s=async(a,e,s,n)=>{try{const r=new FormData;return r.append("unique","true"),r.append("file",a),(await fetch(`/file/upload/uploads?id=${e||""}&form=${s||""}&table=${n||""}`,{method:"POST",body:r}).then(o=>o.json()))?.result}catch(r){return X.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",r),null}},ws=async a=>{try{return await fetch(`file/delete${a}`),!0}catch(e){return console.error(e),!1}},Pe=async a=>{try{const e=await fetch(`file/download/files/uploads${a}`),s=await e.arrayBuffer(),n=e.headers["content-type"],r=new TextDecoder("utf-8").decode(s),l=new Blob([r],{type:n}),o=document.createElement("a");o.setAttribute("download",a),o.href=window.URL.createObjectURL(l),o.click()}catch(e){console.error(e.message)}},Es={},Vs={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Cs(a,e){return t.openBlock(),t.createElementBlock("svg",Vs,e[0]||(e[0]=[t.createElementVNode("path",{d:"M5 12h14"},null,-1),t.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const ye=$(Es,[["render",Cs]]),Bs={},vs={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-text",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function Ss(a,e,s,n,r,l){return t.openBlock(),t.createElementBlock("svg",vs,e[0]||(e[0]=[t.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><line x1="9" y1="9" x2="10" y2="9"></line><line x1="9" y1="13" x2="15" y2="13"></line><line x1="9" y1="17" x2="15" y2="17"></line>',6)]))}const Ns=$(Bs,[["render",Ss]]),Fs={},Ms={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-table",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function As(a,e,s,n,r,l){return t.openBlock(),t.createElementBlock("svg",Ms,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),t.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),t.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const $s=$(Fs,[["render",As]]),Ds={},Is={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file-unknown"};function Ls(a,e,s,n,r,l){return t.openBlock(),t.createElementBlock("svg",Is,e[0]||(e[0]=[t.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M12 17v.01"></path><path d="M12 14a1.5 1.5 0 1 0 -1.14 -2.474"></path>',5)]))}const Ts=$(Ds,[["render",Ls]]),Rs={},Os={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-zip",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function zs(a,e,s,n,r,l){return t.openBlock(),t.createElementBlock("svg",Os,e[0]||(e[0]=[t.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1"></path><path d="M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2z"></path><line x1="11" y1="5" x2="10" y2="5"></line><line x1="13" y1="7" x2="12" y2="7"></line><line x1="11" y1="9" x2="10" y2="9"></line><line x1="13" y1="11" x2="12" y2="11"></line><line x1="11" y1="13" x2="10" y2="13"></line><line x1="13" y1="15" x2="12" y2="15"></line>',9)]))}const js=$(Rs,[["render",zs]]),Us={},Ps={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-code",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function Hs(a,e,s,n,r,l){return t.openBlock(),t.createElementBlock("svg",Ps,e[0]||(e[0]=[t.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M10 13l-1 2l1 2"></path><path d="M14 13l1 2l-1 2"></path>',5)]))}const qs=$(Us,[["render",Hs]]),Gs=a=>{if(!a)return"";const e=a?.split(".");return e[e.length-1]},Ks=a=>{const e=Gs(a),s={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return s.imageFormat.includes(e)?"img":s.sheetsFormat.includes(e)?$s:s.textsFormat.includes(e)?qs:s.documentsFormat.includes(e)?Ns:s.archivesFormat.includes(e)?js:Ts},Zs={},Ys={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function Js(a,e){return t.openBlock(),t.createElementBlock("svg",Ys,e[0]||(e[0]=[t.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const xe=$(Zs,[["render",Js]]),Ws={},Xs={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function Qs(a,e){return t.openBlock(),t.createElementBlock("svg",Xs,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),t.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),t.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const He=$(Ws,[["render",Qs]]),en={class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},tn={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},qe=$(t.defineComponent({__name:"vs-input-file-list-item",props:t.mergeModels({format:{},multiple:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(a){const e=t.useModel(a,"value"),s=t.useModel(a,"item"),n=a;return(r,l)=>(t.openBlock(),t.createElementBlock("div",en,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Ks)(s.value)),{src:s.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:l[0]||(l[0]=o=>t.unref(Pe)(s.value))},null,8,["src"])),t.createElementVNode("div",tn,[t.createElementVNode("button",{type:"button",onClick:l[1]||(l[1]=o=>{t.unref(ws)(s.value),e.value=n.multiple?e.value?.filter(i=>i!==s.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[t.createVNode(xe,{class:"w-4 h-4"})]),t.createElementVNode("button",{type:"button",onClick:l[2]||(l[2]=o=>t.unref(Pe)(s.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[t.createVNode(He,{class:"w-4 h-4"})])])]))}}),[["__scopeId","data-v-0ca886b3"]]),sn={class:"flex items-center gap-x-2"},nn={key:1,class:"flex items-center flex-wrap gap-2"},Ge=t.defineComponent({__name:"vs-input-file",props:t.mergeModels({format:{},multiple:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,s=t.useModel(a,"modelValue"),n=t.ref(null),r=o=>Array.isArray(s.value)&&s.value[o]||"",l=async o=>{if(e.format){const c=o.target.files?.[0];if(!c||!c.name.endsWith(e.format))return}const i=o.target.files?.[0];if(!i)return;const u=await _s(i,"1","form","table");s.value=e.multiple?[...s.value||[],u?.file_path]:u?.file_path};return(o,i)=>(t.openBlock(),t.createElementBlock("div",sn,[t.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:n,type:"file",onChange:l},null,544),!o.multiple&&s.value?(t.openBlock(),t.createBlock(qe,{key:0,item:s.value,"onUpdate:item":i[0]||(i[0]=u=>s.value=u),value:s.value,"onUpdate:value":i[1]||(i[1]=u=>s.value=u)},null,8,["item","value"])):o.multiple?(t.openBlock(),t.createElementBlock("div",nn,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,(u,c)=>(t.openBlock(),t.createBlock(qe,{multiple:o.multiple,key:c,value:s.value,"onUpdate:value":i[2]||(i[2]=d=>s.value=d),item:r(c)},null,8,["multiple","value","item"]))),128)),t.createElementVNode("div",{onClick:i[3]||(i[3]=u=>!o.disabled&&n.value?.click()),class:t.normalizeClass(["h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",o.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[t.createVNode(ye,{class:"w-6 h-6"})],2)])):t.createCommentVNode("",!0),o.multiple?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:2,onClick:i[4]||(i[4]=u=>n.value?.click()),class:t.normalizeClass([o.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[t.createVNode(ye,{class:"w-6 h-6"})],2))]))}}),rn={class:"max-w-[55vw]"},ln={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},an={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},on={class:"px-[5px]"},un={class:""},_e=t.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(a){const e=a,s=t.computed(()=>{try{return new Date(e.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function n(r){if(r<1024)return`${r} B`;const l=r/1024;return l<1024?`${l.toFixed(2)} KB`:`${(l/1024).toFixed(2)} MB`}return(r,l)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[l[1]||(l[1]=t.createStaticVNode('<div class="flex items-center justify-center h-[30px] w-[30px]"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path></svg></div>',1)),t.createElementVNode("div",rn,[t.createElementVNode("p",ln,t.toDisplayString(r.item?.uploaded_name),1),t.createElementVNode("p",an,[t.createElementVNode("span",null,t.toDisplayString(r.item?.username),1),t.withDirectives(t.createElementVNode("span",on,"|",512),[[t.vShow,r.item?.username]]),t.createElementVNode("span",null,t.toDisplayString(s.value),1),l[0]||(l[0]=t.createElementVNode("span",{class:"px-[5px]"},"|",-1)),t.createElementVNode("span",un,t.toDisplayString(n(r.item?.size)),1)])])],64))}}),dn={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},cn={key:0,class:"flex w-full gap-x-3 items-center"},pn={key:1,class:"flex gap-x-3 w-full items-center"},hn={key:2,class:"flex gap-x-3 w-full items-center"},mn=["href"],fn={key:3,class:"flex gap-x-3 w-full items-center"},gn={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},kn={class:"p-0.5 sm:p-1 inline-flex items-center gap-0.5 bg-white rounded-lg dark:bg-neutral-800 dark:border-neutral-700"},bn={class:"inline-block"},yn={class:"inline-block"},xn=t.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(a,{emit:e}){const s=a,n=e;function r(d){return["pdf","json"].includes(d.ext)}function l(d){return["ppt","pptx","doc","docx","xls","xlsx"].includes(d.ext)}function o(d){const h=document.createElement("a");h.setAttribute("download",d?.uploaded_name),h.href=d?.file_path,h.click()}async function i(){try{await fetch(`${s.prefix}/widget/file/${s.item.entity_id}/${s.item.file_id}`),n("update")}catch(d){console.error(d)}}function u(){n("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function c(d){(s.item.ext==="jpg"||s.item.ext==="png")&&n("openLightbox",{item:s.item,index:d})}return(d,h)=>(t.openBlock(),t.createElementBlock("div",dn,[d.item.ext==="jpg"||d.item.ext==="png"?(t.openBlock(),t.createElementBlock("div",cn,[t.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:h[0]||(h[0]=p=>c(d.index))},[t.createVNode(_e,{item:d.item},null,8,["item"])])])):r(d.item)?(t.openBlock(),t.createElementBlock("div",pn,[t.createVNode(_e,{item:d.item},null,8,["item"])])):l(d.item)?(t.openBlock(),t.createElementBlock("div",hn,[t.createElementVNode("a",{href:`/api/file-preview?id=${d.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[t.createVNode(_e,{item:d.item},null,8,["item"])],8,mn)])):(t.openBlock(),t.createElementBlock("div",fn,[t.createVNode(_e,{item:d.item},null,8,["item"])])),t.createElementVNode("div",gn,[t.createElementVNode("div",kn,[t.createElementVNode("div",bn,[t.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:h[1]||(h[1]=p=>o(d.item))},[t.createVNode(He,{height:"14",width:"14"})])]),h[3]||(h[3]=t.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),t.createElementVNode("div",yn,[t.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:h[2]||(h[2]=p=>u())},[t.createVNode(xe,{height:"14",width:"14"})])])])])]))}}),_n={},wn={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function En(a,e){return t.openBlock(),t.createElementBlock("svg",wn,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),t.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),t.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Vn=$(_n,[["render",En]]),Cn={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},Bn={class:"flex w-full mb-[12px] items-center gap-x-2"},vn={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},Sn={class1:"ml-auto"},Nn={class:"py-1.5 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg bg-gray-100 cursor-pointer hover:bg-gray-200 text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},Fn={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},Mn={class:"relative"},An={key:1,class:"space-y-3 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},$n={key:0},Ke=t.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update"],setup(a,{emit:e}){const s=a,n=t.inject("form"),r=t.computed(()=>n.value.formId),l=t.ref(!1),o=t.ref(0),i=e,u=t.ref(!1),c=t.ref({}),d=t.ref([]),h=t.ref(""),p=t.computed(()=>Array.isArray(d.value)?d.value.filter(b=>b.ext==="jpg"||b.ext==="png").map(b=>b?.file_path):[]),_=t.computed(()=>h.value===""?d.value:d.value.filter(b=>b?.uploaded_name?.includes(h.value))),S=b=>{const f=p.value.findIndex(j=>j===b.item.file_path);f!==-1&&(l.value=!0,o.value=f)},M=async()=>{try{const b=await fetch(`${s.prefix}/widget/file/${r.value}`).then(f=>f.json());d.value=b?.rows}catch(b){console.error(b)}},A=async b=>{await Promise.all(Array.from(b.target.files).map(async f=>{const j=new FormData;j.append("file",f);try{const V=`${s.prefix}/widget/file/${r.value}`;return await fetch(V,{method:"POST",body:j}),i("update","file-list"),f}catch(V){return console.error(V),null}})),await M()},T=b=>{const f={...b};return b.cancel||(f.cancel=()=>{u.value=!1}),b.updateListOnConfirm&&(f.confirm=async()=>{await b.confirm(),u.value=!1,M()}),f},w=b=>{c.value=T(b),u.value=!0};return t.watch(r,b=>{b&&M()}),t.onMounted(()=>{r.value&&M()}),(b,f)=>{const j=t.resolveComponent("Lightbox"),V=t.resolveComponent("MessageBox");return t.openBlock(),t.createElementBlock("div",Cn,[t.createElementVNode("div",Bn,[t.createElementVNode("h2",vn," Файлів: "+t.toDisplayString(d.value?.length),1),t.createElementVNode("div",Sn,[t.createElementVNode("label",null,[t.createElementVNode("input",{type:"file",class:"hidden",onChange:f[0]||(f[0]=m=>A(m))},null,32),t.createElementVNode("div",Nn,[t.createVNode(Vn,{height:"16",width:"16"})])])])]),d.value?.length>4?(t.openBlock(),t.createElementBlock("div",Fn,[t.createElementVNode("div",null,[t.createElementVNode("div",Mn,[f[8]||(f[8]=t.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[t.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),t.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),t.withDirectives(t.createElementVNode("input",{type:"text","onUpdate:modelValue":f[1]||(f[1]=m=>h.value=m),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[t.vModelText,h.value,void 0,{trim:!0}]])])])])):t.createCommentVNode("",!0),d.value?.length?(t.openBlock(),t.createElementBlock("div",An,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(_.value,(m,C)=>(t.openBlock(),t.createBlock(xn,{key:C,prefix:b.prefix,item:m,index:C,onUpdate:f[2]||(f[2]=N=>b.$emit("update","file-list")),onOpenModal:f[3]||(f[3]=N=>w(N)),onOpenLightbox:f[4]||(f[4]=N=>S(N))},null,8,["prefix","item","index"]))),128)),_.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",$n,f[9]||(f[9]=[t.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):t.createCommentVNode("",!0),t.createVNode(j,{modelValue:l.value,"onUpdate:modelValue":f[5]||(f[5]=m=>l.value=m),startIndex:o.value,"onUpdate:index":f[6]||(f[6]=m=>o.value=m),images:p.value},null,8,["modelValue","startIndex","images"]),t.createVNode(V,t.mergeProps({modelValue:u.value,"onUpdate:modelValue":f[7]||(f[7]=m=>u.value=m),onConfirm:c.value.confirm},c.value),null,16,["modelValue","onConfirm"])])}}}),Dn={class:"flex items-center justify-between"},In={class:"text-[16px] text-gray-900 font-medium"},Ln={class:"grid gap-3"},Tn=$(t.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(a){const e=a,s=t.ref(e.isOpen);return t.watch(()=>e.isOpen,n=>{s.value=n}),(n,r)=>(t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",Dn,[t.createElementVNode("p",In,t.toDisplayString(a.title),1),t.createVNode(Se,{modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=l=>s.value=l),style:t.normalizeStyle(a.style)},null,8,["modelValue","style"])]),t.createVNode(t.Transition,{name:"slide-fade"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",Ln,[t.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[t.vShow,s.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),Rn={class:"text-[16px] text-gray-900 font-medium"},On={class:"grid gap-3"},zn=$(t.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(a){const e=a,s=t.ref(e.isOpen);return t.watch(()=>e.isOpen,n=>{s.value=n}),(n,r)=>(t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("button",{type:"button",onClick:r[0]||(r[0]=l=>s.value=!s.value),class:"flex items-center gap-2"},[t.createVNode(t.unref(ts),{class:t.normalizeClass(["h-4 w-4 duration-300",[s.value?"-rotate-180":""]])},null,8,["class"]),t.createElementVNode("span",Rn,t.toDisplayString(a.title),1)]),t.createVNode(t.Transition,{name:"slide-fade"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",On,[t.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[t.vShow,s.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),jn={class:"flex items-center justify-between"},Un={switcher:Tn,accordion:zn,default:t.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(a){return(e,s)=>(t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",jn,[t.createElementVNode("p",null,t.toDisplayString(a.title),1)]),t.renderSlot(e.$slots,"default")]))}})},G={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Pn=(a,e)=>String(a)===String(e),Hn=(a,e)=>String(a)!==String(e),qn=(a,e)=>a>e,Gn=(a,e)=>a>=e,Kn=(a,e)=>a<e,Zn=(a,e)=>a<=e,Yn=(a,e)=>Array.isArray(e)&&e.length===2?a>=e[0]&&a<=e[1]:!1,Jn=(a,e)=>String(a).startsWith(String(e)),Wn=(a,e)=>String(a).endsWith(String(e)),Xn=(a,e)=>String(a).includes(String(e)),Qn=(a,e)=>Array.isArray(e)?e.includes(a):!1,er=(a,e)=>Array.isArray(e)?!e.includes(a):!0,Ze=(a,e)=>{if(!e)return!0;switch(e?.[1]){case G.Equal:return Pn(a,e?.[2]);case G.Inequal:return Hn(a,e?.[2]);case G.Higer:return qn(a,e?.[2]);case G.HigerOrEqual:return Gn(a,e?.[2]);case G.Lower:return Kn(a,e?.[2]);case G.LowerOrEqual:return Zn(a,e?.[2]);case G.Between:return Yn(a,e?.[2]);case G.StartWith:return Jn(a,e?.[2]);case G.EndWith:return Wn(a,e?.[2]);case G.Contain:return Xn(a,e?.[2]);case G.In:return Qn(a,e?.[2]);case G.NotIn:return er(a,e?.[2]);default:return!0}},Ye=t.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},schema:{type:Array,default:()=>[]}},setup(a){const e=a,s=t.inject("formValues",{default:{}}),n=t.inject("form"),r=t.computed(()=>e.schema?.filter(o=>{const i=o?.conditions;if(!i)return!0;const u=Array.isArray(i)?i[0]:i,c=s?.value?.[u];return Ze(c,i)})),l=t.computed(()=>Un[e.view]);return(o,i)=>a.schema?.length?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(l.value),{key:0,title:a.title,style:t.normalizeStyle(a.style)},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,u=>(t.openBlock(),t.createBlock(rt,t.mergeProps({key:u.name},{ref_for:!0},u,{item:u,modelValue:t.unref(s)[u.name],"onUpdate:modelValue":c=>t.unref(s)[u.name]=c,style:a.style,error:t.unref(n)?.errors?.[u.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):t.createCommentVNode("",!0)}}),tr={class:"relative"},sr={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},nr={class:"m-[10px] fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 min-h-0 h-fit max-h-[80vh] overflow-hidden opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl lg:w-7/12 w-11/12"},rr={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},lr={class:"font-medium text-gray-800 dark:text-[#ffffff]"},ar={class:"p-4 mim-h-0 h-full overflow-auto"},Je=t.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(a,{emit:e}){const s=a,n=e,r=t.ref(s.schema),l=t.ref(s.defaultValue?JSON.parse(JSON.stringify(s.defaultValue)):{}),o=t.ref({}),i=t.ref(),u=t.ref(s.mode);async function c(){const h=o.value.validate();if(h){X.notify({type:"warning",title:"Помилка валідації",message:Object.entries(h).map(([p,_])=>`${p}: ${_}`).join(`
2
- `)});return}if(i.value)try{const p=await fetch(`/api/table/${i.value}`,{method:u.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(l.value)});if(p.ok)await p.json(),X.notify({type:"success",title:"Успішно",message:`Дані успішно ${u.value==="add"?"збережено":"оновлено"}`}),n("save",l.value);else if(p.status===400){const _=await p.json().catch(()=>({}));X.notify({type:"warning",title:"Помилка валідації",message:_.message||"Некоректні дані (400)"})}else p.status===500?X.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):X.notify({type:"error",title:"Помилка",message:`Статус: ${p.status}`})}catch(p){X.notify({type:"error",title:"Помилка з’єднання",message:p.message||"Не вдалося виконати запит"})}}function d(){n("close")}return t.onMounted(async()=>{if(s.form){const h=await fetch(`/api/template/form/${s.form}`).then(p=>p.json());r.value=h.schema,i.value=h.token}else if(s.token){i.value=s.token;const h=await fetch(`/api/form/${i.value}`).then(p=>p.json());r.value=h.schema,h.data?l.value=h.data:u.value="add"}}),(h,p)=>(t.openBlock(),t.createElementBlock("div",tr,[t.createElementVNode("div",sr,[t.createElementVNode("div",nr,[t.createElementVNode("div",rr,[t.createElementVNode("h3",lr,t.toDisplayString(u.value==="add"?"Додати":"Змінити"),1),t.createElementVNode("button",{onClick:d,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},p[2]||(p[2]=[t.createElementVNode("span",{class:"sr-only"},"Close",-1),t.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("path",{d:"M18 6 6 18"}),t.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),t.createElementVNode("div",ar,[r.value?(t.openBlock(),t.createBlock(de,{key:0,schema:r.value,values:l.value,"onUpdate:values":p[0]||(p[0]=_=>l.value=_),form:o.value,"onUpdate:form":p[1]||(p[1]=_=>o.value=_)},null,8,["schema","values","form"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",{class:"vs-form__head mr-5 mb-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},[t.createElementVNode("button",{type:"button",onClick:d,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),t.createElementVNode("button",{onClick:c,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])])])]))}}),ue=(a={mode:"edit",schema:null})=>new Promise(e=>{const s=document.querySelector("body");if(!s){console.error('Modal root element with id "#modal" not found!');return}const n=document.createElement("div");s.appendChild(n);function r(){l.unmount(),n.remove()}const l=t.createApp({render(){return t.h(Je,{...a,onClose:()=>{e(null),r()},onSave:o=>{e(o),r()}})}});l.mount(n)}),or=["aria-expanded","data-focus"],ir={class:"flex items-center"},ur={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},dr=["onClick"],cr={key:1,class:t.normalizeClass(["flex items-center absolute truncate text-gray-900"])},pr={key:2,class:"absolute text-gray-500 truncate"},hr={class:"flex-1 min-w-[2px]"},mr=["placeholder"],fr={class:"flex items-center shrink-0"},gr=["disabled"],kr=["disabled"],br={key:0,class:"absolute z-10 w-full mt-2 rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]",role:"listbox"},yr=["aria-disabled","onClick"],xr={key:1,class:"px-3 py-2 text-center text-gray-500"},_r=["disabled"],We=t.defineComponent({__name:"vs-input-select",props:t.mergeModels({multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{},options:{default:()=>[]},maxHeight:{default:400},add:{},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},{modelValue:{default:null},modelModifiers:{}}),emits:t.mergeModels(["change"],["update:modelValue"]),setup(a,{emit:e}){const s=a,n=e,r=t.computed(()=>s.multiple),l=t.computed(()=>s.disabled);Q(s.style);const o=t.useModel(a,"modelValue"),i=t.ref(null),u=t.ref(null),c=t.ref(null),d=t.ref(!1),h=t.ref(!1),p=t.ref(null),_=t.ref([]),S=t.ref(-1),M=t.ref([]),A=t.ref(""),T=t.ref(null),w=t.ref([]),b=t.computed(()=>{if(!w.value.length)return[];const x=new Map(_.value.map(y=>[y.id?.toString(),y]));return w.value.map(y=>x.get(y?.toString())).filter(y=>!!y)}),f=t.computed(()=>s.placeholder||"Select..."),j=t.computed(()=>r.value?!w.value.length&&A.value==="":!p.value?.text&&A.value===""),V=t.computed(()=>l.value?!1:r.value?w.value.length>0:!!o.value),m=x=>r.value?w.value.some(y=>y?.toString()===x?.toString()):o.value?.toString?.()===x?.toString?.(),C=t.computed(()=>{let x=_.value??[];if(A.value.trim()!==""){const y=A.value.toLowerCase();x=x.filter(F=>F.text?.toLowerCase?.().includes(y))}if(r.value&&w.value.length){const y=new Set(w.value.map(F=>F?.toString()));x=x.filter(F=>!y.has(F.id?.toString()))}return x}),N=async x=>{if(!s.data||!x)return[];try{const y=`${s.host}/${s.prefix}/suggest/${s.data}?json=1&val=${encodeURIComponent(x)}`;return(await fetch(y).then(P=>P.json())).data??[]}catch{return[]}},U=async()=>{s.options?.length?_.value=[...s.options]:s.data&&(_.value=await N(A.value))},K=async x=>{if(x==null)return null;const y=_.value?.find(P=>P?.id?.toString()===String(x));return y||((await N(String(x)))?.[0]??null)},ie=async x=>{const y=new Set(_.value.map(P=>P.id?.toString())),F=x.filter(P=>!y.has(P?.toString()));F.length&&await F.reduce(async(P,ae)=>{await P;const Be=await K(ae);Be&&_.value.push(Be)},Promise.resolve())},ge=async()=>{l.value||(d.value=!0,await U(),await t.nextTick(()=>{T.value?.focus(),C.value.length?S.value=0:S.value=-1}))},W=()=>{d.value=!1,S.value=-1},Ie=async x=>{if(l.value)return;!d.value?await ge():W()},ke=async()=>{d.value?T.value?.focus():await ge()},g=()=>{r.value?(w.value=[],o.value=[],n("change",[])):(p.value=null,o.value=null,n("change",null)),A.value="",t.nextTick(()=>T.value?.focus())},k=x=>{r.value&&(w.value=w.value.filter(y=>y?.toString()!==x?.toString()),o.value=[...w.value],n("change",o.value),t.nextTick(()=>T.value?.focus()))},D=x=>{r.value?(m(x.id)||(w.value=[...w.value,x.id],o.value=[...w.value],n("change",o.value)),A.value="",t.nextTick(()=>{T.value?.focus(),S.value=Math.min(S.value,C.value.length-1)})):(p.value=x,o.value=x.id,n("change",o.value),A.value="",W())},R=x=>{m(x.id)||D(x)},q=(x,y)=>{if(!x||!y)return;const F=x.offsetTop,P=F+x.offsetHeight,ae=y.scrollTop,Be=ae+y.clientHeight;let Le=y.scrollTop;F<ae?Le=F-80:P>Be&&(Le=P-y.clientHeight+4);const lo=y;lo.scrollTop=Le},be=async x=>{l.value||!d.value&&(x.key==="ArrowDown"||x.key==="ArrowUp")&&(x.preventDefault(),await ge())},se=x=>{if(!d.value)return;const{key:y}=x;if(y==="ArrowDown")x.preventDefault(),S.value+1<C.value.length&&(S.value+=1,q(M.value[S.value],c.value));else if(y==="ArrowUp")x.preventDefault(),S.value>0&&(S.value-=1,q(M.value[S.value],c.value));else if(y==="Enter"){x.preventDefault();const F=C.value[S.value];F&&D(F)}else y==="Escape"?(x.preventDefault(),W()):y==="Backspace"?r.value&&A.value===""&&w.value.length&&(w.value=w.value.slice(0,-1),o.value=[...w.value],n("change",o.value)):y==="Home"?(S.value=0,q(M.value[0],c.value)):y==="End"?(S.value=C.value.length-1,q(M.value[S.value],c.value)):y==="Tab"&&W()},re=()=>{l.value||(h.value=!0)},le=()=>{h.value=!1,A.value=""},ne=x=>{x.key==="Escape"&&d.value&&W()},yt=x=>{i.value&&(i.value.contains(x.target)||W())},xt=x=>{d.value&&c.value&&!c.value.contains(x.target)&&W()};t.watch(()=>s.options,x=>{x?.length&&(_.value=[...x])},{immediate:!0});const _t=async()=>{if(r.value)Array.isArray(o.value)?w.value=[...o.value]:(w.value=o.value==null?[]:[o.value],o.value=[...w.value]),!s.options?.length&&s.data&&await ie(w.value);else{if(Array.isArray(o.value)){const x=o.value[0]??null;o.value=x??null}p.value=await K(o.value)}};t.watch(o,()=>{_t()}),t.onMounted(async()=>{addEventListener("keydown",ne),addEventListener("scroll",xt,!0),document.addEventListener("click",yt,!0),s.options?.length?_.value=[...s.options]:s.data&&(_.value=await N("")),await _t()}),t.onUnmounted(()=>{removeEventListener("keydown",ne),removeEventListener("scroll",xt,!0),document.removeEventListener("click",yt,!0)});async function ro(){if(!s.add)return;const x=await ue({form:s.add.form,mode:"add"});x&&(await fetch(`/api/table/${s.add.token}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(x)}).then(y=>y.json()),!s.options?.length&&s.data&&(_.value=await N(A.value)))}return(x,y)=>(t.openBlock(),t.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:y[2]||(y[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",{class:t.normalizeClass(["relative w-full font-sans",s.customClass])},[y[7]||(y[7]=t.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),y[8]||(y[8]=t.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),t.createElementVNode("div",{class:t.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",d.value||h.value?"border-blue-500 ring-1 ring-blue-500":"",l.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":d.value,"aria-haspopup":"listbox",onKeydown:be,onClick:ke,"data-focus":d.value||h.value?"true":"false"},[t.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"triggerRef",ref:u},[r.value&&w.value.length?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(b.value,F=>(t.openBlock(),t.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border",key:F.id},[t.createElementVNode("div",ir,[F?.color?(t.openBlock(),t.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5",style:t.normalizeStyle({backgroundColor:F?.color})},null,4)):t.createCommentVNode("",!0),t.createElementVNode("div",ur,t.toDisplayString(F.text),1)]),t.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:t.withModifiers(P=>k(F.id),["stop"])},y[3]||(y[3]=[t.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[t.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,dr)]))),128)):!r.value&&p.value?.text&&A.value===""?(t.openBlock(),t.createElementBlock("div",cr,[p.value?.color?(t.openBlock(),t.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-0.5",style:t.normalizeStyle({backgroundColor:p.value?.color})},null,4)):t.createCommentVNode("",!0),t.createTextVNode(" "+t.toDisplayString(p.value.text),1)])):t.createCommentVNode("",!0),j.value?(t.openBlock(),t.createElementBlock("div",pr,t.toDisplayString(f.value),1)):t.createCommentVNode("",!0),t.createElementVNode("div",hr,[!l.value&&x.search?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputRef",ref:T,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:r.value&&w.value.length?"":void 0,"onUpdate:modelValue":y[0]||(y[0]=F=>A.value=F),onFocus:re,onBlur:le,onKeydown:se},null,40,mr)),[[t.vModelText,A.value]]):t.createCommentVNode("",!0)])],512),t.createElementVNode("div",fr,[V.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:l.value,onClick:t.withModifiers(g,["stop"])},y[4]||(y[4]=[t.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[t.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,gr)):t.createCommentVNode("",!0),y[6]||(y[6]=t.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),t.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:l.value,onClick:y[1]||(y[1]=t.withModifiers(F=>Ie(),["stop"]))},y[5]||(y[5]=[t.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[t.createElementVNode("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})],-1)]),8,kr)])],42,or),d.value?(t.openBlock(),t.createElementBlock("div",br,[t.createElementVNode("div",{class:"max-h-[300px] overflow-y-auto py-1",ref_key:"listRef",ref:c},[C.value.length?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(C.value,(F,P)=>(t.openBlock(),t.createElementBlock("div",{key:F.id,ref_for:!0,ref:ae=>M.value[P]=ae,class:t.normalizeClass(["flex px-3 py-2 cursor-default select-none hover:bg-blue-300",m(F.id)?"text-white bg-blue-500":"text-gray-900 bg-white"]),"aria-disabled":m(F.id)?"true":"false",role:"option",tabindex:"-1",onClick:ae=>R(F)},[F?.color?(t.openBlock(),t.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:t.normalizeStyle({backgroundColor:F?.color})},null,4)):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["leading-[19px]",S.value===F.id?"text-white":"",(S.value===P,"")])},t.toDisplayString(F.text),3)],10,yr))),128)):(t.openBlock(),t.createElementBlock("div",xr," No options "))],512)])):t.createCommentVNode("",!0)],2),s.add?(t.openBlock(),t.createElementBlock("button",{key:0,onClick:ro,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:l.value,type:"button"},[t.createVNode(ye,{width:"16",height:"16"}),y[9]||(y[9]=t.createElementVNode("span",null,"Додати",-1))],8,_r)):t.createCommentVNode("",!0)],512))}}),wr=["placeholder","disabled"],Xe=t.defineComponent({__name:"vs-input-textarea",props:t.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,{inputClass:s}=Q(e.style),n=t.useModel(a,"modelValue");return(r,l)=>t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{"onUpdate:modelValue":l[0]||(l[0]=o=>n.value=o),placeholder:r.placeholder,disabled:r.disabled,row:"2",class:t.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto",[t.unref(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,wr)),[[t.vModelText,n.value]])}}),Er={},Vr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};function Cr(a,e){return t.openBlock(),t.createElementBlock("svg",Vr,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),t.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const Br=$(Er,[["render",Cr]]),vr={},Sr={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Nr(a,e){return t.openBlock(),t.createElementBlock("svg",Sr,e[0]||(e[0]=[t.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),t.createElementVNode("path",{d:"M7 20V4"},null,-1),t.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),t.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const Fr=$(vr,[["render",Nr]]),Mr={},Ar={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function $r(a,e){return t.openBlock(),t.createElementBlock("svg",Ar,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),t.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),t.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Dr=$(Mr,[["render",$r]]),Ir={},Lr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Tr(a,e){return t.openBlock(),t.createElementBlock("svg",Lr,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),t.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),t.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Rr=$(Ir,[["render",Tr]]),Or={},zr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function jr(a,e){return t.openBlock(),t.createElementBlock("svg",zr,e[0]||(e[0]=[t.createStaticVNode('<circle cx="9" cy="12" r="1"></circle><circle cx="9" cy="5" r="1"></circle><circle cx="9" cy="19" r="1"></circle><circle cx="15" cy="12" r="1"></circle><circle cx="15" cy="5" r="1"></circle><circle cx="15" cy="19" r="1"></circle>',6)]))}const Qe=$(Or,[["render",jr]]),Ur={},Pr={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Hr(a,e){return t.openBlock(),t.createElementBlock("svg",Pr,e[0]||(e[0]=[t.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)]))}const qr=$(Ur,[["render",Hr]]),Gr={},Kr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Zr(a,e){return t.openBlock(),t.createElementBlock("svg",Kr,e[0]||(e[0]=[t.createElementVNode("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"},null,-1)]))}const Yr=$(Gr,[["render",Zr]]),Jr={class:"vs-datatable border rounded-xl w-full flex-grow"},Wr={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},Xr={class:"relative w-full"},Qr={class:"table-wrapper flex gap-2"},el={class:"vs-popover inline-block text-slate-700"},tl={class:"text-center"},sl={class:""},nl={class:"py-1 px-0 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},rl={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},ll={class:"text-sm items-center text-gray-800 flex gap-1"},al={class:"w-full overflow-x-auto"},ol={class:"w-full table-auto caption-bottom text-sm"},il={class:"[&_tr]:border-b"},ul={class:"border-b data-[state=selected]:bg-muted bg-slate-50/50 dark:bg-slate-700/50 hover:bg-slate-50/80 dark:hover:bg-slate-700/80 transition-colors"},dl={class:"h-10 px-2 align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] w-12 text-center"},cl={key:0,colspan:"100%",class:"text-center"},pl={class:"w-full"},hl={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},ml=["onDragstart","onDragover","onDrop"],fl={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},gl={class:"flex items-center justify-center"},kl={class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},bl={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},yl={class:"flex items-center justify-center gap-2"},xl=["onClick"],_l=["onClick"],et=t.defineComponent({__name:"vs-input-datatable",props:t.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,s=t.useModel(a,"modelValue"),n=t.ref({}),r=t.ref(""),l=t.computed(()=>{if(!r.value)return s.value??[];const V=r.value.toLowerCase();return s.value.filter(m=>e.colModel?.some(C=>{const N=m[C.key];return N?Array.isArray(N)?N.join(", ").toLowerCase().includes(V):String(N).toLowerCase().includes(V):!1}))}),o=t.ref(null),i=t.ref(null),u=t.ref(!1),c=t.ref(null),d=t.ref({top:0,left:0}),h=V=>{o.value=V},p=V=>{i.value=V},_=V=>{if(o.value===null||o.value===V){o.value=null,i.value=null;return}const m=[...s.value],[C]=m.splice(o.value,1);m.splice(V,0,C),s.value=m,o.value=null,i.value=null},S=V=>{const C=V.currentTarget.getBoundingClientRect();d.value={top:C.bottom+window.scrollY,left:C.left+window.scrollX},u.value=!u.value},M=()=>{c.value&&c.value.click()},A=V=>{const C=V.target.files?.[0];if(!C)return;const N=new FileReader;N.onload=U=>{try{const K=U.target?.result;if(typeof K=="string"){const ie=JSON.parse(K);Array.isArray(ie)&&s.value.push(...ie)}}catch(K){console.error("Error parsing file:",K)}},N.readAsText(C)},T=()=>{const V=JSON.stringify(s.value,null,2),m=new Blob([V],{type:"application/json"}),C=URL.createObjectURL(m),N=document.createElement("a");N.href=C,N.download="data.json",N.click(),URL.revokeObjectURL(C)};t.onMounted(async()=>{const V=e.colModel?.filter(m=>m.data);V?.length&&Promise.all(V.map(async m=>{n.value[m.key]=await fetch(`/api/suggest/${m.data}`).then(C=>C.json())}))});async function w(){const V=await ue({schema:e.colModel,mode:"add"});V&&(Array.isArray(s.value)?s.value=[...s.value,V]:s.value=[V])}function b(V,m){return n.value[m.key]&&V[m.key]?n.value[m.key].find(C=>C.id.toString()===V[m.key].toString())?.text??V[m.key]:V[m.key]||"-"}async function f(V,m){const C=await ue({schema:e.colModel,mode:"add",defaultValue:V});C&&(s.value=s.value.map((N,U)=>U===m?C:N))}function j(V){s.value=s.value.filter((m,C)=>C!==V)}return(V,m)=>(t.openBlock(),t.createElementBlock("div",Jr,[t.createElementVNode("div",Wr,[t.createElementVNode("div",Xr,[t.createVNode(Br,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),t.withDirectives(t.createElementVNode("input",{type:"text","onUpdate:modelValue":m[0]||(m[0]=C=>r.value=C),placeholder:"Пошук",class:"py-2 px-3 pl-10 w-full bg-gray-100 h-[36px] rounded-[8px] text-[15px] leading-[18px] focus:border-1 text-stone-800 placeholder:text-[#6B7280] focus:outline-blue-500 focus:outline-2"},null,512),[[t.vModelText,r.value]])]),t.createElementVNode("div",Qr,[t.createElementVNode("input",{ref_key:"fileInput",ref:c,onChange:A,class:"hidden",accept:".json",type:"file"},null,544),t.createElementVNode("div",el,[t.createElementVNode("div",tl,[t.createElementVNode("div",sl,[t.createElementVNode("button",{onClick:S,class:"bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[t.createVNode(Fr,{height:"16",width:"16"})])])])])]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[u.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:t.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:d.value.top+"px",left:d.value.left+"px"}])},[t.createElementVNode("div",nl,[t.createElementVNode("div",rl,[t.createElementVNode("button",{onClick:M,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[t.createVNode(Dr,{class:"text-black",width:"14",height:"14"}),m[1]||(m[1]=t.createTextVNode(" Імпортувати "))]),t.createElementVNode("button",{onClick:T,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[t.createElementVNode("span",ll,[t.createVNode(Rr,{class:"text-black",width:"14",height:"14"}),m[2]||(m[2]=t.createTextVNode(" Експортувати "))])])])])],4)):t.createCommentVNode("",!0)])),t.createElementVNode("button",{onClick:w,class:"text-slate-700 bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[t.createVNode(ye),m[3]||(m[3]=t.createTextVNode(" Додати "))])]),t.createElementVNode("div",al,[t.createElementVNode("table",ol,[t.createElementVNode("thead",il,[t.createElementVNode("tr",ul,[t.createElementVNode("th",dl,[t.createVNode(Qe,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.colModel,C=>(t.openBlock(),t.createElementBlock("th",{key:C.key,class:"h-10 px-2 text-left align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 min-w-[150px]"},t.toDisplayString(C.ua||C.label),1))),128)),m[4]||(m[4]=t.createElementVNode("th",{class:"h-10 px-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 text-center"}," Дії ",-1))])]),t.createElementVNode("tbody",{class:t.normalizeClass({"[&_tr:last-child]:border-0":!i.value})},[l.value.length===0?(t.openBlock(),t.createElementBlock("td",cl,[t.createElementVNode("div",pl,[t.createElementVNode("div",hl,[t.createVNode(qr,{class:"w-48 mx-auto"}),m[5]||(m[5]=t.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[t.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),t.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,(C,N)=>(t.openBlock(),t.createElementBlock("tr",{key:C.id,class:t.normalizeClass(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move",{"opacity-50":o.value===N,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":i.value===N}]),draggable:"true",onDragstart:U=>h(N),onDragover:t.withModifiers(U=>p(N),["prevent"]),onDrop:U=>_(N)},[t.createElementVNode("td",fl,[t.createElementVNode("div",gl,[t.createVNode(Qe,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.colModel,U=>(t.openBlock(),t.createElementBlock("td",{key:U.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[t.createElementVNode("div",kl,t.toDisplayString(b(C,U)),1)]))),128)),t.createElementVNode("td",bl,[t.createElementVNode("div",yl,[t.createElementVNode("button",{onClick:U=>f(C,N),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-blue-50 dark:hover:bg-slate-600 hover:border-blue-300 dark:hover:border-slate-500 hover:text-blue-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[t.createVNode(Yr,{width:"24",height:"24",class:"w-3 h-3"})],8,xl),t.createElementVNode("button",{onClick:U=>j(N),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-red-50 dark:hover:bg-slate-600 hover:border-red-300 dark:hover:border-slate-500 hover:text-red-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[t.createVNode(xe,{width:"24",height:"24",class:"w-3 h-3"})],8,_l)])])],42,ml))),128))],2)])])]))}}),wl={draw:{toolbar:{actions:{title:"Скасувати малювання",text:"Скасувати"},finish:{title:"Завершити малювання",text:"Завершити"},undo:{title:"Видалити останню точку",text:"Видалити останню"},buttons:{polyline:"Намалювати лінію",polygon:"Намалювати полігон",rectangle:"Намалювати прямокутник",circle:"Намалювати коло",marker:"Додати точку",circlemarker:"Додати маркер-коло"}},handlers:{circle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати коло",end:"Відпустіть кнопку миші, щоб завершити"},radius:"Радіус"},circlemarker:{tooltip:{start:"Клацніть на карту, щоб додати маркер-коло"}},marker:{tooltip:{start:"Клацніть на карту, щоб додати точку"}},polygon:{tooltip:{start:"Клацніть, щоб почати малювати полігон",cont:"Клацайте, щоб продовжити малювати полігон",end:"Клацніть першу точку, щоб завершити полігон"}},polyline:{error:"<strong>Помилка:</strong> лінія не може перетинатися сама з собою",tooltip:{start:"Клацніть, щоб почати малювати лінію",cont:"Клацайте, щоб продовжити малювати лінію",end:"Клацніть останню точку, щоб завершити лінію"}},rectangle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати прямокутник",end:"Відпустіть кнопку миші, щоб завершити"}},simpleshape:{tooltip:{end:"Відпустіть кнопку миші, щоб завершити"}}}},edit:{toolbar:{actions:{save:{title:"Зберегти зміни",text:"Зберегти"},cancel:{title:"Скасувати редагування",text:"Скасувати"},clearAll:{title:"Очистити всі шари",text:"Очистити все"}},buttons:{edit:"Редагувати шари",editDisabled:"Немає шарів для редагування",remove:"Видалити шари",removeDisabled:"Немає шарів для видалення"}},handlers:{edit:{tooltip:{text:"Перетягніть маркери, щоб редагувати шари",subtext:"Натисніть 'Скасувати', щоб повернутися"}},remove:{tooltip:{text:"Клацніть на шари, щоб видалити їх"}}}}};function El(a){return a?a.type==="FeatureCollection"||a.type==="Feature"?a:a.geom?{type:"Feature",geometry:{type:a.geom.type,coordinates:a.geom.coordinates},properties:{}}:a.type&&a.coordinates?{type:"Feature",geometry:a,properties:{}}:null:null}const Vl={},Cl={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-map-pin"};function Bl(a,e){return t.openBlock(),t.createElementBlock("svg",Cl,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),t.createElementVNode("path",{d:"M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z"},null,-1)]))}const vl=$(Vl,[["render",Bl]]),Sl={},Nl={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","stroke-width":"2",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-line"};function Fl(a,e){return t.openBlock(),t.createElementBlock("svg",Nl,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),t.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),t.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const Ml=$(Sl,[["render",Fl]]),Al={},$l={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function Dl(a,e){return t.openBlock(),t.createElementBlock("svg",$l,e[0]||(e[0]=[t.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M6.5 9.5l3.5 -3"></path><path d="M14 5.5l3 1.5"></path><path d="M18.5 10l-2.5 7"></path><path d="M13.5 17.5l-7 -5"></path>',9)]))}const Il=$(Al,[["render",Dl]]),Ll={},Tl={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function Rl(a,e){return t.openBlock(),t.createElementBlock("svg",Tl,e[0]||(e[0]=[t.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M8 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M6 8v8"></path><path d="M18 16v-8"></path><path d="M8 6h8"></path><path d="M16 18h-8"></path>',9)]))}const Ol=$(Ll,[["render",Rl]]),zl={},jl={version:"1.1",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg","xmlns:sketch":"http://www.bohemiancoding.com/sketch/ns","xmlns:xlink":"http://www.w3.org/1999/xlink",class:"fullscreen-icon"};function Ul(a,e){return t.openBlock(),t.createElementBlock("svg",jl,e[0]||(e[0]=[t.createElementVNode("title",null,null,-1),t.createElementVNode("desc",null,null,-1),t.createElementVNode("defs",null,null,-1),t.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[t.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[t.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[t.createElementVNode("path",{d:"M2,9 L0,9 L0,14 L5,14 L5,12 L2,12 L2,9 L2,9 Z M0,5 L2,5 L2,2 L5,2 L5,0 L0,0 L0,5 L0,5 Z M12,12 L9,12 L9,14 L14,14 L14,9 L12,9 L12,12 L12,12 Z M9,0 L9,2 L12,2 L12,5 L14,5 L14,0 L9,0 L9,0 Z",id:"Shape"})])])],-1)]))}const Pl=$(zl,[["render",Ul]]),Hl={class:"form-geom__search"},ql={class:"map-search__input"},Gl={class:"flex flex-nowrap relative"},Kl={class:"form-autocomplete relative min-w-[6rem] vsTailwind map-search__select hidden"},Zl={class:"flex items-center w-full"},Yl={class:"max-w-[90%] truncate"},Jl={key:0,class:"absolute z-[3100] mt-0.5 left-0 right-0"},Wl={class:"form-autocomplete__wrapper mt-[10px] z-50 w-full min-w-36 max-h-72 p-0 space-y-0.5 bg-white rounded-xl shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] dark:bg-neutral-900 top-full opened"},Xl={class:"form-autocomplete__list vsTailwind px-2 pb-2 pt-0 max-h-200 relative [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500 dark:bg-neutral-900"},Ql=["onClick"],ea={class:"flex justify-between items-center w-full"},ta={class:"flex items-center"},sa={key:0,class:"flex-shrink-0 w-3.5 h-3.5 text-blue-600",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},na={class:"relative w-full"},ra={class:"vs-form-text relative bg-white rounded-lg"},la={key:1,class:"absolute left-0 right-0 top-full z-[3200] bg-white border border-gray-200 rounded-b-lg shadow-lg max-h-72 overflow-auto"},aa={key:0},oa=["onClick"],ia={key:1,class:"px-3 py-2 text-xs text-gray-500"},ua={key:2,class:"px-3 py-2 text-xs text-gray-400"},da=t.defineComponent({__name:"map-search",props:{placeholder:{default:"50, 30"}},emits:["goToCoordinates"],setup(a,{emit:e}){const s=e,n=t.ref(!1),r=t.ref("coordinates"),l=t.ref(""),o=t.ref([]),i=t.ref(!1),u=t.ref(!1);let c;const d=[{value:"coordinates",label:"Пошук по кординатам"},{value:"atu",label:"АТУ"},{value:"address",label:"Адресса"},{value:"search_here",label:"Пошук HERE"}],h=t.computed(()=>d.find(w=>w.value===r.value)?.label??"АТУ");function p(w){r.value=w.value,n.value=!1,l.value="",l.value&&M()}function _(w){w.target.closest(".map-search__input")||(n.value=!1)}t.onMounted(()=>document.addEventListener("click",_)),t.onUnmounted(()=>document.removeEventListener("click",_));async function S(w){let b;r.value==="atu"?b="/api/suggest/atu.nsdi.ato_level":r.value==="address"?b="/api/suggest/map.address_id":r.value==="search_here"&&(b="/api/gis-url-proxy");const f=new URL(b||"");return r.value==="search_here"?f.searchParams.set("searchtext",w):(r.value==="atu"||r.value==="address")&&f.searchParams.set("key",w),f.searchParams.set("limit","20"),f.searchParams.set("q",w),(await fetch(f.toString())).json()}function M(){if(i.value=!0,u.value=!0,r.value==="coordinates"){const w=l.value.trim().split(",");if(w.length===2){const b=parseFloat(w[0]),f=parseFloat(w[1]);!Number.isNaN(b)&&!Number.isNaN(f)&&s("goToCoordinates",[b,f])}return}c&&window.clearTimeout(c),c=window.setTimeout(async()=>{const w=l.value.trim();if(!w){o.value=[],u.value=!1;return}try{const b=await S(w);o.value=Array.isArray(b.features)?b.features:[]}catch{o.value=[]}finally{u.value=!1}},300)}function A(){l.value="",o.value=[],i.value=!1,u.value=!1}function T(w){s("goToCoordinates",w),i.value=!1,u.value=!1,o.value=[]}return(w,b)=>(t.openBlock(),t.createElementBlock("div",Hl,[t.createElementVNode("div",ql,[t.createElementVNode("div",Gl,[t.createElementVNode("div",Kl,[t.createElementVNode("button",{type:"button",onClick:b[0]||(b[0]=f=>n.value=!n.value),class:"h-[40px] relative px-4 pe-9 flex text-nowrap w-full cursor-pointer bg-white border border-solid border-stone-200 rounded-lg text-start text-sm text-stone-800 focus:outline-none focus:ring-1 focus:ring-blue-600 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-200"},[t.createElementVNode("div",Zl,[t.createElementVNode("span",Yl,t.toDisplayString(h.value),1)]),b[3]||(b[3]=t.createElementVNode("svg",{class:"stroke-gray-500 absolute right-3 translate-y-1/2 bottom-1/2",width:"15",height:"15",viewBox:"0 0 24 24",fill:"none"},[t.createElementVNode("path",{d:"M6 9l6 6 6-6","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1))]),n.value?(t.openBlock(),t.createElementBlock("div",Jl,[t.createElementVNode("div",Wl,[t.createElementVNode("div",Xl,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,f=>t.createElementVNode("div",{onClick:j=>p(f),key:f.value,class:"form-autocomplete__item cursor-pointer hs-selected:bg-stone-100 dark:hs-selected:bg-neutral-800 py-2 px-4 w-full text-sm text-gray-800 hover:bg-gray-100 rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:hover:bg-neutral-800 dark:text-neutral-200 dark:focus:bg-neutral-800 cursor-default"},[t.createElementVNode("div",ea,[t.createElementVNode("div",ta,[t.createElementVNode("div",null,t.toDisplayString(f.label),1)]),f.value===r.value?(t.openBlock(),t.createElementBlock("svg",sa,b[4]||(b[4]=[t.createElementVNode("polyline",{points:"20 6 9 17 4 12"},null,-1)]))):t.createCommentVNode("",!0)])],8,Ql)),64))])])])):t.createCommentVNode("",!0)]),t.createElementVNode("div",na,[t.createElementVNode("div",ra,[b[6]||(b[6]=t.createElementVNode("i",{class:"absolute bottom-1/2 translate-y-1/2 left-3 text-gray-500"},[t.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},[t.createElementVNode("circle",{cx:"11",cy:"11",r:"8","stroke-width":"2"}),t.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65","stroke-width":"2"})])],-1)),t.withDirectives(t.createElementVNode("input",{type:"text","onUpdate:modelValue":b[1]||(b[1]=f=>l.value=f),onInput:M,onFocus:b[2]||(b[2]=f=>i.value=!0),placeholder:"Пошук...",class:"bg-white h-[38px] text-sm py-2 px-3 ps-9 pe-8 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,544),[[t.vModelText,l.value]]),l.value?(t.openBlock(),t.createElementBlock("button",{key:0,onClick:A,class:"absolute right-2 bottom-1/2 translate-y-1/2 text-gray-500 hover:text-red-500","aria-label":"Очистити",type:"button"},b[5]||(b[5]=[t.createElementVNode("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]))):t.createCommentVNode("",!0),i.value&&r.value!=="coordinates"?(t.openBlock(),t.createElementBlock("div",la,[o.value.length?(t.openBlock(),t.createElementBlock("ul",aa,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,f=>(t.openBlock(),t.createElementBlock("li",{key:f.properties.place_id,onClick:j=>T(f),class:"px-3 py-2 text-sm cursor-pointer hover:bg-gray-100"},t.toDisplayString(f.properties.display_name),9,oa))),128))])):u.value?(t.openBlock(),t.createElementBlock("div",ia,"Шукаю…")):(t.openBlock(),t.createElementBlock("div",ua,"Нічого не знайдено"))])):t.createCommentVNode("",!0)])])])])]))}}),ca={class:"bg-white/95 p-2 rounded-xl shadow border border-gray-200"},pa={class:"flex gap-2"},ha=["onClick","title"],ma=["src"],fa=t.defineComponent({__name:"map-layers",props:{basemaps:{},defaultLayer:{}},emits:["onLayerChange"],setup(a,{emit:e}){const s=a,n=t.ref(s.defaultLayer??""),r=e;function l(o){r("onLayerChange",o),n.value=o}return(o,i)=>(t.openBlock(),t.createElementBlock("div",ca,[t.createElementVNode("div",pa,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.basemaps,(u,c)=>(t.openBlock(),t.createElementBlock("div",{key:c,class:t.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":n.value===c}]),onClick:d=>l(c),title:c,role:"button",tabindex:"0"},[t.createElementVNode("img",{src:u.preview,alt:"",class:"w-14 h-14 object-cover"},null,8,ma)],10,ha))),128))])]))}}),ga={class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},ka={class:"form-geom__panel flex gap-1 items-start mt-2"},ba={class:"flex items-center gap-1"},ya=["disabled"],xa={class:"absolute top-4 right-4 z-[1000]"},_a={class:"flex flex-col gap-[2px]"},wa=["aria-pressed"],Ea=["aria-pressed"],Va=["aria-pressed"],Ca=["aria-pressed"],Ba={class:"absolute bottom-0 left-0 right-0 z-[1000] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},va={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},Sa={class:"mr-auto"},Na={class:"font-bold"},Fa={class:"flex items-center"},Ma={class:"text-xs mr-2"},Aa={key:0,class:"text-xs"},$a={key:1,class:"text-xs"},tt=$(t.defineComponent({__name:"vs-input-map",props:{style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(a,{emit:e}){const s=a,n=e,r=t.ref(null);let l,o,i;const u=t.ref(null),c=t.ref(null),d=t.ref(6),h=t.ref(0),p=t.ref(null),_={topo100:{url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/voyager/ua/13/4790/2762.png"},orto10:{url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4790/2762.png"},osmb:{url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",preview:"https://tile.openstreetmap.org.ua/styles/osm-bright/13/4790/2762.png"}};let S;const M=t.ref("topo100");function A(){return new Promise((g,k)=>{window.L&&window.L.Draw&&g(0);const D=q=>{if(Array.from(document.styleSheets).some(re=>re?.href?.includes(q)))return;const se=document.createElement("link");se.rel="stylesheet",se.href=q,document.head.appendChild(se)},R=q=>new Promise((be,se)=>{const re=Array.from(document.scripts).find(ne=>ne.src===q);if(re){re.addEventListener("load",()=>be()),re.addEventListener("error",ne=>se(ne));return}const le=document.createElement("script");le.src=q,le.async=!0,le.onload=()=>be(),le.onerror=ne=>se(ne),document.body.appendChild(le)});D("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),D("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),R("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>R("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js")).then(()=>g(0)).catch(k)})}function T(){const g=o.toGeoJSON();let k=null;g?.features?.length&&(k=g.features[0].geometry),n("update:modelValue",k),h.value=o.getLayers().length}function w(g=30){const k=o.getLayers();if(!k.length)return;const R=L.featureGroup(k).getBounds();R&&R.isValid()&&l.fitBounds(R,{padding:[g,g]})}function b(){u.value?.click()}const f=t.ref("");function j(g){return g instanceof L.Circle?"Circle":g instanceof L.Rectangle?"Rectangle":g instanceof L.Polygon&&!(g instanceof L.Rectangle)?"Polygon":g instanceof L.Polyline&&!(g instanceof L.Polygon)?"Polyline":g instanceof L.Marker?"Point":"Feature"}function V(g){if(g instanceof L.Circle){const k=g.getRadius();return Math.PI*(k*k)/1e6}if(g instanceof L.Polygon||g instanceof L.Rectangle)try{const k=g.getLatLngs(),D=Array.isArray(k[0])?k[0]:k,R=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea(D):0;return R?R/1e6:0}catch{return null}return null}function m(g){return g instanceof L.Circle?g.getLatLng():g.getBounds?g.getBounds().getCenter():g.getLatLng?g.getLatLng():l.getCenter()}function C(){const g=o.getLayers();if(!g.length){p.value=null,h.value=0;return}const k=g[g.length-1],D=j(k),R=m(k),q=V(k);p.value={type:D,center:R,areaKm2:q,layer:k},h.value=g.length}function N(){const g=p.value?.layer;g&&(g instanceof L.Circle&&g.getBounds?l.fitBounds(g.getBounds(),{padding:[30,30]}):g.getBounds?l.fitBounds(g.getBounds(),{padding:[30,30]}):g.getLatLng&&l.setView(g.getLatLng(),Math.max(d.value,14)))}function U(){const g=p.value?.layer;g&&(o.removeLayer(g),T(),C())}t.onMounted(async()=>{await A(),L.drawLocal=wl,l=L.map(r.value,{zoomControl:!1}).setView([50,30],10),L.control.zoom({position:"bottomright"}).addTo(l),S=L.tileLayer(_.topo100.url,{maxZoom:19,minZoom:6}).addTo(l),M.value="topo100",o=new L.FeatureGroup().addTo(l),l.on(L.Draw.Event.CREATED,k=>{const{layer:D}=k;o.clearLayers(),o.addLayer(D),T(),C(),w(),f.value=""}),l.on(L.Draw.Event.EDITED,()=>{T(),C(),w()}),l.on(L.Draw.Event.DELETED,()=>{T(),C(),w()}),l.on("mousemove",k=>{c.value=k.latlng}),l.on("zoomend",()=>{d.value=l.getZoom()});const g=El(s.modelValue);if(g){const k=[];L.geoJSON(g).eachLayer(D=>k.push(D)),k.length&&o.addLayer(k[0]),T(),C(),w()}});function K(g){if(l){switch(i&&i.disable(),g){case"marker":i=new L.Draw.Marker(l);break;case"polyline":i=new L.Draw.Polyline(l);break;case"polygon":i=new L.Draw.Polygon(l);break;case"rectangle":i=new L.Draw.Rectangle(l);break;default:i=new L.Draw.Rectangle(l);break}i&&(i.enable(),f.value=g)}}function ie(){const g=o.toGeoJSON(),k=new Blob([JSON.stringify(g,null,2)],{type:"application/json"}),D=URL.createObjectURL(k),R=document.createElement("a");R.href=D,R.download="data.geojson",R.click(),URL.revokeObjectURL(D)}function ge(g){const k=g.target.files?.[0];if(!k)return;const D=new FileReader;D.onload=()=>{if(typeof D.result=="string")try{const R=JSON.parse(D.result);o.clearLayers(),R&&L.geoJSON({type:"Feature",geometry:R}).eachLayer(q=>{o.addLayer(q)}),T(),C(),w()}finally{g.target.value=""}},D.readAsText(k)}function W(g){l&&(S&&l.removeLayer(S),S=L.tileLayer(_[g].url,{maxZoom:19,minZoom:6}).addTo(l),M.value=g)}function Ie(g){const k=L.latLng(g[0],g[1]);l.setView(k,13)}t.watch(()=>s.modelValue,g=>{o.clearLayers(),g&&L.geoJSON({type:"Feature",geometry:g}).eachLayer(k=>{o.addLayer(k)}),h.value=o.getLayers().length,C(),w()});const ke=t.ref(!1);return(g,k)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["leaflet-map-wrapper relative w-full h-[600px]",{fullscreen:ke.value}])},[t.createElementVNode("div",{ref_key:"mapContainer",ref:r,class:"w-full h-full"},null,512),t.createElementVNode("div",ga,[t.createVNode(da,{onGoToCoordinates:Ie}),t.createElementVNode("div",ka,[t.createElementVNode("div",ba,[t.createElementVNode("button",{type:"button",class:"vs-btn-row",onClick:b},"Імпорт"),t.createElementVNode("button",{type:"button",class:"vs-btn-row",onClick:ie,disabled:h.value===0},"Експорт ",8,ya)]),t.createElementVNode("input",{ref_key:"importRef",ref:u,type:"file",onChange:ge,accept:".json,.geojson",class:"hidden"},null,544)])]),t.createElementVNode("div",xa,[t.createElementVNode("div",_a,[t.createElementVNode("button",{class:t.normalizeClass(["vs-btn",{"vs-active":f.value==="marker"}]),"aria-pressed":f.value==="marker",title:"Point (P)","aria-label":"Draw point",onClick:k[0]||(k[0]=D=>K("marker"))},[t.createVNode(vl)],10,wa),t.createElementVNode("button",{class:t.normalizeClass(["vs-btn",{"vs-active":f.value==="polyline"}]),"aria-pressed":f.value==="polyline",title:"Line (L)","aria-label":"Draw polyline",onClick:k[1]||(k[1]=D=>K("polyline"))},[t.createVNode(Ml)],10,Ea),t.createElementVNode("button",{class:t.normalizeClass(["vs-btn",{"vs-active":f.value==="polygon"}]),"aria-pressed":f.value==="polygon",title:"Polygon (G)","aria-label":"Draw polygon",onClick:k[2]||(k[2]=D=>K("polygon"))},[t.createVNode(Il)],10,Va),t.createElementVNode("button",{class:t.normalizeClass(["vs-btn",{"vs-active":f.value==="rectangle"}]),"aria-pressed":f.value==="rectangle",title:"Rectangle (R)","aria-label":"Draw rectangle",onClick:k[3]||(k[3]=D=>K("rectangle"))},[t.createVNode(Ol)],10,Ca),t.createElementVNode("button",{class:"vs-btn",onClick:k[4]||(k[4]=D=>ke.value=!ke.value)},[t.createVNode(Pl,{style:{width:"12px",height:"12px"}})])])]),t.createElementVNode("div",{class:t.normalizeClass(["absolute left-4 z-[1000]",p.value?"bottom-8":"bottom-4"])},[t.createVNode(fa,{basemaps:_,"default-layer":"topo100",onOnLayerChange:W})],2),t.createElementVNode("div",Ba,[p.value?(t.openBlock(),t.createElementBlock("div",va,[t.createElementVNode("div",Sa,[k[7]||(k[7]=t.createTextVNode(" Тип: ")),t.createElementVNode("span",Na,t.toDisplayString(p.value.type),1)]),t.createElementVNode("div",Fa,[t.createElementVNode("div",Ma,[k[8]||(k[8]=t.createTextVNode(" Центр: ")),t.createElementVNode("b",null,t.toDisplayString(p.value.center.lat.toFixed(5))+", "+t.toDisplayString(p.value.center.lng.toFixed(5)),1)]),p.value.areaKm2!==null?(t.openBlock(),t.createElementBlock("div",Aa,[k[9]||(k[9]=t.createTextVNode(" Площа: ")),t.createElementVNode("b",null,t.toDisplayString(p.value.areaKm2.toFixed(1))+"км²",1)])):(t.openBlock(),t.createElementBlock("div",$a,k[10]||(k[10]=[t.createTextVNode(" Площа: "),t.createElementVNode("b",null,"—",-1)]))),t.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Наблизити",onClick:k[5]||(k[5]=D=>N())},k[11]||(k[11]=[t.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-3 h-3" data-v-d73d6cfa><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" data-v-d73d6cfa></path><path d="M7 10l6 0" data-v-d73d6cfa></path><path d="M10 7l0 6" data-v-d73d6cfa></path><path d="M21 21l-6 -6" data-v-d73d6cfa></path></svg>',1)])),t.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Видалити",onClick:k[6]||(k[6]=D=>U())},[t.createVNode(xe,{class:"w-3 h-3"})])])])):t.createCommentVNode("",!0)])],2))}}),[["__scopeId","data-v-d73d6cfa"]]),Da=["data-focus"],Ia={class:"flex items-center"},La={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},Ta=["onClick","aria-label"],Ra={key:0,class:"absolute text-gray-500 truncate pl-2"},Oa={class:"flex-1 min-w-[2px]"},za=["placeholder"],ja={class:"flex items-center shrink-0"},Ua=["disabled"],st=t.defineComponent({__name:"vs-input-tag",props:t.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"}},{modelValue:{default:[]},modelModifiers:{}}),emits:t.mergeModels(["update:modelValue"],["update:modelValue"]),setup(a,{emit:e}){const s=a,n=e;Q(s.style);const r=t.ref(null),l=t.ref(null),o=t.ref(null),i=t.ref(!1),u=t.ref(""),c=t.useModel(a,"modelValue"),d=t.computed(()=>s.placeholder||"Add tag…"),h=t.computed(()=>c.value?.length===0&&u.value===""),p=t.computed(()=>!s.disabled&&c.value?.length>0),_=t.computed(()=>s.disabled),S=async()=>{_.value||await t.nextTick(()=>o.value?.focus())},M=V=>{const m=V.trim();m!==""&&(!c.value||!Array.isArray(c.value)?c.value=[m]:s.unique?c.value.includes(m)||(c.value=[...c.value,m]):c.value=[...c.value,m],u.value="")},A=()=>{const V=u.value;V.trim()!==""&&M(V),u.value=""},T=V=>{const m=c.value.slice();m.splice(V,1),n("update:modelValue",m)},w=()=>{n("update:modelValue",[])},b=()=>{_.value||(i.value=!0)},f=()=>{i.value=!1},j=V=>{const{key:m}=V;m==="Enter"?(V.preventDefault(),A()):m==="Backspace"&&u.value===""&&c.value.length>0&&T(c.value.length-1)};return(V,m)=>(t.openBlock(),t.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:r,onClick:m[1]||(m[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",{class:t.normalizeClass(["relative w-full font-sans",s.customClass]),role:"group","aria-label":"Tag input"},[t.createElementVNode("div",{class:t.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",i.value?"border-blue-500 ring-1 ring-blue-500":"",_.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:S},[t.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:l},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,(C,N)=>(t.openBlock(),t.createElementBlock("div",{key:N,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[t.createElementVNode("div",Ia,[t.createElementVNode("div",La,t.toDisplayString(C),1)]),t.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:t.withModifiers(U=>T(N),["stop"]),"aria-label":`Remove ${C}`},m[2]||(m[2]=[t.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[t.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,Ta)]))),128)),h.value?(t.openBlock(),t.createElementBlock("div",Ra,t.toDisplayString(d.value),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Oa,[_.value?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputRef",ref:o,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":m[0]||(m[0]=C=>u.value=C),onFocus:b,onBlur:f,onKeydown:j,placeholder:c.value&&c.value.length?"":void 0},null,40,za)),[[t.vModelText,u.value]])])],512),t.createElementVNode("div",ja,[p.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:_.value,onClick:t.withModifiers(w,["stop"])},m[3]||(m[3]=[t.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[t.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,Ua)):t.createCommentVNode("",!0)])],10,Da)],2)],512))}}),nt={VsInputText:ve,VsInputRadio:Fe,"vs-input-text":ve,"vs-input-textarea":Xe,"vs-input-mask":Oe,"vs-input-number":Te,"vs-input-radio":Fe,"vs-input-select":We,"vs-input-switcher":Se,"vs-input-static":Ne,"vs-input-container":Ye,"vs-input-date":Ue,"vs-input-checkbox":je,"vs-input-file":Ge,"vs-input-html":Ne,"vs-input-email":ze,"vs-input-datatable":et,"vs-input-map":tt,"vs-input-file-list":Ke,"vs-input-tag":st},Pa=t.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(a){const e=a,s=t.inject("values");async function n(){try{if(!e.api)return;const r=e.api.replace("{{value}}",e.value),l=await fetch(r);if(!l.ok){X.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const o=await l.json();if(!e.set||!s)return;for(const[i,u]of Object.entries(e.set))s.value[i]=o.result[u]}catch(r){console.error(e.error,r)}}return(r,l)=>(t.openBlock(),t.createElementBlock("button",{onClick:n,class:"vs-button relative inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-blue-500 hover:border-blue-500 hover:bg-blue-500 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 ml-0 md:ml-2 mt-2 md:mt-0 py-[8px] md:w-2/4 whitespace-nowrap w-full"},t.toDisplayString(r.button),1))}}),Ha={class:"flex w-full"},rt=t.defineComponent({__name:"vs-compact-form-layout",props:t.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,s=t.useModel(a,"modelValue"),n=t.computed(()=>Dt[`${e.layout}`]),r=t.computed(()=>nt?.[`vs-input-${e.item.type}`]),l=t.computed(()=>{const i=t.unref(r);if(!i)return new Set;const u=i.props??i.__vccOpts?.props;if(!u)return new Set;const c=Array.isArray(u)?u:Object.keys(u);return new Set(c)}),o=t.computed(()=>{const i=e.item??{},u=l.value;return u.size?Object.fromEntries(Object.entries(i).filter(([c])=>u.has(c))):{}});return(i,u)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(n.value),{ua:e.item.ua,error:e.error||"",item:i.item,label:e.item.label},{default:t.withCtx(()=>[t.createElementVNode("div",Ha,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.value),t.mergeProps(o.value,{modelValue:s.value,"onUpdate:modelValue":u[0]||(u[0]=c=>s.value=c)}),null,16,["modelValue"])),i.item.behavior?(t.openBlock(),t.createBlock(Pa,t.mergeProps({key:0},i.item.behavior,{value:s.value}),null,16,["value"])):t.createCommentVNode("",!0)])]),_:1},8,["ua","error","item","label"]))}}),lt={required:"Це поле є обов’язковим",email:"Неправильний email"},qa=a=>a?!1:lt.required,Ga=a=>!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a)&&a?lt.email:!1,Ka=(a,e)=>{const s=e.pattern??e.regexp;return!(typeof s=="string"?new RegExp(s):s).test(a)&&a?e.message:!1},Za=(a,e)=>!1,Ya=(a,e)=>{switch(typeof e=="string"?e:e.type){case"required":return qa(a);case"email":return Ga(a);case"regexp":return Ka(a,e);case"custom":return Za();default:return!1}},Ja={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file"};function at(a){const e=a.toLowerCase();return Ja[e]||e}function Wa(a){if(Array.isArray(a)){const s=[];return a.forEach(n=>{const r={...n};r.name=(n.name||n.id||n.key||"").toString(),r.type=at(n.type),r.label=n.label||n.ua,r.rules=n.rules||n.validators,n.data&&(r.api=`/api/suggest/${n.data}`),s.push(r)}),s}const e=[];return Object.entries(a).forEach(s=>{const n={name:s[0],...s[1],type:at(s[1].type),label:s[1].label||s[1].ua,rules:s[1].rules||s[1].validators};s[1].type.includes("list")&&(n.multiple=!0),s[1].data&&(n.api=`/api/suggest/${s[1].data}`),e.push(n)}),e}function Xa(a,e){const s=Wa(e),n=t.ref({});function r(u){const c=u?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,h=a?.value?.[d];return Ze(h,c)}const l=(u=s,c=!0)=>(u.forEach(d=>{if(d.rules){if(!r(d)){delete n.value[d.name];return}d.rules.forEach(h=>{const p=Ya(a.value[d.name],h);p?n.value[d.name]=p:delete n.value[d.name]})}d.schema&&l(d.schema,!1)}),c&&Object.values(n.value).some(Boolean)?n.value:null),o=t.computed(()=>s?.filter(u=>r(u)));return{errors:n,validate:l,reset:()=>{a.value={},n.value={}},visibleSchema:o}}const de=t.defineComponent({__name:"vs-compact-form",props:t.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:t.mergeModels(["handle-submit","update:modelValue"],["update:form","update:values"]),setup(a,{expose:e,emit:s}){const n=s,r=a,l=t.useModel(a,"form"),o=t.useModel(a,"values"),{errors:i,validate:u,reset:c,visibleSchema:d}=Xa(o,r.schema),h=()=>{n("update:modelValue",o.value),u(),n("handle-submit",o.value)};e({validate:u,reset:c,errors:i}),t.onMounted(()=>{r.modelValue&&(o.value=r.modelValue),l.value.value=o.value,l.value.errors=i.value,l.value.reset=c,l.value.validate=u,l.value.formId=r.formId});function p(_,S){if(_===S)return!0;if(typeof _!="object"||typeof S!="object"||!_||!S)return!1;const M=Object.keys(_),A=Object.keys(S);return M.length!==A.length?!1:M.every(T=>_[T]===S[T])}return t.provide("form",l),t.provide("values",o),(_,S)=>(t.openBlock(),t.createElementBlock("form",{onSubmit:t.withModifiers(h,["prevent"]),class:t.normalizeClass(["grid grid-cols-12",_.layout==="default"?"gap-6":"gap-4"])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(d),M=>(t.openBlock(),t.createBlock(rt,{key:M.name,class:t.normalizeClass(_.layout==="horizontal"?"col-span-12":`col-span-${M.col||12} `),style:t.normalizeStyle(_.style),item:M,layout:_.layout,"model-value":o.value[M.name],"onUpdate:modelValue":A=>{const T=o.value[M.name];p(T,A)||(o.value[M.name]=A)},error:t.unref(i)[M.name]},null,8,["class","style","item","layout","model-value","onUpdate:modelValue","error"]))),128))],34))}});de.install=function(e){e.component("VForm",de),Object.assign(e.config.globalProperties,{$form:ue}),e.provide("form",ue),window.v3plugin||(window.v3plugin={})};function ee(a){return typeof a=="string"||a instanceof String}function ot(a){var e;return typeof a=="object"&&a!=null&&(a==null||(e=a.constructor)==null?void 0:e.name)==="Object"}function it(a,e){return Array.isArray(e)?it(a,(s,n)=>e.includes(n)):Object.entries(a).reduce((s,n)=>{let[r,l]=n;return e(l,r)&&(s[r]=l),s},{})}const E={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function ut(a){switch(a){case E.LEFT:return E.FORCE_LEFT;case E.RIGHT:return E.FORCE_RIGHT;default:return a}}function Me(a){return a.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function we(a,e){if(e===a)return!0;const s=Array.isArray(e),n=Array.isArray(a);let r;if(s&&n){if(e.length!=a.length)return!1;for(r=0;r<e.length;r++)if(!we(e[r],a[r]))return!1;return!0}if(s!=n)return!1;if(e&&a&&typeof e=="object"&&typeof a=="object"){const l=e instanceof Date,o=a instanceof Date;if(l&&o)return e.getTime()==a.getTime();if(l!=o)return!1;const i=e instanceof RegExp,u=a instanceof RegExp;if(i&&u)return e.toString()==a.toString();if(i!=u)return!1;const c=Object.keys(e);for(r=0;r<c.length;r++)if(!Object.prototype.hasOwnProperty.call(a,c[r]))return!1;for(r=0;r<c.length;r++)if(!we(a[c[r]],e[c[r]]))return!1;return!0}else if(e&&a&&typeof e=="function"&&typeof a=="function")return e.toString()===a.toString();return!1}class Qa{constructor(e){for(Object.assign(this,e);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?E.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?E.RIGHT:E.LEFT}}function B(a,e){return new B.InputMask(a,e)}function dt(a){if(a==null)throw new Error("mask property should be defined");return a instanceof RegExp?B.MaskedRegExp:ee(a)?B.MaskedPattern:a===Date?B.MaskedDate:a===Number?B.MaskedNumber:Array.isArray(a)||a===Array?B.MaskedDynamic:B.Masked&&a.prototype instanceof B.Masked?a:B.Masked&&a instanceof B.Masked?a.constructor:a instanceof Function?B.MaskedFunction:(console.warn("Mask not found for mask",a),B.Masked)}function oe(a){if(!a)throw new Error("Options in not defined");if(B.Masked){if(a.prototype instanceof B.Masked)return{mask:a};const{mask:e=void 0,...s}=a instanceof B.Masked?{mask:a}:ot(a)&&a.mask instanceof B.Masked?a:{};if(e){const n=e.mask;return{...it(e,(r,l)=>!l.startsWith("_")),mask:e.constructor,_mask:n,...s}}}return ot(a)?{...a}:{mask:a}}function Z(a){if(B.Masked&&a instanceof B.Masked)return a;const e=oe(a),s=dt(e.mask);if(!s)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===s&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new s(e)}B.createMask=Z;class Ee{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return e??this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return e??this.value.length}select(e,s){if(!(e==null||s==null||e===this.selectionStart&&s===this.selectionEnd))try{this._unsafeSelect(e,s)}catch{}}get isActive(){return!1}}B.MaskElement=Ee;const ct=90,eo=89;class ce extends Ee{constructor(e){super(),this.input=e,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var e,s,n;return(e=(s=(n=this.input).getRootNode)==null?void 0:s.call(n))!=null?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){if(this._handlers.redo&&(e.keyCode===ct&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===eo&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===ct&&(e.metaKey||e.ctrlKey))return e.preventDefault(),this._handlers.undo(e);e.isComposing||this._handlers.selectionChange(e)}_onBeforeinput(e){if(e.inputType==="historyUndo"&&this._handlers.undo)return e.preventDefault(),this._handlers.undo(e);if(e.inputType==="historyRedo"&&this._handlers.redo)return e.preventDefault(),this._handlers.redo(e)}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}B.HTMLMaskElement=ce;class pt extends ce{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,s){this.input.setSelectionRange(e,s)}get value(){return this.input.value}set value(e){this.input.value=e}}B.HTMLMaskElement=ce;class Ae extends ce{get _unsafeSelectionStart(){const e=this.rootElement,s=e.getSelection&&e.getSelection(),n=s&&s.anchorOffset,r=s&&s.focusOffset;return r==null||n==null||n<r?n:r}get _unsafeSelectionEnd(){const e=this.rootElement,s=e.getSelection&&e.getSelection(),n=s&&s.anchorOffset,r=s&&s.focusOffset;return r==null||n==null||n>r?n:r}_unsafeSelect(e,s){if(!this.rootElement.createRange)return;const n=this.rootElement.createRange();n.setStart(this.input.firstChild||this.input,e),n.setEnd(this.input.lastChild||this.input,s);const r=this.rootElement,l=r.getSelection&&r.getSelection();l&&(l.removeAllRanges(),l.addRange(n))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}B.HTMLContenteditableMaskElement=Ae;class Ve{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>Ve.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}Ve.MAX_LENGTH=100;class ht{constructor(e,s){this.el=e instanceof Ee?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new Ae(e):new pt(e),this.masked=Z(s),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Ve,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(e){var s;return e==null||((s=this.masked)==null?void 0:s.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof B.Masked)&&this.masked.constructor===dt(e)){this.masked.updateOptions({mask:e});return}const s=e instanceof B.Masked?e:Z({mask:e});s.unmaskedValue=this.masked.unmaskedValue,this.masked=s}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(e,s){const n=this._listeners[e];n&&n.forEach(r=>r(s))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){!this.el||!this.el.isActive||(this.el.select(e,e),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(e){const s=this.masked.unmaskedValue,n=this.masked.value,r=this.masked.rawInputValue,l=this.displayValue,o=this.unmaskedValue!==s||this.value!==n||this._rawInputValue!==r;this._unmaskedValue=s,this._value=n,this._rawInputValue=r,this.el.value!==l&&(this.el.value=l),e==="auto"?this.alignCursor():e!=null&&(this.cursorPos=e),o&&this._fireChangeEvents(),!this._historyChanging&&(o||this.history.isEmpty)&&this.history.push({unmaskedValue:s,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:s,...n}=e,r=!this.maskEquals(s),l=this.masked.optionsIsChanged(n);r&&(this.mask=s),l&&this.masked.updateOptions(n),(r||l)&&this.updateControl()}updateCursor(e){e!=null&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,E.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,s){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(s),this}off(e,s){if(!this._listeners[e])return this;if(!s)return delete this._listeners[e],this;const n=this._listeners[e].indexOf(s);return n>=0&&this._listeners[e].splice(n,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const s=new Qa({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),n=this.masked.rawInputValue,r=this.masked.splice(s.startChangePos,s.removed.length,s.inserted,s.removeDirection,{input:!0,raw:!0}).offset,l=n===this.masked.rawInputValue?s.removeDirection:E.NONE;let o=this.masked.nearestInputPos(s.startChangePos+r,l);l!==E.NONE&&(o=this.masked.nearestInputPos(o,E.NONE)),this.updateControl(o),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}B.InputMask=ht;class v{static normalize(e){return Array.isArray(e)?e:[e,new v]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}B.ChangeDetails=v;class Y{constructor(e,s,n){e===void 0&&(e=""),s===void 0&&(s=0),this.value=e,this.from=s,this.stop=n}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||e!=null&&this.from>=e)return"";const s=this.value[0];return this.value=this.value.slice(1),s}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class O{constructor(e){this._value="",this._update({...O.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,s){s===void 0&&(s={input:!0}),this.reset(),this.append(e,s,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,s){return e}totalInputPositions(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),Math.min(this.displayValue.length,s-e)}extractInput(e,s,n){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),this.displayValue.slice(e,s)}extractTail(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),new Y(this.extractInput(e,s),e)}appendTail(e){return ee(e)&&(e=new Y(String(e))),e.appendTo(this)}_appendCharRaw(e,s){return e?(this._value+=e,new v({inserted:e,rawInserted:e})):new v}_appendChar(e,s,n){s===void 0&&(s={});const r=this.state;let l;if([e,l]=this.doPrepareChar(e,s),e&&(l=l.aggregate(this._appendCharRaw(e,s)),!l.rawInserted&&this.autofix==="pad")){const o=this.state;this.state=r;let i=this.pad(s);const u=this._appendCharRaw(e,s);i=i.aggregate(u),u.rawInserted||i.equals(l)?l=i:this.state=o}if(l.inserted){let o,i=this.doValidate(s)!==!1;if(i&&n!=null){const u=this.state;if(this.overwrite===!0){o=n.state;for(let d=0;d<l.rawInserted.length;++d)n.unshift(this.displayValue.length-l.tailShift)}let c=this.appendTail(n);if(i=c.rawInserted.length===n.toString().length,!(i&&c.inserted)&&this.overwrite==="shift"){this.state=u,o=n.state;for(let d=0;d<l.rawInserted.length;++d)n.shift();c=this.appendTail(n),i=c.rawInserted.length===n.toString().length}i&&c.inserted&&(this.state=u)}i||(l=new v,this.state=r,n&&o&&(n.state=o))}return l}_appendPlaceholder(){return new v}_appendEager(){return new v}append(e,s,n){if(!ee(e))throw new Error("value should be string");const r=ee(n)?new Y(String(n)):n;s!=null&&s.tail&&(s._beforeTailState=this.state);let l;[e,l]=this.doPrepare(e,s);for(let o=0;o<e.length;++o){const i=this._appendChar(e[o],s,r);if(!i.rawInserted&&!this.doSkipInvalid(e[o],s,r))break;l.aggregate(i)}return(this.eager===!0||this.eager==="append")&&s!=null&&s.input&&e&&l.aggregate(this._appendEager()),r!=null&&(l.tailShift+=this.appendTail(r).tailShift),l}remove(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(s),new v}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const s=this.rawInputValue,n=this.value,r=e();return this.rawInputValue=s,this.value&&this.value!==n&&n.indexOf(this.value)===0&&(this.append(n.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,r}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const s=this.state,n=e(this);return this.state=s,delete this._isolated,n}doSkipInvalid(e,s,n){return!!this.skipInvalid}doPrepare(e,s){return s===void 0&&(s={}),v.normalize(this.prepare?this.prepare(e,this,s):e)}doPrepareChar(e,s){return s===void 0&&(s={}),v.normalize(this.prepareChar?this.prepareChar(e,this,s):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,s,n,r,l){n===void 0&&(n=""),r===void 0&&(r=E.NONE),l===void 0&&(l={input:!0});const o=e+s,i=this.extractTail(o),u=this.eager===!0||this.eager==="remove";let c;u&&(r=ut(r),c=this.extractInput(0,o,{raw:!0}));let d=e;const h=new v;if(r!==E.NONE&&(d=this.nearestInputPos(e,s>1&&e!==0&&!u?E.NONE:r),h.tailShift=d-e),h.aggregate(this.remove(d)),u&&r!==E.NONE&&c===this.rawInputValue)if(r===E.FORCE_LEFT){let p;for(;c===this.rawInputValue&&(p=this.displayValue.length);)h.aggregate(new v({tailShift:-1})).aggregate(this.remove(p-1))}else r===E.FORCE_RIGHT&&i.unshift();return h.aggregate(this.append(n,l,i))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!we(this,e)}typedValueEquals(e){const s=this.typedValue;return e===s||O.EMPTY_VALUES.includes(e)&&O.EMPTY_VALUES.includes(s)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new v}}O.DEFAULTS={skipInvalid:!0},O.EMPTY_VALUES=[void 0,null,""],B.Masked=O;class te{constructor(e,s){e===void 0&&(e=[]),s===void 0&&(s=0),this.chunks=e,this.from=s}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=ee(e)?new Y(String(e)):e;const s=this.chunks[this.chunks.length-1],n=s&&(s.stop===e.stop||e.stop==null)&&e.from===s.from+s.toString().length;if(e instanceof Y)n?s.extend(e.toString()):this.chunks.push(e);else if(e instanceof te){if(e.stop==null){let r;for(;e.chunks.length&&e.chunks[0].stop==null;)r=e.chunks.shift(),r.from+=e.from,this.extend(r)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof B.MaskedPattern))return new Y(this.toString()).appendTo(e);const s=new v;for(let n=0;n<this.chunks.length;++n){const r=this.chunks[n],l=e._mapPosToBlock(e.displayValue.length),o=r.stop;let i;if(o!=null&&(!l||l.index<=o)&&((r instanceof te||e._stops.indexOf(o)>=0)&&s.aggregate(e._appendPlaceholder(o)),i=r instanceof te&&e._blocks[o]),i){const u=i.appendTail(r);s.aggregate(u);const c=r.toString().slice(u.rawInserted.length);c&&s.aggregate(e.append(c,{tail:!0}))}else s.aggregate(e.append(r.toString(),{tail:!0}))}return s}get state(){return{chunks:this.chunks.map(e=>e.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:s,...n}=e;Object.assign(this,n),this.chunks=s.map(r=>{const l="chunks"in r?new te:new Y;return l.state=r,l})}unshift(e){if(!this.chunks.length||e!=null&&this.from>=e)return"";const s=e!=null?e-this.from:e;let n=0;for(;n<this.chunks.length;){const r=this.chunks[n],l=r.unshift(s);if(r.toString()){if(!l)break;++n}else this.chunks.splice(n,1);if(l)return l}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const s=this.chunks[e],n=s.shift();if(s.toString()){if(!n)break;--e}else this.chunks.splice(e,1);if(n)return n}return""}}class to{constructor(e,s){this.masked=e,this._log=[];const{offset:n,index:r}=e._mapPosToBlock(s)||(s<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=n,this.index=r,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((s=this.block)==null?void 0:s.displayValue.length)||0){var s;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,E.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,E.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,E.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,E.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,E.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,E.NONE),!0})}}class $e{constructor(e){Object.assign(this,e),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(e,s){return e===void 0&&(e=0),s===void 0&&(s=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(s),this._value||(this._isRawInput=!1),new v}nearestInputPos(e,s){s===void 0&&(s=E.NONE);const n=0,r=this._value.length;switch(s){case E.LEFT:case E.FORCE_LEFT:return n;case E.NONE:case E.RIGHT:case E.FORCE_RIGHT:default:return r}}totalInputPositions(e,s){return e===void 0&&(e=0),s===void 0&&(s=this._value.length),this._isRawInput?s-e:0}extractInput(e,s,n){return e===void 0&&(e=0),s===void 0&&(s=this._value.length),n===void 0&&(n={}),n.raw&&this._isRawInput&&this._value.slice(e,s)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(e,s){if(s===void 0&&(s={}),this.isFilled)return new v;const n=this.eager===!0||this.eager==="append",l=this.char===e&&(this.isUnmasking||s.input||s.raw)&&(!s.raw||!n)&&!s.tail,o=new v({inserted:this.char,rawInserted:l?this.char:""});return this._value=this.char,this._isRawInput=l&&(s.raw||s.input),o}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new v;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new Y("")}appendTail(e){return ee(e)&&(e=new Y(String(e))),e.appendTo(this)}append(e,s,n){const r=this._appendChar(e[0],s);return n!=null&&(r.tailShift+=this.appendTail(n).tailShift),r}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=!!e._rawInputValue}pad(e){return this._appendPlaceholder()}}class pe{constructor(e){const{parent:s,isOptional:n,placeholderChar:r,displayChar:l,lazy:o,eager:i,...u}=e;this.masked=Z(u),Object.assign(this,{parent:s,isOptional:n,placeholderChar:r,displayChar:l,lazy:o,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.value.length),e===0&&s>=1?(this.isFilled=!1,this.masked.remove(e,s)):new v}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(e,s){if(s===void 0&&(s={}),this.isFilled)return new v;const n=this.masked.state;let r=this.masked._appendChar(e,this.currentMaskFlags(s));return r.inserted&&this.doValidate(s)===!1&&(r=new v,this.masked.state=n),!r.inserted&&!this.isOptional&&!this.lazy&&!s.input&&(r.inserted=this.placeholderChar),r.skip=!r.inserted&&!this.isOptional,this.isFilled=!!r.inserted,r}append(e,s,n){return this.masked.append(e,this.currentMaskFlags(s),n)}_appendPlaceholder(){return this.isFilled||this.isOptional?new v:(this.isFilled=!0,new v({inserted:this.placeholderChar}))}_appendEager(){return new v}extractTail(e,s){return this.masked.extractTail(e,s)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,s,n){return e===void 0&&(e=0),s===void 0&&(s=this.value.length),this.masked.extractInput(e,s,n)}nearestInputPos(e,s){s===void 0&&(s=E.NONE);const n=0,r=this.value.length,l=Math.min(Math.max(e,n),r);switch(s){case E.LEFT:case E.FORCE_LEFT:return this.isComplete?l:n;case E.RIGHT:case E.FORCE_RIGHT:return this.isComplete?l:r;case E.NONE:default:return l}}totalInputPositions(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.value.length),this.value.slice(e,s).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var s;return{...e,_beforeTailState:(e==null||(s=e._beforeTailState)==null?void 0:s.masked)||e?._beforeTailState}}pad(e){return new v}}pe.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class mt extends O{updateOptions(e){super.updateOptions(e)}_update(e){const s=e.mask;s&&(e.validate=n=>n.search(s)>=0),super._update(e)}}B.MaskedRegExp=mt;class z extends O{constructor(e){super({...z.DEFAULTS,...e,definitions:Object.assign({},pe.DEFAULT_DEFINITIONS,e?.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const s=this.mask;if(!s||!e)return;let n=!1,r=!1;for(let l=0;l<s.length;++l){if(this.blocks){const c=s.slice(l),d=Object.keys(this.blocks).filter(p=>c.indexOf(p)===0);d.sort((p,_)=>_.length-p.length);const h=d[0];if(h){const{expose:p,repeat:_,...S}=oe(this.blocks[h]),M={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...S,repeat:_,parent:this},A=_!=null?new B.RepeatBlock(M):Z(M);A&&(this._blocks.push(A),p&&(this.exposeBlock=A),this._maskedBlocks[h]||(this._maskedBlocks[h]=[]),this._maskedBlocks[h].push(this._blocks.length-1)),l+=h.length-1;continue}}let o=s[l],i=o in e;if(o===z.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(o==="{"||o==="}"){n=!n;continue}if(o==="["||o==="]"){r=!r;continue}if(o===z.ESCAPE_CHAR){if(++l,o=s[l],!o)break;i=!1}const u=i?new pe({isOptional:r,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...oe(e[o]),parent:this}):new $e({char:o,eager:this.eager,isUnmasking:n});this._blocks.push(u)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e){this.reset();return}const{_blocks:s,...n}=e;this._blocks.forEach((r,l)=>r.state=s[l]),super.state=n}reset(){super.reset(),this._blocks.forEach(e=>e.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(e=>e.isComplete)}get isFilled(){return this._blocks.every(e=>e.isFilled)}get isFixed(){return this._blocks.every(e=>e.isFixed)}get isOptional(){return this._blocks.every(e=>e.isOptional)}doCommit(){this._blocks.forEach(e=>e.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((e,s)=>e+=s.unmaskedValue,"")}set unmaskedValue(e){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(s),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((e,s)=>e+=s.value,"")}set value(e){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(s),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(s),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce((e,s)=>e+=s.displayValue,"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const s=new v;let n=(e=this._mapPosToBlock(this.displayValue.length))==null?void 0:e.index;if(n==null)return s;this._blocks[n].isFilled&&++n;for(let r=n;r<this._blocks.length;++r){const l=this._blocks[r]._appendEager();if(!l.inserted)break;s.aggregate(l)}return s}_appendCharRaw(e,s){s===void 0&&(s={});const n=this._mapPosToBlock(this.displayValue.length),r=new v;if(!n)return r;for(let o=n.index,i;i=this._blocks[o];++o){var l;const u=i._appendChar(e,{...s,_beforeTailState:(l=s._beforeTailState)==null||(l=l._blocks)==null?void 0:l[o]});if(r.aggregate(u),u.consumed)break}return r}extractTail(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length);const n=new te;return e===s||this._forEachBlocksInRange(e,s,(r,l,o,i)=>{const u=r.extractTail(o,i);u.stop=this._findStopBefore(l),u.from=this._blockStartPos(l),u instanceof te&&(u.blockIndex=l),n.extend(u)}),n}extractInput(e,s,n){if(e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),n===void 0&&(n={}),e===s)return"";let r="";return this._forEachBlocksInRange(e,s,(l,o,i,u)=>{r+=l.extractInput(i,u,n)}),r}_findStopBefore(e){let s;for(let n=0;n<this._stops.length;++n){const r=this._stops[n];if(r<=e)s=r;else break}return s}_appendPlaceholder(e){const s=new v;if(this.lazy&&e==null)return s;const n=this._mapPosToBlock(this.displayValue.length);if(!n)return s;const r=n.index,l=e??this._blocks.length;return this._blocks.slice(r,l).forEach(o=>{if(!o.lazy||e!=null){var i;s.aggregate(o._appendPlaceholder((i=o._blocks)==null?void 0:i.length))}}),s}_mapPosToBlock(e){let s="";for(let n=0;n<this._blocks.length;++n){const r=this._blocks[n],l=s.length;if(s+=r.displayValue,e<=s.length)return{index:n,offset:e-l}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce((s,n)=>s+=n.displayValue.length,0)}_forEachBlocksInRange(e,s,n){s===void 0&&(s=this.displayValue.length);const r=this._mapPosToBlock(e);if(r){const l=this._mapPosToBlock(s),o=l&&r.index===l.index,i=r.offset,u=l&&o?l.offset:this._blocks[r.index].displayValue.length;if(n(this._blocks[r.index],r.index,i,u),l&&!o){for(let c=r.index+1;c<l.index;++c)n(this._blocks[c],c,0,this._blocks[c].displayValue.length);n(this._blocks[l.index],l.index,0,l.offset)}}}remove(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length);const n=super.remove(e,s);return this._forEachBlocksInRange(e,s,(r,l,o,i)=>{n.aggregate(r.remove(o,i))}),n}nearestInputPos(e,s){if(s===void 0&&(s=E.NONE),!this._blocks.length)return 0;const n=new to(this,e);if(s===E.NONE)return n.pushRightBeforeInput()||(n.popState(),n.pushLeftBeforeInput())?n.pos:this.displayValue.length;if(s===E.LEFT||s===E.FORCE_LEFT){if(s===E.LEFT){if(n.pushRightBeforeFilled(),n.ok&&n.pos===e)return e;n.popState()}if(n.pushLeftBeforeInput(),n.pushLeftBeforeRequired(),n.pushLeftBeforeFilled(),s===E.LEFT){if(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.ok&&n.pos<=e||(n.popState(),n.ok&&n.pos<=e))return n.pos;n.popState()}return n.ok?n.pos:s===E.FORCE_LEFT?0:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:0)}return s===E.RIGHT||s===E.FORCE_RIGHT?(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.pushRightBeforeFilled()?n.pos:s===E.FORCE_RIGHT?this.displayValue.length:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:this.nearestInputPos(e,E.LEFT))):e}totalInputPositions(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length);let n=0;return this._forEachBlocksInRange(e,s,(r,l,o,i)=>{n+=r.totalInputPositions(o,i)}),n}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const s=this._maskedBlocks[e];return s?s.map(n=>this._blocks[n]):[]}pad(e){const s=new v;return this._forEachBlocksInRange(0,this.displayValue.length,n=>s.aggregate(n.pad(e))),s}}z.DEFAULTS={...O.DEFAULTS,lazy:!0,placeholderChar:"_"},z.STOP_CHAR="`",z.ESCAPE_CHAR="\\",z.InputDefinition=pe,z.FixedDefinition=$e,B.MaskedPattern=z;class he extends z{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:s=this.to||0,from:n=this.from||0,maxLength:r=this.maxLength||0,autofix:l=this.autofix,...o}=e;this.to=s,this.from=n,this.maxLength=Math.max(String(s).length,r),this.autofix=l;const i=String(this.from).padStart(this.maxLength,"0"),u=String(this.to).padStart(this.maxLength,"0");let c=0;for(;c<u.length&&u[c]===i[c];)++c;o.mask=u.slice(0,c).replace(/0/g,"\\0")+"0".repeat(this.maxLength-c),super._update(o)}get isComplete(){return super.isComplete&&!!this.value}boundaries(e){let s="",n="";const[,r,l]=e.match(/^(\D*)(\d*)(\D*)/)||[];return l&&(s="0".repeat(r.length)+l,n="9".repeat(r.length)+l),s=s.padEnd(this.maxLength,"0"),n=n.padEnd(this.maxLength,"9"),[s,n]}doPrepareChar(e,s){s===void 0&&(s={});let n;return[e,n]=super.doPrepareChar(e.replace(/\D/g,""),s),e||(n.skip=!this.isComplete),[e,n]}_appendCharRaw(e,s){if(s===void 0&&(s={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,s);const n=String(this.from).padStart(this.maxLength,"0"),r=String(this.to).padStart(this.maxLength,"0"),[l,o]=this.boundaries(this.value+e);return Number(o)<this.from?super._appendCharRaw(n[this.value.length],s):Number(l)>this.to?!s.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(n[this.value.length],s).aggregate(this._appendCharRaw(e,s)):super._appendCharRaw(r[this.value.length],s):super._appendCharRaw(e,s)}doValidate(e){const s=this.value;if(s.search(/[^0]/)===-1&&s.length<=this._matchFrom)return!0;const[r,l]=this.boundaries(s);return this.from<=Number(l)&&Number(r)<=this.to&&super.doValidate(e)}pad(e){const s=new v;if(this.value.length===this.maxLength)return s;const n=this.value,r=this.maxLength-this.value.length;if(r){this.reset();for(let l=0;l<r;++l)s.aggregate(super._appendCharRaw("0",e));n.split("").forEach(l=>this._appendCharRaw(l))}return s}}B.MaskedRange=he;const so="d{.}`m{.}`Y";class J extends z{static extractPatternOptions(e){const{mask:s,pattern:n,...r}=e;return{...r,mask:ee(s)?s:n}}constructor(e){super(J.extractPatternOptions({...J.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:s,pattern:n,blocks:r,...l}={...J.DEFAULTS,...e},o=Object.assign({},J.GET_DEFAULT_BLOCKS());e.min&&(o.Y.from=e.min.getFullYear()),e.max&&(o.Y.to=e.max.getFullYear()),e.min&&e.max&&o.Y.from===o.Y.to&&(o.m.from=e.min.getMonth()+1,o.m.to=e.max.getMonth()+1,o.m.from===o.m.to&&(o.d.from=e.min.getDate(),o.d.to=e.max.getDate())),Object.assign(o,this.blocks,r),super._update({...l,mask:ee(s)?s:n,blocks:o})}doValidate(e){const s=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&s!=null&&(this.min==null||this.min<=s)&&(this.max==null||s<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(J.extractPatternOptions(e))}}J.GET_DEFAULT_BLOCKS=()=>({d:{mask:he,from:1,to:31,maxLength:2},m:{mask:he,from:1,to:12,maxLength:2},Y:{mask:he,from:1900,to:9999}}),J.DEFAULTS={...z.DEFAULTS,mask:Date,pattern:so,format:(a,e)=>{if(!a)return"";const s=String(a.getDate()).padStart(2,"0"),n=String(a.getMonth()+1).padStart(2,"0"),r=a.getFullYear();return[s,n,r].join(".")},parse:(a,e)=>{const[s,n,r]=a.split(".").map(Number);return new Date(r,n-1,s)}},B.MaskedDate=J;class me extends O{constructor(e){super({...me.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map(s=>{const{expose:n,...r}=oe(s),l=Z({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...r});return n&&(this.exposeMask=l),l}):[])}_appendCharRaw(e,s){s===void 0&&(s={});const n=this._applyDispatch(e,s);return this.currentMask&&n.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(s))),n}_applyDispatch(e,s,n){e===void 0&&(e=""),s===void 0&&(s={}),n===void 0&&(n="");const r=s.tail&&s._beforeTailState!=null?s._beforeTailState._value:this.value,l=this.rawInputValue,o=s.tail&&s._beforeTailState!=null?s._beforeTailState._rawInputValue:l,i=l.slice(o.length),u=this.currentMask,c=new v,d=u?.state;return this.currentMask=this.doDispatch(e,{...s},n),this.currentMask&&(this.currentMask!==u?(this.currentMask.reset(),o&&(this.currentMask.append(o,{raw:!0}),c.tailShift=this.currentMask.value.length-r.length),i&&(c.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):d&&(this.currentMask.state=d)),c}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const s=new v;return e&&s.aggregate(this._applyDispatch("",{},e)),s.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var s,n;return{...e,_beforeTailState:((s=e._beforeTailState)==null?void 0:s.currentMaskRef)===this.currentMask&&((n=e._beforeTailState)==null?void 0:n.currentMask)||e._beforeTailState}}doDispatch(e,s,n){return s===void 0&&(s={}),n===void 0&&(n=""),this.dispatch(e,this,s,n)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,s){s===void 0&&(s={});let[n,r]=super.doPrepare(e,s);if(this.currentMask){let l;[n,l]=super.doPrepare(n,this.currentMaskFlags(s)),r=r.aggregate(l)}return[n,r]}doPrepareChar(e,s){s===void 0&&(s={});let[n,r]=super.doPrepareChar(e,s);if(this.currentMask){let l;[n,l]=super.doPrepareChar(n,this.currentMaskFlags(s)),r=r.aggregate(l)}return[n,r]}reset(){var e;(e=this.currentMask)==null||e.reset(),this.compiledMasks.forEach(s=>s.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask){this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,this._applyDispatch();return}let s=String(e);this.currentMask&&(this.currentMask.typedValue=e,s=this.currentMask.unmaskedValue),this.unmaskedValue=s}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return!!((e=this.currentMask)!=null&&e.isComplete)}get isFilled(){var e;return!!((e=this.currentMask)!=null&&e.isFilled)}remove(e,s){const n=new v;return this.currentMask&&n.aggregate(this.currentMask.remove(e,s)).aggregate(this._applyDispatch()),n}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(s=>s.state),currentMaskRef:this.currentMask,currentMask:(e=this.currentMask)==null?void 0:e.state}}set state(e){const{compiledMasks:s,currentMaskRef:n,currentMask:r,...l}=e;s&&this.compiledMasks.forEach((o,i)=>o.state=s[i]),n!=null&&(this.currentMask=n,this.currentMask.state=r),super.state=l}extractInput(e,s,n){return this.currentMask?this.currentMask.extractInput(e,s,n):""}extractTail(e,s){return this.currentMask?this.currentMask.extractTail(e,s):super.extractTail(e,s)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,s){return this.currentMask?this.currentMask.nearestInputPos(e,s):super.nearestInputPos(e,s)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every((s,n)=>{if(!e[n])return;const{mask:r,...l}=e[n];return we(s,l)&&s.maskEquals(r)}):super.maskEquals(e)}typedValueEquals(e){var s;return!!((s=this.currentMask)!=null&&s.typedValueEquals(e))}}me.DEFAULTS={...O.DEFAULTS,dispatch:(a,e,s,n)=>{if(!e.compiledMasks.length)return;const r=e.rawInputValue,l=e.compiledMasks.map((o,i)=>{const u=e.currentMask===o,c=u?o.displayValue.length:o.nearestInputPos(o.displayValue.length,E.FORCE_LEFT);return o.rawInputValue!==r?(o.reset(),o.append(r,{raw:!0})):u||o.remove(c),o.append(a,e.currentMaskFlags(s)),o.appendTail(n),{index:i,weight:o.rawInputValue.length,totalInputPositions:o.totalInputPositions(0,Math.max(c,o.nearestInputPos(o.displayValue.length,E.FORCE_LEFT)))}});return l.sort((o,i)=>i.weight-o.weight||i.totalInputPositions-o.totalInputPositions),e.compiledMasks[l[0].index]}},B.MaskedDynamic=me;class fe extends z{constructor(e){super({...fe.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:s,...n}=e;if(s){const r=s.map(i=>i.length),l=Math.min(...r),o=Math.max(...r)-l;n.mask="*".repeat(l),o&&(n.mask+="["+"*".repeat(o)+"]"),this.enum=s}super._update(n)}_appendCharRaw(e,s){s===void 0&&(s={});const n=Math.min(this.nearestInputPos(0,E.FORCE_RIGHT),this.value.length),r=this.enum.filter(l=>this.matchValue(l,this.unmaskedValue+e,n));if(r.length){r.length===1&&this._forEachBlocksInRange(0,this.value.length,(o,i)=>{const u=r[0][i];i>=this.value.length||u===o.value||(o.reset(),o._appendChar(u,s))});const l=super._appendCharRaw(r[0][this.value.length],s);return r.length===1&&r[0].slice(this.unmaskedValue.length).split("").forEach(o=>l.aggregate(super._appendCharRaw(o))),l}return new v({skip:!this.isComplete})}extractTail(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),new Y("",e)}remove(e,s){if(e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),e===s)return new v;const n=Math.min(super.nearestInputPos(0,E.FORCE_RIGHT),this.value.length);let r;for(r=e;r>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(n,r),n)).length>1);--r);const l=super.remove(r,s);return l.tailShift+=r-e,l}get isComplete(){return this.enum.indexOf(this.value)>=0}}fe.DEFAULTS={...z.DEFAULTS,matchValue:(a,e,s)=>a.indexOf(e,s)===s},B.MaskedEnum=fe;class ft extends O{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}B.MaskedFunction=ft;var gt;class H extends O{constructor(e){super({...H.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),s="\\d*",n=(this.scale?"("+Me(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+s+n),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Me).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Me(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const s=e.split(this.radix);return s[0]=s[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),s.join(this.radix)}doPrepareChar(e,s){s===void 0&&(s={});const[n,r]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(s.input&&s.raw||!s.input&&!s.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),s);return e&&!n&&(r.skip=!0),n&&!this.allowPositive&&!this.value&&n!=="-"&&r.aggregate(this._appendChar("-")),[n,r]}_separatorsCount(e,s){s===void 0&&(s=!1);let n=0;for(let r=0;r<e;++r)this._value.indexOf(this.thousandsSeparator,r)===r&&(++n,s&&(e+=this.thousandsSeparator.length));return n}_separatorsCountFromSlice(e){return e===void 0&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,s,n){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),[e,s]=this._adjustRangeWithSeparators(e,s),this._removeThousandsSeparators(super.extractInput(e,s,n))}_appendCharRaw(e,s){s===void 0&&(s={});const n=s.tail&&s._beforeTailState?s._beforeTailState._value:this._value,r=this._separatorsCountFromSlice(n);this._value=this._removeThousandsSeparators(this.value);const l=this._value;this._value+=e;const o=this.number;let i=!isNaN(o),u=!1;if(i){let p;this.min!=null&&this.min<0&&this.number<this.min&&(p=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(p=this.max),p!=null&&(this.autofix?(this._value=this.format(p,this).replace(H.UNMASKED_RADIX,this.radix),u||(u=l===this._value&&!s.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let c;i?c=new v({inserted:this._value.slice(l.length),rawInserted:u?"":e,skip:u}):(this._value=l,c=new v),this._value=this._insertThousandsSeparators(this._value);const d=s.tail&&s._beforeTailState?s._beforeTailState._value:this._value,h=this._separatorsCountFromSlice(d);return c.tailShift+=(h-r)*this.thousandsSeparator.length,c}_findSeparatorAround(e){if(this.thousandsSeparator){const s=e-this.thousandsSeparator.length+1,n=this.value.indexOf(this.thousandsSeparator,s);if(n<=e)return n}return-1}_adjustRangeWithSeparators(e,s){const n=this._findSeparatorAround(e);n>=0&&(e=n);const r=this._findSeparatorAround(s);return r>=0&&(s=r+this.thousandsSeparator.length),[e,s]}remove(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),[e,s]=this._adjustRangeWithSeparators(e,s);const n=this.value.slice(0,e),r=this.value.slice(s),l=this._separatorsCount(n.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(n+r));const o=this._separatorsCountFromSlice(n);return new v({tailShift:(o-l)*this.thousandsSeparator.length})}nearestInputPos(e,s){if(!this.thousandsSeparator)return e;switch(s){case E.NONE:case E.LEFT:case E.FORCE_LEFT:{const n=this._findSeparatorAround(e-1);if(n>=0){const r=n+this.thousandsSeparator.length;if(e<r||this.value.length<=r||s===E.FORCE_LEFT)return n}break}case E.RIGHT:case E.FORCE_RIGHT:{const n=this._findSeparatorAround(e);if(n>=0)return n+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let s=e;this.min!=null&&(s=Math.max(s,this.min)),this.max!=null&&(s=Math.min(s,this.max)),s!==e&&(this.unmaskedValue=this.format(s,this));let n=this.value;this.normalizeZeros&&(n=this._normalizeZeros(n)),this.padFractionalZeros&&this.scale>0&&(n=this._padFractionalZeros(n)),this._value=n}super.doCommit()}_normalizeZeros(e){const s=this._removeThousandsSeparators(e).split(this.radix);return s[0]=s[0].replace(/^(\D*)(0*)(\d*)/,(n,r,l,o)=>r+o),e.length&&!/\d$/.test(s[0])&&(s[0]=s[0]+"0"),s.length>1&&(s[1]=s[1].replace(/0*$/,""),s[1].length||(s.length=1)),this._insertThousandsSeparators(s.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const s=e.split(this.radix);return s.length<2&&s.push(""),s[1]=s[1].padEnd(this.scale,"0"),s.join(this.radix)}doSkipInvalid(e,s,n){s===void 0&&(s={});const r=this.scale===0&&e!==this.thousandsSeparator&&(e===this.radix||e===H.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,s,n)&&!r}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,H.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(H.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(e){return(super.typedValueEquals(e)||H.EMPTY_VALUES.includes(e)&&H.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}gt=H,H.UNMASKED_RADIX=".",H.EMPTY_VALUES=[...O.EMPTY_VALUES,0],H.DEFAULTS={...O.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[gt.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:a=>a.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},B.MaskedNumber=H;const Ce={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function De(a,e,s){e===void 0&&(e=Ce.MASKED),s===void 0&&(s=Ce.MASKED);const n=Z(a);return r=>n.runIsolated(l=>(l[e]=r,l[s]))}function kt(a,e,s,n){return De(e,s,n)(a)}B.PIPE_TYPE=Ce,B.createPipe=De,B.pipe=kt;class bt extends z{get repeatFrom(){var e;return(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?e:0}get repeatTo(){var e;return(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var s,n,r;const{repeat:l,...o}=oe(e);this._blockOpts=Object.assign({},this._blockOpts,o);const i=Z(this._blockOpts);this.repeat=(s=(n=l??i.repeat)!=null?n:this.repeat)!=null?s:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((r=this._blocks)==null?void 0:r.length)||0,this.repeatFrom)),blocks:{m:i},eager:i.eager,overwrite:i.overwrite,skipInvalid:i.skipInvalid,lazy:i.lazy,placeholderChar:i.placeholderChar,displayChar:i.displayChar})}_allocateBlock(e){if(e<this._blocks.length)return this._blocks[e];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(Z(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(e,s){s===void 0&&(s={});const n=new v;for(let u=(r=(l=this._mapPosToBlock(this.displayValue.length))==null?void 0:l.index)!=null?r:Math.max(this._blocks.length-1,0),c,d;c=(o=this._blocks[u])!=null?o:d=!d&&this._allocateBlock(u);++u){var r,l,o,i;const h=c._appendChar(e,{...s,_beforeTailState:(i=s._beforeTailState)==null||(i=i._blocks)==null?void 0:i[u]});if(h.skip&&d){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(n.aggregate(h),h.consumed)break}return n}_trimEmptyTail(e,s){var n,r;e===void 0&&(e=0);const l=Math.max(((n=this._mapPosToBlock(e))==null?void 0:n.index)||0,this.repeatFrom,0);let o;s!=null&&(o=(r=this._mapPosToBlock(s))==null?void 0:r.index),o==null&&(o=this._blocks.length-1);let i=0;for(let u=o;l<=u&&!this._blocks[u].unmaskedValue;--u,++i);i&&(this._blocks.splice(o-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length);const n=super.remove(e,s);return this._trimEmptyTail(e,s),n}totalInputPositions(e,s){return e===void 0&&(e=0),s==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,s)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}}B.RepeatBlock=bt;try{globalThis.IMask=B}catch{}const no=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:v,ChunksTailDetails:te,DIRECTION:E,HTMLContenteditableMaskElement:Ae,HTMLInputMaskElement:pt,HTMLMaskElement:ce,InputMask:ht,MaskElement:Ee,Masked:O,MaskedDate:J,MaskedDynamic:me,MaskedEnum:fe,MaskedFunction:ft,MaskedNumber:H,MaskedPattern:z,MaskedRange:he,MaskedRegExp:mt,PIPE_TYPE:Ce,PatternFixedDefinition:$e,PatternInputDefinition:pe,RepeatBlock:bt,createMask:Z,createPipe:De,default:B,forceDirection:ut,normalizeOpts:oe,pipe:kt},Symbol.toStringTag,{value:"Module"}));I.ModalEdit=Je,I.VForm=de,I.VsInputCheckbox=je,I.VsInputContainer=Ye,I.VsInputDate=Ue,I.VsInputEmail=ze,I.VsInputFile=Ge,I.VsInputFileList=Ke,I.VsInputMask=Oe,I.VsInputNumber=Te,I.VsInputRadio=Fe,I.VsInputSelect=We,I.VsInputStatic=Ne,I.VsInputSwitcher=Se,I.VsInputTag=st,I.VsInputText=ve,I.VsInputTextarea=Xe,I.default=de,I.inputs=nt,I.vsInputDatatable=et,I.vsInputMap=tt,Object.defineProperties(I,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(I,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@opengis/core")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core"],t):(I=typeof globalThis<"u"?globalThis:I||self,t(I.FormBuilder={},I.Vue,I.OpenGISCore))})(this,function(I,t,Z){"use strict";const wt={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},Et={class:"opacity-100"},Vt={key:0,class:"text-red-500 text-[14px]"},Ct={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Bt=t.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""}},setup(a){const e=t.ref("uk"),s=n=>{n.detail.key==="locale"&&(e.value=n.detail.newValue)};return t.onMounted(()=>{e.value=localStorage.locale,window.addEventListener("storage",s)}),t.onUnmounted(()=>{window.removeEventListener("resize",s)}),(n,l)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["w-full relative",{"opacity-60":n.item.disabled}])},[n.ua||n.label?(t.openBlock(),t.createElementBlock("div",wt,[t.createElementVNode("span",Et,t.toDisplayString(n.item[e.value]||n.ua||n.label),1),n.item?.rules?.includes("required")?(t.openBlock(),t.createElementBlock("span",Vt,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.renderSlot(n.$slots,"default",t.normalizeProps(t.guardReactiveProps(n.$attrs))),n.error?(t.openBlock(),t.createElementBlock("span",Ct,t.toDisplayString(n.error),1)):t.createCommentVNode("",!0)],2))}}),vt={class:"w-full relative flex flex-row items-center gap-2"},St={key:0,class:"text-sm text-gray-900 font-medium flex shrink-0 w-3/12 max-w-[250px]"},Ft={key:0,class:"text-red-500 text-[14px]"},Nt={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},At=t.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""}},setup(a){return(e,s)=>(t.openBlock(),t.createElementBlock("div",vt,[e.item?.type!=="html"?(t.openBlock(),t.createElementBlock("span",St,[t.createTextVNode(t.toDisplayString(e.ua||e.label)+" ",1),e.item?.rules?.includes("required")&&(e.ua||e.label)?(t.openBlock(),t.createElementBlock("span",Ft,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"default",t.normalizeProps(t.guardReactiveProps(e.$attrs))),e.error?(t.openBlock(),t.createElementBlock("span",Nt,t.toDisplayString(e.error),1)):t.createCommentVNode("",!0)]))}}),Mt={class:"w-full relative"},$t={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Dt={default:Bt,horizontal:At,inline:t.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""}},setup(a){return(e,s)=>(t.openBlock(),t.createElementBlock("div",Mt,[t.renderSlot(e.$slots,"default",t.normalizeProps(t.guardReactiveProps(e.$attrs))),e.error?(t.openBlock(),t.createElementBlock("span",$t,t.toDisplayString(e.error),1)):t.createCommentVNode("",!0)]))}})};function Q(a){return{inputClass:t.computed(()=>{const s=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${a?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return a?.size==="sm"?`${s}h-[32px]`:`${s}h-[38px]`})}}const It=["placeholder","disabled"],ve=t.defineComponent({__name:"vs-input-text",props:t.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,{inputClass:s}=Q(e.style),n=t.useModel(a,"modelValue");return(l,r)=>t.withDirectives((t.openBlock(),t.createElementBlock("input",{type:"text","onUpdate:modelValue":r[0]||(r[0]=o=>n.value=o),placeholder:l.placeholder,disabled:l.disabled,class:t.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f]",[t.unref(s),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,It)),[[t.vModelText,n.value]])}}),Lt=["placeholder"],Te=t.defineComponent({__name:"vs-input-number",props:t.mergeModels({style:{default:()=>({})},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,{inputClass:s}=Q(e.style),n=t.useModel(a,"modelValue");return(l,r)=>t.withDirectives((t.openBlock(),t.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":r[0]||(r[0]=o=>n.value=o),placeholder:l.placeholder,class:t.normalizeClass(["py-1.5 px-3 block w-full",[t.unref(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,Lt)),[[t.vModelText,n.value]])}}),D=(a,e)=>{const s=a.__vccOpts||a;for(const[n,l]of e)s[n]=l;return s},Tt={},Rt={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function Ot(a,e){return t.openBlock(),t.createElementBlock("svg",Rt,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const zt=D(Tt,[["render",Ot]]),jt={class:"flex items-center gap-[4px]"},Ut=["value","id","disabled"],Pt=["for"],Ht={class:"text-[14px] text-gray-700 flex items-center gap-x-1 ml-1 dark:text-neutral-400"},qt=t.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(a,{emit:e}){const s=e,n=a,l=t.computed({get:()=>n.modelValue,set:r=>s("update:modelValue",r)});return(r,o)=>(t.openBlock(),t.createElementBlock("div",jt,[t.withDirectives(t.createElementVNode("input",{type:"checkbox",value:r.value,"onUpdate:modelValue":o[0]||(o[0]=i=>l.value=i),class:t.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":r.disabled}]),id:r.id,disabled:r.disabled},null,10,Ut),[[t.vModelCheckbox,l.value]]),t.createElementVNode("label",{for:r.id,class:t.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":r.disabled}])},[t.createElementVNode("div",{class:t.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[l.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",r.error?"border-red-600":""]])},[t.createVNode(zt,{height:"12",width:"12"})],2),t.createElementVNode("span",Ht,[t.renderSlot(r.$slots,"default",{},()=>[t.createTextVNode(t.toDisplayString(r.label),1)])])],10,Pt)]))}}),Gt=["name","value","disabled"],Kt={class:"flex items-center gap-[6px] text-[14px]"},Zt={key:0,class:"text-[16px]"},Yt=["src"],Jt=t.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(a,{emit:e}){const s=a,n=e,l=t.computed({get:()=>s.modelValue,set:i=>{n("update:modelValue",i)}}),r=t.computed(()=>Array.isArray(l.value)?l.value.includes(s.value):l.value===!0||l.value===s.value),o=t.computed(()=>s.style?.size==="xs"?"p-1.5 text-xs":s.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(i,u)=>(t.openBlock(),t.createElementBlock("label",{class:t.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[o.value,r.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[t.withDirectives(t.createElementVNode("input",{type:"checkbox",class:"hidden",name:i.id,value:i.value,"onUpdate:modelValue":u[0]||(u[0]=c=>l.value=c),disabled:i.disabled},null,8,Gt),[[t.vModelCheckbox,l.value]]),t.createElementVNode("span",Kt,[i.icon||i.imgUrl?(t.openBlock(),t.createElementBlock("span",Zt,[i.icon?(t.openBlock(),t.createElementBlock("i",{key:0,class:t.normalizeClass(i.icon)},null,2)):t.createCommentVNode("",!0),i.imgUrl?(t.openBlock(),t.createElementBlock("img",{key:1,src:i.imgUrl,width:"16",height:"16",alt:"icon"},null,8,Yt)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.renderSlot(i.$slots,"default",{},()=>[t.createTextVNode(t.toDisplayString(i.label),1)])])],2))}}),Wt={class:"flex items-center"},Re=t.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(a,{emit:e}){const s=a,n=e,l=`radio-${Math.floor(Math.random()*1e4)}`,r=t.computed({get:()=>Array.isArray(s.modelValue)?Array.isArray(s.modelValue)&&s.modelValue.includes(s.value):s.modelValue,set:i=>{if(Array.isArray(s.modelValue)){let u=[...s.modelValue];i?u.includes(s.value)||u.push(s.value):u=u.filter(c=>c!==s.value),n("update:modelValue",u)}else n("update:modelValue",i)}}),o=t.ref(`vs-checkbox-${s.view||"default"}`);return(i,u)=>(t.openBlock(),t.createElementBlock("div",Wt,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(o.value==="vs-checkbox-buttons"?t.unref(Jt):t.unref(qt)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:r.value,"onUpdate:modelValue":u[0]||(u[0]=c=>r.value=c),id:l,icon:i.icon,imgUrl:i.imgUrl,style:t.normalizeStyle(i.style),error:i.error},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),Xt={},Qt={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function es(a,e){return t.openBlock(),t.createElementBlock("svg",Qt,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const ts=D(Xt,[["render",es]]),ss={},ns={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function ls(a,e){return t.openBlock(),t.createElementBlock("svg",ns,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M12 9h.01"},null,-1),t.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),t.createElementVNode("path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z"},null,-1)]))}const rs=D(ss,[["render",ls]]),as={key:0,class:"flex items-start gap-x-1"},os={key:0,class:"text-red-500 text-[14px]"},is=["title"],us=["disabled"],Se=t.defineComponent({__name:"vs-input-switcher",props:t.mergeModels({rules:{default:()=>[]},view:{default:"checkbox"},label:{default:""},i:{default:""},text:{default:""},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,s=t.useModel(a,"modelValue");return(n,l)=>e.view==="checkbox"?(t.openBlock(),t.createElementBlock("div",as,[t.createVNode(Re,{modelValue:s.value,"onUpdate:modelValue":l[0]||(l[0]=r=>s.value=r),label:n.text,error:n.error||""},null,8,["modelValue","label","error"]),n.rules?.includes("required")?(t.openBlock(),t.createElementBlock("span",os,"*")):t.createCommentVNode("",!0),n.i?(t.openBlock(),t.createElementBlock("button",{key:1,class:"cursor-pointer",title:n.i,onClick:l[1]||(l[1]=t.withModifiers(()=>{},["prevent"]))},[t.createVNode(t.unref(rs),{class:"text-gray-500 w-[14px] h-[14px]"})],8,is)):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[s.value?`bg-${n.style?.primaryColor||"blue"}-500`:"bg-stone-200",n.customClass]]),disabled:n.disabled,onClick:l[2]||(l[2]=r=>s.value=!s.value)},[t.createElementVNode("span",{"data-state":"checked",class:t.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[s.value?"translate-x-4":"translate-x-0"]])},null,2)],10,us))}}),ds=["innerHTML"],Fe=t.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(a){return(e,s)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(e.customClass),innerHTML:e.html?e.html:e.text},null,10,ds))}}),cs=["placeholder","disabled","name"],Oe=t.defineComponent({__name:"vs-input-mask",props:t.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,{inputClass:s}=Q(e.style),n=t.useModel(a,"modelValue"),l=t.ref(null);let r=null;return t.onMounted(async()=>{if(l.value){const{default:o}=await Promise.resolve().then(()=>Xa);r=o(l.value,{mask:e.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),r.on("accept",()=>{n.value=e.unmask?r.unmaskedValue:r.value}),r.on("complete",()=>{n.value=e.unmask?r.unmaskedValue:r.value}),r.value=n.value??""}}),t.onBeforeUnmount(()=>{r?.destroy()}),t.watch(()=>e.mask,o=>{r&&r.updateOptions({mask:o,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),t.watch(n,o=>{r&&r.unmaskedValue!==o&&(r.value=o||"")}),(o,i)=>(t.openBlock(),t.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:l,placeholder:o.placeholder,disabled:o.disabled,name:o.name,class:t.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f]",[t.unref(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,cs))}}),ps={class:"relative w-full bg-white rounded-lg"},hs=["placeholder","disabled"],ze=t.defineComponent({__name:"vs-input-email",props:t.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,{inputClass:s}=Q(e.style),n=t.useModel(a,"modelValue");return(l,r)=>(t.openBlock(),t.createElementBlock("div",ps,[r[1]||(r[1]=t.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),t.withDirectives(t.createElementVNode("input",{type:"email","onUpdate:modelValue":r[0]||(r[0]=o=>n.value=o),placeholder:l.placeholder,disabled:l.disabled,class:t.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f]",[t.unref(s),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,hs),[[t.vModelText,n.value]])]))}}),ms=["value","disabled"],fs={class:"text-[13px] text-gray-700"},gs=t.defineComponent({__name:"vs-input-radio-default",props:t.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=t.useModel(a,"modelValue");return(s,n)=>(t.openBlock(),t.createElementBlock("label",{class:t.normalizeClass(["flex items-center gap-0",[s.customClass]])},[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":n[0]||(n[0]=l=>e.value=l),type:"radio",value:s.value,disabled:s.disabled,class:"hidden"},null,8,ms),[[t.vModelRadio,e.value]]),t.createElementVNode("span",{class:t.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${s.style?.primaryColor||"blue"}-500`,s.disabled?"opacity-50 cursor-not-allowed":""]])},[e.value==s.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${s.style?.primaryColor||"blue"}-500`]])},null,2)):t.createCommentVNode("",!0)],2),t.createElementVNode("span",fs,t.toDisplayString(s.text),1)],2))}}),ks=["value","disabled"],bs={class:"text-[13px] text-gray-700"},ys={"vs-input-radio-default":gs,"vs-input-radio-buttons":t.defineComponent({__name:"vs-input-radio-buttons",props:t.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=t.useModel(a,"modelValue");return(s,n)=>(t.openBlock(),t.createElementBlock("label",{class:t.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[e.value==s.value?`ring-2 ring-ring ring-${s.style?.primaryColor||"blue"}-500`:"",s.customClass]])},[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":n[0]||(n[0]=l=>e.value=l),type:"radio",value:s.value,disabled:s.disabled,class:"hidden"},null,8,ks),[[t.vModelRadio,e.value]]),t.createElementVNode("span",bs,t.toDisplayString(s.text),1)],2))}})},Ne=t.defineComponent({__name:"vs-input-radio",props:t.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,s=t.useModel(a,"modelValue"),n=t.computed(()=>ys[`vs-input-radio-${e.view}`]);return(l,r)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass([l.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.options,o=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(n.value),t.mergeProps({key:o?.id,text:o.text,value:o.id.toString(),checked:s.value===o.id,modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=i=>s.value=i)},{ref_for:!0},l.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),je=D(t.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(a,{emit:e}){const s=a,n=e,l=t.ref([]),r=t.reactive({}),o=d=>d?.value||d?.id||d?.text||d,i=d=>d.text||String(d),u=d=>`lg:col-span-${d||12}`,c=async()=>{try{const d=await fetch(`/api/suggest/${s.data}`).then(h=>h.json());l.value=d?.data||d}catch(d){console.error(d)}};return t.watch(()=>s.modelValue,d=>{if(typeof d=="boolean"&&l.value.length===1){const h=o(l.value[0]);r[h]=d}else if(Array.isArray(d)){const h=new Set(d);l.value.forEach(p=>{if(!p.disabled){const x=o(p);r[x]=h.has(x)}})}},{immediate:!0}),t.watch(r,()=>{if(!l.value.length){n("update:modelValue",null);return}const d=Object.entries(r).filter(([,h])=>h).map(([h])=>h);n("update:modelValue",d.length===0?[]:d)},{deep:!0}),t.onMounted(()=>{if(s.data)c().then(()=>{if(typeof s.modelValue=="boolean"&&l.value.length===1){const d=o(l.value[0]);r[d]=s.modelValue}else if(Array.isArray(s.modelValue)){const d=new Set(s.modelValue);l.value.forEach(h=>{if(!h.disabled){const p=o(h);r[p]=d.has(p)}})}});else if(l.value=s.options,typeof s.modelValue=="boolean"&&l.value.length===1){const d=o(l.value[0]);r[d]=s.modelValue}else if(Array.isArray(s.modelValue)){const d=new Set(s.modelValue);l.value.forEach(h=>{if(!h.disabled){const p=o(h);r[p]=d.has(p)}})}}),(d,h)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["p-0 w-full gap-[6px]",[d.position==="vertical"?"flex-col":"",d.colSpan?"grid":"flex justify-start"]])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,p=>(t.openBlock(),t.createBlock(Re,{modelValue:r[o(p)],"onUpdate:modelValue":x=>r[o(p)]=x,value:o(p),class:t.normalizeClass(u(d.colSpan)),disabled:p.disabled,label:i(p),key:o(p),icon:p?.icon,imgUrl:p?.imgUrl,option:p,view:d.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-91f3584a"]]),xs=["placeholder","disabled"],Ue=t.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},emits:["update:modelValue"],setup(a,{emit:e}){const s=a,{inputClass:n}=Q(s.style),l=e,r=t.computed({get:()=>s.modelValue?.split(" ")[0],set:o=>l("update:modelValue",o)});return(o,i)=>t.withDirectives((t.openBlock(),t.createElementBlock("input",{type:"date","onUpdate:modelValue":i[0]||(i[0]=u=>r.value=u),placeholder:o.placeholder,disabled:o.disabled,ref:"date",class:t.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f]",[o.modelValue?"":"text-opacity-50",t.unref(n)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,xs)),[[t.vModelText,r.value]])}}),_s=async(a,e,s,n)=>{try{const l=new FormData;return l.append("unique","true"),l.append("file",a),(await fetch(`/file/upload/uploads?id=${e||""}&form=${s||""}&table=${n||""}`,{method:"POST",body:l}).then(o=>o.json()))?.result}catch(l){return Z.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",l),null}},ws=async a=>{try{return await fetch(`file/delete${a}`),!0}catch(e){return console.error(e),!1}},Pe=async a=>{try{const e=await fetch(`file/download/files/uploads${a}`),s=await e.arrayBuffer(),n=e.headers["content-type"],l=new TextDecoder("utf-8").decode(s),r=new Blob([l],{type:n}),o=document.createElement("a");o.setAttribute("download",a),o.href=window.URL.createObjectURL(r),o.click()}catch(e){console.error(e.message)}},Es={},Vs={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Cs(a,e){return t.openBlock(),t.createElementBlock("svg",Vs,e[0]||(e[0]=[t.createElementVNode("path",{d:"M5 12h14"},null,-1),t.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const xe=D(Es,[["render",Cs]]),Bs={},vs={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-text",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function Ss(a,e,s,n,l,r){return t.openBlock(),t.createElementBlock("svg",vs,e[0]||(e[0]=[t.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><line x1="9" y1="9" x2="10" y2="9"></line><line x1="9" y1="13" x2="15" y2="13"></line><line x1="9" y1="17" x2="15" y2="17"></line>',6)]))}const Fs=D(Bs,[["render",Ss]]),Ns={},As={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-table",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function Ms(a,e,s,n,l,r){return t.openBlock(),t.createElementBlock("svg",As,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),t.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),t.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const $s=D(Ns,[["render",Ms]]),Ds={},Is={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file-unknown"};function Ls(a,e,s,n,l,r){return t.openBlock(),t.createElementBlock("svg",Is,e[0]||(e[0]=[t.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M12 17v.01"></path><path d="M12 14a1.5 1.5 0 1 0 -1.14 -2.474"></path>',5)]))}const Ts=D(Ds,[["render",Ls]]),Rs={},Os={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-zip",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function zs(a,e,s,n,l,r){return t.openBlock(),t.createElementBlock("svg",Os,e[0]||(e[0]=[t.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1"></path><path d="M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2z"></path><line x1="11" y1="5" x2="10" y2="5"></line><line x1="13" y1="7" x2="12" y2="7"></line><line x1="11" y1="9" x2="10" y2="9"></line><line x1="13" y1="11" x2="12" y2="11"></line><line x1="11" y1="13" x2="10" y2="13"></line><line x1="13" y1="15" x2="12" y2="15"></line>',9)]))}const js=D(Rs,[["render",zs]]),Us={},Ps={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-code",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function Hs(a,e,s,n,l,r){return t.openBlock(),t.createElementBlock("svg",Ps,e[0]||(e[0]=[t.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M10 13l-1 2l1 2"></path><path d="M14 13l1 2l-1 2"></path>',5)]))}const qs=D(Us,[["render",Hs]]),Gs=a=>{if(!a)return"";const e=a?.split(".");return e[e.length-1]},Ks=a=>{const e=Gs(a),s={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return s.imageFormat.includes(e)?"img":s.sheetsFormat.includes(e)?$s:s.textsFormat.includes(e)?qs:s.documentsFormat.includes(e)?Fs:s.archivesFormat.includes(e)?js:Ts},Zs={},Ys={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function Js(a,e){return t.openBlock(),t.createElementBlock("svg",Ys,e[0]||(e[0]=[t.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const _e=D(Zs,[["render",Js]]),Ws={},Xs={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function Qs(a,e){return t.openBlock(),t.createElementBlock("svg",Xs,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),t.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),t.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const He=D(Ws,[["render",Qs]]),en={class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},tn={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},qe=D(t.defineComponent({__name:"vs-input-file-list-item",props:t.mergeModels({format:{},multiple:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(a){const e=t.useModel(a,"value"),s=t.useModel(a,"item"),n=a;return(l,r)=>(t.openBlock(),t.createElementBlock("div",en,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Ks)(s.value)),{src:s.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:r[0]||(r[0]=o=>t.unref(Pe)(s.value))},null,8,["src"])),t.createElementVNode("div",tn,[t.createElementVNode("button",{type:"button",onClick:r[1]||(r[1]=o=>{t.unref(ws)(s.value),e.value=n.multiple?e.value?.filter(i=>i!==s.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[t.createVNode(_e,{class:"w-4 h-4"})]),t.createElementVNode("button",{type:"button",onClick:r[2]||(r[2]=o=>t.unref(Pe)(s.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[t.createVNode(He,{class:"w-4 h-4"})])])]))}}),[["__scopeId","data-v-0ca886b3"]]),sn={class:"flex items-center gap-x-2"},nn={key:1,class:"flex items-center flex-wrap gap-2"},Ge=t.defineComponent({__name:"vs-input-file",props:t.mergeModels({format:{},multiple:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,s=t.useModel(a,"modelValue"),n=t.ref(null),l=o=>Array.isArray(s.value)&&s.value[o]||"",r=async o=>{if(e.format){const c=o.target.files?.[0];if(!c||!c.name.endsWith(e.format))return}const i=o.target.files?.[0];if(!i)return;const u=await _s(i,"1","form","table");s.value=e.multiple?[...s.value||[],u?.file_path]:u?.file_path};return(o,i)=>(t.openBlock(),t.createElementBlock("div",sn,[t.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:n,type:"file",onChange:r},null,544),!o.multiple&&s.value?(t.openBlock(),t.createBlock(qe,{key:0,item:s.value,"onUpdate:item":i[0]||(i[0]=u=>s.value=u),value:s.value,"onUpdate:value":i[1]||(i[1]=u=>s.value=u)},null,8,["item","value"])):o.multiple?(t.openBlock(),t.createElementBlock("div",nn,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,(u,c)=>(t.openBlock(),t.createBlock(qe,{multiple:o.multiple,key:c,value:s.value,"onUpdate:value":i[2]||(i[2]=d=>s.value=d),item:l(c)},null,8,["multiple","value","item"]))),128)),t.createElementVNode("div",{onClick:i[3]||(i[3]=u=>!o.disabled&&n.value?.click()),class:t.normalizeClass(["h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",o.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[t.createVNode(xe,{class:"w-6 h-6"})],2)])):t.createCommentVNode("",!0),o.multiple?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:2,onClick:i[4]||(i[4]=u=>n.value?.click()),class:t.normalizeClass([o.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[t.createVNode(xe,{class:"w-6 h-6"})],2))]))}}),ln={class:"max-w-[55vw]"},rn={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},an={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},on={class:"px-[5px]"},un={class:""},we=t.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(a){const e=a,s=t.computed(()=>{try{return new Date(e.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function n(l){if(l<1024)return`${l} B`;const r=l/1024;return r<1024?`${r.toFixed(2)} KB`:`${(r/1024).toFixed(2)} MB`}return(l,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[r[1]||(r[1]=t.createStaticVNode('<div class="flex items-center justify-center h-[30px] w-[30px]"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path></svg></div>',1)),t.createElementVNode("div",ln,[t.createElementVNode("p",rn,t.toDisplayString(l.item?.uploaded_name),1),t.createElementVNode("p",an,[t.createElementVNode("span",null,t.toDisplayString(l.item?.username),1),t.withDirectives(t.createElementVNode("span",on,"|",512),[[t.vShow,l.item?.username]]),t.createElementVNode("span",null,t.toDisplayString(s.value),1),r[0]||(r[0]=t.createElementVNode("span",{class:"px-[5px]"},"|",-1)),t.createElementVNode("span",un,t.toDisplayString(n(l.item?.size)),1)])])],64))}}),dn={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},cn={key:0,class:"flex w-full gap-x-3 items-center"},pn={key:1,class:"flex gap-x-3 w-full items-center"},hn={key:2,class:"flex gap-x-3 w-full items-center"},mn=["href"],fn={key:3,class:"flex gap-x-3 w-full items-center"},gn={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},kn={class:"p-0.5 sm:p-1 inline-flex items-center gap-0.5 bg-white rounded-lg dark:bg-neutral-800 dark:border-neutral-700"},bn={class:"inline-block"},yn={class:"inline-block"},xn=t.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(a,{emit:e}){const s=a,n=e;function l(d){return["pdf","json"].includes(d.ext)}function r(d){return["ppt","pptx","doc","docx","xls","xlsx"].includes(d.ext)}function o(d){const h=document.createElement("a");h.setAttribute("download",d?.uploaded_name),h.href=d?.file_path,h.click()}async function i(){try{await fetch(`${s.prefix}/widget/file/${s.item.entity_id}/${s.item.file_id}`),n("update")}catch(d){console.error(d)}}function u(){n("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function c(d){(s.item.ext==="jpg"||s.item.ext==="png")&&n("openLightbox",{item:s.item,index:d})}return(d,h)=>(t.openBlock(),t.createElementBlock("div",dn,[d.item.ext==="jpg"||d.item.ext==="png"?(t.openBlock(),t.createElementBlock("div",cn,[t.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:h[0]||(h[0]=p=>c(d.index))},[t.createVNode(we,{item:d.item},null,8,["item"])])])):l(d.item)?(t.openBlock(),t.createElementBlock("div",pn,[t.createVNode(we,{item:d.item},null,8,["item"])])):r(d.item)?(t.openBlock(),t.createElementBlock("div",hn,[t.createElementVNode("a",{href:`/api/file-preview?id=${d.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[t.createVNode(we,{item:d.item},null,8,["item"])],8,mn)])):(t.openBlock(),t.createElementBlock("div",fn,[t.createVNode(we,{item:d.item},null,8,["item"])])),t.createElementVNode("div",gn,[t.createElementVNode("div",kn,[t.createElementVNode("div",bn,[t.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:h[1]||(h[1]=p=>o(d.item))},[t.createVNode(He,{height:"14",width:"14"})])]),h[3]||(h[3]=t.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),t.createElementVNode("div",yn,[t.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:h[2]||(h[2]=p=>u())},[t.createVNode(_e,{height:"14",width:"14"})])])])])]))}}),_n={},wn={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function En(a,e){return t.openBlock(),t.createElementBlock("svg",wn,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),t.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),t.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Vn=D(_n,[["render",En]]),Cn={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},Bn={class:"flex w-full mb-[12px] items-center gap-x-2"},vn={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},Sn={class1:"ml-auto"},Fn={class:"py-1.5 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg bg-gray-100 cursor-pointer hover:bg-gray-200 text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},Nn={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},An={class:"relative"},Mn={key:1,class:"space-y-3 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},$n={key:0},Ke=t.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update"],setup(a,{emit:e}){const s=a,n=t.inject("form"),l=t.computed(()=>n.value.formId),r=t.ref(!1),o=t.ref(0),i=e,u=t.ref(!1),c=t.ref({}),d=t.ref([]),h=t.ref(""),p=t.computed(()=>Array.isArray(d.value)?d.value.filter(b=>b.ext==="jpg"||b.ext==="png").map(b=>b?.file_path):[]),x=t.computed(()=>h.value===""?d.value:d.value.filter(b=>b?.uploaded_name?.includes(h.value))),S=b=>{const f=p.value.findIndex(j=>j===b.item.file_path);f!==-1&&(r.value=!0,o.value=f)},A=async()=>{try{const b=await fetch(`${s.prefix}/widget/file/${l.value}`).then(f=>f.json());d.value=b?.rows}catch(b){console.error(b)}},M=async b=>{await Promise.all(Array.from(b.target.files).map(async f=>{const j=new FormData;j.append("file",f);try{const V=`${s.prefix}/widget/file/${l.value}`;return await fetch(V,{method:"POST",body:j}),i("update","file-list"),f}catch(V){return console.error(V),null}})),await A()},T=b=>{const f={...b};return b.cancel||(f.cancel=()=>{u.value=!1}),b.updateListOnConfirm&&(f.confirm=async()=>{await b.confirm(),u.value=!1,A()}),f},_=b=>{c.value=T(b),u.value=!0};return t.watch(l,b=>{b&&A()}),t.onMounted(()=>{l.value&&A()}),(b,f)=>{const j=t.resolveComponent("Lightbox"),V=t.resolveComponent("MessageBox");return t.openBlock(),t.createElementBlock("div",Cn,[t.createElementVNode("div",Bn,[t.createElementVNode("h2",vn," Файлів: "+t.toDisplayString(d.value?.length),1),t.createElementVNode("div",Sn,[t.createElementVNode("label",null,[t.createElementVNode("input",{type:"file",class:"hidden",onChange:f[0]||(f[0]=m=>M(m))},null,32),t.createElementVNode("div",Fn,[t.createVNode(Vn,{height:"16",width:"16"})])])])]),d.value?.length>4?(t.openBlock(),t.createElementBlock("div",Nn,[t.createElementVNode("div",null,[t.createElementVNode("div",An,[f[8]||(f[8]=t.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[t.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[t.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),t.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),t.withDirectives(t.createElementVNode("input",{type:"text","onUpdate:modelValue":f[1]||(f[1]=m=>h.value=m),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[t.vModelText,h.value,void 0,{trim:!0}]])])])])):t.createCommentVNode("",!0),d.value?.length?(t.openBlock(),t.createElementBlock("div",Mn,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(x.value,(m,C)=>(t.openBlock(),t.createBlock(xn,{key:C,prefix:b.prefix,item:m,index:C,onUpdate:f[2]||(f[2]=N=>b.$emit("update","file-list")),onOpenModal:f[3]||(f[3]=N=>_(N)),onOpenLightbox:f[4]||(f[4]=N=>S(N))},null,8,["prefix","item","index"]))),128)),x.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",$n,f[9]||(f[9]=[t.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):t.createCommentVNode("",!0),t.createVNode(j,{modelValue:r.value,"onUpdate:modelValue":f[5]||(f[5]=m=>r.value=m),startIndex:o.value,"onUpdate:index":f[6]||(f[6]=m=>o.value=m),images:p.value},null,8,["modelValue","startIndex","images"]),t.createVNode(V,t.mergeProps({modelValue:u.value,"onUpdate:modelValue":f[7]||(f[7]=m=>u.value=m),onConfirm:c.value.confirm},c.value),null,16,["modelValue","onConfirm"])])}}}),Dn={class:"flex items-center justify-between"},In={class:"text-[16px] text-gray-900 font-medium"},Ln={class:"grid gap-3"},Tn=D(t.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(a){const e=a,s=t.ref(e.isOpen);return t.watch(()=>e.isOpen,n=>{s.value=n}),(n,l)=>(t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",Dn,[t.createElementVNode("p",In,t.toDisplayString(a.title),1),t.createVNode(Se,{modelValue:s.value,"onUpdate:modelValue":l[0]||(l[0]=r=>s.value=r),style:t.normalizeStyle(a.style)},null,8,["modelValue","style"])]),t.createVNode(t.Transition,{name:"slide-fade"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",Ln,[t.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[t.vShow,s.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),Rn={class:"text-[16px] text-gray-900 font-medium"},On={class:"grid gap-3"},zn=D(t.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(a){const e=a,s=t.ref(e.isOpen);return t.watch(()=>e.isOpen,n=>{s.value=n}),(n,l)=>(t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("button",{type:"button",onClick:l[0]||(l[0]=r=>s.value=!s.value),class:"flex items-center gap-2"},[t.createVNode(t.unref(ts),{class:t.normalizeClass(["h-4 w-4 duration-300",[s.value?"-rotate-180":""]])},null,8,["class"]),t.createElementVNode("span",Rn,t.toDisplayString(a.title),1)]),t.createVNode(t.Transition,{name:"slide-fade"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",On,[t.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[t.vShow,s.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),jn={class:"flex items-center justify-between"},Un={switcher:Tn,accordion:zn,default:t.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(a){return(e,s)=>(t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",jn,[t.createElementVNode("p",null,t.toDisplayString(a.title),1)]),t.renderSlot(e.$slots,"default")]))}})},G={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Pn=(a,e)=>String(a)===String(e),Hn=(a,e)=>String(a)!==String(e),qn=(a,e)=>a>e,Gn=(a,e)=>a>=e,Kn=(a,e)=>a<e,Zn=(a,e)=>a<=e,Yn=(a,e)=>Array.isArray(e)&&e.length===2?a>=e[0]&&a<=e[1]:!1,Jn=(a,e)=>String(a).startsWith(String(e)),Wn=(a,e)=>String(a).endsWith(String(e)),Xn=(a,e)=>String(a).includes(String(e)),Qn=(a,e)=>Array.isArray(e)?e.includes(a):!1,el=(a,e)=>Array.isArray(e)?!e.includes(a):!0,Ze=(a,e)=>{if(!e)return!0;switch(e?.[1]){case G.Equal:return Pn(a,e?.[2]);case G.Inequal:return Hn(a,e?.[2]);case G.Higer:return qn(a,e?.[2]);case G.HigerOrEqual:return Gn(a,e?.[2]);case G.Lower:return Kn(a,e?.[2]);case G.LowerOrEqual:return Zn(a,e?.[2]);case G.Between:return Yn(a,e?.[2]);case G.StartWith:return Jn(a,e?.[2]);case G.EndWith:return Wn(a,e?.[2]);case G.Contain:return Xn(a,e?.[2]);case G.In:return Qn(a,e?.[2]);case G.NotIn:return el(a,e?.[2]);default:return!0}},Ye=t.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},schema:{type:Array,default:()=>[]}},setup(a){const e=a,s=t.inject("formValues",{default:{}}),n=t.inject("form"),l=t.computed(()=>e.schema?.filter(o=>{const i=o?.conditions;if(!i)return!0;const u=Array.isArray(i)?i[0]:i,c=s?.value?.[u];return Ze(c,i)})),r=t.computed(()=>Un[e.view]);return(o,i)=>a.schema?.length?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.value),{key:0,title:a.title,style:t.normalizeStyle(a.style)},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,u=>(t.openBlock(),t.createBlock(lt,t.mergeProps({key:u.name},{ref_for:!0},u,{item:u,modelValue:t.unref(s)[u.name],"onUpdate:modelValue":c=>t.unref(s)[u.name]=c,style:a.style,error:t.unref(n)?.errors?.[u.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):t.createCommentVNode("",!0)}}),tl={class:"p-4 mim-h-0 h-full overflow-auto"},Je=t.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(a,{emit:e}){const s=a,n=e,l=t.ref(s.schema),r=t.ref(s.defaultValue?JSON.parse(JSON.stringify(s.defaultValue)):{}),o=t.ref({}),i=t.ref(),u=t.ref(s.mode);async function c(){const h=o.value.validate();if(h){Z.notify({type:"warning",title:"Помилка валідації",message:Object.entries(h).map(([p,x])=>`${p}: ${x}`).join(`
2
+ `)});return}if(i.value)try{const p=await fetch(`/api/table/${i.value}`,{method:u.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r.value)});if(p.ok)await p.json(),Z.notify({type:"success",title:"Успішно",message:`Дані успішно ${u.value==="add"?"збережено":"оновлено"}`}),n("save",r.value);else if(p.status===400){const x=await p.json().catch(()=>({}));Z.notify({type:"warning",title:"Помилка валідації",message:x.message||"Некоректні дані (400)"})}else p.status===500?Z.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):Z.notify({type:"error",title:"Помилка",message:`Статус: ${p.status}`})}catch(p){Z.notify({type:"error",title:"Помилка з’єднання",message:p.message||"Не вдалося виконати запит"})}else n("save",r.value)}function d(){n("close")}return t.onMounted(async()=>{if(s.form){const h=await fetch(`/api/template/form/${s.form}`).then(p=>p.json());l.value=h.schema,i.value=h.token}else if(s.token){i.value=s.token;const h=await fetch(`/api/form/${i.value}`).then(p=>p.json());l.value=h.schema,h.data?r.value=h.data:u.value="add"}}),(h,p)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[t.createElementVNode("div",tl,[l.value?(t.openBlock(),t.createBlock(ce,{key:0,schema:l.value,values:r.value,"onUpdate:values":p[0]||(p[0]=x=>r.value=x),form:o.value,"onUpdate:form":p[1]||(p[1]=x=>o.value=x)},null,8,["schema","values","form"])):t.createCommentVNode("",!0)]),t.createElementVNode("div",{class:"vs-form__head mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},[t.createElementVNode("button",{type:"button",onClick:d,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),t.createElementVNode("button",{onClick:c,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])],64))}}),de=(a={mode:"edit",schema:null})=>new Promise(e=>{const{close:s}=Z.modal({title:a.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Je,contentProps:{...a,onClose:()=>{e(null),s()},onSave:n=>{e(n),s()}}})}),sl=["aria-expanded","data-focus"],nl={class:"flex items-center"},ll={class:"truncate text-gray-900 overflow-hidden"},rl=["onClick"],al=["title"],ol={key:2,class:"text-gray-500 truncate"},il={class:"flex-1 min-w-[2px]"},ul=["placeholder"],dl={class:"flex items-center shrink-0"},cl=["disabled"],pl=["disabled"],hl={key:0,class:"absolute z-10 w-full mt-2 rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]",role:"listbox"},ml=["aria-disabled","onClick"],fl={key:1,class:"px-3 py-2 text-center text-gray-500"},gl=["disabled"],We=t.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{},options:{default:()=>[]},api:{},maxHeight:{default:400},add:{},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},emits:["change","update:modelValue"],setup(a,{emit:e}){const s=a,n=e,l=t.computed(()=>s.multiple),r=t.computed(()=>s.disabled);Q(s.style);const o=t.computed({get:()=>s.modelValue,set:k=>n("update:modelValue",k)});!o.value&&s.defaultValue&&(o.value=s.defaultValue);const i=t.ref(null),u=t.ref(null),c=t.ref(null),d=t.ref(!1),h=t.ref(!1),p=t.ref(null),x=t.ref([]),S=t.ref(-1),A=t.ref([]),M=t.ref(""),T=t.ref(null),_=t.ref([]),b=t.computed(()=>{if(!_.value.length)return[];const k=new Map(x.value.map(y=>[y.id?.toString(),y]));return _.value.map(y=>k.get(y?.toString())).filter(y=>!!y)}),f=t.computed(()=>s.placeholder||"Select..."),j=t.computed(()=>l.value?!_.value.length&&M.value==="":!p.value?.text&&M.value===""),V=t.computed(()=>r.value?!1:l.value?_.value.length>0:!!o.value),m=k=>l.value?_.value.some(y=>y?.toString()===k?.toString()):o.value?.toString()===k?.toString(),C=t.computed(()=>{let k=x.value??[];if(M.value.trim()!==""){const y=M.value.toLowerCase();k=k.filter(F=>F.text?.toLowerCase?.().includes(y))}if(l.value&&_.value.length){const y=new Set(_.value.map(F=>F?.toString()));k=k.filter(F=>!y.has(F.id?.toString()))}return k}),N=async k=>{if(!s.data)return[];try{const y=s.api?s.api:`/suggest/${s.data}`,F="?json=1",U=k?`&val=${encodeURIComponent(k)}`:"";return(await fetch(y.concat(F,U)).then(ue=>ue.json())).data??[]}catch{return[]}},P=async()=>{s.options?.length?x.value=[...s.options]:s.data&&(x.value=await N(M.value))},K=async k=>{if(k==null)return null;const y=x.value?.find(U=>U?.id?.toString()===String(k));return y||((await N(String(k)))?.[0]??null)},ie=async k=>{const y=new Set(x.value.map(U=>U.id?.toString())),F=k.filter(U=>!y.has(U?.toString()));F.length&&await F.reduce(async(U,le)=>{await U;const ue=await K(le);ue&&x.value.push(ue)},Promise.resolve())},ke=async()=>{r.value||(d.value=!0,await P(),await t.nextTick(()=>{T.value?.focus(),C.value.length?S.value=0:S.value=-1}))},X=()=>{d.value=!1,S.value=-1},Ie=async k=>{if(r.value)return;!d.value?await ke():X()},be=async()=>{d.value?T.value?.focus():await ke()},g=()=>{l.value?(_.value=[],o.value=[],n("change",[])):(p.value=null,o.value=null,n("change",null)),M.value="",t.nextTick(()=>T.value?.focus())},w=k=>{l.value&&(_.value=_.value.filter(y=>y?.toString()!==k?.toString()),o.value=[..._.value],n("change",o.value),t.nextTick(()=>T.value?.focus()))},$=k=>{l.value?(m(k.id)||(_.value=[..._.value,k.id],o.value=[..._.value],n("change",o.value)),M.value="",t.nextTick(()=>{T.value?.focus(),S.value=Math.min(S.value,C.value.length-1)})):(p.value=k,o.value=k.id,n("change",o.value),M.value="",X())},R=k=>{m(k.id)||$(k)},q=(k,y)=>{if(!k||!y)return;const F=k.offsetTop,U=F+k.offsetHeight,le=y.scrollTop,ue=le+y.clientHeight;let Le=y.scrollTop;F<le?Le=F-80:U>ue&&(Le=U-y.clientHeight+4);const eo=y;eo.scrollTop=Le},ye=async k=>{r.value||!d.value&&(k.key==="ArrowDown"||k.key==="ArrowUp")&&(k.preventDefault(),await ke())},se=k=>{if(!d.value)return;const{key:y}=k;if(y==="ArrowDown")k.preventDefault(),S.value+1<C.value.length&&(S.value+=1,q(A.value[S.value],c.value));else if(y==="ArrowUp")k.preventDefault(),S.value>0&&(S.value-=1,q(A.value[S.value],c.value));else if(y==="Enter"){k.preventDefault();const F=C.value[S.value];F&&$(F)}else y==="Escape"?(k.preventDefault(),X()):y==="Backspace"?l.value&&M.value===""&&_.value.length&&(_.value=_.value.slice(0,-1),o.value=[..._.value],n("change",o.value)):y==="Home"?(S.value=0,q(A.value[0],c.value)):y==="End"?(S.value=C.value.length-1,q(A.value[S.value],c.value)):y==="Tab"&&X()},re=()=>{r.value||(h.value=!0)},ae=()=>{h.value=!1,M.value=""},ne=k=>{k.key==="Escape"&&d.value&&X()},yt=k=>{i.value&&(i.value.contains(k.target)||X())},xt=k=>{d.value&&c.value&&!c.value.contains(k.target)&&X()};t.watch(()=>s.options,k=>{k?.length&&(x.value=[...k])},{immediate:!0});const _t=async()=>{if(l.value)Array.isArray(o.value)?_.value=[...o.value]:(_.value=o.value==null?[]:[o.value],o.value=[..._.value]),!s.options?.length&&s.data&&await ie(_.value);else{if(Array.isArray(o.value)){const k=o.value[0]??null;o.value=k??null}p.value=await K(o.value)}};t.watch(o,()=>{_t()}),t.onMounted(async()=>{addEventListener("keydown",ne),addEventListener("scroll",xt,!0),document.addEventListener("click",yt,!0),s.options?.length?x.value=[...s.options]:s.data&&(x.value=await N("")),await _t()}),t.onUnmounted(()=>{removeEventListener("keydown",ne),removeEventListener("scroll",xt,!0),document.removeEventListener("click",yt,!0)});async function Qa(){if(!s.add)return;const k=await de({form:s.add.form,mode:"add"});k&&(await fetch(`/api/table/${s.add.token}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(k)}).then(y=>y.json()),!s.options?.length&&s.data&&(x.value=await N(M.value)))}return(k,y)=>(t.openBlock(),t.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:y[2]||(y[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",{class:t.normalizeClass(["relative w-full font-sans",s.customClass])},[y[7]||(y[7]=t.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),y[8]||(y[8]=t.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),t.createElementVNode("div",{class:t.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",d.value||h.value?"border-blue-500 ring-1 ring-blue-500":"",r.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":d.value,"aria-haspopup":"listbox",onKeydown:ye,onClick:be,"data-focus":d.value||h.value?"true":"false"},[t.createElementVNode("div",{class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"triggerRef",ref:u},[l.value&&_.value.length?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(b.value,F=>(t.openBlock(),t.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border",key:F.id},[t.createElementVNode("div",nl,[F?.color?(t.openBlock(),t.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5",style:t.normalizeStyle({backgroundColor:F?.color})},null,4)):t.createCommentVNode("",!0),t.withDirectives((t.openBlock(),t.createElementBlock("div",ll,[t.createTextVNode(t.toDisplayString(F.text),1)])),[[t.unref(Z.TooltipDirective),F.text]])]),t.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:t.withModifiers(U=>w(F.id),["stop"])},y[3]||(y[3]=[t.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[t.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,rl)]))),128)):!l.value&&!h.value&&p.value?.text&&M.value===""?t.withDirectives((t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["truncate text-gray-900"]),title:p.value.text},[p.value?.color?(t.openBlock(),t.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:t.normalizeStyle({backgroundColor:p.value?.color})},null,4)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:t.normalizeClass({"pl-5":p.value?.color})},t.toDisplayString(p.value.text),3)],8,al)),[[t.unref(Z.TooltipDirective),p.value.text]]):t.createCommentVNode("",!0),j.value?(t.openBlock(),t.createElementBlock("div",ol,t.toDisplayString(f.value),1)):t.createCommentVNode("",!0),t.createElementVNode("div",il,[!r.value&&k.search?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputRef",ref:T,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:(l.value&&_.value.length?" ":null)||(h.value&&!M.value?.length?p.value?.text:" "),"onUpdate:modelValue":y[0]||(y[0]=F=>M.value=F),onFocus:re,onBlur:ae,onKeydown:se},null,40,ul)),[[t.vModelText,M.value]]):t.createCommentVNode("",!0)])],512),t.createElementVNode("div",dl,[V.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:r.value,onClick:t.withModifiers(g,["stop"])},y[4]||(y[4]=[t.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[t.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,cl)):t.createCommentVNode("",!0),y[6]||(y[6]=t.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),t.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:r.value,onClick:y[1]||(y[1]=t.withModifiers(F=>Ie(),["stop"]))},y[5]||(y[5]=[t.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[t.createElementVNode("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})],-1)]),8,pl)])],42,sl),d.value?(t.openBlock(),t.createElementBlock("div",hl,[t.createElementVNode("div",{class:"max-h-[300px] overflow-y-auto py-1",ref_key:"listRef",ref:c},[C.value.length?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(C.value,(F,U)=>(t.openBlock(),t.createElementBlock("div",{key:F.id,ref_for:!0,ref:le=>A.value[U]=le,class:t.normalizeClass(["flex px-3 py-2 cursor-default select-none hover:bg-blue-300",S.value===U?"bg-blue-300":"",m(F.id)?"text-white bg-blue-500":"text-gray-900 bg-white"]),"aria-disabled":m(F.id)?"true":"false",role:"option",tabindex:"-1",onClick:le=>R(F)},[F?.color?(t.openBlock(),t.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:t.normalizeStyle({backgroundColor:F?.color})},null,4)):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["leading-[19px]",S.value===F.id?"text-white":"",(S.value===U,"")])},t.toDisplayString(F.text),3)],10,ml))),128)):(t.openBlock(),t.createElementBlock("div",fl," No options "))],512)])):t.createCommentVNode("",!0)],2),s.add?(t.openBlock(),t.createElementBlock("button",{key:0,onClick:Qa,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:r.value,type:"button"},[t.createVNode(xe,{width:"16",height:"16"}),y[9]||(y[9]=t.createElementVNode("span",null,"Додати",-1))],8,gl)):t.createCommentVNode("",!0)],512))}}),kl=["placeholder","disabled"],Xe=t.defineComponent({__name:"vs-input-textarea",props:t.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,{inputClass:s}=Q(e.style),n=t.useModel(a,"modelValue");return(l,r)=>t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{"onUpdate:modelValue":r[0]||(r[0]=o=>n.value=o),placeholder:l.placeholder,disabled:l.disabled,row:"2",class:t.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto",[t.unref(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,kl)),[[t.vModelText,n.value]])}}),bl={},yl={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};function xl(a,e){return t.openBlock(),t.createElementBlock("svg",yl,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),t.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const _l=D(bl,[["render",xl]]),wl={},El={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Vl(a,e){return t.openBlock(),t.createElementBlock("svg",El,e[0]||(e[0]=[t.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),t.createElementVNode("path",{d:"M7 20V4"},null,-1),t.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),t.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const Cl=D(wl,[["render",Vl]]),Bl={},vl={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Sl(a,e){return t.openBlock(),t.createElementBlock("svg",vl,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),t.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),t.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Fl=D(Bl,[["render",Sl]]),Nl={},Al={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Ml(a,e){return t.openBlock(),t.createElementBlock("svg",Al,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),t.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),t.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const $l=D(Nl,[["render",Ml]]),Dl={},Il={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Ll(a,e){return t.openBlock(),t.createElementBlock("svg",Il,e[0]||(e[0]=[t.createStaticVNode('<circle cx="9" cy="12" r="1"></circle><circle cx="9" cy="5" r="1"></circle><circle cx="9" cy="19" r="1"></circle><circle cx="15" cy="12" r="1"></circle><circle cx="15" cy="5" r="1"></circle><circle cx="15" cy="19" r="1"></circle>',6)]))}const Qe=D(Dl,[["render",Ll]]),Tl={},Rl={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Ol(a,e){return t.openBlock(),t.createElementBlock("svg",Rl,e[0]||(e[0]=[t.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)]))}const zl=D(Tl,[["render",Ol]]),jl={},Ul={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Pl(a,e){return t.openBlock(),t.createElementBlock("svg",Ul,e[0]||(e[0]=[t.createElementVNode("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"},null,-1)]))}const Hl=D(jl,[["render",Pl]]),ql={class:"vs-datatable border rounded-xl w-full flex-grow"},Gl={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},Kl={class:"relative w-full"},Zl={class:"table-wrapper flex gap-2"},Yl={class:"vs-popover inline-block text-slate-700"},Jl={class:"text-center"},Wl={class:""},Xl={class:"py-1 px-0 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},Ql={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},er={class:"text-sm items-center text-gray-800 flex gap-1"},tr={class:"w-full overflow-x-auto"},sr={class:"w-full table-auto caption-bottom text-sm"},nr={class:"[&_tr]:border-b"},lr={class:"border-b data-[state=selected]:bg-muted bg-slate-50/50 dark:bg-slate-700/50 hover:bg-slate-50/80 dark:hover:bg-slate-700/80 transition-colors"},rr={class:"h-10 px-2 align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] w-12 text-center"},ar={key:0,colspan:"100%",class:"text-center"},or={class:"w-full"},ir={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},ur=["onDragstart","onDragover","onDrop"],dr={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},cr={class:"flex items-center justify-center"},pr={class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},hr={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},mr={class:"flex items-center justify-center gap-2"},fr=["onClick"],gr=["onClick"],et=t.defineComponent({__name:"vs-input-datatable",props:t.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,s=t.useModel(a,"modelValue"),n=t.ref({}),l=t.ref(""),r=t.computed(()=>{if(!l.value)return s.value??[];const V=l.value.toLowerCase();return s.value.filter(m=>e.colModel?.some(C=>{const N=m[C.key];return N?Array.isArray(N)?N.join(", ").toLowerCase().includes(V):String(N).toLowerCase().includes(V):!1}))}),o=t.ref(null),i=t.ref(null),u=t.ref(!1),c=t.ref(null),d=t.ref({top:0,left:0}),h=V=>{o.value=V},p=V=>{i.value=V},x=V=>{if(o.value===null||o.value===V){o.value=null,i.value=null;return}const m=[...s.value],[C]=m.splice(o.value,1);m.splice(V,0,C),s.value=m,o.value=null,i.value=null},S=V=>{const C=V.currentTarget.getBoundingClientRect();d.value={top:C.bottom+window.scrollY,left:C.left+window.scrollX},u.value=!u.value},A=()=>{c.value&&c.value.click()},M=V=>{const C=V.target.files?.[0];if(!C)return;const N=new FileReader;N.onload=P=>{try{const K=P.target?.result;if(typeof K=="string"){const ie=JSON.parse(K);Array.isArray(ie)&&s.value.push(...ie)}}catch(K){console.error("Error parsing file:",K)}},N.readAsText(C)},T=()=>{const V=JSON.stringify(s.value,null,2),m=new Blob([V],{type:"application/json"}),C=URL.createObjectURL(m),N=document.createElement("a");N.href=C,N.download="data.json",N.click(),URL.revokeObjectURL(C)};t.onMounted(async()=>{const V=e.colModel?.filter(m=>m.data);V?.length&&Promise.all(V.map(async m=>{n.value[m.key]=await fetch(`/api/suggest/${m.data}`).then(C=>C.json())}))});async function _(){const V=await de({schema:e.colModel,mode:"add"});V&&(Array.isArray(s.value)?s.value=[...s.value,V]:s.value=[V])}function b(V,m){return n.value[m.key]&&V[m.key]?n.value[m.key].find(C=>C.id.toString()===V[m.key].toString())?.text??V[m.key]:V[m.key]||"-"}async function f(V,m){const C=await de({schema:e.colModel,mode:"add",defaultValue:V});C&&(s.value=s.value.map((N,P)=>P===m?C:N))}function j(V){s.value=s.value.filter((m,C)=>C!==V)}return(V,m)=>(t.openBlock(),t.createElementBlock("div",ql,[t.createElementVNode("div",Gl,[t.createElementVNode("div",Kl,[t.createVNode(_l,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),t.withDirectives(t.createElementVNode("input",{type:"text","onUpdate:modelValue":m[0]||(m[0]=C=>l.value=C),placeholder:"Пошук",class:"py-2 px-3 pl-10 w-full bg-gray-100 h-[36px] rounded-[8px] text-[15px] leading-[18px] focus:border-1 text-stone-800 placeholder:text-[#6B7280] focus:outline-blue-500 focus:outline-2"},null,512),[[t.vModelText,l.value]])]),t.createElementVNode("div",Zl,[t.createElementVNode("input",{ref_key:"fileInput",ref:c,onChange:M,class:"hidden",accept:".json",type:"file"},null,544),t.createElementVNode("div",Yl,[t.createElementVNode("div",Jl,[t.createElementVNode("div",Wl,[t.createElementVNode("button",{onClick:S,class:"bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[t.createVNode(Cl,{height:"16",width:"16"})])])])])]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[u.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:t.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:d.value.top+"px",left:d.value.left+"px"}])},[t.createElementVNode("div",Xl,[t.createElementVNode("div",Ql,[t.createElementVNode("button",{onClick:A,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[t.createVNode(Fl,{class:"text-black",width:"14",height:"14"}),m[1]||(m[1]=t.createTextVNode(" Імпортувати "))]),t.createElementVNode("button",{onClick:T,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[t.createElementVNode("span",er,[t.createVNode($l,{class:"text-black",width:"14",height:"14"}),m[2]||(m[2]=t.createTextVNode(" Експортувати "))])])])])],4)):t.createCommentVNode("",!0)])),t.createElementVNode("button",{onClick:_,class:"text-slate-700 bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[t.createVNode(xe),m[3]||(m[3]=t.createTextVNode(" Додати "))])]),t.createElementVNode("div",tr,[t.createElementVNode("table",sr,[t.createElementVNode("thead",nr,[t.createElementVNode("tr",lr,[t.createElementVNode("th",rr,[t.createVNode(Qe,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.colModel,C=>(t.openBlock(),t.createElementBlock("th",{key:C.key,class:"h-10 px-2 text-left align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 min-w-[150px]"},t.toDisplayString(C.ua||C.label),1))),128)),m[4]||(m[4]=t.createElementVNode("th",{class:"h-10 px-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 text-center"}," Дії ",-1))])]),t.createElementVNode("tbody",{class:t.normalizeClass({"[&_tr:last-child]:border-0":!i.value})},[r.value.length===0?(t.openBlock(),t.createElementBlock("td",ar,[t.createElementVNode("div",or,[t.createElementVNode("div",ir,[t.createVNode(zl,{class:"w-48 mx-auto"}),m[5]||(m[5]=t.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[t.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),t.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(C,N)=>(t.openBlock(),t.createElementBlock("tr",{key:C.id,class:t.normalizeClass(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move",{"opacity-50":o.value===N,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":i.value===N}]),draggable:"true",onDragstart:P=>h(N),onDragover:t.withModifiers(P=>p(N),["prevent"]),onDrop:P=>x(N)},[t.createElementVNode("td",dr,[t.createElementVNode("div",cr,[t.createVNode(Qe,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(V.colModel,P=>(t.openBlock(),t.createElementBlock("td",{key:P.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[t.createElementVNode("div",pr,t.toDisplayString(b(C,P)),1)]))),128)),t.createElementVNode("td",hr,[t.createElementVNode("div",mr,[t.createElementVNode("button",{onClick:P=>f(C,N),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-blue-50 dark:hover:bg-slate-600 hover:border-blue-300 dark:hover:border-slate-500 hover:text-blue-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[t.createVNode(Hl,{width:"24",height:"24",class:"w-3 h-3"})],8,fr),t.createElementVNode("button",{onClick:P=>j(N),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-red-50 dark:hover:bg-slate-600 hover:border-red-300 dark:hover:border-slate-500 hover:text-red-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[t.createVNode(_e,{width:"24",height:"24",class:"w-3 h-3"})],8,gr)])])],42,ur))),128))],2)])])]))}}),kr={draw:{toolbar:{actions:{title:"Скасувати малювання",text:"Скасувати"},finish:{title:"Завершити малювання",text:"Завершити"},undo:{title:"Видалити останню точку",text:"Видалити останню"},buttons:{polyline:"Намалювати лінію",polygon:"Намалювати полігон",rectangle:"Намалювати прямокутник",circle:"Намалювати коло",marker:"Додати точку",circlemarker:"Додати маркер-коло"}},handlers:{circle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати коло",end:"Відпустіть кнопку миші, щоб завершити"},radius:"Радіус"},circlemarker:{tooltip:{start:"Клацніть на карту, щоб додати маркер-коло"}},marker:{tooltip:{start:"Клацніть на карту, щоб додати точку"}},polygon:{tooltip:{start:"Клацніть, щоб почати малювати полігон",cont:"Клацайте, щоб продовжити малювати полігон",end:"Клацніть першу точку, щоб завершити полігон"}},polyline:{error:"<strong>Помилка:</strong> лінія не може перетинатися сама з собою",tooltip:{start:"Клацніть, щоб почати малювати лінію",cont:"Клацайте, щоб продовжити малювати лінію",end:"Клацніть останню точку, щоб завершити лінію"}},rectangle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати прямокутник",end:"Відпустіть кнопку миші, щоб завершити"}},simpleshape:{tooltip:{end:"Відпустіть кнопку миші, щоб завершити"}}}},edit:{toolbar:{actions:{save:{title:"Зберегти зміни",text:"Зберегти"},cancel:{title:"Скасувати редагування",text:"Скасувати"},clearAll:{title:"Очистити всі шари",text:"Очистити все"}},buttons:{edit:"Редагувати шари",editDisabled:"Немає шарів для редагування",remove:"Видалити шари",removeDisabled:"Немає шарів для видалення"}},handlers:{edit:{tooltip:{text:"Перетягніть маркери, щоб редагувати шари",subtext:"Натисніть 'Скасувати', щоб повернутися"}},remove:{tooltip:{text:"Клацніть на шари, щоб видалити їх"}}}}};function br(a){return a?a.type==="FeatureCollection"||a.type==="Feature"?a:a.geom?{type:"Feature",geometry:{type:a.geom.type,coordinates:a.geom.coordinates},properties:{}}:a.type&&a.coordinates?{type:"Feature",geometry:a,properties:{}}:null:null}const yr={},xr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-map-pin"};function _r(a,e){return t.openBlock(),t.createElementBlock("svg",xr,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),t.createElementVNode("path",{d:"M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z"},null,-1)]))}const wr=D(yr,[["render",_r]]),Er={},Vr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","stroke-width":"2",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-line"};function Cr(a,e){return t.openBlock(),t.createElementBlock("svg",Vr,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),t.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),t.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const Br=D(Er,[["render",Cr]]),vr={},Sr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function Fr(a,e){return t.openBlock(),t.createElementBlock("svg",Sr,e[0]||(e[0]=[t.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M6.5 9.5l3.5 -3"></path><path d="M14 5.5l3 1.5"></path><path d="M18.5 10l-2.5 7"></path><path d="M13.5 17.5l-7 -5"></path>',9)]))}const Nr=D(vr,[["render",Fr]]),Ar={},Mr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function $r(a,e){return t.openBlock(),t.createElementBlock("svg",Mr,e[0]||(e[0]=[t.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M8 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M6 8v8"></path><path d="M18 16v-8"></path><path d="M8 6h8"></path><path d="M16 18h-8"></path>',9)]))}const Dr=D(Ar,[["render",$r]]),Ir={},Lr={version:"1.1",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg","xmlns:sketch":"http://www.bohemiancoding.com/sketch/ns","xmlns:xlink":"http://www.w3.org/1999/xlink",class:"fullscreen-icon"};function Tr(a,e){return t.openBlock(),t.createElementBlock("svg",Lr,e[0]||(e[0]=[t.createElementVNode("title",null,null,-1),t.createElementVNode("desc",null,null,-1),t.createElementVNode("defs",null,null,-1),t.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[t.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[t.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[t.createElementVNode("path",{d:"M2,9 L0,9 L0,14 L5,14 L5,12 L2,12 L2,9 L2,9 Z M0,5 L2,5 L2,2 L5,2 L5,0 L0,0 L0,5 L0,5 Z M12,12 L9,12 L9,14 L14,14 L14,9 L12,9 L12,12 L12,12 Z M9,0 L9,2 L12,2 L12,5 L14,5 L14,0 L9,0 L9,0 Z",id:"Shape"})])])],-1)]))}const Rr=D(Ir,[["render",Tr]]),Or={class:"form-geom__search"},zr={class:"map-search__input"},jr={class:"flex flex-nowrap relative"},Ur={class:"form-autocomplete relative min-w-[6rem] vsTailwind map-search__select hidden"},Pr={class:"flex items-center w-full"},Hr={class:"max-w-[90%] truncate"},qr={key:0,class:"absolute z-[3100] mt-0.5 left-0 right-0"},Gr={class:"form-autocomplete__wrapper mt-[10px] z-50 w-full min-w-36 max-h-72 p-0 space-y-0.5 bg-white rounded-xl shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] dark:bg-neutral-900 top-full opened"},Kr={class:"form-autocomplete__list vsTailwind px-2 pb-2 pt-0 max-h-200 relative [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500 dark:bg-neutral-900"},Zr=["onClick"],Yr={class:"flex justify-between items-center w-full"},Jr={class:"flex items-center"},Wr={key:0,class:"flex-shrink-0 w-3.5 h-3.5 text-blue-600",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Xr={class:"relative w-full"},Qr={class:"vs-form-text relative bg-white rounded-lg"},ea={key:1,class:"absolute left-0 right-0 top-full z-[3200] bg-white border border-gray-200 rounded-b-lg shadow-lg max-h-72 overflow-auto"},ta={key:0},sa=["onClick"],na={key:1,class:"px-3 py-2 text-xs text-gray-500"},la={key:2,class:"px-3 py-2 text-xs text-gray-400"},ra=t.defineComponent({__name:"map-search",props:{placeholder:{default:"50, 30"}},emits:["goToCoordinates"],setup(a,{emit:e}){const s=e,n=t.ref(!1),l=t.ref("coordinates"),r=t.ref(""),o=t.ref([]),i=t.ref(!1),u=t.ref(!1);let c;const d=[{value:"coordinates",label:"Пошук по кординатам"},{value:"atu",label:"АТУ"},{value:"address",label:"Адресса"},{value:"search_here",label:"Пошук HERE"}],h=t.computed(()=>d.find(_=>_.value===l.value)?.label??"АТУ");function p(_){l.value=_.value,n.value=!1,r.value="",r.value&&A()}function x(_){_.target.closest(".map-search__input")||(n.value=!1)}t.onMounted(()=>document.addEventListener("click",x)),t.onUnmounted(()=>document.removeEventListener("click",x));async function S(_){let b;l.value==="atu"?b="/api/suggest/atu.nsdi.ato_level":l.value==="address"?b="/api/suggest/map.address_id":l.value==="search_here"&&(b="/api/gis-url-proxy");const f=new URL(b||"");return l.value==="search_here"?f.searchParams.set("searchtext",_):(l.value==="atu"||l.value==="address")&&f.searchParams.set("key",_),f.searchParams.set("limit","20"),f.searchParams.set("q",_),(await fetch(f.toString())).json()}function A(){if(i.value=!0,u.value=!0,l.value==="coordinates"){const _=r.value.trim().split(",");if(_.length===2){const b=parseFloat(_[0]),f=parseFloat(_[1]);!Number.isNaN(b)&&!Number.isNaN(f)&&s("goToCoordinates",[b,f])}return}c&&window.clearTimeout(c),c=window.setTimeout(async()=>{const _=r.value.trim();if(!_){o.value=[],u.value=!1;return}try{const b=await S(_);o.value=Array.isArray(b.features)?b.features:[]}catch{o.value=[]}finally{u.value=!1}},300)}function M(){r.value="",o.value=[],i.value=!1,u.value=!1}function T(_){s("goToCoordinates",_),i.value=!1,u.value=!1,o.value=[]}return(_,b)=>(t.openBlock(),t.createElementBlock("div",Or,[t.createElementVNode("div",zr,[t.createElementVNode("div",jr,[t.createElementVNode("div",Ur,[t.createElementVNode("button",{type:"button",onClick:b[0]||(b[0]=f=>n.value=!n.value),class:"h-[40px] relative px-4 pe-9 flex text-nowrap w-full cursor-pointer bg-white border border-solid border-stone-200 rounded-lg text-start text-sm text-stone-800 focus:outline-none focus:ring-1 focus:ring-blue-600 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-200"},[t.createElementVNode("div",Pr,[t.createElementVNode("span",Hr,t.toDisplayString(h.value),1)]),b[3]||(b[3]=t.createElementVNode("svg",{class:"stroke-gray-500 absolute right-3 translate-y-1/2 bottom-1/2",width:"15",height:"15",viewBox:"0 0 24 24",fill:"none"},[t.createElementVNode("path",{d:"M6 9l6 6 6-6","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1))]),n.value?(t.openBlock(),t.createElementBlock("div",qr,[t.createElementVNode("div",Gr,[t.createElementVNode("div",Kr,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,f=>t.createElementVNode("div",{onClick:j=>p(f),key:f.value,class:"form-autocomplete__item cursor-pointer hs-selected:bg-stone-100 dark:hs-selected:bg-neutral-800 py-2 px-4 w-full text-sm text-gray-800 hover:bg-gray-100 rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:hover:bg-neutral-800 dark:text-neutral-200 dark:focus:bg-neutral-800 cursor-default"},[t.createElementVNode("div",Yr,[t.createElementVNode("div",Jr,[t.createElementVNode("div",null,t.toDisplayString(f.label),1)]),f.value===l.value?(t.openBlock(),t.createElementBlock("svg",Wr,b[4]||(b[4]=[t.createElementVNode("polyline",{points:"20 6 9 17 4 12"},null,-1)]))):t.createCommentVNode("",!0)])],8,Zr)),64))])])])):t.createCommentVNode("",!0)]),t.createElementVNode("div",Xr,[t.createElementVNode("div",Qr,[b[6]||(b[6]=t.createElementVNode("i",{class:"absolute bottom-1/2 translate-y-1/2 left-3 text-gray-500"},[t.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},[t.createElementVNode("circle",{cx:"11",cy:"11",r:"8","stroke-width":"2"}),t.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65","stroke-width":"2"})])],-1)),t.withDirectives(t.createElementVNode("input",{type:"text","onUpdate:modelValue":b[1]||(b[1]=f=>r.value=f),onInput:A,onFocus:b[2]||(b[2]=f=>i.value=!0),placeholder:"lat, lng ex. 50, 30",class:"bg-white h-[38px] text-sm py-2 px-3 ps-9 pe-8 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,544),[[t.vModelText,r.value]]),r.value?(t.openBlock(),t.createElementBlock("button",{key:0,onClick:M,class:"absolute right-2 bottom-1/2 translate-y-1/2 text-gray-500 hover:text-red-500","aria-label":"Очистити",type:"button"},b[5]||(b[5]=[t.createElementVNode("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]))):t.createCommentVNode("",!0),i.value&&l.value!=="coordinates"?(t.openBlock(),t.createElementBlock("div",ea,[o.value.length?(t.openBlock(),t.createElementBlock("ul",ta,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.value,f=>(t.openBlock(),t.createElementBlock("li",{key:f.properties.place_id,onClick:j=>T(f),class:"px-3 py-2 text-sm cursor-pointer hover:bg-gray-100"},t.toDisplayString(f.properties.display_name),9,sa))),128))])):u.value?(t.openBlock(),t.createElementBlock("div",na,"Шукаю…")):(t.openBlock(),t.createElementBlock("div",la,"Нічого не знайдено"))])):t.createCommentVNode("",!0)])])])])]))}}),aa={class:"bg-white/95 p-2 rounded-xl shadow border border-gray-200"},oa={class:"flex gap-2"},ia=["onClick","title"],ua=["src"],da=t.defineComponent({__name:"map-layers",props:{basemaps:{},defaultLayer:{}},emits:["onLayerChange"],setup(a,{emit:e}){const s=a,n=t.ref(s.defaultLayer??""),l=e;function r(o){l("onLayerChange",o),n.value=o}return(o,i)=>(t.openBlock(),t.createElementBlock("div",aa,[t.createElementVNode("div",oa,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(o.basemaps,(u,c)=>(t.openBlock(),t.createElementBlock("div",{key:c,class:t.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":n.value===c}]),onClick:d=>r(c),title:c,role:"button",tabindex:"0"},[t.createElementVNode("img",{src:u.preview,alt:"",class:"w-14 h-14 object-cover"},null,8,ua)],10,ia))),128))])]))}}),ca={class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},pa={class:"form-geom__panel flex gap-1 items-start mt-2"},ha={class:"flex items-center gap-1"},ma=["disabled"],fa={class:"absolute top-4 right-4 z-[1000]"},ga={class:"flex flex-col gap-[2px]"},ka=["aria-pressed"],ba=["aria-pressed"],ya=["aria-pressed"],xa=["aria-pressed"],_a={class:"absolute bottom-0 left-0 right-0 z-[1000] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},wa={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},Ea={class:"mr-auto"},Va={class:"font-bold"},Ca={class:"flex items-center"},Ba={class:"text-xs mr-2"},va={key:0,class:"text-xs"},Sa={key:1,class:"text-xs"},tt=D(t.defineComponent({__name:"vs-input-map",props:{tools:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(a,{emit:e}){const s=a;console.log(s);const n=e,l=t.ref(null);let r,o,i;const u=t.ref(null),c=t.ref(null),d=t.ref(6),h=t.ref(0),p=t.ref(null),x={topo100:{url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/voyager/ua/13/4790/2762.png"},orto10:{url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4790/2762.png"},osmb:{url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",preview:"https://tile.openstreetmap.org.ua/styles/osm-bright/13/4790/2762.png"}};let S;const A=t.ref("topo100");function M(){return new Promise((g,w)=>{window.L&&window.L.Draw&&g(0);const $=q=>{if(Array.from(document.styleSheets).some(re=>re?.href?.includes(q)))return;const se=document.createElement("link");se.rel="stylesheet",se.href=q,document.head.appendChild(se)},R=q=>new Promise((ye,se)=>{const re=Array.from(document.scripts).find(ne=>ne.src===q);if(re){re.addEventListener("load",()=>ye()),re.addEventListener("error",ne=>se(ne));return}const ae=document.createElement("script");ae.src=q,ae.async=!0,ae.onload=()=>ye(),ae.onerror=ne=>se(ne),document.body.appendChild(ae)});$("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),$("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),R("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>R("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js")).then(()=>g(0)).catch(w)})}function T(){const g=o.toGeoJSON();let w=null;g?.features?.length&&(w=g.features[0].geometry),n("update:modelValue",w),h.value=o.getLayers().length}function _(g=30){const w=o.getLayers();if(!w.length)return;const R=L.featureGroup(w).getBounds();R&&R.isValid()&&r.fitBounds(R,{padding:[g,g]})}function b(){u.value?.click()}const f=t.ref("");function j(g){return g instanceof L.Circle?"Circle":g instanceof L.Rectangle?"Rectangle":g instanceof L.Polygon&&!(g instanceof L.Rectangle)?"Polygon":g instanceof L.Polyline&&!(g instanceof L.Polygon)?"Polyline":g instanceof L.Marker?"Point":"Feature"}function V(g){if(g instanceof L.Circle){const w=g.getRadius();return Math.PI*(w*w)/1e6}if(g instanceof L.Polygon||g instanceof L.Rectangle)try{const w=g.getLatLngs(),$=Array.isArray(w[0])?w[0]:w,R=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea($):0;return R?R/1e6:0}catch{return null}return null}function m(g){return g instanceof L.Circle?g.getLatLng():g.getBounds?g.getBounds().getCenter():g.getLatLng?g.getLatLng():r.getCenter()}function C(){const g=o.getLayers();if(!g.length){p.value=null,h.value=0;return}const w=g[g.length-1],$=j(w),R=m(w),q=V(w);p.value={type:$,center:R,areaKm2:q,layer:w},h.value=g.length}function N(){const g=p.value?.layer;g&&(g instanceof L.Circle&&g.getBounds?r.fitBounds(g.getBounds(),{padding:[30,30]}):g.getBounds?r.fitBounds(g.getBounds(),{padding:[30,30]}):g.getLatLng&&r.setView(g.getLatLng(),Math.max(d.value,14)))}function P(){const g=p.value?.layer;g&&(o.removeLayer(g),T(),C())}t.onMounted(async()=>{await M(),L.drawLocal=kr,r=L.map(l.value,{zoomControl:!1}).setView([50,30],10),L.control.zoom({position:"bottomright"}).addTo(r),S=L.tileLayer(x.topo100.url,{maxZoom:19,minZoom:6}).addTo(r),A.value="topo100",o=new L.FeatureGroup().addTo(r),r.on(L.Draw.Event.CREATED,$=>{const{layer:R}=$;o.clearLayers(),o.addLayer(R),T(),C(),_(),f.value=""}),r.on(L.Draw.Event.EDITED,()=>{T(),C(),_()}),r.on(L.Draw.Event.DELETED,()=>{T(),C(),_()});let g=!1;r.on("mousemove",$=>{g||(r.invalidateSize(),g=!0),c.value=$.latlng}),r.on("zoomend",()=>{d.value=r.getZoom()});const w=br(s.modelValue);if(w){const $=[];L.geoJSON(w).eachLayer(R=>$.push(R)),$.length&&o.addLayer($[0]),T(),C(),_()}});function K(g){if(r){switch(i&&i.disable(),g){case"marker":i=new L.Draw.Marker(r);break;case"polyline":i=new L.Draw.Polyline(r);break;case"polygon":i=new L.Draw.Polygon(r);break;case"rectangle":i=new L.Draw.Rectangle(r);break;default:i=new L.Draw.Rectangle(r);break}i&&(i.enable(),f.value=g)}}function ie(){const g=o.toGeoJSON(),w=new Blob([JSON.stringify(g,null,2)],{type:"application/json"}),$=URL.createObjectURL(w),R=document.createElement("a");R.href=$,R.download="data.geojson",R.click(),URL.revokeObjectURL($)}function ke(g){const w=g.target.files?.[0];if(!w)return;const $=new FileReader;$.onload=()=>{if(typeof $.result=="string")try{const R=JSON.parse($.result);o.clearLayers(),R&&L.geoJSON({type:"Feature",geometry:R}).eachLayer(q=>{o.addLayer(q)}),T(),C(),_()}finally{g.target.value=""}},$.readAsText(w)}function X(g){r&&(S&&r.removeLayer(S),S=L.tileLayer(x[g].url,{maxZoom:19,minZoom:6}).addTo(r),A.value=g)}function Ie(g){const w=L.latLng(g[0],g[1]);r.setView(w,13)}t.watch(()=>s.modelValue,g=>{o.clearLayers(),g&&L.geoJSON({type:"Feature",geometry:g}).eachLayer(w=>{o.addLayer(w)}),h.value=o.getLayers().length,C(),_()});const be=t.ref(!1);return(g,w)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:be.value}])},[t.createElementVNode("div",{ref_key:"mapContainer",ref:l,class:"w-full h-full"},null,512),t.createElementVNode("div",ca,[t.createVNode(ra,{onGoToCoordinates:Ie}),t.createElementVNode("div",pa,[t.createElementVNode("div",ha,[t.createElementVNode("button",{type:"button",class:"vs-btn-row",onClick:b},"Import"),t.createElementVNode("button",{type:"button",class:"vs-btn-row",onClick:ie,disabled:h.value===0},"Export ",8,ma)]),t.createElementVNode("input",{ref_key:"importRef",ref:u,type:"file",onChange:ke,accept:".json,.geojson",class:"hidden"},null,544)])]),t.createElementVNode("div",fa,[t.createElementVNode("div",ga,[t.createElementVNode("button",{class:t.normalizeClass(["vs-btn",{"vs-active":f.value==="marker"}]),"aria-pressed":f.value==="marker",title:"Point (P)","aria-label":"Draw point",onClick:w[0]||(w[0]=$=>K("marker"))},[t.createVNode(wr)],10,ka),t.createElementVNode("button",{class:t.normalizeClass(["vs-btn",{"vs-active":f.value==="polyline"}]),"aria-pressed":f.value==="polyline",title:"Line (L)","aria-label":"Draw polyline",onClick:w[1]||(w[1]=$=>K("polyline"))},[t.createVNode(Br)],10,ba),t.createElementVNode("button",{class:t.normalizeClass(["vs-btn",{"vs-active":f.value==="polygon"}]),"aria-pressed":f.value==="polygon",title:"Polygon (G)","aria-label":"Draw polygon",onClick:w[2]||(w[2]=$=>K("polygon"))},[t.createVNode(Nr)],10,ya),t.createElementVNode("button",{class:t.normalizeClass(["vs-btn",{"vs-active":f.value==="rectangle"}]),"aria-pressed":f.value==="rectangle",title:"Rectangle (R)","aria-label":"Draw rectangle",onClick:w[3]||(w[3]=$=>K("rectangle"))},[t.createVNode(Dr)],10,xa),t.createElementVNode("button",{class:"vs-btn mt-5",onClick:w[4]||(w[4]=$=>be.value=!be.value),title:"Full Screen","aria-label":"Full Screen"},[t.createVNode(Rr,{style:{width:"12px",height:"12px"}})])])]),t.createElementVNode("div",{class:t.normalizeClass(["absolute left-4 z-[1000]",p.value?"bottom-8":"bottom-4"])},[t.createVNode(da,{basemaps:x,"default-layer":"topo100",onOnLayerChange:X})],2),t.createElementVNode("div",_a,[p.value?(t.openBlock(),t.createElementBlock("div",wa,[t.createElementVNode("div",Ea,[w[7]||(w[7]=t.createTextVNode(" Тип: ")),t.createElementVNode("span",Va,t.toDisplayString(p.value.type),1)]),t.createElementVNode("div",Ca,[t.createElementVNode("div",Ba,[w[8]||(w[8]=t.createTextVNode(" Центр: ")),t.createElementVNode("b",null,t.toDisplayString(p.value.center.lat.toFixed(5))+", "+t.toDisplayString(p.value.center.lng.toFixed(5)),1)]),p.value.areaKm2!==null?(t.openBlock(),t.createElementBlock("div",va,[w[9]||(w[9]=t.createTextVNode(" Площа: ")),t.createElementVNode("b",null,t.toDisplayString(p.value.areaKm2.toFixed(1))+"км²",1)])):(t.openBlock(),t.createElementBlock("div",Sa,w[10]||(w[10]=[t.createTextVNode(" Площа: "),t.createElementVNode("b",null,"—",-1)]))),t.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Наблизити",onClick:w[5]||(w[5]=$=>N())},w[11]||(w[11]=[t.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-3 h-3" data-v-55d330eb><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" data-v-55d330eb></path><path d="M7 10l6 0" data-v-55d330eb></path><path d="M10 7l0 6" data-v-55d330eb></path><path d="M21 21l-6 -6" data-v-55d330eb></path></svg>',1)])),t.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Видалити",onClick:w[6]||(w[6]=$=>P())},[t.createVNode(_e,{class:"w-3 h-3"})])])])):t.createCommentVNode("",!0)])],2))}}),[["__scopeId","data-v-55d330eb"]]),Fa=["data-focus"],Na={class:"flex items-center"},Aa={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},Ma=["onClick","aria-label"],$a={key:0,class:"absolute text-gray-500 truncate pl-2"},Da={class:"flex-1 min-w-[2px]"},Ia=["placeholder"],La={class:"flex items-center shrink-0"},Ta=["disabled"],st=t.defineComponent({__name:"vs-input-tag",props:t.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"}},{modelValue:{default:[]},modelModifiers:{}}),emits:t.mergeModels(["update:modelValue"],["update:modelValue"]),setup(a,{emit:e}){const s=a,n=e;Q(s.style);const l=t.ref(null),r=t.ref(null),o=t.ref(null),i=t.ref(!1),u=t.ref(""),c=t.useModel(a,"modelValue"),d=t.computed(()=>s.placeholder||"Add tag…"),h=t.computed(()=>c.value?.length===0&&u.value===""),p=t.computed(()=>!s.disabled&&c.value?.length>0),x=t.computed(()=>s.disabled),S=async()=>{x.value||await t.nextTick(()=>o.value?.focus())},A=V=>{const m=V.trim();m!==""&&(!c.value||!Array.isArray(c.value)?c.value=[m]:s.unique?c.value.includes(m)||(c.value=[...c.value,m]):c.value=[...c.value,m],u.value="")},M=()=>{const V=u.value;V.trim()!==""&&A(V),u.value=""},T=V=>{const m=c.value.slice();m.splice(V,1),n("update:modelValue",m)},_=()=>{n("update:modelValue",[])},b=()=>{x.value||(i.value=!0)},f=()=>{i.value=!1},j=V=>{const{key:m}=V;m==="Enter"?(V.preventDefault(),M()):m==="Backspace"&&u.value===""&&c.value.length>0&&T(c.value.length-1)};return(V,m)=>(t.openBlock(),t.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:l,onClick:m[1]||(m[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",{class:t.normalizeClass(["relative w-full font-sans",s.customClass]),role:"group","aria-label":"Tag input"},[t.createElementVNode("div",{class:t.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",i.value?"border-blue-500 ring-1 ring-blue-500":"",x.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:S},[t.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:r},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,(C,N)=>(t.openBlock(),t.createElementBlock("div",{key:N,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[t.createElementVNode("div",Na,[t.createElementVNode("div",Aa,t.toDisplayString(C),1)]),t.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:t.withModifiers(P=>T(N),["stop"]),"aria-label":`Remove ${C}`},m[2]||(m[2]=[t.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[t.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,Ma)]))),128)),h.value?(t.openBlock(),t.createElementBlock("div",$a,t.toDisplayString(d.value),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Da,[x.value?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputRef",ref:o,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":m[0]||(m[0]=C=>u.value=C),onFocus:b,onBlur:f,onKeydown:j,placeholder:c.value&&c.value.length?"":void 0},null,40,Ia)),[[t.vModelText,u.value]])])],512),t.createElementVNode("div",La,[p.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:x.value,onClick:t.withModifiers(_,["stop"])},m[3]||(m[3]=[t.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[t.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,Ta)):t.createCommentVNode("",!0)])],10,Fa)],2)],512))}}),nt={VsInputText:ve,VsInputRadio:Ne,"vs-input-text":ve,"vs-input-textarea":Xe,"vs-input-mask":Oe,"vs-input-number":Te,"vs-input-radio":Ne,"vs-input-select":We,"vs-input-switcher":Se,"vs-input-static":Fe,"vs-input-container":Ye,"vs-input-date":Ue,"vs-input-checkbox":je,"vs-input-file":Ge,"vs-input-html":Fe,"vs-input-email":ze,"vs-input-datatable":et,"vs-input-map":tt,"vs-input-file-list":Ke,"vs-input-tag":st},Ra=t.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(a){const e=a,s=t.inject("values");async function n(){try{if(!e.api)return;const l=e.api.replace("{{value}}",e.value),r=await fetch(l);if(!r.ok){Z.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const o=await r.json();if(!e.set||!s)return;for(const[i,u]of Object.entries(e.set))s.value[i]=o.result[u]}catch(l){console.error(e.error,l)}}return(l,r)=>(t.openBlock(),t.createElementBlock("button",{onClick:n,class:"vs-button relative inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-blue-500 hover:border-blue-500 hover:bg-blue-500 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 ml-0 md:ml-2 mt-2 md:mt-0 py-[8px] md:w-2/4 whitespace-nowrap w-full"},t.toDisplayString(l.button),1))}}),Oa={class:"flex w-full"},lt=t.defineComponent({__name:"vs-compact-form-layout",props:t.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(a){const e=a,s=t.useModel(a,"modelValue"),n=t.computed(()=>Dt[`${e.layout}`]),l=t.computed(()=>nt?.[`vs-input-${e.item.type}`]),r=t.computed(()=>{const i=t.unref(l);if(!i)return new Set;const u=i.props??i.__vccOpts?.props;if(!u)return new Set;const c=Array.isArray(u)?u:Object.keys(u);return new Set(c)}),o=t.computed(()=>{const i=e.item??{},u=r.value;return u.size?Object.fromEntries(Object.entries(i).filter(([c])=>u.has(c))):{}});return(i,u)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(n.value),{ua:e.item.ua,error:e.error||"",item:i.item,label:e.item.label},{default:t.withCtx(()=>[t.createElementVNode("div",Oa,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(l.value),t.mergeProps(o.value,{modelValue:s.value,"onUpdate:modelValue":u[0]||(u[0]=c=>s.value=c)}),null,16,["modelValue"])),i.item.behavior?(t.openBlock(),t.createBlock(Ra,t.mergeProps({key:0},i.item.behavior,{value:s.value}),null,16,["value"])):t.createCommentVNode("",!0)])]),_:1},8,["ua","error","item","label"]))}}),rt={required:"Це поле є обов’язковим",email:"Неправильний email"},za=a=>a?!1:rt.required,ja=a=>!a&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(a)?rt.email:!1,Ua=(a,e)=>{const s=e.pattern??e.regexp;return!(typeof s=="string"?new RegExp(s):s).test(a)&&a?e.message:!1},Pa=(a,e)=>!1,Ha=(a,e)=>{switch(typeof e=="string"?e:e.type){case"required":return za(a);case"email":return ja(a);case"regexp":return Ua(a,e);case"custom":return Pa();default:return!1}},qa={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file"};function at(a){const e=a.toLowerCase();return qa[e]||e}function Ga(a){if(Array.isArray(a)){const s=[];return a.forEach(n=>{const l={...n};l.name=(n.name||n.id||n.key||"").toString(),l.type=at(n.type),l.label=n.label||n.ua,l.rules=n.rules||n.validators,n.data&&(l.api=`/api/suggest/${n.data}`),s.push(l)}),s}const e=[];return Object.entries(a).forEach(s=>{const n={name:s[0],...s[1],type:at(s[1].type),label:s[1].label||s[1].ua,rules:s[1].rules||s[1].validators};s[1].type.includes("list")&&(n.multiple=!0),s[1].data&&(n.api=`/api/suggest/${s[1].data}`),e.push(n)}),e}function Ka(a,e){const s=Ga(e),n=t.ref({});function l(u){const c=u?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,h=a?.value?.[d];return Ze(h,c)}const r=(u=s,c=!0)=>(u.forEach(d=>{if(d.rules){if(!l(d)){delete n.value[d.name];return}d.rules.forEach(h=>{const p=Ha(a.value[d.name],h);p?n.value[d.name]=p:delete n.value[d.name]})}d.schema&&r(d.schema,!1)}),c&&Object.values(n.value).some(Boolean)?n.value:null),o=t.computed(()=>s?.filter(u=>l(u)));return{errors:n,validate:r,reset:()=>{a.value={},n.value={}},visibleSchema:o}}const ce=t.defineComponent({__name:"vs-compact-form",props:t.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:t.mergeModels(["handle-submit","update:modelValue"],["update:form","update:values"]),setup(a,{expose:e,emit:s}){const n=s,l=a,r=t.useModel(a,"form"),o=t.useModel(a,"values"),{errors:i,validate:u,reset:c,visibleSchema:d}=Ka(o,l.schema),h=()=>{n("update:modelValue",o.value),u(),n("handle-submit",o.value)};e({validate:u,reset:c,errors:i}),t.onMounted(()=>{l.modelValue&&(o.value=l.modelValue),r.value.value=o.value,r.value.errors=i.value,r.value.reset=c,r.value.validate=u,r.value.formId=l.formId});function p(x,S){if(x===S)return!0;if(typeof x!="object"||typeof S!="object"||!x||!S)return!1;const A=Object.keys(x),M=Object.keys(S);return A.length!==M.length?!1:A.every(T=>x[T]===S[T])}return t.provide("form",r),t.provide("values",o),(x,S)=>(t.openBlock(),t.createElementBlock("form",{onSubmit:t.withModifiers(h,["prevent"]),class:t.normalizeClass(["grid grid-cols-12",x.layout==="default"?"gap-6":"gap-4"])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(d),A=>(t.openBlock(),t.createBlock(lt,{key:A.name,class:t.normalizeClass(x.layout==="horizontal"?"col-span-12":`col-span-${A.col||12} `),style:t.normalizeStyle(x.style),item:A,layout:x.layout,"model-value":o.value[A.name],"onUpdate:modelValue":M=>{const T=o.value[A.name];p(T,M)||(o.value[A.name]=M)},error:t.unref(i)[A.name]},null,8,["class","style","item","layout","model-value","onUpdate:modelValue","error"]))),128))],34))}});ce.install=function(e){e.component("VForm",ce),Object.assign(e.config.globalProperties,{$form:de}),e.provide("form",de),window.v3plugin||(window.v3plugin={})};function ee(a){return typeof a=="string"||a instanceof String}function ot(a){var e;return typeof a=="object"&&a!=null&&(a==null||(e=a.constructor)==null?void 0:e.name)==="Object"}function it(a,e){return Array.isArray(e)?it(a,(s,n)=>e.includes(n)):Object.entries(a).reduce((s,n)=>{let[l,r]=n;return e(r,l)&&(s[l]=r),s},{})}const E={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function ut(a){switch(a){case E.LEFT:return E.FORCE_LEFT;case E.RIGHT:return E.FORCE_RIGHT;default:return a}}function Ae(a){return a.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Ee(a,e){if(e===a)return!0;const s=Array.isArray(e),n=Array.isArray(a);let l;if(s&&n){if(e.length!=a.length)return!1;for(l=0;l<e.length;l++)if(!Ee(e[l],a[l]))return!1;return!0}if(s!=n)return!1;if(e&&a&&typeof e=="object"&&typeof a=="object"){const r=e instanceof Date,o=a instanceof Date;if(r&&o)return e.getTime()==a.getTime();if(r!=o)return!1;const i=e instanceof RegExp,u=a instanceof RegExp;if(i&&u)return e.toString()==a.toString();if(i!=u)return!1;const c=Object.keys(e);for(l=0;l<c.length;l++)if(!Object.prototype.hasOwnProperty.call(a,c[l]))return!1;for(l=0;l<c.length;l++)if(!Ee(a[c[l]],e[c[l]]))return!1;return!0}else if(e&&a&&typeof e=="function"&&typeof a=="function")return e.toString()===a.toString();return!1}class Za{constructor(e){for(Object.assign(this,e);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?E.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?E.RIGHT:E.LEFT}}function B(a,e){return new B.InputMask(a,e)}function dt(a){if(a==null)throw new Error("mask property should be defined");return a instanceof RegExp?B.MaskedRegExp:ee(a)?B.MaskedPattern:a===Date?B.MaskedDate:a===Number?B.MaskedNumber:Array.isArray(a)||a===Array?B.MaskedDynamic:B.Masked&&a.prototype instanceof B.Masked?a:B.Masked&&a instanceof B.Masked?a.constructor:a instanceof Function?B.MaskedFunction:(console.warn("Mask not found for mask",a),B.Masked)}function oe(a){if(!a)throw new Error("Options in not defined");if(B.Masked){if(a.prototype instanceof B.Masked)return{mask:a};const{mask:e=void 0,...s}=a instanceof B.Masked?{mask:a}:ot(a)&&a.mask instanceof B.Masked?a:{};if(e){const n=e.mask;return{...it(e,(l,r)=>!r.startsWith("_")),mask:e.constructor,_mask:n,...s}}}return ot(a)?{...a}:{mask:a}}function Y(a){if(B.Masked&&a instanceof B.Masked)return a;const e=oe(a),s=dt(e.mask);if(!s)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===s&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new s(e)}B.createMask=Y;class Ve{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return e??this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return e??this.value.length}select(e,s){if(!(e==null||s==null||e===this.selectionStart&&s===this.selectionEnd))try{this._unsafeSelect(e,s)}catch{}}get isActive(){return!1}}B.MaskElement=Ve;const ct=90,Ya=89;class pe extends Ve{constructor(e){super(),this.input=e,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var e,s,n;return(e=(s=(n=this.input).getRootNode)==null?void 0:s.call(n))!=null?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){if(this._handlers.redo&&(e.keyCode===ct&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===Ya&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===ct&&(e.metaKey||e.ctrlKey))return e.preventDefault(),this._handlers.undo(e);e.isComposing||this._handlers.selectionChange(e)}_onBeforeinput(e){if(e.inputType==="historyUndo"&&this._handlers.undo)return e.preventDefault(),this._handlers.undo(e);if(e.inputType==="historyRedo"&&this._handlers.redo)return e.preventDefault(),this._handlers.redo(e)}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}B.HTMLMaskElement=pe;class pt extends pe{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,s){this.input.setSelectionRange(e,s)}get value(){return this.input.value}set value(e){this.input.value=e}}B.HTMLMaskElement=pe;class Me extends pe{get _unsafeSelectionStart(){const e=this.rootElement,s=e.getSelection&&e.getSelection(),n=s&&s.anchorOffset,l=s&&s.focusOffset;return l==null||n==null||n<l?n:l}get _unsafeSelectionEnd(){const e=this.rootElement,s=e.getSelection&&e.getSelection(),n=s&&s.anchorOffset,l=s&&s.focusOffset;return l==null||n==null||n>l?n:l}_unsafeSelect(e,s){if(!this.rootElement.createRange)return;const n=this.rootElement.createRange();n.setStart(this.input.firstChild||this.input,e),n.setEnd(this.input.lastChild||this.input,s);const l=this.rootElement,r=l.getSelection&&l.getSelection();r&&(r.removeAllRanges(),r.addRange(n))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}B.HTMLContenteditableMaskElement=Me;class Ce{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>Ce.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}Ce.MAX_LENGTH=100;class ht{constructor(e,s){this.el=e instanceof Ve?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new Me(e):new pt(e),this.masked=Y(s),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Ce,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(e){var s;return e==null||((s=this.masked)==null?void 0:s.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof B.Masked)&&this.masked.constructor===dt(e)){this.masked.updateOptions({mask:e});return}const s=e instanceof B.Masked?e:Y({mask:e});s.unmaskedValue=this.masked.unmaskedValue,this.masked=s}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(e,s){const n=this._listeners[e];n&&n.forEach(l=>l(s))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){!this.el||!this.el.isActive||(this.el.select(e,e),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(e){const s=this.masked.unmaskedValue,n=this.masked.value,l=this.masked.rawInputValue,r=this.displayValue,o=this.unmaskedValue!==s||this.value!==n||this._rawInputValue!==l;this._unmaskedValue=s,this._value=n,this._rawInputValue=l,this.el.value!==r&&(this.el.value=r),e==="auto"?this.alignCursor():e!=null&&(this.cursorPos=e),o&&this._fireChangeEvents(),!this._historyChanging&&(o||this.history.isEmpty)&&this.history.push({unmaskedValue:s,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:s,...n}=e,l=!this.maskEquals(s),r=this.masked.optionsIsChanged(n);l&&(this.mask=s),r&&this.masked.updateOptions(n),(l||r)&&this.updateControl()}updateCursor(e){e!=null&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,E.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,s){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(s),this}off(e,s){if(!this._listeners[e])return this;if(!s)return delete this._listeners[e],this;const n=this._listeners[e].indexOf(s);return n>=0&&this._listeners[e].splice(n,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const s=new Za({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),n=this.masked.rawInputValue,l=this.masked.splice(s.startChangePos,s.removed.length,s.inserted,s.removeDirection,{input:!0,raw:!0}).offset,r=n===this.masked.rawInputValue?s.removeDirection:E.NONE;let o=this.masked.nearestInputPos(s.startChangePos+l,r);r!==E.NONE&&(o=this.masked.nearestInputPos(o,E.NONE)),this.updateControl(o),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}B.InputMask=ht;class v{static normalize(e){return Array.isArray(e)?e:[e,new v]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}B.ChangeDetails=v;class J{constructor(e,s,n){e===void 0&&(e=""),s===void 0&&(s=0),this.value=e,this.from=s,this.stop=n}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||e!=null&&this.from>=e)return"";const s=this.value[0];return this.value=this.value.slice(1),s}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class O{constructor(e){this._value="",this._update({...O.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,s){s===void 0&&(s={input:!0}),this.reset(),this.append(e,s,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,s){return e}totalInputPositions(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),Math.min(this.displayValue.length,s-e)}extractInput(e,s,n){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),this.displayValue.slice(e,s)}extractTail(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),new J(this.extractInput(e,s),e)}appendTail(e){return ee(e)&&(e=new J(String(e))),e.appendTo(this)}_appendCharRaw(e,s){return e?(this._value+=e,new v({inserted:e,rawInserted:e})):new v}_appendChar(e,s,n){s===void 0&&(s={});const l=this.state;let r;if([e,r]=this.doPrepareChar(e,s),e&&(r=r.aggregate(this._appendCharRaw(e,s)),!r.rawInserted&&this.autofix==="pad")){const o=this.state;this.state=l;let i=this.pad(s);const u=this._appendCharRaw(e,s);i=i.aggregate(u),u.rawInserted||i.equals(r)?r=i:this.state=o}if(r.inserted){let o,i=this.doValidate(s)!==!1;if(i&&n!=null){const u=this.state;if(this.overwrite===!0){o=n.state;for(let d=0;d<r.rawInserted.length;++d)n.unshift(this.displayValue.length-r.tailShift)}let c=this.appendTail(n);if(i=c.rawInserted.length===n.toString().length,!(i&&c.inserted)&&this.overwrite==="shift"){this.state=u,o=n.state;for(let d=0;d<r.rawInserted.length;++d)n.shift();c=this.appendTail(n),i=c.rawInserted.length===n.toString().length}i&&c.inserted&&(this.state=u)}i||(r=new v,this.state=l,n&&o&&(n.state=o))}return r}_appendPlaceholder(){return new v}_appendEager(){return new v}append(e,s,n){if(!ee(e))throw new Error("value should be string");const l=ee(n)?new J(String(n)):n;s!=null&&s.tail&&(s._beforeTailState=this.state);let r;[e,r]=this.doPrepare(e,s);for(let o=0;o<e.length;++o){const i=this._appendChar(e[o],s,l);if(!i.rawInserted&&!this.doSkipInvalid(e[o],s,l))break;r.aggregate(i)}return(this.eager===!0||this.eager==="append")&&s!=null&&s.input&&e&&r.aggregate(this._appendEager()),l!=null&&(r.tailShift+=this.appendTail(l).tailShift),r}remove(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(s),new v}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const s=this.rawInputValue,n=this.value,l=e();return this.rawInputValue=s,this.value&&this.value!==n&&n.indexOf(this.value)===0&&(this.append(n.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,l}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const s=this.state,n=e(this);return this.state=s,delete this._isolated,n}doSkipInvalid(e,s,n){return!!this.skipInvalid}doPrepare(e,s){return s===void 0&&(s={}),v.normalize(this.prepare?this.prepare(e,this,s):e)}doPrepareChar(e,s){return s===void 0&&(s={}),v.normalize(this.prepareChar?this.prepareChar(e,this,s):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,s,n,l,r){n===void 0&&(n=""),l===void 0&&(l=E.NONE),r===void 0&&(r={input:!0});const o=e+s,i=this.extractTail(o),u=this.eager===!0||this.eager==="remove";let c;u&&(l=ut(l),c=this.extractInput(0,o,{raw:!0}));let d=e;const h=new v;if(l!==E.NONE&&(d=this.nearestInputPos(e,s>1&&e!==0&&!u?E.NONE:l),h.tailShift=d-e),h.aggregate(this.remove(d)),u&&l!==E.NONE&&c===this.rawInputValue)if(l===E.FORCE_LEFT){let p;for(;c===this.rawInputValue&&(p=this.displayValue.length);)h.aggregate(new v({tailShift:-1})).aggregate(this.remove(p-1))}else l===E.FORCE_RIGHT&&i.unshift();return h.aggregate(this.append(n,r,i))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!Ee(this,e)}typedValueEquals(e){const s=this.typedValue;return e===s||O.EMPTY_VALUES.includes(e)&&O.EMPTY_VALUES.includes(s)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new v}}O.DEFAULTS={skipInvalid:!0},O.EMPTY_VALUES=[void 0,null,""],B.Masked=O;class te{constructor(e,s){e===void 0&&(e=[]),s===void 0&&(s=0),this.chunks=e,this.from=s}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=ee(e)?new J(String(e)):e;const s=this.chunks[this.chunks.length-1],n=s&&(s.stop===e.stop||e.stop==null)&&e.from===s.from+s.toString().length;if(e instanceof J)n?s.extend(e.toString()):this.chunks.push(e);else if(e instanceof te){if(e.stop==null){let l;for(;e.chunks.length&&e.chunks[0].stop==null;)l=e.chunks.shift(),l.from+=e.from,this.extend(l)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof B.MaskedPattern))return new J(this.toString()).appendTo(e);const s=new v;for(let n=0;n<this.chunks.length;++n){const l=this.chunks[n],r=e._mapPosToBlock(e.displayValue.length),o=l.stop;let i;if(o!=null&&(!r||r.index<=o)&&((l instanceof te||e._stops.indexOf(o)>=0)&&s.aggregate(e._appendPlaceholder(o)),i=l instanceof te&&e._blocks[o]),i){const u=i.appendTail(l);s.aggregate(u);const c=l.toString().slice(u.rawInserted.length);c&&s.aggregate(e.append(c,{tail:!0}))}else s.aggregate(e.append(l.toString(),{tail:!0}))}return s}get state(){return{chunks:this.chunks.map(e=>e.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:s,...n}=e;Object.assign(this,n),this.chunks=s.map(l=>{const r="chunks"in l?new te:new J;return r.state=l,r})}unshift(e){if(!this.chunks.length||e!=null&&this.from>=e)return"";const s=e!=null?e-this.from:e;let n=0;for(;n<this.chunks.length;){const l=this.chunks[n],r=l.unshift(s);if(l.toString()){if(!r)break;++n}else this.chunks.splice(n,1);if(r)return r}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const s=this.chunks[e],n=s.shift();if(s.toString()){if(!n)break;--e}else this.chunks.splice(e,1);if(n)return n}return""}}class Ja{constructor(e,s){this.masked=e,this._log=[];const{offset:n,index:l}=e._mapPosToBlock(s)||(s<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=n,this.index=l,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((s=this.block)==null?void 0:s.displayValue.length)||0){var s;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,E.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,E.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,E.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,E.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,E.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,E.NONE),!0})}}class $e{constructor(e){Object.assign(this,e),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(e,s){return e===void 0&&(e=0),s===void 0&&(s=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(s),this._value||(this._isRawInput=!1),new v}nearestInputPos(e,s){s===void 0&&(s=E.NONE);const n=0,l=this._value.length;switch(s){case E.LEFT:case E.FORCE_LEFT:return n;case E.NONE:case E.RIGHT:case E.FORCE_RIGHT:default:return l}}totalInputPositions(e,s){return e===void 0&&(e=0),s===void 0&&(s=this._value.length),this._isRawInput?s-e:0}extractInput(e,s,n){return e===void 0&&(e=0),s===void 0&&(s=this._value.length),n===void 0&&(n={}),n.raw&&this._isRawInput&&this._value.slice(e,s)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(e,s){if(s===void 0&&(s={}),this.isFilled)return new v;const n=this.eager===!0||this.eager==="append",r=this.char===e&&(this.isUnmasking||s.input||s.raw)&&(!s.raw||!n)&&!s.tail,o=new v({inserted:this.char,rawInserted:r?this.char:""});return this._value=this.char,this._isRawInput=r&&(s.raw||s.input),o}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new v;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new J("")}appendTail(e){return ee(e)&&(e=new J(String(e))),e.appendTo(this)}append(e,s,n){const l=this._appendChar(e[0],s);return n!=null&&(l.tailShift+=this.appendTail(n).tailShift),l}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=!!e._rawInputValue}pad(e){return this._appendPlaceholder()}}class he{constructor(e){const{parent:s,isOptional:n,placeholderChar:l,displayChar:r,lazy:o,eager:i,...u}=e;this.masked=Y(u),Object.assign(this,{parent:s,isOptional:n,placeholderChar:l,displayChar:r,lazy:o,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.value.length),e===0&&s>=1?(this.isFilled=!1,this.masked.remove(e,s)):new v}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(e,s){if(s===void 0&&(s={}),this.isFilled)return new v;const n=this.masked.state;let l=this.masked._appendChar(e,this.currentMaskFlags(s));return l.inserted&&this.doValidate(s)===!1&&(l=new v,this.masked.state=n),!l.inserted&&!this.isOptional&&!this.lazy&&!s.input&&(l.inserted=this.placeholderChar),l.skip=!l.inserted&&!this.isOptional,this.isFilled=!!l.inserted,l}append(e,s,n){return this.masked.append(e,this.currentMaskFlags(s),n)}_appendPlaceholder(){return this.isFilled||this.isOptional?new v:(this.isFilled=!0,new v({inserted:this.placeholderChar}))}_appendEager(){return new v}extractTail(e,s){return this.masked.extractTail(e,s)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,s,n){return e===void 0&&(e=0),s===void 0&&(s=this.value.length),this.masked.extractInput(e,s,n)}nearestInputPos(e,s){s===void 0&&(s=E.NONE);const n=0,l=this.value.length,r=Math.min(Math.max(e,n),l);switch(s){case E.LEFT:case E.FORCE_LEFT:return this.isComplete?r:n;case E.RIGHT:case E.FORCE_RIGHT:return this.isComplete?r:l;case E.NONE:default:return r}}totalInputPositions(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.value.length),this.value.slice(e,s).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var s;return{...e,_beforeTailState:(e==null||(s=e._beforeTailState)==null?void 0:s.masked)||e?._beforeTailState}}pad(e){return new v}}he.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class mt extends O{updateOptions(e){super.updateOptions(e)}_update(e){const s=e.mask;s&&(e.validate=n=>n.search(s)>=0),super._update(e)}}B.MaskedRegExp=mt;class z extends O{constructor(e){super({...z.DEFAULTS,...e,definitions:Object.assign({},he.DEFAULT_DEFINITIONS,e?.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const s=this.mask;if(!s||!e)return;let n=!1,l=!1;for(let r=0;r<s.length;++r){if(this.blocks){const c=s.slice(r),d=Object.keys(this.blocks).filter(p=>c.indexOf(p)===0);d.sort((p,x)=>x.length-p.length);const h=d[0];if(h){const{expose:p,repeat:x,...S}=oe(this.blocks[h]),A={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...S,repeat:x,parent:this},M=x!=null?new B.RepeatBlock(A):Y(A);M&&(this._blocks.push(M),p&&(this.exposeBlock=M),this._maskedBlocks[h]||(this._maskedBlocks[h]=[]),this._maskedBlocks[h].push(this._blocks.length-1)),r+=h.length-1;continue}}let o=s[r],i=o in e;if(o===z.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(o==="{"||o==="}"){n=!n;continue}if(o==="["||o==="]"){l=!l;continue}if(o===z.ESCAPE_CHAR){if(++r,o=s[r],!o)break;i=!1}const u=i?new he({isOptional:l,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...oe(e[o]),parent:this}):new $e({char:o,eager:this.eager,isUnmasking:n});this._blocks.push(u)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e){this.reset();return}const{_blocks:s,...n}=e;this._blocks.forEach((l,r)=>l.state=s[r]),super.state=n}reset(){super.reset(),this._blocks.forEach(e=>e.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(e=>e.isComplete)}get isFilled(){return this._blocks.every(e=>e.isFilled)}get isFixed(){return this._blocks.every(e=>e.isFixed)}get isOptional(){return this._blocks.every(e=>e.isOptional)}doCommit(){this._blocks.forEach(e=>e.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((e,s)=>e+=s.unmaskedValue,"")}set unmaskedValue(e){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(s),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((e,s)=>e+=s.value,"")}set value(e){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(s),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(s),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce((e,s)=>e+=s.displayValue,"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const s=new v;let n=(e=this._mapPosToBlock(this.displayValue.length))==null?void 0:e.index;if(n==null)return s;this._blocks[n].isFilled&&++n;for(let l=n;l<this._blocks.length;++l){const r=this._blocks[l]._appendEager();if(!r.inserted)break;s.aggregate(r)}return s}_appendCharRaw(e,s){s===void 0&&(s={});const n=this._mapPosToBlock(this.displayValue.length),l=new v;if(!n)return l;for(let o=n.index,i;i=this._blocks[o];++o){var r;const u=i._appendChar(e,{...s,_beforeTailState:(r=s._beforeTailState)==null||(r=r._blocks)==null?void 0:r[o]});if(l.aggregate(u),u.consumed)break}return l}extractTail(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length);const n=new te;return e===s||this._forEachBlocksInRange(e,s,(l,r,o,i)=>{const u=l.extractTail(o,i);u.stop=this._findStopBefore(r),u.from=this._blockStartPos(r),u instanceof te&&(u.blockIndex=r),n.extend(u)}),n}extractInput(e,s,n){if(e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),n===void 0&&(n={}),e===s)return"";let l="";return this._forEachBlocksInRange(e,s,(r,o,i,u)=>{l+=r.extractInput(i,u,n)}),l}_findStopBefore(e){let s;for(let n=0;n<this._stops.length;++n){const l=this._stops[n];if(l<=e)s=l;else break}return s}_appendPlaceholder(e){const s=new v;if(this.lazy&&e==null)return s;const n=this._mapPosToBlock(this.displayValue.length);if(!n)return s;const l=n.index,r=e??this._blocks.length;return this._blocks.slice(l,r).forEach(o=>{if(!o.lazy||e!=null){var i;s.aggregate(o._appendPlaceholder((i=o._blocks)==null?void 0:i.length))}}),s}_mapPosToBlock(e){let s="";for(let n=0;n<this._blocks.length;++n){const l=this._blocks[n],r=s.length;if(s+=l.displayValue,e<=s.length)return{index:n,offset:e-r}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce((s,n)=>s+=n.displayValue.length,0)}_forEachBlocksInRange(e,s,n){s===void 0&&(s=this.displayValue.length);const l=this._mapPosToBlock(e);if(l){const r=this._mapPosToBlock(s),o=r&&l.index===r.index,i=l.offset,u=r&&o?r.offset:this._blocks[l.index].displayValue.length;if(n(this._blocks[l.index],l.index,i,u),r&&!o){for(let c=l.index+1;c<r.index;++c)n(this._blocks[c],c,0,this._blocks[c].displayValue.length);n(this._blocks[r.index],r.index,0,r.offset)}}}remove(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length);const n=super.remove(e,s);return this._forEachBlocksInRange(e,s,(l,r,o,i)=>{n.aggregate(l.remove(o,i))}),n}nearestInputPos(e,s){if(s===void 0&&(s=E.NONE),!this._blocks.length)return 0;const n=new Ja(this,e);if(s===E.NONE)return n.pushRightBeforeInput()||(n.popState(),n.pushLeftBeforeInput())?n.pos:this.displayValue.length;if(s===E.LEFT||s===E.FORCE_LEFT){if(s===E.LEFT){if(n.pushRightBeforeFilled(),n.ok&&n.pos===e)return e;n.popState()}if(n.pushLeftBeforeInput(),n.pushLeftBeforeRequired(),n.pushLeftBeforeFilled(),s===E.LEFT){if(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.ok&&n.pos<=e||(n.popState(),n.ok&&n.pos<=e))return n.pos;n.popState()}return n.ok?n.pos:s===E.FORCE_LEFT?0:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:0)}return s===E.RIGHT||s===E.FORCE_RIGHT?(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.pushRightBeforeFilled()?n.pos:s===E.FORCE_RIGHT?this.displayValue.length:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:this.nearestInputPos(e,E.LEFT))):e}totalInputPositions(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length);let n=0;return this._forEachBlocksInRange(e,s,(l,r,o,i)=>{n+=l.totalInputPositions(o,i)}),n}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const s=this._maskedBlocks[e];return s?s.map(n=>this._blocks[n]):[]}pad(e){const s=new v;return this._forEachBlocksInRange(0,this.displayValue.length,n=>s.aggregate(n.pad(e))),s}}z.DEFAULTS={...O.DEFAULTS,lazy:!0,placeholderChar:"_"},z.STOP_CHAR="`",z.ESCAPE_CHAR="\\",z.InputDefinition=he,z.FixedDefinition=$e,B.MaskedPattern=z;class me extends z{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:s=this.to||0,from:n=this.from||0,maxLength:l=this.maxLength||0,autofix:r=this.autofix,...o}=e;this.to=s,this.from=n,this.maxLength=Math.max(String(s).length,l),this.autofix=r;const i=String(this.from).padStart(this.maxLength,"0"),u=String(this.to).padStart(this.maxLength,"0");let c=0;for(;c<u.length&&u[c]===i[c];)++c;o.mask=u.slice(0,c).replace(/0/g,"\\0")+"0".repeat(this.maxLength-c),super._update(o)}get isComplete(){return super.isComplete&&!!this.value}boundaries(e){let s="",n="";const[,l,r]=e.match(/^(\D*)(\d*)(\D*)/)||[];return r&&(s="0".repeat(l.length)+r,n="9".repeat(l.length)+r),s=s.padEnd(this.maxLength,"0"),n=n.padEnd(this.maxLength,"9"),[s,n]}doPrepareChar(e,s){s===void 0&&(s={});let n;return[e,n]=super.doPrepareChar(e.replace(/\D/g,""),s),e||(n.skip=!this.isComplete),[e,n]}_appendCharRaw(e,s){if(s===void 0&&(s={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,s);const n=String(this.from).padStart(this.maxLength,"0"),l=String(this.to).padStart(this.maxLength,"0"),[r,o]=this.boundaries(this.value+e);return Number(o)<this.from?super._appendCharRaw(n[this.value.length],s):Number(r)>this.to?!s.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(n[this.value.length],s).aggregate(this._appendCharRaw(e,s)):super._appendCharRaw(l[this.value.length],s):super._appendCharRaw(e,s)}doValidate(e){const s=this.value;if(s.search(/[^0]/)===-1&&s.length<=this._matchFrom)return!0;const[l,r]=this.boundaries(s);return this.from<=Number(r)&&Number(l)<=this.to&&super.doValidate(e)}pad(e){const s=new v;if(this.value.length===this.maxLength)return s;const n=this.value,l=this.maxLength-this.value.length;if(l){this.reset();for(let r=0;r<l;++r)s.aggregate(super._appendCharRaw("0",e));n.split("").forEach(r=>this._appendCharRaw(r))}return s}}B.MaskedRange=me;const Wa="d{.}`m{.}`Y";class W extends z{static extractPatternOptions(e){const{mask:s,pattern:n,...l}=e;return{...l,mask:ee(s)?s:n}}constructor(e){super(W.extractPatternOptions({...W.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:s,pattern:n,blocks:l,...r}={...W.DEFAULTS,...e},o=Object.assign({},W.GET_DEFAULT_BLOCKS());e.min&&(o.Y.from=e.min.getFullYear()),e.max&&(o.Y.to=e.max.getFullYear()),e.min&&e.max&&o.Y.from===o.Y.to&&(o.m.from=e.min.getMonth()+1,o.m.to=e.max.getMonth()+1,o.m.from===o.m.to&&(o.d.from=e.min.getDate(),o.d.to=e.max.getDate())),Object.assign(o,this.blocks,l),super._update({...r,mask:ee(s)?s:n,blocks:o})}doValidate(e){const s=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&s!=null&&(this.min==null||this.min<=s)&&(this.max==null||s<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(W.extractPatternOptions(e))}}W.GET_DEFAULT_BLOCKS=()=>({d:{mask:me,from:1,to:31,maxLength:2},m:{mask:me,from:1,to:12,maxLength:2},Y:{mask:me,from:1900,to:9999}}),W.DEFAULTS={...z.DEFAULTS,mask:Date,pattern:Wa,format:(a,e)=>{if(!a)return"";const s=String(a.getDate()).padStart(2,"0"),n=String(a.getMonth()+1).padStart(2,"0"),l=a.getFullYear();return[s,n,l].join(".")},parse:(a,e)=>{const[s,n,l]=a.split(".").map(Number);return new Date(l,n-1,s)}},B.MaskedDate=W;class fe extends O{constructor(e){super({...fe.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map(s=>{const{expose:n,...l}=oe(s),r=Y({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...l});return n&&(this.exposeMask=r),r}):[])}_appendCharRaw(e,s){s===void 0&&(s={});const n=this._applyDispatch(e,s);return this.currentMask&&n.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(s))),n}_applyDispatch(e,s,n){e===void 0&&(e=""),s===void 0&&(s={}),n===void 0&&(n="");const l=s.tail&&s._beforeTailState!=null?s._beforeTailState._value:this.value,r=this.rawInputValue,o=s.tail&&s._beforeTailState!=null?s._beforeTailState._rawInputValue:r,i=r.slice(o.length),u=this.currentMask,c=new v,d=u?.state;return this.currentMask=this.doDispatch(e,{...s},n),this.currentMask&&(this.currentMask!==u?(this.currentMask.reset(),o&&(this.currentMask.append(o,{raw:!0}),c.tailShift=this.currentMask.value.length-l.length),i&&(c.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):d&&(this.currentMask.state=d)),c}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const s=new v;return e&&s.aggregate(this._applyDispatch("",{},e)),s.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var s,n;return{...e,_beforeTailState:((s=e._beforeTailState)==null?void 0:s.currentMaskRef)===this.currentMask&&((n=e._beforeTailState)==null?void 0:n.currentMask)||e._beforeTailState}}doDispatch(e,s,n){return s===void 0&&(s={}),n===void 0&&(n=""),this.dispatch(e,this,s,n)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,s){s===void 0&&(s={});let[n,l]=super.doPrepare(e,s);if(this.currentMask){let r;[n,r]=super.doPrepare(n,this.currentMaskFlags(s)),l=l.aggregate(r)}return[n,l]}doPrepareChar(e,s){s===void 0&&(s={});let[n,l]=super.doPrepareChar(e,s);if(this.currentMask){let r;[n,r]=super.doPrepareChar(n,this.currentMaskFlags(s)),l=l.aggregate(r)}return[n,l]}reset(){var e;(e=this.currentMask)==null||e.reset(),this.compiledMasks.forEach(s=>s.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask){this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,this._applyDispatch();return}let s=String(e);this.currentMask&&(this.currentMask.typedValue=e,s=this.currentMask.unmaskedValue),this.unmaskedValue=s}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return!!((e=this.currentMask)!=null&&e.isComplete)}get isFilled(){var e;return!!((e=this.currentMask)!=null&&e.isFilled)}remove(e,s){const n=new v;return this.currentMask&&n.aggregate(this.currentMask.remove(e,s)).aggregate(this._applyDispatch()),n}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(s=>s.state),currentMaskRef:this.currentMask,currentMask:(e=this.currentMask)==null?void 0:e.state}}set state(e){const{compiledMasks:s,currentMaskRef:n,currentMask:l,...r}=e;s&&this.compiledMasks.forEach((o,i)=>o.state=s[i]),n!=null&&(this.currentMask=n,this.currentMask.state=l),super.state=r}extractInput(e,s,n){return this.currentMask?this.currentMask.extractInput(e,s,n):""}extractTail(e,s){return this.currentMask?this.currentMask.extractTail(e,s):super.extractTail(e,s)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,s){return this.currentMask?this.currentMask.nearestInputPos(e,s):super.nearestInputPos(e,s)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every((s,n)=>{if(!e[n])return;const{mask:l,...r}=e[n];return Ee(s,r)&&s.maskEquals(l)}):super.maskEquals(e)}typedValueEquals(e){var s;return!!((s=this.currentMask)!=null&&s.typedValueEquals(e))}}fe.DEFAULTS={...O.DEFAULTS,dispatch:(a,e,s,n)=>{if(!e.compiledMasks.length)return;const l=e.rawInputValue,r=e.compiledMasks.map((o,i)=>{const u=e.currentMask===o,c=u?o.displayValue.length:o.nearestInputPos(o.displayValue.length,E.FORCE_LEFT);return o.rawInputValue!==l?(o.reset(),o.append(l,{raw:!0})):u||o.remove(c),o.append(a,e.currentMaskFlags(s)),o.appendTail(n),{index:i,weight:o.rawInputValue.length,totalInputPositions:o.totalInputPositions(0,Math.max(c,o.nearestInputPos(o.displayValue.length,E.FORCE_LEFT)))}});return r.sort((o,i)=>i.weight-o.weight||i.totalInputPositions-o.totalInputPositions),e.compiledMasks[r[0].index]}},B.MaskedDynamic=fe;class ge extends z{constructor(e){super({...ge.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:s,...n}=e;if(s){const l=s.map(i=>i.length),r=Math.min(...l),o=Math.max(...l)-r;n.mask="*".repeat(r),o&&(n.mask+="["+"*".repeat(o)+"]"),this.enum=s}super._update(n)}_appendCharRaw(e,s){s===void 0&&(s={});const n=Math.min(this.nearestInputPos(0,E.FORCE_RIGHT),this.value.length),l=this.enum.filter(r=>this.matchValue(r,this.unmaskedValue+e,n));if(l.length){l.length===1&&this._forEachBlocksInRange(0,this.value.length,(o,i)=>{const u=l[0][i];i>=this.value.length||u===o.value||(o.reset(),o._appendChar(u,s))});const r=super._appendCharRaw(l[0][this.value.length],s);return l.length===1&&l[0].slice(this.unmaskedValue.length).split("").forEach(o=>r.aggregate(super._appendCharRaw(o))),r}return new v({skip:!this.isComplete})}extractTail(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),new J("",e)}remove(e,s){if(e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),e===s)return new v;const n=Math.min(super.nearestInputPos(0,E.FORCE_RIGHT),this.value.length);let l;for(l=e;l>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(n,l),n)).length>1);--l);const r=super.remove(l,s);return r.tailShift+=l-e,r}get isComplete(){return this.enum.indexOf(this.value)>=0}}ge.DEFAULTS={...z.DEFAULTS,matchValue:(a,e,s)=>a.indexOf(e,s)===s},B.MaskedEnum=ge;class ft extends O{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}B.MaskedFunction=ft;var gt;class H extends O{constructor(e){super({...H.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),s="\\d*",n=(this.scale?"("+Ae(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+s+n),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Ae).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Ae(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const s=e.split(this.radix);return s[0]=s[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),s.join(this.radix)}doPrepareChar(e,s){s===void 0&&(s={});const[n,l]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(s.input&&s.raw||!s.input&&!s.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),s);return e&&!n&&(l.skip=!0),n&&!this.allowPositive&&!this.value&&n!=="-"&&l.aggregate(this._appendChar("-")),[n,l]}_separatorsCount(e,s){s===void 0&&(s=!1);let n=0;for(let l=0;l<e;++l)this._value.indexOf(this.thousandsSeparator,l)===l&&(++n,s&&(e+=this.thousandsSeparator.length));return n}_separatorsCountFromSlice(e){return e===void 0&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,s,n){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),[e,s]=this._adjustRangeWithSeparators(e,s),this._removeThousandsSeparators(super.extractInput(e,s,n))}_appendCharRaw(e,s){s===void 0&&(s={});const n=s.tail&&s._beforeTailState?s._beforeTailState._value:this._value,l=this._separatorsCountFromSlice(n);this._value=this._removeThousandsSeparators(this.value);const r=this._value;this._value+=e;const o=this.number;let i=!isNaN(o),u=!1;if(i){let p;this.min!=null&&this.min<0&&this.number<this.min&&(p=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(p=this.max),p!=null&&(this.autofix?(this._value=this.format(p,this).replace(H.UNMASKED_RADIX,this.radix),u||(u=r===this._value&&!s.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let c;i?c=new v({inserted:this._value.slice(r.length),rawInserted:u?"":e,skip:u}):(this._value=r,c=new v),this._value=this._insertThousandsSeparators(this._value);const d=s.tail&&s._beforeTailState?s._beforeTailState._value:this._value,h=this._separatorsCountFromSlice(d);return c.tailShift+=(h-l)*this.thousandsSeparator.length,c}_findSeparatorAround(e){if(this.thousandsSeparator){const s=e-this.thousandsSeparator.length+1,n=this.value.indexOf(this.thousandsSeparator,s);if(n<=e)return n}return-1}_adjustRangeWithSeparators(e,s){const n=this._findSeparatorAround(e);n>=0&&(e=n);const l=this._findSeparatorAround(s);return l>=0&&(s=l+this.thousandsSeparator.length),[e,s]}remove(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),[e,s]=this._adjustRangeWithSeparators(e,s);const n=this.value.slice(0,e),l=this.value.slice(s),r=this._separatorsCount(n.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(n+l));const o=this._separatorsCountFromSlice(n);return new v({tailShift:(o-r)*this.thousandsSeparator.length})}nearestInputPos(e,s){if(!this.thousandsSeparator)return e;switch(s){case E.NONE:case E.LEFT:case E.FORCE_LEFT:{const n=this._findSeparatorAround(e-1);if(n>=0){const l=n+this.thousandsSeparator.length;if(e<l||this.value.length<=l||s===E.FORCE_LEFT)return n}break}case E.RIGHT:case E.FORCE_RIGHT:{const n=this._findSeparatorAround(e);if(n>=0)return n+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let s=e;this.min!=null&&(s=Math.max(s,this.min)),this.max!=null&&(s=Math.min(s,this.max)),s!==e&&(this.unmaskedValue=this.format(s,this));let n=this.value;this.normalizeZeros&&(n=this._normalizeZeros(n)),this.padFractionalZeros&&this.scale>0&&(n=this._padFractionalZeros(n)),this._value=n}super.doCommit()}_normalizeZeros(e){const s=this._removeThousandsSeparators(e).split(this.radix);return s[0]=s[0].replace(/^(\D*)(0*)(\d*)/,(n,l,r,o)=>l+o),e.length&&!/\d$/.test(s[0])&&(s[0]=s[0]+"0"),s.length>1&&(s[1]=s[1].replace(/0*$/,""),s[1].length||(s.length=1)),this._insertThousandsSeparators(s.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const s=e.split(this.radix);return s.length<2&&s.push(""),s[1]=s[1].padEnd(this.scale,"0"),s.join(this.radix)}doSkipInvalid(e,s,n){s===void 0&&(s={});const l=this.scale===0&&e!==this.thousandsSeparator&&(e===this.radix||e===H.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,s,n)&&!l}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,H.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(H.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(e){return(super.typedValueEquals(e)||H.EMPTY_VALUES.includes(e)&&H.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}gt=H,H.UNMASKED_RADIX=".",H.EMPTY_VALUES=[...O.EMPTY_VALUES,0],H.DEFAULTS={...O.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[gt.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:a=>a.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},B.MaskedNumber=H;const Be={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function De(a,e,s){e===void 0&&(e=Be.MASKED),s===void 0&&(s=Be.MASKED);const n=Y(a);return l=>n.runIsolated(r=>(r[e]=l,r[s]))}function kt(a,e,s,n){return De(e,s,n)(a)}B.PIPE_TYPE=Be,B.createPipe=De,B.pipe=kt;class bt extends z{get repeatFrom(){var e;return(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?e:0}get repeatTo(){var e;return(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var s,n,l;const{repeat:r,...o}=oe(e);this._blockOpts=Object.assign({},this._blockOpts,o);const i=Y(this._blockOpts);this.repeat=(s=(n=r??i.repeat)!=null?n:this.repeat)!=null?s:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((l=this._blocks)==null?void 0:l.length)||0,this.repeatFrom)),blocks:{m:i},eager:i.eager,overwrite:i.overwrite,skipInvalid:i.skipInvalid,lazy:i.lazy,placeholderChar:i.placeholderChar,displayChar:i.displayChar})}_allocateBlock(e){if(e<this._blocks.length)return this._blocks[e];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(Y(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(e,s){s===void 0&&(s={});const n=new v;for(let u=(l=(r=this._mapPosToBlock(this.displayValue.length))==null?void 0:r.index)!=null?l:Math.max(this._blocks.length-1,0),c,d;c=(o=this._blocks[u])!=null?o:d=!d&&this._allocateBlock(u);++u){var l,r,o,i;const h=c._appendChar(e,{...s,_beforeTailState:(i=s._beforeTailState)==null||(i=i._blocks)==null?void 0:i[u]});if(h.skip&&d){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(n.aggregate(h),h.consumed)break}return n}_trimEmptyTail(e,s){var n,l;e===void 0&&(e=0);const r=Math.max(((n=this._mapPosToBlock(e))==null?void 0:n.index)||0,this.repeatFrom,0);let o;s!=null&&(o=(l=this._mapPosToBlock(s))==null?void 0:l.index),o==null&&(o=this._blocks.length-1);let i=0;for(let u=o;r<=u&&!this._blocks[u].unmaskedValue;--u,++i);i&&(this._blocks.splice(o-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length);const n=super.remove(e,s);return this._trimEmptyTail(e,s),n}totalInputPositions(e,s){return e===void 0&&(e=0),s==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,s)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}}B.RepeatBlock=bt;try{globalThis.IMask=B}catch{}const Xa=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:v,ChunksTailDetails:te,DIRECTION:E,HTMLContenteditableMaskElement:Me,HTMLInputMaskElement:pt,HTMLMaskElement:pe,InputMask:ht,MaskElement:Ve,Masked:O,MaskedDate:W,MaskedDynamic:fe,MaskedEnum:ge,MaskedFunction:ft,MaskedNumber:H,MaskedPattern:z,MaskedRange:me,MaskedRegExp:mt,PIPE_TYPE:Be,PatternFixedDefinition:$e,PatternInputDefinition:he,RepeatBlock:bt,createMask:Y,createPipe:De,default:B,forceDirection:ut,normalizeOpts:oe,pipe:kt},Symbol.toStringTag,{value:"Module"}));I.ModalEdit=Je,I.VForm=ce,I.VsInputCheckbox=je,I.VsInputContainer=Ye,I.VsInputDate=Ue,I.VsInputEmail=ze,I.VsInputFile=Ge,I.VsInputFileList=Ke,I.VsInputMask=Oe,I.VsInputNumber=Te,I.VsInputRadio=Ne,I.VsInputSelect=We,I.VsInputStatic=Fe,I.VsInputSwitcher=Se,I.VsInputTag=st,I.VsInputText=ve,I.VsInputTextarea=Xe,I.default=ce,I.inputs=nt,I.vsInputDatatable=et,I.vsInputMap=tt,Object.defineProperties(I,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});