@opengis/form 0.0.117 → 0.0.119
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/form/vs-compact-form.vue.d.ts.map +1 -1
- package/dist/components/inputs/array-select/vs-input-array-select.vue.d.ts.map +1 -1
- package/dist/components/inputs/index.d.ts +1 -0
- package/dist/components/inputs/index.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 +3241 -3200
- 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,he,wl){"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&&s.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(a.value),class:"fixed z-[9999] max-w-xs p-2 bg-gray-900 text-white text-xs rounded-lg shadow-lg pointer-events-none"},e.toDisplayString(s.text),5)):e.createCommentVNode("",!0)]))],64))}}),xl={class:"w-full relative"},_l={key:0,class:"text-[14px] font-medium text-gray-900 mb-2 flex items-center gap-1"},vl={class:"opacity-100"},El={key:0,class:"text-red-500 text-[14px]"},Vl={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Cl=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",xl,[a.value?(e.openBlock(),e.createElementBlock("div",_l,[e.createElementVNode("span",vl,e.toDisplayString(n.value),1),o.value?(e.openBlock(),e.createElementBlock("span",El,"*")):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":s.item.disabled}})),s.error?(e.openBlock(),e.createElementBlock("span",Vl,e.toDisplayString(s.error),1)):e.createCommentVNode("",!0)]))}}),Bl={class:"w-full relative flex flex-row items-center gap-2"},Sl={key:0,class:"text-red-500 text-[14px]"},Nl={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: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 y=Math.max(d-Math.max(p??0,0),0)/d;if(!y)return{};const V=`${y*100}%`;return{flexBasis:V,maxWidth:V}});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),d.item?.rules?.includes("required")&&n.value?(e.openBlock(),e.createElementBlock("span",Sl,"*")):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),d.error?(e.openBlock(),e.createElementBlock("span",Nl,e.toDisplayString(d.error),1)):e.createCommentVNode("",!0)]))}}),Ml={class:"w-full relative"},Dl={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Al=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",Ml,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",Dl,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),Fl={class:"flex-1 min-w-0"},Il={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},Ll={class:"truncate"},Tl={key:0,class:"text-red-500 text-[14px]"},Ol=["innerHTML"],zl={key:0,class:"mt-1 text-xs text-red-500"},Rl={default:Cl,horizontal:$l,inline:Al,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":i.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(i.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",Fl,[i.ua||i.label?(e.openBlock(),e.createElementBlock("p",Il,[e.createElementVNode("span",Ll,e.toDisplayString(i.item[n.value]||i.ua||i.label),1),o.value?(e.openBlock(),e.createElementBlock("span",Tl,"*")):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,Ol)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["w-full",["select","native-select"].includes(i.item.type)?"md:w-[30%]":"md:w-auto"])},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],2)],2),r.value?(e.openBlock(),e.createElementBlock("p",zl,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0)],2))}})};function Ne(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 jl=["placeholder","disabled"],Pl=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}=Ne(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":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,jl)),[[e.vModelText,a.value]])}}),Ul=["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}=Ne(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]=y=>a.value=y),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",[d.customClass,e.unref(n),{"!border-red-600":d.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Ul)),[[e.vModelText,a.value]])}}),Hl=["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}=Ne(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled);return(r,s)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":s[0]||(s[0]=i=>a.value=i),placeholder:r.placeholder,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"},min:r.min,max:r.max},null,10,Hl)),[[e.vModelText,a.value]])}}),ae=(l,t)=>{const n=l.__vccOpts||l;for(const[a,o]of t)n[a]=o;return n},ql={},Kl={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 Gl(l,t){return e.openBlock(),e.createElementBlock("svg",Kl,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 Yl=ae(ql,[["render",Gl]]),Wl={class:"flex items-center gap-[4px]"},Zl=["value","id","disabled"],Jl=["for"],Xl={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",Wl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:s.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:s.id,disabled:r.value},null,10,Zl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:s.id,class:e.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":r.value}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[o.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",s.error?"border-red-600":""]])},[e.createVNode(Yl,{height:"12",width:"12"})],2),e.createElementVNode("span",Xl,[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(s.label),1)])])],10,Jl)]))}}),ea=["name","value","disabled"],ta={class:"flex items-center gap-[6px] text-[14px]"},na={key:0,class:"text-[16px]"},la=["src"],aa=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:i.id,value:i.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),disabled:i.disabled},null,8,ea),[[e.vModelCheckbox,o.value]]),e.createElementVNode("span",ta,[i.icon||i.imgUrl?(e.openBlock(),e.createElementBlock("span",na,[i.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(i.icon)},null,2)):e.createCommentVNode("",!0),i.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:1,src:i.imgUrl,width:"16",height:"16",alt:"icon"},null,8,la)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(i.label),1)])])],2))}}),oa={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",oa,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value==="vs-checkbox-buttons"?e.unref(aa):e.unref(Ql)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:r.value,"onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),id:o,icon:i.icon,imgUrl:i.imgUrl,style:e.normalizeStyle(i.style),error:i.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),ra={},sa={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 ia(l,t){return e.openBlock(),e.createElementBlock("svg",sa,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(ra,[["render",ia]]),ca={},da={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 ua(l,t){return e.openBlock(),e.createElementBlock("svg",da,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),e.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const Ct=ae(ca,[["render",ua]]),pa={},ma={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 fa(l,t){return e.openBlock(),e.createElementBlock("svg",ma,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 ha=ae(pa,[["render",fa]]),ga={key:0,class:"flex items-start gap-x-1"},ya={key:0,class:"text-red-500 text-[14px]"},ka=["title"],ba=["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",ga,[e.createVNode(Yt,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),label:a.text,error:a.error||""},null,8,["modelValue","label","error"]),a.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",ya,"*")):e.createCommentVNode("",!0),a.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:a.i,onClick:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(ha),{class:"text-gray-500 w-[14px] h-[14px]"})],8,ka)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[n.value?`bg-${a.style?.primaryColor||"blue"}-500`:"bg-stone-200",a.customClass]]),disabled:a.disabled,onClick:o[2]||(o[2]=r=>n.value=!n.value)},[e.createElementVNode("span",{"data-state":"checked",class:e.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[n.value?"translate-x-4":"translate-x-0"]])},null,2)],10,ba))}}),wa=["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:t.name,class:e.normalizeClass(["text-gray-900",t.customClass]),innerHTML:t.html?t.html:t.text},null,10,wa))}}),xa=["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}=Ne(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 V=0;V<i.length;V+=1){const k=i[V];k==="{"?p=!0:k==="}"?p=!1:p&&d.add(k)}const y={};return Object.keys(c).forEach(V=>{d.has(V)||(y[V]=c[V])}),{mask:i,definitions:y,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:i.placeholder,disabled:i.disabled,name:i.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,xa))}}),_a={class:"relative w-full bg-white rounded-lg"},va=["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}=Ne(t.style),a=e.useModel(l,"modelValue");return(o,r)=>(e.openBlock(),e.createElementBlock("div",_a,[r[1]||(r[1]=e.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),e.withDirectives(e.createElementVNode("input",{type:"email","onUpdate:modelValue":r[0]||(r[0]=s=>a.value=s),placeholder:o.placeholder,disabled:o.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,va),[[e.vModelText,a.value]])]))}}),Ea={class:"relative w-full bg-white rounded-lg"},Va=["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}=Ne(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",Ea,[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:i.placeholder,disabled:i.disabled,class:e.normalizeClass(["!pl-10 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":i.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Va)]))}}),Ca=["value","disabled"],Ba={class:"text-[13px] text-gray-700"},Sa=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,Ca),[[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))}}),Na=["value","disabled"],$a={class:"text-[13px] text-gray-700"},Ma={"vs-input-radio-default":Sa,"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,Na),[[e.vModelRadio,n.value]]),e.createElementVNode("span",$a,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(()=>Ma[`vs-input-radio-${t.view}`]);return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([o.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,s=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),e.mergeProps({key:s?.id,text:s.text,value:s.id.toString(),checked:n.value===s.id,modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=i=>n.value=i)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),Da={key:1,class:"w-full flex flex-col gap-4"},Aa={key:0,class:"text-sm font-medium text-muted-foreground my-2"},Fa="Без категорії",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),y=e.computed(()=>{if(!n.group)return[];const k=new Map;o.value.forEach(g=>{const w=g[n.group],b=p(w);k.has(b)||k.set(b,[]),k.get(b)?.push(g)});const v=[];n.values?.length&&n.values.forEach(g=>{const w=p(g);v.push(w)});const f=new Set,h=g=>{const w=k.get(g)||[];if(!w.length)return null;const b=g===null?"group-null":`group-${String(g)}`,S=g===null?Fa:String(g);return f.add(g),{key:b,label:S,options:w}},x=[];return v.forEach(g=>{const w=h(g);w&&x.push(w)}),k.forEach((g,w)=>{if(f.has(w))return;const b=h(w);b&&x.push(b)}),x}),V=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 h=s(f);r[h]=v.has(h)}})}},{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)V().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",Da,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,f=>(e.openBlock(),e.createElementBlock("div",{key:f.key,class:"flex flex-col gap-2"},[f.label?(e.openBlock(),e.createElementBlock("span",Aa,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,h=>(e.openBlock(),e.createBlock(Yt,{modelValue:r[s(h)],"onUpdate:modelValue":x=>r[s(h)]=x,value:s(h),class:e.normalizeClass(c(k.colSpan)),disabled:n.disabled||h.disabled,label:i(h),key:`${f.key}-${s(h)}`,icon:h?.icon,imgUrl:h?.imgUrl,option:h,view:k.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":h=>r[s(f)]=h,value:s(f),class:e.normalizeClass(c(k.colSpan)),disabled:n.disabled||f.disabled,label:i(f),key:s(f),icon:f?.icon,imgUrl:f?.imgUrl,option:f,view:k.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-8e66207e"]]),Ia=["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}=Ne(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,y)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":y[0]||(y[0]=V=>s.value=V),placeholder:d.value,disabled:c.value,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[p.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Ia)),[[e.vModelDynamic,s.value]])}}),Ta=(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=Ta(c,i);return(await fetch(d,{method:"POST",body:n}).then(y=>y.json()))?.result}catch(n){return he.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",n),null}},Oa=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)}},za={},Ra={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",Ra,t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const ze=ae(za,[["render",ja]]),Pa={},Ua={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 Ha(l,t,n,a,o,r){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><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 qa=ae(Pa,[["render",Ha]]),Ka={},Ga={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 Ya(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Ga,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 Wa=ae(Ka,[["render",Ya]]),Za={},Ja={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 Xa(l,t){return e.openBlock(),e.createElementBlock("svg",Ja,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 Cn=ae(Za,[["render",Xa]]),Qa={},eo={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 to(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",eo,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 no=ae(Qa,[["render",to]]),lo={},ao={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 oo(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",ao,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 ro=ae(lo,[["render",oo]]),so=l=>{if(!l)return"";const t=l?.split(".");return t[t.length-1]},io=l=>{const t=so(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)?Wa:n.textsFormat.includes(t)?ro:n.documentsFormat.includes(t)?qa:n.archivesFormat.includes(t)?no:Cn},co={},uo={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 po(l,t){return e.openBlock(),e.createElementBlock("svg",uo,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(co,[["render",po]]),mo={},fo={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 ho(l,t){return e.openBlock(),e.createElementBlock("svg",fo,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=ae(mo,[["render",ho]]),go=["title"],yo={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(io)(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",yo,[e.createElementVNode("button",{type:"button",onClick:r[1]||(r[1]=s=>{e.unref(Oa)(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(Bn,{class:"w-4 h-4"})])])],8,go))}}),[["__scopeId","data-v-286cdbc0"]]),ko={class:"flex items-center gap-x-2"},bo=["accept","multiple","disabled"],wo={key:1,class:"flex items-center flex-wrap gap-2"},xo={key:1,class:"loader"},_o={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(g=>g.trim().toLowerCase()).filter(Boolean):[]),d=g=>Array.isArray(a.value)&&a.value[g]||"",p=g=>{if(n.max_size&&g.size>n.max_size*1024*1024){const w=(g.size/1048576).toFixed(2);return he.notify({type:"error",title:"Помилка!",message:`Файл "${g.name}" занадто великий. Максимальний розмір: ${n.max_size} МБ, розмір файлу: ${w} МБ`,position:"right-bottom"}),!1}return!0},y=g=>{if(!c.value.length)return!0;const w=`.${g.name.split(".").pop()?.toLowerCase()||""}`,b=c.value.includes(w);return b||he.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${g.name}". Дозволені формати: ${c.value.join(", ")}`,position:"right-bottom"}),b},V=e.computed(()=>{const g={},w=[];if(!n.customParams?.length)return{params:g,missingSources:w};const b=i?.value??{};return n.customParams.forEach(S=>{if(!S)return;const[D,C]=S.split("="),O=D?.trim(),W=C?.trim();if(!O||!W)return;const Y=b[W];if(Y==null||Y===""){w.push(W);return}g[O]=Y}),{params:g,missingSources:w}}),k=()=>{const{params:g}=V.value;return{api:n.api,customParams:Object.keys(g).length?g:void 0}},v=()=>{const g=V.value.missingSources;if(!g.length)return!0;const w=g.join(", ");return he.notify({type:"warning",title:"Заповніть поля",message:`Поля (${w}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},f=g=>{he.notify({type:"error",title:"Помилка завантаження",message:g||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},h=()=>{n.disabled||s.value||v()&&r.value?.click()},x=async g=>{const{files:w}=g.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(C=>!p(C)).length>0){r.value&&(r.value.value="");return}if(b.filter(D=>!y(D)).length>0){r.value&&(r.value.value="");return}s.value=!0;try{if(n.multiple){const D=Array.from(w).map(async Y=>await En(Y,k())),C=await Promise.all(D),W=C.filter(Y=>Y!==null).map(Y=>Y?.file_path).filter(Boolean);if(W.length===0){f();return}W.length<C.length&&f("Деякі файли не вдалося завантажити. Перевірте їх та спробуйте знову."),a.value=[...a.value||[],...W],o("change",a.value)}else{const D=w[0],C=await En(D,k());if(!C?.file_path){f();return}a.value=C?.file_path,o("change",a.value||"")}}catch(D){const C=D?.message||void 0;f(C)}finally{s.value=!1,r.value&&(r.value.value="")}};return(g,w)=>(e.openBlock(),e.createElementBlock("div",ko,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:r,type:"file",accept:n.format,multiple:g.multiple,onChange:x,disabled:s.value||g.disabled},null,40,bo),!g.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"])):g.multiple?(e.openBlock(),e.createElementBlock("div",wo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(b,S)=>(e.openBlock(),e.createBlock(nn,{multiple:g.multiple,key:S,value:a.value,"onUpdate:value":w[2]||(w[2]=D=>a.value=D),item:d(S)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:h,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",g.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",xo)):(e.openBlock(),e.createBlock(ze,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),g.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:h,class:e.normalizeClass([g.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",_o)):(e.openBlock(),e.createBlock(ze,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-cf6efbaa"]]),vo={class:"vs-input-file2 flex flex-col gap-4"},Eo={class:"flex items-center gap-x-2"},Vo=["accept","disabled"],Co={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"},So={class:"flex items-center justify-between text-sm"},No={class:"truncate pr-4"},$o={class:"font-medium text-slate-800 truncate"},Mo={class:"text-slate-500"},Do={class:"text-slate-500 whitespace-nowrap"},Ao={class:"mt-3 h-2 rounded-full bg-slate-100 overflow-hidden"},Fo={class:"mt-3 flex flex-wrap gap-2 text-sm"},Io={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"),y=e.computed(()=>t.format?t.format.split(",").map(F=>F.trim().toLowerCase()).filter(Boolean):[]),V=e.computed(()=>!o.value||!o.value.size?0:Math.min(100,Math.round(s.value/o.value.size*100))),k=e.computed(()=>o.value?`${h(s.value)} / ${h(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()},h=F=>{if(!Number.isFinite(F))return"0 B";const R=["B","KB","MB","GB"];let K=0,T=F;for(;T>=1024&&K<R.length-1;)T/=1024,K+=1;return`${T.toFixed(K===0?0:1)} ${R[K]}`},x=F=>{if(!t.max_size)return!0;const R=t.max_size*1024*1024;return F.size>R?(he.notify({type:"error",title:"Файл занадто великий",message:`Максимальний розмір ${t.max_size} МБ`,position:"right-bottom"}),!1):!0},g=F=>{if(!y.value.length)return!0;const R=`.${F.name.split(".").pop()?.toLowerCase()||""}`;return y.value.includes(R)?!0:(he.notify({type:"error",title:"Непідтримуваний формат",message:`Дозволені формати: ${y.value.join(", ")}`,position:"right-bottom"}),!1)},w=e.computed(()=>{const F={},R=[];if(!t.customParams?.length)return{params:F,missing:R};const K=p?.value??{};return t.customParams.forEach(T=>{if(!T)return;const[A,Z]=T.split("="),q=A?.trim(),me=Z?.trim();if(!q||!me)return;const pe=K[me];pe==null||pe===""?R.push(me):F[q]=pe}),{params:F,missing:R}}),b=()=>w.value.missing.length?(he.notify({type:"warning",title:"Заповніть поля",message:`Потрібні значення: ${w.value.missing.join(", ")}`,position:"right-bottom"}),!1):!0,S=F=>{const R=F.target,K=R.files?.[0];if(K){if(!b()){R.value="";return}if(!x(K)||!g(K)){R.value="";return}o.value=K,s.value=0,r.value="",c.value=""}},D=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 K=await R.json();r.value=K.id||r.value,s.value=K.uploaded||0,await C()}catch(F){c.value=F?.message||"Помилка при старті завантаження"}},C=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),K=o.value.slice(F,R);d.value=new AbortController;const T=await fetch(`/api/file/upload2/${r.value}`,{method:"PATCH",headers:{"Content-Range":`bytes ${F}-${R-1}/${o.value.size}`},body:K,signal:d.value.signal});if(!T.ok)throw new Error("Помилка завантаження частини");const A=await T.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,he.notify({type:"success",title:"Файл завантажено",message:o.value.name,position:"right-bottom"}),L();return}}}catch(F){if(F?.name==="AbortError")return;c.value=F?.message||"Помилка при завантаженні",i.value=!1}finally{d.value=null,i.value=!1}}},O=()=>{i.value&&(d.value?.abort(),d.value=null,i.value=!1)},W=async()=>{if(o.value){if(!r.value){await D();return}await C()}},Y=()=>{d.value?.abort(),d.value=null,L()},L=()=>{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",vo,[e.createElementVNode("div",Eo,[e.createElementVNode("input",{ref_key:"fileInput",ref:a,type:"file",class:"hidden",accept:t.format,disabled:i.value||t.disabled,onChange:S},null,40,Vo),n.value?(e.openBlock(),e.createBlock(nn,{key:0,item:n.value,"onUpdate:item":R[0]||(R[0]=K=>n.value=K),value:n.value,"onUpdate:value":R[1]||(R[1]=K=>n.value=K)},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",Co,[R[2]||(R[2]=e.createElementVNode("div",{class:"loader"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(V.value)+"%",1)])):(e.openBlock(),e.createBlock(ze,{key:1,class:"w-6 h-6"}))],2))]),o.value&&!n.value?(e.openBlock(),e.createElementBlock("div",Bo,[e.createElementVNode("div",So,[e.createElementVNode("div",No,[e.createElementVNode("div",$o,e.toDisplayString(o.value.name),1),e.createElementVNode("div",Mo,e.toDisplayString(h(o.value.size)),1)]),e.createElementVNode("div",Do,e.toDisplayString(k.value),1)]),e.createElementVNode("div",Ao,[e.createElementVNode("div",{class:"h-full rounded-full bg-blue-500 transition-all duration-300",style:e.normalizeStyle({width:`${V.value}%`})},null,4)]),e.createElementVNode("div",Fo,[!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:W}," 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:O}," 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:D}," Upload ")):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"rounded border border-rose-200 px-3 py-1 text-rose-600",onClick:Y}," Cancel ")]),c.value?(e.openBlock(),e.createElementBlock("p",Io,e.toDisplayString(c.value),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),ln=ae(Lo,[["__scopeId","data-v-ea9f874f"]]),To={class:"max-w-[55vw]"},Oo={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},zo={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},Ro={class:"px-[5px]"},jo={class:""},Bt=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",To,[e.createElementVNode("p",Oo,e.toDisplayString(o.item?.uploaded_name),1),e.createElementVNode("p",zo,[e.createElementVNode("span",null,e.toDisplayString(o.item?.username),1),e.withDirectives(e.createElementVNode("span",Ro,"|",512),[[e.vShow,o.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(n.value),1),r[0]||(r[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",jo,e.toDisplayString(a(o.item?.size)),1)])])],64))}}),Po={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},Uo={key:0,class:"flex w-full gap-x-3 items-center"},Ho={key:1,class:"flex gap-x-3 w-full items-center"},qo={key:2,class:"flex gap-x-3 w-full items-center"},Ko=["href"],Go={key:3,class:"flex gap-x-3 w-full items-center"},Yo={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},Wo={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"},Zo={class:"inline-block"},Jo={class:"inline-block"},Xo=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 y=document.createElement("a");y.setAttribute("download",p?.uploaded_name),y.href=p?.file_path,y.click()}async function i(){try{await fetch(`${n.prefix}/widget/file/${n.item.entity_id}/${n.item.file_id}`),a("update")}catch(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,y)=>(e.openBlock(),e.createElementBlock("div",Po,[p.item.ext==="jpg"||p.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",Uo,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:y[0]||(y[0]=V=>d(p.index))},[e.createVNode(Bt,{item:p.item},null,8,["item"])])])):o(p.item)?(e.openBlock(),e.createElementBlock("div",Ho,[e.createVNode(Bt,{item:p.item},null,8,["item"])])):r(p.item)?(e.openBlock(),e.createElementBlock("div",qo,[e.createElementVNode("a",{href:`/api/file-preview?id=${p.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(Bt,{item:p.item},null,8,["item"])],8,Ko)])):(e.openBlock(),e.createElementBlock("div",Go,[e.createVNode(Bt,{item:p.item},null,8,["item"])])),e.createElementVNode("div",Yo,[e.createElementVNode("div",Wo,[e.createElementVNode("div",Zo,[e.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:y[1]||(y[1]=V=>s(p.item))},[e.createVNode(Bn,{height:"14",width:"14"})])]),y[3]||(y[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",Jo,[e.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:y[2]||(y[2]=V=>c())},[e.createVNode(nt,{height:"14",width:"14"})])])])])]))}}),Qo={},er={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 tr(l,t){return e.openBlock(),e.createElementBlock("svg",er,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 nr=ae(Qo,[["render",tr]]),lr={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},ar={class:"flex w-full mb-[12px] items-center gap-x-2"},or={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},rr={class1:"ml-auto"},sr={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"},ir={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},cr={class:"relative"},dr={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"},ur={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([]),y=e.ref(""),V=e.computed(()=>Array.isArray(p.value)?p.value.filter(w=>w.ext==="jpg"||w.ext==="png").map(w=>w?.file_path):[]),k=e.computed(()=>y.value===""?p.value:p.value.filter(w=>w?.uploaded_name?.includes(y.value))),v=w=>{const b=V.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)}},h=async w=>{await Promise.all(Array.from(w.target.files).map(async b=>{const S=new FormData;S.append("file",b);try{const D=`${n.prefix}/widget/file/${o.value}`,C=await fetch(D,{method:"POST",body:S});return C.ok?(i("update","file-list"),b):(he.notify({type:C.status>=400&&C.status<500?"warning":"error",title:"Error",message:`Error code: ${C.status}`}),null)}catch(D){return he.notify({type:"error",title:"Error",message:D.message||"Unknown error"}),console.error(D),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},g=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"),D=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",lr,[e.createElementVNode("div",ar,[e.createElementVNode("h2",or," Файлів: "+e.toDisplayString(p.value?.length),1),e.createElementVNode("div",rr,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:b[0]||(b[0]=C=>h(C))},null,32),e.createElementVNode("div",sr,[e.createVNode(nr,{height:"16",width:"16"})])])])]),p.value?.length>4?(e.openBlock(),e.createElementBlock("div",ir,[e.createElementVNode("div",null,[e.createElementVNode("div",cr,[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]=C=>y.value=C),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[e.vModelText,y.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),p.value?.length?(e.openBlock(),e.createElementBlock("div",dr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,(C,O)=>(e.openBlock(),e.createBlock(Xo,{key:O,prefix:w.prefix,item:C,index:O,onUpdate:b[2]||(b[2]=W=>w.$emit("update","file-list")),onOpenModal:b[3]||(b[3]=W=>g(W)),onOpenLightbox:b[4]||(b[4]=W=>v(W))},null,8,["prefix","item","index"]))),128)),k.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ur,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]=C=>r.value=C),startIndex:s.value,"onUpdate:index":b[6]||(b[6]=C=>s.value=C),images:V.value},null,8,["modelValue","startIndex","images"]),e.createVNode(D,e.mergeProps({modelValue:c.value,"onUpdate:modelValue":b[7]||(b[7]=C=>c.value=C),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),pr={class:"flex items-center justify-between"},mr={class:"text-[16px] text-gray-900 font-medium"},fr={class:"grid gap-3"},hr=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",pr,[e.createElementVNode("p",mr,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",fr,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),gr={class:"text-[16px] text-gray-900 font-medium"},yr={class:"grid gap-3"},kr=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",gr,e.toDisplayString(l.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",yr,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),br={class:"flex items-center justify-between"},wr={switcher:hr,accordion:kr,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",br,[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"},xr=(l,t)=>String(l)===String(t),_r=(l,t)=>String(l)!==String(t),vr=(l,t)=>l>t,Er=(l,t)=>l>=t,Vr=(l,t)=>l<t,Cr=(l,t)=>l<=t,Br=(l,t)=>Array.isArray(t)&&t.length===2?l>=t[0]&&l<=t[1]:!1,Sr=(l,t)=>String(l).startsWith(String(t)),Nr=(l,t)=>String(l).endsWith(String(t)),$r=(l,t)=>String(l).includes(String(t)),Mr=(l,t)=>Array.isArray(t)?t.includes(l):!1,Dr=(l,t)=>Array.isArray(t)?!t.includes(l):!0,$n=(l,t)=>{if(!t)return!0;switch(t?.[1]){case Fe.Equal:return xr(l,t?.[2]);case Fe.Inequal:return _r(l,t?.[2]);case Fe.Higer:return vr(l,t?.[2]);case Fe.HigerOrEqual:return Er(l,t?.[2]);case Fe.Lower:return Vr(l,t?.[2]);case Fe.LowerOrEqual:return Cr(l,t?.[2]);case Fe.Between:return Br(l,t?.[2]);case Fe.StartWith:return Sr(l,t?.[2]);case Fe.EndWith:return Nr(l,t?.[2]);case Fe.Contain:return $r(l,t?.[2]);case Fe.In:return Mr(l,t?.[2]);case Fe.NotIn:return Dr(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(()=>wr[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(Yn,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)}}),Ar=["aria-expanded","data-focus"],Fr={class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full"},Ir={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"},Tr=["title"],Or=["innerHTML"],zr=["onClick"],Rr={class:"flex-1 min-w-[2px]"},jr=["placeholder"],Pr=["title"],Ur=["innerHTML"],Hr={key:3,class:"truncate flex-1 min-w-0"},qr={key:2,class:"flex-1 min-w-[2px]"},Kr=["placeholder"],Gr={class:"flex items-center shrink-0"},Yr=["disabled"],Wr=["disabled","title"],Zr=["aria-disabled","onClick"],Jr=["innerHTML"],Xr={key:1,class:"px-3 py-2 text-center text-gray-500"},Qr=["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);Ne(n.style);const s=e.computed({get:()=>n.modelValue,set:E=>a("update:modelValue",E)});!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),y=e.ref(!1),V=e.ref(!1),k=e.ref(null),v=e.ref([]),f=e.ref(-1),h=e.ref([]),x=e.ref(""),g=e.ref(null),w=e.ref("bottom"),b=e.ref({}),S=e.ref([]),D=e.computed(()=>{if(!S.value.length)return[];const E=v.value,M=new Map(E.map(I=>[I.id?.toString(),I]));return S.value.map(I=>M.get(I?.toString())).filter(I=>!!I)}),C=e.computed(()=>n.placeholder||"Select..."),O=e.computed(()=>q(k.value));e.computed(()=>o.value?!S.value.length&&x.value==="":!O.value&&x.value==="");const W=e.computed(()=>r.value?!1:o.value?S.value.length>0:!!s.value),Y=E=>o.value?S.value.some(M=>M?.toString()===E?.toString()):s.value?.toString()===E?.toString(),L=e.computed(()=>{let E=v.value??[];if(!n.data&&x.value.trim()!==""){const M=x.value.toLowerCase();E=E.filter(I=>{const ee=q(I).toLowerCase(),ge=I.text?.toLowerCase?.()||"";return ee.includes(M)||ge.includes(M)})}if(o.value&&S.value.length){const M=new Set(S.value.map(I=>I?.toString()));E=E.filter(I=>!M.has(I.id?.toString()))}return E}),F=e.inject("values"),R=e.inject("field-props"),K=/\{\{\s*([^}]+?)\s*\}\}/g,T=E=>(E?String(E):"").replace(/<[^>]*>/g,"").trim(),A=e.computed(()=>n.slot??n?.optionTemplate??""),Z=E=>{if(!E)return"";const M=A.value;return M?M.replace(K,(I,ee)=>{const ge=ee.trim(),be=E[ge];return be!=null?String(be):""}):E.text??""},q=E=>{if(!E)return"";if(!A.value)return E.text??"";const I=Z(E);return T(I)||E.text||""},me=new Map,pe=wl.icons,Ae=E=>E.replace(/^([A-Z])|[\s-_]+(\w)/g,(M,I,ee)=>ee?ee.toUpperCase():I.toLowerCase()),Ue=E=>{const M=Ae(E);return M?M.charAt(0).toUpperCase()+M.slice(1):""},H=E=>{if(!E)return;const M=Ue(E);if(me.has(M))return me.get(M);const ee=[M,`${M}Icon`,`Lucide${M}`,`Lucide${M}Icon`].map(ge=>pe[ge]).find(Boolean);return me.set(M,ee),ee},oe=E=>E?typeof E.icon=="string"?H(E.icon)??null:E.icon??null:null,ue=E=>!!(E?.color&&!oe(E)),fe=E=>E?.color?{color:E.color}:void 0,ke=E=>!!oe(E),z=(E,M,I)=>{if(!R)return!1;const ee=R.value?.[E]??{},ge=(we,Ee,u)=>{if(!Ee.length)return we;const[m,..._]=Ee,B={...we};if(!_.length)return B[m]=u,B;const P=typeof we[m]=="object"&&we[m]!==null?we[m]:{};return B[m]=ge(P,_,u),B},be=ge(ee,M,I);return R.value={...R.value||{},[E]:be},!0},le=E=>{if(!n.set)return;const M=F?.value;!M&&!R||Object.entries(n.set).forEach(([I,ee])=>{if(!I)return;const ge=E?E[ee]:null,be=I.split(".").map(u=>u.trim()).filter(Boolean);if(!be.length)return;const[we,...Ee]=be;Ee.length&&z(we,Ee,ge??null)||M&&(M[we]=ge??null)})},N=e.computed(()=>n.parent?F?.value?.[n.parent]?.toString()??null:null),j=async E=>{if(!n.data){let M=n.options??[];if(E?.trim()){const I=E.toLowerCase();M=M.filter(ee=>{const ge=q(ee).toLowerCase(),be=ee.text?.toLowerCase?.()||"";return ge.includes(I)||be.includes(I)})}return M}try{const M=n.host??"",I=n.prefix??"api",ee=n.api??`/${I}/suggest/${n.data}`,ge=`${M}${ee}`,be=new URLSearchParams;return be.set("json","1"),E&&be.set("key",E),N.value!==void 0&&N.value!==null&&N.value!==""&&be.set("parent",N.value),n.start===1&&be.set("start","1"),(await fetch(`${ge}?${be.toString()}`).then(Ee=>Ee.json()))?.data??[]}catch{return[]}},U=async()=>{n.data?v.value=await j(x.value):v.value=n.options?[...n.options]:[]},ne=async E=>{if(E==null||E==="")return null;const M=v.value?.find(I=>I?.id?.toString()===String(E));if(M)return M;if(n.data)try{const I=n.host??"",ee=n.prefix??"api",ge=n.api??`/${ee}/suggest/${n.data}`,be=`${I}${ge}`,we=new URLSearchParams;return we.set("json","1"),we.set("val",String(E)),N.value!==void 0&&N.value!==null&&N.value!==""&&we.set("parent",N.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},re=async E=>{const M=new Set(v.value.map(ee=>ee.id?.toString())),I=E.filter(ee=>!M.has(ee?.toString()));I.length&&await I.reduce(async(ee,ge)=>{await ee;const be=await ne(ge);be&&v.value.push(be)},Promise.resolve())},xe=()=>{if(!L.value.length){f.value=-1;return}let E=0;if(!o.value&&k.value){const M=k.value.id?.toString(),I=L.value.findIndex(ee=>ee.id?.toString()===M);I>=0&&(E=I)}f.value=E,e.nextTick(()=>{Ie(h.value[E],d.value)})},_e=async()=>{r.value||(y.value=!0,await U(),await e.nextTick(()=>{ot(),g.value?.focus()}),xe())},$=()=>{y.value=!1,f.value=-1,e.nextTick(()=>{g.value?.blur()})},G=async E=>{if(r.value)return;!y.value?await _e():$()},J=async()=>{if(!r.value){if(y.value){$();return}await _e()}},ye=()=>{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(()=>g.value?.focus())},$e=E=>{o.value&&(S.value=S.value.filter(M=>M?.toString()!==E?.toString()),s.value=[...S.value],a("change",s.value),Ye(null),e.nextTick(()=>g.value?.focus()))},Ye=(E,M)=>{const I=M??(o.value?[...S.value]:E?.id??null);a("value-selected",{name:n.name,value:I,option:E})},Oe=E=>{o.value?(Y(E.id)||(S.value=[...S.value,E.id],s.value=[...S.value],a("change",s.value),Ye(E)),x.value="",e.nextTick(()=>{g.value?.focus(),f.value=Math.min(f.value,L.value.length-1)}),le(null)):(k.value=E,s.value=E.id,a("change",s.value),Ye(E),x.value="",$(),le(E))},bn=E=>{if(Y(E.id)){o.value||$();return}Oe(E)},Ie=(E,M)=>{if(!E||!M)return;const I=E.offsetTop,ee=I+E.offsetHeight,ge=M.scrollTop,be=ge+M.clientHeight;let we=M.scrollTop;I<ge?we=I-80:ee>be&&(we=ee-M.clientHeight+4);const Ee=M;Ee.scrollTop=we},We=E=>{let M=E.parentElement;for(;M;){if(M.classList.contains("ui-dialog__content"))return M;const I=window.getComputedStyle(M),ee=I.overflow+I.overflowY+I.overflowX;if(ee.includes("auto")||ee.includes("scroll")||M===document.body||M===document.documentElement)return M;M=M.parentElement}return document.body},ot=()=>{if(!c.value)return;const E=c.value.getBoundingClientRect(),M=window.innerHeight||document.documentElement.clientHeight,I=window.innerWidth||document.documentElement.clientWidth,ee=8,ge=8,be=n.maxHeight||300,we=M-E.bottom-ge-ee,Ee=E.top-ge-ee,u=we>=Ee,m=Math.max(I-ee*2,0);let{width:_}=E;m>0&&_>m&&(_=m);let{left:B}=E;B+_+ee>I&&(B=I-_-ee),B=Math.max(B,ee);const P=Math.min(be,Math.max(u?we:Ee,50));w.value=u?"bottom":"top",b.value={position:"fixed",left:`${B}px`,width:`${_}px`,maxHeight:`${P}px`,transform:u?"none":"translateY(-100%)",top:u?`${E.bottom+ge}px`:`${E.top-ge}px`}},qe=async E=>{r.value||!y.value&&(E.key==="ArrowDown"||E.key==="ArrowUp")&&(E.preventDefault(),await _e())},qt=E=>{if(!y.value)return;const{key:M}=E;if(M==="ArrowDown")E.preventDefault(),f.value+1<L.value.length&&(f.value+=1,Ie(h.value[f.value],d.value));else if(M==="ArrowUp")E.preventDefault(),f.value>0&&(f.value-=1,Ie(h.value[f.value],d.value));else if(M==="Enter"){E.preventDefault();const I=L.value[f.value];I&&Oe(I),g.value?.blur()}else M==="Escape"?(E.preventDefault(),$()):M==="Backspace"?o.value&&x.value===""&&S.value.length&&(S.value=S.value.slice(0,-1),s.value=[...S.value],a("change",s.value)):M==="Home"?(f.value=0,Ie(h.value[0],d.value)):M==="End"?(f.value=L.value.length-1,Ie(h.value[f.value],d.value)):M==="Tab"&&$()},rt=()=>{r.value||(V.value=!0)},kt=()=>{V.value=!1,x.value=""},bt=E=>{E.key==="Escape"&&y.value&&$()},wt=E=>{const M=E.target;i.value?.contains(M)||p.value?.contains(M)||$()},Kt=E=>{y.value&&d.value&&!d.value.contains(E.target)&&ot()},xt=()=>{y.value&&ot()},Gt=()=>{y.value&&ot()};e.watch(()=>n.options,E=>{E?.length&&(v.value=[...E],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 re(S.value),await e.nextTick());else{if(Array.isArray(s.value)){const E=s.value[0]??null;s.value=E??null}s.value!=null&&(k.value=await ne(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 j("")),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 M=n.add.api??`/api/table/${n.add.token}`,I=await fetch(M,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(st.value)}),ee=await I.json().catch(()=>({})),ge=ee?.error||ee?.message,be=Number(ee?.code)>=400;if(!I.ok||be){he.notify({title:"Помилка",type:"error",message:ge||`Код помилки: ${ee?.code||I.status}`});return}const we=ee?.id;if(!we){he.notify({title:"Помилка",type:"error",message:"Обʼєкт створено, але в відповіді відсутній ID."});return}if(!n.options?.length&&n.data){const Ee=await fetch(`${n.api??`/api/suggest/${n.data}`}?val=${we}`).then(u=>u.json());k.value=Ee[0],v.value.push(Ee[0]),s.value=we}et.value=!1,he.notify({title:"Успіх",message:"Обʼєкт успішно створено."})}catch(M){he.notify({title:"Помилка",type:"error",message:M?.message||"Не вдалося створити обʼєкт."})}}async function ct(){if(!n.add)return null;const E=await fetch(`/api/template/form/${n.add.form}`).then(M=>M.json());return _t.value=E.schema,et.value=!0,null}function Et(E,M=200){let I;return(...ee)=>{I&&clearTimeout(I),I=window.setTimeout(()=>E(...ee),M)}}const wn=Et(async E=>{v.value=await j(E)},200);e.watch(x,E=>{n.data&&wn(E.trim())}),e.watch(()=>n.options,E=>{!n.data&&E?.length&&(v.value=[...E],Ze())},{immediate:!0}),e.watch(()=>n.parent??n.parentValue,()=>{n.data&&U()});const Je=e.ref(!0);return e.watch(N,async()=>{if(n.data&&(Je.value||(o.value?(S.value=[],s.value=[],a("change",[])):(k.value=null,s.value=null,a("change",null))),await U(),n.auto===1&&N.value&&v.value.length>0)){const E=v.value[0];E&&Oe(E)}}),(E,M)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(he.VsModal),{visible:et.value,"onUpdate:visible":M[1]||(M[1]=I=>et.value=I),class:"z-[1000]",title:"Додати",buttonText:"Додати",onDone:vt,teleport:E.teleport},{default:e.withCtx(()=>[e.createVNode(He,{schema:_t.value,modelValue:st.value,"onUpdate:modelValue":M[0]||(M[0]=I=>st.value=I),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:M[5]||(M[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass])},[M[10]||(M[10]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),M[11]||(M[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":y.value,"aria-haspopup":"listbox",onKeydown:qe,onClick:J,"data-focus":y.value||V.value?"true":"false",ref_key:"triggerRef",ref:c},[e.createElementVNode("div",Fr,[o.value?(e.openBlock(),e.createElementBlock("div",Ir,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(D.value,I=>(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:I.id},[e.createElementVNode("div",Lr,[ue(I)?(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:I?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ke(I)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(an),style:e.normalizeStyle(fe(I)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(oe(I)),{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:q(I)},[A.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:Z(I)},null,8,Or)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(I.text),1)],64))],8,Tr)]),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=>$e(I.id),["stop"])},M[6]||(M[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,zr)]))),128)),e.createElementVNode("div",Rr,[!r.value&&E.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:g,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?" ":C.value,"onUpdate:modelValue":M[2]||(M[2]=I=>x.value=I),onFocus:rt,onBlur:kt,onKeydown:qt},null,40,jr)),[[e.vModelText,x.value]]):e.createCommentVNode("",!0)])])):!o.value&&O.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:O.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&&ke(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(oe(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:Z(k.value)},null,8,Ur)):(e.openBlock(),e.createElementBlock("span",Hr,e.toDisplayString(k.value?.text),1))],8,Pr)):e.createCommentVNode("",!0),o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",qr,[!r.value&&E.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:g,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:O.value?" ":C.value,"onUpdate:modelValue":M[3]||(M[3]=I=>x.value=I),onFocus:rt,onBlur:kt,onKeydown:qt},null,40,Kr)),[[e.vModelText,x.value]]):e.createCommentVNode("",!0)]))]),e.createElementVNode("div",Gr,[W.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(ye,["stop"])},M[7]||(M[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,Yr)):e.createCommentVNode("",!0),M[9]||(M[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:M[4]||(M[4]=e.withModifiers(I=>G(),["stop"])),title:y.value?"Закрити список":"Відкрити список"},M[8]||(M[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,Wr)])],42,Ar),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[y.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},[L.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(L.value,(I,ee)=>(e.openBlock(),e.createElementBlock("div",{key:I.id,ref_for:!0,ref:ge=>h.value[ee]=ge,class:e.normalizeClass(["flex px-3 py-2 gap-2 cursor-pointer select-none text-gray-900",Y(I.id)?"bg-[#2684ff] text-white":"bg-white hover:bg-[#deebff] hover:text-[#172b4d]",f.value===ee&&!Y(I.id)?"bg-[#deebff] text-[#172b4d]":""]),"aria-disabled":Y(I.id)?"true":"false",role:"option",tabindex:"-1",onClick:ge=>bn(I)},[ue(I)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block flex-shrink-0",style:e.normalizeStyle({backgroundColor:I?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ke(I)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(an),style:e.normalizeStyle(fe(I)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(oe(I)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",f.value===I.id?"text-white":"",(f.value===ee,"")])},[A.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:Z(I)},null,8,Jr)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(I.text),1)],64))],2)],10,Zr))),128)):(e.openBlock(),e.createElementBlock("div",Xr," 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(ze,{width:"16",height:"16"}),M[12]||(M[12]=e.createElementVNode("span",null,"Додати",-1))],8,Qr)):e.createCommentVNode("",!0)],512)],64))}}),[["__scopeId","data-v-6c691161"]]),es=["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}=Ne(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,es)),[[e.vModelText,a.value]])}}),ts={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}=Ne(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",[c.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",ts,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))}}),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",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};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:"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 os=ae(ns,[["render",as]]),rs={},ss={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 is(l,t){return e.openBlock(),e.createElementBlock("svg",ss,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 cs=ae(rs,[["render",is]]),ds={},us={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 ps(l,t){return e.openBlock(),e.createElementBlock("svg",us,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 ms=ae(ds,[["render",ps]]),fs={},hs={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 gs(l,t){return e.openBlock(),e.createElementBlock("svg",hs,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(fs,[["render",gs]]),ys={},ks={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function bs(l,t){return e.openBlock(),e.createElementBlock("svg",ks,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 ws=ae(ys,[["render",bs]]),xs={},_s={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 vs(l,t){return e.openBlock(),e.createElementBlock("svg",_s,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 Es=ae(xs,[["render",vs]]),Vs={class:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden flex flex-col"},Cs={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"},Ss={class:"flex flex-nowrap items-center justify-end gap-2 w-full overflow-x-auto"},Ns={class:"w-full overflow-x-auto"},$s={class:"w-full min-w-[640px] table-auto divide-y divide-gray-200"},Ms={class:"bg-gray-50"},Ds={class:"border-b border-gray-200"},As={class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 w-12 text-center"},Fs=["onClick"],Is={key:0,class:"text-gray-400"},Ls={key:0,colspan:"100%",class:"text-center"},Ts={class:"w-full"},Os={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},zs=["onDragstart","onDragover","onDrop"],Rs={class:"px-4 py-3 text-center align-middle"},js={class:"flex items-center justify-center"},Ps=["innerHTML"],Us={key:0,class:"flex items-center gap-3 text-sm text-gray-700"},Hs={key:0},qs=["src"],Ks={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},Gs={key:1,class:"flex items-center justify-center"},Ys={key:2,class:"text-sm font-medium text-gray-900"},Ws={class:"px-4 py-3 text-right whitespace-nowrap"},Zs={class:"flex items-center justify-end gap-2"},Js=["onClick"],Xs=["onClick"],Qs={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({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 N=a.value??[],j=r.value?N.filter(re=>t.colModel?.some(xe=>{const _e=xe.key||xe.name;if(!_e)return!1;const $=re[_e];return $?Array.isArray($)?$.join(", ").toLowerCase().includes(r.value.toLowerCase()):String($).toLowerCase().includes(r.value.toLowerCase()):!1})):N;if(!s.value)return j;const U=s.value,ne=[...j].sort((re,xe)=>{const _e=pe(re?.[U]),$=pe(xe?.[U]);return typeof _e=="number"&&typeof $=="number"?_e-$:String(_e).localeCompare(String($))});return i.value==="asc"?ne:ne.reverse()}),d=e.ref(null),p=e.ref(null),y=e.ref(null),V=N=>{d.value=N},k=N=>{p.value=N},v=N=>{if(d.value===null||d.value===N){d.value=null,p.value=null;return}const j=[...a.value],[U]=j.splice(d.value,1);j.splice(N,0,U),a.value=j,d.value=null,p.value=null},f=()=>{y.value&&y.value.click()},h=N=>{const j=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],U=N.toLowerCase();return j.some(ne=>U.endsWith(ne))},x=N=>{const U=N.target.files?.[0];if(!U)return;const ne=new FileReader;ne.onload=re=>{try{const xe=re.target?.result;if(typeof xe=="string"){const _e=JSON.parse(xe);Array.isArray(_e)&&a.value.push(..._e)}}catch(xe){console.error("Error parsing file:",xe)}},ne.readAsText(U)},g=()=>{const N=JSON.stringify(a.value,null,2),j=new Blob([N],{type:"application/json"}),U=URL.createObjectURL(j),ne=document.createElement("a");ne.href=U,ne.download="data.json",ne.click(),URL.revokeObjectURL(U)},w=new Set(["autocomplete","select","radio","checkbox","combobox"]),b=new Map,S=(N,j)=>{const U=`/api/suggest/${N}`,ne=U.includes("?")?"&":"?",re=j?`&val=${j}`:"";return`${U}${ne}json=1${re}`},D=N=>N==null||N===""?null:typeof N=="object"?N?.id!==void 0&&N.id!==null&&N.id!==""?N.id:null:N,C=N=>{const j=new Set;return Array.isArray(a.value)&&a.value.forEach(U=>{const ne=U?.[N];if(ne==null||ne==="")return;if(Array.isArray(ne)){ne.forEach(xe=>{const _e=D(xe);_e!==null&&j.add(_e)});return}const re=D(ne);re!==null&&j.add(re)}),j},O=async()=>{if(!t.colModel?.length)return;const N=t.colModel.filter(j=>j.data&&w.has(j.type?.toLowerCase()||""));N.length&&await Promise.all(N.map(async j=>{const U=j.key||j.name;if(!U)return;const ne=C(U),re=Array.from(ne).map($=>String($)).sort(),xe=re.join(",");if(!re.length||b.get(U)===xe)return;b.set(U,xe);const _e=re.map(encodeURIComponent).join(",");try{const G=await(await fetch(S(j.data,_e))).json();o.value[U]=G?.data??G}catch($){console.error("Failed to fetch column values",$)}}))};e.watch([()=>t.colModel,()=>a.value],()=>{O()},{immediate:!0,deep:!0});const W=e.ref(""),Y=e.ref(!1);let L="edit",F=0;const R=N=>(N?.format||N?.type||"").toString().toLowerCase(),K=e.computed(()=>t.colModel?.filter(N=>R(N)!=="slot").map(N=>{const{slot:j,...U}=N;return U})??[]),T=e.ref({}),A=e.ref({}),Z=N=>typeof N!="string"?!1:!!n[N],q=(N,j)=>j?j.split(".").reduce((U,ne)=>U==null?U:U[ne.trim()],N):N,me=(N,j)=>typeof N!="string"?"":N.replace(/{{\s*([^}]+)\s*}}/g,(U,ne)=>{const re=q(j,ne.trim());return re??""}),pe=N=>{if(N==null||N==="")return"";if(typeof N=="number")return N;if(typeof N=="boolean")return N?1:0;if(typeof N=="string")return N.toLowerCase();if(Array.isArray(N))return N.map(j=>pe(j)).join(", ");if(typeof N=="object"){if(N.text!==void 0)return String(N.text).toLowerCase();if(N.label!==void 0)return String(N.label).toLowerCase();if(N.id!==void 0)return String(N.id).toLowerCase()}return String(N).toLowerCase()},Ae=N=>{const j=N.key||N.name;if(j){if(s.value===j){i.value=i.value==="asc"?"desc":"asc";return}s.value=j,i.value="asc"}};async function Ue(){W.value="Додати",Y.value=!0,L="add",T.value={}}function H(N,j){if(!N?.length)return null;const U=typeof j=="object"?j?.id:j;return U==null||U===""?null:N.find(ne=>ne?.id?.toString()===U.toString())?.text??null}function oe(N){return N==null||N===""?"-":Array.isArray(N)?N.map(j=>typeof j=="object"?j?.text??j?.id??"-":j).join(", "):typeof N=="object"?N?.text??N?.id??"-":N}function ue(N,j){const U=j.key||j.name,ne=N?.[U],re=o.value[U];if(!ne)return"-";if(Array.isArray(ne)){const _e=ne.map($=>H(re,$)).filter(Boolean);return _e.length?_e.join(", "):oe(ne)}const xe=H(re,ne);return xe||oe(ne)}async function fe(N,j){W.value="Редагувати",Y.value=!0,L="edit",F=j,T.value={...N}}function ke(){const N=A.value.validate();if(N){he.notify({type:"warning",title:"Помилка валідації",message:Object.entries(N).map(([j,U])=>`${j}: ${U}`).join(`
|
|
2
|
-
`)});return}L==="add"?Array.isArray(a.value)?a.value=[...a.value,T.value]:a.value=[T.value]:a.value=a.value.map((j,U)=>U===F?T.value:j),Y.value=!1}function z(N){a.value=a.value.filter((j,U)=>U!==N)}function le(){Y.value=!1}return(N,j)=>(e.openBlock(),e.createElementBlock("div",Vs,[e.createElementVNode("div",Cs,[e.createElementVNode("div",Bs,[e.createVNode(os,{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]=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",Ss,[e.createElementVNode("input",{ref_key:"fileInput",ref:y,onChange:x,class:"hidden",accept:".json",type:"file"},null,544),e.createElementVNode("button",{type:"button",onClick:f,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(cs,{class:"text-gray-700",width:"16",height:"16"}),j[4]||(j[4]=e.createTextVNode(" Імпорт ",-1))]),e.createElementVNode("button",{type:"button",onClick:g,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(ms,{class:"text-gray-700",width:"16",height:"16"}),j[5]||(j[5]=e.createTextVNode(" Експорт ",-1))]),e.createElementVNode("button",{onClick:Ue,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(ze,{class:"text-white"}),j[6]||(j[6]=e.createTextVNode(" Додати ",-1))])])]),e.createElementVNode("div",Ns,[e.createElementVNode("table",$s,[e.createElementVNode("thead",Ms,[e.createElementVNode("tr",Ds,[e.createElementVNode("th",As,[e.createVNode(St,{width:"20",height:"20",class:"mx-auto text-gray-400"})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(N.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:ne=>Ae(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",Is,e.toDisplayString(i.value==="asc"?"▲":"▼"),1)):e.createCommentVNode("",!0)],8,Fs)]))),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":!p.value}])},[c.value.length===0?(e.openBlock(),e.createElementBlock("td",Ls,[e.createElementVNode("div",Ts,[e.createElementVNode("div",Os,[e.createVNode(ws,{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(c.value,(U,ne)=>(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===ne,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":p.value===ne}]),draggable:"true",onDragstart:re=>V(ne),onDragover:e.withModifiers(re=>k(ne),["prevent"]),onDrop:re=>v(ne)},[e.createElementVNode("td",Rs,[e.createElementVNode("div",js,[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(N.colModel,re=>(e.openBlock(),e.createElementBlock("td",{key:re.key,class:"px-4 py-3 align-middle"},[R(re)==="slot"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[Z(re.slot)?e.renderSlot(N.$slots,re.slot,{key:0,row:U,value:U[re.key],column:re}):(e.openBlock(),e.createElementBlock("div",{key:1,class:"text-sm text-gray-900",innerHTML:me(re.slot,U)},null,8,Ps))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[R(re)==="file"?(e.openBlock(),e.createElementBlock("div",Us,[h(ue(U,re))?(e.openBlock(),e.createElementBlock("div",Hs,[e.createElementVNode("img",{src:ue(U,re),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,qs)])):(e.openBlock(),e.createElementBlock("div",Ks,[e.createVNode(Cn,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):R(re)==="color"?(e.openBlock(),e.createElementBlock("div",Gs,[e.createElementVNode("span",{class:"inline-flex h-6 w-6 rounded border border-gray-200",style:e.normalizeStyle({backgroundColor:ue(U,re)||"#ffffff"})},null,4)])):(e.openBlock(),e.createElementBlock("div",Ys,e.toDisplayString(ue(U,re)),1))],64))]))),128)),e.createElementVNode("td",Ws,[e.createElementVNode("div",Zs,[e.createElementVNode("button",{onClick:re=>fe(U,ne),class:"p-1.5 text-gray-600 hover:text-blue-600 hover:bg-blue-50 rounded transition-colors"},[e.createVNode(Es,{width:"16",height:"16"})],8,Js),e.createElementVNode("button",{onClick:re=>z(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,Xs)])])],42,zs))),128))],2)])]),e.createVNode(e.unref(he.VsModal),{visible:Y.value,title:W.value,size:"lg",onClose:le,teleport:"#modal"},{default:e.withCtx(()=>[e.createVNode(He,{schema:K.value,values:T.value,"onUpdate:values":j[1]||(j[1]=U=>T.value=U),form:A.value,"onUpdate:form":j[2]||(j[2]=U=>A.value=U)},null,8,["schema","values","form"]),e.createElementVNode("div",Qs,[e.createElementVNode("button",{type:"button",onClick:j[3]||(j[3]=U=>Y.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:ke,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"])]))}}),ei={},ti={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 ni(l,t){return e.openBlock(),e.createElementBlock("svg",ti,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 li=ae(ei,[["render",ni]]),ai={},oi={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 ri(l,t){return e.openBlock(),e.createElementBlock("svg",oi,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 si=ae(ai,[["render",ri]]),ii={},ci={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 di(l,t){return e.openBlock(),e.createElementBlock("svg",ci,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 ui=ae(ii,[["render",di]]),pi={},mi={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 fi(l,t){return e.openBlock(),e.createElementBlock("svg",mi,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 hi=ae(pi,[["render",fi]]),gi={},yi={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 ki(l,t){return e.openBlock(),e.createElementBlock("svg",yi,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 bi=ae(gi,[["render",ki]]),wi={class:"bg-white/30 p-1 rounded-md shadow w-fit"},xi={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 p=c.url;return Object.entries(d).forEach(([y,V])=>{p=p.replace(new RegExp(y,"gi"),String(V))}),p}return(c,d)=>(e.openBlock(),e.createElementBlock("div",wi,[e.createElementVNode("div",xi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.basemaps,(p,y)=>(e.openBlock(),e.createElementBlock("div",{key:y,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":a.value===y}]),onClick:V=>r(y),title:p.name||y,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:i(p),alt:"",class:"w-10 h-10 object-cover"},null,8,vi)],10,_i))),128))])]))}}),Vi={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},Ci={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"],Si={class:"relative flex-1 min-w-[140px]"},Ni=["placeholder"],$i="https://data.softpro.ua/api-user/gis-url-proxy",Mi="https://geo.rv.ua/api-user/dzk.api",Di=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 y(b){i.value=b}function V(b){if(!d.value)return;const S=p.value;S&&!S.contains(b.target)&&(d.value=!1)}e.onMounted(()=>{window.addEventListener("click",V,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",V,!0)});function k(b){return b==="xy"?"Координати":b==="parcel"?"Кадастр":"Адреси"}function v(b){const S=b.replace(/[,]+/g," ").trim();if(!S)return null;const D=S.split(/\s+/).filter(Boolean);if(D.length<2)return null;const C=D.slice(0,2).map(Number);if(!C.every(K=>Number.isFinite(K)))return null;const[O,W]=C;let Y=O,L=W;const F=K=>Math.abs(K)<=90,R=K=>Math.abs(K)<=180;if(!F(Y)||!R(L))if(F(L)&&R(Y))Y=W,L=O;else return null;return{lat:Y,lng:L}}function f(b){return(b?.items||[]).map((D,C)=>({id:String(D?.id??C),title:D?.title||D?.address?.label||"Знайдений обʼєкт",lat:Number(D?.position?.lat),lng:Number(D?.position?.lng)})).filter(D=>Number.isFinite(D.lat)&&Number.isFinite(D.lng))}function h(b){const S=b?.result||b?.data||b;if(!S)return[];const D=S.geom_centroid;if(!D||!Array.isArray(D.coordinates))return[];const[C,O]=D.coordinates;return!Number.isFinite(O)||!Number.isFinite(C)?[]:[{id:"parcel",title:S.cadnum||S.cad_num||"Земельна ділянка",lat:O,lng:C}]}function x(b){const D=b.replace(/\s+/g,"").split(":");if(D.length!==4)return!1;const C=[10,2,3,4];return D.every((O,W)=>O.length===C[W]&&/^\d+$/.test(O))}function g(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){he.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}g(S),c.value="";return}try{const S=new URL(i.value==="here"?$i:Mi);if(i.value==="here")S.searchParams.set("searchtext",b);else{if(!x(b)){he.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}S.searchParams.set("cad_num",b)}const D=await fetch(S.toString());if(!D.ok)throw new Error(`HTTP ${D.status}`);const C=await D.json(),O=i.value==="here"?f(C):h(C);if(!O.length)he.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const W=O[0];g(W),c.value=""}}catch(S){const D=S?.message||"Помилка пошуку";he.notify({type:"error",title:"Пошук",message:D})}}}return(b,S)=>(e.openBlock(),e.createElementBlock("div",Vi,[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]=D=>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",Ci,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,D=>(e.openBlock(),e.createElementBlock("li",{key:D,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:C=>y(D)},e.toDisplayString(k(D)),9,Bi))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",Si,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":S[1]||(S[1]=D=>c.value=D),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,Ni),[[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-b5059a01"]]),Ai={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},Fi={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},Ii={class:"flex items-center gap-1"},Li=["disabled"],Ti=["disabled"],Oi=["disabled"],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={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"},Ki={class:"space-y-0.5"},Gi={class:"text-gray-500"},Yi={class:"text-gray-900 text-right break-all"},Wi={class:"absolute left-4 bottom-[36px] z-[1000]"},Zi={class:"flex flex-col gap-2"},Ji={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]"},Xi={class:"flex flex-col gap-1"},Qi=["checked","disabled","onChange"],ec={class:"text-gray-700 text-xs font-medium"},tc={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"},nc={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full px-2 pb-1"},lc={class:"mr-auto flex items-center gap-2 min-w-0 relative"},ac={class:"shrink-0"},oc={class:"font-bold"},rc={class:"flex items-center"},sc={class:"text-xs mr-2"},ic={key:0,class:"text-xs mr-2"},cc={key:1,class:"text-xs mr-2"},dc=["disabled"],uc=["disabled"],Nt="__vs_form_maplibre_loader__",rn="__vs_form_maplibre_scripts__",$t="vs-global-bounds-src",Mt="vs-global-bounds-line",In=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(),y=p?.appContext?.config?.globalProperties?.$settings??{},V=y?.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(V.center)&&V.center.length===2?V.center:Array.isArray(y.center)&&y.center.length===2?y.center:[30,50];console.log(V);const h=typeof V.zoom=="number"?V.zoom:typeof y.zoom=="number"?y.zoom:typeof y.defaultZoom=="number"?y.defaultZoom:10,x=e.computed(()=>v("center")?n.center:V.center??n.center),g=e.computed(()=>v("zoom")?n.zoom:V.zoom??n.zoom),w=e.computed(()=>v("katottg")?String(n.katottg??""):String(V.katottg??n.katottg??"")),b=e.computed(()=>v("layers")?n.layers??[]:V.layers??n.layers??[]),S=e.computed(()=>v("bounds")?n.bounds:V.bounds??n.bounds),D=e.ref(Array.isArray(x.value)&&x.value.length===2?[...x.value]:f),C=e.ref(typeof g.value=="number"?g.value:h),O=e.ref(n.modelValue),W=e.ref(null),Y=e.ref([]);let L=!1;const F=e.reactive({}),R=e.ref([]),K=e.computed(()=>R.value.map(u=>F[u]).filter(Boolean)),T=e.ref(null),A=e.computed(()=>T.value?.entries??[]),Z=e.computed(()=>{if(T.value)return{left:`${T.value.point.x+12}px`,top:`${T.value.point.y+12}px`}}),q=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 me(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 pe(){const u=Array.isArray(V.basemaps)&&V.basemaps.length?V.basemaps:y.basemaps;if(Array.isArray(u)&&u.length){const _=u.map((B,P)=>{const te=String(B?.key??B?.id??B?.name??`b${P}`),X=me(String(B?.url??""));if(!X)return null;const ie=typeof B?.preview=="string"&&B.preview?me(B.preview):"";return[te,{...B,url:X,preview:ie}]}).filter(B=>Array.isArray(B)&&B.length===2).reduce((B,[P,te])=>(B[P]=te,B),{});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=pe(),Ue=Object.keys(Ae),H=e.ref(Ue.length?Ue[0]:"");async function oe(){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(Me=>Me?.href?.includes(X)))return;const ve=document.createElement("link");ve.rel="stylesheet",ve.href=X,document.head.appendChild(ve)},B=X=>(m[X]||(m[X]=new Promise((ie,ve)=>{const Me=Array.from(document.scripts).find(Le=>Le.src===X);if(Me){Me.addEventListener("load",()=>ie(),{once:!0}),Me.addEventListener("error",ve,{once:!0}),X.includes("maplibre")&&window.maplibregl&&ie(),X.includes("mapbox-gl-draw")&&window.MapboxDraw&&ie();return}const Se=document.createElement("script");Se.src=X,Se.async=!1,Se.onload=()=>ie(),Se.onerror=ve,document.head.appendChild(Se)})),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 B("https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js"),window.MapboxDraw||await B("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,ke=null,z=null,le=null,N=null,j=null,U=!1,ne=!1;function re(){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[_,B]=u.startPoint,P=m.lngLat.lng,te=m.lngLat.lat;u.rectangle.setCoordinates([[[_,B],[P,B],[P,te],[_,te],[_,B]]])},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[_,B]=u.startPoint,P=m.lngLat.lng,te=m.lngLat.lat;return Math.abs(_-P)>0&&Math.abs(B-te)>0?(u.rectangle.setCoordinates([[[_,B],[P,B],[P,te],[_,te],[_,B]]]),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 B=m.properties.id===u.rectangle.id;m.properties.active=B?"true":"false",_(m)}}}const xe=[{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 _e(){const u=H.value;return!u||!Ae[u]?.url?"":Ae[u].url}function $(u,m){return u?.id?String(u.id):u?.url?`${u.url}-${m}`:`layer-${m}`}function G(u){const m=String(u?.url??"").trim();if(!m)return"";if(/^https?:\/\//i.test(m))return m;const _=window.location?.origin??"",B=m.replace(/^\/+/,"");return`${_}/${B}`}function J(u){u&&T.value?.layerId!==u||(T.value=null)}function ye(u,m={}){return u.popup===!1?[]:Array.isArray(u.popup)?u.popup.length?u.popup.map(_=>{const B=_?.field||_?.name;if(!B)return null;const P=m[B];return P==null||P===""?null:{key:_.label||B,value:String(P)}}).filter(Boolean):[]:Object.entries(m).slice(0,5).map(([_,B])=>({key:_,value:B==null?"—":String(B)}))}function $e(u){if(!Array.isArray(u))return[];const m=B=>Array.isArray(B)&&B.length>=2&&Number.isFinite(Number(B[0]))&&Number.isFinite(Number(B[1])),_=B=>{if(!B.length)return B;const P=B[0],te=B[B.length-1];return!te||P[0]!==te[0]||P[1]!==te[1]?[...B,P]:B};if(u.length&&m(u[0])){const B=u.map(P=>[Number(P[0]),Number(P[1])]).filter(m);return B.length?[_(B)]:[]}return u.length&&Array.isArray(u[0])&&m(u[0][0])?u.map(P=>Array.isArray(P)?P.map(te=>[Number(te[0]),Number(te[1])]):[]).filter(P=>P.length).map(_):u.length&&Array.isArray(u[0])&&Array.isArray(u[0][0])&&m(u[0][0][0])?u.flatMap(P=>Array.isArray(P)?P:[]).map(P=>Array.isArray(P)?P.map(te=>[Number(te[0]),Number(te[1])]):[]).filter(P=>P.length).map(_):[]}function Ye(u){const m=u.style??{},_=m.color??"#3b82f6";if(!m.colorAttr||!m.colorSet)return _;const B=Object.keys(m.colorSet);if(!B.length)return _;const P=["match",["to-string",["get",m.colorAttr]]];return B.forEach(te=>{P.push(String(te),m.colorSet?.[te]??_)}),P.push(_),P}function Oe(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),J(u.id)}function bn(u,m){if(!z)return[];const _=`vs-ov-bounds-src-${m}`,B=`vs-ov-bounds-line-${m}`,P=u.bounds??S.value??Y.value,te=$e(P);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:B,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]}}),[B]}function Ie(u){if(!z)return;Oe(u);const m=u.config,_=G(m);if(!_)return;const B=[],P=[];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 ve=String(m.style?.type??"polygon").toLowerCase(),Me=Ye(m),Se=m.style?.opacity??.5;if(ve==="point"){const Le=`vs-ov-point-${u.id}`;z.addLayer({id:Le,type:"circle",source:u.sourceId,"source-layer":ie,paint:{"circle-color":Me,"circle-radius":5,"circle-opacity":Se}}),B.push(Le)}else if(ve==="polyline"||ve==="line"){const Le=`vs-ov-line-${u.id}`;z.addLayer({id:Le,type:"line",source:u.sourceId,"source-layer":ie,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":Me,"line-width":m.style?.width??2,"line-opacity":Se}}),B.push(Le)}else{const Le=`vs-ov-fill-${u.id}`,Vt=`vs-ov-border-${u.id}`;z.addLayer({id:Le,type:"fill",source:u.sourceId,"source-layer":ie,paint:{"fill-color":Me,"fill-opacity":Se}}),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":Se}}),B.push(Le,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}}),B.push(ie)}B.forEach(ie=>{const ve=Se=>{if(!Se?.features?.length){J(u.id);return}const Le=Se.features[0]?.properties??{},Vt=ye(u.config,Le);if(!Vt.length){J(u.id);return}T.value={layerId:u.id,entries:Vt,point:{x:Se.point.x,y:Se.point.y}}},Me=()=>J(u.id);z.on("mousemove",ie,ve),z.on("mouseleave",ie,Me),P.push({layerId:ie,type:"mousemove",handler:ve},{layerId:ie,type:"mouseleave",handler:Me})}),u.layerIds=B,u.boundsIds=bn(u.config,u.id),u.handlers=P;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:$e(S.value??Y.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(B=>{z.getLayer(B)&&z.setLayoutProperty(B,"visibility",_)}),qe(),m.visible||J(u)}function qe(){if(!z)return;const u=[],m=[],_=[],B=[];R.value.forEach(X=>{const ie=F[X];if(!ie)return;const ve=String(ie.config?.url??""),Me=/\.v(?:m)?t(?:\?|$)/i.test(ve),Se=/\.png(?:\?|$)/i.test(ve);Me?_.push(...ie.layerIds):Se?u.push(...ie.layerIds):m.push(...ie.layerIds),B.push(...ie.boundsIds)}),[...u,...m,..._,...B].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]||(H.value=u,!z))return;const m=_e();if(!m)return;const _=z.getCenter?.(),B=z.getZoom?.(),P=le?.getAll?.();z.setStyle(ue(m)),z.once("style.load",()=>{if(z&&(_&&Number.isFinite(B)&&z.jumpTo({center:[_.lng,_.lat],zoom:B}),We(),R.value.forEach(te=>{const X=F[te];X&&Ie(X)}),qe(),P?.features?.length&&le))try{P.features.forEach(te=>le.add(te)),i.value=P.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[[_,B],[P,te]]=m;return{lat:(B+te)/2,lng:(_+P)/2}}function xt(u){if(!Array.isArray(u)||u.length<3)return 0;const m=(B,P)=>{const te=B*2003750834e-2/180,X=Math.log(Math.tan((90+P)*Math.PI/360))/(Math.PI/180);return[te,X*2003750834e-2/180]};let _=0;for(let B=0;B<u.length-1;B+=1){const[P,te]=m(Number(u[B][0]),Number(u[B][1])),[X,ie]=m(Number(u[B+1][0]),Number(u[B+1][1]));_+=P*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 B=_?.[0];return Array.isArray(B)?m+xt(B):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,B=-1/0,P=-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]),ve=Number(X[1]);m=Math.min(m,ie),_=Math.min(_,ve),B=Math.max(B,ie),P=Math.max(P,ve);return}X.forEach(te)}};return te(u.coordinates),!Number.isFinite(m)||!Number.isFinite(_)?null:[[m,_],[B,P]]}function _t(u){if(!z||!u)return;const m=st(u);if(!m)return;const[[_,B],[P,te]]=m;if(_===P&&B===te){z.easeTo({center:[_,B],zoom:Math.max(C.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){N=null,d.value=null,L||(j="__null__",a("update:modelValue",null));return}const m=bt(u.features[u.features.length-1]?.geometry??null);N=m,Ze(m),L||(j=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(L=!0,ct(),m)try{le.add(kt(m))}catch{}L=!1,N=bt(m),it(),Ze(m),m&&(_t(m),o.value||M())}function wn(){if(le){if(L=!0,ct(),N)try{le.add(kt(N))}catch{}L=!1,it(),Ze(N)}}function Je(){if(le){try{le.changeMode("simple_select",{featureIds:[]})}catch{}c.value=""}}function E(u){if(o.value||!le)return;ne=!0,Je(),c.value=u;const m=u==="marker"?"draw_point":u==="polyline"?"draw_line_string":u==="rectangle"?"draw_rectangle":"draw_polygon";L=!0,ct(),L=!1;try{le.changeMode(m)}catch{c.value=""}finally{requestAnimationFrame(()=>{ne=!1})}}function M(){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 I(){o.value||!le||(Je(),ct(),j="__null__",d.value=null,a("update:modelValue",null))}function ee(){o.value||!N||_t(N)}function ge(u){z&&z.easeTo({center:[u[1],u[0]],zoom:13,duration:250})}function be(){o.value||W.value?.click()}function we(u){if(o.value||!le)return;const m=u.target,_=m.files?.[0];if(!_)return;const B=new FileReader;B.onload=()=>{try{const P=JSON.parse(String(B.result)),te=rt(P);if(!te)return;Et(te)}finally{m.value=""}},B.readAsText(_)}function Ee(){if(o.value||!le)return;const u=le.getAll(),m=new Blob([JSON.stringify(u,null,2)],{type:"application/json"}),_=URL.createObjectURL(m),B=document.createElement("a");B.href=_,B.download="data.geojson",B.click(),URL.revokeObjectURL(_)}return e.onMounted(async()=>{if(!s.value)return;const u=await oe();fe=u.maplibregl,ke=u.MapboxDraw;const m=_e();m&&(z=new fe.Map({container:s.value,style:ue(m),center:[D.value[0],D.value[1]],zoom:C.value,attributionControl:!1}),z.addControl(new fe.NavigationControl({showCompass:!0}),"bottom-right"),z.on("load",()=>{if(!(!ke||!z)){if(le=new ke({displayControlsDefault:!1,modes:{...ke.modes,draw_rectangle:re()},controls:{point:!1,line_string:!1,polygon:!1,trash:!1},styles:xe}),z.addControl(le),z.on("draw.create",()=>{if(!le)return;const _=le.getAll();if(_.features.length>1){const B=_.features[_.features.length-1];L=!0,_.features.slice(0,-1).forEach(P=>le.delete(P.id)),L=!1,B&&(L=!0,le.add(B),L=!1)}vt(),M()}),z.on("draw.update",_=>{if(!U){if(_?.action==="move"){if(U=!0,wn(),U=!1,c.value==="edit"){const B=le?.getAll?.()?.features?.[0];if(B?.id)try{le.changeMode("direct_select",{featureId:B.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||U)&&c.value!=="edit"&&!(c.value==="marker"||c.value==="polyline"||c.value==="polygon"||c.value==="rectangle")){if(!o.value&&i.value>0){M();return}try{le.changeMode("simple_select",{featureIds:[]})}catch{}}}),O.value!==void 0){const _=O.value;O.value=void 0,requestAnimationFrame(()=>{le&&Et(_)})}We(),R.value.forEach(_=>{const B=F[_];B&&Ie(B)}),qe()}}),z.on("zoomend",()=>{z&&(C.value=z.getZoom())}))}),e.onUnmounted(()=>{Object.values(F).forEach(u=>{z&&Oe(u)}),J(),z?.remove&&z.remove(),z=null,le=null}),e.watch(()=>n.modelValue,u=>{if(!le){O.value=u;return}const m=rt(u),_=wt(m);if(j&&_===j){j=null;return}j=null,Et(u)},{deep:!0}),e.watch(()=>b.value,u=>{const m=Array.isArray(u)?u:[],_=[],B=new Set;m.forEach((P,te)=>{if(!P)return;const X=$(P,te);_.push(X),B.add(X);const ie={...P,id:X},ve=F[X],Me=ve?.visible??!!ie.visible;ve&&z&&Oe(ve),F[X]={id:X,config:ie,visible:Me,sourceId:`vs-ov-src-${X}`,layerIds:[],boundsIds:[],handlers:[]}}),Object.keys(F).forEach(P=>{if(B.has(P))return;const te=F[P];te&&z&&Oe(te),delete F[P]}),R.value=_,z&&(R.value.forEach(P=>{const te=F[P];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(Y.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 B=(await m.json())?.geometry?.coordinates;Array.isArray(B)&&B.length&&(Y.value=B)}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(D.value,m)||(D.value=[...m],!z))return;const _=z.getCenter?.();_&&et([_.lng,_.lat],D.value)||z.easeTo({center:[D.value[0],D.value[1]]})},{deep:!0}),e.watch(()=>g.value,u=>{typeof u=="number"&&(C.value=u,z&&z.setZoom(u))}),e.watch(o,u=>{u&&Je()}),e.watch(i,u=>{if(u>0){o.value||M();return}ne||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),q.value.search||q.value.import||q.value.export?(e.openBlock(),e.createElementBlock("div",Ai,[q.value.search?(e.openBlock(),e.createBlock(Di,{key:0,onGoToCoordinates:ge})):e.createCommentVNode("",!0),q.value.import||q.value.export?(e.openBlock(),e.createElementBlock("div",Fi,[e.createElementVNode("div",Ii,[q.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),q.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:Ee,disabled:o.value||i.value===0}," Export ",8,Ti)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:W,type:"file",onChange:we,accept:".json,.geojson",class:"hidden",disabled:o.value},null,40,Oi)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",zi,[e.createElementVNode("div",Ri,[q.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]=_=>E("marker")),disabled:o.value},[e.createVNode(li)],10,ji)):e.createCommentVNode("",!0),q.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]=_=>E("polyline")),disabled:o.value},[e.createVNode(si)],10,Pi)):e.createCommentVNode("",!0),q.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]=_=>E("polygon")),disabled:o.value},[e.createVNode(ui)],10,Ui)):e.createCommentVNode("",!0),q.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]=_=>E("rectangle")),disabled:o.value},[e.createVNode(hi)],10,Hi)):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(bi,{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(Z.value)},[e.createElementVNode("div",qi,[e.createElementVNode("dl",Ki,[(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",Gi,e.toDisplayString(_.key),1),e.createElementVNode("dd",Yi,e.toDisplayString(_.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",Wi,[e.createElementVNode("div",Zi,[e.createVNode(Ei,{basemaps:e.unref(Ae),onOnLayerChange:qt},null,8,["basemaps"]),K.value.length?(e.openBlock(),e.createElementBlock("div",Ji,[m[5]||(m[5]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),e.createElementVNode("div",Xi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(K.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:B=>ot(_.id)},null,40,Qi),e.createElementVNode("span",ec,e.toDisplayString(_.config.title||_.config.name||_.id),1)]))),128))])])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",tc,[d.value?(e.openBlock(),e.createElementBlock("div",nc,[e.createElementVNode("div",lc,[e.createElementVNode("div",ac,[m[6]||(m[6]=e.createTextVNode(" Type: ",-1)),e.createElementVNode("span",oc,e.toDisplayString(d.value.type),1)])]),e.createElementVNode("div",rc,[e.createElementVNode("div",sc,[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",ic,[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",cc,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,dc),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:I,disabled:o.value},[e.createVNode(nt,{class:"w-3 h-3"})],8,uc)])])):e.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-3b015982"]]),pc=["data-focus"],mc={class:"flex items-center"},fc={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},hc=["onClick","aria-label"],gc={key:0,class:"absolute text-gray-500 truncate pl-2"},yc={class:"flex-1 min-w-[2px]"},kc=["placeholder"],bc={class:"flex items-center shrink-0"},wc=["disabled"],Ln=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;Ne(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…"),y=e.computed(()=>d.value?.length===0&&c.value===""),V=e.computed(()=>!n.disabled&&d.value?.length>0),k=e.computed(()=>n.disabled),v=async()=>{k.value||await e.nextTick(()=>s.value?.focus())},f=D=>{const C=D.trim();C!==""&&(!d.value||!Array.isArray(d.value)?d.value=[C]:n.unique?d.value.includes(C)||(d.value=[...d.value,C]):d.value=[...d.value,C],c.value="")},h=()=>{const D=c.value;D.trim()!==""&&f(D),c.value=""},x=D=>{const C=d.value.slice();C.splice(D,1),a("update:modelValue",C)},g=()=>{a("update:modelValue",[])},w=()=>{k.value||(i.value=!0)},b=()=>{i.value=!1,!k.value&&h()},S=D=>{const{key:C}=D;C==="Enter"?(D.preventDefault(),h()):C==="Backspace"&&c.value===""&&d.value.length>0&&x(d.value.length-1)};return(D,C)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:C[1]||(C[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,(O,W)=>(e.openBlock(),e.createElementBlock("div",{key:W,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",mc,[e.createElementVNode("div",fc,e.toDisplayString(O),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(Y=>x(W),["stop"]),"aria-label":`Remove ${O}`},C[2]||(C[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,hc)]))),128)),y.value?(e.openBlock(),e.createElementBlock("div",gc,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",yc,[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":C[0]||(C[0]=O=>c.value=O),onFocus:w,onBlur:b,onKeydown:S,placeholder:d.value&&d.value.length?"":void 0},null,40,kc)),[[e.vModelText,c.value]])])],512),e.createElementVNode("div",bc,[V.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(g,["stop"])},C[3]||(C[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,wc)):e.createCommentVNode("",!0)])],10,pc)],2)],512))}}),xc={class:"relative flex gap-1 bg-white w-full"},_c=["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",xc,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:s.disabled,placeholder:s.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,_c),[[e.vModelText,a.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:r}," Gen ")]))}}),[["__scopeId","data-v-b0eba370"]]),vc={class:"relative flex gap-1 bg-white w-full"},Ec=["disabled","placeholder"],Vc=["disabled"],Cc={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 y=await(await fetch(d)).text();n.value=y}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",vc,[e.withDirectives(e.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":p[0]||(p[0]=y=>n.value=y),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,Ec),[[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||d.disabled||!r.value,onClick:i},[a.value?(e.openBlock(),e.createElementBlock("span",Bc,"...")):(e.openBlock(),e.createElementBlock("span",Cc,"Gen"))],8,Vc)]))}}),[["__scopeId","data-v-6ee5237d"]]),Sc={class:"w-full"},Nc={ref:"sortableContainer",class:"flex flex-col gap-1"},$c=["onDragstart","onDrop"],Mc={class:"w-1/3"},Dc={class:"w-2/3"},Ac=["onClick"],Fc={key:0,class:"text-[14px] text-gray-700"},Ic={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=h=>`${h}-${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 h=o.parent&&a?.value?.[o.parent]||o.modelValue||{};c.value=Object.entries(h).filter(([x])=>!i.includes(x)).map(([x,g])=>({id:n("key-value-"),key:x,value:g}))})();function y(h){d.value=h}function V(h){if(d.value===null||d.value===h)return;const x=c.value.splice(d.value,1)[0];c.value.splice(h,0,x),d.value=null}const k=e.computed(()=>c.value.some(h=>h.key&&!h.value||!h.key&&h.value)),v=()=>{c.value.push({id:n("key-value-"),key:"",value:""})},f=h=>{c.value=c.value.filter(x=>x.id!==h)};return e.watch(c,h=>{const x={};h.forEach(w=>{w.key&&w.value!==void 0&&(x[w.key]=w.value)});const g={};i.length&&i.forEach(w=>{g[w]=o.parent?a?.value?.[o.parent]?.[w]:void 0}),a?.value&&o.parent&&(a.value[o.parent]={...g,...x}),r("update:modelValue",x)},{deep:!0}),(h,x)=>(e.openBlock(),e.createElementBlock("div",Sc,[e.createElementVNode("div",Nc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(g,w)=>(e.openBlock(),e.createElementBlock("div",{key:g.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===w}]),draggable:"true",onDragstart:b=>y(w),onDragover:x[0]||(x[0]=e.withModifiers(()=>{},["prevent"])),onDrop:b=>V(w)},[x[1]||(x[1]=e.createStaticVNode('<button class="cursor-move" data-v-81b9444f><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-81b9444f><circle cx="15" cy="12" r="1.5" data-v-81b9444f></circle><circle cx="15" cy="24" r="1.5" data-v-81b9444f></circle><circle cx="21" cy="12" r="1.5" data-v-81b9444f></circle><circle cx="21" cy="24" r="1.5" data-v-81b9444f></circle><circle cx="21" cy="18" r="1.5" data-v-81b9444f></circle><circle cx="15" cy="18" r="1.5" data-v-81b9444f></circle></svg></button>',1)),e.createElementVNode("div",Mc,[e.createVNode(tt,{modelValue:g.key,"onUpdate:modelValue":b=>g.key=b,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Dc,[e.createVNode(tt,{modelValue:g.value,"onUpdate:modelValue":b=>g.value=b,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:b=>f(g.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[e.createVNode(e.unref(Ct),{height:"16",width:"16"})],8,Ac)],42,$c))),128))],512),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Fc," Дані для відображення відсутні ")),e.createElementVNode("div",Ic,[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(ze,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(s)),1)],8,Lc)])]))}}),[["__scopeId","data-v-81b9444f"]]),Tc={class:"w-full"},Oc={ref:"sortableContainer",class:"flex flex-col gap-1"},zc=["onDragstart","onDrop"],Rc=["disabled"],jc={class:"flex-1"},Pc=["onClick","disabled"],Uc={key:0,class:"text-[14px] text-gray-700"},Hc={class:"mt-2 w-full flex items-center"},qc=["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=h=>`${h}-${Math.random().toString(36).substring(2,15)}`,p=h=>{const x=h??n.value??[];a.value=x.map((g,w)=>({id:a.value[w]?.id??d("text-array"),value:g??""}))};p(),e.watch(()=>n.value,h=>{if(c){c=!1;return}p(h||[])},{deep:!0}),e.watch(a,h=>{c=!0,n.value=h.map(x=>x.value).filter(x=>x!=null&&x!=="")},{deep:!0});const y=e.computed(()=>r.value||a.value.some(h=>!h.value));function V(){y.value||(a.value=[...a.value,{id:d("text-array"),value:""}])}function k(h){r.value||(a.value=a.value.filter(x=>x.id!==h))}function v(h){r.value||(o.value=h)}function f(h){if(r.value||o.value===null||o.value===h)return;const x=[...a.value],[g]=x.splice(o.value,1);x.splice(h,0,g),a.value=x,o.value=null}return(h,x)=>(e.openBlock(),e.createElementBlock("div",Tc,[e.createElementVNode("div",Oc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(g,w)=>(e.openBlock(),e.createElementBlock("div",{key:g.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-66316a33><circle cx="15" cy="12" r="1.5" data-v-66316a33></circle><circle cx="15" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="12" r="1.5" data-v-66316a33></circle><circle cx="21" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="18" r="1.5" data-v-66316a33></circle><circle cx="15" cy="18" r="1.5" data-v-66316a33></circle></svg>',1)]),8,Rc),e.createElementVNode("div",jc,[h.inputType==="text"?(e.openBlock(),e.createBlock(tt,{key:0,modelValue:g.value,"onUpdate:modelValue":b=>g.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),h.inputType==="tel"?(e.openBlock(),e.createBlock(en,{key:1,modelValue:g.value,"onUpdate:modelValue":b=>g.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),h.inputType==="email"?(e.openBlock(),e.createBlock(Qt,{key:2,modelValue:g.value,"onUpdate:modelValue":b=>g.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),h.inputType==="mask"?(e.openBlock(),e.createBlock(Xt,{key:3,modelValue:g.value,"onUpdate:modelValue":b=>g.value=b,mask:h.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(g.id),disabled:r.value,class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200 disabled:opacity-50"},[e.createVNode(e.unref(Ct),{height:"16",width:"16"})],8,Pc)],42,zc))),128))],512),a.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Uc," Дані для відображення відсутні ")),e.createElementVNode("div",Hc,[e.createElementVNode("button",{type:"button",onClick:V,disabled:y.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(ze,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(i.value),1)],8,qc)])]))}}),[["__scopeId","data-v-66316a33"]]),Kc={class:"flex items-center gap-2 w-full"},Gc=["disabled"],Yc=["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}=Ne(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",Kc,[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]",[i.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Gc),[[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,Yc),[[e.vModelText,r.value]])]))}}),Wc={class:"flex items-center gap-2 w-full"},Zc=["min","max","step","disabled"],Jc=["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}=Ne(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",Wc,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),min:i.min,max:i.max,step:i.step,disabled:s.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[i.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")])},null,10,Zc),[[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,Jc),[[e.vModelText,r.value]])]))}}),Xc=["placeholder","disabled","name"],Qc=["type","value","onInput","placeholder","disabled"],ed=["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}=Ne(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,h){f&&(c.value[h]=f)}async function y(f,h){if(!f||t.inputType!=="mask")return;const{default:x}=await Promise.resolve().then(()=>kn);d.value[h]&&d.value[h].destroy(),d.value[h]=x(f,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),d.value[h].on("accept",()=>{const g=[...r.value||[]];g[h]=t.unmask?d.value[h].unmaskedValue:d.value[h].value,r.value=g}),d.value[h].on("complete",()=>{const g=[...r.value||[]];g[h]=t.unmask?d.value[h].unmaskedValue:d.value[h].value,r.value=g}),r.value?.[h]&&(d.value[h].value=r.value[h])}function V(f,h){if(s.value)return;const x=f.target.value??null,g=[...r.value];g[h]=t.inputType==="text"?x:Number(x),r.value=g}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 h=n.value-1;c.value[h]&&y(c.value[h],h)},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,g)=>g!==f);const h={};Object.keys(d.value).forEach(x=>{const g=parseInt(x,10);g>f?h[g-1]=d.value[g]:g<f&&(h[g]=d.value[g])}),d.value=h}}return e.onMounted(()=>{if(t.inputType==="mask")for(let f=0;f<n.value;f+=1)c.value[f]&&y(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(h=>{h&&h.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((h,x)=>{d.value[x]&&d.value[x].value!==h&&(d.value[x].value=h||"")})},{deep:!0}),(f,h)=>(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"},[f.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:g=>p(g,x-1),placeholder:f.placeholder,disabled:f.disabled,name:`${f.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":f.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Xc)):(e.openBlock(),e.createElementBlock("input",{key:1,type:f.inputType,value:r.value?.[x-1],onInput:g=>V(g,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":f.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Qc)),!f.disabled&&x===n.value&&f.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(ze,{height:"18",width:"18"})])):e.createCommentVNode("",!0),!f.disabled&&n.value>1&&f.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(g=>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(Ct,{height:"18",width:"18"})],8,ed)):e.createCommentVNode("",!0)]))),128))],2))}}),td=["aria-expanded","data-focus"],nd=["placeholder","disabled","readonly"],ld={class:"max-h-full"},ad=["onClick","disabled"],od={key:0,class:"px-3 py-2 text-sm text-stone-500"},rd={class:"flex flex-col gap-1"},sd=["onDragstart","onDrop"],id=["disabled"],cd=["title"],dd=["disabled","onClick","aria-label"],ud={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(""),y=e.ref(!1),V=e.ref(null),k=e.ref(null),v=e.ref(null);let f=!1,h=!1;const x=e.inject("values"),g=e.computed(()=>!!n.disabled),w=e.computed(()=>n.placeholder??"Оберіть значення"),b=e.computed(()=>n.search!==!1),S=e.computed(()=>`${n.maxHeight??280}px`),D=e.computed(()=>{const $=n.parent??n.parentValue;return $?String($):""}),C=e.computed(()=>D.value?x?.value?.[D.value]??null:null),O=$=>$==null?"__null__":String($),W=$=>{if(!$)return"";const G=$.label??$.text??$.name??$.ua??$.en;return G?String(G):$.id!==void 0&&$.id!==null?String($.id):""},Y=$=>{const G=O($);return c.value[G]||(c.value[G]=`array-select-${G}-${Math.random().toString(36).slice(2,8)}`),c.value[G]},L=e.computed(()=>new Set(r.value.map($=>O($.id)))),F=e.computed(()=>{const $=L.value;let G=[...s.value];if(!n.data&&p.value.trim()){const J=p.value.toLowerCase();G=G.filter(ye=>W(ye).toLowerCase().includes(J))}return G.filter(J=>!$.has(O(J.id)))}),R=()=>{if(!n.data)return"";const $=n.prefix??"api",G=n.api??`/${$}/suggest/${n.data}`;return`${n.host??""}${G}`},K=()=>{r.value.length&&(f=!0,r.value=r.value.map($=>({...$,text:i.value[O($.id)]??$.text})))},T=$=>{const G=O($.id),J=W($);J&&(i.value[G]=J)},A=$=>{s.value=$?[...$]:[],$?.forEach(T),K()},Z=$=>{if(!$.length)return;const G=new Map(s.value.map(J=>[O(J.id),J]));$.forEach(J=>{const ye=O(J.id);G.set(ye,J),T(J)}),s.value=Array.from(G.values()),K()},q=async($="")=>{if(!n.data)return[];const G=R();if(!G)return[];const J=new URLSearchParams;J.set("json","1"),$&&J.set("key",$),n.start===1&&J.set("start","1"),C.value!==null&&C.value!==void 0&&C.value!==""&&J.set("parent",String(C.value));try{return(await(await fetch(`${G}?${J.toString()}`)).json())?.data??[]}catch{return[]}},me=async $=>{if(!n.data||!$.length)return[];const G=R();if(!G)return[];const J=Array.from(new Set($.map($e=>O($e)))),ye=new URLSearchParams;ye.set("json","1"),ye.set("val",J.join(",")),n.start===1&&ye.set("start","1"),C.value!==null&&C.value!==void 0&&C.value!==""&&ye.set("parent",String(C.value));try{const Oe=(await(await fetch(`${G}?${ye.toString()}`)).json())?.data??[];return Z(Oe),Oe}catch{return[]}},pe=async($="",{force:G=!1}={})=>{if(!n.data)return;const J=C.value??null;if(!G&&d.value.keyword===$&&d.value.parent===J&&s.value.length>0)return;d.value={keyword:$,parent:J};const $e=await q($);A($e)},Ue=(($,G=200)=>{let J;return(...ye)=>{J&&clearTimeout(J),J=setTimeout(()=>$(...ye),G)}})(async $=>{n.data&&await pe($,{force:!0})},250),H=e.ref(null),oe=async($="click")=>{g.value||y.value||(H.value=$,await pe(p.value.trim()),y.value=!0,await e.nextTick(),v.value?.focus())},ue=()=>{y.value=!1,H.value=null,e.nextTick(()=>{v.value?.blur()})},fe=async $=>{if($.stopPropagation(),!g.value){if(y.value){if(H.value==="focus"){H.value=null;return}ue();return}await oe("click")}},ke=$=>{$.key==="Escape"&&ue()},z=$=>{const G=$.target;k.value?.contains(G)||ue()},le=$=>{if($.key==="Escape"){$.preventDefault(),ue();return}if($.key==="Enter"){$.preventDefault();const G=F.value[0];G&&N(G)}},N=$=>{if(!$)return;const G=O($.id);if(L.value.has(G))return;T($);const J={id:$.id,text:W($)||String($.id??""),key:Y($.id)};r.value=[...r.value,J],j($),p.value="",e.nextTick(()=>{v.value?.focus()})},j=$=>{const G=r.value.map(J=>J.id);a("value-selected",{name:n.name,value:G,option:$})},U=$=>{if(g.value)return;const G=r.value.filter(J=>O(J.id)!==O($));r.value=G},ne=$=>{g.value||(V.value=$)},re=$=>{if(g.value||V.value===null||V.value===$)return;const G=[...r.value],[J]=G.splice(V.value,1);G.splice($,0,J),V.value=null,r.value=G},xe=async()=>{const G=(Array.isArray(o.value)?[...o.value]:[]).filter(ye=>ye!=null);if(n.data&&G.length){const ye=G.filter($e=>!i.value[O($e)]);ye.length&&await me(ye)}const J=G.map(ye=>({id:ye,text:i.value[O(ye)]??String(ye),key:Y(ye)}));f=!0,r.value=J};e.watch(r,$=>{if(f){f=!1;return}const G=$.map(J=>J.id);h=!0,o.value=G,a("change",G)},{deep:!0}),e.watch(o,()=>{if(h){h=!1;return}xe()},{deep:!0}),e.watch(p,$=>{!n.data||!y.value||Ue($.trim())}),e.watch(g,$=>{$&&ue()}),e.watch(()=>n.options,async $=>{n.data||(A($??[]),await xe())},{immediate:!0,deep:!0}),e.watch(()=>n.data,async $=>{$&&(await pe(p.value.trim()),await xe())},{immediate:!0});const _e=e.ref(!1);return e.watch(C,async()=>{if(n.data){if(!_e.value){_e.value=!0;return}r.value=[],await pe(p.value.trim()),await xe()}}),e.onMounted(async()=>{document.addEventListener("click",z,!0),window.addEventListener("keydown",ke),await xe()}),e.onUnmounted(()=>{document.removeEventListener("click",z,!0),window.removeEventListener("keydown",ke)}),($,G)=>(e.openBlock(),e.createElementBlock("div",{class:"flex flex-col gap-2 w-full",ref_key:"rootRef",ref:k},[e.createElementVNode("div",{class:"relative",onClick:G[2]||(G[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]",y.value?"border-[#2684ff] ring-1 ring-[#2684ff] shadow-[0_0_0_1px_rgba(38,132,255,0.5)]":"",g.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":y.value,"aria-haspopup":"listbox","data-focus":y.value?"true":"false",onClick:fe},[e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:v,"onUpdate:modelValue":G[0]||(G[0]=J=>p.value=J),placeholder:w.value,disabled:g.value,readonly:!b.value,onFocus:G[1]||(G[1]=()=>oe("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,nd),[[e.vModelText,p.value]]),e.createElementVNode("span",{class:e.normalizeClass(["text-stone-400 transition-transform duration-150",y.value?"rotate-180":""]),"aria-hidden":"true"},[e.createVNode(Wt,{width:"16",height:"16"})],2)],10,td),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[y.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",ld,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(F.value,J=>(e.openBlock(),e.createElementBlock("button",{key:O(J.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(ye=>N(J),["stop"]),disabled:g.value},e.toDisplayString(W(J)),9,ad))),128)),F.value.length===0?(e.openBlock(),e.createElementBlock("p",od," Немає варіантів ")):e.createCommentVNode("",!0)])],4)):e.createCommentVNode("",!0)]),_:1})]),e.createElementVNode("div",rd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(J,ye)=>(e.openBlock(),e.createElementBlock("div",{key:J.key,class:e.normalizeClass(["flex items-center gap-2 rounded-md border border-stone-200 bg-white px-2 py-2",{"opacity-60":V.value===ye}]),draggable:"true",onDragstart:$e=>ne(ye),onDragover:G[3]||(G[3]=e.withModifiers(()=>{},["prevent"])),onDrop:$e=>re(ye),onDragend:G[4]||(G[4]=$e=>V.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:g.value,"aria-label":"Перетягнути"},[e.createVNode(St,{width:"14",height:"14"})],8,id),e.createElementVNode("div",{class:"flex-1 text-sm text-stone-900",title:J.text},e.toDisplayString(J.text),9,cd),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:g.value,onClick:e.withModifiers($e=>U(J.id),["stop"]),"aria-label":`Видалити ${J.text}`},[e.createVNode(Ct,{width:"14",height:"14"})],8,dd)],42,sd))),128)),r.value.length===0?(e.openBlock(),e.createElementBlock("p",ud,"Немає вибраних значень")):e.createCommentVNode("",!0)])],512))}}),[["__scopeId","data-v-8dc8c204"]]),pd={class:"flex items-center gap-2 w-full"},md={class:"relative flex-1"},fd=["placeholder","disabled","onKeydown"],hd=["disabled"],gd={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"},yd={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"},kd={key:0,class:"fixed inset-0 z-[1000] flex items-center justify-center bg-black/50"},bd={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},wd={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},xd=["onClick"],_d={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}=Ne(a.style),s=e.useModel(l,"modelValue"),i=e.computed({get:()=>s.value,set:C=>{s.value=C}}),c=e.ref(!1),d=e.ref([]),p=e.ref(!1),y=e.ref(null);e.watch(p,C=>{typeof document>"u"||(C?(y.value=document.body.style.overflow,document.body.style.overflow="hidden"):y.value!=null?(document.body.style.overflow=y.value,y.value=null):document.body.style.removeProperty("overflow"))}),e.onBeforeUnmount(()=>{typeof document>"u"||(y.value!=null?document.body.style.overflow=y.value:document.body.style.removeProperty("overflow"))});const V=e.computed(()=>a.placeholder??""),k=e.computed(()=>!!a.disabled),v=C=>{if(!C)return null;if(Array.isArray(C))return C;if(typeof C=="string"){const O=C.split(",").map(W=>W.trim()).filter(Boolean);return O.length!==4?null:O.map(Number)}return null},f=e.computed(()=>{const C=v(a.bbox);if(!C||C.length!==4)return null;const O=C.map(Number);return O.some(W=>Number.isNaN(W))?null:O}),h=e.computed(()=>{const C=f.value;if(!C)return"";const[O,W,Y,L]=C;return`${O},${Math.max(W,L)},${Y},${Math.min(W,L)}`});e.computed(()=>h.value?"1":"0");const x=e.inject("values");function g(){!k.value&&i.value.trim()&&w()}async function w(){const C=(i.value||"").trim();if(!C)return;let O=C;if(a.includes?.length&&x?.value){const Y=a.includes.map(L=>x.value?.[L]).filter(Boolean);Y.length&&(O=`${Y.join(", ")}, ${C}`)}const W=D(O);if(W){c.value=!0;try{const L=await(await fetch(W)).json();d.value=Array.isArray(L)?L:[],p.value=!0}catch(Y){console.error("Address search error:",Y)}finally{c.value=!1}}}function b(){p.value=!p.value}function S(C){if(!C)return;p.value=!1;const O=parseFloat(C.lat),Y={type:"Point",coordinates:[parseFloat(C.lon),O]};a.geom&&x?.value&&(x.value[a.geom]=Y),o("update:geom",Y)}function D(C){if(!a.api)return"";const O={value:encodeURIComponent(C),bbox:f.value?f.value.join(","):""};return a.api.replace(n,(W,Y)=>O[Y.trim()]??"")}return(C,O)=>(e.openBlock(),e.createElementBlock("div",pd,[e.createElementVNode("div",md,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":O[0]||(O[0]=W=>i.value=W),placeholder:V.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(g,["prevent"]),["enter"])},null,42,fd),[[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"},O[2]||(O[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",yd,O[4]||(O[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",gd,O[3]||(O[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,hd),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[p.value?(e.openBlock(),e.createElementBlock("div",kd,[e.createElementVNode("div",bd,[e.createElementVNode("div",wd,[O[6]||(O[6]=e.createElementVNode("span",null,"Search results",-1)),e.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:O[1]||(O[1]=W=>p.value=!1),title:"Close"},O[5]||(O[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,(W,Y)=>(e.openBlock(),e.createElementBlock("li",{key:Y,onClick:L=>S(W),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString(W.display_name),9,xd))),128))]),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",_d," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),qn=(l="")=>`${l}${Math.floor(Math.random()*1e4)}`,vd={class:"vs-datalist space-y-3"},Ed={class:"space-y-3"},Vd=["onClick","disabled"],Cd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Bd=["disabled"],Sd=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,h=Array.from({length:f},y);n.value=[...a.value,...h]}function y(){const f={};return r.value.forEach(h=>{f[h.name]=h?.default??null}),f}function V(){i.value&&(n.value=[...a.value,y()],d())}function k(f){c.value||(n.value=a.value.filter((h,x)=>x!==f),d(),p())}function v(f){return{...f}}return(f,h)=>(e.openBlock(),e.createElementBlock("div",vd,[e.createElementVNode("div",Ed,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(x,g)=>(e.openBlock(),e.createElementBlock("div",{key:o.value[g],class:"flex items-center gap-3"},[e.createVNode(He,{schema:s.value,layout:"inline",navigation:!1,values:a.value[g],"onUpdate:values":w=>a.value[g]=w,"form-id":o.value[g]},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(g),disabled:c.value},[e.createVNode(nt,{class:"w-5 h-5"})],8,Vd)]))),128)),a.value.length===0?(e.openBlock(),e.createElementBlock("div",Cd,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:V,disabled:!i.value},[e.createVNode(ze,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Bd)]))}}),[["__scopeId","data-v-8bcb5436"]]),Nd={};function $d(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 Md=ae(Nd,[["render",$d]]),Dd={class:"vs-dataform space-y-4"},Ad=["draggable","onDragstart","onDragover","onDragenter","onDrop"],Fd={class:"flex items-center gap-2"},Id=["onClick"],Ld={class:"text-sm font-medium text-gray-700"},Td={class:"flex items-center gap-2"},Od=["title","onClick","disabled"],zd=["title","onClick","disabled"],Rd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},jd=["disabled"],Pd=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??"Ще немає груп"),y=e.computed(()=>t.schema?.map(H=>({...H,disabled:t.disabled||H.disabled}))??[]),V=e.computed(()=>y.value.map(H=>W(H))),k=e.computed(()=>t.view==="accordion"),v=e.computed(()=>!!(t.collapsible||k.value)),f=e.computed(()=>t.draggable!==!1),h=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,()=>{g(),w(),b()},{immediate:!0}),e.watch(()=>t.schema,b,{immediate:!0,deep:!0}),e.watch(()=>t.view,()=>{w()},{immediate:!0});function g(){const H=n.value.length;a.value.length<H?a.value=[...a.value,...Array.from({length:H-a.value.length},()=>qn())]:a.value.length>H&&a.value.splice(H)}function w(){const H=n.value.length;k.value?H===0?r.value=-1:r.value>=H?r.value=H-1:r.value<0&&(r.value=0):o.value.length<H?o.value=[...o.value,...Array.from({length:H-o.value.length},()=>!1)]:o.value.length>H&&o.value.splice(H)}function b(){if(!t.minGroups||n.value.length>=t.minGroups)return;const H=t.minGroups-n.value.length,oe=Array.from({length:H},S);n.value=[...n.value,...oe],w()}function S(){const H={};return y.value.forEach(oe=>{H[oe.name]=oe?.default??null}),H}function D(){h.value&&(n.value=[...n.value,S()],g(),w())}function C(H){x.value||(n.value=n.value.filter((oe,ue)=>ue!==H),g(),k.value?r.value>=n.value.length&&(r.value=n.value.length-1):o.value.splice(H,1),b())}function O(H){if(t.disabled)return;const oe=JSON.parse(JSON.stringify(n.value[H]??{}));n.value=[...n.value.slice(0,H+1),oe,...n.value.slice(H+1)],g(),k.value?r.value>H&&(r.value+=1):o.value.splice(H+1,0,o.value[H]??!1)}function W(H){return{...H}}function Y(H){return k.value?r.value===-1&&H===0?!1:r.value!==H:!!o.value[H]}function L(H){if(v.value){if(k.value){r.value=H;return}o.value[H]=!o.value[H]}}function F(H,oe){if(!f.value||t.disabled){oe.preventDefault();return}s.value=H,i.value=H,c.value={groups:JSON.parse(JSON.stringify(n.value)),keys:[...a.value],states:[...o.value]},oe.dataTransfer?.setData("text/plain",String(H)),oe.dataTransfer?.setDragImage?.(oe.currentTarget,0,0)}function R(H,oe){!f.value||t.disabled||s.value!==null&&me(H,oe)}function K(H,oe){me(H,oe)}function T(H){!f.value||t.disabled||Ue()}function A(){c.value&&q(),s.value=null,i.value=null,c.value=null}function Z(H,oe){const ue=[...n.value],[fe]=ue.splice(H,1);ue.splice(oe,0,fe),n.value=ue;const ke=[...a.value],[z]=ke.splice(H,1);if(ke.splice(oe,0,z),a.value=ke,k.value)r.value===H&&(r.value=oe);else{const le=[...o.value],[N]=le.splice(H,1);le.splice(oe,0,N),o.value=le}}function q(){c.value&&(n.value=c.value.groups,a.value=c.value.keys,o.value=c.value.states,c.value=null,i.value=null)}function me(H,oe){if(s.value===null)return;const ue=pe(H,oe);i.value=ue,Ae(ue)}function pe(H,oe){if(!oe?.currentTarget)return H;const ue=oe.currentTarget.getBoundingClientRect(),ke=oe.clientY-ue.top>ue.height/2?H+1:H;return Math.max(0,Math.min(ke,n.value.length))}function Ae(H){const oe=s.value;if(oe===null)return;let ue=H;if(ue>n.value.length&&(ue=n.value.length),ue===oe||ue===oe+1)return;const fe=ue>oe?ue-1:ue;Z(oe,fe),s.value=fe,i.value=ue>oe?fe+1:fe}function Ue(){c.value=null,s.value=null,i.value=null}return(H,oe)=>(e.openBlock(),e.createElementBlock("div",Dd,[(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":Y(fe)?"pt-6 px-6":"p-6"]]),draggable:f.value&&!t.disabled,onDragstart:ke=>F(fe,ke),onDragend:A,onDragover:e.withModifiers(ke=>R(fe,ke),["prevent"]),onDragenter:e.withModifiers(ke=>K(fe,ke),["prevent"]),onDrop:e.withModifiers(ke=>T(),["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"&&!Y(fe)?"rounded-t-lg":"rounded-lg"]])},[e.createElementVNode("div",Fd,[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:ke=>L(fe)},[e.createVNode(Wt,{class:e.normalizeClass(["h-4 w-4 transition",Y(fe)?"-rotate-90":"rotate-0"])},null,8,["class"])],8,Id)):e.createCommentVNode("",!0),e.createElementVNode("div",Ld,e.toDisplayString(`${d.value} (${fe+1})`),1)]),e.createElementVNode("div",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.duplicateTitle,onClick:ke=>O(fe),disabled:t.disabled,draggable:"false"},[e.createVNode(Md,{class:"w-5 h-5"})],8,Od),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:ke=>C(fe),disabled:x.value,draggable:"false"},[e.createVNode(nt,{class:"w-5 h-5"})],8,zd)])],2),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(t.view==="accordion"?"p-6":"pt-6")},[e.createVNode(He,{class:"vs-dataform__form",schema:V.value,layout:"inline",navigation:!1,values:n.value[fe],"onUpdate:values":ke=>n.value[fe]=ke,"form-id":a.value[fe],disabled:t.disabled},null,8,["schema","values","onUpdate:values","form-id","disabled"])],2),[[e.vShow,!Y(fe)]])],42,Ad))),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",Rd,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:D,disabled:!h.value},[e.createVNode(ze,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,jd)]))}}),[["__scopeId","data-v-3b71fe50"]]),At="__vs_form_monaco_loader__",Kn=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 V=(async()=>{const k=h=>{if(Array.from(document.styleSheets||[]).some(w=>w?.href?.includes(h)))return;const g=document.createElement("link");g.rel="stylesheet",g.href=h,document.head.appendChild(g)},v=h=>new Promise((x,g)=>{if(Array.from(document.scripts).some(S=>S.src===h))return x();const b=document.createElement("script");b.src=h,b.async=!0,b.onload=()=>x(),b.onerror=S=>g(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((h,x)=>{window.require.config({paths:{vs:f}}),window.require(["vs/editor/editor.main"],()=>{s=window.monaco,p.monaco=s,h(s)},g=>x(g))})})().catch(k=>{throw delete p[At],k});return p[At]=V,V},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 y=r.getValue();p!==y&&(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,y)=>(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))}}),Gn={VsInputText:tt,VsInputRadio:tn,"vs-input-text":tt,"vs-input-password":Pl,"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":In,"vs-input-file-list":Nn,"vs-input-tags":Ln,"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":Sd,"vs-input-dataform":Pd,"vs-input-monaco":Kn},Ud=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){he.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(o.button),1))}}),Hd={class:"flex flex-col gap-1 w-full"},qd=["innerHTML"],Yn=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(()=>Rl[`${n.layout}`]),s=["label","placeholder","info","description","text","html"],i=e.ref(x()),c=e.computed(()=>v(n.item,i.value)),d=e.computed(()=>Gn?.[`vs-input-${n.item.type}`]),p=e.inject("field-props"),y=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)}),V=e.computed(()=>{const w={...c.value??{}},b=n.item?.name;b&&p?.value?.[b]&&Object.assign(w,p.value[b]);const S=y.value;return S.size?Object.fromEntries(Object.entries(w).filter(([D])=>S.has(D))):{}}),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",g)}),e.onUnmounted(()=>{window.removeEventListener("storage",g)});function v(w,b){if(!w)return{};const S={...w};return s.forEach(D=>{const C=h(w,D,b);C!=null&&(S[D]=C)}),Array.isArray(w.options)&&(S.options=w.options.map(D=>f(D,b))),S}function f(w,b){if(!w)return w;const S={...w},D=h(w,"label",b),C=h(w,"text",b);return D!=null&&(S.label=D),C!=null?S.text=C:D!=null&&(S.text=D),S}function h(w,b,S){const D=`${b}:${S}`;if(w?.[D]!=null)return w[D];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 g(){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",Hd,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value),e.mergeProps(V.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,qd)):e.createCommentVNode("",!0)]),c.value.behavior?.api&&c.value.behavior?.button?(e.openBlock(),e.createBlock(Ud,e.mergeProps({key:0},c.value.behavior,{value:a.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),Kd={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},Gd={class:"vs-compact-form-navigation__rail mt-[6px]"},Yd=["onClick"],Wd=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 L=n.width;if(L==null)return{};const F=typeof L=="number"?`${L}px`:`${L}`;return{width:F,minWidth:F}});let d=null,p=0,y=0,V=null,k=null,v=null;const f=()=>W(),h=()=>g();e.watch(()=>n.target,async L=>{if(D(),!L){V=null,a.value=[],o.value="";return}V=L,s.value&&(await e.nextTick(),S(L),g())},{immediate:!0}),e.watch(()=>n.scrollContainer,L=>{if(!s.value){k=L??null;return}x(L??null),e.nextTick(()=>g())},{immediate:!0}),e.onMounted(()=>{n.scrollContainer||x(null),g()}),e.onBeforeUnmount(()=>{D(),x(null,!0),V=null,typeof window<"u"&&(p&&window.cancelAnimationFrame(p),y&&window.cancelAnimationFrame(y))});function x(L,F=!1){if(v&&(v(),v=null),F){k=null;return}if(k=L??null,typeof window>"u")return;const R=L??window,K=window;R.addEventListener("scroll",f,{passive:!0}),K.addEventListener("resize",h),v=()=>{R.removeEventListener("scroll",f),K.removeEventListener("resize",h)}}function g(){if(!s.value||!V)return;p&&typeof window<"u"&&window.cancelAnimationFrame(p);const L=()=>{w(),p=0};typeof window>"u"?L():p=window.requestAnimationFrame(L)}function w(){if(!s.value||!V)return;const L=Array.from(V.querySelectorAll("h1, h2")),F=new Set,R=[];L.forEach((K,T)=>{const A=K.textContent?.trim()??"";if(!A)return;let Z=(K.getAttribute("id")??"").trim();Z||(Z=b(A)||`heading-${T+1}`);let q=Z,me=1;for(;F.has(q);)q=`${Z}-${me+=1}`;K.id!==q&&Object.assign(K,{id:q}),F.add(q),R.push({id:q,text:A,level:K.tagName.toLowerCase()==="h1"?1:2})}),a.value=R,R.length||(o.value=""),O()}function b(L){return L.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function S(L){!L||!s.value||typeof MutationObserver>"u"||(D(),d=new MutationObserver(()=>g()),d.observe(L,{childList:!0,subtree:!0}))}function D(){d&&(d.disconnect(),d=null)}function C(L){const F=k;if(!F)return typeof window>"u"?L.offsetTop:L.getBoundingClientRect().top+window.scrollY;const R=L.getBoundingClientRect(),K=F.getBoundingClientRect();return R.top-K.top+F.scrollTop}function O(){if(!s.value||!a.value.length)return;const L=k,F=(L?L.scrollTop:null)||(typeof window<"u"?window.scrollY:0),R=(L?L.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),K=F+R;let T=null;for(let Z=0;Z<a.value.length;Z+=1){const q=a.value[Z],me=document.getElementById(q.id);if(me){const pe=C(me);pe+me.offsetHeight>F&&pe<K&&(T=q.id)}}!T&&r.value&&(T=r.value),T&&(r.value=T);const A=L?L.scrollHeight-L.clientHeight:document.documentElement.scrollHeight-window.innerHeight;F+5>=A&&(T=a.value[a.value.length-1].id),T&&(o.value=T)}function W(){s.value&&(y&&window.cancelAnimationFrame(y),y=window.requestAnimationFrame(()=>{O(),y=0}))}function Y(L){if(!s.value)return;const F=document.getElementById(L);if(!F)return;const R=k,K=Math.max(0,C(F));R?R.scrollTo({top:K,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:K,behavior:"smooth"})}return t({refresh:g}),(L,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",Kd,e.toDisplayString(L.title),1),e.createElementVNode("div",Gd,[(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:K=>Y(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,Yd)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-1584a562"]]),Xe={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон",minlength:l=>`Мінімальна довжина — ${l} символів`,maxlength:l=>`Максимальна довжина — ${l} символів`},Zd=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,Jd=l=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return l?t.test(l)?!1:Xe.email:!1},Xd=l=>{const t=/^\+[1-9]\d{1,14}$/;return l?t.test(l)?!1:Xe.tel:!1},Wn=l=>l==null?0:typeof l=="string"?l.trim().length:Array.isArray(l)?l.length:typeof l=="number"?l.toString().length:String(l).length,Qd=(l,t)=>{if(l==null)return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Wn(l)<n?t?.message||Xe.minlength(n):!1},eu=(l,t)=>{if(l==null||l==="")return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Wn(l)>n?t?.message||Xe.maxlength(n):!1},tu=(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},nu=(l,t)=>!1,lu=(l,t)=>{switch(typeof t=="string"?t:t.type){case"required":return Zd(l);case"email":return Jd(l);case"tel":return Xd(l);case"regexp":return tu(l,t);case"minlength":return Qd(l,t);case"maxlength":return eu(l,t);case"custom":return nu();default:return!1}},au={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function Zn(l){const t=l?.toLowerCase();return au[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=Zn(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:Zn(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 ou(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 y=Array.isArray(p)?p[0]:p,V=l?.value?.[y];return $n(V,p)}const s=(d=a.value,p=!0)=>(d.forEach(y=>{const V=[],k=Number(y?.minlength),v=Number(y?.maxlength);!Number.isNaN(k)&&Number.isFinite(k)&&V.push({type:"minlength",value:k}),!Number.isNaN(v)&&Number.isFinite(v)&&V.push({type:"maxlength",value:v});const f=[...V,...y.rules||[]];if(f.length){if(!r(y)){delete o.value[y.name];return}let h=!1,x=null;f.forEach(g=>{const w=lu(l.value[y.name],g);w&&(h=!0,!x&&typeof w=="string"&&(x=w))}),h&&x?o.value[y.name]=x:delete o.value[y.name]}y.schema&&s(y.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 ru={class:"flex w-full h-full min-h-0 gap-6"},su={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:y,visibleSchema:V}=ou(c,o.schema,e.toRef(o,"disabled")),k=e.ref(null),v=e.ref(null),f=e.ref({}),h=e.computed(()=>o.navigation),x=e.computed(()=>o.navWidth),g=e.computed(()=>o.style?.columns),w=Object.freeze({container:12,label:3}),b=e.computed(()=>o.columns??g.value??w),S=e.computed(()=>o.columns!=null||g.value!=null),D=e.computed(()=>S.value?"horizontal":o.layout),C=F=>F?.columns?"horizontal":D.value,O=F=>F?.columns??b.value,W=()=>{a("update:modelValue",c.value),p(),a("handle-submit",c.value)},Y=F=>{a("value-selected",F)};t({validate:p,reset:y,errors:d}),e.onMounted(()=>{r.value={value:c.value,errors:d.value,reset:y,validate:p,formId:o.formId}});function L(F,R){if(F===R)return!0;if(typeof F!="object"||typeof R!="object"||!F||!R)return!1;const K=Object.keys(F),T=Object.keys(R);return K.length!==T.length?!1:K.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",ru,[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(W,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",D.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(V),(K,T)=>(e.openBlock(),e.createElementBlock("div",{key:K.name,class:e.normalizeClass(C(K)==="horizontal"?"col-span-12":`col-span-${K.col||12}`)},[e.createVNode(Yn,{style:e.normalizeStyle(F.style),item:K,layout:C(K),columns:O(K),"model-value":c.value[K.name],"onUpdate:modelValue":A=>{const Z=c.value[K.name];L(Z,A)||(c.value[K.name]=A)},error:e.unref(d)[K.name],onValueSelected:Y},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),C(K)==="settings"&&T+1!==e.unref(V).length?(e.openBlock(),e.createElementBlock("div",su)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(Wd,{target:k.value,"scroll-container":v.value,enabled:h.value,width:x.value},null,8,["target","scroll-container","enabled","width"])]))}}),iu={class:"relative"},cu={class:"w-full h-full fixed top-0 start-0 bg-black bg-opacity-50"},du={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"},uu={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},pu={class:"font-medium text-gray-800 dark:text-[#ffffff]"},mu={class:"p-4 mim-h-0 h-full overflow-auto"},Jn=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=()=>{he.notify({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`})},y=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(()=>({}));he.notify({type:"warning",title:"Помилка валідації",message:f.message||"Некоректні дані (400)"});return}if(v.status===500){he.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"});return}he.notify({type:"error",title:"Помилка",message:`Статус: ${v.status}`})};async function V(){const v=s.value.validate();if(v){he.notify({type:"warning",title:"Помилка валідації",message:Object.entries(v).map(([h,x])=>`${h}: ${x}`).join(`
|
|
3
|
-
`)});return}const f=n.api?.trim();if(f){const h=d();try{const x=await fetch(f,{method:h,headers:h==="GET"?void 0:{"Content-Type":"application/json"},body:h==="GET"?void 0:JSON.stringify(r.value)});await y(x)}catch(x){he.notify({type:"error",title:"Помилка з’єднання",message:x.message||"Не вдалося виконати запит"})}return}if(i.value)try{const h=await fetch(`/api/table/${i.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r.value)});await y(h)}catch(h){he.notify({type:"error",title:"Помилка з’єднання",message:h.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){he.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){he.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){he.notify({type:"error",title:"Error",message:v.message||"Unexpected error"}),console.error(v)}}),(v,f)=>(e.openBlock(),e.createElementBlock("div",iu,[e.createElementVNode("div",cu,[e.createElementVNode("div",du,[e.createElementVNode("div",uu,[e.createElementVNode("h3",pu,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",mu,[o.value?(e.openBlock(),e.createBlock(He,{key:0,schema:o.value,values:r.value,"onUpdate:values":f[0]||(f[0]=h=>r.value=h),form:s.value,"onUpdate:form":f[1]||(f[1]=h=>s.value=h),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:V,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"}," Зберегти ")])])])]))}}),fu=1440*60*1e3,hu=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],gu=["січ","лют","бер","квіт","трав","черв","лип","серп","вер","жовт","лист","груд"],yu=["нд","пн","вт","ср","чт","пт","сб"];function Ve(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 ku(l,t){return un(l,-1)}function Ft(l,t){const n=new Date(l);return n.setFullYear(n.getFullYear()+t),n}function Xn(l,t){return Ft(l,-t)}function Qn(l){return Qe(new Date(l.getFullYear(),0,1))}function el(l){return dt(new Date(l.getFullYear(),11,31))}function bu(l){const t=Math.floor(l.getFullYear()/10)*10;return Qe(new Date(t,0,1))}function wu(l){const t=Math.floor(l.getFullYear()/10)*10+9;return dt(new Date(t,11,31))}const Te=l=>l.getFullYear(),It=l=>Math.floor(l.getFullYear()/10)*10;function xu(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()+fu);return t}function _u(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 vu(l){const t=[];let n=Qn(l.start);const a=el(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 Eu(l,t=1){const n=pn(l,t);return n.setDate(n.getDate()+6),dt(n)}function Vu(l,t,n=0){const a=pn(l,n),o=(t-n+7)%7;return a.setDate(a.getDate()+o),a}const Lt=(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(),tl=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear(),nl=(l,t)=>!!l&&!!t&&Lt(l,t)&&l.getHours()===t.getHours(),Cu=(l,t)=>!!l&&!!t&&nl(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 Su(l){const t=l.filter(n=>Ve(n));if(t.length)return t.reduce((n,a)=>n.getTime()>=a.getTime()?n:a)}function Nu(l){const t=l.filter(n=>Ve(n));if(t.length)return t.reduce((n,a)=>n.getTime()<=a.getTime()?n:a)}function ll(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 al(l,t){return t==="wide"?hu[l]:gu[l]}function $u(l){return yu[l]}const Mu=[{token:"LLLL",format:l=>al(l.getMonth(),"wide")},{token:"LLL",format:l=>al(l.getMonth(),"abbreviated")},{token:"EE",format:l=>$u(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(!Ve(l))return"";let n="",a=0;for(;a<t.length;){const o=Mu.find(r=>t.startsWith(r.token,a));o?(n+=o.format(l),a+=o.token.length):(n+=t[a],a+=1)}return n}const Du={"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 ol(l,t){const n=Du[t];if(!n){const o=new Date(l);return Ve(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 Ve(i)?i:null}case"dd.MM.yyyy":{const[,o,r,s]=a,i=new Date(Number(s),Number(r)-1,Number(o));return Ve(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 Ve(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 Au=["year","month","day","time","custom"],Fu=e.defineComponent({emits:{elementClick:l=>Ve(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"&&Au.includes(l)}}}),Iu={class:"v3dp__heading"},Lu=["disabled"],Tu=["disabled"],Ou={class:"v3dp__body"},zu={class:"v3dp__subheading"},Ru={class:"v3dp__elements"},ju=["disabled","onClick"];function Pu(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",Iu,[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,Tu)]),e.createElementVNode("div",Ou,["subheading"in l.$slots?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",zu,[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",Ru,[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,ju))),128))],!0)])])],38)}const zt=ae(Fu,[["render",Pu],["__scopeId","data-v-bc92af04"]]),Uu=e.defineComponent({components:{PickerPopup:zt},emits:{"update:pageDate":l=>Ve(l),select:l=>Ve(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(()=>bu(l.pageDate)),a=e.computed(()=>wu(l.pageDate)),o=(y,V,k)=>!V&&!k?!0:!(V&&Te(y)<Te(V)||k&&Te(y)>Te(k)),r=e.computed(()=>vu({start:n.value,end:a.value}).map(y=>({value:y,key:String(Te(y)),display:Te(y),selected:!!l.selected&&Te(y)===Te(l.selected),disabled:!o(y,l.lowerLimit,l.upperLimit)}))),s=e.computed(()=>{const y=Te(n.value),V=Te(a.value);return`${y} - ${V}`}),i=e.computed(()=>l.lowerLimit&&(It(l.lowerLimit)===It(l.pageDate)||ut(l.pageDate,l.lowerLimit))),c=e.computed(()=>l.upperLimit&&(It(l.upperLimit)===It(l.pageDate)||pt(l.pageDate,l.upperLimit)));return{years:r,heading:s,leftDisabled:i,rightDisabled:c,previousPage:()=>t("update:pageDate",Xn(l.pageDate,10)),nextPage:()=>t("update:pageDate",Ft(l.pageDate,10))}}});function Hu(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 qu=ae(Uu,[["render",Hu]]),Ku=e.defineComponent({components:{PickerPopup:zt},emits:{"update:pageDate":l=>Ve(l),select:l=>Ve(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(()=>el(l.pageDate)),o=e.computed(()=>V=>Ot(V,l.format)),r=(V,k,v)=>!k&&!v?!0:!(k&&ut(V,cn(k))||v&&pt(V,dn(v))),s=e.computed(()=>_u({start:n.value,end:a.value}).map(V=>({value:V,display:o.value(V),key:o.value(V),selected:!!l.selected&&mn(l.selected,V),disabled:!r(V,l.lowerLimit,l.upperLimit)}))),i=e.computed(()=>Te(n.value)),c=e.computed(()=>l.lowerLimit&&(tl(l.lowerLimit,l.pageDate)||ut(l.pageDate,l.lowerLimit))),d=e.computed(()=>l.upperLimit&&(tl(l.upperLimit,l.pageDate)||pt(l.pageDate,l.upperLimit)));return{months:s,heading:i,leftDisabled:c,rightDisabled:d,previousPage:()=>t("update:pageDate",Xn(l.pageDate,1)),nextPage:()=>t("update:pageDate",Ft(l.pageDate,1))}}});function Gu(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 Yu=ae(Ku,[["render",Gu]]),Wu=e.defineComponent({components:{PickerPopup:zt},emits:{"update:pageDate":l=>Ve(l),select:l=>Ve(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(()=>h=>x=>Ot(x,h)),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:Eu(o.value,l.weekStartsOn)})),i=e.computed(()=>l.customWeekdays?.length===7?l.customWeekdays:null),c=e.computed(()=>{const h=l.weekStartsOn,x=i.value;if(x)return Array.from({length:7}).map((w,b)=>x[(h+b)%7]);const g=n.value(l.weekdayFormat);return Array.from(Array(7)).map((w,b)=>(h+b)%7).map(w=>Vu(new Date,w,l.weekStartsOn)).map(g)}),d=(h,x,g,w)=>w?.dates?.some(b=>Lt(h,b))||w?.predicate?.(h)?!1:!x&&!g?!0:!(x&&ut(h,Qe(x))||g&&pt(h,dt(g))),p=e.computed(()=>{const h=new Date,x=n.value(l.format);return xu(s.value).map(g=>({value:g,display:x(g),selected:!!l.selected&&Lt(l.selected,g),current:Lt(h,g),disabled:!l.allowOutsideInterval&&!Bu(g,r.value)||!d(g,l.lowerLimit,l.upperLimit,l.disabledDates),key:n.value("yyyy-MM-dd")(g)}))}),y=e.computed(()=>n.value(l.headingFormat)(l.pageDate)),V=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:y,leftDisabled:V,rightDisabled:k,previousPage:()=>t("update:pageDate",ku(l.pageDate)),nextPage:()=>t("update:pageDate",un(l.pageDate,1))}}});function Zu(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 Ju=ae(Wu,[["render",Zu]]);function rl(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 Xu=e.defineComponent({components:{PickerPopup:zt},emits:{select:l=>Ve(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:ll(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:ll(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&&(rl(n.value,k.ref.value),rl(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=>nl(k,v)&&Cu(k,v))||l.disabledTime?.predicate?.(k)),scroll:p}}}),Qu={ref:"hoursListRef",class:"v3dp__column"},ep=["disabled","onClick"],tp={ref:"minutesListRef",class:"v3dp__column"},np=["disabled","onClick"];function lp(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",Qu,[(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,ep))),128))],512),e.createElementVNode("div",tp,[(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,np))),128))],512)]),_:1})}const ap=ae(Xu,[["render",lp],["__scopeId","data-v-610b89e1"]]),Rt=["time","day","month","year"],op=(l,t,n=void 0)=>{let a=n||new Date;const o=Su([l,a]);o&&(a=o);const r=Nu([t,a]);return r&&(a=r),a},rp=e.defineComponent({components:{YearPicker:qu,MonthPicker:Yu,DayPicker:Ju,TimePicker:ap},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||Ve(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=T=>{const A=T.replace(/[a-zA-Z]/g,"0");return/0/.test(A)?A:""},d=e.computed(()=>c(l.inputFormat));let p=null,y=null;const V=()=>{p?.destroy(),p=null},k=async()=>{if(!y){const{default:T}=await Promise.resolve().then(()=>kn);y=T}return y},v=()=>{p&&p.value!==i.value&&(p.value=i.value??"")},f=async()=>{if(V(),!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 T=ol(i.value,l.inputFormat);T&&(o.value=T)}),e.watchEffect(()=>{i.value=l.modelValue&&Ve(l.modelValue)?Ot(l.modelValue,l.inputFormat):""}),e.onMounted(()=>{d.value&&e.nextTick(()=>{f()})}),e.onBeforeUnmount(()=>{V()}),e.watch(d,T=>{T?e.nextTick(()=>{f()}):V()}),e.watch(i,()=>{v()});const h=(T="none")=>{l.disabled||(T!=="none"&&a.value==="none"&&(o.value=l.modelValue||op(l.lowerLimit,l.upperLimit,o.value)),a.value=T,t(T!=="none"?"opened":"closed"))};e.watchEffect(()=>{l.disabled&&(a.value="none")});const x=(T,A)=>{o.value=A,T==="year"?t("decadePageChanged",A):T==="month"?t("yearPageChanged",A):T==="day"&&t("monthPageChanged",A)},g=T=>{o.value=T,l.minimumView==="year"?(h("none"),t("update:modelValue",T)):a.value="month"},w=T=>{o.value=T,l.minimumView==="month"?(h("none"),t("update:modelValue",T)):a.value="day"},b=T=>{o.value=T,l.minimumView==="day"?(h("none"),t("update:modelValue",T)):a.value="time"},S=T=>{h("none"),t("update:modelValue",T)},D=()=>{l.clearable&&(h("none"),t("update:modelValue",null),o.value=l.startingViewDate)},C=()=>s.value=!0,O=()=>h(L.value),W=()=>{s.value=!1,h()},Y=T=>{const A=T.keyCode?T.keyCode:T.which;if([27,13].includes(A)&&r.value.blur(),l.typeable){const q=ol(r.value.value,l.inputFormat);q&&i.value===Ot(q,l.inputFormat)&&(i.value=r.value.value,t("update:modelValue",q))}},L=e.computed(()=>{const T=Rt.indexOf(l.startingView),A=Rt.indexOf(l.minimumView);return T<A?l.minimumView:l.startingView}),F=T=>Object.fromEntries(Object.entries(T??{}).filter(([A,Z])=>A.startsWith("--"))),R=e.computed(()=>l.weekDayNames?.length===7?l.weekDayNames:void 0);return{blur:W,focus:O,click:C,input:i,inputRef:r,pageDate:o,renderView:h,updatePageDate:x,selectYear:g,selectMonth:w,selectDay:b,selectTime:S,keyUp:Y,normalizedWeekdayNames:R,viewShown:a,goBackFromTimepicker:()=>l.startingView==="time"&&l.minimumView==="time"?null:a.value="day",clearModelValue:D,initialView:L,log:T=>console.log(T),variables:F}}}),sp={class:"v3dp__input_wrapper"},ip=["readonly","placeholder","disabled","tabindex"],cp={class:"v3dp__clearable"};function dp(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",sp,[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,ip),[[e.vModelText,l.input]]),e.withDirectives(e.createElementVNode("div",cp,[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 up=ae(rp,[["render",dp]]),pp=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}=Ne(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))}),y=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],V=e.computed(()=>{if(n.dayNames?.length)return n.dayNames.length===7?n.dayNames:y}),k=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))}),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"},h=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"})),g=e.ref(!1);e.watch(()=>n.modelValue,A=>{A?g.value=!0:n.now||(g.value=!1)},{immediate:!0}),e.watchEffect(()=>{n.now&&!n.modelValue&&!g.value&&(a("update:modelValue",b(new Date,r.value)),g.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 O(A);case"time":return L(A);case"month":return W(A);case"year":return Y(A);case"week":return F(A);case"date":default:return C(A)}}function b(A,Z){if(!A)return null;const q=A instanceof Date?A:w(A,Z);if(!q)return null;switch(Z){case"datetime":return`${S(q)}T${D(q)}`;case"time":return D(q);case"month":return`${q.getFullYear()}-${T(q.getMonth()+1)}`;case"year":return`${q.getFullYear()}`;case"week":{const{year:me,week:pe}=R(q);return`${me}-W${T(pe)}`}case"date":default:return S(q)}}function S(A){return`${A.getFullYear()}-${T(A.getMonth()+1)}-${T(A.getDate())}`}function D(A){return`${T(A.getHours())}:${T(A.getMinutes())}`}function C(A){const Z=A.split("-");if(Z.length<3)return null;const[q,me,pe]=Z.map(Number);return!q||!me||!pe?null:new Date(q,me-1,pe)}function O(A){const Z=A.includes("T")?A:A.replace(" ","T"),q=new Date(Z);return Number.isNaN(q.getTime())?null:q}function W(A){const[Z,q]=A.split("-").map(Number);return!Z||Number.isNaN(q)?null:new Date(Z,(q||1)-1,1)}function Y(A){const Z=Number(A);return Z?new Date(Z,0,1):null}function L(A){const Z=A.match(/^(\d{1,2}):(\d{2})$/);if(!Z)return null;const[,q,me]=Z,pe=new Date;return pe.setHours(Number(q),Number(me),0,0),pe}function F(A){const Z=A.match(/^(\d{4})-W(\d{2})$/);if(!Z)return null;const[,q,me]=Z,pe=Number(me);return K(Number(q),pe)}function R(A){const Z=new Date(Date.UTC(A.getFullYear(),A.getMonth(),A.getDate())),q=Z.getUTCDay()||7;Z.setUTCDate(Z.getUTCDate()+4-q);const me=new Date(Date.UTC(Z.getUTCFullYear(),0,1)),pe=Math.ceil(((Z.getTime()-me.getTime())/864e5+1)/7);return{year:Z.getUTCFullYear(),week:pe}}function K(A,Z){if(!A||!Z)return null;const q=new Date(A,0,1+(Z-1)*7),me=q.getDay(),pe=q;return me<=4?pe.setDate(q.getDate()-q.getDay()+1):pe.setDate(q.getDate()+8-q.getDay()),pe}function T(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(x.value)},[e.createVNode(up,{modelValue:p.value,"onUpdate:modelValue":Z[0]||(Z[0]=q=>p.value=q),placeholder:i.value,disabled:n.disabled,clearable:n.clearable,typeable:n.editable,"week-day-names":V.value,"week-starts-on":k.value,"starting-view":v.value.startingView,"minimum-view":v.value.minimumView,"input-format":h.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-a65a2ac3"]]),sl=(l={mode:"edit",schema:null})=>new Promise(t=>{const{close:n}=he.modal({title:l.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Jn,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:sl}),t.provide("form",sl),window.v3plugin||(window.v3plugin={})};function Ke(l){return typeof l=="string"||l instanceof String}function il(l){var t;return typeof l=="object"&&l!=null&&(l==null||(t=l.constructor)==null?void 0:t.name)==="Object"}function cl(l,t){return Array.isArray(t)?cl(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 dl(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 mp{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 ul(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}:il(l)&&l.mask instanceof se.Masked?l:{};if(t){const a=t.mask;return{...cl(t,(o,r)=>!r.startsWith("_")),mask:t.constructor,_mask:a,...n}}}return il(l)?{...l}:{mask:l}}function Re(l){if(se.Masked&&l instanceof se.Masked)return l;const t=at(l),n=ul(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=Re;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 pl=90,fp=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===pl&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===fp&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===pl&&(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 ml 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 fl{constructor(t,n){this.el=t instanceof Pt?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new hn(t):new ml(t),this.masked=Re(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===ul(t)){this.masked.updateOptions({mask:t});return}const n=t instanceof se.Masked?t:Re({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 mp({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=fl;class de{static normalize(t){return Array.isArray(t)?t:[t,new de]}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=de;class je{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 Ce{constructor(t){this._value="",this._update({...Ce.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 je(this.extractInput(t,n),t)}appendTail(t){return Ke(t)&&(t=new je(String(t))),t.appendTo(this)}_appendCharRaw(t,n){return t?(this._value+=t,new de({inserted:t,rawInserted:t})):new de}_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 de,this.state=o,a&&s&&(a.state=s))}return r}_appendPlaceholder(){return new de}_appendEager(){return new de}append(t,n,a){if(!Ke(t))throw new Error("value should be string");const o=Ke(a)?new je(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 de}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={}),de.normalize(this.prepare?this.prepare(t,this,n):t)}doPrepareChar(t,n){return n===void 0&&(n={}),de.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=dl(o),d=this.extractInput(0,s,{raw:!0}));let p=t;const y=new de;if(o!==Q.NONE&&(p=this.nearestInputPos(t,n>1&&t!==0&&!c?Q.NONE:o),y.tailShift=p-t),y.aggregate(this.remove(p)),c&&o!==Q.NONE&&d===this.rawInputValue)if(o===Q.FORCE_LEFT){let V;for(;d===this.rawInputValue&&(V=this.displayValue.length);)y.aggregate(new de({tailShift:-1})).aggregate(this.remove(V-1))}else o===Q.FORCE_RIGHT&&i.unshift();return y.aggregate(this.append(a,r,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!jt(this,t)}typedValueEquals(t){const n=this.typedValue;return t===n||Ce.EMPTY_VALUES.includes(t)&&Ce.EMPTY_VALUES.includes(n)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new de}}Ce.DEFAULTS={skipInvalid:!0},Ce.EMPTY_VALUES=[void 0,null,""],se.Masked=Ce;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 je(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 je)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 je(this.toString()).appendTo(t);const n=new de;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 je;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 hp{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 de}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 de;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 de({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 de;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new je("")}appendTail(t){return Ke(t)&&(t=new je(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=Re(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 de}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 de;const a=this.masked.state;let o=this.masked._appendChar(t,this.currentMaskFlags(n));return o.inserted&&this.doValidate(n)===!1&&(o=new de,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 de:(this.isFilled=!0,new de({inserted:this.placeholderChar}))}_appendEager(){return new de}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 de}}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 hl extends Ce{updateOptions(t){super.updateOptions(t)}_update(t){const n=t.mask;n&&(t.validate=a=>a.search(n)>=0),super._update(t)}}se.MaskedRegExp=hl;class Be extends Ce{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(V=>d.indexOf(V)===0);p.sort((V,k)=>k.length-V.length);const y=p[0];if(y){const{expose:V,repeat:k,...v}=at(this.blocks[y]),f={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...v,repeat:k,parent:this},h=k!=null?new se.RepeatBlock(f):Re(f);h&&(this._blocks.push(h),V&&(this.exposeBlock=h),this._maskedBlocks[y]||(this._maskedBlocks[y]=[]),this._maskedBlocks[y].push(this._blocks.length-1)),r+=y.length-1;continue}}let s=n[r],i=s in t;if(s===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 de;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 de;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 de;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 hp(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 de;return this._forEachBlocksInRange(0,this.displayValue.length,a=>n.aggregate(a.pad(t))),n}}Be.DEFAULTS={...Ce.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 de;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 gp="d{.}`m{.}`Y";class Pe extends Be{static extractPatternOptions(t){const{mask:n,pattern:a,...o}=t;return{...o,mask:Ke(n)?n:a}}constructor(t){super(Pe.extractPatternOptions({...Pe.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:n,pattern:a,blocks:o,...r}={...Pe.DEFAULTS,...t},s=Object.assign({},Pe.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(Pe.extractPatternOptions(t))}}Pe.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}}),Pe.DEFAULTS={...Be.DEFAULTS,mask:Date,pattern:gp,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=Pe;class gt extends Ce{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=Re({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 de,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 de;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 de;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={...Ce.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 de({skip:!this.isComplete})}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new je("",t)}remove(t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),t===n)return new de;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 gl extends Ce{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}se.MaskedFunction=gl;var yl;class De extends Ce{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 V;this.min!=null&&this.min<0&&this.number<this.min&&(V=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(V=this.max),V!=null&&(this.autofix?(this._value=this.format(V,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 de({inserted:this._value.slice(r.length),rawInserted:c?"":t,skip:c}):(this._value=r,d=new de),this._value=this._insertThousandsSeparators(this._value);const p=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,y=this._separatorsCountFromSlice(p);return d.tailShift+=(y-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 de({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==="")}}yl=De,De.UNMASKED_RADIX=".",De.EMPTY_VALUES=[...Ce.EMPTY_VALUES,0],De.DEFAULTS={...Ce.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[yl.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=Re(l);return o=>a.runIsolated(r=>(r[t]=o,r[n]))}function kl(l,t,n,a){return yn(t,n,a)(l)}se.PIPE_TYPE=Ht,se.createPipe=yn,se.pipe=kl;class bl 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=Re(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(Re(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,n){n===void 0&&(n={});const a=new de;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 y=d._appendChar(t,{...n,_beforeTailState:(i=n._beforeTailState)==null||(i=i._blocks)==null?void 0:i[c]});if(y.skip&&p){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(a.aggregate(y),y.consumed)break}return a}_trimEmptyTail(t,n){var a,o;t===void 0&&(t=0);const r=Math.max(((a=this._mapPosToBlock(t))==null?void 0:a.index)||0,this.repeatFrom,0);let s;n!=null&&(s=(o=this._mapPosToBlock(n))==null?void 0:o.index),s==null&&(s=this._blocks.length-1);let i=0;for(let 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=bl;try{globalThis.IMask=se}catch{}const kn=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:de,ChunksTailDetails:Ge,DIRECTION:Q,HTMLContenteditableMaskElement:hn,HTMLInputMaskElement:ml,HTMLMaskElement:mt,InputMask:fl,MaskElement:Pt,Masked:Ce,MaskedDate:Pe,MaskedDynamic:gt,MaskedEnum:yt,MaskedFunction:gl,MaskedNumber:De,MaskedPattern:Be,MaskedRange:ht,MaskedRegExp:hl,PIPE_TYPE:Ht,PatternFixedDefinition:gn,PatternInputDefinition:ft,RepeatBlock:bl,createMask:Re,createPipe:yn,default:se,forceDirection:dl,normalizeOpts:at,pipe:kl},Symbol.toStringTag,{value:"Module"}));ce.ModalEdit=Jn,ce.VForm=He,ce.VsInputAddress=Hn,ce.VsInputArray=Un,ce.VsInputArraySelect=Dt,ce.VsInputCheckbox=vn,ce.VsInputCodegen=On,ce.VsInputColor=jn,ce.VsInputContainer=Mn,ce.VsInputDate=pp,ce.VsInputEmail=Qt,ce.VsInputFile=Sn,ce.VsInputFileList=Nn,ce.VsInputKeyValue=zn,ce.VsInputMask=Xt,ce.VsInputMonaco=Kn,ce.VsInputNumber=_n,ce.VsInputRadio=tn,ce.VsInputRange=Pn,ce.VsInputRichtext=An,ce.VsInputSelect=on,ce.VsInputSlug=Tn,ce.VsInputStatic=Jt,ce.VsInputSwitcher=Zt,ce.VsInputTag=Ln,ce.VsInputTel=en,ce.VsInputText=tt,ce.VsInputTextArray=Rn,ce.VsInputTextarea=Dn,ce.default=He,ce.inputs=Gn,ce.vsInputDatatable=Fn,ce.vsInputMap=In,Object.defineProperties(ce,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
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,he,wl){"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&&s.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(a.value),class:"fixed z-[9999] max-w-xs p-2 bg-gray-900 text-white text-xs rounded-lg shadow-lg pointer-events-none"},e.toDisplayString(s.text),5)):e.createCommentVNode("",!0)]))],64))}}),xl={class:"w-full relative"},_l={key:0,class:"text-[14px] font-medium text-gray-900 mb-2 flex items-center gap-1"},vl={class:"opacity-100"},El={key:0,class:"text-red-500 text-[14px]"},Vl={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Bl=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",xl,[a.value?(e.openBlock(),e.createElementBlock("div",_l,[e.createElementVNode("span",vl,e.toDisplayString(n.value),1),o.value?(e.openBlock(),e.createElementBlock("span",El,"*")):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":s.item.disabled}})),s.error?(e.openBlock(),e.createElementBlock("span",Vl,e.toDisplayString(s.error),1)):e.createCommentVNode("",!0)]))}}),Cl={class:"w-full relative flex flex-row items-center gap-2"},Sl={key:0,class:"text-red-500 text-[14px]"},Nl={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: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 g=Math.max(d-Math.max(p??0,0),0)/d;if(!g)return{};const E=`${g*100}%`;return{flexBasis:E,maxWidth:E}});return(d,p)=>(e.openBlock(),e.createElementBlock("div",Cl,[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),d.item?.rules?.includes("required")&&n.value?(e.openBlock(),e.createElementBlock("span",Sl,"*")):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),d.error?(e.openBlock(),e.createElementBlock("span",Nl,e.toDisplayString(d.error),1)):e.createCommentVNode("",!0)]))}}),Ml={class:"w-full relative"},Dl={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Al=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",Ml,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",Dl,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),Fl={class:"flex-1 min-w-0"},Il={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},Ll={class:"truncate"},Tl={key:0,class:"text-red-500 text-[14px]"},Ol=["innerHTML"],zl={key:0,class:"mt-1 text-xs text-red-500"},Rl={default:Bl,horizontal:$l,inline:Al,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":i.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(i.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",Fl,[i.ua||i.label?(e.openBlock(),e.createElementBlock("p",Il,[e.createElementVNode("span",Ll,e.toDisplayString(i.item[n.value]||i.ua||i.label),1),o.value?(e.openBlock(),e.createElementBlock("span",Tl,"*")):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,Ol)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["w-full",["select","native-select"].includes(i.item.type)?"md:w-[30%]":"md:w-auto"])},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],2)],2),r.value?(e.openBlock(),e.createElementBlock("p",zl,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0)],2))}})};function De(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 jl=["placeholder","disabled"],Pl=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}=De(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":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,jl)),[[e.vModelText,a.value]])}}),Ul=["placeholder","disabled","maxlength","minlength"],it=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}=De(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]=g=>a.value=g),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",[d.customClass,e.unref(n),{"!border-red-600":d.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Ul)),[[e.vModelText,a.value]])}}),Hl=["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}=De(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled);return(r,s)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":s[0]||(s[0]=i=>a.value=i),placeholder:r.placeholder,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"},min:r.min,max:r.max},null,10,Hl)),[[e.vModelText,a.value]])}}),ae=(l,t)=>{const n=l.__vccOpts||l;for(const[a,o]of t)n[a]=o;return n},ql={},Kl={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 Gl(l,t){return e.openBlock(),e.createElementBlock("svg",Kl,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 Yl=ae(ql,[["render",Gl]]),Wl={class:"flex items-center gap-[4px]"},Zl=["value","id","disabled"],Jl=["for"],Xl={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",Wl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:s.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:s.id,disabled:r.value},null,10,Zl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:s.id,class:e.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":r.value}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[o.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",s.error?"border-red-600":""]])},[e.createVNode(Yl,{height:"12",width:"12"})],2),e.createElementVNode("span",Xl,[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(s.label),1)])])],10,Jl)]))}}),ea=["name","value","disabled"],ta={class:"flex items-center gap-[6px] text-[14px]"},na={key:0,class:"text-[16px]"},la=["src"],aa=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:i.id,value:i.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),disabled:i.disabled},null,8,ea),[[e.vModelCheckbox,o.value]]),e.createElementVNode("span",ta,[i.icon||i.imgUrl?(e.openBlock(),e.createElementBlock("span",na,[i.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(i.icon)},null,2)):e.createCommentVNode("",!0),i.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:1,src:i.imgUrl,width:"16",height:"16",alt:"icon"},null,8,la)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(i.label),1)])])],2))}}),oa={class:"flex items-center"},Wt=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",oa,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value==="vs-checkbox-buttons"?e.unref(aa):e.unref(Ql)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:r.value,"onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),id:o,icon:i.icon,imgUrl:i.imgUrl,style:e.normalizeStyle(i.style),error:i.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),ra={},sa={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 ia(l,t){return e.openBlock(),e.createElementBlock("svg",sa,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 Zt=ae(ra,[["render",ia]]),ca={},da={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 ua(l,t){return e.openBlock(),e.createElementBlock("svg",da,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 St=ae(ca,[["render",ua]]),pa={},ma={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 fa(l,t){return e.openBlock(),e.createElementBlock("svg",ma,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 ha=ae(pa,[["render",fa]]),ga={key:0,class:"flex items-start gap-x-1"},ya={key:0,class:"text-red-500 text-[14px]"},ka=["title"],ba=["disabled"],Jt=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",ga,[e.createVNode(Wt,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),label:a.text,error:a.error||""},null,8,["modelValue","label","error"]),a.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",ya,"*")):e.createCommentVNode("",!0),a.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:a.i,onClick:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(ha),{class:"text-gray-500 w-[14px] h-[14px]"})],8,ka)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[n.value?`bg-${a.style?.primaryColor||"blue"}-500`:"bg-stone-200",a.customClass]]),disabled:a.disabled,onClick:o[2]||(o[2]=r=>n.value=!n.value)},[e.createElementVNode("span",{"data-state":"checked",class:e.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[n.value?"translate-x-4":"translate-x-0"]])},null,2)],10,ba))}}),wa=["id","innerHTML"],Xt=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",{id:t.name,class:e.normalizeClass(["text-gray-900",t.customClass]),innerHTML:t.html?t.html:t.text},null,10,wa))}}),xa=["placeholder","disabled","name"],Qt=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}=De(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 y=i[E];y==="{"?p=!0:y==="}"?p=!1:p&&d.add(y)}const g={};return Object.keys(c).forEach(E=>{d.has(E)||(g[E]=c[E])}),{mask:i,definitions:g,lazy:!1}}return e.onMounted(async()=>{if(o.value){const{default:i}=await Promise.resolve().then(()=>bn),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:i.placeholder,disabled:i.disabled,name:i.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,xa))}}),_a={class:"relative w-full bg-white rounded-lg"},va=["placeholder","disabled"],en=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}=De(t.style),a=e.useModel(l,"modelValue");return(o,r)=>(e.openBlock(),e.createElementBlock("div",_a,[r[1]||(r[1]=e.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),e.withDirectives(e.createElementVNode("input",{type:"email","onUpdate:modelValue":r[0]||(r[0]=s=>a.value=s),placeholder:o.placeholder,disabled:o.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,va),[[e.vModelText,a.value]])]))}}),Ea={class:"relative w-full bg-white rounded-lg"},Va=["value","placeholder","disabled"],tn=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}=De(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",Ea,[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:i.placeholder,disabled:i.disabled,class:e.normalizeClass(["!pl-10 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":i.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Va)]))}}),Ba=["value","disabled"],Ca={class:"text-[13px] text-gray-700"},Sa=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,Ba),[[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",Ca,e.toDisplayString(t.text),1)],2))}}),Na=["value","disabled"],$a={class:"text-[13px] text-gray-700"},Ma={"vs-input-radio-default":Sa,"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,Na),[[e.vModelRadio,n.value]]),e.createElementVNode("span",$a,e.toDisplayString(t.text),1)],2))}})},nn=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(()=>Ma[`vs-input-radio-${t.view}`]);return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([o.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,s=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),e.mergeProps({key:s?.id,text:s.text,value:s.id.toString(),checked:n.value===s.id,modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=i=>n.value=i)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),Da={key:1,class:"w-full flex flex-col gap-4"},Aa={key:0,class:"text-sm font-medium text-muted-foreground my-2"},Fa="Без категорії",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=y=>y?.value||y?.id||y?.text||y,i=y=>y.text||String(y),c=y=>`lg:col-span-${y||12}`,d=e.computed(()=>[n.position==="vertical"?"flex flex-col":"",n.colSpan?"grid":"flex justify-start"]),p=y=>y==null||y===""?null:typeof y=="string"||typeof y=="number"?y:String(y),g=e.computed(()=>{if(!n.group)return[];const y=new Map;o.value.forEach(k=>{const w=k[n.group],b=p(w);y.has(b)||y.set(b,[]),y.get(b)?.push(k)});const V=[];n.values?.length&&n.values.forEach(k=>{const w=p(k);V.push(w)});const f=new Set,h=k=>{const w=y.get(k)||[];if(!w.length)return null;const b=k===null?"group-null":`group-${String(k)}`,B=k===null?Fa:String(k);return f.add(k),{key:b,label:B,options:w}},x=[];return V.forEach(k=>{const w=h(k);w&&x.push(w)}),y.forEach((k,w)=>{if(f.has(w))return;const b=h(w);b&&x.push(b)}),x}),E=async()=>{try{const y=await fetch(`/api/suggest/${n.data}`).then(V=>V.json());o.value=y?.data||y}catch(y){console.error(y)}};return e.watch(()=>n.modelValue,y=>{if(typeof y=="boolean"&&o.value.length===1){const V=s(o.value[0]);r[V]=y}else if(Array.isArray(y)){const V=new Set(y);o.value.forEach(f=>{if(!f.disabled){const h=s(f);r[h]=V.has(h)}})}},{immediate:!0}),e.watch(r,()=>{if(!o.value.length){a("update:modelValue",null);return}const y=Object.entries(r).filter(([,V])=>V).map(([V])=>V);a("update:modelValue",y.length===0?[]:y)},{deep:!0}),e.onMounted(()=>{if(n.data)E().then(()=>{if(typeof n.modelValue=="boolean"&&o.value.length===1){const y=s(o.value[0]);r[y]=n.modelValue}else if(Array.isArray(n.modelValue)){const y=new Set(n.modelValue);o.value.forEach(V=>{if(!V.disabled){const f=s(V);r[f]=y.has(f)}})}});else if(o.value=n.options,typeof n.modelValue=="boolean"&&o.value.length===1){const y=s(o.value[0]);r[y]=n.modelValue}else if(Array.isArray(n.modelValue)){const y=new Set(n.modelValue);o.value.forEach(V=>{if(!V.disabled){const f=s(V);r[f]=y.has(f)}})}}),(y,V)=>n.group?(e.openBlock(),e.createElementBlock("div",Da,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,f=>(e.openBlock(),e.createElementBlock("div",{key:f.key,class:"flex flex-col gap-2"},[f.label?(e.openBlock(),e.createElementBlock("span",Aa,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,h=>(e.openBlock(),e.createBlock(Wt,{modelValue:r[s(h)],"onUpdate:modelValue":x=>r[s(h)]=x,value:s(h),class:e.normalizeClass(c(y.colSpan)),disabled:n.disabled||h.disabled,label:i(h),key:`${f.key}-${s(h)}`,icon:h?.icon,imgUrl:h?.imgUrl,option:h,view:y.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(Wt,{modelValue:r[s(f)],"onUpdate:modelValue":h=>r[s(f)]=h,value:s(f),class:e.normalizeClass(c(y.colSpan)),disabled:n.disabled||f.disabled,label:i(f),key:s(f),icon:f?.icon,imgUrl:f?.imgUrl,option:f,view:y.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-8e66207e"]]),Ia=["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}=De(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,g)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":g[0]||(g[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",[p.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Ia)),[[e.vModelDynamic,s.value]])}}),Ta=(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=Ta(c,i);return(await fetch(d,{method:"POST",body:n}).then(g=>g.json()))?.result}catch(n){return he.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",n),null}},Oa=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)}},za={},Ra={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",Ra,t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const Ke=ae(za,[["render",ja]]),Pa={},Ua={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 Ha(l,t,n,a,o,r){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><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 qa=ae(Pa,[["render",Ha]]),Ka={},Ga={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 Ya(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Ga,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 Wa=ae(Ka,[["render",Ya]]),Za={},Ja={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 Xa(l,t){return e.openBlock(),e.createElementBlock("svg",Ja,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(Za,[["render",Xa]]),Qa={},eo={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 to(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",eo,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 no=ae(Qa,[["render",to]]),lo={},ao={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 oo(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",ao,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 ro=ae(lo,[["render",oo]]),so=l=>{if(!l)return"";const t=l?.split(".");return t[t.length-1]},io=l=>{const t=so(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)?Wa:n.textsFormat.includes(t)?ro:n.documentsFormat.includes(t)?qa:n.archivesFormat.includes(t)?no:Bn},co={},uo={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 po(l,t){return e.openBlock(),e.createElementBlock("svg",uo,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 ct=ae(co,[["render",po]]),mo={},fo={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 ho(l,t){return e.openBlock(),e.createElementBlock("svg",fo,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(mo,[["render",ho]]),go=["title"],yo={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},ln=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(io)(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",yo,[e.createElementVNode("button",{type:"button",onClick:r[1]||(r[1]=s=>{e.unref(Oa)(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(ct,{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,go))}}),[["__scopeId","data-v-286cdbc0"]]),ko={class:"flex items-center gap-x-2"},bo=["accept","multiple","disabled"],wo={key:1,class:"flex items-center flex-wrap gap-2"},xo={key:1,class:"loader"},_o={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(k=>k.trim().toLowerCase()).filter(Boolean):[]),d=k=>Array.isArray(a.value)&&a.value[k]||"",p=k=>{if(n.max_size&&k.size>n.max_size*1024*1024){const w=(k.size/1048576).toFixed(2);return he.notify({type:"error",title:"Помилка!",message:`Файл "${k.name}" занадто великий. Максимальний розмір: ${n.max_size} МБ, розмір файлу: ${w} МБ`,position:"right-bottom"}),!1}return!0},g=k=>{if(!c.value.length)return!0;const w=`.${k.name.split(".").pop()?.toLowerCase()||""}`,b=c.value.includes(w);return b||he.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${k.name}". Дозволені формати: ${c.value.join(", ")}`,position:"right-bottom"}),b},E=e.computed(()=>{const k={},w=[];if(!n.customParams?.length)return{params:k,missingSources:w};const b=i?.value??{};return n.customParams.forEach(B=>{if(!B)return;const[$,S]=B.split("="),j=$?.trim(),W=S?.trim();if(!j||!W)return;const K=b[W];if(K==null||K===""){w.push(W);return}k[j]=K}),{params:k,missingSources:w}}),y=()=>{const{params:k}=E.value;return{api:n.api,customParams:Object.keys(k).length?k:void 0}},V=()=>{const k=E.value.missingSources;if(!k.length)return!0;const w=k.join(", ");return he.notify({type:"warning",title:"Заповніть поля",message:`Поля (${w}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},f=k=>{he.notify({type:"error",title:"Помилка завантаження",message:k||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},h=()=>{n.disabled||s.value||V()&&r.value?.click()},x=async k=>{const{files:w}=k.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(S=>!p(S)).length>0){r.value&&(r.value.value="");return}if(b.filter($=>!g($)).length>0){r.value&&(r.value.value="");return}s.value=!0;try{if(n.multiple){const $=Array.from(w).map(async K=>await En(K,y())),S=await Promise.all($),W=S.filter(K=>K!==null).map(K=>K?.file_path).filter(Boolean);if(W.length===0){f();return}W.length<S.length&&f("Деякі файли не вдалося завантажити. Перевірте їх та спробуйте знову."),a.value=[...a.value||[],...W],o("change",a.value)}else{const $=w[0],S=await En($,y());if(!S?.file_path){f();return}a.value=S?.file_path,o("change",a.value||"")}}catch($){const S=$?.message||void 0;f(S)}finally{s.value=!1,r.value&&(r.value.value="")}};return(k,w)=>(e.openBlock(),e.createElementBlock("div",ko,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:r,type:"file",accept:n.format,multiple:k.multiple,onChange:x,disabled:s.value||k.disabled},null,40,bo),!k.multiple&&a.value?(e.openBlock(),e.createBlock(ln,{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"])):k.multiple?(e.openBlock(),e.createElementBlock("div",wo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(b,B)=>(e.openBlock(),e.createBlock(ln,{multiple:k.multiple,key:B,value:a.value,"onUpdate:value":w[2]||(w[2]=$=>a.value=$),item:d(B)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:h,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",k.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",xo)):(e.openBlock(),e.createBlock(Ke,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),k.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:h,class:e.normalizeClass([k.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",_o)):(e.openBlock(),e.createBlock(Ke,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-cf6efbaa"]]),vo={class:"vs-input-file2 flex flex-col gap-4"},Eo={class:"flex items-center gap-x-2"},Vo=["accept","disabled"],Bo={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"},Co={key:0,class:"rounded-lg border border-[#CFD9E0] bg-white p-4 shadow-sm"},So={class:"flex items-center justify-between text-sm"},No={class:"truncate pr-4"},$o={class:"font-medium text-slate-800 truncate"},Mo={class:"text-slate-500"},Do={class:"text-slate-500 whitespace-nowrap"},Ao={class:"mt-3 h-2 rounded-full bg-slate-100 overflow-hidden"},Fo={class:"mt-3 flex flex-wrap gap-2 text-sm"},Io={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"),g=e.computed(()=>t.format?t.format.split(",").map(z=>z.trim().toLowerCase()).filter(Boolean):[]),E=e.computed(()=>!o.value||!o.value.size?0:Math.min(100,Math.round(s.value/o.value.size*100))),y=e.computed(()=>o.value?`${h(s.value)} / ${h(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()},h=z=>{if(!Number.isFinite(z))return"0 B";const L=["B","KB","MB","GB"];let Z=0,F=z;for(;F>=1024&&Z<L.length-1;)F/=1024,Z+=1;return`${F.toFixed(Z===0?0:1)} ${L[Z]}`},x=z=>{if(!t.max_size)return!0;const L=t.max_size*1024*1024;return z.size>L?(he.notify({type:"error",title:"Файл занадто великий",message:`Максимальний розмір ${t.max_size} МБ`,position:"right-bottom"}),!1):!0},k=z=>{if(!g.value.length)return!0;const L=`.${z.name.split(".").pop()?.toLowerCase()||""}`;return g.value.includes(L)?!0:(he.notify({type:"error",title:"Непідтримуваний формат",message:`Дозволені формати: ${g.value.join(", ")}`,position:"right-bottom"}),!1)},w=e.computed(()=>{const z={},L=[];if(!t.customParams?.length)return{params:z,missing:L};const Z=p?.value??{};return t.customParams.forEach(F=>{if(!F)return;const[A,H]=F.split("="),P=A?.trim(),pe=H?.trim();if(!P||!pe)return;const ke=Z[pe];ke==null||ke===""?L.push(pe):z[P]=ke}),{params:z,missing:L}}),b=()=>w.value.missing.length?(he.notify({type:"warning",title:"Заповніть поля",message:`Потрібні значення: ${w.value.missing.join(", ")}`,position:"right-bottom"}),!1):!0,B=z=>{const L=z.target,Z=L.files?.[0];if(Z){if(!b()){L.value="";return}if(!x(Z)||!k(Z)){L.value="";return}o.value=Z,s.value=0,r.value="",c.value=""}},$=async()=>{if(!o.value){f();return}try{c.value="";const z={id:r.value||"",fileName:o.value.name,subdir:t.subdir,size:o.value.size,...w.value.params},L=await fetch("/api/file/upload2/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(z)});if(!L.ok)throw new Error("Не вдалося ініціалізувати завантаження");const Z=await L.json();r.value=Z.id||r.value,s.value=Z.uploaded||0,await S()}catch(z){c.value=z?.message||"Помилка при старті завантаження"}},S=async()=>{if(!(!o.value||!r.value)){i.value=!0;try{for(;s.value<o.value.size;){const z=s.value,L=Math.min(z+t.chunkSize,o.value.size),Z=o.value.slice(z,L);d.value=new AbortController;const F=await fetch(`/api/file/upload2/${r.value}`,{method:"PATCH",headers:{"Content-Range":`bytes ${z}-${L-1}/${o.value.size}`},body:Z,signal:d.value.signal});if(!F.ok)throw new Error("Помилка завантаження частини");const A=await F.json().catch(()=>({}));if(A.uploaded!=null?s.value=Number(A.uploaded):s.value=L,A.finished||s.value>=o.value.size){i.value=!1,n.value=A.file_path||A.url||r.value,he.notify({type:"success",title:"Файл завантажено",message:o.value.name,position:"right-bottom"}),T();return}}}catch(z){if(z?.name==="AbortError")return;c.value=z?.message||"Помилка при завантаженні",i.value=!1}finally{d.value=null,i.value=!1}}},j=()=>{i.value&&(d.value?.abort(),d.value=null,i.value=!1)},W=async()=>{if(o.value){if(!r.value){await $();return}await S()}},K=()=>{d.value?.abort(),d.value=null,T()},T=()=>{const z=a.value;z&&(z.value=""),o.value=null,r.value="",s.value=0,c.value=""};return(z,L)=>(e.openBlock(),e.createElementBlock("div",vo,[e.createElementVNode("div",Eo,[e.createElementVNode("input",{ref_key:"fileInput",ref:a,type:"file",class:"hidden",accept:t.format,disabled:i.value||t.disabled,onChange:B},null,40,Vo),n.value?(e.openBlock(),e.createBlock(ln,{key:0,item:n.value,"onUpdate:item":L[0]||(L[0]=Z=>n.value=Z),value:n.value,"onUpdate:value":L[1]||(L[1]=Z=>n.value=Z)},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",Bo,[L[2]||(L[2]=e.createElementVNode("div",{class:"loader"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(E.value)+"%",1)])):(e.openBlock(),e.createBlock(Ke,{key:1,class:"w-6 h-6"}))],2))]),o.value&&!n.value?(e.openBlock(),e.createElementBlock("div",Co,[e.createElementVNode("div",So,[e.createElementVNode("div",No,[e.createElementVNode("div",$o,e.toDisplayString(o.value.name),1),e.createElementVNode("div",Mo,e.toDisplayString(h(o.value.size)),1)]),e.createElementVNode("div",Do,e.toDisplayString(y.value),1)]),e.createElementVNode("div",Ao,[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",Fo,[!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:W}," 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:j}," 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:$}," Upload ")):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"rounded border border-rose-200 px-3 py-1 text-rose-600",onClick:K}," Cancel ")]),c.value?(e.openBlock(),e.createElementBlock("p",Io,e.toDisplayString(c.value),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),an=ae(Lo,[["__scopeId","data-v-ea9f874f"]]),To={class:"max-w-[55vw]"},Oo={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},zo={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},Ro={class:"px-[5px]"},jo={class:""},Nt=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",To,[e.createElementVNode("p",Oo,e.toDisplayString(o.item?.uploaded_name),1),e.createElementVNode("p",zo,[e.createElementVNode("span",null,e.toDisplayString(o.item?.username),1),e.withDirectives(e.createElementVNode("span",Ro,"|",512),[[e.vShow,o.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(n.value),1),r[0]||(r[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",jo,e.toDisplayString(a(o.item?.size)),1)])])],64))}}),Po={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},Uo={key:0,class:"flex w-full gap-x-3 items-center"},Ho={key:1,class:"flex gap-x-3 w-full items-center"},qo={key:2,class:"flex gap-x-3 w-full items-center"},Ko=["href"],Go={key:3,class:"flex gap-x-3 w-full items-center"},Yo={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},Wo={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"},Zo={class:"inline-block"},Jo={class:"inline-block"},Xo=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 g=document.createElement("a");g.setAttribute("download",p?.uploaded_name),g.href=p?.file_path,g.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,g)=>(e.openBlock(),e.createElementBlock("div",Po,[p.item.ext==="jpg"||p.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",Uo,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:g[0]||(g[0]=E=>d(p.index))},[e.createVNode(Nt,{item:p.item},null,8,["item"])])])):o(p.item)?(e.openBlock(),e.createElementBlock("div",Ho,[e.createVNode(Nt,{item:p.item},null,8,["item"])])):r(p.item)?(e.openBlock(),e.createElementBlock("div",qo,[e.createElementVNode("a",{href:`/api/file-preview?id=${p.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(Nt,{item:p.item},null,8,["item"])],8,Ko)])):(e.openBlock(),e.createElementBlock("div",Go,[e.createVNode(Nt,{item:p.item},null,8,["item"])])),e.createElementVNode("div",Yo,[e.createElementVNode("div",Wo,[e.createElementVNode("div",Zo,[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:g[1]||(g[1]=E=>s(p.item))},[e.createVNode(Cn,{height:"14",width:"14"})])]),g[3]||(g[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",Jo,[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:g[2]||(g[2]=E=>c())},[e.createVNode(ct,{height:"14",width:"14"})])])])])]))}}),Qo={},er={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 tr(l,t){return e.openBlock(),e.createElementBlock("svg",er,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 nr=ae(Qo,[["render",tr]]),lr={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},ar={class:"flex w-full mb-[12px] items-center gap-x-2"},or={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},rr={class1:"ml-auto"},sr={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"},ir={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},cr={class:"relative"},dr={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"},ur={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([]),g=e.ref(""),E=e.computed(()=>Array.isArray(p.value)?p.value.filter(w=>w.ext==="jpg"||w.ext==="png").map(w=>w?.file_path):[]),y=e.computed(()=>g.value===""?p.value:p.value.filter(w=>w?.uploaded_name?.includes(g.value))),V=w=>{const b=E.value.findIndex(B=>B===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)}},h=async w=>{await Promise.all(Array.from(w.target.files).map(async b=>{const B=new FormData;B.append("file",b);try{const $=`${n.prefix}/widget/file/${o.value}`,S=await fetch($,{method:"POST",body:B});return S.ok?(i("update","file-list"),b):(he.notify({type:S.status>=400&&S.status<500?"warning":"error",title:"Error",message:`Error code: ${S.status}`}),null)}catch($){return he.notify({type:"error",title:"Error",message:$.message||"Unknown error"}),console.error($),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},k=w=>{d.value=x(w),c.value=!0};return e.watch(o,w=>{w&&f()}),e.onMounted(()=>{o.value&&f()}),(w,b)=>{const B=e.resolveComponent("Lightbox"),$=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",lr,[e.createElementVNode("div",ar,[e.createElementVNode("h2",or," Файлів: "+e.toDisplayString(p.value?.length),1),e.createElementVNode("div",rr,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:b[0]||(b[0]=S=>h(S))},null,32),e.createElementVNode("div",sr,[e.createVNode(nr,{height:"16",width:"16"})])])])]),p.value?.length>4?(e.openBlock(),e.createElementBlock("div",ir,[e.createElementVNode("div",null,[e.createElementVNode("div",cr,[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]=S=>g.value=S),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,g.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),p.value?.length?(e.openBlock(),e.createElementBlock("div",dr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(S,j)=>(e.openBlock(),e.createBlock(Xo,{key:j,prefix:w.prefix,item:S,index:j,onUpdate:b[2]||(b[2]=W=>w.$emit("update","file-list")),onOpenModal:b[3]||(b[3]=W=>k(W)),onOpenLightbox:b[4]||(b[4]=W=>V(W))},null,8,["prefix","item","index"]))),128)),y.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",ur,b[9]||(b[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):e.createCommentVNode("",!0),e.createVNode(B,{modelValue:r.value,"onUpdate:modelValue":b[5]||(b[5]=S=>r.value=S),startIndex:s.value,"onUpdate:index":b[6]||(b[6]=S=>s.value=S),images:E.value},null,8,["modelValue","startIndex","images"]),e.createVNode($,e.mergeProps({modelValue:c.value,"onUpdate:modelValue":b[7]||(b[7]=S=>c.value=S),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),pr={class:"flex items-center justify-between"},mr={class:"text-[16px] text-gray-900 font-medium"},fr={class:"grid gap-3"},hr=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",pr,[e.createElementVNode("p",mr,e.toDisplayString(l.title),1),e.createVNode(Jt,{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",fr,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),gr={class:"text-[16px] text-gray-900 font-medium"},yr={class:"grid gap-3"},kr=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(Zt),{class:e.normalizeClass(["h-4 w-4 duration-300",[n.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",gr,e.toDisplayString(l.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",yr,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),br={class:"flex items-center justify-between"},wr={switcher:hr,accordion:kr,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",br,[e.createElementVNode("p",null,e.toDisplayString(l.title),1)]),e.renderSlot(t.$slots,"default")]))}})},Oe={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},xr=(l,t)=>String(l)===String(t),_r=(l,t)=>String(l)!==String(t),vr=(l,t)=>l>t,Er=(l,t)=>l>=t,Vr=(l,t)=>l<t,Br=(l,t)=>l<=t,Cr=(l,t)=>Array.isArray(t)&&t.length===2?l>=t[0]&&l<=t[1]:!1,Sr=(l,t)=>String(l).startsWith(String(t)),Nr=(l,t)=>String(l).endsWith(String(t)),$r=(l,t)=>String(l).includes(String(t)),Mr=(l,t)=>Array.isArray(t)?t.includes(l):!1,Dr=(l,t)=>Array.isArray(t)?!t.includes(l):!0,$n=(l,t)=>{if(!t)return!0;switch(t?.[1]){case Oe.Equal:return xr(l,t?.[2]);case Oe.Inequal:return _r(l,t?.[2]);case Oe.Higer:return vr(l,t?.[2]);case Oe.HigerOrEqual:return Er(l,t?.[2]);case Oe.Lower:return Vr(l,t?.[2]);case Oe.LowerOrEqual:return Br(l,t?.[2]);case Oe.Between:return Cr(l,t?.[2]);case Oe.StartWith:return Sr(l,t?.[2]);case Oe.EndWith:return Nr(l,t?.[2]);case Oe.Contain:return $r(l,t?.[2]);case Oe.In:return Mr(l,t?.[2]);case Oe.NotIn:return Dr(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(()=>wr[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(Yn,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)}}),Ar=["aria-expanded","data-focus"],Fr={class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full"},Ir={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"},Tr=["title"],Or=["innerHTML"],zr=["onClick"],Rr={class:"flex-1 min-w-[2px]"},jr=["placeholder"],Pr=["title"],Ur=["innerHTML"],Hr={key:3,class:"truncate flex-1 min-w-0"},qr={key:2,class:"flex-1 min-w-[2px]"},Kr=["placeholder"],Gr={class:"flex items-center shrink-0"},Yr=["disabled"],Wr=["disabled","title"],Zr=["aria-disabled","onClick"],Jr=["innerHTML"],Xr={key:1,class:"px-3 py-2 text-center text-gray-500"},Qr=["disabled"],on="w-[16px] h-[16px] flex items-center justify-center flex-shrink-0 text-current",rn=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);De(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),g=e.ref(!1),E=e.ref(!1),y=e.ref(null),V=e.ref([]),f=e.ref(-1),h=e.ref([]),x=e.ref(""),k=e.ref(null),w=e.ref("bottom"),b=e.ref({}),B=e.ref([]),$=e.computed(()=>{if(!B.value.length)return[];const v=V.value,N=new Map(v.map(I=>[I.id?.toString(),I]));return B.value.map(I=>N.get(I?.toString())).filter(I=>!!I)}),S=e.computed(()=>n.placeholder||"Select..."),j=e.computed(()=>P(y.value));e.computed(()=>o.value?!B.value.length&&x.value==="":!j.value&&x.value==="");const W=e.computed(()=>r.value?!1:o.value?B.value.length>0:!!s.value),K=v=>o.value?B.value.some(N=>N?.toString()===v?.toString()):s.value?.toString()===v?.toString(),T=e.computed(()=>{let v=V.value??[];if(!n.data&&x.value.trim()!==""){const N=x.value.toLowerCase();v=v.filter(I=>{const ee=P(I).toLowerCase(),ye=I.text?.toLowerCase?.()||"";return ee.includes(N)||ye.includes(N)})}if(o.value&&B.value.length){const N=new Set(B.value.map(I=>I?.toString()));v=v.filter(I=>!N.has(I.id?.toString()))}return v}),z=e.inject("values"),L=e.inject("field-props"),Z=/\{\{\s*([^}]+?)\s*\}\}/g,F=v=>(v?String(v):"").replace(/<[^>]*>/g,"").trim(),A=e.computed(()=>n.slot??n?.optionTemplate??""),H=v=>{if(!v)return"";const N=A.value;return N?N.replace(Z,(I,ee)=>{const ye=ee.trim(),_e=v[ye];return _e!=null?String(_e):""}):v.text??""},P=v=>{if(!v)return"";if(!A.value)return v.text??"";const I=H(v);return F(I)||v.text||""},pe=new Map,ke=wl.icons,Te=v=>v.replace(/^([A-Z])|[\s-_]+(\w)/g,(N,I,ee)=>ee?ee.toUpperCase():I.toLowerCase()),Ie=v=>{const N=Te(v);return N?N.charAt(0).toUpperCase()+N.slice(1):""},Y=v=>{if(!v)return;const N=Ie(v);if(pe.has(N))return pe.get(N);const ee=[N,`${N}Icon`,`Lucide${N}`,`Lucide${N}Icon`].map(ye=>ke[ye]).find(Boolean);return pe.set(N,ee),ee},re=v=>v?typeof v.icon=="string"?Y(v.icon)??null:v.icon??null:null,me=v=>!!(v?.color&&!re(v)),fe=v=>v?.color?{color:v.color}:void 0,ge=v=>!!re(v),O=(v,N,I)=>{if(!L)return!1;const ee=L.value?.[v]??{},ye=(ve,Ce,u)=>{if(!Ce.length)return ve;const[m,..._]=Ce,C={...ve};if(!_.length)return C[m]=u,C;const U=typeof ve[m]=="object"&&ve[m]!==null?ve[m]:{};return C[m]=ye(U,_,u),C},_e=ye(ee,N,I);return L.value={...L.value||{},[v]:_e},!0},ne=v=>{if(!n.set)return;const N=z?.value;!N&&!L||Object.entries(n.set).forEach(([I,ee])=>{if(!I)return;const ye=v?v[ee]:null,_e=I.split(".").map(u=>u.trim()).filter(Boolean);if(!_e.length)return;const[ve,...Ce]=_e;Ce.length&&O(ve,Ce,ye??null)||N&&(N[ve]=ye??null)})},Ee=e.computed(()=>n.parent?z?.value?.[n.parent]?.toString()??null:null),Ae=async v=>{if(!n.data){let N=n.options??[];if(v?.trim()){const I=v.toLowerCase();N=N.filter(ee=>{const ye=P(ee).toLowerCase(),_e=ee.text?.toLowerCase?.()||"";return ye.includes(I)||_e.includes(I)})}return N}try{const N=n.host??"",I=n.prefix??"api",ee=n.api??`/${I}/suggest/${n.data}`,ye=`${N}${ee}`,_e=new URLSearchParams;return _e.set("json","1"),v&&_e.set("key",v),Ee.value!==void 0&&Ee.value!==null&&Ee.value!==""&&_e.set("parent",Ee.value),n.start===1&&_e.set("start","1"),(await fetch(`${ye}?${_e.toString()}`).then(Ce=>Ce.json()))?.data??[]}catch{return[]}},M=async()=>{n.data?V.value=await Ae(x.value):V.value=n.options?[...n.options]:[]},R=async v=>{if(v==null||v==="")return null;const N=V.value?.find(I=>I?.id?.toString()===String(v));if(N)return N;if(n.data)try{const I=n.host??"",ee=n.prefix??"api",ye=n.api??`/${ee}/suggest/${n.data}`,_e=`${I}${ye}`,ve=new URLSearchParams;return ve.set("json","1"),ve.set("val",String(v)),Ee.value!==void 0&&Ee.value!==null&&Ee.value!==""&&ve.set("parent",Ee.value),n.start===1&&ve.set("start","1"),((await fetch(`${_e}?${ve.toString()}`).then(m=>m.json()))?.data??[])?.[0]??null}catch{return null}return null},q=async v=>{const N=new Set(V.value.map(ee=>ee.id?.toString())),I=v.filter(ee=>!N.has(ee?.toString()));I.length&&await I.reduce(async(ee,ye)=>{await ee;const _e=await R(ye);_e&&V.value.push(_e)},Promise.resolve())},le=()=>{if(!T.value.length){f.value=-1;return}let v=0;if(!o.value&&y.value){const N=y.value.id?.toString(),I=T.value.findIndex(ee=>ee.id?.toString()===N);I>=0&&(v=I)}f.value=v,e.nextTick(()=>{xe(h.value[v],d.value)})},oe=async()=>{r.value||(g.value=!0,await M(),await e.nextTick(()=>{ze(),k.value?.focus()}),le())},be=()=>{g.value=!1,f.value=-1,e.nextTick(()=>{k.value?.blur()})},Ve=async v=>{if(r.value)return;!g.value?await oe():be()},we=async()=>{if(!r.value){if(g.value){be();return}await oe()}},Xe=()=>{o.value?(B.value=[],s.value=[],a("change",[]),G(null,[])):(y.value=null,s.value=null,a("change",null),G(null,null)),ne(null),x.value="",e.nextTick(()=>k.value?.focus())},D=v=>{o.value&&(B.value=B.value.filter(N=>N?.toString()!==v?.toString()),s.value=[...B.value],a("change",s.value),G(null),e.nextTick(()=>k.value?.focus()))},G=(v,N)=>{const I=N??(o.value?[...B.value]:v?.id??null);a("value-selected",{name:n.name,value:I,option:v})},J=v=>{o.value?(K(v.id)||(B.value=[...B.value,v.id],s.value=[...B.value],a("change",s.value),G(v)),x.value="",e.nextTick(()=>{k.value?.focus(),f.value=Math.min(f.value,T.value.length-1)}),ne(null)):(y.value=v,s.value=v.id,a("change",s.value),G(v),x.value="",be(),ne(v))},ue=v=>{if(K(v.id)){o.value||be();return}J(v)},xe=(v,N)=>{if(!v||!N)return;const I=v.offsetTop,ee=I+v.offsetHeight,ye=N.scrollTop,_e=ye+N.clientHeight;let ve=N.scrollTop;I<ye?ve=I-80:ee>_e&&(ve=ee-N.clientHeight+4);const Ce=N;Ce.scrollTop=ve},Ue=v=>{let N=v.parentElement;for(;N;){if(N.classList.contains("ui-dialog__content"))return N;const I=window.getComputedStyle(N),ee=I.overflow+I.overflowY+I.overflowX;if(ee.includes("auto")||ee.includes("scroll")||N===document.body||N===document.documentElement)return N;N=N.parentElement}return document.body},ze=()=>{if(!c.value)return;const v=c.value.getBoundingClientRect(),N=window.innerHeight||document.documentElement.clientHeight,I=window.innerWidth||document.documentElement.clientWidth,ee=8,ye=8,_e=n.maxHeight||300,ve=N-v.bottom-ye-ee,Ce=v.top-ye-ee,u=ve>=Ce,m=Math.max(I-ee*2,0);let{width:_}=v;m>0&&_>m&&(_=m);let{left:C}=v;C+_+ee>I&&(C=I-_-ee),C=Math.max(C,ee);const U=Math.min(_e,Math.max(u?ve:Ce,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+ye}px`:`${v.top-ye}px`}},Re=async v=>{r.value||!g.value&&(v.key==="ArrowDown"||v.key==="ArrowUp")&&(v.preventDefault(),await oe())},tt=v=>{if(!g.value)return;const{key:N}=v;if(N==="ArrowDown")v.preventDefault(),f.value+1<T.value.length&&(f.value+=1,xe(h.value[f.value],d.value));else if(N==="ArrowUp")v.preventDefault(),f.value>0&&(f.value-=1,xe(h.value[f.value],d.value));else if(N==="Enter"){v.preventDefault();const I=T.value[f.value];I&&J(I),k.value?.blur()}else N==="Escape"?(v.preventDefault(),be()):N==="Backspace"?o.value&&x.value===""&&B.value.length&&(B.value=B.value.slice(0,-1),s.value=[...B.value],a("change",s.value)):N==="Home"?(f.value=0,xe(h.value[0],d.value)):N==="End"?(f.value=T.value.length-1,xe(h.value[f.value],d.value)):N==="Tab"&&be()},Ze=()=>{r.value||(E.value=!0)},He=()=>{E.value=!1,x.value=""},qe=v=>{v.key==="Escape"&&g.value&&be()},rt=v=>{const N=v.target;i.value?.contains(N)||p.value?.contains(N)||be()},Gt=v=>{g.value&&d.value&&!d.value.contains(v.target)&&ze()},vt=()=>{g.value&&ze()},Yt=()=>{g.value&&ze()};e.watch(()=>n.options,v=>{v?.length&&(V.value=[...v],nt())},{immediate:!0});async function nt(){if(o.value)Array.isArray(s.value)?B.value=[...s.value]:(B.value=s.value==null?[]:[s.value],s.value=[...B.value]),n.data&&B.value.length&&(await q(B.value),await e.nextTick());else{if(Array.isArray(s.value)){const v=s.value[0]??null;s.value=v??null}s.value!=null&&(y.value=await R(s.value)),ne(y.value??null)}}e.watch(s,()=>{nt()}),e.onMounted(async()=>{addEventListener("keydown",qe),addEventListener("scroll",Gt,!0),addEventListener("resize",vt),document.addEventListener("click",rt,!0),c.value&&Ue(c.value).addEventListener("scroll",Yt,!0),n.options?.length&&!n.data?V.value=[...n.options]:n.data&&(V.value=await Ae("")),await nt(),lt.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",qe),removeEventListener("scroll",Gt,!0),removeEventListener("resize",vt),document.removeEventListener("click",rt,!0),c.value&&Ue(c.value).removeEventListener("scroll",Yt,!0)});const st=e.ref(!1),pt=e.ref({}),Et=e.ref([]),mt=e.ref(null);async function Vt(){if(!(!n.add?.token||mt?.value.validate()))try{const N=n.add.api??`/api/table/${n.add.token}`,I=await fetch(N,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(pt.value)}),ee=await I.json().catch(()=>({})),ye=ee?.error||ee?.message,_e=Number(ee?.code)>=400;if(!I.ok||_e){he.notify({title:"Помилка",type:"error",message:ye||`Код помилки: ${ee?.code||I.status}`});return}const ve=ee?.id;if(!ve){he.notify({title:"Помилка",type:"error",message:"Обʼєкт створено, але в відповіді відсутній ID."});return}if(!n.options?.length&&n.data){const Ce=await fetch(`${n.api??`/api/suggest/${n.data}`}?val=${ve}`).then(u=>u.json());y.value=Ce[0],V.value.push(Ce[0]),s.value=ve}st.value=!1,he.notify({title:"Успіх",message:"Обʼєкт успішно створено."})}catch(N){he.notify({title:"Помилка",type:"error",message:N?.message||"Не вдалося створити обʼєкт."})}}async function ft(){if(!n.add)return null;const v=await fetch(`/api/template/form/${n.add.form}`).then(N=>N.json());return Et.value=v.schema,st.value=!0,null}function Bt(v,N=200){let I;return(...ee)=>{I&&clearTimeout(I),I=window.setTimeout(()=>v(...ee),N)}}const wn=Bt(async v=>{V.value=await Ae(v)},200);e.watch(x,v=>{n.data&&wn(v.trim())}),e.watch(()=>n.options,v=>{!n.data&&v?.length&&(V.value=[...v],nt())},{immediate:!0}),e.watch(()=>n.parent??n.parentValue,()=>{n.data&&M()});const lt=e.ref(!0);return e.watch(Ee,async()=>{if(n.data&&(lt.value||(o.value?(B.value=[],s.value=[],a("change",[])):(y.value=null,s.value=null,a("change",null))),await M(),n.auto===1&&Ee.value&&V.value.length>0)){const v=V.value[0];v&&J(v)}}),(v,N)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(he.VsModal),{visible:st.value,"onUpdate:visible":N[1]||(N[1]=I=>st.value=I),class:"z-[1000]",title:"Додати",buttonText:"Додати",onDone:Vt,teleport:v.teleport},{default:e.withCtx(()=>[e.createVNode(Je,{schema:Et.value,modelValue:pt.value,"onUpdate:modelValue":N[0]||(N[0]=I=>pt.value=I),ref_key:"addForm",ref:mt},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:N[5]||(N[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass])},[N[10]||(N[10]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),N[11]||(N[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":g.value,"aria-haspopup":"listbox",onKeydown:Re,onClick:we,"data-focus":g.value||E.value?"true":"false",ref_key:"triggerRef",ref:c},[e.createElementVNode("div",Fr,[o.value?(e.openBlock(),e.createElementBlock("div",Ir,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.value,I=>(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:I.id},[e.createElementVNode("div",Lr,[me(I)?(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:I?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ge(I)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(on),style:e.normalizeStyle(fe(I)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(re(I)),{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:P(I)},[A.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:H(I)},null,8,Or)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(I.text),1)],64))],8,Tr)]),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=>D(I.id),["stop"])},N[6]||(N[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,zr)]))),128)),e.createElementVNode("div",Rr,[!r.value&&v.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:k,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:B.value.length?" ":S.value,"onUpdate:modelValue":N[2]||(N[2]=I=>x.value=I),onFocus:Ze,onBlur:He,onKeydown:tt},null,40,jr)),[[e.vModelText,x.value]]):e.createCommentVNode("",!0)])])):!o.value&&j.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:j.value},[me(y.value)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block flex-shrink-0",style:e.normalizeStyle({backgroundColor:y.value?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ge(y.value)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(on),style:e.normalizeStyle(fe(y.value)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(re(y.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:H(y.value)},null,8,Ur)):(e.openBlock(),e.createElementBlock("span",Hr,e.toDisplayString(y.value?.text),1))],8,Pr)):e.createCommentVNode("",!0),o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",qr,[!r.value&&v.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:k,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:j.value?" ":S.value,"onUpdate:modelValue":N[3]||(N[3]=I=>x.value=I),onFocus:Ze,onBlur:He,onKeydown:tt},null,40,Kr)),[[e.vModelText,x.value]]):e.createCommentVNode("",!0)]))]),e.createElementVNode("div",Gr,[W.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(Xe,["stop"])},N[7]||(N[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,Yr)):e.createCommentVNode("",!0),N[9]||(N[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:N[4]||(N[4]=e.withModifiers(I=>Ve(),["stop"])),title:g.value?"Закрити список":"Відкрити список"},N[8]||(N[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,Wr)])],42,Ar),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[g.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},[T.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(T.value,(I,ee)=>(e.openBlock(),e.createElementBlock("div",{key:I.id,ref_for:!0,ref:ye=>h.value[ee]=ye,class:e.normalizeClass(["flex px-3 py-2 gap-2 cursor-pointer select-none text-gray-900",K(I.id)?"bg-[#2684ff] text-white":"bg-white hover:bg-[#deebff] hover:text-[#172b4d]",f.value===ee&&!K(I.id)?"bg-[#deebff] text-[#172b4d]":""]),"aria-disabled":K(I.id)?"true":"false",role:"option",tabindex:"-1",onClick:ye=>ue(I)},[me(I)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block flex-shrink-0",style:e.normalizeStyle({backgroundColor:I?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ge(I)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(on),style:e.normalizeStyle(fe(I)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(re(I)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",f.value===I.id?"text-white":"",(f.value===ee,"")])},[A.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:H(I)},null,8,Jr)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(I.text),1)],64))],2)],10,Zr))),128)):(e.openBlock(),e.createElementBlock("div",Xr," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),n.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:ft,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(Ke,{width:"16",height:"16"}),N[12]||(N[12]=e.createElementVNode("span",null,"Додати",-1))],8,Qr)):e.createCommentVNode("",!0)],512)],64))}}),[["__scopeId","data-v-6c691161"]]),es=["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}=De(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,es)),[[e.vModelText,a.value]])}}),ts={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}=De(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",[c.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",ts,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))}}),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",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};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:"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 os=ae(ns,[["render",as]]),rs={},ss={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 is(l,t){return e.openBlock(),e.createElementBlock("svg",ss,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 cs=ae(rs,[["render",is]]),ds={},us={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 ps(l,t){return e.openBlock(),e.createElementBlock("svg",us,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 ms=ae(ds,[["render",ps]]),fs={},hs={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 gs(l,t){return e.openBlock(),e.createElementBlock("svg",hs,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 $t=ae(fs,[["render",gs]]),ys={},ks={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function bs(l,t){return e.openBlock(),e.createElementBlock("svg",ks,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 ws=ae(ys,[["render",bs]]),xs={},_s={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 vs(l,t){return e.openBlock(),e.createElementBlock("svg",_s,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 Es=ae(xs,[["render",vs]]),Vs={class:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden flex flex-col"},Bs={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"},Cs={class:"relative w-full"},Ss={class:"flex flex-nowrap items-center justify-end gap-2 w-full overflow-x-auto"},Ns={class:"w-full overflow-x-auto"},$s={class:"w-full min-w-[640px] table-auto divide-y divide-gray-200"},Ms={class:"bg-gray-50"},Ds={class:"border-b border-gray-200"},As={class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 w-12 text-center"},Fs=["onClick"],Is={key:0,class:"text-gray-400"},Ls={key:0,colspan:"100%",class:"text-center"},Ts={class:"w-full"},Os={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},zs=["onDragstart","onDragover","onDrop"],Rs={class:"px-4 py-3 text-center align-middle"},js={class:"flex items-center justify-center"},Ps=["innerHTML"],Us={key:0,class:"flex items-center gap-3 text-sm text-gray-700"},Hs={key:0},qs=["src"],Ks={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},Gs={key:1,class:"flex items-center justify-center"},Ys={key:2,class:"text-sm font-medium text-gray-900"},Ws={class:"px-4 py-3 text-right whitespace-nowrap"},Zs={class:"flex items-center justify-end gap-2"},Js=["onClick"],Xs=["onClick"],Qs={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=M=>t.actions===void 0?!0:t.actions.includes(M),o=e.useModel(l,"modelValue"),r=e.ref({}),s=e.ref(""),i=e.ref(null),c=e.ref("asc"),d=e.computed(()=>{const M=o.value??[],R=s.value?M.filter(oe=>p.value?.some(be=>{const Ve=be.key||be.name;if(!Ve)return!1;const we=oe[Ve];return we?Array.isArray(we)?we.join(", ").toLowerCase().includes(s.value.toLowerCase()):String(we).toLowerCase().includes(s.value.toLowerCase()):!1})):M;if(!i.value)return R;const q=i.value,le=[...R].sort((oe,be)=>{const Ve=Ie(oe?.[q]),we=Ie(be?.[q]);return typeof Ve=="number"&&typeof we=="number"?Ve-we:String(Ve).localeCompare(String(we))});return c.value==="asc"?le:le.reverse()}),p=e.computed(()=>(t.colModel??[]).filter(M=>!M.tableHidden)),g=e.ref(null),E=e.ref(null),y=e.ref(null),V=M=>{g.value=M},f=M=>{E.value=M},h=M=>{if(g.value===null||g.value===M){g.value=null,E.value=null;return}const R=[...o.value],[q]=R.splice(g.value,1);R.splice(M,0,q),o.value=R,g.value=null,E.value=null},x=()=>{y.value&&y.value.click()},k=M=>{const R=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],q=M.toLowerCase();return R.some(le=>q.endsWith(le))},w=M=>{const q=M.target.files?.[0];if(!q)return;const le=new FileReader;le.onload=oe=>{try{const be=oe.target?.result;if(typeof be=="string"){const Ve=JSON.parse(be);Array.isArray(Ve)&&o.value.push(...Ve)}}catch(be){console.error("Error parsing file:",be)}},le.readAsText(q)},b=()=>{const M=JSON.stringify(o.value,null,2),R=new Blob([M],{type:"application/json"}),q=URL.createObjectURL(R),le=document.createElement("a");le.href=q,le.download="data.json",le.click(),URL.revokeObjectURL(q)},B=new Set(["autocomplete","select","radio","checkbox","combobox"]),$=new Map,S=(M,R)=>{const q=`/api/suggest/${M}`,le=q.includes("?")?"&":"?",oe=R?`&val=${R}`:"";return`${q}${le}json=1${oe}`},j=M=>M==null||M===""?null:typeof M=="object"?M?.id!==void 0&&M.id!==null&&M.id!==""?M.id:null:M,W=M=>{const R=new Set;return Array.isArray(o.value)&&o.value.forEach(q=>{const le=q?.[M];if(le==null||le==="")return;if(Array.isArray(le)){le.forEach(be=>{const Ve=j(be);Ve!==null&&R.add(Ve)});return}const oe=j(le);oe!==null&&R.add(oe)}),R},K=async()=>{if(!t.colModel?.length)return;const M=t.colModel.filter(R=>R.data&&B.has(R.type?.toLowerCase()||""));M.length&&await Promise.all(M.map(async R=>{const q=R.key||R.name;if(!q)return;const le=W(q),oe=Array.from(le).map(we=>String(we)).sort(),be=oe.join(",");if(!oe.length||$.get(q)===be)return;$.set(q,be);const Ve=oe.map(encodeURIComponent).join(",");try{const Xe=await(await fetch(S(R.data,Ve))).json();r.value[q]=Xe?.data??Xe}catch(we){console.error("Failed to fetch column values",we)}}))};e.watch([()=>t.colModel,()=>o.value],()=>{K()},{immediate:!0,deep:!0});const T=e.ref(""),z=e.ref(!1);let L="edit",Z=0;const F=M=>(M?.format||M?.type||"").toString().toLowerCase(),A=e.computed(()=>t.colModel?.filter(M=>F(M)!=="slot").map(M=>{const{slot:R,...q}=M;return q})??[]),H=e.ref({}),P=e.ref({}),pe=M=>typeof M!="string"?!1:!!n[M],ke=(M,R)=>R?R.split(".").reduce((q,le)=>q==null?q:q[le.trim()],M):M,Te=(M,R)=>typeof M!="string"?"":M.replace(/{{\s*([^}]+)\s*}}/g,(q,le)=>{const oe=ke(R,le.trim());return oe??""}),Ie=M=>{if(M==null||M==="")return"";if(typeof M=="number")return M;if(typeof M=="boolean")return M?1:0;if(typeof M=="string")return M.toLowerCase();if(Array.isArray(M))return M.map(R=>Ie(R)).join(", ");if(typeof M=="object"){if(M.text!==void 0)return String(M.text).toLowerCase();if(M.label!==void 0)return String(M.label).toLowerCase();if(M.id!==void 0)return String(M.id).toLowerCase()}return String(M).toLowerCase()},Y=M=>{const R=M.key||M.name;if(R){if(i.value===R){c.value=c.value==="asc"?"desc":"asc";return}i.value=R,c.value="asc"}};async function re(){T.value="Додати",z.value=!0,L="add",H.value={}}function me(M,R){if(!M?.length)return null;const q=typeof R=="object"?R?.id:R;return q==null||q===""?null:M.find(le=>le?.id?.toString()===q.toString())?.text??null}function fe(M){return M==null||M===""?"-":Array.isArray(M)?M.map(R=>typeof R=="object"?R?.text??R?.id??"-":R).join(", "):typeof M=="object"?M?.text??M?.id??"-":M}function ge(M,R){const q=R.key||R.name,le=M?.[q],oe=r.value[q];if(!le)return"-";if(Array.isArray(le)){const Ve=le.map(we=>me(oe,we)).filter(Boolean);return Ve.length?Ve.join(", "):fe(le)}const be=me(oe,le);return be||fe(le)}async function O(M,R){T.value="Редагувати",z.value=!0,L="edit",Z=R,H.value={...M}}function ne(){const M=P.value.validate();if(M){he.notify({type:"warning",title:"Помилка валідації",message:Object.entries(M).map(([R,q])=>`${R}: ${q}`).join(`
|
|
2
|
+
`)});return}L==="add"?Array.isArray(o.value)?o.value=[...o.value,H.value]:o.value=[H.value]:o.value=o.value.map((R,q)=>q===Z?H.value:R),z.value=!1}function Ee(M){o.value=o.value.filter((R,q)=>q!==M)}function Ae(){z.value=!1}return(M,R)=>(e.openBlock(),e.createElementBlock("div",Vs,[e.createElementVNode("div",Bs,[e.createElementVNode("div",Cs,[e.createVNode(os,{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":R[0]||(R[0]=q=>s.value=q),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",Ss,[a("import")?(e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"fileInput",ref:y,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(cs,{class:"text-gray-700",width:"16",height:"16"}),R[4]||(R[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(ms,{class:"text-gray-700",width:"16",height:"16"}),R[5]||(R[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(Ke,{class:"text-white"}),R[6]||(R[6]=e.createTextVNode(" Додати ",-1))])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Ns,[e.createElementVNode("table",$s,[e.createElementVNode("thead",Ms,[e.createElementVNode("tr",Ds,[e.createElementVNode("th",As,[e.createVNode($t,{width:"20",height:"20",class:"mx-auto text-gray-400"})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,q=>(e.openBlock(),e.createElementBlock("th",{key:q.key,class:"px-4 py-3 text-left text-xs font-semibold text-gray-900"},[e.createElementVNode("button",{type:"button",onClick:le=>Y(q),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(q.ua||q.label),1),i.value===(q.key||q.name)?(e.openBlock(),e.createElementBlock("span",Is,e.toDisplayString(c.value==="asc"?"▲":"▼"),1)):e.createCommentVNode("",!0)],8,Fs)]))),128)),R[7]||(R[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",Ts,[e.createElementVNode("div",Os,[e.createVNode(ws,{class:"w-48 mx-auto"}),R[8]||(R[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,(q,le)=>(e.openBlock(),e.createElementBlock("tr",{key:q.id,class:e.normalizeClass(["border-b transition-colors hover:bg-gray-50 cursor-move text-sm text-gray-700",{"opacity-50":g.value===le,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":E.value===le}]),draggable:"true",onDragstart:oe=>V(le),onDragover:e.withModifiers(oe=>f(le),["prevent"]),onDrop:oe=>h(le)},[e.createElementVNode("td",Rs,[e.createElementVNode("div",js,[e.createVNode($t,{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"},[F(oe)==="slot"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[pe(oe.slot)?e.renderSlot(M.$slots,oe.slot,{key:0,row:q,value:q[oe.key],column:oe}):(e.openBlock(),e.createElementBlock("div",{key:1,class:"text-sm text-gray-900",innerHTML:Te(oe.slot,q)},null,8,Ps))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[F(oe)==="file"?(e.openBlock(),e.createElementBlock("div",Us,[k(ge(q,oe))?(e.openBlock(),e.createElementBlock("div",Hs,[e.createElementVNode("img",{src:ge(q,oe),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,qs)])):(e.openBlock(),e.createElementBlock("div",Ks,[e.createVNode(Bn,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):F(oe)==="color"?(e.openBlock(),e.createElementBlock("div",Gs,[e.createElementVNode("span",{class:"inline-flex h-6 w-6 rounded border border-gray-200",style:e.normalizeStyle({backgroundColor:ge(q,oe)||"#ffffff"})},null,4)])):(e.openBlock(),e.createElementBlock("div",Ys,e.toDisplayString(ge(q,oe)),1))],64))]))),128)),e.createElementVNode("td",Ws,[e.createElementVNode("div",Zs,[e.createElementVNode("button",{onClick:oe=>O(q,le),class:"p-1.5 text-gray-600 hover:text-blue-600 hover:bg-blue-50 rounded transition-colors"},[e.createVNode(Es,{width:"16",height:"16"})],8,Js),e.createElementVNode("button",{onClick:oe=>Ee(le),class:"p-1.5 text-gray-600 hover:text-red-600 hover:bg-red-50 rounded transition-colors"},[e.createVNode(ct,{width:"16",height:"16"})],8,Xs)])])],42,zs))),128))],2)])]),e.createVNode(e.unref(he.VsModal),{visible:z.value,title:T.value,size:"lg",onClose:Ae,teleport:"#modal"},{default:e.withCtx(()=>[e.createVNode(Je,{schema:A.value,values:H.value,"onUpdate:values":R[1]||(R[1]=q=>H.value=q),form:P.value,"onUpdate:form":R[2]||(R[2]=q=>P.value=q)},null,8,["schema","values","form"]),e.createElementVNode("div",Qs,[e.createElementVNode("button",{type:"button",onClick:R[3]||(R[3]=q=>z.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:ne,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"])]))}}),ei={},ti={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 ni(l,t){return e.openBlock(),e.createElementBlock("svg",ti,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 li=ae(ei,[["render",ni]]),ai={},oi={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 ri(l,t){return e.openBlock(),e.createElementBlock("svg",oi,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 si=ae(ai,[["render",ri]]),ii={},ci={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 di(l,t){return e.openBlock(),e.createElementBlock("svg",ci,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 ui=ae(ii,[["render",di]]),pi={},mi={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 fi(l,t){return e.openBlock(),e.createElementBlock("svg",mi,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 hi=ae(pi,[["render",fi]]),gi={},yi={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 ki(l,t){return e.openBlock(),e.createElementBlock("svg",yi,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 bi=ae(gi,[["render",ki]]),wi={class:"bg-white/30 p-1 rounded-md shadow w-fit"},xi={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 p=c.url;return Object.entries(d).forEach(([g,E])=>{p=p.replace(new RegExp(g,"gi"),String(E))}),p}return(c,d)=>(e.openBlock(),e.createElementBlock("div",wi,[e.createElementVNode("div",xi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.basemaps,(p,g)=>(e.openBlock(),e.createElementBlock("div",{key:g,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":a.value===g}]),onClick:E=>r(g),title:p.name||g,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:i(p),alt:"",class:"w-10 h-10 object-cover"},null,8,vi)],10,_i))),128))])]))}}),Vi={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},Bi={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"},Ci=["onClick"],Si={class:"relative flex-1 min-w-[140px]"},Ni=["placeholder"],$i="https://data.softpro.ua/api-user/gis-url-proxy",Mi="https://geo.rv.ua/api-user/dzk.api",Di=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(B=>o.includes(B));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 g(b){i.value=b}function E(b){if(!d.value)return;const B=p.value;B&&!B.contains(b.target)&&(d.value=!1)}e.onMounted(()=>{window.addEventListener("click",E,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",E,!0)});function y(b){return b==="xy"?"Координати":b==="parcel"?"Кадастр":"Адреси"}function V(b){const B=b.replace(/[,]+/g," ").trim();if(!B)return null;const $=B.split(/\s+/).filter(Boolean);if($.length<2)return null;const S=$.slice(0,2).map(Number);if(!S.every(Z=>Number.isFinite(Z)))return null;const[j,W]=S;let K=j,T=W;const z=Z=>Math.abs(Z)<=90,L=Z=>Math.abs(Z)<=180;if(!z(K)||!L(T))if(z(T)&&L(K))K=W,T=j;else return null;return{lat:K,lng:T}}function f(b){return(b?.items||[]).map(($,S)=>({id:String($?.id??S),title:$?.title||$?.address?.label||"Знайдений обʼєкт",lat:Number($?.position?.lat),lng:Number($?.position?.lng)})).filter($=>Number.isFinite($.lat)&&Number.isFinite($.lng))}function h(b){const B=b?.result||b?.data||b;if(!B)return[];const $=B.geom_centroid;if(!$||!Array.isArray($.coordinates))return[];const[S,j]=$.coordinates;return!Number.isFinite(j)||!Number.isFinite(S)?[]:[{id:"parcel",title:B.cadnum||B.cad_num||"Земельна ділянка",lat:j,lng:S}]}function x(b){const $=b.replace(/\s+/g,"").split(":");if($.length!==4)return!1;const S=[10,2,3,4];return $.every((j,W)=>j.length===S[W]&&/^\d+$/.test(j))}function k(b){a("goToCoordinates",[b.lat,b.lng])}async function w(){const b=c.value.trim();if(b){if(i.value==="xy"){const B=V(b);if(!B){he.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}k(B),c.value="";return}try{const B=new URL(i.value==="here"?$i:Mi);if(i.value==="here")B.searchParams.set("searchtext",b);else{if(!x(b)){he.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}B.searchParams.set("cad_num",b)}const $=await fetch(B.toString());if(!$.ok)throw new Error(`HTTP ${$.status}`);const S=await $.json(),j=i.value==="here"?f(S):h(S);if(!j.length)he.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const W=j[0];k(W),c.value=""}}catch(B){const $=B?.message||"Помилка пошуку";he.notify({type:"error",title:"Пошук",message:$})}}}return(b,B)=>(e.openBlock(),e.createElementBlock("div",Vi,[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:B[0]||(B[0]=$=>d.value=!d.value)},[e.createElementVNode("span",null,e.toDisplayString(y(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"},B[2]||(B[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",Bi,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,$=>(e.openBlock(),e.createElementBlock("li",{key:$,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:S=>g($)},e.toDisplayString(y($)),9,Ci))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",Si,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":B[1]||(B[1]=$=>c.value=$),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,Ni),[[e.vModelText,c.value,void 0,{trim:!0}]]),B[3]||(B[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-b5059a01"]]),Ai={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},Fi={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},Ii={class:"flex items-center gap-1"},Li=["disabled"],Ti=["disabled"],Oi=["disabled"],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={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"},Ki={class:"space-y-0.5"},Gi={class:"text-gray-500"},Yi={class:"text-gray-900 text-right break-all"},Wi={class:"absolute left-4 bottom-[36px] z-[1000]"},Zi={class:"flex flex-col gap-2"},Ji={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]"},Xi={class:"flex flex-col gap-1"},Qi=["checked","disabled","onChange"],ec={class:"text-gray-700 text-xs font-medium"},tc={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"},nc={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full px-2 pb-1"},lc={class:"mr-auto flex items-center gap-2 min-w-0 relative"},ac={class:"shrink-0"},oc={class:"font-bold"},rc={class:"flex items-center"},sc={class:"text-xs mr-2"},ic={key:0,class:"text-xs mr-2"},cc={key:1,class:"text-xs mr-2"},dc=["disabled"],uc=["disabled"],Mt="__vs_form_maplibre_loader__",sn="__vs_form_maplibre_scripts__",Dt="vs-global-bounds-src",At="vs-global-bounds-line",In=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(),g=p?.appContext?.config?.globalProperties?.$settings??{},E=g?.map??{},y=p?.vnode?.props??{};function V(u){return Object.prototype.hasOwnProperty.call(y,u)||Object.prototype.hasOwnProperty.call(y,u.replace(/[A-Z]/g,m=>`-${m.toLowerCase()}`))}const f=Array.isArray(E.center)&&E.center.length===2?E.center:Array.isArray(g.center)&&g.center.length===2?g.center:[30,50];console.log(E);const h=typeof E.zoom=="number"?E.zoom:typeof g.zoom=="number"?g.zoom:typeof g.defaultZoom=="number"?g.defaultZoom:10,x=e.computed(()=>V("center")?n.center:E.center??n.center),k=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??[]),B=e.computed(()=>V("bounds")?n.bounds:E.bounds??n.bounds),$=e.ref(Array.isArray(x.value)&&x.value.length===2?[...x.value]:f),S=e.ref(typeof k.value=="number"?k.value:h),j=e.ref(n.modelValue),W=e.ref(null),K=e.ref([]);let T=!1;const z=e.reactive({}),L=e.ref([]),Z=e.computed(()=>L.value.map(u=>z[u]).filter(Boolean)),F=e.ref(null),A=e.computed(()=>F.value?.entries??[]),H=e.computed(()=>{if(F.value)return{left:`${F.value.point.x+12}px`,top:`${F.value.point.y+12}px`}}),P=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 ke(){const u=Array.isArray(E.basemaps)&&E.basemaps.length?E.basemaps:g.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 Te=ke(),Ie=Object.keys(Te),Y=e.ref(Ie.length?Ie[0]:"");async function re(){if(typeof window>"u")return null;const u=window;if(u[Mt])return u[Mt];u[sn]=u[sn]||{};const m=u[sn],_=X=>{if(Array.from(document.styleSheets).some(Fe=>Fe?.href?.includes(X)))return;const Be=document.createElement("link");Be.rel="stylesheet",Be.href=X,document.head.appendChild(Be)},C=X=>(m[X]||(m[X]=new Promise((ie,Be)=>{const Fe=Array.from(document.scripts).find(je=>je.src===X);if(Fe){Fe.addEventListener("load",()=>ie(),{once:!0}),Fe.addEventListener("error",Be,{once:!0}),X.includes("maplibre")&&window.maplibregl&&ie(),X.includes("mapbox-gl-draw")&&window.MapboxDraw&&ie();return}const Me=document.createElement("script");Me.src=X,Me.async=!1,Me.onload=()=>ie(),Me.onerror=Be,document.head.appendChild(Me)})),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[Mt],X});return u[Mt]=te,te}function me(u){return{version:8,sources:{rasterSource:{type:"raster",tiles:[u],tileSize:256}},layers:[{id:"rasterLayer",type:"raster",source:"rasterSource"}]}}let fe=null,ge=null,O=null,ne=null,Ee=null,Ae=null,M=!1,R=!1;function q(){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 le=[{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=Y.value;return!u||!Te[u]?.url?"":Te[u].url}function be(u,m){return u?.id?String(u.id):u?.url?`${u.url}-${m}`:`layer-${m}`}function Ve(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 we(u){u&&F.value?.layerId!==u||(F.value=null)}function Xe(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 D(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 G(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 J(u){if(!O)return;u.handlers.forEach(_=>{try{O.off(_.type,_.layerId,_.handler)}catch{}}),u.handlers=[],[...u.layerIds,...u.boundsIds].forEach(_=>{O.getLayer(_)&&O.removeLayer(_)}),O.getSource(u.sourceId)&&O.removeSource(u.sourceId);const m=`vs-ov-bounds-src-${u.id}`;O.getSource(m)&&O.removeSource(m),we(u.id)}function ue(u,m){if(!O)return[];const _=`vs-ov-bounds-src-${m}`,C=`vs-ov-bounds-line-${m}`,U=u.bounds??B.value??K.value,te=D(U);if(!te.length)return[];const X={type:"FeatureCollection",features:te.map(ie=>({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:ie}}))};return O.getSource(_)&&O.removeSource(_),O.addSource(_,{type:"geojson",data:X}),O.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 xe(u){if(!O)return;J(u);const m=u.config,_=Ve(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;O.addSource(u.sourceId,{type:"vector",tiles:[_]});const Be=String(m.style?.type??"polygon").toLowerCase(),Fe=G(m),Me=m.style?.opacity??.5;if(Be==="point"){const je=`vs-ov-point-${u.id}`;O.addLayer({id:je,type:"circle",source:u.sourceId,"source-layer":ie,paint:{"circle-color":Fe,"circle-radius":5,"circle-opacity":Me}}),C.push(je)}else if(Be==="polyline"||Be==="line"){const je=`vs-ov-line-${u.id}`;O.addLayer({id:je,type:"line",source:u.sourceId,"source-layer":ie,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":Fe,"line-width":m.style?.width??2,"line-opacity":Me}}),C.push(je)}else{const je=`vs-ov-fill-${u.id}`,Ct=`vs-ov-border-${u.id}`;O.addLayer({id:je,type:"fill",source:u.sourceId,"source-layer":ie,paint:{"fill-color":Fe,"fill-opacity":Me}}),O.addLayer({id:Ct,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":Me}}),C.push(je,Ct)}}else{O.addSource(u.sourceId,{type:"raster",tiles:[_],tileSize:256});const ie=`vs-ov-raster-${u.id}`;O.addLayer({id:ie,type:"raster",source:u.sourceId,paint:{"raster-opacity":m.style?.opacity??1}}),C.push(ie)}C.forEach(ie=>{const Be=Me=>{if(!Me?.features?.length){we(u.id);return}const je=Me.features[0]?.properties??{},Ct=Xe(u.config,je);if(!Ct.length){we(u.id);return}F.value={layerId:u.id,entries:Ct,point:{x:Me.point.x,y:Me.point.y}}},Fe=()=>we(u.id);O.on("mousemove",ie,Be),O.on("mouseleave",ie,Fe),U.push({layerId:ie,type:"mousemove",handler:Be},{layerId:ie,type:"mouseleave",handler:Fe})}),u.layerIds=C,u.boundsIds=ue(u.config,u.id),u.handlers=U;const X=u.visible?"visible":"none";[...u.layerIds,...u.boundsIds].forEach(ie=>{O.getLayer(ie)&&O.setLayoutProperty(ie,"visibility",X)})}function Ue(){if(!O)return;const m={type:"FeatureCollection",features:D(B.value??K.value).map(_=>({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:_}}))};O.getSource(Dt)?O.getSource(Dt).setData(m):O.addSource(Dt,{type:"geojson",data:m}),O.getLayer(At)||O.addLayer({id:At,type:"line",source:Dt,paint:{"line-color":"#2563eb","line-width":2,"line-opacity":.8,"line-dasharray":[2,2]}})}function ze(u){if(!O||o.value)return;const m=z[u];if(!m)return;m.visible=!m.visible;const _=m.visible?"visible":"none";[...m.layerIds,...m.boundsIds].forEach(C=>{O.getLayer(C)&&O.setLayoutProperty(C,"visibility",_)}),Re(),m.visible||we(u)}function Re(){if(!O)return;const u=[],m=[],_=[],C=[];L.value.forEach(X=>{const ie=z[X];if(!ie)return;const Be=String(ie.config?.url??""),Fe=/\.v(?:m)?t(?:\?|$)/i.test(Be),Me=/\.png(?:\?|$)/i.test(Be);Fe?_.push(...ie.layerIds):Me?u.push(...ie.layerIds):m.push(...ie.layerIds),C.push(...ie.boundsIds)}),[...u,...m,..._,...C].forEach(X=>{O.getLayer(X)&&O.moveLayer(X)}),O.getLayer(At)&&O.moveLayer(At),(O.getStyle?.()?.layers??[]).map(X=>String(X?.id??"")).filter(X=>X.startsWith("gl-draw-")).forEach(X=>{O.getLayer(X)&&O.moveLayer(X)})}function tt(u){if(!Te[u]||(Y.value=u,!O))return;const m=oe();if(!m)return;const _=O.getCenter?.(),C=O.getZoom?.(),U=ne?.getAll?.();O.setStyle(me(m)),O.once("style.load",()=>{if(O&&(_&&Number.isFinite(C)&&O.jumpTo({center:[_.lng,_.lat],zoom:C}),Ue(),L.value.forEach(te=>{const X=z[te];X&&xe(X)}),Re(),U?.features?.length&&ne))try{U.features.forEach(te=>ne.add(te)),i.value=U.features.length}catch{i.value=0}})}function Ze(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 He(u){return{type:"Feature",properties:{},geometry:u}}function qe(u){if(!u)return null;try{return JSON.parse(JSON.stringify(u))}catch{return null}}function rt(u){if(!u)return"__null__";try{return JSON.stringify(u)}catch{return"__invalid__"}}function Gt(u){const m=pt(u);if(!m)return null;const[[_,C],[U,te]]=m;return{lat:(C+te)/2,lng:(_+U)/2}}function vt(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 Yt(u){if(!u?.type||!u?.coordinates)return null;if(u.type==="Polygon"){const m=u.coordinates?.[0];return Array.isArray(m)?vt(m):null}return u.type==="MultiPolygon"?u.coordinates.reduce((m,_)=>{const C=_?.[0];return Array.isArray(C)?m+vt(C):m},0):null}function nt(u){if(!u){d.value=null;return}const m=Gt(u);if(!m){d.value=null;return}d.value={type:String(u.type??"Feature"),center:m,areaKm2:Yt(u)}}function st(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 pt(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]),Be=Number(X[1]);m=Math.min(m,ie),_=Math.min(_,Be),C=Math.max(C,ie),U=Math.max(U,Be);return}X.forEach(te)}};return te(u.coordinates),!Number.isFinite(m)||!Number.isFinite(_)?null:[[m,_],[C,U]]}function Et(u){if(!O||!u)return;const m=pt(u);if(!m)return;const[[_,C],[U,te]]=m;if(_===U&&C===te){O.easeTo({center:[_,C],zoom:Math.max(S.value,14)});return}O.fitBounds(m,{padding:30,duration:250,maxZoom:18})}function mt(){if(!ne){i.value=0;return}const u=ne.getAll();i.value=u?.features?.length??0}function Vt(){if(!ne)return;const u=ne.getAll();if(i.value=u?.features?.length??0,!u?.features?.length){Ee=null,d.value=null,T||(Ae="__null__",a("update:modelValue",null));return}const m=qe(u.features[u.features.length-1]?.geometry??null);Ee=m,nt(m),T||(Ae=rt(m),a("update:modelValue",m))}function ft(){if(!ne)return;(ne.getAll()?.features||[]).forEach(m=>ne.delete(m.id)),mt()}function Bt(u){if(!ne)return;const m=Ze(u);if(T=!0,ft(),m)try{ne.add(He(m))}catch{}T=!1,Ee=qe(m),mt(),nt(m),m&&(Et(m),o.value||N())}function wn(){if(ne){if(T=!0,ft(),Ee)try{ne.add(He(Ee))}catch{}T=!1,mt(),nt(Ee)}}function lt(){if(ne){try{ne.changeMode("simple_select",{featureIds:[]})}catch{}c.value=""}}function v(u){if(o.value||!ne)return;R=!0,lt(),c.value=u;const m=u==="marker"?"draw_point":u==="polyline"?"draw_line_string":u==="rectangle"?"draw_rectangle":"draw_polygon";T=!0,ft(),T=!1;try{ne.changeMode(m)}catch{c.value=""}finally{requestAnimationFrame(()=>{R=!1})}}function N(){if(o.value||!ne)return;const u=ne.getAll();if(u?.features?.length)try{ne.changeMode("direct_select",{featureId:u.features[0].id}),c.value="edit"}catch{c.value=""}}function I(){o.value||!ne||(lt(),ft(),Ae="__null__",d.value=null,a("update:modelValue",null))}function ee(){o.value||!Ee||Et(Ee)}function ye(u){O&&O.easeTo({center:[u[1],u[0]],zoom:13,duration:250})}function _e(){o.value||W.value?.click()}function ve(u){if(o.value||!ne)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=Ze(U);if(!te)return;Bt(te)}finally{m.value=""}},C.readAsText(_)}function Ce(){if(o.value||!ne)return;const u=ne.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,ge=u.MapboxDraw;const m=oe();m&&(O=new fe.Map({container:s.value,style:me(m),center:[$.value[0],$.value[1]],zoom:S.value,attributionControl:!1}),O.addControl(new fe.NavigationControl({showCompass:!0}),"bottom-right"),O.on("load",()=>{if(!(!ge||!O)){if(ne=new ge({displayControlsDefault:!1,modes:{...ge.modes,draw_rectangle:q()},controls:{point:!1,line_string:!1,polygon:!1,trash:!1},styles:le}),O.addControl(ne),O.on("draw.create",()=>{if(!ne)return;const _=ne.getAll();if(_.features.length>1){const C=_.features[_.features.length-1];T=!0,_.features.slice(0,-1).forEach(U=>ne.delete(U.id)),T=!1,C&&(T=!0,ne.add(C),T=!1)}Vt(),N()}),O.on("draw.update",_=>{if(!M){if(_?.action==="move"){if(M=!0,wn(),M=!1,c.value==="edit"){const C=ne?.getAll?.()?.features?.[0];if(C?.id)try{ne.changeMode("direct_select",{featureId:C.id})}catch{c.value=""}}return}Vt()}}),O.on("draw.delete",()=>{c.value==="marker"||c.value==="polyline"||c.value==="polygon"||c.value==="rectangle"||(Vt(),c.value="",lt())}),O.on("draw.selectionchange",()=>{if(!(!ne||M)&&c.value!=="edit"&&!(c.value==="marker"||c.value==="polyline"||c.value==="polygon"||c.value==="rectangle")){if(!o.value&&i.value>0){N();return}try{ne.changeMode("simple_select",{featureIds:[]})}catch{}}}),j.value!==void 0){const _=j.value;j.value=void 0,requestAnimationFrame(()=>{ne&&Bt(_)})}Ue(),L.value.forEach(_=>{const C=z[_];C&&xe(C)}),Re()}}),O.on("zoomend",()=>{O&&(S.value=O.getZoom())}))}),e.onUnmounted(()=>{Object.values(z).forEach(u=>{O&&J(u)}),we(),O?.remove&&O.remove(),O=null,ne=null}),e.watch(()=>n.modelValue,u=>{if(!ne){j.value=u;return}const m=Ze(u),_=rt(m);if(Ae&&_===Ae){Ae=null;return}Ae=null,Bt(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=be(U,te);_.push(X),C.add(X);const ie={...U,id:X},Be=z[X],Fe=Be?.visible??!!ie.visible;Be&&O&&J(Be),z[X]={id:X,config:ie,visible:Fe,sourceId:`vs-ov-src-${X}`,layerIds:[],boundsIds:[],handlers:[]}}),Object.keys(z).forEach(U=>{if(C.has(U))return;const te=z[U];te&&O&&J(te),delete z[U]}),L.value=_,O&&(L.value.forEach(U=>{const te=z[U];te&&xe(te)}),Re())},{immediate:!0,deep:!0}),e.watch(()=>B.value,()=>{O&&(Ue(),L.value.forEach(u=>{const m=z[u];m&&xe(m)}),Re())},{deep:!0}),e.watch(()=>w.value,async u=>{if(K.value=[],!u){O&&(Ue(),L.value.forEach(m=>{const _=z[m];_&&xe(_)}),Re());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&&(K.value=C)}catch(m){console.error("Failed to fetch KATOTTG bounds",m)}finally{if(!O)return;Ue(),L.value.forEach(m=>{const _=z[m];_&&xe(_)}),Re()}},{immediate:!0}),e.watch(()=>x.value,u=>{if(!Array.isArray(u)||u.length!==2)return;const m=[Number(u[0]),Number(u[1])];if(st($.value,m)||($.value=[...m],!O))return;const _=O.getCenter?.();_&&st([_.lng,_.lat],$.value)||O.easeTo({center:[$.value[0],$.value[1]]})},{deep:!0}),e.watch(()=>k.value,u=>{typeof u=="number"&&(S.value=u,O&&O.setZoom(u))}),e.watch(o,u=>{u&<()}),e.watch(i,u=>{if(u>0){o.value||N();return}R||lt()}),e.watch(r,()=>{setTimeout(()=>{O?.resize&&O.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),P.value.search||P.value.import||P.value.export?(e.openBlock(),e.createElementBlock("div",Ai,[P.value.search?(e.openBlock(),e.createBlock(Di,{key:0,onGoToCoordinates:ye})):e.createCommentVNode("",!0),P.value.import||P.value.export?(e.openBlock(),e.createElementBlock("div",Fi,[e.createElementVNode("div",Ii,[P.value.import?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:_e,disabled:o.value}," Import ",8,Li)):e.createCommentVNode("",!0),P.value.export?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:Ce,disabled:o.value||i.value===0}," Export ",8,Ti)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:W,type:"file",onChange:ve,accept:".json,.geojson",class:"hidden",disabled:o.value},null,40,Oi)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",zi,[e.createElementVNode("div",Ri,[P.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(li)],10,ji)):e.createCommentVNode("",!0),P.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(si)],10,Pi)):e.createCommentVNode("",!0),P.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(ui)],10,Ui)):e.createCommentVNode("",!0),P.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(hi)],10,Hi)):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(bi,{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(H.value)},[e.createElementVNode("div",qi,[e.createElementVNode("dl",Ki,[(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",Gi,e.toDisplayString(_.key),1),e.createElementVNode("dd",Yi,e.toDisplayString(_.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",Wi,[e.createElementVNode("div",Zi,[e.createVNode(Ei,{basemaps:e.unref(Te),onOnLayerChange:tt},null,8,["basemaps"]),Z.value.length?(e.openBlock(),e.createElementBlock("div",Ji,[m[5]||(m[5]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),e.createElementVNode("div",Xi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Z.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=>ze(_.id)},null,40,Qi),e.createElementVNode("span",ec,e.toDisplayString(_.config.title||_.config.name||_.id),1)]))),128))])])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",tc,[d.value?(e.openBlock(),e.createElementBlock("div",nc,[e.createElementVNode("div",lc,[e.createElementVNode("div",ac,[m[6]||(m[6]=e.createTextVNode(" Type: ",-1)),e.createElementVNode("span",oc,e.toDisplayString(d.value.type),1)])]),e.createElementVNode("div",rc,[e.createElementVNode("div",sc,[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",ic,[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",cc,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,dc),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:I,disabled:o.value},[e.createVNode(ct,{class:"w-3 h-3"})],8,uc)])])):e.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-3b015982"]]),pc=["data-focus"],mc={class:"flex items-center"},fc={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},hc=["onClick","aria-label"],gc={key:0,class:"absolute text-gray-500 truncate pl-2"},yc={class:"flex-1 min-w-[2px]"},kc=["placeholder"],bc={class:"flex items-center shrink-0"},wc=["disabled"],Ln=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;De(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…"),g=e.computed(()=>d.value?.length===0&&c.value===""),E=e.computed(()=>!n.disabled&&d.value?.length>0),y=e.computed(()=>n.disabled),V=async()=>{y.value||await e.nextTick(()=>s.value?.focus())},f=$=>{const S=$.trim();S!==""&&(!d.value||!Array.isArray(d.value)?d.value=[S]:n.unique?d.value.includes(S)||(d.value=[...d.value,S]):d.value=[...d.value,S],c.value="")},h=()=>{const $=c.value;$.trim()!==""&&f($),c.value=""},x=$=>{const S=d.value.slice();S.splice($,1),a("update:modelValue",S)},k=()=>{a("update:modelValue",[])},w=()=>{y.value||(i.value=!0)},b=()=>{i.value=!1,!y.value&&h()},B=$=>{const{key:S}=$;S==="Enter"?($.preventDefault(),h()):S==="Backspace"&&c.value===""&&d.value.length>0&&x(d.value.length-1)};return($,S)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:S[1]||(S[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":"",y.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,(j,W)=>(e.openBlock(),e.createElementBlock("div",{key:W,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",mc,[e.createElementVNode("div",fc,e.toDisplayString(j),1)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:e.withModifiers(K=>x(W),["stop"]),"aria-label":`Remove ${j}`},S[2]||(S[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,hc)]))),128)),g.value?(e.openBlock(),e.createElementBlock("div",gc,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",yc,[y.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":S[0]||(S[0]=j=>c.value=j),onFocus:w,onBlur:b,onKeydown:B,placeholder:d.value&&d.value.length?"":void 0},null,40,kc)),[[e.vModelText,c.value]])])],512),e.createElementVNode("div",bc,[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:y.value,onClick:e.withModifiers(k,["stop"])},S[3]||(S[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,wc)):e.createCommentVNode("",!0)])],10,pc)],2)],512))}}),xc={class:"relative flex gap-1 bg-white w-full"},_c=["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",xc,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:s.disabled,placeholder:s.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,_c),[[e.vModelText,a.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:r}," Gen ")]))}}),[["__scopeId","data-v-b0eba370"]]),vc={class:"relative flex gap-1 bg-white w-full"},Ec=["disabled","placeholder"],Vc=["disabled"],Bc={key:0},Cc={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 g=await(await fetch(d)).text();n.value=g}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",vc,[e.withDirectives(e.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":p[0]||(p[0]=g=>n.value=g),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,Ec),[[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||d.disabled||!r.value,onClick:i},[a.value?(e.openBlock(),e.createElementBlock("span",Cc,"...")):(e.openBlock(),e.createElementBlock("span",Bc,"Gen"))],8,Vc)]))}}),[["__scopeId","data-v-6ee5237d"]]),Sc={class:"w-full"},Nc={ref:"sortableContainer",class:"flex flex-col gap-1"},$c=["onDragstart","onDrop"],Mc={class:"w-1/3"},Dc={class:"w-2/3"},Ac=["onClick"],Fc={key:0,class:"text-[14px] text-gray-700"},Ic={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=h=>`${h}-${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 h=o.parent&&a?.value?.[o.parent]||o.modelValue||{};c.value=Object.entries(h).filter(([x])=>!i.includes(x)).map(([x,k])=>({id:n("key-value-"),key:x,value:k}))})();function g(h){d.value=h}function E(h){if(d.value===null||d.value===h)return;const x=c.value.splice(d.value,1)[0];c.value.splice(h,0,x),d.value=null}const y=e.computed(()=>c.value.some(h=>h.key&&!h.value||!h.key&&h.value)),V=()=>{c.value.push({id:n("key-value-"),key:"",value:""})},f=h=>{c.value=c.value.filter(x=>x.id!==h)};return e.watch(c,h=>{const x={};h.forEach(w=>{w.key&&w.value!==void 0&&(x[w.key]=w.value)});const k={};i.length&&i.forEach(w=>{k[w]=o.parent?a?.value?.[o.parent]?.[w]:void 0}),a?.value&&o.parent&&(a.value[o.parent]={...k,...x}),r("update:modelValue",x)},{deep:!0}),(h,x)=>(e.openBlock(),e.createElementBlock("div",Sc,[e.createElementVNode("div",Nc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(k,w)=>(e.openBlock(),e.createElementBlock("div",{key:k.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===w}]),draggable:"true",onDragstart:b=>g(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-81b9444f><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-81b9444f><circle cx="15" cy="12" r="1.5" data-v-81b9444f></circle><circle cx="15" cy="24" r="1.5" data-v-81b9444f></circle><circle cx="21" cy="12" r="1.5" data-v-81b9444f></circle><circle cx="21" cy="24" r="1.5" data-v-81b9444f></circle><circle cx="21" cy="18" r="1.5" data-v-81b9444f></circle><circle cx="15" cy="18" r="1.5" data-v-81b9444f></circle></svg></button>',1)),e.createElementVNode("div",Mc,[e.createVNode(it,{modelValue:k.key,"onUpdate:modelValue":b=>k.key=b,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Dc,[e.createVNode(it,{modelValue:k.value,"onUpdate:modelValue":b=>k.value=b,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:b=>f(k.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(St),{height:"16",width:"16"})],8,Ac)],42,$c))),128))],512),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Fc," Дані для відображення відсутні ")),e.createElementVNode("div",Ic,[e.createElementVNode("button",{type:"button",onClick:V,disabled:y.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(Ke,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(s)),1)],8,Lc)])]))}}),[["__scopeId","data-v-81b9444f"]]),Tc={class:"w-full"},Oc={ref:"sortableContainer",class:"flex flex-col gap-1"},zc=["onDragstart","onDrop"],Rc=["disabled"],jc={class:"flex-1"},Pc=["onClick","disabled"],Uc={key:0,class:"text-[14px] text-gray-700"},Hc={class:"mt-2 w-full flex items-center"},qc=["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=h=>`${h}-${Math.random().toString(36).substring(2,15)}`,p=h=>{const x=h??n.value??[];a.value=x.map((k,w)=>({id:a.value[w]?.id??d("text-array"),value:k??""}))};p(),e.watch(()=>n.value,h=>{if(c){c=!1;return}p(h||[])},{deep:!0}),e.watch(a,h=>{c=!0,n.value=h.map(x=>x.value).filter(x=>x!=null&&x!=="")},{deep:!0});const g=e.computed(()=>r.value||a.value.some(h=>!h.value));function E(){g.value||(a.value=[...a.value,{id:d("text-array"),value:""}])}function y(h){r.value||(a.value=a.value.filter(x=>x.id!==h))}function V(h){r.value||(o.value=h)}function f(h){if(r.value||o.value===null||o.value===h)return;const x=[...a.value],[k]=x.splice(o.value,1);x.splice(h,0,k),a.value=x,o.value=null}return(h,x)=>(e.openBlock(),e.createElementBlock("div",Tc,[e.createElementVNode("div",Oc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(k,w)=>(e.openBlock(),e.createElementBlock("div",{key:k.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-66316a33><circle cx="15" cy="12" r="1.5" data-v-66316a33></circle><circle cx="15" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="12" r="1.5" data-v-66316a33></circle><circle cx="21" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="18" r="1.5" data-v-66316a33></circle><circle cx="15" cy="18" r="1.5" data-v-66316a33></circle></svg>',1)]),8,Rc),e.createElementVNode("div",jc,[h.inputType==="text"?(e.openBlock(),e.createBlock(it,{key:0,modelValue:k.value,"onUpdate:modelValue":b=>k.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),h.inputType==="tel"?(e.openBlock(),e.createBlock(tn,{key:1,modelValue:k.value,"onUpdate:modelValue":b=>k.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),h.inputType==="email"?(e.openBlock(),e.createBlock(en,{key:2,modelValue:k.value,"onUpdate:modelValue":b=>k.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),h.inputType==="mask"?(e.openBlock(),e.createBlock(Qt,{key:3,modelValue:k.value,"onUpdate:modelValue":b=>k.value=b,mask:h.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=>y(k.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(St),{height:"16",width:"16"})],8,Pc)],42,zc))),128))],512),a.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Uc," Дані для відображення відсутні ")),e.createElementVNode("div",Hc,[e.createElementVNode("button",{type:"button",onClick:E,disabled:g.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(Ke,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(i.value),1)],8,qc)])]))}}),[["__scopeId","data-v-66316a33"]]),Kc={class:"flex items-center gap-2 w-full"},Gc=["disabled"],Yc=["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}=De(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",Kc,[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]",[i.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Gc),[[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,Yc),[[e.vModelText,r.value]])]))}}),Wc={class:"flex items-center gap-2 w-full"},Zc=["min","max","step","disabled"],Jc=["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}=De(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",Wc,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),min:i.min,max:i.max,step:i.step,disabled:s.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[i.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")])},null,10,Zc),[[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,Jc),[[e.vModelText,r.value]])]))}}),Xc=["placeholder","disabled","name"],Qc=["type","value","onInput","placeholder","disabled"],ed=["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}=De(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,h){f&&(c.value[h]=f)}async function g(f,h){if(!f||t.inputType!=="mask")return;const{default:x}=await Promise.resolve().then(()=>bn);d.value[h]&&d.value[h].destroy(),d.value[h]=x(f,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),d.value[h].on("accept",()=>{const k=[...r.value||[]];k[h]=t.unmask?d.value[h].unmaskedValue:d.value[h].value,r.value=k}),d.value[h].on("complete",()=>{const k=[...r.value||[]];k[h]=t.unmask?d.value[h].unmaskedValue:d.value[h].value,r.value=k}),r.value?.[h]&&(d.value[h].value=r.value[h])}function E(f,h){if(s.value)return;const x=f.target.value??null,k=[...r.value];k[h]=t.inputType==="text"?x:Number(x),r.value=k}function y(){n.value+=1;const f=t.inputType==="text"||t.inputType==="mask"?null:0;r.value=[...r.value,f],t.inputType==="mask"&&setTimeout(()=>{const h=n.value-1;c.value[h]&&g(c.value[h],h)},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,k)=>k!==f);const h={};Object.keys(d.value).forEach(x=>{const k=parseInt(x,10);k>f?h[k-1]=d.value[k]:k<f&&(h[k]=d.value[k])}),d.value=h}}return e.onMounted(()=>{if(t.inputType==="mask")for(let f=0;f<n.value;f+=1)c.value[f]&&g(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(h=>{h&&h.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((h,x)=>{d.value[x]&&d.value[x].value!==h&&(d.value[x].value=h||"")})},{deep:!0}),(f,h)=>(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"},[f.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:k=>p(k,x-1),placeholder:f.placeholder,disabled:f.disabled,name:`${f.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":f.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Xc)):(e.openBlock(),e.createElementBlock("input",{key:1,type:f.inputType,value:r.value?.[x-1],onInput:k=>E(k,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":f.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Qc)),!f.disabled&&x===n.value&&f.isAdded?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:e.withModifiers(y,["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(Ke,{height:"18",width:"18"})])):e.createCommentVNode("",!0),!f.disabled&&n.value>1&&f.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(k=>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(St,{height:"18",width:"18"})],8,ed)):e.createCommentVNode("",!0)]))),128))],2))}}),td=["aria-expanded","data-focus"],nd=["placeholder","disabled","readonly"],ld={class:"max-h-full"},ad=["onClick","disabled"],od={key:0,class:"px-3 py-2 text-sm text-stone-500"},rd={class:"flex flex-col gap-1"},sd=["onDragstart","onDrop"],id=["disabled"],cd=["title"],dd=["disabled","onClick","aria-label"],ud={key:0,class:"text-xs text-stone-500"},Ft=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(""),g=e.ref(!1),E=e.ref(null),y=e.ref(null),V=e.ref(null),f=e.ref(null),h=e.ref(null),x=e.ref({});let k=!1,w=!1;const b=e.inject("values"),B=e.computed(()=>!!n.disabled),$=e.computed(()=>n.placeholder??"Оберіть значення"),S=e.computed(()=>n.search!==!1),j=e.computed(()=>{const D=n.parent??n.parentValue;return D?String(D):""}),W=e.computed(()=>j.value?b?.value?.[j.value]??null:null),K=D=>D==null?"__null__":String(D),T=D=>{if(!D)return"";const G=D.label??D.text??D.name??D.ua??D.en;return G?String(G):D.id!==void 0&&D.id!==null?String(D.id):""},z=D=>{const G=K(D);return c.value[G]||(c.value[G]=`array-select-${G}-${Math.random().toString(36).slice(2,8)}`),c.value[G]},L=e.computed(()=>new Set(r.value.map(D=>K(D.id)))),Z=e.computed(()=>{const D=L.value;let G=[...s.value];if(!n.data&&p.value.trim()){const J=p.value.toLowerCase();G=G.filter(ue=>T(ue).toLowerCase().includes(J))}return G.filter(J=>!D.has(K(J.id)))}),F=()=>{if(!n.data)return"";const D=n.prefix??"api",G=n.api??`/${D}/suggest/${n.data}`;return`${n.host??""}${G}`},A=()=>{r.value.length&&(k=!0,r.value=r.value.map(D=>({...D,text:i.value[K(D.id)]??D.text})))},H=D=>{const G=K(D.id),J=T(D);J&&(i.value[G]=J)},P=D=>{s.value=D?[...D]:[],D?.forEach(H),A()},pe=D=>{if(!D.length)return;const G=new Map(s.value.map(J=>[K(J.id),J]));D.forEach(J=>{const ue=K(J.id);G.set(ue,J),H(J)}),s.value=Array.from(G.values()),A()},ke=async(D="")=>{if(!n.data)return[];const G=F();if(!G)return[];const J=new URLSearchParams;J.set("json","1"),D&&J.set("key",D),n.start===1&&J.set("start","1"),W.value!==null&&W.value!==void 0&&W.value!==""&&J.set("parent",String(W.value));try{return(await(await fetch(`${G}?${J.toString()}`)).json())?.data??[]}catch{return[]}},Te=async D=>{if(!n.data||!D.length)return[];const G=F();if(!G)return[];const J=Array.from(new Set(D.map(xe=>K(xe)))),ue=new URLSearchParams;ue.set("json","1"),ue.set("val",J.join(",")),n.start===1&&ue.set("start","1"),W.value!==null&&W.value!==void 0&&W.value!==""&&ue.set("parent",String(W.value));try{const ze=(await(await fetch(`${G}?${ue.toString()}`)).json())?.data??[];return pe(ze),ze}catch{return[]}},Ie=async(D="",{force:G=!1}={})=>{if(!n.data)return;const J=W.value??null;if(!G&&d.value.keyword===D&&d.value.parent===J&&s.value.length>0)return;d.value={keyword:D,parent:J};const xe=await ke(D);P(xe)},re=((D,G=200)=>{let J;return(...ue)=>{J&&clearTimeout(J),J=setTimeout(()=>D(...ue),G)}})(async D=>{n.data&&await Ie(D,{force:!0})},250),me=e.ref(null),fe=()=>{if(!V.value)return;const D=V.value.getBoundingClientRect(),G=window.innerHeight??document.documentElement.clientHeight,J=window.innerWidth??document.documentElement.clientWidth,ue=8,xe=8,Ue=n.maxHeight??280,ze=G-D.bottom-xe-ue,Re=D.top-xe-ue,tt=ze>=Re,Ze=Math.max(J-ue*2,0);let{width:He}=D;Ze>0&&He>Ze&&(He=Ze);let{left:qe}=D;qe+He+ue>J&&(qe=J-He-ue),qe=Math.max(qe,ue);const rt=Math.min(Ue,Math.max(tt?ze:Re,50));x.value={position:"fixed",left:`${qe}px`,width:`${He}px`,maxHeight:`${rt}px`,transform:tt?"none":"translateY(-100%)",top:tt?`${D.bottom+xe}px`:`${D.top-xe}px`}},ge=async(D="click")=>{B.value||g.value||(me.value=D,await Ie(p.value.trim()),g.value=!0,await e.nextTick(),fe(),h.value?.focus())},O=()=>{g.value=!1,me.value=null,e.nextTick(()=>{h.value?.blur()})},ne=async D=>{if(D.stopPropagation(),!B.value){if(g.value){if(me.value==="focus"){me.value=null;return}O();return}await ge("click")}},Ee=D=>{D.key==="Escape"&&O()},Ae=D=>{if(!g.value)return;const G=D.target;f.value?.contains(G)||O()},M=D=>{const G=D.target;y.value?.contains(G)||f.value?.contains(G)||O()},R=D=>{if(D.key==="Escape"){D.preventDefault(),O();return}if(D.key==="Enter"){D.preventDefault();const G=Z.value[0];G&&q(G)}},q=D=>{if(!D)return;const G=K(D.id);if(L.value.has(G))return;H(D);const J={id:D.id,text:T(D)||String(D.id??""),key:z(D.id)};r.value=[...r.value,J],le(D),p.value="",e.nextTick(()=>{h.value?.focus()})},le=D=>{const G=r.value.map(J=>J.id);a("value-selected",{name:n.name,value:G,option:D})},oe=D=>{if(B.value)return;const G=r.value.filter(J=>K(J.id)!==K(D));r.value=G},be=D=>{B.value||(E.value=D)},Ve=D=>{if(B.value||E.value===null||E.value===D)return;const G=[...r.value],[J]=G.splice(E.value,1);G.splice(D,0,J),E.value=null,r.value=G},we=async()=>{const G=(Array.isArray(o.value)?[...o.value]:[]).filter(ue=>ue!=null);if(n.data&&G.length){const ue=G.filter(xe=>!i.value[K(xe)]);ue.length&&await Te(ue)}const J=G.map(ue=>({id:ue,text:i.value[K(ue)]??String(ue),key:z(ue)}));k=!0,r.value=J};e.watch(r,D=>{if(k){k=!1;return}const G=D.map(J=>J.id);w=!0,o.value=G,a("change",G)},{deep:!0}),e.watch(o,()=>{if(w){w=!1;return}we()},{deep:!0}),e.watch(p,D=>{!n.data||!g.value||re(D.trim())}),e.watch(B,D=>{D&&O()}),e.watch(()=>n.options,async D=>{n.data||(P(D??[]),await we())},{immediate:!0,deep:!0}),e.watch(()=>n.data,async D=>{D&&(await Ie(p.value.trim()),await we())},{immediate:!0});const Xe=e.ref(!1);return e.watch(W,async()=>{if(n.data){if(!Xe.value){Xe.value=!0;return}r.value=[],await Ie(p.value.trim()),await we()}}),e.onMounted(async()=>{document.addEventListener("click",M,!0),window.addEventListener("keydown",Ee),window.addEventListener("scroll",Ae,!0),await we()}),e.onUnmounted(()=>{document.removeEventListener("click",M,!0),window.removeEventListener("keydown",Ee),window.removeEventListener("scroll",Ae,!0)}),(D,G)=>(e.openBlock(),e.createElementBlock("div",{class:"flex flex-col gap-2 w-full",ref_key:"rootRef",ref:y},[e.createElementVNode("div",{class:"relative",onClick:G[2]||(G[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{ref_key:"triggerRef",ref:V,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]",g.value?"border-[#2684ff] ring-1 ring-[#2684ff] shadow-[0_0_0_1px_rgba(38,132,255,0.5)]":"",B.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":g.value,"aria-haspopup":"listbox","data-focus":g.value?"true":"false",onClick:ne},[e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:h,"onUpdate:modelValue":G[0]||(G[0]=J=>p.value=J),placeholder:$.value,disabled:B.value,readonly:!S.value,onFocus:G[1]||(G[1]=()=>ge("focus")),onKeydown:R,class:"flex-1 bg-transparent border-0 outline-none px-0 py-1 text-sm text-stone-900 placeholder:text-stone-400"},null,40,nd),[[e.vModelText,p.value]]),e.createElementVNode("span",{class:e.normalizeClass(["text-stone-400 transition-transform duration-150",g.value?"rotate-180":""]),"aria-hidden":"true"},[e.createVNode(Zt,{width:"16",height:"16"})],2)],10,td),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[g.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:f,class:"fixed z-[3000] rounded-md border border-stone-200 bg-white shadow-lg overflow-auto",style:e.normalizeStyle(x.value)},[e.createElementVNode("div",ld,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Z.value,J=>(e.openBlock(),e.createElementBlock("button",{key:K(J.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(ue=>q(J),["stop"]),disabled:B.value},e.toDisplayString(T(J)),9,ad))),128)),Z.value.length===0?(e.openBlock(),e.createElementBlock("p",od," Немає варіантів ")):e.createCommentVNode("",!0)])],4)):e.createCommentVNode("",!0)]),_:1})]))]),e.createElementVNode("div",rd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(J,ue)=>(e.openBlock(),e.createElementBlock("div",{key:J.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===ue}]),draggable:"true",onDragstart:xe=>be(ue),onDragover:G[3]||(G[3]=e.withModifiers(()=>{},["prevent"])),onDrop:xe=>Ve(ue),onDragend:G[4]||(G[4]=xe=>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:B.value,"aria-label":"Перетягнути"},[e.createVNode($t,{width:"14",height:"14"})],8,id),e.createElementVNode("div",{class:"flex-1 text-sm text-stone-900",title:J.text},e.toDisplayString(J.text),9,cd),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:B.value,onClick:e.withModifiers(xe=>oe(J.id),["stop"]),"aria-label":`Видалити ${J.text}`},[e.createVNode(St,{width:"14",height:"14"})],8,dd)],42,sd))),128)),r.value.length===0?(e.openBlock(),e.createElementBlock("p",ud,"Немає вибраних значень")):e.createCommentVNode("",!0)])],512))}}),[["__scopeId","data-v-ad849ae4"]]),pd={class:"flex items-center gap-2 w-full"},md={class:"relative flex-1"},fd=["placeholder","disabled","onKeydown"],hd=["disabled"],gd={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"},yd={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"},kd={key:0,class:"fixed inset-0 z-[1000] flex items-center justify-center bg-black/50"},bd={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},wd={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},xd=["onClick"],_d={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}=De(a.style),s=e.useModel(l,"modelValue"),i=e.computed({get:()=>s.value,set:S=>{s.value=S}}),c=e.ref(!1),d=e.ref([]),p=e.ref(!1),g=e.ref(null);e.watch(p,S=>{typeof document>"u"||(S?(g.value=document.body.style.overflow,document.body.style.overflow="hidden"):g.value!=null?(document.body.style.overflow=g.value,g.value=null):document.body.style.removeProperty("overflow"))}),e.onBeforeUnmount(()=>{typeof document>"u"||(g.value!=null?document.body.style.overflow=g.value:document.body.style.removeProperty("overflow"))});const E=e.computed(()=>a.placeholder??""),y=e.computed(()=>!!a.disabled),V=S=>{if(!S)return null;if(Array.isArray(S))return S;if(typeof S=="string"){const j=S.split(",").map(W=>W.trim()).filter(Boolean);return j.length!==4?null:j.map(Number)}return null},f=e.computed(()=>{const S=V(a.bbox);if(!S||S.length!==4)return null;const j=S.map(Number);return j.some(W=>Number.isNaN(W))?null:j}),h=e.computed(()=>{const S=f.value;if(!S)return"";const[j,W,K,T]=S;return`${j},${Math.max(W,T)},${K},${Math.min(W,T)}`});e.computed(()=>h.value?"1":"0");const x=e.inject("values");function k(){!y.value&&i.value.trim()&&w()}async function w(){const S=(i.value||"").trim();if(!S)return;let j=S;if(a.includes?.length&&x?.value){const K=a.includes.map(T=>x.value?.[T]).filter(Boolean);K.length&&(j=`${K.join(", ")}, ${S}`)}const W=$(j);if(W){c.value=!0;try{const T=await(await fetch(W)).json();d.value=Array.isArray(T)?T:[],p.value=!0}catch(K){console.error("Address search error:",K)}finally{c.value=!1}}}function b(){p.value=!p.value}function B(S){if(!S)return;p.value=!1;const j=parseFloat(S.lat),K={type:"Point",coordinates:[parseFloat(S.lon),j]};a.geom&&x?.value&&(x.value[a.geom]=K),o("update:geom",K)}function $(S){if(!a.api)return"";const j={value:encodeURIComponent(S),bbox:f.value?f.value.join(","):""};return a.api.replace(n,(W,K)=>j[K.trim()]??"")}return(S,j)=>(e.openBlock(),e.createElementBlock("div",pd,[e.createElementVNode("div",md,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":j[0]||(j[0]=W=>i.value=W),placeholder:E.value,disabled:y.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[e.unref(r),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:e.withKeys(e.withModifiers(k,["prevent"]),["enter"])},null,42,fd),[[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"},j[2]||(j[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",yd,j[4]||(j[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",gd,j[3]||(j[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,hd),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[p.value?(e.openBlock(),e.createElementBlock("div",kd,[e.createElementVNode("div",bd,[e.createElementVNode("div",wd,[j[6]||(j[6]=e.createElementVNode("span",null,"Search results",-1)),e.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:j[1]||(j[1]=W=>p.value=!1),title:"Close"},j[5]||(j[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,(W,K)=>(e.openBlock(),e.createElementBlock("li",{key:K,onClick:T=>B(W),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString(W.display_name),9,xd))),128))]),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",_d," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),qn=(l="")=>`${l}${Math.floor(Math.random()*1e4)}`,vd={class:"vs-datalist space-y-3"},Ed={class:"space-y-3"},Vd=["onClick","disabled"],Bd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Cd=["disabled"],Sd=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,h=Array.from({length:f},g);n.value=[...a.value,...h]}function g(){const f={};return r.value.forEach(h=>{f[h.name]=h?.default??null}),f}function E(){i.value&&(n.value=[...a.value,g()],d())}function y(f){c.value||(n.value=a.value.filter((h,x)=>x!==f),d(),p())}function V(f){return{...f}}return(f,h)=>(e.openBlock(),e.createElementBlock("div",vd,[e.createElementVNode("div",Ed,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(x,k)=>(e.openBlock(),e.createElementBlock("div",{key:o.value[k],class:"flex items-center gap-3"},[e.createVNode(Je,{schema:s.value,layout:"inline",navigation:!1,values:a.value[k],"onUpdate:values":w=>a.value[k]=w,"form-id":o.value[k]},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=>y(k),disabled:c.value},[e.createVNode(ct,{class:"w-5 h-5"})],8,Vd)]))),128)),a.value.length===0?(e.openBlock(),e.createElementBlock("div",Bd,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(Ke,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Cd)]))}}),[["__scopeId","data-v-8bcb5436"]]),Nd={};function $d(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 Md=ae(Nd,[["render",$d]]),Dd={class:"vs-dataform space-y-4"},Ad=["draggable","onDragstart","onDragover","onDragenter","onDrop"],Fd={class:"flex items-center gap-2"},Id=["onClick"],Ld={class:"text-sm font-medium text-gray-700"},Td={class:"flex items-center gap-2"},Od=["title","onClick","disabled"],zd=["title","onClick","disabled"],Rd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},jd=["disabled"],Pd=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??"Ще немає груп"),g=e.computed(()=>t.schema?.map(Y=>({...Y,disabled:t.disabled||Y.disabled}))??[]),E=e.computed(()=>g.value.map(Y=>W(Y))),y=e.computed(()=>t.view==="accordion"),V=e.computed(()=>!!(t.collapsible||y.value)),f=e.computed(()=>t.draggable!==!1),h=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,()=>{k(),w(),b()},{immediate:!0}),e.watch(()=>t.schema,b,{immediate:!0,deep:!0}),e.watch(()=>t.view,()=>{w()},{immediate:!0});function k(){const Y=n.value.length;a.value.length<Y?a.value=[...a.value,...Array.from({length:Y-a.value.length},()=>qn())]:a.value.length>Y&&a.value.splice(Y)}function w(){const Y=n.value.length;y.value?Y===0?r.value=-1:r.value>=Y?r.value=Y-1:r.value<0&&(r.value=0):o.value.length<Y?o.value=[...o.value,...Array.from({length:Y-o.value.length},()=>!1)]:o.value.length>Y&&o.value.splice(Y)}function b(){if(!t.minGroups||n.value.length>=t.minGroups)return;const Y=t.minGroups-n.value.length,re=Array.from({length:Y},B);n.value=[...n.value,...re],w()}function B(){const Y={};return g.value.forEach(re=>{Y[re.name]=re?.default??null}),Y}function $(){h.value&&(n.value=[...n.value,B()],k(),w())}function S(Y){x.value||(n.value=n.value.filter((re,me)=>me!==Y),k(),y.value?r.value>=n.value.length&&(r.value=n.value.length-1):o.value.splice(Y,1),b())}function j(Y){if(t.disabled)return;const re=JSON.parse(JSON.stringify(n.value[Y]??{}));n.value=[...n.value.slice(0,Y+1),re,...n.value.slice(Y+1)],k(),y.value?r.value>Y&&(r.value+=1):o.value.splice(Y+1,0,o.value[Y]??!1)}function W(Y){return{...Y}}function K(Y){return y.value?r.value===-1&&Y===0?!1:r.value!==Y:!!o.value[Y]}function T(Y){if(V.value){if(y.value){r.value=Y;return}o.value[Y]=!o.value[Y]}}function z(Y,re){if(!f.value||t.disabled){re.preventDefault();return}s.value=Y,i.value=Y,c.value={groups:JSON.parse(JSON.stringify(n.value)),keys:[...a.value],states:[...o.value]},re.dataTransfer?.setData("text/plain",String(Y)),re.dataTransfer?.setDragImage?.(re.currentTarget,0,0)}function L(Y,re){!f.value||t.disabled||s.value!==null&&pe(Y,re)}function Z(Y,re){pe(Y,re)}function F(Y){!f.value||t.disabled||Ie()}function A(){c.value&&P(),s.value=null,i.value=null,c.value=null}function H(Y,re){const me=[...n.value],[fe]=me.splice(Y,1);me.splice(re,0,fe),n.value=me;const ge=[...a.value],[O]=ge.splice(Y,1);if(ge.splice(re,0,O),a.value=ge,y.value)r.value===Y&&(r.value=re);else{const ne=[...o.value],[Ee]=ne.splice(Y,1);ne.splice(re,0,Ee),o.value=ne}}function P(){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(Y,re){if(s.value===null)return;const me=ke(Y,re);i.value=me,Te(me)}function ke(Y,re){if(!re?.currentTarget)return Y;const me=re.currentTarget.getBoundingClientRect(),ge=re.clientY-me.top>me.height/2?Y+1:Y;return Math.max(0,Math.min(ge,n.value.length))}function Te(Y){const re=s.value;if(re===null)return;let me=Y;if(me>n.value.length&&(me=n.value.length),me===re||me===re+1)return;const fe=me>re?me-1:me;H(re,fe),s.value=fe,i.value=me>re?fe+1:fe}function Ie(){c.value=null,s.value=null,i.value=null}return(Y,re)=>(e.openBlock(),e.createElementBlock("div",Dd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(me,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":K(fe)?"pt-6 px-6":"p-6"]]),draggable:f.value&&!t.disabled,onDragstart:ge=>z(fe,ge),onDragend:A,onDragover:e.withModifiers(ge=>L(fe,ge),["prevent"]),onDragenter:e.withModifiers(ge=>Z(fe,ge),["prevent"]),onDrop:e.withModifiers(ge=>F(),["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"&&!K(fe)?"rounded-t-lg":"rounded-lg"]])},[e.createElementVNode("div",Fd,[f.value?(e.openBlock(),e.createBlock($t,{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:ge=>T(fe)},[e.createVNode(Zt,{class:e.normalizeClass(["h-4 w-4 transition",K(fe)?"-rotate-90":"rotate-0"])},null,8,["class"])],8,Id)):e.createCommentVNode("",!0),e.createElementVNode("div",Ld,e.toDisplayString(`${d.value} (${fe+1})`),1)]),e.createElementVNode("div",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.duplicateTitle,onClick:ge=>j(fe),disabled:t.disabled,draggable:"false"},[e.createVNode(Md,{class:"w-5 h-5"})],8,Od),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=>S(fe),disabled:x.value,draggable:"false"},[e.createVNode(ct,{class:"w-5 h-5"})],8,zd)])],2),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(t.view==="accordion"?"p-6":"pt-6")},[e.createVNode(Je,{class:"vs-dataform__form",schema:E.value,layout:"inline",navigation:!1,values:n.value[fe],"onUpdate:values":ge=>n.value[fe]=ge,"form-id":a.value[fe],disabled:t.disabled},null,8,["schema","values","onUpdate:values","form-id","disabled"])],2),[[e.vShow,!K(fe)]])],42,Ad))),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",Rd,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:$,disabled:!h.value},[e.createVNode(Ke,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,jd)]))}}),[["__scopeId","data-v-3b71fe50"]]),It="__vs_form_monaco_loader__",Kn=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[It])return p[It];const E=(async()=>{const y=h=>{if(Array.from(document.styleSheets||[]).some(w=>w?.href?.includes(h)))return;const k=document.createElement("link");k.rel="stylesheet",k.href=h,document.head.appendChild(k)},V=h=>new Promise((x,k)=>{if(Array.from(document.scripts).some(B=>B.src===h))return x();const b=document.createElement("script");b.src=h,b.async=!0,b.onload=()=>x(),b.onerror=B=>k(B),document.body.appendChild(b)}),f="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs";return y(`${f}/editor/editor.main.min.css`),await V(`${f}/loader.min.js`),new Promise((h,x)=>{window.require.config({paths:{vs:f}}),window.require(["vs/editor/editor.main"],()=>{s=window.monaco,p.monaco=s,h(s)},k=>x(k))})})().catch(y=>{throw delete p[It],y});return p[It]=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 g=r.getValue();p!==g&&(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,g)=>(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))}}),Gn={VsInputText:it,VsInputRadio:nn,"vs-input-text":it,"vs-input-password":Pl,"vs-input-textarea":Dn,"vs-input-richtext":An,"vs-input-mask":Qt,"vs-input-number":_n,"vs-input-radio":nn,"vs-input-select":rn,"vs-input-switcher":Jt,"vs-input-static":Xt,"vs-input-container":Mn,"vs-input-date":La,"vs-input-checkbox":vn,"vs-input-file":Sn,"vs-input-file2":an,file2:an,File2:an,"vs-input-html":Xt,"vs-input-email":en,"vs-input-tel":tn,"vs-input-datatable":Fn,"vs-input-map":In,"vs-input-file-list":Nn,"vs-input-tags":Ln,"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":rn,VsInputArraySelect:Ft,"vs-input-array":Un,"vs-input-array-select":Ft,"array-select":Ft,"vs-input-address":Hn,"vs-input-datalist":Sd,"vs-input-dataform":Pd,"vs-input-monaco":Kn},Ud=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){he.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(o.button),1))}}),Hd={class:"flex flex-col gap-1 w-full"},qd=["innerHTML"],Yn=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(()=>Rl[`${n.layout}`]),s=["label","placeholder","info","description","text","html"],i=e.ref(x()),c=e.computed(()=>V(n.item,i.value)),d=e.computed(()=>Gn?.[`vs-input-${n.item.type}`]),p=e.inject("field-props"),g=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 B=Array.isArray(b)?b:Object.keys(b);return new Set(B)}),E=e.computed(()=>{const w={...c.value??{}},b=n.item?.name;b&&p?.value?.[b]&&Object.assign(w,p.value[b]);const B=g.value;return B.size?Object.fromEntries(Object.entries(w).filter(([$])=>B.has($))):{}}),y=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",k)}),e.onUnmounted(()=>{window.removeEventListener("storage",k)});function V(w,b){if(!w)return{};const B={...w};return s.forEach($=>{const S=h(w,$,b);S!=null&&(B[$]=S)}),Array.isArray(w.options)&&(B.options=w.options.map($=>f($,b))),B}function f(w,b){if(!w)return w;const B={...w},$=h(w,"label",b),S=h(w,"text",b);return $!=null&&(B.label=$),S!=null?B.text=S:$!=null&&(B.text=$),B}function h(w,b,B){const $=`${b}:${B}`;if(w?.[$]!=null)return w[$];if(b==="label"&&w?.[B]!=null)return w[B];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 k(){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",Hd,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value),e.mergeProps(E.value,{modelValue:a.value,"onUpdate:modelValue":b[0]||(b[0]=B=>a.value=B),onValueSelected:y}),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,qd)):e.createCommentVNode("",!0)]),c.value.behavior?.api&&c.value.behavior?.button?(e.openBlock(),e.createBlock(Ud,e.mergeProps({key:0},c.value.behavior,{value:a.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),Kd={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},Gd={class:"vs-compact-form-navigation__rail mt-[6px]"},Yd=["onClick"],Wd=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 T=n.width;if(T==null)return{};const z=typeof T=="number"?`${T}px`:`${T}`;return{width:z,minWidth:z}});let d=null,p=0,g=0,E=null,y=null,V=null;const f=()=>W(),h=()=>k();e.watch(()=>n.target,async T=>{if($(),!T){E=null,a.value=[],o.value="";return}E=T,s.value&&(await e.nextTick(),B(T),k())},{immediate:!0}),e.watch(()=>n.scrollContainer,T=>{if(!s.value){y=T??null;return}x(T??null),e.nextTick(()=>k())},{immediate:!0}),e.onMounted(()=>{n.scrollContainer||x(null),k()}),e.onBeforeUnmount(()=>{$(),x(null,!0),E=null,typeof window<"u"&&(p&&window.cancelAnimationFrame(p),g&&window.cancelAnimationFrame(g))});function x(T,z=!1){if(V&&(V(),V=null),z){y=null;return}if(y=T??null,typeof window>"u")return;const L=T??window,Z=window;L.addEventListener("scroll",f,{passive:!0}),Z.addEventListener("resize",h),V=()=>{L.removeEventListener("scroll",f),Z.removeEventListener("resize",h)}}function k(){if(!s.value||!E)return;p&&typeof window<"u"&&window.cancelAnimationFrame(p);const T=()=>{w(),p=0};typeof window>"u"?T():p=window.requestAnimationFrame(T)}function w(){if(!s.value||!E)return;const T=Array.from(E.querySelectorAll("h1, h2")),z=new Set,L=[];T.forEach((Z,F)=>{const A=Z.textContent?.trim()??"";if(!A)return;let H=(Z.getAttribute("id")??"").trim();H||(H=b(A)||`heading-${F+1}`);let P=H,pe=1;for(;z.has(P);)P=`${H}-${pe+=1}`;Z.id!==P&&Object.assign(Z,{id:P}),z.add(P),L.push({id:P,text:A,level:Z.tagName.toLowerCase()==="h1"?1:2})}),a.value=L,L.length||(o.value=""),j()}function b(T){return T.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function B(T){!T||!s.value||typeof MutationObserver>"u"||($(),d=new MutationObserver(()=>k()),d.observe(T,{childList:!0,subtree:!0}))}function $(){d&&(d.disconnect(),d=null)}function S(T){const z=y;if(!z)return typeof window>"u"?T.offsetTop:T.getBoundingClientRect().top+window.scrollY;const L=T.getBoundingClientRect(),Z=z.getBoundingClientRect();return L.top-Z.top+z.scrollTop}function j(){if(!s.value||!a.value.length)return;const T=y,z=(T?T.scrollTop:null)||(typeof window<"u"?window.scrollY:0),L=(T?T.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),Z=z+L;let F=null;for(let H=0;H<a.value.length;H+=1){const P=a.value[H],pe=document.getElementById(P.id);if(pe){const ke=S(pe);ke+pe.offsetHeight>z&&ke<Z&&(F=P.id)}}!F&&r.value&&(F=r.value),F&&(r.value=F);const A=T?T.scrollHeight-T.clientHeight:document.documentElement.scrollHeight-window.innerHeight;z+5>=A&&(F=a.value[a.value.length-1].id),F&&(o.value=F)}function W(){s.value&&(g&&window.cancelAnimationFrame(g),g=window.requestAnimationFrame(()=>{j(),g=0}))}function K(T){if(!s.value)return;const z=document.getElementById(T);if(!z)return;const L=y,Z=Math.max(0,S(z));L?L.scrollTo({top:Z,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:Z,behavior:"smooth"})}return t({refresh:k}),(T,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",Kd,e.toDisplayString(T.title),1),e.createElementVNode("div",Gd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,L=>(e.openBlock(),e.createElementBlock("div",{key:L.id,class:e.normalizeClass(["vs-compact-form-navigation__item relative",L.level===2?"vs-compact-form-navigation__item--nested":"",L.id===o.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick:Z=>K(L.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",L.level===2?"pl-[15px]":"pl-[18px]",L.id===o.value?"text-gray-800":"text-gray-500"])},[e.createElementVNode("span",null,e.toDisplayString(L.text),1)],10,Yd)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-1584a562"]]),at={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон",minlength:l=>`Мінімальна довжина — ${l} символів`,maxlength:l=>`Максимальна довжина — ${l} символів`},Zd=l=>typeof l=="string"?l.trim()?!1:at.required:Array.isArray(l)?l.map(n=>typeof n=="string"?n.trim():n).filter(n=>n!=null&&n!=="").length?!1:at.required:l?!1:at.required,Jd=l=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return l?t.test(l)?!1:at.email:!1},Xd=l=>{const t=/^\+[1-9]\d{1,14}$/;return l?t.test(l)?!1:at.tel:!1},Wn=l=>l==null?0:typeof l=="string"?l.trim().length:Array.isArray(l)?l.length:typeof l=="number"?l.toString().length:String(l).length,Qd=(l,t)=>{if(l==null)return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Wn(l)<n?t?.message||at.minlength(n):!1},eu=(l,t)=>{if(l==null||l==="")return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Wn(l)>n?t?.message||at.maxlength(n):!1},tu=(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},nu=(l,t)=>!1,lu=(l,t)=>{switch(typeof t=="string"?t:t.type){case"required":return Zd(l);case"email":return Jd(l);case"tel":return Xd(l);case"regexp":return tu(l,t);case"minlength":return Qd(l,t);case"maxlength":return eu(l,t);case"custom":return nu();default:return!1}},au={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function Zn(l){const t=l?.toLowerCase();return au[t]||t}function cn(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=Zn(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=cn(r.schema,r.disabled)),a.push(r)}),a}const n=[];return Object.entries(l).forEach(a=>{const o={name:a[0],...a[1],type:Zn(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=cn(o.schema,o.disabled)),n.push(o)}),n}function ou(l,t,n=!1){const a=e.computed(()=>cn((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 g=Array.isArray(p)?p[0]:p,E=l?.value?.[g];return $n(E,p)}const s=(d=a.value,p=!0)=>(d.forEach(g=>{const E=[],y=Number(g?.minlength),V=Number(g?.maxlength);!Number.isNaN(y)&&Number.isFinite(y)&&E.push({type:"minlength",value:y}),!Number.isNaN(V)&&Number.isFinite(V)&&E.push({type:"maxlength",value:V});const f=[...E,...g.rules||[]];if(f.length){if(!r(g)){delete o.value[g.name];return}let h=!1,x=null;f.forEach(k=>{const w=lu(l.value[g.name],k);w&&(h=!0,!x&&typeof w=="string"&&(x=w))}),h&&x?o.value[g.name]=x:delete o.value[g.name]}g.schema&&s(g.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 ru={class:"flex w-full h-full min-h-0 gap-6"},su={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},Je=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:L=>{s.value=L,i.value=L}}),{errors:d,validate:p,reset:g,visibleSchema:E}=ou(c,o.schema,e.toRef(o,"disabled")),y=e.ref(null),V=e.ref(null),f=e.ref({}),h=e.computed(()=>o.navigation),x=e.computed(()=>o.navWidth),k=e.computed(()=>o.style?.columns),w=Object.freeze({container:12,label:3}),b=e.computed(()=>o.columns??k.value??w),B=e.computed(()=>o.columns!=null||k.value!=null),$=e.computed(()=>B.value?"horizontal":o.layout),S=L=>L?.columns?"horizontal":$.value,j=L=>L?.columns??b.value,W=()=>{a("update:modelValue",c.value),p(),a("handle-submit",c.value)},K=L=>{a("value-selected",L)},T=()=>{o.formId&&(c.value?.id!==void 0&&c.value?.id!==null&&c.value?.id!==""||(c.value={...c.value??{},id:o.formId}))};t({validate:p,reset:g,errors:d}),e.onMounted(()=>{T(),r.value={value:c.value,errors:d.value,reset:g,validate:p,formId:o.formId}}),e.watch(()=>o.formId,()=>{T()},{immediate:!0});function z(L,Z){if(L===Z)return!0;if(typeof L!="object"||typeof Z!="object"||!L||!Z)return!1;const F=Object.keys(L),A=Object.keys(Z);return F.length!==A.length?!1:F.every(H=>L[H]===Z[H])}return e.provide("form",r),e.provide("values",c),e.provide("field-props",f),(L,Z)=>(e.openBlock(),e.createElementBlock("div",ru,[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:y,onSubmit:e.withModifiers(W,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",$.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E),(F,A)=>(e.openBlock(),e.createElementBlock("div",{key:F.name,class:e.normalizeClass(S(F)==="horizontal"?"col-span-12":`col-span-${F.col||12}`)},[e.createVNode(Yn,{style:e.normalizeStyle(L.style),item:F,layout:S(F),columns:j(F),"model-value":c.value[F.name],"onUpdate:modelValue":H=>{const P=c.value[F.name];z(P,H)||(c.value[F.name]=H)},error:e.unref(d)[F.name],onValueSelected:K},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),S(F)==="settings"&&A+1!==e.unref(E).length?(e.openBlock(),e.createElementBlock("div",su)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(Wd,{target:y.value,"scroll-container":V.value,enabled:h.value,width:x.value},null,8,["target","scroll-container","enabled","width"])]))}}),iu={class:"relative"},cu={class:"w-full h-full fixed top-0 start-0 bg-black bg-opacity-50"},du={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"},uu={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},pu={class:"font-medium text-gray-800 dark:text-[#ffffff]"},mu={class:"p-4 mim-h-0 h-full overflow-auto"},Jn=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=()=>{he.notify({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`})},g=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(()=>({}));he.notify({type:"warning",title:"Помилка валідації",message:f.message||"Некоректні дані (400)"});return}if(V.status===500){he.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"});return}he.notify({type:"error",title:"Помилка",message:`Статус: ${V.status}`})};async function E(){const V=s.value.validate();if(V){he.notify({type:"warning",title:"Помилка валідації",message:Object.entries(V).map(([h,x])=>`${h}: ${x}`).join(`
|
|
3
|
+
`)});return}const f=n.api?.trim();if(f){const h=d();try{const x=await fetch(f,{method:h,headers:h==="GET"?void 0:{"Content-Type":"application/json"},body:h==="GET"?void 0:JSON.stringify(r.value)});await g(x)}catch(x){he.notify({type:"error",title:"Помилка з’єднання",message:x.message||"Не вдалося виконати запит"})}return}if(i.value)try{const h=await fetch(`/api/table/${i.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r.value)});await g(h)}catch(h){he.notify({type:"error",title:"Помилка з’єднання",message:h.message||"Не вдалося виконати запит"})}else a("edit",r.value),y()}function y(){a("close")}return e.onMounted(async()=>{try{if(n.form&&!n.schema){const V=await fetch(`/api/template/form/${n.form}`);if(!V.ok){he.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){he.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){he.notify({type:"error",title:"Error",message:V.message||"Unexpected error"}),console.error(V)}}),(V,f)=>(e.openBlock(),e.createElementBlock("div",iu,[e.createElementVNode("div",cu,[e.createElementVNode("div",du,[e.createElementVNode("div",uu,[e.createElementVNode("h3",pu,e.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:y,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",mu,[o.value?(e.openBlock(),e.createBlock(Je,{key:0,schema:o.value,values:r.value,"onUpdate:values":f[0]||(f[0]=h=>r.value=h),form:s.value,"onUpdate:form":f[1]||(f[1]=h=>s.value=h),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:y,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"}," Зберегти ")])])])]))}}),fu=1440*60*1e3,hu=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],gu=["січ","лют","бер","квіт","трав","черв","лип","серп","вер","жовт","лист","груд"],yu=["нд","пн","вт","ср","чт","пт","сб"];function Se(l){return l instanceof Date&&!Number.isNaN(l.getTime())}const dt=l=>new Date(l.getTime());function ot(l){const t=dt(l);return t.setHours(0,0,0,0),t}function ht(l){const t=dt(l);return t.setHours(23,59,59,999),t}function dn(l){return ot(new Date(l.getFullYear(),l.getMonth(),1))}function un(l){return ht(new Date(l.getFullYear(),l.getMonth()+1,0))}function pn(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 ku(l,t){return pn(l,-1)}function Lt(l,t){const n=new Date(l);return n.setFullYear(n.getFullYear()+t),n}function Xn(l,t){return Lt(l,-t)}function Qn(l){return ot(new Date(l.getFullYear(),0,1))}function el(l){return ht(new Date(l.getFullYear(),11,31))}function bu(l){const t=Math.floor(l.getFullYear()/10)*10;return ot(new Date(t,0,1))}function wu(l){const t=Math.floor(l.getFullYear()/10)*10+9;return ht(new Date(t,11,31))}const Pe=l=>l.getFullYear(),Tt=l=>Math.floor(l.getFullYear()/10)*10;function xu(l){const t=[];let n=ot(l.start);const a=ot(l.end);for(;n<=a;)t.push(dt(n)),n=new Date(n.getTime()+fu);return t}function _u(l){const t=[];let n=dn(l.start);const a=un(l.end);for(;n<=a;)t.push(dt(n)),n=pn(n,1);return t}function vu(l){const t=[];let n=Qn(l.start);const a=el(l.end);for(;n<=a;)t.push(dt(n)),n=Lt(n,1);return t}function mn(l,t=1){const n=ot(l),a=(n.getDay()-t+7)%7;return n.setDate(n.getDate()-a),n}function Eu(l,t=1){const n=mn(l,t);return n.setDate(n.getDate()+6),ht(n)}function Vu(l,t,n=0){const a=mn(l,n),o=(t-n+7)%7;return a.setDate(a.getDate()+o),a}const Ot=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth()&&l.getDate()===t.getDate(),fn=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth(),tl=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear(),nl=(l,t)=>!!l&&!!t&&Ot(l,t)&&l.getHours()===t.getHours(),Bu=(l,t)=>!!l&&!!t&&nl(l,t)&&l.getMinutes()===t.getMinutes();function Cu(l,t){const n=l.getTime();return n>=t.start.getTime()&&n<=t.end.getTime()}const gt=(l,t)=>!!l&&!!t&&l.getTime()<t.getTime(),yt=(l,t)=>!!l&&!!t&&l.getTime()>t.getTime();function Su(l){const t=l.filter(n=>Se(n));if(t.length)return t.reduce((n,a)=>n.getTime()>=a.getTime()?n:a)}function Nu(l){const t=l.filter(n=>Se(n));if(t.length)return t.reduce((n,a)=>n.getTime()<=a.getTime()?n:a)}function ll(l,t){const n=dt(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 zt=(l,t=2)=>String(l).padStart(t,"0");function al(l,t){return t==="wide"?hu[l]:gu[l]}function $u(l){return yu[l]}const Mu=[{token:"LLLL",format:l=>al(l.getMonth(),"wide")},{token:"LLL",format:l=>al(l.getMonth(),"abbreviated")},{token:"EE",format:l=>$u(l.getDay())},{token:"yyyy",format:l=>String(l.getFullYear())},{token:"MM",format:l=>zt(l.getMonth()+1)},{token:"dd",format:l=>zt(l.getDate())},{token:"HH",format:l=>zt(l.getHours())},{token:"mm",format:l=>zt(l.getMinutes())}];function Rt(l,t){if(!Se(l))return"";let n="",a=0;for(;a<t.length;){const o=Mu.find(r=>t.startsWith(r.token,a));o?(n+=o.format(l),a+=o.token.length):(n+=t[a],a+=1)}return n}const Du={"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 ol(l,t){const n=Du[t];if(!n){const o=new Date(l);return Se(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 Se(i)?i:null}case"dd.MM.yyyy":{const[,o,r,s]=a,i=new Date(Number(s),Number(r)-1,Number(o));return Se(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 Se(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 Au=["year","month","day","time","custom"],Fu=e.defineComponent({emits:{elementClick:l=>Se(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"&&Au.includes(l)}}}),Iu={class:"v3dp__heading"},Lu=["disabled"],Tu=["disabled"],Ou={class:"v3dp__body"},zu={class:"v3dp__subheading"},Ru={class:"v3dp__elements"},ju=["disabled","onClick"];function Pu(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",Iu,[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,Tu)]),e.createElementVNode("div",Ou,["subheading"in l.$slots?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",zu,[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",Ru,[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,ju))),128))],!0)])])],38)}const jt=ae(Fu,[["render",Pu],["__scopeId","data-v-bc92af04"]]),Uu=e.defineComponent({components:{PickerPopup:jt},emits:{"update:pageDate":l=>Se(l),select:l=>Se(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(()=>bu(l.pageDate)),a=e.computed(()=>wu(l.pageDate)),o=(g,E,y)=>!E&&!y?!0:!(E&&Pe(g)<Pe(E)||y&&Pe(g)>Pe(y)),r=e.computed(()=>vu({start:n.value,end:a.value}).map(g=>({value:g,key:String(Pe(g)),display:Pe(g),selected:!!l.selected&&Pe(g)===Pe(l.selected),disabled:!o(g,l.lowerLimit,l.upperLimit)}))),s=e.computed(()=>{const g=Pe(n.value),E=Pe(a.value);return`${g} - ${E}`}),i=e.computed(()=>l.lowerLimit&&(Tt(l.lowerLimit)===Tt(l.pageDate)||gt(l.pageDate,l.lowerLimit))),c=e.computed(()=>l.upperLimit&&(Tt(l.upperLimit)===Tt(l.pageDate)||yt(l.pageDate,l.upperLimit)));return{years:r,heading:s,leftDisabled:i,rightDisabled:c,previousPage:()=>t("update:pageDate",Xn(l.pageDate,10)),nextPage:()=>t("update:pageDate",Lt(l.pageDate,10))}}});function Hu(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 qu=ae(Uu,[["render",Hu]]),Ku=e.defineComponent({components:{PickerPopup:jt},emits:{"update:pageDate":l=>Se(l),select:l=>Se(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(()=>el(l.pageDate)),o=e.computed(()=>E=>Rt(E,l.format)),r=(E,y,V)=>!y&&!V?!0:!(y&>(E,dn(y))||V&&yt(E,un(V))),s=e.computed(()=>_u({start:n.value,end:a.value}).map(E=>({value:E,display:o.value(E),key:o.value(E),selected:!!l.selected&&fn(l.selected,E),disabled:!r(E,l.lowerLimit,l.upperLimit)}))),i=e.computed(()=>Pe(n.value)),c=e.computed(()=>l.lowerLimit&&(tl(l.lowerLimit,l.pageDate)||gt(l.pageDate,l.lowerLimit))),d=e.computed(()=>l.upperLimit&&(tl(l.upperLimit,l.pageDate)||yt(l.pageDate,l.upperLimit)));return{months:s,heading:i,leftDisabled:c,rightDisabled:d,previousPage:()=>t("update:pageDate",Xn(l.pageDate,1)),nextPage:()=>t("update:pageDate",Lt(l.pageDate,1))}}});function Gu(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 Yu=ae(Ku,[["render",Gu]]),Wu=e.defineComponent({components:{PickerPopup:jt},emits:{"update:pageDate":l=>Se(l),select:l=>Se(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(()=>h=>x=>Rt(x,h)),a=e.computed(()=>dn(l.pageDate)),o=e.computed(()=>un(l.pageDate)),r=e.computed(()=>({start:a.value,end:o.value})),s=e.computed(()=>({start:mn(a.value,l.weekStartsOn),end:Eu(o.value,l.weekStartsOn)})),i=e.computed(()=>l.customWeekdays?.length===7?l.customWeekdays:null),c=e.computed(()=>{const h=l.weekStartsOn,x=i.value;if(x)return Array.from({length:7}).map((w,b)=>x[(h+b)%7]);const k=n.value(l.weekdayFormat);return Array.from(Array(7)).map((w,b)=>(h+b)%7).map(w=>Vu(new Date,w,l.weekStartsOn)).map(k)}),d=(h,x,k,w)=>w?.dates?.some(b=>Ot(h,b))||w?.predicate?.(h)?!1:!x&&!k?!0:!(x&>(h,ot(x))||k&&yt(h,ht(k))),p=e.computed(()=>{const h=new Date,x=n.value(l.format);return xu(s.value).map(k=>({value:k,display:x(k),selected:!!l.selected&&Ot(l.selected,k),current:Ot(h,k),disabled:!l.allowOutsideInterval&&!Cu(k,r.value)||!d(k,l.lowerLimit,l.upperLimit,l.disabledDates),key:n.value("yyyy-MM-dd")(k)}))}),g=e.computed(()=>n.value(l.headingFormat)(l.pageDate)),E=e.computed(()=>l.lowerLimit&&(fn(l.lowerLimit,l.pageDate)||gt(l.pageDate,l.lowerLimit))),y=e.computed(()=>l.upperLimit&&(fn(l.upperLimit,l.pageDate)||yt(l.pageDate,l.upperLimit)));return{weekDays:c,days:p,heading:g,leftDisabled:E,rightDisabled:y,previousPage:()=>t("update:pageDate",ku(l.pageDate)),nextPage:()=>t("update:pageDate",pn(l.pageDate,1))}}});function Zu(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 Ju=ae(Wu,[["render",Zu]]);function rl(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 Xu=e.defineComponent({components:{PickerPopup:jt},emits:{select:l=>Se(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,y=>{let V=0,f=0;y&&(V=y.getHours(),f=y.getMinutes()),r.value=V,s.value=f});const i=e.computed(()=>[...Array(24).keys()].map(y=>({value:y,date:ll(new Date(o.value.getTime()),{hours:y,minutes:s.value,seconds:0}),selected:r.value===y,ref:e.ref(null)}))),c=e.computed(()=>[...Array(60).keys()].map(y=>({value:y,date:ll(new Date(o.value.getTime()),{hours:r.value,minutes:y,seconds:0}),selected:s.value===y,ref:e.ref(null)}))),d=y=>{s.value=y.value,t("select",y.date)},p=()=>{const y=i.value.find(f=>f.ref.value?.classList?.contains("selected")??!1),V=c.value.find(f=>f.ref.value?.classList?.contains("selected")??!1);y&&V&&(rl(n.value,y.ref.value),rl(a.value,V.ref.value))};return e.watch(()=>l.visible,y=>{y&&e.nextTick(p)}),{hoursListRef:n,minutesListRef:a,hours:r,minutes:s,hoursList:i,minutesList:c,padStartZero:y=>`0${y}`.substr(-2),selectMinutes:d,isEnabled:y=>!(l.disabledTime?.dates?.some(V=>nl(y,V)&&Bu(y,V))||l.disabledTime?.predicate?.(y)),scroll:p}}}),Qu={ref:"hoursListRef",class:"v3dp__column"},ep=["disabled","onClick"],tp={ref:"minutesListRef",class:"v3dp__column"},np=["disabled","onClick"];function lp(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",Qu,[(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,ep))),128))],512),e.createElementVNode("div",tp,[(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,np))),128))],512)]),_:1})}const ap=ae(Xu,[["render",lp],["__scopeId","data-v-610b89e1"]]),Pt=["time","day","month","year"],op=(l,t,n=void 0)=>{let a=n||new Date;const o=Su([l,a]);o&&(a=o);const r=Nu([t,a]);return r&&(a=r),a},rp=e.defineComponent({components:{YearPicker:qu,MonthPicker:Yu,DayPicker:Ju,TimePicker:ap},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"&&Pt.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"&&Pt.includes(l)}},emits:{"update:modelValue":l=>l==null||Se(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=F=>{const A=F.replace(/[a-zA-Z]/g,"0");return/0/.test(A)?A:""},d=e.computed(()=>c(l.inputFormat));let p=null,g=null;const E=()=>{p?.destroy(),p=null},y=async()=>{if(!g){const{default:F}=await Promise.resolve().then(()=>bn);g=F}return g},V=()=>{p&&p.value!==i.value&&(p.value=i.value??"")},f=async()=>{if(E(),!r.value||!d.value)return;p=(await y())(r.value,{mask:d.value,lazy:!0,overwrite:!0}),V()};e.watchEffect(()=>{if(!i.value)return;const F=ol(i.value,l.inputFormat);F&&(o.value=F)}),e.watchEffect(()=>{i.value=l.modelValue&&Se(l.modelValue)?Rt(l.modelValue,l.inputFormat):""}),e.onMounted(()=>{d.value&&e.nextTick(()=>{f()})}),e.onBeforeUnmount(()=>{E()}),e.watch(d,F=>{F?e.nextTick(()=>{f()}):E()}),e.watch(i,()=>{V()});const h=(F="none")=>{l.disabled||(F!=="none"&&a.value==="none"&&(o.value=l.modelValue||op(l.lowerLimit,l.upperLimit,o.value)),a.value=F,t(F!=="none"?"opened":"closed"))};e.watchEffect(()=>{l.disabled&&(a.value="none")});const x=(F,A)=>{o.value=A,F==="year"?t("decadePageChanged",A):F==="month"?t("yearPageChanged",A):F==="day"&&t("monthPageChanged",A)},k=F=>{o.value=F,l.minimumView==="year"?(h("none"),t("update:modelValue",F)):a.value="month"},w=F=>{o.value=F,l.minimumView==="month"?(h("none"),t("update:modelValue",F)):a.value="day"},b=F=>{o.value=F,l.minimumView==="day"?(h("none"),t("update:modelValue",F)):a.value="time"},B=F=>{h("none"),t("update:modelValue",F)},$=()=>{l.clearable&&(h("none"),t("update:modelValue",null),o.value=l.startingViewDate)},S=()=>s.value=!0,j=()=>h(T.value),W=()=>{s.value=!1,h()},K=F=>{const A=F.keyCode?F.keyCode:F.which;if([27,13].includes(A)&&r.value.blur(),l.typeable){const P=ol(r.value.value,l.inputFormat);P&&i.value===Rt(P,l.inputFormat)&&(i.value=r.value.value,t("update:modelValue",P))}},T=e.computed(()=>{const F=Pt.indexOf(l.startingView),A=Pt.indexOf(l.minimumView);return F<A?l.minimumView:l.startingView}),z=F=>Object.fromEntries(Object.entries(F??{}).filter(([A,H])=>A.startsWith("--"))),L=e.computed(()=>l.weekDayNames?.length===7?l.weekDayNames:void 0);return{blur:W,focus:j,click:S,input:i,inputRef:r,pageDate:o,renderView:h,updatePageDate:x,selectYear:k,selectMonth:w,selectDay:b,selectTime:B,keyUp:K,normalizedWeekdayNames:L,viewShown:a,goBackFromTimepicker:()=>l.startingView==="time"&&l.minimumView==="time"?null:a.value="day",clearModelValue:$,initialView:T,log:F=>console.log(F),variables:z}}}),sp={class:"v3dp__input_wrapper"},ip=["readonly","placeholder","disabled","tabindex"],cp={class:"v3dp__clearable"};function dp(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",sp,[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,ip),[[e.vModelText,l.input]]),e.withDirectives(e.createElementVNode("div",cp,[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 up=ae(rp,[["render",dp]]),pp=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}=De(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))}),g=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],E=e.computed(()=>{if(n.dayNames?.length)return n.dayNames.length===7?n.dayNames:g}),y=e.computed(()=>{const A=n.weekStart,H=typeof A=="string"?Number(A):A;return H===void 0||Number.isNaN(H)?1:Math.min(6,Math.max(0,H))}),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"},h=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"})),k=e.ref(!1);e.watch(()=>n.modelValue,A=>{A?k.value=!0:n.now||(k.value=!1)},{immediate:!0}),e.watchEffect(()=>{n.now&&!n.modelValue&&!k.value&&(a("update:modelValue",b(new Date,r.value)),k.value=!0)});function w(A,H){if(!A)return null;if(A instanceof Date&&!Number.isNaN(A.getTime()))return A;if(typeof A!="string")return null;switch(H){case"datetime":return j(A);case"time":return T(A);case"month":return W(A);case"year":return K(A);case"week":return z(A);case"date":default:return S(A)}}function b(A,H){if(!A)return null;const P=A instanceof Date?A:w(A,H);if(!P)return null;switch(H){case"datetime":return`${B(P)}T${$(P)}`;case"time":return $(P);case"month":return`${P.getFullYear()}-${F(P.getMonth()+1)}`;case"year":return`${P.getFullYear()}`;case"week":{const{year:pe,week:ke}=L(P);return`${pe}-W${F(ke)}`}case"date":default:return B(P)}}function B(A){return`${A.getFullYear()}-${F(A.getMonth()+1)}-${F(A.getDate())}`}function $(A){return`${F(A.getHours())}:${F(A.getMinutes())}`}function S(A){const H=A.split("-");if(H.length<3)return null;const[P,pe,ke]=H.map(Number);return!P||!pe||!ke?null:new Date(P,pe-1,ke)}function j(A){const H=A.includes("T")?A:A.replace(" ","T"),P=new Date(H);return Number.isNaN(P.getTime())?null:P}function W(A){const[H,P]=A.split("-").map(Number);return!H||Number.isNaN(P)?null:new Date(H,(P||1)-1,1)}function K(A){const H=Number(A);return H?new Date(H,0,1):null}function T(A){const H=A.match(/^(\d{1,2}):(\d{2})$/);if(!H)return null;const[,P,pe]=H,ke=new Date;return ke.setHours(Number(P),Number(pe),0,0),ke}function z(A){const H=A.match(/^(\d{4})-W(\d{2})$/);if(!H)return null;const[,P,pe]=H,ke=Number(pe);return Z(Number(P),ke)}function L(A){const H=new Date(Date.UTC(A.getFullYear(),A.getMonth(),A.getDate())),P=H.getUTCDay()||7;H.setUTCDate(H.getUTCDate()+4-P);const pe=new Date(Date.UTC(H.getUTCFullYear(),0,1)),ke=Math.ceil(((H.getTime()-pe.getTime())/864e5+1)/7);return{year:H.getUTCFullYear(),week:ke}}function Z(A,H){if(!A||!H)return null;const P=new Date(A,0,1+(H-1)*7),pe=P.getDay(),ke=P;return pe<=4?ke.setDate(P.getDate()-P.getDay()+1):ke.setDate(P.getDate()+8-P.getDay()),ke}function F(A){return String(A).padStart(2,"0")}return(A,H)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vs-date-picker",n.customClass]),style:e.normalizeStyle(x.value)},[e.createVNode(up,{modelValue:p.value,"onUpdate:modelValue":H[0]||(H[0]=P=>p.value=P),placeholder:i.value,disabled:n.disabled,clearable:n.clearable,typeable:n.editable,"week-day-names":E.value,"week-starts-on":y.value,"starting-view":V.value.startingView,"minimum-view":V.value.minimumView,"input-format":h.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-a65a2ac3"]]),sl=(l={mode:"edit",schema:null})=>new Promise(t=>{const{close:n}=he.modal({title:l.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Jn,contentProps:{...l,onClose:()=>{t(null),n()},onSave:a=>{t(a),n()}}})});Je.install=function(t){t.component("VForm",Je),Object.assign(t.config.globalProperties,{$form:sl}),t.provide("form",sl),window.v3plugin||(window.v3plugin={})};function Qe(l){return typeof l=="string"||l instanceof String}function il(l){var t;return typeof l=="object"&&l!=null&&(l==null||(t=l.constructor)==null?void 0:t.name)==="Object"}function cl(l,t){return Array.isArray(t)?cl(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 dl(l){switch(l){case Q.LEFT:return Q.FORCE_LEFT;case Q.RIGHT:return Q.FORCE_RIGHT;default:return l}}function hn(l){return l.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Ut(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(!Ut(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(!Ut(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 mp{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 ul(l){if(l==null)throw new Error("mask property should be defined");return l instanceof RegExp?se.MaskedRegExp:Qe(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 ut(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}:il(l)&&l.mask instanceof se.Masked?l:{};if(t){const a=t.mask;return{...cl(t,(o,r)=>!r.startsWith("_")),mask:t.constructor,_mask:a,...n}}}return il(l)?{...l}:{mask:l}}function Ge(l){if(se.Masked&&l instanceof se.Masked)return l;const t=ut(l),n=ul(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=Ge;class Ht{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=Ht;const pl=90,fp=89;class kt extends Ht{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===pl&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===fp&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===pl&&(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=kt;class ml extends kt{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=kt;class gn extends kt{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=gn;class qt{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>qt.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}}qt.MAX_LENGTH=100;class fl{constructor(t,n){this.el=t instanceof Ht?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new gn(t):new ml(t),this.masked=Ge(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new qt,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===ul(t)){this.masked.updateOptions({mask:t});return}const n=t instanceof se.Masked?t:Ge({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 mp({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=fl;class de{static normalize(t){return Array.isArray(t)?t:[t,new de]}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=de;class Ye{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 Ne{constructor(t){this._value="",this._update({...Ne.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 Ye(this.extractInput(t,n),t)}appendTail(t){return Qe(t)&&(t=new Ye(String(t))),t.appendTo(this)}_appendCharRaw(t,n){return t?(this._value+=t,new de({inserted:t,rawInserted:t})):new de}_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 de,this.state=o,a&&s&&(a.state=s))}return r}_appendPlaceholder(){return new de}_appendEager(){return new de}append(t,n,a){if(!Qe(t))throw new Error("value should be string");const o=Qe(a)?new Ye(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 de}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={}),de.normalize(this.prepare?this.prepare(t,this,n):t)}doPrepareChar(t,n){return n===void 0&&(n={}),de.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=dl(o),d=this.extractInput(0,s,{raw:!0}));let p=t;const g=new de;if(o!==Q.NONE&&(p=this.nearestInputPos(t,n>1&&t!==0&&!c?Q.NONE:o),g.tailShift=p-t),g.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);)g.aggregate(new de({tailShift:-1})).aggregate(this.remove(E-1))}else o===Q.FORCE_RIGHT&&i.unshift();return g.aggregate(this.append(a,r,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!Ut(this,t)}typedValueEquals(t){const n=this.typedValue;return t===n||Ne.EMPTY_VALUES.includes(t)&&Ne.EMPTY_VALUES.includes(n)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new de}}Ne.DEFAULTS={skipInvalid:!0},Ne.EMPTY_VALUES=[void 0,null,""],se.Masked=Ne;class et{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=Qe(t)?new Ye(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 Ye)a?n.extend(t.toString()):this.chunks.push(t);else if(t instanceof et){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 Ye(this.toString()).appendTo(t);const n=new de;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 et||t._stops.indexOf(s)>=0)&&n.aggregate(t._appendPlaceholder(s)),i=o instanceof et&&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 et:new Ye;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 hp{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 yn{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 de}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 de;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 de({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 de;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new Ye("")}appendTail(t){return Qe(t)&&(t=new Ye(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 bt{constructor(t){const{parent:n,isOptional:a,placeholderChar:o,displayChar:r,lazy:s,eager:i,...c}=t;this.masked=Ge(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 de}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 de;const a=this.masked.state;let o=this.masked._appendChar(t,this.currentMaskFlags(n));return o.inserted&&this.doValidate(n)===!1&&(o=new de,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 de:(this.isFilled=!0,new de({inserted:this.placeholderChar}))}_appendEager(){return new de}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 de}}bt.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 hl extends Ne{updateOptions(t){super.updateOptions(t)}_update(t){const n=t.mask;n&&(t.validate=a=>a.search(n)>=0),super._update(t)}}se.MaskedRegExp=hl;class $e extends Ne{constructor(t){super({...$e.DEFAULTS,...t,definitions:Object.assign({},bt.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,y)=>y.length-E.length);const g=p[0];if(g){const{expose:E,repeat:y,...V}=ut(this.blocks[g]),f={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...V,repeat:y,parent:this},h=y!=null?new se.RepeatBlock(f):Ge(f);h&&(this._blocks.push(h),E&&(this.exposeBlock=h),this._maskedBlocks[g]||(this._maskedBlocks[g]=[]),this._maskedBlocks[g].push(this._blocks.length-1)),r+=g.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 bt({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...ut(t[s]),parent:this}):new yn({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 de;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 de;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 et;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 et&&(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 de;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 hp(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 de;return this._forEachBlocksInRange(0,this.displayValue.length,a=>n.aggregate(a.pad(t))),n}}$e.DEFAULTS={...Ne.DEFAULTS,lazy:!0,placeholderChar:"_"},$e.STOP_CHAR="`",$e.ESCAPE_CHAR="\\",$e.InputDefinition=bt,$e.FixedDefinition=yn,se.MaskedPattern=$e;class wt 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 de;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=wt;const gp="d{.}`m{.}`Y";class We extends $e{static extractPatternOptions(t){const{mask:n,pattern:a,...o}=t;return{...o,mask:Qe(n)?n:a}}constructor(t){super(We.extractPatternOptions({...We.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:n,pattern:a,blocks:o,...r}={...We.DEFAULTS,...t},s=Object.assign({},We.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:Qe(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(We.extractPatternOptions(t))}}We.GET_DEFAULT_BLOCKS=()=>({d:{mask:wt,from:1,to:31,maxLength:2},m:{mask:wt,from:1,to:12,maxLength:2},Y:{mask:wt,from:1900,to:9999}}),We.DEFAULTS={...$e.DEFAULTS,mask:Date,pattern:gp,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=We;class xt extends Ne{constructor(t){super({...xt.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}=ut(n),r=Ge({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 de,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 de;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 de;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 Ut(n,r)&&n.maskEquals(o)}):super.maskEquals(t)}typedValueEquals(t){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(t))}}xt.DEFAULTS={...Ne.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=xt;class _t extends $e{constructor(t){super({..._t.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 de({skip:!this.isComplete})}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new Ye("",t)}remove(t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),t===n)return new de;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}}_t.DEFAULTS={...$e.DEFAULTS,matchValue:(l,t,n)=>l.indexOf(t,n)===n},se.MaskedEnum=_t;class gl extends Ne{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}se.MaskedFunction=gl;var yl;class Le extends Ne{constructor(t){super({...Le.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",a=(this.scale?"("+hn(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+n+a),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(hn).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(hn(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(Le.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 de({inserted:this._value.slice(r.length),rawInserted:c?"":t,skip:c}):(this._value=r,d=new de),this._value=this._insertThousandsSeparators(this._value);const p=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,g=this._separatorsCountFromSlice(p);return d.tailShift+=(g-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 de({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===Le.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,Le.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(Le.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)||Le.EMPTY_VALUES.includes(t)&&Le.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}yl=Le,Le.UNMASKED_RADIX=".",Le.EMPTY_VALUES=[...Ne.EMPTY_VALUES,0],Le.DEFAULTS={...Ne.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[yl.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=Le;const Kt={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function kn(l,t,n){t===void 0&&(t=Kt.MASKED),n===void 0&&(n=Kt.MASKED);const a=Ge(l);return o=>a.runIsolated(r=>(r[t]=o,r[n]))}function kl(l,t,n,a){return kn(t,n,a)(l)}se.PIPE_TYPE=Kt,se.createPipe=kn,se.pipe=kl;class bl 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}=ut(t);this._blockOpts=Object.assign({},this._blockOpts,s);const i=Ge(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(Ge(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,n){n===void 0&&(n={});const a=new de;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 g=d._appendChar(t,{...n,_beforeTailState:(i=n._beforeTailState)==null||(i=i._blocks)==null?void 0:i[c]});if(g.skip&&p){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(a.aggregate(g),g.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=bl;try{globalThis.IMask=se}catch{}const bn=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:de,ChunksTailDetails:et,DIRECTION:Q,HTMLContenteditableMaskElement:gn,HTMLInputMaskElement:ml,HTMLMaskElement:kt,InputMask:fl,MaskElement:Ht,Masked:Ne,MaskedDate:We,MaskedDynamic:xt,MaskedEnum:_t,MaskedFunction:gl,MaskedNumber:Le,MaskedPattern:$e,MaskedRange:wt,MaskedRegExp:hl,PIPE_TYPE:Kt,PatternFixedDefinition:yn,PatternInputDefinition:bt,RepeatBlock:bl,createMask:Ge,createPipe:kn,default:se,forceDirection:dl,normalizeOpts:ut,pipe:kl},Symbol.toStringTag,{value:"Module"}));ce.ModalEdit=Jn,ce.VForm=Je,ce.VsInputAddress=Hn,ce.VsInputArray=Un,ce.VsInputArraySelect=Ft,ce.VsInputCheckbox=vn,ce.VsInputCodegen=On,ce.VsInputColor=jn,ce.VsInputContainer=Mn,ce.VsInputDate=pp,ce.VsInputEmail=en,ce.VsInputFile=Sn,ce.VsInputFileList=Nn,ce.VsInputKeyValue=zn,ce.VsInputMask=Qt,ce.VsInputMonaco=Kn,ce.VsInputNumber=_n,ce.VsInputRadio=nn,ce.VsInputRange=Pn,ce.VsInputRichtext=An,ce.VsInputSelect=rn,ce.VsInputSlug=Tn,ce.VsInputStatic=Xt,ce.VsInputSwitcher=Jt,ce.VsInputTag=Ln,ce.VsInputTel=tn,ce.VsInputText=it,ce.VsInputTextArray=Rn,ce.VsInputTextarea=Dn,ce.default=Je,ce.inputs=Gn,ce.vsInputDatatable=Fn,ce.vsInputMap=In,Object.defineProperties(ce,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|