@opengis/form 0.0.89 → 0.0.90

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,3 +1,3 @@
1
- (function(ne,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@opengis/core")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core"],e):(ne=typeof globalThis<"u"?globalThis:ne||self,e(ne.FormBuilder={},ne.Vue,ne.OpenGISCore))})(this,(function(ne,e,se){"use strict";const Zt=e.defineComponent({__name:"vs-info-tooltip",props:{text:{}},setup(l){const t=l,n=e.ref(!1),a=e.ref({top:"0px",left:"0px"});function o(s){if(!t.text)return;const i=s.currentTarget.getBoundingClientRect();a.value={top:`${i.bottom+4}px`,left:`${Math.min(i.left,window.innerWidth-230)}px`},n.value=!0}function r(){n.value=!1}return(s,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("span",{class:"inline-flex items-center",onMouseenter:o,onMouseleave:r},[e.renderSlot(s.$slots,"default",{},()=>[i[0]||(i[0]=e.createElementVNode("svg",{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",class:"text-gray-400 cursor-help"},[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),e.createElementVNode("path",{d:"M12 16v-4"}),e.createElementVNode("path",{d:"M12 8h.01"})],-1))])],32),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.value&&s.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(a.value),class:"fixed z-[9999] max-w-xs p-2 bg-gray-900 text-white text-xs rounded-lg shadow-lg pointer-events-none"},e.toDisplayString(s.text),5)):e.createCommentVNode("",!0)]))],64))}}),Zn={class:"w-full relative"},Jn={key:0,class:"text-[14px] font-medium text-gray-900 mb-2 flex items-center gap-1"},Xn={class:"opacity-100"},Qn={key:0,class:"text-red-500 text-[14px]"},el={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},tl=e.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){const t=l,n=e.computed(()=>typeof t.item?.label=="string"&&t.item.label?t.item.label:t.item?.ua||t.label||t.ua),a=e.computed(()=>!!n.value),o=e.computed(()=>!!t.item?.rules?.includes("required")),r=e.computed(()=>t.item?.info||"");return(s,i)=>(e.openBlock(),e.createElementBlock("div",Zn,[a.value?(e.openBlock(),e.createElementBlock("div",Jn,[e.createElementVNode("span",Xn,e.toDisplayString(n.value),1),o.value?(e.openBlock(),e.createElementBlock("span",Qn,"*")):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createBlock(Zt,{key:1,text:r.value},null,8,["text"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"default",e.mergeProps(s.$attrs,{class:{"opacity-60":s.item.disabled}})),s.error?(e.openBlock(),e.createElementBlock("span",el,e.toDisplayString(s.error),1)):e.createCommentVNode("",!0)]))}}),nl={class:"w-full relative flex flex-row items-center gap-2"},ll={key:0,class:"text-red-500 text-[14px]"},al={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},ol=e.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{default:()=>({container:12,label:3})}},setup(l){const t=l,n=e.computed(()=>t.item?.label||t.label||t.ua),a=e.computed(()=>t.item?.info||""),o=e.computed(()=>t.columns??{container:12,label:3}),r=e.computed(()=>{const{container:c,label:h}=o.value;return!c||c<=0?0:Math.min(Math.max(h??0,0),c)/c}),s=e.computed(()=>t.item?.type==="html"||r.value<=0?!1:!!n.value),i=e.computed(()=>{if(!s.value)return{};const c=`${r.value*100}%`;return{flexBasis:c,maxWidth:c}}),d=e.computed(()=>{const{container:c,label:h}=o.value;if(!c||c<=0)return{};if(t.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!s.value)return{flexBasis:"100%",maxWidth:"100%"};const y=Math.max(c-Math.max(h??0,0),0)/c;if(!y)return{};const _=`${y*100}%`;return{flexBasis:_,maxWidth:_}});return(c,h)=>(e.openBlock(),e.createElementBlock("div",nl,[s.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0 items-center gap-1",style:e.normalizeStyle(i.value)},[e.createTextVNode(e.toDisplayString(n.value)+" ",1),c.item?.rules?.includes("required")&&n.value?(e.openBlock(),e.createElementBlock("span",ll,"*")):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createBlock(Zt,{key:1,text:a.value},null,8,["text"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"flex-1 min-w-0",style:e.normalizeStyle(d.value)},[e.renderSlot(c.$slots,"default",e.normalizeProps(e.guardReactiveProps(c.$attrs)))],4),c.error?(e.openBlock(),e.createElementBlock("span",al,e.toDisplayString(c.error),1)):e.createCommentVNode("",!0)]))}}),rl={class:"w-full relative"},sl={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},il=e.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",rl,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",sl,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),dl={class:"flex-1 min-w-0"},cl={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},ul={class:"truncate"},pl={key:0,class:"text-red-500 text-[14px]"},ml=["innerHTML"],hl={key:0,class:"mt-1 text-xs text-red-500"},fl={default:tl,horizontal:ol,inline:il,settings:e.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){const t=l,n=e.ref("uk");e.computed(()=>(t.item??{})?.[n.value]??t.ua??t.label??"");const a=e.computed(()=>t.item?.description??""),o=e.computed(()=>Array.isArray(t.item?.rules)&&t.item.rules.includes("required")),r=e.computed(()=>(typeof t.error=="string"?t.error:"")??""),s=()=>{const i=typeof localStorage<"u"?localStorage.getItem("locale"):null;n.value=i||"uk"};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(n.value=localStorage.locale)}catch{}window.addEventListener("storage",s)}),e.onUnmounted(()=>{window.removeEventListener("storage",s)}),(i,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":i.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(i.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",dl,[i.ua||i.label?(e.openBlock(),e.createElementBlock("p",cl,[e.createElementVNode("span",ul,e.toDisplayString(i.item[n.value]||i.ua||i.label),1),o.value?(e.openBlock(),e.createElementBlock("span",pl,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createElementBlock("p",{key:1,class:"text-xs text-slate-500 dark:text-slate-400",innerHTML:a.value},null,8,ml)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["w-full",["select","native-select"].includes(i.item.type)?"md:w-[30%]":"md:w-auto"])},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],2)],2),r.value?(e.openBlock(),e.createElementBlock("p",hl,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0)],2))}})};function he(l){return{inputClass:e.computed(()=>{const n=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${l?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return l?.size==="sm"?`${n}h-[32px]`:`${n}h-[38px]`})}}const gl=["placeholder","disabled"],yl=e.defineComponent({__name:"vs-input-password",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=he(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??"");return(s,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),placeholder:r.value,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,gl)),[[e.vModelText,a.value]])}}),kl=["placeholder","disabled","maxlength","minlength"],ze=e.defineComponent({__name:"vs-input-text",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=he(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??""),s=e.computed(()=>t.maxlength??void 0),i=e.computed(()=>t.minlength??void 0);function d(){typeof a.value=="string"&&(a.value=a.value.trim())}return(c,h)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":h[0]||(h[0]=y=>a.value=y),placeholder:r.value,disabled:o.value,maxlength:s.value,minlength:i.value,onBlur:d,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[c.customClass,e.unref(n),{"!border-red-600":c.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,kl)),[[e.vModelText,a.value]])}}),bl=["placeholder","disabled","min","max"],Jt=e.defineComponent({__name:"vs-input-number",props:e.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=he(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled);return(r,s)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":s[0]||(s[0]=i=>a.value=i),placeholder:r.placeholder,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"},min:r.min,max:r.max},null,10,bl)),[[e.vModelText,a.value]])}}),Y=(l,t)=>{const n=l.__vccOpts||l;for(const[a,o]of t)n[a]=o;return n},wl={},xl={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 _l(l,t){return e.openBlock(),e.createElementBlock("svg",xl,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const El=Y(wl,[["render",_l]]),Vl={class:"flex items-center gap-[4px]"},vl=["value","id","disabled"],Bl=["for"],Cl={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},Nl=e.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=t,a=l,o=e.computed({get:()=>a.modelValue,set:s=>n("update:modelValue",s)}),r=e.computed(()=>!!a.disabled);return(s,i)=>(e.openBlock(),e.createElementBlock("div",Vl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:s.value,"onUpdate:modelValue":i[0]||(i[0]=d=>o.value=d),class:e.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.value}]),id:s.id,disabled:r.value},null,10,vl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:s.id,class:e.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.value}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[o.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",s.error?"border-red-600":""]])},[e.createVNode(El,{height:"12",width:"12"})],2),e.createElementVNode("span",Cl,[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(s.label),1)])])],10,Bl)]))}}),Ml=["name","value","disabled"],Sl={class:"flex items-center gap-[6px] text-[14px]"},$l={key:0,class:"text-[16px]"},Dl=["src"],Al=e.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(l,{emit:t}){const n=l,a=t,o=e.computed({get:()=>n.modelValue,set:i=>{a("update:modelValue",i)}}),r=e.computed(()=>Array.isArray(o.value)?o.value.includes(n.value):o.value===!0||o.value===n.value),s=e.computed(()=>n.style?.size==="xs"?"p-1.5 text-xs":n.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(i,d)=>(e.openBlock(),e.createElementBlock("label",{class:e.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",[s.value,r.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"hidden",name:i.id,value:i.value,"onUpdate:modelValue":d[0]||(d[0]=c=>o.value=c),disabled:i.disabled},null,8,Ml),[[e.vModelCheckbox,o.value]]),e.createElementVNode("span",Sl,[i.icon||i.imgUrl?(e.openBlock(),e.createElementBlock("span",$l,[i.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(i.icon)},null,2)):e.createCommentVNode("",!0),i.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:1,src:i.imgUrl,width:"16",height:"16",alt:"icon"},null,8,Dl)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(i.label),1)])])],2))}}),Fl={class:"flex items-center"},Bt=e.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(l,{emit:t}){const n=l,a=t,o=`radio-${Math.floor(Math.random()*1e4)}`,r=e.computed({get:()=>Array.isArray(n.modelValue)?Array.isArray(n.modelValue)&&n.modelValue.includes(n.value):n.modelValue,set:i=>{if(Array.isArray(n.modelValue)){let d=[...n.modelValue];i?d.includes(n.value)||d.push(n.value):d=d.filter(c=>c!==n.value),a("update:modelValue",d)}else a("update:modelValue",i)}}),s=e.ref(`vs-checkbox-${n.view||"default"}`);return(i,d)=>(e.openBlock(),e.createElementBlock("div",Fl,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value==="vs-checkbox-buttons"?e.unref(Al):e.unref(Nl)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:r.value,"onUpdate:modelValue":d[0]||(d[0]=c=>r.value=c),id:o,icon:i.icon,imgUrl:i.imgUrl,style:e.normalizeStyle(i.style),error:i.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),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-chevron-down"};function Il(l,t){return e.openBlock(),e.createElementBlock("svg",Tl,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const Ol=Y(Ll,[["render",Il]]),Rl={},zl={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-x"};function jl(l,t){return e.openBlock(),e.createElementBlock("svg",zl,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),e.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const Ct=Y(Rl,[["render",jl]]),Pl={},Ul={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 Hl(l,t){return e.openBlock(),e.createElementBlock("svg",Ul,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M12 9h.01"},null,-1),e.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),e.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 ql=Y(Pl,[["render",Hl]]),Gl={key:0,class:"flex items-start gap-x-1"},Kl={key:0,class:"text-red-500 text-[14px]"},Yl=["title"],Wl=["disabled"],Nt=e.defineComponent({__name:"vs-input-switcher",props:e.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:{},maxlength:{},minlength:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue");return(a,o)=>t.view==="checkbox"?(e.openBlock(),e.createElementBlock("div",Gl,[e.createVNode(Bt,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),label:a.text,error:a.error||""},null,8,["modelValue","label","error"]),a.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",Kl,"*")):e.createCommentVNode("",!0),a.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:a.i,onClick:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(ql),{class:"text-gray-500 w-[14px] h-[14px]"})],8,Yl)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.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",[n.value?`bg-${a.style?.primaryColor||"blue"}-500`:"bg-stone-200",a.customClass]]),disabled:a.disabled,onClick:o[2]||(o[2]=r=>n.value=!n.value)},[e.createElementVNode("span",{"data-state":"checked",class:e.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[n.value?"translate-x-4":"translate-x-0"]])},null,2)],10,Wl))}}),Zl=["id","innerHTML"],Mt=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",{id:t.name,class:e.normalizeClass(["text-gray-900",t.customClass]),innerHTML:t.html?t.html:t.text},null,10,Zl))}}),Jl=["placeholder","disabled","name"],St=e.defineComponent({__name:"vs-input-mask",props:e.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=he(t.style),a=e.useModel(l,"modelValue"),o=e.ref(null);let r=null;return e.onMounted(async()=>{if(o.value){const{default:s}=await Promise.resolve().then(()=>qt);r=s(o.value,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),r.on("accept",()=>{a.value=t.unmask?r.unmaskedValue:r.value}),r.on("complete",()=>{a.value=t.unmask?r.unmaskedValue:r.value}),r.value=a.value!=null?String(a.value):""}}),e.onBeforeUnmount(()=>{r?.destroy()}),e.watch(()=>t.mask,s=>{r&&r.updateOptions({mask:s,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),e.watch(a,s=>{r&&r.unmaskedValue!==s&&(r.value=s!=null?String(s):"")}),(s,i)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:s.placeholder,disabled:s.disabled,name:s.name,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,10,Jl))}}),Xl={class:"relative w-full bg-white rounded-lg"},Ql=["placeholder","disabled"],$t=e.defineComponent({__name:"vs-input-email",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=he(t.style),a=e.useModel(l,"modelValue");return(o,r)=>(e.openBlock(),e.createElementBlock("div",Xl,[r[1]||(r[1]=e.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)),e.withDirectives(e.createElementVNode("input",{type:"email","onUpdate:modelValue":r[0]||(r[0]=s=>a.value=s),placeholder:o.placeholder,disabled:o.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Ql),[[e.vModelText,a.value]])]))}}),ea={class:"relative w-full bg-white rounded-lg"},ta=["value","placeholder","disabled"],Dt=e.defineComponent({__name:"vs-input-tel",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=he(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>a.value?a.value.startsWith("+")?a.value.slice(1):a.value:""),r=i=>{let{value:d}=i.target;d=d.replace(/^\+/,""),a.value=d?`+${d}`:""},s=i=>{const d=i,{data:c,inputType:h}=d;h&&h.startsWith("delete")||c&&/\D/.test(c)&&d.preventDefault()};return e.watch(()=>a.value,i=>{i&&!i.startsWith("+")?a.value=`+${i.replace(/^\+/,"")}`:i||(a.value="")},{immediate:!0}),(i,d)=>(e.openBlock(),e.createElementBlock("div",ea,[d[0]||(d[0]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},[e.createElementVNode("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"},[e.createElementVNode("path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"})])],-1)),d[1]||(d[1]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[30px] text-gray-500 select-none pointer-events-none"}," + ",-1)),e.createElementVNode("input",{type:"tel",value:o.value,onInput:r,onBeforeinput:s,pattern:"^\\+[1-9]\\d{1,14}$",maxlength:"15",placeholder:i.placeholder,disabled:i.disabled,class:e.normalizeClass(["!pl-10 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":i.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,ta)]))}}),na=["value","disabled"],la={class:"text-[13px] text-gray-700"},aa=e.defineComponent({__name:"vs-input-radio-default",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>!!t.disabled);return(o,r)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center gap-0",[t.customClass,a.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:"radio",value:t.value,disabled:a.value,class:"hidden"},null,8,na),[[e.vModelRadio,n.value]]),e.createElementVNode("span",{class:e.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${t.style?.primaryColor||"blue"}-500`,a.value?"opacity-50 cursor-not-allowed":""]])},[n.value==t.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${t.style?.primaryColor||"blue"}-500`]])},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",la,e.toDisplayString(t.text),1)],2))}}),oa=["value","disabled"],ra={class:"text-[13px] text-gray-700"},sa={"vs-input-radio-default":aa,"vs-input-radio-buttons":e.defineComponent({__name:"vs-input-radio-buttons",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>!!t.disabled);return(o,r)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[n.value==t.value?`ring-2 ring-ring ring-${t.style?.primaryColor||"blue"}-500`:"",t.customClass,a.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:"radio",value:t.value,disabled:a.value,class:"hidden"},null,8,oa),[[e.vModelRadio,n.value]]),e.createElementVNode("span",ra,e.toDisplayString(t.text),1)],2))}})},At=e.defineComponent({__name:"vs-input-radio",props:e.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>sa[`vs-input-radio-${t.view}`]);return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([o.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,s=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),e.mergeProps({key:s?.id,text:s.text,value:s.id.toString(),checked:n.value===s.id,modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=i=>n.value=i)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),ia={key:1,class:"w-full flex flex-col gap-4"},da={key:0,class:"text-sm font-medium text-muted-foreground my-2"},ca="Без категорії",Xt=Y(e.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},group:{default:void 0},values:{default:()=>[]},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.ref([]),r=e.reactive({}),s=b=>b?.value||b?.id||b?.text||b,i=b=>b.text||String(b),d=b=>`lg:col-span-${b||12}`,c=e.computed(()=>[n.position==="vertical"?"flex flex-col":"",n.colSpan?"grid":"flex justify-start"]),h=b=>b==null||b===""?null:typeof b=="string"||typeof b=="number"?b:String(b),y=e.computed(()=>{if(!n.group)return[];const b=new Map;o.value.forEach(u=>{const x=u[n.group],f=h(x);b.has(f)||b.set(f,[]),b.get(f)?.push(u)});const B=[];n.values?.length&&n.values.forEach(u=>{const x=h(u);B.push(x)});const g=new Set,k=u=>{const x=b.get(u)||[];if(!x.length)return null;const f=u===null?"group-null":`group-${String(u)}`,V=u===null?ca:String(u);return g.add(u),{key:f,label:V,options:x}},w=[];return B.forEach(u=>{const x=k(u);x&&w.push(x)}),b.forEach((u,x)=>{if(g.has(x))return;const f=k(x);f&&w.push(f)}),w}),_=async()=>{try{const b=await fetch(`/api/suggest/${n.data}`).then(B=>B.json());o.value=b?.data||b}catch(b){console.error(b)}};return e.watch(()=>n.modelValue,b=>{if(typeof b=="boolean"&&o.value.length===1){const B=s(o.value[0]);r[B]=b}else if(Array.isArray(b)){const B=new Set(b);o.value.forEach(g=>{if(!g.disabled){const k=s(g);r[k]=B.has(k)}})}},{immediate:!0}),e.watch(r,()=>{if(!o.value.length){a("update:modelValue",null);return}const b=Object.entries(r).filter(([,B])=>B).map(([B])=>B);a("update:modelValue",b.length===0?[]:b)},{deep:!0}),e.onMounted(()=>{if(n.data)_().then(()=>{if(typeof n.modelValue=="boolean"&&o.value.length===1){const b=s(o.value[0]);r[b]=n.modelValue}else if(Array.isArray(n.modelValue)){const b=new Set(n.modelValue);o.value.forEach(B=>{if(!B.disabled){const g=s(B);r[g]=b.has(g)}})}});else if(o.value=n.options,typeof n.modelValue=="boolean"&&o.value.length===1){const b=s(o.value[0]);r[b]=n.modelValue}else if(Array.isArray(n.modelValue)){const b=new Set(n.modelValue);o.value.forEach(B=>{if(!B.disabled){const g=s(B);r[g]=b.has(g)}})}}),(b,B)=>n.group?(e.openBlock(),e.createElementBlock("div",ia,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g.key,class:"flex flex-col gap-2"},[g.label?(e.openBlock(),e.createElementBlock("span",da,e.toDisplayString(g.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["p-0 w-full gap-[12px]",c.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.options,k=>(e.openBlock(),e.createBlock(Bt,{modelValue:r[s(k)],"onUpdate:modelValue":w=>r[s(k)]=w,value:s(k),class:e.normalizeClass(d(b.colSpan)),disabled:n.disabled||k.disabled,label:i(k),key:`${g.key}-${s(k)}`,icon:k?.icon,imgUrl:k?.imgUrl,option:k,view:b.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["p-0 w-full gap-[10px]",c.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,g=>(e.openBlock(),e.createBlock(Bt,{modelValue:r[s(g)],"onUpdate:modelValue":k=>r[s(g)]=k,value:s(g),class:e.normalizeClass(d(b.colSpan)),disabled:n.disabled||g.disabled,label:i(g),key:s(g),icon:g?.icon,imgUrl:g?.imgUrl,option:g,view:b.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-8e66207e"]]),ua=["type","placeholder","disabled"],pa=e.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},mode:{default:"date"}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l;function a(h){return h?n.mode==="datetime"?(h.includes("T")?h:null)||h+(h.includes(" ")?"":"T00:00"):h?.split(" ")[0]:null}const{inputClass:o}=he(n.style),r=t,s=e.computed({get:()=>a(n.modelValue),set:h=>r("update:modelValue",h)}),i=e.computed(()=>n.mode==="datetime"?"datetime-local":n.mode),d=e.computed(()=>!!n.disabled),c=e.computed(()=>n.placeholder??"");return(h,y)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":y[0]||(y[0]=_=>s.value=_),placeholder:c.value,disabled:d.value,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[h.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,ua)),[[e.vModelDynamic,s.value]])}}),ma=(l,t)=>{if(!t||!Object.keys(t).length)return l;const[n,a=""]=l.split("?"),o=new URLSearchParams(a);Object.entries(t).forEach(([s,i])=>{i==null||i===""||o.set(s,String(i))});const r=o.toString();return r?`${n}?${r}`:n},Qt=async(l,t={})=>{try{const n=new FormData;n.append("unique","true"),n.append("file",l);const{api:a,id:o="1",form:r="form",table:s="table",customParams:i}=t,d=a||`/file/upload/uploads?id=${o||""}&form=${r||""}&table=${s||""}`,c=ma(d,i);return(await fetch(c,{method:"POST",body:n}).then(y=>y.json()))?.result}catch(n){return se.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",n),null}},ha=async l=>{try{return await fetch(`file/delete${l}`),!0}catch(t){return console.error(t),!1}},en=async l=>{try{const t=await fetch(`file/download/files/uploads${l}`),n=await t.arrayBuffer(),a=t.headers["content-type"],o=new TextDecoder("utf-8").decode(n),r=new Blob([o],{type:a}),s=document.createElement("a");s.setAttribute("download",l),s.href=window.URL.createObjectURL(r),s.click()}catch(t){console.error(t.message)}},fa={},ga={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 ya(l,t){return e.openBlock(),e.createElementBlock("svg",ga,t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const Be=Y(fa,[["render",ya]]),ka={},ba={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 wa(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",ba,t[0]||(t[0]=[e.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 xa=Y(ka,[["render",wa]]),_a={},Ea={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 Va(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Ea,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),e.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),e.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const va=Y(_a,[["render",Va]]),Ba={},Ca={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 Na(l,t){return e.openBlock(),e.createElementBlock("svg",Ca,t[0]||(t[0]=[e.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="M9 9l1 0"></path><path d="M9 13l6 0"></path><path d="M9 17l6 0"></path>',6)]))}const tn=Y(Ba,[["render",Na]]),Ma={},Sa={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 $a(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Sa,t[0]||(t[0]=[e.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 Da=Y(Ma,[["render",$a]]),Aa={},Fa={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 La(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Fa,t[0]||(t[0]=[e.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 Ta=Y(Aa,[["render",La]]),Ia=l=>{if(!l)return"";const t=l?.split(".");return t[t.length-1]},Oa=l=>{const t=Ia(l),n={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 n.imageFormat.includes(t)?"img":n.sheetsFormat.includes(t)?va:n.textsFormat.includes(t)?Ta:n.documentsFormat.includes(t)?xa:n.archivesFormat.includes(t)?Da:tn},Ra={},za={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 ja(l,t){return e.openBlock(),e.createElementBlock("svg",za,t[0]||(t[0]=[e.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 je=Y(Ra,[["render",ja]]),Pa={},Ua={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 Ha(l,t){return e.openBlock(),e.createElementBlock("svg",Ua,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const nn=Y(Pa,[["render",Ha]]),qa=["title"],Ga={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},ln=Y(e.defineComponent({__name:"vs-input-file-list-item",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(l){const t=e.useModel(l,"value"),n=e.useModel(l,"item"),a=l;return(o,r)=>(e.openBlock(),e.createElementBlock("div",{title:n.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Oa)(n.value)),{src:n.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:r[0]||(r[0]=s=>e.unref(en)(n.value))},null,8,["src"])),e.createElementVNode("div",Ga,[e.createElementVNode("button",{type:"button",onClick:r[1]||(r[1]=s=>{e.unref(ha)(n.value),t.value=a.multiple?t.value?.filter(i=>i!==n.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[e.createVNode(je,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:r[2]||(r[2]=s=>e.unref(en)(n.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[e.createVNode(nn,{class:"w-4 h-4"})])])],8,qa))}}),[["__scopeId","data-v-286cdbc0"]]),Ka={class:"flex items-center gap-x-2"},Ya=["accept","multiple","disabled"],Wa={key:1,class:"flex items-center flex-wrap gap-2"},Za={key:1,class:"loader"},Ja={key:1,class:"loader"},an=Y(e.defineComponent({__name:"vs-input-file",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["change"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=e.useModel(l,"modelValue"),o=t,r=e.ref(null),s=e.ref(!1),i=e.inject("values"),d=e.computed(()=>n.format?n.format.split(",").map(u=>u.trim().toLowerCase()).filter(Boolean):[]),c=u=>Array.isArray(a.value)&&a.value[u]||"",h=u=>{if(n.max_size&&u.size>n.max_size*1024*1024){const x=(u.size/1048576).toFixed(2);return se.notify({type:"error",title:"Помилка!",message:`Файл "${u.name}" занадто великий. Максимальний розмір: ${n.max_size} МБ, розмір файлу: ${x} МБ`,position:"right-bottom"}),!1}return!0},y=u=>{if(!d.value.length)return!0;const x=`.${u.name.split(".").pop()?.toLowerCase()||""}`,f=d.value.includes(x);return f||se.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${u.name}". Дозволені формати: ${d.value.join(", ")}`,position:"right-bottom"}),f},_=e.computed(()=>{const u={},x=[];if(!n.customParams?.length)return{params:u,missingSources:x};const f=i?.value??{};return n.customParams.forEach(V=>{if(!V)return;const[M,A]=V.split("="),j=M?.trim(),P=A?.trim();if(!j||!P)return;const G=f[P];if(G==null||G===""){x.push(P);return}u[j]=G}),{params:u,missingSources:x}}),b=()=>{const u=_.value.params;return{api:n.api,customParams:Object.keys(u).length?u:void 0}},B=()=>{const u=_.value.missingSources;if(!u.length)return!0;const x=u.join(", ");return se.notify({type:"warning",title:"Заповніть поля",message:`Поля (${x}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},g=u=>{se.notify({type:"error",title:"Помилка завантаження",message:u||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},k=()=>{n.disabled||s.value||B()&&r.value?.click()},w=async u=>{const{files:x}=u.target;if(!x||x.length===0)return;if(!B()){r.value&&(r.value.value="");return}const f=Array.from(x);if(n.max_size&&f.filter(A=>!h(A)).length>0){r.value&&(r.value.value="");return}if(f.filter(M=>!y(M)).length>0){r.value&&(r.value.value="");return}s.value=!0;try{if(n.multiple){const M=Array.from(x).map(async G=>await Qt(G,b())),A=await Promise.all(M),P=A.filter(G=>G!==null).map(G=>G?.file_path).filter(Boolean);if(P.length===0){g();return}P.length<A.length&&g("Деякі файли не вдалося завантажити. Перевірте їх та спробуйте знову."),a.value=[...a.value||[],...P],o("change",a.value)}else{const M=x[0],A=await Qt(M,b());if(!A?.file_path){g();return}a.value=A?.file_path,o("change",a.value||"")}}catch(M){const A=M?.message||void 0;g(A)}finally{s.value=!1,r.value&&(r.value.value="")}};return(u,x)=>(e.openBlock(),e.createElementBlock("div",Ka,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:r,type:"file",accept:n.format,multiple:u.multiple,onChange:w,disabled:s.value||u.disabled},null,40,Ya),!u.multiple&&a.value?(e.openBlock(),e.createBlock(ln,{key:0,item:a.value,"onUpdate:item":x[0]||(x[0]=f=>a.value=f),value:a.value,"onUpdate:value":x[1]||(x[1]=f=>a.value=f)},null,8,["item","value"])):u.multiple?(e.openBlock(),e.createElementBlock("div",Wa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(f,V)=>(e.openBlock(),e.createBlock(ln,{multiple:u.multiple,key:V,value:a.value,"onUpdate:value":x[2]||(x[2]=M=>a.value=M),item:c(V)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:k,class:e.normalizeClass(["relative 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",u.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[s.value?(e.openBlock(),e.createElementBlock("div",Za)):(e.openBlock(),e.createBlock(Be,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),u.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:k,class:e.normalizeClass([u.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","relative 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"])},[s.value?(e.openBlock(),e.createElementBlock("div",Ja)):(e.openBlock(),e.createBlock(Be,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-94bcb5d9"]]),Xa={class:"max-w-[55vw]"},Qa={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},eo={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},to={class:"px-[5px]"},no={class:""},ot=e.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(l){const t=l,n=e.computed(()=>{try{return new Date(t.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function a(o){if(o<1024)return`${o} B`;const r=o/1024;return r<1024?`${r.toFixed(2)} KB`:`${(r/1024).toFixed(2)} MB`}return(o,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[r[1]||(r[1]=e.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)),e.createElementVNode("div",Xa,[e.createElementVNode("p",Qa,e.toDisplayString(o.item?.uploaded_name),1),e.createElementVNode("p",eo,[e.createElementVNode("span",null,e.toDisplayString(o.item?.username),1),e.withDirectives(e.createElementVNode("span",to,"|",512),[[e.vShow,o.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(n.value),1),r[0]||(r[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",no,e.toDisplayString(a(o.item?.size)),1)])])],64))}}),lo={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},ao={key:0,class:"flex w-full gap-x-3 items-center"},oo={key:1,class:"flex gap-x-3 w-full items-center"},ro={key:2,class:"flex gap-x-3 w-full items-center"},so=["href"],io={key:3,class:"flex gap-x-3 w-full items-center"},co={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},uo={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"},po={class:"inline-block"},mo={class:"inline-block"},ho=e.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(l,{emit:t}){const n=l,a=t;function o(h){return["pdf","json"].includes(h.ext)}function r(h){return["ppt","pptx","doc","docx","xls","xlsx"].includes(h.ext)}function s(h){const y=document.createElement("a");y.setAttribute("download",h?.uploaded_name),y.href=h?.file_path,y.click()}async function i(){try{await fetch(`${n.prefix}/widget/file/${n.item.entity_id}/${n.item.file_id}`),a("update")}catch(h){console.error(h)}}function d(){a("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function c(h){(n.item.ext==="jpg"||n.item.ext==="png")&&a("openLightbox",{item:n.item,index:h})}return(h,y)=>(e.openBlock(),e.createElementBlock("div",lo,[h.item.ext==="jpg"||h.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",ao,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:y[0]||(y[0]=_=>c(h.index))},[e.createVNode(ot,{item:h.item},null,8,["item"])])])):o(h.item)?(e.openBlock(),e.createElementBlock("div",oo,[e.createVNode(ot,{item:h.item},null,8,["item"])])):r(h.item)?(e.openBlock(),e.createElementBlock("div",ro,[e.createElementVNode("a",{href:`/api/file-preview?id=${h.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(ot,{item:h.item},null,8,["item"])],8,so)])):(e.openBlock(),e.createElementBlock("div",io,[e.createVNode(ot,{item:h.item},null,8,["item"])])),e.createElementVNode("div",co,[e.createElementVNode("div",uo,[e.createElementVNode("div",po,[e.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:y[1]||(y[1]=_=>s(h.item))},[e.createVNode(nn,{height:"14",width:"14"})])]),y[3]||(y[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",mo,[e.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:y[2]||(y[2]=_=>d())},[e.createVNode(je,{height:"14",width:"14"})])])])])]))}}),fo={},go={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 yo(l,t){return e.openBlock(),e.createElementBlock("svg",go,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const ko=Y(fo,[["render",yo]]),bo={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},wo={class:"flex w-full mb-[12px] items-center gap-x-2"},xo={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},_o={class1:"ml-auto"},Eo={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"},Vo={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},vo={class:"relative"},Bo={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"},Co={key:0},on=e.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update"],setup(l,{emit:t}){const n=l,a=e.inject("form"),o=e.computed(()=>a.value.formId),r=e.ref(!1),s=e.ref(0),i=t,d=e.ref(!1),c=e.ref({}),h=e.ref([]),y=e.ref(""),_=e.computed(()=>Array.isArray(h.value)?h.value.filter(x=>x.ext==="jpg"||x.ext==="png").map(x=>x?.file_path):[]),b=e.computed(()=>y.value===""?h.value:h.value.filter(x=>x?.uploaded_name?.includes(y.value))),B=x=>{const f=_.value.findIndex(V=>V===x.item.file_path);f!==-1&&(r.value=!0,s.value=f)},g=async()=>{try{const x=await fetch(`${n.prefix}/widget/file/${o.value}`).then(f=>f.json());h.value=x?.rows}catch(x){console.error(x)}},k=async x=>{await Promise.all(Array.from(x.target.files).map(async f=>{const V=new FormData;V.append("file",f);try{const M=`${n.prefix}/widget/file/${o.value}`,A=await fetch(M,{method:"POST",body:V});return A.ok?(i("update","file-list"),f):(se.notify({type:A.status>=400&&A.status<500?"warning":"error",title:"Error",message:`Error code: ${A.status}`}),null)}catch(M){return se.notify({type:"error",title:"Error",message:M.message||"Unknown error"}),console.error(M),null}})),await g()},w=x=>{const f={...x};return x.cancel||(f.cancel=()=>{d.value=!1}),x.updateListOnConfirm&&(f.confirm=async()=>{await x.confirm(),d.value=!1,g()}),f},u=x=>{c.value=w(x),d.value=!0};return e.watch(o,x=>{x&&g()}),e.onMounted(()=>{o.value&&g()}),(x,f)=>{const V=e.resolveComponent("Lightbox"),M=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",bo,[e.createElementVNode("div",wo,[e.createElementVNode("h2",xo," Файлів: "+e.toDisplayString(h.value?.length),1),e.createElementVNode("div",_o,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:f[0]||(f[0]=A=>k(A))},null,32),e.createElementVNode("div",Eo,[e.createVNode(ko,{height:"16",width:"16"})])])])]),h.value?.length>4?(e.openBlock(),e.createElementBlock("div",Vo,[e.createElementVNode("div",null,[e.createElementVNode("div",vo,[f[8]||(f[8]=e.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[e.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"},[e.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),e.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":f[1]||(f[1]=A=>y.value=A),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),[[e.vModelText,y.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),h.value?.length?(e.openBlock(),e.createElementBlock("div",Bo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(A,j)=>(e.openBlock(),e.createBlock(ho,{key:j,prefix:x.prefix,item:A,index:j,onUpdate:f[2]||(f[2]=P=>x.$emit("update","file-list")),onOpenModal:f[3]||(f[3]=P=>u(P)),onOpenLightbox:f[4]||(f[4]=P=>B(P))},null,8,["prefix","item","index"]))),128)),b.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Co,f[9]||(f[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):e.createCommentVNode("",!0),e.createVNode(V,{modelValue:r.value,"onUpdate:modelValue":f[5]||(f[5]=A=>r.value=A),startIndex:s.value,"onUpdate:index":f[6]||(f[6]=A=>s.value=A),images:_.value},null,8,["modelValue","startIndex","images"]),e.createVNode(M,e.mergeProps({modelValue:d.value,"onUpdate:modelValue":f[7]||(f[7]=A=>d.value=A),onConfirm:c.value.confirm},c.value),null,16,["modelValue","onConfirm"])])}}}),No={class:"flex items-center justify-between"},Mo={class:"text-[16px] text-gray-900 font-medium"},So={class:"grid gap-3"},$o=Y(e.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(l){const t=l,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,a=>{n.value=a}),(a,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",No,[e.createElementVNode("p",Mo,e.toDisplayString(l.title),1),e.createVNode(Nt,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),style:e.normalizeStyle(l.style)},null,8,["modelValue","style"])]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",So,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),Do={class:"text-[16px] text-gray-900 font-medium"},Ao={class:"grid gap-3"},Fo=Y(e.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(l){const t=l,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,a=>{n.value=a}),(a,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("button",{type:"button",onClick:o[0]||(o[0]=r=>n.value=!n.value),class:"flex items-center gap-2"},[e.createVNode(e.unref(Ol),{class:e.normalizeClass(["h-4 w-4 duration-300",[n.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",Do,e.toDisplayString(l.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Ao,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),Lo={class:"flex items-center justify-between"},To={switcher:$o,accordion:Fo,default:e.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Lo,[e.createElementVNode("p",null,e.toDisplayString(l.title),1)]),e.renderSlot(t.$slots,"default")]))}})},ke={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Io=(l,t)=>String(l)===String(t),Oo=(l,t)=>String(l)!==String(t),Ro=(l,t)=>l>t,zo=(l,t)=>l>=t,jo=(l,t)=>l<t,Po=(l,t)=>l<=t,Uo=(l,t)=>Array.isArray(t)&&t.length===2?l>=t[0]&&l<=t[1]:!1,Ho=(l,t)=>String(l).startsWith(String(t)),qo=(l,t)=>String(l).endsWith(String(t)),Go=(l,t)=>String(l).includes(String(t)),Ko=(l,t)=>Array.isArray(t)?t.includes(l):!1,Yo=(l,t)=>Array.isArray(t)?!t.includes(l):!0,rn=(l,t)=>{if(!t)return!0;switch(t?.[1]){case ke.Equal:return Io(l,t?.[2]);case ke.Inequal:return Oo(l,t?.[2]);case ke.Higer:return Ro(l,t?.[2]);case ke.HigerOrEqual:return zo(l,t?.[2]);case ke.Lower:return jo(l,t?.[2]);case ke.LowerOrEqual:return Po(l,t?.[2]);case ke.Between:return Uo(l,t?.[2]);case ke.StartWith:return Ho(l,t?.[2]);case ke.EndWith:return qo(l,t?.[2]);case ke.Contain:return Go(l,t?.[2]);case ke.In:return Ko(l,t?.[2]);case ke.NotIn:return Yo(l,t?.[2]);default:return!0}},sn=e.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(l){const t=l,n=e.inject("values",e.ref({})),a=e.inject("form"),o=e.computed(()=>t.schema?.filter(i=>{const d=i?.conditions;if(!d)return!0;const c=Array.isArray(d)?d[0]:d,h=t.name?n.value?.[t.name]?.[c]??n.value?.[c]:n.value?.[c];return rn(h,d)})),r=e.computed(()=>To[t.view]),s=e.computed(()=>{if(n.value||(n.value={}),!t.name)return n.value;const i=n.value[t.name];if(i)return i;const d={};return n.value={...n.value,[t.name]:d},d});return(i,d)=>l.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{key:0,title:l.title,style:e.normalizeStyle(l.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,c=>(e.openBlock(),e.createBlock(Vn,e.mergeProps({key:c.name},{ref_for:!0},c,{item:c,modelValue:s.value[c.name],"onUpdate:modelValue":h=>s.value[c.name]=h,style:l.style,error:e.unref(a)?.errors?.[c.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),Wo=["aria-expanded","data-focus"],Zo={class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full"},Jo={key:0,class:"flex flex-nowrap items-center gap-1 overflow-x-auto overflow-y-hidden min-w-0 flex-1 py-0.5"},Xo={class:"flex items-center min-w-0"},Qo=["title"],er=["innerHTML"],tr=["onClick"],nr={class:"flex-1 min-w-[2px]"},lr=["placeholder"],ar=["title"],or=["innerHTML"],rr={key:2,class:"flex-1 min-w-[2px]"},sr=["placeholder"],ir={class:"flex items-center shrink-0"},dr=["disabled"],cr=["disabled","title"],ur=["aria-disabled","onClick"],pr=["innerHTML"],mr={key:1,class:"px-3 py-2 text-center text-gray-500"},hr=["disabled"],Ft=e.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:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{},maxlength:{},minlength:{}},emits:["change","update:modelValue","value-selected"],setup(l,{emit:t}){const n=l,a=t,o=e.computed(()=>n.multiple),r=e.computed(()=>n.disabled);he(n.style);const s=e.computed({get:()=>n.modelValue,set:v=>a("update:modelValue",v)});!s.value&&n.defaultValue&&(s.value=n.defaultValue);const i=e.ref(null),d=e.ref(null),c=e.ref(null),h=e.ref(null),y=e.ref(!1),_=e.ref(!1),b=e.ref(null),B=e.ref([]),g=e.ref(-1),k=e.ref([]),w=e.ref(""),u=e.ref(null),x=e.ref("bottom"),f=e.ref({}),V=e.ref([]),M=e.computed(()=>{if(!V.value.length)return[];const v=B.value,C=new Map(v.map($=>[$.id?.toString(),$]));return V.value.map($=>C.get($?.toString())).filter($=>!!$)}),A=e.computed(()=>n.placeholder||"Select..."),j=e.computed(()=>H(b.value));e.computed(()=>o.value?!V.value.length&&w.value==="":!j.value&&w.value==="");const P=e.computed(()=>r.value?!1:o.value?V.value.length>0:!!s.value),G=v=>o.value?V.value.some(C=>C?.toString()===v?.toString()):s.value?.toString()===v?.toString(),D=e.computed(()=>{let v=B.value??[];if(!n.data&&w.value.trim()!==""){const C=w.value.toLowerCase();v=v.filter($=>{const W=H($).toLowerCase(),m=$.text?.toLowerCase?.()||"";return W.includes(C)||m.includes(C)})}if(o.value&&V.value.length){const C=new Set(V.value.map($=>$?.toString()));v=v.filter($=>!C.has($.id?.toString()))}return v}),te=e.inject("values"),K=/\{\{\s*([^}]+?)\s*\}\}/g,le=v=>(v?String(v):"").replace(/<[^>]*>/g,"").trim(),R=e.computed(()=>n.slot??n?.optionTemplate??""),S=v=>{if(!v)return"";const C=R.value;return C?C.replace(K,($,W)=>{const m=W.trim(),p=v[m];return p!=null?String(p):""}):v.text??""},H=v=>{if(!v)return"";if(!R.value)return v.text??"";const $=S(v);return le($)||v.text||""},z=v=>{n.set&&te?.value&&Object.entries(n.set).forEach(([C,$])=>{if(!C)return;const W=v?v[$]:null;te.value[C]=W??null})},ae=e.computed(()=>n.parent?te?.value?.[n.parent]?.toString()??null:null),re=async v=>{if(!n.data){let C=n.options??[];if(v?.trim()){const $=v.toLowerCase();C=C.filter(W=>{const m=H(W).toLowerCase(),p=W.text?.toLowerCase?.()||"";return m.includes($)||p.includes($)})}return C}try{const C=n.host??"",$=n.prefix??"api",W=n.api??`/${$}/suggest/${n.data}`,m=`${C}${W}`,p=new URLSearchParams;return p.set("json","1"),v&&p.set("key",v),ae.value!==void 0&&ae.value!==null&&ae.value!==""&&p.set("parent",ae.value),(await fetch(`${m}?${p.toString()}`).then(N=>N.json()))?.data??[]}catch{return[]}},xe=async()=>{n.data?B.value=await re(w.value):B.value=n.options?[...n.options]:[]},F=async v=>{if(v==null)return null;const C=B.value?.find($=>$?.id?.toString()===String(v));if(C)return C;if(n.data)try{const $=n.host??"",W=n.prefix??"api",m=n.api??`/${W}/suggest/${n.data}`,p=`${$}${m}`,E=new URLSearchParams;return E.set("json","1"),E.set("val",String(v)),ae.value!==void 0&&ae.value!==null&&ae.value!==""&&E.set("parent",ae.value),((await fetch(`${p}?${E.toString()}`).then(U=>U.json()))?.data??[])?.[0]??null}catch{return null}return null},L=async v=>{const C=new Set(B.value.map(W=>W.id?.toString())),$=v.filter(W=>!C.has(W?.toString()));$.length&&await $.reduce(async(W,m)=>{await W;const p=await F(m);p&&B.value.push(p)},Promise.resolve())},T=async()=>{r.value||(y.value=!0,await xe(),await e.nextTick(()=>{be(),u.value?.focus(),D.value.length?g.value=0:g.value=-1}))},I=()=>{y.value=!1,g.value=-1},Z=async v=>{if(r.value)return;!y.value?await T():I()},oe=async()=>{y.value?u.value?.focus():await T()},me=()=>{o.value?(V.value=[],s.value=[],a("change",[]),ye(null,[])):(b.value=null,s.value=null,a("change",null),ye(null,null)),z(null),w.value="",e.nextTick(()=>u.value?.focus())},ge=v=>{o.value&&(V.value=V.value.filter(C=>C?.toString()!==v?.toString()),s.value=[...V.value],a("change",s.value),ye(null),e.nextTick(()=>u.value?.focus()))},ye=(v,C)=>{const $=C??(o.value?[...V.value]:v?.id??null);a("value-selected",{name:n.name,value:$,option:v})},Ne=v=>{o.value?(G(v.id)||(V.value=[...V.value,v.id],s.value=[...V.value],a("change",s.value),ye(v)),w.value="",e.nextTick(()=>{u.value?.focus(),g.value=Math.min(g.value,D.value.length-1)}),z(null)):(b.value=v,s.value=v.id,a("change",s.value),ye(v),w.value="",I(),z(v))},Gt=v=>{G(v.id)||Ne(v)},He=(v,C)=>{if(!v||!C)return;const $=v.offsetTop,W=$+v.offsetHeight,m=C.scrollTop,p=m+C.clientHeight;let E=C.scrollTop;$<m?E=$-80:W>p&&(E=W-C.clientHeight+4);const N=C;N.scrollTop=E},tt=v=>{let C=v.parentElement;for(;C;){if(C.classList.contains("ui-dialog__content"))return C;const $=window.getComputedStyle(C),W=$.overflow+$.overflowY+$.overflowX;if(W.includes("auto")||W.includes("scroll")||C===document.body||C===document.documentElement)return C;C=C.parentElement}return document.body},be=()=>{if(!d.value)return;const v=d.value.getBoundingClientRect(),C=window.innerHeight||document.documentElement.clientHeight,$=window.innerWidth||document.documentElement.clientWidth,W=8,m=8,p=n.maxHeight||300,E=C-v.bottom-m-W,N=v.top-m-W,O=E>=N,U=Math.max($-W*2,0);let{width:ee}=v;U>0&&ee>U&&(ee=U);let{left:X}=v;X+ee+W>$&&(X=$-ee-W),X=Math.max(X,W);const ie=Math.min(p,Math.max(O?E:N,50));x.value=O?"bottom":"top",f.value={position:"fixed",left:`${X}px`,width:`${ee}px`,maxHeight:`${ie}px`,transform:O?"none":"translateY(-100%)",top:O?`${v.bottom+m}px`:`${v.top-m}px`}},bt=async v=>{r.value||!y.value&&(v.key==="ArrowDown"||v.key==="ArrowUp")&&(v.preventDefault(),await T())},qe=v=>{if(!y.value)return;const{key:C}=v;if(C==="ArrowDown")v.preventDefault(),g.value+1<D.value.length&&(g.value+=1,He(k.value[g.value],c.value));else if(C==="ArrowUp")v.preventDefault(),g.value>0&&(g.value-=1,He(k.value[g.value],c.value));else if(C==="Enter"){v.preventDefault();const $=D.value[g.value];$&&Ne($),u.value?.blur()}else C==="Escape"?(v.preventDefault(),I()):C==="Backspace"?o.value&&w.value===""&&V.value.length&&(V.value=V.value.slice(0,-1),s.value=[...V.value],a("change",s.value)):C==="Home"?(g.value=0,He(k.value[0],c.value)):C==="End"?(g.value=D.value.length-1,He(k.value[g.value],c.value)):C==="Tab"&&I()},wt=()=>{r.value||(_.value=!0)},Te=()=>{_.value=!1,w.value=""},Ie=v=>{v.key==="Escape"&&y.value&&I()},xt=v=>{const C=v.target;i.value?.contains(C)||h.value?.contains(C)||I()},_t=v=>{y.value&&c.value&&!c.value.contains(v.target)&&be()},nt=()=>{y.value&&be()},Et=()=>{y.value&&be()};e.watch(()=>n.options,v=>{v?.length&&(B.value=[...v],ve())},{immediate:!0});async function ve(){if(o.value)Array.isArray(s.value)?V.value=[...s.value]:(V.value=s.value==null?[]:[s.value],s.value=[...V.value]),n.data&&V.value.length&&(await L(V.value),await e.nextTick());else{if(Array.isArray(s.value)){const v=s.value[0]??null;s.value=v??null}s.value!=null&&(b.value=await F(s.value)),z(b.value??null)}}e.watch(s,()=>{ve()}),e.onMounted(async()=>{addEventListener("keydown",Ie),addEventListener("scroll",_t,!0),addEventListener("resize",nt),document.addEventListener("click",xt,!0),d.value&&tt(d.value).addEventListener("scroll",Et,!0),n.options?.length&&!n.data?B.value=[...n.options]:n.data&&(B.value=await re("")),await ve(),vt.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",Ie),removeEventListener("scroll",_t,!0),removeEventListener("resize",nt),document.removeEventListener("click",xt,!0),d.value&&tt(d.value).removeEventListener("scroll",Et,!0)});const Oe=e.ref(!1),Me=e.ref({}),Se=e.ref([]),Re=e.ref(null);async function Kt(){if(!n.add?.token||Re?.value.validate())return;const C=n.add.api??`/api/table/${n.add.token}`,{id:$}=await fetch(C,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Me.value)}).then(W=>W.json());if(!n.options?.length&&n.data){const W=await fetch(`${n.api??`/api/suggest/${n.data}`}?val=${$}`).then(m=>m.json());b.value=W[0],B.value.push(W[0]),s.value=$}Oe.value=!1,se.notify({title:"Success!",message:"Object created."})}async function Yt(){if(!n.add)return null;const v=await fetch(`/api/template/form/${n.add.form}`).then(C=>C.json());return Se.value=v.schema,Oe.value=!0,null}function Vt(v,C=200){let $;return(...W)=>{$&&clearTimeout($),$=window.setTimeout(()=>v(...W),C)}}const Wt=Vt(async v=>{B.value=await re(v)},200);e.watch(w,v=>{n.data&&Wt(v.trim())}),e.watch(()=>n.options,v=>{!n.data&&v?.length&&(B.value=[...v],ve())},{immediate:!0}),e.watch(()=>n.parent??n.parentValue,()=>{n.data&&xe()});const vt=e.ref(!0);return e.watch(ae,async()=>{if(n.data&&(vt.value||(o.value?(V.value=[],s.value=[],a("change",[])):(b.value=null,s.value=null,a("change",null))),await xe(),n.auto===1&&ae.value&&B.value.length>0)){const v=B.value[0];v&&Ne(v)}}),(v,C)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(se.VsModal),{visible:Oe.value,"onUpdate:visible":C[1]||(C[1]=$=>Oe.value=$),class:"z-[1000]",title:"Додати",buttonText:"Додати",onDone:Kt,teleport:v.teleport},{default:e.withCtx(()=>[e.createVNode(Ce,{schema:Se.value,modelValue:Me.value,"onUpdate:modelValue":C[0]||(C[0]=$=>Me.value=$),ref_key:"addForm",ref:Re},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:C[5]||(C[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass])},[C[10]||(C[10]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),C[11]||(C[11]=e.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-[#b3d4ff]",y.value||_.value?"border-[#2684ff] ring-1 ring-[#2684ff]":"",r.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":y.value,"aria-haspopup":"listbox",onKeydown:bt,onClick:oe,"data-focus":y.value||_.value?"true":"false",ref_key:"triggerRef",ref:d},[e.createElementVNode("div",Zo,[o.value?(e.openBlock(),e.createElementBlock("div",Jo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,$=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[rgb(230,230,230)] rounded-[2px] m-[2px] box-border max-w-full",key:$.id},[e.createElementVNode("div",Xo,[$?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:e.normalizeStyle({backgroundColor:$?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"truncate text-[#172b4d] overflow-hidden max-w-[200px] px-0.5 pl-1.5",title:H($)},[R.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:S($)},null,8,er)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString($.text),1)],64))],8,Qo)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border text-[#172b4d] hover:bg-[rgb(255,189,173)] hover:text-[rgb(222,53,11)] flex-shrink-0",onClick:e.withModifiers(W=>ge($.id),["stop"])},C[6]||(C[6]=[e.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"},[e.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,tr)]))),128)),e.createElementVNode("div",nr,[!r.value&&v.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:u,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:V.value.length?" ":A.value,"onUpdate:modelValue":C[2]||(C[2]=$=>w.value=$),onFocus:wt,onBlur:Te,onKeydown:qe},null,40,lr)),[[e.vModelText,w.value]]):e.createCommentVNode("",!0)])])):!o.value&&!_.value&&j.value&&w.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900"]),title:j.value},[b.value?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:e.normalizeStyle({backgroundColor:b.value?.color})},null,4)):e.createCommentVNode("",!0),R.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass({"pl-5":b.value?.color}),innerHTML:S(b.value)},null,10,or)):(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass({"pl-5":b.value?.color})},e.toDisplayString(b.value?.text),3))],8,ar)):e.createCommentVNode("",!0),o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",rr,[!r.value&&v.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:u,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:j.value?" ":A.value,"onUpdate:modelValue":C[3]||(C[3]=$=>w.value=$),onFocus:wt,onBlur:Te,onKeydown:qe},null,40,sr)),[[e.vModelText,w.value]]):e.createCommentVNode("",!0)]))]),e.createElementVNode("div",ir,[P.value?(e.openBlock(),e.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:e.withModifiers(me,["stop"])},C[7]||(C[7]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.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)):e.createCommentVNode("",!0),C[9]||(C[9]=e.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),e.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:C[4]||(C[4]=e.withModifiers($=>Z(),["stop"])),title:y.value?"Закрити список":"Відкрити список"},C[8]||(C[8]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.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,cr)])],42,Wo),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[y.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:h,class:e.normalizeClass(["fixed z-[3000] rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]"]),style:e.normalizeStyle(f.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:f.value.maxHeight||"300px"}),ref_key:"listRef",ref:c},[D.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(D.value,($,W)=>(e.openBlock(),e.createElementBlock("div",{key:$.id,ref_for:!0,ref:m=>k.value[W]=m,class:e.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900",G($.id)?"bg-[#2684ff] text-white":"bg-white hover:bg-[#deebff] hover:text-[#172b4d]",g.value===W&&!G($.id)?"bg-[#deebff] text-[#172b4d]":""]),"aria-disabled":G($.id)?"true":"false",role:"option",tabindex:"-1",onClick:m=>Gt($)},[$?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:e.normalizeStyle({backgroundColor:$?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",g.value===$.id?"text-white":"",(g.value===W,"")])},[R.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:S($)},null,8,pr)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString($.text),1)],64))],2)],10,ur))),128)):(e.openBlock(),e.createElementBlock("div",mr," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),n.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:Yt,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"},[e.createVNode(Be,{width:"16",height:"16"}),C[12]||(C[12]=e.createElementVNode("span",null,"Додати",-1))],8,hr)):e.createCommentVNode("",!0)],512)],64))}}),fr=["placeholder","disabled"],dn=e.defineComponent({__name:"vs-input-textarea",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=he(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??"");function s(){typeof a.value=="string"&&(a.value=a.value.trim())}return(i,d)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":d[0]||(d[0]=c=>a.value=c),placeholder:r.value,disabled:o.value,row:"2",onBlur:s,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,42,fr)),[[e.vModelText,a.value]])}}),gr={},yr={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 kr(l,t){return e.openBlock(),e.createElementBlock("svg",yr,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),e.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const br=Y(gr,[["render",kr]]),wr={},xr={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 _r(l,t){return e.openBlock(),e.createElementBlock("svg",xr,t[0]||(t[0]=[e.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),e.createElementVNode("path",{d:"M7 20V4"},null,-1),e.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),e.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const Er=Y(wr,[["render",_r]]),Vr={},vr={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 Br(l,t){return e.openBlock(),e.createElementBlock("svg",vr,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Cr=Y(Vr,[["render",Br]]),Nr={},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"};function Sr(l,t){return e.openBlock(),e.createElementBlock("svg",Mr,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const $r=Y(Nr,[["render",Sr]]),Dr={},Ar={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 Fr(l,t){return e.openBlock(),e.createElementBlock("svg",Ar,t[0]||(t[0]=[e.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 cn=Y(Dr,[["render",Fr]]),Lr={},Tr={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Ir(l,t){return e.openBlock(),e.createElementBlock("svg",Tr,t[0]||(t[0]=[e.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 Or=Y(Lr,[["render",Ir]]),Rr={},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(l,t){return e.openBlock(),e.createElementBlock("svg",zr,t[0]||(t[0]=[e.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 Pr=Y(Rr,[["render",jr]]),Ur={class:"vs-datatable border rounded-xl w-full flex-grow"},Hr={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},qr={class:"relative w-full"},Gr={class:"table-wrapper flex gap-2"},Kr={class:"vs-popover inline-block text-slate-700"},Yr={class:"text-center"},Wr={class:""},Zr={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"},Jr={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},Xr={class:"text-sm items-center text-gray-800 flex gap-1"},Qr={class:"w-full overflow-x-auto"},es={class:"w-full table-auto caption-bottom text-sm"},ts={class:"[&_tr]:border-b"},ns={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"},ls={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"},as={key:0,colspan:"100%",class:"text-center"},os={class:"w-full"},rs={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},ss=["onDragstart","onDragover","onDrop"],is={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},ds={class:"flex items-center justify-center"},cs={key:0,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"},us={key:0},ps=["src"],ms={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},hs=["innerHTML"],fs={key:2,class:"line-clamp-2 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"},gs={key:3,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"},ys={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},ks={class:"flex items-center justify-center gap-2"},bs=["onClick"],ws=["onClick"],xs={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},un=e.defineComponent({__name:"vs-input-datatable",props:e.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref({}),o=e.ref(""),r=e.computed(()=>{if(!o.value)return n.value??[];const L=o.value.toLowerCase();return n.value.filter(T=>t.colModel?.some(I=>{const Z=T[I.key];return Z?Array.isArray(Z)?Z.join(", ").toLowerCase().includes(L):String(Z).toLowerCase().includes(L):!1}))}),s=e.ref(null),i=e.ref(null),d=e.ref(!1),c=e.ref(null),h=e.ref({top:0,left:0}),y=L=>{s.value=L},_=L=>{i.value=L},b=L=>{if(s.value===null||s.value===L){s.value=null,i.value=null;return}const T=[...n.value],[I]=T.splice(s.value,1);T.splice(L,0,I),n.value=T,s.value=null,i.value=null},B=L=>{const I=L.currentTarget.getBoundingClientRect();h.value={top:I.bottom+window.scrollY,left:I.left+window.scrollX},d.value=!d.value},g=()=>{c.value&&c.value.click()},k=L=>{const T=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],I=L.toLowerCase();return T.some(Z=>I.endsWith(Z))},w=L=>{const I=L.target.files?.[0];if(!I)return;const Z=new FileReader;Z.onload=oe=>{try{const me=oe.target?.result;if(typeof me=="string"){const ge=JSON.parse(me);Array.isArray(ge)&&n.value.push(...ge)}}catch(me){console.error("Error parsing file:",me)}},Z.readAsText(I)},u=()=>{const L=JSON.stringify(n.value,null,2),T=new Blob([L],{type:"application/json"}),I=URL.createObjectURL(T),Z=document.createElement("a");Z.href=I,Z.download="data.json",Z.click(),URL.revokeObjectURL(I)},x=new Set(["autocomplete","select","radio","checkbox","combobox"]),f=new Map,V=(L,T)=>{const I=`/api/suggest/${L}`,Z=I.includes("?")?"&":"?",oe=T?`&val=${T}`:"";return`${I}${Z}json=1${oe}`},M=L=>L==null||L===""?null:typeof L=="object"?L?.id!==void 0&&L.id!==null&&L.id!==""?L.id:null:L,A=L=>{const T=new Set;return Array.isArray(n.value)&&n.value.forEach(I=>{const Z=I?.[L];if(Z==null||Z==="")return;if(Array.isArray(Z)){Z.forEach(me=>{const ge=M(me);ge!==null&&T.add(ge)});return}const oe=M(Z);oe!==null&&T.add(oe)}),T},j=async()=>{if(!t.colModel?.length)return;const L=t.colModel.filter(T=>T.data&&x.has(T.type?.toLowerCase()||""));L.length&&await Promise.all(L.map(async T=>{const I=T.key||T.name;if(!I)return;const Z=A(I),oe=Array.from(Z).map(ye=>String(ye)).sort(),me=oe.join(",");if(!oe.length||f.get(I)===me)return;f.set(I,me);const ge=oe.map(encodeURIComponent).join(",");try{const Ne=await(await fetch(V(T.data,ge))).json();a.value[I]=Ne?.data??Ne}catch(ye){console.error("Failed to fetch column values",ye)}}))};e.watch([()=>t.colModel,()=>n.value],()=>{j()},{immediate:!0,deep:!0});const P=e.ref(""),G=e.ref(!1);let D="edit",te=0;const K=e.ref({}),le=e.ref({});async function R(){P.value="Додати",G.value=!0,D="add",K.value={}}function S(L,T){if(!L?.length)return null;const I=typeof T=="object"?T?.id:T;return I==null||I===""?null:L.find(Z=>Z?.id?.toString()===I.toString())?.text??null}function H(L){return L==null||L===""?"-":Array.isArray(L)?L.map(T=>typeof T=="object"?T?.text??T?.id??"-":T).join(", "):typeof L=="object"?L?.text??L?.id??"-":L}function z(L,T){const I=T.key||T.name,Z=L?.[I],oe=a.value[I];if(!Z)return"-";if(Array.isArray(Z)){const ge=Z.map(ye=>S(oe,ye)).filter(Boolean);return ge.length?ge.join(", "):H(Z)}const me=S(oe,Z);return me||H(Z)}async function ae(L,T){P.value="Редагувати",G.value=!0,D="edit",te=T,K.value={...L}}function re(){const L=le.value.validate();if(L){se.notify({type:"warning",title:"Помилка валідації",message:Object.entries(L).map(([T,I])=>`${T}: ${I}`).join(`
2
- `)});return}D==="add"?Array.isArray(n.value)?n.value=[...n.value,K.value]:n.value=[K.value]:n.value=n.value.map((T,I)=>I===te?K.value:T),G.value=!1}function xe(L){n.value=n.value.filter((T,I)=>I!==L)}function F(){G.value=!1}return(L,T)=>(e.openBlock(),e.createElementBlock("div",Ur,[e.createElementVNode("div",Hr,[e.createElementVNode("div",qr,[e.createVNode(br,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":T[0]||(T[0]=I=>o.value=I),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),[[e.vModelText,o.value]])]),e.createElementVNode("div",Gr,[e.createElementVNode("input",{ref_key:"fileInput",ref:c,onChange:w,class:"hidden",accept:".json",type:"file"},null,544),e.createElementVNode("div",Kr,[e.createElementVNode("div",Yr,[e.createElementVNode("div",Wr,[e.createElementVNode("button",{onClick:B,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"},[e.createVNode(Er,{height:"16",width:"16"})])])])])]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[d.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:e.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:h.value.top+"px",left:h.value.left+"px"}])},[e.createElementVNode("div",Zr,[e.createElementVNode("div",Jr,[e.createElementVNode("button",{onClick:g,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createVNode(Cr,{class:"text-black",width:"14",height:"14"}),T[4]||(T[4]=e.createTextVNode(" Імпортувати ",-1))]),e.createElementVNode("button",{onClick:u,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createElementVNode("span",Xr,[e.createVNode($r,{class:"text-black",width:"14",height:"14"}),T[5]||(T[5]=e.createTextVNode(" Експортувати ",-1))])])])])],4)):e.createCommentVNode("",!0)])),e.createElementVNode("button",{onClick:R,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"},[e.createVNode(Be),T[6]||(T[6]=e.createTextVNode(" Додати ",-1))])]),e.createElementVNode("div",Qr,[e.createElementVNode("table",es,[e.createElementVNode("thead",ts,[e.createElementVNode("tr",ns,[e.createElementVNode("th",ls,[e.createVNode(cn,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(L.colModel,I=>(e.openBlock(),e.createElementBlock("th",{key:I.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]"},e.toDisplayString(I.ua||I.label),1))),128)),T[7]||(T[7]=e.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))])]),e.createElementVNode("tbody",{class:e.normalizeClass({"[&_tr:last-child]:border-0":!i.value})},[r.value.length===0?(e.openBlock(),e.createElementBlock("td",as,[e.createElementVNode("div",os,[e.createElementVNode("div",rs,[e.createVNode(Or,{class:"w-48 mx-auto"}),T[8]||(T[8]=e.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[e.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),e.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(I,Z)=>(e.openBlock(),e.createElementBlock("tr",{key:I.id,class:e.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":s.value===Z,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":i.value===Z}]),draggable:"true",onDragstart:oe=>y(Z),onDragover:e.withModifiers(oe=>_(Z),["prevent"]),onDrop:oe=>b(Z)},[e.createElementVNode("td",is,[e.createElementVNode("div",ds,[e.createVNode(cn,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(L.colModel,oe=>(e.openBlock(),e.createElementBlock("td",{key:oe.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[oe.type==="file"?(e.openBlock(),e.createElementBlock("div",cs,[k(z(I,oe))?(e.openBlock(),e.createElementBlock("div",us,[e.createElementVNode("img",{src:z(I,oe),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,ps)])):(e.openBlock(),e.createElementBlock("div",ms,[e.createVNode(tn,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):oe.type==="tiptap-editor"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"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 line-clamp-3",innerHTML:z(I,oe)},null,8,hs)):oe.type==="reference"?(e.openBlock(),e.createElementBlock("div",fs,e.toDisplayString(z(I,oe)),1)):(e.openBlock(),e.createElementBlock("div",gs,e.toDisplayString(z(I,oe)),1))]))),128)),e.createElementVNode("td",ys,[e.createElementVNode("div",ks,[e.createElementVNode("button",{onClick:oe=>ae(I,Z),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"},[e.createVNode(Pr,{width:"24",height:"24",class:"w-3 h-3"})],8,bs),e.createElementVNode("button",{onClick:oe=>xe(Z),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"},[e.createVNode(je,{width:"24",height:"24",class:"w-3 h-3"})],8,ws)])])],42,ss))),128))],2)])]),e.createVNode(e.unref(se.VsModal),{visible:G.value,title:P.value,size:"lg",onClose:F},{default:e.withCtx(()=>[e.createVNode(Ce,{schema:t.colModel,values:K.value,"onUpdate:values":T[1]||(T[1]=I=>K.value=I),form:le.value,"onUpdate:form":T[2]||(T[2]=I=>le.value=I)},null,8,["schema","values","form"]),e.createElementVNode("div",xs,[e.createElementVNode("button",{type:"button",onClick:T[3]||(T[3]=I=>G.value=!1),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"}," Скасувати "),e.createElementVNode("button",{onClick:re,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"}," Зберегти ")])]),_:1},8,["visible","title"])]))}}),_s={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:"Клацніть на шари, щоб видалити їх"}}}}},Es={},Vs={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 vs(l,t){return e.openBlock(),e.createElementBlock("svg",Vs,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),e.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 Bs=Y(Es,[["render",vs]]),Cs={},Ns={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 Ms(l,t){return e.openBlock(),e.createElementBlock("svg",Ns,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const Ss=Y(Cs,[["render",Ms]]),$s={},Ds={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 As(l,t){return e.openBlock(),e.createElementBlock("svg",Ds,t[0]||(t[0]=[e.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 Fs=Y($s,[["render",As]]),Ls={},Ts={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 Is(l,t){return e.openBlock(),e.createElementBlock("svg",Ts,t[0]||(t[0]=[e.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 Os=Y(Ls,[["render",Is]]),Rs={},zs={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 js(l,t){return e.openBlock(),e.createElementBlock("svg",zs,t[0]||(t[0]=[e.createElementVNode("title",null,null,-1),e.createElementVNode("desc",null,null,-1),e.createElementVNode("defs",null,null,-1),e.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[e.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[e.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[e.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 Ps=Y(Rs,[["render",js]]),Us={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},Hs={key:0,class:"vs-select__options absolute z-50 mt-1 w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm"},qs=["onClick"],Gs={class:"relative flex-1 min-w-[140px]"},Ks=["placeholder"],Ys="https://data.softpro.ua/api-user/gis-url-proxy",Ws="https://geo.rv.ua/api-user/dzk.api",Zs=Y(e.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(l,{emit:t}){const n=l,a=t,o=["here","xy","parcel"],r=e.computed(()=>{const f=n.config?.tools?.filter(V=>o.includes(V));return f&&f.length?f:o}),s=e.computed(()=>n.config?.placeholder?.trim()||"Пошук…"),i=e.ref(r.value[0]??o[0]);e.watch(r,f=>{f.includes(i.value)||(i.value=f[0])});const d=e.ref(""),c=e.ref(!1),h=e.ref(null);e.watch(i,()=>{d.value="",c.value=!1});function y(f){i.value=f}function _(f){if(!c.value)return;const V=h.value;V&&!V.contains(f.target)&&(c.value=!1)}e.onMounted(()=>{window.addEventListener("click",_,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",_,!0)});function b(f){return f==="xy"?"Координати":f==="parcel"?"Кадастр":"Адреси"}function B(f){const V=f.replace(/[,]+/g," ").trim();if(!V)return null;const M=V.split(/\s+/).filter(Boolean);if(M.length<2)return null;const A=M.slice(0,2).map(Number);if(!A.every(le=>Number.isFinite(le)))return null;let[j,P]=A,G=j,D=P;const te=le=>Math.abs(le)<=90,K=le=>Math.abs(le)<=180;if(!te(G)||!K(D))if(te(D)&&K(G))G=P,D=j;else return null;return{lat:G,lng:D}}function g(f){return(f?.items||[]).map((M,A)=>({id:String(M?.id??A),title:M?.title||M?.address?.label||"Знайдений обʼєкт",lat:Number(M?.position?.lat),lng:Number(M?.position?.lng)})).filter(M=>Number.isFinite(M.lat)&&Number.isFinite(M.lng))}function k(f){const V=f?.result||f?.data||f;if(!V)return[];const M=V.geom_centroid;if(!M||!Array.isArray(M.coordinates))return[];const[A,j]=M.coordinates;return!Number.isFinite(j)||!Number.isFinite(A)?[]:[{id:"parcel",title:V.cadnum||V.cad_num||"Земельна ділянка",lat:j,lng:A}]}function w(f){const M=f.replace(/\s+/g,"").split(":");if(M.length!==4)return!1;const A=[10,2,3,4];return M.every((j,P)=>j.length===A[P]&&/^\d+$/.test(j))}function u(f){a("goToCoordinates",[f.lat,f.lng])}async function x(){const f=d.value.trim();if(f){if(i.value==="xy"){const V=B(f);if(!V){se.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}u(V),d.value="";return}try{const V=new URL(i.value==="here"?Ys:Ws);if(i.value==="here")V.searchParams.set("searchtext",f);else{if(!w(f)){se.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}V.searchParams.set("cad_num",f)}const M=await fetch(V.toString());if(!M.ok)throw new Error(`HTTP ${M.status}`);const A=await M.json(),j=i.value==="here"?g(A):k(A);if(!j.length)se.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const P=j[0];u(P),d.value=""}}catch(V){const M=V?.message||"Помилка пошуку";se.notify({type:"error",title:"Пошук",message:M})}}}return(f,V)=>(e.openBlock(),e.createElementBlock("div",Us,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(x,["prevent"])},[r.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:h,class:"relative search-type w-[140px]"},[e.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:V[0]||(V[0]=M=>c.value=!c.value)},[e.createElementVNode("span",null,e.toDisplayString(b(i.value)),1),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":c.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},V[2]||(V[2]=[e.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2))]),c.value?(e.openBlock(),e.createElementBlock("div",Hs,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,M=>(e.openBlock(),e.createElementBlock("li",{key:M,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:A=>y(M)},e.toDisplayString(b(M)),9,qs))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",Gs,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":V[1]||(V[1]=M=>d.value=M),placeholder:s.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,Ks),[[e.vModelText,d.value,void 0,{trim:!0}]]),V[3]||(V[3]=e.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),[["__scopeId","data-v-3048520a"]]),Js={class:"bg-white/30 p-1 rounded-md shadow w-fit"},Xs={class:"flex gap-2"},Qs=["onClick","title"],ei=["src"],ti=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(l,{emit:t}){const n=l,a=e.ref(Object.keys(n.basemaps)[0]),o=t;function r(s){o("onLayerChange",s),a.value=s}return(s,i)=>(e.openBlock(),e.createElementBlock("div",Js,[e.createElementVNode("div",Xs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.basemaps,(d,c)=>(e.openBlock(),e.createElementBlock("div",{key:c,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":a.value===c}]),onClick:h=>r(c),title:d.name||c,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:d.preview,alt:"",class:"w-10 h-10 object-cover"},null,8,ei)],10,Qs))),128))])]))}});function Ge(l){return l?l.type==="Polygon"?{type:"MultiPolygon",coordinates:[l.coordinates]}:l.type==="Feature"?{...l,geometry:Ge(l.geometry)}:l.type==="FeatureCollection"?{...l,features:(l.features||[]).map(t=>Ge(t)).filter(Boolean)}:l:null}function ni(l){return l?l.type==="FeatureCollection"||l.type==="Feature"?Ge(l):l.geom?{type:"Feature",geometry:Ge({type:l.geom.type,coordinates:l.geom.coordinates}),properties:{}}:l.type&&l.coordinates?{type:"Feature",geometry:Ge(l),properties:{}}:null:null}const li={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},ai={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},oi={class:"text-sm font-medium"},ri={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},si={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},ii={class:"flex items-center gap-1"},di=["disabled"],ci=["disabled"],ui=["disabled"],pi={class:"bg-white/95 border border-gray-200 rounded-md shadow-xl px-3 py-2 max-w-[240px] text-[11px] sm:text-xs text-gray-900"},mi={class:"space-y-0.5"},hi={class:"text-gray-500"},fi={class:"text-gray-900 text-right break-all"},gi={class:"absolute top-4 right-4 z-[1000]"},yi={class:"flex flex-col gap-[2px]"},ki=["disabled"],bi=["disabled"],wi=["disabled"],xi=["disabled"],_i={class:"flex flex-col gap-2"},Ei={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},Vi={class:"flex flex-col gap-1"},vi=["checked","disabled","onChange"],Bi={class:"text-gray-700 text-xs font-medium"},Ci={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"},Ni={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},Mi={class:"shrink-0"},Si={class:"font-bold"},$i={class:"flex items-center"},Di={class:"text-xs mr-2"},Ai={key:0,class:"text-xs"},Fi={key:1,class:"text-xs"},Li=["disabled"],Ti=["disabled"],rt="vs-base-tile-pane",st="vs-overlay-tile-pane",pn=Y(e.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},ctrlZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},katottg:{default:""},layers:{default:()=>[]},bounds:{},api:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const a=e.getCurrentInstance()?.appContext?.config?.globalProperties?.$settings??{},o=Array.isArray(a.center)&&a.center.length===2?a.center:[50,30],r=typeof a.zoom=="number"?a.zoom:typeof a.defaultZoom=="number"?a.defaultZoom:10,s=l,i=t,d=e.computed(()=>!!s.disabled),c=e.ref(!1),h=e.ref(null),y=e.ref(!1),_=e.ref(""),b=e.ref(null),B=e.ref(null),g=e.ref(!1),k=e.ref(null),w=e.ref(null),u=e.ref(0),x=e.ref(o),f=e.ref(r),V=e.ref([]),M=e.ref(s.modelValue);let A=!1;const j=e.ref(null),P=e.computed(()=>{const m={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!s.tools?.length)return m;const p=new Set(s.tools.map(E=>E.toLowerCase()));return{search:p.has("search"),import:p.has("import"),export:p.has("export"),point:p.has("point"),line:p.has("line"),polygon:p.has("polygon"),rectangle:p.has("rectangle")}}),G=e.reactive({}),D=e.ref([]),te=e.computed(()=>D.value.map(m=>G[m]).filter(Boolean)),K=e.ref(null),le=e.computed(()=>K.value?.entries??[]),R=e.computed(()=>{if(!K.value)return;const m=12,p=K.value.point.x+m,E=K.value.point.y+m;return{left:`${p}px`,top:`${E}px`}});function S(m){if(typeof m!="string"||!m.trim())return"";if(/^https?:\/\//i.test(m))return m;const p=window?.location?.origin??"",E=m.replace(/^\/+/,"");return E?p?`${p}/${E}`:`/${E}`:p}function H(){if(Array.isArray(a.basemaps)&&a.basemaps.length){const p=a.basemaps.map((E,N)=>{const O=String(E?.key??E?.id??E?.name??`b${N}`),U=S(String(E?.url??""));if(!U)return null;const ee=typeof E?.preview=="string"&&E.preview?S(E.preview):"";return[O,{...E,url:U,preview:ee}]}).filter(E=>Array.isArray(E)&&E.length===2).reduce((E,[N,O])=>(E[N]=O,E),{});if(Object.keys(p).length)return p}return{voyager:{name:"Оглядова карта",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:{name:"Ортофото 1:10K",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:{name:"Open Street Maps",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"}}}const z=H(),ae=Object.keys(z),re=e.ref(ae.length?ae[0]:"");let xe,F,L,T,I=null;async function Z(){const m=N=>{if(!Array.from(document.styleSheets).some(O=>O?.href?.includes(N))){const O=document.createElement("link");O.rel="stylesheet",O.href=N,document.head.appendChild(O)}},p=N=>new Promise((O,U)=>{if(Array.from(document.scripts).some(ie=>ie.src===N))return O();const X=document.createElement("script");X.src=N,X.async=!0,X.onload=()=>O(),X.onerror=ie=>U(ie),document.body.appendChild(X)});m("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),m("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css");try{await p("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js")}catch{}try{await p("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js")}catch{}try{await p("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js")}catch{}return window.L}function oe(){const m=navigator.platform.toUpperCase().includes("MAC");return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Використовуйте два пальці для зуму карти.":m?"Використовуйте Ctrl або ⌘ + прокрутка для зуму карти.":"Використовуйте Ctrl + прокрутка для зуму карти."}function me(){if(!s.handleZoom||!h.value||!F)return null;let m;const p=N=>{const O=N.ctrlKey||N.metaKey||N.shiftKey;if(!s.ctrlZoom){y.value=!1,F.scrollWheelZoom.enable();return}if(!O){y.value=!0,_.value=oe(),clearTimeout(m),m=window.setTimeout(()=>y.value=!1,1200);return}N.preventDefault(),N.stopPropagation(),y.value=!1,F.scrollWheelZoom.enable(),setTimeout(()=>F.scrollWheelZoom.disable(),120)},E=N=>{if(N.touches.length===1){if(!s.ctrlZoom)return;y.value=!0,_.value=oe(),clearTimeout(m),m=window.setTimeout(()=>y.value=!1,3e3)}else y.value=!1};return h.value.addEventListener("wheel",p,{passive:!1}),h.value.addEventListener("touchstart",E,{passive:!0}),F.on("wheel",N=>{if(!s.ctrlZoom)return;N.originalEvent?.ctrlKey||N.originalEvent?.metaKey||N.originalEvent?.shiftKey||(N.originalEvent?.preventDefault?.(),N.originalEvent?.stopPropagation?.())}),()=>{h.value?.removeEventListener("wheel",p),h.value?.removeEventListener("touchstart",E),clearTimeout(m)}}function ge(m,p){return m?.id?String(m.id):m?.url?`${m.url}-${p}`:`layer-${p}`}function ye(m){const p=(m?.url??"").trim();if(!p)return"";if(/^https?:\/\//i.test(p))return p;const E=window.location?.origin??"",N=p.replace(/^\/+/,"");return`${E}/${N}`}function Ne(m){const p=m?.style??{};return E=>{const N=p.colorAttr,O=p.colorSet??{},U=typeof N=="string"?O?.[E?.[N]]??p.color??"#3388ff":p.color??"#3388ff",ee=p.stroke??U;return{weight:p.width??1,color:ee,opacity:p.opacity??1,fill:p.type?p.type!=="polyline":!0,fillColor:U,fillOpacity:p.opacity??.5}}}function Gt(m){return m?.layer?.properties||m?.layer?.feature?.properties||m?.properties||{}}function He(m,p={}){return m.popup===!1?[]:Array.isArray(m.popup)&&m.popup.length?m.popup.map(E=>{if(!E?.field)return null;const N=p[E.field];return N==null||N===""?null:{key:E.label||E.field,value:String(N)}}).filter(E=>!!E):Object.entries(p).filter(([E])=>typeof E=="string"&&E).slice(0,5).map(([E,N])=>({key:E,value:N==null?"—":String(N)}))}function tt(m,p){if(!F||!p?.latlng)return;const E=F.latLngToContainerPoint(p.latlng),N=Gt(p),O=He(m,N);if(!O.length){be(m.id);return}K.value={layerId:m.id,title:N?.name||m.title||m.name,properties:N,entries:O,point:{x:E.x,y:E.y}}}function be(m){m&&K.value?.layerId!==m||(K.value=null)}function bt(m){const p=(m?.service??"").toLowerCase(),E=ye(m),N=m.sourceLayer||m.layer||m.service_layer||m.service_key||m.map_key||m.dataset?.layer||m.id||m.table_name;if(p==="vtile"){const O=j.value;if(O?.vectorGrid?.protobuf&&!O?.maplibreGL){const U=O.vectorGrid.protobuf(E,{interactive:!0,maxNativeZoom:m.maxzoom??19,vectorTileLayerStyles:{[N??"default"]:Ne(m),default:Ne(m)}});return U?.on?.("mouseover",ee=>tt(m,ee)),U?.on?.("mousemove",ee=>tt(m,ee)),U?.on?.("mouseout",()=>be(m.id)),U}if(O?.maplibreGL&&window?.maplibregl){const U=E;return U?O.maplibreGL({style:U,interactive:!1,pane:"overlayPane"}):null}return null}return p==="tile"||/^https?:\/\//i.test(E)||E.includes("{z}")?j.value.tileLayer(E,{opacity:m?.style?.opacity??1,pane:st}):j.value.tileLayer(E,{opacity:m?.style?.opacity??1,pane:st})}function qe(m){const p=j.value;if(!p)return null;const E=("bounds"in m?m.bounds:void 0)??s.bounds??V.value;if(!Array.isArray(E)||!E.length)return null;const O={color:m.style?.stroke??m.style?.color??"#2563eb",weight:m.style?.width??2,interactive:!1,opacity:m.style?.opacity??.8,dashArray:"4 4"},U=Array.isArray(m.bounds)&&m.bounds.length?m.bounds:E,ee=wt(U);if(!ee.length||!p?.polyline)return null;const X=ee.map(ie=>{if(!ie.length)return ie;const de=ie[0],$e=ie[ie.length-1];return de&&$e&&typeof $e.equals=="function"&&!$e.equals(de)?[...ie,de]:ie});return p.polyline(X,O)}function wt(m){const p=j.value;if(!p||!Array.isArray(m))return[];const E=O=>{if(!Array.isArray(O)||O.length<2)return null;const[U,ee]=O;return!Number.isFinite(Number(ee))||!Number.isFinite(Number(U))?null:p.latLng(Number(ee),Number(U))},N=O=>Array.isArray(O)&&O.length>=2&&O.every(U=>Number.isFinite(Number(U)));if(m.length&&N(m[0])){const O=m.map(E).filter(Boolean);return O.length?[O]:[]}return m.length&&Array.isArray(m[0])&&Array.isArray(m[0][0])&&N(m[0][0][0])?m.flatMap(U=>Array.isArray(U)?U:[]).map(U=>Array.isArray(U)?U.map(E).filter(Boolean):[]).filter(U=>U.length):m.length&&Array.isArray(m[0])&&N(m[0][0])?m.map(U=>Array.isArray(U)?U.map(E).filter(Boolean):[]).filter(U=>U.length):[]}function Te(){if(!F||!j.value)return;I&&F.hasLayer(I)&&(F.removeLayer(I),I=null);const m=qe({id:"global-bounds",bounds:s.bounds??V.value,style:{}});m&&(I=m,I.addTo(F))}function Ie(){!F||!j.value||D.value.forEach(m=>{const p=G[m];p&&(p.visible?(p.layer||(p.layer=bt(p.config)),p.boundsLayer||(p.boundsLayer=qe(p.config)),p.layer&&!F.hasLayer(p.layer)&&p.layer.addTo(F),p.boundsLayer&&!F.hasLayer(p.boundsLayer)&&p.boundsLayer.addTo(F)):(p.layer&&F.hasLayer(p.layer)&&F.removeLayer(p.layer),p.boundsLayer&&F.hasLayer(p.boundsLayer)&&F.removeLayer(p.boundsLayer),be(p.id)))})}function xt(m){if(d.value)return;const p=G[m];p&&(p.visible=!p.visible,p.visible?(p.layer||(p.layer=bt(p.config)),p.boundsLayer||(p.boundsLayer=qe(p.config)),p.layer&&!F.hasLayer(p.layer)&&p.layer.addTo(F),p.boundsLayer&&!F.hasLayer(p.boundsLayer)&&p.boundsLayer.addTo(F)):(p.layer&&F.hasLayer(p.layer)&&F.removeLayer(p.layer),p.boundsLayer&&F.hasLayer(p.boundsLayer)&&F.removeLayer(p.boundsLayer),be(p.id)))}e.watch(()=>s.layers,m=>{const p=Array.isArray(m)?m:[],E=[],N=new Set;p.forEach((O,U)=>{if(!O)return;const ee=ge(O,U);E.push(ee),N.add(ee);const X=G[ee],ie={...O,id:ee},de=X?.visible??!!ie?.visible;X&&(X.layer&&F?.hasLayer(X.layer)&&F.removeLayer(X.layer),X.boundsLayer&&F?.hasLayer(X.boundsLayer)&&F.removeLayer(X.boundsLayer),be(ee)),G[ee]={id:ee,config:ie,visible:de,layer:null,boundsLayer:null}}),Object.keys(G).forEach(O=>{if(!N.has(O)){const U=G[O];U?.layer&&F?.hasLayer(U.layer)&&F.removeLayer(U.layer),U?.boundsLayer&&F?.hasLayer(U.boundsLayer)&&F.removeLayer(U.boundsLayer),be(O),delete G[O]}}),D.value=E,Ie()},{immediate:!0,deep:!0}),e.watch(()=>s.bounds,()=>{F&&(Object.values(G).forEach(m=>{m.boundsLayer&&F.hasLayer(m.boundsLayer)&&F.removeLayer(m.boundsLayer),m.boundsLayer=null}),Te(),Ie())},{deep:!0}),e.watch(()=>s.katottg,async m=>{if(V.value=[],!m){Te();return}try{const p=await fetch(`https://data.gki.com.ua/api-user/atu/${m}`);if(!p?.ok)return;const N=(await p.json())?.geometry?.coordinates;Array.isArray(N)&&N.length&&(V.value=N)}catch(p){console.error("Failed to fetch KATOTTG bounds",p)}finally{Te(),Ie()}},{immediate:!0}),e.watch(()=>s.modelValue,m=>{if(!F||!L){M.value=m;return}Oe(m)},{deep:!0});function _t(m){const p=j.value;return m instanceof p.Circle?"Circle":m instanceof p.Rectangle?"Rectangle":m instanceof p.Polygon&&!(m instanceof p.Rectangle)?"Polygon":m instanceof p.Polyline&&!(m instanceof p.Polygon)?"Polyline":m instanceof p.Marker?"Point":"Feature"}function nt(m){const p=j.value;if(m instanceof p.Circle){const E=m.getRadius();return Math.PI*(E*E)/1e6}if(m instanceof p.Polygon||m instanceof p.Rectangle)try{const E=m.getLatLngs();if(!Array.isArray(E)||!E.length)return null;if(!Array.isArray(E[0])){const ee=p.GeometryUtil?.geodesicArea?p.GeometryUtil.geodesicArea(E):0;return ee?Math.abs(ee)/1e6:0}const N=E[0];if(N.length>0&&(N[0]instanceof p.LatLng||typeof N[0]?.lat=="number")){const{feature:ee}=m;if(ee?.geometry?.type==="MultiPolygon"){const de=E.reduce(($e,lt)=>{if(!Array.isArray(lt)||!lt.length)return $e;if(p.GeometryUtil?.geodesicArea){const at=p.GeometryUtil.geodesicArea(lt);if(at)return $e+Math.abs(at)}return $e},0);return de?de/1e6:0}const ie=p.GeometryUtil?.geodesicArea?p.GeometryUtil.geodesicArea(E):0;return ie?Math.abs(ie)/1e6:0}const U=E.reduce((ee,X)=>{if(!Array.isArray(X)||!X.length)return ee;const ie=Array.isArray(X[0])?X[0]:X;if(p.GeometryUtil?.geodesicArea){const de=p.GeometryUtil.geodesicArea(ie);if(de)return ee+Math.abs(de)}return ee},0);return U?U/1e6:0}catch{return null}return null}function Et(m){return m instanceof j.value.Circle?m.getLatLng():m.getBounds?m.getBounds().getCenter():m.getLatLng?m.getLatLng():F.getCenter()}function ve(m){const p=L.toGeoJSON(),E=[],N=[];let O=null;const U=X=>{if(X)switch(X.type){case"Point":O=X;break;case"Polygon":E.push(X.coordinates);break;case"MultiPolygon":E.push(...X.coordinates);break;case"LineString":N.push(X.coordinates);break;case"MultiLineString":N.push(...X.coordinates);break;case"GeometryCollection":(X.geometries||[]).forEach(U);break}};(p?.features||[]).forEach(X=>U(X.geometry));const ee=O||(E.length?{type:E.length===1?"Polygon":"MultiPolygon",coordinates:E.length===1?E[0]:E}:N.length?{type:N.length===1?"LineString":"MultiLineString",coordinates:N.length===1?N[0]:N}:null);!m?.silent&&!A&&i("update:modelValue",ee),u.value=L.getLayers().length}function Oe(m){if(!L||!j.value)return;L.clearLayers();const p=ni(m);if(!p){B.value=null,u.value=0;return}j.value.geoJSON(p).eachLayer(N=>L.addLayer(N)),A=!0,ve({silent:!0}),A=!1,Me();const E=L.getBounds?.();E?.isValid?.()&&F?.fitBounds(E,{padding:[24,24]})}function Me(){const m=L.getLayers();if(!m.length){B.value=null,u.value=0;return}const p=m[m.length-1],E=_t(p),N=Et(p),O=L.toGeoJSON(),U=O?.features?.some(de=>de.geometry?.type==="MultiPolygon")||O?.geometry?.type==="MultiPolygon",ee=m.length>1&&m.every(de=>de instanceof j.value.Polygon||de instanceof j.value.Rectangle),X=U||ee;let ie=null;if(X){const de=m.reduce(($e,lt)=>{const at=nt(lt);return $e+(at?at*1e6:0)},0);ie=de?de/1e6:0}else ie=nt(p);B.value={type:E,center:N,areaKm2:ie,layer:p},u.value=m.length}const Se=e.ref("");function Re(m){if(d.value||!F||!j.value)return;T?.disable&&T.disable();const p=j.value;switch(m){case"marker":T=new p.Draw.Marker(F);break;case"polyline":T=new p.Draw.Polyline(F);break;case"polygon":T=new p.Draw.Polygon(F);break;case"rectangle":T=new p.Draw.Rectangle(F);break}T.enable(),Se.value=m}function Kt(){if(d.value)return;const m=B.value?.layer;m&&(m.getBounds?F.fitBounds(m.getBounds(),{padding:[30,30]}):m.getLatLng&&F.setView(m.getLatLng(),Math.max(f.value,14)))}function Yt(){d.value||L&&(L.clearLayers(),i("update:modelValue",null),B.value=null,u.value=0)}const Vt=e.ref(null);function Wt(){d.value||Vt.value?.click()}function vt(m){if(d.value)return;const p=m.target,E=p.files?.[0];if(!E)return;const N=new FileReader;N.onload=()=>{try{const O=JSON.parse(String(N.result));L.clearLayers(),O&&j.value.geoJSON(O).eachLayer(U=>L.addLayer(U)),ve(),Me()}finally{p.value=""}},N.readAsText(E)}function v(){if(d.value)return;const m=L.toGeoJSON(),p=new Blob([JSON.stringify(m,null,2)],{type:"application/json"}),E=URL.createObjectURL(p),N=document.createElement("a");N.href=E,N.download="data.geojson",N.click(),URL.revokeObjectURL(E)}function C(m){!F||!j.value||!z[m]||(xe&&F.removeLayer(xe),xe=j.value.tileLayer(z[m].url,{maxZoom:19,minZoom:6,pane:rt}).addTo(F),re.value=m)}function $(m){if(!F||!j.value)return;const p=j.value.latLng(m[0],m[1]);F.setView(p,13)}let W=null;return e.onMounted(async()=>{j.value=await Z();const m=j.value;m.drawLocal=_s,F=m.map(h.value,{zoomControl:!1,scrollWheelZoom:!1}).setView(x.value,f.value),m.control.zoom({position:"bottomright"}).addTo(F);const p=re.value||Object.keys(z)[0];F.createPane(rt),F.getPane(rt).style.zIndex="180",F.createPane(st),F.getPane(st).style.zIndex="220",p&&z[p]&&(re.value=p,xe=m.tileLayer(z[p].url,{maxZoom:19,minZoom:6,pane:rt}).addTo(F)),L=new m.FeatureGroup().addTo(F),F.on(m.Draw.Event.CREATED,N=>{if(d.value)return;const{layer:O}=N;L.clearLayers(),L.addLayer(O),ve(),Me(),Se.value=""}),F.on(m.Draw.Event.EDITED,()=>{d.value||(ve(),Me())}),F.on(m.Draw.Event.DELETED,()=>{d.value||(ve(),Me())});let E=!1;F.on("mousemove",N=>{E||(F.invalidateSize(),E=!0)}),F.on("zoomend",()=>{f.value=F.getZoom()}),W=me(),Ie(),Te(),M.value!==void 0&&(Oe(M.value),M.value=void 0)}),e.onUnmounted(()=>{W?.(),be(),I&&F?.hasLayer(I)&&(F.removeLayer(I),I=null),F?.remove&&F.remove()}),e.watch(c,()=>{setTimeout(()=>{F?.invalidateSize&&F.invalidateSize()},50)}),e.watch(g,async m=>{if(!m||!w.value){k.value=null;return}await e.nextTick();const p=w.value.getBoundingClientRect();k.value={top:p.bottom+6,left:p.left}}),(m,p)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",disabled:!c.value},[e.createElementVNode("div",{class:e.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:c.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:h,class:"w-full h-full"},null,512),e.createVNode(e.Transition,{name:"zoom-instructions","enter-active-class":"transition-all duration-200 ease-out","leave-active-class":"transition-all duration-500 ease-in","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:e.withCtx(()=>[y.value&&s.handleZoom?(e.openBlock(),e.createElementBlock("div",li,[e.createElementVNode("div",ai,[e.createElementVNode("p",oi,e.toDisplayString(_.value),1)])])):e.createCommentVNode("",!0)]),_:1}),P.value.search||P.value.import||P.value.export?(e.openBlock(),e.createElementBlock("div",ri,[P.value.search?(e.openBlock(),e.createBlock(Zs,{key:0,onGoToCoordinates:$})):e.createCommentVNode("",!0),P.value.import||P.value.export?(e.openBlock(),e.createElementBlock("div",si,[e.createElementVNode("div",ii,[P.value.import?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:Wt,disabled:d.value}," Import ",8,di)):e.createCommentVNode("",!0),P.value.export?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:v,disabled:d.value||u.value===0}," Export ",8,ci)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:Vt,type:"file",onChange:vt,accept:".json,.geojson",class:"hidden",disabled:d.value},null,40,ui)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),le.value.length?(e.openBlock(),e.createElementBlock("div",{key:1,class:"absolute z-[1500] pointer-events-none",style:e.normalizeStyle(R.value)},[e.createElementVNode("div",pi,[e.createElementVNode("dl",mi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(le.value,E=>(e.openBlock(),e.createElementBlock("div",{key:`${E.key}-${E.value}`,class:"flex justify-between gap-2"},[e.createElementVNode("dt",hi,e.toDisplayString(E.key),1),e.createElementVNode("dd",fi,e.toDisplayString(E.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",gi,[e.createElementVNode("div",yi,[P.value.point?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":Se.value==="marker"}]),title:"Point",onClick:p[0]||(p[0]=E=>Re("marker")),disabled:d.value},[e.createVNode(Bs)],10,ki)):e.createCommentVNode("",!0),P.value.line?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":Se.value==="polyline"}]),title:"Line",onClick:p[1]||(p[1]=E=>Re("polyline")),disabled:d.value},[e.createVNode(Ss)],10,bi)):e.createCommentVNode("",!0),P.value.polygon?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":Se.value==="polygon"}]),title:"Polygon",onClick:p[2]||(p[2]=E=>Re("polygon")),disabled:d.value},[e.createVNode(Fs)],10,wi)):e.createCommentVNode("",!0),P.value.rectangle?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":Se.value==="rectangle"}]),title:"Rectangle",onClick:p[3]||(p[3]=E=>Re("rectangle")),disabled:d.value},[e.createVNode(Os)],10,xi)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:p[4]||(p[4]=E=>c.value=!c.value),title:"Full Screen"},[e.createVNode(Ps,{style:{width:"12px",height:"12px"}})])])]),e.createElementVNode("div",{class:e.normalizeClass(["absolute left-4 z-[1000]",B.value?"bottom-8":"bottom-4"])},[e.createElementVNode("div",_i,[e.createVNode(ti,{basemaps:e.unref(z),onOnLayerChange:C},null,8,["basemaps"]),te.value.length?(e.openBlock(),e.createElementBlock("div",Ei,[p[9]||(p[9]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),e.createElementVNode("div",Vi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(te.value,E=>(e.openBlock(),e.createElementBlock("label",{key:E.id,class:"flex items-center gap-2 cursor-pointer select-none"},[e.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:E.visible,disabled:d.value,onChange:N=>xt(E.id)},null,40,vi),e.createElementVNode("span",Bi,e.toDisplayString(E.config.title||E.config.name||E.id),1)]))),128))])])):e.createCommentVNode("",!0)])],2),e.createElementVNode("div",Ci,[B.value?(e.openBlock(),e.createElementBlock("div",Ni,[e.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:p[5]||(p[5]=E=>g.value=!0),onMouseleave:p[6]||(p[6]=E=>g.value=!1)},[e.createElementVNode("div",Mi,[p[10]||(p[10]=e.createTextVNode(" Type: ",-1)),e.createElementVNode("span",Si,e.toDisplayString(B.value.type),1)]),b.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"addressEl",ref:w,class:"text-gray-500 text-xs truncate cursor-help",style:{"max-width":"260px"}}," Address: "+e.toDisplayString(b.value),513)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[g.value&&b.value&&k.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed z-[99999] pointer-events-none bg-gray-800 text-white text-xs px-2 py-1 rounded shadow whitespace-nowrap",style:e.normalizeStyle({top:k.value.top+"px",left:k.value.left+"px"})},e.toDisplayString(b.value),5)):e.createCommentVNode("",!0)]))],32),e.createElementVNode("div",$i,[e.createElementVNode("div",Di,[p[11]||(p[11]=e.createTextVNode(" Center: ",-1)),e.createElementVNode("b",null,e.toDisplayString(B.value.center.lat.toFixed(5))+", "+e.toDisplayString(B.value.center.lng.toFixed(5)),1)]),B.value.areaKm2!==null?(e.openBlock(),e.createElementBlock("div",Ai,[p[12]||(p[12]=e.createTextVNode(" Area: ",-1)),e.createElementVNode("b",null,e.toDisplayString(B.value.areaKm2.toFixed(1))+" km²",1)])):(e.openBlock(),e.createElementBlock("div",Fi,p[13]||(p[13]=[e.createTextVNode("Area: ",-1),e.createElementVNode("b",null,"—",-1)]))),e.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:"Zoom to feature",onClick:p[7]||(p[7]=E=>Kt()),disabled:d.value},p[14]||(p[14]=[e.createElementVNode("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"},[e.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),e.createElementVNode("path",{d:"M7 10l6 0"}),e.createElementVNode("path",{d:"M10 7l0 6"}),e.createElementVNode("path",{d:"M21 21l-6 -6"})],-1)]),8,Li),e.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:"Delete feature",onClick:p[8]||(p[8]=E=>Yt()),disabled:d.value},[e.createVNode(je,{class:"w-3 h-3"})],8,Ti)])])):e.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-aaf0f9a6"]]),Ii=["data-focus"],Oi={class:"flex items-center"},Ri={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},zi=["onClick","aria-label"],ji={key:0,class:"absolute text-gray-500 truncate pl-2"},Pi={class:"flex-1 min-w-[2px]"},Ui=["placeholder"],Hi={class:"flex items-center shrink-0"},qi=["disabled"],mn=e.defineComponent({__name:"vs-input-tag",props:e.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=t;he(n.style);const o=e.ref(null),r=e.ref(null),s=e.ref(null),i=e.ref(!1),d=e.ref(""),c=e.useModel(l,"modelValue"),h=e.computed(()=>n.placeholder||"Add tag…"),y=e.computed(()=>c.value?.length===0&&d.value===""),_=e.computed(()=>!n.disabled&&c.value?.length>0),b=e.computed(()=>n.disabled),B=async()=>{b.value||await e.nextTick(()=>s.value?.focus())},g=M=>{const A=M.trim();A!==""&&(!c.value||!Array.isArray(c.value)?c.value=[A]:n.unique?c.value.includes(A)||(c.value=[...c.value,A]):c.value=[...c.value,A],d.value="")},k=()=>{const M=d.value;M.trim()!==""&&g(M),d.value=""},w=M=>{const A=c.value.slice();A.splice(M,1),a("update:modelValue",A)},u=()=>{a("update:modelValue",[])},x=()=>{b.value||(i.value=!0)},f=()=>{i.value=!1,!b.value&&k()},V=M=>{const{key:A}=M;A==="Enter"?(M.preventDefault(),k()):A==="Backspace"&&d.value===""&&c.value.length>0&&w(c.value.length-1)};return(M,A)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:A[1]||(A[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass]),role:"group","aria-label":"Tag input"},[e.createElementVNode("div",{class:e.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":"",b.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:B},[e.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},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(j,P)=>(e.openBlock(),e.createElementBlock("div",{key:P,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",Oi,[e.createElementVNode("div",Ri,e.toDisplayString(j),1)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:e.withModifiers(G=>w(P),["stop"]),"aria-label":`Remove ${j}`},A[2]||(A[2]=[e.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"},[e.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,zi)]))),128)),y.value?(e.openBlock(),e.createElementBlock("div",ji,e.toDisplayString(h.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Pi,[b.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:s,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":A[0]||(A[0]=j=>d.value=j),onFocus:x,onBlur:f,onKeydown:V,placeholder:c.value&&c.value.length?"":void 0},null,40,Ui)),[[e.vModelText,d.value]])])],512),e.createElementVNode("div",Hi,[_.value?(e.openBlock(),e.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:b.value,onClick:e.withModifiers(u,["stop"])},A[3]||(A[3]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.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,qi)):e.createCommentVNode("",!0)])],10,Ii)],2)],512))}}),Gi={class:"relative flex gap-1 bg-white w-full"},Ki=["disabled","placeholder"],hn=Y(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=e.inject("values"),n=l,a=e.useModel(l,"modelValue");function o(s){const i={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ы:"y",э:"e",ю:"yu",я:"ya",ь:"",ъ:"",є:"ye",і:"i",ї:"yi",ґ:"g"};return s.toLowerCase().split("").map(d=>i[d]||d).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const r=()=>{const s=t?.value?.[n.parent||""]?.toString(),i=o(s);a.value=i.toString()};return(s,i)=>(e.openBlock(),e.createElementBlock("div",Gi,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:s.disabled,placeholder:s.placeholder,"onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 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,8,Ki),[[e.vModelText,a.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:r}," Gen ")]))}}),[["__scopeId","data-v-b0eba370"]]),Yi={class:"relative flex gap-1 bg-white w-full"},Wi=["disabled","placeholder"],Zi=["disabled"],Ji={key:0},Xi={key:1},fn=Y(e.defineComponent({__name:"vs-input-codegen",props:e.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref(!1),o=e.computed(()=>t.init!==!1),r=e.computed(()=>!!t.table&&!!t.code),s=()=>{if(!r.value)return"";const c=encodeURIComponent(String(t.table)),h=encodeURIComponent(String(t.code));return`/api/code-gen/${c}/${h}`},i=async()=>{if(!r.value||a.value)return;const c=s();if(c){a.value=!0;try{const y=await(await fetch(c)).text();n.value=y}finally{a.value=!1}}},d=()=>{o.value&&(n.value||i())};return e.onMounted(()=>{d()}),e.watch(()=>[t.table,t.code,t.init],()=>{d()}),(c,h)=>(e.openBlock(),e.createElementBlock("div",Yi,[e.withDirectives(e.createElementVNode("input",{disabled:c.disabled,placeholder:c.placeholder,"onUpdate:modelValue":h[0]||(h[0]=y=>n.value=y),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 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,8,Wi),[[e.vModelText,n.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:a.value||c.disabled||!r.value,onClick:i},[a.value?(e.openBlock(),e.createElementBlock("span",Xi,"...")):(e.openBlock(),e.createElementBlock("span",Ji,"Gen"))],8,Zi)]))}}),[["__scopeId","data-v-6ee5237d"]]),Qi={class:"w-full"},ed={ref:"sortableContainer",class:"flex flex-col gap-1"},td=["onDragstart","onDrop"],nd={class:"w-1/3"},ld={class:"w-2/3"},ad=["onClick"],od={key:0,class:"text-[14px] text-gray-700"},rd={class:"mt-2 w-full flex items-center"},sd=["disabled"],gn=Y(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=k=>`${k}-${Math.random().toString(36).substring(2,15)}`,a=e.inject("values"),o=l,r=t,s=o.addButtonText??"Додати",i=o.ignore??[],d=e.ref([]),c=e.ref(null);(()=>{const k=o.parent&&a?.value?.[o.parent]||o.modelValue||{};d.value=Object.entries(k).filter(([w])=>!i.includes(w)).map(([w,u])=>({id:n("key-value-"),key:w,value:u}))})();function y(k){c.value=k}function _(k){if(c.value===null||c.value===k)return;const w=d.value.splice(c.value,1)[0];d.value.splice(k,0,w),c.value=null}const b=e.computed(()=>d.value.some(k=>k.key&&!k.value||!k.key&&k.value)),B=()=>{d.value.push({id:n("key-value-"),key:"",value:""})},g=k=>{d.value=d.value.filter(w=>w.id!==k)};return e.watch(d,k=>{const w={};k.forEach(x=>{x.key&&x.value!==void 0&&(w[x.key]=x.value)});const u={};i.length&&i.forEach(x=>{u[x]=o.parent?a?.value?.[o.parent]?.[x]:void 0}),a?.value&&o.parent&&(a.value[o.parent]={...u,...w}),r("update:modelValue",w)},{deep:!0}),(k,w)=>(e.openBlock(),e.createElementBlock("div",Qi,[e.createElementVNode("div",ed,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(u,x)=>(e.openBlock(),e.createElementBlock("div",{key:u.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":c.value===x}]),draggable:"true",onDragstart:f=>y(x),onDragover:w[0]||(w[0]=e.withModifiers(()=>{},["prevent"])),onDrop:f=>_(x)},[w[1]||(w[1]=e.createStaticVNode('<button class="cursor-move" data-v-a0f7fbfc><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-a0f7fbfc><circle cx="15" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="18" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="18" r="1.5" data-v-a0f7fbfc></circle></svg></button>',1)),e.createElementVNode("div",nd,[e.createVNode(ze,{modelValue:u.key,"onUpdate:modelValue":f=>u.key=f,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",ld,[e.createVNode(ze,{modelValue:u.value,"onUpdate:modelValue":f=>u.value=f,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:f=>g(u.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[e.createVNode(e.unref(Ct),{height:"16",width:"16"})],8,ad)],42,td))),128))],512),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",od," Дані для відображення відсутні ")),e.createElementVNode("div",rd,[e.createElementVNode("button",{type:"button",onClick:B,disabled:b.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(Be,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(s)),1)],8,sd)])]))}}),[["__scopeId","data-v-a0f7fbfc"]]),id={class:"w-full"},dd={ref:"sortableContainer",class:"flex flex-col gap-1"},cd=["onDragstart","onDrop"],ud=["disabled"],pd={class:"flex-1"},md=["onClick","disabled"],hd={key:0,class:"text-[14px] text-gray-700"},fd={class:"mt-2 w-full flex items-center"},gd=["disabled"],yn=Y(e.defineComponent({__name:"vs-input-text-array",props:e.mergeModels({addButtonText:{default:"Додати"},inputType:{default:"text"},placeholder:{default:"Значення"},mask:{default:""},disabled:{type:Boolean,default:!1}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.ref(null),r=e.computed(()=>!!t.disabled),s=e.computed(()=>t.placeholder??""),i=e.computed(()=>t.addButtonText??"Додати");let d=!1;const c=k=>`${k}-${Math.random().toString(36).substring(2,15)}`,h=k=>{const w=k??n.value??[];a.value=w.map((u,x)=>({id:a.value[x]?.id??c("text-array"),value:u??""}))};h(),e.watch(()=>n.value,k=>{if(d){d=!1;return}h(k||[])},{deep:!0}),e.watch(a,k=>{d=!0,n.value=k.map(w=>w.value).filter(w=>w!=null&&w!=="")},{deep:!0});const y=e.computed(()=>r.value||a.value.some(k=>!k.value));function _(){y.value||(a.value=[...a.value,{id:c("text-array"),value:""}])}function b(k){r.value||(a.value=a.value.filter(w=>w.id!==k))}function B(k){r.value||(o.value=k)}function g(k){if(r.value||o.value===null||o.value===k)return;const w=[...a.value],[u]=w.splice(o.value,1);w.splice(k,0,u),a.value=w,o.value=null}return(k,w)=>(e.openBlock(),e.createElementBlock("div",id,[e.createElementVNode("div",dd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(u,x)=>(e.openBlock(),e.createElementBlock("div",{key:u.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":o.value===x}]),draggable:"true",onDragstart:f=>B(x),onDragover:w[0]||(w[0]=e.withModifiers(()=>{},["prevent"])),onDrop:f=>g(x)},[e.createElementVNode("button",{class:"cursor-move",type:"button",disabled:r.value},w[1]||(w[1]=[e.createStaticVNode('<svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-66316a33><circle cx="15" cy="12" r="1.5" data-v-66316a33></circle><circle cx="15" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="12" r="1.5" data-v-66316a33></circle><circle cx="21" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="18" r="1.5" data-v-66316a33></circle><circle cx="15" cy="18" r="1.5" data-v-66316a33></circle></svg>',1)]),8,ud),e.createElementVNode("div",pd,[k.inputType==="text"?(e.openBlock(),e.createBlock(ze,{key:0,modelValue:u.value,"onUpdate:modelValue":f=>u.value=f,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),k.inputType==="tel"?(e.openBlock(),e.createBlock(Dt,{key:1,modelValue:u.value,"onUpdate:modelValue":f=>u.value=f,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),k.inputType==="email"?(e.openBlock(),e.createBlock($t,{key:2,modelValue:u.value,"onUpdate:modelValue":f=>u.value=f,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),k.inputType==="mask"?(e.openBlock(),e.createBlock(St,{key:3,modelValue:u.value,"onUpdate:modelValue":f=>u.value=f,mask:k.mask,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","mask","disabled","placeholder"])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:f=>b(u.id),disabled:r.value,class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200 disabled:opacity-50"},[e.createVNode(e.unref(Ct),{height:"16",width:"16"})],8,md)],42,cd))),128))],512),a.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",hd," Дані для відображення відсутні ")),e.createElementVNode("div",fd,[e.createElementVNode("button",{type:"button",onClick:_,disabled:y.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(Be,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(i.value),1)],8,gd)])]))}}),[["__scopeId","data-v-66316a33"]]),yd={class:"flex items-center gap-2 w-full"},kd=["disabled"],bd=["disabled"],kn=e.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,{inputClass:a}=he(n.style),o=t,r=e.computed({get:()=>n.modelValue||"#000000",set:i=>o("update:modelValue",i)}),s=e.computed(()=>!!n.disabled);return(i,d)=>(e.openBlock(),e.createElementBlock("div",yd,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[0]||(d[0]=c=>r.value=c),disabled:s.value,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[i.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,kd),[[e.vModelText,r.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":d[1]||(d[1]=c=>r.value=c),disabled:s.value},null,8,bd),[[e.vModelText,r.value]])]))}}),wd={class:"flex items-center gap-2 w-full"},xd=["min","max","step","disabled"],_d=["disabled"],bn=e.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,{inputClass:a}=he(n.style),o=t,r=e.computed({get:()=>Number(n.modelValue??n.min),set:i=>o("update:modelValue",Number(i))}),s=e.computed(()=>!!n.disabled);return(i,d)=>(e.openBlock(),e.createElementBlock("div",wd,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":d[0]||(d[0]=c=>r.value=c),min:i.min,max:i.max,step:i.step,disabled:s.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[i.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")])},null,10,xd),[[e.vModelText,r.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":d[1]||(d[1]=c=>r.value=c),disabled:s.value},null,8,_d),[[e.vModelText,r.value]])]))}}),Ed=["placeholder","disabled","name"],Vd=["type","value","onInput","placeholder","disabled"],vd=["onClick"],wn=e.defineComponent({__name:"vs-input-array",props:e.mergeModels({count:{default:1},limit:{default:1},mask:{default:""},unmask:{type:Boolean,default:!1},inputType:{default:"text"},isAdded:{type:Boolean,default:!1},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.ref(t.count),a=e.computed(()=>t.limit),{inputClass:o}=he(t.style),r=e.useModel(l,"modelValue"),s=e.computed(()=>!!t.disabled),i=e.computed(()=>t.placeholder??"");e.watchEffect(()=>{const g=r.value?.length??0;g<n.value&&(r.value=[...r.value??[],...Array(n.value-g)])});const d=e.ref({}),c=e.ref({});function h(g,k){g&&(d.value[k]=g)}async function y(g,k){if(!g||t.inputType!=="mask")return;const{default:w}=await Promise.resolve().then(()=>qt);c.value[k]&&c.value[k].destroy(),c.value[k]=w(g,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),c.value[k].on("accept",()=>{const u=[...r.value||[]];u[k]=t.unmask?c.value[k].unmaskedValue:c.value[k].value,r.value=u}),c.value[k].on("complete",()=>{const u=[...r.value||[]];u[k]=t.unmask?c.value[k].unmaskedValue:c.value[k].value,r.value=u}),r.value?.[k]&&(c.value[k].value=r.value[k])}function _(g,k){if(s.value)return;const w=g.target.value??null,u=[...r.value];u[k]=t.inputType==="text"?w:Number(w),r.value=u}function b(){n.value+=1;const g=t.inputType==="text"||t.inputType==="mask"?null:0;r.value=[...r.value,g],t.inputType==="mask"&&setTimeout(()=>{const k=n.value-1;d.value[k]&&y(d.value[k],k)},0)}function B(g){if(n.value>1){c.value[g]&&(c.value[g].destroy(),delete c.value[g]),n.value-=1,r.value=r.value.filter((w,u)=>u!==g);const k={};Object.keys(c.value).forEach(w=>{const u=parseInt(w,10);u>g?k[u-1]=c.value[u]:u<g&&(k[u]=c.value[u])}),c.value=k}}return e.onMounted(()=>{if(t.inputType==="mask")for(let g=0;g<n.value;g+=1)d.value[g]&&y(d.value[g],g)}),e.onBeforeUnmount(()=>{Object.values(c.value).forEach(g=>{g&&g.destroy()})}),e.watch(()=>t.mask,g=>{t.inputType==="mask"&&Object.values(c.value).forEach(k=>{k&&k.updateOptions({mask:g,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})})}),e.watch(r,g=>{t.inputType==="mask"&&g&&g.forEach((k,w)=>{c.value[w]&&c.value[w].value!==k&&(c.value[w].value=k||"")})},{deep:!0}),(g,k)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["grid gap-2",`grid-cols-${a.value}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,w=>(e.openBlock(),e.createElementBlock("div",{key:w,class:"flex items-center gap-2 w-full"},[g.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:u=>h(u,w-1),placeholder:g.placeholder,disabled:g.disabled,name:`${g.name}[${w-1}]`,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":g.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Ed)):(e.openBlock(),e.createElementBlock("input",{key:1,type:g.inputType,value:r.value?.[w-1],onInput:u=>_(u,w-1),placeholder:i.value,disabled:s.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":g.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Vd)),!g.disabled&&w===n.value&&g.isAdded?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:e.withModifiers(b,["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-green-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(Be,{height:"18",width:"18"})])):e.createCommentVNode("",!0),!g.disabled&&n.value>1&&g.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(u=>B(w-1),["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-red-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(Ct,{height:"18",width:"18"})],8,vd)):e.createCommentVNode("",!0)]))),128))],2))}}),Bd={class:"flex items-center gap-2 w-full"},Cd={class:"relative flex-1"},Nd=["placeholder","disabled","onKeydown"],Md=["disabled"],Sd={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},$d={key:1,class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},Dd={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},Ad={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},Fd={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},Ld=["onClick"],Td={key:0,class:"p-4 text-sm text-gray-500"},xn=e.defineComponent({__name:"vs-input-address",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{},api:{default:""},geom:{default:""},includes:{default:()=>[]}},{modelValue:{default:""},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=t,{inputClass:o}=he(n.style),r=e.useModel(l,"modelValue"),s=e.computed({get:()=>r.value,set:w=>{r.value=w}}),i=e.ref(!1),d=e.ref([]),c=e.ref(!1),h=e.computed(()=>n.placeholder??""),y=e.computed(()=>!!n.disabled),_=e.inject("values");function b(){!y.value&&s.value.trim()&&B()}async function B(){const w=(s.value||"").trim();if(!w)return;let u=w;if(n.includes?.length&&_?.value){const f=n.includes.map(V=>_.value?.[V]).filter(Boolean);f.length&&(u=`${f.join(", ")}, ${w}`)}const x=n.api.replace("{{value}}",encodeURIComponent(u));i.value=!0;try{const V=await(await fetch(x)).json();d.value=Array.isArray(V)?V:[],c.value=!0}catch(f){console.error("Address search error:",f)}finally{i.value=!1}}function g(){c.value=!c.value}function k(w){if(!w)return;c.value=!1;const u=parseFloat(w.lat),f={type:"Point",coordinates:[parseFloat(w.lon),u]};n.geom&&_?.value&&(_.value[n.geom]=f),a("update:geom",f)}return(w,u)=>(e.openBlock(),e.createElementBlock("div",Bd,[e.createElementVNode("div",Cd,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":u[0]||(u[0]=x=>s.value=x),placeholder:h.value,disabled:y.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[e.unref(o),{"!border-red-600":n.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:e.withKeys(e.withModifiers(b,["prevent"]),["enter"])},null,42,Nd),[[e.vModelText,s.value]]),d.value.length?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:g,title:"Show search results"},u[2]||(u[2]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),e.createElementVNode("path",{d:"M12 16v-4"}),e.createElementVNode("path",{d:"M12 8h.01"})],-1)]))):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:B,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:i.value||!s.value?.trim()},[i.value?(e.openBlock(),e.createElementBlock("svg",$d,u[4]||(u[4]=[e.createElementVNode("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e.createElementVNode("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)]))):(e.openBlock(),e.createElementBlock("svg",Sd,u[3]||(u[3]=[e.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),e.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},null,-1)])))],8,Md),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[c.value?(e.openBlock(),e.createElementBlock("div",Dd,[e.createElementVNode("div",Ad,[e.createElementVNode("div",Fd,[u[6]||(u[6]=e.createElementVNode("span",null,"Search results",-1)),e.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:u[1]||(u[1]=x=>c.value=!1),title:"Close"},u[5]||(u[5]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)]))]),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(x,f)=>(e.openBlock(),e.createElementBlock("li",{key:f,onClick:V=>k(x),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString(x.display_name),9,Ld))),128))]),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Td," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),_n=(l="")=>`${l}${Math.floor(Math.random()*1e4)}`,Id={class:"vs-datalist space-y-3"},Od={class:"space-y-3"},Rd=["onClick","disabled"],zd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},jd=["disabled"],Pd=Y(e.defineComponent({__name:"vs-input-datalist",props:e.mergeModels({schema:{default:()=>[]},minItems:{default:0},maxItems:{default:void 0},addButtonText:{default:"Додати позицію"},emptyLabel:{default:"Немає рядків"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>Array.isArray(n.value)?n.value:[]),o=e.ref([]),r=e.computed(()=>t.schema?.map(g=>({...g,disabled:t.disabled||g.disabled}))??[]),s=e.computed(()=>r.value.map(g=>B(g))),i=e.computed(()=>t.disabled?!1:t.maxItems?a.value.length<t.maxItems:!0),d=e.computed(()=>t.disabled||a.value.length<=(t.minItems||0));e.watch(()=>a.value.length,()=>{c(),h()},{immediate:!0}),e.watch(()=>t.schema,h,{immediate:!0,deep:!0});function c(){const g=a.value.length;o.value.length<g?o.value=[...o.value,...Array.from({length:g-o.value.length},()=>_n())]:o.value.length>g&&o.value.splice(g)}function h(){if(!t.minItems||a.value.length>=t.minItems)return;const g=t.minItems-a.value.length,k=Array.from({length:g},y);n.value=[...a.value,...k]}function y(){const g={};return r.value.forEach(k=>{g[k.name]=k?.default??null}),g}function _(){i.value&&(n.value=[...a.value,y()],c())}function b(g){d.value||(n.value=a.value.filter((k,w)=>w!==g),c(),h())}function B(g){return{...g}}return(g,k)=>(e.openBlock(),e.createElementBlock("div",Id,[e.createElementVNode("div",Od,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(w,u)=>(e.openBlock(),e.createElementBlock("div",{key:o.value[u],class:"flex items-center gap-3"},[e.createVNode(Ce,{schema:s.value,layout:"inline",navigation:!1,values:a.value[u],"onUpdate:values":x=>a.value[u]=x,"form-id":o.value[u]},null,8,["schema","values","onUpdate:values","form-id"]),e.createElementVNode("button",{type:"button",class:"h-[38px] w-[38px] flex items-center justify-center text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",onClick:x=>b(u),disabled:d.value},[e.createVNode(je,{class:"w-5 h-5"})],8,Rd)]))),128)),a.value.length===0?(e.openBlock(),e.createElementBlock("div",zd,e.toDisplayString(t.emptyLabel),1)):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:_,disabled:!i.value},[e.createVNode(Be,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,jd)]))}}),[["__scopeId","data-v-e8a02c8e"]]),Ud={};function Hd(l,t){return e.openBlock(),e.createElementBlock("svg",e.mergeProps({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"},l.$attrs),t[0]||(t[0]=[e.createElementVNode("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"},null,-1),e.createElementVNode("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"},null,-1)]),16)}const qd=Y(Ud,[["render",Hd]]),Gd={class:"vs-dataform space-y-4"},Kd={class:"flex items-center justify-between mb-3"},Yd={class:"text-sm font-medium text-gray-700"},Wd={class:"flex items-center gap-2"},Zd=["title","onClick","disabled"],Jd=["title","onClick","disabled"],Xd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Qd=["disabled"],En={VsInputText:ze,VsInputRadio:At,"vs-input-text":ze,"vs-input-password":yl,"vs-input-textarea":dn,"vs-input-mask":St,"vs-input-number":Jt,"vs-input-radio":At,"vs-input-select":Ft,"vs-input-switcher":Nt,"vs-input-static":Mt,"vs-input-container":sn,"vs-input-date":pa,"vs-input-checkbox":Xt,"vs-input-file":an,"vs-input-html":Mt,"vs-input-email":$t,"vs-input-tel":Dt,"vs-input-datatable":un,"vs-input-map":pn,"vs-input-file-list":on,"vs-input-tags":mn,"vs-input-slug":hn,"vs-input-codegen":fn,"vs-input-key-value":gn,"vs-input-text[]":yn,"vs-input-range":bn,"vs-input-color":kn,"vs-input-native-select":Ft,"vs-input-array":wn,"vs-input-address":xn,"vs-input-datalist":Pd,"vs-input-dataform":Y(e.defineComponent({__name:"vs-input-dataform",props:e.mergeModels({schema:{default:()=>[]},minGroups:{default:0},maxGroups:{default:void 0},addButtonText:{default:"Додати групу фільтрів"},groupLabel:{default:"Якщо поле"},duplicateTitle:{default:"Дублювати групу"},removeTitle:{default:"Видалити групу"},emptyLabel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.computed(()=>t.groupLabel),r=e.computed(()=>t.emptyLabel??"Ще немає груп"),s=e.computed(()=>t.schema?.map(w=>({...w,disabled:t.disabled||w.disabled}))??[]),i=e.computed(()=>s.value.map(w=>k(w))),d=e.computed(()=>t.disabled?!1:t.maxGroups?n.value.length<t.maxGroups:!0),c=e.computed(()=>t.disabled||n.value.length<=(t.minGroups||0));e.watch(()=>n.value.length,()=>{h(),y()},{immediate:!0}),e.watch(()=>t.schema,y,{immediate:!0,deep:!0});function h(){const w=n.value.length;a.value.length<w?a.value=[...a.value,...Array.from({length:w-a.value.length},()=>_n())]:a.value.length>w&&a.value.splice(w)}function y(){if(!t.minGroups||n.value.length>=t.minGroups)return;const w=t.minGroups-n.value.length,u=Array.from({length:w},_);n.value=[...n.value,...u]}function _(){const w={};return s.value.forEach(u=>{w[u.name]=u?.default??null}),w}function b(){d.value&&(n.value=[...n.value,_()],h())}function B(w){c.value||(n.value=n.value.filter((u,x)=>x!==w),h(),y())}function g(w){if(t.disabled)return;const u=JSON.parse(JSON.stringify(n.value[w]??{}));n.value=[...n.value.slice(0,w+1),u,...n.value.slice(w+1)],h()}function k(w){return{...w}}return(w,u)=>(e.openBlock(),e.createElementBlock("div",Gd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(x,f)=>(e.openBlock(),e.createElementBlock("div",{key:a.value[f],class:"relative border border-gray-200 rounded-lg p-6 bg-white"},[e.createElementVNode("div",Kd,[e.createElementVNode("div",Yd,e.toDisplayString(o.value),1),e.createElementVNode("div",Wd,[e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.duplicateTitle,onClick:V=>g(f),disabled:t.disabled},[e.createVNode(qd,{class:"w-5 h-5"})],8,Zd),e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.removeTitle,onClick:V=>B(f),disabled:c.value},[e.createVNode(je,{class:"w-5 h-5"})],8,Jd)])]),e.createVNode(Ce,{class:"vs-dataform__form",schema:i.value,layout:"inline",navigation:!1,values:n.value[f],"onUpdate:values":V=>n.value[f]=V,"form-id":a.value[f],disabled:t.disabled},null,8,["schema","values","onUpdate:values","form-id","disabled"])]))),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",Xd,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:b,disabled:!d.value},[e.createVNode(Be,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Qd)]))}}),[["__scopeId","data-v-4dc5a1a3"]])},ec=e.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(l){const t=l,n=e.inject("values");async function a(){try{if(!t.api)return;const o=t.api.replace("{{value}}",t.value),r=await fetch(o);if(!r.ok){se.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const s=await r.json();if(!t.set||!n)return;for(const[i,d]of Object.entries(t.set))n.value[i]=s.result[d]}catch(o){console.error(t.error,o)}}return(o,r)=>(e.openBlock(),e.createElementBlock("button",{onClick:a,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"},e.toDisplayString(o.button),1))}}),tc={class:"flex flex-col gap-1 w-full"},nc=["innerHTML"],Vn=e.defineComponent({__name:"vs-compact-form-layout",props:e.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]},columns:{default:()=>({container:12,label:3})}},{modelValue:{default:null},modelModifiers:{}}),emits:e.mergeModels(["value-selected"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=e.useModel(l,"modelValue"),o=t,r=e.computed(()=>fl[`${n.layout}`]),s=["label","placeholder","info","description","text","html"],i=e.ref(k()),d=e.computed(()=>b(n.item,i.value)),c=e.computed(()=>En?.[`vs-input-${n.item.type}`]),h=e.computed(()=>{const u=e.unref(c);if(!u)return new Set;const x=u.props??u.__vccOpts?.props;if(!x)return new Set;const f=Array.isArray(x)?x:Object.keys(x);return new Set(f)}),y=e.computed(()=>{const u=d.value??{},x=h.value;return x.size?Object.fromEntries(Object.entries(u).filter(([f])=>x.has(f))):{}}),_=u=>{const x=typeof u=="object"&&u!==null?u:{value:u};o("value-selected",{...x,name:x.name??n.item?.name})};e.onMounted(()=>{i.value=k(),window.addEventListener("storage",w)}),e.onUnmounted(()=>{window.removeEventListener("storage",w)});function b(u,x){if(!u)return{};const f={...u};return s.forEach(V=>{const M=g(u,V,x);M!=null&&(f[V]=M)}),Array.isArray(u.options)&&(f.options=u.options.map(V=>B(V,x))),f}function B(u,x){if(!u)return u;const f={...u},V=g(u,"label",x),M=g(u,"text",x);return V!=null&&(f.label=V),M!=null?f.text=M:V!=null&&(f.text=V),f}function g(u,x,f){const V=`${x}:${f}`;if(u?.[V]!=null)return u[V];if(x==="label"&&u?.[f]!=null)return u[f];if(u?.[x]!=null)return u[x];if(x==="label"){if(u?.ua!=null)return u.ua;if(u?.en!=null)return u.en}if(x==="text"||x==="html"){if(u?.ua!=null)return u.ua;if(u?.en!=null)return u.en}return null}function k(){return typeof window>"u"?"uk":localStorage.getItem("locale")||"uk"}function w(){i.value=k()}return(u,x)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{ua:d.value.ua,error:n.error||"",item:d.value,columns:n.columns,label:d.value.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${n.item.type}-component`])},[e.createElementVNode("div",tc,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.value),e.mergeProps(y.value,{modelValue:a.value,"onUpdate:modelValue":x[0]||(x[0]=f=>a.value=f),onValueSelected:_}),null,16,["modelValue"])),d.value.description&&n.layout!=="settings"?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-sm text-gray-500",innerHTML:d.value.description},null,8,nc)):e.createCommentVNode("",!0)]),d.value.behavior?.api&&d.value.behavior?.button?(e.openBlock(),e.createBlock(ec,e.mergeProps({key:0},d.value.behavior,{value:a.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),lc={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},ac={class:"vs-compact-form-navigation__rail mt-[6px]"},oc=["onClick"],rc=Y(e.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(l,{expose:t}){const n=l,a=e.ref([]),o=e.ref(""),r=e.ref(""),s=e.computed(()=>!!n.enabled),i=e.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),d=e.computed(()=>{const D=n.width;if(D==null)return{};const te=typeof D=="number"?`${D}px`:`${D}`;return{width:te,minWidth:te}});let c=null,h=0,y=0,_=null,b=null,B=null;const g=()=>P(),k=()=>u();e.watch(()=>n.target,async D=>{if(M(),!D){_=null,a.value=[],o.value="";return}_=D,s.value&&(await e.nextTick(),V(D),u())},{immediate:!0}),e.watch(()=>n.scrollContainer,D=>{if(!s.value){b=D??null;return}w(D??null),e.nextTick(()=>u())},{immediate:!0}),e.onMounted(()=>{n.scrollContainer||w(null),u()}),e.onBeforeUnmount(()=>{M(),w(null,!0),_=null,typeof window<"u"&&(h&&window.cancelAnimationFrame(h),y&&window.cancelAnimationFrame(y))});function w(D,te=!1){if(B&&(B(),B=null),te){b=null;return}if(b=D??null,typeof window>"u")return;const K=D??window,le=window;K.addEventListener("scroll",g,{passive:!0}),le.addEventListener("resize",k),B=()=>{K.removeEventListener("scroll",g),le.removeEventListener("resize",k)}}function u(){if(!s.value||!_)return;h&&typeof window<"u"&&window.cancelAnimationFrame(h);const D=()=>{x(),h=0};typeof window>"u"?D():h=window.requestAnimationFrame(D)}function x(){if(!s.value||!_)return;const D=Array.from(_.querySelectorAll("h1, h2")),te=new Set,K=[];D.forEach((le,R)=>{const S=le.textContent?.trim()??"";if(!S)return;let H=(le.getAttribute("id")??"").trim();H||(H=f(S)||`heading-${R+1}`);let z=H,ae=1;for(;te.has(z);)z=`${H}-${ae+=1}`;le.id!==z&&Object.assign(le,{id:z}),te.add(z),K.push({id:z,text:S,level:le.tagName.toLowerCase()==="h1"?1:2})}),a.value=K,K.length||(o.value=""),j()}function f(D){return D.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function V(D){!D||!s.value||typeof MutationObserver>"u"||(M(),c=new MutationObserver(()=>u()),c.observe(D,{childList:!0,subtree:!0}))}function M(){c&&(c.disconnect(),c=null)}function A(D){const te=b;if(!te)return typeof window>"u"?D.offsetTop:D.getBoundingClientRect().top+window.scrollY;const K=D.getBoundingClientRect(),le=te.getBoundingClientRect();return K.top-le.top+te.scrollTop}function j(){if(!s.value||!a.value.length)return;const D=b,te=(D?D.scrollTop:null)||(typeof window<"u"?window.scrollY:0),K=(D?D.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),le=te+K;let R=null;for(let H=0;H<a.value.length;H+=1){const z=a.value[H],ae=document.getElementById(z.id);if(ae){const re=A(ae);re+ae.offsetHeight>te&&re<le&&(R=z.id)}}!R&&r.value&&(R=r.value),R&&(r.value=R);const S=D?D.scrollHeight-D.clientHeight:document.documentElement.scrollHeight-window.innerHeight;te+5>=S&&(R=a.value[a.value.length-1].id),R&&(o.value=R)}function P(){s.value&&(y&&window.cancelAnimationFrame(y),y=window.requestAnimationFrame(()=>{j(),y=0}))}function G(D){if(!s.value)return;const te=document.getElementById(D);if(!te)return;const K=b,le=Math.max(0,A(te));K?K.scrollTo({top:le,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:le,behavior:"smooth"})}return t({refresh:u}),(D,te)=>s.value&&a.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(d.value)},[e.createElementVNode("h2",lc,e.toDisplayString(D.title),1),e.createElementVNode("div",ac,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,K=>(e.openBlock(),e.createElementBlock("div",{key:K.id,class:e.normalizeClass(["vs-compact-form-navigation__item relative",K.level===2?"vs-compact-form-navigation__item--nested":"",K.id===o.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick:le=>G(K.id),class:e.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",K.level===2?"pl-[15px]":"pl-[18px]",K.id===o.value?"text-gray-800":"text-gray-500"])},[e.createElementVNode("span",null,e.toDisplayString(K.text),1)],10,oc)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-1584a562"]]),Fe={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон",minlength:l=>`Мінімальна довжина — ${l} символів`,maxlength:l=>`Максимальна довжина — ${l} символів`},sc=l=>typeof l=="string"?l.trim()?!1:Fe.required:Array.isArray(l)?l.map(n=>typeof n=="string"?n.trim():n).filter(n=>n!=null&&n!=="").length?!1:Fe.required:l?!1:Fe.required,ic=l=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return l?t.test(l)?!1:Fe.email:!1},dc=l=>{const t=/^\+[1-9]\d{1,14}$/;return l?t.test(l)?!1:Fe.tel:!1},vn=l=>l==null?0:typeof l=="string"?l.trim().length:Array.isArray(l)?l.length:typeof l=="number"?l.toString().length:String(l).length,cc=(l,t)=>{if(l==null)return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&vn(l)<n?t?.message||Fe.minlength(n):!1},uc=(l,t)=>{if(l==null||l==="")return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&vn(l)>n?t?.message||Fe.maxlength(n):!1},pc=(l,t)=>{const n=t.pattern??t.regexp,a=typeof n=="string"?new RegExp(n):n;if(Array.isArray(l)){const o=l.filter(Boolean);return o.length===0||o.every(r=>a.test(r))?!1:t.message}return!a.test(l)&&l?t.message:!1},mc=(l,t)=>!1,hc=(l,t)=>{switch(typeof t=="string"?t:t.type){case"required":return sc(l);case"email":return ic(l);case"tel":return dc(l);case"regexp":return pc(l,t);case"minlength":return cc(l,t);case"maxlength":return uc(l,t);case"custom":return mc();default:return!1}},fc={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function Bn(l){const t=l?.toLowerCase();return fc[t]||t}function Lt(l,t=!1){if(Array.isArray(l)){const a=[];return l.forEach(o=>{const r={...o};r.name=(o.name||o.id||o.key||"").toString(),r.type=Bn(o.type),r.label=o.label||o.ua,r.rules=o.rules||o.validators,r.type==="email"&&!r.rules&&(r.rules=["email"]),o.data&&(r.api=`/api/suggest/${o.data}`),r.disabled=r.disabled||t,Array.isArray(r.schema)&&(r.schema=Lt(r.schema,r.disabled)),a.push(r)}),a}const n=[];return Object.entries(l).forEach(a=>{const o={name:a[0],...a[1],type:Bn(a[1].type),label:a[1].label||a[1].ua,rules:a[1].rules||a[1].validators,disabled:a[1].disabled||t};o.type==="email"&&!o.rules&&(o.rules=["email"]),a[1].type?.includes("list")&&(o.multiple=!0),!o.api&&a[1].data&&(o.api=`/api/suggest/${a[1].data}`),Array.isArray(o.schema)&&(o.schema=Lt(o.schema,o.disabled)),n.push(o)}),n}function gc(l,t,n=!1){const a=e.computed(()=>Lt((Array.isArray(t),t),typeof n=="boolean"?n:n.value)),o=e.ref({});function r(c){const h=c?.conditions;if(!h)return!0;const y=Array.isArray(h)?h[0]:h,_=l?.value?.[y];return rn(_,h)}const s=(c=a.value,h=!0)=>(c.forEach(y=>{const _=[],b=Number(y?.minlength),B=Number(y?.maxlength);!Number.isNaN(b)&&Number.isFinite(b)&&_.push({type:"minlength",value:b}),!Number.isNaN(B)&&Number.isFinite(B)&&_.push({type:"maxlength",value:B});const g=[..._,...y.rules||[]];if(g.length){if(!r(y)){delete o.value[y.name];return}let k=!1,w=null;g.forEach(u=>{const x=hc(l.value[y.name],u);x&&(k=!0,!w&&typeof x=="string"&&(w=x))}),k&&w?o.value[y.name]=w:delete o.value[y.name]}y.schema&&s(y.schema,!1)}),h&&Object.values(o.value).some(Boolean)?o.value:null),i=e.computed(()=>a.value?.filter(c=>c.hidden!==!0&&r(c)));return{errors:o,validate:s,reset:()=>{l.value={},o.value={}},visibleSchema:i}}const yc={class:"flex w-full h-full min-h-0 gap-6"},kc={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},Ce=e.defineComponent({__name:"vs-compact-form",props:e.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:e.mergeModels(["handle-submit","update:modelValue","value-selected"],["update:form","update:values"]),setup(l,{expose:t,emit:n}){const a=n,o=l,r=e.useModel(l,"form"),s=e.useModel(l,"values"),{errors:i,validate:d,reset:c,visibleSchema:h}=gc(s,o.schema,e.toRef(o,"disabled")),y=e.ref(null),_=e.ref(null),b=e.computed(()=>o.navigation),B=e.computed(()=>o.navWidth),g=e.computed(()=>o.style?.columns),k=Object.freeze({container:12,label:3}),w=e.computed(()=>o.columns??g.value??k),u=e.computed(()=>o.columns!=null||g.value!=null),x=e.computed(()=>u.value?"horizontal":o.layout),f=P=>P?.columns?"horizontal":x.value,V=P=>P?.columns??w.value,M=()=>{a("update:modelValue",s.value),d(),a("handle-submit",s.value)},A=P=>{a("value-selected",P)};t({validate:d,reset:c,errors:i}),e.onMounted(()=>{o.modelValue&&(s.value=o.modelValue),r.value={value:s.value,errors:i.value,reset:c,validate:d,formId:o.formId}});function j(P,G){if(P===G)return!0;if(typeof P!="object"||typeof G!="object"||!P||!G)return!1;const D=Object.keys(P),te=Object.keys(G);return D.length!==te.length?!1:D.every(K=>P[K]===G[K])}return e.provide("form",r),e.provide("values",s),(P,G)=>(e.openBlock(),e.createElementBlock("div",yc,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:_},[e.createElementVNode("form",{ref_key:"formRef",ref:y,onSubmit:e.withModifiers(M,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",x.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(h),(D,te)=>(e.openBlock(),e.createElementBlock("div",{key:D.name,class:e.normalizeClass(f(D)==="horizontal"?"col-span-12":`col-span-${D.col||12}`)},[e.createVNode(Vn,{style:e.normalizeStyle(P.style),item:D,layout:f(D),columns:V(D),"model-value":s.value[D.name],"onUpdate:modelValue":K=>{const le=s.value[D.name];j(le,K)||(s.value[D.name]=K)},error:e.unref(i)[D.name],onValueSelected:A},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),f(D)==="settings"&&te+1!==e.unref(h).length?(e.openBlock(),e.createElementBlock("div",kc)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(rc,{target:y.value,"scroll-container":_.value,enabled:b.value,width:B.value},null,8,["target","scroll-container","enabled","width"])]))}}),bc={class:"relative"},wc={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},xc={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"},_c={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},Ec={class:"font-medium text-gray-800 dark:text-[#ffffff]"},Vc={class:"p-4 mim-h-0 h-full overflow-auto"},Cn=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(l,{emit:t}){const n=l,a=t,o=e.ref(n.schema),r=e.ref(n.defaultValue?JSON.parse(JSON.stringify(n.defaultValue)):{}),s=e.ref({}),i=e.ref(n.token||""),d=e.ref(n.mode);async function c(){const y=s.value.validate();if(y){se.notify({type:"warning",title:"Помилка валідації",message:Object.entries(y).map(([_,b])=>`${_}: ${b}`).join(`
3
- `)});return}if(i.value)try{const _=await fetch(`/api/table/${i.value}`,{method:d.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r.value)});if(_.ok)await _.json(),se.notify({type:"success",title:"Успішно",message:`Дані успішно ${d.value==="add"?"збережено":"оновлено"}`}),a("save",r.value);else if(_.status===400){const b=await _.json().catch(()=>({}));se.notify({type:"warning",title:"Помилка валідації",message:b.message||"Некоректні дані (400)"})}else _.status===500?se.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):se.notify({type:"error",title:"Помилка",message:`Статус: ${_.status}`})}catch(_){se.notify({type:"error",title:"Помилка з’єднання",message:_.message||"Не вдалося виконати запит"})}else a("edit",r.value),h()}function h(){a("close")}return e.onMounted(async()=>{try{if(n.form&&!n.schema){const y=await fetch(`/api/template/form/${n.form}`);if(!y.ok){se.notify({type:y.status>=400&&y.status<500?"warning":"error",title:"Error",message:`Error code: ${y.status}`});return}const _=await y.json();o.value=_.schema,i.value=_.token}else if(n.token&&!n.defaultValue){i.value=n.token;const y=await fetch(`/api/form/${i.value}`);if(!y.ok){se.notify({type:y.status>=400&&y.status<500?"warning":"error",title:"Error",message:`Error code: ${y.status}`});return}const _=await y.json();o.value=_.schema,_.data?r.value=_.data:d.value="add",_.obj&&(r.value={...r.value,..._.obj})}}catch(y){se.notify({type:"error",title:"Error",message:y.message||"Unexpected error"}),console.error(y)}}),(y,_)=>(e.openBlock(),e.createElementBlock("div",bc,[e.createElementVNode("div",wc,[e.createElementVNode("div",xc,[e.createElementVNode("div",_c,[e.createElementVNode("h3",Ec,e.toDisplayString(d.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:h,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"},_[2]||(_[2]=[e.createElementVNode("span",{class:"sr-only"},"Close",-1),e.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"},[e.createElementVNode("path",{d:"M18 6 6 18"}),e.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),e.createElementVNode("div",Vc,[o.value?(e.openBlock(),e.createBlock(Ce,{key:0,schema:o.value,values:r.value,"onUpdate:values":_[0]||(_[0]=b=>r.value=b),form:s.value,"onUpdate:form":_[1]||(_[1]=b=>s.value=b)},null,8,["schema","values","form"])):e.createCommentVNode("",!0)]),e.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"},[e.createElementVNode("button",{type:"button",onClick:h,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"}," Скасувати "),e.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"}," Зберегти ")])])])]))}}),vc=1440*60*1e3,Bc=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],Cc=["січ","лют","бер","квіт","трав","черв","лип","серп","вер","жовт","лист","груд"],Nc=["нд","пн","вт","ср","чт","пт","сб"];function ce(l){return l instanceof Date&&!Number.isNaN(l.getTime())}const Pe=l=>new Date(l.getTime());function Le(l){const t=Pe(l);return t.setHours(0,0,0,0),t}function Ke(l){const t=Pe(l);return t.setHours(23,59,59,999),t}function Tt(l){return Le(new Date(l.getFullYear(),l.getMonth(),1))}function It(l){return Ke(new Date(l.getFullYear(),l.getMonth()+1,0))}function Ot(l,t){const n=new Date(l),a=n.getDate();n.setDate(1),n.setMonth(n.getMonth()+t);const o=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();return n.setDate(Math.min(a,o)),n}function Mc(l,t){return Ot(l,-1)}function it(l,t){const n=new Date(l);return n.setFullYear(n.getFullYear()+t),n}function Nn(l,t){return it(l,-t)}function Mn(l){return Le(new Date(l.getFullYear(),0,1))}function Sn(l){return Ke(new Date(l.getFullYear(),11,31))}function Sc(l){const t=Math.floor(l.getFullYear()/10)*10;return Le(new Date(t,0,1))}function $c(l){const t=Math.floor(l.getFullYear()/10)*10+9;return Ke(new Date(t,11,31))}const we=l=>l.getFullYear(),dt=l=>Math.floor(l.getFullYear()/10)*10;function Dc(l){const t=[];let n=Le(l.start);const a=Le(l.end);for(;n<=a;)t.push(Pe(n)),n=new Date(n.getTime()+vc);return t}function Ac(l){const t=[];let n=Tt(l.start);const a=It(l.end);for(;n<=a;)t.push(Pe(n)),n=Ot(n,1);return t}function Fc(l){const t=[];let n=Mn(l.start);const a=Sn(l.end);for(;n<=a;)t.push(Pe(n)),n=it(n,1);return t}function Rt(l,t=1){const n=Le(l),a=(n.getDay()-t+7)%7;return n.setDate(n.getDate()-a),n}function Lc(l,t=1){const n=Rt(l,t);return n.setDate(n.getDate()+6),Ke(n)}function Tc(l,t,n=0){const a=Rt(l,n),o=(t-n+7)%7;return a.setDate(a.getDate()+o),a}const ct=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth()&&l.getDate()===t.getDate(),zt=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth(),$n=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear(),Dn=(l,t)=>!!l&&!!t&&ct(l,t)&&l.getHours()===t.getHours(),Ic=(l,t)=>!!l&&!!t&&Dn(l,t)&&l.getMinutes()===t.getMinutes();function Oc(l,t){const n=l.getTime();return n>=t.start.getTime()&&n<=t.end.getTime()}const Ye=(l,t)=>!!l&&!!t&&l.getTime()<t.getTime(),We=(l,t)=>!!l&&!!t&&l.getTime()>t.getTime();function Rc(l){const t=l.filter(n=>ce(n));if(t.length)return t.reduce((n,a)=>n.getTime()>=a.getTime()?n:a)}function zc(l){const t=l.filter(n=>ce(n));if(t.length)return t.reduce((n,a)=>n.getTime()<=a.getTime()?n:a)}function An(l,t){const n=Pe(l);return typeof t.year=="number"&&n.setFullYear(t.year),typeof t.month=="number"&&n.setMonth(t.month),typeof t.date=="number"&&n.setDate(t.date),typeof t.hours=="number"&&n.setHours(t.hours),typeof t.minutes=="number"&&n.setMinutes(t.minutes),typeof t.seconds=="number"&&n.setSeconds(t.seconds),typeof t.milliseconds=="number"&&n.setMilliseconds(t.milliseconds),n}const ut=(l,t=2)=>String(l).padStart(t,"0");function Fn(l,t){return t==="wide"?Bc[l]:Cc[l]}function jc(l){return Nc[l]}const Pc=[{token:"LLLL",format:l=>Fn(l.getMonth(),"wide")},{token:"LLL",format:l=>Fn(l.getMonth(),"abbreviated")},{token:"EE",format:l=>jc(l.getDay())},{token:"yyyy",format:l=>String(l.getFullYear())},{token:"MM",format:l=>ut(l.getMonth()+1)},{token:"dd",format:l=>ut(l.getDate())},{token:"HH",format:l=>ut(l.getHours())},{token:"mm",format:l=>ut(l.getMinutes())}];function pt(l,t){if(!ce(l))return"";let n="",a=0;for(;a<t.length;){const o=Pc.find(r=>t.startsWith(r.token,a));o?(n+=o.format(l),a+=o.token.length):(n+=t[a],a+=1)}return n}const Uc={"yyyy-MM-dd":/^(\d{4})-(\d{2})-(\d{2})$/,"dd.MM.yyyy":/^(\d{2})\.(\d{2})\.(\d{4})$/,"dd.MM.yyyy HH:mm":/^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2})$/,"HH:mm":/^(\d{2}):(\d{2})$/,"MM.yyyy":/^(\d{2})\.(\d{4})$/,yyyy:/^(\d{4})$/};function Ln(l,t){const n=Uc[t];if(!n){const o=new Date(l);return ce(o)?o:null}const a=l.match(n);if(!a)return null;switch(t){case"yyyy-MM-dd":{const[,o,r,s]=a,i=new Date(Number(o),Number(r)-1,Number(s));return ce(i)?i:null}case"dd.MM.yyyy":{const[,o,r,s]=a,i=new Date(Number(s),Number(r)-1,Number(o));return ce(i)?i:null}case"dd.MM.yyyy HH:mm":{const[,o,r,s,i,d]=a,c=new Date(Number(s),Number(r)-1,Number(o),Number(i),Number(d));return ce(c)?c:null}case"HH:mm":{const[,o,r]=a,s=new Date;return s.setHours(Number(o),Number(r),0,0),s}case"MM.yyyy":{const[,o,r]=a;return new Date(Number(r),Number(o)-1,1)}case"yyyy":{const[,o]=a;return new Date(Number(o),0,1)}default:return null}}const Hc=["year","month","day","time","custom"],qc=e.defineComponent({emits:{elementClick:l=>ce(l),left:()=>!0,right:()=>!0,heading:()=>!0},props:{headingClickable:{type:Boolean,default:!1},leftDisabled:{type:Boolean,default:!1},rightDisabled:{type:Boolean,default:!1},columnCount:{type:Number,default:7},items:{type:Array,default:()=>[]},viewMode:{type:String,required:!0,validate:l=>typeof l=="string"&&Hc.includes(l)}}}),Gc={class:"v3dp__heading"},Kc=["disabled"],Yc=["disabled"],Wc={class:"v3dp__body"},Zc={class:"v3dp__subheading"},Jc={class:"v3dp__elements"},Xc=["disabled","onClick"];function Qc(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["v3dp__popout",`v3dp__popout-${l.viewMode}`]),style:e.normalizeStyle({"--popout-column-definition":`repeat(${l.columnCount}, 1fr)`}),onMousedown:t[3]||(t[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Gc,[e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__left",disabled:l.leftDisabled,onClick:t[0]||(t[0]=e.withModifiers(s=>l.$emit("left"),["stop","prevent"]))},[e.renderSlot(l.$slots,"arrow-left",{},()=>[t[4]||(t[4]=e.createElementVNode("svg",{class:"v3dp__heading__icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 8"},[e.createElementVNode("g",{fill:"none","fill-rule":"evenodd"},[e.createElementVNode("path",{stroke:"none",d:"M-9 16V-8h24v24z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 0L1 4l4 4"})])],-1))],!0)],8,Kc),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.headingClickable?"button":"span"),{class:"v3dp__heading__center",onClick:t[1]||(t[1]=e.withModifiers(s=>l.$emit("heading"),["stop","prevent"]))},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"heading",{},void 0,!0)]),_:3})),e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__right",disabled:l.rightDisabled,onClick:t[2]||(t[2]=e.withModifiers(s=>l.$emit("right"),["stop","prevent"]))},[e.renderSlot(l.$slots,"arrow-right",{},()=>[t[5]||(t[5]=e.createElementVNode("svg",{class:"v3dp__heading__icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 8"},[e.createElementVNode("g",{fill:"none","fill-rule":"evenodd"},[e.createElementVNode("path",{stroke:"none",d:"M15-8v24H-9V-8z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M1 8l4-4-4-4"})])],-1))],!0)],8,Yc)]),e.createElementVNode("div",Wc,["subheading"in l.$slots?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Zc,[e.renderSlot(l.$slots,"subheading",{},void 0,!0)]),t[6]||(t[6]=e.createElementVNode("hr",{class:"v3dp__divider"},null,-1))],64)):e.createCommentVNode("",!0),e.createElementVNode("div",Jc,[e.renderSlot(l.$slots,"body",{},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.items,s=>(e.openBlock(),e.createElementBlock("button",{key:s.key,disabled:s.disabled,class:e.normalizeClass([{selected:s.selected,current:s.current},`v3dp__element__button__${l.viewMode}`]),onClick:e.withModifiers(i=>l.$emit("elementClick",s.value),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(s.display),1)],10,Xc))),128))],!0)])])],38)}const mt=Y(qc,[["render",Qc],["__scopeId","data-v-3b9aea7a"]]),eu=e.defineComponent({components:{PickerPopup:mt},emits:{"update:pageDate":l=>ce(l),select:l=>ce(l)},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(l,{emit:t}){const n=e.computed(()=>Sc(l.pageDate)),a=e.computed(()=>$c(l.pageDate)),o=(y,_,b)=>!_&&!b?!0:!(_&&we(y)<we(_)||b&&we(y)>we(b)),r=e.computed(()=>Fc({start:n.value,end:a.value}).map(y=>({value:y,key:String(we(y)),display:we(y),selected:!!l.selected&&we(y)===we(l.selected),disabled:!o(y,l.lowerLimit,l.upperLimit)}))),s=e.computed(()=>{const y=we(n.value),_=we(a.value);return`${y} - ${_}`}),i=e.computed(()=>l.lowerLimit&&(dt(l.lowerLimit)===dt(l.pageDate)||Ye(l.pageDate,l.lowerLimit))),d=e.computed(()=>l.upperLimit&&(dt(l.upperLimit)===dt(l.pageDate)||We(l.pageDate,l.upperLimit)));return{years:r,heading:s,leftDisabled:i,rightDisabled:d,previousPage:()=>t("update:pageDate",Nn(l.pageDate,10)),nextPage:()=>t("update:pageDate",it(l.pageDate,10))}}});function tu(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{columnCount:3,leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,items:l.years,viewMode:"year",onLeft:l.previousPage,onRight:l.nextPage,onElementClick:t[0]||(t[0]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const nu=Y(eu,[["render",tu]]),lu=e.defineComponent({components:{PickerPopup:mt},emits:{"update:pageDate":l=>ce(l),select:l=>ce(l),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"LLL"},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(l,{emit:t}){const n=e.computed(()=>Mn(l.pageDate)),a=e.computed(()=>Sn(l.pageDate)),o=e.computed(()=>_=>pt(_,l.format)),r=(_,b,B)=>!b&&!B?!0:!(b&&Ye(_,Tt(b))||B&&We(_,It(B))),s=e.computed(()=>Ac({start:n.value,end:a.value}).map(_=>({value:_,display:o.value(_),key:o.value(_),selected:!!l.selected&&zt(l.selected,_),disabled:!r(_,l.lowerLimit,l.upperLimit)}))),i=e.computed(()=>we(n.value)),d=e.computed(()=>l.lowerLimit&&($n(l.lowerLimit,l.pageDate)||Ye(l.pageDate,l.lowerLimit))),c=e.computed(()=>l.upperLimit&&($n(l.upperLimit,l.pageDate)||We(l.pageDate,l.upperLimit)));return{months:s,heading:i,leftDisabled:d,rightDisabled:c,previousPage:()=>t("update:pageDate",Nn(l.pageDate,1)),nextPage:()=>t("update:pageDate",it(l.pageDate,1))}}});function au(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:3,items:l.months,leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,viewMode:"month",onLeft:l.previousPage,onRight:l.nextPage,onHeading:t[0]||(t[0]=i=>l.$emit("back")),onElementClick:t[1]||(t[1]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),_:1},8,["items","leftDisabled","rightDisabled","onLeft","onRight"])}const ou=Y(lu,[["render",au]]),ru=e.defineComponent({components:{PickerPopup:mt},emits:{"update:pageDate":l=>ce(l),select:l=>ce(l),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"dd"},headingFormat:{type:String,required:!1,default:"LLLL yyyy"},weekdayFormat:{type:String,required:!1,default:"EE"},weekStartsOn:{type:Number,required:!1,default:1,validator:l=>typeof l=="number"&&Number.isInteger(l)&&l>=0&&l<=6},customWeekdays:{type:Array,required:!1},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1}},setup(l,{emit:t}){const n=e.computed(()=>k=>w=>pt(w,k)),a=e.computed(()=>Tt(l.pageDate)),o=e.computed(()=>It(l.pageDate)),r=e.computed(()=>({start:a.value,end:o.value})),s=e.computed(()=>({start:Rt(a.value,l.weekStartsOn),end:Lc(o.value,l.weekStartsOn)})),i=e.computed(()=>l.customWeekdays?.length===7?l.customWeekdays:null),d=e.computed(()=>{const k=l.weekStartsOn,w=i.value;if(w)return Array.from({length:7}).map((x,f)=>w[(k+f)%7]);const u=n.value(l.weekdayFormat);return Array.from(Array(7)).map((x,f)=>(k+f)%7).map(x=>Tc(new Date,x,l.weekStartsOn)).map(u)}),c=(k,w,u,x)=>x?.dates?.some(f=>ct(k,f))||x?.predicate?.(k)?!1:!w&&!u?!0:!(w&&Ye(k,Le(w))||u&&We(k,Ke(u))),h=e.computed(()=>{const k=new Date,w=n.value(l.format);return Dc(s.value).map(u=>({value:u,display:w(u),selected:!!l.selected&&ct(l.selected,u),current:ct(k,u),disabled:!l.allowOutsideInterval&&!Oc(u,r.value)||!c(u,l.lowerLimit,l.upperLimit,l.disabledDates),key:n.value("yyyy-MM-dd")(u)}))}),y=e.computed(()=>n.value(l.headingFormat)(l.pageDate)),_=e.computed(()=>l.lowerLimit&&(zt(l.lowerLimit,l.pageDate)||Ye(l.pageDate,l.lowerLimit))),b=e.computed(()=>l.upperLimit&&(zt(l.upperLimit,l.pageDate)||We(l.pageDate,l.upperLimit)));return{weekDays:d,days:h,heading:y,leftDisabled:_,rightDisabled:b,previousPage:()=>t("update:pageDate",Mc(l.pageDate)),nextPage:()=>t("update:pageDate",Ot(l.pageDate,1))}}});function su(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,items:l.days,viewMode:"day",onLeft:l.previousPage,onRight:l.nextPage,onHeading:t[0]||(t[0]=i=>l.$emit("back")),onElementClick:t[1]||(t[1]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),subheading:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.weekDays,(i,d)=>(e.openBlock(),e.createElementBlock("span",{key:i,class:e.normalizeClass(`v3dp__subheading__weekday__${d}`)},e.toDisplayString(i),3))),128))]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const iu=Y(ru,[["render",su]]);function Tn(l,t){const n=l.getBoundingClientRect(),a={height:l.clientHeight,width:l.clientWidth},o=t.getBoundingClientRect();if(!(o.top>=n.top&&o.bottom<=n.top+a.height)){const s=o.top-n.top,i=o.bottom-n.bottom;Math.abs(s)<Math.abs(i)?l.scrollTop+=s:l.scrollTop+=i}}const du=e.defineComponent({components:{PickerPopup:mt},emits:{select:l=>ce(l),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},visible:{type:Boolean,required:!0},disabledTime:{type:Object,required:!1}},setup(l,{emit:t}){const n=e.ref(null),a=e.ref(null),o=e.computed(()=>l.pageDate??l.selected),r=e.ref(o.value.getHours()),s=e.ref(o.value.getMinutes());e.watch(()=>l.selected,b=>{let B=0,g=0;b&&(B=b.getHours(),g=b.getMinutes()),r.value=B,s.value=g});const i=e.computed(()=>[...Array(24).keys()].map(b=>({value:b,date:An(new Date(o.value.getTime()),{hours:b,minutes:s.value,seconds:0}),selected:r.value===b,ref:e.ref(null)}))),d=e.computed(()=>[...Array(60).keys()].map(b=>({value:b,date:An(new Date(o.value.getTime()),{hours:r.value,minutes:b,seconds:0}),selected:s.value===b,ref:e.ref(null)}))),c=b=>{s.value=b.value,t("select",b.date)},h=()=>{const b=i.value.find(g=>g.ref.value?.classList?.contains("selected")??!1),B=d.value.find(g=>g.ref.value?.classList?.contains("selected")??!1);b&&B&&(Tn(n.value,b.ref.value),Tn(a.value,B.ref.value))};return e.watch(()=>l.visible,b=>{b&&e.nextTick(h)}),{hoursListRef:n,minutesListRef:a,hours:r,minutes:s,hoursList:i,minutesList:d,padStartZero:b=>`0${b}`.substr(-2),selectMinutes:c,isEnabled:b=>!(l.disabledTime?.dates?.some(B=>Dn(b,B)&&Ic(b,B))||l.disabledTime?.predicate?.(b)),scroll:h}}}),cu={ref:"hoursListRef",class:"v3dp__column"},uu=["disabled","onClick"],pu={ref:"minutesListRef",class:"v3dp__column"},mu=["disabled","onClick"];function hu(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:2,leftDisabled:!0,rightDisabled:!0,viewMode:"time",onHeading:t[0]||(t[0]=i=>l.$emit("back"))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.padStartZero(l.hours))+":"+e.toDisplayString(l.padStartZero(l.minutes)),1)]),body:e.withCtx(()=>[e.createElementVNode("div",cu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.hoursList,i=>(e.openBlock(),e.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:e.normalizeClass([{selected:i.selected},"v3dp__element_button__hour"]),disabled:!l.isEnabled(i.date),onClick:e.withModifiers(d=>l.hours=i.value,["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,uu))),128))],512),e.createElementVNode("div",pu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.minutesList,i=>(e.openBlock(),e.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:e.normalizeClass([{selected:i.selected},"v3dp__element_button__minute"]),disabled:!l.isEnabled(i.date),onClick:e.withModifiers(d=>l.selectMinutes(i),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,mu))),128))],512)]),_:1})}const fu=Y(du,[["render",hu],["__scopeId","data-v-c075af58"]]),ht=["time","day","month","year"],gu=(l,t,n=void 0)=>{let a=n||new Date;const o=Rc([l,a]);o&&(a=o);const r=zc([t,a]);return r&&(a=r),a},yu=e.defineComponent({components:{YearPicker:nu,MonthPicker:ou,DayPicker:iu,TimePicker:fu},inheritAttrs:!1,props:{placeholder:{type:String,default:""},modelValue:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1},disabledTime:{type:Object,required:!1},upperLimit:{type:Date,required:!1},lowerLimit:{type:Date,required:!1},startingView:{type:String,required:!1,default:"day",validate:l=>typeof l=="string"&&ht.includes(l)},startingViewDate:{type:Date,required:!1,default:()=>new Date},dayPickerHeadingFormat:{type:String,required:!1,default:"LLLL yyyy"},monthListFormat:{type:String,required:!1,default:"LLL"},weekdayFormat:{type:String,required:!1,default:"EE"},dayFormat:{type:String,required:!1,default:"dd"},inputFormat:{type:String,required:!1,default:"yyyy-MM-dd"},weekDayNames:{type:Array,required:!1},weekStartsOn:{type:Number,required:!1,default:1,validator:l=>[0,1,2,3,4,5,6].includes(l)},disabled:{type:Boolean,required:!1,default:!1},clearable:{type:Boolean,required:!1,default:!1},typeable:{type:Boolean,required:!1,default:!1},minimumView:{type:String,required:!1,default:"day",validate:l=>typeof l=="string"&&ht.includes(l)}},emits:{"update:modelValue":l=>l==null||ce(l),decadePageChanged:l=>!0,yearPageChanged:l=>!0,monthPageChanged:l=>!0,opened:()=>!0,closed:()=>!0},setup(l,{emit:t,attrs:n}){const a=e.ref("none"),o=e.ref(l.startingViewDate),r=e.ref(null),s=e.ref(!1),i=e.ref(""),d=R=>{const S=R.replace(/[a-zA-Z]/g,"0");return/0/.test(S)?S:""},c=e.computed(()=>d(l.inputFormat));let h=null,y=null;const _=()=>{h?.destroy(),h=null},b=async()=>{if(!y){const{default:R}=await Promise.resolve().then(()=>qt);y=R}return y},B=()=>{h&&h.value!==i.value&&(h.value=i.value??"")},g=async()=>{if(_(),!r.value||!c.value)return;h=(await b())(r.value,{mask:c.value,lazy:!0,overwrite:!0}),B()};e.watchEffect(()=>{if(!i.value)return;const R=Ln(i.value,l.inputFormat);R&&(o.value=R)}),e.watchEffect(()=>{i.value=l.modelValue&&ce(l.modelValue)?pt(l.modelValue,l.inputFormat):""}),e.onMounted(()=>{c.value&&e.nextTick(()=>{g()})}),e.onBeforeUnmount(()=>{_()}),e.watch(c,R=>{R?e.nextTick(()=>{g()}):_()}),e.watch(i,()=>{B()});const k=(R="none")=>{l.disabled||(R!=="none"&&a.value==="none"&&(o.value=l.modelValue||gu(l.lowerLimit,l.upperLimit,o.value)),a.value=R,t(R!=="none"?"opened":"closed"))};e.watchEffect(()=>{l.disabled&&(a.value="none")});const w=(R,S)=>{o.value=S,R==="year"?t("decadePageChanged",S):R==="month"?t("yearPageChanged",S):R==="day"&&t("monthPageChanged",S)},u=R=>{o.value=R,l.minimumView==="year"?(k("none"),t("update:modelValue",R)):a.value="month"},x=R=>{o.value=R,l.minimumView==="month"?(k("none"),t("update:modelValue",R)):a.value="day"},f=R=>{o.value=R,l.minimumView==="day"?(k("none"),t("update:modelValue",R)):a.value="time"},V=R=>{k("none"),t("update:modelValue",R)},M=()=>{l.clearable&&(k("none"),t("update:modelValue",null),o.value=l.startingViewDate)},A=()=>s.value=!0,j=()=>k(D.value),P=()=>{s.value=!1,k()},G=R=>{const S=R.keyCode?R.keyCode:R.which;if([27,13].includes(S)&&r.value.blur(),l.typeable){const z=Ln(r.value.value,l.inputFormat);z&&i.value===pt(z,l.inputFormat)&&(i.value=r.value.value,t("update:modelValue",z))}},D=e.computed(()=>{const R=ht.indexOf(l.startingView),S=ht.indexOf(l.minimumView);return R<S?l.minimumView:l.startingView}),te=R=>Object.fromEntries(Object.entries(R??{}).filter(([S,H])=>S.startsWith("--"))),K=e.computed(()=>l.weekDayNames?.length===7?l.weekDayNames:void 0);return{blur:P,focus:j,click:A,input:i,inputRef:r,pageDate:o,renderView:k,updatePageDate:w,selectYear:u,selectMonth:x,selectDay:f,selectTime:V,keyUp:G,normalizedWeekdayNames:K,viewShown:a,goBackFromTimepicker:()=>l.startingView==="time"&&l.minimumView==="time"?null:a.value="day",clearModelValue:M,initialView:D,log:R=>console.log(R),variables:te}}}),ku={class:"v3dp__input_wrapper"},bu=["readonly","placeholder","disabled","tabindex"],wu={class:"v3dp__clearable"};function xu(l,t,n,a,o,r){const s=e.resolveComponent("year-picker"),i=e.resolveComponent("month-picker"),d=e.resolveComponent("day-picker"),c=e.resolveComponent("time-picker");return e.openBlock(),e.createElementBlock("div",{class:"v3dp__datepicker",style:e.normalizeStyle(l.variables(l.$attrs.style))},[e.createElementVNode("div",ku,[e.withDirectives(e.createElementVNode("input",e.mergeProps({type:"text",ref:"inputRef",readonly:!l.typeable,"onUpdate:modelValue":t[0]||(t[0]=h=>l.input=h)},l.$attrs,{placeholder:l.placeholder,disabled:l.disabled,tabindex:l.disabled?-1:0,onKeyup:t[1]||(t[1]=(...h)=>l.keyUp&&l.keyUp(...h)),onBlur:t[2]||(t[2]=(...h)=>l.blur&&l.blur(...h)),onFocus:t[3]||(t[3]=(...h)=>l.focus&&l.focus(...h)),onClick:t[4]||(t[4]=(...h)=>l.click&&l.click(...h))}),null,16,bu),[[e.vModelText,l.input]]),e.withDirectives(e.createElementVNode("div",wu,[e.renderSlot(l.$slots,"clear",{onClear:l.clearModelValue},()=>[e.createElementVNode("i",{onClick:t[5]||(t[5]=h=>l.clearModelValue())},"x")])],512),[[e.vShow,l.clearable&&l.modelValue]])]),e.withDirectives(e.createVNode(s,{pageDate:l.pageDate,"onUpdate:pageDate":t[6]||(t[6]=h=>l.updatePageDate("year",h)),selected:l.modelValue,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,onSelect:l.selectYear},null,8,["pageDate","selected","lowerLimit","upperLimit","onSelect"]),[[e.vShow,l.viewShown==="year"]]),e.withDirectives(e.createVNode(i,{pageDate:l.pageDate,"onUpdate:pageDate":t[7]||(t[7]=h=>l.updatePageDate("month",h)),selected:l.modelValue,onSelect:l.selectMonth,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,format:l.monthListFormat,onBack:t[8]||(t[8]=h=>l.viewShown="year")},null,8,["pageDate","selected","onSelect","lowerLimit","upperLimit","format"]),[[e.vShow,l.viewShown==="month"]]),e.withDirectives(e.createVNode(d,{pageDate:l.pageDate,"onUpdate:pageDate":t[9]||(t[9]=h=>l.updatePageDate("day",h)),selected:l.modelValue,weekStartsOn:l.weekStartsOn,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,headingFormat:l.dayPickerHeadingFormat,disabledDates:l.disabledDates,weekdayFormat:l.weekdayFormat,"allow-outside-interval":l.allowOutsideInterval,format:l.dayFormat,"custom-weekdays":l.normalizedWeekdayNames,onSelect:l.selectDay,onBack:t[10]||(t[10]=h=>l.viewShown="month")},null,8,["pageDate","selected","weekStartsOn","lowerLimit","upperLimit","headingFormat","disabledDates","weekdayFormat","allow-outside-interval","format","custom-weekdays","onSelect"]),[[e.vShow,l.viewShown==="day"]]),e.withDirectives(e.createVNode(c,{pageDate:l.pageDate,visible:l.viewShown==="time",selected:l.modelValue,disabledTime:l.disabledTime,onSelect:l.selectTime,onBack:l.goBackFromTimepicker},null,8,["pageDate","visible","selected","disabledTime","onSelect","onBack"]),[[e.vShow,l.viewShown==="time"]])],4)}const _u=Y(yu,[["render",xu]]),Eu=Y(e.defineComponent({__name:"vs-input-date2",props:{clearable:{type:Boolean,default:!0},now:{type:Boolean},editable:{type:Boolean,default:!0},time:{type:Boolean},isInfinity:{type:Boolean},mode:{default:"date"},weekStart:{},dayNames:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,{inputClass:o}=he(n.style),r=e.computed(()=>n.mode?n.mode:n.time?"datetime":"date"),s={date:"дд.мм.рррр",datetime:"дд.мм.рррр гг:хх",month:"мм.рррр",week:"рррр-тиждень",time:"гг:хх",year:"рррр"},i=e.computed(()=>n.placeholder||s[r.value]||""),d=e.computed(()=>["py-1.5 px-3 block w-full placeholder:text-[#767f8f] bg-white",o.value,n.customClass,{"!border-red-600":n.error}]),c=e.computed(()=>!n.modelValue&&n.now?new Date:null),h=e.computed({get:()=>x(n.modelValue??c.value,r.value)||void 0,set:S=>a("update:modelValue",f(S,r.value))}),y=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],_=e.computed(()=>{if(n.dayNames?.length)return n.dayNames.length===7?n.dayNames:y}),b=e.computed(()=>{const S=n.weekStart,H=typeof S=="string"?Number(S):S;return H===void 0||Number.isNaN(H)?1:Math.min(6,Math.max(0,H))}),B=e.computed(()=>{switch(r.value){case"time":return{startingView:"time",minimumView:"time"};case"month":return{startingView:"month",minimumView:"month"};case"year":return{startingView:"year",minimumView:"year"};case"datetime":return{startingView:"day",minimumView:"time"};default:return{startingView:"day",minimumView:"day"}}}),g={date:"dd.MM.yyyy",datetime:"dd.MM.yyyy HH:mm",month:"MM.yyyy",time:"HH:mm",week:"dd.MM.yyyy",year:"yyyy"},k=e.computed(()=>g[r.value]||"dd.MM.yyyy"),w=e.computed(()=>({"--vdp-selected-bg-color":n.style?.primaryColor||"#2563eb","--vdp-hover-bg-color":n.style?.primaryColor||"#2563eb","--vdp-selected-color":"#ffffff","--vdp-hover-color":"#ffffff","--vdp-border-radius":n.style?.size==="sm"?"6px":"8px","--vdp-elem-font-size":n.style?.size==="sm"?"0.75em":"0.85em"})),u=e.ref(!1);e.watch(()=>n.modelValue,S=>{S?u.value=!0:n.now||(u.value=!1)},{immediate:!0}),e.watchEffect(()=>{n.now&&!n.modelValue&&!u.value&&(a("update:modelValue",f(new Date,r.value)),u.value=!0)});function x(S,H){if(!S)return null;if(S instanceof Date&&!Number.isNaN(S.getTime()))return S;if(typeof S!="string")return null;switch(H){case"datetime":return j(S);case"time":return D(S);case"month":return P(S);case"year":return G(S);case"week":return te(S);case"date":default:return A(S)}}function f(S,H){if(!S)return null;const z=S instanceof Date?S:x(S,H);if(!z)return null;switch(H){case"datetime":return`${V(z)}T${M(z)}`;case"time":return M(z);case"month":return`${z.getFullYear()}-${R(z.getMonth()+1)}`;case"year":return`${z.getFullYear()}`;case"week":{const{year:ae,week:re}=K(z);return`${ae}-W${R(re)}`}case"date":default:return V(z)}}function V(S){return`${S.getFullYear()}-${R(S.getMonth()+1)}-${R(S.getDate())}`}function M(S){return`${R(S.getHours())}:${R(S.getMinutes())}`}function A(S){const H=S.split("-");if(H.length<3)return null;const[z,ae,re]=H.map(Number);return!z||!ae||!re?null:new Date(z,ae-1,re)}function j(S){const H=S.includes("T")?S:S.replace(" ","T"),z=new Date(H);return Number.isNaN(z.getTime())?null:z}function P(S){const[H,z]=S.split("-").map(Number);return!H||Number.isNaN(z)?null:new Date(H,(z||1)-1,1)}function G(S){const H=Number(S);return H?new Date(H,0,1):null}function D(S){const H=S.match(/^(\d{1,2}):(\d{2})$/);if(!H)return null;const[,z,ae]=H,re=new Date;return re.setHours(Number(z),Number(ae),0,0),re}function te(S){const H=S.match(/^(\d{4})-W(\d{2})$/);if(!H)return null;const[,z,ae]=H,re=Number(ae);return le(Number(z),re)}function K(S){const H=new Date(Date.UTC(S.getFullYear(),S.getMonth(),S.getDate())),z=H.getUTCDay()||7;H.setUTCDate(H.getUTCDate()+4-z);const ae=new Date(Date.UTC(H.getUTCFullYear(),0,1)),re=Math.ceil(((H.getTime()-ae.getTime())/864e5+1)/7);return{year:H.getUTCFullYear(),week:re}}function le(S,H){if(!S||!H)return null;const z=new Date(S,0,1+(H-1)*7),ae=z.getDay(),re=z;return ae<=4?re.setDate(z.getDate()-z.getDay()+1):re.setDate(z.getDate()+8-z.getDay()),re}function R(S){return String(S).padStart(2,"0")}return(S,H)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vs-date-picker",n.customClass]),style:e.normalizeStyle(w.value)},[e.createVNode(_u,{modelValue:h.value,"onUpdate:modelValue":H[0]||(H[0]=z=>h.value=z),placeholder:i.value,disabled:n.disabled,clearable:n.clearable,typeable:n.editable,"week-day-names":_.value,"week-starts-on":b.value,"starting-view":B.value.startingView,"minimum-view":B.value.minimumView,"input-format":k.value,name:n.name,class:e.normalizeClass(d.value)},null,8,["modelValue","placeholder","disabled","clearable","typeable","week-day-names","week-starts-on","starting-view","minimum-view","input-format","name","class"])],6))}}),[["__scopeId","data-v-a65a2ac3"]]),In=(l={mode:"edit",schema:null})=>new Promise(t=>{const{close:n}=se.modal({title:l.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Cn,contentProps:{...l,onClose:()=>{t(null),n()},onSave:a=>{t(a),n()}}})});Ce.install=function(t){t.component("VForm",Ce),Object.assign(t.config.globalProperties,{$form:In}),t.provide("form",In),window.v3plugin||(window.v3plugin={})};function De(l){return typeof l=="string"||l instanceof String}function On(l){var t;return typeof l=="object"&&l!=null&&(l==null||(t=l.constructor)==null?void 0:t.name)==="Object"}function Rn(l,t){return Array.isArray(t)?Rn(l,(n,a)=>t.includes(a)):Object.entries(l).reduce((n,a)=>{let[o,r]=a;return t(r,o)&&(n[o]=r),n},{})}const q={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function zn(l){switch(l){case q.LEFT:return q.FORCE_LEFT;case q.RIGHT:return q.FORCE_RIGHT;default:return l}}function jt(l){return l.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function ft(l,t){if(t===l)return!0;const n=Array.isArray(t),a=Array.isArray(l);let o;if(n&&a){if(t.length!=l.length)return!1;for(o=0;o<t.length;o++)if(!ft(t[o],l[o]))return!1;return!0}if(n!=a)return!1;if(t&&l&&typeof t=="object"&&typeof l=="object"){const r=t instanceof Date,s=l instanceof Date;if(r&&s)return t.getTime()==l.getTime();if(r!=s)return!1;const i=t instanceof RegExp,d=l instanceof RegExp;if(i&&d)return t.toString()==l.toString();if(i!=d)return!1;const c=Object.keys(t);for(o=0;o<c.length;o++)if(!Object.prototype.hasOwnProperty.call(l,c[o]))return!1;for(o=0;o<c.length;o++)if(!ft(l[c[o]],t[c[o]]))return!1;return!0}else if(t&&l&&typeof t=="function"&&typeof l=="function")return t.toString()===l.toString();return!1}class Vu{constructor(t){for(Object.assign(this,t);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?q.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?q.RIGHT:q.LEFT}}function J(l,t){return new J.InputMask(l,t)}function jn(l){if(l==null)throw new Error("mask property should be defined");return l instanceof RegExp?J.MaskedRegExp:De(l)?J.MaskedPattern:l===Date?J.MaskedDate:l===Number?J.MaskedNumber:Array.isArray(l)||l===Array?J.MaskedDynamic:J.Masked&&l.prototype instanceof J.Masked?l:J.Masked&&l instanceof J.Masked?l.constructor:l instanceof Function?J.MaskedFunction:(console.warn("Mask not found for mask",l),J.Masked)}function Ue(l){if(!l)throw new Error("Options in not defined");if(J.Masked){if(l.prototype instanceof J.Masked)return{mask:l};const{mask:t=void 0,...n}=l instanceof J.Masked?{mask:l}:On(l)&&l.mask instanceof J.Masked?l:{};if(t){const a=t.mask;return{...Rn(t,(o,r)=>!r.startsWith("_")),mask:t.constructor,_mask:a,...n}}}return On(l)?{...l}:{mask:l}}function _e(l){if(J.Masked&&l instanceof J.Masked)return l;const t=Ue(l),n=jn(t.mask);if(!n)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===n&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new n(t)}J.createMask=_e;class gt{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return t??this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return t??this.value.length}select(t,n){if(!(t==null||n==null||t===this.selectionStart&&n===this.selectionEnd))try{this._unsafeSelect(t,n)}catch{}}get isActive(){return!1}}J.MaskElement=gt;const Pn=90,vu=89;class Ze extends gt{constructor(t){super(),this.input=t,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 t,n,a;return(t=(n=(a=this.input).getRootNode)==null?void 0:n.call(a))!=null?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){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",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){if(this._handlers.redo&&(t.keyCode===Pn&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===vu&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===Pn&&(t.metaKey||t.ctrlKey))return t.preventDefault(),this._handlers.undo(t);t.isComposing||this._handlers.selectionChange(t)}_onBeforeinput(t){if(t.inputType==="historyUndo"&&this._handlers.undo)return t.preventDefault(),this._handlers.undo(t);if(t.inputType==="historyRedo"&&this._handlers.redo)return t.preventDefault(),this._handlers.redo(t)}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}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={}}}J.HTMLMaskElement=Ze;class Un extends Ze{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,n){this.input.setSelectionRange(t,n)}get value(){return this.input.value}set value(t){this.input.value=t}}J.HTMLMaskElement=Ze;class Pt extends Ze{get _unsafeSelectionStart(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),a=n&&n.anchorOffset,o=n&&n.focusOffset;return o==null||a==null||a<o?a:o}get _unsafeSelectionEnd(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),a=n&&n.anchorOffset,o=n&&n.focusOffset;return o==null||a==null||a>o?a:o}_unsafeSelect(t,n){if(!this.rootElement.createRange)return;const a=this.rootElement.createRange();a.setStart(this.input.firstChild||this.input,t),a.setEnd(this.input.lastChild||this.input,n);const o=this.rootElement,r=o.getSelection&&o.getSelection();r&&(r.removeAllRanges(),r.addRange(a))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}J.HTMLContenteditableMaskElement=Pt;class yt{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>yt.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,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}}yt.MAX_LENGTH=100;class Hn{constructor(t,n){this.el=t instanceof gt?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new Pt(t):new Un(t),this.masked=_e(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new yt,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(t){var n;return t==null||((n=this.masked)==null?void 0:n.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof J.Masked)&&this.masked.constructor===jn(t)){this.masked.updateOptions({mask:t});return}const n=t instanceof J.Masked?t:_e({mask:t});n.unmaskedValue=this.masked.unmaskedValue,this.masked=n}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,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(t,n){const a=this._listeners[t];a&&a.forEach(o=>o(n))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){!this.el||!this.el.isActive||(this.el.select(t,t),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(t){const n=this.masked.unmaskedValue,a=this.masked.value,o=this.masked.rawInputValue,r=this.displayValue,s=this.unmaskedValue!==n||this.value!==a||this._rawInputValue!==o;this._unmaskedValue=n,this._value=a,this._rawInputValue=o,this.el.value!==r&&(this.el.value=r),t==="auto"?this.alignCursor():t!=null&&(this.cursorPos=t),s&&this._fireChangeEvents(),!this._historyChanging&&(s||this.history.isEmpty)&&this.history.push({unmaskedValue:n,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:n,...a}=t,o=!this.maskEquals(n),r=this.masked.optionsIsChanged(a);o&&(this.mask=n),r&&this.masked.updateOptions(a),(o||r)&&this.updateControl()}updateCursor(t){t!=null&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,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,q.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,n){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(n),this}off(t,n){if(!this._listeners[t])return this;if(!n)return delete this._listeners[t],this;const a=this._listeners[t].indexOf(n);return a>=0&&this._listeners[t].splice(a,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const n=new Vu({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),a=this.masked.rawInputValue,o=this.masked.splice(n.startChangePos,n.removed.length,n.inserted,n.removeDirection,{input:!0,raw:!0}).offset,r=a===this.masked.rawInputValue?n.removeDirection:q.NONE;let s=this.masked.nearestInputPos(n.startChangePos+o,r);r!==q.NONE&&(s=this.masked.nearestInputPos(s,q.NONE)),this.updateControl(s),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}J.InputMask=Hn;class Q{static normalize(t){return Array.isArray(t)?t:[t,new Q]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}J.ChangeDetails=Q;class Ee{constructor(t,n,a){t===void 0&&(t=""),n===void 0&&(n=0),this.value=t,this.from=n,this.stop=a}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||t!=null&&this.from>=t)return"";const n=this.value[0];return this.value=this.value.slice(1),n}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class ue{constructor(t){this._value="",this._update({...ue.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,n){n===void 0&&(n={input:!0}),this.reset(),this.append(t,n,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,n){return t}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),Math.min(this.displayValue.length,n-t)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this.displayValue.slice(t,n)}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new Ee(this.extractInput(t,n),t)}appendTail(t){return De(t)&&(t=new Ee(String(t))),t.appendTo(this)}_appendCharRaw(t,n){return t?(this._value+=t,new Q({inserted:t,rawInserted:t})):new Q}_appendChar(t,n,a){n===void 0&&(n={});const o=this.state;let r;if([t,r]=this.doPrepareChar(t,n),t&&(r=r.aggregate(this._appendCharRaw(t,n)),!r.rawInserted&&this.autofix==="pad")){const s=this.state;this.state=o;let i=this.pad(n);const d=this._appendCharRaw(t,n);i=i.aggregate(d),d.rawInserted||i.equals(r)?r=i:this.state=s}if(r.inserted){let s,i=this.doValidate(n)!==!1;if(i&&a!=null){const d=this.state;if(this.overwrite===!0){s=a.state;for(let h=0;h<r.rawInserted.length;++h)a.unshift(this.displayValue.length-r.tailShift)}let c=this.appendTail(a);if(i=c.rawInserted.length===a.toString().length,!(i&&c.inserted)&&this.overwrite==="shift"){this.state=d,s=a.state;for(let h=0;h<r.rawInserted.length;++h)a.shift();c=this.appendTail(a),i=c.rawInserted.length===a.toString().length}i&&c.inserted&&(this.state=d)}i||(r=new Q,this.state=o,a&&s&&(a.state=s))}return r}_appendPlaceholder(){return new Q}_appendEager(){return new Q}append(t,n,a){if(!De(t))throw new Error("value should be string");const o=De(a)?new Ee(String(a)):a;n!=null&&n.tail&&(n._beforeTailState=this.state);let r;[t,r]=this.doPrepare(t,n);for(let s=0;s<t.length;++s){const i=this._appendChar(t[s],n,o);if(!i.rawInserted&&!this.doSkipInvalid(t[s],n,o))break;r.aggregate(i)}return(this.eager===!0||this.eager==="append")&&n!=null&&n.input&&t&&r.aggregate(this._appendEager()),o!=null&&(r.tailShift+=this.appendTail(o).tailShift),r}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(n),new Q}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const n=this.rawInputValue,a=this.value,o=t();return this.rawInputValue=n,this.value&&this.value!==a&&a.indexOf(this.value)===0&&(this.append(a.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,o}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const n=this.state,a=t(this);return this.state=n,delete this._isolated,a}doSkipInvalid(t,n,a){return!!this.skipInvalid}doPrepare(t,n){return n===void 0&&(n={}),Q.normalize(this.prepare?this.prepare(t,this,n):t)}doPrepareChar(t,n){return n===void 0&&(n={}),Q.normalize(this.prepareChar?this.prepareChar(t,this,n):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,n,a,o,r){a===void 0&&(a=""),o===void 0&&(o=q.NONE),r===void 0&&(r={input:!0});const s=t+n,i=this.extractTail(s),d=this.eager===!0||this.eager==="remove";let c;d&&(o=zn(o),c=this.extractInput(0,s,{raw:!0}));let h=t;const y=new Q;if(o!==q.NONE&&(h=this.nearestInputPos(t,n>1&&t!==0&&!d?q.NONE:o),y.tailShift=h-t),y.aggregate(this.remove(h)),d&&o!==q.NONE&&c===this.rawInputValue)if(o===q.FORCE_LEFT){let _;for(;c===this.rawInputValue&&(_=this.displayValue.length);)y.aggregate(new Q({tailShift:-1})).aggregate(this.remove(_-1))}else o===q.FORCE_RIGHT&&i.unshift();return y.aggregate(this.append(a,r,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!ft(this,t)}typedValueEquals(t){const n=this.typedValue;return t===n||ue.EMPTY_VALUES.includes(t)&&ue.EMPTY_VALUES.includes(n)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new Q}}ue.DEFAULTS={skipInvalid:!0},ue.EMPTY_VALUES=[void 0,null,""],J.Masked=ue;class Ae{constructor(t,n){t===void 0&&(t=[]),n===void 0&&(n=0),this.chunks=t,this.from=n}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=De(t)?new Ee(String(t)):t;const n=this.chunks[this.chunks.length-1],a=n&&(n.stop===t.stop||t.stop==null)&&t.from===n.from+n.toString().length;if(t instanceof Ee)a?n.extend(t.toString()):this.chunks.push(t);else if(t instanceof Ae){if(t.stop==null){let o;for(;t.chunks.length&&t.chunks[0].stop==null;)o=t.chunks.shift(),o.from+=t.from,this.extend(o)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof J.MaskedPattern))return new Ee(this.toString()).appendTo(t);const n=new Q;for(let a=0;a<this.chunks.length;++a){const o=this.chunks[a],r=t._mapPosToBlock(t.displayValue.length),s=o.stop;let i;if(s!=null&&(!r||r.index<=s)&&((o instanceof Ae||t._stops.indexOf(s)>=0)&&n.aggregate(t._appendPlaceholder(s)),i=o instanceof Ae&&t._blocks[s]),i){const d=i.appendTail(o);n.aggregate(d);const c=o.toString().slice(d.rawInserted.length);c&&n.aggregate(t.append(c,{tail:!0}))}else n.aggregate(t.append(o.toString(),{tail:!0}))}return n}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:n,...a}=t;Object.assign(this,a),this.chunks=n.map(o=>{const r="chunks"in o?new Ae:new Ee;return r.state=o,r})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const n=t!=null?t-this.from:t;let a=0;for(;a<this.chunks.length;){const o=this.chunks[a],r=o.unshift(n);if(o.toString()){if(!r)break;++a}else this.chunks.splice(a,1);if(r)return r}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const n=this.chunks[t],a=n.shift();if(n.toString()){if(!a)break;--t}else this.chunks.splice(t,1);if(a)return a}return""}}class Bu{constructor(t,n){this.masked=t,this._log=[];const{offset:a,index:o}=t._mapPosToBlock(n)||(n<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=a,this.index=o,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(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}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(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((n=this.block)==null?void 0:n.displayValue.length)||0){var n;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())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,q.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,q.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,q.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,q.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,q.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,q.NONE),!0})}}class Ut{constructor(t){Object.assign(this,t),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(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(n),this._value||(this._isRawInput=!1),new Q}nearestInputPos(t,n){n===void 0&&(n=q.NONE);const a=0,o=this._value.length;switch(n){case q.LEFT:case q.FORCE_LEFT:return a;case q.NONE:case q.RIGHT:case q.FORCE_RIGHT:default:return o}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._isRawInput?n-t:0}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),a===void 0&&(a={}),a.raw&&this._isRawInput&&this._value.slice(t,n)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new Q;const a=this.eager===!0||this.eager==="append",r=this.char===t&&(this.isUnmasking||n.input||n.raw)&&(!n.raw||!a)&&!n.tail,s=new Q({inserted:this.char,rawInserted:r?this.char:""});return this._value=this.char,this._isRawInput=r&&(n.raw||n.input),s}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new Q;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new Ee("")}appendTail(t){return De(t)&&(t=new Ee(String(t))),t.appendTo(this)}append(t,n,a){const o=this._appendChar(t[0],n);return a!=null&&(o.tailShift+=this.appendTail(a).tailShift),o}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=!!t._rawInputValue}pad(t){return this._appendPlaceholder()}}class Je{constructor(t){const{parent:n,isOptional:a,placeholderChar:o,displayChar:r,lazy:s,eager:i,...d}=t;this.masked=_e(d),Object.assign(this,{parent:n,isOptional:a,placeholderChar:o,displayChar:r,lazy:s,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),t===0&&n>=1?(this.isFilled=!1,this.masked.remove(t,n)):new Q}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(t,n){if(n===void 0&&(n={}),this.isFilled)return new Q;const a=this.masked.state;let o=this.masked._appendChar(t,this.currentMaskFlags(n));return o.inserted&&this.doValidate(n)===!1&&(o=new Q,this.masked.state=a),!o.inserted&&!this.isOptional&&!this.lazy&&!n.input&&(o.inserted=this.placeholderChar),o.skip=!o.inserted&&!this.isOptional,this.isFilled=!!o.inserted,o}append(t,n,a){return this.masked.append(t,this.currentMaskFlags(n),a)}_appendPlaceholder(){return this.isFilled||this.isOptional?new Q:(this.isFilled=!0,new Q({inserted:this.placeholderChar}))}_appendEager(){return new Q}extractTail(t,n){return this.masked.extractTail(t,n)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.masked.extractInput(t,n,a)}nearestInputPos(t,n){n===void 0&&(n=q.NONE);const a=0,o=this.value.length,r=Math.min(Math.max(t,a),o);switch(n){case q.LEFT:case q.FORCE_LEFT:return this.isComplete?r:a;case q.RIGHT:case q.FORCE_RIGHT:return this.isComplete?r:o;case q.NONE:default:return r}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.value.slice(t,n).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var n;return{...t,_beforeTailState:(t==null||(n=t._beforeTailState)==null?void 0:n.masked)||t?._beforeTailState}}pad(t){return new Q}}Je.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 qn extends ue{updateOptions(t){super.updateOptions(t)}_update(t){const n=t.mask;n&&(t.validate=a=>a.search(n)>=0),super._update(t)}}J.MaskedRegExp=qn;class pe extends ue{constructor(t){super({...pe.DEFAULTS,...t,definitions:Object.assign({},Je.DEFAULT_DEFINITIONS,t?.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const n=this.mask;if(!n||!t)return;let a=!1,o=!1;for(let r=0;r<n.length;++r){if(this.blocks){const c=n.slice(r),h=Object.keys(this.blocks).filter(_=>c.indexOf(_)===0);h.sort((_,b)=>b.length-_.length);const y=h[0];if(y){const{expose:_,repeat:b,...B}=Ue(this.blocks[y]),g={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...B,repeat:b,parent:this},k=b!=null?new J.RepeatBlock(g):_e(g);k&&(this._blocks.push(k),_&&(this.exposeBlock=k),this._maskedBlocks[y]||(this._maskedBlocks[y]=[]),this._maskedBlocks[y].push(this._blocks.length-1)),r+=y.length-1;continue}}let s=n[r],i=s in t;if(s===pe.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){a=!a;continue}if(s==="["||s==="]"){o=!o;continue}if(s===pe.ESCAPE_CHAR){if(++r,s=n[r],!s)break;i=!1}const d=i?new Je({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...Ue(t[s]),parent:this}):new Ut({char:s,eager:this.eager,isUnmasking:a});this._blocks.push(d)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:n,...a}=t;this._blocks.forEach((o,r)=>o.state=n[r]),super.state=a}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,n)=>t+=n.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(n),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,n)=>t+=n.value,"")}set value(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(n),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(n),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,n)=>t+=n.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const n=new Q;let a=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(a==null)return n;this._blocks[a].isFilled&&++a;for(let o=a;o<this._blocks.length;++o){const r=this._blocks[o]._appendEager();if(!r.inserted)break;n.aggregate(r)}return n}_appendCharRaw(t,n){n===void 0&&(n={});const a=this._mapPosToBlock(this.displayValue.length),o=new Q;if(!a)return o;for(let s=a.index,i;i=this._blocks[s];++s){var r;const d=i._appendChar(t,{...n,_beforeTailState:(r=n._beforeTailState)==null||(r=r._blocks)==null?void 0:r[s]});if(o.aggregate(d),d.consumed)break}return o}extractTail(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=new Ae;return t===n||this._forEachBlocksInRange(t,n,(o,r,s,i)=>{const d=o.extractTail(s,i);d.stop=this._findStopBefore(r),d.from=this._blockStartPos(r),d instanceof Ae&&(d.blockIndex=r),a.extend(d)}),a}extractInput(t,n,a){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),a===void 0&&(a={}),t===n)return"";let o="";return this._forEachBlocksInRange(t,n,(r,s,i,d)=>{o+=r.extractInput(i,d,a)}),o}_findStopBefore(t){let n;for(let a=0;a<this._stops.length;++a){const o=this._stops[a];if(o<=t)n=o;else break}return n}_appendPlaceholder(t){const n=new Q;if(this.lazy&&t==null)return n;const a=this._mapPosToBlock(this.displayValue.length);if(!a)return n;const o=a.index,r=t??this._blocks.length;return this._blocks.slice(o,r).forEach(s=>{if(!s.lazy||t!=null){var i;n.aggregate(s._appendPlaceholder((i=s._blocks)==null?void 0:i.length))}}),n}_mapPosToBlock(t){let n="";for(let a=0;a<this._blocks.length;++a){const o=this._blocks[a],r=n.length;if(n+=o.displayValue,t<=n.length)return{index:a,offset:t-r}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((n,a)=>n+=a.displayValue.length,0)}_forEachBlocksInRange(t,n,a){n===void 0&&(n=this.displayValue.length);const o=this._mapPosToBlock(t);if(o){const r=this._mapPosToBlock(n),s=r&&o.index===r.index,i=o.offset,d=r&&s?r.offset:this._blocks[o.index].displayValue.length;if(a(this._blocks[o.index],o.index,i,d),r&&!s){for(let c=o.index+1;c<r.index;++c)a(this._blocks[c],c,0,this._blocks[c].displayValue.length);a(this._blocks[r.index],r.index,0,r.offset)}}}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=super.remove(t,n);return this._forEachBlocksInRange(t,n,(o,r,s,i)=>{a.aggregate(o.remove(s,i))}),a}nearestInputPos(t,n){if(n===void 0&&(n=q.NONE),!this._blocks.length)return 0;const a=new Bu(this,t);if(n===q.NONE)return a.pushRightBeforeInput()||(a.popState(),a.pushLeftBeforeInput())?a.pos:this.displayValue.length;if(n===q.LEFT||n===q.FORCE_LEFT){if(n===q.LEFT){if(a.pushRightBeforeFilled(),a.ok&&a.pos===t)return t;a.popState()}if(a.pushLeftBeforeInput(),a.pushLeftBeforeRequired(),a.pushLeftBeforeFilled(),n===q.LEFT){if(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.ok&&a.pos<=t||(a.popState(),a.ok&&a.pos<=t))return a.pos;a.popState()}return a.ok?a.pos:n===q.FORCE_LEFT?0:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:0)}return n===q.RIGHT||n===q.FORCE_RIGHT?(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.pushRightBeforeFilled()?a.pos:n===q.FORCE_RIGHT?this.displayValue.length:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:this.nearestInputPos(t,q.LEFT))):t}totalInputPositions(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);let a=0;return this._forEachBlocksInRange(t,n,(o,r,s,i)=>{a+=o.totalInputPositions(s,i)}),a}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const n=this._maskedBlocks[t];return n?n.map(a=>this._blocks[a]):[]}pad(t){const n=new Q;return this._forEachBlocksInRange(0,this.displayValue.length,a=>n.aggregate(a.pad(t))),n}}pe.DEFAULTS={...ue.DEFAULTS,lazy:!0,placeholderChar:"_"},pe.STOP_CHAR="`",pe.ESCAPE_CHAR="\\",pe.InputDefinition=Je,pe.FixedDefinition=Ut,J.MaskedPattern=pe;class Xe extends pe{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:n=this.to||0,from:a=this.from||0,maxLength:o=this.maxLength||0,autofix:r=this.autofix,...s}=t;this.to=n,this.from=a,this.maxLength=Math.max(String(n).length,o),this.autofix=r;const i=String(this.from).padStart(this.maxLength,"0"),d=String(this.to).padStart(this.maxLength,"0");let c=0;for(;c<d.length&&d[c]===i[c];)++c;s.mask=d.slice(0,c).replace(/0/g,"\\0")+"0".repeat(this.maxLength-c),super._update(s)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let n="",a="";const[,o,r]=t.match(/^(\D*)(\d*)(\D*)/)||[];return r&&(n="0".repeat(o.length)+r,a="9".repeat(o.length)+r),n=n.padEnd(this.maxLength,"0"),a=a.padEnd(this.maxLength,"9"),[n,a]}doPrepareChar(t,n){n===void 0&&(n={});let a;return[t,a]=super.doPrepareChar(t.replace(/\D/g,""),n),t||(a.skip=!this.isComplete),[t,a]}_appendCharRaw(t,n){if(n===void 0&&(n={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,n);const a=String(this.from).padStart(this.maxLength,"0"),o=String(this.to).padStart(this.maxLength,"0"),[r,s]=this.boundaries(this.value+t);return Number(s)<this.from?super._appendCharRaw(a[this.value.length],n):Number(r)>this.to?!n.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(a[this.value.length],n).aggregate(this._appendCharRaw(t,n)):super._appendCharRaw(o[this.value.length],n):super._appendCharRaw(t,n)}doValidate(t){const n=this.value;if(n.search(/[^0]/)===-1&&n.length<=this._matchFrom)return!0;const[o,r]=this.boundaries(n);return this.from<=Number(r)&&Number(o)<=this.to&&super.doValidate(t)}pad(t){const n=new Q;if(this.value.length===this.maxLength)return n;const a=this.value,o=this.maxLength-this.value.length;if(o){this.reset();for(let r=0;r<o;++r)n.aggregate(super._appendCharRaw("0",t));a.split("").forEach(r=>this._appendCharRaw(r))}return n}}J.MaskedRange=Xe;const Cu="d{.}`m{.}`Y";class Ve extends pe{static extractPatternOptions(t){const{mask:n,pattern:a,...o}=t;return{...o,mask:De(n)?n:a}}constructor(t){super(Ve.extractPatternOptions({...Ve.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:n,pattern:a,blocks:o,...r}={...Ve.DEFAULTS,...t},s=Object.assign({},Ve.GET_DEFAULT_BLOCKS());t.min&&(s.Y.from=t.min.getFullYear()),t.max&&(s.Y.to=t.max.getFullYear()),t.min&&t.max&&s.Y.from===s.Y.to&&(s.m.from=t.min.getMonth()+1,s.m.to=t.max.getMonth()+1,s.m.from===s.m.to&&(s.d.from=t.min.getDate(),s.d.to=t.max.getDate())),Object.assign(s,this.blocks,o),super._update({...r,mask:De(n)?n:a,blocks:s})}doValidate(t){const n=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&n!=null&&(this.min==null||this.min<=n)&&(this.max==null||n<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(Ve.extractPatternOptions(t))}}Ve.GET_DEFAULT_BLOCKS=()=>({d:{mask:Xe,from:1,to:31,maxLength:2},m:{mask:Xe,from:1,to:12,maxLength:2},Y:{mask:Xe,from:1900,to:9999}}),Ve.DEFAULTS={...pe.DEFAULTS,mask:Date,pattern:Cu,format:(l,t)=>{if(!l)return"";const n=String(l.getDate()).padStart(2,"0"),a=String(l.getMonth()+1).padStart(2,"0"),o=l.getFullYear();return[n,a,o].join(".")},parse:(l,t)=>{const[n,a,o]=l.split(".").map(Number);return new Date(o,a-1,n)}},J.MaskedDate=Ve;class Qe extends ue{constructor(t){super({...Qe.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map(n=>{const{expose:a,...o}=Ue(n),r=_e({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...o});return a&&(this.exposeMask=r),r}):[])}_appendCharRaw(t,n){n===void 0&&(n={});const a=this._applyDispatch(t,n);return this.currentMask&&a.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(n))),a}_applyDispatch(t,n,a){t===void 0&&(t=""),n===void 0&&(n={}),a===void 0&&(a="");const o=n.tail&&n._beforeTailState!=null?n._beforeTailState._value:this.value,r=this.rawInputValue,s=n.tail&&n._beforeTailState!=null?n._beforeTailState._rawInputValue:r,i=r.slice(s.length),d=this.currentMask,c=new Q,h=d?.state;return this.currentMask=this.doDispatch(t,{...n},a),this.currentMask&&(this.currentMask!==d?(this.currentMask.reset(),s&&(this.currentMask.append(s,{raw:!0}),c.tailShift=this.currentMask.value.length-o.length),i&&(c.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):h&&(this.currentMask.state=h)),c}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const n=new Q;return t&&n.aggregate(this._applyDispatch("",{},t)),n.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var n,a;return{...t,_beforeTailState:((n=t._beforeTailState)==null?void 0:n.currentMaskRef)===this.currentMask&&((a=t._beforeTailState)==null?void 0:a.currentMask)||t._beforeTailState}}doDispatch(t,n,a){return n===void 0&&(n={}),a===void 0&&(a=""),this.dispatch(t,this,n,a)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,n){n===void 0&&(n={});let[a,o]=super.doPrepare(t,n);if(this.currentMask){let r;[a,r]=super.doPrepare(a,this.currentMaskFlags(n)),o=o.aggregate(r)}return[a,o]}doPrepareChar(t,n){n===void 0&&(n={});let[a,o]=super.doPrepareChar(t,n);if(this.currentMask){let r;[a,r]=super.doPrepareChar(a,this.currentMaskFlags(n)),o=o.aggregate(r)}return[a,o]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(n=>n.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask){this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,this._applyDispatch();return}let n=String(t);this.currentMask&&(this.currentMask.typedValue=t,n=this.currentMask.unmaskedValue),this.unmaskedValue=n}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return!!((t=this.currentMask)!=null&&t.isComplete)}get isFilled(){var t;return!!((t=this.currentMask)!=null&&t.isFilled)}remove(t,n){const a=new Q;return this.currentMask&&a.aggregate(this.currentMask.remove(t,n)).aggregate(this._applyDispatch()),a}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(n=>n.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:n,currentMaskRef:a,currentMask:o,...r}=t;n&&this.compiledMasks.forEach((s,i)=>s.state=n[i]),a!=null&&(this.currentMask=a,this.currentMask.state=o),super.state=r}extractInput(t,n,a){return this.currentMask?this.currentMask.extractInput(t,n,a):""}extractTail(t,n){return this.currentMask?this.currentMask.extractTail(t,n):super.extractTail(t,n)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,n){return this.currentMask?this.currentMask.nearestInputPos(t,n):super.nearestInputPos(t,n)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((n,a)=>{if(!t[a])return;const{mask:o,...r}=t[a];return ft(n,r)&&n.maskEquals(o)}):super.maskEquals(t)}typedValueEquals(t){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(t))}}Qe.DEFAULTS={...ue.DEFAULTS,dispatch:(l,t,n,a)=>{if(!t.compiledMasks.length)return;const o=t.rawInputValue,r=t.compiledMasks.map((s,i)=>{const d=t.currentMask===s,c=d?s.displayValue.length:s.nearestInputPos(s.displayValue.length,q.FORCE_LEFT);return s.rawInputValue!==o?(s.reset(),s.append(o,{raw:!0})):d||s.remove(c),s.append(l,t.currentMaskFlags(n)),s.appendTail(a),{index:i,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(c,s.nearestInputPos(s.displayValue.length,q.FORCE_LEFT)))}});return r.sort((s,i)=>i.weight-s.weight||i.totalInputPositions-s.totalInputPositions),t.compiledMasks[r[0].index]}},J.MaskedDynamic=Qe;class et extends pe{constructor(t){super({...et.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:n,...a}=t;if(n){const o=n.map(i=>i.length),r=Math.min(...o),s=Math.max(...o)-r;a.mask="*".repeat(r),s&&(a.mask+="["+"*".repeat(s)+"]"),this.enum=n}super._update(a)}_appendCharRaw(t,n){n===void 0&&(n={});const a=Math.min(this.nearestInputPos(0,q.FORCE_RIGHT),this.value.length),o=this.enum.filter(r=>this.matchValue(r,this.unmaskedValue+t,a));if(o.length){o.length===1&&this._forEachBlocksInRange(0,this.value.length,(s,i)=>{const d=o[0][i];i>=this.value.length||d===s.value||(s.reset(),s._appendChar(d,n))});const r=super._appendCharRaw(o[0][this.value.length],n);return o.length===1&&o[0].slice(this.unmaskedValue.length).split("").forEach(s=>r.aggregate(super._appendCharRaw(s))),r}return new Q({skip:!this.isComplete})}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new Ee("",t)}remove(t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),t===n)return new Q;const a=Math.min(super.nearestInputPos(0,q.FORCE_RIGHT),this.value.length);let o;for(o=t;o>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(a,o),a)).length>1);--o);const r=super.remove(o,n);return r.tailShift+=o-t,r}get isComplete(){return this.enum.indexOf(this.value)>=0}}et.DEFAULTS={...pe.DEFAULTS,matchValue:(l,t,n)=>l.indexOf(t,n)===n},J.MaskedEnum=et;class Gn extends ue{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}J.MaskedFunction=Gn;var Kn;class fe extends ue{constructor(t){super({...fe.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",a=(this.scale?"("+jt(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+n+a),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(jt).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(jt(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const n=t.split(this.radix);return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),n.join(this.radix)}doPrepareChar(t,n){n===void 0&&(n={});const[a,o]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(n.input&&n.raw||!n.input&&!n.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),n);return t&&!a&&(o.skip=!0),a&&!this.allowPositive&&!this.value&&a!=="-"&&o.aggregate(this._appendChar("-")),[a,o]}_separatorsCount(t,n){n===void 0&&(n=!1);let a=0;for(let o=0;o<t;++o)this._value.indexOf(this.thousandsSeparator,o)===o&&(++a,n&&(t+=this.thousandsSeparator.length));return a}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n),this._removeThousandsSeparators(super.extractInput(t,n,a))}_appendCharRaw(t,n){n===void 0&&(n={});const a=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,o=this._separatorsCountFromSlice(a);this._value=this._removeThousandsSeparators(this.value);const r=this._value;this._value+=t;const s=this.number;let i=!isNaN(s),d=!1;if(i){let _;this.min!=null&&this.min<0&&this.number<this.min&&(_=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(_=this.max),_!=null&&(this.autofix?(this._value=this.format(_,this).replace(fe.UNMASKED_RADIX,this.radix),d||(d=r===this._value&&!n.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let c;i?c=new Q({inserted:this._value.slice(r.length),rawInserted:d?"":t,skip:d}):(this._value=r,c=new Q),this._value=this._insertThousandsSeparators(this._value);const h=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,y=this._separatorsCountFromSlice(h);return c.tailShift+=(y-o)*this.thousandsSeparator.length,c}_findSeparatorAround(t){if(this.thousandsSeparator){const n=t-this.thousandsSeparator.length+1,a=this.value.indexOf(this.thousandsSeparator,n);if(a<=t)return a}return-1}_adjustRangeWithSeparators(t,n){const a=this._findSeparatorAround(t);a>=0&&(t=a);const o=this._findSeparatorAround(n);return o>=0&&(n=o+this.thousandsSeparator.length),[t,n]}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n);const a=this.value.slice(0,t),o=this.value.slice(n),r=this._separatorsCount(a.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(a+o));const s=this._separatorsCountFromSlice(a);return new Q({tailShift:(s-r)*this.thousandsSeparator.length})}nearestInputPos(t,n){if(!this.thousandsSeparator)return t;switch(n){case q.NONE:case q.LEFT:case q.FORCE_LEFT:{const a=this._findSeparatorAround(t-1);if(a>=0){const o=a+this.thousandsSeparator.length;if(t<o||this.value.length<=o||n===q.FORCE_LEFT)return a}break}case q.RIGHT:case q.FORCE_RIGHT:{const a=this._findSeparatorAround(t);if(a>=0)return a+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let n=t;this.min!=null&&(n=Math.max(n,this.min)),this.max!=null&&(n=Math.min(n,this.max)),n!==t&&(this.unmaskedValue=this.format(n,this));let a=this.value;this.normalizeZeros&&(a=this._normalizeZeros(a)),this.padFractionalZeros&&this.scale>0&&(a=this._padFractionalZeros(a)),this._value=a}super.doCommit()}_normalizeZeros(t){const n=this._removeThousandsSeparators(t).split(this.radix);return n[0]=n[0].replace(/^(\D*)(0*)(\d*)/,(a,o,r,s)=>o+s),t.length&&!/\d$/.test(n[0])&&(n[0]=n[0]+"0"),n.length>1&&(n[1]=n[1].replace(/0*$/,""),n[1].length||(n.length=1)),this._insertThousandsSeparators(n.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const n=t.split(this.radix);return n.length<2&&n.push(""),n[1]=n[1].padEnd(this.scale,"0"),n.join(this.radix)}doSkipInvalid(t,n,a){n===void 0&&(n={});const o=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===fe.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,n,a)&&!o}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,fe.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(fe.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}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(t){return(super.typedValueEquals(t)||fe.EMPTY_VALUES.includes(t)&&fe.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}Kn=fe,fe.UNMASKED_RADIX=".",fe.EMPTY_VALUES=[...ue.EMPTY_VALUES,0],fe.DEFAULTS={...ue.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Kn.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:l=>l.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},J.MaskedNumber=fe;const kt={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Ht(l,t,n){t===void 0&&(t=kt.MASKED),n===void 0&&(n=kt.MASKED);const a=_e(l);return o=>a.runIsolated(r=>(r[t]=o,r[n]))}function Yn(l,t,n,a){return Ht(t,n,a)(l)}J.PIPE_TYPE=kt,J.createPipe=Ht,J.pipe=Yn;class Wn extends pe{get repeatFrom(){var t;return(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?t:0}get repeatTo(){var t;return(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var n,a,o;const{repeat:r,...s}=Ue(t);this._blockOpts=Object.assign({},this._blockOpts,s);const i=_e(this._blockOpts);this.repeat=(n=(a=r??i.repeat)!=null?a:this.repeat)!=null?n:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((o=this._blocks)==null?void 0:o.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(t){if(t<this._blocks.length)return this._blocks[t];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(_e(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,n){n===void 0&&(n={});const a=new Q;for(let d=(o=(r=this._mapPosToBlock(this.displayValue.length))==null?void 0:r.index)!=null?o:Math.max(this._blocks.length-1,0),c,h;c=(s=this._blocks[d])!=null?s:h=!h&&this._allocateBlock(d);++d){var o,r,s,i;const y=c._appendChar(t,{...n,_beforeTailState:(i=n._beforeTailState)==null||(i=i._blocks)==null?void 0:i[d]});if(y.skip&&h){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(a.aggregate(y),y.consumed)break}return a}_trimEmptyTail(t,n){var a,o;t===void 0&&(t=0);const r=Math.max(((a=this._mapPosToBlock(t))==null?void 0:a.index)||0,this.repeatFrom,0);let s;n!=null&&(s=(o=this._mapPosToBlock(n))==null?void 0:o.index),s==null&&(s=this._blocks.length-1);let i=0;for(let d=s;r<=d&&!this._blocks[d].unmaskedValue;--d,++i);i&&(this._blocks.splice(s-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=super.remove(t,n);return this._trimEmptyTail(t,n),a}totalInputPositions(t,n){return t===void 0&&(t=0),n==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,n)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}J.RepeatBlock=Wn;try{globalThis.IMask=J}catch{}const qt=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:Q,ChunksTailDetails:Ae,DIRECTION:q,HTMLContenteditableMaskElement:Pt,HTMLInputMaskElement:Un,HTMLMaskElement:Ze,InputMask:Hn,MaskElement:gt,Masked:ue,MaskedDate:Ve,MaskedDynamic:Qe,MaskedEnum:et,MaskedFunction:Gn,MaskedNumber:fe,MaskedPattern:pe,MaskedRange:Xe,MaskedRegExp:qn,PIPE_TYPE:kt,PatternFixedDefinition:Ut,PatternInputDefinition:Je,RepeatBlock:Wn,createMask:_e,createPipe:Ht,default:J,forceDirection:zn,normalizeOpts:Ue,pipe:Yn},Symbol.toStringTag,{value:"Module"}));ne.ModalEdit=Cn,ne.VForm=Ce,ne.VsInputAddress=xn,ne.VsInputArray=wn,ne.VsInputCheckbox=Xt,ne.VsInputCodegen=fn,ne.VsInputColor=kn,ne.VsInputContainer=sn,ne.VsInputDate=Eu,ne.VsInputEmail=$t,ne.VsInputFile=an,ne.VsInputFileList=on,ne.VsInputKeyValue=gn,ne.VsInputMask=St,ne.VsInputNumber=Jt,ne.VsInputRadio=At,ne.VsInputRange=bn,ne.VsInputSelect=Ft,ne.VsInputSlug=hn,ne.VsInputStatic=Mt,ne.VsInputSwitcher=Nt,ne.VsInputTag=mn,ne.VsInputTel=Dt,ne.VsInputText=ze,ne.VsInputTextArray=yn,ne.VsInputTextarea=dn,ne.default=Ce,ne.inputs=En,ne.vsInputDatatable=un,ne.vsInputMap=pn,Object.defineProperties(ne,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ (function(ne,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@opengis/core")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core"],e):(ne=typeof globalThis<"u"?globalThis:ne||self,e(ne.FormBuilder={},ne.Vue,ne.OpenGISCore))})(this,function(ne,e,se){"use strict";const Zt=e.defineComponent({__name:"vs-info-tooltip",props:{text:{}},setup(l){const t=l,n=e.ref(!1),a=e.ref({top:"0px",left:"0px"});function o(s){if(!t.text)return;const i=s.currentTarget.getBoundingClientRect();a.value={top:`${i.bottom+4}px`,left:`${Math.min(i.left,window.innerWidth-230)}px`},n.value=!0}function r(){n.value=!1}return(s,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("span",{class:"inline-flex items-center",onMouseenter:o,onMouseleave:r},[e.renderSlot(s.$slots,"default",{},()=>[i[0]||(i[0]=e.createElementVNode("svg",{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",class:"text-gray-400 cursor-help"},[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),e.createElementVNode("path",{d:"M12 16v-4"}),e.createElementVNode("path",{d:"M12 8h.01"})],-1))])],32),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.value&&s.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(a.value),class:"fixed z-[9999] max-w-xs p-2 bg-gray-900 text-white text-xs rounded-lg shadow-lg pointer-events-none"},e.toDisplayString(s.text),5)):e.createCommentVNode("",!0)]))],64))}}),Zn={class:"w-full relative"},Jn={key:0,class:"text-[14px] font-medium text-gray-900 mb-2 flex items-center gap-1"},Xn={class:"opacity-100"},Qn={key:0,class:"text-red-500 text-[14px]"},el={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},tl=e.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){const t=l,n=e.computed(()=>typeof t.item?.label=="string"&&t.item.label?t.item.label:t.item?.ua||t.label||t.ua),a=e.computed(()=>!!n.value),o=e.computed(()=>!!t.item?.rules?.includes("required")),r=e.computed(()=>t.item?.info||"");return(s,i)=>(e.openBlock(),e.createElementBlock("div",Zn,[a.value?(e.openBlock(),e.createElementBlock("div",Jn,[e.createElementVNode("span",Xn,e.toDisplayString(n.value),1),o.value?(e.openBlock(),e.createElementBlock("span",Qn,"*")):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createBlock(Zt,{key:1,text:r.value},null,8,["text"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"default",e.mergeProps(s.$attrs,{class:{"opacity-60":s.item.disabled}})),s.error?(e.openBlock(),e.createElementBlock("span",el,e.toDisplayString(s.error),1)):e.createCommentVNode("",!0)]))}}),nl={class:"w-full relative flex flex-row items-center gap-2"},ll={key:0,class:"text-red-500 text-[14px]"},al={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},ol=e.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{default:()=>({container:12,label:3})}},setup(l){const t=l,n=e.computed(()=>t.item?.label||t.label||t.ua),a=e.computed(()=>t.item?.info||""),o=e.computed(()=>t.columns??{container:12,label:3}),r=e.computed(()=>{const{container:c,label:h}=o.value;return!c||c<=0?0:Math.min(Math.max(h??0,0),c)/c}),s=e.computed(()=>t.item?.type==="html"||r.value<=0?!1:!!n.value),i=e.computed(()=>{if(!s.value)return{};const c=`${r.value*100}%`;return{flexBasis:c,maxWidth:c}}),d=e.computed(()=>{const{container:c,label:h}=o.value;if(!c||c<=0)return{};if(t.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!s.value)return{flexBasis:"100%",maxWidth:"100%"};const y=Math.max(c-Math.max(h??0,0),0)/c;if(!y)return{};const _=`${y*100}%`;return{flexBasis:_,maxWidth:_}});return(c,h)=>(e.openBlock(),e.createElementBlock("div",nl,[s.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0 items-center gap-1",style:e.normalizeStyle(i.value)},[e.createTextVNode(e.toDisplayString(n.value)+" ",1),c.item?.rules?.includes("required")&&n.value?(e.openBlock(),e.createElementBlock("span",ll,"*")):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createBlock(Zt,{key:1,text:a.value},null,8,["text"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"flex-1 min-w-0",style:e.normalizeStyle(d.value)},[e.renderSlot(c.$slots,"default",e.normalizeProps(e.guardReactiveProps(c.$attrs)))],4),c.error?(e.openBlock(),e.createElementBlock("span",al,e.toDisplayString(c.error),1)):e.createCommentVNode("",!0)]))}}),rl={class:"w-full relative"},sl={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},il=e.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",rl,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",sl,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),dl={class:"flex-1 min-w-0"},cl={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},ul={class:"truncate"},pl={key:0,class:"text-red-500 text-[14px]"},ml=["innerHTML"],hl={key:0,class:"mt-1 text-xs text-red-500"},fl={default:tl,horizontal:ol,inline:il,settings:e.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){const t=l,n=e.ref("uk");e.computed(()=>(t.item??{})?.[n.value]??t.ua??t.label??"");const a=e.computed(()=>t.item?.description??""),o=e.computed(()=>Array.isArray(t.item?.rules)&&t.item.rules.includes("required")),r=e.computed(()=>(typeof t.error=="string"?t.error:"")??""),s=()=>{const i=typeof localStorage<"u"?localStorage.getItem("locale"):null;n.value=i||"uk"};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(n.value=localStorage.locale)}catch{}window.addEventListener("storage",s)}),e.onUnmounted(()=>{window.removeEventListener("storage",s)}),(i,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":i.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(i.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",dl,[i.ua||i.label?(e.openBlock(),e.createElementBlock("p",cl,[e.createElementVNode("span",ul,e.toDisplayString(i.item[n.value]||i.ua||i.label),1),o.value?(e.openBlock(),e.createElementBlock("span",pl,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createElementBlock("p",{key:1,class:"text-xs text-slate-500 dark:text-slate-400",innerHTML:a.value},null,8,ml)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["w-full",["select","native-select"].includes(i.item.type)?"md:w-[30%]":"md:w-auto"])},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],2)],2),r.value?(e.openBlock(),e.createElementBlock("p",hl,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0)],2))}})};function he(l){return{inputClass:e.computed(()=>{const n=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${l?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return l?.size==="sm"?`${n}h-[32px]`:`${n}h-[38px]`})}}const gl=["placeholder","disabled"],yl=e.defineComponent({__name:"vs-input-password",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=he(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??"");return(s,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),placeholder:r.value,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,gl)),[[e.vModelText,a.value]])}}),kl=["placeholder","disabled","maxlength","minlength"],ze=e.defineComponent({__name:"vs-input-text",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=he(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??""),s=e.computed(()=>t.maxlength??void 0),i=e.computed(()=>t.minlength??void 0);function d(){typeof a.value=="string"&&(a.value=a.value.trim())}return(c,h)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":h[0]||(h[0]=y=>a.value=y),placeholder:r.value,disabled:o.value,maxlength:s.value,minlength:i.value,onBlur:d,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[c.customClass,e.unref(n),{"!border-red-600":c.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,kl)),[[e.vModelText,a.value]])}}),bl=["placeholder","disabled","min","max"],Jt=e.defineComponent({__name:"vs-input-number",props:e.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=he(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled);return(r,s)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":s[0]||(s[0]=i=>a.value=i),placeholder:r.placeholder,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"},min:r.min,max:r.max},null,10,bl)),[[e.vModelText,a.value]])}}),Y=(l,t)=>{const n=l.__vccOpts||l;for(const[a,o]of t)n[a]=o;return n},wl={},xl={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 _l(l,t){return e.openBlock(),e.createElementBlock("svg",xl,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const El=Y(wl,[["render",_l]]),Vl={class:"flex items-center gap-[4px]"},vl=["value","id","disabled"],Bl=["for"],Cl={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},Nl=e.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=t,a=l,o=e.computed({get:()=>a.modelValue,set:s=>n("update:modelValue",s)}),r=e.computed(()=>!!a.disabled);return(s,i)=>(e.openBlock(),e.createElementBlock("div",Vl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:s.value,"onUpdate:modelValue":i[0]||(i[0]=d=>o.value=d),class:e.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.value}]),id:s.id,disabled:r.value},null,10,vl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:s.id,class:e.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.value}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[o.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",s.error?"border-red-600":""]])},[e.createVNode(El,{height:"12",width:"12"})],2),e.createElementVNode("span",Cl,[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(s.label),1)])])],10,Bl)]))}}),Ml=["name","value","disabled"],Sl={class:"flex items-center gap-[6px] text-[14px]"},$l={key:0,class:"text-[16px]"},Dl=["src"],Al=e.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(l,{emit:t}){const n=l,a=t,o=e.computed({get:()=>n.modelValue,set:i=>{a("update:modelValue",i)}}),r=e.computed(()=>Array.isArray(o.value)?o.value.includes(n.value):o.value===!0||o.value===n.value),s=e.computed(()=>n.style?.size==="xs"?"p-1.5 text-xs":n.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(i,d)=>(e.openBlock(),e.createElementBlock("label",{class:e.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",[s.value,r.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"hidden",name:i.id,value:i.value,"onUpdate:modelValue":d[0]||(d[0]=c=>o.value=c),disabled:i.disabled},null,8,Ml),[[e.vModelCheckbox,o.value]]),e.createElementVNode("span",Sl,[i.icon||i.imgUrl?(e.openBlock(),e.createElementBlock("span",$l,[i.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(i.icon)},null,2)):e.createCommentVNode("",!0),i.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:1,src:i.imgUrl,width:"16",height:"16",alt:"icon"},null,8,Dl)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(i.label),1)])])],2))}}),Fl={class:"flex items-center"},Bt=e.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(l,{emit:t}){const n=l,a=t,o=`radio-${Math.floor(Math.random()*1e4)}`,r=e.computed({get:()=>Array.isArray(n.modelValue)?Array.isArray(n.modelValue)&&n.modelValue.includes(n.value):n.modelValue,set:i=>{if(Array.isArray(n.modelValue)){let d=[...n.modelValue];i?d.includes(n.value)||d.push(n.value):d=d.filter(c=>c!==n.value),a("update:modelValue",d)}else a("update:modelValue",i)}}),s=e.ref(`vs-checkbox-${n.view||"default"}`);return(i,d)=>(e.openBlock(),e.createElementBlock("div",Fl,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value==="vs-checkbox-buttons"?e.unref(Al):e.unref(Nl)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:r.value,"onUpdate:modelValue":d[0]||(d[0]=c=>r.value=c),id:o,icon:i.icon,imgUrl:i.imgUrl,style:e.normalizeStyle(i.style),error:i.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),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-chevron-down"};function Il(l,t){return e.openBlock(),e.createElementBlock("svg",Tl,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const Ol=Y(Ll,[["render",Il]]),Rl={},zl={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-x"};function jl(l,t){return e.openBlock(),e.createElementBlock("svg",zl,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),e.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const Ct=Y(Rl,[["render",jl]]),Pl={},Ul={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 Hl(l,t){return e.openBlock(),e.createElementBlock("svg",Ul,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M12 9h.01"},null,-1),e.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),e.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 ql=Y(Pl,[["render",Hl]]),Gl={key:0,class:"flex items-start gap-x-1"},Kl={key:0,class:"text-red-500 text-[14px]"},Yl=["title"],Wl=["disabled"],Nt=e.defineComponent({__name:"vs-input-switcher",props:e.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:{},maxlength:{},minlength:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue");return(a,o)=>t.view==="checkbox"?(e.openBlock(),e.createElementBlock("div",Gl,[e.createVNode(Bt,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),label:a.text,error:a.error||""},null,8,["modelValue","label","error"]),a.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",Kl,"*")):e.createCommentVNode("",!0),a.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:a.i,onClick:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(ql),{class:"text-gray-500 w-[14px] h-[14px]"})],8,Yl)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.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",[n.value?`bg-${a.style?.primaryColor||"blue"}-500`:"bg-stone-200",a.customClass]]),disabled:a.disabled,onClick:o[2]||(o[2]=r=>n.value=!n.value)},[e.createElementVNode("span",{"data-state":"checked",class:e.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[n.value?"translate-x-4":"translate-x-0"]])},null,2)],10,Wl))}}),Zl=["id","innerHTML"],Mt=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",{id:t.name,class:e.normalizeClass(["text-gray-900",t.customClass]),innerHTML:t.html?t.html:t.text},null,10,Zl))}}),Jl=["placeholder","disabled","name"],St=e.defineComponent({__name:"vs-input-mask",props:e.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=he(t.style),a=e.useModel(l,"modelValue"),o=e.ref(null);let r=null;return e.onMounted(async()=>{if(o.value){const{default:s}=await Promise.resolve().then(()=>qt);r=s(o.value,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),r.on("accept",()=>{a.value=t.unmask?r.unmaskedValue:r.value}),r.on("complete",()=>{a.value=t.unmask?r.unmaskedValue:r.value}),r.value=a.value!=null?String(a.value):""}}),e.onBeforeUnmount(()=>{r?.destroy()}),e.watch(()=>t.mask,s=>{r&&r.updateOptions({mask:s,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),e.watch(a,s=>{r&&r.unmaskedValue!==s&&(r.value=s!=null?String(s):"")}),(s,i)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:s.placeholder,disabled:s.disabled,name:s.name,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,10,Jl))}}),Xl={class:"relative w-full bg-white rounded-lg"},Ql=["placeholder","disabled"],$t=e.defineComponent({__name:"vs-input-email",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=he(t.style),a=e.useModel(l,"modelValue");return(o,r)=>(e.openBlock(),e.createElementBlock("div",Xl,[r[1]||(r[1]=e.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)),e.withDirectives(e.createElementVNode("input",{type:"email","onUpdate:modelValue":r[0]||(r[0]=s=>a.value=s),placeholder:o.placeholder,disabled:o.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Ql),[[e.vModelText,a.value]])]))}}),ea={class:"relative w-full bg-white rounded-lg"},ta=["value","placeholder","disabled"],Dt=e.defineComponent({__name:"vs-input-tel",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=he(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>a.value?a.value.startsWith("+")?a.value.slice(1):a.value:""),r=i=>{let{value:d}=i.target;d=d.replace(/^\+/,""),a.value=d?`+${d}`:""},s=i=>{const d=i,{data:c,inputType:h}=d;h&&h.startsWith("delete")||c&&/\D/.test(c)&&d.preventDefault()};return e.watch(()=>a.value,i=>{i&&!i.startsWith("+")?a.value=`+${i.replace(/^\+/,"")}`:i||(a.value="")},{immediate:!0}),(i,d)=>(e.openBlock(),e.createElementBlock("div",ea,[d[0]||(d[0]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},[e.createElementVNode("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"},[e.createElementVNode("path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"})])],-1)),d[1]||(d[1]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[30px] text-gray-500 select-none pointer-events-none"}," + ",-1)),e.createElementVNode("input",{type:"tel",value:o.value,onInput:r,onBeforeinput:s,pattern:"^\\+[1-9]\\d{1,14}$",maxlength:"15",placeholder:i.placeholder,disabled:i.disabled,class:e.normalizeClass(["!pl-10 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":i.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,ta)]))}}),na=["value","disabled"],la={class:"text-[13px] text-gray-700"},aa=e.defineComponent({__name:"vs-input-radio-default",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>!!t.disabled);return(o,r)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center gap-0",[t.customClass,a.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:"radio",value:t.value,disabled:a.value,class:"hidden"},null,8,na),[[e.vModelRadio,n.value]]),e.createElementVNode("span",{class:e.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${t.style?.primaryColor||"blue"}-500`,a.value?"opacity-50 cursor-not-allowed":""]])},[n.value==t.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${t.style?.primaryColor||"blue"}-500`]])},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",la,e.toDisplayString(t.text),1)],2))}}),oa=["value","disabled"],ra={class:"text-[13px] text-gray-700"},sa={"vs-input-radio-default":aa,"vs-input-radio-buttons":e.defineComponent({__name:"vs-input-radio-buttons",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>!!t.disabled);return(o,r)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[n.value==t.value?`ring-2 ring-ring ring-${t.style?.primaryColor||"blue"}-500`:"",t.customClass,a.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:"radio",value:t.value,disabled:a.value,class:"hidden"},null,8,oa),[[e.vModelRadio,n.value]]),e.createElementVNode("span",ra,e.toDisplayString(t.text),1)],2))}})},At=e.defineComponent({__name:"vs-input-radio",props:e.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>sa[`vs-input-radio-${t.view}`]);return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([o.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,s=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),e.mergeProps({key:s?.id,text:s.text,value:s.id.toString(),checked:n.value===s.id,modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=i=>n.value=i)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),ia={key:1,class:"w-full flex flex-col gap-4"},da={key:0,class:"text-sm font-medium text-muted-foreground my-2"},ca="Без категорії",Xt=Y(e.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},group:{default:void 0},values:{default:()=>[]},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.ref([]),r=e.reactive({}),s=b=>b?.value||b?.id||b?.text||b,i=b=>b.text||String(b),d=b=>`lg:col-span-${b||12}`,c=e.computed(()=>[n.position==="vertical"?"flex flex-col":"",n.colSpan?"grid":"flex justify-start"]),h=b=>b==null||b===""?null:typeof b=="string"||typeof b=="number"?b:String(b),y=e.computed(()=>{if(!n.group)return[];const b=new Map;o.value.forEach(u=>{const x=u[n.group],f=h(x);b.has(f)||b.set(f,[]),b.get(f)?.push(u)});const B=[];n.values?.length&&n.values.forEach(u=>{const x=h(u);B.push(x)});const g=new Set,k=u=>{const x=b.get(u)||[];if(!x.length)return null;const f=u===null?"group-null":`group-${String(u)}`,V=u===null?ca:String(u);return g.add(u),{key:f,label:V,options:x}},w=[];return B.forEach(u=>{const x=k(u);x&&w.push(x)}),b.forEach((u,x)=>{if(g.has(x))return;const f=k(x);f&&w.push(f)}),w}),_=async()=>{try{const b=await fetch(`/api/suggest/${n.data}`).then(B=>B.json());o.value=b?.data||b}catch(b){console.error(b)}};return e.watch(()=>n.modelValue,b=>{if(typeof b=="boolean"&&o.value.length===1){const B=s(o.value[0]);r[B]=b}else if(Array.isArray(b)){const B=new Set(b);o.value.forEach(g=>{if(!g.disabled){const k=s(g);r[k]=B.has(k)}})}},{immediate:!0}),e.watch(r,()=>{if(!o.value.length){a("update:modelValue",null);return}const b=Object.entries(r).filter(([,B])=>B).map(([B])=>B);a("update:modelValue",b.length===0?[]:b)},{deep:!0}),e.onMounted(()=>{if(n.data)_().then(()=>{if(typeof n.modelValue=="boolean"&&o.value.length===1){const b=s(o.value[0]);r[b]=n.modelValue}else if(Array.isArray(n.modelValue)){const b=new Set(n.modelValue);o.value.forEach(B=>{if(!B.disabled){const g=s(B);r[g]=b.has(g)}})}});else if(o.value=n.options,typeof n.modelValue=="boolean"&&o.value.length===1){const b=s(o.value[0]);r[b]=n.modelValue}else if(Array.isArray(n.modelValue)){const b=new Set(n.modelValue);o.value.forEach(B=>{if(!B.disabled){const g=s(B);r[g]=b.has(g)}})}}),(b,B)=>n.group?(e.openBlock(),e.createElementBlock("div",ia,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g.key,class:"flex flex-col gap-2"},[g.label?(e.openBlock(),e.createElementBlock("span",da,e.toDisplayString(g.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["p-0 w-full gap-[12px]",c.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.options,k=>(e.openBlock(),e.createBlock(Bt,{modelValue:r[s(k)],"onUpdate:modelValue":w=>r[s(k)]=w,value:s(k),class:e.normalizeClass(d(b.colSpan)),disabled:n.disabled||k.disabled,label:i(k),key:`${g.key}-${s(k)}`,icon:k?.icon,imgUrl:k?.imgUrl,option:k,view:b.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["p-0 w-full gap-[10px]",c.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,g=>(e.openBlock(),e.createBlock(Bt,{modelValue:r[s(g)],"onUpdate:modelValue":k=>r[s(g)]=k,value:s(g),class:e.normalizeClass(d(b.colSpan)),disabled:n.disabled||g.disabled,label:i(g),key:s(g),icon:g?.icon,imgUrl:g?.imgUrl,option:g,view:b.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-8e66207e"]]),ua=["type","placeholder","disabled"],pa=e.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},mode:{default:"date"}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l;function a(h){return h?n.mode==="datetime"?(h.includes("T")?h:null)||h+(h.includes(" ")?"":"T00:00"):h?.split(" ")[0]:null}const{inputClass:o}=he(n.style),r=t,s=e.computed({get:()=>a(n.modelValue),set:h=>r("update:modelValue",h)}),i=e.computed(()=>n.mode==="datetime"?"datetime-local":n.mode),d=e.computed(()=>!!n.disabled),c=e.computed(()=>n.placeholder??"");return(h,y)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":y[0]||(y[0]=_=>s.value=_),placeholder:c.value,disabled:d.value,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[h.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,ua)),[[e.vModelDynamic,s.value]])}}),ma=(l,t)=>{if(!t||!Object.keys(t).length)return l;const[n,a=""]=l.split("?"),o=new URLSearchParams(a);Object.entries(t).forEach(([s,i])=>{i==null||i===""||o.set(s,String(i))});const r=o.toString();return r?`${n}?${r}`:n},Qt=async(l,t={})=>{try{const n=new FormData;n.append("unique","true"),n.append("file",l);const{api:a,id:o="1",form:r="form",table:s="table",customParams:i}=t,d=a||`/file/upload/uploads?id=${o||""}&form=${r||""}&table=${s||""}`,c=ma(d,i);return(await fetch(c,{method:"POST",body:n}).then(y=>y.json()))?.result}catch(n){return se.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",n),null}},ha=async l=>{try{return await fetch(`file/delete${l}`),!0}catch(t){return console.error(t),!1}},en=async l=>{try{const t=await fetch(`file/download/files/uploads${l}`),n=await t.arrayBuffer(),a=t.headers["content-type"],o=new TextDecoder("utf-8").decode(n),r=new Blob([o],{type:a}),s=document.createElement("a");s.setAttribute("download",l),s.href=window.URL.createObjectURL(r),s.click()}catch(t){console.error(t.message)}},fa={},ga={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 ya(l,t){return e.openBlock(),e.createElementBlock("svg",ga,t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const Be=Y(fa,[["render",ya]]),ka={},ba={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 wa(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",ba,t[0]||(t[0]=[e.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 xa=Y(ka,[["render",wa]]),_a={},Ea={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 Va(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Ea,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),e.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),e.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const va=Y(_a,[["render",Va]]),Ba={},Ca={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 Na(l,t){return e.openBlock(),e.createElementBlock("svg",Ca,t[0]||(t[0]=[e.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="M9 9l1 0"></path><path d="M9 13l6 0"></path><path d="M9 17l6 0"></path>',6)]))}const tn=Y(Ba,[["render",Na]]),Ma={},Sa={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 $a(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Sa,t[0]||(t[0]=[e.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 Da=Y(Ma,[["render",$a]]),Aa={},Fa={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 La(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Fa,t[0]||(t[0]=[e.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 Ta=Y(Aa,[["render",La]]),Ia=l=>{if(!l)return"";const t=l?.split(".");return t[t.length-1]},Oa=l=>{const t=Ia(l),n={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 n.imageFormat.includes(t)?"img":n.sheetsFormat.includes(t)?va:n.textsFormat.includes(t)?Ta:n.documentsFormat.includes(t)?xa:n.archivesFormat.includes(t)?Da:tn},Ra={},za={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 ja(l,t){return e.openBlock(),e.createElementBlock("svg",za,t[0]||(t[0]=[e.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 je=Y(Ra,[["render",ja]]),Pa={},Ua={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 Ha(l,t){return e.openBlock(),e.createElementBlock("svg",Ua,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const nn=Y(Pa,[["render",Ha]]),qa=["title"],Ga={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},ln=Y(e.defineComponent({__name:"vs-input-file-list-item",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(l){const t=e.useModel(l,"value"),n=e.useModel(l,"item"),a=l;return(o,r)=>(e.openBlock(),e.createElementBlock("div",{title:n.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Oa)(n.value)),{src:n.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:r[0]||(r[0]=s=>e.unref(en)(n.value))},null,8,["src"])),e.createElementVNode("div",Ga,[e.createElementVNode("button",{type:"button",onClick:r[1]||(r[1]=s=>{e.unref(ha)(n.value),t.value=a.multiple?t.value?.filter(i=>i!==n.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[e.createVNode(je,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:r[2]||(r[2]=s=>e.unref(en)(n.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[e.createVNode(nn,{class:"w-4 h-4"})])])],8,qa))}}),[["__scopeId","data-v-286cdbc0"]]),Ka={class:"flex items-center gap-x-2"},Ya=["accept","multiple","disabled"],Wa={key:1,class:"flex items-center flex-wrap gap-2"},Za={key:1,class:"loader"},Ja={key:1,class:"loader"},an=Y(e.defineComponent({__name:"vs-input-file",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["change"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=e.useModel(l,"modelValue"),o=t,r=e.ref(null),s=e.ref(!1),i=e.inject("values"),d=e.computed(()=>n.format?n.format.split(",").map(u=>u.trim().toLowerCase()).filter(Boolean):[]),c=u=>Array.isArray(a.value)&&a.value[u]||"",h=u=>{if(n.max_size&&u.size>n.max_size*1024*1024){const x=(u.size/1048576).toFixed(2);return se.notify({type:"error",title:"Помилка!",message:`Файл "${u.name}" занадто великий. Максимальний розмір: ${n.max_size} МБ, розмір файлу: ${x} МБ`,position:"right-bottom"}),!1}return!0},y=u=>{if(!d.value.length)return!0;const x=`.${u.name.split(".").pop()?.toLowerCase()||""}`,f=d.value.includes(x);return f||se.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${u.name}". Дозволені формати: ${d.value.join(", ")}`,position:"right-bottom"}),f},_=e.computed(()=>{const u={},x=[];if(!n.customParams?.length)return{params:u,missingSources:x};const f=i?.value??{};return n.customParams.forEach(V=>{if(!V)return;const[M,A]=V.split("="),j=M?.trim(),P=A?.trim();if(!j||!P)return;const G=f[P];if(G==null||G===""){x.push(P);return}u[j]=G}),{params:u,missingSources:x}}),b=()=>{const u=_.value.params;return{api:n.api,customParams:Object.keys(u).length?u:void 0}},B=()=>{const u=_.value.missingSources;if(!u.length)return!0;const x=u.join(", ");return se.notify({type:"warning",title:"Заповніть поля",message:`Поля (${x}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},g=u=>{se.notify({type:"error",title:"Помилка завантаження",message:u||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},k=()=>{n.disabled||s.value||B()&&r.value?.click()},w=async u=>{const{files:x}=u.target;if(!x||x.length===0)return;if(!B()){r.value&&(r.value.value="");return}const f=Array.from(x);if(n.max_size&&f.filter(A=>!h(A)).length>0){r.value&&(r.value.value="");return}if(f.filter(M=>!y(M)).length>0){r.value&&(r.value.value="");return}s.value=!0;try{if(n.multiple){const M=Array.from(x).map(async G=>await Qt(G,b())),A=await Promise.all(M),P=A.filter(G=>G!==null).map(G=>G?.file_path).filter(Boolean);if(P.length===0){g();return}P.length<A.length&&g("Деякі файли не вдалося завантажити. Перевірте їх та спробуйте знову."),a.value=[...a.value||[],...P],o("change",a.value)}else{const M=x[0],A=await Qt(M,b());if(!A?.file_path){g();return}a.value=A?.file_path,o("change",a.value||"")}}catch(M){const A=M?.message||void 0;g(A)}finally{s.value=!1,r.value&&(r.value.value="")}};return(u,x)=>(e.openBlock(),e.createElementBlock("div",Ka,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:r,type:"file",accept:n.format,multiple:u.multiple,onChange:w,disabled:s.value||u.disabled},null,40,Ya),!u.multiple&&a.value?(e.openBlock(),e.createBlock(ln,{key:0,item:a.value,"onUpdate:item":x[0]||(x[0]=f=>a.value=f),value:a.value,"onUpdate:value":x[1]||(x[1]=f=>a.value=f)},null,8,["item","value"])):u.multiple?(e.openBlock(),e.createElementBlock("div",Wa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(f,V)=>(e.openBlock(),e.createBlock(ln,{multiple:u.multiple,key:V,value:a.value,"onUpdate:value":x[2]||(x[2]=M=>a.value=M),item:c(V)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:k,class:e.normalizeClass(["relative 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",u.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[s.value?(e.openBlock(),e.createElementBlock("div",Za)):(e.openBlock(),e.createBlock(Be,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),u.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:k,class:e.normalizeClass([u.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","relative 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"])},[s.value?(e.openBlock(),e.createElementBlock("div",Ja)):(e.openBlock(),e.createBlock(Be,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-94bcb5d9"]]),Xa={class:"max-w-[55vw]"},Qa={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},eo={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},to={class:"px-[5px]"},no={class:""},ot=e.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(l){const t=l,n=e.computed(()=>{try{return new Date(t.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function a(o){if(o<1024)return`${o} B`;const r=o/1024;return r<1024?`${r.toFixed(2)} KB`:`${(r/1024).toFixed(2)} MB`}return(o,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[r[1]||(r[1]=e.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)),e.createElementVNode("div",Xa,[e.createElementVNode("p",Qa,e.toDisplayString(o.item?.uploaded_name),1),e.createElementVNode("p",eo,[e.createElementVNode("span",null,e.toDisplayString(o.item?.username),1),e.withDirectives(e.createElementVNode("span",to,"|",512),[[e.vShow,o.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(n.value),1),r[0]||(r[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",no,e.toDisplayString(a(o.item?.size)),1)])])],64))}}),lo={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},ao={key:0,class:"flex w-full gap-x-3 items-center"},oo={key:1,class:"flex gap-x-3 w-full items-center"},ro={key:2,class:"flex gap-x-3 w-full items-center"},so=["href"],io={key:3,class:"flex gap-x-3 w-full items-center"},co={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},uo={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"},po={class:"inline-block"},mo={class:"inline-block"},ho=e.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(l,{emit:t}){const n=l,a=t;function o(h){return["pdf","json"].includes(h.ext)}function r(h){return["ppt","pptx","doc","docx","xls","xlsx"].includes(h.ext)}function s(h){const y=document.createElement("a");y.setAttribute("download",h?.uploaded_name),y.href=h?.file_path,y.click()}async function i(){try{await fetch(`${n.prefix}/widget/file/${n.item.entity_id}/${n.item.file_id}`),a("update")}catch(h){console.error(h)}}function d(){a("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function c(h){(n.item.ext==="jpg"||n.item.ext==="png")&&a("openLightbox",{item:n.item,index:h})}return(h,y)=>(e.openBlock(),e.createElementBlock("div",lo,[h.item.ext==="jpg"||h.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",ao,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:y[0]||(y[0]=_=>c(h.index))},[e.createVNode(ot,{item:h.item},null,8,["item"])])])):o(h.item)?(e.openBlock(),e.createElementBlock("div",oo,[e.createVNode(ot,{item:h.item},null,8,["item"])])):r(h.item)?(e.openBlock(),e.createElementBlock("div",ro,[e.createElementVNode("a",{href:`/api/file-preview?id=${h.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(ot,{item:h.item},null,8,["item"])],8,so)])):(e.openBlock(),e.createElementBlock("div",io,[e.createVNode(ot,{item:h.item},null,8,["item"])])),e.createElementVNode("div",co,[e.createElementVNode("div",uo,[e.createElementVNode("div",po,[e.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:y[1]||(y[1]=_=>s(h.item))},[e.createVNode(nn,{height:"14",width:"14"})])]),y[3]||(y[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",mo,[e.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:y[2]||(y[2]=_=>d())},[e.createVNode(je,{height:"14",width:"14"})])])])])]))}}),fo={},go={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 yo(l,t){return e.openBlock(),e.createElementBlock("svg",go,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const ko=Y(fo,[["render",yo]]),bo={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},wo={class:"flex w-full mb-[12px] items-center gap-x-2"},xo={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},_o={class1:"ml-auto"},Eo={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"},Vo={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},vo={class:"relative"},Bo={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"},Co={key:0},on=e.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update"],setup(l,{emit:t}){const n=l,a=e.inject("form"),o=e.computed(()=>a.value.formId),r=e.ref(!1),s=e.ref(0),i=t,d=e.ref(!1),c=e.ref({}),h=e.ref([]),y=e.ref(""),_=e.computed(()=>Array.isArray(h.value)?h.value.filter(x=>x.ext==="jpg"||x.ext==="png").map(x=>x?.file_path):[]),b=e.computed(()=>y.value===""?h.value:h.value.filter(x=>x?.uploaded_name?.includes(y.value))),B=x=>{const f=_.value.findIndex(V=>V===x.item.file_path);f!==-1&&(r.value=!0,s.value=f)},g=async()=>{try{const x=await fetch(`${n.prefix}/widget/file/${o.value}`).then(f=>f.json());h.value=x?.rows}catch(x){console.error(x)}},k=async x=>{await Promise.all(Array.from(x.target.files).map(async f=>{const V=new FormData;V.append("file",f);try{const M=`${n.prefix}/widget/file/${o.value}`,A=await fetch(M,{method:"POST",body:V});return A.ok?(i("update","file-list"),f):(se.notify({type:A.status>=400&&A.status<500?"warning":"error",title:"Error",message:`Error code: ${A.status}`}),null)}catch(M){return se.notify({type:"error",title:"Error",message:M.message||"Unknown error"}),console.error(M),null}})),await g()},w=x=>{const f={...x};return x.cancel||(f.cancel=()=>{d.value=!1}),x.updateListOnConfirm&&(f.confirm=async()=>{await x.confirm(),d.value=!1,g()}),f},u=x=>{c.value=w(x),d.value=!0};return e.watch(o,x=>{x&&g()}),e.onMounted(()=>{o.value&&g()}),(x,f)=>{const V=e.resolveComponent("Lightbox"),M=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",bo,[e.createElementVNode("div",wo,[e.createElementVNode("h2",xo," Файлів: "+e.toDisplayString(h.value?.length),1),e.createElementVNode("div",_o,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:f[0]||(f[0]=A=>k(A))},null,32),e.createElementVNode("div",Eo,[e.createVNode(ko,{height:"16",width:"16"})])])])]),h.value?.length>4?(e.openBlock(),e.createElementBlock("div",Vo,[e.createElementVNode("div",null,[e.createElementVNode("div",vo,[f[8]||(f[8]=e.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[e.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"},[e.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),e.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":f[1]||(f[1]=A=>y.value=A),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),[[e.vModelText,y.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),h.value?.length?(e.openBlock(),e.createElementBlock("div",Bo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(A,j)=>(e.openBlock(),e.createBlock(ho,{key:j,prefix:x.prefix,item:A,index:j,onUpdate:f[2]||(f[2]=P=>x.$emit("update","file-list")),onOpenModal:f[3]||(f[3]=P=>u(P)),onOpenLightbox:f[4]||(f[4]=P=>B(P))},null,8,["prefix","item","index"]))),128)),b.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Co,f[9]||(f[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):e.createCommentVNode("",!0),e.createVNode(V,{modelValue:r.value,"onUpdate:modelValue":f[5]||(f[5]=A=>r.value=A),startIndex:s.value,"onUpdate:index":f[6]||(f[6]=A=>s.value=A),images:_.value},null,8,["modelValue","startIndex","images"]),e.createVNode(M,e.mergeProps({modelValue:d.value,"onUpdate:modelValue":f[7]||(f[7]=A=>d.value=A),onConfirm:c.value.confirm},c.value),null,16,["modelValue","onConfirm"])])}}}),No={class:"flex items-center justify-between"},Mo={class:"text-[16px] text-gray-900 font-medium"},So={class:"grid gap-3"},$o=Y(e.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(l){const t=l,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,a=>{n.value=a}),(a,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",No,[e.createElementVNode("p",Mo,e.toDisplayString(l.title),1),e.createVNode(Nt,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),style:e.normalizeStyle(l.style)},null,8,["modelValue","style"])]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",So,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),Do={class:"text-[16px] text-gray-900 font-medium"},Ao={class:"grid gap-3"},Fo=Y(e.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(l){const t=l,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,a=>{n.value=a}),(a,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("button",{type:"button",onClick:o[0]||(o[0]=r=>n.value=!n.value),class:"flex items-center gap-2"},[e.createVNode(e.unref(Ol),{class:e.normalizeClass(["h-4 w-4 duration-300",[n.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",Do,e.toDisplayString(l.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Ao,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),Lo={class:"flex items-center justify-between"},To={switcher:$o,accordion:Fo,default:e.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Lo,[e.createElementVNode("p",null,e.toDisplayString(l.title),1)]),e.renderSlot(t.$slots,"default")]))}})},ke={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Io=(l,t)=>String(l)===String(t),Oo=(l,t)=>String(l)!==String(t),Ro=(l,t)=>l>t,zo=(l,t)=>l>=t,jo=(l,t)=>l<t,Po=(l,t)=>l<=t,Uo=(l,t)=>Array.isArray(t)&&t.length===2?l>=t[0]&&l<=t[1]:!1,Ho=(l,t)=>String(l).startsWith(String(t)),qo=(l,t)=>String(l).endsWith(String(t)),Go=(l,t)=>String(l).includes(String(t)),Ko=(l,t)=>Array.isArray(t)?t.includes(l):!1,Yo=(l,t)=>Array.isArray(t)?!t.includes(l):!0,rn=(l,t)=>{if(!t)return!0;switch(t?.[1]){case ke.Equal:return Io(l,t?.[2]);case ke.Inequal:return Oo(l,t?.[2]);case ke.Higer:return Ro(l,t?.[2]);case ke.HigerOrEqual:return zo(l,t?.[2]);case ke.Lower:return jo(l,t?.[2]);case ke.LowerOrEqual:return Po(l,t?.[2]);case ke.Between:return Uo(l,t?.[2]);case ke.StartWith:return Ho(l,t?.[2]);case ke.EndWith:return qo(l,t?.[2]);case ke.Contain:return Go(l,t?.[2]);case ke.In:return Ko(l,t?.[2]);case ke.NotIn:return Yo(l,t?.[2]);default:return!0}},sn=e.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(l){const t=l,n=e.inject("values",e.ref({})),a=e.inject("form"),o=e.computed(()=>t.schema?.filter(i=>{const d=i?.conditions;if(!d)return!0;const c=Array.isArray(d)?d[0]:d,h=t.name?n.value?.[t.name]?.[c]??n.value?.[c]:n.value?.[c];return rn(h,d)})),r=e.computed(()=>To[t.view]),s=e.computed(()=>{if(n.value||(n.value={}),!t.name)return n.value;const i=n.value[t.name];if(i)return i;const d={};return n.value={...n.value,[t.name]:d},d});return(i,d)=>l.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{key:0,title:l.title,style:e.normalizeStyle(l.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,c=>(e.openBlock(),e.createBlock(Vn,e.mergeProps({key:c.name},{ref_for:!0},c,{item:c,modelValue:s.value[c.name],"onUpdate:modelValue":h=>s.value[c.name]=h,style:l.style,error:e.unref(a)?.errors?.[c.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),Wo=["aria-expanded","data-focus"],Zo={class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full"},Jo={key:0,class:"flex flex-nowrap items-center gap-1 overflow-x-auto overflow-y-hidden min-w-0 flex-1 py-0.5"},Xo={class:"flex items-center min-w-0"},Qo=["title"],er=["innerHTML"],tr=["onClick"],nr={class:"flex-1 min-w-[2px]"},lr=["placeholder"],ar=["title"],or=["innerHTML"],rr={key:2,class:"flex-1 min-w-[2px]"},sr=["placeholder"],ir={class:"flex items-center shrink-0"},dr=["disabled"],cr=["disabled","title"],ur=["aria-disabled","onClick"],pr=["innerHTML"],mr={key:1,class:"px-3 py-2 text-center text-gray-500"},hr=["disabled"],Ft=e.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:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{},maxlength:{},minlength:{}},emits:["change","update:modelValue","value-selected"],setup(l,{emit:t}){const n=l,a=t,o=e.computed(()=>n.multiple),r=e.computed(()=>n.disabled);he(n.style);const s=e.computed({get:()=>n.modelValue,set:v=>a("update:modelValue",v)});!s.value&&n.defaultValue&&(s.value=n.defaultValue);const i=e.ref(null),d=e.ref(null),c=e.ref(null),h=e.ref(null),y=e.ref(!1),_=e.ref(!1),b=e.ref(null),B=e.ref([]),g=e.ref(-1),k=e.ref([]),w=e.ref(""),u=e.ref(null),x=e.ref("bottom"),f=e.ref({}),V=e.ref([]),M=e.computed(()=>{if(!V.value.length)return[];const v=B.value,C=new Map(v.map($=>[$.id?.toString(),$]));return V.value.map($=>C.get($?.toString())).filter($=>!!$)}),A=e.computed(()=>n.placeholder||"Select..."),j=e.computed(()=>H(b.value));e.computed(()=>o.value?!V.value.length&&w.value==="":!j.value&&w.value==="");const P=e.computed(()=>r.value?!1:o.value?V.value.length>0:!!s.value),G=v=>o.value?V.value.some(C=>C?.toString()===v?.toString()):s.value?.toString()===v?.toString(),D=e.computed(()=>{let v=B.value??[];if(!n.data&&w.value.trim()!==""){const C=w.value.toLowerCase();v=v.filter($=>{const W=H($).toLowerCase(),m=$.text?.toLowerCase?.()||"";return W.includes(C)||m.includes(C)})}if(o.value&&V.value.length){const C=new Set(V.value.map($=>$?.toString()));v=v.filter($=>!C.has($.id?.toString()))}return v}),te=e.inject("values"),K=/\{\{\s*([^}]+?)\s*\}\}/g,le=v=>(v?String(v):"").replace(/<[^>]*>/g,"").trim(),R=e.computed(()=>n.slot??n?.optionTemplate??""),S=v=>{if(!v)return"";const C=R.value;return C?C.replace(K,($,W)=>{const m=W.trim(),p=v[m];return p!=null?String(p):""}):v.text??""},H=v=>{if(!v)return"";if(!R.value)return v.text??"";const $=S(v);return le($)||v.text||""},z=v=>{n.set&&te?.value&&Object.entries(n.set).forEach(([C,$])=>{if(!C)return;const W=v?v[$]:null;te.value[C]=W??null})},ae=e.computed(()=>n.parent?te?.value?.[n.parent]?.toString()??null:null),re=async v=>{if(!n.data){let C=n.options??[];if(v?.trim()){const $=v.toLowerCase();C=C.filter(W=>{const m=H(W).toLowerCase(),p=W.text?.toLowerCase?.()||"";return m.includes($)||p.includes($)})}return C}try{const C=n.host??"",$=n.prefix??"api",W=n.api??`/${$}/suggest/${n.data}`,m=`${C}${W}`,p=new URLSearchParams;return p.set("json","1"),v&&p.set("key",v),ae.value!==void 0&&ae.value!==null&&ae.value!==""&&p.set("parent",ae.value),(await fetch(`${m}?${p.toString()}`).then(N=>N.json()))?.data??[]}catch{return[]}},xe=async()=>{n.data?B.value=await re(w.value):B.value=n.options?[...n.options]:[]},F=async v=>{if(v==null)return null;const C=B.value?.find($=>$?.id?.toString()===String(v));if(C)return C;if(n.data)try{const $=n.host??"",W=n.prefix??"api",m=n.api??`/${W}/suggest/${n.data}`,p=`${$}${m}`,E=new URLSearchParams;return E.set("json","1"),E.set("val",String(v)),ae.value!==void 0&&ae.value!==null&&ae.value!==""&&E.set("parent",ae.value),((await fetch(`${p}?${E.toString()}`).then(U=>U.json()))?.data??[])?.[0]??null}catch{return null}return null},L=async v=>{const C=new Set(B.value.map(W=>W.id?.toString())),$=v.filter(W=>!C.has(W?.toString()));$.length&&await $.reduce(async(W,m)=>{await W;const p=await F(m);p&&B.value.push(p)},Promise.resolve())},T=async()=>{r.value||(y.value=!0,await xe(),await e.nextTick(()=>{be(),u.value?.focus(),D.value.length?g.value=0:g.value=-1}))},I=()=>{y.value=!1,g.value=-1},Z=async v=>{if(r.value)return;!y.value?await T():I()},oe=async()=>{y.value?u.value?.focus():await T()},me=()=>{o.value?(V.value=[],s.value=[],a("change",[]),ye(null,[])):(b.value=null,s.value=null,a("change",null),ye(null,null)),z(null),w.value="",e.nextTick(()=>u.value?.focus())},ge=v=>{o.value&&(V.value=V.value.filter(C=>C?.toString()!==v?.toString()),s.value=[...V.value],a("change",s.value),ye(null),e.nextTick(()=>u.value?.focus()))},ye=(v,C)=>{const $=C??(o.value?[...V.value]:v?.id??null);a("value-selected",{name:n.name,value:$,option:v})},Ne=v=>{o.value?(G(v.id)||(V.value=[...V.value,v.id],s.value=[...V.value],a("change",s.value),ye(v)),w.value="",e.nextTick(()=>{u.value?.focus(),g.value=Math.min(g.value,D.value.length-1)}),z(null)):(b.value=v,s.value=v.id,a("change",s.value),ye(v),w.value="",I(),z(v))},Gt=v=>{G(v.id)||Ne(v)},He=(v,C)=>{if(!v||!C)return;const $=v.offsetTop,W=$+v.offsetHeight,m=C.scrollTop,p=m+C.clientHeight;let E=C.scrollTop;$<m?E=$-80:W>p&&(E=W-C.clientHeight+4);const N=C;N.scrollTop=E},tt=v=>{let C=v.parentElement;for(;C;){if(C.classList.contains("ui-dialog__content"))return C;const $=window.getComputedStyle(C),W=$.overflow+$.overflowY+$.overflowX;if(W.includes("auto")||W.includes("scroll")||C===document.body||C===document.documentElement)return C;C=C.parentElement}return document.body},be=()=>{if(!d.value)return;const v=d.value.getBoundingClientRect(),C=window.innerHeight||document.documentElement.clientHeight,$=window.innerWidth||document.documentElement.clientWidth,W=8,m=8,p=n.maxHeight||300,E=C-v.bottom-m-W,N=v.top-m-W,O=E>=N,U=Math.max($-W*2,0);let{width:ee}=v;U>0&&ee>U&&(ee=U);let{left:X}=v;X+ee+W>$&&(X=$-ee-W),X=Math.max(X,W);const ie=Math.min(p,Math.max(O?E:N,50));x.value=O?"bottom":"top",f.value={position:"fixed",left:`${X}px`,width:`${ee}px`,maxHeight:`${ie}px`,transform:O?"none":"translateY(-100%)",top:O?`${v.bottom+m}px`:`${v.top-m}px`}},bt=async v=>{r.value||!y.value&&(v.key==="ArrowDown"||v.key==="ArrowUp")&&(v.preventDefault(),await T())},qe=v=>{if(!y.value)return;const{key:C}=v;if(C==="ArrowDown")v.preventDefault(),g.value+1<D.value.length&&(g.value+=1,He(k.value[g.value],c.value));else if(C==="ArrowUp")v.preventDefault(),g.value>0&&(g.value-=1,He(k.value[g.value],c.value));else if(C==="Enter"){v.preventDefault();const $=D.value[g.value];$&&Ne($),u.value?.blur()}else C==="Escape"?(v.preventDefault(),I()):C==="Backspace"?o.value&&w.value===""&&V.value.length&&(V.value=V.value.slice(0,-1),s.value=[...V.value],a("change",s.value)):C==="Home"?(g.value=0,He(k.value[0],c.value)):C==="End"?(g.value=D.value.length-1,He(k.value[g.value],c.value)):C==="Tab"&&I()},wt=()=>{r.value||(_.value=!0)},Te=()=>{_.value=!1,w.value=""},Ie=v=>{v.key==="Escape"&&y.value&&I()},xt=v=>{const C=v.target;i.value?.contains(C)||h.value?.contains(C)||I()},_t=v=>{y.value&&c.value&&!c.value.contains(v.target)&&be()},nt=()=>{y.value&&be()},Et=()=>{y.value&&be()};e.watch(()=>n.options,v=>{v?.length&&(B.value=[...v],ve())},{immediate:!0});async function ve(){if(o.value)Array.isArray(s.value)?V.value=[...s.value]:(V.value=s.value==null?[]:[s.value],s.value=[...V.value]),n.data&&V.value.length&&(await L(V.value),await e.nextTick());else{if(Array.isArray(s.value)){const v=s.value[0]??null;s.value=v??null}s.value!=null&&(b.value=await F(s.value)),z(b.value??null)}}e.watch(s,()=>{ve()}),e.onMounted(async()=>{addEventListener("keydown",Ie),addEventListener("scroll",_t,!0),addEventListener("resize",nt),document.addEventListener("click",xt,!0),d.value&&tt(d.value).addEventListener("scroll",Et,!0),n.options?.length&&!n.data?B.value=[...n.options]:n.data&&(B.value=await re("")),await ve(),vt.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",Ie),removeEventListener("scroll",_t,!0),removeEventListener("resize",nt),document.removeEventListener("click",xt,!0),d.value&&tt(d.value).removeEventListener("scroll",Et,!0)});const Oe=e.ref(!1),Me=e.ref({}),Se=e.ref([]),Re=e.ref(null);async function Kt(){if(!n.add?.token||Re?.value.validate())return;const C=n.add.api??`/api/table/${n.add.token}`,{id:$}=await fetch(C,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Me.value)}).then(W=>W.json());if(!n.options?.length&&n.data){const W=await fetch(`${n.api??`/api/suggest/${n.data}`}?val=${$}`).then(m=>m.json());b.value=W[0],B.value.push(W[0]),s.value=$}Oe.value=!1,se.notify({title:"Success!",message:"Object created."})}async function Yt(){if(!n.add)return null;const v=await fetch(`/api/template/form/${n.add.form}`).then(C=>C.json());return Se.value=v.schema,Oe.value=!0,null}function Vt(v,C=200){let $;return(...W)=>{$&&clearTimeout($),$=window.setTimeout(()=>v(...W),C)}}const Wt=Vt(async v=>{B.value=await re(v)},200);e.watch(w,v=>{n.data&&Wt(v.trim())}),e.watch(()=>n.options,v=>{!n.data&&v?.length&&(B.value=[...v],ve())},{immediate:!0}),e.watch(()=>n.parent??n.parentValue,()=>{n.data&&xe()});const vt=e.ref(!0);return e.watch(ae,async()=>{if(n.data&&(vt.value||(o.value?(V.value=[],s.value=[],a("change",[])):(b.value=null,s.value=null,a("change",null))),await xe(),n.auto===1&&ae.value&&B.value.length>0)){const v=B.value[0];v&&Ne(v)}}),(v,C)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(se.VsModal),{visible:Oe.value,"onUpdate:visible":C[1]||(C[1]=$=>Oe.value=$),class:"z-[1000]",title:"Додати",buttonText:"Додати",onDone:Kt,teleport:v.teleport},{default:e.withCtx(()=>[e.createVNode(Ce,{schema:Se.value,modelValue:Me.value,"onUpdate:modelValue":C[0]||(C[0]=$=>Me.value=$),ref_key:"addForm",ref:Re},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:C[5]||(C[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass])},[C[10]||(C[10]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),C[11]||(C[11]=e.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-[#b3d4ff]",y.value||_.value?"border-[#2684ff] ring-1 ring-[#2684ff]":"",r.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":y.value,"aria-haspopup":"listbox",onKeydown:bt,onClick:oe,"data-focus":y.value||_.value?"true":"false",ref_key:"triggerRef",ref:d},[e.createElementVNode("div",Zo,[o.value?(e.openBlock(),e.createElementBlock("div",Jo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,$=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[rgb(230,230,230)] rounded-[2px] m-[2px] box-border max-w-full",key:$.id},[e.createElementVNode("div",Xo,[$?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:e.normalizeStyle({backgroundColor:$?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"truncate text-[#172b4d] overflow-hidden max-w-[200px] px-0.5 pl-1.5",title:H($)},[R.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:S($)},null,8,er)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString($.text),1)],64))],8,Qo)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border text-[#172b4d] hover:bg-[rgb(255,189,173)] hover:text-[rgb(222,53,11)] flex-shrink-0",onClick:e.withModifiers(W=>ge($.id),["stop"])},C[6]||(C[6]=[e.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"},[e.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,tr)]))),128)),e.createElementVNode("div",nr,[!r.value&&v.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:u,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:V.value.length?" ":A.value,"onUpdate:modelValue":C[2]||(C[2]=$=>w.value=$),onFocus:wt,onBlur:Te,onKeydown:qe},null,40,lr)),[[e.vModelText,w.value]]):e.createCommentVNode("",!0)])])):!o.value&&!_.value&&j.value&&w.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900"]),title:j.value},[b.value?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:e.normalizeStyle({backgroundColor:b.value?.color})},null,4)):e.createCommentVNode("",!0),R.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass({"pl-5":b.value?.color}),innerHTML:S(b.value)},null,10,or)):(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass({"pl-5":b.value?.color})},e.toDisplayString(b.value?.text),3))],8,ar)):e.createCommentVNode("",!0),o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",rr,[!r.value&&v.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:u,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:j.value?" ":A.value,"onUpdate:modelValue":C[3]||(C[3]=$=>w.value=$),onFocus:wt,onBlur:Te,onKeydown:qe},null,40,sr)),[[e.vModelText,w.value]]):e.createCommentVNode("",!0)]))]),e.createElementVNode("div",ir,[P.value?(e.openBlock(),e.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:e.withModifiers(me,["stop"])},C[7]||(C[7]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.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)):e.createCommentVNode("",!0),C[9]||(C[9]=e.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),e.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:C[4]||(C[4]=e.withModifiers($=>Z(),["stop"])),title:y.value?"Закрити список":"Відкрити список"},C[8]||(C[8]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.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,cr)])],42,Wo),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[y.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:h,class:e.normalizeClass(["fixed z-[3000] rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]"]),style:e.normalizeStyle(f.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:f.value.maxHeight||"300px"}),ref_key:"listRef",ref:c},[D.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(D.value,($,W)=>(e.openBlock(),e.createElementBlock("div",{key:$.id,ref_for:!0,ref:m=>k.value[W]=m,class:e.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900",G($.id)?"bg-[#2684ff] text-white":"bg-white hover:bg-[#deebff] hover:text-[#172b4d]",g.value===W&&!G($.id)?"bg-[#deebff] text-[#172b4d]":""]),"aria-disabled":G($.id)?"true":"false",role:"option",tabindex:"-1",onClick:m=>Gt($)},[$?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:e.normalizeStyle({backgroundColor:$?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",g.value===$.id?"text-white":"",(g.value===W,"")])},[R.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:S($)},null,8,pr)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString($.text),1)],64))],2)],10,ur))),128)):(e.openBlock(),e.createElementBlock("div",mr," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),n.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:Yt,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"},[e.createVNode(Be,{width:"16",height:"16"}),C[12]||(C[12]=e.createElementVNode("span",null,"Додати",-1))],8,hr)):e.createCommentVNode("",!0)],512)],64))}}),fr=["placeholder","disabled"],dn=e.defineComponent({__name:"vs-input-textarea",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=he(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??"");function s(){typeof a.value=="string"&&(a.value=a.value.trim())}return(i,d)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":d[0]||(d[0]=c=>a.value=c),placeholder:r.value,disabled:o.value,row:"2",onBlur:s,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,42,fr)),[[e.vModelText,a.value]])}}),gr={},yr={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 kr(l,t){return e.openBlock(),e.createElementBlock("svg",yr,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),e.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const br=Y(gr,[["render",kr]]),wr={},xr={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 _r(l,t){return e.openBlock(),e.createElementBlock("svg",xr,t[0]||(t[0]=[e.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),e.createElementVNode("path",{d:"M7 20V4"},null,-1),e.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),e.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const Er=Y(wr,[["render",_r]]),Vr={},vr={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 Br(l,t){return e.openBlock(),e.createElementBlock("svg",vr,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Cr=Y(Vr,[["render",Br]]),Nr={},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"};function Sr(l,t){return e.openBlock(),e.createElementBlock("svg",Mr,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const $r=Y(Nr,[["render",Sr]]),Dr={},Ar={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 Fr(l,t){return e.openBlock(),e.createElementBlock("svg",Ar,t[0]||(t[0]=[e.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 cn=Y(Dr,[["render",Fr]]),Lr={},Tr={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Ir(l,t){return e.openBlock(),e.createElementBlock("svg",Tr,t[0]||(t[0]=[e.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 Or=Y(Lr,[["render",Ir]]),Rr={},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(l,t){return e.openBlock(),e.createElementBlock("svg",zr,t[0]||(t[0]=[e.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 Pr=Y(Rr,[["render",jr]]),Ur={class:"vs-datatable border rounded-xl w-full flex-grow"},Hr={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},qr={class:"relative w-full"},Gr={class:"table-wrapper flex gap-2"},Kr={class:"vs-popover inline-block text-slate-700"},Yr={class:"text-center"},Wr={class:""},Zr={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"},Jr={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},Xr={class:"text-sm items-center text-gray-800 flex gap-1"},Qr={class:"w-full overflow-x-auto"},es={class:"w-full table-auto caption-bottom text-sm"},ts={class:"[&_tr]:border-b"},ns={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"},ls={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"},as={key:0,colspan:"100%",class:"text-center"},os={class:"w-full"},rs={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},ss=["onDragstart","onDragover","onDrop"],is={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},ds={class:"flex items-center justify-center"},cs={key:0,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"},us={key:0},ps=["src"],ms={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},hs=["innerHTML"],fs={key:2,class:"line-clamp-2 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"},gs={key:3,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"},ys={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},ks={class:"flex items-center justify-center gap-2"},bs=["onClick"],ws=["onClick"],xs={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},un=e.defineComponent({__name:"vs-input-datatable",props:e.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref({}),o=e.ref(""),r=e.computed(()=>{if(!o.value)return n.value??[];const L=o.value.toLowerCase();return n.value.filter(T=>t.colModel?.some(I=>{const Z=T[I.key];return Z?Array.isArray(Z)?Z.join(", ").toLowerCase().includes(L):String(Z).toLowerCase().includes(L):!1}))}),s=e.ref(null),i=e.ref(null),d=e.ref(!1),c=e.ref(null),h=e.ref({top:0,left:0}),y=L=>{s.value=L},_=L=>{i.value=L},b=L=>{if(s.value===null||s.value===L){s.value=null,i.value=null;return}const T=[...n.value],[I]=T.splice(s.value,1);T.splice(L,0,I),n.value=T,s.value=null,i.value=null},B=L=>{const I=L.currentTarget.getBoundingClientRect();h.value={top:I.bottom+window.scrollY,left:I.left+window.scrollX},d.value=!d.value},g=()=>{c.value&&c.value.click()},k=L=>{const T=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],I=L.toLowerCase();return T.some(Z=>I.endsWith(Z))},w=L=>{const I=L.target.files?.[0];if(!I)return;const Z=new FileReader;Z.onload=oe=>{try{const me=oe.target?.result;if(typeof me=="string"){const ge=JSON.parse(me);Array.isArray(ge)&&n.value.push(...ge)}}catch(me){console.error("Error parsing file:",me)}},Z.readAsText(I)},u=()=>{const L=JSON.stringify(n.value,null,2),T=new Blob([L],{type:"application/json"}),I=URL.createObjectURL(T),Z=document.createElement("a");Z.href=I,Z.download="data.json",Z.click(),URL.revokeObjectURL(I)},x=new Set(["autocomplete","select","radio","checkbox","combobox"]),f=new Map,V=(L,T)=>{const I=`/api/suggest/${L}`,Z=I.includes("?")?"&":"?",oe=T?`&val=${T}`:"";return`${I}${Z}json=1${oe}`},M=L=>L==null||L===""?null:typeof L=="object"?L?.id!==void 0&&L.id!==null&&L.id!==""?L.id:null:L,A=L=>{const T=new Set;return Array.isArray(n.value)&&n.value.forEach(I=>{const Z=I?.[L];if(Z==null||Z==="")return;if(Array.isArray(Z)){Z.forEach(me=>{const ge=M(me);ge!==null&&T.add(ge)});return}const oe=M(Z);oe!==null&&T.add(oe)}),T},j=async()=>{if(!t.colModel?.length)return;const L=t.colModel.filter(T=>T.data&&x.has(T.type?.toLowerCase()||""));L.length&&await Promise.all(L.map(async T=>{const I=T.key||T.name;if(!I)return;const Z=A(I),oe=Array.from(Z).map(ye=>String(ye)).sort(),me=oe.join(",");if(!oe.length||f.get(I)===me)return;f.set(I,me);const ge=oe.map(encodeURIComponent).join(",");try{const Ne=await(await fetch(V(T.data,ge))).json();a.value[I]=Ne?.data??Ne}catch(ye){console.error("Failed to fetch column values",ye)}}))};e.watch([()=>t.colModel,()=>n.value],()=>{j()},{immediate:!0,deep:!0});const P=e.ref(""),G=e.ref(!1);let D="edit",te=0;const K=e.ref({}),le=e.ref({});async function R(){P.value="Додати",G.value=!0,D="add",K.value={}}function S(L,T){if(!L?.length)return null;const I=typeof T=="object"?T?.id:T;return I==null||I===""?null:L.find(Z=>Z?.id?.toString()===I.toString())?.text??null}function H(L){return L==null||L===""?"-":Array.isArray(L)?L.map(T=>typeof T=="object"?T?.text??T?.id??"-":T).join(", "):typeof L=="object"?L?.text??L?.id??"-":L}function z(L,T){const I=T.key||T.name,Z=L?.[I],oe=a.value[I];if(!Z)return"-";if(Array.isArray(Z)){const ge=Z.map(ye=>S(oe,ye)).filter(Boolean);return ge.length?ge.join(", "):H(Z)}const me=S(oe,Z);return me||H(Z)}async function ae(L,T){P.value="Редагувати",G.value=!0,D="edit",te=T,K.value={...L}}function re(){const L=le.value.validate();if(L){se.notify({type:"warning",title:"Помилка валідації",message:Object.entries(L).map(([T,I])=>`${T}: ${I}`).join(`
2
+ `)});return}D==="add"?Array.isArray(n.value)?n.value=[...n.value,K.value]:n.value=[K.value]:n.value=n.value.map((T,I)=>I===te?K.value:T),G.value=!1}function xe(L){n.value=n.value.filter((T,I)=>I!==L)}function F(){G.value=!1}return(L,T)=>(e.openBlock(),e.createElementBlock("div",Ur,[e.createElementVNode("div",Hr,[e.createElementVNode("div",qr,[e.createVNode(br,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":T[0]||(T[0]=I=>o.value=I),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),[[e.vModelText,o.value]])]),e.createElementVNode("div",Gr,[e.createElementVNode("input",{ref_key:"fileInput",ref:c,onChange:w,class:"hidden",accept:".json",type:"file"},null,544),e.createElementVNode("div",Kr,[e.createElementVNode("div",Yr,[e.createElementVNode("div",Wr,[e.createElementVNode("button",{onClick:B,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"},[e.createVNode(Er,{height:"16",width:"16"})])])])])]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[d.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:e.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:h.value.top+"px",left:h.value.left+"px"}])},[e.createElementVNode("div",Zr,[e.createElementVNode("div",Jr,[e.createElementVNode("button",{onClick:g,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createVNode(Cr,{class:"text-black",width:"14",height:"14"}),T[4]||(T[4]=e.createTextVNode(" Імпортувати ",-1))]),e.createElementVNode("button",{onClick:u,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createElementVNode("span",Xr,[e.createVNode($r,{class:"text-black",width:"14",height:"14"}),T[5]||(T[5]=e.createTextVNode(" Експортувати ",-1))])])])])],4)):e.createCommentVNode("",!0)])),e.createElementVNode("button",{onClick:R,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"},[e.createVNode(Be),T[6]||(T[6]=e.createTextVNode(" Додати ",-1))])]),e.createElementVNode("div",Qr,[e.createElementVNode("table",es,[e.createElementVNode("thead",ts,[e.createElementVNode("tr",ns,[e.createElementVNode("th",ls,[e.createVNode(cn,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(L.colModel,I=>(e.openBlock(),e.createElementBlock("th",{key:I.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]"},e.toDisplayString(I.ua||I.label),1))),128)),T[7]||(T[7]=e.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))])]),e.createElementVNode("tbody",{class:e.normalizeClass({"[&_tr:last-child]:border-0":!i.value})},[r.value.length===0?(e.openBlock(),e.createElementBlock("td",as,[e.createElementVNode("div",os,[e.createElementVNode("div",rs,[e.createVNode(Or,{class:"w-48 mx-auto"}),T[8]||(T[8]=e.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[e.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),e.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(I,Z)=>(e.openBlock(),e.createElementBlock("tr",{key:I.id,class:e.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":s.value===Z,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":i.value===Z}]),draggable:"true",onDragstart:oe=>y(Z),onDragover:e.withModifiers(oe=>_(Z),["prevent"]),onDrop:oe=>b(Z)},[e.createElementVNode("td",is,[e.createElementVNode("div",ds,[e.createVNode(cn,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(L.colModel,oe=>(e.openBlock(),e.createElementBlock("td",{key:oe.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[oe.type==="file"?(e.openBlock(),e.createElementBlock("div",cs,[k(z(I,oe))?(e.openBlock(),e.createElementBlock("div",us,[e.createElementVNode("img",{src:z(I,oe),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,ps)])):(e.openBlock(),e.createElementBlock("div",ms,[e.createVNode(tn,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):oe.type==="tiptap-editor"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"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 line-clamp-3",innerHTML:z(I,oe)},null,8,hs)):oe.type==="reference"?(e.openBlock(),e.createElementBlock("div",fs,e.toDisplayString(z(I,oe)),1)):(e.openBlock(),e.createElementBlock("div",gs,e.toDisplayString(z(I,oe)),1))]))),128)),e.createElementVNode("td",ys,[e.createElementVNode("div",ks,[e.createElementVNode("button",{onClick:oe=>ae(I,Z),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"},[e.createVNode(Pr,{width:"24",height:"24",class:"w-3 h-3"})],8,bs),e.createElementVNode("button",{onClick:oe=>xe(Z),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"},[e.createVNode(je,{width:"24",height:"24",class:"w-3 h-3"})],8,ws)])])],42,ss))),128))],2)])]),e.createVNode(e.unref(se.VsModal),{visible:G.value,title:P.value,size:"lg",onClose:F},{default:e.withCtx(()=>[e.createVNode(Ce,{schema:t.colModel,values:K.value,"onUpdate:values":T[1]||(T[1]=I=>K.value=I),form:le.value,"onUpdate:form":T[2]||(T[2]=I=>le.value=I)},null,8,["schema","values","form"]),e.createElementVNode("div",xs,[e.createElementVNode("button",{type:"button",onClick:T[3]||(T[3]=I=>G.value=!1),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"}," Скасувати "),e.createElementVNode("button",{onClick:re,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"}," Зберегти ")])]),_:1},8,["visible","title"])]))}}),_s={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:"Клацніть на шари, щоб видалити їх"}}}}},Es={},Vs={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 vs(l,t){return e.openBlock(),e.createElementBlock("svg",Vs,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),e.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 Bs=Y(Es,[["render",vs]]),Cs={},Ns={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 Ms(l,t){return e.openBlock(),e.createElementBlock("svg",Ns,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const Ss=Y(Cs,[["render",Ms]]),$s={},Ds={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 As(l,t){return e.openBlock(),e.createElementBlock("svg",Ds,t[0]||(t[0]=[e.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 Fs=Y($s,[["render",As]]),Ls={},Ts={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 Is(l,t){return e.openBlock(),e.createElementBlock("svg",Ts,t[0]||(t[0]=[e.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 Os=Y(Ls,[["render",Is]]),Rs={},zs={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 js(l,t){return e.openBlock(),e.createElementBlock("svg",zs,t[0]||(t[0]=[e.createElementVNode("title",null,null,-1),e.createElementVNode("desc",null,null,-1),e.createElementVNode("defs",null,null,-1),e.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[e.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[e.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[e.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 Ps=Y(Rs,[["render",js]]),Us={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},Hs={key:0,class:"vs-select__options absolute z-50 mt-1 w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm"},qs=["onClick"],Gs={class:"relative flex-1 min-w-[140px]"},Ks=["placeholder"],Ys="https://data.softpro.ua/api-user/gis-url-proxy",Ws="https://geo.rv.ua/api-user/dzk.api",Zs=Y(e.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(l,{emit:t}){const n=l,a=t,o=["here","xy","parcel"],r=e.computed(()=>{const f=n.config?.tools?.filter(V=>o.includes(V));return f&&f.length?f:o}),s=e.computed(()=>n.config?.placeholder?.trim()||"Пошук…"),i=e.ref(r.value[0]??o[0]);e.watch(r,f=>{f.includes(i.value)||(i.value=f[0])});const d=e.ref(""),c=e.ref(!1),h=e.ref(null);e.watch(i,()=>{d.value="",c.value=!1});function y(f){i.value=f}function _(f){if(!c.value)return;const V=h.value;V&&!V.contains(f.target)&&(c.value=!1)}e.onMounted(()=>{window.addEventListener("click",_,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",_,!0)});function b(f){return f==="xy"?"Координати":f==="parcel"?"Кадастр":"Адреси"}function B(f){const V=f.replace(/[,]+/g," ").trim();if(!V)return null;const M=V.split(/\s+/).filter(Boolean);if(M.length<2)return null;const A=M.slice(0,2).map(Number);if(!A.every(le=>Number.isFinite(le)))return null;let[j,P]=A,G=j,D=P;const te=le=>Math.abs(le)<=90,K=le=>Math.abs(le)<=180;if(!te(G)||!K(D))if(te(D)&&K(G))G=P,D=j;else return null;return{lat:G,lng:D}}function g(f){return(f?.items||[]).map((M,A)=>({id:String(M?.id??A),title:M?.title||M?.address?.label||"Знайдений обʼєкт",lat:Number(M?.position?.lat),lng:Number(M?.position?.lng)})).filter(M=>Number.isFinite(M.lat)&&Number.isFinite(M.lng))}function k(f){const V=f?.result||f?.data||f;if(!V)return[];const M=V.geom_centroid;if(!M||!Array.isArray(M.coordinates))return[];const[A,j]=M.coordinates;return!Number.isFinite(j)||!Number.isFinite(A)?[]:[{id:"parcel",title:V.cadnum||V.cad_num||"Земельна ділянка",lat:j,lng:A}]}function w(f){const M=f.replace(/\s+/g,"").split(":");if(M.length!==4)return!1;const A=[10,2,3,4];return M.every((j,P)=>j.length===A[P]&&/^\d+$/.test(j))}function u(f){a("goToCoordinates",[f.lat,f.lng])}async function x(){const f=d.value.trim();if(f){if(i.value==="xy"){const V=B(f);if(!V){se.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}u(V),d.value="";return}try{const V=new URL(i.value==="here"?Ys:Ws);if(i.value==="here")V.searchParams.set("searchtext",f);else{if(!w(f)){se.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}V.searchParams.set("cad_num",f)}const M=await fetch(V.toString());if(!M.ok)throw new Error(`HTTP ${M.status}`);const A=await M.json(),j=i.value==="here"?g(A):k(A);if(!j.length)se.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const P=j[0];u(P),d.value=""}}catch(V){const M=V?.message||"Помилка пошуку";se.notify({type:"error",title:"Пошук",message:M})}}}return(f,V)=>(e.openBlock(),e.createElementBlock("div",Us,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(x,["prevent"])},[r.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:h,class:"relative search-type w-[140px]"},[e.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:V[0]||(V[0]=M=>c.value=!c.value)},[e.createElementVNode("span",null,e.toDisplayString(b(i.value)),1),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":c.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},V[2]||(V[2]=[e.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2))]),c.value?(e.openBlock(),e.createElementBlock("div",Hs,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,M=>(e.openBlock(),e.createElementBlock("li",{key:M,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:A=>y(M)},e.toDisplayString(b(M)),9,qs))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",Gs,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":V[1]||(V[1]=M=>d.value=M),placeholder:s.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,Ks),[[e.vModelText,d.value,void 0,{trim:!0}]]),V[3]||(V[3]=e.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),[["__scopeId","data-v-3048520a"]]),Js={class:"bg-white/30 p-1 rounded-md shadow w-fit"},Xs={class:"flex gap-2"},Qs=["onClick","title"],ei=["src"],ti=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(l,{emit:t}){const n=l,a=e.ref(Object.keys(n.basemaps)[0]),o=t;function r(s){o("onLayerChange",s),a.value=s}return(s,i)=>(e.openBlock(),e.createElementBlock("div",Js,[e.createElementVNode("div",Xs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.basemaps,(d,c)=>(e.openBlock(),e.createElementBlock("div",{key:c,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":a.value===c}]),onClick:h=>r(c),title:d.name||c,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:d.preview,alt:"",class:"w-10 h-10 object-cover"},null,8,ei)],10,Qs))),128))])]))}});function Ge(l){return l?l.type==="Polygon"?{type:"MultiPolygon",coordinates:[l.coordinates]}:l.type==="Feature"?{...l,geometry:Ge(l.geometry)}:l.type==="FeatureCollection"?{...l,features:(l.features||[]).map(t=>Ge(t)).filter(Boolean)}:l:null}function ni(l){return l?l.type==="FeatureCollection"||l.type==="Feature"?Ge(l):l.geom?{type:"Feature",geometry:Ge({type:l.geom.type,coordinates:l.geom.coordinates}),properties:{}}:l.type&&l.coordinates?{type:"Feature",geometry:Ge(l),properties:{}}:null:null}const li={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},ai={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},oi={class:"text-sm font-medium"},ri={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},si={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},ii={class:"flex items-center gap-1"},di=["disabled"],ci=["disabled"],ui=["disabled"],pi={class:"bg-white/95 border border-gray-200 rounded-md shadow-xl px-3 py-2 max-w-[240px] text-[11px] sm:text-xs text-gray-900"},mi={class:"space-y-0.5"},hi={class:"text-gray-500"},fi={class:"text-gray-900 text-right break-all"},gi={class:"absolute top-4 right-4 z-[1000]"},yi={class:"flex flex-col gap-[2px]"},ki=["disabled"],bi=["disabled"],wi=["disabled"],xi=["disabled"],_i={class:"flex flex-col gap-2"},Ei={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},Vi={class:"flex flex-col gap-1"},vi=["checked","disabled","onChange"],Bi={class:"text-gray-700 text-xs font-medium"},Ci={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"},Ni={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},Mi={class:"shrink-0"},Si={class:"font-bold"},$i={class:"flex items-center"},Di={class:"text-xs mr-2"},Ai={key:0,class:"text-xs"},Fi={key:1,class:"text-xs"},Li=["disabled"],Ti=["disabled"],rt="vs-base-tile-pane",st="vs-overlay-tile-pane",pn=Y(e.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},ctrlZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},katottg:{default:""},layers:{default:()=>[]},bounds:{},api:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const a=e.getCurrentInstance()?.appContext?.config?.globalProperties?.$settings??{},o=Array.isArray(a.center)&&a.center.length===2?a.center:[50,30],r=typeof a.zoom=="number"?a.zoom:typeof a.defaultZoom=="number"?a.defaultZoom:10,s=l,i=t,d=e.computed(()=>!!s.disabled),c=e.ref(!1),h=e.ref(null),y=e.ref(!1),_=e.ref(""),b=e.ref(null),B=e.ref(null),g=e.ref(!1),k=e.ref(null),w=e.ref(null),u=e.ref(0),x=e.ref(o),f=e.ref(r),V=e.ref([]),M=e.ref(s.modelValue);let A=!1;const j=e.ref(null),P=e.computed(()=>{const m={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!s.tools?.length)return{...m,point:!0,line:!0,polygon:!0,rectangle:!0};const p=new Set(s.tools.map(E=>E.toLowerCase()));return{search:p.has("search"),import:p.has("import"),export:p.has("export"),point:p.has("point"),line:p.has("line"),polygon:p.has("polygon"),rectangle:p.has("rectangle")}}),G=e.reactive({}),D=e.ref([]),te=e.computed(()=>D.value.map(m=>G[m]).filter(Boolean)),K=e.ref(null),le=e.computed(()=>K.value?.entries??[]),R=e.computed(()=>{if(!K.value)return;const m=12,p=K.value.point.x+m,E=K.value.point.y+m;return{left:`${p}px`,top:`${E}px`}});function S(m){if(typeof m!="string"||!m.trim())return"";if(/^https?:\/\//i.test(m))return m;const p=window?.location?.origin??"",E=m.replace(/^\/+/,"");return E?p?`${p}/${E}`:`/${E}`:p}function H(){if(Array.isArray(a.basemaps)&&a.basemaps.length){const p=a.basemaps.map((E,N)=>{const O=String(E?.key??E?.id??E?.name??`b${N}`),U=S(String(E?.url??""));if(!U)return null;const ee=typeof E?.preview=="string"&&E.preview?S(E.preview):"";return[O,{...E,url:U,preview:ee}]}).filter(E=>Array.isArray(E)&&E.length===2).reduce((E,[N,O])=>(E[N]=O,E),{});if(Object.keys(p).length)return p}return{voyager:{name:"Оглядова карта",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:{name:"Ортофото 1:10K",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:{name:"Open Street Maps",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"}}}const z=H(),ae=Object.keys(z),re=e.ref(ae.length?ae[0]:"");let xe,F,L,T,I=null;async function Z(){const m=N=>{if(!Array.from(document.styleSheets).some(O=>O?.href?.includes(N))){const O=document.createElement("link");O.rel="stylesheet",O.href=N,document.head.appendChild(O)}},p=N=>new Promise((O,U)=>{if(Array.from(document.scripts).some(ie=>ie.src===N))return O();const X=document.createElement("script");X.src=N,X.async=!0,X.onload=()=>O(),X.onerror=ie=>U(ie),document.body.appendChild(X)});m("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),m("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css");try{await p("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js")}catch{}try{await p("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js")}catch{}try{await p("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js")}catch{}return window.L}function oe(){const m=navigator.platform.toUpperCase().includes("MAC");return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Використовуйте два пальці для зуму карти.":m?"Використовуйте Ctrl або ⌘ + прокрутка для зуму карти.":"Використовуйте Ctrl + прокрутка для зуму карти."}function me(){if(!s.handleZoom||!h.value||!F)return null;let m;const p=N=>{const O=N.ctrlKey||N.metaKey||N.shiftKey;if(!s.ctrlZoom){y.value=!1,F.scrollWheelZoom.enable();return}if(!O){y.value=!0,_.value=oe(),clearTimeout(m),m=window.setTimeout(()=>y.value=!1,1200);return}N.preventDefault(),N.stopPropagation(),y.value=!1,F.scrollWheelZoom.enable(),setTimeout(()=>F.scrollWheelZoom.disable(),120)},E=N=>{if(N.touches.length===1){if(!s.ctrlZoom)return;y.value=!0,_.value=oe(),clearTimeout(m),m=window.setTimeout(()=>y.value=!1,3e3)}else y.value=!1};return h.value.addEventListener("wheel",p,{passive:!1}),h.value.addEventListener("touchstart",E,{passive:!0}),F.on("wheel",N=>{if(!s.ctrlZoom)return;N.originalEvent?.ctrlKey||N.originalEvent?.metaKey||N.originalEvent?.shiftKey||(N.originalEvent?.preventDefault?.(),N.originalEvent?.stopPropagation?.())}),()=>{h.value?.removeEventListener("wheel",p),h.value?.removeEventListener("touchstart",E),clearTimeout(m)}}function ge(m,p){return m?.id?String(m.id):m?.url?`${m.url}-${p}`:`layer-${p}`}function ye(m){const p=(m?.url??"").trim();if(!p)return"";if(/^https?:\/\//i.test(p))return p;const E=window.location?.origin??"",N=p.replace(/^\/+/,"");return`${E}/${N}`}function Ne(m){const p=m?.style??{};return E=>{const N=p.colorAttr,O=p.colorSet??{},U=typeof N=="string"?O?.[E?.[N]]??p.color??"#3388ff":p.color??"#3388ff",ee=p.stroke??U;return{weight:p.width??1,color:ee,opacity:p.opacity??1,fill:p.type?p.type!=="polyline":!0,fillColor:U,fillOpacity:p.opacity??.5}}}function Gt(m){return m?.layer?.properties||m?.layer?.feature?.properties||m?.properties||{}}function He(m,p={}){return m.popup===!1?[]:Array.isArray(m.popup)&&m.popup.length?m.popup.map(E=>{if(!E?.field)return null;const N=p[E.field];return N==null||N===""?null:{key:E.label||E.field,value:String(N)}}).filter(E=>!!E):Object.entries(p).filter(([E])=>typeof E=="string"&&E).slice(0,5).map(([E,N])=>({key:E,value:N==null?"—":String(N)}))}function tt(m,p){if(!F||!p?.latlng)return;const E=F.latLngToContainerPoint(p.latlng),N=Gt(p),O=He(m,N);if(!O.length){be(m.id);return}K.value={layerId:m.id,title:N?.name||m.title||m.name,properties:N,entries:O,point:{x:E.x,y:E.y}}}function be(m){m&&K.value?.layerId!==m||(K.value=null)}function bt(m){const p=(m?.service??"").toLowerCase(),E=ye(m),N=m.sourceLayer||m.layer||m.service_layer||m.service_key||m.map_key||m.dataset?.layer||m.id||m.table_name;if(p==="vtile"){const O=j.value;if(O?.vectorGrid?.protobuf&&!O?.maplibreGL){const U=O.vectorGrid.protobuf(E,{interactive:!0,maxNativeZoom:m.maxzoom??19,vectorTileLayerStyles:{[N??"default"]:Ne(m),default:Ne(m)}});return U?.on?.("mouseover",ee=>tt(m,ee)),U?.on?.("mousemove",ee=>tt(m,ee)),U?.on?.("mouseout",()=>be(m.id)),U}if(O?.maplibreGL&&window?.maplibregl){const U=E;return U?O.maplibreGL({style:U,interactive:!1,pane:"overlayPane"}):null}return null}return p==="tile"||/^https?:\/\//i.test(E)||E.includes("{z}")?j.value.tileLayer(E,{opacity:m?.style?.opacity??1,pane:st}):j.value.tileLayer(E,{opacity:m?.style?.opacity??1,pane:st})}function qe(m){const p=j.value;if(!p)return null;const E=("bounds"in m?m.bounds:void 0)??s.bounds??V.value;if(!Array.isArray(E)||!E.length)return null;const O={color:m.style?.stroke??m.style?.color??"#2563eb",weight:m.style?.width??2,interactive:!1,opacity:m.style?.opacity??.8,dashArray:"4 4"},U=Array.isArray(m.bounds)&&m.bounds.length?m.bounds:E,ee=wt(U);if(!ee.length||!p?.polyline)return null;const X=ee.map(ie=>{if(!ie.length)return ie;const de=ie[0],$e=ie[ie.length-1];return de&&$e&&typeof $e.equals=="function"&&!$e.equals(de)?[...ie,de]:ie});return p.polyline(X,O)}function wt(m){const p=j.value;if(!p||!Array.isArray(m))return[];const E=O=>{if(!Array.isArray(O)||O.length<2)return null;const[U,ee]=O;return!Number.isFinite(Number(ee))||!Number.isFinite(Number(U))?null:p.latLng(Number(ee),Number(U))},N=O=>Array.isArray(O)&&O.length>=2&&O.every(U=>Number.isFinite(Number(U)));if(m.length&&N(m[0])){const O=m.map(E).filter(Boolean);return O.length?[O]:[]}return m.length&&Array.isArray(m[0])&&Array.isArray(m[0][0])&&N(m[0][0][0])?m.flatMap(U=>Array.isArray(U)?U:[]).map(U=>Array.isArray(U)?U.map(E).filter(Boolean):[]).filter(U=>U.length):m.length&&Array.isArray(m[0])&&N(m[0][0])?m.map(U=>Array.isArray(U)?U.map(E).filter(Boolean):[]).filter(U=>U.length):[]}function Te(){if(!F||!j.value)return;I&&F.hasLayer(I)&&(F.removeLayer(I),I=null);const m=qe({id:"global-bounds",bounds:s.bounds??V.value,style:{}});m&&(I=m,I.addTo(F))}function Ie(){!F||!j.value||D.value.forEach(m=>{const p=G[m];p&&(p.visible?(p.layer||(p.layer=bt(p.config)),p.boundsLayer||(p.boundsLayer=qe(p.config)),p.layer&&!F.hasLayer(p.layer)&&p.layer.addTo(F),p.boundsLayer&&!F.hasLayer(p.boundsLayer)&&p.boundsLayer.addTo(F)):(p.layer&&F.hasLayer(p.layer)&&F.removeLayer(p.layer),p.boundsLayer&&F.hasLayer(p.boundsLayer)&&F.removeLayer(p.boundsLayer),be(p.id)))})}function xt(m){if(d.value)return;const p=G[m];p&&(p.visible=!p.visible,p.visible?(p.layer||(p.layer=bt(p.config)),p.boundsLayer||(p.boundsLayer=qe(p.config)),p.layer&&!F.hasLayer(p.layer)&&p.layer.addTo(F),p.boundsLayer&&!F.hasLayer(p.boundsLayer)&&p.boundsLayer.addTo(F)):(p.layer&&F.hasLayer(p.layer)&&F.removeLayer(p.layer),p.boundsLayer&&F.hasLayer(p.boundsLayer)&&F.removeLayer(p.boundsLayer),be(p.id)))}e.watch(()=>s.layers,m=>{const p=Array.isArray(m)?m:[],E=[],N=new Set;p.forEach((O,U)=>{if(!O)return;const ee=ge(O,U);E.push(ee),N.add(ee);const X=G[ee],ie={...O,id:ee},de=X?.visible??!!ie?.visible;X&&(X.layer&&F?.hasLayer(X.layer)&&F.removeLayer(X.layer),X.boundsLayer&&F?.hasLayer(X.boundsLayer)&&F.removeLayer(X.boundsLayer),be(ee)),G[ee]={id:ee,config:ie,visible:de,layer:null,boundsLayer:null}}),Object.keys(G).forEach(O=>{if(!N.has(O)){const U=G[O];U?.layer&&F?.hasLayer(U.layer)&&F.removeLayer(U.layer),U?.boundsLayer&&F?.hasLayer(U.boundsLayer)&&F.removeLayer(U.boundsLayer),be(O),delete G[O]}}),D.value=E,Ie()},{immediate:!0,deep:!0}),e.watch(()=>s.bounds,()=>{F&&(Object.values(G).forEach(m=>{m.boundsLayer&&F.hasLayer(m.boundsLayer)&&F.removeLayer(m.boundsLayer),m.boundsLayer=null}),Te(),Ie())},{deep:!0}),e.watch(()=>s.katottg,async m=>{if(V.value=[],!m){Te();return}try{const p=await fetch(`https://data.gki.com.ua/api-user/atu/${m}`);if(!p?.ok)return;const N=(await p.json())?.geometry?.coordinates;Array.isArray(N)&&N.length&&(V.value=N)}catch(p){console.error("Failed to fetch KATOTTG bounds",p)}finally{Te(),Ie()}},{immediate:!0}),e.watch(()=>s.modelValue,m=>{if(!F||!L){M.value=m;return}Oe(m)},{deep:!0});function _t(m){const p=j.value;return m instanceof p.Circle?"Circle":m instanceof p.Rectangle?"Rectangle":m instanceof p.Polygon&&!(m instanceof p.Rectangle)?"Polygon":m instanceof p.Polyline&&!(m instanceof p.Polygon)?"Polyline":m instanceof p.Marker?"Point":"Feature"}function nt(m){const p=j.value;if(m instanceof p.Circle){const E=m.getRadius();return Math.PI*(E*E)/1e6}if(m instanceof p.Polygon||m instanceof p.Rectangle)try{const E=m.getLatLngs();if(!Array.isArray(E)||!E.length)return null;if(!Array.isArray(E[0])){const ee=p.GeometryUtil?.geodesicArea?p.GeometryUtil.geodesicArea(E):0;return ee?Math.abs(ee)/1e6:0}const N=E[0];if(N.length>0&&(N[0]instanceof p.LatLng||typeof N[0]?.lat=="number")){const{feature:ee}=m;if(ee?.geometry?.type==="MultiPolygon"){const de=E.reduce(($e,lt)=>{if(!Array.isArray(lt)||!lt.length)return $e;if(p.GeometryUtil?.geodesicArea){const at=p.GeometryUtil.geodesicArea(lt);if(at)return $e+Math.abs(at)}return $e},0);return de?de/1e6:0}const ie=p.GeometryUtil?.geodesicArea?p.GeometryUtil.geodesicArea(E):0;return ie?Math.abs(ie)/1e6:0}const U=E.reduce((ee,X)=>{if(!Array.isArray(X)||!X.length)return ee;const ie=Array.isArray(X[0])?X[0]:X;if(p.GeometryUtil?.geodesicArea){const de=p.GeometryUtil.geodesicArea(ie);if(de)return ee+Math.abs(de)}return ee},0);return U?U/1e6:0}catch{return null}return null}function Et(m){return m instanceof j.value.Circle?m.getLatLng():m.getBounds?m.getBounds().getCenter():m.getLatLng?m.getLatLng():F.getCenter()}function ve(m){const p=L.toGeoJSON(),E=[],N=[];let O=null;const U=X=>{if(X)switch(X.type){case"Point":O=X;break;case"Polygon":E.push(X.coordinates);break;case"MultiPolygon":E.push(...X.coordinates);break;case"LineString":N.push(X.coordinates);break;case"MultiLineString":N.push(...X.coordinates);break;case"GeometryCollection":(X.geometries||[]).forEach(U);break}};(p?.features||[]).forEach(X=>U(X.geometry));const ee=O||(E.length?{type:E.length===1?"Polygon":"MultiPolygon",coordinates:E.length===1?E[0]:E}:N.length?{type:N.length===1?"LineString":"MultiLineString",coordinates:N.length===1?N[0]:N}:null);!m?.silent&&!A&&i("update:modelValue",ee),u.value=L.getLayers().length}function Oe(m){if(!L||!j.value)return;L.clearLayers();const p=ni(m);if(!p){B.value=null,u.value=0;return}j.value.geoJSON(p).eachLayer(N=>L.addLayer(N)),A=!0,ve({silent:!0}),A=!1,Me();const E=L.getBounds?.();E?.isValid?.()&&F?.fitBounds(E,{padding:[24,24]})}function Me(){const m=L.getLayers();if(!m.length){B.value=null,u.value=0;return}const p=m[m.length-1],E=_t(p),N=Et(p),O=L.toGeoJSON(),U=O?.features?.some(de=>de.geometry?.type==="MultiPolygon")||O?.geometry?.type==="MultiPolygon",ee=m.length>1&&m.every(de=>de instanceof j.value.Polygon||de instanceof j.value.Rectangle),X=U||ee;let ie=null;if(X){const de=m.reduce(($e,lt)=>{const at=nt(lt);return $e+(at?at*1e6:0)},0);ie=de?de/1e6:0}else ie=nt(p);B.value={type:E,center:N,areaKm2:ie,layer:p},u.value=m.length}const Se=e.ref("");function Re(m){if(d.value||!F||!j.value)return;T?.disable&&T.disable();const p=j.value;switch(m){case"marker":T=new p.Draw.Marker(F);break;case"polyline":T=new p.Draw.Polyline(F);break;case"polygon":T=new p.Draw.Polygon(F);break;case"rectangle":T=new p.Draw.Rectangle(F);break}T.enable(),Se.value=m}function Kt(){if(d.value)return;const m=B.value?.layer;m&&(m.getBounds?F.fitBounds(m.getBounds(),{padding:[30,30]}):m.getLatLng&&F.setView(m.getLatLng(),Math.max(f.value,14)))}function Yt(){d.value||L&&(L.clearLayers(),i("update:modelValue",null),B.value=null,u.value=0)}const Vt=e.ref(null);function Wt(){d.value||Vt.value?.click()}function vt(m){if(d.value)return;const p=m.target,E=p.files?.[0];if(!E)return;const N=new FileReader;N.onload=()=>{try{const O=JSON.parse(String(N.result));L.clearLayers(),O&&j.value.geoJSON(O).eachLayer(U=>L.addLayer(U)),ve(),Me()}finally{p.value=""}},N.readAsText(E)}function v(){if(d.value)return;const m=L.toGeoJSON(),p=new Blob([JSON.stringify(m,null,2)],{type:"application/json"}),E=URL.createObjectURL(p),N=document.createElement("a");N.href=E,N.download="data.geojson",N.click(),URL.revokeObjectURL(E)}function C(m){!F||!j.value||!z[m]||(xe&&F.removeLayer(xe),xe=j.value.tileLayer(z[m].url,{maxZoom:19,minZoom:6,pane:rt}).addTo(F),re.value=m)}function $(m){if(!F||!j.value)return;const p=j.value.latLng(m[0],m[1]);F.setView(p,13)}let W=null;return e.onMounted(async()=>{j.value=await Z();const m=j.value;m.drawLocal=_s,F=m.map(h.value,{zoomControl:!1,scrollWheelZoom:!1}).setView(x.value,f.value),m.control.zoom({position:"bottomright"}).addTo(F);const p=re.value||Object.keys(z)[0];F.createPane(rt),F.getPane(rt).style.zIndex="180",F.createPane(st),F.getPane(st).style.zIndex="220",p&&z[p]&&(re.value=p,xe=m.tileLayer(z[p].url,{maxZoom:19,minZoom:6,pane:rt}).addTo(F)),L=new m.FeatureGroup().addTo(F),F.on(m.Draw.Event.CREATED,N=>{if(d.value)return;const{layer:O}=N;L.clearLayers(),L.addLayer(O),ve(),Me(),Se.value=""}),F.on(m.Draw.Event.EDITED,()=>{d.value||(ve(),Me())}),F.on(m.Draw.Event.DELETED,()=>{d.value||(ve(),Me())});let E=!1;F.on("mousemove",N=>{E||(F.invalidateSize(),E=!0)}),F.on("zoomend",()=>{f.value=F.getZoom()}),W=me(),Ie(),Te(),M.value!==void 0&&(Oe(M.value),M.value=void 0)}),e.onUnmounted(()=>{W?.(),be(),I&&F?.hasLayer(I)&&(F.removeLayer(I),I=null),F?.remove&&F.remove()}),e.watch(c,()=>{setTimeout(()=>{F?.invalidateSize&&F.invalidateSize()},50)}),e.watch(g,async m=>{if(!m||!w.value){k.value=null;return}await e.nextTick();const p=w.value.getBoundingClientRect();k.value={top:p.bottom+6,left:p.left}}),(m,p)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",disabled:!c.value},[e.createElementVNode("div",{class:e.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:c.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:h,class:"w-full h-full"},null,512),e.createVNode(e.Transition,{name:"zoom-instructions","enter-active-class":"transition-all duration-200 ease-out","leave-active-class":"transition-all duration-500 ease-in","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:e.withCtx(()=>[y.value&&s.handleZoom?(e.openBlock(),e.createElementBlock("div",li,[e.createElementVNode("div",ai,[e.createElementVNode("p",oi,e.toDisplayString(_.value),1)])])):e.createCommentVNode("",!0)]),_:1}),P.value.search||P.value.import||P.value.export?(e.openBlock(),e.createElementBlock("div",ri,[P.value.search?(e.openBlock(),e.createBlock(Zs,{key:0,onGoToCoordinates:$})):e.createCommentVNode("",!0),P.value.import||P.value.export?(e.openBlock(),e.createElementBlock("div",si,[e.createElementVNode("div",ii,[P.value.import?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:Wt,disabled:d.value}," Import ",8,di)):e.createCommentVNode("",!0),P.value.export?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:v,disabled:d.value||u.value===0}," Export ",8,ci)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:Vt,type:"file",onChange:vt,accept:".json,.geojson",class:"hidden",disabled:d.value},null,40,ui)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),le.value.length?(e.openBlock(),e.createElementBlock("div",{key:1,class:"absolute z-[1500] pointer-events-none",style:e.normalizeStyle(R.value)},[e.createElementVNode("div",pi,[e.createElementVNode("dl",mi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(le.value,E=>(e.openBlock(),e.createElementBlock("div",{key:`${E.key}-${E.value}`,class:"flex justify-between gap-2"},[e.createElementVNode("dt",hi,e.toDisplayString(E.key),1),e.createElementVNode("dd",fi,e.toDisplayString(E.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",gi,[e.createElementVNode("div",yi,[P.value.point?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":Se.value==="marker"}]),title:"Point",onClick:p[0]||(p[0]=E=>Re("marker")),disabled:d.value},[e.createVNode(Bs)],10,ki)):e.createCommentVNode("",!0),P.value.line?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":Se.value==="polyline"}]),title:"Line",onClick:p[1]||(p[1]=E=>Re("polyline")),disabled:d.value},[e.createVNode(Ss)],10,bi)):e.createCommentVNode("",!0),P.value.polygon?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":Se.value==="polygon"}]),title:"Polygon",onClick:p[2]||(p[2]=E=>Re("polygon")),disabled:d.value},[e.createVNode(Fs)],10,wi)):e.createCommentVNode("",!0),P.value.rectangle?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":Se.value==="rectangle"}]),title:"Rectangle",onClick:p[3]||(p[3]=E=>Re("rectangle")),disabled:d.value},[e.createVNode(Os)],10,xi)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:p[4]||(p[4]=E=>c.value=!c.value),title:"Full Screen"},[e.createVNode(Ps,{style:{width:"12px",height:"12px"}})])])]),e.createElementVNode("div",{class:e.normalizeClass(["absolute left-4 z-[1000]",B.value?"bottom-8":"bottom-4"])},[e.createElementVNode("div",_i,[e.createVNode(ti,{basemaps:e.unref(z),onOnLayerChange:C},null,8,["basemaps"]),te.value.length?(e.openBlock(),e.createElementBlock("div",Ei,[p[9]||(p[9]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),e.createElementVNode("div",Vi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(te.value,E=>(e.openBlock(),e.createElementBlock("label",{key:E.id,class:"flex items-center gap-2 cursor-pointer select-none"},[e.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:E.visible,disabled:d.value,onChange:N=>xt(E.id)},null,40,vi),e.createElementVNode("span",Bi,e.toDisplayString(E.config.title||E.config.name||E.id),1)]))),128))])])):e.createCommentVNode("",!0)])],2),e.createElementVNode("div",Ci,[B.value?(e.openBlock(),e.createElementBlock("div",Ni,[e.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:p[5]||(p[5]=E=>g.value=!0),onMouseleave:p[6]||(p[6]=E=>g.value=!1)},[e.createElementVNode("div",Mi,[p[10]||(p[10]=e.createTextVNode(" Type: ",-1)),e.createElementVNode("span",Si,e.toDisplayString(B.value.type),1)]),b.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"addressEl",ref:w,class:"text-gray-500 text-xs truncate cursor-help",style:{"max-width":"260px"}}," Address: "+e.toDisplayString(b.value),513)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[g.value&&b.value&&k.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed z-[99999] pointer-events-none bg-gray-800 text-white text-xs px-2 py-1 rounded shadow whitespace-nowrap",style:e.normalizeStyle({top:k.value.top+"px",left:k.value.left+"px"})},e.toDisplayString(b.value),5)):e.createCommentVNode("",!0)]))],32),e.createElementVNode("div",$i,[e.createElementVNode("div",Di,[p[11]||(p[11]=e.createTextVNode(" Center: ",-1)),e.createElementVNode("b",null,e.toDisplayString(B.value.center.lat.toFixed(5))+", "+e.toDisplayString(B.value.center.lng.toFixed(5)),1)]),B.value.areaKm2!==null?(e.openBlock(),e.createElementBlock("div",Ai,[p[12]||(p[12]=e.createTextVNode(" Area: ",-1)),e.createElementVNode("b",null,e.toDisplayString(B.value.areaKm2.toFixed(1))+" km²",1)])):(e.openBlock(),e.createElementBlock("div",Fi,p[13]||(p[13]=[e.createTextVNode("Area: ",-1),e.createElementVNode("b",null,"—",-1)]))),e.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:"Zoom to feature",onClick:p[7]||(p[7]=E=>Kt()),disabled:d.value},p[14]||(p[14]=[e.createElementVNode("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"},[e.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),e.createElementVNode("path",{d:"M7 10l6 0"}),e.createElementVNode("path",{d:"M10 7l0 6"}),e.createElementVNode("path",{d:"M21 21l-6 -6"})],-1)]),8,Li),e.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:"Delete feature",onClick:p[8]||(p[8]=E=>Yt()),disabled:d.value},[e.createVNode(je,{class:"w-3 h-3"})],8,Ti)])])):e.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-099336a8"]]),Ii=["data-focus"],Oi={class:"flex items-center"},Ri={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},zi=["onClick","aria-label"],ji={key:0,class:"absolute text-gray-500 truncate pl-2"},Pi={class:"flex-1 min-w-[2px]"},Ui=["placeholder"],Hi={class:"flex items-center shrink-0"},qi=["disabled"],mn=e.defineComponent({__name:"vs-input-tag",props:e.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=t;he(n.style);const o=e.ref(null),r=e.ref(null),s=e.ref(null),i=e.ref(!1),d=e.ref(""),c=e.useModel(l,"modelValue"),h=e.computed(()=>n.placeholder||"Add tag…"),y=e.computed(()=>c.value?.length===0&&d.value===""),_=e.computed(()=>!n.disabled&&c.value?.length>0),b=e.computed(()=>n.disabled),B=async()=>{b.value||await e.nextTick(()=>s.value?.focus())},g=M=>{const A=M.trim();A!==""&&(!c.value||!Array.isArray(c.value)?c.value=[A]:n.unique?c.value.includes(A)||(c.value=[...c.value,A]):c.value=[...c.value,A],d.value="")},k=()=>{const M=d.value;M.trim()!==""&&g(M),d.value=""},w=M=>{const A=c.value.slice();A.splice(M,1),a("update:modelValue",A)},u=()=>{a("update:modelValue",[])},x=()=>{b.value||(i.value=!0)},f=()=>{i.value=!1,!b.value&&k()},V=M=>{const{key:A}=M;A==="Enter"?(M.preventDefault(),k()):A==="Backspace"&&d.value===""&&c.value.length>0&&w(c.value.length-1)};return(M,A)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:A[1]||(A[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass]),role:"group","aria-label":"Tag input"},[e.createElementVNode("div",{class:e.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":"",b.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:B},[e.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},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(j,P)=>(e.openBlock(),e.createElementBlock("div",{key:P,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",Oi,[e.createElementVNode("div",Ri,e.toDisplayString(j),1)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:e.withModifiers(G=>w(P),["stop"]),"aria-label":`Remove ${j}`},A[2]||(A[2]=[e.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"},[e.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,zi)]))),128)),y.value?(e.openBlock(),e.createElementBlock("div",ji,e.toDisplayString(h.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Pi,[b.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:s,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":A[0]||(A[0]=j=>d.value=j),onFocus:x,onBlur:f,onKeydown:V,placeholder:c.value&&c.value.length?"":void 0},null,40,Ui)),[[e.vModelText,d.value]])])],512),e.createElementVNode("div",Hi,[_.value?(e.openBlock(),e.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:b.value,onClick:e.withModifiers(u,["stop"])},A[3]||(A[3]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.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,qi)):e.createCommentVNode("",!0)])],10,Ii)],2)],512))}}),Gi={class:"relative flex gap-1 bg-white w-full"},Ki=["disabled","placeholder"],hn=Y(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=e.inject("values"),n=l,a=e.useModel(l,"modelValue");function o(s){const i={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ы:"y",э:"e",ю:"yu",я:"ya",ь:"",ъ:"",є:"ye",і:"i",ї:"yi",ґ:"g"};return s.toLowerCase().split("").map(d=>i[d]||d).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const r=()=>{const s=t?.value?.[n.parent||""]?.toString(),i=o(s);a.value=i.toString()};return(s,i)=>(e.openBlock(),e.createElementBlock("div",Gi,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:s.disabled,placeholder:s.placeholder,"onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 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,8,Ki),[[e.vModelText,a.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:r}," Gen ")]))}}),[["__scopeId","data-v-b0eba370"]]),Yi={class:"relative flex gap-1 bg-white w-full"},Wi=["disabled","placeholder"],Zi=["disabled"],Ji={key:0},Xi={key:1},fn=Y(e.defineComponent({__name:"vs-input-codegen",props:e.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref(!1),o=e.computed(()=>t.init!==!1),r=e.computed(()=>!!t.table&&!!t.code),s=()=>{if(!r.value)return"";const c=encodeURIComponent(String(t.table)),h=encodeURIComponent(String(t.code));return`/api/code-gen/${c}/${h}`},i=async()=>{if(!r.value||a.value)return;const c=s();if(c){a.value=!0;try{const y=await(await fetch(c)).text();n.value=y}finally{a.value=!1}}},d=()=>{o.value&&(n.value||i())};return e.onMounted(()=>{d()}),e.watch(()=>[t.table,t.code,t.init],()=>{d()}),(c,h)=>(e.openBlock(),e.createElementBlock("div",Yi,[e.withDirectives(e.createElementVNode("input",{disabled:c.disabled,placeholder:c.placeholder,"onUpdate:modelValue":h[0]||(h[0]=y=>n.value=y),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 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,8,Wi),[[e.vModelText,n.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:a.value||c.disabled||!r.value,onClick:i},[a.value?(e.openBlock(),e.createElementBlock("span",Xi,"...")):(e.openBlock(),e.createElementBlock("span",Ji,"Gen"))],8,Zi)]))}}),[["__scopeId","data-v-6ee5237d"]]),Qi={class:"w-full"},ed={ref:"sortableContainer",class:"flex flex-col gap-1"},td=["onDragstart","onDrop"],nd={class:"w-1/3"},ld={class:"w-2/3"},ad=["onClick"],od={key:0,class:"text-[14px] text-gray-700"},rd={class:"mt-2 w-full flex items-center"},sd=["disabled"],gn=Y(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=k=>`${k}-${Math.random().toString(36).substring(2,15)}`,a=e.inject("values"),o=l,r=t,s=o.addButtonText??"Додати",i=o.ignore??[],d=e.ref([]),c=e.ref(null);(()=>{const k=o.parent&&a?.value?.[o.parent]||o.modelValue||{};d.value=Object.entries(k).filter(([w])=>!i.includes(w)).map(([w,u])=>({id:n("key-value-"),key:w,value:u}))})();function y(k){c.value=k}function _(k){if(c.value===null||c.value===k)return;const w=d.value.splice(c.value,1)[0];d.value.splice(k,0,w),c.value=null}const b=e.computed(()=>d.value.some(k=>k.key&&!k.value||!k.key&&k.value)),B=()=>{d.value.push({id:n("key-value-"),key:"",value:""})},g=k=>{d.value=d.value.filter(w=>w.id!==k)};return e.watch(d,k=>{const w={};k.forEach(x=>{x.key&&x.value!==void 0&&(w[x.key]=x.value)});const u={};i.length&&i.forEach(x=>{u[x]=o.parent?a?.value?.[o.parent]?.[x]:void 0}),a?.value&&o.parent&&(a.value[o.parent]={...u,...w}),r("update:modelValue",w)},{deep:!0}),(k,w)=>(e.openBlock(),e.createElementBlock("div",Qi,[e.createElementVNode("div",ed,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(u,x)=>(e.openBlock(),e.createElementBlock("div",{key:u.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":c.value===x}]),draggable:"true",onDragstart:f=>y(x),onDragover:w[0]||(w[0]=e.withModifiers(()=>{},["prevent"])),onDrop:f=>_(x)},[w[1]||(w[1]=e.createStaticVNode('<button class="cursor-move" data-v-a0f7fbfc><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-a0f7fbfc><circle cx="15" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="18" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="18" r="1.5" data-v-a0f7fbfc></circle></svg></button>',1)),e.createElementVNode("div",nd,[e.createVNode(ze,{modelValue:u.key,"onUpdate:modelValue":f=>u.key=f,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",ld,[e.createVNode(ze,{modelValue:u.value,"onUpdate:modelValue":f=>u.value=f,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:f=>g(u.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[e.createVNode(e.unref(Ct),{height:"16",width:"16"})],8,ad)],42,td))),128))],512),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",od," Дані для відображення відсутні ")),e.createElementVNode("div",rd,[e.createElementVNode("button",{type:"button",onClick:B,disabled:b.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(Be,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(s)),1)],8,sd)])]))}}),[["__scopeId","data-v-a0f7fbfc"]]),id={class:"w-full"},dd={ref:"sortableContainer",class:"flex flex-col gap-1"},cd=["onDragstart","onDrop"],ud=["disabled"],pd={class:"flex-1"},md=["onClick","disabled"],hd={key:0,class:"text-[14px] text-gray-700"},fd={class:"mt-2 w-full flex items-center"},gd=["disabled"],yn=Y(e.defineComponent({__name:"vs-input-text-array",props:e.mergeModels({addButtonText:{default:"Додати"},inputType:{default:"text"},placeholder:{default:"Значення"},mask:{default:""},disabled:{type:Boolean,default:!1}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.ref(null),r=e.computed(()=>!!t.disabled),s=e.computed(()=>t.placeholder??""),i=e.computed(()=>t.addButtonText??"Додати");let d=!1;const c=k=>`${k}-${Math.random().toString(36).substring(2,15)}`,h=k=>{const w=k??n.value??[];a.value=w.map((u,x)=>({id:a.value[x]?.id??c("text-array"),value:u??""}))};h(),e.watch(()=>n.value,k=>{if(d){d=!1;return}h(k||[])},{deep:!0}),e.watch(a,k=>{d=!0,n.value=k.map(w=>w.value).filter(w=>w!=null&&w!=="")},{deep:!0});const y=e.computed(()=>r.value||a.value.some(k=>!k.value));function _(){y.value||(a.value=[...a.value,{id:c("text-array"),value:""}])}function b(k){r.value||(a.value=a.value.filter(w=>w.id!==k))}function B(k){r.value||(o.value=k)}function g(k){if(r.value||o.value===null||o.value===k)return;const w=[...a.value],[u]=w.splice(o.value,1);w.splice(k,0,u),a.value=w,o.value=null}return(k,w)=>(e.openBlock(),e.createElementBlock("div",id,[e.createElementVNode("div",dd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(u,x)=>(e.openBlock(),e.createElementBlock("div",{key:u.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":o.value===x}]),draggable:"true",onDragstart:f=>B(x),onDragover:w[0]||(w[0]=e.withModifiers(()=>{},["prevent"])),onDrop:f=>g(x)},[e.createElementVNode("button",{class:"cursor-move",type:"button",disabled:r.value},w[1]||(w[1]=[e.createStaticVNode('<svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-66316a33><circle cx="15" cy="12" r="1.5" data-v-66316a33></circle><circle cx="15" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="12" r="1.5" data-v-66316a33></circle><circle cx="21" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="18" r="1.5" data-v-66316a33></circle><circle cx="15" cy="18" r="1.5" data-v-66316a33></circle></svg>',1)]),8,ud),e.createElementVNode("div",pd,[k.inputType==="text"?(e.openBlock(),e.createBlock(ze,{key:0,modelValue:u.value,"onUpdate:modelValue":f=>u.value=f,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),k.inputType==="tel"?(e.openBlock(),e.createBlock(Dt,{key:1,modelValue:u.value,"onUpdate:modelValue":f=>u.value=f,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),k.inputType==="email"?(e.openBlock(),e.createBlock($t,{key:2,modelValue:u.value,"onUpdate:modelValue":f=>u.value=f,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),k.inputType==="mask"?(e.openBlock(),e.createBlock(St,{key:3,modelValue:u.value,"onUpdate:modelValue":f=>u.value=f,mask:k.mask,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","mask","disabled","placeholder"])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:f=>b(u.id),disabled:r.value,class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200 disabled:opacity-50"},[e.createVNode(e.unref(Ct),{height:"16",width:"16"})],8,md)],42,cd))),128))],512),a.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",hd," Дані для відображення відсутні ")),e.createElementVNode("div",fd,[e.createElementVNode("button",{type:"button",onClick:_,disabled:y.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(Be,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(i.value),1)],8,gd)])]))}}),[["__scopeId","data-v-66316a33"]]),yd={class:"flex items-center gap-2 w-full"},kd=["disabled"],bd=["disabled"],kn=e.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,{inputClass:a}=he(n.style),o=t,r=e.computed({get:()=>n.modelValue||"#000000",set:i=>o("update:modelValue",i)}),s=e.computed(()=>!!n.disabled);return(i,d)=>(e.openBlock(),e.createElementBlock("div",yd,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[0]||(d[0]=c=>r.value=c),disabled:s.value,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[i.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,kd),[[e.vModelText,r.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":d[1]||(d[1]=c=>r.value=c),disabled:s.value},null,8,bd),[[e.vModelText,r.value]])]))}}),wd={class:"flex items-center gap-2 w-full"},xd=["min","max","step","disabled"],_d=["disabled"],bn=e.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,{inputClass:a}=he(n.style),o=t,r=e.computed({get:()=>Number(n.modelValue??n.min),set:i=>o("update:modelValue",Number(i))}),s=e.computed(()=>!!n.disabled);return(i,d)=>(e.openBlock(),e.createElementBlock("div",wd,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":d[0]||(d[0]=c=>r.value=c),min:i.min,max:i.max,step:i.step,disabled:s.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[i.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")])},null,10,xd),[[e.vModelText,r.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":d[1]||(d[1]=c=>r.value=c),disabled:s.value},null,8,_d),[[e.vModelText,r.value]])]))}}),Ed=["placeholder","disabled","name"],Vd=["type","value","onInput","placeholder","disabled"],vd=["onClick"],wn=e.defineComponent({__name:"vs-input-array",props:e.mergeModels({count:{default:1},limit:{default:1},mask:{default:""},unmask:{type:Boolean,default:!1},inputType:{default:"text"},isAdded:{type:Boolean,default:!1},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.ref(t.count),a=e.computed(()=>t.limit),{inputClass:o}=he(t.style),r=e.useModel(l,"modelValue"),s=e.computed(()=>!!t.disabled),i=e.computed(()=>t.placeholder??"");e.watchEffect(()=>{const g=r.value?.length??0;g<n.value&&(r.value=[...r.value??[],...Array(n.value-g)])});const d=e.ref({}),c=e.ref({});function h(g,k){g&&(d.value[k]=g)}async function y(g,k){if(!g||t.inputType!=="mask")return;const{default:w}=await Promise.resolve().then(()=>qt);c.value[k]&&c.value[k].destroy(),c.value[k]=w(g,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),c.value[k].on("accept",()=>{const u=[...r.value||[]];u[k]=t.unmask?c.value[k].unmaskedValue:c.value[k].value,r.value=u}),c.value[k].on("complete",()=>{const u=[...r.value||[]];u[k]=t.unmask?c.value[k].unmaskedValue:c.value[k].value,r.value=u}),r.value?.[k]&&(c.value[k].value=r.value[k])}function _(g,k){if(s.value)return;const w=g.target.value??null,u=[...r.value];u[k]=t.inputType==="text"?w:Number(w),r.value=u}function b(){n.value+=1;const g=t.inputType==="text"||t.inputType==="mask"?null:0;r.value=[...r.value,g],t.inputType==="mask"&&setTimeout(()=>{const k=n.value-1;d.value[k]&&y(d.value[k],k)},0)}function B(g){if(n.value>1){c.value[g]&&(c.value[g].destroy(),delete c.value[g]),n.value-=1,r.value=r.value.filter((w,u)=>u!==g);const k={};Object.keys(c.value).forEach(w=>{const u=parseInt(w,10);u>g?k[u-1]=c.value[u]:u<g&&(k[u]=c.value[u])}),c.value=k}}return e.onMounted(()=>{if(t.inputType==="mask")for(let g=0;g<n.value;g+=1)d.value[g]&&y(d.value[g],g)}),e.onBeforeUnmount(()=>{Object.values(c.value).forEach(g=>{g&&g.destroy()})}),e.watch(()=>t.mask,g=>{t.inputType==="mask"&&Object.values(c.value).forEach(k=>{k&&k.updateOptions({mask:g,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})})}),e.watch(r,g=>{t.inputType==="mask"&&g&&g.forEach((k,w)=>{c.value[w]&&c.value[w].value!==k&&(c.value[w].value=k||"")})},{deep:!0}),(g,k)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["grid gap-2",`grid-cols-${a.value}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,w=>(e.openBlock(),e.createElementBlock("div",{key:w,class:"flex items-center gap-2 w-full"},[g.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:u=>h(u,w-1),placeholder:g.placeholder,disabled:g.disabled,name:`${g.name}[${w-1}]`,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":g.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Ed)):(e.openBlock(),e.createElementBlock("input",{key:1,type:g.inputType,value:r.value?.[w-1],onInput:u=>_(u,w-1),placeholder:i.value,disabled:s.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":g.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Vd)),!g.disabled&&w===n.value&&g.isAdded?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:e.withModifiers(b,["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-green-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(Be,{height:"18",width:"18"})])):e.createCommentVNode("",!0),!g.disabled&&n.value>1&&g.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(u=>B(w-1),["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-red-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(Ct,{height:"18",width:"18"})],8,vd)):e.createCommentVNode("",!0)]))),128))],2))}}),Bd={class:"flex items-center gap-2 w-full"},Cd={class:"relative flex-1"},Nd=["placeholder","disabled","onKeydown"],Md=["disabled"],Sd={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},$d={key:1,class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},Dd={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},Ad={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},Fd={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},Ld=["onClick"],Td={key:0,class:"p-4 text-sm text-gray-500"},xn=e.defineComponent({__name:"vs-input-address",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{},api:{default:""},geom:{default:""},includes:{default:()=>[]}},{modelValue:{default:""},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=t,{inputClass:o}=he(n.style),r=e.useModel(l,"modelValue"),s=e.computed({get:()=>r.value,set:w=>{r.value=w}}),i=e.ref(!1),d=e.ref([]),c=e.ref(!1),h=e.computed(()=>n.placeholder??""),y=e.computed(()=>!!n.disabled),_=e.inject("values");function b(){!y.value&&s.value.trim()&&B()}async function B(){const w=(s.value||"").trim();if(!w)return;let u=w;if(n.includes?.length&&_?.value){const f=n.includes.map(V=>_.value?.[V]).filter(Boolean);f.length&&(u=`${f.join(", ")}, ${w}`)}const x=n.api.replace("{{value}}",encodeURIComponent(u));i.value=!0;try{const V=await(await fetch(x)).json();d.value=Array.isArray(V)?V:[],c.value=!0}catch(f){console.error("Address search error:",f)}finally{i.value=!1}}function g(){c.value=!c.value}function k(w){if(!w)return;c.value=!1;const u=parseFloat(w.lat),f={type:"Point",coordinates:[parseFloat(w.lon),u]};n.geom&&_?.value&&(_.value[n.geom]=f),a("update:geom",f)}return(w,u)=>(e.openBlock(),e.createElementBlock("div",Bd,[e.createElementVNode("div",Cd,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":u[0]||(u[0]=x=>s.value=x),placeholder:h.value,disabled:y.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[e.unref(o),{"!border-red-600":n.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:e.withKeys(e.withModifiers(b,["prevent"]),["enter"])},null,42,Nd),[[e.vModelText,s.value]]),d.value.length?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:g,title:"Show search results"},u[2]||(u[2]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),e.createElementVNode("path",{d:"M12 16v-4"}),e.createElementVNode("path",{d:"M12 8h.01"})],-1)]))):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:B,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:i.value||!s.value?.trim()},[i.value?(e.openBlock(),e.createElementBlock("svg",$d,u[4]||(u[4]=[e.createElementVNode("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e.createElementVNode("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)]))):(e.openBlock(),e.createElementBlock("svg",Sd,u[3]||(u[3]=[e.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),e.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},null,-1)])))],8,Md),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[c.value?(e.openBlock(),e.createElementBlock("div",Dd,[e.createElementVNode("div",Ad,[e.createElementVNode("div",Fd,[u[6]||(u[6]=e.createElementVNode("span",null,"Search results",-1)),e.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:u[1]||(u[1]=x=>c.value=!1),title:"Close"},u[5]||(u[5]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)]))]),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(x,f)=>(e.openBlock(),e.createElementBlock("li",{key:f,onClick:V=>k(x),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString(x.display_name),9,Ld))),128))]),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Td," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),_n=(l="")=>`${l}${Math.floor(Math.random()*1e4)}`,Id={class:"vs-datalist space-y-3"},Od={class:"space-y-3"},Rd=["onClick","disabled"],zd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},jd=["disabled"],Pd=Y(e.defineComponent({__name:"vs-input-datalist",props:e.mergeModels({schema:{default:()=>[]},minItems:{default:0},maxItems:{default:void 0},addButtonText:{default:"Додати позицію"},emptyLabel:{default:"Немає рядків"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>Array.isArray(n.value)?n.value:[]),o=e.ref([]),r=e.computed(()=>t.schema?.map(g=>({...g,disabled:t.disabled||g.disabled}))??[]),s=e.computed(()=>r.value.map(g=>B(g))),i=e.computed(()=>t.disabled?!1:t.maxItems?a.value.length<t.maxItems:!0),d=e.computed(()=>t.disabled||a.value.length<=(t.minItems||0));e.watch(()=>a.value.length,()=>{c(),h()},{immediate:!0}),e.watch(()=>t.schema,h,{immediate:!0,deep:!0});function c(){const g=a.value.length;o.value.length<g?o.value=[...o.value,...Array.from({length:g-o.value.length},()=>_n())]:o.value.length>g&&o.value.splice(g)}function h(){if(!t.minItems||a.value.length>=t.minItems)return;const g=t.minItems-a.value.length,k=Array.from({length:g},y);n.value=[...a.value,...k]}function y(){const g={};return r.value.forEach(k=>{g[k.name]=k?.default??null}),g}function _(){i.value&&(n.value=[...a.value,y()],c())}function b(g){d.value||(n.value=a.value.filter((k,w)=>w!==g),c(),h())}function B(g){return{...g}}return(g,k)=>(e.openBlock(),e.createElementBlock("div",Id,[e.createElementVNode("div",Od,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(w,u)=>(e.openBlock(),e.createElementBlock("div",{key:o.value[u],class:"flex items-center gap-3"},[e.createVNode(Ce,{schema:s.value,layout:"inline",navigation:!1,values:a.value[u],"onUpdate:values":x=>a.value[u]=x,"form-id":o.value[u]},null,8,["schema","values","onUpdate:values","form-id"]),e.createElementVNode("button",{type:"button",class:"h-[38px] w-[38px] flex items-center justify-center text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",onClick:x=>b(u),disabled:d.value},[e.createVNode(je,{class:"w-5 h-5"})],8,Rd)]))),128)),a.value.length===0?(e.openBlock(),e.createElementBlock("div",zd,e.toDisplayString(t.emptyLabel),1)):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:_,disabled:!i.value},[e.createVNode(Be,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,jd)]))}}),[["__scopeId","data-v-e8a02c8e"]]),Ud={};function Hd(l,t){return e.openBlock(),e.createElementBlock("svg",e.mergeProps({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"},l.$attrs),t[0]||(t[0]=[e.createElementVNode("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"},null,-1),e.createElementVNode("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"},null,-1)]),16)}const qd=Y(Ud,[["render",Hd]]),Gd={class:"vs-dataform space-y-4"},Kd={class:"flex items-center justify-between mb-3"},Yd={class:"text-sm font-medium text-gray-700"},Wd={class:"flex items-center gap-2"},Zd=["title","onClick","disabled"],Jd=["title","onClick","disabled"],Xd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Qd=["disabled"],En={VsInputText:ze,VsInputRadio:At,"vs-input-text":ze,"vs-input-password":yl,"vs-input-textarea":dn,"vs-input-mask":St,"vs-input-number":Jt,"vs-input-radio":At,"vs-input-select":Ft,"vs-input-switcher":Nt,"vs-input-static":Mt,"vs-input-container":sn,"vs-input-date":pa,"vs-input-checkbox":Xt,"vs-input-file":an,"vs-input-html":Mt,"vs-input-email":$t,"vs-input-tel":Dt,"vs-input-datatable":un,"vs-input-map":pn,"vs-input-file-list":on,"vs-input-tags":mn,"vs-input-slug":hn,"vs-input-codegen":fn,"vs-input-key-value":gn,"vs-input-text[]":yn,"vs-input-range":bn,"vs-input-color":kn,"vs-input-native-select":Ft,"vs-input-array":wn,"vs-input-address":xn,"vs-input-datalist":Pd,"vs-input-dataform":Y(e.defineComponent({__name:"vs-input-dataform",props:e.mergeModels({schema:{default:()=>[]},minGroups:{default:0},maxGroups:{default:void 0},addButtonText:{default:"Додати групу фільтрів"},groupLabel:{default:"Якщо поле"},duplicateTitle:{default:"Дублювати групу"},removeTitle:{default:"Видалити групу"},emptyLabel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.computed(()=>t.groupLabel),r=e.computed(()=>t.emptyLabel??"Ще немає груп"),s=e.computed(()=>t.schema?.map(w=>({...w,disabled:t.disabled||w.disabled}))??[]),i=e.computed(()=>s.value.map(w=>k(w))),d=e.computed(()=>t.disabled?!1:t.maxGroups?n.value.length<t.maxGroups:!0),c=e.computed(()=>t.disabled||n.value.length<=(t.minGroups||0));e.watch(()=>n.value.length,()=>{h(),y()},{immediate:!0}),e.watch(()=>t.schema,y,{immediate:!0,deep:!0});function h(){const w=n.value.length;a.value.length<w?a.value=[...a.value,...Array.from({length:w-a.value.length},()=>_n())]:a.value.length>w&&a.value.splice(w)}function y(){if(!t.minGroups||n.value.length>=t.minGroups)return;const w=t.minGroups-n.value.length,u=Array.from({length:w},_);n.value=[...n.value,...u]}function _(){const w={};return s.value.forEach(u=>{w[u.name]=u?.default??null}),w}function b(){d.value&&(n.value=[...n.value,_()],h())}function B(w){c.value||(n.value=n.value.filter((u,x)=>x!==w),h(),y())}function g(w){if(t.disabled)return;const u=JSON.parse(JSON.stringify(n.value[w]??{}));n.value=[...n.value.slice(0,w+1),u,...n.value.slice(w+1)],h()}function k(w){return{...w}}return(w,u)=>(e.openBlock(),e.createElementBlock("div",Gd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(x,f)=>(e.openBlock(),e.createElementBlock("div",{key:a.value[f],class:"relative border border-gray-200 rounded-lg p-6 bg-white"},[e.createElementVNode("div",Kd,[e.createElementVNode("div",Yd,e.toDisplayString(o.value),1),e.createElementVNode("div",Wd,[e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.duplicateTitle,onClick:V=>g(f),disabled:t.disabled},[e.createVNode(qd,{class:"w-5 h-5"})],8,Zd),e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.removeTitle,onClick:V=>B(f),disabled:c.value},[e.createVNode(je,{class:"w-5 h-5"})],8,Jd)])]),e.createVNode(Ce,{class:"vs-dataform__form",schema:i.value,layout:"inline",navigation:!1,values:n.value[f],"onUpdate:values":V=>n.value[f]=V,"form-id":a.value[f],disabled:t.disabled},null,8,["schema","values","onUpdate:values","form-id","disabled"])]))),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",Xd,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:b,disabled:!d.value},[e.createVNode(Be,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Qd)]))}}),[["__scopeId","data-v-4dc5a1a3"]])},ec=e.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(l){const t=l,n=e.inject("values");async function a(){try{if(!t.api)return;const o=t.api.replace("{{value}}",t.value),r=await fetch(o);if(!r.ok){se.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const s=await r.json();if(!t.set||!n)return;for(const[i,d]of Object.entries(t.set))n.value[i]=s.result[d]}catch(o){console.error(t.error,o)}}return(o,r)=>(e.openBlock(),e.createElementBlock("button",{onClick:a,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"},e.toDisplayString(o.button),1))}}),tc={class:"flex flex-col gap-1 w-full"},nc=["innerHTML"],Vn=e.defineComponent({__name:"vs-compact-form-layout",props:e.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]},columns:{default:()=>({container:12,label:3})}},{modelValue:{default:null},modelModifiers:{}}),emits:e.mergeModels(["value-selected"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=e.useModel(l,"modelValue"),o=t,r=e.computed(()=>fl[`${n.layout}`]),s=["label","placeholder","info","description","text","html"],i=e.ref(k()),d=e.computed(()=>b(n.item,i.value)),c=e.computed(()=>En?.[`vs-input-${n.item.type}`]),h=e.computed(()=>{const u=e.unref(c);if(!u)return new Set;const x=u.props??u.__vccOpts?.props;if(!x)return new Set;const f=Array.isArray(x)?x:Object.keys(x);return new Set(f)}),y=e.computed(()=>{const u=d.value??{},x=h.value;return x.size?Object.fromEntries(Object.entries(u).filter(([f])=>x.has(f))):{}}),_=u=>{const x=typeof u=="object"&&u!==null?u:{value:u};o("value-selected",{...x,name:x.name??n.item?.name})};e.onMounted(()=>{i.value=k(),window.addEventListener("storage",w)}),e.onUnmounted(()=>{window.removeEventListener("storage",w)});function b(u,x){if(!u)return{};const f={...u};return s.forEach(V=>{const M=g(u,V,x);M!=null&&(f[V]=M)}),Array.isArray(u.options)&&(f.options=u.options.map(V=>B(V,x))),f}function B(u,x){if(!u)return u;const f={...u},V=g(u,"label",x),M=g(u,"text",x);return V!=null&&(f.label=V),M!=null?f.text=M:V!=null&&(f.text=V),f}function g(u,x,f){const V=`${x}:${f}`;if(u?.[V]!=null)return u[V];if(x==="label"&&u?.[f]!=null)return u[f];if(u?.[x]!=null)return u[x];if(x==="label"){if(u?.ua!=null)return u.ua;if(u?.en!=null)return u.en}if(x==="text"||x==="html"){if(u?.ua!=null)return u.ua;if(u?.en!=null)return u.en}return null}function k(){return typeof window>"u"?"uk":localStorage.getItem("locale")||"uk"}function w(){i.value=k()}return(u,x)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{ua:d.value.ua,error:n.error||"",item:d.value,columns:n.columns,label:d.value.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${n.item.type}-component`])},[e.createElementVNode("div",tc,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(c.value),e.mergeProps(y.value,{modelValue:a.value,"onUpdate:modelValue":x[0]||(x[0]=f=>a.value=f),onValueSelected:_}),null,16,["modelValue"])),d.value.description&&n.layout!=="settings"?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-sm text-gray-500",innerHTML:d.value.description},null,8,nc)):e.createCommentVNode("",!0)]),d.value.behavior?.api&&d.value.behavior?.button?(e.openBlock(),e.createBlock(ec,e.mergeProps({key:0},d.value.behavior,{value:a.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),lc={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},ac={class:"vs-compact-form-navigation__rail mt-[6px]"},oc=["onClick"],rc=Y(e.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(l,{expose:t}){const n=l,a=e.ref([]),o=e.ref(""),r=e.ref(""),s=e.computed(()=>!!n.enabled),i=e.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),d=e.computed(()=>{const D=n.width;if(D==null)return{};const te=typeof D=="number"?`${D}px`:`${D}`;return{width:te,minWidth:te}});let c=null,h=0,y=0,_=null,b=null,B=null;const g=()=>P(),k=()=>u();e.watch(()=>n.target,async D=>{if(M(),!D){_=null,a.value=[],o.value="";return}_=D,s.value&&(await e.nextTick(),V(D),u())},{immediate:!0}),e.watch(()=>n.scrollContainer,D=>{if(!s.value){b=D??null;return}w(D??null),e.nextTick(()=>u())},{immediate:!0}),e.onMounted(()=>{n.scrollContainer||w(null),u()}),e.onBeforeUnmount(()=>{M(),w(null,!0),_=null,typeof window<"u"&&(h&&window.cancelAnimationFrame(h),y&&window.cancelAnimationFrame(y))});function w(D,te=!1){if(B&&(B(),B=null),te){b=null;return}if(b=D??null,typeof window>"u")return;const K=D??window,le=window;K.addEventListener("scroll",g,{passive:!0}),le.addEventListener("resize",k),B=()=>{K.removeEventListener("scroll",g),le.removeEventListener("resize",k)}}function u(){if(!s.value||!_)return;h&&typeof window<"u"&&window.cancelAnimationFrame(h);const D=()=>{x(),h=0};typeof window>"u"?D():h=window.requestAnimationFrame(D)}function x(){if(!s.value||!_)return;const D=Array.from(_.querySelectorAll("h1, h2")),te=new Set,K=[];D.forEach((le,R)=>{const S=le.textContent?.trim()??"";if(!S)return;let H=(le.getAttribute("id")??"").trim();H||(H=f(S)||`heading-${R+1}`);let z=H,ae=1;for(;te.has(z);)z=`${H}-${ae+=1}`;le.id!==z&&Object.assign(le,{id:z}),te.add(z),K.push({id:z,text:S,level:le.tagName.toLowerCase()==="h1"?1:2})}),a.value=K,K.length||(o.value=""),j()}function f(D){return D.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function V(D){!D||!s.value||typeof MutationObserver>"u"||(M(),c=new MutationObserver(()=>u()),c.observe(D,{childList:!0,subtree:!0}))}function M(){c&&(c.disconnect(),c=null)}function A(D){const te=b;if(!te)return typeof window>"u"?D.offsetTop:D.getBoundingClientRect().top+window.scrollY;const K=D.getBoundingClientRect(),le=te.getBoundingClientRect();return K.top-le.top+te.scrollTop}function j(){if(!s.value||!a.value.length)return;const D=b,te=(D?D.scrollTop:null)||(typeof window<"u"?window.scrollY:0),K=(D?D.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),le=te+K;let R=null;for(let H=0;H<a.value.length;H+=1){const z=a.value[H],ae=document.getElementById(z.id);if(ae){const re=A(ae);re+ae.offsetHeight>te&&re<le&&(R=z.id)}}!R&&r.value&&(R=r.value),R&&(r.value=R);const S=D?D.scrollHeight-D.clientHeight:document.documentElement.scrollHeight-window.innerHeight;te+5>=S&&(R=a.value[a.value.length-1].id),R&&(o.value=R)}function P(){s.value&&(y&&window.cancelAnimationFrame(y),y=window.requestAnimationFrame(()=>{j(),y=0}))}function G(D){if(!s.value)return;const te=document.getElementById(D);if(!te)return;const K=b,le=Math.max(0,A(te));K?K.scrollTo({top:le,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:le,behavior:"smooth"})}return t({refresh:u}),(D,te)=>s.value&&a.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(d.value)},[e.createElementVNode("h2",lc,e.toDisplayString(D.title),1),e.createElementVNode("div",ac,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,K=>(e.openBlock(),e.createElementBlock("div",{key:K.id,class:e.normalizeClass(["vs-compact-form-navigation__item relative",K.level===2?"vs-compact-form-navigation__item--nested":"",K.id===o.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick:le=>G(K.id),class:e.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",K.level===2?"pl-[15px]":"pl-[18px]",K.id===o.value?"text-gray-800":"text-gray-500"])},[e.createElementVNode("span",null,e.toDisplayString(K.text),1)],10,oc)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-1584a562"]]),Fe={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон",minlength:l=>`Мінімальна довжина — ${l} символів`,maxlength:l=>`Максимальна довжина — ${l} символів`},sc=l=>typeof l=="string"?l.trim()?!1:Fe.required:Array.isArray(l)?l.map(n=>typeof n=="string"?n.trim():n).filter(n=>n!=null&&n!=="").length?!1:Fe.required:l?!1:Fe.required,ic=l=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return l?t.test(l)?!1:Fe.email:!1},dc=l=>{const t=/^\+[1-9]\d{1,14}$/;return l?t.test(l)?!1:Fe.tel:!1},vn=l=>l==null?0:typeof l=="string"?l.trim().length:Array.isArray(l)?l.length:typeof l=="number"?l.toString().length:String(l).length,cc=(l,t)=>{if(l==null)return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&vn(l)<n?t?.message||Fe.minlength(n):!1},uc=(l,t)=>{if(l==null||l==="")return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&vn(l)>n?t?.message||Fe.maxlength(n):!1},pc=(l,t)=>{const n=t.pattern??t.regexp,a=typeof n=="string"?new RegExp(n):n;if(Array.isArray(l)){const o=l.filter(Boolean);return o.length===0||o.every(r=>a.test(r))?!1:t.message}return!a.test(l)&&l?t.message:!1},mc=(l,t)=>!1,hc=(l,t)=>{switch(typeof t=="string"?t:t.type){case"required":return sc(l);case"email":return ic(l);case"tel":return dc(l);case"regexp":return pc(l,t);case"minlength":return cc(l,t);case"maxlength":return uc(l,t);case"custom":return mc();default:return!1}},fc={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function Bn(l){const t=l?.toLowerCase();return fc[t]||t}function Lt(l,t=!1){if(Array.isArray(l)){const a=[];return l.forEach(o=>{const r={...o};r.name=(o.name||o.id||o.key||"").toString(),r.type=Bn(o.type),r.label=o.label||o.ua,r.rules=o.rules||o.validators,r.type==="email"&&!r.rules&&(r.rules=["email"]),o.data&&(r.api=`/api/suggest/${o.data}`),r.disabled=r.disabled||t,Array.isArray(r.schema)&&(r.schema=Lt(r.schema,r.disabled)),a.push(r)}),a}const n=[];return Object.entries(l).forEach(a=>{const o={name:a[0],...a[1],type:Bn(a[1].type),label:a[1].label||a[1].ua,rules:a[1].rules||a[1].validators,disabled:a[1].disabled||t};o.type==="email"&&!o.rules&&(o.rules=["email"]),a[1].type?.includes("list")&&(o.multiple=!0),!o.api&&a[1].data&&(o.api=`/api/suggest/${a[1].data}`),Array.isArray(o.schema)&&(o.schema=Lt(o.schema,o.disabled)),n.push(o)}),n}function gc(l,t,n=!1){const a=e.computed(()=>Lt((Array.isArray(t),t),typeof n=="boolean"?n:n.value)),o=e.ref({});function r(c){const h=c?.conditions;if(!h)return!0;const y=Array.isArray(h)?h[0]:h,_=l?.value?.[y];return rn(_,h)}const s=(c=a.value,h=!0)=>(c.forEach(y=>{const _=[],b=Number(y?.minlength),B=Number(y?.maxlength);!Number.isNaN(b)&&Number.isFinite(b)&&_.push({type:"minlength",value:b}),!Number.isNaN(B)&&Number.isFinite(B)&&_.push({type:"maxlength",value:B});const g=[..._,...y.rules||[]];if(g.length){if(!r(y)){delete o.value[y.name];return}let k=!1,w=null;g.forEach(u=>{const x=hc(l.value[y.name],u);x&&(k=!0,!w&&typeof x=="string"&&(w=x))}),k&&w?o.value[y.name]=w:delete o.value[y.name]}y.schema&&s(y.schema,!1)}),h&&Object.values(o.value).some(Boolean)?o.value:null),i=e.computed(()=>a.value?.filter(c=>c.hidden!==!0&&r(c)));return{errors:o,validate:s,reset:()=>{l.value={},o.value={}},visibleSchema:i}}const yc={class:"flex w-full h-full min-h-0 gap-6"},kc={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},Ce=e.defineComponent({__name:"vs-compact-form",props:e.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:e.mergeModels(["handle-submit","update:modelValue","value-selected"],["update:form","update:values"]),setup(l,{expose:t,emit:n}){const a=n,o=l,r=e.useModel(l,"form"),s=e.useModel(l,"values"),{errors:i,validate:d,reset:c,visibleSchema:h}=gc(s,o.schema,e.toRef(o,"disabled")),y=e.ref(null),_=e.ref(null),b=e.computed(()=>o.navigation),B=e.computed(()=>o.navWidth),g=e.computed(()=>o.style?.columns),k=Object.freeze({container:12,label:3}),w=e.computed(()=>o.columns??g.value??k),u=e.computed(()=>o.columns!=null||g.value!=null),x=e.computed(()=>u.value?"horizontal":o.layout),f=P=>P?.columns?"horizontal":x.value,V=P=>P?.columns??w.value,M=()=>{a("update:modelValue",s.value),d(),a("handle-submit",s.value)},A=P=>{a("value-selected",P)};t({validate:d,reset:c,errors:i}),e.onMounted(()=>{o.modelValue&&(s.value=o.modelValue),r.value={value:s.value,errors:i.value,reset:c,validate:d,formId:o.formId}});function j(P,G){if(P===G)return!0;if(typeof P!="object"||typeof G!="object"||!P||!G)return!1;const D=Object.keys(P),te=Object.keys(G);return D.length!==te.length?!1:D.every(K=>P[K]===G[K])}return e.provide("form",r),e.provide("values",s),(P,G)=>(e.openBlock(),e.createElementBlock("div",yc,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:_},[e.createElementVNode("form",{ref_key:"formRef",ref:y,onSubmit:e.withModifiers(M,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",x.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(h),(D,te)=>(e.openBlock(),e.createElementBlock("div",{key:D.name,class:e.normalizeClass(f(D)==="horizontal"?"col-span-12":`col-span-${D.col||12}`)},[e.createVNode(Vn,{style:e.normalizeStyle(P.style),item:D,layout:f(D),columns:V(D),"model-value":s.value[D.name],"onUpdate:modelValue":K=>{const le=s.value[D.name];j(le,K)||(s.value[D.name]=K)},error:e.unref(i)[D.name],onValueSelected:A},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),f(D)==="settings"&&te+1!==e.unref(h).length?(e.openBlock(),e.createElementBlock("div",kc)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(rc,{target:y.value,"scroll-container":_.value,enabled:b.value,width:B.value},null,8,["target","scroll-container","enabled","width"])]))}}),bc={class:"relative"},wc={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},xc={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"},_c={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},Ec={class:"font-medium text-gray-800 dark:text-[#ffffff]"},Vc={class:"p-4 mim-h-0 h-full overflow-auto"},Cn=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(l,{emit:t}){const n=l,a=t,o=e.ref(n.schema),r=e.ref(n.defaultValue?JSON.parse(JSON.stringify(n.defaultValue)):{}),s=e.ref({}),i=e.ref(n.token||""),d=e.ref(n.mode);async function c(){const y=s.value.validate();if(y){se.notify({type:"warning",title:"Помилка валідації",message:Object.entries(y).map(([_,b])=>`${_}: ${b}`).join(`
3
+ `)});return}if(i.value)try{const _=await fetch(`/api/table/${i.value}`,{method:d.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r.value)});if(_.ok)await _.json(),se.notify({type:"success",title:"Успішно",message:`Дані успішно ${d.value==="add"?"збережено":"оновлено"}`}),a("save",r.value);else if(_.status===400){const b=await _.json().catch(()=>({}));se.notify({type:"warning",title:"Помилка валідації",message:b.message||"Некоректні дані (400)"})}else _.status===500?se.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):se.notify({type:"error",title:"Помилка",message:`Статус: ${_.status}`})}catch(_){se.notify({type:"error",title:"Помилка з’єднання",message:_.message||"Не вдалося виконати запит"})}else a("edit",r.value),h()}function h(){a("close")}return e.onMounted(async()=>{try{if(n.form&&!n.schema){const y=await fetch(`/api/template/form/${n.form}`);if(!y.ok){se.notify({type:y.status>=400&&y.status<500?"warning":"error",title:"Error",message:`Error code: ${y.status}`});return}const _=await y.json();o.value=_.schema,i.value=_.token}else if(n.token&&!n.defaultValue){i.value=n.token;const y=await fetch(`/api/form/${i.value}`);if(!y.ok){se.notify({type:y.status>=400&&y.status<500?"warning":"error",title:"Error",message:`Error code: ${y.status}`});return}const _=await y.json();o.value=_.schema,_.data?r.value=_.data:d.value="add",_.obj&&(r.value={...r.value,..._.obj})}}catch(y){se.notify({type:"error",title:"Error",message:y.message||"Unexpected error"}),console.error(y)}}),(y,_)=>(e.openBlock(),e.createElementBlock("div",bc,[e.createElementVNode("div",wc,[e.createElementVNode("div",xc,[e.createElementVNode("div",_c,[e.createElementVNode("h3",Ec,e.toDisplayString(d.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:h,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"},_[2]||(_[2]=[e.createElementVNode("span",{class:"sr-only"},"Close",-1),e.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"},[e.createElementVNode("path",{d:"M18 6 6 18"}),e.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),e.createElementVNode("div",Vc,[o.value?(e.openBlock(),e.createBlock(Ce,{key:0,schema:o.value,values:r.value,"onUpdate:values":_[0]||(_[0]=b=>r.value=b),form:s.value,"onUpdate:form":_[1]||(_[1]=b=>s.value=b)},null,8,["schema","values","form"])):e.createCommentVNode("",!0)]),e.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"},[e.createElementVNode("button",{type:"button",onClick:h,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"}," Скасувати "),e.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"}," Зберегти ")])])])]))}}),vc=1440*60*1e3,Bc=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],Cc=["січ","лют","бер","квіт","трав","черв","лип","серп","вер","жовт","лист","груд"],Nc=["нд","пн","вт","ср","чт","пт","сб"];function ce(l){return l instanceof Date&&!Number.isNaN(l.getTime())}const Pe=l=>new Date(l.getTime());function Le(l){const t=Pe(l);return t.setHours(0,0,0,0),t}function Ke(l){const t=Pe(l);return t.setHours(23,59,59,999),t}function Tt(l){return Le(new Date(l.getFullYear(),l.getMonth(),1))}function It(l){return Ke(new Date(l.getFullYear(),l.getMonth()+1,0))}function Ot(l,t){const n=new Date(l),a=n.getDate();n.setDate(1),n.setMonth(n.getMonth()+t);const o=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();return n.setDate(Math.min(a,o)),n}function Mc(l,t){return Ot(l,-1)}function it(l,t){const n=new Date(l);return n.setFullYear(n.getFullYear()+t),n}function Nn(l,t){return it(l,-t)}function Mn(l){return Le(new Date(l.getFullYear(),0,1))}function Sn(l){return Ke(new Date(l.getFullYear(),11,31))}function Sc(l){const t=Math.floor(l.getFullYear()/10)*10;return Le(new Date(t,0,1))}function $c(l){const t=Math.floor(l.getFullYear()/10)*10+9;return Ke(new Date(t,11,31))}const we=l=>l.getFullYear(),dt=l=>Math.floor(l.getFullYear()/10)*10;function Dc(l){const t=[];let n=Le(l.start);const a=Le(l.end);for(;n<=a;)t.push(Pe(n)),n=new Date(n.getTime()+vc);return t}function Ac(l){const t=[];let n=Tt(l.start);const a=It(l.end);for(;n<=a;)t.push(Pe(n)),n=Ot(n,1);return t}function Fc(l){const t=[];let n=Mn(l.start);const a=Sn(l.end);for(;n<=a;)t.push(Pe(n)),n=it(n,1);return t}function Rt(l,t=1){const n=Le(l),a=(n.getDay()-t+7)%7;return n.setDate(n.getDate()-a),n}function Lc(l,t=1){const n=Rt(l,t);return n.setDate(n.getDate()+6),Ke(n)}function Tc(l,t,n=0){const a=Rt(l,n),o=(t-n+7)%7;return a.setDate(a.getDate()+o),a}const ct=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth()&&l.getDate()===t.getDate(),zt=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth(),$n=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear(),Dn=(l,t)=>!!l&&!!t&&ct(l,t)&&l.getHours()===t.getHours(),Ic=(l,t)=>!!l&&!!t&&Dn(l,t)&&l.getMinutes()===t.getMinutes();function Oc(l,t){const n=l.getTime();return n>=t.start.getTime()&&n<=t.end.getTime()}const Ye=(l,t)=>!!l&&!!t&&l.getTime()<t.getTime(),We=(l,t)=>!!l&&!!t&&l.getTime()>t.getTime();function Rc(l){const t=l.filter(n=>ce(n));if(t.length)return t.reduce((n,a)=>n.getTime()>=a.getTime()?n:a)}function zc(l){const t=l.filter(n=>ce(n));if(t.length)return t.reduce((n,a)=>n.getTime()<=a.getTime()?n:a)}function An(l,t){const n=Pe(l);return typeof t.year=="number"&&n.setFullYear(t.year),typeof t.month=="number"&&n.setMonth(t.month),typeof t.date=="number"&&n.setDate(t.date),typeof t.hours=="number"&&n.setHours(t.hours),typeof t.minutes=="number"&&n.setMinutes(t.minutes),typeof t.seconds=="number"&&n.setSeconds(t.seconds),typeof t.milliseconds=="number"&&n.setMilliseconds(t.milliseconds),n}const ut=(l,t=2)=>String(l).padStart(t,"0");function Fn(l,t){return t==="wide"?Bc[l]:Cc[l]}function jc(l){return Nc[l]}const Pc=[{token:"LLLL",format:l=>Fn(l.getMonth(),"wide")},{token:"LLL",format:l=>Fn(l.getMonth(),"abbreviated")},{token:"EE",format:l=>jc(l.getDay())},{token:"yyyy",format:l=>String(l.getFullYear())},{token:"MM",format:l=>ut(l.getMonth()+1)},{token:"dd",format:l=>ut(l.getDate())},{token:"HH",format:l=>ut(l.getHours())},{token:"mm",format:l=>ut(l.getMinutes())}];function pt(l,t){if(!ce(l))return"";let n="",a=0;for(;a<t.length;){const o=Pc.find(r=>t.startsWith(r.token,a));o?(n+=o.format(l),a+=o.token.length):(n+=t[a],a+=1)}return n}const Uc={"yyyy-MM-dd":/^(\d{4})-(\d{2})-(\d{2})$/,"dd.MM.yyyy":/^(\d{2})\.(\d{2})\.(\d{4})$/,"dd.MM.yyyy HH:mm":/^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2})$/,"HH:mm":/^(\d{2}):(\d{2})$/,"MM.yyyy":/^(\d{2})\.(\d{4})$/,yyyy:/^(\d{4})$/};function Ln(l,t){const n=Uc[t];if(!n){const o=new Date(l);return ce(o)?o:null}const a=l.match(n);if(!a)return null;switch(t){case"yyyy-MM-dd":{const[,o,r,s]=a,i=new Date(Number(o),Number(r)-1,Number(s));return ce(i)?i:null}case"dd.MM.yyyy":{const[,o,r,s]=a,i=new Date(Number(s),Number(r)-1,Number(o));return ce(i)?i:null}case"dd.MM.yyyy HH:mm":{const[,o,r,s,i,d]=a,c=new Date(Number(s),Number(r)-1,Number(o),Number(i),Number(d));return ce(c)?c:null}case"HH:mm":{const[,o,r]=a,s=new Date;return s.setHours(Number(o),Number(r),0,0),s}case"MM.yyyy":{const[,o,r]=a;return new Date(Number(r),Number(o)-1,1)}case"yyyy":{const[,o]=a;return new Date(Number(o),0,1)}default:return null}}const Hc=["year","month","day","time","custom"],qc=e.defineComponent({emits:{elementClick:l=>ce(l),left:()=>!0,right:()=>!0,heading:()=>!0},props:{headingClickable:{type:Boolean,default:!1},leftDisabled:{type:Boolean,default:!1},rightDisabled:{type:Boolean,default:!1},columnCount:{type:Number,default:7},items:{type:Array,default:()=>[]},viewMode:{type:String,required:!0,validate:l=>typeof l=="string"&&Hc.includes(l)}}}),Gc={class:"v3dp__heading"},Kc=["disabled"],Yc=["disabled"],Wc={class:"v3dp__body"},Zc={class:"v3dp__subheading"},Jc={class:"v3dp__elements"},Xc=["disabled","onClick"];function Qc(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["v3dp__popout",`v3dp__popout-${l.viewMode}`]),style:e.normalizeStyle({"--popout-column-definition":`repeat(${l.columnCount}, 1fr)`}),onMousedown:t[3]||(t[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Gc,[e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__left",disabled:l.leftDisabled,onClick:t[0]||(t[0]=e.withModifiers(s=>l.$emit("left"),["stop","prevent"]))},[e.renderSlot(l.$slots,"arrow-left",{},()=>[t[4]||(t[4]=e.createElementVNode("svg",{class:"v3dp__heading__icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 8"},[e.createElementVNode("g",{fill:"none","fill-rule":"evenodd"},[e.createElementVNode("path",{stroke:"none",d:"M-9 16V-8h24v24z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 0L1 4l4 4"})])],-1))],!0)],8,Kc),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.headingClickable?"button":"span"),{class:"v3dp__heading__center",onClick:t[1]||(t[1]=e.withModifiers(s=>l.$emit("heading"),["stop","prevent"]))},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"heading",{},void 0,!0)]),_:3})),e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__right",disabled:l.rightDisabled,onClick:t[2]||(t[2]=e.withModifiers(s=>l.$emit("right"),["stop","prevent"]))},[e.renderSlot(l.$slots,"arrow-right",{},()=>[t[5]||(t[5]=e.createElementVNode("svg",{class:"v3dp__heading__icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 8"},[e.createElementVNode("g",{fill:"none","fill-rule":"evenodd"},[e.createElementVNode("path",{stroke:"none",d:"M15-8v24H-9V-8z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M1 8l4-4-4-4"})])],-1))],!0)],8,Yc)]),e.createElementVNode("div",Wc,["subheading"in l.$slots?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Zc,[e.renderSlot(l.$slots,"subheading",{},void 0,!0)]),t[6]||(t[6]=e.createElementVNode("hr",{class:"v3dp__divider"},null,-1))],64)):e.createCommentVNode("",!0),e.createElementVNode("div",Jc,[e.renderSlot(l.$slots,"body",{},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.items,s=>(e.openBlock(),e.createElementBlock("button",{key:s.key,disabled:s.disabled,class:e.normalizeClass([{selected:s.selected,current:s.current},`v3dp__element__button__${l.viewMode}`]),onClick:e.withModifiers(i=>l.$emit("elementClick",s.value),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(s.display),1)],10,Xc))),128))],!0)])])],38)}const mt=Y(qc,[["render",Qc],["__scopeId","data-v-3b9aea7a"]]),eu=e.defineComponent({components:{PickerPopup:mt},emits:{"update:pageDate":l=>ce(l),select:l=>ce(l)},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(l,{emit:t}){const n=e.computed(()=>Sc(l.pageDate)),a=e.computed(()=>$c(l.pageDate)),o=(y,_,b)=>!_&&!b?!0:!(_&&we(y)<we(_)||b&&we(y)>we(b)),r=e.computed(()=>Fc({start:n.value,end:a.value}).map(y=>({value:y,key:String(we(y)),display:we(y),selected:!!l.selected&&we(y)===we(l.selected),disabled:!o(y,l.lowerLimit,l.upperLimit)}))),s=e.computed(()=>{const y=we(n.value),_=we(a.value);return`${y} - ${_}`}),i=e.computed(()=>l.lowerLimit&&(dt(l.lowerLimit)===dt(l.pageDate)||Ye(l.pageDate,l.lowerLimit))),d=e.computed(()=>l.upperLimit&&(dt(l.upperLimit)===dt(l.pageDate)||We(l.pageDate,l.upperLimit)));return{years:r,heading:s,leftDisabled:i,rightDisabled:d,previousPage:()=>t("update:pageDate",Nn(l.pageDate,10)),nextPage:()=>t("update:pageDate",it(l.pageDate,10))}}});function tu(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{columnCount:3,leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,items:l.years,viewMode:"year",onLeft:l.previousPage,onRight:l.nextPage,onElementClick:t[0]||(t[0]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const nu=Y(eu,[["render",tu]]),lu=e.defineComponent({components:{PickerPopup:mt},emits:{"update:pageDate":l=>ce(l),select:l=>ce(l),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"LLL"},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(l,{emit:t}){const n=e.computed(()=>Mn(l.pageDate)),a=e.computed(()=>Sn(l.pageDate)),o=e.computed(()=>_=>pt(_,l.format)),r=(_,b,B)=>!b&&!B?!0:!(b&&Ye(_,Tt(b))||B&&We(_,It(B))),s=e.computed(()=>Ac({start:n.value,end:a.value}).map(_=>({value:_,display:o.value(_),key:o.value(_),selected:!!l.selected&&zt(l.selected,_),disabled:!r(_,l.lowerLimit,l.upperLimit)}))),i=e.computed(()=>we(n.value)),d=e.computed(()=>l.lowerLimit&&($n(l.lowerLimit,l.pageDate)||Ye(l.pageDate,l.lowerLimit))),c=e.computed(()=>l.upperLimit&&($n(l.upperLimit,l.pageDate)||We(l.pageDate,l.upperLimit)));return{months:s,heading:i,leftDisabled:d,rightDisabled:c,previousPage:()=>t("update:pageDate",Nn(l.pageDate,1)),nextPage:()=>t("update:pageDate",it(l.pageDate,1))}}});function au(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:3,items:l.months,leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,viewMode:"month",onLeft:l.previousPage,onRight:l.nextPage,onHeading:t[0]||(t[0]=i=>l.$emit("back")),onElementClick:t[1]||(t[1]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),_:1},8,["items","leftDisabled","rightDisabled","onLeft","onRight"])}const ou=Y(lu,[["render",au]]),ru=e.defineComponent({components:{PickerPopup:mt},emits:{"update:pageDate":l=>ce(l),select:l=>ce(l),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"dd"},headingFormat:{type:String,required:!1,default:"LLLL yyyy"},weekdayFormat:{type:String,required:!1,default:"EE"},weekStartsOn:{type:Number,required:!1,default:1,validator:l=>typeof l=="number"&&Number.isInteger(l)&&l>=0&&l<=6},customWeekdays:{type:Array,required:!1},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1}},setup(l,{emit:t}){const n=e.computed(()=>k=>w=>pt(w,k)),a=e.computed(()=>Tt(l.pageDate)),o=e.computed(()=>It(l.pageDate)),r=e.computed(()=>({start:a.value,end:o.value})),s=e.computed(()=>({start:Rt(a.value,l.weekStartsOn),end:Lc(o.value,l.weekStartsOn)})),i=e.computed(()=>l.customWeekdays?.length===7?l.customWeekdays:null),d=e.computed(()=>{const k=l.weekStartsOn,w=i.value;if(w)return Array.from({length:7}).map((x,f)=>w[(k+f)%7]);const u=n.value(l.weekdayFormat);return Array.from(Array(7)).map((x,f)=>(k+f)%7).map(x=>Tc(new Date,x,l.weekStartsOn)).map(u)}),c=(k,w,u,x)=>x?.dates?.some(f=>ct(k,f))||x?.predicate?.(k)?!1:!w&&!u?!0:!(w&&Ye(k,Le(w))||u&&We(k,Ke(u))),h=e.computed(()=>{const k=new Date,w=n.value(l.format);return Dc(s.value).map(u=>({value:u,display:w(u),selected:!!l.selected&&ct(l.selected,u),current:ct(k,u),disabled:!l.allowOutsideInterval&&!Oc(u,r.value)||!c(u,l.lowerLimit,l.upperLimit,l.disabledDates),key:n.value("yyyy-MM-dd")(u)}))}),y=e.computed(()=>n.value(l.headingFormat)(l.pageDate)),_=e.computed(()=>l.lowerLimit&&(zt(l.lowerLimit,l.pageDate)||Ye(l.pageDate,l.lowerLimit))),b=e.computed(()=>l.upperLimit&&(zt(l.upperLimit,l.pageDate)||We(l.pageDate,l.upperLimit)));return{weekDays:d,days:h,heading:y,leftDisabled:_,rightDisabled:b,previousPage:()=>t("update:pageDate",Mc(l.pageDate)),nextPage:()=>t("update:pageDate",Ot(l.pageDate,1))}}});function su(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,items:l.days,viewMode:"day",onLeft:l.previousPage,onRight:l.nextPage,onHeading:t[0]||(t[0]=i=>l.$emit("back")),onElementClick:t[1]||(t[1]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),subheading:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.weekDays,(i,d)=>(e.openBlock(),e.createElementBlock("span",{key:i,class:e.normalizeClass(`v3dp__subheading__weekday__${d}`)},e.toDisplayString(i),3))),128))]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const iu=Y(ru,[["render",su]]);function Tn(l,t){const n=l.getBoundingClientRect(),a={height:l.clientHeight,width:l.clientWidth},o=t.getBoundingClientRect();if(!(o.top>=n.top&&o.bottom<=n.top+a.height)){const s=o.top-n.top,i=o.bottom-n.bottom;Math.abs(s)<Math.abs(i)?l.scrollTop+=s:l.scrollTop+=i}}const du=e.defineComponent({components:{PickerPopup:mt},emits:{select:l=>ce(l),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},visible:{type:Boolean,required:!0},disabledTime:{type:Object,required:!1}},setup(l,{emit:t}){const n=e.ref(null),a=e.ref(null),o=e.computed(()=>l.pageDate??l.selected),r=e.ref(o.value.getHours()),s=e.ref(o.value.getMinutes());e.watch(()=>l.selected,b=>{let B=0,g=0;b&&(B=b.getHours(),g=b.getMinutes()),r.value=B,s.value=g});const i=e.computed(()=>[...Array(24).keys()].map(b=>({value:b,date:An(new Date(o.value.getTime()),{hours:b,minutes:s.value,seconds:0}),selected:r.value===b,ref:e.ref(null)}))),d=e.computed(()=>[...Array(60).keys()].map(b=>({value:b,date:An(new Date(o.value.getTime()),{hours:r.value,minutes:b,seconds:0}),selected:s.value===b,ref:e.ref(null)}))),c=b=>{s.value=b.value,t("select",b.date)},h=()=>{const b=i.value.find(g=>g.ref.value?.classList?.contains("selected")??!1),B=d.value.find(g=>g.ref.value?.classList?.contains("selected")??!1);b&&B&&(Tn(n.value,b.ref.value),Tn(a.value,B.ref.value))};return e.watch(()=>l.visible,b=>{b&&e.nextTick(h)}),{hoursListRef:n,minutesListRef:a,hours:r,minutes:s,hoursList:i,minutesList:d,padStartZero:b=>`0${b}`.substr(-2),selectMinutes:c,isEnabled:b=>!(l.disabledTime?.dates?.some(B=>Dn(b,B)&&Ic(b,B))||l.disabledTime?.predicate?.(b)),scroll:h}}}),cu={ref:"hoursListRef",class:"v3dp__column"},uu=["disabled","onClick"],pu={ref:"minutesListRef",class:"v3dp__column"},mu=["disabled","onClick"];function hu(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:2,leftDisabled:!0,rightDisabled:!0,viewMode:"time",onHeading:t[0]||(t[0]=i=>l.$emit("back"))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.padStartZero(l.hours))+":"+e.toDisplayString(l.padStartZero(l.minutes)),1)]),body:e.withCtx(()=>[e.createElementVNode("div",cu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.hoursList,i=>(e.openBlock(),e.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:e.normalizeClass([{selected:i.selected},"v3dp__element_button__hour"]),disabled:!l.isEnabled(i.date),onClick:e.withModifiers(d=>l.hours=i.value,["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,uu))),128))],512),e.createElementVNode("div",pu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.minutesList,i=>(e.openBlock(),e.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:e.normalizeClass([{selected:i.selected},"v3dp__element_button__minute"]),disabled:!l.isEnabled(i.date),onClick:e.withModifiers(d=>l.selectMinutes(i),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,mu))),128))],512)]),_:1})}const fu=Y(du,[["render",hu],["__scopeId","data-v-c075af58"]]),ht=["time","day","month","year"],gu=(l,t,n=void 0)=>{let a=n||new Date;const o=Rc([l,a]);o&&(a=o);const r=zc([t,a]);return r&&(a=r),a},yu=e.defineComponent({components:{YearPicker:nu,MonthPicker:ou,DayPicker:iu,TimePicker:fu},inheritAttrs:!1,props:{placeholder:{type:String,default:""},modelValue:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1},disabledTime:{type:Object,required:!1},upperLimit:{type:Date,required:!1},lowerLimit:{type:Date,required:!1},startingView:{type:String,required:!1,default:"day",validate:l=>typeof l=="string"&&ht.includes(l)},startingViewDate:{type:Date,required:!1,default:()=>new Date},dayPickerHeadingFormat:{type:String,required:!1,default:"LLLL yyyy"},monthListFormat:{type:String,required:!1,default:"LLL"},weekdayFormat:{type:String,required:!1,default:"EE"},dayFormat:{type:String,required:!1,default:"dd"},inputFormat:{type:String,required:!1,default:"yyyy-MM-dd"},weekDayNames:{type:Array,required:!1},weekStartsOn:{type:Number,required:!1,default:1,validator:l=>[0,1,2,3,4,5,6].includes(l)},disabled:{type:Boolean,required:!1,default:!1},clearable:{type:Boolean,required:!1,default:!1},typeable:{type:Boolean,required:!1,default:!1},minimumView:{type:String,required:!1,default:"day",validate:l=>typeof l=="string"&&ht.includes(l)}},emits:{"update:modelValue":l=>l==null||ce(l),decadePageChanged:l=>!0,yearPageChanged:l=>!0,monthPageChanged:l=>!0,opened:()=>!0,closed:()=>!0},setup(l,{emit:t,attrs:n}){const a=e.ref("none"),o=e.ref(l.startingViewDate),r=e.ref(null),s=e.ref(!1),i=e.ref(""),d=R=>{const S=R.replace(/[a-zA-Z]/g,"0");return/0/.test(S)?S:""},c=e.computed(()=>d(l.inputFormat));let h=null,y=null;const _=()=>{h?.destroy(),h=null},b=async()=>{if(!y){const{default:R}=await Promise.resolve().then(()=>qt);y=R}return y},B=()=>{h&&h.value!==i.value&&(h.value=i.value??"")},g=async()=>{if(_(),!r.value||!c.value)return;h=(await b())(r.value,{mask:c.value,lazy:!0,overwrite:!0}),B()};e.watchEffect(()=>{if(!i.value)return;const R=Ln(i.value,l.inputFormat);R&&(o.value=R)}),e.watchEffect(()=>{i.value=l.modelValue&&ce(l.modelValue)?pt(l.modelValue,l.inputFormat):""}),e.onMounted(()=>{c.value&&e.nextTick(()=>{g()})}),e.onBeforeUnmount(()=>{_()}),e.watch(c,R=>{R?e.nextTick(()=>{g()}):_()}),e.watch(i,()=>{B()});const k=(R="none")=>{l.disabled||(R!=="none"&&a.value==="none"&&(o.value=l.modelValue||gu(l.lowerLimit,l.upperLimit,o.value)),a.value=R,t(R!=="none"?"opened":"closed"))};e.watchEffect(()=>{l.disabled&&(a.value="none")});const w=(R,S)=>{o.value=S,R==="year"?t("decadePageChanged",S):R==="month"?t("yearPageChanged",S):R==="day"&&t("monthPageChanged",S)},u=R=>{o.value=R,l.minimumView==="year"?(k("none"),t("update:modelValue",R)):a.value="month"},x=R=>{o.value=R,l.minimumView==="month"?(k("none"),t("update:modelValue",R)):a.value="day"},f=R=>{o.value=R,l.minimumView==="day"?(k("none"),t("update:modelValue",R)):a.value="time"},V=R=>{k("none"),t("update:modelValue",R)},M=()=>{l.clearable&&(k("none"),t("update:modelValue",null),o.value=l.startingViewDate)},A=()=>s.value=!0,j=()=>k(D.value),P=()=>{s.value=!1,k()},G=R=>{const S=R.keyCode?R.keyCode:R.which;if([27,13].includes(S)&&r.value.blur(),l.typeable){const z=Ln(r.value.value,l.inputFormat);z&&i.value===pt(z,l.inputFormat)&&(i.value=r.value.value,t("update:modelValue",z))}},D=e.computed(()=>{const R=ht.indexOf(l.startingView),S=ht.indexOf(l.minimumView);return R<S?l.minimumView:l.startingView}),te=R=>Object.fromEntries(Object.entries(R??{}).filter(([S,H])=>S.startsWith("--"))),K=e.computed(()=>l.weekDayNames?.length===7?l.weekDayNames:void 0);return{blur:P,focus:j,click:A,input:i,inputRef:r,pageDate:o,renderView:k,updatePageDate:w,selectYear:u,selectMonth:x,selectDay:f,selectTime:V,keyUp:G,normalizedWeekdayNames:K,viewShown:a,goBackFromTimepicker:()=>l.startingView==="time"&&l.minimumView==="time"?null:a.value="day",clearModelValue:M,initialView:D,log:R=>console.log(R),variables:te}}}),ku={class:"v3dp__input_wrapper"},bu=["readonly","placeholder","disabled","tabindex"],wu={class:"v3dp__clearable"};function xu(l,t,n,a,o,r){const s=e.resolveComponent("year-picker"),i=e.resolveComponent("month-picker"),d=e.resolveComponent("day-picker"),c=e.resolveComponent("time-picker");return e.openBlock(),e.createElementBlock("div",{class:"v3dp__datepicker",style:e.normalizeStyle(l.variables(l.$attrs.style))},[e.createElementVNode("div",ku,[e.withDirectives(e.createElementVNode("input",e.mergeProps({type:"text",ref:"inputRef",readonly:!l.typeable,"onUpdate:modelValue":t[0]||(t[0]=h=>l.input=h)},l.$attrs,{placeholder:l.placeholder,disabled:l.disabled,tabindex:l.disabled?-1:0,onKeyup:t[1]||(t[1]=(...h)=>l.keyUp&&l.keyUp(...h)),onBlur:t[2]||(t[2]=(...h)=>l.blur&&l.blur(...h)),onFocus:t[3]||(t[3]=(...h)=>l.focus&&l.focus(...h)),onClick:t[4]||(t[4]=(...h)=>l.click&&l.click(...h))}),null,16,bu),[[e.vModelText,l.input]]),e.withDirectives(e.createElementVNode("div",wu,[e.renderSlot(l.$slots,"clear",{onClear:l.clearModelValue},()=>[e.createElementVNode("i",{onClick:t[5]||(t[5]=h=>l.clearModelValue())},"x")])],512),[[e.vShow,l.clearable&&l.modelValue]])]),e.withDirectives(e.createVNode(s,{pageDate:l.pageDate,"onUpdate:pageDate":t[6]||(t[6]=h=>l.updatePageDate("year",h)),selected:l.modelValue,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,onSelect:l.selectYear},null,8,["pageDate","selected","lowerLimit","upperLimit","onSelect"]),[[e.vShow,l.viewShown==="year"]]),e.withDirectives(e.createVNode(i,{pageDate:l.pageDate,"onUpdate:pageDate":t[7]||(t[7]=h=>l.updatePageDate("month",h)),selected:l.modelValue,onSelect:l.selectMonth,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,format:l.monthListFormat,onBack:t[8]||(t[8]=h=>l.viewShown="year")},null,8,["pageDate","selected","onSelect","lowerLimit","upperLimit","format"]),[[e.vShow,l.viewShown==="month"]]),e.withDirectives(e.createVNode(d,{pageDate:l.pageDate,"onUpdate:pageDate":t[9]||(t[9]=h=>l.updatePageDate("day",h)),selected:l.modelValue,weekStartsOn:l.weekStartsOn,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,headingFormat:l.dayPickerHeadingFormat,disabledDates:l.disabledDates,weekdayFormat:l.weekdayFormat,"allow-outside-interval":l.allowOutsideInterval,format:l.dayFormat,"custom-weekdays":l.normalizedWeekdayNames,onSelect:l.selectDay,onBack:t[10]||(t[10]=h=>l.viewShown="month")},null,8,["pageDate","selected","weekStartsOn","lowerLimit","upperLimit","headingFormat","disabledDates","weekdayFormat","allow-outside-interval","format","custom-weekdays","onSelect"]),[[e.vShow,l.viewShown==="day"]]),e.withDirectives(e.createVNode(c,{pageDate:l.pageDate,visible:l.viewShown==="time",selected:l.modelValue,disabledTime:l.disabledTime,onSelect:l.selectTime,onBack:l.goBackFromTimepicker},null,8,["pageDate","visible","selected","disabledTime","onSelect","onBack"]),[[e.vShow,l.viewShown==="time"]])],4)}const _u=Y(yu,[["render",xu]]),Eu=Y(e.defineComponent({__name:"vs-input-date2",props:{clearable:{type:Boolean,default:!0},now:{type:Boolean},editable:{type:Boolean,default:!0},time:{type:Boolean},isInfinity:{type:Boolean},mode:{default:"date"},weekStart:{},dayNames:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,{inputClass:o}=he(n.style),r=e.computed(()=>n.mode?n.mode:n.time?"datetime":"date"),s={date:"дд.мм.рррр",datetime:"дд.мм.рррр гг:хх",month:"мм.рррр",week:"рррр-тиждень",time:"гг:хх",year:"рррр"},i=e.computed(()=>n.placeholder||s[r.value]||""),d=e.computed(()=>["py-1.5 px-3 block w-full placeholder:text-[#767f8f] bg-white",o.value,n.customClass,{"!border-red-600":n.error}]),c=e.computed(()=>!n.modelValue&&n.now?new Date:null),h=e.computed({get:()=>x(n.modelValue??c.value,r.value)||void 0,set:S=>a("update:modelValue",f(S,r.value))}),y=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],_=e.computed(()=>{if(n.dayNames?.length)return n.dayNames.length===7?n.dayNames:y}),b=e.computed(()=>{const S=n.weekStart,H=typeof S=="string"?Number(S):S;return H===void 0||Number.isNaN(H)?1:Math.min(6,Math.max(0,H))}),B=e.computed(()=>{switch(r.value){case"time":return{startingView:"time",minimumView:"time"};case"month":return{startingView:"month",minimumView:"month"};case"year":return{startingView:"year",minimumView:"year"};case"datetime":return{startingView:"day",minimumView:"time"};default:return{startingView:"day",minimumView:"day"}}}),g={date:"dd.MM.yyyy",datetime:"dd.MM.yyyy HH:mm",month:"MM.yyyy",time:"HH:mm",week:"dd.MM.yyyy",year:"yyyy"},k=e.computed(()=>g[r.value]||"dd.MM.yyyy"),w=e.computed(()=>({"--vdp-selected-bg-color":n.style?.primaryColor||"#2563eb","--vdp-hover-bg-color":n.style?.primaryColor||"#2563eb","--vdp-selected-color":"#ffffff","--vdp-hover-color":"#ffffff","--vdp-border-radius":n.style?.size==="sm"?"6px":"8px","--vdp-elem-font-size":n.style?.size==="sm"?"0.75em":"0.85em"})),u=e.ref(!1);e.watch(()=>n.modelValue,S=>{S?u.value=!0:n.now||(u.value=!1)},{immediate:!0}),e.watchEffect(()=>{n.now&&!n.modelValue&&!u.value&&(a("update:modelValue",f(new Date,r.value)),u.value=!0)});function x(S,H){if(!S)return null;if(S instanceof Date&&!Number.isNaN(S.getTime()))return S;if(typeof S!="string")return null;switch(H){case"datetime":return j(S);case"time":return D(S);case"month":return P(S);case"year":return G(S);case"week":return te(S);case"date":default:return A(S)}}function f(S,H){if(!S)return null;const z=S instanceof Date?S:x(S,H);if(!z)return null;switch(H){case"datetime":return`${V(z)}T${M(z)}`;case"time":return M(z);case"month":return`${z.getFullYear()}-${R(z.getMonth()+1)}`;case"year":return`${z.getFullYear()}`;case"week":{const{year:ae,week:re}=K(z);return`${ae}-W${R(re)}`}case"date":default:return V(z)}}function V(S){return`${S.getFullYear()}-${R(S.getMonth()+1)}-${R(S.getDate())}`}function M(S){return`${R(S.getHours())}:${R(S.getMinutes())}`}function A(S){const H=S.split("-");if(H.length<3)return null;const[z,ae,re]=H.map(Number);return!z||!ae||!re?null:new Date(z,ae-1,re)}function j(S){const H=S.includes("T")?S:S.replace(" ","T"),z=new Date(H);return Number.isNaN(z.getTime())?null:z}function P(S){const[H,z]=S.split("-").map(Number);return!H||Number.isNaN(z)?null:new Date(H,(z||1)-1,1)}function G(S){const H=Number(S);return H?new Date(H,0,1):null}function D(S){const H=S.match(/^(\d{1,2}):(\d{2})$/);if(!H)return null;const[,z,ae]=H,re=new Date;return re.setHours(Number(z),Number(ae),0,0),re}function te(S){const H=S.match(/^(\d{4})-W(\d{2})$/);if(!H)return null;const[,z,ae]=H,re=Number(ae);return le(Number(z),re)}function K(S){const H=new Date(Date.UTC(S.getFullYear(),S.getMonth(),S.getDate())),z=H.getUTCDay()||7;H.setUTCDate(H.getUTCDate()+4-z);const ae=new Date(Date.UTC(H.getUTCFullYear(),0,1)),re=Math.ceil(((H.getTime()-ae.getTime())/864e5+1)/7);return{year:H.getUTCFullYear(),week:re}}function le(S,H){if(!S||!H)return null;const z=new Date(S,0,1+(H-1)*7),ae=z.getDay(),re=z;return ae<=4?re.setDate(z.getDate()-z.getDay()+1):re.setDate(z.getDate()+8-z.getDay()),re}function R(S){return String(S).padStart(2,"0")}return(S,H)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vs-date-picker",n.customClass]),style:e.normalizeStyle(w.value)},[e.createVNode(_u,{modelValue:h.value,"onUpdate:modelValue":H[0]||(H[0]=z=>h.value=z),placeholder:i.value,disabled:n.disabled,clearable:n.clearable,typeable:n.editable,"week-day-names":_.value,"week-starts-on":b.value,"starting-view":B.value.startingView,"minimum-view":B.value.minimumView,"input-format":k.value,name:n.name,class:e.normalizeClass(d.value)},null,8,["modelValue","placeholder","disabled","clearable","typeable","week-day-names","week-starts-on","starting-view","minimum-view","input-format","name","class"])],6))}}),[["__scopeId","data-v-a65a2ac3"]]),In=(l={mode:"edit",schema:null})=>new Promise(t=>{const{close:n}=se.modal({title:l.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Cn,contentProps:{...l,onClose:()=>{t(null),n()},onSave:a=>{t(a),n()}}})});Ce.install=function(t){t.component("VForm",Ce),Object.assign(t.config.globalProperties,{$form:In}),t.provide("form",In),window.v3plugin||(window.v3plugin={})};function De(l){return typeof l=="string"||l instanceof String}function On(l){var t;return typeof l=="object"&&l!=null&&(l==null||(t=l.constructor)==null?void 0:t.name)==="Object"}function Rn(l,t){return Array.isArray(t)?Rn(l,(n,a)=>t.includes(a)):Object.entries(l).reduce((n,a)=>{let[o,r]=a;return t(r,o)&&(n[o]=r),n},{})}const q={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function zn(l){switch(l){case q.LEFT:return q.FORCE_LEFT;case q.RIGHT:return q.FORCE_RIGHT;default:return l}}function jt(l){return l.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function ft(l,t){if(t===l)return!0;const n=Array.isArray(t),a=Array.isArray(l);let o;if(n&&a){if(t.length!=l.length)return!1;for(o=0;o<t.length;o++)if(!ft(t[o],l[o]))return!1;return!0}if(n!=a)return!1;if(t&&l&&typeof t=="object"&&typeof l=="object"){const r=t instanceof Date,s=l instanceof Date;if(r&&s)return t.getTime()==l.getTime();if(r!=s)return!1;const i=t instanceof RegExp,d=l instanceof RegExp;if(i&&d)return t.toString()==l.toString();if(i!=d)return!1;const c=Object.keys(t);for(o=0;o<c.length;o++)if(!Object.prototype.hasOwnProperty.call(l,c[o]))return!1;for(o=0;o<c.length;o++)if(!ft(l[c[o]],t[c[o]]))return!1;return!0}else if(t&&l&&typeof t=="function"&&typeof l=="function")return t.toString()===l.toString();return!1}class Vu{constructor(t){for(Object.assign(this,t);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?q.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?q.RIGHT:q.LEFT}}function J(l,t){return new J.InputMask(l,t)}function jn(l){if(l==null)throw new Error("mask property should be defined");return l instanceof RegExp?J.MaskedRegExp:De(l)?J.MaskedPattern:l===Date?J.MaskedDate:l===Number?J.MaskedNumber:Array.isArray(l)||l===Array?J.MaskedDynamic:J.Masked&&l.prototype instanceof J.Masked?l:J.Masked&&l instanceof J.Masked?l.constructor:l instanceof Function?J.MaskedFunction:(console.warn("Mask not found for mask",l),J.Masked)}function Ue(l){if(!l)throw new Error("Options in not defined");if(J.Masked){if(l.prototype instanceof J.Masked)return{mask:l};const{mask:t=void 0,...n}=l instanceof J.Masked?{mask:l}:On(l)&&l.mask instanceof J.Masked?l:{};if(t){const a=t.mask;return{...Rn(t,(o,r)=>!r.startsWith("_")),mask:t.constructor,_mask:a,...n}}}return On(l)?{...l}:{mask:l}}function _e(l){if(J.Masked&&l instanceof J.Masked)return l;const t=Ue(l),n=jn(t.mask);if(!n)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===n&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new n(t)}J.createMask=_e;class gt{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return t??this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return t??this.value.length}select(t,n){if(!(t==null||n==null||t===this.selectionStart&&n===this.selectionEnd))try{this._unsafeSelect(t,n)}catch{}}get isActive(){return!1}}J.MaskElement=gt;const Pn=90,vu=89;class Ze extends gt{constructor(t){super(),this.input=t,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 t,n,a;return(t=(n=(a=this.input).getRootNode)==null?void 0:n.call(a))!=null?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){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",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){if(this._handlers.redo&&(t.keyCode===Pn&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===vu&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===Pn&&(t.metaKey||t.ctrlKey))return t.preventDefault(),this._handlers.undo(t);t.isComposing||this._handlers.selectionChange(t)}_onBeforeinput(t){if(t.inputType==="historyUndo"&&this._handlers.undo)return t.preventDefault(),this._handlers.undo(t);if(t.inputType==="historyRedo"&&this._handlers.redo)return t.preventDefault(),this._handlers.redo(t)}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}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={}}}J.HTMLMaskElement=Ze;class Un extends Ze{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,n){this.input.setSelectionRange(t,n)}get value(){return this.input.value}set value(t){this.input.value=t}}J.HTMLMaskElement=Ze;class Pt extends Ze{get _unsafeSelectionStart(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),a=n&&n.anchorOffset,o=n&&n.focusOffset;return o==null||a==null||a<o?a:o}get _unsafeSelectionEnd(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),a=n&&n.anchorOffset,o=n&&n.focusOffset;return o==null||a==null||a>o?a:o}_unsafeSelect(t,n){if(!this.rootElement.createRange)return;const a=this.rootElement.createRange();a.setStart(this.input.firstChild||this.input,t),a.setEnd(this.input.lastChild||this.input,n);const o=this.rootElement,r=o.getSelection&&o.getSelection();r&&(r.removeAllRanges(),r.addRange(a))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}J.HTMLContenteditableMaskElement=Pt;class yt{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>yt.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,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}}yt.MAX_LENGTH=100;class Hn{constructor(t,n){this.el=t instanceof gt?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new Pt(t):new Un(t),this.masked=_e(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new yt,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(t){var n;return t==null||((n=this.masked)==null?void 0:n.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof J.Masked)&&this.masked.constructor===jn(t)){this.masked.updateOptions({mask:t});return}const n=t instanceof J.Masked?t:_e({mask:t});n.unmaskedValue=this.masked.unmaskedValue,this.masked=n}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,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(t,n){const a=this._listeners[t];a&&a.forEach(o=>o(n))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){!this.el||!this.el.isActive||(this.el.select(t,t),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(t){const n=this.masked.unmaskedValue,a=this.masked.value,o=this.masked.rawInputValue,r=this.displayValue,s=this.unmaskedValue!==n||this.value!==a||this._rawInputValue!==o;this._unmaskedValue=n,this._value=a,this._rawInputValue=o,this.el.value!==r&&(this.el.value=r),t==="auto"?this.alignCursor():t!=null&&(this.cursorPos=t),s&&this._fireChangeEvents(),!this._historyChanging&&(s||this.history.isEmpty)&&this.history.push({unmaskedValue:n,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:n,...a}=t,o=!this.maskEquals(n),r=this.masked.optionsIsChanged(a);o&&(this.mask=n),r&&this.masked.updateOptions(a),(o||r)&&this.updateControl()}updateCursor(t){t!=null&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,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,q.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,n){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(n),this}off(t,n){if(!this._listeners[t])return this;if(!n)return delete this._listeners[t],this;const a=this._listeners[t].indexOf(n);return a>=0&&this._listeners[t].splice(a,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const n=new Vu({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),a=this.masked.rawInputValue,o=this.masked.splice(n.startChangePos,n.removed.length,n.inserted,n.removeDirection,{input:!0,raw:!0}).offset,r=a===this.masked.rawInputValue?n.removeDirection:q.NONE;let s=this.masked.nearestInputPos(n.startChangePos+o,r);r!==q.NONE&&(s=this.masked.nearestInputPos(s,q.NONE)),this.updateControl(s),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}J.InputMask=Hn;class Q{static normalize(t){return Array.isArray(t)?t:[t,new Q]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}J.ChangeDetails=Q;class Ee{constructor(t,n,a){t===void 0&&(t=""),n===void 0&&(n=0),this.value=t,this.from=n,this.stop=a}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||t!=null&&this.from>=t)return"";const n=this.value[0];return this.value=this.value.slice(1),n}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class ue{constructor(t){this._value="",this._update({...ue.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,n){n===void 0&&(n={input:!0}),this.reset(),this.append(t,n,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,n){return t}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),Math.min(this.displayValue.length,n-t)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this.displayValue.slice(t,n)}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new Ee(this.extractInput(t,n),t)}appendTail(t){return De(t)&&(t=new Ee(String(t))),t.appendTo(this)}_appendCharRaw(t,n){return t?(this._value+=t,new Q({inserted:t,rawInserted:t})):new Q}_appendChar(t,n,a){n===void 0&&(n={});const o=this.state;let r;if([t,r]=this.doPrepareChar(t,n),t&&(r=r.aggregate(this._appendCharRaw(t,n)),!r.rawInserted&&this.autofix==="pad")){const s=this.state;this.state=o;let i=this.pad(n);const d=this._appendCharRaw(t,n);i=i.aggregate(d),d.rawInserted||i.equals(r)?r=i:this.state=s}if(r.inserted){let s,i=this.doValidate(n)!==!1;if(i&&a!=null){const d=this.state;if(this.overwrite===!0){s=a.state;for(let h=0;h<r.rawInserted.length;++h)a.unshift(this.displayValue.length-r.tailShift)}let c=this.appendTail(a);if(i=c.rawInserted.length===a.toString().length,!(i&&c.inserted)&&this.overwrite==="shift"){this.state=d,s=a.state;for(let h=0;h<r.rawInserted.length;++h)a.shift();c=this.appendTail(a),i=c.rawInserted.length===a.toString().length}i&&c.inserted&&(this.state=d)}i||(r=new Q,this.state=o,a&&s&&(a.state=s))}return r}_appendPlaceholder(){return new Q}_appendEager(){return new Q}append(t,n,a){if(!De(t))throw new Error("value should be string");const o=De(a)?new Ee(String(a)):a;n!=null&&n.tail&&(n._beforeTailState=this.state);let r;[t,r]=this.doPrepare(t,n);for(let s=0;s<t.length;++s){const i=this._appendChar(t[s],n,o);if(!i.rawInserted&&!this.doSkipInvalid(t[s],n,o))break;r.aggregate(i)}return(this.eager===!0||this.eager==="append")&&n!=null&&n.input&&t&&r.aggregate(this._appendEager()),o!=null&&(r.tailShift+=this.appendTail(o).tailShift),r}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(n),new Q}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const n=this.rawInputValue,a=this.value,o=t();return this.rawInputValue=n,this.value&&this.value!==a&&a.indexOf(this.value)===0&&(this.append(a.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,o}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const n=this.state,a=t(this);return this.state=n,delete this._isolated,a}doSkipInvalid(t,n,a){return!!this.skipInvalid}doPrepare(t,n){return n===void 0&&(n={}),Q.normalize(this.prepare?this.prepare(t,this,n):t)}doPrepareChar(t,n){return n===void 0&&(n={}),Q.normalize(this.prepareChar?this.prepareChar(t,this,n):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,n,a,o,r){a===void 0&&(a=""),o===void 0&&(o=q.NONE),r===void 0&&(r={input:!0});const s=t+n,i=this.extractTail(s),d=this.eager===!0||this.eager==="remove";let c;d&&(o=zn(o),c=this.extractInput(0,s,{raw:!0}));let h=t;const y=new Q;if(o!==q.NONE&&(h=this.nearestInputPos(t,n>1&&t!==0&&!d?q.NONE:o),y.tailShift=h-t),y.aggregate(this.remove(h)),d&&o!==q.NONE&&c===this.rawInputValue)if(o===q.FORCE_LEFT){let _;for(;c===this.rawInputValue&&(_=this.displayValue.length);)y.aggregate(new Q({tailShift:-1})).aggregate(this.remove(_-1))}else o===q.FORCE_RIGHT&&i.unshift();return y.aggregate(this.append(a,r,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!ft(this,t)}typedValueEquals(t){const n=this.typedValue;return t===n||ue.EMPTY_VALUES.includes(t)&&ue.EMPTY_VALUES.includes(n)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new Q}}ue.DEFAULTS={skipInvalid:!0},ue.EMPTY_VALUES=[void 0,null,""],J.Masked=ue;class Ae{constructor(t,n){t===void 0&&(t=[]),n===void 0&&(n=0),this.chunks=t,this.from=n}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=De(t)?new Ee(String(t)):t;const n=this.chunks[this.chunks.length-1],a=n&&(n.stop===t.stop||t.stop==null)&&t.from===n.from+n.toString().length;if(t instanceof Ee)a?n.extend(t.toString()):this.chunks.push(t);else if(t instanceof Ae){if(t.stop==null){let o;for(;t.chunks.length&&t.chunks[0].stop==null;)o=t.chunks.shift(),o.from+=t.from,this.extend(o)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof J.MaskedPattern))return new Ee(this.toString()).appendTo(t);const n=new Q;for(let a=0;a<this.chunks.length;++a){const o=this.chunks[a],r=t._mapPosToBlock(t.displayValue.length),s=o.stop;let i;if(s!=null&&(!r||r.index<=s)&&((o instanceof Ae||t._stops.indexOf(s)>=0)&&n.aggregate(t._appendPlaceholder(s)),i=o instanceof Ae&&t._blocks[s]),i){const d=i.appendTail(o);n.aggregate(d);const c=o.toString().slice(d.rawInserted.length);c&&n.aggregate(t.append(c,{tail:!0}))}else n.aggregate(t.append(o.toString(),{tail:!0}))}return n}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:n,...a}=t;Object.assign(this,a),this.chunks=n.map(o=>{const r="chunks"in o?new Ae:new Ee;return r.state=o,r})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const n=t!=null?t-this.from:t;let a=0;for(;a<this.chunks.length;){const o=this.chunks[a],r=o.unshift(n);if(o.toString()){if(!r)break;++a}else this.chunks.splice(a,1);if(r)return r}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const n=this.chunks[t],a=n.shift();if(n.toString()){if(!a)break;--t}else this.chunks.splice(t,1);if(a)return a}return""}}class Bu{constructor(t,n){this.masked=t,this._log=[];const{offset:a,index:o}=t._mapPosToBlock(n)||(n<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=a,this.index=o,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(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}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(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((n=this.block)==null?void 0:n.displayValue.length)||0){var n;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())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,q.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,q.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,q.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,q.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,q.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,q.NONE),!0})}}class Ut{constructor(t){Object.assign(this,t),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(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(n),this._value||(this._isRawInput=!1),new Q}nearestInputPos(t,n){n===void 0&&(n=q.NONE);const a=0,o=this._value.length;switch(n){case q.LEFT:case q.FORCE_LEFT:return a;case q.NONE:case q.RIGHT:case q.FORCE_RIGHT:default:return o}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._isRawInput?n-t:0}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),a===void 0&&(a={}),a.raw&&this._isRawInput&&this._value.slice(t,n)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new Q;const a=this.eager===!0||this.eager==="append",r=this.char===t&&(this.isUnmasking||n.input||n.raw)&&(!n.raw||!a)&&!n.tail,s=new Q({inserted:this.char,rawInserted:r?this.char:""});return this._value=this.char,this._isRawInput=r&&(n.raw||n.input),s}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new Q;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new Ee("")}appendTail(t){return De(t)&&(t=new Ee(String(t))),t.appendTo(this)}append(t,n,a){const o=this._appendChar(t[0],n);return a!=null&&(o.tailShift+=this.appendTail(a).tailShift),o}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=!!t._rawInputValue}pad(t){return this._appendPlaceholder()}}class Je{constructor(t){const{parent:n,isOptional:a,placeholderChar:o,displayChar:r,lazy:s,eager:i,...d}=t;this.masked=_e(d),Object.assign(this,{parent:n,isOptional:a,placeholderChar:o,displayChar:r,lazy:s,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),t===0&&n>=1?(this.isFilled=!1,this.masked.remove(t,n)):new Q}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(t,n){if(n===void 0&&(n={}),this.isFilled)return new Q;const a=this.masked.state;let o=this.masked._appendChar(t,this.currentMaskFlags(n));return o.inserted&&this.doValidate(n)===!1&&(o=new Q,this.masked.state=a),!o.inserted&&!this.isOptional&&!this.lazy&&!n.input&&(o.inserted=this.placeholderChar),o.skip=!o.inserted&&!this.isOptional,this.isFilled=!!o.inserted,o}append(t,n,a){return this.masked.append(t,this.currentMaskFlags(n),a)}_appendPlaceholder(){return this.isFilled||this.isOptional?new Q:(this.isFilled=!0,new Q({inserted:this.placeholderChar}))}_appendEager(){return new Q}extractTail(t,n){return this.masked.extractTail(t,n)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.masked.extractInput(t,n,a)}nearestInputPos(t,n){n===void 0&&(n=q.NONE);const a=0,o=this.value.length,r=Math.min(Math.max(t,a),o);switch(n){case q.LEFT:case q.FORCE_LEFT:return this.isComplete?r:a;case q.RIGHT:case q.FORCE_RIGHT:return this.isComplete?r:o;case q.NONE:default:return r}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.value.slice(t,n).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var n;return{...t,_beforeTailState:(t==null||(n=t._beforeTailState)==null?void 0:n.masked)||t?._beforeTailState}}pad(t){return new Q}}Je.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 qn extends ue{updateOptions(t){super.updateOptions(t)}_update(t){const n=t.mask;n&&(t.validate=a=>a.search(n)>=0),super._update(t)}}J.MaskedRegExp=qn;class pe extends ue{constructor(t){super({...pe.DEFAULTS,...t,definitions:Object.assign({},Je.DEFAULT_DEFINITIONS,t?.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const n=this.mask;if(!n||!t)return;let a=!1,o=!1;for(let r=0;r<n.length;++r){if(this.blocks){const c=n.slice(r),h=Object.keys(this.blocks).filter(_=>c.indexOf(_)===0);h.sort((_,b)=>b.length-_.length);const y=h[0];if(y){const{expose:_,repeat:b,...B}=Ue(this.blocks[y]),g={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...B,repeat:b,parent:this},k=b!=null?new J.RepeatBlock(g):_e(g);k&&(this._blocks.push(k),_&&(this.exposeBlock=k),this._maskedBlocks[y]||(this._maskedBlocks[y]=[]),this._maskedBlocks[y].push(this._blocks.length-1)),r+=y.length-1;continue}}let s=n[r],i=s in t;if(s===pe.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){a=!a;continue}if(s==="["||s==="]"){o=!o;continue}if(s===pe.ESCAPE_CHAR){if(++r,s=n[r],!s)break;i=!1}const d=i?new Je({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...Ue(t[s]),parent:this}):new Ut({char:s,eager:this.eager,isUnmasking:a});this._blocks.push(d)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:n,...a}=t;this._blocks.forEach((o,r)=>o.state=n[r]),super.state=a}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,n)=>t+=n.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(n),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,n)=>t+=n.value,"")}set value(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(n),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(n),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,n)=>t+=n.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const n=new Q;let a=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(a==null)return n;this._blocks[a].isFilled&&++a;for(let o=a;o<this._blocks.length;++o){const r=this._blocks[o]._appendEager();if(!r.inserted)break;n.aggregate(r)}return n}_appendCharRaw(t,n){n===void 0&&(n={});const a=this._mapPosToBlock(this.displayValue.length),o=new Q;if(!a)return o;for(let s=a.index,i;i=this._blocks[s];++s){var r;const d=i._appendChar(t,{...n,_beforeTailState:(r=n._beforeTailState)==null||(r=r._blocks)==null?void 0:r[s]});if(o.aggregate(d),d.consumed)break}return o}extractTail(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=new Ae;return t===n||this._forEachBlocksInRange(t,n,(o,r,s,i)=>{const d=o.extractTail(s,i);d.stop=this._findStopBefore(r),d.from=this._blockStartPos(r),d instanceof Ae&&(d.blockIndex=r),a.extend(d)}),a}extractInput(t,n,a){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),a===void 0&&(a={}),t===n)return"";let o="";return this._forEachBlocksInRange(t,n,(r,s,i,d)=>{o+=r.extractInput(i,d,a)}),o}_findStopBefore(t){let n;for(let a=0;a<this._stops.length;++a){const o=this._stops[a];if(o<=t)n=o;else break}return n}_appendPlaceholder(t){const n=new Q;if(this.lazy&&t==null)return n;const a=this._mapPosToBlock(this.displayValue.length);if(!a)return n;const o=a.index,r=t??this._blocks.length;return this._blocks.slice(o,r).forEach(s=>{if(!s.lazy||t!=null){var i;n.aggregate(s._appendPlaceholder((i=s._blocks)==null?void 0:i.length))}}),n}_mapPosToBlock(t){let n="";for(let a=0;a<this._blocks.length;++a){const o=this._blocks[a],r=n.length;if(n+=o.displayValue,t<=n.length)return{index:a,offset:t-r}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((n,a)=>n+=a.displayValue.length,0)}_forEachBlocksInRange(t,n,a){n===void 0&&(n=this.displayValue.length);const o=this._mapPosToBlock(t);if(o){const r=this._mapPosToBlock(n),s=r&&o.index===r.index,i=o.offset,d=r&&s?r.offset:this._blocks[o.index].displayValue.length;if(a(this._blocks[o.index],o.index,i,d),r&&!s){for(let c=o.index+1;c<r.index;++c)a(this._blocks[c],c,0,this._blocks[c].displayValue.length);a(this._blocks[r.index],r.index,0,r.offset)}}}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=super.remove(t,n);return this._forEachBlocksInRange(t,n,(o,r,s,i)=>{a.aggregate(o.remove(s,i))}),a}nearestInputPos(t,n){if(n===void 0&&(n=q.NONE),!this._blocks.length)return 0;const a=new Bu(this,t);if(n===q.NONE)return a.pushRightBeforeInput()||(a.popState(),a.pushLeftBeforeInput())?a.pos:this.displayValue.length;if(n===q.LEFT||n===q.FORCE_LEFT){if(n===q.LEFT){if(a.pushRightBeforeFilled(),a.ok&&a.pos===t)return t;a.popState()}if(a.pushLeftBeforeInput(),a.pushLeftBeforeRequired(),a.pushLeftBeforeFilled(),n===q.LEFT){if(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.ok&&a.pos<=t||(a.popState(),a.ok&&a.pos<=t))return a.pos;a.popState()}return a.ok?a.pos:n===q.FORCE_LEFT?0:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:0)}return n===q.RIGHT||n===q.FORCE_RIGHT?(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.pushRightBeforeFilled()?a.pos:n===q.FORCE_RIGHT?this.displayValue.length:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:this.nearestInputPos(t,q.LEFT))):t}totalInputPositions(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);let a=0;return this._forEachBlocksInRange(t,n,(o,r,s,i)=>{a+=o.totalInputPositions(s,i)}),a}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const n=this._maskedBlocks[t];return n?n.map(a=>this._blocks[a]):[]}pad(t){const n=new Q;return this._forEachBlocksInRange(0,this.displayValue.length,a=>n.aggregate(a.pad(t))),n}}pe.DEFAULTS={...ue.DEFAULTS,lazy:!0,placeholderChar:"_"},pe.STOP_CHAR="`",pe.ESCAPE_CHAR="\\",pe.InputDefinition=Je,pe.FixedDefinition=Ut,J.MaskedPattern=pe;class Xe extends pe{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:n=this.to||0,from:a=this.from||0,maxLength:o=this.maxLength||0,autofix:r=this.autofix,...s}=t;this.to=n,this.from=a,this.maxLength=Math.max(String(n).length,o),this.autofix=r;const i=String(this.from).padStart(this.maxLength,"0"),d=String(this.to).padStart(this.maxLength,"0");let c=0;for(;c<d.length&&d[c]===i[c];)++c;s.mask=d.slice(0,c).replace(/0/g,"\\0")+"0".repeat(this.maxLength-c),super._update(s)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let n="",a="";const[,o,r]=t.match(/^(\D*)(\d*)(\D*)/)||[];return r&&(n="0".repeat(o.length)+r,a="9".repeat(o.length)+r),n=n.padEnd(this.maxLength,"0"),a=a.padEnd(this.maxLength,"9"),[n,a]}doPrepareChar(t,n){n===void 0&&(n={});let a;return[t,a]=super.doPrepareChar(t.replace(/\D/g,""),n),t||(a.skip=!this.isComplete),[t,a]}_appendCharRaw(t,n){if(n===void 0&&(n={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,n);const a=String(this.from).padStart(this.maxLength,"0"),o=String(this.to).padStart(this.maxLength,"0"),[r,s]=this.boundaries(this.value+t);return Number(s)<this.from?super._appendCharRaw(a[this.value.length],n):Number(r)>this.to?!n.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(a[this.value.length],n).aggregate(this._appendCharRaw(t,n)):super._appendCharRaw(o[this.value.length],n):super._appendCharRaw(t,n)}doValidate(t){const n=this.value;if(n.search(/[^0]/)===-1&&n.length<=this._matchFrom)return!0;const[o,r]=this.boundaries(n);return this.from<=Number(r)&&Number(o)<=this.to&&super.doValidate(t)}pad(t){const n=new Q;if(this.value.length===this.maxLength)return n;const a=this.value,o=this.maxLength-this.value.length;if(o){this.reset();for(let r=0;r<o;++r)n.aggregate(super._appendCharRaw("0",t));a.split("").forEach(r=>this._appendCharRaw(r))}return n}}J.MaskedRange=Xe;const Cu="d{.}`m{.}`Y";class Ve extends pe{static extractPatternOptions(t){const{mask:n,pattern:a,...o}=t;return{...o,mask:De(n)?n:a}}constructor(t){super(Ve.extractPatternOptions({...Ve.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:n,pattern:a,blocks:o,...r}={...Ve.DEFAULTS,...t},s=Object.assign({},Ve.GET_DEFAULT_BLOCKS());t.min&&(s.Y.from=t.min.getFullYear()),t.max&&(s.Y.to=t.max.getFullYear()),t.min&&t.max&&s.Y.from===s.Y.to&&(s.m.from=t.min.getMonth()+1,s.m.to=t.max.getMonth()+1,s.m.from===s.m.to&&(s.d.from=t.min.getDate(),s.d.to=t.max.getDate())),Object.assign(s,this.blocks,o),super._update({...r,mask:De(n)?n:a,blocks:s})}doValidate(t){const n=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&n!=null&&(this.min==null||this.min<=n)&&(this.max==null||n<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(Ve.extractPatternOptions(t))}}Ve.GET_DEFAULT_BLOCKS=()=>({d:{mask:Xe,from:1,to:31,maxLength:2},m:{mask:Xe,from:1,to:12,maxLength:2},Y:{mask:Xe,from:1900,to:9999}}),Ve.DEFAULTS={...pe.DEFAULTS,mask:Date,pattern:Cu,format:(l,t)=>{if(!l)return"";const n=String(l.getDate()).padStart(2,"0"),a=String(l.getMonth()+1).padStart(2,"0"),o=l.getFullYear();return[n,a,o].join(".")},parse:(l,t)=>{const[n,a,o]=l.split(".").map(Number);return new Date(o,a-1,n)}},J.MaskedDate=Ve;class Qe extends ue{constructor(t){super({...Qe.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map(n=>{const{expose:a,...o}=Ue(n),r=_e({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...o});return a&&(this.exposeMask=r),r}):[])}_appendCharRaw(t,n){n===void 0&&(n={});const a=this._applyDispatch(t,n);return this.currentMask&&a.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(n))),a}_applyDispatch(t,n,a){t===void 0&&(t=""),n===void 0&&(n={}),a===void 0&&(a="");const o=n.tail&&n._beforeTailState!=null?n._beforeTailState._value:this.value,r=this.rawInputValue,s=n.tail&&n._beforeTailState!=null?n._beforeTailState._rawInputValue:r,i=r.slice(s.length),d=this.currentMask,c=new Q,h=d?.state;return this.currentMask=this.doDispatch(t,{...n},a),this.currentMask&&(this.currentMask!==d?(this.currentMask.reset(),s&&(this.currentMask.append(s,{raw:!0}),c.tailShift=this.currentMask.value.length-o.length),i&&(c.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):h&&(this.currentMask.state=h)),c}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const n=new Q;return t&&n.aggregate(this._applyDispatch("",{},t)),n.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var n,a;return{...t,_beforeTailState:((n=t._beforeTailState)==null?void 0:n.currentMaskRef)===this.currentMask&&((a=t._beforeTailState)==null?void 0:a.currentMask)||t._beforeTailState}}doDispatch(t,n,a){return n===void 0&&(n={}),a===void 0&&(a=""),this.dispatch(t,this,n,a)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,n){n===void 0&&(n={});let[a,o]=super.doPrepare(t,n);if(this.currentMask){let r;[a,r]=super.doPrepare(a,this.currentMaskFlags(n)),o=o.aggregate(r)}return[a,o]}doPrepareChar(t,n){n===void 0&&(n={});let[a,o]=super.doPrepareChar(t,n);if(this.currentMask){let r;[a,r]=super.doPrepareChar(a,this.currentMaskFlags(n)),o=o.aggregate(r)}return[a,o]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(n=>n.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask){this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,this._applyDispatch();return}let n=String(t);this.currentMask&&(this.currentMask.typedValue=t,n=this.currentMask.unmaskedValue),this.unmaskedValue=n}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return!!((t=this.currentMask)!=null&&t.isComplete)}get isFilled(){var t;return!!((t=this.currentMask)!=null&&t.isFilled)}remove(t,n){const a=new Q;return this.currentMask&&a.aggregate(this.currentMask.remove(t,n)).aggregate(this._applyDispatch()),a}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(n=>n.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:n,currentMaskRef:a,currentMask:o,...r}=t;n&&this.compiledMasks.forEach((s,i)=>s.state=n[i]),a!=null&&(this.currentMask=a,this.currentMask.state=o),super.state=r}extractInput(t,n,a){return this.currentMask?this.currentMask.extractInput(t,n,a):""}extractTail(t,n){return this.currentMask?this.currentMask.extractTail(t,n):super.extractTail(t,n)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,n){return this.currentMask?this.currentMask.nearestInputPos(t,n):super.nearestInputPos(t,n)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((n,a)=>{if(!t[a])return;const{mask:o,...r}=t[a];return ft(n,r)&&n.maskEquals(o)}):super.maskEquals(t)}typedValueEquals(t){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(t))}}Qe.DEFAULTS={...ue.DEFAULTS,dispatch:(l,t,n,a)=>{if(!t.compiledMasks.length)return;const o=t.rawInputValue,r=t.compiledMasks.map((s,i)=>{const d=t.currentMask===s,c=d?s.displayValue.length:s.nearestInputPos(s.displayValue.length,q.FORCE_LEFT);return s.rawInputValue!==o?(s.reset(),s.append(o,{raw:!0})):d||s.remove(c),s.append(l,t.currentMaskFlags(n)),s.appendTail(a),{index:i,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(c,s.nearestInputPos(s.displayValue.length,q.FORCE_LEFT)))}});return r.sort((s,i)=>i.weight-s.weight||i.totalInputPositions-s.totalInputPositions),t.compiledMasks[r[0].index]}},J.MaskedDynamic=Qe;class et extends pe{constructor(t){super({...et.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:n,...a}=t;if(n){const o=n.map(i=>i.length),r=Math.min(...o),s=Math.max(...o)-r;a.mask="*".repeat(r),s&&(a.mask+="["+"*".repeat(s)+"]"),this.enum=n}super._update(a)}_appendCharRaw(t,n){n===void 0&&(n={});const a=Math.min(this.nearestInputPos(0,q.FORCE_RIGHT),this.value.length),o=this.enum.filter(r=>this.matchValue(r,this.unmaskedValue+t,a));if(o.length){o.length===1&&this._forEachBlocksInRange(0,this.value.length,(s,i)=>{const d=o[0][i];i>=this.value.length||d===s.value||(s.reset(),s._appendChar(d,n))});const r=super._appendCharRaw(o[0][this.value.length],n);return o.length===1&&o[0].slice(this.unmaskedValue.length).split("").forEach(s=>r.aggregate(super._appendCharRaw(s))),r}return new Q({skip:!this.isComplete})}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new Ee("",t)}remove(t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),t===n)return new Q;const a=Math.min(super.nearestInputPos(0,q.FORCE_RIGHT),this.value.length);let o;for(o=t;o>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(a,o),a)).length>1);--o);const r=super.remove(o,n);return r.tailShift+=o-t,r}get isComplete(){return this.enum.indexOf(this.value)>=0}}et.DEFAULTS={...pe.DEFAULTS,matchValue:(l,t,n)=>l.indexOf(t,n)===n},J.MaskedEnum=et;class Gn extends ue{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}J.MaskedFunction=Gn;var Kn;class fe extends ue{constructor(t){super({...fe.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",a=(this.scale?"("+jt(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+n+a),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(jt).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(jt(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const n=t.split(this.radix);return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),n.join(this.radix)}doPrepareChar(t,n){n===void 0&&(n={});const[a,o]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(n.input&&n.raw||!n.input&&!n.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),n);return t&&!a&&(o.skip=!0),a&&!this.allowPositive&&!this.value&&a!=="-"&&o.aggregate(this._appendChar("-")),[a,o]}_separatorsCount(t,n){n===void 0&&(n=!1);let a=0;for(let o=0;o<t;++o)this._value.indexOf(this.thousandsSeparator,o)===o&&(++a,n&&(t+=this.thousandsSeparator.length));return a}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n),this._removeThousandsSeparators(super.extractInput(t,n,a))}_appendCharRaw(t,n){n===void 0&&(n={});const a=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,o=this._separatorsCountFromSlice(a);this._value=this._removeThousandsSeparators(this.value);const r=this._value;this._value+=t;const s=this.number;let i=!isNaN(s),d=!1;if(i){let _;this.min!=null&&this.min<0&&this.number<this.min&&(_=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(_=this.max),_!=null&&(this.autofix?(this._value=this.format(_,this).replace(fe.UNMASKED_RADIX,this.radix),d||(d=r===this._value&&!n.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let c;i?c=new Q({inserted:this._value.slice(r.length),rawInserted:d?"":t,skip:d}):(this._value=r,c=new Q),this._value=this._insertThousandsSeparators(this._value);const h=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,y=this._separatorsCountFromSlice(h);return c.tailShift+=(y-o)*this.thousandsSeparator.length,c}_findSeparatorAround(t){if(this.thousandsSeparator){const n=t-this.thousandsSeparator.length+1,a=this.value.indexOf(this.thousandsSeparator,n);if(a<=t)return a}return-1}_adjustRangeWithSeparators(t,n){const a=this._findSeparatorAround(t);a>=0&&(t=a);const o=this._findSeparatorAround(n);return o>=0&&(n=o+this.thousandsSeparator.length),[t,n]}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n);const a=this.value.slice(0,t),o=this.value.slice(n),r=this._separatorsCount(a.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(a+o));const s=this._separatorsCountFromSlice(a);return new Q({tailShift:(s-r)*this.thousandsSeparator.length})}nearestInputPos(t,n){if(!this.thousandsSeparator)return t;switch(n){case q.NONE:case q.LEFT:case q.FORCE_LEFT:{const a=this._findSeparatorAround(t-1);if(a>=0){const o=a+this.thousandsSeparator.length;if(t<o||this.value.length<=o||n===q.FORCE_LEFT)return a}break}case q.RIGHT:case q.FORCE_RIGHT:{const a=this._findSeparatorAround(t);if(a>=0)return a+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let n=t;this.min!=null&&(n=Math.max(n,this.min)),this.max!=null&&(n=Math.min(n,this.max)),n!==t&&(this.unmaskedValue=this.format(n,this));let a=this.value;this.normalizeZeros&&(a=this._normalizeZeros(a)),this.padFractionalZeros&&this.scale>0&&(a=this._padFractionalZeros(a)),this._value=a}super.doCommit()}_normalizeZeros(t){const n=this._removeThousandsSeparators(t).split(this.radix);return n[0]=n[0].replace(/^(\D*)(0*)(\d*)/,(a,o,r,s)=>o+s),t.length&&!/\d$/.test(n[0])&&(n[0]=n[0]+"0"),n.length>1&&(n[1]=n[1].replace(/0*$/,""),n[1].length||(n.length=1)),this._insertThousandsSeparators(n.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const n=t.split(this.radix);return n.length<2&&n.push(""),n[1]=n[1].padEnd(this.scale,"0"),n.join(this.radix)}doSkipInvalid(t,n,a){n===void 0&&(n={});const o=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===fe.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,n,a)&&!o}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,fe.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(fe.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}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(t){return(super.typedValueEquals(t)||fe.EMPTY_VALUES.includes(t)&&fe.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}Kn=fe,fe.UNMASKED_RADIX=".",fe.EMPTY_VALUES=[...ue.EMPTY_VALUES,0],fe.DEFAULTS={...ue.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Kn.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:l=>l.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},J.MaskedNumber=fe;const kt={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Ht(l,t,n){t===void 0&&(t=kt.MASKED),n===void 0&&(n=kt.MASKED);const a=_e(l);return o=>a.runIsolated(r=>(r[t]=o,r[n]))}function Yn(l,t,n,a){return Ht(t,n,a)(l)}J.PIPE_TYPE=kt,J.createPipe=Ht,J.pipe=Yn;class Wn extends pe{get repeatFrom(){var t;return(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?t:0}get repeatTo(){var t;return(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var n,a,o;const{repeat:r,...s}=Ue(t);this._blockOpts=Object.assign({},this._blockOpts,s);const i=_e(this._blockOpts);this.repeat=(n=(a=r??i.repeat)!=null?a:this.repeat)!=null?n:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((o=this._blocks)==null?void 0:o.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(t){if(t<this._blocks.length)return this._blocks[t];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(_e(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,n){n===void 0&&(n={});const a=new Q;for(let d=(o=(r=this._mapPosToBlock(this.displayValue.length))==null?void 0:r.index)!=null?o:Math.max(this._blocks.length-1,0),c,h;c=(s=this._blocks[d])!=null?s:h=!h&&this._allocateBlock(d);++d){var o,r,s,i;const y=c._appendChar(t,{...n,_beforeTailState:(i=n._beforeTailState)==null||(i=i._blocks)==null?void 0:i[d]});if(y.skip&&h){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(a.aggregate(y),y.consumed)break}return a}_trimEmptyTail(t,n){var a,o;t===void 0&&(t=0);const r=Math.max(((a=this._mapPosToBlock(t))==null?void 0:a.index)||0,this.repeatFrom,0);let s;n!=null&&(s=(o=this._mapPosToBlock(n))==null?void 0:o.index),s==null&&(s=this._blocks.length-1);let i=0;for(let d=s;r<=d&&!this._blocks[d].unmaskedValue;--d,++i);i&&(this._blocks.splice(s-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=super.remove(t,n);return this._trimEmptyTail(t,n),a}totalInputPositions(t,n){return t===void 0&&(t=0),n==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,n)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}J.RepeatBlock=Wn;try{globalThis.IMask=J}catch{}const qt=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:Q,ChunksTailDetails:Ae,DIRECTION:q,HTMLContenteditableMaskElement:Pt,HTMLInputMaskElement:Un,HTMLMaskElement:Ze,InputMask:Hn,MaskElement:gt,Masked:ue,MaskedDate:Ve,MaskedDynamic:Qe,MaskedEnum:et,MaskedFunction:Gn,MaskedNumber:fe,MaskedPattern:pe,MaskedRange:Xe,MaskedRegExp:qn,PIPE_TYPE:kt,PatternFixedDefinition:Ut,PatternInputDefinition:Je,RepeatBlock:Wn,createMask:_e,createPipe:Ht,default:J,forceDirection:zn,normalizeOpts:Ue,pipe:Yn},Symbol.toStringTag,{value:"Module"}));ne.ModalEdit=Cn,ne.VForm=Ce,ne.VsInputAddress=xn,ne.VsInputArray=wn,ne.VsInputCheckbox=Xt,ne.VsInputCodegen=fn,ne.VsInputColor=kn,ne.VsInputContainer=sn,ne.VsInputDate=Eu,ne.VsInputEmail=$t,ne.VsInputFile=an,ne.VsInputFileList=on,ne.VsInputKeyValue=gn,ne.VsInputMask=St,ne.VsInputNumber=Jt,ne.VsInputRadio=At,ne.VsInputRange=bn,ne.VsInputSelect=Ft,ne.VsInputSlug=hn,ne.VsInputStatic=Mt,ne.VsInputSwitcher=Nt,ne.VsInputTag=mn,ne.VsInputTel=Dt,ne.VsInputText=ze,ne.VsInputTextArray=yn,ne.VsInputTextarea=dn,ne.default=Ce,ne.inputs=En,ne.vsInputDatatable=un,ne.vsInputMap=pn,Object.defineProperties(ne,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});