@opengis/form 0.0.113 → 0.0.115
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.
- package/dist/components/inputs/index.d.ts +1 -0
- package/dist/components/inputs/index.d.ts.map +1 -1
- package/dist/components/inputs/map/vs-input-map.vue.d.ts +1 -1
- package/dist/components/inputs/map/vs-input-map.vue.d.ts.map +1 -1
- package/dist/components/inputs/table/vs-input-datatable.vue.d.ts +1 -0
- package/dist/components/inputs/table/vs-input-datatable.vue.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +4390 -4161
- package/dist/index.umd.cjs +3 -3
- package/dist/types/form.d.ts +2 -0
- package/dist/types/form.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(ce,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@opengis/core"),require("lucide-vue-next")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core","lucide-vue-next"],e):(ce=typeof globalThis<"u"?globalThis:ce||self,e(ce.FormBuilder={},ce.Vue,ce.OpenGISCore,ce.lucide))})(this,(function(ce,e,me,pl){"use strict";const mn=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&&l.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(l.text),5)):e.createCommentVNode("",!0)]))],64))}}),ml={class:"w-full relative"},fl={key:0,class:"text-[14px] font-medium text-gray-900 mb-2 flex items-center gap-1"},hl={class:"opacity-100"},gl={key:0,class:"text-red-500 text-[14px]"},yl={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},kl=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",ml,[a.value?(e.openBlock(),e.createElementBlock("div",fl,[e.createElementVNode("span",hl,e.toDisplayString(n.value),1),o.value?(e.openBlock(),e.createElementBlock("span",gl,"*")):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createBlock(mn,{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":l.item.disabled}})),l.error?(e.openBlock(),e.createElementBlock("span",yl,e.toDisplayString(l.error),1)):e.createCommentVNode("",!0)]))}}),bl={class:"w-full relative flex flex-row items-center gap-2"},xl={key:0,class:"text-red-500 text-[14px]"},wl={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},_l=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:d,label:u}=o.value;return!d||d<=0?0:Math.min(Math.max(u??0,0),d)/d}),s=e.computed(()=>t.item?.type==="html"||r.value<=0?!1:!!n.value),i=e.computed(()=>{if(!s.value)return{};const d=`${r.value*100}%`;return{flexBasis:d,maxWidth:d}}),c=e.computed(()=>{const{container:d,label:u}=o.value;if(!d||d<=0)return{};if(t.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!s.value)return{flexBasis:"100%",maxWidth:"100%"};const k=Math.max(d-Math.max(u??0,0),0)/d;if(!k)return{};const C=`${k*100}%`;return{flexBasis:C,maxWidth:C}});return(d,u)=>(e.openBlock(),e.createElementBlock("div",bl,[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),l.item?.rules?.includes("required")&&n.value?(e.openBlock(),e.createElementBlock("span",xl,"*")):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createBlock(mn,{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(c.value)},[e.renderSlot(d.$slots,"default",e.normalizeProps(e.guardReactiveProps(d.$attrs)))],4),l.error?(e.openBlock(),e.createElementBlock("span",wl,e.toDisplayString(l.error),1)):e.createCommentVNode("",!0)]))}}),vl={class:"w-full relative"},El={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Vl=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",vl,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),l.error?(e.openBlock(),e.createElementBlock("span",El,e.toDisplayString(l.error),1)):e.createCommentVNode("",!0)]))}}),Bl={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"},Sl={class:"truncate"},Nl={key:0,class:"text-red-500 text-[14px]"},Ml=["innerHTML"],$l={key:0,class:"mt-1 text-xs text-red-500"},Dl={default:kl,horizontal:_l,inline:Vl,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,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":l.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(l.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",Bl,[l.ua||l.label?(e.openBlock(),e.createElementBlock("p",Cl,[e.createElementVNode("span",Sl,e.toDisplayString(l.item[n.value]||l.ua||l.label),1),o.value?(e.openBlock(),e.createElementBlock("span",Nl,"*")):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(l.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",$l,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0)],2))}})};function Ee(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 Al=["placeholder","disabled"],Fl=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}=Ee(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]=c=>a.value=c),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":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Al)),[[e.vModelText,a.value]])}}),Ll=["placeholder","disabled","maxlength","minlength"],Xe=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}=Ee(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 c(){typeof a.value=="string"&&(a.value=a.value.trim())}return(d,u)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":u[0]||(u[0]=k=>a.value=k),placeholder:r.value,disabled:o.value,maxlength:s.value,minlength:i.value,onBlur:c,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[l.customClass,e.unref(n),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Ll)),[[e.vModelText,a.value]])}}),Tl=["placeholder","disabled","min","max"],fn=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}=Ee(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:l.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:l.min,max:l.max},null,10,Tl)),[[e.vModelText,a.value]])}}),ne=(l,t)=>{const n=l.__vccOpts||l;for(const[a,o]of t)n[a]=o;return n},Il={},Ol={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 zl(l,t){return e.openBlock(),e.createElementBlock("svg",Ol,[...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 Rl=ne(Il,[["render",zl]]),jl={class:"flex items-center gap-[4px]"},Pl=["value","id","disabled"],Ul=["for"],Hl={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},ql=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",jl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:l.value,"onUpdate:modelValue":i[0]||(i[0]=c=>o.value=c),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:l.id,disabled:r.value},null,10,Pl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:l.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",l.error?"border-red-600":""]])},[e.createVNode(Rl,{height:"12",width:"12"})],2),e.createElementVNode("span",Hl,[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.label),1)])])],10,Ul)]))}}),Gl=["name","value","disabled"],Kl={class:"flex items-center gap-[6px] text-[14px]"},Yl={key:0,class:"text-[16px]"},Wl=["src"],Zl=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,c)=>(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:l.id,value:l.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),disabled:l.disabled},null,8,Gl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("span",Kl,[l.icon||l.imgUrl?(e.openBlock(),e.createElementBlock("span",Yl,[l.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(l.icon)},null,2)):e.createCommentVNode("",!0),l.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:1,src:l.imgUrl,width:"16",height:"16",alt:"icon"},null,8,Wl)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.label),1)])])],2))}}),Jl={class:"flex items-center"},Rt=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 c=[...n.modelValue];i?c.includes(n.value)||c.push(n.value):c=c.filter(d=>d!==n.value),a("update:modelValue",c)}else a("update:modelValue",i)}}),s=e.ref(`vs-checkbox-${n.view||"default"}`);return(i,c)=>(e.openBlock(),e.createElementBlock("div",Jl,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value==="vs-checkbox-buttons"?e.unref(Zl):e.unref(ql)),{value:l.value,label:l.label,info:l.option?.info,disabled:l.disabled,modelValue:r.value,"onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),id:o,icon:l.icon,imgUrl:l.imgUrl,style:e.normalizeStyle(l.style),error:l.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),Xl={},Ql={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 ea(l,t){return e.openBlock(),e.createElementBlock("svg",Ql,[...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 jt=ne(Xl,[["render",ea]]),ta={},na={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 la(l,t){return e.openBlock(),e.createElementBlock("svg",na,[...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 pt=ne(ta,[["render",la]]),aa={},oa={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 ra(l,t){return e.openBlock(),e.createElementBlock("svg",oa,[...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 sa=ne(aa,[["render",ra]]),ia={key:0,class:"flex items-start gap-x-1"},ca={key:0,class:"text-red-500 text-[14px]"},da=["title"],ua=["disabled"],Pt=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",ia,[e.createVNode(Rt,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),label:l.text,error:l.error||""},null,8,["modelValue","label","error"]),l.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",ca,"*")):e.createCommentVNode("",!0),l.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:l.i,onClick:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(sa),{class:"text-gray-500 w-[14px] h-[14px]"})],8,da)):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-${l.style?.primaryColor||"blue"}-500`:"bg-stone-200",l.customClass]]),disabled:l.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,ua))}}),pa=["id","innerHTML"],Ut=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:l.name,class:e.normalizeClass(["text-gray-900",l.customClass]),innerHTML:l.html?l.html:l.text},null,10,pa))}}),ma=["placeholder","disabled","name"],Ht=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}=Ee(t.style),a=e.useModel(l,"modelValue"),o=e.ref(null);let r=null;function s(i){const c={9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},d=new Set;let u=!1;for(let C=0;C<i.length;C+=1){const b=i[C];b==="{"?u=!0:b==="}"?u=!1:u&&d.add(b)}const k={};return Object.keys(c).forEach(C=>{d.has(C)||(k[C]=c[C])}),{mask:i,definitions:k,lazy:!1}}return e.onMounted(async()=>{if(o.value){const{default:i}=await Promise.resolve().then(()=>dn),c=s(t.mask||"");r=i(o.value,c),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,i=>{if(r){const c=s(i||"");r.updateOptions(c)}}),e.watch(a,i=>{r&&r.unmaskedValue!==i&&(r.value=i!=null?String(i):"")}),(i,c)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:l.placeholder,disabled:l.disabled,name:l.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,ma))}}),fa={class:"relative w-full bg-white rounded-lg"},ha=["placeholder","disabled"],qt=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}=Ee(t.style),a=e.useModel(l,"modelValue");return(o,r)=>(e.openBlock(),e.createElementBlock("div",fa,[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:l.placeholder,disabled:l.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":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,ha),[[e.vModelText,a.value]])]))}}),ga={class:"relative w-full bg-white rounded-lg"},ya=["value","placeholder","disabled"],Gt=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}=Ee(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:c}=i.target;c=c.replace(/^\+/,""),a.value=c?`+${c}`:""},s=i=>{const c=i,{data:d,inputType:u}=c;u&&u.startsWith("delete")||d&&/\D/.test(d)&&c.preventDefault()};return e.watch(()=>a.value,i=>{i&&!i.startsWith("+")?a.value=`+${i.replace(/^\+/,"")}`:i||(a.value="")},{immediate:!0}),(i,c)=>(e.openBlock(),e.createElementBlock("div",ga,[c[0]||(c[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)),c[1]||(c[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:l.placeholder,disabled:l.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":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,ya)]))}}),ka=["value","disabled"],ba={class:"text-[13px] text-gray-700"},xa=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,ka),[[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",ba,e.toDisplayString(t.text),1)],2))}}),wa=["value","disabled"],_a={class:"text-[13px] text-gray-700"},va={"vs-input-radio-default":xa,"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,wa),[[e.vModelRadio,n.value]]),e.createElementVNode("span",_a,e.toDisplayString(t.text),1)],2))}})},Kt=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(()=>va[`vs-input-radio-${t.view}`]);return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([l.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.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))}}),Ea={key:1,class:"w-full flex flex-col gap-4"},Va={key:0,class:"text-sm font-medium text-muted-foreground my-2"},Ba="Без категорії",hn=ne(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),c=b=>`lg:col-span-${b||12}`,d=e.computed(()=>[n.position==="vertical"?"flex flex-col":"",n.colSpan?"grid":"flex justify-start"]),u=b=>b==null||b===""?null:typeof b=="string"||typeof b=="number"?b:String(b),k=e.computed(()=>{if(!n.group)return[];const b=new Map;o.value.forEach(y=>{const w=y[n.group],x=u(w);b.has(x)||b.set(x,[]),b.get(x)?.push(y)});const E=[];n.values?.length&&n.values.forEach(y=>{const w=u(y);E.push(w)});const h=new Set,g=y=>{const w=b.get(y)||[];if(!w.length)return null;const x=y===null?"group-null":`group-${String(y)}`,S=y===null?Ba:String(y);return h.add(y),{key:x,label:S,options:w}},V=[];return E.forEach(y=>{const w=g(y);w&&V.push(w)}),b.forEach((y,w)=>{if(h.has(w))return;const x=g(w);x&&V.push(x)}),V}),C=async()=>{try{const b=await fetch(`/api/suggest/${n.data}`).then(E=>E.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 E=s(o.value[0]);r[E]=b}else if(Array.isArray(b)){const E=new Set(b);o.value.forEach(h=>{if(!h.disabled){const g=s(h);r[g]=E.has(g)}})}},{immediate:!0}),e.watch(r,()=>{if(!o.value.length){a("update:modelValue",null);return}const b=Object.entries(r).filter(([,E])=>E).map(([E])=>E);a("update:modelValue",b.length===0?[]:b)},{deep:!0}),e.onMounted(()=>{if(n.data)C().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(E=>{if(!E.disabled){const h=s(E);r[h]=b.has(h)}})}});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(E=>{if(!E.disabled){const h=s(E);r[h]=b.has(h)}})}}),(b,E)=>n.group?(e.openBlock(),e.createElementBlock("div",Ea,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,h=>(e.openBlock(),e.createElementBlock("div",{key:h.key,class:"flex flex-col gap-2"},[h.label?(e.openBlock(),e.createElementBlock("span",Va,e.toDisplayString(h.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.options,g=>(e.openBlock(),e.createBlock(Rt,{modelValue:r[s(g)],"onUpdate:modelValue":V=>r[s(g)]=V,value:s(g),class:e.normalizeClass(c(l.colSpan)),disabled:n.disabled||g.disabled,label:i(g),key:`${h.key}-${s(g)}`,icon:g?.icon,imgUrl:g?.imgUrl,option:g,view:l.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]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,h=>(e.openBlock(),e.createBlock(Rt,{modelValue:r[s(h)],"onUpdate:modelValue":g=>r[s(h)]=g,value:s(h),class:e.normalizeClass(c(l.colSpan)),disabled:n.disabled||h.disabled,label:i(h),key:s(h),icon:h?.icon,imgUrl:h?.imgUrl,option:h,view:l.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-cf0478ce"]]),Ca=["type","placeholder","disabled"],Sa=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(u){return u?n.mode==="datetime"?(u.includes("T")?u:null)||u+(u.includes(" ")?"":"T00:00"):u?.split(" ")[0]:null}const{inputClass:o}=Ee(n.style),r=t,s=e.computed({get:()=>a(n.modelValue),set:u=>r("update:modelValue",u)}),i=e.computed(()=>n.mode==="datetime"?"datetime-local":n.mode),c=e.computed(()=>!!n.disabled),d=e.computed(()=>n.placeholder??"");return(u,k)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":k[0]||(k[0]=C=>s.value=C),placeholder:d.value,disabled:c.value,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[l.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Ca)),[[e.vModelDynamic,s.value]])}}),Na=(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},gn=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,c=a||`/file/upload/uploads?id=${o||""}&form=${r||""}&table=${s||""}`,d=Na(c,i);return(await fetch(d,{method:"POST",body:n}).then(k=>k.json()))?.result}catch(n){return me.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",n),null}},Ma=async l=>{try{return await fetch(`file/delete${l}`),!0}catch(t){return console.error(t),!1}},yn=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)}},$a={},Da={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 Aa(l,t){return e.openBlock(),e.createElementBlock("svg",Da,[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)])])}const Ae=ne($a,[["render",Aa]]),Fa={},La={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 Ta(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",La,[...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 Ia=ne(Fa,[["render",Ta]]),Oa={},za={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 Ra(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",za,[...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 ja=ne(Oa,[["render",Ra]]),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"};function Ha(l,t){return e.openBlock(),e.createElementBlock("svg",Ua,[...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 kn=ne(Pa,[["render",Ha]]),qa={},Ga={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 Ka(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Ga,[...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 Ya=ne(qa,[["render",Ka]]),Wa={},Za={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 Ja(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Za,[...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 Xa=ne(Wa,[["render",Ja]]),Qa=l=>{if(!l)return"";const t=l?.split(".");return t[t.length-1]},eo=l=>{const t=Qa(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)?ja:n.textsFormat.includes(t)?Xa:n.documentsFormat.includes(t)?Ia:n.archivesFormat.includes(t)?Ya:kn},to={},no={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 lo(l,t){return e.openBlock(),e.createElementBlock("svg",no,[...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 Qe=ne(to,[["render",lo]]),ao={},oo={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 ro(l,t){return e.openBlock(),e.createElementBlock("svg",oo,[...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 bn=ne(ao,[["render",ro]]),so=["title"],io={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},Yt=ne(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(eo)(n.value)),{src:n.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:r[0]||(r[0]=s=>e.unref(yn)(n.value))},null,8,["src"])),e.createElementVNode("div",io,[e.createElementVNode("button",{type:"button",onClick:r[1]||(r[1]=s=>{e.unref(Ma)(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(Qe,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:r[2]||(r[2]=s=>e.unref(yn)(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(bn,{class:"w-4 h-4"})])])],8,so))}}),[["__scopeId","data-v-b61a9d9a"]]),co={class:"flex items-center gap-x-2"},uo=["accept","multiple","disabled"],po={key:1,class:"flex items-center flex-wrap gap-2"},mo={key:1,class:"loader"},fo={key:1,class:"loader"},xn=ne(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"),c=e.computed(()=>n.format?n.format.split(",").map(y=>y.trim().toLowerCase()).filter(Boolean):[]),d=y=>Array.isArray(a.value)&&a.value[y]||"",u=y=>{if(n.max_size&&y.size>n.max_size*1024*1024){const w=(y.size/1048576).toFixed(2);return me.notify({type:"error",title:"Помилка!",message:`Файл "${y.name}" занадто великий. Максимальний розмір: ${n.max_size} МБ, розмір файлу: ${w} МБ`,position:"right-bottom"}),!1}return!0},k=y=>{if(!c.value.length)return!0;const w=`.${y.name.split(".").pop()?.toLowerCase()||""}`,x=c.value.includes(w);return x||me.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${y.name}". Дозволені формати: ${c.value.join(", ")}`,position:"right-bottom"}),x},C=e.computed(()=>{const y={},w=[];if(!n.customParams?.length)return{params:y,missingSources:w};const x=i?.value??{};return n.customParams.forEach(S=>{if(!S)return;const[F,B]=S.split("="),$=F?.trim(),H=B?.trim();if(!$||!H)return;const G=x[H];if(G==null||G===""){w.push(H);return}y[$]=G}),{params:y,missingSources:w}}),b=()=>{const{params:y}=C.value;return{api:n.api,customParams:Object.keys(y).length?y:void 0}},E=()=>{const y=C.value.missingSources;if(!y.length)return!0;const w=y.join(", ");return me.notify({type:"warning",title:"Заповніть поля",message:`Поля (${w}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},h=y=>{me.notify({type:"error",title:"Помилка завантаження",message:y||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},g=()=>{n.disabled||s.value||E()&&r.value?.click()},V=async y=>{const{files:w}=y.target;if(!w||w.length===0)return;if(!E()){r.value&&(r.value.value="");return}const x=Array.from(w);if(n.max_size&&x.filter(B=>!u(B)).length>0){r.value&&(r.value.value="");return}if(x.filter(F=>!k(F)).length>0){r.value&&(r.value.value="");return}s.value=!0;try{if(n.multiple){const F=Array.from(w).map(async G=>await gn(G,b())),B=await Promise.all(F),H=B.filter(G=>G!==null).map(G=>G?.file_path).filter(Boolean);if(H.length===0){h();return}H.length<B.length&&h("Деякі файли не вдалося завантажити. Перевірте їх та спробуйте знову."),a.value=[...a.value||[],...H],o("change",a.value)}else{const F=w[0],B=await gn(F,b());if(!B?.file_path){h();return}a.value=B?.file_path,o("change",a.value||"")}}catch(F){const B=F?.message||void 0;h(B)}finally{s.value=!1,r.value&&(r.value.value="")}};return(y,w)=>(e.openBlock(),e.createElementBlock("div",co,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:r,type:"file",accept:n.format,multiple:l.multiple,onChange:V,disabled:s.value||l.disabled},null,40,uo),!l.multiple&&a.value?(e.openBlock(),e.createBlock(Yt,{key:0,item:a.value,"onUpdate:item":w[0]||(w[0]=x=>a.value=x),value:a.value,"onUpdate:value":w[1]||(w[1]=x=>a.value=x)},null,8,["item","value"])):l.multiple?(e.openBlock(),e.createElementBlock("div",po,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(x,S)=>(e.openBlock(),e.createBlock(Yt,{multiple:l.multiple,key:S,value:a.value,"onUpdate:value":w[2]||(w[2]=F=>a.value=F),item:d(S)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:g,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",l.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",mo)):(e.openBlock(),e.createBlock(Ae,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),l.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:g,class:e.normalizeClass([l.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",fo)):(e.openBlock(),e.createBlock(Ae,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-05d41c5c"]]),ho={class:"vs-input-file2 flex flex-col gap-4"},go={class:"flex items-center gap-x-2"},yo=["accept","disabled"],ko={key:0,class:"absolute inset-0 flex flex-col items-center justify-center gap-1 rounded-lg bg-white/90 text-xs font-medium text-slate-600"},bo={key:0,class:"rounded-lg border border-[#CFD9E0] bg-white p-4 shadow-sm"},xo={class:"flex items-center justify-between text-sm"},wo={class:"truncate pr-4"},_o={class:"font-medium text-slate-800 truncate"},vo={class:"text-slate-500"},Eo={class:"text-slate-500 whitespace-nowrap"},Vo={class:"mt-3 h-2 rounded-full bg-slate-100 overflow-hidden"},Bo={class:"mt-3 flex flex-wrap gap-2 text-sm"},Co={key:0,class:"mt-2 text-sm text-rose-600"},So=e.defineComponent({__name:"vs-input-file2",props:e.mergeModels({format:{},max_size:{},api:{},chunkSize:{default:5*1024*1024},subdir:{default:""},customParams:{},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(null),o=e.ref(null),r=e.ref(""),s=e.ref(0),i=e.ref(!1),c=e.ref(""),d=e.ref(null),u=e.inject("values"),k=e.computed(()=>t.format?t.format.split(",").map(z=>z.trim().toLowerCase()).filter(Boolean):[]),C=e.computed(()=>!o.value||!o.value.size?0:Math.min(100,Math.round(s.value/o.value.size*100))),b=e.computed(()=>o.value?`${g(s.value)} / ${g(o.value.size)}`:""),E=e.computed(()=>t.disabled?"opacity-50 cursor-not-allowed":i.value?"cursor-default text-blue-500":"cursor-pointer hover:border-blue-500 hover:bg-blue-50 hover:text-blue-500"),h=()=>{t.disabled||i.value||x()&&a.value?.click()},g=z=>{if(!Number.isFinite(z))return"0 B";const R=["B","KB","MB","GB"];let q=0,O=z;for(;O>=1024&&q<R.length-1;)O/=1024,q+=1;return`${O.toFixed(q===0?0:1)} ${R[q]}`},V=z=>{if(!t.max_size)return!0;const R=t.max_size*1024*1024;return z.size>R?(me.notify({type:"error",title:"Файл занадто великий",message:`Максимальний розмір ${t.max_size} МБ`,position:"right-bottom"}),!1):!0},y=z=>{if(!k.value.length)return!0;const R=`.${z.name.split(".").pop()?.toLowerCase()||""}`;return k.value.includes(R)?!0:(me.notify({type:"error",title:"Непідтримуваний формат",message:`Дозволені формати: ${k.value.join(", ")}`,position:"right-bottom"}),!1)},w=e.computed(()=>{const z={},R=[];if(!t.customParams?.length)return{params:z,missing:R};const q=u?.value??{};return t.customParams.forEach(O=>{if(!O)return;const[A,Z]=O.split("="),Y=A?.trim(),ue=Z?.trim();if(!Y||!ue)return;const de=q[ue];de==null||de===""?R.push(ue):z[Y]=de}),{params:z,missing:R}}),x=()=>w.value.missing.length?(me.notify({type:"warning",title:"Заповніть поля",message:`Потрібні значення: ${w.value.missing.join(", ")}`,position:"right-bottom"}),!1):!0,S=z=>{const R=z.target,q=R.files?.[0];if(q){if(!x()){R.value="";return}if(!V(q)||!y(q)){R.value="";return}o.value=q,s.value=0,r.value="",c.value=""}},F=async()=>{if(!o.value){h();return}try{c.value="";const z={id:r.value||"",fileName:o.value.name,subdir:t.subdir,size:o.value.size,...w.value.params},R=await fetch("/api/file/upload2/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(z)});if(!R.ok)throw new Error("Не вдалося ініціалізувати завантаження");const q=await R.json();r.value=q.id||r.value,s.value=q.uploaded||0,await B()}catch(z){c.value=z?.message||"Помилка при старті завантаження"}},B=async()=>{if(!(!o.value||!r.value)){i.value=!0;try{for(;s.value<o.value.size;){const z=s.value,R=Math.min(z+t.chunkSize,o.value.size),q=o.value.slice(z,R);d.value=new AbortController;const O=await fetch(`/api/file/upload2/${r.value}`,{method:"PATCH",headers:{"Content-Range":`bytes ${z}-${R-1}/${o.value.size}`},body:q,signal:d.value.signal});if(!O.ok)throw new Error("Помилка завантаження частини");const A=await O.json().catch(()=>({}));if(A.uploaded!=null?s.value=Number(A.uploaded):s.value=R,A.finished||s.value>=o.value.size){i.value=!1,n.value=A.file_path||A.url||r.value,me.notify({type:"success",title:"Файл завантажено",message:o.value.name,position:"right-bottom"}),j();return}}}catch(z){if(z?.name==="AbortError")return;c.value=z?.message||"Помилка при завантаженні",i.value=!1}finally{d.value=null,i.value=!1}}},$=()=>{i.value&&(d.value?.abort(),d.value=null,i.value=!1)},H=async()=>{if(o.value){if(!r.value){await F();return}await B()}},G=()=>{d.value?.abort(),d.value=null,j()},j=()=>{const z=a.value;z&&(z.value=""),o.value=null,r.value="",s.value=0,c.value=""};return(z,R)=>(e.openBlock(),e.createElementBlock("div",ho,[e.createElementVNode("div",go,[e.createElementVNode("input",{ref_key:"fileInput",ref:a,type:"file",class:"hidden",accept:t.format,disabled:i.value||t.disabled,onChange:S},null,40,yo),n.value?(e.openBlock(),e.createBlock(Yt,{key:0,item:n.value,"onUpdate:item":R[0]||(R[0]=q=>n.value=q),value:n.value,"onUpdate:value":R[1]||(R[1]=q=>n.value=q)},null,8,["item","value"])):(e.openBlock(),e.createElementBlock("div",{key:1,onClick:h,class:e.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",E.value])},[i.value?(e.openBlock(),e.createElementBlock("div",ko,[R[2]||(R[2]=e.createElementVNode("div",{class:"loader"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(C.value)+"%",1)])):(e.openBlock(),e.createBlock(Ae,{key:1,class:"w-6 h-6"}))],2))]),o.value&&!n.value?(e.openBlock(),e.createElementBlock("div",bo,[e.createElementVNode("div",xo,[e.createElementVNode("div",wo,[e.createElementVNode("div",_o,e.toDisplayString(o.value.name),1),e.createElementVNode("div",vo,e.toDisplayString(g(o.value.size)),1)]),e.createElementVNode("div",Eo,e.toDisplayString(b.value),1)]),e.createElementVNode("div",Vo,[e.createElementVNode("div",{class:"h-full rounded-full bg-blue-500 transition-all duration-300",style:e.normalizeStyle({width:`${C.value}%`})},null,4)]),e.createElementVNode("div",Bo,[!i.value&&s.value>0&&s.value<(o.value?.size||0)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:H}," Resume ")):e.createCommentVNode("",!0),i.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:$}," Pause ")):e.createCommentVNode("",!0),!i.value&&s.value===0?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:F}," Upload ")):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"rounded border border-rose-200 px-3 py-1 text-rose-600",onClick:G}," Cancel ")]),c.value?(e.openBlock(),e.createElementBlock("p",Co,e.toDisplayString(c.value),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),Wt=ne(So,[["__scopeId","data-v-8f52f552"]]),No={class:"max-w-[55vw]"},Mo={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},$o={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},Do={class:"px-[5px]"},Ao={class:""},mt=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",No,[e.createElementVNode("p",Mo,e.toDisplayString(l.item?.uploaded_name),1),e.createElementVNode("p",$o,[e.createElementVNode("span",null,e.toDisplayString(l.item?.username),1),e.withDirectives(e.createElementVNode("span",Do,"|",512),[[e.vShow,l.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",Ao,e.toDisplayString(a(l.item?.size)),1)])])],64))}}),Fo={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},Lo={key:0,class:"flex w-full gap-x-3 items-center"},To={key:1,class:"flex gap-x-3 w-full items-center"},Io={key:2,class:"flex gap-x-3 w-full items-center"},Oo=["href"],zo={key:3,class:"flex gap-x-3 w-full items-center"},Ro={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},jo={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"},Uo={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(u){return["pdf","json"].includes(u.ext)}function r(u){return["ppt","pptx","doc","docx","xls","xlsx"].includes(u.ext)}function s(u){const k=document.createElement("a");k.setAttribute("download",u?.uploaded_name),k.href=u?.file_path,k.click()}async function i(){try{await fetch(`${n.prefix}/widget/file/${n.item.entity_id}/${n.item.file_id}`),a("update")}catch(u){console.error(u)}}function c(){a("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function d(u){(n.item.ext==="jpg"||n.item.ext==="png")&&a("openLightbox",{item:n.item,index:u})}return(u,k)=>(e.openBlock(),e.createElementBlock("div",Fo,[l.item.ext==="jpg"||l.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",Lo,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:k[0]||(k[0]=C=>d(l.index))},[e.createVNode(mt,{item:l.item},null,8,["item"])])])):o(l.item)?(e.openBlock(),e.createElementBlock("div",To,[e.createVNode(mt,{item:l.item},null,8,["item"])])):r(l.item)?(e.openBlock(),e.createElementBlock("div",Io,[e.createElementVNode("a",{href:`/api/file-preview?id=${l.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(mt,{item:l.item},null,8,["item"])],8,Oo)])):(e.openBlock(),e.createElementBlock("div",zo,[e.createVNode(mt,{item:l.item},null,8,["item"])])),e.createElementVNode("div",Ro,[e.createElementVNode("div",jo,[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:k[1]||(k[1]=C=>s(l.item))},[e.createVNode(bn,{height:"14",width:"14"})])]),k[3]||(k[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",Uo,[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:k[2]||(k[2]=C=>c())},[e.createVNode(Qe,{height:"14",width:"14"})])])])])]))}}),qo={},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 Ko(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 Yo=ne(qo,[["render",Ko]]),Wo={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},Zo={class:"flex w-full mb-[12px] items-center gap-x-2"},Jo={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},Xo={class1:"ml-auto"},Qo={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"},er={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},tr={class:"relative"},nr={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"},lr={key:0},wn=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,c=e.ref(!1),d=e.ref({}),u=e.ref([]),k=e.ref(""),C=e.computed(()=>Array.isArray(u.value)?u.value.filter(w=>w.ext==="jpg"||w.ext==="png").map(w=>w?.file_path):[]),b=e.computed(()=>k.value===""?u.value:u.value.filter(w=>w?.uploaded_name?.includes(k.value))),E=w=>{const x=C.value.findIndex(S=>S===w.item.file_path);x!==-1&&(r.value=!0,s.value=x)},h=async()=>{try{const w=await fetch(`${n.prefix}/widget/file/${o.value}`).then(x=>x.json());u.value=w?.rows}catch(w){console.error(w)}},g=async w=>{await Promise.all(Array.from(w.target.files).map(async x=>{const S=new FormData;S.append("file",x);try{const F=`${n.prefix}/widget/file/${o.value}`,B=await fetch(F,{method:"POST",body:S});return B.ok?(i("update","file-list"),x):(me.notify({type:B.status>=400&&B.status<500?"warning":"error",title:"Error",message:`Error code: ${B.status}`}),null)}catch(F){return me.notify({type:"error",title:"Error",message:F.message||"Unknown error"}),console.error(F),null}})),await h()},V=w=>{const x={...w};return w.cancel||(x.cancel=()=>{c.value=!1}),w.updateListOnConfirm&&(x.confirm=async()=>{await w.confirm(),c.value=!1,h()}),x},y=w=>{d.value=V(w),c.value=!0};return e.watch(o,w=>{w&&h()}),e.onMounted(()=>{o.value&&h()}),(w,x)=>{const S=e.resolveComponent("Lightbox"),F=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",Wo,[e.createElementVNode("div",Zo,[e.createElementVNode("h2",Jo," Файлів: "+e.toDisplayString(u.value?.length),1),e.createElementVNode("div",Xo,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:x[0]||(x[0]=B=>g(B))},null,32),e.createElementVNode("div",Qo,[e.createVNode(Yo,{height:"16",width:"16"})])])])]),u.value?.length>4?(e.openBlock(),e.createElementBlock("div",er,[e.createElementVNode("div",null,[e.createElementVNode("div",tr,[x[8]||(x[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":x[1]||(x[1]=B=>k.value=B),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,k.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),u.value?.length?(e.openBlock(),e.createElementBlock("div",nr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.value,(B,$)=>(e.openBlock(),e.createBlock(Ho,{key:$,prefix:l.prefix,item:B,index:$,onUpdate:x[2]||(x[2]=H=>w.$emit("update","file-list")),onOpenModal:x[3]||(x[3]=H=>y(H)),onOpenLightbox:x[4]||(x[4]=H=>E(H))},null,8,["prefix","item","index"]))),128)),b.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",lr,[...x[9]||(x[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])]))])):e.createCommentVNode("",!0),e.createVNode(S,{modelValue:r.value,"onUpdate:modelValue":x[5]||(x[5]=B=>r.value=B),startIndex:s.value,"onUpdate:index":x[6]||(x[6]=B=>s.value=B),images:C.value},null,8,["modelValue","startIndex","images"]),e.createVNode(F,e.mergeProps({modelValue:c.value,"onUpdate:modelValue":x[7]||(x[7]=B=>c.value=B),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),ar={class:"flex items-center justify-between"},or={class:"text-[16px] text-gray-900 font-medium"},rr={class:"grid gap-3"},sr=ne(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",ar,[e.createElementVNode("p",or,e.toDisplayString(l.title),1),e.createVNode(Pt,{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",rr,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-00f2f0fc"]]),ir={class:"text-[16px] text-gray-900 font-medium"},cr={class:"grid gap-3"},dr=ne(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(jt),{class:e.normalizeClass(["h-4 w-4 duration-300",[n.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",ir,e.toDisplayString(l.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",cr,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-78778cb5"]]),ur={class:"flex items-center justify-between"},pr={switcher:sr,accordion:dr,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",ur,[e.createElementVNode("p",null,e.toDisplayString(l.title),1)]),e.renderSlot(t.$slots,"default")]))}})},Se={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},mr=(l,t)=>String(l)===String(t),fr=(l,t)=>String(l)!==String(t),hr=(l,t)=>l>t,gr=(l,t)=>l>=t,yr=(l,t)=>l<t,kr=(l,t)=>l<=t,br=(l,t)=>Array.isArray(t)&&t.length===2?l>=t[0]&&l<=t[1]:!1,xr=(l,t)=>String(l).startsWith(String(t)),wr=(l,t)=>String(l).endsWith(String(t)),_r=(l,t)=>String(l).includes(String(t)),vr=(l,t)=>Array.isArray(t)?t.includes(l):!1,Er=(l,t)=>Array.isArray(t)?!t.includes(l):!0,_n=(l,t)=>{if(!t)return!0;switch(t?.[1]){case Se.Equal:return mr(l,t?.[2]);case Se.Inequal:return fr(l,t?.[2]);case Se.Higer:return hr(l,t?.[2]);case Se.HigerOrEqual:return gr(l,t?.[2]);case Se.Lower:return yr(l,t?.[2]);case Se.LowerOrEqual:return kr(l,t?.[2]);case Se.Between:return br(l,t?.[2]);case Se.StartWith:return xr(l,t?.[2]);case Se.EndWith:return wr(l,t?.[2]);case Se.Contain:return _r(l,t?.[2]);case Se.In:return vr(l,t?.[2]);case Se.NotIn:return Er(l,t?.[2]);default:return!0}},vn=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 c=i?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,u=t.name?n.value?.[t.name]?.[d]??n.value?.[d]:n.value?.[d];return _n(u,c)})),r=e.computed(()=>pr[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 c={};return n.value={...n.value,[t.name]:c},c});return(i,c)=>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,d=>(e.openBlock(),e.createBlock(Rn,e.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:s.value[d.name],"onUpdate:modelValue":u=>s.value[d.name]=u,style:l.style,error:e.unref(a)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),Vr=["aria-expanded","data-focus"],Br={class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full"},Cr={key:0,class:"flex flex-nowrap items-center gap-1 overflow-x-auto overflow-y-hidden min-w-0 flex-1 py-0.5"},Sr={class:"flex items-center gap-1 min-w-0"},Nr=["title"],Mr=["innerHTML"],$r=["onClick"],Dr={class:"flex-1 min-w-[2px]"},Ar=["placeholder"],Fr=["title"],Lr=["innerHTML"],Tr={key:3,class:"truncate flex-1 min-w-0"},Ir={key:2,class:"flex-1 min-w-[2px]"},Or=["placeholder"],zr={class:"flex items-center shrink-0"},Rr=["disabled"],jr=["disabled","title"],Pr=["aria-disabled","onClick"],Ur=["innerHTML"],Hr={key:1,class:"px-3 py-2 text-center text-gray-500"},qr=["disabled"],Zt="w-[16px] h-[16px] flex items-center justify-center flex-shrink-0 text-current",Jt=ne(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},start:{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);Ee(n.style);const s=e.computed({get:()=>n.modelValue,set:p=>a("update:modelValue",p)});!s.value&&n.defaultValue&&(s.value=n.defaultValue);const i=e.ref(null),c=e.ref(null),d=e.ref(null),u=e.ref(null),k=e.ref(!1),C=e.ref(!1),b=e.ref(null),E=e.ref([]),h=e.ref(-1),g=e.ref([]),V=e.ref(""),y=e.ref(null),w=e.ref("bottom"),x=e.ref({}),S=e.ref([]),F=e.computed(()=>{if(!S.value.length)return[];const p=E.value,_=new Map(p.map(v=>[v.id?.toString(),v]));return S.value.map(v=>_.get(v?.toString())).filter(v=>!!v)}),B=e.computed(()=>n.placeholder||"Select..."),$=e.computed(()=>Y(b.value));e.computed(()=>o.value?!S.value.length&&V.value==="":!$.value&&V.value==="");const H=e.computed(()=>r.value?!1:o.value?S.value.length>0:!!s.value),G=p=>o.value?S.value.some(_=>_?.toString()===p?.toString()):s.value?.toString()===p?.toString(),j=e.computed(()=>{let p=E.value??[];if(!n.data&&V.value.trim()!==""){const _=V.value.toLowerCase();p=p.filter(v=>{const L=Y(v).toLowerCase(),K=v.text?.toLowerCase?.()||"";return L.includes(_)||K.includes(_)})}if(o.value&&S.value.length){const _=new Set(S.value.map(v=>v?.toString()));p=p.filter(v=>!_.has(v.id?.toString()))}return p}),z=e.inject("values"),R=e.inject("field-props"),q=/\{\{\s*([^}]+?)\s*\}\}/g,O=p=>(p?String(p):"").replace(/<[^>]*>/g,"").trim(),A=e.computed(()=>n.slot??n?.optionTemplate??""),Z=p=>{if(!p)return"";const _=A.value;return _?_.replace(q,(v,L)=>{const K=L.trim(),le=p[K];return le!=null?String(le):""}):p.text??""},Y=p=>{if(!p)return"";if(!A.value)return p.text??"";const v=Z(p);return O(v)||p.text||""},ue=new Map,de=pl.icons,Ne=p=>p.replace(/^([A-Z])|[\s-_]+(\w)/g,(_,v,L)=>L?L.toUpperCase():v.toLowerCase()),I=p=>{const _=Ne(p);return _?_.charAt(0).toUpperCase()+_.slice(1):""},T=p=>{if(!p)return;const _=I(p);if(ue.has(_))return ue.get(_);const L=[_,`${_}Icon`,`Lucide${_}`,`Lucide${_}Icon`].map(K=>de[K]).find(Boolean);return ue.set(_,L),L},X=p=>p?typeof p.icon=="string"?T(p.icon)??null:p.icon??null:null,re=p=>!!(p?.color&&!X(p)),se=p=>p?.color?{color:p.color}:void 0,ge=p=>!!X(p),De=(p,_,v)=>{if(!R)return!1;const L=R.value?.[p]??{},K=(te,he,ke)=>{if(!he.length)return te;const[ve,...qe]=he,Ie={...te};if(!qe.length)return Ie[ve]=ke,Ie;const pn=typeof te[ve]=="object"&&te[ve]!==null?te[ve]:{};return Ie[ve]=K(pn,qe,ke),Ie},le=K(L,_,v);return R.value={...R.value||{},[p]:le},!0},Be=p=>{if(!n.set)return;const _=z?.value;!_&&!R||Object.entries(n.set).forEach(([v,L])=>{if(!v)return;const K=p?p[L]:null,le=v.split(".").map(ke=>ke.trim()).filter(Boolean);if(!le.length)return;const[te,...he]=le;he.length&&De(te,he,K??null)||_&&(_[te]=K??null)})},D=e.computed(()=>n.parent?z?.value?.[n.parent]?.toString()??null:null),P=async p=>{if(!n.data){let _=n.options??[];if(p?.trim()){const v=p.toLowerCase();_=_.filter(L=>{const K=Y(L).toLowerCase(),le=L.text?.toLowerCase?.()||"";return K.includes(v)||le.includes(v)})}return _}try{const _=n.host??"",v=n.prefix??"api",L=n.api??`/${v}/suggest/${n.data}`,K=`${_}${L}`,le=new URLSearchParams;return le.set("json","1"),p&&le.set("key",p),D.value!==void 0&&D.value!==null&&D.value!==""&&le.set("parent",D.value),n.start===1&&le.set("start","1"),(await fetch(`${K}?${le.toString()}`).then(he=>he.json()))?.data??[]}catch{return[]}},U=async()=>{n.data?E.value=await P(V.value):E.value=n.options?[...n.options]:[]},ee=async p=>{if(p==null||p==="")return null;const _=E.value?.find(v=>v?.id?.toString()===String(p));if(_)return _;if(n.data)try{const v=n.host??"",L=n.prefix??"api",K=n.api??`/${L}/suggest/${n.data}`,le=`${v}${K}`,te=new URLSearchParams;return te.set("json","1"),te.set("val",String(p)),D.value!==void 0&&D.value!==null&&D.value!==""&&te.set("parent",D.value),n.start===1&&te.set("start","1"),((await fetch(`${le}?${te.toString()}`).then(ve=>ve.json()))?.data??[])?.[0]??null}catch{return null}return null},ae=async p=>{const _=new Set(E.value.map(L=>L.id?.toString())),v=p.filter(L=>!_.has(L?.toString()));v.length&&await v.reduce(async(L,K)=>{await L;const le=await ee(K);le&&E.value.push(le)},Promise.resolve())},ye=()=>{if(!j.value.length){h.value=-1;return}let p=0;if(!o.value&&b.value){const _=b.value.id?.toString(),v=j.value.findIndex(L=>L.id?.toString()===_);v>=0&&(p=v)}h.value=p,e.nextTick(()=>{Ye(g.value[p],d.value)})},fe=async()=>{r.value||(k.value=!0,await U(),await e.nextTick(()=>{We(),y.value?.focus()}),ye())},M=()=>{k.value=!1,h.value=-1,e.nextTick(()=>{y.value?.blur()})},W=async p=>{if(r.value)return;!k.value?await fe():M()},Q=async()=>{if(!r.value){if(k.value){M();return}await fe()}},pe=()=>{o.value?(S.value=[],s.value=[],a("change",[]),Pe(null,[])):(b.value=null,s.value=null,a("change",null),Pe(null,null)),Be(null),V.value="",e.nextTick(()=>y.value?.focus())},be=p=>{o.value&&(S.value=S.value.filter(_=>_?.toString()!==p?.toString()),s.value=[...S.value],a("change",s.value),Pe(null),e.nextTick(()=>y.value?.focus()))},Pe=(p,_)=>{const v=_??(o.value?[...S.value]:p?.id??null);a("value-selected",{name:n.name,value:v,option:p})},Ue=p=>{o.value?(G(p.id)||(S.value=[...S.value,p.id],s.value=[...S.value],a("change",s.value),Pe(p)),V.value="",e.nextTick(()=>{y.value?.focus(),h.value=Math.min(h.value,j.value.length-1)}),Be(null)):(b.value=p,s.value=p.id,a("change",s.value),Pe(p),V.value="",M(),Be(p))},$t=p=>{if(G(p.id)){o.value||M();return}Ue(p)},Ye=(p,_)=>{if(!p||!_)return;const v=p.offsetTop,L=v+p.offsetHeight,K=_.scrollTop,le=K+_.clientHeight;let te=_.scrollTop;v<K?te=v-80:L>le&&(te=L-_.clientHeight+4);const he=_;he.scrollTop=te},ze=p=>{let _=p.parentElement;for(;_;){if(_.classList.contains("ui-dialog__content"))return _;const v=window.getComputedStyle(_),L=v.overflow+v.overflowY+v.overflowX;if(L.includes("auto")||L.includes("scroll")||_===document.body||_===document.documentElement)return _;_=_.parentElement}return document.body},We=()=>{if(!c.value)return;const p=c.value.getBoundingClientRect(),_=window.innerHeight||document.documentElement.clientHeight,v=window.innerWidth||document.documentElement.clientWidth,L=8,K=8,le=n.maxHeight||300,te=_-p.bottom-K-L,he=p.top-K-L,ke=te>=he,ve=Math.max(v-L*2,0);let{width:qe}=p;ve>0&&qe>ve&&(qe=ve);let{left:Ie}=p;Ie+qe+L>v&&(Ie=v-qe-L),Ie=Math.max(Ie,L);const pn=Math.min(le,Math.max(ke?te:he,50));w.value=ke?"bottom":"top",x.value={position:"fixed",left:`${Ie}px`,width:`${qe}px`,maxHeight:`${pn}px`,transform:ke?"none":"translateY(-100%)",top:ke?`${p.bottom+K}px`:`${p.top-K}px`}},He=async p=>{r.value||!k.value&&(p.key==="ArrowDown"||p.key==="ArrowUp")&&(p.preventDefault(),await fe())},Ce=p=>{if(!k.value)return;const{key:_}=p;if(_==="ArrowDown")p.preventDefault(),h.value+1<j.value.length&&(h.value+=1,Ye(g.value[h.value],d.value));else if(_==="ArrowUp")p.preventDefault(),h.value>0&&(h.value-=1,Ye(g.value[h.value],d.value));else if(_==="Enter"){p.preventDefault();const v=j.value[h.value];v&&Ue(v),y.value?.blur()}else _==="Escape"?(p.preventDefault(),M()):_==="Backspace"?o.value&&V.value===""&&S.value.length&&(S.value=S.value.slice(0,-1),s.value=[...S.value],a("change",s.value)):_==="Home"?(h.value=0,Ye(g.value[0],d.value)):_==="End"?(h.value=j.value.length-1,Ye(g.value[h.value],d.value)):_==="Tab"&&M()},Ze=()=>{r.value||(C.value=!0)},Dt=()=>{C.value=!1,V.value=""},Me=p=>{p.key==="Escape"&&k.value&&M()},At=p=>{const _=p.target;i.value?.contains(_)||u.value?.contains(_)||M()},Ft=p=>{k.value&&d.value&&!d.value.contains(p.target)&&We()},Lt=()=>{k.value&&We()},Tt=()=>{k.value&&We()};e.watch(()=>n.options,p=>{p?.length&&(E.value=[...p],Je())},{immediate:!0});async function Je(){if(o.value)Array.isArray(s.value)?S.value=[...s.value]:(S.value=s.value==null?[]:[s.value],s.value=[...S.value]),n.data&&S.value.length&&(await ae(S.value),await e.nextTick());else{if(Array.isArray(s.value)){const p=s.value[0]??null;s.value=p??null}s.value!=null&&(b.value=await ee(s.value)),Be(b.value??null)}}e.watch(s,()=>{Je()}),e.onMounted(async()=>{addEventListener("keydown",Me),addEventListener("scroll",Ft,!0),addEventListener("resize",Lt),document.addEventListener("click",At,!0),c.value&&ze(c.value).addEventListener("scroll",Tt,!0),n.options?.length&&!n.data?E.value=[...n.options]:n.data&&(E.value=await P("")),await Je(),N.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",Me),removeEventListener("scroll",Ft,!0),removeEventListener("resize",Lt),document.removeEventListener("click",At,!0),c.value&&ze(c.value).removeEventListener("scroll",Tt,!0)});const nt=e.ref(!1),ut=e.ref({}),It=e.ref([]),Ot=e.ref(null);async function un(){if(!(!n.add?.token||Ot?.value.validate()))try{const _=n.add.api??`/api/table/${n.add.token}`,v=await fetch(_,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ut.value)}),L=await v.json().catch(()=>({})),K=L?.error||L?.message,le=Number(L?.code)>=400;if(!v.ok||le){me.notify({title:"Помилка",type:"error",message:K||`Код помилки: ${L?.code||v.status}`});return}const te=L?.id;if(!te){me.notify({title:"Помилка",type:"error",message:"Обʼєкт створено, але в відповіді відсутній ID."});return}if(!n.options?.length&&n.data){const he=await fetch(`${n.api??`/api/suggest/${n.data}`}?val=${te}`).then(ke=>ke.json());b.value=he[0],E.value.push(he[0]),s.value=te}nt.value=!1,me.notify({title:"Успіх",message:"Обʼєкт успішно створено."})}catch(_){me.notify({title:"Помилка",type:"error",message:_?.message||"Не вдалося створити обʼєкт."})}}async function zt(){if(!n.add)return null;const p=await fetch(`/api/template/form/${n.add.form}`).then(_=>_.json());return It.value=p.schema,nt.value=!0,null}function m(p,_=200){let v;return(...L)=>{v&&clearTimeout(v),v=window.setTimeout(()=>p(...L),_)}}const f=m(async p=>{E.value=await P(p)},200);e.watch(V,p=>{n.data&&f(p.trim())}),e.watch(()=>n.options,p=>{!n.data&&p?.length&&(E.value=[...p],Je())},{immediate:!0}),e.watch(()=>n.parent??n.parentValue,()=>{n.data&&U()});const N=e.ref(!0);return e.watch(D,async()=>{if(n.data&&(N.value||(o.value?(S.value=[],s.value=[],a("change",[])):(b.value=null,s.value=null,a("change",null))),await U(),n.auto===1&&D.value&&E.value.length>0)){const p=E.value[0];p&&Ue(p)}}),(p,_)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(me.VsModal),{visible:nt.value,"onUpdate:visible":_[1]||(_[1]=v=>nt.value=v),class:"z-[1000]",title:"Додати",buttonText:"Додати",onDone:un,teleport:l.teleport},{default:e.withCtx(()=>[e.createVNode(Oe,{schema:It.value,modelValue:ut.value,"onUpdate:modelValue":_[0]||(_[0]=v=>ut.value=v),ref_key:"addForm",ref:Ot},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:_[5]||(_[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass])},[_[10]||(_[10]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),_[11]||(_[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(["vs-input-select__control flex min-h-[38px] items-center justify-between rounded transition-colors bg-white",r.value?"bg-gray-100 text-gray-400 cursor-not-allowed":""]),role:"combobox","aria-expanded":k.value,"aria-haspopup":"listbox",onKeydown:He,onClick:Q,"data-focus":k.value||C.value?"true":"false",ref_key:"triggerRef",ref:c},[e.createElementVNode("div",Br,[o.value?(e.openBlock(),e.createElementBlock("div",Cr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(F.value,v=>(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:v.id},[e.createElementVNode("div",Sr,[re(v)?(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:v?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ge(v)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(Zt),style:e.normalizeStyle(se(v)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(X(v)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"truncate text-[#172b4d] overflow-hidden max-w-[200px] px-0.5 pl-1.5",title:Y(v)},[A.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:Z(v)},null,8,Mr)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(v.text),1)],64))],8,Nr)]),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(L=>be(v.id),["stop"])},[..._[6]||(_[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,$r)]))),128)),e.createElementVNode("div",Dr,[!r.value&&l.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:y,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900 hover:cursor-pointer",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:S.value.length?" ":B.value,"onUpdate:modelValue":_[2]||(_[2]=v=>V.value=v),onFocus:Ze,onBlur:Dt,onKeydown:Ce},null,40,Ar)),[[e.vModelText,V.value]]):e.createCommentVNode("",!0)])])):!o.value&&$.value&&V.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900 absolute flex items-center gap-1 min-w-0"]),title:$.value},[re(b.value)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block flex-shrink-0",style:e.normalizeStyle({backgroundColor:b.value?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ge(b.value)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(Zt),style:e.normalizeStyle(se(b.value)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(X(b.value)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),A.value?(e.openBlock(),e.createElementBlock("span",{key:2,class:"truncate flex-1 min-w-0",innerHTML:Z(b.value)},null,8,Lr)):(e.openBlock(),e.createElementBlock("span",Tr,e.toDisplayString(b.value?.text),1))],8,Fr)):e.createCommentVNode("",!0),o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ir,[!r.value&&l.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:y,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900 hover:cursor-pointer",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:$.value?" ":B.value,"onUpdate:modelValue":_[3]||(_[3]=v=>V.value=v),onFocus:Ze,onBlur:Dt,onKeydown:Ce},null,40,Or)),[[e.vModelText,V.value]]):e.createCommentVNode("",!0)]))]),e.createElementVNode("div",zr,[H.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(pe,["stop"])},[..._[7]||(_[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,Rr)):e.createCommentVNode("",!0),_[9]||(_[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:_[4]||(_[4]=e.withModifiers(v=>W(),["stop"])),title:k.value?"Закрити список":"Відкрити список"},[..._[8]||(_[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,jr)])],42,Vr),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[k.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,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(x.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:x.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[j.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(j.value,(v,L)=>(e.openBlock(),e.createElementBlock("div",{key:v.id,ref_for:!0,ref:K=>g.value[L]=K,class:e.normalizeClass(["flex px-3 py-2 gap-2 cursor-pointer select-none text-gray-900",G(v.id)?"bg-[#2684ff] text-white":"bg-white hover:bg-[#deebff] hover:text-[#172b4d]",h.value===L&&!G(v.id)?"bg-[#deebff] text-[#172b4d]":""]),"aria-disabled":G(v.id)?"true":"false",role:"option",tabindex:"-1",onClick:K=>$t(v)},[re(v)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block flex-shrink-0",style:e.normalizeStyle({backgroundColor:v?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ge(v)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(Zt),style:e.normalizeStyle(se(v)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(X(v)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",h.value===v.id?"text-white":"",(h.value===L,"")])},[A.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:Z(v)},null,8,Ur)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(v.text),1)],64))],2)],10,Pr))),128)):(e.openBlock(),e.createElementBlock("div",Hr," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),n.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:zt,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(Ae,{width:"16",height:"16"}),_[12]||(_[12]=e.createElementVNode("span",null,"Додати",-1))],8,qr)):e.createCommentVNode("",!0)],512)],64))}}),[["__scopeId","data-v-df831fc2"]]),Gr=["placeholder","disabled"],En=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}=Ee(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,c)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":c[0]||(c[0]=d=>a.value=d),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,Gr)),[[e.vModelText,a.value]])}}),Kr={key:1,class:"richtext-error"},Vn=e.defineComponent({__name:"vs-input-richtext",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},richtextProps:{default:()=>({})}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=e.ref(null);e.onMounted(async()=>{try{const d=await import("@opengis/richtext");t.value=d.VsRichtext}catch{console.warn("@opengis/richtext is not installed. Please install it in your app to use richtext input.")}});const n=l,{inputClass:a}=Ee(n.style),o=e.useModel(l,"modelValue"),r=e.computed(()=>!!n.disabled),s=e.computed(()=>n.placeholder??""),i=e.computed(()=>({height:"300px",...n.richtextProps}));return(c,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["richtext-wrapper !h-full !border-transparent",[l.customClass,e.unref(a),{"richtext-disabled":r.value}]]),style:e.normalizeStyle(r.value?{pointerEvents:"none",opacity:.6}:{})},[t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.mergeProps({key:0,modelValue:o.value,"onUpdate:modelValue":d[0]||(d[0]=u=>o.value=u),placeholder:s.value},i.value),null,16,["modelValue","placeholder"])):(e.openBlock(),e.createElementBlock("div",Kr,[...d[1]||(d[1]=[e.createElementVNode("p",null,"@opengis/richtext package is not installed.",-1),e.createElementVNode("p",null,"Please install it: npm install @opengis/richtext",-1)])]))],6))}}),Yr={},Wr={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 Zr(l,t){return e.openBlock(),e.createElementBlock("svg",Wr,[...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 Jr=ne(Yr,[["render",Zr]]),Xr={},Qr={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 es(l,t){return e.openBlock(),e.createElementBlock("svg",Qr,[...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 ts=ne(Xr,[["render",es]]),ns={},ls={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 as(l,t){return e.openBlock(),e.createElementBlock("svg",ls,[...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 os=ne(ns,[["render",as]]),rs={},ss={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 is(l,t){return e.openBlock(),e.createElementBlock("svg",ss,[...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 ft=ne(rs,[["render",is]]),cs={},ds={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function us(l,t){return e.openBlock(),e.createElementBlock("svg",ds,[...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 ps=ne(cs,[["render",us]]),ms={},fs={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 hs(l,t){return e.openBlock(),e.createElementBlock("svg",fs,[...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 Bn=ne(ms,[["render",hs]]),gs={class:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden flex flex-col"},ys={class:"flex flex-col gap-2 !p-4 border-b border-gray-200 sm:flex-row sm:items-center sm:justify-between bg-gray-50"},ks={class:"relative w-full"},bs={class:"flex flex-nowrap items-center justify-end gap-2 w-full overflow-x-auto"},xs={class:"w-full overflow-x-auto"},ws={class:"w-full min-w-[640px] table-auto divide-y divide-gray-200"},_s={class:"bg-gray-50"},vs={class:"border-b border-gray-200"},Es={class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 w-12 text-center"},Vs=["onClick"],Bs={key:0,class:"text-gray-400"},Cs={key:0,colspan:"100%",class:"text-center"},Ss={class:"w-full"},Ns={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},Ms=["onDragstart","onDragover","onDrop"],$s={class:"px-4 py-3 text-center align-middle"},Ds={class:"flex items-center justify-center"},As=["innerHTML"],Fs={key:0,class:"flex items-center gap-3 text-sm text-gray-700"},Ls={key:0},Ts=["src"],Is={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},Os={key:1,class:"flex items-center justify-center"},zs={key:2,class:"text-sm font-medium text-gray-900"},Rs={class:"px-4 py-3 text-right whitespace-nowrap"},js={class:"flex items-center justify-end gap-2"},Ps=["onClick"],Us=["onClick"],Hs={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},Cn=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.useSlots(),a=e.useModel(l,"modelValue"),o=e.ref({}),r=e.ref(""),s=e.ref(null),i=e.ref("asc"),c=e.computed(()=>{const D=a.value??[],P=r.value?D.filter(ae=>t.colModel?.some(ye=>{const fe=ye.key||ye.name;if(!fe)return!1;const M=ae[fe];return M?Array.isArray(M)?M.join(", ").toLowerCase().includes(r.value.toLowerCase()):String(M).toLowerCase().includes(r.value.toLowerCase()):!1})):D;if(!s.value)return P;const U=s.value,ee=[...P].sort((ae,ye)=>{const fe=de(ae?.[U]),M=de(ye?.[U]);return typeof fe=="number"&&typeof M=="number"?fe-M:String(fe).localeCompare(String(M))});return i.value==="asc"?ee:ee.reverse()}),d=e.ref(null),u=e.ref(null),k=e.ref(null),C=D=>{d.value=D},b=D=>{u.value=D},E=D=>{if(d.value===null||d.value===D){d.value=null,u.value=null;return}const P=[...a.value],[U]=P.splice(d.value,1);P.splice(D,0,U),a.value=P,d.value=null,u.value=null},h=()=>{k.value&&k.value.click()},g=D=>{const P=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],U=D.toLowerCase();return P.some(ee=>U.endsWith(ee))},V=D=>{const U=D.target.files?.[0];if(!U)return;const ee=new FileReader;ee.onload=ae=>{try{const ye=ae.target?.result;if(typeof ye=="string"){const fe=JSON.parse(ye);Array.isArray(fe)&&a.value.push(...fe)}}catch(ye){console.error("Error parsing file:",ye)}},ee.readAsText(U)},y=()=>{const D=JSON.stringify(a.value,null,2),P=new Blob([D],{type:"application/json"}),U=URL.createObjectURL(P),ee=document.createElement("a");ee.href=U,ee.download="data.json",ee.click(),URL.revokeObjectURL(U)},w=new Set(["autocomplete","select","radio","checkbox","combobox"]),x=new Map,S=(D,P)=>{const U=`/api/suggest/${D}`,ee=U.includes("?")?"&":"?",ae=P?`&val=${P}`:"";return`${U}${ee}json=1${ae}`},F=D=>D==null||D===""?null:typeof D=="object"?D?.id!==void 0&&D.id!==null&&D.id!==""?D.id:null:D,B=D=>{const P=new Set;return Array.isArray(a.value)&&a.value.forEach(U=>{const ee=U?.[D];if(ee==null||ee==="")return;if(Array.isArray(ee)){ee.forEach(ye=>{const fe=F(ye);fe!==null&&P.add(fe)});return}const ae=F(ee);ae!==null&&P.add(ae)}),P},$=async()=>{if(!t.colModel?.length)return;const D=t.colModel.filter(P=>P.data&&w.has(P.type?.toLowerCase()||""));D.length&&await Promise.all(D.map(async P=>{const U=P.key||P.name;if(!U)return;const ee=B(U),ae=Array.from(ee).map(M=>String(M)).sort(),ye=ae.join(",");if(!ae.length||x.get(U)===ye)return;x.set(U,ye);const fe=ae.map(encodeURIComponent).join(",");try{const W=await(await fetch(S(P.data,fe))).json();o.value[U]=W?.data??W}catch(M){console.error("Failed to fetch column values",M)}}))};e.watch([()=>t.colModel,()=>a.value],()=>{$()},{immediate:!0,deep:!0});const H=e.ref(""),G=e.ref(!1);let j="edit",z=0;const R=D=>(D?.format||D?.type||"").toString().toLowerCase(),q=e.computed(()=>t.colModel?.filter(D=>R(D)!=="slot").map(D=>{const{slot:P,...U}=D;return U})??[]),O=e.ref({}),A=e.ref({}),Z=D=>typeof D!="string"?!1:!!n[D],Y=(D,P)=>P?P.split(".").reduce((U,ee)=>U==null?U:U[ee.trim()],D):D,ue=(D,P)=>typeof D!="string"?"":D.replace(/{{\s*([^}]+)\s*}}/g,(U,ee)=>{const ae=Y(P,ee.trim());return ae??""}),de=D=>{if(D==null||D==="")return"";if(typeof D=="number")return D;if(typeof D=="boolean")return D?1:0;if(typeof D=="string")return D.toLowerCase();if(Array.isArray(D))return D.map(P=>de(P)).join(", ");if(typeof D=="object"){if(D.text!==void 0)return String(D.text).toLowerCase();if(D.label!==void 0)return String(D.label).toLowerCase();if(D.id!==void 0)return String(D.id).toLowerCase()}return String(D).toLowerCase()},Ne=D=>{const P=D.key||D.name;if(P){if(s.value===P){i.value=i.value==="asc"?"desc":"asc";return}s.value=P,i.value="asc"}};async function I(){H.value="Додати",G.value=!0,j="add",O.value={}}function T(D,P){if(!D?.length)return null;const U=typeof P=="object"?P?.id:P;return U==null||U===""?null:D.find(ee=>ee?.id?.toString()===U.toString())?.text??null}function X(D){return D==null||D===""?"-":Array.isArray(D)?D.map(P=>typeof P=="object"?P?.text??P?.id??"-":P).join(", "):typeof D=="object"?D?.text??D?.id??"-":D}function re(D,P){const U=P.key||P.name,ee=D?.[U],ae=o.value[U];if(!ee)return"-";if(Array.isArray(ee)){const fe=ee.map(M=>T(ae,M)).filter(Boolean);return fe.length?fe.join(", "):X(ee)}const ye=T(ae,ee);return ye||X(ee)}async function se(D,P){H.value="Редагувати",G.value=!0,j="edit",z=P,O.value={...D}}function ge(){const D=A.value.validate();if(D){me.notify({type:"warning",title:"Помилка валідації",message:Object.entries(D).map(([P,U])=>`${P}: ${U}`).join(`
|
|
2
|
-
`)});return}j==="add"?Array.isArray(a.value)?a.value=[...a.value,O.value]:a.value=[O.value]:a.value=a.value.map((P,U)=>U===z?O.value:P),G.value=!1}function De(D){a.value=a.value.filter((P,U)=>U!==D)}function Be(){G.value=!1}return(D,P)=>(e.openBlock(),e.createElementBlock("div",gs,[e.createElementVNode("div",ys,[e.createElementVNode("div",ks,[e.createVNode(Jr,{width:"16",height:"16",class:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":P[0]||(P[0]=U=>r.value=U),placeholder:"Пошук",class:"w-full rounded-md border border-gray-200 bg-white pl-10 pr-3 py-2 text-sm text-gray-900 placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100"},null,512),[[e.vModelText,r.value]])]),e.createElementVNode("div",bs,[e.createElementVNode("input",{ref_key:"fileInput",ref:k,onChange:V,class:"hidden",accept:".json",type:"file"},null,544),e.createElementVNode("button",{type:"button",onClick:h,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[e.createVNode(ts,{class:"text-gray-700",width:"16",height:"16"}),P[4]||(P[4]=e.createTextVNode(" Імпорт ",-1))]),e.createElementVNode("button",{type:"button",onClick:y,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[e.createVNode(os,{class:"text-gray-700",width:"16",height:"16"}),P[5]||(P[5]=e.createTextVNode(" Експорт ",-1))]),e.createElementVNode("button",{onClick:I,type:"button",class:"inline-flex items-center gap-2 rounded-md bg-blue-500 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-600 transition-colors"},[e.createVNode(Ae,{class:"text-white"}),P[6]||(P[6]=e.createTextVNode(" Додати ",-1))])])]),e.createElementVNode("div",xs,[e.createElementVNode("table",ws,[e.createElementVNode("thead",_s,[e.createElementVNode("tr",vs,[e.createElementVNode("th",Es,[e.createVNode(ft,{width:"20",height:"20",class:"mx-auto text-gray-400"})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.colModel,U=>(e.openBlock(),e.createElementBlock("th",{key:U.key,class:"px-4 py-3 text-left text-xs font-semibold text-gray-900"},[e.createElementVNode("button",{type:"button",onClick:ee=>Ne(U),class:"flex items-center gap-1 text-xs font-semibold text-gray-700 hover:text-gray-900 transition-colors"},[e.createElementVNode("span",null,e.toDisplayString(U.ua||U.label),1),s.value===(U.key||U.name)?(e.openBlock(),e.createElementBlock("span",Bs,e.toDisplayString(i.value==="asc"?"▲":"▼"),1)):e.createCommentVNode("",!0)],8,Vs)]))),128)),P[7]||(P[7]=e.createElementVNode("th",{class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 text-center w-[1%] whitespace-nowrap"}," Дії ",-1))])]),e.createElementVNode("tbody",{class:e.normalizeClass(["divide-y divide-gray-200",{"[&_tr:last-child]:border-0":!u.value}])},[c.value.length===0?(e.openBlock(),e.createElementBlock("td",Cs,[e.createElementVNode("div",Ss,[e.createElementVNode("div",Ns,[e.createVNode(ps,{class:"w-48 mx-auto"}),P[8]||(P[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(c.value,(U,ee)=>(e.openBlock(),e.createElementBlock("tr",{key:U.id,class:e.normalizeClass(["border-b transition-colors hover:bg-gray-50 cursor-move text-sm text-gray-700",{"opacity-50":d.value===ee,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":u.value===ee}]),draggable:"true",onDragstart:ae=>C(ee),onDragover:e.withModifiers(ae=>b(ee),["prevent"]),onDrop:ae=>E(ee)},[e.createElementVNode("td",$s,[e.createElementVNode("div",Ds,[e.createVNode(ft,{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,ae=>(e.openBlock(),e.createElementBlock("td",{key:ae.key,class:"px-4 py-3 align-middle"},[R(ae)==="slot"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[Z(ae.slot)?e.renderSlot(D.$slots,ae.slot,{key:0,row:U,value:U[ae.key],column:ae}):(e.openBlock(),e.createElementBlock("div",{key:1,class:"text-sm text-gray-900",innerHTML:ue(ae.slot,U)},null,8,As))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[R(ae)==="file"?(e.openBlock(),e.createElementBlock("div",Fs,[g(re(U,ae))?(e.openBlock(),e.createElementBlock("div",Ls,[e.createElementVNode("img",{src:re(U,ae),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,Ts)])):(e.openBlock(),e.createElementBlock("div",Is,[e.createVNode(kn,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):R(ae)==="color"?(e.openBlock(),e.createElementBlock("div",Os,[e.createElementVNode("span",{class:"inline-flex h-6 w-6 rounded border border-gray-200",style:e.normalizeStyle({backgroundColor:re(U,ae)||"#ffffff"})},null,4)])):(e.openBlock(),e.createElementBlock("div",zs,e.toDisplayString(re(U,ae)),1))],64))]))),128)),e.createElementVNode("td",Rs,[e.createElementVNode("div",js,[e.createElementVNode("button",{onClick:ae=>se(U,ee),class:"p-1.5 text-gray-600 hover:text-blue-600 hover:bg-blue-50 rounded transition-colors"},[e.createVNode(Bn,{width:"16",height:"16"})],8,Ps),e.createElementVNode("button",{onClick:ae=>De(ee),class:"p-1.5 text-gray-600 hover:text-red-600 hover:bg-red-50 rounded transition-colors"},[e.createVNode(Qe,{width:"16",height:"16"})],8,Us)])])],42,Ms))),128))],2)])]),e.createVNode(e.unref(me.VsModal),{visible:G.value,title:H.value,size:"lg",onClose:Be,teleport:"#modal"},{default:e.withCtx(()=>[e.createVNode(Oe,{schema:q.value,values:O.value,"onUpdate:values":P[1]||(P[1]=U=>O.value=U),form:A.value,"onUpdate:form":P[2]||(P[2]=U=>A.value=U)},null,8,["schema","values","form"]),e.createElementVNode("div",Hs,[e.createElementVNode("button",{type:"button",onClick:P[3]||(P[3]=U=>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:ge,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"])]))}}),qs={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:"Клацніть на шари, щоб видалити їх"}}}}},Gs={},Ks={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 Ys(l,t){return e.openBlock(),e.createElementBlock("svg",Ks,[...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 Ws=ne(Gs,[["render",Ys]]),Zs={},Js={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 Xs(l,t){return e.openBlock(),e.createElementBlock("svg",Js,[...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 Qs=ne(Zs,[["render",Xs]]),ei={},ti={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 ni(l,t){return e.openBlock(),e.createElementBlock("svg",ti,[...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 li=ne(ei,[["render",ni]]),ai={},oi={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 ri(l,t){return e.openBlock(),e.createElementBlock("svg",oi,[...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 si=ne(ai,[["render",ri]]),ii={},ci={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 di(l,t){return e.openBlock(),e.createElementBlock("svg",ci,[...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 ui=ne(ii,[["render",di]]),pi={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},mi={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"},fi=["onClick"],hi={class:"relative flex-1 min-w-[140px]"},gi=["placeholder"],yi="https://data.softpro.ua/api-user/gis-url-proxy",ki="https://geo.rv.ua/api-user/dzk.api",bi=ne(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 x=n.config?.tools?.filter(S=>o.includes(S));return x&&x.length?x:o}),s=e.computed(()=>n.config?.placeholder?.trim()||"Пошук…"),i=e.ref(r.value[0]??o[0]);e.watch(r,x=>{x.includes(i.value)||(i.value=x[0])});const c=e.ref(""),d=e.ref(!1),u=e.ref(null);e.watch(i,()=>{c.value="",d.value=!1});function k(x){i.value=x}function C(x){if(!d.value)return;const S=u.value;S&&!S.contains(x.target)&&(d.value=!1)}e.onMounted(()=>{window.addEventListener("click",C,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",C,!0)});function b(x){return x==="xy"?"Координати":x==="parcel"?"Кадастр":"Адреси"}function E(x){const S=x.replace(/[,]+/g," ").trim();if(!S)return null;const F=S.split(/\s+/).filter(Boolean);if(F.length<2)return null;const B=F.slice(0,2).map(Number);if(!B.every(q=>Number.isFinite(q)))return null;const[$,H]=B;let G=$,j=H;const z=q=>Math.abs(q)<=90,R=q=>Math.abs(q)<=180;if(!z(G)||!R(j))if(z(j)&&R(G))G=H,j=$;else return null;return{lat:G,lng:j}}function h(x){return(x?.items||[]).map((F,B)=>({id:String(F?.id??B),title:F?.title||F?.address?.label||"Знайдений обʼєкт",lat:Number(F?.position?.lat),lng:Number(F?.position?.lng)})).filter(F=>Number.isFinite(F.lat)&&Number.isFinite(F.lng))}function g(x){const S=x?.result||x?.data||x;if(!S)return[];const F=S.geom_centroid;if(!F||!Array.isArray(F.coordinates))return[];const[B,$]=F.coordinates;return!Number.isFinite($)||!Number.isFinite(B)?[]:[{id:"parcel",title:S.cadnum||S.cad_num||"Земельна ділянка",lat:$,lng:B}]}function V(x){const F=x.replace(/\s+/g,"").split(":");if(F.length!==4)return!1;const B=[10,2,3,4];return F.every(($,H)=>$.length===B[H]&&/^\d+$/.test($))}function y(x){a("goToCoordinates",[x.lat,x.lng])}async function w(){const x=c.value.trim();if(x){if(i.value==="xy"){const S=E(x);if(!S){me.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}y(S),c.value="";return}try{const S=new URL(i.value==="here"?yi:ki);if(i.value==="here")S.searchParams.set("searchtext",x);else{if(!V(x)){me.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}S.searchParams.set("cad_num",x)}const F=await fetch(S.toString());if(!F.ok)throw new Error(`HTTP ${F.status}`);const B=await F.json(),$=i.value==="here"?h(B):g(B);if(!$.length)me.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const H=$[0];y(H),c.value=""}}catch(S){const F=S?.message||"Помилка пошуку";me.notify({type:"error",title:"Пошук",message:F})}}}return(x,S)=>(e.openBlock(),e.createElementBlock("div",pi,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(w,["prevent"])},[r.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,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:S[0]||(S[0]=F=>d.value=!d.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":d.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[...S[2]||(S[2]=[e.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))]),d.value?(e.openBlock(),e.createElementBlock("div",mi,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,F=>(e.openBlock(),e.createElementBlock("li",{key:F,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:B=>k(F)},e.toDisplayString(b(F)),9,fi))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",hi,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":S[1]||(S[1]=F=>c.value=F),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,gi),[[e.vModelText,c.value,void 0,{trim:!0}]]),S[3]||(S[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-359172e4"]]),xi={class:"bg-white/30 p-1 rounded-md shadow w-fit"},wi={class:"flex gap-2"},_i=["onClick","title"],vi=["src"],Ei=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(c){o("onLayerChange",c),a.value=c}const s={z:13,x:4790,y:2762};function i(c){if(c?.preview)return c.preview;if(!c?.url)return;const d={"{z}":s.z,"{x}":s.x,"{y}":s.y};let u=c.url;return Object.entries(d).forEach(([k,C])=>{u=u.replace(new RegExp(k,"gi"),String(C))}),u}return(c,d)=>(e.openBlock(),e.createElementBlock("div",xi,[e.createElementVNode("div",wi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.basemaps,(u,k)=>(e.openBlock(),e.createElementBlock("div",{key:k,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":a.value===k}]),onClick:C=>r(k),title:u.name||k,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:i(u),alt:"",class:"w-10 h-10 object-cover"},null,8,vi)],10,_i))),128))])]))}});function Vi(l){return l?l.type==="FeatureCollection"||l.type==="Feature"?l:l.geom?.type&&Array.isArray(l.geom.coordinates)?{type:"Feature",geometry:{type:l.geom.type,coordinates:l.geom.coordinates},properties:l.properties??{}}:l.type&&Array.isArray(l.coordinates)?{type:"Feature",geometry:{type:l.type,coordinates:l.coordinates},properties:l.properties??{}}:null:null}const Bi={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},Ci={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},Si={class:"text-sm font-medium"},Ni={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},Mi={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},$i={class:"flex items-center gap-1"},Di=["disabled"],Ai=["disabled"],Fi=["disabled"],Li={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"},Ti={class:"space-y-0.5"},Ii={class:"text-gray-500"},Oi={class:"text-gray-900 text-right break-all"},zi={class:"absolute top-4 right-4 z-[1000]"},Ri={class:"flex flex-col gap-[2px]"},ji=["disabled"],Pi=["disabled"],Ui=["disabled"],Hi=["disabled"],qi=["disabled"],Gi={class:"flex flex-col gap-2"},Ki={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]"},Yi={class:"flex flex-col gap-1"},Wi=["checked","disabled","onChange"],Zi={class:"text-gray-700 text-xs font-medium"},Ji={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"},Xi={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},Qi={class:"shrink-0"},ec={class:"font-bold"},tc={class:"flex items-center"},nc={class:"text-xs mr-2"},lc={key:0,class:"text-xs"},ac={key:1,class:"text-xs"},oc=["disabled"],rc=["disabled"],ht="vs-base-tile-pane",gt="vs-overlay-tile-pane",yt="__vs_form_leaflet_loader__",Xt="__vs_form_leaflet_scripts__",Sn=ne(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:{},center:{default:void 0},zoom:{default:void 0},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,c=e.computed(()=>!!s.disabled),d=e.ref(!1),u=e.ref(null),k=e.ref(!1),C=e.ref(""),b=e.ref(null),E=e.ref(null),h=e.ref(!1),g=e.ref(null),V=e.ref(null),y=e.ref(0),w=e.ref(Array.isArray(s.center)&&s.center.length===2?[...s.center]:o),x=e.ref(typeof s.zoom=="number"?s.zoom:r),S=e.ref([]),F=e.ref(s.modelValue);let B=!1;const $=e.ref(null),H=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 f=new Set(s.tools.map(N=>N.toLowerCase()));return{search:f.has("search"),import:f.has("import"),export:f.has("export"),point:f.has("point"),line:f.has("line"),polygon:f.has("polygon"),rectangle:f.has("rectangle")}}),G=e.reactive({}),j=e.ref([]),z=e.computed(()=>j.value.map(m=>G[m]).filter(Boolean)),R=e.ref(null),q=e.computed(()=>R.value?.entries??[]),O=e.computed(()=>{if(!R.value)return;const m=12,f=R.value.point.x+m,N=R.value.point.y+m;return{left:`${f}px`,top:`${N}px`}});function A(m){if(typeof m!="string"||!m.trim())return"";if(/^https?:\/\//i.test(m))return m;const f=window?.location?.origin??"",N=m.replace(/^\/+/,"");return N?f?`${f}/${N}`:`/${N}`:f}function Z(){if(Array.isArray(a.basemaps)&&a.basemaps.length){const f=a.basemaps.map((N,p)=>{const _=String(N?.key??N?.id??N?.name??`b${p}`),v=A(String(N?.url??""));if(!v)return null;const L=typeof N?.preview=="string"&&N.preview?A(N.preview):"";return[_,{...N,url:v,preview:L}]}).filter(N=>Array.isArray(N)&&N.length===2).reduce((N,[p,_])=>(N[p]=_,N),{});if(Object.keys(f).length)return f}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 Y=Z(),ue=Object.keys(Y),de=e.ref(ue.length?ue[0]:"");let Ne,I,T,X,re,se=null;async function ge(){if(typeof window>"u")return null;const m=window;if(m[yt])return m[yt];const f=L=>{if(!Array.from(document.styleSheets).some(K=>K?.href?.includes(L))){const K=document.createElement("link");K.rel="stylesheet",K.href=L,document.head.appendChild(K)}};m[Xt]=m[Xt]||{};const N=m[Xt],p=L=>(N[L]||(N[L]=new Promise((K,le)=>{const te=Array.from(document.scripts).find(ke=>ke.src===L);if(te){te.addEventListener("load",()=>K(),{once:!0}),te.addEventListener("error",ke=>le(ke),{once:!0});return}const he=document.createElement("script");he.src=L,he.async=!1,he.onload=()=>K(),he.onerror=ke=>le(ke),document.head.appendChild(he)})),N[L]),v=(async()=>{f("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),f("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),window.L||await p("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"),await p("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js"),await p("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js");const L=window.L;if(!L)throw new Error("Leaflet global not available after loading scripts");return L})().catch(L=>{throw delete m[yt],L});return m[yt]=v,v}function De(){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 Be(){if(!s.handleZoom||!u.value||!I)return null;let m;const f=p=>{const _=p.ctrlKey||p.metaKey||p.shiftKey;if(!s.ctrlZoom){k.value=!1,I.scrollWheelZoom.enable();return}if(!_){k.value=!0,C.value=De(),clearTimeout(m),m=window.setTimeout(()=>k.value=!1,1200);return}p.preventDefault(),p.stopPropagation(),k.value=!1,I.scrollWheelZoom.enable(),setTimeout(()=>I.scrollWheelZoom.disable(),120)},N=p=>{if(p.touches.length===1){if(!s.ctrlZoom)return;k.value=!0,C.value=De(),clearTimeout(m),m=window.setTimeout(()=>k.value=!1,3e3)}else k.value=!1};return u.value.addEventListener("wheel",f,{passive:!1}),u.value.addEventListener("touchstart",N,{passive:!0}),I.on("wheel",p=>{if(!s.ctrlZoom)return;p.originalEvent?.ctrlKey||p.originalEvent?.metaKey||p.originalEvent?.shiftKey||(p.originalEvent?.preventDefault?.(),p.originalEvent?.stopPropagation?.())}),()=>{u.value?.removeEventListener("wheel",f),u.value?.removeEventListener("touchstart",N),clearTimeout(m)}}function D(m,f){return m?.id?String(m.id):m?.url?`${m.url}-${f}`:`layer-${f}`}function P(m){const f=(m?.url??"").trim();if(!f)return"";if(/^https?:\/\//i.test(f))return f;const N=window.location?.origin??"",p=f.replace(/^\/+/,"");return`${N}/${p}`}function U(m){const f=m?.style??{};return N=>{const{colorAttr:p}=f,_=f.colorSet??{},v=typeof p=="string"?_?.[N?.[p]]??f.color??"#3388ff":f.color??"#3388ff",L=f.stroke??v;return{weight:f.width??1,color:L,opacity:f.opacity??1,fill:f.type?f.type!=="polyline":!0,fillColor:v,fillOpacity:f.opacity??.5}}}function ee(m){return m?.layer?.properties||m?.layer?.feature?.properties||m?.properties||{}}function ae(m,f={}){return m.popup===!1?[]:Array.isArray(m.popup)&&m.popup.length?m.popup.map(N=>{if(!N?.field)return null;const p=f[N.field];return p==null||p===""?null:{key:N.label||N.field,value:String(p)}}).filter(N=>!!N):Object.entries(f).filter(([N])=>typeof N=="string"&&N).slice(0,5).map(([N,p])=>({key:N,value:p==null?"—":String(p)}))}function ye(m,f){if(!I||!f?.latlng)return;const N=I.latLngToContainerPoint(f.latlng),p=ee(f),_=ae(m,p);if(!_.length){fe(m.id);return}R.value={layerId:m.id,title:p?.name||m.title||m.name,properties:p,entries:_,point:{x:N.x,y:N.y}}}function fe(m){m&&R.value?.layerId!==m||(R.value=null)}function M(m){const f=(m?.service??"").toLowerCase(),N=P(m),p=m.sourceLayer||m.layer||m.service_layer||m.service_key||m.map_key||m.dataset?.layer||m.id||m.table_name;if(f==="vtile"){const _=$.value;if(_?.vectorGrid?.protobuf&&!_?.maplibreGL){const v=_.vectorGrid.protobuf(N,{interactive:!0,maxNativeZoom:m.maxzoom??19,vectorTileLayerStyles:{[p??"default"]:U(m),default:U(m)}});return v?.on?.("mouseover",L=>ye(m,L)),v?.on?.("mousemove",L=>ye(m,L)),v?.on?.("mouseout",()=>fe(m.id)),v}if(_?.maplibreGL&&window?.maplibregl){const v=N;return v?_.maplibreGL({style:v,interactive:!1,pane:"overlayPane"}):null}return null}return f==="tile"||/^https?:\/\//i.test(N)||N.includes("{z}")?$.value.tileLayer(N,{opacity:m?.style?.opacity??1,pane:gt}):$.value.tileLayer(N,{opacity:m?.style?.opacity??1,pane:gt})}function W(m){const f=$.value;if(!f)return null;const N=("bounds"in m?m.bounds:void 0)??s.bounds??S.value;if(!Array.isArray(N)||!N.length)return null;const _={color:m.style?.stroke??m.style?.color??"#2563eb",weight:m.style?.width??2,interactive:!1,opacity:m.style?.opacity??.8,dashArray:"4 4"},v=Array.isArray(m.bounds)&&m.bounds.length?m.bounds:N,L=Q(v);if(!L.length||!f?.polyline)return null;const K=L.map(le=>{if(!le.length)return le;const te=le[0],he=le[le.length-1];return te&&he&&typeof he.equals=="function"&&!he.equals(te)?[...le,te]:le});return f.polyline(K,_)}function Q(m){const f=$.value;if(!f||!Array.isArray(m))return[];const N=_=>{if(!Array.isArray(_)||_.length<2)return null;const[v,L]=_;return!Number.isFinite(Number(L))||!Number.isFinite(Number(v))?null:f.latLng(Number(L),Number(v))},p=_=>Array.isArray(_)&&_.length>=2&&_.every(v=>Number.isFinite(Number(v)));if(m.length&&p(m[0])){const _=m.map(N).filter(Boolean);return _.length?[_]:[]}return m.length&&Array.isArray(m[0])&&Array.isArray(m[0][0])&&p(m[0][0][0])?m.flatMap(v=>Array.isArray(v)?v:[]).map(v=>Array.isArray(v)?v.map(N).filter(Boolean):[]).filter(v=>v.length):m.length&&Array.isArray(m[0])&&p(m[0][0])?m.map(v=>Array.isArray(v)?v.map(N).filter(Boolean):[]).filter(v=>v.length):[]}function pe(){if(!I||!$.value)return;se&&I.hasLayer(se)&&(I.removeLayer(se),se=null);const m=W({id:"global-bounds",bounds:s.bounds??S.value,style:{}});m&&(se=m,se.addTo(I))}function be(){!I||!$.value||j.value.forEach(m=>{const f=G[m];f&&(f.visible?(f.layer||(f.layer=M(f.config)),f.boundsLayer||(f.boundsLayer=W(f.config)),f.layer&&!I.hasLayer(f.layer)&&f.layer.addTo(I),f.boundsLayer&&!I.hasLayer(f.boundsLayer)&&f.boundsLayer.addTo(I)):(f.layer&&I.hasLayer(f.layer)&&I.removeLayer(f.layer),f.boundsLayer&&I.hasLayer(f.boundsLayer)&&I.removeLayer(f.boundsLayer),fe(f.id)))})}function Pe(m){if(c.value)return;const f=G[m];f&&(f.visible=!f.visible,f.visible?(f.layer||(f.layer=M(f.config)),f.boundsLayer||(f.boundsLayer=W(f.config)),f.layer&&!I.hasLayer(f.layer)&&f.layer.addTo(I),f.boundsLayer&&!I.hasLayer(f.boundsLayer)&&f.boundsLayer.addTo(I)):(f.layer&&I.hasLayer(f.layer)&&I.removeLayer(f.layer),f.boundsLayer&&I.hasLayer(f.boundsLayer)&&I.removeLayer(f.boundsLayer),fe(f.id)))}e.watch(()=>s.layers,m=>{const f=Array.isArray(m)?m:[],N=[],p=new Set;f.forEach((_,v)=>{if(!_)return;const L=D(_,v);N.push(L),p.add(L);const K=G[L],le={..._,id:L},te=K?.visible??!!le?.visible;K&&(K.layer&&I?.hasLayer(K.layer)&&I.removeLayer(K.layer),K.boundsLayer&&I?.hasLayer(K.boundsLayer)&&I.removeLayer(K.boundsLayer),fe(L)),G[L]={id:L,config:le,visible:te,layer:null,boundsLayer:null}}),Object.keys(G).forEach(_=>{if(!p.has(_)){const v=G[_];v?.layer&&I?.hasLayer(v.layer)&&I.removeLayer(v.layer),v?.boundsLayer&&I?.hasLayer(v.boundsLayer)&&I.removeLayer(v.boundsLayer),fe(_),delete G[_]}}),j.value=N,be()},{immediate:!0,deep:!0}),e.watch(()=>s.bounds,()=>{I&&(Object.values(G).forEach(m=>{m.boundsLayer&&I.hasLayer(m.boundsLayer)&&I.removeLayer(m.boundsLayer),m.boundsLayer=null}),pe(),be())},{deep:!0}),e.watch(()=>s.katottg,async m=>{if(S.value=[],!m){pe();return}try{const f=await fetch(`https://data.gki.com.ua/api-user/atu/${m}`);if(!f?.ok)return;const p=(await f.json())?.geometry?.coordinates;Array.isArray(p)&&p.length&&(S.value=p)}catch(f){console.error("Failed to fetch KATOTTG bounds",f)}finally{pe(),be()}},{immediate:!0}),e.watch(()=>s.modelValue,m=>{if(!I||!T){F.value=m;return}We(m)},{deep:!0});function Ue(m){const f=$.value;return m instanceof f.Circle?"Circle":m instanceof f.Rectangle?"Rectangle":m instanceof f.Polygon&&!(m instanceof f.Rectangle)?"Polygon":m instanceof f.Polyline&&!(m instanceof f.Polygon)?"Polyline":m instanceof f.Marker?"Point":"Feature"}function $t(m){const f=$.value;if(m instanceof f.Circle){const N=m.getRadius();return Math.PI*(N*N)/1e6}if(m instanceof f.Polygon||m instanceof f.Rectangle)try{const N=m.getLatLngs();if(!Array.isArray(N)||!N.length)return null;if(!Array.isArray(N[0])){const L=f.GeometryUtil?.geodesicArea?f.GeometryUtil.geodesicArea(N):0;return L?Math.abs(L)/1e6:0}const p=N[0];if(p.length>0&&(p[0]instanceof f.LatLng||typeof p[0]?.lat=="number")){const{feature:L}=m;if(L?.geometry?.type==="MultiPolygon"){const te=N.reduce((he,ke)=>{if(!Array.isArray(ke)||!ke.length)return he;if(f.GeometryUtil?.geodesicArea){const ve=f.GeometryUtil.geodesicArea(ke);if(ve)return he+Math.abs(ve)}return he},0);return te?te/1e6:0}const le=f.GeometryUtil?.geodesicArea?f.GeometryUtil.geodesicArea(N):0;return le?Math.abs(le)/1e6:0}const v=N.reduce((L,K)=>{if(!Array.isArray(K)||!K.length)return L;const le=Array.isArray(K[0])?K[0]:K;if(f.GeometryUtil?.geodesicArea){const te=f.GeometryUtil.geodesicArea(le);if(te)return L+Math.abs(te)}return L},0);return v?v/1e6:0}catch{return null}return null}function Ye(m){return m instanceof $.value.Circle?m.getLatLng():m.getBounds?m.getBounds().getCenter():m.getLatLng?m.getLatLng():I.getCenter()}function ze(m){const f=T.toGeoJSON(),N=[],p=[];let _=null;const v=K=>{if(K)switch(K.type){case"Point":_=K;break;case"Polygon":N.push(K.coordinates);break;case"MultiPolygon":N.push(...K.coordinates);break;case"LineString":p.push(K.coordinates);break;case"MultiLineString":p.push(...K.coordinates);break;case"GeometryCollection":(K.geometries||[]).forEach(v);break}};(f?.features||[]).forEach(K=>v(K.geometry));const L=_||(N.length?{type:N.length===1?"Polygon":"MultiPolygon",coordinates:N.length===1?N[0]:N}:p.length?{type:p.length===1?"LineString":"MultiLineString",coordinates:p.length===1?p[0]:p}:null);!m?.silent&&!B&&i("update:modelValue",L),y.value=T.getLayers().length}function We(m){if(!T||!$.value)return;T.clearLayers();const f=Vi(m);if(!f){E.value=null,y.value=0;return}$.value.geoJSON(f).eachLayer(p=>T.addLayer(p)),B=!0,ze({silent:!0}),B=!1,He();const N=T.getBounds?.();N?.isValid?.()&&I?.fitBounds(N,{padding:[24,24]})}function He(){const m=T.getLayers();if(!m.length){E.value=null,y.value=0;return}const f=m[m.length-1],N=Ue(f),p=Ye(f),_=T.toGeoJSON(),v=_?.features?.some(te=>te.geometry?.type==="MultiPolygon")||_?.geometry?.type==="MultiPolygon",L=m.length>1&&m.every(te=>te instanceof $.value.Polygon||te instanceof $.value.Rectangle),K=v||L;let le=null;if(K){const te=m.reduce((he,ke)=>{const ve=$t(ke);return he+(ve?ve*1e6:0)},0);le=te?te/1e6:0}else le=$t(f);E.value={type:N,center:p,areaKm2:le,layer:f},y.value=m.length}const Ce=e.ref("");function Ze(m){if(c.value||!I||!$.value)return;Me(),X?.disable&&X.disable();const f=$.value;switch(m){case"marker":X=new f.Draw.Marker(I);break;case"polyline":X=new f.Draw.Polyline(I);break;case"polygon":X=new f.Draw.Polygon(I);break;case"rectangle":X=new f.Draw.Rectangle(I);break}X.enable(),Ce.value=m}function Dt(){re=null,Ce.value==="edit"&&(Ce.value="")}function Me(m=!0){if(re?.disable)try{re.disable()}catch{}Dt(),m&&(ze(),He())}function At(){if(c.value||!I||!T||!$.value||!(T.getLayers?.()??[]).length)return;X?.disable&&X.disable();const f=$.value?.EditToolbar?.Edit;f&&(Me(!1),re=new f(I,{featureGroup:T,selectedPathOptions:{maintainColor:!0}}),re.enable(),Ce.value="edit")}function Ft(){if(!(c.value||!T||!T.getLayers?.().length)){if(Ce.value==="edit"){Me();return}At()}}e.watch(c,m=>{m&&Me()}),e.watch(y,m=>{m>0||Me()});function Lt(){if(c.value)return;const m=E.value?.layer;m&&(m.getBounds?I.fitBounds(m.getBounds(),{padding:[30,30]}):m.getLatLng&&I.setView(m.getLatLng(),Math.max(x.value,14)))}function Tt(){c.value||T&&(Me(!1),T.clearLayers(),i("update:modelValue",null),E.value=null,y.value=0)}const Je=e.ref(null);function nt(){c.value||Je.value?.click()}function ut(m){if(c.value)return;const f=m.target,N=f.files?.[0];if(!N)return;const p=new FileReader;p.onload=()=>{try{const _=JSON.parse(String(p.result));Me(!1),T.clearLayers(),_&&$.value.geoJSON(_).eachLayer(v=>T.addLayer(v)),ze(),He()}finally{f.value=""}},p.readAsText(N)}function It(){if(c.value)return;const m=T.toGeoJSON(),f=new Blob([JSON.stringify(m,null,2)],{type:"application/json"}),N=URL.createObjectURL(f),p=document.createElement("a");p.href=N,p.download="data.geojson",p.click(),URL.revokeObjectURL(N)}function Ot(m){!I||!$.value||!Y[m]||(Ne&&I.removeLayer(Ne),Ne=$.value.tileLayer(Y[m].url,{maxZoom:19,minZoom:6,pane:ht}).addTo(I),de.value=m)}function un(m){if(!I||!$.value)return;const f=$.value.latLng(m[0],m[1]);I.setView(f,13)}let zt=null;return e.onMounted(async()=>{$.value=await ge();const m=$.value;m.drawLocal=qs,I=m.map(u.value,{zoomControl:!1,scrollWheelZoom:!1}).setView(w.value,x.value),m.control.zoom({position:"bottomright"}).addTo(I);const f=de.value||Object.keys(Y)[0];I.createPane(ht),I.getPane(ht).style.zIndex="180",I.createPane(gt),I.getPane(gt).style.zIndex="220",f&&Y[f]&&(de.value=f,Ne=m.tileLayer(Y[f].url,{maxZoom:19,minZoom:6,pane:ht}).addTo(I)),T=new m.FeatureGroup().addTo(I),I.on(m.Draw.Event.CREATED,p=>{if(c.value)return;const{layer:_}=p;T.clearLayers(),T.addLayer(_),ze(),He(),Ce.value=""}),I.on(m.Draw.Event.EDITED,()=>{c.value||(ze(),He())}),I.on(m.Draw.Event.DELETED,()=>{Me(),c.value||(ze(),He())});let N=!1;I.on("mousemove",p=>{N||(I.invalidateSize(),N=!0)}),I.on("zoomend",()=>{x.value=I.getZoom()}),zt=Be(),be(),pe(),F.value!==void 0&&(We(F.value),F.value=void 0)}),e.watch(()=>s.center,m=>{!Array.isArray(m)||m.length!==2||(w.value=[...m],I&&I.setView(w.value,I.getZoom()))},{deep:!0}),e.watch(()=>s.zoom,m=>{typeof m=="number"&&(x.value=m,I&&I.setZoom(m))}),e.onUnmounted(()=>{Me(),zt?.(),fe(),se&&I?.hasLayer(se)&&(I.removeLayer(se),se=null),I?.remove&&I.remove()}),e.watch(d,()=>{setTimeout(()=>{I?.invalidateSize&&I.invalidateSize()},50)}),e.watch(h,async m=>{if(!m||!V.value){g.value=null;return}await e.nextTick();const f=V.value.getBoundingClientRect();g.value={top:f.bottom+6,left:f.left}}),(m,f)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",disabled:!d.value},[e.createElementVNode("div",{class:e.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:d.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:u,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(()=>[k.value&&s.handleZoom?(e.openBlock(),e.createElementBlock("div",Bi,[e.createElementVNode("div",Ci,[e.createElementVNode("p",Si,e.toDisplayString(C.value),1)])])):e.createCommentVNode("",!0)]),_:1}),H.value.search||H.value.import||H.value.export?(e.openBlock(),e.createElementBlock("div",Ni,[H.value.search?(e.openBlock(),e.createBlock(bi,{key:0,onGoToCoordinates:un})):e.createCommentVNode("",!0),H.value.import||H.value.export?(e.openBlock(),e.createElementBlock("div",Mi,[e.createElementVNode("div",$i,[H.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:nt,disabled:c.value}," Import ",8,Di)):e.createCommentVNode("",!0),H.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:It,disabled:c.value||y.value===0}," Export ",8,Ai)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:Je,type:"file",onChange:ut,accept:".json,.geojson",class:"hidden",disabled:c.value},null,40,Fi)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),q.value.length?(e.openBlock(),e.createElementBlock("div",{key:1,class:"absolute z-[1500] pointer-events-none",style:e.normalizeStyle(O.value)},[e.createElementVNode("div",Li,[e.createElementVNode("dl",Ti,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(q.value,N=>(e.openBlock(),e.createElementBlock("div",{key:`${N.key}-${N.value}`,class:"flex justify-between gap-2"},[e.createElementVNode("dt",Ii,e.toDisplayString(N.key),1),e.createElementVNode("dd",Oi,e.toDisplayString(N.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",zi,[e.createElementVNode("div",Ri,[H.value.point?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":Ce.value==="marker"}]),title:"Point",onClick:f[0]||(f[0]=N=>Ze("marker")),disabled:c.value},[e.createVNode(Ws)],10,ji)):e.createCommentVNode("",!0),H.value.line?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":Ce.value==="polyline"}]),title:"Line",onClick:f[1]||(f[1]=N=>Ze("polyline")),disabled:c.value},[e.createVNode(Qs)],10,Pi)):e.createCommentVNode("",!0),H.value.polygon?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":Ce.value==="polygon"}]),title:"Polygon",onClick:f[2]||(f[2]=N=>Ze("polygon")),disabled:c.value},[e.createVNode(li)],10,Ui)):e.createCommentVNode("",!0),H.value.rectangle?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":Ce.value==="rectangle"}]),title:"Rectangle",onClick:f[3]||(f[3]=N=>Ze("rectangle")),disabled:c.value},[e.createVNode(si)],10,Hi)):e.createCommentVNode("",!0),y.value>0?(e.openBlock(),e.createElementBlock("button",{key:4,class:e.normalizeClass(["vs-btn",{"vs-active":Ce.value==="edit"}]),title:"Edit geometry",onClick:f[4]||(f[4]=N=>Ft()),disabled:c.value||y.value===0},[e.createVNode(Bn)],10,qi)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:f[5]||(f[5]=N=>d.value=!d.value),title:"Full Screen"},[e.createVNode(ui,{style:{width:"12px",height:"12px"}})])])]),e.createElementVNode("div",{class:e.normalizeClass(["absolute left-4 z-[1000]",E.value?"bottom-8":"bottom-4"])},[e.createElementVNode("div",Gi,[e.createVNode(Ei,{basemaps:e.unref(Y),onOnLayerChange:Ot},null,8,["basemaps"]),z.value.length?(e.openBlock(),e.createElementBlock("div",Ki,[f[10]||(f[10]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),e.createElementVNode("div",Yi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(z.value,N=>(e.openBlock(),e.createElementBlock("label",{key:N.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:N.visible,disabled:c.value,onChange:p=>Pe(N.id)},null,40,Wi),e.createElementVNode("span",Zi,e.toDisplayString(N.config.title||N.config.name||N.id),1)]))),128))])])):e.createCommentVNode("",!0)])],2),e.createElementVNode("div",Ji,[E.value?(e.openBlock(),e.createElementBlock("div",Xi,[e.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:f[6]||(f[6]=N=>h.value=!0),onMouseleave:f[7]||(f[7]=N=>h.value=!1)},[e.createElementVNode("div",Qi,[f[11]||(f[11]=e.createTextVNode(" Type: ",-1)),e.createElementVNode("span",ec,e.toDisplayString(E.value.type),1)]),b.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"addressEl",ref:V,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"},[h.value&&b.value&&g.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:g.value.top+"px",left:g.value.left+"px"})},e.toDisplayString(b.value),5)):e.createCommentVNode("",!0)]))],32),e.createElementVNode("div",tc,[e.createElementVNode("div",nc,[f[12]||(f[12]=e.createTextVNode(" Center: ",-1)),e.createElementVNode("b",null,e.toDisplayString(E.value.center.lat.toFixed(5))+", "+e.toDisplayString(E.value.center.lng.toFixed(5)),1)]),E.value.areaKm2!==null?(e.openBlock(),e.createElementBlock("div",lc,[f[13]||(f[13]=e.createTextVNode(" Area: ",-1)),e.createElementVNode("b",null,e.toDisplayString(E.value.areaKm2.toFixed(1))+" km²",1)])):(e.openBlock(),e.createElementBlock("div",ac,[...f[14]||(f[14]=[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:f[8]||(f[8]=N=>Lt()),disabled:c.value},[...f[15]||(f[15]=[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,oc),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:f[9]||(f[9]=N=>Tt()),disabled:c.value},[e.createVNode(Qe,{class:"w-3 h-3"})],8,rc)])])):e.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-5928a49c"]]),sc=["data-focus"],ic={class:"flex items-center"},cc={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},dc=["onClick","aria-label"],uc={key:0,class:"absolute text-gray-500 truncate pl-2"},pc={class:"flex-1 min-w-[2px]"},mc=["placeholder"],fc={class:"flex items-center shrink-0"},hc=["disabled"],Nn=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;Ee(n.style);const o=e.ref(null),r=e.ref(null),s=e.ref(null),i=e.ref(!1),c=e.ref(""),d=e.useModel(l,"modelValue"),u=e.computed(()=>n.placeholder||"Add tag…"),k=e.computed(()=>d.value?.length===0&&c.value===""),C=e.computed(()=>!n.disabled&&d.value?.length>0),b=e.computed(()=>n.disabled),E=async()=>{b.value||await e.nextTick(()=>s.value?.focus())},h=F=>{const B=F.trim();B!==""&&(!d.value||!Array.isArray(d.value)?d.value=[B]:n.unique?d.value.includes(B)||(d.value=[...d.value,B]):d.value=[...d.value,B],c.value="")},g=()=>{const F=c.value;F.trim()!==""&&h(F),c.value=""},V=F=>{const B=d.value.slice();B.splice(F,1),a("update:modelValue",B)},y=()=>{a("update:modelValue",[])},w=()=>{b.value||(i.value=!0)},x=()=>{i.value=!1,!b.value&&g()},S=F=>{const{key:B}=F;B==="Enter"?(F.preventDefault(),g()):B==="Backspace"&&c.value===""&&d.value.length>0&&V(d.value.length-1)};return(F,B)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:B[1]||(B[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:E},[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(d.value,($,H)=>(e.openBlock(),e.createElementBlock("div",{key:H,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",ic,[e.createElementVNode("div",cc,e.toDisplayString($),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=>V(H),["stop"]),"aria-label":`Remove ${$}`},[...B[2]||(B[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,dc)]))),128)),k.value?(e.openBlock(),e.createElementBlock("div",uc,e.toDisplayString(u.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",pc,[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":B[0]||(B[0]=$=>c.value=$),onFocus:w,onBlur:x,onKeydown:S,placeholder:d.value&&d.value.length?"":void 0},null,40,mc)),[[e.vModelText,c.value]])])],512),e.createElementVNode("div",fc,[C.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(y,["stop"])},[...B[3]||(B[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,hc)):e.createCommentVNode("",!0)])],10,sc)],2)],512))}}),gc={class:"relative flex gap-1 bg-white w-full"},yc=["disabled","placeholder"],Mn=ne(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(c=>i[c]||c).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",gc,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:l.disabled,placeholder:l.placeholder,"onUpdate:modelValue":i[0]||(i[0]=c=>a.value=c),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,yc),[[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-cb7b2b74"]]),kc={class:"relative flex gap-1 bg-white w-full"},bc=["disabled","placeholder"],xc=["disabled"],wc={key:0},_c={key:1},$n=ne(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 d=encodeURIComponent(String(t.table)),u=encodeURIComponent(String(t.code));return`/api/code-gen/${d}/${u}`},i=async()=>{if(!r.value||a.value)return;const d=s();if(d){a.value=!0;try{const k=await(await fetch(d)).text();n.value=k}finally{a.value=!1}}},c=()=>{o.value&&(n.value||i())};return e.onMounted(()=>{c()}),e.watch(()=>[t.table,t.code,t.init],()=>{c()}),(d,u)=>(e.openBlock(),e.createElementBlock("div",kc,[e.withDirectives(e.createElementVNode("input",{disabled:l.disabled,placeholder:l.placeholder,"onUpdate:modelValue":u[0]||(u[0]=k=>n.value=k),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,bc),[[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||l.disabled||!r.value,onClick:i},[a.value?(e.openBlock(),e.createElementBlock("span",_c,"...")):(e.openBlock(),e.createElementBlock("span",wc,"Gen"))],8,xc)]))}}),[["__scopeId","data-v-8f88fb66"]]),vc={class:"w-full"},Ec={ref:"sortableContainer",class:"flex flex-col gap-1"},Vc=["onDragstart","onDrop"],Bc={class:"w-1/3"},Cc={class:"w-2/3"},Sc=["onClick"],Nc={key:0,class:"text-[14px] text-gray-700"},Mc={class:"mt-2 w-full flex items-center"},$c=["disabled"],Dn=ne(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=g=>`${g}-${Math.random().toString(36).substring(2,15)}`,a=e.inject("values"),o=l,r=t,s=o.addButtonText??"Додати",i=o.ignore??[],c=e.ref([]),d=e.ref(null);(()=>{const g=o.parent&&a?.value?.[o.parent]||o.modelValue||{};c.value=Object.entries(g).filter(([V])=>!i.includes(V)).map(([V,y])=>({id:n("key-value-"),key:V,value:y}))})();function k(g){d.value=g}function C(g){if(d.value===null||d.value===g)return;const V=c.value.splice(d.value,1)[0];c.value.splice(g,0,V),d.value=null}const b=e.computed(()=>c.value.some(g=>g.key&&!g.value||!g.key&&g.value)),E=()=>{c.value.push({id:n("key-value-"),key:"",value:""})},h=g=>{c.value=c.value.filter(V=>V.id!==g)};return e.watch(c,g=>{const V={};g.forEach(w=>{w.key&&w.value!==void 0&&(V[w.key]=w.value)});const y={};i.length&&i.forEach(w=>{y[w]=o.parent?a?.value?.[o.parent]?.[w]:void 0}),a?.value&&o.parent&&(a.value[o.parent]={...y,...V}),r("update:modelValue",V)},{deep:!0}),(g,V)=>(e.openBlock(),e.createElementBlock("div",vc,[e.createElementVNode("div",Ec,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(y,w)=>(e.openBlock(),e.createElementBlock("div",{key:y.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===w}]),draggable:"true",onDragstart:x=>k(w),onDragover:V[0]||(V[0]=e.withModifiers(()=>{},["prevent"])),onDrop:x=>C(w)},[V[1]||(V[1]=e.createStaticVNode('<button class="cursor-move" data-v-2ae5f16f><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-2ae5f16f><circle cx="15" cy="12" r="1.5" data-v-2ae5f16f></circle><circle cx="15" cy="24" r="1.5" data-v-2ae5f16f></circle><circle cx="21" cy="12" r="1.5" data-v-2ae5f16f></circle><circle cx="21" cy="24" r="1.5" data-v-2ae5f16f></circle><circle cx="21" cy="18" r="1.5" data-v-2ae5f16f></circle><circle cx="15" cy="18" r="1.5" data-v-2ae5f16f></circle></svg></button>',1)),e.createElementVNode("div",Bc,[e.createVNode(Xe,{modelValue:y.key,"onUpdate:modelValue":x=>y.key=x,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Cc,[e.createVNode(Xe,{modelValue:y.value,"onUpdate:modelValue":x=>y.value=x,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:x=>h(y.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(pt),{height:"16",width:"16"})],8,Sc)],42,Vc))),128))],512),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Nc," Дані для відображення відсутні ")),e.createElementVNode("div",Mc,[e.createElementVNode("button",{type:"button",onClick:E,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(Ae,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(s)),1)],8,$c)])]))}}),[["__scopeId","data-v-2ae5f16f"]]),Dc={class:"w-full"},Ac={ref:"sortableContainer",class:"flex flex-col gap-1"},Fc=["onDragstart","onDrop"],Lc=["disabled"],Tc={class:"flex-1"},Ic=["onClick","disabled"],Oc={key:0,class:"text-[14px] text-gray-700"},zc={class:"mt-2 w-full flex items-center"},Rc=["disabled"],An=ne(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 c=!1;const d=g=>`${g}-${Math.random().toString(36).substring(2,15)}`,u=g=>{const V=g??n.value??[];a.value=V.map((y,w)=>({id:a.value[w]?.id??d("text-array"),value:y??""}))};u(),e.watch(()=>n.value,g=>{if(c){c=!1;return}u(g||[])},{deep:!0}),e.watch(a,g=>{c=!0,n.value=g.map(V=>V.value).filter(V=>V!=null&&V!=="")},{deep:!0});const k=e.computed(()=>r.value||a.value.some(g=>!g.value));function C(){k.value||(a.value=[...a.value,{id:d("text-array"),value:""}])}function b(g){r.value||(a.value=a.value.filter(V=>V.id!==g))}function E(g){r.value||(o.value=g)}function h(g){if(r.value||o.value===null||o.value===g)return;const V=[...a.value],[y]=V.splice(o.value,1);V.splice(g,0,y),a.value=V,o.value=null}return(g,V)=>(e.openBlock(),e.createElementBlock("div",Dc,[e.createElementVNode("div",Ac,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(y,w)=>(e.openBlock(),e.createElementBlock("div",{key:y.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":o.value===w}]),draggable:"true",onDragstart:x=>E(w),onDragover:V[0]||(V[0]=e.withModifiers(()=>{},["prevent"])),onDrop:x=>h(w)},[e.createElementVNode("button",{class:"cursor-move",type:"button",disabled:r.value},[...V[1]||(V[1]=[e.createStaticVNode('<svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-77ce3498><circle cx="15" cy="12" r="1.5" data-v-77ce3498></circle><circle cx="15" cy="24" r="1.5" data-v-77ce3498></circle><circle cx="21" cy="12" r="1.5" data-v-77ce3498></circle><circle cx="21" cy="24" r="1.5" data-v-77ce3498></circle><circle cx="21" cy="18" r="1.5" data-v-77ce3498></circle><circle cx="15" cy="18" r="1.5" data-v-77ce3498></circle></svg>',1)])],8,Lc),e.createElementVNode("div",Tc,[l.inputType==="text"?(e.openBlock(),e.createBlock(Xe,{key:0,modelValue:y.value,"onUpdate:modelValue":x=>y.value=x,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),l.inputType==="tel"?(e.openBlock(),e.createBlock(Gt,{key:1,modelValue:y.value,"onUpdate:modelValue":x=>y.value=x,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),l.inputType==="email"?(e.openBlock(),e.createBlock(qt,{key:2,modelValue:y.value,"onUpdate:modelValue":x=>y.value=x,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),l.inputType==="mask"?(e.openBlock(),e.createBlock(Ht,{key:3,modelValue:y.value,"onUpdate:modelValue":x=>y.value=x,mask:l.mask,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","mask","disabled","placeholder"])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:x=>b(y.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(pt),{height:"16",width:"16"})],8,Ic)],42,Fc))),128))],512),a.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Oc," Дані для відображення відсутні ")),e.createElementVNode("div",zc,[e.createElementVNode("button",{type:"button",onClick:C,disabled:k.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(Ae,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(i.value),1)],8,Rc)])]))}}),[["__scopeId","data-v-77ce3498"]]),jc={class:"flex items-center gap-2 w-full"},Pc=["disabled"],Uc=["disabled"],Fn=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}=Ee(n.style),o=t,r=e.computed({get:()=>n.modelValue||"#000000",set:i=>o("update:modelValue",i)}),s=e.computed(()=>!!n.disabled);return(i,c)=>(e.openBlock(),e.createElementBlock("div",jc,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),disabled:s.value,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[l.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Pc),[[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":c[1]||(c[1]=d=>r.value=d),disabled:s.value},null,8,Uc),[[e.vModelText,r.value]])]))}}),Hc={class:"flex items-center gap-2 w-full"},qc=["min","max","step","disabled"],Gc=["disabled"],Ln=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}=Ee(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,c)=>(e.openBlock(),e.createElementBlock("div",Hc,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),min:l.min,max:l.max,step:l.step,disabled:s.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[l.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")])},null,10,qc),[[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":c[1]||(c[1]=d=>r.value=d),disabled:s.value},null,8,Gc),[[e.vModelText,r.value]])]))}}),Kc=["placeholder","disabled","name"],Yc=["type","value","onInput","placeholder","disabled"],Wc=["onClick"],Tn=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}=Ee(t.style),r=e.useModel(l,"modelValue"),s=e.computed(()=>!!t.disabled),i=e.computed(()=>t.placeholder??"");e.watchEffect(()=>{const h=r.value?.length??0;h<n.value&&(r.value=[...r.value??[],...Array(n.value-h)])});const c=e.ref({}),d=e.ref({});function u(h,g){h&&(c.value[g]=h)}async function k(h,g){if(!h||t.inputType!=="mask")return;const{default:V}=await Promise.resolve().then(()=>dn);d.value[g]&&d.value[g].destroy(),d.value[g]=V(h,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),d.value[g].on("accept",()=>{const y=[...r.value||[]];y[g]=t.unmask?d.value[g].unmaskedValue:d.value[g].value,r.value=y}),d.value[g].on("complete",()=>{const y=[...r.value||[]];y[g]=t.unmask?d.value[g].unmaskedValue:d.value[g].value,r.value=y}),r.value?.[g]&&(d.value[g].value=r.value[g])}function C(h,g){if(s.value)return;const V=h.target.value??null,y=[...r.value];y[g]=t.inputType==="text"?V:Number(V),r.value=y}function b(){n.value+=1;const h=t.inputType==="text"||t.inputType==="mask"?null:0;r.value=[...r.value,h],t.inputType==="mask"&&setTimeout(()=>{const g=n.value-1;c.value[g]&&k(c.value[g],g)},0)}function E(h){if(n.value>1){d.value[h]&&(d.value[h].destroy(),delete d.value[h]),n.value-=1,r.value=r.value.filter((V,y)=>y!==h);const g={};Object.keys(d.value).forEach(V=>{const y=parseInt(V,10);y>h?g[y-1]=d.value[y]:y<h&&(g[y]=d.value[y])}),d.value=g}}return e.onMounted(()=>{if(t.inputType==="mask")for(let h=0;h<n.value;h+=1)c.value[h]&&k(c.value[h],h)}),e.onBeforeUnmount(()=>{Object.values(d.value).forEach(h=>{h&&h.destroy()})}),e.watch(()=>t.mask,h=>{t.inputType==="mask"&&Object.values(d.value).forEach(g=>{g&&g.updateOptions({mask:h,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})})}),e.watch(r,h=>{t.inputType==="mask"&&h&&h.forEach((g,V)=>{d.value[V]&&d.value[V].value!==g&&(d.value[V].value=g||"")})},{deep:!0}),(h,g)=>(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,V=>(e.openBlock(),e.createElementBlock("div",{key:V,class:"flex items-center gap-2 w-full"},[l.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:y=>u(y,V-1),placeholder:l.placeholder,disabled:l.disabled,name:`${l.name}[${V-1}]`,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Kc)):(e.openBlock(),e.createElementBlock("input",{key:1,type:l.inputType,value:r.value?.[V-1],onInput:y=>C(y,V-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":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Yc)),!l.disabled&&V===n.value&&l.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(Ae,{height:"18",width:"18"})])):e.createCommentVNode("",!0),!l.disabled&&n.value>1&&l.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(y=>E(V-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(pt,{height:"18",width:"18"})],8,Wc)):e.createCommentVNode("",!0)]))),128))],2))}}),Zc=["aria-expanded","data-focus"],Jc=["placeholder","disabled","readonly"],Xc={class:"max-h-full"},Qc=["onClick","disabled"],ed={key:0,class:"px-3 py-2 text-sm text-stone-500"},td={class:"flex flex-col gap-1"},nd=["onDragstart","onDrop"],ld=["disabled"],ad=["title"],od=["disabled","onClick","aria-label"],rd={key:0,class:"text-xs text-stone-500"},kt=ne(e.defineComponent({__name:"vs-input-array-select",props:e.mergeModels({options:{default:()=>[]},data:{default:""},api:{default:""},prefix:{default:"api"},host:{default:""},parent:{},search:{type:Boolean,default:!0},maxHeight:{default:280},start:{default:0},slot:{},disabled:{type:Boolean,default:!1},style:{},customClass:{},modelValue:{},error:{},name:{},placeholder:{default:"Оберіть значення"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["change","update:modelValue","value-selected"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=t,o=e.useModel(l,"modelValue"),r=e.ref([]),s=e.ref(n.options??[]),i=e.ref({}),c=e.ref({}),d=e.ref({keyword:"",parent:null}),u=e.ref(""),k=e.ref(!1),C=e.ref(null),b=e.ref(null),E=e.ref(null);let h=!1,g=!1;const V=e.inject("values"),y=e.computed(()=>!!n.disabled),w=e.computed(()=>n.placeholder??"Оберіть значення"),x=e.computed(()=>n.search!==!1),S=e.computed(()=>`${n.maxHeight??280}px`),F=e.computed(()=>{const M=n.parent??n.parentValue;return M?String(M):""}),B=e.computed(()=>F.value?V?.value?.[F.value]??null:null),$=M=>M==null?"__null__":String(M),H=M=>{if(!M)return"";const W=M.label??M.text??M.name??M.ua??M.en;return W?String(W):M.id!==void 0&&M.id!==null?String(M.id):""},G=M=>{const W=$(M);return c.value[W]||(c.value[W]=`array-select-${W}-${Math.random().toString(36).slice(2,8)}`),c.value[W]},j=e.computed(()=>new Set(r.value.map(M=>$(M.id)))),z=e.computed(()=>{const M=j.value;let W=[...s.value];if(!n.data&&u.value.trim()){const Q=u.value.toLowerCase();W=W.filter(pe=>H(pe).toLowerCase().includes(Q))}return W.filter(Q=>!M.has($(Q.id)))}),R=()=>{if(!n.data)return"";const M=n.prefix??"api",W=n.api??`/${M}/suggest/${n.data}`;return`${n.host??""}${W}`},q=()=>{r.value.length&&(h=!0,r.value=r.value.map(M=>({...M,text:i.value[$(M.id)]??M.text})))},O=M=>{const W=$(M.id),Q=H(M);Q&&(i.value[W]=Q)},A=M=>{s.value=M?[...M]:[],M?.forEach(O),q()},Z=M=>{if(!M.length)return;const W=new Map(s.value.map(Q=>[$(Q.id),Q]));M.forEach(Q=>{const pe=$(Q.id);W.set(pe,Q),O(Q)}),s.value=Array.from(W.values()),q()},Y=async(M="")=>{if(!n.data)return[];const W=R();if(!W)return[];const Q=new URLSearchParams;Q.set("json","1"),M&&Q.set("key",M),n.start===1&&Q.set("start","1"),B.value!==null&&B.value!==void 0&&B.value!==""&&Q.set("parent",String(B.value));try{return(await(await fetch(`${W}?${Q.toString()}`)).json())?.data??[]}catch{return[]}},ue=async M=>{if(!n.data||!M.length)return[];const W=R();if(!W)return[];const Q=Array.from(new Set(M.map(be=>$(be)))),pe=new URLSearchParams;pe.set("json","1"),pe.set("val",Q.join(",")),n.start===1&&pe.set("start","1"),B.value!==null&&B.value!==void 0&&B.value!==""&&pe.set("parent",String(B.value));try{const Ue=(await(await fetch(`${W}?${pe.toString()}`)).json())?.data??[];return Z(Ue),Ue}catch{return[]}},de=async(M="",{force:W=!1}={})=>{if(!n.data)return;const Q=B.value??null;if(!W&&d.value.keyword===M&&d.value.parent===Q&&s.value.length>0)return;d.value={keyword:M,parent:Q};const be=await Y(M);A(be)},I=((M,W=200)=>{let Q;return(...pe)=>{Q&&clearTimeout(Q),Q=setTimeout(()=>M(...pe),W)}})(async M=>{n.data&&await de(M,{force:!0})},250),T=e.ref(null),X=async(M="click")=>{y.value||k.value||(T.value=M,await de(u.value.trim()),k.value=!0,await e.nextTick(),E.value?.focus())},re=()=>{k.value=!1,T.value=null,e.nextTick(()=>{E.value?.blur()})},se=async M=>{if(M.stopPropagation(),!y.value){if(k.value){if(T.value==="focus"){T.value=null;return}re();return}await X("click")}},ge=M=>{M.key==="Escape"&&re()},De=M=>{const W=M.target;b.value?.contains(W)||re()},Be=M=>{if(M.key==="Escape"){M.preventDefault(),re();return}if(M.key==="Enter"){M.preventDefault();const W=z.value[0];W&&D(W)}},D=M=>{if(!M)return;const W=$(M.id);if(j.value.has(W))return;O(M);const Q={id:M.id,text:H(M)||String(M.id??""),key:G(M.id)};r.value=[...r.value,Q],P(M),u.value="",e.nextTick(()=>{E.value?.focus()})},P=M=>{const W=r.value.map(Q=>Q.id);a("value-selected",{name:n.name,value:W,option:M})},U=M=>{if(y.value)return;const W=r.value.filter(Q=>$(Q.id)!==$(M));r.value=W},ee=M=>{y.value||(C.value=M)},ae=M=>{if(y.value||C.value===null||C.value===M)return;const W=[...r.value],[Q]=W.splice(C.value,1);W.splice(M,0,Q),C.value=null,r.value=W},ye=async()=>{const W=(Array.isArray(o.value)?[...o.value]:[]).filter(pe=>pe!=null);if(n.data&&W.length){const pe=W.filter(be=>!i.value[$(be)]);pe.length&&await ue(pe)}const Q=W.map(pe=>({id:pe,text:i.value[$(pe)]??String(pe),key:G(pe)}));h=!0,r.value=Q};e.watch(r,M=>{if(h){h=!1;return}const W=M.map(Q=>Q.id);g=!0,o.value=W,a("change",W)},{deep:!0}),e.watch(o,()=>{if(g){g=!1;return}ye()},{deep:!0}),e.watch(u,M=>{!n.data||!k.value||I(M.trim())}),e.watch(y,M=>{M&&re()}),e.watch(()=>n.options,async M=>{n.data||(A(M??[]),await ye())},{immediate:!0,deep:!0}),e.watch(()=>n.data,async M=>{M&&(await de(u.value.trim()),await ye())},{immediate:!0});const fe=e.ref(!1);return e.watch(B,async()=>{if(n.data){if(!fe.value){fe.value=!0;return}r.value=[],await de(u.value.trim()),await ye()}}),e.onMounted(async()=>{document.addEventListener("click",De,!0),window.addEventListener("keydown",ge),await ye()}),e.onUnmounted(()=>{document.removeEventListener("click",De,!0),window.removeEventListener("keydown",ge)}),(M,W)=>(e.openBlock(),e.createElementBlock("div",{class:"flex flex-col gap-2 w-full",ref_key:"rootRef",ref:b},[e.createElementVNode("div",{class:"relative",onClick:W[2]||(W[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white px-3","border-gray-300 hover:border-[#b3d4ff]",k.value?"border-[#2684ff] ring-1 ring-[#2684ff] shadow-[0_0_0_1px_rgba(38,132,255,0.5)]":"",y.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":k.value,"aria-haspopup":"listbox","data-focus":k.value?"true":"false",onClick:se},[e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:E,"onUpdate:modelValue":W[0]||(W[0]=Q=>u.value=Q),placeholder:w.value,disabled:y.value,readonly:!x.value,onFocus:W[1]||(W[1]=()=>X("focus")),onKeydown:Be,class:"flex-1 bg-transparent border-0 outline-none px-0 py-1 text-sm text-stone-900 placeholder:text-stone-400"},null,40,Jc),[[e.vModelText,u.value]]),e.createElementVNode("span",{class:e.normalizeClass(["text-stone-400 transition-transform duration-150",k.value?"rotate-180":""]),"aria-hidden":"true"},[e.createVNode(jt,{width:"16",height:"16"})],2)],10,Zc),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[k.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"absolute left-0 right-0 z-10 mt-1 rounded-md border border-stone-200 bg-white shadow-lg overflow-auto",style:e.normalizeStyle({maxHeight:S.value})},[e.createElementVNode("div",Xc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(z.value,Q=>(e.openBlock(),e.createElementBlock("button",{key:$(Q.id),type:"button",class:"w-full px-3 py-2 text-left text-sm text-stone-900 hover:bg-stone-100 disabled:opacity-50",onClick:e.withModifiers(pe=>D(Q),["stop"]),disabled:y.value},e.toDisplayString(H(Q)),9,Qc))),128)),z.value.length===0?(e.openBlock(),e.createElementBlock("p",ed," Немає варіантів ")):e.createCommentVNode("",!0)])],4)):e.createCommentVNode("",!0)]),_:1})]),e.createElementVNode("div",td,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(Q,pe)=>(e.openBlock(),e.createElementBlock("div",{key:Q.key,class:e.normalizeClass(["flex items-center gap-2 rounded-md border border-stone-200 bg-white px-2 py-2",{"opacity-60":C.value===pe}]),draggable:"true",onDragstart:be=>ee(pe),onDragover:W[3]||(W[3]=e.withModifiers(()=>{},["prevent"])),onDrop:be=>ae(pe),onDragend:W[4]||(W[4]=be=>C.value=null)},[e.createElementVNode("button",{type:"button",class:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-stone-500 hover:text-stone-900",disabled:y.value,"aria-label":"Перетягнути"},[e.createVNode(ft,{width:"14",height:"14"})],8,ld),e.createElementVNode("div",{class:"flex-1 text-sm text-stone-900",title:Q.text},e.toDisplayString(Q.text),9,ad),e.createElementVNode("button",{type:"button",class:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-stone-400 hover:text-stone-900",disabled:y.value,onClick:e.withModifiers(be=>U(Q.id),["stop"]),"aria-label":`Видалити ${Q.text}`},[e.createVNode(pt,{width:"14",height:"14"})],8,od)],42,nd))),128)),r.value.length===0?(e.openBlock(),e.createElementBlock("p",rd,"Немає вибраних значень")):e.createCommentVNode("",!0)])],512))}}),[["__scopeId","data-v-cffead85"]]),sd={class:"flex items-center gap-2 w-full"},id={class:"relative flex-1"},cd=["placeholder","disabled","onKeydown"],dd=["disabled"],ud={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"},pd={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"},md={key:0,class:"fixed inset-0 z-[1000] flex items-center justify-center bg-black/50"},fd={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},hd={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},gd=["onClick"],yd={key:0,class:"p-4 text-sm text-gray-500"},In=e.defineComponent({__name:"vs-input-address",props:e.mergeModels({api:{default:""},geom:{default:""},includes:{default:()=>[]},bbox:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(l,{emit:t}){const n=/{{\s*([^}]+?)\s*}}/g,a=l,o=t,{inputClass:r}=Ee(a.style),s=e.useModel(l,"modelValue"),i=e.computed({get:()=>s.value,set:B=>{s.value=B}}),c=e.ref(!1),d=e.ref([]),u=e.ref(!1),k=e.ref(null);e.watch(u,B=>{typeof document>"u"||(B?(k.value=document.body.style.overflow,document.body.style.overflow="hidden"):k.value!=null?(document.body.style.overflow=k.value,k.value=null):document.body.style.removeProperty("overflow"))}),e.onBeforeUnmount(()=>{typeof document>"u"||(k.value!=null?document.body.style.overflow=k.value:document.body.style.removeProperty("overflow"))});const C=e.computed(()=>a.placeholder??""),b=e.computed(()=>!!a.disabled),E=B=>{if(!B)return null;if(Array.isArray(B))return B;if(typeof B=="string"){const $=B.split(",").map(H=>H.trim()).filter(Boolean);return $.length!==4?null:$.map(Number)}return null},h=e.computed(()=>{const B=E(a.bbox);if(!B||B.length!==4)return null;const $=B.map(Number);return $.some(H=>Number.isNaN(H))?null:$}),g=e.computed(()=>{const B=h.value;if(!B)return"";const[$,H,G,j]=B;return`${$},${Math.max(H,j)},${G},${Math.min(H,j)}`});e.computed(()=>g.value?"1":"0");const V=e.inject("values");function y(){!b.value&&i.value.trim()&&w()}async function w(){const B=(i.value||"").trim();if(!B)return;let $=B;if(a.includes?.length&&V?.value){const G=a.includes.map(j=>V.value?.[j]).filter(Boolean);G.length&&($=`${G.join(", ")}, ${B}`)}const H=F($);if(H){c.value=!0;try{const j=await(await fetch(H)).json();d.value=Array.isArray(j)?j:[],u.value=!0}catch(G){console.error("Address search error:",G)}finally{c.value=!1}}}function x(){u.value=!u.value}function S(B){if(!B)return;u.value=!1;const $=parseFloat(B.lat),G={type:"Point",coordinates:[parseFloat(B.lon),$]};a.geom&&V?.value&&(V.value[a.geom]=G),o("update:geom",G)}function F(B){if(!a.api)return"";const $={value:encodeURIComponent(B),bbox:h.value?h.value.join(","):""};return a.api.replace(n,(H,G)=>$[G.trim()]??"")}return(B,$)=>(e.openBlock(),e.createElementBlock("div",sd,[e.createElementVNode("div",id,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":$[0]||($[0]=H=>i.value=H),placeholder:C.value,disabled:b.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(r),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:e.withKeys(e.withModifiers(y,["prevent"]),["enter"])},null,42,cd),[[e.vModelText,i.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:x,title:"Show search results"},[...$[2]||($[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:w,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:c.value||!i.value?.trim()},[c.value?(e.openBlock(),e.createElementBlock("svg",pd,[...$[4]||($[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",ud,[...$[3]||($[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,dd),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[u.value?(e.openBlock(),e.createElementBlock("div",md,[e.createElementVNode("div",fd,[e.createElementVNode("div",hd,[$[6]||($[6]=e.createElementVNode("span",null,"Search results",-1)),e.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:$[1]||($[1]=H=>u.value=!1),title:"Close"},[...$[5]||($[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,(H,G)=>(e.openBlock(),e.createElementBlock("li",{key:G,onClick:j=>S(H),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString(H.display_name),9,gd))),128))]),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",yd," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),On=(l="")=>`${l}${Math.floor(Math.random()*1e4)}`,kd={class:"vs-datalist space-y-3"},bd={class:"space-y-3"},xd=["onClick","disabled"],wd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},_d=["disabled"],vd=ne(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(h=>({...h,disabled:t.disabled||h.disabled}))??[]),s=e.computed(()=>r.value.map(h=>E(h))),i=e.computed(()=>t.disabled?!1:t.maxItems?a.value.length<t.maxItems:!0),c=e.computed(()=>t.disabled||a.value.length<=(t.minItems||0));e.watch(()=>a.value.length,()=>{d(),u()},{immediate:!0}),e.watch(()=>t.schema,u,{immediate:!0,deep:!0});function d(){const h=a.value.length;o.value.length<h?o.value=[...o.value,...Array.from({length:h-o.value.length},()=>On())]:o.value.length>h&&o.value.splice(h)}function u(){if(!t.minItems||a.value.length>=t.minItems)return;const h=t.minItems-a.value.length,g=Array.from({length:h},k);n.value=[...a.value,...g]}function k(){const h={};return r.value.forEach(g=>{h[g.name]=g?.default??null}),h}function C(){i.value&&(n.value=[...a.value,k()],d())}function b(h){c.value||(n.value=a.value.filter((g,V)=>V!==h),d(),u())}function E(h){return{...h}}return(h,g)=>(e.openBlock(),e.createElementBlock("div",kd,[e.createElementVNode("div",bd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(V,y)=>(e.openBlock(),e.createElementBlock("div",{key:o.value[y],class:"flex items-center gap-3"},[e.createVNode(Oe,{schema:s.value,layout:"inline",navigation:!1,values:a.value[y],"onUpdate:values":w=>a.value[y]=w,"form-id":o.value[y]},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:w=>b(y),disabled:c.value},[e.createVNode(Qe,{class:"w-5 h-5"})],8,xd)]))),128)),a.value.length===0?(e.openBlock(),e.createElementBlock("div",wd,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:C,disabled:!i.value},[e.createVNode(Ae,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,_d)]))}}),[["__scopeId","data-v-c4c0acde"]]),Ed={};function Vd(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 Bd=ne(Ed,[["render",Vd]]),Cd={class:"vs-dataform space-y-4"},Sd=["draggable","onDragstart","onDragover","onDragenter","onDrop"],Nd={class:"flex items-center gap-2"},Md=["onClick"],$d={class:"text-sm font-medium text-gray-700"},Dd={class:"flex items-center gap-2"},Ad=["title","onClick","disabled"],Fd=["title","onClick","disabled"],Ld={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Td=["disabled"],Id=ne(e.defineComponent({__name:"vs-input-dataform",props:e.mergeModels({schema:{default:()=>[]},minGroups:{default:0},maxGroups:{default:void 0},addButtonText:{default:"Додати групу фільтрів"},groupLabel:{default:void 0},duplicateTitle:{default:"Дублювати групу"},removeTitle:{default:"Видалити групу"},emptyLabel:{},view:{default:"default"},collapsible:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},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.ref(0),s=e.ref(null),i=e.ref(null),c=e.ref(null),d=e.computed(()=>t.groupLabel??"Group"),u=e.computed(()=>t.emptyLabel??"Ще немає груп"),k=e.computed(()=>t.schema?.map(T=>({...T,disabled:t.disabled||T.disabled}))??[]),C=e.computed(()=>k.value.map(T=>H(T))),b=e.computed(()=>t.view==="accordion"),E=e.computed(()=>!!(t.collapsible||b.value)),h=e.computed(()=>t.draggable!==!1),g=e.computed(()=>t.disabled?!1:t.maxGroups?n.value.length<t.maxGroups:!0),V=e.computed(()=>t.disabled||n.value.length<=(t.minGroups||0));e.watch(()=>n.value.length,()=>{y(),w(),x()},{immediate:!0}),e.watch(()=>t.schema,x,{immediate:!0,deep:!0}),e.watch(()=>t.view,()=>{w()},{immediate:!0});function y(){const T=n.value.length;a.value.length<T?a.value=[...a.value,...Array.from({length:T-a.value.length},()=>On())]:a.value.length>T&&a.value.splice(T)}function w(){const T=n.value.length;b.value?T===0?r.value=-1:r.value>=T?r.value=T-1:r.value<0&&(r.value=0):o.value.length<T?o.value=[...o.value,...Array.from({length:T-o.value.length},()=>!1)]:o.value.length>T&&o.value.splice(T)}function x(){if(!t.minGroups||n.value.length>=t.minGroups)return;const T=t.minGroups-n.value.length,X=Array.from({length:T},S);n.value=[...n.value,...X],w()}function S(){const T={};return k.value.forEach(X=>{T[X.name]=X?.default??null}),T}function F(){g.value&&(n.value=[...n.value,S()],y(),w())}function B(T){V.value||(n.value=n.value.filter((X,re)=>re!==T),y(),b.value?r.value>=n.value.length&&(r.value=n.value.length-1):o.value.splice(T,1),x())}function $(T){if(t.disabled)return;const X=JSON.parse(JSON.stringify(n.value[T]??{}));n.value=[...n.value.slice(0,T+1),X,...n.value.slice(T+1)],y(),b.value?r.value>T&&(r.value+=1):o.value.splice(T+1,0,o.value[T]??!1)}function H(T){return{...T}}function G(T){return b.value?r.value===-1&&T===0?!1:r.value!==T:!!o.value[T]}function j(T){if(E.value){if(b.value){r.value=T;return}o.value[T]=!o.value[T]}}function z(T,X){if(!h.value||t.disabled){X.preventDefault();return}s.value=T,i.value=T,c.value={groups:JSON.parse(JSON.stringify(n.value)),keys:[...a.value],states:[...o.value]},X.dataTransfer?.setData("text/plain",String(T)),X.dataTransfer?.setDragImage?.(X.currentTarget,0,0)}function R(T,X){!h.value||t.disabled||s.value!==null&&ue(T,X)}function q(T,X){ue(T,X)}function O(T){!h.value||t.disabled||I()}function A(){c.value&&Y(),s.value=null,i.value=null,c.value=null}function Z(T,X){const re=[...n.value],[se]=re.splice(T,1);re.splice(X,0,se),n.value=re;const ge=[...a.value],[De]=ge.splice(T,1);if(ge.splice(X,0,De),a.value=ge,b.value)r.value===T&&(r.value=X);else{const Be=[...o.value],[D]=Be.splice(T,1);Be.splice(X,0,D),o.value=Be}}function Y(){c.value&&(n.value=c.value.groups,a.value=c.value.keys,o.value=c.value.states,c.value=null,i.value=null)}function ue(T,X){if(s.value===null)return;const re=de(T,X);i.value=re,Ne(re)}function de(T,X){if(!X?.currentTarget)return T;const re=X.currentTarget.getBoundingClientRect(),ge=X.clientY-re.top>re.height/2?T+1:T;return Math.max(0,Math.min(ge,n.value.length))}function Ne(T){const X=s.value;if(X===null)return;let re=T;if(re>n.value.length&&(re=n.value.length),re===X||re===X+1)return;const se=re>X?re-1:re;Z(X,se),s.value=se,i.value=re>X?se+1:se}function I(){c.value=null,s.value=null,i.value=null}return(T,X)=>(e.openBlock(),e.createElementBlock("div",Cd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(re,se)=>(e.openBlock(),e.createElementBlock("div",{key:a.value[se],class:e.normalizeClass(["relative border border-gray-200 rounded-lg bg-white transition vs-dataform__group",[t.view==="accordion"?"overflow-hidden":G(se)?"pt-6 px-6":"p-6"]]),draggable:h.value&&!t.disabled,onDragstart:ge=>z(se,ge),onDragend:A,onDragover:e.withModifiers(ge=>R(se,ge),["prevent"]),onDragenter:e.withModifiers(ge=>q(se,ge),["prevent"]),onDrop:e.withModifiers(ge=>O(),["prevent"])},[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center justify-between gap-2 border-b border-gray-100 px-4 py-3",[t.view!=="accordion"?"-mx-6 -mt-6 px-6":"",t.view!=="accordion"&&!G(se)?"rounded-t-lg":"rounded-lg"]])},[e.createElementVNode("div",Nd,[h.value?(e.openBlock(),e.createBlock(ft,{key:0,class:"w-4 h-4 text-gray-400","aria-hidden":"true"})):e.createCommentVNode("",!0),E.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"rounded-full p-1 text-gray-500 transition hover:bg-gray-100",onClick:ge=>j(se)},[e.createVNode(jt,{class:e.normalizeClass(["h-4 w-4 transition",G(se)?"-rotate-90":"rotate-0"])},null,8,["class"])],8,Md)):e.createCommentVNode("",!0),e.createElementVNode("div",$d,e.toDisplayString(`${d.value} (${se+1})`),1)]),e.createElementVNode("div",Dd,[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:ge=>$(se),disabled:t.disabled,draggable:"false"},[e.createVNode(Bd,{class:"w-5 h-5"})],8,Ad),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:ge=>B(se),disabled:V.value,draggable:"false"},[e.createVNode(Qe,{class:"w-5 h-5"})],8,Fd)])],2),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(t.view==="accordion"?"p-6":"pt-6")},[e.createVNode(Oe,{class:"vs-dataform__form",schema:C.value,layout:"inline",navigation:!1,values:n.value[se],"onUpdate:values":ge=>n.value[se]=ge,"form-id":a.value[se],disabled:t.disabled},null,8,["schema","values","onUpdate:values","form-id","disabled"])],2),[[e.vShow,!G(se)]])],42,Sd))),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",Ld,e.toDisplayString(u.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:F,disabled:!g.value},[e.createVNode(Ae,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Td)]))}}),[["__scopeId","data-v-473b9d69"]]),bt="__vs_form_monaco_loader__",zn={VsInputText:Xe,VsInputRadio:Kt,"vs-input-text":Xe,"vs-input-password":Fl,"vs-input-textarea":En,"vs-input-richtext":Vn,"vs-input-mask":Ht,"vs-input-number":fn,"vs-input-radio":Kt,"vs-input-select":Jt,"vs-input-switcher":Pt,"vs-input-static":Ut,"vs-input-container":vn,"vs-input-date":Sa,"vs-input-checkbox":hn,"vs-input-file":xn,"vs-input-file2":Wt,file2:Wt,File2:Wt,"vs-input-html":Ut,"vs-input-email":qt,"vs-input-tel":Gt,"vs-input-datatable":Cn,"vs-input-map":Sn,"vs-input-file-list":wn,"vs-input-tags":Nn,"vs-input-slug":Mn,"vs-input-codegen":$n,"vs-input-key-value":Dn,"vs-input-text[]":An,"vs-input-range":Ln,"vs-input-color":Fn,"vs-input-native-select":Jt,VsInputArraySelect:kt,"vs-input-array":Tn,"vs-input-array-select":kt,"array-select":kt,"vs-input-address":In,"vs-input-datalist":vd,"vs-input-dataform":Id,"vs-input-monaco":e.defineComponent({__name:"vs-input-monaco",props:e.mergeModels({syntax:{default:"xml"},theme:{default:"vs-light"},height:{default:280},minimap:{type:Boolean,default:!1},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(null),o=e.computed(()=>typeof t.height=="number"?`${t.height}px`:t.height||"280px");let r=null,s=null,i=!1;const c=()=>{if(s)return Promise.resolve(s);if(typeof window>"u")return Promise.resolve(null);const u=window;if(u.monaco?.editor?.create)return s=u.monaco,Promise.resolve(s);if(u[bt])return u[bt];const C=(async()=>{const b=g=>{if(Array.from(document.styleSheets||[]).some(w=>w?.href?.includes(g)))return;const y=document.createElement("link");y.rel="stylesheet",y.href=g,document.head.appendChild(y)},E=g=>new Promise((V,y)=>{if(Array.from(document.scripts).some(S=>S.src===g))return V();const x=document.createElement("script");x.src=g,x.async=!0,x.onload=()=>V(),x.onerror=S=>y(S),document.body.appendChild(x)}),h="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs";return b(`${h}/editor/editor.main.min.css`),await E(`${h}/loader.min.js`),new Promise((g,V)=>{window.require.config({paths:{vs:h}}),window.require(["vs/editor/editor.main"],()=>{s=window.monaco,u.monaco=s,g(s)},y=>V(y))})})().catch(b=>{throw delete u[bt],b});return u[bt]=C,C},d=()=>{!a.value||!s||(r&&(r.dispose(),r=null),r=s.editor.create(a.value,{value:n.value||"",language:t.syntax,theme:t.theme,automaticLayout:!0,minimap:{enabled:!!t.minimap},readOnly:!!t.disabled}),r.onDidChangeModelContent(()=>{i||(n.value=r.getValue())}))};return e.watch(()=>n.value,u=>{if(!r)return;const k=r.getValue();u!==k&&(i=!0,r.setValue(u||""),i=!1)}),e.watch(()=>t.syntax,u=>{!r||!s||s.editor.setModelLanguage(r.getModel(),u||"xml")}),e.watch(()=>t.theme,u=>{s&&s.editor.setTheme(u||"vs-light")}),e.watch(()=>t.disabled,u=>{r&&r.updateOptions({readOnly:!!u})}),e.watch(()=>t.minimap,u=>{r&&r.updateOptions({minimap:{enabled:!!u}})}),e.onMounted(async()=>{try{const u=await c();if(!u||!u.editor)return;s=u,d()}catch(u){console.error("Failed to load Monaco editor",u)}}),e.onBeforeUnmount(()=>{r&&(r.dispose(),r=null)}),(u,k)=>(e.openBlock(),e.createElementBlock("div",{class:"w-full",style:e.normalizeStyle({height:o.value})},[e.createElementVNode("div",{ref_key:"editorContainer",ref:a,class:"w-full h-full overflow-hidden border border-[#CFD9E0] rounded"},null,512)],4))}})},Od=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){me.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const s=await r.json();if(!t.set||!n)return;for(const[i,c]of Object.entries(t.set))n.value[i]=s.result[c]}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(l.button),1))}}),zd={class:"flex flex-col gap-1 w-full"},Rd=["innerHTML"],Rn=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(()=>Dl[`${n.layout}`]),s=["label","placeholder","info","description","text","html"],i=e.ref(V()),c=e.computed(()=>E(n.item,i.value)),d=e.computed(()=>zn?.[`vs-input-${n.item.type}`]),u=e.inject("field-props"),k=e.computed(()=>{const w=e.unref(d);if(!w)return new Set;const x=w.props??w.__vccOpts?.props;if(!x)return new Set;const S=Array.isArray(x)?x:Object.keys(x);return new Set(S)}),C=e.computed(()=>{const w={...c.value??{}},x=n.item?.name;x&&u?.value?.[x]&&Object.assign(w,u.value[x]);const S=k.value;return S.size?Object.fromEntries(Object.entries(w).filter(([F])=>S.has(F))):{}}),b=w=>{const x=typeof w=="object"&&w!==null?w:{value:w};o("value-selected",{...x,name:x.name??n.item?.name})};e.onMounted(()=>{i.value=V(),window.addEventListener("storage",y)}),e.onUnmounted(()=>{window.removeEventListener("storage",y)});function E(w,x){if(!w)return{};const S={...w};return s.forEach(F=>{const B=g(w,F,x);B!=null&&(S[F]=B)}),Array.isArray(w.options)&&(S.options=w.options.map(F=>h(F,x))),S}function h(w,x){if(!w)return w;const S={...w},F=g(w,"label",x),B=g(w,"text",x);return F!=null&&(S.label=F),B!=null?S.text=B:F!=null&&(S.text=F),S}function g(w,x,S){const F=`${x}:${S}`;if(w?.[F]!=null)return w[F];if(x==="label"&&w?.[S]!=null)return w[S];if(w?.[x]!=null)return w[x];if(x==="label"){if(w?.ua!=null)return w.ua;if(w?.en!=null)return w.en}if(x==="text"||x==="html"){if(w?.ua!=null)return w.ua;if(w?.en!=null)return w.en}return null}function V(){return typeof window>"u"?"uk":localStorage.getItem("locale")||"uk"}function y(){i.value=V()}return(w,x)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{ua:c.value.ua,error:n.error||"",item:c.value,columns:n.columns,label:c.value.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${n.item.type}-component`])},[e.createElementVNode("div",zd,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value),e.mergeProps(C.value,{modelValue:a.value,"onUpdate:modelValue":x[0]||(x[0]=S=>a.value=S),onValueSelected:b}),null,16,["modelValue"])),c.value.description&&n.layout!=="settings"?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-sm text-gray-500",innerHTML:c.value.description},null,8,Rd)):e.createCommentVNode("",!0)]),c.value.behavior?.api&&c.value.behavior?.button?(e.openBlock(),e.createBlock(Od,e.mergeProps({key:0},c.value.behavior,{value:a.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),jd={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},Pd={class:"vs-compact-form-navigation__rail mt-[6px]"},Ud=["onClick"],Hd=ne(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"]),c=e.computed(()=>{const j=n.width;if(j==null)return{};const z=typeof j=="number"?`${j}px`:`${j}`;return{width:z,minWidth:z}});let d=null,u=0,k=0,C=null,b=null,E=null;const h=()=>H(),g=()=>y();e.watch(()=>n.target,async j=>{if(F(),!j){C=null,a.value=[],o.value="";return}C=j,s.value&&(await e.nextTick(),S(j),y())},{immediate:!0}),e.watch(()=>n.scrollContainer,j=>{if(!s.value){b=j??null;return}V(j??null),e.nextTick(()=>y())},{immediate:!0}),e.onMounted(()=>{n.scrollContainer||V(null),y()}),e.onBeforeUnmount(()=>{F(),V(null,!0),C=null,typeof window<"u"&&(u&&window.cancelAnimationFrame(u),k&&window.cancelAnimationFrame(k))});function V(j,z=!1){if(E&&(E(),E=null),z){b=null;return}if(b=j??null,typeof window>"u")return;const R=j??window,q=window;R.addEventListener("scroll",h,{passive:!0}),q.addEventListener("resize",g),E=()=>{R.removeEventListener("scroll",h),q.removeEventListener("resize",g)}}function y(){if(!s.value||!C)return;u&&typeof window<"u"&&window.cancelAnimationFrame(u);const j=()=>{w(),u=0};typeof window>"u"?j():u=window.requestAnimationFrame(j)}function w(){if(!s.value||!C)return;const j=Array.from(C.querySelectorAll("h1, h2")),z=new Set,R=[];j.forEach((q,O)=>{const A=q.textContent?.trim()??"";if(!A)return;let Z=(q.getAttribute("id")??"").trim();Z||(Z=x(A)||`heading-${O+1}`);let Y=Z,ue=1;for(;z.has(Y);)Y=`${Z}-${ue+=1}`;q.id!==Y&&Object.assign(q,{id:Y}),z.add(Y),R.push({id:Y,text:A,level:q.tagName.toLowerCase()==="h1"?1:2})}),a.value=R,R.length||(o.value=""),$()}function x(j){return j.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function S(j){!j||!s.value||typeof MutationObserver>"u"||(F(),d=new MutationObserver(()=>y()),d.observe(j,{childList:!0,subtree:!0}))}function F(){d&&(d.disconnect(),d=null)}function B(j){const z=b;if(!z)return typeof window>"u"?j.offsetTop:j.getBoundingClientRect().top+window.scrollY;const R=j.getBoundingClientRect(),q=z.getBoundingClientRect();return R.top-q.top+z.scrollTop}function $(){if(!s.value||!a.value.length)return;const j=b,z=(j?j.scrollTop:null)||(typeof window<"u"?window.scrollY:0),R=(j?j.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),q=z+R;let O=null;for(let Z=0;Z<a.value.length;Z+=1){const Y=a.value[Z],ue=document.getElementById(Y.id);if(ue){const de=B(ue);de+ue.offsetHeight>z&&de<q&&(O=Y.id)}}!O&&r.value&&(O=r.value),O&&(r.value=O);const A=j?j.scrollHeight-j.clientHeight:document.documentElement.scrollHeight-window.innerHeight;z+5>=A&&(O=a.value[a.value.length-1].id),O&&(o.value=O)}function H(){s.value&&(k&&window.cancelAnimationFrame(k),k=window.requestAnimationFrame(()=>{$(),k=0}))}function G(j){if(!s.value)return;const z=document.getElementById(j);if(!z)return;const R=b,q=Math.max(0,B(z));R?R.scrollTo({top:q,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:q,behavior:"smooth"})}return t({refresh:y}),(j,z)=>s.value&&a.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(c.value)},[e.createElementVNode("h2",jd,e.toDisplayString(l.title),1),e.createElementVNode("div",Pd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,R=>(e.openBlock(),e.createElementBlock("div",{key:R.id,class:e.normalizeClass(["vs-compact-form-navigation__item relative",R.level===2?"vs-compact-form-navigation__item--nested":"",R.id===o.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick:q=>G(R.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",R.level===2?"pl-[15px]":"pl-[18px]",R.id===o.value?"text-gray-800":"text-gray-500"])},[e.createElementVNode("span",null,e.toDisplayString(R.text),1)],10,Ud)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-b3e16a91"]]),Ge={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон",minlength:l=>`Мінімальна довжина — ${l} символів`,maxlength:l=>`Максимальна довжина — ${l} символів`},qd=l=>typeof l=="string"?l.trim()?!1:Ge.required:Array.isArray(l)?l.map(n=>typeof n=="string"?n.trim():n).filter(n=>n!=null&&n!=="").length?!1:Ge.required:l?!1:Ge.required,Gd=l=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return l?t.test(l)?!1:Ge.email:!1},Kd=l=>{const t=/^\+[1-9]\d{1,14}$/;return l?t.test(l)?!1:Ge.tel:!1},jn=l=>l==null?0:typeof l=="string"?l.trim().length:Array.isArray(l)?l.length:typeof l=="number"?l.toString().length:String(l).length,Yd=(l,t)=>{if(l==null)return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&jn(l)<n?t?.message||Ge.minlength(n):!1},Wd=(l,t)=>{if(l==null||l==="")return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&jn(l)>n?t?.message||Ge.maxlength(n):!1},Zd=(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},Jd=(l,t)=>!1,Xd=(l,t)=>{switch(typeof t=="string"?t:t.type){case"required":return qd(l);case"email":return Gd(l);case"tel":return Kd(l);case"regexp":return Zd(l,t);case"minlength":return Yd(l,t);case"maxlength":return Wd(l,t);case"custom":return Jd();default:return!1}},Qd={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function Pn(l){const t=l?.toLowerCase();return Qd[t]||t}function Qt(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=Pn(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=Qt(r.schema,r.disabled)),a.push(r)}),a}const n=[];return Object.entries(l).forEach(a=>{const o={name:a[0],...a[1],type:Pn(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=Qt(o.schema,o.disabled)),n.push(o)}),n}function eu(l,t,n=!1){const a=e.computed(()=>Qt((Array.isArray(t),t),typeof n=="boolean"?n:n.value)),o=e.ref({});function r(d){const u=d?.conditions;if(!u)return!0;const k=Array.isArray(u)?u[0]:u,C=l?.value?.[k];return _n(C,u)}const s=(d=a.value,u=!0)=>(d.forEach(k=>{const C=[],b=Number(k?.minlength),E=Number(k?.maxlength);!Number.isNaN(b)&&Number.isFinite(b)&&C.push({type:"minlength",value:b}),!Number.isNaN(E)&&Number.isFinite(E)&&C.push({type:"maxlength",value:E});const h=[...C,...k.rules||[]];if(h.length){if(!r(k)){delete o.value[k.name];return}let g=!1,V=null;h.forEach(y=>{const w=Xd(l.value[k.name],y);w&&(g=!0,!V&&typeof w=="string"&&(V=w))}),g&&V?o.value[k.name]=V:delete o.value[k.name]}k.schema&&s(k.schema,!1)}),u&&Object.values(o.value).some(Boolean)?o.value:null),i=e.computed(()=>a.value?.filter(d=>d.hidden!==!0&&r(d)));return{errors:o,validate:s,reset:()=>{l.value={},o.value={}},visibleSchema:i}}const tu={class:"flex w-full h-full min-h-0 gap-6"},nu={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},Oe=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:{},modelValue:{default:()=>({})},modelModifiers:{},values:{default:void 0},valuesModifiers:{}}),emits:e.mergeModels(["handle-submit","update:modelValue","value-selected"],["update:form","update:modelValue","update:values"]),setup(l,{expose:t,emit:n}){const a=n,o=l,r=e.useModel(l,"form"),s=e.useModel(l,"modelValue"),i=e.useModel(l,"values"),c=e.computed({get:()=>i.value??s.value,set:z=>{s.value=z,i.value=z}}),{errors:d,validate:u,reset:k,visibleSchema:C}=eu(c,o.schema,e.toRef(o,"disabled")),b=e.ref(null),E=e.ref(null),h=e.ref({}),g=e.computed(()=>o.navigation),V=e.computed(()=>o.navWidth),y=e.computed(()=>o.style?.columns),w=Object.freeze({container:12,label:3}),x=e.computed(()=>o.columns??y.value??w),S=e.computed(()=>o.columns!=null||y.value!=null),F=e.computed(()=>S.value?"horizontal":o.layout),B=z=>z?.columns?"horizontal":F.value,$=z=>z?.columns??x.value,H=()=>{a("update:modelValue",c.value),u(),a("handle-submit",c.value)},G=z=>{a("value-selected",z)};t({validate:u,reset:k,errors:d}),e.onMounted(()=>{r.value={value:c.value,errors:d.value,reset:k,validate:u,formId:o.formId}});function j(z,R){if(z===R)return!0;if(typeof z!="object"||typeof R!="object"||!z||!R)return!1;const q=Object.keys(z),O=Object.keys(R);return q.length!==O.length?!1:q.every(A=>z[A]===R[A])}return e.provide("form",r),e.provide("values",c),e.provide("field-props",h),(z,R)=>(e.openBlock(),e.createElementBlock("div",tu,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:E},[e.createElementVNode("form",{ref_key:"formRef",ref:b,onSubmit:e.withModifiers(H,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",F.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(C),(q,O)=>(e.openBlock(),e.createElementBlock("div",{key:q.name,class:e.normalizeClass(B(q)==="horizontal"?"col-span-12":`col-span-${q.col||12}`)},[e.createVNode(Rn,{style:e.normalizeStyle(l.style),item:q,layout:B(q),columns:$(q),"model-value":c.value[q.name],"onUpdate:modelValue":A=>{const Z=c.value[q.name];j(Z,A)||(c.value[q.name]=A)},error:e.unref(d)[q.name],onValueSelected:G},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),B(q)==="settings"&&O+1!==e.unref(C).length?(e.openBlock(),e.createElementBlock("div",nu)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(Hd,{target:b.value,"scroll-container":E.value,enabled:g.value,width:V.value},null,8,["target","scroll-container","enabled","width"])]))}}),lu={class:"relative"},au={class:"w-full h-full fixed top-0 start-0 bg-black bg-opacity-50"},ou={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"},ru={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},su={class:"font-medium text-gray-800 dark:text-[#ffffff]"},iu={class:"p-4 mim-h-0 h-full overflow-auto"},Un=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{},api:{},method:{}},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||""),c=e.ref(n.mode),d=()=>{const E=n.method?.trim().toUpperCase();return E==="GET"||E==="POST"||E==="PUT"?E:c.value==="add"?"POST":"PUT"},u=()=>{me.notify({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`})},k=async E=>{if(console.log(E),E.ok){await E.json().catch(()=>({})),u(),a("save",r.value);return}if(E.status===400){const h=await E.json().catch(()=>({}));me.notify({type:"warning",title:"Помилка валідації",message:h.message||"Некоректні дані (400)"});return}if(E.status===500){me.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"});return}me.notify({type:"error",title:"Помилка",message:`Статус: ${E.status}`})};async function C(){const E=s.value.validate();if(E){me.notify({type:"warning",title:"Помилка валідації",message:Object.entries(E).map(([g,V])=>`${g}: ${V}`).join(`
|
|
3
|
-
`)});return}const h=n.api?.trim();if(h){const g=d();try{const V=await fetch(h,{method:g,headers:g==="GET"?void 0:{"Content-Type":"application/json"},body:g==="GET"?void 0:JSON.stringify(r.value)});await k(V)}catch(V){me.notify({type:"error",title:"Помилка з’єднання",message:V.message||"Не вдалося виконати запит"})}return}if(i.value)try{const g=await fetch(`/api/table/${i.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r.value)});await k(g)}catch(g){me.notify({type:"error",title:"Помилка з’єднання",message:g.message||"Не вдалося виконати запит"})}else a("edit",r.value),b()}function b(){a("close")}return e.onMounted(async()=>{try{if(n.form&&!n.schema){const E=await fetch(`/api/template/form/${n.form}`);if(!E.ok){me.notify({type:E.status>=400&&E.status<500?"warning":"error",title:"Error",message:`Error code: ${E.status}`});return}const h=await E.json();o.value=h.schema,h.token&&(i.value=h.token)}else if(n.token&&!n.defaultValue){i.value=n.token;const E=await fetch(`/api/form/${i.value}`);if(!E.ok){me.notify({type:E.status>=400&&E.status<500?"warning":"error",title:"Error",message:`Error code: ${E.status}`});return}const h=await E.json();o.value=h.schema,h.data?r.value=h.data:c.value="add",h.obj&&(r.value={...r.value,...h.obj})}}catch(E){me.notify({type:"error",title:"Error",message:E.message||"Unexpected error"}),console.error(E)}}),(E,h)=>(e.openBlock(),e.createElementBlock("div",lu,[e.createElementVNode("div",au,[e.createElementVNode("div",ou,[e.createElementVNode("div",ru,[e.createElementVNode("h3",su,e.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:b,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"},[...h[2]||(h[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",iu,[o.value?(e.openBlock(),e.createBlock(Oe,{key:0,schema:o.value,values:r.value,"onUpdate:values":h[0]||(h[0]=g=>r.value=g),form:s.value,"onUpdate:form":h[1]||(h[1]=g=>s.value=g),formId:i.value},null,8,["schema","values","form","formId"])):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:b,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"}," Зберегти ")])])])]))}}),cu=1440*60*1e3,du=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],uu=["січ","лют","бер","квіт","трав","черв","лип","серп","вер","жовт","лист","груд"],pu=["нд","пн","вт","ср","чт","пт","сб"];function xe(l){return l instanceof Date&&!Number.isNaN(l.getTime())}const et=l=>new Date(l.getTime());function Ke(l){const t=et(l);return t.setHours(0,0,0,0),t}function lt(l){const t=et(l);return t.setHours(23,59,59,999),t}function en(l){return Ke(new Date(l.getFullYear(),l.getMonth(),1))}function tn(l){return lt(new Date(l.getFullYear(),l.getMonth()+1,0))}function nn(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 mu(l,t){return nn(l,-1)}function xt(l,t){const n=new Date(l);return n.setFullYear(n.getFullYear()+t),n}function Hn(l,t){return xt(l,-t)}function qn(l){return Ke(new Date(l.getFullYear(),0,1))}function Gn(l){return lt(new Date(l.getFullYear(),11,31))}function fu(l){const t=Math.floor(l.getFullYear()/10)*10;return Ke(new Date(t,0,1))}function hu(l){const t=Math.floor(l.getFullYear()/10)*10+9;return lt(new Date(t,11,31))}const $e=l=>l.getFullYear(),wt=l=>Math.floor(l.getFullYear()/10)*10;function gu(l){const t=[];let n=Ke(l.start);const a=Ke(l.end);for(;n<=a;)t.push(et(n)),n=new Date(n.getTime()+cu);return t}function yu(l){const t=[];let n=en(l.start);const a=tn(l.end);for(;n<=a;)t.push(et(n)),n=nn(n,1);return t}function ku(l){const t=[];let n=qn(l.start);const a=Gn(l.end);for(;n<=a;)t.push(et(n)),n=xt(n,1);return t}function ln(l,t=1){const n=Ke(l),a=(n.getDay()-t+7)%7;return n.setDate(n.getDate()-a),n}function bu(l,t=1){const n=ln(l,t);return n.setDate(n.getDate()+6),lt(n)}function xu(l,t,n=0){const a=ln(l,n),o=(t-n+7)%7;return a.setDate(a.getDate()+o),a}const _t=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth()&&l.getDate()===t.getDate(),an=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth(),Kn=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear(),Yn=(l,t)=>!!l&&!!t&&_t(l,t)&&l.getHours()===t.getHours(),wu=(l,t)=>!!l&&!!t&&Yn(l,t)&&l.getMinutes()===t.getMinutes();function _u(l,t){const n=l.getTime();return n>=t.start.getTime()&&n<=t.end.getTime()}const at=(l,t)=>!!l&&!!t&&l.getTime()<t.getTime(),ot=(l,t)=>!!l&&!!t&&l.getTime()>t.getTime();function vu(l){const t=l.filter(n=>xe(n));if(t.length)return t.reduce((n,a)=>n.getTime()>=a.getTime()?n:a)}function Eu(l){const t=l.filter(n=>xe(n));if(t.length)return t.reduce((n,a)=>n.getTime()<=a.getTime()?n:a)}function Wn(l,t){const n=et(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 vt=(l,t=2)=>String(l).padStart(t,"0");function Zn(l,t){return t==="wide"?du[l]:uu[l]}function Vu(l){return pu[l]}const Bu=[{token:"LLLL",format:l=>Zn(l.getMonth(),"wide")},{token:"LLL",format:l=>Zn(l.getMonth(),"abbreviated")},{token:"EE",format:l=>Vu(l.getDay())},{token:"yyyy",format:l=>String(l.getFullYear())},{token:"MM",format:l=>vt(l.getMonth()+1)},{token:"dd",format:l=>vt(l.getDate())},{token:"HH",format:l=>vt(l.getHours())},{token:"mm",format:l=>vt(l.getMinutes())}];function Et(l,t){if(!xe(l))return"";let n="",a=0;for(;a<t.length;){const o=Bu.find(r=>t.startsWith(r.token,a));o?(n+=o.format(l),a+=o.token.length):(n+=t[a],a+=1)}return n}const Cu={"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 Jn(l,t){const n=Cu[t];if(!n){const o=new Date(l);return xe(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 xe(i)?i:null}case"dd.MM.yyyy":{const[,o,r,s]=a,i=new Date(Number(s),Number(r)-1,Number(o));return xe(i)?i:null}case"dd.MM.yyyy HH:mm":{const[,o,r,s,i,c]=a,d=new Date(Number(s),Number(r)-1,Number(o),Number(i),Number(c));return xe(d)?d: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 Su=["year","month","day","time","custom"],Nu=e.defineComponent({emits:{elementClick:l=>xe(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"&&Su.includes(l)}}}),Mu={class:"v3dp__heading"},$u=["disabled"],Du=["disabled"],Au={class:"v3dp__body"},Fu={class:"v3dp__subheading"},Lu={class:"v3dp__elements"},Tu=["disabled","onClick"];function Iu(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",Mu,[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,$u),(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,Du)]),e.createElementVNode("div",Au,["subheading"in l.$slots?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Fu,[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",Lu,[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,Tu))),128))],!0)])])],38)}const Vt=ne(Nu,[["render",Iu],["__scopeId","data-v-5de7813f"]]),Ou=e.defineComponent({components:{PickerPopup:Vt},emits:{"update:pageDate":l=>xe(l),select:l=>xe(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(()=>fu(l.pageDate)),a=e.computed(()=>hu(l.pageDate)),o=(k,C,b)=>!C&&!b?!0:!(C&&$e(k)<$e(C)||b&&$e(k)>$e(b)),r=e.computed(()=>ku({start:n.value,end:a.value}).map(k=>({value:k,key:String($e(k)),display:$e(k),selected:!!l.selected&&$e(k)===$e(l.selected),disabled:!o(k,l.lowerLimit,l.upperLimit)}))),s=e.computed(()=>{const k=$e(n.value),C=$e(a.value);return`${k} - ${C}`}),i=e.computed(()=>l.lowerLimit&&(wt(l.lowerLimit)===wt(l.pageDate)||at(l.pageDate,l.lowerLimit))),c=e.computed(()=>l.upperLimit&&(wt(l.upperLimit)===wt(l.pageDate)||ot(l.pageDate,l.upperLimit)));return{years:r,heading:s,leftDisabled:i,rightDisabled:c,previousPage:()=>t("update:pageDate",Hn(l.pageDate,10)),nextPage:()=>t("update:pageDate",xt(l.pageDate,10))}}});function zu(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 Ru=ne(Ou,[["render",zu]]),ju=e.defineComponent({components:{PickerPopup:Vt},emits:{"update:pageDate":l=>xe(l),select:l=>xe(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(()=>qn(l.pageDate)),a=e.computed(()=>Gn(l.pageDate)),o=e.computed(()=>C=>Et(C,l.format)),r=(C,b,E)=>!b&&!E?!0:!(b&&at(C,en(b))||E&&ot(C,tn(E))),s=e.computed(()=>yu({start:n.value,end:a.value}).map(C=>({value:C,display:o.value(C),key:o.value(C),selected:!!l.selected&&an(l.selected,C),disabled:!r(C,l.lowerLimit,l.upperLimit)}))),i=e.computed(()=>$e(n.value)),c=e.computed(()=>l.lowerLimit&&(Kn(l.lowerLimit,l.pageDate)||at(l.pageDate,l.lowerLimit))),d=e.computed(()=>l.upperLimit&&(Kn(l.upperLimit,l.pageDate)||ot(l.pageDate,l.upperLimit)));return{months:s,heading:i,leftDisabled:c,rightDisabled:d,previousPage:()=>t("update:pageDate",Hn(l.pageDate,1)),nextPage:()=>t("update:pageDate",xt(l.pageDate,1))}}});function Pu(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 Uu=ne(ju,[["render",Pu]]),Hu=e.defineComponent({components:{PickerPopup:Vt},emits:{"update:pageDate":l=>xe(l),select:l=>xe(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(()=>g=>V=>Et(V,g)),a=e.computed(()=>en(l.pageDate)),o=e.computed(()=>tn(l.pageDate)),r=e.computed(()=>({start:a.value,end:o.value})),s=e.computed(()=>({start:ln(a.value,l.weekStartsOn),end:bu(o.value,l.weekStartsOn)})),i=e.computed(()=>l.customWeekdays?.length===7?l.customWeekdays:null),c=e.computed(()=>{const g=l.weekStartsOn,V=i.value;if(V)return Array.from({length:7}).map((w,x)=>V[(g+x)%7]);const y=n.value(l.weekdayFormat);return Array.from(Array(7)).map((w,x)=>(g+x)%7).map(w=>xu(new Date,w,l.weekStartsOn)).map(y)}),d=(g,V,y,w)=>w?.dates?.some(x=>_t(g,x))||w?.predicate?.(g)?!1:!V&&!y?!0:!(V&&at(g,Ke(V))||y&&ot(g,lt(y))),u=e.computed(()=>{const g=new Date,V=n.value(l.format);return gu(s.value).map(y=>({value:y,display:V(y),selected:!!l.selected&&_t(l.selected,y),current:_t(g,y),disabled:!l.allowOutsideInterval&&!_u(y,r.value)||!d(y,l.lowerLimit,l.upperLimit,l.disabledDates),key:n.value("yyyy-MM-dd")(y)}))}),k=e.computed(()=>n.value(l.headingFormat)(l.pageDate)),C=e.computed(()=>l.lowerLimit&&(an(l.lowerLimit,l.pageDate)||at(l.pageDate,l.lowerLimit))),b=e.computed(()=>l.upperLimit&&(an(l.upperLimit,l.pageDate)||ot(l.pageDate,l.upperLimit)));return{weekDays:c,days:u,heading:k,leftDisabled:C,rightDisabled:b,previousPage:()=>t("update:pageDate",mu(l.pageDate)),nextPage:()=>t("update:pageDate",nn(l.pageDate,1))}}});function qu(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,c)=>(e.openBlock(),e.createElementBlock("span",{key:i,class:e.normalizeClass(`v3dp__subheading__weekday__${c}`)},e.toDisplayString(i),3))),128))]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const Gu=ne(Hu,[["render",qu]]);function Xn(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 Ku=e.defineComponent({components:{PickerPopup:Vt},emits:{select:l=>xe(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 E=0,h=0;b&&(E=b.getHours(),h=b.getMinutes()),r.value=E,s.value=h});const i=e.computed(()=>[...Array(24).keys()].map(b=>({value:b,date:Wn(new Date(o.value.getTime()),{hours:b,minutes:s.value,seconds:0}),selected:r.value===b,ref:e.ref(null)}))),c=e.computed(()=>[...Array(60).keys()].map(b=>({value:b,date:Wn(new Date(o.value.getTime()),{hours:r.value,minutes:b,seconds:0}),selected:s.value===b,ref:e.ref(null)}))),d=b=>{s.value=b.value,t("select",b.date)},u=()=>{const b=i.value.find(h=>h.ref.value?.classList?.contains("selected")??!1),E=c.value.find(h=>h.ref.value?.classList?.contains("selected")??!1);b&&E&&(Xn(n.value,b.ref.value),Xn(a.value,E.ref.value))};return e.watch(()=>l.visible,b=>{b&&e.nextTick(u)}),{hoursListRef:n,minutesListRef:a,hours:r,minutes:s,hoursList:i,minutesList:c,padStartZero:b=>`0${b}`.substr(-2),selectMinutes:d,isEnabled:b=>!(l.disabledTime?.dates?.some(E=>Yn(b,E)&&wu(b,E))||l.disabledTime?.predicate?.(b)),scroll:u}}}),Yu={ref:"hoursListRef",class:"v3dp__column"},Wu=["disabled","onClick"],Zu={ref:"minutesListRef",class:"v3dp__column"},Ju=["disabled","onClick"];function Xu(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",Yu,[(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(c=>l.hours=i.value,["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,Wu))),128))],512),e.createElementVNode("div",Zu,[(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(c=>l.selectMinutes(i),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,Ju))),128))],512)]),_:1})}const Qu=ne(Ku,[["render",Xu],["__scopeId","data-v-43e01bf7"]]),Bt=["time","day","month","year"],ep=(l,t,n=void 0)=>{let a=n||new Date;const o=vu([l,a]);o&&(a=o);const r=Eu([t,a]);return r&&(a=r),a},tp=e.defineComponent({components:{YearPicker:Ru,MonthPicker:Uu,DayPicker:Gu,TimePicker:Qu},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"&&Bt.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"&&Bt.includes(l)}},emits:{"update:modelValue":l=>l==null||xe(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(""),c=O=>{const A=O.replace(/[a-zA-Z]/g,"0");return/0/.test(A)?A:""},d=e.computed(()=>c(l.inputFormat));let u=null,k=null;const C=()=>{u?.destroy(),u=null},b=async()=>{if(!k){const{default:O}=await Promise.resolve().then(()=>dn);k=O}return k},E=()=>{u&&u.value!==i.value&&(u.value=i.value??"")},h=async()=>{if(C(),!r.value||!d.value)return;u=(await b())(r.value,{mask:d.value,lazy:!0,overwrite:!0}),E()};e.watchEffect(()=>{if(!i.value)return;const O=Jn(i.value,l.inputFormat);O&&(o.value=O)}),e.watchEffect(()=>{i.value=l.modelValue&&xe(l.modelValue)?Et(l.modelValue,l.inputFormat):""}),e.onMounted(()=>{d.value&&e.nextTick(()=>{h()})}),e.onBeforeUnmount(()=>{C()}),e.watch(d,O=>{O?e.nextTick(()=>{h()}):C()}),e.watch(i,()=>{E()});const g=(O="none")=>{l.disabled||(O!=="none"&&a.value==="none"&&(o.value=l.modelValue||ep(l.lowerLimit,l.upperLimit,o.value)),a.value=O,t(O!=="none"?"opened":"closed"))};e.watchEffect(()=>{l.disabled&&(a.value="none")});const V=(O,A)=>{o.value=A,O==="year"?t("decadePageChanged",A):O==="month"?t("yearPageChanged",A):O==="day"&&t("monthPageChanged",A)},y=O=>{o.value=O,l.minimumView==="year"?(g("none"),t("update:modelValue",O)):a.value="month"},w=O=>{o.value=O,l.minimumView==="month"?(g("none"),t("update:modelValue",O)):a.value="day"},x=O=>{o.value=O,l.minimumView==="day"?(g("none"),t("update:modelValue",O)):a.value="time"},S=O=>{g("none"),t("update:modelValue",O)},F=()=>{l.clearable&&(g("none"),t("update:modelValue",null),o.value=l.startingViewDate)},B=()=>s.value=!0,$=()=>g(j.value),H=()=>{s.value=!1,g()},G=O=>{const A=O.keyCode?O.keyCode:O.which;if([27,13].includes(A)&&r.value.blur(),l.typeable){const Y=Jn(r.value.value,l.inputFormat);Y&&i.value===Et(Y,l.inputFormat)&&(i.value=r.value.value,t("update:modelValue",Y))}},j=e.computed(()=>{const O=Bt.indexOf(l.startingView),A=Bt.indexOf(l.minimumView);return O<A?l.minimumView:l.startingView}),z=O=>Object.fromEntries(Object.entries(O??{}).filter(([A,Z])=>A.startsWith("--"))),R=e.computed(()=>l.weekDayNames?.length===7?l.weekDayNames:void 0);return{blur:H,focus:$,click:B,input:i,inputRef:r,pageDate:o,renderView:g,updatePageDate:V,selectYear:y,selectMonth:w,selectDay:x,selectTime:S,keyUp:G,normalizedWeekdayNames:R,viewShown:a,goBackFromTimepicker:()=>l.startingView==="time"&&l.minimumView==="time"?null:a.value="day",clearModelValue:F,initialView:j,log:O=>console.log(O),variables:z}}}),np={class:"v3dp__input_wrapper"},lp=["readonly","placeholder","disabled","tabindex"],ap={class:"v3dp__clearable"};function op(l,t,n,a,o,r){const s=e.resolveComponent("year-picker"),i=e.resolveComponent("month-picker"),c=e.resolveComponent("day-picker"),d=e.resolveComponent("time-picker");return e.openBlock(),e.createElementBlock("div",{class:"v3dp__datepicker",style:e.normalizeStyle(l.variables(l.$attrs.style))},[e.createElementVNode("div",np,[e.withDirectives(e.createElementVNode("input",e.mergeProps({type:"text",ref:"inputRef",readonly:!l.typeable,"onUpdate:modelValue":t[0]||(t[0]=u=>l.input=u)},l.$attrs,{placeholder:l.placeholder,disabled:l.disabled,tabindex:l.disabled?-1:0,onKeyup:t[1]||(t[1]=(...u)=>l.keyUp&&l.keyUp(...u)),onBlur:t[2]||(t[2]=(...u)=>l.blur&&l.blur(...u)),onFocus:t[3]||(t[3]=(...u)=>l.focus&&l.focus(...u)),onClick:t[4]||(t[4]=(...u)=>l.click&&l.click(...u))}),null,16,lp),[[e.vModelText,l.input]]),e.withDirectives(e.createElementVNode("div",ap,[e.renderSlot(l.$slots,"clear",{onClear:l.clearModelValue},()=>[e.createElementVNode("i",{onClick:t[5]||(t[5]=u=>l.clearModelValue())},"x")])],512),[[e.vShow,l.clearable&&l.modelValue]])]),e.withDirectives(e.createVNode(s,{pageDate:l.pageDate,"onUpdate:pageDate":t[6]||(t[6]=u=>l.updatePageDate("year",u)),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]=u=>l.updatePageDate("month",u)),selected:l.modelValue,onSelect:l.selectMonth,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,format:l.monthListFormat,onBack:t[8]||(t[8]=u=>l.viewShown="year")},null,8,["pageDate","selected","onSelect","lowerLimit","upperLimit","format"]),[[e.vShow,l.viewShown==="month"]]),e.withDirectives(e.createVNode(c,{pageDate:l.pageDate,"onUpdate:pageDate":t[9]||(t[9]=u=>l.updatePageDate("day",u)),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]=u=>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(d,{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 rp=ne(tp,[["render",op]]),sp=ne(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}=Ee(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]||""),c=e.computed(()=>["py-1.5 px-3 block w-full placeholder:text-[#767f8f] bg-white",o.value,n.customClass,{"!border-red-600":n.error}]),d=e.computed(()=>!n.modelValue&&n.now?new Date:null),u=e.computed({get:()=>w(n.modelValue??d.value,r.value)||void 0,set:A=>a("update:modelValue",x(A,r.value))}),k=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],C=e.computed(()=>{if(n.dayNames?.length)return n.dayNames.length===7?n.dayNames:k}),b=e.computed(()=>{const A=n.weekStart,Z=typeof A=="string"?Number(A):A;return Z===void 0||Number.isNaN(Z)?1:Math.min(6,Math.max(0,Z))}),E=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"}}}),h={date:"dd.MM.yyyy",datetime:"dd.MM.yyyy HH:mm",month:"MM.yyyy",time:"HH:mm",week:"dd.MM.yyyy",year:"yyyy"},g=e.computed(()=>h[r.value]||"dd.MM.yyyy"),V=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"})),y=e.ref(!1);e.watch(()=>n.modelValue,A=>{A?y.value=!0:n.now||(y.value=!1)},{immediate:!0}),e.watchEffect(()=>{n.now&&!n.modelValue&&!y.value&&(a("update:modelValue",x(new Date,r.value)),y.value=!0)});function w(A,Z){if(!A)return null;if(A instanceof Date&&!Number.isNaN(A.getTime()))return A;if(typeof A!="string")return null;switch(Z){case"datetime":return $(A);case"time":return j(A);case"month":return H(A);case"year":return G(A);case"week":return z(A);default:return B(A)}}function x(A,Z){if(!A)return null;const Y=A instanceof Date?A:w(A,Z);if(!Y)return null;switch(Z){case"datetime":return`${S(Y)}T${F(Y)}`;case"time":return F(Y);case"month":return`${Y.getFullYear()}-${O(Y.getMonth()+1)}`;case"year":return`${Y.getFullYear()}`;case"week":{const{year:ue,week:de}=R(Y);return`${ue}-W${O(de)}`}default:return S(Y)}}function S(A){return`${A.getFullYear()}-${O(A.getMonth()+1)}-${O(A.getDate())}`}function F(A){return`${O(A.getHours())}:${O(A.getMinutes())}`}function B(A){const Z=A.split("-");if(Z.length<3)return null;const[Y,ue,de]=Z.map(Number);return!Y||!ue||!de?null:new Date(Y,ue-1,de)}function $(A){const Z=A.includes("T")?A:A.replace(" ","T"),Y=new Date(Z);return Number.isNaN(Y.getTime())?null:Y}function H(A){const[Z,Y]=A.split("-").map(Number);return!Z||Number.isNaN(Y)?null:new Date(Z,(Y||1)-1,1)}function G(A){const Z=Number(A);return Z?new Date(Z,0,1):null}function j(A){const Z=A.match(/^(\d{1,2}):(\d{2})$/);if(!Z)return null;const[,Y,ue]=Z,de=new Date;return de.setHours(Number(Y),Number(ue),0,0),de}function z(A){const Z=A.match(/^(\d{4})-W(\d{2})$/);if(!Z)return null;const[,Y,ue]=Z,de=Number(ue);return q(Number(Y),de)}function R(A){const Z=new Date(Date.UTC(A.getFullYear(),A.getMonth(),A.getDate())),Y=Z.getUTCDay()||7;Z.setUTCDate(Z.getUTCDate()+4-Y);const ue=new Date(Date.UTC(Z.getUTCFullYear(),0,1)),de=Math.ceil(((Z.getTime()-ue.getTime())/864e5+1)/7);return{year:Z.getUTCFullYear(),week:de}}function q(A,Z){if(!A||!Z)return null;const Y=new Date(A,0,1+(Z-1)*7),ue=Y.getDay(),de=Y;return ue<=4?de.setDate(Y.getDate()-Y.getDay()+1):de.setDate(Y.getDate()+8-Y.getDay()),de}function O(A){return String(A).padStart(2,"0")}return(A,Z)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vs-date-picker",n.customClass]),style:e.normalizeStyle(V.value)},[e.createVNode(rp,{modelValue:u.value,"onUpdate:modelValue":Z[0]||(Z[0]=Y=>u.value=Y),placeholder:i.value,disabled:n.disabled,clearable:n.clearable,typeable:n.editable,"week-day-names":C.value,"week-starts-on":b.value,"starting-view":E.value.startingView,"minimum-view":E.value.minimumView,"input-format":g.value,name:n.name,class:e.normalizeClass(c.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-97661afe"]]),Qn=(l={mode:"edit",schema:null})=>new Promise(t=>{const{close:n}=me.modal({title:l.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Un,contentProps:{...l,onClose:()=>{t(null),n()},onSave:a=>{t(a),n()}}})});Oe.install=function(t){t.component("VForm",Oe),Object.assign(t.config.globalProperties,{$form:Qn}),t.provide("form",Qn),window.v3plugin||(window.v3plugin={})};function Re(l){return typeof l=="string"||l instanceof String}function el(l){var t;return typeof l=="object"&&l!=null&&(l==null||(t=l.constructor)==null?void 0:t.name)==="Object"}function tl(l,t){return Array.isArray(t)?tl(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 J={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function nl(l){switch(l){case J.LEFT:return J.FORCE_LEFT;case J.RIGHT:return J.FORCE_RIGHT;default:return l}}function on(l){return l.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Ct(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(!Ct(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,c=l instanceof RegExp;if(i&&c)return t.toString()==l.toString();if(i!=c)return!1;const d=Object.keys(t);for(o=0;o<d.length;o++)if(!Object.prototype.hasOwnProperty.call(l,d[o]))return!1;for(o=0;o<d.length;o++)if(!Ct(l[d[o]],t[d[o]]))return!1;return!0}else if(t&&l&&typeof t=="function"&&typeof l=="function")return t.toString()===l.toString();return!1}class ip{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?J.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?J.RIGHT:J.LEFT}}function oe(l,t){return new oe.InputMask(l,t)}function ll(l){if(l==null)throw new Error("mask property should be defined");return l instanceof RegExp?oe.MaskedRegExp:Re(l)?oe.MaskedPattern:l===Date?oe.MaskedDate:l===Number?oe.MaskedNumber:Array.isArray(l)||l===Array?oe.MaskedDynamic:oe.Masked&&l.prototype instanceof oe.Masked?l:oe.Masked&&l instanceof oe.Masked?l.constructor:l instanceof Function?oe.MaskedFunction:(console.warn("Mask not found for mask",l),oe.Masked)}function tt(l){if(!l)throw new Error("Options in not defined");if(oe.Masked){if(l.prototype instanceof oe.Masked)return{mask:l};const{mask:t=void 0,...n}=l instanceof oe.Masked?{mask:l}:el(l)&&l.mask instanceof oe.Masked?l:{};if(t){const a=t.mask;return{...tl(t,(o,r)=>!r.startsWith("_")),mask:t.constructor,_mask:a,...n}}}return el(l)?{...l}:{mask:l}}function Fe(l){if(oe.Masked&&l instanceof oe.Masked)return l;const t=tt(l),n=ll(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)}oe.createMask=Fe;class St{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}}oe.MaskElement=St;const al=90,cp=89;class rt extends St{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===al&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===cp&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===al&&(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={}}}oe.HTMLMaskElement=rt;class ol extends rt{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}}oe.HTMLMaskElement=rt;class rn extends rt{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}}oe.HTMLContenteditableMaskElement=rn;class Nt{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>Nt.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}}Nt.MAX_LENGTH=100;class rl{constructor(t,n){this.el=t instanceof St?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new rn(t):new ol(t),this.masked=Fe(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Nt,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 oe.Masked)&&this.masked.constructor===ll(t)){this.masked.updateOptions({mask:t});return}const n=t instanceof oe.Masked?t:Fe({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,J.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 ip({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:J.NONE;let s=this.masked.nearestInputPos(n.startChangePos+o,r);r!==J.NONE&&(s=this.masked.nearestInputPos(s,J.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}}oe.InputMask=rl;class ie{static normalize(t){return Array.isArray(t)?t:[t,new ie]}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}}oe.ChangeDetails=ie;class Le{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 we{constructor(t){this._value="",this._update({...we.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 Le(this.extractInput(t,n),t)}appendTail(t){return Re(t)&&(t=new Le(String(t))),t.appendTo(this)}_appendCharRaw(t,n){return t?(this._value+=t,new ie({inserted:t,rawInserted:t})):new ie}_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 c=this._appendCharRaw(t,n);i=i.aggregate(c),c.rawInserted||i.equals(r)?r=i:this.state=s}if(r.inserted){let s,i=this.doValidate(n)!==!1;if(i&&a!=null){const c=this.state;if(this.overwrite===!0){s=a.state;for(let u=0;u<r.rawInserted.length;++u)a.unshift(this.displayValue.length-r.tailShift)}let d=this.appendTail(a);if(i=d.rawInserted.length===a.toString().length,!(i&&d.inserted)&&this.overwrite==="shift"){this.state=c,s=a.state;for(let u=0;u<r.rawInserted.length;++u)a.shift();d=this.appendTail(a),i=d.rawInserted.length===a.toString().length}i&&d.inserted&&(this.state=c)}i||(r=new ie,this.state=o,a&&s&&(a.state=s))}return r}_appendPlaceholder(){return new ie}_appendEager(){return new ie}append(t,n,a){if(!Re(t))throw new Error("value should be string");const o=Re(a)?new Le(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 ie}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={}),ie.normalize(this.prepare?this.prepare(t,this,n):t)}doPrepareChar(t,n){return n===void 0&&(n={}),ie.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=J.NONE),r===void 0&&(r={input:!0});const s=t+n,i=this.extractTail(s),c=this.eager===!0||this.eager==="remove";let d;c&&(o=nl(o),d=this.extractInput(0,s,{raw:!0}));let u=t;const k=new ie;if(o!==J.NONE&&(u=this.nearestInputPos(t,n>1&&t!==0&&!c?J.NONE:o),k.tailShift=u-t),k.aggregate(this.remove(u)),c&&o!==J.NONE&&d===this.rawInputValue)if(o===J.FORCE_LEFT){let C;for(;d===this.rawInputValue&&(C=this.displayValue.length);)k.aggregate(new ie({tailShift:-1})).aggregate(this.remove(C-1))}else o===J.FORCE_RIGHT&&i.unshift();return k.aggregate(this.append(a,r,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!Ct(this,t)}typedValueEquals(t){const n=this.typedValue;return t===n||we.EMPTY_VALUES.includes(t)&&we.EMPTY_VALUES.includes(n)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new ie}}we.DEFAULTS={skipInvalid:!0},we.EMPTY_VALUES=[void 0,null,""],oe.Masked=we;class je{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=Re(t)?new Le(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 Le)a?n.extend(t.toString()):this.chunks.push(t);else if(t instanceof je){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 oe.MaskedPattern))return new Le(this.toString()).appendTo(t);const n=new ie;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 je||t._stops.indexOf(s)>=0)&&n.aggregate(t._appendPlaceholder(s)),i=o instanceof je&&t._blocks[s]),i){const c=i.appendTail(o);n.aggregate(c);const d=o.toString().slice(c.rawInserted.length);d&&n.aggregate(t.append(d,{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 je:new Le;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 dp{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,J.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,J.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,J.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,J.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,J.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,J.NONE),!0})}}class sn{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 ie}nearestInputPos(t,n){n===void 0&&(n=J.NONE);const a=0,o=this._value.length;switch(n){case J.LEFT:case J.FORCE_LEFT:return a;case J.NONE:case J.RIGHT:case J.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 ie;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 ie({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 ie;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new Le("")}appendTail(t){return Re(t)&&(t=new Le(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 st{constructor(t){const{parent:n,isOptional:a,placeholderChar:o,displayChar:r,lazy:s,eager:i,...c}=t;this.masked=Fe(c),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 ie}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 ie;const a=this.masked.state;let o=this.masked._appendChar(t,this.currentMaskFlags(n));return o.inserted&&this.doValidate(n)===!1&&(o=new ie,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 ie:(this.isFilled=!0,new ie({inserted:this.placeholderChar}))}_appendEager(){return new ie}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=J.NONE);const a=0,o=this.value.length,r=Math.min(Math.max(t,a),o);switch(n){case J.LEFT:case J.FORCE_LEFT:return this.isComplete?r:a;case J.RIGHT:case J.FORCE_RIGHT:return this.isComplete?r:o;case J.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 ie}}st.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 sl extends we{updateOptions(t){super.updateOptions(t)}_update(t){const n=t.mask;n&&(t.validate=a=>a.search(n)>=0),super._update(t)}}oe.MaskedRegExp=sl;class _e extends we{constructor(t){super({..._e.DEFAULTS,...t,definitions:Object.assign({},st.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 d=n.slice(r),u=Object.keys(this.blocks).filter(C=>d.indexOf(C)===0);u.sort((C,b)=>b.length-C.length);const k=u[0];if(k){const{expose:C,repeat:b,...E}=tt(this.blocks[k]),h={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...E,repeat:b,parent:this},g=b!=null?new oe.RepeatBlock(h):Fe(h);g&&(this._blocks.push(g),C&&(this.exposeBlock=g),this._maskedBlocks[k]||(this._maskedBlocks[k]=[]),this._maskedBlocks[k].push(this._blocks.length-1)),r+=k.length-1;continue}}let s=n[r],i=s in t;if(s===_e.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){a=!a;continue}if(s==="["||s==="]"){o=!o;continue}if(s===_e.ESCAPE_CHAR){if(++r,s=n[r],!s)break;i=!1}const c=i?new st({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...tt(t[s]),parent:this}):new sn({char:s,eager:this.eager,isUnmasking:a});this._blocks.push(c)}}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 ie;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 ie;if(!a)return o;for(let s=a.index,i;i=this._blocks[s];++s){var r;const c=i._appendChar(t,{...n,_beforeTailState:(r=n._beforeTailState)==null||(r=r._blocks)==null?void 0:r[s]});if(o.aggregate(c),c.consumed)break}return o}extractTail(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=new je;return t===n||this._forEachBlocksInRange(t,n,(o,r,s,i)=>{const c=o.extractTail(s,i);c.stop=this._findStopBefore(r),c.from=this._blockStartPos(r),c instanceof je&&(c.blockIndex=r),a.extend(c)}),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,c)=>{o+=r.extractInput(i,c,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 ie;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,c=r&&s?r.offset:this._blocks[o.index].displayValue.length;if(a(this._blocks[o.index],o.index,i,c),r&&!s){for(let d=o.index+1;d<r.index;++d)a(this._blocks[d],d,0,this._blocks[d].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=J.NONE),!this._blocks.length)return 0;const a=new dp(this,t);if(n===J.NONE)return a.pushRightBeforeInput()||(a.popState(),a.pushLeftBeforeInput())?a.pos:this.displayValue.length;if(n===J.LEFT||n===J.FORCE_LEFT){if(n===J.LEFT){if(a.pushRightBeforeFilled(),a.ok&&a.pos===t)return t;a.popState()}if(a.pushLeftBeforeInput(),a.pushLeftBeforeRequired(),a.pushLeftBeforeFilled(),n===J.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===J.FORCE_LEFT?0:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:0)}return n===J.RIGHT||n===J.FORCE_RIGHT?(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.pushRightBeforeFilled()?a.pos:n===J.FORCE_RIGHT?this.displayValue.length:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:this.nearestInputPos(t,J.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 ie;return this._forEachBlocksInRange(0,this.displayValue.length,a=>n.aggregate(a.pad(t))),n}}_e.DEFAULTS={...we.DEFAULTS,lazy:!0,placeholderChar:"_"},_e.STOP_CHAR="`",_e.ESCAPE_CHAR="\\",_e.InputDefinition=st,_e.FixedDefinition=sn,oe.MaskedPattern=_e;class it extends _e{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"),c=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<c.length&&c[d]===i[d];)++d;s.mask=c.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),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 ie;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}}oe.MaskedRange=it;const up="d{.}`m{.}`Y";class Te extends _e{static extractPatternOptions(t){const{mask:n,pattern:a,...o}=t;return{...o,mask:Re(n)?n:a}}constructor(t){super(Te.extractPatternOptions({...Te.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:n,pattern:a,blocks:o,...r}={...Te.DEFAULTS,...t},s=Object.assign({},Te.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:Re(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(Te.extractPatternOptions(t))}}Te.GET_DEFAULT_BLOCKS=()=>({d:{mask:it,from:1,to:31,maxLength:2},m:{mask:it,from:1,to:12,maxLength:2},Y:{mask:it,from:1900,to:9999}}),Te.DEFAULTS={..._e.DEFAULTS,mask:Date,pattern:up,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)}},oe.MaskedDate=Te;class ct extends we{constructor(t){super({...ct.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}=tt(n),r=Fe({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),c=this.currentMask,d=new ie,u=c?.state;return this.currentMask=this.doDispatch(t,{...n},a),this.currentMask&&(this.currentMask!==c?(this.currentMask.reset(),s&&(this.currentMask.append(s,{raw:!0}),d.tailShift=this.currentMask.value.length-o.length),i&&(d.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):u&&(this.currentMask.state=u)),d}_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 ie;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 ie;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 Ct(n,r)&&n.maskEquals(o)}):super.maskEquals(t)}typedValueEquals(t){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(t))}}ct.DEFAULTS={...we.DEFAULTS,dispatch:(l,t,n,a)=>{if(!t.compiledMasks.length)return;const o=t.rawInputValue,r=t.compiledMasks.map((s,i)=>{const c=t.currentMask===s,d=c?s.displayValue.length:s.nearestInputPos(s.displayValue.length,J.FORCE_LEFT);return s.rawInputValue!==o?(s.reset(),s.append(o,{raw:!0})):c||s.remove(d),s.append(l,t.currentMaskFlags(n)),s.appendTail(a),{index:i,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(d,s.nearestInputPos(s.displayValue.length,J.FORCE_LEFT)))}});return r.sort((s,i)=>i.weight-s.weight||i.totalInputPositions-s.totalInputPositions),t.compiledMasks[r[0].index]}},oe.MaskedDynamic=ct;class dt extends _e{constructor(t){super({...dt.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,J.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 c=o[0][i];i>=this.value.length||c===s.value||(s.reset(),s._appendChar(c,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 ie({skip:!this.isComplete})}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new Le("",t)}remove(t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),t===n)return new ie;const a=Math.min(super.nearestInputPos(0,J.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}}dt.DEFAULTS={..._e.DEFAULTS,matchValue:(l,t,n)=>l.indexOf(t,n)===n},oe.MaskedEnum=dt;class il extends we{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}oe.MaskedFunction=il;var cl;class Ve extends we{constructor(t){super({...Ve.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",a=(this.scale?"("+on(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+n+a),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(on).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(on(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),c=!1;if(i){let C;this.min!=null&&this.min<0&&this.number<this.min&&(C=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(C=this.max),C!=null&&(this.autofix?(this._value=this.format(C,this).replace(Ve.UNMASKED_RADIX,this.radix),c||(c=r===this._value&&!n.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let d;i?d=new ie({inserted:this._value.slice(r.length),rawInserted:c?"":t,skip:c}):(this._value=r,d=new ie),this._value=this._insertThousandsSeparators(this._value);const u=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,k=this._separatorsCountFromSlice(u);return d.tailShift+=(k-o)*this.thousandsSeparator.length,d}_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 ie({tailShift:(s-r)*this.thousandsSeparator.length})}nearestInputPos(t,n){if(!this.thousandsSeparator)return t;switch(n){case J.NONE:case J.LEFT:case J.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===J.FORCE_LEFT)return a}break}case J.RIGHT:case J.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===Ve.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,Ve.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(Ve.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)||Ve.EMPTY_VALUES.includes(t)&&Ve.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}cl=Ve,Ve.UNMASKED_RADIX=".",Ve.EMPTY_VALUES=[...we.EMPTY_VALUES,0],Ve.DEFAULTS={...we.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[cl.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})},oe.MaskedNumber=Ve;const Mt={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function cn(l,t,n){t===void 0&&(t=Mt.MASKED),n===void 0&&(n=Mt.MASKED);const a=Fe(l);return o=>a.runIsolated(r=>(r[t]=o,r[n]))}function dl(l,t,n,a){return cn(t,n,a)(l)}oe.PIPE_TYPE=Mt,oe.createPipe=cn,oe.pipe=dl;class ul extends _e{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}=tt(t);this._blockOpts=Object.assign({},this._blockOpts,s);const i=Fe(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(Fe(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,n){n===void 0&&(n={});const a=new ie;for(let c=(o=(r=this._mapPosToBlock(this.displayValue.length))==null?void 0:r.index)!=null?o:Math.max(this._blocks.length-1,0),d,u;d=(s=this._blocks[c])!=null?s:u=!u&&this._allocateBlock(c);++c){var o,r,s,i;const k=d._appendChar(t,{...n,_beforeTailState:(i=n._beforeTailState)==null||(i=i._blocks)==null?void 0:i[c]});if(k.skip&&u){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(a.aggregate(k),k.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 c=s;r<=c&&!this._blocks[c].unmaskedValue;--c,++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}}oe.RepeatBlock=ul;try{globalThis.IMask=oe}catch{}const dn=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:ie,ChunksTailDetails:je,DIRECTION:J,HTMLContenteditableMaskElement:rn,HTMLInputMaskElement:ol,HTMLMaskElement:rt,InputMask:rl,MaskElement:St,Masked:we,MaskedDate:Te,MaskedDynamic:ct,MaskedEnum:dt,MaskedFunction:il,MaskedNumber:Ve,MaskedPattern:_e,MaskedRange:it,MaskedRegExp:sl,PIPE_TYPE:Mt,PatternFixedDefinition:sn,PatternInputDefinition:st,RepeatBlock:ul,createMask:Fe,createPipe:cn,default:oe,forceDirection:nl,normalizeOpts:tt,pipe:dl},Symbol.toStringTag,{value:"Module"}));ce.ModalEdit=Un,ce.VForm=Oe,ce.VsInputAddress=In,ce.VsInputArray=Tn,ce.VsInputArraySelect=kt,ce.VsInputCheckbox=hn,ce.VsInputCodegen=$n,ce.VsInputColor=Fn,ce.VsInputContainer=vn,ce.VsInputDate=sp,ce.VsInputEmail=qt,ce.VsInputFile=xn,ce.VsInputFileList=wn,ce.VsInputKeyValue=Dn,ce.VsInputMask=Ht,ce.VsInputNumber=fn,ce.VsInputRadio=Kt,ce.VsInputRange=Ln,ce.VsInputRichtext=Vn,ce.VsInputSelect=Jt,ce.VsInputSlug=Mn,ce.VsInputStatic=Ut,ce.VsInputSwitcher=Pt,ce.VsInputTag=Nn,ce.VsInputTel=Gt,ce.VsInputText=Xe,ce.VsInputTextArray=An,ce.VsInputTextarea=En,ce.default=Oe,ce.inputs=zn,ce.vsInputDatatable=Cn,ce.vsInputMap=Sn,Object.defineProperties(ce,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(de,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@opengis/core"),require("lucide-vue-next")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core","lucide-vue-next"],e):(de=typeof globalThis<"u"?globalThis:de||self,e(de.FormBuilder={},de.Vue,de.OpenGISCore,de.lucide))})(this,(function(de,e,ge,bl){"use strict";const xn=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&&l.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(l.text),5)):e.createCommentVNode("",!0)]))],64))}}),wl={class:"w-full relative"},xl={key:0,class:"text-[14px] font-medium text-gray-900 mb-2 flex items-center gap-1"},_l={class:"opacity-100"},vl={key:0,class:"text-red-500 text-[14px]"},El={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Vl=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",wl,[a.value?(e.openBlock(),e.createElementBlock("div",xl,[e.createElementVNode("span",_l,e.toDisplayString(n.value),1),o.value?(e.openBlock(),e.createElementBlock("span",vl,"*")):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createBlock(xn,{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":l.item.disabled}})),l.error?(e.openBlock(),e.createElementBlock("span",El,e.toDisplayString(l.error),1)):e.createCommentVNode("",!0)]))}}),Bl={class:"w-full relative flex flex-row items-center gap-2"},Cl={key:0,class:"text-red-500 text-[14px]"},Sl={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Nl=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:d,label:p}=o.value;return!d||d<=0?0:Math.min(Math.max(p??0,0),d)/d}),s=e.computed(()=>t.item?.type==="html"||r.value<=0?!1:!!n.value),i=e.computed(()=>{if(!s.value)return{};const d=`${r.value*100}%`;return{flexBasis:d,maxWidth:d}}),c=e.computed(()=>{const{container:d,label:p}=o.value;if(!d||d<=0)return{};if(t.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!s.value)return{flexBasis:"100%",maxWidth:"100%"};const h=Math.max(d-Math.max(p??0,0),0)/d;if(!h)return{};const E=`${h*100}%`;return{flexBasis:E,maxWidth:E}});return(d,p)=>(e.openBlock(),e.createElementBlock("div",Bl,[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),l.item?.rules?.includes("required")&&n.value?(e.openBlock(),e.createElementBlock("span",Cl,"*")):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createBlock(xn,{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(c.value)},[e.renderSlot(d.$slots,"default",e.normalizeProps(e.guardReactiveProps(d.$attrs)))],4),l.error?(e.openBlock(),e.createElementBlock("span",Sl,e.toDisplayString(l.error),1)):e.createCommentVNode("",!0)]))}}),$l={class:"w-full relative"},Ml={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Dl=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",$l,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),l.error?(e.openBlock(),e.createElementBlock("span",Ml,e.toDisplayString(l.error),1)):e.createCommentVNode("",!0)]))}}),Al={class:"flex-1 min-w-0"},Fl={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},Ll={class:"truncate"},Il={key:0,class:"text-red-500 text-[14px]"},Tl=["innerHTML"],Ol={key:0,class:"mt-1 text-xs text-red-500"},zl={default:Vl,horizontal:Nl,inline:Dl,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,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":l.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(l.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",Al,[l.ua||l.label?(e.openBlock(),e.createElementBlock("p",Fl,[e.createElementVNode("span",Ll,e.toDisplayString(l.item[n.value]||l.ua||l.label),1),o.value?(e.openBlock(),e.createElementBlock("span",Il,"*")):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,Tl)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["w-full",["select","native-select"].includes(l.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",Ol,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0)],2))}})};function Se(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 Rl=["placeholder","disabled"],jl=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}=Se(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]=c=>a.value=c),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":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Rl)),[[e.vModelText,a.value]])}}),Pl=["placeholder","disabled","maxlength","minlength"],tt=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}=Se(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 c(){typeof a.value=="string"&&(a.value=a.value.trim())}return(d,p)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":p[0]||(p[0]=h=>a.value=h),placeholder:r.value,disabled:o.value,maxlength:s.value,minlength:i.value,onBlur:c,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[l.customClass,e.unref(n),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Pl)),[[e.vModelText,a.value]])}}),Ul=["placeholder","disabled","min","max"],_n=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}=Se(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:l.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:l.min,max:l.max},null,10,Ul)),[[e.vModelText,a.value]])}}),ae=(l,t)=>{const n=l.__vccOpts||l;for(const[a,o]of t)n[a]=o;return n},Hl={},ql={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 Kl(l,t){return e.openBlock(),e.createElementBlock("svg",ql,[...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 Gl=ae(Hl,[["render",Kl]]),Yl={class:"flex items-center gap-[4px]"},Wl=["value","id","disabled"],Zl=["for"],Jl={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},Xl=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",Yl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:l.value,"onUpdate:modelValue":i[0]||(i[0]=c=>o.value=c),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:l.id,disabled:r.value},null,10,Wl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:l.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",l.error?"border-red-600":""]])},[e.createVNode(Gl,{height:"12",width:"12"})],2),e.createElementVNode("span",Jl,[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.label),1)])])],10,Zl)]))}}),Ql=["name","value","disabled"],ea={class:"flex items-center gap-[6px] text-[14px]"},ta={key:0,class:"text-[16px]"},na=["src"],la=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,c)=>(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:l.id,value:l.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),disabled:l.disabled},null,8,Ql),[[e.vModelCheckbox,o.value]]),e.createElementVNode("span",ea,[l.icon||l.imgUrl?(e.openBlock(),e.createElementBlock("span",ta,[l.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(l.icon)},null,2)):e.createCommentVNode("",!0),l.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:1,src:l.imgUrl,width:"16",height:"16",alt:"icon"},null,8,na)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.label),1)])])],2))}}),aa={class:"flex items-center"},Yt=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 c=[...n.modelValue];i?c.includes(n.value)||c.push(n.value):c=c.filter(d=>d!==n.value),a("update:modelValue",c)}else a("update:modelValue",i)}}),s=e.ref(`vs-checkbox-${n.view||"default"}`);return(i,c)=>(e.openBlock(),e.createElementBlock("div",aa,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value==="vs-checkbox-buttons"?e.unref(la):e.unref(Xl)),{value:l.value,label:l.label,info:l.option?.info,disabled:l.disabled,modelValue:r.value,"onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),id:o,icon:l.icon,imgUrl:l.imgUrl,style:e.normalizeStyle(l.style),error:l.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),oa={},ra={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 sa(l,t){return e.openBlock(),e.createElementBlock("svg",ra,[...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 Wt=ae(oa,[["render",sa]]),ia={},ca={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 da(l,t){return e.openBlock(),e.createElementBlock("svg",ca,[...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 Bt=ae(ia,[["render",da]]),ua={},pa={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 ma(l,t){return e.openBlock(),e.createElementBlock("svg",pa,[...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 fa=ae(ua,[["render",ma]]),ha={key:0,class:"flex items-start gap-x-1"},ga={key:0,class:"text-red-500 text-[14px]"},ya=["title"],ka=["disabled"],Zt=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",ha,[e.createVNode(Yt,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),label:l.text,error:l.error||""},null,8,["modelValue","label","error"]),l.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",ga,"*")):e.createCommentVNode("",!0),l.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:l.i,onClick:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(fa),{class:"text-gray-500 w-[14px] h-[14px]"})],8,ya)):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-${l.style?.primaryColor||"blue"}-500`:"bg-stone-200",l.customClass]]),disabled:l.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,ka))}}),ba=["id","innerHTML"],Jt=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:l.name,class:e.normalizeClass(["text-gray-900",l.customClass]),innerHTML:l.html?l.html:l.text},null,10,ba))}}),wa=["placeholder","disabled","name"],Xt=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}=Se(t.style),a=e.useModel(l,"modelValue"),o=e.ref(null);let r=null;function s(i){const c={9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},d=new Set;let p=!1;for(let E=0;E<i.length;E+=1){const k=i[E];k==="{"?p=!0:k==="}"?p=!1:p&&d.add(k)}const h={};return Object.keys(c).forEach(E=>{d.has(E)||(h[E]=c[E])}),{mask:i,definitions:h,lazy:!1}}return e.onMounted(async()=>{if(o.value){const{default:i}=await Promise.resolve().then(()=>kn),c=s(t.mask||"");r=i(o.value,c),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,i=>{if(r){const c=s(i||"");r.updateOptions(c)}}),e.watch(a,i=>{r&&r.unmaskedValue!==i&&(r.value=i!=null?String(i):"")}),(i,c)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:l.placeholder,disabled:l.disabled,name:l.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,wa))}}),xa={class:"relative w-full bg-white rounded-lg"},_a=["placeholder","disabled"],Qt=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}=Se(t.style),a=e.useModel(l,"modelValue");return(o,r)=>(e.openBlock(),e.createElementBlock("div",xa,[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:l.placeholder,disabled:l.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":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,_a),[[e.vModelText,a.value]])]))}}),va={class:"relative w-full bg-white rounded-lg"},Ea=["value","placeholder","disabled"],en=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}=Se(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:c}=i.target;c=c.replace(/^\+/,""),a.value=c?`+${c}`:""},s=i=>{const c=i,{data:d,inputType:p}=c;p&&p.startsWith("delete")||d&&/\D/.test(d)&&c.preventDefault()};return e.watch(()=>a.value,i=>{i&&!i.startsWith("+")?a.value=`+${i.replace(/^\+/,"")}`:i||(a.value="")},{immediate:!0}),(i,c)=>(e.openBlock(),e.createElementBlock("div",va,[c[0]||(c[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)),c[1]||(c[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:l.placeholder,disabled:l.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":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Ea)]))}}),Va=["value","disabled"],Ba={class:"text-[13px] text-gray-700"},Ca=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,Va),[[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",Ba,e.toDisplayString(t.text),1)],2))}}),Sa=["value","disabled"],Na={class:"text-[13px] text-gray-700"},$a={"vs-input-radio-default":Ca,"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,Sa),[[e.vModelRadio,n.value]]),e.createElementVNode("span",Na,e.toDisplayString(t.text),1)],2))}})},tn=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(()=>$a[`vs-input-radio-${t.view}`]);return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([l.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.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))}}),Ma={key:1,class:"w-full flex flex-col gap-4"},Da={key:0,class:"text-sm font-medium text-muted-foreground my-2"},Aa="Без категорії",vn=ae(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=k=>k?.value||k?.id||k?.text||k,i=k=>k.text||String(k),c=k=>`lg:col-span-${k||12}`,d=e.computed(()=>[n.position==="vertical"?"flex flex-col":"",n.colSpan?"grid":"flex justify-start"]),p=k=>k==null||k===""?null:typeof k=="string"||typeof k=="number"?k:String(k),h=e.computed(()=>{if(!n.group)return[];const k=new Map;o.value.forEach(y=>{const w=y[n.group],b=p(w);k.has(b)||k.set(b,[]),k.get(b)?.push(y)});const v=[];n.values?.length&&n.values.forEach(y=>{const w=p(y);v.push(w)});const f=new Set,g=y=>{const w=k.get(y)||[];if(!w.length)return null;const b=y===null?"group-null":`group-${String(y)}`,S=y===null?Aa:String(y);return f.add(y),{key:b,label:S,options:w}},x=[];return v.forEach(y=>{const w=g(y);w&&x.push(w)}),k.forEach((y,w)=>{if(f.has(w))return;const b=g(w);b&&x.push(b)}),x}),E=async()=>{try{const k=await fetch(`/api/suggest/${n.data}`).then(v=>v.json());o.value=k?.data||k}catch(k){console.error(k)}};return e.watch(()=>n.modelValue,k=>{if(typeof k=="boolean"&&o.value.length===1){const v=s(o.value[0]);r[v]=k}else if(Array.isArray(k)){const v=new Set(k);o.value.forEach(f=>{if(!f.disabled){const g=s(f);r[g]=v.has(g)}})}},{immediate:!0}),e.watch(r,()=>{if(!o.value.length){a("update:modelValue",null);return}const k=Object.entries(r).filter(([,v])=>v).map(([v])=>v);a("update:modelValue",k.length===0?[]:k)},{deep:!0}),e.onMounted(()=>{if(n.data)E().then(()=>{if(typeof n.modelValue=="boolean"&&o.value.length===1){const k=s(o.value[0]);r[k]=n.modelValue}else if(Array.isArray(n.modelValue)){const k=new Set(n.modelValue);o.value.forEach(v=>{if(!v.disabled){const f=s(v);r[f]=k.has(f)}})}});else if(o.value=n.options,typeof n.modelValue=="boolean"&&o.value.length===1){const k=s(o.value[0]);r[k]=n.modelValue}else if(Array.isArray(n.modelValue)){const k=new Set(n.modelValue);o.value.forEach(v=>{if(!v.disabled){const f=s(v);r[f]=k.has(f)}})}}),(k,v)=>n.group?(e.openBlock(),e.createElementBlock("div",Ma,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,f=>(e.openBlock(),e.createElementBlock("div",{key:f.key,class:"flex flex-col gap-2"},[f.label?(e.openBlock(),e.createElementBlock("span",Da,e.toDisplayString(f.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.options,g=>(e.openBlock(),e.createBlock(Yt,{modelValue:r[s(g)],"onUpdate:modelValue":x=>r[s(g)]=x,value:s(g),class:e.normalizeClass(c(l.colSpan)),disabled:n.disabled||g.disabled,label:i(g),key:`${f.key}-${s(g)}`,icon:g?.icon,imgUrl:g?.imgUrl,option:g,view:l.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]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,f=>(e.openBlock(),e.createBlock(Yt,{modelValue:r[s(f)],"onUpdate:modelValue":g=>r[s(f)]=g,value:s(f),class:e.normalizeClass(c(l.colSpan)),disabled:n.disabled||f.disabled,label:i(f),key:s(f),icon:f?.icon,imgUrl:f?.imgUrl,option:f,view:l.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-cf0478ce"]]),Fa=["type","placeholder","disabled"],La=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(p){return p?n.mode==="datetime"?(p.includes("T")?p:null)||p+(p.includes(" ")?"":"T00:00"):p?.split(" ")[0]:null}const{inputClass:o}=Se(n.style),r=t,s=e.computed({get:()=>a(n.modelValue),set:p=>r("update:modelValue",p)}),i=e.computed(()=>n.mode==="datetime"?"datetime-local":n.mode),c=e.computed(()=>!!n.disabled),d=e.computed(()=>n.placeholder??"");return(p,h)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":h[0]||(h[0]=E=>s.value=E),placeholder:d.value,disabled:c.value,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[l.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Fa)),[[e.vModelDynamic,s.value]])}}),Ia=(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},En=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,c=a||`/file/upload/uploads?id=${o||""}&form=${r||""}&table=${s||""}`,d=Ia(c,i);return(await fetch(d,{method:"POST",body:n}).then(h=>h.json()))?.result}catch(n){return ge.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",n),null}},Ta=async l=>{try{return await fetch(`file/delete${l}`),!0}catch(t){return console.error(t),!1}},Vn=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)}},Oa={},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"};function Ra(l,t){return e.openBlock(),e.createElementBlock("svg",za,[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)])])}const Re=ae(Oa,[["render",Ra]]),ja={},Pa={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 Ua(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Pa,[...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 Ha=ae(ja,[["render",Ua]]),qa={},Ka={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 Ga(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Ka,[...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 Ya=ae(qa,[["render",Ga]]),Wa={},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"};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="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 Bn=ae(Wa,[["render",Ja]]),Xa={},Qa={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 eo(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Qa,[...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 to=ae(Xa,[["render",eo]]),no={},lo={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 ao(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",lo,[...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 oo=ae(no,[["render",ao]]),ro=l=>{if(!l)return"";const t=l?.split(".");return t[t.length-1]},so=l=>{const t=ro(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)?Ya:n.textsFormat.includes(t)?oo:n.documentsFormat.includes(t)?Ha:n.archivesFormat.includes(t)?to:Bn},io={},co={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 uo(l,t){return e.openBlock(),e.createElementBlock("svg",co,[...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 nt=ae(io,[["render",uo]]),po={},mo={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 fo(l,t){return e.openBlock(),e.createElementBlock("svg",mo,[...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 Cn=ae(po,[["render",fo]]),ho=["title"],go={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},nn=ae(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(so)(n.value)),{src:n.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:r[0]||(r[0]=s=>e.unref(Vn)(n.value))},null,8,["src"])),e.createElementVNode("div",go,[e.createElementVNode("button",{type:"button",onClick:r[1]||(r[1]=s=>{e.unref(Ta)(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(nt,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:r[2]||(r[2]=s=>e.unref(Vn)(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(Cn,{class:"w-4 h-4"})])])],8,ho))}}),[["__scopeId","data-v-b61a9d9a"]]),yo={class:"flex items-center gap-x-2"},ko=["accept","multiple","disabled"],bo={key:1,class:"flex items-center flex-wrap gap-2"},wo={key:1,class:"loader"},xo={key:1,class:"loader"},Sn=ae(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"),c=e.computed(()=>n.format?n.format.split(",").map(y=>y.trim().toLowerCase()).filter(Boolean):[]),d=y=>Array.isArray(a.value)&&a.value[y]||"",p=y=>{if(n.max_size&&y.size>n.max_size*1024*1024){const w=(y.size/1048576).toFixed(2);return ge.notify({type:"error",title:"Помилка!",message:`Файл "${y.name}" занадто великий. Максимальний розмір: ${n.max_size} МБ, розмір файлу: ${w} МБ`,position:"right-bottom"}),!1}return!0},h=y=>{if(!c.value.length)return!0;const w=`.${y.name.split(".").pop()?.toLowerCase()||""}`,b=c.value.includes(w);return b||ge.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${y.name}". Дозволені формати: ${c.value.join(", ")}`,position:"right-bottom"}),b},E=e.computed(()=>{const y={},w=[];if(!n.customParams?.length)return{params:y,missingSources:w};const b=i?.value??{};return n.customParams.forEach(S=>{if(!S)return;const[M,B]=S.split("="),T=M?.trim(),Z=B?.trim();if(!T||!Z)return;const J=b[Z];if(J==null||J===""){w.push(Z);return}y[T]=J}),{params:y,missingSources:w}}),k=()=>{const{params:y}=E.value;return{api:n.api,customParams:Object.keys(y).length?y:void 0}},v=()=>{const y=E.value.missingSources;if(!y.length)return!0;const w=y.join(", ");return ge.notify({type:"warning",title:"Заповніть поля",message:`Поля (${w}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},f=y=>{ge.notify({type:"error",title:"Помилка завантаження",message:y||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},g=()=>{n.disabled||s.value||v()&&r.value?.click()},x=async y=>{const{files:w}=y.target;if(!w||w.length===0)return;if(!v()){r.value&&(r.value.value="");return}const b=Array.from(w);if(n.max_size&&b.filter(B=>!p(B)).length>0){r.value&&(r.value.value="");return}if(b.filter(M=>!h(M)).length>0){r.value&&(r.value.value="");return}s.value=!0;try{if(n.multiple){const M=Array.from(w).map(async J=>await En(J,k())),B=await Promise.all(M),Z=B.filter(J=>J!==null).map(J=>J?.file_path).filter(Boolean);if(Z.length===0){f();return}Z.length<B.length&&f("Деякі файли не вдалося завантажити. Перевірте їх та спробуйте знову."),a.value=[...a.value||[],...Z],o("change",a.value)}else{const M=w[0],B=await En(M,k());if(!B?.file_path){f();return}a.value=B?.file_path,o("change",a.value||"")}}catch(M){const B=M?.message||void 0;f(B)}finally{s.value=!1,r.value&&(r.value.value="")}};return(y,w)=>(e.openBlock(),e.createElementBlock("div",yo,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:r,type:"file",accept:n.format,multiple:l.multiple,onChange:x,disabled:s.value||l.disabled},null,40,ko),!l.multiple&&a.value?(e.openBlock(),e.createBlock(nn,{key:0,item:a.value,"onUpdate:item":w[0]||(w[0]=b=>a.value=b),value:a.value,"onUpdate:value":w[1]||(w[1]=b=>a.value=b)},null,8,["item","value"])):l.multiple?(e.openBlock(),e.createElementBlock("div",bo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(b,S)=>(e.openBlock(),e.createBlock(nn,{multiple:l.multiple,key:S,value:a.value,"onUpdate:value":w[2]||(w[2]=M=>a.value=M),item:d(S)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:g,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",l.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",wo)):(e.openBlock(),e.createBlock(Re,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),l.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:g,class:e.normalizeClass([l.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",xo)):(e.openBlock(),e.createBlock(Re,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-05d41c5c"]]),_o={class:"vs-input-file2 flex flex-col gap-4"},vo={class:"flex items-center gap-x-2"},Eo=["accept","disabled"],Vo={key:0,class:"absolute inset-0 flex flex-col items-center justify-center gap-1 rounded-lg bg-white/90 text-xs font-medium text-slate-600"},Bo={key:0,class:"rounded-lg border border-[#CFD9E0] bg-white p-4 shadow-sm"},Co={class:"flex items-center justify-between text-sm"},So={class:"truncate pr-4"},No={class:"font-medium text-slate-800 truncate"},$o={class:"text-slate-500"},Mo={class:"text-slate-500 whitespace-nowrap"},Do={class:"mt-3 h-2 rounded-full bg-slate-100 overflow-hidden"},Ao={class:"mt-3 flex flex-wrap gap-2 text-sm"},Fo={key:0,class:"mt-2 text-sm text-rose-600"},Lo=e.defineComponent({__name:"vs-input-file2",props:e.mergeModels({format:{},max_size:{},api:{},chunkSize:{default:5*1024*1024},subdir:{default:""},customParams:{},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(null),o=e.ref(null),r=e.ref(""),s=e.ref(0),i=e.ref(!1),c=e.ref(""),d=e.ref(null),p=e.inject("values"),h=e.computed(()=>t.format?t.format.split(",").map(F=>F.trim().toLowerCase()).filter(Boolean):[]),E=e.computed(()=>!o.value||!o.value.size?0:Math.min(100,Math.round(s.value/o.value.size*100))),k=e.computed(()=>o.value?`${g(s.value)} / ${g(o.value.size)}`:""),v=e.computed(()=>t.disabled?"opacity-50 cursor-not-allowed":i.value?"cursor-default text-blue-500":"cursor-pointer hover:border-blue-500 hover:bg-blue-50 hover:text-blue-500"),f=()=>{t.disabled||i.value||b()&&a.value?.click()},g=F=>{if(!Number.isFinite(F))return"0 B";const R=["B","KB","MB","GB"];let G=0,O=F;for(;O>=1024&&G<R.length-1;)O/=1024,G+=1;return`${O.toFixed(G===0?0:1)} ${R[G]}`},x=F=>{if(!t.max_size)return!0;const R=t.max_size*1024*1024;return F.size>R?(ge.notify({type:"error",title:"Файл занадто великий",message:`Максимальний розмір ${t.max_size} МБ`,position:"right-bottom"}),!1):!0},y=F=>{if(!h.value.length)return!0;const R=`.${F.name.split(".").pop()?.toLowerCase()||""}`;return h.value.includes(R)?!0:(ge.notify({type:"error",title:"Непідтримуваний формат",message:`Дозволені формати: ${h.value.join(", ")}`,position:"right-bottom"}),!1)},w=e.computed(()=>{const F={},R=[];if(!t.customParams?.length)return{params:F,missing:R};const G=p?.value??{};return t.customParams.forEach(O=>{if(!O)return;const[A,W]=O.split("="),H=A?.trim(),pe=W?.trim();if(!H||!pe)return;const me=G[pe];me==null||me===""?R.push(pe):F[H]=me}),{params:F,missing:R}}),b=()=>w.value.missing.length?(ge.notify({type:"warning",title:"Заповніть поля",message:`Потрібні значення: ${w.value.missing.join(", ")}`,position:"right-bottom"}),!1):!0,S=F=>{const R=F.target,G=R.files?.[0];if(G){if(!b()){R.value="";return}if(!x(G)||!y(G)){R.value="";return}o.value=G,s.value=0,r.value="",c.value=""}},M=async()=>{if(!o.value){f();return}try{c.value="";const F={id:r.value||"",fileName:o.value.name,subdir:t.subdir,size:o.value.size,...w.value.params},R=await fetch("/api/file/upload2/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)});if(!R.ok)throw new Error("Не вдалося ініціалізувати завантаження");const G=await R.json();r.value=G.id||r.value,s.value=G.uploaded||0,await B()}catch(F){c.value=F?.message||"Помилка при старті завантаження"}},B=async()=>{if(!(!o.value||!r.value)){i.value=!0;try{for(;s.value<o.value.size;){const F=s.value,R=Math.min(F+t.chunkSize,o.value.size),G=o.value.slice(F,R);d.value=new AbortController;const O=await fetch(`/api/file/upload2/${r.value}`,{method:"PATCH",headers:{"Content-Range":`bytes ${F}-${R-1}/${o.value.size}`},body:G,signal:d.value.signal});if(!O.ok)throw new Error("Помилка завантаження частини");const A=await O.json().catch(()=>({}));if(A.uploaded!=null?s.value=Number(A.uploaded):s.value=R,A.finished||s.value>=o.value.size){i.value=!1,n.value=A.file_path||A.url||r.value,ge.notify({type:"success",title:"Файл завантажено",message:o.value.name,position:"right-bottom"}),I();return}}}catch(F){if(F?.name==="AbortError")return;c.value=F?.message||"Помилка при завантаженні",i.value=!1}finally{d.value=null,i.value=!1}}},T=()=>{i.value&&(d.value?.abort(),d.value=null,i.value=!1)},Z=async()=>{if(o.value){if(!r.value){await M();return}await B()}},J=()=>{d.value?.abort(),d.value=null,I()},I=()=>{const F=a.value;F&&(F.value=""),o.value=null,r.value="",s.value=0,c.value=""};return(F,R)=>(e.openBlock(),e.createElementBlock("div",_o,[e.createElementVNode("div",vo,[e.createElementVNode("input",{ref_key:"fileInput",ref:a,type:"file",class:"hidden",accept:t.format,disabled:i.value||t.disabled,onChange:S},null,40,Eo),n.value?(e.openBlock(),e.createBlock(nn,{key:0,item:n.value,"onUpdate:item":R[0]||(R[0]=G=>n.value=G),value:n.value,"onUpdate:value":R[1]||(R[1]=G=>n.value=G)},null,8,["item","value"])):(e.openBlock(),e.createElementBlock("div",{key:1,onClick:f,class:e.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",v.value])},[i.value?(e.openBlock(),e.createElementBlock("div",Vo,[R[2]||(R[2]=e.createElementVNode("div",{class:"loader"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(E.value)+"%",1)])):(e.openBlock(),e.createBlock(Re,{key:1,class:"w-6 h-6"}))],2))]),o.value&&!n.value?(e.openBlock(),e.createElementBlock("div",Bo,[e.createElementVNode("div",Co,[e.createElementVNode("div",So,[e.createElementVNode("div",No,e.toDisplayString(o.value.name),1),e.createElementVNode("div",$o,e.toDisplayString(g(o.value.size)),1)]),e.createElementVNode("div",Mo,e.toDisplayString(k.value),1)]),e.createElementVNode("div",Do,[e.createElementVNode("div",{class:"h-full rounded-full bg-blue-500 transition-all duration-300",style:e.normalizeStyle({width:`${E.value}%`})},null,4)]),e.createElementVNode("div",Ao,[!i.value&&s.value>0&&s.value<(o.value?.size||0)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:Z}," Resume ")):e.createCommentVNode("",!0),i.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:T}," Pause ")):e.createCommentVNode("",!0),!i.value&&s.value===0?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:M}," Upload ")):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"rounded border border-rose-200 px-3 py-1 text-rose-600",onClick:J}," Cancel ")]),c.value?(e.openBlock(),e.createElementBlock("p",Fo,e.toDisplayString(c.value),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),ln=ae(Lo,[["__scopeId","data-v-8f52f552"]]),Io={class:"max-w-[55vw]"},To={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},Oo={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},zo={class:"px-[5px]"},Ro={class:""},Ct=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",Io,[e.createElementVNode("p",To,e.toDisplayString(l.item?.uploaded_name),1),e.createElementVNode("p",Oo,[e.createElementVNode("span",null,e.toDisplayString(l.item?.username),1),e.withDirectives(e.createElementVNode("span",zo,"|",512),[[e.vShow,l.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",Ro,e.toDisplayString(a(l.item?.size)),1)])])],64))}}),jo={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},Po={key:0,class:"flex w-full gap-x-3 items-center"},Uo={key:1,class:"flex gap-x-3 w-full items-center"},Ho={key:2,class:"flex gap-x-3 w-full items-center"},qo=["href"],Ko={key:3,class:"flex gap-x-3 w-full items-center"},Go={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},Yo={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"},Wo={class:"inline-block"},Zo={class:"inline-block"},Jo=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(p){return["pdf","json"].includes(p.ext)}function r(p){return["ppt","pptx","doc","docx","xls","xlsx"].includes(p.ext)}function s(p){const h=document.createElement("a");h.setAttribute("download",p?.uploaded_name),h.href=p?.file_path,h.click()}async function i(){try{await fetch(`${n.prefix}/widget/file/${n.item.entity_id}/${n.item.file_id}`),a("update")}catch(p){console.error(p)}}function c(){a("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function d(p){(n.item.ext==="jpg"||n.item.ext==="png")&&a("openLightbox",{item:n.item,index:p})}return(p,h)=>(e.openBlock(),e.createElementBlock("div",jo,[l.item.ext==="jpg"||l.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",Po,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:h[0]||(h[0]=E=>d(l.index))},[e.createVNode(Ct,{item:l.item},null,8,["item"])])])):o(l.item)?(e.openBlock(),e.createElementBlock("div",Uo,[e.createVNode(Ct,{item:l.item},null,8,["item"])])):r(l.item)?(e.openBlock(),e.createElementBlock("div",Ho,[e.createElementVNode("a",{href:`/api/file-preview?id=${l.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(Ct,{item:l.item},null,8,["item"])],8,qo)])):(e.openBlock(),e.createElementBlock("div",Ko,[e.createVNode(Ct,{item:l.item},null,8,["item"])])),e.createElementVNode("div",Go,[e.createElementVNode("div",Yo,[e.createElementVNode("div",Wo,[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:h[1]||(h[1]=E=>s(l.item))},[e.createVNode(Cn,{height:"14",width:"14"})])]),h[3]||(h[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",Zo,[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:h[2]||(h[2]=E=>c())},[e.createVNode(nt,{height:"14",width:"14"})])])])])]))}}),Xo={},Qo={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 er(l,t){return e.openBlock(),e.createElementBlock("svg",Qo,[...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 tr=ae(Xo,[["render",er]]),nr={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},lr={class:"flex w-full mb-[12px] items-center gap-x-2"},ar={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},or={class1:"ml-auto"},rr={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"},sr={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},ir={class:"relative"},cr={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"},dr={key:0},Nn=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,c=e.ref(!1),d=e.ref({}),p=e.ref([]),h=e.ref(""),E=e.computed(()=>Array.isArray(p.value)?p.value.filter(w=>w.ext==="jpg"||w.ext==="png").map(w=>w?.file_path):[]),k=e.computed(()=>h.value===""?p.value:p.value.filter(w=>w?.uploaded_name?.includes(h.value))),v=w=>{const b=E.value.findIndex(S=>S===w.item.file_path);b!==-1&&(r.value=!0,s.value=b)},f=async()=>{try{const w=await fetch(`${n.prefix}/widget/file/${o.value}`).then(b=>b.json());p.value=w?.rows}catch(w){console.error(w)}},g=async w=>{await Promise.all(Array.from(w.target.files).map(async b=>{const S=new FormData;S.append("file",b);try{const M=`${n.prefix}/widget/file/${o.value}`,B=await fetch(M,{method:"POST",body:S});return B.ok?(i("update","file-list"),b):(ge.notify({type:B.status>=400&&B.status<500?"warning":"error",title:"Error",message:`Error code: ${B.status}`}),null)}catch(M){return ge.notify({type:"error",title:"Error",message:M.message||"Unknown error"}),console.error(M),null}})),await f()},x=w=>{const b={...w};return w.cancel||(b.cancel=()=>{c.value=!1}),w.updateListOnConfirm&&(b.confirm=async()=>{await w.confirm(),c.value=!1,f()}),b},y=w=>{d.value=x(w),c.value=!0};return e.watch(o,w=>{w&&f()}),e.onMounted(()=>{o.value&&f()}),(w,b)=>{const S=e.resolveComponent("Lightbox"),M=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",nr,[e.createElementVNode("div",lr,[e.createElementVNode("h2",ar," Файлів: "+e.toDisplayString(p.value?.length),1),e.createElementVNode("div",or,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:b[0]||(b[0]=B=>g(B))},null,32),e.createElementVNode("div",rr,[e.createVNode(tr,{height:"16",width:"16"})])])])]),p.value?.length>4?(e.openBlock(),e.createElementBlock("div",sr,[e.createElementVNode("div",null,[e.createElementVNode("div",ir,[b[8]||(b[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":b[1]||(b[1]=B=>h.value=B),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,h.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),p.value?.length?(e.openBlock(),e.createElementBlock("div",cr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,(B,T)=>(e.openBlock(),e.createBlock(Jo,{key:T,prefix:l.prefix,item:B,index:T,onUpdate:b[2]||(b[2]=Z=>w.$emit("update","file-list")),onOpenModal:b[3]||(b[3]=Z=>y(Z)),onOpenLightbox:b[4]||(b[4]=Z=>v(Z))},null,8,["prefix","item","index"]))),128)),k.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",dr,[...b[9]||(b[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])]))])):e.createCommentVNode("",!0),e.createVNode(S,{modelValue:r.value,"onUpdate:modelValue":b[5]||(b[5]=B=>r.value=B),startIndex:s.value,"onUpdate:index":b[6]||(b[6]=B=>s.value=B),images:E.value},null,8,["modelValue","startIndex","images"]),e.createVNode(M,e.mergeProps({modelValue:c.value,"onUpdate:modelValue":b[7]||(b[7]=B=>c.value=B),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),ur={class:"flex items-center justify-between"},pr={class:"text-[16px] text-gray-900 font-medium"},mr={class:"grid gap-3"},fr=ae(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",ur,[e.createElementVNode("p",pr,e.toDisplayString(l.title),1),e.createVNode(Zt,{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",mr,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-00f2f0fc"]]),hr={class:"text-[16px] text-gray-900 font-medium"},gr={class:"grid gap-3"},yr=ae(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(Wt),{class:e.normalizeClass(["h-4 w-4 duration-300",[n.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",hr,e.toDisplayString(l.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",gr,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-78778cb5"]]),kr={class:"flex items-center justify-between"},br={switcher:fr,accordion:yr,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",kr,[e.createElementVNode("p",null,e.toDisplayString(l.title),1)]),e.renderSlot(t.$slots,"default")]))}})},Fe={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},wr=(l,t)=>String(l)===String(t),xr=(l,t)=>String(l)!==String(t),_r=(l,t)=>l>t,vr=(l,t)=>l>=t,Er=(l,t)=>l<t,Vr=(l,t)=>l<=t,Br=(l,t)=>Array.isArray(t)&&t.length===2?l>=t[0]&&l<=t[1]:!1,Cr=(l,t)=>String(l).startsWith(String(t)),Sr=(l,t)=>String(l).endsWith(String(t)),Nr=(l,t)=>String(l).includes(String(t)),$r=(l,t)=>Array.isArray(t)?t.includes(l):!1,Mr=(l,t)=>Array.isArray(t)?!t.includes(l):!0,$n=(l,t)=>{if(!t)return!0;switch(t?.[1]){case Fe.Equal:return wr(l,t?.[2]);case Fe.Inequal:return xr(l,t?.[2]);case Fe.Higer:return _r(l,t?.[2]);case Fe.HigerOrEqual:return vr(l,t?.[2]);case Fe.Lower:return Er(l,t?.[2]);case Fe.LowerOrEqual:return Vr(l,t?.[2]);case Fe.Between:return Br(l,t?.[2]);case Fe.StartWith:return Cr(l,t?.[2]);case Fe.EndWith:return Sr(l,t?.[2]);case Fe.Contain:return Nr(l,t?.[2]);case Fe.In:return $r(l,t?.[2]);case Fe.NotIn:return Mr(l,t?.[2]);default:return!0}},Mn=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 c=i?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,p=t.name?n.value?.[t.name]?.[d]??n.value?.[d]:n.value?.[d];return $n(p,c)})),r=e.computed(()=>br[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 c={};return n.value={...n.value,[t.name]:c},c});return(i,c)=>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,d=>(e.openBlock(),e.createBlock(Gn,e.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:s.value[d.name],"onUpdate:modelValue":p=>s.value[d.name]=p,style:l.style,error:e.unref(a)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),Dr=["aria-expanded","data-focus"],Ar={class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full"},Fr={key:0,class:"flex flex-nowrap items-center gap-1 overflow-x-auto overflow-y-hidden min-w-0 flex-1 py-0.5"},Lr={class:"flex items-center gap-1 min-w-0"},Ir=["title"],Tr=["innerHTML"],Or=["onClick"],zr={class:"flex-1 min-w-[2px]"},Rr=["placeholder"],jr=["title"],Pr=["innerHTML"],Ur={key:3,class:"truncate flex-1 min-w-0"},Hr={key:2,class:"flex-1 min-w-[2px]"},qr=["placeholder"],Kr={class:"flex items-center shrink-0"},Gr=["disabled"],Yr=["disabled","title"],Wr=["aria-disabled","onClick"],Zr=["innerHTML"],Jr={key:1,class:"px-3 py-2 text-center text-gray-500"},Xr=["disabled"],an="w-[16px] h-[16px] flex items-center justify-center flex-shrink-0 text-current",on=ae(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},start:{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);Se(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),c=e.ref(null),d=e.ref(null),p=e.ref(null),h=e.ref(!1),E=e.ref(!1),k=e.ref(null),v=e.ref([]),f=e.ref(-1),g=e.ref([]),x=e.ref(""),y=e.ref(null),w=e.ref("bottom"),b=e.ref({}),S=e.ref([]),M=e.computed(()=>{if(!S.value.length)return[];const V=v.value,$=new Map(V.map(L=>[L.id?.toString(),L]));return S.value.map(L=>$.get(L?.toString())).filter(L=>!!L)}),B=e.computed(()=>n.placeholder||"Select..."),T=e.computed(()=>H(k.value));e.computed(()=>o.value?!S.value.length&&x.value==="":!T.value&&x.value==="");const Z=e.computed(()=>r.value?!1:o.value?S.value.length>0:!!s.value),J=V=>o.value?S.value.some($=>$?.toString()===V?.toString()):s.value?.toString()===V?.toString(),I=e.computed(()=>{let V=v.value??[];if(!n.data&&x.value.trim()!==""){const $=x.value.toLowerCase();V=V.filter(L=>{const ee=H(L).toLowerCase(),ke=L.text?.toLowerCase?.()||"";return ee.includes($)||ke.includes($)})}if(o.value&&S.value.length){const $=new Set(S.value.map(L=>L?.toString()));V=V.filter(L=>!$.has(L.id?.toString()))}return V}),F=e.inject("values"),R=e.inject("field-props"),G=/\{\{\s*([^}]+?)\s*\}\}/g,O=V=>(V?String(V):"").replace(/<[^>]*>/g,"").trim(),A=e.computed(()=>n.slot??n?.optionTemplate??""),W=V=>{if(!V)return"";const $=A.value;return $?$.replace(G,(L,ee)=>{const ke=ee.trim(),be=V[ke];return be!=null?String(be):""}):V.text??""},H=V=>{if(!V)return"";if(!A.value)return V.text??"";const L=W(V);return O(L)||V.text||""},pe=new Map,me=bl.icons,Ae=V=>V.replace(/^([A-Z])|[\s-_]+(\w)/g,($,L,ee)=>ee?ee.toUpperCase():L.toLowerCase()),Le=V=>{const $=Ae(V);return $?$.charAt(0).toUpperCase()+$.slice(1):""},q=V=>{if(!V)return;const $=Le(V);if(pe.has($))return pe.get($);const ee=[$,`${$}Icon`,`Lucide${$}`,`Lucide${$}Icon`].map(ke=>me[ke]).find(Boolean);return pe.set($,ee),ee},re=V=>V?typeof V.icon=="string"?q(V.icon)??null:V.icon??null:null,ue=V=>!!(V?.color&&!re(V)),fe=V=>V?.color?{color:V.color}:void 0,ye=V=>!!re(V),z=(V,$,L)=>{if(!R)return!1;const ee=R.value?.[V]??{},ke=(we,ve,u)=>{if(!ve.length)return we;const[m,..._]=ve,C={...we};if(!_.length)return C[m]=u,C;const U=typeof we[m]=="object"&&we[m]!==null?we[m]:{};return C[m]=ke(U,_,u),C},be=ke(ee,$,L);return R.value={...R.value||{},[V]:be},!0},le=V=>{if(!n.set)return;const $=F?.value;!$&&!R||Object.entries(n.set).forEach(([L,ee])=>{if(!L)return;const ke=V?V[ee]:null,be=L.split(".").map(u=>u.trim()).filter(Boolean);if(!be.length)return;const[we,...ve]=be;ve.length&&z(we,ve,ke??null)||$&&($[we]=ke??null)})},xe=e.computed(()=>n.parent?F?.value?.[n.parent]?.toString()??null:null),Me=async V=>{if(!n.data){let $=n.options??[];if(V?.trim()){const L=V.toLowerCase();$=$.filter(ee=>{const ke=H(ee).toLowerCase(),be=ee.text?.toLowerCase?.()||"";return ke.includes(L)||be.includes(L)})}return $}try{const $=n.host??"",L=n.prefix??"api",ee=n.api??`/${L}/suggest/${n.data}`,ke=`${$}${ee}`,be=new URLSearchParams;return be.set("json","1"),V&&be.set("key",V),xe.value!==void 0&&xe.value!==null&&xe.value!==""&&be.set("parent",xe.value),n.start===1&&be.set("start","1"),(await fetch(`${ke}?${be.toString()}`).then(ve=>ve.json()))?.data??[]}catch{return[]}},D=async()=>{n.data?v.value=await Me(x.value):v.value=n.options?[...n.options]:[]},j=async V=>{if(V==null||V==="")return null;const $=v.value?.find(L=>L?.id?.toString()===String(V));if($)return $;if(n.data)try{const L=n.host??"",ee=n.prefix??"api",ke=n.api??`/${ee}/suggest/${n.data}`,be=`${L}${ke}`,we=new URLSearchParams;return we.set("json","1"),we.set("val",String(V)),xe.value!==void 0&&xe.value!==null&&xe.value!==""&&we.set("parent",xe.value),n.start===1&&we.set("start","1"),((await fetch(`${be}?${we.toString()}`).then(m=>m.json()))?.data??[])?.[0]??null}catch{return null}return null},Y=async V=>{const $=new Set(v.value.map(ee=>ee.id?.toString())),L=V.filter(ee=>!$.has(ee?.toString()));L.length&&await L.reduce(async(ee,ke)=>{await ee;const be=await j(ke);be&&v.value.push(be)},Promise.resolve())},ne=()=>{if(!I.value.length){f.value=-1;return}let V=0;if(!o.value&&k.value){const $=k.value.id?.toString(),L=I.value.findIndex(ee=>ee.id?.toString()===$);L>=0&&(V=L)}f.value=V,e.nextTick(()=>{Ie(g.value[V],d.value)})},oe=async()=>{r.value||(h.value=!0,await D(),await e.nextTick(()=>{ot(),y.value?.focus()}),ne())},N=()=>{h.value=!1,f.value=-1,e.nextTick(()=>{y.value?.blur()})},P=async V=>{if(r.value)return;!h.value?await oe():N()},K=async()=>{if(!r.value){if(h.value){N();return}await oe()}},he=()=>{o.value?(S.value=[],s.value=[],a("change",[]),Ye(null,[])):(k.value=null,s.value=null,a("change",null),Ye(null,null)),le(null),x.value="",e.nextTick(()=>y.value?.focus())},Ne=V=>{o.value&&(S.value=S.value.filter($=>$?.toString()!==V?.toString()),s.value=[...S.value],a("change",s.value),Ye(null),e.nextTick(()=>y.value?.focus()))},Ye=(V,$)=>{const L=$??(o.value?[...S.value]:V?.id??null);a("value-selected",{name:n.name,value:L,option:V})},ze=V=>{o.value?(J(V.id)||(S.value=[...S.value,V.id],s.value=[...S.value],a("change",s.value),Ye(V)),x.value="",e.nextTick(()=>{y.value?.focus(),f.value=Math.min(f.value,I.value.length-1)}),le(null)):(k.value=V,s.value=V.id,a("change",s.value),Ye(V),x.value="",N(),le(V))},bn=V=>{if(J(V.id)){o.value||N();return}ze(V)},Ie=(V,$)=>{if(!V||!$)return;const L=V.offsetTop,ee=L+V.offsetHeight,ke=$.scrollTop,be=ke+$.clientHeight;let we=$.scrollTop;L<ke?we=L-80:ee>be&&(we=ee-$.clientHeight+4);const ve=$;ve.scrollTop=we},We=V=>{let $=V.parentElement;for(;$;){if($.classList.contains("ui-dialog__content"))return $;const L=window.getComputedStyle($),ee=L.overflow+L.overflowY+L.overflowX;if(ee.includes("auto")||ee.includes("scroll")||$===document.body||$===document.documentElement)return $;$=$.parentElement}return document.body},ot=()=>{if(!c.value)return;const V=c.value.getBoundingClientRect(),$=window.innerHeight||document.documentElement.clientHeight,L=window.innerWidth||document.documentElement.clientWidth,ee=8,ke=8,be=n.maxHeight||300,we=$-V.bottom-ke-ee,ve=V.top-ke-ee,u=we>=ve,m=Math.max(L-ee*2,0);let{width:_}=V;m>0&&_>m&&(_=m);let{left:C}=V;C+_+ee>L&&(C=L-_-ee),C=Math.max(C,ee);const U=Math.min(be,Math.max(u?we:ve,50));w.value=u?"bottom":"top",b.value={position:"fixed",left:`${C}px`,width:`${_}px`,maxHeight:`${U}px`,transform:u?"none":"translateY(-100%)",top:u?`${V.bottom+ke}px`:`${V.top-ke}px`}},qe=async V=>{r.value||!h.value&&(V.key==="ArrowDown"||V.key==="ArrowUp")&&(V.preventDefault(),await oe())},qt=V=>{if(!h.value)return;const{key:$}=V;if($==="ArrowDown")V.preventDefault(),f.value+1<I.value.length&&(f.value+=1,Ie(g.value[f.value],d.value));else if($==="ArrowUp")V.preventDefault(),f.value>0&&(f.value-=1,Ie(g.value[f.value],d.value));else if($==="Enter"){V.preventDefault();const L=I.value[f.value];L&&ze(L),y.value?.blur()}else $==="Escape"?(V.preventDefault(),N()):$==="Backspace"?o.value&&x.value===""&&S.value.length&&(S.value=S.value.slice(0,-1),s.value=[...S.value],a("change",s.value)):$==="Home"?(f.value=0,Ie(g.value[0],d.value)):$==="End"?(f.value=I.value.length-1,Ie(g.value[f.value],d.value)):$==="Tab"&&N()},rt=()=>{r.value||(E.value=!0)},kt=()=>{E.value=!1,x.value=""},bt=V=>{V.key==="Escape"&&h.value&&N()},wt=V=>{const $=V.target;i.value?.contains($)||p.value?.contains($)||N()},Kt=V=>{h.value&&d.value&&!d.value.contains(V.target)&&ot()},xt=()=>{h.value&&ot()},Gt=()=>{h.value&&ot()};e.watch(()=>n.options,V=>{V?.length&&(v.value=[...V],Ze())},{immediate:!0});async function Ze(){if(o.value)Array.isArray(s.value)?S.value=[...s.value]:(S.value=s.value==null?[]:[s.value],s.value=[...S.value]),n.data&&S.value.length&&(await Y(S.value),await e.nextTick());else{if(Array.isArray(s.value)){const V=s.value[0]??null;s.value=V??null}s.value!=null&&(k.value=await j(s.value)),le(k.value??null)}}e.watch(s,()=>{Ze()}),e.onMounted(async()=>{addEventListener("keydown",bt),addEventListener("scroll",Kt,!0),addEventListener("resize",xt),document.addEventListener("click",wt,!0),c.value&&We(c.value).addEventListener("scroll",Gt,!0),n.options?.length&&!n.data?v.value=[...n.options]:n.data&&(v.value=await Me("")),await Ze(),Je.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",bt),removeEventListener("scroll",Kt,!0),removeEventListener("resize",xt),document.removeEventListener("click",wt,!0),c.value&&We(c.value).removeEventListener("scroll",Gt,!0)});const et=e.ref(!1),st=e.ref({}),_t=e.ref([]),it=e.ref(null);async function vt(){if(!(!n.add?.token||it?.value.validate()))try{const $=n.add.api??`/api/table/${n.add.token}`,L=await fetch($,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(st.value)}),ee=await L.json().catch(()=>({})),ke=ee?.error||ee?.message,be=Number(ee?.code)>=400;if(!L.ok||be){ge.notify({title:"Помилка",type:"error",message:ke||`Код помилки: ${ee?.code||L.status}`});return}const we=ee?.id;if(!we){ge.notify({title:"Помилка",type:"error",message:"Обʼєкт створено, але в відповіді відсутній ID."});return}if(!n.options?.length&&n.data){const ve=await fetch(`${n.api??`/api/suggest/${n.data}`}?val=${we}`).then(u=>u.json());k.value=ve[0],v.value.push(ve[0]),s.value=we}et.value=!1,ge.notify({title:"Успіх",message:"Обʼєкт успішно створено."})}catch($){ge.notify({title:"Помилка",type:"error",message:$?.message||"Не вдалося створити обʼєкт."})}}async function ct(){if(!n.add)return null;const V=await fetch(`/api/template/form/${n.add.form}`).then($=>$.json());return _t.value=V.schema,et.value=!0,null}function Et(V,$=200){let L;return(...ee)=>{L&&clearTimeout(L),L=window.setTimeout(()=>V(...ee),$)}}const wn=Et(async V=>{v.value=await Me(V)},200);e.watch(x,V=>{n.data&&wn(V.trim())}),e.watch(()=>n.options,V=>{!n.data&&V?.length&&(v.value=[...V],Ze())},{immediate:!0}),e.watch(()=>n.parent??n.parentValue,()=>{n.data&&D()});const Je=e.ref(!0);return e.watch(xe,async()=>{if(n.data&&(Je.value||(o.value?(S.value=[],s.value=[],a("change",[])):(k.value=null,s.value=null,a("change",null))),await D(),n.auto===1&&xe.value&&v.value.length>0)){const V=v.value[0];V&&ze(V)}}),(V,$)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(ge.VsModal),{visible:et.value,"onUpdate:visible":$[1]||($[1]=L=>et.value=L),class:"z-[1000]",title:"Додати",buttonText:"Додати",onDone:vt,teleport:l.teleport},{default:e.withCtx(()=>[e.createVNode(He,{schema:_t.value,modelValue:st.value,"onUpdate:modelValue":$[0]||($[0]=L=>st.value=L),ref_key:"addForm",ref:it},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:$[5]||($[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass])},[$[10]||($[10]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),$[11]||($[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(["vs-input-select__control flex min-h-[38px] items-center justify-between rounded transition-colors bg-white",r.value?"bg-gray-100 text-gray-400 cursor-not-allowed":""]),role:"combobox","aria-expanded":h.value,"aria-haspopup":"listbox",onKeydown:qe,onClick:K,"data-focus":h.value||E.value?"true":"false",ref_key:"triggerRef",ref:c},[e.createElementVNode("div",Ar,[o.value?(e.openBlock(),e.createElementBlock("div",Fr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,L=>(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:L.id},[e.createElementVNode("div",Lr,[ue(L)?(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:L?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ye(L)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(an),style:e.normalizeStyle(fe(L)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(re(L)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"truncate text-[#172b4d] overflow-hidden max-w-[200px] px-0.5 pl-1.5",title:H(L)},[A.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:W(L)},null,8,Tr)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(L.text),1)],64))],8,Ir)]),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(ee=>Ne(L.id),["stop"])},[...$[6]||($[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,Or)]))),128)),e.createElementVNode("div",zr,[!r.value&&l.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:y,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900 hover:cursor-pointer",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:S.value.length?" ":B.value,"onUpdate:modelValue":$[2]||($[2]=L=>x.value=L),onFocus:rt,onBlur:kt,onKeydown:qt},null,40,Rr)),[[e.vModelText,x.value]]):e.createCommentVNode("",!0)])])):!o.value&&T.value&&x.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900 absolute flex items-center gap-1 min-w-0"]),title:T.value},[ue(k.value)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block flex-shrink-0",style:e.normalizeStyle({backgroundColor:k.value?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ye(k.value)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(an),style:e.normalizeStyle(fe(k.value)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(re(k.value)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),A.value?(e.openBlock(),e.createElementBlock("span",{key:2,class:"truncate flex-1 min-w-0",innerHTML:W(k.value)},null,8,Pr)):(e.openBlock(),e.createElementBlock("span",Ur,e.toDisplayString(k.value?.text),1))],8,jr)):e.createCommentVNode("",!0),o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Hr,[!r.value&&l.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:y,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900 hover:cursor-pointer",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:T.value?" ":B.value,"onUpdate:modelValue":$[3]||($[3]=L=>x.value=L),onFocus:rt,onBlur:kt,onKeydown:qt},null,40,qr)),[[e.vModelText,x.value]]):e.createCommentVNode("",!0)]))]),e.createElementVNode("div",Kr,[Z.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(he,["stop"])},[...$[7]||($[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,Gr)):e.createCommentVNode("",!0),$[9]||($[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:$[4]||($[4]=e.withModifiers(L=>P(),["stop"])),title:h.value?"Закрити список":"Відкрити список"},[...$[8]||($[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,Yr)])],42,Dr),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[h.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:p,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(b.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:b.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[I.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(I.value,(L,ee)=>(e.openBlock(),e.createElementBlock("div",{key:L.id,ref_for:!0,ref:ke=>g.value[ee]=ke,class:e.normalizeClass(["flex px-3 py-2 gap-2 cursor-pointer select-none text-gray-900",J(L.id)?"bg-[#2684ff] text-white":"bg-white hover:bg-[#deebff] hover:text-[#172b4d]",f.value===ee&&!J(L.id)?"bg-[#deebff] text-[#172b4d]":""]),"aria-disabled":J(L.id)?"true":"false",role:"option",tabindex:"-1",onClick:ke=>bn(L)},[ue(L)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block flex-shrink-0",style:e.normalizeStyle({backgroundColor:L?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ye(L)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(an),style:e.normalizeStyle(fe(L)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(re(L)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",f.value===L.id?"text-white":"",(f.value===ee,"")])},[A.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:W(L)},null,8,Zr)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(L.text),1)],64))],2)],10,Wr))),128)):(e.openBlock(),e.createElementBlock("div",Jr," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),n.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:ct,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(Re,{width:"16",height:"16"}),$[12]||($[12]=e.createElementVNode("span",null,"Додати",-1))],8,Xr)):e.createCommentVNode("",!0)],512)],64))}}),[["__scopeId","data-v-df831fc2"]]),Qr=["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}=Se(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,c)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":c[0]||(c[0]=d=>a.value=d),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,Qr)),[[e.vModelText,a.value]])}}),es={key:1,class:"richtext-error"},An=e.defineComponent({__name:"vs-input-richtext",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},richtextProps:{default:()=>({})}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=e.ref(null);e.onMounted(async()=>{try{const d=await import("@opengis/richtext");t.value=d.VsRichtext}catch{console.warn("@opengis/richtext is not installed. Please install it in your app to use richtext input.")}});const n=l,{inputClass:a}=Se(n.style),o=e.useModel(l,"modelValue"),r=e.computed(()=>!!n.disabled),s=e.computed(()=>n.placeholder??""),i=e.computed(()=>({height:"300px",...n.richtextProps}));return(c,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["richtext-wrapper !h-full !border-transparent",[l.customClass,e.unref(a),{"richtext-disabled":r.value}]]),style:e.normalizeStyle(r.value?{pointerEvents:"none",opacity:.6}:{})},[t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.mergeProps({key:0,modelValue:o.value,"onUpdate:modelValue":d[0]||(d[0]=p=>o.value=p),placeholder:s.value},i.value),null,16,["modelValue","placeholder"])):(e.openBlock(),e.createElementBlock("div",es,[...d[1]||(d[1]=[e.createElementVNode("p",null,"@opengis/richtext package is not installed.",-1),e.createElementVNode("p",null,"Please install it: npm install @opengis/richtext",-1)])]))],6))}}),ts={},ns={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 ls(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:"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 as=ae(ts,[["render",ls]]),os={},rs={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 ss(l,t){return e.openBlock(),e.createElementBlock("svg",rs,[...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 is=ae(os,[["render",ss]]),cs={},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"};function us(l,t){return e.openBlock(),e.createElementBlock("svg",ds,[...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 ps=ae(cs,[["render",us]]),ms={},fs={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 hs(l,t){return e.openBlock(),e.createElementBlock("svg",fs,[...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 St=ae(ms,[["render",hs]]),gs={},ys={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function ks(l,t){return e.openBlock(),e.createElementBlock("svg",ys,[...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 bs=ae(gs,[["render",ks]]),ws={},xs={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 _s(l,t){return e.openBlock(),e.createElementBlock("svg",xs,[...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 vs=ae(ws,[["render",_s]]),Es={class:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden flex flex-col"},Vs={class:"flex flex-col gap-2 !p-4 border-b border-gray-200 sm:flex-row sm:items-center sm:justify-between bg-gray-50"},Bs={class:"relative w-full"},Cs={class:"flex flex-nowrap items-center justify-end gap-2 w-full overflow-x-auto"},Ss={class:"w-full overflow-x-auto"},Ns={class:"w-full min-w-[640px] table-auto divide-y divide-gray-200"},$s={class:"bg-gray-50"},Ms={class:"border-b border-gray-200"},Ds={class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 w-12 text-center"},As=["onClick"],Fs={key:0,class:"text-gray-400"},Ls={key:0,colspan:"100%",class:"text-center"},Is={class:"w-full"},Ts={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},Os=["onDragstart","onDragover","onDrop"],zs={class:"px-4 py-3 text-center align-middle"},Rs={class:"flex items-center justify-center"},js=["innerHTML"],Ps={key:0,class:"flex items-center gap-3 text-sm text-gray-700"},Us={key:0},Hs=["src"],qs={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},Ks={key:1,class:"flex items-center justify-center"},Gs={key:2,class:"text-sm font-medium text-gray-900"},Ys={class:"px-4 py-3 text-right whitespace-nowrap"},Ws={class:"flex items-center justify-end gap-2"},Zs=["onClick"],Js=["onClick"],Xs={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},Fn=e.defineComponent({__name:"vs-input-datatable",props:e.mergeModels({actions:{},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.useSlots(),a=D=>t.actions===void 0?!0:t.actions.includes(D),o=e.useModel(l,"modelValue"),r=e.ref({}),s=e.ref(""),i=e.ref(null),c=e.ref("asc"),d=e.computed(()=>{const D=o.value??[],j=s.value?D.filter(oe=>p.value?.some(N=>{const P=N.key||N.name;if(!P)return!1;const K=oe[P];return K?Array.isArray(K)?K.join(", ").toLowerCase().includes(s.value.toLowerCase()):String(K).toLowerCase().includes(s.value.toLowerCase()):!1})):D;if(!i.value)return j;const Y=i.value,ne=[...j].sort((oe,N)=>{const P=Le(oe?.[Y]),K=Le(N?.[Y]);return typeof P=="number"&&typeof K=="number"?P-K:String(P).localeCompare(String(K))});return c.value==="asc"?ne:ne.reverse()}),p=e.computed(()=>(t.colModel??[]).filter(D=>!D.tableHidden)),h=e.ref(null),E=e.ref(null),k=e.ref(null),v=D=>{h.value=D},f=D=>{E.value=D},g=D=>{if(h.value===null||h.value===D){h.value=null,E.value=null;return}const j=[...o.value],[Y]=j.splice(h.value,1);j.splice(D,0,Y),o.value=j,h.value=null,E.value=null},x=()=>{k.value&&k.value.click()},y=D=>{const j=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],Y=D.toLowerCase();return j.some(ne=>Y.endsWith(ne))},w=D=>{const Y=D.target.files?.[0];if(!Y)return;const ne=new FileReader;ne.onload=oe=>{try{const N=oe.target?.result;if(typeof N=="string"){const P=JSON.parse(N);Array.isArray(P)&&o.value.push(...P)}}catch(N){console.error("Error parsing file:",N)}},ne.readAsText(Y)},b=()=>{const D=JSON.stringify(o.value,null,2),j=new Blob([D],{type:"application/json"}),Y=URL.createObjectURL(j),ne=document.createElement("a");ne.href=Y,ne.download="data.json",ne.click(),URL.revokeObjectURL(Y)},S=new Set(["autocomplete","select","radio","checkbox","combobox"]),M=new Map,B=(D,j)=>{const Y=`/api/suggest/${D}`,ne=Y.includes("?")?"&":"?",oe=j?`&val=${j}`:"";return`${Y}${ne}json=1${oe}`},T=D=>D==null||D===""?null:typeof D=="object"?D?.id!==void 0&&D.id!==null&&D.id!==""?D.id:null:D,Z=D=>{const j=new Set;return Array.isArray(o.value)&&o.value.forEach(Y=>{const ne=Y?.[D];if(ne==null||ne==="")return;if(Array.isArray(ne)){ne.forEach(N=>{const P=T(N);P!==null&&j.add(P)});return}const oe=T(ne);oe!==null&&j.add(oe)}),j},J=async()=>{if(!t.colModel?.length)return;const D=t.colModel.filter(j=>j.data&&S.has(j.type?.toLowerCase()||""));D.length&&await Promise.all(D.map(async j=>{const Y=j.key||j.name;if(!Y)return;const ne=Z(Y),oe=Array.from(ne).map(K=>String(K)).sort(),N=oe.join(",");if(!oe.length||M.get(Y)===N)return;M.set(Y,N);const P=oe.map(encodeURIComponent).join(",");try{const he=await(await fetch(B(j.data,P))).json();r.value[Y]=he?.data??he}catch(K){console.error("Failed to fetch column values",K)}}))};e.watch([()=>t.colModel,()=>o.value],()=>{J()},{immediate:!0,deep:!0});const I=e.ref(""),F=e.ref(!1);let R="edit",G=0;const O=D=>(D?.format||D?.type||"").toString().toLowerCase(),A=e.computed(()=>t.colModel?.filter(D=>O(D)!=="slot").map(D=>{const{slot:j,...Y}=D;return Y})??[]),W=e.ref({}),H=e.ref({}),pe=D=>typeof D!="string"?!1:!!n[D],me=(D,j)=>j?j.split(".").reduce((Y,ne)=>Y==null?Y:Y[ne.trim()],D):D,Ae=(D,j)=>typeof D!="string"?"":D.replace(/{{\s*([^}]+)\s*}}/g,(Y,ne)=>{const oe=me(j,ne.trim());return oe??""}),Le=D=>{if(D==null||D==="")return"";if(typeof D=="number")return D;if(typeof D=="boolean")return D?1:0;if(typeof D=="string")return D.toLowerCase();if(Array.isArray(D))return D.map(j=>Le(j)).join(", ");if(typeof D=="object"){if(D.text!==void 0)return String(D.text).toLowerCase();if(D.label!==void 0)return String(D.label).toLowerCase();if(D.id!==void 0)return String(D.id).toLowerCase()}return String(D).toLowerCase()},q=D=>{const j=D.key||D.name;if(j){if(i.value===j){c.value=c.value==="asc"?"desc":"asc";return}i.value=j,c.value="asc"}};async function re(){I.value="Додати",F.value=!0,R="add",W.value={}}function ue(D,j){if(!D?.length)return null;const Y=typeof j=="object"?j?.id:j;return Y==null||Y===""?null:D.find(ne=>ne?.id?.toString()===Y.toString())?.text??null}function fe(D){return D==null||D===""?"-":Array.isArray(D)?D.map(j=>typeof j=="object"?j?.text??j?.id??"-":j).join(", "):typeof D=="object"?D?.text??D?.id??"-":D}function ye(D,j){const Y=j.key||j.name,ne=D?.[Y],oe=r.value[Y];if(!ne)return"-";if(Array.isArray(ne)){const P=ne.map(K=>ue(oe,K)).filter(Boolean);return P.length?P.join(", "):fe(ne)}const N=ue(oe,ne);return N||fe(ne)}async function z(D,j){I.value="Редагувати",F.value=!0,R="edit",G=j,W.value={...D}}function le(){const D=H.value.validate();if(D){ge.notify({type:"warning",title:"Помилка валідації",message:Object.entries(D).map(([j,Y])=>`${j}: ${Y}`).join(`
|
|
2
|
+
`)});return}R==="add"?Array.isArray(o.value)?o.value=[...o.value,W.value]:o.value=[W.value]:o.value=o.value.map((j,Y)=>Y===G?W.value:j),F.value=!1}function xe(D){o.value=o.value.filter((j,Y)=>Y!==D)}function Me(){F.value=!1}return(D,j)=>(e.openBlock(),e.createElementBlock("div",Es,[e.createElementVNode("div",Vs,[e.createElementVNode("div",Bs,[e.createVNode(as,{width:"16",height:"16",class:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":j[0]||(j[0]=Y=>s.value=Y),placeholder:"Пошук",class:"w-full rounded-md border border-gray-200 bg-white pl-10 pr-3 py-2 text-sm text-gray-900 placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100"},null,512),[[e.vModelText,s.value]])]),e.createElementVNode("div",Cs,[a("import")?(e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"fileInput",ref:k,onChange:w,class:"hidden",accept:".json",type:"file"},null,544)):e.createCommentVNode("",!0),a("import")?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",onClick:x,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[e.createVNode(is,{class:"text-gray-700",width:"16",height:"16"}),j[4]||(j[4]=e.createTextVNode(" Імпорт ",-1))])):e.createCommentVNode("",!0),a("export")?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:b,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[e.createVNode(ps,{class:"text-gray-700",width:"16",height:"16"}),j[5]||(j[5]=e.createTextVNode(" Експорт ",-1))])):e.createCommentVNode("",!0),a("add")?(e.openBlock(),e.createElementBlock("button",{key:3,onClick:re,type:"button",class:"inline-flex items-center gap-2 rounded-md bg-blue-500 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-600 transition-colors"},[e.createVNode(Re,{class:"text-white"}),j[6]||(j[6]=e.createTextVNode(" Додати ",-1))])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Ss,[e.createElementVNode("table",Ns,[e.createElementVNode("thead",$s,[e.createElementVNode("tr",Ms,[e.createElementVNode("th",Ds,[e.createVNode(St,{width:"20",height:"20",class:"mx-auto text-gray-400"})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,Y=>(e.openBlock(),e.createElementBlock("th",{key:Y.key,class:"px-4 py-3 text-left text-xs font-semibold text-gray-900"},[e.createElementVNode("button",{type:"button",onClick:ne=>q(Y),class:"flex items-center gap-1 text-xs font-semibold text-gray-700 hover:text-gray-900 transition-colors"},[e.createElementVNode("span",null,e.toDisplayString(Y.ua||Y.label),1),i.value===(Y.key||Y.name)?(e.openBlock(),e.createElementBlock("span",Fs,e.toDisplayString(c.value==="asc"?"▲":"▼"),1)):e.createCommentVNode("",!0)],8,As)]))),128)),j[7]||(j[7]=e.createElementVNode("th",{class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 text-center w-[1%] whitespace-nowrap"}," Дії ",-1))])]),e.createElementVNode("tbody",{class:e.normalizeClass(["divide-y divide-gray-200",{"[&_tr:last-child]:border-0":!E.value}])},[d.value.length===0?(e.openBlock(),e.createElementBlock("td",Ls,[e.createElementVNode("div",Is,[e.createElementVNode("div",Ts,[e.createVNode(bs,{class:"w-48 mx-auto"}),j[8]||(j[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(d.value,(Y,ne)=>(e.openBlock(),e.createElementBlock("tr",{key:Y.id,class:e.normalizeClass(["border-b transition-colors hover:bg-gray-50 cursor-move text-sm text-gray-700",{"opacity-50":h.value===ne,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":E.value===ne}]),draggable:"true",onDragstart:oe=>v(ne),onDragover:e.withModifiers(oe=>f(ne),["prevent"]),onDrop:oe=>g(ne)},[e.createElementVNode("td",zs,[e.createElementVNode("div",Rs,[e.createVNode(St,{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(p.value,oe=>(e.openBlock(),e.createElementBlock("td",{key:oe.key,class:"px-4 py-3 align-middle"},[O(oe)==="slot"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[pe(oe.slot)?e.renderSlot(D.$slots,oe.slot,{key:0,row:Y,value:Y[oe.key],column:oe}):(e.openBlock(),e.createElementBlock("div",{key:1,class:"text-sm text-gray-900",innerHTML:Ae(oe.slot,Y)},null,8,js))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[O(oe)==="file"?(e.openBlock(),e.createElementBlock("div",Ps,[y(ye(Y,oe))?(e.openBlock(),e.createElementBlock("div",Us,[e.createElementVNode("img",{src:ye(Y,oe),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,Hs)])):(e.openBlock(),e.createElementBlock("div",qs,[e.createVNode(Bn,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):O(oe)==="color"?(e.openBlock(),e.createElementBlock("div",Ks,[e.createElementVNode("span",{class:"inline-flex h-6 w-6 rounded border border-gray-200",style:e.normalizeStyle({backgroundColor:ye(Y,oe)||"#ffffff"})},null,4)])):(e.openBlock(),e.createElementBlock("div",Gs,e.toDisplayString(ye(Y,oe)),1))],64))]))),128)),e.createElementVNode("td",Ys,[e.createElementVNode("div",Ws,[e.createElementVNode("button",{onClick:oe=>z(Y,ne),class:"p-1.5 text-gray-600 hover:text-blue-600 hover:bg-blue-50 rounded transition-colors"},[e.createVNode(vs,{width:"16",height:"16"})],8,Zs),e.createElementVNode("button",{onClick:oe=>xe(ne),class:"p-1.5 text-gray-600 hover:text-red-600 hover:bg-red-50 rounded transition-colors"},[e.createVNode(nt,{width:"16",height:"16"})],8,Js)])])],42,Os))),128))],2)])]),e.createVNode(e.unref(ge.VsModal),{visible:F.value,title:I.value,size:"lg",onClose:Me,teleport:"#modal"},{default:e.withCtx(()=>[e.createVNode(He,{schema:A.value,values:W.value,"onUpdate:values":j[1]||(j[1]=Y=>W.value=Y),form:H.value,"onUpdate:form":j[2]||(j[2]=Y=>H.value=Y)},null,8,["schema","values","form"]),e.createElementVNode("div",Xs,[e.createElementVNode("button",{type:"button",onClick:j[3]||(j[3]=Y=>F.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:le,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"])]))}}),Qs={},ei={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 ti(l,t){return e.openBlock(),e.createElementBlock("svg",ei,[...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 ni=ae(Qs,[["render",ti]]),li={},ai={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 oi(l,t){return e.openBlock(),e.createElementBlock("svg",ai,[...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 ri=ae(li,[["render",oi]]),si={},ii={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 ci(l,t){return e.openBlock(),e.createElementBlock("svg",ii,[...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 di=ae(si,[["render",ci]]),ui={},pi={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 mi(l,t){return e.openBlock(),e.createElementBlock("svg",pi,[...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 fi=ae(ui,[["render",mi]]),hi={},gi={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 yi(l,t){return e.openBlock(),e.createElementBlock("svg",gi,[...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 ki=ae(hi,[["render",yi]]),bi={class:"bg-white/30 p-1 rounded-md shadow w-fit"},wi={class:"flex gap-2"},xi=["onClick","title"],_i=["src"],vi=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(c){o("onLayerChange",c),a.value=c}const s={z:13,x:4790,y:2762};function i(c){if(c?.preview)return c.preview;if(!c?.url)return;const d={"{z}":s.z,"{x}":s.x,"{y}":s.y};let p=c.url;return Object.entries(d).forEach(([h,E])=>{p=p.replace(new RegExp(h,"gi"),String(E))}),p}return(c,d)=>(e.openBlock(),e.createElementBlock("div",bi,[e.createElementVNode("div",wi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.basemaps,(p,h)=>(e.openBlock(),e.createElementBlock("div",{key:h,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":a.value===h}]),onClick:E=>r(h),title:p.name||h,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:i(p),alt:"",class:"w-10 h-10 object-cover"},null,8,_i)],10,xi))),128))])]))}}),Ei={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},Vi={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"},Bi=["onClick"],Ci={class:"relative flex-1 min-w-[140px]"},Si=["placeholder"],Ni="https://data.softpro.ua/api-user/gis-url-proxy",$i="https://geo.rv.ua/api-user/dzk.api",Mi=ae(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 b=n.config?.tools?.filter(S=>o.includes(S));return b&&b.length?b:o}),s=e.computed(()=>n.config?.placeholder?.trim()||"Пошук…"),i=e.ref(r.value[0]??o[0]);e.watch(r,b=>{b.includes(i.value)||(i.value=b[0])});const c=e.ref(""),d=e.ref(!1),p=e.ref(null);e.watch(i,()=>{c.value="",d.value=!1});function h(b){i.value=b}function E(b){if(!d.value)return;const S=p.value;S&&!S.contains(b.target)&&(d.value=!1)}e.onMounted(()=>{window.addEventListener("click",E,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",E,!0)});function k(b){return b==="xy"?"Координати":b==="parcel"?"Кадастр":"Адреси"}function v(b){const S=b.replace(/[,]+/g," ").trim();if(!S)return null;const M=S.split(/\s+/).filter(Boolean);if(M.length<2)return null;const B=M.slice(0,2).map(Number);if(!B.every(G=>Number.isFinite(G)))return null;const[T,Z]=B;let J=T,I=Z;const F=G=>Math.abs(G)<=90,R=G=>Math.abs(G)<=180;if(!F(J)||!R(I))if(F(I)&&R(J))J=Z,I=T;else return null;return{lat:J,lng:I}}function f(b){return(b?.items||[]).map((M,B)=>({id:String(M?.id??B),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 g(b){const S=b?.result||b?.data||b;if(!S)return[];const M=S.geom_centroid;if(!M||!Array.isArray(M.coordinates))return[];const[B,T]=M.coordinates;return!Number.isFinite(T)||!Number.isFinite(B)?[]:[{id:"parcel",title:S.cadnum||S.cad_num||"Земельна ділянка",lat:T,lng:B}]}function x(b){const M=b.replace(/\s+/g,"").split(":");if(M.length!==4)return!1;const B=[10,2,3,4];return M.every((T,Z)=>T.length===B[Z]&&/^\d+$/.test(T))}function y(b){a("goToCoordinates",[b.lat,b.lng])}async function w(){const b=c.value.trim();if(b){if(i.value==="xy"){const S=v(b);if(!S){ge.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}y(S),c.value="";return}try{const S=new URL(i.value==="here"?Ni:$i);if(i.value==="here")S.searchParams.set("searchtext",b);else{if(!x(b)){ge.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}S.searchParams.set("cad_num",b)}const M=await fetch(S.toString());if(!M.ok)throw new Error(`HTTP ${M.status}`);const B=await M.json(),T=i.value==="here"?f(B):g(B);if(!T.length)ge.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const Z=T[0];y(Z),c.value=""}}catch(S){const M=S?.message||"Помилка пошуку";ge.notify({type:"error",title:"Пошук",message:M})}}}return(b,S)=>(e.openBlock(),e.createElementBlock("div",Ei,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(w,["prevent"])},[r.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:p,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:S[0]||(S[0]=M=>d.value=!d.value)},[e.createElementVNode("span",null,e.toDisplayString(k(i.value)),1),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":d.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[...S[2]||(S[2]=[e.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))]),d.value?(e.openBlock(),e.createElementBlock("div",Vi,[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:B=>h(M)},e.toDisplayString(k(M)),9,Bi))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",Ci,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":S[1]||(S[1]=M=>c.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,Si),[[e.vModelText,c.value,void 0,{trim:!0}]]),S[3]||(S[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-359172e4"]]),Di={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},Ai={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},Fi={class:"flex items-center gap-1"},Li=["disabled"],Ii=["disabled"],Ti=["disabled"],Oi={class:"absolute top-4 right-4 z-[1000]"},zi={class:"flex flex-col gap-[2px]"},Ri=["disabled"],ji=["disabled"],Pi=["disabled"],Ui=["disabled"],Hi={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"},qi={class:"space-y-0.5"},Ki={class:"text-gray-500"},Gi={class:"text-gray-900 text-right break-all"},Yi={class:"absolute left-4 bottom-[36px] z-[1000]"},Wi={class:"flex flex-col gap-2"},Zi={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]"},Ji={class:"flex flex-col gap-1"},Xi=["checked","disabled","onChange"],Qi={class:"text-gray-700 text-xs font-medium"},ec={class:"absolute bottom-0 left-0 right-0 z-[1000] min-h-[28px] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},tc={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full px-2 pb-1"},nc={class:"mr-auto flex items-center gap-2 min-w-0 relative"},lc={class:"shrink-0"},ac={class:"font-bold"},oc={class:"flex items-center"},rc={class:"text-xs mr-2"},sc={key:0,class:"text-xs mr-2"},ic={key:1,class:"text-xs mr-2"},cc=["disabled"],dc=["disabled"],Nt="__vs_form_maplibre_loader__",rn="__vs_form_maplibre_scripts__",$t="vs-global-bounds-src",Mt="vs-global-bounds-line",Ln=ae(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:{},center:{default:void 0},zoom:{default:void 0},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.computed(()=>!!n.disabled),r=e.ref(!1),s=e.ref(null),i=e.ref(0),c=e.ref(""),d=e.ref(null),p=e.getCurrentInstance(),h=p?.appContext?.config?.globalProperties?.$settings??{},E=h?.map??{},k=p?.vnode?.props??{};function v(u){return Object.prototype.hasOwnProperty.call(k,u)||Object.prototype.hasOwnProperty.call(k,u.replace(/[A-Z]/g,m=>`-${m.toLowerCase()}`))}const f=Array.isArray(E.center)&&E.center.length===2?E.center:Array.isArray(h.center)&&h.center.length===2?h.center:[30,50];console.log(E);const g=typeof E.zoom=="number"?E.zoom:typeof h.zoom=="number"?h.zoom:typeof h.defaultZoom=="number"?h.defaultZoom:10,x=e.computed(()=>v("center")?n.center:E.center??n.center),y=e.computed(()=>v("zoom")?n.zoom:E.zoom??n.zoom),w=e.computed(()=>v("katottg")?String(n.katottg??""):String(E.katottg??n.katottg??"")),b=e.computed(()=>v("layers")?n.layers??[]:E.layers??n.layers??[]),S=e.computed(()=>v("bounds")?n.bounds:E.bounds??n.bounds),M=e.ref(Array.isArray(x.value)&&x.value.length===2?[...x.value]:f),B=e.ref(typeof y.value=="number"?y.value:g),T=e.ref(n.modelValue),Z=e.ref(null),J=e.ref([]);let I=!1;const F=e.reactive({}),R=e.ref([]),G=e.computed(()=>R.value.map(u=>F[u]).filter(Boolean)),O=e.ref(null),A=e.computed(()=>O.value?.entries??[]),W=e.computed(()=>{if(O.value)return{left:`${O.value.point.x+12}px`,top:`${O.value.point.y+12}px`}}),H=e.computed(()=>{const u={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!n.tools?.length)return{...u,point:!0,line:!0,polygon:!0,rectangle:!0};const m=new Set(n.tools.map(_=>_.toLowerCase()));return{search:m.has("search"),import:m.has("import"),export:m.has("export"),point:m.has("point"),line:m.has("line"),polygon:m.has("polygon"),rectangle:m.has("rectangle")}});function pe(u){if(typeof u!="string"||!u.trim())return"";if(/^https?:\/\//i.test(u))return u;const m=window?.location?.origin??"",_=u.replace(/^\/+/,"");return _?m?`${m}/${_}`:`/${_}`:m}function me(){const u=Array.isArray(E.basemaps)&&E.basemaps.length?E.basemaps:h.basemaps;if(Array.isArray(u)&&u.length){const _=u.map((C,U)=>{const te=String(C?.key??C?.id??C?.name??`b${U}`),X=pe(String(C?.url??""));if(!X)return null;const ie=typeof C?.preview=="string"&&C.preview?pe(C.preview):"";return[te,{...C,url:X,preview:ie}]}).filter(C=>Array.isArray(C)&&C.length===2).reduce((C,[U,te])=>(C[U]=te,C),{});if(Object.keys(_).length)return _}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 Ae=me(),Le=Object.keys(Ae),q=e.ref(Le.length?Le[0]:"");async function re(){if(typeof window>"u")return null;const u=window;if(u[Nt])return u[Nt];u[rn]=u[rn]||{};const m=u[rn],_=X=>{if(Array.from(document.styleSheets).some($e=>$e?.href?.includes(X)))return;const _e=document.createElement("link");_e.rel="stylesheet",_e.href=X,document.head.appendChild(_e)},C=X=>(m[X]||(m[X]=new Promise((ie,_e)=>{const $e=Array.from(document.scripts).find(Te=>Te.src===X);if($e){$e.addEventListener("load",()=>ie(),{once:!0}),$e.addEventListener("error",_e,{once:!0}),X.includes("maplibre")&&window.maplibregl&&ie(),X.includes("mapbox-gl-draw")&&window.MapboxDraw&&ie();return}const Ce=document.createElement("script");Ce.src=X,Ce.async=!1,Ce.onload=()=>ie(),Ce.onerror=_e,document.head.appendChild(Ce)})),m[X]),te=(async()=>{_("https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css"),_("https://unpkg.com/@mapbox/mapbox-gl-draw@1.5.0/dist/mapbox-gl-draw.css"),window.maplibregl||await C("https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js"),window.MapboxDraw||await C("https://unpkg.com/@mapbox/mapbox-gl-draw@1.5.0/dist/mapbox-gl-draw.js");const X=window.maplibregl,ie=window.MapboxDraw;if(!X)throw new Error("maplibregl not available after load");if(!ie)throw new Error("MapboxDraw not available after load");return{maplibregl:X,MapboxDraw:ie}})().catch(X=>{throw delete u[Nt],X});return u[Nt]=te,te}function ue(u){return{version:8,sources:{rasterSource:{type:"raster",tiles:[u],tileSize:256}},layers:[{id:"rasterLayer",type:"raster",source:"rasterSource"}]}}let fe=null,ye=null,z=null,le=null,xe=null,Me=null,D=!1,j=!1;function Y(){return{onSetup(){const u=this.newFeature({type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[0,0],[0,0],[0,0],[0,0],[0,0]]]}});return this.addFeature(u),this.clearSelectedFeatures(),this.updateUIClasses({mouse:"add"}),this.setActionableState({trash:!0}),{rectangle:u,startPoint:null,hasCoordinates:!1}},onMouseMove(u,m){if(!u.startPoint)return;const[_,C]=u.startPoint,U=m.lngLat.lng,te=m.lngLat.lat;u.rectangle.setCoordinates([[[_,C],[U,C],[U,te],[_,te],[_,C]]])},onClick(u,m){if(!u.startPoint){u.startPoint=[m.lngLat.lng,m.lngLat.lat],u.hasCoordinates=!0,u.rectangle.setCoordinates([[[m.lngLat.lng,m.lngLat.lat],[m.lngLat.lng,m.lngLat.lat],[m.lngLat.lng,m.lngLat.lat],[m.lngLat.lng,m.lngLat.lat],[m.lngLat.lng,m.lngLat.lat]]]);return}const[_,C]=u.startPoint,U=m.lngLat.lng,te=m.lngLat.lat;return Math.abs(_-U)>0&&Math.abs(C-te)>0?(u.rectangle.setCoordinates([[[_,C],[U,C],[U,te],[_,te],[_,C]]]),this.map.fire("draw.create",{features:[u.rectangle.toGeoJSON()]}),this.changeMode("simple_select",{featureIds:[u.rectangle.id]})):(this.deleteFeature([u.rectangle.id],{silent:!0}),u.hasCoordinates=!1,this.changeMode("simple_select"))},onStop(){},onTrash(u){this.deleteFeature([u.rectangle.id],{silent:!0}),this.changeMode("simple_select")},toDisplayFeatures(u,m,_){if(!u.hasCoordinates)return;const C=m.properties.id===u.rectangle.id;m.properties.active=C?"true":"false",_(m)}}}const ne=[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","$type","Polygon"],["!=","active","true"]],paint:{"fill-color":"#3b82f6","fill-outline-color":"#3b82f6","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","$type","Polygon"],["==","active","true"]],paint:{"fill-color":"#2563eb","fill-outline-color":"#2563eb","fill-opacity":.2}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","$type","Polygon"],["!=","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3b82f6","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","$type","Polygon"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#2563eb","line-width":2}},{id:"gl-draw-lines-inactive",type:"line",filter:["all",["==","$type","LineString"],["!=","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3b82f6","line-width":2}},{id:"gl-draw-lines-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#2563eb","line-width":2}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["!=","active","true"]],paint:{"circle-radius":5,"circle-color":"#3b82f6"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":6,"circle-color":"#2563eb"}},{id:"gl-draw-polygon-and-line-vertex-halo-active",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-active",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#2563eb"}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","meta","midpoint"],["==","$type","Point"]],paint:{"circle-radius":4,"circle-color":"#1d4ed8"}}];function oe(){const u=q.value;return!u||!Ae[u]?.url?"":Ae[u].url}function N(u,m){return u?.id?String(u.id):u?.url?`${u.url}-${m}`:`layer-${m}`}function P(u){const m=String(u?.url??"").trim();if(!m)return"";if(/^https?:\/\//i.test(m))return m;const _=window.location?.origin??"",C=m.replace(/^\/+/,"");return`${_}/${C}`}function K(u){u&&O.value?.layerId!==u||(O.value=null)}function he(u,m={}){return u.popup===!1?[]:Array.isArray(u.popup)?u.popup.length?u.popup.map(_=>{const C=_?.field||_?.name;if(!C)return null;const U=m[C];return U==null||U===""?null:{key:_.label||C,value:String(U)}}).filter(Boolean):[]:Object.entries(m).slice(0,5).map(([_,C])=>({key:_,value:C==null?"—":String(C)}))}function Ne(u){if(!Array.isArray(u))return[];const m=C=>Array.isArray(C)&&C.length>=2&&Number.isFinite(Number(C[0]))&&Number.isFinite(Number(C[1])),_=C=>{if(!C.length)return C;const U=C[0],te=C[C.length-1];return!te||U[0]!==te[0]||U[1]!==te[1]?[...C,U]:C};if(u.length&&m(u[0])){const C=u.map(U=>[Number(U[0]),Number(U[1])]).filter(m);return C.length?[_(C)]:[]}return u.length&&Array.isArray(u[0])&&m(u[0][0])?u.map(U=>Array.isArray(U)?U.map(te=>[Number(te[0]),Number(te[1])]):[]).filter(U=>U.length).map(_):u.length&&Array.isArray(u[0])&&Array.isArray(u[0][0])&&m(u[0][0][0])?u.flatMap(U=>Array.isArray(U)?U:[]).map(U=>Array.isArray(U)?U.map(te=>[Number(te[0]),Number(te[1])]):[]).filter(U=>U.length).map(_):[]}function Ye(u){const m=u.style??{},_=m.color??"#3b82f6";if(!m.colorAttr||!m.colorSet)return _;const C=Object.keys(m.colorSet);if(!C.length)return _;const U=["match",["to-string",["get",m.colorAttr]]];return C.forEach(te=>{U.push(String(te),m.colorSet?.[te]??_)}),U.push(_),U}function ze(u){if(!z)return;u.handlers.forEach(_=>{try{z.off(_.type,_.layerId,_.handler)}catch{}}),u.handlers=[],[...u.layerIds,...u.boundsIds].forEach(_=>{z.getLayer(_)&&z.removeLayer(_)}),z.getSource(u.sourceId)&&z.removeSource(u.sourceId);const m=`vs-ov-bounds-src-${u.id}`;z.getSource(m)&&z.removeSource(m),K(u.id)}function bn(u,m){if(!z)return[];const _=`vs-ov-bounds-src-${m}`,C=`vs-ov-bounds-line-${m}`,U=u.bounds??S.value??J.value,te=Ne(U);if(!te.length)return[];const X={type:"FeatureCollection",features:te.map(ie=>({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:ie}}))};return z.getSource(_)&&z.removeSource(_),z.addSource(_,{type:"geojson",data:X}),z.addLayer({id:C,type:"line",source:_,paint:{"line-color":u.style?.stroke??u.style?.color??"#2563eb","line-width":u.style?.width??2,"line-opacity":u.style?.opacity??.8,"line-dasharray":[2,2]}}),[C]}function Ie(u){if(!z)return;ze(u);const m=u.config,_=P(m);if(!_)return;const C=[],U=[];if(/\.v(?:m)?t(?:\?|$)/i.test(_)||/\.pbf(?:\?|$)/i.test(_)){const ie=m.sourceLayer||m.layer||m.service_layer||m.dataset?.layer||m.id;z.addSource(u.sourceId,{type:"vector",tiles:[_]});const _e=String(m.style?.type??"polygon").toLowerCase(),$e=Ye(m),Ce=m.style?.opacity??.5;if(_e==="point"){const Te=`vs-ov-point-${u.id}`;z.addLayer({id:Te,type:"circle",source:u.sourceId,"source-layer":ie,paint:{"circle-color":$e,"circle-radius":5,"circle-opacity":Ce}}),C.push(Te)}else if(_e==="polyline"||_e==="line"){const Te=`vs-ov-line-${u.id}`;z.addLayer({id:Te,type:"line",source:u.sourceId,"source-layer":ie,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":$e,"line-width":m.style?.width??2,"line-opacity":Ce}}),C.push(Te)}else{const Te=`vs-ov-fill-${u.id}`,Vt=`vs-ov-border-${u.id}`;z.addLayer({id:Te,type:"fill",source:u.sourceId,"source-layer":ie,paint:{"fill-color":$e,"fill-opacity":Ce}}),z.addLayer({id:Vt,type:"line",source:u.sourceId,"source-layer":ie,paint:{"line-color":m.style?.stroke??m.style?.color??"#2563eb","line-width":m.style?.width??1,"line-opacity":Ce}}),C.push(Te,Vt)}}else{z.addSource(u.sourceId,{type:"raster",tiles:[_],tileSize:256});const ie=`vs-ov-raster-${u.id}`;z.addLayer({id:ie,type:"raster",source:u.sourceId,paint:{"raster-opacity":m.style?.opacity??1}}),C.push(ie)}C.forEach(ie=>{const _e=Ce=>{if(!Ce?.features?.length){K(u.id);return}const Te=Ce.features[0]?.properties??{},Vt=he(u.config,Te);if(!Vt.length){K(u.id);return}O.value={layerId:u.id,entries:Vt,point:{x:Ce.point.x,y:Ce.point.y}}},$e=()=>K(u.id);z.on("mousemove",ie,_e),z.on("mouseleave",ie,$e),U.push({layerId:ie,type:"mousemove",handler:_e},{layerId:ie,type:"mouseleave",handler:$e})}),u.layerIds=C,u.boundsIds=bn(u.config,u.id),u.handlers=U;const X=u.visible?"visible":"none";[...u.layerIds,...u.boundsIds].forEach(ie=>{z.getLayer(ie)&&z.setLayoutProperty(ie,"visibility",X)})}function We(){if(!z)return;const m={type:"FeatureCollection",features:Ne(S.value??J.value).map(_=>({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:_}}))};z.getSource($t)?z.getSource($t).setData(m):z.addSource($t,{type:"geojson",data:m}),z.getLayer(Mt)||z.addLayer({id:Mt,type:"line",source:$t,paint:{"line-color":"#2563eb","line-width":2,"line-opacity":.8,"line-dasharray":[2,2]}})}function ot(u){if(!z||o.value)return;const m=F[u];if(!m)return;m.visible=!m.visible;const _=m.visible?"visible":"none";[...m.layerIds,...m.boundsIds].forEach(C=>{z.getLayer(C)&&z.setLayoutProperty(C,"visibility",_)}),qe(),m.visible||K(u)}function qe(){if(!z)return;const u=[],m=[],_=[],C=[];R.value.forEach(X=>{const ie=F[X];if(!ie)return;const _e=String(ie.config?.url??""),$e=/\.v(?:m)?t(?:\?|$)/i.test(_e),Ce=/\.png(?:\?|$)/i.test(_e);$e?_.push(...ie.layerIds):Ce?u.push(...ie.layerIds):m.push(...ie.layerIds),C.push(...ie.boundsIds)}),[...u,...m,..._,...C].forEach(X=>{z.getLayer(X)&&z.moveLayer(X)}),z.getLayer(Mt)&&z.moveLayer(Mt),(z.getStyle?.()?.layers??[]).map(X=>String(X?.id??"")).filter(X=>X.startsWith("gl-draw-")).forEach(X=>{z.getLayer(X)&&z.moveLayer(X)})}function qt(u){if(!Ae[u]||(q.value=u,!z))return;const m=oe();if(!m)return;const _=z.getCenter?.(),C=z.getZoom?.(),U=le?.getAll?.();z.setStyle(ue(m)),z.once("style.load",()=>{if(z&&(_&&Number.isFinite(C)&&z.jumpTo({center:[_.lng,_.lat],zoom:C}),We(),R.value.forEach(te=>{const X=F[te];X&&Ie(X)}),qe(),U?.features?.length&&le))try{U.features.forEach(te=>le.add(te)),i.value=U.features.length}catch{i.value=0}})}function rt(u){return u?u.type==="FeatureCollection"?u.features?.[0]?.geometry??null:u.type==="Feature"?u.geometry??null:u.geom?.type&&Array.isArray(u.geom.coordinates)?{type:u.geom.type,coordinates:u.geom.coordinates}:typeof u.type=="string"&&Array.isArray(u.coordinates)?u:null:null}function kt(u){return{type:"Feature",properties:{},geometry:u}}function bt(u){if(!u)return null;try{return JSON.parse(JSON.stringify(u))}catch{return null}}function wt(u){if(!u)return"__null__";try{return JSON.stringify(u)}catch{return"__invalid__"}}function Kt(u){const m=st(u);if(!m)return null;const[[_,C],[U,te]]=m;return{lat:(C+te)/2,lng:(_+U)/2}}function xt(u){if(!Array.isArray(u)||u.length<3)return 0;const m=(C,U)=>{const te=C*2003750834e-2/180,X=Math.log(Math.tan((90+U)*Math.PI/360))/(Math.PI/180);return[te,X*2003750834e-2/180]};let _=0;for(let C=0;C<u.length-1;C+=1){const[U,te]=m(Number(u[C][0]),Number(u[C][1])),[X,ie]=m(Number(u[C+1][0]),Number(u[C+1][1]));_+=U*ie-X*te}return Math.abs(_/2)/1e6}function Gt(u){if(!u?.type||!u?.coordinates)return null;if(u.type==="Polygon"){const m=u.coordinates?.[0];return Array.isArray(m)?xt(m):null}return u.type==="MultiPolygon"?u.coordinates.reduce((m,_)=>{const C=_?.[0];return Array.isArray(C)?m+xt(C):m},0):null}function Ze(u){if(!u){d.value=null;return}const m=Kt(u);if(!m){d.value=null;return}d.value={type:String(u.type??"Feature"),center:m,areaKm2:Gt(u)}}function et(u,m){if(!Array.isArray(u)||!Array.isArray(m)||u.length!==2||m.length!==2)return!1;const _=1e-9;return Math.abs(Number(u[0])-Number(m[0]))<_&&Math.abs(Number(u[1])-Number(m[1]))<_}function st(u){if(!u)return null;let m=1/0,_=1/0,C=-1/0,U=-1/0;const te=X=>{if(Array.isArray(X)){if(X.length>=2&&Number.isFinite(X[0])&&Number.isFinite(X[1])){const ie=Number(X[0]),_e=Number(X[1]);m=Math.min(m,ie),_=Math.min(_,_e),C=Math.max(C,ie),U=Math.max(U,_e);return}X.forEach(te)}};return te(u.coordinates),!Number.isFinite(m)||!Number.isFinite(_)?null:[[m,_],[C,U]]}function _t(u){if(!z||!u)return;const m=st(u);if(!m)return;const[[_,C],[U,te]]=m;if(_===U&&C===te){z.easeTo({center:[_,C],zoom:Math.max(B.value,14)});return}z.fitBounds(m,{padding:30,duration:250,maxZoom:18})}function it(){if(!le){i.value=0;return}const u=le.getAll();i.value=u?.features?.length??0}function vt(){if(!le)return;const u=le.getAll();if(i.value=u?.features?.length??0,!u?.features?.length){xe=null,d.value=null,I||(Me="__null__",a("update:modelValue",null));return}const m=bt(u.features[u.features.length-1]?.geometry??null);xe=m,Ze(m),I||(Me=wt(m),a("update:modelValue",m))}function ct(){if(!le)return;(le.getAll()?.features||[]).forEach(m=>le.delete(m.id)),it()}function Et(u){if(!le)return;const m=rt(u);if(I=!0,ct(),m)try{le.add(kt(m))}catch{}I=!1,xe=bt(m),it(),Ze(m),m&&(_t(m),o.value||$())}function wn(){if(le){if(I=!0,ct(),xe)try{le.add(kt(xe))}catch{}I=!1,it(),Ze(xe)}}function Je(){if(le){try{le.changeMode("simple_select",{featureIds:[]})}catch{}c.value=""}}function V(u){if(o.value||!le)return;j=!0,Je(),c.value=u;const m=u==="marker"?"draw_point":u==="polyline"?"draw_line_string":u==="rectangle"?"draw_rectangle":"draw_polygon";I=!0,ct(),I=!1;try{le.changeMode(m)}catch{c.value=""}finally{requestAnimationFrame(()=>{j=!1})}}function $(){if(o.value||!le)return;const u=le.getAll();if(u?.features?.length)try{le.changeMode("direct_select",{featureId:u.features[0].id}),c.value="edit"}catch{c.value=""}}function L(){o.value||!le||(Je(),ct(),Me="__null__",d.value=null,a("update:modelValue",null))}function ee(){o.value||!xe||_t(xe)}function ke(u){z&&z.easeTo({center:[u[1],u[0]],zoom:13,duration:250})}function be(){o.value||Z.value?.click()}function we(u){if(o.value||!le)return;const m=u.target,_=m.files?.[0];if(!_)return;const C=new FileReader;C.onload=()=>{try{const U=JSON.parse(String(C.result)),te=rt(U);if(!te)return;Et(te)}finally{m.value=""}},C.readAsText(_)}function ve(){if(o.value||!le)return;const u=le.getAll(),m=new Blob([JSON.stringify(u,null,2)],{type:"application/json"}),_=URL.createObjectURL(m),C=document.createElement("a");C.href=_,C.download="data.geojson",C.click(),URL.revokeObjectURL(_)}return e.onMounted(async()=>{if(!s.value)return;const u=await re();fe=u.maplibregl,ye=u.MapboxDraw;const m=oe();m&&(z=new fe.Map({container:s.value,style:ue(m),center:[M.value[0],M.value[1]],zoom:B.value,attributionControl:!1}),z.addControl(new fe.NavigationControl({showCompass:!0}),"bottom-right"),z.on("load",()=>{if(!(!ye||!z)){if(le=new ye({displayControlsDefault:!1,modes:{...ye.modes,draw_rectangle:Y()},controls:{point:!1,line_string:!1,polygon:!1,trash:!1},styles:ne}),z.addControl(le),z.on("draw.create",()=>{if(!le)return;const _=le.getAll();if(_.features.length>1){const C=_.features[_.features.length-1];I=!0,_.features.slice(0,-1).forEach(U=>le.delete(U.id)),I=!1,C&&(I=!0,le.add(C),I=!1)}vt(),$()}),z.on("draw.update",_=>{if(!D){if(_?.action==="move"){if(D=!0,wn(),D=!1,c.value==="edit"){const C=le?.getAll?.()?.features?.[0];if(C?.id)try{le.changeMode("direct_select",{featureId:C.id})}catch{c.value=""}}return}vt()}}),z.on("draw.delete",()=>{c.value==="marker"||c.value==="polyline"||c.value==="polygon"||c.value==="rectangle"||(vt(),c.value="",Je())}),z.on("draw.selectionchange",()=>{if(!(!le||D)&&c.value!=="edit"&&!(c.value==="marker"||c.value==="polyline"||c.value==="polygon"||c.value==="rectangle")){if(!o.value&&i.value>0){$();return}try{le.changeMode("simple_select",{featureIds:[]})}catch{}}}),T.value!==void 0){const _=T.value;T.value=void 0,requestAnimationFrame(()=>{le&&Et(_)})}We(),R.value.forEach(_=>{const C=F[_];C&&Ie(C)}),qe()}}),z.on("zoomend",()=>{z&&(B.value=z.getZoom())}))}),e.onUnmounted(()=>{Object.values(F).forEach(u=>{z&&ze(u)}),K(),z?.remove&&z.remove(),z=null,le=null}),e.watch(()=>n.modelValue,u=>{if(!le){T.value=u;return}const m=rt(u),_=wt(m);if(Me&&_===Me){Me=null;return}Me=null,Et(u)},{deep:!0}),e.watch(()=>b.value,u=>{const m=Array.isArray(u)?u:[],_=[],C=new Set;m.forEach((U,te)=>{if(!U)return;const X=N(U,te);_.push(X),C.add(X);const ie={...U,id:X},_e=F[X],$e=_e?.visible??!!ie.visible;_e&&z&&ze(_e),F[X]={id:X,config:ie,visible:$e,sourceId:`vs-ov-src-${X}`,layerIds:[],boundsIds:[],handlers:[]}}),Object.keys(F).forEach(U=>{if(C.has(U))return;const te=F[U];te&&z&&ze(te),delete F[U]}),R.value=_,z&&(R.value.forEach(U=>{const te=F[U];te&&Ie(te)}),qe())},{immediate:!0,deep:!0}),e.watch(()=>S.value,()=>{z&&(We(),R.value.forEach(u=>{const m=F[u];m&&Ie(m)}),qe())},{deep:!0}),e.watch(()=>w.value,async u=>{if(J.value=[],!u){z&&(We(),R.value.forEach(m=>{const _=F[m];_&&Ie(_)}),qe());return}try{const m=await fetch(`https://data.gki.com.ua/api-user/atu/${u}`);if(!m?.ok)return;const C=(await m.json())?.geometry?.coordinates;Array.isArray(C)&&C.length&&(J.value=C)}catch(m){console.error("Failed to fetch KATOTTG bounds",m)}finally{if(!z)return;We(),R.value.forEach(m=>{const _=F[m];_&&Ie(_)}),qe()}},{immediate:!0}),e.watch(()=>x.value,u=>{if(!Array.isArray(u)||u.length!==2)return;const m=[Number(u[0]),Number(u[1])];if(et(M.value,m)||(M.value=[...m],!z))return;const _=z.getCenter?.();_&&et([_.lng,_.lat],M.value)||z.easeTo({center:[M.value[0],M.value[1]]})},{deep:!0}),e.watch(()=>y.value,u=>{typeof u=="number"&&(B.value=u,z&&z.setZoom(u))}),e.watch(o,u=>{u&&Je()}),e.watch(i,u=>{if(u>0){o.value||$();return}j||Je()}),e.watch(r,()=>{setTimeout(()=>{z?.resize&&z.resize()},50)}),(u,m)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",disabled:!r.value},[e.createElementVNode("div",{class:e.normalizeClass(["vs-map-wrapper relative w-full h-[400px]",{fullscreen:r.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:s,class:"w-full h-[calc(100%-28px)]"},null,512),H.value.search||H.value.import||H.value.export?(e.openBlock(),e.createElementBlock("div",Di,[H.value.search?(e.openBlock(),e.createBlock(Mi,{key:0,onGoToCoordinates:ke})):e.createCommentVNode("",!0),H.value.import||H.value.export?(e.openBlock(),e.createElementBlock("div",Ai,[e.createElementVNode("div",Fi,[H.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:be,disabled:o.value}," Import ",8,Li)):e.createCommentVNode("",!0),H.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:ve,disabled:o.value||i.value===0}," Export ",8,Ii)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:Z,type:"file",onChange:we,accept:".json,.geojson",class:"hidden",disabled:o.value},null,40,Ti)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",Oi,[e.createElementVNode("div",zi,[H.value.point?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":c.value==="marker"}]),title:"Point",onClick:m[0]||(m[0]=_=>V("marker")),disabled:o.value},[e.createVNode(ni)],10,Ri)):e.createCommentVNode("",!0),H.value.line?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":c.value==="polyline"}]),title:"Line",onClick:m[1]||(m[1]=_=>V("polyline")),disabled:o.value},[e.createVNode(ri)],10,ji)):e.createCommentVNode("",!0),H.value.polygon?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":c.value==="polygon"}]),title:"Polygon",onClick:m[2]||(m[2]=_=>V("polygon")),disabled:o.value},[e.createVNode(di)],10,Pi)):e.createCommentVNode("",!0),H.value.rectangle?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":c.value==="rectangle"}]),title:"Rectangle",onClick:m[3]||(m[3]=_=>V("rectangle")),disabled:o.value},[e.createVNode(fi)],10,Ui)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:m[4]||(m[4]=_=>r.value=!r.value),title:"Full Screen"},[e.createVNode(ki,{style:{width:"12px",height:"12px"}})])])]),A.value.length?(e.openBlock(),e.createElementBlock("div",{key:1,class:"absolute z-[1500] pointer-events-none",style:e.normalizeStyle(W.value)},[e.createElementVNode("div",Hi,[e.createElementVNode("dl",qi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(A.value,_=>(e.openBlock(),e.createElementBlock("div",{key:`${_.key}-${_.value}`,class:"flex justify-between gap-2"},[e.createElementVNode("dt",Ki,e.toDisplayString(_.key),1),e.createElementVNode("dd",Gi,e.toDisplayString(_.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",Yi,[e.createElementVNode("div",Wi,[e.createVNode(vi,{basemaps:e.unref(Ae),onOnLayerChange:qt},null,8,["basemaps"]),G.value.length?(e.openBlock(),e.createElementBlock("div",Zi,[m[5]||(m[5]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),e.createElementVNode("div",Ji,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(G.value,_=>(e.openBlock(),e.createElementBlock("label",{key:_.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:_.visible,disabled:o.value,onChange:C=>ot(_.id)},null,40,Xi),e.createElementVNode("span",Qi,e.toDisplayString(_.config.title||_.config.name||_.id),1)]))),128))])])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ec,[d.value?(e.openBlock(),e.createElementBlock("div",tc,[e.createElementVNode("div",nc,[e.createElementVNode("div",lc,[m[6]||(m[6]=e.createTextVNode(" Type: ",-1)),e.createElementVNode("span",ac,e.toDisplayString(d.value.type),1)])]),e.createElementVNode("div",oc,[e.createElementVNode("div",rc,[m[7]||(m[7]=e.createTextVNode(" Center: ",-1)),e.createElementVNode("b",null,e.toDisplayString(d.value.center.lat.toFixed(5))+", "+e.toDisplayString(d.value.center.lng.toFixed(5)),1)]),d.value.areaKm2!==null?(e.openBlock(),e.createElementBlock("div",sc,[m[8]||(m[8]=e.createTextVNode(" Area: ",-1)),e.createElementVNode("b",null,e.toDisplayString(d.value.areaKm2.toFixed(1))+" km²",1)])):(e.openBlock(),e.createElementBlock("div",ic,[...m[9]||(m[9]=[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:ee,disabled:o.value},[...m[10]||(m[10]=[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,cc),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:L,disabled:o.value},[e.createVNode(nt,{class:"w-3 h-3"})],8,dc)])])):e.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-e66e6e67"]]),uc=["data-focus"],pc={class:"flex items-center"},mc={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},fc=["onClick","aria-label"],hc={key:0,class:"absolute text-gray-500 truncate pl-2"},gc={class:"flex-1 min-w-[2px]"},yc=["placeholder"],kc={class:"flex items-center shrink-0"},bc=["disabled"],In=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;Se(n.style);const o=e.ref(null),r=e.ref(null),s=e.ref(null),i=e.ref(!1),c=e.ref(""),d=e.useModel(l,"modelValue"),p=e.computed(()=>n.placeholder||"Add tag…"),h=e.computed(()=>d.value?.length===0&&c.value===""),E=e.computed(()=>!n.disabled&&d.value?.length>0),k=e.computed(()=>n.disabled),v=async()=>{k.value||await e.nextTick(()=>s.value?.focus())},f=M=>{const B=M.trim();B!==""&&(!d.value||!Array.isArray(d.value)?d.value=[B]:n.unique?d.value.includes(B)||(d.value=[...d.value,B]):d.value=[...d.value,B],c.value="")},g=()=>{const M=c.value;M.trim()!==""&&f(M),c.value=""},x=M=>{const B=d.value.slice();B.splice(M,1),a("update:modelValue",B)},y=()=>{a("update:modelValue",[])},w=()=>{k.value||(i.value=!0)},b=()=>{i.value=!1,!k.value&&g()},S=M=>{const{key:B}=M;B==="Enter"?(M.preventDefault(),g()):B==="Backspace"&&c.value===""&&d.value.length>0&&x(d.value.length-1)};return(M,B)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:B[1]||(B[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":"",k.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:v},[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(d.value,(T,Z)=>(e.openBlock(),e.createElementBlock("div",{key:Z,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",pc,[e.createElementVNode("div",mc,e.toDisplayString(T),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(J=>x(Z),["stop"]),"aria-label":`Remove ${T}`},[...B[2]||(B[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,fc)]))),128)),h.value?(e.openBlock(),e.createElementBlock("div",hc,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",gc,[k.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":B[0]||(B[0]=T=>c.value=T),onFocus:w,onBlur:b,onKeydown:S,placeholder:d.value&&d.value.length?"":void 0},null,40,yc)),[[e.vModelText,c.value]])])],512),e.createElementVNode("div",kc,[E.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:k.value,onClick:e.withModifiers(y,["stop"])},[...B[3]||(B[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,bc)):e.createCommentVNode("",!0)])],10,uc)],2)],512))}}),wc={class:"relative flex gap-1 bg-white w-full"},xc=["disabled","placeholder"],Tn=ae(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(c=>i[c]||c).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",wc,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:l.disabled,placeholder:l.placeholder,"onUpdate:modelValue":i[0]||(i[0]=c=>a.value=c),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,xc),[[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-cb7b2b74"]]),_c={class:"relative flex gap-1 bg-white w-full"},vc=["disabled","placeholder"],Ec=["disabled"],Vc={key:0},Bc={key:1},On=ae(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 d=encodeURIComponent(String(t.table)),p=encodeURIComponent(String(t.code));return`/api/code-gen/${d}/${p}`},i=async()=>{if(!r.value||a.value)return;const d=s();if(d){a.value=!0;try{const h=await(await fetch(d)).text();n.value=h}finally{a.value=!1}}},c=()=>{o.value&&(n.value||i())};return e.onMounted(()=>{c()}),e.watch(()=>[t.table,t.code,t.init],()=>{c()}),(d,p)=>(e.openBlock(),e.createElementBlock("div",_c,[e.withDirectives(e.createElementVNode("input",{disabled:l.disabled,placeholder:l.placeholder,"onUpdate:modelValue":p[0]||(p[0]=h=>n.value=h),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,vc),[[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||l.disabled||!r.value,onClick:i},[a.value?(e.openBlock(),e.createElementBlock("span",Bc,"...")):(e.openBlock(),e.createElementBlock("span",Vc,"Gen"))],8,Ec)]))}}),[["__scopeId","data-v-8f88fb66"]]),Cc={class:"w-full"},Sc={ref:"sortableContainer",class:"flex flex-col gap-1"},Nc=["onDragstart","onDrop"],$c={class:"w-1/3"},Mc={class:"w-2/3"},Dc=["onClick"],Ac={key:0,class:"text-[14px] text-gray-700"},Fc={class:"mt-2 w-full flex items-center"},Lc=["disabled"],zn=ae(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=g=>`${g}-${Math.random().toString(36).substring(2,15)}`,a=e.inject("values"),o=l,r=t,s=o.addButtonText??"Додати",i=o.ignore??[],c=e.ref([]),d=e.ref(null);(()=>{const g=o.parent&&a?.value?.[o.parent]||o.modelValue||{};c.value=Object.entries(g).filter(([x])=>!i.includes(x)).map(([x,y])=>({id:n("key-value-"),key:x,value:y}))})();function h(g){d.value=g}function E(g){if(d.value===null||d.value===g)return;const x=c.value.splice(d.value,1)[0];c.value.splice(g,0,x),d.value=null}const k=e.computed(()=>c.value.some(g=>g.key&&!g.value||!g.key&&g.value)),v=()=>{c.value.push({id:n("key-value-"),key:"",value:""})},f=g=>{c.value=c.value.filter(x=>x.id!==g)};return e.watch(c,g=>{const x={};g.forEach(w=>{w.key&&w.value!==void 0&&(x[w.key]=w.value)});const y={};i.length&&i.forEach(w=>{y[w]=o.parent?a?.value?.[o.parent]?.[w]:void 0}),a?.value&&o.parent&&(a.value[o.parent]={...y,...x}),r("update:modelValue",x)},{deep:!0}),(g,x)=>(e.openBlock(),e.createElementBlock("div",Cc,[e.createElementVNode("div",Sc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(y,w)=>(e.openBlock(),e.createElementBlock("div",{key:y.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===w}]),draggable:"true",onDragstart:b=>h(w),onDragover:x[0]||(x[0]=e.withModifiers(()=>{},["prevent"])),onDrop:b=>E(w)},[x[1]||(x[1]=e.createStaticVNode('<button class="cursor-move" data-v-2ae5f16f><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-2ae5f16f><circle cx="15" cy="12" r="1.5" data-v-2ae5f16f></circle><circle cx="15" cy="24" r="1.5" data-v-2ae5f16f></circle><circle cx="21" cy="12" r="1.5" data-v-2ae5f16f></circle><circle cx="21" cy="24" r="1.5" data-v-2ae5f16f></circle><circle cx="21" cy="18" r="1.5" data-v-2ae5f16f></circle><circle cx="15" cy="18" r="1.5" data-v-2ae5f16f></circle></svg></button>',1)),e.createElementVNode("div",$c,[e.createVNode(tt,{modelValue:y.key,"onUpdate:modelValue":b=>y.key=b,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Mc,[e.createVNode(tt,{modelValue:y.value,"onUpdate:modelValue":b=>y.value=b,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:b=>f(y.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(Bt),{height:"16",width:"16"})],8,Dc)],42,Nc))),128))],512),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Ac," Дані для відображення відсутні ")),e.createElementVNode("div",Fc,[e.createElementVNode("button",{type:"button",onClick:v,disabled:k.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(Re,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(s)),1)],8,Lc)])]))}}),[["__scopeId","data-v-2ae5f16f"]]),Ic={class:"w-full"},Tc={ref:"sortableContainer",class:"flex flex-col gap-1"},Oc=["onDragstart","onDrop"],zc=["disabled"],Rc={class:"flex-1"},jc=["onClick","disabled"],Pc={key:0,class:"text-[14px] text-gray-700"},Uc={class:"mt-2 w-full flex items-center"},Hc=["disabled"],Rn=ae(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 c=!1;const d=g=>`${g}-${Math.random().toString(36).substring(2,15)}`,p=g=>{const x=g??n.value??[];a.value=x.map((y,w)=>({id:a.value[w]?.id??d("text-array"),value:y??""}))};p(),e.watch(()=>n.value,g=>{if(c){c=!1;return}p(g||[])},{deep:!0}),e.watch(a,g=>{c=!0,n.value=g.map(x=>x.value).filter(x=>x!=null&&x!=="")},{deep:!0});const h=e.computed(()=>r.value||a.value.some(g=>!g.value));function E(){h.value||(a.value=[...a.value,{id:d("text-array"),value:""}])}function k(g){r.value||(a.value=a.value.filter(x=>x.id!==g))}function v(g){r.value||(o.value=g)}function f(g){if(r.value||o.value===null||o.value===g)return;const x=[...a.value],[y]=x.splice(o.value,1);x.splice(g,0,y),a.value=x,o.value=null}return(g,x)=>(e.openBlock(),e.createElementBlock("div",Ic,[e.createElementVNode("div",Tc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(y,w)=>(e.openBlock(),e.createElementBlock("div",{key:y.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":o.value===w}]),draggable:"true",onDragstart:b=>v(w),onDragover:x[0]||(x[0]=e.withModifiers(()=>{},["prevent"])),onDrop:b=>f(w)},[e.createElementVNode("button",{class:"cursor-move",type:"button",disabled:r.value},[...x[1]||(x[1]=[e.createStaticVNode('<svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-77ce3498><circle cx="15" cy="12" r="1.5" data-v-77ce3498></circle><circle cx="15" cy="24" r="1.5" data-v-77ce3498></circle><circle cx="21" cy="12" r="1.5" data-v-77ce3498></circle><circle cx="21" cy="24" r="1.5" data-v-77ce3498></circle><circle cx="21" cy="18" r="1.5" data-v-77ce3498></circle><circle cx="15" cy="18" r="1.5" data-v-77ce3498></circle></svg>',1)])],8,zc),e.createElementVNode("div",Rc,[l.inputType==="text"?(e.openBlock(),e.createBlock(tt,{key:0,modelValue:y.value,"onUpdate:modelValue":b=>y.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),l.inputType==="tel"?(e.openBlock(),e.createBlock(en,{key:1,modelValue:y.value,"onUpdate:modelValue":b=>y.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),l.inputType==="email"?(e.openBlock(),e.createBlock(Qt,{key:2,modelValue:y.value,"onUpdate:modelValue":b=>y.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),l.inputType==="mask"?(e.openBlock(),e.createBlock(Xt,{key:3,modelValue:y.value,"onUpdate:modelValue":b=>y.value=b,mask:l.mask,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","mask","disabled","placeholder"])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:b=>k(y.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(Bt),{height:"16",width:"16"})],8,jc)],42,Oc))),128))],512),a.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Pc," Дані для відображення відсутні ")),e.createElementVNode("div",Uc,[e.createElementVNode("button",{type:"button",onClick:E,disabled:h.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(Re,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(i.value),1)],8,Hc)])]))}}),[["__scopeId","data-v-77ce3498"]]),qc={class:"flex items-center gap-2 w-full"},Kc=["disabled"],Gc=["disabled"],jn=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}=Se(n.style),o=t,r=e.computed({get:()=>n.modelValue||"#000000",set:i=>o("update:modelValue",i)}),s=e.computed(()=>!!n.disabled);return(i,c)=>(e.openBlock(),e.createElementBlock("div",qc,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),disabled:s.value,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[l.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Kc),[[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":c[1]||(c[1]=d=>r.value=d),disabled:s.value},null,8,Gc),[[e.vModelText,r.value]])]))}}),Yc={class:"flex items-center gap-2 w-full"},Wc=["min","max","step","disabled"],Zc=["disabled"],Pn=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}=Se(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,c)=>(e.openBlock(),e.createElementBlock("div",Yc,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),min:l.min,max:l.max,step:l.step,disabled:s.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[l.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")])},null,10,Wc),[[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":c[1]||(c[1]=d=>r.value=d),disabled:s.value},null,8,Zc),[[e.vModelText,r.value]])]))}}),Jc=["placeholder","disabled","name"],Xc=["type","value","onInput","placeholder","disabled"],Qc=["onClick"],Un=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}=Se(t.style),r=e.useModel(l,"modelValue"),s=e.computed(()=>!!t.disabled),i=e.computed(()=>t.placeholder??"");e.watchEffect(()=>{const f=r.value?.length??0;f<n.value&&(r.value=[...r.value??[],...Array(n.value-f)])});const c=e.ref({}),d=e.ref({});function p(f,g){f&&(c.value[g]=f)}async function h(f,g){if(!f||t.inputType!=="mask")return;const{default:x}=await Promise.resolve().then(()=>kn);d.value[g]&&d.value[g].destroy(),d.value[g]=x(f,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),d.value[g].on("accept",()=>{const y=[...r.value||[]];y[g]=t.unmask?d.value[g].unmaskedValue:d.value[g].value,r.value=y}),d.value[g].on("complete",()=>{const y=[...r.value||[]];y[g]=t.unmask?d.value[g].unmaskedValue:d.value[g].value,r.value=y}),r.value?.[g]&&(d.value[g].value=r.value[g])}function E(f,g){if(s.value)return;const x=f.target.value??null,y=[...r.value];y[g]=t.inputType==="text"?x:Number(x),r.value=y}function k(){n.value+=1;const f=t.inputType==="text"||t.inputType==="mask"?null:0;r.value=[...r.value,f],t.inputType==="mask"&&setTimeout(()=>{const g=n.value-1;c.value[g]&&h(c.value[g],g)},0)}function v(f){if(n.value>1){d.value[f]&&(d.value[f].destroy(),delete d.value[f]),n.value-=1,r.value=r.value.filter((x,y)=>y!==f);const g={};Object.keys(d.value).forEach(x=>{const y=parseInt(x,10);y>f?g[y-1]=d.value[y]:y<f&&(g[y]=d.value[y])}),d.value=g}}return e.onMounted(()=>{if(t.inputType==="mask")for(let f=0;f<n.value;f+=1)c.value[f]&&h(c.value[f],f)}),e.onBeforeUnmount(()=>{Object.values(d.value).forEach(f=>{f&&f.destroy()})}),e.watch(()=>t.mask,f=>{t.inputType==="mask"&&Object.values(d.value).forEach(g=>{g&&g.updateOptions({mask:f,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})})}),e.watch(r,f=>{t.inputType==="mask"&&f&&f.forEach((g,x)=>{d.value[x]&&d.value[x].value!==g&&(d.value[x].value=g||"")})},{deep:!0}),(f,g)=>(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,x=>(e.openBlock(),e.createElementBlock("div",{key:x,class:"flex items-center gap-2 w-full"},[l.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:y=>p(y,x-1),placeholder:l.placeholder,disabled:l.disabled,name:`${l.name}[${x-1}]`,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Jc)):(e.openBlock(),e.createElementBlock("input",{key:1,type:l.inputType,value:r.value?.[x-1],onInput:y=>E(y,x-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":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Xc)),!l.disabled&&x===n.value&&l.isAdded?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:e.withModifiers(k,["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(Re,{height:"18",width:"18"})])):e.createCommentVNode("",!0),!l.disabled&&n.value>1&&l.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(y=>v(x-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(Bt,{height:"18",width:"18"})],8,Qc)):e.createCommentVNode("",!0)]))),128))],2))}}),ed=["aria-expanded","data-focus"],td=["placeholder","disabled","readonly"],nd={class:"max-h-full"},ld=["onClick","disabled"],ad={key:0,class:"px-3 py-2 text-sm text-stone-500"},od={class:"flex flex-col gap-1"},rd=["onDragstart","onDrop"],sd=["disabled"],id=["title"],cd=["disabled","onClick","aria-label"],dd={key:0,class:"text-xs text-stone-500"},Dt=ae(e.defineComponent({__name:"vs-input-array-select",props:e.mergeModels({options:{default:()=>[]},data:{default:""},api:{default:""},prefix:{default:"api"},host:{default:""},parent:{},search:{type:Boolean,default:!0},maxHeight:{default:280},start:{default:0},slot:{},disabled:{type:Boolean,default:!1},style:{},customClass:{},modelValue:{},error:{},name:{},placeholder:{default:"Оберіть значення"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["change","update:modelValue","value-selected"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=t,o=e.useModel(l,"modelValue"),r=e.ref([]),s=e.ref(n.options??[]),i=e.ref({}),c=e.ref({}),d=e.ref({keyword:"",parent:null}),p=e.ref(""),h=e.ref(!1),E=e.ref(null),k=e.ref(null),v=e.ref(null);let f=!1,g=!1;const x=e.inject("values"),y=e.computed(()=>!!n.disabled),w=e.computed(()=>n.placeholder??"Оберіть значення"),b=e.computed(()=>n.search!==!1),S=e.computed(()=>`${n.maxHeight??280}px`),M=e.computed(()=>{const N=n.parent??n.parentValue;return N?String(N):""}),B=e.computed(()=>M.value?x?.value?.[M.value]??null:null),T=N=>N==null?"__null__":String(N),Z=N=>{if(!N)return"";const P=N.label??N.text??N.name??N.ua??N.en;return P?String(P):N.id!==void 0&&N.id!==null?String(N.id):""},J=N=>{const P=T(N);return c.value[P]||(c.value[P]=`array-select-${P}-${Math.random().toString(36).slice(2,8)}`),c.value[P]},I=e.computed(()=>new Set(r.value.map(N=>T(N.id)))),F=e.computed(()=>{const N=I.value;let P=[...s.value];if(!n.data&&p.value.trim()){const K=p.value.toLowerCase();P=P.filter(he=>Z(he).toLowerCase().includes(K))}return P.filter(K=>!N.has(T(K.id)))}),R=()=>{if(!n.data)return"";const N=n.prefix??"api",P=n.api??`/${N}/suggest/${n.data}`;return`${n.host??""}${P}`},G=()=>{r.value.length&&(f=!0,r.value=r.value.map(N=>({...N,text:i.value[T(N.id)]??N.text})))},O=N=>{const P=T(N.id),K=Z(N);K&&(i.value[P]=K)},A=N=>{s.value=N?[...N]:[],N?.forEach(O),G()},W=N=>{if(!N.length)return;const P=new Map(s.value.map(K=>[T(K.id),K]));N.forEach(K=>{const he=T(K.id);P.set(he,K),O(K)}),s.value=Array.from(P.values()),G()},H=async(N="")=>{if(!n.data)return[];const P=R();if(!P)return[];const K=new URLSearchParams;K.set("json","1"),N&&K.set("key",N),n.start===1&&K.set("start","1"),B.value!==null&&B.value!==void 0&&B.value!==""&&K.set("parent",String(B.value));try{return(await(await fetch(`${P}?${K.toString()}`)).json())?.data??[]}catch{return[]}},pe=async N=>{if(!n.data||!N.length)return[];const P=R();if(!P)return[];const K=Array.from(new Set(N.map(Ne=>T(Ne)))),he=new URLSearchParams;he.set("json","1"),he.set("val",K.join(",")),n.start===1&&he.set("start","1"),B.value!==null&&B.value!==void 0&&B.value!==""&&he.set("parent",String(B.value));try{const ze=(await(await fetch(`${P}?${he.toString()}`)).json())?.data??[];return W(ze),ze}catch{return[]}},me=async(N="",{force:P=!1}={})=>{if(!n.data)return;const K=B.value??null;if(!P&&d.value.keyword===N&&d.value.parent===K&&s.value.length>0)return;d.value={keyword:N,parent:K};const Ne=await H(N);A(Ne)},Le=((N,P=200)=>{let K;return(...he)=>{K&&clearTimeout(K),K=setTimeout(()=>N(...he),P)}})(async N=>{n.data&&await me(N,{force:!0})},250),q=e.ref(null),re=async(N="click")=>{y.value||h.value||(q.value=N,await me(p.value.trim()),h.value=!0,await e.nextTick(),v.value?.focus())},ue=()=>{h.value=!1,q.value=null,e.nextTick(()=>{v.value?.blur()})},fe=async N=>{if(N.stopPropagation(),!y.value){if(h.value){if(q.value==="focus"){q.value=null;return}ue();return}await re("click")}},ye=N=>{N.key==="Escape"&&ue()},z=N=>{const P=N.target;k.value?.contains(P)||ue()},le=N=>{if(N.key==="Escape"){N.preventDefault(),ue();return}if(N.key==="Enter"){N.preventDefault();const P=F.value[0];P&&xe(P)}},xe=N=>{if(!N)return;const P=T(N.id);if(I.value.has(P))return;O(N);const K={id:N.id,text:Z(N)||String(N.id??""),key:J(N.id)};r.value=[...r.value,K],Me(N),p.value="",e.nextTick(()=>{v.value?.focus()})},Me=N=>{const P=r.value.map(K=>K.id);a("value-selected",{name:n.name,value:P,option:N})},D=N=>{if(y.value)return;const P=r.value.filter(K=>T(K.id)!==T(N));r.value=P},j=N=>{y.value||(E.value=N)},Y=N=>{if(y.value||E.value===null||E.value===N)return;const P=[...r.value],[K]=P.splice(E.value,1);P.splice(N,0,K),E.value=null,r.value=P},ne=async()=>{const P=(Array.isArray(o.value)?[...o.value]:[]).filter(he=>he!=null);if(n.data&&P.length){const he=P.filter(Ne=>!i.value[T(Ne)]);he.length&&await pe(he)}const K=P.map(he=>({id:he,text:i.value[T(he)]??String(he),key:J(he)}));f=!0,r.value=K};e.watch(r,N=>{if(f){f=!1;return}const P=N.map(K=>K.id);g=!0,o.value=P,a("change",P)},{deep:!0}),e.watch(o,()=>{if(g){g=!1;return}ne()},{deep:!0}),e.watch(p,N=>{!n.data||!h.value||Le(N.trim())}),e.watch(y,N=>{N&&ue()}),e.watch(()=>n.options,async N=>{n.data||(A(N??[]),await ne())},{immediate:!0,deep:!0}),e.watch(()=>n.data,async N=>{N&&(await me(p.value.trim()),await ne())},{immediate:!0});const oe=e.ref(!1);return e.watch(B,async()=>{if(n.data){if(!oe.value){oe.value=!0;return}r.value=[],await me(p.value.trim()),await ne()}}),e.onMounted(async()=>{document.addEventListener("click",z,!0),window.addEventListener("keydown",ye),await ne()}),e.onUnmounted(()=>{document.removeEventListener("click",z,!0),window.removeEventListener("keydown",ye)}),(N,P)=>(e.openBlock(),e.createElementBlock("div",{class:"flex flex-col gap-2 w-full",ref_key:"rootRef",ref:k},[e.createElementVNode("div",{class:"relative",onClick:P[2]||(P[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white px-3","border-gray-300 hover:border-[#b3d4ff]",h.value?"border-[#2684ff] ring-1 ring-[#2684ff] shadow-[0_0_0_1px_rgba(38,132,255,0.5)]":"",y.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":h.value,"aria-haspopup":"listbox","data-focus":h.value?"true":"false",onClick:fe},[e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:v,"onUpdate:modelValue":P[0]||(P[0]=K=>p.value=K),placeholder:w.value,disabled:y.value,readonly:!b.value,onFocus:P[1]||(P[1]=()=>re("focus")),onKeydown:le,class:"flex-1 bg-transparent border-0 outline-none px-0 py-1 text-sm text-stone-900 placeholder:text-stone-400"},null,40,td),[[e.vModelText,p.value]]),e.createElementVNode("span",{class:e.normalizeClass(["text-stone-400 transition-transform duration-150",h.value?"rotate-180":""]),"aria-hidden":"true"},[e.createVNode(Wt,{width:"16",height:"16"})],2)],10,ed),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[h.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"absolute left-0 right-0 z-10 mt-1 rounded-md border border-stone-200 bg-white shadow-lg overflow-auto",style:e.normalizeStyle({maxHeight:S.value})},[e.createElementVNode("div",nd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(F.value,K=>(e.openBlock(),e.createElementBlock("button",{key:T(K.id),type:"button",class:"w-full px-3 py-2 text-left text-sm text-stone-900 hover:bg-stone-100 disabled:opacity-50",onClick:e.withModifiers(he=>xe(K),["stop"]),disabled:y.value},e.toDisplayString(Z(K)),9,ld))),128)),F.value.length===0?(e.openBlock(),e.createElementBlock("p",ad," Немає варіантів ")):e.createCommentVNode("",!0)])],4)):e.createCommentVNode("",!0)]),_:1})]),e.createElementVNode("div",od,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(K,he)=>(e.openBlock(),e.createElementBlock("div",{key:K.key,class:e.normalizeClass(["flex items-center gap-2 rounded-md border border-stone-200 bg-white px-2 py-2",{"opacity-60":E.value===he}]),draggable:"true",onDragstart:Ne=>j(he),onDragover:P[3]||(P[3]=e.withModifiers(()=>{},["prevent"])),onDrop:Ne=>Y(he),onDragend:P[4]||(P[4]=Ne=>E.value=null)},[e.createElementVNode("button",{type:"button",class:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-stone-500 hover:text-stone-900",disabled:y.value,"aria-label":"Перетягнути"},[e.createVNode(St,{width:"14",height:"14"})],8,sd),e.createElementVNode("div",{class:"flex-1 text-sm text-stone-900",title:K.text},e.toDisplayString(K.text),9,id),e.createElementVNode("button",{type:"button",class:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-stone-400 hover:text-stone-900",disabled:y.value,onClick:e.withModifiers(Ne=>D(K.id),["stop"]),"aria-label":`Видалити ${K.text}`},[e.createVNode(Bt,{width:"14",height:"14"})],8,cd)],42,rd))),128)),r.value.length===0?(e.openBlock(),e.createElementBlock("p",dd,"Немає вибраних значень")):e.createCommentVNode("",!0)])],512))}}),[["__scopeId","data-v-cffead85"]]),ud={class:"flex items-center gap-2 w-full"},pd={class:"relative flex-1"},md=["placeholder","disabled","onKeydown"],fd=["disabled"],hd={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"},gd={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"},yd={key:0,class:"fixed inset-0 z-[1000] flex items-center justify-center bg-black/50"},kd={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},bd={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},wd=["onClick"],xd={key:0,class:"p-4 text-sm text-gray-500"},Hn=e.defineComponent({__name:"vs-input-address",props:e.mergeModels({api:{default:""},geom:{default:""},includes:{default:()=>[]},bbox:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(l,{emit:t}){const n=/{{\s*([^}]+?)\s*}}/g,a=l,o=t,{inputClass:r}=Se(a.style),s=e.useModel(l,"modelValue"),i=e.computed({get:()=>s.value,set:B=>{s.value=B}}),c=e.ref(!1),d=e.ref([]),p=e.ref(!1),h=e.ref(null);e.watch(p,B=>{typeof document>"u"||(B?(h.value=document.body.style.overflow,document.body.style.overflow="hidden"):h.value!=null?(document.body.style.overflow=h.value,h.value=null):document.body.style.removeProperty("overflow"))}),e.onBeforeUnmount(()=>{typeof document>"u"||(h.value!=null?document.body.style.overflow=h.value:document.body.style.removeProperty("overflow"))});const E=e.computed(()=>a.placeholder??""),k=e.computed(()=>!!a.disabled),v=B=>{if(!B)return null;if(Array.isArray(B))return B;if(typeof B=="string"){const T=B.split(",").map(Z=>Z.trim()).filter(Boolean);return T.length!==4?null:T.map(Number)}return null},f=e.computed(()=>{const B=v(a.bbox);if(!B||B.length!==4)return null;const T=B.map(Number);return T.some(Z=>Number.isNaN(Z))?null:T}),g=e.computed(()=>{const B=f.value;if(!B)return"";const[T,Z,J,I]=B;return`${T},${Math.max(Z,I)},${J},${Math.min(Z,I)}`});e.computed(()=>g.value?"1":"0");const x=e.inject("values");function y(){!k.value&&i.value.trim()&&w()}async function w(){const B=(i.value||"").trim();if(!B)return;let T=B;if(a.includes?.length&&x?.value){const J=a.includes.map(I=>x.value?.[I]).filter(Boolean);J.length&&(T=`${J.join(", ")}, ${B}`)}const Z=M(T);if(Z){c.value=!0;try{const I=await(await fetch(Z)).json();d.value=Array.isArray(I)?I:[],p.value=!0}catch(J){console.error("Address search error:",J)}finally{c.value=!1}}}function b(){p.value=!p.value}function S(B){if(!B)return;p.value=!1;const T=parseFloat(B.lat),J={type:"Point",coordinates:[parseFloat(B.lon),T]};a.geom&&x?.value&&(x.value[a.geom]=J),o("update:geom",J)}function M(B){if(!a.api)return"";const T={value:encodeURIComponent(B),bbox:f.value?f.value.join(","):""};return a.api.replace(n,(Z,J)=>T[J.trim()]??"")}return(B,T)=>(e.openBlock(),e.createElementBlock("div",ud,[e.createElementVNode("div",pd,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":T[0]||(T[0]=Z=>i.value=Z),placeholder:E.value,disabled:k.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(r),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:e.withKeys(e.withModifiers(y,["prevent"]),["enter"])},null,42,md),[[e.vModelText,i.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:b,title:"Show search results"},[...T[2]||(T[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:w,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:c.value||!i.value?.trim()},[c.value?(e.openBlock(),e.createElementBlock("svg",gd,[...T[4]||(T[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",hd,[...T[3]||(T[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,fd),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[p.value?(e.openBlock(),e.createElementBlock("div",yd,[e.createElementVNode("div",kd,[e.createElementVNode("div",bd,[T[6]||(T[6]=e.createElementVNode("span",null,"Search results",-1)),e.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:T[1]||(T[1]=Z=>p.value=!1),title:"Close"},[...T[5]||(T[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,(Z,J)=>(e.openBlock(),e.createElementBlock("li",{key:J,onClick:I=>S(Z),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString(Z.display_name),9,wd))),128))]),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",xd," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),qn=(l="")=>`${l}${Math.floor(Math.random()*1e4)}`,_d={class:"vs-datalist space-y-3"},vd={class:"space-y-3"},Ed=["onClick","disabled"],Vd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Bd=["disabled"],Cd=ae(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(f=>({...f,disabled:t.disabled||f.disabled}))??[]),s=e.computed(()=>r.value.map(f=>v(f))),i=e.computed(()=>t.disabled?!1:t.maxItems?a.value.length<t.maxItems:!0),c=e.computed(()=>t.disabled||a.value.length<=(t.minItems||0));e.watch(()=>a.value.length,()=>{d(),p()},{immediate:!0}),e.watch(()=>t.schema,p,{immediate:!0,deep:!0});function d(){const f=a.value.length;o.value.length<f?o.value=[...o.value,...Array.from({length:f-o.value.length},()=>qn())]:o.value.length>f&&o.value.splice(f)}function p(){if(!t.minItems||a.value.length>=t.minItems)return;const f=t.minItems-a.value.length,g=Array.from({length:f},h);n.value=[...a.value,...g]}function h(){const f={};return r.value.forEach(g=>{f[g.name]=g?.default??null}),f}function E(){i.value&&(n.value=[...a.value,h()],d())}function k(f){c.value||(n.value=a.value.filter((g,x)=>x!==f),d(),p())}function v(f){return{...f}}return(f,g)=>(e.openBlock(),e.createElementBlock("div",_d,[e.createElementVNode("div",vd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(x,y)=>(e.openBlock(),e.createElementBlock("div",{key:o.value[y],class:"flex items-center gap-3"},[e.createVNode(He,{schema:s.value,layout:"inline",navigation:!1,values:a.value[y],"onUpdate:values":w=>a.value[y]=w,"form-id":o.value[y]},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:w=>k(y),disabled:c.value},[e.createVNode(nt,{class:"w-5 h-5"})],8,Ed)]))),128)),a.value.length===0?(e.openBlock(),e.createElementBlock("div",Vd,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:E,disabled:!i.value},[e.createVNode(Re,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Bd)]))}}),[["__scopeId","data-v-c4c0acde"]]),Sd={};function Nd(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 $d=ae(Sd,[["render",Nd]]),Md={class:"vs-dataform space-y-4"},Dd=["draggable","onDragstart","onDragover","onDragenter","onDrop"],Ad={class:"flex items-center gap-2"},Fd=["onClick"],Ld={class:"text-sm font-medium text-gray-700"},Id={class:"flex items-center gap-2"},Td=["title","onClick","disabled"],Od=["title","onClick","disabled"],zd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Rd=["disabled"],jd=ae(e.defineComponent({__name:"vs-input-dataform",props:e.mergeModels({schema:{default:()=>[]},minGroups:{default:0},maxGroups:{default:void 0},addButtonText:{default:"Додати групу фільтрів"},groupLabel:{default:void 0},duplicateTitle:{default:"Дублювати групу"},removeTitle:{default:"Видалити групу"},emptyLabel:{},view:{default:"default"},collapsible:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},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.ref(0),s=e.ref(null),i=e.ref(null),c=e.ref(null),d=e.computed(()=>t.groupLabel??"Group"),p=e.computed(()=>t.emptyLabel??"Ще немає груп"),h=e.computed(()=>t.schema?.map(q=>({...q,disabled:t.disabled||q.disabled}))??[]),E=e.computed(()=>h.value.map(q=>Z(q))),k=e.computed(()=>t.view==="accordion"),v=e.computed(()=>!!(t.collapsible||k.value)),f=e.computed(()=>t.draggable!==!1),g=e.computed(()=>t.disabled?!1:t.maxGroups?n.value.length<t.maxGroups:!0),x=e.computed(()=>t.disabled||n.value.length<=(t.minGroups||0));e.watch(()=>n.value.length,()=>{y(),w(),b()},{immediate:!0}),e.watch(()=>t.schema,b,{immediate:!0,deep:!0}),e.watch(()=>t.view,()=>{w()},{immediate:!0});function y(){const q=n.value.length;a.value.length<q?a.value=[...a.value,...Array.from({length:q-a.value.length},()=>qn())]:a.value.length>q&&a.value.splice(q)}function w(){const q=n.value.length;k.value?q===0?r.value=-1:r.value>=q?r.value=q-1:r.value<0&&(r.value=0):o.value.length<q?o.value=[...o.value,...Array.from({length:q-o.value.length},()=>!1)]:o.value.length>q&&o.value.splice(q)}function b(){if(!t.minGroups||n.value.length>=t.minGroups)return;const q=t.minGroups-n.value.length,re=Array.from({length:q},S);n.value=[...n.value,...re],w()}function S(){const q={};return h.value.forEach(re=>{q[re.name]=re?.default??null}),q}function M(){g.value&&(n.value=[...n.value,S()],y(),w())}function B(q){x.value||(n.value=n.value.filter((re,ue)=>ue!==q),y(),k.value?r.value>=n.value.length&&(r.value=n.value.length-1):o.value.splice(q,1),b())}function T(q){if(t.disabled)return;const re=JSON.parse(JSON.stringify(n.value[q]??{}));n.value=[...n.value.slice(0,q+1),re,...n.value.slice(q+1)],y(),k.value?r.value>q&&(r.value+=1):o.value.splice(q+1,0,o.value[q]??!1)}function Z(q){return{...q}}function J(q){return k.value?r.value===-1&&q===0?!1:r.value!==q:!!o.value[q]}function I(q){if(v.value){if(k.value){r.value=q;return}o.value[q]=!o.value[q]}}function F(q,re){if(!f.value||t.disabled){re.preventDefault();return}s.value=q,i.value=q,c.value={groups:JSON.parse(JSON.stringify(n.value)),keys:[...a.value],states:[...o.value]},re.dataTransfer?.setData("text/plain",String(q)),re.dataTransfer?.setDragImage?.(re.currentTarget,0,0)}function R(q,re){!f.value||t.disabled||s.value!==null&&pe(q,re)}function G(q,re){pe(q,re)}function O(q){!f.value||t.disabled||Le()}function A(){c.value&&H(),s.value=null,i.value=null,c.value=null}function W(q,re){const ue=[...n.value],[fe]=ue.splice(q,1);ue.splice(re,0,fe),n.value=ue;const ye=[...a.value],[z]=ye.splice(q,1);if(ye.splice(re,0,z),a.value=ye,k.value)r.value===q&&(r.value=re);else{const le=[...o.value],[xe]=le.splice(q,1);le.splice(re,0,xe),o.value=le}}function H(){c.value&&(n.value=c.value.groups,a.value=c.value.keys,o.value=c.value.states,c.value=null,i.value=null)}function pe(q,re){if(s.value===null)return;const ue=me(q,re);i.value=ue,Ae(ue)}function me(q,re){if(!re?.currentTarget)return q;const ue=re.currentTarget.getBoundingClientRect(),ye=re.clientY-ue.top>ue.height/2?q+1:q;return Math.max(0,Math.min(ye,n.value.length))}function Ae(q){const re=s.value;if(re===null)return;let ue=q;if(ue>n.value.length&&(ue=n.value.length),ue===re||ue===re+1)return;const fe=ue>re?ue-1:ue;W(re,fe),s.value=fe,i.value=ue>re?fe+1:fe}function Le(){c.value=null,s.value=null,i.value=null}return(q,re)=>(e.openBlock(),e.createElementBlock("div",Md,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(ue,fe)=>(e.openBlock(),e.createElementBlock("div",{key:a.value[fe],class:e.normalizeClass(["relative border border-gray-200 rounded-lg bg-white transition vs-dataform__group",[t.view==="accordion"?"overflow-hidden":J(fe)?"pt-6 px-6":"p-6"]]),draggable:f.value&&!t.disabled,onDragstart:ye=>F(fe,ye),onDragend:A,onDragover:e.withModifiers(ye=>R(fe,ye),["prevent"]),onDragenter:e.withModifiers(ye=>G(fe,ye),["prevent"]),onDrop:e.withModifiers(ye=>O(),["prevent"])},[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center justify-between gap-2 border-b border-gray-100 px-4 py-3",[t.view!=="accordion"?"-mx-6 -mt-6 px-6":"",t.view!=="accordion"&&!J(fe)?"rounded-t-lg":"rounded-lg"]])},[e.createElementVNode("div",Ad,[f.value?(e.openBlock(),e.createBlock(St,{key:0,class:"w-4 h-4 text-gray-400","aria-hidden":"true"})):e.createCommentVNode("",!0),v.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"rounded-full p-1 text-gray-500 transition hover:bg-gray-100",onClick:ye=>I(fe)},[e.createVNode(Wt,{class:e.normalizeClass(["h-4 w-4 transition",J(fe)?"-rotate-90":"rotate-0"])},null,8,["class"])],8,Fd)):e.createCommentVNode("",!0),e.createElementVNode("div",Ld,e.toDisplayString(`${d.value} (${fe+1})`),1)]),e.createElementVNode("div",Id,[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:ye=>T(fe),disabled:t.disabled,draggable:"false"},[e.createVNode($d,{class:"w-5 h-5"})],8,Td),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:ye=>B(fe),disabled:x.value,draggable:"false"},[e.createVNode(nt,{class:"w-5 h-5"})],8,Od)])],2),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(t.view==="accordion"?"p-6":"pt-6")},[e.createVNode(He,{class:"vs-dataform__form",schema:E.value,layout:"inline",navigation:!1,values:n.value[fe],"onUpdate:values":ye=>n.value[fe]=ye,"form-id":a.value[fe],disabled:t.disabled},null,8,["schema","values","onUpdate:values","form-id","disabled"])],2),[[e.vShow,!J(fe)]])],42,Dd))),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",zd,e.toDisplayString(p.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:M,disabled:!g.value},[e.createVNode(Re,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Rd)]))}}),[["__scopeId","data-v-473b9d69"]]),At="__vs_form_monaco_loader__",Kn={VsInputText:tt,VsInputRadio:tn,"vs-input-text":tt,"vs-input-password":jl,"vs-input-textarea":Dn,"vs-input-richtext":An,"vs-input-mask":Xt,"vs-input-number":_n,"vs-input-radio":tn,"vs-input-select":on,"vs-input-switcher":Zt,"vs-input-static":Jt,"vs-input-container":Mn,"vs-input-date":La,"vs-input-checkbox":vn,"vs-input-file":Sn,"vs-input-file2":ln,file2:ln,File2:ln,"vs-input-html":Jt,"vs-input-email":Qt,"vs-input-tel":en,"vs-input-datatable":Fn,"vs-input-map":Ln,"vs-input-file-list":Nn,"vs-input-tags":In,"vs-input-slug":Tn,"vs-input-codegen":On,"vs-input-key-value":zn,"vs-input-text[]":Rn,"vs-input-range":Pn,"vs-input-color":jn,"vs-input-native-select":on,VsInputArraySelect:Dt,"vs-input-array":Un,"vs-input-array-select":Dt,"array-select":Dt,"vs-input-address":Hn,"vs-input-datalist":Cd,"vs-input-dataform":jd,"vs-input-monaco":e.defineComponent({__name:"vs-input-monaco",props:e.mergeModels({syntax:{default:"xml"},theme:{default:"vs-light"},height:{default:280},minimap:{type:Boolean,default:!1},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(null),o=e.computed(()=>typeof t.height=="number"?`${t.height}px`:t.height||"280px");let r=null,s=null,i=!1;const c=()=>{if(s)return Promise.resolve(s);if(typeof window>"u")return Promise.resolve(null);const p=window;if(p.monaco?.editor?.create)return s=p.monaco,Promise.resolve(s);if(p[At])return p[At];const E=(async()=>{const k=g=>{if(Array.from(document.styleSheets||[]).some(w=>w?.href?.includes(g)))return;const y=document.createElement("link");y.rel="stylesheet",y.href=g,document.head.appendChild(y)},v=g=>new Promise((x,y)=>{if(Array.from(document.scripts).some(S=>S.src===g))return x();const b=document.createElement("script");b.src=g,b.async=!0,b.onload=()=>x(),b.onerror=S=>y(S),document.body.appendChild(b)}),f="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs";return k(`${f}/editor/editor.main.min.css`),await v(`${f}/loader.min.js`),new Promise((g,x)=>{window.require.config({paths:{vs:f}}),window.require(["vs/editor/editor.main"],()=>{s=window.monaco,p.monaco=s,g(s)},y=>x(y))})})().catch(k=>{throw delete p[At],k});return p[At]=E,E},d=()=>{!a.value||!s||(r&&(r.dispose(),r=null),r=s.editor.create(a.value,{value:n.value||"",language:t.syntax,theme:t.theme,automaticLayout:!0,minimap:{enabled:!!t.minimap},readOnly:!!t.disabled}),r.onDidChangeModelContent(()=>{i||(n.value=r.getValue())}))};return e.watch(()=>n.value,p=>{if(!r)return;const h=r.getValue();p!==h&&(i=!0,r.setValue(p||""),i=!1)}),e.watch(()=>t.syntax,p=>{!r||!s||s.editor.setModelLanguage(r.getModel(),p||"xml")}),e.watch(()=>t.theme,p=>{s&&s.editor.setTheme(p||"vs-light")}),e.watch(()=>t.disabled,p=>{r&&r.updateOptions({readOnly:!!p})}),e.watch(()=>t.minimap,p=>{r&&r.updateOptions({minimap:{enabled:!!p}})}),e.onMounted(async()=>{try{const p=await c();if(!p||!p.editor)return;s=p,d()}catch(p){console.error("Failed to load Monaco editor",p)}}),e.onBeforeUnmount(()=>{r&&(r.dispose(),r=null)}),(p,h)=>(e.openBlock(),e.createElementBlock("div",{class:"w-full",style:e.normalizeStyle({height:o.value})},[e.createElementVNode("div",{ref_key:"editorContainer",ref:a,class:"w-full h-full overflow-hidden border border-[#CFD9E0] rounded"},null,512)],4))}})},Pd=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){ge.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const s=await r.json();if(!t.set||!n)return;for(const[i,c]of Object.entries(t.set))n.value[i]=s.result[c]}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(l.button),1))}}),Ud={class:"flex flex-col gap-1 w-full"},Hd=["innerHTML"],Gn=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(()=>zl[`${n.layout}`]),s=["label","placeholder","info","description","text","html"],i=e.ref(x()),c=e.computed(()=>v(n.item,i.value)),d=e.computed(()=>Kn?.[`vs-input-${n.item.type}`]),p=e.inject("field-props"),h=e.computed(()=>{const w=e.unref(d);if(!w)return new Set;const b=w.props??w.__vccOpts?.props;if(!b)return new Set;const S=Array.isArray(b)?b:Object.keys(b);return new Set(S)}),E=e.computed(()=>{const w={...c.value??{}},b=n.item?.name;b&&p?.value?.[b]&&Object.assign(w,p.value[b]);const S=h.value;return S.size?Object.fromEntries(Object.entries(w).filter(([M])=>S.has(M))):{}}),k=w=>{const b=typeof w=="object"&&w!==null?w:{value:w};o("value-selected",{...b,name:b.name??n.item?.name})};e.onMounted(()=>{i.value=x(),window.addEventListener("storage",y)}),e.onUnmounted(()=>{window.removeEventListener("storage",y)});function v(w,b){if(!w)return{};const S={...w};return s.forEach(M=>{const B=g(w,M,b);B!=null&&(S[M]=B)}),Array.isArray(w.options)&&(S.options=w.options.map(M=>f(M,b))),S}function f(w,b){if(!w)return w;const S={...w},M=g(w,"label",b),B=g(w,"text",b);return M!=null&&(S.label=M),B!=null?S.text=B:M!=null&&(S.text=M),S}function g(w,b,S){const M=`${b}:${S}`;if(w?.[M]!=null)return w[M];if(b==="label"&&w?.[S]!=null)return w[S];if(w?.[b]!=null)return w[b];if(b==="label"){if(w?.ua!=null)return w.ua;if(w?.en!=null)return w.en}if(b==="text"||b==="html"){if(w?.ua!=null)return w.ua;if(w?.en!=null)return w.en}return null}function x(){return typeof window>"u"?"uk":localStorage.getItem("locale")||"uk"}function y(){i.value=x()}return(w,b)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{ua:c.value.ua,error:n.error||"",item:c.value,columns:n.columns,label:c.value.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${n.item.type}-component`])},[e.createElementVNode("div",Ud,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value),e.mergeProps(E.value,{modelValue:a.value,"onUpdate:modelValue":b[0]||(b[0]=S=>a.value=S),onValueSelected:k}),null,16,["modelValue"])),c.value.description&&n.layout!=="settings"?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-sm text-gray-500",innerHTML:c.value.description},null,8,Hd)):e.createCommentVNode("",!0)]),c.value.behavior?.api&&c.value.behavior?.button?(e.openBlock(),e.createBlock(Pd,e.mergeProps({key:0},c.value.behavior,{value:a.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),qd={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},Kd={class:"vs-compact-form-navigation__rail mt-[6px]"},Gd=["onClick"],Yd=ae(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"]),c=e.computed(()=>{const I=n.width;if(I==null)return{};const F=typeof I=="number"?`${I}px`:`${I}`;return{width:F,minWidth:F}});let d=null,p=0,h=0,E=null,k=null,v=null;const f=()=>Z(),g=()=>y();e.watch(()=>n.target,async I=>{if(M(),!I){E=null,a.value=[],o.value="";return}E=I,s.value&&(await e.nextTick(),S(I),y())},{immediate:!0}),e.watch(()=>n.scrollContainer,I=>{if(!s.value){k=I??null;return}x(I??null),e.nextTick(()=>y())},{immediate:!0}),e.onMounted(()=>{n.scrollContainer||x(null),y()}),e.onBeforeUnmount(()=>{M(),x(null,!0),E=null,typeof window<"u"&&(p&&window.cancelAnimationFrame(p),h&&window.cancelAnimationFrame(h))});function x(I,F=!1){if(v&&(v(),v=null),F){k=null;return}if(k=I??null,typeof window>"u")return;const R=I??window,G=window;R.addEventListener("scroll",f,{passive:!0}),G.addEventListener("resize",g),v=()=>{R.removeEventListener("scroll",f),G.removeEventListener("resize",g)}}function y(){if(!s.value||!E)return;p&&typeof window<"u"&&window.cancelAnimationFrame(p);const I=()=>{w(),p=0};typeof window>"u"?I():p=window.requestAnimationFrame(I)}function w(){if(!s.value||!E)return;const I=Array.from(E.querySelectorAll("h1, h2")),F=new Set,R=[];I.forEach((G,O)=>{const A=G.textContent?.trim()??"";if(!A)return;let W=(G.getAttribute("id")??"").trim();W||(W=b(A)||`heading-${O+1}`);let H=W,pe=1;for(;F.has(H);)H=`${W}-${pe+=1}`;G.id!==H&&Object.assign(G,{id:H}),F.add(H),R.push({id:H,text:A,level:G.tagName.toLowerCase()==="h1"?1:2})}),a.value=R,R.length||(o.value=""),T()}function b(I){return I.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function S(I){!I||!s.value||typeof MutationObserver>"u"||(M(),d=new MutationObserver(()=>y()),d.observe(I,{childList:!0,subtree:!0}))}function M(){d&&(d.disconnect(),d=null)}function B(I){const F=k;if(!F)return typeof window>"u"?I.offsetTop:I.getBoundingClientRect().top+window.scrollY;const R=I.getBoundingClientRect(),G=F.getBoundingClientRect();return R.top-G.top+F.scrollTop}function T(){if(!s.value||!a.value.length)return;const I=k,F=(I?I.scrollTop:null)||(typeof window<"u"?window.scrollY:0),R=(I?I.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),G=F+R;let O=null;for(let W=0;W<a.value.length;W+=1){const H=a.value[W],pe=document.getElementById(H.id);if(pe){const me=B(pe);me+pe.offsetHeight>F&&me<G&&(O=H.id)}}!O&&r.value&&(O=r.value),O&&(r.value=O);const A=I?I.scrollHeight-I.clientHeight:document.documentElement.scrollHeight-window.innerHeight;F+5>=A&&(O=a.value[a.value.length-1].id),O&&(o.value=O)}function Z(){s.value&&(h&&window.cancelAnimationFrame(h),h=window.requestAnimationFrame(()=>{T(),h=0}))}function J(I){if(!s.value)return;const F=document.getElementById(I);if(!F)return;const R=k,G=Math.max(0,B(F));R?R.scrollTo({top:G,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:G,behavior:"smooth"})}return t({refresh:y}),(I,F)=>s.value&&a.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(c.value)},[e.createElementVNode("h2",qd,e.toDisplayString(l.title),1),e.createElementVNode("div",Kd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,R=>(e.openBlock(),e.createElementBlock("div",{key:R.id,class:e.normalizeClass(["vs-compact-form-navigation__item relative",R.level===2?"vs-compact-form-navigation__item--nested":"",R.id===o.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick:G=>J(R.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",R.level===2?"pl-[15px]":"pl-[18px]",R.id===o.value?"text-gray-800":"text-gray-500"])},[e.createElementVNode("span",null,e.toDisplayString(R.text),1)],10,Gd)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-b3e16a91"]]),Xe={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон",minlength:l=>`Мінімальна довжина — ${l} символів`,maxlength:l=>`Максимальна довжина — ${l} символів`},Wd=l=>typeof l=="string"?l.trim()?!1:Xe.required:Array.isArray(l)?l.map(n=>typeof n=="string"?n.trim():n).filter(n=>n!=null&&n!=="").length?!1:Xe.required:l?!1:Xe.required,Zd=l=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return l?t.test(l)?!1:Xe.email:!1},Jd=l=>{const t=/^\+[1-9]\d{1,14}$/;return l?t.test(l)?!1:Xe.tel:!1},Yn=l=>l==null?0:typeof l=="string"?l.trim().length:Array.isArray(l)?l.length:typeof l=="number"?l.toString().length:String(l).length,Xd=(l,t)=>{if(l==null)return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Yn(l)<n?t?.message||Xe.minlength(n):!1},Qd=(l,t)=>{if(l==null||l==="")return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Yn(l)>n?t?.message||Xe.maxlength(n):!1},eu=(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},tu=(l,t)=>!1,nu=(l,t)=>{switch(typeof t=="string"?t:t.type){case"required":return Wd(l);case"email":return Zd(l);case"tel":return Jd(l);case"regexp":return eu(l,t);case"minlength":return Xd(l,t);case"maxlength":return Qd(l,t);case"custom":return tu();default:return!1}},lu={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function Wn(l){const t=l?.toLowerCase();return lu[t]||t}function sn(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=Wn(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=sn(r.schema,r.disabled)),a.push(r)}),a}const n=[];return Object.entries(l).forEach(a=>{const o={name:a[0],...a[1],type:Wn(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=sn(o.schema,o.disabled)),n.push(o)}),n}function au(l,t,n=!1){const a=e.computed(()=>sn((Array.isArray(t),t),typeof n=="boolean"?n:n.value)),o=e.ref({});function r(d){const p=d?.conditions;if(!p)return!0;const h=Array.isArray(p)?p[0]:p,E=l?.value?.[h];return $n(E,p)}const s=(d=a.value,p=!0)=>(d.forEach(h=>{const E=[],k=Number(h?.minlength),v=Number(h?.maxlength);!Number.isNaN(k)&&Number.isFinite(k)&&E.push({type:"minlength",value:k}),!Number.isNaN(v)&&Number.isFinite(v)&&E.push({type:"maxlength",value:v});const f=[...E,...h.rules||[]];if(f.length){if(!r(h)){delete o.value[h.name];return}let g=!1,x=null;f.forEach(y=>{const w=nu(l.value[h.name],y);w&&(g=!0,!x&&typeof w=="string"&&(x=w))}),g&&x?o.value[h.name]=x:delete o.value[h.name]}h.schema&&s(h.schema,!1)}),p&&Object.values(o.value).some(Boolean)?o.value:null),i=e.computed(()=>a.value?.filter(d=>d.hidden!==!0&&r(d)));return{errors:o,validate:s,reset:()=>{l.value={},o.value={}},visibleSchema:i}}const ou={class:"flex w-full h-full min-h-0 gap-6"},ru={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},He=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:{},modelValue:{default:()=>({})},modelModifiers:{},values:{default:void 0},valuesModifiers:{}}),emits:e.mergeModels(["handle-submit","update:modelValue","value-selected"],["update:form","update:modelValue","update:values"]),setup(l,{expose:t,emit:n}){const a=n,o=l,r=e.useModel(l,"form"),s=e.useModel(l,"modelValue"),i=e.useModel(l,"values"),c=e.computed({get:()=>i.value??s.value,set:F=>{s.value=F,i.value=F}}),{errors:d,validate:p,reset:h,visibleSchema:E}=au(c,o.schema,e.toRef(o,"disabled")),k=e.ref(null),v=e.ref(null),f=e.ref({}),g=e.computed(()=>o.navigation),x=e.computed(()=>o.navWidth),y=e.computed(()=>o.style?.columns),w=Object.freeze({container:12,label:3}),b=e.computed(()=>o.columns??y.value??w),S=e.computed(()=>o.columns!=null||y.value!=null),M=e.computed(()=>S.value?"horizontal":o.layout),B=F=>F?.columns?"horizontal":M.value,T=F=>F?.columns??b.value,Z=()=>{a("update:modelValue",c.value),p(),a("handle-submit",c.value)},J=F=>{a("value-selected",F)};t({validate:p,reset:h,errors:d}),e.onMounted(()=>{r.value={value:c.value,errors:d.value,reset:h,validate:p,formId:o.formId}});function I(F,R){if(F===R)return!0;if(typeof F!="object"||typeof R!="object"||!F||!R)return!1;const G=Object.keys(F),O=Object.keys(R);return G.length!==O.length?!1:G.every(A=>F[A]===R[A])}return e.provide("form",r),e.provide("values",c),e.provide("field-props",f),(F,R)=>(e.openBlock(),e.createElementBlock("div",ou,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:v},[e.createElementVNode("form",{ref_key:"formRef",ref:k,onSubmit:e.withModifiers(Z,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",M.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E),(G,O)=>(e.openBlock(),e.createElementBlock("div",{key:G.name,class:e.normalizeClass(B(G)==="horizontal"?"col-span-12":`col-span-${G.col||12}`)},[e.createVNode(Gn,{style:e.normalizeStyle(l.style),item:G,layout:B(G),columns:T(G),"model-value":c.value[G.name],"onUpdate:modelValue":A=>{const W=c.value[G.name];I(W,A)||(c.value[G.name]=A)},error:e.unref(d)[G.name],onValueSelected:J},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),B(G)==="settings"&&O+1!==e.unref(E).length?(e.openBlock(),e.createElementBlock("div",ru)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(Yd,{target:k.value,"scroll-container":v.value,enabled:g.value,width:x.value},null,8,["target","scroll-container","enabled","width"])]))}}),su={class:"relative"},iu={class:"w-full h-full fixed top-0 start-0 bg-black bg-opacity-50"},cu={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"},du={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},uu={class:"font-medium text-gray-800 dark:text-[#ffffff]"},pu={class:"p-4 mim-h-0 h-full overflow-auto"},Zn=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{},api:{},method:{}},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||""),c=e.ref(n.mode),d=()=>{const v=n.method?.trim().toUpperCase();return v==="GET"||v==="POST"||v==="PUT"?v:c.value==="add"?"POST":"PUT"},p=()=>{ge.notify({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`})},h=async v=>{if(console.log(v),v.ok){await v.json().catch(()=>({})),p(),a("save",r.value);return}if(v.status===400){const f=await v.json().catch(()=>({}));ge.notify({type:"warning",title:"Помилка валідації",message:f.message||"Некоректні дані (400)"});return}if(v.status===500){ge.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"});return}ge.notify({type:"error",title:"Помилка",message:`Статус: ${v.status}`})};async function E(){const v=s.value.validate();if(v){ge.notify({type:"warning",title:"Помилка валідації",message:Object.entries(v).map(([g,x])=>`${g}: ${x}`).join(`
|
|
3
|
+
`)});return}const f=n.api?.trim();if(f){const g=d();try{const x=await fetch(f,{method:g,headers:g==="GET"?void 0:{"Content-Type":"application/json"},body:g==="GET"?void 0:JSON.stringify(r.value)});await h(x)}catch(x){ge.notify({type:"error",title:"Помилка з’єднання",message:x.message||"Не вдалося виконати запит"})}return}if(i.value)try{const g=await fetch(`/api/table/${i.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r.value)});await h(g)}catch(g){ge.notify({type:"error",title:"Помилка з’єднання",message:g.message||"Не вдалося виконати запит"})}else a("edit",r.value),k()}function k(){a("close")}return e.onMounted(async()=>{try{if(n.form&&!n.schema){const v=await fetch(`/api/template/form/${n.form}`);if(!v.ok){ge.notify({type:v.status>=400&&v.status<500?"warning":"error",title:"Error",message:`Error code: ${v.status}`});return}const f=await v.json();o.value=f.schema,f.token&&(i.value=f.token)}else if(n.token&&!n.defaultValue){i.value=n.token;const v=await fetch(`/api/form/${i.value}`);if(!v.ok){ge.notify({type:v.status>=400&&v.status<500?"warning":"error",title:"Error",message:`Error code: ${v.status}`});return}const f=await v.json();o.value=f.schema,f.data?r.value=f.data:c.value="add",f.obj&&(r.value={...r.value,...f.obj})}}catch(v){ge.notify({type:"error",title:"Error",message:v.message||"Unexpected error"}),console.error(v)}}),(v,f)=>(e.openBlock(),e.createElementBlock("div",su,[e.createElementVNode("div",iu,[e.createElementVNode("div",cu,[e.createElementVNode("div",du,[e.createElementVNode("h3",uu,e.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:k,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"},[...f[2]||(f[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",pu,[o.value?(e.openBlock(),e.createBlock(He,{key:0,schema:o.value,values:r.value,"onUpdate:values":f[0]||(f[0]=g=>r.value=g),form:s.value,"onUpdate:form":f[1]||(f[1]=g=>s.value=g),formId:i.value},null,8,["schema","values","form","formId"])):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:k,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:E,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"}," Зберегти ")])])])]))}}),mu=1440*60*1e3,fu=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],hu=["січ","лют","бер","квіт","трав","черв","лип","серп","вер","жовт","лист","груд"],gu=["нд","пн","вт","ср","чт","пт","сб"];function Ee(l){return l instanceof Date&&!Number.isNaN(l.getTime())}const lt=l=>new Date(l.getTime());function Qe(l){const t=lt(l);return t.setHours(0,0,0,0),t}function dt(l){const t=lt(l);return t.setHours(23,59,59,999),t}function cn(l){return Qe(new Date(l.getFullYear(),l.getMonth(),1))}function dn(l){return dt(new Date(l.getFullYear(),l.getMonth()+1,0))}function un(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 yu(l,t){return un(l,-1)}function Ft(l,t){const n=new Date(l);return n.setFullYear(n.getFullYear()+t),n}function Jn(l,t){return Ft(l,-t)}function Xn(l){return Qe(new Date(l.getFullYear(),0,1))}function Qn(l){return dt(new Date(l.getFullYear(),11,31))}function ku(l){const t=Math.floor(l.getFullYear()/10)*10;return Qe(new Date(t,0,1))}function bu(l){const t=Math.floor(l.getFullYear()/10)*10+9;return dt(new Date(t,11,31))}const Oe=l=>l.getFullYear(),Lt=l=>Math.floor(l.getFullYear()/10)*10;function wu(l){const t=[];let n=Qe(l.start);const a=Qe(l.end);for(;n<=a;)t.push(lt(n)),n=new Date(n.getTime()+mu);return t}function xu(l){const t=[];let n=cn(l.start);const a=dn(l.end);for(;n<=a;)t.push(lt(n)),n=un(n,1);return t}function _u(l){const t=[];let n=Xn(l.start);const a=Qn(l.end);for(;n<=a;)t.push(lt(n)),n=Ft(n,1);return t}function pn(l,t=1){const n=Qe(l),a=(n.getDay()-t+7)%7;return n.setDate(n.getDate()-a),n}function vu(l,t=1){const n=pn(l,t);return n.setDate(n.getDate()+6),dt(n)}function Eu(l,t,n=0){const a=pn(l,n),o=(t-n+7)%7;return a.setDate(a.getDate()+o),a}const It=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth()&&l.getDate()===t.getDate(),mn=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth(),el=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear(),tl=(l,t)=>!!l&&!!t&&It(l,t)&&l.getHours()===t.getHours(),Vu=(l,t)=>!!l&&!!t&&tl(l,t)&&l.getMinutes()===t.getMinutes();function Bu(l,t){const n=l.getTime();return n>=t.start.getTime()&&n<=t.end.getTime()}const ut=(l,t)=>!!l&&!!t&&l.getTime()<t.getTime(),pt=(l,t)=>!!l&&!!t&&l.getTime()>t.getTime();function Cu(l){const t=l.filter(n=>Ee(n));if(t.length)return t.reduce((n,a)=>n.getTime()>=a.getTime()?n:a)}function Su(l){const t=l.filter(n=>Ee(n));if(t.length)return t.reduce((n,a)=>n.getTime()<=a.getTime()?n:a)}function nl(l,t){const n=lt(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 Tt=(l,t=2)=>String(l).padStart(t,"0");function ll(l,t){return t==="wide"?fu[l]:hu[l]}function Nu(l){return gu[l]}const $u=[{token:"LLLL",format:l=>ll(l.getMonth(),"wide")},{token:"LLL",format:l=>ll(l.getMonth(),"abbreviated")},{token:"EE",format:l=>Nu(l.getDay())},{token:"yyyy",format:l=>String(l.getFullYear())},{token:"MM",format:l=>Tt(l.getMonth()+1)},{token:"dd",format:l=>Tt(l.getDate())},{token:"HH",format:l=>Tt(l.getHours())},{token:"mm",format:l=>Tt(l.getMinutes())}];function Ot(l,t){if(!Ee(l))return"";let n="",a=0;for(;a<t.length;){const o=$u.find(r=>t.startsWith(r.token,a));o?(n+=o.format(l),a+=o.token.length):(n+=t[a],a+=1)}return n}const Mu={"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 al(l,t){const n=Mu[t];if(!n){const o=new Date(l);return Ee(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 Ee(i)?i:null}case"dd.MM.yyyy":{const[,o,r,s]=a,i=new Date(Number(s),Number(r)-1,Number(o));return Ee(i)?i:null}case"dd.MM.yyyy HH:mm":{const[,o,r,s,i,c]=a,d=new Date(Number(s),Number(r)-1,Number(o),Number(i),Number(c));return Ee(d)?d: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 Du=["year","month","day","time","custom"],Au=e.defineComponent({emits:{elementClick:l=>Ee(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"&&Du.includes(l)}}}),Fu={class:"v3dp__heading"},Lu=["disabled"],Iu=["disabled"],Tu={class:"v3dp__body"},Ou={class:"v3dp__subheading"},zu={class:"v3dp__elements"},Ru=["disabled","onClick"];function ju(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",Fu,[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,Lu),(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,Iu)]),e.createElementVNode("div",Tu,["subheading"in l.$slots?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Ou,[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",zu,[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,Ru))),128))],!0)])])],38)}const zt=ae(Au,[["render",ju],["__scopeId","data-v-5de7813f"]]),Pu=e.defineComponent({components:{PickerPopup:zt},emits:{"update:pageDate":l=>Ee(l),select:l=>Ee(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(()=>ku(l.pageDate)),a=e.computed(()=>bu(l.pageDate)),o=(h,E,k)=>!E&&!k?!0:!(E&&Oe(h)<Oe(E)||k&&Oe(h)>Oe(k)),r=e.computed(()=>_u({start:n.value,end:a.value}).map(h=>({value:h,key:String(Oe(h)),display:Oe(h),selected:!!l.selected&&Oe(h)===Oe(l.selected),disabled:!o(h,l.lowerLimit,l.upperLimit)}))),s=e.computed(()=>{const h=Oe(n.value),E=Oe(a.value);return`${h} - ${E}`}),i=e.computed(()=>l.lowerLimit&&(Lt(l.lowerLimit)===Lt(l.pageDate)||ut(l.pageDate,l.lowerLimit))),c=e.computed(()=>l.upperLimit&&(Lt(l.upperLimit)===Lt(l.pageDate)||pt(l.pageDate,l.upperLimit)));return{years:r,heading:s,leftDisabled:i,rightDisabled:c,previousPage:()=>t("update:pageDate",Jn(l.pageDate,10)),nextPage:()=>t("update:pageDate",Ft(l.pageDate,10))}}});function Uu(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 Hu=ae(Pu,[["render",Uu]]),qu=e.defineComponent({components:{PickerPopup:zt},emits:{"update:pageDate":l=>Ee(l),select:l=>Ee(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(()=>Xn(l.pageDate)),a=e.computed(()=>Qn(l.pageDate)),o=e.computed(()=>E=>Ot(E,l.format)),r=(E,k,v)=>!k&&!v?!0:!(k&&ut(E,cn(k))||v&&pt(E,dn(v))),s=e.computed(()=>xu({start:n.value,end:a.value}).map(E=>({value:E,display:o.value(E),key:o.value(E),selected:!!l.selected&&mn(l.selected,E),disabled:!r(E,l.lowerLimit,l.upperLimit)}))),i=e.computed(()=>Oe(n.value)),c=e.computed(()=>l.lowerLimit&&(el(l.lowerLimit,l.pageDate)||ut(l.pageDate,l.lowerLimit))),d=e.computed(()=>l.upperLimit&&(el(l.upperLimit,l.pageDate)||pt(l.pageDate,l.upperLimit)));return{months:s,heading:i,leftDisabled:c,rightDisabled:d,previousPage:()=>t("update:pageDate",Jn(l.pageDate,1)),nextPage:()=>t("update:pageDate",Ft(l.pageDate,1))}}});function Ku(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 Gu=ae(qu,[["render",Ku]]),Yu=e.defineComponent({components:{PickerPopup:zt},emits:{"update:pageDate":l=>Ee(l),select:l=>Ee(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(()=>g=>x=>Ot(x,g)),a=e.computed(()=>cn(l.pageDate)),o=e.computed(()=>dn(l.pageDate)),r=e.computed(()=>({start:a.value,end:o.value})),s=e.computed(()=>({start:pn(a.value,l.weekStartsOn),end:vu(o.value,l.weekStartsOn)})),i=e.computed(()=>l.customWeekdays?.length===7?l.customWeekdays:null),c=e.computed(()=>{const g=l.weekStartsOn,x=i.value;if(x)return Array.from({length:7}).map((w,b)=>x[(g+b)%7]);const y=n.value(l.weekdayFormat);return Array.from(Array(7)).map((w,b)=>(g+b)%7).map(w=>Eu(new Date,w,l.weekStartsOn)).map(y)}),d=(g,x,y,w)=>w?.dates?.some(b=>It(g,b))||w?.predicate?.(g)?!1:!x&&!y?!0:!(x&&ut(g,Qe(x))||y&&pt(g,dt(y))),p=e.computed(()=>{const g=new Date,x=n.value(l.format);return wu(s.value).map(y=>({value:y,display:x(y),selected:!!l.selected&&It(l.selected,y),current:It(g,y),disabled:!l.allowOutsideInterval&&!Bu(y,r.value)||!d(y,l.lowerLimit,l.upperLimit,l.disabledDates),key:n.value("yyyy-MM-dd")(y)}))}),h=e.computed(()=>n.value(l.headingFormat)(l.pageDate)),E=e.computed(()=>l.lowerLimit&&(mn(l.lowerLimit,l.pageDate)||ut(l.pageDate,l.lowerLimit))),k=e.computed(()=>l.upperLimit&&(mn(l.upperLimit,l.pageDate)||pt(l.pageDate,l.upperLimit)));return{weekDays:c,days:p,heading:h,leftDisabled:E,rightDisabled:k,previousPage:()=>t("update:pageDate",yu(l.pageDate)),nextPage:()=>t("update:pageDate",un(l.pageDate,1))}}});function Wu(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,c)=>(e.openBlock(),e.createElementBlock("span",{key:i,class:e.normalizeClass(`v3dp__subheading__weekday__${c}`)},e.toDisplayString(i),3))),128))]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const Zu=ae(Yu,[["render",Wu]]);function ol(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 Ju=e.defineComponent({components:{PickerPopup:zt},emits:{select:l=>Ee(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,k=>{let v=0,f=0;k&&(v=k.getHours(),f=k.getMinutes()),r.value=v,s.value=f});const i=e.computed(()=>[...Array(24).keys()].map(k=>({value:k,date:nl(new Date(o.value.getTime()),{hours:k,minutes:s.value,seconds:0}),selected:r.value===k,ref:e.ref(null)}))),c=e.computed(()=>[...Array(60).keys()].map(k=>({value:k,date:nl(new Date(o.value.getTime()),{hours:r.value,minutes:k,seconds:0}),selected:s.value===k,ref:e.ref(null)}))),d=k=>{s.value=k.value,t("select",k.date)},p=()=>{const k=i.value.find(f=>f.ref.value?.classList?.contains("selected")??!1),v=c.value.find(f=>f.ref.value?.classList?.contains("selected")??!1);k&&v&&(ol(n.value,k.ref.value),ol(a.value,v.ref.value))};return e.watch(()=>l.visible,k=>{k&&e.nextTick(p)}),{hoursListRef:n,minutesListRef:a,hours:r,minutes:s,hoursList:i,minutesList:c,padStartZero:k=>`0${k}`.substr(-2),selectMinutes:d,isEnabled:k=>!(l.disabledTime?.dates?.some(v=>tl(k,v)&&Vu(k,v))||l.disabledTime?.predicate?.(k)),scroll:p}}}),Xu={ref:"hoursListRef",class:"v3dp__column"},Qu=["disabled","onClick"],ep={ref:"minutesListRef",class:"v3dp__column"},tp=["disabled","onClick"];function np(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",Xu,[(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(c=>l.hours=i.value,["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,Qu))),128))],512),e.createElementVNode("div",ep,[(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(c=>l.selectMinutes(i),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,tp))),128))],512)]),_:1})}const lp=ae(Ju,[["render",np],["__scopeId","data-v-43e01bf7"]]),Rt=["time","day","month","year"],ap=(l,t,n=void 0)=>{let a=n||new Date;const o=Cu([l,a]);o&&(a=o);const r=Su([t,a]);return r&&(a=r),a},op=e.defineComponent({components:{YearPicker:Hu,MonthPicker:Gu,DayPicker:Zu,TimePicker:lp},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"&&Rt.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"&&Rt.includes(l)}},emits:{"update:modelValue":l=>l==null||Ee(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(""),c=O=>{const A=O.replace(/[a-zA-Z]/g,"0");return/0/.test(A)?A:""},d=e.computed(()=>c(l.inputFormat));let p=null,h=null;const E=()=>{p?.destroy(),p=null},k=async()=>{if(!h){const{default:O}=await Promise.resolve().then(()=>kn);h=O}return h},v=()=>{p&&p.value!==i.value&&(p.value=i.value??"")},f=async()=>{if(E(),!r.value||!d.value)return;p=(await k())(r.value,{mask:d.value,lazy:!0,overwrite:!0}),v()};e.watchEffect(()=>{if(!i.value)return;const O=al(i.value,l.inputFormat);O&&(o.value=O)}),e.watchEffect(()=>{i.value=l.modelValue&&Ee(l.modelValue)?Ot(l.modelValue,l.inputFormat):""}),e.onMounted(()=>{d.value&&e.nextTick(()=>{f()})}),e.onBeforeUnmount(()=>{E()}),e.watch(d,O=>{O?e.nextTick(()=>{f()}):E()}),e.watch(i,()=>{v()});const g=(O="none")=>{l.disabled||(O!=="none"&&a.value==="none"&&(o.value=l.modelValue||ap(l.lowerLimit,l.upperLimit,o.value)),a.value=O,t(O!=="none"?"opened":"closed"))};e.watchEffect(()=>{l.disabled&&(a.value="none")});const x=(O,A)=>{o.value=A,O==="year"?t("decadePageChanged",A):O==="month"?t("yearPageChanged",A):O==="day"&&t("monthPageChanged",A)},y=O=>{o.value=O,l.minimumView==="year"?(g("none"),t("update:modelValue",O)):a.value="month"},w=O=>{o.value=O,l.minimumView==="month"?(g("none"),t("update:modelValue",O)):a.value="day"},b=O=>{o.value=O,l.minimumView==="day"?(g("none"),t("update:modelValue",O)):a.value="time"},S=O=>{g("none"),t("update:modelValue",O)},M=()=>{l.clearable&&(g("none"),t("update:modelValue",null),o.value=l.startingViewDate)},B=()=>s.value=!0,T=()=>g(I.value),Z=()=>{s.value=!1,g()},J=O=>{const A=O.keyCode?O.keyCode:O.which;if([27,13].includes(A)&&r.value.blur(),l.typeable){const H=al(r.value.value,l.inputFormat);H&&i.value===Ot(H,l.inputFormat)&&(i.value=r.value.value,t("update:modelValue",H))}},I=e.computed(()=>{const O=Rt.indexOf(l.startingView),A=Rt.indexOf(l.minimumView);return O<A?l.minimumView:l.startingView}),F=O=>Object.fromEntries(Object.entries(O??{}).filter(([A,W])=>A.startsWith("--"))),R=e.computed(()=>l.weekDayNames?.length===7?l.weekDayNames:void 0);return{blur:Z,focus:T,click:B,input:i,inputRef:r,pageDate:o,renderView:g,updatePageDate:x,selectYear:y,selectMonth:w,selectDay:b,selectTime:S,keyUp:J,normalizedWeekdayNames:R,viewShown:a,goBackFromTimepicker:()=>l.startingView==="time"&&l.minimumView==="time"?null:a.value="day",clearModelValue:M,initialView:I,log:O=>console.log(O),variables:F}}}),rp={class:"v3dp__input_wrapper"},sp=["readonly","placeholder","disabled","tabindex"],ip={class:"v3dp__clearable"};function cp(l,t,n,a,o,r){const s=e.resolveComponent("year-picker"),i=e.resolveComponent("month-picker"),c=e.resolveComponent("day-picker"),d=e.resolveComponent("time-picker");return e.openBlock(),e.createElementBlock("div",{class:"v3dp__datepicker",style:e.normalizeStyle(l.variables(l.$attrs.style))},[e.createElementVNode("div",rp,[e.withDirectives(e.createElementVNode("input",e.mergeProps({type:"text",ref:"inputRef",readonly:!l.typeable,"onUpdate:modelValue":t[0]||(t[0]=p=>l.input=p)},l.$attrs,{placeholder:l.placeholder,disabled:l.disabled,tabindex:l.disabled?-1:0,onKeyup:t[1]||(t[1]=(...p)=>l.keyUp&&l.keyUp(...p)),onBlur:t[2]||(t[2]=(...p)=>l.blur&&l.blur(...p)),onFocus:t[3]||(t[3]=(...p)=>l.focus&&l.focus(...p)),onClick:t[4]||(t[4]=(...p)=>l.click&&l.click(...p))}),null,16,sp),[[e.vModelText,l.input]]),e.withDirectives(e.createElementVNode("div",ip,[e.renderSlot(l.$slots,"clear",{onClear:l.clearModelValue},()=>[e.createElementVNode("i",{onClick:t[5]||(t[5]=p=>l.clearModelValue())},"x")])],512),[[e.vShow,l.clearable&&l.modelValue]])]),e.withDirectives(e.createVNode(s,{pageDate:l.pageDate,"onUpdate:pageDate":t[6]||(t[6]=p=>l.updatePageDate("year",p)),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]=p=>l.updatePageDate("month",p)),selected:l.modelValue,onSelect:l.selectMonth,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,format:l.monthListFormat,onBack:t[8]||(t[8]=p=>l.viewShown="year")},null,8,["pageDate","selected","onSelect","lowerLimit","upperLimit","format"]),[[e.vShow,l.viewShown==="month"]]),e.withDirectives(e.createVNode(c,{pageDate:l.pageDate,"onUpdate:pageDate":t[9]||(t[9]=p=>l.updatePageDate("day",p)),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]=p=>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(d,{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 dp=ae(op,[["render",cp]]),up=ae(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}=Se(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]||""),c=e.computed(()=>["py-1.5 px-3 block w-full placeholder:text-[#767f8f] bg-white",o.value,n.customClass,{"!border-red-600":n.error}]),d=e.computed(()=>!n.modelValue&&n.now?new Date:null),p=e.computed({get:()=>w(n.modelValue??d.value,r.value)||void 0,set:A=>a("update:modelValue",b(A,r.value))}),h=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],E=e.computed(()=>{if(n.dayNames?.length)return n.dayNames.length===7?n.dayNames:h}),k=e.computed(()=>{const A=n.weekStart,W=typeof A=="string"?Number(A):A;return W===void 0||Number.isNaN(W)?1:Math.min(6,Math.max(0,W))}),v=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"}}}),f={date:"dd.MM.yyyy",datetime:"dd.MM.yyyy HH:mm",month:"MM.yyyy",time:"HH:mm",week:"dd.MM.yyyy",year:"yyyy"},g=e.computed(()=>f[r.value]||"dd.MM.yyyy"),x=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"})),y=e.ref(!1);e.watch(()=>n.modelValue,A=>{A?y.value=!0:n.now||(y.value=!1)},{immediate:!0}),e.watchEffect(()=>{n.now&&!n.modelValue&&!y.value&&(a("update:modelValue",b(new Date,r.value)),y.value=!0)});function w(A,W){if(!A)return null;if(A instanceof Date&&!Number.isNaN(A.getTime()))return A;if(typeof A!="string")return null;switch(W){case"datetime":return T(A);case"time":return I(A);case"month":return Z(A);case"year":return J(A);case"week":return F(A);default:return B(A)}}function b(A,W){if(!A)return null;const H=A instanceof Date?A:w(A,W);if(!H)return null;switch(W){case"datetime":return`${S(H)}T${M(H)}`;case"time":return M(H);case"month":return`${H.getFullYear()}-${O(H.getMonth()+1)}`;case"year":return`${H.getFullYear()}`;case"week":{const{year:pe,week:me}=R(H);return`${pe}-W${O(me)}`}default:return S(H)}}function S(A){return`${A.getFullYear()}-${O(A.getMonth()+1)}-${O(A.getDate())}`}function M(A){return`${O(A.getHours())}:${O(A.getMinutes())}`}function B(A){const W=A.split("-");if(W.length<3)return null;const[H,pe,me]=W.map(Number);return!H||!pe||!me?null:new Date(H,pe-1,me)}function T(A){const W=A.includes("T")?A:A.replace(" ","T"),H=new Date(W);return Number.isNaN(H.getTime())?null:H}function Z(A){const[W,H]=A.split("-").map(Number);return!W||Number.isNaN(H)?null:new Date(W,(H||1)-1,1)}function J(A){const W=Number(A);return W?new Date(W,0,1):null}function I(A){const W=A.match(/^(\d{1,2}):(\d{2})$/);if(!W)return null;const[,H,pe]=W,me=new Date;return me.setHours(Number(H),Number(pe),0,0),me}function F(A){const W=A.match(/^(\d{4})-W(\d{2})$/);if(!W)return null;const[,H,pe]=W,me=Number(pe);return G(Number(H),me)}function R(A){const W=new Date(Date.UTC(A.getFullYear(),A.getMonth(),A.getDate())),H=W.getUTCDay()||7;W.setUTCDate(W.getUTCDate()+4-H);const pe=new Date(Date.UTC(W.getUTCFullYear(),0,1)),me=Math.ceil(((W.getTime()-pe.getTime())/864e5+1)/7);return{year:W.getUTCFullYear(),week:me}}function G(A,W){if(!A||!W)return null;const H=new Date(A,0,1+(W-1)*7),pe=H.getDay(),me=H;return pe<=4?me.setDate(H.getDate()-H.getDay()+1):me.setDate(H.getDate()+8-H.getDay()),me}function O(A){return String(A).padStart(2,"0")}return(A,W)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vs-date-picker",n.customClass]),style:e.normalizeStyle(x.value)},[e.createVNode(dp,{modelValue:p.value,"onUpdate:modelValue":W[0]||(W[0]=H=>p.value=H),placeholder:i.value,disabled:n.disabled,clearable:n.clearable,typeable:n.editable,"week-day-names":E.value,"week-starts-on":k.value,"starting-view":v.value.startingView,"minimum-view":v.value.minimumView,"input-format":g.value,name:n.name,class:e.normalizeClass(c.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-97661afe"]]),rl=(l={mode:"edit",schema:null})=>new Promise(t=>{const{close:n}=ge.modal({title:l.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Zn,contentProps:{...l,onClose:()=>{t(null),n()},onSave:a=>{t(a),n()}}})});He.install=function(t){t.component("VForm",He),Object.assign(t.config.globalProperties,{$form:rl}),t.provide("form",rl),window.v3plugin||(window.v3plugin={})};function Ke(l){return typeof l=="string"||l instanceof String}function sl(l){var t;return typeof l=="object"&&l!=null&&(l==null||(t=l.constructor)==null?void 0:t.name)==="Object"}function il(l,t){return Array.isArray(t)?il(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 cl(l){switch(l){case Q.LEFT:return Q.FORCE_LEFT;case Q.RIGHT:return Q.FORCE_RIGHT;default:return l}}function fn(l){return l.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function jt(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(!jt(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,c=l instanceof RegExp;if(i&&c)return t.toString()==l.toString();if(i!=c)return!1;const d=Object.keys(t);for(o=0;o<d.length;o++)if(!Object.prototype.hasOwnProperty.call(l,d[o]))return!1;for(o=0;o<d.length;o++)if(!jt(l[d[o]],t[d[o]]))return!1;return!0}else if(t&&l&&typeof t=="function"&&typeof l=="function")return t.toString()===l.toString();return!1}class pp{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 se(l,t){return new se.InputMask(l,t)}function dl(l){if(l==null)throw new Error("mask property should be defined");return l instanceof RegExp?se.MaskedRegExp:Ke(l)?se.MaskedPattern:l===Date?se.MaskedDate:l===Number?se.MaskedNumber:Array.isArray(l)||l===Array?se.MaskedDynamic:se.Masked&&l.prototype instanceof se.Masked?l:se.Masked&&l instanceof se.Masked?l.constructor:l instanceof Function?se.MaskedFunction:(console.warn("Mask not found for mask",l),se.Masked)}function at(l){if(!l)throw new Error("Options in not defined");if(se.Masked){if(l.prototype instanceof se.Masked)return{mask:l};const{mask:t=void 0,...n}=l instanceof se.Masked?{mask:l}:sl(l)&&l.mask instanceof se.Masked?l:{};if(t){const a=t.mask;return{...il(t,(o,r)=>!r.startsWith("_")),mask:t.constructor,_mask:a,...n}}}return sl(l)?{...l}:{mask:l}}function je(l){if(se.Masked&&l instanceof se.Masked)return l;const t=at(l),n=dl(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)}se.createMask=je;class Pt{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}}se.MaskElement=Pt;const ul=90,mp=89;class mt extends Pt{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===ul&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===mp&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===ul&&(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={}}}se.HTMLMaskElement=mt;class pl extends mt{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}}se.HTMLMaskElement=mt;class hn extends mt{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}}se.HTMLContenteditableMaskElement=hn;class Ut{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>Ut.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}}Ut.MAX_LENGTH=100;class ml{constructor(t,n){this.el=t instanceof Pt?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new hn(t):new pl(t),this.masked=je(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Ut,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 se.Masked)&&this.masked.constructor===dl(t)){this.masked.updateOptions({mask:t});return}const n=t instanceof se.Masked?t:je({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 pp({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}}se.InputMask=ml;class ce{static normalize(t){return Array.isArray(t)?t:[t,new ce]}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}}se.ChangeDetails=ce;class Pe{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 Ve{constructor(t){this._value="",this._update({...Ve.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 Pe(this.extractInput(t,n),t)}appendTail(t){return Ke(t)&&(t=new Pe(String(t))),t.appendTo(this)}_appendCharRaw(t,n){return t?(this._value+=t,new ce({inserted:t,rawInserted:t})):new ce}_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 c=this._appendCharRaw(t,n);i=i.aggregate(c),c.rawInserted||i.equals(r)?r=i:this.state=s}if(r.inserted){let s,i=this.doValidate(n)!==!1;if(i&&a!=null){const c=this.state;if(this.overwrite===!0){s=a.state;for(let p=0;p<r.rawInserted.length;++p)a.unshift(this.displayValue.length-r.tailShift)}let d=this.appendTail(a);if(i=d.rawInserted.length===a.toString().length,!(i&&d.inserted)&&this.overwrite==="shift"){this.state=c,s=a.state;for(let p=0;p<r.rawInserted.length;++p)a.shift();d=this.appendTail(a),i=d.rawInserted.length===a.toString().length}i&&d.inserted&&(this.state=c)}i||(r=new ce,this.state=o,a&&s&&(a.state=s))}return r}_appendPlaceholder(){return new ce}_appendEager(){return new ce}append(t,n,a){if(!Ke(t))throw new Error("value should be string");const o=Ke(a)?new Pe(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 ce}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={}),ce.normalize(this.prepare?this.prepare(t,this,n):t)}doPrepareChar(t,n){return n===void 0&&(n={}),ce.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),c=this.eager===!0||this.eager==="remove";let d;c&&(o=cl(o),d=this.extractInput(0,s,{raw:!0}));let p=t;const h=new ce;if(o!==Q.NONE&&(p=this.nearestInputPos(t,n>1&&t!==0&&!c?Q.NONE:o),h.tailShift=p-t),h.aggregate(this.remove(p)),c&&o!==Q.NONE&&d===this.rawInputValue)if(o===Q.FORCE_LEFT){let E;for(;d===this.rawInputValue&&(E=this.displayValue.length);)h.aggregate(new ce({tailShift:-1})).aggregate(this.remove(E-1))}else o===Q.FORCE_RIGHT&&i.unshift();return h.aggregate(this.append(a,r,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!jt(this,t)}typedValueEquals(t){const n=this.typedValue;return t===n||Ve.EMPTY_VALUES.includes(t)&&Ve.EMPTY_VALUES.includes(n)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new ce}}Ve.DEFAULTS={skipInvalid:!0},Ve.EMPTY_VALUES=[void 0,null,""],se.Masked=Ve;class Ge{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=Ke(t)?new Pe(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 Pe)a?n.extend(t.toString()):this.chunks.push(t);else if(t instanceof Ge){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 se.MaskedPattern))return new Pe(this.toString()).appendTo(t);const n=new ce;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 Ge||t._stops.indexOf(s)>=0)&&n.aggregate(t._appendPlaceholder(s)),i=o instanceof Ge&&t._blocks[s]),i){const c=i.appendTail(o);n.aggregate(c);const d=o.toString().slice(c.rawInserted.length);d&&n.aggregate(t.append(d,{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 Ge:new Pe;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 fp{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 gn{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 ce}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 ce;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 ce({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 ce;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new Pe("")}appendTail(t){return Ke(t)&&(t=new Pe(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 ft{constructor(t){const{parent:n,isOptional:a,placeholderChar:o,displayChar:r,lazy:s,eager:i,...c}=t;this.masked=je(c),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 ce}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 ce;const a=this.masked.state;let o=this.masked._appendChar(t,this.currentMaskFlags(n));return o.inserted&&this.doValidate(n)===!1&&(o=new ce,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 ce:(this.isFilled=!0,new ce({inserted:this.placeholderChar}))}_appendEager(){return new ce}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 ce}}ft.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 fl extends Ve{updateOptions(t){super.updateOptions(t)}_update(t){const n=t.mask;n&&(t.validate=a=>a.search(n)>=0),super._update(t)}}se.MaskedRegExp=fl;class Be extends Ve{constructor(t){super({...Be.DEFAULTS,...t,definitions:Object.assign({},ft.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 d=n.slice(r),p=Object.keys(this.blocks).filter(E=>d.indexOf(E)===0);p.sort((E,k)=>k.length-E.length);const h=p[0];if(h){const{expose:E,repeat:k,...v}=at(this.blocks[h]),f={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...v,repeat:k,parent:this},g=k!=null?new se.RepeatBlock(f):je(f);g&&(this._blocks.push(g),E&&(this.exposeBlock=g),this._maskedBlocks[h]||(this._maskedBlocks[h]=[]),this._maskedBlocks[h].push(this._blocks.length-1)),r+=h.length-1;continue}}let s=n[r],i=s in t;if(s===Be.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){a=!a;continue}if(s==="["||s==="]"){o=!o;continue}if(s===Be.ESCAPE_CHAR){if(++r,s=n[r],!s)break;i=!1}const c=i?new ft({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...at(t[s]),parent:this}):new gn({char:s,eager:this.eager,isUnmasking:a});this._blocks.push(c)}}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 ce;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 ce;if(!a)return o;for(let s=a.index,i;i=this._blocks[s];++s){var r;const c=i._appendChar(t,{...n,_beforeTailState:(r=n._beforeTailState)==null||(r=r._blocks)==null?void 0:r[s]});if(o.aggregate(c),c.consumed)break}return o}extractTail(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=new Ge;return t===n||this._forEachBlocksInRange(t,n,(o,r,s,i)=>{const c=o.extractTail(s,i);c.stop=this._findStopBefore(r),c.from=this._blockStartPos(r),c instanceof Ge&&(c.blockIndex=r),a.extend(c)}),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,c)=>{o+=r.extractInput(i,c,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 ce;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,c=r&&s?r.offset:this._blocks[o.index].displayValue.length;if(a(this._blocks[o.index],o.index,i,c),r&&!s){for(let d=o.index+1;d<r.index;++d)a(this._blocks[d],d,0,this._blocks[d].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 fp(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 ce;return this._forEachBlocksInRange(0,this.displayValue.length,a=>n.aggregate(a.pad(t))),n}}Be.DEFAULTS={...Ve.DEFAULTS,lazy:!0,placeholderChar:"_"},Be.STOP_CHAR="`",Be.ESCAPE_CHAR="\\",Be.InputDefinition=ft,Be.FixedDefinition=gn,se.MaskedPattern=Be;class ht extends Be{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"),c=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<c.length&&c[d]===i[d];)++d;s.mask=c.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),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 ce;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}}se.MaskedRange=ht;const hp="d{.}`m{.}`Y";class Ue extends Be{static extractPatternOptions(t){const{mask:n,pattern:a,...o}=t;return{...o,mask:Ke(n)?n:a}}constructor(t){super(Ue.extractPatternOptions({...Ue.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:n,pattern:a,blocks:o,...r}={...Ue.DEFAULTS,...t},s=Object.assign({},Ue.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:Ke(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(Ue.extractPatternOptions(t))}}Ue.GET_DEFAULT_BLOCKS=()=>({d:{mask:ht,from:1,to:31,maxLength:2},m:{mask:ht,from:1,to:12,maxLength:2},Y:{mask:ht,from:1900,to:9999}}),Ue.DEFAULTS={...Be.DEFAULTS,mask:Date,pattern:hp,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)}},se.MaskedDate=Ue;class gt extends Ve{constructor(t){super({...gt.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}=at(n),r=je({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),c=this.currentMask,d=new ce,p=c?.state;return this.currentMask=this.doDispatch(t,{...n},a),this.currentMask&&(this.currentMask!==c?(this.currentMask.reset(),s&&(this.currentMask.append(s,{raw:!0}),d.tailShift=this.currentMask.value.length-o.length),i&&(d.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):p&&(this.currentMask.state=p)),d}_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 ce;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 ce;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 jt(n,r)&&n.maskEquals(o)}):super.maskEquals(t)}typedValueEquals(t){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(t))}}gt.DEFAULTS={...Ve.DEFAULTS,dispatch:(l,t,n,a)=>{if(!t.compiledMasks.length)return;const o=t.rawInputValue,r=t.compiledMasks.map((s,i)=>{const c=t.currentMask===s,d=c?s.displayValue.length:s.nearestInputPos(s.displayValue.length,Q.FORCE_LEFT);return s.rawInputValue!==o?(s.reset(),s.append(o,{raw:!0})):c||s.remove(d),s.append(l,t.currentMaskFlags(n)),s.appendTail(a),{index:i,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(d,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]}},se.MaskedDynamic=gt;class yt extends Be{constructor(t){super({...yt.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 c=o[0][i];i>=this.value.length||c===s.value||(s.reset(),s._appendChar(c,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 ce({skip:!this.isComplete})}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new Pe("",t)}remove(t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),t===n)return new ce;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}}yt.DEFAULTS={...Be.DEFAULTS,matchValue:(l,t,n)=>l.indexOf(t,n)===n},se.MaskedEnum=yt;class hl extends Ve{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}se.MaskedFunction=hl;var gl;class De extends Ve{constructor(t){super({...De.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",a=(this.scale?"("+fn(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+n+a),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(fn).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(fn(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),c=!1;if(i){let E;this.min!=null&&this.min<0&&this.number<this.min&&(E=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(E=this.max),E!=null&&(this.autofix?(this._value=this.format(E,this).replace(De.UNMASKED_RADIX,this.radix),c||(c=r===this._value&&!n.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let d;i?d=new ce({inserted:this._value.slice(r.length),rawInserted:c?"":t,skip:c}):(this._value=r,d=new ce),this._value=this._insertThousandsSeparators(this._value);const p=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,h=this._separatorsCountFromSlice(p);return d.tailShift+=(h-o)*this.thousandsSeparator.length,d}_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 ce({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===De.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,De.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(De.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)||De.EMPTY_VALUES.includes(t)&&De.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}gl=De,De.UNMASKED_RADIX=".",De.EMPTY_VALUES=[...Ve.EMPTY_VALUES,0],De.DEFAULTS={...Ve.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[gl.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})},se.MaskedNumber=De;const Ht={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function yn(l,t,n){t===void 0&&(t=Ht.MASKED),n===void 0&&(n=Ht.MASKED);const a=je(l);return o=>a.runIsolated(r=>(r[t]=o,r[n]))}function yl(l,t,n,a){return yn(t,n,a)(l)}se.PIPE_TYPE=Ht,se.createPipe=yn,se.pipe=yl;class kl extends Be{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}=at(t);this._blockOpts=Object.assign({},this._blockOpts,s);const i=je(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(je(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,n){n===void 0&&(n={});const a=new ce;for(let c=(o=(r=this._mapPosToBlock(this.displayValue.length))==null?void 0:r.index)!=null?o:Math.max(this._blocks.length-1,0),d,p;d=(s=this._blocks[c])!=null?s:p=!p&&this._allocateBlock(c);++c){var o,r,s,i;const h=d._appendChar(t,{...n,_beforeTailState:(i=n._beforeTailState)==null||(i=i._blocks)==null?void 0:i[c]});if(h.skip&&p){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(a.aggregate(h),h.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 c=s;r<=c&&!this._blocks[c].unmaskedValue;--c,++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}}se.RepeatBlock=kl;try{globalThis.IMask=se}catch{}const kn=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:ce,ChunksTailDetails:Ge,DIRECTION:Q,HTMLContenteditableMaskElement:hn,HTMLInputMaskElement:pl,HTMLMaskElement:mt,InputMask:ml,MaskElement:Pt,Masked:Ve,MaskedDate:Ue,MaskedDynamic:gt,MaskedEnum:yt,MaskedFunction:hl,MaskedNumber:De,MaskedPattern:Be,MaskedRange:ht,MaskedRegExp:fl,PIPE_TYPE:Ht,PatternFixedDefinition:gn,PatternInputDefinition:ft,RepeatBlock:kl,createMask:je,createPipe:yn,default:se,forceDirection:cl,normalizeOpts:at,pipe:yl},Symbol.toStringTag,{value:"Module"}));de.ModalEdit=Zn,de.VForm=He,de.VsInputAddress=Hn,de.VsInputArray=Un,de.VsInputArraySelect=Dt,de.VsInputCheckbox=vn,de.VsInputCodegen=On,de.VsInputColor=jn,de.VsInputContainer=Mn,de.VsInputDate=up,de.VsInputEmail=Qt,de.VsInputFile=Sn,de.VsInputFileList=Nn,de.VsInputKeyValue=zn,de.VsInputMask=Xt,de.VsInputNumber=_n,de.VsInputRadio=tn,de.VsInputRange=Pn,de.VsInputRichtext=An,de.VsInputSelect=on,de.VsInputSlug=Tn,de.VsInputStatic=Jt,de.VsInputSwitcher=Zt,de.VsInputTag=In,de.VsInputTel=en,de.VsInputText=tt,de.VsInputTextArray=Rn,de.VsInputTextarea=Dn,de.default=He,de.inputs=Kn,de.vsInputDatatable=Fn,de.vsInputMap=Ln,Object.defineProperties(de,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|