@opengis/form 0.0.78 → 0.0.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +73 -73
- package/dist/index.css +1 -1
- package/dist/index.js +104 -99
- package/dist/index.umd.cjs +3 -3
- package/package.json +68 -68
package/dist/index.umd.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(W,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):(W=typeof globalThis<"u"?globalThis:W||self,e(W.FormBuilder={},W.Vue,W.OpenGISCore))})(this,(function(W,e,ee){"use strict";const kl={class:"w-full relative"},yl={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},bl={class:"opacity-100"},xl={key:0,class:"text-red-500 text-[14px]"},wl={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},_l=e.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(s){const t=e.ref("uk"),l=n=>{n.detail.key==="locale"&&(t.value=n.detail.newValue)};return e.onMounted(()=>{t.value=localStorage.locale,window.addEventListener("storage",l)}),e.onUnmounted(()=>{window.removeEventListener("resize",l)}),(n,o)=>(e.openBlock(),e.createElementBlock("div",kl,[n.ua||n.label?(e.openBlock(),e.createElementBlock("div",yl,[e.createElementVNode("span",bl,e.toDisplayString(n.item[t.value]||n.ua||n.label),1),n.item?.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",xl,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"default",e.mergeProps(n.$attrs,{class:{"opacity-60":n.item.disabled}})),n.error?(e.openBlock(),e.createElementBlock("span",wl,e.toDisplayString(n.error),1)):e.createCommentVNode("",!0)]))}}),El={class:"w-full relative flex flex-row items-center gap-2"},vl={key:0,class:"text-red-500 text-[14px]"},Vl={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Bl=e.defineComponent({__name:"vs-layout-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(s){const t=s,l=e.computed(()=>t.columns??{container:12,label:3}),n=e.computed(()=>{const{container:i,label:c}=l.value;return!i||i<=0?0:Math.min(Math.max(c??0,0),i)/i}),o=e.computed(()=>t.item?.type==="html"||n.value<=0?!1:!!(t.ua||t.label)),a=e.computed(()=>{if(!o.value)return{};const i=`${n.value*100}%`;return{flexBasis:i,maxWidth:i}}),r=e.computed(()=>{const{container:i,label:c}=l.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 d=Math.max(i-Math.max(c??0,0),0)/i;if(!d)return{};const m=`${d*100}%`;return{flexBasis:m,maxWidth:m}});return(i,c)=>(e.openBlock(),e.createElementBlock("div",El,[o.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0",style:e.normalizeStyle(a.value)},[e.createTextVNode(e.toDisplayString(i.ua||i.label)+" ",1),i.item?.rules?.includes("required")&&(i.ua||i.label)?(e.openBlock(),e.createElementBlock("span",vl,"*")):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"flex-1 min-w-0",style:e.normalizeStyle(r.value)},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],4),i.error?(e.openBlock(),e.createElementBlock("span",Vl,e.toDisplayString(i.error),1)):e.createCommentVNode("",!0)]))}}),Cl={class:"w-full relative"},Nl={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Sl=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(s){return(t,l)=>(e.openBlock(),e.createElementBlock("div",Cl,[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)]))}}),$l={class:"flex-1 min-w-0"},Ml={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},Al={class:"truncate"},Fl={key:0,class:"text-red-500 text-[14px]"},Dl={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},Il={key:0,class:"mt-1 text-xs text-red-500"},Tl={default:_l,horizontal:Bl,inline:Sl,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(s){const t=s,l=e.ref("uk");e.computed(()=>(t.item??{})?.[l.value]??t.ua??t.label??"");const n=e.computed(()=>t.item?.description??""),o=e.computed(()=>Array.isArray(t.item?.rules)&&t.item.rules.includes("required")),a=e.computed(()=>(typeof t.error=="string"?t.error:"")??""),r=i=>{i.key==="locale"&&(l.value=i.newValue??"uk")};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(l.value=localStorage.locale)}catch{}window.addEventListener("storage",r)}),e.onUnmounted(()=>{window.removeEventListener("storage",r)}),(i,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":i.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(i.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",$l,[i.ua||i.label?(e.openBlock(),e.createElementBlock("p",Ml,[e.createElementVNode("span",Al,e.toDisplayString(i.item[l.value]||i.ua||i.label),1),o.value?(e.openBlock(),e.createElementBlock("span",Fl,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),n.value?(e.openBlock(),e.createElementBlock("p",Dl,e.toDisplayString(n.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),a.value?(e.openBlock(),e.createElementBlock("p",Il,e.toDisplayString(a.value),1)):e.createCommentVNode("",!0)],2))}})};function ie(s){return{inputClass:e.computed(()=>{const l=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${s?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return s?.size==="sm"?`${l}h-[32px]`:`${l}h-[38px]`})}}const Ll=["placeholder","disabled"],Ol=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(s){const t=s,{inputClass:l}=ie(t.style),n=e.useModel(s,"modelValue"),o=e.computed(()=>!!t.disabled),a=e.computed(()=>t.placeholder??"");return(r,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":i[0]||(i[0]=c=>n.value=c),placeholder:a.value,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(l),{"!border-red-600":r.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Ll)),[[e.vModelText,n.value]])}}),Rl=["placeholder","disabled"],Se=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(s){const t=s,{inputClass:l}=ie(t.style),n=e.useModel(s,"modelValue"),o=e.computed(()=>!!t.disabled),a=e.computed(()=>t.placeholder??"");function r(){typeof n.value=="string"&&(n.value=n.value.trim())}return(i,c)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":c[0]||(c[0]=d=>n.value=d),placeholder:a.value,disabled:o.value,onBlur:r,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.customClass,e.unref(l),{"!border-red-600":i.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Rl)),[[e.vModelText,n.value]])}}),zl=["placeholder","disabled","min","max"],St=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(s){const t=s,{inputClass:l}=ie(t.style),n=e.useModel(s,"modelValue"),o=e.computed(()=>!!t.disabled);return(a,r)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":r[0]||(r[0]=i=>n.value=i),placeholder:a.placeholder,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(l)]]),style:{border:"1px solid #CFD9E0"},min:a.min,max:a.max},null,10,zl)),[[e.vModelText,n.value]])}}),Z=(s,t)=>{const l=s.__vccOpts||s;for(const[n,o]of t)l[n]=o;return l},jl={},Ul={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 Pl(s,t){return e.openBlock(),e.createElementBlock("svg",Ul,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)])])}const Hl=Z(jl,[["render",Pl]]),Gl={class:"flex items-center gap-[4px]"},Kl=["value","id","disabled"],ql=["for"],Zl={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},Wl=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(s,{emit:t}){const l=t,n=s,o=e.computed({get:()=>n.modelValue,set:r=>l("update:modelValue",r)}),a=e.computed(()=>!!n.disabled);return(r,i)=>(e.openBlock(),e.createElementBlock("div",Gl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:r.value,"onUpdate:modelValue":i[0]||(i[0]=c=>o.value=c),class:e.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":a.value}]),id:r.id,disabled:a.value},null,10,Kl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:r.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":a.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",r.error?"border-red-600":""]])},[e.createVNode(Hl,{height:"12",width:"12"})],2),e.createElementVNode("span",Zl,[e.renderSlot(r.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(r.label),1)])])],10,ql)]))}}),Yl=["name","value","disabled"],Jl={class:"flex items-center gap-[6px] text-[14px]"},Xl={key:0,class:"text-[16px]"},Ql=["src"],en=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(s,{emit:t}){const l=s,n=t,o=e.computed({get:()=>l.modelValue,set:i=>{n("update:modelValue",i)}}),a=e.computed(()=>Array.isArray(o.value)?o.value.includes(l.value):o.value===!0||o.value===l.value),r=e.computed(()=>l.style?.size==="xs"?"p-1.5 text-xs":l.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(i,c)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[r.value,a.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"hidden",name:i.id,value:i.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),disabled:i.disabled},null,8,Yl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("span",Jl,[i.icon||i.imgUrl?(e.openBlock(),e.createElementBlock("span",Xl,[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,Ql)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(i.label),1)])])],2))}}),tn={class:"flex items-center"},st=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(s,{emit:t}){const l=s,n=t,o=`radio-${Math.floor(Math.random()*1e4)}`,a=e.computed({get:()=>Array.isArray(l.modelValue)?Array.isArray(l.modelValue)&&l.modelValue.includes(l.value):l.modelValue,set:i=>{if(Array.isArray(l.modelValue)){let c=[...l.modelValue];i?c.includes(l.value)||c.push(l.value):c=c.filter(d=>d!==l.value),n("update:modelValue",c)}else n("update:modelValue",i)}}),r=e.ref(`vs-checkbox-${l.view||"default"}`);return(i,c)=>(e.openBlock(),e.createElementBlock("div",tn,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value==="vs-checkbox-buttons"?e.unref(en):e.unref(Wl)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:a.value,"onUpdate:modelValue":c[0]||(c[0]=d=>a.value=d),id:o,icon:i.icon,imgUrl:i.imgUrl,style:e.normalizeStyle(i.style),error:i.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),ln={},nn={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 on(s,t){return e.openBlock(),e.createElementBlock("svg",nn,[...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 an=Z(ln,[["render",on]]),sn={},rn={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 cn(s,t){return e.openBlock(),e.createElementBlock("svg",rn,[...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 rt=Z(sn,[["render",cn]]),dn={},un={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 pn(s,t){return e.openBlock(),e.createElementBlock("svg",un,[...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 hn=Z(dn,[["render",pn]]),mn={key:0,class:"flex items-start gap-x-1"},fn={key:0,class:"text-red-500 text-[14px]"},gn=["title"],kn=["disabled"],it=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(s){const t=s,l=e.useModel(s,"modelValue");return(n,o)=>t.view==="checkbox"?(e.openBlock(),e.createElementBlock("div",mn,[e.createVNode(st,{modelValue:l.value,"onUpdate:modelValue":o[0]||(o[0]=a=>l.value=a),label:n.text,error:n.error||""},null,8,["modelValue","label","error"]),n.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",fn,"*")):e.createCommentVNode("",!0),n.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:n.i,onClick:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(hn),{class:"text-gray-500 w-[14px] h-[14px]"})],8,gn)):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",[l.value?`bg-${n.style?.primaryColor||"blue"}-500`:"bg-stone-200",n.customClass]]),disabled:n.disabled,onClick:o[2]||(o[2]=a=>l.value=!l.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",[l.value?"translate-x-4":"translate-x-0"]])},null,2)],10,kn))}}),yn=["id","innerHTML"],ct=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(s){return(t,l)=>(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,yn))}}),bn=["placeholder","disabled","name"],dt=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(s){const t=s,{inputClass:l}=ie(t.style),n=e.useModel(s,"modelValue"),o=e.ref(null);let a=null;return e.onMounted(async()=>{if(o.value){const{default:r}=await Promise.resolve().then(()=>gl);a=r(o.value,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),a.on("accept",()=>{n.value=t.unmask?a.unmaskedValue:a.value}),a.on("complete",()=>{n.value=t.unmask?a.unmaskedValue:a.value}),a.value=n.value??""}}),e.onBeforeUnmount(()=>{a?.destroy()}),e.watch(()=>t.mask,r=>{a&&a.updateOptions({mask:r,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),e.watch(n,r=>{a&&a.unmaskedValue!==r&&(a.value=r||"")}),(r,i)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:r.placeholder,disabled:r.disabled,name:r.name,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(l)]]),style:{border:"1px solid #CFD9E0"}},null,10,bn))}}),xn={class:"relative w-full bg-white rounded-lg"},wn=["placeholder","disabled"],ut=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(s){const t=s,{inputClass:l}=ie(t.style),n=e.useModel(s,"modelValue");return(o,a)=>(e.openBlock(),e.createElementBlock("div",xn,[a[1]||(a[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":a[0]||(a[0]=r=>n.value=r),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(l),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,wn),[[e.vModelText,n.value]])]))}}),_n={class:"relative w-full bg-white rounded-lg"},En=["value","placeholder","disabled"],pt=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(s){const t=s,{inputClass:l}=ie(t.style),n=e.useModel(s,"modelValue"),o=e.computed(()=>n.value?n.value.startsWith("+")?n.value.slice(1):n.value:""),a=i=>{let{value:c}=i.target;c=c.replace(/^\+/,""),n.value=c?`+${c}`:""},r=i=>{const c=i,{data:d,inputType:m}=c;m&&m.startsWith("delete")||d&&/\D/.test(d)&&c.preventDefault()};return e.watch(()=>n.value,i=>{i&&!i.startsWith("+")?n.value=`+${i.replace(/^\+/,"")}`:i||(n.value="")},{immediate:!0}),(i,c)=>(e.openBlock(),e.createElementBlock("div",_n,[c[0]||(c[0]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"stroke-gray-500 transition-all"},[e.createElementVNode("path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"})])],-1)),c[1]||(c[1]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[30px] text-gray-500 select-none pointer-events-none"}," + ",-1)),e.createElementVNode("input",{type:"tel",value:o.value,onInput:a,onBeforeinput:r,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(l),{"!border-red-600":i.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,En)]))}}),vn=["value","disabled"],Vn={class:"text-[13px] text-gray-700"},Bn=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(s){const t=s,l=e.useModel(s,"modelValue"),n=e.computed(()=>!!t.disabled);return(o,a)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center gap-0",[t.customClass,n.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=r=>l.value=r),type:"radio",value:t.value,disabled:n.value,class:"hidden"},null,8,vn),[[e.vModelRadio,l.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`,n.value?"opacity-50 cursor-not-allowed":""]])},[l.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",Vn,e.toDisplayString(t.text),1)],2))}}),Cn=["value","disabled"],Nn={class:"text-[13px] text-gray-700"},Sn={"vs-input-radio-default":Bn,"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(s){const t=s,l=e.useModel(s,"modelValue"),n=e.computed(()=>!!t.disabled);return(o,a)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[l.value==t.value?`ring-2 ring-ring ring-${t.style?.primaryColor||"blue"}-500`:"",t.customClass,n.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=r=>l.value=r),type:"radio",value:t.value,disabled:n.value,class:"hidden"},null,8,Cn),[[e.vModelRadio,l.value]]),e.createElementVNode("span",Nn,e.toDisplayString(t.text),1)],2))}})},ht=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(s){const t=s,l=e.useModel(s,"modelValue"),n=e.computed(()=>Sn[`vs-input-radio-${t.view}`]);return(o,a)=>(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,r=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.value),e.mergeProps({key:r?.id,text:r.text,value:r.id.toString(),checked:l.value===r.id,modelValue:l.value,"onUpdate:modelValue":a[0]||(a[0]=i=>l.value=i)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),$n={key:1,class:"w-full flex flex-col gap-4"},Mn={key:0,class:"text-sm font-medium text-muted-foreground my-2"},An="Без категорії",$t=Z(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(s,{emit:t}){const l=s,n=t,o=e.ref([]),a=e.reactive({}),r=w=>w?.value||w?.id||w?.text||w,i=w=>w.text||String(w),c=w=>`lg:col-span-${w||12}`,d=e.computed(()=>[l.position==="vertical"?"flex flex-col":"",l.colSpan?"grid":"flex justify-start"]),m=w=>w==null||w===""?null:typeof w=="string"||typeof w=="number"?w:String(w),f=e.computed(()=>{if(!l.group)return[];const w=new Map;o.value.forEach(h=>{const E=h[l.group],g=m(E);w.has(g)||w.set(g,[]),w.get(g)?.push(h)});const V=[];l.values?.length&&l.values.forEach(h=>{const E=m(h);V.push(E)});const k=new Set,b=h=>{const E=w.get(h)||[];if(!E.length)return null;const g=h===null?"group-null":`group-${String(h)}`,B=h===null?An:String(h);return k.add(h),{key:g,label:B,options:E}},y=[];return V.forEach(h=>{const E=b(h);E&&y.push(E)}),w.forEach((h,E)=>{if(k.has(E))return;const g=b(E);g&&y.push(g)}),y}),v=async()=>{try{const w=await fetch(`/api/suggest/${l.data}`).then(V=>V.json());o.value=w?.data||w}catch(w){console.error(w)}};return e.watch(()=>l.modelValue,w=>{if(typeof w=="boolean"&&o.value.length===1){const V=r(o.value[0]);a[V]=w}else if(Array.isArray(w)){const V=new Set(w);o.value.forEach(k=>{if(!k.disabled){const b=r(k);a[b]=V.has(b)}})}},{immediate:!0}),e.watch(a,()=>{if(!o.value.length){n("update:modelValue",null);return}const w=Object.entries(a).filter(([,V])=>V).map(([V])=>V);n("update:modelValue",w.length===0?[]:w)},{deep:!0}),e.onMounted(()=>{if(l.data)v().then(()=>{if(typeof l.modelValue=="boolean"&&o.value.length===1){const w=r(o.value[0]);a[w]=l.modelValue}else if(Array.isArray(l.modelValue)){const w=new Set(l.modelValue);o.value.forEach(V=>{if(!V.disabled){const k=r(V);a[k]=w.has(k)}})}});else if(o.value=l.options,typeof l.modelValue=="boolean"&&o.value.length===1){const w=r(o.value[0]);a[w]=l.modelValue}else if(Array.isArray(l.modelValue)){const w=new Set(l.modelValue);o.value.forEach(V=>{if(!V.disabled){const k=r(V);a[k]=w.has(k)}})}}),(w,V)=>l.group?(e.openBlock(),e.createElementBlock("div",$n,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,k=>(e.openBlock(),e.createElementBlock("div",{key:k.key,class:"flex flex-col gap-2"},[k.label?(e.openBlock(),e.createElementBlock("span",Mn,e.toDisplayString(k.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.options,b=>(e.openBlock(),e.createBlock(st,{modelValue:a[r(b)],"onUpdate:modelValue":y=>a[r(b)]=y,value:r(b),class:e.normalizeClass(c(w.colSpan)),disabled:l.disabled||b.disabled,label:i(b),key:`${k.key}-${r(b)}`,icon:b?.icon,imgUrl:b?.imgUrl,option:b,view:w.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["p-0 w-full gap-[10px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,k=>(e.openBlock(),e.createBlock(st,{modelValue:a[r(k)],"onUpdate:modelValue":b=>a[r(k)]=b,value:r(k),class:e.normalizeClass(c(w.colSpan)),disabled:l.disabled||k.disabled,label:i(k),key:r(k),icon:k?.icon,imgUrl:k?.imgUrl,option:k,view:w.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-cf0478ce"]]),Fn=["type","placeholder","disabled"],Mt=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(s,{emit:t}){const l=s;function n(m){return m?l.mode==="datetime"?(m.includes("T")?m:null)||m+(m.includes(" ")?"":"T00:00"):m?.split(" ")[0]:null}const{inputClass:o}=ie(l.style),a=t,r=e.computed({get:()=>n(l.modelValue),set:m=>a("update:modelValue",m)}),i=e.computed(()=>l.mode==="datetime"?"datetime-local":l.mode),c=e.computed(()=>!!l.disabled),d=e.computed(()=>l.placeholder??"");return(m,f)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":f[0]||(f[0]=v=>r.value=v),placeholder:d.value,disabled:c.value,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[m.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Fn)),[[e.vModelDynamic,r.value]])}}),Dn=(s,t)=>{if(!t||!Object.keys(t).length)return s;const[l,n=""]=s.split("?"),o=new URLSearchParams(n);Object.entries(t).forEach(([r,i])=>{i==null||i===""||o.set(r,String(i))});const a=o.toString();return a?`${l}?${a}`:l},At=async(s,t={})=>{try{const l=new FormData;l.append("unique","true"),l.append("file",s);const{api:n,id:o="1",form:a="form",table:r="table",customParams:i}=t,c=n||`/file/upload/uploads?id=${o||""}&form=${a||""}&table=${r||""}`,d=Dn(c,i);return(await fetch(d,{method:"POST",body:l}).then(f=>f.json()))?.result}catch(l){return ee.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",l),null}},In=async s=>{try{return await fetch(`file/delete${s}`),!0}catch(t){return console.error(t),!1}},Ft=async s=>{try{const t=await fetch(`file/download/files/uploads${s}`),l=await t.arrayBuffer(),n=t.headers["content-type"],o=new TextDecoder("utf-8").decode(l),a=new Blob([o],{type:n}),r=document.createElement("a");r.setAttribute("download",s),r.href=window.URL.createObjectURL(a),r.click()}catch(t){console.error(t.message)}},Tn={},Ln={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 On(s,t){return e.openBlock(),e.createElementBlock("svg",Ln,[...t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)])])}const ye=Z(Tn,[["render",On]]),Rn={},zn={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 jn(s,t,l,n,o,a){return e.openBlock(),e.createElementBlock("svg",zn,[...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 Un=Z(Rn,[["render",jn]]),Pn={},Hn={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 Gn(s,t,l,n,o,a){return e.openBlock(),e.createElementBlock("svg",Hn,[...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 Kn=Z(Pn,[["render",Gn]]),qn={},Zn={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 Wn(s,t){return e.openBlock(),e.createElementBlock("svg",Zn,[...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 Dt=Z(qn,[["render",Wn]]),Yn={},Jn={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 Xn(s,t,l,n,o,a){return e.openBlock(),e.createElementBlock("svg",Jn,[...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 Qn=Z(Yn,[["render",Xn]]),eo={},to={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 lo(s,t,l,n,o,a){return e.openBlock(),e.createElementBlock("svg",to,[...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 no=Z(eo,[["render",lo]]),oo=s=>{if(!s)return"";const t=s?.split(".");return t[t.length-1]},ao=s=>{const t=oo(s),l={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 l.imageFormat.includes(t)?"img":l.sheetsFormat.includes(t)?Kn:l.textsFormat.includes(t)?no:l.documentsFormat.includes(t)?Un:l.archivesFormat.includes(t)?Qn:Dt},so={},ro={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 io(s,t){return e.openBlock(),e.createElementBlock("svg",ro,[...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 $e=Z(so,[["render",io]]),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(s,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 It=Z(co,[["render",po]]),ho=["title"],mo={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},Tt=Z(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(s){const t=e.useModel(s,"value"),l=e.useModel(s,"item"),n=s;return(o,a)=>(e.openBlock(),e.createElementBlock("div",{title:l.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(ao)(l.value)),{src:l.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:a[0]||(a[0]=r=>e.unref(Ft)(l.value))},null,8,["src"])),e.createElementVNode("div",mo,[e.createElementVNode("button",{type:"button",onClick:a[1]||(a[1]=r=>{e.unref(In)(l.value),t.value=n.multiple?t.value?.filter(i=>i!==l.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($e,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:a[2]||(a[2]=r=>e.unref(Ft)(l.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(It,{class:"w-4 h-4"})])])],8,ho))}}),[["__scopeId","data-v-b61a9d9a"]]),fo={class:"flex items-center gap-x-2"},go=["accept","multiple","disabled"],ko={key:1,class:"flex items-center flex-wrap gap-2"},yo={key:1,class:"loader"},bo={key:1,class:"loader"},Lt=Z(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(s,{emit:t}){const l=s,n=e.useModel(s,"modelValue"),o=t,a=e.ref(null),r=e.ref(!1),i=e.inject("values"),c=e.computed(()=>l.format?l.format.split(",").map(h=>h.trim().toLowerCase()).filter(Boolean):[]),d=h=>Array.isArray(n.value)&&n.value[h]||"",m=h=>{if(l.max_size&&h.size>l.max_size*1024*1024){const E=(h.size/1048576).toFixed(2);return ee.notify({type:"error",title:"Помилка!",message:`Файл "${h.name}" занадто великий. Максимальний розмір: ${l.max_size} МБ, розмір файлу: ${E} МБ`,position:"right-bottom"}),!1}return!0},f=h=>{if(!c.value.length)return!0;const E=`.${h.name.split(".").pop()?.toLowerCase()||""}`,g=c.value.includes(E);return g||ee.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${h.name}". Дозволені формати: ${c.value.join(", ")}`,position:"right-bottom"}),g},v=e.computed(()=>{const h={},E=[];if(!l.customParams?.length)return{params:h,missingSources:E};const g=i?.value??{};return l.customParams.forEach(B=>{if(!B)return;const[M,S]=B.split("="),T=M?.trim(),R=S?.trim();if(!T||!R)return;const P=g[R];if(P==null||P===""){E.push(R);return}h[T]=P}),{params:h,missingSources:E}}),w=()=>{const h=v.value.params;return{api:l.api,customParams:Object.keys(h).length?h:void 0}},V=()=>{const h=v.value.missingSources;if(!h.length)return!0;const E=h.join(", ");return ee.notify({type:"warning",title:"Заповніть поля",message:`Поля (${E}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},k=h=>{ee.notify({type:"error",title:"Помилка завантаження",message:h||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},b=()=>{l.disabled||r.value||V()&&a.value?.click()},y=async h=>{const{files:E}=h.target;if(!E||E.length===0)return;if(!V()){a.value&&(a.value.value="");return}const g=Array.from(E);if(l.max_size&&g.filter(S=>!m(S)).length>0){a.value&&(a.value.value="");return}if(g.filter(M=>!f(M)).length>0){a.value&&(a.value.value="");return}r.value=!0;try{if(l.multiple){const M=Array.from(E).map(async P=>await At(P,w())),S=await Promise.all(M),R=S.filter(P=>P!==null).map(P=>P?.file_path).filter(Boolean);if(R.length===0){k();return}R.length<S.length&&k("Деякі файли не вдалося завантажити. Перевірте їх та спробуйте знову."),n.value=[...n.value||[],...R],o("change",n.value)}else{const M=E[0],S=await At(M,w());if(!S?.file_path){k();return}n.value=S?.file_path,o("change",n.value||"")}}catch(M){const S=M?.message||void 0;k(S)}finally{r.value=!1,a.value&&(a.value.value="")}};return(h,E)=>(e.openBlock(),e.createElementBlock("div",fo,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:a,type:"file",accept:l.format,multiple:h.multiple,onChange:y,disabled:r.value||h.disabled},null,40,go),!h.multiple&&n.value?(e.openBlock(),e.createBlock(Tt,{key:0,item:n.value,"onUpdate:item":E[0]||(E[0]=g=>n.value=g),value:n.value,"onUpdate:value":E[1]||(E[1]=g=>n.value=g)},null,8,["item","value"])):h.multiple?(e.openBlock(),e.createElementBlock("div",ko,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(g,B)=>(e.openBlock(),e.createBlock(Tt,{multiple:h.multiple,key:B,value:n.value,"onUpdate:value":E[2]||(E[2]=M=>n.value=M),item:d(B)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:b,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||r.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[r.value?(e.openBlock(),e.createElementBlock("div",yo)):(e.openBlock(),e.createBlock(ye,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),h.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:b,class:e.normalizeClass([h.disabled||r.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"])},[r.value?(e.openBlock(),e.createElementBlock("div",bo)):(e.openBlock(),e.createBlock(ye,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-08fe911b"]]),xo={class:"max-w-[55vw]"},wo={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},_o={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},Eo={class:"px-[5px]"},vo={class:""},He=e.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(s){const t=s,l=e.computed(()=>{try{return new Date(t.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function n(o){if(o<1024)return`${o} B`;const a=o/1024;return a<1024?`${a.toFixed(2)} KB`:`${(a/1024).toFixed(2)} MB`}return(o,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[a[1]||(a[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",xo,[e.createElementVNode("p",wo,e.toDisplayString(o.item?.uploaded_name),1),e.createElementVNode("p",_o,[e.createElementVNode("span",null,e.toDisplayString(o.item?.username),1),e.withDirectives(e.createElementVNode("span",Eo,"|",512),[[e.vShow,o.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(l.value),1),a[0]||(a[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",vo,e.toDisplayString(n(o.item?.size)),1)])])],64))}}),Vo={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},Bo={key:0,class:"flex w-full gap-x-3 items-center"},Co={key:1,class:"flex gap-x-3 w-full items-center"},No={key:2,class:"flex gap-x-3 w-full items-center"},So=["href"],$o={key:3,class:"flex gap-x-3 w-full items-center"},Mo={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},Ao={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"},Fo={class:"inline-block"},Do={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(s,{emit:t}){const l=s,n=t;function o(m){return["pdf","json"].includes(m.ext)}function a(m){return["ppt","pptx","doc","docx","xls","xlsx"].includes(m.ext)}function r(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(`${l.prefix}/widget/file/${l.item.entity_id}/${l.item.file_id}`),n("update")}catch(m){console.error(m)}}function c(){n("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function d(m){(l.item.ext==="jpg"||l.item.ext==="png")&&n("openLightbox",{item:l.item,index:m})}return(m,f)=>(e.openBlock(),e.createElementBlock("div",Vo,[m.item.ext==="jpg"||m.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",Bo,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:f[0]||(f[0]=v=>d(m.index))},[e.createVNode(He,{item:m.item},null,8,["item"])])])):o(m.item)?(e.openBlock(),e.createElementBlock("div",Co,[e.createVNode(He,{item:m.item},null,8,["item"])])):a(m.item)?(e.openBlock(),e.createElementBlock("div",No,[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(He,{item:m.item},null,8,["item"])],8,So)])):(e.openBlock(),e.createElementBlock("div",$o,[e.createVNode(He,{item:m.item},null,8,["item"])])),e.createElementVNode("div",Mo,[e.createElementVNode("div",Ao,[e.createElementVNode("div",Fo,[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]=v=>r(m.item))},[e.createVNode(It,{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",Do,[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]=v=>c())},[e.createVNode($e,{height:"14",width:"14"})])])])])]))}}),To={},Lo={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 Oo(s,t){return e.openBlock(),e.createElementBlock("svg",Lo,[...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 Ro=Z(To,[["render",Oo]]),zo={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},jo={class:"flex w-full mb-[12px] items-center gap-x-2"},Uo={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},Po={class1:"ml-auto"},Ho={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"},Go={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},Ko={class:"relative"},qo={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"},Zo={key:0},Ot=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(s,{emit:t}){const l=s,n=e.inject("form"),o=e.computed(()=>n.value.formId),a=e.ref(!1),r=e.ref(0),i=t,c=e.ref(!1),d=e.ref({}),m=e.ref([]),f=e.ref(""),v=e.computed(()=>Array.isArray(m.value)?m.value.filter(E=>E.ext==="jpg"||E.ext==="png").map(E=>E?.file_path):[]),w=e.computed(()=>f.value===""?m.value:m.value.filter(E=>E?.uploaded_name?.includes(f.value))),V=E=>{const g=v.value.findIndex(B=>B===E.item.file_path);g!==-1&&(a.value=!0,r.value=g)},k=async()=>{try{const E=await fetch(`${l.prefix}/widget/file/${o.value}`).then(g=>g.json());m.value=E?.rows}catch(E){console.error(E)}},b=async E=>{await Promise.all(Array.from(E.target.files).map(async g=>{const B=new FormData;B.append("file",g);try{const M=`${l.prefix}/widget/file/${o.value}`,S=await fetch(M,{method:"POST",body:B});return S.ok?(i("update","file-list"),g):(ee.notify({type:S.status>=400&&S.status<500?"warning":"error",title:"Error",message:`Error code: ${S.status}`}),null)}catch(M){return ee.notify({type:"error",title:"Error",message:M.message||"Unknown error"}),console.error(M),null}})),await k()},y=E=>{const g={...E};return E.cancel||(g.cancel=()=>{c.value=!1}),E.updateListOnConfirm&&(g.confirm=async()=>{await E.confirm(),c.value=!1,k()}),g},h=E=>{d.value=y(E),c.value=!0};return e.watch(o,E=>{E&&k()}),e.onMounted(()=>{o.value&&k()}),(E,g)=>{const B=e.resolveComponent("Lightbox"),M=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",zo,[e.createElementVNode("div",jo,[e.createElementVNode("h2",Uo," Файлів: "+e.toDisplayString(m.value?.length),1),e.createElementVNode("div",Po,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:g[0]||(g[0]=S=>b(S))},null,32),e.createElementVNode("div",Ho,[e.createVNode(Ro,{height:"16",width:"16"})])])])]),m.value?.length>4?(e.openBlock(),e.createElementBlock("div",Go,[e.createElementVNode("div",null,[e.createElementVNode("div",Ko,[g[8]||(g[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":g[1]||(g[1]=S=>f.value=S),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[e.vModelText,f.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),m.value?.length?(e.openBlock(),e.createElementBlock("div",qo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,(S,T)=>(e.openBlock(),e.createBlock(Io,{key:T,prefix:E.prefix,item:S,index:T,onUpdate:g[2]||(g[2]=R=>E.$emit("update","file-list")),onOpenModal:g[3]||(g[3]=R=>h(R)),onOpenLightbox:g[4]||(g[4]=R=>V(R))},null,8,["prefix","item","index"]))),128)),w.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Zo,[...g[9]||(g[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])]))])):e.createCommentVNode("",!0),e.createVNode(B,{modelValue:a.value,"onUpdate:modelValue":g[5]||(g[5]=S=>a.value=S),startIndex:r.value,"onUpdate:index":g[6]||(g[6]=S=>r.value=S),images:v.value},null,8,["modelValue","startIndex","images"]),e.createVNode(M,e.mergeProps({modelValue:c.value,"onUpdate:modelValue":g[7]||(g[7]=S=>c.value=S),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),Wo={class:"flex items-center justify-between"},Yo={class:"text-[16px] text-gray-900 font-medium"},Jo={class:"grid gap-3"},Xo=Z(e.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(s){const t=s,l=e.ref(t.isOpen);return e.watch(()=>t.isOpen,n=>{l.value=n}),(n,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Wo,[e.createElementVNode("p",Yo,e.toDisplayString(s.title),1),e.createVNode(it,{modelValue:l.value,"onUpdate:modelValue":o[0]||(o[0]=a=>l.value=a),style:e.normalizeStyle(s.style)},null,8,["modelValue","style"])]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Jo,[e.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[e.vShow,l.value]])]),_:3})]))}}),[["__scopeId","data-v-00f2f0fc"]]),Qo={class:"text-[16px] text-gray-900 font-medium"},ea={class:"grid gap-3"},ta=Z(e.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(s){const t=s,l=e.ref(t.isOpen);return e.watch(()=>t.isOpen,n=>{l.value=n}),(n,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("button",{type:"button",onClick:o[0]||(o[0]=a=>l.value=!l.value),class:"flex items-center gap-2"},[e.createVNode(e.unref(an),{class:e.normalizeClass(["h-4 w-4 duration-300",[l.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",Qo,e.toDisplayString(s.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",ea,[e.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[e.vShow,l.value]])]),_:3})]))}}),[["__scopeId","data-v-78778cb5"]]),la={class:"flex items-center justify-between"},na={switcher:Xo,accordion:ta,default:e.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(s){return(t,l)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",la,[e.createElementVNode("p",null,e.toDisplayString(s.title),1)]),e.renderSlot(t.$slots,"default")]))}})},de={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},oa=(s,t)=>String(s)===String(t),aa=(s,t)=>String(s)!==String(t),sa=(s,t)=>s>t,ra=(s,t)=>s>=t,ia=(s,t)=>s<t,ca=(s,t)=>s<=t,da=(s,t)=>Array.isArray(t)&&t.length===2?s>=t[0]&&s<=t[1]:!1,ua=(s,t)=>String(s).startsWith(String(t)),pa=(s,t)=>String(s).endsWith(String(t)),ha=(s,t)=>String(s).includes(String(t)),ma=(s,t)=>Array.isArray(t)?t.includes(s):!1,fa=(s,t)=>Array.isArray(t)?!t.includes(s):!0,Rt=(s,t)=>{if(!t)return!0;switch(t?.[1]){case de.Equal:return oa(s,t?.[2]);case de.Inequal:return aa(s,t?.[2]);case de.Higer:return sa(s,t?.[2]);case de.HigerOrEqual:return ra(s,t?.[2]);case de.Lower:return ia(s,t?.[2]);case de.LowerOrEqual:return ca(s,t?.[2]);case de.Between:return da(s,t?.[2]);case de.StartWith:return ua(s,t?.[2]);case de.EndWith:return pa(s,t?.[2]);case de.Contain:return ha(s,t?.[2]);case de.In:return ma(s,t?.[2]);case de.NotIn:return fa(s,t?.[2]);default:return!0}},zt=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(s){const t=s,l=e.inject("values",e.ref({})),n=e.inject("form"),o=e.computed(()=>t.schema?.filter(i=>{const c=i?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,m=t.name?l.value?.[t.name]?.[d]??l.value?.[d]:l.value?.[d];return Rt(m,c)})),a=e.computed(()=>na[t.view]),r=e.computed(()=>{if(l.value||(l.value={}),!t.name)return l.value;const i=l.value[t.name];if(i)return i;const c={};return l.value={...l.value,[t.name]:c},c});return(i,c)=>s.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),{key:0,title:s.title,style:e.normalizeStyle(s.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,d=>(e.openBlock(),e.createBlock(el,e.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:r.value[d.name],"onUpdate:modelValue":m=>r.value[d.name]=m,style:s.style,error:e.unref(n)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),ga=["aria-expanded","data-focus"],ka={key:0,class:"flex flex-wrap items-center gap-1 overflow-y-auto min-w-0 flex-1"},ya={class:"flex items-center min-w-0"},ba=["title"],xa=["innerHTML"],wa=["onClick"],_a={class:"flex-1 min-w-[2px]"},Ea=["placeholder"],va=["title"],Va=["innerHTML"],Ba={key:2,class:"flex-1 min-w-[2px]"},Ca=["placeholder"],Na={class:"flex items-center shrink-0"},Sa=["disabled"],$a=["disabled","title"],Ma=["aria-disabled","onClick"],Aa=["innerHTML"],Fa={key:1,class:"px-3 py-2 text-center text-gray-500"},Da=["disabled"],mt=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(s,{emit:t}){const l=s,n=t,o=e.computed(()=>l.multiple),a=e.computed(()=>l.disabled);ie(l.style);const r=e.computed({get:()=>l.modelValue,set:_=>n("update:modelValue",_)});!r.value&&l.defaultValue&&(r.value=l.defaultValue);const i=e.ref(null),c=e.ref(null),d=e.ref(null),m=e.ref(null),f=e.ref(!1),v=e.ref(!1),w=e.ref(null),V=e.ref([]),k=e.ref(-1),b=e.ref([]),y=e.ref(""),h=e.ref(null),E=e.ref("bottom"),g=e.ref({}),B=e.ref([]),M=e.computed(()=>{if(!B.value.length)return[];const _=V.value,C=new Map(_.map(N=>[N.id?.toString(),N]));return B.value.map(N=>C.get(N?.toString())).filter(N=>!!N)}),S=e.computed(()=>l.placeholder||"Select..."),T=e.computed(()=>I(w.value));e.computed(()=>o.value?!B.value.length&&y.value==="":!T.value&&y.value==="");const R=e.computed(()=>a.value?!1:o.value?B.value.length>0:!!r.value),P=_=>o.value?B.value.some(C=>C?.toString()===_?.toString()):r.value?.toString()===_?.toString(),F=e.computed(()=>{let _=V.value??[];if(!l.data&&y.value.trim()!==""){const C=y.value.toLowerCase();_=_.filter(N=>{const H=I(N).toLowerCase(),p=N.text?.toLowerCase?.()||"";return H.includes(C)||p.includes(C)})}if(o.value&&B.value.length){const C=new Set(B.value.map(N=>N?.toString()));_=_.filter(N=>!C.has(N.id?.toString()))}return _}),X=e.inject("values"),K=/\{\{\s*([^}]+?)\s*\}\}/g,Q=_=>(_?String(_):"").replace(/<[^>]*>/g,"").trim(),z=e.computed(()=>l.slot??l?.optionTemplate??""),L=_=>{if(!_)return"";const C=z.value;return C?C.replace(K,(N,H)=>{const p=H.trim(),u=_[p];return u!=null?String(u):""}):_.text??""},I=_=>{if(!_)return"";if(!z.value)return _.text??"";const N=L(_);return Q(N)||_.text||""},U=_=>{l.set&&X?.value&&Object.entries(l.set).forEach(([C,N])=>{if(!C)return;const H=_?_[N]:null;X.value[C]=H??null})},J=e.computed(()=>l.parent?X?.value?.[l.parent]?.toString()??null:null),re=async _=>{if(!l.data){let C=l.options??[];if(_?.trim()){const N=_.toLowerCase();C=C.filter(H=>{const p=I(H).toLowerCase(),u=H.text?.toLowerCase?.()||"";return p.includes(N)||u.includes(N)})}return C}try{const C=l.host??"",N=l.prefix??"api",H=l.api??`/${N}/suggest/${l.data}`,p=`${C}${H}`,u=new URLSearchParams;return u.set("json","1"),_&&u.set("key",_),J.value!==void 0&&J.value!==null&&J.value!==""&&u.set("parent",J.value),(await fetch(`${p}?${u.toString()}`).then($=>$.json()))?.data??[]}catch{return[]}},ue=async()=>{l.data?V.value=await re(y.value):V.value=l.options?[...l.options]:[]},A=async _=>{if(_==null)return null;const C=V.value?.find(N=>N?.id?.toString()===String(_));if(C)return C;if(l.data)try{const N=l.host??"",H=l.prefix??"api",p=l.api??`/${H}/suggest/${l.data}`,u=`${N}${p}`,x=new URLSearchParams;return x.set("json","1"),x.set("val",String(_)),J.value!==void 0&&J.value!==null&&J.value!==""&&x.set("parent",J.value),((await fetch(`${u}?${x.toString()}`).then(j=>j.json()))?.data??[])?.[0]??null}catch{return null}return null},le=async _=>{const C=new Set(V.value.map(H=>H.id?.toString())),N=_.filter(H=>!C.has(H?.toString()));N.length&&await N.reduce(async(H,p)=>{await H;const u=await A(p);u&&V.value.push(u)},Promise.resolve())},he=async()=>{a.value||(f.value=!0,await ue(),await e.nextTick(()=>{pe(),h.value?.focus(),F.value.length?k.value=0:k.value=-1}))},ae=()=>{f.value=!1,k.value=-1},wt=async _=>{if(a.value)return;!f.value?await he():ae()},Je=async()=>{f.value?h.value?.focus():await he()},_t=()=>{o.value?(B.value=[],r.value=[],n("change",[]),ve(null,[])):(w.value=null,r.value=null,n("change",null),ve(null,null)),U(null),y.value="",e.nextTick(()=>h.value?.focus())},Et=_=>{o.value&&(B.value=B.value.filter(C=>C?.toString()!==_?.toString()),r.value=[...B.value],n("change",r.value),ve(null),e.nextTick(()=>h.value?.focus()))},ve=(_,C)=>{const N=C??(o.value?[...B.value]:_?.id??null);n("value-selected",{name:l.name,value:N,option:_})},Ae=_=>{o.value?(P(_.id)||(B.value=[...B.value,_.id],r.value=[...B.value],n("change",r.value),ve(_)),y.value="",e.nextTick(()=>{h.value?.focus(),k.value=Math.min(k.value,F.value.length-1)}),U(null)):(w.value=_,r.value=_.id,n("change",r.value),ve(_),y.value="",ae(),U(_))},vt=_=>{P(_.id)||Ae(_)},Fe=(_,C)=>{if(!_||!C)return;const N=_.offsetTop,H=N+_.offsetHeight,p=C.scrollTop,u=p+C.clientHeight;let x=C.scrollTop;N<p?x=N-80:H>u&&(x=H-C.clientHeight+4);const $=C;$.scrollTop=x},Ue=_=>{let C=_.parentElement;for(;C;){if(C.classList.contains("ui-dialog__content"))return C;const N=window.getComputedStyle(C),H=N.overflow+N.overflowY+N.overflowX;if(H.includes("auto")||H.includes("scroll")||C===document.body||C===document.documentElement)return C;C=C.parentElement}return document.body},pe=()=>{if(!c.value)return;const _=c.value.getBoundingClientRect(),C=window.innerHeight||document.documentElement.clientHeight,N=window.innerWidth||document.documentElement.clientWidth,H=8,p=8,u=l.maxHeight||300,x=C-_.bottom-p-H,$=_.top-p-H,D=x>=$,j=Math.max(N-H*2,0);let{width:Y}=_;j>0&&Y>j&&(Y=j);let{left:te}=_;te+Y+H>N&&(te=N-Y-H),te=Math.max(te,H);const se=Math.min(u,Math.max(D?x:$,50));E.value=D?"bottom":"top",g.value={position:"fixed",left:`${te}px`,width:`${Y}px`,minWidth:"300px",maxHeight:`${se}px`,transform:D?"none":"translateY(-100%)",top:D?`${_.bottom+p}px`:`${_.top-p}px`}},Xe=async _=>{a.value||!f.value&&(_.key==="ArrowDown"||_.key==="ArrowUp")&&(_.preventDefault(),await he())},De=_=>{if(!f.value)return;const{key:C}=_;if(C==="ArrowDown")_.preventDefault(),k.value+1<F.value.length&&(k.value+=1,Fe(b.value[k.value],d.value));else if(C==="ArrowUp")_.preventDefault(),k.value>0&&(k.value-=1,Fe(b.value[k.value],d.value));else if(C==="Enter"){_.preventDefault();const N=F.value[k.value];N&&Ae(N),h.value?.blur()}else C==="Escape"?(_.preventDefault(),ae()):C==="Backspace"?o.value&&y.value===""&&B.value.length&&(B.value=B.value.slice(0,-1),r.value=[...B.value],n("change",r.value)):C==="Home"?(k.value=0,Fe(b.value[0],d.value)):C==="End"?(k.value=F.value.length-1,Fe(b.value[k.value],d.value)):C==="Tab"&&ae()},Qe=()=>{a.value||(v.value=!0)},Ve=()=>{v.value=!1,y.value=""},Be=_=>{_.key==="Escape"&&f.value&&ae()},et=_=>{const C=_.target;i.value?.contains(C)||m.value?.contains(C)||ae()},tt=_=>{f.value&&d.value&&!d.value.contains(_.target)&&pe()},lt=()=>{f.value&&pe()},nt=()=>{f.value&&pe()};e.watch(()=>l.options,_=>{_?.length&&(V.value=[..._],ke())},{immediate:!0});async function ke(){if(o.value)Array.isArray(r.value)?B.value=[...r.value]:(B.value=r.value==null?[]:[r.value],r.value=[...B.value]),l.data&&B.value.length&&(await le(B.value),await e.nextTick());else{if(Array.isArray(r.value)){const _=r.value[0]??null;r.value=_??null}r.value!=null&&(w.value=await A(r.value)),U(w.value??null)}}e.watch(r,()=>{ke()}),e.onMounted(async()=>{addEventListener("keydown",Be),addEventListener("scroll",tt,!0),addEventListener("resize",lt),document.addEventListener("click",et,!0),c.value&&Ue(c.value).addEventListener("scroll",nt,!0),l.options?.length&&!l.data?V.value=[...l.options]:l.data&&(V.value=await re("")),await ke(),at.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",Be),removeEventListener("scroll",tt,!0),removeEventListener("resize",lt),document.removeEventListener("click",et,!0),c.value&&Ue(c.value).removeEventListener("scroll",nt,!0)});const Ce=e.ref(!1),xe=e.ref({}),we=e.ref([]),Ne=e.ref(null);async function Vt(){if(!l.add?.token||Ne?.value.validate())return;const C=l.add.api??`/api/table/${l.add.token}`,{id:N}=await fetch(C,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(xe.value)}).then(H=>H.json());if(!l.options?.length&&l.data){const H=await fetch(`${l.api??`/api/suggest/${l.data}`}?val=${N}`).then(p=>p.json());w.value=H[0],V.value.push(H[0]),r.value=N}Ce.value=!1,ee.notify({title:"Success!",message:"Object created."})}async function Bt(){if(!l.add)return null;const _=await fetch(`/api/template/form/${l.add.form}`).then(C=>C.json());return we.value=_.schema,Ce.value=!0,null}function ot(_,C=200){let N;return(...H)=>{N&&clearTimeout(N),N=window.setTimeout(()=>_(...H),C)}}const Ct=ot(async _=>{V.value=await re(_)},200);e.watch(y,_=>{l.data&&Ct(_.trim())}),e.watch(()=>l.options,_=>{!l.data&&_?.length&&(V.value=[..._],ke())},{immediate:!0}),e.watch(()=>l.parent??l.parentValue,()=>{l.data&&ue()});const at=e.ref(!0);return e.watch(J,async()=>{if(l.data&&(at.value||(o.value?(B.value=[],r.value=[],n("change",[])):(w.value=null,r.value=null,n("change",null))),await ue(),l.auto===1&&J.value&&V.value.length>0)){const _=V.value[0];_&&Ae(_)}}),(_,C)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(ee.VsModal),{visible:Ce.value,"onUpdate:visible":C[1]||(C[1]=N=>Ce.value=N),title:"Додати",buttonText:"Додати",onDone:Vt,teleport:_.teleport},{default:e.withCtx(()=>[e.createVNode(be,{schema:we.value,modelValue:xe.value,"onUpdate:modelValue":C[0]||(C[0]=N=>xe.value=N),ref_key:"addForm",ref:Ne},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:C[5]||(C[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",l.customClass])},[C[10]||(C[10]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),C[11]||(C[11]=e.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",f.value||v.value?"border-blue-500 ring-1 ring-blue-500":"",a.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":f.value,"aria-haspopup":"listbox",onKeydown:Xe,onClick:Je,"data-focus":f.value||v.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:c},[o.value?(e.openBlock(),e.createElementBlock("div",ka,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,N=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border max-w-full",key:N.id},[e.createElementVNode("div",ya,[N?.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:N?.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:I(N)},[z.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:L(N)},null,8,xa)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(N.text),1)],64))],8,ba)]),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(H=>Et(N.id),["stop"])},[...C[6]||(C[6]=[e.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)])],8,wa)]))),128)),e.createElementVNode("div",_a,[!a.value&&_.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:B.value.length?" ":S.value,"onUpdate:modelValue":C[2]||(C[2]=N=>y.value=N),onFocus:Qe,onBlur:Ve,onKeydown:De},null,40,Ea)),[[e.vModelText,y.value]]):e.createCommentVNode("",!0)])])):!o.value&&!v.value&&T.value&&y.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900"]),title:T.value},[w.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:w.value?.color})},null,4)):e.createCommentVNode("",!0),z.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass({"pl-5":w.value?.color}),innerHTML:L(w.value)},null,10,Va)):(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass({"pl-5":w.value?.color})},e.toDisplayString(w.value?.text),3))],8,va)):e.createCommentVNode("",!0),o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ba,[!a.value&&_.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:T.value?" ":S.value,"onUpdate:modelValue":C[3]||(C[3]=N=>y.value=N),onFocus:Qe,onBlur:Ve,onKeydown:De},null,40,Ca)),[[e.vModelText,y.value]]):e.createCommentVNode("",!0)]))],512),e.createElementVNode("div",Na,[R.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:a.value,onClick:e.withModifiers(_t,["stop"])},[...C[7]||(C[7]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)])],8,Sa)):e.createCommentVNode("",!0),C[9]||(C[9]=e.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),e.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:a.value,onClick:C[4]||(C[4]=e.withModifiers(N=>wt(),["stop"])),title:f.value?"Закрити список":"Відкрити список"},[...C[8]||(C[8]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})],-1)])],8,$a)])],42,ga),(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(g.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:g.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[F.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(F.value,(N,H)=>(e.openBlock(),e.createElementBlock("div",{key:N.id,ref_for:!0,ref:p=>b.value[H]=p,class:e.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900 ",P(N.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",k.value===H&&!P(N.id)?"bg-blue-100":""]),"aria-disabled":P(N.id)?"true":"false",role:"option",tabindex:"-1",onClick:p=>vt(N)},[N?.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:N?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",k.value===N.id?"text-white":"",(k.value===H,"")])},[z.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:L(N)},null,8,Aa)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(N.text),1)],64))],2)],10,Ma))),128)):(e.openBlock(),e.createElementBlock("div",Fa," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),l.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:Bt,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:a.value,type:"button"},[e.createVNode(ye,{width:"16",height:"16"}),C[12]||(C[12]=e.createElementVNode("span",null,"Додати",-1))],8,Da)):e.createCommentVNode("",!0)],512)],64))}}),Ia=["placeholder","disabled"],jt=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(s){const t=s,{inputClass:l}=ie(t.style),n=e.useModel(s,"modelValue"),o=e.computed(()=>!!t.disabled),a=e.computed(()=>t.placeholder??"");function r(){typeof n.value=="string"&&(n.value=n.value.trim())}return(i,c)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":c[0]||(c[0]=d=>n.value=d),placeholder:a.value,disabled:o.value,row:"2",onBlur:r,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(l)]]),style:{border:"1px solid #CFD9E0"}},null,42,Ia)),[[e.vModelText,n.value]])}}),Ta={},La={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 Oa(s,t){return e.openBlock(),e.createElementBlock("svg",La,[...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 Ra=Z(Ta,[["render",Oa]]),za={},ja={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 Ua(s,t){return e.openBlock(),e.createElementBlock("svg",ja,[...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 Pa=Z(za,[["render",Ua]]),Ha={},Ga={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 Ka(s,t){return e.openBlock(),e.createElementBlock("svg",Ga,[...t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("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 qa=Z(Ha,[["render",Ka]]),Za={},Wa={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 Ya(s,t){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("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 Ja=Z(Za,[["render",Ya]]),Xa={},Qa={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 es(s,t){return e.openBlock(),e.createElementBlock("svg",Qa,[...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 Ut=Z(Xa,[["render",es]]),ts={},ls={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function ns(s,t){return e.openBlock(),e.createElementBlock("svg",ls,[...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 os=Z(ts,[["render",ns]]),as={},ss={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function rs(s,t){return e.openBlock(),e.createElementBlock("svg",ss,[...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 is=Z(as,[["render",rs]]),cs={class:"vs-datatable border rounded-xl w-full flex-grow"},ds={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},us={class:"relative w-full"},ps={class:"table-wrapper flex gap-2"},hs={class:"vs-popover inline-block text-slate-700"},ms={class:"text-center"},fs={class:""},gs={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"},ks={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},ys={class:"text-sm items-center text-gray-800 flex gap-1"},bs={class:"w-full overflow-x-auto"},xs={class:"w-full table-auto caption-bottom text-sm"},ws={class:"[&_tr]:border-b"},_s={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"},Es={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"},vs={key:0,colspan:"100%",class:"text-center"},Vs={class:"w-full"},Bs={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},Cs=["onDragstart","onDragover","onDrop"],Ns={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},Ss={class:"flex items-center justify-center"},$s={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"},Ms={key:0},As=["src"],Fs={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},Ds=["innerHTML"],Is={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"},Ts={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"},Ls={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},Os={class:"flex items-center justify-center gap-2"},Rs=["onClick"],zs=["onClick"],js={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},Pt=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(s){const t=s,l=e.useModel(s,"modelValue"),n=e.ref({}),o=e.ref(""),a=e.computed(()=>{if(!o.value)return l.value??[];const z=o.value.toLowerCase();return l.value.filter(L=>t.colModel?.some(I=>{const U=L[I.key];return U?Array.isArray(U)?U.join(", ").toLowerCase().includes(z):String(U).toLowerCase().includes(z):!1}))}),r=e.ref(null),i=e.ref(null),c=e.ref(!1),d=e.ref(null),m=e.ref({top:0,left:0}),f=z=>{r.value=z},v=z=>{i.value=z},w=z=>{if(r.value===null||r.value===z){r.value=null,i.value=null;return}const L=[...l.value],[I]=L.splice(r.value,1);L.splice(z,0,I),l.value=L,r.value=null,i.value=null},V=z=>{const I=z.currentTarget.getBoundingClientRect();m.value={top:I.bottom+window.scrollY,left:I.left+window.scrollX},c.value=!c.value},k=()=>{d.value&&d.value.click()},b=z=>{const L=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],I=z.toLowerCase();return L.some(U=>I.endsWith(U))},y=z=>{const I=z.target.files?.[0];if(!I)return;const U=new FileReader;U.onload=J=>{try{const re=J.target?.result;if(typeof re=="string"){const ue=JSON.parse(re);Array.isArray(ue)&&l.value.push(...ue)}}catch(re){console.error("Error parsing file:",re)}},U.readAsText(I)},h=()=>{const z=JSON.stringify(l.value,null,2),L=new Blob([z],{type:"application/json"}),I=URL.createObjectURL(L),U=document.createElement("a");U.href=I,U.download="data.json",U.click(),URL.revokeObjectURL(I)};e.onMounted(async()=>{const z=t.colModel?.filter(L=>L.data);z?.length&&Promise.all(z.map(async L=>{const U=await(await fetch(`/api/suggest/${L.data}`)).json();n.value[L.key]=U.data}))});const E=e.ref(""),g=e.ref(!1);let B="edit",M=0;const S=e.ref({}),T=e.ref({});async function R(){E.value="Додати",g.value=!0,B="add",S.value={}}function P(z,L){const I=L.key||L.name;return n.value[I]&&z[I]?n.value[I].find(U=>U.id.toString()===z[I].toString())?.text??z[I]:z[I]||"-"}async function F(z,L){E.value="Редагувати",g.value=!0,B="edit",M=L,S.value={...z}}function X(){const z=T.value.validate();if(z){ee.notify({type:"warning",title:"Помилка валідації",message:Object.entries(z).map(([L,I])=>`${L}: ${I}`).join(`
|
|
2
|
-
`)});return}B==="add"?Array.isArray(l.value)?l.value=[...l.value,S.value]:l.value=[S.value]:l.value=l.value.map((L,I)=>I===M?S.value:L),g.value=!1}function K(z){l.value=l.value.filter((L,I)=>I!==z)}function Q(){g.value=!1}return(z,L)=>(e.openBlock(),e.createElementBlock("div",cs,[e.createElementVNode("div",ds,[e.createElementVNode("div",us,[e.createVNode(Ra,{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":L[0]||(L[0]=I=>o.value=I),placeholder:"Пошук",class:"py-2 px-3 pl-10 w-full bg-gray-100 h-[36px] rounded-[8px] text-[15px] leading-[18px] focus:border-1 text-stone-800 placeholder:text-[#6B7280] focus:outline-blue-500 focus:outline-2"},null,512),[[e.vModelText,o.value]])]),e.createElementVNode("div",ps,[e.createElementVNode("input",{ref_key:"fileInput",ref:d,onChange:y,class:"hidden",accept:".json",type:"file"},null,544),e.createElementVNode("div",hs,[e.createElementVNode("div",ms,[e.createElementVNode("div",fs,[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(Pa,{height:"16",width:"16"})])])])])]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[c.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",gs,[e.createElementVNode("div",ks,[e.createElementVNode("button",{onClick:k,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createVNode(qa,{class:"text-black",width:"14",height:"14"}),L[4]||(L[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",ys,[e.createVNode(Ja,{class:"text-black",width:"14",height:"14"}),L[5]||(L[5]=e.createTextVNode(" Експортувати ",-1))])])])])],4)):e.createCommentVNode("",!0)])),e.createElementVNode("button",{onClick:R,class:"text-slate-700 bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[e.createVNode(ye),L[6]||(L[6]=e.createTextVNode(" Додати ",-1))])]),e.createElementVNode("div",bs,[e.createElementVNode("table",xs,[e.createElementVNode("thead",ws,[e.createElementVNode("tr",_s,[e.createElementVNode("th",Es,[e.createVNode(Ut,{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(z.colModel,I=>(e.openBlock(),e.createElementBlock("th",{key:I.key,class:"h-10 px-2 text-left align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 min-w-[150px]"},e.toDisplayString(I.ua||I.label),1))),128)),L[7]||(L[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})},[a.value.length===0?(e.openBlock(),e.createElementBlock("td",vs,[e.createElementVNode("div",Vs,[e.createElementVNode("div",Bs,[e.createVNode(os,{class:"w-48 mx-auto"}),L[8]||(L[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(a.value,(I,U)=>(e.openBlock(),e.createElementBlock("tr",{key:I.id,class:e.normalizeClass(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move",{"opacity-50":r.value===U,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":i.value===U}]),draggable:"true",onDragstart:J=>f(U),onDragover:e.withModifiers(J=>v(U),["prevent"]),onDrop:J=>w(U)},[e.createElementVNode("td",Ns,[e.createElementVNode("div",Ss,[e.createVNode(Ut,{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(z.colModel,J=>(e.openBlock(),e.createElementBlock("td",{key:J.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[J.type==="file"?(e.openBlock(),e.createElementBlock("div",$s,[b(P(I,J))?(e.openBlock(),e.createElementBlock("div",Ms,[e.createElementVNode("img",{src:P(I,J),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,As)])):(e.openBlock(),e.createElementBlock("div",Fs,[e.createVNode(Dt,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):J.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(I,J)},null,8,Ds)):J.type==="reference"?(e.openBlock(),e.createElementBlock("div",Is,e.toDisplayString(P(I,J)),1)):(e.openBlock(),e.createElementBlock("div",Ts,e.toDisplayString(P(I,J)),1))]))),128)),e.createElementVNode("td",Ls,[e.createElementVNode("div",Os,[e.createElementVNode("button",{onClick:J=>F(I,U),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(is,{width:"24",height:"24",class:"w-3 h-3"})],8,Rs),e.createElementVNode("button",{onClick:J=>K(U),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($e,{width:"24",height:"24",class:"w-3 h-3"})],8,zs)])])],42,Cs))),128))],2)])]),e.createVNode(e.unref(ee.VsModal),{visible:g.value,title:E.value,size:"lg",onClose:Q},{default:e.withCtx(()=>[e.createVNode(be,{schema:t.colModel,values:S.value,"onUpdate:values":L[1]||(L[1]=I=>S.value=I),form:T.value,"onUpdate:form":L[2]||(L[2]=I=>T.value=I)},null,8,["schema","values","form"]),e.createElementVNode("div",js,[e.createElementVNode("button",{type:"button",onClick:L[3]||(L[3]=I=>g.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:X,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"])]))}}),Us={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:"Клацніть на шари, щоб видалити їх"}}}}},Ps={},Hs={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 Gs(s,t){return e.openBlock(),e.createElementBlock("svg",Hs,[...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 Ks=Z(Ps,[["render",Gs]]),qs={},Zs={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 Ws(s,t){return e.openBlock(),e.createElementBlock("svg",Zs,[...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 Ys=Z(qs,[["render",Ws]]),Js={},Xs={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function Qs(s,t){return e.openBlock(),e.createElementBlock("svg",Xs,[...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 er=Z(Js,[["render",Qs]]),tr={},lr={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 nr(s,t){return e.openBlock(),e.createElementBlock("svg",lr,[...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 or=Z(tr,[["render",nr]]),ar={},sr={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 rr(s,t){return e.openBlock(),e.createElementBlock("svg",sr,[...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 ir=Z(ar,[["render",rr]]),cr={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},dr={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"},ur=["onClick"],pr={class:"relative flex-1 min-w-[140px]"},hr=["placeholder"],mr="https://data.softpro.ua/api-user/gis-url-proxy",fr="https://geo.rv.ua/api-user/dzk.api",gr=Z(e.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(s,{emit:t}){const l=s,n=t,o=["here","xy","parcel"],a=e.computed(()=>{const g=l.config?.tools?.filter(B=>o.includes(B));return g&&g.length?g:o}),r=e.computed(()=>l.config?.placeholder?.trim()||"Пошук…"),i=e.ref(a.value[0]??o[0]);e.watch(a,g=>{g.includes(i.value)||(i.value=g[0])});const c=e.ref(""),d=e.ref(!1),m=e.ref(null);e.watch(i,()=>{c.value="",d.value=!1});function f(g){i.value=g}function v(g){if(!d.value)return;const B=m.value;B&&!B.contains(g.target)&&(d.value=!1)}e.onMounted(()=>{window.addEventListener("click",v,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",v,!0)});function w(g){return g==="xy"?"Координати":g==="parcel"?"Кадастр":"Адреси"}function V(g){const B=g.replace(/[,]+/g," ").trim();if(!B)return null;const M=B.split(/\s+/).filter(Boolean);if(M.length<2)return null;const S=M.slice(0,2).map(Number);if(!S.every(Q=>Number.isFinite(Q)))return null;let[T,R]=S,P=T,F=R;const X=Q=>Math.abs(Q)<=90,K=Q=>Math.abs(Q)<=180;if(!X(P)||!K(F))if(X(F)&&K(P))P=R,F=T;else return null;return{lat:P,lng:F}}function k(g){return(g?.items||[]).map((M,S)=>({id:String(M?.id??S),title:M?.title||M?.address?.label||"Знайдений обʼєкт",lat:Number(M?.position?.lat),lng:Number(M?.position?.lng)})).filter(M=>Number.isFinite(M.lat)&&Number.isFinite(M.lng))}function b(g){const B=g?.result||g?.data||g;if(!B)return[];const M=B.geom_centroid;if(!M||!Array.isArray(M.coordinates))return[];const[S,T]=M.coordinates;return!Number.isFinite(T)||!Number.isFinite(S)?[]:[{id:"parcel",title:B.cadnum||B.cad_num||"Земельна ділянка",lat:T,lng:S}]}function y(g){const M=g.replace(/\s+/g,"").split(":");if(M.length!==4)return!1;const S=[10,2,3,4];return M.every((T,R)=>T.length===S[R]&&/^\d+$/.test(T))}function h(g){n("goToCoordinates",[g.lat,g.lng])}async function E(){const g=c.value.trim();if(g){if(i.value==="xy"){const B=V(g);if(!B){ee.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}h(B),c.value="";return}try{const B=new URL(i.value==="here"?mr:fr);if(i.value==="here")B.searchParams.set("searchtext",g);else{if(!y(g)){ee.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}B.searchParams.set("cad_num",g)}const M=await fetch(B.toString());if(!M.ok)throw new Error(`HTTP ${M.status}`);const S=await M.json(),T=i.value==="here"?k(S):b(S);if(!T.length)ee.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const R=T[0];h(R),c.value=""}}catch(B){const M=B?.message||"Помилка пошуку";ee.notify({type:"error",title:"Пошук",message:M})}}}return(g,B)=>(e.openBlock(),e.createElementBlock("div",cr,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(E,["prevent"])},[a.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:B[0]||(B[0]=M=>d.value=!d.value)},[e.createElementVNode("span",null,e.toDisplayString(w(i.value)),1),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":d.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[...B[2]||(B[2]=[e.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))]),d.value?(e.openBlock(),e.createElementBlock("div",dr,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,M=>(e.openBlock(),e.createElementBlock("li",{key:M,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:S=>f(M)},e.toDisplayString(w(M)),9,ur))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",pr,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":B[1]||(B[1]=M=>c.value=M),placeholder:r.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,hr),[[e.vModelText,c.value,void 0,{trim:!0}]]),B[3]||(B[3]=e.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),[["__scopeId","data-v-c5cab151"]]),kr={class:"bg-white/30 p-1 rounded-md shadow w-fit"},yr={class:"flex gap-2"},br=["onClick","title"],xr=["src"],wr=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(s,{emit:t}){const l=s,n=e.ref(Object.keys(l.basemaps)[0]),o=t;function a(r){o("onLayerChange",r),n.value=r}return(r,i)=>(e.openBlock(),e.createElementBlock("div",kr,[e.createElementVNode("div",yr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.basemaps,(c,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":n.value===d}]),onClick:m=>a(d),title:c.name||d,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:c.preview,alt:"",class:"w-10 h-10 object-cover"},null,8,xr)],10,br))),128))])]))}});function Ie(s){return s?s.type==="Polygon"?{type:"MultiPolygon",coordinates:[s.coordinates]}:s.type==="Feature"?{...s,geometry:Ie(s.geometry)}:s.type==="FeatureCollection"?{...s,features:(s.features||[]).map(t=>Ie(t)).filter(Boolean)}:s:null}function _r(s){return s?s.type==="FeatureCollection"||s.type==="Feature"?Ie(s):s.geom?{type:"Feature",geometry:Ie({type:s.geom.type,coordinates:s.geom.coordinates}),properties:{}}:s.type&&s.coordinates?{type:"Feature",geometry:Ie(s),properties:{}}:null:null}const Er={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},vr={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},Vr={class:"text-sm font-medium"},Br={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},Cr={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},Nr={class:"flex items-center gap-1"},Sr=["disabled"],$r=["disabled"],Mr=["disabled"],Ar={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"},Fr={class:"space-y-0.5"},Dr={class:"text-gray-500"},Ir={class:"text-gray-900 text-right break-all"},Tr={class:"absolute top-4 right-4 z-[1000]"},Lr={class:"flex flex-col gap-[2px]"},Or=["disabled"],Rr=["disabled"],zr=["disabled"],jr=["disabled"],Ur={class:"flex flex-col gap-2"},Pr={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]"},Hr={class:"flex flex-col gap-1"},Gr=["checked","disabled","onChange"],Kr={class:"text-gray-700 text-xs font-medium"},qr={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"},Zr={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},Wr={class:"shrink-0"},Yr={class:"font-bold"},Jr={class:"flex items-center"},Xr={class:"text-xs mr-2"},Qr={key:0,class:"text-xs"},ei={key:1,class:"text-xs"},ti=["disabled"],li=["disabled"],Ge="vs-base-tile-pane",Ke="vs-overlay-tile-pane",Ht=Z(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(s,{emit:t}){const n=e.getCurrentInstance()?.appContext?.config?.globalProperties?.$settings??{},o=Array.isArray(n.center)&&n.center.length===2?n.center:[50,30],a=typeof n.zoom=="number"?n.zoom:typeof n.defaultZoom=="number"?n.defaultZoom:10,r=s,i=t,c=e.computed(()=>!!r.disabled),d=e.ref(!1),m=e.ref(null),f=e.ref(!1),v=e.ref(""),w=e.ref(null),V=e.ref(null),k=e.ref(!1),b=e.ref(null),y=e.ref(null),h=e.ref(0),E=e.ref(o),g=e.ref(a),B=e.ref([]),M=e.ref(r.modelValue);let S=!1;const T=e.ref(null),R=e.computed(()=>{const p={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!r.tools?.length)return p;const u=new Set(r.tools.map(x=>x.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({}),F=e.ref([]),X=e.computed(()=>F.value.map(p=>P[p]).filter(Boolean)),K=e.ref(null),Q=e.computed(()=>K.value?.entries??[]),z=e.computed(()=>{if(!K.value)return;const p=12,u=K.value.point.x+p,x=K.value.point.y+p;return{left:`${u}px`,top:`${x}px`}});function L(p){if(typeof p!="string"||!p.trim())return"";if(/^https?:\/\//i.test(p))return p;const u=window?.location?.origin??"",x=p.replace(/^\/+/,"");return x?u?`${u}/${x}`:`/${x}`:u}function I(){if(Array.isArray(n.basemaps)&&n.basemaps.length){const u=n.basemaps.map((x,$)=>{const D=String(x?.key??x?.id??x?.name??`b${$}`),j=L(String(x?.url??""));if(!j)return null;const Y=typeof x?.preview=="string"&&x.preview?L(x.preview):"";return[D,{...x,url:j,preview:Y}]}).filter(x=>Array.isArray(x)&&x.length===2).reduce((x,[$,D])=>(x[$]=D,x),{});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 U=I(),J=Object.keys(U),re=e.ref(J.length?J[0]:"");let ue,A,le,he,ae=null;async function wt(){const p=$=>{if(!Array.from(document.styleSheets).some(D=>D?.href?.includes($))){const D=document.createElement("link");D.rel="stylesheet",D.href=$,document.head.appendChild(D)}},u=$=>new Promise((D,j)=>{if(Array.from(document.scripts).some(se=>se.src===$))return D();const te=document.createElement("script");te.src=$,te.async=!0,te.onload=()=>D(),te.onerror=se=>j(se),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 Je(){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 _t(){if(!r.handleZoom||!m.value||!A)return null;let p;const u=$=>{const D=$.ctrlKey||$.metaKey||$.shiftKey;if(!r.ctrlZoom){f.value=!1,A.scrollWheelZoom.enable();return}if(!D){f.value=!0,v.value=Je(),clearTimeout(p),p=window.setTimeout(()=>f.value=!1,1200);return}$.preventDefault(),$.stopPropagation(),f.value=!1,A.scrollWheelZoom.enable(),setTimeout(()=>A.scrollWheelZoom.disable(),120)},x=$=>{if($.touches.length===1){if(!r.ctrlZoom)return;f.value=!0,v.value=Je(),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",x,{passive:!0}),A.on("wheel",$=>{if(!r.ctrlZoom)return;$.originalEvent?.ctrlKey||$.originalEvent?.metaKey||$.originalEvent?.shiftKey||($.originalEvent?.preventDefault?.(),$.originalEvent?.stopPropagation?.())}),()=>{m.value?.removeEventListener("wheel",u),m.value?.removeEventListener("touchstart",x),clearTimeout(p)}}function Et(p,u){return p?.id?String(p.id):p?.url?`${p.url}-${u}`:`layer-${u}`}function ve(p){const u=(p?.url??"").trim();if(!u)return"";if(/^https?:\/\//i.test(u))return u;const x=window.location?.origin??"",$=u.replace(/^\/+/,"");return`${x}/${$}`}function Ae(p){const u=p?.style??{};return x=>{const $=u.colorAttr,D=u.colorSet??{},j=typeof $=="string"?D?.[x?.[$]]??u.color??"#3388ff":u.color??"#3388ff",Y=u.stroke??j;return{weight:u.width??1,color:Y,opacity:u.opacity??1,fill:u.type?u.type!=="polyline":!0,fillColor:j,fillOpacity:u.opacity??.5}}}function vt(p){return p?.layer?.properties||p?.layer?.feature?.properties||p?.properties||{}}function Fe(p,u={}){return p.popup===!1?[]:Array.isArray(p.popup)&&p.popup.length?p.popup.map(x=>{if(!x?.field)return null;const $=u[x.field];return $==null||$===""?null:{key:x.label||x.field,value:String($)}}).filter(x=>!!x):Object.entries(u).filter(([x])=>typeof x=="string"&&x).slice(0,5).map(([x,$])=>({key:x,value:$==null?"—":String($)}))}function Ue(p,u){if(!A||!u?.latlng)return;const x=A.latLngToContainerPoint(u.latlng),$=vt(u),D=Fe(p,$);if(!D.length){pe(p.id);return}K.value={layerId:p.id,title:$?.name||p.title||p.name,properties:$,entries:D,point:{x:x.x,y:x.y}}}function pe(p){p&&K.value?.layerId!==p||(K.value=null)}function Xe(p){const u=(p?.service??"").toLowerCase(),x=ve(p),$=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 D=T.value;if(D?.vectorGrid?.protobuf&&!D?.maplibreGL){const j=D.vectorGrid.protobuf(x,{interactive:!0,maxNativeZoom:p.maxzoom??19,vectorTileLayerStyles:{[$??"default"]:Ae(p),default:Ae(p)}});return j?.on?.("mouseover",Y=>Ue(p,Y)),j?.on?.("mousemove",Y=>Ue(p,Y)),j?.on?.("mouseout",()=>pe(p.id)),j}if(D?.maplibreGL&&window?.maplibregl){const j=x;return j?D.maplibreGL({style:j,interactive:!1,pane:"overlayPane"}):null}return null}return u==="tile"||/^https?:\/\//i.test(x)||x.includes("{z}")?T.value.tileLayer(x,{opacity:p?.style?.opacity??1,pane:Ke}):T.value.tileLayer(x,{opacity:p?.style?.opacity??1,pane:Ke})}function De(p){const u=T.value;if(!u)return null;const x=("bounds"in p?p.bounds:void 0)??r.bounds??B.value;if(!Array.isArray(x)||!x.length)return null;const D={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:x,Y=Qe(j);if(!Y.length||!u?.polyline)return null;const te=Y.map(se=>{if(!se.length)return se;const Pe=se[0],Nt=se[se.length-1];return Pe&&Nt&&typeof Nt.equals=="function"&&!Nt.equals(Pe)?[...se,Pe]:se});return u.polyline(te,D)}function Qe(p){const u=T.value;if(!u||!Array.isArray(p))return[];const x=D=>{if(!Array.isArray(D)||D.length<2)return null;const[j,Y]=D;return!Number.isFinite(Number(Y))||!Number.isFinite(Number(j))?null:u.latLng(Number(Y),Number(j))},$=D=>Array.isArray(D)&&D.length>=2&&D.every(j=>Number.isFinite(Number(j)));if(p.length&&$(p[0])){const D=p.map(x).filter(Boolean);return D.length?[D]:[]}return p.length&&Array.isArray(p[0])&&Array.isArray(p[0][0])&&$(p[0][0][0])?p.flatMap(j=>Array.isArray(j)?j:[]).map(j=>Array.isArray(j)?j.map(x).filter(Boolean):[]).filter(j=>j.length):p.length&&Array.isArray(p[0])&&$(p[0][0])?p.map(j=>Array.isArray(j)?j.map(x).filter(Boolean):[]).filter(j=>j.length):[]}function Ve(){if(!A||!T.value)return;ae&&A.hasLayer(ae)&&(A.removeLayer(ae),ae=null);const p=De({id:"global-bounds",bounds:r.bounds??B.value,style:{}});p&&(ae=p,ae.addTo(A))}function Be(){!A||!T.value||F.value.forEach(p=>{const u=P[p];u&&(u.visible?(u.layer||(u.layer=Xe(u.config)),u.boundsLayer||(u.boundsLayer=De(u.config)),u.layer&&!A.hasLayer(u.layer)&&u.layer.addTo(A),u.boundsLayer&&!A.hasLayer(u.boundsLayer)&&u.boundsLayer.addTo(A)):(u.layer&&A.hasLayer(u.layer)&&A.removeLayer(u.layer),u.boundsLayer&&A.hasLayer(u.boundsLayer)&&A.removeLayer(u.boundsLayer),pe(u.id)))})}function et(p){if(c.value)return;const u=P[p];u&&(u.visible=!u.visible,u.visible?(u.layer||(u.layer=Xe(u.config)),u.boundsLayer||(u.boundsLayer=De(u.config)),u.layer&&!A.hasLayer(u.layer)&&u.layer.addTo(A),u.boundsLayer&&!A.hasLayer(u.boundsLayer)&&u.boundsLayer.addTo(A)):(u.layer&&A.hasLayer(u.layer)&&A.removeLayer(u.layer),u.boundsLayer&&A.hasLayer(u.boundsLayer)&&A.removeLayer(u.boundsLayer),pe(u.id)))}e.watch(()=>r.layers,p=>{const u=Array.isArray(p)?p:[],x=[],$=new Set;u.forEach((D,j)=>{if(!D)return;const Y=Et(D,j);x.push(Y),$.add(Y);const te=P[Y],se={...D,id:Y},Pe=te?.visible??se?.overlay!==!1;te&&(te.layer&&A?.hasLayer(te.layer)&&A.removeLayer(te.layer),te.boundsLayer&&A?.hasLayer(te.boundsLayer)&&A.removeLayer(te.boundsLayer),pe(Y)),P[Y]={id:Y,config:se,visible:Pe,layer:null,boundsLayer:null}}),Object.keys(P).forEach(D=>{if(!$.has(D)){const j=P[D];j?.layer&&A?.hasLayer(j.layer)&&A.removeLayer(j.layer),j?.boundsLayer&&A?.hasLayer(j.boundsLayer)&&A.removeLayer(j.boundsLayer),pe(D),delete P[D]}}),F.value=x,Be()},{immediate:!0,deep:!0}),e.watch(()=>r.bounds,()=>{A&&(Object.values(P).forEach(p=>{p.boundsLayer&&A.hasLayer(p.boundsLayer)&&A.removeLayer(p.boundsLayer),p.boundsLayer=null}),Ve(),Be())},{deep:!0}),e.watch(()=>r.katottg,async p=>{if(B.value=[],!p){Ve();return}try{const u=await fetch(`https://data.gki.com.ua/api-user/atu/${p}`);if(!u?.ok)return;const $=(await u.json())?.geometry?.coordinates;Array.isArray($)&&$.length&&(B.value=$)}catch(u){console.error("Failed to fetch KATOTTG bounds",u)}finally{Ve(),Be()}},{immediate:!0}),e.watch(()=>r.modelValue,p=>{if(!A||!le){M.value=p;return}Ce(p)},{deep:!0});function tt(p){const u=T.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 lt(p){const u=T.value;if(p instanceof u.Circle){const x=p.getRadius();return Math.PI*(x*x)/1e6}if(p instanceof u.Polygon||p instanceof u.Rectangle)try{const x=p.getLatLngs(),$=Array.isArray(x[0])?x[0]:x,D=u.GeometryUtil?.geodesicArea?u.GeometryUtil.geodesicArea($):0;return D?D/1e6:0}catch{return null}return null}function nt(p){return p instanceof T.value.Circle?p.getLatLng():p.getBounds?p.getBounds().getCenter():p.getLatLng?p.getLatLng():A.getCenter()}function ke(p){const u=le.toGeoJSON(),x=[];let $=null;const D=Y=>{if(Y)switch(Y.type){case"Point":$=Y;break;case"Polygon":x.push(Y.coordinates);break;case"MultiPolygon":x.push(...Y.coordinates);break;case"GeometryCollection":(Y.geometries||[]).forEach(D);break}};(u?.features||[]).forEach(Y=>D(Y.geometry));const j=$||(x.length?{type:x.length===1?"Polygon":"MultiPolygon",coordinates:x.length===1?x[0]:x}:null);!p?.silent&&!S&&i("update:modelValue",j),h.value=le.getLayers().length}function Ce(p){if(!le||!T.value)return;le.clearLayers();const u=_r(p);if(!u){V.value=null,h.value=0;return}T.value.geoJSON(u).eachLayer($=>le.addLayer($)),S=!0,ke({silent:!0}),S=!1,xe();const x=le.getBounds?.();x?.isValid?.()&&A?.fitBounds(x,{padding:[24,24]})}function xe(){const p=le.getLayers();if(!p.length){V.value=null,h.value=0;return}const u=p[p.length-1],x=tt(u),$=nt(u),D=lt(u);V.value={type:x,center:$,areaKm2:D,layer:u},h.value=p.length}const we=e.ref("");function Ne(p){if(c.value||!A||!T.value)return;he?.disable&&he.disable();const u=T.value;switch(p){case"marker":he=new u.Draw.Marker(A);break;case"polyline":he=new u.Draw.Polyline(A);break;case"polygon":he=new u.Draw.Polygon(A);break;case"rectangle":he=new u.Draw.Rectangle(A);break}he.enable(),we.value=p}function Vt(){if(c.value)return;const p=V.value?.layer;p&&(p.getBounds?A.fitBounds(p.getBounds(),{padding:[30,30]}):p.getLatLng&&A.setView(p.getLatLng(),Math.max(g.value,14)))}function Bt(){c.value||le&&(le.clearLayers(),i("update:modelValue",null),V.value=null,h.value=0)}const ot=e.ref(null);function Ct(){c.value||ot.value?.click()}function at(p){if(c.value)return;const u=p.target,x=u.files?.[0];if(!x)return;const $=new FileReader;$.onload=()=>{try{const D=JSON.parse(String($.result));le.clearLayers(),D&&T.value.geoJSON(D).eachLayer(j=>le.addLayer(j)),ke(),xe()}finally{u.value=""}},$.readAsText(x)}function _(){if(c.value)return;const p=le.toGeoJSON(),u=new Blob([JSON.stringify(p,null,2)],{type:"application/json"}),x=URL.createObjectURL(u),$=document.createElement("a");$.href=x,$.download="data.geojson",$.click(),URL.revokeObjectURL(x)}function C(p){!A||!T.value||!U[p]||(ue&&A.removeLayer(ue),ue=T.value.tileLayer(U[p].url,{maxZoom:19,minZoom:6,pane:Ge}).addTo(A),re.value=p)}function N(p){if(!A||!T.value)return;const u=T.value.latLng(p[0],p[1]);A.setView(u,13)}let H=null;return e.onMounted(async()=>{T.value=await wt();const p=T.value;p.drawLocal=Us,A=p.map(m.value,{zoomControl:!1,scrollWheelZoom:!1}).setView(E.value,g.value),p.control.zoom({position:"bottomright"}).addTo(A);const u=re.value||Object.keys(U)[0];A.createPane(Ge),A.getPane(Ge).style.zIndex="180",A.createPane(Ke),A.getPane(Ke).style.zIndex="220",u&&U[u]&&(re.value=u,ue=p.tileLayer(U[u].url,{maxZoom:19,minZoom:6,pane:Ge}).addTo(A)),le=new p.FeatureGroup().addTo(A),A.on(p.Draw.Event.CREATED,$=>{if(c.value)return;const{layer:D}=$;le.clearLayers(),le.addLayer(D),ke(),xe(),we.value=""}),A.on(p.Draw.Event.EDITED,()=>{c.value||(ke(),xe())}),A.on(p.Draw.Event.DELETED,()=>{c.value||(ke(),xe())});let x=!1;A.on("mousemove",$=>{x||(A.invalidateSize(),x=!0)}),A.on("zoomend",()=>{g.value=A.getZoom()}),H=_t(),Be(),Ve(),M.value!==void 0&&(Ce(M.value),M.value=void 0)}),e.onUnmounted(()=>{H?.(),pe(),ae&&A?.hasLayer(ae)&&(A.removeLayer(ae),ae=null),A?.remove&&A.remove()}),e.watch(d,()=>{setTimeout(()=>{A?.invalidateSize&&A.invalidateSize()},50)}),e.watch(k,async p=>{if(!p||!y.value){b.value=null;return}await e.nextTick();const u=y.value.getBoundingClientRect();b.value={top:u.bottom+6,left:u.left}}),(p,u)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",disabled:!d.value},[e.createElementVNode("div",{class:e.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:d.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref: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&&r.handleZoom?(e.openBlock(),e.createElementBlock("div",Er,[e.createElementVNode("div",vr,[e.createElementVNode("p",Vr,e.toDisplayString(v.value),1)])])):e.createCommentVNode("",!0)]),_:1}),R.value.search||R.value.import||R.value.export?(e.openBlock(),e.createElementBlock("div",Br,[R.value.search?(e.openBlock(),e.createBlock(gr,{key:0,onGoToCoordinates:N})):e.createCommentVNode("",!0),R.value.import||R.value.export?(e.openBlock(),e.createElementBlock("div",Cr,[e.createElementVNode("div",Nr,[R.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:Ct,disabled:c.value}," Import ",8,Sr)):e.createCommentVNode("",!0),R.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:_,disabled:c.value||h.value===0}," Export ",8,$r)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:ot,type:"file",onChange:at,accept:".json,.geojson",class:"hidden",disabled:c.value},null,40,Mr)])):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(z.value)},[e.createElementVNode("div",Ar,[e.createElementVNode("dl",Fr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Q.value,x=>(e.openBlock(),e.createElementBlock("div",{key:`${x.key}-${x.value}`,class:"flex justify-between gap-2"},[e.createElementVNode("dt",Dr,e.toDisplayString(x.key),1),e.createElementVNode("dd",Ir,e.toDisplayString(x.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",Tr,[e.createElementVNode("div",Lr,[R.value.point?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":we.value==="marker"}]),title:"Point",onClick:u[0]||(u[0]=x=>Ne("marker")),disabled:c.value},[e.createVNode(Ks)],10,Or)):e.createCommentVNode("",!0),R.value.line?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":we.value==="polyline"}]),title:"Line",onClick:u[1]||(u[1]=x=>Ne("polyline")),disabled:c.value},[e.createVNode(Ys)],10,Rr)):e.createCommentVNode("",!0),R.value.polygon?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":we.value==="polygon"}]),title:"Polygon",onClick:u[2]||(u[2]=x=>Ne("polygon")),disabled:c.value},[e.createVNode(er)],10,zr)):e.createCommentVNode("",!0),R.value.rectangle?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":we.value==="rectangle"}]),title:"Rectangle",onClick:u[3]||(u[3]=x=>Ne("rectangle")),disabled:c.value},[e.createVNode(or)],10,jr)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:u[4]||(u[4]=x=>d.value=!d.value),title:"Full Screen"},[e.createVNode(ir,{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",Ur,[e.createVNode(wr,{basemaps:e.unref(U),onOnLayerChange:C},null,8,["basemaps"]),X.value.length?(e.openBlock(),e.createElementBlock("div",Pr,[u[9]||(u[9]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),e.createElementVNode("div",Hr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(X.value,x=>(e.openBlock(),e.createElementBlock("label",{key:x.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:x.visible,disabled:c.value,onChange:$=>et(x.id)},null,40,Gr),e.createElementVNode("span",Kr,e.toDisplayString(x.config.title||x.config.name||x.id),1)]))),128))])])):e.createCommentVNode("",!0)])],2),e.createElementVNode("div",qr,[V.value?(e.openBlock(),e.createElementBlock("div",Zr,[e.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:u[5]||(u[5]=x=>k.value=!0),onMouseleave:u[6]||(u[6]=x=>k.value=!1)},[e.createElementVNode("div",Wr,[u[10]||(u[10]=e.createTextVNode(" Type: ",-1)),e.createElementVNode("span",Yr,e.toDisplayString(V.value.type),1)]),w.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"addressEl",ref:y,class:"text-gray-500 text-xs truncate cursor-help",style:{"max-width":"260px"}}," Address: "+e.toDisplayString(w.value),513)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[k.value&&w.value&&b.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:b.value.top+"px",left:b.value.left+"px"})},e.toDisplayString(w.value),5)):e.createCommentVNode("",!0)]))],32),e.createElementVNode("div",Jr,[e.createElementVNode("div",Xr,[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",Qr,[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",ei,[...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]=x=>Vt()),disabled:c.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,ti),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]=x=>Bt()),disabled:c.value},[e.createVNode($e,{class:"w-3 h-3"})],8,li)])])):e.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-9074155d"]]),ni=["data-focus"],oi={class:"flex items-center"},ai={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},si=["onClick","aria-label"],ri={key:0,class:"absolute text-gray-500 truncate pl-2"},ii={class:"flex-1 min-w-[2px]"},ci=["placeholder"],di={class:"flex items-center shrink-0"},ui=["disabled"],Gt=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(s,{emit:t}){const l=s,n=t;ie(l.style);const o=e.ref(null),a=e.ref(null),r=e.ref(null),i=e.ref(!1),c=e.ref(""),d=e.useModel(s,"modelValue"),m=e.computed(()=>l.placeholder||"Add tag…"),f=e.computed(()=>d.value?.length===0&&c.value===""),v=e.computed(()=>!l.disabled&&d.value?.length>0),w=e.computed(()=>l.disabled),V=async()=>{w.value||await e.nextTick(()=>r.value?.focus())},k=M=>{const S=M.trim();S!==""&&(!d.value||!Array.isArray(d.value)?d.value=[S]:l.unique?d.value.includes(S)||(d.value=[...d.value,S]):d.value=[...d.value,S],c.value="")},b=()=>{const M=c.value;M.trim()!==""&&k(M),c.value=""},y=M=>{const S=d.value.slice();S.splice(M,1),n("update:modelValue",S)},h=()=>{n("update:modelValue",[])},E=()=>{w.value||(i.value=!0)},g=()=>{i.value=!1,!w.value&&b()},B=M=>{const{key:S}=M;S==="Enter"?(M.preventDefault(),b()):S==="Backspace"&&c.value===""&&d.value.length>0&&y(d.value.length-1)};return(M,S)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:S[1]||(S[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",l.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":"",w.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:a},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(T,R)=>(e.openBlock(),e.createElementBlock("div",{key:R,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",oi,[e.createElementVNode("div",ai,e.toDisplayString(T),1)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:e.withModifiers(P=>y(R),["stop"]),"aria-label":`Remove ${T}`},[...S[2]||(S[2]=[e.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)])],8,si)]))),128)),f.value?(e.openBlock(),e.createElementBlock("div",ri,e.toDisplayString(m.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",ii,[w.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:r,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":S[0]||(S[0]=T=>c.value=T),onFocus:E,onBlur:g,onKeydown:B,placeholder:d.value&&d.value.length?"":void 0},null,40,ci)),[[e.vModelText,c.value]])])],512),e.createElementVNode("div",di,[v.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:w.value,onClick:e.withModifiers(h,["stop"])},[...S[3]||(S[3]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)])],8,ui)):e.createCommentVNode("",!0)])],10,ni)],2)],512))}}),pi={class:"relative flex gap-1 bg-white w-full"},hi=["disabled","placeholder"],Kt=Z(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(s){const t=e.inject("values"),l=s,n=e.useModel(s,"modelValue");function o(r){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 r.toLowerCase().split("").map(c=>i[c]||c).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const a=()=>{const r=t?.value?.[l.parent||""]?.toString(),i=o(r);n.value=i.toString()};return(r,i)=>(e.openBlock(),e.createElementBlock("div",pi,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:r.disabled,placeholder:r.placeholder,"onUpdate:modelValue":i[0]||(i[0]=c=>n.value=c),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,hi),[[e.vModelText,n.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:a}," Gen ")]))}}),[["__scopeId","data-v-cb7b2b74"]]),mi={class:"relative flex gap-1 bg-white w-full"},fi=["disabled","placeholder"],gi=["disabled"],ki={key:0},yi={key:1},qt=Z(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(s){const t=s,l=e.useModel(s,"modelValue"),n=e.ref(!1),o=e.computed(()=>t.init!==!1),a=e.computed(()=>!!t.table&&!!t.code),r=()=>{if(!a.value)return"";const d=encodeURIComponent(String(t.table)),m=encodeURIComponent(String(t.code));return`/api/code-gen/${d}/${m}`},i=async()=>{if(!a.value||n.value)return;const d=r();if(d){n.value=!0;try{const f=await(await fetch(d)).text();l.value=f}finally{n.value=!1}}},c=()=>{o.value&&(l.value||i())};return e.onMounted(()=>{c()}),e.watch(()=>[t.table,t.code,t.init],()=>{c()}),(d,m)=>(e.openBlock(),e.createElementBlock("div",mi,[e.withDirectives(e.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":m[0]||(m[0]=f=>l.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,fi),[[e.vModelText,l.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:n.value||d.disabled||!a.value,onClick:i},[n.value?(e.openBlock(),e.createElementBlock("span",yi,"...")):(e.openBlock(),e.createElementBlock("span",ki,"Gen"))],8,gi)]))}}),[["__scopeId","data-v-8f88fb66"]]),bi={class:"w-full"},xi={ref:"sortableContainer",class:"flex flex-col gap-1"},wi=["onDragstart","onDrop"],_i={class:"w-1/3"},Ei={class:"w-2/3"},vi=["onClick"],Vi={key:0,class:"text-[14px] text-gray-700"},Bi={class:"mt-2 w-full flex items-center"},Ci=["disabled"],Zt=Z(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(s,{emit:t}){const l=b=>`${b}-${Math.random().toString(36).substring(2,15)}`,n=e.inject("values"),o=s,a=t,r=o.addButtonText??"Додати",i=o.ignore??[],c=e.ref([]),d=e.ref(null);(()=>{const b=o.parent&&n?.value?.[o.parent]||o.modelValue||{};c.value=Object.entries(b).filter(([y])=>!i.includes(y)).map(([y,h])=>({id:l("key-value-"),key:y,value:h}))})();function f(b){d.value=b}function v(b){if(d.value===null||d.value===b)return;const y=c.value.splice(d.value,1)[0];c.value.splice(b,0,y),d.value=null}const w=e.computed(()=>c.value.some(b=>b.key&&!b.value||!b.key&&b.value)),V=()=>{c.value.push({id:l("key-value-"),key:"",value:""})},k=b=>{c.value=c.value.filter(y=>y.id!==b)};return e.watch(c,b=>{const y={};b.forEach(E=>{E.key&&E.value!==void 0&&(y[E.key]=E.value)});const h={};i.length&&i.forEach(E=>{h[E]=o.parent?n?.value?.[o.parent]?.[E]:void 0}),n?.value&&o.parent&&(n.value[o.parent]={...h,...y}),a("update:modelValue",y)},{deep:!0}),(b,y)=>(e.openBlock(),e.createElementBlock("div",bi,[e.createElementVNode("div",xi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(h,E)=>(e.openBlock(),e.createElementBlock("div",{key:h.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===E}]),draggable:"true",onDragstart:g=>f(E),onDragover:y[0]||(y[0]=e.withModifiers(()=>{},["prevent"])),onDrop:g=>v(E)},[y[1]||(y[1]=e.createStaticVNode('<button class="cursor-move" data-v-c1219c25><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-c1219c25><circle cx="15" cy="12" r="1.5" data-v-c1219c25></circle><circle cx="15" cy="24" r="1.5" data-v-c1219c25></circle><circle cx="21" cy="12" r="1.5" data-v-c1219c25></circle><circle cx="21" cy="24" r="1.5" data-v-c1219c25></circle><circle cx="21" cy="18" r="1.5" data-v-c1219c25></circle><circle cx="15" cy="18" r="1.5" data-v-c1219c25></circle></svg></button>',1)),e.createElementVNode("div",_i,[e.createVNode(Se,{modelValue:h.key,"onUpdate:modelValue":g=>h.key=g,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Ei,[e.createVNode(Se,{modelValue:h.value,"onUpdate:modelValue":g=>h.value=g,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:g=>k(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(rt),{height:"16",width:"16"})],8,vi)],42,wi))),128))],512),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Vi," Дані для відображення відсутні ")),e.createElementVNode("div",Bi,[e.createElementVNode("button",{type:"button",onClick:V,disabled:w.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(ye,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(r)),1)],8,Ci)])]))}}),[["__scopeId","data-v-c1219c25"]]),Ni={class:"w-full"},Si={ref:"sortableContainer",class:"flex flex-col gap-1"},$i=["onDragstart","onDrop"],Mi=["disabled"],Ai={class:"flex-1"},Fi=["onClick","disabled"],Di={key:0,class:"text-[14px] text-gray-700"},Ii={class:"mt-2 w-full flex items-center"},Ti=["disabled"],ft=Z(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(s){const t=s,l=e.useModel(s,"modelValue"),n=e.ref([]),o=e.ref(null),a=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??""),i=e.computed(()=>t.addButtonText??"Додати");let c=!1;const d=b=>`${b}-${Math.random().toString(36).substring(2,15)}`,m=b=>{const y=b??l.value??[];n.value=y.map((h,E)=>({id:n.value[E]?.id??d("text-array"),value:h??""}))};m(),e.watch(()=>l.value,b=>{if(c){c=!1;return}m(b||[])},{deep:!0}),e.watch(n,b=>{c=!0,l.value=b.map(y=>y.value).filter(y=>y!=null&&y!=="")},{deep:!0});const f=e.computed(()=>a.value||n.value.some(b=>!b.value));function v(){f.value||(n.value=[...n.value,{id:d("text-array"),value:""}])}function w(b){a.value||(n.value=n.value.filter(y=>y.id!==b))}function V(b){a.value||(o.value=b)}function k(b){if(a.value||o.value===null||o.value===b)return;const y=[...n.value],[h]=y.splice(o.value,1);y.splice(b,0,h),n.value=y,o.value=null}return(b,y)=>(e.openBlock(),e.createElementBlock("div",Ni,[e.createElementVNode("div",Si,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(h,E)=>(e.openBlock(),e.createElementBlock("div",{key:h.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":o.value===E}]),draggable:"true",onDragstart:g=>V(E),onDragover:y[0]||(y[0]=e.withModifiers(()=>{},["prevent"])),onDrop:g=>k(E)},[e.createElementVNode("button",{class:"cursor-move",type:"button",disabled:a.value},[...y[1]||(y[1]=[e.createStaticVNode('<svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-77ce3498><circle cx="15" cy="12" r="1.5" data-v-77ce3498></circle><circle cx="15" cy="24" r="1.5" data-v-77ce3498></circle><circle cx="21" cy="12" r="1.5" data-v-77ce3498></circle><circle cx="21" cy="24" r="1.5" data-v-77ce3498></circle><circle cx="21" cy="18" r="1.5" data-v-77ce3498></circle><circle cx="15" cy="18" r="1.5" data-v-77ce3498></circle></svg>',1)])],8,Mi),e.createElementVNode("div",Ai,[b.inputType==="text"?(e.openBlock(),e.createBlock(Se,{key:0,modelValue:h.value,"onUpdate:modelValue":g=>h.value=g,disabled:a.value,placeholder:r.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),b.inputType==="tel"?(e.openBlock(),e.createBlock(pt,{key:1,modelValue:h.value,"onUpdate:modelValue":g=>h.value=g,disabled:a.value,placeholder:r.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),b.inputType==="email"?(e.openBlock(),e.createBlock(ut,{key:2,modelValue:h.value,"onUpdate:modelValue":g=>h.value=g,disabled:a.value,placeholder:r.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),b.inputType==="mask"?(e.openBlock(),e.createBlock(dt,{key:3,modelValue:h.value,"onUpdate:modelValue":g=>h.value=g,mask:b.mask,disabled:a.value,placeholder:r.value},null,8,["modelValue","onUpdate:modelValue","mask","disabled","placeholder"])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:g=>w(h.id),disabled:a.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(rt),{height:"16",width:"16"})],8,Fi)],42,$i))),128))],512),n.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Di," Дані для відображення відсутні ")),e.createElementVNode("div",Ii,[e.createElementVNode("button",{type:"button",onClick:v,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(ye,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(i.value),1)],8,Ti)])]))}}),[["__scopeId","data-v-77ce3498"]]),Li={class:"flex items-center gap-2 w-full"},Oi=["disabled"],Ri=["disabled"],Wt=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(s,{emit:t}){const l=s,{inputClass:n}=ie(l.style),o=t,a=e.computed({get:()=>l.modelValue||"#000000",set:i=>o("update:modelValue",i)}),r=e.computed(()=>!!l.disabled);return(i,c)=>(e.openBlock(),e.createElementBlock("div",Li,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":c[0]||(c[0]=d=>a.value=d),disabled:r.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(n)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Oi),[[e.vModelText,a.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":c[1]||(c[1]=d=>a.value=d),disabled:r.value},null,8,Ri),[[e.vModelText,a.value]])]))}}),zi={class:"flex items-center gap-2 w-full"},ji=["min","max","step","disabled"],Ui=["disabled"],Yt=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(s,{emit:t}){const l=s,{inputClass:n}=ie(l.style),o=t,a=e.computed({get:()=>Number(l.modelValue??l.min),set:i=>o("update:modelValue",Number(i))}),r=e.computed(()=>!!l.disabled);return(i,c)=>(e.openBlock(),e.createElementBlock("div",zi,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>a.value=d),min:i.min,max:i.max,step:i.step,disabled:r.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[i.modelValue?"":"text-opacity-50",e.unref(n)].join(" ")])},null,10,ji),[[e.vModelText,a.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":c[1]||(c[1]=d=>a.value=d),disabled:r.value},null,8,Ui),[[e.vModelText,a.value]])]))}}),Pi={class:"flex items-center gap-2 w-full"},Hi={class:"relative flex-1"},Gi=["placeholder","disabled","onKeydown"],Ki=["disabled"],qi={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"},Zi={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"},Wi={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},Yi={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},Ji={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},Xi=["onClick"],Qi={key:0,class:"p-4 text-sm text-gray-500"},Jt=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(s,{emit:t}){const l=s,n=t,{inputClass:o}=ie(l.style),a=e.useModel(s,"modelValue"),r=e.computed({get:()=>a.value,set:y=>{a.value=y}}),i=e.ref(!1),c=e.ref([]),d=e.ref(!1),m=e.computed(()=>l.placeholder??""),f=e.computed(()=>!!l.disabled),v=e.inject("values");function w(){!f.value&&r.value.trim()&&V()}async function V(){const y=(r.value||"").trim();if(!y)return;let h=y;if(l.includes?.length&&v?.value){const g=l.includes.map(B=>v.value?.[B]).filter(Boolean);g.length&&(h=`${g.join(", ")}, ${y}`)}const E=l.api.replace("{{value}}",encodeURIComponent(h));i.value=!0;try{const B=await(await fetch(E)).json();c.value=Array.isArray(B)?B:[],d.value=!0}catch(g){console.error("Address search error:",g)}finally{i.value=!1}}function k(){d.value=!d.value}function b(y){if(!y)return;d.value=!1;const h=parseFloat(y.lat),g={type:"Point",coordinates:[parseFloat(y.lon),h]};l.geom&&v?.value&&(v.value[l.geom]=g),n("update:geom",g)}return(y,h)=>(e.openBlock(),e.createElementBlock("div",Pi,[e.createElementVNode("div",Hi,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":h[0]||(h[0]=E=>r.value=E),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":l.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:e.withKeys(e.withModifiers(w,["prevent"]),["enter"])},null,42,Gi),[[e.vModelText,r.value]]),c.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:k,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||!r.value?.trim()},[i.value?(e.openBlock(),e.createElementBlock("svg",Zi,[...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",qi,[...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,Ki),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[d.value?(e.openBlock(),e.createElementBlock("div",Wi,[e.createElementVNode("div",Yi,[e.createElementVNode("div",Ji,[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]=E=>d.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(c.value,(E,g)=>(e.openBlock(),e.createElementBlock("li",{key:g,onClick:B=>b(E),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString(E.display_name),9,Xi))),128))]),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Qi," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),Xt=(s="")=>`${s}${Math.floor(Math.random()*1e4)}`,ec={class:"vs-datalist space-y-3"},tc={class:"space-y-3"},lc=["onClick","disabled"],nc={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},oc=["disabled"],ac=Z(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(s){const t=s,l=e.useModel(s,"modelValue"),n=e.ref([]),o=e.computed(()=>t.schema?.map(V=>({...V,disabled:t.disabled||V.disabled}))??[]),a=e.computed(()=>o.value.map(V=>w(V))),r=e.computed(()=>t.disabled?!1:t.maxItems?l.value.length<t.maxItems:!0),i=e.computed(()=>t.disabled||l.value.length<=(t.minItems||0));e.watch(()=>l.value.length,()=>{c(),d()},{immediate:!0}),e.watch(()=>t.schema,d,{immediate:!0,deep:!0});function c(){const V=l.value.length;n.value.length<V?n.value=[...n.value,...Array.from({length:V-n.value.length},()=>Xt())]:n.value.length>V&&n.value.splice(V)}function d(){if(!t.minItems||l.value.length>=t.minItems)return;const V=t.minItems-l.value.length,k=Array.from({length:V},m);l.value=[...l.value,...k]}function m(){const V={};return o.value.forEach(k=>{V[k.name]=k?.default??null}),V}function f(){r.value&&(l.value=[...l.value,m()],c())}function v(V){i.value||(l.value=l.value.filter((k,b)=>b!==V),c(),d())}function w(V){return{...V}}return(V,k)=>(e.openBlock(),e.createElementBlock("div",ec,[e.createElementVNode("div",tc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(b,y)=>(e.openBlock(),e.createElementBlock("div",{key:n.value[y],class:"flex items-center gap-3"},[e.createVNode(be,{schema:a.value,layout:"inline",navigation:!1,values:l.value[y],"onUpdate:values":h=>l.value[y]=h,"form-id":n.value[y]},null,8,["schema","values","onUpdate:values","form-id"]),e.createElementVNode("button",{type:"button",class:"h-[38px] w-[38px] flex items-center justify-center text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",onClick:h=>v(y),disabled:i.value},[e.createVNode($e,{class:"w-5 h-5"})],8,lc)]))),128)),l.value.length===0?(e.openBlock(),e.createElementBlock("div",nc,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:!r.value},[e.createVNode(ye,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,oc)]))}}),[["__scopeId","data-v-3b714d78"]]),sc={};function rc(s,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"},s.$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 ic=Z(sc,[["render",rc]]),cc={class:"vs-dataform space-y-4"},dc={class:"flex items-center justify-between mb-3"},uc={class:"text-sm font-medium text-gray-700"},pc={class:"flex items-center gap-2"},hc=["title","onClick","disabled"],mc=["title","onClick","disabled"],fc={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},gc=["disabled"],Qt={VsInputText:Se,VsInputRadio:ht,"vs-input-text":Se,"vs-input-password":Ol,"vs-input-textarea":jt,"vs-input-mask":dt,"vs-input-number":St,"vs-input-radio":ht,"vs-input-select":mt,"vs-input-switcher":it,"vs-input-static":ct,"vs-input-container":zt,"vs-input-date":Mt,"vs-input-checkbox":$t,"vs-input-file":Lt,"vs-input-html":ct,"vs-input-email":ut,"vs-input-tel":pt,"vs-input-datatable":Pt,"vs-input-map":Ht,"vs-input-file-list":Ot,"vs-input-tags":Gt,"vs-input-slug":Kt,"vs-input-codegen":qt,"vs-input-key-value":Zt,"vs-input-text[]":ft,"vs-input-range":Yt,"vs-input-color":Wt,"vs-input-native-select":mt,"vs-input-array":ft,"vs-input-address":Jt,"vs-input-datalist":ac,"vs-input-dataform":Z(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(s){const t=s,l=e.useModel(s,"modelValue"),n=e.ref([]),o=e.computed(()=>t.groupLabel),a=e.computed(()=>t.emptyLabel??"Ще немає груп"),r=e.computed(()=>t.schema?.map(y=>({...y,disabled:t.disabled||y.disabled}))??[]),i=e.computed(()=>r.value.map(y=>b(y))),c=e.computed(()=>t.disabled?!1:t.maxGroups?l.value.length<t.maxGroups:!0),d=e.computed(()=>t.disabled||l.value.length<=(t.minGroups||0));e.watch(()=>l.value.length,()=>{m(),f()},{immediate:!0}),e.watch(()=>t.schema,f,{immediate:!0,deep:!0});function m(){const y=l.value.length;n.value.length<y?n.value=[...n.value,...Array.from({length:y-n.value.length},()=>Xt())]:n.value.length>y&&n.value.splice(y)}function f(){if(!t.minGroups||l.value.length>=t.minGroups)return;const y=t.minGroups-l.value.length,h=Array.from({length:y},v);l.value=[...l.value,...h]}function v(){const y={};return r.value.forEach(h=>{y[h.name]=h?.default??null}),y}function w(){c.value&&(l.value=[...l.value,v()],m())}function V(y){d.value||(l.value=l.value.filter((h,E)=>E!==y),m(),f())}function k(y){if(t.disabled)return;const h=JSON.parse(JSON.stringify(l.value[y]??{}));l.value=[...l.value.slice(0,y+1),h,...l.value.slice(y+1)],m()}function b(y){return{...y}}return(y,h)=>(e.openBlock(),e.createElementBlock("div",cc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(E,g)=>(e.openBlock(),e.createElementBlock("div",{key:n.value[g],class:"relative border border-gray-200 rounded-lg p-6 bg-white"},[e.createElementVNode("div",dc,[e.createElementVNode("div",uc,e.toDisplayString(o.value),1),e.createElementVNode("div",pc,[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:B=>k(g),disabled:t.disabled},[e.createVNode(ic,{class:"w-5 h-5"})],8,hc),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:B=>V(g),disabled:d.value},[e.createVNode($e,{class:"w-5 h-5"})],8,mc)])]),e.createVNode(be,{class:"vs-dataform__form",schema:i.value,layout:"inline",navigation:!1,values:l.value[g],"onUpdate:values":B=>l.value[g]=B,"form-id":n.value[g],disabled:t.disabled},null,8,["schema","values","onUpdate:values","form-id","disabled"])]))),128)),l.value.length===0?(e.openBlock(),e.createElementBlock("div",fc,e.toDisplayString(a.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:w,disabled:!c.value},[e.createVNode(ye,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,gc)]))}}),[["__scopeId","data-v-9e39b4f5"]])},kc=e.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(s){const t=s,l=e.inject("values");async function n(){try{if(!t.api)return;const o=t.api.replace("{{value}}",t.value),a=await fetch(o);if(!a.ok){ee.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const r=await a.json();if(!t.set||!l)return;for(const[i,c]of Object.entries(t.set))l.value[i]=r.result[c]}catch(o){console.error(t.error,o)}}return(o,a)=>(e.openBlock(),e.createElementBlock("button",{onClick:n,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))}}),yc={class:"flex flex-col gap-1 w-full"},bc={key:0,class:"text-sm text-gray-500"},el=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(s,{emit:t}){const l=s,n=e.useModel(s,"modelValue"),o=t,a=e.computed(()=>Tl[`${l.layout}`]),r=e.computed(()=>Qt?.[`vs-input-${l.item.type}`]),i=e.computed(()=>{const m=e.unref(r);if(!m)return new Set;const f=m.props??m.__vccOpts?.props;if(!f)return new Set;const v=Array.isArray(f)?f:Object.keys(f);return new Set(v)}),c=e.computed(()=>{const m=l.item??{},f=i.value;return f.size?Object.fromEntries(Object.entries(m).filter(([v])=>f.has(v))):{}}),d=m=>{const f=typeof m=="object"&&m!==null?m:{value:m};o("value-selected",{...f,name:f.name??l.item?.name})};return(m,f)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),{ua:l.item.ua,error:l.error||"",item:m.item,columns:l.columns,label:l.item.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${l.item.type}-component`])},[e.createElementVNode("div",yc,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),e.mergeProps(c.value,{modelValue:n.value,"onUpdate:modelValue":f[0]||(f[0]=v=>n.value=v),onValueSelected:d}),null,16,["modelValue"])),m.item.description&&l.layout!=="settings"?(e.openBlock(),e.createElementBlock("p",bc,e.toDisplayString(m.item.description),1)):e.createCommentVNode("",!0)]),m.item.behavior?.api&&m.item.behavior?.button?(e.openBlock(),e.createBlock(kc,e.mergeProps({key:0},m.item.behavior,{value:n.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),xc={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},wc={class:"vs-compact-form-navigation__rail mt-[6px]"},_c=["onClick"],Ec=Z(e.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(s,{expose:t}){const l=s,n=e.ref([]),o=e.ref(""),a=e.ref(""),r=e.computed(()=>!!l.enabled),i=e.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),c=e.computed(()=>{const F=l.width;if(F==null)return{};const X=typeof F=="number"?`${F}px`:`${F}`;return{width:X,minWidth:X}});let d=null,m=0,f=0,v=null,w=null,V=null;const k=()=>R(),b=()=>h();e.watch(()=>l.target,async F=>{if(M(),!F){v=null,n.value=[],o.value="";return}v=F,r.value&&(await e.nextTick(),B(F),h())},{immediate:!0}),e.watch(()=>l.scrollContainer,F=>{if(!r.value){w=F??null;return}y(F??null),e.nextTick(()=>h())},{immediate:!0}),e.onMounted(()=>{l.scrollContainer||y(null),h()}),e.onBeforeUnmount(()=>{M(),y(null,!0),v=null,typeof window<"u"&&(m&&window.cancelAnimationFrame(m),f&&window.cancelAnimationFrame(f))});function y(F,X=!1){if(V&&(V(),V=null),X){w=null;return}if(w=F??null,typeof window>"u")return;const K=F??window,Q=window;K.addEventListener("scroll",k,{passive:!0}),Q.addEventListener("resize",b),V=()=>{K.removeEventListener("scroll",k),Q.removeEventListener("resize",b)}}function h(){if(!r.value||!v)return;m&&typeof window<"u"&&window.cancelAnimationFrame(m);const F=()=>{E(),m=0};typeof window>"u"?F():m=window.requestAnimationFrame(F)}function E(){if(!r.value||!v)return;const F=Array.from(v.querySelectorAll("h1, h2")),X=new Set,K=[];F.forEach((Q,z)=>{const L=Q.textContent?.trim()??"";if(!L)return;let I=(Q.getAttribute("id")??"").trim();I||(I=g(L)||`heading-${z+1}`);let U=I,J=1;for(;X.has(U);)U=`${I}-${J+=1}`;Q.id!==U&&Object.assign(Q,{id:U}),X.add(U),K.push({id:U,text:L,level:Q.tagName.toLowerCase()==="h1"?1:2})}),n.value=K,K.length||(o.value=""),T()}function g(F){return F.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function B(F){!F||!r.value||typeof MutationObserver>"u"||(M(),d=new MutationObserver(()=>h()),d.observe(F,{childList:!0,subtree:!0}))}function M(){d&&(d.disconnect(),d=null)}function S(F){const X=w;if(!X)return typeof window>"u"?F.offsetTop:F.getBoundingClientRect().top+window.scrollY;const K=F.getBoundingClientRect(),Q=X.getBoundingClientRect();return K.top-Q.top+X.scrollTop}function T(){if(!r.value||!n.value.length)return;const F=w,X=(F?F.scrollTop:null)||(typeof window<"u"?window.scrollY:0),K=(F?F.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),Q=X+K;let z=null;for(let I=0;I<n.value.length;I+=1){const U=n.value[I],J=document.getElementById(U.id);if(J){const re=S(J);re+J.offsetHeight>X&&re<Q&&(z=U.id)}}!z&&a.value&&(z=a.value),z&&(a.value=z);const L=F?F.scrollHeight-F.clientHeight:document.documentElement.scrollHeight-window.innerHeight;X+5>=L&&(z=n.value[n.value.length-1].id),z&&(o.value=z)}function R(){r.value&&(f&&window.cancelAnimationFrame(f),f=window.requestAnimationFrame(()=>{T(),f=0}))}function P(F){if(!r.value)return;const X=document.getElementById(F);if(!X)return;const K=w,Q=Math.max(0,S(X));K?K.scrollTo({top:Q,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:Q,behavior:"smooth"})}return t({refresh:h}),(F,X)=>r.value&&n.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(c.value)},[e.createElementVNode("h2",xc,e.toDisplayString(F.title),1),e.createElementVNode("div",wc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.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,_c)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-b3e16a91"]]),Te={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон"},vc=s=>typeof s=="string"?s.trim()?!1:Te.required:Array.isArray(s)?s.map(l=>typeof l=="string"?l.trim():l).filter(l=>l!=null&&l!=="").length?!1:Te.required:s?!1:Te.required,Vc=s=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return s?t.test(s)?!1:Te.email:!1},Bc=s=>{const t=/^\+[1-9]\d{1,14}$/;return s?t.test(s)?!1:Te.tel:!1},Cc=(s,t)=>{const l=t.pattern??t.regexp,n=typeof l=="string"?new RegExp(l):l;if(Array.isArray(s)){const o=s.filter(Boolean);return o.length===0||o.every(a=>n.test(a))?!1:t.message}return!n.test(s)&&s?t.message:!1},Nc=(s,t)=>!1,Sc=(s,t)=>{switch(typeof t=="string"?t:t.type){case"required":return vc(s);case"email":return Vc(s);case"tel":return Bc(s);case"regexp":return Cc(s,t);case"custom":return Nc();default:return!1}},$c={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function tl(s){const t=s.toLowerCase();return $c[t]||t}function gt(s,t=!1){if(Array.isArray(s)){const n=[];return s.forEach(o=>{const a={...o};a.name=(o.name||o.id||o.key||"").toString(),a.type=tl(o.type),a.label=o.label||o.ua,a.rules=o.rules||o.validators,a.type==="email"&&!a.rules&&(a.rules=["email"]),o.data&&(a.api=`/api/suggest/${o.data}`),a.disabled=a.disabled||t,Array.isArray(a.schema)&&(a.schema=gt(a.schema,a.disabled)),n.push(a)}),n}const l=[];return Object.entries(s).forEach(n=>{const o={name:n[0],...n[1],type:tl(n[1].type),label:n[1].label||n[1].ua,rules:n[1].rules||n[1].validators,disabled:n[1].disabled||t};o.type==="email"&&!o.rules&&(o.rules=["email"]),n[1].type.includes("list")&&(o.multiple=!0),!o.api&&n[1].data&&(o.api=`/api/suggest/${n[1].data}`),Array.isArray(o.schema)&&(o.schema=gt(o.schema,o.disabled)),l.push(o)}),l}function Mc(s,t,l=!1){const n=e.computed(()=>gt((Array.isArray(t),t),typeof l=="boolean"?l:l.value)),o=e.ref({});function a(d){const m=d?.conditions;if(!m)return!0;const f=Array.isArray(m)?m[0]:m,v=s?.value?.[f];return Rt(v,m)}const r=(d=n.value,m=!0)=>(d.forEach(f=>{if(f.rules){if(!a(f)){delete o.value[f.name];return}let v=!1,w=null;f.rules.forEach(V=>{const k=Sc(s.value[f.name],V);k&&(v=!0,!w&&typeof k=="string"&&(w=k))}),v&&w?o.value[f.name]=w:delete o.value[f.name]}f.schema&&r(f.schema,!1)}),m&&Object.values(o.value).some(Boolean)?o.value:null),i=e.computed(()=>n.value?.filter(d=>d.hidden!==!0&&a(d)));return{errors:o,validate:r,reset:()=>{s.value={},o.value={}},visibleSchema:i}}const Ac={class:"flex w-full h-full min-h-0 gap-6"},Fc={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},be=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(s,{expose:t,emit:l}){const n=l,o=s,a=e.useModel(s,"form"),r=e.useModel(s,"values"),{errors:i,validate:c,reset:d,visibleSchema:m}=Mc(r,o.schema,e.toRef(o,"disabled")),f=e.ref(null),v=e.ref(null),w=e.computed(()=>o.navigation),V=e.computed(()=>o.navWidth),k=e.computed(()=>o.style?.columns),b=Object.freeze({container:12,label:3}),y=e.computed(()=>o.columns??k.value??b),h=e.computed(()=>o.columns!=null||k.value!=null),E=e.computed(()=>h.value?"horizontal":o.layout),g=R=>R?.columns?"horizontal":E.value,B=R=>R?.columns??y.value,M=()=>{n("update:modelValue",r.value),c(),n("handle-submit",r.value)},S=R=>{n("value-selected",R)};t({validate:c,reset:d,errors:i}),e.onMounted(()=>{o.modelValue&&(r.value=o.modelValue),a.value={value:r.value,errors:i.value,reset:d,validate:c,formId:o.formId}});function T(R,P){if(R===P)return!0;if(typeof R!="object"||typeof P!="object"||!R||!P)return!1;const F=Object.keys(R),X=Object.keys(P);return F.length!==X.length?!1:F.every(K=>R[K]===P[K])}return e.provide("form",a),e.provide("values",r),(R,P)=>(e.openBlock(),e.createElementBlock("div",Ac,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:v},[e.createElementVNode("form",{ref_key:"formRef",ref:f,onSubmit:e.withModifiers(M,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",E.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),(F,X)=>(e.openBlock(),e.createElementBlock("div",{key:F.name,class:e.normalizeClass(g(F)==="horizontal"?"col-span-12":`col-span-${F.col||12}`)},[e.createVNode(el,{style:e.normalizeStyle(R.style),item:F,layout:g(F),columns:B(F),"model-value":r.value[F.name],"onUpdate:modelValue":K=>{const Q=r.value[F.name];T(Q,K)||(r.value[F.name]=K)},error:e.unref(i)[F.name],onValueSelected:S},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),g(F)==="settings"&&X+1!==e.unref(m).length?(e.openBlock(),e.createElementBlock("div",Fc)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(Ec,{target:f.value,"scroll-container":v.value,enabled:w.value,width:V.value},null,8,["target","scroll-container","enabled","width"])]))}}),Dc={class:"relative"},Ic={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},Tc={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"},Lc={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},Oc={class:"font-medium text-gray-800 dark:text-[#ffffff]"},Rc={class:"p-4 mim-h-0 h-full overflow-auto"},ll=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(s,{emit:t}){const l=s,n=t,o=e.ref(l.schema),a=e.ref(l.defaultValue?JSON.parse(JSON.stringify(l.defaultValue)):{}),r=e.ref({}),i=e.ref(l.token||""),c=e.ref(l.mode);async function d(){const f=r.value.validate();if(f){ee.notify({type:"warning",title:"Помилка валідації",message:Object.entries(f).map(([v,w])=>`${v}: ${w}`).join(`
|
|
3
|
-
`)});return}if(i.value)try{const v=await fetch(`/api/table/${i.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a.value)});if(v.ok)await v.json(),ee.notify({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`}),n("save",a.value);else if(v.status===400){const w=await v.json().catch(()=>({}));ee.notify({type:"warning",title:"Помилка валідації",message:w.message||"Некоректні дані (400)"})}else v.status===500?ee.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):ee.notify({type:"error",title:"Помилка",message:`Статус: ${v.status}`})}catch(v){ee.notify({type:"error",title:"Помилка з’єднання",message:v.message||"Не вдалося виконати запит"})}}function m(){n("close")}return e.onMounted(async()=>{try{if(l.form&&!l.schema){const f=await fetch(`/api/template/form/${l.form}`);if(!f.ok){ee.notify({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const v=await f.json();o.value=v.schema,i.value=v.token}else if(l.token&&!l.defaultValue){i.value=l.token;const f=await fetch(`/api/form/${i.value}`);if(!f.ok){ee.notify({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const v=await f.json();o.value=v.schema,v.data?a.value=v.data:c.value="add",v.obj&&(a.value={...a.value,...v.obj})}}catch(f){ee.notify({type:"error",title:"Error",message:f.message||"Unexpected error"}),console.error(f)}}),(f,v)=>(e.openBlock(),e.createElementBlock("div",Dc,[e.createElementVNode("div",Ic,[e.createElementVNode("div",Tc,[e.createElementVNode("div",Lc,[e.createElementVNode("h3",Oc,e.toDisplayString(c.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"},[...v[2]||(v[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",Rc,[o.value?(e.openBlock(),e.createBlock(be,{key:0,schema:o.value,values:a.value,"onUpdate:values":v[0]||(v[0]=w=>a.value=w),form:r.value,"onUpdate:form":v[1]||(v[1]=w=>r.value=w)},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:d,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"}," Зберегти ")])])])]))}}),zc=["placeholder","disabled","name"],jc=["type","value","onInput","placeholder","disabled"],Uc=["onClick"],Pc=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(s){const t=s,l=e.ref(t.count),n=e.computed(()=>t.limit),{inputClass:o}=ie(t.style),a=e.useModel(s,"modelValue"),r=e.computed(()=>!!t.disabled),i=e.computed(()=>t.placeholder??"");e.watchEffect(()=>{const k=a.value?.length??0;k<l.value&&(a.value=[...a.value??[],...Array(l.value-k)])});const c=e.ref({}),d=e.ref({});function m(k,b){k&&(c.value[b]=k)}async function f(k,b){if(!k||t.inputType!=="mask")return;const{default:y}=await Promise.resolve().then(()=>gl);d.value[b]&&d.value[b].destroy(),d.value[b]=y(k,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),d.value[b].on("accept",()=>{const h=[...a.value||[]];h[b]=t.unmask?d.value[b].unmaskedValue:d.value[b].value,a.value=h}),d.value[b].on("complete",()=>{const h=[...a.value||[]];h[b]=t.unmask?d.value[b].unmaskedValue:d.value[b].value,a.value=h}),a.value?.[b]&&(d.value[b].value=a.value[b])}function v(k,b){if(r.value)return;const y=k.target.value??null,h=[...a.value];h[b]=t.inputType==="text"?y:Number(y),a.value=h}function w(){l.value+=1;const k=t.inputType==="text"||t.inputType==="mask"?null:0;a.value=[...a.value,k],t.inputType==="mask"&&setTimeout(()=>{const b=l.value-1;c.value[b]&&f(c.value[b],b)},0)}function V(k){if(l.value>1){d.value[k]&&(d.value[k].destroy(),delete d.value[k]),l.value-=1,a.value=a.value.filter((y,h)=>h!==k);const b={};Object.keys(d.value).forEach(y=>{const h=parseInt(y,10);h>k?b[h-1]=d.value[h]:h<k&&(b[h]=d.value[h])}),d.value=b}}return e.onMounted(()=>{if(t.inputType==="mask")for(let k=0;k<l.value;k+=1)c.value[k]&&f(c.value[k],k)}),e.onBeforeUnmount(()=>{Object.values(d.value).forEach(k=>{k&&k.destroy()})}),e.watch(()=>t.mask,k=>{t.inputType==="mask"&&Object.values(d.value).forEach(b=>{b&&b.updateOptions({mask:k,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})})}),e.watch(a,k=>{t.inputType==="mask"&&k&&k.forEach((b,y)=>{d.value[y]&&d.value[y].value!==b&&(d.value[y].value=b||"")})},{deep:!0}),(k,b)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["grid gap-2",`grid-cols-${n.value}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,y=>(e.openBlock(),e.createElementBlock("div",{key:y,class:"flex items-center gap-2 w-full"},[k.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:h=>m(h,y-1),placeholder:k.placeholder,disabled:k.disabled,name:`${k.name}[${y-1}]`,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":k.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,zc)):(e.openBlock(),e.createElementBlock("input",{key:1,type:k.inputType,value:a.value?.[y-1],onInput:h=>v(h,y-1),placeholder:i.value,disabled:r.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":k.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,jc)),!k.disabled&&y===l.value&&k.isAdded?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:e.withModifiers(w,["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(ye,{height:"18",width:"18"})])):e.createCommentVNode("",!0),!k.disabled&&l.value>1&&k.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(h=>V(y-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(rt,{height:"18",width:"18"})],8,Uc)):e.createCommentVNode("",!0)]))),128))],2))}}),nl=(s={mode:"edit",schema:null})=>new Promise(t=>{const{close:l}=ee.modal({title:s.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:ll,contentProps:{...s,onClose:()=>{t(null),l()},onSave:n=>{t(n),l()}}})});be.install=function(t){t.component("VForm",be),Object.assign(t.config.globalProperties,{$form:nl}),t.provide("form",nl),window.v3plugin||(window.v3plugin={})};function _e(s){return typeof s=="string"||s instanceof String}function ol(s){var t;return typeof s=="object"&&s!=null&&(s==null||(t=s.constructor)==null?void 0:t.name)==="Object"}function al(s,t){return Array.isArray(t)?al(s,(l,n)=>t.includes(n)):Object.entries(s).reduce((l,n)=>{let[o,a]=n;return t(a,o)&&(l[o]=a),l},{})}const O={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function sl(s){switch(s){case O.LEFT:return O.FORCE_LEFT;case O.RIGHT:return O.FORCE_RIGHT;default:return s}}function kt(s){return s.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function qe(s,t){if(t===s)return!0;const l=Array.isArray(t),n=Array.isArray(s);let o;if(l&&n){if(t.length!=s.length)return!1;for(o=0;o<t.length;o++)if(!qe(t[o],s[o]))return!1;return!0}if(l!=n)return!1;if(t&&s&&typeof t=="object"&&typeof s=="object"){const a=t instanceof Date,r=s instanceof Date;if(a&&r)return t.getTime()==s.getTime();if(a!=r)return!1;const i=t instanceof RegExp,c=s instanceof RegExp;if(i&&c)return t.toString()==s.toString();if(i!=c)return!1;const d=Object.keys(t);for(o=0;o<d.length;o++)if(!Object.prototype.hasOwnProperty.call(s,d[o]))return!1;for(o=0;o<d.length;o++)if(!qe(s[d[o]],t[d[o]]))return!1;return!0}else if(t&&s&&typeof t=="function"&&typeof s=="function")return t.toString()===s.toString();return!1}class Hc{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?O.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?O.RIGHT:O.LEFT}}function G(s,t){return new G.InputMask(s,t)}function rl(s){if(s==null)throw new Error("mask property should be defined");return s instanceof RegExp?G.MaskedRegExp:_e(s)?G.MaskedPattern:s===Date?G.MaskedDate:s===Number?G.MaskedNumber:Array.isArray(s)||s===Array?G.MaskedDynamic:G.Masked&&s.prototype instanceof G.Masked?s:G.Masked&&s instanceof G.Masked?s.constructor:s instanceof Function?G.MaskedFunction:(console.warn("Mask not found for mask",s),G.Masked)}function Me(s){if(!s)throw new Error("Options in not defined");if(G.Masked){if(s.prototype instanceof G.Masked)return{mask:s};const{mask:t=void 0,...l}=s instanceof G.Masked?{mask:s}:ol(s)&&s.mask instanceof G.Masked?s:{};if(t){const n=t.mask;return{...al(t,(o,a)=>!a.startsWith("_")),mask:t.constructor,_mask:n,...l}}}return ol(s)?{...s}:{mask:s}}function me(s){if(G.Masked&&s instanceof G.Masked)return s;const t=Me(s),l=rl(t.mask);if(!l)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===l&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new l(t)}G.createMask=me;class Ze{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,l){if(!(t==null||l==null||t===this.selectionStart&&l===this.selectionEnd))try{this._unsafeSelect(t,l)}catch{}}get isActive(){return!1}}G.MaskElement=Ze;const il=90,Gc=89;class Le extends Ze{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,l,n;return(t=(l=(n=this.input).getRootNode)==null?void 0:l.call(n))!=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===il&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===Gc&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===il&&(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={}}}G.HTMLMaskElement=Le;class cl extends Le{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,l){this.input.setSelectionRange(t,l)}get value(){return this.input.value}set value(t){this.input.value=t}}G.HTMLMaskElement=Le;class yt extends Le{get _unsafeSelectionStart(){const t=this.rootElement,l=t.getSelection&&t.getSelection(),n=l&&l.anchorOffset,o=l&&l.focusOffset;return o==null||n==null||n<o?n:o}get _unsafeSelectionEnd(){const t=this.rootElement,l=t.getSelection&&t.getSelection(),n=l&&l.anchorOffset,o=l&&l.focusOffset;return o==null||n==null||n>o?n:o}_unsafeSelect(t,l){if(!this.rootElement.createRange)return;const n=this.rootElement.createRange();n.setStart(this.input.firstChild||this.input,t),n.setEnd(this.input.lastChild||this.input,l);const o=this.rootElement,a=o.getSelection&&o.getSelection();a&&(a.removeAllRanges(),a.addRange(n))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}G.HTMLContenteditableMaskElement=yt;class We{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>We.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}}We.MAX_LENGTH=100;class dl{constructor(t,l){this.el=t instanceof Ze?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new yt(t):new cl(t),this.masked=me(l),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new We,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 l;return t==null||((l=this.masked)==null?void 0:l.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof G.Masked)&&this.masked.constructor===rl(t)){this.masked.updateOptions({mask:t});return}const l=t instanceof G.Masked?t:me({mask:t});l.unmaskedValue=this.masked.unmaskedValue,this.masked=l}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,l){const n=this._listeners[t];n&&n.forEach(o=>o(l))}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 l=this.masked.unmaskedValue,n=this.masked.value,o=this.masked.rawInputValue,a=this.displayValue,r=this.unmaskedValue!==l||this.value!==n||this._rawInputValue!==o;this._unmaskedValue=l,this._value=n,this._rawInputValue=o,this.el.value!==a&&(this.el.value=a),t==="auto"?this.alignCursor():t!=null&&(this.cursorPos=t),r&&this._fireChangeEvents(),!this._historyChanging&&(r||this.history.isEmpty)&&this.history.push({unmaskedValue:l,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:l,...n}=t,o=!this.maskEquals(l),a=this.masked.optionsIsChanged(n);o&&(this.mask=l),a&&this.masked.updateOptions(n),(o||a)&&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,O.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,l){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(l),this}off(t,l){if(!this._listeners[t])return this;if(!l)return delete this._listeners[t],this;const n=this._listeners[t].indexOf(l);return n>=0&&this._listeners[t].splice(n,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const l=new Hc({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),n=this.masked.rawInputValue,o=this.masked.splice(l.startChangePos,l.removed.length,l.inserted,l.removeDirection,{input:!0,raw:!0}).offset,a=n===this.masked.rawInputValue?l.removeDirection:O.NONE;let r=this.masked.nearestInputPos(l.startChangePos+o,a);a!==O.NONE&&(r=this.masked.nearestInputPos(r,O.NONE)),this.updateControl(r),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}}G.InputMask=dl;class q{static normalize(t){return Array.isArray(t)?t:[t,new q]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}G.ChangeDetails=q;class fe{constructor(t,l,n){t===void 0&&(t=""),l===void 0&&(l=0),this.value=t,this.from=l,this.stop=n}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 l=this.value[0];return this.value=this.value.slice(1),l}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class ne{constructor(t){this._value="",this._update({...ne.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,l){l===void 0&&(l={input:!0}),this.reset(),this.append(t,l,""),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,l){return t}totalInputPositions(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),Math.min(this.displayValue.length,l-t)}extractInput(t,l,n){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),this.displayValue.slice(t,l)}extractTail(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),new fe(this.extractInput(t,l),t)}appendTail(t){return _e(t)&&(t=new fe(String(t))),t.appendTo(this)}_appendCharRaw(t,l){return t?(this._value+=t,new q({inserted:t,rawInserted:t})):new q}_appendChar(t,l,n){l===void 0&&(l={});const o=this.state;let a;if([t,a]=this.doPrepareChar(t,l),t&&(a=a.aggregate(this._appendCharRaw(t,l)),!a.rawInserted&&this.autofix==="pad")){const r=this.state;this.state=o;let i=this.pad(l);const c=this._appendCharRaw(t,l);i=i.aggregate(c),c.rawInserted||i.equals(a)?a=i:this.state=r}if(a.inserted){let r,i=this.doValidate(l)!==!1;if(i&&n!=null){const c=this.state;if(this.overwrite===!0){r=n.state;for(let m=0;m<a.rawInserted.length;++m)n.unshift(this.displayValue.length-a.tailShift)}let d=this.appendTail(n);if(i=d.rawInserted.length===n.toString().length,!(i&&d.inserted)&&this.overwrite==="shift"){this.state=c,r=n.state;for(let m=0;m<a.rawInserted.length;++m)n.shift();d=this.appendTail(n),i=d.rawInserted.length===n.toString().length}i&&d.inserted&&(this.state=c)}i||(a=new q,this.state=o,n&&r&&(n.state=r))}return a}_appendPlaceholder(){return new q}_appendEager(){return new q}append(t,l,n){if(!_e(t))throw new Error("value should be string");const o=_e(n)?new fe(String(n)):n;l!=null&&l.tail&&(l._beforeTailState=this.state);let a;[t,a]=this.doPrepare(t,l);for(let r=0;r<t.length;++r){const i=this._appendChar(t[r],l,o);if(!i.rawInserted&&!this.doSkipInvalid(t[r],l,o))break;a.aggregate(i)}return(this.eager===!0||this.eager==="append")&&l!=null&&l.input&&t&&a.aggregate(this._appendEager()),o!=null&&(a.tailShift+=this.appendTail(o).tailShift),a}remove(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(l),new q}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const l=this.rawInputValue,n=this.value,o=t();return this.rawInputValue=l,this.value&&this.value!==n&&n.indexOf(this.value)===0&&(this.append(n.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,o}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const l=this.state,n=t(this);return this.state=l,delete this._isolated,n}doSkipInvalid(t,l,n){return!!this.skipInvalid}doPrepare(t,l){return l===void 0&&(l={}),q.normalize(this.prepare?this.prepare(t,this,l):t)}doPrepareChar(t,l){return l===void 0&&(l={}),q.normalize(this.prepareChar?this.prepareChar(t,this,l):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,l,n,o,a){n===void 0&&(n=""),o===void 0&&(o=O.NONE),a===void 0&&(a={input:!0});const r=t+l,i=this.extractTail(r),c=this.eager===!0||this.eager==="remove";let d;c&&(o=sl(o),d=this.extractInput(0,r,{raw:!0}));let m=t;const f=new q;if(o!==O.NONE&&(m=this.nearestInputPos(t,l>1&&t!==0&&!c?O.NONE:o),f.tailShift=m-t),f.aggregate(this.remove(m)),c&&o!==O.NONE&&d===this.rawInputValue)if(o===O.FORCE_LEFT){let v;for(;d===this.rawInputValue&&(v=this.displayValue.length);)f.aggregate(new q({tailShift:-1})).aggregate(this.remove(v-1))}else o===O.FORCE_RIGHT&&i.unshift();return f.aggregate(this.append(n,a,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!qe(this,t)}typedValueEquals(t){const l=this.typedValue;return t===l||ne.EMPTY_VALUES.includes(t)&&ne.EMPTY_VALUES.includes(l)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new q}}ne.DEFAULTS={skipInvalid:!0},ne.EMPTY_VALUES=[void 0,null,""],G.Masked=ne;class Ee{constructor(t,l){t===void 0&&(t=[]),l===void 0&&(l=0),this.chunks=t,this.from=l}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=_e(t)?new fe(String(t)):t;const l=this.chunks[this.chunks.length-1],n=l&&(l.stop===t.stop||t.stop==null)&&t.from===l.from+l.toString().length;if(t instanceof fe)n?l.extend(t.toString()):this.chunks.push(t);else if(t instanceof Ee){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 G.MaskedPattern))return new fe(this.toString()).appendTo(t);const l=new q;for(let n=0;n<this.chunks.length;++n){const o=this.chunks[n],a=t._mapPosToBlock(t.displayValue.length),r=o.stop;let i;if(r!=null&&(!a||a.index<=r)&&((o instanceof Ee||t._stops.indexOf(r)>=0)&&l.aggregate(t._appendPlaceholder(r)),i=o instanceof Ee&&t._blocks[r]),i){const c=i.appendTail(o);l.aggregate(c);const d=o.toString().slice(c.rawInserted.length);d&&l.aggregate(t.append(d,{tail:!0}))}else l.aggregate(t.append(o.toString(),{tail:!0}))}return l}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:l,...n}=t;Object.assign(this,n),this.chunks=l.map(o=>{const a="chunks"in o?new Ee:new fe;return a.state=o,a})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const l=t!=null?t-this.from:t;let n=0;for(;n<this.chunks.length;){const o=this.chunks[n],a=o.unshift(l);if(o.toString()){if(!a)break;++n}else this.chunks.splice(n,1);if(a)return a}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const l=this.chunks[t],n=l.shift();if(l.toString()){if(!n)break;--t}else this.chunks.splice(t,1);if(n)return n}return""}}class Kc{constructor(t,l){this.masked=t,this._log=[];const{offset:n,index:o}=t._mapPosToBlock(l)||(l<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=n,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=((l=this.block)==null?void 0:l.displayValue.length)||0){var l;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,O.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,O.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,O.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,O.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,O.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,O.NONE),!0})}}class bt{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,l){return t===void 0&&(t=0),l===void 0&&(l=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(l),this._value||(this._isRawInput=!1),new q}nearestInputPos(t,l){l===void 0&&(l=O.NONE);const n=0,o=this._value.length;switch(l){case O.LEFT:case O.FORCE_LEFT:return n;case O.NONE:case O.RIGHT:case O.FORCE_RIGHT:default:return o}}totalInputPositions(t,l){return t===void 0&&(t=0),l===void 0&&(l=this._value.length),this._isRawInput?l-t:0}extractInput(t,l,n){return t===void 0&&(t=0),l===void 0&&(l=this._value.length),n===void 0&&(n={}),n.raw&&this._isRawInput&&this._value.slice(t,l)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,l){if(l===void 0&&(l={}),this.isFilled)return new q;const n=this.eager===!0||this.eager==="append",a=this.char===t&&(this.isUnmasking||l.input||l.raw)&&(!l.raw||!n)&&!l.tail,r=new q({inserted:this.char,rawInserted:a?this.char:""});return this._value=this.char,this._isRawInput=a&&(l.raw||l.input),r}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new q;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new fe("")}appendTail(t){return _e(t)&&(t=new fe(String(t))),t.appendTo(this)}append(t,l,n){const o=this._appendChar(t[0],l);return n!=null&&(o.tailShift+=this.appendTail(n).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 Oe{constructor(t){const{parent:l,isOptional:n,placeholderChar:o,displayChar:a,lazy:r,eager:i,...c}=t;this.masked=me(c),Object.assign(this,{parent:l,isOptional:n,placeholderChar:o,displayChar:a,lazy:r,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.value.length),t===0&&l>=1?(this.isFilled=!1,this.masked.remove(t,l)):new q}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(t,l){if(l===void 0&&(l={}),this.isFilled)return new q;const n=this.masked.state;let o=this.masked._appendChar(t,this.currentMaskFlags(l));return o.inserted&&this.doValidate(l)===!1&&(o=new q,this.masked.state=n),!o.inserted&&!this.isOptional&&!this.lazy&&!l.input&&(o.inserted=this.placeholderChar),o.skip=!o.inserted&&!this.isOptional,this.isFilled=!!o.inserted,o}append(t,l,n){return this.masked.append(t,this.currentMaskFlags(l),n)}_appendPlaceholder(){return this.isFilled||this.isOptional?new q:(this.isFilled=!0,new q({inserted:this.placeholderChar}))}_appendEager(){return new q}extractTail(t,l){return this.masked.extractTail(t,l)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,l,n){return t===void 0&&(t=0),l===void 0&&(l=this.value.length),this.masked.extractInput(t,l,n)}nearestInputPos(t,l){l===void 0&&(l=O.NONE);const n=0,o=this.value.length,a=Math.min(Math.max(t,n),o);switch(l){case O.LEFT:case O.FORCE_LEFT:return this.isComplete?a:n;case O.RIGHT:case O.FORCE_RIGHT:return this.isComplete?a:o;case O.NONE:default:return a}}totalInputPositions(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.value.length),this.value.slice(t,l).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 l;return{...t,_beforeTailState:(t==null||(l=t._beforeTailState)==null?void 0:l.masked)||t?._beforeTailState}}pad(t){return new q}}Oe.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 ul extends ne{updateOptions(t){super.updateOptions(t)}_update(t){const l=t.mask;l&&(t.validate=n=>n.search(l)>=0),super._update(t)}}G.MaskedRegExp=ul;class oe extends ne{constructor(t){super({...oe.DEFAULTS,...t,definitions:Object.assign({},Oe.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 l=this.mask;if(!l||!t)return;let n=!1,o=!1;for(let a=0;a<l.length;++a){if(this.blocks){const d=l.slice(a),m=Object.keys(this.blocks).filter(v=>d.indexOf(v)===0);m.sort((v,w)=>w.length-v.length);const f=m[0];if(f){const{expose:v,repeat:w,...V}=Me(this.blocks[f]),k={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...V,repeat:w,parent:this},b=w!=null?new G.RepeatBlock(k):me(k);b&&(this._blocks.push(b),v&&(this.exposeBlock=b),this._maskedBlocks[f]||(this._maskedBlocks[f]=[]),this._maskedBlocks[f].push(this._blocks.length-1)),a+=f.length-1;continue}}let r=l[a],i=r in t;if(r===oe.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(r==="{"||r==="}"){n=!n;continue}if(r==="["||r==="]"){o=!o;continue}if(r===oe.ESCAPE_CHAR){if(++a,r=l[a],!r)break;i=!1}const c=i?new Oe({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...Me(t[r]),parent:this}):new bt({char:r,eager:this.eager,isUnmasking:n});this._blocks.push(c)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:l,...n}=t;this._blocks.forEach((o,a)=>o.state=l[a]),super.state=n}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,l)=>t+=l.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const l=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(l),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,l)=>t+=l.value,"")}set value(t){if(this.exposeBlock){const l=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(l),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const l=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(l),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,l)=>t+=l.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const l=new q;let n=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(n==null)return l;this._blocks[n].isFilled&&++n;for(let o=n;o<this._blocks.length;++o){const a=this._blocks[o]._appendEager();if(!a.inserted)break;l.aggregate(a)}return l}_appendCharRaw(t,l){l===void 0&&(l={});const n=this._mapPosToBlock(this.displayValue.length),o=new q;if(!n)return o;for(let r=n.index,i;i=this._blocks[r];++r){var a;const c=i._appendChar(t,{...l,_beforeTailState:(a=l._beforeTailState)==null||(a=a._blocks)==null?void 0:a[r]});if(o.aggregate(c),c.consumed)break}return o}extractTail(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length);const n=new Ee;return t===l||this._forEachBlocksInRange(t,l,(o,a,r,i)=>{const c=o.extractTail(r,i);c.stop=this._findStopBefore(a),c.from=this._blockStartPos(a),c instanceof Ee&&(c.blockIndex=a),n.extend(c)}),n}extractInput(t,l,n){if(t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),n===void 0&&(n={}),t===l)return"";let o="";return this._forEachBlocksInRange(t,l,(a,r,i,c)=>{o+=a.extractInput(i,c,n)}),o}_findStopBefore(t){let l;for(let n=0;n<this._stops.length;++n){const o=this._stops[n];if(o<=t)l=o;else break}return l}_appendPlaceholder(t){const l=new q;if(this.lazy&&t==null)return l;const n=this._mapPosToBlock(this.displayValue.length);if(!n)return l;const o=n.index,a=t??this._blocks.length;return this._blocks.slice(o,a).forEach(r=>{if(!r.lazy||t!=null){var i;l.aggregate(r._appendPlaceholder((i=r._blocks)==null?void 0:i.length))}}),l}_mapPosToBlock(t){let l="";for(let n=0;n<this._blocks.length;++n){const o=this._blocks[n],a=l.length;if(l+=o.displayValue,t<=l.length)return{index:n,offset:t-a}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((l,n)=>l+=n.displayValue.length,0)}_forEachBlocksInRange(t,l,n){l===void 0&&(l=this.displayValue.length);const o=this._mapPosToBlock(t);if(o){const a=this._mapPosToBlock(l),r=a&&o.index===a.index,i=o.offset,c=a&&r?a.offset:this._blocks[o.index].displayValue.length;if(n(this._blocks[o.index],o.index,i,c),a&&!r){for(let d=o.index+1;d<a.index;++d)n(this._blocks[d],d,0,this._blocks[d].displayValue.length);n(this._blocks[a.index],a.index,0,a.offset)}}}remove(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length);const n=super.remove(t,l);return this._forEachBlocksInRange(t,l,(o,a,r,i)=>{n.aggregate(o.remove(r,i))}),n}nearestInputPos(t,l){if(l===void 0&&(l=O.NONE),!this._blocks.length)return 0;const n=new Kc(this,t);if(l===O.NONE)return n.pushRightBeforeInput()||(n.popState(),n.pushLeftBeforeInput())?n.pos:this.displayValue.length;if(l===O.LEFT||l===O.FORCE_LEFT){if(l===O.LEFT){if(n.pushRightBeforeFilled(),n.ok&&n.pos===t)return t;n.popState()}if(n.pushLeftBeforeInput(),n.pushLeftBeforeRequired(),n.pushLeftBeforeFilled(),l===O.LEFT){if(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.ok&&n.pos<=t||(n.popState(),n.ok&&n.pos<=t))return n.pos;n.popState()}return n.ok?n.pos:l===O.FORCE_LEFT?0:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:0)}return l===O.RIGHT||l===O.FORCE_RIGHT?(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.pushRightBeforeFilled()?n.pos:l===O.FORCE_RIGHT?this.displayValue.length:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:this.nearestInputPos(t,O.LEFT))):t}totalInputPositions(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length);let n=0;return this._forEachBlocksInRange(t,l,(o,a,r,i)=>{n+=o.totalInputPositions(r,i)}),n}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const l=this._maskedBlocks[t];return l?l.map(n=>this._blocks[n]):[]}pad(t){const l=new q;return this._forEachBlocksInRange(0,this.displayValue.length,n=>l.aggregate(n.pad(t))),l}}oe.DEFAULTS={...ne.DEFAULTS,lazy:!0,placeholderChar:"_"},oe.STOP_CHAR="`",oe.ESCAPE_CHAR="\\",oe.InputDefinition=Oe,oe.FixedDefinition=bt,G.MaskedPattern=oe;class Re extends oe{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:l=this.to||0,from:n=this.from||0,maxLength:o=this.maxLength||0,autofix:a=this.autofix,...r}=t;this.to=l,this.from=n,this.maxLength=Math.max(String(l).length,o),this.autofix=a;const i=String(this.from).padStart(this.maxLength,"0"),c=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<c.length&&c[d]===i[d];)++d;r.mask=c.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(r)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let l="",n="";const[,o,a]=t.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(l="0".repeat(o.length)+a,n="9".repeat(o.length)+a),l=l.padEnd(this.maxLength,"0"),n=n.padEnd(this.maxLength,"9"),[l,n]}doPrepareChar(t,l){l===void 0&&(l={});let n;return[t,n]=super.doPrepareChar(t.replace(/\D/g,""),l),t||(n.skip=!this.isComplete),[t,n]}_appendCharRaw(t,l){if(l===void 0&&(l={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,l);const n=String(this.from).padStart(this.maxLength,"0"),o=String(this.to).padStart(this.maxLength,"0"),[a,r]=this.boundaries(this.value+t);return Number(r)<this.from?super._appendCharRaw(n[this.value.length],l):Number(a)>this.to?!l.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(n[this.value.length],l).aggregate(this._appendCharRaw(t,l)):super._appendCharRaw(o[this.value.length],l):super._appendCharRaw(t,l)}doValidate(t){const l=this.value;if(l.search(/[^0]/)===-1&&l.length<=this._matchFrom)return!0;const[o,a]=this.boundaries(l);return this.from<=Number(a)&&Number(o)<=this.to&&super.doValidate(t)}pad(t){const l=new q;if(this.value.length===this.maxLength)return l;const n=this.value,o=this.maxLength-this.value.length;if(o){this.reset();for(let a=0;a<o;++a)l.aggregate(super._appendCharRaw("0",t));n.split("").forEach(a=>this._appendCharRaw(a))}return l}}G.MaskedRange=Re;const qc="d{.}`m{.}`Y";class ge extends oe{static extractPatternOptions(t){const{mask:l,pattern:n,...o}=t;return{...o,mask:_e(l)?l:n}}constructor(t){super(ge.extractPatternOptions({...ge.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:l,pattern:n,blocks:o,...a}={...ge.DEFAULTS,...t},r=Object.assign({},ge.GET_DEFAULT_BLOCKS());t.min&&(r.Y.from=t.min.getFullYear()),t.max&&(r.Y.to=t.max.getFullYear()),t.min&&t.max&&r.Y.from===r.Y.to&&(r.m.from=t.min.getMonth()+1,r.m.to=t.max.getMonth()+1,r.m.from===r.m.to&&(r.d.from=t.min.getDate(),r.d.to=t.max.getDate())),Object.assign(r,this.blocks,o),super._update({...a,mask:_e(l)?l:n,blocks:r})}doValidate(t){const l=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&l!=null&&(this.min==null||this.min<=l)&&(this.max==null||l<=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(ge.extractPatternOptions(t))}}ge.GET_DEFAULT_BLOCKS=()=>({d:{mask:Re,from:1,to:31,maxLength:2},m:{mask:Re,from:1,to:12,maxLength:2},Y:{mask:Re,from:1900,to:9999}}),ge.DEFAULTS={...oe.DEFAULTS,mask:Date,pattern:qc,format:(s,t)=>{if(!s)return"";const l=String(s.getDate()).padStart(2,"0"),n=String(s.getMonth()+1).padStart(2,"0"),o=s.getFullYear();return[l,n,o].join(".")},parse:(s,t)=>{const[l,n,o]=s.split(".").map(Number);return new Date(o,n-1,l)}},G.MaskedDate=ge;class ze extends ne{constructor(t){super({...ze.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(l=>{const{expose:n,...o}=Me(l),a=me({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...o});return n&&(this.exposeMask=a),a}):[])}_appendCharRaw(t,l){l===void 0&&(l={});const n=this._applyDispatch(t,l);return this.currentMask&&n.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(l))),n}_applyDispatch(t,l,n){t===void 0&&(t=""),l===void 0&&(l={}),n===void 0&&(n="");const o=l.tail&&l._beforeTailState!=null?l._beforeTailState._value:this.value,a=this.rawInputValue,r=l.tail&&l._beforeTailState!=null?l._beforeTailState._rawInputValue:a,i=a.slice(r.length),c=this.currentMask,d=new q,m=c?.state;return this.currentMask=this.doDispatch(t,{...l},n),this.currentMask&&(this.currentMask!==c?(this.currentMask.reset(),r&&(this.currentMask.append(r,{raw:!0}),d.tailShift=this.currentMask.value.length-o.length),i&&(d.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):m&&(this.currentMask.state=m)),d}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const l=new q;return t&&l.aggregate(this._applyDispatch("",{},t)),l.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var l,n;return{...t,_beforeTailState:((l=t._beforeTailState)==null?void 0:l.currentMaskRef)===this.currentMask&&((n=t._beforeTailState)==null?void 0:n.currentMask)||t._beforeTailState}}doDispatch(t,l,n){return l===void 0&&(l={}),n===void 0&&(n=""),this.dispatch(t,this,l,n)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,l){l===void 0&&(l={});let[n,o]=super.doPrepare(t,l);if(this.currentMask){let a;[n,a]=super.doPrepare(n,this.currentMaskFlags(l)),o=o.aggregate(a)}return[n,o]}doPrepareChar(t,l){l===void 0&&(l={});let[n,o]=super.doPrepareChar(t,l);if(this.currentMask){let a;[n,a]=super.doPrepareChar(n,this.currentMaskFlags(l)),o=o.aggregate(a)}return[n,o]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(l=>l.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 l=String(t);this.currentMask&&(this.currentMask.typedValue=t,l=this.currentMask.unmaskedValue),this.unmaskedValue=l}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,l){const n=new q;return this.currentMask&&n.aggregate(this.currentMask.remove(t,l)).aggregate(this._applyDispatch()),n}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(l=>l.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:l,currentMaskRef:n,currentMask:o,...a}=t;l&&this.compiledMasks.forEach((r,i)=>r.state=l[i]),n!=null&&(this.currentMask=n,this.currentMask.state=o),super.state=a}extractInput(t,l,n){return this.currentMask?this.currentMask.extractInput(t,l,n):""}extractTail(t,l){return this.currentMask?this.currentMask.extractTail(t,l):super.extractTail(t,l)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,l){return this.currentMask?this.currentMask.nearestInputPos(t,l):super.nearestInputPos(t,l)}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((l,n)=>{if(!t[n])return;const{mask:o,...a}=t[n];return qe(l,a)&&l.maskEquals(o)}):super.maskEquals(t)}typedValueEquals(t){var l;return!!((l=this.currentMask)!=null&&l.typedValueEquals(t))}}ze.DEFAULTS={...ne.DEFAULTS,dispatch:(s,t,l,n)=>{if(!t.compiledMasks.length)return;const o=t.rawInputValue,a=t.compiledMasks.map((r,i)=>{const c=t.currentMask===r,d=c?r.displayValue.length:r.nearestInputPos(r.displayValue.length,O.FORCE_LEFT);return r.rawInputValue!==o?(r.reset(),r.append(o,{raw:!0})):c||r.remove(d),r.append(s,t.currentMaskFlags(l)),r.appendTail(n),{index:i,weight:r.rawInputValue.length,totalInputPositions:r.totalInputPositions(0,Math.max(d,r.nearestInputPos(r.displayValue.length,O.FORCE_LEFT)))}});return a.sort((r,i)=>i.weight-r.weight||i.totalInputPositions-r.totalInputPositions),t.compiledMasks[a[0].index]}},G.MaskedDynamic=ze;class je extends oe{constructor(t){super({...je.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:l,...n}=t;if(l){const o=l.map(i=>i.length),a=Math.min(...o),r=Math.max(...o)-a;n.mask="*".repeat(a),r&&(n.mask+="["+"*".repeat(r)+"]"),this.enum=l}super._update(n)}_appendCharRaw(t,l){l===void 0&&(l={});const n=Math.min(this.nearestInputPos(0,O.FORCE_RIGHT),this.value.length),o=this.enum.filter(a=>this.matchValue(a,this.unmaskedValue+t,n));if(o.length){o.length===1&&this._forEachBlocksInRange(0,this.value.length,(r,i)=>{const c=o[0][i];i>=this.value.length||c===r.value||(r.reset(),r._appendChar(c,l))});const a=super._appendCharRaw(o[0][this.value.length],l);return o.length===1&&o[0].slice(this.unmaskedValue.length).split("").forEach(r=>a.aggregate(super._appendCharRaw(r))),a}return new q({skip:!this.isComplete})}extractTail(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),new fe("",t)}remove(t,l){if(t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),t===l)return new q;const n=Math.min(super.nearestInputPos(0,O.FORCE_RIGHT),this.value.length);let o;for(o=t;o>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(n,o),n)).length>1);--o);const a=super.remove(o,l);return a.tailShift+=o-t,a}get isComplete(){return this.enum.indexOf(this.value)>=0}}je.DEFAULTS={...oe.DEFAULTS,matchValue:(s,t,l)=>s.indexOf(t,l)===l},G.MaskedEnum=je;class pl extends ne{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}G.MaskedFunction=pl;var hl;class ce extends ne{constructor(t){super({...ce.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),l="\\d*",n=(this.scale?"("+kt(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+l+n),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(kt).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(kt(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const l=t.split(this.radix);return l[0]=l[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),l.join(this.radix)}doPrepareChar(t,l){l===void 0&&(l={});const[n,o]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(l.input&&l.raw||!l.input&&!l.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),l);return t&&!n&&(o.skip=!0),n&&!this.allowPositive&&!this.value&&n!=="-"&&o.aggregate(this._appendChar("-")),[n,o]}_separatorsCount(t,l){l===void 0&&(l=!1);let n=0;for(let o=0;o<t;++o)this._value.indexOf(this.thousandsSeparator,o)===o&&(++n,l&&(t+=this.thousandsSeparator.length));return n}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,l,n){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),[t,l]=this._adjustRangeWithSeparators(t,l),this._removeThousandsSeparators(super.extractInput(t,l,n))}_appendCharRaw(t,l){l===void 0&&(l={});const n=l.tail&&l._beforeTailState?l._beforeTailState._value:this._value,o=this._separatorsCountFromSlice(n);this._value=this._removeThousandsSeparators(this.value);const a=this._value;this._value+=t;const r=this.number;let i=!isNaN(r),c=!1;if(i){let v;this.min!=null&&this.min<0&&this.number<this.min&&(v=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(v=this.max),v!=null&&(this.autofix?(this._value=this.format(v,this).replace(ce.UNMASKED_RADIX,this.radix),c||(c=a===this._value&&!l.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let d;i?d=new q({inserted:this._value.slice(a.length),rawInserted:c?"":t,skip:c}):(this._value=a,d=new q),this._value=this._insertThousandsSeparators(this._value);const m=l.tail&&l._beforeTailState?l._beforeTailState._value:this._value,f=this._separatorsCountFromSlice(m);return d.tailShift+=(f-o)*this.thousandsSeparator.length,d}_findSeparatorAround(t){if(this.thousandsSeparator){const l=t-this.thousandsSeparator.length+1,n=this.value.indexOf(this.thousandsSeparator,l);if(n<=t)return n}return-1}_adjustRangeWithSeparators(t,l){const n=this._findSeparatorAround(t);n>=0&&(t=n);const o=this._findSeparatorAround(l);return o>=0&&(l=o+this.thousandsSeparator.length),[t,l]}remove(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),[t,l]=this._adjustRangeWithSeparators(t,l);const n=this.value.slice(0,t),o=this.value.slice(l),a=this._separatorsCount(n.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(n+o));const r=this._separatorsCountFromSlice(n);return new q({tailShift:(r-a)*this.thousandsSeparator.length})}nearestInputPos(t,l){if(!this.thousandsSeparator)return t;switch(l){case O.NONE:case O.LEFT:case O.FORCE_LEFT:{const n=this._findSeparatorAround(t-1);if(n>=0){const o=n+this.thousandsSeparator.length;if(t<o||this.value.length<=o||l===O.FORCE_LEFT)return n}break}case O.RIGHT:case O.FORCE_RIGHT:{const n=this._findSeparatorAround(t);if(n>=0)return n+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let l=t;this.min!=null&&(l=Math.max(l,this.min)),this.max!=null&&(l=Math.min(l,this.max)),l!==t&&(this.unmaskedValue=this.format(l,this));let n=this.value;this.normalizeZeros&&(n=this._normalizeZeros(n)),this.padFractionalZeros&&this.scale>0&&(n=this._padFractionalZeros(n)),this._value=n}super.doCommit()}_normalizeZeros(t){const l=this._removeThousandsSeparators(t).split(this.radix);return l[0]=l[0].replace(/^(\D*)(0*)(\d*)/,(n,o,a,r)=>o+r),t.length&&!/\d$/.test(l[0])&&(l[0]=l[0]+"0"),l.length>1&&(l[1]=l[1].replace(/0*$/,""),l[1].length||(l.length=1)),this._insertThousandsSeparators(l.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const l=t.split(this.radix);return l.length<2&&l.push(""),l[1]=l[1].padEnd(this.scale,"0"),l.join(this.radix)}doSkipInvalid(t,l,n){l===void 0&&(l={});const o=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===ce.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,l,n)&&!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==="")}}hl=ce,ce.UNMASKED_RADIX=".",ce.EMPTY_VALUES=[...ne.EMPTY_VALUES,0],ce.DEFAULTS={...ne.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[hl.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:s=>s.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},G.MaskedNumber=ce;const Ye={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function xt(s,t,l){t===void 0&&(t=Ye.MASKED),l===void 0&&(l=Ye.MASKED);const n=me(s);return o=>n.runIsolated(a=>(a[t]=o,a[l]))}function ml(s,t,l,n){return xt(t,l,n)(s)}G.PIPE_TYPE=Ye,G.createPipe=xt,G.pipe=ml;class fl extends oe{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 l,n,o;const{repeat:a,...r}=Me(t);this._blockOpts=Object.assign({},this._blockOpts,r);const i=me(this._blockOpts);this.repeat=(l=(n=a??i.repeat)!=null?n:this.repeat)!=null?l: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(me(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,l){l===void 0&&(l={});const n=new q;for(let c=(o=(a=this._mapPosToBlock(this.displayValue.length))==null?void 0:a.index)!=null?o:Math.max(this._blocks.length-1,0),d,m;d=(r=this._blocks[c])!=null?r:m=!m&&this._allocateBlock(c);++c){var o,a,r,i;const f=d._appendChar(t,{...l,_beforeTailState:(i=l._beforeTailState)==null||(i=i._blocks)==null?void 0:i[c]});if(f.skip&&m){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(n.aggregate(f),f.consumed)break}return n}_trimEmptyTail(t,l){var n,o;t===void 0&&(t=0);const a=Math.max(((n=this._mapPosToBlock(t))==null?void 0:n.index)||0,this.repeatFrom,0);let r;l!=null&&(r=(o=this._mapPosToBlock(l))==null?void 0:o.index),r==null&&(r=this._blocks.length-1);let i=0;for(let c=r;a<=c&&!this._blocks[c].unmaskedValue;--c,++i);i&&(this._blocks.splice(r-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length);const n=super.remove(t,l);return this._trimEmptyTail(t,l),n}totalInputPositions(t,l){return t===void 0&&(t=0),l==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,l)}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}}G.RepeatBlock=fl;try{globalThis.IMask=G}catch{}const gl=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:q,ChunksTailDetails:Ee,DIRECTION:O,HTMLContenteditableMaskElement:yt,HTMLInputMaskElement:cl,HTMLMaskElement:Le,InputMask:dl,MaskElement:Ze,Masked:ne,MaskedDate:ge,MaskedDynamic:ze,MaskedEnum:je,MaskedFunction:pl,MaskedNumber:ce,MaskedPattern:oe,MaskedRange:Re,MaskedRegExp:ul,PIPE_TYPE:Ye,PatternFixedDefinition:bt,PatternInputDefinition:Oe,RepeatBlock:fl,createMask:me,createPipe:xt,default:G,forceDirection:sl,normalizeOpts:Me,pipe:ml},Symbol.toStringTag,{value:"Module"}));W.ModalEdit=ll,W.VForm=be,W.VsInputAddress=Jt,W.VsInputArray=Pc,W.VsInputCheckbox=$t,W.VsInputCodegen=qt,W.VsInputColor=Wt,W.VsInputContainer=zt,W.VsInputDate=Mt,W.VsInputEmail=ut,W.VsInputFile=Lt,W.VsInputFileList=Ot,W.VsInputKeyValue=Zt,W.VsInputMask=dt,W.VsInputNumber=St,W.VsInputRadio=ht,W.VsInputRange=Yt,W.VsInputSelect=mt,W.VsInputSlug=Kt,W.VsInputStatic=ct,W.VsInputSwitcher=it,W.VsInputTag=Gt,W.VsInputTel=pt,W.VsInputText=Se,W.VsInputTextArray=ft,W.VsInputTextarea=jt,W.default=be,W.inputs=Qt,W.vsInputDatatable=Pt,W.vsInputMap=Ht,Object.defineProperties(W,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
1
|
+
(function(W,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):(W=typeof globalThis<"u"?globalThis:W||self,e(W.FormBuilder={},W.Vue,W.OpenGISCore))})(this,(function(W,e,ee){"use strict";const kl={class:"w-full relative"},yl={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},bl={class:"opacity-100"},xl={key:0,class:"text-red-500 text-[14px]"},wl={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},_l=e.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(s){const t=e.ref("uk"),l=n=>{n.detail.key==="locale"&&(t.value=n.detail.newValue)};return e.onMounted(()=>{t.value=localStorage.locale,window.addEventListener("storage",l)}),e.onUnmounted(()=>{window.removeEventListener("resize",l)}),(n,o)=>(e.openBlock(),e.createElementBlock("div",kl,[n.ua||n.label?(e.openBlock(),e.createElementBlock("div",yl,[e.createElementVNode("span",bl,e.toDisplayString(n.item[t.value]||n.ua||n.label),1),n.item?.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",xl,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(n.$slots,"default",e.mergeProps(n.$attrs,{class:{"opacity-60":n.item.disabled}})),n.error?(e.openBlock(),e.createElementBlock("span",wl,e.toDisplayString(n.error),1)):e.createCommentVNode("",!0)]))}}),El={class:"w-full relative flex flex-row items-center gap-2"},vl={key:0,class:"text-red-500 text-[14px]"},Vl={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Bl=e.defineComponent({__name:"vs-layout-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(s){const t=s,l=e.computed(()=>t.columns??{container:12,label:3}),n=e.computed(()=>{const{container:i,label:c}=l.value;return!i||i<=0?0:Math.min(Math.max(c??0,0),i)/i}),o=e.computed(()=>t.item?.type==="html"||n.value<=0?!1:!!(t.ua||t.label)),a=e.computed(()=>{if(!o.value)return{};const i=`${n.value*100}%`;return{flexBasis:i,maxWidth:i}}),r=e.computed(()=>{const{container:i,label:c}=l.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 d=Math.max(i-Math.max(c??0,0),0)/i;if(!d)return{};const m=`${d*100}%`;return{flexBasis:m,maxWidth:m}});return(i,c)=>(e.openBlock(),e.createElementBlock("div",El,[o.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0",style:e.normalizeStyle(a.value)},[e.createTextVNode(e.toDisplayString(i.ua||i.label)+" ",1),i.item?.rules?.includes("required")&&(i.ua||i.label)?(e.openBlock(),e.createElementBlock("span",vl,"*")):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"flex-1 min-w-0",style:e.normalizeStyle(r.value)},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],4),i.error?(e.openBlock(),e.createElementBlock("span",Vl,e.toDisplayString(i.error),1)):e.createCommentVNode("",!0)]))}}),Cl={class:"w-full relative"},Nl={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Sl=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(s){return(t,l)=>(e.openBlock(),e.createElementBlock("div",Cl,[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)]))}}),$l={class:"flex-1 min-w-0"},Ml={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},Al={class:"truncate"},Fl={key:0,class:"text-red-500 text-[14px]"},Dl={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},Il={key:0,class:"mt-1 text-xs text-red-500"},Tl={default:_l,horizontal:Bl,inline:Sl,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(s){const t=s,l=e.ref("uk");e.computed(()=>(t.item??{})?.[l.value]??t.ua??t.label??"");const n=e.computed(()=>t.item?.description??""),o=e.computed(()=>Array.isArray(t.item?.rules)&&t.item.rules.includes("required")),a=e.computed(()=>(typeof t.error=="string"?t.error:"")??""),r=i=>{i.key==="locale"&&(l.value=i.newValue??"uk")};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(l.value=localStorage.locale)}catch{}window.addEventListener("storage",r)}),e.onUnmounted(()=>{window.removeEventListener("storage",r)}),(i,c)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":i.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(i.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",$l,[i.ua||i.label?(e.openBlock(),e.createElementBlock("p",Ml,[e.createElementVNode("span",Al,e.toDisplayString(i.item[l.value]||i.ua||i.label),1),o.value?(e.openBlock(),e.createElementBlock("span",Fl,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),n.value?(e.openBlock(),e.createElementBlock("p",Dl,e.toDisplayString(n.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),a.value?(e.openBlock(),e.createElementBlock("p",Il,e.toDisplayString(a.value),1)):e.createCommentVNode("",!0)],2))}})};function ie(s){return{inputClass:e.computed(()=>{const l=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${s?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return s?.size==="sm"?`${l}h-[32px]`:`${l}h-[38px]`})}}const Ll=["placeholder","disabled"],Ol=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(s){const t=s,{inputClass:l}=ie(t.style),n=e.useModel(s,"modelValue"),o=e.computed(()=>!!t.disabled),a=e.computed(()=>t.placeholder??"");return(r,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":i[0]||(i[0]=c=>n.value=c),placeholder:a.value,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(l),{"!border-red-600":r.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Ll)),[[e.vModelText,n.value]])}}),Rl=["placeholder","disabled"],Se=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(s){const t=s,{inputClass:l}=ie(t.style),n=e.useModel(s,"modelValue"),o=e.computed(()=>!!t.disabled),a=e.computed(()=>t.placeholder??"");function r(){typeof n.value=="string"&&(n.value=n.value.trim())}return(i,c)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":c[0]||(c[0]=d=>n.value=d),placeholder:a.value,disabled:o.value,onBlur:r,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.customClass,e.unref(l),{"!border-red-600":i.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Rl)),[[e.vModelText,n.value]])}}),zl=["placeholder","disabled","min","max"],St=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(s){const t=s,{inputClass:l}=ie(t.style),n=e.useModel(s,"modelValue"),o=e.computed(()=>!!t.disabled);return(a,r)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":r[0]||(r[0]=i=>n.value=i),placeholder:a.placeholder,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(l)]]),style:{border:"1px solid #CFD9E0"},min:a.min,max:a.max},null,10,zl)),[[e.vModelText,n.value]])}}),Z=(s,t)=>{const l=s.__vccOpts||s;for(const[n,o]of t)l[n]=o;return l},jl={},Ul={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 Pl(s,t){return e.openBlock(),e.createElementBlock("svg",Ul,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const Hl=Z(jl,[["render",Pl]]),Gl={class:"flex items-center gap-[4px]"},Kl=["value","id","disabled"],ql=["for"],Zl={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},Wl=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(s,{emit:t}){const l=t,n=s,o=e.computed({get:()=>n.modelValue,set:r=>l("update:modelValue",r)}),a=e.computed(()=>!!n.disabled);return(r,i)=>(e.openBlock(),e.createElementBlock("div",Gl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:r.value,"onUpdate:modelValue":i[0]||(i[0]=c=>o.value=c),class:e.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":a.value}]),id:r.id,disabled:a.value},null,10,Kl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:r.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":a.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",r.error?"border-red-600":""]])},[e.createVNode(Hl,{height:"12",width:"12"})],2),e.createElementVNode("span",Zl,[e.renderSlot(r.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(r.label),1)])])],10,ql)]))}}),Yl=["name","value","disabled"],Jl={class:"flex items-center gap-[6px] text-[14px]"},Xl={key:0,class:"text-[16px]"},Ql=["src"],en=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(s,{emit:t}){const l=s,n=t,o=e.computed({get:()=>l.modelValue,set:i=>{n("update:modelValue",i)}}),a=e.computed(()=>Array.isArray(o.value)?o.value.includes(l.value):o.value===!0||o.value===l.value),r=e.computed(()=>l.style?.size==="xs"?"p-1.5 text-xs":l.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(i,c)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[r.value,a.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"hidden",name:i.id,value:i.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),disabled:i.disabled},null,8,Yl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("span",Jl,[i.icon||i.imgUrl?(e.openBlock(),e.createElementBlock("span",Xl,[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,Ql)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(i.label),1)])])],2))}}),tn={class:"flex items-center"},st=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(s,{emit:t}){const l=s,n=t,o=`radio-${Math.floor(Math.random()*1e4)}`,a=e.computed({get:()=>Array.isArray(l.modelValue)?Array.isArray(l.modelValue)&&l.modelValue.includes(l.value):l.modelValue,set:i=>{if(Array.isArray(l.modelValue)){let c=[...l.modelValue];i?c.includes(l.value)||c.push(l.value):c=c.filter(d=>d!==l.value),n("update:modelValue",c)}else n("update:modelValue",i)}}),r=e.ref(`vs-checkbox-${l.view||"default"}`);return(i,c)=>(e.openBlock(),e.createElementBlock("div",tn,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value==="vs-checkbox-buttons"?e.unref(en):e.unref(Wl)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:a.value,"onUpdate:modelValue":c[0]||(c[0]=d=>a.value=d),id:o,icon:i.icon,imgUrl:i.imgUrl,style:e.normalizeStyle(i.style),error:i.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),ln={},nn={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 on(s,t){return e.openBlock(),e.createElementBlock("svg",nn,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 an=Z(ln,[["render",on]]),sn={},rn={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 cn(s,t){return e.openBlock(),e.createElementBlock("svg",rn,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 rt=Z(sn,[["render",cn]]),dn={},un={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 pn(s,t){return e.openBlock(),e.createElementBlock("svg",un,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 hn=Z(dn,[["render",pn]]),mn={key:0,class:"flex items-start gap-x-1"},fn={key:0,class:"text-red-500 text-[14px]"},gn=["title"],kn=["disabled"],it=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(s){const t=s,l=e.useModel(s,"modelValue");return(n,o)=>t.view==="checkbox"?(e.openBlock(),e.createElementBlock("div",mn,[e.createVNode(st,{modelValue:l.value,"onUpdate:modelValue":o[0]||(o[0]=a=>l.value=a),label:n.text,error:n.error||""},null,8,["modelValue","label","error"]),n.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",fn,"*")):e.createCommentVNode("",!0),n.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:n.i,onClick:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(hn),{class:"text-gray-500 w-[14px] h-[14px]"})],8,gn)):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",[l.value?`bg-${n.style?.primaryColor||"blue"}-500`:"bg-stone-200",n.customClass]]),disabled:n.disabled,onClick:o[2]||(o[2]=a=>l.value=!l.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",[l.value?"translate-x-4":"translate-x-0"]])},null,2)],10,kn))}}),yn=["id","innerHTML"],ct=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(s){return(t,l)=>(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,yn))}}),bn=["placeholder","disabled","name"],dt=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(s){const t=s,{inputClass:l}=ie(t.style),n=e.useModel(s,"modelValue"),o=e.ref(null);let a=null;return e.onMounted(async()=>{if(o.value){const{default:r}=await Promise.resolve().then(()=>gl);a=r(o.value,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),a.on("accept",()=>{n.value=t.unmask?a.unmaskedValue:a.value}),a.on("complete",()=>{n.value=t.unmask?a.unmaskedValue:a.value}),a.value=n.value??""}}),e.onBeforeUnmount(()=>{a?.destroy()}),e.watch(()=>t.mask,r=>{a&&a.updateOptions({mask:r,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),e.watch(n,r=>{a&&a.unmaskedValue!==r&&(a.value=r||"")}),(r,i)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:r.placeholder,disabled:r.disabled,name:r.name,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(l)]]),style:{border:"1px solid #CFD9E0"}},null,10,bn))}}),xn={class:"relative w-full bg-white rounded-lg"},wn=["placeholder","disabled"],ut=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(s){const t=s,{inputClass:l}=ie(t.style),n=e.useModel(s,"modelValue");return(o,a)=>(e.openBlock(),e.createElementBlock("div",xn,[a[1]||(a[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":a[0]||(a[0]=r=>n.value=r),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(l),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,wn),[[e.vModelText,n.value]])]))}}),_n={class:"relative w-full bg-white rounded-lg"},En=["value","placeholder","disabled"],pt=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(s){const t=s,{inputClass:l}=ie(t.style),n=e.useModel(s,"modelValue"),o=e.computed(()=>n.value?n.value.startsWith("+")?n.value.slice(1):n.value:""),a=i=>{let{value:c}=i.target;c=c.replace(/^\+/,""),n.value=c?`+${c}`:""},r=i=>{const c=i,{data:d,inputType:m}=c;m&&m.startsWith("delete")||d&&/\D/.test(d)&&c.preventDefault()};return e.watch(()=>n.value,i=>{i&&!i.startsWith("+")?n.value=`+${i.replace(/^\+/,"")}`:i||(n.value="")},{immediate:!0}),(i,c)=>(e.openBlock(),e.createElementBlock("div",_n,[c[0]||(c[0]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"stroke-gray-500 transition-all"},[e.createElementVNode("path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"})])],-1)),c[1]||(c[1]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[30px] text-gray-500 select-none pointer-events-none"}," + ",-1)),e.createElementVNode("input",{type:"tel",value:o.value,onInput:a,onBeforeinput:r,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(l),{"!border-red-600":i.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,En)]))}}),vn=["value","disabled"],Vn={class:"text-[13px] text-gray-700"},Bn=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(s){const t=s,l=e.useModel(s,"modelValue"),n=e.computed(()=>!!t.disabled);return(o,a)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center gap-0",[t.customClass,n.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=r=>l.value=r),type:"radio",value:t.value,disabled:n.value,class:"hidden"},null,8,vn),[[e.vModelRadio,l.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`,n.value?"opacity-50 cursor-not-allowed":""]])},[l.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",Vn,e.toDisplayString(t.text),1)],2))}}),Cn=["value","disabled"],Nn={class:"text-[13px] text-gray-700"},Sn={"vs-input-radio-default":Bn,"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(s){const t=s,l=e.useModel(s,"modelValue"),n=e.computed(()=>!!t.disabled);return(o,a)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[l.value==t.value?`ring-2 ring-ring ring-${t.style?.primaryColor||"blue"}-500`:"",t.customClass,n.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=r=>l.value=r),type:"radio",value:t.value,disabled:n.value,class:"hidden"},null,8,Cn),[[e.vModelRadio,l.value]]),e.createElementVNode("span",Nn,e.toDisplayString(t.text),1)],2))}})},ht=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(s){const t=s,l=e.useModel(s,"modelValue"),n=e.computed(()=>Sn[`vs-input-radio-${t.view}`]);return(o,a)=>(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,r=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.value),e.mergeProps({key:r?.id,text:r.text,value:r.id.toString(),checked:l.value===r.id,modelValue:l.value,"onUpdate:modelValue":a[0]||(a[0]=i=>l.value=i)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),$n={key:1,class:"w-full flex flex-col gap-4"},Mn={key:0,class:"text-sm font-medium text-muted-foreground my-2"},An="Без категорії",$t=Z(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(s,{emit:t}){const l=s,n=t,o=e.ref([]),a=e.reactive({}),r=w=>w?.value||w?.id||w?.text||w,i=w=>w.text||String(w),c=w=>`lg:col-span-${w||12}`,d=e.computed(()=>[l.position==="vertical"?"flex flex-col":"",l.colSpan?"grid":"flex justify-start"]),m=w=>w==null||w===""?null:typeof w=="string"||typeof w=="number"?w:String(w),f=e.computed(()=>{if(!l.group)return[];const w=new Map;o.value.forEach(h=>{const E=h[l.group],g=m(E);w.has(g)||w.set(g,[]),w.get(g)?.push(h)});const V=[];l.values?.length&&l.values.forEach(h=>{const E=m(h);V.push(E)});const k=new Set,b=h=>{const E=w.get(h)||[];if(!E.length)return null;const g=h===null?"group-null":`group-${String(h)}`,B=h===null?An:String(h);return k.add(h),{key:g,label:B,options:E}},y=[];return V.forEach(h=>{const E=b(h);E&&y.push(E)}),w.forEach((h,E)=>{if(k.has(E))return;const g=b(E);g&&y.push(g)}),y}),v=async()=>{try{const w=await fetch(`/api/suggest/${l.data}`).then(V=>V.json());o.value=w?.data||w}catch(w){console.error(w)}};return e.watch(()=>l.modelValue,w=>{if(typeof w=="boolean"&&o.value.length===1){const V=r(o.value[0]);a[V]=w}else if(Array.isArray(w)){const V=new Set(w);o.value.forEach(k=>{if(!k.disabled){const b=r(k);a[b]=V.has(b)}})}},{immediate:!0}),e.watch(a,()=>{if(!o.value.length){n("update:modelValue",null);return}const w=Object.entries(a).filter(([,V])=>V).map(([V])=>V);n("update:modelValue",w.length===0?[]:w)},{deep:!0}),e.onMounted(()=>{if(l.data)v().then(()=>{if(typeof l.modelValue=="boolean"&&o.value.length===1){const w=r(o.value[0]);a[w]=l.modelValue}else if(Array.isArray(l.modelValue)){const w=new Set(l.modelValue);o.value.forEach(V=>{if(!V.disabled){const k=r(V);a[k]=w.has(k)}})}});else if(o.value=l.options,typeof l.modelValue=="boolean"&&o.value.length===1){const w=r(o.value[0]);a[w]=l.modelValue}else if(Array.isArray(l.modelValue)){const w=new Set(l.modelValue);o.value.forEach(V=>{if(!V.disabled){const k=r(V);a[k]=w.has(k)}})}}),(w,V)=>l.group?(e.openBlock(),e.createElementBlock("div",$n,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,k=>(e.openBlock(),e.createElementBlock("div",{key:k.key,class:"flex flex-col gap-2"},[k.label?(e.openBlock(),e.createElementBlock("span",Mn,e.toDisplayString(k.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.options,b=>(e.openBlock(),e.createBlock(st,{modelValue:a[r(b)],"onUpdate:modelValue":y=>a[r(b)]=y,value:r(b),class:e.normalizeClass(c(w.colSpan)),disabled:l.disabled||b.disabled,label:i(b),key:`${k.key}-${r(b)}`,icon:b?.icon,imgUrl:b?.imgUrl,option:b,view:w.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["p-0 w-full gap-[10px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,k=>(e.openBlock(),e.createBlock(st,{modelValue:a[r(k)],"onUpdate:modelValue":b=>a[r(k)]=b,value:r(k),class:e.normalizeClass(c(w.colSpan)),disabled:l.disabled||k.disabled,label:i(k),key:r(k),icon:k?.icon,imgUrl:k?.imgUrl,option:k,view:w.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-8e66207e"]]),Fn=["type","placeholder","disabled"],Mt=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(s,{emit:t}){const l=s;function n(m){return m?l.mode==="datetime"?(m.includes("T")?m:null)||m+(m.includes(" ")?"":"T00:00"):m?.split(" ")[0]:null}const{inputClass:o}=ie(l.style),a=t,r=e.computed({get:()=>n(l.modelValue),set:m=>a("update:modelValue",m)}),i=e.computed(()=>l.mode==="datetime"?"datetime-local":l.mode),c=e.computed(()=>!!l.disabled),d=e.computed(()=>l.placeholder??"");return(m,f)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":f[0]||(f[0]=v=>r.value=v),placeholder:d.value,disabled:c.value,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[m.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Fn)),[[e.vModelDynamic,r.value]])}}),Dn=(s,t)=>{if(!t||!Object.keys(t).length)return s;const[l,n=""]=s.split("?"),o=new URLSearchParams(n);Object.entries(t).forEach(([r,i])=>{i==null||i===""||o.set(r,String(i))});const a=o.toString();return a?`${l}?${a}`:l},At=async(s,t={})=>{try{const l=new FormData;l.append("unique","true"),l.append("file",s);const{api:n,id:o="1",form:a="form",table:r="table",customParams:i}=t,c=n||`/file/upload/uploads?id=${o||""}&form=${a||""}&table=${r||""}`,d=Dn(c,i);return(await fetch(d,{method:"POST",body:l}).then(f=>f.json()))?.result}catch(l){return ee.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",l),null}},In=async s=>{try{return await fetch(`file/delete${s}`),!0}catch(t){return console.error(t),!1}},Ft=async s=>{try{const t=await fetch(`file/download/files/uploads${s}`),l=await t.arrayBuffer(),n=t.headers["content-type"],o=new TextDecoder("utf-8").decode(l),a=new Blob([o],{type:n}),r=document.createElement("a");r.setAttribute("download",s),r.href=window.URL.createObjectURL(a),r.click()}catch(t){console.error(t.message)}},Tn={},Ln={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 On(s,t){return e.openBlock(),e.createElementBlock("svg",Ln,t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const ye=Z(Tn,[["render",On]]),Rn={},zn={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 jn(s,t,l,n,o,a){return e.openBlock(),e.createElementBlock("svg",zn,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 Un=Z(Rn,[["render",jn]]),Pn={},Hn={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 Gn(s,t,l,n,o,a){return e.openBlock(),e.createElementBlock("svg",Hn,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 Kn=Z(Pn,[["render",Gn]]),qn={},Zn={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 Wn(s,t){return e.openBlock(),e.createElementBlock("svg",Zn,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 Dt=Z(qn,[["render",Wn]]),Yn={},Jn={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 Xn(s,t,l,n,o,a){return e.openBlock(),e.createElementBlock("svg",Jn,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 Qn=Z(Yn,[["render",Xn]]),eo={},to={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 lo(s,t,l,n,o,a){return e.openBlock(),e.createElementBlock("svg",to,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 no=Z(eo,[["render",lo]]),oo=s=>{if(!s)return"";const t=s?.split(".");return t[t.length-1]},ao=s=>{const t=oo(s),l={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 l.imageFormat.includes(t)?"img":l.sheetsFormat.includes(t)?Kn:l.textsFormat.includes(t)?no:l.documentsFormat.includes(t)?Un:l.archivesFormat.includes(t)?Qn:Dt},so={},ro={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 io(s,t){return e.openBlock(),e.createElementBlock("svg",ro,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 $e=Z(so,[["render",io]]),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(s,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 It=Z(co,[["render",po]]),ho=["title"],mo={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},Tt=Z(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(s){const t=e.useModel(s,"value"),l=e.useModel(s,"item"),n=s;return(o,a)=>(e.openBlock(),e.createElementBlock("div",{title:l.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(ao)(l.value)),{src:l.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:a[0]||(a[0]=r=>e.unref(Ft)(l.value))},null,8,["src"])),e.createElementVNode("div",mo,[e.createElementVNode("button",{type:"button",onClick:a[1]||(a[1]=r=>{e.unref(In)(l.value),t.value=n.multiple?t.value?.filter(i=>i!==l.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($e,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:a[2]||(a[2]=r=>e.unref(Ft)(l.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(It,{class:"w-4 h-4"})])])],8,ho))}}),[["__scopeId","data-v-286cdbc0"]]),fo={class:"flex items-center gap-x-2"},go=["accept","multiple","disabled"],ko={key:1,class:"flex items-center flex-wrap gap-2"},yo={key:1,class:"loader"},bo={key:1,class:"loader"},Lt=Z(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(s,{emit:t}){const l=s,n=e.useModel(s,"modelValue"),o=t,a=e.ref(null),r=e.ref(!1),i=e.inject("values"),c=e.computed(()=>l.format?l.format.split(",").map(h=>h.trim().toLowerCase()).filter(Boolean):[]),d=h=>Array.isArray(n.value)&&n.value[h]||"",m=h=>{if(l.max_size&&h.size>l.max_size*1024*1024){const E=(h.size/1048576).toFixed(2);return ee.notify({type:"error",title:"Помилка!",message:`Файл "${h.name}" занадто великий. Максимальний розмір: ${l.max_size} МБ, розмір файлу: ${E} МБ`,position:"right-bottom"}),!1}return!0},f=h=>{if(!c.value.length)return!0;const E=`.${h.name.split(".").pop()?.toLowerCase()||""}`,g=c.value.includes(E);return g||ee.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${h.name}". Дозволені формати: ${c.value.join(", ")}`,position:"right-bottom"}),g},v=e.computed(()=>{const h={},E=[];if(!l.customParams?.length)return{params:h,missingSources:E};const g=i?.value??{};return l.customParams.forEach(B=>{if(!B)return;const[M,S]=B.split("="),T=M?.trim(),R=S?.trim();if(!T||!R)return;const P=g[R];if(P==null||P===""){E.push(R);return}h[T]=P}),{params:h,missingSources:E}}),w=()=>{const h=v.value.params;return{api:l.api,customParams:Object.keys(h).length?h:void 0}},V=()=>{const h=v.value.missingSources;if(!h.length)return!0;const E=h.join(", ");return ee.notify({type:"warning",title:"Заповніть поля",message:`Поля (${E}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},k=h=>{ee.notify({type:"error",title:"Помилка завантаження",message:h||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},b=()=>{l.disabled||r.value||V()&&a.value?.click()},y=async h=>{const{files:E}=h.target;if(!E||E.length===0)return;if(!V()){a.value&&(a.value.value="");return}const g=Array.from(E);if(l.max_size&&g.filter(S=>!m(S)).length>0){a.value&&(a.value.value="");return}if(g.filter(M=>!f(M)).length>0){a.value&&(a.value.value="");return}r.value=!0;try{if(l.multiple){const M=Array.from(E).map(async P=>await At(P,w())),S=await Promise.all(M),R=S.filter(P=>P!==null).map(P=>P?.file_path).filter(Boolean);if(R.length===0){k();return}R.length<S.length&&k("Деякі файли не вдалося завантажити. Перевірте їх та спробуйте знову."),n.value=[...n.value||[],...R],o("change",n.value)}else{const M=E[0],S=await At(M,w());if(!S?.file_path){k();return}n.value=S?.file_path,o("change",n.value||"")}}catch(M){const S=M?.message||void 0;k(S)}finally{r.value=!1,a.value&&(a.value.value="")}};return(h,E)=>(e.openBlock(),e.createElementBlock("div",fo,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:a,type:"file",accept:l.format,multiple:h.multiple,onChange:y,disabled:r.value||h.disabled},null,40,go),!h.multiple&&n.value?(e.openBlock(),e.createBlock(Tt,{key:0,item:n.value,"onUpdate:item":E[0]||(E[0]=g=>n.value=g),value:n.value,"onUpdate:value":E[1]||(E[1]=g=>n.value=g)},null,8,["item","value"])):h.multiple?(e.openBlock(),e.createElementBlock("div",ko,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(g,B)=>(e.openBlock(),e.createBlock(Tt,{multiple:h.multiple,key:B,value:n.value,"onUpdate:value":E[2]||(E[2]=M=>n.value=M),item:d(B)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:b,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||r.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[r.value?(e.openBlock(),e.createElementBlock("div",yo)):(e.openBlock(),e.createBlock(ye,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),h.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:b,class:e.normalizeClass([h.disabled||r.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"])},[r.value?(e.openBlock(),e.createElementBlock("div",bo)):(e.openBlock(),e.createBlock(ye,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-94bcb5d9"]]),xo={class:"max-w-[55vw]"},wo={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},_o={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},Eo={class:"px-[5px]"},vo={class:""},He=e.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(s){const t=s,l=e.computed(()=>{try{return new Date(t.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function n(o){if(o<1024)return`${o} B`;const a=o/1024;return a<1024?`${a.toFixed(2)} KB`:`${(a/1024).toFixed(2)} MB`}return(o,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[a[1]||(a[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",xo,[e.createElementVNode("p",wo,e.toDisplayString(o.item?.uploaded_name),1),e.createElementVNode("p",_o,[e.createElementVNode("span",null,e.toDisplayString(o.item?.username),1),e.withDirectives(e.createElementVNode("span",Eo,"|",512),[[e.vShow,o.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(l.value),1),a[0]||(a[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",vo,e.toDisplayString(n(o.item?.size)),1)])])],64))}}),Vo={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},Bo={key:0,class:"flex w-full gap-x-3 items-center"},Co={key:1,class:"flex gap-x-3 w-full items-center"},No={key:2,class:"flex gap-x-3 w-full items-center"},So=["href"],$o={key:3,class:"flex gap-x-3 w-full items-center"},Mo={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},Ao={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"},Fo={class:"inline-block"},Do={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(s,{emit:t}){const l=s,n=t;function o(m){return["pdf","json"].includes(m.ext)}function a(m){return["ppt","pptx","doc","docx","xls","xlsx"].includes(m.ext)}function r(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(`${l.prefix}/widget/file/${l.item.entity_id}/${l.item.file_id}`),n("update")}catch(m){console.error(m)}}function c(){n("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function d(m){(l.item.ext==="jpg"||l.item.ext==="png")&&n("openLightbox",{item:l.item,index:m})}return(m,f)=>(e.openBlock(),e.createElementBlock("div",Vo,[m.item.ext==="jpg"||m.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",Bo,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:f[0]||(f[0]=v=>d(m.index))},[e.createVNode(He,{item:m.item},null,8,["item"])])])):o(m.item)?(e.openBlock(),e.createElementBlock("div",Co,[e.createVNode(He,{item:m.item},null,8,["item"])])):a(m.item)?(e.openBlock(),e.createElementBlock("div",No,[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(He,{item:m.item},null,8,["item"])],8,So)])):(e.openBlock(),e.createElementBlock("div",$o,[e.createVNode(He,{item:m.item},null,8,["item"])])),e.createElementVNode("div",Mo,[e.createElementVNode("div",Ao,[e.createElementVNode("div",Fo,[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]=v=>r(m.item))},[e.createVNode(It,{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",Do,[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]=v=>c())},[e.createVNode($e,{height:"14",width:"14"})])])])])]))}}),To={},Lo={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 Oo(s,t){return e.openBlock(),e.createElementBlock("svg",Lo,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 Ro=Z(To,[["render",Oo]]),zo={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},jo={class:"flex w-full mb-[12px] items-center gap-x-2"},Uo={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},Po={class1:"ml-auto"},Ho={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"},Go={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},Ko={class:"relative"},qo={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"},Zo={key:0},Ot=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(s,{emit:t}){const l=s,n=e.inject("form"),o=e.computed(()=>n.value.formId),a=e.ref(!1),r=e.ref(0),i=t,c=e.ref(!1),d=e.ref({}),m=e.ref([]),f=e.ref(""),v=e.computed(()=>Array.isArray(m.value)?m.value.filter(E=>E.ext==="jpg"||E.ext==="png").map(E=>E?.file_path):[]),w=e.computed(()=>f.value===""?m.value:m.value.filter(E=>E?.uploaded_name?.includes(f.value))),V=E=>{const g=v.value.findIndex(B=>B===E.item.file_path);g!==-1&&(a.value=!0,r.value=g)},k=async()=>{try{const E=await fetch(`${l.prefix}/widget/file/${o.value}`).then(g=>g.json());m.value=E?.rows}catch(E){console.error(E)}},b=async E=>{await Promise.all(Array.from(E.target.files).map(async g=>{const B=new FormData;B.append("file",g);try{const M=`${l.prefix}/widget/file/${o.value}`,S=await fetch(M,{method:"POST",body:B});return S.ok?(i("update","file-list"),g):(ee.notify({type:S.status>=400&&S.status<500?"warning":"error",title:"Error",message:`Error code: ${S.status}`}),null)}catch(M){return ee.notify({type:"error",title:"Error",message:M.message||"Unknown error"}),console.error(M),null}})),await k()},y=E=>{const g={...E};return E.cancel||(g.cancel=()=>{c.value=!1}),E.updateListOnConfirm&&(g.confirm=async()=>{await E.confirm(),c.value=!1,k()}),g},h=E=>{d.value=y(E),c.value=!0};return e.watch(o,E=>{E&&k()}),e.onMounted(()=>{o.value&&k()}),(E,g)=>{const B=e.resolveComponent("Lightbox"),M=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",zo,[e.createElementVNode("div",jo,[e.createElementVNode("h2",Uo," Файлів: "+e.toDisplayString(m.value?.length),1),e.createElementVNode("div",Po,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:g[0]||(g[0]=S=>b(S))},null,32),e.createElementVNode("div",Ho,[e.createVNode(Ro,{height:"16",width:"16"})])])])]),m.value?.length>4?(e.openBlock(),e.createElementBlock("div",Go,[e.createElementVNode("div",null,[e.createElementVNode("div",Ko,[g[8]||(g[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":g[1]||(g[1]=S=>f.value=S),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[e.vModelText,f.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),m.value?.length?(e.openBlock(),e.createElementBlock("div",qo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,(S,T)=>(e.openBlock(),e.createBlock(Io,{key:T,prefix:E.prefix,item:S,index:T,onUpdate:g[2]||(g[2]=R=>E.$emit("update","file-list")),onOpenModal:g[3]||(g[3]=R=>h(R)),onOpenLightbox:g[4]||(g[4]=R=>V(R))},null,8,["prefix","item","index"]))),128)),w.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Zo,g[9]||(g[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):e.createCommentVNode("",!0),e.createVNode(B,{modelValue:a.value,"onUpdate:modelValue":g[5]||(g[5]=S=>a.value=S),startIndex:r.value,"onUpdate:index":g[6]||(g[6]=S=>r.value=S),images:v.value},null,8,["modelValue","startIndex","images"]),e.createVNode(M,e.mergeProps({modelValue:c.value,"onUpdate:modelValue":g[7]||(g[7]=S=>c.value=S),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),Wo={class:"flex items-center justify-between"},Yo={class:"text-[16px] text-gray-900 font-medium"},Jo={class:"grid gap-3"},Xo=Z(e.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(s){const t=s,l=e.ref(t.isOpen);return e.watch(()=>t.isOpen,n=>{l.value=n}),(n,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Wo,[e.createElementVNode("p",Yo,e.toDisplayString(s.title),1),e.createVNode(it,{modelValue:l.value,"onUpdate:modelValue":o[0]||(o[0]=a=>l.value=a),style:e.normalizeStyle(s.style)},null,8,["modelValue","style"])]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Jo,[e.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[e.vShow,l.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),Qo={class:"text-[16px] text-gray-900 font-medium"},ea={class:"grid gap-3"},ta=Z(e.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(s){const t=s,l=e.ref(t.isOpen);return e.watch(()=>t.isOpen,n=>{l.value=n}),(n,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("button",{type:"button",onClick:o[0]||(o[0]=a=>l.value=!l.value),class:"flex items-center gap-2"},[e.createVNode(e.unref(an),{class:e.normalizeClass(["h-4 w-4 duration-300",[l.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",Qo,e.toDisplayString(s.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",ea,[e.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[e.vShow,l.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),la={class:"flex items-center justify-between"},na={switcher:Xo,accordion:ta,default:e.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(s){return(t,l)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",la,[e.createElementVNode("p",null,e.toDisplayString(s.title),1)]),e.renderSlot(t.$slots,"default")]))}})},de={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},oa=(s,t)=>String(s)===String(t),aa=(s,t)=>String(s)!==String(t),sa=(s,t)=>s>t,ra=(s,t)=>s>=t,ia=(s,t)=>s<t,ca=(s,t)=>s<=t,da=(s,t)=>Array.isArray(t)&&t.length===2?s>=t[0]&&s<=t[1]:!1,ua=(s,t)=>String(s).startsWith(String(t)),pa=(s,t)=>String(s).endsWith(String(t)),ha=(s,t)=>String(s).includes(String(t)),ma=(s,t)=>Array.isArray(t)?t.includes(s):!1,fa=(s,t)=>Array.isArray(t)?!t.includes(s):!0,Rt=(s,t)=>{if(!t)return!0;switch(t?.[1]){case de.Equal:return oa(s,t?.[2]);case de.Inequal:return aa(s,t?.[2]);case de.Higer:return sa(s,t?.[2]);case de.HigerOrEqual:return ra(s,t?.[2]);case de.Lower:return ia(s,t?.[2]);case de.LowerOrEqual:return ca(s,t?.[2]);case de.Between:return da(s,t?.[2]);case de.StartWith:return ua(s,t?.[2]);case de.EndWith:return pa(s,t?.[2]);case de.Contain:return ha(s,t?.[2]);case de.In:return ma(s,t?.[2]);case de.NotIn:return fa(s,t?.[2]);default:return!0}},zt=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(s){const t=s,l=e.inject("values",e.ref({})),n=e.inject("form"),o=e.computed(()=>t.schema?.filter(i=>{const c=i?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,m=t.name?l.value?.[t.name]?.[d]??l.value?.[d]:l.value?.[d];return Rt(m,c)})),a=e.computed(()=>na[t.view]),r=e.computed(()=>{if(l.value||(l.value={}),!t.name)return l.value;const i=l.value[t.name];if(i)return i;const c={};return l.value={...l.value,[t.name]:c},c});return(i,c)=>s.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),{key:0,title:s.title,style:e.normalizeStyle(s.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,d=>(e.openBlock(),e.createBlock(el,e.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:r.value[d.name],"onUpdate:modelValue":m=>r.value[d.name]=m,style:s.style,error:e.unref(n)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),ga=["aria-expanded","data-focus"],ka={key:0,class:"flex flex-wrap items-center gap-1 overflow-y-auto min-w-0 flex-1"},ya={class:"flex items-center min-w-0"},ba=["title"],xa=["innerHTML"],wa=["onClick"],_a={class:"flex-1 min-w-[2px]"},Ea=["placeholder"],va=["title"],Va=["innerHTML"],Ba={key:2,class:"flex-1 min-w-[2px]"},Ca=["placeholder"],Na={class:"flex items-center shrink-0"},Sa=["disabled"],$a=["disabled","title"],Ma=["aria-disabled","onClick"],Aa=["innerHTML"],Fa={key:1,class:"px-3 py-2 text-center text-gray-500"},Da=["disabled"],mt=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(s,{emit:t}){const l=s,n=t,o=e.computed(()=>l.multiple),a=e.computed(()=>l.disabled);ie(l.style);const r=e.computed({get:()=>l.modelValue,set:_=>n("update:modelValue",_)});!r.value&&l.defaultValue&&(r.value=l.defaultValue);const i=e.ref(null),c=e.ref(null),d=e.ref(null),m=e.ref(null),f=e.ref(!1),v=e.ref(!1),w=e.ref(null),V=e.ref([]),k=e.ref(-1),b=e.ref([]),y=e.ref(""),h=e.ref(null),E=e.ref("bottom"),g=e.ref({}),B=e.ref([]),M=e.computed(()=>{if(!B.value.length)return[];const _=V.value,C=new Map(_.map(N=>[N.id?.toString(),N]));return B.value.map(N=>C.get(N?.toString())).filter(N=>!!N)}),S=e.computed(()=>l.placeholder||"Select..."),T=e.computed(()=>I(w.value));e.computed(()=>o.value?!B.value.length&&y.value==="":!T.value&&y.value==="");const R=e.computed(()=>a.value?!1:o.value?B.value.length>0:!!r.value),P=_=>o.value?B.value.some(C=>C?.toString()===_?.toString()):r.value?.toString()===_?.toString(),F=e.computed(()=>{let _=V.value??[];if(!l.data&&y.value.trim()!==""){const C=y.value.toLowerCase();_=_.filter(N=>{const H=I(N).toLowerCase(),p=N.text?.toLowerCase?.()||"";return H.includes(C)||p.includes(C)})}if(o.value&&B.value.length){const C=new Set(B.value.map(N=>N?.toString()));_=_.filter(N=>!C.has(N.id?.toString()))}return _}),X=e.inject("values"),K=/\{\{\s*([^}]+?)\s*\}\}/g,Q=_=>(_?String(_):"").replace(/<[^>]*>/g,"").trim(),z=e.computed(()=>l.slot??l?.optionTemplate??""),L=_=>{if(!_)return"";const C=z.value;return C?C.replace(K,(N,H)=>{const p=H.trim(),u=_[p];return u!=null?String(u):""}):_.text??""},I=_=>{if(!_)return"";if(!z.value)return _.text??"";const N=L(_);return Q(N)||_.text||""},U=_=>{l.set&&X?.value&&Object.entries(l.set).forEach(([C,N])=>{if(!C)return;const H=_?_[N]:null;X.value[C]=H??null})},J=e.computed(()=>l.parent?X?.value?.[l.parent]?.toString()??null:null),re=async _=>{if(!l.data){let C=l.options??[];if(_?.trim()){const N=_.toLowerCase();C=C.filter(H=>{const p=I(H).toLowerCase(),u=H.text?.toLowerCase?.()||"";return p.includes(N)||u.includes(N)})}return C}try{const C=l.host??"",N=l.prefix??"api",H=l.api??`/${N}/suggest/${l.data}`,p=`${C}${H}`,u=new URLSearchParams;return u.set("json","1"),_&&u.set("key",_),J.value!==void 0&&J.value!==null&&J.value!==""&&u.set("parent",J.value),(await fetch(`${p}?${u.toString()}`).then($=>$.json()))?.data??[]}catch{return[]}},ue=async()=>{l.data?V.value=await re(y.value):V.value=l.options?[...l.options]:[]},A=async _=>{if(_==null)return null;const C=V.value?.find(N=>N?.id?.toString()===String(_));if(C)return C;if(l.data)try{const N=l.host??"",H=l.prefix??"api",p=l.api??`/${H}/suggest/${l.data}`,u=`${N}${p}`,x=new URLSearchParams;return x.set("json","1"),x.set("val",String(_)),J.value!==void 0&&J.value!==null&&J.value!==""&&x.set("parent",J.value),((await fetch(`${u}?${x.toString()}`).then(j=>j.json()))?.data??[])?.[0]??null}catch{return null}return null},le=async _=>{const C=new Set(V.value.map(H=>H.id?.toString())),N=_.filter(H=>!C.has(H?.toString()));N.length&&await N.reduce(async(H,p)=>{await H;const u=await A(p);u&&V.value.push(u)},Promise.resolve())},he=async()=>{a.value||(f.value=!0,await ue(),await e.nextTick(()=>{pe(),h.value?.focus(),F.value.length?k.value=0:k.value=-1}))},ae=()=>{f.value=!1,k.value=-1},wt=async _=>{if(a.value)return;!f.value?await he():ae()},Je=async()=>{f.value?h.value?.focus():await he()},_t=()=>{o.value?(B.value=[],r.value=[],n("change",[]),ve(null,[])):(w.value=null,r.value=null,n("change",null),ve(null,null)),U(null),y.value="",e.nextTick(()=>h.value?.focus())},Et=_=>{o.value&&(B.value=B.value.filter(C=>C?.toString()!==_?.toString()),r.value=[...B.value],n("change",r.value),ve(null),e.nextTick(()=>h.value?.focus()))},ve=(_,C)=>{const N=C??(o.value?[...B.value]:_?.id??null);n("value-selected",{name:l.name,value:N,option:_})},Ae=_=>{o.value?(P(_.id)||(B.value=[...B.value,_.id],r.value=[...B.value],n("change",r.value),ve(_)),y.value="",e.nextTick(()=>{h.value?.focus(),k.value=Math.min(k.value,F.value.length-1)}),U(null)):(w.value=_,r.value=_.id,n("change",r.value),ve(_),y.value="",ae(),U(_))},vt=_=>{P(_.id)||Ae(_)},Fe=(_,C)=>{if(!_||!C)return;const N=_.offsetTop,H=N+_.offsetHeight,p=C.scrollTop,u=p+C.clientHeight;let x=C.scrollTop;N<p?x=N-80:H>u&&(x=H-C.clientHeight+4);const $=C;$.scrollTop=x},Ue=_=>{let C=_.parentElement;for(;C;){if(C.classList.contains("ui-dialog__content"))return C;const N=window.getComputedStyle(C),H=N.overflow+N.overflowY+N.overflowX;if(H.includes("auto")||H.includes("scroll")||C===document.body||C===document.documentElement)return C;C=C.parentElement}return document.body},pe=()=>{if(!c.value)return;const _=c.value.getBoundingClientRect(),C=window.innerHeight||document.documentElement.clientHeight,N=window.innerWidth||document.documentElement.clientWidth,H=8,p=8,u=l.maxHeight||300,x=C-_.bottom-p-H,$=_.top-p-H,D=x>=$,j=Math.max(N-H*2,0);let{width:Y}=_;j>0&&Y>j&&(Y=j);let{left:te}=_;te+Y+H>N&&(te=N-Y-H),te=Math.max(te,H);const se=Math.min(u,Math.max(D?x:$,50));E.value=D?"bottom":"top",g.value={position:"fixed",left:`${te}px`,width:`${Y}px`,minWidth:"300px",maxHeight:`${se}px`,transform:D?"none":"translateY(-100%)",top:D?`${_.bottom+p}px`:`${_.top-p}px`}},Xe=async _=>{a.value||!f.value&&(_.key==="ArrowDown"||_.key==="ArrowUp")&&(_.preventDefault(),await he())},De=_=>{if(!f.value)return;const{key:C}=_;if(C==="ArrowDown")_.preventDefault(),k.value+1<F.value.length&&(k.value+=1,Fe(b.value[k.value],d.value));else if(C==="ArrowUp")_.preventDefault(),k.value>0&&(k.value-=1,Fe(b.value[k.value],d.value));else if(C==="Enter"){_.preventDefault();const N=F.value[k.value];N&&Ae(N),h.value?.blur()}else C==="Escape"?(_.preventDefault(),ae()):C==="Backspace"?o.value&&y.value===""&&B.value.length&&(B.value=B.value.slice(0,-1),r.value=[...B.value],n("change",r.value)):C==="Home"?(k.value=0,Fe(b.value[0],d.value)):C==="End"?(k.value=F.value.length-1,Fe(b.value[k.value],d.value)):C==="Tab"&&ae()},Qe=()=>{a.value||(v.value=!0)},Ve=()=>{v.value=!1,y.value=""},Be=_=>{_.key==="Escape"&&f.value&&ae()},et=_=>{const C=_.target;i.value?.contains(C)||m.value?.contains(C)||ae()},tt=_=>{f.value&&d.value&&!d.value.contains(_.target)&&pe()},lt=()=>{f.value&&pe()},nt=()=>{f.value&&pe()};e.watch(()=>l.options,_=>{_?.length&&(V.value=[..._],ke())},{immediate:!0});async function ke(){if(o.value)Array.isArray(r.value)?B.value=[...r.value]:(B.value=r.value==null?[]:[r.value],r.value=[...B.value]),l.data&&B.value.length&&(await le(B.value),await e.nextTick());else{if(Array.isArray(r.value)){const _=r.value[0]??null;r.value=_??null}r.value!=null&&(w.value=await A(r.value)),U(w.value??null)}}e.watch(r,()=>{ke()}),e.onMounted(async()=>{addEventListener("keydown",Be),addEventListener("scroll",tt,!0),addEventListener("resize",lt),document.addEventListener("click",et,!0),c.value&&Ue(c.value).addEventListener("scroll",nt,!0),l.options?.length&&!l.data?V.value=[...l.options]:l.data&&(V.value=await re("")),await ke(),at.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",Be),removeEventListener("scroll",tt,!0),removeEventListener("resize",lt),document.removeEventListener("click",et,!0),c.value&&Ue(c.value).removeEventListener("scroll",nt,!0)});const Ce=e.ref(!1),xe=e.ref({}),we=e.ref([]),Ne=e.ref(null);async function Vt(){if(!l.add?.token||Ne?.value.validate())return;const C=l.add.api??`/api/table/${l.add.token}`,{id:N}=await fetch(C,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(xe.value)}).then(H=>H.json());if(!l.options?.length&&l.data){const H=await fetch(`${l.api??`/api/suggest/${l.data}`}?val=${N}`).then(p=>p.json());w.value=H[0],V.value.push(H[0]),r.value=N}Ce.value=!1,ee.notify({title:"Success!",message:"Object created."})}async function Bt(){if(!l.add)return null;const _=await fetch(`/api/template/form/${l.add.form}`).then(C=>C.json());return we.value=_.schema,Ce.value=!0,null}function ot(_,C=200){let N;return(...H)=>{N&&clearTimeout(N),N=window.setTimeout(()=>_(...H),C)}}const Ct=ot(async _=>{V.value=await re(_)},200);e.watch(y,_=>{l.data&&Ct(_.trim())}),e.watch(()=>l.options,_=>{!l.data&&_?.length&&(V.value=[..._],ke())},{immediate:!0}),e.watch(()=>l.parent??l.parentValue,()=>{l.data&&ue()});const at=e.ref(!0);return e.watch(J,async()=>{if(l.data&&(at.value||(o.value?(B.value=[],r.value=[],n("change",[])):(w.value=null,r.value=null,n("change",null))),await ue(),l.auto===1&&J.value&&V.value.length>0)){const _=V.value[0];_&&Ae(_)}}),(_,C)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(ee.VsModal),{visible:Ce.value,"onUpdate:visible":C[1]||(C[1]=N=>Ce.value=N),title:"Додати",buttonText:"Додати",onDone:Vt,teleport:_.teleport},{default:e.withCtx(()=>[e.createVNode(be,{schema:we.value,modelValue:xe.value,"onUpdate:modelValue":C[0]||(C[0]=N=>xe.value=N),ref_key:"addForm",ref:Ne},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:C[5]||(C[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",l.customClass])},[C[10]||(C[10]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),C[11]||(C[11]=e.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",f.value||v.value?"border-blue-500 ring-1 ring-blue-500":"",a.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":f.value,"aria-haspopup":"listbox",onKeydown:Xe,onClick:Je,"data-focus":f.value||v.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:c},[o.value?(e.openBlock(),e.createElementBlock("div",ka,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,N=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border max-w-full",key:N.id},[e.createElementVNode("div",ya,[N?.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:N?.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:I(N)},[z.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:L(N)},null,8,xa)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(N.text),1)],64))],8,ba)]),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(H=>Et(N.id),["stop"])},C[6]||(C[6]=[e.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,wa)]))),128)),e.createElementVNode("div",_a,[!a.value&&_.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:B.value.length?" ":S.value,"onUpdate:modelValue":C[2]||(C[2]=N=>y.value=N),onFocus:Qe,onBlur:Ve,onKeydown:De},null,40,Ea)),[[e.vModelText,y.value]]):e.createCommentVNode("",!0)])])):!o.value&&!v.value&&T.value&&y.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900"]),title:T.value},[w.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:w.value?.color})},null,4)):e.createCommentVNode("",!0),z.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass({"pl-5":w.value?.color}),innerHTML:L(w.value)},null,10,Va)):(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass({"pl-5":w.value?.color})},e.toDisplayString(w.value?.text),3))],8,va)):e.createCommentVNode("",!0),o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ba,[!a.value&&_.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:T.value?" ":S.value,"onUpdate:modelValue":C[3]||(C[3]=N=>y.value=N),onFocus:Qe,onBlur:Ve,onKeydown:De},null,40,Ca)),[[e.vModelText,y.value]]):e.createCommentVNode("",!0)]))],512),e.createElementVNode("div",Na,[R.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:a.value,onClick:e.withModifiers(_t,["stop"])},C[7]||(C[7]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,Sa)):e.createCommentVNode("",!0),C[9]||(C[9]=e.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),e.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:a.value,onClick:C[4]||(C[4]=e.withModifiers(N=>wt(),["stop"])),title:f.value?"Закрити список":"Відкрити список"},C[8]||(C[8]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})],-1)]),8,$a)])],42,ga),(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(g.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:g.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[F.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(F.value,(N,H)=>(e.openBlock(),e.createElementBlock("div",{key:N.id,ref_for:!0,ref:p=>b.value[H]=p,class:e.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900 ",P(N.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",k.value===H&&!P(N.id)?"bg-blue-100":""]),"aria-disabled":P(N.id)?"true":"false",role:"option",tabindex:"-1",onClick:p=>vt(N)},[N?.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:N?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",k.value===N.id?"text-white":"",(k.value===H,"")])},[z.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:L(N)},null,8,Aa)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(N.text),1)],64))],2)],10,Ma))),128)):(e.openBlock(),e.createElementBlock("div",Fa," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),l.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:Bt,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:a.value,type:"button"},[e.createVNode(ye,{width:"16",height:"16"}),C[12]||(C[12]=e.createElementVNode("span",null,"Додати",-1))],8,Da)):e.createCommentVNode("",!0)],512)],64))}}),Ia=["placeholder","disabled"],jt=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(s){const t=s,{inputClass:l}=ie(t.style),n=e.useModel(s,"modelValue"),o=e.computed(()=>!!t.disabled),a=e.computed(()=>t.placeholder??"");function r(){typeof n.value=="string"&&(n.value=n.value.trim())}return(i,c)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":c[0]||(c[0]=d=>n.value=d),placeholder:a.value,disabled:o.value,row:"2",onBlur:r,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(l)]]),style:{border:"1px solid #CFD9E0"}},null,42,Ia)),[[e.vModelText,n.value]])}}),Ta={},La={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 Oa(s,t){return e.openBlock(),e.createElementBlock("svg",La,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 Ra=Z(Ta,[["render",Oa]]),za={},ja={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 Ua(s,t){return e.openBlock(),e.createElementBlock("svg",ja,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 Pa=Z(za,[["render",Ua]]),Ha={},Ga={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 Ka(s,t){return e.openBlock(),e.createElementBlock("svg",Ga,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("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 qa=Z(Ha,[["render",Ka]]),Za={},Wa={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 Ya(s,t){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("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 Ja=Z(Za,[["render",Ya]]),Xa={},Qa={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 es(s,t){return e.openBlock(),e.createElementBlock("svg",Qa,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 Ut=Z(Xa,[["render",es]]),ts={},ls={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function ns(s,t){return e.openBlock(),e.createElementBlock("svg",ls,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 os=Z(ts,[["render",ns]]),as={},ss={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function rs(s,t){return e.openBlock(),e.createElementBlock("svg",ss,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 is=Z(as,[["render",rs]]),cs={class:"vs-datatable border rounded-xl w-full flex-grow"},ds={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},us={class:"relative w-full"},ps={class:"table-wrapper flex gap-2"},hs={class:"vs-popover inline-block text-slate-700"},ms={class:"text-center"},fs={class:""},gs={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"},ks={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},ys={class:"text-sm items-center text-gray-800 flex gap-1"},bs={class:"w-full overflow-x-auto"},xs={class:"w-full table-auto caption-bottom text-sm"},ws={class:"[&_tr]:border-b"},_s={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"},Es={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"},vs={key:0,colspan:"100%",class:"text-center"},Vs={class:"w-full"},Bs={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},Cs=["onDragstart","onDragover","onDrop"],Ns={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},Ss={class:"flex items-center justify-center"},$s={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"},Ms={key:0},As=["src"],Fs={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},Ds=["innerHTML"],Is={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"},Ts={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"},Ls={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},Os={class:"flex items-center justify-center gap-2"},Rs=["onClick"],zs=["onClick"],js={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},Pt=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(s){const t=s,l=e.useModel(s,"modelValue"),n=e.ref({}),o=e.ref(""),a=e.computed(()=>{if(!o.value)return l.value??[];const z=o.value.toLowerCase();return l.value.filter(L=>t.colModel?.some(I=>{const U=L[I.key];return U?Array.isArray(U)?U.join(", ").toLowerCase().includes(z):String(U).toLowerCase().includes(z):!1}))}),r=e.ref(null),i=e.ref(null),c=e.ref(!1),d=e.ref(null),m=e.ref({top:0,left:0}),f=z=>{r.value=z},v=z=>{i.value=z},w=z=>{if(r.value===null||r.value===z){r.value=null,i.value=null;return}const L=[...l.value],[I]=L.splice(r.value,1);L.splice(z,0,I),l.value=L,r.value=null,i.value=null},V=z=>{const I=z.currentTarget.getBoundingClientRect();m.value={top:I.bottom+window.scrollY,left:I.left+window.scrollX},c.value=!c.value},k=()=>{d.value&&d.value.click()},b=z=>{const L=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],I=z.toLowerCase();return L.some(U=>I.endsWith(U))},y=z=>{const I=z.target.files?.[0];if(!I)return;const U=new FileReader;U.onload=J=>{try{const re=J.target?.result;if(typeof re=="string"){const ue=JSON.parse(re);Array.isArray(ue)&&l.value.push(...ue)}}catch(re){console.error("Error parsing file:",re)}},U.readAsText(I)},h=()=>{const z=JSON.stringify(l.value,null,2),L=new Blob([z],{type:"application/json"}),I=URL.createObjectURL(L),U=document.createElement("a");U.href=I,U.download="data.json",U.click(),URL.revokeObjectURL(I)};e.onMounted(async()=>{const z=t.colModel?.filter(L=>L.data);z?.length&&Promise.all(z.map(async L=>{const U=await(await fetch(`/api/suggest/${L.data}`)).json();n.value[L.key]=U.data}))});const E=e.ref(""),g=e.ref(!1);let B="edit",M=0;const S=e.ref({}),T=e.ref({});async function R(){E.value="Додати",g.value=!0,B="add",S.value={}}function P(z,L){const I=L.key||L.name;return n.value[I]&&z[I]?n.value[I].find(U=>U.id.toString()===z[I].toString())?.text??z[I]:z[I]||"-"}async function F(z,L){E.value="Редагувати",g.value=!0,B="edit",M=L,S.value={...z}}function X(){const z=T.value.validate();if(z){ee.notify({type:"warning",title:"Помилка валідації",message:Object.entries(z).map(([L,I])=>`${L}: ${I}`).join(`
|
|
2
|
+
`)});return}B==="add"?Array.isArray(l.value)?l.value=[...l.value,S.value]:l.value=[S.value]:l.value=l.value.map((L,I)=>I===M?S.value:L),g.value=!1}function K(z){l.value=l.value.filter((L,I)=>I!==z)}function Q(){g.value=!1}return(z,L)=>(e.openBlock(),e.createElementBlock("div",cs,[e.createElementVNode("div",ds,[e.createElementVNode("div",us,[e.createVNode(Ra,{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":L[0]||(L[0]=I=>o.value=I),placeholder:"Пошук",class:"py-2 px-3 pl-10 w-full bg-gray-100 h-[36px] rounded-[8px] text-[15px] leading-[18px] focus:border-1 text-stone-800 placeholder:text-[#6B7280] focus:outline-blue-500 focus:outline-2"},null,512),[[e.vModelText,o.value]])]),e.createElementVNode("div",ps,[e.createElementVNode("input",{ref_key:"fileInput",ref:d,onChange:y,class:"hidden",accept:".json",type:"file"},null,544),e.createElementVNode("div",hs,[e.createElementVNode("div",ms,[e.createElementVNode("div",fs,[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(Pa,{height:"16",width:"16"})])])])])]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[c.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",gs,[e.createElementVNode("div",ks,[e.createElementVNode("button",{onClick:k,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createVNode(qa,{class:"text-black",width:"14",height:"14"}),L[4]||(L[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",ys,[e.createVNode(Ja,{class:"text-black",width:"14",height:"14"}),L[5]||(L[5]=e.createTextVNode(" Експортувати ",-1))])])])])],4)):e.createCommentVNode("",!0)])),e.createElementVNode("button",{onClick:R,class:"text-slate-700 bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[e.createVNode(ye),L[6]||(L[6]=e.createTextVNode(" Додати ",-1))])]),e.createElementVNode("div",bs,[e.createElementVNode("table",xs,[e.createElementVNode("thead",ws,[e.createElementVNode("tr",_s,[e.createElementVNode("th",Es,[e.createVNode(Ut,{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(z.colModel,I=>(e.openBlock(),e.createElementBlock("th",{key:I.key,class:"h-10 px-2 text-left align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 min-w-[150px]"},e.toDisplayString(I.ua||I.label),1))),128)),L[7]||(L[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})},[a.value.length===0?(e.openBlock(),e.createElementBlock("td",vs,[e.createElementVNode("div",Vs,[e.createElementVNode("div",Bs,[e.createVNode(os,{class:"w-48 mx-auto"}),L[8]||(L[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(a.value,(I,U)=>(e.openBlock(),e.createElementBlock("tr",{key:I.id,class:e.normalizeClass(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move",{"opacity-50":r.value===U,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":i.value===U}]),draggable:"true",onDragstart:J=>f(U),onDragover:e.withModifiers(J=>v(U),["prevent"]),onDrop:J=>w(U)},[e.createElementVNode("td",Ns,[e.createElementVNode("div",Ss,[e.createVNode(Ut,{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(z.colModel,J=>(e.openBlock(),e.createElementBlock("td",{key:J.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[J.type==="file"?(e.openBlock(),e.createElementBlock("div",$s,[b(P(I,J))?(e.openBlock(),e.createElementBlock("div",Ms,[e.createElementVNode("img",{src:P(I,J),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,As)])):(e.openBlock(),e.createElementBlock("div",Fs,[e.createVNode(Dt,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):J.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(I,J)},null,8,Ds)):J.type==="reference"?(e.openBlock(),e.createElementBlock("div",Is,e.toDisplayString(P(I,J)),1)):(e.openBlock(),e.createElementBlock("div",Ts,e.toDisplayString(P(I,J)),1))]))),128)),e.createElementVNode("td",Ls,[e.createElementVNode("div",Os,[e.createElementVNode("button",{onClick:J=>F(I,U),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(is,{width:"24",height:"24",class:"w-3 h-3"})],8,Rs),e.createElementVNode("button",{onClick:J=>K(U),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($e,{width:"24",height:"24",class:"w-3 h-3"})],8,zs)])])],42,Cs))),128))],2)])]),e.createVNode(e.unref(ee.VsModal),{visible:g.value,title:E.value,size:"lg",onClose:Q},{default:e.withCtx(()=>[e.createVNode(be,{schema:t.colModel,values:S.value,"onUpdate:values":L[1]||(L[1]=I=>S.value=I),form:T.value,"onUpdate:form":L[2]||(L[2]=I=>T.value=I)},null,8,["schema","values","form"]),e.createElementVNode("div",js,[e.createElementVNode("button",{type:"button",onClick:L[3]||(L[3]=I=>g.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:X,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"])]))}}),Us={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:"Клацніть на шари, щоб видалити їх"}}}}},Ps={},Hs={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 Gs(s,t){return e.openBlock(),e.createElementBlock("svg",Hs,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 Ks=Z(Ps,[["render",Gs]]),qs={},Zs={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 Ws(s,t){return e.openBlock(),e.createElementBlock("svg",Zs,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 Ys=Z(qs,[["render",Ws]]),Js={},Xs={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function Qs(s,t){return e.openBlock(),e.createElementBlock("svg",Xs,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 er=Z(Js,[["render",Qs]]),tr={},lr={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 nr(s,t){return e.openBlock(),e.createElementBlock("svg",lr,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 or=Z(tr,[["render",nr]]),ar={},sr={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 rr(s,t){return e.openBlock(),e.createElementBlock("svg",sr,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 ir=Z(ar,[["render",rr]]),cr={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},dr={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"},ur=["onClick"],pr={class:"relative flex-1 min-w-[140px]"},hr=["placeholder"],mr="https://data.softpro.ua/api-user/gis-url-proxy",fr="https://geo.rv.ua/api-user/dzk.api",gr=Z(e.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(s,{emit:t}){const l=s,n=t,o=["here","xy","parcel"],a=e.computed(()=>{const g=l.config?.tools?.filter(B=>o.includes(B));return g&&g.length?g:o}),r=e.computed(()=>l.config?.placeholder?.trim()||"Пошук…"),i=e.ref(a.value[0]??o[0]);e.watch(a,g=>{g.includes(i.value)||(i.value=g[0])});const c=e.ref(""),d=e.ref(!1),m=e.ref(null);e.watch(i,()=>{c.value="",d.value=!1});function f(g){i.value=g}function v(g){if(!d.value)return;const B=m.value;B&&!B.contains(g.target)&&(d.value=!1)}e.onMounted(()=>{window.addEventListener("click",v,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",v,!0)});function w(g){return g==="xy"?"Координати":g==="parcel"?"Кадастр":"Адреси"}function V(g){const B=g.replace(/[,]+/g," ").trim();if(!B)return null;const M=B.split(/\s+/).filter(Boolean);if(M.length<2)return null;const S=M.slice(0,2).map(Number);if(!S.every(Q=>Number.isFinite(Q)))return null;let[T,R]=S,P=T,F=R;const X=Q=>Math.abs(Q)<=90,K=Q=>Math.abs(Q)<=180;if(!X(P)||!K(F))if(X(F)&&K(P))P=R,F=T;else return null;return{lat:P,lng:F}}function k(g){return(g?.items||[]).map((M,S)=>({id:String(M?.id??S),title:M?.title||M?.address?.label||"Знайдений обʼєкт",lat:Number(M?.position?.lat),lng:Number(M?.position?.lng)})).filter(M=>Number.isFinite(M.lat)&&Number.isFinite(M.lng))}function b(g){const B=g?.result||g?.data||g;if(!B)return[];const M=B.geom_centroid;if(!M||!Array.isArray(M.coordinates))return[];const[S,T]=M.coordinates;return!Number.isFinite(T)||!Number.isFinite(S)?[]:[{id:"parcel",title:B.cadnum||B.cad_num||"Земельна ділянка",lat:T,lng:S}]}function y(g){const M=g.replace(/\s+/g,"").split(":");if(M.length!==4)return!1;const S=[10,2,3,4];return M.every((T,R)=>T.length===S[R]&&/^\d+$/.test(T))}function h(g){n("goToCoordinates",[g.lat,g.lng])}async function E(){const g=c.value.trim();if(g){if(i.value==="xy"){const B=V(g);if(!B){ee.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}h(B),c.value="";return}try{const B=new URL(i.value==="here"?mr:fr);if(i.value==="here")B.searchParams.set("searchtext",g);else{if(!y(g)){ee.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}B.searchParams.set("cad_num",g)}const M=await fetch(B.toString());if(!M.ok)throw new Error(`HTTP ${M.status}`);const S=await M.json(),T=i.value==="here"?k(S):b(S);if(!T.length)ee.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const R=T[0];h(R),c.value=""}}catch(B){const M=B?.message||"Помилка пошуку";ee.notify({type:"error",title:"Пошук",message:M})}}}return(g,B)=>(e.openBlock(),e.createElementBlock("div",cr,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(E,["prevent"])},[a.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:B[0]||(B[0]=M=>d.value=!d.value)},[e.createElementVNode("span",null,e.toDisplayString(w(i.value)),1),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":d.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},B[2]||(B[2]=[e.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2))]),d.value?(e.openBlock(),e.createElementBlock("div",dr,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,M=>(e.openBlock(),e.createElementBlock("li",{key:M,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:S=>f(M)},e.toDisplayString(w(M)),9,ur))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",pr,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":B[1]||(B[1]=M=>c.value=M),placeholder:r.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,hr),[[e.vModelText,c.value,void 0,{trim:!0}]]),B[3]||(B[3]=e.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),[["__scopeId","data-v-3048520a"]]),kr={class:"bg-white/30 p-1 rounded-md shadow w-fit"},yr={class:"flex gap-2"},br=["onClick","title"],xr=["src"],wr=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(s,{emit:t}){const l=s,n=e.ref(Object.keys(l.basemaps)[0]),o=t;function a(r){o("onLayerChange",r),n.value=r}return(r,i)=>(e.openBlock(),e.createElementBlock("div",kr,[e.createElementVNode("div",yr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.basemaps,(c,d)=>(e.openBlock(),e.createElementBlock("div",{key:d,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":n.value===d}]),onClick:m=>a(d),title:c.name||d,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:c.preview,alt:"",class:"w-10 h-10 object-cover"},null,8,xr)],10,br))),128))])]))}});function Ie(s){return s?s.type==="Polygon"?{type:"MultiPolygon",coordinates:[s.coordinates]}:s.type==="Feature"?{...s,geometry:Ie(s.geometry)}:s.type==="FeatureCollection"?{...s,features:(s.features||[]).map(t=>Ie(t)).filter(Boolean)}:s:null}function _r(s){return s?s.type==="FeatureCollection"||s.type==="Feature"?Ie(s):s.geom?{type:"Feature",geometry:Ie({type:s.geom.type,coordinates:s.geom.coordinates}),properties:{}}:s.type&&s.coordinates?{type:"Feature",geometry:Ie(s),properties:{}}:null:null}const Er={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},vr={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},Vr={class:"text-sm font-medium"},Br={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},Cr={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},Nr={class:"flex items-center gap-1"},Sr=["disabled"],$r=["disabled"],Mr=["disabled"],Ar={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"},Fr={class:"space-y-0.5"},Dr={class:"text-gray-500"},Ir={class:"text-gray-900 text-right break-all"},Tr={class:"absolute top-4 right-4 z-[1000]"},Lr={class:"flex flex-col gap-[2px]"},Or=["disabled"],Rr=["disabled"],zr=["disabled"],jr=["disabled"],Ur={class:"flex flex-col gap-2"},Pr={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]"},Hr={class:"flex flex-col gap-1"},Gr=["checked","disabled","onChange"],Kr={class:"text-gray-700 text-xs font-medium"},qr={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"},Zr={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},Wr={class:"shrink-0"},Yr={class:"font-bold"},Jr={class:"flex items-center"},Xr={class:"text-xs mr-2"},Qr={key:0,class:"text-xs"},ei={key:1,class:"text-xs"},ti=["disabled"],li=["disabled"],Ge="vs-base-tile-pane",Ke="vs-overlay-tile-pane",Ht=Z(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(s,{emit:t}){const n=e.getCurrentInstance()?.appContext?.config?.globalProperties?.$settings??{},o=Array.isArray(n.center)&&n.center.length===2?n.center:[50,30],a=typeof n.zoom=="number"?n.zoom:typeof n.defaultZoom=="number"?n.defaultZoom:10,r=s,i=t,c=e.computed(()=>!!r.disabled),d=e.ref(!1),m=e.ref(null),f=e.ref(!1),v=e.ref(""),w=e.ref(null),V=e.ref(null),k=e.ref(!1),b=e.ref(null),y=e.ref(null),h=e.ref(0),E=e.ref(o),g=e.ref(a),B=e.ref([]),M=e.ref(r.modelValue);let S=!1;const T=e.ref(null),R=e.computed(()=>{const p={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!r.tools?.length)return p;const u=new Set(r.tools.map(x=>x.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({}),F=e.ref([]),X=e.computed(()=>F.value.map(p=>P[p]).filter(Boolean)),K=e.ref(null),Q=e.computed(()=>K.value?.entries??[]),z=e.computed(()=>{if(!K.value)return;const p=12,u=K.value.point.x+p,x=K.value.point.y+p;return{left:`${u}px`,top:`${x}px`}});function L(p){if(typeof p!="string"||!p.trim())return"";if(/^https?:\/\//i.test(p))return p;const u=window?.location?.origin??"",x=p.replace(/^\/+/,"");return x?u?`${u}/${x}`:`/${x}`:u}function I(){if(Array.isArray(n.basemaps)&&n.basemaps.length){const u=n.basemaps.map((x,$)=>{const D=String(x?.key??x?.id??x?.name??`b${$}`),j=L(String(x?.url??""));if(!j)return null;const Y=typeof x?.preview=="string"&&x.preview?L(x.preview):"";return[D,{...x,url:j,preview:Y}]}).filter(x=>Array.isArray(x)&&x.length===2).reduce((x,[$,D])=>(x[$]=D,x),{});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 U=I(),J=Object.keys(U),re=e.ref(J.length?J[0]:"");let ue,A,le,he,ae=null;async function wt(){const p=$=>{if(!Array.from(document.styleSheets).some(D=>D?.href?.includes($))){const D=document.createElement("link");D.rel="stylesheet",D.href=$,document.head.appendChild(D)}},u=$=>new Promise((D,j)=>{if(Array.from(document.scripts).some(se=>se.src===$))return D();const te=document.createElement("script");te.src=$,te.async=!0,te.onload=()=>D(),te.onerror=se=>j(se),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 Je(){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 _t(){if(!r.handleZoom||!m.value||!A)return null;let p;const u=$=>{const D=$.ctrlKey||$.metaKey||$.shiftKey;if(!r.ctrlZoom){f.value=!1,A.scrollWheelZoom.enable();return}if(!D){f.value=!0,v.value=Je(),clearTimeout(p),p=window.setTimeout(()=>f.value=!1,1200);return}$.preventDefault(),$.stopPropagation(),f.value=!1,A.scrollWheelZoom.enable(),setTimeout(()=>A.scrollWheelZoom.disable(),120)},x=$=>{if($.touches.length===1){if(!r.ctrlZoom)return;f.value=!0,v.value=Je(),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",x,{passive:!0}),A.on("wheel",$=>{if(!r.ctrlZoom)return;$.originalEvent?.ctrlKey||$.originalEvent?.metaKey||$.originalEvent?.shiftKey||($.originalEvent?.preventDefault?.(),$.originalEvent?.stopPropagation?.())}),()=>{m.value?.removeEventListener("wheel",u),m.value?.removeEventListener("touchstart",x),clearTimeout(p)}}function Et(p,u){return p?.id?String(p.id):p?.url?`${p.url}-${u}`:`layer-${u}`}function ve(p){const u=(p?.url??"").trim();if(!u)return"";if(/^https?:\/\//i.test(u))return u;const x=window.location?.origin??"",$=u.replace(/^\/+/,"");return`${x}/${$}`}function Ae(p){const u=p?.style??{};return x=>{const $=u.colorAttr,D=u.colorSet??{},j=typeof $=="string"?D?.[x?.[$]]??u.color??"#3388ff":u.color??"#3388ff",Y=u.stroke??j;return{weight:u.width??1,color:Y,opacity:u.opacity??1,fill:u.type?u.type!=="polyline":!0,fillColor:j,fillOpacity:u.opacity??.5}}}function vt(p){return p?.layer?.properties||p?.layer?.feature?.properties||p?.properties||{}}function Fe(p,u={}){return p.popup===!1?[]:Array.isArray(p.popup)&&p.popup.length?p.popup.map(x=>{if(!x?.field)return null;const $=u[x.field];return $==null||$===""?null:{key:x.label||x.field,value:String($)}}).filter(x=>!!x):Object.entries(u).filter(([x])=>typeof x=="string"&&x).slice(0,5).map(([x,$])=>({key:x,value:$==null?"—":String($)}))}function Ue(p,u){if(!A||!u?.latlng)return;const x=A.latLngToContainerPoint(u.latlng),$=vt(u),D=Fe(p,$);if(!D.length){pe(p.id);return}K.value={layerId:p.id,title:$?.name||p.title||p.name,properties:$,entries:D,point:{x:x.x,y:x.y}}}function pe(p){p&&K.value?.layerId!==p||(K.value=null)}function Xe(p){const u=(p?.service??"").toLowerCase(),x=ve(p),$=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 D=T.value;if(D?.vectorGrid?.protobuf&&!D?.maplibreGL){const j=D.vectorGrid.protobuf(x,{interactive:!0,maxNativeZoom:p.maxzoom??19,vectorTileLayerStyles:{[$??"default"]:Ae(p),default:Ae(p)}});return j?.on?.("mouseover",Y=>Ue(p,Y)),j?.on?.("mousemove",Y=>Ue(p,Y)),j?.on?.("mouseout",()=>pe(p.id)),j}if(D?.maplibreGL&&window?.maplibregl){const j=x;return j?D.maplibreGL({style:j,interactive:!1,pane:"overlayPane"}):null}return null}return u==="tile"||/^https?:\/\//i.test(x)||x.includes("{z}")?T.value.tileLayer(x,{opacity:p?.style?.opacity??1,pane:Ke}):T.value.tileLayer(x,{opacity:p?.style?.opacity??1,pane:Ke})}function De(p){const u=T.value;if(!u)return null;const x=("bounds"in p?p.bounds:void 0)??r.bounds??B.value;if(!Array.isArray(x)||!x.length)return null;const D={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:x,Y=Qe(j);if(!Y.length||!u?.polyline)return null;const te=Y.map(se=>{if(!se.length)return se;const Pe=se[0],Nt=se[se.length-1];return Pe&&Nt&&typeof Nt.equals=="function"&&!Nt.equals(Pe)?[...se,Pe]:se});return u.polyline(te,D)}function Qe(p){const u=T.value;if(!u||!Array.isArray(p))return[];const x=D=>{if(!Array.isArray(D)||D.length<2)return null;const[j,Y]=D;return!Number.isFinite(Number(Y))||!Number.isFinite(Number(j))?null:u.latLng(Number(Y),Number(j))},$=D=>Array.isArray(D)&&D.length>=2&&D.every(j=>Number.isFinite(Number(j)));if(p.length&&$(p[0])){const D=p.map(x).filter(Boolean);return D.length?[D]:[]}return p.length&&Array.isArray(p[0])&&Array.isArray(p[0][0])&&$(p[0][0][0])?p.flatMap(j=>Array.isArray(j)?j:[]).map(j=>Array.isArray(j)?j.map(x).filter(Boolean):[]).filter(j=>j.length):p.length&&Array.isArray(p[0])&&$(p[0][0])?p.map(j=>Array.isArray(j)?j.map(x).filter(Boolean):[]).filter(j=>j.length):[]}function Ve(){if(!A||!T.value)return;ae&&A.hasLayer(ae)&&(A.removeLayer(ae),ae=null);const p=De({id:"global-bounds",bounds:r.bounds??B.value,style:{}});p&&(ae=p,ae.addTo(A))}function Be(){!A||!T.value||F.value.forEach(p=>{const u=P[p];u&&(u.visible?(u.layer||(u.layer=Xe(u.config)),u.boundsLayer||(u.boundsLayer=De(u.config)),u.layer&&!A.hasLayer(u.layer)&&u.layer.addTo(A),u.boundsLayer&&!A.hasLayer(u.boundsLayer)&&u.boundsLayer.addTo(A)):(u.layer&&A.hasLayer(u.layer)&&A.removeLayer(u.layer),u.boundsLayer&&A.hasLayer(u.boundsLayer)&&A.removeLayer(u.boundsLayer),pe(u.id)))})}function et(p){if(c.value)return;const u=P[p];u&&(u.visible=!u.visible,u.visible?(u.layer||(u.layer=Xe(u.config)),u.boundsLayer||(u.boundsLayer=De(u.config)),u.layer&&!A.hasLayer(u.layer)&&u.layer.addTo(A),u.boundsLayer&&!A.hasLayer(u.boundsLayer)&&u.boundsLayer.addTo(A)):(u.layer&&A.hasLayer(u.layer)&&A.removeLayer(u.layer),u.boundsLayer&&A.hasLayer(u.boundsLayer)&&A.removeLayer(u.boundsLayer),pe(u.id)))}e.watch(()=>r.layers,p=>{const u=Array.isArray(p)?p:[],x=[],$=new Set;u.forEach((D,j)=>{if(!D)return;const Y=Et(D,j);x.push(Y),$.add(Y);const te=P[Y],se={...D,id:Y},Pe=te?.visible??se?.overlay!==!1;te&&(te.layer&&A?.hasLayer(te.layer)&&A.removeLayer(te.layer),te.boundsLayer&&A?.hasLayer(te.boundsLayer)&&A.removeLayer(te.boundsLayer),pe(Y)),P[Y]={id:Y,config:se,visible:Pe,layer:null,boundsLayer:null}}),Object.keys(P).forEach(D=>{if(!$.has(D)){const j=P[D];j?.layer&&A?.hasLayer(j.layer)&&A.removeLayer(j.layer),j?.boundsLayer&&A?.hasLayer(j.boundsLayer)&&A.removeLayer(j.boundsLayer),pe(D),delete P[D]}}),F.value=x,Be()},{immediate:!0,deep:!0}),e.watch(()=>r.bounds,()=>{A&&(Object.values(P).forEach(p=>{p.boundsLayer&&A.hasLayer(p.boundsLayer)&&A.removeLayer(p.boundsLayer),p.boundsLayer=null}),Ve(),Be())},{deep:!0}),e.watch(()=>r.katottg,async p=>{if(B.value=[],!p){Ve();return}try{const u=await fetch(`https://data.gki.com.ua/api-user/atu/${p}`);if(!u?.ok)return;const $=(await u.json())?.geometry?.coordinates;Array.isArray($)&&$.length&&(B.value=$)}catch(u){console.error("Failed to fetch KATOTTG bounds",u)}finally{Ve(),Be()}},{immediate:!0}),e.watch(()=>r.modelValue,p=>{if(!A||!le){M.value=p;return}Ce(p)},{deep:!0});function tt(p){const u=T.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 lt(p){const u=T.value;if(p instanceof u.Circle){const x=p.getRadius();return Math.PI*(x*x)/1e6}if(p instanceof u.Polygon||p instanceof u.Rectangle)try{const x=p.getLatLngs(),$=Array.isArray(x[0])?x[0]:x,D=u.GeometryUtil?.geodesicArea?u.GeometryUtil.geodesicArea($):0;return D?D/1e6:0}catch{return null}return null}function nt(p){return p instanceof T.value.Circle?p.getLatLng():p.getBounds?p.getBounds().getCenter():p.getLatLng?p.getLatLng():A.getCenter()}function ke(p){const u=le.toGeoJSON(),x=[];let $=null;const D=Y=>{if(Y)switch(Y.type){case"Point":$=Y;break;case"Polygon":x.push(Y.coordinates);break;case"MultiPolygon":x.push(...Y.coordinates);break;case"GeometryCollection":(Y.geometries||[]).forEach(D);break}};(u?.features||[]).forEach(Y=>D(Y.geometry));const j=$||(x.length?{type:x.length===1?"Polygon":"MultiPolygon",coordinates:x.length===1?x[0]:x}:null);!p?.silent&&!S&&i("update:modelValue",j),h.value=le.getLayers().length}function Ce(p){if(!le||!T.value)return;le.clearLayers();const u=_r(p);if(!u){V.value=null,h.value=0;return}T.value.geoJSON(u).eachLayer($=>le.addLayer($)),S=!0,ke({silent:!0}),S=!1,xe();const x=le.getBounds?.();x?.isValid?.()&&A?.fitBounds(x,{padding:[24,24]})}function xe(){const p=le.getLayers();if(!p.length){V.value=null,h.value=0;return}const u=p[p.length-1],x=tt(u),$=nt(u),D=lt(u);V.value={type:x,center:$,areaKm2:D,layer:u},h.value=p.length}const we=e.ref("");function Ne(p){if(c.value||!A||!T.value)return;he?.disable&&he.disable();const u=T.value;switch(p){case"marker":he=new u.Draw.Marker(A);break;case"polyline":he=new u.Draw.Polyline(A);break;case"polygon":he=new u.Draw.Polygon(A);break;case"rectangle":he=new u.Draw.Rectangle(A);break}he.enable(),we.value=p}function Vt(){if(c.value)return;const p=V.value?.layer;p&&(p.getBounds?A.fitBounds(p.getBounds(),{padding:[30,30]}):p.getLatLng&&A.setView(p.getLatLng(),Math.max(g.value,14)))}function Bt(){c.value||le&&(le.clearLayers(),i("update:modelValue",null),V.value=null,h.value=0)}const ot=e.ref(null);function Ct(){c.value||ot.value?.click()}function at(p){if(c.value)return;const u=p.target,x=u.files?.[0];if(!x)return;const $=new FileReader;$.onload=()=>{try{const D=JSON.parse(String($.result));le.clearLayers(),D&&T.value.geoJSON(D).eachLayer(j=>le.addLayer(j)),ke(),xe()}finally{u.value=""}},$.readAsText(x)}function _(){if(c.value)return;const p=le.toGeoJSON(),u=new Blob([JSON.stringify(p,null,2)],{type:"application/json"}),x=URL.createObjectURL(u),$=document.createElement("a");$.href=x,$.download="data.geojson",$.click(),URL.revokeObjectURL(x)}function C(p){!A||!T.value||!U[p]||(ue&&A.removeLayer(ue),ue=T.value.tileLayer(U[p].url,{maxZoom:19,minZoom:6,pane:Ge}).addTo(A),re.value=p)}function N(p){if(!A||!T.value)return;const u=T.value.latLng(p[0],p[1]);A.setView(u,13)}let H=null;return e.onMounted(async()=>{T.value=await wt();const p=T.value;p.drawLocal=Us,A=p.map(m.value,{zoomControl:!1,scrollWheelZoom:!1}).setView(E.value,g.value),p.control.zoom({position:"bottomright"}).addTo(A);const u=re.value||Object.keys(U)[0];A.createPane(Ge),A.getPane(Ge).style.zIndex="180",A.createPane(Ke),A.getPane(Ke).style.zIndex="220",u&&U[u]&&(re.value=u,ue=p.tileLayer(U[u].url,{maxZoom:19,minZoom:6,pane:Ge}).addTo(A)),le=new p.FeatureGroup().addTo(A),A.on(p.Draw.Event.CREATED,$=>{if(c.value)return;const{layer:D}=$;le.clearLayers(),le.addLayer(D),ke(),xe(),we.value=""}),A.on(p.Draw.Event.EDITED,()=>{c.value||(ke(),xe())}),A.on(p.Draw.Event.DELETED,()=>{c.value||(ke(),xe())});let x=!1;A.on("mousemove",$=>{x||(A.invalidateSize(),x=!0)}),A.on("zoomend",()=>{g.value=A.getZoom()}),H=_t(),Be(),Ve(),M.value!==void 0&&(Ce(M.value),M.value=void 0)}),e.onUnmounted(()=>{H?.(),pe(),ae&&A?.hasLayer(ae)&&(A.removeLayer(ae),ae=null),A?.remove&&A.remove()}),e.watch(d,()=>{setTimeout(()=>{A?.invalidateSize&&A.invalidateSize()},50)}),e.watch(k,async p=>{if(!p||!y.value){b.value=null;return}await e.nextTick();const u=y.value.getBoundingClientRect();b.value={top:u.bottom+6,left:u.left}}),(p,u)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",disabled:!d.value},[e.createElementVNode("div",{class:e.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:d.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref: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&&r.handleZoom?(e.openBlock(),e.createElementBlock("div",Er,[e.createElementVNode("div",vr,[e.createElementVNode("p",Vr,e.toDisplayString(v.value),1)])])):e.createCommentVNode("",!0)]),_:1}),R.value.search||R.value.import||R.value.export?(e.openBlock(),e.createElementBlock("div",Br,[R.value.search?(e.openBlock(),e.createBlock(gr,{key:0,onGoToCoordinates:N})):e.createCommentVNode("",!0),R.value.import||R.value.export?(e.openBlock(),e.createElementBlock("div",Cr,[e.createElementVNode("div",Nr,[R.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:Ct,disabled:c.value}," Import ",8,Sr)):e.createCommentVNode("",!0),R.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:_,disabled:c.value||h.value===0}," Export ",8,$r)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:ot,type:"file",onChange:at,accept:".json,.geojson",class:"hidden",disabled:c.value},null,40,Mr)])):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(z.value)},[e.createElementVNode("div",Ar,[e.createElementVNode("dl",Fr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Q.value,x=>(e.openBlock(),e.createElementBlock("div",{key:`${x.key}-${x.value}`,class:"flex justify-between gap-2"},[e.createElementVNode("dt",Dr,e.toDisplayString(x.key),1),e.createElementVNode("dd",Ir,e.toDisplayString(x.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",Tr,[e.createElementVNode("div",Lr,[R.value.point?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":we.value==="marker"}]),title:"Point",onClick:u[0]||(u[0]=x=>Ne("marker")),disabled:c.value},[e.createVNode(Ks)],10,Or)):e.createCommentVNode("",!0),R.value.line?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":we.value==="polyline"}]),title:"Line",onClick:u[1]||(u[1]=x=>Ne("polyline")),disabled:c.value},[e.createVNode(Ys)],10,Rr)):e.createCommentVNode("",!0),R.value.polygon?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":we.value==="polygon"}]),title:"Polygon",onClick:u[2]||(u[2]=x=>Ne("polygon")),disabled:c.value},[e.createVNode(er)],10,zr)):e.createCommentVNode("",!0),R.value.rectangle?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":we.value==="rectangle"}]),title:"Rectangle",onClick:u[3]||(u[3]=x=>Ne("rectangle")),disabled:c.value},[e.createVNode(or)],10,jr)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:u[4]||(u[4]=x=>d.value=!d.value),title:"Full Screen"},[e.createVNode(ir,{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",Ur,[e.createVNode(wr,{basemaps:e.unref(U),onOnLayerChange:C},null,8,["basemaps"]),X.value.length?(e.openBlock(),e.createElementBlock("div",Pr,[u[9]||(u[9]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),e.createElementVNode("div",Hr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(X.value,x=>(e.openBlock(),e.createElementBlock("label",{key:x.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:x.visible,disabled:c.value,onChange:$=>et(x.id)},null,40,Gr),e.createElementVNode("span",Kr,e.toDisplayString(x.config.title||x.config.name||x.id),1)]))),128))])])):e.createCommentVNode("",!0)])],2),e.createElementVNode("div",qr,[V.value?(e.openBlock(),e.createElementBlock("div",Zr,[e.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:u[5]||(u[5]=x=>k.value=!0),onMouseleave:u[6]||(u[6]=x=>k.value=!1)},[e.createElementVNode("div",Wr,[u[10]||(u[10]=e.createTextVNode(" Type: ",-1)),e.createElementVNode("span",Yr,e.toDisplayString(V.value.type),1)]),w.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"addressEl",ref:y,class:"text-gray-500 text-xs truncate cursor-help",style:{"max-width":"260px"}}," Address: "+e.toDisplayString(w.value),513)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[k.value&&w.value&&b.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:b.value.top+"px",left:b.value.left+"px"})},e.toDisplayString(w.value),5)):e.createCommentVNode("",!0)]))],32),e.createElementVNode("div",Jr,[e.createElementVNode("div",Xr,[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",Qr,[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",ei,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]=x=>Vt()),disabled:c.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,ti),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]=x=>Bt()),disabled:c.value},[e.createVNode($e,{class:"w-3 h-3"})],8,li)])])):e.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-52b45f71"]]),ni=["data-focus"],oi={class:"flex items-center"},ai={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},si=["onClick","aria-label"],ri={key:0,class:"absolute text-gray-500 truncate pl-2"},ii={class:"flex-1 min-w-[2px]"},ci=["placeholder"],di={class:"flex items-center shrink-0"},ui=["disabled"],Gt=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(s,{emit:t}){const l=s,n=t;ie(l.style);const o=e.ref(null),a=e.ref(null),r=e.ref(null),i=e.ref(!1),c=e.ref(""),d=e.useModel(s,"modelValue"),m=e.computed(()=>l.placeholder||"Add tag…"),f=e.computed(()=>d.value?.length===0&&c.value===""),v=e.computed(()=>!l.disabled&&d.value?.length>0),w=e.computed(()=>l.disabled),V=async()=>{w.value||await e.nextTick(()=>r.value?.focus())},k=M=>{const S=M.trim();S!==""&&(!d.value||!Array.isArray(d.value)?d.value=[S]:l.unique?d.value.includes(S)||(d.value=[...d.value,S]):d.value=[...d.value,S],c.value="")},b=()=>{const M=c.value;M.trim()!==""&&k(M),c.value=""},y=M=>{const S=d.value.slice();S.splice(M,1),n("update:modelValue",S)},h=()=>{n("update:modelValue",[])},E=()=>{w.value||(i.value=!0)},g=()=>{i.value=!1,!w.value&&b()},B=M=>{const{key:S}=M;S==="Enter"?(M.preventDefault(),b()):S==="Backspace"&&c.value===""&&d.value.length>0&&y(d.value.length-1)};return(M,S)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:S[1]||(S[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",l.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":"",w.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:a},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(T,R)=>(e.openBlock(),e.createElementBlock("div",{key:R,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",oi,[e.createElementVNode("div",ai,e.toDisplayString(T),1)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:e.withModifiers(P=>y(R),["stop"]),"aria-label":`Remove ${T}`},S[2]||(S[2]=[e.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,si)]))),128)),f.value?(e.openBlock(),e.createElementBlock("div",ri,e.toDisplayString(m.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",ii,[w.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:r,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":S[0]||(S[0]=T=>c.value=T),onFocus:E,onBlur:g,onKeydown:B,placeholder:d.value&&d.value.length?"":void 0},null,40,ci)),[[e.vModelText,c.value]])])],512),e.createElementVNode("div",di,[v.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:w.value,onClick:e.withModifiers(h,["stop"])},S[3]||(S[3]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,ui)):e.createCommentVNode("",!0)])],10,ni)],2)],512))}}),pi={class:"relative flex gap-1 bg-white w-full"},hi=["disabled","placeholder"],Kt=Z(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(s){const t=e.inject("values"),l=s,n=e.useModel(s,"modelValue");function o(r){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 r.toLowerCase().split("").map(c=>i[c]||c).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const a=()=>{const r=t?.value?.[l.parent||""]?.toString(),i=o(r);n.value=i.toString()};return(r,i)=>(e.openBlock(),e.createElementBlock("div",pi,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:r.disabled,placeholder:r.placeholder,"onUpdate:modelValue":i[0]||(i[0]=c=>n.value=c),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,hi),[[e.vModelText,n.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:a}," Gen ")]))}}),[["__scopeId","data-v-b0eba370"]]),mi={class:"relative flex gap-1 bg-white w-full"},fi=["disabled","placeholder"],gi=["disabled"],ki={key:0},yi={key:1},qt=Z(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(s){const t=s,l=e.useModel(s,"modelValue"),n=e.ref(!1),o=e.computed(()=>t.init!==!1),a=e.computed(()=>!!t.table&&!!t.code),r=()=>{if(!a.value)return"";const d=encodeURIComponent(String(t.table)),m=encodeURIComponent(String(t.code));return`/api/code-gen/${d}/${m}`},i=async()=>{if(!a.value||n.value)return;const d=r();if(d){n.value=!0;try{const f=await(await fetch(d)).text();l.value=f}finally{n.value=!1}}},c=()=>{o.value&&(l.value||i())};return e.onMounted(()=>{c()}),e.watch(()=>[t.table,t.code,t.init],()=>{c()}),(d,m)=>(e.openBlock(),e.createElementBlock("div",mi,[e.withDirectives(e.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":m[0]||(m[0]=f=>l.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,fi),[[e.vModelText,l.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:n.value||d.disabled||!a.value,onClick:i},[n.value?(e.openBlock(),e.createElementBlock("span",yi,"...")):(e.openBlock(),e.createElementBlock("span",ki,"Gen"))],8,gi)]))}}),[["__scopeId","data-v-6ee5237d"]]),bi={class:"w-full"},xi={ref:"sortableContainer",class:"flex flex-col gap-1"},wi=["onDragstart","onDrop"],_i={class:"w-1/3"},Ei={class:"w-2/3"},vi=["onClick"],Vi={key:0,class:"text-[14px] text-gray-700"},Bi={class:"mt-2 w-full flex items-center"},Ci=["disabled"],Zt=Z(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(s,{emit:t}){const l=b=>`${b}-${Math.random().toString(36).substring(2,15)}`,n=e.inject("values"),o=s,a=t,r=o.addButtonText??"Додати",i=o.ignore??[],c=e.ref([]),d=e.ref(null);(()=>{const b=o.parent&&n?.value?.[o.parent]||o.modelValue||{};c.value=Object.entries(b).filter(([y])=>!i.includes(y)).map(([y,h])=>({id:l("key-value-"),key:y,value:h}))})();function f(b){d.value=b}function v(b){if(d.value===null||d.value===b)return;const y=c.value.splice(d.value,1)[0];c.value.splice(b,0,y),d.value=null}const w=e.computed(()=>c.value.some(b=>b.key&&!b.value||!b.key&&b.value)),V=()=>{c.value.push({id:l("key-value-"),key:"",value:""})},k=b=>{c.value=c.value.filter(y=>y.id!==b)};return e.watch(c,b=>{const y={};b.forEach(E=>{E.key&&E.value!==void 0&&(y[E.key]=E.value)});const h={};i.length&&i.forEach(E=>{h[E]=o.parent?n?.value?.[o.parent]?.[E]:void 0}),n?.value&&o.parent&&(n.value[o.parent]={...h,...y}),a("update:modelValue",y)},{deep:!0}),(b,y)=>(e.openBlock(),e.createElementBlock("div",bi,[e.createElementVNode("div",xi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(h,E)=>(e.openBlock(),e.createElementBlock("div",{key:h.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===E}]),draggable:"true",onDragstart:g=>f(E),onDragover:y[0]||(y[0]=e.withModifiers(()=>{},["prevent"])),onDrop:g=>v(E)},[y[1]||(y[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",_i,[e.createVNode(Se,{modelValue:h.key,"onUpdate:modelValue":g=>h.key=g,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Ei,[e.createVNode(Se,{modelValue:h.value,"onUpdate:modelValue":g=>h.value=g,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:g=>k(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(rt),{height:"16",width:"16"})],8,vi)],42,wi))),128))],512),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Vi," Дані для відображення відсутні ")),e.createElementVNode("div",Bi,[e.createElementVNode("button",{type:"button",onClick:V,disabled:w.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(ye,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(r)),1)],8,Ci)])]))}}),[["__scopeId","data-v-a0f7fbfc"]]),Ni={class:"w-full"},Si={ref:"sortableContainer",class:"flex flex-col gap-1"},$i=["onDragstart","onDrop"],Mi=["disabled"],Ai={class:"flex-1"},Fi=["onClick","disabled"],Di={key:0,class:"text-[14px] text-gray-700"},Ii={class:"mt-2 w-full flex items-center"},Ti=["disabled"],ft=Z(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(s){const t=s,l=e.useModel(s,"modelValue"),n=e.ref([]),o=e.ref(null),a=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??""),i=e.computed(()=>t.addButtonText??"Додати");let c=!1;const d=b=>`${b}-${Math.random().toString(36).substring(2,15)}`,m=b=>{const y=b??l.value??[];n.value=y.map((h,E)=>({id:n.value[E]?.id??d("text-array"),value:h??""}))};m(),e.watch(()=>l.value,b=>{if(c){c=!1;return}m(b||[])},{deep:!0}),e.watch(n,b=>{c=!0,l.value=b.map(y=>y.value).filter(y=>y!=null&&y!=="")},{deep:!0});const f=e.computed(()=>a.value||n.value.some(b=>!b.value));function v(){f.value||(n.value=[...n.value,{id:d("text-array"),value:""}])}function w(b){a.value||(n.value=n.value.filter(y=>y.id!==b))}function V(b){a.value||(o.value=b)}function k(b){if(a.value||o.value===null||o.value===b)return;const y=[...n.value],[h]=y.splice(o.value,1);y.splice(b,0,h),n.value=y,o.value=null}return(b,y)=>(e.openBlock(),e.createElementBlock("div",Ni,[e.createElementVNode("div",Si,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(h,E)=>(e.openBlock(),e.createElementBlock("div",{key:h.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":o.value===E}]),draggable:"true",onDragstart:g=>V(E),onDragover:y[0]||(y[0]=e.withModifiers(()=>{},["prevent"])),onDrop:g=>k(E)},[e.createElementVNode("button",{class:"cursor-move",type:"button",disabled:a.value},y[1]||(y[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,Mi),e.createElementVNode("div",Ai,[b.inputType==="text"?(e.openBlock(),e.createBlock(Se,{key:0,modelValue:h.value,"onUpdate:modelValue":g=>h.value=g,disabled:a.value,placeholder:r.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),b.inputType==="tel"?(e.openBlock(),e.createBlock(pt,{key:1,modelValue:h.value,"onUpdate:modelValue":g=>h.value=g,disabled:a.value,placeholder:r.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),b.inputType==="email"?(e.openBlock(),e.createBlock(ut,{key:2,modelValue:h.value,"onUpdate:modelValue":g=>h.value=g,disabled:a.value,placeholder:r.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),b.inputType==="mask"?(e.openBlock(),e.createBlock(dt,{key:3,modelValue:h.value,"onUpdate:modelValue":g=>h.value=g,mask:b.mask,disabled:a.value,placeholder:r.value},null,8,["modelValue","onUpdate:modelValue","mask","disabled","placeholder"])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:g=>w(h.id),disabled:a.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(rt),{height:"16",width:"16"})],8,Fi)],42,$i))),128))],512),n.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Di," Дані для відображення відсутні ")),e.createElementVNode("div",Ii,[e.createElementVNode("button",{type:"button",onClick:v,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(ye,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(i.value),1)],8,Ti)])]))}}),[["__scopeId","data-v-66316a33"]]),Li={class:"flex items-center gap-2 w-full"},Oi=["disabled"],Ri=["disabled"],Wt=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(s,{emit:t}){const l=s,{inputClass:n}=ie(l.style),o=t,a=e.computed({get:()=>l.modelValue||"#000000",set:i=>o("update:modelValue",i)}),r=e.computed(()=>!!l.disabled);return(i,c)=>(e.openBlock(),e.createElementBlock("div",Li,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":c[0]||(c[0]=d=>a.value=d),disabled:r.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(n)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Oi),[[e.vModelText,a.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":c[1]||(c[1]=d=>a.value=d),disabled:r.value},null,8,Ri),[[e.vModelText,a.value]])]))}}),zi={class:"flex items-center gap-2 w-full"},ji=["min","max","step","disabled"],Ui=["disabled"],Yt=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(s,{emit:t}){const l=s,{inputClass:n}=ie(l.style),o=t,a=e.computed({get:()=>Number(l.modelValue??l.min),set:i=>o("update:modelValue",Number(i))}),r=e.computed(()=>!!l.disabled);return(i,c)=>(e.openBlock(),e.createElementBlock("div",zi,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>a.value=d),min:i.min,max:i.max,step:i.step,disabled:r.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[i.modelValue?"":"text-opacity-50",e.unref(n)].join(" ")])},null,10,ji),[[e.vModelText,a.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":c[1]||(c[1]=d=>a.value=d),disabled:r.value},null,8,Ui),[[e.vModelText,a.value]])]))}}),Pi={class:"flex items-center gap-2 w-full"},Hi={class:"relative flex-1"},Gi=["placeholder","disabled","onKeydown"],Ki=["disabled"],qi={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"},Zi={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"},Wi={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},Yi={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},Ji={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},Xi=["onClick"],Qi={key:0,class:"p-4 text-sm text-gray-500"},Jt=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(s,{emit:t}){const l=s,n=t,{inputClass:o}=ie(l.style),a=e.useModel(s,"modelValue"),r=e.computed({get:()=>a.value,set:y=>{a.value=y}}),i=e.ref(!1),c=e.ref([]),d=e.ref(!1),m=e.computed(()=>l.placeholder??""),f=e.computed(()=>!!l.disabled),v=e.inject("values");function w(){!f.value&&r.value.trim()&&V()}async function V(){const y=(r.value||"").trim();if(!y)return;let h=y;if(l.includes?.length&&v?.value){const g=l.includes.map(B=>v.value?.[B]).filter(Boolean);g.length&&(h=`${g.join(", ")}, ${y}`)}const E=l.api.replace("{{value}}",encodeURIComponent(h));i.value=!0;try{const B=await(await fetch(E)).json();c.value=Array.isArray(B)?B:[],d.value=!0}catch(g){console.error("Address search error:",g)}finally{i.value=!1}}function k(){d.value=!d.value}function b(y){if(!y)return;d.value=!1;const h=parseFloat(y.lat),g={type:"Point",coordinates:[parseFloat(y.lon),h]};l.geom&&v?.value&&(v.value[l.geom]=g),n("update:geom",g)}return(y,h)=>(e.openBlock(),e.createElementBlock("div",Pi,[e.createElementVNode("div",Hi,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":h[0]||(h[0]=E=>r.value=E),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":l.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:e.withKeys(e.withModifiers(w,["prevent"]),["enter"])},null,42,Gi),[[e.vModelText,r.value]]),c.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:k,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||!r.value?.trim()},[i.value?(e.openBlock(),e.createElementBlock("svg",Zi,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",qi,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,Ki),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[d.value?(e.openBlock(),e.createElementBlock("div",Wi,[e.createElementVNode("div",Yi,[e.createElementVNode("div",Ji,[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]=E=>d.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(c.value,(E,g)=>(e.openBlock(),e.createElementBlock("li",{key:g,onClick:B=>b(E),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString(E.display_name),9,Xi))),128))]),c.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Qi," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),Xt=(s="")=>`${s}${Math.floor(Math.random()*1e4)}`,ec={class:"vs-datalist space-y-3"},tc={class:"space-y-3"},lc=["onClick","disabled"],nc={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},oc=["disabled"],ac=Z(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(s){const t=s,l=e.useModel(s,"modelValue"),n=e.ref([]),o=e.computed(()=>t.schema?.map(V=>({...V,disabled:t.disabled||V.disabled}))??[]),a=e.computed(()=>o.value.map(V=>w(V))),r=e.computed(()=>t.disabled?!1:t.maxItems?l.value.length<t.maxItems:!0),i=e.computed(()=>t.disabled||l.value.length<=(t.minItems||0));e.watch(()=>l.value.length,()=>{c(),d()},{immediate:!0}),e.watch(()=>t.schema,d,{immediate:!0,deep:!0});function c(){const V=l.value.length;n.value.length<V?n.value=[...n.value,...Array.from({length:V-n.value.length},()=>Xt())]:n.value.length>V&&n.value.splice(V)}function d(){if(!t.minItems||l.value.length>=t.minItems)return;const V=t.minItems-l.value.length,k=Array.from({length:V},m);l.value=[...l.value,...k]}function m(){const V={};return o.value.forEach(k=>{V[k.name]=k?.default??null}),V}function f(){r.value&&(l.value=[...l.value,m()],c())}function v(V){i.value||(l.value=l.value.filter((k,b)=>b!==V),c(),d())}function w(V){return{...V}}return(V,k)=>(e.openBlock(),e.createElementBlock("div",ec,[e.createElementVNode("div",tc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(b,y)=>(e.openBlock(),e.createElementBlock("div",{key:n.value[y],class:"flex items-center gap-3"},[e.createVNode(be,{schema:a.value,layout:"inline",navigation:!1,values:l.value[y],"onUpdate:values":h=>l.value[y]=h,"form-id":n.value[y]},null,8,["schema","values","onUpdate:values","form-id"]),e.createElementVNode("button",{type:"button",class:"h-[38px] w-[38px] flex items-center justify-center text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",onClick:h=>v(y),disabled:i.value},[e.createVNode($e,{class:"w-5 h-5"})],8,lc)]))),128)),l.value.length===0?(e.openBlock(),e.createElementBlock("div",nc,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:!r.value},[e.createVNode(ye,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,oc)]))}}),[["__scopeId","data-v-a7a64a30"]]),sc={};function rc(s,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"},s.$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 ic=Z(sc,[["render",rc]]),cc={class:"vs-dataform space-y-4"},dc={class:"flex items-center justify-between mb-3"},uc={class:"text-sm font-medium text-gray-700"},pc={class:"flex items-center gap-2"},hc=["title","onClick","disabled"],mc=["title","onClick","disabled"],fc={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},gc=["disabled"],Qt={VsInputText:Se,VsInputRadio:ht,"vs-input-text":Se,"vs-input-password":Ol,"vs-input-textarea":jt,"vs-input-mask":dt,"vs-input-number":St,"vs-input-radio":ht,"vs-input-select":mt,"vs-input-switcher":it,"vs-input-static":ct,"vs-input-container":zt,"vs-input-date":Mt,"vs-input-checkbox":$t,"vs-input-file":Lt,"vs-input-html":ct,"vs-input-email":ut,"vs-input-tel":pt,"vs-input-datatable":Pt,"vs-input-map":Ht,"vs-input-file-list":Ot,"vs-input-tags":Gt,"vs-input-slug":Kt,"vs-input-codegen":qt,"vs-input-key-value":Zt,"vs-input-text[]":ft,"vs-input-range":Yt,"vs-input-color":Wt,"vs-input-native-select":mt,"vs-input-array":ft,"vs-input-address":Jt,"vs-input-datalist":ac,"vs-input-dataform":Z(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(s){const t=s,l=e.useModel(s,"modelValue"),n=e.ref([]),o=e.computed(()=>t.groupLabel),a=e.computed(()=>t.emptyLabel??"Ще немає груп"),r=e.computed(()=>t.schema?.map(y=>({...y,disabled:t.disabled||y.disabled}))??[]),i=e.computed(()=>r.value.map(y=>b(y))),c=e.computed(()=>t.disabled?!1:t.maxGroups?l.value.length<t.maxGroups:!0),d=e.computed(()=>t.disabled||l.value.length<=(t.minGroups||0));e.watch(()=>l.value.length,()=>{m(),f()},{immediate:!0}),e.watch(()=>t.schema,f,{immediate:!0,deep:!0});function m(){const y=l.value.length;n.value.length<y?n.value=[...n.value,...Array.from({length:y-n.value.length},()=>Xt())]:n.value.length>y&&n.value.splice(y)}function f(){if(!t.minGroups||l.value.length>=t.minGroups)return;const y=t.minGroups-l.value.length,h=Array.from({length:y},v);l.value=[...l.value,...h]}function v(){const y={};return r.value.forEach(h=>{y[h.name]=h?.default??null}),y}function w(){c.value&&(l.value=[...l.value,v()],m())}function V(y){d.value||(l.value=l.value.filter((h,E)=>E!==y),m(),f())}function k(y){if(t.disabled)return;const h=JSON.parse(JSON.stringify(l.value[y]??{}));l.value=[...l.value.slice(0,y+1),h,...l.value.slice(y+1)],m()}function b(y){return{...y}}return(y,h)=>(e.openBlock(),e.createElementBlock("div",cc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(E,g)=>(e.openBlock(),e.createElementBlock("div",{key:n.value[g],class:"relative border border-gray-200 rounded-lg p-6 bg-white"},[e.createElementVNode("div",dc,[e.createElementVNode("div",uc,e.toDisplayString(o.value),1),e.createElementVNode("div",pc,[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:B=>k(g),disabled:t.disabled},[e.createVNode(ic,{class:"w-5 h-5"})],8,hc),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:B=>V(g),disabled:d.value},[e.createVNode($e,{class:"w-5 h-5"})],8,mc)])]),e.createVNode(be,{class:"vs-dataform__form",schema:i.value,layout:"inline",navigation:!1,values:l.value[g],"onUpdate:values":B=>l.value[g]=B,"form-id":n.value[g],disabled:t.disabled},null,8,["schema","values","onUpdate:values","form-id","disabled"])]))),128)),l.value.length===0?(e.openBlock(),e.createElementBlock("div",fc,e.toDisplayString(a.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:w,disabled:!c.value},[e.createVNode(ye,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,gc)]))}}),[["__scopeId","data-v-4dc5a1a3"]])},kc=e.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(s){const t=s,l=e.inject("values");async function n(){try{if(!t.api)return;const o=t.api.replace("{{value}}",t.value),a=await fetch(o);if(!a.ok){ee.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const r=await a.json();if(!t.set||!l)return;for(const[i,c]of Object.entries(t.set))l.value[i]=r.result[c]}catch(o){console.error(t.error,o)}}return(o,a)=>(e.openBlock(),e.createElementBlock("button",{onClick:n,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))}}),yc={class:"flex flex-col gap-1 w-full"},bc={key:0,class:"text-sm text-gray-500"},el=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(s,{emit:t}){const l=s,n=e.useModel(s,"modelValue"),o=t,a=e.computed(()=>Tl[`${l.layout}`]),r=e.computed(()=>Qt?.[`vs-input-${l.item.type}`]),i=e.computed(()=>{const m=e.unref(r);if(!m)return new Set;const f=m.props??m.__vccOpts?.props;if(!f)return new Set;const v=Array.isArray(f)?f:Object.keys(f);return new Set(v)}),c=e.computed(()=>{const m=l.item??{},f=i.value;return f.size?Object.fromEntries(Object.entries(m).filter(([v])=>f.has(v))):{}}),d=m=>{const f=typeof m=="object"&&m!==null?m:{value:m};o("value-selected",{...f,name:f.name??l.item?.name})};return(m,f)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),{ua:l.item.ua,error:l.error||"",item:m.item,columns:l.columns,label:l.item.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${l.item.type}-component`])},[e.createElementVNode("div",yc,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),e.mergeProps(c.value,{modelValue:n.value,"onUpdate:modelValue":f[0]||(f[0]=v=>n.value=v),onValueSelected:d}),null,16,["modelValue"])),m.item.description&&l.layout!=="settings"?(e.openBlock(),e.createElementBlock("p",bc,e.toDisplayString(m.item.description),1)):e.createCommentVNode("",!0)]),m.item.behavior?.api&&m.item.behavior?.button?(e.openBlock(),e.createBlock(kc,e.mergeProps({key:0},m.item.behavior,{value:n.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),xc={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},wc={class:"vs-compact-form-navigation__rail mt-[6px]"},_c=["onClick"],Ec=Z(e.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(s,{expose:t}){const l=s,n=e.ref([]),o=e.ref(""),a=e.ref(""),r=e.computed(()=>!!l.enabled),i=e.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),c=e.computed(()=>{const F=l.width;if(F==null)return{};const X=typeof F=="number"?`${F}px`:`${F}`;return{width:X,minWidth:X}});let d=null,m=0,f=0,v=null,w=null,V=null;const k=()=>R(),b=()=>h();e.watch(()=>l.target,async F=>{if(M(),!F){v=null,n.value=[],o.value="";return}v=F,r.value&&(await e.nextTick(),B(F),h())},{immediate:!0}),e.watch(()=>l.scrollContainer,F=>{if(!r.value){w=F??null;return}y(F??null),e.nextTick(()=>h())},{immediate:!0}),e.onMounted(()=>{l.scrollContainer||y(null),h()}),e.onBeforeUnmount(()=>{M(),y(null,!0),v=null,typeof window<"u"&&(m&&window.cancelAnimationFrame(m),f&&window.cancelAnimationFrame(f))});function y(F,X=!1){if(V&&(V(),V=null),X){w=null;return}if(w=F??null,typeof window>"u")return;const K=F??window,Q=window;K.addEventListener("scroll",k,{passive:!0}),Q.addEventListener("resize",b),V=()=>{K.removeEventListener("scroll",k),Q.removeEventListener("resize",b)}}function h(){if(!r.value||!v)return;m&&typeof window<"u"&&window.cancelAnimationFrame(m);const F=()=>{E(),m=0};typeof window>"u"?F():m=window.requestAnimationFrame(F)}function E(){if(!r.value||!v)return;const F=Array.from(v.querySelectorAll("h1, h2")),X=new Set,K=[];F.forEach((Q,z)=>{const L=Q.textContent?.trim()??"";if(!L)return;let I=(Q.getAttribute("id")??"").trim();I||(I=g(L)||`heading-${z+1}`);let U=I,J=1;for(;X.has(U);)U=`${I}-${J+=1}`;Q.id!==U&&Object.assign(Q,{id:U}),X.add(U),K.push({id:U,text:L,level:Q.tagName.toLowerCase()==="h1"?1:2})}),n.value=K,K.length||(o.value=""),T()}function g(F){return F.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function B(F){!F||!r.value||typeof MutationObserver>"u"||(M(),d=new MutationObserver(()=>h()),d.observe(F,{childList:!0,subtree:!0}))}function M(){d&&(d.disconnect(),d=null)}function S(F){const X=w;if(!X)return typeof window>"u"?F.offsetTop:F.getBoundingClientRect().top+window.scrollY;const K=F.getBoundingClientRect(),Q=X.getBoundingClientRect();return K.top-Q.top+X.scrollTop}function T(){if(!r.value||!n.value.length)return;const F=w,X=(F?F.scrollTop:null)||(typeof window<"u"?window.scrollY:0),K=(F?F.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),Q=X+K;let z=null;for(let I=0;I<n.value.length;I+=1){const U=n.value[I],J=document.getElementById(U.id);if(J){const re=S(J);re+J.offsetHeight>X&&re<Q&&(z=U.id)}}!z&&a.value&&(z=a.value),z&&(a.value=z);const L=F?F.scrollHeight-F.clientHeight:document.documentElement.scrollHeight-window.innerHeight;X+5>=L&&(z=n.value[n.value.length-1].id),z&&(o.value=z)}function R(){r.value&&(f&&window.cancelAnimationFrame(f),f=window.requestAnimationFrame(()=>{T(),f=0}))}function P(F){if(!r.value)return;const X=document.getElementById(F);if(!X)return;const K=w,Q=Math.max(0,S(X));K?K.scrollTo({top:Q,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:Q,behavior:"smooth"})}return t({refresh:h}),(F,X)=>r.value&&n.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(c.value)},[e.createElementVNode("h2",xc,e.toDisplayString(F.title),1),e.createElementVNode("div",wc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.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,_c)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-1584a562"]]),Te={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон"},vc=s=>typeof s=="string"?s.trim()?!1:Te.required:Array.isArray(s)?s.map(l=>typeof l=="string"?l.trim():l).filter(l=>l!=null&&l!=="").length?!1:Te.required:s?!1:Te.required,Vc=s=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return s?t.test(s)?!1:Te.email:!1},Bc=s=>{const t=/^\+[1-9]\d{1,14}$/;return s?t.test(s)?!1:Te.tel:!1},Cc=(s,t)=>{const l=t.pattern??t.regexp,n=typeof l=="string"?new RegExp(l):l;if(Array.isArray(s)){const o=s.filter(Boolean);return o.length===0||o.every(a=>n.test(a))?!1:t.message}return!n.test(s)&&s?t.message:!1},Nc=(s,t)=>!1,Sc=(s,t)=>{switch(typeof t=="string"?t:t.type){case"required":return vc(s);case"email":return Vc(s);case"tel":return Bc(s);case"regexp":return Cc(s,t);case"custom":return Nc();default:return!1}},$c={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function tl(s){const t=s?.toLowerCase();return $c[t]||t}function gt(s,t=!1){if(Array.isArray(s)){const n=[];return s.forEach(o=>{const a={...o};a.name=(o.name||o.id||o.key||"").toString(),a.type=tl(o.type),a.label=o.label||o.ua,a.rules=o.rules||o.validators,a.type==="email"&&!a.rules&&(a.rules=["email"]),o.data&&(a.api=`/api/suggest/${o.data}`),a.disabled=a.disabled||t,Array.isArray(a.schema)&&(a.schema=gt(a.schema,a.disabled)),n.push(a)}),n}const l=[];return Object.entries(s).forEach(n=>{const o={name:n[0],...n[1],type:tl(n[1].type),label:n[1].label||n[1].ua,rules:n[1].rules||n[1].validators,disabled:n[1].disabled||t};o.type==="email"&&!o.rules&&(o.rules=["email"]),n[1].type?.includes("list")&&(o.multiple=!0),!o.api&&n[1].data&&(o.api=`/api/suggest/${n[1].data}`),Array.isArray(o.schema)&&(o.schema=gt(o.schema,o.disabled)),l.push(o)}),l}function Mc(s,t,l=!1){const n=e.computed(()=>gt((Array.isArray(t),t),typeof l=="boolean"?l:l.value)),o=e.ref({});function a(d){const m=d?.conditions;if(!m)return!0;const f=Array.isArray(m)?m[0]:m,v=s?.value?.[f];return Rt(v,m)}const r=(d=n.value,m=!0)=>(d.forEach(f=>{if(f.rules){if(!a(f)){delete o.value[f.name];return}let v=!1,w=null;f.rules.forEach(V=>{const k=Sc(s.value[f.name],V);k&&(v=!0,!w&&typeof k=="string"&&(w=k))}),v&&w?o.value[f.name]=w:delete o.value[f.name]}f.schema&&r(f.schema,!1)}),m&&Object.values(o.value).some(Boolean)?o.value:null),i=e.computed(()=>n.value?.filter(d=>d.hidden!==!0&&a(d)));return{errors:o,validate:r,reset:()=>{s.value={},o.value={}},visibleSchema:i}}const Ac={class:"flex w-full h-full min-h-0 gap-6"},Fc={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},be=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(s,{expose:t,emit:l}){const n=l,o=s,a=e.useModel(s,"form"),r=e.useModel(s,"values"),{errors:i,validate:c,reset:d,visibleSchema:m}=Mc(r,o.schema,e.toRef(o,"disabled")),f=e.ref(null),v=e.ref(null),w=e.computed(()=>o.navigation),V=e.computed(()=>o.navWidth),k=e.computed(()=>o.style?.columns),b=Object.freeze({container:12,label:3}),y=e.computed(()=>o.columns??k.value??b),h=e.computed(()=>o.columns!=null||k.value!=null),E=e.computed(()=>h.value?"horizontal":o.layout),g=R=>R?.columns?"horizontal":E.value,B=R=>R?.columns??y.value,M=()=>{n("update:modelValue",r.value),c(),n("handle-submit",r.value)},S=R=>{n("value-selected",R)};t({validate:c,reset:d,errors:i}),e.onMounted(()=>{o.modelValue&&(r.value=o.modelValue),a.value={value:r.value,errors:i.value,reset:d,validate:c,formId:o.formId}});function T(R,P){if(R===P)return!0;if(typeof R!="object"||typeof P!="object"||!R||!P)return!1;const F=Object.keys(R),X=Object.keys(P);return F.length!==X.length?!1:F.every(K=>R[K]===P[K])}return e.provide("form",a),e.provide("values",r),(R,P)=>(e.openBlock(),e.createElementBlock("div",Ac,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:v},[e.createElementVNode("form",{ref_key:"formRef",ref:f,onSubmit:e.withModifiers(M,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",E.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m),(F,X)=>(e.openBlock(),e.createElementBlock("div",{key:F.name,class:e.normalizeClass(g(F)==="horizontal"?"col-span-12":`col-span-${F.col||12}`)},[e.createVNode(el,{style:e.normalizeStyle(R.style),item:F,layout:g(F),columns:B(F),"model-value":r.value[F.name],"onUpdate:modelValue":K=>{const Q=r.value[F.name];T(Q,K)||(r.value[F.name]=K)},error:e.unref(i)[F.name],onValueSelected:S},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),g(F)==="settings"&&X+1!==e.unref(m).length?(e.openBlock(),e.createElementBlock("div",Fc)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(Ec,{target:f.value,"scroll-container":v.value,enabled:w.value,width:V.value},null,8,["target","scroll-container","enabled","width"])]))}}),Dc={class:"relative"},Ic={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},Tc={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"},Lc={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},Oc={class:"font-medium text-gray-800 dark:text-[#ffffff]"},Rc={class:"p-4 mim-h-0 h-full overflow-auto"},ll=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(s,{emit:t}){const l=s,n=t,o=e.ref(l.schema),a=e.ref(l.defaultValue?JSON.parse(JSON.stringify(l.defaultValue)):{}),r=e.ref({}),i=e.ref(l.token||""),c=e.ref(l.mode);async function d(){const f=r.value.validate();if(f){ee.notify({type:"warning",title:"Помилка валідації",message:Object.entries(f).map(([v,w])=>`${v}: ${w}`).join(`
|
|
3
|
+
`)});return}if(i.value)try{const v=await fetch(`/api/table/${i.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a.value)});if(v.ok)await v.json(),ee.notify({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`}),n("save",a.value);else if(v.status===400){const w=await v.json().catch(()=>({}));ee.notify({type:"warning",title:"Помилка валідації",message:w.message||"Некоректні дані (400)"})}else v.status===500?ee.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):ee.notify({type:"error",title:"Помилка",message:`Статус: ${v.status}`})}catch(v){ee.notify({type:"error",title:"Помилка з’єднання",message:v.message||"Не вдалося виконати запит"})}}function m(){n("close")}return e.onMounted(async()=>{try{if(l.form&&!l.schema){const f=await fetch(`/api/template/form/${l.form}`);if(!f.ok){ee.notify({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const v=await f.json();o.value=v.schema,i.value=v.token}else if(l.token&&!l.defaultValue){i.value=l.token;const f=await fetch(`/api/form/${i.value}`);if(!f.ok){ee.notify({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const v=await f.json();o.value=v.schema,v.data?a.value=v.data:c.value="add",v.obj&&(a.value={...a.value,...v.obj})}}catch(f){ee.notify({type:"error",title:"Error",message:f.message||"Unexpected error"}),console.error(f)}}),(f,v)=>(e.openBlock(),e.createElementBlock("div",Dc,[e.createElementVNode("div",Ic,[e.createElementVNode("div",Tc,[e.createElementVNode("div",Lc,[e.createElementVNode("h3",Oc,e.toDisplayString(c.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"},v[2]||(v[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",Rc,[o.value?(e.openBlock(),e.createBlock(be,{key:0,schema:o.value,values:a.value,"onUpdate:values":v[0]||(v[0]=w=>a.value=w),form:r.value,"onUpdate:form":v[1]||(v[1]=w=>r.value=w)},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:d,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"}," Зберегти ")])])])]))}}),zc=["placeholder","disabled","name"],jc=["type","value","onInput","placeholder","disabled"],Uc=["onClick"],Pc=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(s){const t=s,l=e.ref(t.count),n=e.computed(()=>t.limit),{inputClass:o}=ie(t.style),a=e.useModel(s,"modelValue"),r=e.computed(()=>!!t.disabled),i=e.computed(()=>t.placeholder??"");e.watchEffect(()=>{const k=a.value?.length??0;k<l.value&&(a.value=[...a.value??[],...Array(l.value-k)])});const c=e.ref({}),d=e.ref({});function m(k,b){k&&(c.value[b]=k)}async function f(k,b){if(!k||t.inputType!=="mask")return;const{default:y}=await Promise.resolve().then(()=>gl);d.value[b]&&d.value[b].destroy(),d.value[b]=y(k,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),d.value[b].on("accept",()=>{const h=[...a.value||[]];h[b]=t.unmask?d.value[b].unmaskedValue:d.value[b].value,a.value=h}),d.value[b].on("complete",()=>{const h=[...a.value||[]];h[b]=t.unmask?d.value[b].unmaskedValue:d.value[b].value,a.value=h}),a.value?.[b]&&(d.value[b].value=a.value[b])}function v(k,b){if(r.value)return;const y=k.target.value??null,h=[...a.value];h[b]=t.inputType==="text"?y:Number(y),a.value=h}function w(){l.value+=1;const k=t.inputType==="text"||t.inputType==="mask"?null:0;a.value=[...a.value,k],t.inputType==="mask"&&setTimeout(()=>{const b=l.value-1;c.value[b]&&f(c.value[b],b)},0)}function V(k){if(l.value>1){d.value[k]&&(d.value[k].destroy(),delete d.value[k]),l.value-=1,a.value=a.value.filter((y,h)=>h!==k);const b={};Object.keys(d.value).forEach(y=>{const h=parseInt(y,10);h>k?b[h-1]=d.value[h]:h<k&&(b[h]=d.value[h])}),d.value=b}}return e.onMounted(()=>{if(t.inputType==="mask")for(let k=0;k<l.value;k+=1)c.value[k]&&f(c.value[k],k)}),e.onBeforeUnmount(()=>{Object.values(d.value).forEach(k=>{k&&k.destroy()})}),e.watch(()=>t.mask,k=>{t.inputType==="mask"&&Object.values(d.value).forEach(b=>{b&&b.updateOptions({mask:k,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})})}),e.watch(a,k=>{t.inputType==="mask"&&k&&k.forEach((b,y)=>{d.value[y]&&d.value[y].value!==b&&(d.value[y].value=b||"")})},{deep:!0}),(k,b)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["grid gap-2",`grid-cols-${n.value}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,y=>(e.openBlock(),e.createElementBlock("div",{key:y,class:"flex items-center gap-2 w-full"},[k.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:h=>m(h,y-1),placeholder:k.placeholder,disabled:k.disabled,name:`${k.name}[${y-1}]`,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":k.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,zc)):(e.openBlock(),e.createElementBlock("input",{key:1,type:k.inputType,value:a.value?.[y-1],onInput:h=>v(h,y-1),placeholder:i.value,disabled:r.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":k.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,jc)),!k.disabled&&y===l.value&&k.isAdded?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:e.withModifiers(w,["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(ye,{height:"18",width:"18"})])):e.createCommentVNode("",!0),!k.disabled&&l.value>1&&k.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(h=>V(y-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(rt,{height:"18",width:"18"})],8,Uc)):e.createCommentVNode("",!0)]))),128))],2))}}),nl=(s={mode:"edit",schema:null})=>new Promise(t=>{const{close:l}=ee.modal({title:s.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:ll,contentProps:{...s,onClose:()=>{t(null),l()},onSave:n=>{t(n),l()}}})});be.install=function(t){t.component("VForm",be),Object.assign(t.config.globalProperties,{$form:nl}),t.provide("form",nl),window.v3plugin||(window.v3plugin={})};function _e(s){return typeof s=="string"||s instanceof String}function ol(s){var t;return typeof s=="object"&&s!=null&&(s==null||(t=s.constructor)==null?void 0:t.name)==="Object"}function al(s,t){return Array.isArray(t)?al(s,(l,n)=>t.includes(n)):Object.entries(s).reduce((l,n)=>{let[o,a]=n;return t(a,o)&&(l[o]=a),l},{})}const O={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function sl(s){switch(s){case O.LEFT:return O.FORCE_LEFT;case O.RIGHT:return O.FORCE_RIGHT;default:return s}}function kt(s){return s.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function qe(s,t){if(t===s)return!0;const l=Array.isArray(t),n=Array.isArray(s);let o;if(l&&n){if(t.length!=s.length)return!1;for(o=0;o<t.length;o++)if(!qe(t[o],s[o]))return!1;return!0}if(l!=n)return!1;if(t&&s&&typeof t=="object"&&typeof s=="object"){const a=t instanceof Date,r=s instanceof Date;if(a&&r)return t.getTime()==s.getTime();if(a!=r)return!1;const i=t instanceof RegExp,c=s instanceof RegExp;if(i&&c)return t.toString()==s.toString();if(i!=c)return!1;const d=Object.keys(t);for(o=0;o<d.length;o++)if(!Object.prototype.hasOwnProperty.call(s,d[o]))return!1;for(o=0;o<d.length;o++)if(!qe(s[d[o]],t[d[o]]))return!1;return!0}else if(t&&s&&typeof t=="function"&&typeof s=="function")return t.toString()===s.toString();return!1}class Hc{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?O.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?O.RIGHT:O.LEFT}}function G(s,t){return new G.InputMask(s,t)}function rl(s){if(s==null)throw new Error("mask property should be defined");return s instanceof RegExp?G.MaskedRegExp:_e(s)?G.MaskedPattern:s===Date?G.MaskedDate:s===Number?G.MaskedNumber:Array.isArray(s)||s===Array?G.MaskedDynamic:G.Masked&&s.prototype instanceof G.Masked?s:G.Masked&&s instanceof G.Masked?s.constructor:s instanceof Function?G.MaskedFunction:(console.warn("Mask not found for mask",s),G.Masked)}function Me(s){if(!s)throw new Error("Options in not defined");if(G.Masked){if(s.prototype instanceof G.Masked)return{mask:s};const{mask:t=void 0,...l}=s instanceof G.Masked?{mask:s}:ol(s)&&s.mask instanceof G.Masked?s:{};if(t){const n=t.mask;return{...al(t,(o,a)=>!a.startsWith("_")),mask:t.constructor,_mask:n,...l}}}return ol(s)?{...s}:{mask:s}}function me(s){if(G.Masked&&s instanceof G.Masked)return s;const t=Me(s),l=rl(t.mask);if(!l)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===l&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new l(t)}G.createMask=me;class Ze{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,l){if(!(t==null||l==null||t===this.selectionStart&&l===this.selectionEnd))try{this._unsafeSelect(t,l)}catch{}}get isActive(){return!1}}G.MaskElement=Ze;const il=90,Gc=89;class Le extends Ze{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,l,n;return(t=(l=(n=this.input).getRootNode)==null?void 0:l.call(n))!=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===il&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===Gc&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===il&&(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={}}}G.HTMLMaskElement=Le;class cl extends Le{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,l){this.input.setSelectionRange(t,l)}get value(){return this.input.value}set value(t){this.input.value=t}}G.HTMLMaskElement=Le;class yt extends Le{get _unsafeSelectionStart(){const t=this.rootElement,l=t.getSelection&&t.getSelection(),n=l&&l.anchorOffset,o=l&&l.focusOffset;return o==null||n==null||n<o?n:o}get _unsafeSelectionEnd(){const t=this.rootElement,l=t.getSelection&&t.getSelection(),n=l&&l.anchorOffset,o=l&&l.focusOffset;return o==null||n==null||n>o?n:o}_unsafeSelect(t,l){if(!this.rootElement.createRange)return;const n=this.rootElement.createRange();n.setStart(this.input.firstChild||this.input,t),n.setEnd(this.input.lastChild||this.input,l);const o=this.rootElement,a=o.getSelection&&o.getSelection();a&&(a.removeAllRanges(),a.addRange(n))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}G.HTMLContenteditableMaskElement=yt;class We{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>We.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}}We.MAX_LENGTH=100;class dl{constructor(t,l){this.el=t instanceof Ze?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new yt(t):new cl(t),this.masked=me(l),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new We,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 l;return t==null||((l=this.masked)==null?void 0:l.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof G.Masked)&&this.masked.constructor===rl(t)){this.masked.updateOptions({mask:t});return}const l=t instanceof G.Masked?t:me({mask:t});l.unmaskedValue=this.masked.unmaskedValue,this.masked=l}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,l){const n=this._listeners[t];n&&n.forEach(o=>o(l))}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 l=this.masked.unmaskedValue,n=this.masked.value,o=this.masked.rawInputValue,a=this.displayValue,r=this.unmaskedValue!==l||this.value!==n||this._rawInputValue!==o;this._unmaskedValue=l,this._value=n,this._rawInputValue=o,this.el.value!==a&&(this.el.value=a),t==="auto"?this.alignCursor():t!=null&&(this.cursorPos=t),r&&this._fireChangeEvents(),!this._historyChanging&&(r||this.history.isEmpty)&&this.history.push({unmaskedValue:l,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:l,...n}=t,o=!this.maskEquals(l),a=this.masked.optionsIsChanged(n);o&&(this.mask=l),a&&this.masked.updateOptions(n),(o||a)&&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,O.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,l){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(l),this}off(t,l){if(!this._listeners[t])return this;if(!l)return delete this._listeners[t],this;const n=this._listeners[t].indexOf(l);return n>=0&&this._listeners[t].splice(n,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const l=new Hc({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),n=this.masked.rawInputValue,o=this.masked.splice(l.startChangePos,l.removed.length,l.inserted,l.removeDirection,{input:!0,raw:!0}).offset,a=n===this.masked.rawInputValue?l.removeDirection:O.NONE;let r=this.masked.nearestInputPos(l.startChangePos+o,a);a!==O.NONE&&(r=this.masked.nearestInputPos(r,O.NONE)),this.updateControl(r),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}}G.InputMask=dl;class q{static normalize(t){return Array.isArray(t)?t:[t,new q]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}G.ChangeDetails=q;class fe{constructor(t,l,n){t===void 0&&(t=""),l===void 0&&(l=0),this.value=t,this.from=l,this.stop=n}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 l=this.value[0];return this.value=this.value.slice(1),l}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class ne{constructor(t){this._value="",this._update({...ne.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,l){l===void 0&&(l={input:!0}),this.reset(),this.append(t,l,""),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,l){return t}totalInputPositions(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),Math.min(this.displayValue.length,l-t)}extractInput(t,l,n){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),this.displayValue.slice(t,l)}extractTail(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),new fe(this.extractInput(t,l),t)}appendTail(t){return _e(t)&&(t=new fe(String(t))),t.appendTo(this)}_appendCharRaw(t,l){return t?(this._value+=t,new q({inserted:t,rawInserted:t})):new q}_appendChar(t,l,n){l===void 0&&(l={});const o=this.state;let a;if([t,a]=this.doPrepareChar(t,l),t&&(a=a.aggregate(this._appendCharRaw(t,l)),!a.rawInserted&&this.autofix==="pad")){const r=this.state;this.state=o;let i=this.pad(l);const c=this._appendCharRaw(t,l);i=i.aggregate(c),c.rawInserted||i.equals(a)?a=i:this.state=r}if(a.inserted){let r,i=this.doValidate(l)!==!1;if(i&&n!=null){const c=this.state;if(this.overwrite===!0){r=n.state;for(let m=0;m<a.rawInserted.length;++m)n.unshift(this.displayValue.length-a.tailShift)}let d=this.appendTail(n);if(i=d.rawInserted.length===n.toString().length,!(i&&d.inserted)&&this.overwrite==="shift"){this.state=c,r=n.state;for(let m=0;m<a.rawInserted.length;++m)n.shift();d=this.appendTail(n),i=d.rawInserted.length===n.toString().length}i&&d.inserted&&(this.state=c)}i||(a=new q,this.state=o,n&&r&&(n.state=r))}return a}_appendPlaceholder(){return new q}_appendEager(){return new q}append(t,l,n){if(!_e(t))throw new Error("value should be string");const o=_e(n)?new fe(String(n)):n;l!=null&&l.tail&&(l._beforeTailState=this.state);let a;[t,a]=this.doPrepare(t,l);for(let r=0;r<t.length;++r){const i=this._appendChar(t[r],l,o);if(!i.rawInserted&&!this.doSkipInvalid(t[r],l,o))break;a.aggregate(i)}return(this.eager===!0||this.eager==="append")&&l!=null&&l.input&&t&&a.aggregate(this._appendEager()),o!=null&&(a.tailShift+=this.appendTail(o).tailShift),a}remove(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(l),new q}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const l=this.rawInputValue,n=this.value,o=t();return this.rawInputValue=l,this.value&&this.value!==n&&n.indexOf(this.value)===0&&(this.append(n.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,o}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const l=this.state,n=t(this);return this.state=l,delete this._isolated,n}doSkipInvalid(t,l,n){return!!this.skipInvalid}doPrepare(t,l){return l===void 0&&(l={}),q.normalize(this.prepare?this.prepare(t,this,l):t)}doPrepareChar(t,l){return l===void 0&&(l={}),q.normalize(this.prepareChar?this.prepareChar(t,this,l):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,l,n,o,a){n===void 0&&(n=""),o===void 0&&(o=O.NONE),a===void 0&&(a={input:!0});const r=t+l,i=this.extractTail(r),c=this.eager===!0||this.eager==="remove";let d;c&&(o=sl(o),d=this.extractInput(0,r,{raw:!0}));let m=t;const f=new q;if(o!==O.NONE&&(m=this.nearestInputPos(t,l>1&&t!==0&&!c?O.NONE:o),f.tailShift=m-t),f.aggregate(this.remove(m)),c&&o!==O.NONE&&d===this.rawInputValue)if(o===O.FORCE_LEFT){let v;for(;d===this.rawInputValue&&(v=this.displayValue.length);)f.aggregate(new q({tailShift:-1})).aggregate(this.remove(v-1))}else o===O.FORCE_RIGHT&&i.unshift();return f.aggregate(this.append(n,a,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!qe(this,t)}typedValueEquals(t){const l=this.typedValue;return t===l||ne.EMPTY_VALUES.includes(t)&&ne.EMPTY_VALUES.includes(l)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new q}}ne.DEFAULTS={skipInvalid:!0},ne.EMPTY_VALUES=[void 0,null,""],G.Masked=ne;class Ee{constructor(t,l){t===void 0&&(t=[]),l===void 0&&(l=0),this.chunks=t,this.from=l}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=_e(t)?new fe(String(t)):t;const l=this.chunks[this.chunks.length-1],n=l&&(l.stop===t.stop||t.stop==null)&&t.from===l.from+l.toString().length;if(t instanceof fe)n?l.extend(t.toString()):this.chunks.push(t);else if(t instanceof Ee){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 G.MaskedPattern))return new fe(this.toString()).appendTo(t);const l=new q;for(let n=0;n<this.chunks.length;++n){const o=this.chunks[n],a=t._mapPosToBlock(t.displayValue.length),r=o.stop;let i;if(r!=null&&(!a||a.index<=r)&&((o instanceof Ee||t._stops.indexOf(r)>=0)&&l.aggregate(t._appendPlaceholder(r)),i=o instanceof Ee&&t._blocks[r]),i){const c=i.appendTail(o);l.aggregate(c);const d=o.toString().slice(c.rawInserted.length);d&&l.aggregate(t.append(d,{tail:!0}))}else l.aggregate(t.append(o.toString(),{tail:!0}))}return l}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:l,...n}=t;Object.assign(this,n),this.chunks=l.map(o=>{const a="chunks"in o?new Ee:new fe;return a.state=o,a})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const l=t!=null?t-this.from:t;let n=0;for(;n<this.chunks.length;){const o=this.chunks[n],a=o.unshift(l);if(o.toString()){if(!a)break;++n}else this.chunks.splice(n,1);if(a)return a}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const l=this.chunks[t],n=l.shift();if(l.toString()){if(!n)break;--t}else this.chunks.splice(t,1);if(n)return n}return""}}class Kc{constructor(t,l){this.masked=t,this._log=[];const{offset:n,index:o}=t._mapPosToBlock(l)||(l<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=n,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=((l=this.block)==null?void 0:l.displayValue.length)||0){var l;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,O.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,O.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,O.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,O.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,O.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,O.NONE),!0})}}class bt{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,l){return t===void 0&&(t=0),l===void 0&&(l=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(l),this._value||(this._isRawInput=!1),new q}nearestInputPos(t,l){l===void 0&&(l=O.NONE);const n=0,o=this._value.length;switch(l){case O.LEFT:case O.FORCE_LEFT:return n;case O.NONE:case O.RIGHT:case O.FORCE_RIGHT:default:return o}}totalInputPositions(t,l){return t===void 0&&(t=0),l===void 0&&(l=this._value.length),this._isRawInput?l-t:0}extractInput(t,l,n){return t===void 0&&(t=0),l===void 0&&(l=this._value.length),n===void 0&&(n={}),n.raw&&this._isRawInput&&this._value.slice(t,l)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,l){if(l===void 0&&(l={}),this.isFilled)return new q;const n=this.eager===!0||this.eager==="append",a=this.char===t&&(this.isUnmasking||l.input||l.raw)&&(!l.raw||!n)&&!l.tail,r=new q({inserted:this.char,rawInserted:a?this.char:""});return this._value=this.char,this._isRawInput=a&&(l.raw||l.input),r}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new q;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new fe("")}appendTail(t){return _e(t)&&(t=new fe(String(t))),t.appendTo(this)}append(t,l,n){const o=this._appendChar(t[0],l);return n!=null&&(o.tailShift+=this.appendTail(n).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 Oe{constructor(t){const{parent:l,isOptional:n,placeholderChar:o,displayChar:a,lazy:r,eager:i,...c}=t;this.masked=me(c),Object.assign(this,{parent:l,isOptional:n,placeholderChar:o,displayChar:a,lazy:r,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.value.length),t===0&&l>=1?(this.isFilled=!1,this.masked.remove(t,l)):new q}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(t,l){if(l===void 0&&(l={}),this.isFilled)return new q;const n=this.masked.state;let o=this.masked._appendChar(t,this.currentMaskFlags(l));return o.inserted&&this.doValidate(l)===!1&&(o=new q,this.masked.state=n),!o.inserted&&!this.isOptional&&!this.lazy&&!l.input&&(o.inserted=this.placeholderChar),o.skip=!o.inserted&&!this.isOptional,this.isFilled=!!o.inserted,o}append(t,l,n){return this.masked.append(t,this.currentMaskFlags(l),n)}_appendPlaceholder(){return this.isFilled||this.isOptional?new q:(this.isFilled=!0,new q({inserted:this.placeholderChar}))}_appendEager(){return new q}extractTail(t,l){return this.masked.extractTail(t,l)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,l,n){return t===void 0&&(t=0),l===void 0&&(l=this.value.length),this.masked.extractInput(t,l,n)}nearestInputPos(t,l){l===void 0&&(l=O.NONE);const n=0,o=this.value.length,a=Math.min(Math.max(t,n),o);switch(l){case O.LEFT:case O.FORCE_LEFT:return this.isComplete?a:n;case O.RIGHT:case O.FORCE_RIGHT:return this.isComplete?a:o;case O.NONE:default:return a}}totalInputPositions(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.value.length),this.value.slice(t,l).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 l;return{...t,_beforeTailState:(t==null||(l=t._beforeTailState)==null?void 0:l.masked)||t?._beforeTailState}}pad(t){return new q}}Oe.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 ul extends ne{updateOptions(t){super.updateOptions(t)}_update(t){const l=t.mask;l&&(t.validate=n=>n.search(l)>=0),super._update(t)}}G.MaskedRegExp=ul;class oe extends ne{constructor(t){super({...oe.DEFAULTS,...t,definitions:Object.assign({},Oe.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 l=this.mask;if(!l||!t)return;let n=!1,o=!1;for(let a=0;a<l.length;++a){if(this.blocks){const d=l.slice(a),m=Object.keys(this.blocks).filter(v=>d.indexOf(v)===0);m.sort((v,w)=>w.length-v.length);const f=m[0];if(f){const{expose:v,repeat:w,...V}=Me(this.blocks[f]),k={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...V,repeat:w,parent:this},b=w!=null?new G.RepeatBlock(k):me(k);b&&(this._blocks.push(b),v&&(this.exposeBlock=b),this._maskedBlocks[f]||(this._maskedBlocks[f]=[]),this._maskedBlocks[f].push(this._blocks.length-1)),a+=f.length-1;continue}}let r=l[a],i=r in t;if(r===oe.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(r==="{"||r==="}"){n=!n;continue}if(r==="["||r==="]"){o=!o;continue}if(r===oe.ESCAPE_CHAR){if(++a,r=l[a],!r)break;i=!1}const c=i?new Oe({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...Me(t[r]),parent:this}):new bt({char:r,eager:this.eager,isUnmasking:n});this._blocks.push(c)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:l,...n}=t;this._blocks.forEach((o,a)=>o.state=l[a]),super.state=n}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,l)=>t+=l.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const l=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(l),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,l)=>t+=l.value,"")}set value(t){if(this.exposeBlock){const l=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(l),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const l=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(l),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,l)=>t+=l.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const l=new q;let n=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(n==null)return l;this._blocks[n].isFilled&&++n;for(let o=n;o<this._blocks.length;++o){const a=this._blocks[o]._appendEager();if(!a.inserted)break;l.aggregate(a)}return l}_appendCharRaw(t,l){l===void 0&&(l={});const n=this._mapPosToBlock(this.displayValue.length),o=new q;if(!n)return o;for(let r=n.index,i;i=this._blocks[r];++r){var a;const c=i._appendChar(t,{...l,_beforeTailState:(a=l._beforeTailState)==null||(a=a._blocks)==null?void 0:a[r]});if(o.aggregate(c),c.consumed)break}return o}extractTail(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length);const n=new Ee;return t===l||this._forEachBlocksInRange(t,l,(o,a,r,i)=>{const c=o.extractTail(r,i);c.stop=this._findStopBefore(a),c.from=this._blockStartPos(a),c instanceof Ee&&(c.blockIndex=a),n.extend(c)}),n}extractInput(t,l,n){if(t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),n===void 0&&(n={}),t===l)return"";let o="";return this._forEachBlocksInRange(t,l,(a,r,i,c)=>{o+=a.extractInput(i,c,n)}),o}_findStopBefore(t){let l;for(let n=0;n<this._stops.length;++n){const o=this._stops[n];if(o<=t)l=o;else break}return l}_appendPlaceholder(t){const l=new q;if(this.lazy&&t==null)return l;const n=this._mapPosToBlock(this.displayValue.length);if(!n)return l;const o=n.index,a=t??this._blocks.length;return this._blocks.slice(o,a).forEach(r=>{if(!r.lazy||t!=null){var i;l.aggregate(r._appendPlaceholder((i=r._blocks)==null?void 0:i.length))}}),l}_mapPosToBlock(t){let l="";for(let n=0;n<this._blocks.length;++n){const o=this._blocks[n],a=l.length;if(l+=o.displayValue,t<=l.length)return{index:n,offset:t-a}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((l,n)=>l+=n.displayValue.length,0)}_forEachBlocksInRange(t,l,n){l===void 0&&(l=this.displayValue.length);const o=this._mapPosToBlock(t);if(o){const a=this._mapPosToBlock(l),r=a&&o.index===a.index,i=o.offset,c=a&&r?a.offset:this._blocks[o.index].displayValue.length;if(n(this._blocks[o.index],o.index,i,c),a&&!r){for(let d=o.index+1;d<a.index;++d)n(this._blocks[d],d,0,this._blocks[d].displayValue.length);n(this._blocks[a.index],a.index,0,a.offset)}}}remove(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length);const n=super.remove(t,l);return this._forEachBlocksInRange(t,l,(o,a,r,i)=>{n.aggregate(o.remove(r,i))}),n}nearestInputPos(t,l){if(l===void 0&&(l=O.NONE),!this._blocks.length)return 0;const n=new Kc(this,t);if(l===O.NONE)return n.pushRightBeforeInput()||(n.popState(),n.pushLeftBeforeInput())?n.pos:this.displayValue.length;if(l===O.LEFT||l===O.FORCE_LEFT){if(l===O.LEFT){if(n.pushRightBeforeFilled(),n.ok&&n.pos===t)return t;n.popState()}if(n.pushLeftBeforeInput(),n.pushLeftBeforeRequired(),n.pushLeftBeforeFilled(),l===O.LEFT){if(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.ok&&n.pos<=t||(n.popState(),n.ok&&n.pos<=t))return n.pos;n.popState()}return n.ok?n.pos:l===O.FORCE_LEFT?0:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:0)}return l===O.RIGHT||l===O.FORCE_RIGHT?(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.pushRightBeforeFilled()?n.pos:l===O.FORCE_RIGHT?this.displayValue.length:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:this.nearestInputPos(t,O.LEFT))):t}totalInputPositions(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length);let n=0;return this._forEachBlocksInRange(t,l,(o,a,r,i)=>{n+=o.totalInputPositions(r,i)}),n}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const l=this._maskedBlocks[t];return l?l.map(n=>this._blocks[n]):[]}pad(t){const l=new q;return this._forEachBlocksInRange(0,this.displayValue.length,n=>l.aggregate(n.pad(t))),l}}oe.DEFAULTS={...ne.DEFAULTS,lazy:!0,placeholderChar:"_"},oe.STOP_CHAR="`",oe.ESCAPE_CHAR="\\",oe.InputDefinition=Oe,oe.FixedDefinition=bt,G.MaskedPattern=oe;class Re extends oe{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:l=this.to||0,from:n=this.from||0,maxLength:o=this.maxLength||0,autofix:a=this.autofix,...r}=t;this.to=l,this.from=n,this.maxLength=Math.max(String(l).length,o),this.autofix=a;const i=String(this.from).padStart(this.maxLength,"0"),c=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<c.length&&c[d]===i[d];)++d;r.mask=c.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(r)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let l="",n="";const[,o,a]=t.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(l="0".repeat(o.length)+a,n="9".repeat(o.length)+a),l=l.padEnd(this.maxLength,"0"),n=n.padEnd(this.maxLength,"9"),[l,n]}doPrepareChar(t,l){l===void 0&&(l={});let n;return[t,n]=super.doPrepareChar(t.replace(/\D/g,""),l),t||(n.skip=!this.isComplete),[t,n]}_appendCharRaw(t,l){if(l===void 0&&(l={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,l);const n=String(this.from).padStart(this.maxLength,"0"),o=String(this.to).padStart(this.maxLength,"0"),[a,r]=this.boundaries(this.value+t);return Number(r)<this.from?super._appendCharRaw(n[this.value.length],l):Number(a)>this.to?!l.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(n[this.value.length],l).aggregate(this._appendCharRaw(t,l)):super._appendCharRaw(o[this.value.length],l):super._appendCharRaw(t,l)}doValidate(t){const l=this.value;if(l.search(/[^0]/)===-1&&l.length<=this._matchFrom)return!0;const[o,a]=this.boundaries(l);return this.from<=Number(a)&&Number(o)<=this.to&&super.doValidate(t)}pad(t){const l=new q;if(this.value.length===this.maxLength)return l;const n=this.value,o=this.maxLength-this.value.length;if(o){this.reset();for(let a=0;a<o;++a)l.aggregate(super._appendCharRaw("0",t));n.split("").forEach(a=>this._appendCharRaw(a))}return l}}G.MaskedRange=Re;const qc="d{.}`m{.}`Y";class ge extends oe{static extractPatternOptions(t){const{mask:l,pattern:n,...o}=t;return{...o,mask:_e(l)?l:n}}constructor(t){super(ge.extractPatternOptions({...ge.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:l,pattern:n,blocks:o,...a}={...ge.DEFAULTS,...t},r=Object.assign({},ge.GET_DEFAULT_BLOCKS());t.min&&(r.Y.from=t.min.getFullYear()),t.max&&(r.Y.to=t.max.getFullYear()),t.min&&t.max&&r.Y.from===r.Y.to&&(r.m.from=t.min.getMonth()+1,r.m.to=t.max.getMonth()+1,r.m.from===r.m.to&&(r.d.from=t.min.getDate(),r.d.to=t.max.getDate())),Object.assign(r,this.blocks,o),super._update({...a,mask:_e(l)?l:n,blocks:r})}doValidate(t){const l=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&l!=null&&(this.min==null||this.min<=l)&&(this.max==null||l<=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(ge.extractPatternOptions(t))}}ge.GET_DEFAULT_BLOCKS=()=>({d:{mask:Re,from:1,to:31,maxLength:2},m:{mask:Re,from:1,to:12,maxLength:2},Y:{mask:Re,from:1900,to:9999}}),ge.DEFAULTS={...oe.DEFAULTS,mask:Date,pattern:qc,format:(s,t)=>{if(!s)return"";const l=String(s.getDate()).padStart(2,"0"),n=String(s.getMonth()+1).padStart(2,"0"),o=s.getFullYear();return[l,n,o].join(".")},parse:(s,t)=>{const[l,n,o]=s.split(".").map(Number);return new Date(o,n-1,l)}},G.MaskedDate=ge;class ze extends ne{constructor(t){super({...ze.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(l=>{const{expose:n,...o}=Me(l),a=me({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...o});return n&&(this.exposeMask=a),a}):[])}_appendCharRaw(t,l){l===void 0&&(l={});const n=this._applyDispatch(t,l);return this.currentMask&&n.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(l))),n}_applyDispatch(t,l,n){t===void 0&&(t=""),l===void 0&&(l={}),n===void 0&&(n="");const o=l.tail&&l._beforeTailState!=null?l._beforeTailState._value:this.value,a=this.rawInputValue,r=l.tail&&l._beforeTailState!=null?l._beforeTailState._rawInputValue:a,i=a.slice(r.length),c=this.currentMask,d=new q,m=c?.state;return this.currentMask=this.doDispatch(t,{...l},n),this.currentMask&&(this.currentMask!==c?(this.currentMask.reset(),r&&(this.currentMask.append(r,{raw:!0}),d.tailShift=this.currentMask.value.length-o.length),i&&(d.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):m&&(this.currentMask.state=m)),d}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const l=new q;return t&&l.aggregate(this._applyDispatch("",{},t)),l.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var l,n;return{...t,_beforeTailState:((l=t._beforeTailState)==null?void 0:l.currentMaskRef)===this.currentMask&&((n=t._beforeTailState)==null?void 0:n.currentMask)||t._beforeTailState}}doDispatch(t,l,n){return l===void 0&&(l={}),n===void 0&&(n=""),this.dispatch(t,this,l,n)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,l){l===void 0&&(l={});let[n,o]=super.doPrepare(t,l);if(this.currentMask){let a;[n,a]=super.doPrepare(n,this.currentMaskFlags(l)),o=o.aggregate(a)}return[n,o]}doPrepareChar(t,l){l===void 0&&(l={});let[n,o]=super.doPrepareChar(t,l);if(this.currentMask){let a;[n,a]=super.doPrepareChar(n,this.currentMaskFlags(l)),o=o.aggregate(a)}return[n,o]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(l=>l.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 l=String(t);this.currentMask&&(this.currentMask.typedValue=t,l=this.currentMask.unmaskedValue),this.unmaskedValue=l}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,l){const n=new q;return this.currentMask&&n.aggregate(this.currentMask.remove(t,l)).aggregate(this._applyDispatch()),n}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(l=>l.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:l,currentMaskRef:n,currentMask:o,...a}=t;l&&this.compiledMasks.forEach((r,i)=>r.state=l[i]),n!=null&&(this.currentMask=n,this.currentMask.state=o),super.state=a}extractInput(t,l,n){return this.currentMask?this.currentMask.extractInput(t,l,n):""}extractTail(t,l){return this.currentMask?this.currentMask.extractTail(t,l):super.extractTail(t,l)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,l){return this.currentMask?this.currentMask.nearestInputPos(t,l):super.nearestInputPos(t,l)}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((l,n)=>{if(!t[n])return;const{mask:o,...a}=t[n];return qe(l,a)&&l.maskEquals(o)}):super.maskEquals(t)}typedValueEquals(t){var l;return!!((l=this.currentMask)!=null&&l.typedValueEquals(t))}}ze.DEFAULTS={...ne.DEFAULTS,dispatch:(s,t,l,n)=>{if(!t.compiledMasks.length)return;const o=t.rawInputValue,a=t.compiledMasks.map((r,i)=>{const c=t.currentMask===r,d=c?r.displayValue.length:r.nearestInputPos(r.displayValue.length,O.FORCE_LEFT);return r.rawInputValue!==o?(r.reset(),r.append(o,{raw:!0})):c||r.remove(d),r.append(s,t.currentMaskFlags(l)),r.appendTail(n),{index:i,weight:r.rawInputValue.length,totalInputPositions:r.totalInputPositions(0,Math.max(d,r.nearestInputPos(r.displayValue.length,O.FORCE_LEFT)))}});return a.sort((r,i)=>i.weight-r.weight||i.totalInputPositions-r.totalInputPositions),t.compiledMasks[a[0].index]}},G.MaskedDynamic=ze;class je extends oe{constructor(t){super({...je.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:l,...n}=t;if(l){const o=l.map(i=>i.length),a=Math.min(...o),r=Math.max(...o)-a;n.mask="*".repeat(a),r&&(n.mask+="["+"*".repeat(r)+"]"),this.enum=l}super._update(n)}_appendCharRaw(t,l){l===void 0&&(l={});const n=Math.min(this.nearestInputPos(0,O.FORCE_RIGHT),this.value.length),o=this.enum.filter(a=>this.matchValue(a,this.unmaskedValue+t,n));if(o.length){o.length===1&&this._forEachBlocksInRange(0,this.value.length,(r,i)=>{const c=o[0][i];i>=this.value.length||c===r.value||(r.reset(),r._appendChar(c,l))});const a=super._appendCharRaw(o[0][this.value.length],l);return o.length===1&&o[0].slice(this.unmaskedValue.length).split("").forEach(r=>a.aggregate(super._appendCharRaw(r))),a}return new q({skip:!this.isComplete})}extractTail(t,l){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),new fe("",t)}remove(t,l){if(t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),t===l)return new q;const n=Math.min(super.nearestInputPos(0,O.FORCE_RIGHT),this.value.length);let o;for(o=t;o>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(n,o),n)).length>1);--o);const a=super.remove(o,l);return a.tailShift+=o-t,a}get isComplete(){return this.enum.indexOf(this.value)>=0}}je.DEFAULTS={...oe.DEFAULTS,matchValue:(s,t,l)=>s.indexOf(t,l)===l},G.MaskedEnum=je;class pl extends ne{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}G.MaskedFunction=pl;var hl;class ce extends ne{constructor(t){super({...ce.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),l="\\d*",n=(this.scale?"("+kt(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+l+n),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(kt).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(kt(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const l=t.split(this.radix);return l[0]=l[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),l.join(this.radix)}doPrepareChar(t,l){l===void 0&&(l={});const[n,o]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(l.input&&l.raw||!l.input&&!l.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),l);return t&&!n&&(o.skip=!0),n&&!this.allowPositive&&!this.value&&n!=="-"&&o.aggregate(this._appendChar("-")),[n,o]}_separatorsCount(t,l){l===void 0&&(l=!1);let n=0;for(let o=0;o<t;++o)this._value.indexOf(this.thousandsSeparator,o)===o&&(++n,l&&(t+=this.thousandsSeparator.length));return n}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,l,n){return t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),[t,l]=this._adjustRangeWithSeparators(t,l),this._removeThousandsSeparators(super.extractInput(t,l,n))}_appendCharRaw(t,l){l===void 0&&(l={});const n=l.tail&&l._beforeTailState?l._beforeTailState._value:this._value,o=this._separatorsCountFromSlice(n);this._value=this._removeThousandsSeparators(this.value);const a=this._value;this._value+=t;const r=this.number;let i=!isNaN(r),c=!1;if(i){let v;this.min!=null&&this.min<0&&this.number<this.min&&(v=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(v=this.max),v!=null&&(this.autofix?(this._value=this.format(v,this).replace(ce.UNMASKED_RADIX,this.radix),c||(c=a===this._value&&!l.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let d;i?d=new q({inserted:this._value.slice(a.length),rawInserted:c?"":t,skip:c}):(this._value=a,d=new q),this._value=this._insertThousandsSeparators(this._value);const m=l.tail&&l._beforeTailState?l._beforeTailState._value:this._value,f=this._separatorsCountFromSlice(m);return d.tailShift+=(f-o)*this.thousandsSeparator.length,d}_findSeparatorAround(t){if(this.thousandsSeparator){const l=t-this.thousandsSeparator.length+1,n=this.value.indexOf(this.thousandsSeparator,l);if(n<=t)return n}return-1}_adjustRangeWithSeparators(t,l){const n=this._findSeparatorAround(t);n>=0&&(t=n);const o=this._findSeparatorAround(l);return o>=0&&(l=o+this.thousandsSeparator.length),[t,l]}remove(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length),[t,l]=this._adjustRangeWithSeparators(t,l);const n=this.value.slice(0,t),o=this.value.slice(l),a=this._separatorsCount(n.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(n+o));const r=this._separatorsCountFromSlice(n);return new q({tailShift:(r-a)*this.thousandsSeparator.length})}nearestInputPos(t,l){if(!this.thousandsSeparator)return t;switch(l){case O.NONE:case O.LEFT:case O.FORCE_LEFT:{const n=this._findSeparatorAround(t-1);if(n>=0){const o=n+this.thousandsSeparator.length;if(t<o||this.value.length<=o||l===O.FORCE_LEFT)return n}break}case O.RIGHT:case O.FORCE_RIGHT:{const n=this._findSeparatorAround(t);if(n>=0)return n+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let l=t;this.min!=null&&(l=Math.max(l,this.min)),this.max!=null&&(l=Math.min(l,this.max)),l!==t&&(this.unmaskedValue=this.format(l,this));let n=this.value;this.normalizeZeros&&(n=this._normalizeZeros(n)),this.padFractionalZeros&&this.scale>0&&(n=this._padFractionalZeros(n)),this._value=n}super.doCommit()}_normalizeZeros(t){const l=this._removeThousandsSeparators(t).split(this.radix);return l[0]=l[0].replace(/^(\D*)(0*)(\d*)/,(n,o,a,r)=>o+r),t.length&&!/\d$/.test(l[0])&&(l[0]=l[0]+"0"),l.length>1&&(l[1]=l[1].replace(/0*$/,""),l[1].length||(l.length=1)),this._insertThousandsSeparators(l.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const l=t.split(this.radix);return l.length<2&&l.push(""),l[1]=l[1].padEnd(this.scale,"0"),l.join(this.radix)}doSkipInvalid(t,l,n){l===void 0&&(l={});const o=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===ce.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,l,n)&&!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==="")}}hl=ce,ce.UNMASKED_RADIX=".",ce.EMPTY_VALUES=[...ne.EMPTY_VALUES,0],ce.DEFAULTS={...ne.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[hl.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:s=>s.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},G.MaskedNumber=ce;const Ye={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function xt(s,t,l){t===void 0&&(t=Ye.MASKED),l===void 0&&(l=Ye.MASKED);const n=me(s);return o=>n.runIsolated(a=>(a[t]=o,a[l]))}function ml(s,t,l,n){return xt(t,l,n)(s)}G.PIPE_TYPE=Ye,G.createPipe=xt,G.pipe=ml;class fl extends oe{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 l,n,o;const{repeat:a,...r}=Me(t);this._blockOpts=Object.assign({},this._blockOpts,r);const i=me(this._blockOpts);this.repeat=(l=(n=a??i.repeat)!=null?n:this.repeat)!=null?l: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(me(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,l){l===void 0&&(l={});const n=new q;for(let c=(o=(a=this._mapPosToBlock(this.displayValue.length))==null?void 0:a.index)!=null?o:Math.max(this._blocks.length-1,0),d,m;d=(r=this._blocks[c])!=null?r:m=!m&&this._allocateBlock(c);++c){var o,a,r,i;const f=d._appendChar(t,{...l,_beforeTailState:(i=l._beforeTailState)==null||(i=i._blocks)==null?void 0:i[c]});if(f.skip&&m){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(n.aggregate(f),f.consumed)break}return n}_trimEmptyTail(t,l){var n,o;t===void 0&&(t=0);const a=Math.max(((n=this._mapPosToBlock(t))==null?void 0:n.index)||0,this.repeatFrom,0);let r;l!=null&&(r=(o=this._mapPosToBlock(l))==null?void 0:o.index),r==null&&(r=this._blocks.length-1);let i=0;for(let c=r;a<=c&&!this._blocks[c].unmaskedValue;--c,++i);i&&(this._blocks.splice(r-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(t,l){t===void 0&&(t=0),l===void 0&&(l=this.displayValue.length);const n=super.remove(t,l);return this._trimEmptyTail(t,l),n}totalInputPositions(t,l){return t===void 0&&(t=0),l==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,l)}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}}G.RepeatBlock=fl;try{globalThis.IMask=G}catch{}const gl=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:q,ChunksTailDetails:Ee,DIRECTION:O,HTMLContenteditableMaskElement:yt,HTMLInputMaskElement:cl,HTMLMaskElement:Le,InputMask:dl,MaskElement:Ze,Masked:ne,MaskedDate:ge,MaskedDynamic:ze,MaskedEnum:je,MaskedFunction:pl,MaskedNumber:ce,MaskedPattern:oe,MaskedRange:Re,MaskedRegExp:ul,PIPE_TYPE:Ye,PatternFixedDefinition:bt,PatternInputDefinition:Oe,RepeatBlock:fl,createMask:me,createPipe:xt,default:G,forceDirection:sl,normalizeOpts:Me,pipe:ml},Symbol.toStringTag,{value:"Module"}));W.ModalEdit=ll,W.VForm=be,W.VsInputAddress=Jt,W.VsInputArray=Pc,W.VsInputCheckbox=$t,W.VsInputCodegen=qt,W.VsInputColor=Wt,W.VsInputContainer=zt,W.VsInputDate=Mt,W.VsInputEmail=ut,W.VsInputFile=Lt,W.VsInputFileList=Ot,W.VsInputKeyValue=Zt,W.VsInputMask=dt,W.VsInputNumber=St,W.VsInputRadio=ht,W.VsInputRange=Yt,W.VsInputSelect=mt,W.VsInputSlug=Kt,W.VsInputStatic=ct,W.VsInputSwitcher=it,W.VsInputTag=Gt,W.VsInputTel=pt,W.VsInputText=Se,W.VsInputTextArray=ft,W.VsInputTextarea=jt,W.default=be,W.inputs=Qt,W.vsInputDatatable=Pt,W.vsInputMap=Ht,Object.defineProperties(W,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|