@opengis/form 0.0.114 → 0.0.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/inputs/index.d.ts +1 -0
- package/dist/components/inputs/index.d.ts.map +1 -1
- package/dist/components/inputs/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.js +2809 -2804
- 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(de,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@opengis/core"),require("lucide-vue-next")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core","lucide-vue-next"],e):(de=typeof globalThis<"u"?globalThis:de||self,e(de.FormBuilder={},de.Vue,de.OpenGISCore,de.lucide))})(this,(function(de,e,he,bl){"use strict";const xn=e.defineComponent({__name:"vs-info-tooltip",props:{text:{}},setup(l){const t=l,n=e.ref(!1),a=e.ref({top:"0px",left:"0px"});function o(s){if(!t.text)return;const i=s.currentTarget.getBoundingClientRect();a.value={top:`${i.bottom+4}px`,left:`${Math.min(i.left,window.innerWidth-230)}px`},n.value=!0}function r(){n.value=!1}return(s,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("span",{class:"inline-flex items-center",onMouseenter:o,onMouseleave:r},[e.renderSlot(s.$slots,"default",{},()=>[i[0]||(i[0]=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"text-gray-400 cursor-help"},[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),e.createElementVNode("path",{d:"M12 16v-4"}),e.createElementVNode("path",{d:"M12 8h.01"})],-1))])],32),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.value&&l.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(a.value),class:"fixed z-[9999] max-w-xs p-2 bg-gray-900 text-white text-xs rounded-lg shadow-lg pointer-events-none"},e.toDisplayString(l.text),5)):e.createCommentVNode("",!0)]))],64))}}),wl={class:"w-full relative"},xl={key:0,class:"text-[14px] font-medium text-gray-900 mb-2 flex items-center gap-1"},_l={class:"opacity-100"},vl={key:0,class:"text-red-500 text-[14px]"},El={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Vl=e.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){const t=l,n=e.computed(()=>typeof t.item?.label=="string"&&t.item.label?t.item.label:t.item?.ua||t.label||t.ua),a=e.computed(()=>!!n.value),o=e.computed(()=>!!t.item?.rules?.includes("required")),r=e.computed(()=>t.item?.info||"");return(s,i)=>(e.openBlock(),e.createElementBlock("div",wl,[a.value?(e.openBlock(),e.createElementBlock("div",xl,[e.createElementVNode("span",_l,e.toDisplayString(n.value),1),o.value?(e.openBlock(),e.createElementBlock("span",vl,"*")):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createBlock(xn,{key:1,text:r.value},null,8,["text"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"default",e.mergeProps(s.$attrs,{class:{"opacity-60":l.item.disabled}})),l.error?(e.openBlock(),e.createElementBlock("span",El,e.toDisplayString(l.error),1)):e.createCommentVNode("",!0)]))}}),Cl={class:"w-full relative flex flex-row items-center gap-2"},Bl={key:0,class:"text-red-500 text-[14px]"},Sl={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Nl=e.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{default:()=>({container:12,label:3})}},setup(l){const t=l,n=e.computed(()=>t.item?.label||t.label||t.ua),a=e.computed(()=>t.item?.info||""),o=e.computed(()=>t.columns??{container:12,label:3}),r=e.computed(()=>{const{container:d,label:p}=o.value;return!d||d<=0?0:Math.min(Math.max(p??0,0),d)/d}),s=e.computed(()=>t.item?.type==="html"||r.value<=0?!1:!!n.value),i=e.computed(()=>{if(!s.value)return{};const d=`${r.value*100}%`;return{flexBasis:d,maxWidth:d}}),c=e.computed(()=>{const{container:d,label:p}=o.value;if(!d||d<=0)return{};if(t.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!s.value)return{flexBasis:"100%",maxWidth:"100%"};const g=Math.max(d-Math.max(p??0,0),0)/d;if(!g)return{};const V=`${g*100}%`;return{flexBasis:V,maxWidth:V}});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),l.item?.rules?.includes("required")&&n.value?(e.openBlock(),e.createElementBlock("span",Bl,"*")):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createBlock(xn,{key:1,text:a.value},null,8,["text"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"flex-1 min-w-0",style:e.normalizeStyle(c.value)},[e.renderSlot(d.$slots,"default",e.normalizeProps(e.guardReactiveProps(d.$attrs)))],4),l.error?(e.openBlock(),e.createElementBlock("span",Sl,e.toDisplayString(l.error),1)):e.createCommentVNode("",!0)]))}}),$l={class:"w-full relative"},Ml={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Dl=e.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",$l,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),l.error?(e.openBlock(),e.createElementBlock("span",Ml,e.toDisplayString(l.error),1)):e.createCommentVNode("",!0)]))}}),Al={class:"flex-1 min-w-0"},Fl={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},Ll={class:"truncate"},Il={key:0,class:"text-red-500 text-[14px]"},Tl=["innerHTML"],Ol={key:0,class:"mt-1 text-xs text-red-500"},zl={default:Vl,horizontal:Nl,inline:Dl,settings:e.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){const t=l,n=e.ref("uk");e.computed(()=>(t.item??{})?.[n.value]??t.ua??t.label??"");const a=e.computed(()=>t.item?.description??""),o=e.computed(()=>Array.isArray(t.item?.rules)&&t.item.rules.includes("required")),r=e.computed(()=>(typeof t.error=="string"?t.error:"")??""),s=()=>{const i=typeof localStorage<"u"?localStorage.getItem("locale"):null;n.value=i||"uk"};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(n.value=localStorage.locale)}catch{}window.addEventListener("storage",s)}),e.onUnmounted(()=>{window.removeEventListener("storage",s)}),(i,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":l.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(l.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",Al,[l.ua||l.label?(e.openBlock(),e.createElementBlock("p",Fl,[e.createElementVNode("span",Ll,e.toDisplayString(l.item[n.value]||l.ua||l.label),1),o.value?(e.openBlock(),e.createElementBlock("span",Il,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createElementBlock("p",{key:1,class:"text-xs text-slate-500 dark:text-slate-400",innerHTML:a.value},null,8,Tl)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["w-full",["select","native-select"].includes(l.item.type)?"md:w-[30%]":"md:w-auto"])},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],2)],2),r.value?(e.openBlock(),e.createElementBlock("p",Ol,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0)],2))}})};function 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 Rl=["placeholder","disabled"],jl=e.defineComponent({__name:"vs-input-password",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=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":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Rl)),[[e.vModelText,a.value]])}}),Pl=["placeholder","disabled","maxlength","minlength"],tt=e.defineComponent({__name:"vs-input-text",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=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]=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",[l.customClass,e.unref(n),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Pl)),[[e.vModelText,a.value]])}}),Ul=["placeholder","disabled","min","max"],_n=e.defineComponent({__name:"vs-input-number",props:e.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=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:l.placeholder,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"},min:l.min,max:l.max},null,10,Ul)),[[e.vModelText,a.value]])}}),ae=(l,t)=>{const n=l.__vccOpts||l;for(const[a,o]of t)n[a]=o;return n},Hl={},ql={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function Kl(l,t){return e.openBlock(),e.createElementBlock("svg",ql,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)])])}const Gl=ae(Hl,[["render",Kl]]),Yl={class:"flex items-center gap-[4px]"},Wl=["value","id","disabled"],Zl=["for"],Jl={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},Xl=e.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=t,a=l,o=e.computed({get:()=>a.modelValue,set:s=>n("update:modelValue",s)}),r=e.computed(()=>!!a.disabled);return(s,i)=>(e.openBlock(),e.createElementBlock("div",Yl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:l.value,"onUpdate:modelValue":i[0]||(i[0]=c=>o.value=c),class:e.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":r.value}]),id:l.id,disabled:r.value},null,10,Wl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:l.id,class:e.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":r.value}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[o.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",l.error?"border-red-600":""]])},[e.createVNode(Gl,{height:"12",width:"12"})],2),e.createElementVNode("span",Jl,[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.label),1)])])],10,Zl)]))}}),Ql=["name","value","disabled"],ea={class:"flex items-center gap-[6px] text-[14px]"},ta={key:0,class:"text-[16px]"},na=["src"],la=e.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.computed({get:()=>n.modelValue,set:i=>{a("update:modelValue",i)}}),r=e.computed(()=>Array.isArray(o.value)?o.value.includes(n.value):o.value===!0||o.value===n.value),s=e.computed(()=>n.style?.size==="xs"?"p-1.5 text-xs":n.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(i,c)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[s.value,r.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"hidden",name:l.id,value:l.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),disabled:l.disabled},null,8,Ql),[[e.vModelCheckbox,o.value]]),e.createElementVNode("span",ea,[l.icon||l.imgUrl?(e.openBlock(),e.createElementBlock("span",ta,[l.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(l.icon)},null,2)):e.createCommentVNode("",!0),l.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:1,src:l.imgUrl,width:"16",height:"16",alt:"icon"},null,8,na)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.label),1)])])],2))}}),aa={class:"flex items-center"},Yt=e.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=`radio-${Math.floor(Math.random()*1e4)}`,r=e.computed({get:()=>Array.isArray(n.modelValue)?Array.isArray(n.modelValue)&&n.modelValue.includes(n.value):n.modelValue,set:i=>{if(Array.isArray(n.modelValue)){let c=[...n.modelValue];i?c.includes(n.value)||c.push(n.value):c=c.filter(d=>d!==n.value),a("update:modelValue",c)}else a("update:modelValue",i)}}),s=e.ref(`vs-checkbox-${n.view||"default"}`);return(i,c)=>(e.openBlock(),e.createElementBlock("div",aa,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value==="vs-checkbox-buttons"?e.unref(la):e.unref(Xl)),{value:l.value,label:l.label,info:l.option?.info,disabled:l.disabled,modelValue:r.value,"onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),id:o,icon:l.icon,imgUrl:l.imgUrl,style:e.normalizeStyle(l.style),error:l.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),oa={},ra={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function sa(l,t){return e.openBlock(),e.createElementBlock("svg",ra,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)])])}const Wt=ae(oa,[["render",sa]]),ia={},ca={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function da(l,t){return e.openBlock(),e.createElementBlock("svg",ca,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),e.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])])}const Ct=ae(ia,[["render",da]]),ua={},pa={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function ma(l,t){return e.openBlock(),e.createElementBlock("svg",pa,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M12 9h.01"},null,-1),e.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),e.createElementVNode("path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z"},null,-1)])])}const fa=ae(ua,[["render",ma]]),ha={key:0,class:"flex items-start gap-x-1"},ga={key:0,class:"text-red-500 text-[14px]"},ya=["title"],ka=["disabled"],Zt=e.defineComponent({__name:"vs-input-switcher",props:e.mergeModels({rules:{default:()=>[]},view:{default:"checkbox"},label:{default:""},i:{default:""},text:{default:""},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue");return(a,o)=>t.view==="checkbox"?(e.openBlock(),e.createElementBlock("div",ha,[e.createVNode(Yt,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),label:l.text,error:l.error||""},null,8,["modelValue","label","error"]),l.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",ga,"*")):e.createCommentVNode("",!0),l.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:l.i,onClick:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(fa),{class:"text-gray-500 w-[14px] h-[14px]"})],8,ya)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[n.value?`bg-${l.style?.primaryColor||"blue"}-500`:"bg-stone-200",l.customClass]]),disabled:l.disabled,onClick:o[2]||(o[2]=r=>n.value=!n.value)},[e.createElementVNode("span",{"data-state":"checked",class:e.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[n.value?"translate-x-4":"translate-x-0"]])},null,2)],10,ka))}}),ba=["id","innerHTML"],Jt=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",{id:l.name,class:e.normalizeClass(["text-gray-900",l.customClass]),innerHTML:l.html?l.html:l.text},null,10,ba))}}),wa=["placeholder","disabled","name"],Xt=e.defineComponent({__name:"vs-input-mask",props:e.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=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 g={};return Object.keys(c).forEach(V=>{d.has(V)||(g[V]=c[V])}),{mask:i,definitions:g,lazy:!1}}return e.onMounted(async()=>{if(o.value){const{default:i}=await Promise.resolve().then(()=>kn),c=s(t.mask||"");r=i(o.value,c),r.on("accept",()=>{a.value=t.unmask?r.unmaskedValue:r.value}),r.on("complete",()=>{a.value=t.unmask?r.unmaskedValue:r.value}),r.value=a.value!=null?String(a.value):""}}),e.onBeforeUnmount(()=>{r?.destroy()}),e.watch(()=>t.mask,i=>{if(r){const c=s(i||"");r.updateOptions(c)}}),e.watch(a,i=>{r&&r.unmaskedValue!==i&&(r.value=i!=null?String(i):"")}),(i,c)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:l.placeholder,disabled:l.disabled,name:l.name,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,10,wa))}}),xa={class:"relative w-full bg-white rounded-lg"},_a=["placeholder","disabled"],Qt=e.defineComponent({__name:"vs-input-email",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=Ne(t.style),a=e.useModel(l,"modelValue");return(o,r)=>(e.openBlock(),e.createElementBlock("div",xa,[r[1]||(r[1]=e.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),e.withDirectives(e.createElementVNode("input",{type:"email","onUpdate:modelValue":r[0]||(r[0]=s=>a.value=s),placeholder:l.placeholder,disabled:l.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,_a),[[e.vModelText,a.value]])]))}}),va={class:"relative w-full bg-white rounded-lg"},Ea=["value","placeholder","disabled"],en=e.defineComponent({__name:"vs-input-tel",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=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",va,[c[0]||(c[0]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"stroke-gray-500 transition-all"},[e.createElementVNode("path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"})])],-1)),c[1]||(c[1]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[30px] text-gray-500 select-none pointer-events-none"}," + ",-1)),e.createElementVNode("input",{type:"tel",value:o.value,onInput:r,onBeforeinput:s,pattern:"^\\+[1-9]\\d{1,14}$",maxlength:"15",placeholder:l.placeholder,disabled:l.disabled,class:e.normalizeClass(["!pl-10 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Ea)]))}}),Va=["value","disabled"],Ca={class:"text-[13px] text-gray-700"},Ba=e.defineComponent({__name:"vs-input-radio-default",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>!!t.disabled);return(o,r)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center gap-0",[t.customClass,a.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:"radio",value:t.value,disabled:a.value,class:"hidden"},null,8,Va),[[e.vModelRadio,n.value]]),e.createElementVNode("span",{class:e.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${t.style?.primaryColor||"blue"}-500`,a.value?"opacity-50 cursor-not-allowed":""]])},[n.value==t.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${t.style?.primaryColor||"blue"}-500`]])},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",Ca,e.toDisplayString(t.text),1)],2))}}),Sa=["value","disabled"],Na={class:"text-[13px] text-gray-700"},$a={"vs-input-radio-default":Ba,"vs-input-radio-buttons":e.defineComponent({__name:"vs-input-radio-buttons",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>!!t.disabled);return(o,r)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[n.value==t.value?`ring-2 ring-ring ring-${t.style?.primaryColor||"blue"}-500`:"",t.customClass,a.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:"radio",value:t.value,disabled:a.value,class:"hidden"},null,8,Sa),[[e.vModelRadio,n.value]]),e.createElementVNode("span",Na,e.toDisplayString(t.text),1)],2))}})},tn=e.defineComponent({__name:"vs-input-radio",props:e.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>$a[`vs-input-radio-${t.view}`]);return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([l.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options,s=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),e.mergeProps({key:s?.id,text:s.text,value:s.id.toString(),checked:n.value===s.id,modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=i=>n.value=i)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),Ma={key:1,class:"w-full flex flex-col gap-4"},Da={key:0,class:"text-sm font-medium text-muted-foreground my-2"},Aa="Без категорії",vn=ae(e.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},group:{default:void 0},values:{default:()=>[]},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.ref([]),r=e.reactive({}),s=k=>k?.value||k?.id||k?.text||k,i=k=>k.text||String(k),c=k=>`lg:col-span-${k||12}`,d=e.computed(()=>[n.position==="vertical"?"flex flex-col":"",n.colSpan?"grid":"flex justify-start"]),p=k=>k==null||k===""?null:typeof k=="string"||typeof k=="number"?k:String(k),g=e.computed(()=>{if(!n.group)return[];const k=new Map;o.value.forEach(y=>{const w=y[n.group],b=p(w);k.has(b)||k.set(b,[]),k.get(b)?.push(y)});const v=[];n.values?.length&&n.values.forEach(y=>{const w=p(y);v.push(w)});const f=new Set,h=y=>{const w=k.get(y)||[];if(!w.length)return null;const b=y===null?"group-null":`group-${String(y)}`,S=y===null?Aa:String(y);return f.add(y),{key:b,label:S,options:w}},x=[];return v.forEach(y=>{const w=h(y);w&&x.push(w)}),k.forEach((y,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",Ma,[(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",Da,e.toDisplayString(f.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.options,h=>(e.openBlock(),e.createBlock(Yt,{modelValue:r[s(h)],"onUpdate:modelValue":x=>r[s(h)]=x,value:s(h),class:e.normalizeClass(c(l.colSpan)),disabled:n.disabled||h.disabled,label:i(h),key:`${f.key}-${s(h)}`,icon:h?.icon,imgUrl:h?.imgUrl,option:h,view:l.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),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(l.colSpan)),disabled:n.disabled||f.disabled,label:i(f),key:s(f),icon:f?.icon,imgUrl:f?.imgUrl,option:f,view:l.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-cf0478ce"]]),Fa=["type","placeholder","disabled"],La=e.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},mode:{default:"date"}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l;function a(p){return p?n.mode==="datetime"?(p.includes("T")?p:null)||p+(p.includes(" ")?"":"T00:00"):p?.split(" ")[0]:null}const{inputClass:o}=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,g)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":g[0]||(g[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",[l.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Fa)),[[e.vModelDynamic,s.value]])}}),Ia=(l,t)=>{if(!t||!Object.keys(t).length)return l;const[n,a=""]=l.split("?"),o=new URLSearchParams(a);Object.entries(t).forEach(([s,i])=>{i==null||i===""||o.set(s,String(i))});const r=o.toString();return r?`${n}?${r}`:n},En=async(l,t={})=>{try{const n=new FormData;n.append("unique","true"),n.append("file",l);const{api:a,id:o="1",form:r="form",table:s="table",customParams:i}=t,c=a||`/file/upload/uploads?id=${o||""}&form=${r||""}&table=${s||""}`,d=Ia(c,i);return(await fetch(d,{method:"POST",body:n}).then(g=>g.json()))?.result}catch(n){return he.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",n),null}},Ta=async l=>{try{return await fetch(`file/delete${l}`),!0}catch(t){return console.error(t),!1}},Vn=async l=>{try{const t=await fetch(`/file/download/files/uploads${l}`),n=await t.arrayBuffer(),a=t.headers["content-type"],o=new TextDecoder("utf-8").decode(n),r=new Blob([o],{type:a}),s=document.createElement("a");s.setAttribute("download",l),s.href=window.URL.createObjectURL(r),s.click()}catch(t){console.error(t.message)}},Oa={},za={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Ra(l,t){return e.openBlock(),e.createElementBlock("svg",za,[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)])])}const ze=ae(Oa,[["render",Ra]]),ja={},Pa={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-text",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function Ua(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Pa,[...t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><line x1="9" y1="9" x2="10" y2="9"></line><line x1="9" y1="13" x2="15" y2="13"></line><line x1="9" y1="17" x2="15" y2="17"></line>',6)])])}const Ha=ae(ja,[["render",Ua]]),qa={},Ka={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-table",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function Ga(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Ka,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),e.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),e.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)])])}const Ya=ae(qa,[["render",Ga]]),Wa={},Za={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Ja(l,t){return e.openBlock(),e.createElementBlock("svg",Za,[...t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M9 9l1 0"></path><path d="M9 13l6 0"></path><path d="M9 17l6 0"></path>',6)])])}const Cn=ae(Wa,[["render",Ja]]),Xa={},Qa={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-zip",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function eo(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Qa,[...t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1"></path><path d="M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2z"></path><line x1="11" y1="5" x2="10" y2="5"></line><line x1="13" y1="7" x2="12" y2="7"></line><line x1="11" y1="9" x2="10" y2="9"></line><line x1="13" y1="11" x2="12" y2="11"></line><line x1="11" y1="13" x2="10" y2="13"></line><line x1="13" y1="15" x2="12" y2="15"></line>',9)])])}const to=ae(Xa,[["render",eo]]),no={},lo={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-code",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function ao(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",lo,[...t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M10 13l-1 2l1 2"></path><path d="M14 13l1 2l-1 2"></path>',5)])])}const oo=ae(no,[["render",ao]]),ro=l=>{if(!l)return"";const t=l?.split(".");return t[t.length-1]},so=l=>{const t=ro(l),n={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return n.imageFormat.includes(t)?"img":n.sheetsFormat.includes(t)?Ya:n.textsFormat.includes(t)?oo:n.documentsFormat.includes(t)?Ha:n.archivesFormat.includes(t)?to:Cn},io={},co={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function uo(l,t){return e.openBlock(),e.createElementBlock("svg",co,[...t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)])])}const nt=ae(io,[["render",uo]]),po={},mo={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function fo(l,t){return e.openBlock(),e.createElementBlock("svg",mo,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const Bn=ae(po,[["render",fo]]),ho=["title"],go={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},nn=ae(e.defineComponent({__name:"vs-input-file-list-item",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(l){const t=e.useModel(l,"value"),n=e.useModel(l,"item"),a=l;return(o,r)=>(e.openBlock(),e.createElementBlock("div",{title:n.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(so)(n.value)),{src:n.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:r[0]||(r[0]=s=>e.unref(Vn)(n.value))},null,8,["src"])),e.createElementVNode("div",go,[e.createElementVNode("button",{type:"button",onClick:r[1]||(r[1]=s=>{e.unref(Ta)(n.value),t.value=a.multiple?t.value?.filter(i=>i!==n.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[e.createVNode(nt,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:r[2]||(r[2]=s=>e.unref(Vn)(n.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[e.createVNode(Bn,{class:"w-4 h-4"})])])],8,ho))}}),[["__scopeId","data-v-b61a9d9a"]]),yo={class:"flex items-center gap-x-2"},ko=["accept","multiple","disabled"],bo={key:1,class:"flex items-center flex-wrap gap-2"},wo={key:1,class:"loader"},xo={key:1,class:"loader"},Sn=ae(e.defineComponent({__name:"vs-input-file",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["change"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=e.useModel(l,"modelValue"),o=t,r=e.ref(null),s=e.ref(!1),i=e.inject("values"),c=e.computed(()=>n.format?n.format.split(",").map(y=>y.trim().toLowerCase()).filter(Boolean):[]),d=y=>Array.isArray(a.value)&&a.value[y]||"",p=y=>{if(n.max_size&&y.size>n.max_size*1024*1024){const w=(y.size/1048576).toFixed(2);return he.notify({type:"error",title:"Помилка!",message:`Файл "${y.name}" занадто великий. Максимальний розмір: ${n.max_size} МБ, розмір файлу: ${w} МБ`,position:"right-bottom"}),!1}return!0},g=y=>{if(!c.value.length)return!0;const w=`.${y.name.split(".").pop()?.toLowerCase()||""}`,b=c.value.includes(w);return b||he.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${y.name}". Дозволені формати: ${c.value.join(", ")}`,position:"right-bottom"}),b},V=e.computed(()=>{const y={},w=[];if(!n.customParams?.length)return{params:y,missingSources:w};const b=i?.value??{};return n.customParams.forEach(S=>{if(!S)return;const[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}y[O]=Y}),{params:y,missingSources:w}}),k=()=>{const{params:y}=V.value;return{api:n.api,customParams:Object.keys(y).length?y:void 0}},v=()=>{const y=V.value.missingSources;if(!y.length)return!0;const w=y.join(", ");return he.notify({type:"warning",title:"Заповніть поля",message:`Поля (${w}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},f=y=>{he.notify({type:"error",title:"Помилка завантаження",message:y||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},h=()=>{n.disabled||s.value||v()&&r.value?.click()},x=async y=>{const{files:w}=y.target;if(!w||w.length===0)return;if(!v()){r.value&&(r.value.value="");return}const b=Array.from(w);if(n.max_size&&b.filter(C=>!p(C)).length>0){r.value&&(r.value.value="");return}if(b.filter(D=>!g(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(y,w)=>(e.openBlock(),e.createElementBlock("div",yo,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:r,type:"file",accept:n.format,multiple:l.multiple,onChange:x,disabled:s.value||l.disabled},null,40,ko),!l.multiple&&a.value?(e.openBlock(),e.createBlock(nn,{key:0,item:a.value,"onUpdate:item":w[0]||(w[0]=b=>a.value=b),value:a.value,"onUpdate:value":w[1]||(w[1]=b=>a.value=b)},null,8,["item","value"])):l.multiple?(e.openBlock(),e.createElementBlock("div",bo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(b,S)=>(e.openBlock(),e.createBlock(nn,{multiple:l.multiple,key:S,value:a.value,"onUpdate:value":w[2]||(w[2]=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",l.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[s.value?(e.openBlock(),e.createElementBlock("div",wo)):(e.openBlock(),e.createBlock(ze,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),l.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:h,class:e.normalizeClass([l.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[s.value?(e.openBlock(),e.createElementBlock("div",xo)):(e.openBlock(),e.createBlock(ze,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-05d41c5c"]]),_o={class:"vs-input-file2 flex flex-col gap-4"},vo={class:"flex items-center gap-x-2"},Eo=["accept","disabled"],Vo={key:0,class:"absolute inset-0 flex flex-col items-center justify-center gap-1 rounded-lg bg-white/90 text-xs font-medium text-slate-600"},Co={key:0,class:"rounded-lg border border-[#CFD9E0] bg-white p-4 shadow-sm"},Bo={class:"flex items-center justify-between text-sm"},So={class:"truncate pr-4"},No={class:"font-medium text-slate-800 truncate"},$o={class:"text-slate-500"},Mo={class:"text-slate-500 whitespace-nowrap"},Do={class:"mt-3 h-2 rounded-full bg-slate-100 overflow-hidden"},Ao={class:"mt-3 flex flex-wrap gap-2 text-sm"},Fo={key:0,class:"mt-2 text-sm text-rose-600"},Lo=e.defineComponent({__name:"vs-input-file2",props:e.mergeModels({format:{},max_size:{},api:{},chunkSize:{default:5*1024*1024},subdir:{default:""},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref(null),o=e.ref(null),r=e.ref(""),s=e.ref(0),i=e.ref(!1),c=e.ref(""),d=e.ref(null),p=e.inject("values"),g=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},y=F=>{if(!g.value.length)return!0;const R=`.${F.name.split(".").pop()?.toLowerCase()||""}`;return g.value.includes(R)?!0:(he.notify({type:"error",title:"Непідтримуваний формат",message:`Дозволені формати: ${g.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)||!y(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"}),I();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,I()},I=()=>{const F=a.value;F&&(F.value=""),o.value=null,r.value="",s.value=0,c.value=""};return(F,R)=>(e.openBlock(),e.createElementBlock("div",_o,[e.createElementVNode("div",vo,[e.createElementVNode("input",{ref_key:"fileInput",ref:a,type:"file",class:"hidden",accept:t.format,disabled:i.value||t.disabled,onChange:S},null,40,Eo),n.value?(e.openBlock(),e.createBlock(nn,{key:0,item:n.value,"onUpdate:item":R[0]||(R[0]=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",Vo,[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",Co,[e.createElementVNode("div",Bo,[e.createElementVNode("div",So,[e.createElementVNode("div",No,e.toDisplayString(o.value.name),1),e.createElementVNode("div",$o,e.toDisplayString(h(o.value.size)),1)]),e.createElementVNode("div",Mo,e.toDisplayString(k.value),1)]),e.createElementVNode("div",Do,[e.createElementVNode("div",{class:"h-full rounded-full bg-blue-500 transition-all duration-300",style:e.normalizeStyle({width:`${V.value}%`})},null,4)]),e.createElementVNode("div",Ao,[!i.value&&s.value>0&&s.value<(o.value?.size||0)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick: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",Fo,e.toDisplayString(c.value),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),ln=ae(Lo,[["__scopeId","data-v-8f52f552"]]),Io={class:"max-w-[55vw]"},To={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},Oo={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},zo={class:"px-[5px]"},Ro={class:""},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",Io,[e.createElementVNode("p",To,e.toDisplayString(l.item?.uploaded_name),1),e.createElementVNode("p",Oo,[e.createElementVNode("span",null,e.toDisplayString(l.item?.username),1),e.withDirectives(e.createElementVNode("span",zo,"|",512),[[e.vShow,l.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(n.value),1),r[0]||(r[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",Ro,e.toDisplayString(a(l.item?.size)),1)])])],64))}}),jo={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},Po={key:0,class:"flex w-full gap-x-3 items-center"},Uo={key:1,class:"flex gap-x-3 w-full items-center"},Ho={key:2,class:"flex gap-x-3 w-full items-center"},qo=["href"],Ko={key:3,class:"flex gap-x-3 w-full items-center"},Go={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},Yo={class:"p-0.5 sm:p-1 inline-flex items-center gap-0.5 bg-white rounded-lg dark:bg-neutral-800 dark:border-neutral-700"},Wo={class:"inline-block"},Zo={class:"inline-block"},Jo=e.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(l,{emit:t}){const n=l,a=t;function o(p){return["pdf","json"].includes(p.ext)}function r(p){return["ppt","pptx","doc","docx","xls","xlsx"].includes(p.ext)}function s(p){const 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",jo,[l.item.ext==="jpg"||l.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",Po,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:g[0]||(g[0]=V=>d(l.index))},[e.createVNode(Bt,{item:l.item},null,8,["item"])])])):o(l.item)?(e.openBlock(),e.createElementBlock("div",Uo,[e.createVNode(Bt,{item:l.item},null,8,["item"])])):r(l.item)?(e.openBlock(),e.createElementBlock("div",Ho,[e.createElementVNode("a",{href:`/api/file-preview?id=${l.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(Bt,{item:l.item},null,8,["item"])],8,qo)])):(e.openBlock(),e.createElementBlock("div",Ko,[e.createVNode(Bt,{item:l.item},null,8,["item"])])),e.createElementVNode("div",Go,[e.createElementVNode("div",Yo,[e.createElementVNode("div",Wo,[e.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:g[1]||(g[1]=V=>s(l.item))},[e.createVNode(Bn,{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",Zo,[e.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:g[2]||(g[2]=V=>c())},[e.createVNode(nt,{height:"14",width:"14"})])])])])]))}}),Xo={},Qo={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function er(l,t){return e.openBlock(),e.createElementBlock("svg",Qo,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const tr=ae(Xo,[["render",er]]),nr={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},lr={class:"flex w-full mb-[12px] items-center gap-x-2"},ar={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},or={class1:"ml-auto"},rr={class:"py-1.5 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg bg-gray-100 cursor-pointer hover:bg-gray-200 text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},sr={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},ir={class:"relative"},cr={key:1,class:"space-y-3 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},dr={key:0},Nn=e.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update"],setup(l,{emit:t}){const n=l,a=e.inject("form"),o=e.computed(()=>a.value.formId),r=e.ref(!1),s=e.ref(0),i=t,c=e.ref(!1),d=e.ref({}),p=e.ref([]),g=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(()=>g.value===""?p.value:p.value.filter(w=>w?.uploaded_name?.includes(g.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},y=w=>{d.value=x(w),c.value=!0};return e.watch(o,w=>{w&&f()}),e.onMounted(()=>{o.value&&f()}),(w,b)=>{const S=e.resolveComponent("Lightbox"),D=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",nr,[e.createElementVNode("div",lr,[e.createElementVNode("h2",ar," Файлів: "+e.toDisplayString(p.value?.length),1),e.createElementVNode("div",or,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:b[0]||(b[0]=C=>h(C))},null,32),e.createElementVNode("div",rr,[e.createVNode(tr,{height:"16",width:"16"})])])])]),p.value?.length>4?(e.openBlock(),e.createElementBlock("div",sr,[e.createElementVNode("div",null,[e.createElementVNode("div",ir,[b[8]||(b[8]=e.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[e.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),e.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":b[1]||(b[1]=C=>g.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,g.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),p.value?.length?(e.openBlock(),e.createElementBlock("div",cr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,(C,O)=>(e.openBlock(),e.createBlock(Jo,{key:O,prefix:l.prefix,item:C,index:O,onUpdate:b[2]||(b[2]=W=>w.$emit("update","file-list")),onOpenModal:b[3]||(b[3]=W=>y(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",dr,[...b[9]||(b[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])]))])):e.createCommentVNode("",!0),e.createVNode(S,{modelValue:r.value,"onUpdate:modelValue":b[5]||(b[5]=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"])])}}}),ur={class:"flex items-center justify-between"},pr={class:"text-[16px] text-gray-900 font-medium"},mr={class:"grid gap-3"},fr=ae(e.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(l){const t=l,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,a=>{n.value=a}),(a,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",ur,[e.createElementVNode("p",pr,e.toDisplayString(l.title),1),e.createVNode(Zt,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),style:e.normalizeStyle(l.style)},null,8,["modelValue","style"])]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",mr,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-00f2f0fc"]]),hr={class:"text-[16px] text-gray-900 font-medium"},gr={class:"grid gap-3"},yr=ae(e.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(l){const t=l,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,a=>{n.value=a}),(a,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("button",{type:"button",onClick:o[0]||(o[0]=r=>n.value=!n.value),class:"flex items-center gap-2"},[e.createVNode(e.unref(Wt),{class:e.normalizeClass(["h-4 w-4 duration-300",[n.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",hr,e.toDisplayString(l.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",gr,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-78778cb5"]]),kr={class:"flex items-center justify-between"},br={switcher:fr,accordion:yr,default:e.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",kr,[e.createElementVNode("p",null,e.toDisplayString(l.title),1)]),e.renderSlot(t.$slots,"default")]))}})},Fe={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},wr=(l,t)=>String(l)===String(t),xr=(l,t)=>String(l)!==String(t),_r=(l,t)=>l>t,vr=(l,t)=>l>=t,Er=(l,t)=>l<t,Vr=(l,t)=>l<=t,Cr=(l,t)=>Array.isArray(t)&&t.length===2?l>=t[0]&&l<=t[1]:!1,Br=(l,t)=>String(l).startsWith(String(t)),Sr=(l,t)=>String(l).endsWith(String(t)),Nr=(l,t)=>String(l).includes(String(t)),$r=(l,t)=>Array.isArray(t)?t.includes(l):!1,Mr=(l,t)=>Array.isArray(t)?!t.includes(l):!0,$n=(l,t)=>{if(!t)return!0;switch(t?.[1]){case Fe.Equal:return wr(l,t?.[2]);case Fe.Inequal:return xr(l,t?.[2]);case Fe.Higer:return _r(l,t?.[2]);case Fe.HigerOrEqual:return vr(l,t?.[2]);case Fe.Lower:return Er(l,t?.[2]);case Fe.LowerOrEqual:return Vr(l,t?.[2]);case Fe.Between:return Cr(l,t?.[2]);case Fe.StartWith:return Br(l,t?.[2]);case Fe.EndWith:return Sr(l,t?.[2]);case Fe.Contain:return Nr(l,t?.[2]);case Fe.In:return $r(l,t?.[2]);case Fe.NotIn:return Mr(l,t?.[2]);default:return!0}},Mn=e.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(l){const t=l,n=e.inject("values",e.ref({})),a=e.inject("form"),o=e.computed(()=>t.schema?.filter(i=>{const c=i?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,p=t.name?n.value?.[t.name]?.[d]??n.value?.[d]:n.value?.[d];return $n(p,c)})),r=e.computed(()=>br[t.view]),s=e.computed(()=>{if(n.value||(n.value={}),!t.name)return n.value;const i=n.value[t.name];if(i)return i;const c={};return n.value={...n.value,[t.name]:c},c});return(i,c)=>l.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{key:0,title:l.title,style:e.normalizeStyle(l.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,d=>(e.openBlock(),e.createBlock(Gn,e.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:s.value[d.name],"onUpdate:modelValue":p=>s.value[d.name]=p,style:l.style,error:e.unref(a)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),Dr=["aria-expanded","data-focus"],Ar={class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full"},Fr={key:0,class:"flex flex-nowrap items-center gap-1 overflow-x-auto overflow-y-hidden min-w-0 flex-1 py-0.5"},Lr={class:"flex items-center gap-1 min-w-0"},Ir=["title"],Tr=["innerHTML"],Or=["onClick"],zr={class:"flex-1 min-w-[2px]"},Rr=["placeholder"],jr=["title"],Pr=["innerHTML"],Ur={key:3,class:"truncate flex-1 min-w-0"},Hr={key:2,class:"flex-1 min-w-[2px]"},qr=["placeholder"],Kr={class:"flex items-center shrink-0"},Gr=["disabled"],Yr=["disabled","title"],Wr=["aria-disabled","onClick"],Zr=["innerHTML"],Jr={key:1,class:"px-3 py-2 text-center text-gray-500"},Xr=["disabled"],an="w-[16px] h-[16px] flex items-center justify-center flex-shrink-0 text-current",on=ae(e.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},start:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{},maxlength:{},minlength:{}},emits:["change","update:modelValue","value-selected"],setup(l,{emit:t}){const n=l,a=t,o=e.computed(()=>n.multiple),r=e.computed(()=>n.disabled);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),g=e.ref(!1),V=e.ref(!1),k=e.ref(null),v=e.ref([]),f=e.ref(-1),h=e.ref([]),x=e.ref(""),y=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(L=>[L.id?.toString(),L]));return S.value.map(L=>M.get(L?.toString())).filter(L=>!!L)}),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(),I=e.computed(()=>{let E=v.value??[];if(!n.data&&x.value.trim()!==""){const M=x.value.toLowerCase();E=E.filter(L=>{const ee=q(L).toLowerCase(),ge=L.text?.toLowerCase?.()||"";return ee.includes(M)||ge.includes(M)})}if(o.value&&S.value.length){const M=new Set(S.value.map(L=>L?.toString()));E=E.filter(L=>!M.has(L.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,(L,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 L=Z(E);return T(L)||E.text||""},me=new Map,pe=bl.icons,Ae=E=>E.replace(/^([A-Z])|[\s-_]+(\w)/g,(M,L,ee)=>ee?ee.toUpperCase():L.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,L)=>{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,L);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(([L,ee])=>{if(!L)return;const ge=E?E[ee]:null,be=L.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)})},$=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 L=E.toLowerCase();M=M.filter(ee=>{const ge=q(ee).toLowerCase(),be=ee.text?.toLowerCase?.()||"";return ge.includes(L)||be.includes(L)})}return M}try{const M=n.host??"",L=n.prefix??"api",ee=n.api??`/${L}/suggest/${n.data}`,ge=`${M}${ee}`,be=new URLSearchParams;return be.set("json","1"),E&&be.set("key",E),$.value!==void 0&&$.value!==null&&$.value!==""&&be.set("parent",$.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(L=>L?.id?.toString()===String(E));if(M)return M;if(n.data)try{const L=n.host??"",ee=n.prefix??"api",ge=n.api??`/${ee}/suggest/${n.data}`,be=`${L}${ge}`,we=new URLSearchParams;return we.set("json","1"),we.set("val",String(E)),$.value!==void 0&&$.value!==null&&$.value!==""&&we.set("parent",$.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())),L=E.filter(ee=>!M.has(ee?.toString()));L.length&&await L.reduce(async(ee,ge)=>{await ee;const be=await ne(ge);be&&v.value.push(be)},Promise.resolve())},xe=()=>{if(!I.value.length){f.value=-1;return}let E=0;if(!o.value&&k.value){const M=k.value.id?.toString(),L=I.value.findIndex(ee=>ee.id?.toString()===M);L>=0&&(E=L)}f.value=E,e.nextTick(()=>{Le(h.value[E],d.value)})},_e=async()=>{r.value||(g.value=!0,await U(),await e.nextTick(()=>{ot(),y.value?.focus()}),xe())},N=()=>{g.value=!1,f.value=-1,e.nextTick(()=>{y.value?.blur()})},G=async E=>{if(r.value)return;!g.value?await _e():N()},J=async()=>{if(!r.value){if(g.value){N();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(()=>y.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(()=>y.value?.focus()))},Ye=(E,M)=>{const L=M??(o.value?[...S.value]:E?.id??null);a("value-selected",{name:n.name,value:L,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(()=>{y.value?.focus(),f.value=Math.min(f.value,I.value.length-1)}),le(null)):(k.value=E,s.value=E.id,a("change",s.value),Ye(E),x.value="",N(),le(E))},bn=E=>{if(Y(E.id)){o.value||N();return}Oe(E)},Le=(E,M)=>{if(!E||!M)return;const L=E.offsetTop,ee=L+E.offsetHeight,ge=M.scrollTop,be=ge+M.clientHeight;let we=M.scrollTop;L<ge?we=L-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 L=window.getComputedStyle(M),ee=L.overflow+L.overflowY+L.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,L=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(L-ee*2,0);let{width:_}=E;m>0&&_>m&&(_=m);let{left:B}=E;B+_+ee>L&&(B=L-_-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||!g.value&&(E.key==="ArrowDown"||E.key==="ArrowUp")&&(E.preventDefault(),await _e())},qt=E=>{if(!g.value)return;const{key:M}=E;if(M==="ArrowDown")E.preventDefault(),f.value+1<I.value.length&&(f.value+=1,Le(h.value[f.value],d.value));else if(M==="ArrowUp")E.preventDefault(),f.value>0&&(f.value-=1,Le(h.value[f.value],d.value));else if(M==="Enter"){E.preventDefault();const L=I.value[f.value];L&&Oe(L),y.value?.blur()}else M==="Escape"?(E.preventDefault(),N()):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,Le(h.value[0],d.value)):M==="End"?(f.value=I.value.length-1,Le(h.value[f.value],d.value)):M==="Tab"&&N()},rt=()=>{r.value||(V.value=!0)},kt=()=>{V.value=!1,x.value=""},bt=E=>{E.key==="Escape"&&g.value&&N()},wt=E=>{const M=E.target;i.value?.contains(M)||p.value?.contains(M)||N()},Kt=E=>{g.value&&d.value&&!d.value.contains(E.target)&&ot()},xt=()=>{g.value&&ot()},Gt=()=>{g.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}`,L=await fetch(M,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(st.value)}),ee=await L.json().catch(()=>({})),ge=ee?.error||ee?.message,be=Number(ee?.code)>=400;if(!L.ok||be){he.notify({title:"Помилка",type:"error",message:ge||`Код помилки: ${ee?.code||L.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 L;return(...ee)=>{L&&clearTimeout(L),L=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($,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&&$.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]=L=>et.value=L),class:"z-[1000]",title:"Додати",buttonText:"Додати",onDone:vt,teleport:l.teleport},{default:e.withCtx(()=>[e.createVNode(He,{schema:_t.value,modelValue:st.value,"onUpdate:modelValue":M[0]||(M[0]=L=>st.value=L),ref_key:"addForm",ref:it},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick: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":g.value,"aria-haspopup":"listbox",onKeydown:qe,onClick:J,"data-focus":g.value||V.value?"true":"false",ref_key:"triggerRef",ref:c},[e.createElementVNode("div",Ar,[o.value?(e.openBlock(),e.createElementBlock("div",Fr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(D.value,L=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[rgb(230,230,230)] rounded-[2px] m-[2px] box-border max-w-full",key:L.id},[e.createElementVNode("div",Lr,[ue(L)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:e.normalizeStyle({backgroundColor:L?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ke(L)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(an),style:e.normalizeStyle(fe(L)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(oe(L)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"truncate text-[#172b4d] overflow-hidden max-w-[200px] px-0.5 pl-1.5",title:q(L)},[A.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:Z(L)},null,8,Tr)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(L.text),1)],64))],8,Ir)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border text-[#172b4d] hover:bg-[rgb(255,189,173)] hover:text-[rgb(222,53,11)] flex-shrink-0",onClick:e.withModifiers(ee=>$e(L.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,Or)]))),128)),e.createElementVNode("div",zr,[!r.value&&l.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:y,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900 hover:cursor-pointer",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:S.value.length?" ":C.value,"onUpdate:modelValue":M[2]||(M[2]=L=>x.value=L),onFocus:rt,onBlur:kt,onKeydown:qt},null,40,Rr)),[[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,Pr)):(e.openBlock(),e.createElementBlock("span",Ur,e.toDisplayString(k.value?.text),1))],8,jr)):e.createCommentVNode("",!0),o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Hr,[!r.value&&l.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:y,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900 hover:cursor-pointer",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:O.value?" ":C.value,"onUpdate:modelValue":M[3]||(M[3]=L=>x.value=L),onFocus:rt,onBlur:kt,onKeydown:qt},null,40,qr)),[[e.vModelText,x.value]]):e.createCommentVNode("",!0)]))]),e.createElementVNode("div",Kr,[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,Gr)):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(L=>G(),["stop"])),title:g.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,Yr)])],42,Dr),(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},[I.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(I.value,(L,ee)=>(e.openBlock(),e.createElementBlock("div",{key:L.id,ref_for:!0,ref:ge=>h.value[ee]=ge,class:e.normalizeClass(["flex px-3 py-2 gap-2 cursor-pointer select-none text-gray-900",Y(L.id)?"bg-[#2684ff] text-white":"bg-white hover:bg-[#deebff] hover:text-[#172b4d]",f.value===ee&&!Y(L.id)?"bg-[#deebff] text-[#172b4d]":""]),"aria-disabled":Y(L.id)?"true":"false",role:"option",tabindex:"-1",onClick:ge=>bn(L)},[ue(L)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block flex-shrink-0",style:e.normalizeStyle({backgroundColor:L?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ke(L)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(an),style:e.normalizeStyle(fe(L)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(oe(L)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",f.value===L.id?"text-white":"",(f.value===ee,"")])},[A.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:Z(L)},null,8,Zr)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(L.text),1)],64))],2)],10,Wr))),128)):(e.openBlock(),e.createElementBlock("div",Jr," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),n.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:ct,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:r.value,type:"button"},[e.createVNode(ze,{width:"16",height:"16"}),M[12]||(M[12]=e.createElementVNode("span",null,"Додати",-1))],8,Xr)):e.createCommentVNode("",!0)],512)],64))}}),[["__scopeId","data-v-df831fc2"]]),Qr=["placeholder","disabled"],Dn=e.defineComponent({__name:"vs-input-textarea",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=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,Qr)),[[e.vModelText,a.value]])}}),es={key:1,class:"richtext-error"},An=e.defineComponent({__name:"vs-input-richtext",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},richtextProps:{default:()=>({})}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=e.ref(null);e.onMounted(async()=>{try{const d=await import("@opengis/richtext");t.value=d.VsRichtext}catch{console.warn("@opengis/richtext is not installed. Please install it in your app to use richtext input.")}});const n=l,{inputClass:a}=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",[l.customClass,e.unref(a),{"richtext-disabled":r.value}]]),style:e.normalizeStyle(r.value?{pointerEvents:"none",opacity:.6}:{})},[t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.mergeProps({key:0,modelValue:o.value,"onUpdate:modelValue":d[0]||(d[0]=p=>o.value=p),placeholder:s.value},i.value),null,16,["modelValue","placeholder"])):(e.openBlock(),e.createElementBlock("div",es,[...d[1]||(d[1]=[e.createElementVNode("p",null,"@opengis/richtext package is not installed.",-1),e.createElementVNode("p",null,"Please install it: npm install @opengis/richtext",-1)])]))],6))}}),ts={},ns={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};function ls(l,t){return e.openBlock(),e.createElementBlock("svg",ns,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),e.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)])])}const as=ae(ts,[["render",ls]]),os={},rs={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function ss(l,t){return e.openBlock(),e.createElementBlock("svg",rs,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const is=ae(os,[["render",ss]]),cs={},ds={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function us(l,t){return e.openBlock(),e.createElementBlock("svg",ds,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const ps=ae(cs,[["render",us]]),ms={},fs={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function hs(l,t){return e.openBlock(),e.createElementBlock("svg",fs,[...t[0]||(t[0]=[e.createStaticVNode('<circle cx="9" cy="12" r="1"></circle><circle cx="9" cy="5" r="1"></circle><circle cx="9" cy="19" r="1"></circle><circle cx="15" cy="12" r="1"></circle><circle cx="15" cy="5" r="1"></circle><circle cx="15" cy="19" r="1"></circle>',6)])])}const St=ae(ms,[["render",hs]]),gs={},ys={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function ks(l,t){return e.openBlock(),e.createElementBlock("svg",ys,[...t[0]||(t[0]=[e.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)])])}const bs=ae(gs,[["render",ks]]),ws={},xs={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _s(l,t){return e.openBlock(),e.createElementBlock("svg",xs,[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"},null,-1)])])}const vs=ae(ws,[["render",_s]]),Es={class:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden flex flex-col"},Vs={class:"flex flex-col gap-2 !p-4 border-b border-gray-200 sm:flex-row sm:items-center sm:justify-between bg-gray-50"},Cs={class:"relative w-full"},Bs={class:"flex flex-nowrap items-center justify-end gap-2 w-full overflow-x-auto"},Ss={class:"w-full overflow-x-auto"},Ns={class:"w-full min-w-[640px] table-auto divide-y divide-gray-200"},$s={class:"bg-gray-50"},Ms={class:"border-b border-gray-200"},Ds={class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 w-12 text-center"},As=["onClick"],Fs={key:0,class:"text-gray-400"},Ls={key:0,colspan:"100%",class:"text-center"},Is={class:"w-full"},Ts={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},Os=["onDragstart","onDragover","onDrop"],zs={class:"px-4 py-3 text-center align-middle"},Rs={class:"flex items-center justify-center"},js=["innerHTML"],Ps={key:0,class:"flex items-center gap-3 text-sm text-gray-700"},Us={key:0},Hs=["src"],qs={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},Ks={key:1,class:"flex items-center justify-center"},Gs={key:2,class:"text-sm font-medium text-gray-900"},Ys={class:"px-4 py-3 text-right whitespace-nowrap"},Ws={class:"flex items-center justify-end gap-2"},Zs=["onClick"],Js=["onClick"],Xs={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},Fn=e.defineComponent({__name:"vs-input-datatable",props:e.mergeModels({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 $=a.value??[],j=r.value?$.filter(re=>t.colModel?.some(xe=>{const _e=xe.key||xe.name;if(!_e)return!1;const N=re[_e];return N?Array.isArray(N)?N.join(", ").toLowerCase().includes(r.value.toLowerCase()):String(N).toLowerCase().includes(r.value.toLowerCase()):!1})):$;if(!s.value)return j;const U=s.value,ne=[...j].sort((re,xe)=>{const _e=pe(re?.[U]),N=pe(xe?.[U]);return typeof _e=="number"&&typeof N=="number"?_e-N:String(_e).localeCompare(String(N))});return i.value==="asc"?ne:ne.reverse()}),d=e.ref(null),p=e.ref(null),g=e.ref(null),V=$=>{d.value=$},k=$=>{p.value=$},v=$=>{if(d.value===null||d.value===$){d.value=null,p.value=null;return}const j=[...a.value],[U]=j.splice(d.value,1);j.splice($,0,U),a.value=j,d.value=null,p.value=null},f=()=>{g.value&&g.value.click()},h=$=>{const j=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],U=$.toLowerCase();return j.some(ne=>U.endsWith(ne))},x=$=>{const U=$.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)},y=()=>{const $=JSON.stringify(a.value,null,2),j=new Blob([$],{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=($,j)=>{const U=`/api/suggest/${$}`,ne=U.includes("?")?"&":"?",re=j?`&val=${j}`:"";return`${U}${ne}json=1${re}`},D=$=>$==null||$===""?null:typeof $=="object"?$?.id!==void 0&&$.id!==null&&$.id!==""?$.id:null:$,C=$=>{const j=new Set;return Array.isArray(a.value)&&a.value.forEach(U=>{const ne=U?.[$];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 $=t.colModel.filter(j=>j.data&&w.has(j.type?.toLowerCase()||""));$.length&&await Promise.all($.map(async j=>{const U=j.key||j.name;if(!U)return;const ne=C(U),re=Array.from(ne).map(N=>String(N)).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(N){console.error("Failed to fetch column values",N)}}))};e.watch([()=>t.colModel,()=>a.value],()=>{O()},{immediate:!0,deep:!0});const W=e.ref(""),Y=e.ref(!1);let I="edit",F=0;const R=$=>($?.format||$?.type||"").toString().toLowerCase(),K=e.computed(()=>t.colModel?.filter($=>R($)!=="slot").map($=>{const{slot:j,...U}=$;return U})??[]),T=e.ref({}),A=e.ref({}),Z=$=>typeof $!="string"?!1:!!n[$],q=($,j)=>j?j.split(".").reduce((U,ne)=>U==null?U:U[ne.trim()],$):$,me=($,j)=>typeof $!="string"?"":$.replace(/{{\s*([^}]+)\s*}}/g,(U,ne)=>{const re=q(j,ne.trim());return re??""}),pe=$=>{if($==null||$==="")return"";if(typeof $=="number")return $;if(typeof $=="boolean")return $?1:0;if(typeof $=="string")return $.toLowerCase();if(Array.isArray($))return $.map(j=>pe(j)).join(", ");if(typeof $=="object"){if($.text!==void 0)return String($.text).toLowerCase();if($.label!==void 0)return String($.label).toLowerCase();if($.id!==void 0)return String($.id).toLowerCase()}return String($).toLowerCase()},Ae=$=>{const j=$.key||$.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,I="add",T.value={}}function H($,j){if(!$?.length)return null;const U=typeof j=="object"?j?.id:j;return U==null||U===""?null:$.find(ne=>ne?.id?.toString()===U.toString())?.text??null}function oe($){return $==null||$===""?"-":Array.isArray($)?$.map(j=>typeof j=="object"?j?.text??j?.id??"-":j).join(", "):typeof $=="object"?$?.text??$?.id??"-":$}function ue($,j){const U=j.key||j.name,ne=$?.[U],re=o.value[U];if(!ne)return"-";if(Array.isArray(ne)){const _e=ne.map(N=>H(re,N)).filter(Boolean);return _e.length?_e.join(", "):oe(ne)}const xe=H(re,ne);return xe||oe(ne)}async function fe($,j){W.value="Редагувати",Y.value=!0,I="edit",F=j,T.value={...$}}function ke(){const $=A.value.validate();if($){he.notify({type:"warning",title:"Помилка валідації",message:Object.entries($).map(([j,U])=>`${j}: ${U}`).join(`
|
|
2
|
-
`)});return}I==="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($){a.value=a.value.filter((j,U)=>U!==$)}function le(){Y.value=!1}return($,j)=>(e.openBlock(),e.createElementBlock("div",Es,[e.createElementVNode("div",Vs,[e.createElementVNode("div",Cs,[e.createVNode(as,{width:"16",height:"16",class:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":j[0]||(j[0]=U=>r.value=U),placeholder:"Пошук",class:"w-full rounded-md border border-gray-200 bg-white pl-10 pr-3 py-2 text-sm text-gray-900 placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100"},null,512),[[e.vModelText,r.value]])]),e.createElementVNode("div",Bs,[e.createElementVNode("input",{ref_key:"fileInput",ref:g,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(is,{class:"text-gray-700",width:"16",height:"16"}),j[4]||(j[4]=e.createTextVNode(" Імпорт ",-1))]),e.createElementVNode("button",{type:"button",onClick:y,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[e.createVNode(ps,{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",Ss,[e.createElementVNode("table",Ns,[e.createElementVNode("thead",$s,[e.createElementVNode("tr",Ms,[e.createElementVNode("th",Ds,[e.createVNode(St,{width:"20",height:"20",class:"mx-auto text-gray-400"})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.colModel,U=>(e.openBlock(),e.createElementBlock("th",{key:U.key,class:"px-4 py-3 text-left text-xs font-semibold text-gray-900"},[e.createElementVNode("button",{type:"button",onClick: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",Fs,e.toDisplayString(i.value==="asc"?"▲":"▼"),1)):e.createCommentVNode("",!0)],8,As)]))),128)),j[7]||(j[7]=e.createElementVNode("th",{class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 text-center w-[1%] whitespace-nowrap"}," Дії ",-1))])]),e.createElementVNode("tbody",{class:e.normalizeClass(["divide-y divide-gray-200",{"[&_tr:last-child]:border-0":!p.value}])},[c.value.length===0?(e.openBlock(),e.createElementBlock("td",Ls,[e.createElementVNode("div",Is,[e.createElementVNode("div",Ts,[e.createVNode(bs,{class:"w-48 mx-auto"}),j[8]||(j[8]=e.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[e.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),e.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(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",zs,[e.createElementVNode("div",Rs,[e.createVNode(St,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.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($.$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,js))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[R(re)==="file"?(e.openBlock(),e.createElementBlock("div",Ps,[h(ue(U,re))?(e.openBlock(),e.createElementBlock("div",Us,[e.createElementVNode("img",{src:ue(U,re),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,Hs)])):(e.openBlock(),e.createElementBlock("div",qs,[e.createVNode(Cn,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):R(re)==="color"?(e.openBlock(),e.createElementBlock("div",Ks,[e.createElementVNode("span",{class:"inline-flex h-6 w-6 rounded border border-gray-200",style:e.normalizeStyle({backgroundColor:ue(U,re)||"#ffffff"})},null,4)])):(e.openBlock(),e.createElementBlock("div",Gs,e.toDisplayString(ue(U,re)),1))],64))]))),128)),e.createElementVNode("td",Ys,[e.createElementVNode("div",Ws,[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(vs,{width:"16",height:"16"})],8,Zs),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,Js)])])],42,Os))),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",Xs,[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"])]))}}),Qs={},ei={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-map-pin"};function ti(l,t){return e.openBlock(),e.createElementBlock("svg",ei,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),e.createElementVNode("path",{d:"M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z"},null,-1)])])}const ni=ae(Qs,[["render",ti]]),li={},ai={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","stroke-width":"2",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-line"};function oi(l,t){return e.openBlock(),e.createElementBlock("svg",ai,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)])])}const ri=ae(li,[["render",oi]]),si={},ii={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function ci(l,t){return e.openBlock(),e.createElementBlock("svg",ii,[...t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M6.5 9.5l3.5 -3"></path><path d="M14 5.5l3 1.5"></path><path d="M18.5 10l-2.5 7"></path><path d="M13.5 17.5l-7 -5"></path>',9)])])}const di=ae(si,[["render",ci]]),ui={},pi={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function mi(l,t){return e.openBlock(),e.createElementBlock("svg",pi,[...t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M8 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M6 8v8"></path><path d="M18 16v-8"></path><path d="M8 6h8"></path><path d="M16 18h-8"></path>',9)])])}const fi=ae(ui,[["render",mi]]),hi={},gi={version:"1.1",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg","xmlns:sketch":"http://www.bohemiancoding.com/sketch/ns","xmlns:xlink":"http://www.w3.org/1999/xlink",class:"fullscreen-icon"};function yi(l,t){return e.openBlock(),e.createElementBlock("svg",gi,[...t[0]||(t[0]=[e.createElementVNode("title",null,null,-1),e.createElementVNode("desc",null,null,-1),e.createElementVNode("defs",null,null,-1),e.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[e.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[e.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[e.createElementVNode("path",{d:"M2,9 L0,9 L0,14 L5,14 L5,12 L2,12 L2,9 L2,9 Z M0,5 L2,5 L2,2 L5,2 L5,0 L0,0 L0,5 L0,5 Z M12,12 L9,12 L9,14 L14,14 L14,9 L12,9 L12,12 L12,12 Z M9,0 L9,2 L12,2 L12,5 L14,5 L14,0 L9,0 L9,0 Z",id:"Shape"})])])],-1)])])}const ki=ae(hi,[["render",yi]]),bi={class:"bg-white/30 p-1 rounded-md shadow w-fit"},wi={class:"flex gap-2"},xi=["onClick","title"],_i=["src"],vi=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(l,{emit:t}){const n=l,a=e.ref(Object.keys(n.basemaps)[0]),o=t;function r(c){o("onLayerChange",c),a.value=c}const s={z:13,x:4790,y:2762};function i(c){if(c?.preview)return c.preview;if(!c?.url)return;const d={"{z}":s.z,"{x}":s.x,"{y}":s.y};let p=c.url;return Object.entries(d).forEach(([g,V])=>{p=p.replace(new RegExp(g,"gi"),String(V))}),p}return(c,d)=>(e.openBlock(),e.createElementBlock("div",bi,[e.createElementVNode("div",wi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.basemaps,(p,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:V=>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,_i)],10,xi))),128))])]))}}),Ei={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},Vi={key:0,class:"vs-select__options absolute z-50 mt-1 w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm"},Ci=["onClick"],Bi={class:"relative flex-1 min-w-[140px]"},Si=["placeholder"],Ni="https://data.softpro.ua/api-user/gis-url-proxy",$i="https://geo.rv.ua/api-user/dzk.api",Mi=ae(e.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(l,{emit:t}){const n=l,a=t,o=["here","xy","parcel"],r=e.computed(()=>{const b=n.config?.tools?.filter(S=>o.includes(S));return b&&b.length?b:o}),s=e.computed(()=>n.config?.placeholder?.trim()||"Пошук…"),i=e.ref(r.value[0]??o[0]);e.watch(r,b=>{b.includes(i.value)||(i.value=b[0])});const c=e.ref(""),d=e.ref(!1),p=e.ref(null);e.watch(i,()=>{c.value="",d.value=!1});function g(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,I=W;const F=K=>Math.abs(K)<=90,R=K=>Math.abs(K)<=180;if(!F(Y)||!R(I))if(F(I)&&R(Y))Y=W,I=O;else return null;return{lat:Y,lng:I}}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 y(b){a("goToCoordinates",[b.lat,b.lng])}async function w(){const b=c.value.trim();if(b){if(i.value==="xy"){const S=v(b);if(!S){he.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}y(S),c.value="";return}try{const S=new URL(i.value==="here"?Ni:$i);if(i.value==="here")S.searchParams.set("searchtext",b);else{if(!x(b)){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];y(W),c.value=""}}catch(S){const D=S?.message||"Помилка пошуку";he.notify({type:"error",title:"Пошук",message:D})}}}return(b,S)=>(e.openBlock(),e.createElementBlock("div",Ei,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(w,["prevent"])},[r.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:p,class:"relative search-type w-[140px]"},[e.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:S[0]||(S[0]=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",Vi,[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=>g(D)},e.toDisplayString(k(D)),9,Ci))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",Bi,[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,Si),[[e.vModelText,c.value,void 0,{trim:!0}]]),S[3]||(S[3]=e.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),[["__scopeId","data-v-359172e4"]]),Di={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},Ai={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},Fi={class:"flex items-center gap-1"},Li=["disabled"],Ii=["disabled"],Ti=["disabled"],Oi={class:"absolute top-4 right-4 z-[1000]"},zi={class:"flex flex-col gap-[2px]"},Ri=["disabled"],ji=["disabled"],Pi=["disabled"],Ui=["disabled"],Hi={class:"bg-white/95 border border-gray-200 rounded-md shadow-xl px-3 py-2 max-w-[240px] text-[11px] sm:text-xs text-gray-900"},qi={class:"space-y-0.5"},Ki={class:"text-gray-500"},Gi={class:"text-gray-900 text-right break-all"},Yi={class:"absolute left-4 bottom-[36px] z-[1000]"},Wi={class:"flex flex-col gap-2"},Zi={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},Ji={class:"flex flex-col gap-1"},Xi=["checked","disabled","onChange"],Qi={class:"text-gray-700 text-xs font-medium"},ec={class:"absolute bottom-0 left-0 right-0 z-[1000] min-h-[28px] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},tc={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full px-2 pb-1"},nc={class:"mr-auto flex items-center gap-2 min-w-0 relative"},lc={class:"shrink-0"},ac={class:"font-bold"},oc={class:"flex items-center"},rc={class:"text-xs mr-2"},sc={key:0,class:"text-xs mr-2"},ic={key:1,class:"text-xs mr-2"},cc=["disabled"],dc=["disabled"],Nt="__vs_form_maplibre_loader__",rn="__vs_form_maplibre_scripts__",$t="vs-global-bounds-src",Mt="vs-global-bounds-line",Ln=ae(e.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},ctrlZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},katottg:{default:""},layers:{default:()=>[]},bounds:{},api:{},center:{default:void 0},zoom:{default:void 0},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.computed(()=>!!n.disabled),r=e.ref(!1),s=e.ref(null),i=e.ref(0),c=e.ref(""),d=e.ref(null),p=e.getCurrentInstance(),g=p?.appContext?.config?.globalProperties?.$settings??{},V=g?.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(g.center)&&g.center.length===2?g.center:[30,50];console.log(V);const h=typeof V.zoom=="number"?V.zoom:typeof g.zoom=="number"?g.zoom:typeof g.defaultZoom=="number"?g.defaultZoom:10,x=e.computed(()=>v("center")?n.center:V.center??n.center),y=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 y.value=="number"?y.value:h),O=e.ref(n.modelValue),W=e.ref(null),Y=e.ref([]);let I=!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:g.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(Ie=>Ie.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,$=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 N(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 Le(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 Ie=`vs-ov-point-${u.id}`;z.addLayer({id:Ie,type:"circle",source:u.sourceId,"source-layer":ie,paint:{"circle-color":Me,"circle-radius":5,"circle-opacity":Se}}),B.push(Ie)}else if(ve==="polyline"||ve==="line"){const Ie=`vs-ov-line-${u.id}`;z.addLayer({id:Ie,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(Ie)}else{const Ie=`vs-ov-fill-${u.id}`,Vt=`vs-ov-border-${u.id}`;z.addLayer({id:Ie,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(Ie,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 Ie=Se.features[0]?.properties??{},Vt=ye(u.config,Ie);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&&Le(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){$=null,d.value=null,I||(j="__null__",a("update:modelValue",null));return}const m=bt(u.features[u.features.length-1]?.geometry??null);$=m,Ze(m),I||(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(I=!0,ct(),m)try{le.add(kt(m))}catch{}I=!1,$=bt(m),it(),Ze(m),m&&(_t(m),o.value||M())}function wn(){if(le){if(I=!0,ct(),$)try{le.add(kt($))}catch{}I=!1,it(),Ze($)}}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";I=!0,ct(),I=!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 L(){o.value||!le||(Je(),ct(),j="__null__",d.value=null,a("update:modelValue",null))}function ee(){o.value||!$||_t($)}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];I=!0,_.features.slice(0,-1).forEach(P=>le.delete(P.id)),I=!1,B&&(I=!0,le.add(B),I=!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&&Le(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=N(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&&Le(te)}),qe())},{immediate:!0,deep:!0}),e.watch(()=>S.value,()=>{z&&(We(),R.value.forEach(u=>{const m=F[u];m&&Le(m)}),qe())},{deep:!0}),e.watch(()=>w.value,async u=>{if(Y.value=[],!u){z&&(We(),R.value.forEach(m=>{const _=F[m];_&&Le(_)}),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];_&&Le(_)}),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(()=>y.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",Di,[q.value.search?(e.openBlock(),e.createBlock(Mi,{key:0,onGoToCoordinates:ge})):e.createCommentVNode("",!0),q.value.import||q.value.export?(e.openBlock(),e.createElementBlock("div",Ai,[e.createElementVNode("div",Fi,[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,Ii)):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,Ti)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",Oi,[e.createElementVNode("div",zi,[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(ni)],10,Ri)):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(ri)],10,ji)):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(di)],10,Pi)):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(fi)],10,Ui)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:m[4]||(m[4]=_=>r.value=!r.value),title:"Full Screen"},[e.createVNode(ki,{style:{width:"12px",height:"12px"}})])])]),A.value.length?(e.openBlock(),e.createElementBlock("div",{key:1,class:"absolute z-[1500] pointer-events-none",style:e.normalizeStyle(Z.value)},[e.createElementVNode("div",Hi,[e.createElementVNode("dl",qi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(A.value,_=>(e.openBlock(),e.createElementBlock("div",{key:`${_.key}-${_.value}`,class:"flex justify-between gap-2"},[e.createElementVNode("dt",Ki,e.toDisplayString(_.key),1),e.createElementVNode("dd",Gi,e.toDisplayString(_.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",Yi,[e.createElementVNode("div",Wi,[e.createVNode(vi,{basemaps:e.unref(Ae),onOnLayerChange:qt},null,8,["basemaps"]),K.value.length?(e.openBlock(),e.createElementBlock("div",Zi,[m[5]||(m[5]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),e.createElementVNode("div",Ji,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(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,Xi),e.createElementVNode("span",Qi,e.toDisplayString(_.config.title||_.config.name||_.id),1)]))),128))])])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ec,[d.value?(e.openBlock(),e.createElementBlock("div",tc,[e.createElementVNode("div",nc,[e.createElementVNode("div",lc,[m[6]||(m[6]=e.createTextVNode(" Type: ",-1)),e.createElementVNode("span",ac,e.toDisplayString(d.value.type),1)])]),e.createElementVNode("div",oc,[e.createElementVNode("div",rc,[m[7]||(m[7]=e.createTextVNode(" Center: ",-1)),e.createElementVNode("b",null,e.toDisplayString(d.value.center.lat.toFixed(5))+", "+e.toDisplayString(d.value.center.lng.toFixed(5)),1)]),d.value.areaKm2!==null?(e.openBlock(),e.createElementBlock("div",sc,[m[8]||(m[8]=e.createTextVNode(" Area: ",-1)),e.createElementVNode("b",null,e.toDisplayString(d.value.areaKm2.toFixed(1))+" km²",1)])):(e.openBlock(),e.createElementBlock("div",ic,[...m[9]||(m[9]=[e.createTextVNode("Area: ",-1),e.createElementVNode("b",null,"—",-1)])])),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:ee,disabled:o.value},[...m[10]||(m[10]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"w-3 h-3"},[e.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),e.createElementVNode("path",{d:"M7 10l6 0"}),e.createElementVNode("path",{d:"M10 7l0 6"}),e.createElementVNode("path",{d:"M21 21l-6 -6"})],-1)])],8,cc),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Delete feature",onClick:L,disabled:o.value},[e.createVNode(nt,{class:"w-3 h-3"})],8,dc)])])):e.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-e66e6e67"]]),uc=["data-focus"],pc={class:"flex items-center"},mc={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},fc=["onClick","aria-label"],hc={key:0,class:"absolute text-gray-500 truncate pl-2"},gc={class:"flex-1 min-w-[2px]"},yc=["placeholder"],kc={class:"flex items-center shrink-0"},bc=["disabled"],In=e.defineComponent({__name:"vs-input-tag",props:e.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=t;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…"),g=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)},y=()=>{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",pc,[e.createElementVNode("div",mc,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,fc)]))),128)),g.value?(e.openBlock(),e.createElementBlock("div",hc,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",gc,[k.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:s,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":C[0]||(C[0]=O=>c.value=O),onFocus:w,onBlur:b,onKeydown:S,placeholder:d.value&&d.value.length?"":void 0},null,40,yc)),[[e.vModelText,c.value]])])],512),e.createElementVNode("div",kc,[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(y,["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,bc)):e.createCommentVNode("",!0)])],10,uc)],2)],512))}}),wc={class:"relative flex gap-1 bg-white w-full"},xc=["disabled","placeholder"],Tn=ae(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=e.inject("values"),n=l,a=e.useModel(l,"modelValue");function o(s){const i={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ы:"y",э:"e",ю:"yu",я:"ya",ь:"",ъ:"",є:"ye",і:"i",ї:"yi",ґ:"g"};return s.toLowerCase().split("").map(c=>i[c]||c).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const r=()=>{const s=t?.value?.[n.parent||""]?.toString(),i=o(s);a.value=i.toString()};return(s,i)=>(e.openBlock(),e.createElementBlock("div",wc,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:l.disabled,placeholder:l.placeholder,"onUpdate:modelValue":i[0]||(i[0]=c=>a.value=c),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,xc),[[e.vModelText,a.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:r}," Gen ")]))}}),[["__scopeId","data-v-cb7b2b74"]]),_c={class:"relative flex gap-1 bg-white w-full"},vc=["disabled","placeholder"],Ec=["disabled"],Vc={key:0},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",_c,[e.withDirectives(e.createElementVNode("input",{disabled:l.disabled,placeholder:l.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,vc),[[e.vModelText,n.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:a.value||l.disabled||!r.value,onClick:i},[a.value?(e.openBlock(),e.createElementBlock("span",Cc,"...")):(e.openBlock(),e.createElementBlock("span",Vc,"Gen"))],8,Ec)]))}}),[["__scopeId","data-v-8f88fb66"]]),Bc={class:"w-full"},Sc={ref:"sortableContainer",class:"flex flex-col gap-1"},Nc=["onDragstart","onDrop"],$c={class:"w-1/3"},Mc={class:"w-2/3"},Dc=["onClick"],Ac={key:0,class:"text-[14px] text-gray-700"},Fc={class:"mt-2 w-full flex items-center"},Lc=["disabled"],zn=ae(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=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,y])=>({id:n("key-value-"),key:x,value:y}))})();function g(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 y={};i.length&&i.forEach(w=>{y[w]=o.parent?a?.value?.[o.parent]?.[w]:void 0}),a?.value&&o.parent&&(a.value[o.parent]={...y,...x}),r("update:modelValue",x)},{deep:!0}),(h,x)=>(e.openBlock(),e.createElementBlock("div",Bc,[e.createElementVNode("div",Sc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(y,w)=>(e.openBlock(),e.createElementBlock("div",{key:y.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===w}]),draggable:"true",onDragstart:b=>g(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-2ae5f16f><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-2ae5f16f><circle cx="15" cy="12" r="1.5" data-v-2ae5f16f></circle><circle cx="15" cy="24" r="1.5" data-v-2ae5f16f></circle><circle cx="21" cy="12" r="1.5" data-v-2ae5f16f></circle><circle cx="21" cy="24" r="1.5" data-v-2ae5f16f></circle><circle cx="21" cy="18" r="1.5" data-v-2ae5f16f></circle><circle cx="15" cy="18" r="1.5" data-v-2ae5f16f></circle></svg></button>',1)),e.createElementVNode("div",$c,[e.createVNode(tt,{modelValue:y.key,"onUpdate:modelValue":b=>y.key=b,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Mc,[e.createVNode(tt,{modelValue:y.value,"onUpdate:modelValue":b=>y.value=b,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:b=>f(y.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[e.createVNode(e.unref(Ct),{height:"16",width:"16"})],8,Dc)],42,Nc))),128))],512),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Ac," Дані для відображення відсутні ")),e.createElementVNode("div",Fc,[e.createElementVNode("button",{type:"button",onClick:v,disabled:k.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(ze,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(s)),1)],8,Lc)])]))}}),[["__scopeId","data-v-2ae5f16f"]]),Ic={class:"w-full"},Tc={ref:"sortableContainer",class:"flex flex-col gap-1"},Oc=["onDragstart","onDrop"],zc=["disabled"],Rc={class:"flex-1"},jc=["onClick","disabled"],Pc={key:0,class:"text-[14px] text-gray-700"},Uc={class:"mt-2 w-full flex items-center"},Hc=["disabled"],Rn=ae(e.defineComponent({__name:"vs-input-text-array",props:e.mergeModels({addButtonText:{default:"Додати"},inputType:{default:"text"},placeholder:{default:"Значення"},mask:{default:""},disabled:{type:Boolean,default:!1}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.ref(null),r=e.computed(()=>!!t.disabled),s=e.computed(()=>t.placeholder??""),i=e.computed(()=>t.addButtonText??"Додати");let c=!1;const d=h=>`${h}-${Math.random().toString(36).substring(2,15)}`,p=h=>{const x=h??n.value??[];a.value=x.map((y,w)=>({id:a.value[w]?.id??d("text-array"),value:y??""}))};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 V(){g.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],[y]=x.splice(o.value,1);x.splice(h,0,y),a.value=x,o.value=null}return(h,x)=>(e.openBlock(),e.createElementBlock("div",Ic,[e.createElementVNode("div",Tc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(y,w)=>(e.openBlock(),e.createElementBlock("div",{key:y.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":o.value===w}]),draggable:"true",onDragstart:b=>v(w),onDragover:x[0]||(x[0]=e.withModifiers(()=>{},["prevent"])),onDrop:b=>f(w)},[e.createElementVNode("button",{class:"cursor-move",type:"button",disabled:r.value},[...x[1]||(x[1]=[e.createStaticVNode('<svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-77ce3498><circle cx="15" cy="12" r="1.5" data-v-77ce3498></circle><circle cx="15" cy="24" r="1.5" data-v-77ce3498></circle><circle cx="21" cy="12" r="1.5" data-v-77ce3498></circle><circle cx="21" cy="24" r="1.5" data-v-77ce3498></circle><circle cx="21" cy="18" r="1.5" data-v-77ce3498></circle><circle cx="15" cy="18" r="1.5" data-v-77ce3498></circle></svg>',1)])],8,zc),e.createElementVNode("div",Rc,[l.inputType==="text"?(e.openBlock(),e.createBlock(tt,{key:0,modelValue:y.value,"onUpdate:modelValue":b=>y.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),l.inputType==="tel"?(e.openBlock(),e.createBlock(en,{key:1,modelValue:y.value,"onUpdate:modelValue":b=>y.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),l.inputType==="email"?(e.openBlock(),e.createBlock(Qt,{key:2,modelValue:y.value,"onUpdate:modelValue":b=>y.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),l.inputType==="mask"?(e.openBlock(),e.createBlock(Xt,{key:3,modelValue:y.value,"onUpdate:modelValue":b=>y.value=b,mask:l.mask,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","mask","disabled","placeholder"])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:b=>k(y.id),disabled:r.value,class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200 disabled:opacity-50"},[e.createVNode(e.unref(Ct),{height:"16",width:"16"})],8,jc)],42,Oc))),128))],512),a.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Pc," Дані для відображення відсутні ")),e.createElementVNode("div",Uc,[e.createElementVNode("button",{type:"button",onClick:V,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(ze,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(i.value),1)],8,Hc)])]))}}),[["__scopeId","data-v-77ce3498"]]),qc={class:"flex items-center gap-2 w-full"},Kc=["disabled"],Gc=["disabled"],jn=e.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,{inputClass:a}=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",qc,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),disabled:s.value,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[l.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Kc),[[e.vModelText,r.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":c[1]||(c[1]=d=>r.value=d),disabled:s.value},null,8,Gc),[[e.vModelText,r.value]])]))}}),Yc={class:"flex items-center gap-2 w-full"},Wc=["min","max","step","disabled"],Zc=["disabled"],Pn=e.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,{inputClass:a}=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",Yc,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),min:l.min,max:l.max,step:l.step,disabled:s.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[l.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")])},null,10,Wc),[[e.vModelText,r.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":c[1]||(c[1]=d=>r.value=d),disabled:s.value},null,8,Zc),[[e.vModelText,r.value]])]))}}),Jc=["placeholder","disabled","name"],Xc=["type","value","onInput","placeholder","disabled"],Qc=["onClick"],Un=e.defineComponent({__name:"vs-input-array",props:e.mergeModels({count:{default:1},limit:{default:1},mask:{default:""},unmask:{type:Boolean,default:!1},inputType:{default:"text"},isAdded:{type:Boolean,default:!1},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.ref(t.count),a=e.computed(()=>t.limit),{inputClass:o}=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 g(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 y=[...r.value||[]];y[h]=t.unmask?d.value[h].unmaskedValue:d.value[h].value,r.value=y}),d.value[h].on("complete",()=>{const y=[...r.value||[]];y[h]=t.unmask?d.value[h].unmaskedValue:d.value[h].value,r.value=y}),r.value?.[h]&&(d.value[h].value=r.value[h])}function V(f,h){if(s.value)return;const x=f.target.value??null,y=[...r.value];y[h]=t.inputType==="text"?x:Number(x),r.value=y}function k(){n.value+=1;const f=t.inputType==="text"||t.inputType==="mask"?null:0;r.value=[...r.value,f],t.inputType==="mask"&&setTimeout(()=>{const 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,y)=>y!==f);const h={};Object.keys(d.value).forEach(x=>{const y=parseInt(x,10);y>f?h[y-1]=d.value[y]:y<f&&(h[y]=d.value[y])}),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"},[l.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:y=>p(y,x-1),placeholder:l.placeholder,disabled:l.disabled,name:`${l.name}[${x-1}]`,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Jc)):(e.openBlock(),e.createElementBlock("input",{key:1,type:l.inputType,value:r.value?.[x-1],onInput:y=>V(y,x-1),placeholder:i.value,disabled:s.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Xc)),!l.disabled&&x===n.value&&l.isAdded?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:e.withModifiers(k,["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-green-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(ze,{height:"18",width:"18"})])):e.createCommentVNode("",!0),!l.disabled&&n.value>1&&l.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(y=>v(x-1),["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-red-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(Ct,{height:"18",width:"18"})],8,Qc)):e.createCommentVNode("",!0)]))),128))],2))}}),ed=["aria-expanded","data-focus"],td=["placeholder","disabled","readonly"],nd={class:"max-h-full"},ld=["onClick","disabled"],ad={key:0,class:"px-3 py-2 text-sm text-stone-500"},od={class:"flex flex-col gap-1"},rd=["onDragstart","onDrop"],sd=["disabled"],id=["title"],cd=["disabled","onClick","aria-label"],dd={key:0,class:"text-xs text-stone-500"},Dt=ae(e.defineComponent({__name:"vs-input-array-select",props:e.mergeModels({options:{default:()=>[]},data:{default:""},api:{default:""},prefix:{default:"api"},host:{default:""},parent:{},search:{type:Boolean,default:!0},maxHeight:{default:280},start:{default:0},slot:{},disabled:{type:Boolean,default:!1},style:{},customClass:{},modelValue:{},error:{},name:{},placeholder:{default:"Оберіть значення"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["change","update:modelValue","value-selected"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=t,o=e.useModel(l,"modelValue"),r=e.ref([]),s=e.ref(n.options??[]),i=e.ref({}),c=e.ref({}),d=e.ref({keyword:"",parent:null}),p=e.ref(""),g=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"),y=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=n.parent??n.parentValue;return N?String(N):""}),C=e.computed(()=>D.value?x?.value?.[D.value]??null:null),O=N=>N==null?"__null__":String(N),W=N=>{if(!N)return"";const G=N.label??N.text??N.name??N.ua??N.en;return G?String(G):N.id!==void 0&&N.id!==null?String(N.id):""},Y=N=>{const G=O(N);return c.value[G]||(c.value[G]=`array-select-${G}-${Math.random().toString(36).slice(2,8)}`),c.value[G]},I=e.computed(()=>new Set(r.value.map(N=>O(N.id)))),F=e.computed(()=>{const N=I.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=>!N.has(O(J.id)))}),R=()=>{if(!n.data)return"";const N=n.prefix??"api",G=n.api??`/${N}/suggest/${n.data}`;return`${n.host??""}${G}`},K=()=>{r.value.length&&(f=!0,r.value=r.value.map(N=>({...N,text:i.value[O(N.id)]??N.text})))},T=N=>{const G=O(N.id),J=W(N);J&&(i.value[G]=J)},A=N=>{s.value=N?[...N]:[],N?.forEach(T),K()},Z=N=>{if(!N.length)return;const G=new Map(s.value.map(J=>[O(J.id),J]));N.forEach(J=>{const ye=O(J.id);G.set(ye,J),T(J)}),s.value=Array.from(G.values()),K()},q=async(N="")=>{if(!n.data)return[];const G=R();if(!G)return[];const J=new URLSearchParams;J.set("json","1"),N&&J.set("key",N),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 N=>{if(!n.data||!N.length)return[];const G=R();if(!G)return[];const J=Array.from(new Set(N.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(N="",{force:G=!1}={})=>{if(!n.data)return;const J=C.value??null;if(!G&&d.value.keyword===N&&d.value.parent===J&&s.value.length>0)return;d.value={keyword:N,parent:J};const $e=await q(N);A($e)},Ue=((N,G=200)=>{let J;return(...ye)=>{J&&clearTimeout(J),J=setTimeout(()=>N(...ye),G)}})(async N=>{n.data&&await pe(N,{force:!0})},250),H=e.ref(null),oe=async(N="click")=>{y.value||g.value||(H.value=N,await pe(p.value.trim()),g.value=!0,await e.nextTick(),v.value?.focus())},ue=()=>{g.value=!1,H.value=null,e.nextTick(()=>{v.value?.blur()})},fe=async N=>{if(N.stopPropagation(),!y.value){if(g.value){if(H.value==="focus"){H.value=null;return}ue();return}await oe("click")}},ke=N=>{N.key==="Escape"&&ue()},z=N=>{const G=N.target;k.value?.contains(G)||ue()},le=N=>{if(N.key==="Escape"){N.preventDefault(),ue();return}if(N.key==="Enter"){N.preventDefault();const G=F.value[0];G&&$(G)}},$=N=>{if(!N)return;const G=O(N.id);if(I.value.has(G))return;T(N);const J={id:N.id,text:W(N)||String(N.id??""),key:Y(N.id)};r.value=[...r.value,J],j(N),p.value="",e.nextTick(()=>{v.value?.focus()})},j=N=>{const G=r.value.map(J=>J.id);a("value-selected",{name:n.name,value:G,option:N})},U=N=>{if(y.value)return;const G=r.value.filter(J=>O(J.id)!==O(N));r.value=G},ne=N=>{y.value||(V.value=N)},re=N=>{if(y.value||V.value===null||V.value===N)return;const G=[...r.value],[J]=G.splice(V.value,1);G.splice(N,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,N=>{if(f){f=!1;return}const G=N.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=>{!n.data||!g.value||Ue(N.trim())}),e.watch(y,N=>{N&&ue()}),e.watch(()=>n.options,async N=>{n.data||(A(N??[]),await xe())},{immediate:!0,deep:!0}),e.watch(()=>n.data,async N=>{N&&(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)}),(N,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]",g.value?"border-[#2684ff] ring-1 ring-[#2684ff] shadow-[0_0_0_1px_rgba(38,132,255,0.5)]":"",y.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":g.value,"aria-haspopup":"listbox","data-focus":g.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:y.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,td),[[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(Wt,{width:"16",height:"16"})],2)],10,ed),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[g.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"absolute left-0 right-0 z-10 mt-1 rounded-md border border-stone-200 bg-white shadow-lg overflow-auto",style:e.normalizeStyle({maxHeight:S.value})},[e.createElementVNode("div",nd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(F.value,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=>$(J),["stop"]),disabled:y.value},e.toDisplayString(W(J)),9,ld))),128)),F.value.length===0?(e.openBlock(),e.createElementBlock("p",ad," Немає варіантів ")):e.createCommentVNode("",!0)])],4)):e.createCommentVNode("",!0)]),_:1})]),e.createElementVNode("div",od,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(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:y.value,"aria-label":"Перетягнути"},[e.createVNode(St,{width:"14",height:"14"})],8,sd),e.createElementVNode("div",{class:"flex-1 text-sm text-stone-900",title:J.text},e.toDisplayString(J.text),9,id),e.createElementVNode("button",{type:"button",class:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-stone-400 hover:text-stone-900",disabled:y.value,onClick:e.withModifiers($e=>U(J.id),["stop"]),"aria-label":`Видалити ${J.text}`},[e.createVNode(Ct,{width:"14",height:"14"})],8,cd)],42,rd))),128)),r.value.length===0?(e.openBlock(),e.createElementBlock("p",dd,"Немає вибраних значень")):e.createCommentVNode("",!0)])],512))}}),[["__scopeId","data-v-cffead85"]]),ud={class:"flex items-center gap-2 w-full"},pd={class:"relative flex-1"},md=["placeholder","disabled","onKeydown"],fd=["disabled"],hd={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},gd={key:1,class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},yd={key:0,class:"fixed inset-0 z-[1000] flex items-center justify-center bg-black/50"},kd={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},bd={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},wd=["onClick"],xd={key:0,class:"p-4 text-sm text-gray-500"},Hn=e.defineComponent({__name:"vs-input-address",props:e.mergeModels({api:{default:""},geom:{default:""},includes:{default:()=>[]},bbox:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(l,{emit:t}){const n=/{{\s*([^}]+?)\s*}}/g,a=l,o=t,{inputClass:r}=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),g=e.ref(null);e.watch(p,C=>{typeof document>"u"||(C?(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 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,I]=C;return`${O},${Math.max(W,I)},${Y},${Math.min(W,I)}`});e.computed(()=>h.value?"1":"0");const x=e.inject("values");function y(){!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(I=>x.value?.[I]).filter(Boolean);Y.length&&(O=`${Y.join(", ")}, ${C}`)}const W=D(O);if(W){c.value=!0;try{const I=await(await fetch(W)).json();d.value=Array.isArray(I)?I:[],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",ud,[e.createElementVNode("div",pd,[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(y,["prevent"]),["enter"])},null,42,md),[[e.vModelText,i.value]]),d.value.length?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:b,title:"Show search results"},[...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",gd,[...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",hd,[...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,fd),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[p.value?(e.openBlock(),e.createElementBlock("div",yd,[e.createElementVNode("div",kd,[e.createElementVNode("div",bd,[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:I=>S(W),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString(W.display_name),9,wd))),128))]),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",xd," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),qn=(l="")=>`${l}${Math.floor(Math.random()*1e4)}`,_d={class:"vs-datalist space-y-3"},vd={class:"space-y-3"},Ed=["onClick","disabled"],Vd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Cd=["disabled"],Bd=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 V(){i.value&&(n.value=[...a.value,g()],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",_d,[e.createElementVNode("div",vd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(x,y)=>(e.openBlock(),e.createElementBlock("div",{key:o.value[y],class:"flex items-center gap-3"},[e.createVNode(He,{schema:s.value,layout:"inline",navigation:!1,values:a.value[y],"onUpdate:values":w=>a.value[y]=w,"form-id":o.value[y]},null,8,["schema","values","onUpdate:values","form-id"]),e.createElementVNode("button",{type:"button",class:"h-[38px] w-[38px] flex items-center justify-center text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",onClick:w=>k(y),disabled:c.value},[e.createVNode(nt,{class:"w-5 h-5"})],8,Ed)]))),128)),a.value.length===0?(e.openBlock(),e.createElementBlock("div",Vd,e.toDisplayString(t.emptyLabel),1)):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:V,disabled:!i.value},[e.createVNode(ze,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Cd)]))}}),[["__scopeId","data-v-c4c0acde"]]),Sd={};function Nd(l,t){return e.openBlock(),e.createElementBlock("svg",e.mergeProps({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},l.$attrs),[...t[0]||(t[0]=[e.createElementVNode("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"},null,-1),e.createElementVNode("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"},null,-1)])],16)}const $d=ae(Sd,[["render",Nd]]),Md={class:"vs-dataform space-y-4"},Dd=["draggable","onDragstart","onDragover","onDragenter","onDrop"],Ad={class:"flex items-center gap-2"},Fd=["onClick"],Ld={class:"text-sm font-medium text-gray-700"},Id={class:"flex items-center gap-2"},Td=["title","onClick","disabled"],Od=["title","onClick","disabled"],zd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Rd=["disabled"],jd=ae(e.defineComponent({__name:"vs-input-dataform",props:e.mergeModels({schema:{default:()=>[]},minGroups:{default:0},maxGroups:{default:void 0},addButtonText:{default:"Додати групу фільтрів"},groupLabel:{default:void 0},duplicateTitle:{default:"Дублювати групу"},removeTitle:{default:"Видалити групу"},emptyLabel:{},view:{default:"default"},collapsible:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.ref([]),r=e.ref(0),s=e.ref(null),i=e.ref(null),c=e.ref(null),d=e.computed(()=>t.groupLabel??"Group"),p=e.computed(()=>t.emptyLabel??"Ще немає груп"),g=e.computed(()=>t.schema?.map(H=>({...H,disabled:t.disabled||H.disabled}))??[]),V=e.computed(()=>g.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,()=>{y(),w(),b()},{immediate:!0}),e.watch(()=>t.schema,b,{immediate:!0,deep:!0}),e.watch(()=>t.view,()=>{w()},{immediate:!0});function y(){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 g.value.forEach(oe=>{H[oe.name]=oe?.default??null}),H}function D(){h.value&&(n.value=[...n.value,S()],y(),w())}function C(H){x.value||(n.value=n.value.filter((oe,ue)=>ue!==H),y(),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)],y(),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 I(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],[$]=le.splice(H,1);le.splice(oe,0,$),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",Md,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(ue,fe)=>(e.openBlock(),e.createElementBlock("div",{key:a.value[fe],class:e.normalizeClass(["relative border border-gray-200 rounded-lg bg-white transition vs-dataform__group",[t.view==="accordion"?"overflow-hidden":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",Ad,[f.value?(e.openBlock(),e.createBlock(St,{key:0,class:"w-4 h-4 text-gray-400","aria-hidden":"true"})):e.createCommentVNode("",!0),v.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"rounded-full p-1 text-gray-500 transition hover:bg-gray-100",onClick:ke=>I(fe)},[e.createVNode(Wt,{class:e.normalizeClass(["h-4 w-4 transition",Y(fe)?"-rotate-90":"rotate-0"])},null,8,["class"])],8,Fd)):e.createCommentVNode("",!0),e.createElementVNode("div",Ld,e.toDisplayString(`${d.value} (${fe+1})`),1)]),e.createElementVNode("div",Id,[e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.duplicateTitle,onClick:ke=>O(fe),disabled:t.disabled,draggable:"false"},[e.createVNode($d,{class:"w-5 h-5"})],8,Td),e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.removeTitle,onClick:ke=>C(fe),disabled:x.value,draggable:"false"},[e.createVNode(nt,{class:"w-5 h-5"})],8,Od)])],2),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(t.view==="accordion"?"p-6":"pt-6")},[e.createVNode(He,{class:"vs-dataform__form",schema: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,Dd))),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",zd,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:D,disabled:!h.value},[e.createVNode(ze,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Rd)]))}}),[["__scopeId","data-v-473b9d69"]]),At="__vs_form_monaco_loader__",Kn={VsInputText:tt,VsInputRadio:tn,"vs-input-text":tt,"vs-input-password":jl,"vs-input-textarea":Dn,"vs-input-richtext":An,"vs-input-mask":Xt,"vs-input-number":_n,"vs-input-radio":tn,"vs-input-select":on,"vs-input-switcher":Zt,"vs-input-static":Jt,"vs-input-container":Mn,"vs-input-date":La,"vs-input-checkbox":vn,"vs-input-file":Sn,"vs-input-file2":ln,file2:ln,File2:ln,"vs-input-html":Jt,"vs-input-email":Qt,"vs-input-tel":en,"vs-input-datatable":Fn,"vs-input-map":Ln,"vs-input-file-list":Nn,"vs-input-tags":In,"vs-input-slug":Tn,"vs-input-codegen":On,"vs-input-key-value":zn,"vs-input-text[]":Rn,"vs-input-range":Pn,"vs-input-color":jn,"vs-input-native-select":on,VsInputArraySelect:Dt,"vs-input-array":Un,"vs-input-array-select":Dt,"array-select":Dt,"vs-input-address":Hn,"vs-input-datalist":Bd,"vs-input-dataform":jd,"vs-input-monaco":e.defineComponent({__name:"vs-input-monaco",props:e.mergeModels({syntax:{default:"xml"},theme:{default:"vs-light"},height:{default:280},minimap:{type:Boolean,default:!1},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref(null),o=e.computed(()=>typeof t.height=="number"?`${t.height}px`:t.height||"280px");let r=null,s=null,i=!1;const c=()=>{if(s)return Promise.resolve(s);if(typeof window>"u")return Promise.resolve(null);const p=window;if(p.monaco?.editor?.create)return s=p.monaco,Promise.resolve(s);if(p[At])return p[At];const V=(async()=>{const k=h=>{if(Array.from(document.styleSheets||[]).some(w=>w?.href?.includes(h)))return;const y=document.createElement("link");y.rel="stylesheet",y.href=h,document.head.appendChild(y)},v=h=>new Promise((x,y)=>{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=>y(S),document.body.appendChild(b)}),f="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs";return k(`${f}/editor/editor.main.min.css`),await v(`${f}/loader.min.js`),new Promise((h,x)=>{window.require.config({paths:{vs:f}}),window.require(["vs/editor/editor.main"],()=>{s=window.monaco,p.monaco=s,h(s)},y=>x(y))})})().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 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))}})},Pd=e.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(l){const t=l,n=e.inject("values");async function a(){try{if(!t.api)return;const o=t.api.replace("{{value}}",t.value),r=await fetch(o);if(!r.ok){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(l.button),1))}}),Ud={class:"flex flex-col gap-1 w-full"},Hd=["innerHTML"],Gn=e.defineComponent({__name:"vs-compact-form-layout",props:e.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]},columns:{default:()=>({container:12,label:3})}},{modelValue:{default:null},modelModifiers:{}}),emits:e.mergeModels(["value-selected"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=e.useModel(l,"modelValue"),o=t,r=e.computed(()=>zl[`${n.layout}`]),s=["label","placeholder","info","description","text","html"],i=e.ref(x()),c=e.computed(()=>v(n.item,i.value)),d=e.computed(()=>Kn?.[`vs-input-${n.item.type}`]),p=e.inject("field-props"),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 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=g.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",y)}),e.onUnmounted(()=>{window.removeEventListener("storage",y)});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 y(){i.value=x()}return(w,b)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{ua:c.value.ua,error:n.error||"",item:c.value,columns:n.columns,label:c.value.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${n.item.type}-component`])},[e.createElementVNode("div",Ud,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value),e.mergeProps(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,Hd)):e.createCommentVNode("",!0)]),c.value.behavior?.api&&c.value.behavior?.button?(e.openBlock(),e.createBlock(Pd,e.mergeProps({key:0},c.value.behavior,{value:a.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),qd={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},Kd={class:"vs-compact-form-navigation__rail mt-[6px]"},Gd=["onClick"],Yd=ae(e.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(l,{expose:t}){const n=l,a=e.ref([]),o=e.ref(""),r=e.ref(""),s=e.computed(()=>!!n.enabled),i=e.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),c=e.computed(()=>{const I=n.width;if(I==null)return{};const F=typeof I=="number"?`${I}px`:`${I}`;return{width:F,minWidth:F}});let d=null,p=0,g=0,V=null,k=null,v=null;const f=()=>W(),h=()=>y();e.watch(()=>n.target,async I=>{if(D(),!I){V=null,a.value=[],o.value="";return}V=I,s.value&&(await e.nextTick(),S(I),y())},{immediate:!0}),e.watch(()=>n.scrollContainer,I=>{if(!s.value){k=I??null;return}x(I??null),e.nextTick(()=>y())},{immediate:!0}),e.onMounted(()=>{n.scrollContainer||x(null),y()}),e.onBeforeUnmount(()=>{D(),x(null,!0),V=null,typeof window<"u"&&(p&&window.cancelAnimationFrame(p),g&&window.cancelAnimationFrame(g))});function x(I,F=!1){if(v&&(v(),v=null),F){k=null;return}if(k=I??null,typeof window>"u")return;const R=I??window,K=window;R.addEventListener("scroll",f,{passive:!0}),K.addEventListener("resize",h),v=()=>{R.removeEventListener("scroll",f),K.removeEventListener("resize",h)}}function y(){if(!s.value||!V)return;p&&typeof window<"u"&&window.cancelAnimationFrame(p);const I=()=>{w(),p=0};typeof window>"u"?I():p=window.requestAnimationFrame(I)}function w(){if(!s.value||!V)return;const I=Array.from(V.querySelectorAll("h1, h2")),F=new Set,R=[];I.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(I){return I.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function S(I){!I||!s.value||typeof MutationObserver>"u"||(D(),d=new MutationObserver(()=>y()),d.observe(I,{childList:!0,subtree:!0}))}function D(){d&&(d.disconnect(),d=null)}function C(I){const F=k;if(!F)return typeof window>"u"?I.offsetTop:I.getBoundingClientRect().top+window.scrollY;const R=I.getBoundingClientRect(),K=F.getBoundingClientRect();return R.top-K.top+F.scrollTop}function O(){if(!s.value||!a.value.length)return;const I=k,F=(I?I.scrollTop:null)||(typeof window<"u"?window.scrollY:0),R=(I?I.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),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=I?I.scrollHeight-I.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&&(g&&window.cancelAnimationFrame(g),g=window.requestAnimationFrame(()=>{O(),g=0}))}function Y(I){if(!s.value)return;const F=document.getElementById(I);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:y}),(I,F)=>s.value&&a.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(c.value)},[e.createElementVNode("h2",qd,e.toDisplayString(l.title),1),e.createElementVNode("div",Kd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,R=>(e.openBlock(),e.createElementBlock("div",{key:R.id,class:e.normalizeClass(["vs-compact-form-navigation__item relative",R.level===2?"vs-compact-form-navigation__item--nested":"",R.id===o.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick: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,Gd)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-b3e16a91"]]),Xe={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон",minlength:l=>`Мінімальна довжина — ${l} символів`,maxlength:l=>`Максимальна довжина — ${l} символів`},Wd=l=>typeof l=="string"?l.trim()?!1:Xe.required:Array.isArray(l)?l.map(n=>typeof n=="string"?n.trim():n).filter(n=>n!=null&&n!=="").length?!1:Xe.required:l?!1:Xe.required,Zd=l=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return l?t.test(l)?!1:Xe.email:!1},Jd=l=>{const t=/^\+[1-9]\d{1,14}$/;return l?t.test(l)?!1:Xe.tel:!1},Yn=l=>l==null?0:typeof l=="string"?l.trim().length:Array.isArray(l)?l.length:typeof l=="number"?l.toString().length:String(l).length,Xd=(l,t)=>{if(l==null)return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Yn(l)<n?t?.message||Xe.minlength(n):!1},Qd=(l,t)=>{if(l==null||l==="")return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Yn(l)>n?t?.message||Xe.maxlength(n):!1},eu=(l,t)=>{const n=t.pattern??t.regexp,a=typeof n=="string"?new RegExp(n):n;if(Array.isArray(l)){const o=l.filter(Boolean);return o.length===0||o.every(r=>a.test(r))?!1:t.message}return!a.test(l)&&l?t.message:!1},tu=(l,t)=>!1,nu=(l,t)=>{switch(typeof t=="string"?t:t.type){case"required":return Wd(l);case"email":return Zd(l);case"tel":return Jd(l);case"regexp":return eu(l,t);case"minlength":return Xd(l,t);case"maxlength":return Qd(l,t);case"custom":return tu();default:return!1}},lu={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function Wn(l){const t=l?.toLowerCase();return lu[t]||t}function sn(l,t=!1){if(Array.isArray(l)){const a=[];return l.forEach(o=>{const r={...o};r.name=(o.name||o.id||o.key||"").toString(),r.type=Wn(o.type),r.label=o.label||o.ua,r.rules=o.rules||o.validators,r.type==="email"&&!r.rules&&(r.rules=["email"]),o.data&&(r.api=`/api/suggest/${o.data}`),r.disabled=r.disabled??t,Array.isArray(r.schema)&&(r.schema=sn(r.schema,r.disabled)),a.push(r)}),a}const n=[];return Object.entries(l).forEach(a=>{const o={name:a[0],...a[1],type:Wn(a[1].type),label:a[1].label||a[1].ua,rules:a[1].rules||a[1].validators,disabled:a[1].disabled??t};o.type==="email"&&!o.rules&&(o.rules=["email"]),a[1].type?.includes("list")&&(o.multiple=!0),!o.api&&a[1].data&&(o.api=`/api/suggest/${a[1].data}`),Array.isArray(o.schema)&&(o.schema=sn(o.schema,o.disabled)),n.push(o)}),n}function au(l,t,n=!1){const a=e.computed(()=>sn((Array.isArray(t),t),typeof n=="boolean"?n:n.value)),o=e.ref({});function r(d){const p=d?.conditions;if(!p)return!0;const g=Array.isArray(p)?p[0]:p,V=l?.value?.[g];return $n(V,p)}const s=(d=a.value,p=!0)=>(d.forEach(g=>{const V=[],k=Number(g?.minlength),v=Number(g?.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,...g.rules||[]];if(f.length){if(!r(g)){delete o.value[g.name];return}let h=!1,x=null;f.forEach(y=>{const w=nu(l.value[g.name],y);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 ou={class:"flex w-full h-full min-h-0 gap-6"},ru={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},He=e.defineComponent({__name:"vs-compact-form",props:e.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},modelValue:{default:()=>({})},modelModifiers:{},values:{default:void 0},valuesModifiers:{}}),emits:e.mergeModels(["handle-submit","update:modelValue","value-selected"],["update:form","update:modelValue","update:values"]),setup(l,{expose:t,emit:n}){const a=n,o=l,r=e.useModel(l,"form"),s=e.useModel(l,"modelValue"),i=e.useModel(l,"values"),c=e.computed({get:()=>i.value??s.value,set:F=>{s.value=F,i.value=F}}),{errors:d,validate:p,reset:g,visibleSchema:V}=au(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),y=e.computed(()=>o.style?.columns),w=Object.freeze({container:12,label:3}),b=e.computed(()=>o.columns??y.value??w),S=e.computed(()=>o.columns!=null||y.value!=null),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:g,errors:d}),e.onMounted(()=>{r.value={value:c.value,errors:d.value,reset:g,validate:p,formId:o.formId}});function I(F,R){if(F===R)return!0;if(typeof F!="object"||typeof R!="object"||!F||!R)return!1;const 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",ou,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:v},[e.createElementVNode("form",{ref_key:"formRef",ref:k,onSubmit:e.withModifiers(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(Gn,{style:e.normalizeStyle(l.style),item:K,layout:C(K),columns:O(K),"model-value":c.value[K.name],"onUpdate:modelValue":A=>{const Z=c.value[K.name];I(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",ru)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(Yd,{target:k.value,"scroll-container":v.value,enabled:h.value,width:x.value},null,8,["target","scroll-container","enabled","width"])]))}}),su={class:"relative"},iu={class:"w-full h-full fixed top-0 start-0 bg-black bg-opacity-50"},cu={class:"m-[10px] fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 min-h-0 h-fit max-h-[80vh] overflow-hidden opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl lg:w-7/12 w-11/12"},du={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},uu={class:"font-medium text-gray-800 dark:text-[#ffffff]"},pu={class:"p-4 mim-h-0 h-full overflow-auto"},Zn=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{},api:{},method:{}},emits:["close","save","edit"],setup(l,{emit:t}){const n=l,a=t,o=e.ref(n.schema),r=e.ref(n.defaultValue?JSON.parse(JSON.stringify(n.defaultValue)):{}),s=e.ref({}),i=e.ref(n.token||""),c=e.ref(n.mode),d=()=>{const v=n.method?.trim().toUpperCase();return v==="GET"||v==="POST"||v==="PUT"?v:c.value==="add"?"POST":"PUT"},p=()=>{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 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 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),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",su,[e.createElementVNode("div",iu,[e.createElementVNode("div",cu,[e.createElementVNode("div",du,[e.createElementVNode("h3",uu,e.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:k,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},[...f[2]||(f[2]=[e.createElementVNode("span",{class:"sr-only"},"Close",-1),e.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("path",{d:"M18 6 6 18"}),e.createElementVNode("path",{d:"m6 6 12 12"})],-1)])])]),e.createElementVNode("div",pu,[o.value?(e.openBlock(),e.createBlock(He,{key:0,schema:o.value,values:r.value,"onUpdate:values":f[0]||(f[0]=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"}," Зберегти ")])])])]))}}),mu=1440*60*1e3,fu=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],hu=["січ","лют","бер","квіт","трав","черв","лип","серп","вер","жовт","лист","груд"],gu=["нд","пн","вт","ср","чт","пт","сб"];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 yu(l,t){return un(l,-1)}function Ft(l,t){const n=new Date(l);return n.setFullYear(n.getFullYear()+t),n}function Jn(l,t){return Ft(l,-t)}function Xn(l){return Qe(new Date(l.getFullYear(),0,1))}function Qn(l){return dt(new Date(l.getFullYear(),11,31))}function ku(l){const t=Math.floor(l.getFullYear()/10)*10;return Qe(new Date(t,0,1))}function bu(l){const t=Math.floor(l.getFullYear()/10)*10+9;return dt(new Date(t,11,31))}const Te=l=>l.getFullYear(),Lt=l=>Math.floor(l.getFullYear()/10)*10;function wu(l){const t=[];let n=Qe(l.start);const a=Qe(l.end);for(;n<=a;)t.push(lt(n)),n=new Date(n.getTime()+mu);return t}function xu(l){const t=[];let n=cn(l.start);const a=dn(l.end);for(;n<=a;)t.push(lt(n)),n=un(n,1);return t}function _u(l){const t=[];let n=Xn(l.start);const a=Qn(l.end);for(;n<=a;)t.push(lt(n)),n=Ft(n,1);return t}function pn(l,t=1){const n=Qe(l),a=(n.getDay()-t+7)%7;return n.setDate(n.getDate()-a),n}function vu(l,t=1){const n=pn(l,t);return n.setDate(n.getDate()+6),dt(n)}function Eu(l,t,n=0){const a=pn(l,n),o=(t-n+7)%7;return a.setDate(a.getDate()+o),a}const It=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth()&&l.getDate()===t.getDate(),mn=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth(),el=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear(),tl=(l,t)=>!!l&&!!t&&It(l,t)&&l.getHours()===t.getHours(),Vu=(l,t)=>!!l&&!!t&&tl(l,t)&&l.getMinutes()===t.getMinutes();function Cu(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 Bu(l){const t=l.filter(n=>Ve(n));if(t.length)return t.reduce((n,a)=>n.getTime()>=a.getTime()?n:a)}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 nl(l,t){const n=lt(l);return typeof t.year=="number"&&n.setFullYear(t.year),typeof t.month=="number"&&n.setMonth(t.month),typeof t.date=="number"&&n.setDate(t.date),typeof t.hours=="number"&&n.setHours(t.hours),typeof t.minutes=="number"&&n.setMinutes(t.minutes),typeof t.seconds=="number"&&n.setSeconds(t.seconds),typeof t.milliseconds=="number"&&n.setMilliseconds(t.milliseconds),n}const Tt=(l,t=2)=>String(l).padStart(t,"0");function ll(l,t){return t==="wide"?fu[l]:hu[l]}function Nu(l){return gu[l]}const $u=[{token:"LLLL",format:l=>ll(l.getMonth(),"wide")},{token:"LLL",format:l=>ll(l.getMonth(),"abbreviated")},{token:"EE",format:l=>Nu(l.getDay())},{token:"yyyy",format:l=>String(l.getFullYear())},{token:"MM",format:l=>Tt(l.getMonth()+1)},{token:"dd",format:l=>Tt(l.getDate())},{token:"HH",format:l=>Tt(l.getHours())},{token:"mm",format:l=>Tt(l.getMinutes())}];function Ot(l,t){if(!Ve(l))return"";let n="",a=0;for(;a<t.length;){const o=$u.find(r=>t.startsWith(r.token,a));o?(n+=o.format(l),a+=o.token.length):(n+=t[a],a+=1)}return n}const Mu={"yyyy-MM-dd":/^(\d{4})-(\d{2})-(\d{2})$/,"dd.MM.yyyy":/^(\d{2})\.(\d{2})\.(\d{4})$/,"dd.MM.yyyy HH:mm":/^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2})$/,"HH:mm":/^(\d{2}):(\d{2})$/,"MM.yyyy":/^(\d{2})\.(\d{4})$/,yyyy:/^(\d{4})$/};function al(l,t){const n=Mu[t];if(!n){const o=new Date(l);return 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 Du=["year","month","day","time","custom"],Au=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"&&Du.includes(l)}}}),Fu={class:"v3dp__heading"},Lu=["disabled"],Iu=["disabled"],Tu={class:"v3dp__body"},Ou={class:"v3dp__subheading"},zu={class:"v3dp__elements"},Ru=["disabled","onClick"];function ju(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["v3dp__popout",`v3dp__popout-${l.viewMode}`]),style:e.normalizeStyle({"--popout-column-definition":`repeat(${l.columnCount}, 1fr)`}),onMousedown:t[3]||(t[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Fu,[e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__left",disabled:l.leftDisabled,onClick:t[0]||(t[0]=e.withModifiers(s=>l.$emit("left"),["stop","prevent"]))},[e.renderSlot(l.$slots,"arrow-left",{},()=>[t[4]||(t[4]=e.createElementVNode("svg",{class:"v3dp__heading__icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 8"},[e.createElementVNode("g",{fill:"none","fill-rule":"evenodd"},[e.createElementVNode("path",{stroke:"none",d:"M-9 16V-8h24v24z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 0L1 4l4 4"})])],-1))],!0)],8,Lu),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.headingClickable?"button":"span"),{class:"v3dp__heading__center",onClick:t[1]||(t[1]=e.withModifiers(s=>l.$emit("heading"),["stop","prevent"]))},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"heading",{},void 0,!0)]),_:3})),e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__right",disabled:l.rightDisabled,onClick:t[2]||(t[2]=e.withModifiers(s=>l.$emit("right"),["stop","prevent"]))},[e.renderSlot(l.$slots,"arrow-right",{},()=>[t[5]||(t[5]=e.createElementVNode("svg",{class:"v3dp__heading__icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 8"},[e.createElementVNode("g",{fill:"none","fill-rule":"evenodd"},[e.createElementVNode("path",{stroke:"none",d:"M15-8v24H-9V-8z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M1 8l4-4-4-4"})])],-1))],!0)],8,Iu)]),e.createElementVNode("div",Tu,["subheading"in l.$slots?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Ou,[e.renderSlot(l.$slots,"subheading",{},void 0,!0)]),t[6]||(t[6]=e.createElementVNode("hr",{class:"v3dp__divider"},null,-1))],64)):e.createCommentVNode("",!0),e.createElementVNode("div",zu,[e.renderSlot(l.$slots,"body",{},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.items,s=>(e.openBlock(),e.createElementBlock("button",{key:s.key,disabled:s.disabled,class:e.normalizeClass([{selected:s.selected,current:s.current},`v3dp__element__button__${l.viewMode}`]),onClick:e.withModifiers(i=>l.$emit("elementClick",s.value),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(s.display),1)],10,Ru))),128))],!0)])])],38)}const zt=ae(Au,[["render",ju],["__scopeId","data-v-5de7813f"]]),Pu=e.defineComponent({components:{PickerPopup:zt},emits:{"update:pageDate":l=>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(()=>ku(l.pageDate)),a=e.computed(()=>bu(l.pageDate)),o=(g,V,k)=>!V&&!k?!0:!(V&&Te(g)<Te(V)||k&&Te(g)>Te(k)),r=e.computed(()=>_u({start:n.value,end:a.value}).map(g=>({value:g,key:String(Te(g)),display:Te(g),selected:!!l.selected&&Te(g)===Te(l.selected),disabled:!o(g,l.lowerLimit,l.upperLimit)}))),s=e.computed(()=>{const g=Te(n.value),V=Te(a.value);return`${g} - ${V}`}),i=e.computed(()=>l.lowerLimit&&(Lt(l.lowerLimit)===Lt(l.pageDate)||ut(l.pageDate,l.lowerLimit))),c=e.computed(()=>l.upperLimit&&(Lt(l.upperLimit)===Lt(l.pageDate)||pt(l.pageDate,l.upperLimit)));return{years:r,heading:s,leftDisabled:i,rightDisabled:c,previousPage:()=>t("update:pageDate",Jn(l.pageDate,10)),nextPage:()=>t("update:pageDate",Ft(l.pageDate,10))}}});function Uu(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{columnCount:3,leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,items:l.years,viewMode:"year",onLeft:l.previousPage,onRight:l.nextPage,onElementClick:t[0]||(t[0]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const Hu=ae(Pu,[["render",Uu]]),qu=e.defineComponent({components:{PickerPopup:zt},emits:{"update:pageDate":l=>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(()=>Xn(l.pageDate)),a=e.computed(()=>Qn(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(()=>xu({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&&(el(l.lowerLimit,l.pageDate)||ut(l.pageDate,l.lowerLimit))),d=e.computed(()=>l.upperLimit&&(el(l.upperLimit,l.pageDate)||pt(l.pageDate,l.upperLimit)));return{months:s,heading:i,leftDisabled:c,rightDisabled:d,previousPage:()=>t("update:pageDate",Jn(l.pageDate,1)),nextPage:()=>t("update:pageDate",Ft(l.pageDate,1))}}});function Ku(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:3,items:l.months,leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,viewMode:"month",onLeft:l.previousPage,onRight:l.nextPage,onHeading:t[0]||(t[0]=i=>l.$emit("back")),onElementClick:t[1]||(t[1]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),_:1},8,["items","leftDisabled","rightDisabled","onLeft","onRight"])}const Gu=ae(qu,[["render",Ku]]),Yu=e.defineComponent({components:{PickerPopup:zt},emits:{"update:pageDate":l=>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:vu(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 y=n.value(l.weekdayFormat);return Array.from(Array(7)).map((w,b)=>(h+b)%7).map(w=>Eu(new Date,w,l.weekStartsOn)).map(y)}),d=(h,x,y,w)=>w?.dates?.some(b=>It(h,b))||w?.predicate?.(h)?!1:!x&&!y?!0:!(x&&ut(h,Qe(x))||y&&pt(h,dt(y))),p=e.computed(()=>{const h=new Date,x=n.value(l.format);return wu(s.value).map(y=>({value:y,display:x(y),selected:!!l.selected&&It(l.selected,y),current:It(h,y),disabled:!l.allowOutsideInterval&&!Cu(y,r.value)||!d(y,l.lowerLimit,l.upperLimit,l.disabledDates),key:n.value("yyyy-MM-dd")(y)}))}),g=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:g,leftDisabled:V,rightDisabled:k,previousPage:()=>t("update:pageDate",yu(l.pageDate)),nextPage:()=>t("update:pageDate",un(l.pageDate,1))}}});function Wu(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,items:l.days,viewMode:"day",onLeft:l.previousPage,onRight:l.nextPage,onHeading:t[0]||(t[0]=i=>l.$emit("back")),onElementClick:t[1]||(t[1]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),subheading:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.weekDays,(i,c)=>(e.openBlock(),e.createElementBlock("span",{key:i,class:e.normalizeClass(`v3dp__subheading__weekday__${c}`)},e.toDisplayString(i),3))),128))]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const Zu=ae(Yu,[["render",Wu]]);function ol(l,t){const n=l.getBoundingClientRect(),a={height:l.clientHeight,width:l.clientWidth},o=t.getBoundingClientRect();if(!(o.top>=n.top&&o.bottom<=n.top+a.height)){const s=o.top-n.top,i=o.bottom-n.bottom;Math.abs(s)<Math.abs(i)?l.scrollTop+=s:l.scrollTop+=i}}const Ju=e.defineComponent({components:{PickerPopup:zt},emits:{select:l=>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:nl(new Date(o.value.getTime()),{hours:k,minutes:s.value,seconds:0}),selected:r.value===k,ref:e.ref(null)}))),c=e.computed(()=>[...Array(60).keys()].map(k=>({value:k,date:nl(new Date(o.value.getTime()),{hours:r.value,minutes:k,seconds:0}),selected:s.value===k,ref:e.ref(null)}))),d=k=>{s.value=k.value,t("select",k.date)},p=()=>{const k=i.value.find(f=>f.ref.value?.classList?.contains("selected")??!1),v=c.value.find(f=>f.ref.value?.classList?.contains("selected")??!1);k&&v&&(ol(n.value,k.ref.value),ol(a.value,v.ref.value))};return e.watch(()=>l.visible,k=>{k&&e.nextTick(p)}),{hoursListRef:n,minutesListRef:a,hours:r,minutes:s,hoursList:i,minutesList:c,padStartZero:k=>`0${k}`.substr(-2),selectMinutes:d,isEnabled:k=>!(l.disabledTime?.dates?.some(v=>tl(k,v)&&Vu(k,v))||l.disabledTime?.predicate?.(k)),scroll:p}}}),Xu={ref:"hoursListRef",class:"v3dp__column"},Qu=["disabled","onClick"],ep={ref:"minutesListRef",class:"v3dp__column"},tp=["disabled","onClick"];function np(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:2,leftDisabled:!0,rightDisabled:!0,viewMode:"time",onHeading:t[0]||(t[0]=i=>l.$emit("back"))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.padStartZero(l.hours))+":"+e.toDisplayString(l.padStartZero(l.minutes)),1)]),body:e.withCtx(()=>[e.createElementVNode("div",Xu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.hoursList,i=>(e.openBlock(),e.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:e.normalizeClass([{selected:i.selected},"v3dp__element_button__hour"]),disabled:!l.isEnabled(i.date),onClick:e.withModifiers(c=>l.hours=i.value,["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,Qu))),128))],512),e.createElementVNode("div",ep,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.minutesList,i=>(e.openBlock(),e.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:e.normalizeClass([{selected:i.selected},"v3dp__element_button__minute"]),disabled:!l.isEnabled(i.date),onClick:e.withModifiers(c=>l.selectMinutes(i),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,tp))),128))],512)]),_:1})}const lp=ae(Ju,[["render",np],["__scopeId","data-v-43e01bf7"]]),Rt=["time","day","month","year"],ap=(l,t,n=void 0)=>{let a=n||new Date;const o=Bu([l,a]);o&&(a=o);const r=Su([t,a]);return r&&(a=r),a},op=e.defineComponent({components:{YearPicker:Hu,MonthPicker:Gu,DayPicker:Zu,TimePicker:lp},inheritAttrs:!1,props:{placeholder:{type:String,default:""},modelValue:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1},disabledTime:{type:Object,required:!1},upperLimit:{type:Date,required:!1},lowerLimit:{type:Date,required:!1},startingView:{type:String,required:!1,default:"day",validate:l=>typeof l=="string"&&Rt.includes(l)},startingViewDate:{type:Date,required:!1,default:()=>new Date},dayPickerHeadingFormat:{type:String,required:!1,default:"LLLL yyyy"},monthListFormat:{type:String,required:!1,default:"LLL"},weekdayFormat:{type:String,required:!1,default:"EE"},dayFormat:{type:String,required:!1,default:"dd"},inputFormat:{type:String,required:!1,default:"yyyy-MM-dd"},weekDayNames:{type:Array,required:!1},weekStartsOn:{type:Number,required:!1,default:1,validator:l=>[0,1,2,3,4,5,6].includes(l)},disabled:{type:Boolean,required:!1,default:!1},clearable:{type:Boolean,required:!1,default:!1},typeable:{type:Boolean,required:!1,default:!1},minimumView:{type:String,required:!1,default:"day",validate:l=>typeof l=="string"&&Rt.includes(l)}},emits:{"update:modelValue":l=>l==null||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,g=null;const V=()=>{p?.destroy(),p=null},k=async()=>{if(!g){const{default:T}=await Promise.resolve().then(()=>kn);g=T}return g},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=al(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||ap(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)},y=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(I.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=al(r.value.value,l.inputFormat);q&&i.value===Ot(q,l.inputFormat)&&(i.value=r.value.value,t("update:modelValue",q))}},I=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:y,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:I,log:T=>console.log(T),variables:F}}}),rp={class:"v3dp__input_wrapper"},sp=["readonly","placeholder","disabled","tabindex"],ip={class:"v3dp__clearable"};function cp(l,t,n,a,o,r){const s=e.resolveComponent("year-picker"),i=e.resolveComponent("month-picker"),c=e.resolveComponent("day-picker"),d=e.resolveComponent("time-picker");return e.openBlock(),e.createElementBlock("div",{class:"v3dp__datepicker",style:e.normalizeStyle(l.variables(l.$attrs.style))},[e.createElementVNode("div",rp,[e.withDirectives(e.createElementVNode("input",e.mergeProps({type:"text",ref:"inputRef",readonly:!l.typeable,"onUpdate:modelValue":t[0]||(t[0]=p=>l.input=p)},l.$attrs,{placeholder:l.placeholder,disabled:l.disabled,tabindex:l.disabled?-1:0,onKeyup:t[1]||(t[1]=(...p)=>l.keyUp&&l.keyUp(...p)),onBlur:t[2]||(t[2]=(...p)=>l.blur&&l.blur(...p)),onFocus:t[3]||(t[3]=(...p)=>l.focus&&l.focus(...p)),onClick:t[4]||(t[4]=(...p)=>l.click&&l.click(...p))}),null,16,sp),[[e.vModelText,l.input]]),e.withDirectives(e.createElementVNode("div",ip,[e.renderSlot(l.$slots,"clear",{onClear:l.clearModelValue},()=>[e.createElementVNode("i",{onClick:t[5]||(t[5]=p=>l.clearModelValue())},"x")])],512),[[e.vShow,l.clearable&&l.modelValue]])]),e.withDirectives(e.createVNode(s,{pageDate:l.pageDate,"onUpdate:pageDate":t[6]||(t[6]=p=>l.updatePageDate("year",p)),selected:l.modelValue,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,onSelect:l.selectYear},null,8,["pageDate","selected","lowerLimit","upperLimit","onSelect"]),[[e.vShow,l.viewShown==="year"]]),e.withDirectives(e.createVNode(i,{pageDate:l.pageDate,"onUpdate:pageDate":t[7]||(t[7]=p=>l.updatePageDate("month",p)),selected:l.modelValue,onSelect:l.selectMonth,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,format:l.monthListFormat,onBack:t[8]||(t[8]=p=>l.viewShown="year")},null,8,["pageDate","selected","onSelect","lowerLimit","upperLimit","format"]),[[e.vShow,l.viewShown==="month"]]),e.withDirectives(e.createVNode(c,{pageDate:l.pageDate,"onUpdate:pageDate":t[9]||(t[9]=p=>l.updatePageDate("day",p)),selected:l.modelValue,weekStartsOn:l.weekStartsOn,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,headingFormat:l.dayPickerHeadingFormat,disabledDates:l.disabledDates,weekdayFormat:l.weekdayFormat,"allow-outside-interval":l.allowOutsideInterval,format:l.dayFormat,"custom-weekdays":l.normalizedWeekdayNames,onSelect:l.selectDay,onBack:t[10]||(t[10]=p=>l.viewShown="month")},null,8,["pageDate","selected","weekStartsOn","lowerLimit","upperLimit","headingFormat","disabledDates","weekdayFormat","allow-outside-interval","format","custom-weekdays","onSelect"]),[[e.vShow,l.viewShown==="day"]]),e.withDirectives(e.createVNode(d,{pageDate:l.pageDate,visible:l.viewShown==="time",selected:l.modelValue,disabledTime:l.disabledTime,onSelect:l.selectTime,onBack:l.goBackFromTimepicker},null,8,["pageDate","visible","selected","disabledTime","onSelect","onBack"]),[[e.vShow,l.viewShown==="time"]])],4)}const dp=ae(op,[["render",cp]]),up=ae(e.defineComponent({__name:"vs-input-date2",props:{clearable:{type:Boolean,default:!0},now:{type:Boolean},editable:{type:Boolean,default:!0},time:{type:Boolean},isInfinity:{type:Boolean},mode:{default:"date"},weekStart:{},dayNames:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,{inputClass:o}=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))}),g=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],V=e.computed(()=>{if(n.dayNames?.length)return n.dayNames.length===7?n.dayNames:g}),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"})),y=e.ref(!1);e.watch(()=>n.modelValue,A=>{A?y.value=!0:n.now||(y.value=!1)},{immediate:!0}),e.watchEffect(()=>{n.now&&!n.modelValue&&!y.value&&(a("update:modelValue",b(new Date,r.value)),y.value=!0)});function w(A,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 I(A);case"month":return W(A);case"year":return Y(A);case"week":return F(A);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)}`}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 I(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(dp,{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-97661afe"]]),rl=(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:Zn,contentProps:{...l,onClose:()=>{t(null),n()},onSave:a=>{t(a),n()}}})});He.install=function(t){t.component("VForm",He),Object.assign(t.config.globalProperties,{$form:rl}),t.provide("form",rl),window.v3plugin||(window.v3plugin={})};function Ke(l){return typeof l=="string"||l instanceof String}function sl(l){var t;return typeof l=="object"&&l!=null&&(l==null||(t=l.constructor)==null?void 0:t.name)==="Object"}function il(l,t){return Array.isArray(t)?il(l,(n,a)=>t.includes(a)):Object.entries(l).reduce((n,a)=>{let[o,r]=a;return t(r,o)&&(n[o]=r),n},{})}const Q={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function cl(l){switch(l){case Q.LEFT:return Q.FORCE_LEFT;case Q.RIGHT:return Q.FORCE_RIGHT;default:return l}}function fn(l){return l.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function jt(l,t){if(t===l)return!0;const n=Array.isArray(t),a=Array.isArray(l);let o;if(n&&a){if(t.length!=l.length)return!1;for(o=0;o<t.length;o++)if(!jt(t[o],l[o]))return!1;return!0}if(n!=a)return!1;if(t&&l&&typeof t=="object"&&typeof l=="object"){const r=t instanceof Date,s=l instanceof Date;if(r&&s)return t.getTime()==l.getTime();if(r!=s)return!1;const i=t instanceof RegExp,c=l instanceof RegExp;if(i&&c)return t.toString()==l.toString();if(i!=c)return!1;const d=Object.keys(t);for(o=0;o<d.length;o++)if(!Object.prototype.hasOwnProperty.call(l,d[o]))return!1;for(o=0;o<d.length;o++)if(!jt(l[d[o]],t[d[o]]))return!1;return!0}else if(t&&l&&typeof t=="function"&&typeof l=="function")return t.toString()===l.toString();return!1}class pp{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?Q.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?Q.RIGHT:Q.LEFT}}function se(l,t){return new se.InputMask(l,t)}function dl(l){if(l==null)throw new Error("mask property should be defined");return l instanceof RegExp?se.MaskedRegExp:Ke(l)?se.MaskedPattern:l===Date?se.MaskedDate:l===Number?se.MaskedNumber:Array.isArray(l)||l===Array?se.MaskedDynamic:se.Masked&&l.prototype instanceof se.Masked?l:se.Masked&&l instanceof se.Masked?l.constructor:l instanceof Function?se.MaskedFunction:(console.warn("Mask not found for mask",l),se.Masked)}function at(l){if(!l)throw new Error("Options in not defined");if(se.Masked){if(l.prototype instanceof se.Masked)return{mask:l};const{mask:t=void 0,...n}=l instanceof se.Masked?{mask:l}:sl(l)&&l.mask instanceof se.Masked?l:{};if(t){const a=t.mask;return{...il(t,(o,r)=>!r.startsWith("_")),mask:t.constructor,_mask:a,...n}}}return sl(l)?{...l}:{mask:l}}function Re(l){if(se.Masked&&l instanceof se.Masked)return l;const t=at(l),n=dl(t.mask);if(!n)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===n&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new n(t)}se.createMask=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 ul=90,mp=89;class mt extends Pt{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,n,a;return(t=(n=(a=this.input).getRootNode)==null?void 0:n.call(a))!=null?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){if(this._handlers.redo&&(t.keyCode===ul&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===mp&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===ul&&(t.metaKey||t.ctrlKey))return t.preventDefault(),this._handlers.undo(t);t.isComposing||this._handlers.selectionChange(t)}_onBeforeinput(t){if(t.inputType==="historyUndo"&&this._handlers.undo)return t.preventDefault(),this._handlers.undo(t);if(t.inputType==="historyRedo"&&this._handlers.redo)return t.preventDefault(),this._handlers.redo(t)}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}se.HTMLMaskElement=mt;class pl extends mt{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,n){this.input.setSelectionRange(t,n)}get value(){return this.input.value}set value(t){this.input.value=t}}se.HTMLMaskElement=mt;class hn extends mt{get _unsafeSelectionStart(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),a=n&&n.anchorOffset,o=n&&n.focusOffset;return o==null||a==null||a<o?a:o}get _unsafeSelectionEnd(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),a=n&&n.anchorOffset,o=n&&n.focusOffset;return o==null||a==null||a>o?a:o}_unsafeSelect(t,n){if(!this.rootElement.createRange)return;const a=this.rootElement.createRange();a.setStart(this.input.firstChild||this.input,t),a.setEnd(this.input.lastChild||this.input,n);const o=this.rootElement,r=o.getSelection&&o.getSelection();r&&(r.removeAllRanges(),r.addRange(a))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}se.HTMLContenteditableMaskElement=hn;class Ut{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>Ut.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}Ut.MAX_LENGTH=100;class ml{constructor(t,n){this.el=t instanceof Pt?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new hn(t):new pl(t),this.masked=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===dl(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 pp({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),a=this.masked.rawInputValue,o=this.masked.splice(n.startChangePos,n.removed.length,n.inserted,n.removeDirection,{input:!0,raw:!0}).offset,r=a===this.masked.rawInputValue?n.removeDirection:Q.NONE;let s=this.masked.nearestInputPos(n.startChangePos+o,r);r!==Q.NONE&&(s=this.masked.nearestInputPos(s,Q.NONE)),this.updateControl(s),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}se.InputMask=ml;class ce{static normalize(t){return Array.isArray(t)?t:[t,new ce]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}se.ChangeDetails=ce;class 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 ce({inserted:t,rawInserted:t})):new ce}_appendChar(t,n,a){n===void 0&&(n={});const o=this.state;let r;if([t,r]=this.doPrepareChar(t,n),t&&(r=r.aggregate(this._appendCharRaw(t,n)),!r.rawInserted&&this.autofix==="pad")){const s=this.state;this.state=o;let i=this.pad(n);const c=this._appendCharRaw(t,n);i=i.aggregate(c),c.rawInserted||i.equals(r)?r=i:this.state=s}if(r.inserted){let s,i=this.doValidate(n)!==!1;if(i&&a!=null){const c=this.state;if(this.overwrite===!0){s=a.state;for(let p=0;p<r.rawInserted.length;++p)a.unshift(this.displayValue.length-r.tailShift)}let d=this.appendTail(a);if(i=d.rawInserted.length===a.toString().length,!(i&&d.inserted)&&this.overwrite==="shift"){this.state=c,s=a.state;for(let p=0;p<r.rawInserted.length;++p)a.shift();d=this.appendTail(a),i=d.rawInserted.length===a.toString().length}i&&d.inserted&&(this.state=c)}i||(r=new ce,this.state=o,a&&s&&(a.state=s))}return r}_appendPlaceholder(){return new ce}_appendEager(){return new ce}append(t,n,a){if(!Ke(t))throw new Error("value should be string");const o=Ke(a)?new 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 ce}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const n=this.rawInputValue,a=this.value,o=t();return this.rawInputValue=n,this.value&&this.value!==a&&a.indexOf(this.value)===0&&(this.append(a.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,o}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const n=this.state,a=t(this);return this.state=n,delete this._isolated,a}doSkipInvalid(t,n,a){return!!this.skipInvalid}doPrepare(t,n){return n===void 0&&(n={}),ce.normalize(this.prepare?this.prepare(t,this,n):t)}doPrepareChar(t,n){return n===void 0&&(n={}),ce.normalize(this.prepareChar?this.prepareChar(t,this,n):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,n,a,o,r){a===void 0&&(a=""),o===void 0&&(o=Q.NONE),r===void 0&&(r={input:!0});const s=t+n,i=this.extractTail(s),c=this.eager===!0||this.eager==="remove";let d;c&&(o=cl(o),d=this.extractInput(0,s,{raw:!0}));let p=t;const g=new ce;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 V;for(;d===this.rawInputValue&&(V=this.displayValue.length);)g.aggregate(new ce({tailShift:-1})).aggregate(this.remove(V-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!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 ce}}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 ce;for(let a=0;a<this.chunks.length;++a){const o=this.chunks[a],r=t._mapPosToBlock(t.displayValue.length),s=o.stop;let i;if(s!=null&&(!r||r.index<=s)&&((o instanceof Ge||t._stops.indexOf(s)>=0)&&n.aggregate(t._appendPlaceholder(s)),i=o instanceof Ge&&t._blocks[s]),i){const c=i.appendTail(o);n.aggregate(c);const d=o.toString().slice(c.rawInserted.length);d&&n.aggregate(t.append(d,{tail:!0}))}else n.aggregate(t.append(o.toString(),{tail:!0}))}return n}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:n,...a}=t;Object.assign(this,a),this.chunks=n.map(o=>{const r="chunks"in o?new Ge:new 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 fp{constructor(t,n){this.masked=t,this._log=[];const{offset:a,index:o}=t._mapPosToBlock(n)||(n<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=a,this.index=o,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((n=this.block)==null?void 0:n.displayValue.length)||0){var n;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,Q.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,Q.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Q.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,Q.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,Q.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Q.NONE),!0})}}class gn{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(n),this._value||(this._isRawInput=!1),new ce}nearestInputPos(t,n){n===void 0&&(n=Q.NONE);const a=0,o=this._value.length;switch(n){case Q.LEFT:case Q.FORCE_LEFT:return a;case Q.NONE:case Q.RIGHT:case Q.FORCE_RIGHT:default:return o}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._isRawInput?n-t:0}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),a===void 0&&(a={}),a.raw&&this._isRawInput&&this._value.slice(t,n)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new ce;const a=this.eager===!0||this.eager==="append",r=this.char===t&&(this.isUnmasking||n.input||n.raw)&&(!n.raw||!a)&&!n.tail,s=new ce({inserted:this.char,rawInserted:r?this.char:""});return this._value=this.char,this._isRawInput=r&&(n.raw||n.input),s}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new ce;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new 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 ce}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new ce;const a=this.masked.state;let o=this.masked._appendChar(t,this.currentMaskFlags(n));return o.inserted&&this.doValidate(n)===!1&&(o=new ce,this.masked.state=a),!o.inserted&&!this.isOptional&&!this.lazy&&!n.input&&(o.inserted=this.placeholderChar),o.skip=!o.inserted&&!this.isOptional,this.isFilled=!!o.inserted,o}append(t,n,a){return this.masked.append(t,this.currentMaskFlags(n),a)}_appendPlaceholder(){return this.isFilled||this.isOptional?new ce:(this.isFilled=!0,new ce({inserted:this.placeholderChar}))}_appendEager(){return new ce}extractTail(t,n){return this.masked.extractTail(t,n)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.masked.extractInput(t,n,a)}nearestInputPos(t,n){n===void 0&&(n=Q.NONE);const a=0,o=this.value.length,r=Math.min(Math.max(t,a),o);switch(n){case Q.LEFT:case Q.FORCE_LEFT:return this.isComplete?r:a;case Q.RIGHT:case Q.FORCE_RIGHT:return this.isComplete?r:o;case Q.NONE:default:return r}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.value.slice(t,n).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var n;return{...t,_beforeTailState:(t==null||(n=t._beforeTailState)==null?void 0:n.masked)||t?._beforeTailState}}pad(t){return new ce}}ft.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class fl extends 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=fl;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 g=p[0];if(g){const{expose:V,repeat:k,...v}=at(this.blocks[g]),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[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===Be.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){a=!a;continue}if(s==="["||s==="]"){o=!o;continue}if(s===Be.ESCAPE_CHAR){if(++r,s=n[r],!s)break;i=!1}const c=i?new ft({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...at(t[s]),parent:this}):new gn({char:s,eager:this.eager,isUnmasking:a});this._blocks.push(c)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:n,...a}=t;this._blocks.forEach((o,r)=>o.state=n[r]),super.state=a}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,n)=>t+=n.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(n),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,n)=>t+=n.value,"")}set value(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(n),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(n),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,n)=>t+=n.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const n=new ce;let a=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(a==null)return n;this._blocks[a].isFilled&&++a;for(let o=a;o<this._blocks.length;++o){const r=this._blocks[o]._appendEager();if(!r.inserted)break;n.aggregate(r)}return n}_appendCharRaw(t,n){n===void 0&&(n={});const a=this._mapPosToBlock(this.displayValue.length),o=new ce;if(!a)return o;for(let s=a.index,i;i=this._blocks[s];++s){var r;const c=i._appendChar(t,{...n,_beforeTailState:(r=n._beforeTailState)==null||(r=r._blocks)==null?void 0:r[s]});if(o.aggregate(c),c.consumed)break}return o}extractTail(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=new Ge;return t===n||this._forEachBlocksInRange(t,n,(o,r,s,i)=>{const c=o.extractTail(s,i);c.stop=this._findStopBefore(r),c.from=this._blockStartPos(r),c instanceof Ge&&(c.blockIndex=r),a.extend(c)}),a}extractInput(t,n,a){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),a===void 0&&(a={}),t===n)return"";let o="";return this._forEachBlocksInRange(t,n,(r,s,i,c)=>{o+=r.extractInput(i,c,a)}),o}_findStopBefore(t){let n;for(let a=0;a<this._stops.length;++a){const o=this._stops[a];if(o<=t)n=o;else break}return n}_appendPlaceholder(t){const n=new ce;if(this.lazy&&t==null)return n;const a=this._mapPosToBlock(this.displayValue.length);if(!a)return n;const o=a.index,r=t??this._blocks.length;return this._blocks.slice(o,r).forEach(s=>{if(!s.lazy||t!=null){var i;n.aggregate(s._appendPlaceholder((i=s._blocks)==null?void 0:i.length))}}),n}_mapPosToBlock(t){let n="";for(let a=0;a<this._blocks.length;++a){const o=this._blocks[a],r=n.length;if(n+=o.displayValue,t<=n.length)return{index:a,offset:t-r}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((n,a)=>n+=a.displayValue.length,0)}_forEachBlocksInRange(t,n,a){n===void 0&&(n=this.displayValue.length);const o=this._mapPosToBlock(t);if(o){const r=this._mapPosToBlock(n),s=r&&o.index===r.index,i=o.offset,c=r&&s?r.offset:this._blocks[o.index].displayValue.length;if(a(this._blocks[o.index],o.index,i,c),r&&!s){for(let d=o.index+1;d<r.index;++d)a(this._blocks[d],d,0,this._blocks[d].displayValue.length);a(this._blocks[r.index],r.index,0,r.offset)}}}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=super.remove(t,n);return this._forEachBlocksInRange(t,n,(o,r,s,i)=>{a.aggregate(o.remove(s,i))}),a}nearestInputPos(t,n){if(n===void 0&&(n=Q.NONE),!this._blocks.length)return 0;const a=new fp(this,t);if(n===Q.NONE)return a.pushRightBeforeInput()||(a.popState(),a.pushLeftBeforeInput())?a.pos:this.displayValue.length;if(n===Q.LEFT||n===Q.FORCE_LEFT){if(n===Q.LEFT){if(a.pushRightBeforeFilled(),a.ok&&a.pos===t)return t;a.popState()}if(a.pushLeftBeforeInput(),a.pushLeftBeforeRequired(),a.pushLeftBeforeFilled(),n===Q.LEFT){if(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.ok&&a.pos<=t||(a.popState(),a.ok&&a.pos<=t))return a.pos;a.popState()}return a.ok?a.pos:n===Q.FORCE_LEFT?0:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:0)}return n===Q.RIGHT||n===Q.FORCE_RIGHT?(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.pushRightBeforeFilled()?a.pos:n===Q.FORCE_RIGHT?this.displayValue.length:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:this.nearestInputPos(t,Q.LEFT))):t}totalInputPositions(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);let a=0;return this._forEachBlocksInRange(t,n,(o,r,s,i)=>{a+=o.totalInputPositions(s,i)}),a}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const n=this._maskedBlocks[t];return n?n.map(a=>this._blocks[a]):[]}pad(t){const n=new ce;return this._forEachBlocksInRange(0,this.displayValue.length,a=>n.aggregate(a.pad(t))),n}}Be.DEFAULTS={...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 ce;if(this.value.length===this.maxLength)return n;const a=this.value,o=this.maxLength-this.value.length;if(o){this.reset();for(let r=0;r<o;++r)n.aggregate(super._appendCharRaw("0",t));a.split("").forEach(r=>this._appendCharRaw(r))}return n}}se.MaskedRange=ht;const hp="d{.}`m{.}`Y";class 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:hp,format:(l,t)=>{if(!l)return"";const n=String(l.getDate()).padStart(2,"0"),a=String(l.getMonth()+1).padStart(2,"0"),o=l.getFullYear();return[n,a,o].join(".")},parse:(l,t)=>{const[n,a,o]=l.split(".").map(Number);return new Date(o,a-1,n)}},se.MaskedDate=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 ce,p=c?.state;return this.currentMask=this.doDispatch(t,{...n},a),this.currentMask&&(this.currentMask!==c?(this.currentMask.reset(),s&&(this.currentMask.append(s,{raw:!0}),d.tailShift=this.currentMask.value.length-o.length),i&&(d.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):p&&(this.currentMask.state=p)),d}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const n=new ce;return t&&n.aggregate(this._applyDispatch("",{},t)),n.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var n,a;return{...t,_beforeTailState:((n=t._beforeTailState)==null?void 0:n.currentMaskRef)===this.currentMask&&((a=t._beforeTailState)==null?void 0:a.currentMask)||t._beforeTailState}}doDispatch(t,n,a){return n===void 0&&(n={}),a===void 0&&(a=""),this.dispatch(t,this,n,a)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,n){n===void 0&&(n={});let[a,o]=super.doPrepare(t,n);if(this.currentMask){let r;[a,r]=super.doPrepare(a,this.currentMaskFlags(n)),o=o.aggregate(r)}return[a,o]}doPrepareChar(t,n){n===void 0&&(n={});let[a,o]=super.doPrepareChar(t,n);if(this.currentMask){let r;[a,r]=super.doPrepareChar(a,this.currentMaskFlags(n)),o=o.aggregate(r)}return[a,o]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(n=>n.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask){this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,this._applyDispatch();return}let n=String(t);this.currentMask&&(this.currentMask.typedValue=t,n=this.currentMask.unmaskedValue),this.unmaskedValue=n}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return!!((t=this.currentMask)!=null&&t.isComplete)}get isFilled(){var t;return!!((t=this.currentMask)!=null&&t.isFilled)}remove(t,n){const a=new ce;return this.currentMask&&a.aggregate(this.currentMask.remove(t,n)).aggregate(this._applyDispatch()),a}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(n=>n.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:n,currentMaskRef:a,currentMask:o,...r}=t;n&&this.compiledMasks.forEach((s,i)=>s.state=n[i]),a!=null&&(this.currentMask=a,this.currentMask.state=o),super.state=r}extractInput(t,n,a){return this.currentMask?this.currentMask.extractInput(t,n,a):""}extractTail(t,n){return this.currentMask?this.currentMask.extractTail(t,n):super.extractTail(t,n)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,n){return this.currentMask?this.currentMask.nearestInputPos(t,n):super.nearestInputPos(t,n)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((n,a)=>{if(!t[a])return;const{mask:o,...r}=t[a];return jt(n,r)&&n.maskEquals(o)}):super.maskEquals(t)}typedValueEquals(t){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(t))}}gt.DEFAULTS={...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 ce({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 ce;const a=Math.min(super.nearestInputPos(0,Q.FORCE_RIGHT),this.value.length);let o;for(o=t;o>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(a,o),a)).length>1);--o);const r=super.remove(o,n);return r.tailShift+=o-t,r}get isComplete(){return this.enum.indexOf(this.value)>=0}}yt.DEFAULTS={...Be.DEFAULTS,matchValue:(l,t,n)=>l.indexOf(t,n)===n},se.MaskedEnum=yt;class hl extends Ce{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}se.MaskedFunction=hl;var gl;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 ce({inserted:this._value.slice(r.length),rawInserted:c?"":t,skip:c}):(this._value=r,d=new ce),this._value=this._insertThousandsSeparators(this._value);const p=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,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 ce({tailShift:(s-r)*this.thousandsSeparator.length})}nearestInputPos(t,n){if(!this.thousandsSeparator)return t;switch(n){case Q.NONE:case Q.LEFT:case Q.FORCE_LEFT:{const a=this._findSeparatorAround(t-1);if(a>=0){const o=a+this.thousandsSeparator.length;if(t<o||this.value.length<=o||n===Q.FORCE_LEFT)return a}break}case Q.RIGHT:case Q.FORCE_RIGHT:{const a=this._findSeparatorAround(t);if(a>=0)return a+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let n=t;this.min!=null&&(n=Math.max(n,this.min)),this.max!=null&&(n=Math.min(n,this.max)),n!==t&&(this.unmaskedValue=this.format(n,this));let a=this.value;this.normalizeZeros&&(a=this._normalizeZeros(a)),this.padFractionalZeros&&this.scale>0&&(a=this._padFractionalZeros(a)),this._value=a}super.doCommit()}_normalizeZeros(t){const n=this._removeThousandsSeparators(t).split(this.radix);return n[0]=n[0].replace(/^(\D*)(0*)(\d*)/,(a,o,r,s)=>o+s),t.length&&!/\d$/.test(n[0])&&(n[0]=n[0]+"0"),n.length>1&&(n[1]=n[1].replace(/0*$/,""),n[1].length||(n.length=1)),this._insertThousandsSeparators(n.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const n=t.split(this.radix);return n.length<2&&n.push(""),n[1]=n[1].padEnd(this.scale,"0"),n.join(this.radix)}doSkipInvalid(t,n,a){n===void 0&&(n={});const o=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===De.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,n,a)&&!o}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,De.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(De.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||De.EMPTY_VALUES.includes(t)&&De.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}gl=De,De.UNMASKED_RADIX=".",De.EMPTY_VALUES=[...Ce.EMPTY_VALUES,0],De.DEFAULTS={...Ce.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[gl.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:l=>l.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},se.MaskedNumber=De;const Ht={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function yn(l,t,n){t===void 0&&(t=Ht.MASKED),n===void 0&&(n=Ht.MASKED);const a=Re(l);return o=>a.runIsolated(r=>(r[t]=o,r[n]))}function yl(l,t,n,a){return yn(t,n,a)(l)}se.PIPE_TYPE=Ht,se.createPipe=yn,se.pipe=yl;class kl extends Be{get repeatFrom(){var t;return(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?t:0}get repeatTo(){var t;return(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var n,a,o;const{repeat:r,...s}=at(t);this._blockOpts=Object.assign({},this._blockOpts,s);const i=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 ce;for(let c=(o=(r=this._mapPosToBlock(this.displayValue.length))==null?void 0:r.index)!=null?o:Math.max(this._blocks.length-1,0),d,p;d=(s=this._blocks[c])!=null?s:p=!p&&this._allocateBlock(c);++c){var o,r,s,i;const 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=kl;try{globalThis.IMask=se}catch{}const kn=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:ce,ChunksTailDetails:Ge,DIRECTION:Q,HTMLContenteditableMaskElement:hn,HTMLInputMaskElement:pl,HTMLMaskElement:mt,InputMask:ml,MaskElement:Pt,Masked:Ce,MaskedDate:Pe,MaskedDynamic:gt,MaskedEnum:yt,MaskedFunction:hl,MaskedNumber:De,MaskedPattern:Be,MaskedRange:ht,MaskedRegExp:fl,PIPE_TYPE:Ht,PatternFixedDefinition:gn,PatternInputDefinition:ft,RepeatBlock:kl,createMask:Re,createPipe:yn,default:se,forceDirection:cl,normalizeOpts:at,pipe:yl},Symbol.toStringTag,{value:"Module"}));de.ModalEdit=Zn,de.VForm=He,de.VsInputAddress=Hn,de.VsInputArray=Un,de.VsInputArraySelect=Dt,de.VsInputCheckbox=vn,de.VsInputCodegen=On,de.VsInputColor=jn,de.VsInputContainer=Mn,de.VsInputDate=up,de.VsInputEmail=Qt,de.VsInputFile=Sn,de.VsInputFileList=Nn,de.VsInputKeyValue=zn,de.VsInputMask=Xt,de.VsInputNumber=_n,de.VsInputRadio=tn,de.VsInputRange=Pn,de.VsInputRichtext=An,de.VsInputSelect=on,de.VsInputSlug=Tn,de.VsInputStatic=Jt,de.VsInputSwitcher=Zt,de.VsInputTag=In,de.VsInputTel=en,de.VsInputText=tt,de.VsInputTextArray=Rn,de.VsInputTextarea=Dn,de.default=He,de.inputs=Kn,de.vsInputDatatable=Fn,de.vsInputMap=Ln,Object.defineProperties(de,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(de,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@opengis/core"),require("lucide-vue-next")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core","lucide-vue-next"],e):(de=typeof globalThis<"u"?globalThis:de||self,e(de.FormBuilder={},de.Vue,de.OpenGISCore,de.lucide))})(this,(function(de,e,ge,bl){"use strict";const xn=e.defineComponent({__name:"vs-info-tooltip",props:{text:{}},setup(l){const t=l,n=e.ref(!1),a=e.ref({top:"0px",left:"0px"});function o(s){if(!t.text)return;const i=s.currentTarget.getBoundingClientRect();a.value={top:`${i.bottom+4}px`,left:`${Math.min(i.left,window.innerWidth-230)}px`},n.value=!0}function r(){n.value=!1}return(s,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("span",{class:"inline-flex items-center",onMouseenter:o,onMouseleave:r},[e.renderSlot(s.$slots,"default",{},()=>[i[0]||(i[0]=e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"text-gray-400 cursor-help"},[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),e.createElementVNode("path",{d:"M12 16v-4"}),e.createElementVNode("path",{d:"M12 8h.01"})],-1))])],32),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.value&&l.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(a.value),class:"fixed z-[9999] max-w-xs p-2 bg-gray-900 text-white text-xs rounded-lg shadow-lg pointer-events-none"},e.toDisplayString(l.text),5)):e.createCommentVNode("",!0)]))],64))}}),wl={class:"w-full relative"},xl={key:0,class:"text-[14px] font-medium text-gray-900 mb-2 flex items-center gap-1"},_l={class:"opacity-100"},vl={key:0,class:"text-red-500 text-[14px]"},El={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Vl=e.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){const t=l,n=e.computed(()=>typeof t.item?.label=="string"&&t.item.label?t.item.label:t.item?.ua||t.label||t.ua),a=e.computed(()=>!!n.value),o=e.computed(()=>!!t.item?.rules?.includes("required")),r=e.computed(()=>t.item?.info||"");return(s,i)=>(e.openBlock(),e.createElementBlock("div",wl,[a.value?(e.openBlock(),e.createElementBlock("div",xl,[e.createElementVNode("span",_l,e.toDisplayString(n.value),1),o.value?(e.openBlock(),e.createElementBlock("span",vl,"*")):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createBlock(xn,{key:1,text:r.value},null,8,["text"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"default",e.mergeProps(s.$attrs,{class:{"opacity-60":l.item.disabled}})),l.error?(e.openBlock(),e.createElementBlock("span",El,e.toDisplayString(l.error),1)):e.createCommentVNode("",!0)]))}}),Bl={class:"w-full relative flex flex-row items-center gap-2"},Cl={key:0,class:"text-red-500 text-[14px]"},Sl={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Nl=e.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{default:()=>({container:12,label:3})}},setup(l){const t=l,n=e.computed(()=>t.item?.label||t.label||t.ua),a=e.computed(()=>t.item?.info||""),o=e.computed(()=>t.columns??{container:12,label:3}),r=e.computed(()=>{const{container:d,label:p}=o.value;return!d||d<=0?0:Math.min(Math.max(p??0,0),d)/d}),s=e.computed(()=>t.item?.type==="html"||r.value<=0?!1:!!n.value),i=e.computed(()=>{if(!s.value)return{};const d=`${r.value*100}%`;return{flexBasis:d,maxWidth:d}}),c=e.computed(()=>{const{container:d,label:p}=o.value;if(!d||d<=0)return{};if(t.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!s.value)return{flexBasis:"100%",maxWidth:"100%"};const h=Math.max(d-Math.max(p??0,0),0)/d;if(!h)return{};const E=`${h*100}%`;return{flexBasis:E,maxWidth:E}});return(d,p)=>(e.openBlock(),e.createElementBlock("div",Bl,[s.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0 items-center gap-1",style:e.normalizeStyle(i.value)},[e.createTextVNode(e.toDisplayString(n.value)+" ",1),l.item?.rules?.includes("required")&&n.value?(e.openBlock(),e.createElementBlock("span",Cl,"*")):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createBlock(xn,{key:1,text:a.value},null,8,["text"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"flex-1 min-w-0",style:e.normalizeStyle(c.value)},[e.renderSlot(d.$slots,"default",e.normalizeProps(e.guardReactiveProps(d.$attrs)))],4),l.error?(e.openBlock(),e.createElementBlock("span",Sl,e.toDisplayString(l.error),1)):e.createCommentVNode("",!0)]))}}),$l={class:"w-full relative"},Ml={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Dl=e.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",$l,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),l.error?(e.openBlock(),e.createElementBlock("span",Ml,e.toDisplayString(l.error),1)):e.createCommentVNode("",!0)]))}}),Al={class:"flex-1 min-w-0"},Fl={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},Ll={class:"truncate"},Il={key:0,class:"text-red-500 text-[14px]"},Tl=["innerHTML"],Ol={key:0,class:"mt-1 text-xs text-red-500"},zl={default:Vl,horizontal:Nl,inline:Dl,settings:e.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){const t=l,n=e.ref("uk");e.computed(()=>(t.item??{})?.[n.value]??t.ua??t.label??"");const a=e.computed(()=>t.item?.description??""),o=e.computed(()=>Array.isArray(t.item?.rules)&&t.item.rules.includes("required")),r=e.computed(()=>(typeof t.error=="string"?t.error:"")??""),s=()=>{const i=typeof localStorage<"u"?localStorage.getItem("locale"):null;n.value=i||"uk"};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(n.value=localStorage.locale)}catch{}window.addEventListener("storage",s)}),e.onUnmounted(()=>{window.removeEventListener("storage",s)}),(i,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":l.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(l.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",Al,[l.ua||l.label?(e.openBlock(),e.createElementBlock("p",Fl,[e.createElementVNode("span",Ll,e.toDisplayString(l.item[n.value]||l.ua||l.label),1),o.value?(e.openBlock(),e.createElementBlock("span",Il,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createElementBlock("p",{key:1,class:"text-xs text-slate-500 dark:text-slate-400",innerHTML:a.value},null,8,Tl)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["w-full",["select","native-select"].includes(l.item.type)?"md:w-[30%]":"md:w-auto"])},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],2)],2),r.value?(e.openBlock(),e.createElementBlock("p",Ol,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0)],2))}})};function Se(l){return{inputClass:e.computed(()=>{const n=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${l?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return l?.size==="sm"?`${n}h-[32px]`:`${n}h-[38px]`})}}const Rl=["placeholder","disabled"],jl=e.defineComponent({__name:"vs-input-password",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=Se(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??"");return(s,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":i[0]||(i[0]=c=>a.value=c),placeholder:r.value,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Rl)),[[e.vModelText,a.value]])}}),Pl=["placeholder","disabled","maxlength","minlength"],tt=e.defineComponent({__name:"vs-input-text",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=Se(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??""),s=e.computed(()=>t.maxlength??void 0),i=e.computed(()=>t.minlength??void 0);function c(){typeof a.value=="string"&&(a.value=a.value.trim())}return(d,p)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":p[0]||(p[0]=h=>a.value=h),placeholder:r.value,disabled:o.value,maxlength:s.value,minlength:i.value,onBlur:c,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[l.customClass,e.unref(n),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Pl)),[[e.vModelText,a.value]])}}),Ul=["placeholder","disabled","min","max"],_n=e.defineComponent({__name:"vs-input-number",props:e.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=Se(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled);return(r,s)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":s[0]||(s[0]=i=>a.value=i),placeholder:l.placeholder,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"},min:l.min,max:l.max},null,10,Ul)),[[e.vModelText,a.value]])}}),ae=(l,t)=>{const n=l.__vccOpts||l;for(const[a,o]of t)n[a]=o;return n},Hl={},ql={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function Kl(l,t){return e.openBlock(),e.createElementBlock("svg",ql,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)])])}const Gl=ae(Hl,[["render",Kl]]),Yl={class:"flex items-center gap-[4px]"},Wl=["value","id","disabled"],Zl=["for"],Jl={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},Xl=e.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=t,a=l,o=e.computed({get:()=>a.modelValue,set:s=>n("update:modelValue",s)}),r=e.computed(()=>!!a.disabled);return(s,i)=>(e.openBlock(),e.createElementBlock("div",Yl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:l.value,"onUpdate:modelValue":i[0]||(i[0]=c=>o.value=c),class:e.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":r.value}]),id:l.id,disabled:r.value},null,10,Wl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:l.id,class:e.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":r.value}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[o.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",l.error?"border-red-600":""]])},[e.createVNode(Gl,{height:"12",width:"12"})],2),e.createElementVNode("span",Jl,[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.label),1)])])],10,Zl)]))}}),Ql=["name","value","disabled"],ea={class:"flex items-center gap-[6px] text-[14px]"},ta={key:0,class:"text-[16px]"},na=["src"],la=e.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.computed({get:()=>n.modelValue,set:i=>{a("update:modelValue",i)}}),r=e.computed(()=>Array.isArray(o.value)?o.value.includes(n.value):o.value===!0||o.value===n.value),s=e.computed(()=>n.style?.size==="xs"?"p-1.5 text-xs":n.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(i,c)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[s.value,r.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"hidden",name:l.id,value:l.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),disabled:l.disabled},null,8,Ql),[[e.vModelCheckbox,o.value]]),e.createElementVNode("span",ea,[l.icon||l.imgUrl?(e.openBlock(),e.createElementBlock("span",ta,[l.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(l.icon)},null,2)):e.createCommentVNode("",!0),l.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:1,src:l.imgUrl,width:"16",height:"16",alt:"icon"},null,8,na)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(l.label),1)])])],2))}}),aa={class:"flex items-center"},Yt=e.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=`radio-${Math.floor(Math.random()*1e4)}`,r=e.computed({get:()=>Array.isArray(n.modelValue)?Array.isArray(n.modelValue)&&n.modelValue.includes(n.value):n.modelValue,set:i=>{if(Array.isArray(n.modelValue)){let c=[...n.modelValue];i?c.includes(n.value)||c.push(n.value):c=c.filter(d=>d!==n.value),a("update:modelValue",c)}else a("update:modelValue",i)}}),s=e.ref(`vs-checkbox-${n.view||"default"}`);return(i,c)=>(e.openBlock(),e.createElementBlock("div",aa,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value==="vs-checkbox-buttons"?e.unref(la):e.unref(Xl)),{value:l.value,label:l.label,info:l.option?.info,disabled:l.disabled,modelValue:r.value,"onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),id:o,icon:l.icon,imgUrl:l.imgUrl,style:e.normalizeStyle(l.style),error:l.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),oa={},ra={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function sa(l,t){return e.openBlock(),e.createElementBlock("svg",ra,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)])])}const Wt=ae(oa,[["render",sa]]),ia={},ca={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function da(l,t){return e.openBlock(),e.createElementBlock("svg",ca,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),e.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])])}const Bt=ae(ia,[["render",da]]),ua={},pa={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function ma(l,t){return e.openBlock(),e.createElementBlock("svg",pa,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M12 9h.01"},null,-1),e.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),e.createElementVNode("path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z"},null,-1)])])}const fa=ae(ua,[["render",ma]]),ha={key:0,class:"flex items-start gap-x-1"},ga={key:0,class:"text-red-500 text-[14px]"},ya=["title"],ka=["disabled"],Zt=e.defineComponent({__name:"vs-input-switcher",props:e.mergeModels({rules:{default:()=>[]},view:{default:"checkbox"},label:{default:""},i:{default:""},text:{default:""},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue");return(a,o)=>t.view==="checkbox"?(e.openBlock(),e.createElementBlock("div",ha,[e.createVNode(Yt,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),label:l.text,error:l.error||""},null,8,["modelValue","label","error"]),l.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",ga,"*")):e.createCommentVNode("",!0),l.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:l.i,onClick:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(fa),{class:"text-gray-500 w-[14px] h-[14px]"})],8,ya)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[n.value?`bg-${l.style?.primaryColor||"blue"}-500`:"bg-stone-200",l.customClass]]),disabled:l.disabled,onClick:o[2]||(o[2]=r=>n.value=!n.value)},[e.createElementVNode("span",{"data-state":"checked",class:e.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[n.value?"translate-x-4":"translate-x-0"]])},null,2)],10,ka))}}),ba=["id","innerHTML"],Jt=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",{id:l.name,class:e.normalizeClass(["text-gray-900",l.customClass]),innerHTML:l.html?l.html:l.text},null,10,ba))}}),wa=["placeholder","disabled","name"],Xt=e.defineComponent({__name:"vs-input-mask",props:e.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=Se(t.style),a=e.useModel(l,"modelValue"),o=e.ref(null);let r=null;function s(i){const c={9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},d=new Set;let p=!1;for(let E=0;E<i.length;E+=1){const k=i[E];k==="{"?p=!0:k==="}"?p=!1:p&&d.add(k)}const h={};return Object.keys(c).forEach(E=>{d.has(E)||(h[E]=c[E])}),{mask:i,definitions:h,lazy:!1}}return e.onMounted(async()=>{if(o.value){const{default:i}=await Promise.resolve().then(()=>kn),c=s(t.mask||"");r=i(o.value,c),r.on("accept",()=>{a.value=t.unmask?r.unmaskedValue:r.value}),r.on("complete",()=>{a.value=t.unmask?r.unmaskedValue:r.value}),r.value=a.value!=null?String(a.value):""}}),e.onBeforeUnmount(()=>{r?.destroy()}),e.watch(()=>t.mask,i=>{if(r){const c=s(i||"");r.updateOptions(c)}}),e.watch(a,i=>{r&&r.unmaskedValue!==i&&(r.value=i!=null?String(i):"")}),(i,c)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:l.placeholder,disabled:l.disabled,name:l.name,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,10,wa))}}),xa={class:"relative w-full bg-white rounded-lg"},_a=["placeholder","disabled"],Qt=e.defineComponent({__name:"vs-input-email",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=Se(t.style),a=e.useModel(l,"modelValue");return(o,r)=>(e.openBlock(),e.createElementBlock("div",xa,[r[1]||(r[1]=e.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),e.withDirectives(e.createElementVNode("input",{type:"email","onUpdate:modelValue":r[0]||(r[0]=s=>a.value=s),placeholder:l.placeholder,disabled:l.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,_a),[[e.vModelText,a.value]])]))}}),va={class:"relative w-full bg-white rounded-lg"},Ea=["value","placeholder","disabled"],en=e.defineComponent({__name:"vs-input-tel",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=Se(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>a.value?a.value.startsWith("+")?a.value.slice(1):a.value:""),r=i=>{let{value:c}=i.target;c=c.replace(/^\+/,""),a.value=c?`+${c}`:""},s=i=>{const c=i,{data:d,inputType:p}=c;p&&p.startsWith("delete")||d&&/\D/.test(d)&&c.preventDefault()};return e.watch(()=>a.value,i=>{i&&!i.startsWith("+")?a.value=`+${i.replace(/^\+/,"")}`:i||(a.value="")},{immediate:!0}),(i,c)=>(e.openBlock(),e.createElementBlock("div",va,[c[0]||(c[0]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"stroke-gray-500 transition-all"},[e.createElementVNode("path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"})])],-1)),c[1]||(c[1]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[30px] text-gray-500 select-none pointer-events-none"}," + ",-1)),e.createElementVNode("input",{type:"tel",value:o.value,onInput:r,onBeforeinput:s,pattern:"^\\+[1-9]\\d{1,14}$",maxlength:"15",placeholder:l.placeholder,disabled:l.disabled,class:e.normalizeClass(["!pl-10 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Ea)]))}}),Va=["value","disabled"],Ba={class:"text-[13px] text-gray-700"},Ca=e.defineComponent({__name:"vs-input-radio-default",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>!!t.disabled);return(o,r)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center gap-0",[t.customClass,a.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:"radio",value:t.value,disabled:a.value,class:"hidden"},null,8,Va),[[e.vModelRadio,n.value]]),e.createElementVNode("span",{class:e.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${t.style?.primaryColor||"blue"}-500`,a.value?"opacity-50 cursor-not-allowed":""]])},[n.value==t.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${t.style?.primaryColor||"blue"}-500`]])},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",Ba,e.toDisplayString(t.text),1)],2))}}),Sa=["value","disabled"],Na={class:"text-[13px] text-gray-700"},$a={"vs-input-radio-default":Ca,"vs-input-radio-buttons":e.defineComponent({__name:"vs-input-radio-buttons",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>!!t.disabled);return(o,r)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[n.value==t.value?`ring-2 ring-ring ring-${t.style?.primaryColor||"blue"}-500`:"",t.customClass,a.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:"radio",value:t.value,disabled:a.value,class:"hidden"},null,8,Sa),[[e.vModelRadio,n.value]]),e.createElementVNode("span",Na,e.toDisplayString(t.text),1)],2))}})},tn=e.defineComponent({__name:"vs-input-radio",props:e.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>$a[`vs-input-radio-${t.view}`]);return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([l.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options,s=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),e.mergeProps({key:s?.id,text:s.text,value:s.id.toString(),checked:n.value===s.id,modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=i=>n.value=i)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),Ma={key:1,class:"w-full flex flex-col gap-4"},Da={key:0,class:"text-sm font-medium text-muted-foreground my-2"},Aa="Без категорії",vn=ae(e.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},group:{default:void 0},values:{default:()=>[]},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.ref([]),r=e.reactive({}),s=k=>k?.value||k?.id||k?.text||k,i=k=>k.text||String(k),c=k=>`lg:col-span-${k||12}`,d=e.computed(()=>[n.position==="vertical"?"flex flex-col":"",n.colSpan?"grid":"flex justify-start"]),p=k=>k==null||k===""?null:typeof k=="string"||typeof k=="number"?k:String(k),h=e.computed(()=>{if(!n.group)return[];const k=new Map;o.value.forEach(y=>{const w=y[n.group],b=p(w);k.has(b)||k.set(b,[]),k.get(b)?.push(y)});const v=[];n.values?.length&&n.values.forEach(y=>{const w=p(y);v.push(w)});const f=new Set,g=y=>{const w=k.get(y)||[];if(!w.length)return null;const b=y===null?"group-null":`group-${String(y)}`,S=y===null?Aa:String(y);return f.add(y),{key:b,label:S,options:w}},x=[];return v.forEach(y=>{const w=g(y);w&&x.push(w)}),k.forEach((y,w)=>{if(f.has(w))return;const b=g(w);b&&x.push(b)}),x}),E=async()=>{try{const k=await fetch(`/api/suggest/${n.data}`).then(v=>v.json());o.value=k?.data||k}catch(k){console.error(k)}};return e.watch(()=>n.modelValue,k=>{if(typeof k=="boolean"&&o.value.length===1){const v=s(o.value[0]);r[v]=k}else if(Array.isArray(k)){const v=new Set(k);o.value.forEach(f=>{if(!f.disabled){const g=s(f);r[g]=v.has(g)}})}},{immediate:!0}),e.watch(r,()=>{if(!o.value.length){a("update:modelValue",null);return}const k=Object.entries(r).filter(([,v])=>v).map(([v])=>v);a("update:modelValue",k.length===0?[]:k)},{deep:!0}),e.onMounted(()=>{if(n.data)E().then(()=>{if(typeof n.modelValue=="boolean"&&o.value.length===1){const k=s(o.value[0]);r[k]=n.modelValue}else if(Array.isArray(n.modelValue)){const k=new Set(n.modelValue);o.value.forEach(v=>{if(!v.disabled){const f=s(v);r[f]=k.has(f)}})}});else if(o.value=n.options,typeof n.modelValue=="boolean"&&o.value.length===1){const k=s(o.value[0]);r[k]=n.modelValue}else if(Array.isArray(n.modelValue)){const k=new Set(n.modelValue);o.value.forEach(v=>{if(!v.disabled){const f=s(v);r[f]=k.has(f)}})}}),(k,v)=>n.group?(e.openBlock(),e.createElementBlock("div",Ma,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,f=>(e.openBlock(),e.createElementBlock("div",{key:f.key,class:"flex flex-col gap-2"},[f.label?(e.openBlock(),e.createElementBlock("span",Da,e.toDisplayString(f.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.options,g=>(e.openBlock(),e.createBlock(Yt,{modelValue:r[s(g)],"onUpdate:modelValue":x=>r[s(g)]=x,value:s(g),class:e.normalizeClass(c(l.colSpan)),disabled:n.disabled||g.disabled,label:i(g),key:`${f.key}-${s(g)}`,icon:g?.icon,imgUrl:g?.imgUrl,option:g,view:l.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["p-0 w-full gap-[10px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,f=>(e.openBlock(),e.createBlock(Yt,{modelValue:r[s(f)],"onUpdate:modelValue":g=>r[s(f)]=g,value:s(f),class:e.normalizeClass(c(l.colSpan)),disabled:n.disabled||f.disabled,label:i(f),key:s(f),icon:f?.icon,imgUrl:f?.imgUrl,option:f,view:l.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-cf0478ce"]]),Fa=["type","placeholder","disabled"],La=e.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},mode:{default:"date"}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l;function a(p){return p?n.mode==="datetime"?(p.includes("T")?p:null)||p+(p.includes(" ")?"":"T00:00"):p?.split(" ")[0]:null}const{inputClass:o}=Se(n.style),r=t,s=e.computed({get:()=>a(n.modelValue),set:p=>r("update:modelValue",p)}),i=e.computed(()=>n.mode==="datetime"?"datetime-local":n.mode),c=e.computed(()=>!!n.disabled),d=e.computed(()=>n.placeholder??"");return(p,h)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":h[0]||(h[0]=E=>s.value=E),placeholder:d.value,disabled:c.value,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[l.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Fa)),[[e.vModelDynamic,s.value]])}}),Ia=(l,t)=>{if(!t||!Object.keys(t).length)return l;const[n,a=""]=l.split("?"),o=new URLSearchParams(a);Object.entries(t).forEach(([s,i])=>{i==null||i===""||o.set(s,String(i))});const r=o.toString();return r?`${n}?${r}`:n},En=async(l,t={})=>{try{const n=new FormData;n.append("unique","true"),n.append("file",l);const{api:a,id:o="1",form:r="form",table:s="table",customParams:i}=t,c=a||`/file/upload/uploads?id=${o||""}&form=${r||""}&table=${s||""}`,d=Ia(c,i);return(await fetch(d,{method:"POST",body:n}).then(h=>h.json()))?.result}catch(n){return ge.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",n),null}},Ta=async l=>{try{return await fetch(`file/delete${l}`),!0}catch(t){return console.error(t),!1}},Vn=async l=>{try{const t=await fetch(`/file/download/files/uploads${l}`),n=await t.arrayBuffer(),a=t.headers["content-type"],o=new TextDecoder("utf-8").decode(n),r=new Blob([o],{type:a}),s=document.createElement("a");s.setAttribute("download",l),s.href=window.URL.createObjectURL(r),s.click()}catch(t){console.error(t.message)}},Oa={},za={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Ra(l,t){return e.openBlock(),e.createElementBlock("svg",za,[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)])])}const Re=ae(Oa,[["render",Ra]]),ja={},Pa={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-text",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function Ua(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Pa,[...t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><line x1="9" y1="9" x2="10" y2="9"></line><line x1="9" y1="13" x2="15" y2="13"></line><line x1="9" y1="17" x2="15" y2="17"></line>',6)])])}const Ha=ae(ja,[["render",Ua]]),qa={},Ka={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-table",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function Ga(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Ka,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),e.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),e.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)])])}const Ya=ae(qa,[["render",Ga]]),Wa={},Za={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Ja(l,t){return e.openBlock(),e.createElementBlock("svg",Za,[...t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M9 9l1 0"></path><path d="M9 13l6 0"></path><path d="M9 17l6 0"></path>',6)])])}const Bn=ae(Wa,[["render",Ja]]),Xa={},Qa={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-zip",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function eo(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Qa,[...t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1"></path><path d="M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2z"></path><line x1="11" y1="5" x2="10" y2="5"></line><line x1="13" y1="7" x2="12" y2="7"></line><line x1="11" y1="9" x2="10" y2="9"></line><line x1="13" y1="11" x2="12" y2="11"></line><line x1="11" y1="13" x2="10" y2="13"></line><line x1="13" y1="15" x2="12" y2="15"></line>',9)])])}const to=ae(Xa,[["render",eo]]),no={},lo={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-code",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function ao(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",lo,[...t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M10 13l-1 2l1 2"></path><path d="M14 13l1 2l-1 2"></path>',5)])])}const oo=ae(no,[["render",ao]]),ro=l=>{if(!l)return"";const t=l?.split(".");return t[t.length-1]},so=l=>{const t=ro(l),n={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return n.imageFormat.includes(t)?"img":n.sheetsFormat.includes(t)?Ya:n.textsFormat.includes(t)?oo:n.documentsFormat.includes(t)?Ha:n.archivesFormat.includes(t)?to:Bn},io={},co={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function uo(l,t){return e.openBlock(),e.createElementBlock("svg",co,[...t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)])])}const nt=ae(io,[["render",uo]]),po={},mo={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function fo(l,t){return e.openBlock(),e.createElementBlock("svg",mo,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const Cn=ae(po,[["render",fo]]),ho=["title"],go={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},nn=ae(e.defineComponent({__name:"vs-input-file-list-item",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(l){const t=e.useModel(l,"value"),n=e.useModel(l,"item"),a=l;return(o,r)=>(e.openBlock(),e.createElementBlock("div",{title:n.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(so)(n.value)),{src:n.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:r[0]||(r[0]=s=>e.unref(Vn)(n.value))},null,8,["src"])),e.createElementVNode("div",go,[e.createElementVNode("button",{type:"button",onClick:r[1]||(r[1]=s=>{e.unref(Ta)(n.value),t.value=a.multiple?t.value?.filter(i=>i!==n.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[e.createVNode(nt,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:r[2]||(r[2]=s=>e.unref(Vn)(n.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[e.createVNode(Cn,{class:"w-4 h-4"})])])],8,ho))}}),[["__scopeId","data-v-b61a9d9a"]]),yo={class:"flex items-center gap-x-2"},ko=["accept","multiple","disabled"],bo={key:1,class:"flex items-center flex-wrap gap-2"},wo={key:1,class:"loader"},xo={key:1,class:"loader"},Sn=ae(e.defineComponent({__name:"vs-input-file",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["change"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=e.useModel(l,"modelValue"),o=t,r=e.ref(null),s=e.ref(!1),i=e.inject("values"),c=e.computed(()=>n.format?n.format.split(",").map(y=>y.trim().toLowerCase()).filter(Boolean):[]),d=y=>Array.isArray(a.value)&&a.value[y]||"",p=y=>{if(n.max_size&&y.size>n.max_size*1024*1024){const w=(y.size/1048576).toFixed(2);return ge.notify({type:"error",title:"Помилка!",message:`Файл "${y.name}" занадто великий. Максимальний розмір: ${n.max_size} МБ, розмір файлу: ${w} МБ`,position:"right-bottom"}),!1}return!0},h=y=>{if(!c.value.length)return!0;const w=`.${y.name.split(".").pop()?.toLowerCase()||""}`,b=c.value.includes(w);return b||ge.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${y.name}". Дозволені формати: ${c.value.join(", ")}`,position:"right-bottom"}),b},E=e.computed(()=>{const y={},w=[];if(!n.customParams?.length)return{params:y,missingSources:w};const b=i?.value??{};return n.customParams.forEach(S=>{if(!S)return;const[M,B]=S.split("="),T=M?.trim(),Z=B?.trim();if(!T||!Z)return;const J=b[Z];if(J==null||J===""){w.push(Z);return}y[T]=J}),{params:y,missingSources:w}}),k=()=>{const{params:y}=E.value;return{api:n.api,customParams:Object.keys(y).length?y:void 0}},v=()=>{const y=E.value.missingSources;if(!y.length)return!0;const w=y.join(", ");return ge.notify({type:"warning",title:"Заповніть поля",message:`Поля (${w}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},f=y=>{ge.notify({type:"error",title:"Помилка завантаження",message:y||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},g=()=>{n.disabled||s.value||v()&&r.value?.click()},x=async y=>{const{files:w}=y.target;if(!w||w.length===0)return;if(!v()){r.value&&(r.value.value="");return}const b=Array.from(w);if(n.max_size&&b.filter(B=>!p(B)).length>0){r.value&&(r.value.value="");return}if(b.filter(M=>!h(M)).length>0){r.value&&(r.value.value="");return}s.value=!0;try{if(n.multiple){const M=Array.from(w).map(async J=>await En(J,k())),B=await Promise.all(M),Z=B.filter(J=>J!==null).map(J=>J?.file_path).filter(Boolean);if(Z.length===0){f();return}Z.length<B.length&&f("Деякі файли не вдалося завантажити. Перевірте їх та спробуйте знову."),a.value=[...a.value||[],...Z],o("change",a.value)}else{const M=w[0],B=await En(M,k());if(!B?.file_path){f();return}a.value=B?.file_path,o("change",a.value||"")}}catch(M){const B=M?.message||void 0;f(B)}finally{s.value=!1,r.value&&(r.value.value="")}};return(y,w)=>(e.openBlock(),e.createElementBlock("div",yo,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:r,type:"file",accept:n.format,multiple:l.multiple,onChange:x,disabled:s.value||l.disabled},null,40,ko),!l.multiple&&a.value?(e.openBlock(),e.createBlock(nn,{key:0,item:a.value,"onUpdate:item":w[0]||(w[0]=b=>a.value=b),value:a.value,"onUpdate:value":w[1]||(w[1]=b=>a.value=b)},null,8,["item","value"])):l.multiple?(e.openBlock(),e.createElementBlock("div",bo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(b,S)=>(e.openBlock(),e.createBlock(nn,{multiple:l.multiple,key:S,value:a.value,"onUpdate:value":w[2]||(w[2]=M=>a.value=M),item:d(S)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:g,class:e.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",l.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[s.value?(e.openBlock(),e.createElementBlock("div",wo)):(e.openBlock(),e.createBlock(Re,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),l.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:g,class:e.normalizeClass([l.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[s.value?(e.openBlock(),e.createElementBlock("div",xo)):(e.openBlock(),e.createBlock(Re,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-05d41c5c"]]),_o={class:"vs-input-file2 flex flex-col gap-4"},vo={class:"flex items-center gap-x-2"},Eo=["accept","disabled"],Vo={key:0,class:"absolute inset-0 flex flex-col items-center justify-center gap-1 rounded-lg bg-white/90 text-xs font-medium text-slate-600"},Bo={key:0,class:"rounded-lg border border-[#CFD9E0] bg-white p-4 shadow-sm"},Co={class:"flex items-center justify-between text-sm"},So={class:"truncate pr-4"},No={class:"font-medium text-slate-800 truncate"},$o={class:"text-slate-500"},Mo={class:"text-slate-500 whitespace-nowrap"},Do={class:"mt-3 h-2 rounded-full bg-slate-100 overflow-hidden"},Ao={class:"mt-3 flex flex-wrap gap-2 text-sm"},Fo={key:0,class:"mt-2 text-sm text-rose-600"},Lo=e.defineComponent({__name:"vs-input-file2",props:e.mergeModels({format:{},max_size:{},api:{},chunkSize:{default:5*1024*1024},subdir:{default:""},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref(null),o=e.ref(null),r=e.ref(""),s=e.ref(0),i=e.ref(!1),c=e.ref(""),d=e.ref(null),p=e.inject("values"),h=e.computed(()=>t.format?t.format.split(",").map(F=>F.trim().toLowerCase()).filter(Boolean):[]),E=e.computed(()=>!o.value||!o.value.size?0:Math.min(100,Math.round(s.value/o.value.size*100))),k=e.computed(()=>o.value?`${g(s.value)} / ${g(o.value.size)}`:""),v=e.computed(()=>t.disabled?"opacity-50 cursor-not-allowed":i.value?"cursor-default text-blue-500":"cursor-pointer hover:border-blue-500 hover:bg-blue-50 hover:text-blue-500"),f=()=>{t.disabled||i.value||b()&&a.value?.click()},g=F=>{if(!Number.isFinite(F))return"0 B";const R=["B","KB","MB","GB"];let G=0,O=F;for(;O>=1024&&G<R.length-1;)O/=1024,G+=1;return`${O.toFixed(G===0?0:1)} ${R[G]}`},x=F=>{if(!t.max_size)return!0;const R=t.max_size*1024*1024;return F.size>R?(ge.notify({type:"error",title:"Файл занадто великий",message:`Максимальний розмір ${t.max_size} МБ`,position:"right-bottom"}),!1):!0},y=F=>{if(!h.value.length)return!0;const R=`.${F.name.split(".").pop()?.toLowerCase()||""}`;return h.value.includes(R)?!0:(ge.notify({type:"error",title:"Непідтримуваний формат",message:`Дозволені формати: ${h.value.join(", ")}`,position:"right-bottom"}),!1)},w=e.computed(()=>{const F={},R=[];if(!t.customParams?.length)return{params:F,missing:R};const G=p?.value??{};return t.customParams.forEach(O=>{if(!O)return;const[A,W]=O.split("="),H=A?.trim(),pe=W?.trim();if(!H||!pe)return;const me=G[pe];me==null||me===""?R.push(pe):F[H]=me}),{params:F,missing:R}}),b=()=>w.value.missing.length?(ge.notify({type:"warning",title:"Заповніть поля",message:`Потрібні значення: ${w.value.missing.join(", ")}`,position:"right-bottom"}),!1):!0,S=F=>{const R=F.target,G=R.files?.[0];if(G){if(!b()){R.value="";return}if(!x(G)||!y(G)){R.value="";return}o.value=G,s.value=0,r.value="",c.value=""}},M=async()=>{if(!o.value){f();return}try{c.value="";const F={id:r.value||"",fileName:o.value.name,subdir:t.subdir,size:o.value.size,...w.value.params},R=await fetch("/api/file/upload2/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)});if(!R.ok)throw new Error("Не вдалося ініціалізувати завантаження");const G=await R.json();r.value=G.id||r.value,s.value=G.uploaded||0,await B()}catch(F){c.value=F?.message||"Помилка при старті завантаження"}},B=async()=>{if(!(!o.value||!r.value)){i.value=!0;try{for(;s.value<o.value.size;){const F=s.value,R=Math.min(F+t.chunkSize,o.value.size),G=o.value.slice(F,R);d.value=new AbortController;const O=await fetch(`/api/file/upload2/${r.value}`,{method:"PATCH",headers:{"Content-Range":`bytes ${F}-${R-1}/${o.value.size}`},body:G,signal:d.value.signal});if(!O.ok)throw new Error("Помилка завантаження частини");const A=await O.json().catch(()=>({}));if(A.uploaded!=null?s.value=Number(A.uploaded):s.value=R,A.finished||s.value>=o.value.size){i.value=!1,n.value=A.file_path||A.url||r.value,ge.notify({type:"success",title:"Файл завантажено",message:o.value.name,position:"right-bottom"}),I();return}}}catch(F){if(F?.name==="AbortError")return;c.value=F?.message||"Помилка при завантаженні",i.value=!1}finally{d.value=null,i.value=!1}}},T=()=>{i.value&&(d.value?.abort(),d.value=null,i.value=!1)},Z=async()=>{if(o.value){if(!r.value){await M();return}await B()}},J=()=>{d.value?.abort(),d.value=null,I()},I=()=>{const F=a.value;F&&(F.value=""),o.value=null,r.value="",s.value=0,c.value=""};return(F,R)=>(e.openBlock(),e.createElementBlock("div",_o,[e.createElementVNode("div",vo,[e.createElementVNode("input",{ref_key:"fileInput",ref:a,type:"file",class:"hidden",accept:t.format,disabled:i.value||t.disabled,onChange:S},null,40,Eo),n.value?(e.openBlock(),e.createBlock(nn,{key:0,item:n.value,"onUpdate:item":R[0]||(R[0]=G=>n.value=G),value:n.value,"onUpdate:value":R[1]||(R[1]=G=>n.value=G)},null,8,["item","value"])):(e.openBlock(),e.createElementBlock("div",{key:1,onClick:f,class:e.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",v.value])},[i.value?(e.openBlock(),e.createElementBlock("div",Vo,[R[2]||(R[2]=e.createElementVNode("div",{class:"loader"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(E.value)+"%",1)])):(e.openBlock(),e.createBlock(Re,{key:1,class:"w-6 h-6"}))],2))]),o.value&&!n.value?(e.openBlock(),e.createElementBlock("div",Bo,[e.createElementVNode("div",Co,[e.createElementVNode("div",So,[e.createElementVNode("div",No,e.toDisplayString(o.value.name),1),e.createElementVNode("div",$o,e.toDisplayString(g(o.value.size)),1)]),e.createElementVNode("div",Mo,e.toDisplayString(k.value),1)]),e.createElementVNode("div",Do,[e.createElementVNode("div",{class:"h-full rounded-full bg-blue-500 transition-all duration-300",style:e.normalizeStyle({width:`${E.value}%`})},null,4)]),e.createElementVNode("div",Ao,[!i.value&&s.value>0&&s.value<(o.value?.size||0)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:Z}," Resume ")):e.createCommentVNode("",!0),i.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:T}," Pause ")):e.createCommentVNode("",!0),!i.value&&s.value===0?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:M}," Upload ")):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"rounded border border-rose-200 px-3 py-1 text-rose-600",onClick:J}," Cancel ")]),c.value?(e.openBlock(),e.createElementBlock("p",Fo,e.toDisplayString(c.value),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),ln=ae(Lo,[["__scopeId","data-v-8f52f552"]]),Io={class:"max-w-[55vw]"},To={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},Oo={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},zo={class:"px-[5px]"},Ro={class:""},Ct=e.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(l){const t=l,n=e.computed(()=>{try{return new Date(t.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function a(o){if(o<1024)return`${o} B`;const r=o/1024;return r<1024?`${r.toFixed(2)} KB`:`${(r/1024).toFixed(2)} MB`}return(o,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[r[1]||(r[1]=e.createStaticVNode('<div class="flex items-center justify-center h-[30px] w-[30px]"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path></svg></div>',1)),e.createElementVNode("div",Io,[e.createElementVNode("p",To,e.toDisplayString(l.item?.uploaded_name),1),e.createElementVNode("p",Oo,[e.createElementVNode("span",null,e.toDisplayString(l.item?.username),1),e.withDirectives(e.createElementVNode("span",zo,"|",512),[[e.vShow,l.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(n.value),1),r[0]||(r[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",Ro,e.toDisplayString(a(l.item?.size)),1)])])],64))}}),jo={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},Po={key:0,class:"flex w-full gap-x-3 items-center"},Uo={key:1,class:"flex gap-x-3 w-full items-center"},Ho={key:2,class:"flex gap-x-3 w-full items-center"},qo=["href"],Ko={key:3,class:"flex gap-x-3 w-full items-center"},Go={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},Yo={class:"p-0.5 sm:p-1 inline-flex items-center gap-0.5 bg-white rounded-lg dark:bg-neutral-800 dark:border-neutral-700"},Wo={class:"inline-block"},Zo={class:"inline-block"},Jo=e.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(l,{emit:t}){const n=l,a=t;function o(p){return["pdf","json"].includes(p.ext)}function r(p){return["ppt","pptx","doc","docx","xls","xlsx"].includes(p.ext)}function s(p){const h=document.createElement("a");h.setAttribute("download",p?.uploaded_name),h.href=p?.file_path,h.click()}async function i(){try{await fetch(`${n.prefix}/widget/file/${n.item.entity_id}/${n.item.file_id}`),a("update")}catch(p){console.error(p)}}function c(){a("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function d(p){(n.item.ext==="jpg"||n.item.ext==="png")&&a("openLightbox",{item:n.item,index:p})}return(p,h)=>(e.openBlock(),e.createElementBlock("div",jo,[l.item.ext==="jpg"||l.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",Po,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:h[0]||(h[0]=E=>d(l.index))},[e.createVNode(Ct,{item:l.item},null,8,["item"])])])):o(l.item)?(e.openBlock(),e.createElementBlock("div",Uo,[e.createVNode(Ct,{item:l.item},null,8,["item"])])):r(l.item)?(e.openBlock(),e.createElementBlock("div",Ho,[e.createElementVNode("a",{href:`/api/file-preview?id=${l.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(Ct,{item:l.item},null,8,["item"])],8,qo)])):(e.openBlock(),e.createElementBlock("div",Ko,[e.createVNode(Ct,{item:l.item},null,8,["item"])])),e.createElementVNode("div",Go,[e.createElementVNode("div",Yo,[e.createElementVNode("div",Wo,[e.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:h[1]||(h[1]=E=>s(l.item))},[e.createVNode(Cn,{height:"14",width:"14"})])]),h[3]||(h[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",Zo,[e.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:h[2]||(h[2]=E=>c())},[e.createVNode(nt,{height:"14",width:"14"})])])])])]))}}),Xo={},Qo={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function er(l,t){return e.openBlock(),e.createElementBlock("svg",Qo,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const tr=ae(Xo,[["render",er]]),nr={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},lr={class:"flex w-full mb-[12px] items-center gap-x-2"},ar={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},or={class1:"ml-auto"},rr={class:"py-1.5 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg bg-gray-100 cursor-pointer hover:bg-gray-200 text-gray-800 shadow-2xs hover:bg-gray-50 focus:outline-hidden focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700"},sr={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},ir={class:"relative"},cr={key:1,class:"space-y-3 max-h-[300px] overflow-y-auto [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500"},dr={key:0},Nn=e.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update"],setup(l,{emit:t}){const n=l,a=e.inject("form"),o=e.computed(()=>a.value.formId),r=e.ref(!1),s=e.ref(0),i=t,c=e.ref(!1),d=e.ref({}),p=e.ref([]),h=e.ref(""),E=e.computed(()=>Array.isArray(p.value)?p.value.filter(w=>w.ext==="jpg"||w.ext==="png").map(w=>w?.file_path):[]),k=e.computed(()=>h.value===""?p.value:p.value.filter(w=>w?.uploaded_name?.includes(h.value))),v=w=>{const b=E.value.findIndex(S=>S===w.item.file_path);b!==-1&&(r.value=!0,s.value=b)},f=async()=>{try{const w=await fetch(`${n.prefix}/widget/file/${o.value}`).then(b=>b.json());p.value=w?.rows}catch(w){console.error(w)}},g=async w=>{await Promise.all(Array.from(w.target.files).map(async b=>{const S=new FormData;S.append("file",b);try{const M=`${n.prefix}/widget/file/${o.value}`,B=await fetch(M,{method:"POST",body:S});return B.ok?(i("update","file-list"),b):(ge.notify({type:B.status>=400&&B.status<500?"warning":"error",title:"Error",message:`Error code: ${B.status}`}),null)}catch(M){return ge.notify({type:"error",title:"Error",message:M.message||"Unknown error"}),console.error(M),null}})),await f()},x=w=>{const b={...w};return w.cancel||(b.cancel=()=>{c.value=!1}),w.updateListOnConfirm&&(b.confirm=async()=>{await w.confirm(),c.value=!1,f()}),b},y=w=>{d.value=x(w),c.value=!0};return e.watch(o,w=>{w&&f()}),e.onMounted(()=>{o.value&&f()}),(w,b)=>{const S=e.resolveComponent("Lightbox"),M=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",nr,[e.createElementVNode("div",lr,[e.createElementVNode("h2",ar," Файлів: "+e.toDisplayString(p.value?.length),1),e.createElementVNode("div",or,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:b[0]||(b[0]=B=>g(B))},null,32),e.createElementVNode("div",rr,[e.createVNode(tr,{height:"16",width:"16"})])])])]),p.value?.length>4?(e.openBlock(),e.createElementBlock("div",sr,[e.createElementVNode("div",null,[e.createElementVNode("div",ir,[b[8]||(b[8]=e.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[e.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),e.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":b[1]||(b[1]=B=>h.value=B),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[e.vModelText,h.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),p.value?.length?(e.openBlock(),e.createElementBlock("div",cr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,(B,T)=>(e.openBlock(),e.createBlock(Jo,{key:T,prefix:l.prefix,item:B,index:T,onUpdate:b[2]||(b[2]=Z=>w.$emit("update","file-list")),onOpenModal:b[3]||(b[3]=Z=>y(Z)),onOpenLightbox:b[4]||(b[4]=Z=>v(Z))},null,8,["prefix","item","index"]))),128)),k.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",dr,[...b[9]||(b[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])]))])):e.createCommentVNode("",!0),e.createVNode(S,{modelValue:r.value,"onUpdate:modelValue":b[5]||(b[5]=B=>r.value=B),startIndex:s.value,"onUpdate:index":b[6]||(b[6]=B=>s.value=B),images:E.value},null,8,["modelValue","startIndex","images"]),e.createVNode(M,e.mergeProps({modelValue:c.value,"onUpdate:modelValue":b[7]||(b[7]=B=>c.value=B),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),ur={class:"flex items-center justify-between"},pr={class:"text-[16px] text-gray-900 font-medium"},mr={class:"grid gap-3"},fr=ae(e.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(l){const t=l,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,a=>{n.value=a}),(a,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",ur,[e.createElementVNode("p",pr,e.toDisplayString(l.title),1),e.createVNode(Zt,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),style:e.normalizeStyle(l.style)},null,8,["modelValue","style"])]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",mr,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-00f2f0fc"]]),hr={class:"text-[16px] text-gray-900 font-medium"},gr={class:"grid gap-3"},yr=ae(e.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(l){const t=l,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,a=>{n.value=a}),(a,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("button",{type:"button",onClick:o[0]||(o[0]=r=>n.value=!n.value),class:"flex items-center gap-2"},[e.createVNode(e.unref(Wt),{class:e.normalizeClass(["h-4 w-4 duration-300",[n.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",hr,e.toDisplayString(l.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",gr,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-78778cb5"]]),kr={class:"flex items-center justify-between"},br={switcher:fr,accordion:yr,default:e.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",kr,[e.createElementVNode("p",null,e.toDisplayString(l.title),1)]),e.renderSlot(t.$slots,"default")]))}})},Fe={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},wr=(l,t)=>String(l)===String(t),xr=(l,t)=>String(l)!==String(t),_r=(l,t)=>l>t,vr=(l,t)=>l>=t,Er=(l,t)=>l<t,Vr=(l,t)=>l<=t,Br=(l,t)=>Array.isArray(t)&&t.length===2?l>=t[0]&&l<=t[1]:!1,Cr=(l,t)=>String(l).startsWith(String(t)),Sr=(l,t)=>String(l).endsWith(String(t)),Nr=(l,t)=>String(l).includes(String(t)),$r=(l,t)=>Array.isArray(t)?t.includes(l):!1,Mr=(l,t)=>Array.isArray(t)?!t.includes(l):!0,$n=(l,t)=>{if(!t)return!0;switch(t?.[1]){case Fe.Equal:return wr(l,t?.[2]);case Fe.Inequal:return xr(l,t?.[2]);case Fe.Higer:return _r(l,t?.[2]);case Fe.HigerOrEqual:return vr(l,t?.[2]);case Fe.Lower:return Er(l,t?.[2]);case Fe.LowerOrEqual:return Vr(l,t?.[2]);case Fe.Between:return Br(l,t?.[2]);case Fe.StartWith:return Cr(l,t?.[2]);case Fe.EndWith:return Sr(l,t?.[2]);case Fe.Contain:return Nr(l,t?.[2]);case Fe.In:return $r(l,t?.[2]);case Fe.NotIn:return Mr(l,t?.[2]);default:return!0}},Mn=e.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(l){const t=l,n=e.inject("values",e.ref({})),a=e.inject("form"),o=e.computed(()=>t.schema?.filter(i=>{const c=i?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,p=t.name?n.value?.[t.name]?.[d]??n.value?.[d]:n.value?.[d];return $n(p,c)})),r=e.computed(()=>br[t.view]),s=e.computed(()=>{if(n.value||(n.value={}),!t.name)return n.value;const i=n.value[t.name];if(i)return i;const c={};return n.value={...n.value,[t.name]:c},c});return(i,c)=>l.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{key:0,title:l.title,style:e.normalizeStyle(l.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,d=>(e.openBlock(),e.createBlock(Gn,e.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:s.value[d.name],"onUpdate:modelValue":p=>s.value[d.name]=p,style:l.style,error:e.unref(a)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),Dr=["aria-expanded","data-focus"],Ar={class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full"},Fr={key:0,class:"flex flex-nowrap items-center gap-1 overflow-x-auto overflow-y-hidden min-w-0 flex-1 py-0.5"},Lr={class:"flex items-center gap-1 min-w-0"},Ir=["title"],Tr=["innerHTML"],Or=["onClick"],zr={class:"flex-1 min-w-[2px]"},Rr=["placeholder"],jr=["title"],Pr=["innerHTML"],Ur={key:3,class:"truncate flex-1 min-w-0"},Hr={key:2,class:"flex-1 min-w-[2px]"},qr=["placeholder"],Kr={class:"flex items-center shrink-0"},Gr=["disabled"],Yr=["disabled","title"],Wr=["aria-disabled","onClick"],Zr=["innerHTML"],Jr={key:1,class:"px-3 py-2 text-center text-gray-500"},Xr=["disabled"],an="w-[16px] h-[16px] flex items-center justify-center flex-shrink-0 text-current",on=ae(e.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},start:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{},maxlength:{},minlength:{}},emits:["change","update:modelValue","value-selected"],setup(l,{emit:t}){const n=l,a=t,o=e.computed(()=>n.multiple),r=e.computed(()=>n.disabled);Se(n.style);const s=e.computed({get:()=>n.modelValue,set:V=>a("update:modelValue",V)});!s.value&&n.defaultValue&&(s.value=n.defaultValue);const i=e.ref(null),c=e.ref(null),d=e.ref(null),p=e.ref(null),h=e.ref(!1),E=e.ref(!1),k=e.ref(null),v=e.ref([]),f=e.ref(-1),g=e.ref([]),x=e.ref(""),y=e.ref(null),w=e.ref("bottom"),b=e.ref({}),S=e.ref([]),M=e.computed(()=>{if(!S.value.length)return[];const V=v.value,$=new Map(V.map(L=>[L.id?.toString(),L]));return S.value.map(L=>$.get(L?.toString())).filter(L=>!!L)}),B=e.computed(()=>n.placeholder||"Select..."),T=e.computed(()=>H(k.value));e.computed(()=>o.value?!S.value.length&&x.value==="":!T.value&&x.value==="");const Z=e.computed(()=>r.value?!1:o.value?S.value.length>0:!!s.value),J=V=>o.value?S.value.some($=>$?.toString()===V?.toString()):s.value?.toString()===V?.toString(),I=e.computed(()=>{let V=v.value??[];if(!n.data&&x.value.trim()!==""){const $=x.value.toLowerCase();V=V.filter(L=>{const ee=H(L).toLowerCase(),ke=L.text?.toLowerCase?.()||"";return ee.includes($)||ke.includes($)})}if(o.value&&S.value.length){const $=new Set(S.value.map(L=>L?.toString()));V=V.filter(L=>!$.has(L.id?.toString()))}return V}),F=e.inject("values"),R=e.inject("field-props"),G=/\{\{\s*([^}]+?)\s*\}\}/g,O=V=>(V?String(V):"").replace(/<[^>]*>/g,"").trim(),A=e.computed(()=>n.slot??n?.optionTemplate??""),W=V=>{if(!V)return"";const $=A.value;return $?$.replace(G,(L,ee)=>{const ke=ee.trim(),be=V[ke];return be!=null?String(be):""}):V.text??""},H=V=>{if(!V)return"";if(!A.value)return V.text??"";const L=W(V);return O(L)||V.text||""},pe=new Map,me=bl.icons,Ae=V=>V.replace(/^([A-Z])|[\s-_]+(\w)/g,($,L,ee)=>ee?ee.toUpperCase():L.toLowerCase()),Le=V=>{const $=Ae(V);return $?$.charAt(0).toUpperCase()+$.slice(1):""},q=V=>{if(!V)return;const $=Le(V);if(pe.has($))return pe.get($);const ee=[$,`${$}Icon`,`Lucide${$}`,`Lucide${$}Icon`].map(ke=>me[ke]).find(Boolean);return pe.set($,ee),ee},re=V=>V?typeof V.icon=="string"?q(V.icon)??null:V.icon??null:null,ue=V=>!!(V?.color&&!re(V)),fe=V=>V?.color?{color:V.color}:void 0,ye=V=>!!re(V),z=(V,$,L)=>{if(!R)return!1;const ee=R.value?.[V]??{},ke=(we,ve,u)=>{if(!ve.length)return we;const[m,..._]=ve,C={...we};if(!_.length)return C[m]=u,C;const U=typeof we[m]=="object"&&we[m]!==null?we[m]:{};return C[m]=ke(U,_,u),C},be=ke(ee,$,L);return R.value={...R.value||{},[V]:be},!0},le=V=>{if(!n.set)return;const $=F?.value;!$&&!R||Object.entries(n.set).forEach(([L,ee])=>{if(!L)return;const ke=V?V[ee]:null,be=L.split(".").map(u=>u.trim()).filter(Boolean);if(!be.length)return;const[we,...ve]=be;ve.length&&z(we,ve,ke??null)||$&&($[we]=ke??null)})},xe=e.computed(()=>n.parent?F?.value?.[n.parent]?.toString()??null:null),Me=async V=>{if(!n.data){let $=n.options??[];if(V?.trim()){const L=V.toLowerCase();$=$.filter(ee=>{const ke=H(ee).toLowerCase(),be=ee.text?.toLowerCase?.()||"";return ke.includes(L)||be.includes(L)})}return $}try{const $=n.host??"",L=n.prefix??"api",ee=n.api??`/${L}/suggest/${n.data}`,ke=`${$}${ee}`,be=new URLSearchParams;return be.set("json","1"),V&&be.set("key",V),xe.value!==void 0&&xe.value!==null&&xe.value!==""&&be.set("parent",xe.value),n.start===1&&be.set("start","1"),(await fetch(`${ke}?${be.toString()}`).then(ve=>ve.json()))?.data??[]}catch{return[]}},D=async()=>{n.data?v.value=await Me(x.value):v.value=n.options?[...n.options]:[]},j=async V=>{if(V==null||V==="")return null;const $=v.value?.find(L=>L?.id?.toString()===String(V));if($)return $;if(n.data)try{const L=n.host??"",ee=n.prefix??"api",ke=n.api??`/${ee}/suggest/${n.data}`,be=`${L}${ke}`,we=new URLSearchParams;return we.set("json","1"),we.set("val",String(V)),xe.value!==void 0&&xe.value!==null&&xe.value!==""&&we.set("parent",xe.value),n.start===1&&we.set("start","1"),((await fetch(`${be}?${we.toString()}`).then(m=>m.json()))?.data??[])?.[0]??null}catch{return null}return null},Y=async V=>{const $=new Set(v.value.map(ee=>ee.id?.toString())),L=V.filter(ee=>!$.has(ee?.toString()));L.length&&await L.reduce(async(ee,ke)=>{await ee;const be=await j(ke);be&&v.value.push(be)},Promise.resolve())},ne=()=>{if(!I.value.length){f.value=-1;return}let V=0;if(!o.value&&k.value){const $=k.value.id?.toString(),L=I.value.findIndex(ee=>ee.id?.toString()===$);L>=0&&(V=L)}f.value=V,e.nextTick(()=>{Ie(g.value[V],d.value)})},oe=async()=>{r.value||(h.value=!0,await D(),await e.nextTick(()=>{ot(),y.value?.focus()}),ne())},N=()=>{h.value=!1,f.value=-1,e.nextTick(()=>{y.value?.blur()})},P=async V=>{if(r.value)return;!h.value?await oe():N()},K=async()=>{if(!r.value){if(h.value){N();return}await oe()}},he=()=>{o.value?(S.value=[],s.value=[],a("change",[]),Ye(null,[])):(k.value=null,s.value=null,a("change",null),Ye(null,null)),le(null),x.value="",e.nextTick(()=>y.value?.focus())},Ne=V=>{o.value&&(S.value=S.value.filter($=>$?.toString()!==V?.toString()),s.value=[...S.value],a("change",s.value),Ye(null),e.nextTick(()=>y.value?.focus()))},Ye=(V,$)=>{const L=$??(o.value?[...S.value]:V?.id??null);a("value-selected",{name:n.name,value:L,option:V})},ze=V=>{o.value?(J(V.id)||(S.value=[...S.value,V.id],s.value=[...S.value],a("change",s.value),Ye(V)),x.value="",e.nextTick(()=>{y.value?.focus(),f.value=Math.min(f.value,I.value.length-1)}),le(null)):(k.value=V,s.value=V.id,a("change",s.value),Ye(V),x.value="",N(),le(V))},bn=V=>{if(J(V.id)){o.value||N();return}ze(V)},Ie=(V,$)=>{if(!V||!$)return;const L=V.offsetTop,ee=L+V.offsetHeight,ke=$.scrollTop,be=ke+$.clientHeight;let we=$.scrollTop;L<ke?we=L-80:ee>be&&(we=ee-$.clientHeight+4);const ve=$;ve.scrollTop=we},We=V=>{let $=V.parentElement;for(;$;){if($.classList.contains("ui-dialog__content"))return $;const L=window.getComputedStyle($),ee=L.overflow+L.overflowY+L.overflowX;if(ee.includes("auto")||ee.includes("scroll")||$===document.body||$===document.documentElement)return $;$=$.parentElement}return document.body},ot=()=>{if(!c.value)return;const V=c.value.getBoundingClientRect(),$=window.innerHeight||document.documentElement.clientHeight,L=window.innerWidth||document.documentElement.clientWidth,ee=8,ke=8,be=n.maxHeight||300,we=$-V.bottom-ke-ee,ve=V.top-ke-ee,u=we>=ve,m=Math.max(L-ee*2,0);let{width:_}=V;m>0&&_>m&&(_=m);let{left:C}=V;C+_+ee>L&&(C=L-_-ee),C=Math.max(C,ee);const U=Math.min(be,Math.max(u?we:ve,50));w.value=u?"bottom":"top",b.value={position:"fixed",left:`${C}px`,width:`${_}px`,maxHeight:`${U}px`,transform:u?"none":"translateY(-100%)",top:u?`${V.bottom+ke}px`:`${V.top-ke}px`}},qe=async V=>{r.value||!h.value&&(V.key==="ArrowDown"||V.key==="ArrowUp")&&(V.preventDefault(),await oe())},qt=V=>{if(!h.value)return;const{key:$}=V;if($==="ArrowDown")V.preventDefault(),f.value+1<I.value.length&&(f.value+=1,Ie(g.value[f.value],d.value));else if($==="ArrowUp")V.preventDefault(),f.value>0&&(f.value-=1,Ie(g.value[f.value],d.value));else if($==="Enter"){V.preventDefault();const L=I.value[f.value];L&&ze(L),y.value?.blur()}else $==="Escape"?(V.preventDefault(),N()):$==="Backspace"?o.value&&x.value===""&&S.value.length&&(S.value=S.value.slice(0,-1),s.value=[...S.value],a("change",s.value)):$==="Home"?(f.value=0,Ie(g.value[0],d.value)):$==="End"?(f.value=I.value.length-1,Ie(g.value[f.value],d.value)):$==="Tab"&&N()},rt=()=>{r.value||(E.value=!0)},kt=()=>{E.value=!1,x.value=""},bt=V=>{V.key==="Escape"&&h.value&&N()},wt=V=>{const $=V.target;i.value?.contains($)||p.value?.contains($)||N()},Kt=V=>{h.value&&d.value&&!d.value.contains(V.target)&&ot()},xt=()=>{h.value&&ot()},Gt=()=>{h.value&&ot()};e.watch(()=>n.options,V=>{V?.length&&(v.value=[...V],Ze())},{immediate:!0});async function Ze(){if(o.value)Array.isArray(s.value)?S.value=[...s.value]:(S.value=s.value==null?[]:[s.value],s.value=[...S.value]),n.data&&S.value.length&&(await Y(S.value),await e.nextTick());else{if(Array.isArray(s.value)){const V=s.value[0]??null;s.value=V??null}s.value!=null&&(k.value=await j(s.value)),le(k.value??null)}}e.watch(s,()=>{Ze()}),e.onMounted(async()=>{addEventListener("keydown",bt),addEventListener("scroll",Kt,!0),addEventListener("resize",xt),document.addEventListener("click",wt,!0),c.value&&We(c.value).addEventListener("scroll",Gt,!0),n.options?.length&&!n.data?v.value=[...n.options]:n.data&&(v.value=await Me("")),await Ze(),Je.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",bt),removeEventListener("scroll",Kt,!0),removeEventListener("resize",xt),document.removeEventListener("click",wt,!0),c.value&&We(c.value).removeEventListener("scroll",Gt,!0)});const et=e.ref(!1),st=e.ref({}),_t=e.ref([]),it=e.ref(null);async function vt(){if(!(!n.add?.token||it?.value.validate()))try{const $=n.add.api??`/api/table/${n.add.token}`,L=await fetch($,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(st.value)}),ee=await L.json().catch(()=>({})),ke=ee?.error||ee?.message,be=Number(ee?.code)>=400;if(!L.ok||be){ge.notify({title:"Помилка",type:"error",message:ke||`Код помилки: ${ee?.code||L.status}`});return}const we=ee?.id;if(!we){ge.notify({title:"Помилка",type:"error",message:"Обʼєкт створено, але в відповіді відсутній ID."});return}if(!n.options?.length&&n.data){const ve=await fetch(`${n.api??`/api/suggest/${n.data}`}?val=${we}`).then(u=>u.json());k.value=ve[0],v.value.push(ve[0]),s.value=we}et.value=!1,ge.notify({title:"Успіх",message:"Обʼєкт успішно створено."})}catch($){ge.notify({title:"Помилка",type:"error",message:$?.message||"Не вдалося створити обʼєкт."})}}async function ct(){if(!n.add)return null;const V=await fetch(`/api/template/form/${n.add.form}`).then($=>$.json());return _t.value=V.schema,et.value=!0,null}function Et(V,$=200){let L;return(...ee)=>{L&&clearTimeout(L),L=window.setTimeout(()=>V(...ee),$)}}const wn=Et(async V=>{v.value=await Me(V)},200);e.watch(x,V=>{n.data&&wn(V.trim())}),e.watch(()=>n.options,V=>{!n.data&&V?.length&&(v.value=[...V],Ze())},{immediate:!0}),e.watch(()=>n.parent??n.parentValue,()=>{n.data&&D()});const Je=e.ref(!0);return e.watch(xe,async()=>{if(n.data&&(Je.value||(o.value?(S.value=[],s.value=[],a("change",[])):(k.value=null,s.value=null,a("change",null))),await D(),n.auto===1&&xe.value&&v.value.length>0)){const V=v.value[0];V&&ze(V)}}),(V,$)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(ge.VsModal),{visible:et.value,"onUpdate:visible":$[1]||($[1]=L=>et.value=L),class:"z-[1000]",title:"Додати",buttonText:"Додати",onDone:vt,teleport:l.teleport},{default:e.withCtx(()=>[e.createVNode(He,{schema:_t.value,modelValue:st.value,"onUpdate:modelValue":$[0]||($[0]=L=>st.value=L),ref_key:"addForm",ref:it},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:$[5]||($[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass])},[$[10]||($[10]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),$[11]||($[11]=e.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["vs-input-select__control flex min-h-[38px] items-center justify-between rounded transition-colors bg-white",r.value?"bg-gray-100 text-gray-400 cursor-not-allowed":""]),role:"combobox","aria-expanded":h.value,"aria-haspopup":"listbox",onKeydown:qe,onClick:K,"data-focus":h.value||E.value?"true":"false",ref_key:"triggerRef",ref:c},[e.createElementVNode("div",Ar,[o.value?(e.openBlock(),e.createElementBlock("div",Fr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,L=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[rgb(230,230,230)] rounded-[2px] m-[2px] box-border max-w-full",key:L.id},[e.createElementVNode("div",Lr,[ue(L)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:e.normalizeStyle({backgroundColor:L?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ye(L)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(an),style:e.normalizeStyle(fe(L)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(re(L)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"truncate text-[#172b4d] overflow-hidden max-w-[200px] px-0.5 pl-1.5",title:H(L)},[A.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:W(L)},null,8,Tr)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(L.text),1)],64))],8,Ir)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border text-[#172b4d] hover:bg-[rgb(255,189,173)] hover:text-[rgb(222,53,11)] flex-shrink-0",onClick:e.withModifiers(ee=>Ne(L.id),["stop"])},[...$[6]||($[6]=[e.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)])],8,Or)]))),128)),e.createElementVNode("div",zr,[!r.value&&l.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:y,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900 hover:cursor-pointer",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:S.value.length?" ":B.value,"onUpdate:modelValue":$[2]||($[2]=L=>x.value=L),onFocus:rt,onBlur:kt,onKeydown:qt},null,40,Rr)),[[e.vModelText,x.value]]):e.createCommentVNode("",!0)])])):!o.value&&T.value&&x.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900 absolute flex items-center gap-1 min-w-0"]),title:T.value},[ue(k.value)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block flex-shrink-0",style:e.normalizeStyle({backgroundColor:k.value?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ye(k.value)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(an),style:e.normalizeStyle(fe(k.value)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(re(k.value)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),A.value?(e.openBlock(),e.createElementBlock("span",{key:2,class:"truncate flex-1 min-w-0",innerHTML:W(k.value)},null,8,Pr)):(e.openBlock(),e.createElementBlock("span",Ur,e.toDisplayString(k.value?.text),1))],8,jr)):e.createCommentVNode("",!0),o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Hr,[!r.value&&l.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:y,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900 hover:cursor-pointer",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:T.value?" ":B.value,"onUpdate:modelValue":$[3]||($[3]=L=>x.value=L),onFocus:rt,onBlur:kt,onKeydown:qt},null,40,qr)),[[e.vModelText,x.value]]):e.createCommentVNode("",!0)]))]),e.createElementVNode("div",Kr,[Z.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:r.value,onClick:e.withModifiers(he,["stop"])},[...$[7]||($[7]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)])],8,Gr)):e.createCommentVNode("",!0),$[9]||($[9]=e.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),e.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:r.value,onClick:$[4]||($[4]=e.withModifiers(L=>P(),["stop"])),title:h.value?"Закрити список":"Відкрити список"},[...$[8]||($[8]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})],-1)])],8,Yr)])],42,Dr),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[h.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:p,class:e.normalizeClass(["fixed z-[3000] rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]"]),style:e.normalizeStyle(b.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:b.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[I.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(I.value,(L,ee)=>(e.openBlock(),e.createElementBlock("div",{key:L.id,ref_for:!0,ref:ke=>g.value[ee]=ke,class:e.normalizeClass(["flex px-3 py-2 gap-2 cursor-pointer select-none text-gray-900",J(L.id)?"bg-[#2684ff] text-white":"bg-white hover:bg-[#deebff] hover:text-[#172b4d]",f.value===ee&&!J(L.id)?"bg-[#deebff] text-[#172b4d]":""]),"aria-disabled":J(L.id)?"true":"false",role:"option",tabindex:"-1",onClick:ke=>bn(L)},[ue(L)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block flex-shrink-0",style:e.normalizeStyle({backgroundColor:L?.color})},null,4)):e.createCommentVNode("",!0),!A.value&&ye(L)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(an),style:e.normalizeStyle(fe(L)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(re(L)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",f.value===L.id?"text-white":"",(f.value===ee,"")])},[A.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:W(L)},null,8,Zr)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(L.text),1)],64))],2)],10,Wr))),128)):(e.openBlock(),e.createElementBlock("div",Jr," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),n.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:ct,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:r.value,type:"button"},[e.createVNode(Re,{width:"16",height:"16"}),$[12]||($[12]=e.createElementVNode("span",null,"Додати",-1))],8,Xr)):e.createCommentVNode("",!0)],512)],64))}}),[["__scopeId","data-v-df831fc2"]]),Qr=["placeholder","disabled"],Dn=e.defineComponent({__name:"vs-input-textarea",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=Se(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??"");function s(){typeof a.value=="string"&&(a.value=a.value.trim())}return(i,c)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":c[0]||(c[0]=d=>a.value=d),placeholder:r.value,disabled:o.value,row:"2",onBlur:s,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,42,Qr)),[[e.vModelText,a.value]])}}),es={key:1,class:"richtext-error"},An=e.defineComponent({__name:"vs-input-richtext",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},richtextProps:{default:()=>({})}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=e.ref(null);e.onMounted(async()=>{try{const d=await import("@opengis/richtext");t.value=d.VsRichtext}catch{console.warn("@opengis/richtext is not installed. Please install it in your app to use richtext input.")}});const n=l,{inputClass:a}=Se(n.style),o=e.useModel(l,"modelValue"),r=e.computed(()=>!!n.disabled),s=e.computed(()=>n.placeholder??""),i=e.computed(()=>({height:"300px",...n.richtextProps}));return(c,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["richtext-wrapper !h-full !border-transparent",[l.customClass,e.unref(a),{"richtext-disabled":r.value}]]),style:e.normalizeStyle(r.value?{pointerEvents:"none",opacity:.6}:{})},[t.value?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(t.value),e.mergeProps({key:0,modelValue:o.value,"onUpdate:modelValue":d[0]||(d[0]=p=>o.value=p),placeholder:s.value},i.value),null,16,["modelValue","placeholder"])):(e.openBlock(),e.createElementBlock("div",es,[...d[1]||(d[1]=[e.createElementVNode("p",null,"@opengis/richtext package is not installed.",-1),e.createElementVNode("p",null,"Please install it: npm install @opengis/richtext",-1)])]))],6))}}),ts={},ns={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};function ls(l,t){return e.openBlock(),e.createElementBlock("svg",ns,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),e.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)])])}const as=ae(ts,[["render",ls]]),os={},rs={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function ss(l,t){return e.openBlock(),e.createElementBlock("svg",rs,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const is=ae(os,[["render",ss]]),cs={},ds={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function us(l,t){return e.openBlock(),e.createElementBlock("svg",ds,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)])])}const ps=ae(cs,[["render",us]]),ms={},fs={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function hs(l,t){return e.openBlock(),e.createElementBlock("svg",fs,[...t[0]||(t[0]=[e.createStaticVNode('<circle cx="9" cy="12" r="1"></circle><circle cx="9" cy="5" r="1"></circle><circle cx="9" cy="19" r="1"></circle><circle cx="15" cy="12" r="1"></circle><circle cx="15" cy="5" r="1"></circle><circle cx="15" cy="19" r="1"></circle>',6)])])}const St=ae(ms,[["render",hs]]),gs={},ys={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function ks(l,t){return e.openBlock(),e.createElementBlock("svg",ys,[...t[0]||(t[0]=[e.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)])])}const bs=ae(gs,[["render",ks]]),ws={},xs={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _s(l,t){return e.openBlock(),e.createElementBlock("svg",xs,[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"},null,-1)])])}const vs=ae(ws,[["render",_s]]),Es={class:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden flex flex-col"},Vs={class:"flex flex-col gap-2 !p-4 border-b border-gray-200 sm:flex-row sm:items-center sm:justify-between bg-gray-50"},Bs={class:"relative w-full"},Cs={class:"flex flex-nowrap items-center justify-end gap-2 w-full overflow-x-auto"},Ss={class:"w-full overflow-x-auto"},Ns={class:"w-full min-w-[640px] table-auto divide-y divide-gray-200"},$s={class:"bg-gray-50"},Ms={class:"border-b border-gray-200"},Ds={class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 w-12 text-center"},As=["onClick"],Fs={key:0,class:"text-gray-400"},Ls={key:0,colspan:"100%",class:"text-center"},Is={class:"w-full"},Ts={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},Os=["onDragstart","onDragover","onDrop"],zs={class:"px-4 py-3 text-center align-middle"},Rs={class:"flex items-center justify-center"},js=["innerHTML"],Ps={key:0,class:"flex items-center gap-3 text-sm text-gray-700"},Us={key:0},Hs=["src"],qs={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},Ks={key:1,class:"flex items-center justify-center"},Gs={key:2,class:"text-sm font-medium text-gray-900"},Ys={class:"px-4 py-3 text-right whitespace-nowrap"},Ws={class:"flex items-center justify-end gap-2"},Zs=["onClick"],Js=["onClick"],Xs={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},Fn=e.defineComponent({__name:"vs-input-datatable",props:e.mergeModels({actions:{},colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useSlots(),a=D=>t.actions===void 0?!0:t.actions.includes(D),o=e.useModel(l,"modelValue"),r=e.ref({}),s=e.ref(""),i=e.ref(null),c=e.ref("asc"),d=e.computed(()=>{const D=o.value??[],j=s.value?D.filter(oe=>p.value?.some(N=>{const P=N.key||N.name;if(!P)return!1;const K=oe[P];return K?Array.isArray(K)?K.join(", ").toLowerCase().includes(s.value.toLowerCase()):String(K).toLowerCase().includes(s.value.toLowerCase()):!1})):D;if(!i.value)return j;const Y=i.value,ne=[...j].sort((oe,N)=>{const P=Le(oe?.[Y]),K=Le(N?.[Y]);return typeof P=="number"&&typeof K=="number"?P-K:String(P).localeCompare(String(K))});return c.value==="asc"?ne:ne.reverse()}),p=e.computed(()=>(t.colModel??[]).filter(D=>!D.tableHidden)),h=e.ref(null),E=e.ref(null),k=e.ref(null),v=D=>{h.value=D},f=D=>{E.value=D},g=D=>{if(h.value===null||h.value===D){h.value=null,E.value=null;return}const j=[...o.value],[Y]=j.splice(h.value,1);j.splice(D,0,Y),o.value=j,h.value=null,E.value=null},x=()=>{k.value&&k.value.click()},y=D=>{const j=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],Y=D.toLowerCase();return j.some(ne=>Y.endsWith(ne))},w=D=>{const Y=D.target.files?.[0];if(!Y)return;const ne=new FileReader;ne.onload=oe=>{try{const N=oe.target?.result;if(typeof N=="string"){const P=JSON.parse(N);Array.isArray(P)&&o.value.push(...P)}}catch(N){console.error("Error parsing file:",N)}},ne.readAsText(Y)},b=()=>{const D=JSON.stringify(o.value,null,2),j=new Blob([D],{type:"application/json"}),Y=URL.createObjectURL(j),ne=document.createElement("a");ne.href=Y,ne.download="data.json",ne.click(),URL.revokeObjectURL(Y)},S=new Set(["autocomplete","select","radio","checkbox","combobox"]),M=new Map,B=(D,j)=>{const Y=`/api/suggest/${D}`,ne=Y.includes("?")?"&":"?",oe=j?`&val=${j}`:"";return`${Y}${ne}json=1${oe}`},T=D=>D==null||D===""?null:typeof D=="object"?D?.id!==void 0&&D.id!==null&&D.id!==""?D.id:null:D,Z=D=>{const j=new Set;return Array.isArray(o.value)&&o.value.forEach(Y=>{const ne=Y?.[D];if(ne==null||ne==="")return;if(Array.isArray(ne)){ne.forEach(N=>{const P=T(N);P!==null&&j.add(P)});return}const oe=T(ne);oe!==null&&j.add(oe)}),j},J=async()=>{if(!t.colModel?.length)return;const D=t.colModel.filter(j=>j.data&&S.has(j.type?.toLowerCase()||""));D.length&&await Promise.all(D.map(async j=>{const Y=j.key||j.name;if(!Y)return;const ne=Z(Y),oe=Array.from(ne).map(K=>String(K)).sort(),N=oe.join(",");if(!oe.length||M.get(Y)===N)return;M.set(Y,N);const P=oe.map(encodeURIComponent).join(",");try{const he=await(await fetch(B(j.data,P))).json();r.value[Y]=he?.data??he}catch(K){console.error("Failed to fetch column values",K)}}))};e.watch([()=>t.colModel,()=>o.value],()=>{J()},{immediate:!0,deep:!0});const I=e.ref(""),F=e.ref(!1);let R="edit",G=0;const O=D=>(D?.format||D?.type||"").toString().toLowerCase(),A=e.computed(()=>t.colModel?.filter(D=>O(D)!=="slot").map(D=>{const{slot:j,...Y}=D;return Y})??[]),W=e.ref({}),H=e.ref({}),pe=D=>typeof D!="string"?!1:!!n[D],me=(D,j)=>j?j.split(".").reduce((Y,ne)=>Y==null?Y:Y[ne.trim()],D):D,Ae=(D,j)=>typeof D!="string"?"":D.replace(/{{\s*([^}]+)\s*}}/g,(Y,ne)=>{const oe=me(j,ne.trim());return oe??""}),Le=D=>{if(D==null||D==="")return"";if(typeof D=="number")return D;if(typeof D=="boolean")return D?1:0;if(typeof D=="string")return D.toLowerCase();if(Array.isArray(D))return D.map(j=>Le(j)).join(", ");if(typeof D=="object"){if(D.text!==void 0)return String(D.text).toLowerCase();if(D.label!==void 0)return String(D.label).toLowerCase();if(D.id!==void 0)return String(D.id).toLowerCase()}return String(D).toLowerCase()},q=D=>{const j=D.key||D.name;if(j){if(i.value===j){c.value=c.value==="asc"?"desc":"asc";return}i.value=j,c.value="asc"}};async function re(){I.value="Додати",F.value=!0,R="add",W.value={}}function ue(D,j){if(!D?.length)return null;const Y=typeof j=="object"?j?.id:j;return Y==null||Y===""?null:D.find(ne=>ne?.id?.toString()===Y.toString())?.text??null}function fe(D){return D==null||D===""?"-":Array.isArray(D)?D.map(j=>typeof j=="object"?j?.text??j?.id??"-":j).join(", "):typeof D=="object"?D?.text??D?.id??"-":D}function ye(D,j){const Y=j.key||j.name,ne=D?.[Y],oe=r.value[Y];if(!ne)return"-";if(Array.isArray(ne)){const P=ne.map(K=>ue(oe,K)).filter(Boolean);return P.length?P.join(", "):fe(ne)}const N=ue(oe,ne);return N||fe(ne)}async function z(D,j){I.value="Редагувати",F.value=!0,R="edit",G=j,W.value={...D}}function le(){const D=H.value.validate();if(D){ge.notify({type:"warning",title:"Помилка валідації",message:Object.entries(D).map(([j,Y])=>`${j}: ${Y}`).join(`
|
|
2
|
+
`)});return}R==="add"?Array.isArray(o.value)?o.value=[...o.value,W.value]:o.value=[W.value]:o.value=o.value.map((j,Y)=>Y===G?W.value:j),F.value=!1}function xe(D){o.value=o.value.filter((j,Y)=>Y!==D)}function Me(){F.value=!1}return(D,j)=>(e.openBlock(),e.createElementBlock("div",Es,[e.createElementVNode("div",Vs,[e.createElementVNode("div",Bs,[e.createVNode(as,{width:"16",height:"16",class:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":j[0]||(j[0]=Y=>s.value=Y),placeholder:"Пошук",class:"w-full rounded-md border border-gray-200 bg-white pl-10 pr-3 py-2 text-sm text-gray-900 placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100"},null,512),[[e.vModelText,s.value]])]),e.createElementVNode("div",Cs,[a("import")?(e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"fileInput",ref:k,onChange:w,class:"hidden",accept:".json",type:"file"},null,544)):e.createCommentVNode("",!0),a("import")?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",onClick:x,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[e.createVNode(is,{class:"text-gray-700",width:"16",height:"16"}),j[4]||(j[4]=e.createTextVNode(" Імпорт ",-1))])):e.createCommentVNode("",!0),a("export")?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:b,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[e.createVNode(ps,{class:"text-gray-700",width:"16",height:"16"}),j[5]||(j[5]=e.createTextVNode(" Експорт ",-1))])):e.createCommentVNode("",!0),a("add")?(e.openBlock(),e.createElementBlock("button",{key:3,onClick:re,type:"button",class:"inline-flex items-center gap-2 rounded-md bg-blue-500 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-600 transition-colors"},[e.createVNode(Re,{class:"text-white"}),j[6]||(j[6]=e.createTextVNode(" Додати ",-1))])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",Ss,[e.createElementVNode("table",Ns,[e.createElementVNode("thead",$s,[e.createElementVNode("tr",Ms,[e.createElementVNode("th",Ds,[e.createVNode(St,{width:"20",height:"20",class:"mx-auto text-gray-400"})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,Y=>(e.openBlock(),e.createElementBlock("th",{key:Y.key,class:"px-4 py-3 text-left text-xs font-semibold text-gray-900"},[e.createElementVNode("button",{type:"button",onClick:ne=>q(Y),class:"flex items-center gap-1 text-xs font-semibold text-gray-700 hover:text-gray-900 transition-colors"},[e.createElementVNode("span",null,e.toDisplayString(Y.ua||Y.label),1),i.value===(Y.key||Y.name)?(e.openBlock(),e.createElementBlock("span",Fs,e.toDisplayString(c.value==="asc"?"▲":"▼"),1)):e.createCommentVNode("",!0)],8,As)]))),128)),j[7]||(j[7]=e.createElementVNode("th",{class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 text-center w-[1%] whitespace-nowrap"}," Дії ",-1))])]),e.createElementVNode("tbody",{class:e.normalizeClass(["divide-y divide-gray-200",{"[&_tr:last-child]:border-0":!E.value}])},[d.value.length===0?(e.openBlock(),e.createElementBlock("td",Ls,[e.createElementVNode("div",Is,[e.createElementVNode("div",Ts,[e.createVNode(bs,{class:"w-48 mx-auto"}),j[8]||(j[8]=e.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[e.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),e.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(Y,ne)=>(e.openBlock(),e.createElementBlock("tr",{key:Y.id,class:e.normalizeClass(["border-b transition-colors hover:bg-gray-50 cursor-move text-sm text-gray-700",{"opacity-50":h.value===ne,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":E.value===ne}]),draggable:"true",onDragstart:oe=>v(ne),onDragover:e.withModifiers(oe=>f(ne),["prevent"]),onDrop:oe=>g(ne)},[e.createElementVNode("td",zs,[e.createElementVNode("div",Rs,[e.createVNode(St,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,oe=>(e.openBlock(),e.createElementBlock("td",{key:oe.key,class:"px-4 py-3 align-middle"},[O(oe)==="slot"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[pe(oe.slot)?e.renderSlot(D.$slots,oe.slot,{key:0,row:Y,value:Y[oe.key],column:oe}):(e.openBlock(),e.createElementBlock("div",{key:1,class:"text-sm text-gray-900",innerHTML:Ae(oe.slot,Y)},null,8,js))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[O(oe)==="file"?(e.openBlock(),e.createElementBlock("div",Ps,[y(ye(Y,oe))?(e.openBlock(),e.createElementBlock("div",Us,[e.createElementVNode("img",{src:ye(Y,oe),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,Hs)])):(e.openBlock(),e.createElementBlock("div",qs,[e.createVNode(Bn,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):O(oe)==="color"?(e.openBlock(),e.createElementBlock("div",Ks,[e.createElementVNode("span",{class:"inline-flex h-6 w-6 rounded border border-gray-200",style:e.normalizeStyle({backgroundColor:ye(Y,oe)||"#ffffff"})},null,4)])):(e.openBlock(),e.createElementBlock("div",Gs,e.toDisplayString(ye(Y,oe)),1))],64))]))),128)),e.createElementVNode("td",Ys,[e.createElementVNode("div",Ws,[e.createElementVNode("button",{onClick:oe=>z(Y,ne),class:"p-1.5 text-gray-600 hover:text-blue-600 hover:bg-blue-50 rounded transition-colors"},[e.createVNode(vs,{width:"16",height:"16"})],8,Zs),e.createElementVNode("button",{onClick:oe=>xe(ne),class:"p-1.5 text-gray-600 hover:text-red-600 hover:bg-red-50 rounded transition-colors"},[e.createVNode(nt,{width:"16",height:"16"})],8,Js)])])],42,Os))),128))],2)])]),e.createVNode(e.unref(ge.VsModal),{visible:F.value,title:I.value,size:"lg",onClose:Me,teleport:"#modal"},{default:e.withCtx(()=>[e.createVNode(He,{schema:A.value,values:W.value,"onUpdate:values":j[1]||(j[1]=Y=>W.value=Y),form:H.value,"onUpdate:form":j[2]||(j[2]=Y=>H.value=Y)},null,8,["schema","values","form"]),e.createElementVNode("div",Xs,[e.createElementVNode("button",{type:"button",onClick:j[3]||(j[3]=Y=>F.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:le,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])]),_:1},8,["visible","title"])]))}}),Qs={},ei={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-map-pin"};function ti(l,t){return e.openBlock(),e.createElementBlock("svg",ei,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),e.createElementVNode("path",{d:"M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z"},null,-1)])])}const ni=ae(Qs,[["render",ti]]),li={},ai={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none","stroke-width":"2",stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-line"};function oi(l,t){return e.openBlock(),e.createElementBlock("svg",ai,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)])])}const ri=ae(li,[["render",oi]]),si={},ii={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function ci(l,t){return e.openBlock(),e.createElementBlock("svg",ii,[...t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M6.5 9.5l3.5 -3"></path><path d="M14 5.5l3 1.5"></path><path d="M18.5 10l-2.5 7"></path><path d="M13.5 17.5l-7 -5"></path>',9)])])}const di=ae(si,[["render",ci]]),ui={},pi={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function mi(l,t){return e.openBlock(),e.createElementBlock("svg",pi,[...t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M8 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M6 8v8"></path><path d="M18 16v-8"></path><path d="M8 6h8"></path><path d="M16 18h-8"></path>',9)])])}const fi=ae(ui,[["render",mi]]),hi={},gi={version:"1.1",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg","xmlns:sketch":"http://www.bohemiancoding.com/sketch/ns","xmlns:xlink":"http://www.w3.org/1999/xlink",class:"fullscreen-icon"};function yi(l,t){return e.openBlock(),e.createElementBlock("svg",gi,[...t[0]||(t[0]=[e.createElementVNode("title",null,null,-1),e.createElementVNode("desc",null,null,-1),e.createElementVNode("defs",null,null,-1),e.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[e.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[e.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[e.createElementVNode("path",{d:"M2,9 L0,9 L0,14 L5,14 L5,12 L2,12 L2,9 L2,9 Z M0,5 L2,5 L2,2 L5,2 L5,0 L0,0 L0,5 L0,5 Z M12,12 L9,12 L9,14 L14,14 L14,9 L12,9 L12,12 L12,12 Z M9,0 L9,2 L12,2 L12,5 L14,5 L14,0 L9,0 L9,0 Z",id:"Shape"})])])],-1)])])}const ki=ae(hi,[["render",yi]]),bi={class:"bg-white/30 p-1 rounded-md shadow w-fit"},wi={class:"flex gap-2"},xi=["onClick","title"],_i=["src"],vi=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(l,{emit:t}){const n=l,a=e.ref(Object.keys(n.basemaps)[0]),o=t;function r(c){o("onLayerChange",c),a.value=c}const s={z:13,x:4790,y:2762};function i(c){if(c?.preview)return c.preview;if(!c?.url)return;const d={"{z}":s.z,"{x}":s.x,"{y}":s.y};let p=c.url;return Object.entries(d).forEach(([h,E])=>{p=p.replace(new RegExp(h,"gi"),String(E))}),p}return(c,d)=>(e.openBlock(),e.createElementBlock("div",bi,[e.createElementVNode("div",wi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.basemaps,(p,h)=>(e.openBlock(),e.createElementBlock("div",{key:h,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":a.value===h}]),onClick:E=>r(h),title:p.name||h,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:i(p),alt:"",class:"w-10 h-10 object-cover"},null,8,_i)],10,xi))),128))])]))}}),Ei={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},Vi={key:0,class:"vs-select__options absolute z-50 mt-1 w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm"},Bi=["onClick"],Ci={class:"relative flex-1 min-w-[140px]"},Si=["placeholder"],Ni="https://data.softpro.ua/api-user/gis-url-proxy",$i="https://geo.rv.ua/api-user/dzk.api",Mi=ae(e.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(l,{emit:t}){const n=l,a=t,o=["here","xy","parcel"],r=e.computed(()=>{const b=n.config?.tools?.filter(S=>o.includes(S));return b&&b.length?b:o}),s=e.computed(()=>n.config?.placeholder?.trim()||"Пошук…"),i=e.ref(r.value[0]??o[0]);e.watch(r,b=>{b.includes(i.value)||(i.value=b[0])});const c=e.ref(""),d=e.ref(!1),p=e.ref(null);e.watch(i,()=>{c.value="",d.value=!1});function h(b){i.value=b}function E(b){if(!d.value)return;const S=p.value;S&&!S.contains(b.target)&&(d.value=!1)}e.onMounted(()=>{window.addEventListener("click",E,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",E,!0)});function k(b){return b==="xy"?"Координати":b==="parcel"?"Кадастр":"Адреси"}function v(b){const S=b.replace(/[,]+/g," ").trim();if(!S)return null;const M=S.split(/\s+/).filter(Boolean);if(M.length<2)return null;const B=M.slice(0,2).map(Number);if(!B.every(G=>Number.isFinite(G)))return null;const[T,Z]=B;let J=T,I=Z;const F=G=>Math.abs(G)<=90,R=G=>Math.abs(G)<=180;if(!F(J)||!R(I))if(F(I)&&R(J))J=Z,I=T;else return null;return{lat:J,lng:I}}function f(b){return(b?.items||[]).map((M,B)=>({id:String(M?.id??B),title:M?.title||M?.address?.label||"Знайдений обʼєкт",lat:Number(M?.position?.lat),lng:Number(M?.position?.lng)})).filter(M=>Number.isFinite(M.lat)&&Number.isFinite(M.lng))}function g(b){const S=b?.result||b?.data||b;if(!S)return[];const M=S.geom_centroid;if(!M||!Array.isArray(M.coordinates))return[];const[B,T]=M.coordinates;return!Number.isFinite(T)||!Number.isFinite(B)?[]:[{id:"parcel",title:S.cadnum||S.cad_num||"Земельна ділянка",lat:T,lng:B}]}function x(b){const M=b.replace(/\s+/g,"").split(":");if(M.length!==4)return!1;const B=[10,2,3,4];return M.every((T,Z)=>T.length===B[Z]&&/^\d+$/.test(T))}function y(b){a("goToCoordinates",[b.lat,b.lng])}async function w(){const b=c.value.trim();if(b){if(i.value==="xy"){const S=v(b);if(!S){ge.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}y(S),c.value="";return}try{const S=new URL(i.value==="here"?Ni:$i);if(i.value==="here")S.searchParams.set("searchtext",b);else{if(!x(b)){ge.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}S.searchParams.set("cad_num",b)}const M=await fetch(S.toString());if(!M.ok)throw new Error(`HTTP ${M.status}`);const B=await M.json(),T=i.value==="here"?f(B):g(B);if(!T.length)ge.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const Z=T[0];y(Z),c.value=""}}catch(S){const M=S?.message||"Помилка пошуку";ge.notify({type:"error",title:"Пошук",message:M})}}}return(b,S)=>(e.openBlock(),e.createElementBlock("div",Ei,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(w,["prevent"])},[r.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:p,class:"relative search-type w-[140px]"},[e.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:S[0]||(S[0]=M=>d.value=!d.value)},[e.createElementVNode("span",null,e.toDisplayString(k(i.value)),1),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":d.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[...S[2]||(S[2]=[e.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))]),d.value?(e.openBlock(),e.createElementBlock("div",Vi,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,M=>(e.openBlock(),e.createElementBlock("li",{key:M,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:B=>h(M)},e.toDisplayString(k(M)),9,Bi))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",Ci,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":S[1]||(S[1]=M=>c.value=M),placeholder:s.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,Si),[[e.vModelText,c.value,void 0,{trim:!0}]]),S[3]||(S[3]=e.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),[["__scopeId","data-v-359172e4"]]),Di={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},Ai={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},Fi={class:"flex items-center gap-1"},Li=["disabled"],Ii=["disabled"],Ti=["disabled"],Oi={class:"absolute top-4 right-4 z-[1000]"},zi={class:"flex flex-col gap-[2px]"},Ri=["disabled"],ji=["disabled"],Pi=["disabled"],Ui=["disabled"],Hi={class:"bg-white/95 border border-gray-200 rounded-md shadow-xl px-3 py-2 max-w-[240px] text-[11px] sm:text-xs text-gray-900"},qi={class:"space-y-0.5"},Ki={class:"text-gray-500"},Gi={class:"text-gray-900 text-right break-all"},Yi={class:"absolute left-4 bottom-[36px] z-[1000]"},Wi={class:"flex flex-col gap-2"},Zi={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},Ji={class:"flex flex-col gap-1"},Xi=["checked","disabled","onChange"],Qi={class:"text-gray-700 text-xs font-medium"},ec={class:"absolute bottom-0 left-0 right-0 z-[1000] min-h-[28px] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},tc={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full px-2 pb-1"},nc={class:"mr-auto flex items-center gap-2 min-w-0 relative"},lc={class:"shrink-0"},ac={class:"font-bold"},oc={class:"flex items-center"},rc={class:"text-xs mr-2"},sc={key:0,class:"text-xs mr-2"},ic={key:1,class:"text-xs mr-2"},cc=["disabled"],dc=["disabled"],Nt="__vs_form_maplibre_loader__",rn="__vs_form_maplibre_scripts__",$t="vs-global-bounds-src",Mt="vs-global-bounds-line",Ln=ae(e.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},ctrlZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},katottg:{default:""},layers:{default:()=>[]},bounds:{},api:{},center:{default:void 0},zoom:{default:void 0},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.computed(()=>!!n.disabled),r=e.ref(!1),s=e.ref(null),i=e.ref(0),c=e.ref(""),d=e.ref(null),p=e.getCurrentInstance(),h=p?.appContext?.config?.globalProperties?.$settings??{},E=h?.map??{},k=p?.vnode?.props??{};function v(u){return Object.prototype.hasOwnProperty.call(k,u)||Object.prototype.hasOwnProperty.call(k,u.replace(/[A-Z]/g,m=>`-${m.toLowerCase()}`))}const f=Array.isArray(E.center)&&E.center.length===2?E.center:Array.isArray(h.center)&&h.center.length===2?h.center:[30,50];console.log(E);const g=typeof E.zoom=="number"?E.zoom:typeof h.zoom=="number"?h.zoom:typeof h.defaultZoom=="number"?h.defaultZoom:10,x=e.computed(()=>v("center")?n.center:E.center??n.center),y=e.computed(()=>v("zoom")?n.zoom:E.zoom??n.zoom),w=e.computed(()=>v("katottg")?String(n.katottg??""):String(E.katottg??n.katottg??"")),b=e.computed(()=>v("layers")?n.layers??[]:E.layers??n.layers??[]),S=e.computed(()=>v("bounds")?n.bounds:E.bounds??n.bounds),M=e.ref(Array.isArray(x.value)&&x.value.length===2?[...x.value]:f),B=e.ref(typeof y.value=="number"?y.value:g),T=e.ref(n.modelValue),Z=e.ref(null),J=e.ref([]);let I=!1;const F=e.reactive({}),R=e.ref([]),G=e.computed(()=>R.value.map(u=>F[u]).filter(Boolean)),O=e.ref(null),A=e.computed(()=>O.value?.entries??[]),W=e.computed(()=>{if(O.value)return{left:`${O.value.point.x+12}px`,top:`${O.value.point.y+12}px`}}),H=e.computed(()=>{const u={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!n.tools?.length)return{...u,point:!0,line:!0,polygon:!0,rectangle:!0};const m=new Set(n.tools.map(_=>_.toLowerCase()));return{search:m.has("search"),import:m.has("import"),export:m.has("export"),point:m.has("point"),line:m.has("line"),polygon:m.has("polygon"),rectangle:m.has("rectangle")}});function pe(u){if(typeof u!="string"||!u.trim())return"";if(/^https?:\/\//i.test(u))return u;const m=window?.location?.origin??"",_=u.replace(/^\/+/,"");return _?m?`${m}/${_}`:`/${_}`:m}function me(){const u=Array.isArray(E.basemaps)&&E.basemaps.length?E.basemaps:h.basemaps;if(Array.isArray(u)&&u.length){const _=u.map((C,U)=>{const te=String(C?.key??C?.id??C?.name??`b${U}`),X=pe(String(C?.url??""));if(!X)return null;const ie=typeof C?.preview=="string"&&C.preview?pe(C.preview):"";return[te,{...C,url:X,preview:ie}]}).filter(C=>Array.isArray(C)&&C.length===2).reduce((C,[U,te])=>(C[U]=te,C),{});if(Object.keys(_).length)return _}return{voyager:{name:"Оглядова карта",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/voyager/ua/13/4790/2762.png"},orto10:{name:"Ортофото 1:10K",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4790/2762.png"},osmb:{name:"Open Street Maps",url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",preview:"https://tile.openstreetmap.org.ua/styles/osm-bright/13/4790/2762.png"}}}const Ae=me(),Le=Object.keys(Ae),q=e.ref(Le.length?Le[0]:"");async function re(){if(typeof window>"u")return null;const u=window;if(u[Nt])return u[Nt];u[rn]=u[rn]||{};const m=u[rn],_=X=>{if(Array.from(document.styleSheets).some($e=>$e?.href?.includes(X)))return;const _e=document.createElement("link");_e.rel="stylesheet",_e.href=X,document.head.appendChild(_e)},C=X=>(m[X]||(m[X]=new Promise((ie,_e)=>{const $e=Array.from(document.scripts).find(Te=>Te.src===X);if($e){$e.addEventListener("load",()=>ie(),{once:!0}),$e.addEventListener("error",_e,{once:!0}),X.includes("maplibre")&&window.maplibregl&&ie(),X.includes("mapbox-gl-draw")&&window.MapboxDraw&&ie();return}const Ce=document.createElement("script");Ce.src=X,Ce.async=!1,Ce.onload=()=>ie(),Ce.onerror=_e,document.head.appendChild(Ce)})),m[X]),te=(async()=>{_("https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css"),_("https://unpkg.com/@mapbox/mapbox-gl-draw@1.5.0/dist/mapbox-gl-draw.css"),window.maplibregl||await C("https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.js"),window.MapboxDraw||await C("https://unpkg.com/@mapbox/mapbox-gl-draw@1.5.0/dist/mapbox-gl-draw.js");const X=window.maplibregl,ie=window.MapboxDraw;if(!X)throw new Error("maplibregl not available after load");if(!ie)throw new Error("MapboxDraw not available after load");return{maplibregl:X,MapboxDraw:ie}})().catch(X=>{throw delete u[Nt],X});return u[Nt]=te,te}function ue(u){return{version:8,sources:{rasterSource:{type:"raster",tiles:[u],tileSize:256}},layers:[{id:"rasterLayer",type:"raster",source:"rasterSource"}]}}let fe=null,ye=null,z=null,le=null,xe=null,Me=null,D=!1,j=!1;function Y(){return{onSetup(){const u=this.newFeature({type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[0,0],[0,0],[0,0],[0,0],[0,0]]]}});return this.addFeature(u),this.clearSelectedFeatures(),this.updateUIClasses({mouse:"add"}),this.setActionableState({trash:!0}),{rectangle:u,startPoint:null,hasCoordinates:!1}},onMouseMove(u,m){if(!u.startPoint)return;const[_,C]=u.startPoint,U=m.lngLat.lng,te=m.lngLat.lat;u.rectangle.setCoordinates([[[_,C],[U,C],[U,te],[_,te],[_,C]]])},onClick(u,m){if(!u.startPoint){u.startPoint=[m.lngLat.lng,m.lngLat.lat],u.hasCoordinates=!0,u.rectangle.setCoordinates([[[m.lngLat.lng,m.lngLat.lat],[m.lngLat.lng,m.lngLat.lat],[m.lngLat.lng,m.lngLat.lat],[m.lngLat.lng,m.lngLat.lat],[m.lngLat.lng,m.lngLat.lat]]]);return}const[_,C]=u.startPoint,U=m.lngLat.lng,te=m.lngLat.lat;return Math.abs(_-U)>0&&Math.abs(C-te)>0?(u.rectangle.setCoordinates([[[_,C],[U,C],[U,te],[_,te],[_,C]]]),this.map.fire("draw.create",{features:[u.rectangle.toGeoJSON()]}),this.changeMode("simple_select",{featureIds:[u.rectangle.id]})):(this.deleteFeature([u.rectangle.id],{silent:!0}),u.hasCoordinates=!1,this.changeMode("simple_select"))},onStop(){},onTrash(u){this.deleteFeature([u.rectangle.id],{silent:!0}),this.changeMode("simple_select")},toDisplayFeatures(u,m,_){if(!u.hasCoordinates)return;const C=m.properties.id===u.rectangle.id;m.properties.active=C?"true":"false",_(m)}}}const ne=[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","$type","Polygon"],["!=","active","true"]],paint:{"fill-color":"#3b82f6","fill-outline-color":"#3b82f6","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","$type","Polygon"],["==","active","true"]],paint:{"fill-color":"#2563eb","fill-outline-color":"#2563eb","fill-opacity":.2}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","$type","Polygon"],["!=","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3b82f6","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","$type","Polygon"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#2563eb","line-width":2}},{id:"gl-draw-lines-inactive",type:"line",filter:["all",["==","$type","LineString"],["!=","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3b82f6","line-width":2}},{id:"gl-draw-lines-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#2563eb","line-width":2}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["!=","active","true"]],paint:{"circle-radius":5,"circle-color":"#3b82f6"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":6,"circle-color":"#2563eb"}},{id:"gl-draw-polygon-and-line-vertex-halo-active",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-active",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#2563eb"}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","meta","midpoint"],["==","$type","Point"]],paint:{"circle-radius":4,"circle-color":"#1d4ed8"}}];function oe(){const u=q.value;return!u||!Ae[u]?.url?"":Ae[u].url}function N(u,m){return u?.id?String(u.id):u?.url?`${u.url}-${m}`:`layer-${m}`}function P(u){const m=String(u?.url??"").trim();if(!m)return"";if(/^https?:\/\//i.test(m))return m;const _=window.location?.origin??"",C=m.replace(/^\/+/,"");return`${_}/${C}`}function K(u){u&&O.value?.layerId!==u||(O.value=null)}function he(u,m={}){return u.popup===!1?[]:Array.isArray(u.popup)?u.popup.length?u.popup.map(_=>{const C=_?.field||_?.name;if(!C)return null;const U=m[C];return U==null||U===""?null:{key:_.label||C,value:String(U)}}).filter(Boolean):[]:Object.entries(m).slice(0,5).map(([_,C])=>({key:_,value:C==null?"—":String(C)}))}function Ne(u){if(!Array.isArray(u))return[];const m=C=>Array.isArray(C)&&C.length>=2&&Number.isFinite(Number(C[0]))&&Number.isFinite(Number(C[1])),_=C=>{if(!C.length)return C;const U=C[0],te=C[C.length-1];return!te||U[0]!==te[0]||U[1]!==te[1]?[...C,U]:C};if(u.length&&m(u[0])){const C=u.map(U=>[Number(U[0]),Number(U[1])]).filter(m);return C.length?[_(C)]:[]}return u.length&&Array.isArray(u[0])&&m(u[0][0])?u.map(U=>Array.isArray(U)?U.map(te=>[Number(te[0]),Number(te[1])]):[]).filter(U=>U.length).map(_):u.length&&Array.isArray(u[0])&&Array.isArray(u[0][0])&&m(u[0][0][0])?u.flatMap(U=>Array.isArray(U)?U:[]).map(U=>Array.isArray(U)?U.map(te=>[Number(te[0]),Number(te[1])]):[]).filter(U=>U.length).map(_):[]}function Ye(u){const m=u.style??{},_=m.color??"#3b82f6";if(!m.colorAttr||!m.colorSet)return _;const C=Object.keys(m.colorSet);if(!C.length)return _;const U=["match",["to-string",["get",m.colorAttr]]];return C.forEach(te=>{U.push(String(te),m.colorSet?.[te]??_)}),U.push(_),U}function ze(u){if(!z)return;u.handlers.forEach(_=>{try{z.off(_.type,_.layerId,_.handler)}catch{}}),u.handlers=[],[...u.layerIds,...u.boundsIds].forEach(_=>{z.getLayer(_)&&z.removeLayer(_)}),z.getSource(u.sourceId)&&z.removeSource(u.sourceId);const m=`vs-ov-bounds-src-${u.id}`;z.getSource(m)&&z.removeSource(m),K(u.id)}function bn(u,m){if(!z)return[];const _=`vs-ov-bounds-src-${m}`,C=`vs-ov-bounds-line-${m}`,U=u.bounds??S.value??J.value,te=Ne(U);if(!te.length)return[];const X={type:"FeatureCollection",features:te.map(ie=>({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:ie}}))};return z.getSource(_)&&z.removeSource(_),z.addSource(_,{type:"geojson",data:X}),z.addLayer({id:C,type:"line",source:_,paint:{"line-color":u.style?.stroke??u.style?.color??"#2563eb","line-width":u.style?.width??2,"line-opacity":u.style?.opacity??.8,"line-dasharray":[2,2]}}),[C]}function Ie(u){if(!z)return;ze(u);const m=u.config,_=P(m);if(!_)return;const C=[],U=[];if(/\.v(?:m)?t(?:\?|$)/i.test(_)||/\.pbf(?:\?|$)/i.test(_)){const ie=m.sourceLayer||m.layer||m.service_layer||m.dataset?.layer||m.id;z.addSource(u.sourceId,{type:"vector",tiles:[_]});const _e=String(m.style?.type??"polygon").toLowerCase(),$e=Ye(m),Ce=m.style?.opacity??.5;if(_e==="point"){const Te=`vs-ov-point-${u.id}`;z.addLayer({id:Te,type:"circle",source:u.sourceId,"source-layer":ie,paint:{"circle-color":$e,"circle-radius":5,"circle-opacity":Ce}}),C.push(Te)}else if(_e==="polyline"||_e==="line"){const Te=`vs-ov-line-${u.id}`;z.addLayer({id:Te,type:"line",source:u.sourceId,"source-layer":ie,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":$e,"line-width":m.style?.width??2,"line-opacity":Ce}}),C.push(Te)}else{const Te=`vs-ov-fill-${u.id}`,Vt=`vs-ov-border-${u.id}`;z.addLayer({id:Te,type:"fill",source:u.sourceId,"source-layer":ie,paint:{"fill-color":$e,"fill-opacity":Ce}}),z.addLayer({id:Vt,type:"line",source:u.sourceId,"source-layer":ie,paint:{"line-color":m.style?.stroke??m.style?.color??"#2563eb","line-width":m.style?.width??1,"line-opacity":Ce}}),C.push(Te,Vt)}}else{z.addSource(u.sourceId,{type:"raster",tiles:[_],tileSize:256});const ie=`vs-ov-raster-${u.id}`;z.addLayer({id:ie,type:"raster",source:u.sourceId,paint:{"raster-opacity":m.style?.opacity??1}}),C.push(ie)}C.forEach(ie=>{const _e=Ce=>{if(!Ce?.features?.length){K(u.id);return}const Te=Ce.features[0]?.properties??{},Vt=he(u.config,Te);if(!Vt.length){K(u.id);return}O.value={layerId:u.id,entries:Vt,point:{x:Ce.point.x,y:Ce.point.y}}},$e=()=>K(u.id);z.on("mousemove",ie,_e),z.on("mouseleave",ie,$e),U.push({layerId:ie,type:"mousemove",handler:_e},{layerId:ie,type:"mouseleave",handler:$e})}),u.layerIds=C,u.boundsIds=bn(u.config,u.id),u.handlers=U;const X=u.visible?"visible":"none";[...u.layerIds,...u.boundsIds].forEach(ie=>{z.getLayer(ie)&&z.setLayoutProperty(ie,"visibility",X)})}function We(){if(!z)return;const m={type:"FeatureCollection",features:Ne(S.value??J.value).map(_=>({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:_}}))};z.getSource($t)?z.getSource($t).setData(m):z.addSource($t,{type:"geojson",data:m}),z.getLayer(Mt)||z.addLayer({id:Mt,type:"line",source:$t,paint:{"line-color":"#2563eb","line-width":2,"line-opacity":.8,"line-dasharray":[2,2]}})}function ot(u){if(!z||o.value)return;const m=F[u];if(!m)return;m.visible=!m.visible;const _=m.visible?"visible":"none";[...m.layerIds,...m.boundsIds].forEach(C=>{z.getLayer(C)&&z.setLayoutProperty(C,"visibility",_)}),qe(),m.visible||K(u)}function qe(){if(!z)return;const u=[],m=[],_=[],C=[];R.value.forEach(X=>{const ie=F[X];if(!ie)return;const _e=String(ie.config?.url??""),$e=/\.v(?:m)?t(?:\?|$)/i.test(_e),Ce=/\.png(?:\?|$)/i.test(_e);$e?_.push(...ie.layerIds):Ce?u.push(...ie.layerIds):m.push(...ie.layerIds),C.push(...ie.boundsIds)}),[...u,...m,..._,...C].forEach(X=>{z.getLayer(X)&&z.moveLayer(X)}),z.getLayer(Mt)&&z.moveLayer(Mt),(z.getStyle?.()?.layers??[]).map(X=>String(X?.id??"")).filter(X=>X.startsWith("gl-draw-")).forEach(X=>{z.getLayer(X)&&z.moveLayer(X)})}function qt(u){if(!Ae[u]||(q.value=u,!z))return;const m=oe();if(!m)return;const _=z.getCenter?.(),C=z.getZoom?.(),U=le?.getAll?.();z.setStyle(ue(m)),z.once("style.load",()=>{if(z&&(_&&Number.isFinite(C)&&z.jumpTo({center:[_.lng,_.lat],zoom:C}),We(),R.value.forEach(te=>{const X=F[te];X&&Ie(X)}),qe(),U?.features?.length&&le))try{U.features.forEach(te=>le.add(te)),i.value=U.features.length}catch{i.value=0}})}function rt(u){return u?u.type==="FeatureCollection"?u.features?.[0]?.geometry??null:u.type==="Feature"?u.geometry??null:u.geom?.type&&Array.isArray(u.geom.coordinates)?{type:u.geom.type,coordinates:u.geom.coordinates}:typeof u.type=="string"&&Array.isArray(u.coordinates)?u:null:null}function kt(u){return{type:"Feature",properties:{},geometry:u}}function bt(u){if(!u)return null;try{return JSON.parse(JSON.stringify(u))}catch{return null}}function wt(u){if(!u)return"__null__";try{return JSON.stringify(u)}catch{return"__invalid__"}}function Kt(u){const m=st(u);if(!m)return null;const[[_,C],[U,te]]=m;return{lat:(C+te)/2,lng:(_+U)/2}}function xt(u){if(!Array.isArray(u)||u.length<3)return 0;const m=(C,U)=>{const te=C*2003750834e-2/180,X=Math.log(Math.tan((90+U)*Math.PI/360))/(Math.PI/180);return[te,X*2003750834e-2/180]};let _=0;for(let C=0;C<u.length-1;C+=1){const[U,te]=m(Number(u[C][0]),Number(u[C][1])),[X,ie]=m(Number(u[C+1][0]),Number(u[C+1][1]));_+=U*ie-X*te}return Math.abs(_/2)/1e6}function Gt(u){if(!u?.type||!u?.coordinates)return null;if(u.type==="Polygon"){const m=u.coordinates?.[0];return Array.isArray(m)?xt(m):null}return u.type==="MultiPolygon"?u.coordinates.reduce((m,_)=>{const C=_?.[0];return Array.isArray(C)?m+xt(C):m},0):null}function Ze(u){if(!u){d.value=null;return}const m=Kt(u);if(!m){d.value=null;return}d.value={type:String(u.type??"Feature"),center:m,areaKm2:Gt(u)}}function et(u,m){if(!Array.isArray(u)||!Array.isArray(m)||u.length!==2||m.length!==2)return!1;const _=1e-9;return Math.abs(Number(u[0])-Number(m[0]))<_&&Math.abs(Number(u[1])-Number(m[1]))<_}function st(u){if(!u)return null;let m=1/0,_=1/0,C=-1/0,U=-1/0;const te=X=>{if(Array.isArray(X)){if(X.length>=2&&Number.isFinite(X[0])&&Number.isFinite(X[1])){const ie=Number(X[0]),_e=Number(X[1]);m=Math.min(m,ie),_=Math.min(_,_e),C=Math.max(C,ie),U=Math.max(U,_e);return}X.forEach(te)}};return te(u.coordinates),!Number.isFinite(m)||!Number.isFinite(_)?null:[[m,_],[C,U]]}function _t(u){if(!z||!u)return;const m=st(u);if(!m)return;const[[_,C],[U,te]]=m;if(_===U&&C===te){z.easeTo({center:[_,C],zoom:Math.max(B.value,14)});return}z.fitBounds(m,{padding:30,duration:250,maxZoom:18})}function it(){if(!le){i.value=0;return}const u=le.getAll();i.value=u?.features?.length??0}function vt(){if(!le)return;const u=le.getAll();if(i.value=u?.features?.length??0,!u?.features?.length){xe=null,d.value=null,I||(Me="__null__",a("update:modelValue",null));return}const m=bt(u.features[u.features.length-1]?.geometry??null);xe=m,Ze(m),I||(Me=wt(m),a("update:modelValue",m))}function ct(){if(!le)return;(le.getAll()?.features||[]).forEach(m=>le.delete(m.id)),it()}function Et(u){if(!le)return;const m=rt(u);if(I=!0,ct(),m)try{le.add(kt(m))}catch{}I=!1,xe=bt(m),it(),Ze(m),m&&(_t(m),o.value||$())}function wn(){if(le){if(I=!0,ct(),xe)try{le.add(kt(xe))}catch{}I=!1,it(),Ze(xe)}}function Je(){if(le){try{le.changeMode("simple_select",{featureIds:[]})}catch{}c.value=""}}function V(u){if(o.value||!le)return;j=!0,Je(),c.value=u;const m=u==="marker"?"draw_point":u==="polyline"?"draw_line_string":u==="rectangle"?"draw_rectangle":"draw_polygon";I=!0,ct(),I=!1;try{le.changeMode(m)}catch{c.value=""}finally{requestAnimationFrame(()=>{j=!1})}}function $(){if(o.value||!le)return;const u=le.getAll();if(u?.features?.length)try{le.changeMode("direct_select",{featureId:u.features[0].id}),c.value="edit"}catch{c.value=""}}function L(){o.value||!le||(Je(),ct(),Me="__null__",d.value=null,a("update:modelValue",null))}function ee(){o.value||!xe||_t(xe)}function ke(u){z&&z.easeTo({center:[u[1],u[0]],zoom:13,duration:250})}function be(){o.value||Z.value?.click()}function we(u){if(o.value||!le)return;const m=u.target,_=m.files?.[0];if(!_)return;const C=new FileReader;C.onload=()=>{try{const U=JSON.parse(String(C.result)),te=rt(U);if(!te)return;Et(te)}finally{m.value=""}},C.readAsText(_)}function ve(){if(o.value||!le)return;const u=le.getAll(),m=new Blob([JSON.stringify(u,null,2)],{type:"application/json"}),_=URL.createObjectURL(m),C=document.createElement("a");C.href=_,C.download="data.geojson",C.click(),URL.revokeObjectURL(_)}return e.onMounted(async()=>{if(!s.value)return;const u=await re();fe=u.maplibregl,ye=u.MapboxDraw;const m=oe();m&&(z=new fe.Map({container:s.value,style:ue(m),center:[M.value[0],M.value[1]],zoom:B.value,attributionControl:!1}),z.addControl(new fe.NavigationControl({showCompass:!0}),"bottom-right"),z.on("load",()=>{if(!(!ye||!z)){if(le=new ye({displayControlsDefault:!1,modes:{...ye.modes,draw_rectangle:Y()},controls:{point:!1,line_string:!1,polygon:!1,trash:!1},styles:ne}),z.addControl(le),z.on("draw.create",()=>{if(!le)return;const _=le.getAll();if(_.features.length>1){const C=_.features[_.features.length-1];I=!0,_.features.slice(0,-1).forEach(U=>le.delete(U.id)),I=!1,C&&(I=!0,le.add(C),I=!1)}vt(),$()}),z.on("draw.update",_=>{if(!D){if(_?.action==="move"){if(D=!0,wn(),D=!1,c.value==="edit"){const C=le?.getAll?.()?.features?.[0];if(C?.id)try{le.changeMode("direct_select",{featureId:C.id})}catch{c.value=""}}return}vt()}}),z.on("draw.delete",()=>{c.value==="marker"||c.value==="polyline"||c.value==="polygon"||c.value==="rectangle"||(vt(),c.value="",Je())}),z.on("draw.selectionchange",()=>{if(!(!le||D)&&c.value!=="edit"&&!(c.value==="marker"||c.value==="polyline"||c.value==="polygon"||c.value==="rectangle")){if(!o.value&&i.value>0){$();return}try{le.changeMode("simple_select",{featureIds:[]})}catch{}}}),T.value!==void 0){const _=T.value;T.value=void 0,requestAnimationFrame(()=>{le&&Et(_)})}We(),R.value.forEach(_=>{const C=F[_];C&&Ie(C)}),qe()}}),z.on("zoomend",()=>{z&&(B.value=z.getZoom())}))}),e.onUnmounted(()=>{Object.values(F).forEach(u=>{z&&ze(u)}),K(),z?.remove&&z.remove(),z=null,le=null}),e.watch(()=>n.modelValue,u=>{if(!le){T.value=u;return}const m=rt(u),_=wt(m);if(Me&&_===Me){Me=null;return}Me=null,Et(u)},{deep:!0}),e.watch(()=>b.value,u=>{const m=Array.isArray(u)?u:[],_=[],C=new Set;m.forEach((U,te)=>{if(!U)return;const X=N(U,te);_.push(X),C.add(X);const ie={...U,id:X},_e=F[X],$e=_e?.visible??!!ie.visible;_e&&z&&ze(_e),F[X]={id:X,config:ie,visible:$e,sourceId:`vs-ov-src-${X}`,layerIds:[],boundsIds:[],handlers:[]}}),Object.keys(F).forEach(U=>{if(C.has(U))return;const te=F[U];te&&z&&ze(te),delete F[U]}),R.value=_,z&&(R.value.forEach(U=>{const te=F[U];te&&Ie(te)}),qe())},{immediate:!0,deep:!0}),e.watch(()=>S.value,()=>{z&&(We(),R.value.forEach(u=>{const m=F[u];m&&Ie(m)}),qe())},{deep:!0}),e.watch(()=>w.value,async u=>{if(J.value=[],!u){z&&(We(),R.value.forEach(m=>{const _=F[m];_&&Ie(_)}),qe());return}try{const m=await fetch(`https://data.gki.com.ua/api-user/atu/${u}`);if(!m?.ok)return;const C=(await m.json())?.geometry?.coordinates;Array.isArray(C)&&C.length&&(J.value=C)}catch(m){console.error("Failed to fetch KATOTTG bounds",m)}finally{if(!z)return;We(),R.value.forEach(m=>{const _=F[m];_&&Ie(_)}),qe()}},{immediate:!0}),e.watch(()=>x.value,u=>{if(!Array.isArray(u)||u.length!==2)return;const m=[Number(u[0]),Number(u[1])];if(et(M.value,m)||(M.value=[...m],!z))return;const _=z.getCenter?.();_&&et([_.lng,_.lat],M.value)||z.easeTo({center:[M.value[0],M.value[1]]})},{deep:!0}),e.watch(()=>y.value,u=>{typeof u=="number"&&(B.value=u,z&&z.setZoom(u))}),e.watch(o,u=>{u&&Je()}),e.watch(i,u=>{if(u>0){o.value||$();return}j||Je()}),e.watch(r,()=>{setTimeout(()=>{z?.resize&&z.resize()},50)}),(u,m)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",disabled:!r.value},[e.createElementVNode("div",{class:e.normalizeClass(["vs-map-wrapper relative w-full h-[400px]",{fullscreen:r.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:s,class:"w-full h-[calc(100%-28px)]"},null,512),H.value.search||H.value.import||H.value.export?(e.openBlock(),e.createElementBlock("div",Di,[H.value.search?(e.openBlock(),e.createBlock(Mi,{key:0,onGoToCoordinates:ke})):e.createCommentVNode("",!0),H.value.import||H.value.export?(e.openBlock(),e.createElementBlock("div",Ai,[e.createElementVNode("div",Fi,[H.value.import?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:be,disabled:o.value}," Import ",8,Li)):e.createCommentVNode("",!0),H.value.export?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:ve,disabled:o.value||i.value===0}," Export ",8,Ii)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:Z,type:"file",onChange:we,accept:".json,.geojson",class:"hidden",disabled:o.value},null,40,Ti)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createElementVNode("div",Oi,[e.createElementVNode("div",zi,[H.value.point?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":c.value==="marker"}]),title:"Point",onClick:m[0]||(m[0]=_=>V("marker")),disabled:o.value},[e.createVNode(ni)],10,Ri)):e.createCommentVNode("",!0),H.value.line?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":c.value==="polyline"}]),title:"Line",onClick:m[1]||(m[1]=_=>V("polyline")),disabled:o.value},[e.createVNode(ri)],10,ji)):e.createCommentVNode("",!0),H.value.polygon?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":c.value==="polygon"}]),title:"Polygon",onClick:m[2]||(m[2]=_=>V("polygon")),disabled:o.value},[e.createVNode(di)],10,Pi)):e.createCommentVNode("",!0),H.value.rectangle?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":c.value==="rectangle"}]),title:"Rectangle",onClick:m[3]||(m[3]=_=>V("rectangle")),disabled:o.value},[e.createVNode(fi)],10,Ui)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:m[4]||(m[4]=_=>r.value=!r.value),title:"Full Screen"},[e.createVNode(ki,{style:{width:"12px",height:"12px"}})])])]),A.value.length?(e.openBlock(),e.createElementBlock("div",{key:1,class:"absolute z-[1500] pointer-events-none",style:e.normalizeStyle(W.value)},[e.createElementVNode("div",Hi,[e.createElementVNode("dl",qi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(A.value,_=>(e.openBlock(),e.createElementBlock("div",{key:`${_.key}-${_.value}`,class:"flex justify-between gap-2"},[e.createElementVNode("dt",Ki,e.toDisplayString(_.key),1),e.createElementVNode("dd",Gi,e.toDisplayString(_.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",Yi,[e.createElementVNode("div",Wi,[e.createVNode(vi,{basemaps:e.unref(Ae),onOnLayerChange:qt},null,8,["basemaps"]),G.value.length?(e.openBlock(),e.createElementBlock("div",Zi,[m[5]||(m[5]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),e.createElementVNode("div",Ji,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(G.value,_=>(e.openBlock(),e.createElementBlock("label",{key:_.id,class:"flex items-center gap-2 cursor-pointer select-none"},[e.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:_.visible,disabled:o.value,onChange:C=>ot(_.id)},null,40,Xi),e.createElementVNode("span",Qi,e.toDisplayString(_.config.title||_.config.name||_.id),1)]))),128))])])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",ec,[d.value?(e.openBlock(),e.createElementBlock("div",tc,[e.createElementVNode("div",nc,[e.createElementVNode("div",lc,[m[6]||(m[6]=e.createTextVNode(" Type: ",-1)),e.createElementVNode("span",ac,e.toDisplayString(d.value.type),1)])]),e.createElementVNode("div",oc,[e.createElementVNode("div",rc,[m[7]||(m[7]=e.createTextVNode(" Center: ",-1)),e.createElementVNode("b",null,e.toDisplayString(d.value.center.lat.toFixed(5))+", "+e.toDisplayString(d.value.center.lng.toFixed(5)),1)]),d.value.areaKm2!==null?(e.openBlock(),e.createElementBlock("div",sc,[m[8]||(m[8]=e.createTextVNode(" Area: ",-1)),e.createElementVNode("b",null,e.toDisplayString(d.value.areaKm2.toFixed(1))+" km²",1)])):(e.openBlock(),e.createElementBlock("div",ic,[...m[9]||(m[9]=[e.createTextVNode("Area: ",-1),e.createElementVNode("b",null,"—",-1)])])),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:ee,disabled:o.value},[...m[10]||(m[10]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"w-3 h-3"},[e.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),e.createElementVNode("path",{d:"M7 10l6 0"}),e.createElementVNode("path",{d:"M10 7l0 6"}),e.createElementVNode("path",{d:"M21 21l-6 -6"})],-1)])],8,cc),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Delete feature",onClick:L,disabled:o.value},[e.createVNode(nt,{class:"w-3 h-3"})],8,dc)])])):e.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-e66e6e67"]]),uc=["data-focus"],pc={class:"flex items-center"},mc={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},fc=["onClick","aria-label"],hc={key:0,class:"absolute text-gray-500 truncate pl-2"},gc={class:"flex-1 min-w-[2px]"},yc=["placeholder"],kc={class:"flex items-center shrink-0"},bc=["disabled"],In=e.defineComponent({__name:"vs-input-tag",props:e.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=t;Se(n.style);const o=e.ref(null),r=e.ref(null),s=e.ref(null),i=e.ref(!1),c=e.ref(""),d=e.useModel(l,"modelValue"),p=e.computed(()=>n.placeholder||"Add tag…"),h=e.computed(()=>d.value?.length===0&&c.value===""),E=e.computed(()=>!n.disabled&&d.value?.length>0),k=e.computed(()=>n.disabled),v=async()=>{k.value||await e.nextTick(()=>s.value?.focus())},f=M=>{const B=M.trim();B!==""&&(!d.value||!Array.isArray(d.value)?d.value=[B]:n.unique?d.value.includes(B)||(d.value=[...d.value,B]):d.value=[...d.value,B],c.value="")},g=()=>{const M=c.value;M.trim()!==""&&f(M),c.value=""},x=M=>{const B=d.value.slice();B.splice(M,1),a("update:modelValue",B)},y=()=>{a("update:modelValue",[])},w=()=>{k.value||(i.value=!0)},b=()=>{i.value=!1,!k.value&&g()},S=M=>{const{key:B}=M;B==="Enter"?(M.preventDefault(),g()):B==="Backspace"&&c.value===""&&d.value.length>0&&x(d.value.length-1)};return(M,B)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:B[1]||(B[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass]),role:"group","aria-label":"Tag input"},[e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",i.value?"border-blue-500 ring-1 ring-blue-500":"",k.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:v},[e.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:r},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(T,Z)=>(e.openBlock(),e.createElementBlock("div",{key:Z,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",pc,[e.createElementVNode("div",mc,e.toDisplayString(T),1)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:e.withModifiers(J=>x(Z),["stop"]),"aria-label":`Remove ${T}`},[...B[2]||(B[2]=[e.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)])],8,fc)]))),128)),h.value?(e.openBlock(),e.createElementBlock("div",hc,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",gc,[k.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:s,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":B[0]||(B[0]=T=>c.value=T),onFocus:w,onBlur:b,onKeydown:S,placeholder:d.value&&d.value.length?"":void 0},null,40,yc)),[[e.vModelText,c.value]])])],512),e.createElementVNode("div",kc,[E.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:k.value,onClick:e.withModifiers(y,["stop"])},[...B[3]||(B[3]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)])],8,bc)):e.createCommentVNode("",!0)])],10,uc)],2)],512))}}),wc={class:"relative flex gap-1 bg-white w-full"},xc=["disabled","placeholder"],Tn=ae(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=e.inject("values"),n=l,a=e.useModel(l,"modelValue");function o(s){const i={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ы:"y",э:"e",ю:"yu",я:"ya",ь:"",ъ:"",є:"ye",і:"i",ї:"yi",ґ:"g"};return s.toLowerCase().split("").map(c=>i[c]||c).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const r=()=>{const s=t?.value?.[n.parent||""]?.toString(),i=o(s);a.value=i.toString()};return(s,i)=>(e.openBlock(),e.createElementBlock("div",wc,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:l.disabled,placeholder:l.placeholder,"onUpdate:modelValue":i[0]||(i[0]=c=>a.value=c),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,xc),[[e.vModelText,a.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:r}," Gen ")]))}}),[["__scopeId","data-v-cb7b2b74"]]),_c={class:"relative flex gap-1 bg-white w-full"},vc=["disabled","placeholder"],Ec=["disabled"],Vc={key:0},Bc={key:1},On=ae(e.defineComponent({__name:"vs-input-codegen",props:e.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref(!1),o=e.computed(()=>t.init!==!1),r=e.computed(()=>!!t.table&&!!t.code),s=()=>{if(!r.value)return"";const d=encodeURIComponent(String(t.table)),p=encodeURIComponent(String(t.code));return`/api/code-gen/${d}/${p}`},i=async()=>{if(!r.value||a.value)return;const d=s();if(d){a.value=!0;try{const h=await(await fetch(d)).text();n.value=h}finally{a.value=!1}}},c=()=>{o.value&&(n.value||i())};return e.onMounted(()=>{c()}),e.watch(()=>[t.table,t.code,t.init],()=>{c()}),(d,p)=>(e.openBlock(),e.createElementBlock("div",_c,[e.withDirectives(e.createElementVNode("input",{disabled:l.disabled,placeholder:l.placeholder,"onUpdate:modelValue":p[0]||(p[0]=h=>n.value=h),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,vc),[[e.vModelText,n.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:a.value||l.disabled||!r.value,onClick:i},[a.value?(e.openBlock(),e.createElementBlock("span",Bc,"...")):(e.openBlock(),e.createElementBlock("span",Vc,"Gen"))],8,Ec)]))}}),[["__scopeId","data-v-8f88fb66"]]),Cc={class:"w-full"},Sc={ref:"sortableContainer",class:"flex flex-col gap-1"},Nc=["onDragstart","onDrop"],$c={class:"w-1/3"},Mc={class:"w-2/3"},Dc=["onClick"],Ac={key:0,class:"text-[14px] text-gray-700"},Fc={class:"mt-2 w-full flex items-center"},Lc=["disabled"],zn=ae(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=g=>`${g}-${Math.random().toString(36).substring(2,15)}`,a=e.inject("values"),o=l,r=t,s=o.addButtonText??"Додати",i=o.ignore??[],c=e.ref([]),d=e.ref(null);(()=>{const g=o.parent&&a?.value?.[o.parent]||o.modelValue||{};c.value=Object.entries(g).filter(([x])=>!i.includes(x)).map(([x,y])=>({id:n("key-value-"),key:x,value:y}))})();function h(g){d.value=g}function E(g){if(d.value===null||d.value===g)return;const x=c.value.splice(d.value,1)[0];c.value.splice(g,0,x),d.value=null}const k=e.computed(()=>c.value.some(g=>g.key&&!g.value||!g.key&&g.value)),v=()=>{c.value.push({id:n("key-value-"),key:"",value:""})},f=g=>{c.value=c.value.filter(x=>x.id!==g)};return e.watch(c,g=>{const x={};g.forEach(w=>{w.key&&w.value!==void 0&&(x[w.key]=w.value)});const y={};i.length&&i.forEach(w=>{y[w]=o.parent?a?.value?.[o.parent]?.[w]:void 0}),a?.value&&o.parent&&(a.value[o.parent]={...y,...x}),r("update:modelValue",x)},{deep:!0}),(g,x)=>(e.openBlock(),e.createElementBlock("div",Cc,[e.createElementVNode("div",Sc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(y,w)=>(e.openBlock(),e.createElementBlock("div",{key:y.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===w}]),draggable:"true",onDragstart:b=>h(w),onDragover:x[0]||(x[0]=e.withModifiers(()=>{},["prevent"])),onDrop:b=>E(w)},[x[1]||(x[1]=e.createStaticVNode('<button class="cursor-move" data-v-2ae5f16f><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-2ae5f16f><circle cx="15" cy="12" r="1.5" data-v-2ae5f16f></circle><circle cx="15" cy="24" r="1.5" data-v-2ae5f16f></circle><circle cx="21" cy="12" r="1.5" data-v-2ae5f16f></circle><circle cx="21" cy="24" r="1.5" data-v-2ae5f16f></circle><circle cx="21" cy="18" r="1.5" data-v-2ae5f16f></circle><circle cx="15" cy="18" r="1.5" data-v-2ae5f16f></circle></svg></button>',1)),e.createElementVNode("div",$c,[e.createVNode(tt,{modelValue:y.key,"onUpdate:modelValue":b=>y.key=b,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Mc,[e.createVNode(tt,{modelValue:y.value,"onUpdate:modelValue":b=>y.value=b,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:b=>f(y.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[e.createVNode(e.unref(Bt),{height:"16",width:"16"})],8,Dc)],42,Nc))),128))],512),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Ac," Дані для відображення відсутні ")),e.createElementVNode("div",Fc,[e.createElementVNode("button",{type:"button",onClick:v,disabled:k.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(Re,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(s)),1)],8,Lc)])]))}}),[["__scopeId","data-v-2ae5f16f"]]),Ic={class:"w-full"},Tc={ref:"sortableContainer",class:"flex flex-col gap-1"},Oc=["onDragstart","onDrop"],zc=["disabled"],Rc={class:"flex-1"},jc=["onClick","disabled"],Pc={key:0,class:"text-[14px] text-gray-700"},Uc={class:"mt-2 w-full flex items-center"},Hc=["disabled"],Rn=ae(e.defineComponent({__name:"vs-input-text-array",props:e.mergeModels({addButtonText:{default:"Додати"},inputType:{default:"text"},placeholder:{default:"Значення"},mask:{default:""},disabled:{type:Boolean,default:!1}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.ref(null),r=e.computed(()=>!!t.disabled),s=e.computed(()=>t.placeholder??""),i=e.computed(()=>t.addButtonText??"Додати");let c=!1;const d=g=>`${g}-${Math.random().toString(36).substring(2,15)}`,p=g=>{const x=g??n.value??[];a.value=x.map((y,w)=>({id:a.value[w]?.id??d("text-array"),value:y??""}))};p(),e.watch(()=>n.value,g=>{if(c){c=!1;return}p(g||[])},{deep:!0}),e.watch(a,g=>{c=!0,n.value=g.map(x=>x.value).filter(x=>x!=null&&x!=="")},{deep:!0});const h=e.computed(()=>r.value||a.value.some(g=>!g.value));function E(){h.value||(a.value=[...a.value,{id:d("text-array"),value:""}])}function k(g){r.value||(a.value=a.value.filter(x=>x.id!==g))}function v(g){r.value||(o.value=g)}function f(g){if(r.value||o.value===null||o.value===g)return;const x=[...a.value],[y]=x.splice(o.value,1);x.splice(g,0,y),a.value=x,o.value=null}return(g,x)=>(e.openBlock(),e.createElementBlock("div",Ic,[e.createElementVNode("div",Tc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(y,w)=>(e.openBlock(),e.createElementBlock("div",{key:y.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":o.value===w}]),draggable:"true",onDragstart:b=>v(w),onDragover:x[0]||(x[0]=e.withModifiers(()=>{},["prevent"])),onDrop:b=>f(w)},[e.createElementVNode("button",{class:"cursor-move",type:"button",disabled:r.value},[...x[1]||(x[1]=[e.createStaticVNode('<svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-77ce3498><circle cx="15" cy="12" r="1.5" data-v-77ce3498></circle><circle cx="15" cy="24" r="1.5" data-v-77ce3498></circle><circle cx="21" cy="12" r="1.5" data-v-77ce3498></circle><circle cx="21" cy="24" r="1.5" data-v-77ce3498></circle><circle cx="21" cy="18" r="1.5" data-v-77ce3498></circle><circle cx="15" cy="18" r="1.5" data-v-77ce3498></circle></svg>',1)])],8,zc),e.createElementVNode("div",Rc,[l.inputType==="text"?(e.openBlock(),e.createBlock(tt,{key:0,modelValue:y.value,"onUpdate:modelValue":b=>y.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),l.inputType==="tel"?(e.openBlock(),e.createBlock(en,{key:1,modelValue:y.value,"onUpdate:modelValue":b=>y.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),l.inputType==="email"?(e.openBlock(),e.createBlock(Qt,{key:2,modelValue:y.value,"onUpdate:modelValue":b=>y.value=b,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),l.inputType==="mask"?(e.openBlock(),e.createBlock(Xt,{key:3,modelValue:y.value,"onUpdate:modelValue":b=>y.value=b,mask:l.mask,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","mask","disabled","placeholder"])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:b=>k(y.id),disabled:r.value,class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200 disabled:opacity-50"},[e.createVNode(e.unref(Bt),{height:"16",width:"16"})],8,jc)],42,Oc))),128))],512),a.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Pc," Дані для відображення відсутні ")),e.createElementVNode("div",Uc,[e.createElementVNode("button",{type:"button",onClick:E,disabled:h.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(Re,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(i.value),1)],8,Hc)])]))}}),[["__scopeId","data-v-77ce3498"]]),qc={class:"flex items-center gap-2 w-full"},Kc=["disabled"],Gc=["disabled"],jn=e.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,{inputClass:a}=Se(n.style),o=t,r=e.computed({get:()=>n.modelValue||"#000000",set:i=>o("update:modelValue",i)}),s=e.computed(()=>!!n.disabled);return(i,c)=>(e.openBlock(),e.createElementBlock("div",qc,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),disabled:s.value,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[l.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Kc),[[e.vModelText,r.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":c[1]||(c[1]=d=>r.value=d),disabled:s.value},null,8,Gc),[[e.vModelText,r.value]])]))}}),Yc={class:"flex items-center gap-2 w-full"},Wc=["min","max","step","disabled"],Zc=["disabled"],Pn=e.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,{inputClass:a}=Se(n.style),o=t,r=e.computed({get:()=>Number(n.modelValue??n.min),set:i=>o("update:modelValue",Number(i))}),s=e.computed(()=>!!n.disabled);return(i,c)=>(e.openBlock(),e.createElementBlock("div",Yc,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),min:l.min,max:l.max,step:l.step,disabled:s.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[l.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")])},null,10,Wc),[[e.vModelText,r.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":c[1]||(c[1]=d=>r.value=d),disabled:s.value},null,8,Zc),[[e.vModelText,r.value]])]))}}),Jc=["placeholder","disabled","name"],Xc=["type","value","onInput","placeholder","disabled"],Qc=["onClick"],Un=e.defineComponent({__name:"vs-input-array",props:e.mergeModels({count:{default:1},limit:{default:1},mask:{default:""},unmask:{type:Boolean,default:!1},inputType:{default:"text"},isAdded:{type:Boolean,default:!1},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.ref(t.count),a=e.computed(()=>t.limit),{inputClass:o}=Se(t.style),r=e.useModel(l,"modelValue"),s=e.computed(()=>!!t.disabled),i=e.computed(()=>t.placeholder??"");e.watchEffect(()=>{const f=r.value?.length??0;f<n.value&&(r.value=[...r.value??[],...Array(n.value-f)])});const c=e.ref({}),d=e.ref({});function p(f,g){f&&(c.value[g]=f)}async function h(f,g){if(!f||t.inputType!=="mask")return;const{default:x}=await Promise.resolve().then(()=>kn);d.value[g]&&d.value[g].destroy(),d.value[g]=x(f,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),d.value[g].on("accept",()=>{const y=[...r.value||[]];y[g]=t.unmask?d.value[g].unmaskedValue:d.value[g].value,r.value=y}),d.value[g].on("complete",()=>{const y=[...r.value||[]];y[g]=t.unmask?d.value[g].unmaskedValue:d.value[g].value,r.value=y}),r.value?.[g]&&(d.value[g].value=r.value[g])}function E(f,g){if(s.value)return;const x=f.target.value??null,y=[...r.value];y[g]=t.inputType==="text"?x:Number(x),r.value=y}function k(){n.value+=1;const f=t.inputType==="text"||t.inputType==="mask"?null:0;r.value=[...r.value,f],t.inputType==="mask"&&setTimeout(()=>{const g=n.value-1;c.value[g]&&h(c.value[g],g)},0)}function v(f){if(n.value>1){d.value[f]&&(d.value[f].destroy(),delete d.value[f]),n.value-=1,r.value=r.value.filter((x,y)=>y!==f);const g={};Object.keys(d.value).forEach(x=>{const y=parseInt(x,10);y>f?g[y-1]=d.value[y]:y<f&&(g[y]=d.value[y])}),d.value=g}}return e.onMounted(()=>{if(t.inputType==="mask")for(let f=0;f<n.value;f+=1)c.value[f]&&h(c.value[f],f)}),e.onBeforeUnmount(()=>{Object.values(d.value).forEach(f=>{f&&f.destroy()})}),e.watch(()=>t.mask,f=>{t.inputType==="mask"&&Object.values(d.value).forEach(g=>{g&&g.updateOptions({mask:f,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})})}),e.watch(r,f=>{t.inputType==="mask"&&f&&f.forEach((g,x)=>{d.value[x]&&d.value[x].value!==g&&(d.value[x].value=g||"")})},{deep:!0}),(f,g)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["grid gap-2",`grid-cols-${a.value}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,x=>(e.openBlock(),e.createElementBlock("div",{key:x,class:"flex items-center gap-2 w-full"},[l.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:y=>p(y,x-1),placeholder:l.placeholder,disabled:l.disabled,name:`${l.name}[${x-1}]`,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Jc)):(e.openBlock(),e.createElementBlock("input",{key:1,type:l.inputType,value:r.value?.[x-1],onInput:y=>E(y,x-1),placeholder:i.value,disabled:s.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Xc)),!l.disabled&&x===n.value&&l.isAdded?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:e.withModifiers(k,["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-green-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(Re,{height:"18",width:"18"})])):e.createCommentVNode("",!0),!l.disabled&&n.value>1&&l.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(y=>v(x-1),["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-red-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(Bt,{height:"18",width:"18"})],8,Qc)):e.createCommentVNode("",!0)]))),128))],2))}}),ed=["aria-expanded","data-focus"],td=["placeholder","disabled","readonly"],nd={class:"max-h-full"},ld=["onClick","disabled"],ad={key:0,class:"px-3 py-2 text-sm text-stone-500"},od={class:"flex flex-col gap-1"},rd=["onDragstart","onDrop"],sd=["disabled"],id=["title"],cd=["disabled","onClick","aria-label"],dd={key:0,class:"text-xs text-stone-500"},Dt=ae(e.defineComponent({__name:"vs-input-array-select",props:e.mergeModels({options:{default:()=>[]},data:{default:""},api:{default:""},prefix:{default:"api"},host:{default:""},parent:{},search:{type:Boolean,default:!0},maxHeight:{default:280},start:{default:0},slot:{},disabled:{type:Boolean,default:!1},style:{},customClass:{},modelValue:{},error:{},name:{},placeholder:{default:"Оберіть значення"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["change","update:modelValue","value-selected"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=t,o=e.useModel(l,"modelValue"),r=e.ref([]),s=e.ref(n.options??[]),i=e.ref({}),c=e.ref({}),d=e.ref({keyword:"",parent:null}),p=e.ref(""),h=e.ref(!1),E=e.ref(null),k=e.ref(null),v=e.ref(null);let f=!1,g=!1;const x=e.inject("values"),y=e.computed(()=>!!n.disabled),w=e.computed(()=>n.placeholder??"Оберіть значення"),b=e.computed(()=>n.search!==!1),S=e.computed(()=>`${n.maxHeight??280}px`),M=e.computed(()=>{const N=n.parent??n.parentValue;return N?String(N):""}),B=e.computed(()=>M.value?x?.value?.[M.value]??null:null),T=N=>N==null?"__null__":String(N),Z=N=>{if(!N)return"";const P=N.label??N.text??N.name??N.ua??N.en;return P?String(P):N.id!==void 0&&N.id!==null?String(N.id):""},J=N=>{const P=T(N);return c.value[P]||(c.value[P]=`array-select-${P}-${Math.random().toString(36).slice(2,8)}`),c.value[P]},I=e.computed(()=>new Set(r.value.map(N=>T(N.id)))),F=e.computed(()=>{const N=I.value;let P=[...s.value];if(!n.data&&p.value.trim()){const K=p.value.toLowerCase();P=P.filter(he=>Z(he).toLowerCase().includes(K))}return P.filter(K=>!N.has(T(K.id)))}),R=()=>{if(!n.data)return"";const N=n.prefix??"api",P=n.api??`/${N}/suggest/${n.data}`;return`${n.host??""}${P}`},G=()=>{r.value.length&&(f=!0,r.value=r.value.map(N=>({...N,text:i.value[T(N.id)]??N.text})))},O=N=>{const P=T(N.id),K=Z(N);K&&(i.value[P]=K)},A=N=>{s.value=N?[...N]:[],N?.forEach(O),G()},W=N=>{if(!N.length)return;const P=new Map(s.value.map(K=>[T(K.id),K]));N.forEach(K=>{const he=T(K.id);P.set(he,K),O(K)}),s.value=Array.from(P.values()),G()},H=async(N="")=>{if(!n.data)return[];const P=R();if(!P)return[];const K=new URLSearchParams;K.set("json","1"),N&&K.set("key",N),n.start===1&&K.set("start","1"),B.value!==null&&B.value!==void 0&&B.value!==""&&K.set("parent",String(B.value));try{return(await(await fetch(`${P}?${K.toString()}`)).json())?.data??[]}catch{return[]}},pe=async N=>{if(!n.data||!N.length)return[];const P=R();if(!P)return[];const K=Array.from(new Set(N.map(Ne=>T(Ne)))),he=new URLSearchParams;he.set("json","1"),he.set("val",K.join(",")),n.start===1&&he.set("start","1"),B.value!==null&&B.value!==void 0&&B.value!==""&&he.set("parent",String(B.value));try{const ze=(await(await fetch(`${P}?${he.toString()}`)).json())?.data??[];return W(ze),ze}catch{return[]}},me=async(N="",{force:P=!1}={})=>{if(!n.data)return;const K=B.value??null;if(!P&&d.value.keyword===N&&d.value.parent===K&&s.value.length>0)return;d.value={keyword:N,parent:K};const Ne=await H(N);A(Ne)},Le=((N,P=200)=>{let K;return(...he)=>{K&&clearTimeout(K),K=setTimeout(()=>N(...he),P)}})(async N=>{n.data&&await me(N,{force:!0})},250),q=e.ref(null),re=async(N="click")=>{y.value||h.value||(q.value=N,await me(p.value.trim()),h.value=!0,await e.nextTick(),v.value?.focus())},ue=()=>{h.value=!1,q.value=null,e.nextTick(()=>{v.value?.blur()})},fe=async N=>{if(N.stopPropagation(),!y.value){if(h.value){if(q.value==="focus"){q.value=null;return}ue();return}await re("click")}},ye=N=>{N.key==="Escape"&&ue()},z=N=>{const P=N.target;k.value?.contains(P)||ue()},le=N=>{if(N.key==="Escape"){N.preventDefault(),ue();return}if(N.key==="Enter"){N.preventDefault();const P=F.value[0];P&&xe(P)}},xe=N=>{if(!N)return;const P=T(N.id);if(I.value.has(P))return;O(N);const K={id:N.id,text:Z(N)||String(N.id??""),key:J(N.id)};r.value=[...r.value,K],Me(N),p.value="",e.nextTick(()=>{v.value?.focus()})},Me=N=>{const P=r.value.map(K=>K.id);a("value-selected",{name:n.name,value:P,option:N})},D=N=>{if(y.value)return;const P=r.value.filter(K=>T(K.id)!==T(N));r.value=P},j=N=>{y.value||(E.value=N)},Y=N=>{if(y.value||E.value===null||E.value===N)return;const P=[...r.value],[K]=P.splice(E.value,1);P.splice(N,0,K),E.value=null,r.value=P},ne=async()=>{const P=(Array.isArray(o.value)?[...o.value]:[]).filter(he=>he!=null);if(n.data&&P.length){const he=P.filter(Ne=>!i.value[T(Ne)]);he.length&&await pe(he)}const K=P.map(he=>({id:he,text:i.value[T(he)]??String(he),key:J(he)}));f=!0,r.value=K};e.watch(r,N=>{if(f){f=!1;return}const P=N.map(K=>K.id);g=!0,o.value=P,a("change",P)},{deep:!0}),e.watch(o,()=>{if(g){g=!1;return}ne()},{deep:!0}),e.watch(p,N=>{!n.data||!h.value||Le(N.trim())}),e.watch(y,N=>{N&&ue()}),e.watch(()=>n.options,async N=>{n.data||(A(N??[]),await ne())},{immediate:!0,deep:!0}),e.watch(()=>n.data,async N=>{N&&(await me(p.value.trim()),await ne())},{immediate:!0});const oe=e.ref(!1);return e.watch(B,async()=>{if(n.data){if(!oe.value){oe.value=!0;return}r.value=[],await me(p.value.trim()),await ne()}}),e.onMounted(async()=>{document.addEventListener("click",z,!0),window.addEventListener("keydown",ye),await ne()}),e.onUnmounted(()=>{document.removeEventListener("click",z,!0),window.removeEventListener("keydown",ye)}),(N,P)=>(e.openBlock(),e.createElementBlock("div",{class:"flex flex-col gap-2 w-full",ref_key:"rootRef",ref:k},[e.createElementVNode("div",{class:"relative",onClick:P[2]||(P[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white px-3","border-gray-300 hover:border-[#b3d4ff]",h.value?"border-[#2684ff] ring-1 ring-[#2684ff] shadow-[0_0_0_1px_rgba(38,132,255,0.5)]":"",y.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":h.value,"aria-haspopup":"listbox","data-focus":h.value?"true":"false",onClick:fe},[e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:v,"onUpdate:modelValue":P[0]||(P[0]=K=>p.value=K),placeholder:w.value,disabled:y.value,readonly:!b.value,onFocus:P[1]||(P[1]=()=>re("focus")),onKeydown:le,class:"flex-1 bg-transparent border-0 outline-none px-0 py-1 text-sm text-stone-900 placeholder:text-stone-400"},null,40,td),[[e.vModelText,p.value]]),e.createElementVNode("span",{class:e.normalizeClass(["text-stone-400 transition-transform duration-150",h.value?"rotate-180":""]),"aria-hidden":"true"},[e.createVNode(Wt,{width:"16",height:"16"})],2)],10,ed),e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[h.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"absolute left-0 right-0 z-10 mt-1 rounded-md border border-stone-200 bg-white shadow-lg overflow-auto",style:e.normalizeStyle({maxHeight:S.value})},[e.createElementVNode("div",nd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(F.value,K=>(e.openBlock(),e.createElementBlock("button",{key:T(K.id),type:"button",class:"w-full px-3 py-2 text-left text-sm text-stone-900 hover:bg-stone-100 disabled:opacity-50",onClick:e.withModifiers(he=>xe(K),["stop"]),disabled:y.value},e.toDisplayString(Z(K)),9,ld))),128)),F.value.length===0?(e.openBlock(),e.createElementBlock("p",ad," Немає варіантів ")):e.createCommentVNode("",!0)])],4)):e.createCommentVNode("",!0)]),_:1})]),e.createElementVNode("div",od,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(K,he)=>(e.openBlock(),e.createElementBlock("div",{key:K.key,class:e.normalizeClass(["flex items-center gap-2 rounded-md border border-stone-200 bg-white px-2 py-2",{"opacity-60":E.value===he}]),draggable:"true",onDragstart:Ne=>j(he),onDragover:P[3]||(P[3]=e.withModifiers(()=>{},["prevent"])),onDrop:Ne=>Y(he),onDragend:P[4]||(P[4]=Ne=>E.value=null)},[e.createElementVNode("button",{type:"button",class:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-stone-500 hover:text-stone-900",disabled:y.value,"aria-label":"Перетягнути"},[e.createVNode(St,{width:"14",height:"14"})],8,sd),e.createElementVNode("div",{class:"flex-1 text-sm text-stone-900",title:K.text},e.toDisplayString(K.text),9,id),e.createElementVNode("button",{type:"button",class:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-stone-400 hover:text-stone-900",disabled:y.value,onClick:e.withModifiers(Ne=>D(K.id),["stop"]),"aria-label":`Видалити ${K.text}`},[e.createVNode(Bt,{width:"14",height:"14"})],8,cd)],42,rd))),128)),r.value.length===0?(e.openBlock(),e.createElementBlock("p",dd,"Немає вибраних значень")):e.createCommentVNode("",!0)])],512))}}),[["__scopeId","data-v-cffead85"]]),ud={class:"flex items-center gap-2 w-full"},pd={class:"relative flex-1"},md=["placeholder","disabled","onKeydown"],fd=["disabled"],hd={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},gd={key:1,class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},yd={key:0,class:"fixed inset-0 z-[1000] flex items-center justify-center bg-black/50"},kd={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},bd={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},wd=["onClick"],xd={key:0,class:"p-4 text-sm text-gray-500"},Hn=e.defineComponent({__name:"vs-input-address",props:e.mergeModels({api:{default:""},geom:{default:""},includes:{default:()=>[]},bbox:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(l,{emit:t}){const n=/{{\s*([^}]+?)\s*}}/g,a=l,o=t,{inputClass:r}=Se(a.style),s=e.useModel(l,"modelValue"),i=e.computed({get:()=>s.value,set:B=>{s.value=B}}),c=e.ref(!1),d=e.ref([]),p=e.ref(!1),h=e.ref(null);e.watch(p,B=>{typeof document>"u"||(B?(h.value=document.body.style.overflow,document.body.style.overflow="hidden"):h.value!=null?(document.body.style.overflow=h.value,h.value=null):document.body.style.removeProperty("overflow"))}),e.onBeforeUnmount(()=>{typeof document>"u"||(h.value!=null?document.body.style.overflow=h.value:document.body.style.removeProperty("overflow"))});const E=e.computed(()=>a.placeholder??""),k=e.computed(()=>!!a.disabled),v=B=>{if(!B)return null;if(Array.isArray(B))return B;if(typeof B=="string"){const T=B.split(",").map(Z=>Z.trim()).filter(Boolean);return T.length!==4?null:T.map(Number)}return null},f=e.computed(()=>{const B=v(a.bbox);if(!B||B.length!==4)return null;const T=B.map(Number);return T.some(Z=>Number.isNaN(Z))?null:T}),g=e.computed(()=>{const B=f.value;if(!B)return"";const[T,Z,J,I]=B;return`${T},${Math.max(Z,I)},${J},${Math.min(Z,I)}`});e.computed(()=>g.value?"1":"0");const x=e.inject("values");function y(){!k.value&&i.value.trim()&&w()}async function w(){const B=(i.value||"").trim();if(!B)return;let T=B;if(a.includes?.length&&x?.value){const J=a.includes.map(I=>x.value?.[I]).filter(Boolean);J.length&&(T=`${J.join(", ")}, ${B}`)}const Z=M(T);if(Z){c.value=!0;try{const I=await(await fetch(Z)).json();d.value=Array.isArray(I)?I:[],p.value=!0}catch(J){console.error("Address search error:",J)}finally{c.value=!1}}}function b(){p.value=!p.value}function S(B){if(!B)return;p.value=!1;const T=parseFloat(B.lat),J={type:"Point",coordinates:[parseFloat(B.lon),T]};a.geom&&x?.value&&(x.value[a.geom]=J),o("update:geom",J)}function M(B){if(!a.api)return"";const T={value:encodeURIComponent(B),bbox:f.value?f.value.join(","):""};return a.api.replace(n,(Z,J)=>T[J.trim()]??"")}return(B,T)=>(e.openBlock(),e.createElementBlock("div",ud,[e.createElementVNode("div",pd,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":T[0]||(T[0]=Z=>i.value=Z),placeholder:E.value,disabled:k.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[e.unref(r),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:e.withKeys(e.withModifiers(y,["prevent"]),["enter"])},null,42,md),[[e.vModelText,i.value]]),d.value.length?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:b,title:"Show search results"},[...T[2]||(T[2]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),e.createElementVNode("path",{d:"M12 16v-4"}),e.createElementVNode("path",{d:"M12 8h.01"})],-1)])])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:w,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:c.value||!i.value?.trim()},[c.value?(e.openBlock(),e.createElementBlock("svg",gd,[...T[4]||(T[4]=[e.createElementVNode("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e.createElementVNode("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)])])):(e.openBlock(),e.createElementBlock("svg",hd,[...T[3]||(T[3]=[e.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),e.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},null,-1)])]))],8,fd),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[p.value?(e.openBlock(),e.createElementBlock("div",yd,[e.createElementVNode("div",kd,[e.createElementVNode("div",bd,[T[6]||(T[6]=e.createElementVNode("span",null,"Search results",-1)),e.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:T[1]||(T[1]=Z=>p.value=!1),title:"Close"},[...T[5]||(T[5]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)])])]),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(Z,J)=>(e.openBlock(),e.createElementBlock("li",{key:J,onClick:I=>S(Z),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString(Z.display_name),9,wd))),128))]),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",xd," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),qn=(l="")=>`${l}${Math.floor(Math.random()*1e4)}`,_d={class:"vs-datalist space-y-3"},vd={class:"space-y-3"},Ed=["onClick","disabled"],Vd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Bd=["disabled"],Cd=ae(e.defineComponent({__name:"vs-input-datalist",props:e.mergeModels({schema:{default:()=>[]},minItems:{default:0},maxItems:{default:void 0},addButtonText:{default:"Додати позицію"},emptyLabel:{default:"Немає рядків"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>Array.isArray(n.value)?n.value:[]),o=e.ref([]),r=e.computed(()=>t.schema?.map(f=>({...f,disabled:t.disabled||f.disabled}))??[]),s=e.computed(()=>r.value.map(f=>v(f))),i=e.computed(()=>t.disabled?!1:t.maxItems?a.value.length<t.maxItems:!0),c=e.computed(()=>t.disabled||a.value.length<=(t.minItems||0));e.watch(()=>a.value.length,()=>{d(),p()},{immediate:!0}),e.watch(()=>t.schema,p,{immediate:!0,deep:!0});function d(){const f=a.value.length;o.value.length<f?o.value=[...o.value,...Array.from({length:f-o.value.length},()=>qn())]:o.value.length>f&&o.value.splice(f)}function p(){if(!t.minItems||a.value.length>=t.minItems)return;const f=t.minItems-a.value.length,g=Array.from({length:f},h);n.value=[...a.value,...g]}function h(){const f={};return r.value.forEach(g=>{f[g.name]=g?.default??null}),f}function E(){i.value&&(n.value=[...a.value,h()],d())}function k(f){c.value||(n.value=a.value.filter((g,x)=>x!==f),d(),p())}function v(f){return{...f}}return(f,g)=>(e.openBlock(),e.createElementBlock("div",_d,[e.createElementVNode("div",vd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(x,y)=>(e.openBlock(),e.createElementBlock("div",{key:o.value[y],class:"flex items-center gap-3"},[e.createVNode(He,{schema:s.value,layout:"inline",navigation:!1,values:a.value[y],"onUpdate:values":w=>a.value[y]=w,"form-id":o.value[y]},null,8,["schema","values","onUpdate:values","form-id"]),e.createElementVNode("button",{type:"button",class:"h-[38px] w-[38px] flex items-center justify-center text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",onClick:w=>k(y),disabled:c.value},[e.createVNode(nt,{class:"w-5 h-5"})],8,Ed)]))),128)),a.value.length===0?(e.openBlock(),e.createElementBlock("div",Vd,e.toDisplayString(t.emptyLabel),1)):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:E,disabled:!i.value},[e.createVNode(Re,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Bd)]))}}),[["__scopeId","data-v-c4c0acde"]]),Sd={};function Nd(l,t){return e.openBlock(),e.createElementBlock("svg",e.mergeProps({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},l.$attrs),[...t[0]||(t[0]=[e.createElementVNode("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"},null,-1),e.createElementVNode("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"},null,-1)])],16)}const $d=ae(Sd,[["render",Nd]]),Md={class:"vs-dataform space-y-4"},Dd=["draggable","onDragstart","onDragover","onDragenter","onDrop"],Ad={class:"flex items-center gap-2"},Fd=["onClick"],Ld={class:"text-sm font-medium text-gray-700"},Id={class:"flex items-center gap-2"},Td=["title","onClick","disabled"],Od=["title","onClick","disabled"],zd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Rd=["disabled"],jd=ae(e.defineComponent({__name:"vs-input-dataform",props:e.mergeModels({schema:{default:()=>[]},minGroups:{default:0},maxGroups:{default:void 0},addButtonText:{default:"Додати групу фільтрів"},groupLabel:{default:void 0},duplicateTitle:{default:"Дублювати групу"},removeTitle:{default:"Видалити групу"},emptyLabel:{},view:{default:"default"},collapsible:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.ref([]),r=e.ref(0),s=e.ref(null),i=e.ref(null),c=e.ref(null),d=e.computed(()=>t.groupLabel??"Group"),p=e.computed(()=>t.emptyLabel??"Ще немає груп"),h=e.computed(()=>t.schema?.map(q=>({...q,disabled:t.disabled||q.disabled}))??[]),E=e.computed(()=>h.value.map(q=>Z(q))),k=e.computed(()=>t.view==="accordion"),v=e.computed(()=>!!(t.collapsible||k.value)),f=e.computed(()=>t.draggable!==!1),g=e.computed(()=>t.disabled?!1:t.maxGroups?n.value.length<t.maxGroups:!0),x=e.computed(()=>t.disabled||n.value.length<=(t.minGroups||0));e.watch(()=>n.value.length,()=>{y(),w(),b()},{immediate:!0}),e.watch(()=>t.schema,b,{immediate:!0,deep:!0}),e.watch(()=>t.view,()=>{w()},{immediate:!0});function y(){const q=n.value.length;a.value.length<q?a.value=[...a.value,...Array.from({length:q-a.value.length},()=>qn())]:a.value.length>q&&a.value.splice(q)}function w(){const q=n.value.length;k.value?q===0?r.value=-1:r.value>=q?r.value=q-1:r.value<0&&(r.value=0):o.value.length<q?o.value=[...o.value,...Array.from({length:q-o.value.length},()=>!1)]:o.value.length>q&&o.value.splice(q)}function b(){if(!t.minGroups||n.value.length>=t.minGroups)return;const q=t.minGroups-n.value.length,re=Array.from({length:q},S);n.value=[...n.value,...re],w()}function S(){const q={};return h.value.forEach(re=>{q[re.name]=re?.default??null}),q}function M(){g.value&&(n.value=[...n.value,S()],y(),w())}function B(q){x.value||(n.value=n.value.filter((re,ue)=>ue!==q),y(),k.value?r.value>=n.value.length&&(r.value=n.value.length-1):o.value.splice(q,1),b())}function T(q){if(t.disabled)return;const re=JSON.parse(JSON.stringify(n.value[q]??{}));n.value=[...n.value.slice(0,q+1),re,...n.value.slice(q+1)],y(),k.value?r.value>q&&(r.value+=1):o.value.splice(q+1,0,o.value[q]??!1)}function Z(q){return{...q}}function J(q){return k.value?r.value===-1&&q===0?!1:r.value!==q:!!o.value[q]}function I(q){if(v.value){if(k.value){r.value=q;return}o.value[q]=!o.value[q]}}function F(q,re){if(!f.value||t.disabled){re.preventDefault();return}s.value=q,i.value=q,c.value={groups:JSON.parse(JSON.stringify(n.value)),keys:[...a.value],states:[...o.value]},re.dataTransfer?.setData("text/plain",String(q)),re.dataTransfer?.setDragImage?.(re.currentTarget,0,0)}function R(q,re){!f.value||t.disabled||s.value!==null&&pe(q,re)}function G(q,re){pe(q,re)}function O(q){!f.value||t.disabled||Le()}function A(){c.value&&H(),s.value=null,i.value=null,c.value=null}function W(q,re){const ue=[...n.value],[fe]=ue.splice(q,1);ue.splice(re,0,fe),n.value=ue;const ye=[...a.value],[z]=ye.splice(q,1);if(ye.splice(re,0,z),a.value=ye,k.value)r.value===q&&(r.value=re);else{const le=[...o.value],[xe]=le.splice(q,1);le.splice(re,0,xe),o.value=le}}function H(){c.value&&(n.value=c.value.groups,a.value=c.value.keys,o.value=c.value.states,c.value=null,i.value=null)}function pe(q,re){if(s.value===null)return;const ue=me(q,re);i.value=ue,Ae(ue)}function me(q,re){if(!re?.currentTarget)return q;const ue=re.currentTarget.getBoundingClientRect(),ye=re.clientY-ue.top>ue.height/2?q+1:q;return Math.max(0,Math.min(ye,n.value.length))}function Ae(q){const re=s.value;if(re===null)return;let ue=q;if(ue>n.value.length&&(ue=n.value.length),ue===re||ue===re+1)return;const fe=ue>re?ue-1:ue;W(re,fe),s.value=fe,i.value=ue>re?fe+1:fe}function Le(){c.value=null,s.value=null,i.value=null}return(q,re)=>(e.openBlock(),e.createElementBlock("div",Md,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(ue,fe)=>(e.openBlock(),e.createElementBlock("div",{key:a.value[fe],class:e.normalizeClass(["relative border border-gray-200 rounded-lg bg-white transition vs-dataform__group",[t.view==="accordion"?"overflow-hidden":J(fe)?"pt-6 px-6":"p-6"]]),draggable:f.value&&!t.disabled,onDragstart:ye=>F(fe,ye),onDragend:A,onDragover:e.withModifiers(ye=>R(fe,ye),["prevent"]),onDragenter:e.withModifiers(ye=>G(fe,ye),["prevent"]),onDrop:e.withModifiers(ye=>O(),["prevent"])},[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center justify-between gap-2 border-b border-gray-100 px-4 py-3",[t.view!=="accordion"?"-mx-6 -mt-6 px-6":"",t.view!=="accordion"&&!J(fe)?"rounded-t-lg":"rounded-lg"]])},[e.createElementVNode("div",Ad,[f.value?(e.openBlock(),e.createBlock(St,{key:0,class:"w-4 h-4 text-gray-400","aria-hidden":"true"})):e.createCommentVNode("",!0),v.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"rounded-full p-1 text-gray-500 transition hover:bg-gray-100",onClick:ye=>I(fe)},[e.createVNode(Wt,{class:e.normalizeClass(["h-4 w-4 transition",J(fe)?"-rotate-90":"rotate-0"])},null,8,["class"])],8,Fd)):e.createCommentVNode("",!0),e.createElementVNode("div",Ld,e.toDisplayString(`${d.value} (${fe+1})`),1)]),e.createElementVNode("div",Id,[e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.duplicateTitle,onClick:ye=>T(fe),disabled:t.disabled,draggable:"false"},[e.createVNode($d,{class:"w-5 h-5"})],8,Td),e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.removeTitle,onClick:ye=>B(fe),disabled:x.value,draggable:"false"},[e.createVNode(nt,{class:"w-5 h-5"})],8,Od)])],2),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(t.view==="accordion"?"p-6":"pt-6")},[e.createVNode(He,{class:"vs-dataform__form",schema:E.value,layout:"inline",navigation:!1,values:n.value[fe],"onUpdate:values":ye=>n.value[fe]=ye,"form-id":a.value[fe],disabled:t.disabled},null,8,["schema","values","onUpdate:values","form-id","disabled"])],2),[[e.vShow,!J(fe)]])],42,Dd))),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",zd,e.toDisplayString(p.value),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:M,disabled:!g.value},[e.createVNode(Re,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Rd)]))}}),[["__scopeId","data-v-473b9d69"]]),At="__vs_form_monaco_loader__",Kn={VsInputText:tt,VsInputRadio:tn,"vs-input-text":tt,"vs-input-password":jl,"vs-input-textarea":Dn,"vs-input-richtext":An,"vs-input-mask":Xt,"vs-input-number":_n,"vs-input-radio":tn,"vs-input-select":on,"vs-input-switcher":Zt,"vs-input-static":Jt,"vs-input-container":Mn,"vs-input-date":La,"vs-input-checkbox":vn,"vs-input-file":Sn,"vs-input-file2":ln,file2:ln,File2:ln,"vs-input-html":Jt,"vs-input-email":Qt,"vs-input-tel":en,"vs-input-datatable":Fn,"vs-input-map":Ln,"vs-input-file-list":Nn,"vs-input-tags":In,"vs-input-slug":Tn,"vs-input-codegen":On,"vs-input-key-value":zn,"vs-input-text[]":Rn,"vs-input-range":Pn,"vs-input-color":jn,"vs-input-native-select":on,VsInputArraySelect:Dt,"vs-input-array":Un,"vs-input-array-select":Dt,"array-select":Dt,"vs-input-address":Hn,"vs-input-datalist":Cd,"vs-input-dataform":jd,"vs-input-monaco":e.defineComponent({__name:"vs-input-monaco",props:e.mergeModels({syntax:{default:"xml"},theme:{default:"vs-light"},height:{default:280},minimap:{type:Boolean,default:!1},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref(null),o=e.computed(()=>typeof t.height=="number"?`${t.height}px`:t.height||"280px");let r=null,s=null,i=!1;const c=()=>{if(s)return Promise.resolve(s);if(typeof window>"u")return Promise.resolve(null);const p=window;if(p.monaco?.editor?.create)return s=p.monaco,Promise.resolve(s);if(p[At])return p[At];const E=(async()=>{const k=g=>{if(Array.from(document.styleSheets||[]).some(w=>w?.href?.includes(g)))return;const y=document.createElement("link");y.rel="stylesheet",y.href=g,document.head.appendChild(y)},v=g=>new Promise((x,y)=>{if(Array.from(document.scripts).some(S=>S.src===g))return x();const b=document.createElement("script");b.src=g,b.async=!0,b.onload=()=>x(),b.onerror=S=>y(S),document.body.appendChild(b)}),f="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs";return k(`${f}/editor/editor.main.min.css`),await v(`${f}/loader.min.js`),new Promise((g,x)=>{window.require.config({paths:{vs:f}}),window.require(["vs/editor/editor.main"],()=>{s=window.monaco,p.monaco=s,g(s)},y=>x(y))})})().catch(k=>{throw delete p[At],k});return p[At]=E,E},d=()=>{!a.value||!s||(r&&(r.dispose(),r=null),r=s.editor.create(a.value,{value:n.value||"",language:t.syntax,theme:t.theme,automaticLayout:!0,minimap:{enabled:!!t.minimap},readOnly:!!t.disabled}),r.onDidChangeModelContent(()=>{i||(n.value=r.getValue())}))};return e.watch(()=>n.value,p=>{if(!r)return;const h=r.getValue();p!==h&&(i=!0,r.setValue(p||""),i=!1)}),e.watch(()=>t.syntax,p=>{!r||!s||s.editor.setModelLanguage(r.getModel(),p||"xml")}),e.watch(()=>t.theme,p=>{s&&s.editor.setTheme(p||"vs-light")}),e.watch(()=>t.disabled,p=>{r&&r.updateOptions({readOnly:!!p})}),e.watch(()=>t.minimap,p=>{r&&r.updateOptions({minimap:{enabled:!!p}})}),e.onMounted(async()=>{try{const p=await c();if(!p||!p.editor)return;s=p,d()}catch(p){console.error("Failed to load Monaco editor",p)}}),e.onBeforeUnmount(()=>{r&&(r.dispose(),r=null)}),(p,h)=>(e.openBlock(),e.createElementBlock("div",{class:"w-full",style:e.normalizeStyle({height:o.value})},[e.createElementVNode("div",{ref_key:"editorContainer",ref:a,class:"w-full h-full overflow-hidden border border-[#CFD9E0] rounded"},null,512)],4))}})},Pd=e.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(l){const t=l,n=e.inject("values");async function a(){try{if(!t.api)return;const o=t.api.replace("{{value}}",t.value),r=await fetch(o);if(!r.ok){ge.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const s=await r.json();if(!t.set||!n)return;for(const[i,c]of Object.entries(t.set))n.value[i]=s.result[c]}catch(o){console.error(t.error,o)}}return(o,r)=>(e.openBlock(),e.createElementBlock("button",{onClick:a,class:"vs-button relative inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-blue-500 hover:border-blue-500 hover:bg-blue-500 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 ml-0 md:ml-2 mt-2 md:mt-0 py-[8px] md:w-2/4 whitespace-nowrap w-full"},e.toDisplayString(l.button),1))}}),Ud={class:"flex flex-col gap-1 w-full"},Hd=["innerHTML"],Gn=e.defineComponent({__name:"vs-compact-form-layout",props:e.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]},columns:{default:()=>({container:12,label:3})}},{modelValue:{default:null},modelModifiers:{}}),emits:e.mergeModels(["value-selected"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=e.useModel(l,"modelValue"),o=t,r=e.computed(()=>zl[`${n.layout}`]),s=["label","placeholder","info","description","text","html"],i=e.ref(x()),c=e.computed(()=>v(n.item,i.value)),d=e.computed(()=>Kn?.[`vs-input-${n.item.type}`]),p=e.inject("field-props"),h=e.computed(()=>{const w=e.unref(d);if(!w)return new Set;const b=w.props??w.__vccOpts?.props;if(!b)return new Set;const S=Array.isArray(b)?b:Object.keys(b);return new Set(S)}),E=e.computed(()=>{const w={...c.value??{}},b=n.item?.name;b&&p?.value?.[b]&&Object.assign(w,p.value[b]);const S=h.value;return S.size?Object.fromEntries(Object.entries(w).filter(([M])=>S.has(M))):{}}),k=w=>{const b=typeof w=="object"&&w!==null?w:{value:w};o("value-selected",{...b,name:b.name??n.item?.name})};e.onMounted(()=>{i.value=x(),window.addEventListener("storage",y)}),e.onUnmounted(()=>{window.removeEventListener("storage",y)});function v(w,b){if(!w)return{};const S={...w};return s.forEach(M=>{const B=g(w,M,b);B!=null&&(S[M]=B)}),Array.isArray(w.options)&&(S.options=w.options.map(M=>f(M,b))),S}function f(w,b){if(!w)return w;const S={...w},M=g(w,"label",b),B=g(w,"text",b);return M!=null&&(S.label=M),B!=null?S.text=B:M!=null&&(S.text=M),S}function g(w,b,S){const M=`${b}:${S}`;if(w?.[M]!=null)return w[M];if(b==="label"&&w?.[S]!=null)return w[S];if(w?.[b]!=null)return w[b];if(b==="label"){if(w?.ua!=null)return w.ua;if(w?.en!=null)return w.en}if(b==="text"||b==="html"){if(w?.ua!=null)return w.ua;if(w?.en!=null)return w.en}return null}function x(){return typeof window>"u"?"uk":localStorage.getItem("locale")||"uk"}function y(){i.value=x()}return(w,b)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{ua:c.value.ua,error:n.error||"",item:c.value,columns:n.columns,label:c.value.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${n.item.type}-component`])},[e.createElementVNode("div",Ud,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value),e.mergeProps(E.value,{modelValue:a.value,"onUpdate:modelValue":b[0]||(b[0]=S=>a.value=S),onValueSelected:k}),null,16,["modelValue"])),c.value.description&&n.layout!=="settings"?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-sm text-gray-500",innerHTML:c.value.description},null,8,Hd)):e.createCommentVNode("",!0)]),c.value.behavior?.api&&c.value.behavior?.button?(e.openBlock(),e.createBlock(Pd,e.mergeProps({key:0},c.value.behavior,{value:a.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),qd={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},Kd={class:"vs-compact-form-navigation__rail mt-[6px]"},Gd=["onClick"],Yd=ae(e.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(l,{expose:t}){const n=l,a=e.ref([]),o=e.ref(""),r=e.ref(""),s=e.computed(()=>!!n.enabled),i=e.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),c=e.computed(()=>{const I=n.width;if(I==null)return{};const F=typeof I=="number"?`${I}px`:`${I}`;return{width:F,minWidth:F}});let d=null,p=0,h=0,E=null,k=null,v=null;const f=()=>Z(),g=()=>y();e.watch(()=>n.target,async I=>{if(M(),!I){E=null,a.value=[],o.value="";return}E=I,s.value&&(await e.nextTick(),S(I),y())},{immediate:!0}),e.watch(()=>n.scrollContainer,I=>{if(!s.value){k=I??null;return}x(I??null),e.nextTick(()=>y())},{immediate:!0}),e.onMounted(()=>{n.scrollContainer||x(null),y()}),e.onBeforeUnmount(()=>{M(),x(null,!0),E=null,typeof window<"u"&&(p&&window.cancelAnimationFrame(p),h&&window.cancelAnimationFrame(h))});function x(I,F=!1){if(v&&(v(),v=null),F){k=null;return}if(k=I??null,typeof window>"u")return;const R=I??window,G=window;R.addEventListener("scroll",f,{passive:!0}),G.addEventListener("resize",g),v=()=>{R.removeEventListener("scroll",f),G.removeEventListener("resize",g)}}function y(){if(!s.value||!E)return;p&&typeof window<"u"&&window.cancelAnimationFrame(p);const I=()=>{w(),p=0};typeof window>"u"?I():p=window.requestAnimationFrame(I)}function w(){if(!s.value||!E)return;const I=Array.from(E.querySelectorAll("h1, h2")),F=new Set,R=[];I.forEach((G,O)=>{const A=G.textContent?.trim()??"";if(!A)return;let W=(G.getAttribute("id")??"").trim();W||(W=b(A)||`heading-${O+1}`);let H=W,pe=1;for(;F.has(H);)H=`${W}-${pe+=1}`;G.id!==H&&Object.assign(G,{id:H}),F.add(H),R.push({id:H,text:A,level:G.tagName.toLowerCase()==="h1"?1:2})}),a.value=R,R.length||(o.value=""),T()}function b(I){return I.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function S(I){!I||!s.value||typeof MutationObserver>"u"||(M(),d=new MutationObserver(()=>y()),d.observe(I,{childList:!0,subtree:!0}))}function M(){d&&(d.disconnect(),d=null)}function B(I){const F=k;if(!F)return typeof window>"u"?I.offsetTop:I.getBoundingClientRect().top+window.scrollY;const R=I.getBoundingClientRect(),G=F.getBoundingClientRect();return R.top-G.top+F.scrollTop}function T(){if(!s.value||!a.value.length)return;const I=k,F=(I?I.scrollTop:null)||(typeof window<"u"?window.scrollY:0),R=(I?I.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),G=F+R;let O=null;for(let W=0;W<a.value.length;W+=1){const H=a.value[W],pe=document.getElementById(H.id);if(pe){const me=B(pe);me+pe.offsetHeight>F&&me<G&&(O=H.id)}}!O&&r.value&&(O=r.value),O&&(r.value=O);const A=I?I.scrollHeight-I.clientHeight:document.documentElement.scrollHeight-window.innerHeight;F+5>=A&&(O=a.value[a.value.length-1].id),O&&(o.value=O)}function Z(){s.value&&(h&&window.cancelAnimationFrame(h),h=window.requestAnimationFrame(()=>{T(),h=0}))}function J(I){if(!s.value)return;const F=document.getElementById(I);if(!F)return;const R=k,G=Math.max(0,B(F));R?R.scrollTo({top:G,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:G,behavior:"smooth"})}return t({refresh:y}),(I,F)=>s.value&&a.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(c.value)},[e.createElementVNode("h2",qd,e.toDisplayString(l.title),1),e.createElementVNode("div",Kd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,R=>(e.openBlock(),e.createElementBlock("div",{key:R.id,class:e.normalizeClass(["vs-compact-form-navigation__item relative",R.level===2?"vs-compact-form-navigation__item--nested":"",R.id===o.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick:G=>J(R.id),class:e.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",R.level===2?"pl-[15px]":"pl-[18px]",R.id===o.value?"text-gray-800":"text-gray-500"])},[e.createElementVNode("span",null,e.toDisplayString(R.text),1)],10,Gd)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-b3e16a91"]]),Xe={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон",minlength:l=>`Мінімальна довжина — ${l} символів`,maxlength:l=>`Максимальна довжина — ${l} символів`},Wd=l=>typeof l=="string"?l.trim()?!1:Xe.required:Array.isArray(l)?l.map(n=>typeof n=="string"?n.trim():n).filter(n=>n!=null&&n!=="").length?!1:Xe.required:l?!1:Xe.required,Zd=l=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return l?t.test(l)?!1:Xe.email:!1},Jd=l=>{const t=/^\+[1-9]\d{1,14}$/;return l?t.test(l)?!1:Xe.tel:!1},Yn=l=>l==null?0:typeof l=="string"?l.trim().length:Array.isArray(l)?l.length:typeof l=="number"?l.toString().length:String(l).length,Xd=(l,t)=>{if(l==null)return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Yn(l)<n?t?.message||Xe.minlength(n):!1},Qd=(l,t)=>{if(l==null||l==="")return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Yn(l)>n?t?.message||Xe.maxlength(n):!1},eu=(l,t)=>{const n=t.pattern??t.regexp,a=typeof n=="string"?new RegExp(n):n;if(Array.isArray(l)){const o=l.filter(Boolean);return o.length===0||o.every(r=>a.test(r))?!1:t.message}return!a.test(l)&&l?t.message:!1},tu=(l,t)=>!1,nu=(l,t)=>{switch(typeof t=="string"?t:t.type){case"required":return Wd(l);case"email":return Zd(l);case"tel":return Jd(l);case"regexp":return eu(l,t);case"minlength":return Xd(l,t);case"maxlength":return Qd(l,t);case"custom":return tu();default:return!1}},lu={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function Wn(l){const t=l?.toLowerCase();return lu[t]||t}function sn(l,t=!1){if(Array.isArray(l)){const a=[];return l.forEach(o=>{const r={...o};r.name=(o.name||o.id||o.key||"").toString(),r.type=Wn(o.type),r.label=o.label||o.ua,r.rules=o.rules||o.validators,r.type==="email"&&!r.rules&&(r.rules=["email"]),o.data&&(r.api=`/api/suggest/${o.data}`),r.disabled=r.disabled??t,Array.isArray(r.schema)&&(r.schema=sn(r.schema,r.disabled)),a.push(r)}),a}const n=[];return Object.entries(l).forEach(a=>{const o={name:a[0],...a[1],type:Wn(a[1].type),label:a[1].label||a[1].ua,rules:a[1].rules||a[1].validators,disabled:a[1].disabled??t};o.type==="email"&&!o.rules&&(o.rules=["email"]),a[1].type?.includes("list")&&(o.multiple=!0),!o.api&&a[1].data&&(o.api=`/api/suggest/${a[1].data}`),Array.isArray(o.schema)&&(o.schema=sn(o.schema,o.disabled)),n.push(o)}),n}function au(l,t,n=!1){const a=e.computed(()=>sn((Array.isArray(t),t),typeof n=="boolean"?n:n.value)),o=e.ref({});function r(d){const p=d?.conditions;if(!p)return!0;const h=Array.isArray(p)?p[0]:p,E=l?.value?.[h];return $n(E,p)}const s=(d=a.value,p=!0)=>(d.forEach(h=>{const E=[],k=Number(h?.minlength),v=Number(h?.maxlength);!Number.isNaN(k)&&Number.isFinite(k)&&E.push({type:"minlength",value:k}),!Number.isNaN(v)&&Number.isFinite(v)&&E.push({type:"maxlength",value:v});const f=[...E,...h.rules||[]];if(f.length){if(!r(h)){delete o.value[h.name];return}let g=!1,x=null;f.forEach(y=>{const w=nu(l.value[h.name],y);w&&(g=!0,!x&&typeof w=="string"&&(x=w))}),g&&x?o.value[h.name]=x:delete o.value[h.name]}h.schema&&s(h.schema,!1)}),p&&Object.values(o.value).some(Boolean)?o.value:null),i=e.computed(()=>a.value?.filter(d=>d.hidden!==!0&&r(d)));return{errors:o,validate:s,reset:()=>{l.value={},o.value={}},visibleSchema:i}}const ou={class:"flex w-full h-full min-h-0 gap-6"},ru={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},He=e.defineComponent({__name:"vs-compact-form",props:e.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},modelValue:{default:()=>({})},modelModifiers:{},values:{default:void 0},valuesModifiers:{}}),emits:e.mergeModels(["handle-submit","update:modelValue","value-selected"],["update:form","update:modelValue","update:values"]),setup(l,{expose:t,emit:n}){const a=n,o=l,r=e.useModel(l,"form"),s=e.useModel(l,"modelValue"),i=e.useModel(l,"values"),c=e.computed({get:()=>i.value??s.value,set:F=>{s.value=F,i.value=F}}),{errors:d,validate:p,reset:h,visibleSchema:E}=au(c,o.schema,e.toRef(o,"disabled")),k=e.ref(null),v=e.ref(null),f=e.ref({}),g=e.computed(()=>o.navigation),x=e.computed(()=>o.navWidth),y=e.computed(()=>o.style?.columns),w=Object.freeze({container:12,label:3}),b=e.computed(()=>o.columns??y.value??w),S=e.computed(()=>o.columns!=null||y.value!=null),M=e.computed(()=>S.value?"horizontal":o.layout),B=F=>F?.columns?"horizontal":M.value,T=F=>F?.columns??b.value,Z=()=>{a("update:modelValue",c.value),p(),a("handle-submit",c.value)},J=F=>{a("value-selected",F)};t({validate:p,reset:h,errors:d}),e.onMounted(()=>{r.value={value:c.value,errors:d.value,reset:h,validate:p,formId:o.formId}});function I(F,R){if(F===R)return!0;if(typeof F!="object"||typeof R!="object"||!F||!R)return!1;const G=Object.keys(F),O=Object.keys(R);return G.length!==O.length?!1:G.every(A=>F[A]===R[A])}return e.provide("form",r),e.provide("values",c),e.provide("field-props",f),(F,R)=>(e.openBlock(),e.createElementBlock("div",ou,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:v},[e.createElementVNode("form",{ref_key:"formRef",ref:k,onSubmit:e.withModifiers(Z,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",M.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E),(G,O)=>(e.openBlock(),e.createElementBlock("div",{key:G.name,class:e.normalizeClass(B(G)==="horizontal"?"col-span-12":`col-span-${G.col||12}`)},[e.createVNode(Gn,{style:e.normalizeStyle(l.style),item:G,layout:B(G),columns:T(G),"model-value":c.value[G.name],"onUpdate:modelValue":A=>{const W=c.value[G.name];I(W,A)||(c.value[G.name]=A)},error:e.unref(d)[G.name],onValueSelected:J},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),B(G)==="settings"&&O+1!==e.unref(E).length?(e.openBlock(),e.createElementBlock("div",ru)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(Yd,{target:k.value,"scroll-container":v.value,enabled:g.value,width:x.value},null,8,["target","scroll-container","enabled","width"])]))}}),su={class:"relative"},iu={class:"w-full h-full fixed top-0 start-0 bg-black bg-opacity-50"},cu={class:"m-[10px] fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 min-h-0 h-fit max-h-[80vh] overflow-hidden opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl lg:w-7/12 w-11/12"},du={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},uu={class:"font-medium text-gray-800 dark:text-[#ffffff]"},pu={class:"p-4 mim-h-0 h-full overflow-auto"},Zn=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{},api:{},method:{}},emits:["close","save","edit"],setup(l,{emit:t}){const n=l,a=t,o=e.ref(n.schema),r=e.ref(n.defaultValue?JSON.parse(JSON.stringify(n.defaultValue)):{}),s=e.ref({}),i=e.ref(n.token||""),c=e.ref(n.mode),d=()=>{const v=n.method?.trim().toUpperCase();return v==="GET"||v==="POST"||v==="PUT"?v:c.value==="add"?"POST":"PUT"},p=()=>{ge.notify({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`})},h=async v=>{if(console.log(v),v.ok){await v.json().catch(()=>({})),p(),a("save",r.value);return}if(v.status===400){const f=await v.json().catch(()=>({}));ge.notify({type:"warning",title:"Помилка валідації",message:f.message||"Некоректні дані (400)"});return}if(v.status===500){ge.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"});return}ge.notify({type:"error",title:"Помилка",message:`Статус: ${v.status}`})};async function E(){const v=s.value.validate();if(v){ge.notify({type:"warning",title:"Помилка валідації",message:Object.entries(v).map(([g,x])=>`${g}: ${x}`).join(`
|
|
3
|
+
`)});return}const f=n.api?.trim();if(f){const g=d();try{const x=await fetch(f,{method:g,headers:g==="GET"?void 0:{"Content-Type":"application/json"},body:g==="GET"?void 0:JSON.stringify(r.value)});await h(x)}catch(x){ge.notify({type:"error",title:"Помилка з’єднання",message:x.message||"Не вдалося виконати запит"})}return}if(i.value)try{const g=await fetch(`/api/table/${i.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r.value)});await h(g)}catch(g){ge.notify({type:"error",title:"Помилка з’єднання",message:g.message||"Не вдалося виконати запит"})}else a("edit",r.value),k()}function k(){a("close")}return e.onMounted(async()=>{try{if(n.form&&!n.schema){const v=await fetch(`/api/template/form/${n.form}`);if(!v.ok){ge.notify({type:v.status>=400&&v.status<500?"warning":"error",title:"Error",message:`Error code: ${v.status}`});return}const f=await v.json();o.value=f.schema,f.token&&(i.value=f.token)}else if(n.token&&!n.defaultValue){i.value=n.token;const v=await fetch(`/api/form/${i.value}`);if(!v.ok){ge.notify({type:v.status>=400&&v.status<500?"warning":"error",title:"Error",message:`Error code: ${v.status}`});return}const f=await v.json();o.value=f.schema,f.data?r.value=f.data:c.value="add",f.obj&&(r.value={...r.value,...f.obj})}}catch(v){ge.notify({type:"error",title:"Error",message:v.message||"Unexpected error"}),console.error(v)}}),(v,f)=>(e.openBlock(),e.createElementBlock("div",su,[e.createElementVNode("div",iu,[e.createElementVNode("div",cu,[e.createElementVNode("div",du,[e.createElementVNode("h3",uu,e.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:k,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},[...f[2]||(f[2]=[e.createElementVNode("span",{class:"sr-only"},"Close",-1),e.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("path",{d:"M18 6 6 18"}),e.createElementVNode("path",{d:"m6 6 12 12"})],-1)])])]),e.createElementVNode("div",pu,[o.value?(e.openBlock(),e.createBlock(He,{key:0,schema:o.value,values:r.value,"onUpdate:values":f[0]||(f[0]=g=>r.value=g),form:s.value,"onUpdate:form":f[1]||(f[1]=g=>s.value=g),formId:i.value},null,8,["schema","values","form","formId"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"vs-form__head mr-5 mb-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},[e.createElementVNode("button",{type:"button",onClick:k,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:E,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])])])]))}}),mu=1440*60*1e3,fu=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],hu=["січ","лют","бер","квіт","трав","черв","лип","серп","вер","жовт","лист","груд"],gu=["нд","пн","вт","ср","чт","пт","сб"];function Ee(l){return l instanceof Date&&!Number.isNaN(l.getTime())}const lt=l=>new Date(l.getTime());function Qe(l){const t=lt(l);return t.setHours(0,0,0,0),t}function dt(l){const t=lt(l);return t.setHours(23,59,59,999),t}function cn(l){return Qe(new Date(l.getFullYear(),l.getMonth(),1))}function dn(l){return dt(new Date(l.getFullYear(),l.getMonth()+1,0))}function un(l,t){const n=new Date(l),a=n.getDate();n.setDate(1),n.setMonth(n.getMonth()+t);const o=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();return n.setDate(Math.min(a,o)),n}function yu(l,t){return un(l,-1)}function Ft(l,t){const n=new Date(l);return n.setFullYear(n.getFullYear()+t),n}function Jn(l,t){return Ft(l,-t)}function Xn(l){return Qe(new Date(l.getFullYear(),0,1))}function Qn(l){return dt(new Date(l.getFullYear(),11,31))}function ku(l){const t=Math.floor(l.getFullYear()/10)*10;return Qe(new Date(t,0,1))}function bu(l){const t=Math.floor(l.getFullYear()/10)*10+9;return dt(new Date(t,11,31))}const Oe=l=>l.getFullYear(),Lt=l=>Math.floor(l.getFullYear()/10)*10;function wu(l){const t=[];let n=Qe(l.start);const a=Qe(l.end);for(;n<=a;)t.push(lt(n)),n=new Date(n.getTime()+mu);return t}function xu(l){const t=[];let n=cn(l.start);const a=dn(l.end);for(;n<=a;)t.push(lt(n)),n=un(n,1);return t}function _u(l){const t=[];let n=Xn(l.start);const a=Qn(l.end);for(;n<=a;)t.push(lt(n)),n=Ft(n,1);return t}function pn(l,t=1){const n=Qe(l),a=(n.getDay()-t+7)%7;return n.setDate(n.getDate()-a),n}function vu(l,t=1){const n=pn(l,t);return n.setDate(n.getDate()+6),dt(n)}function Eu(l,t,n=0){const a=pn(l,n),o=(t-n+7)%7;return a.setDate(a.getDate()+o),a}const It=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth()&&l.getDate()===t.getDate(),mn=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth(),el=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear(),tl=(l,t)=>!!l&&!!t&&It(l,t)&&l.getHours()===t.getHours(),Vu=(l,t)=>!!l&&!!t&&tl(l,t)&&l.getMinutes()===t.getMinutes();function Bu(l,t){const n=l.getTime();return n>=t.start.getTime()&&n<=t.end.getTime()}const ut=(l,t)=>!!l&&!!t&&l.getTime()<t.getTime(),pt=(l,t)=>!!l&&!!t&&l.getTime()>t.getTime();function Cu(l){const t=l.filter(n=>Ee(n));if(t.length)return t.reduce((n,a)=>n.getTime()>=a.getTime()?n:a)}function Su(l){const t=l.filter(n=>Ee(n));if(t.length)return t.reduce((n,a)=>n.getTime()<=a.getTime()?n:a)}function nl(l,t){const n=lt(l);return typeof t.year=="number"&&n.setFullYear(t.year),typeof t.month=="number"&&n.setMonth(t.month),typeof t.date=="number"&&n.setDate(t.date),typeof t.hours=="number"&&n.setHours(t.hours),typeof t.minutes=="number"&&n.setMinutes(t.minutes),typeof t.seconds=="number"&&n.setSeconds(t.seconds),typeof t.milliseconds=="number"&&n.setMilliseconds(t.milliseconds),n}const Tt=(l,t=2)=>String(l).padStart(t,"0");function ll(l,t){return t==="wide"?fu[l]:hu[l]}function Nu(l){return gu[l]}const $u=[{token:"LLLL",format:l=>ll(l.getMonth(),"wide")},{token:"LLL",format:l=>ll(l.getMonth(),"abbreviated")},{token:"EE",format:l=>Nu(l.getDay())},{token:"yyyy",format:l=>String(l.getFullYear())},{token:"MM",format:l=>Tt(l.getMonth()+1)},{token:"dd",format:l=>Tt(l.getDate())},{token:"HH",format:l=>Tt(l.getHours())},{token:"mm",format:l=>Tt(l.getMinutes())}];function Ot(l,t){if(!Ee(l))return"";let n="",a=0;for(;a<t.length;){const o=$u.find(r=>t.startsWith(r.token,a));o?(n+=o.format(l),a+=o.token.length):(n+=t[a],a+=1)}return n}const Mu={"yyyy-MM-dd":/^(\d{4})-(\d{2})-(\d{2})$/,"dd.MM.yyyy":/^(\d{2})\.(\d{2})\.(\d{4})$/,"dd.MM.yyyy HH:mm":/^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2})$/,"HH:mm":/^(\d{2}):(\d{2})$/,"MM.yyyy":/^(\d{2})\.(\d{4})$/,yyyy:/^(\d{4})$/};function al(l,t){const n=Mu[t];if(!n){const o=new Date(l);return Ee(o)?o:null}const a=l.match(n);if(!a)return null;switch(t){case"yyyy-MM-dd":{const[,o,r,s]=a,i=new Date(Number(o),Number(r)-1,Number(s));return Ee(i)?i:null}case"dd.MM.yyyy":{const[,o,r,s]=a,i=new Date(Number(s),Number(r)-1,Number(o));return Ee(i)?i:null}case"dd.MM.yyyy HH:mm":{const[,o,r,s,i,c]=a,d=new Date(Number(s),Number(r)-1,Number(o),Number(i),Number(c));return Ee(d)?d:null}case"HH:mm":{const[,o,r]=a,s=new Date;return s.setHours(Number(o),Number(r),0,0),s}case"MM.yyyy":{const[,o,r]=a;return new Date(Number(r),Number(o)-1,1)}case"yyyy":{const[,o]=a;return new Date(Number(o),0,1)}default:return null}}const Du=["year","month","day","time","custom"],Au=e.defineComponent({emits:{elementClick:l=>Ee(l),left:()=>!0,right:()=>!0,heading:()=>!0},props:{headingClickable:{type:Boolean,default:!1},leftDisabled:{type:Boolean,default:!1},rightDisabled:{type:Boolean,default:!1},columnCount:{type:Number,default:7},items:{type:Array,default:()=>[]},viewMode:{type:String,required:!0,validate:l=>typeof l=="string"&&Du.includes(l)}}}),Fu={class:"v3dp__heading"},Lu=["disabled"],Iu=["disabled"],Tu={class:"v3dp__body"},Ou={class:"v3dp__subheading"},zu={class:"v3dp__elements"},Ru=["disabled","onClick"];function ju(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["v3dp__popout",`v3dp__popout-${l.viewMode}`]),style:e.normalizeStyle({"--popout-column-definition":`repeat(${l.columnCount}, 1fr)`}),onMousedown:t[3]||(t[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Fu,[e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__left",disabled:l.leftDisabled,onClick:t[0]||(t[0]=e.withModifiers(s=>l.$emit("left"),["stop","prevent"]))},[e.renderSlot(l.$slots,"arrow-left",{},()=>[t[4]||(t[4]=e.createElementVNode("svg",{class:"v3dp__heading__icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 8"},[e.createElementVNode("g",{fill:"none","fill-rule":"evenodd"},[e.createElementVNode("path",{stroke:"none",d:"M-9 16V-8h24v24z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 0L1 4l4 4"})])],-1))],!0)],8,Lu),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.headingClickable?"button":"span"),{class:"v3dp__heading__center",onClick:t[1]||(t[1]=e.withModifiers(s=>l.$emit("heading"),["stop","prevent"]))},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"heading",{},void 0,!0)]),_:3})),e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__right",disabled:l.rightDisabled,onClick:t[2]||(t[2]=e.withModifiers(s=>l.$emit("right"),["stop","prevent"]))},[e.renderSlot(l.$slots,"arrow-right",{},()=>[t[5]||(t[5]=e.createElementVNode("svg",{class:"v3dp__heading__icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 8"},[e.createElementVNode("g",{fill:"none","fill-rule":"evenodd"},[e.createElementVNode("path",{stroke:"none",d:"M15-8v24H-9V-8z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M1 8l4-4-4-4"})])],-1))],!0)],8,Iu)]),e.createElementVNode("div",Tu,["subheading"in l.$slots?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Ou,[e.renderSlot(l.$slots,"subheading",{},void 0,!0)]),t[6]||(t[6]=e.createElementVNode("hr",{class:"v3dp__divider"},null,-1))],64)):e.createCommentVNode("",!0),e.createElementVNode("div",zu,[e.renderSlot(l.$slots,"body",{},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.items,s=>(e.openBlock(),e.createElementBlock("button",{key:s.key,disabled:s.disabled,class:e.normalizeClass([{selected:s.selected,current:s.current},`v3dp__element__button__${l.viewMode}`]),onClick:e.withModifiers(i=>l.$emit("elementClick",s.value),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(s.display),1)],10,Ru))),128))],!0)])])],38)}const zt=ae(Au,[["render",ju],["__scopeId","data-v-5de7813f"]]),Pu=e.defineComponent({components:{PickerPopup:zt},emits:{"update:pageDate":l=>Ee(l),select:l=>Ee(l)},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(l,{emit:t}){const n=e.computed(()=>ku(l.pageDate)),a=e.computed(()=>bu(l.pageDate)),o=(h,E,k)=>!E&&!k?!0:!(E&&Oe(h)<Oe(E)||k&&Oe(h)>Oe(k)),r=e.computed(()=>_u({start:n.value,end:a.value}).map(h=>({value:h,key:String(Oe(h)),display:Oe(h),selected:!!l.selected&&Oe(h)===Oe(l.selected),disabled:!o(h,l.lowerLimit,l.upperLimit)}))),s=e.computed(()=>{const h=Oe(n.value),E=Oe(a.value);return`${h} - ${E}`}),i=e.computed(()=>l.lowerLimit&&(Lt(l.lowerLimit)===Lt(l.pageDate)||ut(l.pageDate,l.lowerLimit))),c=e.computed(()=>l.upperLimit&&(Lt(l.upperLimit)===Lt(l.pageDate)||pt(l.pageDate,l.upperLimit)));return{years:r,heading:s,leftDisabled:i,rightDisabled:c,previousPage:()=>t("update:pageDate",Jn(l.pageDate,10)),nextPage:()=>t("update:pageDate",Ft(l.pageDate,10))}}});function Uu(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{columnCount:3,leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,items:l.years,viewMode:"year",onLeft:l.previousPage,onRight:l.nextPage,onElementClick:t[0]||(t[0]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const Hu=ae(Pu,[["render",Uu]]),qu=e.defineComponent({components:{PickerPopup:zt},emits:{"update:pageDate":l=>Ee(l),select:l=>Ee(l),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"LLL"},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(l,{emit:t}){const n=e.computed(()=>Xn(l.pageDate)),a=e.computed(()=>Qn(l.pageDate)),o=e.computed(()=>E=>Ot(E,l.format)),r=(E,k,v)=>!k&&!v?!0:!(k&&ut(E,cn(k))||v&&pt(E,dn(v))),s=e.computed(()=>xu({start:n.value,end:a.value}).map(E=>({value:E,display:o.value(E),key:o.value(E),selected:!!l.selected&&mn(l.selected,E),disabled:!r(E,l.lowerLimit,l.upperLimit)}))),i=e.computed(()=>Oe(n.value)),c=e.computed(()=>l.lowerLimit&&(el(l.lowerLimit,l.pageDate)||ut(l.pageDate,l.lowerLimit))),d=e.computed(()=>l.upperLimit&&(el(l.upperLimit,l.pageDate)||pt(l.pageDate,l.upperLimit)));return{months:s,heading:i,leftDisabled:c,rightDisabled:d,previousPage:()=>t("update:pageDate",Jn(l.pageDate,1)),nextPage:()=>t("update:pageDate",Ft(l.pageDate,1))}}});function Ku(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:3,items:l.months,leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,viewMode:"month",onLeft:l.previousPage,onRight:l.nextPage,onHeading:t[0]||(t[0]=i=>l.$emit("back")),onElementClick:t[1]||(t[1]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),_:1},8,["items","leftDisabled","rightDisabled","onLeft","onRight"])}const Gu=ae(qu,[["render",Ku]]),Yu=e.defineComponent({components:{PickerPopup:zt},emits:{"update:pageDate":l=>Ee(l),select:l=>Ee(l),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"dd"},headingFormat:{type:String,required:!1,default:"LLLL yyyy"},weekdayFormat:{type:String,required:!1,default:"EE"},weekStartsOn:{type:Number,required:!1,default:1,validator:l=>typeof l=="number"&&Number.isInteger(l)&&l>=0&&l<=6},customWeekdays:{type:Array,required:!1},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1}},setup(l,{emit:t}){const n=e.computed(()=>g=>x=>Ot(x,g)),a=e.computed(()=>cn(l.pageDate)),o=e.computed(()=>dn(l.pageDate)),r=e.computed(()=>({start:a.value,end:o.value})),s=e.computed(()=>({start:pn(a.value,l.weekStartsOn),end:vu(o.value,l.weekStartsOn)})),i=e.computed(()=>l.customWeekdays?.length===7?l.customWeekdays:null),c=e.computed(()=>{const g=l.weekStartsOn,x=i.value;if(x)return Array.from({length:7}).map((w,b)=>x[(g+b)%7]);const y=n.value(l.weekdayFormat);return Array.from(Array(7)).map((w,b)=>(g+b)%7).map(w=>Eu(new Date,w,l.weekStartsOn)).map(y)}),d=(g,x,y,w)=>w?.dates?.some(b=>It(g,b))||w?.predicate?.(g)?!1:!x&&!y?!0:!(x&&ut(g,Qe(x))||y&&pt(g,dt(y))),p=e.computed(()=>{const g=new Date,x=n.value(l.format);return wu(s.value).map(y=>({value:y,display:x(y),selected:!!l.selected&&It(l.selected,y),current:It(g,y),disabled:!l.allowOutsideInterval&&!Bu(y,r.value)||!d(y,l.lowerLimit,l.upperLimit,l.disabledDates),key:n.value("yyyy-MM-dd")(y)}))}),h=e.computed(()=>n.value(l.headingFormat)(l.pageDate)),E=e.computed(()=>l.lowerLimit&&(mn(l.lowerLimit,l.pageDate)||ut(l.pageDate,l.lowerLimit))),k=e.computed(()=>l.upperLimit&&(mn(l.upperLimit,l.pageDate)||pt(l.pageDate,l.upperLimit)));return{weekDays:c,days:p,heading:h,leftDisabled:E,rightDisabled:k,previousPage:()=>t("update:pageDate",yu(l.pageDate)),nextPage:()=>t("update:pageDate",un(l.pageDate,1))}}});function Wu(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,items:l.days,viewMode:"day",onLeft:l.previousPage,onRight:l.nextPage,onHeading:t[0]||(t[0]=i=>l.$emit("back")),onElementClick:t[1]||(t[1]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),subheading:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.weekDays,(i,c)=>(e.openBlock(),e.createElementBlock("span",{key:i,class:e.normalizeClass(`v3dp__subheading__weekday__${c}`)},e.toDisplayString(i),3))),128))]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const Zu=ae(Yu,[["render",Wu]]);function ol(l,t){const n=l.getBoundingClientRect(),a={height:l.clientHeight,width:l.clientWidth},o=t.getBoundingClientRect();if(!(o.top>=n.top&&o.bottom<=n.top+a.height)){const s=o.top-n.top,i=o.bottom-n.bottom;Math.abs(s)<Math.abs(i)?l.scrollTop+=s:l.scrollTop+=i}}const Ju=e.defineComponent({components:{PickerPopup:zt},emits:{select:l=>Ee(l),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},visible:{type:Boolean,required:!0},disabledTime:{type:Object,required:!1}},setup(l,{emit:t}){const n=e.ref(null),a=e.ref(null),o=e.computed(()=>l.pageDate??l.selected),r=e.ref(o.value.getHours()),s=e.ref(o.value.getMinutes());e.watch(()=>l.selected,k=>{let v=0,f=0;k&&(v=k.getHours(),f=k.getMinutes()),r.value=v,s.value=f});const i=e.computed(()=>[...Array(24).keys()].map(k=>({value:k,date:nl(new Date(o.value.getTime()),{hours:k,minutes:s.value,seconds:0}),selected:r.value===k,ref:e.ref(null)}))),c=e.computed(()=>[...Array(60).keys()].map(k=>({value:k,date:nl(new Date(o.value.getTime()),{hours:r.value,minutes:k,seconds:0}),selected:s.value===k,ref:e.ref(null)}))),d=k=>{s.value=k.value,t("select",k.date)},p=()=>{const k=i.value.find(f=>f.ref.value?.classList?.contains("selected")??!1),v=c.value.find(f=>f.ref.value?.classList?.contains("selected")??!1);k&&v&&(ol(n.value,k.ref.value),ol(a.value,v.ref.value))};return e.watch(()=>l.visible,k=>{k&&e.nextTick(p)}),{hoursListRef:n,minutesListRef:a,hours:r,minutes:s,hoursList:i,minutesList:c,padStartZero:k=>`0${k}`.substr(-2),selectMinutes:d,isEnabled:k=>!(l.disabledTime?.dates?.some(v=>tl(k,v)&&Vu(k,v))||l.disabledTime?.predicate?.(k)),scroll:p}}}),Xu={ref:"hoursListRef",class:"v3dp__column"},Qu=["disabled","onClick"],ep={ref:"minutesListRef",class:"v3dp__column"},tp=["disabled","onClick"];function np(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:2,leftDisabled:!0,rightDisabled:!0,viewMode:"time",onHeading:t[0]||(t[0]=i=>l.$emit("back"))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.padStartZero(l.hours))+":"+e.toDisplayString(l.padStartZero(l.minutes)),1)]),body:e.withCtx(()=>[e.createElementVNode("div",Xu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.hoursList,i=>(e.openBlock(),e.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:e.normalizeClass([{selected:i.selected},"v3dp__element_button__hour"]),disabled:!l.isEnabled(i.date),onClick:e.withModifiers(c=>l.hours=i.value,["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,Qu))),128))],512),e.createElementVNode("div",ep,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.minutesList,i=>(e.openBlock(),e.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:e.normalizeClass([{selected:i.selected},"v3dp__element_button__minute"]),disabled:!l.isEnabled(i.date),onClick:e.withModifiers(c=>l.selectMinutes(i),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,tp))),128))],512)]),_:1})}const lp=ae(Ju,[["render",np],["__scopeId","data-v-43e01bf7"]]),Rt=["time","day","month","year"],ap=(l,t,n=void 0)=>{let a=n||new Date;const o=Cu([l,a]);o&&(a=o);const r=Su([t,a]);return r&&(a=r),a},op=e.defineComponent({components:{YearPicker:Hu,MonthPicker:Gu,DayPicker:Zu,TimePicker:lp},inheritAttrs:!1,props:{placeholder:{type:String,default:""},modelValue:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1},disabledTime:{type:Object,required:!1},upperLimit:{type:Date,required:!1},lowerLimit:{type:Date,required:!1},startingView:{type:String,required:!1,default:"day",validate:l=>typeof l=="string"&&Rt.includes(l)},startingViewDate:{type:Date,required:!1,default:()=>new Date},dayPickerHeadingFormat:{type:String,required:!1,default:"LLLL yyyy"},monthListFormat:{type:String,required:!1,default:"LLL"},weekdayFormat:{type:String,required:!1,default:"EE"},dayFormat:{type:String,required:!1,default:"dd"},inputFormat:{type:String,required:!1,default:"yyyy-MM-dd"},weekDayNames:{type:Array,required:!1},weekStartsOn:{type:Number,required:!1,default:1,validator:l=>[0,1,2,3,4,5,6].includes(l)},disabled:{type:Boolean,required:!1,default:!1},clearable:{type:Boolean,required:!1,default:!1},typeable:{type:Boolean,required:!1,default:!1},minimumView:{type:String,required:!1,default:"day",validate:l=>typeof l=="string"&&Rt.includes(l)}},emits:{"update:modelValue":l=>l==null||Ee(l),decadePageChanged:l=>!0,yearPageChanged:l=>!0,monthPageChanged:l=>!0,opened:()=>!0,closed:()=>!0},setup(l,{emit:t,attrs:n}){const a=e.ref("none"),o=e.ref(l.startingViewDate),r=e.ref(null),s=e.ref(!1),i=e.ref(""),c=O=>{const A=O.replace(/[a-zA-Z]/g,"0");return/0/.test(A)?A:""},d=e.computed(()=>c(l.inputFormat));let p=null,h=null;const E=()=>{p?.destroy(),p=null},k=async()=>{if(!h){const{default:O}=await Promise.resolve().then(()=>kn);h=O}return h},v=()=>{p&&p.value!==i.value&&(p.value=i.value??"")},f=async()=>{if(E(),!r.value||!d.value)return;p=(await k())(r.value,{mask:d.value,lazy:!0,overwrite:!0}),v()};e.watchEffect(()=>{if(!i.value)return;const O=al(i.value,l.inputFormat);O&&(o.value=O)}),e.watchEffect(()=>{i.value=l.modelValue&&Ee(l.modelValue)?Ot(l.modelValue,l.inputFormat):""}),e.onMounted(()=>{d.value&&e.nextTick(()=>{f()})}),e.onBeforeUnmount(()=>{E()}),e.watch(d,O=>{O?e.nextTick(()=>{f()}):E()}),e.watch(i,()=>{v()});const g=(O="none")=>{l.disabled||(O!=="none"&&a.value==="none"&&(o.value=l.modelValue||ap(l.lowerLimit,l.upperLimit,o.value)),a.value=O,t(O!=="none"?"opened":"closed"))};e.watchEffect(()=>{l.disabled&&(a.value="none")});const x=(O,A)=>{o.value=A,O==="year"?t("decadePageChanged",A):O==="month"?t("yearPageChanged",A):O==="day"&&t("monthPageChanged",A)},y=O=>{o.value=O,l.minimumView==="year"?(g("none"),t("update:modelValue",O)):a.value="month"},w=O=>{o.value=O,l.minimumView==="month"?(g("none"),t("update:modelValue",O)):a.value="day"},b=O=>{o.value=O,l.minimumView==="day"?(g("none"),t("update:modelValue",O)):a.value="time"},S=O=>{g("none"),t("update:modelValue",O)},M=()=>{l.clearable&&(g("none"),t("update:modelValue",null),o.value=l.startingViewDate)},B=()=>s.value=!0,T=()=>g(I.value),Z=()=>{s.value=!1,g()},J=O=>{const A=O.keyCode?O.keyCode:O.which;if([27,13].includes(A)&&r.value.blur(),l.typeable){const H=al(r.value.value,l.inputFormat);H&&i.value===Ot(H,l.inputFormat)&&(i.value=r.value.value,t("update:modelValue",H))}},I=e.computed(()=>{const O=Rt.indexOf(l.startingView),A=Rt.indexOf(l.minimumView);return O<A?l.minimumView:l.startingView}),F=O=>Object.fromEntries(Object.entries(O??{}).filter(([A,W])=>A.startsWith("--"))),R=e.computed(()=>l.weekDayNames?.length===7?l.weekDayNames:void 0);return{blur:Z,focus:T,click:B,input:i,inputRef:r,pageDate:o,renderView:g,updatePageDate:x,selectYear:y,selectMonth:w,selectDay:b,selectTime:S,keyUp:J,normalizedWeekdayNames:R,viewShown:a,goBackFromTimepicker:()=>l.startingView==="time"&&l.minimumView==="time"?null:a.value="day",clearModelValue:M,initialView:I,log:O=>console.log(O),variables:F}}}),rp={class:"v3dp__input_wrapper"},sp=["readonly","placeholder","disabled","tabindex"],ip={class:"v3dp__clearable"};function cp(l,t,n,a,o,r){const s=e.resolveComponent("year-picker"),i=e.resolveComponent("month-picker"),c=e.resolveComponent("day-picker"),d=e.resolveComponent("time-picker");return e.openBlock(),e.createElementBlock("div",{class:"v3dp__datepicker",style:e.normalizeStyle(l.variables(l.$attrs.style))},[e.createElementVNode("div",rp,[e.withDirectives(e.createElementVNode("input",e.mergeProps({type:"text",ref:"inputRef",readonly:!l.typeable,"onUpdate:modelValue":t[0]||(t[0]=p=>l.input=p)},l.$attrs,{placeholder:l.placeholder,disabled:l.disabled,tabindex:l.disabled?-1:0,onKeyup:t[1]||(t[1]=(...p)=>l.keyUp&&l.keyUp(...p)),onBlur:t[2]||(t[2]=(...p)=>l.blur&&l.blur(...p)),onFocus:t[3]||(t[3]=(...p)=>l.focus&&l.focus(...p)),onClick:t[4]||(t[4]=(...p)=>l.click&&l.click(...p))}),null,16,sp),[[e.vModelText,l.input]]),e.withDirectives(e.createElementVNode("div",ip,[e.renderSlot(l.$slots,"clear",{onClear:l.clearModelValue},()=>[e.createElementVNode("i",{onClick:t[5]||(t[5]=p=>l.clearModelValue())},"x")])],512),[[e.vShow,l.clearable&&l.modelValue]])]),e.withDirectives(e.createVNode(s,{pageDate:l.pageDate,"onUpdate:pageDate":t[6]||(t[6]=p=>l.updatePageDate("year",p)),selected:l.modelValue,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,onSelect:l.selectYear},null,8,["pageDate","selected","lowerLimit","upperLimit","onSelect"]),[[e.vShow,l.viewShown==="year"]]),e.withDirectives(e.createVNode(i,{pageDate:l.pageDate,"onUpdate:pageDate":t[7]||(t[7]=p=>l.updatePageDate("month",p)),selected:l.modelValue,onSelect:l.selectMonth,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,format:l.monthListFormat,onBack:t[8]||(t[8]=p=>l.viewShown="year")},null,8,["pageDate","selected","onSelect","lowerLimit","upperLimit","format"]),[[e.vShow,l.viewShown==="month"]]),e.withDirectives(e.createVNode(c,{pageDate:l.pageDate,"onUpdate:pageDate":t[9]||(t[9]=p=>l.updatePageDate("day",p)),selected:l.modelValue,weekStartsOn:l.weekStartsOn,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,headingFormat:l.dayPickerHeadingFormat,disabledDates:l.disabledDates,weekdayFormat:l.weekdayFormat,"allow-outside-interval":l.allowOutsideInterval,format:l.dayFormat,"custom-weekdays":l.normalizedWeekdayNames,onSelect:l.selectDay,onBack:t[10]||(t[10]=p=>l.viewShown="month")},null,8,["pageDate","selected","weekStartsOn","lowerLimit","upperLimit","headingFormat","disabledDates","weekdayFormat","allow-outside-interval","format","custom-weekdays","onSelect"]),[[e.vShow,l.viewShown==="day"]]),e.withDirectives(e.createVNode(d,{pageDate:l.pageDate,visible:l.viewShown==="time",selected:l.modelValue,disabledTime:l.disabledTime,onSelect:l.selectTime,onBack:l.goBackFromTimepicker},null,8,["pageDate","visible","selected","disabledTime","onSelect","onBack"]),[[e.vShow,l.viewShown==="time"]])],4)}const dp=ae(op,[["render",cp]]),up=ae(e.defineComponent({__name:"vs-input-date2",props:{clearable:{type:Boolean,default:!0},now:{type:Boolean},editable:{type:Boolean,default:!0},time:{type:Boolean},isInfinity:{type:Boolean},mode:{default:"date"},weekStart:{},dayNames:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,{inputClass:o}=Se(n.style),r=e.computed(()=>n.mode?n.mode:n.time?"datetime":"date"),s={date:"дд.мм.рррр",datetime:"дд.мм.рррр гг:хх",month:"мм.рррр",week:"рррр-тиждень",time:"гг:хх",year:"рррр"},i=e.computed(()=>n.placeholder||s[r.value]||""),c=e.computed(()=>["py-1.5 px-3 block w-full placeholder:text-[#767f8f] bg-white",o.value,n.customClass,{"!border-red-600":n.error}]),d=e.computed(()=>!n.modelValue&&n.now?new Date:null),p=e.computed({get:()=>w(n.modelValue??d.value,r.value)||void 0,set:A=>a("update:modelValue",b(A,r.value))}),h=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],E=e.computed(()=>{if(n.dayNames?.length)return n.dayNames.length===7?n.dayNames:h}),k=e.computed(()=>{const A=n.weekStart,W=typeof A=="string"?Number(A):A;return W===void 0||Number.isNaN(W)?1:Math.min(6,Math.max(0,W))}),v=e.computed(()=>{switch(r.value){case"time":return{startingView:"time",minimumView:"time"};case"month":return{startingView:"month",minimumView:"month"};case"year":return{startingView:"year",minimumView:"year"};case"datetime":return{startingView:"day",minimumView:"time"};default:return{startingView:"day",minimumView:"day"}}}),f={date:"dd.MM.yyyy",datetime:"dd.MM.yyyy HH:mm",month:"MM.yyyy",time:"HH:mm",week:"dd.MM.yyyy",year:"yyyy"},g=e.computed(()=>f[r.value]||"dd.MM.yyyy"),x=e.computed(()=>({"--vdp-selected-bg-color":n.style?.primaryColor||"#2563eb","--vdp-hover-bg-color":n.style?.primaryColor||"#2563eb","--vdp-selected-color":"#ffffff","--vdp-hover-color":"#ffffff","--vdp-border-radius":n.style?.size==="sm"?"6px":"8px","--vdp-elem-font-size":n.style?.size==="sm"?"0.75em":"0.85em"})),y=e.ref(!1);e.watch(()=>n.modelValue,A=>{A?y.value=!0:n.now||(y.value=!1)},{immediate:!0}),e.watchEffect(()=>{n.now&&!n.modelValue&&!y.value&&(a("update:modelValue",b(new Date,r.value)),y.value=!0)});function w(A,W){if(!A)return null;if(A instanceof Date&&!Number.isNaN(A.getTime()))return A;if(typeof A!="string")return null;switch(W){case"datetime":return T(A);case"time":return I(A);case"month":return Z(A);case"year":return J(A);case"week":return F(A);default:return B(A)}}function b(A,W){if(!A)return null;const H=A instanceof Date?A:w(A,W);if(!H)return null;switch(W){case"datetime":return`${S(H)}T${M(H)}`;case"time":return M(H);case"month":return`${H.getFullYear()}-${O(H.getMonth()+1)}`;case"year":return`${H.getFullYear()}`;case"week":{const{year:pe,week:me}=R(H);return`${pe}-W${O(me)}`}default:return S(H)}}function S(A){return`${A.getFullYear()}-${O(A.getMonth()+1)}-${O(A.getDate())}`}function M(A){return`${O(A.getHours())}:${O(A.getMinutes())}`}function B(A){const W=A.split("-");if(W.length<3)return null;const[H,pe,me]=W.map(Number);return!H||!pe||!me?null:new Date(H,pe-1,me)}function T(A){const W=A.includes("T")?A:A.replace(" ","T"),H=new Date(W);return Number.isNaN(H.getTime())?null:H}function Z(A){const[W,H]=A.split("-").map(Number);return!W||Number.isNaN(H)?null:new Date(W,(H||1)-1,1)}function J(A){const W=Number(A);return W?new Date(W,0,1):null}function I(A){const W=A.match(/^(\d{1,2}):(\d{2})$/);if(!W)return null;const[,H,pe]=W,me=new Date;return me.setHours(Number(H),Number(pe),0,0),me}function F(A){const W=A.match(/^(\d{4})-W(\d{2})$/);if(!W)return null;const[,H,pe]=W,me=Number(pe);return G(Number(H),me)}function R(A){const W=new Date(Date.UTC(A.getFullYear(),A.getMonth(),A.getDate())),H=W.getUTCDay()||7;W.setUTCDate(W.getUTCDate()+4-H);const pe=new Date(Date.UTC(W.getUTCFullYear(),0,1)),me=Math.ceil(((W.getTime()-pe.getTime())/864e5+1)/7);return{year:W.getUTCFullYear(),week:me}}function G(A,W){if(!A||!W)return null;const H=new Date(A,0,1+(W-1)*7),pe=H.getDay(),me=H;return pe<=4?me.setDate(H.getDate()-H.getDay()+1):me.setDate(H.getDate()+8-H.getDay()),me}function O(A){return String(A).padStart(2,"0")}return(A,W)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vs-date-picker",n.customClass]),style:e.normalizeStyle(x.value)},[e.createVNode(dp,{modelValue:p.value,"onUpdate:modelValue":W[0]||(W[0]=H=>p.value=H),placeholder:i.value,disabled:n.disabled,clearable:n.clearable,typeable:n.editable,"week-day-names":E.value,"week-starts-on":k.value,"starting-view":v.value.startingView,"minimum-view":v.value.minimumView,"input-format":g.value,name:n.name,class:e.normalizeClass(c.value)},null,8,["modelValue","placeholder","disabled","clearable","typeable","week-day-names","week-starts-on","starting-view","minimum-view","input-format","name","class"])],6))}}),[["__scopeId","data-v-97661afe"]]),rl=(l={mode:"edit",schema:null})=>new Promise(t=>{const{close:n}=ge.modal({title:l.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Zn,contentProps:{...l,onClose:()=>{t(null),n()},onSave:a=>{t(a),n()}}})});He.install=function(t){t.component("VForm",He),Object.assign(t.config.globalProperties,{$form:rl}),t.provide("form",rl),window.v3plugin||(window.v3plugin={})};function Ke(l){return typeof l=="string"||l instanceof String}function sl(l){var t;return typeof l=="object"&&l!=null&&(l==null||(t=l.constructor)==null?void 0:t.name)==="Object"}function il(l,t){return Array.isArray(t)?il(l,(n,a)=>t.includes(a)):Object.entries(l).reduce((n,a)=>{let[o,r]=a;return t(r,o)&&(n[o]=r),n},{})}const Q={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function cl(l){switch(l){case Q.LEFT:return Q.FORCE_LEFT;case Q.RIGHT:return Q.FORCE_RIGHT;default:return l}}function fn(l){return l.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function jt(l,t){if(t===l)return!0;const n=Array.isArray(t),a=Array.isArray(l);let o;if(n&&a){if(t.length!=l.length)return!1;for(o=0;o<t.length;o++)if(!jt(t[o],l[o]))return!1;return!0}if(n!=a)return!1;if(t&&l&&typeof t=="object"&&typeof l=="object"){const r=t instanceof Date,s=l instanceof Date;if(r&&s)return t.getTime()==l.getTime();if(r!=s)return!1;const i=t instanceof RegExp,c=l instanceof RegExp;if(i&&c)return t.toString()==l.toString();if(i!=c)return!1;const d=Object.keys(t);for(o=0;o<d.length;o++)if(!Object.prototype.hasOwnProperty.call(l,d[o]))return!1;for(o=0;o<d.length;o++)if(!jt(l[d[o]],t[d[o]]))return!1;return!0}else if(t&&l&&typeof t=="function"&&typeof l=="function")return t.toString()===l.toString();return!1}class pp{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?Q.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?Q.RIGHT:Q.LEFT}}function se(l,t){return new se.InputMask(l,t)}function dl(l){if(l==null)throw new Error("mask property should be defined");return l instanceof RegExp?se.MaskedRegExp:Ke(l)?se.MaskedPattern:l===Date?se.MaskedDate:l===Number?se.MaskedNumber:Array.isArray(l)||l===Array?se.MaskedDynamic:se.Masked&&l.prototype instanceof se.Masked?l:se.Masked&&l instanceof se.Masked?l.constructor:l instanceof Function?se.MaskedFunction:(console.warn("Mask not found for mask",l),se.Masked)}function at(l){if(!l)throw new Error("Options in not defined");if(se.Masked){if(l.prototype instanceof se.Masked)return{mask:l};const{mask:t=void 0,...n}=l instanceof se.Masked?{mask:l}:sl(l)&&l.mask instanceof se.Masked?l:{};if(t){const a=t.mask;return{...il(t,(o,r)=>!r.startsWith("_")),mask:t.constructor,_mask:a,...n}}}return sl(l)?{...l}:{mask:l}}function je(l){if(se.Masked&&l instanceof se.Masked)return l;const t=at(l),n=dl(t.mask);if(!n)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===n&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new n(t)}se.createMask=je;class Pt{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return t??this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return t??this.value.length}select(t,n){if(!(t==null||n==null||t===this.selectionStart&&n===this.selectionEnd))try{this._unsafeSelect(t,n)}catch{}}get isActive(){return!1}}se.MaskElement=Pt;const ul=90,mp=89;class mt extends Pt{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,n,a;return(t=(n=(a=this.input).getRootNode)==null?void 0:n.call(a))!=null?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){if(this._handlers.redo&&(t.keyCode===ul&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===mp&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===ul&&(t.metaKey||t.ctrlKey))return t.preventDefault(),this._handlers.undo(t);t.isComposing||this._handlers.selectionChange(t)}_onBeforeinput(t){if(t.inputType==="historyUndo"&&this._handlers.undo)return t.preventDefault(),this._handlers.undo(t);if(t.inputType==="historyRedo"&&this._handlers.redo)return t.preventDefault(),this._handlers.redo(t)}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}se.HTMLMaskElement=mt;class pl extends mt{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,n){this.input.setSelectionRange(t,n)}get value(){return this.input.value}set value(t){this.input.value=t}}se.HTMLMaskElement=mt;class hn extends mt{get _unsafeSelectionStart(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),a=n&&n.anchorOffset,o=n&&n.focusOffset;return o==null||a==null||a<o?a:o}get _unsafeSelectionEnd(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),a=n&&n.anchorOffset,o=n&&n.focusOffset;return o==null||a==null||a>o?a:o}_unsafeSelect(t,n){if(!this.rootElement.createRange)return;const a=this.rootElement.createRange();a.setStart(this.input.firstChild||this.input,t),a.setEnd(this.input.lastChild||this.input,n);const o=this.rootElement,r=o.getSelection&&o.getSelection();r&&(r.removeAllRanges(),r.addRange(a))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}se.HTMLContenteditableMaskElement=hn;class Ut{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>Ut.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}Ut.MAX_LENGTH=100;class ml{constructor(t,n){this.el=t instanceof Pt?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new hn(t):new pl(t),this.masked=je(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Ut,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(t){var n;return t==null||((n=this.masked)==null?void 0:n.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof se.Masked)&&this.masked.constructor===dl(t)){this.masked.updateOptions({mask:t});return}const n=t instanceof se.Masked?t:je({mask:t});n.unmaskedValue=this.masked.unmaskedValue,this.masked=n}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,n){const a=this._listeners[t];a&&a.forEach(o=>o(n))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){!this.el||!this.el.isActive||(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const n=this.masked.unmaskedValue,a=this.masked.value,o=this.masked.rawInputValue,r=this.displayValue,s=this.unmaskedValue!==n||this.value!==a||this._rawInputValue!==o;this._unmaskedValue=n,this._value=a,this._rawInputValue=o,this.el.value!==r&&(this.el.value=r),t==="auto"?this.alignCursor():t!=null&&(this.cursorPos=t),s&&this._fireChangeEvents(),!this._historyChanging&&(s||this.history.isEmpty)&&this.history.push({unmaskedValue:n,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:n,...a}=t,o=!this.maskEquals(n),r=this.masked.optionsIsChanged(a);o&&(this.mask=n),r&&this.masked.updateOptions(a),(o||r)&&this.updateControl()}updateCursor(t){t!=null&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,Q.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,n){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(n),this}off(t,n){if(!this._listeners[t])return this;if(!n)return delete this._listeners[t],this;const a=this._listeners[t].indexOf(n);return a>=0&&this._listeners[t].splice(a,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const n=new pp({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),a=this.masked.rawInputValue,o=this.masked.splice(n.startChangePos,n.removed.length,n.inserted,n.removeDirection,{input:!0,raw:!0}).offset,r=a===this.masked.rawInputValue?n.removeDirection:Q.NONE;let s=this.masked.nearestInputPos(n.startChangePos+o,r);r!==Q.NONE&&(s=this.masked.nearestInputPos(s,Q.NONE)),this.updateControl(s),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}se.InputMask=ml;class ce{static normalize(t){return Array.isArray(t)?t:[t,new ce]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}se.ChangeDetails=ce;class Pe{constructor(t,n,a){t===void 0&&(t=""),n===void 0&&(n=0),this.value=t,this.from=n,this.stop=a}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||t!=null&&this.from>=t)return"";const n=this.value[0];return this.value=this.value.slice(1),n}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class Ve{constructor(t){this._value="",this._update({...Ve.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,n){n===void 0&&(n={input:!0}),this.reset(),this.append(t,n,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,n){return t}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),Math.min(this.displayValue.length,n-t)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this.displayValue.slice(t,n)}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new Pe(this.extractInput(t,n),t)}appendTail(t){return Ke(t)&&(t=new Pe(String(t))),t.appendTo(this)}_appendCharRaw(t,n){return t?(this._value+=t,new ce({inserted:t,rawInserted:t})):new ce}_appendChar(t,n,a){n===void 0&&(n={});const o=this.state;let r;if([t,r]=this.doPrepareChar(t,n),t&&(r=r.aggregate(this._appendCharRaw(t,n)),!r.rawInserted&&this.autofix==="pad")){const s=this.state;this.state=o;let i=this.pad(n);const c=this._appendCharRaw(t,n);i=i.aggregate(c),c.rawInserted||i.equals(r)?r=i:this.state=s}if(r.inserted){let s,i=this.doValidate(n)!==!1;if(i&&a!=null){const c=this.state;if(this.overwrite===!0){s=a.state;for(let p=0;p<r.rawInserted.length;++p)a.unshift(this.displayValue.length-r.tailShift)}let d=this.appendTail(a);if(i=d.rawInserted.length===a.toString().length,!(i&&d.inserted)&&this.overwrite==="shift"){this.state=c,s=a.state;for(let p=0;p<r.rawInserted.length;++p)a.shift();d=this.appendTail(a),i=d.rawInserted.length===a.toString().length}i&&d.inserted&&(this.state=c)}i||(r=new ce,this.state=o,a&&s&&(a.state=s))}return r}_appendPlaceholder(){return new ce}_appendEager(){return new ce}append(t,n,a){if(!Ke(t))throw new Error("value should be string");const o=Ke(a)?new Pe(String(a)):a;n!=null&&n.tail&&(n._beforeTailState=this.state);let r;[t,r]=this.doPrepare(t,n);for(let s=0;s<t.length;++s){const i=this._appendChar(t[s],n,o);if(!i.rawInserted&&!this.doSkipInvalid(t[s],n,o))break;r.aggregate(i)}return(this.eager===!0||this.eager==="append")&&n!=null&&n.input&&t&&r.aggregate(this._appendEager()),o!=null&&(r.tailShift+=this.appendTail(o).tailShift),r}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(n),new ce}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const n=this.rawInputValue,a=this.value,o=t();return this.rawInputValue=n,this.value&&this.value!==a&&a.indexOf(this.value)===0&&(this.append(a.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,o}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const n=this.state,a=t(this);return this.state=n,delete this._isolated,a}doSkipInvalid(t,n,a){return!!this.skipInvalid}doPrepare(t,n){return n===void 0&&(n={}),ce.normalize(this.prepare?this.prepare(t,this,n):t)}doPrepareChar(t,n){return n===void 0&&(n={}),ce.normalize(this.prepareChar?this.prepareChar(t,this,n):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,n,a,o,r){a===void 0&&(a=""),o===void 0&&(o=Q.NONE),r===void 0&&(r={input:!0});const s=t+n,i=this.extractTail(s),c=this.eager===!0||this.eager==="remove";let d;c&&(o=cl(o),d=this.extractInput(0,s,{raw:!0}));let p=t;const h=new ce;if(o!==Q.NONE&&(p=this.nearestInputPos(t,n>1&&t!==0&&!c?Q.NONE:o),h.tailShift=p-t),h.aggregate(this.remove(p)),c&&o!==Q.NONE&&d===this.rawInputValue)if(o===Q.FORCE_LEFT){let E;for(;d===this.rawInputValue&&(E=this.displayValue.length);)h.aggregate(new ce({tailShift:-1})).aggregate(this.remove(E-1))}else o===Q.FORCE_RIGHT&&i.unshift();return h.aggregate(this.append(a,r,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!jt(this,t)}typedValueEquals(t){const n=this.typedValue;return t===n||Ve.EMPTY_VALUES.includes(t)&&Ve.EMPTY_VALUES.includes(n)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new ce}}Ve.DEFAULTS={skipInvalid:!0},Ve.EMPTY_VALUES=[void 0,null,""],se.Masked=Ve;class Ge{constructor(t,n){t===void 0&&(t=[]),n===void 0&&(n=0),this.chunks=t,this.from=n}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=Ke(t)?new Pe(String(t)):t;const n=this.chunks[this.chunks.length-1],a=n&&(n.stop===t.stop||t.stop==null)&&t.from===n.from+n.toString().length;if(t instanceof Pe)a?n.extend(t.toString()):this.chunks.push(t);else if(t instanceof Ge){if(t.stop==null){let o;for(;t.chunks.length&&t.chunks[0].stop==null;)o=t.chunks.shift(),o.from+=t.from,this.extend(o)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof se.MaskedPattern))return new Pe(this.toString()).appendTo(t);const n=new ce;for(let a=0;a<this.chunks.length;++a){const o=this.chunks[a],r=t._mapPosToBlock(t.displayValue.length),s=o.stop;let i;if(s!=null&&(!r||r.index<=s)&&((o instanceof Ge||t._stops.indexOf(s)>=0)&&n.aggregate(t._appendPlaceholder(s)),i=o instanceof Ge&&t._blocks[s]),i){const c=i.appendTail(o);n.aggregate(c);const d=o.toString().slice(c.rawInserted.length);d&&n.aggregate(t.append(d,{tail:!0}))}else n.aggregate(t.append(o.toString(),{tail:!0}))}return n}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:n,...a}=t;Object.assign(this,a),this.chunks=n.map(o=>{const r="chunks"in o?new Ge:new Pe;return r.state=o,r})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const n=t!=null?t-this.from:t;let a=0;for(;a<this.chunks.length;){const o=this.chunks[a],r=o.unshift(n);if(o.toString()){if(!r)break;++a}else this.chunks.splice(a,1);if(r)return r}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const n=this.chunks[t],a=n.shift();if(n.toString()){if(!a)break;--t}else this.chunks.splice(t,1);if(a)return a}return""}}class fp{constructor(t,n){this.masked=t,this._log=[];const{offset:a,index:o}=t._mapPosToBlock(n)||(n<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=a,this.index=o,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((n=this.block)==null?void 0:n.displayValue.length)||0){var n;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,Q.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,Q.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Q.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,Q.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,Q.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,Q.NONE),!0})}}class gn{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(n),this._value||(this._isRawInput=!1),new ce}nearestInputPos(t,n){n===void 0&&(n=Q.NONE);const a=0,o=this._value.length;switch(n){case Q.LEFT:case Q.FORCE_LEFT:return a;case Q.NONE:case Q.RIGHT:case Q.FORCE_RIGHT:default:return o}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._isRawInput?n-t:0}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),a===void 0&&(a={}),a.raw&&this._isRawInput&&this._value.slice(t,n)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new ce;const a=this.eager===!0||this.eager==="append",r=this.char===t&&(this.isUnmasking||n.input||n.raw)&&(!n.raw||!a)&&!n.tail,s=new ce({inserted:this.char,rawInserted:r?this.char:""});return this._value=this.char,this._isRawInput=r&&(n.raw||n.input),s}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new ce;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new Pe("")}appendTail(t){return Ke(t)&&(t=new Pe(String(t))),t.appendTo(this)}append(t,n,a){const o=this._appendChar(t[0],n);return a!=null&&(o.tailShift+=this.appendTail(a).tailShift),o}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=!!t._rawInputValue}pad(t){return this._appendPlaceholder()}}class ft{constructor(t){const{parent:n,isOptional:a,placeholderChar:o,displayChar:r,lazy:s,eager:i,...c}=t;this.masked=je(c),Object.assign(this,{parent:n,isOptional:a,placeholderChar:o,displayChar:r,lazy:s,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),t===0&&n>=1?(this.isFilled=!1,this.masked.remove(t,n)):new ce}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new ce;const a=this.masked.state;let o=this.masked._appendChar(t,this.currentMaskFlags(n));return o.inserted&&this.doValidate(n)===!1&&(o=new ce,this.masked.state=a),!o.inserted&&!this.isOptional&&!this.lazy&&!n.input&&(o.inserted=this.placeholderChar),o.skip=!o.inserted&&!this.isOptional,this.isFilled=!!o.inserted,o}append(t,n,a){return this.masked.append(t,this.currentMaskFlags(n),a)}_appendPlaceholder(){return this.isFilled||this.isOptional?new ce:(this.isFilled=!0,new ce({inserted:this.placeholderChar}))}_appendEager(){return new ce}extractTail(t,n){return this.masked.extractTail(t,n)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.masked.extractInput(t,n,a)}nearestInputPos(t,n){n===void 0&&(n=Q.NONE);const a=0,o=this.value.length,r=Math.min(Math.max(t,a),o);switch(n){case Q.LEFT:case Q.FORCE_LEFT:return this.isComplete?r:a;case Q.RIGHT:case Q.FORCE_RIGHT:return this.isComplete?r:o;case Q.NONE:default:return r}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.value.slice(t,n).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var n;return{...t,_beforeTailState:(t==null||(n=t._beforeTailState)==null?void 0:n.masked)||t?._beforeTailState}}pad(t){return new ce}}ft.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class fl extends Ve{updateOptions(t){super.updateOptions(t)}_update(t){const n=t.mask;n&&(t.validate=a=>a.search(n)>=0),super._update(t)}}se.MaskedRegExp=fl;class Be extends Ve{constructor(t){super({...Be.DEFAULTS,...t,definitions:Object.assign({},ft.DEFAULT_DEFINITIONS,t?.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const n=this.mask;if(!n||!t)return;let a=!1,o=!1;for(let r=0;r<n.length;++r){if(this.blocks){const d=n.slice(r),p=Object.keys(this.blocks).filter(E=>d.indexOf(E)===0);p.sort((E,k)=>k.length-E.length);const h=p[0];if(h){const{expose:E,repeat:k,...v}=at(this.blocks[h]),f={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...v,repeat:k,parent:this},g=k!=null?new se.RepeatBlock(f):je(f);g&&(this._blocks.push(g),E&&(this.exposeBlock=g),this._maskedBlocks[h]||(this._maskedBlocks[h]=[]),this._maskedBlocks[h].push(this._blocks.length-1)),r+=h.length-1;continue}}let s=n[r],i=s in t;if(s===Be.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){a=!a;continue}if(s==="["||s==="]"){o=!o;continue}if(s===Be.ESCAPE_CHAR){if(++r,s=n[r],!s)break;i=!1}const c=i?new ft({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...at(t[s]),parent:this}):new gn({char:s,eager:this.eager,isUnmasking:a});this._blocks.push(c)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:n,...a}=t;this._blocks.forEach((o,r)=>o.state=n[r]),super.state=a}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,n)=>t+=n.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(n),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,n)=>t+=n.value,"")}set value(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(n),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(n),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,n)=>t+=n.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const n=new ce;let a=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(a==null)return n;this._blocks[a].isFilled&&++a;for(let o=a;o<this._blocks.length;++o){const r=this._blocks[o]._appendEager();if(!r.inserted)break;n.aggregate(r)}return n}_appendCharRaw(t,n){n===void 0&&(n={});const a=this._mapPosToBlock(this.displayValue.length),o=new ce;if(!a)return o;for(let s=a.index,i;i=this._blocks[s];++s){var r;const c=i._appendChar(t,{...n,_beforeTailState:(r=n._beforeTailState)==null||(r=r._blocks)==null?void 0:r[s]});if(o.aggregate(c),c.consumed)break}return o}extractTail(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=new Ge;return t===n||this._forEachBlocksInRange(t,n,(o,r,s,i)=>{const c=o.extractTail(s,i);c.stop=this._findStopBefore(r),c.from=this._blockStartPos(r),c instanceof Ge&&(c.blockIndex=r),a.extend(c)}),a}extractInput(t,n,a){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),a===void 0&&(a={}),t===n)return"";let o="";return this._forEachBlocksInRange(t,n,(r,s,i,c)=>{o+=r.extractInput(i,c,a)}),o}_findStopBefore(t){let n;for(let a=0;a<this._stops.length;++a){const o=this._stops[a];if(o<=t)n=o;else break}return n}_appendPlaceholder(t){const n=new ce;if(this.lazy&&t==null)return n;const a=this._mapPosToBlock(this.displayValue.length);if(!a)return n;const o=a.index,r=t??this._blocks.length;return this._blocks.slice(o,r).forEach(s=>{if(!s.lazy||t!=null){var i;n.aggregate(s._appendPlaceholder((i=s._blocks)==null?void 0:i.length))}}),n}_mapPosToBlock(t){let n="";for(let a=0;a<this._blocks.length;++a){const o=this._blocks[a],r=n.length;if(n+=o.displayValue,t<=n.length)return{index:a,offset:t-r}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((n,a)=>n+=a.displayValue.length,0)}_forEachBlocksInRange(t,n,a){n===void 0&&(n=this.displayValue.length);const o=this._mapPosToBlock(t);if(o){const r=this._mapPosToBlock(n),s=r&&o.index===r.index,i=o.offset,c=r&&s?r.offset:this._blocks[o.index].displayValue.length;if(a(this._blocks[o.index],o.index,i,c),r&&!s){for(let d=o.index+1;d<r.index;++d)a(this._blocks[d],d,0,this._blocks[d].displayValue.length);a(this._blocks[r.index],r.index,0,r.offset)}}}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=super.remove(t,n);return this._forEachBlocksInRange(t,n,(o,r,s,i)=>{a.aggregate(o.remove(s,i))}),a}nearestInputPos(t,n){if(n===void 0&&(n=Q.NONE),!this._blocks.length)return 0;const a=new fp(this,t);if(n===Q.NONE)return a.pushRightBeforeInput()||(a.popState(),a.pushLeftBeforeInput())?a.pos:this.displayValue.length;if(n===Q.LEFT||n===Q.FORCE_LEFT){if(n===Q.LEFT){if(a.pushRightBeforeFilled(),a.ok&&a.pos===t)return t;a.popState()}if(a.pushLeftBeforeInput(),a.pushLeftBeforeRequired(),a.pushLeftBeforeFilled(),n===Q.LEFT){if(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.ok&&a.pos<=t||(a.popState(),a.ok&&a.pos<=t))return a.pos;a.popState()}return a.ok?a.pos:n===Q.FORCE_LEFT?0:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:0)}return n===Q.RIGHT||n===Q.FORCE_RIGHT?(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.pushRightBeforeFilled()?a.pos:n===Q.FORCE_RIGHT?this.displayValue.length:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:this.nearestInputPos(t,Q.LEFT))):t}totalInputPositions(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);let a=0;return this._forEachBlocksInRange(t,n,(o,r,s,i)=>{a+=o.totalInputPositions(s,i)}),a}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const n=this._maskedBlocks[t];return n?n.map(a=>this._blocks[a]):[]}pad(t){const n=new ce;return this._forEachBlocksInRange(0,this.displayValue.length,a=>n.aggregate(a.pad(t))),n}}Be.DEFAULTS={...Ve.DEFAULTS,lazy:!0,placeholderChar:"_"},Be.STOP_CHAR="`",Be.ESCAPE_CHAR="\\",Be.InputDefinition=ft,Be.FixedDefinition=gn,se.MaskedPattern=Be;class ht extends Be{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:n=this.to||0,from:a=this.from||0,maxLength:o=this.maxLength||0,autofix:r=this.autofix,...s}=t;this.to=n,this.from=a,this.maxLength=Math.max(String(n).length,o),this.autofix=r;const i=String(this.from).padStart(this.maxLength,"0"),c=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<c.length&&c[d]===i[d];)++d;s.mask=c.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(s)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let n="",a="";const[,o,r]=t.match(/^(\D*)(\d*)(\D*)/)||[];return r&&(n="0".repeat(o.length)+r,a="9".repeat(o.length)+r),n=n.padEnd(this.maxLength,"0"),a=a.padEnd(this.maxLength,"9"),[n,a]}doPrepareChar(t,n){n===void 0&&(n={});let a;return[t,a]=super.doPrepareChar(t.replace(/\D/g,""),n),t||(a.skip=!this.isComplete),[t,a]}_appendCharRaw(t,n){if(n===void 0&&(n={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,n);const a=String(this.from).padStart(this.maxLength,"0"),o=String(this.to).padStart(this.maxLength,"0"),[r,s]=this.boundaries(this.value+t);return Number(s)<this.from?super._appendCharRaw(a[this.value.length],n):Number(r)>this.to?!n.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(a[this.value.length],n).aggregate(this._appendCharRaw(t,n)):super._appendCharRaw(o[this.value.length],n):super._appendCharRaw(t,n)}doValidate(t){const n=this.value;if(n.search(/[^0]/)===-1&&n.length<=this._matchFrom)return!0;const[o,r]=this.boundaries(n);return this.from<=Number(r)&&Number(o)<=this.to&&super.doValidate(t)}pad(t){const n=new ce;if(this.value.length===this.maxLength)return n;const a=this.value,o=this.maxLength-this.value.length;if(o){this.reset();for(let r=0;r<o;++r)n.aggregate(super._appendCharRaw("0",t));a.split("").forEach(r=>this._appendCharRaw(r))}return n}}se.MaskedRange=ht;const hp="d{.}`m{.}`Y";class Ue extends Be{static extractPatternOptions(t){const{mask:n,pattern:a,...o}=t;return{...o,mask:Ke(n)?n:a}}constructor(t){super(Ue.extractPatternOptions({...Ue.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:n,pattern:a,blocks:o,...r}={...Ue.DEFAULTS,...t},s=Object.assign({},Ue.GET_DEFAULT_BLOCKS());t.min&&(s.Y.from=t.min.getFullYear()),t.max&&(s.Y.to=t.max.getFullYear()),t.min&&t.max&&s.Y.from===s.Y.to&&(s.m.from=t.min.getMonth()+1,s.m.to=t.max.getMonth()+1,s.m.from===s.m.to&&(s.d.from=t.min.getDate(),s.d.to=t.max.getDate())),Object.assign(s,this.blocks,o),super._update({...r,mask:Ke(n)?n:a,blocks:s})}doValidate(t){const n=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&n!=null&&(this.min==null||this.min<=n)&&(this.max==null||n<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(Ue.extractPatternOptions(t))}}Ue.GET_DEFAULT_BLOCKS=()=>({d:{mask:ht,from:1,to:31,maxLength:2},m:{mask:ht,from:1,to:12,maxLength:2},Y:{mask:ht,from:1900,to:9999}}),Ue.DEFAULTS={...Be.DEFAULTS,mask:Date,pattern:hp,format:(l,t)=>{if(!l)return"";const n=String(l.getDate()).padStart(2,"0"),a=String(l.getMonth()+1).padStart(2,"0"),o=l.getFullYear();return[n,a,o].join(".")},parse:(l,t)=>{const[n,a,o]=l.split(".").map(Number);return new Date(o,a-1,n)}},se.MaskedDate=Ue;class gt extends Ve{constructor(t){super({...gt.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map(n=>{const{expose:a,...o}=at(n),r=je({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...o});return a&&(this.exposeMask=r),r}):[])}_appendCharRaw(t,n){n===void 0&&(n={});const a=this._applyDispatch(t,n);return this.currentMask&&a.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(n))),a}_applyDispatch(t,n,a){t===void 0&&(t=""),n===void 0&&(n={}),a===void 0&&(a="");const o=n.tail&&n._beforeTailState!=null?n._beforeTailState._value:this.value,r=this.rawInputValue,s=n.tail&&n._beforeTailState!=null?n._beforeTailState._rawInputValue:r,i=r.slice(s.length),c=this.currentMask,d=new ce,p=c?.state;return this.currentMask=this.doDispatch(t,{...n},a),this.currentMask&&(this.currentMask!==c?(this.currentMask.reset(),s&&(this.currentMask.append(s,{raw:!0}),d.tailShift=this.currentMask.value.length-o.length),i&&(d.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):p&&(this.currentMask.state=p)),d}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const n=new ce;return t&&n.aggregate(this._applyDispatch("",{},t)),n.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var n,a;return{...t,_beforeTailState:((n=t._beforeTailState)==null?void 0:n.currentMaskRef)===this.currentMask&&((a=t._beforeTailState)==null?void 0:a.currentMask)||t._beforeTailState}}doDispatch(t,n,a){return n===void 0&&(n={}),a===void 0&&(a=""),this.dispatch(t,this,n,a)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,n){n===void 0&&(n={});let[a,o]=super.doPrepare(t,n);if(this.currentMask){let r;[a,r]=super.doPrepare(a,this.currentMaskFlags(n)),o=o.aggregate(r)}return[a,o]}doPrepareChar(t,n){n===void 0&&(n={});let[a,o]=super.doPrepareChar(t,n);if(this.currentMask){let r;[a,r]=super.doPrepareChar(a,this.currentMaskFlags(n)),o=o.aggregate(r)}return[a,o]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(n=>n.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask){this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,this._applyDispatch();return}let n=String(t);this.currentMask&&(this.currentMask.typedValue=t,n=this.currentMask.unmaskedValue),this.unmaskedValue=n}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return!!((t=this.currentMask)!=null&&t.isComplete)}get isFilled(){var t;return!!((t=this.currentMask)!=null&&t.isFilled)}remove(t,n){const a=new ce;return this.currentMask&&a.aggregate(this.currentMask.remove(t,n)).aggregate(this._applyDispatch()),a}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(n=>n.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:n,currentMaskRef:a,currentMask:o,...r}=t;n&&this.compiledMasks.forEach((s,i)=>s.state=n[i]),a!=null&&(this.currentMask=a,this.currentMask.state=o),super.state=r}extractInput(t,n,a){return this.currentMask?this.currentMask.extractInput(t,n,a):""}extractTail(t,n){return this.currentMask?this.currentMask.extractTail(t,n):super.extractTail(t,n)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,n){return this.currentMask?this.currentMask.nearestInputPos(t,n):super.nearestInputPos(t,n)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((n,a)=>{if(!t[a])return;const{mask:o,...r}=t[a];return jt(n,r)&&n.maskEquals(o)}):super.maskEquals(t)}typedValueEquals(t){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(t))}}gt.DEFAULTS={...Ve.DEFAULTS,dispatch:(l,t,n,a)=>{if(!t.compiledMasks.length)return;const o=t.rawInputValue,r=t.compiledMasks.map((s,i)=>{const c=t.currentMask===s,d=c?s.displayValue.length:s.nearestInputPos(s.displayValue.length,Q.FORCE_LEFT);return s.rawInputValue!==o?(s.reset(),s.append(o,{raw:!0})):c||s.remove(d),s.append(l,t.currentMaskFlags(n)),s.appendTail(a),{index:i,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(d,s.nearestInputPos(s.displayValue.length,Q.FORCE_LEFT)))}});return r.sort((s,i)=>i.weight-s.weight||i.totalInputPositions-s.totalInputPositions),t.compiledMasks[r[0].index]}},se.MaskedDynamic=gt;class yt extends Be{constructor(t){super({...yt.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:n,...a}=t;if(n){const o=n.map(i=>i.length),r=Math.min(...o),s=Math.max(...o)-r;a.mask="*".repeat(r),s&&(a.mask+="["+"*".repeat(s)+"]"),this.enum=n}super._update(a)}_appendCharRaw(t,n){n===void 0&&(n={});const a=Math.min(this.nearestInputPos(0,Q.FORCE_RIGHT),this.value.length),o=this.enum.filter(r=>this.matchValue(r,this.unmaskedValue+t,a));if(o.length){o.length===1&&this._forEachBlocksInRange(0,this.value.length,(s,i)=>{const c=o[0][i];i>=this.value.length||c===s.value||(s.reset(),s._appendChar(c,n))});const r=super._appendCharRaw(o[0][this.value.length],n);return o.length===1&&o[0].slice(this.unmaskedValue.length).split("").forEach(s=>r.aggregate(super._appendCharRaw(s))),r}return new ce({skip:!this.isComplete})}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new Pe("",t)}remove(t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),t===n)return new ce;const a=Math.min(super.nearestInputPos(0,Q.FORCE_RIGHT),this.value.length);let o;for(o=t;o>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(a,o),a)).length>1);--o);const r=super.remove(o,n);return r.tailShift+=o-t,r}get isComplete(){return this.enum.indexOf(this.value)>=0}}yt.DEFAULTS={...Be.DEFAULTS,matchValue:(l,t,n)=>l.indexOf(t,n)===n},se.MaskedEnum=yt;class hl extends Ve{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}se.MaskedFunction=hl;var gl;class De extends Ve{constructor(t){super({...De.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",a=(this.scale?"("+fn(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+n+a),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(fn).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(fn(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const n=t.split(this.radix);return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),n.join(this.radix)}doPrepareChar(t,n){n===void 0&&(n={});const[a,o]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(n.input&&n.raw||!n.input&&!n.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),n);return t&&!a&&(o.skip=!0),a&&!this.allowPositive&&!this.value&&a!=="-"&&o.aggregate(this._appendChar("-")),[a,o]}_separatorsCount(t,n){n===void 0&&(n=!1);let a=0;for(let o=0;o<t;++o)this._value.indexOf(this.thousandsSeparator,o)===o&&(++a,n&&(t+=this.thousandsSeparator.length));return a}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n),this._removeThousandsSeparators(super.extractInput(t,n,a))}_appendCharRaw(t,n){n===void 0&&(n={});const a=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,o=this._separatorsCountFromSlice(a);this._value=this._removeThousandsSeparators(this.value);const r=this._value;this._value+=t;const s=this.number;let i=!isNaN(s),c=!1;if(i){let E;this.min!=null&&this.min<0&&this.number<this.min&&(E=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(E=this.max),E!=null&&(this.autofix?(this._value=this.format(E,this).replace(De.UNMASKED_RADIX,this.radix),c||(c=r===this._value&&!n.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let d;i?d=new ce({inserted:this._value.slice(r.length),rawInserted:c?"":t,skip:c}):(this._value=r,d=new ce),this._value=this._insertThousandsSeparators(this._value);const p=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,h=this._separatorsCountFromSlice(p);return d.tailShift+=(h-o)*this.thousandsSeparator.length,d}_findSeparatorAround(t){if(this.thousandsSeparator){const n=t-this.thousandsSeparator.length+1,a=this.value.indexOf(this.thousandsSeparator,n);if(a<=t)return a}return-1}_adjustRangeWithSeparators(t,n){const a=this._findSeparatorAround(t);a>=0&&(t=a);const o=this._findSeparatorAround(n);return o>=0&&(n=o+this.thousandsSeparator.length),[t,n]}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n);const a=this.value.slice(0,t),o=this.value.slice(n),r=this._separatorsCount(a.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(a+o));const s=this._separatorsCountFromSlice(a);return new ce({tailShift:(s-r)*this.thousandsSeparator.length})}nearestInputPos(t,n){if(!this.thousandsSeparator)return t;switch(n){case Q.NONE:case Q.LEFT:case Q.FORCE_LEFT:{const a=this._findSeparatorAround(t-1);if(a>=0){const o=a+this.thousandsSeparator.length;if(t<o||this.value.length<=o||n===Q.FORCE_LEFT)return a}break}case Q.RIGHT:case Q.FORCE_RIGHT:{const a=this._findSeparatorAround(t);if(a>=0)return a+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let n=t;this.min!=null&&(n=Math.max(n,this.min)),this.max!=null&&(n=Math.min(n,this.max)),n!==t&&(this.unmaskedValue=this.format(n,this));let a=this.value;this.normalizeZeros&&(a=this._normalizeZeros(a)),this.padFractionalZeros&&this.scale>0&&(a=this._padFractionalZeros(a)),this._value=a}super.doCommit()}_normalizeZeros(t){const n=this._removeThousandsSeparators(t).split(this.radix);return n[0]=n[0].replace(/^(\D*)(0*)(\d*)/,(a,o,r,s)=>o+s),t.length&&!/\d$/.test(n[0])&&(n[0]=n[0]+"0"),n.length>1&&(n[1]=n[1].replace(/0*$/,""),n[1].length||(n.length=1)),this._insertThousandsSeparators(n.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const n=t.split(this.radix);return n.length<2&&n.push(""),n[1]=n[1].padEnd(this.scale,"0"),n.join(this.radix)}doSkipInvalid(t,n,a){n===void 0&&(n={});const o=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===De.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,n,a)&&!o}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,De.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(De.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||De.EMPTY_VALUES.includes(t)&&De.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}gl=De,De.UNMASKED_RADIX=".",De.EMPTY_VALUES=[...Ve.EMPTY_VALUES,0],De.DEFAULTS={...Ve.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[gl.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:l=>l.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},se.MaskedNumber=De;const Ht={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function yn(l,t,n){t===void 0&&(t=Ht.MASKED),n===void 0&&(n=Ht.MASKED);const a=je(l);return o=>a.runIsolated(r=>(r[t]=o,r[n]))}function yl(l,t,n,a){return yn(t,n,a)(l)}se.PIPE_TYPE=Ht,se.createPipe=yn,se.pipe=yl;class kl extends Be{get repeatFrom(){var t;return(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?t:0}get repeatTo(){var t;return(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var n,a,o;const{repeat:r,...s}=at(t);this._blockOpts=Object.assign({},this._blockOpts,s);const i=je(this._blockOpts);this.repeat=(n=(a=r??i.repeat)!=null?a:this.repeat)!=null?n:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((o=this._blocks)==null?void 0:o.length)||0,this.repeatFrom)),blocks:{m:i},eager:i.eager,overwrite:i.overwrite,skipInvalid:i.skipInvalid,lazy:i.lazy,placeholderChar:i.placeholderChar,displayChar:i.displayChar})}_allocateBlock(t){if(t<this._blocks.length)return this._blocks[t];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(je(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,n){n===void 0&&(n={});const a=new ce;for(let c=(o=(r=this._mapPosToBlock(this.displayValue.length))==null?void 0:r.index)!=null?o:Math.max(this._blocks.length-1,0),d,p;d=(s=this._blocks[c])!=null?s:p=!p&&this._allocateBlock(c);++c){var o,r,s,i;const h=d._appendChar(t,{...n,_beforeTailState:(i=n._beforeTailState)==null||(i=i._blocks)==null?void 0:i[c]});if(h.skip&&p){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(a.aggregate(h),h.consumed)break}return a}_trimEmptyTail(t,n){var a,o;t===void 0&&(t=0);const r=Math.max(((a=this._mapPosToBlock(t))==null?void 0:a.index)||0,this.repeatFrom,0);let s;n!=null&&(s=(o=this._mapPosToBlock(n))==null?void 0:o.index),s==null&&(s=this._blocks.length-1);let i=0;for(let c=s;r<=c&&!this._blocks[c].unmaskedValue;--c,++i);i&&(this._blocks.splice(s-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=super.remove(t,n);return this._trimEmptyTail(t,n),a}totalInputPositions(t,n){return t===void 0&&(t=0),n==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,n)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}se.RepeatBlock=kl;try{globalThis.IMask=se}catch{}const kn=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:ce,ChunksTailDetails:Ge,DIRECTION:Q,HTMLContenteditableMaskElement:hn,HTMLInputMaskElement:pl,HTMLMaskElement:mt,InputMask:ml,MaskElement:Pt,Masked:Ve,MaskedDate:Ue,MaskedDynamic:gt,MaskedEnum:yt,MaskedFunction:hl,MaskedNumber:De,MaskedPattern:Be,MaskedRange:ht,MaskedRegExp:fl,PIPE_TYPE:Ht,PatternFixedDefinition:gn,PatternInputDefinition:ft,RepeatBlock:kl,createMask:je,createPipe:yn,default:se,forceDirection:cl,normalizeOpts:at,pipe:yl},Symbol.toStringTag,{value:"Module"}));de.ModalEdit=Zn,de.VForm=He,de.VsInputAddress=Hn,de.VsInputArray=Un,de.VsInputArraySelect=Dt,de.VsInputCheckbox=vn,de.VsInputCodegen=On,de.VsInputColor=jn,de.VsInputContainer=Mn,de.VsInputDate=up,de.VsInputEmail=Qt,de.VsInputFile=Sn,de.VsInputFileList=Nn,de.VsInputKeyValue=zn,de.VsInputMask=Xt,de.VsInputNumber=_n,de.VsInputRadio=tn,de.VsInputRange=Pn,de.VsInputRichtext=An,de.VsInputSelect=on,de.VsInputSlug=Tn,de.VsInputStatic=Jt,de.VsInputSwitcher=Zt,de.VsInputTag=In,de.VsInputTel=en,de.VsInputText=tt,de.VsInputTextArray=Rn,de.VsInputTextarea=Dn,de.default=He,de.inputs=Kn,de.vsInputDatatable=Fn,de.vsInputMap=Ln,Object.defineProperties(de,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|