@opengis/form 0.0.83 → 0.0.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
- (function(J,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@opengis/core")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core"],e):(J=typeof globalThis<"u"?globalThis:J||self,e(J.FormBuilder={},J.Vue,J.OpenGISCore))})(this,function(J,e,te){"use strict";const qn={class:"w-full relative"},Gn={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},Kn={class:"opacity-100"},Yn={key:0,class:"text-red-500 text-[14px]"},Wn={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Zn=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=e.ref("uk"),n=a=>{a.detail.key==="locale"&&(t.value=a.detail.newValue)};return e.onMounted(()=>{t.value=localStorage.locale,window.addEventListener("storage",n)}),e.onUnmounted(()=>{window.removeEventListener("resize",n)}),(a,o)=>(e.openBlock(),e.createElementBlock("div",qn,[a.ua||a.label?(e.openBlock(),e.createElementBlock("div",Gn,[e.createElementVNode("span",Kn,e.toDisplayString(a.item[t.value]||a.ua||a.label),1),a.item?.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",Yn,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(a.$slots,"default",e.mergeProps(a.$attrs,{class:{"opacity-60":a.item.disabled}})),a.error?(e.openBlock(),e.createElementBlock("span",Wn,e.toDisplayString(a.error),1)):e.createCommentVNode("",!0)]))}}),Jn={class:"w-full relative flex flex-row items-center gap-2"},Xn={key:0,class:"text-red-500 text-[14px]"},Qn={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},el=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.columns??{container:12,label:3}),a=e.computed(()=>{const{container:i,label:d}=n.value;return!i||i<=0?0:Math.min(Math.max(d??0,0),i)/i}),o=e.computed(()=>t.item?.type==="html"||a.value<=0?!1:!!(t.ua||t.label)),r=e.computed(()=>{if(!o.value)return{};const i=`${a.value*100}%`;return{flexBasis:i,maxWidth:i}}),s=e.computed(()=>{const{container:i,label:d}=n.value;if(!i||i<=0)return{};if(t.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!o.value)return{flexBasis:"100%",maxWidth:"100%"};const c=Math.max(i-Math.max(d??0,0),0)/i;if(!c)return{};const m=`${c*100}%`;return{flexBasis:m,maxWidth:m}});return(i,d)=>(e.openBlock(),e.createElementBlock("div",Jn,[o.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0",style:e.normalizeStyle(r.value)},[e.createTextVNode(e.toDisplayString(i.ua||i.label)+" ",1),i.item?.rules?.includes("required")&&(i.ua||i.label)?(e.openBlock(),e.createElementBlock("span",Xn,"*")):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"flex-1 min-w-0",style:e.normalizeStyle(s.value)},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],4),i.error?(e.openBlock(),e.createElementBlock("span",Qn,e.toDisplayString(i.error),1)):e.createCommentVNode("",!0)]))}}),tl={class:"w-full relative"},nl={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},ll=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",tl,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",nl,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),al={class:"flex-1 min-w-0"},ol={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},rl={class:"truncate"},sl={key:0,class:"text-red-500 text-[14px]"},il={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},dl={key:0,class:"mt-1 text-xs text-red-500"},cl={default:Zn,horizontal:el,inline:ll,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=i=>{i.key==="locale"&&(n.value=i.newValue??"uk")};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(n.value=localStorage.locale)}catch{}window.addEventListener("storage",s)}),e.onUnmounted(()=>{window.removeEventListener("storage",s)}),(i,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":i.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(i.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",al,[i.ua||i.label?(e.openBlock(),e.createElementBlock("p",ol,[e.createElementVNode("span",rl,e.toDisplayString(i.item[n.value]||i.ua||i.label),1),o.value?(e.openBlock(),e.createElementBlock("span",sl,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createElementBlock("p",il,e.toDisplayString(a.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["w-full",["select","native-select"].includes(i.item.type)?"md:w-[30%]":"md:w-auto"])},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],2)],2),r.value?(e.openBlock(),e.createElementBlock("p",dl,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0)],2))}})};function de(l){return{inputClass:e.computed(()=>{const n=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${l?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return l?.size==="sm"?`${n}h-[32px]`:`${n}h-[38px]`})}}const ul=["placeholder","disabled"],pl=e.defineComponent({__name:"vs-input-password",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=de(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??"");return(s,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),placeholder:r.value,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,ul)),[[e.vModelText,a.value]])}}),ml=["placeholder","disabled"],De=e.defineComponent({__name:"vs-input-text",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=de(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??"");function s(){typeof a.value=="string"&&(a.value=a.value.trim())}return(i,d)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":d[0]||(d[0]=c=>a.value=c),placeholder:r.value,disabled:o.value,onBlur:s,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.customClass,e.unref(n),{"!border-red-600":i.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,ml)),[[e.vModelText,a.value]])}}),hl=["placeholder","disabled","min","max"],Wt=e.defineComponent({__name:"vs-input-number",props:e.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=de(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled);return(r,s)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":s[0]||(s[0]=i=>a.value=i),placeholder:r.placeholder,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"},min:r.min,max:r.max},null,10,hl)),[[e.vModelText,a.value]])}}),q=(l,t)=>{const n=l.__vccOpts||l;for(const[a,o]of t)n[a]=o;return n},fl={},gl={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 yl(l,t){return e.openBlock(),e.createElementBlock("svg",gl,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 kl=q(fl,[["render",yl]]),bl={class:"flex items-center gap-[4px]"},wl=["value","id","disabled"],xl=["for"],_l={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},El=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",bl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:s.value,"onUpdate:modelValue":i[0]||(i[0]=d=>o.value=d),class:e.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":r.value}]),id:s.id,disabled:r.value},null,10,wl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:s.id,class:e.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":r.value}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[o.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",s.error?"border-red-600":""]])},[e.createVNode(kl,{height:"12",width:"12"})],2),e.createElementVNode("span",_l,[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(s.label),1)])])],10,xl)]))}}),Vl=["name","value","disabled"],vl={class:"flex items-center gap-[6px] text-[14px]"},Bl={key:0,class:"text-[16px]"},Cl=["src"],Nl=e.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.computed({get:()=>n.modelValue,set:i=>{a("update:modelValue",i)}}),r=e.computed(()=>Array.isArray(o.value)?o.value.includes(n.value):o.value===!0||o.value===n.value),s=e.computed(()=>n.style?.size==="xs"?"p-1.5 text-xs":n.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(i,d)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[s.value,r.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"hidden",name:i.id,value:i.value,"onUpdate:modelValue":d[0]||(d[0]=c=>o.value=c),disabled:i.disabled},null,8,Vl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("span",vl,[i.icon||i.imgUrl?(e.openBlock(),e.createElementBlock("span",Bl,[i.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(i.icon)},null,2)):e.createCommentVNode("",!0),i.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:1,src:i.imgUrl,width:"16",height:"16",alt:"icon"},null,8,Cl)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(i.label),1)])])],2))}}),Sl={class:"flex items-center"},wt=e.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=`radio-${Math.floor(Math.random()*1e4)}`,r=e.computed({get:()=>Array.isArray(n.modelValue)?Array.isArray(n.modelValue)&&n.modelValue.includes(n.value):n.modelValue,set:i=>{if(Array.isArray(n.modelValue)){let d=[...n.modelValue];i?d.includes(n.value)||d.push(n.value):d=d.filter(c=>c!==n.value),a("update:modelValue",d)}else a("update:modelValue",i)}}),s=e.ref(`vs-checkbox-${n.view||"default"}`);return(i,d)=>(e.openBlock(),e.createElementBlock("div",Sl,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value==="vs-checkbox-buttons"?e.unref(Nl):e.unref(El)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:r.value,"onUpdate:modelValue":d[0]||(d[0]=c=>r.value=c),id:o,icon:i.icon,imgUrl:i.imgUrl,style:e.normalizeStyle(i.style),error:i.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),$l={},Ml={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 Dl(l,t){return e.openBlock(),e.createElementBlock("svg",Ml,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 Fl=q($l,[["render",Dl]]),Al={},Ll={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 Tl(l,t){return e.openBlock(),e.createElementBlock("svg",Ll,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 xt=q(Al,[["render",Tl]]),Il={},Ol={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 Rl(l,t){return e.openBlock(),e.createElementBlock("svg",Ol,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"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 zl=q(Il,[["render",Rl]]),jl={key:0,class:"flex items-start gap-x-1"},Ul={key:0,class:"text-red-500 text-[14px]"},Pl=["title"],Hl=["disabled"],_t=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:{}},{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",jl,[e.createVNode(wt,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),label:a.text,error:a.error||""},null,8,["modelValue","label","error"]),a.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",Ul,"*")):e.createCommentVNode("",!0),a.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:a.i,onClick:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(zl),{class:"text-gray-500 w-[14px] h-[14px]"})],8,Pl)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[n.value?`bg-${a.style?.primaryColor||"blue"}-500`:"bg-stone-200",a.customClass]]),disabled:a.disabled,onClick:o[2]||(o[2]=r=>n.value=!n.value)},[e.createElementVNode("span",{"data-state":"checked",class:e.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[n.value?"translate-x-4":"translate-x-0"]])},null,2)],10,Hl))}}),ql=["id","innerHTML"],Et=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",{id:t.name,class:e.normalizeClass(["text-gray-900",t.customClass]),innerHTML:t.html?t.html:t.text},null,10,ql))}}),Gl=["placeholder","disabled","name"],Vt=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:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=de(t.style),a=e.useModel(l,"modelValue"),o=e.ref(null);let r=null;return e.onMounted(async()=>{if(o.value){const{default:s}=await Promise.resolve().then(()=>zt);r=s(o.value,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),r.on("accept",()=>{a.value=t.unmask?r.unmaskedValue:r.value}),r.on("complete",()=>{a.value=t.unmask?r.unmaskedValue:r.value}),r.value=a.value!=null?String(a.value):""}}),e.onBeforeUnmount(()=>{r?.destroy()}),e.watch(()=>t.mask,s=>{r&&r.updateOptions({mask:s,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),e.watch(a,s=>{r&&r.unmaskedValue!==s&&(r.value=s!=null?String(s):"")}),(s,i)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:s.placeholder,disabled:s.disabled,name:s.name,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,10,Gl))}}),Kl={class:"relative w-full bg-white rounded-lg"},Yl=["placeholder","disabled"],vt=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:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=de(t.style),a=e.useModel(l,"modelValue");return(o,r)=>(e.openBlock(),e.createElementBlock("div",Kl,[r[1]||(r[1]=e.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),e.withDirectives(e.createElementVNode("input",{type:"email","onUpdate:modelValue":r[0]||(r[0]=s=>a.value=s),placeholder:o.placeholder,disabled:o.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Yl),[[e.vModelText,a.value]])]))}}),Wl={class:"relative w-full bg-white rounded-lg"},Zl=["value","placeholder","disabled"],Bt=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:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=de(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>a.value?a.value.startsWith("+")?a.value.slice(1):a.value:""),r=i=>{let{value:d}=i.target;d=d.replace(/^\+/,""),a.value=d?`+${d}`:""},s=i=>{const d=i,{data:c,inputType:m}=d;m&&m.startsWith("delete")||c&&/\D/.test(c)&&d.preventDefault()};return e.watch(()=>a.value,i=>{i&&!i.startsWith("+")?a.value=`+${i.replace(/^\+/,"")}`:i||(a.value="")},{immediate:!0}),(i,d)=>(e.openBlock(),e.createElementBlock("div",Wl,[d[0]||(d[0]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"stroke-gray-500 transition-all"},[e.createElementVNode("path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"})])],-1)),d[1]||(d[1]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[30px] text-gray-500 select-none pointer-events-none"}," + ",-1)),e.createElementVNode("input",{type:"tel",value:o.value,onInput:r,onBeforeinput:s,pattern:"^\\+[1-9]\\d{1,14}$",maxlength:"15",placeholder:i.placeholder,disabled:i.disabled,class:e.normalizeClass(["!pl-10 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":i.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Zl)]))}}),Jl=["value","disabled"],Xl={class:"text-[13px] text-gray-700"},Ql=e.defineComponent({__name:"vs-input-radio-default",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},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,Jl),[[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",Xl,e.toDisplayString(t.text),1)],2))}}),ea=["value","disabled"],ta={class:"text-[13px] text-gray-700"},na={"vs-input-radio-default":Ql,"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:{},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,ea),[[e.vModelRadio,n.value]]),e.createElementVNode("span",ta,e.toDisplayString(t.text),1)],2))}})},Ct=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:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>na[`vs-input-radio-${t.view}`]);return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([o.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,s=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),e.mergeProps({key:s?.id,text:s.text,value:s.id.toString(),checked:n.value===s.id,modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=i=>n.value=i)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),la={key:1,class:"w-full flex flex-col gap-4"},aa={key:0,class:"text-sm font-medium text-muted-foreground my-2"},oa="Без категорії",Zt=q(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:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.ref([]),r=e.reactive({}),s=g=>g?.value||g?.id||g?.text||g,i=g=>g.text||String(g),d=g=>`lg:col-span-${g||12}`,c=e.computed(()=>[n.position==="vertical"?"flex flex-col":"",n.colSpan?"grid":"flex justify-start"]),m=g=>g==null||g===""?null:typeof g=="string"||typeof g=="number"?g:String(g),f=e.computed(()=>{if(!n.group)return[];const g=new Map;o.value.forEach(h=>{const v=h[n.group],y=m(v);g.has(y)||g.set(y,[]),g.get(y)?.push(h)});const V=[];n.values?.length&&n.values.forEach(h=>{const v=m(h);V.push(v)});const w=new Set,k=h=>{const v=g.get(h)||[];if(!v.length)return null;const y=h===null?"group-null":`group-${String(h)}`,C=h===null?oa:String(h);return w.add(h),{key:y,label:C,options:v}},b=[];return V.forEach(h=>{const v=k(h);v&&b.push(v)}),g.forEach((h,v)=>{if(w.has(v))return;const y=k(v);y&&b.push(y)}),b}),x=async()=>{try{const g=await fetch(`/api/suggest/${n.data}`).then(V=>V.json());o.value=g?.data||g}catch(g){console.error(g)}};return e.watch(()=>n.modelValue,g=>{if(typeof g=="boolean"&&o.value.length===1){const V=s(o.value[0]);r[V]=g}else if(Array.isArray(g)){const V=new Set(g);o.value.forEach(w=>{if(!w.disabled){const k=s(w);r[k]=V.has(k)}})}},{immediate:!0}),e.watch(r,()=>{if(!o.value.length){a("update:modelValue",null);return}const g=Object.entries(r).filter(([,V])=>V).map(([V])=>V);a("update:modelValue",g.length===0?[]:g)},{deep:!0}),e.onMounted(()=>{if(n.data)x().then(()=>{if(typeof n.modelValue=="boolean"&&o.value.length===1){const g=s(o.value[0]);r[g]=n.modelValue}else if(Array.isArray(n.modelValue)){const g=new Set(n.modelValue);o.value.forEach(V=>{if(!V.disabled){const w=s(V);r[w]=g.has(w)}})}});else if(o.value=n.options,typeof n.modelValue=="boolean"&&o.value.length===1){const g=s(o.value[0]);r[g]=n.modelValue}else if(Array.isArray(n.modelValue)){const g=new Set(n.modelValue);o.value.forEach(V=>{if(!V.disabled){const w=s(V);r[w]=g.has(w)}})}}),(g,V)=>n.group?(e.openBlock(),e.createElementBlock("div",la,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,w=>(e.openBlock(),e.createElementBlock("div",{key:w.key,class:"flex flex-col gap-2"},[w.label?(e.openBlock(),e.createElementBlock("span",aa,e.toDisplayString(w.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["p-0 w-full gap-[12px]",c.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.options,k=>(e.openBlock(),e.createBlock(wt,{modelValue:r[s(k)],"onUpdate:modelValue":b=>r[s(k)]=b,value:s(k),class:e.normalizeClass(d(g.colSpan)),disabled:n.disabled||k.disabled,label:i(k),key:`${w.key}-${s(k)}`,icon:k?.icon,imgUrl:k?.imgUrl,option:k,view:g.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["p-0 w-full gap-[10px]",c.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,w=>(e.openBlock(),e.createBlock(wt,{modelValue:r[s(w)],"onUpdate:modelValue":k=>r[s(w)]=k,value:s(w),class:e.normalizeClass(d(g.colSpan)),disabled:n.disabled||w.disabled,label:i(w),key:s(w),icon:w?.icon,imgUrl:w?.imgUrl,option:w,view:g.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-8e66207e"]]),ra=["type","placeholder","disabled"],sa=e.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},mode:{default:"date"}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l;function a(m){return m?n.mode==="datetime"?(m.includes("T")?m:null)||m+(m.includes(" ")?"":"T00:00"):m?.split(" ")[0]:null}const{inputClass:o}=de(n.style),r=t,s=e.computed({get:()=>a(n.modelValue),set:m=>r("update:modelValue",m)}),i=e.computed(()=>n.mode==="datetime"?"datetime-local":n.mode),d=e.computed(()=>!!n.disabled),c=e.computed(()=>n.placeholder??"");return(m,f)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":f[0]||(f[0]=x=>s.value=x),placeholder:c.value,disabled:d.value,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[m.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,ra)),[[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},Jt=async(l,t={})=>{try{const n=new FormData;n.append("unique","true"),n.append("file",l);const{api:a,id:o="1",form:r="form",table:s="table",customParams:i}=t,d=a||`/file/upload/uploads?id=${o||""}&form=${r||""}&table=${s||""}`,c=ia(d,i);return(await fetch(c,{method:"POST",body:n}).then(f=>f.json()))?.result}catch(n){return te.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",n),null}},da=async l=>{try{return await fetch(`file/delete${l}`),!0}catch(t){return console.error(t),!1}},Xt=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)}},ca={},ua={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function pa(l,t){return e.openBlock(),e.createElementBlock("svg",ua,t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const we=q(ca,[["render",pa]]),ma={},ha={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 fa(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",ha,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 ga=q(ma,[["render",fa]]),ya={},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 ba(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 wa=q(ya,[["render",ba]]),xa={},_a={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 Ea(l,t){return e.openBlock(),e.createElementBlock("svg",_a,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 Qt=q(xa,[["render",Ea]]),Va={},va={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 Ba(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",va,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 Ca=q(Va,[["render",Ba]]),Na={},Sa={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 $a(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Sa,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="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 Ma=q(Na,[["render",$a]]),Da=l=>{if(!l)return"";const t=l?.split(".");return t[t.length-1]},Fa=l=>{const t=Da(l),n={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return n.imageFormat.includes(t)?"img":n.sheetsFormat.includes(t)?wa:n.textsFormat.includes(t)?Ma:n.documentsFormat.includes(t)?ga:n.archivesFormat.includes(t)?Ca:Qt},Aa={},La={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 Ta(l,t){return e.openBlock(),e.createElementBlock("svg",La,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 Fe=q(Aa,[["render",Ta]]),Ia={},Oa={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function Ra(l,t){return e.openBlock(),e.createElementBlock("svg",Oa,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"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 en=q(Ia,[["render",Ra]]),za=["title"],ja={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},tn=q(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:{}},{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(Fa)(n.value)),{src:n.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:r[0]||(r[0]=s=>e.unref(Xt)(n.value))},null,8,["src"])),e.createElementVNode("div",ja,[e.createElementVNode("button",{type:"button",onClick:r[1]||(r[1]=s=>{e.unref(da)(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(Fe,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:r[2]||(r[2]=s=>e.unref(Xt)(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(en,{class:"w-4 h-4"})])])],8,za))}}),[["__scopeId","data-v-286cdbc0"]]),Ua={class:"flex items-center gap-x-2"},Pa=["accept","multiple","disabled"],Ha={key:1,class:"flex items-center flex-wrap gap-2"},qa={key:1,class:"loader"},Ga={key:1,class:"loader"},nn=q(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:{}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["change"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=e.useModel(l,"modelValue"),o=t,r=e.ref(null),s=e.ref(!1),i=e.inject("values"),d=e.computed(()=>n.format?n.format.split(",").map(h=>h.trim().toLowerCase()).filter(Boolean):[]),c=h=>Array.isArray(a.value)&&a.value[h]||"",m=h=>{if(n.max_size&&h.size>n.max_size*1024*1024){const v=(h.size/1048576).toFixed(2);return te.notify({type:"error",title:"Помилка!",message:`Файл "${h.name}" занадто великий. Максимальний розмір: ${n.max_size} МБ, розмір файлу: ${v} МБ`,position:"right-bottom"}),!1}return!0},f=h=>{if(!d.value.length)return!0;const v=`.${h.name.split(".").pop()?.toLowerCase()||""}`,y=d.value.includes(v);return y||te.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${h.name}". Дозволені формати: ${d.value.join(", ")}`,position:"right-bottom"}),y},x=e.computed(()=>{const h={},v=[];if(!n.customParams?.length)return{params:h,missingSources:v};const y=i?.value??{};return n.customParams.forEach(C=>{if(!C)return;const[A,M]=C.split("="),R=A?.trim(),z=M?.trim();if(!R||!z)return;const P=y[z];if(P==null||P===""){v.push(z);return}h[R]=P}),{params:h,missingSources:v}}),g=()=>{const h=x.value.params;return{api:n.api,customParams:Object.keys(h).length?h:void 0}},V=()=>{const h=x.value.missingSources;if(!h.length)return!0;const v=h.join(", ");return te.notify({type:"warning",title:"Заповніть поля",message:`Поля (${v}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},w=h=>{te.notify({type:"error",title:"Помилка завантаження",message:h||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},k=()=>{n.disabled||s.value||V()&&r.value?.click()},b=async h=>{const{files:v}=h.target;if(!v||v.length===0)return;if(!V()){r.value&&(r.value.value="");return}const y=Array.from(v);if(n.max_size&&y.filter(M=>!m(M)).length>0){r.value&&(r.value.value="");return}if(y.filter(A=>!f(A)).length>0){r.value&&(r.value.value="");return}s.value=!0;try{if(n.multiple){const A=Array.from(v).map(async P=>await Jt(P,g())),M=await Promise.all(A),z=M.filter(P=>P!==null).map(P=>P?.file_path).filter(Boolean);if(z.length===0){w();return}z.length<M.length&&w("Деякі файли не вдалося завантажити. Перевірте їх та спробуйте знову."),a.value=[...a.value||[],...z],o("change",a.value)}else{const A=v[0],M=await Jt(A,g());if(!M?.file_path){w();return}a.value=M?.file_path,o("change",a.value||"")}}catch(A){const M=A?.message||void 0;w(M)}finally{s.value=!1,r.value&&(r.value.value="")}};return(h,v)=>(e.openBlock(),e.createElementBlock("div",Ua,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:r,type:"file",accept:n.format,multiple:h.multiple,onChange:b,disabled:s.value||h.disabled},null,40,Pa),!h.multiple&&a.value?(e.openBlock(),e.createBlock(tn,{key:0,item:a.value,"onUpdate:item":v[0]||(v[0]=y=>a.value=y),value:a.value,"onUpdate:value":v[1]||(v[1]=y=>a.value=y)},null,8,["item","value"])):h.multiple?(e.openBlock(),e.createElementBlock("div",Ha,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(y,C)=>(e.openBlock(),e.createBlock(tn,{multiple:h.multiple,key:C,value:a.value,"onUpdate:value":v[2]||(v[2]=A=>a.value=A),item:c(C)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:k,class:e.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",h.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",qa)):(e.openBlock(),e.createBlock(we,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),h.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:k,class:e.normalizeClass([h.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",Ga)):(e.openBlock(),e.createBlock(we,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-94bcb5d9"]]),Ka={class:"max-w-[55vw]"},Ya={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},Wa={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},Za={class:"px-[5px]"},Ja={class:""},Je=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",Ka,[e.createElementVNode("p",Ya,e.toDisplayString(o.item?.uploaded_name),1),e.createElementVNode("p",Wa,[e.createElementVNode("span",null,e.toDisplayString(o.item?.username),1),e.withDirectives(e.createElementVNode("span",Za,"|",512),[[e.vShow,o.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(n.value),1),r[0]||(r[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",Ja,e.toDisplayString(a(o.item?.size)),1)])])],64))}}),Xa={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},Qa={key:0,class:"flex w-full gap-x-3 items-center"},eo={key:1,class:"flex gap-x-3 w-full items-center"},to={key:2,class:"flex gap-x-3 w-full items-center"},no=["href"],lo={key:3,class:"flex gap-x-3 w-full items-center"},ao={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},oo={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"},ro={class:"inline-block"},so={class:"inline-block"},io=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(m){return["pdf","json"].includes(m.ext)}function r(m){return["ppt","pptx","doc","docx","xls","xlsx"].includes(m.ext)}function s(m){const f=document.createElement("a");f.setAttribute("download",m?.uploaded_name),f.href=m?.file_path,f.click()}async function i(){try{await fetch(`${n.prefix}/widget/file/${n.item.entity_id}/${n.item.file_id}`),a("update")}catch(m){console.error(m)}}function d(){a("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function c(m){(n.item.ext==="jpg"||n.item.ext==="png")&&a("openLightbox",{item:n.item,index:m})}return(m,f)=>(e.openBlock(),e.createElementBlock("div",Xa,[m.item.ext==="jpg"||m.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",Qa,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:f[0]||(f[0]=x=>c(m.index))},[e.createVNode(Je,{item:m.item},null,8,["item"])])])):o(m.item)?(e.openBlock(),e.createElementBlock("div",eo,[e.createVNode(Je,{item:m.item},null,8,["item"])])):r(m.item)?(e.openBlock(),e.createElementBlock("div",to,[e.createElementVNode("a",{href:`/api/file-preview?id=${m.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(Je,{item:m.item},null,8,["item"])],8,no)])):(e.openBlock(),e.createElementBlock("div",lo,[e.createVNode(Je,{item:m.item},null,8,["item"])])),e.createElementVNode("div",ao,[e.createElementVNode("div",oo,[e.createElementVNode("div",ro,[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:f[1]||(f[1]=x=>s(m.item))},[e.createVNode(en,{height:"14",width:"14"})])]),f[3]||(f[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",so,[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:f[2]||(f[2]=x=>d())},[e.createVNode(Fe,{height:"14",width:"14"})])])])])]))}}),co={},uo={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function po(l,t){return e.openBlock(),e.createElementBlock("svg",uo,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 mo=q(co,[["render",po]]),ho={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},fo={class:"flex w-full mb-[12px] items-center gap-x-2"},go={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},yo={class1:"ml-auto"},ko={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"},bo={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},wo={class:"relative"},xo={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"},_o={key:0},ln=e.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update"],setup(l,{emit:t}){const n=l,a=e.inject("form"),o=e.computed(()=>a.value.formId),r=e.ref(!1),s=e.ref(0),i=t,d=e.ref(!1),c=e.ref({}),m=e.ref([]),f=e.ref(""),x=e.computed(()=>Array.isArray(m.value)?m.value.filter(v=>v.ext==="jpg"||v.ext==="png").map(v=>v?.file_path):[]),g=e.computed(()=>f.value===""?m.value:m.value.filter(v=>v?.uploaded_name?.includes(f.value))),V=v=>{const y=x.value.findIndex(C=>C===v.item.file_path);y!==-1&&(r.value=!0,s.value=y)},w=async()=>{try{const v=await fetch(`${n.prefix}/widget/file/${o.value}`).then(y=>y.json());m.value=v?.rows}catch(v){console.error(v)}},k=async v=>{await Promise.all(Array.from(v.target.files).map(async y=>{const C=new FormData;C.append("file",y);try{const A=`${n.prefix}/widget/file/${o.value}`,M=await fetch(A,{method:"POST",body:C});return M.ok?(i("update","file-list"),y):(te.notify({type:M.status>=400&&M.status<500?"warning":"error",title:"Error",message:`Error code: ${M.status}`}),null)}catch(A){return te.notify({type:"error",title:"Error",message:A.message||"Unknown error"}),console.error(A),null}})),await w()},b=v=>{const y={...v};return v.cancel||(y.cancel=()=>{d.value=!1}),v.updateListOnConfirm&&(y.confirm=async()=>{await v.confirm(),d.value=!1,w()}),y},h=v=>{c.value=b(v),d.value=!0};return e.watch(o,v=>{v&&w()}),e.onMounted(()=>{o.value&&w()}),(v,y)=>{const C=e.resolveComponent("Lightbox"),A=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",ho,[e.createElementVNode("div",fo,[e.createElementVNode("h2",go," Файлів: "+e.toDisplayString(m.value?.length),1),e.createElementVNode("div",yo,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:y[0]||(y[0]=M=>k(M))},null,32),e.createElementVNode("div",ko,[e.createVNode(mo,{height:"16",width:"16"})])])])]),m.value?.length>4?(e.openBlock(),e.createElementBlock("div",bo,[e.createElementVNode("div",null,[e.createElementVNode("div",wo,[y[8]||(y[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":y[1]||(y[1]=M=>f.value=M),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[e.vModelText,f.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),m.value?.length?(e.openBlock(),e.createElementBlock("div",xo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(M,R)=>(e.openBlock(),e.createBlock(io,{key:R,prefix:v.prefix,item:M,index:R,onUpdate:y[2]||(y[2]=z=>v.$emit("update","file-list")),onOpenModal:y[3]||(y[3]=z=>h(z)),onOpenLightbox:y[4]||(y[4]=z=>V(z))},null,8,["prefix","item","index"]))),128)),g.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",_o,y[9]||(y[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):e.createCommentVNode("",!0),e.createVNode(C,{modelValue:r.value,"onUpdate:modelValue":y[5]||(y[5]=M=>r.value=M),startIndex:s.value,"onUpdate:index":y[6]||(y[6]=M=>s.value=M),images:x.value},null,8,["modelValue","startIndex","images"]),e.createVNode(A,e.mergeProps({modelValue:d.value,"onUpdate:modelValue":y[7]||(y[7]=M=>d.value=M),onConfirm:c.value.confirm},c.value),null,16,["modelValue","onConfirm"])])}}}),Eo={class:"flex items-center justify-between"},Vo={class:"text-[16px] text-gray-900 font-medium"},vo={class:"grid gap-3"},Bo=q(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",Eo,[e.createElementVNode("p",Vo,e.toDisplayString(l.title),1),e.createVNode(_t,{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",vo,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),Co={class:"text-[16px] text-gray-900 font-medium"},No={class:"grid gap-3"},So=q(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(Fl),{class:e.normalizeClass(["h-4 w-4 duration-300",[n.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",Co,e.toDisplayString(l.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",No,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),$o={class:"flex items-center justify-between"},Mo={switcher:Bo,accordion:So,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",$o,[e.createElementVNode("p",null,e.toDisplayString(l.title),1)]),e.renderSlot(t.$slots,"default")]))}})},ue={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Do=(l,t)=>String(l)===String(t),Fo=(l,t)=>String(l)!==String(t),Ao=(l,t)=>l>t,Lo=(l,t)=>l>=t,To=(l,t)=>l<t,Io=(l,t)=>l<=t,Oo=(l,t)=>Array.isArray(t)&&t.length===2?l>=t[0]&&l<=t[1]:!1,Ro=(l,t)=>String(l).startsWith(String(t)),zo=(l,t)=>String(l).endsWith(String(t)),jo=(l,t)=>String(l).includes(String(t)),Uo=(l,t)=>Array.isArray(t)?t.includes(l):!1,Po=(l,t)=>Array.isArray(t)?!t.includes(l):!0,an=(l,t)=>{if(!t)return!0;switch(t?.[1]){case ue.Equal:return Do(l,t?.[2]);case ue.Inequal:return Fo(l,t?.[2]);case ue.Higer:return Ao(l,t?.[2]);case ue.HigerOrEqual:return Lo(l,t?.[2]);case ue.Lower:return To(l,t?.[2]);case ue.LowerOrEqual:return Io(l,t?.[2]);case ue.Between:return Oo(l,t?.[2]);case ue.StartWith:return Ro(l,t?.[2]);case ue.EndWith:return zo(l,t?.[2]);case ue.Contain:return jo(l,t?.[2]);case ue.In:return Uo(l,t?.[2]);case ue.NotIn:return Po(l,t?.[2]);default:return!0}},on=e.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(l){const t=l,n=e.inject("values",e.ref({})),a=e.inject("form"),o=e.computed(()=>t.schema?.filter(i=>{const d=i?.conditions;if(!d)return!0;const c=Array.isArray(d)?d[0]:d,m=t.name?n.value?.[t.name]?.[c]??n.value?.[c]:n.value?.[c];return an(m,d)})),r=e.computed(()=>Mo[t.view]),s=e.computed(()=>{if(n.value||(n.value={}),!t.name)return n.value;const i=n.value[t.name];if(i)return i;const d={};return n.value={...n.value,[t.name]:d},d});return(i,d)=>l.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{key:0,title:l.title,style:e.normalizeStyle(l.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,c=>(e.openBlock(),e.createBlock(wn,e.mergeProps({key:c.name},{ref_for:!0},c,{item:c,modelValue:s.value[c.name],"onUpdate:modelValue":m=>s.value[c.name]=m,style:l.style,error:e.unref(a)?.errors?.[c.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),Ho=["aria-expanded","data-focus"],qo={key:0,class:"flex flex-wrap items-center gap-1 overflow-y-auto min-w-0 flex-1"},Go={class:"flex items-center min-w-0"},Ko=["title"],Yo=["innerHTML"],Wo=["onClick"],Zo={class:"flex-1 min-w-[2px]"},Jo=["placeholder"],Xo=["title"],Qo=["innerHTML"],er={key:2,class:"flex-1 min-w-[2px]"},tr=["placeholder"],nr={class:"flex items-center shrink-0"},lr=["disabled"],ar=["disabled","title"],or=["aria-disabled","onClick"],rr=["innerHTML"],sr={key:1,class:"px-3 py-2 text-center text-gray-500"},ir=["disabled"],Nt=e.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},emits:["change","update:modelValue","value-selected"],setup(l,{emit:t}){const n=l,a=t,o=e.computed(()=>n.multiple),r=e.computed(()=>n.disabled);de(n.style);const s=e.computed({get:()=>n.modelValue,set:B=>a("update:modelValue",B)});!s.value&&n.defaultValue&&(s.value=n.defaultValue);const i=e.ref(null),d=e.ref(null),c=e.ref(null),m=e.ref(null),f=e.ref(!1),x=e.ref(!1),g=e.ref(null),V=e.ref([]),w=e.ref(-1),k=e.ref([]),b=e.ref(""),h=e.ref(null),v=e.ref("bottom"),y=e.ref({}),C=e.ref([]),A=e.computed(()=>{if(!C.value.length)return[];const B=V.value,$=new Map(B.map(F=>[F.id?.toString(),F]));return C.value.map(F=>$.get(F?.toString())).filter(F=>!!F)}),M=e.computed(()=>n.placeholder||"Select..."),R=e.computed(()=>N(g.value));e.computed(()=>o.value?!C.value.length&&b.value==="":!R.value&&b.value==="");const z=e.computed(()=>r.value?!1:o.value?C.value.length>0:!!s.value),P=B=>o.value?C.value.some($=>$?.toString()===B?.toString()):s.value?.toString()===B?.toString(),T=e.computed(()=>{let B=V.value??[];if(!n.data&&b.value.trim()!==""){const $=b.value.toLowerCase();B=B.filter(F=>{const G=N(F).toLowerCase(),p=F.text?.toLowerCase?.()||"";return G.includes($)||p.includes($)})}if(o.value&&C.value.length){const $=new Set(C.value.map(F=>F?.toString()));B=B.filter(F=>!$.has(F.id?.toString()))}return B}),Z=e.inject("values"),K=/\{\{\s*([^}]+?)\s*\}\}/g,Q=B=>(B?String(B):"").replace(/<[^>]*>/g,"").trim(),S=e.computed(()=>n.slot??n?.optionTemplate??""),_=B=>{if(!B)return"";const $=S.value;return $?$.replace(K,(F,G)=>{const p=G.trim(),u=B[p];return u!=null?String(u):""}):B.text??""},N=B=>{if(!B)return"";if(!S.value)return B.text??"";const F=_(B);return Q(F)||B.text||""},D=B=>{n.set&&Z?.value&&Object.entries(n.set).forEach(([$,F])=>{if(!$)return;const G=B?B[F]:null;Z.value[$]=G??null})},H=e.computed(()=>n.parent?Z?.value?.[n.parent]?.toString()??null:null),ee=async B=>{if(!n.data){let $=n.options??[];if(B?.trim()){const F=B.toLowerCase();$=$.filter(G=>{const p=N(G).toLowerCase(),u=G.text?.toLowerCase?.()||"";return p.includes(F)||u.includes(F)})}return $}try{const $=n.host??"",F=n.prefix??"api",G=n.api??`/${F}/suggest/${n.data}`,p=`${$}${G}`,u=new URLSearchParams;return u.set("json","1"),B&&u.set("key",B),H.value!==void 0&&H.value!==null&&H.value!==""&&u.set("parent",H.value),(await fetch(`${p}?${u.toString()}`).then(L=>L.json()))?.data??[]}catch{return[]}},pe=async()=>{n.data?V.value=await ee(b.value):V.value=n.options?[...n.options]:[]},I=async B=>{if(B==null)return null;const $=V.value?.find(F=>F?.id?.toString()===String(B));if($)return $;if(n.data)try{const F=n.host??"",G=n.prefix??"api",p=n.api??`/${G}/suggest/${n.data}`,u=`${F}${p}`,E=new URLSearchParams;return E.set("json","1"),E.set("val",String(B)),H.value!==void 0&&H.value!==null&&H.value!==""&&E.set("parent",H.value),((await fetch(`${u}?${E.toString()}`).then(U=>U.json()))?.data??[])?.[0]??null}catch{return null}return null},le=async B=>{const $=new Set(V.value.map(G=>G.id?.toString())),F=B.filter(G=>!$.has(G?.toString()));F.length&&await F.reduce(async(G,p)=>{await G;const u=await I(p);u&&V.value.push(u)},Promise.resolve())},fe=async()=>{r.value||(f.value=!0,await pe(),await e.nextTick(()=>{me(),h.value?.focus(),T.value.length?w.value=0:w.value=-1}))},se=()=>{f.value=!1,w.value=-1},jt=async B=>{if(r.value)return;!f.value?await fe():se()},ut=async()=>{f.value?h.value?.focus():await fe()},Ut=()=>{o.value?(C.value=[],s.value=[],a("change",[]),Ce(null,[])):(g.value=null,s.value=null,a("change",null),Ce(null,null)),D(null),b.value="",e.nextTick(()=>h.value?.focus())},Pt=B=>{o.value&&(C.value=C.value.filter($=>$?.toString()!==B?.toString()),s.value=[...C.value],a("change",s.value),Ce(null),e.nextTick(()=>h.value?.focus()))},Ce=(B,$)=>{const F=$??(o.value?[...C.value]:B?.id??null);a("value-selected",{name:n.name,value:F,option:B})},Te=B=>{o.value?(P(B.id)||(C.value=[...C.value,B.id],s.value=[...C.value],a("change",s.value),Ce(B)),b.value="",e.nextTick(()=>{h.value?.focus(),w.value=Math.min(w.value,T.value.length-1)}),D(null)):(g.value=B,s.value=B.id,a("change",s.value),Ce(B),b.value="",se(),D(B))},Ht=B=>{P(B.id)||Te(B)},Ie=(B,$)=>{if(!B||!$)return;const F=B.offsetTop,G=F+B.offsetHeight,p=$.scrollTop,u=p+$.clientHeight;let E=$.scrollTop;F<p?E=F-80:G>u&&(E=G-$.clientHeight+4);const L=$;L.scrollTop=E},We=B=>{let $=B.parentElement;for(;$;){if($.classList.contains("ui-dialog__content"))return $;const F=window.getComputedStyle($),G=F.overflow+F.overflowY+F.overflowX;if(G.includes("auto")||G.includes("scroll")||$===document.body||$===document.documentElement)return $;$=$.parentElement}return document.body},me=()=>{if(!d.value)return;const B=d.value.getBoundingClientRect(),$=window.innerHeight||document.documentElement.clientHeight,F=window.innerWidth||document.documentElement.clientWidth,G=8,p=8,u=n.maxHeight||300,E=$-B.bottom-p-G,L=B.top-p-G,O=E>=L,U=Math.max(F-G*2,0);let{width:X}=B;U>0&&X>U&&(X=U);let{left:ne}=B;ne+X+G>F&&(ne=F-X-G),ne=Math.max(ne,G);const ie=Math.min(u,Math.max(O?E:L,50));v.value=O?"bottom":"top",y.value={position:"fixed",left:`${ne}px`,width:`${X}px`,minWidth:"300px",maxHeight:`${ie}px`,transform:O?"none":"translateY(-100%)",top:O?`${B.bottom+p}px`:`${B.top-p}px`}},pt=async B=>{r.value||!f.value&&(B.key==="ArrowDown"||B.key==="ArrowUp")&&(B.preventDefault(),await fe())},Oe=B=>{if(!f.value)return;const{key:$}=B;if($==="ArrowDown")B.preventDefault(),w.value+1<T.value.length&&(w.value+=1,Ie(k.value[w.value],c.value));else if($==="ArrowUp")B.preventDefault(),w.value>0&&(w.value-=1,Ie(k.value[w.value],c.value));else if($==="Enter"){B.preventDefault();const F=T.value[w.value];F&&Te(F),h.value?.blur()}else $==="Escape"?(B.preventDefault(),se()):$==="Backspace"?o.value&&b.value===""&&C.value.length&&(C.value=C.value.slice(0,-1),s.value=[...C.value],a("change",s.value)):$==="Home"?(w.value=0,Ie(k.value[0],c.value)):$==="End"?(w.value=T.value.length-1,Ie(k.value[w.value],c.value)):$==="Tab"&&se()},mt=()=>{r.value||(x.value=!0)},Ne=()=>{x.value=!1,b.value=""},Se=B=>{B.key==="Escape"&&f.value&&se()},ht=B=>{const $=B.target;i.value?.contains($)||m.value?.contains($)||se()},ft=B=>{f.value&&c.value&&!c.value.contains(B.target)&&me()},gt=()=>{f.value&&me()},yt=()=>{f.value&&me()};e.watch(()=>n.options,B=>{B?.length&&(V.value=[...B],be())},{immediate:!0});async function be(){if(o.value)Array.isArray(s.value)?C.value=[...s.value]:(C.value=s.value==null?[]:[s.value],s.value=[...C.value]),n.data&&C.value.length&&(await le(C.value),await e.nextTick());else{if(Array.isArray(s.value)){const B=s.value[0]??null;s.value=B??null}s.value!=null&&(g.value=await I(s.value)),D(g.value??null)}}e.watch(s,()=>{be()}),e.onMounted(async()=>{addEventListener("keydown",Se),addEventListener("scroll",ft,!0),addEventListener("resize",gt),document.addEventListener("click",ht,!0),d.value&&We(d.value).addEventListener("scroll",yt,!0),n.options?.length&&!n.data?V.value=[...n.options]:n.data&&(V.value=await ee("")),await be(),bt.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",Se),removeEventListener("scroll",ft,!0),removeEventListener("resize",gt),document.removeEventListener("click",ht,!0),d.value&&We(d.value).removeEventListener("scroll",yt,!0)});const $e=e.ref(!1),_e=e.ref({}),Ee=e.ref([]),Me=e.ref(null);async function qt(){if(!n.add?.token||Me?.value.validate())return;const $=n.add.api??`/api/table/${n.add.token}`,{id:F}=await fetch($,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(_e.value)}).then(G=>G.json());if(!n.options?.length&&n.data){const G=await fetch(`${n.api??`/api/suggest/${n.data}`}?val=${F}`).then(p=>p.json());g.value=G[0],V.value.push(G[0]),s.value=F}$e.value=!1,te.notify({title:"Success!",message:"Object created."})}async function Gt(){if(!n.add)return null;const B=await fetch(`/api/template/form/${n.add.form}`).then($=>$.json());return Ee.value=B.schema,$e.value=!0,null}function kt(B,$=200){let F;return(...G)=>{F&&clearTimeout(F),F=window.setTimeout(()=>B(...G),$)}}const Kt=kt(async B=>{V.value=await ee(B)},200);e.watch(b,B=>{n.data&&Kt(B.trim())}),e.watch(()=>n.options,B=>{!n.data&&B?.length&&(V.value=[...B],be())},{immediate:!0}),e.watch(()=>n.parent??n.parentValue,()=>{n.data&&pe()});const bt=e.ref(!0);return e.watch(H,async()=>{if(n.data&&(bt.value||(o.value?(C.value=[],s.value=[],a("change",[])):(g.value=null,s.value=null,a("change",null))),await pe(),n.auto===1&&H.value&&V.value.length>0)){const B=V.value[0];B&&Te(B)}}),(B,$)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(te.VsModal),{visible:$e.value,"onUpdate:visible":$[1]||($[1]=F=>$e.value=F),class:"z-[1000]",title:"Додати",buttonText:"Додати",onDone:qt,teleport:B.teleport},{default:e.withCtx(()=>[e.createVNode(xe,{schema:Ee.value,modelValue:_e.value,"onUpdate:modelValue":$[0]||($[0]=F=>_e.value=F),ref_key:"addForm",ref:Me},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(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",f.value||x.value?"border-blue-500 ring-1 ring-blue-500":"",r.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":f.value,"aria-haspopup":"listbox",onKeydown:pt,onClick:ut,"data-focus":f.value||x.value?"true":"false"},[e.createElementVNode("div",{class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full",ref_key:"triggerRef",ref:d},[o.value?(e.openBlock(),e.createElementBlock("div",qo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(A.value,F=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border max-w-full",key:F.id},[e.createElementVNode("div",Go,[F?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:e.normalizeStyle({backgroundColor:F?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"truncate text-gray-900 overflow-hidden max-w-[200px] px-0.5 py-[2px] pl-1.5",title:N(F)},[S.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:_(F)},null,8,Yo)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(F.text),1)],64))],8,Ko)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b] flex-shrink-0",onClick:e.withModifiers(G=>Pt(F.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,Wo)]))),128)),e.createElementVNode("div",Zo,[!r.value&&B.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:h,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:C.value.length?" ":M.value,"onUpdate:modelValue":$[2]||($[2]=F=>b.value=F),onFocus:mt,onBlur:Ne,onKeydown:Oe},null,40,Jo)),[[e.vModelText,b.value]]):e.createCommentVNode("",!0)])])):!o.value&&!x.value&&R.value&&b.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900"]),title:R.value},[g.value?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:e.normalizeStyle({backgroundColor:g.value?.color})},null,4)):e.createCommentVNode("",!0),S.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass({"pl-5":g.value?.color}),innerHTML:_(g.value)},null,10,Qo)):(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass({"pl-5":g.value?.color})},e.toDisplayString(g.value?.text),3))],8,Xo)):e.createCommentVNode("",!0),o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",er,[!r.value&&B.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:h,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:R.value?" ":M.value,"onUpdate:modelValue":$[3]||($[3]=F=>b.value=F),onFocus:mt,onBlur:Ne,onKeydown:Oe},null,40,tr)),[[e.vModelText,b.value]]):e.createCommentVNode("",!0)]))],512),e.createElementVNode("div",nr,[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(Ut,["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,lr)):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(F=>jt(),["stop"])),title:f.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,ar)])],42,Ho),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[f.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:m,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(y.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:y.value.maxHeight||"300px"}),ref_key:"listRef",ref:c},[T.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(T.value,(F,G)=>(e.openBlock(),e.createElementBlock("div",{key:F.id,ref_for:!0,ref:p=>k.value[G]=p,class:e.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900 ",P(F.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",w.value===G&&!P(F.id)?"bg-blue-100":""]),"aria-disabled":P(F.id)?"true":"false",role:"option",tabindex:"-1",onClick:p=>Ht(F)},[F?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:e.normalizeStyle({backgroundColor:F?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",w.value===F.id?"text-white":"",(w.value===G,"")])},[S.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:_(F)},null,8,rr)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(F.text),1)],64))],2)],10,or))),128)):(e.openBlock(),e.createElementBlock("div",sr," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),n.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:Gt,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(we,{width:"16",height:"16"}),$[12]||($[12]=e.createElementVNode("span",null,"Додати",-1))],8,ir)):e.createCommentVNode("",!0)],512)],64))}}),dr=["placeholder","disabled"],rn=e.defineComponent({__name:"vs-input-textarea",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=de(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??"");function s(){typeof a.value=="string"&&(a.value=a.value.trim())}return(i,d)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":d[0]||(d[0]=c=>a.value=c),placeholder:r.value,disabled:o.value,row:"2",onBlur:s,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,42,dr)),[[e.vModelText,a.value]])}}),cr={},ur={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 pr(l,t){return e.openBlock(),e.createElementBlock("svg",ur,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 mr=q(cr,[["render",pr]]),hr={},fr={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function gr(l,t){return e.openBlock(),e.createElementBlock("svg",fr,t[0]||(t[0]=[e.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),e.createElementVNode("path",{d:"M7 20V4"},null,-1),e.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),e.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const yr=q(hr,[["render",gr]]),kr={},br={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 wr(l,t){return e.openBlock(),e.createElementBlock("svg",br,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 xr=q(kr,[["render",wr]]),_r={},Er={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 Vr(l,t){return e.openBlock(),e.createElementBlock("svg",Er,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const vr=q(_r,[["render",Vr]]),Br={},Cr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Nr(l,t){return e.openBlock(),e.createElementBlock("svg",Cr,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 sn=q(Br,[["render",Nr]]),Sr={},$r={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Mr(l,t){return e.openBlock(),e.createElementBlock("svg",$r,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 Dr=q(Sr,[["render",Mr]]),Fr={},Ar={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Lr(l,t){return e.openBlock(),e.createElementBlock("svg",Ar,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 Tr=q(Fr,[["render",Lr]]),Ir={class:"vs-datatable border rounded-xl w-full flex-grow"},Or={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},Rr={class:"relative w-full"},zr={class:"table-wrapper flex gap-2"},jr={class:"vs-popover inline-block text-slate-700"},Ur={class:"text-center"},Pr={class:""},Hr={class:"py-1 px-0 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},qr={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},Gr={class:"text-sm items-center text-gray-800 flex gap-1"},Kr={class:"w-full overflow-x-auto"},Yr={class:"w-full table-auto caption-bottom text-sm"},Wr={class:"[&_tr]:border-b"},Zr={class:"border-b data-[state=selected]:bg-muted bg-slate-50/50 dark:bg-slate-700/50 hover:bg-slate-50/80 dark:hover:bg-slate-700/80 transition-colors"},Jr={class:"h-10 px-2 align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] w-12 text-center"},Xr={key:0,colspan:"100%",class:"text-center"},Qr={class:"w-full"},es={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},ts=["onDragstart","onDragover","onDrop"],ns={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},ls={class:"flex items-center justify-center"},as={key:0,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},os={key:0},rs=["src"],ss={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},is=["innerHTML"],ds={key:2,class:"line-clamp-2 rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},cs={key:3,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},us={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},ps={class:"flex items-center justify-center gap-2"},ms=["onClick"],hs=["onClick"],fs={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},dn=e.defineComponent({__name:"vs-input-datatable",props:e.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref({}),o=e.ref(""),r=e.computed(()=>{if(!o.value)return n.value??[];const S=o.value.toLowerCase();return n.value.filter(_=>t.colModel?.some(N=>{const D=_[N.key];return D?Array.isArray(D)?D.join(", ").toLowerCase().includes(S):String(D).toLowerCase().includes(S):!1}))}),s=e.ref(null),i=e.ref(null),d=e.ref(!1),c=e.ref(null),m=e.ref({top:0,left:0}),f=S=>{s.value=S},x=S=>{i.value=S},g=S=>{if(s.value===null||s.value===S){s.value=null,i.value=null;return}const _=[...n.value],[N]=_.splice(s.value,1);_.splice(S,0,N),n.value=_,s.value=null,i.value=null},V=S=>{const N=S.currentTarget.getBoundingClientRect();m.value={top:N.bottom+window.scrollY,left:N.left+window.scrollX},d.value=!d.value},w=()=>{c.value&&c.value.click()},k=S=>{const _=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],N=S.toLowerCase();return _.some(D=>N.endsWith(D))},b=S=>{const N=S.target.files?.[0];if(!N)return;const D=new FileReader;D.onload=H=>{try{const ee=H.target?.result;if(typeof ee=="string"){const pe=JSON.parse(ee);Array.isArray(pe)&&n.value.push(...pe)}}catch(ee){console.error("Error parsing file:",ee)}},D.readAsText(N)},h=()=>{const S=JSON.stringify(n.value,null,2),_=new Blob([S],{type:"application/json"}),N=URL.createObjectURL(_),D=document.createElement("a");D.href=N,D.download="data.json",D.click(),URL.revokeObjectURL(N)};e.onMounted(async()=>{const S=t.colModel?.filter(_=>_.data);S?.length&&Promise.all(S.map(async _=>{const D=await(await fetch(`/api/suggest/${_.data}`)).json();a.value[_.key]=D.data}))});const v=e.ref(""),y=e.ref(!1);let C="edit",A=0;const M=e.ref({}),R=e.ref({});async function z(){v.value="Додати",y.value=!0,C="add",M.value={}}function P(S,_){const N=_.key||_.name;return a.value[N]&&S[N]?a.value[N].find(D=>D.id.toString()===S[N].toString())?.text??S[N]:S[N]||"-"}async function T(S,_){v.value="Редагувати",y.value=!0,C="edit",A=_,M.value={...S}}function Z(){const S=R.value.validate();if(S){te.notify({type:"warning",title:"Помилка валідації",message:Object.entries(S).map(([_,N])=>`${_}: ${N}`).join(`
2
- `)});return}C==="add"?Array.isArray(n.value)?n.value=[...n.value,M.value]:n.value=[M.value]:n.value=n.value.map((_,N)=>N===A?M.value:_),y.value=!1}function K(S){n.value=n.value.filter((_,N)=>N!==S)}function Q(){y.value=!1}return(S,_)=>(e.openBlock(),e.createElementBlock("div",Ir,[e.createElementVNode("div",Or,[e.createElementVNode("div",Rr,[e.createVNode(mr,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":_[0]||(_[0]=N=>o.value=N),placeholder:"Пошук",class:"py-2 px-3 pl-10 w-full bg-gray-100 h-[36px] rounded-[8px] text-[15px] leading-[18px] focus:border-1 text-stone-800 placeholder:text-[#6B7280] focus:outline-blue-500 focus:outline-2"},null,512),[[e.vModelText,o.value]])]),e.createElementVNode("div",zr,[e.createElementVNode("input",{ref_key:"fileInput",ref:c,onChange:b,class:"hidden",accept:".json",type:"file"},null,544),e.createElementVNode("div",jr,[e.createElementVNode("div",Ur,[e.createElementVNode("div",Pr,[e.createElementVNode("button",{onClick:V,class:"bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[e.createVNode(yr,{height:"16",width:"16"})])])])])]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[d.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:e.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:m.value.top+"px",left:m.value.left+"px"}])},[e.createElementVNode("div",Hr,[e.createElementVNode("div",qr,[e.createElementVNode("button",{onClick:w,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createVNode(xr,{class:"text-black",width:"14",height:"14"}),_[4]||(_[4]=e.createTextVNode(" Імпортувати ",-1))]),e.createElementVNode("button",{onClick:h,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createElementVNode("span",Gr,[e.createVNode(vr,{class:"text-black",width:"14",height:"14"}),_[5]||(_[5]=e.createTextVNode(" Експортувати ",-1))])])])])],4)):e.createCommentVNode("",!0)])),e.createElementVNode("button",{onClick:z,class:"text-slate-700 bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[e.createVNode(we),_[6]||(_[6]=e.createTextVNode(" Додати ",-1))])]),e.createElementVNode("div",Kr,[e.createElementVNode("table",Yr,[e.createElementVNode("thead",Wr,[e.createElementVNode("tr",Zr,[e.createElementVNode("th",Jr,[e.createVNode(sn,{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(S.colModel,N=>(e.openBlock(),e.createElementBlock("th",{key:N.key,class:"h-10 px-2 text-left align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 min-w-[150px]"},e.toDisplayString(N.ua||N.label),1))),128)),_[7]||(_[7]=e.createElementVNode("th",{class:"h-10 px-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 text-center"}," Дії ",-1))])]),e.createElementVNode("tbody",{class:e.normalizeClass({"[&_tr:last-child]:border-0":!i.value})},[r.value.length===0?(e.openBlock(),e.createElementBlock("td",Xr,[e.createElementVNode("div",Qr,[e.createElementVNode("div",es,[e.createVNode(Dr,{class:"w-48 mx-auto"}),_[8]||(_[8]=e.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[e.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),e.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(N,D)=>(e.openBlock(),e.createElementBlock("tr",{key:N.id,class:e.normalizeClass(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move",{"opacity-50":s.value===D,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":i.value===D}]),draggable:"true",onDragstart:H=>f(D),onDragover:e.withModifiers(H=>x(D),["prevent"]),onDrop:H=>g(D)},[e.createElementVNode("td",ns,[e.createElementVNode("div",ls,[e.createVNode(sn,{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(S.colModel,H=>(e.openBlock(),e.createElementBlock("td",{key:H.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[H.type==="file"?(e.openBlock(),e.createElementBlock("div",as,[k(P(N,H))?(e.openBlock(),e.createElementBlock("div",os,[e.createElementVNode("img",{src:P(N,H),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,rs)])):(e.openBlock(),e.createElementBlock("div",ss,[e.createVNode(Qt,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):H.type==="tiptap-editor"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors line-clamp-3",innerHTML:P(N,H)},null,8,is)):H.type==="reference"?(e.openBlock(),e.createElementBlock("div",ds,e.toDisplayString(P(N,H)),1)):(e.openBlock(),e.createElementBlock("div",cs,e.toDisplayString(P(N,H)),1))]))),128)),e.createElementVNode("td",us,[e.createElementVNode("div",ps,[e.createElementVNode("button",{onClick:H=>T(N,D),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-blue-50 dark:hover:bg-slate-600 hover:border-blue-300 dark:hover:border-slate-500 hover:text-blue-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[e.createVNode(Tr,{width:"24",height:"24",class:"w-3 h-3"})],8,ms),e.createElementVNode("button",{onClick:H=>K(D),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-red-50 dark:hover:bg-slate-600 hover:border-red-300 dark:hover:border-slate-500 hover:text-red-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[e.createVNode(Fe,{width:"24",height:"24",class:"w-3 h-3"})],8,hs)])])],42,ts))),128))],2)])]),e.createVNode(e.unref(te.VsModal),{visible:y.value,title:v.value,size:"lg",onClose:Q},{default:e.withCtx(()=>[e.createVNode(xe,{schema:t.colModel,values:M.value,"onUpdate:values":_[1]||(_[1]=N=>M.value=N),form:R.value,"onUpdate:form":_[2]||(_[2]=N=>R.value=N)},null,8,["schema","values","form"]),e.createElementVNode("div",fs,[e.createElementVNode("button",{type:"button",onClick:_[3]||(_[3]=N=>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:Z,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"])]))}}),gs={draw:{toolbar:{actions:{title:"Скасувати малювання",text:"Скасувати"},finish:{title:"Завершити малювання",text:"Завершити"},undo:{title:"Видалити останню точку",text:"Видалити останню"},buttons:{polyline:"Намалювати лінію",polygon:"Намалювати полігон",rectangle:"Намалювати прямокутник",circle:"Намалювати коло",marker:"Додати точку",circlemarker:"Додати маркер-коло"}},handlers:{circle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати коло",end:"Відпустіть кнопку миші, щоб завершити"},radius:"Радіус"},circlemarker:{tooltip:{start:"Клацніть на карту, щоб додати маркер-коло"}},marker:{tooltip:{start:"Клацніть на карту, щоб додати точку"}},polygon:{tooltip:{start:"Клацніть, щоб почати малювати полігон",cont:"Клацайте, щоб продовжити малювати полігон",end:"Клацніть першу точку, щоб завершити полігон"}},polyline:{error:"<strong>Помилка:</strong> лінія не може перетинатися сама з собою",tooltip:{start:"Клацніть, щоб почати малювати лінію",cont:"Клацайте, щоб продовжити малювати лінію",end:"Клацніть останню точку, щоб завершити лінію"}},rectangle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати прямокутник",end:"Відпустіть кнопку миші, щоб завершити"}},simpleshape:{tooltip:{end:"Відпустіть кнопку миші, щоб завершити"}}}},edit:{toolbar:{actions:{save:{title:"Зберегти зміни",text:"Зберегти"},cancel:{title:"Скасувати редагування",text:"Скасувати"},clearAll:{title:"Очистити всі шари",text:"Очистити все"}},buttons:{edit:"Редагувати шари",editDisabled:"Немає шарів для редагування",remove:"Видалити шари",removeDisabled:"Немає шарів для видалення"}},handlers:{edit:{tooltip:{text:"Перетягніть маркери, щоб редагувати шари",subtext:"Натисніть 'Скасувати', щоб повернутися"}},remove:{tooltip:{text:"Клацніть на шари, щоб видалити їх"}}}}},ys={},ks={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-map-pin"};function bs(l,t){return e.openBlock(),e.createElementBlock("svg",ks,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),e.createElementVNode("path",{d:"M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z"},null,-1)]))}const ws=q(ys,[["render",bs]]),xs={},_s={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 Es(l,t){return e.openBlock(),e.createElementBlock("svg",_s,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 Vs=q(xs,[["render",Es]]),vs={},Bs={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 Cs(l,t){return e.openBlock(),e.createElementBlock("svg",Bs,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 Ns=q(vs,[["render",Cs]]),Ss={},$s={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function Ms(l,t){return e.openBlock(),e.createElementBlock("svg",$s,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 Ds=q(Ss,[["render",Ms]]),Fs={},As={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 Ls(l,t){return e.openBlock(),e.createElementBlock("svg",As,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 Ts=q(Fs,[["render",Ls]]),Is={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},Os={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"},Rs=["onClick"],zs={class:"relative flex-1 min-w-[140px]"},js=["placeholder"],Us="https://data.softpro.ua/api-user/gis-url-proxy",Ps="https://geo.rv.ua/api-user/dzk.api",Hs=q(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 y=n.config?.tools?.filter(C=>o.includes(C));return y&&y.length?y:o}),s=e.computed(()=>n.config?.placeholder?.trim()||"Пошук…"),i=e.ref(r.value[0]??o[0]);e.watch(r,y=>{y.includes(i.value)||(i.value=y[0])});const d=e.ref(""),c=e.ref(!1),m=e.ref(null);e.watch(i,()=>{d.value="",c.value=!1});function f(y){i.value=y}function x(y){if(!c.value)return;const C=m.value;C&&!C.contains(y.target)&&(c.value=!1)}e.onMounted(()=>{window.addEventListener("click",x,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",x,!0)});function g(y){return y==="xy"?"Координати":y==="parcel"?"Кадастр":"Адреси"}function V(y){const C=y.replace(/[,]+/g," ").trim();if(!C)return null;const A=C.split(/\s+/).filter(Boolean);if(A.length<2)return null;const M=A.slice(0,2).map(Number);if(!M.every(Q=>Number.isFinite(Q)))return null;let[R,z]=M,P=R,T=z;const Z=Q=>Math.abs(Q)<=90,K=Q=>Math.abs(Q)<=180;if(!Z(P)||!K(T))if(Z(T)&&K(P))P=z,T=R;else return null;return{lat:P,lng:T}}function w(y){return(y?.items||[]).map((A,M)=>({id:String(A?.id??M),title:A?.title||A?.address?.label||"Знайдений обʼєкт",lat:Number(A?.position?.lat),lng:Number(A?.position?.lng)})).filter(A=>Number.isFinite(A.lat)&&Number.isFinite(A.lng))}function k(y){const C=y?.result||y?.data||y;if(!C)return[];const A=C.geom_centroid;if(!A||!Array.isArray(A.coordinates))return[];const[M,R]=A.coordinates;return!Number.isFinite(R)||!Number.isFinite(M)?[]:[{id:"parcel",title:C.cadnum||C.cad_num||"Земельна ділянка",lat:R,lng:M}]}function b(y){const A=y.replace(/\s+/g,"").split(":");if(A.length!==4)return!1;const M=[10,2,3,4];return A.every((R,z)=>R.length===M[z]&&/^\d+$/.test(R))}function h(y){a("goToCoordinates",[y.lat,y.lng])}async function v(){const y=d.value.trim();if(y){if(i.value==="xy"){const C=V(y);if(!C){te.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}h(C),d.value="";return}try{const C=new URL(i.value==="here"?Us:Ps);if(i.value==="here")C.searchParams.set("searchtext",y);else{if(!b(y)){te.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}C.searchParams.set("cad_num",y)}const A=await fetch(C.toString());if(!A.ok)throw new Error(`HTTP ${A.status}`);const M=await A.json(),R=i.value==="here"?w(M):k(M);if(!R.length)te.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const z=R[0];h(z),d.value=""}}catch(C){const A=C?.message||"Помилка пошуку";te.notify({type:"error",title:"Пошук",message:A})}}}return(y,C)=>(e.openBlock(),e.createElementBlock("div",Is,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(v,["prevent"])},[r.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:m,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:C[0]||(C[0]=A=>c.value=!c.value)},[e.createElementVNode("span",null,e.toDisplayString(g(i.value)),1),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":c.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},C[2]||(C[2]=[e.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2))]),c.value?(e.openBlock(),e.createElementBlock("div",Os,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,A=>(e.openBlock(),e.createElementBlock("li",{key:A,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:M=>f(A)},e.toDisplayString(g(A)),9,Rs))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",zs,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":C[1]||(C[1]=A=>d.value=A),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,js),[[e.vModelText,d.value,void 0,{trim:!0}]]),C[3]||(C[3]=e.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),[["__scopeId","data-v-3048520a"]]),qs={class:"bg-white/30 p-1 rounded-md shadow w-fit"},Gs={class:"flex gap-2"},Ks=["onClick","title"],Ys=["src"],Ws=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(l,{emit:t}){const n=l,a=e.ref(Object.keys(n.basemaps)[0]),o=t;function r(s){o("onLayerChange",s),a.value=s}return(s,i)=>(e.openBlock(),e.createElementBlock("div",qs,[e.createElementVNode("div",Gs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.basemaps,(d,c)=>(e.openBlock(),e.createElementBlock("div",{key:c,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":a.value===c}]),onClick:m=>r(c),title:d.name||c,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:d.preview,alt:"",class:"w-10 h-10 object-cover"},null,8,Ys)],10,Ks))),128))])]))}});function Re(l){return l?l.type==="Polygon"?{type:"MultiPolygon",coordinates:[l.coordinates]}:l.type==="Feature"?{...l,geometry:Re(l.geometry)}:l.type==="FeatureCollection"?{...l,features:(l.features||[]).map(t=>Re(t)).filter(Boolean)}:l:null}function Zs(l){return l?l.type==="FeatureCollection"||l.type==="Feature"?Re(l):l.geom?{type:"Feature",geometry:Re({type:l.geom.type,coordinates:l.geom.coordinates}),properties:{}}:l.type&&l.coordinates?{type:"Feature",geometry:Re(l),properties:{}}:null:null}const Js={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},Xs={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},Qs={class:"text-sm font-medium"},ei={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},ti={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},ni={class:"flex items-center gap-1"},li=["disabled"],ai=["disabled"],oi=["disabled"],ri={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"},si={class:"space-y-0.5"},ii={class:"text-gray-500"},di={class:"text-gray-900 text-right break-all"},ci={class:"absolute top-4 right-4 z-[1000]"},ui={class:"flex flex-col gap-[2px]"},pi=["disabled"],mi=["disabled"],hi=["disabled"],fi=["disabled"],gi={class:"flex flex-col gap-2"},yi={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]"},ki={class:"flex flex-col gap-1"},bi=["checked","disabled","onChange"],wi={class:"text-gray-700 text-xs font-medium"},xi={class:"absolute bottom-0 left-0 right-0 z-[1000] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},_i={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},Ei={class:"shrink-0"},Vi={class:"font-bold"},vi={class:"flex items-center"},Bi={class:"text-xs mr-2"},Ci={key:0,class:"text-xs"},Ni={key:1,class:"text-xs"},Si=["disabled"],$i=["disabled"],Xe="vs-base-tile-pane",Qe="vs-overlay-tile-pane",cn=q(e.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},ctrlZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},katottg:{default:""},layers:{default:()=>[]},bounds:{},api:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(l,{emit:t}){const a=e.getCurrentInstance()?.appContext?.config?.globalProperties?.$settings??{},o=Array.isArray(a.center)&&a.center.length===2?a.center:[50,30],r=typeof a.zoom=="number"?a.zoom:typeof a.defaultZoom=="number"?a.defaultZoom:10,s=l,i=t,d=e.computed(()=>!!s.disabled),c=e.ref(!1),m=e.ref(null),f=e.ref(!1),x=e.ref(""),g=e.ref(null),V=e.ref(null),w=e.ref(!1),k=e.ref(null),b=e.ref(null),h=e.ref(0),v=e.ref(o),y=e.ref(r),C=e.ref([]),A=e.ref(s.modelValue);let M=!1;const R=e.ref(null),z=e.computed(()=>{const p={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!s.tools?.length)return p;const u=new Set(s.tools.map(E=>E.toLowerCase()));return{search:u.has("search"),import:u.has("import"),export:u.has("export"),point:u.has("point"),line:u.has("line"),polygon:u.has("polygon"),rectangle:u.has("rectangle")}}),P=e.reactive({}),T=e.ref([]),Z=e.computed(()=>T.value.map(p=>P[p]).filter(Boolean)),K=e.ref(null),Q=e.computed(()=>K.value?.entries??[]),S=e.computed(()=>{if(!K.value)return;const p=12,u=K.value.point.x+p,E=K.value.point.y+p;return{left:`${u}px`,top:`${E}px`}});function _(p){if(typeof p!="string"||!p.trim())return"";if(/^https?:\/\//i.test(p))return p;const u=window?.location?.origin??"",E=p.replace(/^\/+/,"");return E?u?`${u}/${E}`:`/${E}`:u}function N(){if(Array.isArray(a.basemaps)&&a.basemaps.length){const u=a.basemaps.map((E,L)=>{const O=String(E?.key??E?.id??E?.name??`b${L}`),U=_(String(E?.url??""));if(!U)return null;const X=typeof E?.preview=="string"&&E.preview?_(E.preview):"";return[O,{...E,url:U,preview:X}]}).filter(E=>Array.isArray(E)&&E.length===2).reduce((E,[L,O])=>(E[L]=O,E),{});if(Object.keys(u).length)return u}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 D=N(),H=Object.keys(D),ee=e.ref(H.length?H[0]:"");let pe,I,le,fe,se=null;async function jt(){const p=L=>{if(!Array.from(document.styleSheets).some(O=>O?.href?.includes(L))){const O=document.createElement("link");O.rel="stylesheet",O.href=L,document.head.appendChild(O)}},u=L=>new Promise((O,U)=>{if(Array.from(document.scripts).some(ie=>ie.src===L))return O();const ne=document.createElement("script");ne.src=L,ne.async=!0,ne.onload=()=>O(),ne.onerror=ie=>U(ie),document.body.appendChild(ne)});p("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),p("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css");try{await u("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js")}catch{}try{await u("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js")}catch{}try{await u("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js")}catch{}return window.L}function ut(){const p=navigator.platform.toUpperCase().includes("MAC");return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Використовуйте два пальці для зуму карти.":p?"Використовуйте Ctrl або ⌘ + прокрутка для зуму карти.":"Використовуйте Ctrl + прокрутка для зуму карти."}function Ut(){if(!s.handleZoom||!m.value||!I)return null;let p;const u=L=>{const O=L.ctrlKey||L.metaKey||L.shiftKey;if(!s.ctrlZoom){f.value=!1,I.scrollWheelZoom.enable();return}if(!O){f.value=!0,x.value=ut(),clearTimeout(p),p=window.setTimeout(()=>f.value=!1,1200);return}L.preventDefault(),L.stopPropagation(),f.value=!1,I.scrollWheelZoom.enable(),setTimeout(()=>I.scrollWheelZoom.disable(),120)},E=L=>{if(L.touches.length===1){if(!s.ctrlZoom)return;f.value=!0,x.value=ut(),clearTimeout(p),p=window.setTimeout(()=>f.value=!1,3e3)}else f.value=!1};return m.value.addEventListener("wheel",u,{passive:!1}),m.value.addEventListener("touchstart",E,{passive:!0}),I.on("wheel",L=>{if(!s.ctrlZoom)return;L.originalEvent?.ctrlKey||L.originalEvent?.metaKey||L.originalEvent?.shiftKey||(L.originalEvent?.preventDefault?.(),L.originalEvent?.stopPropagation?.())}),()=>{m.value?.removeEventListener("wheel",u),m.value?.removeEventListener("touchstart",E),clearTimeout(p)}}function Pt(p,u){return p?.id?String(p.id):p?.url?`${p.url}-${u}`:`layer-${u}`}function Ce(p){const u=(p?.url??"").trim();if(!u)return"";if(/^https?:\/\//i.test(u))return u;const E=window.location?.origin??"",L=u.replace(/^\/+/,"");return`${E}/${L}`}function Te(p){const u=p?.style??{};return E=>{const L=u.colorAttr,O=u.colorSet??{},U=typeof L=="string"?O?.[E?.[L]]??u.color??"#3388ff":u.color??"#3388ff",X=u.stroke??U;return{weight:u.width??1,color:X,opacity:u.opacity??1,fill:u.type?u.type!=="polyline":!0,fillColor:U,fillOpacity:u.opacity??.5}}}function Ht(p){return p?.layer?.properties||p?.layer?.feature?.properties||p?.properties||{}}function Ie(p,u={}){return p.popup===!1?[]:Array.isArray(p.popup)&&p.popup.length?p.popup.map(E=>{if(!E?.field)return null;const L=u[E.field];return L==null||L===""?null:{key:E.label||E.field,value:String(L)}}).filter(E=>!!E):Object.entries(u).filter(([E])=>typeof E=="string"&&E).slice(0,5).map(([E,L])=>({key:E,value:L==null?"—":String(L)}))}function We(p,u){if(!I||!u?.latlng)return;const E=I.latLngToContainerPoint(u.latlng),L=Ht(u),O=Ie(p,L);if(!O.length){me(p.id);return}K.value={layerId:p.id,title:L?.name||p.title||p.name,properties:L,entries:O,point:{x:E.x,y:E.y}}}function me(p){p&&K.value?.layerId!==p||(K.value=null)}function pt(p){const u=(p?.service??"").toLowerCase(),E=Ce(p),L=p.sourceLayer||p.layer||p.service_layer||p.service_key||p.map_key||p.dataset?.layer||p.id||p.table_name;if(u==="vtile"){const O=R.value;if(O?.vectorGrid?.protobuf&&!O?.maplibreGL){const U=O.vectorGrid.protobuf(E,{interactive:!0,maxNativeZoom:p.maxzoom??19,vectorTileLayerStyles:{[L??"default"]:Te(p),default:Te(p)}});return U?.on?.("mouseover",X=>We(p,X)),U?.on?.("mousemove",X=>We(p,X)),U?.on?.("mouseout",()=>me(p.id)),U}if(O?.maplibreGL&&window?.maplibregl){const U=E;return U?O.maplibreGL({style:U,interactive:!1,pane:"overlayPane"}):null}return null}return u==="tile"||/^https?:\/\//i.test(E)||E.includes("{z}")?R.value.tileLayer(E,{opacity:p?.style?.opacity??1,pane:Qe}):R.value.tileLayer(E,{opacity:p?.style?.opacity??1,pane:Qe})}function Oe(p){const u=R.value;if(!u)return null;const E=("bounds"in p?p.bounds:void 0)??s.bounds??C.value;if(!Array.isArray(E)||!E.length)return null;const O={color:p.style?.stroke??p.style?.color??"#2563eb",weight:p.style?.width??2,interactive:!1,opacity:p.style?.opacity??.8,dashArray:"4 4"},U=Array.isArray(p.bounds)&&p.bounds.length?p.bounds:E,X=mt(U);if(!X.length||!u?.polyline)return null;const ne=X.map(ie=>{if(!ie.length)return ie;const Ze=ie[0],Yt=ie[ie.length-1];return Ze&&Yt&&typeof Yt.equals=="function"&&!Yt.equals(Ze)?[...ie,Ze]:ie});return u.polyline(ne,O)}function mt(p){const u=R.value;if(!u||!Array.isArray(p))return[];const E=O=>{if(!Array.isArray(O)||O.length<2)return null;const[U,X]=O;return!Number.isFinite(Number(X))||!Number.isFinite(Number(U))?null:u.latLng(Number(X),Number(U))},L=O=>Array.isArray(O)&&O.length>=2&&O.every(U=>Number.isFinite(Number(U)));if(p.length&&L(p[0])){const O=p.map(E).filter(Boolean);return O.length?[O]:[]}return p.length&&Array.isArray(p[0])&&Array.isArray(p[0][0])&&L(p[0][0][0])?p.flatMap(U=>Array.isArray(U)?U:[]).map(U=>Array.isArray(U)?U.map(E).filter(Boolean):[]).filter(U=>U.length):p.length&&Array.isArray(p[0])&&L(p[0][0])?p.map(U=>Array.isArray(U)?U.map(E).filter(Boolean):[]).filter(U=>U.length):[]}function Ne(){if(!I||!R.value)return;se&&I.hasLayer(se)&&(I.removeLayer(se),se=null);const p=Oe({id:"global-bounds",bounds:s.bounds??C.value,style:{}});p&&(se=p,se.addTo(I))}function Se(){!I||!R.value||T.value.forEach(p=>{const u=P[p];u&&(u.visible?(u.layer||(u.layer=pt(u.config)),u.boundsLayer||(u.boundsLayer=Oe(u.config)),u.layer&&!I.hasLayer(u.layer)&&u.layer.addTo(I),u.boundsLayer&&!I.hasLayer(u.boundsLayer)&&u.boundsLayer.addTo(I)):(u.layer&&I.hasLayer(u.layer)&&I.removeLayer(u.layer),u.boundsLayer&&I.hasLayer(u.boundsLayer)&&I.removeLayer(u.boundsLayer),me(u.id)))})}function ht(p){if(d.value)return;const u=P[p];u&&(u.visible=!u.visible,u.visible?(u.layer||(u.layer=pt(u.config)),u.boundsLayer||(u.boundsLayer=Oe(u.config)),u.layer&&!I.hasLayer(u.layer)&&u.layer.addTo(I),u.boundsLayer&&!I.hasLayer(u.boundsLayer)&&u.boundsLayer.addTo(I)):(u.layer&&I.hasLayer(u.layer)&&I.removeLayer(u.layer),u.boundsLayer&&I.hasLayer(u.boundsLayer)&&I.removeLayer(u.boundsLayer),me(u.id)))}e.watch(()=>s.layers,p=>{const u=Array.isArray(p)?p:[],E=[],L=new Set;u.forEach((O,U)=>{if(!O)return;const X=Pt(O,U);E.push(X),L.add(X);const ne=P[X],ie={...O,id:X},Ze=ne?.visible??ie?.overlay!==!1;ne&&(ne.layer&&I?.hasLayer(ne.layer)&&I.removeLayer(ne.layer),ne.boundsLayer&&I?.hasLayer(ne.boundsLayer)&&I.removeLayer(ne.boundsLayer),me(X)),P[X]={id:X,config:ie,visible:Ze,layer:null,boundsLayer:null}}),Object.keys(P).forEach(O=>{if(!L.has(O)){const U=P[O];U?.layer&&I?.hasLayer(U.layer)&&I.removeLayer(U.layer),U?.boundsLayer&&I?.hasLayer(U.boundsLayer)&&I.removeLayer(U.boundsLayer),me(O),delete P[O]}}),T.value=E,Se()},{immediate:!0,deep:!0}),e.watch(()=>s.bounds,()=>{I&&(Object.values(P).forEach(p=>{p.boundsLayer&&I.hasLayer(p.boundsLayer)&&I.removeLayer(p.boundsLayer),p.boundsLayer=null}),Ne(),Se())},{deep:!0}),e.watch(()=>s.katottg,async p=>{if(C.value=[],!p){Ne();return}try{const u=await fetch(`https://data.gki.com.ua/api-user/atu/${p}`);if(!u?.ok)return;const L=(await u.json())?.geometry?.coordinates;Array.isArray(L)&&L.length&&(C.value=L)}catch(u){console.error("Failed to fetch KATOTTG bounds",u)}finally{Ne(),Se()}},{immediate:!0}),e.watch(()=>s.modelValue,p=>{if(!I||!le){A.value=p;return}$e(p)},{deep:!0});function ft(p){const u=R.value;return p instanceof u.Circle?"Circle":p instanceof u.Rectangle?"Rectangle":p instanceof u.Polygon&&!(p instanceof u.Rectangle)?"Polygon":p instanceof u.Polyline&&!(p instanceof u.Polygon)?"Polyline":p instanceof u.Marker?"Point":"Feature"}function gt(p){const u=R.value;if(p instanceof u.Circle){const E=p.getRadius();return Math.PI*(E*E)/1e6}if(p instanceof u.Polygon||p instanceof u.Rectangle)try{const E=p.getLatLngs(),L=Array.isArray(E[0])?E[0]:E,O=u.GeometryUtil?.geodesicArea?u.GeometryUtil.geodesicArea(L):0;return O?O/1e6:0}catch{return null}return null}function yt(p){return p instanceof R.value.Circle?p.getLatLng():p.getBounds?p.getBounds().getCenter():p.getLatLng?p.getLatLng():I.getCenter()}function be(p){const u=le.toGeoJSON(),E=[];let L=null;const O=X=>{if(X)switch(X.type){case"Point":L=X;break;case"Polygon":E.push(X.coordinates);break;case"MultiPolygon":E.push(...X.coordinates);break;case"GeometryCollection":(X.geometries||[]).forEach(O);break}};(u?.features||[]).forEach(X=>O(X.geometry));const U=L||(E.length?{type:E.length===1?"Polygon":"MultiPolygon",coordinates:E.length===1?E[0]:E}:null);!p?.silent&&!M&&i("update:modelValue",U),h.value=le.getLayers().length}function $e(p){if(!le||!R.value)return;le.clearLayers();const u=Zs(p);if(!u){V.value=null,h.value=0;return}R.value.geoJSON(u).eachLayer(L=>le.addLayer(L)),M=!0,be({silent:!0}),M=!1,_e();const E=le.getBounds?.();E?.isValid?.()&&I?.fitBounds(E,{padding:[24,24]})}function _e(){const p=le.getLayers();if(!p.length){V.value=null,h.value=0;return}const u=p[p.length-1],E=ft(u),L=yt(u),O=gt(u);V.value={type:E,center:L,areaKm2:O,layer:u},h.value=p.length}const Ee=e.ref("");function Me(p){if(d.value||!I||!R.value)return;fe?.disable&&fe.disable();const u=R.value;switch(p){case"marker":fe=new u.Draw.Marker(I);break;case"polyline":fe=new u.Draw.Polyline(I);break;case"polygon":fe=new u.Draw.Polygon(I);break;case"rectangle":fe=new u.Draw.Rectangle(I);break}fe.enable(),Ee.value=p}function qt(){if(d.value)return;const p=V.value?.layer;p&&(p.getBounds?I.fitBounds(p.getBounds(),{padding:[30,30]}):p.getLatLng&&I.setView(p.getLatLng(),Math.max(y.value,14)))}function Gt(){d.value||le&&(le.clearLayers(),i("update:modelValue",null),V.value=null,h.value=0)}const kt=e.ref(null);function Kt(){d.value||kt.value?.click()}function bt(p){if(d.value)return;const u=p.target,E=u.files?.[0];if(!E)return;const L=new FileReader;L.onload=()=>{try{const O=JSON.parse(String(L.result));le.clearLayers(),O&&R.value.geoJSON(O).eachLayer(U=>le.addLayer(U)),be(),_e()}finally{u.value=""}},L.readAsText(E)}function B(){if(d.value)return;const p=le.toGeoJSON(),u=new Blob([JSON.stringify(p,null,2)],{type:"application/json"}),E=URL.createObjectURL(u),L=document.createElement("a");L.href=E,L.download="data.geojson",L.click(),URL.revokeObjectURL(E)}function $(p){!I||!R.value||!D[p]||(pe&&I.removeLayer(pe),pe=R.value.tileLayer(D[p].url,{maxZoom:19,minZoom:6,pane:Xe}).addTo(I),ee.value=p)}function F(p){if(!I||!R.value)return;const u=R.value.latLng(p[0],p[1]);I.setView(u,13)}let G=null;return e.onMounted(async()=>{R.value=await jt();const p=R.value;p.drawLocal=gs,I=p.map(m.value,{zoomControl:!1,scrollWheelZoom:!1}).setView(v.value,y.value),p.control.zoom({position:"bottomright"}).addTo(I);const u=ee.value||Object.keys(D)[0];I.createPane(Xe),I.getPane(Xe).style.zIndex="180",I.createPane(Qe),I.getPane(Qe).style.zIndex="220",u&&D[u]&&(ee.value=u,pe=p.tileLayer(D[u].url,{maxZoom:19,minZoom:6,pane:Xe}).addTo(I)),le=new p.FeatureGroup().addTo(I),I.on(p.Draw.Event.CREATED,L=>{if(d.value)return;const{layer:O}=L;le.clearLayers(),le.addLayer(O),be(),_e(),Ee.value=""}),I.on(p.Draw.Event.EDITED,()=>{d.value||(be(),_e())}),I.on(p.Draw.Event.DELETED,()=>{d.value||(be(),_e())});let E=!1;I.on("mousemove",L=>{E||(I.invalidateSize(),E=!0)}),I.on("zoomend",()=>{y.value=I.getZoom()}),G=Ut(),Se(),Ne(),A.value!==void 0&&($e(A.value),A.value=void 0)}),e.onUnmounted(()=>{G?.(),me(),se&&I?.hasLayer(se)&&(I.removeLayer(se),se=null),I?.remove&&I.remove()}),e.watch(c,()=>{setTimeout(()=>{I?.invalidateSize&&I.invalidateSize()},50)}),e.watch(w,async p=>{if(!p||!b.value){k.value=null;return}await e.nextTick();const u=b.value.getBoundingClientRect();k.value={top:u.bottom+6,left:u.left}}),(p,u)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",disabled:!c.value},[e.createElementVNode("div",{class:e.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:c.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:m,class:"w-full h-full"},null,512),e.createVNode(e.Transition,{name:"zoom-instructions","enter-active-class":"transition-all duration-200 ease-out","leave-active-class":"transition-all duration-500 ease-in","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:e.withCtx(()=>[f.value&&s.handleZoom?(e.openBlock(),e.createElementBlock("div",Js,[e.createElementVNode("div",Xs,[e.createElementVNode("p",Qs,e.toDisplayString(x.value),1)])])):e.createCommentVNode("",!0)]),_:1}),z.value.search||z.value.import||z.value.export?(e.openBlock(),e.createElementBlock("div",ei,[z.value.search?(e.openBlock(),e.createBlock(Hs,{key:0,onGoToCoordinates:F})):e.createCommentVNode("",!0),z.value.import||z.value.export?(e.openBlock(),e.createElementBlock("div",ti,[e.createElementVNode("div",ni,[z.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:Kt,disabled:d.value}," Import ",8,li)):e.createCommentVNode("",!0),z.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:B,disabled:d.value||h.value===0}," Export ",8,ai)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:kt,type:"file",onChange:bt,accept:".json,.geojson",class:"hidden",disabled:d.value},null,40,oi)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),Q.value.length?(e.openBlock(),e.createElementBlock("div",{key:1,class:"absolute z-[1500] pointer-events-none",style:e.normalizeStyle(S.value)},[e.createElementVNode("div",ri,[e.createElementVNode("dl",si,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Q.value,E=>(e.openBlock(),e.createElementBlock("div",{key:`${E.key}-${E.value}`,class:"flex justify-between gap-2"},[e.createElementVNode("dt",ii,e.toDisplayString(E.key),1),e.createElementVNode("dd",di,e.toDisplayString(E.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",ci,[e.createElementVNode("div",ui,[z.value.point?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":Ee.value==="marker"}]),title:"Point",onClick:u[0]||(u[0]=E=>Me("marker")),disabled:d.value},[e.createVNode(ws)],10,pi)):e.createCommentVNode("",!0),z.value.line?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":Ee.value==="polyline"}]),title:"Line",onClick:u[1]||(u[1]=E=>Me("polyline")),disabled:d.value},[e.createVNode(Vs)],10,mi)):e.createCommentVNode("",!0),z.value.polygon?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":Ee.value==="polygon"}]),title:"Polygon",onClick:u[2]||(u[2]=E=>Me("polygon")),disabled:d.value},[e.createVNode(Ns)],10,hi)):e.createCommentVNode("",!0),z.value.rectangle?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":Ee.value==="rectangle"}]),title:"Rectangle",onClick:u[3]||(u[3]=E=>Me("rectangle")),disabled:d.value},[e.createVNode(Ds)],10,fi)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:u[4]||(u[4]=E=>c.value=!c.value),title:"Full Screen"},[e.createVNode(Ts,{style:{width:"12px",height:"12px"}})])])]),e.createElementVNode("div",{class:e.normalizeClass(["absolute left-4 z-[1000]",V.value?"bottom-8":"bottom-4"])},[e.createElementVNode("div",gi,[e.createVNode(Ws,{basemaps:e.unref(D),onOnLayerChange:$},null,8,["basemaps"]),Z.value.length?(e.openBlock(),e.createElementBlock("div",yi,[u[9]||(u[9]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),e.createElementVNode("div",ki,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Z.value,E=>(e.openBlock(),e.createElementBlock("label",{key:E.id,class:"flex items-center gap-2 cursor-pointer select-none"},[e.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:E.visible,disabled:d.value,onChange:L=>ht(E.id)},null,40,bi),e.createElementVNode("span",wi,e.toDisplayString(E.config.title||E.config.name||E.id),1)]))),128))])])):e.createCommentVNode("",!0)])],2),e.createElementVNode("div",xi,[V.value?(e.openBlock(),e.createElementBlock("div",_i,[e.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:u[5]||(u[5]=E=>w.value=!0),onMouseleave:u[6]||(u[6]=E=>w.value=!1)},[e.createElementVNode("div",Ei,[u[10]||(u[10]=e.createTextVNode(" Type: ",-1)),e.createElementVNode("span",Vi,e.toDisplayString(V.value.type),1)]),g.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"addressEl",ref:b,class:"text-gray-500 text-xs truncate cursor-help",style:{"max-width":"260px"}}," Address: "+e.toDisplayString(g.value),513)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[w.value&&g.value&&k.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed z-[99999] pointer-events-none bg-gray-800 text-white text-xs px-2 py-1 rounded shadow whitespace-nowrap",style:e.normalizeStyle({top:k.value.top+"px",left:k.value.left+"px"})},e.toDisplayString(g.value),5)):e.createCommentVNode("",!0)]))],32),e.createElementVNode("div",vi,[e.createElementVNode("div",Bi,[u[11]||(u[11]=e.createTextVNode(" Center: ",-1)),e.createElementVNode("b",null,e.toDisplayString(V.value.center.lat.toFixed(5))+", "+e.toDisplayString(V.value.center.lng.toFixed(5)),1)]),V.value.areaKm2!==null?(e.openBlock(),e.createElementBlock("div",Ci,[u[12]||(u[12]=e.createTextVNode(" Area: ",-1)),e.createElementVNode("b",null,e.toDisplayString(V.value.areaKm2.toFixed(1))+" km²",1)])):(e.openBlock(),e.createElementBlock("div",Ni,u[13]||(u[13]=[e.createTextVNode("Area: ",-1),e.createElementVNode("b",null,"—",-1)]))),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:u[7]||(u[7]=E=>qt()),disabled:d.value},u[14]||(u[14]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"w-3 h-3"},[e.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),e.createElementVNode("path",{d:"M7 10l6 0"}),e.createElementVNode("path",{d:"M10 7l0 6"}),e.createElementVNode("path",{d:"M21 21l-6 -6"})],-1)]),8,Si),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:u[8]||(u[8]=E=>Gt()),disabled:d.value},[e.createVNode(Fe,{class:"w-3 h-3"})],8,$i)])])):e.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-52b45f71"]]),Mi=["data-focus"],Di={class:"flex items-center"},Fi={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},Ai=["onClick","aria-label"],Li={key:0,class:"absolute text-gray-500 truncate pl-2"},Ti={class:"flex-1 min-w-[2px]"},Ii=["placeholder"],Oi={class:"flex items-center shrink-0"},Ri=["disabled"],un=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:"Введіть тег"}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=t;de(n.style);const o=e.ref(null),r=e.ref(null),s=e.ref(null),i=e.ref(!1),d=e.ref(""),c=e.useModel(l,"modelValue"),m=e.computed(()=>n.placeholder||"Add tag…"),f=e.computed(()=>c.value?.length===0&&d.value===""),x=e.computed(()=>!n.disabled&&c.value?.length>0),g=e.computed(()=>n.disabled),V=async()=>{g.value||await e.nextTick(()=>s.value?.focus())},w=A=>{const M=A.trim();M!==""&&(!c.value||!Array.isArray(c.value)?c.value=[M]:n.unique?c.value.includes(M)||(c.value=[...c.value,M]):c.value=[...c.value,M],d.value="")},k=()=>{const A=d.value;A.trim()!==""&&w(A),d.value=""},b=A=>{const M=c.value.slice();M.splice(A,1),a("update:modelValue",M)},h=()=>{a("update:modelValue",[])},v=()=>{g.value||(i.value=!0)},y=()=>{i.value=!1,!g.value&&k()},C=A=>{const{key:M}=A;M==="Enter"?(A.preventDefault(),k()):M==="Backspace"&&d.value===""&&c.value.length>0&&b(c.value.length-1)};return(A,M)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:M[1]||(M[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":"",g.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(c.value,(R,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",Di,[e.createElementVNode("div",Fi,e.toDisplayString(R),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(P=>b(z),["stop"]),"aria-label":`Remove ${R}`},M[2]||(M[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,Ai)]))),128)),f.value?(e.openBlock(),e.createElementBlock("div",Li,e.toDisplayString(m.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Ti,[g.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":M[0]||(M[0]=R=>d.value=R),onFocus:v,onBlur:y,onKeydown:C,placeholder:c.value&&c.value.length?"":void 0},null,40,Ii)),[[e.vModelText,d.value]])])],512),e.createElementVNode("div",Oi,[x.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:g.value,onClick:e.withModifiers(h,["stop"])},M[3]||(M[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,Ri)):e.createCommentVNode("",!0)])],10,Mi)],2)],512))}}),zi={class:"relative flex gap-1 bg-white w-full"},ji=["disabled","placeholder"],pn=q(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=e.inject("values"),n=l,a=e.useModel(l,"modelValue");function o(s){const i={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ы:"y",э:"e",ю:"yu",я:"ya",ь:"",ъ:"",є:"ye",і:"i",ї:"yi",ґ:"g"};return s.toLowerCase().split("").map(d=>i[d]||d).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const r=()=>{const s=t?.value?.[n.parent||""]?.toString(),i=o(s);a.value=i.toString()};return(s,i)=>(e.openBlock(),e.createElementBlock("div",zi,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:s.disabled,placeholder:s.placeholder,"onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,ji),[[e.vModelText,a.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:r}," Gen ")]))}}),[["__scopeId","data-v-b0eba370"]]),Ui={class:"relative flex gap-1 bg-white w-full"},Pi=["disabled","placeholder"],Hi=["disabled"],qi={key:0},Gi={key:1},mn=q(e.defineComponent({__name:"vs-input-codegen",props:e.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref(!1),o=e.computed(()=>t.init!==!1),r=e.computed(()=>!!t.table&&!!t.code),s=()=>{if(!r.value)return"";const c=encodeURIComponent(String(t.table)),m=encodeURIComponent(String(t.code));return`/api/code-gen/${c}/${m}`},i=async()=>{if(!r.value||a.value)return;const c=s();if(c){a.value=!0;try{const f=await(await fetch(c)).text();n.value=f}finally{a.value=!1}}},d=()=>{o.value&&(n.value||i())};return e.onMounted(()=>{d()}),e.watch(()=>[t.table,t.code,t.init],()=>{d()}),(c,m)=>(e.openBlock(),e.createElementBlock("div",Ui,[e.withDirectives(e.createElementVNode("input",{disabled:c.disabled,placeholder:c.placeholder,"onUpdate:modelValue":m[0]||(m[0]=f=>n.value=f),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,Pi),[[e.vModelText,n.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:a.value||c.disabled||!r.value,onClick:i},[a.value?(e.openBlock(),e.createElementBlock("span",Gi,"...")):(e.openBlock(),e.createElementBlock("span",qi,"Gen"))],8,Hi)]))}}),[["__scopeId","data-v-6ee5237d"]]),Ki={class:"w-full"},Yi={ref:"sortableContainer",class:"flex flex-col gap-1"},Wi=["onDragstart","onDrop"],Zi={class:"w-1/3"},Ji={class:"w-2/3"},Xi=["onClick"],Qi={key:0,class:"text-[14px] text-gray-700"},ed={class:"mt-2 w-full flex items-center"},td=["disabled"],hn=q(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=k=>`${k}-${Math.random().toString(36).substring(2,15)}`,a=e.inject("values"),o=l,r=t,s=o.addButtonText??"Додати",i=o.ignore??[],d=e.ref([]),c=e.ref(null);(()=>{const k=o.parent&&a?.value?.[o.parent]||o.modelValue||{};d.value=Object.entries(k).filter(([b])=>!i.includes(b)).map(([b,h])=>({id:n("key-value-"),key:b,value:h}))})();function f(k){c.value=k}function x(k){if(c.value===null||c.value===k)return;const b=d.value.splice(c.value,1)[0];d.value.splice(k,0,b),c.value=null}const g=e.computed(()=>d.value.some(k=>k.key&&!k.value||!k.key&&k.value)),V=()=>{d.value.push({id:n("key-value-"),key:"",value:""})},w=k=>{d.value=d.value.filter(b=>b.id!==k)};return e.watch(d,k=>{const b={};k.forEach(v=>{v.key&&v.value!==void 0&&(b[v.key]=v.value)});const h={};i.length&&i.forEach(v=>{h[v]=o.parent?a?.value?.[o.parent]?.[v]:void 0}),a?.value&&o.parent&&(a.value[o.parent]={...h,...b}),r("update:modelValue",b)},{deep:!0}),(k,b)=>(e.openBlock(),e.createElementBlock("div",Ki,[e.createElementVNode("div",Yi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(h,v)=>(e.openBlock(),e.createElementBlock("div",{key:h.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":c.value===v}]),draggable:"true",onDragstart:y=>f(v),onDragover:b[0]||(b[0]=e.withModifiers(()=>{},["prevent"])),onDrop:y=>x(v)},[b[1]||(b[1]=e.createStaticVNode('<button class="cursor-move" data-v-a0f7fbfc><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-a0f7fbfc><circle cx="15" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="18" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="18" r="1.5" data-v-a0f7fbfc></circle></svg></button>',1)),e.createElementVNode("div",Zi,[e.createVNode(De,{modelValue:h.key,"onUpdate:modelValue":y=>h.key=y,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Ji,[e.createVNode(De,{modelValue:h.value,"onUpdate:modelValue":y=>h.value=y,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:y=>w(h.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(xt),{height:"16",width:"16"})],8,Xi)],42,Wi))),128))],512),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Qi," Дані для відображення відсутні ")),e.createElementVNode("div",ed,[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(we,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(s)),1)],8,td)])]))}}),[["__scopeId","data-v-a0f7fbfc"]]),nd={class:"w-full"},ld={ref:"sortableContainer",class:"flex flex-col gap-1"},ad=["onDragstart","onDrop"],od=["disabled"],rd={class:"flex-1"},sd=["onClick","disabled"],id={key:0,class:"text-[14px] text-gray-700"},dd={class:"mt-2 w-full flex items-center"},cd=["disabled"],St=q(e.defineComponent({__name:"vs-input-text-array",props:e.mergeModels({addButtonText:{default:"Додати"},inputType:{default:"text"},placeholder:{default:"Значення"},mask:{default:""},disabled:{type:Boolean,default:!1}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.ref(null),r=e.computed(()=>!!t.disabled),s=e.computed(()=>t.placeholder??""),i=e.computed(()=>t.addButtonText??"Додати");let d=!1;const c=k=>`${k}-${Math.random().toString(36).substring(2,15)}`,m=k=>{const b=k??n.value??[];a.value=b.map((h,v)=>({id:a.value[v]?.id??c("text-array"),value:h??""}))};m(),e.watch(()=>n.value,k=>{if(d){d=!1;return}m(k||[])},{deep:!0}),e.watch(a,k=>{d=!0,n.value=k.map(b=>b.value).filter(b=>b!=null&&b!=="")},{deep:!0});const f=e.computed(()=>r.value||a.value.some(k=>!k.value));function x(){f.value||(a.value=[...a.value,{id:c("text-array"),value:""}])}function g(k){r.value||(a.value=a.value.filter(b=>b.id!==k))}function V(k){r.value||(o.value=k)}function w(k){if(r.value||o.value===null||o.value===k)return;const b=[...a.value],[h]=b.splice(o.value,1);b.splice(k,0,h),a.value=b,o.value=null}return(k,b)=>(e.openBlock(),e.createElementBlock("div",nd,[e.createElementVNode("div",ld,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(h,v)=>(e.openBlock(),e.createElementBlock("div",{key:h.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":o.value===v}]),draggable:"true",onDragstart:y=>V(v),onDragover:b[0]||(b[0]=e.withModifiers(()=>{},["prevent"])),onDrop:y=>w(v)},[e.createElementVNode("button",{class:"cursor-move",type:"button",disabled:r.value},b[1]||(b[1]=[e.createStaticVNode('<svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-66316a33><circle cx="15" cy="12" r="1.5" data-v-66316a33></circle><circle cx="15" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="12" r="1.5" data-v-66316a33></circle><circle cx="21" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="18" r="1.5" data-v-66316a33></circle><circle cx="15" cy="18" r="1.5" data-v-66316a33></circle></svg>',1)]),8,od),e.createElementVNode("div",rd,[k.inputType==="text"?(e.openBlock(),e.createBlock(De,{key:0,modelValue:h.value,"onUpdate:modelValue":y=>h.value=y,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),k.inputType==="tel"?(e.openBlock(),e.createBlock(Bt,{key:1,modelValue:h.value,"onUpdate:modelValue":y=>h.value=y,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),k.inputType==="email"?(e.openBlock(),e.createBlock(vt,{key:2,modelValue:h.value,"onUpdate:modelValue":y=>h.value=y,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),k.inputType==="mask"?(e.openBlock(),e.createBlock(Vt,{key:3,modelValue:h.value,"onUpdate:modelValue":y=>h.value=y,mask:k.mask,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","mask","disabled","placeholder"])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:y=>g(h.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(xt),{height:"16",width:"16"})],8,sd)],42,ad))),128))],512),a.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",id," Дані для відображення відсутні ")),e.createElementVNode("div",dd,[e.createElementVNode("button",{type:"button",onClick:x,disabled:f.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(we,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(i.value),1)],8,cd)])]))}}),[["__scopeId","data-v-66316a33"]]),ud={class:"flex items-center gap-2 w-full"},pd=["disabled"],md=["disabled"],fn=e.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,{inputClass:a}=de(n.style),o=t,r=e.computed({get:()=>n.modelValue||"#000000",set:i=>o("update:modelValue",i)}),s=e.computed(()=>!!n.disabled);return(i,d)=>(e.openBlock(),e.createElementBlock("div",ud,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[0]||(d[0]=c=>r.value=c),disabled:s.value,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[i.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,pd),[[e.vModelText,r.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":d[1]||(d[1]=c=>r.value=c),disabled:s.value},null,8,md),[[e.vModelText,r.value]])]))}}),hd={class:"flex items-center gap-2 w-full"},fd=["min","max","step","disabled"],gd=["disabled"],gn=e.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,{inputClass:a}=de(n.style),o=t,r=e.computed({get:()=>Number(n.modelValue??n.min),set:i=>o("update:modelValue",Number(i))}),s=e.computed(()=>!!n.disabled);return(i,d)=>(e.openBlock(),e.createElementBlock("div",hd,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":d[0]||(d[0]=c=>r.value=c),min:i.min,max:i.max,step:i.step,disabled:s.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[i.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")])},null,10,fd),[[e.vModelText,r.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":d[1]||(d[1]=c=>r.value=c),disabled:s.value},null,8,gd),[[e.vModelText,r.value]])]))}}),yd={class:"flex items-center gap-2 w-full"},kd={class:"relative flex-1"},bd=["placeholder","disabled","onKeydown"],wd=["disabled"],xd={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},_d={key:1,class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},Ed={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},Vd={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},vd={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},Bd=["onClick"],Cd={key:0,class:"p-4 text-sm text-gray-500"},yn=e.defineComponent({__name:"vs-input-address",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},api:{default:""},geom:{default:""},includes:{default:()=>[]}},{modelValue:{default:""},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=t,{inputClass:o}=de(n.style),r=e.useModel(l,"modelValue"),s=e.computed({get:()=>r.value,set:b=>{r.value=b}}),i=e.ref(!1),d=e.ref([]),c=e.ref(!1),m=e.computed(()=>n.placeholder??""),f=e.computed(()=>!!n.disabled),x=e.inject("values");function g(){!f.value&&s.value.trim()&&V()}async function V(){const b=(s.value||"").trim();if(!b)return;let h=b;if(n.includes?.length&&x?.value){const y=n.includes.map(C=>x.value?.[C]).filter(Boolean);y.length&&(h=`${y.join(", ")}, ${b}`)}const v=n.api.replace("{{value}}",encodeURIComponent(h));i.value=!0;try{const C=await(await fetch(v)).json();d.value=Array.isArray(C)?C:[],c.value=!0}catch(y){console.error("Address search error:",y)}finally{i.value=!1}}function w(){c.value=!c.value}function k(b){if(!b)return;c.value=!1;const h=parseFloat(b.lat),y={type:"Point",coordinates:[parseFloat(b.lon),h]};n.geom&&x?.value&&(x.value[n.geom]=y),a("update:geom",y)}return(b,h)=>(e.openBlock(),e.createElementBlock("div",yd,[e.createElementVNode("div",kd,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":h[0]||(h[0]=v=>s.value=v),placeholder:m.value,disabled:f.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[e.unref(o),{"!border-red-600":n.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:e.withKeys(e.withModifiers(g,["prevent"]),["enter"])},null,42,bd),[[e.vModelText,s.value]]),d.value.length?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:w,title:"Show search results"},h[2]||(h[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:V,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:i.value||!s.value?.trim()},[i.value?(e.openBlock(),e.createElementBlock("svg",_d,h[4]||(h[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",xd,h[3]||(h[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,wd),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[c.value?(e.openBlock(),e.createElementBlock("div",Ed,[e.createElementVNode("div",Vd,[e.createElementVNode("div",vd,[h[6]||(h[6]=e.createElementVNode("span",null,"Search results",-1)),e.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:h[1]||(h[1]=v=>c.value=!1),title:"Close"},h[5]||(h[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,(v,y)=>(e.openBlock(),e.createElementBlock("li",{key:y,onClick:C=>k(v),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString(v.display_name),9,Bd))),128))]),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Cd," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),kn=(l="")=>`${l}${Math.floor(Math.random()*1e4)}`,Nd={class:"vs-datalist space-y-3"},Sd={class:"space-y-3"},$d=["onClick","disabled"],Md={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Dd=["disabled"],Fd=q(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:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.computed(()=>t.schema?.map(V=>({...V,disabled:t.disabled||V.disabled}))??[]),r=e.computed(()=>o.value.map(V=>g(V))),s=e.computed(()=>t.disabled?!1:t.maxItems?n.value.length<t.maxItems:!0),i=e.computed(()=>t.disabled||n.value.length<=(t.minItems||0));e.watch(()=>n.value.length,()=>{d(),c()},{immediate:!0}),e.watch(()=>t.schema,c,{immediate:!0,deep:!0});function d(){const V=n.value.length;a.value.length<V?a.value=[...a.value,...Array.from({length:V-a.value.length},()=>kn())]:a.value.length>V&&a.value.splice(V)}function c(){if(!t.minItems||n.value.length>=t.minItems)return;const V=t.minItems-n.value.length,w=Array.from({length:V},m);n.value=[...n.value,...w]}function m(){const V={};return o.value.forEach(w=>{V[w.name]=w?.default??null}),V}function f(){s.value&&(n.value=[...n.value,m()],d())}function x(V){i.value||(n.value=n.value.filter((w,k)=>k!==V),d(),c())}function g(V){return{...V}}return(V,w)=>(e.openBlock(),e.createElementBlock("div",Nd,[e.createElementVNode("div",Sd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(k,b)=>(e.openBlock(),e.createElementBlock("div",{key:a.value[b],class:"flex items-center gap-3"},[e.createVNode(xe,{schema:r.value,layout:"inline",navigation:!1,values:n.value[b],"onUpdate:values":h=>n.value[b]=h,"form-id":a.value[b]},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:h=>x(b),disabled:i.value},[e.createVNode(Fe,{class:"w-5 h-5"})],8,$d)]))),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",Md,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:f,disabled:!s.value},[e.createVNode(we,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Dd)]))}}),[["__scopeId","data-v-a7a64a30"]]),Ad={};function Ld(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 Td=q(Ad,[["render",Ld]]),Id={class:"vs-dataform space-y-4"},Od={class:"flex items-center justify-between mb-3"},Rd={class:"text-sm font-medium text-gray-700"},zd={class:"flex items-center gap-2"},jd=["title","onClick","disabled"],Ud=["title","onClick","disabled"],Pd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Hd=["disabled"],bn={VsInputText:De,VsInputRadio:Ct,"vs-input-text":De,"vs-input-password":pl,"vs-input-textarea":rn,"vs-input-mask":Vt,"vs-input-number":Wt,"vs-input-radio":Ct,"vs-input-select":Nt,"vs-input-switcher":_t,"vs-input-static":Et,"vs-input-container":on,"vs-input-date":sa,"vs-input-checkbox":Zt,"vs-input-file":nn,"vs-input-html":Et,"vs-input-email":vt,"vs-input-tel":Bt,"vs-input-datatable":dn,"vs-input-map":cn,"vs-input-file-list":ln,"vs-input-tags":un,"vs-input-slug":pn,"vs-input-codegen":mn,"vs-input-key-value":hn,"vs-input-text[]":St,"vs-input-range":gn,"vs-input-color":fn,"vs-input-native-select":Nt,"vs-input-array":St,"vs-input-address":yn,"vs-input-datalist":Fd,"vs-input-dataform":q(e.defineComponent({__name:"vs-input-dataform",props:e.mergeModels({schema:{default:()=>[]},minGroups:{default:0},maxGroups:{default:void 0},addButtonText:{default:"Додати групу фільтрів"},groupLabel:{default:"Якщо поле"},duplicateTitle:{default:"Дублювати групу"},removeTitle:{default:"Видалити групу"},emptyLabel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.computed(()=>t.groupLabel),r=e.computed(()=>t.emptyLabel??"Ще немає груп"),s=e.computed(()=>t.schema?.map(b=>({...b,disabled:t.disabled||b.disabled}))??[]),i=e.computed(()=>s.value.map(b=>k(b))),d=e.computed(()=>t.disabled?!1:t.maxGroups?n.value.length<t.maxGroups:!0),c=e.computed(()=>t.disabled||n.value.length<=(t.minGroups||0));e.watch(()=>n.value.length,()=>{m(),f()},{immediate:!0}),e.watch(()=>t.schema,f,{immediate:!0,deep:!0});function m(){const b=n.value.length;a.value.length<b?a.value=[...a.value,...Array.from({length:b-a.value.length},()=>kn())]:a.value.length>b&&a.value.splice(b)}function f(){if(!t.minGroups||n.value.length>=t.minGroups)return;const b=t.minGroups-n.value.length,h=Array.from({length:b},x);n.value=[...n.value,...h]}function x(){const b={};return s.value.forEach(h=>{b[h.name]=h?.default??null}),b}function g(){d.value&&(n.value=[...n.value,x()],m())}function V(b){c.value||(n.value=n.value.filter((h,v)=>v!==b),m(),f())}function w(b){if(t.disabled)return;const h=JSON.parse(JSON.stringify(n.value[b]??{}));n.value=[...n.value.slice(0,b+1),h,...n.value.slice(b+1)],m()}function k(b){return{...b}}return(b,h)=>(e.openBlock(),e.createElementBlock("div",Id,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(v,y)=>(e.openBlock(),e.createElementBlock("div",{key:a.value[y],class:"relative border border-gray-200 rounded-lg p-6 bg-white"},[e.createElementVNode("div",Od,[e.createElementVNode("div",Rd,e.toDisplayString(o.value),1),e.createElementVNode("div",zd,[e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.duplicateTitle,onClick:C=>w(y),disabled:t.disabled},[e.createVNode(Td,{class:"w-5 h-5"})],8,jd),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:C=>V(y),disabled:c.value},[e.createVNode(Fe,{class:"w-5 h-5"})],8,Ud)])]),e.createVNode(xe,{class:"vs-dataform__form",schema:i.value,layout:"inline",navigation:!1,values:n.value[y],"onUpdate:values":C=>n.value[y]=C,"form-id":a.value[y],disabled:t.disabled},null,8,["schema","values","onUpdate:values","form-id","disabled"])]))),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",Pd,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:g,disabled:!d.value},[e.createVNode(we,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Hd)]))}}),[["__scopeId","data-v-4dc5a1a3"]])},qd=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){te.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const s=await r.json();if(!t.set||!n)return;for(const[i,d]of Object.entries(t.set))n.value[i]=s.result[d]}catch(o){console.error(t.error,o)}}return(o,r)=>(e.openBlock(),e.createElementBlock("button",{onClick:a,class:"vs-button relative inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-blue-500 hover:border-blue-500 hover:bg-blue-500 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 ml-0 md:ml-2 mt-2 md:mt-0 py-[8px] md:w-2/4 whitespace-nowrap w-full"},e.toDisplayString(o.button),1))}}),Gd={class:"flex flex-col gap-1 w-full"},Kd={key:0,class:"text-sm text-gray-500"},wn=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(()=>cl[`${n.layout}`]),s=e.computed(()=>bn?.[`vs-input-${n.item.type}`]),i=e.computed(()=>{const m=e.unref(s);if(!m)return new Set;const f=m.props??m.__vccOpts?.props;if(!f)return new Set;const x=Array.isArray(f)?f:Object.keys(f);return new Set(x)}),d=e.computed(()=>{const m=n.item??{},f=i.value;return f.size?Object.fromEntries(Object.entries(m).filter(([x])=>f.has(x))):{}}),c=m=>{const f=typeof m=="object"&&m!==null?m:{value:m};o("value-selected",{...f,name:f.name??n.item?.name})};return(m,f)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{ua:n.item.ua,error:n.error||"",item:m.item,columns:n.columns,label:n.item.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${n.item.type}-component`])},[e.createElementVNode("div",Gd,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value),e.mergeProps(d.value,{modelValue:a.value,"onUpdate:modelValue":f[0]||(f[0]=x=>a.value=x),onValueSelected:c}),null,16,["modelValue"])),m.item.description&&n.layout!=="settings"?(e.openBlock(),e.createElementBlock("p",Kd,e.toDisplayString(m.item.description),1)):e.createCommentVNode("",!0)]),m.item.behavior?.api&&m.item.behavior?.button?(e.openBlock(),e.createBlock(qd,e.mergeProps({key:0},m.item.behavior,{value:a.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),Yd={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},Wd={class:"vs-compact-form-navigation__rail mt-[6px]"},Zd=["onClick"],Jd=q(e.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(l,{expose:t}){const n=l,a=e.ref([]),o=e.ref(""),r=e.ref(""),s=e.computed(()=>!!n.enabled),i=e.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),d=e.computed(()=>{const T=n.width;if(T==null)return{};const Z=typeof T=="number"?`${T}px`:`${T}`;return{width:Z,minWidth:Z}});let c=null,m=0,f=0,x=null,g=null,V=null;const w=()=>z(),k=()=>h();e.watch(()=>n.target,async T=>{if(A(),!T){x=null,a.value=[],o.value="";return}x=T,s.value&&(await e.nextTick(),C(T),h())},{immediate:!0}),e.watch(()=>n.scrollContainer,T=>{if(!s.value){g=T??null;return}b(T??null),e.nextTick(()=>h())},{immediate:!0}),e.onMounted(()=>{n.scrollContainer||b(null),h()}),e.onBeforeUnmount(()=>{A(),b(null,!0),x=null,typeof window<"u"&&(m&&window.cancelAnimationFrame(m),f&&window.cancelAnimationFrame(f))});function b(T,Z=!1){if(V&&(V(),V=null),Z){g=null;return}if(g=T??null,typeof window>"u")return;const K=T??window,Q=window;K.addEventListener("scroll",w,{passive:!0}),Q.addEventListener("resize",k),V=()=>{K.removeEventListener("scroll",w),Q.removeEventListener("resize",k)}}function h(){if(!s.value||!x)return;m&&typeof window<"u"&&window.cancelAnimationFrame(m);const T=()=>{v(),m=0};typeof window>"u"?T():m=window.requestAnimationFrame(T)}function v(){if(!s.value||!x)return;const T=Array.from(x.querySelectorAll("h1, h2")),Z=new Set,K=[];T.forEach((Q,S)=>{const _=Q.textContent?.trim()??"";if(!_)return;let N=(Q.getAttribute("id")??"").trim();N||(N=y(_)||`heading-${S+1}`);let D=N,H=1;for(;Z.has(D);)D=`${N}-${H+=1}`;Q.id!==D&&Object.assign(Q,{id:D}),Z.add(D),K.push({id:D,text:_,level:Q.tagName.toLowerCase()==="h1"?1:2})}),a.value=K,K.length||(o.value=""),R()}function y(T){return T.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function C(T){!T||!s.value||typeof MutationObserver>"u"||(A(),c=new MutationObserver(()=>h()),c.observe(T,{childList:!0,subtree:!0}))}function A(){c&&(c.disconnect(),c=null)}function M(T){const Z=g;if(!Z)return typeof window>"u"?T.offsetTop:T.getBoundingClientRect().top+window.scrollY;const K=T.getBoundingClientRect(),Q=Z.getBoundingClientRect();return K.top-Q.top+Z.scrollTop}function R(){if(!s.value||!a.value.length)return;const T=g,Z=(T?T.scrollTop:null)||(typeof window<"u"?window.scrollY:0),K=(T?T.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),Q=Z+K;let S=null;for(let N=0;N<a.value.length;N+=1){const D=a.value[N],H=document.getElementById(D.id);if(H){const ee=M(H);ee+H.offsetHeight>Z&&ee<Q&&(S=D.id)}}!S&&r.value&&(S=r.value),S&&(r.value=S);const _=T?T.scrollHeight-T.clientHeight:document.documentElement.scrollHeight-window.innerHeight;Z+5>=_&&(S=a.value[a.value.length-1].id),S&&(o.value=S)}function z(){s.value&&(f&&window.cancelAnimationFrame(f),f=window.requestAnimationFrame(()=>{R(),f=0}))}function P(T){if(!s.value)return;const Z=document.getElementById(T);if(!Z)return;const K=g,Q=Math.max(0,M(Z));K?K.scrollTo({top:Q,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:Q,behavior:"smooth"})}return t({refresh:h}),(T,Z)=>s.value&&a.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(d.value)},[e.createElementVNode("h2",Yd,e.toDisplayString(T.title),1),e.createElementVNode("div",Wd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,K=>(e.openBlock(),e.createElementBlock("div",{key:K.id,class:e.normalizeClass(["vs-compact-form-navigation__item relative",K.level===2?"vs-compact-form-navigation__item--nested":"",K.id===o.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick:Q=>P(K.id),class:e.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",K.level===2?"pl-[15px]":"pl-[18px]",K.id===o.value?"text-gray-800":"text-gray-500"])},[e.createElementVNode("span",null,e.toDisplayString(K.text),1)],10,Zd)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-1584a562"]]),ze={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон"},Xd=l=>typeof l=="string"?l.trim()?!1:ze.required:Array.isArray(l)?l.map(n=>typeof n=="string"?n.trim():n).filter(n=>n!=null&&n!=="").length?!1:ze.required:l?!1:ze.required,Qd=l=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return l?t.test(l)?!1:ze.email:!1},ec=l=>{const t=/^\+[1-9]\d{1,14}$/;return l?t.test(l)?!1:ze.tel:!1},tc=(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},nc=(l,t)=>!1,lc=(l,t)=>{switch(typeof t=="string"?t:t.type){case"required":return Xd(l);case"email":return Qd(l);case"tel":return ec(l);case"regexp":return tc(l,t);case"custom":return nc();default:return!1}},ac={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function xn(l){const t=l?.toLowerCase();return ac[t]||t}function $t(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=xn(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=$t(r.schema,r.disabled)),a.push(r)}),a}const n=[];return Object.entries(l).forEach(a=>{const o={name:a[0],...a[1],type:xn(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=$t(o.schema,o.disabled)),n.push(o)}),n}function oc(l,t,n=!1){const a=e.computed(()=>$t((Array.isArray(t),t),typeof n=="boolean"?n:n.value)),o=e.ref({});function r(c){const m=c?.conditions;if(!m)return!0;const f=Array.isArray(m)?m[0]:m,x=l?.value?.[f];return an(x,m)}const s=(c=a.value,m=!0)=>(c.forEach(f=>{if(f.rules){if(!r(f)){delete o.value[f.name];return}let x=!1,g=null;f.rules.forEach(V=>{const w=lc(l.value[f.name],V);w&&(x=!0,!g&&typeof w=="string"&&(g=w))}),x&&g?o.value[f.name]=g:delete o.value[f.name]}f.schema&&s(f.schema,!1)}),m&&Object.values(o.value).some(Boolean)?o.value:null),i=e.computed(()=>a.value?.filter(c=>c.hidden!==!0&&r(c)));return{errors:o,validate:s,reset:()=>{l.value={},o.value={}},visibleSchema:i}}const rc={class:"flex w-full h-full min-h-0 gap-6"},sc={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},xe=e.defineComponent({__name:"vs-compact-form",props:e.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:e.mergeModels(["handle-submit","update:modelValue","value-selected"],["update:form","update:values"]),setup(l,{expose:t,emit:n}){const a=n,o=l,r=e.useModel(l,"form"),s=e.useModel(l,"values"),{errors:i,validate:d,reset:c,visibleSchema:m}=oc(s,o.schema,e.toRef(o,"disabled")),f=e.ref(null),x=e.ref(null),g=e.computed(()=>o.navigation),V=e.computed(()=>o.navWidth),w=e.computed(()=>o.style?.columns),k=Object.freeze({container:12,label:3}),b=e.computed(()=>o.columns??w.value??k),h=e.computed(()=>o.columns!=null||w.value!=null),v=e.computed(()=>h.value?"horizontal":o.layout),y=z=>z?.columns?"horizontal":v.value,C=z=>z?.columns??b.value,A=()=>{a("update:modelValue",s.value),d(),a("handle-submit",s.value)},M=z=>{a("value-selected",z)};t({validate:d,reset:c,errors:i}),e.onMounted(()=>{o.modelValue&&(s.value=o.modelValue),r.value={value:s.value,errors:i.value,reset:c,validate:d,formId:o.formId}});function R(z,P){if(z===P)return!0;if(typeof z!="object"||typeof P!="object"||!z||!P)return!1;const T=Object.keys(z),Z=Object.keys(P);return T.length!==Z.length?!1:T.every(K=>z[K]===P[K])}return e.provide("form",r),e.provide("values",s),(z,P)=>(e.openBlock(),e.createElementBlock("div",rc,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:x},[e.createElementVNode("form",{ref_key:"formRef",ref:f,onSubmit:e.withModifiers(A,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",v.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),(T,Z)=>(e.openBlock(),e.createElementBlock("div",{key:T.name,class:e.normalizeClass(y(T)==="horizontal"?"col-span-12":`col-span-${T.col||12}`)},[e.createVNode(wn,{style:e.normalizeStyle(z.style),item:T,layout:y(T),columns:C(T),"model-value":s.value[T.name],"onUpdate:modelValue":K=>{const Q=s.value[T.name];R(Q,K)||(s.value[T.name]=K)},error:e.unref(i)[T.name],onValueSelected:M},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),y(T)==="settings"&&Z+1!==e.unref(m).length?(e.openBlock(),e.createElementBlock("div",sc)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(Jd,{target:f.value,"scroll-container":x.value,enabled:g.value,width:V.value},null,8,["target","scroll-container","enabled","width"])]))}}),ic={class:"relative"},dc={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},cc={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"},uc={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},pc={class:"font-medium text-gray-800 dark:text-[#ffffff]"},mc={class:"p-4 mim-h-0 h-full overflow-auto"},_n=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(l,{emit:t}){const n=l,a=t,o=e.ref(n.schema),r=e.ref(n.defaultValue?JSON.parse(JSON.stringify(n.defaultValue)):{}),s=e.ref({}),i=e.ref(n.token||""),d=e.ref(n.mode);async function c(){const f=s.value.validate();if(f){te.notify({type:"warning",title:"Помилка валідації",message:Object.entries(f).map(([x,g])=>`${x}: ${g}`).join(`
3
- `)});return}if(i.value)try{const x=await fetch(`/api/table/${i.value}`,{method:d.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r.value)});if(x.ok)await x.json(),te.notify({type:"success",title:"Успішно",message:`Дані успішно ${d.value==="add"?"збережено":"оновлено"}`}),a("save",r.value);else if(x.status===400){const g=await x.json().catch(()=>({}));te.notify({type:"warning",title:"Помилка валідації",message:g.message||"Некоректні дані (400)"})}else x.status===500?te.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):te.notify({type:"error",title:"Помилка",message:`Статус: ${x.status}`})}catch(x){te.notify({type:"error",title:"Помилка з’єднання",message:x.message||"Не вдалося виконати запит"})}else a("edit",r.value),m()}function m(){a("close")}return e.onMounted(async()=>{try{if(n.form&&!n.schema){const f=await fetch(`/api/template/form/${n.form}`);if(!f.ok){te.notify({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const x=await f.json();o.value=x.schema,i.value=x.token}else if(n.token&&!n.defaultValue){i.value=n.token;const f=await fetch(`/api/form/${i.value}`);if(!f.ok){te.notify({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const x=await f.json();o.value=x.schema,x.data?r.value=x.data:d.value="add",x.obj&&(r.value={...r.value,...x.obj})}}catch(f){te.notify({type:"error",title:"Error",message:f.message||"Unexpected error"}),console.error(f)}}),(f,x)=>(e.openBlock(),e.createElementBlock("div",ic,[e.createElementVNode("div",dc,[e.createElementVNode("div",cc,[e.createElementVNode("div",uc,[e.createElementVNode("h3",pc,e.toDisplayString(d.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:m,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"},x[2]||(x[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",mc,[o.value?(e.openBlock(),e.createBlock(xe,{key:0,schema:o.value,values:r.value,"onUpdate:values":x[0]||(x[0]=g=>r.value=g),form:s.value,"onUpdate:form":x[1]||(x[1]=g=>s.value=g)},null,8,["schema","values","form"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"vs-form__head mr-5 mb-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},[e.createElementVNode("button",{type:"button",onClick:m,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:c,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])])])]))}}),hc=1440*60*1e3,fc=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],gc=["січ","лют","бер","квіт","трав","черв","лип","серп","вер","жовт","лист","груд"],yc=["нд","пн","вт","ср","чт","пт","сб"];function ae(l){return l instanceof Date&&!Number.isNaN(l.getTime())}const Ae=l=>new Date(l.getTime());function Be(l){const t=Ae(l);return t.setHours(0,0,0,0),t}function je(l){const t=Ae(l);return t.setHours(23,59,59,999),t}function Mt(l){return Be(new Date(l.getFullYear(),l.getMonth(),1))}function Dt(l){return je(new Date(l.getFullYear(),l.getMonth()+1,0))}function Ft(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 kc(l,t){return Ft(l,-1)}function et(l,t){const n=new Date(l);return n.setFullYear(n.getFullYear()+t),n}function En(l,t){return et(l,-t)}function Vn(l){return Be(new Date(l.getFullYear(),0,1))}function vn(l){return je(new Date(l.getFullYear(),11,31))}function bc(l){const t=Math.floor(l.getFullYear()/10)*10;return Be(new Date(t,0,1))}function wc(l){const t=Math.floor(l.getFullYear()/10)*10+9;return je(new Date(t,11,31))}const he=l=>l.getFullYear(),tt=l=>Math.floor(l.getFullYear()/10)*10;function xc(l){const t=[];let n=Be(l.start);const a=Be(l.end);for(;n<=a;)t.push(Ae(n)),n=new Date(n.getTime()+hc);return t}function _c(l){const t=[];let n=Mt(l.start);const a=Dt(l.end);for(;n<=a;)t.push(Ae(n)),n=Ft(n,1);return t}function Ec(l){const t=[];let n=Vn(l.start);const a=vn(l.end);for(;n<=a;)t.push(Ae(n)),n=et(n,1);return t}function At(l,t=1){const n=Be(l),a=(n.getDay()-t+7)%7;return n.setDate(n.getDate()-a),n}function Vc(l,t=1){const n=At(l,t);return n.setDate(n.getDate()+6),je(n)}function vc(l,t,n=0){const a=At(l,n),o=(t-n+7)%7;return a.setDate(a.getDate()+o),a}const nt=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth()&&l.getDate()===t.getDate(),Lt=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth(),Bn=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear(),Cn=(l,t)=>!!l&&!!t&&nt(l,t)&&l.getHours()===t.getHours(),Bc=(l,t)=>!!l&&!!t&&Cn(l,t)&&l.getMinutes()===t.getMinutes();function Cc(l,t){const n=l.getTime();return n>=t.start.getTime()&&n<=t.end.getTime()}const Ue=(l,t)=>!!l&&!!t&&l.getTime()<t.getTime(),Pe=(l,t)=>!!l&&!!t&&l.getTime()>t.getTime();function Nc(l){const t=l.filter(n=>ae(n));if(t.length)return t.reduce((n,a)=>n.getTime()>=a.getTime()?n:a)}function Sc(l){const t=l.filter(n=>ae(n));if(t.length)return t.reduce((n,a)=>n.getTime()<=a.getTime()?n:a)}function Nn(l,t){const n=Ae(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 lt=(l,t=2)=>String(l).padStart(t,"0");function Sn(l,t){return t==="wide"?fc[l]:gc[l]}function $c(l){return yc[l]}const Mc=[{token:"LLLL",format:l=>Sn(l.getMonth(),"wide")},{token:"LLL",format:l=>Sn(l.getMonth(),"abbreviated")},{token:"EE",format:l=>$c(l.getDay())},{token:"yyyy",format:l=>String(l.getFullYear())},{token:"MM",format:l=>lt(l.getMonth()+1)},{token:"dd",format:l=>lt(l.getDate())},{token:"HH",format:l=>lt(l.getHours())},{token:"mm",format:l=>lt(l.getMinutes())}];function at(l,t){if(!ae(l))return"";let n="",a=0;for(;a<t.length;){const o=Mc.find(r=>t.startsWith(r.token,a));o?(n+=o.format(l),a+=o.token.length):(n+=t[a],a+=1)}return n}const Dc={"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 $n(l,t){const n=Dc[t];if(!n){const o=new Date(l);return ae(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 ae(i)?i:null}case"dd.MM.yyyy":{const[,o,r,s]=a,i=new Date(Number(s),Number(r)-1,Number(o));return ae(i)?i:null}case"dd.MM.yyyy HH:mm":{const[,o,r,s,i,d]=a,c=new Date(Number(s),Number(r)-1,Number(o),Number(i),Number(d));return ae(c)?c:null}case"HH:mm":{const[,o,r]=a,s=new Date;return s.setHours(Number(o),Number(r),0,0),s}case"MM.yyyy":{const[,o,r]=a;return new Date(Number(r),Number(o)-1,1)}case"yyyy":{const[,o]=a;return new Date(Number(o),0,1)}default:return null}}const Fc=["year","month","day","time","custom"],Ac=e.defineComponent({emits:{elementClick:l=>ae(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"&&Fc.includes(l)}}}),Lc={class:"v3dp__heading"},Tc=["disabled"],Ic=["disabled"],Oc={class:"v3dp__body"},Rc={class:"v3dp__subheading"},zc={class:"v3dp__elements"},jc=["disabled","onClick"];function Uc(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",Lc,[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,Tc),(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,Ic)]),e.createElementVNode("div",Oc,["subheading"in l.$slots?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Rc,[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",zc,[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,jc))),128))],!0)])])],38)}const ot=q(Ac,[["render",Uc],["__scopeId","data-v-3b9aea7a"]]),Pc=e.defineComponent({components:{PickerPopup:ot},emits:{"update:pageDate":l=>ae(l),select:l=>ae(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(()=>bc(l.pageDate)),a=e.computed(()=>wc(l.pageDate)),o=(f,x,g)=>!x&&!g?!0:!(x&&he(f)<he(x)||g&&he(f)>he(g)),r=e.computed(()=>Ec({start:n.value,end:a.value}).map(f=>({value:f,key:String(he(f)),display:he(f),selected:!!l.selected&&he(f)===he(l.selected),disabled:!o(f,l.lowerLimit,l.upperLimit)}))),s=e.computed(()=>{const f=he(n.value),x=he(a.value);return`${f} - ${x}`}),i=e.computed(()=>l.lowerLimit&&(tt(l.lowerLimit)===tt(l.pageDate)||Ue(l.pageDate,l.lowerLimit))),d=e.computed(()=>l.upperLimit&&(tt(l.upperLimit)===tt(l.pageDate)||Pe(l.pageDate,l.upperLimit)));return{years:r,heading:s,leftDisabled:i,rightDisabled:d,previousPage:()=>t("update:pageDate",En(l.pageDate,10)),nextPage:()=>t("update:pageDate",et(l.pageDate,10))}}});function Hc(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 qc=q(Pc,[["render",Hc]]),Gc=e.defineComponent({components:{PickerPopup:ot},emits:{"update:pageDate":l=>ae(l),select:l=>ae(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(()=>Vn(l.pageDate)),a=e.computed(()=>vn(l.pageDate)),o=e.computed(()=>x=>at(x,l.format)),r=(x,g,V)=>!g&&!V?!0:!(g&&Ue(x,Mt(g))||V&&Pe(x,Dt(V))),s=e.computed(()=>_c({start:n.value,end:a.value}).map(x=>({value:x,display:o.value(x),key:o.value(x),selected:!!l.selected&&Lt(l.selected,x),disabled:!r(x,l.lowerLimit,l.upperLimit)}))),i=e.computed(()=>he(n.value)),d=e.computed(()=>l.lowerLimit&&(Bn(l.lowerLimit,l.pageDate)||Ue(l.pageDate,l.lowerLimit))),c=e.computed(()=>l.upperLimit&&(Bn(l.upperLimit,l.pageDate)||Pe(l.pageDate,l.upperLimit)));return{months:s,heading:i,leftDisabled:d,rightDisabled:c,previousPage:()=>t("update:pageDate",En(l.pageDate,1)),nextPage:()=>t("update:pageDate",et(l.pageDate,1))}}});function Kc(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 Yc=q(Gc,[["render",Kc]]),Wc=e.defineComponent({components:{PickerPopup:ot},emits:{"update:pageDate":l=>ae(l),select:l=>ae(l),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"dd"},headingFormat:{type:String,required:!1,default:"LLLL yyyy"},weekdayFormat:{type:String,required:!1,default:"EE"},weekStartsOn:{type:Number,required:!1,default:1,validator:l=>typeof l=="number"&&Number.isInteger(l)&&l>=0&&l<=6},customWeekdays:{type:Array,required:!1},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1}},setup(l,{emit:t}){const n=e.computed(()=>k=>b=>at(b,k)),a=e.computed(()=>Mt(l.pageDate)),o=e.computed(()=>Dt(l.pageDate)),r=e.computed(()=>({start:a.value,end:o.value})),s=e.computed(()=>({start:At(a.value,l.weekStartsOn),end:Vc(o.value,l.weekStartsOn)})),i=e.computed(()=>l.customWeekdays?.length===7?l.customWeekdays:null),d=e.computed(()=>{const k=l.weekStartsOn,b=i.value;if(b)return Array.from({length:7}).map((v,y)=>b[(k+y)%7]);const h=n.value(l.weekdayFormat);return Array.from(Array(7)).map((v,y)=>(k+y)%7).map(v=>vc(new Date,v,l.weekStartsOn)).map(h)}),c=(k,b,h,v)=>v?.dates?.some(y=>nt(k,y))||v?.predicate?.(k)?!1:!b&&!h?!0:!(b&&Ue(k,Be(b))||h&&Pe(k,je(h))),m=e.computed(()=>{const k=new Date,b=n.value(l.format);return xc(s.value).map(h=>({value:h,display:b(h),selected:!!l.selected&&nt(l.selected,h),current:nt(k,h),disabled:!l.allowOutsideInterval&&!Cc(h,r.value)||!c(h,l.lowerLimit,l.upperLimit,l.disabledDates),key:n.value("yyyy-MM-dd")(h)}))}),f=e.computed(()=>n.value(l.headingFormat)(l.pageDate)),x=e.computed(()=>l.lowerLimit&&(Lt(l.lowerLimit,l.pageDate)||Ue(l.pageDate,l.lowerLimit))),g=e.computed(()=>l.upperLimit&&(Lt(l.upperLimit,l.pageDate)||Pe(l.pageDate,l.upperLimit)));return{weekDays:d,days:m,heading:f,leftDisabled:x,rightDisabled:g,previousPage:()=>t("update:pageDate",kc(l.pageDate)),nextPage:()=>t("update:pageDate",Ft(l.pageDate,1))}}});function Zc(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,items:l.days,viewMode:"day",onLeft:l.previousPage,onRight:l.nextPage,onHeading:t[0]||(t[0]=i=>l.$emit("back")),onElementClick:t[1]||(t[1]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),subheading:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.weekDays,(i,d)=>(e.openBlock(),e.createElementBlock("span",{key:i,class:e.normalizeClass(`v3dp__subheading__weekday__${d}`)},e.toDisplayString(i),3))),128))]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const Jc=q(Wc,[["render",Zc]]);function Mn(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 Xc=e.defineComponent({components:{PickerPopup:ot},emits:{select:l=>ae(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,g=>{let V=0,w=0;g&&(V=g.getHours(),w=g.getMinutes()),r.value=V,s.value=w});const i=e.computed(()=>[...Array(24).keys()].map(g=>({value:g,date:Nn(new Date(o.value.getTime()),{hours:g,minutes:s.value,seconds:0}),selected:r.value===g,ref:e.ref(null)}))),d=e.computed(()=>[...Array(60).keys()].map(g=>({value:g,date:Nn(new Date(o.value.getTime()),{hours:r.value,minutes:g,seconds:0}),selected:s.value===g,ref:e.ref(null)}))),c=g=>{s.value=g.value,t("select",g.date)},m=()=>{const g=i.value.find(w=>w.ref.value?.classList?.contains("selected")??!1),V=d.value.find(w=>w.ref.value?.classList?.contains("selected")??!1);g&&V&&(Mn(n.value,g.ref.value),Mn(a.value,V.ref.value))};return e.watch(()=>l.visible,g=>{g&&e.nextTick(m)}),{hoursListRef:n,minutesListRef:a,hours:r,minutes:s,hoursList:i,minutesList:d,padStartZero:g=>`0${g}`.substr(-2),selectMinutes:c,isEnabled:g=>!(l.disabledTime?.dates?.some(V=>Cn(g,V)&&Bc(g,V))||l.disabledTime?.predicate?.(g)),scroll:m}}}),Qc={ref:"hoursListRef",class:"v3dp__column"},eu=["disabled","onClick"],tu={ref:"minutesListRef",class:"v3dp__column"},nu=["disabled","onClick"];function lu(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",Qc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.hoursList,i=>(e.openBlock(),e.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:e.normalizeClass([{selected:i.selected},"v3dp__element_button__hour"]),disabled:!l.isEnabled(i.date),onClick:e.withModifiers(d=>l.hours=i.value,["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,eu))),128))],512),e.createElementVNode("div",tu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.minutesList,i=>(e.openBlock(),e.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:e.normalizeClass([{selected:i.selected},"v3dp__element_button__minute"]),disabled:!l.isEnabled(i.date),onClick:e.withModifiers(d=>l.selectMinutes(i),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,nu))),128))],512)]),_:1})}const au=q(Xc,[["render",lu],["__scopeId","data-v-c075af58"]]),rt=["time","day","month","year"],ou=(l,t,n=void 0)=>{let a=n||new Date;const o=Nc([l,a]);o&&(a=o);const r=Sc([t,a]);return r&&(a=r),a},ru=e.defineComponent({components:{YearPicker:qc,MonthPicker:Yc,DayPicker:Jc,TimePicker:au},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||ae(l),decadePageChanged:l=>!0,yearPageChanged:l=>!0,monthPageChanged:l=>!0,opened:()=>!0,closed:()=>!0},setup(l,{emit:t,attrs:n}){const a=e.ref("none"),o=e.ref(l.startingViewDate),r=e.ref(null),s=e.ref(!1),i=e.ref(""),d=S=>{const _=S.replace(/[a-zA-Z]/g,"0");return/0/.test(_)?_:""},c=e.computed(()=>d(l.inputFormat));let m=null,f=null;const x=()=>{m?.destroy(),m=null},g=async()=>{if(!f){const{default:S}=await Promise.resolve().then(()=>zt);f=S}return f},V=()=>{m&&m.value!==i.value&&(m.value=i.value??"")},w=async()=>{if(x(),!r.value||!c.value)return;m=(await g())(r.value,{mask:c.value,lazy:!0,overwrite:!0}),V()};e.watchEffect(()=>{if(!i.value)return;const S=$n(i.value,l.inputFormat);S&&(o.value=S)}),e.watchEffect(()=>{i.value=l.modelValue&&ae(l.modelValue)?at(l.modelValue,l.inputFormat):""}),e.onMounted(()=>{c.value&&e.nextTick(()=>{w()})}),e.onBeforeUnmount(()=>{x()}),e.watch(c,S=>{S?e.nextTick(()=>{w()}):x()}),e.watch(i,()=>{V()});const k=(S="none")=>{l.disabled||(S!=="none"&&a.value==="none"&&(o.value=l.modelValue||ou(l.lowerLimit,l.upperLimit,o.value)),a.value=S,t(S!=="none"?"opened":"closed"))};e.watchEffect(()=>{l.disabled&&(a.value="none")});const b=(S,_)=>{o.value=_,S==="year"?t("decadePageChanged",_):S==="month"?t("yearPageChanged",_):S==="day"&&t("monthPageChanged",_)},h=S=>{o.value=S,l.minimumView==="year"?(k("none"),t("update:modelValue",S)):a.value="month"},v=S=>{o.value=S,l.minimumView==="month"?(k("none"),t("update:modelValue",S)):a.value="day"},y=S=>{o.value=S,l.minimumView==="day"?(k("none"),t("update:modelValue",S)):a.value="time"},C=S=>{k("none"),t("update:modelValue",S)},A=()=>{l.clearable&&(k("none"),t("update:modelValue",null),o.value=l.startingViewDate)},M=()=>s.value=!0,R=()=>k(T.value),z=()=>{s.value=!1,k()},P=S=>{const _=S.keyCode?S.keyCode:S.which;if([27,13].includes(_)&&r.value.blur(),l.typeable){const D=$n(r.value.value,l.inputFormat);D&&i.value===at(D,l.inputFormat)&&(i.value=r.value.value,t("update:modelValue",D))}},T=e.computed(()=>{const S=rt.indexOf(l.startingView),_=rt.indexOf(l.minimumView);return S<_?l.minimumView:l.startingView}),Z=S=>Object.fromEntries(Object.entries(S??{}).filter(([_,N])=>_.startsWith("--"))),K=e.computed(()=>l.weekDayNames?.length===7?l.weekDayNames:void 0);return{blur:z,focus:R,click:M,input:i,inputRef:r,pageDate:o,renderView:k,updatePageDate:b,selectYear:h,selectMonth:v,selectDay:y,selectTime:C,keyUp:P,normalizedWeekdayNames:K,viewShown:a,goBackFromTimepicker:()=>l.startingView==="time"&&l.minimumView==="time"?null:a.value="day",clearModelValue:A,initialView:T,log:S=>console.log(S),variables:Z}}}),su={class:"v3dp__input_wrapper"},iu=["readonly","placeholder","disabled","tabindex"],du={class:"v3dp__clearable"};function cu(l,t,n,a,o,r){const s=e.resolveComponent("year-picker"),i=e.resolveComponent("month-picker"),d=e.resolveComponent("day-picker"),c=e.resolveComponent("time-picker");return e.openBlock(),e.createElementBlock("div",{class:"v3dp__datepicker",style:e.normalizeStyle(l.variables(l.$attrs.style))},[e.createElementVNode("div",su,[e.withDirectives(e.createElementVNode("input",e.mergeProps({type:"text",ref:"inputRef",readonly:!l.typeable,"onUpdate:modelValue":t[0]||(t[0]=m=>l.input=m)},l.$attrs,{placeholder:l.placeholder,disabled:l.disabled,tabindex:l.disabled?-1:0,onKeyup:t[1]||(t[1]=(...m)=>l.keyUp&&l.keyUp(...m)),onBlur:t[2]||(t[2]=(...m)=>l.blur&&l.blur(...m)),onFocus:t[3]||(t[3]=(...m)=>l.focus&&l.focus(...m)),onClick:t[4]||(t[4]=(...m)=>l.click&&l.click(...m))}),null,16,iu),[[e.vModelText,l.input]]),e.withDirectives(e.createElementVNode("div",du,[e.renderSlot(l.$slots,"clear",{onClear:l.clearModelValue},()=>[e.createElementVNode("i",{onClick:t[5]||(t[5]=m=>l.clearModelValue())},"x")])],512),[[e.vShow,l.clearable&&l.modelValue]])]),e.withDirectives(e.createVNode(s,{pageDate:l.pageDate,"onUpdate:pageDate":t[6]||(t[6]=m=>l.updatePageDate("year",m)),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]=m=>l.updatePageDate("month",m)),selected:l.modelValue,onSelect:l.selectMonth,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,format:l.monthListFormat,onBack:t[8]||(t[8]=m=>l.viewShown="year")},null,8,["pageDate","selected","onSelect","lowerLimit","upperLimit","format"]),[[e.vShow,l.viewShown==="month"]]),e.withDirectives(e.createVNode(d,{pageDate:l.pageDate,"onUpdate:pageDate":t[9]||(t[9]=m=>l.updatePageDate("day",m)),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]=m=>l.viewShown="month")},null,8,["pageDate","selected","weekStartsOn","lowerLimit","upperLimit","headingFormat","disabledDates","weekdayFormat","allow-outside-interval","format","custom-weekdays","onSelect"]),[[e.vShow,l.viewShown==="day"]]),e.withDirectives(e.createVNode(c,{pageDate:l.pageDate,visible:l.viewShown==="time",selected:l.modelValue,disabledTime:l.disabledTime,onSelect:l.selectTime,onBack:l.goBackFromTimepicker},null,8,["pageDate","visible","selected","disabledTime","onSelect","onBack"]),[[e.vShow,l.viewShown==="time"]])],4)}const uu=q(ru,[["render",cu]]),pu=q(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:""}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,{inputClass:o}=de(n.style),r=e.computed(()=>n.mode?n.mode:n.time?"datetime":"date"),s={date:"дд.мм.рррр",datetime:"дд.мм.рррр гг:хх",month:"мм.рррр",week:"рррр-тиждень",time:"гг:хх",year:"рррр"},i=e.computed(()=>n.placeholder||s[r.value]||""),d=e.computed(()=>["py-1.5 px-3 block w-full placeholder:text-[#767f8f] bg-white",o.value,n.customClass,{"!border-red-600":n.error}]),c=e.computed(()=>!n.modelValue&&n.now?new Date:null),m=e.computed({get:()=>v(n.modelValue??c.value,r.value)||void 0,set:_=>a("update:modelValue",y(_,r.value))}),f=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],x=e.computed(()=>{if(n.dayNames?.length)return n.dayNames.length===7?n.dayNames:f}),g=e.computed(()=>{const _=n.weekStart,N=typeof _=="string"?Number(_):_;return N===void 0||Number.isNaN(N)?1:Math.min(6,Math.max(0,N))}),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"}}}),w={date:"dd.MM.yyyy",datetime:"dd.MM.yyyy HH:mm",month:"MM.yyyy",time:"HH:mm",week:"dd.MM.yyyy",year:"yyyy"},k=e.computed(()=>w[r.value]||"dd.MM.yyyy"),b=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"})),h=e.ref(!1);e.watch(()=>n.modelValue,_=>{_?h.value=!0:n.now||(h.value=!1)},{immediate:!0}),e.watchEffect(()=>{n.now&&!n.modelValue&&!h.value&&(a("update:modelValue",y(new Date,r.value)),h.value=!0)});function v(_,N){if(!_)return null;if(_ instanceof Date&&!Number.isNaN(_.getTime()))return _;if(typeof _!="string")return null;switch(N){case"datetime":return R(_);case"time":return T(_);case"month":return z(_);case"year":return P(_);case"week":return Z(_);case"date":default:return M(_)}}function y(_,N){if(!_)return null;const D=_ instanceof Date?_:v(_,N);if(!D)return null;switch(N){case"datetime":return`${C(D)}T${A(D)}`;case"time":return A(D);case"month":return`${D.getFullYear()}-${S(D.getMonth()+1)}`;case"year":return`${D.getFullYear()}`;case"week":{const{year:H,week:ee}=K(D);return`${H}-W${S(ee)}`}case"date":default:return C(D)}}function C(_){return`${_.getFullYear()}-${S(_.getMonth()+1)}-${S(_.getDate())}`}function A(_){return`${S(_.getHours())}:${S(_.getMinutes())}`}function M(_){const N=_.split("-");if(N.length<3)return null;const[D,H,ee]=N.map(Number);return!D||!H||!ee?null:new Date(D,H-1,ee)}function R(_){const N=_.includes("T")?_:_.replace(" ","T"),D=new Date(N);return Number.isNaN(D.getTime())?null:D}function z(_){const[N,D]=_.split("-").map(Number);return!N||Number.isNaN(D)?null:new Date(N,(D||1)-1,1)}function P(_){const N=Number(_);return N?new Date(N,0,1):null}function T(_){const N=_.match(/^(\d{1,2}):(\d{2})$/);if(!N)return null;const[,D,H]=N,ee=new Date;return ee.setHours(Number(D),Number(H),0,0),ee}function Z(_){const N=_.match(/^(\d{4})-W(\d{2})$/);if(!N)return null;const[,D,H]=N,ee=Number(H);return Q(Number(D),ee)}function K(_){const N=new Date(Date.UTC(_.getFullYear(),_.getMonth(),_.getDate())),D=N.getUTCDay()||7;N.setUTCDate(N.getUTCDate()+4-D);const H=new Date(Date.UTC(N.getUTCFullYear(),0,1)),ee=Math.ceil(((N.getTime()-H.getTime())/864e5+1)/7);return{year:N.getUTCFullYear(),week:ee}}function Q(_,N){if(!_||!N)return null;const D=new Date(_,0,1+(N-1)*7),H=D.getDay(),ee=D;return H<=4?ee.setDate(D.getDate()-D.getDay()+1):ee.setDate(D.getDate()+8-D.getDay()),ee}function S(_){return String(_).padStart(2,"0")}return(_,N)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vs-date-picker",n.customClass]),style:e.normalizeStyle(b.value)},[e.createVNode(uu,{modelValue:m.value,"onUpdate:modelValue":N[0]||(N[0]=D=>m.value=D),placeholder:i.value,disabled:n.disabled,clearable:n.clearable,typeable:n.editable,"week-day-names":x.value,"week-starts-on":g.value,"starting-view":V.value.startingView,"minimum-view":V.value.minimumView,"input-format":k.value,name:n.name,class:e.normalizeClass(d.value)},null,8,["modelValue","placeholder","disabled","clearable","typeable","week-day-names","week-starts-on","starting-view","minimum-view","input-format","name","class"])],6))}}),[["__scopeId","data-v-a65a2ac3"]]),mu=["placeholder","disabled","name"],hu=["type","value","onInput","placeholder","disabled"],fu=["onClick"],gu=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:""}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.ref(t.count),a=e.computed(()=>t.limit),{inputClass:o}=de(t.style),r=e.useModel(l,"modelValue"),s=e.computed(()=>!!t.disabled),i=e.computed(()=>t.placeholder??"");e.watchEffect(()=>{const w=r.value?.length??0;w<n.value&&(r.value=[...r.value??[],...Array(n.value-w)])});const d=e.ref({}),c=e.ref({});function m(w,k){w&&(d.value[k]=w)}async function f(w,k){if(!w||t.inputType!=="mask")return;const{default:b}=await Promise.resolve().then(()=>zt);c.value[k]&&c.value[k].destroy(),c.value[k]=b(w,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),c.value[k].on("accept",()=>{const h=[...r.value||[]];h[k]=t.unmask?c.value[k].unmaskedValue:c.value[k].value,r.value=h}),c.value[k].on("complete",()=>{const h=[...r.value||[]];h[k]=t.unmask?c.value[k].unmaskedValue:c.value[k].value,r.value=h}),r.value?.[k]&&(c.value[k].value=r.value[k])}function x(w,k){if(s.value)return;const b=w.target.value??null,h=[...r.value];h[k]=t.inputType==="text"?b:Number(b),r.value=h}function g(){n.value+=1;const w=t.inputType==="text"||t.inputType==="mask"?null:0;r.value=[...r.value,w],t.inputType==="mask"&&setTimeout(()=>{const k=n.value-1;d.value[k]&&f(d.value[k],k)},0)}function V(w){if(n.value>1){c.value[w]&&(c.value[w].destroy(),delete c.value[w]),n.value-=1,r.value=r.value.filter((b,h)=>h!==w);const k={};Object.keys(c.value).forEach(b=>{const h=parseInt(b,10);h>w?k[h-1]=c.value[h]:h<w&&(k[h]=c.value[h])}),c.value=k}}return e.onMounted(()=>{if(t.inputType==="mask")for(let w=0;w<n.value;w+=1)d.value[w]&&f(d.value[w],w)}),e.onBeforeUnmount(()=>{Object.values(c.value).forEach(w=>{w&&w.destroy()})}),e.watch(()=>t.mask,w=>{t.inputType==="mask"&&Object.values(c.value).forEach(k=>{k&&k.updateOptions({mask:w,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})})}),e.watch(r,w=>{t.inputType==="mask"&&w&&w.forEach((k,b)=>{c.value[b]&&c.value[b].value!==k&&(c.value[b].value=k||"")})},{deep:!0}),(w,k)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["grid gap-2",`grid-cols-${a.value}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,b=>(e.openBlock(),e.createElementBlock("div",{key:b,class:"flex items-center gap-2 w-full"},[w.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:h=>m(h,b-1),placeholder:w.placeholder,disabled:w.disabled,name:`${w.name}[${b-1}]`,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":w.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,mu)):(e.openBlock(),e.createElementBlock("input",{key:1,type:w.inputType,value:r.value?.[b-1],onInput:h=>x(h,b-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":w.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,hu)),!w.disabled&&b===n.value&&w.isAdded?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:e.withModifiers(g,["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(we,{height:"18",width:"18"})])):e.createCommentVNode("",!0),!w.disabled&&n.value>1&&w.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(h=>V(b-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(xt,{height:"18",width:"18"})],8,fu)):e.createCommentVNode("",!0)]))),128))],2))}}),Dn=(l={mode:"edit",schema:null})=>new Promise(t=>{const{close:n}=te.modal({title:l.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:_n,contentProps:{...l,onClose:()=>{t(null),n()},onSave:a=>{t(a),n()}}})});xe.install=function(t){t.component("VForm",xe),Object.assign(t.config.globalProperties,{$form:Dn}),t.provide("form",Dn),window.v3plugin||(window.v3plugin={})};function Ve(l){return typeof l=="string"||l instanceof String}function Fn(l){var t;return typeof l=="object"&&l!=null&&(l==null||(t=l.constructor)==null?void 0:t.name)==="Object"}function An(l,t){return Array.isArray(t)?An(l,(n,a)=>t.includes(a)):Object.entries(l).reduce((n,a)=>{let[o,r]=a;return t(r,o)&&(n[o]=r),n},{})}const j={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function Ln(l){switch(l){case j.LEFT:return j.FORCE_LEFT;case j.RIGHT:return j.FORCE_RIGHT;default:return l}}function Tt(l){return l.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function st(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(!st(t[o],l[o]))return!1;return!0}if(n!=a)return!1;if(t&&l&&typeof t=="object"&&typeof l=="object"){const r=t instanceof Date,s=l instanceof Date;if(r&&s)return t.getTime()==l.getTime();if(r!=s)return!1;const i=t instanceof RegExp,d=l instanceof RegExp;if(i&&d)return t.toString()==l.toString();if(i!=d)return!1;const c=Object.keys(t);for(o=0;o<c.length;o++)if(!Object.prototype.hasOwnProperty.call(l,c[o]))return!1;for(o=0;o<c.length;o++)if(!st(l[c[o]],t[c[o]]))return!1;return!0}else if(t&&l&&typeof t=="function"&&typeof l=="function")return t.toString()===l.toString();return!1}class yu{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?j.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?j.RIGHT:j.LEFT}}function Y(l,t){return new Y.InputMask(l,t)}function Tn(l){if(l==null)throw new Error("mask property should be defined");return l instanceof RegExp?Y.MaskedRegExp:Ve(l)?Y.MaskedPattern:l===Date?Y.MaskedDate:l===Number?Y.MaskedNumber:Array.isArray(l)||l===Array?Y.MaskedDynamic:Y.Masked&&l.prototype instanceof Y.Masked?l:Y.Masked&&l instanceof Y.Masked?l.constructor:l instanceof Function?Y.MaskedFunction:(console.warn("Mask not found for mask",l),Y.Masked)}function Le(l){if(!l)throw new Error("Options in not defined");if(Y.Masked){if(l.prototype instanceof Y.Masked)return{mask:l};const{mask:t=void 0,...n}=l instanceof Y.Masked?{mask:l}:Fn(l)&&l.mask instanceof Y.Masked?l:{};if(t){const a=t.mask;return{...An(t,(o,r)=>!r.startsWith("_")),mask:t.constructor,_mask:a,...n}}}return Fn(l)?{...l}:{mask:l}}function ge(l){if(Y.Masked&&l instanceof Y.Masked)return l;const t=Le(l),n=Tn(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)}Y.createMask=ge;class it{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}}Y.MaskElement=it;const In=90,ku=89;class He extends it{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===In&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===ku&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===In&&(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={}}}Y.HTMLMaskElement=He;class On extends He{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}}Y.HTMLMaskElement=He;class It extends He{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}}Y.HTMLContenteditableMaskElement=It;class dt{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>dt.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}}dt.MAX_LENGTH=100;class Rn{constructor(t,n){this.el=t instanceof it?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new It(t):new On(t),this.masked=ge(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new dt,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 Y.Masked)&&this.masked.constructor===Tn(t)){this.masked.updateOptions({mask:t});return}const n=t instanceof Y.Masked?t:ge({mask:t});n.unmaskedValue=this.masked.unmaskedValue,this.masked=n}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,n){const a=this._listeners[t];a&&a.forEach(o=>o(n))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){!this.el||!this.el.isActive||(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const n=this.masked.unmaskedValue,a=this.masked.value,o=this.masked.rawInputValue,r=this.displayValue,s=this.unmaskedValue!==n||this.value!==a||this._rawInputValue!==o;this._unmaskedValue=n,this._value=a,this._rawInputValue=o,this.el.value!==r&&(this.el.value=r),t==="auto"?this.alignCursor():t!=null&&(this.cursorPos=t),s&&this._fireChangeEvents(),!this._historyChanging&&(s||this.history.isEmpty)&&this.history.push({unmaskedValue:n,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:n,...a}=t,o=!this.maskEquals(n),r=this.masked.optionsIsChanged(a);o&&(this.mask=n),r&&this.masked.updateOptions(a),(o||r)&&this.updateControl()}updateCursor(t){t!=null&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,j.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,n){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(n),this}off(t,n){if(!this._listeners[t])return this;if(!n)return delete this._listeners[t],this;const a=this._listeners[t].indexOf(n);return a>=0&&this._listeners[t].splice(a,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const n=new yu({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),a=this.masked.rawInputValue,o=this.masked.splice(n.startChangePos,n.removed.length,n.inserted,n.removeDirection,{input:!0,raw:!0}).offset,r=a===this.masked.rawInputValue?n.removeDirection:j.NONE;let s=this.masked.nearestInputPos(n.startChangePos+o,r);r!==j.NONE&&(s=this.masked.nearestInputPos(s,j.NONE)),this.updateControl(s),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}Y.InputMask=Rn;class W{static normalize(t){return Array.isArray(t)?t:[t,new W]}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}}Y.ChangeDetails=W;class ye{constructor(t,n,a){t===void 0&&(t=""),n===void 0&&(n=0),this.value=t,this.from=n,this.stop=a}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||t!=null&&this.from>=t)return"";const n=this.value[0];return this.value=this.value.slice(1),n}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class oe{constructor(t){this._value="",this._update({...oe.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,n){n===void 0&&(n={input:!0}),this.reset(),this.append(t,n,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,n){return t}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),Math.min(this.displayValue.length,n-t)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this.displayValue.slice(t,n)}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new ye(this.extractInput(t,n),t)}appendTail(t){return Ve(t)&&(t=new ye(String(t))),t.appendTo(this)}_appendCharRaw(t,n){return t?(this._value+=t,new W({inserted:t,rawInserted:t})):new W}_appendChar(t,n,a){n===void 0&&(n={});const o=this.state;let r;if([t,r]=this.doPrepareChar(t,n),t&&(r=r.aggregate(this._appendCharRaw(t,n)),!r.rawInserted&&this.autofix==="pad")){const s=this.state;this.state=o;let i=this.pad(n);const d=this._appendCharRaw(t,n);i=i.aggregate(d),d.rawInserted||i.equals(r)?r=i:this.state=s}if(r.inserted){let s,i=this.doValidate(n)!==!1;if(i&&a!=null){const d=this.state;if(this.overwrite===!0){s=a.state;for(let m=0;m<r.rawInserted.length;++m)a.unshift(this.displayValue.length-r.tailShift)}let c=this.appendTail(a);if(i=c.rawInserted.length===a.toString().length,!(i&&c.inserted)&&this.overwrite==="shift"){this.state=d,s=a.state;for(let m=0;m<r.rawInserted.length;++m)a.shift();c=this.appendTail(a),i=c.rawInserted.length===a.toString().length}i&&c.inserted&&(this.state=d)}i||(r=new W,this.state=o,a&&s&&(a.state=s))}return r}_appendPlaceholder(){return new W}_appendEager(){return new W}append(t,n,a){if(!Ve(t))throw new Error("value should be string");const o=Ve(a)?new ye(String(a)):a;n!=null&&n.tail&&(n._beforeTailState=this.state);let r;[t,r]=this.doPrepare(t,n);for(let s=0;s<t.length;++s){const i=this._appendChar(t[s],n,o);if(!i.rawInserted&&!this.doSkipInvalid(t[s],n,o))break;r.aggregate(i)}return(this.eager===!0||this.eager==="append")&&n!=null&&n.input&&t&&r.aggregate(this._appendEager()),o!=null&&(r.tailShift+=this.appendTail(o).tailShift),r}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(n),new W}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={}),W.normalize(this.prepare?this.prepare(t,this,n):t)}doPrepareChar(t,n){return n===void 0&&(n={}),W.normalize(this.prepareChar?this.prepareChar(t,this,n):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,n,a,o,r){a===void 0&&(a=""),o===void 0&&(o=j.NONE),r===void 0&&(r={input:!0});const s=t+n,i=this.extractTail(s),d=this.eager===!0||this.eager==="remove";let c;d&&(o=Ln(o),c=this.extractInput(0,s,{raw:!0}));let m=t;const f=new W;if(o!==j.NONE&&(m=this.nearestInputPos(t,n>1&&t!==0&&!d?j.NONE:o),f.tailShift=m-t),f.aggregate(this.remove(m)),d&&o!==j.NONE&&c===this.rawInputValue)if(o===j.FORCE_LEFT){let x;for(;c===this.rawInputValue&&(x=this.displayValue.length);)f.aggregate(new W({tailShift:-1})).aggregate(this.remove(x-1))}else o===j.FORCE_RIGHT&&i.unshift();return f.aggregate(this.append(a,r,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!st(this,t)}typedValueEquals(t){const n=this.typedValue;return t===n||oe.EMPTY_VALUES.includes(t)&&oe.EMPTY_VALUES.includes(n)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new W}}oe.DEFAULTS={skipInvalid:!0},oe.EMPTY_VALUES=[void 0,null,""],Y.Masked=oe;class ve{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=Ve(t)?new ye(String(t)):t;const n=this.chunks[this.chunks.length-1],a=n&&(n.stop===t.stop||t.stop==null)&&t.from===n.from+n.toString().length;if(t instanceof ye)a?n.extend(t.toString()):this.chunks.push(t);else if(t instanceof ve){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 Y.MaskedPattern))return new ye(this.toString()).appendTo(t);const n=new W;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 ve||t._stops.indexOf(s)>=0)&&n.aggregate(t._appendPlaceholder(s)),i=o instanceof ve&&t._blocks[s]),i){const d=i.appendTail(o);n.aggregate(d);const c=o.toString().slice(d.rawInserted.length);c&&n.aggregate(t.append(c,{tail:!0}))}else n.aggregate(t.append(o.toString(),{tail:!0}))}return n}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:n,...a}=t;Object.assign(this,a),this.chunks=n.map(o=>{const r="chunks"in o?new ve:new ye;return r.state=o,r})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const n=t!=null?t-this.from:t;let a=0;for(;a<this.chunks.length;){const o=this.chunks[a],r=o.unshift(n);if(o.toString()){if(!r)break;++a}else this.chunks.splice(a,1);if(r)return r}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const n=this.chunks[t],a=n.shift();if(n.toString()){if(!a)break;--t}else this.chunks.splice(t,1);if(a)return a}return""}}class bu{constructor(t,n){this.masked=t,this._log=[];const{offset:a,index:o}=t._mapPosToBlock(n)||(n<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=a,this.index=o,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((n=this.block)==null?void 0:n.displayValue.length)||0){var n;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,j.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,j.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,j.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,j.FORCE_RIGHT),this.offset!==this.block.value.length))return!0})}pushRightBeforeInput(){return this._pushRight(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,j.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,j.NONE),!0})}}class Ot{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 W}nearestInputPos(t,n){n===void 0&&(n=j.NONE);const a=0,o=this._value.length;switch(n){case j.LEFT:case j.FORCE_LEFT:return a;case j.NONE:case j.RIGHT:case j.FORCE_RIGHT:default:return o}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._isRawInput?n-t:0}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),a===void 0&&(a={}),a.raw&&this._isRawInput&&this._value.slice(t,n)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new W;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 W({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 W;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new ye("")}appendTail(t){return Ve(t)&&(t=new ye(String(t))),t.appendTo(this)}append(t,n,a){const o=this._appendChar(t[0],n);return a!=null&&(o.tailShift+=this.appendTail(a).tailShift),o}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=!!t._rawInputValue}pad(t){return this._appendPlaceholder()}}class qe{constructor(t){const{parent:n,isOptional:a,placeholderChar:o,displayChar:r,lazy:s,eager:i,...d}=t;this.masked=ge(d),Object.assign(this,{parent:n,isOptional:a,placeholderChar:o,displayChar:r,lazy:s,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),t===0&&n>=1?(this.isFilled=!1,this.masked.remove(t,n)):new W}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 W;const a=this.masked.state;let o=this.masked._appendChar(t,this.currentMaskFlags(n));return o.inserted&&this.doValidate(n)===!1&&(o=new W,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 W:(this.isFilled=!0,new W({inserted:this.placeholderChar}))}_appendEager(){return new W}extractTail(t,n){return this.masked.extractTail(t,n)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.masked.extractInput(t,n,a)}nearestInputPos(t,n){n===void 0&&(n=j.NONE);const a=0,o=this.value.length,r=Math.min(Math.max(t,a),o);switch(n){case j.LEFT:case j.FORCE_LEFT:return this.isComplete?r:a;case j.RIGHT:case j.FORCE_RIGHT:return this.isComplete?r:o;case j.NONE:default:return r}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.value.slice(t,n).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var n;return{...t,_beforeTailState:(t==null||(n=t._beforeTailState)==null?void 0:n.masked)||t?._beforeTailState}}pad(t){return new W}}qe.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 zn extends oe{updateOptions(t){super.updateOptions(t)}_update(t){const n=t.mask;n&&(t.validate=a=>a.search(n)>=0),super._update(t)}}Y.MaskedRegExp=zn;class re extends oe{constructor(t){super({...re.DEFAULTS,...t,definitions:Object.assign({},qe.DEFAULT_DEFINITIONS,t?.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const n=this.mask;if(!n||!t)return;let a=!1,o=!1;for(let r=0;r<n.length;++r){if(this.blocks){const c=n.slice(r),m=Object.keys(this.blocks).filter(x=>c.indexOf(x)===0);m.sort((x,g)=>g.length-x.length);const f=m[0];if(f){const{expose:x,repeat:g,...V}=Le(this.blocks[f]),w={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...V,repeat:g,parent:this},k=g!=null?new Y.RepeatBlock(w):ge(w);k&&(this._blocks.push(k),x&&(this.exposeBlock=k),this._maskedBlocks[f]||(this._maskedBlocks[f]=[]),this._maskedBlocks[f].push(this._blocks.length-1)),r+=f.length-1;continue}}let s=n[r],i=s in t;if(s===re.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){a=!a;continue}if(s==="["||s==="]"){o=!o;continue}if(s===re.ESCAPE_CHAR){if(++r,s=n[r],!s)break;i=!1}const d=i?new qe({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...Le(t[s]),parent:this}):new Ot({char:s,eager:this.eager,isUnmasking:a});this._blocks.push(d)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:n,...a}=t;this._blocks.forEach((o,r)=>o.state=n[r]),super.state=a}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,n)=>t+=n.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(n),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,n)=>t+=n.value,"")}set value(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(n),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(n),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,n)=>t+=n.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const n=new W;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 W;if(!a)return o;for(let s=a.index,i;i=this._blocks[s];++s){var r;const d=i._appendChar(t,{...n,_beforeTailState:(r=n._beforeTailState)==null||(r=r._blocks)==null?void 0:r[s]});if(o.aggregate(d),d.consumed)break}return o}extractTail(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=new ve;return t===n||this._forEachBlocksInRange(t,n,(o,r,s,i)=>{const d=o.extractTail(s,i);d.stop=this._findStopBefore(r),d.from=this._blockStartPos(r),d instanceof ve&&(d.blockIndex=r),a.extend(d)}),a}extractInput(t,n,a){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),a===void 0&&(a={}),t===n)return"";let o="";return this._forEachBlocksInRange(t,n,(r,s,i,d)=>{o+=r.extractInput(i,d,a)}),o}_findStopBefore(t){let n;for(let a=0;a<this._stops.length;++a){const o=this._stops[a];if(o<=t)n=o;else break}return n}_appendPlaceholder(t){const n=new W;if(this.lazy&&t==null)return n;const a=this._mapPosToBlock(this.displayValue.length);if(!a)return n;const o=a.index,r=t??this._blocks.length;return this._blocks.slice(o,r).forEach(s=>{if(!s.lazy||t!=null){var i;n.aggregate(s._appendPlaceholder((i=s._blocks)==null?void 0:i.length))}}),n}_mapPosToBlock(t){let n="";for(let a=0;a<this._blocks.length;++a){const o=this._blocks[a],r=n.length;if(n+=o.displayValue,t<=n.length)return{index:a,offset:t-r}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((n,a)=>n+=a.displayValue.length,0)}_forEachBlocksInRange(t,n,a){n===void 0&&(n=this.displayValue.length);const o=this._mapPosToBlock(t);if(o){const r=this._mapPosToBlock(n),s=r&&o.index===r.index,i=o.offset,d=r&&s?r.offset:this._blocks[o.index].displayValue.length;if(a(this._blocks[o.index],o.index,i,d),r&&!s){for(let c=o.index+1;c<r.index;++c)a(this._blocks[c],c,0,this._blocks[c].displayValue.length);a(this._blocks[r.index],r.index,0,r.offset)}}}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=super.remove(t,n);return this._forEachBlocksInRange(t,n,(o,r,s,i)=>{a.aggregate(o.remove(s,i))}),a}nearestInputPos(t,n){if(n===void 0&&(n=j.NONE),!this._blocks.length)return 0;const a=new bu(this,t);if(n===j.NONE)return a.pushRightBeforeInput()||(a.popState(),a.pushLeftBeforeInput())?a.pos:this.displayValue.length;if(n===j.LEFT||n===j.FORCE_LEFT){if(n===j.LEFT){if(a.pushRightBeforeFilled(),a.ok&&a.pos===t)return t;a.popState()}if(a.pushLeftBeforeInput(),a.pushLeftBeforeRequired(),a.pushLeftBeforeFilled(),n===j.LEFT){if(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.ok&&a.pos<=t||(a.popState(),a.ok&&a.pos<=t))return a.pos;a.popState()}return a.ok?a.pos:n===j.FORCE_LEFT?0:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:0)}return n===j.RIGHT||n===j.FORCE_RIGHT?(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.pushRightBeforeFilled()?a.pos:n===j.FORCE_RIGHT?this.displayValue.length:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:this.nearestInputPos(t,j.LEFT))):t}totalInputPositions(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);let a=0;return this._forEachBlocksInRange(t,n,(o,r,s,i)=>{a+=o.totalInputPositions(s,i)}),a}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const n=this._maskedBlocks[t];return n?n.map(a=>this._blocks[a]):[]}pad(t){const n=new W;return this._forEachBlocksInRange(0,this.displayValue.length,a=>n.aggregate(a.pad(t))),n}}re.DEFAULTS={...oe.DEFAULTS,lazy:!0,placeholderChar:"_"},re.STOP_CHAR="`",re.ESCAPE_CHAR="\\",re.InputDefinition=qe,re.FixedDefinition=Ot,Y.MaskedPattern=re;class Ge extends re{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:n=this.to||0,from:a=this.from||0,maxLength:o=this.maxLength||0,autofix:r=this.autofix,...s}=t;this.to=n,this.from=a,this.maxLength=Math.max(String(n).length,o),this.autofix=r;const i=String(this.from).padStart(this.maxLength,"0"),d=String(this.to).padStart(this.maxLength,"0");let c=0;for(;c<d.length&&d[c]===i[c];)++c;s.mask=d.slice(0,c).replace(/0/g,"\\0")+"0".repeat(this.maxLength-c),super._update(s)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let n="",a="";const[,o,r]=t.match(/^(\D*)(\d*)(\D*)/)||[];return r&&(n="0".repeat(o.length)+r,a="9".repeat(o.length)+r),n=n.padEnd(this.maxLength,"0"),a=a.padEnd(this.maxLength,"9"),[n,a]}doPrepareChar(t,n){n===void 0&&(n={});let a;return[t,a]=super.doPrepareChar(t.replace(/\D/g,""),n),t||(a.skip=!this.isComplete),[t,a]}_appendCharRaw(t,n){if(n===void 0&&(n={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,n);const a=String(this.from).padStart(this.maxLength,"0"),o=String(this.to).padStart(this.maxLength,"0"),[r,s]=this.boundaries(this.value+t);return Number(s)<this.from?super._appendCharRaw(a[this.value.length],n):Number(r)>this.to?!n.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(a[this.value.length],n).aggregate(this._appendCharRaw(t,n)):super._appendCharRaw(o[this.value.length],n):super._appendCharRaw(t,n)}doValidate(t){const n=this.value;if(n.search(/[^0]/)===-1&&n.length<=this._matchFrom)return!0;const[o,r]=this.boundaries(n);return this.from<=Number(r)&&Number(o)<=this.to&&super.doValidate(t)}pad(t){const n=new W;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}}Y.MaskedRange=Ge;const wu="d{.}`m{.}`Y";class ke extends re{static extractPatternOptions(t){const{mask:n,pattern:a,...o}=t;return{...o,mask:Ve(n)?n:a}}constructor(t){super(ke.extractPatternOptions({...ke.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:n,pattern:a,blocks:o,...r}={...ke.DEFAULTS,...t},s=Object.assign({},ke.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:Ve(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(ke.extractPatternOptions(t))}}ke.GET_DEFAULT_BLOCKS=()=>({d:{mask:Ge,from:1,to:31,maxLength:2},m:{mask:Ge,from:1,to:12,maxLength:2},Y:{mask:Ge,from:1900,to:9999}}),ke.DEFAULTS={...re.DEFAULTS,mask:Date,pattern:wu,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)}},Y.MaskedDate=ke;class Ke extends oe{constructor(t){super({...Ke.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}=Le(n),r=ge({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...o});return a&&(this.exposeMask=r),r}):[])}_appendCharRaw(t,n){n===void 0&&(n={});const a=this._applyDispatch(t,n);return this.currentMask&&a.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(n))),a}_applyDispatch(t,n,a){t===void 0&&(t=""),n===void 0&&(n={}),a===void 0&&(a="");const o=n.tail&&n._beforeTailState!=null?n._beforeTailState._value:this.value,r=this.rawInputValue,s=n.tail&&n._beforeTailState!=null?n._beforeTailState._rawInputValue:r,i=r.slice(s.length),d=this.currentMask,c=new W,m=d?.state;return this.currentMask=this.doDispatch(t,{...n},a),this.currentMask&&(this.currentMask!==d?(this.currentMask.reset(),s&&(this.currentMask.append(s,{raw:!0}),c.tailShift=this.currentMask.value.length-o.length),i&&(c.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):m&&(this.currentMask.state=m)),c}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const n=new W;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 W;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 st(n,r)&&n.maskEquals(o)}):super.maskEquals(t)}typedValueEquals(t){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(t))}}Ke.DEFAULTS={...oe.DEFAULTS,dispatch:(l,t,n,a)=>{if(!t.compiledMasks.length)return;const o=t.rawInputValue,r=t.compiledMasks.map((s,i)=>{const d=t.currentMask===s,c=d?s.displayValue.length:s.nearestInputPos(s.displayValue.length,j.FORCE_LEFT);return s.rawInputValue!==o?(s.reset(),s.append(o,{raw:!0})):d||s.remove(c),s.append(l,t.currentMaskFlags(n)),s.appendTail(a),{index:i,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(c,s.nearestInputPos(s.displayValue.length,j.FORCE_LEFT)))}});return r.sort((s,i)=>i.weight-s.weight||i.totalInputPositions-s.totalInputPositions),t.compiledMasks[r[0].index]}},Y.MaskedDynamic=Ke;class Ye extends re{constructor(t){super({...Ye.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:n,...a}=t;if(n){const o=n.map(i=>i.length),r=Math.min(...o),s=Math.max(...o)-r;a.mask="*".repeat(r),s&&(a.mask+="["+"*".repeat(s)+"]"),this.enum=n}super._update(a)}_appendCharRaw(t,n){n===void 0&&(n={});const a=Math.min(this.nearestInputPos(0,j.FORCE_RIGHT),this.value.length),o=this.enum.filter(r=>this.matchValue(r,this.unmaskedValue+t,a));if(o.length){o.length===1&&this._forEachBlocksInRange(0,this.value.length,(s,i)=>{const d=o[0][i];i>=this.value.length||d===s.value||(s.reset(),s._appendChar(d,n))});const r=super._appendCharRaw(o[0][this.value.length],n);return o.length===1&&o[0].slice(this.unmaskedValue.length).split("").forEach(s=>r.aggregate(super._appendCharRaw(s))),r}return new W({skip:!this.isComplete})}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new ye("",t)}remove(t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),t===n)return new W;const a=Math.min(super.nearestInputPos(0,j.FORCE_RIGHT),this.value.length);let o;for(o=t;o>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(a,o),a)).length>1);--o);const r=super.remove(o,n);return r.tailShift+=o-t,r}get isComplete(){return this.enum.indexOf(this.value)>=0}}Ye.DEFAULTS={...re.DEFAULTS,matchValue:(l,t,n)=>l.indexOf(t,n)===n},Y.MaskedEnum=Ye;class jn extends oe{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}Y.MaskedFunction=jn;var Un;class ce extends oe{constructor(t){super({...ce.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",a=(this.scale?"("+Tt(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+n+a),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Tt).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Tt(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const n=t.split(this.radix);return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),n.join(this.radix)}doPrepareChar(t,n){n===void 0&&(n={});const[a,o]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(n.input&&n.raw||!n.input&&!n.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),n);return t&&!a&&(o.skip=!0),a&&!this.allowPositive&&!this.value&&a!=="-"&&o.aggregate(this._appendChar("-")),[a,o]}_separatorsCount(t,n){n===void 0&&(n=!1);let a=0;for(let o=0;o<t;++o)this._value.indexOf(this.thousandsSeparator,o)===o&&(++a,n&&(t+=this.thousandsSeparator.length));return a}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n),this._removeThousandsSeparators(super.extractInput(t,n,a))}_appendCharRaw(t,n){n===void 0&&(n={});const a=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,o=this._separatorsCountFromSlice(a);this._value=this._removeThousandsSeparators(this.value);const r=this._value;this._value+=t;const s=this.number;let i=!isNaN(s),d=!1;if(i){let x;this.min!=null&&this.min<0&&this.number<this.min&&(x=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(x=this.max),x!=null&&(this.autofix?(this._value=this.format(x,this).replace(ce.UNMASKED_RADIX,this.radix),d||(d=r===this._value&&!n.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let c;i?c=new W({inserted:this._value.slice(r.length),rawInserted:d?"":t,skip:d}):(this._value=r,c=new W),this._value=this._insertThousandsSeparators(this._value);const m=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,f=this._separatorsCountFromSlice(m);return c.tailShift+=(f-o)*this.thousandsSeparator.length,c}_findSeparatorAround(t){if(this.thousandsSeparator){const n=t-this.thousandsSeparator.length+1,a=this.value.indexOf(this.thousandsSeparator,n);if(a<=t)return a}return-1}_adjustRangeWithSeparators(t,n){const a=this._findSeparatorAround(t);a>=0&&(t=a);const o=this._findSeparatorAround(n);return o>=0&&(n=o+this.thousandsSeparator.length),[t,n]}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n);const a=this.value.slice(0,t),o=this.value.slice(n),r=this._separatorsCount(a.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(a+o));const s=this._separatorsCountFromSlice(a);return new W({tailShift:(s-r)*this.thousandsSeparator.length})}nearestInputPos(t,n){if(!this.thousandsSeparator)return t;switch(n){case j.NONE:case j.LEFT:case j.FORCE_LEFT:{const a=this._findSeparatorAround(t-1);if(a>=0){const o=a+this.thousandsSeparator.length;if(t<o||this.value.length<=o||n===j.FORCE_LEFT)return a}break}case j.RIGHT:case j.FORCE_RIGHT:{const a=this._findSeparatorAround(t);if(a>=0)return a+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let n=t;this.min!=null&&(n=Math.max(n,this.min)),this.max!=null&&(n=Math.min(n,this.max)),n!==t&&(this.unmaskedValue=this.format(n,this));let a=this.value;this.normalizeZeros&&(a=this._normalizeZeros(a)),this.padFractionalZeros&&this.scale>0&&(a=this._padFractionalZeros(a)),this._value=a}super.doCommit()}_normalizeZeros(t){const n=this._removeThousandsSeparators(t).split(this.radix);return n[0]=n[0].replace(/^(\D*)(0*)(\d*)/,(a,o,r,s)=>o+s),t.length&&!/\d$/.test(n[0])&&(n[0]=n[0]+"0"),n.length>1&&(n[1]=n[1].replace(/0*$/,""),n[1].length||(n.length=1)),this._insertThousandsSeparators(n.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const n=t.split(this.radix);return n.length<2&&n.push(""),n[1]=n[1].padEnd(this.scale,"0"),n.join(this.radix)}doSkipInvalid(t,n,a){n===void 0&&(n={});const o=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===ce.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,ce.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(ce.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)||ce.EMPTY_VALUES.includes(t)&&ce.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}Un=ce,ce.UNMASKED_RADIX=".",ce.EMPTY_VALUES=[...oe.EMPTY_VALUES,0],ce.DEFAULTS={...oe.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Un.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})},Y.MaskedNumber=ce;const ct={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Rt(l,t,n){t===void 0&&(t=ct.MASKED),n===void 0&&(n=ct.MASKED);const a=ge(l);return o=>a.runIsolated(r=>(r[t]=o,r[n]))}function Pn(l,t,n,a){return Rt(t,n,a)(l)}Y.PIPE_TYPE=ct,Y.createPipe=Rt,Y.pipe=Pn;class Hn extends re{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}=Le(t);this._blockOpts=Object.assign({},this._blockOpts,s);const i=ge(this._blockOpts);this.repeat=(n=(a=r??i.repeat)!=null?a:this.repeat)!=null?n:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((o=this._blocks)==null?void 0:o.length)||0,this.repeatFrom)),blocks:{m:i},eager:i.eager,overwrite:i.overwrite,skipInvalid:i.skipInvalid,lazy:i.lazy,placeholderChar:i.placeholderChar,displayChar:i.displayChar})}_allocateBlock(t){if(t<this._blocks.length)return this._blocks[t];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(ge(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,n){n===void 0&&(n={});const a=new W;for(let d=(o=(r=this._mapPosToBlock(this.displayValue.length))==null?void 0:r.index)!=null?o:Math.max(this._blocks.length-1,0),c,m;c=(s=this._blocks[d])!=null?s:m=!m&&this._allocateBlock(d);++d){var o,r,s,i;const f=c._appendChar(t,{...n,_beforeTailState:(i=n._beforeTailState)==null||(i=i._blocks)==null?void 0:i[d]});if(f.skip&&m){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(a.aggregate(f),f.consumed)break}return a}_trimEmptyTail(t,n){var a,o;t===void 0&&(t=0);const r=Math.max(((a=this._mapPosToBlock(t))==null?void 0:a.index)||0,this.repeatFrom,0);let s;n!=null&&(s=(o=this._mapPosToBlock(n))==null?void 0:o.index),s==null&&(s=this._blocks.length-1);let i=0;for(let d=s;r<=d&&!this._blocks[d].unmaskedValue;--d,++i);i&&(this._blocks.splice(s-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=super.remove(t,n);return this._trimEmptyTail(t,n),a}totalInputPositions(t,n){return t===void 0&&(t=0),n==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,n)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}Y.RepeatBlock=Hn;try{globalThis.IMask=Y}catch{}const zt=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:W,ChunksTailDetails:ve,DIRECTION:j,HTMLContenteditableMaskElement:It,HTMLInputMaskElement:On,HTMLMaskElement:He,InputMask:Rn,MaskElement:it,Masked:oe,MaskedDate:ke,MaskedDynamic:Ke,MaskedEnum:Ye,MaskedFunction:jn,MaskedNumber:ce,MaskedPattern:re,MaskedRange:Ge,MaskedRegExp:zn,PIPE_TYPE:ct,PatternFixedDefinition:Ot,PatternInputDefinition:qe,RepeatBlock:Hn,createMask:ge,createPipe:Rt,default:Y,forceDirection:Ln,normalizeOpts:Le,pipe:Pn},Symbol.toStringTag,{value:"Module"}));J.ModalEdit=_n,J.VForm=xe,J.VsInputAddress=yn,J.VsInputArray=gu,J.VsInputCheckbox=Zt,J.VsInputCodegen=mn,J.VsInputColor=fn,J.VsInputContainer=on,J.VsInputDate=pu,J.VsInputEmail=vt,J.VsInputFile=nn,J.VsInputFileList=ln,J.VsInputKeyValue=hn,J.VsInputMask=Vt,J.VsInputNumber=Wt,J.VsInputRadio=Ct,J.VsInputRange=gn,J.VsInputSelect=Nt,J.VsInputSlug=pn,J.VsInputStatic=Et,J.VsInputSwitcher=_t,J.VsInputTag=un,J.VsInputTel=Bt,J.VsInputText=De,J.VsInputTextArray=St,J.VsInputTextarea=rn,J.default=xe,J.inputs=bn,J.vsInputDatatable=dn,J.vsInputMap=cn,Object.defineProperties(J,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(X,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@opengis/core")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core"],e):(X=typeof globalThis<"u"?globalThis:X||self,e(X.FormBuilder={},X.Vue,X.OpenGISCore))})(this,function(X,e,ne){"use strict";const Kn={class:"w-full relative"},Yn={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},Wn={class:"opacity-100"},Zn={key:0,class:"text-red-500 text-[14px]"},Jn={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Xn=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=e.ref("uk"),n=a=>{a.detail.key==="locale"&&(t.value=a.detail.newValue)};return e.onMounted(()=>{t.value=localStorage.locale,window.addEventListener("storage",n)}),e.onUnmounted(()=>{window.removeEventListener("resize",n)}),(a,o)=>(e.openBlock(),e.createElementBlock("div",Kn,[a.ua||a.label?(e.openBlock(),e.createElementBlock("div",Yn,[e.createElementVNode("span",Wn,e.toDisplayString(a.item[t.value]||a.ua||a.label),1),a.item?.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",Zn,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(a.$slots,"default",e.mergeProps(a.$attrs,{class:{"opacity-60":a.item.disabled}})),a.error?(e.openBlock(),e.createElementBlock("span",Jn,e.toDisplayString(a.error),1)):e.createCommentVNode("",!0)]))}}),Qn={class:"w-full relative flex flex-row items-center gap-2"},el={key:0,class:"text-red-500 text-[14px]"},tl={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.columns??{container:12,label:3}),a=e.computed(()=>{const{container:i,label:d}=n.value;return!i||i<=0?0:Math.min(Math.max(d??0,0),i)/i}),o=e.computed(()=>t.item?.type==="html"||a.value<=0?!1:!!(t.ua||t.label)),r=e.computed(()=>{if(!o.value)return{};const i=`${a.value*100}%`;return{flexBasis:i,maxWidth:i}}),s=e.computed(()=>{const{container:i,label:d}=n.value;if(!i||i<=0)return{};if(t.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!o.value)return{flexBasis:"100%",maxWidth:"100%"};const c=Math.max(i-Math.max(d??0,0),0)/i;if(!c)return{};const m=`${c*100}%`;return{flexBasis:m,maxWidth:m}});return(i,d)=>(e.openBlock(),e.createElementBlock("div",Qn,[o.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0",style:e.normalizeStyle(r.value)},[e.createTextVNode(e.toDisplayString(i.ua||i.label)+" ",1),i.item?.rules?.includes("required")&&(i.ua||i.label)?(e.openBlock(),e.createElementBlock("span",el,"*")):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"flex-1 min-w-0",style:e.normalizeStyle(s.value)},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],4),i.error?(e.openBlock(),e.createElementBlock("span",tl,e.toDisplayString(i.error),1)):e.createCommentVNode("",!0)]))}}),ll={class:"w-full relative"},al={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},ol=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",ll,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",al,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),rl={class:"flex-1 min-w-0"},sl={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},il={class:"truncate"},dl={key:0,class:"text-red-500 text-[14px]"},cl={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},ul={key:0,class:"mt-1 text-xs text-red-500"},pl={default:Xn,horizontal:nl,inline:ol,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=i=>{i.key==="locale"&&(n.value=i.newValue??"uk")};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(n.value=localStorage.locale)}catch{}window.addEventListener("storage",s)}),e.onUnmounted(()=>{window.removeEventListener("storage",s)}),(i,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":i.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(i.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",rl,[i.ua||i.label?(e.openBlock(),e.createElementBlock("p",sl,[e.createElementVNode("span",il,e.toDisplayString(i.item[n.value]||i.ua||i.label),1),o.value?(e.openBlock(),e.createElementBlock("span",dl,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createElementBlock("p",cl,e.toDisplayString(a.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["w-full",["select","native-select"].includes(i.item.type)?"md:w-[30%]":"md:w-auto"])},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],2)],2),r.value?(e.openBlock(),e.createElementBlock("p",ul,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0)],2))}})};function ce(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 ml=["placeholder","disabled"],hl=e.defineComponent({__name:"vs-input-password",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=ce(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??"");return(s,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),placeholder:r.value,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,ml)),[[e.vModelText,a.value]])}}),fl=["placeholder","disabled"],Fe=e.defineComponent({__name:"vs-input-text",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=ce(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??"");function s(){typeof a.value=="string"&&(a.value=a.value.trim())}return(i,d)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":d[0]||(d[0]=c=>a.value=c),placeholder:r.value,disabled:o.value,onBlur:s,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.customClass,e.unref(n),{"!border-red-600":i.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,fl)),[[e.vModelText,a.value]])}}),gl=["placeholder","disabled","min","max"],Jt=e.defineComponent({__name:"vs-input-number",props:e.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=ce(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled);return(r,s)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":s[0]||(s[0]=i=>a.value=i),placeholder:r.placeholder,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"},min:r.min,max:r.max},null,10,gl)),[[e.vModelText,a.value]])}}),G=(l,t)=>{const n=l.__vccOpts||l;for(const[a,o]of t)n[a]=o;return n},yl={},kl={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function bl(l,t){return e.openBlock(),e.createElementBlock("svg",kl,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const wl=G(yl,[["render",bl]]),xl={class:"flex items-center gap-[4px]"},_l=["value","id","disabled"],El=["for"],Vl={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},vl=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",xl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:s.value,"onUpdate:modelValue":i[0]||(i[0]=d=>o.value=d),class:e.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":r.value}]),id:s.id,disabled:r.value},null,10,_l),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:s.id,class:e.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":r.value}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[o.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",s.error?"border-red-600":""]])},[e.createVNode(wl,{height:"12",width:"12"})],2),e.createElementVNode("span",Vl,[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(s.label),1)])])],10,El)]))}}),Bl=["name","value","disabled"],Cl={class:"flex items-center gap-[6px] text-[14px]"},Nl={key:0,class:"text-[16px]"},Ml=["src"],Sl=e.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.computed({get:()=>n.modelValue,set:i=>{a("update:modelValue",i)}}),r=e.computed(()=>Array.isArray(o.value)?o.value.includes(n.value):o.value===!0||o.value===n.value),s=e.computed(()=>n.style?.size==="xs"?"p-1.5 text-xs":n.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(i,d)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[s.value,r.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"hidden",name:i.id,value:i.value,"onUpdate:modelValue":d[0]||(d[0]=c=>o.value=c),disabled:i.disabled},null,8,Bl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("span",Cl,[i.icon||i.imgUrl?(e.openBlock(),e.createElementBlock("span",Nl,[i.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(i.icon)},null,2)):e.createCommentVNode("",!0),i.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:1,src:i.imgUrl,width:"16",height:"16",alt:"icon"},null,8,Ml)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(i.label),1)])])],2))}}),$l={class:"flex items-center"},Et=e.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=`radio-${Math.floor(Math.random()*1e4)}`,r=e.computed({get:()=>Array.isArray(n.modelValue)?Array.isArray(n.modelValue)&&n.modelValue.includes(n.value):n.modelValue,set:i=>{if(Array.isArray(n.modelValue)){let d=[...n.modelValue];i?d.includes(n.value)||d.push(n.value):d=d.filter(c=>c!==n.value),a("update:modelValue",d)}else a("update:modelValue",i)}}),s=e.ref(`vs-checkbox-${n.view||"default"}`);return(i,d)=>(e.openBlock(),e.createElementBlock("div",$l,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value==="vs-checkbox-buttons"?e.unref(Sl):e.unref(vl)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:r.value,"onUpdate:modelValue":d[0]||(d[0]=c=>r.value=c),id:o,icon:i.icon,imgUrl:i.imgUrl,style:e.normalizeStyle(i.style),error:i.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),Dl={},Al={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function Fl(l,t){return e.openBlock(),e.createElementBlock("svg",Al,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 Ll=G(Dl,[["render",Fl]]),Tl={},Il={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function Ol(l,t){return e.openBlock(),e.createElementBlock("svg",Il,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 Vt=G(Tl,[["render",Ol]]),Rl={},zl={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 jl(l,t){return e.openBlock(),e.createElementBlock("svg",zl,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"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 Pl=G(Rl,[["render",jl]]),Ul={key:0,class:"flex items-start gap-x-1"},Hl={key:0,class:"text-red-500 text-[14px]"},ql=["title"],Gl=["disabled"],vt=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:{}},{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",Ul,[e.createVNode(Et,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),label:a.text,error:a.error||""},null,8,["modelValue","label","error"]),a.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",Hl,"*")):e.createCommentVNode("",!0),a.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:a.i,onClick:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(Pl),{class:"text-gray-500 w-[14px] h-[14px]"})],8,ql)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[n.value?`bg-${a.style?.primaryColor||"blue"}-500`:"bg-stone-200",a.customClass]]),disabled:a.disabled,onClick:o[2]||(o[2]=r=>n.value=!n.value)},[e.createElementVNode("span",{"data-state":"checked",class:e.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[n.value?"translate-x-4":"translate-x-0"]])},null,2)],10,Gl))}}),Kl=["id","innerHTML"],Bt=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",{id:t.name,class:e.normalizeClass(["text-gray-900",t.customClass]),innerHTML:t.html?t.html:t.text},null,10,Kl))}}),Yl=["placeholder","disabled","name"],Ct=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:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=ce(t.style),a=e.useModel(l,"modelValue"),o=e.ref(null);let r=null;return e.onMounted(async()=>{if(o.value){const{default:s}=await Promise.resolve().then(()=>Ut);r=s(o.value,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),r.on("accept",()=>{a.value=t.unmask?r.unmaskedValue:r.value}),r.on("complete",()=>{a.value=t.unmask?r.unmaskedValue:r.value}),r.value=a.value!=null?String(a.value):""}}),e.onBeforeUnmount(()=>{r?.destroy()}),e.watch(()=>t.mask,s=>{r&&r.updateOptions({mask:s,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),e.watch(a,s=>{r&&r.unmaskedValue!==s&&(r.value=s!=null?String(s):"")}),(s,i)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:s.placeholder,disabled:s.disabled,name:s.name,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,10,Yl))}}),Wl={class:"relative w-full bg-white rounded-lg"},Zl=["placeholder","disabled"],Nt=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:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=ce(t.style),a=e.useModel(l,"modelValue");return(o,r)=>(e.openBlock(),e.createElementBlock("div",Wl,[r[1]||(r[1]=e.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),e.withDirectives(e.createElementVNode("input",{type:"email","onUpdate:modelValue":r[0]||(r[0]=s=>a.value=s),placeholder:o.placeholder,disabled:o.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Zl),[[e.vModelText,a.value]])]))}}),Jl={class:"relative w-full bg-white rounded-lg"},Xl=["value","placeholder","disabled"],Mt=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:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=ce(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>a.value?a.value.startsWith("+")?a.value.slice(1):a.value:""),r=i=>{let{value:d}=i.target;d=d.replace(/^\+/,""),a.value=d?`+${d}`:""},s=i=>{const d=i,{data:c,inputType:m}=d;m&&m.startsWith("delete")||c&&/\D/.test(c)&&d.preventDefault()};return e.watch(()=>a.value,i=>{i&&!i.startsWith("+")?a.value=`+${i.replace(/^\+/,"")}`:i||(a.value="")},{immediate:!0}),(i,d)=>(e.openBlock(),e.createElementBlock("div",Jl,[d[0]||(d[0]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"stroke-gray-500 transition-all"},[e.createElementVNode("path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"})])],-1)),d[1]||(d[1]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[30px] text-gray-500 select-none pointer-events-none"}," + ",-1)),e.createElementVNode("input",{type:"tel",value:o.value,onInput:r,onBeforeinput:s,pattern:"^\\+[1-9]\\d{1,14}$",maxlength:"15",placeholder:i.placeholder,disabled:i.disabled,class:e.normalizeClass(["!pl-10 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":i.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Xl)]))}}),Ql=["value","disabled"],ea={class:"text-[13px] text-gray-700"},ta=e.defineComponent({__name:"vs-input-radio-default",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},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,Ql),[[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",ea,e.toDisplayString(t.text),1)],2))}}),na=["value","disabled"],la={class:"text-[13px] text-gray-700"},aa={"vs-input-radio-default":ta,"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:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>!!t.disabled);return(o,r)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[n.value==t.value?`ring-2 ring-ring ring-${t.style?.primaryColor||"blue"}-500`:"",t.customClass,a.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:"radio",value:t.value,disabled:a.value,class:"hidden"},null,8,na),[[e.vModelRadio,n.value]]),e.createElementVNode("span",la,e.toDisplayString(t.text),1)],2))}})},St=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:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>aa[`vs-input-radio-${t.view}`]);return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([o.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,s=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),e.mergeProps({key:s?.id,text:s.text,value:s.id.toString(),checked:n.value===s.id,modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=i=>n.value=i)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),oa={key:1,class:"w-full flex flex-col gap-4"},ra={key:0,class:"text-sm font-medium text-muted-foreground my-2"},sa="Без категорії",Xt=G(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:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.ref([]),r=e.reactive({}),s=g=>g?.value||g?.id||g?.text||g,i=g=>g.text||String(g),d=g=>`lg:col-span-${g||12}`,c=e.computed(()=>[n.position==="vertical"?"flex flex-col":"",n.colSpan?"grid":"flex justify-start"]),m=g=>g==null||g===""?null:typeof g=="string"||typeof g=="number"?g:String(g),f=e.computed(()=>{if(!n.group)return[];const g=new Map;o.value.forEach(h=>{const v=h[n.group],y=m(v);g.has(y)||g.set(y,[]),g.get(y)?.push(h)});const V=[];n.values?.length&&n.values.forEach(h=>{const v=m(h);V.push(v)});const w=new Set,k=h=>{const v=g.get(h)||[];if(!v.length)return null;const y=h===null?"group-null":`group-${String(h)}`,C=h===null?sa:String(h);return w.add(h),{key:y,label:C,options:v}},b=[];return V.forEach(h=>{const v=k(h);v&&b.push(v)}),g.forEach((h,v)=>{if(w.has(v))return;const y=k(v);y&&b.push(y)}),b}),x=async()=>{try{const g=await fetch(`/api/suggest/${n.data}`).then(V=>V.json());o.value=g?.data||g}catch(g){console.error(g)}};return e.watch(()=>n.modelValue,g=>{if(typeof g=="boolean"&&o.value.length===1){const V=s(o.value[0]);r[V]=g}else if(Array.isArray(g)){const V=new Set(g);o.value.forEach(w=>{if(!w.disabled){const k=s(w);r[k]=V.has(k)}})}},{immediate:!0}),e.watch(r,()=>{if(!o.value.length){a("update:modelValue",null);return}const g=Object.entries(r).filter(([,V])=>V).map(([V])=>V);a("update:modelValue",g.length===0?[]:g)},{deep:!0}),e.onMounted(()=>{if(n.data)x().then(()=>{if(typeof n.modelValue=="boolean"&&o.value.length===1){const g=s(o.value[0]);r[g]=n.modelValue}else if(Array.isArray(n.modelValue)){const g=new Set(n.modelValue);o.value.forEach(V=>{if(!V.disabled){const w=s(V);r[w]=g.has(w)}})}});else if(o.value=n.options,typeof n.modelValue=="boolean"&&o.value.length===1){const g=s(o.value[0]);r[g]=n.modelValue}else if(Array.isArray(n.modelValue)){const g=new Set(n.modelValue);o.value.forEach(V=>{if(!V.disabled){const w=s(V);r[w]=g.has(w)}})}}),(g,V)=>n.group?(e.openBlock(),e.createElementBlock("div",oa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,w=>(e.openBlock(),e.createElementBlock("div",{key:w.key,class:"flex flex-col gap-2"},[w.label?(e.openBlock(),e.createElementBlock("span",ra,e.toDisplayString(w.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["p-0 w-full gap-[12px]",c.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.options,k=>(e.openBlock(),e.createBlock(Et,{modelValue:r[s(k)],"onUpdate:modelValue":b=>r[s(k)]=b,value:s(k),class:e.normalizeClass(d(g.colSpan)),disabled:n.disabled||k.disabled,label:i(k),key:`${w.key}-${s(k)}`,icon:k?.icon,imgUrl:k?.imgUrl,option:k,view:g.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["p-0 w-full gap-[10px]",c.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,w=>(e.openBlock(),e.createBlock(Et,{modelValue:r[s(w)],"onUpdate:modelValue":k=>r[s(w)]=k,value:s(w),class:e.normalizeClass(d(g.colSpan)),disabled:n.disabled||w.disabled,label:i(w),key:s(w),icon:w?.icon,imgUrl:w?.imgUrl,option:w,view:g.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-8e66207e"]]),ia=["type","placeholder","disabled"],da=e.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},mode:{default:"date"}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l;function a(m){return m?n.mode==="datetime"?(m.includes("T")?m:null)||m+(m.includes(" ")?"":"T00:00"):m?.split(" ")[0]:null}const{inputClass:o}=ce(n.style),r=t,s=e.computed({get:()=>a(n.modelValue),set:m=>r("update:modelValue",m)}),i=e.computed(()=>n.mode==="datetime"?"datetime-local":n.mode),d=e.computed(()=>!!n.disabled),c=e.computed(()=>n.placeholder??"");return(m,f)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":f[0]||(f[0]=x=>s.value=x),placeholder:c.value,disabled:d.value,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[m.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,ia)),[[e.vModelDynamic,s.value]])}}),ca=(l,t)=>{if(!t||!Object.keys(t).length)return l;const[n,a=""]=l.split("?"),o=new URLSearchParams(a);Object.entries(t).forEach(([s,i])=>{i==null||i===""||o.set(s,String(i))});const r=o.toString();return r?`${n}?${r}`:n},Qt=async(l,t={})=>{try{const n=new FormData;n.append("unique","true"),n.append("file",l);const{api:a,id:o="1",form:r="form",table:s="table",customParams:i}=t,d=a||`/file/upload/uploads?id=${o||""}&form=${r||""}&table=${s||""}`,c=ca(d,i);return(await fetch(c,{method:"POST",body:n}).then(f=>f.json()))?.result}catch(n){return ne.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",n),null}},ua=async l=>{try{return await fetch(`file/delete${l}`),!0}catch(t){return console.error(t),!1}},en=async l=>{try{const t=await fetch(`file/download/files/uploads${l}`),n=await t.arrayBuffer(),a=t.headers["content-type"],o=new TextDecoder("utf-8").decode(n),r=new Blob([o],{type:a}),s=document.createElement("a");s.setAttribute("download",l),s.href=window.URL.createObjectURL(r),s.click()}catch(t){console.error(t.message)}},pa={},ma={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function ha(l,t){return e.openBlock(),e.createElementBlock("svg",ma,t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const xe=G(pa,[["render",ha]]),fa={},ga={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 ya(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",ga,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="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 ka=G(fa,[["render",ya]]),ba={},wa={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 xa(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",wa,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 _a=G(ba,[["render",xa]]),Ea={},Va={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 va(l,t){return e.openBlock(),e.createElementBlock("svg",Va,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M9 9l1 0"></path><path d="M9 13l6 0"></path><path d="M9 17l6 0"></path>',6)]))}const tn=G(Ea,[["render",va]]),Ba={},Ca={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 Na(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Ca,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 Ma=G(Ba,[["render",Na]]),Sa={},$a={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 Da(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",$a,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 Aa=G(Sa,[["render",Da]]),Fa=l=>{if(!l)return"";const t=l?.split(".");return t[t.length-1]},La=l=>{const t=Fa(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)?_a:n.textsFormat.includes(t)?Aa:n.documentsFormat.includes(t)?ka:n.archivesFormat.includes(t)?Ma:tn},Ta={},Ia={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 Oa(l,t){return e.openBlock(),e.createElementBlock("svg",Ia,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 Le=G(Ta,[["render",Oa]]),Ra={},za={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function ja(l,t){return e.openBlock(),e.createElementBlock("svg",za,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const nn=G(Ra,[["render",ja]]),Pa=["title"],Ua={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},ln=G(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:{}},{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(La)(n.value)),{src:n.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:r[0]||(r[0]=s=>e.unref(en)(n.value))},null,8,["src"])),e.createElementVNode("div",Ua,[e.createElementVNode("button",{type:"button",onClick:r[1]||(r[1]=s=>{e.unref(ua)(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(Le,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:r[2]||(r[2]=s=>e.unref(en)(n.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[e.createVNode(nn,{class:"w-4 h-4"})])])],8,Pa))}}),[["__scopeId","data-v-286cdbc0"]]),Ha={class:"flex items-center gap-x-2"},qa=["accept","multiple","disabled"],Ga={key:1,class:"flex items-center flex-wrap gap-2"},Ka={key:1,class:"loader"},Ya={key:1,class:"loader"},an=G(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:{}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["change"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=e.useModel(l,"modelValue"),o=t,r=e.ref(null),s=e.ref(!1),i=e.inject("values"),d=e.computed(()=>n.format?n.format.split(",").map(h=>h.trim().toLowerCase()).filter(Boolean):[]),c=h=>Array.isArray(a.value)&&a.value[h]||"",m=h=>{if(n.max_size&&h.size>n.max_size*1024*1024){const v=(h.size/1048576).toFixed(2);return ne.notify({type:"error",title:"Помилка!",message:`Файл "${h.name}" занадто великий. Максимальний розмір: ${n.max_size} МБ, розмір файлу: ${v} МБ`,position:"right-bottom"}),!1}return!0},f=h=>{if(!d.value.length)return!0;const v=`.${h.name.split(".").pop()?.toLowerCase()||""}`,y=d.value.includes(v);return y||ne.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${h.name}". Дозволені формати: ${d.value.join(", ")}`,position:"right-bottom"}),y},x=e.computed(()=>{const h={},v=[];if(!n.customParams?.length)return{params:h,missingSources:v};const y=i?.value??{};return n.customParams.forEach(C=>{if(!C)return;const[L,$]=C.split("="),R=L?.trim(),z=$?.trim();if(!R||!z)return;const U=y[z];if(U==null||U===""){v.push(z);return}h[R]=U}),{params:h,missingSources:v}}),g=()=>{const h=x.value.params;return{api:n.api,customParams:Object.keys(h).length?h:void 0}},V=()=>{const h=x.value.missingSources;if(!h.length)return!0;const v=h.join(", ");return ne.notify({type:"warning",title:"Заповніть поля",message:`Поля (${v}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},w=h=>{ne.notify({type:"error",title:"Помилка завантаження",message:h||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},k=()=>{n.disabled||s.value||V()&&r.value?.click()},b=async h=>{const{files:v}=h.target;if(!v||v.length===0)return;if(!V()){r.value&&(r.value.value="");return}const y=Array.from(v);if(n.max_size&&y.filter($=>!m($)).length>0){r.value&&(r.value.value="");return}if(y.filter(L=>!f(L)).length>0){r.value&&(r.value.value="");return}s.value=!0;try{if(n.multiple){const L=Array.from(v).map(async U=>await Qt(U,g())),$=await Promise.all(L),z=$.filter(U=>U!==null).map(U=>U?.file_path).filter(Boolean);if(z.length===0){w();return}z.length<$.length&&w("Деякі файли не вдалося завантажити. Перевірте їх та спробуйте знову."),a.value=[...a.value||[],...z],o("change",a.value)}else{const L=v[0],$=await Qt(L,g());if(!$?.file_path){w();return}a.value=$?.file_path,o("change",a.value||"")}}catch(L){const $=L?.message||void 0;w($)}finally{s.value=!1,r.value&&(r.value.value="")}};return(h,v)=>(e.openBlock(),e.createElementBlock("div",Ha,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:r,type:"file",accept:n.format,multiple:h.multiple,onChange:b,disabled:s.value||h.disabled},null,40,qa),!h.multiple&&a.value?(e.openBlock(),e.createBlock(ln,{key:0,item:a.value,"onUpdate:item":v[0]||(v[0]=y=>a.value=y),value:a.value,"onUpdate:value":v[1]||(v[1]=y=>a.value=y)},null,8,["item","value"])):h.multiple?(e.openBlock(),e.createElementBlock("div",Ga,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(y,C)=>(e.openBlock(),e.createBlock(ln,{multiple:h.multiple,key:C,value:a.value,"onUpdate:value":v[2]||(v[2]=L=>a.value=L),item:c(C)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:k,class:e.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",h.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",Ka)):(e.openBlock(),e.createBlock(xe,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),h.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:k,class:e.normalizeClass([h.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",Ya)):(e.openBlock(),e.createBlock(xe,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-94bcb5d9"]]),Wa={class:"max-w-[55vw]"},Za={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},Ja={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},Xa={class:"px-[5px]"},Qa={class:""},tt=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",Wa,[e.createElementVNode("p",Za,e.toDisplayString(o.item?.uploaded_name),1),e.createElementVNode("p",Ja,[e.createElementVNode("span",null,e.toDisplayString(o.item?.username),1),e.withDirectives(e.createElementVNode("span",Xa,"|",512),[[e.vShow,o.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(n.value),1),r[0]||(r[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",Qa,e.toDisplayString(a(o.item?.size)),1)])])],64))}}),eo={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},to={key:0,class:"flex w-full gap-x-3 items-center"},no={key:1,class:"flex gap-x-3 w-full items-center"},lo={key:2,class:"flex gap-x-3 w-full items-center"},ao=["href"],oo={key:3,class:"flex gap-x-3 w-full items-center"},ro={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},so={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"},io={class:"inline-block"},co={class:"inline-block"},uo=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(m){return["pdf","json"].includes(m.ext)}function r(m){return["ppt","pptx","doc","docx","xls","xlsx"].includes(m.ext)}function s(m){const f=document.createElement("a");f.setAttribute("download",m?.uploaded_name),f.href=m?.file_path,f.click()}async function i(){try{await fetch(`${n.prefix}/widget/file/${n.item.entity_id}/${n.item.file_id}`),a("update")}catch(m){console.error(m)}}function d(){a("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function c(m){(n.item.ext==="jpg"||n.item.ext==="png")&&a("openLightbox",{item:n.item,index:m})}return(m,f)=>(e.openBlock(),e.createElementBlock("div",eo,[m.item.ext==="jpg"||m.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",to,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:f[0]||(f[0]=x=>c(m.index))},[e.createVNode(tt,{item:m.item},null,8,["item"])])])):o(m.item)?(e.openBlock(),e.createElementBlock("div",no,[e.createVNode(tt,{item:m.item},null,8,["item"])])):r(m.item)?(e.openBlock(),e.createElementBlock("div",lo,[e.createElementVNode("a",{href:`/api/file-preview?id=${m.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(tt,{item:m.item},null,8,["item"])],8,ao)])):(e.openBlock(),e.createElementBlock("div",oo,[e.createVNode(tt,{item:m.item},null,8,["item"])])),e.createElementVNode("div",ro,[e.createElementVNode("div",so,[e.createElementVNode("div",io,[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:f[1]||(f[1]=x=>s(m.item))},[e.createVNode(nn,{height:"14",width:"14"})])]),f[3]||(f[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",co,[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:f[2]||(f[2]=x=>d())},[e.createVNode(Le,{height:"14",width:"14"})])])])])]))}}),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 ho(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 fo=G(po,[["render",ho]]),go={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},yo={class:"flex w-full mb-[12px] items-center gap-x-2"},ko={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},bo={class1:"ml-auto"},wo={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"},xo={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},_o={class:"relative"},Eo={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"},Vo={key:0},on=e.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update"],setup(l,{emit:t}){const n=l,a=e.inject("form"),o=e.computed(()=>a.value.formId),r=e.ref(!1),s=e.ref(0),i=t,d=e.ref(!1),c=e.ref({}),m=e.ref([]),f=e.ref(""),x=e.computed(()=>Array.isArray(m.value)?m.value.filter(v=>v.ext==="jpg"||v.ext==="png").map(v=>v?.file_path):[]),g=e.computed(()=>f.value===""?m.value:m.value.filter(v=>v?.uploaded_name?.includes(f.value))),V=v=>{const y=x.value.findIndex(C=>C===v.item.file_path);y!==-1&&(r.value=!0,s.value=y)},w=async()=>{try{const v=await fetch(`${n.prefix}/widget/file/${o.value}`).then(y=>y.json());m.value=v?.rows}catch(v){console.error(v)}},k=async v=>{await Promise.all(Array.from(v.target.files).map(async y=>{const C=new FormData;C.append("file",y);try{const L=`${n.prefix}/widget/file/${o.value}`,$=await fetch(L,{method:"POST",body:C});return $.ok?(i("update","file-list"),y):(ne.notify({type:$.status>=400&&$.status<500?"warning":"error",title:"Error",message:`Error code: ${$.status}`}),null)}catch(L){return ne.notify({type:"error",title:"Error",message:L.message||"Unknown error"}),console.error(L),null}})),await w()},b=v=>{const y={...v};return v.cancel||(y.cancel=()=>{d.value=!1}),v.updateListOnConfirm&&(y.confirm=async()=>{await v.confirm(),d.value=!1,w()}),y},h=v=>{c.value=b(v),d.value=!0};return e.watch(o,v=>{v&&w()}),e.onMounted(()=>{o.value&&w()}),(v,y)=>{const C=e.resolveComponent("Lightbox"),L=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",go,[e.createElementVNode("div",yo,[e.createElementVNode("h2",ko," Файлів: "+e.toDisplayString(m.value?.length),1),e.createElementVNode("div",bo,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:y[0]||(y[0]=$=>k($))},null,32),e.createElementVNode("div",wo,[e.createVNode(fo,{height:"16",width:"16"})])])])]),m.value?.length>4?(e.openBlock(),e.createElementBlock("div",xo,[e.createElementVNode("div",null,[e.createElementVNode("div",_o,[y[8]||(y[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":y[1]||(y[1]=$=>f.value=$),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,f.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),m.value?.length?(e.openBlock(),e.createElementBlock("div",Eo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,($,R)=>(e.openBlock(),e.createBlock(uo,{key:R,prefix:v.prefix,item:$,index:R,onUpdate:y[2]||(y[2]=z=>v.$emit("update","file-list")),onOpenModal:y[3]||(y[3]=z=>h(z)),onOpenLightbox:y[4]||(y[4]=z=>V(z))},null,8,["prefix","item","index"]))),128)),g.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Vo,y[9]||(y[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):e.createCommentVNode("",!0),e.createVNode(C,{modelValue:r.value,"onUpdate:modelValue":y[5]||(y[5]=$=>r.value=$),startIndex:s.value,"onUpdate:index":y[6]||(y[6]=$=>s.value=$),images:x.value},null,8,["modelValue","startIndex","images"]),e.createVNode(L,e.mergeProps({modelValue:d.value,"onUpdate:modelValue":y[7]||(y[7]=$=>d.value=$),onConfirm:c.value.confirm},c.value),null,16,["modelValue","onConfirm"])])}}}),vo={class:"flex items-center justify-between"},Bo={class:"text-[16px] text-gray-900 font-medium"},Co={class:"grid gap-3"},No=G(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",vo,[e.createElementVNode("p",Bo,e.toDisplayString(l.title),1),e.createVNode(vt,{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",Co,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),Mo={class:"text-[16px] text-gray-900 font-medium"},So={class:"grid gap-3"},$o=G(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(Ll),{class:e.normalizeClass(["h-4 w-4 duration-300",[n.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",Mo,e.toDisplayString(l.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",So,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),Do={class:"flex items-center justify-between"},Ao={switcher:No,accordion:$o,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",Do,[e.createElementVNode("p",null,e.toDisplayString(l.title),1)]),e.renderSlot(t.$slots,"default")]))}})},pe={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Fo=(l,t)=>String(l)===String(t),Lo=(l,t)=>String(l)!==String(t),To=(l,t)=>l>t,Io=(l,t)=>l>=t,Oo=(l,t)=>l<t,Ro=(l,t)=>l<=t,zo=(l,t)=>Array.isArray(t)&&t.length===2?l>=t[0]&&l<=t[1]:!1,jo=(l,t)=>String(l).startsWith(String(t)),Po=(l,t)=>String(l).endsWith(String(t)),Uo=(l,t)=>String(l).includes(String(t)),Ho=(l,t)=>Array.isArray(t)?t.includes(l):!1,qo=(l,t)=>Array.isArray(t)?!t.includes(l):!0,rn=(l,t)=>{if(!t)return!0;switch(t?.[1]){case pe.Equal:return Fo(l,t?.[2]);case pe.Inequal:return Lo(l,t?.[2]);case pe.Higer:return To(l,t?.[2]);case pe.HigerOrEqual:return Io(l,t?.[2]);case pe.Lower:return Oo(l,t?.[2]);case pe.LowerOrEqual:return Ro(l,t?.[2]);case pe.Between:return zo(l,t?.[2]);case pe.StartWith:return jo(l,t?.[2]);case pe.EndWith:return Po(l,t?.[2]);case pe.Contain:return Uo(l,t?.[2]);case pe.In:return Ho(l,t?.[2]);case pe.NotIn:return qo(l,t?.[2]);default:return!0}},sn=e.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(l){const t=l,n=e.inject("values",e.ref({})),a=e.inject("form"),o=e.computed(()=>t.schema?.filter(i=>{const d=i?.conditions;if(!d)return!0;const c=Array.isArray(d)?d[0]:d,m=t.name?n.value?.[t.name]?.[c]??n.value?.[c]:n.value?.[c];return rn(m,d)})),r=e.computed(()=>Ao[t.view]),s=e.computed(()=>{if(n.value||(n.value={}),!t.name)return n.value;const i=n.value[t.name];if(i)return i;const d={};return n.value={...n.value,[t.name]:d},d});return(i,d)=>l.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{key:0,title:l.title,style:e.normalizeStyle(l.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,c=>(e.openBlock(),e.createBlock(_n,e.mergeProps({key:c.name},{ref_for:!0},c,{item:c,modelValue:s.value[c.name],"onUpdate:modelValue":m=>s.value[c.name]=m,style:l.style,error:e.unref(a)?.errors?.[c.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),Go=["aria-expanded","data-focus"],Ko={key:0,class:"flex flex-wrap items-center gap-1 overflow-y-auto min-w-0 flex-1"},Yo={class:"flex items-center min-w-0"},Wo=["title"],Zo=["innerHTML"],Jo=["onClick"],Xo={class:"flex-1 min-w-[2px]"},Qo=["placeholder"],er=["title"],tr=["innerHTML"],nr={key:2,class:"flex-1 min-w-[2px]"},lr=["placeholder"],ar={class:"flex items-center shrink-0"},or=["disabled"],rr=["disabled","title"],sr=["aria-disabled","onClick"],ir=["innerHTML"],dr={key:1,class:"px-3 py-2 text-center text-gray-500"},cr=["disabled"],$t=e.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},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);ce(n.style);const s=e.computed({get:()=>n.modelValue,set:B=>a("update:modelValue",B)});!s.value&&n.defaultValue&&(s.value=n.defaultValue);const i=e.ref(null),d=e.ref(null),c=e.ref(null),m=e.ref(null),f=e.ref(!1),x=e.ref(!1),g=e.ref(null),V=e.ref([]),w=e.ref(-1),k=e.ref([]),b=e.ref(""),h=e.ref(null),v=e.ref("bottom"),y=e.ref({}),C=e.ref([]),L=e.computed(()=>{if(!C.value.length)return[];const B=V.value,S=new Map(B.map(A=>[A.id?.toString(),A]));return C.value.map(A=>S.get(A?.toString())).filter(A=>!!A)}),$=e.computed(()=>n.placeholder||"Select..."),R=e.computed(()=>N(g.value));e.computed(()=>o.value?!C.value.length&&b.value==="":!R.value&&b.value==="");const z=e.computed(()=>r.value?!1:o.value?C.value.length>0:!!s.value),U=B=>o.value?C.value.some(S=>S?.toString()===B?.toString()):s.value?.toString()===B?.toString(),T=e.computed(()=>{let B=V.value??[];if(!n.data&&b.value.trim()!==""){const S=b.value.toLowerCase();B=B.filter(A=>{const K=N(A).toLowerCase(),p=A.text?.toLowerCase?.()||"";return K.includes(S)||p.includes(S)})}if(o.value&&C.value.length){const S=new Set(C.value.map(A=>A?.toString()));B=B.filter(A=>!S.has(A.id?.toString()))}return B}),J=e.inject("values"),Y=/\{\{\s*([^}]+?)\s*\}\}/g,Q=B=>(B?String(B):"").replace(/<[^>]*>/g,"").trim(),M=e.computed(()=>n.slot??n?.optionTemplate??""),E=B=>{if(!B)return"";const S=M.value;return S?S.replace(Y,(A,K)=>{const p=K.trim(),u=B[p];return u!=null?String(u):""}):B.text??""},N=B=>{if(!B)return"";if(!M.value)return B.text??"";const A=E(B);return Q(A)||B.text||""},D=B=>{n.set&&J?.value&&Object.entries(n.set).forEach(([S,A])=>{if(!S)return;const K=B?B[A]:null;J.value[S]=K??null})},H=e.computed(()=>n.parent?J?.value?.[n.parent]?.toString()??null:null),ee=async B=>{if(!n.data){let S=n.options??[];if(B?.trim()){const A=B.toLowerCase();S=S.filter(K=>{const p=N(K).toLowerCase(),u=K.text?.toLowerCase?.()||"";return p.includes(A)||u.includes(A)})}return S}try{const S=n.host??"",A=n.prefix??"api",K=n.api??`/${A}/suggest/${n.data}`,p=`${S}${K}`,u=new URLSearchParams;return u.set("json","1"),B&&u.set("key",B),H.value!==void 0&&H.value!==null&&H.value!==""&&u.set("parent",H.value),(await fetch(`${p}?${u.toString()}`).then(F=>F.json()))?.data??[]}catch{return[]}},me=async()=>{n.data?V.value=await ee(b.value):V.value=n.options?[...n.options]:[]},I=async B=>{if(B==null)return null;const S=V.value?.find(A=>A?.id?.toString()===String(B));if(S)return S;if(n.data)try{const A=n.host??"",K=n.prefix??"api",p=n.api??`/${K}/suggest/${n.data}`,u=`${A}${p}`,_=new URLSearchParams;return _.set("json","1"),_.set("val",String(B)),H.value!==void 0&&H.value!==null&&H.value!==""&&_.set("parent",H.value),((await fetch(`${u}?${_.toString()}`).then(j=>j.json()))?.data??[])?.[0]??null}catch{return null}return null},ae=async B=>{const S=new Set(V.value.map(K=>K.id?.toString())),A=B.filter(K=>!S.has(K?.toString()));A.length&&await A.reduce(async(K,p)=>{await K;const u=await I(p);u&&V.value.push(u)},Promise.resolve())},ge=async()=>{r.value||(f.value=!0,await me(),await e.nextTick(()=>{he(),h.value?.focus(),T.value.length?w.value=0:w.value=-1}))},de=()=>{f.value=!1,w.value=-1},Ht=async B=>{if(r.value)return;!f.value?await ge():de()},ft=async()=>{f.value?h.value?.focus():await ge()},qt=()=>{o.value?(C.value=[],s.value=[],a("change",[]),Me(null,[])):(g.value=null,s.value=null,a("change",null),Me(null,null)),D(null),b.value="",e.nextTick(()=>h.value?.focus())},Gt=B=>{o.value&&(C.value=C.value.filter(S=>S?.toString()!==B?.toString()),s.value=[...C.value],a("change",s.value),Me(null),e.nextTick(()=>h.value?.focus()))},Me=(B,S)=>{const A=S??(o.value?[...C.value]:B?.id??null);a("value-selected",{name:n.name,value:A,option:B})},Oe=B=>{o.value?(U(B.id)||(C.value=[...C.value,B.id],s.value=[...C.value],a("change",s.value),Me(B)),b.value="",e.nextTick(()=>{h.value?.focus(),w.value=Math.min(w.value,T.value.length-1)}),D(null)):(g.value=B,s.value=B.id,a("change",s.value),Me(B),b.value="",de(),D(B))},Kt=B=>{U(B.id)||Oe(B)},Re=(B,S)=>{if(!B||!S)return;const A=B.offsetTop,K=A+B.offsetHeight,p=S.scrollTop,u=p+S.clientHeight;let _=S.scrollTop;A<p?_=A-80:K>u&&(_=K-S.clientHeight+4);const F=S;F.scrollTop=_},Je=B=>{let S=B.parentElement;for(;S;){if(S.classList.contains("ui-dialog__content"))return S;const A=window.getComputedStyle(S),K=A.overflow+A.overflowY+A.overflowX;if(K.includes("auto")||K.includes("scroll")||S===document.body||S===document.documentElement)return S;S=S.parentElement}return document.body},he=()=>{if(!d.value)return;const B=d.value.getBoundingClientRect(),S=window.innerHeight||document.documentElement.clientHeight,A=window.innerWidth||document.documentElement.clientWidth,K=8,p=8,u=n.maxHeight||300,_=S-B.bottom-p-K,F=B.top-p-K,O=_>=F,j=Math.max(A-K*2,0);let{width:q}=B;j>0&&q>j&&(q=j);let{left:te}=B;te+q+K>A&&(te=A-q-K),te=Math.max(te,K);const le=Math.min(u,Math.max(O?_:F,50));v.value=O?"bottom":"top",y.value={position:"fixed",left:`${te}px`,width:`${q}px`,minWidth:"300px",maxHeight:`${le}px`,transform:O?"none":"translateY(-100%)",top:O?`${B.bottom+p}px`:`${B.top-p}px`}},gt=async B=>{r.value||!f.value&&(B.key==="ArrowDown"||B.key==="ArrowUp")&&(B.preventDefault(),await ge())},ze=B=>{if(!f.value)return;const{key:S}=B;if(S==="ArrowDown")B.preventDefault(),w.value+1<T.value.length&&(w.value+=1,Re(k.value[w.value],c.value));else if(S==="ArrowUp")B.preventDefault(),w.value>0&&(w.value-=1,Re(k.value[w.value],c.value));else if(S==="Enter"){B.preventDefault();const A=T.value[w.value];A&&Oe(A),h.value?.blur()}else S==="Escape"?(B.preventDefault(),de()):S==="Backspace"?o.value&&b.value===""&&C.value.length&&(C.value=C.value.slice(0,-1),s.value=[...C.value],a("change",s.value)):S==="Home"?(w.value=0,Re(k.value[0],c.value)):S==="End"?(w.value=T.value.length-1,Re(k.value[w.value],c.value)):S==="Tab"&&de()},yt=()=>{r.value||(x.value=!0)},Se=()=>{x.value=!1,b.value=""},$e=B=>{B.key==="Escape"&&f.value&&de()},kt=B=>{const S=B.target;i.value?.contains(S)||m.value?.contains(S)||de()},bt=B=>{f.value&&c.value&&!c.value.contains(B.target)&&he()},Xe=()=>{f.value&&he()},wt=()=>{f.value&&he()};e.watch(()=>n.options,B=>{B?.length&&(V.value=[...B],we())},{immediate:!0});async function we(){if(o.value)Array.isArray(s.value)?C.value=[...s.value]:(C.value=s.value==null?[]:[s.value],s.value=[...C.value]),n.data&&C.value.length&&(await ae(C.value),await e.nextTick());else{if(Array.isArray(s.value)){const B=s.value[0]??null;s.value=B??null}s.value!=null&&(g.value=await I(s.value)),D(g.value??null)}}e.watch(s,()=>{we()}),e.onMounted(async()=>{addEventListener("keydown",$e),addEventListener("scroll",bt,!0),addEventListener("resize",Xe),document.addEventListener("click",kt,!0),d.value&&Je(d.value).addEventListener("scroll",wt,!0),n.options?.length&&!n.data?V.value=[...n.options]:n.data&&(V.value=await ee("")),await we(),_t.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",$e),removeEventListener("scroll",bt,!0),removeEventListener("resize",Xe),document.removeEventListener("click",kt,!0),d.value&&Je(d.value).removeEventListener("scroll",wt,!0)});const De=e.ref(!1),Ee=e.ref({}),Ve=e.ref([]),Ae=e.ref(null);async function Yt(){if(!n.add?.token||Ae?.value.validate())return;const S=n.add.api??`/api/table/${n.add.token}`,{id:A}=await fetch(S,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ee.value)}).then(K=>K.json());if(!n.options?.length&&n.data){const K=await fetch(`${n.api??`/api/suggest/${n.data}`}?val=${A}`).then(p=>p.json());g.value=K[0],V.value.push(K[0]),s.value=A}De.value=!1,ne.notify({title:"Success!",message:"Object created."})}async function Wt(){if(!n.add)return null;const B=await fetch(`/api/template/form/${n.add.form}`).then(S=>S.json());return Ve.value=B.schema,De.value=!0,null}function xt(B,S=200){let A;return(...K)=>{A&&clearTimeout(A),A=window.setTimeout(()=>B(...K),S)}}const Zt=xt(async B=>{V.value=await ee(B)},200);e.watch(b,B=>{n.data&&Zt(B.trim())}),e.watch(()=>n.options,B=>{!n.data&&B?.length&&(V.value=[...B],we())},{immediate:!0}),e.watch(()=>n.parent??n.parentValue,()=>{n.data&&me()});const _t=e.ref(!0);return e.watch(H,async()=>{if(n.data&&(_t.value||(o.value?(C.value=[],s.value=[],a("change",[])):(g.value=null,s.value=null,a("change",null))),await me(),n.auto===1&&H.value&&V.value.length>0)){const B=V.value[0];B&&Oe(B)}}),(B,S)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(ne.VsModal),{visible:De.value,"onUpdate:visible":S[1]||(S[1]=A=>De.value=A),class:"z-[1000]",title:"Додати",buttonText:"Додати",onDone:Yt,teleport:B.teleport},{default:e.withCtx(()=>[e.createVNode(_e,{schema:Ve.value,modelValue:Ee.value,"onUpdate:modelValue":S[0]||(S[0]=A=>Ee.value=A),ref_key:"addForm",ref:Ae},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:S[5]||(S[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass])},[S[10]||(S[10]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),S[11]||(S[11]=e.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",f.value||x.value?"border-blue-500 ring-1 ring-blue-500":"",r.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":f.value,"aria-haspopup":"listbox",onKeydown:gt,onClick:ft,"data-focus":f.value||x.value?"true":"false"},[e.createElementVNode("div",{class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full",ref_key:"triggerRef",ref:d},[o.value?(e.openBlock(),e.createElementBlock("div",Ko,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(L.value,A=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border max-w-full",key:A.id},[e.createElementVNode("div",Yo,[A?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:e.normalizeStyle({backgroundColor:A?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"truncate text-gray-900 overflow-hidden max-w-[200px] px-0.5 py-[2px] pl-1.5",title:N(A)},[M.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:E(A)},null,8,Zo)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(A.text),1)],64))],8,Wo)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b] flex-shrink-0",onClick:e.withModifiers(K=>Gt(A.id),["stop"])},S[6]||(S[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,Jo)]))),128)),e.createElementVNode("div",Xo,[!r.value&&B.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:h,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:C.value.length?" ":$.value,"onUpdate:modelValue":S[2]||(S[2]=A=>b.value=A),onFocus:yt,onBlur:Se,onKeydown:ze},null,40,Qo)),[[e.vModelText,b.value]]):e.createCommentVNode("",!0)])])):!o.value&&!x.value&&R.value&&b.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900"]),title:R.value},[g.value?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:e.normalizeStyle({backgroundColor:g.value?.color})},null,4)):e.createCommentVNode("",!0),M.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass({"pl-5":g.value?.color}),innerHTML:E(g.value)},null,10,tr)):(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass({"pl-5":g.value?.color})},e.toDisplayString(g.value?.text),3))],8,er)):e.createCommentVNode("",!0),o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",nr,[!r.value&&B.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:h,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:R.value?" ":$.value,"onUpdate:modelValue":S[3]||(S[3]=A=>b.value=A),onFocus:yt,onBlur:Se,onKeydown:ze},null,40,lr)),[[e.vModelText,b.value]]):e.createCommentVNode("",!0)]))],512),e.createElementVNode("div",ar,[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(qt,["stop"])},S[7]||(S[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,or)):e.createCommentVNode("",!0),S[9]||(S[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:S[4]||(S[4]=e.withModifiers(A=>Ht(),["stop"])),title:f.value?"Закрити список":"Відкрити список"},S[8]||(S[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,rr)])],42,Go),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[f.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:m,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(y.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:y.value.maxHeight||"300px"}),ref_key:"listRef",ref:c},[T.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(T.value,(A,K)=>(e.openBlock(),e.createElementBlock("div",{key:A.id,ref_for:!0,ref:p=>k.value[K]=p,class:e.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900 ",U(A.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",w.value===K&&!U(A.id)?"bg-blue-100":""]),"aria-disabled":U(A.id)?"true":"false",role:"option",tabindex:"-1",onClick:p=>Kt(A)},[A?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:e.normalizeStyle({backgroundColor:A?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",w.value===A.id?"text-white":"",(w.value===K,"")])},[M.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:E(A)},null,8,ir)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(A.text),1)],64))],2)],10,sr))),128)):(e.openBlock(),e.createElementBlock("div",dr," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),n.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:Wt,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(xe,{width:"16",height:"16"}),S[12]||(S[12]=e.createElementVNode("span",null,"Додати",-1))],8,cr)):e.createCommentVNode("",!0)],512)],64))}}),ur=["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:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=ce(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??"");function s(){typeof a.value=="string"&&(a.value=a.value.trim())}return(i,d)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":d[0]||(d[0]=c=>a.value=c),placeholder:r.value,disabled:o.value,row:"2",onBlur:s,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,42,ur)),[[e.vModelText,a.value]])}}),pr={},mr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};function hr(l,t){return e.openBlock(),e.createElementBlock("svg",mr,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"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 fr=G(pr,[["render",hr]]),gr={},yr={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function kr(l,t){return e.openBlock(),e.createElementBlock("svg",yr,t[0]||(t[0]=[e.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),e.createElementVNode("path",{d:"M7 20V4"},null,-1),e.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),e.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const br=G(gr,[["render",kr]]),wr={},xr={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _r(l,t){return e.openBlock(),e.createElementBlock("svg",xr,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 Er=G(wr,[["render",_r]]),Vr={},vr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Br(l,t){return e.openBlock(),e.createElementBlock("svg",vr,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Cr=G(Vr,[["render",Br]]),Nr={},Mr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Sr(l,t){return e.openBlock(),e.createElementBlock("svg",Mr,t[0]||(t[0]=[e.createStaticVNode('<circle cx="9" cy="12" r="1"></circle><circle cx="9" cy="5" r="1"></circle><circle cx="9" cy="19" r="1"></circle><circle cx="15" cy="12" r="1"></circle><circle cx="15" cy="5" r="1"></circle><circle cx="15" cy="19" r="1"></circle>',6)]))}const cn=G(Nr,[["render",Sr]]),$r={},Dr={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Ar(l,t){return e.openBlock(),e.createElementBlock("svg",Dr,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 Fr=G($r,[["render",Ar]]),Lr={},Tr={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 Ir(l,t){return e.openBlock(),e.createElementBlock("svg",Tr,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 Or=G(Lr,[["render",Ir]]),Rr={class:"vs-datatable border rounded-xl w-full flex-grow"},zr={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},jr={class:"relative w-full"},Pr={class:"table-wrapper flex gap-2"},Ur={class:"vs-popover inline-block text-slate-700"},Hr={class:"text-center"},qr={class:""},Gr={class:"py-1 px-0 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},Kr={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},Yr={class:"text-sm items-center text-gray-800 flex gap-1"},Wr={class:"w-full overflow-x-auto"},Zr={class:"w-full table-auto caption-bottom text-sm"},Jr={class:"[&_tr]:border-b"},Xr={class:"border-b data-[state=selected]:bg-muted bg-slate-50/50 dark:bg-slate-700/50 hover:bg-slate-50/80 dark:hover:bg-slate-700/80 transition-colors"},Qr={class:"h-10 px-2 align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] w-12 text-center"},es={key:0,colspan:"100%",class:"text-center"},ts={class:"w-full"},ns={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},ls=["onDragstart","onDragover","onDrop"],as={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},os={class:"flex items-center justify-center"},rs={key:0,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},ss={key:0},is=["src"],ds={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},cs=["innerHTML"],us={key:2,class:"line-clamp-2 rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},ps={key:3,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},ms={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},hs={class:"flex items-center justify-center gap-2"},fs=["onClick"],gs=["onClick"],ys={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},un=e.defineComponent({__name:"vs-input-datatable",props:e.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref({}),o=e.ref(""),r=e.computed(()=>{if(!o.value)return n.value??[];const M=o.value.toLowerCase();return n.value.filter(E=>t.colModel?.some(N=>{const D=E[N.key];return D?Array.isArray(D)?D.join(", ").toLowerCase().includes(M):String(D).toLowerCase().includes(M):!1}))}),s=e.ref(null),i=e.ref(null),d=e.ref(!1),c=e.ref(null),m=e.ref({top:0,left:0}),f=M=>{s.value=M},x=M=>{i.value=M},g=M=>{if(s.value===null||s.value===M){s.value=null,i.value=null;return}const E=[...n.value],[N]=E.splice(s.value,1);E.splice(M,0,N),n.value=E,s.value=null,i.value=null},V=M=>{const N=M.currentTarget.getBoundingClientRect();m.value={top:N.bottom+window.scrollY,left:N.left+window.scrollX},d.value=!d.value},w=()=>{c.value&&c.value.click()},k=M=>{const E=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],N=M.toLowerCase();return E.some(D=>N.endsWith(D))},b=M=>{const N=M.target.files?.[0];if(!N)return;const D=new FileReader;D.onload=H=>{try{const ee=H.target?.result;if(typeof ee=="string"){const me=JSON.parse(ee);Array.isArray(me)&&n.value.push(...me)}}catch(ee){console.error("Error parsing file:",ee)}},D.readAsText(N)},h=()=>{const M=JSON.stringify(n.value,null,2),E=new Blob([M],{type:"application/json"}),N=URL.createObjectURL(E),D=document.createElement("a");D.href=N,D.download="data.json",D.click(),URL.revokeObjectURL(N)};e.onMounted(async()=>{const M=t.colModel?.filter(E=>E.data);M?.length&&Promise.all(M.map(async E=>{const D=await(await fetch(`/api/suggest/${E.data}`)).json();a.value[E.key]=D.data}))});const v=e.ref(""),y=e.ref(!1);let C="edit",L=0;const $=e.ref({}),R=e.ref({});async function z(){v.value="Додати",y.value=!0,C="add",$.value={}}function U(M,E){const N=E.key||E.name;return a.value[N]&&M[N]?a.value[N].find(D=>D.id.toString()===M[N].toString())?.text??M[N]:M[N]||"-"}async function T(M,E){v.value="Редагувати",y.value=!0,C="edit",L=E,$.value={...M}}function J(){const M=R.value.validate();if(M){ne.notify({type:"warning",title:"Помилка валідації",message:Object.entries(M).map(([E,N])=>`${E}: ${N}`).join(`
2
+ `)});return}C==="add"?Array.isArray(n.value)?n.value=[...n.value,$.value]:n.value=[$.value]:n.value=n.value.map((E,N)=>N===L?$.value:E),y.value=!1}function Y(M){n.value=n.value.filter((E,N)=>N!==M)}function Q(){y.value=!1}return(M,E)=>(e.openBlock(),e.createElementBlock("div",Rr,[e.createElementVNode("div",zr,[e.createElementVNode("div",jr,[e.createVNode(fr,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":E[0]||(E[0]=N=>o.value=N),placeholder:"Пошук",class:"py-2 px-3 pl-10 w-full bg-gray-100 h-[36px] rounded-[8px] text-[15px] leading-[18px] focus:border-1 text-stone-800 placeholder:text-[#6B7280] focus:outline-blue-500 focus:outline-2"},null,512),[[e.vModelText,o.value]])]),e.createElementVNode("div",Pr,[e.createElementVNode("input",{ref_key:"fileInput",ref:c,onChange:b,class:"hidden",accept:".json",type:"file"},null,544),e.createElementVNode("div",Ur,[e.createElementVNode("div",Hr,[e.createElementVNode("div",qr,[e.createElementVNode("button",{onClick:V,class:"bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[e.createVNode(br,{height:"16",width:"16"})])])])])]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[d.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:e.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:m.value.top+"px",left:m.value.left+"px"}])},[e.createElementVNode("div",Gr,[e.createElementVNode("div",Kr,[e.createElementVNode("button",{onClick:w,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createVNode(Er,{class:"text-black",width:"14",height:"14"}),E[4]||(E[4]=e.createTextVNode(" Імпортувати ",-1))]),e.createElementVNode("button",{onClick:h,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createElementVNode("span",Yr,[e.createVNode(Cr,{class:"text-black",width:"14",height:"14"}),E[5]||(E[5]=e.createTextVNode(" Експортувати ",-1))])])])])],4)):e.createCommentVNode("",!0)])),e.createElementVNode("button",{onClick:z,class:"text-slate-700 bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[e.createVNode(xe),E[6]||(E[6]=e.createTextVNode(" Додати ",-1))])]),e.createElementVNode("div",Wr,[e.createElementVNode("table",Zr,[e.createElementVNode("thead",Jr,[e.createElementVNode("tr",Xr,[e.createElementVNode("th",Qr,[e.createVNode(cn,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.colModel,N=>(e.openBlock(),e.createElementBlock("th",{key:N.key,class:"h-10 px-2 text-left align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 min-w-[150px]"},e.toDisplayString(N.ua||N.label),1))),128)),E[7]||(E[7]=e.createElementVNode("th",{class:"h-10 px-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 text-center"}," Дії ",-1))])]),e.createElementVNode("tbody",{class:e.normalizeClass({"[&_tr:last-child]:border-0":!i.value})},[r.value.length===0?(e.openBlock(),e.createElementBlock("td",es,[e.createElementVNode("div",ts,[e.createElementVNode("div",ns,[e.createVNode(Fr,{class:"w-48 mx-auto"}),E[8]||(E[8]=e.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[e.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),e.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(N,D)=>(e.openBlock(),e.createElementBlock("tr",{key:N.id,class:e.normalizeClass(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move",{"opacity-50":s.value===D,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":i.value===D}]),draggable:"true",onDragstart:H=>f(D),onDragover:e.withModifiers(H=>x(D),["prevent"]),onDrop:H=>g(D)},[e.createElementVNode("td",as,[e.createElementVNode("div",os,[e.createVNode(cn,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.colModel,H=>(e.openBlock(),e.createElementBlock("td",{key:H.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[H.type==="file"?(e.openBlock(),e.createElementBlock("div",rs,[k(U(N,H))?(e.openBlock(),e.createElementBlock("div",ss,[e.createElementVNode("img",{src:U(N,H),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,is)])):(e.openBlock(),e.createElementBlock("div",ds,[e.createVNode(tn,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):H.type==="tiptap-editor"?(e.openBlock(),e.createElementBlock("div",{key:1,class:"rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors line-clamp-3",innerHTML:U(N,H)},null,8,cs)):H.type==="reference"?(e.openBlock(),e.createElementBlock("div",us,e.toDisplayString(U(N,H)),1)):(e.openBlock(),e.createElementBlock("div",ps,e.toDisplayString(U(N,H)),1))]))),128)),e.createElementVNode("td",ms,[e.createElementVNode("div",hs,[e.createElementVNode("button",{onClick:H=>T(N,D),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-blue-50 dark:hover:bg-slate-600 hover:border-blue-300 dark:hover:border-slate-500 hover:text-blue-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[e.createVNode(Or,{width:"24",height:"24",class:"w-3 h-3"})],8,fs),e.createElementVNode("button",{onClick:H=>Y(D),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-red-50 dark:hover:bg-slate-600 hover:border-red-300 dark:hover:border-slate-500 hover:text-red-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[e.createVNode(Le,{width:"24",height:"24",class:"w-3 h-3"})],8,gs)])])],42,ls))),128))],2)])]),e.createVNode(e.unref(ne.VsModal),{visible:y.value,title:v.value,size:"lg",onClose:Q},{default:e.withCtx(()=>[e.createVNode(_e,{schema:t.colModel,values:$.value,"onUpdate:values":E[1]||(E[1]=N=>$.value=N),form:R.value,"onUpdate:form":E[2]||(E[2]=N=>R.value=N)},null,8,["schema","values","form"]),e.createElementVNode("div",ys,[e.createElementVNode("button",{type:"button",onClick:E[3]||(E[3]=N=>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:J,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"])]))}}),ks={draw:{toolbar:{actions:{title:"Скасувати малювання",text:"Скасувати"},finish:{title:"Завершити малювання",text:"Завершити"},undo:{title:"Видалити останню точку",text:"Видалити останню"},buttons:{polyline:"Намалювати лінію",polygon:"Намалювати полігон",rectangle:"Намалювати прямокутник",circle:"Намалювати коло",marker:"Додати точку",circlemarker:"Додати маркер-коло"}},handlers:{circle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати коло",end:"Відпустіть кнопку миші, щоб завершити"},radius:"Радіус"},circlemarker:{tooltip:{start:"Клацніть на карту, щоб додати маркер-коло"}},marker:{tooltip:{start:"Клацніть на карту, щоб додати точку"}},polygon:{tooltip:{start:"Клацніть, щоб почати малювати полігон",cont:"Клацайте, щоб продовжити малювати полігон",end:"Клацніть першу точку, щоб завершити полігон"}},polyline:{error:"<strong>Помилка:</strong> лінія не може перетинатися сама з собою",tooltip:{start:"Клацніть, щоб почати малювати лінію",cont:"Клацайте, щоб продовжити малювати лінію",end:"Клацніть останню точку, щоб завершити лінію"}},rectangle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати прямокутник",end:"Відпустіть кнопку миші, щоб завершити"}},simpleshape:{tooltip:{end:"Відпустіть кнопку миші, щоб завершити"}}}},edit:{toolbar:{actions:{save:{title:"Зберегти зміни",text:"Зберегти"},cancel:{title:"Скасувати редагування",text:"Скасувати"},clearAll:{title:"Очистити всі шари",text:"Очистити все"}},buttons:{edit:"Редагувати шари",editDisabled:"Немає шарів для редагування",remove:"Видалити шари",removeDisabled:"Немає шарів для видалення"}},handlers:{edit:{tooltip:{text:"Перетягніть маркери, щоб редагувати шари",subtext:"Натисніть 'Скасувати', щоб повернутися"}},remove:{tooltip:{text:"Клацніть на шари, щоб видалити їх"}}}}},bs={},ws={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 xs(l,t){return e.openBlock(),e.createElementBlock("svg",ws,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 _s=G(bs,[["render",xs]]),Es={},Vs={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 vs(l,t){return e.openBlock(),e.createElementBlock("svg",Vs,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"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 Bs=G(Es,[["render",vs]]),Cs={},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-polygon"};function Ms(l,t){return e.openBlock(),e.createElementBlock("svg",Ns,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 Ss=G(Cs,[["render",Ms]]),$s={},Ds={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function As(l,t){return e.openBlock(),e.createElementBlock("svg",Ds,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="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 Fs=G($s,[["render",As]]),Ls={},Ts={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 Is(l,t){return e.openBlock(),e.createElementBlock("svg",Ts,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 Os=G(Ls,[["render",Is]]),Rs={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},zs={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"},js=["onClick"],Ps={class:"relative flex-1 min-w-[140px]"},Us=["placeholder"],Hs="https://data.softpro.ua/api-user/gis-url-proxy",qs="https://geo.rv.ua/api-user/dzk.api",Gs=G(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 y=n.config?.tools?.filter(C=>o.includes(C));return y&&y.length?y:o}),s=e.computed(()=>n.config?.placeholder?.trim()||"Пошук…"),i=e.ref(r.value[0]??o[0]);e.watch(r,y=>{y.includes(i.value)||(i.value=y[0])});const d=e.ref(""),c=e.ref(!1),m=e.ref(null);e.watch(i,()=>{d.value="",c.value=!1});function f(y){i.value=y}function x(y){if(!c.value)return;const C=m.value;C&&!C.contains(y.target)&&(c.value=!1)}e.onMounted(()=>{window.addEventListener("click",x,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",x,!0)});function g(y){return y==="xy"?"Координати":y==="parcel"?"Кадастр":"Адреси"}function V(y){const C=y.replace(/[,]+/g," ").trim();if(!C)return null;const L=C.split(/\s+/).filter(Boolean);if(L.length<2)return null;const $=L.slice(0,2).map(Number);if(!$.every(Q=>Number.isFinite(Q)))return null;let[R,z]=$,U=R,T=z;const J=Q=>Math.abs(Q)<=90,Y=Q=>Math.abs(Q)<=180;if(!J(U)||!Y(T))if(J(T)&&Y(U))U=z,T=R;else return null;return{lat:U,lng:T}}function w(y){return(y?.items||[]).map((L,$)=>({id:String(L?.id??$),title:L?.title||L?.address?.label||"Знайдений обʼєкт",lat:Number(L?.position?.lat),lng:Number(L?.position?.lng)})).filter(L=>Number.isFinite(L.lat)&&Number.isFinite(L.lng))}function k(y){const C=y?.result||y?.data||y;if(!C)return[];const L=C.geom_centroid;if(!L||!Array.isArray(L.coordinates))return[];const[$,R]=L.coordinates;return!Number.isFinite(R)||!Number.isFinite($)?[]:[{id:"parcel",title:C.cadnum||C.cad_num||"Земельна ділянка",lat:R,lng:$}]}function b(y){const L=y.replace(/\s+/g,"").split(":");if(L.length!==4)return!1;const $=[10,2,3,4];return L.every((R,z)=>R.length===$[z]&&/^\d+$/.test(R))}function h(y){a("goToCoordinates",[y.lat,y.lng])}async function v(){const y=d.value.trim();if(y){if(i.value==="xy"){const C=V(y);if(!C){ne.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}h(C),d.value="";return}try{const C=new URL(i.value==="here"?Hs:qs);if(i.value==="here")C.searchParams.set("searchtext",y);else{if(!b(y)){ne.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}C.searchParams.set("cad_num",y)}const L=await fetch(C.toString());if(!L.ok)throw new Error(`HTTP ${L.status}`);const $=await L.json(),R=i.value==="here"?w($):k($);if(!R.length)ne.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const z=R[0];h(z),d.value=""}}catch(C){const L=C?.message||"Помилка пошуку";ne.notify({type:"error",title:"Пошук",message:L})}}}return(y,C)=>(e.openBlock(),e.createElementBlock("div",Rs,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(v,["prevent"])},[r.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:m,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:C[0]||(C[0]=L=>c.value=!c.value)},[e.createElementVNode("span",null,e.toDisplayString(g(i.value)),1),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":c.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},C[2]||(C[2]=[e.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2))]),c.value?(e.openBlock(),e.createElementBlock("div",zs,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,L=>(e.openBlock(),e.createElementBlock("li",{key:L,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:$=>f(L)},e.toDisplayString(g(L)),9,js))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",Ps,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":C[1]||(C[1]=L=>d.value=L),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,Us),[[e.vModelText,d.value,void 0,{trim:!0}]]),C[3]||(C[3]=e.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),[["__scopeId","data-v-3048520a"]]),Ks={class:"bg-white/30 p-1 rounded-md shadow w-fit"},Ys={class:"flex gap-2"},Ws=["onClick","title"],Zs=["src"],Js=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(l,{emit:t}){const n=l,a=e.ref(Object.keys(n.basemaps)[0]),o=t;function r(s){o("onLayerChange",s),a.value=s}return(s,i)=>(e.openBlock(),e.createElementBlock("div",Ks,[e.createElementVNode("div",Ys,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.basemaps,(d,c)=>(e.openBlock(),e.createElementBlock("div",{key:c,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":a.value===c}]),onClick:m=>r(c),title:d.name||c,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:d.preview,alt:"",class:"w-10 h-10 object-cover"},null,8,Zs)],10,Ws))),128))])]))}});function je(l){return l?l.type==="Polygon"?{type:"MultiPolygon",coordinates:[l.coordinates]}:l.type==="Feature"?{...l,geometry:je(l.geometry)}:l.type==="FeatureCollection"?{...l,features:(l.features||[]).map(t=>je(t)).filter(Boolean)}:l:null}function Xs(l){return l?l.type==="FeatureCollection"||l.type==="Feature"?je(l):l.geom?{type:"Feature",geometry:je({type:l.geom.type,coordinates:l.geom.coordinates}),properties:{}}:l.type&&l.coordinates?{type:"Feature",geometry:je(l),properties:{}}:null:null}const Qs={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},ei={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},ti={class:"text-sm font-medium"},ni={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},li={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},ai={class:"flex items-center gap-1"},oi=["disabled"],ri=["disabled"],si=["disabled"],ii={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"},di={class:"space-y-0.5"},ci={class:"text-gray-500"},ui={class:"text-gray-900 text-right break-all"},pi={class:"absolute top-4 right-4 z-[1000]"},mi={class:"flex flex-col gap-[2px]"},hi=["disabled"],fi=["disabled"],gi=["disabled"],yi=["disabled"],ki={class:"flex flex-col gap-2"},bi={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]"},wi={class:"flex flex-col gap-1"},xi=["checked","disabled","onChange"],_i={class:"text-gray-700 text-xs font-medium"},Ei={class:"absolute bottom-0 left-0 right-0 z-[1000] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},Vi={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},vi={class:"shrink-0"},Bi={class:"font-bold"},Ci={class:"flex items-center"},Ni={class:"text-xs mr-2"},Mi={key:0,class:"text-xs"},Si={key:1,class:"text-xs"},$i=["disabled"],Di=["disabled"],nt="vs-base-tile-pane",lt="vs-overlay-tile-pane",pn=G(e.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},ctrlZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},katottg:{default:""},layers:{default:()=>[]},bounds:{},api:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(l,{emit:t}){const a=e.getCurrentInstance()?.appContext?.config?.globalProperties?.$settings??{},o=Array.isArray(a.center)&&a.center.length===2?a.center:[50,30],r=typeof a.zoom=="number"?a.zoom:typeof a.defaultZoom=="number"?a.defaultZoom:10,s=l,i=t,d=e.computed(()=>!!s.disabled),c=e.ref(!1),m=e.ref(null),f=e.ref(!1),x=e.ref(""),g=e.ref(null),V=e.ref(null),w=e.ref(!1),k=e.ref(null),b=e.ref(null),h=e.ref(0),v=e.ref(o),y=e.ref(r),C=e.ref([]),L=e.ref(s.modelValue);let $=!1;const R=e.ref(null),z=e.computed(()=>{const p={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!s.tools?.length)return p;const u=new Set(s.tools.map(_=>_.toLowerCase()));return{search:u.has("search"),import:u.has("import"),export:u.has("export"),point:u.has("point"),line:u.has("line"),polygon:u.has("polygon"),rectangle:u.has("rectangle")}}),U=e.reactive({}),T=e.ref([]),J=e.computed(()=>T.value.map(p=>U[p]).filter(Boolean)),Y=e.ref(null),Q=e.computed(()=>Y.value?.entries??[]),M=e.computed(()=>{if(!Y.value)return;const p=12,u=Y.value.point.x+p,_=Y.value.point.y+p;return{left:`${u}px`,top:`${_}px`}});function E(p){if(typeof p!="string"||!p.trim())return"";if(/^https?:\/\//i.test(p))return p;const u=window?.location?.origin??"",_=p.replace(/^\/+/,"");return _?u?`${u}/${_}`:`/${_}`:u}function N(){if(Array.isArray(a.basemaps)&&a.basemaps.length){const u=a.basemaps.map((_,F)=>{const O=String(_?.key??_?.id??_?.name??`b${F}`),j=E(String(_?.url??""));if(!j)return null;const q=typeof _?.preview=="string"&&_.preview?E(_.preview):"";return[O,{..._,url:j,preview:q}]}).filter(_=>Array.isArray(_)&&_.length===2).reduce((_,[F,O])=>(_[F]=O,_),{});if(Object.keys(u).length)return u}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 D=N(),H=Object.keys(D),ee=e.ref(H.length?H[0]:"");let me,I,ae,ge,de=null;async function Ht(){const p=F=>{if(!Array.from(document.styleSheets).some(O=>O?.href?.includes(F))){const O=document.createElement("link");O.rel="stylesheet",O.href=F,document.head.appendChild(O)}},u=F=>new Promise((O,j)=>{if(Array.from(document.scripts).some(le=>le.src===F))return O();const te=document.createElement("script");te.src=F,te.async=!0,te.onload=()=>O(),te.onerror=le=>j(le),document.body.appendChild(te)});p("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),p("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css");try{await u("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js")}catch{}try{await u("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js")}catch{}try{await u("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js")}catch{}return window.L}function ft(){const p=navigator.platform.toUpperCase().includes("MAC");return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Використовуйте два пальці для зуму карти.":p?"Використовуйте Ctrl або ⌘ + прокрутка для зуму карти.":"Використовуйте Ctrl + прокрутка для зуму карти."}function qt(){if(!s.handleZoom||!m.value||!I)return null;let p;const u=F=>{const O=F.ctrlKey||F.metaKey||F.shiftKey;if(!s.ctrlZoom){f.value=!1,I.scrollWheelZoom.enable();return}if(!O){f.value=!0,x.value=ft(),clearTimeout(p),p=window.setTimeout(()=>f.value=!1,1200);return}F.preventDefault(),F.stopPropagation(),f.value=!1,I.scrollWheelZoom.enable(),setTimeout(()=>I.scrollWheelZoom.disable(),120)},_=F=>{if(F.touches.length===1){if(!s.ctrlZoom)return;f.value=!0,x.value=ft(),clearTimeout(p),p=window.setTimeout(()=>f.value=!1,3e3)}else f.value=!1};return m.value.addEventListener("wheel",u,{passive:!1}),m.value.addEventListener("touchstart",_,{passive:!0}),I.on("wheel",F=>{if(!s.ctrlZoom)return;F.originalEvent?.ctrlKey||F.originalEvent?.metaKey||F.originalEvent?.shiftKey||(F.originalEvent?.preventDefault?.(),F.originalEvent?.stopPropagation?.())}),()=>{m.value?.removeEventListener("wheel",u),m.value?.removeEventListener("touchstart",_),clearTimeout(p)}}function Gt(p,u){return p?.id?String(p.id):p?.url?`${p.url}-${u}`:`layer-${u}`}function Me(p){const u=(p?.url??"").trim();if(!u)return"";if(/^https?:\/\//i.test(u))return u;const _=window.location?.origin??"",F=u.replace(/^\/+/,"");return`${_}/${F}`}function Oe(p){const u=p?.style??{};return _=>{const F=u.colorAttr,O=u.colorSet??{},j=typeof F=="string"?O?.[_?.[F]]??u.color??"#3388ff":u.color??"#3388ff",q=u.stroke??j;return{weight:u.width??1,color:q,opacity:u.opacity??1,fill:u.type?u.type!=="polyline":!0,fillColor:j,fillOpacity:u.opacity??.5}}}function Kt(p){return p?.layer?.properties||p?.layer?.feature?.properties||p?.properties||{}}function Re(p,u={}){return p.popup===!1?[]:Array.isArray(p.popup)&&p.popup.length?p.popup.map(_=>{if(!_?.field)return null;const F=u[_.field];return F==null||F===""?null:{key:_.label||_.field,value:String(F)}}).filter(_=>!!_):Object.entries(u).filter(([_])=>typeof _=="string"&&_).slice(0,5).map(([_,F])=>({key:_,value:F==null?"—":String(F)}))}function Je(p,u){if(!I||!u?.latlng)return;const _=I.latLngToContainerPoint(u.latlng),F=Kt(u),O=Re(p,F);if(!O.length){he(p.id);return}Y.value={layerId:p.id,title:F?.name||p.title||p.name,properties:F,entries:O,point:{x:_.x,y:_.y}}}function he(p){p&&Y.value?.layerId!==p||(Y.value=null)}function gt(p){const u=(p?.service??"").toLowerCase(),_=Me(p),F=p.sourceLayer||p.layer||p.service_layer||p.service_key||p.map_key||p.dataset?.layer||p.id||p.table_name;if(u==="vtile"){const O=R.value;if(O?.vectorGrid?.protobuf&&!O?.maplibreGL){const j=O.vectorGrid.protobuf(_,{interactive:!0,maxNativeZoom:p.maxzoom??19,vectorTileLayerStyles:{[F??"default"]:Oe(p),default:Oe(p)}});return j?.on?.("mouseover",q=>Je(p,q)),j?.on?.("mousemove",q=>Je(p,q)),j?.on?.("mouseout",()=>he(p.id)),j}if(O?.maplibreGL&&window?.maplibregl){const j=_;return j?O.maplibreGL({style:j,interactive:!1,pane:"overlayPane"}):null}return null}return u==="tile"||/^https?:\/\//i.test(_)||_.includes("{z}")?R.value.tileLayer(_,{opacity:p?.style?.opacity??1,pane:lt}):R.value.tileLayer(_,{opacity:p?.style?.opacity??1,pane:lt})}function ze(p){const u=R.value;if(!u)return null;const _=("bounds"in p?p.bounds:void 0)??s.bounds??C.value;if(!Array.isArray(_)||!_.length)return null;const O={color:p.style?.stroke??p.style?.color??"#2563eb",weight:p.style?.width??2,interactive:!1,opacity:p.style?.opacity??.8,dashArray:"4 4"},j=Array.isArray(p.bounds)&&p.bounds.length?p.bounds:_,q=yt(j);if(!q.length||!u?.polyline)return null;const te=q.map(le=>{if(!le.length)return le;const oe=le[0],ve=le[le.length-1];return oe&&ve&&typeof ve.equals=="function"&&!ve.equals(oe)?[...le,oe]:le});return u.polyline(te,O)}function yt(p){const u=R.value;if(!u||!Array.isArray(p))return[];const _=O=>{if(!Array.isArray(O)||O.length<2)return null;const[j,q]=O;return!Number.isFinite(Number(q))||!Number.isFinite(Number(j))?null:u.latLng(Number(q),Number(j))},F=O=>Array.isArray(O)&&O.length>=2&&O.every(j=>Number.isFinite(Number(j)));if(p.length&&F(p[0])){const O=p.map(_).filter(Boolean);return O.length?[O]:[]}return p.length&&Array.isArray(p[0])&&Array.isArray(p[0][0])&&F(p[0][0][0])?p.flatMap(j=>Array.isArray(j)?j:[]).map(j=>Array.isArray(j)?j.map(_).filter(Boolean):[]).filter(j=>j.length):p.length&&Array.isArray(p[0])&&F(p[0][0])?p.map(j=>Array.isArray(j)?j.map(_).filter(Boolean):[]).filter(j=>j.length):[]}function Se(){if(!I||!R.value)return;de&&I.hasLayer(de)&&(I.removeLayer(de),de=null);const p=ze({id:"global-bounds",bounds:s.bounds??C.value,style:{}});p&&(de=p,de.addTo(I))}function $e(){!I||!R.value||T.value.forEach(p=>{const u=U[p];u&&(u.visible?(u.layer||(u.layer=gt(u.config)),u.boundsLayer||(u.boundsLayer=ze(u.config)),u.layer&&!I.hasLayer(u.layer)&&u.layer.addTo(I),u.boundsLayer&&!I.hasLayer(u.boundsLayer)&&u.boundsLayer.addTo(I)):(u.layer&&I.hasLayer(u.layer)&&I.removeLayer(u.layer),u.boundsLayer&&I.hasLayer(u.boundsLayer)&&I.removeLayer(u.boundsLayer),he(u.id)))})}function kt(p){if(d.value)return;const u=U[p];u&&(u.visible=!u.visible,u.visible?(u.layer||(u.layer=gt(u.config)),u.boundsLayer||(u.boundsLayer=ze(u.config)),u.layer&&!I.hasLayer(u.layer)&&u.layer.addTo(I),u.boundsLayer&&!I.hasLayer(u.boundsLayer)&&u.boundsLayer.addTo(I)):(u.layer&&I.hasLayer(u.layer)&&I.removeLayer(u.layer),u.boundsLayer&&I.hasLayer(u.boundsLayer)&&I.removeLayer(u.boundsLayer),he(u.id)))}e.watch(()=>s.layers,p=>{const u=Array.isArray(p)?p:[],_=[],F=new Set;u.forEach((O,j)=>{if(!O)return;const q=Gt(O,j);_.push(q),F.add(q);const te=U[q],le={...O,id:q},oe=te?.visible??le?.overlay!==!1;te&&(te.layer&&I?.hasLayer(te.layer)&&I.removeLayer(te.layer),te.boundsLayer&&I?.hasLayer(te.boundsLayer)&&I.removeLayer(te.boundsLayer),he(q)),U[q]={id:q,config:le,visible:oe,layer:null,boundsLayer:null}}),Object.keys(U).forEach(O=>{if(!F.has(O)){const j=U[O];j?.layer&&I?.hasLayer(j.layer)&&I.removeLayer(j.layer),j?.boundsLayer&&I?.hasLayer(j.boundsLayer)&&I.removeLayer(j.boundsLayer),he(O),delete U[O]}}),T.value=_,$e()},{immediate:!0,deep:!0}),e.watch(()=>s.bounds,()=>{I&&(Object.values(U).forEach(p=>{p.boundsLayer&&I.hasLayer(p.boundsLayer)&&I.removeLayer(p.boundsLayer),p.boundsLayer=null}),Se(),$e())},{deep:!0}),e.watch(()=>s.katottg,async p=>{if(C.value=[],!p){Se();return}try{const u=await fetch(`https://data.gki.com.ua/api-user/atu/${p}`);if(!u?.ok)return;const F=(await u.json())?.geometry?.coordinates;Array.isArray(F)&&F.length&&(C.value=F)}catch(u){console.error("Failed to fetch KATOTTG bounds",u)}finally{Se(),$e()}},{immediate:!0}),e.watch(()=>s.modelValue,p=>{if(!I||!ae){L.value=p;return}De(p)},{deep:!0});function bt(p){const u=R.value;return p instanceof u.Circle?"Circle":p instanceof u.Rectangle?"Rectangle":p instanceof u.Polygon&&!(p instanceof u.Rectangle)?"Polygon":p instanceof u.Polyline&&!(p instanceof u.Polygon)?"Polyline":p instanceof u.Marker?"Point":"Feature"}function Xe(p){const u=R.value;if(p instanceof u.Circle){const _=p.getRadius();return Math.PI*(_*_)/1e6}if(p instanceof u.Polygon||p instanceof u.Rectangle)try{const _=p.getLatLngs();if(!Array.isArray(_)||!_.length)return null;if(!Array.isArray(_[0])){const q=u.GeometryUtil?.geodesicArea?u.GeometryUtil.geodesicArea(_):0;return q?Math.abs(q)/1e6:0}const F=_[0];if(F.length>0&&(F[0]instanceof u.LatLng||typeof F[0]?.lat=="number")){const{feature:q}=p;if(q?.geometry?.type==="MultiPolygon"){const oe=_.reduce((ve,Qe)=>{if(!Array.isArray(Qe)||!Qe.length)return ve;if(u.GeometryUtil?.geodesicArea){const et=u.GeometryUtil.geodesicArea(Qe);if(et)return ve+Math.abs(et)}return ve},0);return oe?oe/1e6:0}const le=u.GeometryUtil?.geodesicArea?u.GeometryUtil.geodesicArea(_):0;return le?Math.abs(le)/1e6:0}const j=_.reduce((q,te)=>{if(!Array.isArray(te)||!te.length)return q;const le=Array.isArray(te[0])?te[0]:te;if(u.GeometryUtil?.geodesicArea){const oe=u.GeometryUtil.geodesicArea(le);if(oe)return q+Math.abs(oe)}return q},0);return j?j/1e6:0}catch{return null}return null}function wt(p){return p instanceof R.value.Circle?p.getLatLng():p.getBounds?p.getBounds().getCenter():p.getLatLng?p.getLatLng():I.getCenter()}function we(p){const u=ae.toGeoJSON(),_=[];let F=null;const O=q=>{if(q)switch(q.type){case"Point":F=q;break;case"Polygon":_.push(q.coordinates);break;case"MultiPolygon":_.push(...q.coordinates);break;case"GeometryCollection":(q.geometries||[]).forEach(O);break}};(u?.features||[]).forEach(q=>O(q.geometry));const j=F||(_.length?{type:_.length===1?"Polygon":"MultiPolygon",coordinates:_.length===1?_[0]:_}:null);!p?.silent&&!$&&i("update:modelValue",j),h.value=ae.getLayers().length}function De(p){if(!ae||!R.value)return;ae.clearLayers();const u=Xs(p);if(!u){V.value=null,h.value=0;return}R.value.geoJSON(u).eachLayer(F=>ae.addLayer(F)),$=!0,we({silent:!0}),$=!1,Ee();const _=ae.getBounds?.();_?.isValid?.()&&I?.fitBounds(_,{padding:[24,24]})}function Ee(){const p=ae.getLayers();if(!p.length){V.value=null,h.value=0;return}const u=p[p.length-1],_=bt(u),F=wt(u),O=ae.toGeoJSON(),j=O?.features?.some(oe=>oe.geometry?.type==="MultiPolygon")||O?.geometry?.type==="MultiPolygon",q=p.length>1&&p.every(oe=>oe instanceof R.value.Polygon||oe instanceof R.value.Rectangle),te=j||q;let le=null;if(te){const oe=p.reduce((ve,Qe)=>{const et=Xe(Qe);return ve+(et?et*1e6:0)},0);le=oe?oe/1e6:0}else le=Xe(u);V.value={type:_,center:F,areaKm2:le,layer:u},h.value=p.length}const Ve=e.ref("");function Ae(p){if(d.value||!I||!R.value)return;ge?.disable&&ge.disable();const u=R.value;switch(p){case"marker":ge=new u.Draw.Marker(I);break;case"polyline":ge=new u.Draw.Polyline(I);break;case"polygon":ge=new u.Draw.Polygon(I);break;case"rectangle":ge=new u.Draw.Rectangle(I);break}ge.enable(),Ve.value=p}function Yt(){if(d.value)return;const p=V.value?.layer;p&&(p.getBounds?I.fitBounds(p.getBounds(),{padding:[30,30]}):p.getLatLng&&I.setView(p.getLatLng(),Math.max(y.value,14)))}function Wt(){d.value||ae&&(ae.clearLayers(),i("update:modelValue",null),V.value=null,h.value=0)}const xt=e.ref(null);function Zt(){d.value||xt.value?.click()}function _t(p){if(d.value)return;const u=p.target,_=u.files?.[0];if(!_)return;const F=new FileReader;F.onload=()=>{try{const O=JSON.parse(String(F.result));ae.clearLayers(),O&&R.value.geoJSON(O).eachLayer(j=>ae.addLayer(j)),we(),Ee()}finally{u.value=""}},F.readAsText(_)}function B(){if(d.value)return;const p=ae.toGeoJSON(),u=new Blob([JSON.stringify(p,null,2)],{type:"application/json"}),_=URL.createObjectURL(u),F=document.createElement("a");F.href=_,F.download="data.geojson",F.click(),URL.revokeObjectURL(_)}function S(p){!I||!R.value||!D[p]||(me&&I.removeLayer(me),me=R.value.tileLayer(D[p].url,{maxZoom:19,minZoom:6,pane:nt}).addTo(I),ee.value=p)}function A(p){if(!I||!R.value)return;const u=R.value.latLng(p[0],p[1]);I.setView(u,13)}let K=null;return e.onMounted(async()=>{R.value=await Ht();const p=R.value;p.drawLocal=ks,I=p.map(m.value,{zoomControl:!1,scrollWheelZoom:!1}).setView(v.value,y.value),p.control.zoom({position:"bottomright"}).addTo(I);const u=ee.value||Object.keys(D)[0];I.createPane(nt),I.getPane(nt).style.zIndex="180",I.createPane(lt),I.getPane(lt).style.zIndex="220",u&&D[u]&&(ee.value=u,me=p.tileLayer(D[u].url,{maxZoom:19,minZoom:6,pane:nt}).addTo(I)),ae=new p.FeatureGroup().addTo(I),I.on(p.Draw.Event.CREATED,F=>{if(d.value)return;const{layer:O}=F;ae.clearLayers(),ae.addLayer(O),we(),Ee(),Ve.value=""}),I.on(p.Draw.Event.EDITED,()=>{d.value||(we(),Ee())}),I.on(p.Draw.Event.DELETED,()=>{d.value||(we(),Ee())});let _=!1;I.on("mousemove",F=>{_||(I.invalidateSize(),_=!0)}),I.on("zoomend",()=>{y.value=I.getZoom()}),K=qt(),$e(),Se(),L.value!==void 0&&(De(L.value),L.value=void 0)}),e.onUnmounted(()=>{K?.(),he(),de&&I?.hasLayer(de)&&(I.removeLayer(de),de=null),I?.remove&&I.remove()}),e.watch(c,()=>{setTimeout(()=>{I?.invalidateSize&&I.invalidateSize()},50)}),e.watch(w,async p=>{if(!p||!b.value){k.value=null;return}await e.nextTick();const u=b.value.getBoundingClientRect();k.value={top:u.bottom+6,left:u.left}}),(p,u)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",disabled:!c.value},[e.createElementVNode("div",{class:e.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:c.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:m,class:"w-full h-full"},null,512),e.createVNode(e.Transition,{name:"zoom-instructions","enter-active-class":"transition-all duration-200 ease-out","leave-active-class":"transition-all duration-500 ease-in","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:e.withCtx(()=>[f.value&&s.handleZoom?(e.openBlock(),e.createElementBlock("div",Qs,[e.createElementVNode("div",ei,[e.createElementVNode("p",ti,e.toDisplayString(x.value),1)])])):e.createCommentVNode("",!0)]),_:1}),z.value.search||z.value.import||z.value.export?(e.openBlock(),e.createElementBlock("div",ni,[z.value.search?(e.openBlock(),e.createBlock(Gs,{key:0,onGoToCoordinates:A})):e.createCommentVNode("",!0),z.value.import||z.value.export?(e.openBlock(),e.createElementBlock("div",li,[e.createElementVNode("div",ai,[z.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:Zt,disabled:d.value}," Import ",8,oi)):e.createCommentVNode("",!0),z.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:B,disabled:d.value||h.value===0}," Export ",8,ri)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:xt,type:"file",onChange:_t,accept:".json,.geojson",class:"hidden",disabled:d.value},null,40,si)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),Q.value.length?(e.openBlock(),e.createElementBlock("div",{key:1,class:"absolute z-[1500] pointer-events-none",style:e.normalizeStyle(M.value)},[e.createElementVNode("div",ii,[e.createElementVNode("dl",di,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Q.value,_=>(e.openBlock(),e.createElementBlock("div",{key:`${_.key}-${_.value}`,class:"flex justify-between gap-2"},[e.createElementVNode("dt",ci,e.toDisplayString(_.key),1),e.createElementVNode("dd",ui,e.toDisplayString(_.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",pi,[e.createElementVNode("div",mi,[z.value.point?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":Ve.value==="marker"}]),title:"Point",onClick:u[0]||(u[0]=_=>Ae("marker")),disabled:d.value},[e.createVNode(_s)],10,hi)):e.createCommentVNode("",!0),z.value.line?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":Ve.value==="polyline"}]),title:"Line",onClick:u[1]||(u[1]=_=>Ae("polyline")),disabled:d.value},[e.createVNode(Bs)],10,fi)):e.createCommentVNode("",!0),z.value.polygon?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":Ve.value==="polygon"}]),title:"Polygon",onClick:u[2]||(u[2]=_=>Ae("polygon")),disabled:d.value},[e.createVNode(Ss)],10,gi)):e.createCommentVNode("",!0),z.value.rectangle?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":Ve.value==="rectangle"}]),title:"Rectangle",onClick:u[3]||(u[3]=_=>Ae("rectangle")),disabled:d.value},[e.createVNode(Fs)],10,yi)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:u[4]||(u[4]=_=>c.value=!c.value),title:"Full Screen"},[e.createVNode(Os,{style:{width:"12px",height:"12px"}})])])]),e.createElementVNode("div",{class:e.normalizeClass(["absolute left-4 z-[1000]",V.value?"bottom-8":"bottom-4"])},[e.createElementVNode("div",ki,[e.createVNode(Js,{basemaps:e.unref(D),onOnLayerChange:S},null,8,["basemaps"]),J.value.length?(e.openBlock(),e.createElementBlock("div",bi,[u[9]||(u[9]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),e.createElementVNode("div",wi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(J.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:d.value,onChange:F=>kt(_.id)},null,40,xi),e.createElementVNode("span",_i,e.toDisplayString(_.config.title||_.config.name||_.id),1)]))),128))])])):e.createCommentVNode("",!0)])],2),e.createElementVNode("div",Ei,[V.value?(e.openBlock(),e.createElementBlock("div",Vi,[e.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:u[5]||(u[5]=_=>w.value=!0),onMouseleave:u[6]||(u[6]=_=>w.value=!1)},[e.createElementVNode("div",vi,[u[10]||(u[10]=e.createTextVNode(" Type: ",-1)),e.createElementVNode("span",Bi,e.toDisplayString(V.value.type),1)]),g.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"addressEl",ref:b,class:"text-gray-500 text-xs truncate cursor-help",style:{"max-width":"260px"}}," Address: "+e.toDisplayString(g.value),513)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[w.value&&g.value&&k.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed z-[99999] pointer-events-none bg-gray-800 text-white text-xs px-2 py-1 rounded shadow whitespace-nowrap",style:e.normalizeStyle({top:k.value.top+"px",left:k.value.left+"px"})},e.toDisplayString(g.value),5)):e.createCommentVNode("",!0)]))],32),e.createElementVNode("div",Ci,[e.createElementVNode("div",Ni,[u[11]||(u[11]=e.createTextVNode(" Center: ",-1)),e.createElementVNode("b",null,e.toDisplayString(V.value.center.lat.toFixed(5))+", "+e.toDisplayString(V.value.center.lng.toFixed(5)),1)]),V.value.areaKm2!==null?(e.openBlock(),e.createElementBlock("div",Mi,[u[12]||(u[12]=e.createTextVNode(" Area: ",-1)),e.createElementVNode("b",null,e.toDisplayString(V.value.areaKm2.toFixed(1))+" km²",1)])):(e.openBlock(),e.createElementBlock("div",Si,u[13]||(u[13]=[e.createTextVNode("Area: ",-1),e.createElementVNode("b",null,"—",-1)]))),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:u[7]||(u[7]=_=>Yt()),disabled:d.value},u[14]||(u[14]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"w-3 h-3"},[e.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),e.createElementVNode("path",{d:"M7 10l6 0"}),e.createElementVNode("path",{d:"M10 7l0 6"}),e.createElementVNode("path",{d:"M21 21l-6 -6"})],-1)]),8,$i),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:u[8]||(u[8]=_=>Wt()),disabled:d.value},[e.createVNode(Le,{class:"w-3 h-3"})],8,Di)])])):e.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-0b90fe35"]]),Ai=["data-focus"],Fi={class:"flex items-center"},Li={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},Ti=["onClick","aria-label"],Ii={key:0,class:"absolute text-gray-500 truncate pl-2"},Oi={class:"flex-1 min-w-[2px]"},Ri=["placeholder"],zi={class:"flex items-center shrink-0"},ji=["disabled"],mn=e.defineComponent({__name:"vs-input-tag",props:e.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=t;ce(n.style);const o=e.ref(null),r=e.ref(null),s=e.ref(null),i=e.ref(!1),d=e.ref(""),c=e.useModel(l,"modelValue"),m=e.computed(()=>n.placeholder||"Add tag…"),f=e.computed(()=>c.value?.length===0&&d.value===""),x=e.computed(()=>!n.disabled&&c.value?.length>0),g=e.computed(()=>n.disabled),V=async()=>{g.value||await e.nextTick(()=>s.value?.focus())},w=L=>{const $=L.trim();$!==""&&(!c.value||!Array.isArray(c.value)?c.value=[$]:n.unique?c.value.includes($)||(c.value=[...c.value,$]):c.value=[...c.value,$],d.value="")},k=()=>{const L=d.value;L.trim()!==""&&w(L),d.value=""},b=L=>{const $=c.value.slice();$.splice(L,1),a("update:modelValue",$)},h=()=>{a("update:modelValue",[])},v=()=>{g.value||(i.value=!0)},y=()=>{i.value=!1,!g.value&&k()},C=L=>{const{key:$}=L;$==="Enter"?(L.preventDefault(),k()):$==="Backspace"&&d.value===""&&c.value.length>0&&b(c.value.length-1)};return(L,$)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:$[1]||($[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":"",g.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(c.value,(R,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",Fi,[e.createElementVNode("div",Li,e.toDisplayString(R),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(U=>b(z),["stop"]),"aria-label":`Remove ${R}`},$[2]||($[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,Ti)]))),128)),f.value?(e.openBlock(),e.createElementBlock("div",Ii,e.toDisplayString(m.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Oi,[g.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":$[0]||($[0]=R=>d.value=R),onFocus:v,onBlur:y,onKeydown:C,placeholder:c.value&&c.value.length?"":void 0},null,40,Ri)),[[e.vModelText,d.value]])])],512),e.createElementVNode("div",zi,[x.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:g.value,onClick:e.withModifiers(h,["stop"])},$[3]||($[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,ji)):e.createCommentVNode("",!0)])],10,Ai)],2)],512))}}),Pi={class:"relative flex gap-1 bg-white w-full"},Ui=["disabled","placeholder"],hn=G(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=e.inject("values"),n=l,a=e.useModel(l,"modelValue");function o(s){const i={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ы:"y",э:"e",ю:"yu",я:"ya",ь:"",ъ:"",є:"ye",і:"i",ї:"yi",ґ:"g"};return s.toLowerCase().split("").map(d=>i[d]||d).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const r=()=>{const s=t?.value?.[n.parent||""]?.toString(),i=o(s);a.value=i.toString()};return(s,i)=>(e.openBlock(),e.createElementBlock("div",Pi,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:s.disabled,placeholder:s.placeholder,"onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,Ui),[[e.vModelText,a.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:r}," Gen ")]))}}),[["__scopeId","data-v-b0eba370"]]),Hi={class:"relative flex gap-1 bg-white w-full"},qi=["disabled","placeholder"],Gi=["disabled"],Ki={key:0},Yi={key:1},fn=G(e.defineComponent({__name:"vs-input-codegen",props:e.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref(!1),o=e.computed(()=>t.init!==!1),r=e.computed(()=>!!t.table&&!!t.code),s=()=>{if(!r.value)return"";const c=encodeURIComponent(String(t.table)),m=encodeURIComponent(String(t.code));return`/api/code-gen/${c}/${m}`},i=async()=>{if(!r.value||a.value)return;const c=s();if(c){a.value=!0;try{const f=await(await fetch(c)).text();n.value=f}finally{a.value=!1}}},d=()=>{o.value&&(n.value||i())};return e.onMounted(()=>{d()}),e.watch(()=>[t.table,t.code,t.init],()=>{d()}),(c,m)=>(e.openBlock(),e.createElementBlock("div",Hi,[e.withDirectives(e.createElementVNode("input",{disabled:c.disabled,placeholder:c.placeholder,"onUpdate:modelValue":m[0]||(m[0]=f=>n.value=f),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,qi),[[e.vModelText,n.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:a.value||c.disabled||!r.value,onClick:i},[a.value?(e.openBlock(),e.createElementBlock("span",Yi,"...")):(e.openBlock(),e.createElementBlock("span",Ki,"Gen"))],8,Gi)]))}}),[["__scopeId","data-v-6ee5237d"]]),Wi={class:"w-full"},Zi={ref:"sortableContainer",class:"flex flex-col gap-1"},Ji=["onDragstart","onDrop"],Xi={class:"w-1/3"},Qi={class:"w-2/3"},ed=["onClick"],td={key:0,class:"text-[14px] text-gray-700"},nd={class:"mt-2 w-full flex items-center"},ld=["disabled"],gn=G(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=k=>`${k}-${Math.random().toString(36).substring(2,15)}`,a=e.inject("values"),o=l,r=t,s=o.addButtonText??"Додати",i=o.ignore??[],d=e.ref([]),c=e.ref(null);(()=>{const k=o.parent&&a?.value?.[o.parent]||o.modelValue||{};d.value=Object.entries(k).filter(([b])=>!i.includes(b)).map(([b,h])=>({id:n("key-value-"),key:b,value:h}))})();function f(k){c.value=k}function x(k){if(c.value===null||c.value===k)return;const b=d.value.splice(c.value,1)[0];d.value.splice(k,0,b),c.value=null}const g=e.computed(()=>d.value.some(k=>k.key&&!k.value||!k.key&&k.value)),V=()=>{d.value.push({id:n("key-value-"),key:"",value:""})},w=k=>{d.value=d.value.filter(b=>b.id!==k)};return e.watch(d,k=>{const b={};k.forEach(v=>{v.key&&v.value!==void 0&&(b[v.key]=v.value)});const h={};i.length&&i.forEach(v=>{h[v]=o.parent?a?.value?.[o.parent]?.[v]:void 0}),a?.value&&o.parent&&(a.value[o.parent]={...h,...b}),r("update:modelValue",b)},{deep:!0}),(k,b)=>(e.openBlock(),e.createElementBlock("div",Wi,[e.createElementVNode("div",Zi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(h,v)=>(e.openBlock(),e.createElementBlock("div",{key:h.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":c.value===v}]),draggable:"true",onDragstart:y=>f(v),onDragover:b[0]||(b[0]=e.withModifiers(()=>{},["prevent"])),onDrop:y=>x(v)},[b[1]||(b[1]=e.createStaticVNode('<button class="cursor-move" data-v-a0f7fbfc><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-a0f7fbfc><circle cx="15" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="18" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="18" r="1.5" data-v-a0f7fbfc></circle></svg></button>',1)),e.createElementVNode("div",Xi,[e.createVNode(Fe,{modelValue:h.key,"onUpdate:modelValue":y=>h.key=y,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Qi,[e.createVNode(Fe,{modelValue:h.value,"onUpdate:modelValue":y=>h.value=y,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:y=>w(h.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(Vt),{height:"16",width:"16"})],8,ed)],42,Ji))),128))],512),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",td," Дані для відображення відсутні ")),e.createElementVNode("div",nd,[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(xe,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(s)),1)],8,ld)])]))}}),[["__scopeId","data-v-a0f7fbfc"]]),ad={class:"w-full"},od={ref:"sortableContainer",class:"flex flex-col gap-1"},rd=["onDragstart","onDrop"],sd=["disabled"],id={class:"flex-1"},dd=["onClick","disabled"],cd={key:0,class:"text-[14px] text-gray-700"},ud={class:"mt-2 w-full flex items-center"},pd=["disabled"],Dt=G(e.defineComponent({__name:"vs-input-text-array",props:e.mergeModels({addButtonText:{default:"Додати"},inputType:{default:"text"},placeholder:{default:"Значення"},mask:{default:""},disabled:{type:Boolean,default:!1}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.ref(null),r=e.computed(()=>!!t.disabled),s=e.computed(()=>t.placeholder??""),i=e.computed(()=>t.addButtonText??"Додати");let d=!1;const c=k=>`${k}-${Math.random().toString(36).substring(2,15)}`,m=k=>{const b=k??n.value??[];a.value=b.map((h,v)=>({id:a.value[v]?.id??c("text-array"),value:h??""}))};m(),e.watch(()=>n.value,k=>{if(d){d=!1;return}m(k||[])},{deep:!0}),e.watch(a,k=>{d=!0,n.value=k.map(b=>b.value).filter(b=>b!=null&&b!=="")},{deep:!0});const f=e.computed(()=>r.value||a.value.some(k=>!k.value));function x(){f.value||(a.value=[...a.value,{id:c("text-array"),value:""}])}function g(k){r.value||(a.value=a.value.filter(b=>b.id!==k))}function V(k){r.value||(o.value=k)}function w(k){if(r.value||o.value===null||o.value===k)return;const b=[...a.value],[h]=b.splice(o.value,1);b.splice(k,0,h),a.value=b,o.value=null}return(k,b)=>(e.openBlock(),e.createElementBlock("div",ad,[e.createElementVNode("div",od,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(h,v)=>(e.openBlock(),e.createElementBlock("div",{key:h.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":o.value===v}]),draggable:"true",onDragstart:y=>V(v),onDragover:b[0]||(b[0]=e.withModifiers(()=>{},["prevent"])),onDrop:y=>w(v)},[e.createElementVNode("button",{class:"cursor-move",type:"button",disabled:r.value},b[1]||(b[1]=[e.createStaticVNode('<svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-66316a33><circle cx="15" cy="12" r="1.5" data-v-66316a33></circle><circle cx="15" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="12" r="1.5" data-v-66316a33></circle><circle cx="21" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="18" r="1.5" data-v-66316a33></circle><circle cx="15" cy="18" r="1.5" data-v-66316a33></circle></svg>',1)]),8,sd),e.createElementVNode("div",id,[k.inputType==="text"?(e.openBlock(),e.createBlock(Fe,{key:0,modelValue:h.value,"onUpdate:modelValue":y=>h.value=y,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),k.inputType==="tel"?(e.openBlock(),e.createBlock(Mt,{key:1,modelValue:h.value,"onUpdate:modelValue":y=>h.value=y,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),k.inputType==="email"?(e.openBlock(),e.createBlock(Nt,{key:2,modelValue:h.value,"onUpdate:modelValue":y=>h.value=y,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),k.inputType==="mask"?(e.openBlock(),e.createBlock(Ct,{key:3,modelValue:h.value,"onUpdate:modelValue":y=>h.value=y,mask:k.mask,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","mask","disabled","placeholder"])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:y=>g(h.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(Vt),{height:"16",width:"16"})],8,dd)],42,rd))),128))],512),a.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",cd," Дані для відображення відсутні ")),e.createElementVNode("div",ud,[e.createElementVNode("button",{type:"button",onClick:x,disabled:f.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(xe,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(i.value),1)],8,pd)])]))}}),[["__scopeId","data-v-66316a33"]]),md={class:"flex items-center gap-2 w-full"},hd=["disabled"],fd=["disabled"],yn=e.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,{inputClass:a}=ce(n.style),o=t,r=e.computed({get:()=>n.modelValue||"#000000",set:i=>o("update:modelValue",i)}),s=e.computed(()=>!!n.disabled);return(i,d)=>(e.openBlock(),e.createElementBlock("div",md,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[0]||(d[0]=c=>r.value=c),disabled:s.value,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[i.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,hd),[[e.vModelText,r.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":d[1]||(d[1]=c=>r.value=c),disabled:s.value},null,8,fd),[[e.vModelText,r.value]])]))}}),gd={class:"flex items-center gap-2 w-full"},yd=["min","max","step","disabled"],kd=["disabled"],kn=e.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,{inputClass:a}=ce(n.style),o=t,r=e.computed({get:()=>Number(n.modelValue??n.min),set:i=>o("update:modelValue",Number(i))}),s=e.computed(()=>!!n.disabled);return(i,d)=>(e.openBlock(),e.createElementBlock("div",gd,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":d[0]||(d[0]=c=>r.value=c),min:i.min,max:i.max,step:i.step,disabled:s.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[i.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")])},null,10,yd),[[e.vModelText,r.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":d[1]||(d[1]=c=>r.value=c),disabled:s.value},null,8,kd),[[e.vModelText,r.value]])]))}}),bd={class:"flex items-center gap-2 w-full"},wd={class:"relative flex-1"},xd=["placeholder","disabled","onKeydown"],_d=["disabled"],Ed={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"},Vd={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"},vd={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},Bd={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},Cd={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},Nd=["onClick"],Md={key:0,class:"p-4 text-sm text-gray-500"},bn=e.defineComponent({__name:"vs-input-address",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},api:{default:""},geom:{default:""},includes:{default:()=>[]}},{modelValue:{default:""},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=t,{inputClass:o}=ce(n.style),r=e.useModel(l,"modelValue"),s=e.computed({get:()=>r.value,set:b=>{r.value=b}}),i=e.ref(!1),d=e.ref([]),c=e.ref(!1),m=e.computed(()=>n.placeholder??""),f=e.computed(()=>!!n.disabled),x=e.inject("values");function g(){!f.value&&s.value.trim()&&V()}async function V(){const b=(s.value||"").trim();if(!b)return;let h=b;if(n.includes?.length&&x?.value){const y=n.includes.map(C=>x.value?.[C]).filter(Boolean);y.length&&(h=`${y.join(", ")}, ${b}`)}const v=n.api.replace("{{value}}",encodeURIComponent(h));i.value=!0;try{const C=await(await fetch(v)).json();d.value=Array.isArray(C)?C:[],c.value=!0}catch(y){console.error("Address search error:",y)}finally{i.value=!1}}function w(){c.value=!c.value}function k(b){if(!b)return;c.value=!1;const h=parseFloat(b.lat),y={type:"Point",coordinates:[parseFloat(b.lon),h]};n.geom&&x?.value&&(x.value[n.geom]=y),a("update:geom",y)}return(b,h)=>(e.openBlock(),e.createElementBlock("div",bd,[e.createElementVNode("div",wd,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":h[0]||(h[0]=v=>s.value=v),placeholder:m.value,disabled:f.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[e.unref(o),{"!border-red-600":n.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:e.withKeys(e.withModifiers(g,["prevent"]),["enter"])},null,42,xd),[[e.vModelText,s.value]]),d.value.length?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:w,title:"Show search results"},h[2]||(h[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:V,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:i.value||!s.value?.trim()},[i.value?(e.openBlock(),e.createElementBlock("svg",Vd,h[4]||(h[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",Ed,h[3]||(h[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,_d),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[c.value?(e.openBlock(),e.createElementBlock("div",vd,[e.createElementVNode("div",Bd,[e.createElementVNode("div",Cd,[h[6]||(h[6]=e.createElementVNode("span",null,"Search results",-1)),e.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:h[1]||(h[1]=v=>c.value=!1),title:"Close"},h[5]||(h[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,(v,y)=>(e.openBlock(),e.createElementBlock("li",{key:y,onClick:C=>k(v),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString(v.display_name),9,Nd))),128))]),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Md," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),wn=(l="")=>`${l}${Math.floor(Math.random()*1e4)}`,Sd={class:"vs-datalist space-y-3"},$d={class:"space-y-3"},Dd=["onClick","disabled"],Ad={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Fd=["disabled"],Ld=G(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:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.computed(()=>t.schema?.map(V=>({...V,disabled:t.disabled||V.disabled}))??[]),r=e.computed(()=>o.value.map(V=>g(V))),s=e.computed(()=>t.disabled?!1:t.maxItems?n.value.length<t.maxItems:!0),i=e.computed(()=>t.disabled||n.value.length<=(t.minItems||0));e.watch(()=>n.value.length,()=>{d(),c()},{immediate:!0}),e.watch(()=>t.schema,c,{immediate:!0,deep:!0});function d(){const V=n.value.length;a.value.length<V?a.value=[...a.value,...Array.from({length:V-a.value.length},()=>wn())]:a.value.length>V&&a.value.splice(V)}function c(){if(!t.minItems||n.value.length>=t.minItems)return;const V=t.minItems-n.value.length,w=Array.from({length:V},m);n.value=[...n.value,...w]}function m(){const V={};return o.value.forEach(w=>{V[w.name]=w?.default??null}),V}function f(){s.value&&(n.value=[...n.value,m()],d())}function x(V){i.value||(n.value=n.value.filter((w,k)=>k!==V),d(),c())}function g(V){return{...V}}return(V,w)=>(e.openBlock(),e.createElementBlock("div",Sd,[e.createElementVNode("div",$d,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(k,b)=>(e.openBlock(),e.createElementBlock("div",{key:a.value[b],class:"flex items-center gap-3"},[e.createVNode(_e,{schema:r.value,layout:"inline",navigation:!1,values:n.value[b],"onUpdate:values":h=>n.value[b]=h,"form-id":a.value[b]},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:h=>x(b),disabled:i.value},[e.createVNode(Le,{class:"w-5 h-5"})],8,Dd)]))),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",Ad,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:f,disabled:!s.value},[e.createVNode(xe,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Fd)]))}}),[["__scopeId","data-v-a7a64a30"]]),Td={};function Id(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 Od=G(Td,[["render",Id]]),Rd={class:"vs-dataform space-y-4"},zd={class:"flex items-center justify-between mb-3"},jd={class:"text-sm font-medium text-gray-700"},Pd={class:"flex items-center gap-2"},Ud=["title","onClick","disabled"],Hd=["title","onClick","disabled"],qd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Gd=["disabled"],xn={VsInputText:Fe,VsInputRadio:St,"vs-input-text":Fe,"vs-input-password":hl,"vs-input-textarea":dn,"vs-input-mask":Ct,"vs-input-number":Jt,"vs-input-radio":St,"vs-input-select":$t,"vs-input-switcher":vt,"vs-input-static":Bt,"vs-input-container":sn,"vs-input-date":da,"vs-input-checkbox":Xt,"vs-input-file":an,"vs-input-html":Bt,"vs-input-email":Nt,"vs-input-tel":Mt,"vs-input-datatable":un,"vs-input-map":pn,"vs-input-file-list":on,"vs-input-tags":mn,"vs-input-slug":hn,"vs-input-codegen":fn,"vs-input-key-value":gn,"vs-input-text[]":Dt,"vs-input-range":kn,"vs-input-color":yn,"vs-input-native-select":$t,"vs-input-array":Dt,"vs-input-address":bn,"vs-input-datalist":Ld,"vs-input-dataform":G(e.defineComponent({__name:"vs-input-dataform",props:e.mergeModels({schema:{default:()=>[]},minGroups:{default:0},maxGroups:{default:void 0},addButtonText:{default:"Додати групу фільтрів"},groupLabel:{default:"Якщо поле"},duplicateTitle:{default:"Дублювати групу"},removeTitle:{default:"Видалити групу"},emptyLabel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.computed(()=>t.groupLabel),r=e.computed(()=>t.emptyLabel??"Ще немає груп"),s=e.computed(()=>t.schema?.map(b=>({...b,disabled:t.disabled||b.disabled}))??[]),i=e.computed(()=>s.value.map(b=>k(b))),d=e.computed(()=>t.disabled?!1:t.maxGroups?n.value.length<t.maxGroups:!0),c=e.computed(()=>t.disabled||n.value.length<=(t.minGroups||0));e.watch(()=>n.value.length,()=>{m(),f()},{immediate:!0}),e.watch(()=>t.schema,f,{immediate:!0,deep:!0});function m(){const b=n.value.length;a.value.length<b?a.value=[...a.value,...Array.from({length:b-a.value.length},()=>wn())]:a.value.length>b&&a.value.splice(b)}function f(){if(!t.minGroups||n.value.length>=t.minGroups)return;const b=t.minGroups-n.value.length,h=Array.from({length:b},x);n.value=[...n.value,...h]}function x(){const b={};return s.value.forEach(h=>{b[h.name]=h?.default??null}),b}function g(){d.value&&(n.value=[...n.value,x()],m())}function V(b){c.value||(n.value=n.value.filter((h,v)=>v!==b),m(),f())}function w(b){if(t.disabled)return;const h=JSON.parse(JSON.stringify(n.value[b]??{}));n.value=[...n.value.slice(0,b+1),h,...n.value.slice(b+1)],m()}function k(b){return{...b}}return(b,h)=>(e.openBlock(),e.createElementBlock("div",Rd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(v,y)=>(e.openBlock(),e.createElementBlock("div",{key:a.value[y],class:"relative border border-gray-200 rounded-lg p-6 bg-white"},[e.createElementVNode("div",zd,[e.createElementVNode("div",jd,e.toDisplayString(o.value),1),e.createElementVNode("div",Pd,[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:C=>w(y),disabled:t.disabled},[e.createVNode(Od,{class:"w-5 h-5"})],8,Ud),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:C=>V(y),disabled:c.value},[e.createVNode(Le,{class:"w-5 h-5"})],8,Hd)])]),e.createVNode(_e,{class:"vs-dataform__form",schema:i.value,layout:"inline",navigation:!1,values:n.value[y],"onUpdate:values":C=>n.value[y]=C,"form-id":a.value[y],disabled:t.disabled},null,8,["schema","values","onUpdate:values","form-id","disabled"])]))),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",qd,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:g,disabled:!d.value},[e.createVNode(xe,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Gd)]))}}),[["__scopeId","data-v-4dc5a1a3"]])},Kd=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){ne.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const s=await r.json();if(!t.set||!n)return;for(const[i,d]of Object.entries(t.set))n.value[i]=s.result[d]}catch(o){console.error(t.error,o)}}return(o,r)=>(e.openBlock(),e.createElementBlock("button",{onClick:a,class:"vs-button relative inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-blue-500 hover:border-blue-500 hover:bg-blue-500 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 ml-0 md:ml-2 mt-2 md:mt-0 py-[8px] md:w-2/4 whitespace-nowrap w-full"},e.toDisplayString(o.button),1))}}),Yd={class:"flex flex-col gap-1 w-full"},Wd={key:0,class:"text-sm text-gray-500"},_n=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(()=>pl[`${n.layout}`]),s=e.computed(()=>xn?.[`vs-input-${n.item.type}`]),i=e.computed(()=>{const m=e.unref(s);if(!m)return new Set;const f=m.props??m.__vccOpts?.props;if(!f)return new Set;const x=Array.isArray(f)?f:Object.keys(f);return new Set(x)}),d=e.computed(()=>{const m=n.item??{},f=i.value;return f.size?Object.fromEntries(Object.entries(m).filter(([x])=>f.has(x))):{}}),c=m=>{const f=typeof m=="object"&&m!==null?m:{value:m};o("value-selected",{...f,name:f.name??n.item?.name})};return(m,f)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{ua:n.item.ua,error:n.error||"",item:m.item,columns:n.columns,label:n.item.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${n.item.type}-component`])},[e.createElementVNode("div",Yd,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value),e.mergeProps(d.value,{modelValue:a.value,"onUpdate:modelValue":f[0]||(f[0]=x=>a.value=x),onValueSelected:c}),null,16,["modelValue"])),m.item.description&&n.layout!=="settings"?(e.openBlock(),e.createElementBlock("p",Wd,e.toDisplayString(m.item.description),1)):e.createCommentVNode("",!0)]),m.item.behavior?.api&&m.item.behavior?.button?(e.openBlock(),e.createBlock(Kd,e.mergeProps({key:0},m.item.behavior,{value:a.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),Zd={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},Jd={class:"vs-compact-form-navigation__rail mt-[6px]"},Xd=["onClick"],Qd=G(e.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(l,{expose:t}){const n=l,a=e.ref([]),o=e.ref(""),r=e.ref(""),s=e.computed(()=>!!n.enabled),i=e.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),d=e.computed(()=>{const T=n.width;if(T==null)return{};const J=typeof T=="number"?`${T}px`:`${T}`;return{width:J,minWidth:J}});let c=null,m=0,f=0,x=null,g=null,V=null;const w=()=>z(),k=()=>h();e.watch(()=>n.target,async T=>{if(L(),!T){x=null,a.value=[],o.value="";return}x=T,s.value&&(await e.nextTick(),C(T),h())},{immediate:!0}),e.watch(()=>n.scrollContainer,T=>{if(!s.value){g=T??null;return}b(T??null),e.nextTick(()=>h())},{immediate:!0}),e.onMounted(()=>{n.scrollContainer||b(null),h()}),e.onBeforeUnmount(()=>{L(),b(null,!0),x=null,typeof window<"u"&&(m&&window.cancelAnimationFrame(m),f&&window.cancelAnimationFrame(f))});function b(T,J=!1){if(V&&(V(),V=null),J){g=null;return}if(g=T??null,typeof window>"u")return;const Y=T??window,Q=window;Y.addEventListener("scroll",w,{passive:!0}),Q.addEventListener("resize",k),V=()=>{Y.removeEventListener("scroll",w),Q.removeEventListener("resize",k)}}function h(){if(!s.value||!x)return;m&&typeof window<"u"&&window.cancelAnimationFrame(m);const T=()=>{v(),m=0};typeof window>"u"?T():m=window.requestAnimationFrame(T)}function v(){if(!s.value||!x)return;const T=Array.from(x.querySelectorAll("h1, h2")),J=new Set,Y=[];T.forEach((Q,M)=>{const E=Q.textContent?.trim()??"";if(!E)return;let N=(Q.getAttribute("id")??"").trim();N||(N=y(E)||`heading-${M+1}`);let D=N,H=1;for(;J.has(D);)D=`${N}-${H+=1}`;Q.id!==D&&Object.assign(Q,{id:D}),J.add(D),Y.push({id:D,text:E,level:Q.tagName.toLowerCase()==="h1"?1:2})}),a.value=Y,Y.length||(o.value=""),R()}function y(T){return T.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function C(T){!T||!s.value||typeof MutationObserver>"u"||(L(),c=new MutationObserver(()=>h()),c.observe(T,{childList:!0,subtree:!0}))}function L(){c&&(c.disconnect(),c=null)}function $(T){const J=g;if(!J)return typeof window>"u"?T.offsetTop:T.getBoundingClientRect().top+window.scrollY;const Y=T.getBoundingClientRect(),Q=J.getBoundingClientRect();return Y.top-Q.top+J.scrollTop}function R(){if(!s.value||!a.value.length)return;const T=g,J=(T?T.scrollTop:null)||(typeof window<"u"?window.scrollY:0),Y=(T?T.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),Q=J+Y;let M=null;for(let N=0;N<a.value.length;N+=1){const D=a.value[N],H=document.getElementById(D.id);if(H){const ee=$(H);ee+H.offsetHeight>J&&ee<Q&&(M=D.id)}}!M&&r.value&&(M=r.value),M&&(r.value=M);const E=T?T.scrollHeight-T.clientHeight:document.documentElement.scrollHeight-window.innerHeight;J+5>=E&&(M=a.value[a.value.length-1].id),M&&(o.value=M)}function z(){s.value&&(f&&window.cancelAnimationFrame(f),f=window.requestAnimationFrame(()=>{R(),f=0}))}function U(T){if(!s.value)return;const J=document.getElementById(T);if(!J)return;const Y=g,Q=Math.max(0,$(J));Y?Y.scrollTo({top:Q,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:Q,behavior:"smooth"})}return t({refresh:h}),(T,J)=>s.value&&a.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(d.value)},[e.createElementVNode("h2",Zd,e.toDisplayString(T.title),1),e.createElementVNode("div",Jd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,Y=>(e.openBlock(),e.createElementBlock("div",{key:Y.id,class:e.normalizeClass(["vs-compact-form-navigation__item relative",Y.level===2?"vs-compact-form-navigation__item--nested":"",Y.id===o.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick:Q=>U(Y.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",Y.level===2?"pl-[15px]":"pl-[18px]",Y.id===o.value?"text-gray-800":"text-gray-500"])},[e.createElementVNode("span",null,e.toDisplayString(Y.text),1)],10,Xd)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-1584a562"]]),Pe={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон"},ec=l=>typeof l=="string"?l.trim()?!1:Pe.required:Array.isArray(l)?l.map(n=>typeof n=="string"?n.trim():n).filter(n=>n!=null&&n!=="").length?!1:Pe.required:l?!1:Pe.required,tc=l=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return l?t.test(l)?!1:Pe.email:!1},nc=l=>{const t=/^\+[1-9]\d{1,14}$/;return l?t.test(l)?!1:Pe.tel:!1},lc=(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},ac=(l,t)=>!1,oc=(l,t)=>{switch(typeof t=="string"?t:t.type){case"required":return ec(l);case"email":return tc(l);case"tel":return nc(l);case"regexp":return lc(l,t);case"custom":return ac();default:return!1}},rc={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function En(l){const t=l?.toLowerCase();return rc[t]||t}function At(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=En(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=At(r.schema,r.disabled)),a.push(r)}),a}const n=[];return Object.entries(l).forEach(a=>{const o={name:a[0],...a[1],type:En(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=At(o.schema,o.disabled)),n.push(o)}),n}function sc(l,t,n=!1){const a=e.computed(()=>At((Array.isArray(t),t),typeof n=="boolean"?n:n.value)),o=e.ref({});function r(c){const m=c?.conditions;if(!m)return!0;const f=Array.isArray(m)?m[0]:m,x=l?.value?.[f];return rn(x,m)}const s=(c=a.value,m=!0)=>(c.forEach(f=>{if(f.rules){if(!r(f)){delete o.value[f.name];return}let x=!1,g=null;f.rules.forEach(V=>{const w=oc(l.value[f.name],V);w&&(x=!0,!g&&typeof w=="string"&&(g=w))}),x&&g?o.value[f.name]=g:delete o.value[f.name]}f.schema&&s(f.schema,!1)}),m&&Object.values(o.value).some(Boolean)?o.value:null),i=e.computed(()=>a.value?.filter(c=>c.hidden!==!0&&r(c)));return{errors:o,validate:s,reset:()=>{l.value={},o.value={}},visibleSchema:i}}const ic={class:"flex w-full h-full min-h-0 gap-6"},dc={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},_e=e.defineComponent({__name:"vs-compact-form",props:e.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:e.mergeModels(["handle-submit","update:modelValue","value-selected"],["update:form","update:values"]),setup(l,{expose:t,emit:n}){const a=n,o=l,r=e.useModel(l,"form"),s=e.useModel(l,"values"),{errors:i,validate:d,reset:c,visibleSchema:m}=sc(s,o.schema,e.toRef(o,"disabled")),f=e.ref(null),x=e.ref(null),g=e.computed(()=>o.navigation),V=e.computed(()=>o.navWidth),w=e.computed(()=>o.style?.columns),k=Object.freeze({container:12,label:3}),b=e.computed(()=>o.columns??w.value??k),h=e.computed(()=>o.columns!=null||w.value!=null),v=e.computed(()=>h.value?"horizontal":o.layout),y=z=>z?.columns?"horizontal":v.value,C=z=>z?.columns??b.value,L=()=>{a("update:modelValue",s.value),d(),a("handle-submit",s.value)},$=z=>{a("value-selected",z)};t({validate:d,reset:c,errors:i}),e.onMounted(()=>{o.modelValue&&(s.value=o.modelValue),r.value={value:s.value,errors:i.value,reset:c,validate:d,formId:o.formId}});function R(z,U){if(z===U)return!0;if(typeof z!="object"||typeof U!="object"||!z||!U)return!1;const T=Object.keys(z),J=Object.keys(U);return T.length!==J.length?!1:T.every(Y=>z[Y]===U[Y])}return e.provide("form",r),e.provide("values",s),(z,U)=>(e.openBlock(),e.createElementBlock("div",ic,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:x},[e.createElementVNode("form",{ref_key:"formRef",ref:f,onSubmit:e.withModifiers(L,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",v.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),(T,J)=>(e.openBlock(),e.createElementBlock("div",{key:T.name,class:e.normalizeClass(y(T)==="horizontal"?"col-span-12":`col-span-${T.col||12}`)},[e.createVNode(_n,{style:e.normalizeStyle(z.style),item:T,layout:y(T),columns:C(T),"model-value":s.value[T.name],"onUpdate:modelValue":Y=>{const Q=s.value[T.name];R(Q,Y)||(s.value[T.name]=Y)},error:e.unref(i)[T.name],onValueSelected:$},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),y(T)==="settings"&&J+1!==e.unref(m).length?(e.openBlock(),e.createElementBlock("div",dc)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(Qd,{target:f.value,"scroll-container":x.value,enabled:g.value,width:V.value},null,8,["target","scroll-container","enabled","width"])]))}}),cc={class:"relative"},uc={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},pc={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"},mc={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},hc={class:"font-medium text-gray-800 dark:text-[#ffffff]"},fc={class:"p-4 mim-h-0 h-full overflow-auto"},Vn=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(l,{emit:t}){const n=l,a=t,o=e.ref(n.schema),r=e.ref(n.defaultValue?JSON.parse(JSON.stringify(n.defaultValue)):{}),s=e.ref({}),i=e.ref(n.token||""),d=e.ref(n.mode);async function c(){const f=s.value.validate();if(f){ne.notify({type:"warning",title:"Помилка валідації",message:Object.entries(f).map(([x,g])=>`${x}: ${g}`).join(`
3
+ `)});return}if(i.value)try{const x=await fetch(`/api/table/${i.value}`,{method:d.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r.value)});if(x.ok)await x.json(),ne.notify({type:"success",title:"Успішно",message:`Дані успішно ${d.value==="add"?"збережено":"оновлено"}`}),a("save",r.value);else if(x.status===400){const g=await x.json().catch(()=>({}));ne.notify({type:"warning",title:"Помилка валідації",message:g.message||"Некоректні дані (400)"})}else x.status===500?ne.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):ne.notify({type:"error",title:"Помилка",message:`Статус: ${x.status}`})}catch(x){ne.notify({type:"error",title:"Помилка з’єднання",message:x.message||"Не вдалося виконати запит"})}else a("edit",r.value),m()}function m(){a("close")}return e.onMounted(async()=>{try{if(n.form&&!n.schema){const f=await fetch(`/api/template/form/${n.form}`);if(!f.ok){ne.notify({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const x=await f.json();o.value=x.schema,i.value=x.token}else if(n.token&&!n.defaultValue){i.value=n.token;const f=await fetch(`/api/form/${i.value}`);if(!f.ok){ne.notify({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const x=await f.json();o.value=x.schema,x.data?r.value=x.data:d.value="add",x.obj&&(r.value={...r.value,...x.obj})}}catch(f){ne.notify({type:"error",title:"Error",message:f.message||"Unexpected error"}),console.error(f)}}),(f,x)=>(e.openBlock(),e.createElementBlock("div",cc,[e.createElementVNode("div",uc,[e.createElementVNode("div",pc,[e.createElementVNode("div",mc,[e.createElementVNode("h3",hc,e.toDisplayString(d.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:m,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"},x[2]||(x[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",fc,[o.value?(e.openBlock(),e.createBlock(_e,{key:0,schema:o.value,values:r.value,"onUpdate:values":x[0]||(x[0]=g=>r.value=g),form:s.value,"onUpdate:form":x[1]||(x[1]=g=>s.value=g)},null,8,["schema","values","form"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"vs-form__head mr-5 mb-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},[e.createElementVNode("button",{type:"button",onClick:m,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:c,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])])])]))}}),gc=1440*60*1e3,yc=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],kc=["січ","лют","бер","квіт","трав","черв","лип","серп","вер","жовт","лист","груд"],bc=["нд","пн","вт","ср","чт","пт","сб"];function re(l){return l instanceof Date&&!Number.isNaN(l.getTime())}const Te=l=>new Date(l.getTime());function Ne(l){const t=Te(l);return t.setHours(0,0,0,0),t}function Ue(l){const t=Te(l);return t.setHours(23,59,59,999),t}function Ft(l){return Ne(new Date(l.getFullYear(),l.getMonth(),1))}function Lt(l){return Ue(new Date(l.getFullYear(),l.getMonth()+1,0))}function Tt(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 wc(l,t){return Tt(l,-1)}function at(l,t){const n=new Date(l);return n.setFullYear(n.getFullYear()+t),n}function vn(l,t){return at(l,-t)}function Bn(l){return Ne(new Date(l.getFullYear(),0,1))}function Cn(l){return Ue(new Date(l.getFullYear(),11,31))}function xc(l){const t=Math.floor(l.getFullYear()/10)*10;return Ne(new Date(t,0,1))}function _c(l){const t=Math.floor(l.getFullYear()/10)*10+9;return Ue(new Date(t,11,31))}const fe=l=>l.getFullYear(),ot=l=>Math.floor(l.getFullYear()/10)*10;function Ec(l){const t=[];let n=Ne(l.start);const a=Ne(l.end);for(;n<=a;)t.push(Te(n)),n=new Date(n.getTime()+gc);return t}function Vc(l){const t=[];let n=Ft(l.start);const a=Lt(l.end);for(;n<=a;)t.push(Te(n)),n=Tt(n,1);return t}function vc(l){const t=[];let n=Bn(l.start);const a=Cn(l.end);for(;n<=a;)t.push(Te(n)),n=at(n,1);return t}function It(l,t=1){const n=Ne(l),a=(n.getDay()-t+7)%7;return n.setDate(n.getDate()-a),n}function Bc(l,t=1){const n=It(l,t);return n.setDate(n.getDate()+6),Ue(n)}function Cc(l,t,n=0){const a=It(l,n),o=(t-n+7)%7;return a.setDate(a.getDate()+o),a}const rt=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth()&&l.getDate()===t.getDate(),Ot=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth(),Nn=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear(),Mn=(l,t)=>!!l&&!!t&&rt(l,t)&&l.getHours()===t.getHours(),Nc=(l,t)=>!!l&&!!t&&Mn(l,t)&&l.getMinutes()===t.getMinutes();function Mc(l,t){const n=l.getTime();return n>=t.start.getTime()&&n<=t.end.getTime()}const He=(l,t)=>!!l&&!!t&&l.getTime()<t.getTime(),qe=(l,t)=>!!l&&!!t&&l.getTime()>t.getTime();function Sc(l){const t=l.filter(n=>re(n));if(t.length)return t.reduce((n,a)=>n.getTime()>=a.getTime()?n:a)}function $c(l){const t=l.filter(n=>re(n));if(t.length)return t.reduce((n,a)=>n.getTime()<=a.getTime()?n:a)}function Sn(l,t){const n=Te(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 st=(l,t=2)=>String(l).padStart(t,"0");function $n(l,t){return t==="wide"?yc[l]:kc[l]}function Dc(l){return bc[l]}const Ac=[{token:"LLLL",format:l=>$n(l.getMonth(),"wide")},{token:"LLL",format:l=>$n(l.getMonth(),"abbreviated")},{token:"EE",format:l=>Dc(l.getDay())},{token:"yyyy",format:l=>String(l.getFullYear())},{token:"MM",format:l=>st(l.getMonth()+1)},{token:"dd",format:l=>st(l.getDate())},{token:"HH",format:l=>st(l.getHours())},{token:"mm",format:l=>st(l.getMinutes())}];function it(l,t){if(!re(l))return"";let n="",a=0;for(;a<t.length;){const o=Ac.find(r=>t.startsWith(r.token,a));o?(n+=o.format(l),a+=o.token.length):(n+=t[a],a+=1)}return n}const Fc={"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 Dn(l,t){const n=Fc[t];if(!n){const o=new Date(l);return re(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 re(i)?i:null}case"dd.MM.yyyy":{const[,o,r,s]=a,i=new Date(Number(s),Number(r)-1,Number(o));return re(i)?i:null}case"dd.MM.yyyy HH:mm":{const[,o,r,s,i,d]=a,c=new Date(Number(s),Number(r)-1,Number(o),Number(i),Number(d));return re(c)?c:null}case"HH:mm":{const[,o,r]=a,s=new Date;return s.setHours(Number(o),Number(r),0,0),s}case"MM.yyyy":{const[,o,r]=a;return new Date(Number(r),Number(o)-1,1)}case"yyyy":{const[,o]=a;return new Date(Number(o),0,1)}default:return null}}const Lc=["year","month","day","time","custom"],Tc=e.defineComponent({emits:{elementClick:l=>re(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"&&Lc.includes(l)}}}),Ic={class:"v3dp__heading"},Oc=["disabled"],Rc=["disabled"],zc={class:"v3dp__body"},jc={class:"v3dp__subheading"},Pc={class:"v3dp__elements"},Uc=["disabled","onClick"];function Hc(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",Ic,[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,Oc),(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,Rc)]),e.createElementVNode("div",zc,["subheading"in l.$slots?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",jc,[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",Pc,[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,Uc))),128))],!0)])])],38)}const dt=G(Tc,[["render",Hc],["__scopeId","data-v-3b9aea7a"]]),qc=e.defineComponent({components:{PickerPopup:dt},emits:{"update:pageDate":l=>re(l),select:l=>re(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(()=>xc(l.pageDate)),a=e.computed(()=>_c(l.pageDate)),o=(f,x,g)=>!x&&!g?!0:!(x&&fe(f)<fe(x)||g&&fe(f)>fe(g)),r=e.computed(()=>vc({start:n.value,end:a.value}).map(f=>({value:f,key:String(fe(f)),display:fe(f),selected:!!l.selected&&fe(f)===fe(l.selected),disabled:!o(f,l.lowerLimit,l.upperLimit)}))),s=e.computed(()=>{const f=fe(n.value),x=fe(a.value);return`${f} - ${x}`}),i=e.computed(()=>l.lowerLimit&&(ot(l.lowerLimit)===ot(l.pageDate)||He(l.pageDate,l.lowerLimit))),d=e.computed(()=>l.upperLimit&&(ot(l.upperLimit)===ot(l.pageDate)||qe(l.pageDate,l.upperLimit)));return{years:r,heading:s,leftDisabled:i,rightDisabled:d,previousPage:()=>t("update:pageDate",vn(l.pageDate,10)),nextPage:()=>t("update:pageDate",at(l.pageDate,10))}}});function Gc(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 Kc=G(qc,[["render",Gc]]),Yc=e.defineComponent({components:{PickerPopup:dt},emits:{"update:pageDate":l=>re(l),select:l=>re(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(()=>Bn(l.pageDate)),a=e.computed(()=>Cn(l.pageDate)),o=e.computed(()=>x=>it(x,l.format)),r=(x,g,V)=>!g&&!V?!0:!(g&&He(x,Ft(g))||V&&qe(x,Lt(V))),s=e.computed(()=>Vc({start:n.value,end:a.value}).map(x=>({value:x,display:o.value(x),key:o.value(x),selected:!!l.selected&&Ot(l.selected,x),disabled:!r(x,l.lowerLimit,l.upperLimit)}))),i=e.computed(()=>fe(n.value)),d=e.computed(()=>l.lowerLimit&&(Nn(l.lowerLimit,l.pageDate)||He(l.pageDate,l.lowerLimit))),c=e.computed(()=>l.upperLimit&&(Nn(l.upperLimit,l.pageDate)||qe(l.pageDate,l.upperLimit)));return{months:s,heading:i,leftDisabled:d,rightDisabled:c,previousPage:()=>t("update:pageDate",vn(l.pageDate,1)),nextPage:()=>t("update:pageDate",at(l.pageDate,1))}}});function Wc(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 Zc=G(Yc,[["render",Wc]]),Jc=e.defineComponent({components:{PickerPopup:dt},emits:{"update:pageDate":l=>re(l),select:l=>re(l),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"dd"},headingFormat:{type:String,required:!1,default:"LLLL yyyy"},weekdayFormat:{type:String,required:!1,default:"EE"},weekStartsOn:{type:Number,required:!1,default:1,validator:l=>typeof l=="number"&&Number.isInteger(l)&&l>=0&&l<=6},customWeekdays:{type:Array,required:!1},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1}},setup(l,{emit:t}){const n=e.computed(()=>k=>b=>it(b,k)),a=e.computed(()=>Ft(l.pageDate)),o=e.computed(()=>Lt(l.pageDate)),r=e.computed(()=>({start:a.value,end:o.value})),s=e.computed(()=>({start:It(a.value,l.weekStartsOn),end:Bc(o.value,l.weekStartsOn)})),i=e.computed(()=>l.customWeekdays?.length===7?l.customWeekdays:null),d=e.computed(()=>{const k=l.weekStartsOn,b=i.value;if(b)return Array.from({length:7}).map((v,y)=>b[(k+y)%7]);const h=n.value(l.weekdayFormat);return Array.from(Array(7)).map((v,y)=>(k+y)%7).map(v=>Cc(new Date,v,l.weekStartsOn)).map(h)}),c=(k,b,h,v)=>v?.dates?.some(y=>rt(k,y))||v?.predicate?.(k)?!1:!b&&!h?!0:!(b&&He(k,Ne(b))||h&&qe(k,Ue(h))),m=e.computed(()=>{const k=new Date,b=n.value(l.format);return Ec(s.value).map(h=>({value:h,display:b(h),selected:!!l.selected&&rt(l.selected,h),current:rt(k,h),disabled:!l.allowOutsideInterval&&!Mc(h,r.value)||!c(h,l.lowerLimit,l.upperLimit,l.disabledDates),key:n.value("yyyy-MM-dd")(h)}))}),f=e.computed(()=>n.value(l.headingFormat)(l.pageDate)),x=e.computed(()=>l.lowerLimit&&(Ot(l.lowerLimit,l.pageDate)||He(l.pageDate,l.lowerLimit))),g=e.computed(()=>l.upperLimit&&(Ot(l.upperLimit,l.pageDate)||qe(l.pageDate,l.upperLimit)));return{weekDays:d,days:m,heading:f,leftDisabled:x,rightDisabled:g,previousPage:()=>t("update:pageDate",wc(l.pageDate)),nextPage:()=>t("update:pageDate",Tt(l.pageDate,1))}}});function Xc(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,items:l.days,viewMode:"day",onLeft:l.previousPage,onRight:l.nextPage,onHeading:t[0]||(t[0]=i=>l.$emit("back")),onElementClick:t[1]||(t[1]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),subheading:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.weekDays,(i,d)=>(e.openBlock(),e.createElementBlock("span",{key:i,class:e.normalizeClass(`v3dp__subheading__weekday__${d}`)},e.toDisplayString(i),3))),128))]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const Qc=G(Jc,[["render",Xc]]);function An(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 eu=e.defineComponent({components:{PickerPopup:dt},emits:{select:l=>re(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,g=>{let V=0,w=0;g&&(V=g.getHours(),w=g.getMinutes()),r.value=V,s.value=w});const i=e.computed(()=>[...Array(24).keys()].map(g=>({value:g,date:Sn(new Date(o.value.getTime()),{hours:g,minutes:s.value,seconds:0}),selected:r.value===g,ref:e.ref(null)}))),d=e.computed(()=>[...Array(60).keys()].map(g=>({value:g,date:Sn(new Date(o.value.getTime()),{hours:r.value,minutes:g,seconds:0}),selected:s.value===g,ref:e.ref(null)}))),c=g=>{s.value=g.value,t("select",g.date)},m=()=>{const g=i.value.find(w=>w.ref.value?.classList?.contains("selected")??!1),V=d.value.find(w=>w.ref.value?.classList?.contains("selected")??!1);g&&V&&(An(n.value,g.ref.value),An(a.value,V.ref.value))};return e.watch(()=>l.visible,g=>{g&&e.nextTick(m)}),{hoursListRef:n,minutesListRef:a,hours:r,minutes:s,hoursList:i,minutesList:d,padStartZero:g=>`0${g}`.substr(-2),selectMinutes:c,isEnabled:g=>!(l.disabledTime?.dates?.some(V=>Mn(g,V)&&Nc(g,V))||l.disabledTime?.predicate?.(g)),scroll:m}}}),tu={ref:"hoursListRef",class:"v3dp__column"},nu=["disabled","onClick"],lu={ref:"minutesListRef",class:"v3dp__column"},au=["disabled","onClick"];function ou(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",tu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.hoursList,i=>(e.openBlock(),e.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:e.normalizeClass([{selected:i.selected},"v3dp__element_button__hour"]),disabled:!l.isEnabled(i.date),onClick:e.withModifiers(d=>l.hours=i.value,["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,nu))),128))],512),e.createElementVNode("div",lu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.minutesList,i=>(e.openBlock(),e.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:e.normalizeClass([{selected:i.selected},"v3dp__element_button__minute"]),disabled:!l.isEnabled(i.date),onClick:e.withModifiers(d=>l.selectMinutes(i),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,au))),128))],512)]),_:1})}const ru=G(eu,[["render",ou],["__scopeId","data-v-c075af58"]]),ct=["time","day","month","year"],su=(l,t,n=void 0)=>{let a=n||new Date;const o=Sc([l,a]);o&&(a=o);const r=$c([t,a]);return r&&(a=r),a},iu=e.defineComponent({components:{YearPicker:Kc,MonthPicker:Zc,DayPicker:Qc,TimePicker:ru},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"&&ct.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"&&ct.includes(l)}},emits:{"update:modelValue":l=>l==null||re(l),decadePageChanged:l=>!0,yearPageChanged:l=>!0,monthPageChanged:l=>!0,opened:()=>!0,closed:()=>!0},setup(l,{emit:t,attrs:n}){const a=e.ref("none"),o=e.ref(l.startingViewDate),r=e.ref(null),s=e.ref(!1),i=e.ref(""),d=M=>{const E=M.replace(/[a-zA-Z]/g,"0");return/0/.test(E)?E:""},c=e.computed(()=>d(l.inputFormat));let m=null,f=null;const x=()=>{m?.destroy(),m=null},g=async()=>{if(!f){const{default:M}=await Promise.resolve().then(()=>Ut);f=M}return f},V=()=>{m&&m.value!==i.value&&(m.value=i.value??"")},w=async()=>{if(x(),!r.value||!c.value)return;m=(await g())(r.value,{mask:c.value,lazy:!0,overwrite:!0}),V()};e.watchEffect(()=>{if(!i.value)return;const M=Dn(i.value,l.inputFormat);M&&(o.value=M)}),e.watchEffect(()=>{i.value=l.modelValue&&re(l.modelValue)?it(l.modelValue,l.inputFormat):""}),e.onMounted(()=>{c.value&&e.nextTick(()=>{w()})}),e.onBeforeUnmount(()=>{x()}),e.watch(c,M=>{M?e.nextTick(()=>{w()}):x()}),e.watch(i,()=>{V()});const k=(M="none")=>{l.disabled||(M!=="none"&&a.value==="none"&&(o.value=l.modelValue||su(l.lowerLimit,l.upperLimit,o.value)),a.value=M,t(M!=="none"?"opened":"closed"))};e.watchEffect(()=>{l.disabled&&(a.value="none")});const b=(M,E)=>{o.value=E,M==="year"?t("decadePageChanged",E):M==="month"?t("yearPageChanged",E):M==="day"&&t("monthPageChanged",E)},h=M=>{o.value=M,l.minimumView==="year"?(k("none"),t("update:modelValue",M)):a.value="month"},v=M=>{o.value=M,l.minimumView==="month"?(k("none"),t("update:modelValue",M)):a.value="day"},y=M=>{o.value=M,l.minimumView==="day"?(k("none"),t("update:modelValue",M)):a.value="time"},C=M=>{k("none"),t("update:modelValue",M)},L=()=>{l.clearable&&(k("none"),t("update:modelValue",null),o.value=l.startingViewDate)},$=()=>s.value=!0,R=()=>k(T.value),z=()=>{s.value=!1,k()},U=M=>{const E=M.keyCode?M.keyCode:M.which;if([27,13].includes(E)&&r.value.blur(),l.typeable){const D=Dn(r.value.value,l.inputFormat);D&&i.value===it(D,l.inputFormat)&&(i.value=r.value.value,t("update:modelValue",D))}},T=e.computed(()=>{const M=ct.indexOf(l.startingView),E=ct.indexOf(l.minimumView);return M<E?l.minimumView:l.startingView}),J=M=>Object.fromEntries(Object.entries(M??{}).filter(([E,N])=>E.startsWith("--"))),Y=e.computed(()=>l.weekDayNames?.length===7?l.weekDayNames:void 0);return{blur:z,focus:R,click:$,input:i,inputRef:r,pageDate:o,renderView:k,updatePageDate:b,selectYear:h,selectMonth:v,selectDay:y,selectTime:C,keyUp:U,normalizedWeekdayNames:Y,viewShown:a,goBackFromTimepicker:()=>l.startingView==="time"&&l.minimumView==="time"?null:a.value="day",clearModelValue:L,initialView:T,log:M=>console.log(M),variables:J}}}),du={class:"v3dp__input_wrapper"},cu=["readonly","placeholder","disabled","tabindex"],uu={class:"v3dp__clearable"};function pu(l,t,n,a,o,r){const s=e.resolveComponent("year-picker"),i=e.resolveComponent("month-picker"),d=e.resolveComponent("day-picker"),c=e.resolveComponent("time-picker");return e.openBlock(),e.createElementBlock("div",{class:"v3dp__datepicker",style:e.normalizeStyle(l.variables(l.$attrs.style))},[e.createElementVNode("div",du,[e.withDirectives(e.createElementVNode("input",e.mergeProps({type:"text",ref:"inputRef",readonly:!l.typeable,"onUpdate:modelValue":t[0]||(t[0]=m=>l.input=m)},l.$attrs,{placeholder:l.placeholder,disabled:l.disabled,tabindex:l.disabled?-1:0,onKeyup:t[1]||(t[1]=(...m)=>l.keyUp&&l.keyUp(...m)),onBlur:t[2]||(t[2]=(...m)=>l.blur&&l.blur(...m)),onFocus:t[3]||(t[3]=(...m)=>l.focus&&l.focus(...m)),onClick:t[4]||(t[4]=(...m)=>l.click&&l.click(...m))}),null,16,cu),[[e.vModelText,l.input]]),e.withDirectives(e.createElementVNode("div",uu,[e.renderSlot(l.$slots,"clear",{onClear:l.clearModelValue},()=>[e.createElementVNode("i",{onClick:t[5]||(t[5]=m=>l.clearModelValue())},"x")])],512),[[e.vShow,l.clearable&&l.modelValue]])]),e.withDirectives(e.createVNode(s,{pageDate:l.pageDate,"onUpdate:pageDate":t[6]||(t[6]=m=>l.updatePageDate("year",m)),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]=m=>l.updatePageDate("month",m)),selected:l.modelValue,onSelect:l.selectMonth,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,format:l.monthListFormat,onBack:t[8]||(t[8]=m=>l.viewShown="year")},null,8,["pageDate","selected","onSelect","lowerLimit","upperLimit","format"]),[[e.vShow,l.viewShown==="month"]]),e.withDirectives(e.createVNode(d,{pageDate:l.pageDate,"onUpdate:pageDate":t[9]||(t[9]=m=>l.updatePageDate("day",m)),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]=m=>l.viewShown="month")},null,8,["pageDate","selected","weekStartsOn","lowerLimit","upperLimit","headingFormat","disabledDates","weekdayFormat","allow-outside-interval","format","custom-weekdays","onSelect"]),[[e.vShow,l.viewShown==="day"]]),e.withDirectives(e.createVNode(c,{pageDate:l.pageDate,visible:l.viewShown==="time",selected:l.modelValue,disabledTime:l.disabledTime,onSelect:l.selectTime,onBack:l.goBackFromTimepicker},null,8,["pageDate","visible","selected","disabledTime","onSelect","onBack"]),[[e.vShow,l.viewShown==="time"]])],4)}const mu=G(iu,[["render",pu]]),hu=G(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:""}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,{inputClass:o}=ce(n.style),r=e.computed(()=>n.mode?n.mode:n.time?"datetime":"date"),s={date:"дд.мм.рррр",datetime:"дд.мм.рррр гг:хх",month:"мм.рррр",week:"рррр-тиждень",time:"гг:хх",year:"рррр"},i=e.computed(()=>n.placeholder||s[r.value]||""),d=e.computed(()=>["py-1.5 px-3 block w-full placeholder:text-[#767f8f] bg-white",o.value,n.customClass,{"!border-red-600":n.error}]),c=e.computed(()=>!n.modelValue&&n.now?new Date:null),m=e.computed({get:()=>v(n.modelValue??c.value,r.value)||void 0,set:E=>a("update:modelValue",y(E,r.value))}),f=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],x=e.computed(()=>{if(n.dayNames?.length)return n.dayNames.length===7?n.dayNames:f}),g=e.computed(()=>{const E=n.weekStart,N=typeof E=="string"?Number(E):E;return N===void 0||Number.isNaN(N)?1:Math.min(6,Math.max(0,N))}),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"}}}),w={date:"dd.MM.yyyy",datetime:"dd.MM.yyyy HH:mm",month:"MM.yyyy",time:"HH:mm",week:"dd.MM.yyyy",year:"yyyy"},k=e.computed(()=>w[r.value]||"dd.MM.yyyy"),b=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"})),h=e.ref(!1);e.watch(()=>n.modelValue,E=>{E?h.value=!0:n.now||(h.value=!1)},{immediate:!0}),e.watchEffect(()=>{n.now&&!n.modelValue&&!h.value&&(a("update:modelValue",y(new Date,r.value)),h.value=!0)});function v(E,N){if(!E)return null;if(E instanceof Date&&!Number.isNaN(E.getTime()))return E;if(typeof E!="string")return null;switch(N){case"datetime":return R(E);case"time":return T(E);case"month":return z(E);case"year":return U(E);case"week":return J(E);case"date":default:return $(E)}}function y(E,N){if(!E)return null;const D=E instanceof Date?E:v(E,N);if(!D)return null;switch(N){case"datetime":return`${C(D)}T${L(D)}`;case"time":return L(D);case"month":return`${D.getFullYear()}-${M(D.getMonth()+1)}`;case"year":return`${D.getFullYear()}`;case"week":{const{year:H,week:ee}=Y(D);return`${H}-W${M(ee)}`}case"date":default:return C(D)}}function C(E){return`${E.getFullYear()}-${M(E.getMonth()+1)}-${M(E.getDate())}`}function L(E){return`${M(E.getHours())}:${M(E.getMinutes())}`}function $(E){const N=E.split("-");if(N.length<3)return null;const[D,H,ee]=N.map(Number);return!D||!H||!ee?null:new Date(D,H-1,ee)}function R(E){const N=E.includes("T")?E:E.replace(" ","T"),D=new Date(N);return Number.isNaN(D.getTime())?null:D}function z(E){const[N,D]=E.split("-").map(Number);return!N||Number.isNaN(D)?null:new Date(N,(D||1)-1,1)}function U(E){const N=Number(E);return N?new Date(N,0,1):null}function T(E){const N=E.match(/^(\d{1,2}):(\d{2})$/);if(!N)return null;const[,D,H]=N,ee=new Date;return ee.setHours(Number(D),Number(H),0,0),ee}function J(E){const N=E.match(/^(\d{4})-W(\d{2})$/);if(!N)return null;const[,D,H]=N,ee=Number(H);return Q(Number(D),ee)}function Y(E){const N=new Date(Date.UTC(E.getFullYear(),E.getMonth(),E.getDate())),D=N.getUTCDay()||7;N.setUTCDate(N.getUTCDate()+4-D);const H=new Date(Date.UTC(N.getUTCFullYear(),0,1)),ee=Math.ceil(((N.getTime()-H.getTime())/864e5+1)/7);return{year:N.getUTCFullYear(),week:ee}}function Q(E,N){if(!E||!N)return null;const D=new Date(E,0,1+(N-1)*7),H=D.getDay(),ee=D;return H<=4?ee.setDate(D.getDate()-D.getDay()+1):ee.setDate(D.getDate()+8-D.getDay()),ee}function M(E){return String(E).padStart(2,"0")}return(E,N)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vs-date-picker",n.customClass]),style:e.normalizeStyle(b.value)},[e.createVNode(mu,{modelValue:m.value,"onUpdate:modelValue":N[0]||(N[0]=D=>m.value=D),placeholder:i.value,disabled:n.disabled,clearable:n.clearable,typeable:n.editable,"week-day-names":x.value,"week-starts-on":g.value,"starting-view":V.value.startingView,"minimum-view":V.value.minimumView,"input-format":k.value,name:n.name,class:e.normalizeClass(d.value)},null,8,["modelValue","placeholder","disabled","clearable","typeable","week-day-names","week-starts-on","starting-view","minimum-view","input-format","name","class"])],6))}}),[["__scopeId","data-v-a65a2ac3"]]),fu=["placeholder","disabled","name"],gu=["type","value","onInput","placeholder","disabled"],yu=["onClick"],ku=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:""}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.ref(t.count),a=e.computed(()=>t.limit),{inputClass:o}=ce(t.style),r=e.useModel(l,"modelValue"),s=e.computed(()=>!!t.disabled),i=e.computed(()=>t.placeholder??"");e.watchEffect(()=>{const w=r.value?.length??0;w<n.value&&(r.value=[...r.value??[],...Array(n.value-w)])});const d=e.ref({}),c=e.ref({});function m(w,k){w&&(d.value[k]=w)}async function f(w,k){if(!w||t.inputType!=="mask")return;const{default:b}=await Promise.resolve().then(()=>Ut);c.value[k]&&c.value[k].destroy(),c.value[k]=b(w,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),c.value[k].on("accept",()=>{const h=[...r.value||[]];h[k]=t.unmask?c.value[k].unmaskedValue:c.value[k].value,r.value=h}),c.value[k].on("complete",()=>{const h=[...r.value||[]];h[k]=t.unmask?c.value[k].unmaskedValue:c.value[k].value,r.value=h}),r.value?.[k]&&(c.value[k].value=r.value[k])}function x(w,k){if(s.value)return;const b=w.target.value??null,h=[...r.value];h[k]=t.inputType==="text"?b:Number(b),r.value=h}function g(){n.value+=1;const w=t.inputType==="text"||t.inputType==="mask"?null:0;r.value=[...r.value,w],t.inputType==="mask"&&setTimeout(()=>{const k=n.value-1;d.value[k]&&f(d.value[k],k)},0)}function V(w){if(n.value>1){c.value[w]&&(c.value[w].destroy(),delete c.value[w]),n.value-=1,r.value=r.value.filter((b,h)=>h!==w);const k={};Object.keys(c.value).forEach(b=>{const h=parseInt(b,10);h>w?k[h-1]=c.value[h]:h<w&&(k[h]=c.value[h])}),c.value=k}}return e.onMounted(()=>{if(t.inputType==="mask")for(let w=0;w<n.value;w+=1)d.value[w]&&f(d.value[w],w)}),e.onBeforeUnmount(()=>{Object.values(c.value).forEach(w=>{w&&w.destroy()})}),e.watch(()=>t.mask,w=>{t.inputType==="mask"&&Object.values(c.value).forEach(k=>{k&&k.updateOptions({mask:w,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})})}),e.watch(r,w=>{t.inputType==="mask"&&w&&w.forEach((k,b)=>{c.value[b]&&c.value[b].value!==k&&(c.value[b].value=k||"")})},{deep:!0}),(w,k)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["grid gap-2",`grid-cols-${a.value}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,b=>(e.openBlock(),e.createElementBlock("div",{key:b,class:"flex items-center gap-2 w-full"},[w.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:h=>m(h,b-1),placeholder:w.placeholder,disabled:w.disabled,name:`${w.name}[${b-1}]`,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":w.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,fu)):(e.openBlock(),e.createElementBlock("input",{key:1,type:w.inputType,value:r.value?.[b-1],onInput:h=>x(h,b-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":w.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,gu)),!w.disabled&&b===n.value&&w.isAdded?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:e.withModifiers(g,["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(xe,{height:"18",width:"18"})])):e.createCommentVNode("",!0),!w.disabled&&n.value>1&&w.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(h=>V(b-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(Vt,{height:"18",width:"18"})],8,yu)):e.createCommentVNode("",!0)]))),128))],2))}}),Fn=(l={mode:"edit",schema:null})=>new Promise(t=>{const{close:n}=ne.modal({title:l.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Vn,contentProps:{...l,onClose:()=>{t(null),n()},onSave:a=>{t(a),n()}}})});_e.install=function(t){t.component("VForm",_e),Object.assign(t.config.globalProperties,{$form:Fn}),t.provide("form",Fn),window.v3plugin||(window.v3plugin={})};function Be(l){return typeof l=="string"||l instanceof String}function Ln(l){var t;return typeof l=="object"&&l!=null&&(l==null||(t=l.constructor)==null?void 0:t.name)==="Object"}function Tn(l,t){return Array.isArray(t)?Tn(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 P={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function In(l){switch(l){case P.LEFT:return P.FORCE_LEFT;case P.RIGHT:return P.FORCE_RIGHT;default:return l}}function Rt(l){return l.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function ut(l,t){if(t===l)return!0;const n=Array.isArray(t),a=Array.isArray(l);let o;if(n&&a){if(t.length!=l.length)return!1;for(o=0;o<t.length;o++)if(!ut(t[o],l[o]))return!1;return!0}if(n!=a)return!1;if(t&&l&&typeof t=="object"&&typeof l=="object"){const r=t instanceof Date,s=l instanceof Date;if(r&&s)return t.getTime()==l.getTime();if(r!=s)return!1;const i=t instanceof RegExp,d=l instanceof RegExp;if(i&&d)return t.toString()==l.toString();if(i!=d)return!1;const c=Object.keys(t);for(o=0;o<c.length;o++)if(!Object.prototype.hasOwnProperty.call(l,c[o]))return!1;for(o=0;o<c.length;o++)if(!ut(l[c[o]],t[c[o]]))return!1;return!0}else if(t&&l&&typeof t=="function"&&typeof l=="function")return t.toString()===l.toString();return!1}class bu{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?P.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?P.RIGHT:P.LEFT}}function W(l,t){return new W.InputMask(l,t)}function On(l){if(l==null)throw new Error("mask property should be defined");return l instanceof RegExp?W.MaskedRegExp:Be(l)?W.MaskedPattern:l===Date?W.MaskedDate:l===Number?W.MaskedNumber:Array.isArray(l)||l===Array?W.MaskedDynamic:W.Masked&&l.prototype instanceof W.Masked?l:W.Masked&&l instanceof W.Masked?l.constructor:l instanceof Function?W.MaskedFunction:(console.warn("Mask not found for mask",l),W.Masked)}function Ie(l){if(!l)throw new Error("Options in not defined");if(W.Masked){if(l.prototype instanceof W.Masked)return{mask:l};const{mask:t=void 0,...n}=l instanceof W.Masked?{mask:l}:Ln(l)&&l.mask instanceof W.Masked?l:{};if(t){const a=t.mask;return{...Tn(t,(o,r)=>!r.startsWith("_")),mask:t.constructor,_mask:a,...n}}}return Ln(l)?{...l}:{mask:l}}function ye(l){if(W.Masked&&l instanceof W.Masked)return l;const t=Ie(l),n=On(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)}W.createMask=ye;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}}W.MaskElement=pt;const Rn=90,wu=89;class Ge 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===Rn&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===wu&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===Rn&&(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={}}}W.HTMLMaskElement=Ge;class zn extends Ge{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}}W.HTMLMaskElement=Ge;class zt extends Ge{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}}W.HTMLContenteditableMaskElement=zt;class mt{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>mt.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}}mt.MAX_LENGTH=100;class jn{constructor(t,n){this.el=t instanceof pt?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new zt(t):new zn(t),this.masked=ye(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new mt,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 W.Masked)&&this.masked.constructor===On(t)){this.masked.updateOptions({mask:t});return}const n=t instanceof W.Masked?t:ye({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,P.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 bu({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:P.NONE;let s=this.masked.nearestInputPos(n.startChangePos+o,r);r!==P.NONE&&(s=this.masked.nearestInputPos(s,P.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}}W.InputMask=jn;class Z{static normalize(t){return Array.isArray(t)?t:[t,new Z]}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}}W.ChangeDetails=Z;class ke{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 se{constructor(t){this._value="",this._update({...se.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 ke(this.extractInput(t,n),t)}appendTail(t){return Be(t)&&(t=new ke(String(t))),t.appendTo(this)}_appendCharRaw(t,n){return t?(this._value+=t,new Z({inserted:t,rawInserted:t})):new Z}_appendChar(t,n,a){n===void 0&&(n={});const o=this.state;let r;if([t,r]=this.doPrepareChar(t,n),t&&(r=r.aggregate(this._appendCharRaw(t,n)),!r.rawInserted&&this.autofix==="pad")){const s=this.state;this.state=o;let i=this.pad(n);const d=this._appendCharRaw(t,n);i=i.aggregate(d),d.rawInserted||i.equals(r)?r=i:this.state=s}if(r.inserted){let s,i=this.doValidate(n)!==!1;if(i&&a!=null){const d=this.state;if(this.overwrite===!0){s=a.state;for(let m=0;m<r.rawInserted.length;++m)a.unshift(this.displayValue.length-r.tailShift)}let c=this.appendTail(a);if(i=c.rawInserted.length===a.toString().length,!(i&&c.inserted)&&this.overwrite==="shift"){this.state=d,s=a.state;for(let m=0;m<r.rawInserted.length;++m)a.shift();c=this.appendTail(a),i=c.rawInserted.length===a.toString().length}i&&c.inserted&&(this.state=d)}i||(r=new Z,this.state=o,a&&s&&(a.state=s))}return r}_appendPlaceholder(){return new Z}_appendEager(){return new Z}append(t,n,a){if(!Be(t))throw new Error("value should be string");const o=Be(a)?new ke(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 Z}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={}),Z.normalize(this.prepare?this.prepare(t,this,n):t)}doPrepareChar(t,n){return n===void 0&&(n={}),Z.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=P.NONE),r===void 0&&(r={input:!0});const s=t+n,i=this.extractTail(s),d=this.eager===!0||this.eager==="remove";let c;d&&(o=In(o),c=this.extractInput(0,s,{raw:!0}));let m=t;const f=new Z;if(o!==P.NONE&&(m=this.nearestInputPos(t,n>1&&t!==0&&!d?P.NONE:o),f.tailShift=m-t),f.aggregate(this.remove(m)),d&&o!==P.NONE&&c===this.rawInputValue)if(o===P.FORCE_LEFT){let x;for(;c===this.rawInputValue&&(x=this.displayValue.length);)f.aggregate(new Z({tailShift:-1})).aggregate(this.remove(x-1))}else o===P.FORCE_RIGHT&&i.unshift();return f.aggregate(this.append(a,r,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!ut(this,t)}typedValueEquals(t){const n=this.typedValue;return t===n||se.EMPTY_VALUES.includes(t)&&se.EMPTY_VALUES.includes(n)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new Z}}se.DEFAULTS={skipInvalid:!0},se.EMPTY_VALUES=[void 0,null,""],W.Masked=se;class Ce{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=Be(t)?new ke(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 ke)a?n.extend(t.toString()):this.chunks.push(t);else if(t instanceof Ce){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 W.MaskedPattern))return new ke(this.toString()).appendTo(t);const n=new Z;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 Ce||t._stops.indexOf(s)>=0)&&n.aggregate(t._appendPlaceholder(s)),i=o instanceof Ce&&t._blocks[s]),i){const d=i.appendTail(o);n.aggregate(d);const c=o.toString().slice(d.rawInserted.length);c&&n.aggregate(t.append(c,{tail:!0}))}else n.aggregate(t.append(o.toString(),{tail:!0}))}return n}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:n,...a}=t;Object.assign(this,a),this.chunks=n.map(o=>{const r="chunks"in o?new Ce:new ke;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 xu{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,P.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,P.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,P.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,P.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,P.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,P.NONE),!0})}}class jt{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 Z}nearestInputPos(t,n){n===void 0&&(n=P.NONE);const a=0,o=this._value.length;switch(n){case P.LEFT:case P.FORCE_LEFT:return a;case P.NONE:case P.RIGHT:case P.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 Z;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 Z({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 Z;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new ke("")}appendTail(t){return Be(t)&&(t=new ke(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 Ke{constructor(t){const{parent:n,isOptional:a,placeholderChar:o,displayChar:r,lazy:s,eager:i,...d}=t;this.masked=ye(d),Object.assign(this,{parent:n,isOptional:a,placeholderChar:o,displayChar:r,lazy:s,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),t===0&&n>=1?(this.isFilled=!1,this.masked.remove(t,n)):new Z}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 Z;const a=this.masked.state;let o=this.masked._appendChar(t,this.currentMaskFlags(n));return o.inserted&&this.doValidate(n)===!1&&(o=new Z,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 Z:(this.isFilled=!0,new Z({inserted:this.placeholderChar}))}_appendEager(){return new Z}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=P.NONE);const a=0,o=this.value.length,r=Math.min(Math.max(t,a),o);switch(n){case P.LEFT:case P.FORCE_LEFT:return this.isComplete?r:a;case P.RIGHT:case P.FORCE_RIGHT:return this.isComplete?r:o;case P.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 Z}}Ke.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 Pn extends se{updateOptions(t){super.updateOptions(t)}_update(t){const n=t.mask;n&&(t.validate=a=>a.search(n)>=0),super._update(t)}}W.MaskedRegExp=Pn;class ie extends se{constructor(t){super({...ie.DEFAULTS,...t,definitions:Object.assign({},Ke.DEFAULT_DEFINITIONS,t?.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const n=this.mask;if(!n||!t)return;let a=!1,o=!1;for(let r=0;r<n.length;++r){if(this.blocks){const c=n.slice(r),m=Object.keys(this.blocks).filter(x=>c.indexOf(x)===0);m.sort((x,g)=>g.length-x.length);const f=m[0];if(f){const{expose:x,repeat:g,...V}=Ie(this.blocks[f]),w={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...V,repeat:g,parent:this},k=g!=null?new W.RepeatBlock(w):ye(w);k&&(this._blocks.push(k),x&&(this.exposeBlock=k),this._maskedBlocks[f]||(this._maskedBlocks[f]=[]),this._maskedBlocks[f].push(this._blocks.length-1)),r+=f.length-1;continue}}let s=n[r],i=s in t;if(s===ie.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){a=!a;continue}if(s==="["||s==="]"){o=!o;continue}if(s===ie.ESCAPE_CHAR){if(++r,s=n[r],!s)break;i=!1}const d=i?new Ke({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...Ie(t[s]),parent:this}):new jt({char:s,eager:this.eager,isUnmasking:a});this._blocks.push(d)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:n,...a}=t;this._blocks.forEach((o,r)=>o.state=n[r]),super.state=a}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,n)=>t+=n.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(n),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,n)=>t+=n.value,"")}set value(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(n),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(n),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,n)=>t+=n.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const n=new Z;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 Z;if(!a)return o;for(let s=a.index,i;i=this._blocks[s];++s){var r;const d=i._appendChar(t,{...n,_beforeTailState:(r=n._beforeTailState)==null||(r=r._blocks)==null?void 0:r[s]});if(o.aggregate(d),d.consumed)break}return o}extractTail(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=new Ce;return t===n||this._forEachBlocksInRange(t,n,(o,r,s,i)=>{const d=o.extractTail(s,i);d.stop=this._findStopBefore(r),d.from=this._blockStartPos(r),d instanceof Ce&&(d.blockIndex=r),a.extend(d)}),a}extractInput(t,n,a){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),a===void 0&&(a={}),t===n)return"";let o="";return this._forEachBlocksInRange(t,n,(r,s,i,d)=>{o+=r.extractInput(i,d,a)}),o}_findStopBefore(t){let n;for(let a=0;a<this._stops.length;++a){const o=this._stops[a];if(o<=t)n=o;else break}return n}_appendPlaceholder(t){const n=new Z;if(this.lazy&&t==null)return n;const a=this._mapPosToBlock(this.displayValue.length);if(!a)return n;const o=a.index,r=t??this._blocks.length;return this._blocks.slice(o,r).forEach(s=>{if(!s.lazy||t!=null){var i;n.aggregate(s._appendPlaceholder((i=s._blocks)==null?void 0:i.length))}}),n}_mapPosToBlock(t){let n="";for(let a=0;a<this._blocks.length;++a){const o=this._blocks[a],r=n.length;if(n+=o.displayValue,t<=n.length)return{index:a,offset:t-r}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((n,a)=>n+=a.displayValue.length,0)}_forEachBlocksInRange(t,n,a){n===void 0&&(n=this.displayValue.length);const o=this._mapPosToBlock(t);if(o){const r=this._mapPosToBlock(n),s=r&&o.index===r.index,i=o.offset,d=r&&s?r.offset:this._blocks[o.index].displayValue.length;if(a(this._blocks[o.index],o.index,i,d),r&&!s){for(let c=o.index+1;c<r.index;++c)a(this._blocks[c],c,0,this._blocks[c].displayValue.length);a(this._blocks[r.index],r.index,0,r.offset)}}}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=super.remove(t,n);return this._forEachBlocksInRange(t,n,(o,r,s,i)=>{a.aggregate(o.remove(s,i))}),a}nearestInputPos(t,n){if(n===void 0&&(n=P.NONE),!this._blocks.length)return 0;const a=new xu(this,t);if(n===P.NONE)return a.pushRightBeforeInput()||(a.popState(),a.pushLeftBeforeInput())?a.pos:this.displayValue.length;if(n===P.LEFT||n===P.FORCE_LEFT){if(n===P.LEFT){if(a.pushRightBeforeFilled(),a.ok&&a.pos===t)return t;a.popState()}if(a.pushLeftBeforeInput(),a.pushLeftBeforeRequired(),a.pushLeftBeforeFilled(),n===P.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===P.FORCE_LEFT?0:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:0)}return n===P.RIGHT||n===P.FORCE_RIGHT?(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.pushRightBeforeFilled()?a.pos:n===P.FORCE_RIGHT?this.displayValue.length:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:this.nearestInputPos(t,P.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 Z;return this._forEachBlocksInRange(0,this.displayValue.length,a=>n.aggregate(a.pad(t))),n}}ie.DEFAULTS={...se.DEFAULTS,lazy:!0,placeholderChar:"_"},ie.STOP_CHAR="`",ie.ESCAPE_CHAR="\\",ie.InputDefinition=Ke,ie.FixedDefinition=jt,W.MaskedPattern=ie;class Ye extends ie{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:n=this.to||0,from:a=this.from||0,maxLength:o=this.maxLength||0,autofix:r=this.autofix,...s}=t;this.to=n,this.from=a,this.maxLength=Math.max(String(n).length,o),this.autofix=r;const i=String(this.from).padStart(this.maxLength,"0"),d=String(this.to).padStart(this.maxLength,"0");let c=0;for(;c<d.length&&d[c]===i[c];)++c;s.mask=d.slice(0,c).replace(/0/g,"\\0")+"0".repeat(this.maxLength-c),super._update(s)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let n="",a="";const[,o,r]=t.match(/^(\D*)(\d*)(\D*)/)||[];return r&&(n="0".repeat(o.length)+r,a="9".repeat(o.length)+r),n=n.padEnd(this.maxLength,"0"),a=a.padEnd(this.maxLength,"9"),[n,a]}doPrepareChar(t,n){n===void 0&&(n={});let a;return[t,a]=super.doPrepareChar(t.replace(/\D/g,""),n),t||(a.skip=!this.isComplete),[t,a]}_appendCharRaw(t,n){if(n===void 0&&(n={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,n);const a=String(this.from).padStart(this.maxLength,"0"),o=String(this.to).padStart(this.maxLength,"0"),[r,s]=this.boundaries(this.value+t);return Number(s)<this.from?super._appendCharRaw(a[this.value.length],n):Number(r)>this.to?!n.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(a[this.value.length],n).aggregate(this._appendCharRaw(t,n)):super._appendCharRaw(o[this.value.length],n):super._appendCharRaw(t,n)}doValidate(t){const n=this.value;if(n.search(/[^0]/)===-1&&n.length<=this._matchFrom)return!0;const[o,r]=this.boundaries(n);return this.from<=Number(r)&&Number(o)<=this.to&&super.doValidate(t)}pad(t){const n=new Z;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}}W.MaskedRange=Ye;const _u="d{.}`m{.}`Y";class be extends ie{static extractPatternOptions(t){const{mask:n,pattern:a,...o}=t;return{...o,mask:Be(n)?n:a}}constructor(t){super(be.extractPatternOptions({...be.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:n,pattern:a,blocks:o,...r}={...be.DEFAULTS,...t},s=Object.assign({},be.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:Be(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(be.extractPatternOptions(t))}}be.GET_DEFAULT_BLOCKS=()=>({d:{mask:Ye,from:1,to:31,maxLength:2},m:{mask:Ye,from:1,to:12,maxLength:2},Y:{mask:Ye,from:1900,to:9999}}),be.DEFAULTS={...ie.DEFAULTS,mask:Date,pattern:_u,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)}},W.MaskedDate=be;class We extends se{constructor(t){super({...We.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}=Ie(n),r=ye({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...o});return a&&(this.exposeMask=r),r}):[])}_appendCharRaw(t,n){n===void 0&&(n={});const a=this._applyDispatch(t,n);return this.currentMask&&a.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(n))),a}_applyDispatch(t,n,a){t===void 0&&(t=""),n===void 0&&(n={}),a===void 0&&(a="");const o=n.tail&&n._beforeTailState!=null?n._beforeTailState._value:this.value,r=this.rawInputValue,s=n.tail&&n._beforeTailState!=null?n._beforeTailState._rawInputValue:r,i=r.slice(s.length),d=this.currentMask,c=new Z,m=d?.state;return this.currentMask=this.doDispatch(t,{...n},a),this.currentMask&&(this.currentMask!==d?(this.currentMask.reset(),s&&(this.currentMask.append(s,{raw:!0}),c.tailShift=this.currentMask.value.length-o.length),i&&(c.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):m&&(this.currentMask.state=m)),c}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const n=new Z;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 Z;return this.currentMask&&a.aggregate(this.currentMask.remove(t,n)).aggregate(this._applyDispatch()),a}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(n=>n.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:n,currentMaskRef:a,currentMask:o,...r}=t;n&&this.compiledMasks.forEach((s,i)=>s.state=n[i]),a!=null&&(this.currentMask=a,this.currentMask.state=o),super.state=r}extractInput(t,n,a){return this.currentMask?this.currentMask.extractInput(t,n,a):""}extractTail(t,n){return this.currentMask?this.currentMask.extractTail(t,n):super.extractTail(t,n)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,n){return this.currentMask?this.currentMask.nearestInputPos(t,n):super.nearestInputPos(t,n)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((n,a)=>{if(!t[a])return;const{mask:o,...r}=t[a];return ut(n,r)&&n.maskEquals(o)}):super.maskEquals(t)}typedValueEquals(t){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(t))}}We.DEFAULTS={...se.DEFAULTS,dispatch:(l,t,n,a)=>{if(!t.compiledMasks.length)return;const o=t.rawInputValue,r=t.compiledMasks.map((s,i)=>{const d=t.currentMask===s,c=d?s.displayValue.length:s.nearestInputPos(s.displayValue.length,P.FORCE_LEFT);return s.rawInputValue!==o?(s.reset(),s.append(o,{raw:!0})):d||s.remove(c),s.append(l,t.currentMaskFlags(n)),s.appendTail(a),{index:i,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(c,s.nearestInputPos(s.displayValue.length,P.FORCE_LEFT)))}});return r.sort((s,i)=>i.weight-s.weight||i.totalInputPositions-s.totalInputPositions),t.compiledMasks[r[0].index]}},W.MaskedDynamic=We;class Ze extends ie{constructor(t){super({...Ze.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,P.FORCE_RIGHT),this.value.length),o=this.enum.filter(r=>this.matchValue(r,this.unmaskedValue+t,a));if(o.length){o.length===1&&this._forEachBlocksInRange(0,this.value.length,(s,i)=>{const d=o[0][i];i>=this.value.length||d===s.value||(s.reset(),s._appendChar(d,n))});const r=super._appendCharRaw(o[0][this.value.length],n);return o.length===1&&o[0].slice(this.unmaskedValue.length).split("").forEach(s=>r.aggregate(super._appendCharRaw(s))),r}return new Z({skip:!this.isComplete})}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new ke("",t)}remove(t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),t===n)return new Z;const a=Math.min(super.nearestInputPos(0,P.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}}Ze.DEFAULTS={...ie.DEFAULTS,matchValue:(l,t,n)=>l.indexOf(t,n)===n},W.MaskedEnum=Ze;class Un extends se{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}W.MaskedFunction=Un;var Hn;class ue extends se{constructor(t){super({...ue.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",a=(this.scale?"("+Rt(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+n+a),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Rt).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Rt(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const n=t.split(this.radix);return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),n.join(this.radix)}doPrepareChar(t,n){n===void 0&&(n={});const[a,o]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(n.input&&n.raw||!n.input&&!n.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),n);return t&&!a&&(o.skip=!0),a&&!this.allowPositive&&!this.value&&a!=="-"&&o.aggregate(this._appendChar("-")),[a,o]}_separatorsCount(t,n){n===void 0&&(n=!1);let a=0;for(let o=0;o<t;++o)this._value.indexOf(this.thousandsSeparator,o)===o&&(++a,n&&(t+=this.thousandsSeparator.length));return a}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n),this._removeThousandsSeparators(super.extractInput(t,n,a))}_appendCharRaw(t,n){n===void 0&&(n={});const a=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,o=this._separatorsCountFromSlice(a);this._value=this._removeThousandsSeparators(this.value);const r=this._value;this._value+=t;const s=this.number;let i=!isNaN(s),d=!1;if(i){let x;this.min!=null&&this.min<0&&this.number<this.min&&(x=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(x=this.max),x!=null&&(this.autofix?(this._value=this.format(x,this).replace(ue.UNMASKED_RADIX,this.radix),d||(d=r===this._value&&!n.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let c;i?c=new Z({inserted:this._value.slice(r.length),rawInserted:d?"":t,skip:d}):(this._value=r,c=new Z),this._value=this._insertThousandsSeparators(this._value);const m=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,f=this._separatorsCountFromSlice(m);return c.tailShift+=(f-o)*this.thousandsSeparator.length,c}_findSeparatorAround(t){if(this.thousandsSeparator){const n=t-this.thousandsSeparator.length+1,a=this.value.indexOf(this.thousandsSeparator,n);if(a<=t)return a}return-1}_adjustRangeWithSeparators(t,n){const a=this._findSeparatorAround(t);a>=0&&(t=a);const o=this._findSeparatorAround(n);return o>=0&&(n=o+this.thousandsSeparator.length),[t,n]}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n);const a=this.value.slice(0,t),o=this.value.slice(n),r=this._separatorsCount(a.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(a+o));const s=this._separatorsCountFromSlice(a);return new Z({tailShift:(s-r)*this.thousandsSeparator.length})}nearestInputPos(t,n){if(!this.thousandsSeparator)return t;switch(n){case P.NONE:case P.LEFT:case P.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===P.FORCE_LEFT)return a}break}case P.RIGHT:case P.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===ue.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,ue.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(ue.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)||ue.EMPTY_VALUES.includes(t)&&ue.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}Hn=ue,ue.UNMASKED_RADIX=".",ue.EMPTY_VALUES=[...se.EMPTY_VALUES,0],ue.DEFAULTS={...se.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Hn.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})},W.MaskedNumber=ue;const ht={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Pt(l,t,n){t===void 0&&(t=ht.MASKED),n===void 0&&(n=ht.MASKED);const a=ye(l);return o=>a.runIsolated(r=>(r[t]=o,r[n]))}function qn(l,t,n,a){return Pt(t,n,a)(l)}W.PIPE_TYPE=ht,W.createPipe=Pt,W.pipe=qn;class Gn extends ie{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}=Ie(t);this._blockOpts=Object.assign({},this._blockOpts,s);const i=ye(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(ye(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,n){n===void 0&&(n={});const a=new Z;for(let d=(o=(r=this._mapPosToBlock(this.displayValue.length))==null?void 0:r.index)!=null?o:Math.max(this._blocks.length-1,0),c,m;c=(s=this._blocks[d])!=null?s:m=!m&&this._allocateBlock(d);++d){var o,r,s,i;const f=c._appendChar(t,{...n,_beforeTailState:(i=n._beforeTailState)==null||(i=i._blocks)==null?void 0:i[d]});if(f.skip&&m){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(a.aggregate(f),f.consumed)break}return a}_trimEmptyTail(t,n){var a,o;t===void 0&&(t=0);const r=Math.max(((a=this._mapPosToBlock(t))==null?void 0:a.index)||0,this.repeatFrom,0);let s;n!=null&&(s=(o=this._mapPosToBlock(n))==null?void 0:o.index),s==null&&(s=this._blocks.length-1);let i=0;for(let d=s;r<=d&&!this._blocks[d].unmaskedValue;--d,++i);i&&(this._blocks.splice(s-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=super.remove(t,n);return this._trimEmptyTail(t,n),a}totalInputPositions(t,n){return t===void 0&&(t=0),n==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,n)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}W.RepeatBlock=Gn;try{globalThis.IMask=W}catch{}const Ut=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:Z,ChunksTailDetails:Ce,DIRECTION:P,HTMLContenteditableMaskElement:zt,HTMLInputMaskElement:zn,HTMLMaskElement:Ge,InputMask:jn,MaskElement:pt,Masked:se,MaskedDate:be,MaskedDynamic:We,MaskedEnum:Ze,MaskedFunction:Un,MaskedNumber:ue,MaskedPattern:ie,MaskedRange:Ye,MaskedRegExp:Pn,PIPE_TYPE:ht,PatternFixedDefinition:jt,PatternInputDefinition:Ke,RepeatBlock:Gn,createMask:ye,createPipe:Pt,default:W,forceDirection:In,normalizeOpts:Ie,pipe:qn},Symbol.toStringTag,{value:"Module"}));X.ModalEdit=Vn,X.VForm=_e,X.VsInputAddress=bn,X.VsInputArray=ku,X.VsInputCheckbox=Xt,X.VsInputCodegen=fn,X.VsInputColor=yn,X.VsInputContainer=sn,X.VsInputDate=hu,X.VsInputEmail=Nt,X.VsInputFile=an,X.VsInputFileList=on,X.VsInputKeyValue=gn,X.VsInputMask=Ct,X.VsInputNumber=Jt,X.VsInputRadio=St,X.VsInputRange=kn,X.VsInputSelect=$t,X.VsInputSlug=hn,X.VsInputStatic=Bt,X.VsInputSwitcher=vt,X.VsInputTag=mn,X.VsInputTel=Mt,X.VsInputText=Fe,X.VsInputTextArray=Dt,X.VsInputTextarea=dn,X.default=_e,X.inputs=xn,X.vsInputDatatable=un,X.vsInputMap=pn,Object.defineProperties(X,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});