@opengis/form 0.0.41 → 0.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/inputs/array/vs-input-array.vue.d.ts +21 -0
- package/dist/components/inputs/array/vs-input-array.vue.d.ts.map +1 -0
- package/dist/components/inputs/base/vs-input-number.vue.d.ts +2 -2
- package/dist/components/inputs/base/vs-input-number.vue.d.ts.map +1 -1
- package/dist/components/inputs/base/vs-input-range.vue.d.ts +2 -2
- package/dist/components/inputs/base/vs-input-range.vue.d.ts.map +1 -1
- package/dist/components/inputs/index.d.ts +22 -4
- package/dist/components/inputs/index.d.ts.map +1 -1
- package/dist/components/inputs/table/vs-input-datatable.vue.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1058 -1001
- package/dist/index.umd.cjs +3 -3
- package/dist/types/form.d.ts +9 -0
- package/dist/types/form.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(O,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):(O=typeof globalThis<"u"?globalThis:O||self,e(O.FormBuilder={},O.Vue,O.OpenGISCore))})(this,function(O,e,G){"use strict";const Ht={class:"w-full relative"},Gt={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},qt={class:"opacity-100"},Kt={key:0,class:"text-red-500 text-[14px]"},Zt={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Yt=e.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""}},setup(o){const t=e.ref("uk"),s=n=>{n.detail.key==="locale"&&(t.value=n.detail.newValue)};return e.onMounted(()=>{t.value=localStorage.locale,window.addEventListener("storage",s)}),e.onUnmounted(()=>{window.removeEventListener("resize",s)}),(n,l)=>(e.openBlock(),e.createElementBlock("div",Ht,[n.ua||n.label?(e.openBlock(),e.createElementBlock("div",Gt,[e.createElementVNode("span",qt,e.toDisplayString(n.item[t.value]||n.ua||n.label),1),n.item?.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",Kt,"*")):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",Zt,e.toDisplayString(n.error),1)):e.createCommentVNode("",!0)]))}}),Wt={class:"w-full relative flex flex-row items-center gap-2"},Jt={key:0,class:"text-sm text-gray-900 font-medium flex shrink-0 w-3/12 max-w-[250px]"},Xt={key:0,class:"text-red-500 text-[14px]"},Qt={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},es=e.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""}},setup(o){return(t,s)=>(e.openBlock(),e.createElementBlock("div",Wt,[t.item?.type!=="html"?(e.openBlock(),e.createElementBlock("span",Jt,[e.createTextVNode(e.toDisplayString(t.ua||t.label)+" ",1),t.item?.rules?.includes("required")&&(t.ua||t.label)?(e.openBlock(),e.createElementBlock("span",Xt,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",Qt,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),ts={class:"w-full relative"},ss={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},ns=e.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""}},setup(o){return(t,s)=>(e.openBlock(),e.createElementBlock("div",ts,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",ss,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),ls={class:"flex-1 min-w-0"},as={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},rs={class:"truncate"},os={key:0,class:"text-red-500 text-[14px]"},is={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},ds={class:"w-full md:w-auto"},us={key:0,class:"mt-1 text-xs text-red-500"},cs={default:Yt,horizontal:es,inline:ns,settings:e.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""}},setup(o){const t=o,s=e.ref("uk");e.computed(()=>(t.item??{})?.[s.value]??t.ua??t.label??"");const n=e.computed(()=>t.item?.description??""),l=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"&&(s.value=i.newValue??"uk")};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(s.value=localStorage.locale)}catch{}window.addEventListener("storage",r)}),e.onUnmounted(()=>{window.removeEventListener("storage",r)}),(i,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":i.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(i.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",ls,[i.ua||i.label?(e.openBlock(),e.createElementBlock("p",as,[e.createElementVNode("span",rs,e.toDisplayString(i.item[s.value]||i.ua||i.label),1),l.value?(e.openBlock(),e.createElementBlock("span",os,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),n.value?(e.openBlock(),e.createElementBlock("p",is,e.toDisplayString(n.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",ds,[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))])],2),a.value?(e.openBlock(),e.createElementBlock("p",us,e.toDisplayString(a.value),1)):e.createCommentVNode("",!0)],2))}})};function se(o){return{inputClass:e.computed(()=>{const s=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${o?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return o?.size==="sm"?`${s}h-[32px]`:`${s}h-[38px]`})}}const ps=["placeholder","disabled"],hs=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(o){const t=o,{inputClass:s}=se(t.style),n=e.useModel(o,"modelValue");return(l,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":a[0]||(a[0]=r=>n.value=r),placeholder:l.placeholder,disabled:l.disabled,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(s),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,ps)),[[e.vModelText,n.value]])}}),ms=["placeholder","disabled"],xe=e.defineComponent({__name:"vs-input-text",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const t=o,{inputClass:s}=se(t.style),n=e.useModel(o,"modelValue");return(l,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":a[0]||(a[0]=r=>n.value=r),placeholder:l.placeholder,disabled:l.disabled,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(s),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,ms)),[[e.vModelText,n.value]])}}),fs=["placeholder"],Ye=e.defineComponent({__name:"vs-input-number",props:e.mergeModels({style:{default:()=>({})},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const t=o,{inputClass:s}=se(t.style),n=e.useModel(o,"modelValue");return(l,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":a[0]||(a[0]=r=>n.value=r),placeholder:l.placeholder,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,fs)),[[e.vModelText,n.value]])}}),R=(o,t)=>{const s=o.__vccOpts||o;for(const[n,l]of t)s[n]=l;return s},gs={},ks={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 bs(o,t){return e.openBlock(),e.createElementBlock("svg",ks,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const ys=R(gs,[["render",bs]]),xs={class:"flex items-center gap-[4px]"},_s=["value","id","disabled"],ws=["for"],Es={class:"text-[14px] text-gray-700 flex items-center gap-x-1 ml-1 dark:text-neutral-400"},Vs=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(o,{emit:t}){const s=t,n=o,l=e.computed({get:()=>n.modelValue,set:a=>s("update:modelValue",a)});return(a,r)=>(e.openBlock(),e.createElementBlock("div",xs,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:a.value,"onUpdate:modelValue":r[0]||(r[0]=i=>l.value=i),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.disabled}]),id:a.id,disabled:a.disabled},null,10,_s),[[e.vModelCheckbox,l.value]]),e.createElementVNode("label",{for:a.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.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[l.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",a.error?"border-red-600":""]])},[e.createVNode(ys,{height:"12",width:"12"})],2),e.createElementVNode("span",Es,[e.renderSlot(a.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(a.label),1)])])],10,ws)]))}}),Cs=["name","value","disabled"],vs={class:"flex items-center gap-[6px] text-[14px]"},Bs={key:0,class:"text-[16px]"},Ns=["src"],Ss=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(o,{emit:t}){const s=o,n=t,l=e.computed({get:()=>s.modelValue,set:i=>{n("update:modelValue",i)}}),a=e.computed(()=>Array.isArray(l.value)?l.value.includes(s.value):l.value===!0||l.value===s.value),r=e.computed(()=>s.style?.size==="xs"?"p-1.5 text-xs":s.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(i,d)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[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":d[0]||(d[0]=u=>l.value=u),disabled:i.disabled},null,8,Cs),[[e.vModelCheckbox,l.value]]),e.createElementVNode("span",vs,[i.icon||i.imgUrl?(e.openBlock(),e.createElementBlock("span",Bs,[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,Ns)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(i.label),1)])])],2))}}),Ms={class:"flex items-center"},We=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(o,{emit:t}){const s=o,n=t,l=`radio-${Math.floor(Math.random()*1e4)}`,a=e.computed({get:()=>Array.isArray(s.modelValue)?Array.isArray(s.modelValue)&&s.modelValue.includes(s.value):s.modelValue,set:i=>{if(Array.isArray(s.modelValue)){let d=[...s.modelValue];i?d.includes(s.value)||d.push(s.value):d=d.filter(u=>u!==s.value),n("update:modelValue",d)}else n("update:modelValue",i)}}),r=e.ref(`vs-checkbox-${s.view||"default"}`);return(i,d)=>(e.openBlock(),e.createElementBlock("div",Ms,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value==="vs-checkbox-buttons"?e.unref(Ss):e.unref(Vs)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:a.value,"onUpdate:modelValue":d[0]||(d[0]=u=>a.value=u),id:l,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"]))]))}}),Fs={},As={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 $s(o,t){return e.openBlock(),e.createElementBlock("svg",As,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 Ds=R(Fs,[["render",$s]]),Is={},Ls={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function Ts(o,t){return e.openBlock(),e.createElementBlock("svg",Ls,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),e.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const Os=R(Is,[["render",Ts]]),Rs={},zs={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 js(o,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:"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 Us=R(Rs,[["render",js]]),Ps={key:0,class:"flex items-start gap-x-1"},Hs={key:0,class:"text-red-500 text-[14px]"},Gs=["title"],qs=["disabled"],Re=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(o){const t=o,s=e.useModel(o,"modelValue");return(n,l)=>t.view==="checkbox"?(e.openBlock(),e.createElementBlock("div",Ps,[e.createVNode(We,{modelValue:s.value,"onUpdate:modelValue":l[0]||(l[0]=a=>s.value=a),label:n.text,error:n.error||""},null,8,["modelValue","label","error"]),n.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",Hs,"*")):e.createCommentVNode("",!0),n.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:n.i,onClick:l[1]||(l[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(Us),{class:"text-gray-500 w-[14px] h-[14px]"})],8,Gs)):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",[s.value?`bg-${n.style?.primaryColor||"blue"}-500`:"bg-stone-200",n.customClass]]),disabled:n.disabled,onClick:l[2]||(l[2]=a=>s.value=!s.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",[s.value?"translate-x-4":"translate-x-0"]])},null,2)],10,qs))}}),Ks=["innerHTML"],ze=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(o){return(t,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(t.customClass),innerHTML:t.html?t.html:t.text},null,10,Ks))}}),Zs=["placeholder","disabled","name"],Je=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(o){const t=o,{inputClass:s}=se(t.style),n=e.useModel(o,"modelValue"),l=e.ref(null);let a=null;return e.onMounted(async()=>{if(l.value){const{default:r}=await Promise.resolve().then(()=>ii);a=r(l.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:l,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(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,Zs))}}),Ys={class:"relative w-full bg-white rounded-lg"},Ws=["placeholder","disabled"],Xe=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(o){const t=o,{inputClass:s}=se(t.style),n=e.useModel(o,"modelValue");return(l,a)=>(e.openBlock(),e.createElementBlock("div",Ys,[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:l.placeholder,disabled:l.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(s),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Ws),[[e.vModelText,n.value]])]))}}),Js=["value","disabled"],Xs={class:"text-[13px] text-gray-700"},Qs=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(o){const t=e.useModel(o,"modelValue");return(s,n)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center gap-0",[s.customClass]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n[0]||(n[0]=l=>t.value=l),type:"radio",value:s.value,disabled:s.disabled,class:"hidden"},null,8,Js),[[e.vModelRadio,t.value]]),e.createElementVNode("span",{class:e.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${s.style?.primaryColor||"blue"}-500`,s.disabled?"opacity-50 cursor-not-allowed":""]])},[t.value==s.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${s.style?.primaryColor||"blue"}-500`]])},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",Xs,e.toDisplayString(s.text),1)],2))}}),en=["value","disabled"],tn={class:"text-[13px] text-gray-700"},sn={"vs-input-radio-default":Qs,"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(o){const t=e.useModel(o,"modelValue");return(s,n)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[t.value==s.value?`ring-2 ring-ring ring-${s.style?.primaryColor||"blue"}-500`:"",s.customClass]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n[0]||(n[0]=l=>t.value=l),type:"radio",value:s.value,disabled:s.disabled,class:"hidden"},null,8,en),[[e.vModelRadio,t.value]]),e.createElementVNode("span",tn,e.toDisplayString(s.text),1)],2))}})},je=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(o){const t=o,s=e.useModel(o,"modelValue"),n=e.computed(()=>sn[`vs-input-radio-${t.view}`]);return(l,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([l.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options,r=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.value),e.mergeProps({key:r?.id,text:r.text,value:r.id.toString(),checked:s.value===r.id,modelValue:s.value,"onUpdate:modelValue":a[0]||(a[0]=i=>s.value=i)},{ref_for:!0},l.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),Qe=R(e.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(o,{emit:t}){const s=o,n=t,l=e.ref([]),a=e.reactive({}),r=c=>c?.value||c?.id||c?.text||c,i=c=>c.text||String(c),d=c=>`lg:col-span-${c||12}`,u=async()=>{try{const c=await fetch(`/api/suggest/${s.data}`).then(p=>p.json());l.value=c?.data||c}catch(c){console.error(c)}};return e.watch(()=>s.modelValue,c=>{if(typeof c=="boolean"&&l.value.length===1){const p=r(l.value[0]);a[p]=c}else if(Array.isArray(c)){const p=new Set(c);l.value.forEach(h=>{if(!h.disabled){const x=r(h);a[x]=p.has(x)}})}},{immediate:!0}),e.watch(a,()=>{if(!l.value.length){n("update:modelValue",null);return}const c=Object.entries(a).filter(([,p])=>p).map(([p])=>p);n("update:modelValue",c.length===0?[]:c)},{deep:!0}),e.onMounted(()=>{if(s.data)u().then(()=>{if(typeof s.modelValue=="boolean"&&l.value.length===1){const c=r(l.value[0]);a[c]=s.modelValue}else if(Array.isArray(s.modelValue)){const c=new Set(s.modelValue);l.value.forEach(p=>{if(!p.disabled){const h=r(p);a[h]=c.has(h)}})}});else if(l.value=s.options,typeof s.modelValue=="boolean"&&l.value.length===1){const c=r(l.value[0]);a[c]=s.modelValue}else if(Array.isArray(s.modelValue)){const c=new Set(s.modelValue);l.value.forEach(p=>{if(!p.disabled){const h=r(p);a[h]=c.has(h)}})}}),(c,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["p-0 w-full gap-[6px]",[c.position==="vertical"?"flex-col":"",c.colSpan?"grid":"flex justify-start"]])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,h=>(e.openBlock(),e.createBlock(We,{modelValue:a[r(h)],"onUpdate:modelValue":x=>a[r(h)]=x,value:r(h),class:e.normalizeClass(d(c.colSpan)),disabled:h.disabled,label:i(h),key:r(h),icon:h?.icon,imgUrl:h?.imgUrl,option:h,view:c.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-91f3584a"]]),nn=["type","placeholder","disabled"],et=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(o,{emit:t}){const s=o;function n(d){return d?s.mode==="datetime"?(d.includes("T")?d:null)||d+(d.includes(" ")?"":"T00:00"):d?.split(" ")[0]:null}const{inputClass:l}=se(s.style),a=t,r=e.computed({get:()=>n(s.modelValue),set:d=>a("update:modelValue",d)}),i=e.computed(()=>s.mode==="datetime"?"datetime-local":s.mode);return(d,u)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":u[0]||(u[0]=c=>r.value=c),placeholder:d.placeholder,disabled:d.disabled,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[d.modelValue?"":"text-opacity-50",e.unref(l)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,nn)),[[e.vModelDynamic,r.value]])}}),ln=async(o,t,s,n)=>{try{const l=new FormData;return l.append("unique","true"),l.append("file",o),(await fetch(`/file/upload/uploads?id=${t||""}&form=${s||""}&table=${n||""}`,{method:"POST",body:l}).then(r=>r.json()))?.result}catch(l){return G.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",l),null}},an=async o=>{try{return await fetch(`file/delete${o}`),!0}catch(t){return console.error(t),!1}},tt=async o=>{try{const t=await fetch(`file/download/files/uploads${o}`),s=await t.arrayBuffer(),n=t.headers["content-type"],l=new TextDecoder("utf-8").decode(s),a=new Blob([l],{type:n}),r=document.createElement("a");r.setAttribute("download",o),r.href=window.URL.createObjectURL(a),r.click()}catch(t){console.error(t.message)}},rn={},on={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 dn(o,t){return e.openBlock(),e.createElementBlock("svg",on,t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const _e=R(rn,[["render",dn]]),un={},cn={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 pn(o,t,s,n,l,a){return e.openBlock(),e.createElementBlock("svg",cn,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 hn=R(un,[["render",pn]]),mn={},fn={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(o,t,s,n,l,a){return e.openBlock(),e.createElementBlock("svg",fn,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=R(mn,[["render",gn]]),bn={},yn={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 xn(o,t){return e.openBlock(),e.createElementBlock("svg",yn,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 st=R(bn,[["render",xn]]),_n={},wn={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 En(o,t,s,n,l,a){return e.openBlock(),e.createElementBlock("svg",wn,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 Vn=R(_n,[["render",En]]),Cn={},vn={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 Bn(o,t,s,n,l,a){return e.openBlock(),e.createElementBlock("svg",vn,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 Nn=R(Cn,[["render",Bn]]),Sn=o=>{if(!o)return"";const t=o?.split(".");return t[t.length-1]},Mn=o=>{const t=Sn(o),s={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 s.imageFormat.includes(t)?"img":s.sheetsFormat.includes(t)?kn:s.textsFormat.includes(t)?Nn:s.documentsFormat.includes(t)?hn:s.archivesFormat.includes(t)?Vn:st},Fn={},An={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 $n(o,t){return e.openBlock(),e.createElementBlock("svg",An,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const Fe=R(Fn,[["render",$n]]),Dn={},In={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 Ln(o,t){return e.openBlock(),e.createElementBlock("svg",In,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 nt=R(Dn,[["render",Ln]]),Tn={class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},On={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},lt=R(e.defineComponent({__name:"vs-input-file-list-item",props:e.mergeModels({format:{},multiple:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(o){const t=e.useModel(o,"value"),s=e.useModel(o,"item"),n=o;return(l,a)=>(e.openBlock(),e.createElementBlock("div",Tn,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Mn)(s.value)),{src:s.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:a[0]||(a[0]=r=>e.unref(tt)(s.value))},null,8,["src"])),e.createElementVNode("div",On,[e.createElementVNode("button",{type:"button",onClick:a[1]||(a[1]=r=>{e.unref(an)(s.value),t.value=n.multiple?t.value?.filter(i=>i!==s.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[e.createVNode(Fe,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:a[2]||(a[2]=r=>e.unref(tt)(s.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(nt,{class:"w-4 h-4"})])])]))}}),[["__scopeId","data-v-0ca886b3"]]),Rn={class:"flex items-center gap-x-2"},zn={key:1,class:"flex items-center flex-wrap gap-2"},at=e.defineComponent({__name:"vs-input-file",props:e.mergeModels({format:{},multiple:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const t=o,s=e.useModel(o,"modelValue"),n=e.ref(null),l=r=>Array.isArray(s.value)&&s.value[r]||"",a=async r=>{if(t.format){const u=r.target.files?.[0];if(!u||!u.name.endsWith(t.format))return}const i=r.target.files?.[0];if(!i)return;const d=await ln(i,"1","form","table");s.value=t.multiple?[...s.value||[],d?.file_path]:d?.file_path};return(r,i)=>(e.openBlock(),e.createElementBlock("div",Rn,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:n,type:"file",onChange:a},null,544),!r.multiple&&s.value?(e.openBlock(),e.createBlock(lt,{key:0,item:s.value,"onUpdate:item":i[0]||(i[0]=d=>s.value=d),value:s.value,"onUpdate:value":i[1]||(i[1]=d=>s.value=d)},null,8,["item","value"])):r.multiple?(e.openBlock(),e.createElementBlock("div",zn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(d,u)=>(e.openBlock(),e.createBlock(lt,{multiple:r.multiple,key:u,value:s.value,"onUpdate:value":i[2]||(i[2]=c=>s.value=c),item:l(u)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:i[3]||(i[3]=d=>!r.disabled&&n.value?.click()),class:e.normalizeClass(["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",r.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[e.createVNode(_e,{class:"w-6 h-6"})],2)])):e.createCommentVNode("",!0),r.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:i[4]||(i[4]=d=>n.value?.click()),class:e.normalizeClass([r.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","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"])},[e.createVNode(_e,{class:"w-6 h-6"})],2))]))}}),jn={class:"max-w-[55vw]"},Un={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},Pn={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},Hn={class:"px-[5px]"},Gn={class:""},Ae=e.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(o){const t=o,s=e.computed(()=>{try{return new Date(t.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function n(l){if(l<1024)return`${l} B`;const a=l/1024;return a<1024?`${a.toFixed(2)} KB`:`${(a/1024).toFixed(2)} MB`}return(l,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",jn,[e.createElementVNode("p",Un,e.toDisplayString(l.item?.uploaded_name),1),e.createElementVNode("p",Pn,[e.createElementVNode("span",null,e.toDisplayString(l.item?.username),1),e.withDirectives(e.createElementVNode("span",Hn,"|",512),[[e.vShow,l.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(s.value),1),a[0]||(a[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",Gn,e.toDisplayString(n(l.item?.size)),1)])])],64))}}),qn={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},Kn={key:0,class:"flex w-full gap-x-3 items-center"},Zn={key:1,class:"flex gap-x-3 w-full items-center"},Yn={key:2,class:"flex gap-x-3 w-full items-center"},Wn=["href"],Jn={key:3,class:"flex gap-x-3 w-full items-center"},Xn={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},Qn={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"},el={class:"inline-block"},tl={class:"inline-block"},sl=e.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(o,{emit:t}){const s=o,n=t;function l(c){return["pdf","json"].includes(c.ext)}function a(c){return["ppt","pptx","doc","docx","xls","xlsx"].includes(c.ext)}function r(c){const p=document.createElement("a");p.setAttribute("download",c?.uploaded_name),p.href=c?.file_path,p.click()}async function i(){try{await fetch(`${s.prefix}/widget/file/${s.item.entity_id}/${s.item.file_id}`),n("update")}catch(c){console.error(c)}}function d(){n("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function u(c){(s.item.ext==="jpg"||s.item.ext==="png")&&n("openLightbox",{item:s.item,index:c})}return(c,p)=>(e.openBlock(),e.createElementBlock("div",qn,[c.item.ext==="jpg"||c.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",Kn,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:p[0]||(p[0]=h=>u(c.index))},[e.createVNode(Ae,{item:c.item},null,8,["item"])])])):l(c.item)?(e.openBlock(),e.createElementBlock("div",Zn,[e.createVNode(Ae,{item:c.item},null,8,["item"])])):a(c.item)?(e.openBlock(),e.createElementBlock("div",Yn,[e.createElementVNode("a",{href:`/api/file-preview?id=${c.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(Ae,{item:c.item},null,8,["item"])],8,Wn)])):(e.openBlock(),e.createElementBlock("div",Jn,[e.createVNode(Ae,{item:c.item},null,8,["item"])])),e.createElementVNode("div",Xn,[e.createElementVNode("div",Qn,[e.createElementVNode("div",el,[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:p[1]||(p[1]=h=>r(c.item))},[e.createVNode(nt,{height:"14",width:"14"})])]),p[3]||(p[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",tl,[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:p[2]||(p[2]=h=>d())},[e.createVNode(Fe,{height:"14",width:"14"})])])])])]))}}),nl={},ll={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 al(o,t){return e.openBlock(),e.createElementBlock("svg",ll,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"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 rl=R(nl,[["render",al]]),ol={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},il={class:"flex w-full mb-[12px] items-center gap-x-2"},dl={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},ul={class1:"ml-auto"},cl={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"},pl={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},hl={class:"relative"},ml={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"},fl={key:0},rt=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(o,{emit:t}){const s=o,n=e.inject("form"),l=e.computed(()=>n.value.formId),a=e.ref(!1),r=e.ref(0),i=t,d=e.ref(!1),u=e.ref({}),c=e.ref([]),p=e.ref(""),h=e.computed(()=>Array.isArray(c.value)?c.value.filter(b=>b.ext==="jpg"||b.ext==="png").map(b=>b?.file_path):[]),x=e.computed(()=>p.value===""?c.value:c.value.filter(b=>b?.uploaded_name?.includes(p.value))),$=b=>{const k=h.value.findIndex(S=>S===b.item.file_path);k!==-1&&(a.value=!0,r.value=k)},V=async()=>{try{const b=await fetch(`${s.prefix}/widget/file/${l.value}`).then(k=>k.json());c.value=b?.rows}catch(b){console.error(b)}},M=async b=>{await Promise.all(Array.from(b.target.files).map(async k=>{const S=new FormData;S.append("file",k);try{const U=`${s.prefix}/widget/file/${l.value}`,w=await fetch(U,{method:"POST",body:S});return w.ok?(i("update","file-list"),k):(G.notify({type:w.status>=400&&w.status<500?"warning":"error",title:"Error",message:`Error code: ${w.status}`}),null)}catch(U){return G.notify({type:"error",title:"Error",message:U.message||"Unknown error"}),console.error(U),null}})),await V()},C=b=>{const k={...b};return b.cancel||(k.cancel=()=>{d.value=!1}),b.updateListOnConfirm&&(k.confirm=async()=>{await b.confirm(),d.value=!1,V()}),k},v=b=>{u.value=C(b),d.value=!0};return e.watch(l,b=>{b&&V()}),e.onMounted(()=>{l.value&&V()}),(b,k)=>{const S=e.resolveComponent("Lightbox"),U=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",ol,[e.createElementVNode("div",il,[e.createElementVNode("h2",dl," Файлів: "+e.toDisplayString(c.value?.length),1),e.createElementVNode("div",ul,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:k[0]||(k[0]=w=>M(w))},null,32),e.createElementVNode("div",cl,[e.createVNode(rl,{height:"16",width:"16"})])])])]),c.value?.length>4?(e.openBlock(),e.createElementBlock("div",pl,[e.createElementVNode("div",null,[e.createElementVNode("div",hl,[k[8]||(k[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":k[1]||(k[1]=w=>p.value=w),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,p.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),c.value?.length?(e.openBlock(),e.createElementBlock("div",ml,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,(w,W)=>(e.openBlock(),e.createBlock(sl,{key:W,prefix:b.prefix,item:w,index:W,onUpdate:k[2]||(k[2]=X=>b.$emit("update","file-list")),onOpenModal:k[3]||(k[3]=X=>v(X)),onOpenLightbox:k[4]||(k[4]=X=>$(X))},null,8,["prefix","item","index"]))),128)),x.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",fl,k[9]||(k[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):e.createCommentVNode("",!0),e.createVNode(S,{modelValue:a.value,"onUpdate:modelValue":k[5]||(k[5]=w=>a.value=w),startIndex:r.value,"onUpdate:index":k[6]||(k[6]=w=>r.value=w),images:h.value},null,8,["modelValue","startIndex","images"]),e.createVNode(U,e.mergeProps({modelValue:d.value,"onUpdate:modelValue":k[7]||(k[7]=w=>d.value=w),onConfirm:u.value.confirm},u.value),null,16,["modelValue","onConfirm"])])}}}),gl={class:"flex items-center justify-between"},kl={class:"text-[16px] text-gray-900 font-medium"},bl={class:"grid gap-3"},yl=R(e.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(o){const t=o,s=e.ref(t.isOpen);return e.watch(()=>t.isOpen,n=>{s.value=n}),(n,l)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",gl,[e.createElementVNode("p",kl,e.toDisplayString(o.title),1),e.createVNode(Re,{modelValue:s.value,"onUpdate:modelValue":l[0]||(l[0]=a=>s.value=a),style:e.normalizeStyle(o.style)},null,8,["modelValue","style"])]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",bl,[e.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[e.vShow,s.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),xl={class:"text-[16px] text-gray-900 font-medium"},_l={class:"grid gap-3"},wl=R(e.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(o){const t=o,s=e.ref(t.isOpen);return e.watch(()=>t.isOpen,n=>{s.value=n}),(n,l)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("button",{type:"button",onClick:l[0]||(l[0]=a=>s.value=!s.value),class:"flex items-center gap-2"},[e.createVNode(e.unref(Ds),{class:e.normalizeClass(["h-4 w-4 duration-300",[s.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",xl,e.toDisplayString(o.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",_l,[e.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[e.vShow,s.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),El={class:"flex items-center justify-between"},Vl={switcher:yl,accordion:wl,default:e.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(o){return(t,s)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",El,[e.createElementVNode("p",null,e.toDisplayString(o.title),1)]),e.renderSlot(t.$slots,"default")]))}})},te={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Cl=(o,t)=>String(o)===String(t),vl=(o,t)=>String(o)!==String(t),Bl=(o,t)=>o>t,Nl=(o,t)=>o>=t,Sl=(o,t)=>o<t,Ml=(o,t)=>o<=t,Fl=(o,t)=>Array.isArray(t)&&t.length===2?o>=t[0]&&o<=t[1]:!1,Al=(o,t)=>String(o).startsWith(String(t)),$l=(o,t)=>String(o).endsWith(String(t)),Dl=(o,t)=>String(o).includes(String(t)),Il=(o,t)=>Array.isArray(t)?t.includes(o):!1,Ll=(o,t)=>Array.isArray(t)?!t.includes(o):!0,ot=(o,t)=>{if(!t)return!0;switch(t?.[1]){case te.Equal:return Cl(o,t?.[2]);case te.Inequal:return vl(o,t?.[2]);case te.Higer:return Bl(o,t?.[2]);case te.HigerOrEqual:return Nl(o,t?.[2]);case te.Lower:return Sl(o,t?.[2]);case te.LowerOrEqual:return Ml(o,t?.[2]);case te.Between:return Fl(o,t?.[2]);case te.StartWith:return Al(o,t?.[2]);case te.EndWith:return $l(o,t?.[2]);case te.Contain:return Dl(o,t?.[2]);case te.In:return Il(o,t?.[2]);case te.NotIn:return Ll(o,t?.[2]);default:return!0}},it=e.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},schema:{type:Array,default:()=>[]}},setup(o){const t=o,s=e.inject("formValues",{default:{}}),n=e.inject("form"),l=e.computed(()=>t.schema?.filter(r=>{const i=r?.conditions;if(!i)return!0;const d=Array.isArray(i)?i[0]:i,u=s?.value?.[d];return ot(u,i)})),a=e.computed(()=>Vl[t.view]);return(r,i)=>o.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),{key:0,title:o.title,style:e.normalizeStyle(o.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,d=>(e.openBlock(),e.createBlock(yt,e.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:e.unref(s)[d.name],"onUpdate:modelValue":u=>e.unref(s)[d.name]=u,style:o.style,error:e.unref(n)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),Tl=["aria-expanded","data-focus"],Ol={class:"flex items-center"},Rl=["title"],zl=["onClick"],jl=["title"],Ul={key:2,class:"text-gray-500 truncate"},Pl={class:"flex-1 min-w-[2px]"},Hl=["placeholder"],Gl={class:"flex items-center shrink-0"},ql=["disabled"],Kl=["disabled","title"],Zl=["aria-disabled","onClick"],Yl={key:1,class:"px-3 py-2 text-center text-gray-500"},Wl=["disabled"],Ue=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:{},add:{},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},emits:["change","update:modelValue"],setup(o,{emit:t}){const s=o,n=t,l=e.computed(()=>s.multiple),a=e.computed(()=>s.disabled);se(s.style);const r=e.computed({get:()=>s.modelValue,set:f=>n("update:modelValue",f)});!r.value&&s.defaultValue&&(r.value=s.defaultValue);const i=e.ref(null),d=e.ref(null),u=e.ref(null),c=e.ref(null),p=e.ref(!1),h=e.ref(!1),x=e.ref(null),$=e.ref([]),V=e.ref(-1),M=e.ref([]),C=e.ref(""),v=e.ref(null),b=e.ref("bottom"),k=e.ref({}),S=e.ref([]),U=e.computed(()=>{if(!S.value.length)return[];const f=new Map($.value.map(m=>[m.id?.toString(),m]));return S.value.map(m=>f.get(m?.toString())).filter(m=>!!m)}),w=e.computed(()=>s.placeholder||"Select..."),W=e.computed(()=>l.value?!S.value.length&&C.value==="":!x.value?.text&&C.value===""),X=e.computed(()=>a.value?!1:l.value?S.value.length>0:!!r.value),Q=f=>l.value?S.value.some(m=>m?.toString()===f?.toString()):r.value?.toString()===f?.toString(),Z=e.computed(()=>{let f=$.value??[];if(!s.data&&C.value.trim()!==""){const m=C.value.toLowerCase();f=f.filter(_=>_.text?.toLowerCase?.().includes(m))}if(l.value&&S.value.length){const m=new Set(S.value.map(_=>_?.toString()));f=f.filter(_=>!m.has(_.id?.toString()))}return f}),Ne=e.inject("values"),de=e.computed(()=>s.parent?Ne?.value?.[s.parent]??null:null),F=async f=>{if(!s.data){let m=s.options??[];if(f?.trim()){const _=f.toLowerCase();m=m.filter(T=>T.text?.toLowerCase?.().includes(_))}return m}try{const m=s.host??"",_=s.prefix??"api",T=s.api??`/${_}/suggest/${s.data}`,Y=`${m}${T}`,le=new URLSearchParams;return le.set("json","1"),f&&le.set("key",f),de.value!==void 0&&de.value!==null&&de.value!==""&&le.set("parent",String(de.value)),(await fetch(`${Y}?${le.toString()}`).then(ye=>ye.json()))?.data??[]}catch{return[]}},N=async()=>{s.data?$.value=await F(C.value):$.value=s.options?[...s.options]:[]},B=async f=>{if(f==null)return null;const m=$.value?.find(T=>T?.id?.toString()===String(f));return m||((await F(String(f)))?.[0]??null)},j=async f=>{const m=new Set($.value.map(T=>T.id?.toString())),_=f.filter(T=>!m.has(T?.toString()));_.length&&await _.reduce(async(T,Y)=>{await T;const le=await B(Y);le&&$.value.push(le)},Promise.resolve())},P=async()=>{a.value||(p.value=!0,await N(),await e.nextTick(()=>{ie(),v.value?.focus(),Z.value.length?V.value=0:V.value=-1}))},ee=()=>{p.value=!1,V.value=-1},ue=async f=>{if(a.value)return;!p.value?await P():ee()},g=async()=>{p.value?v.value?.focus():await P()},y=()=>{l.value?(S.value=[],r.value=[],n("change",[])):(x.value=null,r.value=null,n("change",null)),C.value="",e.nextTick(()=>v.value?.focus())},I=f=>{l.value&&(S.value=S.value.filter(m=>m?.toString()!==f?.toString()),r.value=[...S.value],n("change",r.value),e.nextTick(()=>v.value?.focus()))},z=f=>{l.value?(Q(f.id)||(S.value=[...S.value,f.id],r.value=[...S.value],n("change",r.value)),C.value="",e.nextTick(()=>{v.value?.focus(),V.value=Math.min(V.value,Z.value.length-1)})):(x.value=f,r.value=f.id,n("change",r.value),C.value="",ee())},H=f=>{Q(f.id)||z(f)},ne=(f,m)=>{if(!f||!m)return;const _=f.offsetTop,T=_+f.offsetHeight,Y=m.scrollTop,le=Y+m.clientHeight;let ke=m.scrollTop;_<Y?ke=_-80:T>le&&(ke=T-m.clientHeight+4);const ye=m;ye.scrollTop=ke},ce=f=>{let m=f.parentElement;for(;m;){if(m.classList.contains("ui-dialog__content"))return m;const _=window.getComputedStyle(m),T=_.overflow+_.overflowY+_.overflowX;if(T.includes("auto")||T.includes("scroll")||m===document.body||m===document.documentElement)return m;m=m.parentElement}return document.body},ie=()=>{if(!d.value)return;const f=d.value.getBoundingClientRect(),m=window.innerHeight||document.documentElement.clientHeight,_=window.innerWidth||document.documentElement.clientWidth,T=8,Y=8,le=s.maxHeight||300,ke=m-f.bottom-Y-T,ye=f.top-Y-T,Oe=ke>=ye,Ze=Math.max(_-T*2,0);let{width:Se}=f;Ze>0&&Se>Ze&&(Se=Ze);let{left:Me}=f;Me+Se+T>_&&(Me=_-Se-T),Me=Math.max(Me,T);const fi=Math.min(le,Math.max(Oe?ke:ye,50));b.value=Oe?"bottom":"top",k.value={position:"fixed",left:`${Me}px`,width:`${Se}px`,minWidth:"300px",maxHeight:`${fi}px`,transform:Oe?"none":"translateY(-100%)",top:Oe?`${f.bottom+Y}px`:`${f.top-Y}px`}},fe=async f=>{a.value||!p.value&&(f.key==="ArrowDown"||f.key==="ArrowUp")&&(f.preventDefault(),await P())},ge=f=>{if(!p.value)return;const{key:m}=f;if(m==="ArrowDown")f.preventDefault(),V.value+1<Z.value.length&&(V.value+=1,ne(M.value[V.value],u.value));else if(m==="ArrowUp")f.preventDefault(),V.value>0&&(V.value-=1,ne(M.value[V.value],u.value));else if(m==="Enter"){f.preventDefault();const _=Z.value[V.value];_&&z(_),v.value?.blur()}else m==="Escape"?(f.preventDefault(),ee()):m==="Backspace"?l.value&&C.value===""&&S.value.length&&(S.value=S.value.slice(0,-1),r.value=[...S.value],n("change",r.value)):m==="Home"?(V.value=0,ne(M.value[0],u.value)):m==="End"?(V.value=Z.value.length-1,ne(M.value[V.value],u.value)):m==="Tab"&&ee()},di=()=>{a.value||(h.value=!0)},ui=()=>{h.value=!1,C.value=""},Lt=f=>{f.key==="Escape"&&p.value&&ee()},Tt=f=>{const m=f.target;i.value?.contains(m)||c.value?.contains(m)||ee()},Ot=f=>{p.value&&u.value&&!u.value.contains(f.target)&&ie()},Rt=()=>{p.value&&ie()},zt=()=>{p.value&&ie()};e.watch(()=>s.options,f=>{f?.length&&($.value=[...f])},{immediate:!0});const jt=async()=>{if(l.value)Array.isArray(r.value)?S.value=[...r.value]:(S.value=r.value==null?[]:[r.value],r.value=[...S.value]),!s.options?.length&&s.data&&await j(S.value);else{if(Array.isArray(r.value)){const f=r.value[0]??null;r.value=f??null}x.value=await B(r.value)}};e.watch(r,()=>{jt()}),e.onMounted(async()=>{addEventListener("keydown",Lt),addEventListener("scroll",Ot,!0),addEventListener("resize",Rt),document.addEventListener("click",Tt,!0),d.value&&ce(d.value).addEventListener("scroll",zt,!0),s.options?.length?$.value=[...s.options]:s.data&&($.value=await F("")),await jt()}),e.onUnmounted(()=>{removeEventListener("keydown",Lt),removeEventListener("scroll",Ot,!0),removeEventListener("resize",Rt),document.removeEventListener("click",Tt,!0),d.value&&ce(d.value).removeEventListener("scroll",zt,!0)});const Te=e.ref(!1),Ke=e.ref({}),Ut=e.ref([]),Pt=e.ref(null);async function ci(){if(!s.add?.token||Pt?.value.validate())return;const m=s.add.api??`/api/table/${s.add.token}`,{id:_}=await fetch(m,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ke.value)}).then(T=>T.json());if(!s.options?.length&&s.data){const{data:T}=await fetch(`${s.api??`/api/suggest/${s.data}`}?val=${_}`).then(Y=>Y.json());x.value=T[0],$.value.push(T[0]),r.value=_}Te.value=!1,G.notify({title:"Success!",message:"Object created."})}async function pi(){if(!s.add)return null;const f=await fetch(`/api/template/form/${s.add.form}`).then(m=>m.json());return Ut.value=f.schema,Te.value=!0,null}function hi(f,m=200){let _;return(...T)=>{_&&clearTimeout(_),_=window.setTimeout(()=>f(...T),m)}}const mi=hi(async f=>{$.value=await F(f)},200);return e.watch(C,f=>{s.data&&mi(f.trim())}),e.watch(()=>s.options,f=>{!s.data&&f?.length&&($.value=[...f])},{immediate:!0}),e.watch(()=>s.parent??s.parentValue,()=>{s.data&&N()}),e.watch(de,async()=>{s.data&&(l.value?(S.value=[],r.value=[],n("change",[])):(x.value=null,r.value=null,n("change",null)))}),(f,m)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(G.VsModal),{visible:Te.value,"onUpdate:visible":m[1]||(m[1]=_=>Te.value=_),title:"Додати",buttonText:"Додати",onDone:ci},{default:e.withCtx(()=>[e.createVNode(me,{schema:Ut.value,modelValue:Ke.value,"onUpdate:modelValue":m[0]||(m[0]=_=>Ke.value=_),ref_key:"addForm",ref:Pt},null,8,["schema","modelValue"])]),_:1},8,["visible"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:m[4]||(m[4]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",s.customClass])},[m[9]||(m[9]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),m[10]||(m[10]=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",p.value||h.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":p.value,"aria-haspopup":"listbox",onKeydown:fe,onClick:g,"data-focus":p.value||h.value?"true":"false"},[e.createElementVNode("div",{class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"triggerRef",ref:d},[l.value&&S.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(U.value,_=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border",key:_.id},[e.createElementVNode("div",Ol,[_?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5",style:e.normalizeStyle({backgroundColor:_?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"truncate text-gray-900 overflow-hidden",title:_.text},e.toDisplayString(_.text),9,Rl)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:e.withModifiers(T=>I(_.id),["stop"])},m[5]||(m[5]=[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,zl)]))),128)):!l.value&&!h.value&&x.value?.text&&C.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900"]),title:x.value.text},[x.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:x.value?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",{class:e.normalizeClass({"pl-5":x.value?.color})},e.toDisplayString(x.value.text),3)],8,jl)):e.createCommentVNode("",!0),W.value?(e.openBlock(),e.createElementBlock("div",Ul,e.toDisplayString(w.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Pl,[!a.value&&f.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:v,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:(l.value&&S.value.length?" ":null)||(h.value&&!C.value?.length?x.value?.text:" "),"onUpdate:modelValue":m[2]||(m[2]=_=>C.value=_),onFocus:di,onBlur:ui,onKeydown:ge},null,40,Hl)),[[e.vModelText,C.value]]):e.createCommentVNode("",!0)])],512),e.createElementVNode("div",Gl,[X.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:a.value,onClick:e.withModifiers(y,["stop"])},m[6]||(m[6]=[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,ql)):e.createCommentVNode("",!0),m[8]||(m[8]=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:m[3]||(m[3]=e.withModifiers(_=>ue(),["stop"])),title:p.value?"Закрити список":"Відкрити список"},m[7]||(m[7]=[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,Kl)])],42,Tl),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[p.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:c,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(k.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:k.value.maxHeight||"300px"}),ref_key:"listRef",ref:u},[Z.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(Z.value,(_,T)=>(e.openBlock(),e.createElementBlock("div",{key:_.id,ref_for:!0,ref:Y=>M.value[T]=Y,class:e.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900 ",Q(_.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",V.value===T&&!Q(_.id)?"bg-blue-100":""]),"aria-disabled":Q(_.id)?"true":"false",role:"option",tabindex:"-1",onClick:Y=>H(_)},[_?.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:_?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",V.value===_.id?"text-white":"",(V.value===T,"")])},e.toDisplayString(_.text),3)],10,Zl))),128)):(e.openBlock(),e.createElementBlock("div",Yl," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),s.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:pi,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(_e,{width:"16",height:"16"}),m[11]||(m[11]=e.createElementVNode("span",null,"Додати",-1))],8,Wl)):e.createCommentVNode("",!0)],512)],64))}}),Jl=["placeholder","disabled"],dt=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(o){const t=o,{inputClass:s}=se(t.style),n=e.useModel(o,"modelValue");return(l,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":a[0]||(a[0]=r=>n.value=r),placeholder:l.placeholder,disabled:l.disabled,row:"2",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,Jl)),[[e.vModelText,n.value]])}}),Xl={},Ql={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};function ea(o,t){return e.openBlock(),e.createElementBlock("svg",Ql,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"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 ta=R(Xl,[["render",ea]]),sa={},na={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 la(o,t){return e.openBlock(),e.createElementBlock("svg",na,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 aa=R(sa,[["render",la]]),ra={},oa={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 ia(o,t){return e.openBlock(),e.createElementBlock("svg",oa,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const da=R(ra,[["render",ia]]),ua={},ca={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function pa(o,t){return e.openBlock(),e.createElementBlock("svg",ca,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"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 ha=R(ua,[["render",pa]]),ma={},fa={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 ga(o,t){return e.openBlock(),e.createElementBlock("svg",fa,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=R(ma,[["render",ga]]),ka={},ba={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function ya(o,t){return e.openBlock(),e.createElementBlock("svg",ba,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 xa=R(ka,[["render",ya]]),_a={},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 Ea(o,t){return e.openBlock(),e.createElementBlock("svg",wa,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 Va=R(_a,[["render",Ea]]),Ca={class:"vs-datatable border rounded-xl w-full flex-grow"},va={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},Ba={class:"relative w-full"},Na={class:"table-wrapper flex gap-2"},Sa={class:"vs-popover inline-block text-slate-700"},Ma={class:"text-center"},Fa={class:""},Aa={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"},$a={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},Da={class:"text-sm items-center text-gray-800 flex gap-1"},Ia={class:"w-full overflow-x-auto"},La={class:"w-full table-auto caption-bottom text-sm"},Ta={class:"[&_tr]:border-b"},Oa={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"},Ra={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"},za={key:0,colspan:"100%",class:"text-center"},ja={class:"w-full"},Ua={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},Pa=["onDragstart","onDragover","onDrop"],Ha={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},Ga={class:"flex items-center justify-center"},qa={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"},Ka={key:0},Za=["src"],Ya={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},Wa=["innerHTML"],Ja={key:2,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"},Xa={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},Qa={class:"flex items-center justify-center gap-2"},er=["onClick"],tr=["onClick"],sr={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},ct=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(o){const t=o,s=e.useModel(o,"modelValue"),n=e.ref({}),l=e.ref(""),a=e.computed(()=>{if(!l.value)return s.value??[];const F=l.value.toLowerCase();return s.value.filter(N=>t.colModel?.some(B=>{const j=N[B.key];return j?Array.isArray(j)?j.join(", ").toLowerCase().includes(F):String(j).toLowerCase().includes(F):!1}))}),r=e.ref(null),i=e.ref(null),d=e.ref(!1),u=e.ref(null),c=e.ref({top:0,left:0}),p=F=>{r.value=F},h=F=>{i.value=F},x=F=>{if(r.value===null||r.value===F){r.value=null,i.value=null;return}const N=[...s.value],[B]=N.splice(r.value,1);N.splice(F,0,B),s.value=N,r.value=null,i.value=null},$=F=>{const B=F.currentTarget.getBoundingClientRect();c.value={top:B.bottom+window.scrollY,left:B.left+window.scrollX},d.value=!d.value},V=()=>{u.value&&u.value.click()},M=F=>{const N=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],B=F.toLowerCase();return N.some(j=>B.endsWith(j))},C=F=>{const B=F.target.files?.[0];if(!B)return;const j=new FileReader;j.onload=P=>{try{const ee=P.target?.result;if(typeof ee=="string"){const ue=JSON.parse(ee);Array.isArray(ue)&&s.value.push(...ue)}}catch(ee){console.error("Error parsing file:",ee)}},j.readAsText(B)},v=()=>{const F=JSON.stringify(s.value,null,2),N=new Blob([F],{type:"application/json"}),B=URL.createObjectURL(N),j=document.createElement("a");j.href=B,j.download="data.json",j.click(),URL.revokeObjectURL(B)};e.onMounted(async()=>{const F=t.colModel?.filter(N=>N.data);F?.length&&Promise.all(F.map(async N=>{const j=await(await fetch(`/api/suggest/${N.data}`)).json();n.value[N.key]=j.data}))});const b=e.ref(""),k=e.ref(!1);let S="edit",U=0;const w=e.ref({}),W=e.ref({});async function X(){b.value="Додати",k.value=!0,S="add",w.value={}}function Q(F,N){const B=N.key||N.name;return n.value[B]&&F[B]?n.value[B].find(j=>j.id.toString()===F[B].toString())?.text??F[B]:F[B]||"-"}async function Z(F,N){b.value="Редагувати",k.value=!0,S="edit",U=N,w.value={...F}}function Ne(){const F=W.value.validate();if(F){G.notify({type:"warning",title:"Помилка валідації",message:Object.entries(F).map(([N,B])=>`${N}: ${B}`).join(`
|
|
2
|
-
`)});return}S==="add"?Array.isArray(s.value)?s.value=[...s.value,w.value]:s.value=[w.value]:s.value=s.value.map((N,B)=>B===U?w.value:N),k.value=!1}function de(F){s.value=s.value.filter((N,B)=>B!==F)}return(F,N)=>(e.openBlock(),e.createElementBlock("div",Ca,[e.createElementVNode("div",va,[e.createElementVNode("div",Ba,[e.createVNode(ta,{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":N[0]||(N[0]=B=>l.value=B),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,l.value]])]),e.createElementVNode("div",Na,[e.createElementVNode("input",{ref_key:"fileInput",ref:u,onChange:C,class:"hidden",accept:".json",type:"file"},null,544),e.createElementVNode("div",Sa,[e.createElementVNode("div",Ma,[e.createElementVNode("div",Fa,[e.createElementVNode("button",{onClick:$,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(aa,{height:"16",width:"16"})])])])])]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[d.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:e.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:c.value.top+"px",left:c.value.left+"px"}])},[e.createElementVNode("div",Aa,[e.createElementVNode("div",$a,[e.createElementVNode("button",{onClick:V,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createVNode(da,{class:"text-black",width:"14",height:"14"}),N[4]||(N[4]=e.createTextVNode(" Імпортувати ",-1))]),e.createElementVNode("button",{onClick:v,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createElementVNode("span",Da,[e.createVNode(ha,{class:"text-black",width:"14",height:"14"}),N[5]||(N[5]=e.createTextVNode(" Експортувати ",-1))])])])])],4)):e.createCommentVNode("",!0)])),e.createElementVNode("button",{onClick:X,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(_e),N[6]||(N[6]=e.createTextVNode(" Додати ",-1))])]),e.createElementVNode("div",Ia,[e.createElementVNode("table",La,[e.createElementVNode("thead",Ta,[e.createElementVNode("tr",Oa,[e.createElementVNode("th",Ra,[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(F.colModel,B=>(e.openBlock(),e.createElementBlock("th",{key:B.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(B.ua||B.label),1))),128)),N[7]||(N[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",za,[e.createElementVNode("div",ja,[e.createElementVNode("div",Ua,[e.createVNode(xa,{class:"w-48 mx-auto"}),N[8]||(N[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,(B,j)=>(e.openBlock(),e.createElementBlock("tr",{key:B.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===j,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":i.value===j}]),draggable:"true",onDragstart:P=>p(j),onDragover:e.withModifiers(P=>h(j),["prevent"]),onDrop:P=>x(j)},[e.createElementVNode("td",Ha,[e.createElementVNode("div",Ga,[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(F.colModel,P=>(e.openBlock(),e.createElementBlock("td",{key:P.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[P.type==="file"?(e.openBlock(),e.createElementBlock("div",qa,[M(Q(B,P))?(e.openBlock(),e.createElementBlock("div",Ka,[e.createElementVNode("img",{src:Q(B,P),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,Za)])):(e.openBlock(),e.createElementBlock("div",Ya,[e.createVNode(st,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):P.type==="tiptap-editor"?(e.openBlock(),e.createElementBlock("div",{key:1,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",innerHTML:Q(B,P)},null,8,Wa)):(e.openBlock(),e.createElementBlock("div",Ja,e.toDisplayString(Q(B,P)),1))]))),128)),e.createElementVNode("td",Xa,[e.createElementVNode("div",Qa,[e.createElementVNode("button",{onClick:P=>Z(B,j),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(Va,{width:"24",height:"24",class:"w-3 h-3"})],8,er),e.createElementVNode("button",{onClick:P=>de(j),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-red-50 dark:hover:bg-slate-600 hover:border-red-300 dark:hover:border-slate-500 hover:text-red-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[e.createVNode(Fe,{width:"24",height:"24",class:"w-3 h-3"})],8,tr)])])],42,Pa))),128))],2)])]),e.createVNode(e.unref(G.VsModal),{visible:k.value,title:b.value,size:"lg"},{default:e.withCtx(()=>[e.createVNode(me,{schema:t.colModel,values:w.value,"onUpdate:values":N[1]||(N[1]=B=>w.value=B),form:W.value,"onUpdate:form":N[2]||(N[2]=B=>W.value=B)},null,8,["schema","values","form"]),e.createElementVNode("div",sr,[e.createElementVNode("button",{type:"button",onClick:N[3]||(N[3]=B=>k.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:Ne,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])]),_:1},8,["visible","title"])]))}}),nr={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:"Клацніть на шари, щоб видалити їх"}}}}};function we(o){return o?o.type==="Polygon"?{type:"MultiPolygon",coordinates:[o.coordinates]}:o.type==="Feature"?{...o,geometry:we(o.geometry)}:o.type==="FeatureCollection"?{...o,features:(o.features||[]).map(t=>we(t)).filter(Boolean)}:o:null}function lr(o){return o?o.type==="FeatureCollection"||o.type==="Feature"?we(o):o.geom?{type:"Feature",geometry:we({type:o.geom.type,coordinates:o.geom.coordinates}),properties:{}}:o.type&&o.coordinates?{type:"Feature",geometry:we(o),properties:{}}:null:null}const ar={},rr={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 or(o,t){return e.openBlock(),e.createElementBlock("svg",rr,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 ir=R(ar,[["render",or]]),dr={},ur={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 cr(o,t){return e.openBlock(),e.createElementBlock("svg",ur,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"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 pr=R(dr,[["render",cr]]),hr={},mr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function fr(o,t){return e.openBlock(),e.createElementBlock("svg",mr,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 gr=R(hr,[["render",fr]]),kr={},br={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 yr(o,t){return e.openBlock(),e.createElementBlock("svg",br,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 xr=R(kr,[["render",yr]]),_r={},wr={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 Er(o,t){return e.openBlock(),e.createElementBlock("svg",wr,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 Vr=R(_r,[["render",Er]]),Cr={class:"form-geom__search"},vr={class:"map-search__input"},Br={class:"flex flex-nowrap relative"},Nr={class:"form-autocomplete relative min-w-[6rem] vsTailwind map-search__select hidden"},Sr={class:"flex items-center w-full"},Mr={class:"max-w-[90%] truncate"},Fr={key:0,class:"absolute z-[3100] mt-0.5 left-0 right-0"},Ar={class:"form-autocomplete__wrapper mt-[10px] z-50 w-full min-w-36 max-h-72 p-0 space-y-0.5 bg-white rounded-xl shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] dark:bg-neutral-900 top-full opened"},$r={class:"form-autocomplete__list vsTailwind px-2 pb-2 pt-0 max-h-200 relative [&::-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 dark:bg-neutral-900"},Dr=["onClick"],Ir={class:"flex justify-between items-center w-full"},Lr={class:"flex items-center"},Tr={key:0,class:"flex-shrink-0 w-3.5 h-3.5 text-blue-600",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Or={class:"relative w-full"},Rr={class:"vs-form-text relative bg-white rounded-lg"},zr={key:1,class:"absolute left-0 right-0 top-full z-[3200] bg-white border border-gray-200 rounded-b-lg shadow-lg max-h-72 overflow-auto"},jr={key:0},Ur=["onClick"],Pr={key:1,class:"px-3 py-2 text-xs text-gray-500"},Hr={key:2,class:"px-3 py-2 text-xs text-gray-400"},Gr=e.defineComponent({__name:"map-search",props:{placeholder:{default:"50, 30"}},emits:["goToCoordinates"],setup(o,{emit:t}){const s=t,n=e.ref(!1),l=e.ref("coordinates"),a=e.ref(""),r=e.ref([]),i=e.ref(!1),d=e.ref(!1);let u;const c=[{value:"coordinates",label:"Пошук по кординатам"},{value:"atu",label:"АТУ"},{value:"address",label:"Адресса"},{value:"search_here",label:"Пошук HERE"}],p=e.computed(()=>c.find(v=>v.value===l.value)?.label??"АТУ");function h(v){l.value=v.value,n.value=!1,a.value="",a.value&&V()}function x(v){v.target.closest(".map-search__input")||(n.value=!1)}e.onMounted(()=>document.addEventListener("click",x)),e.onUnmounted(()=>document.removeEventListener("click",x));async function $(v){let b;l.value==="atu"?b="/api/suggest/atu.nsdi.ato_level":l.value==="address"?b="/api/suggest/map.address_id":l.value==="search_here"&&(b="/api/gis-url-proxy");const k=new URL(b||"");return l.value==="search_here"?k.searchParams.set("searchtext",v):(l.value==="atu"||l.value==="address")&&k.searchParams.set("key",v),k.searchParams.set("limit","20"),k.searchParams.set("q",v),(await fetch(k.toString())).json()}function V(){if(i.value=!0,d.value=!0,l.value==="coordinates"){const v=a.value.trim().split(",");if(v.length===2){const b=parseFloat(v[0]),k=parseFloat(v[1]);!Number.isNaN(b)&&!Number.isNaN(k)&&s("goToCoordinates",[b,k])}return}u&&window.clearTimeout(u),u=window.setTimeout(async()=>{const v=a.value.trim();if(!v){r.value=[],d.value=!1;return}try{const b=await $(v);r.value=Array.isArray(b.features)?b.features:[]}catch{r.value=[]}finally{d.value=!1}},300)}function M(){a.value="",r.value=[],i.value=!1,d.value=!1}function C(v){s("goToCoordinates",v),i.value=!1,d.value=!1,r.value=[]}return(v,b)=>(e.openBlock(),e.createElementBlock("div",Cr,[e.createElementVNode("div",vr,[e.createElementVNode("div",Br,[e.createElementVNode("div",Nr,[e.createElementVNode("button",{type:"button",onClick:b[0]||(b[0]=k=>n.value=!n.value),class:"h-[40px] relative px-4 pe-9 flex text-nowrap w-full cursor-pointer bg-white border border-solid border-stone-200 rounded-lg text-start text-sm text-stone-800 focus:outline-none focus:ring-1 focus:ring-blue-600 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-200"},[e.createElementVNode("div",Sr,[e.createElementVNode("span",Mr,e.toDisplayString(p.value),1)]),b[3]||(b[3]=e.createElementVNode("svg",{class:"stroke-gray-500 absolute right-3 translate-y-1/2 bottom-1/2",width:"15",height:"15",viewBox:"0 0 24 24",fill:"none"},[e.createElementVNode("path",{d:"M6 9l6 6 6-6","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1))]),n.value?(e.openBlock(),e.createElementBlock("div",Fr,[e.createElementVNode("div",Ar,[e.createElementVNode("div",$r,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(c,k=>e.createElementVNode("div",{onClick:S=>h(k),key:k.value,class:"form-autocomplete__item cursor-pointer hs-selected:bg-stone-100 dark:hs-selected:bg-neutral-800 py-2 px-4 w-full text-sm text-gray-800 hover:bg-gray-100 rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:hover:bg-neutral-800 dark:text-neutral-200 dark:focus:bg-neutral-800 cursor-default"},[e.createElementVNode("div",Ir,[e.createElementVNode("div",Lr,[e.createElementVNode("div",null,e.toDisplayString(k.label),1)]),k.value===l.value?(e.openBlock(),e.createElementBlock("svg",Tr,b[4]||(b[4]=[e.createElementVNode("polyline",{points:"20 6 9 17 4 12"},null,-1)]))):e.createCommentVNode("",!0)])],8,Dr)),64))])])])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Or,[e.createElementVNode("div",Rr,[b[6]||(b[6]=e.createElementVNode("i",{class:"absolute bottom-1/2 translate-y-1/2 left-3 text-gray-500"},[e.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},[e.createElementVNode("circle",{cx:"11",cy:"11",r:"8","stroke-width":"2"}),e.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65","stroke-width":"2"})])],-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":b[1]||(b[1]=k=>a.value=k),onInput:V,onFocus:b[2]||(b[2]=k=>i.value=!0),placeholder:"lat, lng ex. 50, 30",class:"bg-white h-[38px] text-sm py-2 px-3 ps-9 pe-8 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg 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,544),[[e.vModelText,a.value]]),a.value?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:M,class:"absolute right-2 bottom-1/2 translate-y-1/2 text-gray-500 hover:text-red-500","aria-label":"Очистити",type:"button"},b[5]||(b[5]=[e.createElementVNode("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]))):e.createCommentVNode("",!0),i.value&&l.value!=="coordinates"?(e.openBlock(),e.createElementBlock("div",zr,[r.value.length?(e.openBlock(),e.createElementBlock("ul",jr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,k=>(e.openBlock(),e.createElementBlock("li",{key:k.properties.place_id,onClick:S=>C(k),class:"px-3 py-2 text-sm cursor-pointer hover:bg-gray-100"},e.toDisplayString(k.properties.display_name),9,Ur))),128))])):d.value?(e.openBlock(),e.createElementBlock("div",Pr,"Шукаю…")):(e.openBlock(),e.createElementBlock("div",Hr,"Нічого не знайдено"))])):e.createCommentVNode("",!0)])])])])]))}}),qr={class:"bg-white/95 p-2 rounded-xl shadow border border-gray-200"},Kr={class:"flex gap-2"},Zr=["onClick","title"],Yr=["src"],Wr=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(o,{emit:t}){const s=o,n=e.ref(Object.keys(s.basemaps)[0]),l=t;function a(r){l("onLayerChange",r),n.value=r}return(r,i)=>(e.openBlock(),e.createElementBlock("div",qr,[e.createElementVNode("div",Kr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.basemaps,(d,u)=>(e.openBlock(),e.createElementBlock("div",{key:u,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":n.value===u}]),onClick:c=>a(u),title:d.name||u,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:d.preview,alt:"",class:"w-14 h-14 object-cover"},null,8,Yr)],10,Zr))),128))])]))}}),Jr={class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},Xr={class:"form-geom__panel flex gap-1 items-start mt-2"},Qr={class:"flex items-center gap-1"},eo=["disabled"],to={class:"absolute top-4 right-4 z-[1000]"},so={class:"flex flex-col gap-[2px]"},no=["aria-pressed"],lo=["aria-pressed"],ao=["aria-pressed"],ro=["aria-pressed"],oo={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"},io={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},uo={class:"mr-auto"},co={class:"font-bold"},po={class:"flex items-center"},ho={class:"text-xs mr-2"},mo={key:0,class:"text-xs"},fo={key:1,class:"text-xs"},pt=R(e.defineComponent({__name:"vs-input-map",props:{tools:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(o,{emit:t}){const s=e.getCurrentInstance(),n=o,l=t,a=e.ref(null);let r,i,d;const u=e.ref(null),c=e.ref(null),p=e.ref(6),h=e.ref(0),x=e.ref(s?.appContext.config.globalProperties.$settings?.center||[50,30]),$=e.ref(null),V=ee();let M;const C=e.ref("topo100");function v(g){return g?g.type==="Polygon"?{type:"MultiPolygon",coordinates:[g.coordinates]}:(g.type==="MultiPolygon",g):null}function b(){return new Promise((g,y)=>{window.L&&window.L.Draw&&g(0);const I=H=>{if(Array.from(document.styleSheets).some(ie=>ie?.href?.includes(H)))return;const ce=document.createElement("link");ce.rel="stylesheet",ce.href=H,document.head.appendChild(ce)},z=H=>new Promise((ne,ce)=>{const ie=Array.from(document.scripts).find(ge=>ge.src===H);if(ie){ie.addEventListener("load",()=>ne()),ie.addEventListener("error",ge=>ce(ge));return}const fe=document.createElement("script");fe.src=H,fe.async=!0,fe.onload=()=>ne(),fe.onerror=ge=>ce(ge),document.body.appendChild(fe)});I("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),I("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),z("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>z("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js")).then(()=>g(0)).catch(y)})}function k(){const g=i.toGeoJSON(),y=[],I=H=>{if(H)switch(H.type){case"Polygon":y.push(H.coordinates);break;case"MultiPolygon":y.push(...H.coordinates);break;case"GeometryCollection":(H.geometries||[]).forEach(I);break}};(g?.features||[]).forEach(H=>I(H.geometry));const z=y.length?{type:"MultiPolygon",coordinates:y}:null;l("update:modelValue",z?v(z):null),h.value=i.getLayers().length}function S(g=30){const y=i.getLayers();if(!y.length)return;const z=L.featureGroup(y).getBounds();z&&z.isValid()&&r.fitBounds(z,{padding:[g,g]})}function U(){u.value?.click()}const w=e.ref("");function W(g){return g instanceof L.Circle?"Circle":g instanceof L.Rectangle?"Rectangle":g instanceof L.Polygon&&!(g instanceof L.Rectangle)?"Polygon":g instanceof L.Polyline&&!(g instanceof L.Polygon)?"Polyline":g instanceof L.Marker?"Point":"Feature"}function X(g){if(g instanceof L.Circle){const y=g.getRadius();return Math.PI*(y*y)/1e6}if(g instanceof L.Polygon||g instanceof L.Rectangle)try{const y=g.getLatLngs(),I=Array.isArray(y[0])?y[0]:y,z=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea(I):0;return z?z/1e6:0}catch{return null}return null}function Q(g){return g instanceof L.Circle?g.getLatLng():g.getBounds?g.getBounds().getCenter():g.getLatLng?g.getLatLng():r.getCenter()}function Z(){const g=i.getLayers();if(!g.length){$.value=null,h.value=0;return}const y=g[g.length-1],I=W(y),z=Q(y),H=X(y);$.value={type:I,center:z,areaKm2:H,layer:y},h.value=g.length}function Ne(){const g=$.value?.layer;g&&(g instanceof L.Circle&&g.getBounds?r.fitBounds(g.getBounds(),{padding:[30,30]}):g.getBounds?r.fitBounds(g.getBounds(),{padding:[30,30]}):g.getLatLng&&r.setView(g.getLatLng(),Math.max(p.value,14)))}function de(){const g=$.value?.layer;g&&(i.removeLayer(g),k(),Z())}e.onMounted(async()=>{await b(),L.drawLocal=nr,r=L.map(a.value,{zoomControl:!1}).setView(x.value,10),L.control.zoom({position:"bottomright"}).addTo(r),C.value=Object.keys(V)[0],M=L.tileLayer(V[C.value].url,{maxZoom:19,minZoom:6}).addTo(r),i=new L.FeatureGroup().addTo(r),r.on(L.Draw.Event.CREATED,I=>{const{layer:z}=I;i.clearLayers(),i.addLayer(z),k(),Z(),S(),w.value=""}),r.on(L.Draw.Event.EDITED,()=>{k(),Z(),S()}),r.on(L.Draw.Event.DELETED,()=>{k(),Z(),S()});let g=!1;r.on("mousemove",I=>{g||(r.invalidateSize(),g=!0),c.value=I.latlng}),r.on("zoomend",()=>{p.value=r.getZoom()});const y=lr(n.modelValue);if(y){const I=[];L.geoJSON(y).eachLayer(z=>I.push(z)),I.length&&i.addLayer(I[0]),k(),Z(),S()}});function F(g){if(r){switch(d&&d.disable(),g){case"marker":d=new L.Draw.Marker(r);break;case"polyline":d=new L.Draw.Polyline(r);break;case"polygon":d=new L.Draw.Polygon(r);break;case"rectangle":d=new L.Draw.Rectangle(r);break;default:d=new L.Draw.Rectangle(r);break}d&&(d.enable(),w.value=g)}}function N(){const g=i.toGeoJSON(),y=new Blob([JSON.stringify(g,null,2)],{type:"application/json"}),I=URL.createObjectURL(y),z=document.createElement("a");z.href=I,z.download="data.geojson",z.click(),URL.revokeObjectURL(I)}function B(g){const y=g.target.files?.[0];if(!y)return;const I=new FileReader;I.onload=()=>{if(typeof I.result=="string")try{const z=JSON.parse(I.result);i.clearLayers(),z&&L.geoJSON({type:"Feature",geometry:z}).eachLayer(H=>{i.addLayer(H)}),k(),Z(),S()}finally{g.target.value=""}},I.readAsText(y)}function j(g){r&&(M&&r.removeLayer(M),M=L.tileLayer(V[g].url,{maxZoom:19,minZoom:6}).addTo(r),C.value=g)}function P(g){const y=L.latLng(g[0],g[1]);r.setView(y,13)}e.watch(()=>n.modelValue,g=>{console.log("update map");const y=v(g);if(g&&y!==g){l("update:modelValue",y);return}i.clearLayers(),y&&L.geoJSON({type:"Feature",geometry:y}).eachLayer(I=>{i.addLayer(I),I.dragging?.enable(),I.dragging?.enabled(),I.on("dragend",z=>{const ne=z.target.getLatLng();l("update:modelValue",{type:"Point",coordinates:[ne.lng,ne.lat]})})}),h.value=i.getLayers().length,Z(),S()});function ee(){return s?.appContext.config.globalProperties.$settings?.basemaps?s?.appContext.config.globalProperties.$settings?.basemaps.map((g,y)=>Object.assign(g,{key:`b${y}`,preview:g.preview||g.url.replace("{z}/{x}/{y}.png","13/4790/2762.png")})).reduce((g,y)=>({...g,[y.key]:y}),{}):{topo100:{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:{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:{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 ue=e.ref(!1);return e.watch(ue,()=>{setTimeout(()=>{r.invalidateSize()},50)}),(g,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:ue.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:a,class:"w-full h-full"},null,512),e.createElementVNode("div",Jr,[e.createVNode(Gr,{onGoToCoordinates:P}),e.createElementVNode("div",Xr,[e.createElementVNode("div",Qr,[e.createElementVNode("button",{type:"button",class:"vs-btn-row",onClick:U},"Import"),e.createElementVNode("button",{type:"button",class:"vs-btn-row",onClick:N,disabled:h.value===0},"Export ",8,eo)]),e.createElementVNode("input",{ref_key:"importRef",ref:u,type:"file",onChange:B,accept:".json,.geojson",class:"hidden"},null,544)])]),e.createElementVNode("div",to,[e.createElementVNode("div",so,[e.createElementVNode("button",{class:e.normalizeClass(["vs-btn",{"vs-active":w.value==="marker"}]),"aria-pressed":w.value==="marker",title:"Point (P)","aria-label":"Draw point",onClick:y[0]||(y[0]=I=>F("marker"))},[e.createVNode(ir)],10,no),e.createElementVNode("button",{class:e.normalizeClass(["vs-btn",{"vs-active":w.value==="polyline"}]),"aria-pressed":w.value==="polyline",title:"Line (L)","aria-label":"Draw polyline",onClick:y[1]||(y[1]=I=>F("polyline"))},[e.createVNode(pr)],10,lo),e.createElementVNode("button",{class:e.normalizeClass(["vs-btn",{"vs-active":w.value==="polygon"}]),"aria-pressed":w.value==="polygon",title:"Polygon (G)","aria-label":"Draw polygon",onClick:y[2]||(y[2]=I=>F("polygon"))},[e.createVNode(gr)],10,ao),e.createElementVNode("button",{class:e.normalizeClass(["vs-btn",{"vs-active":w.value==="rectangle"}]),"aria-pressed":w.value==="rectangle",title:"Rectangle (R)","aria-label":"Draw rectangle",onClick:y[3]||(y[3]=I=>F("rectangle"))},[e.createVNode(xr)],10,ro),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:y[4]||(y[4]=I=>{ue.value=!ue.value}),title:"Full Screen","aria-label":"Full Screen"},[e.createVNode(Vr,{style:{width:"12px",height:"12px"}})])])]),e.createElementVNode("div",{class:e.normalizeClass(["absolute left-4 z-[1000]",$.value?"bottom-8":"bottom-4"])},[e.createVNode(Wr,{basemaps:e.unref(V),onOnLayerChange:j},null,8,["basemaps"])],2),e.createElementVNode("div",oo,[$.value?(e.openBlock(),e.createElementBlock("div",io,[e.createElementVNode("div",uo,[y[7]||(y[7]=e.createTextVNode(" Тип: ",-1)),e.createElementVNode("span",co,e.toDisplayString($.value.type),1)]),e.createElementVNode("div",po,[e.createElementVNode("div",ho,[y[8]||(y[8]=e.createTextVNode(" Центр: ",-1)),e.createElementVNode("b",null,e.toDisplayString($.value.center.lat.toFixed(5))+", "+e.toDisplayString($.value.center.lng.toFixed(5)),1)]),$.value.areaKm2!==null?(e.openBlock(),e.createElementBlock("div",mo,[y[9]||(y[9]=e.createTextVNode(" Площа: ",-1)),e.createElementVNode("b",null,e.toDisplayString($.value.areaKm2.toFixed(1))+"км²",1)])):(e.openBlock(),e.createElementBlock("div",fo,y[10]||(y[10]=[e.createTextVNode(" Площа: ",-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:"Наблизити",onClick:y[5]||(y[5]=I=>Ne())},y[11]||(y[11]=[e.createStaticVNode('<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" data-v-44f47a6f><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" data-v-44f47a6f></path><path d="M7 10l6 0" data-v-44f47a6f></path><path d="M10 7l0 6" data-v-44f47a6f></path><path d="M21 21l-6 -6" data-v-44f47a6f></path></svg>',1)])),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:"Видалити",onClick:y[6]||(y[6]=I=>de())},[e.createVNode(Fe,{class:"w-3 h-3"})])])])):e.createCommentVNode("",!0)])],2))}}),[["__scopeId","data-v-44f47a6f"]]),go=["data-focus"],ko={class:"flex items-center"},bo={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},yo=["onClick","aria-label"],xo={key:0,class:"absolute text-gray-500 truncate pl-2"},_o={class:"flex-1 min-w-[2px]"},wo=["placeholder"],Eo={class:"flex items-center shrink-0"},Vo=["disabled"],ht=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(o,{emit:t}){const s=o,n=t;se(s.style);const l=e.ref(null),a=e.ref(null),r=e.ref(null),i=e.ref(!1),d=e.ref(""),u=e.useModel(o,"modelValue"),c=e.computed(()=>s.placeholder||"Add tag…"),p=e.computed(()=>u.value?.length===0&&d.value===""),h=e.computed(()=>!s.disabled&&u.value?.length>0),x=e.computed(()=>s.disabled),$=async()=>{x.value||await e.nextTick(()=>r.value?.focus())},V=U=>{const w=U.trim();w!==""&&(!u.value||!Array.isArray(u.value)?u.value=[w]:s.unique?u.value.includes(w)||(u.value=[...u.value,w]):u.value=[...u.value,w],d.value="")},M=()=>{const U=d.value;U.trim()!==""&&V(U),d.value=""},C=U=>{const w=u.value.slice();w.splice(U,1),n("update:modelValue",w)},v=()=>{n("update:modelValue",[])},b=()=>{x.value||(i.value=!0)},k=()=>{i.value=!1},S=U=>{const{key:w}=U;w==="Enter"?(U.preventDefault(),M()):w==="Backspace"&&d.value===""&&u.value.length>0&&C(u.value.length-1)};return(U,w)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:l,onClick:w[1]||(w[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",s.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":"",x.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:$},[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(u.value,(W,X)=>(e.openBlock(),e.createElementBlock("div",{key:X,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",ko,[e.createElementVNode("div",bo,e.toDisplayString(W),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(Q=>C(X),["stop"]),"aria-label":`Remove ${W}`},w[2]||(w[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,yo)]))),128)),p.value?(e.openBlock(),e.createElementBlock("div",xo,e.toDisplayString(c.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",_o,[x.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":w[0]||(w[0]=W=>d.value=W),onFocus:b,onBlur:k,onKeydown:S,placeholder:u.value&&u.value.length?"":void 0},null,40,wo)),[[e.vModelText,d.value]])])],512),e.createElementVNode("div",Eo,[h.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:x.value,onClick:e.withModifiers(v,["stop"])},w[3]||(w[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,Vo)):e.createCommentVNode("",!0)])],10,go)],2)],512))}}),Co={class:"relative flex gap-1 bg-white w-full"},vo=["disabled","placeholder"],mt=R(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const t=e.inject("values"),s=o,n=e.useModel(o,"modelValue");function l(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(d=>i[d]||d).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const a=()=>{const r=t?.value?.[s.parent||""]?.toString(),i=l(r);n.value=i.toString()};return(r,i)=>(e.openBlock(),e.createElementBlock("div",Co,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:r.disabled,placeholder:r.placeholder,"onUpdate:modelValue":i[0]||(i[0]=d=>n.value=d),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,vo),[[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"]]),Bo={class:"w-full"},No={ref:"sortableContainer",class:"flex flex-col gap-1"},So=["onDragstart","onDrop"],Mo={class:"w-1/3"},Fo={class:"w-2/3"},Ao=["onClick"],$o={key:0,class:"text-[14px] text-gray-700"},Do={class:"mt-2 w-full flex items-center"},Io=["disabled"],ft=R(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(o,{emit:t}){const s=M=>`${M}-${Math.random().toString(36).substring(2,15)}`,n=e.inject("values"),l=o,a=t,r=l.addButtonText??"Додати",i=l.ignore??[],d=e.ref([]),u=e.ref(null);(()=>{const M=l.parent&&n?.value?.[l.parent]||l.modelValue||{};d.value=Object.entries(M).filter(([C])=>!i.includes(C)).map(([C,v])=>({id:s("key-value-"),key:C,value:v}))})();function p(M){u.value=M}function h(M){if(u.value===null||u.value===M)return;const C=d.value.splice(u.value,1)[0];d.value.splice(M,0,C),u.value=null}const x=e.computed(()=>d.value.some(M=>M.key&&!M.value||!M.key&&M.value)),$=()=>{d.value.push({id:s("key-value-"),key:"",value:""})},V=M=>{d.value=d.value.filter(C=>C.id!==M)};return e.watch(d,M=>{const C={};M.forEach(b=>{b.key&&b.value!==void 0&&(C[b.key]=b.value)});const v={};i.length&&i.forEach(b=>{v[b]=l.parent?n?.value?.[l.parent]?.[b]:void 0}),n?.value&&l.parent&&(n.value[l.parent]={...v,...C}),a("update:modelValue",C)},{deep:!0}),(M,C)=>(e.openBlock(),e.createElementBlock("div",Bo,[e.createElementVNode("div",No,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(v,b)=>(e.openBlock(),e.createElementBlock("div",{key:v.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":u.value===b}]),draggable:"true",onDragstart:k=>p(b),onDragover:C[0]||(C[0]=e.withModifiers(()=>{},["prevent"])),onDrop:k=>h(b)},[C[1]||(C[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",Mo,[e.createVNode(xe,{modelValue:v.key,"onUpdate:modelValue":k=>v.key=k,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Fo,[e.createVNode(xe,{modelValue:v.value,"onUpdate:modelValue":k=>v.value=k,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:k=>V(v.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(Os),{height:"16",width:"16"})],8,Ao)],42,So))),128))],512),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",$o," Дані для відображення відсутні ")),e.createElementVNode("div",Do,[e.createElementVNode("button",{type:"button",onClick:$,disabled:x.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(_e,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(r)),1)],8,Io)])]))}}),[["__scopeId","data-v-a0f7fbfc"]]),Lo={class:"flex items-center gap-2 w-full"},To=["disabled"],gt=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(o,{emit:t}){const s=o,{inputClass:n}=se(s.style),l=t,a=e.computed({get:()=>s.modelValue||"#000000",set:r=>l("update:modelValue",r)});return(r,i)=>(e.openBlock(),e.createElementBlock("div",Lo,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),disabled:r.disabled,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[r.modelValue?"":"text-opacity-50",e.unref(n)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,To),[[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":i[1]||(i[1]=d=>a.value=d)},null,512),[[e.vModelText,a.value]])]))}}),Oo={class:"flex items-center gap-2 w-full"},Ro=["min","max","step","disabled"],kt=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(o,{emit:t}){const s=o,{inputClass:n}=se(s.style),l=t,a=e.computed({get:()=>Number(s.modelValue??s.min),set:r=>l("update:modelValue",Number(r))});return(r,i)=>(e.openBlock(),e.createElementBlock("div",Oo,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),min:r.min,max:r.max,step:r.step,disabled:r.disabled,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[r.modelValue?"":"text-opacity-50",e.unref(n)].join(" ")])},null,10,Ro),[[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":i[1]||(i[1]=d=>a.value=d)},null,512),[[e.vModelText,a.value]])]))}}),bt={VsInputText:xe,VsInputRadio:je,"vs-input-text":xe,"vs-input-password":hs,"vs-input-textarea":dt,"vs-input-mask":Je,"vs-input-number":Ye,"vs-input-radio":je,"vs-input-select":Ue,"vs-input-switcher":Re,"vs-input-static":ze,"vs-input-container":it,"vs-input-date":et,"vs-input-checkbox":Qe,"vs-input-file":at,"vs-input-html":ze,"vs-input-email":Xe,"vs-input-datatable":ct,"vs-input-map":pt,"vs-input-file-list":rt,"vs-input-tag":ht,"vs-input-slug":mt,"vs-input-key-value":ft,"vs-input-range":kt,"vs-input-color":gt,"vs-input-native-select":Ue},zo=e.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(o){const t=o,s=e.inject("values");async function n(){try{if(!t.api)return;const l=t.api.replace("{{value}}",t.value),a=await fetch(l);if(!a.ok){G.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const r=await a.json();if(!t.set||!s)return;for(const[i,d]of Object.entries(t.set))s.value[i]=r.result[d]}catch(l){console.error(t.error,l)}}return(l,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(l.button),1))}}),jo={class:"flex flex-col gap-1 w-full"},Uo={key:0,class:"text-sm text-gray-500"},yt=e.defineComponent({__name:"vs-compact-form-layout",props:e.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const t=o,s=e.useModel(o,"modelValue"),n=e.computed(()=>cs[`${t.layout}`]),l=e.computed(()=>bt?.[`vs-input-${t.item.type}`]),a=e.computed(()=>{const i=e.unref(l);if(!i)return new Set;const d=i.props??i.__vccOpts?.props;if(!d)return new Set;const u=Array.isArray(d)?d:Object.keys(d);return new Set(u)}),r=e.computed(()=>{const i=t.item??{},d=a.value;return d.size?Object.fromEntries(Object.entries(i).filter(([u])=>d.has(u))):{}});return(i,d)=>e.withDirectives((e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.value),{ua:t.item.ua,error:t.error||"",item:i.item,label:t.item.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${t.item.type}-component`])},[e.createElementVNode("div",jo,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.value),e.mergeProps(r.value,{modelValue:s.value,"onUpdate:modelValue":d[0]||(d[0]=u=>s.value=u)}),null,16,["modelValue"])),i.item.description?(e.openBlock(),e.createElementBlock("p",Uo,e.toDisplayString(i.item.description),1)):e.createCommentVNode("",!0)]),i.item.behavior?.api&&i.item.behavior?.button?(e.openBlock(),e.createBlock(zo,e.mergeProps({key:0},i.item.behavior,{value:s.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","label"])),[[e.vShow,!i.item.hidden]])}}),xt={required:"Це поле є обов’язковим",email:"Неправильний email"},Po=o=>o?!1:xt.required,Ho=o=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return o?t.test(o)?!1:xt.email:!1},Go=(o,t)=>{const s=t.pattern??t.regexp;return!(typeof s=="string"?new RegExp(s):s).test(o)&&o?t.message:!1},qo=(o,t)=>!1,Ko=(o,t)=>{switch(typeof t=="string"?t:t.type){case"required":return Po(o);case"email":return Ho(o);case"regexp":return Go(o,t);case"custom":return qo();default:return!1}},Zo={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file"};function _t(o){const t=o.toLowerCase();return Zo[t]||t}function Yo(o,t=!1){if(Array.isArray(o)){const n=[];return o.forEach(l=>{const a={...l};a.name=(l.name||l.id||l.key||"").toString(),a.type=_t(l.type),a.label=l.label||l.ua,a.rules=l.rules||l.validators,a.type==="email"&&!a.rules&&(a.rules=["email"]),l.data&&(a.api=`/api/suggest/${l.data}`),a.disabled=t||a.disabled,n.push(a)}),n}const s=[];return Object.entries(o).forEach(n=>{const l={name:n[0],...n[1],type:_t(n[1].type),label:n[1].label||n[1].ua,rules:n[1].rules||n[1].validators,disabled:t};l.type==="email"&&!l.rules&&(l.rules=["email"]),n[1].type.includes("list")&&(l.multiple=!0),!l.api&&n[1].data&&(l.api=`/api/suggest/${n[1].data}`),s.push(l)}),s}function Wo(o,t,s=!1){const n=e.computed(()=>Yo((Array.isArray(t),t),typeof s=="boolean"?s:s.value)),l=e.ref({});function a(u){const c=u?.conditions;if(!c)return!0;const p=Array.isArray(c)?c[0]:c,h=o?.value?.[p];return ot(h,c)}const r=(u=n.value,c=!0)=>(u.forEach(p=>{if(p.rules){if(!a(p)){delete l.value[p.name];return}p.rules.forEach(h=>{const x=Ko(o.value[p.name],h);x?l.value[p.name]=x:delete l.value[p.name]})}p.schema&&r(p.schema,!1)}),c&&Object.values(l.value).some(Boolean)?l.value:null),i=e.computed(()=>n.value?.filter(u=>a(u)));return{errors:l,validate:r,reset:()=>{o.value={},l.value={}},visibleSchema:i}}const Jo={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},me=e.defineComponent({__name:"vs-compact-form",props:e.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:e.mergeModels(["handle-submit","update:modelValue"],["update:form","update:values"]),setup(o,{expose:t,emit:s}){const n=s,l=o,a=e.useModel(o,"form"),r=e.useModel(o,"values"),{errors:i,validate:d,reset:u,visibleSchema:c}=Wo(r,l.schema,e.toRef(l,"disabled")),p=()=>{n("update:modelValue",r.value),d(),n("handle-submit",r.value)};t({validate:d,reset:u,errors:i}),e.onMounted(()=>{l.modelValue&&(r.value=l.modelValue),a.value.value=r.value,a.value.errors=i.value,a.value.reset=u,a.value.validate=d,a.value.formId=l.formId});function h(x,$){if(x===$)return!0;if(typeof x!="object"||typeof $!="object"||!x||!$)return!1;const V=Object.keys(x),M=Object.keys($);return V.length!==M.length?!1:V.every(C=>x[C]===$[C])}return e.provide("form",a),e.provide("values",r),e.watch(a.value,x=>{console.log("form",x)}),(x,$)=>(e.openBlock(),e.createElementBlock("form",{onSubmit:e.withModifiers(p,["prevent"]),class:e.normalizeClass(["grid grid-cols-12",x.layout==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(c),(V,M)=>(e.openBlock(),e.createElementBlock("div",{key:V.name,class:e.normalizeClass(x.layout==="horizontal"?"col-span-12":`col-span-${V.col||12}`)},[e.createVNode(yt,{style:e.normalizeStyle(x.style),item:V,layout:x.layout,"model-value":r.value[V.name],"onUpdate:modelValue":C=>{const v=r.value[V.name];h(v,C)||(r.value[V.name]=C)},error:e.unref(i)[V.name]},null,8,["style","item","layout","model-value","onUpdate:modelValue","error"]),x.layout==="settings"&&M+1!==e.unref(c).length?(e.openBlock(),e.createElementBlock("div",Jo)):e.createCommentVNode("",!0)],2))),128))],34))}}),Xo={class:"relative"},Qo={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},ei={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"},ti={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},si={class:"font-medium text-gray-800 dark:text-[#ffffff]"},ni={class:"p-4 mim-h-0 h-full overflow-auto"},wt=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(o,{emit:t}){const s=o,n=t,l=e.ref(s.schema),a=e.ref(s.defaultValue?JSON.parse(JSON.stringify(s.defaultValue)):{}),r=e.ref({}),i=e.ref(),d=e.ref(s.mode);async function u(){const p=r.value.validate();if(p){G.notify({type:"warning",title:"Помилка валідації",message:Object.entries(p).map(([h,x])=>`${h}: ${x}`).join(`
|
|
3
|
-
`)});return}if(i.value)try{const h=await fetch(`/api/table/${i.value}`,{method:d.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a.value)});if(h.ok)await h.json(),G.notify({type:"success",title:"Успішно",message:`Дані успішно ${d.value==="add"?"збережено":"оновлено"}`}),n("save",a.value);else if(h.status===400){const x=await h.json().catch(()=>({}));G.notify({type:"warning",title:"Помилка валідації",message:x.message||"Некоректні дані (400)"})}else h.status===500?G.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):G.notify({type:"error",title:"Помилка",message:`Статус: ${h.status}`})}catch(h){G.notify({type:"error",title:"Помилка з’єднання",message:h.message||"Не вдалося виконати запит"})}}function c(){n("close")}return e.onMounted(async()=>{try{if(s.form){const p=await fetch(`/api/template/form/${s.form}`);if(!p.ok){G.notify({type:p.status>=400&&p.status<500?"warning":"error",title:"Error",message:`Error code: ${p.status}`});return}const h=await p.json();l.value=h.schema,i.value=h.token}else if(s.token){i.value=s.token;const p=await fetch(`/api/form/${i.value}`);if(!p.ok){G.notify({type:p.status>=400&&p.status<500?"warning":"error",title:"Error",message:`Error code: ${p.status}`});return}const h=await p.json();l.value=h.schema,h.data?a.value=h.data:d.value="add"}}catch(p){G.notify({type:"error",title:"Error",message:p.message||"Unexpected error"}),console.error(p)}}),(p,h)=>(e.openBlock(),e.createElementBlock("div",Xo,[e.createElementVNode("div",Qo,[e.createElementVNode("div",ei,[e.createElementVNode("div",ti,[e.createElementVNode("h3",si,e.toDisplayString(d.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:c,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},h[2]||(h[2]=[e.createElementVNode("span",{class:"sr-only"},"Close",-1),e.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("path",{d:"M18 6 6 18"}),e.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),e.createElementVNode("div",ni,[l.value?(e.openBlock(),e.createBlock(me,{key:0,schema:l.value,values:a.value,"onUpdate:values":h[0]||(h[0]=x=>a.value=x),form:r.value,"onUpdate:form":h[1]||(h[1]=x=>r.value=x)},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:c,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:u,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"}," Зберегти ")])])])]))}}),Et=(o={mode:"edit",schema:null})=>new Promise(t=>{const{close:s}=G.modal({title:o.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:wt,contentProps:{...o,onClose:()=>{t(null),s()},onSave:n=>{t(n),s()}}})});me.install=function(t){t.component("VForm",me),Object.assign(t.config.globalProperties,{$form:Et}),t.provide("form",Et),window.v3plugin||(window.v3plugin={})};function pe(o){return typeof o=="string"||o instanceof String}function Vt(o){var t;return typeof o=="object"&&o!=null&&(o==null||(t=o.constructor)==null?void 0:t.name)==="Object"}function Ct(o,t){return Array.isArray(t)?Ct(o,(s,n)=>t.includes(n)):Object.entries(o).reduce((s,n)=>{let[l,a]=n;return t(a,l)&&(s[l]=a),s},{})}const E={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function vt(o){switch(o){case E.LEFT:return E.FORCE_LEFT;case E.RIGHT:return E.FORCE_RIGHT;default:return o}}function Pe(o){return o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function $e(o,t){if(t===o)return!0;const s=Array.isArray(t),n=Array.isArray(o);let l;if(s&&n){if(t.length!=o.length)return!1;for(l=0;l<t.length;l++)if(!$e(t[l],o[l]))return!1;return!0}if(s!=n)return!1;if(t&&o&&typeof t=="object"&&typeof o=="object"){const a=t instanceof Date,r=o instanceof Date;if(a&&r)return t.getTime()==o.getTime();if(a!=r)return!1;const i=t instanceof RegExp,d=o instanceof RegExp;if(i&&d)return t.toString()==o.toString();if(i!=d)return!1;const u=Object.keys(t);for(l=0;l<u.length;l++)if(!Object.prototype.hasOwnProperty.call(o,u[l]))return!1;for(l=0;l<u.length;l++)if(!$e(o[u[l]],t[u[l]]))return!1;return!0}else if(t&&o&&typeof t=="function"&&typeof o=="function")return t.toString()===o.toString();return!1}class li{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?E.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?E.RIGHT:E.LEFT}}function A(o,t){return new A.InputMask(o,t)}function Bt(o){if(o==null)throw new Error("mask property should be defined");return o instanceof RegExp?A.MaskedRegExp:pe(o)?A.MaskedPattern:o===Date?A.MaskedDate:o===Number?A.MaskedNumber:Array.isArray(o)||o===Array?A.MaskedDynamic:A.Masked&&o.prototype instanceof A.Masked?o:A.Masked&&o instanceof A.Masked?o.constructor:o instanceof Function?A.MaskedFunction:(console.warn("Mask not found for mask",o),A.Masked)}function be(o){if(!o)throw new Error("Options in not defined");if(A.Masked){if(o.prototype instanceof A.Masked)return{mask:o};const{mask:t=void 0,...s}=o instanceof A.Masked?{mask:o}:Vt(o)&&o.mask instanceof A.Masked?o:{};if(t){const n=t.mask;return{...Ct(t,(l,a)=>!a.startsWith("_")),mask:t.constructor,_mask:n,...s}}}return Vt(o)?{...o}:{mask:o}}function ae(o){if(A.Masked&&o instanceof A.Masked)return o;const t=be(o),s=Bt(t.mask);if(!s)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===s&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new s(t)}A.createMask=ae;class De{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,s){if(!(t==null||s==null||t===this.selectionStart&&s===this.selectionEnd))try{this._unsafeSelect(t,s)}catch{}}get isActive(){return!1}}A.MaskElement=De;const Nt=90,ai=89;class Ee extends De{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,s,n;return(t=(s=(n=this.input).getRootNode)==null?void 0:s.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===Nt&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===ai&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===Nt&&(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={}}}A.HTMLMaskElement=Ee;class St extends Ee{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,s){this.input.setSelectionRange(t,s)}get value(){return this.input.value}set value(t){this.input.value=t}}A.HTMLMaskElement=Ee;class He extends Ee{get _unsafeSelectionStart(){const t=this.rootElement,s=t.getSelection&&t.getSelection(),n=s&&s.anchorOffset,l=s&&s.focusOffset;return l==null||n==null||n<l?n:l}get _unsafeSelectionEnd(){const t=this.rootElement,s=t.getSelection&&t.getSelection(),n=s&&s.anchorOffset,l=s&&s.focusOffset;return l==null||n==null||n>l?n:l}_unsafeSelect(t,s){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,s);const l=this.rootElement,a=l.getSelection&&l.getSelection();a&&(a.removeAllRanges(),a.addRange(n))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}A.HTMLContenteditableMaskElement=He;class Ie{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>Ie.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}}Ie.MAX_LENGTH=100;class Mt{constructor(t,s){this.el=t instanceof De?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new He(t):new St(t),this.masked=ae(s),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Ie,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 s;return t==null||((s=this.masked)==null?void 0:s.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof A.Masked)&&this.masked.constructor===Bt(t)){this.masked.updateOptions({mask:t});return}const s=t instanceof A.Masked?t:ae({mask:t});s.unmaskedValue=this.masked.unmaskedValue,this.masked=s}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,s){const n=this._listeners[t];n&&n.forEach(l=>l(s))}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 s=this.masked.unmaskedValue,n=this.masked.value,l=this.masked.rawInputValue,a=this.displayValue,r=this.unmaskedValue!==s||this.value!==n||this._rawInputValue!==l;this._unmaskedValue=s,this._value=n,this._rawInputValue=l,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:s,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:s,...n}=t,l=!this.maskEquals(s),a=this.masked.optionsIsChanged(n);l&&(this.mask=s),a&&this.masked.updateOptions(n),(l||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,E.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,s){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(s),this}off(t,s){if(!this._listeners[t])return this;if(!s)return delete this._listeners[t],this;const n=this._listeners[t].indexOf(s);return n>=0&&this._listeners[t].splice(n,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const s=new li({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),n=this.masked.rawInputValue,l=this.masked.splice(s.startChangePos,s.removed.length,s.inserted,s.removeDirection,{input:!0,raw:!0}).offset,a=n===this.masked.rawInputValue?s.removeDirection:E.NONE;let r=this.masked.nearestInputPos(s.startChangePos+l,a);a!==E.NONE&&(r=this.masked.nearestInputPos(r,E.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}}A.InputMask=Mt;class D{static normalize(t){return Array.isArray(t)?t:[t,new D]}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}}A.ChangeDetails=D;class re{constructor(t,s,n){t===void 0&&(t=""),s===void 0&&(s=0),this.value=t,this.from=s,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 s=this.value[0];return this.value=this.value.slice(1),s}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class q{constructor(t){this._value="",this._update({...q.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,s){s===void 0&&(s={input:!0}),this.reset(),this.append(t,s,""),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,s){return t}totalInputPositions(t,s){return t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),Math.min(this.displayValue.length,s-t)}extractInput(t,s,n){return t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),this.displayValue.slice(t,s)}extractTail(t,s){return t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),new re(this.extractInput(t,s),t)}appendTail(t){return pe(t)&&(t=new re(String(t))),t.appendTo(this)}_appendCharRaw(t,s){return t?(this._value+=t,new D({inserted:t,rawInserted:t})):new D}_appendChar(t,s,n){s===void 0&&(s={});const l=this.state;let a;if([t,a]=this.doPrepareChar(t,s),t&&(a=a.aggregate(this._appendCharRaw(t,s)),!a.rawInserted&&this.autofix==="pad")){const r=this.state;this.state=l;let i=this.pad(s);const d=this._appendCharRaw(t,s);i=i.aggregate(d),d.rawInserted||i.equals(a)?a=i:this.state=r}if(a.inserted){let r,i=this.doValidate(s)!==!1;if(i&&n!=null){const d=this.state;if(this.overwrite===!0){r=n.state;for(let c=0;c<a.rawInserted.length;++c)n.unshift(this.displayValue.length-a.tailShift)}let u=this.appendTail(n);if(i=u.rawInserted.length===n.toString().length,!(i&&u.inserted)&&this.overwrite==="shift"){this.state=d,r=n.state;for(let c=0;c<a.rawInserted.length;++c)n.shift();u=this.appendTail(n),i=u.rawInserted.length===n.toString().length}i&&u.inserted&&(this.state=d)}i||(a=new D,this.state=l,n&&r&&(n.state=r))}return a}_appendPlaceholder(){return new D}_appendEager(){return new D}append(t,s,n){if(!pe(t))throw new Error("value should be string");const l=pe(n)?new re(String(n)):n;s!=null&&s.tail&&(s._beforeTailState=this.state);let a;[t,a]=this.doPrepare(t,s);for(let r=0;r<t.length;++r){const i=this._appendChar(t[r],s,l);if(!i.rawInserted&&!this.doSkipInvalid(t[r],s,l))break;a.aggregate(i)}return(this.eager===!0||this.eager==="append")&&s!=null&&s.input&&t&&a.aggregate(this._appendEager()),l!=null&&(a.tailShift+=this.appendTail(l).tailShift),a}remove(t,s){return t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(s),new D}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const s=this.rawInputValue,n=this.value,l=t();return this.rawInputValue=s,this.value&&this.value!==n&&n.indexOf(this.value)===0&&(this.append(n.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,l}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const s=this.state,n=t(this);return this.state=s,delete this._isolated,n}doSkipInvalid(t,s,n){return!!this.skipInvalid}doPrepare(t,s){return s===void 0&&(s={}),D.normalize(this.prepare?this.prepare(t,this,s):t)}doPrepareChar(t,s){return s===void 0&&(s={}),D.normalize(this.prepareChar?this.prepareChar(t,this,s):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,s,n,l,a){n===void 0&&(n=""),l===void 0&&(l=E.NONE),a===void 0&&(a={input:!0});const r=t+s,i=this.extractTail(r),d=this.eager===!0||this.eager==="remove";let u;d&&(l=vt(l),u=this.extractInput(0,r,{raw:!0}));let c=t;const p=new D;if(l!==E.NONE&&(c=this.nearestInputPos(t,s>1&&t!==0&&!d?E.NONE:l),p.tailShift=c-t),p.aggregate(this.remove(c)),d&&l!==E.NONE&&u===this.rawInputValue)if(l===E.FORCE_LEFT){let h;for(;u===this.rawInputValue&&(h=this.displayValue.length);)p.aggregate(new D({tailShift:-1})).aggregate(this.remove(h-1))}else l===E.FORCE_RIGHT&&i.unshift();return p.aggregate(this.append(n,a,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!$e(this,t)}typedValueEquals(t){const s=this.typedValue;return t===s||q.EMPTY_VALUES.includes(t)&&q.EMPTY_VALUES.includes(s)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new D}}q.DEFAULTS={skipInvalid:!0},q.EMPTY_VALUES=[void 0,null,""],A.Masked=q;class he{constructor(t,s){t===void 0&&(t=[]),s===void 0&&(s=0),this.chunks=t,this.from=s}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=pe(t)?new re(String(t)):t;const s=this.chunks[this.chunks.length-1],n=s&&(s.stop===t.stop||t.stop==null)&&t.from===s.from+s.toString().length;if(t instanceof re)n?s.extend(t.toString()):this.chunks.push(t);else if(t instanceof he){if(t.stop==null){let l;for(;t.chunks.length&&t.chunks[0].stop==null;)l=t.chunks.shift(),l.from+=t.from,this.extend(l)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof A.MaskedPattern))return new re(this.toString()).appendTo(t);const s=new D;for(let n=0;n<this.chunks.length;++n){const l=this.chunks[n],a=t._mapPosToBlock(t.displayValue.length),r=l.stop;let i;if(r!=null&&(!a||a.index<=r)&&((l instanceof he||t._stops.indexOf(r)>=0)&&s.aggregate(t._appendPlaceholder(r)),i=l instanceof he&&t._blocks[r]),i){const d=i.appendTail(l);s.aggregate(d);const u=l.toString().slice(d.rawInserted.length);u&&s.aggregate(t.append(u,{tail:!0}))}else s.aggregate(t.append(l.toString(),{tail:!0}))}return s}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:s,...n}=t;Object.assign(this,n),this.chunks=s.map(l=>{const a="chunks"in l?new he:new re;return a.state=l,a})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const s=t!=null?t-this.from:t;let n=0;for(;n<this.chunks.length;){const l=this.chunks[n],a=l.unshift(s);if(l.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 s=this.chunks[t],n=s.shift();if(s.toString()){if(!n)break;--t}else this.chunks.splice(t,1);if(n)return n}return""}}class ri{constructor(t,s){this.masked=t,this._log=[];const{offset:n,index:l}=t._mapPosToBlock(s)||(s<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=n,this.index=l,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=((s=this.block)==null?void 0:s.displayValue.length)||0){var s;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,E.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,E.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,E.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,E.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,E.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,E.NONE),!0})}}class Ge{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,s){return t===void 0&&(t=0),s===void 0&&(s=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(s),this._value||(this._isRawInput=!1),new D}nearestInputPos(t,s){s===void 0&&(s=E.NONE);const n=0,l=this._value.length;switch(s){case E.LEFT:case E.FORCE_LEFT:return n;case E.NONE:case E.RIGHT:case E.FORCE_RIGHT:default:return l}}totalInputPositions(t,s){return t===void 0&&(t=0),s===void 0&&(s=this._value.length),this._isRawInput?s-t:0}extractInput(t,s,n){return t===void 0&&(t=0),s===void 0&&(s=this._value.length),n===void 0&&(n={}),n.raw&&this._isRawInput&&this._value.slice(t,s)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,s){if(s===void 0&&(s={}),this.isFilled)return new D;const n=this.eager===!0||this.eager==="append",a=this.char===t&&(this.isUnmasking||s.input||s.raw)&&(!s.raw||!n)&&!s.tail,r=new D({inserted:this.char,rawInserted:a?this.char:""});return this._value=this.char,this._isRawInput=a&&(s.raw||s.input),r}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new D;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new re("")}appendTail(t){return pe(t)&&(t=new re(String(t))),t.appendTo(this)}append(t,s,n){const l=this._appendChar(t[0],s);return n!=null&&(l.tailShift+=this.appendTail(n).tailShift),l}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 Ve{constructor(t){const{parent:s,isOptional:n,placeholderChar:l,displayChar:a,lazy:r,eager:i,...d}=t;this.masked=ae(d),Object.assign(this,{parent:s,isOptional:n,placeholderChar:l,displayChar:a,lazy:r,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,s){return t===void 0&&(t=0),s===void 0&&(s=this.value.length),t===0&&s>=1?(this.isFilled=!1,this.masked.remove(t,s)):new D}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,s){if(s===void 0&&(s={}),this.isFilled)return new D;const n=this.masked.state;let l=this.masked._appendChar(t,this.currentMaskFlags(s));return l.inserted&&this.doValidate(s)===!1&&(l=new D,this.masked.state=n),!l.inserted&&!this.isOptional&&!this.lazy&&!s.input&&(l.inserted=this.placeholderChar),l.skip=!l.inserted&&!this.isOptional,this.isFilled=!!l.inserted,l}append(t,s,n){return this.masked.append(t,this.currentMaskFlags(s),n)}_appendPlaceholder(){return this.isFilled||this.isOptional?new D:(this.isFilled=!0,new D({inserted:this.placeholderChar}))}_appendEager(){return new D}extractTail(t,s){return this.masked.extractTail(t,s)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,s,n){return t===void 0&&(t=0),s===void 0&&(s=this.value.length),this.masked.extractInput(t,s,n)}nearestInputPos(t,s){s===void 0&&(s=E.NONE);const n=0,l=this.value.length,a=Math.min(Math.max(t,n),l);switch(s){case E.LEFT:case E.FORCE_LEFT:return this.isComplete?a:n;case E.RIGHT:case E.FORCE_RIGHT:return this.isComplete?a:l;case E.NONE:default:return a}}totalInputPositions(t,s){return t===void 0&&(t=0),s===void 0&&(s=this.value.length),this.value.slice(t,s).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 s;return{...t,_beforeTailState:(t==null||(s=t._beforeTailState)==null?void 0:s.masked)||t?._beforeTailState}}pad(t){return new D}}Ve.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 Ft extends q{updateOptions(t){super.updateOptions(t)}_update(t){const s=t.mask;s&&(t.validate=n=>n.search(s)>=0),super._update(t)}}A.MaskedRegExp=Ft;class K extends q{constructor(t){super({...K.DEFAULTS,...t,definitions:Object.assign({},Ve.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 s=this.mask;if(!s||!t)return;let n=!1,l=!1;for(let a=0;a<s.length;++a){if(this.blocks){const u=s.slice(a),c=Object.keys(this.blocks).filter(h=>u.indexOf(h)===0);c.sort((h,x)=>x.length-h.length);const p=c[0];if(p){const{expose:h,repeat:x,...$}=be(this.blocks[p]),V={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...$,repeat:x,parent:this},M=x!=null?new A.RepeatBlock(V):ae(V);M&&(this._blocks.push(M),h&&(this.exposeBlock=M),this._maskedBlocks[p]||(this._maskedBlocks[p]=[]),this._maskedBlocks[p].push(this._blocks.length-1)),a+=p.length-1;continue}}let r=s[a],i=r in t;if(r===K.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(r==="{"||r==="}"){n=!n;continue}if(r==="["||r==="]"){l=!l;continue}if(r===K.ESCAPE_CHAR){if(++a,r=s[a],!r)break;i=!1}const d=i?new Ve({isOptional:l,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...be(t[r]),parent:this}):new Ge({char:r,eager:this.eager,isUnmasking:n});this._blocks.push(d)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:s,...n}=t;this._blocks.forEach((l,a)=>l.state=s[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,s)=>t+=s.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(s),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,s)=>t+=s.value,"")}set value(t){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(s),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(s),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,s)=>t+=s.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const s=new D;let n=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(n==null)return s;this._blocks[n].isFilled&&++n;for(let l=n;l<this._blocks.length;++l){const a=this._blocks[l]._appendEager();if(!a.inserted)break;s.aggregate(a)}return s}_appendCharRaw(t,s){s===void 0&&(s={});const n=this._mapPosToBlock(this.displayValue.length),l=new D;if(!n)return l;for(let r=n.index,i;i=this._blocks[r];++r){var a;const d=i._appendChar(t,{...s,_beforeTailState:(a=s._beforeTailState)==null||(a=a._blocks)==null?void 0:a[r]});if(l.aggregate(d),d.consumed)break}return l}extractTail(t,s){t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length);const n=new he;return t===s||this._forEachBlocksInRange(t,s,(l,a,r,i)=>{const d=l.extractTail(r,i);d.stop=this._findStopBefore(a),d.from=this._blockStartPos(a),d instanceof he&&(d.blockIndex=a),n.extend(d)}),n}extractInput(t,s,n){if(t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),n===void 0&&(n={}),t===s)return"";let l="";return this._forEachBlocksInRange(t,s,(a,r,i,d)=>{l+=a.extractInput(i,d,n)}),l}_findStopBefore(t){let s;for(let n=0;n<this._stops.length;++n){const l=this._stops[n];if(l<=t)s=l;else break}return s}_appendPlaceholder(t){const s=new D;if(this.lazy&&t==null)return s;const n=this._mapPosToBlock(this.displayValue.length);if(!n)return s;const l=n.index,a=t??this._blocks.length;return this._blocks.slice(l,a).forEach(r=>{if(!r.lazy||t!=null){var i;s.aggregate(r._appendPlaceholder((i=r._blocks)==null?void 0:i.length))}}),s}_mapPosToBlock(t){let s="";for(let n=0;n<this._blocks.length;++n){const l=this._blocks[n],a=s.length;if(s+=l.displayValue,t<=s.length)return{index:n,offset:t-a}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((s,n)=>s+=n.displayValue.length,0)}_forEachBlocksInRange(t,s,n){s===void 0&&(s=this.displayValue.length);const l=this._mapPosToBlock(t);if(l){const a=this._mapPosToBlock(s),r=a&&l.index===a.index,i=l.offset,d=a&&r?a.offset:this._blocks[l.index].displayValue.length;if(n(this._blocks[l.index],l.index,i,d),a&&!r){for(let u=l.index+1;u<a.index;++u)n(this._blocks[u],u,0,this._blocks[u].displayValue.length);n(this._blocks[a.index],a.index,0,a.offset)}}}remove(t,s){t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length);const n=super.remove(t,s);return this._forEachBlocksInRange(t,s,(l,a,r,i)=>{n.aggregate(l.remove(r,i))}),n}nearestInputPos(t,s){if(s===void 0&&(s=E.NONE),!this._blocks.length)return 0;const n=new ri(this,t);if(s===E.NONE)return n.pushRightBeforeInput()||(n.popState(),n.pushLeftBeforeInput())?n.pos:this.displayValue.length;if(s===E.LEFT||s===E.FORCE_LEFT){if(s===E.LEFT){if(n.pushRightBeforeFilled(),n.ok&&n.pos===t)return t;n.popState()}if(n.pushLeftBeforeInput(),n.pushLeftBeforeRequired(),n.pushLeftBeforeFilled(),s===E.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:s===E.FORCE_LEFT?0:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:0)}return s===E.RIGHT||s===E.FORCE_RIGHT?(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.pushRightBeforeFilled()?n.pos:s===E.FORCE_RIGHT?this.displayValue.length:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:this.nearestInputPos(t,E.LEFT))):t}totalInputPositions(t,s){t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length);let n=0;return this._forEachBlocksInRange(t,s,(l,a,r,i)=>{n+=l.totalInputPositions(r,i)}),n}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const s=this._maskedBlocks[t];return s?s.map(n=>this._blocks[n]):[]}pad(t){const s=new D;return this._forEachBlocksInRange(0,this.displayValue.length,n=>s.aggregate(n.pad(t))),s}}K.DEFAULTS={...q.DEFAULTS,lazy:!0,placeholderChar:"_"},K.STOP_CHAR="`",K.ESCAPE_CHAR="\\",K.InputDefinition=Ve,K.FixedDefinition=Ge,A.MaskedPattern=K;class Ce extends K{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:s=this.to||0,from:n=this.from||0,maxLength:l=this.maxLength||0,autofix:a=this.autofix,...r}=t;this.to=s,this.from=n,this.maxLength=Math.max(String(s).length,l),this.autofix=a;const i=String(this.from).padStart(this.maxLength,"0"),d=String(this.to).padStart(this.maxLength,"0");let u=0;for(;u<d.length&&d[u]===i[u];)++u;r.mask=d.slice(0,u).replace(/0/g,"\\0")+"0".repeat(this.maxLength-u),super._update(r)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let s="",n="";const[,l,a]=t.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(s="0".repeat(l.length)+a,n="9".repeat(l.length)+a),s=s.padEnd(this.maxLength,"0"),n=n.padEnd(this.maxLength,"9"),[s,n]}doPrepareChar(t,s){s===void 0&&(s={});let n;return[t,n]=super.doPrepareChar(t.replace(/\D/g,""),s),t||(n.skip=!this.isComplete),[t,n]}_appendCharRaw(t,s){if(s===void 0&&(s={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,s);const n=String(this.from).padStart(this.maxLength,"0"),l=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],s):Number(a)>this.to?!s.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(n[this.value.length],s).aggregate(this._appendCharRaw(t,s)):super._appendCharRaw(l[this.value.length],s):super._appendCharRaw(t,s)}doValidate(t){const s=this.value;if(s.search(/[^0]/)===-1&&s.length<=this._matchFrom)return!0;const[l,a]=this.boundaries(s);return this.from<=Number(a)&&Number(l)<=this.to&&super.doValidate(t)}pad(t){const s=new D;if(this.value.length===this.maxLength)return s;const n=this.value,l=this.maxLength-this.value.length;if(l){this.reset();for(let a=0;a<l;++a)s.aggregate(super._appendCharRaw("0",t));n.split("").forEach(a=>this._appendCharRaw(a))}return s}}A.MaskedRange=Ce;const oi="d{.}`m{.}`Y";class oe extends K{static extractPatternOptions(t){const{mask:s,pattern:n,...l}=t;return{...l,mask:pe(s)?s:n}}constructor(t){super(oe.extractPatternOptions({...oe.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:s,pattern:n,blocks:l,...a}={...oe.DEFAULTS,...t},r=Object.assign({},oe.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,l),super._update({...a,mask:pe(s)?s:n,blocks:r})}doValidate(t){const s=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&s!=null&&(this.min==null||this.min<=s)&&(this.max==null||s<=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(oe.extractPatternOptions(t))}}oe.GET_DEFAULT_BLOCKS=()=>({d:{mask:Ce,from:1,to:31,maxLength:2},m:{mask:Ce,from:1,to:12,maxLength:2},Y:{mask:Ce,from:1900,to:9999}}),oe.DEFAULTS={...K.DEFAULTS,mask:Date,pattern:oi,format:(o,t)=>{if(!o)return"";const s=String(o.getDate()).padStart(2,"0"),n=String(o.getMonth()+1).padStart(2,"0"),l=o.getFullYear();return[s,n,l].join(".")},parse:(o,t)=>{const[s,n,l]=o.split(".").map(Number);return new Date(l,n-1,s)}},A.MaskedDate=oe;class ve extends q{constructor(t){super({...ve.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(s=>{const{expose:n,...l}=be(s),a=ae({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...l});return n&&(this.exposeMask=a),a}):[])}_appendCharRaw(t,s){s===void 0&&(s={});const n=this._applyDispatch(t,s);return this.currentMask&&n.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(s))),n}_applyDispatch(t,s,n){t===void 0&&(t=""),s===void 0&&(s={}),n===void 0&&(n="");const l=s.tail&&s._beforeTailState!=null?s._beforeTailState._value:this.value,a=this.rawInputValue,r=s.tail&&s._beforeTailState!=null?s._beforeTailState._rawInputValue:a,i=a.slice(r.length),d=this.currentMask,u=new D,c=d?.state;return this.currentMask=this.doDispatch(t,{...s},n),this.currentMask&&(this.currentMask!==d?(this.currentMask.reset(),r&&(this.currentMask.append(r,{raw:!0}),u.tailShift=this.currentMask.value.length-l.length),i&&(u.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):c&&(this.currentMask.state=c)),u}_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 s=new D;return t&&s.aggregate(this._applyDispatch("",{},t)),s.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var s,n;return{...t,_beforeTailState:((s=t._beforeTailState)==null?void 0:s.currentMaskRef)===this.currentMask&&((n=t._beforeTailState)==null?void 0:n.currentMask)||t._beforeTailState}}doDispatch(t,s,n){return s===void 0&&(s={}),n===void 0&&(n=""),this.dispatch(t,this,s,n)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,s){s===void 0&&(s={});let[n,l]=super.doPrepare(t,s);if(this.currentMask){let a;[n,a]=super.doPrepare(n,this.currentMaskFlags(s)),l=l.aggregate(a)}return[n,l]}doPrepareChar(t,s){s===void 0&&(s={});let[n,l]=super.doPrepareChar(t,s);if(this.currentMask){let a;[n,a]=super.doPrepareChar(n,this.currentMaskFlags(s)),l=l.aggregate(a)}return[n,l]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(s=>s.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 s=String(t);this.currentMask&&(this.currentMask.typedValue=t,s=this.currentMask.unmaskedValue),this.unmaskedValue=s}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,s){const n=new D;return this.currentMask&&n.aggregate(this.currentMask.remove(t,s)).aggregate(this._applyDispatch()),n}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(s=>s.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:s,currentMaskRef:n,currentMask:l,...a}=t;s&&this.compiledMasks.forEach((r,i)=>r.state=s[i]),n!=null&&(this.currentMask=n,this.currentMask.state=l),super.state=a}extractInput(t,s,n){return this.currentMask?this.currentMask.extractInput(t,s,n):""}extractTail(t,s){return this.currentMask?this.currentMask.extractTail(t,s):super.extractTail(t,s)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,s){return this.currentMask?this.currentMask.nearestInputPos(t,s):super.nearestInputPos(t,s)}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((s,n)=>{if(!t[n])return;const{mask:l,...a}=t[n];return $e(s,a)&&s.maskEquals(l)}):super.maskEquals(t)}typedValueEquals(t){var s;return!!((s=this.currentMask)!=null&&s.typedValueEquals(t))}}ve.DEFAULTS={...q.DEFAULTS,dispatch:(o,t,s,n)=>{if(!t.compiledMasks.length)return;const l=t.rawInputValue,a=t.compiledMasks.map((r,i)=>{const d=t.currentMask===r,u=d?r.displayValue.length:r.nearestInputPos(r.displayValue.length,E.FORCE_LEFT);return r.rawInputValue!==l?(r.reset(),r.append(l,{raw:!0})):d||r.remove(u),r.append(o,t.currentMaskFlags(s)),r.appendTail(n),{index:i,weight:r.rawInputValue.length,totalInputPositions:r.totalInputPositions(0,Math.max(u,r.nearestInputPos(r.displayValue.length,E.FORCE_LEFT)))}});return a.sort((r,i)=>i.weight-r.weight||i.totalInputPositions-r.totalInputPositions),t.compiledMasks[a[0].index]}},A.MaskedDynamic=ve;class Be extends K{constructor(t){super({...Be.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:s,...n}=t;if(s){const l=s.map(i=>i.length),a=Math.min(...l),r=Math.max(...l)-a;n.mask="*".repeat(a),r&&(n.mask+="["+"*".repeat(r)+"]"),this.enum=s}super._update(n)}_appendCharRaw(t,s){s===void 0&&(s={});const n=Math.min(this.nearestInputPos(0,E.FORCE_RIGHT),this.value.length),l=this.enum.filter(a=>this.matchValue(a,this.unmaskedValue+t,n));if(l.length){l.length===1&&this._forEachBlocksInRange(0,this.value.length,(r,i)=>{const d=l[0][i];i>=this.value.length||d===r.value||(r.reset(),r._appendChar(d,s))});const a=super._appendCharRaw(l[0][this.value.length],s);return l.length===1&&l[0].slice(this.unmaskedValue.length).split("").forEach(r=>a.aggregate(super._appendCharRaw(r))),a}return new D({skip:!this.isComplete})}extractTail(t,s){return t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),new re("",t)}remove(t,s){if(t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),t===s)return new D;const n=Math.min(super.nearestInputPos(0,E.FORCE_RIGHT),this.value.length);let l;for(l=t;l>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(n,l),n)).length>1);--l);const a=super.remove(l,s);return a.tailShift+=l-t,a}get isComplete(){return this.enum.indexOf(this.value)>=0}}Be.DEFAULTS={...K.DEFAULTS,matchValue:(o,t,s)=>o.indexOf(t,s)===s},A.MaskedEnum=Be;class At extends q{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}A.MaskedFunction=At;var $t;class J extends q{constructor(t){super({...J.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),s="\\d*",n=(this.scale?"("+Pe(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+s+n),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Pe).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Pe(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const s=t.split(this.radix);return s[0]=s[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),s.join(this.radix)}doPrepareChar(t,s){s===void 0&&(s={});const[n,l]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(s.input&&s.raw||!s.input&&!s.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),s);return t&&!n&&(l.skip=!0),n&&!this.allowPositive&&!this.value&&n!=="-"&&l.aggregate(this._appendChar("-")),[n,l]}_separatorsCount(t,s){s===void 0&&(s=!1);let n=0;for(let l=0;l<t;++l)this._value.indexOf(this.thousandsSeparator,l)===l&&(++n,s&&(t+=this.thousandsSeparator.length));return n}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,s,n){return t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),[t,s]=this._adjustRangeWithSeparators(t,s),this._removeThousandsSeparators(super.extractInput(t,s,n))}_appendCharRaw(t,s){s===void 0&&(s={});const n=s.tail&&s._beforeTailState?s._beforeTailState._value:this._value,l=this._separatorsCountFromSlice(n);this._value=this._removeThousandsSeparators(this.value);const a=this._value;this._value+=t;const r=this.number;let i=!isNaN(r),d=!1;if(i){let h;this.min!=null&&this.min<0&&this.number<this.min&&(h=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(h=this.max),h!=null&&(this.autofix?(this._value=this.format(h,this).replace(J.UNMASKED_RADIX,this.radix),d||(d=a===this._value&&!s.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let u;i?u=new D({inserted:this._value.slice(a.length),rawInserted:d?"":t,skip:d}):(this._value=a,u=new D),this._value=this._insertThousandsSeparators(this._value);const c=s.tail&&s._beforeTailState?s._beforeTailState._value:this._value,p=this._separatorsCountFromSlice(c);return u.tailShift+=(p-l)*this.thousandsSeparator.length,u}_findSeparatorAround(t){if(this.thousandsSeparator){const s=t-this.thousandsSeparator.length+1,n=this.value.indexOf(this.thousandsSeparator,s);if(n<=t)return n}return-1}_adjustRangeWithSeparators(t,s){const n=this._findSeparatorAround(t);n>=0&&(t=n);const l=this._findSeparatorAround(s);return l>=0&&(s=l+this.thousandsSeparator.length),[t,s]}remove(t,s){t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),[t,s]=this._adjustRangeWithSeparators(t,s);const n=this.value.slice(0,t),l=this.value.slice(s),a=this._separatorsCount(n.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(n+l));const r=this._separatorsCountFromSlice(n);return new D({tailShift:(r-a)*this.thousandsSeparator.length})}nearestInputPos(t,s){if(!this.thousandsSeparator)return t;switch(s){case E.NONE:case E.LEFT:case E.FORCE_LEFT:{const n=this._findSeparatorAround(t-1);if(n>=0){const l=n+this.thousandsSeparator.length;if(t<l||this.value.length<=l||s===E.FORCE_LEFT)return n}break}case E.RIGHT:case E.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 s=t;this.min!=null&&(s=Math.max(s,this.min)),this.max!=null&&(s=Math.min(s,this.max)),s!==t&&(this.unmaskedValue=this.format(s,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 s=this._removeThousandsSeparators(t).split(this.radix);return s[0]=s[0].replace(/^(\D*)(0*)(\d*)/,(n,l,a,r)=>l+r),t.length&&!/\d$/.test(s[0])&&(s[0]=s[0]+"0"),s.length>1&&(s[1]=s[1].replace(/0*$/,""),s[1].length||(s.length=1)),this._insertThousandsSeparators(s.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const s=t.split(this.radix);return s.length<2&&s.push(""),s[1]=s[1].padEnd(this.scale,"0"),s.join(this.radix)}doSkipInvalid(t,s,n){s===void 0&&(s={});const l=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===J.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,s,n)&&!l}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,J.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(J.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)||J.EMPTY_VALUES.includes(t)&&J.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}$t=J,J.UNMASKED_RADIX=".",J.EMPTY_VALUES=[...q.EMPTY_VALUES,0],J.DEFAULTS={...q.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[$t.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:o=>o.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},A.MaskedNumber=J;const Le={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function qe(o,t,s){t===void 0&&(t=Le.MASKED),s===void 0&&(s=Le.MASKED);const n=ae(o);return l=>n.runIsolated(a=>(a[t]=l,a[s]))}function Dt(o,t,s,n){return qe(t,s,n)(o)}A.PIPE_TYPE=Le,A.createPipe=qe,A.pipe=Dt;class It extends K{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 s,n,l;const{repeat:a,...r}=be(t);this._blockOpts=Object.assign({},this._blockOpts,r);const i=ae(this._blockOpts);this.repeat=(s=(n=a??i.repeat)!=null?n:this.repeat)!=null?s:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((l=this._blocks)==null?void 0:l.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(ae(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,s){s===void 0&&(s={});const n=new D;for(let d=(l=(a=this._mapPosToBlock(this.displayValue.length))==null?void 0:a.index)!=null?l:Math.max(this._blocks.length-1,0),u,c;u=(r=this._blocks[d])!=null?r:c=!c&&this._allocateBlock(d);++d){var l,a,r,i;const p=u._appendChar(t,{...s,_beforeTailState:(i=s._beforeTailState)==null||(i=i._blocks)==null?void 0:i[d]});if(p.skip&&c){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(n.aggregate(p),p.consumed)break}return n}_trimEmptyTail(t,s){var n,l;t===void 0&&(t=0);const a=Math.max(((n=this._mapPosToBlock(t))==null?void 0:n.index)||0,this.repeatFrom,0);let r;s!=null&&(r=(l=this._mapPosToBlock(s))==null?void 0:l.index),r==null&&(r=this._blocks.length-1);let i=0;for(let d=r;a<=d&&!this._blocks[d].unmaskedValue;--d,++i);i&&(this._blocks.splice(r-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(t,s){t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length);const n=super.remove(t,s);return this._trimEmptyTail(t,s),n}totalInputPositions(t,s){return t===void 0&&(t=0),s==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,s)}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}}A.RepeatBlock=It;try{globalThis.IMask=A}catch{}const ii=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:D,ChunksTailDetails:he,DIRECTION:E,HTMLContenteditableMaskElement:He,HTMLInputMaskElement:St,HTMLMaskElement:Ee,InputMask:Mt,MaskElement:De,Masked:q,MaskedDate:oe,MaskedDynamic:ve,MaskedEnum:Be,MaskedFunction:At,MaskedNumber:J,MaskedPattern:K,MaskedRange:Ce,MaskedRegExp:Ft,PIPE_TYPE:Le,PatternFixedDefinition:Ge,PatternInputDefinition:Ve,RepeatBlock:It,createMask:ae,createPipe:qe,default:A,forceDirection:vt,normalizeOpts:be,pipe:Dt},Symbol.toStringTag,{value:"Module"}));O.ModalEdit=wt,O.VForm=me,O.VsInputCheckbox=Qe,O.VsInputColor=gt,O.VsInputContainer=it,O.VsInputDate=et,O.VsInputEmail=Xe,O.VsInputFile=at,O.VsInputFileList=rt,O.VsInputKeyValue=ft,O.VsInputMask=Je,O.VsInputNumber=Ye,O.VsInputRadio=je,O.VsInputRange=kt,O.VsInputSelect=Ue,O.VsInputSlug=mt,O.VsInputStatic=ze,O.VsInputSwitcher=Re,O.VsInputTag=ht,O.VsInputText=xe,O.VsInputTextarea=dt,O.default=me,O.inputs=bt,O.vsInputDatatable=ct,O.vsInputMap=pt,Object.defineProperties(O,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(O,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):(O=typeof globalThis<"u"?globalThis:O||self,e(O.FormBuilder={},O.Vue,O.OpenGISCore))})(this,function(O,e,G){"use strict";const Gt={class:"w-full relative"},qt={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},Kt={class:"opacity-100"},Zt={key:0,class:"text-red-500 text-[14px]"},Yt={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Wt=e.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""}},setup(o){const t=e.ref("uk"),s=n=>{n.detail.key==="locale"&&(t.value=n.detail.newValue)};return e.onMounted(()=>{t.value=localStorage.locale,window.addEventListener("storage",s)}),e.onUnmounted(()=>{window.removeEventListener("resize",s)}),(n,l)=>(e.openBlock(),e.createElementBlock("div",Gt,[n.ua||n.label?(e.openBlock(),e.createElementBlock("div",qt,[e.createElementVNode("span",Kt,e.toDisplayString(n.item[t.value]||n.ua||n.label),1),n.item?.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",Zt,"*")):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",Yt,e.toDisplayString(n.error),1)):e.createCommentVNode("",!0)]))}}),Jt={class:"w-full relative flex flex-row items-center gap-2"},Xt={key:0,class:"text-sm text-gray-900 font-medium flex shrink-0 w-3/12 max-w-[250px]"},Qt={key:0,class:"text-red-500 text-[14px]"},es={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},ts=e.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""}},setup(o){return(t,s)=>(e.openBlock(),e.createElementBlock("div",Jt,[t.item?.type!=="html"?(e.openBlock(),e.createElementBlock("span",Xt,[e.createTextVNode(e.toDisplayString(t.ua||t.label)+" ",1),t.item?.rules?.includes("required")&&(t.ua||t.label)?(e.openBlock(),e.createElementBlock("span",Qt,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",es,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),ss={class:"w-full relative"},ns={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},ls=e.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""}},setup(o){return(t,s)=>(e.openBlock(),e.createElementBlock("div",ss,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",ns,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),as={class:"flex-1 min-w-0"},rs={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},os={class:"truncate"},is={key:0,class:"text-red-500 text-[14px]"},ds={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},us={class:"w-full md:w-auto"},cs={key:0,class:"mt-1 text-xs text-red-500"},ps={default:Wt,horizontal:ts,inline:ls,settings:e.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""}},setup(o){const t=o,s=e.ref("uk");e.computed(()=>(t.item??{})?.[s.value]??t.ua??t.label??"");const n=e.computed(()=>t.item?.description??""),l=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"&&(s.value=i.newValue??"uk")};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(s.value=localStorage.locale)}catch{}window.addEventListener("storage",r)}),e.onUnmounted(()=>{window.removeEventListener("storage",r)}),(i,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":i.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(i.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",as,[i.ua||i.label?(e.openBlock(),e.createElementBlock("p",rs,[e.createElementVNode("span",os,e.toDisplayString(i.item[s.value]||i.ua||i.label),1),l.value?(e.openBlock(),e.createElementBlock("span",is,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),n.value?(e.openBlock(),e.createElementBlock("p",ds,e.toDisplayString(n.value),1)):e.createCommentVNode("",!0)]),e.createElementVNode("div",us,[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))])],2),a.value?(e.openBlock(),e.createElementBlock("p",cs,e.toDisplayString(a.value),1)):e.createCommentVNode("",!0)],2))}})};function ee(o){return{inputClass:e.computed(()=>{const s=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${o?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return o?.size==="sm"?`${s}h-[32px]`:`${s}h-[38px]`})}}const hs=["placeholder","disabled"],ms=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(o){const t=o,{inputClass:s}=ee(t.style),n=e.useModel(o,"modelValue");return(l,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":a[0]||(a[0]=r=>n.value=r),placeholder:l.placeholder,disabled:l.disabled,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(s),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,hs)),[[e.vModelText,n.value]])}}),fs=["placeholder","disabled"],xe=e.defineComponent({__name:"vs-input-text",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const t=o,{inputClass:s}=ee(t.style),n=e.useModel(o,"modelValue");return(l,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":a[0]||(a[0]=r=>n.value=r),placeholder:l.placeholder,disabled:l.disabled,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(s),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,fs)),[[e.vModelText,n.value]])}}),gs=["placeholder","min","max"],Ye=e.defineComponent({__name:"vs-input-number",props:e.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const t=o,{inputClass:s}=ee(t.style),n=e.useModel(o,"modelValue");return(l,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":a[0]||(a[0]=r=>n.value=r),placeholder:l.placeholder,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(s)]]),style:{border:"1px solid #CFD9E0"},min:l.min,max:l.max},null,10,gs)),[[e.vModelText,n.value]])}}),R=(o,t)=>{const s=o.__vccOpts||o;for(const[n,l]of t)s[n]=l;return s},ks={},bs={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 ys(o,t){return e.openBlock(),e.createElementBlock("svg",bs,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 xs=R(ks,[["render",ys]]),_s={class:"flex items-center gap-[4px]"},ws=["value","id","disabled"],Es=["for"],Vs={class:"text-[14px] text-gray-700 flex items-center gap-x-1 ml-1 dark:text-neutral-400"},Cs=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(o,{emit:t}){const s=t,n=o,l=e.computed({get:()=>n.modelValue,set:a=>s("update:modelValue",a)});return(a,r)=>(e.openBlock(),e.createElementBlock("div",_s,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:a.value,"onUpdate:modelValue":r[0]||(r[0]=i=>l.value=i),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.disabled}]),id:a.id,disabled:a.disabled},null,10,ws),[[e.vModelCheckbox,l.value]]),e.createElementVNode("label",{for:a.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.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[l.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",a.error?"border-red-600":""]])},[e.createVNode(xs,{height:"12",width:"12"})],2),e.createElementVNode("span",Vs,[e.renderSlot(a.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(a.label),1)])])],10,Es)]))}}),Bs=["name","value","disabled"],vs={class:"flex items-center gap-[6px] text-[14px]"},Ns={key:0,class:"text-[16px]"},Ss=["src"],Ms=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(o,{emit:t}){const s=o,n=t,l=e.computed({get:()=>s.modelValue,set:i=>{n("update:modelValue",i)}}),a=e.computed(()=>Array.isArray(l.value)?l.value.includes(s.value):l.value===!0||l.value===s.value),r=e.computed(()=>s.style?.size==="xs"?"p-1.5 text-xs":s.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(i,d)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[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":d[0]||(d[0]=u=>l.value=u),disabled:i.disabled},null,8,Bs),[[e.vModelCheckbox,l.value]]),e.createElementVNode("span",vs,[i.icon||i.imgUrl?(e.openBlock(),e.createElementBlock("span",Ns,[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,Ss)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(i.label),1)])])],2))}}),Fs={class:"flex items-center"},We=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(o,{emit:t}){const s=o,n=t,l=`radio-${Math.floor(Math.random()*1e4)}`,a=e.computed({get:()=>Array.isArray(s.modelValue)?Array.isArray(s.modelValue)&&s.modelValue.includes(s.value):s.modelValue,set:i=>{if(Array.isArray(s.modelValue)){let d=[...s.modelValue];i?d.includes(s.value)||d.push(s.value):d=d.filter(u=>u!==s.value),n("update:modelValue",d)}else n("update:modelValue",i)}}),r=e.ref(`vs-checkbox-${s.view||"default"}`);return(i,d)=>(e.openBlock(),e.createElementBlock("div",Fs,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value==="vs-checkbox-buttons"?e.unref(Ms):e.unref(Cs)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:a.value,"onUpdate:modelValue":d[0]||(d[0]=u=>a.value=u),id:l,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"]))]))}}),As={},$s={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function Ds(o,t){return e.openBlock(),e.createElementBlock("svg",$s,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const Is=R(As,[["render",Ds]]),Ls={},Ts={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 Os(o,t){return e.openBlock(),e.createElementBlock("svg",Ts,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 Rs=R(Ls,[["render",Os]]),zs={},js={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 Us(o,t){return e.openBlock(),e.createElementBlock("svg",js,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"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 Ps=R(zs,[["render",Us]]),Hs={key:0,class:"flex items-start gap-x-1"},Gs={key:0,class:"text-red-500 text-[14px]"},qs=["title"],Ks=["disabled"],Re=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(o){const t=o,s=e.useModel(o,"modelValue");return(n,l)=>t.view==="checkbox"?(e.openBlock(),e.createElementBlock("div",Hs,[e.createVNode(We,{modelValue:s.value,"onUpdate:modelValue":l[0]||(l[0]=a=>s.value=a),label:n.text,error:n.error||""},null,8,["modelValue","label","error"]),n.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",Gs,"*")):e.createCommentVNode("",!0),n.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:n.i,onClick:l[1]||(l[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(Ps),{class:"text-gray-500 w-[14px] h-[14px]"})],8,qs)):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",[s.value?`bg-${n.style?.primaryColor||"blue"}-500`:"bg-stone-200",n.customClass]]),disabled:n.disabled,onClick:l[2]||(l[2]=a=>s.value=!s.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",[s.value?"translate-x-4":"translate-x-0"]])},null,2)],10,Ks))}}),Zs=["innerHTML"],ze=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(o){return(t,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(t.customClass),innerHTML:t.html?t.html:t.text},null,10,Zs))}}),Ys=["placeholder","disabled","name"],Je=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(o){const t=o,{inputClass:s}=ee(t.style),n=e.useModel(o,"modelValue"),l=e.ref(null);let a=null;return e.onMounted(async()=>{if(l.value){const{default:r}=await Promise.resolve().then(()=>ui);a=r(l.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:l,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(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,Ys))}}),Ws={class:"relative w-full bg-white rounded-lg"},Js=["placeholder","disabled"],Xe=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(o){const t=o,{inputClass:s}=ee(t.style),n=e.useModel(o,"modelValue");return(l,a)=>(e.openBlock(),e.createElementBlock("div",Ws,[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:l.placeholder,disabled:l.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(s),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Js),[[e.vModelText,n.value]])]))}}),Xs=["value","disabled"],Qs={class:"text-[13px] text-gray-700"},en=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(o){const t=e.useModel(o,"modelValue");return(s,n)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center gap-0",[s.customClass]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n[0]||(n[0]=l=>t.value=l),type:"radio",value:s.value,disabled:s.disabled,class:"hidden"},null,8,Xs),[[e.vModelRadio,t.value]]),e.createElementVNode("span",{class:e.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${s.style?.primaryColor||"blue"}-500`,s.disabled?"opacity-50 cursor-not-allowed":""]])},[t.value==s.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${s.style?.primaryColor||"blue"}-500`]])},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",Qs,e.toDisplayString(s.text),1)],2))}}),tn=["value","disabled"],sn={class:"text-[13px] text-gray-700"},nn={"vs-input-radio-default":en,"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(o){const t=e.useModel(o,"modelValue");return(s,n)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[t.value==s.value?`ring-2 ring-ring ring-${s.style?.primaryColor||"blue"}-500`:"",s.customClass]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":n[0]||(n[0]=l=>t.value=l),type:"radio",value:s.value,disabled:s.disabled,class:"hidden"},null,8,tn),[[e.vModelRadio,t.value]]),e.createElementVNode("span",sn,e.toDisplayString(s.text),1)],2))}})},je=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(o){const t=o,s=e.useModel(o,"modelValue"),n=e.computed(()=>nn[`vs-input-radio-${t.view}`]);return(l,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([l.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options,r=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.value),e.mergeProps({key:r?.id,text:r.text,value:r.id.toString(),checked:s.value===r.id,modelValue:s.value,"onUpdate:modelValue":a[0]||(a[0]=i=>s.value=i)},{ref_for:!0},l.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),Qe=R(e.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(o,{emit:t}){const s=o,n=t,l=e.ref([]),a=e.reactive({}),r=c=>c?.value||c?.id||c?.text||c,i=c=>c.text||String(c),d=c=>`lg:col-span-${c||12}`,u=async()=>{try{const c=await fetch(`/api/suggest/${s.data}`).then(p=>p.json());l.value=c?.data||c}catch(c){console.error(c)}};return e.watch(()=>s.modelValue,c=>{if(typeof c=="boolean"&&l.value.length===1){const p=r(l.value[0]);a[p]=c}else if(Array.isArray(c)){const p=new Set(c);l.value.forEach(h=>{if(!h.disabled){const x=r(h);a[x]=p.has(x)}})}},{immediate:!0}),e.watch(a,()=>{if(!l.value.length){n("update:modelValue",null);return}const c=Object.entries(a).filter(([,p])=>p).map(([p])=>p);n("update:modelValue",c.length===0?[]:c)},{deep:!0}),e.onMounted(()=>{if(s.data)u().then(()=>{if(typeof s.modelValue=="boolean"&&l.value.length===1){const c=r(l.value[0]);a[c]=s.modelValue}else if(Array.isArray(s.modelValue)){const c=new Set(s.modelValue);l.value.forEach(p=>{if(!p.disabled){const h=r(p);a[h]=c.has(h)}})}});else if(l.value=s.options,typeof s.modelValue=="boolean"&&l.value.length===1){const c=r(l.value[0]);a[c]=s.modelValue}else if(Array.isArray(s.modelValue)){const c=new Set(s.modelValue);l.value.forEach(p=>{if(!p.disabled){const h=r(p);a[h]=c.has(h)}})}}),(c,p)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["p-0 w-full gap-[6px]",[c.position==="vertical"?"flex-col":"",c.colSpan?"grid":"flex justify-start"]])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,h=>(e.openBlock(),e.createBlock(We,{modelValue:a[r(h)],"onUpdate:modelValue":x=>a[r(h)]=x,value:r(h),class:e.normalizeClass(d(c.colSpan)),disabled:h.disabled,label:i(h),key:r(h),icon:h?.icon,imgUrl:h?.imgUrl,option:h,view:c.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-91f3584a"]]),ln=["type","placeholder","disabled"],et=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(o,{emit:t}){const s=o;function n(d){return d?s.mode==="datetime"?(d.includes("T")?d:null)||d+(d.includes(" ")?"":"T00:00"):d?.split(" ")[0]:null}const{inputClass:l}=ee(s.style),a=t,r=e.computed({get:()=>n(s.modelValue),set:d=>a("update:modelValue",d)}),i=e.computed(()=>s.mode==="datetime"?"datetime-local":s.mode);return(d,u)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":u[0]||(u[0]=c=>r.value=c),placeholder:d.placeholder,disabled:d.disabled,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[d.modelValue?"":"text-opacity-50",e.unref(l)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,ln)),[[e.vModelDynamic,r.value]])}}),an=async(o,t,s,n)=>{try{const l=new FormData;return l.append("unique","true"),l.append("file",o),(await fetch(`/file/upload/uploads?id=${t||""}&form=${s||""}&table=${n||""}`,{method:"POST",body:l}).then(r=>r.json()))?.result}catch(l){return G.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",l),null}},rn=async o=>{try{return await fetch(`file/delete${o}`),!0}catch(t){return console.error(t),!1}},tt=async o=>{try{const t=await fetch(`file/download/files/uploads${o}`),s=await t.arrayBuffer(),n=t.headers["content-type"],l=new TextDecoder("utf-8").decode(s),a=new Blob([l],{type:n}),r=document.createElement("a");r.setAttribute("download",o),r.href=window.URL.createObjectURL(a),r.click()}catch(t){console.error(t.message)}},on={},dn={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 un(o,t){return e.openBlock(),e.createElementBlock("svg",dn,t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const _e=R(on,[["render",un]]),cn={},pn={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 hn(o,t,s,n,l,a){return e.openBlock(),e.createElementBlock("svg",pn,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 mn=R(cn,[["render",hn]]),fn={},gn={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 kn(o,t,s,n,l,a){return e.openBlock(),e.createElementBlock("svg",gn,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 bn=R(fn,[["render",kn]]),yn={},xn={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 _n(o,t){return e.openBlock(),e.createElementBlock("svg",xn,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 st=R(yn,[["render",_n]]),wn={},En={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 Vn(o,t,s,n,l,a){return e.openBlock(),e.createElementBlock("svg",En,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 Cn=R(wn,[["render",Vn]]),Bn={},vn={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 Nn(o,t,s,n,l,a){return e.openBlock(),e.createElementBlock("svg",vn,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 Sn=R(Bn,[["render",Nn]]),Mn=o=>{if(!o)return"";const t=o?.split(".");return t[t.length-1]},Fn=o=>{const t=Mn(o),s={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 s.imageFormat.includes(t)?"img":s.sheetsFormat.includes(t)?bn:s.textsFormat.includes(t)?Sn:s.documentsFormat.includes(t)?mn:s.archivesFormat.includes(t)?Cn:st},An={},$n={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 Dn(o,t){return e.openBlock(),e.createElementBlock("svg",$n,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const Fe=R(An,[["render",Dn]]),In={},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",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function Tn(o,t){return e.openBlock(),e.createElementBlock("svg",Ln,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 nt=R(In,[["render",Tn]]),On={class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},Rn={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},lt=R(e.defineComponent({__name:"vs-input-file-list-item",props:e.mergeModels({format:{},multiple:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(o){const t=e.useModel(o,"value"),s=e.useModel(o,"item"),n=o;return(l,a)=>(e.openBlock(),e.createElementBlock("div",On,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Fn)(s.value)),{src:s.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:a[0]||(a[0]=r=>e.unref(tt)(s.value))},null,8,["src"])),e.createElementVNode("div",Rn,[e.createElementVNode("button",{type:"button",onClick:a[1]||(a[1]=r=>{e.unref(rn)(s.value),t.value=n.multiple?t.value?.filter(i=>i!==s.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[e.createVNode(Fe,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:a[2]||(a[2]=r=>e.unref(tt)(s.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(nt,{class:"w-4 h-4"})])])]))}}),[["__scopeId","data-v-0ca886b3"]]),zn={class:"flex items-center gap-x-2"},jn={key:1,class:"flex items-center flex-wrap gap-2"},at=e.defineComponent({__name:"vs-input-file",props:e.mergeModels({format:{},multiple:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const t=o,s=e.useModel(o,"modelValue"),n=e.ref(null),l=r=>Array.isArray(s.value)&&s.value[r]||"",a=async r=>{if(t.format){const u=r.target.files?.[0];if(!u||!u.name.endsWith(t.format))return}const i=r.target.files?.[0];if(!i)return;const d=await an(i,"1","form","table");s.value=t.multiple?[...s.value||[],d?.file_path]:d?.file_path};return(r,i)=>(e.openBlock(),e.createElementBlock("div",zn,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:n,type:"file",onChange:a},null,544),!r.multiple&&s.value?(e.openBlock(),e.createBlock(lt,{key:0,item:s.value,"onUpdate:item":i[0]||(i[0]=d=>s.value=d),value:s.value,"onUpdate:value":i[1]||(i[1]=d=>s.value=d)},null,8,["item","value"])):r.multiple?(e.openBlock(),e.createElementBlock("div",jn,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(d,u)=>(e.openBlock(),e.createBlock(lt,{multiple:r.multiple,key:u,value:s.value,"onUpdate:value":i[2]||(i[2]=c=>s.value=c),item:l(u)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:i[3]||(i[3]=d=>!r.disabled&&n.value?.click()),class:e.normalizeClass(["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",r.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[e.createVNode(_e,{class:"w-6 h-6"})],2)])):e.createCommentVNode("",!0),r.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:i[4]||(i[4]=d=>n.value?.click()),class:e.normalizeClass([r.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","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"])},[e.createVNode(_e,{class:"w-6 h-6"})],2))]))}}),Un={class:"max-w-[55vw]"},Pn={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},Hn={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},Gn={class:"px-[5px]"},qn={class:""},Ae=e.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(o){const t=o,s=e.computed(()=>{try{return new Date(t.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function n(l){if(l<1024)return`${l} B`;const a=l/1024;return a<1024?`${a.toFixed(2)} KB`:`${(a/1024).toFixed(2)} MB`}return(l,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",Un,[e.createElementVNode("p",Pn,e.toDisplayString(l.item?.uploaded_name),1),e.createElementVNode("p",Hn,[e.createElementVNode("span",null,e.toDisplayString(l.item?.username),1),e.withDirectives(e.createElementVNode("span",Gn,"|",512),[[e.vShow,l.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(s.value),1),a[0]||(a[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",qn,e.toDisplayString(n(l.item?.size)),1)])])],64))}}),Kn={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},Zn={key:0,class:"flex w-full gap-x-3 items-center"},Yn={key:1,class:"flex gap-x-3 w-full items-center"},Wn={key:2,class:"flex gap-x-3 w-full items-center"},Jn=["href"],Xn={key:3,class:"flex gap-x-3 w-full items-center"},Qn={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},el={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"},tl={class:"inline-block"},sl={class:"inline-block"},nl=e.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(o,{emit:t}){const s=o,n=t;function l(c){return["pdf","json"].includes(c.ext)}function a(c){return["ppt","pptx","doc","docx","xls","xlsx"].includes(c.ext)}function r(c){const p=document.createElement("a");p.setAttribute("download",c?.uploaded_name),p.href=c?.file_path,p.click()}async function i(){try{await fetch(`${s.prefix}/widget/file/${s.item.entity_id}/${s.item.file_id}`),n("update")}catch(c){console.error(c)}}function d(){n("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function u(c){(s.item.ext==="jpg"||s.item.ext==="png")&&n("openLightbox",{item:s.item,index:c})}return(c,p)=>(e.openBlock(),e.createElementBlock("div",Kn,[c.item.ext==="jpg"||c.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",Zn,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:p[0]||(p[0]=h=>u(c.index))},[e.createVNode(Ae,{item:c.item},null,8,["item"])])])):l(c.item)?(e.openBlock(),e.createElementBlock("div",Yn,[e.createVNode(Ae,{item:c.item},null,8,["item"])])):a(c.item)?(e.openBlock(),e.createElementBlock("div",Wn,[e.createElementVNode("a",{href:`/api/file-preview?id=${c.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(Ae,{item:c.item},null,8,["item"])],8,Jn)])):(e.openBlock(),e.createElementBlock("div",Xn,[e.createVNode(Ae,{item:c.item},null,8,["item"])])),e.createElementVNode("div",Qn,[e.createElementVNode("div",el,[e.createElementVNode("div",tl,[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:p[1]||(p[1]=h=>r(c.item))},[e.createVNode(nt,{height:"14",width:"14"})])]),p[3]||(p[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",sl,[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:p[2]||(p[2]=h=>d())},[e.createVNode(Fe,{height:"14",width:"14"})])])])])]))}}),ll={},al={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 rl(o,t){return e.openBlock(),e.createElementBlock("svg",al,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"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 ol=R(ll,[["render",rl]]),il={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},dl={class:"flex w-full mb-[12px] items-center gap-x-2"},ul={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},cl={class1:"ml-auto"},pl={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"},hl={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},ml={class:"relative"},fl={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"},gl={key:0},rt=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(o,{emit:t}){const s=o,n=e.inject("form"),l=e.computed(()=>n.value.formId),a=e.ref(!1),r=e.ref(0),i=t,d=e.ref(!1),u=e.ref({}),c=e.ref([]),p=e.ref(""),h=e.computed(()=>Array.isArray(c.value)?c.value.filter(b=>b.ext==="jpg"||b.ext==="png").map(b=>b?.file_path):[]),x=e.computed(()=>p.value===""?c.value:c.value.filter(b=>b?.uploaded_name?.includes(p.value))),A=b=>{const k=h.value.findIndex(S=>S===b.item.file_path);k!==-1&&(a.value=!0,r.value=k)},V=async()=>{try{const b=await fetch(`${s.prefix}/widget/file/${l.value}`).then(k=>k.json());c.value=b?.rows}catch(b){console.error(b)}},M=async b=>{await Promise.all(Array.from(b.target.files).map(async k=>{const S=new FormData;S.append("file",k);try{const U=`${s.prefix}/widget/file/${l.value}`,w=await fetch(U,{method:"POST",body:S});return w.ok?(i("update","file-list"),k):(G.notify({type:w.status>=400&&w.status<500?"warning":"error",title:"Error",message:`Error code: ${w.status}`}),null)}catch(U){return G.notify({type:"error",title:"Error",message:U.message||"Unknown error"}),console.error(U),null}})),await V()},C=b=>{const k={...b};return b.cancel||(k.cancel=()=>{d.value=!1}),b.updateListOnConfirm&&(k.confirm=async()=>{await b.confirm(),d.value=!1,V()}),k},B=b=>{u.value=C(b),d.value=!0};return e.watch(l,b=>{b&&V()}),e.onMounted(()=>{l.value&&V()}),(b,k)=>{const S=e.resolveComponent("Lightbox"),U=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",il,[e.createElementVNode("div",dl,[e.createElementVNode("h2",ul," Файлів: "+e.toDisplayString(c.value?.length),1),e.createElementVNode("div",cl,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:k[0]||(k[0]=w=>M(w))},null,32),e.createElementVNode("div",pl,[e.createVNode(ol,{height:"16",width:"16"})])])])]),c.value?.length>4?(e.openBlock(),e.createElementBlock("div",hl,[e.createElementVNode("div",null,[e.createElementVNode("div",ml,[k[8]||(k[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":k[1]||(k[1]=w=>p.value=w),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,p.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),c.value?.length?(e.openBlock(),e.createElementBlock("div",fl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,(w,W)=>(e.openBlock(),e.createBlock(nl,{key:W,prefix:b.prefix,item:w,index:W,onUpdate:k[2]||(k[2]=X=>b.$emit("update","file-list")),onOpenModal:k[3]||(k[3]=X=>B(X)),onOpenLightbox:k[4]||(k[4]=X=>A(X))},null,8,["prefix","item","index"]))),128)),x.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",gl,k[9]||(k[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):e.createCommentVNode("",!0),e.createVNode(S,{modelValue:a.value,"onUpdate:modelValue":k[5]||(k[5]=w=>a.value=w),startIndex:r.value,"onUpdate:index":k[6]||(k[6]=w=>r.value=w),images:h.value},null,8,["modelValue","startIndex","images"]),e.createVNode(U,e.mergeProps({modelValue:d.value,"onUpdate:modelValue":k[7]||(k[7]=w=>d.value=w),onConfirm:u.value.confirm},u.value),null,16,["modelValue","onConfirm"])])}}}),kl={class:"flex items-center justify-between"},bl={class:"text-[16px] text-gray-900 font-medium"},yl={class:"grid gap-3"},xl=R(e.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(o){const t=o,s=e.ref(t.isOpen);return e.watch(()=>t.isOpen,n=>{s.value=n}),(n,l)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",kl,[e.createElementVNode("p",bl,e.toDisplayString(o.title),1),e.createVNode(Re,{modelValue:s.value,"onUpdate:modelValue":l[0]||(l[0]=a=>s.value=a),style:e.normalizeStyle(o.style)},null,8,["modelValue","style"])]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",yl,[e.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[e.vShow,s.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),_l={class:"text-[16px] text-gray-900 font-medium"},wl={class:"grid gap-3"},El=R(e.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(o){const t=o,s=e.ref(t.isOpen);return e.watch(()=>t.isOpen,n=>{s.value=n}),(n,l)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("button",{type:"button",onClick:l[0]||(l[0]=a=>s.value=!s.value),class:"flex items-center gap-2"},[e.createVNode(e.unref(Is),{class:e.normalizeClass(["h-4 w-4 duration-300",[s.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",_l,e.toDisplayString(o.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",wl,[e.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[e.vShow,s.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),Vl={class:"flex items-center justify-between"},Cl={switcher:xl,accordion:El,default:e.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(o){return(t,s)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Vl,[e.createElementVNode("p",null,e.toDisplayString(o.title),1)]),e.renderSlot(t.$slots,"default")]))}})},te={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Bl=(o,t)=>String(o)===String(t),vl=(o,t)=>String(o)!==String(t),Nl=(o,t)=>o>t,Sl=(o,t)=>o>=t,Ml=(o,t)=>o<t,Fl=(o,t)=>o<=t,Al=(o,t)=>Array.isArray(t)&&t.length===2?o>=t[0]&&o<=t[1]:!1,$l=(o,t)=>String(o).startsWith(String(t)),Dl=(o,t)=>String(o).endsWith(String(t)),Il=(o,t)=>String(o).includes(String(t)),Ll=(o,t)=>Array.isArray(t)?t.includes(o):!1,Tl=(o,t)=>Array.isArray(t)?!t.includes(o):!0,ot=(o,t)=>{if(!t)return!0;switch(t?.[1]){case te.Equal:return Bl(o,t?.[2]);case te.Inequal:return vl(o,t?.[2]);case te.Higer:return Nl(o,t?.[2]);case te.HigerOrEqual:return Sl(o,t?.[2]);case te.Lower:return Ml(o,t?.[2]);case te.LowerOrEqual:return Fl(o,t?.[2]);case te.Between:return Al(o,t?.[2]);case te.StartWith:return $l(o,t?.[2]);case te.EndWith:return Dl(o,t?.[2]);case te.Contain:return Il(o,t?.[2]);case te.In:return Ll(o,t?.[2]);case te.NotIn:return Tl(o,t?.[2]);default:return!0}},it=e.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},schema:{type:Array,default:()=>[]}},setup(o){const t=o,s=e.inject("formValues",{default:{}}),n=e.inject("form"),l=e.computed(()=>t.schema?.filter(r=>{const i=r?.conditions;if(!i)return!0;const d=Array.isArray(i)?i[0]:i,u=s?.value?.[d];return ot(u,i)})),a=e.computed(()=>Cl[t.view]);return(r,i)=>o.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),{key:0,title:o.title,style:e.normalizeStyle(o.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,d=>(e.openBlock(),e.createBlock(xt,e.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:e.unref(s)[d.name],"onUpdate:modelValue":u=>e.unref(s)[d.name]=u,style:o.style,error:e.unref(n)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),Ol=["aria-expanded","data-focus"],Rl={class:"flex items-center"},zl=["title"],jl=["onClick"],Ul=["title"],Pl={key:2,class:"text-gray-500 truncate"},Hl={class:"flex-1 min-w-[2px]"},Gl=["placeholder"],ql={class:"flex items-center shrink-0"},Kl=["disabled"],Zl=["disabled","title"],Yl=["aria-disabled","onClick"],Wl={key:1,class:"px-3 py-2 text-center text-gray-500"},Jl=["disabled"],Ue=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:{},add:{},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},emits:["change","update:modelValue"],setup(o,{emit:t}){const s=o,n=t,l=e.computed(()=>s.multiple),a=e.computed(()=>s.disabled);ee(s.style);const r=e.computed({get:()=>s.modelValue,set:g=>n("update:modelValue",g)});!r.value&&s.defaultValue&&(r.value=s.defaultValue);const i=e.ref(null),d=e.ref(null),u=e.ref(null),c=e.ref(null),p=e.ref(!1),h=e.ref(!1),x=e.ref(null),A=e.ref([]),V=e.ref(-1),M=e.ref([]),C=e.ref(""),B=e.ref(null),b=e.ref("bottom"),k=e.ref({}),S=e.ref([]),U=e.computed(()=>{if(!S.value.length)return[];const g=new Map(A.value.map(m=>[m.id?.toString(),m]));return S.value.map(m=>g.get(m?.toString())).filter(m=>!!m)}),w=e.computed(()=>s.placeholder||"Select..."),W=e.computed(()=>l.value?!S.value.length&&C.value==="":!x.value?.text&&C.value===""),X=e.computed(()=>a.value?!1:l.value?S.value.length>0:!!r.value),Q=g=>l.value?S.value.some(m=>m?.toString()===g?.toString()):r.value?.toString()===g?.toString(),Z=e.computed(()=>{let g=A.value??[];if(!s.data&&C.value.trim()!==""){const m=C.value.toLowerCase();g=g.filter(_=>_.text?.toLowerCase?.().includes(m))}if(l.value&&S.value.length){const m=new Set(S.value.map(_=>_?.toString()));g=g.filter(_=>!m.has(_.id?.toString()))}return g}),Ne=e.inject("values"),ue=e.computed(()=>s.parent?Ne?.value?.[s.parent]??null:null),se=async g=>{if(!s.data){let m=s.options??[];if(g?.trim()){const _=g.toLowerCase();m=m.filter(T=>T.text?.toLowerCase?.().includes(_))}return m}try{const m=s.host??"",_=s.prefix??"api",T=s.api??`/${_}/suggest/${s.data}`,Y=`${m}${T}`,ae=new URLSearchParams;return ae.set("json","1"),g&&ae.set("key",g),ue.value!==void 0&&ue.value!==null&&ue.value!==""&&ae.set("parent",String(ue.value)),(await fetch(`${Y}?${ae.toString()}`).then(ye=>ye.json()))?.data??[]}catch{return[]}},D=async()=>{s.data?A.value=await se(C.value):A.value=s.options?[...s.options]:[]},v=async g=>{if(g==null)return null;const m=A.value?.find(T=>T?.id?.toString()===String(g));return m||((await se(String(g)))?.[0]??null)},N=async g=>{const m=new Set(A.value.map(T=>T.id?.toString())),_=g.filter(T=>!m.has(T?.toString()));_.length&&await _.reduce(async(T,Y)=>{await T;const ae=await v(Y);ae&&A.value.push(ae)},Promise.resolve())},z=async()=>{a.value||(p.value=!0,await D(),await e.nextTick(()=>{de(),B.value?.focus(),Z.value.length?V.value=0:V.value=-1}))},P=()=>{p.value=!1,V.value=-1},ne=async g=>{if(a.value)return;!p.value?await z():P()},f=async()=>{p.value?B.value?.focus():await z()},y=()=>{l.value?(S.value=[],r.value=[],n("change",[])):(x.value=null,r.value=null,n("change",null)),C.value="",e.nextTick(()=>B.value?.focus())},I=g=>{l.value&&(S.value=S.value.filter(m=>m?.toString()!==g?.toString()),r.value=[...S.value],n("change",r.value),e.nextTick(()=>B.value?.focus()))},j=g=>{l.value?(Q(g.id)||(S.value=[...S.value,g.id],r.value=[...S.value],n("change",r.value)),C.value="",e.nextTick(()=>{B.value?.focus(),V.value=Math.min(V.value,Z.value.length-1)})):(x.value=g,r.value=g.id,n("change",r.value),C.value="",P())},H=g=>{Q(g.id)||j(g)},le=(g,m)=>{if(!g||!m)return;const _=g.offsetTop,T=_+g.offsetHeight,Y=m.scrollTop,ae=Y+m.clientHeight;let ke=m.scrollTop;_<Y?ke=_-80:T>ae&&(ke=T-m.clientHeight+4);const ye=m;ye.scrollTop=ke},ce=g=>{let m=g.parentElement;for(;m;){if(m.classList.contains("ui-dialog__content"))return m;const _=window.getComputedStyle(m),T=_.overflow+_.overflowY+_.overflowX;if(T.includes("auto")||T.includes("scroll")||m===document.body||m===document.documentElement)return m;m=m.parentElement}return document.body},de=()=>{if(!d.value)return;const g=d.value.getBoundingClientRect(),m=window.innerHeight||document.documentElement.clientHeight,_=window.innerWidth||document.documentElement.clientWidth,T=8,Y=8,ae=s.maxHeight||300,ke=m-g.bottom-Y-T,ye=g.top-Y-T,Oe=ke>=ye,Ze=Math.max(_-T*2,0);let{width:Se}=g;Ze>0&&Se>Ze&&(Se=Ze);let{left:Me}=g;Me+Se+T>_&&(Me=_-Se-T),Me=Math.max(Me,T);const ki=Math.min(ae,Math.max(Oe?ke:ye,50));b.value=Oe?"bottom":"top",k.value={position:"fixed",left:`${Me}px`,width:`${Se}px`,minWidth:"300px",maxHeight:`${ki}px`,transform:Oe?"none":"translateY(-100%)",top:Oe?`${g.bottom+Y}px`:`${g.top-Y}px`}},fe=async g=>{a.value||!p.value&&(g.key==="ArrowDown"||g.key==="ArrowUp")&&(g.preventDefault(),await z())},ge=g=>{if(!p.value)return;const{key:m}=g;if(m==="ArrowDown")g.preventDefault(),V.value+1<Z.value.length&&(V.value+=1,le(M.value[V.value],u.value));else if(m==="ArrowUp")g.preventDefault(),V.value>0&&(V.value-=1,le(M.value[V.value],u.value));else if(m==="Enter"){g.preventDefault();const _=Z.value[V.value];_&&j(_),B.value?.blur()}else m==="Escape"?(g.preventDefault(),P()):m==="Backspace"?l.value&&C.value===""&&S.value.length&&(S.value=S.value.slice(0,-1),r.value=[...S.value],n("change",r.value)):m==="Home"?(V.value=0,le(M.value[0],u.value)):m==="End"?(V.value=Z.value.length-1,le(M.value[V.value],u.value)):m==="Tab"&&P()},ci=()=>{a.value||(h.value=!0)},pi=()=>{h.value=!1,C.value=""},Tt=g=>{g.key==="Escape"&&p.value&&P()},Ot=g=>{const m=g.target;i.value?.contains(m)||c.value?.contains(m)||P()},Rt=g=>{p.value&&u.value&&!u.value.contains(g.target)&&de()},zt=()=>{p.value&&de()},jt=()=>{p.value&&de()};e.watch(()=>s.options,g=>{g?.length&&(A.value=[...g])},{immediate:!0});const Ut=async()=>{if(l.value)Array.isArray(r.value)?S.value=[...r.value]:(S.value=r.value==null?[]:[r.value],r.value=[...S.value]),!s.options?.length&&s.data&&await N(S.value);else{if(Array.isArray(r.value)){const g=r.value[0]??null;r.value=g??null}x.value=await v(r.value)}};e.watch(r,()=>{Ut()}),e.onMounted(async()=>{addEventListener("keydown",Tt),addEventListener("scroll",Rt,!0),addEventListener("resize",zt),document.addEventListener("click",Ot,!0),d.value&&ce(d.value).addEventListener("scroll",jt,!0),s.options?.length?A.value=[...s.options]:s.data&&(A.value=await se("")),await Ut()}),e.onUnmounted(()=>{removeEventListener("keydown",Tt),removeEventListener("scroll",Rt,!0),removeEventListener("resize",zt),document.removeEventListener("click",Ot,!0),d.value&&ce(d.value).removeEventListener("scroll",jt,!0)});const Te=e.ref(!1),Ke=e.ref({}),Pt=e.ref([]),Ht=e.ref(null);async function hi(){if(!s.add?.token||Ht?.value.validate())return;const m=s.add.api??`/api/table/${s.add.token}`,{id:_}=await fetch(m,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ke.value)}).then(T=>T.json());if(!s.options?.length&&s.data){const{data:T}=await fetch(`${s.api??`/api/suggest/${s.data}`}?val=${_}`).then(Y=>Y.json());x.value=T[0],A.value.push(T[0]),r.value=_}Te.value=!1,G.notify({title:"Success!",message:"Object created."})}async function mi(){if(!s.add)return null;const g=await fetch(`/api/template/form/${s.add.form}`).then(m=>m.json());return Pt.value=g.schema,Te.value=!0,null}function fi(g,m=200){let _;return(...T)=>{_&&clearTimeout(_),_=window.setTimeout(()=>g(...T),m)}}const gi=fi(async g=>{A.value=await se(g)},200);return e.watch(C,g=>{s.data&&gi(g.trim())}),e.watch(()=>s.options,g=>{!s.data&&g?.length&&(A.value=[...g])},{immediate:!0}),e.watch(()=>s.parent??s.parentValue,()=>{s.data&&D()}),e.watch(ue,async()=>{s.data&&(l.value?(S.value=[],r.value=[],n("change",[])):(x.value=null,r.value=null,n("change",null)))}),(g,m)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(G.VsModal),{visible:Te.value,"onUpdate:visible":m[1]||(m[1]=_=>Te.value=_),title:"Додати",buttonText:"Додати",onDone:hi},{default:e.withCtx(()=>[e.createVNode(me,{schema:Pt.value,modelValue:Ke.value,"onUpdate:modelValue":m[0]||(m[0]=_=>Ke.value=_),ref_key:"addForm",ref:Ht},null,8,["schema","modelValue"])]),_:1},8,["visible"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:m[4]||(m[4]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",s.customClass])},[m[9]||(m[9]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),m[10]||(m[10]=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",p.value||h.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":p.value,"aria-haspopup":"listbox",onKeydown:fe,onClick:f,"data-focus":p.value||h.value?"true":"false"},[e.createElementVNode("div",{class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"triggerRef",ref:d},[l.value&&S.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(U.value,_=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border",key:_.id},[e.createElementVNode("div",Rl,[_?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5",style:e.normalizeStyle({backgroundColor:_?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"truncate text-gray-900 overflow-hidden",title:_.text},e.toDisplayString(_.text),9,zl)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:e.withModifiers(T=>I(_.id),["stop"])},m[5]||(m[5]=[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,jl)]))),128)):!l.value&&!h.value&&x.value?.text&&C.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900"]),title:x.value.text},[x.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:x.value?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("span",{class:e.normalizeClass({"pl-5":x.value?.color})},e.toDisplayString(x.value.text),3)],8,Ul)):e.createCommentVNode("",!0),W.value?(e.openBlock(),e.createElementBlock("div",Pl,e.toDisplayString(w.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Hl,[!a.value&&g.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:B,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:(l.value&&S.value.length?" ":null)||(h.value&&!C.value?.length?x.value?.text:" "),"onUpdate:modelValue":m[2]||(m[2]=_=>C.value=_),onFocus:ci,onBlur:pi,onKeydown:ge},null,40,Gl)),[[e.vModelText,C.value]]):e.createCommentVNode("",!0)])],512),e.createElementVNode("div",ql,[X.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:a.value,onClick:e.withModifiers(y,["stop"])},m[6]||(m[6]=[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,Kl)):e.createCommentVNode("",!0),m[8]||(m[8]=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:m[3]||(m[3]=e.withModifiers(_=>ne(),["stop"])),title:p.value?"Закрити список":"Відкрити список"},m[7]||(m[7]=[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,Zl)])],42,Ol),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[p.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:c,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(k.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:k.value.maxHeight||"300px"}),ref_key:"listRef",ref:u},[Z.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(Z.value,(_,T)=>(e.openBlock(),e.createElementBlock("div",{key:_.id,ref_for:!0,ref:Y=>M.value[T]=Y,class:e.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900 ",Q(_.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",V.value===T&&!Q(_.id)?"bg-blue-100":""]),"aria-disabled":Q(_.id)?"true":"false",role:"option",tabindex:"-1",onClick:Y=>H(_)},[_?.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:_?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",V.value===_.id?"text-white":"",(V.value===T,"")])},e.toDisplayString(_.text),3)],10,Yl))),128)):(e.openBlock(),e.createElementBlock("div",Wl," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),s.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:mi,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(_e,{width:"16",height:"16"}),m[11]||(m[11]=e.createElementVNode("span",null,"Додати",-1))],8,Jl)):e.createCommentVNode("",!0)],512)],64))}}),Xl=["placeholder","disabled"],dt=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(o){const t=o,{inputClass:s}=ee(t.style),n=e.useModel(o,"modelValue");return(l,a)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":a[0]||(a[0]=r=>n.value=r),placeholder:l.placeholder,disabled:l.disabled,row:"2",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,Xl)),[[e.vModelText,n.value]])}}),Ql={},ea={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 ta(o,t){return e.openBlock(),e.createElementBlock("svg",ea,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 sa=R(Ql,[["render",ta]]),na={},la={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 aa(o,t){return e.openBlock(),e.createElementBlock("svg",la,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 ra=R(na,[["render",aa]]),oa={},ia={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 da(o,t){return e.openBlock(),e.createElementBlock("svg",ia,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 ua=R(oa,[["render",da]]),ca={},pa={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 ha(o,t){return e.openBlock(),e.createElementBlock("svg",pa,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"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 ma=R(ca,[["render",ha]]),fa={},ga={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 ka(o,t){return e.openBlock(),e.createElementBlock("svg",ga,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=R(fa,[["render",ka]]),ba={},ya={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function xa(o,t){return e.openBlock(),e.createElementBlock("svg",ya,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 _a=R(ba,[["render",xa]]),wa={},Ea={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 Va(o,t){return e.openBlock(),e.createElementBlock("svg",Ea,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 Ca=R(wa,[["render",Va]]),Ba={class:"vs-datatable border rounded-xl w-full flex-grow"},va={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},Na={class:"relative w-full"},Sa={class:"table-wrapper flex gap-2"},Ma={class:"vs-popover inline-block text-slate-700"},Fa={class:"text-center"},Aa={class:""},$a={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"},Da={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},Ia={class:"text-sm items-center text-gray-800 flex gap-1"},La={class:"w-full overflow-x-auto"},Ta={class:"w-full table-auto caption-bottom text-sm"},Oa={class:"[&_tr]:border-b"},Ra={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"},za={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"},ja={key:0,colspan:"100%",class:"text-center"},Ua={class:"w-full"},Pa={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},Ha=["onDragstart","onDragover","onDrop"],Ga={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},qa={class:"flex items-center justify-center"},Ka={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"},Za={key:0},Ya=["src"],Wa={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},Ja=["innerHTML"],Xa={key:2,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"},Qa={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},er={class:"flex items-center justify-center gap-2"},tr=["onClick"],sr=["onClick"],nr={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},ct=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(o){const t=o,s=e.useModel(o,"modelValue"),n=e.ref({}),l=e.ref(""),a=e.computed(()=>{if(!l.value)return s.value??[];const D=l.value.toLowerCase();return s.value.filter(v=>t.colModel?.some(N=>{const z=v[N.key];return z?Array.isArray(z)?z.join(", ").toLowerCase().includes(D):String(z).toLowerCase().includes(D):!1}))}),r=e.ref(null),i=e.ref(null),d=e.ref(!1),u=e.ref(null),c=e.ref({top:0,left:0}),p=D=>{r.value=D},h=D=>{i.value=D},x=D=>{if(r.value===null||r.value===D){r.value=null,i.value=null;return}const v=[...s.value],[N]=v.splice(r.value,1);v.splice(D,0,N),s.value=v,r.value=null,i.value=null},A=D=>{const N=D.currentTarget.getBoundingClientRect();c.value={top:N.bottom+window.scrollY,left:N.left+window.scrollX},d.value=!d.value},V=()=>{u.value&&u.value.click()},M=D=>{const v=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],N=D.toLowerCase();return v.some(z=>N.endsWith(z))},C=D=>{const N=D.target.files?.[0];if(!N)return;const z=new FileReader;z.onload=P=>{try{const ne=P.target?.result;if(typeof ne=="string"){const f=JSON.parse(ne);Array.isArray(f)&&s.value.push(...f)}}catch(ne){console.error("Error parsing file:",ne)}},z.readAsText(N)},B=()=>{const D=JSON.stringify(s.value,null,2),v=new Blob([D],{type:"application/json"}),N=URL.createObjectURL(v),z=document.createElement("a");z.href=N,z.download="data.json",z.click(),URL.revokeObjectURL(N)};e.onMounted(async()=>{const D=t.colModel?.filter(v=>v.data);D?.length&&Promise.all(D.map(async v=>{const z=await(await fetch(`/api/suggest/${v.data}`)).json();n.value[v.key]=z.data}))});const b=e.ref(""),k=e.ref(!1);let S="edit",U=0;const w=e.ref({}),W=e.ref({});async function X(){b.value="Додати",k.value=!0,S="add",w.value={}}function Q(D,v){const N=v.key||v.name;return n.value[N]&&D[N]?n.value[N].find(z=>z.id.toString()===D[N].toString())?.text??D[N]:D[N]||"-"}async function Z(D,v){b.value="Редагувати",k.value=!0,S="edit",U=v,w.value={...D}}function Ne(){const D=W.value.validate();if(D){G.notify({type:"warning",title:"Помилка валідації",message:Object.entries(D).map(([v,N])=>`${v}: ${N}`).join(`
|
|
2
|
+
`)});return}S==="add"?Array.isArray(s.value)?s.value=[...s.value,w.value]:s.value=[w.value]:s.value=s.value.map((v,N)=>N===U?w.value:v),k.value=!1}function ue(D){s.value=s.value.filter((v,N)=>N!==D)}function se(){k.value=!1}return(D,v)=>(e.openBlock(),e.createElementBlock("div",Ba,[e.createElementVNode("div",va,[e.createElementVNode("div",Na,[e.createVNode(sa,{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":v[0]||(v[0]=N=>l.value=N),placeholder:"Пошук",class:"py-2 px-3 pl-10 w-full bg-gray-100 h-[36px] rounded-[8px] text-[15px] leading-[18px] focus:border-1 text-stone-800 placeholder:text-[#6B7280] focus:outline-blue-500 focus:outline-2"},null,512),[[e.vModelText,l.value]])]),e.createElementVNode("div",Sa,[e.createElementVNode("input",{ref_key:"fileInput",ref:u,onChange:C,class:"hidden",accept:".json",type:"file"},null,544),e.createElementVNode("div",Ma,[e.createElementVNode("div",Fa,[e.createElementVNode("div",Aa,[e.createElementVNode("button",{onClick:A,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(ra,{height:"16",width:"16"})])])])])]),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[d.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:e.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:c.value.top+"px",left:c.value.left+"px"}])},[e.createElementVNode("div",$a,[e.createElementVNode("div",Da,[e.createElementVNode("button",{onClick:V,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createVNode(ua,{class:"text-black",width:"14",height:"14"}),v[4]||(v[4]=e.createTextVNode(" Імпортувати ",-1))]),e.createElementVNode("button",{onClick:B,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[e.createElementVNode("span",Ia,[e.createVNode(ma,{class:"text-black",width:"14",height:"14"}),v[5]||(v[5]=e.createTextVNode(" Експортувати ",-1))])])])])],4)):e.createCommentVNode("",!0)])),e.createElementVNode("button",{onClick:X,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(_e),v[6]||(v[6]=e.createTextVNode(" Додати ",-1))])]),e.createElementVNode("div",La,[e.createElementVNode("table",Ta,[e.createElementVNode("thead",Oa,[e.createElementVNode("tr",Ra,[e.createElementVNode("th",za,[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(D.colModel,N=>(e.openBlock(),e.createElementBlock("th",{key:N.key,class:"h-10 px-2 text-left align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 min-w-[150px]"},e.toDisplayString(N.ua||N.label),1))),128)),v[7]||(v[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",ja,[e.createElementVNode("div",Ua,[e.createElementVNode("div",Pa,[e.createVNode(_a,{class:"w-48 mx-auto"}),v[8]||(v[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,(N,z)=>(e.openBlock(),e.createElementBlock("tr",{key:N.id,class:e.normalizeClass(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move",{"opacity-50":r.value===z,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":i.value===z}]),draggable:"true",onDragstart:P=>p(z),onDragover:e.withModifiers(P=>h(z),["prevent"]),onDrop:P=>x(z)},[e.createElementVNode("td",Ga,[e.createElementVNode("div",qa,[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(D.colModel,P=>(e.openBlock(),e.createElementBlock("td",{key:P.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[P.type==="file"?(e.openBlock(),e.createElementBlock("div",Ka,[M(Q(N,P))?(e.openBlock(),e.createElementBlock("div",Za,[e.createElementVNode("img",{src:Q(N,P),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,Ya)])):(e.openBlock(),e.createElementBlock("div",Wa,[e.createVNode(st,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):P.type==="tiptap-editor"?(e.openBlock(),e.createElementBlock("div",{key:1,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",innerHTML:Q(N,P)},null,8,Ja)):(e.openBlock(),e.createElementBlock("div",Xa,e.toDisplayString(Q(N,P)),1))]))),128)),e.createElementVNode("td",Qa,[e.createElementVNode("div",er,[e.createElementVNode("button",{onClick:P=>Z(N,z),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(Ca,{width:"24",height:"24",class:"w-3 h-3"})],8,tr),e.createElementVNode("button",{onClick:P=>ue(z),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-red-50 dark:hover:bg-slate-600 hover:border-red-300 dark:hover:border-slate-500 hover:text-red-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[e.createVNode(Fe,{width:"24",height:"24",class:"w-3 h-3"})],8,sr)])])],42,Ha))),128))],2)])]),e.createVNode(e.unref(G.VsModal),{visible:k.value,title:b.value,size:"lg",onClose:se},{default:e.withCtx(()=>[e.createVNode(me,{schema:t.colModel,values:w.value,"onUpdate:values":v[1]||(v[1]=N=>w.value=N),form:W.value,"onUpdate:form":v[2]||(v[2]=N=>W.value=N)},null,8,["schema","values","form"]),e.createElementVNode("div",nr,[e.createElementVNode("button",{type:"button",onClick:v[3]||(v[3]=N=>k.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:Ne,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])]),_:1},8,["visible","title"])]))}}),lr={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:"Клацніть на шари, щоб видалити їх"}}}}};function we(o){return o?o.type==="Polygon"?{type:"MultiPolygon",coordinates:[o.coordinates]}:o.type==="Feature"?{...o,geometry:we(o.geometry)}:o.type==="FeatureCollection"?{...o,features:(o.features||[]).map(t=>we(t)).filter(Boolean)}:o:null}function ar(o){return o?o.type==="FeatureCollection"||o.type==="Feature"?we(o):o.geom?{type:"Feature",geometry:we({type:o.geom.type,coordinates:o.geom.coordinates}),properties:{}}:o.type&&o.coordinates?{type:"Feature",geometry:we(o),properties:{}}:null:null}const rr={},or={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 ir(o,t){return e.openBlock(),e.createElementBlock("svg",or,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 dr=R(rr,[["render",ir]]),ur={},cr={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 pr(o,t){return e.openBlock(),e.createElementBlock("svg",cr,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 hr=R(ur,[["render",pr]]),mr={},fr={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 gr(o,t){return e.openBlock(),e.createElementBlock("svg",fr,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 kr=R(mr,[["render",gr]]),br={},yr={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 xr(o,t){return e.openBlock(),e.createElementBlock("svg",yr,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 _r=R(br,[["render",xr]]),wr={},Er={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 Vr(o,t){return e.openBlock(),e.createElementBlock("svg",Er,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 Cr=R(wr,[["render",Vr]]),Br={class:"form-geom__search"},vr={class:"map-search__input"},Nr={class:"flex flex-nowrap relative"},Sr={class:"form-autocomplete relative min-w-[6rem] vsTailwind map-search__select hidden"},Mr={class:"flex items-center w-full"},Fr={class:"max-w-[90%] truncate"},Ar={key:0,class:"absolute z-[3100] mt-0.5 left-0 right-0"},$r={class:"form-autocomplete__wrapper mt-[10px] z-50 w-full min-w-36 max-h-72 p-0 space-y-0.5 bg-white rounded-xl shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] dark:bg-neutral-900 top-full opened"},Dr={class:"form-autocomplete__list vsTailwind px-2 pb-2 pt-0 max-h-200 relative [&::-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 dark:bg-neutral-900"},Ir=["onClick"],Lr={class:"flex justify-between items-center w-full"},Tr={class:"flex items-center"},Or={key:0,class:"flex-shrink-0 w-3.5 h-3.5 text-blue-600",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Rr={class:"relative w-full"},zr={class:"vs-form-text relative bg-white rounded-lg"},jr={key:1,class:"absolute left-0 right-0 top-full z-[3200] bg-white border border-gray-200 rounded-b-lg shadow-lg max-h-72 overflow-auto"},Ur={key:0},Pr=["onClick"],Hr={key:1,class:"px-3 py-2 text-xs text-gray-500"},Gr={key:2,class:"px-3 py-2 text-xs text-gray-400"},qr=e.defineComponent({__name:"map-search",props:{placeholder:{default:"50, 30"}},emits:["goToCoordinates"],setup(o,{emit:t}){const s=t,n=e.ref(!1),l=e.ref("coordinates"),a=e.ref(""),r=e.ref([]),i=e.ref(!1),d=e.ref(!1);let u;const c=[{value:"coordinates",label:"Пошук по кординатам"},{value:"atu",label:"АТУ"},{value:"address",label:"Адресса"},{value:"search_here",label:"Пошук HERE"}],p=e.computed(()=>c.find(B=>B.value===l.value)?.label??"АТУ");function h(B){l.value=B.value,n.value=!1,a.value="",a.value&&V()}function x(B){B.target.closest(".map-search__input")||(n.value=!1)}e.onMounted(()=>document.addEventListener("click",x)),e.onUnmounted(()=>document.removeEventListener("click",x));async function A(B){let b;l.value==="atu"?b="/api/suggest/atu.nsdi.ato_level":l.value==="address"?b="/api/suggest/map.address_id":l.value==="search_here"&&(b="/api/gis-url-proxy");const k=new URL(b||"");return l.value==="search_here"?k.searchParams.set("searchtext",B):(l.value==="atu"||l.value==="address")&&k.searchParams.set("key",B),k.searchParams.set("limit","20"),k.searchParams.set("q",B),(await fetch(k.toString())).json()}function V(){if(i.value=!0,d.value=!0,l.value==="coordinates"){const B=a.value.trim().split(",");if(B.length===2){const b=parseFloat(B[0]),k=parseFloat(B[1]);!Number.isNaN(b)&&!Number.isNaN(k)&&s("goToCoordinates",[b,k])}return}u&&window.clearTimeout(u),u=window.setTimeout(async()=>{const B=a.value.trim();if(!B){r.value=[],d.value=!1;return}try{const b=await A(B);r.value=Array.isArray(b.features)?b.features:[]}catch{r.value=[]}finally{d.value=!1}},300)}function M(){a.value="",r.value=[],i.value=!1,d.value=!1}function C(B){s("goToCoordinates",B),i.value=!1,d.value=!1,r.value=[]}return(B,b)=>(e.openBlock(),e.createElementBlock("div",Br,[e.createElementVNode("div",vr,[e.createElementVNode("div",Nr,[e.createElementVNode("div",Sr,[e.createElementVNode("button",{type:"button",onClick:b[0]||(b[0]=k=>n.value=!n.value),class:"h-[40px] relative px-4 pe-9 flex text-nowrap w-full cursor-pointer bg-white border border-solid border-stone-200 rounded-lg text-start text-sm text-stone-800 focus:outline-none focus:ring-1 focus:ring-blue-600 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-200"},[e.createElementVNode("div",Mr,[e.createElementVNode("span",Fr,e.toDisplayString(p.value),1)]),b[3]||(b[3]=e.createElementVNode("svg",{class:"stroke-gray-500 absolute right-3 translate-y-1/2 bottom-1/2",width:"15",height:"15",viewBox:"0 0 24 24",fill:"none"},[e.createElementVNode("path",{d:"M6 9l6 6 6-6","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1))]),n.value?(e.openBlock(),e.createElementBlock("div",Ar,[e.createElementVNode("div",$r,[e.createElementVNode("div",Dr,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(c,k=>e.createElementVNode("div",{onClick:S=>h(k),key:k.value,class:"form-autocomplete__item cursor-pointer hs-selected:bg-stone-100 dark:hs-selected:bg-neutral-800 py-2 px-4 w-full text-sm text-gray-800 hover:bg-gray-100 rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:hover:bg-neutral-800 dark:text-neutral-200 dark:focus:bg-neutral-800 cursor-default"},[e.createElementVNode("div",Lr,[e.createElementVNode("div",Tr,[e.createElementVNode("div",null,e.toDisplayString(k.label),1)]),k.value===l.value?(e.openBlock(),e.createElementBlock("svg",Or,b[4]||(b[4]=[e.createElementVNode("polyline",{points:"20 6 9 17 4 12"},null,-1)]))):e.createCommentVNode("",!0)])],8,Ir)),64))])])])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Rr,[e.createElementVNode("div",zr,[b[6]||(b[6]=e.createElementVNode("i",{class:"absolute bottom-1/2 translate-y-1/2 left-3 text-gray-500"},[e.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},[e.createElementVNode("circle",{cx:"11",cy:"11",r:"8","stroke-width":"2"}),e.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65","stroke-width":"2"})])],-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":b[1]||(b[1]=k=>a.value=k),onInput:V,onFocus:b[2]||(b[2]=k=>i.value=!0),placeholder:"lat, lng ex. 50, 30",class:"bg-white h-[38px] text-sm py-2 px-3 ps-9 pe-8 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg 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,544),[[e.vModelText,a.value]]),a.value?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:M,class:"absolute right-2 bottom-1/2 translate-y-1/2 text-gray-500 hover:text-red-500","aria-label":"Очистити",type:"button"},b[5]||(b[5]=[e.createElementVNode("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]))):e.createCommentVNode("",!0),i.value&&l.value!=="coordinates"?(e.openBlock(),e.createElementBlock("div",jr,[r.value.length?(e.openBlock(),e.createElementBlock("ul",Ur,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,k=>(e.openBlock(),e.createElementBlock("li",{key:k.properties.place_id,onClick:S=>C(k),class:"px-3 py-2 text-sm cursor-pointer hover:bg-gray-100"},e.toDisplayString(k.properties.display_name),9,Pr))),128))])):d.value?(e.openBlock(),e.createElementBlock("div",Hr,"Шукаю…")):(e.openBlock(),e.createElementBlock("div",Gr,"Нічого не знайдено"))])):e.createCommentVNode("",!0)])])])])]))}}),Kr={class:"bg-white/95 p-2 rounded-xl shadow border border-gray-200"},Zr={class:"flex gap-2"},Yr=["onClick","title"],Wr=["src"],Jr=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(o,{emit:t}){const s=o,n=e.ref(Object.keys(s.basemaps)[0]),l=t;function a(r){l("onLayerChange",r),n.value=r}return(r,i)=>(e.openBlock(),e.createElementBlock("div",Kr,[e.createElementVNode("div",Zr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.basemaps,(d,u)=>(e.openBlock(),e.createElementBlock("div",{key:u,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":n.value===u}]),onClick:c=>a(u),title:d.name||u,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:d.preview,alt:"",class:"w-14 h-14 object-cover"},null,8,Wr)],10,Yr))),128))])]))}}),Xr={class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},Qr={class:"form-geom__panel flex gap-1 items-start mt-2"},eo={class:"flex items-center gap-1"},to=["disabled"],so={class:"absolute top-4 right-4 z-[1000]"},no={class:"flex flex-col gap-[2px]"},lo=["aria-pressed"],ao=["aria-pressed"],ro=["aria-pressed"],oo=["aria-pressed"],io={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"},uo={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},co={class:"mr-auto"},po={class:"font-bold"},ho={class:"flex items-center"},mo={class:"text-xs mr-2"},fo={key:0,class:"text-xs"},go={key:1,class:"text-xs"},pt=R(e.defineComponent({__name:"vs-input-map",props:{tools:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(o,{emit:t}){const s=e.getCurrentInstance(),n=o,l=t,a=e.ref(null);let r,i,d;const u=e.ref(null),c=e.ref(null),p=e.ref(6),h=e.ref(0),x=e.ref(s?.appContext.config.globalProperties.$settings?.center||[50,30]),A=e.ref(null),V=P();let M;const C=e.ref("topo100");function B(f){return f?f.type==="Polygon"?{type:"MultiPolygon",coordinates:[f.coordinates]}:(f.type==="MultiPolygon",f):null}function b(){return new Promise((f,y)=>{window.L&&window.L.Draw&&f(0);const I=H=>{if(Array.from(document.styleSheets).some(de=>de?.href?.includes(H)))return;const ce=document.createElement("link");ce.rel="stylesheet",ce.href=H,document.head.appendChild(ce)},j=H=>new Promise((le,ce)=>{const de=Array.from(document.scripts).find(ge=>ge.src===H);if(de){de.addEventListener("load",()=>le()),de.addEventListener("error",ge=>ce(ge));return}const fe=document.createElement("script");fe.src=H,fe.async=!0,fe.onload=()=>le(),fe.onerror=ge=>ce(ge),document.body.appendChild(fe)});I("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),I("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),j("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>j("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js")).then(()=>f(0)).catch(y)})}function k(){const f=i.toGeoJSON(),y=[],I=H=>{if(H)switch(H.type){case"Polygon":y.push(H.coordinates);break;case"MultiPolygon":y.push(...H.coordinates);break;case"GeometryCollection":(H.geometries||[]).forEach(I);break}};(f?.features||[]).forEach(H=>I(H.geometry));const j=y.length?{type:"MultiPolygon",coordinates:y}:null;l("update:modelValue",j?B(j):null),h.value=i.getLayers().length}function S(f=30){const y=i.getLayers();if(!y.length)return;const j=L.featureGroup(y).getBounds();j&&j.isValid()&&r.fitBounds(j,{padding:[f,f]})}function U(){u.value?.click()}const w=e.ref("");function W(f){return f instanceof L.Circle?"Circle":f instanceof L.Rectangle?"Rectangle":f instanceof L.Polygon&&!(f instanceof L.Rectangle)?"Polygon":f instanceof L.Polyline&&!(f instanceof L.Polygon)?"Polyline":f instanceof L.Marker?"Point":"Feature"}function X(f){if(f instanceof L.Circle){const y=f.getRadius();return Math.PI*(y*y)/1e6}if(f instanceof L.Polygon||f instanceof L.Rectangle)try{const y=f.getLatLngs(),I=Array.isArray(y[0])?y[0]:y,j=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea(I):0;return j?j/1e6:0}catch{return null}return null}function Q(f){return f instanceof L.Circle?f.getLatLng():f.getBounds?f.getBounds().getCenter():f.getLatLng?f.getLatLng():r.getCenter()}function Z(){const f=i.getLayers();if(!f.length){A.value=null,h.value=0;return}const y=f[f.length-1],I=W(y),j=Q(y),H=X(y);A.value={type:I,center:j,areaKm2:H,layer:y},h.value=f.length}function Ne(){const f=A.value?.layer;f&&(f instanceof L.Circle&&f.getBounds?r.fitBounds(f.getBounds(),{padding:[30,30]}):f.getBounds?r.fitBounds(f.getBounds(),{padding:[30,30]}):f.getLatLng&&r.setView(f.getLatLng(),Math.max(p.value,14)))}function ue(){const f=A.value?.layer;f&&(i.removeLayer(f),k(),Z())}e.onMounted(async()=>{await b(),L.drawLocal=lr,r=L.map(a.value,{zoomControl:!1}).setView(x.value,10),L.control.zoom({position:"bottomright"}).addTo(r),C.value=Object.keys(V)[0],M=L.tileLayer(V[C.value].url,{maxZoom:19,minZoom:6}).addTo(r),i=new L.FeatureGroup().addTo(r),r.on(L.Draw.Event.CREATED,I=>{const{layer:j}=I;i.clearLayers(),i.addLayer(j),k(),Z(),S(),w.value=""}),r.on(L.Draw.Event.EDITED,()=>{k(),Z(),S()}),r.on(L.Draw.Event.DELETED,()=>{k(),Z(),S()});let f=!1;r.on("mousemove",I=>{f||(r.invalidateSize(),f=!0),c.value=I.latlng}),r.on("zoomend",()=>{p.value=r.getZoom()});const y=ar(n.modelValue);if(y){const I=[];L.geoJSON(y).eachLayer(j=>I.push(j)),I.length&&i.addLayer(I[0]),k(),Z(),S()}});function se(f){if(r){switch(d&&d.disable(),f){case"marker":d=new L.Draw.Marker(r);break;case"polyline":d=new L.Draw.Polyline(r);break;case"polygon":d=new L.Draw.Polygon(r);break;case"rectangle":d=new L.Draw.Rectangle(r);break;default:d=new L.Draw.Rectangle(r);break}d&&(d.enable(),w.value=f)}}function D(){const f=i.toGeoJSON(),y=new Blob([JSON.stringify(f,null,2)],{type:"application/json"}),I=URL.createObjectURL(y),j=document.createElement("a");j.href=I,j.download="data.geojson",j.click(),URL.revokeObjectURL(I)}function v(f){const y=f.target.files?.[0];if(!y)return;const I=new FileReader;I.onload=()=>{if(typeof I.result=="string")try{const j=JSON.parse(I.result);i.clearLayers(),j&&L.geoJSON({type:"Feature",geometry:j}).eachLayer(H=>{i.addLayer(H)}),k(),Z(),S()}finally{f.target.value=""}},I.readAsText(y)}function N(f){r&&(M&&r.removeLayer(M),M=L.tileLayer(V[f].url,{maxZoom:19,minZoom:6}).addTo(r),C.value=f)}function z(f){const y=L.latLng(f[0],f[1]);r.setView(y,13)}e.watch(()=>n.modelValue,f=>{console.log("update map");const y=B(f);if(f&&y!==f){l("update:modelValue",y);return}i.clearLayers(),y&&L.geoJSON({type:"Feature",geometry:y}).eachLayer(I=>{i.addLayer(I),I.dragging?.enable(),I.dragging?.enabled(),I.on("dragend",j=>{const le=j.target.getLatLng();l("update:modelValue",{type:"Point",coordinates:[le.lng,le.lat]})})}),h.value=i.getLayers().length,Z(),S()});function P(){return s?.appContext.config.globalProperties.$settings?.basemaps?s?.appContext.config.globalProperties.$settings?.basemaps.map((f,y)=>Object.assign(f,{key:`b${y}`,preview:f.preview||f.url.replace("{z}/{x}/{y}.png","13/4790/2762.png")})).reduce((f,y)=>({...f,[y.key]:y}),{}):{topo100:{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:{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:{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 ne=e.ref(!1);return e.watch(ne,()=>{setTimeout(()=>{r.invalidateSize()},50)}),(f,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:ne.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:a,class:"w-full h-full"},null,512),e.createElementVNode("div",Xr,[e.createVNode(qr,{onGoToCoordinates:z}),e.createElementVNode("div",Qr,[e.createElementVNode("div",eo,[e.createElementVNode("button",{type:"button",class:"vs-btn-row",onClick:U},"Import"),e.createElementVNode("button",{type:"button",class:"vs-btn-row",onClick:D,disabled:h.value===0},"Export ",8,to)]),e.createElementVNode("input",{ref_key:"importRef",ref:u,type:"file",onChange:v,accept:".json,.geojson",class:"hidden"},null,544)])]),e.createElementVNode("div",so,[e.createElementVNode("div",no,[e.createElementVNode("button",{class:e.normalizeClass(["vs-btn",{"vs-active":w.value==="marker"}]),"aria-pressed":w.value==="marker",title:"Point (P)","aria-label":"Draw point",onClick:y[0]||(y[0]=I=>se("marker"))},[e.createVNode(dr)],10,lo),e.createElementVNode("button",{class:e.normalizeClass(["vs-btn",{"vs-active":w.value==="polyline"}]),"aria-pressed":w.value==="polyline",title:"Line (L)","aria-label":"Draw polyline",onClick:y[1]||(y[1]=I=>se("polyline"))},[e.createVNode(hr)],10,ao),e.createElementVNode("button",{class:e.normalizeClass(["vs-btn",{"vs-active":w.value==="polygon"}]),"aria-pressed":w.value==="polygon",title:"Polygon (G)","aria-label":"Draw polygon",onClick:y[2]||(y[2]=I=>se("polygon"))},[e.createVNode(kr)],10,ro),e.createElementVNode("button",{class:e.normalizeClass(["vs-btn",{"vs-active":w.value==="rectangle"}]),"aria-pressed":w.value==="rectangle",title:"Rectangle (R)","aria-label":"Draw rectangle",onClick:y[3]||(y[3]=I=>se("rectangle"))},[e.createVNode(_r)],10,oo),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:y[4]||(y[4]=I=>{ne.value=!ne.value}),title:"Full Screen","aria-label":"Full Screen"},[e.createVNode(Cr,{style:{width:"12px",height:"12px"}})])])]),e.createElementVNode("div",{class:e.normalizeClass(["absolute left-4 z-[1000]",A.value?"bottom-8":"bottom-4"])},[e.createVNode(Jr,{basemaps:e.unref(V),onOnLayerChange:N},null,8,["basemaps"])],2),e.createElementVNode("div",io,[A.value?(e.openBlock(),e.createElementBlock("div",uo,[e.createElementVNode("div",co,[y[7]||(y[7]=e.createTextVNode(" Тип: ",-1)),e.createElementVNode("span",po,e.toDisplayString(A.value.type),1)]),e.createElementVNode("div",ho,[e.createElementVNode("div",mo,[y[8]||(y[8]=e.createTextVNode(" Центр: ",-1)),e.createElementVNode("b",null,e.toDisplayString(A.value.center.lat.toFixed(5))+", "+e.toDisplayString(A.value.center.lng.toFixed(5)),1)]),A.value.areaKm2!==null?(e.openBlock(),e.createElementBlock("div",fo,[y[9]||(y[9]=e.createTextVNode(" Площа: ",-1)),e.createElementVNode("b",null,e.toDisplayString(A.value.areaKm2.toFixed(1))+"км²",1)])):(e.openBlock(),e.createElementBlock("div",go,y[10]||(y[10]=[e.createTextVNode(" Площа: ",-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:"Наблизити",onClick:y[5]||(y[5]=I=>Ne())},y[11]||(y[11]=[e.createStaticVNode('<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" data-v-44f47a6f><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" data-v-44f47a6f></path><path d="M7 10l6 0" data-v-44f47a6f></path><path d="M10 7l0 6" data-v-44f47a6f></path><path d="M21 21l-6 -6" data-v-44f47a6f></path></svg>',1)])),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:"Видалити",onClick:y[6]||(y[6]=I=>ue())},[e.createVNode(Fe,{class:"w-3 h-3"})])])])):e.createCommentVNode("",!0)])],2))}}),[["__scopeId","data-v-44f47a6f"]]),ko=["data-focus"],bo={class:"flex items-center"},yo={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},xo=["onClick","aria-label"],_o={key:0,class:"absolute text-gray-500 truncate pl-2"},wo={class:"flex-1 min-w-[2px]"},Eo=["placeholder"],Vo={class:"flex items-center shrink-0"},Co=["disabled"],ht=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(o,{emit:t}){const s=o,n=t;ee(s.style);const l=e.ref(null),a=e.ref(null),r=e.ref(null),i=e.ref(!1),d=e.ref(""),u=e.useModel(o,"modelValue"),c=e.computed(()=>s.placeholder||"Add tag…"),p=e.computed(()=>u.value?.length===0&&d.value===""),h=e.computed(()=>!s.disabled&&u.value?.length>0),x=e.computed(()=>s.disabled),A=async()=>{x.value||await e.nextTick(()=>r.value?.focus())},V=U=>{const w=U.trim();w!==""&&(!u.value||!Array.isArray(u.value)?u.value=[w]:s.unique?u.value.includes(w)||(u.value=[...u.value,w]):u.value=[...u.value,w],d.value="")},M=()=>{const U=d.value;U.trim()!==""&&V(U),d.value=""},C=U=>{const w=u.value.slice();w.splice(U,1),n("update:modelValue",w)},B=()=>{n("update:modelValue",[])},b=()=>{x.value||(i.value=!0)},k=()=>{i.value=!1},S=U=>{const{key:w}=U;w==="Enter"?(U.preventDefault(),M()):w==="Backspace"&&d.value===""&&u.value.length>0&&C(u.value.length-1)};return(U,w)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:l,onClick:w[1]||(w[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",s.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":"",x.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:A},[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(u.value,(W,X)=>(e.openBlock(),e.createElementBlock("div",{key:X,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",bo,[e.createElementVNode("div",yo,e.toDisplayString(W),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(Q=>C(X),["stop"]),"aria-label":`Remove ${W}`},w[2]||(w[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,xo)]))),128)),p.value?(e.openBlock(),e.createElementBlock("div",_o,e.toDisplayString(c.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",wo,[x.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":w[0]||(w[0]=W=>d.value=W),onFocus:b,onBlur:k,onKeydown:S,placeholder:u.value&&u.value.length?"":void 0},null,40,Eo)),[[e.vModelText,d.value]])])],512),e.createElementVNode("div",Vo,[h.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:x.value,onClick:e.withModifiers(B,["stop"])},w[3]||(w[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,Co)):e.createCommentVNode("",!0)])],10,ko)],2)],512))}}),Bo={class:"relative flex gap-1 bg-white w-full"},vo=["disabled","placeholder"],mt=R(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const t=e.inject("values"),s=o,n=e.useModel(o,"modelValue");function l(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(d=>i[d]||d).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const a=()=>{const r=t?.value?.[s.parent||""]?.toString(),i=l(r);n.value=i.toString()};return(r,i)=>(e.openBlock(),e.createElementBlock("div",Bo,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:r.disabled,placeholder:r.placeholder,"onUpdate:modelValue":i[0]||(i[0]=d=>n.value=d),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,vo),[[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"]]),No={class:"w-full"},So={ref:"sortableContainer",class:"flex flex-col gap-1"},Mo=["onDragstart","onDrop"],Fo={class:"w-1/3"},Ao={class:"w-2/3"},$o=["onClick"],Do={key:0,class:"text-[14px] text-gray-700"},Io={class:"mt-2 w-full flex items-center"},Lo=["disabled"],ft=R(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(o,{emit:t}){const s=M=>`${M}-${Math.random().toString(36).substring(2,15)}`,n=e.inject("values"),l=o,a=t,r=l.addButtonText??"Додати",i=l.ignore??[],d=e.ref([]),u=e.ref(null);(()=>{const M=l.parent&&n?.value?.[l.parent]||l.modelValue||{};d.value=Object.entries(M).filter(([C])=>!i.includes(C)).map(([C,B])=>({id:s("key-value-"),key:C,value:B}))})();function p(M){u.value=M}function h(M){if(u.value===null||u.value===M)return;const C=d.value.splice(u.value,1)[0];d.value.splice(M,0,C),u.value=null}const x=e.computed(()=>d.value.some(M=>M.key&&!M.value||!M.key&&M.value)),A=()=>{d.value.push({id:s("key-value-"),key:"",value:""})},V=M=>{d.value=d.value.filter(C=>C.id!==M)};return e.watch(d,M=>{const C={};M.forEach(b=>{b.key&&b.value!==void 0&&(C[b.key]=b.value)});const B={};i.length&&i.forEach(b=>{B[b]=l.parent?n?.value?.[l.parent]?.[b]:void 0}),n?.value&&l.parent&&(n.value[l.parent]={...B,...C}),a("update:modelValue",C)},{deep:!0}),(M,C)=>(e.openBlock(),e.createElementBlock("div",No,[e.createElementVNode("div",So,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(B,b)=>(e.openBlock(),e.createElementBlock("div",{key:B.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":u.value===b}]),draggable:"true",onDragstart:k=>p(b),onDragover:C[0]||(C[0]=e.withModifiers(()=>{},["prevent"])),onDrop:k=>h(b)},[C[1]||(C[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",Fo,[e.createVNode(xe,{modelValue:B.key,"onUpdate:modelValue":k=>B.key=k,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Ao,[e.createVNode(xe,{modelValue:B.value,"onUpdate:modelValue":k=>B.value=k,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:k=>V(B.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(Rs),{height:"16",width:"16"})],8,$o)],42,Mo))),128))],512),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Do," Дані для відображення відсутні ")),e.createElementVNode("div",Io,[e.createElementVNode("button",{type:"button",onClick:A,disabled:x.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(_e,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(r)),1)],8,Lo)])]))}}),[["__scopeId","data-v-a0f7fbfc"]]),To={class:"flex items-center gap-2 w-full"},Oo=["disabled"],gt=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(o,{emit:t}){const s=o,{inputClass:n}=ee(s.style),l=t,a=e.computed({get:()=>s.modelValue||"#000000",set:r=>l("update:modelValue",r)});return(r,i)=>(e.openBlock(),e.createElementBlock("div",To,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),disabled:r.disabled,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[r.modelValue?"":"text-opacity-50",e.unref(n)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Oo),[[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":i[1]||(i[1]=d=>a.value=d)},null,512),[[e.vModelText,a.value]])]))}}),Ro={class:"flex items-center gap-2 w-full"},zo=["min","max","step","disabled"],kt=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(o,{emit:t}){const s=o,{inputClass:n}=ee(s.style),l=t,a=e.computed({get:()=>Number(s.modelValue??s.min),set:r=>l("update:modelValue",Number(r))});return(r,i)=>(e.openBlock(),e.createElementBlock("div",Ro,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),min:r.min,max:r.max,step:r.step,disabled:r.disabled,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[r.modelValue?"":"text-opacity-50",e.unref(n)].join(" ")])},null,10,zo),[[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":i[1]||(i[1]=d=>a.value=d)},null,512),[[e.vModelText,a.value]])]))}}),jo=["type","value","onInput","placeholder","disabled"],bt=e.defineComponent({__name:"vs-input-array",props:e.mergeModels({count:{default:1},limit:{default:o=>o.count??1},inputType:{default:"text"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const t=o,{inputClass:s}=ee(t.style),n=e.useModel(o,"modelValue");e.watchEffect(()=>{const a=n.value?.length??0;a<t.count&&(n.value=[...n.value??[],...Array(t.count-a)])});function l(a,r){const i=a.target.value,d=[...n.value];d[r]=t.inputType==="text"?i:Number(i),n.value=d}return(a,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["grid gap-2",`grid-cols-${a.limit}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.count,i=>(e.openBlock(),e.createElementBlock("input",{type:a.inputType,value:n.value?.[i-1]??"",onInput:d=>l(d,i-1),placeholder:a.placeholder,disabled:a.disabled,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(s),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,jo))),256))],2))}}),yt={VsInputText:xe,VsInputRadio:je,"vs-input-text":xe,"vs-input-password":ms,"vs-input-textarea":dt,"vs-input-mask":Je,"vs-input-number":Ye,"vs-input-radio":je,"vs-input-select":Ue,"vs-input-switcher":Re,"vs-input-static":ze,"vs-input-container":it,"vs-input-date":et,"vs-input-checkbox":Qe,"vs-input-file":at,"vs-input-html":ze,"vs-input-email":Xe,"vs-input-datatable":ct,"vs-input-map":pt,"vs-input-file-list":rt,"vs-input-tag":ht,"vs-input-slug":mt,"vs-input-key-value":ft,"vs-input-range":kt,"vs-input-color":gt,"vs-input-native-select":Ue,"vs-input-array":bt},Uo=e.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(o){const t=o,s=e.inject("values");async function n(){try{if(!t.api)return;const l=t.api.replace("{{value}}",t.value),a=await fetch(l);if(!a.ok){G.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const r=await a.json();if(!t.set||!s)return;for(const[i,d]of Object.entries(t.set))s.value[i]=r.result[d]}catch(l){console.error(t.error,l)}}return(l,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(l.button),1))}}),Po={class:"flex flex-col gap-1 w-full"},Ho={key:0,class:"text-sm text-gray-500"},xt=e.defineComponent({__name:"vs-compact-form-layout",props:e.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const t=o,s=e.useModel(o,"modelValue"),n=e.computed(()=>ps[`${t.layout}`]),l=e.computed(()=>yt?.[`vs-input-${t.item.type}`]),a=e.computed(()=>{const i=e.unref(l);if(!i)return new Set;const d=i.props??i.__vccOpts?.props;if(!d)return new Set;const u=Array.isArray(d)?d:Object.keys(d);return new Set(u)}),r=e.computed(()=>{const i=t.item??{},d=a.value;return d.size?Object.fromEntries(Object.entries(i).filter(([u])=>d.has(u))):{}});return(i,d)=>e.withDirectives((e.openBlock(),e.createBlock(e.resolveDynamicComponent(n.value),{ua:t.item.ua,error:t.error||"",item:i.item,label:t.item.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${t.item.type}-component`])},[e.createElementVNode("div",Po,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.value),e.mergeProps(r.value,{modelValue:s.value,"onUpdate:modelValue":d[0]||(d[0]=u=>s.value=u)}),null,16,["modelValue"])),i.item.description?(e.openBlock(),e.createElementBlock("p",Ho,e.toDisplayString(i.item.description),1)):e.createCommentVNode("",!0)]),i.item.behavior?.api&&i.item.behavior?.button?(e.openBlock(),e.createBlock(Uo,e.mergeProps({key:0},i.item.behavior,{value:s.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","label"])),[[e.vShow,!i.item.hidden]])}}),_t={required:"Це поле є обов’язковим",email:"Неправильний email"},Go=o=>o?!1:_t.required,qo=o=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return o?t.test(o)?!1:_t.email:!1},Ko=(o,t)=>{const s=t.pattern??t.regexp;return!(typeof s=="string"?new RegExp(s):s).test(o)&&o?t.message:!1},Zo=(o,t)=>!1,Yo=(o,t)=>{switch(typeof t=="string"?t:t.type){case"required":return Go(o);case"email":return qo(o);case"regexp":return Ko(o,t);case"custom":return Zo();default:return!1}},Wo={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file"};function wt(o){const t=o.toLowerCase();return Wo[t]||t}function Jo(o,t=!1){if(Array.isArray(o)){const n=[];return o.forEach(l=>{const a={...l};a.name=(l.name||l.id||l.key||"").toString(),a.type=wt(l.type),a.label=l.label||l.ua,a.rules=l.rules||l.validators,a.type==="email"&&!a.rules&&(a.rules=["email"]),l.data&&(a.api=`/api/suggest/${l.data}`),a.disabled=t||a.disabled,n.push(a)}),n}const s=[];return Object.entries(o).forEach(n=>{const l={name:n[0],...n[1],type:wt(n[1].type),label:n[1].label||n[1].ua,rules:n[1].rules||n[1].validators,disabled:t};l.type==="email"&&!l.rules&&(l.rules=["email"]),n[1].type.includes("list")&&(l.multiple=!0),!l.api&&n[1].data&&(l.api=`/api/suggest/${n[1].data}`),s.push(l)}),s}function Xo(o,t,s=!1){const n=e.computed(()=>Jo((Array.isArray(t),t),typeof s=="boolean"?s:s.value)),l=e.ref({});function a(u){const c=u?.conditions;if(!c)return!0;const p=Array.isArray(c)?c[0]:c,h=o?.value?.[p];return ot(h,c)}const r=(u=n.value,c=!0)=>(u.forEach(p=>{if(p.rules){if(!a(p)){delete l.value[p.name];return}p.rules.forEach(h=>{const x=Yo(o.value[p.name],h);x?l.value[p.name]=x:delete l.value[p.name]})}p.schema&&r(p.schema,!1)}),c&&Object.values(l.value).some(Boolean)?l.value:null),i=e.computed(()=>n.value?.filter(u=>a(u)));return{errors:l,validate:r,reset:()=>{o.value={},l.value={}},visibleSchema:i}}const Qo={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},me=e.defineComponent({__name:"vs-compact-form",props:e.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:e.mergeModels(["handle-submit","update:modelValue"],["update:form","update:values"]),setup(o,{expose:t,emit:s}){const n=s,l=o,a=e.useModel(o,"form"),r=e.useModel(o,"values"),{errors:i,validate:d,reset:u,visibleSchema:c}=Xo(r,l.schema,e.toRef(l,"disabled")),p=()=>{n("update:modelValue",r.value),d(),n("handle-submit",r.value)};t({validate:d,reset:u,errors:i}),e.onMounted(()=>{l.modelValue&&(r.value=l.modelValue),a.value.value=r.value,a.value.errors=i.value,a.value.reset=u,a.value.validate=d,a.value.formId=l.formId});function h(x,A){if(x===A)return!0;if(typeof x!="object"||typeof A!="object"||!x||!A)return!1;const V=Object.keys(x),M=Object.keys(A);return V.length!==M.length?!1:V.every(C=>x[C]===A[C])}return e.provide("form",a),e.provide("values",r),e.watch(a.value,x=>{console.log("form",x)}),(x,A)=>(e.openBlock(),e.createElementBlock("form",{onSubmit:e.withModifiers(p,["prevent"]),class:e.normalizeClass(["grid grid-cols-12",x.layout==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(c),(V,M)=>(e.openBlock(),e.createElementBlock("div",{key:V.name,class:e.normalizeClass(x.layout==="horizontal"?"col-span-12":`col-span-${V.col||12}`)},[e.createVNode(xt,{style:e.normalizeStyle(x.style),item:V,layout:x.layout,"model-value":r.value[V.name],"onUpdate:modelValue":C=>{const B=r.value[V.name];h(B,C)||(r.value[V.name]=C)},error:e.unref(i)[V.name]},null,8,["style","item","layout","model-value","onUpdate:modelValue","error"]),x.layout==="settings"&&M+1!==e.unref(c).length?(e.openBlock(),e.createElementBlock("div",Qo)):e.createCommentVNode("",!0)],2))),128))],34))}}),ei={class:"relative"},ti={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},si={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"},ni={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},li={class:"font-medium text-gray-800 dark:text-[#ffffff]"},ai={class:"p-4 mim-h-0 h-full overflow-auto"},Et=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(o,{emit:t}){const s=o,n=t,l=e.ref(s.schema),a=e.ref(s.defaultValue?JSON.parse(JSON.stringify(s.defaultValue)):{}),r=e.ref({}),i=e.ref(),d=e.ref(s.mode);async function u(){const p=r.value.validate();if(p){G.notify({type:"warning",title:"Помилка валідації",message:Object.entries(p).map(([h,x])=>`${h}: ${x}`).join(`
|
|
3
|
+
`)});return}if(i.value)try{const h=await fetch(`/api/table/${i.value}`,{method:d.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a.value)});if(h.ok)await h.json(),G.notify({type:"success",title:"Успішно",message:`Дані успішно ${d.value==="add"?"збережено":"оновлено"}`}),n("save",a.value);else if(h.status===400){const x=await h.json().catch(()=>({}));G.notify({type:"warning",title:"Помилка валідації",message:x.message||"Некоректні дані (400)"})}else h.status===500?G.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):G.notify({type:"error",title:"Помилка",message:`Статус: ${h.status}`})}catch(h){G.notify({type:"error",title:"Помилка з’єднання",message:h.message||"Не вдалося виконати запит"})}}function c(){n("close")}return e.onMounted(async()=>{try{if(s.form){const p=await fetch(`/api/template/form/${s.form}`);if(!p.ok){G.notify({type:p.status>=400&&p.status<500?"warning":"error",title:"Error",message:`Error code: ${p.status}`});return}const h=await p.json();l.value=h.schema,i.value=h.token}else if(s.token){i.value=s.token;const p=await fetch(`/api/form/${i.value}`);if(!p.ok){G.notify({type:p.status>=400&&p.status<500?"warning":"error",title:"Error",message:`Error code: ${p.status}`});return}const h=await p.json();l.value=h.schema,h.data?a.value=h.data:d.value="add"}}catch(p){G.notify({type:"error",title:"Error",message:p.message||"Unexpected error"}),console.error(p)}}),(p,h)=>(e.openBlock(),e.createElementBlock("div",ei,[e.createElementVNode("div",ti,[e.createElementVNode("div",si,[e.createElementVNode("div",ni,[e.createElementVNode("h3",li,e.toDisplayString(d.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:c,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},h[2]||(h[2]=[e.createElementVNode("span",{class:"sr-only"},"Close",-1),e.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("path",{d:"M18 6 6 18"}),e.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),e.createElementVNode("div",ai,[l.value?(e.openBlock(),e.createBlock(me,{key:0,schema:l.value,values:a.value,"onUpdate:values":h[0]||(h[0]=x=>a.value=x),form:r.value,"onUpdate:form":h[1]||(h[1]=x=>r.value=x)},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:c,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:u,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"}," Зберегти ")])])])]))}}),Vt=(o={mode:"edit",schema:null})=>new Promise(t=>{const{close:s}=G.modal({title:o.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Et,contentProps:{...o,onClose:()=>{t(null),s()},onSave:n=>{t(n),s()}}})});me.install=function(t){t.component("VForm",me),Object.assign(t.config.globalProperties,{$form:Vt}),t.provide("form",Vt),window.v3plugin||(window.v3plugin={})};function pe(o){return typeof o=="string"||o instanceof String}function Ct(o){var t;return typeof o=="object"&&o!=null&&(o==null||(t=o.constructor)==null?void 0:t.name)==="Object"}function Bt(o,t){return Array.isArray(t)?Bt(o,(s,n)=>t.includes(n)):Object.entries(o).reduce((s,n)=>{let[l,a]=n;return t(a,l)&&(s[l]=a),s},{})}const E={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function vt(o){switch(o){case E.LEFT:return E.FORCE_LEFT;case E.RIGHT:return E.FORCE_RIGHT;default:return o}}function Pe(o){return o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function $e(o,t){if(t===o)return!0;const s=Array.isArray(t),n=Array.isArray(o);let l;if(s&&n){if(t.length!=o.length)return!1;for(l=0;l<t.length;l++)if(!$e(t[l],o[l]))return!1;return!0}if(s!=n)return!1;if(t&&o&&typeof t=="object"&&typeof o=="object"){const a=t instanceof Date,r=o instanceof Date;if(a&&r)return t.getTime()==o.getTime();if(a!=r)return!1;const i=t instanceof RegExp,d=o instanceof RegExp;if(i&&d)return t.toString()==o.toString();if(i!=d)return!1;const u=Object.keys(t);for(l=0;l<u.length;l++)if(!Object.prototype.hasOwnProperty.call(o,u[l]))return!1;for(l=0;l<u.length;l++)if(!$e(o[u[l]],t[u[l]]))return!1;return!0}else if(t&&o&&typeof t=="function"&&typeof o=="function")return t.toString()===o.toString();return!1}class ri{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?E.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?E.RIGHT:E.LEFT}}function F(o,t){return new F.InputMask(o,t)}function Nt(o){if(o==null)throw new Error("mask property should be defined");return o instanceof RegExp?F.MaskedRegExp:pe(o)?F.MaskedPattern:o===Date?F.MaskedDate:o===Number?F.MaskedNumber:Array.isArray(o)||o===Array?F.MaskedDynamic:F.Masked&&o.prototype instanceof F.Masked?o:F.Masked&&o instanceof F.Masked?o.constructor:o instanceof Function?F.MaskedFunction:(console.warn("Mask not found for mask",o),F.Masked)}function be(o){if(!o)throw new Error("Options in not defined");if(F.Masked){if(o.prototype instanceof F.Masked)return{mask:o};const{mask:t=void 0,...s}=o instanceof F.Masked?{mask:o}:Ct(o)&&o.mask instanceof F.Masked?o:{};if(t){const n=t.mask;return{...Bt(t,(l,a)=>!a.startsWith("_")),mask:t.constructor,_mask:n,...s}}}return Ct(o)?{...o}:{mask:o}}function re(o){if(F.Masked&&o instanceof F.Masked)return o;const t=be(o),s=Nt(t.mask);if(!s)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===s&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new s(t)}F.createMask=re;class De{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,s){if(!(t==null||s==null||t===this.selectionStart&&s===this.selectionEnd))try{this._unsafeSelect(t,s)}catch{}}get isActive(){return!1}}F.MaskElement=De;const St=90,oi=89;class Ee extends De{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,s,n;return(t=(s=(n=this.input).getRootNode)==null?void 0:s.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===St&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===oi&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===St&&(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={}}}F.HTMLMaskElement=Ee;class Mt extends Ee{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,s){this.input.setSelectionRange(t,s)}get value(){return this.input.value}set value(t){this.input.value=t}}F.HTMLMaskElement=Ee;class He extends Ee{get _unsafeSelectionStart(){const t=this.rootElement,s=t.getSelection&&t.getSelection(),n=s&&s.anchorOffset,l=s&&s.focusOffset;return l==null||n==null||n<l?n:l}get _unsafeSelectionEnd(){const t=this.rootElement,s=t.getSelection&&t.getSelection(),n=s&&s.anchorOffset,l=s&&s.focusOffset;return l==null||n==null||n>l?n:l}_unsafeSelect(t,s){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,s);const l=this.rootElement,a=l.getSelection&&l.getSelection();a&&(a.removeAllRanges(),a.addRange(n))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}F.HTMLContenteditableMaskElement=He;class Ie{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>Ie.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}}Ie.MAX_LENGTH=100;class Ft{constructor(t,s){this.el=t instanceof De?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new He(t):new Mt(t),this.masked=re(s),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Ie,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 s;return t==null||((s=this.masked)==null?void 0:s.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof F.Masked)&&this.masked.constructor===Nt(t)){this.masked.updateOptions({mask:t});return}const s=t instanceof F.Masked?t:re({mask:t});s.unmaskedValue=this.masked.unmaskedValue,this.masked=s}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,s){const n=this._listeners[t];n&&n.forEach(l=>l(s))}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 s=this.masked.unmaskedValue,n=this.masked.value,l=this.masked.rawInputValue,a=this.displayValue,r=this.unmaskedValue!==s||this.value!==n||this._rawInputValue!==l;this._unmaskedValue=s,this._value=n,this._rawInputValue=l,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:s,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:s,...n}=t,l=!this.maskEquals(s),a=this.masked.optionsIsChanged(n);l&&(this.mask=s),a&&this.masked.updateOptions(n),(l||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,E.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,s){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(s),this}off(t,s){if(!this._listeners[t])return this;if(!s)return delete this._listeners[t],this;const n=this._listeners[t].indexOf(s);return n>=0&&this._listeners[t].splice(n,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const s=new ri({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),n=this.masked.rawInputValue,l=this.masked.splice(s.startChangePos,s.removed.length,s.inserted,s.removeDirection,{input:!0,raw:!0}).offset,a=n===this.masked.rawInputValue?s.removeDirection:E.NONE;let r=this.masked.nearestInputPos(s.startChangePos+l,a);a!==E.NONE&&(r=this.masked.nearestInputPos(r,E.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}}F.InputMask=Ft;class ${static normalize(t){return Array.isArray(t)?t:[t,new $]}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}}F.ChangeDetails=$;class oe{constructor(t,s,n){t===void 0&&(t=""),s===void 0&&(s=0),this.value=t,this.from=s,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 s=this.value[0];return this.value=this.value.slice(1),s}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class q{constructor(t){this._value="",this._update({...q.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,s){s===void 0&&(s={input:!0}),this.reset(),this.append(t,s,""),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,s){return t}totalInputPositions(t,s){return t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),Math.min(this.displayValue.length,s-t)}extractInput(t,s,n){return t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),this.displayValue.slice(t,s)}extractTail(t,s){return t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),new oe(this.extractInput(t,s),t)}appendTail(t){return pe(t)&&(t=new oe(String(t))),t.appendTo(this)}_appendCharRaw(t,s){return t?(this._value+=t,new $({inserted:t,rawInserted:t})):new $}_appendChar(t,s,n){s===void 0&&(s={});const l=this.state;let a;if([t,a]=this.doPrepareChar(t,s),t&&(a=a.aggregate(this._appendCharRaw(t,s)),!a.rawInserted&&this.autofix==="pad")){const r=this.state;this.state=l;let i=this.pad(s);const d=this._appendCharRaw(t,s);i=i.aggregate(d),d.rawInserted||i.equals(a)?a=i:this.state=r}if(a.inserted){let r,i=this.doValidate(s)!==!1;if(i&&n!=null){const d=this.state;if(this.overwrite===!0){r=n.state;for(let c=0;c<a.rawInserted.length;++c)n.unshift(this.displayValue.length-a.tailShift)}let u=this.appendTail(n);if(i=u.rawInserted.length===n.toString().length,!(i&&u.inserted)&&this.overwrite==="shift"){this.state=d,r=n.state;for(let c=0;c<a.rawInserted.length;++c)n.shift();u=this.appendTail(n),i=u.rawInserted.length===n.toString().length}i&&u.inserted&&(this.state=d)}i||(a=new $,this.state=l,n&&r&&(n.state=r))}return a}_appendPlaceholder(){return new $}_appendEager(){return new $}append(t,s,n){if(!pe(t))throw new Error("value should be string");const l=pe(n)?new oe(String(n)):n;s!=null&&s.tail&&(s._beforeTailState=this.state);let a;[t,a]=this.doPrepare(t,s);for(let r=0;r<t.length;++r){const i=this._appendChar(t[r],s,l);if(!i.rawInserted&&!this.doSkipInvalid(t[r],s,l))break;a.aggregate(i)}return(this.eager===!0||this.eager==="append")&&s!=null&&s.input&&t&&a.aggregate(this._appendEager()),l!=null&&(a.tailShift+=this.appendTail(l).tailShift),a}remove(t,s){return t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(s),new $}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const s=this.rawInputValue,n=this.value,l=t();return this.rawInputValue=s,this.value&&this.value!==n&&n.indexOf(this.value)===0&&(this.append(n.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,l}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const s=this.state,n=t(this);return this.state=s,delete this._isolated,n}doSkipInvalid(t,s,n){return!!this.skipInvalid}doPrepare(t,s){return s===void 0&&(s={}),$.normalize(this.prepare?this.prepare(t,this,s):t)}doPrepareChar(t,s){return s===void 0&&(s={}),$.normalize(this.prepareChar?this.prepareChar(t,this,s):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,s,n,l,a){n===void 0&&(n=""),l===void 0&&(l=E.NONE),a===void 0&&(a={input:!0});const r=t+s,i=this.extractTail(r),d=this.eager===!0||this.eager==="remove";let u;d&&(l=vt(l),u=this.extractInput(0,r,{raw:!0}));let c=t;const p=new $;if(l!==E.NONE&&(c=this.nearestInputPos(t,s>1&&t!==0&&!d?E.NONE:l),p.tailShift=c-t),p.aggregate(this.remove(c)),d&&l!==E.NONE&&u===this.rawInputValue)if(l===E.FORCE_LEFT){let h;for(;u===this.rawInputValue&&(h=this.displayValue.length);)p.aggregate(new $({tailShift:-1})).aggregate(this.remove(h-1))}else l===E.FORCE_RIGHT&&i.unshift();return p.aggregate(this.append(n,a,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!$e(this,t)}typedValueEquals(t){const s=this.typedValue;return t===s||q.EMPTY_VALUES.includes(t)&&q.EMPTY_VALUES.includes(s)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new $}}q.DEFAULTS={skipInvalid:!0},q.EMPTY_VALUES=[void 0,null,""],F.Masked=q;class he{constructor(t,s){t===void 0&&(t=[]),s===void 0&&(s=0),this.chunks=t,this.from=s}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=pe(t)?new oe(String(t)):t;const s=this.chunks[this.chunks.length-1],n=s&&(s.stop===t.stop||t.stop==null)&&t.from===s.from+s.toString().length;if(t instanceof oe)n?s.extend(t.toString()):this.chunks.push(t);else if(t instanceof he){if(t.stop==null){let l;for(;t.chunks.length&&t.chunks[0].stop==null;)l=t.chunks.shift(),l.from+=t.from,this.extend(l)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof F.MaskedPattern))return new oe(this.toString()).appendTo(t);const s=new $;for(let n=0;n<this.chunks.length;++n){const l=this.chunks[n],a=t._mapPosToBlock(t.displayValue.length),r=l.stop;let i;if(r!=null&&(!a||a.index<=r)&&((l instanceof he||t._stops.indexOf(r)>=0)&&s.aggregate(t._appendPlaceholder(r)),i=l instanceof he&&t._blocks[r]),i){const d=i.appendTail(l);s.aggregate(d);const u=l.toString().slice(d.rawInserted.length);u&&s.aggregate(t.append(u,{tail:!0}))}else s.aggregate(t.append(l.toString(),{tail:!0}))}return s}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:s,...n}=t;Object.assign(this,n),this.chunks=s.map(l=>{const a="chunks"in l?new he:new oe;return a.state=l,a})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const s=t!=null?t-this.from:t;let n=0;for(;n<this.chunks.length;){const l=this.chunks[n],a=l.unshift(s);if(l.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 s=this.chunks[t],n=s.shift();if(s.toString()){if(!n)break;--t}else this.chunks.splice(t,1);if(n)return n}return""}}class ii{constructor(t,s){this.masked=t,this._log=[];const{offset:n,index:l}=t._mapPosToBlock(s)||(s<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=n,this.index=l,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=((s=this.block)==null?void 0:s.displayValue.length)||0){var s;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,E.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,E.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,E.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,E.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,E.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,E.NONE),!0})}}class Ge{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,s){return t===void 0&&(t=0),s===void 0&&(s=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(s),this._value||(this._isRawInput=!1),new $}nearestInputPos(t,s){s===void 0&&(s=E.NONE);const n=0,l=this._value.length;switch(s){case E.LEFT:case E.FORCE_LEFT:return n;case E.NONE:case E.RIGHT:case E.FORCE_RIGHT:default:return l}}totalInputPositions(t,s){return t===void 0&&(t=0),s===void 0&&(s=this._value.length),this._isRawInput?s-t:0}extractInput(t,s,n){return t===void 0&&(t=0),s===void 0&&(s=this._value.length),n===void 0&&(n={}),n.raw&&this._isRawInput&&this._value.slice(t,s)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,s){if(s===void 0&&(s={}),this.isFilled)return new $;const n=this.eager===!0||this.eager==="append",a=this.char===t&&(this.isUnmasking||s.input||s.raw)&&(!s.raw||!n)&&!s.tail,r=new $({inserted:this.char,rawInserted:a?this.char:""});return this._value=this.char,this._isRawInput=a&&(s.raw||s.input),r}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new $;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new oe("")}appendTail(t){return pe(t)&&(t=new oe(String(t))),t.appendTo(this)}append(t,s,n){const l=this._appendChar(t[0],s);return n!=null&&(l.tailShift+=this.appendTail(n).tailShift),l}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 Ve{constructor(t){const{parent:s,isOptional:n,placeholderChar:l,displayChar:a,lazy:r,eager:i,...d}=t;this.masked=re(d),Object.assign(this,{parent:s,isOptional:n,placeholderChar:l,displayChar:a,lazy:r,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,s){return t===void 0&&(t=0),s===void 0&&(s=this.value.length),t===0&&s>=1?(this.isFilled=!1,this.masked.remove(t,s)):new $}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,s){if(s===void 0&&(s={}),this.isFilled)return new $;const n=this.masked.state;let l=this.masked._appendChar(t,this.currentMaskFlags(s));return l.inserted&&this.doValidate(s)===!1&&(l=new $,this.masked.state=n),!l.inserted&&!this.isOptional&&!this.lazy&&!s.input&&(l.inserted=this.placeholderChar),l.skip=!l.inserted&&!this.isOptional,this.isFilled=!!l.inserted,l}append(t,s,n){return this.masked.append(t,this.currentMaskFlags(s),n)}_appendPlaceholder(){return this.isFilled||this.isOptional?new $:(this.isFilled=!0,new $({inserted:this.placeholderChar}))}_appendEager(){return new $}extractTail(t,s){return this.masked.extractTail(t,s)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,s,n){return t===void 0&&(t=0),s===void 0&&(s=this.value.length),this.masked.extractInput(t,s,n)}nearestInputPos(t,s){s===void 0&&(s=E.NONE);const n=0,l=this.value.length,a=Math.min(Math.max(t,n),l);switch(s){case E.LEFT:case E.FORCE_LEFT:return this.isComplete?a:n;case E.RIGHT:case E.FORCE_RIGHT:return this.isComplete?a:l;case E.NONE:default:return a}}totalInputPositions(t,s){return t===void 0&&(t=0),s===void 0&&(s=this.value.length),this.value.slice(t,s).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 s;return{...t,_beforeTailState:(t==null||(s=t._beforeTailState)==null?void 0:s.masked)||t?._beforeTailState}}pad(t){return new $}}Ve.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 At extends q{updateOptions(t){super.updateOptions(t)}_update(t){const s=t.mask;s&&(t.validate=n=>n.search(s)>=0),super._update(t)}}F.MaskedRegExp=At;class K extends q{constructor(t){super({...K.DEFAULTS,...t,definitions:Object.assign({},Ve.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 s=this.mask;if(!s||!t)return;let n=!1,l=!1;for(let a=0;a<s.length;++a){if(this.blocks){const u=s.slice(a),c=Object.keys(this.blocks).filter(h=>u.indexOf(h)===0);c.sort((h,x)=>x.length-h.length);const p=c[0];if(p){const{expose:h,repeat:x,...A}=be(this.blocks[p]),V={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...A,repeat:x,parent:this},M=x!=null?new F.RepeatBlock(V):re(V);M&&(this._blocks.push(M),h&&(this.exposeBlock=M),this._maskedBlocks[p]||(this._maskedBlocks[p]=[]),this._maskedBlocks[p].push(this._blocks.length-1)),a+=p.length-1;continue}}let r=s[a],i=r in t;if(r===K.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(r==="{"||r==="}"){n=!n;continue}if(r==="["||r==="]"){l=!l;continue}if(r===K.ESCAPE_CHAR){if(++a,r=s[a],!r)break;i=!1}const d=i?new Ve({isOptional:l,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...be(t[r]),parent:this}):new Ge({char:r,eager:this.eager,isUnmasking:n});this._blocks.push(d)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:s,...n}=t;this._blocks.forEach((l,a)=>l.state=s[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,s)=>t+=s.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(s),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,s)=>t+=s.value,"")}set value(t){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(s),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(s),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,s)=>t+=s.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const s=new $;let n=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(n==null)return s;this._blocks[n].isFilled&&++n;for(let l=n;l<this._blocks.length;++l){const a=this._blocks[l]._appendEager();if(!a.inserted)break;s.aggregate(a)}return s}_appendCharRaw(t,s){s===void 0&&(s={});const n=this._mapPosToBlock(this.displayValue.length),l=new $;if(!n)return l;for(let r=n.index,i;i=this._blocks[r];++r){var a;const d=i._appendChar(t,{...s,_beforeTailState:(a=s._beforeTailState)==null||(a=a._blocks)==null?void 0:a[r]});if(l.aggregate(d),d.consumed)break}return l}extractTail(t,s){t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length);const n=new he;return t===s||this._forEachBlocksInRange(t,s,(l,a,r,i)=>{const d=l.extractTail(r,i);d.stop=this._findStopBefore(a),d.from=this._blockStartPos(a),d instanceof he&&(d.blockIndex=a),n.extend(d)}),n}extractInput(t,s,n){if(t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),n===void 0&&(n={}),t===s)return"";let l="";return this._forEachBlocksInRange(t,s,(a,r,i,d)=>{l+=a.extractInput(i,d,n)}),l}_findStopBefore(t){let s;for(let n=0;n<this._stops.length;++n){const l=this._stops[n];if(l<=t)s=l;else break}return s}_appendPlaceholder(t){const s=new $;if(this.lazy&&t==null)return s;const n=this._mapPosToBlock(this.displayValue.length);if(!n)return s;const l=n.index,a=t??this._blocks.length;return this._blocks.slice(l,a).forEach(r=>{if(!r.lazy||t!=null){var i;s.aggregate(r._appendPlaceholder((i=r._blocks)==null?void 0:i.length))}}),s}_mapPosToBlock(t){let s="";for(let n=0;n<this._blocks.length;++n){const l=this._blocks[n],a=s.length;if(s+=l.displayValue,t<=s.length)return{index:n,offset:t-a}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((s,n)=>s+=n.displayValue.length,0)}_forEachBlocksInRange(t,s,n){s===void 0&&(s=this.displayValue.length);const l=this._mapPosToBlock(t);if(l){const a=this._mapPosToBlock(s),r=a&&l.index===a.index,i=l.offset,d=a&&r?a.offset:this._blocks[l.index].displayValue.length;if(n(this._blocks[l.index],l.index,i,d),a&&!r){for(let u=l.index+1;u<a.index;++u)n(this._blocks[u],u,0,this._blocks[u].displayValue.length);n(this._blocks[a.index],a.index,0,a.offset)}}}remove(t,s){t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length);const n=super.remove(t,s);return this._forEachBlocksInRange(t,s,(l,a,r,i)=>{n.aggregate(l.remove(r,i))}),n}nearestInputPos(t,s){if(s===void 0&&(s=E.NONE),!this._blocks.length)return 0;const n=new ii(this,t);if(s===E.NONE)return n.pushRightBeforeInput()||(n.popState(),n.pushLeftBeforeInput())?n.pos:this.displayValue.length;if(s===E.LEFT||s===E.FORCE_LEFT){if(s===E.LEFT){if(n.pushRightBeforeFilled(),n.ok&&n.pos===t)return t;n.popState()}if(n.pushLeftBeforeInput(),n.pushLeftBeforeRequired(),n.pushLeftBeforeFilled(),s===E.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:s===E.FORCE_LEFT?0:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:0)}return s===E.RIGHT||s===E.FORCE_RIGHT?(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.pushRightBeforeFilled()?n.pos:s===E.FORCE_RIGHT?this.displayValue.length:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:this.nearestInputPos(t,E.LEFT))):t}totalInputPositions(t,s){t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length);let n=0;return this._forEachBlocksInRange(t,s,(l,a,r,i)=>{n+=l.totalInputPositions(r,i)}),n}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const s=this._maskedBlocks[t];return s?s.map(n=>this._blocks[n]):[]}pad(t){const s=new $;return this._forEachBlocksInRange(0,this.displayValue.length,n=>s.aggregate(n.pad(t))),s}}K.DEFAULTS={...q.DEFAULTS,lazy:!0,placeholderChar:"_"},K.STOP_CHAR="`",K.ESCAPE_CHAR="\\",K.InputDefinition=Ve,K.FixedDefinition=Ge,F.MaskedPattern=K;class Ce extends K{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:s=this.to||0,from:n=this.from||0,maxLength:l=this.maxLength||0,autofix:a=this.autofix,...r}=t;this.to=s,this.from=n,this.maxLength=Math.max(String(s).length,l),this.autofix=a;const i=String(this.from).padStart(this.maxLength,"0"),d=String(this.to).padStart(this.maxLength,"0");let u=0;for(;u<d.length&&d[u]===i[u];)++u;r.mask=d.slice(0,u).replace(/0/g,"\\0")+"0".repeat(this.maxLength-u),super._update(r)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let s="",n="";const[,l,a]=t.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(s="0".repeat(l.length)+a,n="9".repeat(l.length)+a),s=s.padEnd(this.maxLength,"0"),n=n.padEnd(this.maxLength,"9"),[s,n]}doPrepareChar(t,s){s===void 0&&(s={});let n;return[t,n]=super.doPrepareChar(t.replace(/\D/g,""),s),t||(n.skip=!this.isComplete),[t,n]}_appendCharRaw(t,s){if(s===void 0&&(s={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,s);const n=String(this.from).padStart(this.maxLength,"0"),l=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],s):Number(a)>this.to?!s.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(n[this.value.length],s).aggregate(this._appendCharRaw(t,s)):super._appendCharRaw(l[this.value.length],s):super._appendCharRaw(t,s)}doValidate(t){const s=this.value;if(s.search(/[^0]/)===-1&&s.length<=this._matchFrom)return!0;const[l,a]=this.boundaries(s);return this.from<=Number(a)&&Number(l)<=this.to&&super.doValidate(t)}pad(t){const s=new $;if(this.value.length===this.maxLength)return s;const n=this.value,l=this.maxLength-this.value.length;if(l){this.reset();for(let a=0;a<l;++a)s.aggregate(super._appendCharRaw("0",t));n.split("").forEach(a=>this._appendCharRaw(a))}return s}}F.MaskedRange=Ce;const di="d{.}`m{.}`Y";class ie extends K{static extractPatternOptions(t){const{mask:s,pattern:n,...l}=t;return{...l,mask:pe(s)?s:n}}constructor(t){super(ie.extractPatternOptions({...ie.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:s,pattern:n,blocks:l,...a}={...ie.DEFAULTS,...t},r=Object.assign({},ie.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,l),super._update({...a,mask:pe(s)?s:n,blocks:r})}doValidate(t){const s=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&s!=null&&(this.min==null||this.min<=s)&&(this.max==null||s<=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(ie.extractPatternOptions(t))}}ie.GET_DEFAULT_BLOCKS=()=>({d:{mask:Ce,from:1,to:31,maxLength:2},m:{mask:Ce,from:1,to:12,maxLength:2},Y:{mask:Ce,from:1900,to:9999}}),ie.DEFAULTS={...K.DEFAULTS,mask:Date,pattern:di,format:(o,t)=>{if(!o)return"";const s=String(o.getDate()).padStart(2,"0"),n=String(o.getMonth()+1).padStart(2,"0"),l=o.getFullYear();return[s,n,l].join(".")},parse:(o,t)=>{const[s,n,l]=o.split(".").map(Number);return new Date(l,n-1,s)}},F.MaskedDate=ie;class Be extends q{constructor(t){super({...Be.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(s=>{const{expose:n,...l}=be(s),a=re({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...l});return n&&(this.exposeMask=a),a}):[])}_appendCharRaw(t,s){s===void 0&&(s={});const n=this._applyDispatch(t,s);return this.currentMask&&n.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(s))),n}_applyDispatch(t,s,n){t===void 0&&(t=""),s===void 0&&(s={}),n===void 0&&(n="");const l=s.tail&&s._beforeTailState!=null?s._beforeTailState._value:this.value,a=this.rawInputValue,r=s.tail&&s._beforeTailState!=null?s._beforeTailState._rawInputValue:a,i=a.slice(r.length),d=this.currentMask,u=new $,c=d?.state;return this.currentMask=this.doDispatch(t,{...s},n),this.currentMask&&(this.currentMask!==d?(this.currentMask.reset(),r&&(this.currentMask.append(r,{raw:!0}),u.tailShift=this.currentMask.value.length-l.length),i&&(u.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):c&&(this.currentMask.state=c)),u}_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 s=new $;return t&&s.aggregate(this._applyDispatch("",{},t)),s.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var s,n;return{...t,_beforeTailState:((s=t._beforeTailState)==null?void 0:s.currentMaskRef)===this.currentMask&&((n=t._beforeTailState)==null?void 0:n.currentMask)||t._beforeTailState}}doDispatch(t,s,n){return s===void 0&&(s={}),n===void 0&&(n=""),this.dispatch(t,this,s,n)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,s){s===void 0&&(s={});let[n,l]=super.doPrepare(t,s);if(this.currentMask){let a;[n,a]=super.doPrepare(n,this.currentMaskFlags(s)),l=l.aggregate(a)}return[n,l]}doPrepareChar(t,s){s===void 0&&(s={});let[n,l]=super.doPrepareChar(t,s);if(this.currentMask){let a;[n,a]=super.doPrepareChar(n,this.currentMaskFlags(s)),l=l.aggregate(a)}return[n,l]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(s=>s.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 s=String(t);this.currentMask&&(this.currentMask.typedValue=t,s=this.currentMask.unmaskedValue),this.unmaskedValue=s}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,s){const n=new $;return this.currentMask&&n.aggregate(this.currentMask.remove(t,s)).aggregate(this._applyDispatch()),n}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(s=>s.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:s,currentMaskRef:n,currentMask:l,...a}=t;s&&this.compiledMasks.forEach((r,i)=>r.state=s[i]),n!=null&&(this.currentMask=n,this.currentMask.state=l),super.state=a}extractInput(t,s,n){return this.currentMask?this.currentMask.extractInput(t,s,n):""}extractTail(t,s){return this.currentMask?this.currentMask.extractTail(t,s):super.extractTail(t,s)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,s){return this.currentMask?this.currentMask.nearestInputPos(t,s):super.nearestInputPos(t,s)}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((s,n)=>{if(!t[n])return;const{mask:l,...a}=t[n];return $e(s,a)&&s.maskEquals(l)}):super.maskEquals(t)}typedValueEquals(t){var s;return!!((s=this.currentMask)!=null&&s.typedValueEquals(t))}}Be.DEFAULTS={...q.DEFAULTS,dispatch:(o,t,s,n)=>{if(!t.compiledMasks.length)return;const l=t.rawInputValue,a=t.compiledMasks.map((r,i)=>{const d=t.currentMask===r,u=d?r.displayValue.length:r.nearestInputPos(r.displayValue.length,E.FORCE_LEFT);return r.rawInputValue!==l?(r.reset(),r.append(l,{raw:!0})):d||r.remove(u),r.append(o,t.currentMaskFlags(s)),r.appendTail(n),{index:i,weight:r.rawInputValue.length,totalInputPositions:r.totalInputPositions(0,Math.max(u,r.nearestInputPos(r.displayValue.length,E.FORCE_LEFT)))}});return a.sort((r,i)=>i.weight-r.weight||i.totalInputPositions-r.totalInputPositions),t.compiledMasks[a[0].index]}},F.MaskedDynamic=Be;class ve extends K{constructor(t){super({...ve.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:s,...n}=t;if(s){const l=s.map(i=>i.length),a=Math.min(...l),r=Math.max(...l)-a;n.mask="*".repeat(a),r&&(n.mask+="["+"*".repeat(r)+"]"),this.enum=s}super._update(n)}_appendCharRaw(t,s){s===void 0&&(s={});const n=Math.min(this.nearestInputPos(0,E.FORCE_RIGHT),this.value.length),l=this.enum.filter(a=>this.matchValue(a,this.unmaskedValue+t,n));if(l.length){l.length===1&&this._forEachBlocksInRange(0,this.value.length,(r,i)=>{const d=l[0][i];i>=this.value.length||d===r.value||(r.reset(),r._appendChar(d,s))});const a=super._appendCharRaw(l[0][this.value.length],s);return l.length===1&&l[0].slice(this.unmaskedValue.length).split("").forEach(r=>a.aggregate(super._appendCharRaw(r))),a}return new $({skip:!this.isComplete})}extractTail(t,s){return t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),new oe("",t)}remove(t,s){if(t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),t===s)return new $;const n=Math.min(super.nearestInputPos(0,E.FORCE_RIGHT),this.value.length);let l;for(l=t;l>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(n,l),n)).length>1);--l);const a=super.remove(l,s);return a.tailShift+=l-t,a}get isComplete(){return this.enum.indexOf(this.value)>=0}}ve.DEFAULTS={...K.DEFAULTS,matchValue:(o,t,s)=>o.indexOf(t,s)===s},F.MaskedEnum=ve;class $t extends q{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}F.MaskedFunction=$t;var Dt;class J extends q{constructor(t){super({...J.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),s="\\d*",n=(this.scale?"("+Pe(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+s+n),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Pe).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Pe(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const s=t.split(this.radix);return s[0]=s[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),s.join(this.radix)}doPrepareChar(t,s){s===void 0&&(s={});const[n,l]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(s.input&&s.raw||!s.input&&!s.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),s);return t&&!n&&(l.skip=!0),n&&!this.allowPositive&&!this.value&&n!=="-"&&l.aggregate(this._appendChar("-")),[n,l]}_separatorsCount(t,s){s===void 0&&(s=!1);let n=0;for(let l=0;l<t;++l)this._value.indexOf(this.thousandsSeparator,l)===l&&(++n,s&&(t+=this.thousandsSeparator.length));return n}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,s,n){return t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),[t,s]=this._adjustRangeWithSeparators(t,s),this._removeThousandsSeparators(super.extractInput(t,s,n))}_appendCharRaw(t,s){s===void 0&&(s={});const n=s.tail&&s._beforeTailState?s._beforeTailState._value:this._value,l=this._separatorsCountFromSlice(n);this._value=this._removeThousandsSeparators(this.value);const a=this._value;this._value+=t;const r=this.number;let i=!isNaN(r),d=!1;if(i){let h;this.min!=null&&this.min<0&&this.number<this.min&&(h=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(h=this.max),h!=null&&(this.autofix?(this._value=this.format(h,this).replace(J.UNMASKED_RADIX,this.radix),d||(d=a===this._value&&!s.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let u;i?u=new $({inserted:this._value.slice(a.length),rawInserted:d?"":t,skip:d}):(this._value=a,u=new $),this._value=this._insertThousandsSeparators(this._value);const c=s.tail&&s._beforeTailState?s._beforeTailState._value:this._value,p=this._separatorsCountFromSlice(c);return u.tailShift+=(p-l)*this.thousandsSeparator.length,u}_findSeparatorAround(t){if(this.thousandsSeparator){const s=t-this.thousandsSeparator.length+1,n=this.value.indexOf(this.thousandsSeparator,s);if(n<=t)return n}return-1}_adjustRangeWithSeparators(t,s){const n=this._findSeparatorAround(t);n>=0&&(t=n);const l=this._findSeparatorAround(s);return l>=0&&(s=l+this.thousandsSeparator.length),[t,s]}remove(t,s){t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length),[t,s]=this._adjustRangeWithSeparators(t,s);const n=this.value.slice(0,t),l=this.value.slice(s),a=this._separatorsCount(n.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(n+l));const r=this._separatorsCountFromSlice(n);return new $({tailShift:(r-a)*this.thousandsSeparator.length})}nearestInputPos(t,s){if(!this.thousandsSeparator)return t;switch(s){case E.NONE:case E.LEFT:case E.FORCE_LEFT:{const n=this._findSeparatorAround(t-1);if(n>=0){const l=n+this.thousandsSeparator.length;if(t<l||this.value.length<=l||s===E.FORCE_LEFT)return n}break}case E.RIGHT:case E.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 s=t;this.min!=null&&(s=Math.max(s,this.min)),this.max!=null&&(s=Math.min(s,this.max)),s!==t&&(this.unmaskedValue=this.format(s,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 s=this._removeThousandsSeparators(t).split(this.radix);return s[0]=s[0].replace(/^(\D*)(0*)(\d*)/,(n,l,a,r)=>l+r),t.length&&!/\d$/.test(s[0])&&(s[0]=s[0]+"0"),s.length>1&&(s[1]=s[1].replace(/0*$/,""),s[1].length||(s.length=1)),this._insertThousandsSeparators(s.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const s=t.split(this.radix);return s.length<2&&s.push(""),s[1]=s[1].padEnd(this.scale,"0"),s.join(this.radix)}doSkipInvalid(t,s,n){s===void 0&&(s={});const l=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===J.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,s,n)&&!l}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,J.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(J.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)||J.EMPTY_VALUES.includes(t)&&J.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}Dt=J,J.UNMASKED_RADIX=".",J.EMPTY_VALUES=[...q.EMPTY_VALUES,0],J.DEFAULTS={...q.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Dt.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:o=>o.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},F.MaskedNumber=J;const Le={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function qe(o,t,s){t===void 0&&(t=Le.MASKED),s===void 0&&(s=Le.MASKED);const n=re(o);return l=>n.runIsolated(a=>(a[t]=l,a[s]))}function It(o,t,s,n){return qe(t,s,n)(o)}F.PIPE_TYPE=Le,F.createPipe=qe,F.pipe=It;class Lt extends K{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 s,n,l;const{repeat:a,...r}=be(t);this._blockOpts=Object.assign({},this._blockOpts,r);const i=re(this._blockOpts);this.repeat=(s=(n=a??i.repeat)!=null?n:this.repeat)!=null?s:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((l=this._blocks)==null?void 0:l.length)||0,this.repeatFrom)),blocks:{m:i},eager:i.eager,overwrite:i.overwrite,skipInvalid:i.skipInvalid,lazy:i.lazy,placeholderChar:i.placeholderChar,displayChar:i.displayChar})}_allocateBlock(t){if(t<this._blocks.length)return this._blocks[t];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(re(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,s){s===void 0&&(s={});const n=new $;for(let d=(l=(a=this._mapPosToBlock(this.displayValue.length))==null?void 0:a.index)!=null?l:Math.max(this._blocks.length-1,0),u,c;u=(r=this._blocks[d])!=null?r:c=!c&&this._allocateBlock(d);++d){var l,a,r,i;const p=u._appendChar(t,{...s,_beforeTailState:(i=s._beforeTailState)==null||(i=i._blocks)==null?void 0:i[d]});if(p.skip&&c){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(n.aggregate(p),p.consumed)break}return n}_trimEmptyTail(t,s){var n,l;t===void 0&&(t=0);const a=Math.max(((n=this._mapPosToBlock(t))==null?void 0:n.index)||0,this.repeatFrom,0);let r;s!=null&&(r=(l=this._mapPosToBlock(s))==null?void 0:l.index),r==null&&(r=this._blocks.length-1);let i=0;for(let d=r;a<=d&&!this._blocks[d].unmaskedValue;--d,++i);i&&(this._blocks.splice(r-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(t,s){t===void 0&&(t=0),s===void 0&&(s=this.displayValue.length);const n=super.remove(t,s);return this._trimEmptyTail(t,s),n}totalInputPositions(t,s){return t===void 0&&(t=0),s==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,s)}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}}F.RepeatBlock=Lt;try{globalThis.IMask=F}catch{}const ui=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:$,ChunksTailDetails:he,DIRECTION:E,HTMLContenteditableMaskElement:He,HTMLInputMaskElement:Mt,HTMLMaskElement:Ee,InputMask:Ft,MaskElement:De,Masked:q,MaskedDate:ie,MaskedDynamic:Be,MaskedEnum:ve,MaskedFunction:$t,MaskedNumber:J,MaskedPattern:K,MaskedRange:Ce,MaskedRegExp:At,PIPE_TYPE:Le,PatternFixedDefinition:Ge,PatternInputDefinition:Ve,RepeatBlock:Lt,createMask:re,createPipe:qe,default:F,forceDirection:vt,normalizeOpts:be,pipe:It},Symbol.toStringTag,{value:"Module"}));O.ModalEdit=Et,O.VForm=me,O.VsInputArray=bt,O.VsInputCheckbox=Qe,O.VsInputColor=gt,O.VsInputContainer=it,O.VsInputDate=et,O.VsInputEmail=Xe,O.VsInputFile=at,O.VsInputFileList=rt,O.VsInputKeyValue=ft,O.VsInputMask=Je,O.VsInputNumber=Ye,O.VsInputRadio=je,O.VsInputRange=kt,O.VsInputSelect=Ue,O.VsInputSlug=mt,O.VsInputStatic=ze,O.VsInputSwitcher=Re,O.VsInputTag=ht,O.VsInputText=xe,O.VsInputTextarea=dt,O.default=me,O.inputs=yt,O.vsInputDatatable=ct,O.vsInputMap=pt,Object.defineProperties(O,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|