@opengis/form 0.0.24 → 0.0.25
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/behavior.vue.d.ts +1 -1
- package/dist/components/behavior.vue.d.ts.map +1 -1
- package/dist/components/inputs/index.d.ts +24 -0
- package/dist/components/inputs/index.d.ts.map +1 -1
- package/dist/components/inputs/vs-input-key-value.vue.d.ts +8 -0
- package/dist/components/inputs/vs-input-key-value.vue.d.ts.map +1 -0
- package/dist/components/inputs/vs-input-select.vue.d.ts +1 -1
- package/dist/components/inputs/vs-input-select.vue.d.ts.map +1 -1
- package/dist/components/inputs/vs-input-slug.vue.d.ts +13 -0
- package/dist/components/inputs/vs-input-slug.vue.d.ts.map +1 -0
- package/dist/components/layouts/vs-compact-form-layout.vue.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1399 -1160
- package/dist/index.umd.cjs +3 -3
- package/dist/schema.d.ts +11 -0
- package/dist/schema.d.ts.map +1 -1
- package/dist/types/form.d.ts +1 -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(T,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@opengis/core")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core"],t):(T=typeof globalThis<"u"?globalThis:T||self,t(T.FormBuilder={},T.Vue,T.OpenGISCore))})(this,function(T,t,W){"use strict";const wt={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},Et={class:"opacity-100"},Vt={key:0,class:"text-red-500 text-[14px]"},Ct={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},vt=t.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 e=t.ref("uk"),s=n=>{n.detail.key==="locale"&&(e.value=n.detail.newValue)};return t.onMounted(()=>{e.value=localStorage.locale,window.addEventListener("storage",s)}),t.onUnmounted(()=>{window.removeEventListener("resize",s)}),(n,l)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["w-full relative",{"opacity-60":n.item.disabled}])},[n.ua||n.label?(t.openBlock(),t.createElementBlock("div",wt,[t.createElementVNode("span",Et,t.toDisplayString(n.item[e.value]||n.ua||n.label),1),n.item?.rules?.includes("required")?(t.openBlock(),t.createElementBlock("span",Vt,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.renderSlot(n.$slots,"default",t.normalizeProps(t.guardReactiveProps(n.$attrs))),n.error?(t.openBlock(),t.createElementBlock("span",Ct,t.toDisplayString(n.error),1)):t.createCommentVNode("",!0)],2))}}),Bt={class:"w-full relative flex flex-row items-center gap-2"},St={key:0,class:"text-sm text-gray-900 font-medium flex shrink-0 w-3/12 max-w-[250px]"},Nt={key:0,class:"text-red-500 text-[14px]"},Ft={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},At=t.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(e,s)=>(t.openBlock(),t.createElementBlock("div",Bt,[e.item?.type!=="html"?(t.openBlock(),t.createElementBlock("span",St,[t.createTextVNode(t.toDisplayString(e.ua||e.label)+" ",1),e.item?.rules?.includes("required")&&(e.ua||e.label)?(t.openBlock(),t.createElementBlock("span",Nt,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"default",t.normalizeProps(t.guardReactiveProps(e.$attrs))),e.error?(t.openBlock(),t.createElementBlock("span",Ft,t.toDisplayString(e.error),1)):t.createCommentVNode("",!0)]))}}),Mt={class:"w-full relative"},$t={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Dt={default:vt,horizontal:At,inline:t.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(e,s)=>(t.openBlock(),t.createElementBlock("div",Mt,[t.renderSlot(e.$slots,"default",t.normalizeProps(t.guardReactiveProps(e.$attrs))),e.error?(t.openBlock(),t.createElementBlock("span",$t,t.toDisplayString(e.error),1)):t.createCommentVNode("",!0)]))}})};function le(o){return{inputClass:t.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 It=["placeholder","disabled"],Fe=t.defineComponent({__name:"vs-input-text",props:t.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 e=o,{inputClass:s}=le(e.style),n=t.useModel(o,"modelValue");return(l,r)=>t.withDirectives((t.openBlock(),t.createElementBlock("input",{type:"text","onUpdate:modelValue":r[0]||(r[0]=a=>n.value=a),placeholder:l.placeholder,disabled:l.disabled,class:t.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[t.unref(s),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,It)),[[t.vModelText,n.value]])}}),Lt=["placeholder"],ze=t.defineComponent({__name:"vs-input-number",props:t.mergeModels({style:{default:()=>({})},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,{inputClass:s}=le(e.style),n=t.useModel(o,"modelValue");return(l,r)=>t.withDirectives((t.openBlock(),t.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":r[0]||(r[0]=a=>n.value=a),placeholder:l.placeholder,class:t.normalizeClass(["py-1.5 px-3 block w-full bg-white",[t.unref(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,Lt)),[[t.vModelText,n.value]])}}),I=(o,e)=>{const s=o.__vccOpts||o;for(const[n,l]of e)s[n]=l;return s},Tt={},Ot={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 Rt(o,e){return t.openBlock(),t.createElementBlock("svg",Ot,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const zt=I(Tt,[["render",Rt]]),jt={class:"flex items-center gap-[4px]"},Ut=["value","id","disabled"],Pt=["for"],Ht={class:"text-[14px] text-gray-700 flex items-center gap-x-1 ml-1 dark:text-neutral-400"},qt=t.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:e}){const s=e,n=o,l=t.computed({get:()=>n.modelValue,set:r=>s("update:modelValue",r)});return(r,a)=>(t.openBlock(),t.createElementBlock("div",jt,[t.withDirectives(t.createElementVNode("input",{type:"checkbox",value:r.value,"onUpdate:modelValue":a[0]||(a[0]=i=>l.value=i),class:t.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":r.disabled}]),id:r.id,disabled:r.disabled},null,10,Ut),[[t.vModelCheckbox,l.value]]),t.createElementVNode("label",{for:r.id,class:t.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":r.disabled}])},[t.createElementVNode("div",{class:t.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",r.error?"border-red-600":""]])},[t.createVNode(zt,{height:"12",width:"12"})],2),t.createElementVNode("span",Ht,[t.renderSlot(r.$slots,"default",{},()=>[t.createTextVNode(t.toDisplayString(r.label),1)])])],10,Pt)]))}}),Gt=["name","value","disabled"],Kt={class:"flex items-center gap-[6px] text-[14px]"},Zt={key:0,class:"text-[16px]"},Yt=["src"],Jt=t.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:e}){const s=o,n=e,l=t.computed({get:()=>s.modelValue,set:i=>{n("update:modelValue",i)}}),r=t.computed(()=>Array.isArray(l.value)?l.value.includes(s.value):l.value===!0||l.value===s.value),a=t.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,u)=>(t.openBlock(),t.createElementBlock("label",{class:t.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",[a.value,r.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[t.withDirectives(t.createElementVNode("input",{type:"checkbox",class:"hidden",name:i.id,value:i.value,"onUpdate:modelValue":u[0]||(u[0]=c=>l.value=c),disabled:i.disabled},null,8,Gt),[[t.vModelCheckbox,l.value]]),t.createElementVNode("span",Kt,[i.icon||i.imgUrl?(t.openBlock(),t.createElementBlock("span",Zt,[i.icon?(t.openBlock(),t.createElementBlock("i",{key:0,class:t.normalizeClass(i.icon)},null,2)):t.createCommentVNode("",!0),i.imgUrl?(t.openBlock(),t.createElementBlock("img",{key:1,src:i.imgUrl,width:"16",height:"16",alt:"icon"},null,8,Yt)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.renderSlot(i.$slots,"default",{},()=>[t.createTextVNode(t.toDisplayString(i.label),1)])])],2))}}),Wt={class:"flex items-center"},je=t.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:e}){const s=o,n=e,l=`radio-${Math.floor(Math.random()*1e4)}`,r=t.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 u=[...s.modelValue];i?u.includes(s.value)||u.push(s.value):u=u.filter(c=>c!==s.value),n("update:modelValue",u)}else n("update:modelValue",i)}}),a=t.ref(`vs-checkbox-${s.view||"default"}`);return(i,u)=>(t.openBlock(),t.createElementBlock("div",Wt,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.value==="vs-checkbox-buttons"?t.unref(Jt):t.unref(qt)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:r.value,"onUpdate:modelValue":u[0]||(u[0]=c=>r.value=c),id:l,icon:i.icon,imgUrl:i.imgUrl,style:t.normalizeStyle(i.style),error:i.error},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),Xt={},Qt={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 es(o,e){return t.openBlock(),t.createElementBlock("svg",Qt,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const ts=I(Xt,[["render",es]]),ss={},ns={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 ls(o,e){return t.openBlock(),t.createElementBlock("svg",ns,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M12 9h.01"},null,-1),t.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),t.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 rs=I(ss,[["render",ls]]),as={key:0,class:"flex items-start gap-x-1"},os={key:0,class:"text-red-500 text-[14px]"},is=["title"],us=["disabled"],Ae=t.defineComponent({__name:"vs-input-switcher",props:t.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 e=o,s=t.useModel(o,"modelValue");return(n,l)=>e.view==="checkbox"?(t.openBlock(),t.createElementBlock("div",as,[t.createVNode(je,{modelValue:s.value,"onUpdate:modelValue":l[0]||(l[0]=r=>s.value=r),label:n.text,error:n.error||""},null,8,["modelValue","label","error"]),n.rules?.includes("required")?(t.openBlock(),t.createElementBlock("span",os,"*")):t.createCommentVNode("",!0),n.i?(t.openBlock(),t.createElementBlock("button",{key:1,class:"cursor-pointer",title:n.i,onClick:l[1]||(l[1]=t.withModifiers(()=>{},["prevent"]))},[t.createVNode(t.unref(rs),{class:"text-gray-500 w-[14px] h-[14px]"})],8,is)):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.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]=r=>s.value=!s.value)},[t.createElementVNode("span",{"data-state":"checked",class:t.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,us))}}),ds=["innerHTML"],Me=t.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(o){return(e,s)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(e.customClass),innerHTML:e.html?e.html:e.text},null,10,ds))}}),cs=["placeholder","disabled","name"],Ue=t.defineComponent({__name:"vs-input-mask",props:t.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 e=o,{inputClass:s}=le(e.style),n=t.useModel(o,"modelValue"),l=t.ref(null);let r=null;return t.onMounted(async()=>{if(l.value){const{default:a}=await Promise.resolve().then(()=>lo);r=a(l.value,{mask:e.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),r.on("accept",()=>{n.value=e.unmask?r.unmaskedValue:r.value}),r.on("complete",()=>{n.value=e.unmask?r.unmaskedValue:r.value}),r.value=n.value??""}}),t.onBeforeUnmount(()=>{r?.destroy()}),t.watch(()=>e.mask,a=>{r&&r.updateOptions({mask:a,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),t.watch(n,a=>{r&&r.unmaskedValue!==a&&(r.value=a||"")}),(a,i)=>(t.openBlock(),t.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:l,placeholder:a.placeholder,disabled:a.disabled,name:a.name,class:t.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[t.unref(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,cs))}}),ps={class:"relative w-full bg-white rounded-lg"},hs=["placeholder","disabled"],Pe=t.defineComponent({__name:"vs-input-email",props:t.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 e=o,{inputClass:s}=le(e.style),n=t.useModel(o,"modelValue");return(l,r)=>(t.openBlock(),t.createElementBlock("div",ps,[r[1]||(r[1]=t.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)),t.withDirectives(t.createElementVNode("input",{type:"email","onUpdate:modelValue":r[0]||(r[0]=a=>n.value=a),placeholder:l.placeholder,disabled:l.disabled,class:t.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[t.unref(s),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,hs),[[t.vModelText,n.value]])]))}}),ms=["value","disabled"],fs={class:"text-[13px] text-gray-700"},gs=t.defineComponent({__name:"vs-input-radio-default",props:t.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=t.useModel(o,"modelValue");return(s,n)=>(t.openBlock(),t.createElementBlock("label",{class:t.normalizeClass(["flex items-center gap-0",[s.customClass]])},[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":n[0]||(n[0]=l=>e.value=l),type:"radio",value:s.value,disabled:s.disabled,class:"hidden"},null,8,ms),[[t.vModelRadio,e.value]]),t.createElementVNode("span",{class:t.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":""]])},[e.value==s.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${s.style?.primaryColor||"blue"}-500`]])},null,2)):t.createCommentVNode("",!0)],2),t.createElementVNode("span",fs,t.toDisplayString(s.text),1)],2))}}),ks=["value","disabled"],bs={class:"text-[13px] text-gray-700"},ys={"vs-input-radio-default":gs,"vs-input-radio-buttons":t.defineComponent({__name:"vs-input-radio-buttons",props:t.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=t.useModel(o,"modelValue");return(s,n)=>(t.openBlock(),t.createElementBlock("label",{class:t.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[e.value==s.value?`ring-2 ring-ring ring-${s.style?.primaryColor||"blue"}-500`:"",s.customClass]])},[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":n[0]||(n[0]=l=>e.value=l),type:"radio",value:s.value,disabled:s.disabled,class:"hidden"},null,8,ks),[[t.vModelRadio,e.value]]),t.createElementVNode("span",bs,t.toDisplayString(s.text),1)],2))}})},$e=t.defineComponent({__name:"vs-input-radio",props:t.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 e=o,s=t.useModel(o,"modelValue"),n=t.computed(()=>ys[`vs-input-radio-${e.view}`]);return(l,r)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass([l.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.options,a=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(n.value),t.mergeProps({key:a?.id,text:a.text,value:a.id.toString(),checked:s.value===a.id,modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=i=>s.value=i)},{ref_for:!0},l.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),He=I(t.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:e}){const s=o,n=e,l=t.ref([]),r=t.reactive({}),a=d=>d?.value||d?.id||d?.text||d,i=d=>d.text||String(d),u=d=>`lg:col-span-${d||12}`,c=async()=>{try{const d=await fetch(`/api/suggest/${s.data}`).then(h=>h.json());l.value=d?.data||d}catch(d){console.error(d)}};return t.watch(()=>s.modelValue,d=>{if(typeof d=="boolean"&&l.value.length===1){const h=a(l.value[0]);r[h]=d}else if(Array.isArray(d)){const h=new Set(d);l.value.forEach(p=>{if(!p.disabled){const w=a(p);r[w]=h.has(w)}})}},{immediate:!0}),t.watch(r,()=>{if(!l.value.length){n("update:modelValue",null);return}const d=Object.entries(r).filter(([,h])=>h).map(([h])=>h);n("update:modelValue",d.length===0?[]:d)},{deep:!0}),t.onMounted(()=>{if(s.data)c().then(()=>{if(typeof s.modelValue=="boolean"&&l.value.length===1){const d=a(l.value[0]);r[d]=s.modelValue}else if(Array.isArray(s.modelValue)){const d=new Set(s.modelValue);l.value.forEach(h=>{if(!h.disabled){const p=a(h);r[p]=d.has(p)}})}});else if(l.value=s.options,typeof s.modelValue=="boolean"&&l.value.length===1){const d=a(l.value[0]);r[d]=s.modelValue}else if(Array.isArray(s.modelValue)){const d=new Set(s.modelValue);l.value.forEach(h=>{if(!h.disabled){const p=a(h);r[p]=d.has(p)}})}}),(d,h)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["p-0 w-full gap-[6px]",[d.position==="vertical"?"flex-col":"",d.colSpan?"grid":"flex justify-start"]])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,p=>(t.openBlock(),t.createBlock(je,{modelValue:r[a(p)],"onUpdate:modelValue":w=>r[a(p)]=w,value:a(p),class:t.normalizeClass(u(d.colSpan)),disabled:p.disabled,label:i(p),key:a(p),icon:p?.icon,imgUrl:p?.imgUrl,option:p,view:d.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-91f3584a"]]),xs=["placeholder","disabled"],qe=t.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},emits:["update:modelValue"],setup(o,{emit:e}){const s=o,{inputClass:n}=le(s.style),l=e,r=t.computed({get:()=>s.modelValue?.split(" ")[0],set:a=>l("update:modelValue",a)});return(a,i)=>t.withDirectives((t.openBlock(),t.createElementBlock("input",{type:"date","onUpdate:modelValue":i[0]||(i[0]=u=>r.value=u),placeholder:a.placeholder,disabled:a.disabled,ref:"date",class:t.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[a.modelValue?"":"text-opacity-50",t.unref(n)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,xs)),[[t.vModelText,r.value]])}}),_s=async(o,e,s,n)=>{try{const l=new FormData;return l.append("unique","true"),l.append("file",o),(await fetch(`/file/upload/uploads?id=${e||""}&form=${s||""}&table=${n||""}`,{method:"POST",body:l}).then(a=>a.json()))?.result}catch(l){return W.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",l),null}},ws=async o=>{try{return await fetch(`file/delete${o}`),!0}catch(e){return console.error(e),!1}},Ge=async o=>{try{const e=await fetch(`file/download/files/uploads${o}`),s=await e.arrayBuffer(),n=e.headers["content-type"],l=new TextDecoder("utf-8").decode(s),r=new Blob([l],{type:n}),a=document.createElement("a");a.setAttribute("download",o),a.href=window.URL.createObjectURL(r),a.click()}catch(e){console.error(e.message)}},Es={},Vs={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 Cs(o,e){return t.openBlock(),t.createElementBlock("svg",Vs,e[0]||(e[0]=[t.createElementVNode("path",{d:"M5 12h14"},null,-1),t.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const Ee=I(Es,[["render",Cs]]),vs={},Bs={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 Ss(o,e,s,n,l,r){return t.openBlock(),t.createElementBlock("svg",Bs,e[0]||(e[0]=[t.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 Ns=I(vs,[["render",Ss]]),Fs={},As={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 Ms(o,e,s,n,l,r){return t.openBlock(),t.createElementBlock("svg",As,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),t.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),t.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const $s=I(Fs,[["render",Ms]]),Ds={},Is={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-file-unknown"};function Ls(o,e,s,n,l,r){return t.openBlock(),t.createElementBlock("svg",Is,e[0]||(e[0]=[t.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="M12 17v.01"></path><path d="M12 14a1.5 1.5 0 1 0 -1.14 -2.474"></path>',5)]))}const Ts=I(Ds,[["render",Ls]]),Os={},Rs={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 zs(o,e,s,n,l,r){return t.openBlock(),t.createElementBlock("svg",Rs,e[0]||(e[0]=[t.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 js=I(Os,[["render",zs]]),Us={},Ps={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 Hs(o,e,s,n,l,r){return t.openBlock(),t.createElementBlock("svg",Ps,e[0]||(e[0]=[t.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 qs=I(Us,[["render",Hs]]),Gs=o=>{if(!o)return"";const e=o?.split(".");return e[e.length-1]},Ks=o=>{const e=Gs(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(e)?"img":s.sheetsFormat.includes(e)?$s:s.textsFormat.includes(e)?qs:s.documentsFormat.includes(e)?Ns:s.archivesFormat.includes(e)?js:Ts},Zs={},Ys={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 Js(o,e){return t.openBlock(),t.createElementBlock("svg",Ys,e[0]||(e[0]=[t.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 Ve=I(Zs,[["render",Js]]),Ws={},Xs={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 Qs(o,e){return t.openBlock(),t.createElementBlock("svg",Xs,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),t.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),t.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Ke=I(Ws,[["render",Qs]]),en={class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},tn={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},Ze=I(t.defineComponent({__name:"vs-input-file-list-item",props:t.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 e=t.useModel(o,"value"),s=t.useModel(o,"item"),n=o;return(l,r)=>(t.openBlock(),t.createElementBlock("div",en,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(Ks)(s.value)),{src:s.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:r[0]||(r[0]=a=>t.unref(Ge)(s.value))},null,8,["src"])),t.createElementVNode("div",tn,[t.createElementVNode("button",{type:"button",onClick:r[1]||(r[1]=a=>{t.unref(ws)(s.value),e.value=n.multiple?e.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"},[t.createVNode(Ve,{class:"w-4 h-4"})]),t.createElementVNode("button",{type:"button",onClick:r[2]||(r[2]=a=>t.unref(Ge)(s.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[t.createVNode(Ke,{class:"w-4 h-4"})])])]))}}),[["__scopeId","data-v-0ca886b3"]]),sn={class:"flex items-center gap-x-2"},nn={key:1,class:"flex items-center flex-wrap gap-2"},Ye=t.defineComponent({__name:"vs-input-file",props:t.mergeModels({format:{},multiple:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,s=t.useModel(o,"modelValue"),n=t.ref(null),l=a=>Array.isArray(s.value)&&s.value[a]||"",r=async a=>{if(e.format){const c=a.target.files?.[0];if(!c||!c.name.endsWith(e.format))return}const i=a.target.files?.[0];if(!i)return;const u=await _s(i,"1","form","table");s.value=e.multiple?[...s.value||[],u?.file_path]:u?.file_path};return(a,i)=>(t.openBlock(),t.createElementBlock("div",sn,[t.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:n,type:"file",onChange:r},null,544),!a.multiple&&s.value?(t.openBlock(),t.createBlock(Ze,{key:0,item:s.value,"onUpdate:item":i[0]||(i[0]=u=>s.value=u),value:s.value,"onUpdate:value":i[1]||(i[1]=u=>s.value=u)},null,8,["item","value"])):a.multiple?(t.openBlock(),t.createElementBlock("div",nn,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,(u,c)=>(t.openBlock(),t.createBlock(Ze,{multiple:a.multiple,key:c,value:s.value,"onUpdate:value":i[2]||(i[2]=d=>s.value=d),item:l(c)},null,8,["multiple","value","item"]))),128)),t.createElementVNode("div",{onClick:i[3]||(i[3]=u=>!a.disabled&&n.value?.click()),class:t.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",a.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[t.createVNode(Ee,{class:"w-6 h-6"})],2)])):t.createCommentVNode("",!0),a.multiple?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:2,onClick:i[4]||(i[4]=u=>n.value?.click()),class:t.normalizeClass([a.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"])},[t.createVNode(Ee,{class:"w-6 h-6"})],2))]))}}),ln={class:"max-w-[55vw]"},rn={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},an={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},on={class:"px-[5px]"},un={class:""},Ce=t.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(o){const e=o,s=t.computed(()=>{try{return new Date(e.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function n(l){if(l<1024)return`${l} B`;const r=l/1024;return r<1024?`${r.toFixed(2)} KB`:`${(r/1024).toFixed(2)} MB`}return(l,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[r[1]||(r[1]=t.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)),t.createElementVNode("div",ln,[t.createElementVNode("p",rn,t.toDisplayString(l.item?.uploaded_name),1),t.createElementVNode("p",an,[t.createElementVNode("span",null,t.toDisplayString(l.item?.username),1),t.withDirectives(t.createElementVNode("span",on,"|",512),[[t.vShow,l.item?.username]]),t.createElementVNode("span",null,t.toDisplayString(s.value),1),r[0]||(r[0]=t.createElementVNode("span",{class:"px-[5px]"},"|",-1)),t.createElementVNode("span",un,t.toDisplayString(n(l.item?.size)),1)])])],64))}}),dn={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},cn={key:0,class:"flex w-full gap-x-3 items-center"},pn={key:1,class:"flex gap-x-3 w-full items-center"},hn={key:2,class:"flex gap-x-3 w-full items-center"},mn=["href"],fn={key:3,class:"flex gap-x-3 w-full items-center"},gn={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},kn={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"},bn={class:"inline-block"},yn={class:"inline-block"},xn=t.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(o,{emit:e}){const s=o,n=e;function l(d){return["pdf","json"].includes(d.ext)}function r(d){return["ppt","pptx","doc","docx","xls","xlsx"].includes(d.ext)}function a(d){const h=document.createElement("a");h.setAttribute("download",d?.uploaded_name),h.href=d?.file_path,h.click()}async function i(){try{await fetch(`${s.prefix}/widget/file/${s.item.entity_id}/${s.item.file_id}`),n("update")}catch(d){console.error(d)}}function u(){n("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function c(d){(s.item.ext==="jpg"||s.item.ext==="png")&&n("openLightbox",{item:s.item,index:d})}return(d,h)=>(t.openBlock(),t.createElementBlock("div",dn,[d.item.ext==="jpg"||d.item.ext==="png"?(t.openBlock(),t.createElementBlock("div",cn,[t.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:h[0]||(h[0]=p=>c(d.index))},[t.createVNode(Ce,{item:d.item},null,8,["item"])])])):l(d.item)?(t.openBlock(),t.createElementBlock("div",pn,[t.createVNode(Ce,{item:d.item},null,8,["item"])])):r(d.item)?(t.openBlock(),t.createElementBlock("div",hn,[t.createElementVNode("a",{href:`/api/file-preview?id=${d.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[t.createVNode(Ce,{item:d.item},null,8,["item"])],8,mn)])):(t.openBlock(),t.createElementBlock("div",fn,[t.createVNode(Ce,{item:d.item},null,8,["item"])])),t.createElementVNode("div",gn,[t.createElementVNode("div",kn,[t.createElementVNode("div",bn,[t.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:h[1]||(h[1]=p=>a(d.item))},[t.createVNode(Ke,{height:"14",width:"14"})])]),h[3]||(h[3]=t.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),t.createElementVNode("div",yn,[t.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:h[2]||(h[2]=p=>u())},[t.createVNode(Ve,{height:"14",width:"14"})])])])])]))}}),_n={},wn={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 En(o,e){return t.openBlock(),t.createElementBlock("svg",wn,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),t.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),t.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Vn=I(_n,[["render",En]]),Cn={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},vn={class:"flex w-full mb-[12px] items-center gap-x-2"},Bn={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},Sn={class1:"ml-auto"},Nn={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"},Fn={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},An={class:"relative"},Mn={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"},$n={key:0},Je=t.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:e}){const s=o,n=t.inject("form"),l=t.computed(()=>n.value.formId),r=t.ref(!1),a=t.ref(0),i=e,u=t.ref(!1),c=t.ref({}),d=t.ref([]),h=t.ref(""),p=t.computed(()=>Array.isArray(d.value)?d.value.filter(f=>f.ext==="jpg"||f.ext==="png").map(f=>f?.file_path):[]),w=t.computed(()=>h.value===""?d.value:d.value.filter(f=>f?.uploaded_name?.includes(h.value))),V=f=>{const g=p.value.findIndex(U=>U===f.item.file_path);g!==-1&&(r.value=!0,a.value=g)},$=async()=>{try{const f=await fetch(`${s.prefix}/widget/file/${l.value}`).then(g=>g.json());d.value=f?.rows}catch(f){console.error(f)}},F=async f=>{await Promise.all(Array.from(f.target.files).map(async g=>{const U=new FormData;U.append("file",g);try{const A=`${s.prefix}/widget/file/${l.value}`;return await fetch(A,{method:"POST",body:U}),i("update","file-list"),g}catch(A){return console.error(A),null}})),await $()},O=f=>{const g={...f};return f.cancel||(g.cancel=()=>{u.value=!1}),f.updateListOnConfirm&&(g.confirm=async()=>{await f.confirm(),u.value=!1,$()}),g},E=f=>{c.value=O(f),u.value=!0};return t.watch(l,f=>{f&&$()}),t.onMounted(()=>{l.value&&$()}),(f,g)=>{const U=t.resolveComponent("Lightbox"),A=t.resolveComponent("MessageBox");return t.openBlock(),t.createElementBlock("div",Cn,[t.createElementVNode("div",vn,[t.createElementVNode("h2",Bn," Файлів: "+t.toDisplayString(d.value?.length),1),t.createElementVNode("div",Sn,[t.createElementVNode("label",null,[t.createElementVNode("input",{type:"file",class:"hidden",onChange:g[0]||(g[0]=v=>F(v))},null,32),t.createElementVNode("div",Nn,[t.createVNode(Vn,{height:"16",width:"16"})])])])]),d.value?.length>4?(t.openBlock(),t.createElementBlock("div",Fn,[t.createElementVNode("div",null,[t.createElementVNode("div",An,[g[8]||(g[8]=t.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[t.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"},[t.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),t.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),t.withDirectives(t.createElementVNode("input",{type:"text","onUpdate:modelValue":g[1]||(g[1]=v=>h.value=v),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),[[t.vModelText,h.value,void 0,{trim:!0}]])])])])):t.createCommentVNode("",!0),d.value?.length?(t.openBlock(),t.createElementBlock("div",Mn,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(w.value,(v,j)=>(t.openBlock(),t.createBlock(xn,{key:j,prefix:f.prefix,item:v,index:j,onUpdate:g[2]||(g[2]=G=>f.$emit("update","file-list")),onOpenModal:g[3]||(g[3]=G=>E(G)),onOpenLightbox:g[4]||(g[4]=G=>V(G))},null,8,["prefix","item","index"]))),128)),w.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",$n,g[9]||(g[9]=[t.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):t.createCommentVNode("",!0),t.createVNode(U,{modelValue:r.value,"onUpdate:modelValue":g[5]||(g[5]=v=>r.value=v),startIndex:a.value,"onUpdate:index":g[6]||(g[6]=v=>a.value=v),images:p.value},null,8,["modelValue","startIndex","images"]),t.createVNode(A,t.mergeProps({modelValue:u.value,"onUpdate:modelValue":g[7]||(g[7]=v=>u.value=v),onConfirm:c.value.confirm},c.value),null,16,["modelValue","onConfirm"])])}}}),Dn={class:"flex items-center justify-between"},In={class:"text-[16px] text-gray-900 font-medium"},Ln={class:"grid gap-3"},Tn=I(t.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(o){const e=o,s=t.ref(e.isOpen);return t.watch(()=>e.isOpen,n=>{s.value=n}),(n,l)=>(t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",Dn,[t.createElementVNode("p",In,t.toDisplayString(o.title),1),t.createVNode(Ae,{modelValue:s.value,"onUpdate:modelValue":l[0]||(l[0]=r=>s.value=r),style:t.normalizeStyle(o.style)},null,8,["modelValue","style"])]),t.createVNode(t.Transition,{name:"slide-fade"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",Ln,[t.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[t.vShow,s.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),On={class:"text-[16px] text-gray-900 font-medium"},Rn={class:"grid gap-3"},zn=I(t.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(o){const e=o,s=t.ref(e.isOpen);return t.watch(()=>e.isOpen,n=>{s.value=n}),(n,l)=>(t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("button",{type:"button",onClick:l[0]||(l[0]=r=>s.value=!s.value),class:"flex items-center gap-2"},[t.createVNode(t.unref(ts),{class:t.normalizeClass(["h-4 w-4 duration-300",[s.value?"-rotate-180":""]])},null,8,["class"]),t.createElementVNode("span",On,t.toDisplayString(o.title),1)]),t.createVNode(t.Transition,{name:"slide-fade"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",Rn,[t.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[t.vShow,s.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),jn={class:"flex items-center justify-between"},Un={switcher:Tn,accordion:zn,default:t.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(o){return(e,s)=>(t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",jn,[t.createElementVNode("p",null,t.toDisplayString(o.title),1)]),t.renderSlot(e.$slots,"default")]))}})},Y={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Pn=(o,e)=>String(o)===String(e),Hn=(o,e)=>String(o)!==String(e),qn=(o,e)=>o>e,Gn=(o,e)=>o>=e,Kn=(o,e)=>o<e,Zn=(o,e)=>o<=e,Yn=(o,e)=>Array.isArray(e)&&e.length===2?o>=e[0]&&o<=e[1]:!1,Jn=(o,e)=>String(o).startsWith(String(e)),Wn=(o,e)=>String(o).endsWith(String(e)),Xn=(o,e)=>String(o).includes(String(e)),Qn=(o,e)=>Array.isArray(e)?e.includes(o):!1,el=(o,e)=>Array.isArray(e)?!e.includes(o):!0,We=(o,e)=>{if(!e)return!0;switch(e?.[1]){case Y.Equal:return Pn(o,e?.[2]);case Y.Inequal:return Hn(o,e?.[2]);case Y.Higer:return qn(o,e?.[2]);case Y.HigerOrEqual:return Gn(o,e?.[2]);case Y.Lower:return Kn(o,e?.[2]);case Y.LowerOrEqual:return Zn(o,e?.[2]);case Y.Between:return Yn(o,e?.[2]);case Y.StartWith:return Jn(o,e?.[2]);case Y.EndWith:return Wn(o,e?.[2]);case Y.Contain:return Xn(o,e?.[2]);case Y.In:return Qn(o,e?.[2]);case Y.NotIn:return el(o,e?.[2]);default:return!0}},Xe=t.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 e=o,s=t.inject("formValues",{default:{}}),n=t.inject("form"),l=t.computed(()=>e.schema?.filter(a=>{const i=a?.conditions;if(!i)return!0;const u=Array.isArray(i)?i[0]:i,c=s?.value?.[u];return We(c,i)})),r=t.computed(()=>Un[e.view]);return(a,i)=>o.schema?.length?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.value),{key:0,title:o.title,style:t.normalizeStyle(o.style)},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,u=>(t.openBlock(),t.createBlock(ot,t.mergeProps({key:u.name},{ref_for:!0},u,{item:u,modelValue:t.unref(s)[u.name],"onUpdate:modelValue":c=>t.unref(s)[u.name]=c,style:o.style,error:t.unref(n)?.errors?.[u.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):t.createCommentVNode("",!0)}}),tl={class:"relative"},sl={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},nl={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"},ll={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},rl={class:"font-medium text-gray-800 dark:text-[#ffffff]"},al={class:"p-4 mim-h-0 h-full overflow-auto"},Qe=t.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(o,{emit:e}){const s=o,n=e,l=t.ref(s.schema),r=t.ref(s.defaultValue?JSON.parse(JSON.stringify(s.defaultValue)):{}),a=t.ref({}),i=t.ref(),u=t.ref(s.mode);async function c(){const h=a.value.validate();if(h){W.notify({type:"warning",title:"Помилка валідації",message:Object.entries(h).map(([p,w])=>`${p}: ${w}`).join(`
|
|
2
|
-
`)});return}if(i.value)try{const p=await fetch(`/api/table/${i.value}`,{method:u.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r.value)});if(p.ok)await p.json(),W.notify({type:"success",title:"Успішно",message:`Дані успішно ${u.value==="add"?"збережено":"оновлено"}`}),n("save",r.value);else if(p.status===400){const w=await p.json().catch(()=>({}));W.notify({type:"warning",title:"Помилка валідації",message:w.message||"Некоректні дані (400)"})}else p.status===500?W.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):W.notify({type:"error",title:"Помилка",message:`Статус: ${p.status}`})}catch(p){W.notify({type:"error",title:"Помилка з’єднання",message:p.message||"Не вдалося виконати запит"})}}function d(){n("close")}return t.onMounted(async()=>{if(s.form){const h=await fetch(`/api/template/form/${s.form}`).then(p=>p.json());l.value=h.schema,i.value=h.token}else if(s.token){i.value=s.token;const h=await fetch(`/api/form/${i.value}`).then(p=>p.json());l.value=h.schema,h.data?r.value=h.data:u.value="add"}}),(h,p)=>(t.openBlock(),t.createElementBlock("div",tl,[t.createElementVNode("div",sl,[t.createElementVNode("div",nl,[t.createElementVNode("div",ll,[t.createElementVNode("h3",rl,t.toDisplayString(u.value==="add"?"Додати":"Змінити"),1),t.createElementVNode("button",{onClick:d,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"},p[2]||(p[2]=[t.createElementVNode("span",{class:"sr-only"},"Close",-1),t.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"},[t.createElementVNode("path",{d:"M18 6 6 18"}),t.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),t.createElementVNode("div",al,[l.value?(t.openBlock(),t.createBlock(pe,{key:0,schema:l.value,values:r.value,"onUpdate:values":p[0]||(p[0]=w=>r.value=w),form:a.value,"onUpdate:form":p[1]||(p[1]=w=>a.value=w)},null,8,["schema","values","form"])):t.createCommentVNode("",!0)]),t.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"},[t.createElementVNode("button",{type:"button",onClick:d,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"}," Скасувати "),t.createElementVNode("button",{onClick:c,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])])])]))}}),De=(o={mode:"edit",schema:null})=>new Promise(e=>{const{close:s}=W.modal({title:o.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Qe,contentProps:{...o,onClose:()=>{e(null),s()},onSave:n=>{e(n),s()}}})}),ol=["aria-expanded","data-focus"],il={class:"flex items-center"},ul=["title"],dl=["onClick"],cl=["title"],pl={key:2,class:"text-gray-500 truncate"},hl={class:"flex-1 min-w-[2px]"},ml=["placeholder"],fl={class:"flex items-center shrink-0"},gl=["disabled"],kl=["disabled"],bl={key:0,class:"absolute z-10 w-full mt-2 rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]",role:"listbox"},yl=["aria-disabled","onClick"],xl={key:1,class:"px-3 py-2 text-center text-gray-500"},_l=["disabled"],et=t.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:{},options:{default:()=>[]},api:{},maxHeight:{default:400},add:{},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},emits:["change","update:modelValue"],setup(o,{emit:e}){const s=o,n=e,l=t.computed(()=>s.multiple),r=t.computed(()=>s.disabled);le(s.style);const a=t.computed({get:()=>s.modelValue,set:b=>n("update:modelValue",b)});!a.value&&s.defaultValue&&(a.value=s.defaultValue);const i=t.ref(null),u=t.ref(null),c=t.ref(null),d=t.ref(!1),h=t.ref(!1),p=t.ref(null),w=t.ref([]),V=t.ref(-1),$=t.ref([]),F=t.ref(""),O=t.ref(null),E=t.ref([]),f=t.computed(()=>{if(!E.value.length)return[];const b=new Map(w.value.map(y=>[y.id?.toString(),y]));return E.value.map(y=>b.get(y?.toString())).filter(y=>!!y)}),g=t.computed(()=>s.placeholder||"Select..."),U=t.computed(()=>l.value?!E.value.length&&F.value==="":!p.value?.text&&F.value===""),A=t.computed(()=>r.value?!1:l.value?E.value.length>0:!!a.value),v=b=>l.value?E.value.some(y=>y?.toString()===b?.toString()):a.value?.toString()===b?.toString(),j=t.computed(()=>{let b=w.value??[];if(F.value.trim()!==""){const y=F.value.toLowerCase();b=b.filter(M=>M.text?.toLowerCase?.().includes(y))}if(l.value&&E.value.length){const y=new Set(E.value.map(M=>M?.toString()));b=b.filter(M=>!y.has(M.id?.toString()))}return b}),G=async b=>{if(!s.data)return[];try{const y=s.api?s.api:`/suggest/${s.data}`,M="?json=1",q=b?`&val=${encodeURIComponent(b)}`:"";return(await fetch(y.concat(M,q)).then(fe=>fe.json())).data??[]}catch{return[]}},J=async()=>{s.options?.length?w.value=[...s.options]:s.data&&(w.value=await G(F.value))},me=async b=>{if(b==null)return null;const y=w.value?.find(q=>q?.id?.toString()===String(b));return y||((await G(String(b)))?.[0]??null)},_e=async b=>{const y=new Set(w.value.map(q=>q.id?.toString())),M=b.filter(q=>!y.has(q?.toString()));M.length&&await M.reduce(async(q,ce)=>{await q;const fe=await me(ce);fe&&w.value.push(fe)},Promise.resolve())},B=async()=>{r.value||(d.value=!0,await J(),await t.nextTick(()=>{O.value?.focus(),j.value.length?V.value=0:V.value=-1}))},_=()=>{d.value=!1,V.value=-1},N=async b=>{if(r.value)return;!d.value?await B():_()},z=async()=>{d.value?O.value?.focus():await B()},Z=()=>{l.value?(E.value=[],a.value=[],n("change",[])):(p.value=null,a.value=null,n("change",null)),F.value="",t.nextTick(()=>O.value?.focus())},oe=b=>{l.value&&(E.value=E.value.filter(y=>y?.toString()!==b?.toString()),a.value=[...E.value],n("change",a.value),t.nextTick(()=>O.value?.focus()))},se=b=>{l.value?(v(b.id)||(E.value=[...E.value,b.id],a.value=[...E.value],n("change",a.value)),F.value="",t.nextTick(()=>{O.value?.focus(),V.value=Math.min(V.value,j.value.length-1)})):(p.value=b,a.value=b.id,n("change",a.value),F.value="",_())},m=b=>{v(b.id)||se(b)},k=(b,y)=>{if(!b||!y)return;const M=b.offsetTop,q=M+b.offsetHeight,ce=y.scrollTop,fe=ce+y.clientHeight;let Re=y.scrollTop;M<ce?Re=M-80:q>fe&&(Re=q-y.clientHeight+4);const ao=y;ao.scrollTop=Re},D=async b=>{r.value||!d.value&&(b.key==="ArrowDown"||b.key==="ArrowUp")&&(b.preventDefault(),await B())},R=b=>{if(!d.value)return;const{key:y}=b;if(y==="ArrowDown")b.preventDefault(),V.value+1<j.value.length&&(V.value+=1,k($.value[V.value],c.value));else if(y==="ArrowUp")b.preventDefault(),V.value>0&&(V.value-=1,k($.value[V.value],c.value));else if(y==="Enter"){b.preventDefault();const M=j.value[V.value];M&&se(M)}else y==="Escape"?(b.preventDefault(),_()):y==="Backspace"?l.value&&F.value===""&&E.value.length&&(E.value=E.value.slice(0,-1),a.value=[...E.value],n("change",a.value)):y==="Home"?(V.value=0,k($.value[0],c.value)):y==="End"?(V.value=j.value.length-1,k($.value[V.value],c.value)):y==="Tab"&&_()},X=()=>{r.value||(h.value=!0)},we=()=>{h.value=!1,F.value=""},ne=b=>{b.key==="Escape"&&d.value&&_()},ie=b=>{i.value&&(i.value.contains(b.target)||_())},ue=b=>{d.value&&c.value&&!c.value.contains(b.target)&&_()};t.watch(()=>s.options,b=>{b?.length&&(w.value=[...b])},{immediate:!0});const de=async()=>{if(l.value)Array.isArray(a.value)?E.value=[...a.value]:(E.value=a.value==null?[]:[a.value],a.value=[...E.value]),!s.options?.length&&s.data&&await _e(E.value);else{if(Array.isArray(a.value)){const b=a.value[0]??null;a.value=b??null}p.value=await me(a.value)}};t.watch(a,()=>{de()}),t.onMounted(async()=>{addEventListener("keydown",ne),addEventListener("scroll",ue,!0),document.addEventListener("click",ie,!0),s.options?.length?w.value=[...s.options]:s.data&&(w.value=await G("")),await de()}),t.onUnmounted(()=>{removeEventListener("keydown",ne),removeEventListener("scroll",ue,!0),document.removeEventListener("click",ie,!0)});async function ro(){if(!s.add)return;const b=await De({form:s.add.form,mode:"add"});b&&(await fetch(`/api/table/${s.add.token}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(b)}).then(y=>y.json()),!s.options?.length&&s.data&&(w.value=await G(F.value)))}return(b,y)=>(t.openBlock(),t.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:y[2]||(y[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",{class:t.normalizeClass(["relative w-full font-sans",s.customClass])},[y[7]||(y[7]=t.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),y[8]||(y[8]=t.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),t.createElementVNode("div",{class:t.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",d.value||h.value?"border-blue-500 ring-1 ring-blue-500":"",r.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":d.value,"aria-haspopup":"listbox",onKeydown:D,onClick:z,"data-focus":d.value||h.value?"true":"false"},[t.createElementVNode("div",{class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"triggerRef",ref:u},[l.value&&E.value.length?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(f.value,M=>(t.openBlock(),t.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border",key:M.id},[t.createElementVNode("div",il,[M?.color?(t.openBlock(),t.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5",style:t.normalizeStyle({backgroundColor:M?.color})},null,4)):t.createCommentVNode("",!0),t.createElementVNode("div",{class:"truncate text-gray-900 overflow-hidden",title:M.text},t.toDisplayString(M.text),9,ul)]),t.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:t.withModifiers(q=>oe(M.id),["stop"])},y[3]||(y[3]=[t.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"},[t.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,dl)]))),128)):!l.value&&!h.value&&p.value?.text&&F.value===""?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["truncate text-gray-900"]),title:p.value.text},[p.value?.color?(t.openBlock(),t.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:t.normalizeStyle({backgroundColor:p.value?.color})},null,4)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:t.normalizeClass({"pl-5":p.value?.color})},t.toDisplayString(p.value.text),3)],8,cl)):t.createCommentVNode("",!0),U.value?(t.openBlock(),t.createElementBlock("div",pl,t.toDisplayString(g.value),1)):t.createCommentVNode("",!0),t.createElementVNode("div",hl,[!r.value&&b.search?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputRef",ref:O,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&&E.value.length?" ":null)||(h.value&&!F.value?.length?p.value?.text:" "),"onUpdate:modelValue":y[0]||(y[0]=M=>F.value=M),onFocus:X,onBlur:we,onKeydown:R},null,40,ml)),[[t.vModelText,F.value]]):t.createCommentVNode("",!0)])],512),t.createElementVNode("div",fl,[A.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:r.value,onClick:t.withModifiers(Z,["stop"])},y[4]||(y[4]=[t.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[t.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,gl)):t.createCommentVNode("",!0),y[6]||(y[6]=t.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),t.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:r.value,onClick:y[1]||(y[1]=t.withModifiers(M=>N(),["stop"]))},y[5]||(y[5]=[t.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[t.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,ol),d.value?(t.openBlock(),t.createElementBlock("div",bl,[t.createElementVNode("div",{class:"max-h-[300px] overflow-y-auto py-1",ref_key:"listRef",ref:c},[j.value.length?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(j.value,(M,q)=>(t.openBlock(),t.createElementBlock("div",{key:M.id,ref_for:!0,ref:ce=>$.value[q]=ce,class:t.normalizeClass(["flex px-3 py-2 cursor-default select-none hover:bg-blue-300",V.value===q?"bg-blue-300":"",v(M.id)?"text-white bg-blue-500":"text-gray-900 bg-white"]),"aria-disabled":v(M.id)?"true":"false",role:"option",tabindex:"-1",onClick:ce=>m(M)},[M?.color?(t.openBlock(),t.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:t.normalizeStyle({backgroundColor:M?.color})},null,4)):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["leading-[19px]",V.value===M.id?"text-white":"",(V.value===q,"")])},t.toDisplayString(M.text),3)],10,yl))),128)):(t.openBlock(),t.createElementBlock("div",xl," No options "))],512)])):t.createCommentVNode("",!0)],2),s.add?(t.openBlock(),t.createElementBlock("button",{key:0,onClick:ro,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:r.value,type:"button"},[t.createVNode(Ee,{width:"16",height:"16"}),y[9]||(y[9]=t.createElementVNode("span",null,"Додати",-1))],8,_l)):t.createCommentVNode("",!0)],512))}}),wl=["placeholder","disabled"],tt=t.defineComponent({__name:"vs-input-textarea",props:t.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,{inputClass:s}=le(e.style),n=t.useModel(o,"modelValue");return(l,r)=>t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{"onUpdate:modelValue":r[0]||(r[0]=a=>n.value=a),placeholder:l.placeholder,disabled:l.disabled,row:"2",class:t.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[t.unref(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,wl)),[[t.vModelText,n.value]])}}),El={},Vl={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 Cl(o,e){return t.openBlock(),t.createElementBlock("svg",Vl,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),t.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const vl=I(El,[["render",Cl]]),Bl={},Sl={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 Nl(o,e){return t.openBlock(),t.createElementBlock("svg",Sl,e[0]||(e[0]=[t.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),t.createElementVNode("path",{d:"M7 20V4"},null,-1),t.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),t.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const Fl=I(Bl,[["render",Nl]]),Al={},Ml={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 $l(o,e){return t.openBlock(),t.createElementBlock("svg",Ml,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),t.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),t.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Dl=I(Al,[["render",$l]]),Il={},Ll={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Tl(o,e){return t.openBlock(),t.createElementBlock("svg",Ll,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),t.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),t.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Ol=I(Il,[["render",Tl]]),Rl={},zl={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 jl(o,e){return t.openBlock(),t.createElementBlock("svg",zl,e[0]||(e[0]=[t.createStaticVNode('<circle cx="9" cy="12" r="1"></circle><circle cx="9" cy="5" r="1"></circle><circle cx="9" cy="19" r="1"></circle><circle cx="15" cy="12" r="1"></circle><circle cx="15" cy="5" r="1"></circle><circle cx="15" cy="19" r="1"></circle>',6)]))}const st=I(Rl,[["render",jl]]),Ul={},Pl={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Hl(o,e){return t.openBlock(),t.createElementBlock("svg",Pl,e[0]||(e[0]=[t.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 ql=I(Ul,[["render",Hl]]),Gl={},Kl={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 Zl(o,e){return t.openBlock(),t.createElementBlock("svg",Kl,e[0]||(e[0]=[t.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 Yl=I(Gl,[["render",Zl]]),Jl={class:"vs-datatable border rounded-xl w-full flex-grow"},Wl={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},Xl={class:"relative w-full"},Ql={class:"table-wrapper flex gap-2"},er={class:"vs-popover inline-block text-slate-700"},tr={class:"text-center"},sr={class:""},nr={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"},lr={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},rr={class:"text-sm items-center text-gray-800 flex gap-1"},ar={class:"w-full overflow-x-auto"},or={class:"w-full table-auto caption-bottom text-sm"},ir={class:"[&_tr]:border-b"},ur={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"},dr={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"},cr={key:0,colspan:"100%",class:"text-center"},pr={class:"w-full"},hr={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},mr=["onDragstart","onDragover","onDrop"],fr={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},gr={class:"flex items-center justify-center"},kr={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"},br={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},yr={class:"flex items-center justify-center gap-2"},xr=["onClick"],_r=["onClick"],wr={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},nt=t.defineComponent({__name:"vs-input-datatable",props:t.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,s=t.useModel(o,"modelValue"),n=t.ref({}),l=t.ref(""),r=t.computed(()=>{if(!l.value)return s.value??[];const B=l.value.toLowerCase();return s.value.filter(_=>e.colModel?.some(N=>{const z=_[N.key];return z?Array.isArray(z)?z.join(", ").toLowerCase().includes(B):String(z).toLowerCase().includes(B):!1}))}),a=t.ref(null),i=t.ref(null),u=t.ref(!1),c=t.ref(null),d=t.ref({top:0,left:0}),h=B=>{a.value=B},p=B=>{i.value=B},w=B=>{if(a.value===null||a.value===B){a.value=null,i.value=null;return}const _=[...s.value],[N]=_.splice(a.value,1);_.splice(B,0,N),s.value=_,a.value=null,i.value=null},V=B=>{const N=B.currentTarget.getBoundingClientRect();d.value={top:N.bottom+window.scrollY,left:N.left+window.scrollX},u.value=!u.value},$=()=>{c.value&&c.value.click()},F=B=>{const N=B.target.files?.[0];if(!N)return;const z=new FileReader;z.onload=Z=>{try{const oe=Z.target?.result;if(typeof oe=="string"){const se=JSON.parse(oe);Array.isArray(se)&&s.value.push(...se)}}catch(oe){console.error("Error parsing file:",oe)}},z.readAsText(N)},O=()=>{const B=JSON.stringify(s.value,null,2),_=new Blob([B],{type:"application/json"}),N=URL.createObjectURL(_),z=document.createElement("a");z.href=N,z.download="data.json",z.click(),URL.revokeObjectURL(N)};t.onMounted(async()=>{const B=e.colModel?.filter(_=>_.data);B?.length&&Promise.all(B.map(async _=>{n.value[_.key]=await fetch(`/api/suggest/${_.data}`).then(N=>N.json())}))});const E=t.ref(""),f=t.ref(!1);let g="edit",U=0;const A=t.ref({}),v=t.ref({});async function j(){E.value="Додати",f.value=!0,g="add",A.value={}}function G(B,_){return n.value[_.key]&&B[_.key]?n.value[_.key].find(N=>N.id.toString()===B[_.key].toString())?.text??B[_.key]:B[_.key]||"-"}async function J(B,_){E.value="Редагувати",f.value=!0,g="edit",U=_,A.value={...B}}function me(){const B=v.value.validate();if(B){W.notify({type:"warning",title:"Помилка валідації",message:Object.entries(B).map(([_,N])=>`${_}: ${N}`).join(`
|
|
3
|
-
`)});return}g==="add"?Array.isArray(s.value)?s.value=[...s.value,A.value]:s.value=[A.value]:s.value=s.value.map((_,N)=>N===U?A.value:_),f.value=!1}function _e(B){s.value=s.value.filter((_,N)=>N!==B)}return(B,_)=>(t.openBlock(),t.createElementBlock("div",Jl,[t.createElementVNode("div",Wl,[t.createElementVNode("div",Xl,[t.createVNode(vl,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),t.withDirectives(t.createElementVNode("input",{type:"text","onUpdate:modelValue":_[0]||(_[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),[[t.vModelText,l.value]])]),t.createElementVNode("div",Ql,[t.createElementVNode("input",{ref_key:"fileInput",ref:c,onChange:F,class:"hidden",accept:".json",type:"file"},null,544),t.createElementVNode("div",er,[t.createElementVNode("div",tr,[t.createElementVNode("div",sr,[t.createElementVNode("button",{onClick:V,class:"bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[t.createVNode(Fl,{height:"16",width:"16"})])])])])]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[u.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:t.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:d.value.top+"px",left:d.value.left+"px"}])},[t.createElementVNode("div",nr,[t.createElementVNode("div",lr,[t.createElementVNode("button",{onClick:$,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[t.createVNode(Dl,{class:"text-black",width:"14",height:"14"}),_[4]||(_[4]=t.createTextVNode(" Імпортувати "))]),t.createElementVNode("button",{onClick:O,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[t.createElementVNode("span",rr,[t.createVNode(Ol,{class:"text-black",width:"14",height:"14"}),_[5]||(_[5]=t.createTextVNode(" Експортувати "))])])])])],4)):t.createCommentVNode("",!0)])),t.createElementVNode("button",{onClick:j,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"},[t.createVNode(Ee),_[6]||(_[6]=t.createTextVNode(" Додати "))])]),t.createElementVNode("div",ar,[t.createElementVNode("table",or,[t.createElementVNode("thead",ir,[t.createElementVNode("tr",ur,[t.createElementVNode("th",dr,[t.createVNode(st,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(B.colModel,N=>(t.openBlock(),t.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]"},t.toDisplayString(N.ua||N.label),1))),128)),_[7]||(_[7]=t.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))])]),t.createElementVNode("tbody",{class:t.normalizeClass({"[&_tr:last-child]:border-0":!i.value})},[r.value.length===0?(t.openBlock(),t.createElementBlock("td",cr,[t.createElementVNode("div",pr,[t.createElementVNode("div",hr,[t.createVNode(ql,{class:"w-48 mx-auto"}),_[8]||(_[8]=t.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[t.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),t.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(N,z)=>(t.openBlock(),t.createElementBlock("tr",{key:N.id,class:t.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":a.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:Z=>h(z),onDragover:t.withModifiers(Z=>p(z),["prevent"]),onDrop:Z=>w(z)},[t.createElementVNode("td",fr,[t.createElementVNode("div",gr,[t.createVNode(st,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(B.colModel,Z=>(t.openBlock(),t.createElementBlock("td",{key:Z.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[t.createElementVNode("div",kr,t.toDisplayString(G(N,Z)),1)]))),128)),t.createElementVNode("td",br,[t.createElementVNode("div",yr,[t.createElementVNode("button",{onClick:Z=>J(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"},[t.createVNode(Yl,{width:"24",height:"24",class:"w-3 h-3"})],8,xr),t.createElementVNode("button",{onClick:Z=>_e(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"},[t.createVNode(Ve,{width:"24",height:"24",class:"w-3 h-3"})],8,_r)])])],42,mr))),128))],2)])]),t.createVNode(t.unref(W.VsModal),{visible:f.value,title:E.value,size:"lg"},{default:t.withCtx(()=>[t.createVNode(pe,{schema:e.colModel,values:A.value,"onUpdate:values":_[1]||(_[1]=N=>A.value=N),form:v.value,"onUpdate:form":_[2]||(_[2]=N=>v.value=N)},null,8,["schema","values","form"]),t.createElementVNode("div",wr,[t.createElementVNode("button",{type:"button",onClick:_[3]||(_[3]=N=>f.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),t.createElementVNode("button",{onClick:me,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"])]))}}),Er={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 Vr(o){return o?o.type==="FeatureCollection"||o.type==="Feature"?o:o.geom?{type:"Feature",geometry:{type:o.geom.type,coordinates:o.geom.coordinates},properties:{}}:o.type&&o.coordinates?{type:"Feature",geometry:o,properties:{}}:null:null}const Cr={},vr={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 Br(o,e){return t.openBlock(),t.createElementBlock("svg",vr,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),t.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 Sr=I(Cr,[["render",Br]]),Nr={},Fr={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 Ar(o,e){return t.openBlock(),t.createElementBlock("svg",Fr,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),t.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),t.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const Mr=I(Nr,[["render",Ar]]),$r={},Dr={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 Ir(o,e){return t.openBlock(),t.createElementBlock("svg",Dr,e[0]||(e[0]=[t.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 Lr=I($r,[["render",Ir]]),Tr={},Or={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 Rr(o,e){return t.openBlock(),t.createElementBlock("svg",Or,e[0]||(e[0]=[t.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 zr=I(Tr,[["render",Rr]]),jr={},Ur={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 Pr(o,e){return t.openBlock(),t.createElementBlock("svg",Ur,e[0]||(e[0]=[t.createElementVNode("title",null,null,-1),t.createElementVNode("desc",null,null,-1),t.createElementVNode("defs",null,null,-1),t.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[t.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[t.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[t.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 Hr=I(jr,[["render",Pr]]),qr={class:"form-geom__search"},Gr={class:"map-search__input"},Kr={class:"flex flex-nowrap relative"},Zr={class:"form-autocomplete relative min-w-[6rem] vsTailwind map-search__select hidden"},Yr={class:"flex items-center w-full"},Jr={class:"max-w-[90%] truncate"},Wr={key:0,class:"absolute z-[3100] mt-0.5 left-0 right-0"},Xr={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"},Qr={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"},ea=["onClick"],ta={class:"flex justify-between items-center w-full"},sa={class:"flex items-center"},na={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"},la={class:"relative w-full"},ra={class:"vs-form-text relative bg-white rounded-lg"},aa={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"},oa={key:0},ia=["onClick"],ua={key:1,class:"px-3 py-2 text-xs text-gray-500"},da={key:2,class:"px-3 py-2 text-xs text-gray-400"},ca=t.defineComponent({__name:"map-search",props:{placeholder:{default:"50, 30"}},emits:["goToCoordinates"],setup(o,{emit:e}){const s=e,n=t.ref(!1),l=t.ref("coordinates"),r=t.ref(""),a=t.ref([]),i=t.ref(!1),u=t.ref(!1);let c;const d=[{value:"coordinates",label:"Пошук по кординатам"},{value:"atu",label:"АТУ"},{value:"address",label:"Адресса"},{value:"search_here",label:"Пошук HERE"}],h=t.computed(()=>d.find(E=>E.value===l.value)?.label??"АТУ");function p(E){l.value=E.value,n.value=!1,r.value="",r.value&&$()}function w(E){E.target.closest(".map-search__input")||(n.value=!1)}t.onMounted(()=>document.addEventListener("click",w)),t.onUnmounted(()=>document.removeEventListener("click",w));async function V(E){let f;l.value==="atu"?f="/api/suggest/atu.nsdi.ato_level":l.value==="address"?f="/api/suggest/map.address_id":l.value==="search_here"&&(f="/api/gis-url-proxy");const g=new URL(f||"");return l.value==="search_here"?g.searchParams.set("searchtext",E):(l.value==="atu"||l.value==="address")&&g.searchParams.set("key",E),g.searchParams.set("limit","20"),g.searchParams.set("q",E),(await fetch(g.toString())).json()}function $(){if(i.value=!0,u.value=!0,l.value==="coordinates"){const E=r.value.trim().split(",");if(E.length===2){const f=parseFloat(E[0]),g=parseFloat(E[1]);!Number.isNaN(f)&&!Number.isNaN(g)&&s("goToCoordinates",[f,g])}return}c&&window.clearTimeout(c),c=window.setTimeout(async()=>{const E=r.value.trim();if(!E){a.value=[],u.value=!1;return}try{const f=await V(E);a.value=Array.isArray(f.features)?f.features:[]}catch{a.value=[]}finally{u.value=!1}},300)}function F(){r.value="",a.value=[],i.value=!1,u.value=!1}function O(E){s("goToCoordinates",E),i.value=!1,u.value=!1,a.value=[]}return(E,f)=>(t.openBlock(),t.createElementBlock("div",qr,[t.createElementVNode("div",Gr,[t.createElementVNode("div",Kr,[t.createElementVNode("div",Zr,[t.createElementVNode("button",{type:"button",onClick:f[0]||(f[0]=g=>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"},[t.createElementVNode("div",Yr,[t.createElementVNode("span",Jr,t.toDisplayString(h.value),1)]),f[3]||(f[3]=t.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"},[t.createElementVNode("path",{d:"M6 9l6 6 6-6","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1))]),n.value?(t.openBlock(),t.createElementBlock("div",Wr,[t.createElementVNode("div",Xr,[t.createElementVNode("div",Qr,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(d,g=>t.createElementVNode("div",{onClick:U=>p(g),key:g.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"},[t.createElementVNode("div",ta,[t.createElementVNode("div",sa,[t.createElementVNode("div",null,t.toDisplayString(g.label),1)]),g.value===l.value?(t.openBlock(),t.createElementBlock("svg",na,f[4]||(f[4]=[t.createElementVNode("polyline",{points:"20 6 9 17 4 12"},null,-1)]))):t.createCommentVNode("",!0)])],8,ea)),64))])])])):t.createCommentVNode("",!0)]),t.createElementVNode("div",la,[t.createElementVNode("div",ra,[f[6]||(f[6]=t.createElementVNode("i",{class:"absolute bottom-1/2 translate-y-1/2 left-3 text-gray-500"},[t.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},[t.createElementVNode("circle",{cx:"11",cy:"11",r:"8","stroke-width":"2"}),t.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65","stroke-width":"2"})])],-1)),t.withDirectives(t.createElementVNode("input",{type:"text","onUpdate:modelValue":f[1]||(f[1]=g=>r.value=g),onInput:$,onFocus:f[2]||(f[2]=g=>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),[[t.vModelText,r.value]]),r.value?(t.openBlock(),t.createElementBlock("button",{key:0,onClick:F,class:"absolute right-2 bottom-1/2 translate-y-1/2 text-gray-500 hover:text-red-500","aria-label":"Очистити",type:"button"},f[5]||(f[5]=[t.createElementVNode("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]))):t.createCommentVNode("",!0),i.value&&l.value!=="coordinates"?(t.openBlock(),t.createElementBlock("div",aa,[a.value.length?(t.openBlock(),t.createElementBlock("ul",oa,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,g=>(t.openBlock(),t.createElementBlock("li",{key:g.properties.place_id,onClick:U=>O(g),class:"px-3 py-2 text-sm cursor-pointer hover:bg-gray-100"},t.toDisplayString(g.properties.display_name),9,ia))),128))])):u.value?(t.openBlock(),t.createElementBlock("div",ua,"Шукаю…")):(t.openBlock(),t.createElementBlock("div",da,"Нічого не знайдено"))])):t.createCommentVNode("",!0)])])])])]))}}),pa={class:"bg-white/95 p-2 rounded-xl shadow border border-gray-200"},ha={class:"flex gap-2"},ma=["onClick","title"],fa=["src"],ga=t.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(o,{emit:e}){const s=o,n=t.ref(Object.keys(s.basemaps)[0]),l=e;function r(a){l("onLayerChange",a),n.value=a}return(a,i)=>(t.openBlock(),t.createElementBlock("div",pa,[t.createElementVNode("div",ha,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.basemaps,(u,c)=>(t.openBlock(),t.createElementBlock("div",{key:c,class:t.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":n.value===c}]),onClick:d=>r(c),title:u.name||c,role:"button",tabindex:"0"},[t.createElementVNode("img",{src:u.preview,alt:"",class:"w-14 h-14 object-cover"},null,8,fa)],10,ma))),128))])]))}}),ka={class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},ba={class:"form-geom__panel flex gap-1 items-start mt-2"},ya={class:"flex items-center gap-1"},xa=["disabled"],_a={class:"absolute top-4 right-4 z-[1000]"},wa={class:"flex flex-col gap-[2px]"},Ea=["aria-pressed"],Va=["aria-pressed"],Ca=["aria-pressed"],va=["aria-pressed"],Ba={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"},Sa={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},Na={class:"mr-auto"},Fa={class:"font-bold"},Aa={class:"flex items-center"},Ma={class:"text-xs mr-2"},$a={key:0,class:"text-xs"},Da={key:1,class:"text-xs"},lt=I(t.defineComponent({__name:"vs-input-map",props:{tools:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(o,{emit:e}){const s=t.getCurrentInstance(),n=o,l=e,r=t.ref(null);let a,i,u;const c=t.ref(null),d=t.ref(null),h=t.ref(6),p=t.ref(0),w=t.ref(s?.appContext.config.globalProperties.$settings?.center||[50,30]),V=t.ref(null),$=oe();let F;const O=t.ref("topo100");function E(){return new Promise((m,k)=>{window.L&&window.L.Draw&&m(0);const D=X=>{if(Array.from(document.styleSheets).some(ie=>ie?.href?.includes(X)))return;const ne=document.createElement("link");ne.rel="stylesheet",ne.href=X,document.head.appendChild(ne)},R=X=>new Promise((we,ne)=>{const ie=Array.from(document.scripts).find(de=>de.src===X);if(ie){ie.addEventListener("load",()=>we()),ie.addEventListener("error",de=>ne(de));return}const ue=document.createElement("script");ue.src=X,ue.async=!0,ue.onload=()=>we(),ue.onerror=de=>ne(de),document.body.appendChild(ue)});D("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),D("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),R("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>R("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js")).then(()=>m(0)).catch(k)})}function f(){const m=i.toGeoJSON();let k=null;m?.features?.length&&(k=m.features[0].geometry),l("update:modelValue",k),p.value=i.getLayers().length}function g(m=30){const k=i.getLayers();if(!k.length)return;const R=L.featureGroup(k).getBounds();R&&R.isValid()&&a.fitBounds(R,{padding:[m,m]})}function U(){c.value?.click()}const A=t.ref("");function v(m){return m instanceof L.Circle?"Circle":m instanceof L.Rectangle?"Rectangle":m instanceof L.Polygon&&!(m instanceof L.Rectangle)?"Polygon":m instanceof L.Polyline&&!(m instanceof L.Polygon)?"Polyline":m instanceof L.Marker?"Point":"Feature"}function j(m){if(m instanceof L.Circle){const k=m.getRadius();return Math.PI*(k*k)/1e6}if(m instanceof L.Polygon||m instanceof L.Rectangle)try{const k=m.getLatLngs(),D=Array.isArray(k[0])?k[0]:k,R=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea(D):0;return R?R/1e6:0}catch{return null}return null}function G(m){return m instanceof L.Circle?m.getLatLng():m.getBounds?m.getBounds().getCenter():m.getLatLng?m.getLatLng():a.getCenter()}function J(){const m=i.getLayers();if(!m.length){V.value=null,p.value=0;return}const k=m[m.length-1],D=v(k),R=G(k),X=j(k);V.value={type:D,center:R,areaKm2:X,layer:k},p.value=m.length}function me(){const m=V.value?.layer;m&&(m instanceof L.Circle&&m.getBounds?a.fitBounds(m.getBounds(),{padding:[30,30]}):m.getBounds?a.fitBounds(m.getBounds(),{padding:[30,30]}):m.getLatLng&&a.setView(m.getLatLng(),Math.max(h.value,14)))}function _e(){const m=V.value?.layer;m&&(i.removeLayer(m),f(),J())}t.onMounted(async()=>{await E(),L.drawLocal=Er,a=L.map(r.value,{zoomControl:!1}).setView(w.value,10),L.control.zoom({position:"bottomright"}).addTo(a),O.value=Object.keys($)[0],F=L.tileLayer($[O.value].url,{maxZoom:19,minZoom:6}).addTo(a),i=new L.FeatureGroup().addTo(a),a.on(L.Draw.Event.CREATED,D=>{const{layer:R}=D;i.clearLayers(),i.addLayer(R),f(),J(),g(),A.value=""}),a.on(L.Draw.Event.EDITED,()=>{f(),J(),g()}),a.on(L.Draw.Event.DELETED,()=>{f(),J(),g()});let m=!1;a.on("mousemove",D=>{m||(a.invalidateSize(),m=!0),d.value=D.latlng}),a.on("zoomend",()=>{h.value=a.getZoom()});const k=Vr(n.modelValue);if(k){const D=[];L.geoJSON(k).eachLayer(R=>D.push(R)),D.length&&i.addLayer(D[0]),f(),J(),g()}});function B(m){if(a){switch(u&&u.disable(),m){case"marker":u=new L.Draw.Marker(a);break;case"polyline":u=new L.Draw.Polyline(a);break;case"polygon":u=new L.Draw.Polygon(a);break;case"rectangle":u=new L.Draw.Rectangle(a);break;default:u=new L.Draw.Rectangle(a);break}u&&(u.enable(),A.value=m)}}function _(){const m=i.toGeoJSON(),k=new Blob([JSON.stringify(m,null,2)],{type:"application/json"}),D=URL.createObjectURL(k),R=document.createElement("a");R.href=D,R.download="data.geojson",R.click(),URL.revokeObjectURL(D)}function N(m){const k=m.target.files?.[0];if(!k)return;const D=new FileReader;D.onload=()=>{if(typeof D.result=="string")try{const R=JSON.parse(D.result);i.clearLayers(),R&&L.geoJSON({type:"Feature",geometry:R}).eachLayer(X=>{i.addLayer(X)}),f(),J(),g()}finally{m.target.value=""}},D.readAsText(k)}function z(m){a&&(F&&a.removeLayer(F),F=L.tileLayer($[m].url,{maxZoom:19,minZoom:6}).addTo(a),O.value=m)}function Z(m){const k=L.latLng(m[0],m[1]);a.setView(k,13)}t.watch(()=>n.modelValue,m=>{i.clearLayers(),m&&L.geoJSON({type:"Feature",geometry:m}).eachLayer(k=>{i.addLayer(k)}),p.value=i.getLayers().length,J(),g()});function oe(){return s?.appContext.config.globalProperties.$settings?.basemaps?s?.appContext.config.globalProperties.$settings?.basemaps.map((m,k)=>Object.assign(m,{key:`b${k}`,preview:m.preview||m.url.replace("{z}/{x}/{y}.png","13/4790/2762.png")})).reduce((m,k)=>({...m,[k.key]:k}),{}):{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 se=t.ref(!1);return t.watch(se,()=>{setTimeout(()=>{a.invalidateSize()},50)}),(m,k)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:se.value}])},[t.createElementVNode("div",{ref_key:"mapContainer",ref:r,class:"w-full h-full"},null,512),t.createElementVNode("div",ka,[t.createVNode(ca,{onGoToCoordinates:Z}),t.createElementVNode("div",ba,[t.createElementVNode("div",ya,[t.createElementVNode("button",{type:"button",class:"vs-btn-row",onClick:U},"Import"),t.createElementVNode("button",{type:"button",class:"vs-btn-row",onClick:_,disabled:p.value===0},"Export ",8,xa)]),t.createElementVNode("input",{ref_key:"importRef",ref:c,type:"file",onChange:N,accept:".json,.geojson",class:"hidden"},null,544)])]),t.createElementVNode("div",_a,[t.createElementVNode("div",wa,[t.createElementVNode("button",{class:t.normalizeClass(["vs-btn",{"vs-active":A.value==="marker"}]),"aria-pressed":A.value==="marker",title:"Point (P)","aria-label":"Draw point",onClick:k[0]||(k[0]=D=>B("marker"))},[t.createVNode(Sr)],10,Ea),t.createElementVNode("button",{class:t.normalizeClass(["vs-btn",{"vs-active":A.value==="polyline"}]),"aria-pressed":A.value==="polyline",title:"Line (L)","aria-label":"Draw polyline",onClick:k[1]||(k[1]=D=>B("polyline"))},[t.createVNode(Mr)],10,Va),t.createElementVNode("button",{class:t.normalizeClass(["vs-btn",{"vs-active":A.value==="polygon"}]),"aria-pressed":A.value==="polygon",title:"Polygon (G)","aria-label":"Draw polygon",onClick:k[2]||(k[2]=D=>B("polygon"))},[t.createVNode(Lr)],10,Ca),t.createElementVNode("button",{class:t.normalizeClass(["vs-btn",{"vs-active":A.value==="rectangle"}]),"aria-pressed":A.value==="rectangle",title:"Rectangle (R)","aria-label":"Draw rectangle",onClick:k[3]||(k[3]=D=>B("rectangle"))},[t.createVNode(zr)],10,va),t.createElementVNode("button",{class:"vs-btn mt-5",onClick:k[4]||(k[4]=D=>{se.value=!se.value}),title:"Full Screen","aria-label":"Full Screen"},[t.createVNode(Hr,{style:{width:"12px",height:"12px"}})])])]),t.createElementVNode("div",{class:t.normalizeClass(["absolute left-4 z-[1000]",V.value?"bottom-8":"bottom-4"])},[t.createVNode(ga,{basemaps:t.unref($),onOnLayerChange:z},null,8,["basemaps"])],2),t.createElementVNode("div",Ba,[V.value?(t.openBlock(),t.createElementBlock("div",Sa,[t.createElementVNode("div",Na,[k[7]||(k[7]=t.createTextVNode(" Тип: ")),t.createElementVNode("span",Fa,t.toDisplayString(V.value.type),1)]),t.createElementVNode("div",Aa,[t.createElementVNode("div",Ma,[k[8]||(k[8]=t.createTextVNode(" Центр: ")),t.createElementVNode("b",null,t.toDisplayString(V.value.center.lat.toFixed(5))+", "+t.toDisplayString(V.value.center.lng.toFixed(5)),1)]),V.value.areaKm2!==null?(t.openBlock(),t.createElementBlock("div",$a,[k[9]||(k[9]=t.createTextVNode(" Площа: ")),t.createElementVNode("b",null,t.toDisplayString(V.value.areaKm2.toFixed(1))+"км²",1)])):(t.openBlock(),t.createElementBlock("div",Da,k[10]||(k[10]=[t.createTextVNode(" Площа: "),t.createElementVNode("b",null,"—",-1)]))),t.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:k[5]||(k[5]=D=>me())},k[11]||(k[11]=[t.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-e82d2d97><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" data-v-e82d2d97></path><path d="M7 10l6 0" data-v-e82d2d97></path><path d="M10 7l0 6" data-v-e82d2d97></path><path d="M21 21l-6 -6" data-v-e82d2d97></path></svg>',1)])),t.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:k[6]||(k[6]=D=>_e())},[t.createVNode(Ve,{class:"w-3 h-3"})])])])):t.createCommentVNode("",!0)])],2))}}),[["__scopeId","data-v-e82d2d97"]]),Ia=["data-focus"],La={class:"flex items-center"},Ta={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},Oa=["onClick","aria-label"],Ra={key:0,class:"absolute text-gray-500 truncate pl-2"},za={class:"flex-1 min-w-[2px]"},ja=["placeholder"],Ua={class:"flex items-center shrink-0"},Pa=["disabled"],rt=t.defineComponent({__name:"vs-input-tag",props:t.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"}},{modelValue:{default:[]},modelModifiers:{}}),emits:t.mergeModels(["update:modelValue"],["update:modelValue"]),setup(o,{emit:e}){const s=o,n=e;le(s.style);const l=t.ref(null),r=t.ref(null),a=t.ref(null),i=t.ref(!1),u=t.ref(""),c=t.useModel(o,"modelValue"),d=t.computed(()=>s.placeholder||"Add tag…"),h=t.computed(()=>c.value?.length===0&&u.value===""),p=t.computed(()=>!s.disabled&&c.value?.length>0),w=t.computed(()=>s.disabled),V=async()=>{w.value||await t.nextTick(()=>a.value?.focus())},$=A=>{const v=A.trim();v!==""&&(!c.value||!Array.isArray(c.value)?c.value=[v]:s.unique?c.value.includes(v)||(c.value=[...c.value,v]):c.value=[...c.value,v],u.value="")},F=()=>{const A=u.value;A.trim()!==""&&$(A),u.value=""},O=A=>{const v=c.value.slice();v.splice(A,1),n("update:modelValue",v)},E=()=>{n("update:modelValue",[])},f=()=>{w.value||(i.value=!0)},g=()=>{i.value=!1},U=A=>{const{key:v}=A;v==="Enter"?(A.preventDefault(),F()):v==="Backspace"&&u.value===""&&c.value.length>0&&O(c.value.length-1)};return(A,v)=>(t.openBlock(),t.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:l,onClick:v[1]||(v[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",{class:t.normalizeClass(["relative w-full font-sans",s.customClass]),role:"group","aria-label":"Tag input"},[t.createElementVNode("div",{class:t.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",i.value?"border-blue-500 ring-1 ring-blue-500":"",w.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:V},[t.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:r},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(c.value,(j,G)=>(t.openBlock(),t.createElementBlock("div",{key:G,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[t.createElementVNode("div",La,[t.createElementVNode("div",Ta,t.toDisplayString(j),1)]),t.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:t.withModifiers(J=>O(G),["stop"]),"aria-label":`Remove ${j}`},v[2]||(v[2]=[t.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"},[t.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,Oa)]))),128)),h.value?(t.openBlock(),t.createElementBlock("div",Ra,t.toDisplayString(d.value),1)):t.createCommentVNode("",!0),t.createElementVNode("div",za,[w.value?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputRef",ref:a,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":v[0]||(v[0]=j=>u.value=j),onFocus:f,onBlur:g,onKeydown:U,placeholder:c.value&&c.value.length?"":void 0},null,40,ja)),[[t.vModelText,u.value]])])],512),t.createElementVNode("div",Ua,[p.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:w.value,onClick:t.withModifiers(E,["stop"])},v[3]||(v[3]=[t.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[t.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,Pa)):t.createCommentVNode("",!0)])],10,Ia)],2)],512))}}),at={VsInputText:Fe,VsInputRadio:$e,"vs-input-text":Fe,"vs-input-textarea":tt,"vs-input-mask":Ue,"vs-input-number":ze,"vs-input-radio":$e,"vs-input-select":et,"vs-input-switcher":Ae,"vs-input-static":Me,"vs-input-container":Xe,"vs-input-date":qe,"vs-input-checkbox":He,"vs-input-file":Ye,"vs-input-html":Me,"vs-input-email":Pe,"vs-input-datatable":nt,"vs-input-map":lt,"vs-input-file-list":Je,"vs-input-tag":rt},Ha=t.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(o){const e=o,s=t.inject("values");async function n(){try{if(!e.api)return;const l=e.api.replace("{{value}}",e.value),r=await fetch(l);if(!r.ok){W.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const a=await r.json();if(!e.set||!s)return;for(const[i,u]of Object.entries(e.set))s.value[i]=a.result[u]}catch(l){console.error(e.error,l)}}return(l,r)=>(t.openBlock(),t.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"},t.toDisplayString(l.button),1))}}),qa={class:"flex w-full"},ot=t.defineComponent({__name:"vs-compact-form-layout",props:t.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,s=t.useModel(o,"modelValue"),n=t.computed(()=>Dt[`${e.layout}`]),l=t.computed(()=>at?.[`vs-input-${e.item.type}`]),r=t.computed(()=>{const i=t.unref(l);if(!i)return new Set;const u=i.props??i.__vccOpts?.props;if(!u)return new Set;const c=Array.isArray(u)?u:Object.keys(u);return new Set(c)}),a=t.computed(()=>{const i=e.item??{},u=r.value;return u.size?Object.fromEntries(Object.entries(i).filter(([c])=>u.has(c))):{}});return(i,u)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(n.value),{ua:e.item.ua,error:e.error||"",item:i.item,label:e.item.label},{default:t.withCtx(()=>[t.createElementVNode("div",qa,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(l.value),t.mergeProps(a.value,{modelValue:s.value,"onUpdate:modelValue":u[0]||(u[0]=c=>s.value=c)}),null,16,["modelValue"])),i.item.behavior?(t.openBlock(),t.createBlock(Ha,t.mergeProps({key:0},i.item.behavior,{value:s.value}),null,16,["value"])):t.createCommentVNode("",!0)])]),_:1},8,["ua","error","item","label"]))}}),it={required:"Це поле є обов’язковим",email:"Неправильний email"},Ga=o=>o?!1:it.required,Ka=o=>!o&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)?it.email:!1,Za=(o,e)=>{const s=e.pattern??e.regexp;return!(typeof s=="string"?new RegExp(s):s).test(o)&&o?e.message:!1},Ya=(o,e)=>!1,Ja=(o,e)=>{switch(typeof e=="string"?e:e.type){case"required":return Ga(o);case"email":return Ka(o);case"regexp":return Za(o,e);case"custom":return Ya();default:return!1}},Wa={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file"};function ut(o){const e=o.toLowerCase();return Wa[e]||e}function Xa(o){if(Array.isArray(o)){const s=[];return o.forEach(n=>{const l={...n};l.name=(n.name||n.id||n.key||"").toString(),l.type=ut(n.type),l.label=n.label||n.ua,l.rules=n.rules||n.validators,n.data&&(l.api=`/api/suggest/${n.data}`),s.push(l)}),s}const e=[];return Object.entries(o).forEach(s=>{const n={name:s[0],...s[1],type:ut(s[1].type),label:s[1].label||s[1].ua,rules:s[1].rules||s[1].validators};s[1].type.includes("list")&&(n.multiple=!0),s[1].data&&(n.api=`/api/suggest/${s[1].data}`),e.push(n)}),e}function Qa(o,e){const s=Xa(e),n=t.ref({});function l(u){const c=u?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,h=o?.value?.[d];return We(h,c)}const r=(u=s,c=!0)=>(u.forEach(d=>{if(d.rules){if(!l(d)){delete n.value[d.name];return}d.rules.forEach(h=>{const p=Ja(o.value[d.name],h);p?n.value[d.name]=p:delete n.value[d.name]})}d.schema&&r(d.schema,!1)}),c&&Object.values(n.value).some(Boolean)?n.value:null),a=t.computed(()=>s?.filter(u=>l(u)));return{errors:n,validate:r,reset:()=>{o.value={},n.value={}},visibleSchema:a}}const pe=t.defineComponent({__name:"vs-compact-form",props:t.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:t.mergeModels(["handle-submit","update:modelValue"],["update:form","update:values"]),setup(o,{expose:e,emit:s}){const n=s,l=o,r=t.useModel(o,"form"),a=t.useModel(o,"values"),{errors:i,validate:u,reset:c,visibleSchema:d}=Qa(a,l.schema),h=()=>{n("update:modelValue",a.value),u(),n("handle-submit",a.value)};e({validate:u,reset:c,errors:i}),t.onMounted(()=>{l.modelValue&&(a.value=l.modelValue),r.value.value=a.value,r.value.errors=i.value,r.value.reset=c,r.value.validate=u,r.value.formId=l.formId});function p(w,V){if(w===V)return!0;if(typeof w!="object"||typeof V!="object"||!w||!V)return!1;const $=Object.keys(w),F=Object.keys(V);return $.length!==F.length?!1:$.every(O=>w[O]===V[O])}return t.provide("form",r),t.provide("values",a),(w,V)=>(t.openBlock(),t.createElementBlock("form",{onSubmit:t.withModifiers(h,["prevent"]),class:t.normalizeClass(["grid grid-cols-12",w.layout==="default"?"gap-6":"gap-4"])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(d),$=>(t.openBlock(),t.createBlock(ot,{key:$.name,class:t.normalizeClass(w.layout==="horizontal"?"col-span-12":`col-span-${$.col||12} `),style:t.normalizeStyle(w.style),item:$,layout:w.layout,"model-value":a.value[$.name],"onUpdate:modelValue":F=>{const O=a.value[$.name];p(O,F)||(a.value[$.name]=F)},error:t.unref(i)[$.name]},null,8,["class","style","item","layout","model-value","onUpdate:modelValue","error"]))),128))],34))}});pe.install=function(e){e.component("VForm",pe),Object.assign(e.config.globalProperties,{$form:De}),e.provide("form",De),window.v3plugin||(window.v3plugin={})};function re(o){return typeof o=="string"||o instanceof String}function dt(o){var e;return typeof o=="object"&&o!=null&&(o==null||(e=o.constructor)==null?void 0:e.name)==="Object"}function ct(o,e){return Array.isArray(e)?ct(o,(s,n)=>e.includes(n)):Object.entries(o).reduce((s,n)=>{let[l,r]=n;return e(r,l)&&(s[l]=r),s},{})}const x={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function pt(o){switch(o){case x.LEFT:return x.FORCE_LEFT;case x.RIGHT:return x.FORCE_RIGHT;default:return o}}function Ie(o){return o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function ve(o,e){if(e===o)return!0;const s=Array.isArray(e),n=Array.isArray(o);let l;if(s&&n){if(e.length!=o.length)return!1;for(l=0;l<e.length;l++)if(!ve(e[l],o[l]))return!1;return!0}if(s!=n)return!1;if(e&&o&&typeof e=="object"&&typeof o=="object"){const r=e instanceof Date,a=o instanceof Date;if(r&&a)return e.getTime()==o.getTime();if(r!=a)return!1;const i=e instanceof RegExp,u=o instanceof RegExp;if(i&&u)return e.toString()==o.toString();if(i!=u)return!1;const c=Object.keys(e);for(l=0;l<c.length;l++)if(!Object.prototype.hasOwnProperty.call(o,c[l]))return!1;for(l=0;l<c.length;l++)if(!ve(o[c[l]],e[c[l]]))return!1;return!0}else if(e&&o&&typeof e=="function"&&typeof o=="function")return e.toString()===o.toString();return!1}class eo{constructor(e){for(Object.assign(this,e);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?x.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?x.RIGHT:x.LEFT}}function C(o,e){return new C.InputMask(o,e)}function ht(o){if(o==null)throw new Error("mask property should be defined");return o instanceof RegExp?C.MaskedRegExp:re(o)?C.MaskedPattern:o===Date?C.MaskedDate:o===Number?C.MaskedNumber:Array.isArray(o)||o===Array?C.MaskedDynamic:C.Masked&&o.prototype instanceof C.Masked?o:C.Masked&&o instanceof C.Masked?o.constructor:o instanceof Function?C.MaskedFunction:(console.warn("Mask not found for mask",o),C.Masked)}function he(o){if(!o)throw new Error("Options in not defined");if(C.Masked){if(o.prototype instanceof C.Masked)return{mask:o};const{mask:e=void 0,...s}=o instanceof C.Masked?{mask:o}:dt(o)&&o.mask instanceof C.Masked?o:{};if(e){const n=e.mask;return{...ct(e,(l,r)=>!r.startsWith("_")),mask:e.constructor,_mask:n,...s}}}return dt(o)?{...o}:{mask:o}}function Q(o){if(C.Masked&&o instanceof C.Masked)return o;const e=he(o),s=ht(e.mask);if(!s)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===s&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new s(e)}C.createMask=Q;class Be{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return e??this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return e??this.value.length}select(e,s){if(!(e==null||s==null||e===this.selectionStart&&s===this.selectionEnd))try{this._unsafeSelect(e,s)}catch{}}get isActive(){return!1}}C.MaskElement=Be;const mt=90,to=89;class ge extends Be{constructor(e){super(),this.input=e,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 e,s,n;return(e=(s=(n=this.input).getRootNode)==null?void 0:s.call(n))!=null?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){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",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){if(this._handlers.redo&&(e.keyCode===mt&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===to&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===mt&&(e.metaKey||e.ctrlKey))return e.preventDefault(),this._handlers.undo(e);e.isComposing||this._handlers.selectionChange(e)}_onBeforeinput(e){if(e.inputType==="historyUndo"&&this._handlers.undo)return e.preventDefault(),this._handlers.undo(e);if(e.inputType==="historyRedo"&&this._handlers.redo)return e.preventDefault(),this._handlers.redo(e)}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}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={}}}C.HTMLMaskElement=ge;class ft extends ge{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,s){this.input.setSelectionRange(e,s)}get value(){return this.input.value}set value(e){this.input.value=e}}C.HTMLMaskElement=ge;class Le extends ge{get _unsafeSelectionStart(){const e=this.rootElement,s=e.getSelection&&e.getSelection(),n=s&&s.anchorOffset,l=s&&s.focusOffset;return l==null||n==null||n<l?n:l}get _unsafeSelectionEnd(){const e=this.rootElement,s=e.getSelection&&e.getSelection(),n=s&&s.anchorOffset,l=s&&s.focusOffset;return l==null||n==null||n>l?n:l}_unsafeSelect(e,s){if(!this.rootElement.createRange)return;const n=this.rootElement.createRange();n.setStart(this.input.firstChild||this.input,e),n.setEnd(this.input.lastChild||this.input,s);const l=this.rootElement,r=l.getSelection&&l.getSelection();r&&(r.removeAllRanges(),r.addRange(n))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}C.HTMLContenteditableMaskElement=Le;class Se{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>Se.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,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}}Se.MAX_LENGTH=100;class gt{constructor(e,s){this.el=e instanceof Be?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new Le(e):new ft(e),this.masked=Q(s),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Se,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(e){var s;return e==null||((s=this.masked)==null?void 0:s.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof C.Masked)&&this.masked.constructor===ht(e)){this.masked.updateOptions({mask:e});return}const s=e instanceof C.Masked?e:Q({mask:e});s.unmaskedValue=this.masked.unmaskedValue,this.masked=s}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,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(e,s){const n=this._listeners[e];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(e){!this.el||!this.el.isActive||(this.el.select(e,e),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(e){const s=this.masked.unmaskedValue,n=this.masked.value,l=this.masked.rawInputValue,r=this.displayValue,a=this.unmaskedValue!==s||this.value!==n||this._rawInputValue!==l;this._unmaskedValue=s,this._value=n,this._rawInputValue=l,this.el.value!==r&&(this.el.value=r),e==="auto"?this.alignCursor():e!=null&&(this.cursorPos=e),a&&this._fireChangeEvents(),!this._historyChanging&&(a||this.history.isEmpty)&&this.history.push({unmaskedValue:s,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:s,...n}=e,l=!this.maskEquals(s),r=this.masked.optionsIsChanged(n);l&&(this.mask=s),r&&this.masked.updateOptions(n),(l||r)&&this.updateControl()}updateCursor(e){e!=null&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,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,x.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,s){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(s),this}off(e,s){if(!this._listeners[e])return this;if(!s)return delete this._listeners[e],this;const n=this._listeners[e].indexOf(s);return n>=0&&this._listeners[e].splice(n,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const s=new eo({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,r=n===this.masked.rawInputValue?s.removeDirection:x.NONE;let a=this.masked.nearestInputPos(s.startChangePos+l,r);r!==x.NONE&&(a=this.masked.nearestInputPos(a,x.NONE)),this.updateControl(a),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}C.InputMask=gt;class S{static normalize(e){return Array.isArray(e)?e:[e,new S]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}C.ChangeDetails=S;class ee{constructor(e,s,n){e===void 0&&(e=""),s===void 0&&(s=0),this.value=e,this.from=s,this.stop=n}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||e!=null&&this.from>=e)return"";const s=this.value[0];return this.value=this.value.slice(1),s}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class P{constructor(e){this._value="",this._update({...P.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,s){s===void 0&&(s={input:!0}),this.reset(),this.append(e,s,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,s){return e}totalInputPositions(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),Math.min(this.displayValue.length,s-e)}extractInput(e,s,n){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),this.displayValue.slice(e,s)}extractTail(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),new ee(this.extractInput(e,s),e)}appendTail(e){return re(e)&&(e=new ee(String(e))),e.appendTo(this)}_appendCharRaw(e,s){return e?(this._value+=e,new S({inserted:e,rawInserted:e})):new S}_appendChar(e,s,n){s===void 0&&(s={});const l=this.state;let r;if([e,r]=this.doPrepareChar(e,s),e&&(r=r.aggregate(this._appendCharRaw(e,s)),!r.rawInserted&&this.autofix==="pad")){const a=this.state;this.state=l;let i=this.pad(s);const u=this._appendCharRaw(e,s);i=i.aggregate(u),u.rawInserted||i.equals(r)?r=i:this.state=a}if(r.inserted){let a,i=this.doValidate(s)!==!1;if(i&&n!=null){const u=this.state;if(this.overwrite===!0){a=n.state;for(let d=0;d<r.rawInserted.length;++d)n.unshift(this.displayValue.length-r.tailShift)}let c=this.appendTail(n);if(i=c.rawInserted.length===n.toString().length,!(i&&c.inserted)&&this.overwrite==="shift"){this.state=u,a=n.state;for(let d=0;d<r.rawInserted.length;++d)n.shift();c=this.appendTail(n),i=c.rawInserted.length===n.toString().length}i&&c.inserted&&(this.state=u)}i||(r=new S,this.state=l,n&&a&&(n.state=a))}return r}_appendPlaceholder(){return new S}_appendEager(){return new S}append(e,s,n){if(!re(e))throw new Error("value should be string");const l=re(n)?new ee(String(n)):n;s!=null&&s.tail&&(s._beforeTailState=this.state);let r;[e,r]=this.doPrepare(e,s);for(let a=0;a<e.length;++a){const i=this._appendChar(e[a],s,l);if(!i.rawInserted&&!this.doSkipInvalid(e[a],s,l))break;r.aggregate(i)}return(this.eager===!0||this.eager==="append")&&s!=null&&s.input&&e&&r.aggregate(this._appendEager()),l!=null&&(r.tailShift+=this.appendTail(l).tailShift),r}remove(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(s),new S}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const s=this.rawInputValue,n=this.value,l=e();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(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const s=this.state,n=e(this);return this.state=s,delete this._isolated,n}doSkipInvalid(e,s,n){return!!this.skipInvalid}doPrepare(e,s){return s===void 0&&(s={}),S.normalize(this.prepare?this.prepare(e,this,s):e)}doPrepareChar(e,s){return s===void 0&&(s={}),S.normalize(this.prepareChar?this.prepareChar(e,this,s):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,s,n,l,r){n===void 0&&(n=""),l===void 0&&(l=x.NONE),r===void 0&&(r={input:!0});const a=e+s,i=this.extractTail(a),u=this.eager===!0||this.eager==="remove";let c;u&&(l=pt(l),c=this.extractInput(0,a,{raw:!0}));let d=e;const h=new S;if(l!==x.NONE&&(d=this.nearestInputPos(e,s>1&&e!==0&&!u?x.NONE:l),h.tailShift=d-e),h.aggregate(this.remove(d)),u&&l!==x.NONE&&c===this.rawInputValue)if(l===x.FORCE_LEFT){let p;for(;c===this.rawInputValue&&(p=this.displayValue.length);)h.aggregate(new S({tailShift:-1})).aggregate(this.remove(p-1))}else l===x.FORCE_RIGHT&&i.unshift();return h.aggregate(this.append(n,r,i))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!ve(this,e)}typedValueEquals(e){const s=this.typedValue;return e===s||P.EMPTY_VALUES.includes(e)&&P.EMPTY_VALUES.includes(s)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new S}}P.DEFAULTS={skipInvalid:!0},P.EMPTY_VALUES=[void 0,null,""],C.Masked=P;class ae{constructor(e,s){e===void 0&&(e=[]),s===void 0&&(s=0),this.chunks=e,this.from=s}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=re(e)?new ee(String(e)):e;const s=this.chunks[this.chunks.length-1],n=s&&(s.stop===e.stop||e.stop==null)&&e.from===s.from+s.toString().length;if(e instanceof ee)n?s.extend(e.toString()):this.chunks.push(e);else if(e instanceof ae){if(e.stop==null){let l;for(;e.chunks.length&&e.chunks[0].stop==null;)l=e.chunks.shift(),l.from+=e.from,this.extend(l)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof C.MaskedPattern))return new ee(this.toString()).appendTo(e);const s=new S;for(let n=0;n<this.chunks.length;++n){const l=this.chunks[n],r=e._mapPosToBlock(e.displayValue.length),a=l.stop;let i;if(a!=null&&(!r||r.index<=a)&&((l instanceof ae||e._stops.indexOf(a)>=0)&&s.aggregate(e._appendPlaceholder(a)),i=l instanceof ae&&e._blocks[a]),i){const u=i.appendTail(l);s.aggregate(u);const c=l.toString().slice(u.rawInserted.length);c&&s.aggregate(e.append(c,{tail:!0}))}else s.aggregate(e.append(l.toString(),{tail:!0}))}return s}get state(){return{chunks:this.chunks.map(e=>e.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:s,...n}=e;Object.assign(this,n),this.chunks=s.map(l=>{const r="chunks"in l?new ae:new ee;return r.state=l,r})}unshift(e){if(!this.chunks.length||e!=null&&this.from>=e)return"";const s=e!=null?e-this.from:e;let n=0;for(;n<this.chunks.length;){const l=this.chunks[n],r=l.unshift(s);if(l.toString()){if(!r)break;++n}else this.chunks.splice(n,1);if(r)return r}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const s=this.chunks[e],n=s.shift();if(s.toString()){if(!n)break;--e}else this.chunks.splice(e,1);if(n)return n}return""}}class so{constructor(e,s){this.masked=e,this._log=[];const{offset:n,index:l}=e._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(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}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(e){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(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())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,x.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,x.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,x.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,x.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,x.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,x.NONE),!0})}}class Te{constructor(e){Object.assign(this,e),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(e,s){return e===void 0&&(e=0),s===void 0&&(s=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(s),this._value||(this._isRawInput=!1),new S}nearestInputPos(e,s){s===void 0&&(s=x.NONE);const n=0,l=this._value.length;switch(s){case x.LEFT:case x.FORCE_LEFT:return n;case x.NONE:case x.RIGHT:case x.FORCE_RIGHT:default:return l}}totalInputPositions(e,s){return e===void 0&&(e=0),s===void 0&&(s=this._value.length),this._isRawInput?s-e:0}extractInput(e,s,n){return e===void 0&&(e=0),s===void 0&&(s=this._value.length),n===void 0&&(n={}),n.raw&&this._isRawInput&&this._value.slice(e,s)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(e,s){if(s===void 0&&(s={}),this.isFilled)return new S;const n=this.eager===!0||this.eager==="append",r=this.char===e&&(this.isUnmasking||s.input||s.raw)&&(!s.raw||!n)&&!s.tail,a=new S({inserted:this.char,rawInserted:r?this.char:""});return this._value=this.char,this._isRawInput=r&&(s.raw||s.input),a}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new S;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new ee("")}appendTail(e){return re(e)&&(e=new ee(String(e))),e.appendTo(this)}append(e,s,n){const l=this._appendChar(e[0],s);return n!=null&&(l.tailShift+=this.appendTail(n).tailShift),l}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=!!e._rawInputValue}pad(e){return this._appendPlaceholder()}}class ke{constructor(e){const{parent:s,isOptional:n,placeholderChar:l,displayChar:r,lazy:a,eager:i,...u}=e;this.masked=Q(u),Object.assign(this,{parent:s,isOptional:n,placeholderChar:l,displayChar:r,lazy:a,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.value.length),e===0&&s>=1?(this.isFilled=!1,this.masked.remove(e,s)):new S}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(e,s){if(s===void 0&&(s={}),this.isFilled)return new S;const n=this.masked.state;let l=this.masked._appendChar(e,this.currentMaskFlags(s));return l.inserted&&this.doValidate(s)===!1&&(l=new S,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(e,s,n){return this.masked.append(e,this.currentMaskFlags(s),n)}_appendPlaceholder(){return this.isFilled||this.isOptional?new S:(this.isFilled=!0,new S({inserted:this.placeholderChar}))}_appendEager(){return new S}extractTail(e,s){return this.masked.extractTail(e,s)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,s,n){return e===void 0&&(e=0),s===void 0&&(s=this.value.length),this.masked.extractInput(e,s,n)}nearestInputPos(e,s){s===void 0&&(s=x.NONE);const n=0,l=this.value.length,r=Math.min(Math.max(e,n),l);switch(s){case x.LEFT:case x.FORCE_LEFT:return this.isComplete?r:n;case x.RIGHT:case x.FORCE_RIGHT:return this.isComplete?r:l;case x.NONE:default:return r}}totalInputPositions(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.value.length),this.value.slice(e,s).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var s;return{...e,_beforeTailState:(e==null||(s=e._beforeTailState)==null?void 0:s.masked)||e?._beforeTailState}}pad(e){return new S}}ke.DEFAULT_DEFINITIONS={0:/\d/,a:/[\u0041-\u005A\u0061-\u007A\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u0527\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0\u08A2-\u08AC\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0977\u0979-\u097F\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C33\u0C35-\u0C39\u0C3D\u0C58\u0C59\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D60\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F4\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191C\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19C1-\u19C7\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FCC\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,"*":/./};class kt extends P{updateOptions(e){super.updateOptions(e)}_update(e){const s=e.mask;s&&(e.validate=n=>n.search(s)>=0),super._update(e)}}C.MaskedRegExp=kt;class H extends P{constructor(e){super({...H.DEFAULTS,...e,definitions:Object.assign({},ke.DEFAULT_DEFINITIONS,e?.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const s=this.mask;if(!s||!e)return;let n=!1,l=!1;for(let r=0;r<s.length;++r){if(this.blocks){const c=s.slice(r),d=Object.keys(this.blocks).filter(p=>c.indexOf(p)===0);d.sort((p,w)=>w.length-p.length);const h=d[0];if(h){const{expose:p,repeat:w,...V}=he(this.blocks[h]),$={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...V,repeat:w,parent:this},F=w!=null?new C.RepeatBlock($):Q($);F&&(this._blocks.push(F),p&&(this.exposeBlock=F),this._maskedBlocks[h]||(this._maskedBlocks[h]=[]),this._maskedBlocks[h].push(this._blocks.length-1)),r+=h.length-1;continue}}let a=s[r],i=a in e;if(a===H.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(a==="{"||a==="}"){n=!n;continue}if(a==="["||a==="]"){l=!l;continue}if(a===H.ESCAPE_CHAR){if(++r,a=s[r],!a)break;i=!1}const u=i?new ke({isOptional:l,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...he(e[a]),parent:this}):new Te({char:a,eager:this.eager,isUnmasking:n});this._blocks.push(u)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e){this.reset();return}const{_blocks:s,...n}=e;this._blocks.forEach((l,r)=>l.state=s[r]),super.state=n}reset(){super.reset(),this._blocks.forEach(e=>e.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(e=>e.isComplete)}get isFilled(){return this._blocks.every(e=>e.isFilled)}get isFixed(){return this._blocks.every(e=>e.isFixed)}get isOptional(){return this._blocks.every(e=>e.isOptional)}doCommit(){this._blocks.forEach(e=>e.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((e,s)=>e+=s.unmaskedValue,"")}set unmaskedValue(e){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(s),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((e,s)=>e+=s.value,"")}set value(e){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(s),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(s),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce((e,s)=>e+=s.displayValue,"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const s=new S;let n=(e=this._mapPosToBlock(this.displayValue.length))==null?void 0:e.index;if(n==null)return s;this._blocks[n].isFilled&&++n;for(let l=n;l<this._blocks.length;++l){const r=this._blocks[l]._appendEager();if(!r.inserted)break;s.aggregate(r)}return s}_appendCharRaw(e,s){s===void 0&&(s={});const n=this._mapPosToBlock(this.displayValue.length),l=new S;if(!n)return l;for(let a=n.index,i;i=this._blocks[a];++a){var r;const u=i._appendChar(e,{...s,_beforeTailState:(r=s._beforeTailState)==null||(r=r._blocks)==null?void 0:r[a]});if(l.aggregate(u),u.consumed)break}return l}extractTail(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length);const n=new ae;return e===s||this._forEachBlocksInRange(e,s,(l,r,a,i)=>{const u=l.extractTail(a,i);u.stop=this._findStopBefore(r),u.from=this._blockStartPos(r),u instanceof ae&&(u.blockIndex=r),n.extend(u)}),n}extractInput(e,s,n){if(e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),n===void 0&&(n={}),e===s)return"";let l="";return this._forEachBlocksInRange(e,s,(r,a,i,u)=>{l+=r.extractInput(i,u,n)}),l}_findStopBefore(e){let s;for(let n=0;n<this._stops.length;++n){const l=this._stops[n];if(l<=e)s=l;else break}return s}_appendPlaceholder(e){const s=new S;if(this.lazy&&e==null)return s;const n=this._mapPosToBlock(this.displayValue.length);if(!n)return s;const l=n.index,r=e??this._blocks.length;return this._blocks.slice(l,r).forEach(a=>{if(!a.lazy||e!=null){var i;s.aggregate(a._appendPlaceholder((i=a._blocks)==null?void 0:i.length))}}),s}_mapPosToBlock(e){let s="";for(let n=0;n<this._blocks.length;++n){const l=this._blocks[n],r=s.length;if(s+=l.displayValue,e<=s.length)return{index:n,offset:e-r}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce((s,n)=>s+=n.displayValue.length,0)}_forEachBlocksInRange(e,s,n){s===void 0&&(s=this.displayValue.length);const l=this._mapPosToBlock(e);if(l){const r=this._mapPosToBlock(s),a=r&&l.index===r.index,i=l.offset,u=r&&a?r.offset:this._blocks[l.index].displayValue.length;if(n(this._blocks[l.index],l.index,i,u),r&&!a){for(let c=l.index+1;c<r.index;++c)n(this._blocks[c],c,0,this._blocks[c].displayValue.length);n(this._blocks[r.index],r.index,0,r.offset)}}}remove(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length);const n=super.remove(e,s);return this._forEachBlocksInRange(e,s,(l,r,a,i)=>{n.aggregate(l.remove(a,i))}),n}nearestInputPos(e,s){if(s===void 0&&(s=x.NONE),!this._blocks.length)return 0;const n=new so(this,e);if(s===x.NONE)return n.pushRightBeforeInput()||(n.popState(),n.pushLeftBeforeInput())?n.pos:this.displayValue.length;if(s===x.LEFT||s===x.FORCE_LEFT){if(s===x.LEFT){if(n.pushRightBeforeFilled(),n.ok&&n.pos===e)return e;n.popState()}if(n.pushLeftBeforeInput(),n.pushLeftBeforeRequired(),n.pushLeftBeforeFilled(),s===x.LEFT){if(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.ok&&n.pos<=e||(n.popState(),n.ok&&n.pos<=e))return n.pos;n.popState()}return n.ok?n.pos:s===x.FORCE_LEFT?0:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:0)}return s===x.RIGHT||s===x.FORCE_RIGHT?(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.pushRightBeforeFilled()?n.pos:s===x.FORCE_RIGHT?this.displayValue.length:(n.popState(),n.ok||(n.popState(),n.ok)?n.pos:this.nearestInputPos(e,x.LEFT))):e}totalInputPositions(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length);let n=0;return this._forEachBlocksInRange(e,s,(l,r,a,i)=>{n+=l.totalInputPositions(a,i)}),n}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const s=this._maskedBlocks[e];return s?s.map(n=>this._blocks[n]):[]}pad(e){const s=new S;return this._forEachBlocksInRange(0,this.displayValue.length,n=>s.aggregate(n.pad(e))),s}}H.DEFAULTS={...P.DEFAULTS,lazy:!0,placeholderChar:"_"},H.STOP_CHAR="`",H.ESCAPE_CHAR="\\",H.InputDefinition=ke,H.FixedDefinition=Te,C.MaskedPattern=H;class be extends H{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:s=this.to||0,from:n=this.from||0,maxLength:l=this.maxLength||0,autofix:r=this.autofix,...a}=e;this.to=s,this.from=n,this.maxLength=Math.max(String(s).length,l),this.autofix=r;const i=String(this.from).padStart(this.maxLength,"0"),u=String(this.to).padStart(this.maxLength,"0");let c=0;for(;c<u.length&&u[c]===i[c];)++c;a.mask=u.slice(0,c).replace(/0/g,"\\0")+"0".repeat(this.maxLength-c),super._update(a)}get isComplete(){return super.isComplete&&!!this.value}boundaries(e){let s="",n="";const[,l,r]=e.match(/^(\D*)(\d*)(\D*)/)||[];return r&&(s="0".repeat(l.length)+r,n="9".repeat(l.length)+r),s=s.padEnd(this.maxLength,"0"),n=n.padEnd(this.maxLength,"9"),[s,n]}doPrepareChar(e,s){s===void 0&&(s={});let n;return[e,n]=super.doPrepareChar(e.replace(/\D/g,""),s),e||(n.skip=!this.isComplete),[e,n]}_appendCharRaw(e,s){if(s===void 0&&(s={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,s);const n=String(this.from).padStart(this.maxLength,"0"),l=String(this.to).padStart(this.maxLength,"0"),[r,a]=this.boundaries(this.value+e);return Number(a)<this.from?super._appendCharRaw(n[this.value.length],s):Number(r)>this.to?!s.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(n[this.value.length],s).aggregate(this._appendCharRaw(e,s)):super._appendCharRaw(l[this.value.length],s):super._appendCharRaw(e,s)}doValidate(e){const s=this.value;if(s.search(/[^0]/)===-1&&s.length<=this._matchFrom)return!0;const[l,r]=this.boundaries(s);return this.from<=Number(r)&&Number(l)<=this.to&&super.doValidate(e)}pad(e){const s=new S;if(this.value.length===this.maxLength)return s;const n=this.value,l=this.maxLength-this.value.length;if(l){this.reset();for(let r=0;r<l;++r)s.aggregate(super._appendCharRaw("0",e));n.split("").forEach(r=>this._appendCharRaw(r))}return s}}C.MaskedRange=be;const no="d{.}`m{.}`Y";class te extends H{static extractPatternOptions(e){const{mask:s,pattern:n,...l}=e;return{...l,mask:re(s)?s:n}}constructor(e){super(te.extractPatternOptions({...te.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:s,pattern:n,blocks:l,...r}={...te.DEFAULTS,...e},a=Object.assign({},te.GET_DEFAULT_BLOCKS());e.min&&(a.Y.from=e.min.getFullYear()),e.max&&(a.Y.to=e.max.getFullYear()),e.min&&e.max&&a.Y.from===a.Y.to&&(a.m.from=e.min.getMonth()+1,a.m.to=e.max.getMonth()+1,a.m.from===a.m.to&&(a.d.from=e.min.getDate(),a.d.to=e.max.getDate())),Object.assign(a,this.blocks,l),super._update({...r,mask:re(s)?s:n,blocks:a})}doValidate(e){const s=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&s!=null&&(this.min==null||this.min<=s)&&(this.max==null||s<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(te.extractPatternOptions(e))}}te.GET_DEFAULT_BLOCKS=()=>({d:{mask:be,from:1,to:31,maxLength:2},m:{mask:be,from:1,to:12,maxLength:2},Y:{mask:be,from:1900,to:9999}}),te.DEFAULTS={...H.DEFAULTS,mask:Date,pattern:no,format:(o,e)=>{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,e)=>{const[s,n,l]=o.split(".").map(Number);return new Date(l,n-1,s)}},C.MaskedDate=te;class ye extends P{constructor(e){super({...ye.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map(s=>{const{expose:n,...l}=he(s),r=Q({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...l});return n&&(this.exposeMask=r),r}):[])}_appendCharRaw(e,s){s===void 0&&(s={});const n=this._applyDispatch(e,s);return this.currentMask&&n.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(s))),n}_applyDispatch(e,s,n){e===void 0&&(e=""),s===void 0&&(s={}),n===void 0&&(n="");const l=s.tail&&s._beforeTailState!=null?s._beforeTailState._value:this.value,r=this.rawInputValue,a=s.tail&&s._beforeTailState!=null?s._beforeTailState._rawInputValue:r,i=r.slice(a.length),u=this.currentMask,c=new S,d=u?.state;return this.currentMask=this.doDispatch(e,{...s},n),this.currentMask&&(this.currentMask!==u?(this.currentMask.reset(),a&&(this.currentMask.append(a,{raw:!0}),c.tailShift=this.currentMask.value.length-l.length),i&&(c.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):d&&(this.currentMask.state=d)),c}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const s=new S;return e&&s.aggregate(this._applyDispatch("",{},e)),s.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var s,n;return{...e,_beforeTailState:((s=e._beforeTailState)==null?void 0:s.currentMaskRef)===this.currentMask&&((n=e._beforeTailState)==null?void 0:n.currentMask)||e._beforeTailState}}doDispatch(e,s,n){return s===void 0&&(s={}),n===void 0&&(n=""),this.dispatch(e,this,s,n)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,s){s===void 0&&(s={});let[n,l]=super.doPrepare(e,s);if(this.currentMask){let r;[n,r]=super.doPrepare(n,this.currentMaskFlags(s)),l=l.aggregate(r)}return[n,l]}doPrepareChar(e,s){s===void 0&&(s={});let[n,l]=super.doPrepareChar(e,s);if(this.currentMask){let r;[n,r]=super.doPrepareChar(n,this.currentMaskFlags(s)),l=l.aggregate(r)}return[n,l]}reset(){var e;(e=this.currentMask)==null||e.reset(),this.compiledMasks.forEach(s=>s.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask){this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,this._applyDispatch();return}let s=String(e);this.currentMask&&(this.currentMask.typedValue=e,s=this.currentMask.unmaskedValue),this.unmaskedValue=s}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return!!((e=this.currentMask)!=null&&e.isComplete)}get isFilled(){var e;return!!((e=this.currentMask)!=null&&e.isFilled)}remove(e,s){const n=new S;return this.currentMask&&n.aggregate(this.currentMask.remove(e,s)).aggregate(this._applyDispatch()),n}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(s=>s.state),currentMaskRef:this.currentMask,currentMask:(e=this.currentMask)==null?void 0:e.state}}set state(e){const{compiledMasks:s,currentMaskRef:n,currentMask:l,...r}=e;s&&this.compiledMasks.forEach((a,i)=>a.state=s[i]),n!=null&&(this.currentMask=n,this.currentMask.state=l),super.state=r}extractInput(e,s,n){return this.currentMask?this.currentMask.extractInput(e,s,n):""}extractTail(e,s){return this.currentMask?this.currentMask.extractTail(e,s):super.extractTail(e,s)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,s){return this.currentMask?this.currentMask.nearestInputPos(e,s):super.nearestInputPos(e,s)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every((s,n)=>{if(!e[n])return;const{mask:l,...r}=e[n];return ve(s,r)&&s.maskEquals(l)}):super.maskEquals(e)}typedValueEquals(e){var s;return!!((s=this.currentMask)!=null&&s.typedValueEquals(e))}}ye.DEFAULTS={...P.DEFAULTS,dispatch:(o,e,s,n)=>{if(!e.compiledMasks.length)return;const l=e.rawInputValue,r=e.compiledMasks.map((a,i)=>{const u=e.currentMask===a,c=u?a.displayValue.length:a.nearestInputPos(a.displayValue.length,x.FORCE_LEFT);return a.rawInputValue!==l?(a.reset(),a.append(l,{raw:!0})):u||a.remove(c),a.append(o,e.currentMaskFlags(s)),a.appendTail(n),{index:i,weight:a.rawInputValue.length,totalInputPositions:a.totalInputPositions(0,Math.max(c,a.nearestInputPos(a.displayValue.length,x.FORCE_LEFT)))}});return r.sort((a,i)=>i.weight-a.weight||i.totalInputPositions-a.totalInputPositions),e.compiledMasks[r[0].index]}},C.MaskedDynamic=ye;class xe extends H{constructor(e){super({...xe.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:s,...n}=e;if(s){const l=s.map(i=>i.length),r=Math.min(...l),a=Math.max(...l)-r;n.mask="*".repeat(r),a&&(n.mask+="["+"*".repeat(a)+"]"),this.enum=s}super._update(n)}_appendCharRaw(e,s){s===void 0&&(s={});const n=Math.min(this.nearestInputPos(0,x.FORCE_RIGHT),this.value.length),l=this.enum.filter(r=>this.matchValue(r,this.unmaskedValue+e,n));if(l.length){l.length===1&&this._forEachBlocksInRange(0,this.value.length,(a,i)=>{const u=l[0][i];i>=this.value.length||u===a.value||(a.reset(),a._appendChar(u,s))});const r=super._appendCharRaw(l[0][this.value.length],s);return l.length===1&&l[0].slice(this.unmaskedValue.length).split("").forEach(a=>r.aggregate(super._appendCharRaw(a))),r}return new S({skip:!this.isComplete})}extractTail(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),new ee("",e)}remove(e,s){if(e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),e===s)return new S;const n=Math.min(super.nearestInputPos(0,x.FORCE_RIGHT),this.value.length);let l;for(l=e;l>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(n,l),n)).length>1);--l);const r=super.remove(l,s);return r.tailShift+=l-e,r}get isComplete(){return this.enum.indexOf(this.value)>=0}}xe.DEFAULTS={...H.DEFAULTS,matchValue:(o,e,s)=>o.indexOf(e,s)===s},C.MaskedEnum=xe;class bt extends P{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}C.MaskedFunction=bt;var yt;class K extends P{constructor(e){super({...K.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),s="\\d*",n=(this.scale?"("+Ie(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+s+n),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Ie).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Ie(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const s=e.split(this.radix);return s[0]=s[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),s.join(this.radix)}doPrepareChar(e,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)?e.replace(this._mapToRadixRegExp,this.radix):e),s);return e&&!n&&(l.skip=!0),n&&!this.allowPositive&&!this.value&&n!=="-"&&l.aggregate(this._appendChar("-")),[n,l]}_separatorsCount(e,s){s===void 0&&(s=!1);let n=0;for(let l=0;l<e;++l)this._value.indexOf(this.thousandsSeparator,l)===l&&(++n,s&&(e+=this.thousandsSeparator.length));return n}_separatorsCountFromSlice(e){return e===void 0&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,s,n){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),[e,s]=this._adjustRangeWithSeparators(e,s),this._removeThousandsSeparators(super.extractInput(e,s,n))}_appendCharRaw(e,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 r=this._value;this._value+=e;const a=this.number;let i=!isNaN(a),u=!1;if(i){let p;this.min!=null&&this.min<0&&this.number<this.min&&(p=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(p=this.max),p!=null&&(this.autofix?(this._value=this.format(p,this).replace(K.UNMASKED_RADIX,this.radix),u||(u=r===this._value&&!s.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let c;i?c=new S({inserted:this._value.slice(r.length),rawInserted:u?"":e,skip:u}):(this._value=r,c=new S),this._value=this._insertThousandsSeparators(this._value);const d=s.tail&&s._beforeTailState?s._beforeTailState._value:this._value,h=this._separatorsCountFromSlice(d);return c.tailShift+=(h-l)*this.thousandsSeparator.length,c}_findSeparatorAround(e){if(this.thousandsSeparator){const s=e-this.thousandsSeparator.length+1,n=this.value.indexOf(this.thousandsSeparator,s);if(n<=e)return n}return-1}_adjustRangeWithSeparators(e,s){const n=this._findSeparatorAround(e);n>=0&&(e=n);const l=this._findSeparatorAround(s);return l>=0&&(s=l+this.thousandsSeparator.length),[e,s]}remove(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),[e,s]=this._adjustRangeWithSeparators(e,s);const n=this.value.slice(0,e),l=this.value.slice(s),r=this._separatorsCount(n.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(n+l));const a=this._separatorsCountFromSlice(n);return new S({tailShift:(a-r)*this.thousandsSeparator.length})}nearestInputPos(e,s){if(!this.thousandsSeparator)return e;switch(s){case x.NONE:case x.LEFT:case x.FORCE_LEFT:{const n=this._findSeparatorAround(e-1);if(n>=0){const l=n+this.thousandsSeparator.length;if(e<l||this.value.length<=l||s===x.FORCE_LEFT)return n}break}case x.RIGHT:case x.FORCE_RIGHT:{const n=this._findSeparatorAround(e);if(n>=0)return n+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let s=e;this.min!=null&&(s=Math.max(s,this.min)),this.max!=null&&(s=Math.min(s,this.max)),s!==e&&(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(e){const s=this._removeThousandsSeparators(e).split(this.radix);return s[0]=s[0].replace(/^(\D*)(0*)(\d*)/,(n,l,r,a)=>l+a),e.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(e){if(!e)return e;const s=e.split(this.radix);return s.length<2&&s.push(""),s[1]=s[1].padEnd(this.scale,"0"),s.join(this.radix)}doSkipInvalid(e,s,n){s===void 0&&(s={});const l=this.scale===0&&e!==this.thousandsSeparator&&(e===this.radix||e===K.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,s,n)&&!l}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,K.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(K.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}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(e){return(super.typedValueEquals(e)||K.EMPTY_VALUES.includes(e)&&K.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}yt=K,K.UNMASKED_RADIX=".",K.EMPTY_VALUES=[...P.EMPTY_VALUES,0],K.DEFAULTS={...P.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[yt.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})},C.MaskedNumber=K;const Ne={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Oe(o,e,s){e===void 0&&(e=Ne.MASKED),s===void 0&&(s=Ne.MASKED);const n=Q(o);return l=>n.runIsolated(r=>(r[e]=l,r[s]))}function xt(o,e,s,n){return Oe(e,s,n)(o)}C.PIPE_TYPE=Ne,C.createPipe=Oe,C.pipe=xt;class _t extends H{get repeatFrom(){var e;return(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?e:0}get repeatTo(){var e;return(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var s,n,l;const{repeat:r,...a}=he(e);this._blockOpts=Object.assign({},this._blockOpts,a);const i=Q(this._blockOpts);this.repeat=(s=(n=r??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(e){if(e<this._blocks.length)return this._blocks[e];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(Q(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(e,s){s===void 0&&(s={});const n=new S;for(let u=(l=(r=this._mapPosToBlock(this.displayValue.length))==null?void 0:r.index)!=null?l:Math.max(this._blocks.length-1,0),c,d;c=(a=this._blocks[u])!=null?a:d=!d&&this._allocateBlock(u);++u){var l,r,a,i;const h=c._appendChar(e,{...s,_beforeTailState:(i=s._beforeTailState)==null||(i=i._blocks)==null?void 0:i[u]});if(h.skip&&d){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(n.aggregate(h),h.consumed)break}return n}_trimEmptyTail(e,s){var n,l;e===void 0&&(e=0);const r=Math.max(((n=this._mapPosToBlock(e))==null?void 0:n.index)||0,this.repeatFrom,0);let a;s!=null&&(a=(l=this._mapPosToBlock(s))==null?void 0:l.index),a==null&&(a=this._blocks.length-1);let i=0;for(let u=a;r<=u&&!this._blocks[u].unmaskedValue;--u,++i);i&&(this._blocks.splice(a-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length);const n=super.remove(e,s);return this._trimEmptyTail(e,s),n}totalInputPositions(e,s){return e===void 0&&(e=0),s==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,s)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}}C.RepeatBlock=_t;try{globalThis.IMask=C}catch{}const lo=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:S,ChunksTailDetails:ae,DIRECTION:x,HTMLContenteditableMaskElement:Le,HTMLInputMaskElement:ft,HTMLMaskElement:ge,InputMask:gt,MaskElement:Be,Masked:P,MaskedDate:te,MaskedDynamic:ye,MaskedEnum:xe,MaskedFunction:bt,MaskedNumber:K,MaskedPattern:H,MaskedRange:be,MaskedRegExp:kt,PIPE_TYPE:Ne,PatternFixedDefinition:Te,PatternInputDefinition:ke,RepeatBlock:_t,createMask:Q,createPipe:Oe,default:C,forceDirection:pt,normalizeOpts:he,pipe:xt},Symbol.toStringTag,{value:"Module"}));T.ModalEdit=Qe,T.VForm=pe,T.VsInputCheckbox=He,T.VsInputContainer=Xe,T.VsInputDate=qe,T.VsInputEmail=Pe,T.VsInputFile=Ye,T.VsInputFileList=Je,T.VsInputMask=Ue,T.VsInputNumber=ze,T.VsInputRadio=$e,T.VsInputSelect=et,T.VsInputStatic=Me,T.VsInputSwitcher=Ae,T.VsInputTag=rt,T.VsInputText=Fe,T.VsInputTextarea=tt,T.default=pe,T.inputs=at,T.vsInputDatatable=nt,T.vsInputMap=lt,Object.defineProperties(T,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(O,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("@opengis/core")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core"],t):(O=typeof globalThis<"u"?globalThis:O||self,t(O.FormBuilder={},O.Vue,O.OpenGISCore))})(this,function(O,t,W){"use strict";const Bt={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},Nt={class:"opacity-100"},St={key:0,class:"text-red-500 text-[14px]"},Ft={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Mt=t.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 e=t.ref("uk"),s=n=>{n.detail.key==="locale"&&(e.value=n.detail.newValue)};return t.onMounted(()=>{e.value=localStorage.locale,window.addEventListener("storage",s)}),t.onUnmounted(()=>{window.removeEventListener("resize",s)}),(n,l)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["w-full relative",{"opacity-60":n.item.disabled}])},[n.ua||n.label?(t.openBlock(),t.createElementBlock("div",Bt,[t.createElementVNode("span",Nt,t.toDisplayString(n.item[e.value]||n.ua||n.label),1),n.item?.rules?.includes("required")?(t.openBlock(),t.createElementBlock("span",St,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.renderSlot(n.$slots,"default",t.normalizeProps(t.guardReactiveProps(n.$attrs))),n.error?(t.openBlock(),t.createElementBlock("span",Ft,t.toDisplayString(n.error),1)):t.createCommentVNode("",!0)],2))}}),At={class:"w-full relative flex flex-row items-center gap-2"},$t={key:0,class:"text-sm text-gray-900 font-medium flex shrink-0 w-3/12 max-w-[250px]"},Dt={key:0,class:"text-red-500 text-[14px]"},It={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Lt=t.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(e,s)=>(t.openBlock(),t.createElementBlock("div",At,[e.item?.type!=="html"?(t.openBlock(),t.createElementBlock("span",$t,[t.createTextVNode(t.toDisplayString(e.ua||e.label)+" ",1),e.item?.rules?.includes("required")&&(e.ua||e.label)?(t.openBlock(),t.createElementBlock("span",Dt,"*")):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.renderSlot(e.$slots,"default",t.normalizeProps(t.guardReactiveProps(e.$attrs))),e.error?(t.openBlock(),t.createElementBlock("span",It,t.toDisplayString(e.error),1)):t.createCommentVNode("",!0)]))}}),Tt={class:"w-full relative"},Ot={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Rt={default:Mt,horizontal:Lt,inline:t.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(e,s)=>(t.openBlock(),t.createElementBlock("div",Tt,[t.renderSlot(e.$slots,"default",t.normalizeProps(t.guardReactiveProps(e.$attrs))),e.error?(t.openBlock(),t.createElementBlock("span",Ot,t.toDisplayString(e.error),1)):t.createCommentVNode("",!0)]))}})};function ae(o){return{inputClass:t.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 zt=["placeholder","disabled"],ke=t.defineComponent({__name:"vs-input-text",props:t.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 e=o,{inputClass:s}=ae(e.style),n=t.useModel(o,"modelValue");return(l,r)=>t.withDirectives((t.openBlock(),t.createElementBlock("input",{type:"text","onUpdate:modelValue":r[0]||(r[0]=a=>n.value=a),placeholder:l.placeholder,disabled:l.disabled,class:t.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[t.unref(s),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,zt)),[[t.vModelText,n.value]])}}),jt=["placeholder"],je=t.defineComponent({__name:"vs-input-number",props:t.mergeModels({style:{default:()=>({})},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,{inputClass:s}=ae(e.style),n=t.useModel(o,"modelValue");return(l,r)=>t.withDirectives((t.openBlock(),t.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":r[0]||(r[0]=a=>n.value=a),placeholder:l.placeholder,class:t.normalizeClass(["py-1.5 px-3 block w-full bg-white",[t.unref(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,jt)),[[t.vModelText,n.value]])}}),I=(o,e)=>{const s=o.__vccOpts||o;for(const[n,l]of e)s[n]=l;return s},Ut={},Pt={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 Ht(o,e){return t.openBlock(),t.createElementBlock("svg",Pt,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const qt=I(Ut,[["render",Ht]]),Gt={class:"flex items-center gap-[4px]"},Kt=["value","id","disabled"],Zt=["for"],Yt={class:"text-[14px] text-gray-700 flex items-center gap-x-1 ml-1 dark:text-neutral-400"},Jt=t.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:e}){const s=e,n=o,l=t.computed({get:()=>n.modelValue,set:r=>s("update:modelValue",r)});return(r,a)=>(t.openBlock(),t.createElementBlock("div",Gt,[t.withDirectives(t.createElementVNode("input",{type:"checkbox",value:r.value,"onUpdate:modelValue":a[0]||(a[0]=i=>l.value=i),class:t.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":r.disabled}]),id:r.id,disabled:r.disabled},null,10,Kt),[[t.vModelCheckbox,l.value]]),t.createElementVNode("label",{for:r.id,class:t.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":r.disabled}])},[t.createElementVNode("div",{class:t.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",r.error?"border-red-600":""]])},[t.createVNode(qt,{height:"12",width:"12"})],2),t.createElementVNode("span",Yt,[t.renderSlot(r.$slots,"default",{},()=>[t.createTextVNode(t.toDisplayString(r.label),1)])])],10,Zt)]))}}),Wt=["name","value","disabled"],Xt={class:"flex items-center gap-[6px] text-[14px]"},Qt={key:0,class:"text-[16px]"},es=["src"],ts=t.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:e}){const s=o,n=e,l=t.computed({get:()=>s.modelValue,set:i=>{n("update:modelValue",i)}}),r=t.computed(()=>Array.isArray(l.value)?l.value.includes(s.value):l.value===!0||l.value===s.value),a=t.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,u)=>(t.openBlock(),t.createElementBlock("label",{class:t.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",[a.value,r.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[t.withDirectives(t.createElementVNode("input",{type:"checkbox",class:"hidden",name:i.id,value:i.value,"onUpdate:modelValue":u[0]||(u[0]=d=>l.value=d),disabled:i.disabled},null,8,Wt),[[t.vModelCheckbox,l.value]]),t.createElementVNode("span",Xt,[i.icon||i.imgUrl?(t.openBlock(),t.createElementBlock("span",Qt,[i.icon?(t.openBlock(),t.createElementBlock("i",{key:0,class:t.normalizeClass(i.icon)},null,2)):t.createCommentVNode("",!0),i.imgUrl?(t.openBlock(),t.createElementBlock("img",{key:1,src:i.imgUrl,width:"16",height:"16",alt:"icon"},null,8,es)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0),t.renderSlot(i.$slots,"default",{},()=>[t.createTextVNode(t.toDisplayString(i.label),1)])])],2))}}),ss={class:"flex items-center"},Ue=t.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:e}){const s=o,n=e,l=`radio-${Math.floor(Math.random()*1e4)}`,r=t.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 u=[...s.modelValue];i?u.includes(s.value)||u.push(s.value):u=u.filter(d=>d!==s.value),n("update:modelValue",u)}else n("update:modelValue",i)}}),a=t.ref(`vs-checkbox-${s.view||"default"}`);return(i,u)=>(t.openBlock(),t.createElementBlock("div",ss,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(a.value==="vs-checkbox-buttons"?t.unref(ts):t.unref(Jt)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:r.value,"onUpdate:modelValue":u[0]||(u[0]=d=>r.value=d),id:l,icon:i.icon,imgUrl:i.imgUrl,style:t.normalizeStyle(i.style),error:i.error},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),ns={},ls={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function rs(o,e){return t.openBlock(),t.createElementBlock("svg",ls,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const as=I(ns,[["render",rs]]),os={},is={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 us(o,e){return t.openBlock(),t.createElementBlock("svg",is,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),t.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const ds=I(os,[["render",us]]),cs={},ps={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 hs(o,e){return t.openBlock(),t.createElementBlock("svg",ps,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M12 9h.01"},null,-1),t.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),t.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 ms=I(cs,[["render",hs]]),fs={key:0,class:"flex items-start gap-x-1"},gs={key:0,class:"text-red-500 text-[14px]"},ks=["title"],bs=["disabled"],Ae=t.defineComponent({__name:"vs-input-switcher",props:t.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 e=o,s=t.useModel(o,"modelValue");return(n,l)=>e.view==="checkbox"?(t.openBlock(),t.createElementBlock("div",fs,[t.createVNode(Ue,{modelValue:s.value,"onUpdate:modelValue":l[0]||(l[0]=r=>s.value=r),label:n.text,error:n.error||""},null,8,["modelValue","label","error"]),n.rules?.includes("required")?(t.openBlock(),t.createElementBlock("span",gs,"*")):t.createCommentVNode("",!0),n.i?(t.openBlock(),t.createElementBlock("button",{key:1,class:"cursor-pointer",title:n.i,onClick:l[1]||(l[1]=t.withModifiers(()=>{},["prevent"]))},[t.createVNode(t.unref(ms),{class:"text-gray-500 w-[14px] h-[14px]"})],8,ks)):t.createCommentVNode("",!0)])):(t.openBlock(),t.createElementBlock("button",{key:1,type:"button",class:t.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]=r=>s.value=!s.value)},[t.createElementVNode("span",{"data-state":"checked",class:t.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,bs))}}),ys=["innerHTML"],$e=t.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(o){return(e,s)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(e.customClass),innerHTML:e.html?e.html:e.text},null,10,ys))}}),xs=["placeholder","disabled","name"],Pe=t.defineComponent({__name:"vs-input-mask",props:t.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 e=o,{inputClass:s}=ae(e.style),n=t.useModel(o,"modelValue"),l=t.ref(null);let r=null;return t.onMounted(async()=>{if(l.value){const{default:a}=await Promise.resolve().then(()=>Co);r=a(l.value,{mask:e.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),r.on("accept",()=>{n.value=e.unmask?r.unmaskedValue:r.value}),r.on("complete",()=>{n.value=e.unmask?r.unmaskedValue:r.value}),r.value=n.value??""}}),t.onBeforeUnmount(()=>{r?.destroy()}),t.watch(()=>e.mask,a=>{r&&r.updateOptions({mask:a,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),t.watch(n,a=>{r&&r.unmaskedValue!==a&&(r.value=a||"")}),(a,i)=>(t.openBlock(),t.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:l,placeholder:a.placeholder,disabled:a.disabled,name:a.name,class:t.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[t.unref(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,xs))}}),_s={class:"relative w-full bg-white rounded-lg"},ws=["placeholder","disabled"],He=t.defineComponent({__name:"vs-input-email",props:t.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 e=o,{inputClass:s}=ae(e.style),n=t.useModel(o,"modelValue");return(l,r)=>(t.openBlock(),t.createElementBlock("div",_s,[r[1]||(r[1]=t.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)),t.withDirectives(t.createElementVNode("input",{type:"email","onUpdate:modelValue":r[0]||(r[0]=a=>n.value=a),placeholder:l.placeholder,disabled:l.disabled,class:t.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[t.unref(s),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,ws),[[t.vModelText,n.value]])]))}}),Es=["value","disabled"],Vs={class:"text-[13px] text-gray-700"},Cs=t.defineComponent({__name:"vs-input-radio-default",props:t.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=t.useModel(o,"modelValue");return(s,n)=>(t.openBlock(),t.createElementBlock("label",{class:t.normalizeClass(["flex items-center gap-0",[s.customClass]])},[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":n[0]||(n[0]=l=>e.value=l),type:"radio",value:s.value,disabled:s.disabled,class:"hidden"},null,8,Es),[[t.vModelRadio,e.value]]),t.createElementVNode("span",{class:t.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":""]])},[e.value==s.value?(t.openBlock(),t.createElementBlock("span",{key:0,class:t.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${s.style?.primaryColor||"blue"}-500`]])},null,2)):t.createCommentVNode("",!0)],2),t.createElementVNode("span",Vs,t.toDisplayString(s.text),1)],2))}}),vs=["value","disabled"],Bs={class:"text-[13px] text-gray-700"},Ns={"vs-input-radio-default":Cs,"vs-input-radio-buttons":t.defineComponent({__name:"vs-input-radio-buttons",props:t.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=t.useModel(o,"modelValue");return(s,n)=>(t.openBlock(),t.createElementBlock("label",{class:t.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[e.value==s.value?`ring-2 ring-ring ring-${s.style?.primaryColor||"blue"}-500`:"",s.customClass]])},[t.withDirectives(t.createElementVNode("input",{"onUpdate:modelValue":n[0]||(n[0]=l=>e.value=l),type:"radio",value:s.value,disabled:s.disabled,class:"hidden"},null,8,vs),[[t.vModelRadio,e.value]]),t.createElementVNode("span",Bs,t.toDisplayString(s.text),1)],2))}})},De=t.defineComponent({__name:"vs-input-radio",props:t.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 e=o,s=t.useModel(o,"modelValue"),n=t.computed(()=>Ns[`vs-input-radio-${e.view}`]);return(l,r)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass([l.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.options,a=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(n.value),t.mergeProps({key:a?.id,text:a.text,value:a.id.toString(),checked:s.value===a.id,modelValue:s.value,"onUpdate:modelValue":r[0]||(r[0]=i=>s.value=i)},{ref_for:!0},l.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),qe=I(t.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:e}){const s=o,n=e,l=t.ref([]),r=t.reactive({}),a=c=>c?.value||c?.id||c?.text||c,i=c=>c.text||String(c),u=c=>`lg:col-span-${c||12}`,d=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 t.watch(()=>s.modelValue,c=>{if(typeof c=="boolean"&&l.value.length===1){const p=a(l.value[0]);r[p]=c}else if(Array.isArray(c)){const p=new Set(c);l.value.forEach(h=>{if(!h.disabled){const w=a(h);r[w]=p.has(w)}})}},{immediate:!0}),t.watch(r,()=>{if(!l.value.length){n("update:modelValue",null);return}const c=Object.entries(r).filter(([,p])=>p).map(([p])=>p);n("update:modelValue",c.length===0?[]:c)},{deep:!0}),t.onMounted(()=>{if(s.data)d().then(()=>{if(typeof s.modelValue=="boolean"&&l.value.length===1){const c=a(l.value[0]);r[c]=s.modelValue}else if(Array.isArray(s.modelValue)){const c=new Set(s.modelValue);l.value.forEach(p=>{if(!p.disabled){const h=a(p);r[h]=c.has(h)}})}});else if(l.value=s.options,typeof s.modelValue=="boolean"&&l.value.length===1){const c=a(l.value[0]);r[c]=s.modelValue}else if(Array.isArray(s.modelValue)){const c=new Set(s.modelValue);l.value.forEach(p=>{if(!p.disabled){const h=a(p);r[h]=c.has(h)}})}}),(c,p)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["p-0 w-full gap-[6px]",[c.position==="vertical"?"flex-col":"",c.colSpan?"grid":"flex justify-start"]])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,h=>(t.openBlock(),t.createBlock(Ue,{modelValue:r[a(h)],"onUpdate:modelValue":w=>r[a(h)]=w,value:a(h),class:t.normalizeClass(u(c.colSpan)),disabled:h.disabled,label:i(h),key:a(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"]]),Ss=["placeholder","disabled"],Ge=t.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},emits:["update:modelValue"],setup(o,{emit:e}){const s=o,{inputClass:n}=ae(s.style),l=e,r=t.computed({get:()=>s.modelValue?.split(" ")[0],set:a=>l("update:modelValue",a)});return(a,i)=>t.withDirectives((t.openBlock(),t.createElementBlock("input",{type:"date","onUpdate:modelValue":i[0]||(i[0]=u=>r.value=u),placeholder:a.placeholder,disabled:a.disabled,ref:"date",class:t.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[a.modelValue?"":"text-opacity-50",t.unref(n)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Ss)),[[t.vModelText,r.value]])}}),Fs=async(o,e,s,n)=>{try{const l=new FormData;return l.append("unique","true"),l.append("file",o),(await fetch(`/file/upload/uploads?id=${e||""}&form=${s||""}&table=${n||""}`,{method:"POST",body:l}).then(a=>a.json()))?.result}catch(l){return W.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",l),null}},Ms=async o=>{try{return await fetch(`file/delete${o}`),!0}catch(e){return console.error(e),!1}},Ke=async o=>{try{const e=await fetch(`file/download/files/uploads${o}`),s=await e.arrayBuffer(),n=e.headers["content-type"],l=new TextDecoder("utf-8").decode(s),r=new Blob([l],{type:n}),a=document.createElement("a");a.setAttribute("download",o),a.href=window.URL.createObjectURL(r),a.click()}catch(e){console.error(e.message)}},As={},$s={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 Ds(o,e){return t.openBlock(),t.createElementBlock("svg",$s,e[0]||(e[0]=[t.createElementVNode("path",{d:"M5 12h14"},null,-1),t.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const be=I(As,[["render",Ds]]),Is={},Ls={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 Ts(o,e,s,n,l,r){return t.openBlock(),t.createElementBlock("svg",Ls,e[0]||(e[0]=[t.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 Os=I(Is,[["render",Ts]]),Rs={},zs={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 js(o,e,s,n,l,r){return t.openBlock(),t.createElementBlock("svg",zs,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),t.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),t.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const Us=I(Rs,[["render",js]]),Ps={},Hs={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-file-unknown"};function qs(o,e,s,n,l,r){return t.openBlock(),t.createElementBlock("svg",Hs,e[0]||(e[0]=[t.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="M12 17v.01"></path><path d="M12 14a1.5 1.5 0 1 0 -1.14 -2.474"></path>',5)]))}const Gs=I(Ps,[["render",qs]]),Ks={},Zs={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 Ys(o,e,s,n,l,r){return t.openBlock(),t.createElementBlock("svg",Zs,e[0]||(e[0]=[t.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 Js=I(Ks,[["render",Ys]]),Ws={},Xs={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 Qs(o,e,s,n,l,r){return t.openBlock(),t.createElementBlock("svg",Xs,e[0]||(e[0]=[t.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 en=I(Ws,[["render",Qs]]),tn=o=>{if(!o)return"";const e=o?.split(".");return e[e.length-1]},sn=o=>{const e=tn(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(e)?"img":s.sheetsFormat.includes(e)?Us:s.textsFormat.includes(e)?en:s.documentsFormat.includes(e)?Os:s.archivesFormat.includes(e)?Js:Gs},nn={},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-trash"};function rn(o,e){return t.openBlock(),t.createElementBlock("svg",ln,e[0]||(e[0]=[t.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 Ce=I(nn,[["render",rn]]),an={},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",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function un(o,e){return t.openBlock(),t.createElementBlock("svg",on,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),t.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),t.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Ze=I(an,[["render",un]]),dn={class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},cn={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},Ye=I(t.defineComponent({__name:"vs-input-file-list-item",props:t.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 e=t.useModel(o,"value"),s=t.useModel(o,"item"),n=o;return(l,r)=>(t.openBlock(),t.createElementBlock("div",dn,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(t.unref(sn)(s.value)),{src:s.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:r[0]||(r[0]=a=>t.unref(Ke)(s.value))},null,8,["src"])),t.createElementVNode("div",cn,[t.createElementVNode("button",{type:"button",onClick:r[1]||(r[1]=a=>{t.unref(Ms)(s.value),e.value=n.multiple?e.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"},[t.createVNode(Ce,{class:"w-4 h-4"})]),t.createElementVNode("button",{type:"button",onClick:r[2]||(r[2]=a=>t.unref(Ke)(s.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[t.createVNode(Ze,{class:"w-4 h-4"})])])]))}}),[["__scopeId","data-v-0ca886b3"]]),pn={class:"flex items-center gap-x-2"},hn={key:1,class:"flex items-center flex-wrap gap-2"},Je=t.defineComponent({__name:"vs-input-file",props:t.mergeModels({format:{},multiple:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,s=t.useModel(o,"modelValue"),n=t.ref(null),l=a=>Array.isArray(s.value)&&s.value[a]||"",r=async a=>{if(e.format){const d=a.target.files?.[0];if(!d||!d.name.endsWith(e.format))return}const i=a.target.files?.[0];if(!i)return;const u=await Fs(i,"1","form","table");s.value=e.multiple?[...s.value||[],u?.file_path]:u?.file_path};return(a,i)=>(t.openBlock(),t.createElementBlock("div",pn,[t.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:n,type:"file",onChange:r},null,544),!a.multiple&&s.value?(t.openBlock(),t.createBlock(Ye,{key:0,item:s.value,"onUpdate:item":i[0]||(i[0]=u=>s.value=u),value:s.value,"onUpdate:value":i[1]||(i[1]=u=>s.value=u)},null,8,["item","value"])):a.multiple?(t.openBlock(),t.createElementBlock("div",hn,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(s.value,(u,d)=>(t.openBlock(),t.createBlock(Ye,{multiple:a.multiple,key:d,value:s.value,"onUpdate:value":i[2]||(i[2]=c=>s.value=c),item:l(d)},null,8,["multiple","value","item"]))),128)),t.createElementVNode("div",{onClick:i[3]||(i[3]=u=>!a.disabled&&n.value?.click()),class:t.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",a.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[t.createVNode(be,{class:"w-6 h-6"})],2)])):t.createCommentVNode("",!0),a.multiple?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",{key:2,onClick:i[4]||(i[4]=u=>n.value?.click()),class:t.normalizeClass([a.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"])},[t.createVNode(be,{class:"w-6 h-6"})],2))]))}}),mn={class:"max-w-[55vw]"},fn={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},gn={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},kn={class:"px-[5px]"},bn={class:""},ve=t.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(o){const e=o,s=t.computed(()=>{try{return new Date(e.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function n(l){if(l<1024)return`${l} B`;const r=l/1024;return r<1024?`${r.toFixed(2)} KB`:`${(r/1024).toFixed(2)} MB`}return(l,r)=>(t.openBlock(),t.createElementBlock(t.Fragment,null,[r[1]||(r[1]=t.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)),t.createElementVNode("div",mn,[t.createElementVNode("p",fn,t.toDisplayString(l.item?.uploaded_name),1),t.createElementVNode("p",gn,[t.createElementVNode("span",null,t.toDisplayString(l.item?.username),1),t.withDirectives(t.createElementVNode("span",kn,"|",512),[[t.vShow,l.item?.username]]),t.createElementVNode("span",null,t.toDisplayString(s.value),1),r[0]||(r[0]=t.createElementVNode("span",{class:"px-[5px]"},"|",-1)),t.createElementVNode("span",bn,t.toDisplayString(n(l.item?.size)),1)])])],64))}}),yn={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},xn={key:0,class:"flex w-full gap-x-3 items-center"},_n={key:1,class:"flex gap-x-3 w-full items-center"},wn={key:2,class:"flex gap-x-3 w-full items-center"},En=["href"],Vn={key:3,class:"flex gap-x-3 w-full items-center"},Cn={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},vn={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"},Bn={class:"inline-block"},Nn={class:"inline-block"},Sn=t.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(o,{emit:e}){const s=o,n=e;function l(c){return["pdf","json"].includes(c.ext)}function r(c){return["ppt","pptx","doc","docx","xls","xlsx"].includes(c.ext)}function a(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 u(){n("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function d(c){(s.item.ext==="jpg"||s.item.ext==="png")&&n("openLightbox",{item:s.item,index:c})}return(c,p)=>(t.openBlock(),t.createElementBlock("div",yn,[c.item.ext==="jpg"||c.item.ext==="png"?(t.openBlock(),t.createElementBlock("div",xn,[t.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:p[0]||(p[0]=h=>d(c.index))},[t.createVNode(ve,{item:c.item},null,8,["item"])])])):l(c.item)?(t.openBlock(),t.createElementBlock("div",_n,[t.createVNode(ve,{item:c.item},null,8,["item"])])):r(c.item)?(t.openBlock(),t.createElementBlock("div",wn,[t.createElementVNode("a",{href:`/api/file-preview?id=${c.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[t.createVNode(ve,{item:c.item},null,8,["item"])],8,En)])):(t.openBlock(),t.createElementBlock("div",Vn,[t.createVNode(ve,{item:c.item},null,8,["item"])])),t.createElementVNode("div",Cn,[t.createElementVNode("div",vn,[t.createElementVNode("div",Bn,[t.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=>a(c.item))},[t.createVNode(Ze,{height:"14",width:"14"})])]),p[3]||(p[3]=t.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),t.createElementVNode("div",Nn,[t.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=>u())},[t.createVNode(Ce,{height:"14",width:"14"})])])])])]))}}),Fn={},Mn={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 An(o,e){return t.openBlock(),t.createElementBlock("svg",Mn,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),t.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),t.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const $n=I(Fn,[["render",An]]),Dn={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},In={class:"flex w-full mb-[12px] items-center gap-x-2"},Ln={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},Tn={class1:"ml-auto"},On={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"},Rn={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},zn={class:"relative"},jn={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"},Un={key:0},We=t.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:e}){const s=o,n=t.inject("form"),l=t.computed(()=>n.value.formId),r=t.ref(!1),a=t.ref(0),i=e,u=t.ref(!1),d=t.ref({}),c=t.ref([]),p=t.ref(""),h=t.computed(()=>Array.isArray(c.value)?c.value.filter(g=>g.ext==="jpg"||g.ext==="png").map(g=>g?.file_path):[]),w=t.computed(()=>p.value===""?c.value:c.value.filter(g=>g?.uploaded_name?.includes(p.value))),y=g=>{const k=h.value.findIndex(P=>P===g.item.file_path);k!==-1&&(r.value=!0,a.value=k)},V=async()=>{try{const g=await fetch(`${s.prefix}/widget/file/${l.value}`).then(k=>k.json());c.value=g?.rows}catch(g){console.error(g)}},v=async g=>{await Promise.all(Array.from(g.target.files).map(async k=>{const P=new FormData;P.append("file",k);try{const D=`${s.prefix}/widget/file/${l.value}`;return await fetch(D,{method:"POST",body:P}),i("update","file-list"),k}catch(D){return console.error(D),null}})),await V()},$=g=>{const k={...g};return g.cancel||(k.cancel=()=>{u.value=!1}),g.updateListOnConfirm&&(k.confirm=async()=>{await g.confirm(),u.value=!1,V()}),k},_=g=>{d.value=$(g),u.value=!0};return t.watch(l,g=>{g&&V()}),t.onMounted(()=>{l.value&&V()}),(g,k)=>{const P=t.resolveComponent("Lightbox"),D=t.resolveComponent("MessageBox");return t.openBlock(),t.createElementBlock("div",Dn,[t.createElementVNode("div",In,[t.createElementVNode("h2",Ln," Файлів: "+t.toDisplayString(c.value?.length),1),t.createElementVNode("div",Tn,[t.createElementVNode("label",null,[t.createElementVNode("input",{type:"file",class:"hidden",onChange:k[0]||(k[0]=N=>v(N))},null,32),t.createElementVNode("div",On,[t.createVNode($n,{height:"16",width:"16"})])])])]),c.value?.length>4?(t.openBlock(),t.createElementBlock("div",Rn,[t.createElementVNode("div",null,[t.createElementVNode("div",zn,[k[8]||(k[8]=t.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[t.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"},[t.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),t.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),t.withDirectives(t.createElementVNode("input",{type:"text","onUpdate:modelValue":k[1]||(k[1]=N=>p.value=N),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),[[t.vModelText,p.value,void 0,{trim:!0}]])])])])):t.createCommentVNode("",!0),c.value?.length?(t.openBlock(),t.createElementBlock("div",jn,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(w.value,(N,U)=>(t.openBlock(),t.createBlock(Sn,{key:U,prefix:g.prefix,item:N,index:U,onUpdate:k[2]||(k[2]=Z=>g.$emit("update","file-list")),onOpenModal:k[3]||(k[3]=Z=>_(Z)),onOpenLightbox:k[4]||(k[4]=Z=>y(Z))},null,8,["prefix","item","index"]))),128)),w.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("div",Un,k[9]||(k[9]=[t.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):t.createCommentVNode("",!0),t.createVNode(P,{modelValue:r.value,"onUpdate:modelValue":k[5]||(k[5]=N=>r.value=N),startIndex:a.value,"onUpdate:index":k[6]||(k[6]=N=>a.value=N),images:h.value},null,8,["modelValue","startIndex","images"]),t.createVNode(D,t.mergeProps({modelValue:u.value,"onUpdate:modelValue":k[7]||(k[7]=N=>u.value=N),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),Pn={class:"flex items-center justify-between"},Hn={class:"text-[16px] text-gray-900 font-medium"},qn={class:"grid gap-3"},Gn=I(t.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(o){const e=o,s=t.ref(e.isOpen);return t.watch(()=>e.isOpen,n=>{s.value=n}),(n,l)=>(t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",Pn,[t.createElementVNode("p",Hn,t.toDisplayString(o.title),1),t.createVNode(Ae,{modelValue:s.value,"onUpdate:modelValue":l[0]||(l[0]=r=>s.value=r),style:t.normalizeStyle(o.style)},null,8,["modelValue","style"])]),t.createVNode(t.Transition,{name:"slide-fade"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",qn,[t.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[t.vShow,s.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),Kn={class:"text-[16px] text-gray-900 font-medium"},Zn={class:"grid gap-3"},Yn=I(t.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(o){const e=o,s=t.ref(e.isOpen);return t.watch(()=>e.isOpen,n=>{s.value=n}),(n,l)=>(t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("button",{type:"button",onClick:l[0]||(l[0]=r=>s.value=!s.value),class:"flex items-center gap-2"},[t.createVNode(t.unref(as),{class:t.normalizeClass(["h-4 w-4 duration-300",[s.value?"-rotate-180":""]])},null,8,["class"]),t.createElementVNode("span",Kn,t.toDisplayString(o.title),1)]),t.createVNode(t.Transition,{name:"slide-fade"},{default:t.withCtx(()=>[t.withDirectives(t.createElementVNode("div",Zn,[t.renderSlot(n.$slots,"default",{},void 0,!0)],512),[[t.vShow,s.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),Jn={class:"flex items-center justify-between"},Wn={switcher:Gn,accordion:Yn,default:t.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(o){return(e,s)=>(t.openBlock(),t.createElementBlock("div",null,[t.createElementVNode("div",Jn,[t.createElementVNode("p",null,t.toDisplayString(o.title),1)]),t.renderSlot(e.$slots,"default")]))}})},J={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Xn=(o,e)=>String(o)===String(e),Qn=(o,e)=>String(o)!==String(e),el=(o,e)=>o>e,tl=(o,e)=>o>=e,sl=(o,e)=>o<e,nl=(o,e)=>o<=e,ll=(o,e)=>Array.isArray(e)&&e.length===2?o>=e[0]&&o<=e[1]:!1,rl=(o,e)=>String(o).startsWith(String(e)),al=(o,e)=>String(o).endsWith(String(e)),ol=(o,e)=>String(o).includes(String(e)),il=(o,e)=>Array.isArray(e)?e.includes(o):!1,ul=(o,e)=>Array.isArray(e)?!e.includes(o):!0,Xe=(o,e)=>{if(!e)return!0;switch(e?.[1]){case J.Equal:return Xn(o,e?.[2]);case J.Inequal:return Qn(o,e?.[2]);case J.Higer:return el(o,e?.[2]);case J.HigerOrEqual:return tl(o,e?.[2]);case J.Lower:return sl(o,e?.[2]);case J.LowerOrEqual:return nl(o,e?.[2]);case J.Between:return ll(o,e?.[2]);case J.StartWith:return rl(o,e?.[2]);case J.EndWith:return al(o,e?.[2]);case J.Contain:return ol(o,e?.[2]);case J.In:return il(o,e?.[2]);case J.NotIn:return ul(o,e?.[2]);default:return!0}},Qe=t.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 e=o,s=t.inject("formValues",{default:{}}),n=t.inject("form"),l=t.computed(()=>e.schema?.filter(a=>{const i=a?.conditions;if(!i)return!0;const u=Array.isArray(i)?i[0]:i,d=s?.value?.[u];return Xe(d,i)})),r=t.computed(()=>Wn[e.view]);return(a,i)=>o.schema?.length?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(r.value),{key:0,title:o.title,style:t.normalizeStyle(o.style)},{default:t.withCtx(()=>[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(l.value,u=>(t.openBlock(),t.createBlock(dt,t.mergeProps({key:u.name},{ref_for:!0},u,{item:u,modelValue:t.unref(s)[u.name],"onUpdate:modelValue":d=>t.unref(s)[u.name]=d,style:o.style,error:t.unref(n)?.errors?.[u.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):t.createCommentVNode("",!0)}}),dl={class:"relative"},cl={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},pl={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"},hl={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},ml={class:"font-medium text-gray-800 dark:text-[#ffffff]"},fl={class:"p-4 mim-h-0 h-full overflow-auto"},et=t.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(o,{emit:e}){const s=o,n=e,l=t.ref(s.schema),r=t.ref(s.defaultValue?JSON.parse(JSON.stringify(s.defaultValue)):{}),a=t.ref({}),i=t.ref(),u=t.ref(s.mode);async function d(){const p=a.value.validate();if(p){W.notify({type:"warning",title:"Помилка валідації",message:Object.entries(p).map(([h,w])=>`${h}: ${w}`).join(`
|
|
2
|
+
`)});return}if(i.value)try{const h=await fetch(`/api/table/${i.value}`,{method:u.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r.value)});if(h.ok)await h.json(),W.notify({type:"success",title:"Успішно",message:`Дані успішно ${u.value==="add"?"збережено":"оновлено"}`}),n("save",r.value);else if(h.status===400){const w=await h.json().catch(()=>({}));W.notify({type:"warning",title:"Помилка валідації",message:w.message||"Некоректні дані (400)"})}else h.status===500?W.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):W.notify({type:"error",title:"Помилка",message:`Статус: ${h.status}`})}catch(h){W.notify({type:"error",title:"Помилка з’єднання",message:h.message||"Не вдалося виконати запит"})}}function c(){n("close")}return t.onMounted(async()=>{if(s.form){const p=await fetch(`/api/template/form/${s.form}`).then(h=>h.json());l.value=p.schema,i.value=p.token}else if(s.token){i.value=s.token;const p=await fetch(`/api/form/${i.value}`).then(h=>h.json());l.value=p.schema,p.data?r.value=p.data:u.value="add"}}),(p,h)=>(t.openBlock(),t.createElementBlock("div",dl,[t.createElementVNode("div",cl,[t.createElementVNode("div",pl,[t.createElementVNode("div",hl,[t.createElementVNode("h3",ml,t.toDisplayString(u.value==="add"?"Додати":"Змінити"),1),t.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]=[t.createElementVNode("span",{class:"sr-only"},"Close",-1),t.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"},[t.createElementVNode("path",{d:"M18 6 6 18"}),t.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),t.createElementVNode("div",fl,[l.value?(t.openBlock(),t.createBlock(me,{key:0,schema:l.value,values:r.value,"onUpdate:values":h[0]||(h[0]=w=>r.value=w),form:a.value,"onUpdate:form":h[1]||(h[1]=w=>a.value=w)},null,8,["schema","values","form"])):t.createCommentVNode("",!0)]),t.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"},[t.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"}," Скасувати "),t.createElementVNode("button",{onClick:d,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])])])]))}}),Ie=(o={mode:"edit",schema:null})=>new Promise(e=>{const{close:s}=W.modal({title:o.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:et,contentProps:{...o,onClose:()=>{e(null),s()},onSave:n=>{e(n),s()}}})}),gl=["aria-expanded","data-focus"],kl={class:"flex items-center"},bl=["title"],yl=["onClick"],xl=["title"],_l={key:2,class:"text-gray-500 truncate"},wl={class:"flex-1 min-w-[2px]"},El=["placeholder"],Vl={class:"flex items-center shrink-0"},Cl=["disabled"],vl=["disabled"],Bl={key:0,class:"absolute z-10 w-full mt-2 rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]",role:"listbox"},Nl=["aria-disabled","onClick"],Sl={key:1,class:"px-3 py-2 text-center text-gray-500"},Fl=["disabled"],tt=t.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:{},options:{default:()=>[]},api:{},maxHeight:{default:400},parent:{},add:{},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},emits:["change","update:modelValue"],setup(o,{emit:e}){const s=o,n=e,l=t.computed(()=>s.multiple),r=t.computed(()=>s.disabled);ae(s.style);const a=t.computed({get:()=>s.modelValue,set:f=>n("update:modelValue",f)});!a.value&&s.defaultValue&&(a.value=s.defaultValue);const i=t.ref(null),u=t.ref(null),d=t.ref(null),c=t.ref(!1),p=t.ref(!1),h=t.ref(null),w=t.ref([]),y=t.ref(-1),V=t.ref([]),v=t.ref(""),$=t.ref(null),_=t.ref([]),g=t.computed(()=>{if(!_.value.length)return[];const f=new Map(w.value.map(b=>[b.id?.toString(),b]));return _.value.map(b=>f.get(b?.toString())).filter(b=>!!b)}),k=t.computed(()=>s.placeholder||"Select..."),P=t.computed(()=>l.value?!_.value.length&&v.value==="":!h.value?.text&&v.value===""),D=t.computed(()=>r.value?!1:l.value?_.value.length>0:!!a.value),N=f=>l.value?_.value.some(b=>b?.toString()===f?.toString()):a.value?.toString()===f?.toString(),U=t.computed(()=>{let f=w.value??[];if(!s.data&&v.value.trim()!==""){const b=v.value.toLowerCase();f=f.filter(F=>F.text?.toLowerCase?.().includes(b))}if(l.value&&_.value.length){const b=new Set(_.value.map(F=>F?.toString()));f=f.filter(F=>!b.has(F.id?.toString()))}return f}),Z=t.inject("values"),G=t.computed(()=>s.parent?Z?.value?.[s.parent]??null:null),se=async f=>{if(!s.data){let b=s.options??[];if(f?.trim()){const F=f.toLowerCase();b=b.filter(j=>j.text?.toLowerCase?.().includes(F))}return b}try{const b=s.host??"",F=s.prefix??"api",j=s.api??`/${F}/suggest/${s.data}`,le=`${b}${j}`,re=new URLSearchParams;return re.set("json","1"),f&&re.set("key",f),G.value!==void 0&&G.value!==null&&G.value!==""&&re.set("parent",String(G.value)),(await fetch(`${le}?${re.toString()}`).then(ze=>ze.json()))?.data??[]}catch{return[]}},ge=async()=>{s.data?w.value=await se(v.value):w.value=s.options?[...s.options]:[]},A=async f=>{if(f==null)return null;const b=w.value?.find(j=>j?.id?.toString()===String(f));return b||((await se(String(f)))?.[0]??null)},C=async f=>{const b=new Set(w.value.map(j=>j.id?.toString())),F=f.filter(j=>!b.has(j?.toString()));F.length&&await F.reduce(async(j,le)=>{await j;const re=await A(le);re&&w.value.push(re)},Promise.resolve())},S=async()=>{r.value||(c.value=!0,await ge(),await t.nextTick(()=>{$.value?.focus(),U.value.length?y.value=0:y.value=-1}))},R=()=>{c.value=!1,y.value=-1},Y=async f=>{if(r.value)return;!c.value?await S():R()},ue=async()=>{c.value?$.value?.focus():await S()},ne=()=>{l.value?(_.value=[],a.value=[],n("change",[])):(h.value=null,a.value=null,n("change",null)),v.value="",t.nextTick(()=>$.value?.focus())},m=f=>{l.value&&(_.value=_.value.filter(b=>b?.toString()!==f?.toString()),a.value=[..._.value],n("change",a.value),t.nextTick(()=>$.value?.focus()))},x=f=>{l.value?(N(f.id)||(_.value=[..._.value,f.id],a.value=[..._.value],n("change",a.value)),v.value="",t.nextTick(()=>{$.value?.focus(),y.value=Math.min(y.value,U.value.length-1)})):(h.value=f,a.value=f.id,n("change",a.value),v.value="",R())},T=f=>{N(f.id)||x(f)},z=(f,b)=>{if(!f||!b)return;const F=f.offsetTop,j=F+f.offsetHeight,le=b.scrollTop,re=le+b.clientHeight;let Me=b.scrollTop;F<le?Me=F-80:j>re&&(Me=j-b.clientHeight+4);const ze=b;ze.scrollTop=Me},X=async f=>{r.value||!c.value&&(f.key==="ArrowDown"||f.key==="ArrowUp")&&(f.preventDefault(),await S())},Ve=f=>{if(!c.value)return;const{key:b}=f;if(b==="ArrowDown")f.preventDefault(),y.value+1<U.value.length&&(y.value+=1,z(V.value[y.value],d.value));else if(b==="ArrowUp")f.preventDefault(),y.value>0&&(y.value-=1,z(V.value[y.value],d.value));else if(b==="Enter"){f.preventDefault();const F=U.value[y.value];F&&x(F),$.value?.blur()}else b==="Escape"?(f.preventDefault(),R()):b==="Backspace"?l.value&&v.value===""&&_.value.length&&(_.value=_.value.slice(0,-1),a.value=[..._.value],n("change",a.value)):b==="Home"?(y.value=0,z(V.value[0],d.value)):b==="End"?(y.value=U.value.length-1,z(V.value[y.value],d.value)):b==="Tab"&&R()},de=()=>{r.value||(p.value=!0)},he=()=>{p.value=!1,v.value=""},ce=f=>{f.key==="Escape"&&c.value&&R()},pe=f=>{i.value&&(i.value.contains(f.target)||R())},Ct=f=>{c.value&&d.value&&!d.value.contains(f.target)&&R()};t.watch(()=>s.options,f=>{f?.length&&(w.value=[...f])},{immediate:!0});const vt=async()=>{if(l.value)Array.isArray(a.value)?_.value=[...a.value]:(_.value=a.value==null?[]:[a.value],a.value=[..._.value]),!s.options?.length&&s.data&&await C(_.value);else{if(Array.isArray(a.value)){const f=a.value[0]??null;a.value=f??null}h.value=await A(a.value)}};t.watch(a,()=>{vt()}),t.onMounted(async()=>{addEventListener("keydown",ce),addEventListener("scroll",Ct,!0),document.addEventListener("click",pe,!0),s.options?.length?w.value=[...s.options]:s.data&&(w.value=await se("")),await vt()}),t.onUnmounted(()=>{removeEventListener("keydown",ce),removeEventListener("scroll",Ct,!0),document.removeEventListener("click",pe,!0)});async function vo(){if(!s.add)return;const f=await Ie({form:s.add.form,mode:"add"});f&&(await fetch(`/api/table/${s.add.token}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(f)}).then(b=>b.json()),!s.options?.length&&s.data&&(w.value=await se(v.value)))}function Bo(f,b=200){let F;return(...j)=>{F&&clearTimeout(F),F=window.setTimeout(()=>f(...j),b)}}const No=Bo(async f=>{w.value=await se(f)},200);return t.watch(v,f=>{s.data&&No(f.trim())}),t.watch(()=>s.options,f=>{!s.data&&f?.length&&(w.value=[...f])},{immediate:!0}),t.watch(()=>s.parent??s.parentValue,()=>{s.data&&ge()}),t.watch(G,async()=>{s.data&&(l.value?(_.value=[],a.value=[],n("change",[])):(h.value=null,a.value=null,n("change",null)))}),(f,b)=>(t.openBlock(),t.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:b[2]||(b[2]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",{class:t.normalizeClass(["relative w-full font-sans",s.customClass])},[b[7]||(b[7]=t.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),b[8]||(b[8]=t.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),t.createElementVNode("div",{class:t.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",c.value||p.value?"border-blue-500 ring-1 ring-blue-500":"",r.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":c.value,"aria-haspopup":"listbox",onKeydown:X,onClick:ue,"data-focus":c.value||p.value?"true":"false"},[t.createElementVNode("div",{class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"triggerRef",ref:u},[l.value&&_.value.length?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(g.value,F=>(t.openBlock(),t.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border",key:F.id},[t.createElementVNode("div",kl,[F?.color?(t.openBlock(),t.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5",style:t.normalizeStyle({backgroundColor:F?.color})},null,4)):t.createCommentVNode("",!0),t.createElementVNode("div",{class:"truncate text-gray-900 overflow-hidden",title:F.text},t.toDisplayString(F.text),9,bl)]),t.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:t.withModifiers(j=>m(F.id),["stop"])},b[3]||(b[3]=[t.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"},[t.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,yl)]))),128)):!l.value&&!p.value&&h.value?.text&&v.value===""?(t.openBlock(),t.createElementBlock("div",{key:1,class:t.normalizeClass(["truncate text-gray-900"]),title:h.value.text},[h.value?.color?(t.openBlock(),t.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:t.normalizeStyle({backgroundColor:h.value?.color})},null,4)):t.createCommentVNode("",!0),t.createElementVNode("span",{class:t.normalizeClass({"pl-5":h.value?.color})},t.toDisplayString(h.value.text),3)],8,xl)):t.createCommentVNode("",!0),P.value?(t.openBlock(),t.createElementBlock("div",_l,t.toDisplayString(k.value),1)):t.createCommentVNode("",!0),t.createElementVNode("div",wl,[!r.value&&f.search?t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputRef",ref:$,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&&_.value.length?" ":null)||(p.value&&!v.value?.length?h.value?.text:" "),"onUpdate:modelValue":b[0]||(b[0]=F=>v.value=F),onFocus:de,onBlur:he,onKeydown:Ve},null,40,El)),[[t.vModelText,v.value]]):t.createCommentVNode("",!0)])],512),t.createElementVNode("div",Vl,[D.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:r.value,onClick:t.withModifiers(ne,["stop"])},b[4]||(b[4]=[t.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[t.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,Cl)):t.createCommentVNode("",!0),b[6]||(b[6]=t.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),t.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:r.value,onClick:b[1]||(b[1]=t.withModifiers(F=>Y(),["stop"]))},b[5]||(b[5]=[t.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[t.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,vl)])],42,gl),c.value?(t.openBlock(),t.createElementBlock("div",Bl,[t.createElementVNode("div",{class:"max-h-[300px] overflow-y-auto py-1",ref_key:"listRef",ref:d},[U.value.length?(t.openBlock(!0),t.createElementBlock(t.Fragment,{key:0},t.renderList(U.value,(F,j)=>(t.openBlock(),t.createElementBlock("div",{key:F.id,ref_for:!0,ref:le=>V.value[j]=le,class:t.normalizeClass(["flex px-3 py-2 cursor-default select-none hover:bg-blue-300",y.value===j?"bg-blue-300":"",N(F.id)?"text-white bg-blue-500":"text-gray-900 bg-white"]),"aria-disabled":N(F.id)?"true":"false",role:"option",tabindex:"-1",onClick:le=>T(F)},[F?.color?(t.openBlock(),t.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:t.normalizeStyle({backgroundColor:F?.color})},null,4)):t.createCommentVNode("",!0),t.createElementVNode("div",{class:t.normalizeClass(["leading-[19px]",y.value===F.id?"text-white":"",(y.value===j,"")])},t.toDisplayString(F.text),3)],10,Nl))),128)):(t.openBlock(),t.createElementBlock("div",Sl," No options "))],512)])):t.createCommentVNode("",!0)],2),s.add?(t.openBlock(),t.createElementBlock("button",{key:0,onClick:vo,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:r.value,type:"button"},[t.createVNode(be,{width:"16",height:"16"}),b[9]||(b[9]=t.createElementVNode("span",null,"Додати",-1))],8,Fl)):t.createCommentVNode("",!0)],512))}}),Ml=["placeholder","disabled"],st=t.defineComponent({__name:"vs-input-textarea",props:t.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,{inputClass:s}=ae(e.style),n=t.useModel(o,"modelValue");return(l,r)=>t.withDirectives((t.openBlock(),t.createElementBlock("textarea",{"onUpdate:modelValue":r[0]||(r[0]=a=>n.value=a),placeholder:l.placeholder,disabled:l.disabled,row:"2",class:t.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[t.unref(s)]]),style:{border:"1px solid #CFD9E0"}},null,10,Ml)),[[t.vModelText,n.value]])}}),Al={},$l={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 Dl(o,e){return t.openBlock(),t.createElementBlock("svg",$l,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),t.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const Il=I(Al,[["render",Dl]]),Ll={},Tl={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 Ol(o,e){return t.openBlock(),t.createElementBlock("svg",Tl,e[0]||(e[0]=[t.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),t.createElementVNode("path",{d:"M7 20V4"},null,-1),t.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),t.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const Rl=I(Ll,[["render",Ol]]),zl={},jl={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 Ul(o,e){return t.openBlock(),t.createElementBlock("svg",jl,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),t.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),t.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Pl=I(zl,[["render",Ul]]),Hl={},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"};function Gl(o,e){return t.openBlock(),t.createElementBlock("svg",ql,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),t.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),t.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Kl=I(Hl,[["render",Gl]]),Zl={},Yl={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 Jl(o,e){return t.openBlock(),t.createElementBlock("svg",Yl,e[0]||(e[0]=[t.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 nt=I(Zl,[["render",Jl]]),Wl={},Xl={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Ql(o,e){return t.openBlock(),t.createElementBlock("svg",Xl,e[0]||(e[0]=[t.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 er=I(Wl,[["render",Ql]]),tr={},sr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function nr(o,e){return t.openBlock(),t.createElementBlock("svg",sr,e[0]||(e[0]=[t.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 lr=I(tr,[["render",nr]]),rr={class:"vs-datatable border rounded-xl w-full flex-grow"},ar={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},or={class:"relative w-full"},ir={class:"table-wrapper flex gap-2"},ur={class:"vs-popover inline-block text-slate-700"},dr={class:"text-center"},cr={class:""},pr={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"},hr={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},mr={class:"text-sm items-center text-gray-800 flex gap-1"},fr={class:"w-full overflow-x-auto"},gr={class:"w-full table-auto caption-bottom text-sm"},kr={class:"[&_tr]:border-b"},br={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"},yr={class:"h-10 px-2 align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] w-12 text-center"},xr={key:0,colspan:"100%",class:"text-center"},_r={class:"w-full"},wr={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},Er=["onDragstart","onDragover","onDrop"],Vr={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},Cr={class:"flex items-center justify-center"},vr={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"},Br={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},Nr={class:"flex items-center justify-center gap-2"},Sr=["onClick"],Fr=["onClick"],Mr={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},lt=t.defineComponent({__name:"vs-input-datatable",props:t.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,s=t.useModel(o,"modelValue"),n=t.ref({}),l=t.ref(""),r=t.computed(()=>{if(!l.value)return s.value??[];const A=l.value.toLowerCase();return s.value.filter(C=>e.colModel?.some(S=>{const R=C[S.key];return R?Array.isArray(R)?R.join(", ").toLowerCase().includes(A):String(R).toLowerCase().includes(A):!1}))}),a=t.ref(null),i=t.ref(null),u=t.ref(!1),d=t.ref(null),c=t.ref({top:0,left:0}),p=A=>{a.value=A},h=A=>{i.value=A},w=A=>{if(a.value===null||a.value===A){a.value=null,i.value=null;return}const C=[...s.value],[S]=C.splice(a.value,1);C.splice(A,0,S),s.value=C,a.value=null,i.value=null},y=A=>{const S=A.currentTarget.getBoundingClientRect();c.value={top:S.bottom+window.scrollY,left:S.left+window.scrollX},u.value=!u.value},V=()=>{d.value&&d.value.click()},v=A=>{const S=A.target.files?.[0];if(!S)return;const R=new FileReader;R.onload=Y=>{try{const ue=Y.target?.result;if(typeof ue=="string"){const ne=JSON.parse(ue);Array.isArray(ne)&&s.value.push(...ne)}}catch(ue){console.error("Error parsing file:",ue)}},R.readAsText(S)},$=()=>{const A=JSON.stringify(s.value,null,2),C=new Blob([A],{type:"application/json"}),S=URL.createObjectURL(C),R=document.createElement("a");R.href=S,R.download="data.json",R.click(),URL.revokeObjectURL(S)};t.onMounted(async()=>{const A=e.colModel?.filter(C=>C.data);A?.length&&Promise.all(A.map(async C=>{n.value[C.key]=await fetch(`/api/suggest/${C.data}`).then(S=>S.json())}))});const _=t.ref(""),g=t.ref(!1);let k="edit",P=0;const D=t.ref({}),N=t.ref({});async function U(){_.value="Додати",g.value=!0,k="add",D.value={}}function Z(A,C){return n.value[C.key]&&A[C.key]?n.value[C.key].find(S=>S.id.toString()===A[C.key].toString())?.text??A[C.key]:A[C.key]||"-"}async function G(A,C){_.value="Редагувати",g.value=!0,k="edit",P=C,D.value={...A}}function se(){const A=N.value.validate();if(A){W.notify({type:"warning",title:"Помилка валідації",message:Object.entries(A).map(([C,S])=>`${C}: ${S}`).join(`
|
|
3
|
+
`)});return}k==="add"?Array.isArray(s.value)?s.value=[...s.value,D.value]:s.value=[D.value]:s.value=s.value.map((C,S)=>S===P?D.value:C),g.value=!1}function ge(A){s.value=s.value.filter((C,S)=>S!==A)}return(A,C)=>(t.openBlock(),t.createElementBlock("div",rr,[t.createElementVNode("div",ar,[t.createElementVNode("div",or,[t.createVNode(Il,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),t.withDirectives(t.createElementVNode("input",{type:"text","onUpdate:modelValue":C[0]||(C[0]=S=>l.value=S),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),[[t.vModelText,l.value]])]),t.createElementVNode("div",ir,[t.createElementVNode("input",{ref_key:"fileInput",ref:d,onChange:v,class:"hidden",accept:".json",type:"file"},null,544),t.createElementVNode("div",ur,[t.createElementVNode("div",dr,[t.createElementVNode("div",cr,[t.createElementVNode("button",{onClick:y,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"},[t.createVNode(Rl,{height:"16",width:"16"})])])])])]),(t.openBlock(),t.createBlock(t.Teleport,{to:"body"},[u.value?(t.openBlock(),t.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:t.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:c.value.top+"px",left:c.value.left+"px"}])},[t.createElementVNode("div",pr,[t.createElementVNode("div",hr,[t.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"},[t.createVNode(Pl,{class:"text-black",width:"14",height:"14"}),C[4]||(C[4]=t.createTextVNode(" Імпортувати ",-1))]),t.createElementVNode("button",{onClick:$,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[t.createElementVNode("span",mr,[t.createVNode(Kl,{class:"text-black",width:"14",height:"14"}),C[5]||(C[5]=t.createTextVNode(" Експортувати ",-1))])])])])],4)):t.createCommentVNode("",!0)])),t.createElementVNode("button",{onClick:U,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"},[t.createVNode(be),C[6]||(C[6]=t.createTextVNode(" Додати ",-1))])]),t.createElementVNode("div",fr,[t.createElementVNode("table",gr,[t.createElementVNode("thead",kr,[t.createElementVNode("tr",br,[t.createElementVNode("th",yr,[t.createVNode(nt,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(A.colModel,S=>(t.openBlock(),t.createElementBlock("th",{key:S.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]"},t.toDisplayString(S.ua||S.label),1))),128)),C[7]||(C[7]=t.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))])]),t.createElementVNode("tbody",{class:t.normalizeClass({"[&_tr:last-child]:border-0":!i.value})},[r.value.length===0?(t.openBlock(),t.createElementBlock("td",xr,[t.createElementVNode("div",_r,[t.createElementVNode("div",wr,[t.createVNode(er,{class:"w-48 mx-auto"}),C[8]||(C[8]=t.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[t.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),t.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(r.value,(S,R)=>(t.openBlock(),t.createElementBlock("tr",{key:S.id,class:t.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":a.value===R,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":i.value===R}]),draggable:"true",onDragstart:Y=>p(R),onDragover:t.withModifiers(Y=>h(R),["prevent"]),onDrop:Y=>w(R)},[t.createElementVNode("td",Vr,[t.createElementVNode("div",Cr,[t.createVNode(nt,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(A.colModel,Y=>(t.openBlock(),t.createElementBlock("td",{key:Y.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[t.createElementVNode("div",vr,t.toDisplayString(Z(S,Y)),1)]))),128)),t.createElementVNode("td",Br,[t.createElementVNode("div",Nr,[t.createElementVNode("button",{onClick:Y=>G(S,R),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"},[t.createVNode(lr,{width:"24",height:"24",class:"w-3 h-3"})],8,Sr),t.createElementVNode("button",{onClick:Y=>ge(R),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"},[t.createVNode(Ce,{width:"24",height:"24",class:"w-3 h-3"})],8,Fr)])])],42,Er))),128))],2)])]),t.createVNode(t.unref(W.VsModal),{visible:g.value,title:_.value,size:"lg"},{default:t.withCtx(()=>[t.createVNode(me,{schema:e.colModel,values:D.value,"onUpdate:values":C[1]||(C[1]=S=>D.value=S),form:N.value,"onUpdate:form":C[2]||(C[2]=S=>N.value=S)},null,8,["schema","values","form"]),t.createElementVNode("div",Mr,[t.createElementVNode("button",{type:"button",onClick:C[3]||(C[3]=S=>g.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),t.createElementVNode("button",{onClick:se,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"])]))}}),Ar={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 $r(o){return o?o.type==="FeatureCollection"||o.type==="Feature"?o:o.geom?{type:"Feature",geometry:{type:o.geom.type,coordinates:o.geom.coordinates},properties:{}}:o.type&&o.coordinates?{type:"Feature",geometry:o,properties:{}}:null:null}const Dr={},Ir={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 Lr(o,e){return t.openBlock(),t.createElementBlock("svg",Ir,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),t.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 Tr=I(Dr,[["render",Lr]]),Or={},Rr={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 zr(o,e){return t.openBlock(),t.createElementBlock("svg",Rr,e[0]||(e[0]=[t.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),t.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),t.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),t.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const jr=I(Or,[["render",zr]]),Ur={},Pr={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 Hr(o,e){return t.openBlock(),t.createElementBlock("svg",Pr,e[0]||(e[0]=[t.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 qr=I(Ur,[["render",Hr]]),Gr={},Kr={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 Zr(o,e){return t.openBlock(),t.createElementBlock("svg",Kr,e[0]||(e[0]=[t.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 Yr=I(Gr,[["render",Zr]]),Jr={},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 Xr(o,e){return t.openBlock(),t.createElementBlock("svg",Wr,e[0]||(e[0]=[t.createElementVNode("title",null,null,-1),t.createElementVNode("desc",null,null,-1),t.createElementVNode("defs",null,null,-1),t.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[t.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[t.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[t.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 Qr=I(Jr,[["render",Xr]]),ea={class:"form-geom__search"},ta={class:"map-search__input"},sa={class:"flex flex-nowrap relative"},na={class:"form-autocomplete relative min-w-[6rem] vsTailwind map-search__select hidden"},la={class:"flex items-center w-full"},ra={class:"max-w-[90%] truncate"},aa={key:0,class:"absolute z-[3100] mt-0.5 left-0 right-0"},oa={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"},ia={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"},ua=["onClick"],da={class:"flex justify-between items-center w-full"},ca={class:"flex items-center"},pa={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"},ha={class:"relative w-full"},ma={class:"vs-form-text relative bg-white rounded-lg"},fa={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"},ga={key:0},ka=["onClick"],ba={key:1,class:"px-3 py-2 text-xs text-gray-500"},ya={key:2,class:"px-3 py-2 text-xs text-gray-400"},xa=t.defineComponent({__name:"map-search",props:{placeholder:{default:"50, 30"}},emits:["goToCoordinates"],setup(o,{emit:e}){const s=e,n=t.ref(!1),l=t.ref("coordinates"),r=t.ref(""),a=t.ref([]),i=t.ref(!1),u=t.ref(!1);let d;const c=[{value:"coordinates",label:"Пошук по кординатам"},{value:"atu",label:"АТУ"},{value:"address",label:"Адресса"},{value:"search_here",label:"Пошук HERE"}],p=t.computed(()=>c.find(_=>_.value===l.value)?.label??"АТУ");function h(_){l.value=_.value,n.value=!1,r.value="",r.value&&V()}function w(_){_.target.closest(".map-search__input")||(n.value=!1)}t.onMounted(()=>document.addEventListener("click",w)),t.onUnmounted(()=>document.removeEventListener("click",w));async function y(_){let g;l.value==="atu"?g="/api/suggest/atu.nsdi.ato_level":l.value==="address"?g="/api/suggest/map.address_id":l.value==="search_here"&&(g="/api/gis-url-proxy");const k=new URL(g||"");return l.value==="search_here"?k.searchParams.set("searchtext",_):(l.value==="atu"||l.value==="address")&&k.searchParams.set("key",_),k.searchParams.set("limit","20"),k.searchParams.set("q",_),(await fetch(k.toString())).json()}function V(){if(i.value=!0,u.value=!0,l.value==="coordinates"){const _=r.value.trim().split(",");if(_.length===2){const g=parseFloat(_[0]),k=parseFloat(_[1]);!Number.isNaN(g)&&!Number.isNaN(k)&&s("goToCoordinates",[g,k])}return}d&&window.clearTimeout(d),d=window.setTimeout(async()=>{const _=r.value.trim();if(!_){a.value=[],u.value=!1;return}try{const g=await y(_);a.value=Array.isArray(g.features)?g.features:[]}catch{a.value=[]}finally{u.value=!1}},300)}function v(){r.value="",a.value=[],i.value=!1,u.value=!1}function $(_){s("goToCoordinates",_),i.value=!1,u.value=!1,a.value=[]}return(_,g)=>(t.openBlock(),t.createElementBlock("div",ea,[t.createElementVNode("div",ta,[t.createElementVNode("div",sa,[t.createElementVNode("div",na,[t.createElementVNode("button",{type:"button",onClick:g[0]||(g[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"},[t.createElementVNode("div",la,[t.createElementVNode("span",ra,t.toDisplayString(p.value),1)]),g[3]||(g[3]=t.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"},[t.createElementVNode("path",{d:"M6 9l6 6 6-6","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1))]),n.value?(t.openBlock(),t.createElementBlock("div",aa,[t.createElementVNode("div",oa,[t.createElementVNode("div",ia,[(t.openBlock(),t.createElementBlock(t.Fragment,null,t.renderList(c,k=>t.createElementVNode("div",{onClick:P=>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"},[t.createElementVNode("div",da,[t.createElementVNode("div",ca,[t.createElementVNode("div",null,t.toDisplayString(k.label),1)]),k.value===l.value?(t.openBlock(),t.createElementBlock("svg",pa,g[4]||(g[4]=[t.createElementVNode("polyline",{points:"20 6 9 17 4 12"},null,-1)]))):t.createCommentVNode("",!0)])],8,ua)),64))])])])):t.createCommentVNode("",!0)]),t.createElementVNode("div",ha,[t.createElementVNode("div",ma,[g[6]||(g[6]=t.createElementVNode("i",{class:"absolute bottom-1/2 translate-y-1/2 left-3 text-gray-500"},[t.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},[t.createElementVNode("circle",{cx:"11",cy:"11",r:"8","stroke-width":"2"}),t.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65","stroke-width":"2"})])],-1)),t.withDirectives(t.createElementVNode("input",{type:"text","onUpdate:modelValue":g[1]||(g[1]=k=>r.value=k),onInput:V,onFocus:g[2]||(g[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),[[t.vModelText,r.value]]),r.value?(t.openBlock(),t.createElementBlock("button",{key:0,onClick:v,class:"absolute right-2 bottom-1/2 translate-y-1/2 text-gray-500 hover:text-red-500","aria-label":"Очистити",type:"button"},g[5]||(g[5]=[t.createElementVNode("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[t.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]))):t.createCommentVNode("",!0),i.value&&l.value!=="coordinates"?(t.openBlock(),t.createElementBlock("div",fa,[a.value.length?(t.openBlock(),t.createElementBlock("ul",ga,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,k=>(t.openBlock(),t.createElementBlock("li",{key:k.properties.place_id,onClick:P=>$(k),class:"px-3 py-2 text-sm cursor-pointer hover:bg-gray-100"},t.toDisplayString(k.properties.display_name),9,ka))),128))])):u.value?(t.openBlock(),t.createElementBlock("div",ba,"Шукаю…")):(t.openBlock(),t.createElementBlock("div",ya,"Нічого не знайдено"))])):t.createCommentVNode("",!0)])])])])]))}}),_a={class:"bg-white/95 p-2 rounded-xl shadow border border-gray-200"},wa={class:"flex gap-2"},Ea=["onClick","title"],Va=["src"],Ca=t.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(o,{emit:e}){const s=o,n=t.ref(Object.keys(s.basemaps)[0]),l=e;function r(a){l("onLayerChange",a),n.value=a}return(a,i)=>(t.openBlock(),t.createElementBlock("div",_a,[t.createElementVNode("div",wa,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.basemaps,(u,d)=>(t.openBlock(),t.createElementBlock("div",{key:d,class:t.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":n.value===d}]),onClick:c=>r(d),title:u.name||d,role:"button",tabindex:"0"},[t.createElementVNode("img",{src:u.preview,alt:"",class:"w-14 h-14 object-cover"},null,8,Va)],10,Ea))),128))])]))}}),va={class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},Ba={class:"form-geom__panel flex gap-1 items-start mt-2"},Na={class:"flex items-center gap-1"},Sa=["disabled"],Fa={class:"absolute top-4 right-4 z-[1000]"},Ma={class:"flex flex-col gap-[2px]"},Aa=["aria-pressed"],$a=["aria-pressed"],Da=["aria-pressed"],Ia=["aria-pressed"],La={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"},Ta={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},Oa={class:"mr-auto"},Ra={class:"font-bold"},za={class:"flex items-center"},ja={class:"text-xs mr-2"},Ua={key:0,class:"text-xs"},Pa={key:1,class:"text-xs"},rt=I(t.defineComponent({__name:"vs-input-map",props:{tools:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(o,{emit:e}){const s=t.getCurrentInstance(),n=o,l=e,r=t.ref(null);let a,i,u;const d=t.ref(null),c=t.ref(null),p=t.ref(6),h=t.ref(0),w=t.ref(s?.appContext.config.globalProperties.$settings?.center||[50,30]),y=t.ref(null),V=ue();let v;const $=t.ref("topo100");function _(){return new Promise((m,x)=>{window.L&&window.L.Draw&&m(0);const T=X=>{if(Array.from(document.styleSheets).some(he=>he?.href?.includes(X)))return;const de=document.createElement("link");de.rel="stylesheet",de.href=X,document.head.appendChild(de)},z=X=>new Promise((Ve,de)=>{const he=Array.from(document.scripts).find(pe=>pe.src===X);if(he){he.addEventListener("load",()=>Ve()),he.addEventListener("error",pe=>de(pe));return}const ce=document.createElement("script");ce.src=X,ce.async=!0,ce.onload=()=>Ve(),ce.onerror=pe=>de(pe),document.body.appendChild(ce)});T("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),T("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(()=>m(0)).catch(x)})}function g(){const m=i.toGeoJSON();let x=null;m?.features?.length&&(x=m.features[0].geometry),l("update:modelValue",x),h.value=i.getLayers().length}function k(m=30){const x=i.getLayers();if(!x.length)return;const z=L.featureGroup(x).getBounds();z&&z.isValid()&&a.fitBounds(z,{padding:[m,m]})}function P(){d.value?.click()}const D=t.ref("");function N(m){return m instanceof L.Circle?"Circle":m instanceof L.Rectangle?"Rectangle":m instanceof L.Polygon&&!(m instanceof L.Rectangle)?"Polygon":m instanceof L.Polyline&&!(m instanceof L.Polygon)?"Polyline":m instanceof L.Marker?"Point":"Feature"}function U(m){if(m instanceof L.Circle){const x=m.getRadius();return Math.PI*(x*x)/1e6}if(m instanceof L.Polygon||m instanceof L.Rectangle)try{const x=m.getLatLngs(),T=Array.isArray(x[0])?x[0]:x,z=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea(T):0;return z?z/1e6:0}catch{return null}return null}function Z(m){return m instanceof L.Circle?m.getLatLng():m.getBounds?m.getBounds().getCenter():m.getLatLng?m.getLatLng():a.getCenter()}function G(){const m=i.getLayers();if(!m.length){y.value=null,h.value=0;return}const x=m[m.length-1],T=N(x),z=Z(x),X=U(x);y.value={type:T,center:z,areaKm2:X,layer:x},h.value=m.length}function se(){const m=y.value?.layer;m&&(m instanceof L.Circle&&m.getBounds?a.fitBounds(m.getBounds(),{padding:[30,30]}):m.getBounds?a.fitBounds(m.getBounds(),{padding:[30,30]}):m.getLatLng&&a.setView(m.getLatLng(),Math.max(p.value,14)))}function ge(){const m=y.value?.layer;m&&(i.removeLayer(m),g(),G())}t.onMounted(async()=>{await _(),L.drawLocal=Ar,a=L.map(r.value,{zoomControl:!1}).setView(w.value,10),L.control.zoom({position:"bottomright"}).addTo(a),$.value=Object.keys(V)[0],v=L.tileLayer(V[$.value].url,{maxZoom:19,minZoom:6}).addTo(a),i=new L.FeatureGroup().addTo(a),a.on(L.Draw.Event.CREATED,T=>{const{layer:z}=T;i.clearLayers(),i.addLayer(z),g(),G(),k(),D.value=""}),a.on(L.Draw.Event.EDITED,()=>{g(),G(),k()}),a.on(L.Draw.Event.DELETED,()=>{g(),G(),k()});let m=!1;a.on("mousemove",T=>{m||(a.invalidateSize(),m=!0),c.value=T.latlng}),a.on("zoomend",()=>{p.value=a.getZoom()});const x=$r(n.modelValue);if(x){const T=[];L.geoJSON(x).eachLayer(z=>T.push(z)),T.length&&i.addLayer(T[0]),g(),G(),k()}});function A(m){if(a){switch(u&&u.disable(),m){case"marker":u=new L.Draw.Marker(a);break;case"polyline":u=new L.Draw.Polyline(a);break;case"polygon":u=new L.Draw.Polygon(a);break;case"rectangle":u=new L.Draw.Rectangle(a);break;default:u=new L.Draw.Rectangle(a);break}u&&(u.enable(),D.value=m)}}function C(){const m=i.toGeoJSON(),x=new Blob([JSON.stringify(m,null,2)],{type:"application/json"}),T=URL.createObjectURL(x),z=document.createElement("a");z.href=T,z.download="data.geojson",z.click(),URL.revokeObjectURL(T)}function S(m){const x=m.target.files?.[0];if(!x)return;const T=new FileReader;T.onload=()=>{if(typeof T.result=="string")try{const z=JSON.parse(T.result);i.clearLayers(),z&&L.geoJSON({type:"Feature",geometry:z}).eachLayer(X=>{i.addLayer(X)}),g(),G(),k()}finally{m.target.value=""}},T.readAsText(x)}function R(m){a&&(v&&a.removeLayer(v),v=L.tileLayer(V[m].url,{maxZoom:19,minZoom:6}).addTo(a),$.value=m)}function Y(m){const x=L.latLng(m[0],m[1]);a.setView(x,13)}t.watch(()=>n.modelValue,m=>{i.clearLayers(),m&&L.geoJSON({type:"Feature",geometry:m}).eachLayer(x=>{i.addLayer(x)}),h.value=i.getLayers().length,G(),k()});function ue(){return s?.appContext.config.globalProperties.$settings?.basemaps?s?.appContext.config.globalProperties.$settings?.basemaps.map((m,x)=>Object.assign(m,{key:`b${x}`,preview:m.preview||m.url.replace("{z}/{x}/{y}.png","13/4790/2762.png")})).reduce((m,x)=>({...m,[x.key]:x}),{}):{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=t.ref(!1);return t.watch(ne,()=>{setTimeout(()=>{a.invalidateSize()},50)}),(m,x)=>(t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:ne.value}])},[t.createElementVNode("div",{ref_key:"mapContainer",ref:r,class:"w-full h-full"},null,512),t.createElementVNode("div",va,[t.createVNode(xa,{onGoToCoordinates:Y}),t.createElementVNode("div",Ba,[t.createElementVNode("div",Na,[t.createElementVNode("button",{type:"button",class:"vs-btn-row",onClick:P},"Import"),t.createElementVNode("button",{type:"button",class:"vs-btn-row",onClick:C,disabled:h.value===0},"Export ",8,Sa)]),t.createElementVNode("input",{ref_key:"importRef",ref:d,type:"file",onChange:S,accept:".json,.geojson",class:"hidden"},null,544)])]),t.createElementVNode("div",Fa,[t.createElementVNode("div",Ma,[t.createElementVNode("button",{class:t.normalizeClass(["vs-btn",{"vs-active":D.value==="marker"}]),"aria-pressed":D.value==="marker",title:"Point (P)","aria-label":"Draw point",onClick:x[0]||(x[0]=T=>A("marker"))},[t.createVNode(Tr)],10,Aa),t.createElementVNode("button",{class:t.normalizeClass(["vs-btn",{"vs-active":D.value==="polyline"}]),"aria-pressed":D.value==="polyline",title:"Line (L)","aria-label":"Draw polyline",onClick:x[1]||(x[1]=T=>A("polyline"))},[t.createVNode(jr)],10,$a),t.createElementVNode("button",{class:t.normalizeClass(["vs-btn",{"vs-active":D.value==="polygon"}]),"aria-pressed":D.value==="polygon",title:"Polygon (G)","aria-label":"Draw polygon",onClick:x[2]||(x[2]=T=>A("polygon"))},[t.createVNode(qr)],10,Da),t.createElementVNode("button",{class:t.normalizeClass(["vs-btn",{"vs-active":D.value==="rectangle"}]),"aria-pressed":D.value==="rectangle",title:"Rectangle (R)","aria-label":"Draw rectangle",onClick:x[3]||(x[3]=T=>A("rectangle"))},[t.createVNode(Yr)],10,Ia),t.createElementVNode("button",{class:"vs-btn mt-5",onClick:x[4]||(x[4]=T=>{ne.value=!ne.value}),title:"Full Screen","aria-label":"Full Screen"},[t.createVNode(Qr,{style:{width:"12px",height:"12px"}})])])]),t.createElementVNode("div",{class:t.normalizeClass(["absolute left-4 z-[1000]",y.value?"bottom-8":"bottom-4"])},[t.createVNode(Ca,{basemaps:t.unref(V),onOnLayerChange:R},null,8,["basemaps"])],2),t.createElementVNode("div",La,[y.value?(t.openBlock(),t.createElementBlock("div",Ta,[t.createElementVNode("div",Oa,[x[7]||(x[7]=t.createTextVNode(" Тип: ",-1)),t.createElementVNode("span",Ra,t.toDisplayString(y.value.type),1)]),t.createElementVNode("div",za,[t.createElementVNode("div",ja,[x[8]||(x[8]=t.createTextVNode(" Центр: ",-1)),t.createElementVNode("b",null,t.toDisplayString(y.value.center.lat.toFixed(5))+", "+t.toDisplayString(y.value.center.lng.toFixed(5)),1)]),y.value.areaKm2!==null?(t.openBlock(),t.createElementBlock("div",Ua,[x[9]||(x[9]=t.createTextVNode(" Площа: ",-1)),t.createElementVNode("b",null,t.toDisplayString(y.value.areaKm2.toFixed(1))+"км²",1)])):(t.openBlock(),t.createElementBlock("div",Pa,x[10]||(x[10]=[t.createTextVNode(" Площа: ",-1),t.createElementVNode("b",null,"—",-1)]))),t.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:x[5]||(x[5]=T=>se())},x[11]||(x[11]=[t.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-e82d2d97><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" data-v-e82d2d97></path><path d="M7 10l6 0" data-v-e82d2d97></path><path d="M10 7l0 6" data-v-e82d2d97></path><path d="M21 21l-6 -6" data-v-e82d2d97></path></svg>',1)])),t.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:x[6]||(x[6]=T=>ge())},[t.createVNode(Ce,{class:"w-3 h-3"})])])])):t.createCommentVNode("",!0)])],2))}}),[["__scopeId","data-v-e82d2d97"]]),Ha=["data-focus"],qa={class:"flex items-center"},Ga={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},Ka=["onClick","aria-label"],Za={key:0,class:"absolute text-gray-500 truncate pl-2"},Ya={class:"flex-1 min-w-[2px]"},Ja=["placeholder"],Wa={class:"flex items-center shrink-0"},Xa=["disabled"],at=t.defineComponent({__name:"vs-input-tag",props:t.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"}},{modelValue:{default:[]},modelModifiers:{}}),emits:t.mergeModels(["update:modelValue"],["update:modelValue"]),setup(o,{emit:e}){const s=o,n=e;ae(s.style);const l=t.ref(null),r=t.ref(null),a=t.ref(null),i=t.ref(!1),u=t.ref(""),d=t.useModel(o,"modelValue"),c=t.computed(()=>s.placeholder||"Add tag…"),p=t.computed(()=>d.value?.length===0&&u.value===""),h=t.computed(()=>!s.disabled&&d.value?.length>0),w=t.computed(()=>s.disabled),y=async()=>{w.value||await t.nextTick(()=>a.value?.focus())},V=D=>{const N=D.trim();N!==""&&(!d.value||!Array.isArray(d.value)?d.value=[N]:s.unique?d.value.includes(N)||(d.value=[...d.value,N]):d.value=[...d.value,N],u.value="")},v=()=>{const D=u.value;D.trim()!==""&&V(D),u.value=""},$=D=>{const N=d.value.slice();N.splice(D,1),n("update:modelValue",N)},_=()=>{n("update:modelValue",[])},g=()=>{w.value||(i.value=!0)},k=()=>{i.value=!1},P=D=>{const{key:N}=D;N==="Enter"?(D.preventDefault(),v()):N==="Backspace"&&u.value===""&&d.value.length>0&&$(d.value.length-1)};return(D,N)=>(t.openBlock(),t.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:l,onClick:N[1]||(N[1]=t.withModifiers(()=>{},["stop"]))},[t.createElementVNode("div",{class:t.normalizeClass(["relative w-full font-sans",s.customClass]),role:"group","aria-label":"Tag input"},[t.createElementVNode("div",{class:t.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",i.value?"border-blue-500 ring-1 ring-blue-500":"",w.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:y},[t.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:r},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(d.value,(U,Z)=>(t.openBlock(),t.createElementBlock("div",{key:Z,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[t.createElementVNode("div",qa,[t.createElementVNode("div",Ga,t.toDisplayString(U),1)]),t.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:t.withModifiers(G=>$(Z),["stop"]),"aria-label":`Remove ${U}`},N[2]||(N[2]=[t.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"},[t.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,Ka)]))),128)),p.value?(t.openBlock(),t.createElementBlock("div",Za,t.toDisplayString(c.value),1)):t.createCommentVNode("",!0),t.createElementVNode("div",Ya,[w.value?t.createCommentVNode("",!0):t.withDirectives((t.openBlock(),t.createElementBlock("input",{key:0,ref_key:"inputRef",ref:a,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":N[0]||(N[0]=U=>u.value=U),onFocus:g,onBlur:k,onKeydown:P,placeholder:d.value&&d.value.length?"":void 0},null,40,Ja)),[[t.vModelText,u.value]])])],512),t.createElementVNode("div",Wa,[h.value?(t.openBlock(),t.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:w.value,onClick:t.withModifiers(_,["stop"])},N[3]||(N[3]=[t.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[t.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,Xa)):t.createCommentVNode("",!0)])],10,Ha)],2)],512))}}),Qa={class:"relative flex gap-1 bg-white rounded-lg vs-form-text"},eo=["disabled","placeholder"],ot=I(t.defineComponent({__name:"vs-input-slug",props:{disabled:{type:Boolean},modelValue:{},placeholder:{},parent:{}},emits:["update:modelValue"],setup(o,{emit:e}){const s=t.inject("values"),n=o,l=t.computed(()=>s?.value?.[n.parent||""]||""),r=e,a=t.computed({get(){return n.modelValue},set(d){r("update:modelValue",d.trim())}});function i(d){const c={а:"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 d.toLowerCase().split("").map(p=>c[p]||p).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const u=()=>{a.value=l.value?i(l.value):i(a.value)};return(d,c)=>(t.openBlock(),t.createElementBlock("div",Qa,[t.withDirectives(t.createElementVNode("input",{ref:"vsText",disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":c[0]||(c[0]=p=>a.value=p),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,eo),[[t.vModelText,a.value]]),t.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:u}," Gen ")]))}}),[["__scopeId","data-v-f76159c3"]]),to={class:"w-full"},so={ref:"sortableContainer",class:"flex flex-col gap-1"},no=["onDragstart","onDrop"],lo={class:"w-1/3"},ro={class:"w-2/3"},ao=["onClick"],oo={key:0,class:"text-[14px] text-gray-700"},io={class:"mt-2 w-full flex items-center"},uo=["disabled"],it=I(t.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{}},setup(o){const e=y=>`${y}-${Math.random().toString(36).substring(2,15)}`,s=t.inject("values"),n=o,l=n.addButtonText??"Додати",r=n.ignore??[],a=t.ref([]),i=t.ref(null);(()=>{const y=s?.value?.[n.parent]||{};a.value=Object.entries(y).filter(([V])=>!r.includes(V)).map(([V,v])=>({id:e("key-value-"),key:V,value:v}))})();function d(y){i.value=y}function c(y){if(i.value===null||i.value===y)return;const V=a.value.splice(i.value,1)[0];a.value.splice(y,0,V),i.value=null}const p=t.computed(()=>a.value.some(y=>y.key&&!y.value||!y.key&&y.value)),h=()=>{a.value.push({id:e("key-value-"),key:"",value:""})},w=y=>{a.value=a.value.filter(V=>V.id!==y)};return t.watch(a,y=>{const V={};y.forEach($=>{$.key&&$.value!==void 0&&(V[$.key]=$.value)});const v={};r.length&&r.forEach($=>{v[$]=s?.value?.[n.parent]?.[$]}),s?.value&&(s.value[n.parent]={...v,...V})},{deep:!0}),(y,V)=>(t.openBlock(),t.createElementBlock("div",to,[t.createElementVNode("div",so,[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(a.value,(v,$)=>(t.openBlock(),t.createElementBlock("div",{key:v.id,class:t.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":i.value===$}]),draggable:"true",onDragstart:_=>d($),onDragover:V[0]||(V[0]=t.withModifiers(()=>{},["prevent"])),onDrop:_=>c($)},[V[1]||(V[1]=t.createStaticVNode('<button class="cursor-move" data-v-fe75c0b1><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-fe75c0b1><circle cx="15" cy="12" r="1.5" data-v-fe75c0b1></circle><circle cx="15" cy="24" r="1.5" data-v-fe75c0b1></circle><circle cx="21" cy="12" r="1.5" data-v-fe75c0b1></circle><circle cx="21" cy="24" r="1.5" data-v-fe75c0b1></circle><circle cx="21" cy="18" r="1.5" data-v-fe75c0b1></circle><circle cx="15" cy="18" r="1.5" data-v-fe75c0b1></circle></svg></button>',1)),t.createElementVNode("div",lo,[t.createVNode(ke,{modelValue:v.key,"onUpdate:modelValue":_=>v.key=_,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),t.createElementVNode("div",ro,[t.createVNode(ke,{modelValue:v.value,"onUpdate:modelValue":_=>v.value=_,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),t.createElementVNode("button",{onClick:_=>w(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"},[t.createVNode(t.unref(ds),{height:"16",width:"16"})],8,ao)],42,no))),128))],512),a.value.length?t.createCommentVNode("",!0):(t.openBlock(),t.createElementBlock("span",oo," Дані для відображення відсутні ")),t.createElementVNode("div",io,[t.createElementVNode("button",{type:"button",onClick:h,disabled:p.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"},[t.createVNode(be,{height:"14",width:"14"}),t.createTextVNode(" "+t.toDisplayString(t.unref(l)),1)],8,uo)])]))}}),[["__scopeId","data-v-fe75c0b1"]]),ut={VsInputText:ke,VsInputRadio:De,"vs-input-text":ke,"vs-input-textarea":st,"vs-input-mask":Pe,"vs-input-number":je,"vs-input-radio":De,"vs-input-select":tt,"vs-input-switcher":Ae,"vs-input-static":$e,"vs-input-container":Qe,"vs-input-date":Ge,"vs-input-checkbox":qe,"vs-input-file":Je,"vs-input-html":$e,"vs-input-email":He,"vs-input-datatable":lt,"vs-input-map":rt,"vs-input-file-list":We,"vs-input-tag":at,"vs-input-slug":ot,"vs-input-key-value":it},co=t.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(o){const e=o,s=t.inject("values");async function n(){try{if(!e.api)return;const l=e.api.replace("{{value}}",e.value),r=await fetch(l);if(!r.ok){W.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const a=await r.json();if(!e.set||!s)return;for(const[i,u]of Object.entries(e.set))s.value[i]=a.result[u]}catch(l){console.error(e.error,l)}}return(l,r)=>(t.openBlock(),t.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"},t.toDisplayString(l.button),1))}}),po={class:"flex w-full"},dt=t.defineComponent({__name:"vs-compact-form-layout",props:t.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,s=t.useModel(o,"modelValue");console.log(e.item.type);const n=t.computed(()=>Rt[`${e.layout}`]),l=t.computed(()=>ut?.[`vs-input-${e.item.type}`]),r=t.computed(()=>{const i=t.unref(l);if(!i)return new Set;const u=i.props??i.__vccOpts?.props;if(!u)return new Set;const d=Array.isArray(u)?u:Object.keys(u);return new Set(d)}),a=t.computed(()=>{const i=e.item??{},u=r.value;return u.size?Object.fromEntries(Object.entries(i).filter(([d])=>u.has(d))):{}});return(i,u)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(n.value),{ua:e.item.ua,error:e.error||"",item:i.item,label:e.item.label},{default:t.withCtx(()=>[t.createElementVNode("div",po,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(l.value),t.mergeProps(a.value,{modelValue:s.value,"onUpdate:modelValue":u[0]||(u[0]=d=>s.value=d)}),null,16,["modelValue"])),i.item.behavior?.api&&i.item.behavior?.button?(t.openBlock(),t.createBlock(co,t.mergeProps({key:0},i.item.behavior,{value:s.value}),null,16,["value"])):t.createCommentVNode("",!0)])]),_:1},8,["ua","error","item","label"]))}}),ct={required:"Це поле є обов’язковим",email:"Неправильний email"},ho=o=>o?!1:ct.required,mo=o=>!o&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)?ct.email:!1,fo=(o,e)=>{const s=e.pattern??e.regexp;return!(typeof s=="string"?new RegExp(s):s).test(o)&&o?e.message:!1},go=(o,e)=>!1,ko=(o,e)=>{switch(typeof e=="string"?e:e.type){case"required":return ho(o);case"email":return mo(o);case"regexp":return fo(o,e);case"custom":return go();default:return!1}},bo={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file"};function pt(o){const e=o.toLowerCase();return bo[e]||e}function yo(o){if(Array.isArray(o)){const s=[];return o.forEach(n=>{const l={...n};l.name=(n.name||n.id||n.key||"").toString(),l.type=pt(n.type),l.label=n.label||n.ua,l.rules=n.rules||n.validators,n.data&&(l.api=`/api/suggest/${n.data}`),s.push(l)}),s}const e=[];return Object.entries(o).forEach(s=>{const n={name:s[0],...s[1],type:pt(s[1].type),label:s[1].label||s[1].ua,rules:s[1].rules||s[1].validators};s[1].type.includes("list")&&(n.multiple=!0),s[1].data&&(n.api=`/api/suggest/${s[1].data}`),e.push(n)}),e}function xo(o,e){const s=yo(e),n=t.ref({});function l(u){const d=u?.conditions;if(!d)return!0;const c=Array.isArray(d)?d[0]:d,p=o?.value?.[c];return Xe(p,d)}const r=(u=s,d=!0)=>(u.forEach(c=>{if(c.rules){if(!l(c)){delete n.value[c.name];return}c.rules.forEach(p=>{const h=ko(o.value[c.name],p);h?n.value[c.name]=h:delete n.value[c.name]})}c.schema&&r(c.schema,!1)}),d&&Object.values(n.value).some(Boolean)?n.value:null),a=t.computed(()=>s?.filter(u=>l(u)));return{errors:n,validate:r,reset:()=>{o.value={},n.value={}},visibleSchema:a}}const me=t.defineComponent({__name:"vs-compact-form",props:t.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:t.mergeModels(["handle-submit","update:modelValue"],["update:form","update:values"]),setup(o,{expose:e,emit:s}){const n=s,l=o,r=t.useModel(o,"form"),a=t.useModel(o,"values"),{errors:i,validate:u,reset:d,visibleSchema:c}=xo(a,l.schema),p=()=>{n("update:modelValue",a.value),u(),n("handle-submit",a.value)};e({validate:u,reset:d,errors:i}),t.onMounted(()=>{l.modelValue&&(a.value=l.modelValue),r.value.value=a.value,r.value.errors=i.value,r.value.reset=d,r.value.validate=u,r.value.formId=l.formId});function h(w,y){if(w===y)return!0;if(typeof w!="object"||typeof y!="object"||!w||!y)return!1;const V=Object.keys(w),v=Object.keys(y);return V.length!==v.length?!1:V.every($=>w[$]===y[$])}return t.provide("form",r),t.provide("values",a),(w,y)=>(t.openBlock(),t.createElementBlock("form",{onSubmit:t.withModifiers(p,["prevent"]),class:t.normalizeClass(["grid grid-cols-12",w.layout==="default"?"gap-6":"gap-4"])},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(t.unref(c),V=>(t.openBlock(),t.createBlock(dt,{key:V.name,class:t.normalizeClass(w.layout==="horizontal"?"col-span-12":`col-span-${V.col||12} `),style:t.normalizeStyle(w.style),item:V,layout:w.layout,"model-value":a.value[V.name],"onUpdate:modelValue":v=>{const $=a.value[V.name];h($,v)||(a.value[V.name]=v)},error:t.unref(i)[V.name]},null,8,["class","style","item","layout","model-value","onUpdate:modelValue","error"]))),128))],34))}});me.install=function(e){e.component("VForm",me),Object.assign(e.config.globalProperties,{$form:Ie}),e.provide("form",Ie),window.v3plugin||(window.v3plugin={})};function oe(o){return typeof o=="string"||o instanceof String}function ht(o){var e;return typeof o=="object"&&o!=null&&(o==null||(e=o.constructor)==null?void 0:e.name)==="Object"}function mt(o,e){return Array.isArray(e)?mt(o,(s,n)=>e.includes(n)):Object.entries(o).reduce((s,n)=>{let[l,r]=n;return e(r,l)&&(s[l]=r),s},{})}const E={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function ft(o){switch(o){case E.LEFT:return E.FORCE_LEFT;case E.RIGHT:return E.FORCE_RIGHT;default:return o}}function Le(o){return o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Be(o,e){if(e===o)return!0;const s=Array.isArray(e),n=Array.isArray(o);let l;if(s&&n){if(e.length!=o.length)return!1;for(l=0;l<e.length;l++)if(!Be(e[l],o[l]))return!1;return!0}if(s!=n)return!1;if(e&&o&&typeof e=="object"&&typeof o=="object"){const r=e instanceof Date,a=o instanceof Date;if(r&&a)return e.getTime()==o.getTime();if(r!=a)return!1;const i=e instanceof RegExp,u=o instanceof RegExp;if(i&&u)return e.toString()==o.toString();if(i!=u)return!1;const d=Object.keys(e);for(l=0;l<d.length;l++)if(!Object.prototype.hasOwnProperty.call(o,d[l]))return!1;for(l=0;l<d.length;l++)if(!Be(o[d[l]],e[d[l]]))return!1;return!0}else if(e&&o&&typeof e=="function"&&typeof o=="function")return e.toString()===o.toString();return!1}class _o{constructor(e){for(Object.assign(this,e);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 B(o,e){return new B.InputMask(o,e)}function gt(o){if(o==null)throw new Error("mask property should be defined");return o instanceof RegExp?B.MaskedRegExp:oe(o)?B.MaskedPattern:o===Date?B.MaskedDate:o===Number?B.MaskedNumber:Array.isArray(o)||o===Array?B.MaskedDynamic:B.Masked&&o.prototype instanceof B.Masked?o:B.Masked&&o instanceof B.Masked?o.constructor:o instanceof Function?B.MaskedFunction:(console.warn("Mask not found for mask",o),B.Masked)}function fe(o){if(!o)throw new Error("Options in not defined");if(B.Masked){if(o.prototype instanceof B.Masked)return{mask:o};const{mask:e=void 0,...s}=o instanceof B.Masked?{mask:o}:ht(o)&&o.mask instanceof B.Masked?o:{};if(e){const n=e.mask;return{...mt(e,(l,r)=>!r.startsWith("_")),mask:e.constructor,_mask:n,...s}}}return ht(o)?{...o}:{mask:o}}function Q(o){if(B.Masked&&o instanceof B.Masked)return o;const e=fe(o),s=gt(e.mask);if(!s)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===s&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new s(e)}B.createMask=Q;class Ne{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return e??this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return e??this.value.length}select(e,s){if(!(e==null||s==null||e===this.selectionStart&&s===this.selectionEnd))try{this._unsafeSelect(e,s)}catch{}}get isActive(){return!1}}B.MaskElement=Ne;const kt=90,wo=89;class ye extends Ne{constructor(e){super(),this.input=e,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 e,s,n;return(e=(s=(n=this.input).getRootNode)==null?void 0:s.call(n))!=null?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){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",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){if(this._handlers.redo&&(e.keyCode===kt&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===wo&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===kt&&(e.metaKey||e.ctrlKey))return e.preventDefault(),this._handlers.undo(e);e.isComposing||this._handlers.selectionChange(e)}_onBeforeinput(e){if(e.inputType==="historyUndo"&&this._handlers.undo)return e.preventDefault(),this._handlers.undo(e);if(e.inputType==="historyRedo"&&this._handlers.redo)return e.preventDefault(),this._handlers.redo(e)}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}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={}}}B.HTMLMaskElement=ye;class bt extends ye{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,s){this.input.setSelectionRange(e,s)}get value(){return this.input.value}set value(e){this.input.value=e}}B.HTMLMaskElement=ye;class Te extends ye{get _unsafeSelectionStart(){const e=this.rootElement,s=e.getSelection&&e.getSelection(),n=s&&s.anchorOffset,l=s&&s.focusOffset;return l==null||n==null||n<l?n:l}get _unsafeSelectionEnd(){const e=this.rootElement,s=e.getSelection&&e.getSelection(),n=s&&s.anchorOffset,l=s&&s.focusOffset;return l==null||n==null||n>l?n:l}_unsafeSelect(e,s){if(!this.rootElement.createRange)return;const n=this.rootElement.createRange();n.setStart(this.input.firstChild||this.input,e),n.setEnd(this.input.lastChild||this.input,s);const l=this.rootElement,r=l.getSelection&&l.getSelection();r&&(r.removeAllRanges(),r.addRange(n))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}B.HTMLContenteditableMaskElement=Te;class Se{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>Se.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,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}}Se.MAX_LENGTH=100;class yt{constructor(e,s){this.el=e instanceof Ne?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new Te(e):new bt(e),this.masked=Q(s),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Se,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(e){var s;return e==null||((s=this.masked)==null?void 0:s.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof B.Masked)&&this.masked.constructor===gt(e)){this.masked.updateOptions({mask:e});return}const s=e instanceof B.Masked?e:Q({mask:e});s.unmaskedValue=this.masked.unmaskedValue,this.masked=s}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,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(e,s){const n=this._listeners[e];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(e){!this.el||!this.el.isActive||(this.el.select(e,e),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(e){const s=this.masked.unmaskedValue,n=this.masked.value,l=this.masked.rawInputValue,r=this.displayValue,a=this.unmaskedValue!==s||this.value!==n||this._rawInputValue!==l;this._unmaskedValue=s,this._value=n,this._rawInputValue=l,this.el.value!==r&&(this.el.value=r),e==="auto"?this.alignCursor():e!=null&&(this.cursorPos=e),a&&this._fireChangeEvents(),!this._historyChanging&&(a||this.history.isEmpty)&&this.history.push({unmaskedValue:s,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:s,...n}=e,l=!this.maskEquals(s),r=this.masked.optionsIsChanged(n);l&&(this.mask=s),r&&this.masked.updateOptions(n),(l||r)&&this.updateControl()}updateCursor(e){e!=null&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,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(e,s){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(s),this}off(e,s){if(!this._listeners[e])return this;if(!s)return delete this._listeners[e],this;const n=this._listeners[e].indexOf(s);return n>=0&&this._listeners[e].splice(n,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const s=new _o({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,r=n===this.masked.rawInputValue?s.removeDirection:E.NONE;let a=this.masked.nearestInputPos(s.startChangePos+l,r);r!==E.NONE&&(a=this.masked.nearestInputPos(a,E.NONE)),this.updateControl(a),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}B.InputMask=yt;class M{static normalize(e){return Array.isArray(e)?e:[e,new M]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}B.ChangeDetails=M;class ee{constructor(e,s,n){e===void 0&&(e=""),s===void 0&&(s=0),this.value=e,this.from=s,this.stop=n}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||e!=null&&this.from>=e)return"";const s=this.value[0];return this.value=this.value.slice(1),s}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class H{constructor(e){this._value="",this._update({...H.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,s){s===void 0&&(s={input:!0}),this.reset(),this.append(e,s,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,s){return e}totalInputPositions(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),Math.min(this.displayValue.length,s-e)}extractInput(e,s,n){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),this.displayValue.slice(e,s)}extractTail(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),new ee(this.extractInput(e,s),e)}appendTail(e){return oe(e)&&(e=new ee(String(e))),e.appendTo(this)}_appendCharRaw(e,s){return e?(this._value+=e,new M({inserted:e,rawInserted:e})):new M}_appendChar(e,s,n){s===void 0&&(s={});const l=this.state;let r;if([e,r]=this.doPrepareChar(e,s),e&&(r=r.aggregate(this._appendCharRaw(e,s)),!r.rawInserted&&this.autofix==="pad")){const a=this.state;this.state=l;let i=this.pad(s);const u=this._appendCharRaw(e,s);i=i.aggregate(u),u.rawInserted||i.equals(r)?r=i:this.state=a}if(r.inserted){let a,i=this.doValidate(s)!==!1;if(i&&n!=null){const u=this.state;if(this.overwrite===!0){a=n.state;for(let c=0;c<r.rawInserted.length;++c)n.unshift(this.displayValue.length-r.tailShift)}let d=this.appendTail(n);if(i=d.rawInserted.length===n.toString().length,!(i&&d.inserted)&&this.overwrite==="shift"){this.state=u,a=n.state;for(let c=0;c<r.rawInserted.length;++c)n.shift();d=this.appendTail(n),i=d.rawInserted.length===n.toString().length}i&&d.inserted&&(this.state=u)}i||(r=new M,this.state=l,n&&a&&(n.state=a))}return r}_appendPlaceholder(){return new M}_appendEager(){return new M}append(e,s,n){if(!oe(e))throw new Error("value should be string");const l=oe(n)?new ee(String(n)):n;s!=null&&s.tail&&(s._beforeTailState=this.state);let r;[e,r]=this.doPrepare(e,s);for(let a=0;a<e.length;++a){const i=this._appendChar(e[a],s,l);if(!i.rawInserted&&!this.doSkipInvalid(e[a],s,l))break;r.aggregate(i)}return(this.eager===!0||this.eager==="append")&&s!=null&&s.input&&e&&r.aggregate(this._appendEager()),l!=null&&(r.tailShift+=this.appendTail(l).tailShift),r}remove(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(s),new M}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const s=this.rawInputValue,n=this.value,l=e();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(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const s=this.state,n=e(this);return this.state=s,delete this._isolated,n}doSkipInvalid(e,s,n){return!!this.skipInvalid}doPrepare(e,s){return s===void 0&&(s={}),M.normalize(this.prepare?this.prepare(e,this,s):e)}doPrepareChar(e,s){return s===void 0&&(s={}),M.normalize(this.prepareChar?this.prepareChar(e,this,s):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,s,n,l,r){n===void 0&&(n=""),l===void 0&&(l=E.NONE),r===void 0&&(r={input:!0});const a=e+s,i=this.extractTail(a),u=this.eager===!0||this.eager==="remove";let d;u&&(l=ft(l),d=this.extractInput(0,a,{raw:!0}));let c=e;const p=new M;if(l!==E.NONE&&(c=this.nearestInputPos(e,s>1&&e!==0&&!u?E.NONE:l),p.tailShift=c-e),p.aggregate(this.remove(c)),u&&l!==E.NONE&&d===this.rawInputValue)if(l===E.FORCE_LEFT){let h;for(;d===this.rawInputValue&&(h=this.displayValue.length);)p.aggregate(new M({tailShift:-1})).aggregate(this.remove(h-1))}else l===E.FORCE_RIGHT&&i.unshift();return p.aggregate(this.append(n,r,i))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!Be(this,e)}typedValueEquals(e){const s=this.typedValue;return e===s||H.EMPTY_VALUES.includes(e)&&H.EMPTY_VALUES.includes(s)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new M}}H.DEFAULTS={skipInvalid:!0},H.EMPTY_VALUES=[void 0,null,""],B.Masked=H;class ie{constructor(e,s){e===void 0&&(e=[]),s===void 0&&(s=0),this.chunks=e,this.from=s}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=oe(e)?new ee(String(e)):e;const s=this.chunks[this.chunks.length-1],n=s&&(s.stop===e.stop||e.stop==null)&&e.from===s.from+s.toString().length;if(e instanceof ee)n?s.extend(e.toString()):this.chunks.push(e);else if(e instanceof ie){if(e.stop==null){let l;for(;e.chunks.length&&e.chunks[0].stop==null;)l=e.chunks.shift(),l.from+=e.from,this.extend(l)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof B.MaskedPattern))return new ee(this.toString()).appendTo(e);const s=new M;for(let n=0;n<this.chunks.length;++n){const l=this.chunks[n],r=e._mapPosToBlock(e.displayValue.length),a=l.stop;let i;if(a!=null&&(!r||r.index<=a)&&((l instanceof ie||e._stops.indexOf(a)>=0)&&s.aggregate(e._appendPlaceholder(a)),i=l instanceof ie&&e._blocks[a]),i){const u=i.appendTail(l);s.aggregate(u);const d=l.toString().slice(u.rawInserted.length);d&&s.aggregate(e.append(d,{tail:!0}))}else s.aggregate(e.append(l.toString(),{tail:!0}))}return s}get state(){return{chunks:this.chunks.map(e=>e.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:s,...n}=e;Object.assign(this,n),this.chunks=s.map(l=>{const r="chunks"in l?new ie:new ee;return r.state=l,r})}unshift(e){if(!this.chunks.length||e!=null&&this.from>=e)return"";const s=e!=null?e-this.from:e;let n=0;for(;n<this.chunks.length;){const l=this.chunks[n],r=l.unshift(s);if(l.toString()){if(!r)break;++n}else this.chunks.splice(n,1);if(r)return r}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const s=this.chunks[e],n=s.shift();if(s.toString()){if(!n)break;--e}else this.chunks.splice(e,1);if(n)return n}return""}}class Eo{constructor(e,s){this.masked=e,this._log=[];const{offset:n,index:l}=e._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(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}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(e){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(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())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 Oe{constructor(e){Object.assign(this,e),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(e,s){return e===void 0&&(e=0),s===void 0&&(s=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(s),this._value||(this._isRawInput=!1),new M}nearestInputPos(e,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(e,s){return e===void 0&&(e=0),s===void 0&&(s=this._value.length),this._isRawInput?s-e:0}extractInput(e,s,n){return e===void 0&&(e=0),s===void 0&&(s=this._value.length),n===void 0&&(n={}),n.raw&&this._isRawInput&&this._value.slice(e,s)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(e,s){if(s===void 0&&(s={}),this.isFilled)return new M;const n=this.eager===!0||this.eager==="append",r=this.char===e&&(this.isUnmasking||s.input||s.raw)&&(!s.raw||!n)&&!s.tail,a=new M({inserted:this.char,rawInserted:r?this.char:""});return this._value=this.char,this._isRawInput=r&&(s.raw||s.input),a}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new M;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new ee("")}appendTail(e){return oe(e)&&(e=new ee(String(e))),e.appendTo(this)}append(e,s,n){const l=this._appendChar(e[0],s);return n!=null&&(l.tailShift+=this.appendTail(n).tailShift),l}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=!!e._rawInputValue}pad(e){return this._appendPlaceholder()}}class xe{constructor(e){const{parent:s,isOptional:n,placeholderChar:l,displayChar:r,lazy:a,eager:i,...u}=e;this.masked=Q(u),Object.assign(this,{parent:s,isOptional:n,placeholderChar:l,displayChar:r,lazy:a,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.value.length),e===0&&s>=1?(this.isFilled=!1,this.masked.remove(e,s)):new M}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(e,s){if(s===void 0&&(s={}),this.isFilled)return new M;const n=this.masked.state;let l=this.masked._appendChar(e,this.currentMaskFlags(s));return l.inserted&&this.doValidate(s)===!1&&(l=new M,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(e,s,n){return this.masked.append(e,this.currentMaskFlags(s),n)}_appendPlaceholder(){return this.isFilled||this.isOptional?new M:(this.isFilled=!0,new M({inserted:this.placeholderChar}))}_appendEager(){return new M}extractTail(e,s){return this.masked.extractTail(e,s)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,s,n){return e===void 0&&(e=0),s===void 0&&(s=this.value.length),this.masked.extractInput(e,s,n)}nearestInputPos(e,s){s===void 0&&(s=E.NONE);const n=0,l=this.value.length,r=Math.min(Math.max(e,n),l);switch(s){case E.LEFT:case E.FORCE_LEFT:return this.isComplete?r:n;case E.RIGHT:case E.FORCE_RIGHT:return this.isComplete?r:l;case E.NONE:default:return r}}totalInputPositions(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.value.length),this.value.slice(e,s).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var s;return{...e,_beforeTailState:(e==null||(s=e._beforeTailState)==null?void 0:s.masked)||e?._beforeTailState}}pad(e){return new M}}xe.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 xt extends H{updateOptions(e){super.updateOptions(e)}_update(e){const s=e.mask;s&&(e.validate=n=>n.search(s)>=0),super._update(e)}}B.MaskedRegExp=xt;class q extends H{constructor(e){super({...q.DEFAULTS,...e,definitions:Object.assign({},xe.DEFAULT_DEFINITIONS,e?.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const s=this.mask;if(!s||!e)return;let n=!1,l=!1;for(let r=0;r<s.length;++r){if(this.blocks){const d=s.slice(r),c=Object.keys(this.blocks).filter(h=>d.indexOf(h)===0);c.sort((h,w)=>w.length-h.length);const p=c[0];if(p){const{expose:h,repeat:w,...y}=fe(this.blocks[p]),V={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...y,repeat:w,parent:this},v=w!=null?new B.RepeatBlock(V):Q(V);v&&(this._blocks.push(v),h&&(this.exposeBlock=v),this._maskedBlocks[p]||(this._maskedBlocks[p]=[]),this._maskedBlocks[p].push(this._blocks.length-1)),r+=p.length-1;continue}}let a=s[r],i=a in e;if(a===q.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(a==="{"||a==="}"){n=!n;continue}if(a==="["||a==="]"){l=!l;continue}if(a===q.ESCAPE_CHAR){if(++r,a=s[r],!a)break;i=!1}const u=i?new xe({isOptional:l,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...fe(e[a]),parent:this}):new Oe({char:a,eager:this.eager,isUnmasking:n});this._blocks.push(u)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e){this.reset();return}const{_blocks:s,...n}=e;this._blocks.forEach((l,r)=>l.state=s[r]),super.state=n}reset(){super.reset(),this._blocks.forEach(e=>e.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(e=>e.isComplete)}get isFilled(){return this._blocks.every(e=>e.isFilled)}get isFixed(){return this._blocks.every(e=>e.isFixed)}get isOptional(){return this._blocks.every(e=>e.isOptional)}doCommit(){this._blocks.forEach(e=>e.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((e,s)=>e+=s.unmaskedValue,"")}set unmaskedValue(e){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(s),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((e,s)=>e+=s.value,"")}set value(e){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(s),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const s=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(s),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce((e,s)=>e+=s.displayValue,"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const s=new M;let n=(e=this._mapPosToBlock(this.displayValue.length))==null?void 0:e.index;if(n==null)return s;this._blocks[n].isFilled&&++n;for(let l=n;l<this._blocks.length;++l){const r=this._blocks[l]._appendEager();if(!r.inserted)break;s.aggregate(r)}return s}_appendCharRaw(e,s){s===void 0&&(s={});const n=this._mapPosToBlock(this.displayValue.length),l=new M;if(!n)return l;for(let a=n.index,i;i=this._blocks[a];++a){var r;const u=i._appendChar(e,{...s,_beforeTailState:(r=s._beforeTailState)==null||(r=r._blocks)==null?void 0:r[a]});if(l.aggregate(u),u.consumed)break}return l}extractTail(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length);const n=new ie;return e===s||this._forEachBlocksInRange(e,s,(l,r,a,i)=>{const u=l.extractTail(a,i);u.stop=this._findStopBefore(r),u.from=this._blockStartPos(r),u instanceof ie&&(u.blockIndex=r),n.extend(u)}),n}extractInput(e,s,n){if(e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),n===void 0&&(n={}),e===s)return"";let l="";return this._forEachBlocksInRange(e,s,(r,a,i,u)=>{l+=r.extractInput(i,u,n)}),l}_findStopBefore(e){let s;for(let n=0;n<this._stops.length;++n){const l=this._stops[n];if(l<=e)s=l;else break}return s}_appendPlaceholder(e){const s=new M;if(this.lazy&&e==null)return s;const n=this._mapPosToBlock(this.displayValue.length);if(!n)return s;const l=n.index,r=e??this._blocks.length;return this._blocks.slice(l,r).forEach(a=>{if(!a.lazy||e!=null){var i;s.aggregate(a._appendPlaceholder((i=a._blocks)==null?void 0:i.length))}}),s}_mapPosToBlock(e){let s="";for(let n=0;n<this._blocks.length;++n){const l=this._blocks[n],r=s.length;if(s+=l.displayValue,e<=s.length)return{index:n,offset:e-r}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce((s,n)=>s+=n.displayValue.length,0)}_forEachBlocksInRange(e,s,n){s===void 0&&(s=this.displayValue.length);const l=this._mapPosToBlock(e);if(l){const r=this._mapPosToBlock(s),a=r&&l.index===r.index,i=l.offset,u=r&&a?r.offset:this._blocks[l.index].displayValue.length;if(n(this._blocks[l.index],l.index,i,u),r&&!a){for(let d=l.index+1;d<r.index;++d)n(this._blocks[d],d,0,this._blocks[d].displayValue.length);n(this._blocks[r.index],r.index,0,r.offset)}}}remove(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length);const n=super.remove(e,s);return this._forEachBlocksInRange(e,s,(l,r,a,i)=>{n.aggregate(l.remove(a,i))}),n}nearestInputPos(e,s){if(s===void 0&&(s=E.NONE),!this._blocks.length)return 0;const n=new Eo(this,e);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===e)return e;n.popState()}if(n.pushLeftBeforeInput(),n.pushLeftBeforeRequired(),n.pushLeftBeforeFilled(),s===E.LEFT){if(n.pushRightBeforeInput(),n.pushRightBeforeRequired(),n.ok&&n.pos<=e||(n.popState(),n.ok&&n.pos<=e))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(e,E.LEFT))):e}totalInputPositions(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length);let n=0;return this._forEachBlocksInRange(e,s,(l,r,a,i)=>{n+=l.totalInputPositions(a,i)}),n}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const s=this._maskedBlocks[e];return s?s.map(n=>this._blocks[n]):[]}pad(e){const s=new M;return this._forEachBlocksInRange(0,this.displayValue.length,n=>s.aggregate(n.pad(e))),s}}q.DEFAULTS={...H.DEFAULTS,lazy:!0,placeholderChar:"_"},q.STOP_CHAR="`",q.ESCAPE_CHAR="\\",q.InputDefinition=xe,q.FixedDefinition=Oe,B.MaskedPattern=q;class _e extends q{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:s=this.to||0,from:n=this.from||0,maxLength:l=this.maxLength||0,autofix:r=this.autofix,...a}=e;this.to=s,this.from=n,this.maxLength=Math.max(String(s).length,l),this.autofix=r;const i=String(this.from).padStart(this.maxLength,"0"),u=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<u.length&&u[d]===i[d];)++d;a.mask=u.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(a)}get isComplete(){return super.isComplete&&!!this.value}boundaries(e){let s="",n="";const[,l,r]=e.match(/^(\D*)(\d*)(\D*)/)||[];return r&&(s="0".repeat(l.length)+r,n="9".repeat(l.length)+r),s=s.padEnd(this.maxLength,"0"),n=n.padEnd(this.maxLength,"9"),[s,n]}doPrepareChar(e,s){s===void 0&&(s={});let n;return[e,n]=super.doPrepareChar(e.replace(/\D/g,""),s),e||(n.skip=!this.isComplete),[e,n]}_appendCharRaw(e,s){if(s===void 0&&(s={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,s);const n=String(this.from).padStart(this.maxLength,"0"),l=String(this.to).padStart(this.maxLength,"0"),[r,a]=this.boundaries(this.value+e);return Number(a)<this.from?super._appendCharRaw(n[this.value.length],s):Number(r)>this.to?!s.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(n[this.value.length],s).aggregate(this._appendCharRaw(e,s)):super._appendCharRaw(l[this.value.length],s):super._appendCharRaw(e,s)}doValidate(e){const s=this.value;if(s.search(/[^0]/)===-1&&s.length<=this._matchFrom)return!0;const[l,r]=this.boundaries(s);return this.from<=Number(r)&&Number(l)<=this.to&&super.doValidate(e)}pad(e){const s=new M;if(this.value.length===this.maxLength)return s;const n=this.value,l=this.maxLength-this.value.length;if(l){this.reset();for(let r=0;r<l;++r)s.aggregate(super._appendCharRaw("0",e));n.split("").forEach(r=>this._appendCharRaw(r))}return s}}B.MaskedRange=_e;const Vo="d{.}`m{.}`Y";class te extends q{static extractPatternOptions(e){const{mask:s,pattern:n,...l}=e;return{...l,mask:oe(s)?s:n}}constructor(e){super(te.extractPatternOptions({...te.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:s,pattern:n,blocks:l,...r}={...te.DEFAULTS,...e},a=Object.assign({},te.GET_DEFAULT_BLOCKS());e.min&&(a.Y.from=e.min.getFullYear()),e.max&&(a.Y.to=e.max.getFullYear()),e.min&&e.max&&a.Y.from===a.Y.to&&(a.m.from=e.min.getMonth()+1,a.m.to=e.max.getMonth()+1,a.m.from===a.m.to&&(a.d.from=e.min.getDate(),a.d.to=e.max.getDate())),Object.assign(a,this.blocks,l),super._update({...r,mask:oe(s)?s:n,blocks:a})}doValidate(e){const s=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&s!=null&&(this.min==null||this.min<=s)&&(this.max==null||s<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(te.extractPatternOptions(e))}}te.GET_DEFAULT_BLOCKS=()=>({d:{mask:_e,from:1,to:31,maxLength:2},m:{mask:_e,from:1,to:12,maxLength:2},Y:{mask:_e,from:1900,to:9999}}),te.DEFAULTS={...q.DEFAULTS,mask:Date,pattern:Vo,format:(o,e)=>{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,e)=>{const[s,n,l]=o.split(".").map(Number);return new Date(l,n-1,s)}},B.MaskedDate=te;class we extends H{constructor(e){super({...we.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map(s=>{const{expose:n,...l}=fe(s),r=Q({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...l});return n&&(this.exposeMask=r),r}):[])}_appendCharRaw(e,s){s===void 0&&(s={});const n=this._applyDispatch(e,s);return this.currentMask&&n.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(s))),n}_applyDispatch(e,s,n){e===void 0&&(e=""),s===void 0&&(s={}),n===void 0&&(n="");const l=s.tail&&s._beforeTailState!=null?s._beforeTailState._value:this.value,r=this.rawInputValue,a=s.tail&&s._beforeTailState!=null?s._beforeTailState._rawInputValue:r,i=r.slice(a.length),u=this.currentMask,d=new M,c=u?.state;return this.currentMask=this.doDispatch(e,{...s},n),this.currentMask&&(this.currentMask!==u?(this.currentMask.reset(),a&&(this.currentMask.append(a,{raw:!0}),d.tailShift=this.currentMask.value.length-l.length),i&&(d.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):c&&(this.currentMask.state=c)),d}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const s=new M;return e&&s.aggregate(this._applyDispatch("",{},e)),s.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var s,n;return{...e,_beforeTailState:((s=e._beforeTailState)==null?void 0:s.currentMaskRef)===this.currentMask&&((n=e._beforeTailState)==null?void 0:n.currentMask)||e._beforeTailState}}doDispatch(e,s,n){return s===void 0&&(s={}),n===void 0&&(n=""),this.dispatch(e,this,s,n)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,s){s===void 0&&(s={});let[n,l]=super.doPrepare(e,s);if(this.currentMask){let r;[n,r]=super.doPrepare(n,this.currentMaskFlags(s)),l=l.aggregate(r)}return[n,l]}doPrepareChar(e,s){s===void 0&&(s={});let[n,l]=super.doPrepareChar(e,s);if(this.currentMask){let r;[n,r]=super.doPrepareChar(n,this.currentMaskFlags(s)),l=l.aggregate(r)}return[n,l]}reset(){var e;(e=this.currentMask)==null||e.reset(),this.compiledMasks.forEach(s=>s.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask){this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,this._applyDispatch();return}let s=String(e);this.currentMask&&(this.currentMask.typedValue=e,s=this.currentMask.unmaskedValue),this.unmaskedValue=s}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return!!((e=this.currentMask)!=null&&e.isComplete)}get isFilled(){var e;return!!((e=this.currentMask)!=null&&e.isFilled)}remove(e,s){const n=new M;return this.currentMask&&n.aggregate(this.currentMask.remove(e,s)).aggregate(this._applyDispatch()),n}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(s=>s.state),currentMaskRef:this.currentMask,currentMask:(e=this.currentMask)==null?void 0:e.state}}set state(e){const{compiledMasks:s,currentMaskRef:n,currentMask:l,...r}=e;s&&this.compiledMasks.forEach((a,i)=>a.state=s[i]),n!=null&&(this.currentMask=n,this.currentMask.state=l),super.state=r}extractInput(e,s,n){return this.currentMask?this.currentMask.extractInput(e,s,n):""}extractTail(e,s){return this.currentMask?this.currentMask.extractTail(e,s):super.extractTail(e,s)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,s){return this.currentMask?this.currentMask.nearestInputPos(e,s):super.nearestInputPos(e,s)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every((s,n)=>{if(!e[n])return;const{mask:l,...r}=e[n];return Be(s,r)&&s.maskEquals(l)}):super.maskEquals(e)}typedValueEquals(e){var s;return!!((s=this.currentMask)!=null&&s.typedValueEquals(e))}}we.DEFAULTS={...H.DEFAULTS,dispatch:(o,e,s,n)=>{if(!e.compiledMasks.length)return;const l=e.rawInputValue,r=e.compiledMasks.map((a,i)=>{const u=e.currentMask===a,d=u?a.displayValue.length:a.nearestInputPos(a.displayValue.length,E.FORCE_LEFT);return a.rawInputValue!==l?(a.reset(),a.append(l,{raw:!0})):u||a.remove(d),a.append(o,e.currentMaskFlags(s)),a.appendTail(n),{index:i,weight:a.rawInputValue.length,totalInputPositions:a.totalInputPositions(0,Math.max(d,a.nearestInputPos(a.displayValue.length,E.FORCE_LEFT)))}});return r.sort((a,i)=>i.weight-a.weight||i.totalInputPositions-a.totalInputPositions),e.compiledMasks[r[0].index]}},B.MaskedDynamic=we;class Ee extends q{constructor(e){super({...Ee.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:s,...n}=e;if(s){const l=s.map(i=>i.length),r=Math.min(...l),a=Math.max(...l)-r;n.mask="*".repeat(r),a&&(n.mask+="["+"*".repeat(a)+"]"),this.enum=s}super._update(n)}_appendCharRaw(e,s){s===void 0&&(s={});const n=Math.min(this.nearestInputPos(0,E.FORCE_RIGHT),this.value.length),l=this.enum.filter(r=>this.matchValue(r,this.unmaskedValue+e,n));if(l.length){l.length===1&&this._forEachBlocksInRange(0,this.value.length,(a,i)=>{const u=l[0][i];i>=this.value.length||u===a.value||(a.reset(),a._appendChar(u,s))});const r=super._appendCharRaw(l[0][this.value.length],s);return l.length===1&&l[0].slice(this.unmaskedValue.length).split("").forEach(a=>r.aggregate(super._appendCharRaw(a))),r}return new M({skip:!this.isComplete})}extractTail(e,s){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),new ee("",e)}remove(e,s){if(e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),e===s)return new M;const n=Math.min(super.nearestInputPos(0,E.FORCE_RIGHT),this.value.length);let l;for(l=e;l>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(n,l),n)).length>1);--l);const r=super.remove(l,s);return r.tailShift+=l-e,r}get isComplete(){return this.enum.indexOf(this.value)>=0}}Ee.DEFAULTS={...q.DEFAULTS,matchValue:(o,e,s)=>o.indexOf(e,s)===s},B.MaskedEnum=Ee;class _t extends H{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}B.MaskedFunction=_t;var wt;class K extends H{constructor(e){super({...K.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),s="\\d*",n=(this.scale?"("+Le(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+s+n),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Le).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Le(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const s=e.split(this.radix);return s[0]=s[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),s.join(this.radix)}doPrepareChar(e,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)?e.replace(this._mapToRadixRegExp,this.radix):e),s);return e&&!n&&(l.skip=!0),n&&!this.allowPositive&&!this.value&&n!=="-"&&l.aggregate(this._appendChar("-")),[n,l]}_separatorsCount(e,s){s===void 0&&(s=!1);let n=0;for(let l=0;l<e;++l)this._value.indexOf(this.thousandsSeparator,l)===l&&(++n,s&&(e+=this.thousandsSeparator.length));return n}_separatorsCountFromSlice(e){return e===void 0&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,s,n){return e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),[e,s]=this._adjustRangeWithSeparators(e,s),this._removeThousandsSeparators(super.extractInput(e,s,n))}_appendCharRaw(e,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 r=this._value;this._value+=e;const a=this.number;let i=!isNaN(a),u=!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(K.UNMASKED_RADIX,this.radix),u||(u=r===this._value&&!s.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let d;i?d=new M({inserted:this._value.slice(r.length),rawInserted:u?"":e,skip:u}):(this._value=r,d=new M),this._value=this._insertThousandsSeparators(this._value);const c=s.tail&&s._beforeTailState?s._beforeTailState._value:this._value,p=this._separatorsCountFromSlice(c);return d.tailShift+=(p-l)*this.thousandsSeparator.length,d}_findSeparatorAround(e){if(this.thousandsSeparator){const s=e-this.thousandsSeparator.length+1,n=this.value.indexOf(this.thousandsSeparator,s);if(n<=e)return n}return-1}_adjustRangeWithSeparators(e,s){const n=this._findSeparatorAround(e);n>=0&&(e=n);const l=this._findSeparatorAround(s);return l>=0&&(s=l+this.thousandsSeparator.length),[e,s]}remove(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length),[e,s]=this._adjustRangeWithSeparators(e,s);const n=this.value.slice(0,e),l=this.value.slice(s),r=this._separatorsCount(n.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(n+l));const a=this._separatorsCountFromSlice(n);return new M({tailShift:(a-r)*this.thousandsSeparator.length})}nearestInputPos(e,s){if(!this.thousandsSeparator)return e;switch(s){case E.NONE:case E.LEFT:case E.FORCE_LEFT:{const n=this._findSeparatorAround(e-1);if(n>=0){const l=n+this.thousandsSeparator.length;if(e<l||this.value.length<=l||s===E.FORCE_LEFT)return n}break}case E.RIGHT:case E.FORCE_RIGHT:{const n=this._findSeparatorAround(e);if(n>=0)return n+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let s=e;this.min!=null&&(s=Math.max(s,this.min)),this.max!=null&&(s=Math.min(s,this.max)),s!==e&&(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(e){const s=this._removeThousandsSeparators(e).split(this.radix);return s[0]=s[0].replace(/^(\D*)(0*)(\d*)/,(n,l,r,a)=>l+a),e.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(e){if(!e)return e;const s=e.split(this.radix);return s.length<2&&s.push(""),s[1]=s[1].padEnd(this.scale,"0"),s.join(this.radix)}doSkipInvalid(e,s,n){s===void 0&&(s={});const l=this.scale===0&&e!==this.thousandsSeparator&&(e===this.radix||e===K.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,s,n)&&!l}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,K.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(K.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}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(e){return(super.typedValueEquals(e)||K.EMPTY_VALUES.includes(e)&&K.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}wt=K,K.UNMASKED_RADIX=".",K.EMPTY_VALUES=[...H.EMPTY_VALUES,0],K.DEFAULTS={...H.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[wt.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})},B.MaskedNumber=K;const Fe={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Re(o,e,s){e===void 0&&(e=Fe.MASKED),s===void 0&&(s=Fe.MASKED);const n=Q(o);return l=>n.runIsolated(r=>(r[e]=l,r[s]))}function Et(o,e,s,n){return Re(e,s,n)(o)}B.PIPE_TYPE=Fe,B.createPipe=Re,B.pipe=Et;class Vt extends q{get repeatFrom(){var e;return(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?e:0}get repeatTo(){var e;return(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var s,n,l;const{repeat:r,...a}=fe(e);this._blockOpts=Object.assign({},this._blockOpts,a);const i=Q(this._blockOpts);this.repeat=(s=(n=r??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(e){if(e<this._blocks.length)return this._blocks[e];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(Q(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(e,s){s===void 0&&(s={});const n=new M;for(let u=(l=(r=this._mapPosToBlock(this.displayValue.length))==null?void 0:r.index)!=null?l:Math.max(this._blocks.length-1,0),d,c;d=(a=this._blocks[u])!=null?a:c=!c&&this._allocateBlock(u);++u){var l,r,a,i;const p=d._appendChar(e,{...s,_beforeTailState:(i=s._beforeTailState)==null||(i=i._blocks)==null?void 0:i[u]});if(p.skip&&c){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(n.aggregate(p),p.consumed)break}return n}_trimEmptyTail(e,s){var n,l;e===void 0&&(e=0);const r=Math.max(((n=this._mapPosToBlock(e))==null?void 0:n.index)||0,this.repeatFrom,0);let a;s!=null&&(a=(l=this._mapPosToBlock(s))==null?void 0:l.index),a==null&&(a=this._blocks.length-1);let i=0;for(let u=a;r<=u&&!this._blocks[u].unmaskedValue;--u,++i);i&&(this._blocks.splice(a-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(e,s){e===void 0&&(e=0),s===void 0&&(s=this.displayValue.length);const n=super.remove(e,s);return this._trimEmptyTail(e,s),n}totalInputPositions(e,s){return e===void 0&&(e=0),s==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,s)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}}B.RepeatBlock=Vt;try{globalThis.IMask=B}catch{}const Co=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:M,ChunksTailDetails:ie,DIRECTION:E,HTMLContenteditableMaskElement:Te,HTMLInputMaskElement:bt,HTMLMaskElement:ye,InputMask:yt,MaskElement:Ne,Masked:H,MaskedDate:te,MaskedDynamic:we,MaskedEnum:Ee,MaskedFunction:_t,MaskedNumber:K,MaskedPattern:q,MaskedRange:_e,MaskedRegExp:xt,PIPE_TYPE:Fe,PatternFixedDefinition:Oe,PatternInputDefinition:xe,RepeatBlock:Vt,createMask:Q,createPipe:Re,default:B,forceDirection:ft,normalizeOpts:fe,pipe:Et},Symbol.toStringTag,{value:"Module"}));O.ModalEdit=et,O.VForm=me,O.VsInputCheckbox=qe,O.VsInputContainer=Qe,O.VsInputDate=Ge,O.VsInputEmail=He,O.VsInputFile=Je,O.VsInputFileList=We,O.VsInputKeyValue=it,O.VsInputMask=Pe,O.VsInputNumber=je,O.VsInputRadio=De,O.VsInputSelect=tt,O.VsInputSlug=ot,O.VsInputStatic=$e,O.VsInputSwitcher=Ae,O.VsInputTag=at,O.VsInputText=ke,O.VsInputTextarea=st,O.default=me,O.inputs=ut,O.vsInputDatatable=lt,O.vsInputMap=rt,Object.defineProperties(O,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|