@opengis/form 0.0.134 → 0.0.136
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/{index-B0SGQTiY.js → index-BYGdKjjS.js} +101 -101
- package/dist/index.css +1 -1
- package/dist/index.js +1 -1
- package/dist/index.umd.cjs +9 -9
- package/dist/src/components/inputs/map/vs-input-map.vue.d.ts.map +1 -1
- package/dist/{vs-richtext-DKA3mQH9.js → vs-richtext-CUhUsIND.js} +1 -1
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
(function(pe,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@opengis/core"),require("lucide-vue-next")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core","lucide-vue-next"],e):(pe=typeof globalThis<"u"?globalThis:pe||self,e(pe.FormBuilder={},pe.Vue,pe.OpenGISCore,pe.lucide))})(this,function(pe,e,ue,j){"use strict";const or=e.defineComponent({__name:"vs-info-tooltip",props:{text:{}},setup(r){const t=r,n=e.ref(!1),o=e.ref({top:"0px",left:"0px"});function l(s){if(!t.text)return;const c=s.currentTarget.getBoundingClientRect();o.value={top:`${c.bottom+4}px`,left:`${Math.min(c.left,window.innerWidth-230)}px`},n.value=!0}function a(){n.value=!1}return(s,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("span",{class:"inline-flex items-center",onMouseenter:l,onMouseleave:a},[e.renderSlot(s.$slots,"default",{},()=>[e.createVNode(e.unref(j.Info),{class:"h-4 w-4 text-gray-400 cursor-help"})])],32),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.value&&s.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(o.value),class:"fixed z-[9999] max-w-xs p-2 bg-gray-900 text-white text-xs rounded-lg shadow-lg pointer-events-none"},e.toDisplayString(s.text),5)):e.createCommentVNode("",!0)]))],64))}}),Ao={class:"w-full relative"},Fo={key:0,class:"text-[14px] font-medium text-gray-900 mb-2 flex items-center gap-1"},Mo={class:"opacity-100"},Do={key:0,class:"text-red-500 text-[14px]"},Lo={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},To=e.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(r){const t=r,n=e.computed(()=>typeof t.item?.label=="string"&&t.item.label?t.item.label:t.item?.ua||t.label||t.ua),o=e.computed(()=>!!n.value),l=e.computed(()=>!!t.item?.rules?.includes("required")),a=e.computed(()=>t.item?.info||"");return(s,c)=>(e.openBlock(),e.createElementBlock("div",Ao,[o.value?(e.openBlock(),e.createElementBlock("div",Fo,[e.createElementVNode("span",Mo,e.toDisplayString(n.value),1),l.value?(e.openBlock(),e.createElementBlock("span",Do,"*")):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createBlock(or,{key:1,text:a.value},null,8,["text"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"default",e.mergeProps(s.$attrs,{class:{"opacity-60":s.item.disabled}})),s.error?(e.openBlock(),e.createElementBlock("span",Lo,e.toDisplayString(s.error),1)):e.createCommentVNode("",!0)]))}}),Io={class:"w-full relative flex flex-row items-center gap-2"},Ro={key:0,class:"text-red-500 text-[14px]"},Oo={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},zo=e.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{default:()=>({container:12,label:3})}},setup(r){const t=r,n=e.computed(()=>t.item?.label||t.label||t.ua),o=e.computed(()=>t.item?.info||""),l=e.computed(()=>t.columns??{container:12,label:3}),a=e.computed(()=>{const{container:d,label:u}=l.value;return!d||d<=0?0:Math.min(Math.max(u??0,0),d)/d}),s=e.computed(()=>t.item?.type==="html"||a.value<=0?!1:!!n.value),c=e.computed(()=>{if(!s.value)return{};const d=`${a.value*100}%`;return{flexBasis:d,maxWidth:d}}),i=e.computed(()=>{const{container:d,label:u}=l.value;if(!d||d<=0)return{};if(t.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!s.value)return{flexBasis:"100%",maxWidth:"100%"};const h=Math.max(d-Math.max(u??0,0),0)/d;if(!h)return{};const x=`${h*100}%`;return{flexBasis:x,maxWidth:x}});return(d,u)=>(e.openBlock(),e.createElementBlock("div",Io,[s.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0 items-center gap-1",style:e.normalizeStyle(c.value)},[e.createTextVNode(e.toDisplayString(n.value)+" ",1),d.item?.rules?.includes("required")&&n.value?(e.openBlock(),e.createElementBlock("span",Ro,"*")):e.createCommentVNode("",!0),o.value?(e.openBlock(),e.createBlock(or,{key:1,text:o.value},null,8,["text"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"flex-1 min-w-0",style:e.normalizeStyle(i.value)},[e.renderSlot(d.$slots,"default",e.normalizeProps(e.guardReactiveProps(d.$attrs)))],4),d.error?(e.openBlock(),e.createElementBlock("span",Oo,e.toDisplayString(d.error),1)):e.createCommentVNode("",!0)]))}}),Po={class:"w-full relative"},jo={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Uo=e.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(r){return(t,n)=>(e.openBlock(),e.createElementBlock("div",Po,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",jo,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),Ho={class:"flex-1 min-w-0"},qo={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},Go={class:"truncate"},Ko={key:0,class:"text-red-500 text-[14px]"},Wo=["innerHTML"],Yo={key:0,class:"mt-1 text-xs text-red-500"},Xo={default:To,horizontal:zo,inline:Uo,settings:e.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(r){const t=r,n=e.ref("uk");e.computed(()=>(t.item??{})?.[n.value]??t.ua??t.label??"");const o=e.computed(()=>t.item?.description??""),l=e.computed(()=>Array.isArray(t.item?.rules)&&t.item.rules.includes("required")),a=e.computed(()=>(typeof t.error=="string"?t.error:"")??""),s=()=>{const c=typeof localStorage<"u"?localStorage.getItem("locale"):null;n.value=c||"uk"};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(n.value=localStorage.locale)}catch{}window.addEventListener("storage",s)}),e.onUnmounted(()=>{window.removeEventListener("storage",s)}),(c,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":c.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(c.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",Ho,[c.ua||c.label?(e.openBlock(),e.createElementBlock("p",qo,[e.createElementVNode("span",Go,e.toDisplayString(c.item[n.value]||c.ua||c.label),1),l.value?(e.openBlock(),e.createElementBlock("span",Ko,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),o.value?(e.openBlock(),e.createElementBlock("p",{key:1,class:"text-xs text-slate-500 dark:text-slate-400",innerHTML:o.value},null,8,Wo)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["w-full",["select","native-select"].includes(c.item.type)?"md:w-[30%]":"md:w-auto"])},[e.renderSlot(c.$slots,"default",e.normalizeProps(e.guardReactiveProps(c.$attrs)))],2)],2),a.value?(e.openBlock(),e.createElementBlock("p",Yo,e.toDisplayString(a.value),1)):e.createCommentVNode("",!0)],2))}})};function Ie(r){return{inputClass:e.computed(()=>{const n=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${r?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return r?.size==="sm"?`${n}h-[32px]`:`${n}h-[38px]`})}}const Zo=["placeholder","disabled"],Jo=e.defineComponent({__name:"vs-input-password",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Ie(t.style),o=e.useModel(r,"modelValue"),l=e.computed(()=>!!t.disabled),a=e.computed(()=>t.placeholder??"");return(s,c)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":c[0]||(c[0]=i=>o.value=i),placeholder:a.value,disabled:l.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Zo)),[[e.vModelText,o.value]])}}),Qo=["placeholder","disabled","maxlength","minlength"],Et=e.defineComponent({__name:"vs-input-text",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Ie(t.style),o=e.useModel(r,"modelValue"),l=e.computed(()=>!!t.disabled),a=e.computed(()=>t.placeholder??""),s=e.computed(()=>t.maxlength??void 0),c=e.computed(()=>t.minlength??void 0);function i(){typeof o.value=="string"&&(o.value=o.value.trim())}return(d,u)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":u[0]||(u[0]=h=>o.value=h),placeholder:a.value,disabled:l.value,maxlength:s.value,minlength:c.value,onBlur:i,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[d.customClass,e.unref(n),{"!border-red-600":d.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Qo)),[[e.vModelText,o.value]])}}),el=["placeholder","disabled","min","max"],lr=e.defineComponent({__name:"vs-input-number",props:e.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Ie(t.style),o=e.useModel(r,"modelValue"),l=e.computed(()=>!!t.disabled);return(a,s)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":s[0]||(s[0]=c=>o.value=c),placeholder:a.placeholder,disabled:l.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"},min:a.min,max:a.max},null,10,el)),[[e.vModelText,o.value]])}}),tl={class:"flex items-center gap-[4px]"},nl=["value","id","disabled"],rl=["for"],ol={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},ll=e.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=t,o=r,l=e.computed({get:()=>o.modelValue,set:s=>n("update:modelValue",s)}),a=e.computed(()=>!!o.disabled);return(s,c)=>(e.openBlock(),e.createElementBlock("div",tl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:s.value,"onUpdate:modelValue":c[0]||(c[0]=i=>l.value=i),class:e.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":a.value}]),id:s.id,disabled:a.value},null,10,nl),[[e.vModelCheckbox,l.value]]),e.createElementVNode("label",{for:s.id,class:e.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":a.value}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[l.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",s.error?"border-red-600":""]])},[e.createVNode(e.unref(j.Check),{class:"h-4 w-4"})],2),e.createElementVNode("span",ol,[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(s.label),1)])])],10,rl)]))}}),al=["name","value","disabled"],sl={class:"flex items-center gap-[6px] text-[14px]"},il={key:0,class:"text-[16px]"},cl=["src"],dl=e.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,o=t,l=e.computed({get:()=>n.modelValue,set:c=>{o("update:modelValue",c)}}),a=e.computed(()=>Array.isArray(l.value)?l.value.includes(n.value):l.value===!0||l.value===n.value),s=e.computed(()=>n.style?.size==="xs"?"p-1.5 text-xs":n.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(c,i)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[s.value,a.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"hidden",name:c.id,value:c.value,"onUpdate:modelValue":i[0]||(i[0]=d=>l.value=d),disabled:c.disabled},null,8,al),[[e.vModelCheckbox,l.value]]),e.createElementVNode("span",sl,[c.icon||c.imgUrl?(e.openBlock(),e.createElementBlock("span",il,[c.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(c.icon)},null,2)):e.createCommentVNode("",!0),c.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:1,src:c.imgUrl,width:"16",height:"16",alt:"icon"},null,8,cl)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(c.label),1)])])],2))}}),ul={class:"flex items-center"},_n=e.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,o=t,l=`radio-${Math.floor(Math.random()*1e4)}`,a=e.computed({get:()=>Array.isArray(n.modelValue)?Array.isArray(n.modelValue)&&n.modelValue.includes(n.value):n.modelValue,set:c=>{if(Array.isArray(n.modelValue)){let i=[...n.modelValue];c?i.includes(n.value)||i.push(n.value):i=i.filter(d=>d!==n.value),o("update:modelValue",i)}else o("update:modelValue",c)}}),s=e.ref(`vs-checkbox-${n.view||"default"}`);return(c,i)=>(e.openBlock(),e.createElementBlock("div",ul,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value==="vs-checkbox-buttons"?e.unref(dl):e.unref(ll)),{value:c.value,label:c.label,info:c.option?.info,disabled:c.disabled,modelValue:a.value,"onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),id:l,icon:c.icon,imgUrl:c.imgUrl,style:e.normalizeStyle(c.style),error:c.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),pl={key:0,class:"flex items-start gap-x-1"},fl={key:0,class:"text-red-500 text-[14px]"},ml=["title"],hl=["disabled"],vn=e.defineComponent({__name:"vs-input-switcher",props:e.mergeModels({rules:{default:()=>[]},view:{default:"checkbox"},label:{default:""},i:{default:""},text:{default:""},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue");return(o,l)=>t.view==="checkbox"?(e.openBlock(),e.createElementBlock("div",pl,[e.createVNode(_n,{modelValue:n.value,"onUpdate:modelValue":l[0]||(l[0]=a=>n.value=a),label:o.text,error:o.error||""},null,8,["modelValue","label","error"]),o.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",fl,"*")):e.createCommentVNode("",!0),o.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:o.i,onClick:l[1]||(l[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(j.Info),{class:"h-4 w-4 text-gray-500"})],8,ml)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[n.value?`bg-${o.style?.primaryColor||"blue"}-500`:"bg-stone-200",o.customClass]]),disabled:o.disabled,onClick:l[2]||(l[2]=a=>n.value=!n.value)},[e.createElementVNode("span",{"data-state":"checked",class:e.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[n.value?"translate-x-4":"translate-x-0"]])},null,2)],10,hl))}}),gl=["id","innerHTML"],Cn=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},setup(r){return(t,n)=>(e.openBlock(),e.createElementBlock("div",{id:t.name,class:e.normalizeClass(["text-gray-900",t.customClass]),innerHTML:t.html?t.html:t.text},null,10,gl))}}),yl=["placeholder","disabled","name"],En=e.defineComponent({__name:"vs-input-mask",props:e.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Ie(t.style),o=e.useModel(r,"modelValue"),l=e.ref(null);let a=null;function s(c){const i={9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},d=new Set;let u=!1;for(let x=0;x<c.length;x+=1){const g=c[x];g==="{"?u=!0:g==="}"?u=!1:u&&d.add(g)}const h={};return Object.keys(i).forEach(x=>{d.has(x)||(h[x]=i[x])}),{mask:c,definitions:h,lazy:!1}}return e.onMounted(async()=>{if(l.value){const{default:c}=await Promise.resolve().then(()=>qn),i=s(t.mask||"");a=c(l.value,i),a.on("accept",()=>{o.value=t.unmask?a.unmaskedValue:a.value}),a.on("complete",()=>{o.value=t.unmask?a.unmaskedValue:a.value}),a.value=o.value!=null?String(o.value):""}}),e.onBeforeUnmount(()=>{a?.destroy()}),e.watch(()=>t.mask,c=>{if(a){const i=s(c||"");a.updateOptions(i)}}),e.watch(o,c=>{a&&a.unmaskedValue!==c&&(a.value=c!=null?String(c):"")}),(c,i)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:l,placeholder:c.placeholder,disabled:c.disabled,name:c.name,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,10,yl))}}),bl={class:"relative w-full bg-white rounded-lg"},kl={class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},xl=["placeholder","disabled"],Bn=e.defineComponent({__name:"vs-input-email",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Ie(t.style),o=e.useModel(r,"modelValue");return(l,a)=>(e.openBlock(),e.createElementBlock("div",bl,[e.createElementVNode("div",kl,[e.createVNode(e.unref(j.Mail),{class:"h-4 w-4 stroke-gray-500 transition-all"})]),e.withDirectives(e.createElementVNode("input",{type:"email","onUpdate:modelValue":a[0]||(a[0]=s=>o.value=s),placeholder:l.placeholder,disabled:l.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,xl),[[e.vModelText,o.value]])]))}}),wl={class:"relative w-full bg-white rounded-lg"},_l={class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},vl=["value","placeholder","disabled"],Vn=e.defineComponent({__name:"vs-input-tel",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Ie(t.style),o=e.useModel(r,"modelValue"),l=e.computed(()=>o.value?o.value.startsWith("+")?o.value.slice(1):o.value:""),a=c=>{let{value:i}=c.target;i=i.replace(/^\+/,""),o.value=i?`+${i}`:""},s=c=>{const i=c,{data:d,inputType:u}=i;u&&u.startsWith("delete")||d&&/\D/.test(d)&&i.preventDefault()};return e.watch(()=>o.value,c=>{c&&!c.startsWith("+")?o.value=`+${c.replace(/^\+/,"")}`:c||(o.value="")},{immediate:!0}),(c,i)=>(e.openBlock(),e.createElementBlock("div",wl,[e.createElementVNode("div",_l,[e.createVNode(e.unref(j.Phone),{class:"h-4 w-4 stroke-gray-500 transition-all"})]),i[0]||(i[0]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[30px] text-gray-500 select-none pointer-events-none"}," + ",-1)),e.createElementVNode("input",{type:"tel",value:l.value,onInput:a,onBeforeinput:s,pattern:"^\\+[1-9]\\d{1,14}$",maxlength:"15",placeholder:c.placeholder,disabled:c.disabled,class:e.normalizeClass(["!pl-10 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":c.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,vl)]))}}),Cl=["value","disabled"],El={class:"text-[13px] text-gray-700"},Bl=e.defineComponent({__name:"vs-input-radio-default",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),o=e.computed(()=>!!t.disabled);return(l,a)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center gap-0",[t.customClass,o.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=s=>n.value=s),type:"radio",value:t.value,disabled:o.value,class:"hidden"},null,8,Cl),[[e.vModelRadio,n.value]]),e.createElementVNode("span",{class:e.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${t.style?.primaryColor||"blue"}-500`,o.value?"opacity-50 cursor-not-allowed":""]])},[n.value==t.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${t.style?.primaryColor||"blue"}-500`]])},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",El,e.toDisplayString(t.text),1)],2))}}),Vl=["value","disabled"],Sl={class:"text-[13px] text-gray-700"},$l={"vs-input-radio-default":Bl,"vs-input-radio-buttons":e.defineComponent({__name:"vs-input-radio-buttons",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),o=e.computed(()=>!!t.disabled);return(l,a)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[n.value==t.value?`ring-2 ring-ring ring-${t.style?.primaryColor||"blue"}-500`:"",t.customClass,o.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=s=>n.value=s),type:"radio",value:t.value,disabled:o.value,class:"hidden"},null,8,Vl),[[e.vModelRadio,n.value]]),e.createElementVNode("span",Sl,e.toDisplayString(t.text),1)],2))}})},Sn=e.defineComponent({__name:"vs-input-radio",props:e.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),o=e.computed(()=>$l[`vs-input-radio-${t.view}`]);return(l,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([l.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options,s=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.value),e.mergeProps({key:s?.id,text:s.text,value:s.id.toString(),checked:n.value===s.id,modelValue:n.value,"onUpdate:modelValue":a[0]||(a[0]=c=>n.value=c)},{ref_for:!0},l.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),Nl={key:1,class:"w-full flex flex-col gap-4"},Al={key:0,class:"text-sm font-medium text-muted-foreground my-2"},Fl="Без категорії",Ml=e.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},group:{default:void 0},values:{default:()=>[]},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,o=t,l=e.ref([]),a=e.reactive({}),s=g=>g?.value||g?.id||g?.text||g,c=g=>g.text||String(g),i=g=>`lg:col-span-${g||12}`,d=e.computed(()=>[n.position==="vertical"?"flex flex-col":"",n.colSpan?"grid":"flex justify-start"]),u=g=>g==null||g===""?null:typeof g=="string"||typeof g=="number"?g:String(g),h=e.computed(()=>{if(!n.group)return[];const g=new Map;l.value.forEach(_=>{const k=_[n.group],C=u(k);g.has(C)||g.set(C,[]),g.get(C)?.push(_)});const m=[];n.values?.length&&n.values.forEach(_=>{const k=u(_);m.push(k)});const f=new Set,b=_=>{const k=g.get(_)||[];if(!k.length)return null;const C=_===null?"group-null":`group-${String(_)}`,E=_===null?Fl:String(_);return f.add(_),{key:C,label:E,options:k}},w=[];return m.forEach(_=>{const k=b(_);k&&w.push(k)}),g.forEach((_,k)=>{if(f.has(k))return;const C=b(k);C&&w.push(C)}),w}),x=async()=>{try{const g=await fetch(`/api/suggest/${n.data}`).then(m=>m.json());l.value=g?.data||g}catch(g){console.error(g)}};return e.watch(()=>n.modelValue,g=>{if(typeof g=="boolean"&&l.value.length===1){const m=s(l.value[0]);a[m]=g}else if(Array.isArray(g)){const m=new Set(g);l.value.forEach(f=>{if(!f.disabled){const b=s(f);a[b]=m.has(b)}})}},{immediate:!0}),e.watch(a,()=>{if(!l.value.length){o("update:modelValue",null);return}const g=Object.entries(a).filter(([,m])=>m).map(([m])=>m);o("update:modelValue",g.length===0?[]:g)},{deep:!0}),e.onMounted(()=>{if(n.data)x().then(()=>{if(typeof n.modelValue=="boolean"&&l.value.length===1){const g=s(l.value[0]);a[g]=n.modelValue}else if(Array.isArray(n.modelValue)){const g=new Set(n.modelValue);l.value.forEach(m=>{if(!m.disabled){const f=s(m);a[f]=g.has(f)}})}});else if(l.value=n.options,typeof n.modelValue=="boolean"&&l.value.length===1){const g=s(l.value[0]);a[g]=n.modelValue}else if(Array.isArray(n.modelValue)){const g=new Set(n.modelValue);l.value.forEach(m=>{if(!m.disabled){const f=s(m);a[f]=g.has(f)}})}}),(g,m)=>n.group?(e.openBlock(),e.createElementBlock("div",Nl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,f=>(e.openBlock(),e.createElementBlock("div",{key:f.key,class:"flex flex-col gap-2"},[f.label?(e.openBlock(),e.createElementBlock("span",Al,e.toDisplayString(f.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.options,b=>(e.openBlock(),e.createBlock(_n,{modelValue:a[s(b)],"onUpdate:modelValue":w=>a[s(b)]=w,value:s(b),class:e.normalizeClass(i(g.colSpan)),disabled:n.disabled||b.disabled,label:c(b),key:`${f.key}-${s(b)}`,icon:b?.icon,imgUrl:b?.imgUrl,option:b,view:g.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["p-0 w-full gap-[10px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,f=>(e.openBlock(),e.createBlock(_n,{modelValue:a[s(f)],"onUpdate:modelValue":b=>a[s(f)]=b,value:s(f),class:e.normalizeClass(i(g.colSpan)),disabled:n.disabled||f.disabled,label:c(f),key:s(f),icon:f?.icon,imgUrl:f?.imgUrl,option:f,view:g.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),me=(r,t)=>{const n=r.__vccOpts||r;for(const[o,l]of t)n[o]=l;return n},ar=me(Ml,[["__scopeId","data-v-8e66207e"]]),Dl=["type","placeholder","disabled"],Ll=e.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},mode:{default:"date"}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r;function o(u){return u?n.mode==="datetime"?(u.includes("T")?u:null)||u+(u.includes(" ")?"":"T00:00"):u?.split(" ")[0]:null}const{inputClass:l}=Ie(n.style),a=t,s=e.computed({get:()=>o(n.modelValue),set:u=>a("update:modelValue",u)}),c=e.computed(()=>n.mode==="datetime"?"datetime-local":n.mode),i=e.computed(()=>!!n.disabled),d=e.computed(()=>n.placeholder??"");return(u,h)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:c.value,"onUpdate:modelValue":h[0]||(h[0]=x=>s.value=x),placeholder:d.value,disabled:i.value,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[u.modelValue?"":"text-opacity-50",e.unref(l)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Dl)),[[e.vModelDynamic,s.value]])}}),Tl=(r,t)=>{if(!t||!Object.keys(t).length)return r;const[n,o=""]=r.split("?"),l=new URLSearchParams(o);Object.entries(t).forEach(([s,c])=>{c==null||c===""||l.set(s,String(c))});const a=l.toString();return a?`${n}?${a}`:n},sr=async(r,t={})=>{try{const n=new FormData;n.append("unique","true"),n.append("file",r);const{api:o,id:l="1",form:a="form",table:s="table",customParams:c}=t,i=o||`/file/upload/uploads?id=${l||""}&form=${a||""}&table=${s||""}`,d=Tl(i,c);return(await fetch(d,{method:"POST",body:n}).then(h=>h.json()))?.result}catch(n){return ue.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",n),null}},Il=async r=>{try{return await fetch(`file/delete${r}`),!0}catch(t){return console.error(t),!1}},ir=async r=>{try{const t=await fetch(`/file/download/files/uploads${r}`),n=await t.arrayBuffer(),o=t.headers["content-type"],l=new TextDecoder("utf-8").decode(n),a=new Blob([l],{type:o}),s=document.createElement("a");s.setAttribute("download",r),s.href=window.URL.createObjectURL(a),s.click()}catch(t){console.error(t.message)}},Rl=r=>{if(!r)return"";const t=r?.split(".");return t[t.length-1]},Ol=r=>{const t=Rl(r),n={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return n.imageFormat.includes(t)?"img":n.sheetsFormat.includes(t)?j.Table:n.textsFormat.includes(t)?j.FileCode:n.documentsFormat.includes(t)?j.FileText:n.archivesFormat.includes(t)?j.FileArchive:j.FileText},zl=["title"],Pl={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},$n=me(e.defineComponent({__name:"vs-input-file-list-item",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(r){const t=e.useModel(r,"value"),n=e.useModel(r,"item"),o=r,l=e.computed(()=>n.value?typeof n.value=="string"?n.value:n.value.file_path:""),a=c=>typeof c=="string"?c:c?.file_path||"",s=()=>{const c=l.value;Il(c),o.multiple&&Array.isArray(t.value)?t.value=t.value.filter(i=>a(i)!==c):t.value=""};return(c,i)=>(e.openBlock(),e.createElementBlock("div",{title:l.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Ol)(l.value)),{src:l.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:i[0]||(i[0]=d=>e.unref(ir)(l.value))},null,8,["src"])),e.createElementVNode("div",Pl,[e.createElementVNode("button",{type:"button",onClick:s,class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[e.createVNode(e.unref(j.Trash2),{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:i[1]||(i[1]=d=>e.unref(ir)(l.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[e.createVNode(e.unref(j.Download),{class:"w-4 h-4"})])])],8,zl))}}),[["__scopeId","data-v-67f822ce"]]),jl={class:"flex items-center gap-x-2"},Ul=["accept","multiple","disabled"],Hl={key:1,class:"flex items-center flex-wrap gap-2"},ql={key:1,class:"loader"},Gl={key:1,class:"loader"},cr=me(e.defineComponent({__name:"vs-input-file",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["change"],["update:modelValue"]),setup(r,{emit:t}){const n=r,o=e.useModel(r,"modelValue"),l=t,a=e.ref(null),s=e.ref(!1),c=e.inject("values"),i=e.computed(()=>n.format?n.format.split(",").map(w=>w.trim().toLowerCase()).filter(Boolean):[]),d=w=>{if(n.max_size&&w.size>n.max_size*1024*1024){const _=(w.size/1048576).toFixed(2);return ue.notify({type:"error",title:"Помилка!",message:`Файл "${w.name}" занадто великий. Максимальний розмір: ${n.max_size} МБ, розмір файлу: ${_} МБ`,position:"right-bottom"}),!1}return!0},u=w=>{if(!i.value.length)return!0;const _=`.${w.name.split(".").pop()?.toLowerCase()||""}`,k=i.value.includes(_);return k||ue.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${w.name}". Дозволені формати: ${i.value.join(", ")}`,position:"right-bottom"}),k},h=e.computed(()=>{const w={},_=[];if(!n.customParams?.length)return{params:w,missingSources:_};const k=c?.value??{};return n.customParams.forEach(C=>{if(!C)return;const[E,I]=C.split("="),A=E?.trim(),B=I?.trim();if(!A||!B)return;const $=k[B];if($==null||$===""){_.push(B);return}w[A]=$}),{params:w,missingSources:_}}),x=()=>{const{params:w}=h.value;return{api:n.api,customParams:Object.keys(w).length?w:void 0}},g=()=>{const w=h.value.missingSources;if(!w.length)return!0;const _=w.join(", ");return ue.notify({type:"warning",title:"Заповніть поля",message:`Поля (${_}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},m=w=>{ue.notify({type:"error",title:"Помилка завантаження",message:w||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},f=()=>{n.disabled||s.value||g()&&a.value?.click()},b=async w=>{const{files:_}=w.target;if(!_||_.length===0)return;if(!g()){a.value&&(a.value.value="");return}const k=Array.from(_);if(n.max_size&&k.filter(I=>!d(I)).length>0){a.value&&(a.value.value="");return}if(k.filter(E=>!u(E)).length>0){a.value&&(a.value.value="");return}s.value=!0;try{if(n.multiple){const E=Array.from(_).map(async $=>await sr($,x())),I=await Promise.all(E),A=I.filter($=>$?.file_path);if(A.length===0){m();return}A.length<I.length&&m("Деякі файли не вдалося завантажити. Перевірте їх та спробуйте знову.");const B=A.map($=>({file_id:$.file_id??$.file_path,file_path:$.file_path}));o.value=[...o.value||[],...B],l("change",o.value)}else{const E=_[0],I=await sr(E,x());if(!I?.file_path){m();return}o.value={file_id:I.file_id??I.file_path,file_path:I.file_path},l("change",o.value)}}catch(E){const I=E?.message||void 0;m(I)}finally{s.value=!1,a.value&&(a.value.value="")}};return(w,_)=>(e.openBlock(),e.createElementBlock("div",jl,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:a,type:"file",accept:n.format,multiple:w.multiple,onChange:b,disabled:s.value||w.disabled},null,40,Ul),!w.multiple&&o.value&&!Array.isArray(o.value)?(e.openBlock(),e.createBlock($n,{key:0,item:o.value,value:o.value,"onUpdate:value":_[0]||(_[0]=k=>o.value=k)},null,8,["item","value"])):w.multiple?(e.openBlock(),e.createElementBlock("div",Hl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(k,C)=>(e.openBlock(),e.createBlock($n,{multiple:w.multiple,key:C,value:o.value,"onUpdate:value":_[1]||(_[1]=E=>o.value=E),item:k},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:f,class:e.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",w.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[s.value?(e.openBlock(),e.createElementBlock("div",ql)):(e.openBlock(),e.createBlock(e.unref(j.Plus),{key:0,class:"h-4 w-4"}))],2)])):e.createCommentVNode("",!0),w.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:f,class:e.normalizeClass([w.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[s.value?(e.openBlock(),e.createElementBlock("div",Gl)):(e.openBlock(),e.createBlock(e.unref(j.Plus),{key:0,class:"h-4 w-4"}))],2))]))}}),[["__scopeId","data-v-b79e26bd"]]),Kl={class:"vs-input-file2 flex flex-col gap-4"},Wl={class:"flex items-center gap-x-2"},Yl=["accept","disabled"],Xl={key:0,class:"absolute inset-0 flex flex-col items-center justify-center gap-1 rounded-lg bg-white/90 text-xs font-medium text-slate-600"},Zl={key:0,class:"rounded-lg border border-[#CFD9E0] bg-white p-4 shadow-sm"},Jl={class:"flex items-center justify-between text-sm"},Ql={class:"truncate pr-4"},ea={class:"font-medium text-slate-800 truncate"},ta={class:"text-slate-500"},na={class:"text-slate-500 whitespace-nowrap"},ra={class:"mt-3 h-2 rounded-full bg-slate-100 overflow-hidden"},oa={class:"mt-3 flex flex-wrap gap-2 text-sm"},la={key:0,class:"mt-2 text-sm text-rose-600"},aa=e.defineComponent({__name:"vs-input-file2",props:e.mergeModels({format:{},max_size:{},api:{},chunkSize:{default:5*1024*1024},subdir:{default:""},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),o=e.ref(null),l=e.ref(null),a=e.ref(""),s=e.ref(0),c=e.ref(!1),i=e.ref(""),d=e.ref(null),u=e.inject("values"),h=e.computed(()=>t.format?t.format.split(",").map(F=>F.trim().toLowerCase()).filter(Boolean):[]),x=e.computed(()=>!l.value||!l.value.size?0:Math.min(100,Math.round(s.value/l.value.size*100))),g=e.computed(()=>l.value?`${b(s.value)} / ${b(l.value.size)}`:""),m=e.computed(()=>t.disabled?"opacity-50 cursor-not-allowed":c.value?"cursor-default text-blue-500":"cursor-pointer hover:border-blue-500 hover:bg-blue-50 hover:text-blue-500"),f=()=>{t.disabled||c.value||C()&&o.value?.click()},b=F=>{if(!Number.isFinite(F))return"0 B";const P=["B","KB","MB","GB"];let M=0,O=F;for(;O>=1024&&M<P.length-1;)O/=1024,M+=1;return`${O.toFixed(M===0?0:1)} ${P[M]}`},w=F=>{if(!t.max_size)return!0;const P=t.max_size*1024*1024;return F.size>P?(ue.notify({type:"error",title:"Файл занадто великий",message:`Максимальний розмір ${t.max_size} МБ`,position:"right-bottom"}),!1):!0},_=F=>{if(!h.value.length)return!0;const P=`.${F.name.split(".").pop()?.toLowerCase()||""}`;return h.value.includes(P)?!0:(ue.notify({type:"error",title:"Непідтримуваний формат",message:`Дозволені формати: ${h.value.join(", ")}`,position:"right-bottom"}),!1)},k=e.computed(()=>{const F={},P=[];if(!t.customParams?.length)return{params:F,missing:P};const M=u?.value??{};return t.customParams.forEach(O=>{if(!O)return;const[T,G]=O.split("="),W=T?.trim(),X=G?.trim();if(!W||!X)return;const ne=M[X];ne==null||ne===""?P.push(X):F[W]=ne}),{params:F,missing:P}}),C=()=>k.value.missing.length?(ue.notify({type:"warning",title:"Заповніть поля",message:`Потрібні значення: ${k.value.missing.join(", ")}`,position:"right-bottom"}),!1):!0,E=F=>{const P=F.target,M=P.files?.[0];if(M){if(!C()){P.value="";return}if(!w(M)||!_(M)){P.value="";return}l.value=M,s.value=0,a.value="",i.value=""}},I=async()=>{if(!l.value){f();return}try{i.value="";const F={id:a.value||"",fileName:l.value.name,subdir:t.subdir,size:l.value.size,...k.value.params},P=await fetch("/api/file/upload2/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)});if(!P.ok)throw new Error("Не вдалося ініціалізувати завантаження");const M=await P.json();a.value=M.id||a.value,s.value=M.uploaded||0,await A()}catch(F){i.value=F?.message||"Помилка при старті завантаження"}},A=async()=>{if(!(!l.value||!a.value)){c.value=!0;try{for(;s.value<l.value.size;){const F=s.value,P=Math.min(F+t.chunkSize,l.value.size),M=l.value.slice(F,P);d.value=new AbortController;const O=await fetch(`/api/file/upload2/${a.value}`,{method:"PATCH",headers:{"Content-Range":`bytes ${F}-${P-1}/${l.value.size}`},body:M,signal:d.value.signal});if(!O.ok)throw new Error("Помилка завантаження частини");const T=await O.json().catch(()=>({}));if(T.uploaded!=null?s.value=Number(T.uploaded):s.value=P,T.finished||s.value>=l.value.size){c.value=!1;const G=T.file_path||T.url||a.value;n.value={file_id:T.file_id??a.value??G,file_path:G},ue.notify({type:"success",title:"Файл завантажено",message:l.value.name,position:"right-bottom"}),L();return}}}catch(F){if(F?.name==="AbortError")return;i.value=F?.message||"Помилка при завантаженні",c.value=!1}finally{d.value=null,c.value=!1}}},B=()=>{c.value&&(d.value?.abort(),d.value=null,c.value=!1)},$=async()=>{if(l.value){if(!a.value){await I();return}await A()}},S=()=>{d.value?.abort(),d.value=null,L()},L=()=>{const F=o.value;F&&(F.value=""),l.value=null,a.value="",s.value=0,i.value=""};return(F,P)=>(e.openBlock(),e.createElementBlock("div",Kl,[e.createElementVNode("div",Wl,[e.createElementVNode("input",{ref_key:"fileInput",ref:o,type:"file",class:"hidden",accept:t.format,disabled:c.value||t.disabled,onChange:E},null,40,Yl),n.value?(e.openBlock(),e.createBlock($n,{key:0,item:n.value,"onUpdate:item":P[0]||(P[0]=M=>n.value=M),value:n.value,"onUpdate:value":P[1]||(P[1]=M=>n.value=M)},null,8,["item","value"])):(e.openBlock(),e.createElementBlock("div",{key:1,onClick:f,class:e.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",m.value])},[c.value?(e.openBlock(),e.createElementBlock("div",Xl,[P[2]||(P[2]=e.createElementVNode("div",{class:"loader"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(x.value)+"%",1)])):(e.openBlock(),e.createBlock(e.unref(j.Plus),{key:1,class:"h-4 w-4"}))],2))]),l.value&&!n.value?(e.openBlock(),e.createElementBlock("div",Zl,[e.createElementVNode("div",Jl,[e.createElementVNode("div",Ql,[e.createElementVNode("div",ea,e.toDisplayString(l.value.name),1),e.createElementVNode("div",ta,e.toDisplayString(b(l.value.size)),1)]),e.createElementVNode("div",na,e.toDisplayString(g.value),1)]),e.createElementVNode("div",ra,[e.createElementVNode("div",{class:"h-full rounded-full bg-blue-500 transition-all duration-300",style:e.normalizeStyle({width:`${x.value}%`})},null,4)]),e.createElementVNode("div",oa,[!c.value&&s.value>0&&s.value<(l.value?.size||0)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:$}," Resume ")):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:B}," Pause ")):e.createCommentVNode("",!0),!c.value&&s.value===0?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:I}," Upload ")):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"rounded border border-rose-200 px-3 py-1 text-rose-600",onClick:S}," Cancel ")]),i.value?(e.openBlock(),e.createElementBlock("p",la,e.toDisplayString(i.value),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),Nn=me(aa,[["__scopeId","data-v-62ba7299"]]),sa={class:"flex items-center justify-center h-[30px] w-[30px]"},ia={class:"max-w-[55vw]"},ca={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},da={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},ua={class:"px-[5px]"},pa={class:""},Kt=e.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(r){const t=r,n=e.computed(()=>{try{return new Date(t.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function o(l){if(l<1024)return`${l} B`;const a=l/1024;return a<1024?`${a.toFixed(2)} KB`:`${(a/1024).toFixed(2)} MB`}return(l,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",sa,[e.createVNode(e.unref(j.FileText),{class:"icon icon-tabler icons-tabler-outline icon-tabler-file h-4 w-4"})]),e.createElementVNode("div",ia,[e.createElementVNode("p",ca,e.toDisplayString(l.item?.uploaded_name),1),e.createElementVNode("p",da,[e.createElementVNode("span",null,e.toDisplayString(l.item?.username),1),e.withDirectives(e.createElementVNode("span",ua,"|",512),[[e.vShow,l.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(n.value),1),a[0]||(a[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",pa,e.toDisplayString(o(l.item?.size)),1)])])],64))}}),fa={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},ma={key:0,class:"flex w-full gap-x-3 items-center"},ha={key:1,class:"flex gap-x-3 w-full items-center"},ga={key:2,class:"flex gap-x-3 w-full items-center"},ya=["href"],ba={key:3,class:"flex gap-x-3 w-full items-center"},ka={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},xa={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"},wa={class:"inline-block"},_a={class:"inline-block"},va=e.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(r,{emit:t}){const n=r,o=t;function l(u){return["pdf","json"].includes(u.ext)}function a(u){return["ppt","pptx","doc","docx","xls","xlsx"].includes(u.ext)}function s(u){const h=document.createElement("a");h.setAttribute("download",u?.uploaded_name),h.href=u?.file_path,h.click()}async function c(){try{await fetch(`${n.prefix}/widget/file/${n.item.entity_id}/${n.item.file_id}`),o("update")}catch(u){console.error(u)}}function i(){o("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:c,updateListOnConfirm:!0})}function d(u){(n.item.ext==="jpg"||n.item.ext==="png")&&o("openLightbox",{item:n.item,index:u})}return(u,h)=>(e.openBlock(),e.createElementBlock("div",fa,[u.item.ext==="jpg"||u.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",ma,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:h[0]||(h[0]=x=>d(u.index))},[e.createVNode(Kt,{item:u.item},null,8,["item"])])])):l(u.item)?(e.openBlock(),e.createElementBlock("div",ha,[e.createVNode(Kt,{item:u.item},null,8,["item"])])):a(u.item)?(e.openBlock(),e.createElementBlock("div",ga,[e.createElementVNode("a",{href:`/api/file-preview?id=${u.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(Kt,{item:u.item},null,8,["item"])],8,ya)])):(e.openBlock(),e.createElementBlock("div",ba,[e.createVNode(Kt,{item:u.item},null,8,["item"])])),e.createElementVNode("div",ka,[e.createElementVNode("div",xa,[e.createElementVNode("div",wa,[e.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:h[1]||(h[1]=x=>s(u.item))},[e.createVNode(e.unref(j.Download),{class:"h-4 w-4"})])]),h[3]||(h[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",_a,[e.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:h[2]||(h[2]=x=>i())},[e.createVNode(e.unref(j.Trash2),{class:"h-4 w-4"})])])])])]))}}),Ca={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},Ea={class:"flex w-full mb-[12px] items-center gap-x-2"},Ba={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},Va={class1:"ml-auto"},Sa={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"},$a={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},Na={class:"relative"},Aa={class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},Fa={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"},Ma={key:0},dr=e.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update"],setup(r,{emit:t}){const n=r,o=e.inject("form"),l=e.computed(()=>o.value.formId),a=e.ref(!1),s=e.ref(0),c=t,i=e.ref(!1),d=e.ref({}),u=e.ref([]),h=e.ref(""),x=e.computed(()=>Array.isArray(u.value)?u.value.filter(k=>k.ext==="jpg"||k.ext==="png").map(k=>k?.file_path):[]),g=e.computed(()=>h.value===""?u.value:u.value.filter(k=>k?.uploaded_name?.includes(h.value))),m=k=>{const C=x.value.findIndex(E=>E===k.item.file_path);C!==-1&&(a.value=!0,s.value=C)},f=async()=>{try{const k=await fetch(`${n.prefix}/widget/file/${l.value}`).then(C=>C.json());u.value=k?.rows}catch(k){console.error(k)}},b=async k=>{await Promise.all(Array.from(k.target.files).map(async C=>{const E=new FormData;E.append("file",C);try{const I=`${n.prefix}/widget/file/${l.value}`,A=await fetch(I,{method:"POST",body:E});return A.ok?(c("update","file-list"),C):(ue.notify({type:A.status>=400&&A.status<500?"warning":"error",title:"Error",message:`Error code: ${A.status}`}),null)}catch(I){return ue.notify({type:"error",title:"Error",message:I.message||"Unknown error"}),console.error(I),null}})),await f()},w=k=>{const C={...k};return k.cancel||(C.cancel=()=>{i.value=!1}),k.updateListOnConfirm&&(C.confirm=async()=>{await k.confirm(),i.value=!1,f()}),C},_=k=>{d.value=w(k),i.value=!0};return e.watch(l,k=>{k&&f()}),e.onMounted(()=>{l.value&&f()}),(k,C)=>{const E=e.resolveComponent("Lightbox"),I=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",Ca,[e.createElementVNode("div",Ea,[e.createElementVNode("h2",Ba," Файлів: "+e.toDisplayString(u.value?.length),1),e.createElementVNode("div",Va,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:C[0]||(C[0]=A=>b(A))},null,32),e.createElementVNode("div",Sa,[e.createVNode(e.unref(j.Upload),{class:"h-4 w-4"})])])])]),u.value?.length>4?(e.openBlock(),e.createElementBlock("div",$a,[e.createElementVNode("div",null,[e.createElementVNode("div",Na,[e.createElementVNode("div",Aa,[e.createVNode(e.unref(j.Search),{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400"})]),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":C[1]||(C[1]=A=>h.value=A),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[e.vModelText,h.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),u.value?.length?(e.openBlock(),e.createElementBlock("div",Fa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(A,B)=>(e.openBlock(),e.createBlock(va,{key:B,prefix:k.prefix,item:A,index:B,onUpdate:C[2]||(C[2]=$=>k.$emit("update","file-list")),onOpenModal:C[3]||(C[3]=$=>_($)),onOpenLightbox:C[4]||(C[4]=$=>m($))},null,8,["prefix","item","index"]))),128)),g.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ma,C[8]||(C[8]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):e.createCommentVNode("",!0),e.createVNode(E,{modelValue:a.value,"onUpdate:modelValue":C[5]||(C[5]=A=>a.value=A),startIndex:s.value,"onUpdate:index":C[6]||(C[6]=A=>s.value=A),images:x.value},null,8,["modelValue","startIndex","images"]),e.createVNode(I,e.mergeProps({modelValue:i.value,"onUpdate:modelValue":C[7]||(C[7]=A=>i.value=A),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),Da={class:"flex items-center justify-between"},La={class:"text-[16px] text-gray-900 font-medium"},Ta={class:"grid gap-3"},Ia=me(e.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(r){const t=r,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,o=>{n.value=o}),(o,l)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Da,[e.createElementVNode("p",La,e.toDisplayString(r.title),1),e.createVNode(vn,{modelValue:n.value,"onUpdate:modelValue":l[0]||(l[0]=a=>n.value=a),style:e.normalizeStyle(r.style)},null,8,["modelValue","style"])]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Ta,[e.renderSlot(o.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),Ra={class:"text-[16px] text-gray-900 font-medium"},Oa={class:"grid gap-3"},za=me(e.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(r){const t=r,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,o=>{n.value=o}),(o,l)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("button",{type:"button",onClick:l[0]||(l[0]=a=>n.value=!n.value),class:"flex items-center gap-2"},[e.createVNode(e.unref(j.ChevronDown),{class:e.normalizeClass(["h-4 w-4 duration-300",[n.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",Ra,e.toDisplayString(r.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Oa,[e.renderSlot(o.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-0c825d65"]]),Pa={class:"flex items-center justify-between"},ja={switcher:Ia,accordion:za,default:e.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(r){return(t,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Pa,[e.createElementVNode("p",null,e.toDisplayString(r.title),1)]),e.renderSlot(t.$slots,"default")]))}})},Xe={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Ua=(r,t)=>String(r)===String(t),Ha=(r,t)=>String(r)!==String(t),qa=(r,t)=>r>t,Ga=(r,t)=>r>=t,Ka=(r,t)=>r<t,Wa=(r,t)=>r<=t,Ya=(r,t)=>Array.isArray(t)&&t.length===2?r>=t[0]&&r<=t[1]:!1,Xa=(r,t)=>String(r).startsWith(String(t)),Za=(r,t)=>String(r).endsWith(String(t)),Ja=(r,t)=>String(r).includes(String(t)),Qa=(r,t)=>Array.isArray(t)?t.includes(r):!1,es=(r,t)=>Array.isArray(t)?!t.includes(r):!0,ur=(r,t)=>{if(!t)return!0;switch(t?.[1]){case Xe.Equal:return Ua(r,t?.[2]);case Xe.Inequal:return Ha(r,t?.[2]);case Xe.Higer:return qa(r,t?.[2]);case Xe.HigerOrEqual:return Ga(r,t?.[2]);case Xe.Lower:return Ka(r,t?.[2]);case Xe.LowerOrEqual:return Wa(r,t?.[2]);case Xe.Between:return Ya(r,t?.[2]);case Xe.StartWith:return Xa(r,t?.[2]);case Xe.EndWith:return Za(r,t?.[2]);case Xe.Contain:return Ja(r,t?.[2]);case Xe.In:return Qa(r,t?.[2]);case Xe.NotIn:return es(r,t?.[2]);default:return!0}},pr=e.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(r){const t=r,n=e.inject("values",e.ref({})),o=e.inject("form"),l=e.computed(()=>t.schema?.filter(c=>{const i=c?.conditions;if(!i)return!0;const d=Array.isArray(i)?i[0]:i,u=t.name?n.value?.[t.name]?.[d]??n.value?.[d]:n.value?.[d];return ur(u,i)})),a=e.computed(()=>ja[t.view]),s=e.computed(()=>{if(n.value||(n.value={}),!t.name)return n.value;const c=n.value[t.name];if(c)return c;const i={};return n.value={...n.value,[t.name]:i},i});return(c,i)=>r.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),{key:0,title:r.title,style:e.normalizeStyle(r.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,d=>(e.openBlock(),e.createBlock(Mr,e.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:s.value[d.name],"onUpdate:modelValue":u=>s.value[d.name]=u,style:r.style,error:e.unref(o)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),ts=["aria-expanded","data-focus"],ns={class:"relative flex flex-1 items-center gap-1 py-0.5 pl-1 pr-0 overflow-hidden h-full min-w-0"},rs={key:0,class:"flex flex-nowrap items-center gap-1 overflow-x-auto overflow-y-hidden min-w-0 flex-1 py-0.5"},os={class:"flex items-center gap-1 min-w-0"},ls=["title"],as=["innerHTML"],ss=["onClick"],is={class:"flex-1 min-w-[2px]"},cs=["placeholder"],ds=["title"],us=["innerHTML"],ps={key:3,class:"truncate flex-1 min-w-0"},fs={key:2,class:"flex-1 min-w-[2px]"},ms=["placeholder"],hs={class:"flex items-center shrink-0"},gs=["disabled"],ys={key:1,class:"self-stretch w-px bg-[#ccc] my-[1px]"},bs=["disabled","title"],ks=["aria-disabled","onClick"],xs=["innerHTML"],ws={key:1,class:"px-3 py-2 text-center text-gray-500"},_s=["disabled"],An="w-[16px] h-[16px] flex items-center justify-center flex-shrink-0 text-current",Fn=me(e.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},start:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{},maxlength:{},minlength:{}},emits:["change","update:modelValue","value-selected"],setup(r,{emit:t}){const n=r,o=t,l=e.computed(()=>n.multiple),a=e.computed(()=>n.disabled);Ie(n.style);const s=e.computed({get:()=>n.modelValue,set:R=>o("update:modelValue",R)});!s.value&&n.defaultValue&&(s.value=n.defaultValue);const c=e.ref(null),i=e.ref(null),d=e.ref(null),u=e.ref(null),h=e.ref(!1),x=e.ref(!1),g=e.ref(null),m=e.ref([]),f=e.ref(-1),b=e.ref([]),w=e.ref(""),_=e.ref(null),k=e.ref("bottom"),C=e.ref({}),E=e.ref([]),I=e.computed(()=>{if(!E.value.length)return[];const R=m.value,Y=new Map(R.map(q=>[q.id?.toString(),q]));return E.value.map(q=>Y.get(q?.toString())).filter(q=>!!q)}),A=e.computed(()=>n.placeholder||"Select..."),B=e.computed(()=>W(g.value));e.computed(()=>l.value?!E.value.length&&w.value==="":!B.value&&w.value==="");const $=e.computed(()=>a.value?!1:l.value?E.value.length>0:!!s.value),S=R=>l.value?E.value.some(Y=>Y?.toString()===R?.toString()):s.value?.toString()===R?.toString(),L=e.computed(()=>{let R=m.value??[];if(!n.data&&w.value.trim()!==""){const Y=w.value.toLowerCase();R=R.filter(q=>{const se=W(q).toLowerCase(),xe=q.text?.toLowerCase?.()||"";return se.includes(Y)||xe.includes(Y)})}if(l.value&&E.value.length){const Y=new Set(E.value.map(q=>q?.toString()));R=R.filter(q=>!Y.has(q.id?.toString()))}return R}),F=e.inject("values"),P=e.inject("field-props"),M=/\{\{\s*([^}]+?)\s*\}\}/g,O=R=>(R?String(R):"").replace(/<[^>]*>/g,"").trim(),T=e.computed(()=>n.slot??n?.optionTemplate??""),G=R=>{if(!R)return"";const Y=T.value;return Y?Y.replace(M,(q,se)=>{const xe=se.trim(),be=R[xe];return be!=null?String(be):""}):R.text??""},W=R=>{if(!R)return"";if(!T.value)return R.text??"";const q=G(R);return O(q)||R.text||""},X=R=>R?R.icon??null:null,ne=R=>!!(R?.color&&!X(R)),we=R=>R?.color?{color:R.color}:void 0,ge=R=>!!X(R),J=(R,Y,q)=>{if(!P)return!1;const se=P.value?.[R]??{},xe=(ve,Ne,Ee)=>{if(!Ne.length)return ve;const[ze,...je]=Ne,We={...ve};if(!je.length)return We[ze]=Ee,We;const St=typeof ve[ze]=="object"&&ve[ze]!==null?ve[ze]:{};return We[ze]=xe(St,je,Ee),We},be=xe(se,Y,q);return P.value={...P.value||{},[R]:be},!0},re=R=>{if(!n.set)return;const Y=F?.value;!Y&&!P||Object.entries(n.set).forEach(([q,se])=>{if(!q)return;const xe=R?R[se]:null,be=q.split(".").map(Ee=>Ee.trim()).filter(Boolean);if(!be.length)return;const[ve,...Ne]=be;Ne.length&&J(ve,Ne,xe??null)||Y&&(Y[ve]=xe??null)})},de=e.computed(()=>n.parent?F?.value?.[n.parent]?.toString()??null:null),ce=async R=>{if(!n.data){let Y=n.options??[];if(R?.trim()){const q=R.toLowerCase();Y=Y.filter(se=>{const xe=W(se).toLowerCase(),be=se.text?.toLowerCase?.()||"";return xe.includes(q)||be.includes(q)})}return Y}try{const Y=n.host??"",q=n.prefix??"api",se=n.api??`/${q}/suggest/${n.data}`,xe=`${Y}${se}`,be=new URLSearchParams;return be.set("json","1"),R&&be.set("key",R),de.value!==void 0&&de.value!==null&&de.value!==""&&be.set("parent",de.value),n.start===1&&be.set("start","1"),(await fetch(`${xe}?${be.toString()}`).then(Ne=>Ne.json()))?.data??[]}catch{return[]}},ye=async()=>{n.data?m.value=await ce(w.value):m.value=n.options?[...n.options]:[]},Le=async R=>{if(R==null||R==="")return null;const Y=m.value?.find(q=>q?.id?.toString()===String(R));if(Y)return Y;if(n.data)try{const q=n.host??"",se=n.prefix??"api",xe=n.api??`/${se}/suggest/${n.data}`,be=`${q}${xe}`,ve=new URLSearchParams;return ve.set("json","1"),ve.set("val",String(R)),de.value!==void 0&&de.value!==null&&de.value!==""&&ve.set("parent",de.value),n.start===1&&ve.set("start","1"),((await fetch(`${be}?${ve.toString()}`).then(ze=>ze.json()))?.data??[])?.[0]??null}catch{return null}return null},$e=async R=>{const Y=new Set(m.value.map(se=>se.id?.toString())),q=R.filter(se=>!Y.has(se?.toString()));q.length&&await q.reduce(async(se,xe)=>{await se;const be=await Le(xe);be&&m.value.push(be)},Promise.resolve())},tt=()=>{if(!L.value.length){f.value=-1;return}let R=0;if(!l.value&&g.value){const Y=g.value.id?.toString(),q=L.value.findIndex(se=>se.id?.toString()===Y);q>=0&&(R=q)}f.value=R,e.nextTick(()=>{_e(b.value[R],d.value)})},it=async()=>{a.value||(h.value=!0,await ye(),await e.nextTick(()=>{Q(),_.value?.focus()}),tt())},Re=()=>{h.value=!1,f.value=-1,e.nextTick(()=>{_.value?.blur()})},Be=async R=>{if(a.value)return;!h.value?await it():Re()},U=async()=>{if(!a.value){if(h.value){Re();return}await it()}},Z=()=>{l.value?(E.value=[],s.value=[],o("change",[]),ae(null,[])):(g.value=null,s.value=null,o("change",null),ae(null,null)),re(null),w.value="",e.nextTick(()=>_.value?.focus())},ee=R=>{l.value&&(E.value=E.value.filter(Y=>Y?.toString()!==R?.toString()),s.value=[...E.value],o("change",s.value),ae(null),e.nextTick(()=>_.value?.focus()))},ae=(R,Y)=>{const q=Y??(l.value?[...E.value]:R?.id??null);o("value-selected",{name:n.name,value:q,option:R})},ie=R=>{l.value?(S(R.id)||(E.value=[...E.value,R.id],s.value=[...E.value],o("change",s.value),ae(R)),w.value="",e.nextTick(()=>{_.value?.focus(),f.value=Math.min(f.value,L.value.length-1)}),re(null)):(g.value=R,s.value=R.id,o("change",s.value),ae(R),w.value="",Re(),re(R))},Ce=R=>{if(S(R.id)){l.value||Re();return}ie(R)},_e=(R,Y)=>{if(!R||!Y)return;const q=R.offsetTop,se=q+R.offsetHeight,xe=Y.scrollTop,be=xe+Y.clientHeight;let ve=Y.scrollTop;q<xe?ve=q-80:se>be&&(ve=se-Y.clientHeight+4);const Ne=Y;Ne.scrollTop=ve},z=R=>{let Y=R.parentElement;for(;Y;){if(Y.classList.contains("ui-dialog__content"))return Y;const q=window.getComputedStyle(Y),se=q.overflow+q.overflowY+q.overflowX;if(se.includes("auto")||se.includes("scroll")||Y===document.body||Y===document.documentElement)return Y;Y=Y.parentElement}return document.body},Q=()=>{if(!i.value)return;const R=i.value.getBoundingClientRect(),Y=window.innerHeight||document.documentElement.clientHeight,q=window.innerWidth||document.documentElement.clientWidth,se=8,xe=8,be=n.maxHeight||300,ve=Y-R.bottom-xe-se,Ne=R.top-xe-se,Ee=ve>=Ne,ze=Math.max(q-se*2,0);let{width:je}=R;ze>0&&je>ze&&(je=ze);let{left:We}=R;We+je+se>q&&(We=q-je-se),We=Math.max(We,se);const St=Math.min(be,Math.max(Ee?ve:Ne,50));k.value=Ee?"bottom":"top",C.value={position:"fixed",left:`${We}px`,width:`${je}px`,maxHeight:`${St}px`,transform:Ee?"none":"translateY(-100%)",top:Ee?`${R.bottom+xe}px`:`${R.top-xe}px`}},D=async R=>{a.value||!h.value&&(R.key==="ArrowDown"||R.key==="ArrowUp")&&(R.preventDefault(),await it())},K=R=>{if(!h.value)return;const{key:Y}=R;if(Y==="ArrowDown")R.preventDefault(),f.value+1<L.value.length&&(f.value+=1,_e(b.value[f.value],d.value));else if(Y==="ArrowUp")R.preventDefault(),f.value>0&&(f.value-=1,_e(b.value[f.value],d.value));else if(Y==="Enter"){R.preventDefault();const q=L.value[f.value];q&&ie(q),_.value?.blur()}else Y==="Escape"?(R.preventDefault(),Re()):Y==="Backspace"?l.value&&w.value===""&&E.value.length&&(E.value=E.value.slice(0,-1),s.value=[...E.value],o("change",s.value)):Y==="Home"?(f.value=0,_e(b.value[0],d.value)):Y==="End"?(f.value=L.value.length-1,_e(b.value[f.value],d.value)):Y==="Tab"&&Re()},ke=()=>{a.value||(x.value=!0)},Ze=()=>{x.value=!1,w.value=""},Oe=R=>{R.key==="Escape"&&h.value&&Re()},Ve=R=>{const Y=R.target;c.value?.contains(Y)||u.value?.contains(Y)||Re()},nt=R=>{h.value&&d.value&&!d.value.contains(R.target)&&Q()},rt=()=>{h.value&&Q()},Je=()=>{h.value&&Q()};e.watch(()=>n.options,R=>{R?.length&&(m.value=[...R],Te())},{immediate:!0});async function Te(){if(l.value)Array.isArray(s.value)?E.value=[...s.value]:(E.value=s.value==null?[]:[s.value],s.value=[...E.value]),n.data&&E.value.length&&(await $e(E.value),await e.nextTick());else{if(Array.isArray(s.value)){const R=s.value[0]??null;s.value=R??null}s.value!=null&&(g.value=await Le(s.value)),re(g.value??null)}}e.watch(s,()=>{Te()}),e.onMounted(async()=>{addEventListener("keydown",Oe),addEventListener("scroll",nt,!0),addEventListener("resize",rt),document.addEventListener("click",Ve,!0),i.value&&z(i.value).addEventListener("scroll",Je,!0),n.options?.length&&!n.data?m.value=[...n.options]:n.data&&(m.value=await ce("")),await Te(),bn.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",Oe),removeEventListener("scroll",nt,!0),removeEventListener("resize",rt),document.removeEventListener("click",Ve,!0),i.value&&z(i.value).removeEventListener("scroll",Je,!0)});const kt=e.ref(!1),jt=e.ref({}),Ut=e.ref([]),gn=e.ref(null);async function Jn(){if(!(!n.add?.token||gn?.value.validate()))try{const Y=n.add.api??`/api/table/${n.add.token}`,q=await fetch(Y,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(jt.value)}),se=await q.json().catch(()=>({})),xe=se?.error||se?.message,be=Number(se?.code)>=400;if(!q.ok||be){ue.notify({title:"Помилка",type:"error",message:xe||`Код помилки: ${se?.code||q.status}`});return}const ve=se?.id;if(!ve){ue.notify({title:"Помилка",type:"error",message:"Обʼєкт створено, але в відповіді відсутній ID."});return}if(!n.options?.length&&n.data){const Ne=await fetch(`${n.api??`/api/suggest/${n.data}`}?val=${ve}`).then(Ee=>Ee.json());g.value=Ne[0],m.value.push(Ne[0]),s.value=ve}kt.value=!1,ue.notify({title:"Успіх",message:"Обʼєкт успішно створено."})}catch(Y){ue.notify({title:"Помилка",type:"error",message:Y?.message||"Не вдалося створити обʼєкт."})}}async function xt(){if(!n.add)return null;const R=await fetch(`/api/template/form/${n.add.form}`).then(Y=>Y.json());return Ut.value=R.schema,kt.value=!0,null}function Qn(R,Y=200){let q;return(...se)=>{q&&clearTimeout(q),q=window.setTimeout(()=>R(...se),Y)}}const yn=Qn(async R=>{m.value=await ce(R)},200);e.watch(w,R=>{n.data&&yn(R.trim())}),e.watch(()=>n.options,R=>{!n.data&&R?.length&&(m.value=[...R],Te())},{immediate:!0}),e.watch(()=>n.parent??n.parentValue,()=>{n.data&&ye()});const bn=e.ref(!0);return e.watch(de,async()=>{if(n.data&&(bn.value||(l.value?(E.value=[],s.value=[],o("change",[])):(g.value=null,s.value=null,o("change",null))),await ye(),n.auto===1&&de.value&&m.value.length>0)){const R=m.value[0];R&&ie(R)}}),(R,Y)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(ue.VsModal),{visible:kt.value,"onUpdate:visible":Y[1]||(Y[1]=q=>kt.value=q),class:"z-[1000]",title:"Додати",buttonText:"Додати",onDone:Jn,teleport:R.teleport},{default:e.withCtx(()=>[e.createVNode(Qe,{schema:Ut.value,modelValue:jt.value,"onUpdate:modelValue":Y[0]||(Y[0]=q=>jt.value=q),ref_key:"addForm",ref:gn},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:c,onClick:Y[5]||(Y[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass])},[Y[6]||(Y[6]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),Y[7]||(Y[7]=e.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["vs-input-select__control flex min-h-[38px] items-center justify-between rounded transition-colors bg-white",a.value?"bg-gray-100 text-gray-400 cursor-not-allowed":""]),role:"combobox","aria-expanded":h.value,"aria-haspopup":"listbox",onKeydown:D,onClick:U,"data-focus":h.value||x.value?"true":"false",ref_key:"triggerRef",ref:i},[e.createElementVNode("div",ns,[l.value?(e.openBlock(),e.createElementBlock("div",rs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(I.value,q=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[rgb(230,230,230)] rounded-[2px] m-[2px] box-border max-w-full",key:q.id},[e.createElementVNode("div",os,[ne(q)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:e.normalizeStyle({backgroundColor:q?.color})},null,4)):e.createCommentVNode("",!0),!T.value&&ge(q)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(An),style:e.normalizeStyle(we(q)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(X(q)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"truncate text-[#172b4d] overflow-hidden max-w-[200px] px-0.5 pl-1.5",title:W(q)},[T.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:G(q)},null,8,as)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(q.text),1)],64))],8,ls)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border text-[#172b4d] hover:bg-[rgb(255,189,173)] hover:text-[rgb(222,53,11)] flex-shrink-0",onClick:e.withModifiers(se=>ee(q.id),["stop"])},[e.createVNode(e.unref(j.X),{"aria-hidden":"true",focusable:"false",class:"inline-block h-4 w-4"})],8,ss)]))),128)),e.createElementVNode("div",is,[!a.value&&R.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:_,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900 hover:cursor-pointer",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:E.value.length?" ":A.value,"onUpdate:modelValue":Y[2]||(Y[2]=q=>w.value=q),onFocus:ke,onBlur:Ze,onKeydown:K},null,40,cs)),[[e.vModelText,w.value]]):e.createCommentVNode("",!0)])])):!l.value&&B.value&&w.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900 absolute inset-x-0 pl-2 flex items-center gap-1 min-w-0"]),title:B.value},[ne(g.value)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block flex-shrink-0",style:e.normalizeStyle({backgroundColor:g.value?.color})},null,4)):e.createCommentVNode("",!0),!T.value&&ge(g.value)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(An),style:e.normalizeStyle(we(g.value)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(X(g.value)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),T.value?(e.openBlock(),e.createElementBlock("span",{key:2,class:"truncate flex-1 min-w-0",innerHTML:G(g.value)},null,8,us)):(e.openBlock(),e.createElementBlock("span",ps,e.toDisplayString(g.value?.text),1))],8,ds)):e.createCommentVNode("",!0),l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",fs,[!a.value&&R.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:_,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900 hover:cursor-pointer",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:B.value?" ":A.value,"onUpdate:modelValue":Y[3]||(Y[3]=q=>w.value=q),onFocus:ke,onBlur:Ze,onKeydown:K},null,40,ms)),[[e.vModelText,w.value]]):e.createCommentVNode("",!0)]))]),e.createElementVNode("div",hs,[$.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:a.value,onClick:e.withModifiers(Z,["stop"])},[e.createVNode(e.unref(j.X),{class:"h-4 w-4"})],8,gs)):e.createCommentVNode("",!0),$.value?(e.openBlock(),e.createElementBlock("div",ys)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:a.value,onClick:Y[4]||(Y[4]=e.withModifiers(q=>Be(),["stop"])),title:h.value?"Закрити список":"Відкрити список"},[e.createVNode(e.unref(j.ChevronDown),{class:"h-4 w-4"})],8,bs)])],42,ts),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[h.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:e.normalizeClass(["fixed z-[3000] rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]"]),style:e.normalizeStyle(C.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:C.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[L.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(L.value,(q,se)=>(e.openBlock(),e.createElementBlock("div",{key:q.id,ref_for:!0,ref:xe=>b.value[se]=xe,class:e.normalizeClass(["flex px-3 py-2 gap-2 cursor-pointer select-none text-gray-900",S(q.id)?"bg-[#2684ff] text-white":"bg-white hover:bg-[#deebff] hover:text-[#172b4d]",f.value===se&&!S(q.id)?"bg-[#deebff] text-[#172b4d]":""]),"aria-disabled":S(q.id)?"true":"false",role:"option",tabindex:"-1",onClick:xe=>Ce(q)},[ne(q)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block flex-shrink-0",style:e.normalizeStyle({backgroundColor:q?.color})},null,4)):e.createCommentVNode("",!0),!T.value&&ge(q)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(An),style:e.normalizeStyle(we(q)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(X(q)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",f.value===q.id?"text-white":"",(f.value===se,"")])},[T.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:G(q)},null,8,xs)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(q.text),1)],64))],2)],10,ks))),128)):(e.openBlock(),e.createElementBlock("div",ws," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),n.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:xt,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:a.value,type:"button"},[e.createVNode(e.unref(j.Plus),{class:"h-4 w-4"}),Y[8]||(Y[8]=e.createElementVNode("span",null,"Додати",-1))],8,_s)):e.createCommentVNode("",!0)],512)],64))}}),[["__scopeId","data-v-4f31eacf"]]),vs=["placeholder","disabled"],fr=e.defineComponent({__name:"vs-input-textarea",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Ie(t.style),o=e.useModel(r,"modelValue"),l=e.computed(()=>!!t.disabled),a=e.computed(()=>t.placeholder??"");function s(){typeof o.value=="string"&&(o.value=o.value.trim())}return(c,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":i[0]||(i[0]=d=>o.value=d),placeholder:a.value,disabled:l.value,row:"2",onBlur:s,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,42,vs)),[[e.vModelText,o.value]])}}),mr=e.defineComponent({__name:"vs-input-richtext",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},format:{default:"html"},richtextProps:{default:()=>({})}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=e.defineAsyncComponent(()=>Promise.resolve().then(()=>rg)),n=r,{inputClass:o}=Ie(n.style),l=e.useModel(r,"modelValue"),a=e.computed(()=>!!n.disabled),s=e.computed(()=>n.placeholder??""),c=e.computed(()=>({height:"300px",format:n.format,...n.richtextProps}));return(i,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["!h-full",[i.customClass,e.unref(o)]]),style:e.normalizeStyle(a.value?{pointerEvents:"none",opacity:.6}:{})},[e.createVNode(e.unref(t),e.mergeProps({modelValue:l.value,"onUpdate:modelValue":d[0]||(d[0]=u=>l.value=u),placeholder:s.value},c.value),null,16,["modelValue","placeholder"])],6))}}),Cs={},Es={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Bs(r,t){return e.openBlock(),e.createElementBlock("svg",Es,t[0]||(t[0]=[e.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)]))}const Vs=me(Cs,[["render",Bs]]),Ss={class:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden flex flex-col"},$s={key:0,class:"flex flex-col gap-2 !p-4 border-b border-gray-200 sm:flex-row sm:items-center sm:justify-between bg-gray-50"},Ns={key:0,class:"relative w-full"},As={class:"flex flex-nowrap items-center justify-end gap-2 w-full overflow-x-auto"},Fs={class:"w-full overflow-x-auto"},Ms={class:"w-full min-w-[640px] table-auto divide-y divide-gray-200"},Ds={class:"bg-gray-50"},Ls={class:"border-b border-gray-200"},Ts={class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 w-12 text-center"},Is=["onClick"],Rs={key:0,class:"text-gray-400"},Os={key:0,colspan:"100%",class:"text-center"},zs={class:"w-full"},Ps={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},js=["onDragstart","onDragover","onDrop"],Us={class:"px-4 py-3 text-center align-middle"},Hs={class:"flex items-center justify-center"},qs=["innerHTML"],Gs={key:0,class:"flex items-center gap-3 text-sm text-gray-700"},Ks={key:0},Ws=["src"],Ys={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},Xs={key:1,class:"flex items-center justify-center"},Zs={key:2,class:"text-sm font-medium text-gray-900"},Js={class:"px-4 py-3 text-right whitespace-nowrap"},Qs={class:"flex items-center justify-end gap-2"},ei=["onClick"],ti=["onClick"],ni={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},hr=e.defineComponent({__name:"vs-input-datatable",props:e.mergeModels({actions:{},colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useSlots(),o=U=>t.actions===void 0?!0:t.actions.includes(U),l=["search","import","export","add"],a=e.computed(()=>l.some(U=>o(U))),s=e.useModel(r,"modelValue"),c=e.ref({}),i=e.ref(""),d=e.ref(null),u=e.ref("asc"),h=e.computed(()=>{const U=s.value??[],Z=i.value?U.filter(ie=>x.value?.some(Ce=>{const _e=Ce.key||Ce.name;if(!_e)return!1;const z=ie[_e];return z?Array.isArray(z)?z.join(", ").toLowerCase().includes(i.value.toLowerCase()):String(z).toLowerCase().includes(i.value.toLowerCase()):!1})):U;if(!d.value)return Z;const ee=d.value,ae=[...Z].sort((ie,Ce)=>{const _e=re(ie?.[ee]),z=re(Ce?.[ee]);return typeof _e=="number"&&typeof z=="number"?_e-z:String(_e).localeCompare(String(z))});return u.value==="asc"?ae:ae.reverse()}),x=e.computed(()=>(t.colModel??[]).filter(U=>!U.tableHidden)),g=e.ref(null),m=e.ref(null),f=e.ref(null),b=U=>{g.value=U},w=U=>{m.value=U},_=U=>{if(g.value===null||g.value===U){g.value=null,m.value=null;return}const Z=[...s.value],[ee]=Z.splice(g.value,1);Z.splice(U,0,ee),s.value=Z,g.value=null,m.value=null},k=()=>{f.value&&f.value.click()},C=U=>{const Z=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],ee=U.toLowerCase();return Z.some(ae=>ee.endsWith(ae))},E=U=>{const ee=U.target.files?.[0];if(!ee)return;const ae=new FileReader;ae.onload=ie=>{try{const Ce=ie.target?.result;if(typeof Ce=="string"){const _e=JSON.parse(Ce);Array.isArray(_e)&&s.value.push(..._e)}}catch(Ce){console.error("Error parsing file:",Ce)}},ae.readAsText(ee)},I=()=>{const U=JSON.stringify(s.value,null,2),Z=new Blob([U],{type:"application/json"}),ee=URL.createObjectURL(Z),ae=document.createElement("a");ae.href=ee,ae.download="data.json",ae.click(),URL.revokeObjectURL(ee)},A=new Set(["autocomplete","select","radio","checkbox","combobox"]),B=new Map,$=(U,Z)=>{const ee=`/api/suggest/${U}`,ae=ee.includes("?")?"&":"?",ie=Z?`&val=${Z}`:"";return`${ee}${ae}json=1${ie}`},S=U=>U==null||U===""?null:typeof U=="object"?U?.id!==void 0&&U.id!==null&&U.id!==""?U.id:null:U,L=U=>{const Z=new Set;return Array.isArray(s.value)&&s.value.forEach(ee=>{const ae=ee?.[U];if(ae==null||ae==="")return;if(Array.isArray(ae)){ae.forEach(Ce=>{const _e=S(Ce);_e!==null&&Z.add(_e)});return}const ie=S(ae);ie!==null&&Z.add(ie)}),Z},F=async()=>{if(!t.colModel?.length)return;const U=t.colModel.filter(Z=>Z.data&&A.has(Z.type?.toLowerCase()||""));U.length&&await Promise.all(U.map(async Z=>{const ee=Z.key||Z.name;if(!ee)return;const ae=L(ee),ie=Array.from(ae).map(z=>String(z)).sort(),Ce=ie.join(",");if(!ie.length||B.get(ee)===Ce)return;B.set(ee,Ce);const _e=ie.map(encodeURIComponent).join(",");try{const Q=await(await fetch($(Z.data,_e))).json();c.value[ee]=Q?.data??Q}catch(z){console.error("Failed to fetch column values",z)}}))};e.watch([()=>t.colModel,()=>s.value],()=>{F()},{immediate:!0,deep:!0});const P=e.ref(""),M=e.ref(!1);let O="edit",T=0;const G=U=>(U?.format||U?.type||"").toString().toLowerCase(),W=e.computed(()=>t.colModel?.filter(U=>G(U)!=="slot").map(U=>{const{slot:Z,...ee}=U;return ee})??[]),X=e.ref({}),ne=e.ref({}),we=U=>typeof U!="string"?!1:!!n[U],ge=(U,Z)=>Z?Z.split(".").reduce((ee,ae)=>ee==null?ee:ee[ae.trim()],U):U,J=(U,Z)=>typeof U!="string"?"":U.replace(/{{\s*([^}]+)\s*}}/g,(ee,ae)=>{const ie=ge(Z,ae.trim());return ie??""}),re=U=>{if(U==null||U==="")return"";if(typeof U=="number")return U;if(typeof U=="boolean")return U?1:0;if(typeof U=="string")return U.toLowerCase();if(Array.isArray(U))return U.map(Z=>re(Z)).join(", ");if(typeof U=="object"){if(U.text!==void 0)return String(U.text).toLowerCase();if(U.label!==void 0)return String(U.label).toLowerCase();if(U.id!==void 0)return String(U.id).toLowerCase()}return String(U).toLowerCase()},de=U=>{const Z=U.key||U.name;if(Z){if(d.value===Z){u.value=u.value==="asc"?"desc":"asc";return}d.value=Z,u.value="asc"}};async function ce(){P.value="Додати",M.value=!0,O="add",X.value={}}function ye(U,Z){if(!U?.length)return null;const ee=typeof Z=="object"?Z?.id:Z;return ee==null||ee===""?null:U.find(ae=>ae?.id?.toString()===ee.toString())?.text??null}function Le(U){return U==null||U===""?"-":Array.isArray(U)?U.map(Z=>typeof Z=="object"?Z?.text??Z?.id??"-":Z).join(", "):typeof U=="object"?U?.text??U?.id??"-":U}function $e(U,Z){const ee=Z.key||Z.name,ae=U?.[ee],ie=c.value[ee];if(!ae)return"-";if(Array.isArray(ae)){const _e=ae.map(z=>ye(ie,z)).filter(Boolean);return _e.length?_e.join(", "):Le(ae)}const Ce=ye(ie,ae);return Ce||Le(ae)}async function tt(U,Z){P.value="Редагувати",M.value=!0,O="edit",T=Z,X.value={...U}}function it(){const U=ne.value.validate();if(U){ue.notify({type:"warning",title:"Помилка валідації",message:Object.entries(U).map(([Z,ee])=>`${Z}: ${ee}`).join(`
|
|
2
|
-
`)});return}O==="add"?Array.isArray(s.value)?s.value=[...s.value,X.value]:s.value=[X.value]:s.value=s.value.map((Z,ee)=>ee===T?X.value:Z),M.value=!1}function Re(U){s.value=s.value.filter((Z,ee)=>ee!==U)}function Be(){M.value=!1}return(U,Z)=>(e.openBlock(),e.createElementBlock("div",Ss,[a.value?(e.openBlock(),e.createElementBlock("div",$s,[o("search")?(e.openBlock(),e.createElementBlock("div",Ns,[e.createVNode(e.unref(j.Search),{class:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":Z[0]||(Z[0]=ee=>i.value=ee),placeholder:"Пошук",class:"w-full rounded-md border border-gray-200 bg-white pl-10 pr-3 py-2 text-sm text-gray-900 placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100"},null,512),[[e.vModelText,i.value]])])):e.createCommentVNode("",!0),e.createElementVNode("div",As,[o("import")?(e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"fileInput",ref:f,onChange:E,class:"hidden",accept:".json",type:"file"},null,544)):e.createCommentVNode("",!0),o("import")?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",onClick:k,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[e.createVNode(e.unref(j.Upload),{class:"h-4 w-4 text-gray-700"}),Z[4]||(Z[4]=e.createTextVNode(" Імпорт ",-1))])):e.createCommentVNode("",!0),o("export")?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:I,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[e.createVNode(e.unref(j.Download),{class:"h-4 w-4 text-gray-700"}),Z[5]||(Z[5]=e.createTextVNode(" Експорт ",-1))])):e.createCommentVNode("",!0),o("add")?(e.openBlock(),e.createElementBlock("button",{key:3,onClick:ce,type:"button",class:"inline-flex items-center gap-2 rounded-md bg-blue-500 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-600 transition-colors"},[e.createVNode(e.unref(j.Plus),{class:"h-4 w-4 text-white"}),Z[6]||(Z[6]=e.createTextVNode(" Додати ",-1))])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),e.createElementVNode("div",Fs,[e.createElementVNode("table",Ms,[e.createElementVNode("thead",Ds,[e.createElementVNode("tr",Ls,[e.createElementVNode("th",Ts,[e.createVNode(e.unref(j.GripVertical),{class:"mx-auto h-4 w-4 text-gray-400"})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,ee=>(e.openBlock(),e.createElementBlock("th",{key:ee.key,class:"px-4 py-3 text-left text-xs font-semibold text-gray-900"},[e.createElementVNode("button",{type:"button",onClick:ae=>de(ee),class:"flex items-center gap-1 text-xs font-semibold text-gray-700 hover:text-gray-900 transition-colors"},[e.createElementVNode("span",null,e.toDisplayString(ee.ua||ee.label),1),d.value===(ee.key||ee.name)?(e.openBlock(),e.createElementBlock("span",Rs,e.toDisplayString(u.value==="asc"?"▲":"▼"),1)):e.createCommentVNode("",!0)],8,Is)]))),128)),Z[7]||(Z[7]=e.createElementVNode("th",{class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 text-center w-[1%] whitespace-nowrap"}," Дії ",-1))])]),e.createElementVNode("tbody",{class:e.normalizeClass(["divide-y divide-gray-200",{"[&_tr:last-child]:border-0":!m.value}])},[h.value.length===0?(e.openBlock(),e.createElementBlock("td",Os,[e.createElementVNode("div",zs,[e.createElementVNode("div",Ps,[e.createVNode(Vs,{class:"w-48 mx-auto"}),Z[8]||(Z[8]=e.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[e.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),e.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(ee,ae)=>(e.openBlock(),e.createElementBlock("tr",{key:ee.id,class:e.normalizeClass(["border-b transition-colors hover:bg-gray-50 cursor-move text-sm text-gray-700",{"opacity-50":g.value===ae,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":m.value===ae}]),draggable:"true",onDragstart:ie=>b(ae),onDragover:e.withModifiers(ie=>w(ae),["prevent"]),onDrop:ie=>_(ae)},[e.createElementVNode("td",Us,[e.createElementVNode("div",Hs,[e.createVNode(e.unref(j.GripVertical),{class:"mx-auto h-4 w-4 text-slate-400 dark:text-slate-500"})])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,ie=>(e.openBlock(),e.createElementBlock("td",{key:ie.key,class:"px-4 py-3 align-middle"},[G(ie)==="slot"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[we(ie.slot)?e.renderSlot(U.$slots,ie.slot,{key:0,row:ee,value:ee[ie.key],column:ie}):(e.openBlock(),e.createElementBlock("div",{key:1,class:"text-sm text-gray-900",innerHTML:J(ie.slot,ee)},null,8,qs))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[G(ie)==="file"?(e.openBlock(),e.createElementBlock("div",Gs,[C($e(ee,ie))?(e.openBlock(),e.createElementBlock("div",Ks,[e.createElementVNode("img",{src:$e(ee,ie),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,Ws)])):(e.openBlock(),e.createElementBlock("div",Ys,[e.createVNode(e.unref(j.FileText),{class:"h-4 w-4 min-w-4"})]))])):G(ie)==="color"?(e.openBlock(),e.createElementBlock("div",Xs,[e.createElementVNode("span",{class:"inline-flex h-6 w-6 rounded border border-gray-200",style:e.normalizeStyle({backgroundColor:$e(ee,ie)||"#ffffff"})},null,4)])):(e.openBlock(),e.createElementBlock("div",Zs,e.toDisplayString($e(ee,ie)),1))],64))]))),128)),e.createElementVNode("td",Js,[e.createElementVNode("div",Qs,[e.createElementVNode("button",{onClick:ie=>tt(ee,ae),class:"p-1.5 text-gray-600 hover:text-blue-600 hover:bg-blue-50 rounded transition-colors"},[e.createVNode(e.unref(j.Pencil),{class:"h-4 w-4"})],8,ei),e.createElementVNode("button",{onClick:ie=>Re(ae),class:"p-1.5 text-gray-600 hover:text-red-600 hover:bg-red-50 rounded transition-colors"},[e.createVNode(e.unref(j.Trash2),{class:"h-4 w-4"})],8,ti)])])],42,js))),128))],2)])]),e.createVNode(e.unref(ue.VsModal),{visible:M.value,title:P.value,size:"lg",onClose:Be,teleport:"#modal"},{default:e.withCtx(()=>[e.createVNode(Qe,{schema:W.value,values:X.value,"onUpdate:values":Z[1]||(Z[1]=ee=>X.value=ee),form:ne.value,"onUpdate:form":Z[2]||(Z[2]=ee=>ne.value=ee)},null,8,["schema","values","form"]),e.createElementVNode("div",ni,[e.createElementVNode("button",{type:"button",onClick:Z[3]||(Z[3]=ee=>M.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:it,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"])]))}}),ri={},oi={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 li(r,t){return e.openBlock(),e.createElementBlock("svg",oi,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const ai=me(ri,[["render",li]]),si={},ii={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function ci(r,t){return e.openBlock(),e.createElementBlock("svg",ii,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M6.5 9.5l3.5 -3"></path><path d="M14 5.5l3 1.5"></path><path d="M18.5 10l-2.5 7"></path><path d="M13.5 17.5l-7 -5"></path>',9)]))}const di=me(si,[["render",ci]]),ui={},pi={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function fi(r,t){return e.openBlock(),e.createElementBlock("svg",pi,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M8 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M6 8v8"></path><path d="M18 16v-8"></path><path d="M8 6h8"></path><path d="M16 18h-8"></path>',9)]))}const mi=me(ui,[["render",fi]]),hi={class:"bg-white/30 p-1 rounded-md shadow w-fit"},gi={class:"flex gap-2"},yi=["onClick","title"],bi=["src"],ki=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(r,{emit:t}){const n=r,o=e.ref(Object.keys(n.basemaps)[0]),l=t;function a(i){l("onLayerChange",i),o.value=i}const s={z:13,x:4790,y:2762};function c(i){if(i?.preview)return i.preview;if(!i?.url)return;const d={"{z}":s.z,"{x}":s.x,"{y}":s.y};let u=i.url;return Object.entries(d).forEach(([h,x])=>{u=u.replace(new RegExp(h,"gi"),String(x))}),u}return(i,d)=>(e.openBlock(),e.createElementBlock("div",hi,[e.createElementVNode("div",gi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.basemaps,(u,h)=>(e.openBlock(),e.createElementBlock("div",{key:h,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":o.value===h}]),onClick:x=>a(h),title:u.name||h,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:c(u),alt:"",class:"w-10 h-10 object-cover"},null,8,bi)],10,yi))),128))])]))}}),wt=1e-10,Wt=/([+-]?\d{1,3})\s*[°º˚]\s*(\d{1,2})\s*['’′`]\s*(\d{1,2}(?:\.\d+)?)\s*["”″]\s*([NSEW])/gi,xi=/^[+-]?\d+(?:\.\d+)?$/;function wi(r,t,n){const o=r.split(/\r?\n/).map(d=>d.trim()).filter(Boolean);if(o.length<3)return{ok:!1,errors:[{line:0,message:"Має бути щонайменше 3 рядки координат."}]};if(o.length>100)return{ok:!1,errors:[{line:0,message:"Допускається не більше 100 рядків координат."}]};const l=[],a=[];if(o.forEach((d,u)=>{const h=u+1,x=t==="decimal"?_i(d,h,n):yr(d,h,n);if(!x.ok){l.push(...x.errors);return}const g=a[a.length-1];if(g&&kr(g,x.point)){l.push({line:h,message:"Послідовні точки не повинні дублюватися."});return}a.push(x.point)}),l.length)return{ok:!1,errors:l};if(new Set(a.map(Ci)).size<3)return{ok:!1,errors:[{line:0,message:"Полігон повинен містити мінімум 3 унікальні точки."}]};const c=[...a];let i=!1;return kr(c[0],c[c.length-1])||(c.push(c[0]),i=!0),Ei(c)?{ok:!1,errors:[{line:0,message:"Полігон має самоперетин."}]}:{ok:!0,ring:c,wasClosedAutomatically:i}}function _i(r,t,n){return gr(r,"decimal",n,t)}function gr(r,t,n,o=1){return t==="decimal"?vi(r,o,n):yr(r,o,n)}function vi(r,t,n){const o=[];if(/[A-Za-zА-Яа-яІіЇїЄєҐґ]/.test(r))return{ok:!1,errors:[{line:t,message:"У десятковому форматі не допускаються літери."}]};const l=r.split(/[\s,;]+/).filter(Boolean);if(l.length<2)return{ok:!1,errors:[{line:t,message:"Кожен рядок має містити дві координати."}]};if(l.length>2)return{ok:!1,errors:[{line:t,message:"У рядку дозволено лише одну пару координат."}]};if(!l.every(d=>xi.test(d)))return{ok:!1,errors:[{line:t,message:"Не вдалося розпізнати десяткові координати."}]};const a=Number(l[0]),s=Number(l[1]);if(!Number.isFinite(a)||!Number.isFinite(s))return{ok:!1,errors:[{line:t,message:"Не вдалося розпізнати десяткові координати."}]};const c=n==="lat-lon"?a:s,i=n==="lat-lon"?s:a;return(c<-90||c>90)&&o.push({line:t,message:"Широта поза діапазоном (-90..90)."}),(i<-180||i>180)&&o.push({line:t,message:"Довгота поза діапазоном (-180..180)."}),o.length?{ok:!1,errors:o}:{ok:!0,point:[i,c]}}function yr(r,t,n){Wt.lastIndex=0;const o=[...r.matchAll(Wt)];if(o.length<2)return{ok:!1,errors:[{line:t,message:"Не вдалося розпізнати DMS-координати."}]};if(o.length>2)return{ok:!1,errors:[{line:t,message:"У рядку дозволено лише одну пару координат."}]};if(Wt.lastIndex=0,r.replace(Wt," ").replace(/[\s,;]+/g,"").trim().length)return{ok:!1,errors:[{line:t,message:"У рядку виявлено зайві символи або значення."}]};const a=br(o[0],t,n==="lat-lon"?"lat":"lon"),s=br(o[1],t,n==="lat-lon"?"lon":"lat"),c=[];if(a.ok||c.push(a.error),s.ok||c.push(s.error),c.length)return{ok:!1,errors:c};const i=n==="lat-lon"?a.value:s.value;return{ok:!0,point:[n==="lat-lon"?s.value:a.value,i]}}function br(r,t,n){const o=Number(r[1]),l=Number(r[2]),a=Number(r[3]),s=String(r[4]).toUpperCase();if(!Number.isFinite(o)||!Number.isFinite(l)||!Number.isFinite(a))return{ok:!1,error:{line:t,message:"Невірні значення DMS-координат."}};if(n==="lat"&&!(s==="N"||s==="S")||n==="lon"&&!(s==="E"||s==="W"))return{ok:!1,error:{line:t,message:n==="lat"?"Для широти напрям повинен бути N або S.":"Для довготи напрям повинен бути E або W."}};if(l<0||l>59)return{ok:!1,error:{line:t,message:"Хвилини повинні бути в діапазоні 0..59."}};if(a<0||a>59)return{ok:!1,error:{line:t,message:"Секунди повинні бути в діапазоні 0..59."}};const d=Math.abs(o),u=n==="lat"?90:180;if(d>u)return{ok:!1,error:{line:t,message:n==="lat"?"Градуси широти повинні бути в діапазоні 0..90.":"Градуси довготи повинні бути в діапазоні 0..180."}};if(d===u&&(l!==0||a!==0))return{ok:!1,error:{line:t,message:n==="lat"?"Для 90° широти хвилини й секунди мають бути 0.":"Для 180° довготи хвилини й секунди мають бути 0."}};const h=d+l/60+a/3600;return{ok:!0,value:s==="S"||s==="W"?-h:h}}function Ci(r){return`${r[0].toFixed(12)}:${r[1].toFixed(12)}`}function kr(r,t){return Math.abs(r[0]-t[0])<wt&&Math.abs(r[1]-t[1])<wt}function Ei(r){if(r.length<4)return!1;for(let t=0;t<r.length-1;t+=1){const n=r[t],o=r[t+1];for(let l=t+1;l<r.length-1;l+=1){if(Math.abs(t-l)<=1||t===0&&l===r.length-2)continue;const a=r[l],s=r[l+1];if(Bi(n,o,a,s))return!0}}return!1}function Bi(r,t,n,o){const l=Yt(r,t,n),a=Yt(r,t,o),s=Yt(n,o,r),c=Yt(n,o,t);return!!(l!==a&&s!==c||l===0&&Xt(r,n,t)||a===0&&Xt(r,o,t)||s===0&&Xt(n,r,o)||c===0&&Xt(n,t,o))}function Yt(r,t,n){const o=(t[1]-r[1])*(n[0]-t[0])-(t[0]-r[0])*(n[1]-t[1]);return Math.abs(o)<wt?0:o>0?1:2}function Xt(r,t,n){return t[0]<=Math.max(r[0],n[0])+wt&&t[0]+wt>=Math.min(r[0],n[0])&&t[1]<=Math.max(r[1],n[1])+wt&&t[1]+wt>=Math.min(r[1],n[1])}const Vi={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},Si={key:0,class:"vs-select__options absolute z-50 mt-1 w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm"},$i=["onClick"],Ni={class:"relative flex-1 min-w-[140px]"},Ai=["placeholder"],Fi={type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},Mi="https://data.softpro.ua/api-user/gis-url-proxy",Di="https://geo.rv.ua/api-user/dzk.api",Li=me(e.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(r,{emit:t}){const n=r,o=t,l=["here","xy","parcel"],a=e.computed(()=>{const E=n.config?.tools?.filter(I=>l.includes(I));return E&&E.length?E:l}),s={here:"Пошук…",xy:`50.4501 30.5234 або 50°27'00"N 30°31'24"E`,parcel:"Пошук…"},c=e.computed(()=>{const E=n.config?.placeholder?.trim();return E||s[i.value]||"Пошук…"}),i=e.ref(a.value[0]??l[0]);e.watch(a,E=>{E.includes(i.value)||(i.value=E[0])});const d=e.ref(""),u=e.ref(!1),h=e.ref(null);e.watch(i,()=>{d.value="",u.value=!1});function x(E){i.value=E}function g(E){if(!u.value)return;const I=h.value;I&&!I.contains(E.target)&&(u.value=!1)}e.onMounted(()=>{window.addEventListener("click",g,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",g,!0)});function m(E){return E==="xy"?"Координати":E==="parcel"?"Кадастр":"Адреси"}function f(E){const I=gr(E.trim(),"dms","lat-lon");if(I.ok){const[T,G]=I.point;return{lat:G,lng:T}}const A=E.replace(/[,]+/g," ").trim();if(!A)return null;const B=A.split(/\s+/).filter(Boolean);if(B.length<2)return null;const $=B.slice(0,2).map(Number);if(!$.every(T=>Number.isFinite(T)))return null;const[S,L]=$;let F=S,P=L;const M=T=>Math.abs(T)<=90,O=T=>Math.abs(T)<=180;if(!M(F)||!O(P))if(M(P)&&O(F))F=L,P=S;else return null;return{lat:F,lng:P}}function b(E){return(E?.items||[]).map((A,B)=>({id:String(A?.id??B),title:A?.title||A?.address?.label||"Знайдений обʼєкт",lat:Number(A?.position?.lat),lng:Number(A?.position?.lng)})).filter(A=>Number.isFinite(A.lat)&&Number.isFinite(A.lng))}function w(E){const I=E?.result||E?.data||E;if(!I)return[];const A=I.geom_centroid;if(!A||!Array.isArray(A.coordinates))return[];const[B,$]=A.coordinates;return!Number.isFinite($)||!Number.isFinite(B)?[]:[{id:"parcel",title:I.cadnum||I.cad_num||"Земельна ділянка",lat:$,lng:B}]}function _(E){const A=E.replace(/\s+/g,"").split(":");if(A.length!==4)return!1;const B=[10,2,3,4];return A.every(($,S)=>$.length===B[S]&&/^\d+$/.test($))}function k(E){o("goToCoordinates",[E.lat,E.lng])}async function C(){const E=d.value.trim();if(E){if(i.value==="xy"){const I=f(E);if(!I){ue.notify({type:"warning",title:"Пошук координат",message:"Використайте `lat lon` або DMS у форматі `50°27'00\"N 30°31'24\"E`."});return}k(I),d.value="";return}try{const I=new URL(i.value==="here"?Mi:Di);if(i.value==="here")I.searchParams.set("searchtext",E);else{if(!_(E)){ue.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}I.searchParams.set("cad_num",E)}const A=await fetch(I.toString());if(!A.ok)throw new Error(`HTTP ${A.status}`);const B=await A.json(),$=i.value==="here"?b(B):w(B);if(!$.length)ue.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const S=$[0];k(S),d.value=""}}catch(I){const A=I?.message||"Помилка пошуку";ue.notify({type:"error",title:"Пошук",message:A})}}}return(E,I)=>(e.openBlock(),e.createElementBlock("div",Vi,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(C,["prevent"])},[a.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:h,class:"relative search-type w-[140px]"},[e.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:I[0]||(I[0]=A=>u.value=!u.value)},[e.createElementVNode("span",null,e.toDisplayString(m(i.value)),1),e.createVNode(e.unref(j.ChevronDown),{class:e.normalizeClass(["h-4 w-4 text-gray-500 transition-transform",{"rotate-180":u.value}])},null,8,["class"])]),u.value?(e.openBlock(),e.createElementBlock("div",Si,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,A=>(e.openBlock(),e.createElementBlock("li",{key:A,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:B=>x(A)},e.toDisplayString(m(A)),9,$i))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",Ni,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":I[1]||(I[1]=A=>d.value=A),placeholder:c.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,Ai),[[e.vModelText,d.value,void 0,{trim:!0}]]),e.createElementVNode("button",Fi,[e.createVNode(e.unref(j.Search),{class:"h-4 w-4"})])])],32)]))}}),[["__scopeId","data-v-8da4c870"]]),Ti={class:"pt-1 border-t border-gray-100"},Ii={class:"space-y-1"},Ri=e.defineComponent({__name:"AddCoordinates",emits:["submit","cancel"],setup(r,{emit:t}){const n=t,o=e.ref(null),l=e.ref(null),a=(i,d,u)=>Math.min(Math.max(i,d),u),s=()=>{if(o.value===null||l.value===null||!Number.isFinite(o.value)||!Number.isFinite(l.value))return;const i=a(o.value,-90,90),d=a(l.value,-180,180);n("submit",{lat:i,lng:d}),o.value=null,l.value=null},c=()=>{o.value=null,l.value=null,n("cancel")};return(i,d)=>(e.openBlock(),e.createElementBlock("div",Ti,[d[2]||(d[2]=e.createElementVNode("p",{class:"text-xs text-gray-600 mb-1"},"Додати точку за координатами:",-1)),e.createElementVNode("div",Ii,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[0]||(d[0]=u=>o.value=u),type:"number",step:"0.0001",class:"w-full px-2 py-1 text-xs border border-gray-300 rounded focus:outline-none focus:border-blue-500",placeholder:"Широта (50.4501)"},null,512),[[e.vModelText,o.value,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[1]||(d[1]=u=>l.value=u),type:"number",step:"0.0001",class:"w-full px-2 py-1 text-xs border border-gray-300 rounded focus:outline-none focus:border-blue-500",placeholder:"Довгота (30.5234)"},null,512),[[e.vModelText,l.value,void 0,{number:!0}]]),e.createElementVNode("div",{class:"flex gap-1.5"},[e.createElementVNode("button",{class:"flex-1 px-2 py-1 bg-blue-500 hover:bg-blue-600 text-white text-xs font-medium rounded transition-colors",type:"button",onClick:s}," Додати "),e.createElementVNode("button",{class:"px-2 py-1 bg-gray-200 hover:bg-gray-300 text-gray-700 text-xs font-medium rounded transition-colors",type:"button",onClick:c}," Скасувати ")])])]))}}),Oi=e.defineComponent({__name:"BtnAdd",emits:["click"],setup(r){return(t,n)=>(e.openBlock(),e.createElementBlock("button",{class:"flex-1 px-2 py-1.5 bg-blue-500 hover:bg-blue-600 text-white text-xs font-medium rounded transition-colors duration-150 flex items-center justify-center gap-1",onClick:n[0]||(n[0]=o=>t.$emit("click"))},[e.createVNode(e.unref(j.Plus),{size:12,"stroke-width":2}),n[1]||(n[1]=e.createTextVNode(" Додати ",-1))]))}}),zi=e.defineComponent({__name:"BtnClear",emits:["click"],setup(r){return(t,n)=>(e.openBlock(),e.createElementBlock("button",{class:"w-full px-2 py-1.5 bg-rose-500 hover:bg-rose-600 text-white text-xs font-medium rounded transition-colors duration-150 flex items-center justify-center gap-1",onClick:n[0]||(n[0]=o=>t.$emit("click"))},[e.createVNode(e.unref(j.Trash2),{size:12,"stroke-width":2}),n[1]||(n[1]=e.createTextVNode(" Очистити ",-1))]))}}),Pi=e.defineComponent({__name:"BtnComplete",emits:["click"],setup(r){return(t,n)=>(e.openBlock(),e.createElementBlock("button",{class:"flex-1 px-2 py-1.5 bg-emerald-500 hover:bg-emerald-600 text-white text-xs font-medium rounded transition-colors duration-150 flex items-center justify-center gap-1",onClick:n[0]||(n[0]=o=>t.$emit("click"))},[e.createVNode(e.unref(j.Circle),{size:12,"stroke-width":2}),n[1]||(n[1]=e.createTextVNode("Замкнути ",-1))]))}}),ji=new Intl.NumberFormat("uk-UA",{minimumFractionDigits:2,maximumFractionDigits:2});function _t(r){return ji.format(r)}function xr(r){return r>=1e3?`${_t(r/1e3)} км`:`${_t(r)} м`}const Ui={class:"flex items-center gap-1.5 text-xs bg-gray-50 rounded p-1.5"},Hi={key:0,class:"flex-1 flex gap-1"},qi={key:1,class:"flex-1 font-mono text-gray-700"},Gi=e.defineComponent({__name:"DotListItem",props:{id:{},index:{},coords:{}},emits:["update","delete"],setup(r,{emit:t}){const n=r,o=t,l=e.computed(()=>`${n.coords.lat.toFixed(4)}°, ${n.coords.lng.toFixed(4)}°`),a=e.ref(!1),s=e.ref(n.coords.lat),c=e.ref(n.coords.lng);e.watch(()=>n.coords,x=>{s.value=x.lat,c.value=x.lng},{deep:!0,immediate:!0});const i=(x,g,m)=>Math.min(Math.max(x,g),m),d=()=>{a.value=!0},u=()=>{if(!Number.isFinite(s.value)||!Number.isFinite(c.value))return;const x=i(s.value,-90,90),g=i(c.value,-180,180);o("update",{id:n.id,coords:{lat:x,lng:g}}),a.value=!1},h=()=>{o("delete",n.id)};return(x,g)=>(e.openBlock(),e.createElementBlock("div",Ui,[e.createVNode(e.unref(j.MapPin),{size:12,"stroke-width":2,class:"text-gray-400 flex-shrink-0"}),a.value?(e.openBlock(),e.createElementBlock("div",Hi,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":g[0]||(g[0]=m=>s.value=m),type:"number",step:"0.0001",min:"-90",max:"90",class:"flex-1 px-1.5 py-0.5 text-xs border border-gray-300 rounded focus:outline-none focus:border-blue-500",placeholder:"Широта"},null,512),[[e.vModelText,s.value,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":g[1]||(g[1]=m=>c.value=m),type:"number",step:"0.0001",min:"-180",max:"180",class:"flex-1 px-1.5 py-0.5 text-xs border border-gray-300 rounded focus:outline-none focus:border-blue-500",placeholder:"Довгота"},null,512),[[e.vModelText,c.value,void 0,{number:!0}]]),e.createElementVNode("button",{class:"px-1.5 py-0.5 bg-emerald-500 text-white rounded hover:bg-emerald-600 text-xs",type:"button",onClick:u}," ✓ ")])):(e.openBlock(),e.createElementBlock("span",qi,e.toDisplayString(l.value),1)),a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:2,class:"text-blue-500 hover:text-blue-600 px-0.5",type:"button",onClick:d}," ✎ ")),e.createElementVNode("button",{class:"text-rose-500 hover:text-rose-600 px-0.5",type:"button",onClick:h}," ✕ ")]))}}),Ki={class:"ruler-control px-3 py-2.5 space-y-2"},Wi={type:"button",class:"ruler-row w-full flex items-center gap-2 cursor-pointer group text-left"},Yi={class:e.normalizeClass(["flex items-center justify-center w-5 h-5 rounded-full shrink-0 transition-colors pointer-events-none"]),title:"Сумарна довжина всіх відрізків","aria-hidden":"true"},Xi={class:"text-sm font-semibold text-slate-700"},Zi={class:"ruler-row"},Ji={type:"button",class:"w-full flex items-center gap-2 cursor-pointer group text-left"},Qi={class:e.normalizeClass(["flex items-center justify-center w-5 h-5 rounded-full shrink-0 transition-colors pointer-events-none"]),title:"Площа замкнутого контуру","aria-hidden":"true"},ec={class:"inline-flex rounded-md overflow-hidden border border-gray-200 bg-gray-100"},tc=["onClick"],nc={class:"flex items-center gap-2 mt-0.5 pl-7"},rc={key:0,class:"text-base font-semibold text-green-600"},oc={key:1,class:"text-xs text-gray-400"},lc={class:"ruler-row flex items-center gap-2 cursor-pointer"},ac={class:e.normalizeClass(["flex items-center justify-center w-5 h-5 rounded-full shrink-0 transition-colors pointer-events-none"]),title:"Список точок","aria-hidden":"true"},sc={class:"text-xs font-medium text-gray-600 flex-1"},ic={key:0,class:"pt-1.5 border-t border-gray-100 max-h-32 overflow-y-auto space-y-1"},cc=e.defineComponent({__name:"ControlPanel",props:{points:{},isShapeClosed:{type:Boolean}},emits:["update-point","delete-point"],setup(r){const t=r,n=e.ref(!1),o=e.ref("km2"),l=[{id:"km2",label:"км²"},{id:"ha",label:"га"},{id:"m2",label:"м²"}],a=()=>{n.value=!n.value},s=(m,f)=>{const b=$=>$*Math.PI/180,w=b(f.lat-m.lat),_=b(f.lng-m.lng),k=b(m.lat),C=b(f.lat),E=Math.sin(w/2),I=Math.sin(_/2);return 6371e3*(2*Math.asin(Math.sqrt(E*E+Math.cos(k)*Math.cos(C)*I*I)))},c=e.computed(()=>{if(t.points.length<2)return 0;let m=0;for(let f=1;f<t.points.length;f+=1)m+=s(t.points[f-1].coords,t.points[f].coords);return t.isShapeClosed&&t.points.length>=2&&(m+=s(t.points[t.points.length-1].coords,t.points[0].coords)),m}),i=e.computed(()=>c.value>=1e3?`${_t(c.value/1e3)} км`:`${_t(c.value)} м`);function d(m){if(m.length<3)return 0;const f=m[0].lat,b=m[0].lng,w=(k,C)=>{const E=(k-f)*110574;return{x:(C-b)*111320*Math.cos(f*Math.PI/180),y:E}};let _=0;for(let k=0;k<m.length;k++){const C=(k+1)%m.length,E=w(m[k].lat,m[k].lng),I=w(m[C].lat,m[C].lng);_+=E.x*I.y-E.y*I.x}return Math.abs(_)*.5}const u=e.computed(()=>{if(!t.isShapeClosed||t.points.length<3)return 0;const m=t.points.map(f=>f.coords);return d(m)}),h=e.computed(()=>u.value>0),x=e.computed(()=>{const m=u.value;if(m===0)return"—";if(o.value==="km2"){const b=m/1e6;return`${_t(b)} км²`}if(o.value==="ha"){const b=m/1e4;return`${_t(b)} га`}const f=m>=1?Math.round(m):m;return`${_t(f)} м²`}),g=e.computed(()=>{const m=t.points.length;return m===1?"1 точка":m>=2&&m<=4?`${m} точки`:`${m} точок`});return e.watch(()=>t.points.length,()=>{t.points.length===0&&(n.value=!1)}),(m,f)=>(e.openBlock(),e.createElementBlock("div",Ki,[e.createElementVNode("button",Wi,[e.createElementVNode("span",Yi,[e.createVNode(e.unref(j.Info),{size:12,"stroke-width":2.5})]),f[1]||(f[1]=e.createElementVNode("span",{class:"text-xs font-medium text-gray-600 flex-1"},"Загальна відстань",-1)),e.createElementVNode("span",Xi,e.toDisplayString(i.value),1)]),e.createElementVNode("div",Zi,[e.createElementVNode("button",Ji,[e.createElementVNode("span",Qi,[e.createVNode(e.unref(j.Info),{size:12,"stroke-width":2.5})]),f[2]||(f[2]=e.createElementVNode("span",{class:"text-xs font-medium text-gray-600 flex-1"},"Площа",-1)),e.createElementVNode("div",ec,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(l,(b,w)=>e.createElementVNode("button",{key:b.id,type:"button",class:e.normalizeClass(["px-2.5 py-1 text-xs font-medium transition-colors border-r border-gray-200 last:border-r-0",w===0&&"rounded-l-md",w===l.length-1&&"rounded-r-md",o.value===b.id?"bg-white text-green-600 font-semibold shadow-sm":"text-gray-600 hover:bg-gray-50"]),onClick:e.withModifiers(_=>o.value=b.id,["stop"])},e.toDisplayString(b.label),11,tc)),64))])]),e.createElementVNode("div",nc,[h.value?(e.openBlock(),e.createElementBlock("span",rc,e.toDisplayString(x.value),1)):(e.openBlock(),e.createElementBlock("span",oc,"—"))])]),e.createElementVNode("div",lc,[e.createElementVNode("span",ac,[e.createVNode(e.unref(j.Info),{size:12,"stroke-width":2.5})]),e.createElementVNode("span",sc,e.toDisplayString(g.value),1),e.createElementVNode("button",{type:"button",class:"text-xs text-blue-500 hover:text-blue-600 font-medium transition-colors",onClick:e.withModifiers(a,["stop"])}," Координати ")]),n.value?(e.openBlock(),e.createElementBlock("div",ic,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.points,(b,w)=>(e.openBlock(),e.createBlock(Gi,{key:b.id,id:b.id,index:w+1,coords:b.coords,onUpdate:f[0]||(f[0]=_=>m.$emit("update-point",_)),onDelete:_=>m.$emit("delete-point",b.id)},null,8,["id","index","coords","onDelete"]))),128))])):e.createCommentVNode("",!0)]))}}),dc={class:"px-3 py-3 bg-blue-50/50 border-b border-blue-100"},uc={class:"flex items-start gap-2"},pc=e.defineComponent({__name:"InfoHint",setup(r){return(t,n)=>(e.openBlock(),e.createElementBlock("div",dc,[e.createElementVNode("div",uc,[e.createVNode(e.unref(j.Info),{size:16,"stroke-width":2,class:"text-blue-600 flex-shrink-0 mt-0.5"}),n[0]||(n[0]=e.createElementVNode("div",{class:"space-y-1"},[e.createElementVNode("p",{class:"text-xs font-medium text-blue-900"}," Натискайте на карту, щоб додати точки вимірювання "),e.createElementVNode("p",{class:"text-[10px] text-blue-700"},' Або скористайтесь кнопкою "Додати" внизу для введення координат вручну ')],-1))])]))}}),fc={class:"space-y-1.5"},mc={class:"space-y-1 max-h-40 overflow-y-auto"},hc={class:"text-gray-700"},gc={class:"font-semibold text-slate-800"},yc=e.defineComponent({__name:"ToPointList",props:{points:{},isShapeClosed:{type:Boolean}},setup(r){const t=r;function n(a,s){const c=g=>g*Math.PI/180,i=c(s.lat-a.lat),d=c(s.lng-a.lng),u=c(a.lat),h=c(s.lat);return 6371e3*(2*Math.asin(Math.sqrt(Math.sin(i/2)**2+Math.cos(u)*Math.cos(h)*Math.sin(d/2)**2)))}function o(a){return xr(a)}const l=e.computed(()=>{const a=[],s=t.points;if(s.length<2)return a;for(let c=0;c<s.length;c++){const i=c===s.length-1&&t.isShapeClosed?0:c+1;if(i>=s.length)break;const d=n(s[c].coords,s[i].coords);a.push({from:c+1,to:i+1,label:o(d)})}return a});return(a,s)=>(e.openBlock(),e.createElementBlock("div",fc,[s[0]||(s[0]=e.createElementVNode("p",{class:"text-xs font-medium text-gray-600 mb-1.5"},"Відстань між точками:",-1)),e.createElementVNode("div",mc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(c,i)=>(e.openBlock(),e.createElementBlock("div",{key:i,class:"flex items-center justify-between text-xs py-1 px-2 rounded bg-gray-50"},[e.createElementVNode("span",hc,"Точка "+e.toDisplayString(c.from)+" → Точка "+e.toDisplayString(c.to),1),e.createElementVNode("span",gc,e.toDisplayString(c.label),1)]))),128))])]))}}),bc={class:"ruler-panel-wrap absolute bottom-12 right-4 z-[1001] animate-slide-up"},kc={class:"bg-white rounded-xl shadow-2xl border border-gray-200 overflow-hidden w-72"},xc={class:"bg-gradient-to-r from-blue-400 to-blue-500 px-3 py-2 flex items-center justify-between"},wc={class:"flex items-center gap-2"},_c={class:"w-6 h-6 bg-white/20 rounded-lg flex items-center justify-center"},vc={class:"flex border-b border-gray-200"},Cc={key:1,class:"px-3 py-2.5"},Ec={key:1,class:"text-xs text-gray-500"},Bc={class:"px-2.5 py-1.5 bg-gray-50 border-t border-gray-200 space-y-1.5"},Vc={class:"flex gap-1.5"},Sc=e.defineComponent({name:"RulerPanel",__name:"RulerPanel",emits:["close","tab-change","points-change","add-request","complete","shape-closed-change"],setup(r,{expose:t,emit:n}){const o=n,l=e.ref([]),a=e.computed(()=>l.value.length>0),s=e.ref(!1),c=e.ref(!1),i=e.ref("general");function d(S){i.value=S,o("tab-change",S)}e.onMounted(()=>{o("tab-change",i.value)});const u=e.computed(()=>l.value.length>=3&&!c.value);let h=1;const x=()=>l.value.map(S=>({id:S.id,coords:{...S.coords}})),g=()=>{l.value.length<3&&c.value&&(c.value=!1,o("shape-closed-change",!1)),o("points-change",x())},m=()=>{const S=h;return h+=1,S},f=S=>{l.value=[...l.value,{id:m(),coords:{lat:S.lat,lng:S.lng}}],g()},b=({id:S,coords:L})=>{const F=l.value.findIndex(M=>M.id===S);if(F===-1)return;const P=[...l.value];P[F]={id:S,coords:{...L}},l.value=P,g()},w=S=>{l.value=l.value.filter(L=>L.id!==S),g()},_=()=>{l.value=[],c.value&&(c.value=!1,o("shape-closed-change",!1)),g()},k=S=>{b(S)},C=S=>{w(S)},E=()=>{s.value=!0,o("add-request")},I=S=>{f(S),s.value=!1},A=()=>{s.value=!1},B=()=>{u.value&&(c.value=!0,o("complete"),o("shape-closed-change",!0))},$=()=>{_(),s.value=!1,o("close")};return t({addPoint:f,clearPoints:_}),(S,L)=>(e.openBlock(),e.createElementBlock("div",bc,[e.createElementVNode("div",kc,[e.createElementVNode("div",xc,[e.createElementVNode("div",wc,[e.createElementVNode("div",_c,[e.createVNode(e.unref(j.Ruler),{size:14,"stroke-width":2,class:"text-white"})]),L[2]||(L[2]=e.createElementVNode("h3",{class:"text-white font-semibold text-xs"},"Вимірювання",-1))]),e.createElementVNode("button",{class:"w-5 h-5 flex items-center justify-center rounded hover:bg-white/20 transition-colors","aria-label":"Закрити",onClick:$},[e.createVNode(e.unref(j.X),{size:14,"stroke-width":2,class:"text-white"})])]),e.createElementVNode("div",vc,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["flex-1 px-3 py-2 text-xs font-medium transition-colors",i.value==="general"?"text-blue-600 border-b-2 border-blue-500 bg-blue-50/50":"text-gray-500 hover:text-gray-700"]),onClick:L[0]||(L[0]=F=>d("general"))}," Загальна ",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["flex-1 px-3 py-2 text-xs font-medium transition-colors",i.value==="topoint"?"text-blue-600 border-b-2 border-blue-500 bg-blue-50/50":"text-gray-500 hover:text-gray-700"]),onClick:L[1]||(L[1]=F=>d("topoint"))}," До точки ",2)]),i.value==="general"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[a.value?(e.openBlock(),e.createBlock(cc,{key:1,points:l.value,"is-shape-closed":c.value,onUpdatePoint:k,onDeletePoint:C},null,8,["points","is-shape-closed"])):(e.openBlock(),e.createBlock(pc,{key:0}))],64)):(e.openBlock(),e.createElementBlock("div",Cc,[a.value?(e.openBlock(),e.createBlock(yc,{key:0,points:l.value,"is-shape-closed":c.value},null,8,["points","is-shape-closed"])):(e.openBlock(),e.createElementBlock("p",Ec,"Додайте точки на карті, щоб бачити відстані між ними."))])),e.createElementVNode("div",Bc,[e.createElementVNode("div",Vc,[s.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(Oi,{key:0,onClick:E})),u.value?(e.openBlock(),e.createBlock(Pi,{key:1,onClick:B})):e.createCommentVNode("",!0)]),s.value?(e.openBlock(),e.createBlock(Ri,{key:0,onSubmit:I,onCancel:A})):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createBlock(zi,{key:1,onClick:_})):e.createCommentVNode("",!0)])])]))}}),Ue="ruler-points",dt="ruler-line",ut="ruler-polygon",pt="ruler-segments",$c=e.defineComponent({__name:"RulerLayer",props:{map:{},points:{},isShapeClosed:{type:Boolean},labelMode:{}},setup(r){function t(m,f){const b=I=>I*Math.PI/180,w=b(f.lat-m.lat),_=b(f.lng-m.lng),k=b(m.lat),C=b(f.lat);return 6371e3*(2*Math.asin(Math.sqrt(Math.sin(w/2)**2+Math.cos(k)*Math.cos(C)*Math.sin(_/2)**2)))}function n(m){return xr(m)}const o=r;function l(){return{type:"FeatureCollection",features:[]}}function a(m,f,b){const w=b??"general",_=[];let k=0;_.push(0);for(let C=1;C<m.length;C++)k+=t(m[C-1].coords,m[C].coords),_.push(k);return f&&m.length>=2&&(k+=t(m[m.length-1].coords,m[0].coords)),{type:"FeatureCollection",features:m.map((C,E)=>{const I=w==="general"?E===0?"0":n(_[E]):E===0?"0":n(t(m[E-1].coords,m[E].coords));return{type:"Feature",geometry:{type:"Point",coordinates:[C.coords.lng,C.coords.lat]},properties:{id:C.id,index:E+1,label:I}}})}}function s(m,f){if(m.length<2)return l();const b=[];for(let w=0;w<m.length;w++){const _=w===m.length-1&&f?0:w+1;if(_>=m.length)break;const k=m[w].coords,C=m[_].coords,E=t(k,C);b.push({type:"Feature",geometry:{type:"LineString",coordinates:[[k.lng,k.lat],[C.lng,C.lat]]},properties:{distance:n(E)}})}return{type:"FeatureCollection",features:b}}function c(m,f){if(m.length<2)return l();const b=m.map(w=>[w.coords.lng,w.coords.lat]);return f&&b.push(b[0]),{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:b},properties:{}}]}}function i(m){if(m.length<3)return l();const f=m.map(b=>[b.coords.lng,b.coords.lat]);return f.push(f[0]),{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Polygon",coordinates:[f]},properties:{}}]}}let d=!1;function u(m){m.getSource(Ue)||(m.addSource(Ue,{type:"geojson",data:l()}),m.addLayer({id:`${Ue}-circle`,type:"circle",source:Ue,paint:{"circle-radius":5,"circle-color":"#1e293b","circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}),m.addLayer({id:`${Ue}-labels`,type:"symbol",source:Ue,layout:{"text-field":["get","label"],"text-size":14,"text-offset":[0,1.3]},paint:{"text-color":"#0f172a","text-halo-color":"#ffffff","text-halo-width":1}})),m.getSource(pt)||(m.addSource(pt,{type:"geojson",data:l()}),m.addLayer({id:`${pt}-labels`,type:"symbol",source:pt,layout:{"text-field":["get","distance"],"text-size":13,"symbol-placement":"line-center","text-rotation-alignment":"map","text-pitch-alignment":"map"},paint:{"text-color":"#1e293b","text-halo-color":"#ffffff","text-halo-width":1.5}})),m.getSource(dt)||(m.addSource(dt,{type:"geojson",data:l()}),m.addLayer({id:`${dt}-layer`,type:"line",source:dt,paint:{"line-color":"#3b82f6","line-width":2}})),m.getSource(ut)||(m.addSource(ut,{type:"geojson",data:l()}),m.addLayer({id:`${ut}-layer`,type:"fill",source:ut,paint:{"fill-color":"#93c5fd","fill-opacity":.25}})),d=!0}function h(m){if(m){try{m.getLayer(`${ut}-layer`)&&m.removeLayer(`${ut}-layer`),m.getSource(ut)&&m.removeSource(ut),m.getLayer(`${dt}-layer`)&&m.removeLayer(`${dt}-layer`),m.getSource(dt)&&m.removeSource(dt),m.getLayer(`${pt}-labels`)&&m.removeLayer(`${pt}-labels`),m.getSource(pt)&&m.removeSource(pt),m.getLayer(`${Ue}-labels`)&&m.removeLayer(`${Ue}-labels`),m.getLayer(`${Ue}-circle`)&&m.removeLayer(`${Ue}-circle`),m.getSource(Ue)&&m.removeSource(Ue)}catch{}d=!1}}function x(m){if(!m)return;const f=m.getSource(Ue),b=m.getSource(dt),w=m.getSource(ut),_=m.getSource(pt),k=o.points,C=o.labelMode??"general";f&&f.setData(a(k,o.isShapeClosed,C)),b&&b.setData(c(k,o.isShapeClosed)),w&&w.setData(i(k)),_&&_.setData(C==="topoint"?s(k,o.isShapeClosed):l())}function g(){const m=o.map;m&&(d||u(m),x(m))}return e.watch(()=>[o.points,o.isShapeClosed,o.labelMode],()=>g(),{deep:!0,immediate:!0}),e.watch(()=>o.map,()=>g(),{immediate:!0}),e.onBeforeUnmount(()=>{h(o.map)}),(m,f)=>null}});function Nc(r={}){const t=e.ref(!1),n=e.ref([]),o=e.ref(!1),l=e.ref("general"),a=e.ref(null);function s(){t.value?c():(t.value=!0,r.onActivate?.())}function c(){t.value=!1,n.value=[],o.value=!1,a.value?.clearPoints(),r.onDeactivate?.()}function i(g){n.value=g}function d(g){l.value=g}function u(g){o.value=g}function h(g){t.value&&a.value?.addPoint({lat:g.lat,lng:g.lng})}const x=e.computed(()=>n.value.length>0);return{isRulerActive:t,rulerPoints:n,rulerShapeClosed:o,rulerActiveTab:l,rulerPanelRef:a,hasRulerPoints:x,toggleRuler:s,closeRuler:c,onRulerPointsChange:i,onRulerTabChange:d,onRulerShapeClosedChange:u,handleRulerMapClick:h}}const Ac={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},Fc={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},Mc={class:"flex items-center gap-1"},Dc=["disabled"],Lc={key:0,class:"absolute z-[1600] mt-1 min-w-[120px] bg-white border border-gray-300 shadow-lg rounded-lg text-sm overflow-hidden"},Tc=["disabled"],Ic=["disabled"],Rc={class:"mt-4 flex justify-end gap-2"},Oc=["disabled"],zc={class:"absolute top-4 right-4 z-[1000]"},Pc={class:"flex flex-col gap-[2px]"},jc=["disabled"],Uc=["disabled"],Hc=["disabled"],qc=["disabled"],Gc={class:"bg-white/95 border border-gray-200 rounded-md shadow-xl px-3 py-2 max-w-[240px] text-[11px] sm:text-xs text-gray-900"},Kc={class:"space-y-0.5"},Wc={class:"text-gray-500"},Yc={class:"text-gray-900 text-right break-all"},Xc={class:"absolute left-4 bottom-[36px] z-[1000]"},Zc={class:"flex flex-col gap-2"},Jc={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},Qc={class:"flex flex-col gap-1"},ed=["checked","disabled","onChange"],td={class:"text-gray-700 text-xs font-medium"},nd={class:"absolute bottom-0 left-0 right-0 z-[1000] min-h-[28px] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},rd={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full px-2 pb-1"},od={class:"mr-auto flex items-center gap-2 min-w-0 relative"},ld={class:"shrink-0"},ad={key:0,class:"font-bold"},sd=["onClick","disabled"],id={key:0},cd={class:"flex items-center"},dd={class:"text-xs mr-2"},ud={key:0},pd={key:1},fd={key:0,class:"text-xs mr-2"},md={key:1,class:"text-xs mr-2"},hd=["disabled"],gd=["disabled"],Zt="__vs_form_maplibre_loader__",Jt="vs-global-bounds-src",Qt="vs-global-bounds-line",wr=me(e.defineComponent({__name:"vs-input-map",props:{tools:{},multi:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},handleZoom:{type:Boolean,default:!0},ctrlZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},katottg:{default:""},layers:{default:()=>[]},bounds:{},api:{},center:{default:void 0},zoom:{default:void 0},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue","valueSelected"],setup(r,{emit:t}){const n=r,o=t,l=e.useAttrs(),a=e.computed(()=>{const p=l?.multiple,y=l?.multi,v=V=>V===""||V===!0||V==="true"||V===1||V==="1";return!!n.multi||!!n.multiple||v(y)||v(p)}),s=e.computed(()=>!!n.disabled),c=e.ref(!1),i=e.ref(null),d=e.ref(0),u=e.ref(""),h=e.ref(null),x=e.ref([]),g=e.ref(null),m=e.ref(null),f=Nc({onActivate(){if(K)try{K.changeMode("simple_select",{featureIds:[]})}catch{}u.value=""},onDeactivate(){}});function b(){f.toggleRuler()}const w=e.getCurrentInstance(),_=w?.appContext?.config?.globalProperties?.$settings??{},k=_?.map??{},C=w?.vnode?.props??{};function E(p){return Object.prototype.hasOwnProperty.call(C,p)||Object.prototype.hasOwnProperty.call(C,p.replace(/[A-Z]/g,y=>`-${y.toLowerCase()}`))}const I=Array.isArray(k.center)&&k.center.length===2?k.center:Array.isArray(_.center)&&_.center.length===2?_.center:[30,50],A=typeof k.zoom=="number"?k.zoom:typeof _.zoom=="number"?_.zoom:typeof _.defaultZoom=="number"?_.defaultZoom:10,B=e.computed(()=>E("center")?n.center:k.center??n.center),$=e.computed(()=>E("zoom")?n.zoom:k.zoom??n.zoom),S=e.computed(()=>E("katottg")?String(n.katottg??""):String(k.katottg??n.katottg??"")),L=e.computed(()=>E("layers")?n.layers??[]:k.layers??n.layers??[]),F=e.computed(()=>E("bounds")?n.bounds:k.bounds??n.bounds),P=e.ref(Array.isArray(B.value)&&B.value.length===2?[...B.value]:I),M=e.ref(typeof $.value=="number"?$.value:A),O=e.ref(n.modelValue),T=e.ref(null),G=e.ref(null),W=e.ref([]),X=e.ref(!1),ne=e.ref(!1),we=e.ref([]),ge=e.ref({coordinates:"",format:"decimal",order:"lat-lon"}),J={coordinates:{type:"Textarea",label:"Координати вершин полігону (3-100 точок)",placeholder:`50.4501, 30.5234
|
|
1
|
+
(function(pe,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@opengis/core"),require("lucide-vue-next")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core","lucide-vue-next"],e):(pe=typeof globalThis<"u"?globalThis:pe||self,e(pe.FormBuilder={},pe.Vue,pe.OpenGISCore,pe.lucide))})(this,(function(pe,e,ue,j){"use strict";const or=e.defineComponent({__name:"vs-info-tooltip",props:{text:{}},setup(r){const t=r,n=e.ref(!1),o=e.ref({top:"0px",left:"0px"});function l(s){if(!t.text)return;const c=s.currentTarget.getBoundingClientRect();o.value={top:`${c.bottom+4}px`,left:`${Math.min(c.left,window.innerWidth-230)}px`},n.value=!0}function a(){n.value=!1}return(s,c)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("span",{class:"inline-flex items-center",onMouseenter:l,onMouseleave:a},[e.renderSlot(s.$slots,"default",{},()=>[e.createVNode(e.unref(j.Info),{class:"h-4 w-4 text-gray-400 cursor-help"})])],32),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.value&&s.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(o.value),class:"fixed z-[9999] max-w-xs p-2 bg-gray-900 text-white text-xs rounded-lg shadow-lg pointer-events-none"},e.toDisplayString(s.text),5)):e.createCommentVNode("",!0)]))],64))}}),Ao={class:"w-full relative"},Fo={key:0,class:"text-[14px] font-medium text-gray-900 mb-2 flex items-center gap-1"},Mo={class:"opacity-100"},Do={key:0,class:"text-red-500 text-[14px]"},Lo={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},To=e.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(r){const t=r,n=e.computed(()=>typeof t.item?.label=="string"&&t.item.label?t.item.label:t.item?.ua||t.label||t.ua),o=e.computed(()=>!!n.value),l=e.computed(()=>!!t.item?.rules?.includes("required")),a=e.computed(()=>t.item?.info||"");return(s,c)=>(e.openBlock(),e.createElementBlock("div",Ao,[o.value?(e.openBlock(),e.createElementBlock("div",Fo,[e.createElementVNode("span",Mo,e.toDisplayString(n.value),1),l.value?(e.openBlock(),e.createElementBlock("span",Do,"*")):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createBlock(or,{key:1,text:a.value},null,8,["text"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"default",e.mergeProps(s.$attrs,{class:{"opacity-60":s.item.disabled}})),s.error?(e.openBlock(),e.createElementBlock("span",Lo,e.toDisplayString(s.error),1)):e.createCommentVNode("",!0)]))}}),Io={class:"w-full relative flex flex-row items-center gap-2"},Ro={key:0,class:"text-red-500 text-[14px]"},Oo={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},zo=e.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{default:()=>({container:12,label:3})}},setup(r){const t=r,n=e.computed(()=>t.item?.label||t.label||t.ua),o=e.computed(()=>t.item?.info||""),l=e.computed(()=>t.columns??{container:12,label:3}),a=e.computed(()=>{const{container:d,label:u}=l.value;return!d||d<=0?0:Math.min(Math.max(u??0,0),d)/d}),s=e.computed(()=>t.item?.type==="html"||a.value<=0?!1:!!n.value),c=e.computed(()=>{if(!s.value)return{};const d=`${a.value*100}%`;return{flexBasis:d,maxWidth:d}}),i=e.computed(()=>{const{container:d,label:u}=l.value;if(!d||d<=0)return{};if(t.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!s.value)return{flexBasis:"100%",maxWidth:"100%"};const h=Math.max(d-Math.max(u??0,0),0)/d;if(!h)return{};const x=`${h*100}%`;return{flexBasis:x,maxWidth:x}});return(d,u)=>(e.openBlock(),e.createElementBlock("div",Io,[s.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0 items-center gap-1",style:e.normalizeStyle(c.value)},[e.createTextVNode(e.toDisplayString(n.value)+" ",1),d.item?.rules?.includes("required")&&n.value?(e.openBlock(),e.createElementBlock("span",Ro,"*")):e.createCommentVNode("",!0),o.value?(e.openBlock(),e.createBlock(or,{key:1,text:o.value},null,8,["text"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"flex-1 min-w-0",style:e.normalizeStyle(i.value)},[e.renderSlot(d.$slots,"default",e.normalizeProps(e.guardReactiveProps(d.$attrs)))],4),d.error?(e.openBlock(),e.createElementBlock("span",Oo,e.toDisplayString(d.error),1)):e.createCommentVNode("",!0)]))}}),Po={class:"w-full relative"},jo={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},Uo=e.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(r){return(t,n)=>(e.openBlock(),e.createElementBlock("div",Po,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",jo,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),Ho={class:"flex-1 min-w-0"},qo={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},Go={class:"truncate"},Ko={key:0,class:"text-red-500 text-[14px]"},Wo=["innerHTML"],Yo={key:0,class:"mt-1 text-xs text-red-500"},Xo={default:To,horizontal:zo,inline:Uo,settings:e.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(r){const t=r,n=e.ref("uk");e.computed(()=>(t.item??{})?.[n.value]??t.ua??t.label??"");const o=e.computed(()=>t.item?.description??""),l=e.computed(()=>Array.isArray(t.item?.rules)&&t.item.rules.includes("required")),a=e.computed(()=>(typeof t.error=="string"?t.error:"")??""),s=()=>{const c=typeof localStorage<"u"?localStorage.getItem("locale"):null;n.value=c||"uk"};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(n.value=localStorage.locale)}catch{}window.addEventListener("storage",s)}),e.onUnmounted(()=>{window.removeEventListener("storage",s)}),(c,i)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":c.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(c.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",Ho,[c.ua||c.label?(e.openBlock(),e.createElementBlock("p",qo,[e.createElementVNode("span",Go,e.toDisplayString(c.item[n.value]||c.ua||c.label),1),l.value?(e.openBlock(),e.createElementBlock("span",Ko,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),o.value?(e.openBlock(),e.createElementBlock("p",{key:1,class:"text-xs text-slate-500 dark:text-slate-400",innerHTML:o.value},null,8,Wo)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["w-full",["select","native-select"].includes(c.item.type)?"md:w-[30%]":"md:w-auto"])},[e.renderSlot(c.$slots,"default",e.normalizeProps(e.guardReactiveProps(c.$attrs)))],2)],2),a.value?(e.openBlock(),e.createElementBlock("p",Yo,e.toDisplayString(a.value),1)):e.createCommentVNode("",!0)],2))}})};function Ie(r){return{inputClass:e.computed(()=>{const n=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${r?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return r?.size==="sm"?`${n}h-[32px]`:`${n}h-[38px]`})}}const Zo=["placeholder","disabled"],Jo=e.defineComponent({__name:"vs-input-password",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Ie(t.style),o=e.useModel(r,"modelValue"),l=e.computed(()=>!!t.disabled),a=e.computed(()=>t.placeholder??"");return(s,c)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":c[0]||(c[0]=i=>o.value=i),placeholder:a.value,disabled:l.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Zo)),[[e.vModelText,o.value]])}}),Qo=["placeholder","disabled","maxlength","minlength"],Bt=e.defineComponent({__name:"vs-input-text",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Ie(t.style),o=e.useModel(r,"modelValue"),l=e.computed(()=>!!t.disabled),a=e.computed(()=>t.placeholder??""),s=e.computed(()=>t.maxlength??void 0),c=e.computed(()=>t.minlength??void 0);function i(){typeof o.value=="string"&&(o.value=o.value.trim())}return(d,u)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":u[0]||(u[0]=h=>o.value=h),placeholder:a.value,disabled:l.value,maxlength:s.value,minlength:c.value,onBlur:i,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[d.customClass,e.unref(n),{"!border-red-600":d.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,Qo)),[[e.vModelText,o.value]])}}),el=["placeholder","disabled","min","max"],lr=e.defineComponent({__name:"vs-input-number",props:e.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Ie(t.style),o=e.useModel(r,"modelValue"),l=e.computed(()=>!!t.disabled);return(a,s)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":s[0]||(s[0]=c=>o.value=c),placeholder:a.placeholder,disabled:l.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"},min:a.min,max:a.max},null,10,el)),[[e.vModelText,o.value]])}}),tl={class:"flex items-center gap-[4px]"},nl=["value","id","disabled"],rl=["for"],ol={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},ll=e.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=t,o=r,l=e.computed({get:()=>o.modelValue,set:s=>n("update:modelValue",s)}),a=e.computed(()=>!!o.disabled);return(s,c)=>(e.openBlock(),e.createElementBlock("div",tl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:s.value,"onUpdate:modelValue":c[0]||(c[0]=i=>l.value=i),class:e.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":a.value}]),id:s.id,disabled:a.value},null,10,nl),[[e.vModelCheckbox,l.value]]),e.createElementVNode("label",{for:s.id,class:e.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":a.value}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[l.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",s.error?"border-red-600":""]])},[e.createVNode(e.unref(j.Check),{class:"h-4 w-4"})],2),e.createElementVNode("span",ol,[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(s.label),1)])])],10,rl)]))}}),al=["name","value","disabled"],sl={class:"flex items-center gap-[6px] text-[14px]"},il={key:0,class:"text-[16px]"},cl=["src"],dl=e.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,o=t,l=e.computed({get:()=>n.modelValue,set:c=>{o("update:modelValue",c)}}),a=e.computed(()=>Array.isArray(l.value)?l.value.includes(n.value):l.value===!0||l.value===n.value),s=e.computed(()=>n.style?.size==="xs"?"p-1.5 text-xs":n.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(c,i)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[s.value,a.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"hidden",name:c.id,value:c.value,"onUpdate:modelValue":i[0]||(i[0]=d=>l.value=d),disabled:c.disabled},null,8,al),[[e.vModelCheckbox,l.value]]),e.createElementVNode("span",sl,[c.icon||c.imgUrl?(e.openBlock(),e.createElementBlock("span",il,[c.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(c.icon)},null,2)):e.createCommentVNode("",!0),c.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:1,src:c.imgUrl,width:"16",height:"16",alt:"icon"},null,8,cl)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(c.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(c.label),1)])])],2))}}),ul={class:"flex items-center"},_n=e.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,o=t,l=`radio-${Math.floor(Math.random()*1e4)}`,a=e.computed({get:()=>Array.isArray(n.modelValue)?Array.isArray(n.modelValue)&&n.modelValue.includes(n.value):n.modelValue,set:c=>{if(Array.isArray(n.modelValue)){let i=[...n.modelValue];c?i.includes(n.value)||i.push(n.value):i=i.filter(d=>d!==n.value),o("update:modelValue",i)}else o("update:modelValue",c)}}),s=e.ref(`vs-checkbox-${n.view||"default"}`);return(c,i)=>(e.openBlock(),e.createElementBlock("div",ul,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value==="vs-checkbox-buttons"?e.unref(dl):e.unref(ll)),{value:c.value,label:c.label,info:c.option?.info,disabled:c.disabled,modelValue:a.value,"onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),id:l,icon:c.icon,imgUrl:c.imgUrl,style:e.normalizeStyle(c.style),error:c.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(c.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),pl={key:0,class:"flex items-start gap-x-1"},fl={key:0,class:"text-red-500 text-[14px]"},ml=["title"],hl=["disabled"],vn=e.defineComponent({__name:"vs-input-switcher",props:e.mergeModels({rules:{default:()=>[]},view:{default:"checkbox"},label:{default:""},i:{default:""},text:{default:""},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue");return(o,l)=>t.view==="checkbox"?(e.openBlock(),e.createElementBlock("div",pl,[e.createVNode(_n,{modelValue:n.value,"onUpdate:modelValue":l[0]||(l[0]=a=>n.value=a),label:o.text,error:o.error||""},null,8,["modelValue","label","error"]),o.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",fl,"*")):e.createCommentVNode("",!0),o.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:o.i,onClick:l[1]||(l[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(j.Info),{class:"h-4 w-4 text-gray-500"})],8,ml)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[n.value?`bg-${o.style?.primaryColor||"blue"}-500`:"bg-stone-200",o.customClass]]),disabled:o.disabled,onClick:l[2]||(l[2]=a=>n.value=!n.value)},[e.createElementVNode("span",{"data-state":"checked",class:e.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[n.value?"translate-x-4":"translate-x-0"]])},null,2)],10,hl))}}),gl=["id","innerHTML"],Cn=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},setup(r){return(t,n)=>(e.openBlock(),e.createElementBlock("div",{id:t.name,class:e.normalizeClass(["text-gray-900",t.customClass]),innerHTML:t.html?t.html:t.text},null,10,gl))}}),yl=["placeholder","disabled","name"],En=e.defineComponent({__name:"vs-input-mask",props:e.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Ie(t.style),o=e.useModel(r,"modelValue"),l=e.ref(null);let a=null;function s(c){const i={9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},d=new Set;let u=!1;for(let x=0;x<c.length;x+=1){const g=c[x];g==="{"?u=!0:g==="}"?u=!1:u&&d.add(g)}const h={};return Object.keys(i).forEach(x=>{d.has(x)||(h[x]=i[x])}),{mask:c,definitions:h,lazy:!1}}return e.onMounted(async()=>{if(l.value){const{default:c}=await Promise.resolve().then(()=>qn),i=s(t.mask||"");a=c(l.value,i),a.on("accept",()=>{o.value=t.unmask?a.unmaskedValue:a.value}),a.on("complete",()=>{o.value=t.unmask?a.unmaskedValue:a.value}),a.value=o.value!=null?String(o.value):""}}),e.onBeforeUnmount(()=>{a?.destroy()}),e.watch(()=>t.mask,c=>{if(a){const i=s(c||"");a.updateOptions(i)}}),e.watch(o,c=>{a&&a.unmaskedValue!==c&&(a.value=c!=null?String(c):"")}),(c,i)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:l,placeholder:c.placeholder,disabled:c.disabled,name:c.name,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,10,yl))}}),bl={class:"relative w-full bg-white rounded-lg"},kl={class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},xl=["placeholder","disabled"],Bn=e.defineComponent({__name:"vs-input-email",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Ie(t.style),o=e.useModel(r,"modelValue");return(l,a)=>(e.openBlock(),e.createElementBlock("div",bl,[e.createElementVNode("div",kl,[e.createVNode(e.unref(j.Mail),{class:"h-4 w-4 stroke-gray-500 transition-all"})]),e.withDirectives(e.createElementVNode("input",{type:"email","onUpdate:modelValue":a[0]||(a[0]=s=>o.value=s),placeholder:l.placeholder,disabled:l.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,xl),[[e.vModelText,o.value]])]))}}),wl={class:"relative w-full bg-white rounded-lg"},_l={class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},vl=["value","placeholder","disabled"],Vn=e.defineComponent({__name:"vs-input-tel",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Ie(t.style),o=e.useModel(r,"modelValue"),l=e.computed(()=>o.value?o.value.startsWith("+")?o.value.slice(1):o.value:""),a=c=>{let{value:i}=c.target;i=i.replace(/^\+/,""),o.value=i?`+${i}`:""},s=c=>{const i=c,{data:d,inputType:u}=i;u&&u.startsWith("delete")||d&&/\D/.test(d)&&i.preventDefault()};return e.watch(()=>o.value,c=>{c&&!c.startsWith("+")?o.value=`+${c.replace(/^\+/,"")}`:c||(o.value="")},{immediate:!0}),(c,i)=>(e.openBlock(),e.createElementBlock("div",wl,[e.createElementVNode("div",_l,[e.createVNode(e.unref(j.Phone),{class:"h-4 w-4 stroke-gray-500 transition-all"})]),i[0]||(i[0]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[30px] text-gray-500 select-none pointer-events-none"}," + ",-1)),e.createElementVNode("input",{type:"tel",value:l.value,onInput:a,onBeforeinput:s,pattern:"^\\+[1-9]\\d{1,14}$",maxlength:"15",placeholder:c.placeholder,disabled:c.disabled,class:e.normalizeClass(["!pl-10 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":c.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,vl)]))}}),Cl=["value","disabled"],El={class:"text-[13px] text-gray-700"},Bl=e.defineComponent({__name:"vs-input-radio-default",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),o=e.computed(()=>!!t.disabled);return(l,a)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center gap-0",[t.customClass,o.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=s=>n.value=s),type:"radio",value:t.value,disabled:o.value,class:"hidden"},null,8,Cl),[[e.vModelRadio,n.value]]),e.createElementVNode("span",{class:e.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${t.style?.primaryColor||"blue"}-500`,o.value?"opacity-50 cursor-not-allowed":""]])},[n.value==t.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${t.style?.primaryColor||"blue"}-500`]])},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",El,e.toDisplayString(t.text),1)],2))}}),Vl=["value","disabled"],Sl={class:"text-[13px] text-gray-700"},$l={"vs-input-radio-default":Bl,"vs-input-radio-buttons":e.defineComponent({__name:"vs-input-radio-buttons",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),o=e.computed(()=>!!t.disabled);return(l,a)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[n.value==t.value?`ring-2 ring-ring ring-${t.style?.primaryColor||"blue"}-500`:"",t.customClass,o.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":a[0]||(a[0]=s=>n.value=s),type:"radio",value:t.value,disabled:o.value,class:"hidden"},null,8,Vl),[[e.vModelRadio,n.value]]),e.createElementVNode("span",Sl,e.toDisplayString(t.text),1)],2))}})},Sn=e.defineComponent({__name:"vs-input-radio",props:e.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),o=e.computed(()=>$l[`vs-input-radio-${t.view}`]);return(l,a)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([l.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.options,s=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(o.value),e.mergeProps({key:s?.id,text:s.text,value:s.id.toString(),checked:n.value===s.id,modelValue:n.value,"onUpdate:modelValue":a[0]||(a[0]=c=>n.value=c)},{ref_for:!0},l.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),Nl={key:1,class:"w-full flex flex-col gap-4"},Al={key:0,class:"text-sm font-medium text-muted-foreground my-2"},Fl="Без категорії",Ml=e.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},group:{default:void 0},values:{default:()=>[]},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,o=t,l=e.ref([]),a=e.reactive({}),s=g=>g?.value||g?.id||g?.text||g,c=g=>g.text||String(g),i=g=>`lg:col-span-${g||12}`,d=e.computed(()=>[n.position==="vertical"?"flex flex-col":"",n.colSpan?"grid":"flex justify-start"]),u=g=>g==null||g===""?null:typeof g=="string"||typeof g=="number"?g:String(g),h=e.computed(()=>{if(!n.group)return[];const g=new Map;l.value.forEach(_=>{const k=_[n.group],C=u(k);g.has(C)||g.set(C,[]),g.get(C)?.push(_)});const m=[];n.values?.length&&n.values.forEach(_=>{const k=u(_);m.push(k)});const f=new Set,b=_=>{const k=g.get(_)||[];if(!k.length)return null;const C=_===null?"group-null":`group-${String(_)}`,E=_===null?Fl:String(_);return f.add(_),{key:C,label:E,options:k}},w=[];return m.forEach(_=>{const k=b(_);k&&w.push(k)}),g.forEach((_,k)=>{if(f.has(k))return;const C=b(k);C&&w.push(C)}),w}),x=async()=>{try{const g=await fetch(`/api/suggest/${n.data}`).then(m=>m.json());l.value=g?.data||g}catch(g){console.error(g)}};return e.watch(()=>n.modelValue,g=>{if(typeof g=="boolean"&&l.value.length===1){const m=s(l.value[0]);a[m]=g}else if(Array.isArray(g)){const m=new Set(g);l.value.forEach(f=>{if(!f.disabled){const b=s(f);a[b]=m.has(b)}})}},{immediate:!0}),e.watch(a,()=>{if(!l.value.length){o("update:modelValue",null);return}const g=Object.entries(a).filter(([,m])=>m).map(([m])=>m);o("update:modelValue",g.length===0?[]:g)},{deep:!0}),e.onMounted(()=>{if(n.data)x().then(()=>{if(typeof n.modelValue=="boolean"&&l.value.length===1){const g=s(l.value[0]);a[g]=n.modelValue}else if(Array.isArray(n.modelValue)){const g=new Set(n.modelValue);l.value.forEach(m=>{if(!m.disabled){const f=s(m);a[f]=g.has(f)}})}});else if(l.value=n.options,typeof n.modelValue=="boolean"&&l.value.length===1){const g=s(l.value[0]);a[g]=n.modelValue}else if(Array.isArray(n.modelValue)){const g=new Set(n.modelValue);l.value.forEach(m=>{if(!m.disabled){const f=s(m);a[f]=g.has(f)}})}}),(g,m)=>n.group?(e.openBlock(),e.createElementBlock("div",Nl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,f=>(e.openBlock(),e.createElementBlock("div",{key:f.key,class:"flex flex-col gap-2"},[f.label?(e.openBlock(),e.createElementBlock("span",Al,e.toDisplayString(f.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.options,b=>(e.openBlock(),e.createBlock(_n,{modelValue:a[s(b)],"onUpdate:modelValue":w=>a[s(b)]=w,value:s(b),class:e.normalizeClass(i(g.colSpan)),disabled:n.disabled||b.disabled,label:c(b),key:`${f.key}-${s(b)}`,icon:b?.icon,imgUrl:b?.imgUrl,option:b,view:g.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["p-0 w-full gap-[10px]",d.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,f=>(e.openBlock(),e.createBlock(_n,{modelValue:a[s(f)],"onUpdate:modelValue":b=>a[s(f)]=b,value:s(f),class:e.normalizeClass(i(g.colSpan)),disabled:n.disabled||f.disabled,label:c(f),key:s(f),icon:f?.icon,imgUrl:f?.imgUrl,option:f,view:g.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),me=(r,t)=>{const n=r.__vccOpts||r;for(const[o,l]of t)n[o]=l;return n},ar=me(Ml,[["__scopeId","data-v-8e66207e"]]),Dl=["type","placeholder","disabled"],Ll=e.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},mode:{default:"date"}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r;function o(u){return u?n.mode==="datetime"?(u.includes("T")?u:null)||u+(u.includes(" ")?"":"T00:00"):u?.split(" ")[0]:null}const{inputClass:l}=Ie(n.style),a=t,s=e.computed({get:()=>o(n.modelValue),set:u=>a("update:modelValue",u)}),c=e.computed(()=>n.mode==="datetime"?"datetime-local":n.mode),i=e.computed(()=>!!n.disabled),d=e.computed(()=>n.placeholder??"");return(u,h)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:c.value,"onUpdate:modelValue":h[0]||(h[0]=x=>s.value=x),placeholder:d.value,disabled:i.value,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[u.modelValue?"":"text-opacity-50",e.unref(l)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Dl)),[[e.vModelDynamic,s.value]])}}),Tl=(r,t)=>{if(!t||!Object.keys(t).length)return r;const[n,o=""]=r.split("?"),l=new URLSearchParams(o);Object.entries(t).forEach(([s,c])=>{c==null||c===""||l.set(s,String(c))});const a=l.toString();return a?`${n}?${a}`:n},sr=async(r,t={})=>{try{const n=new FormData;n.append("unique","true"),n.append("file",r);const{api:o,id:l="1",form:a="form",table:s="table",customParams:c}=t,i=o||`/file/upload/uploads?id=${l||""}&form=${a||""}&table=${s||""}`,d=Tl(i,c);return(await fetch(d,{method:"POST",body:n}).then(h=>h.json()))?.result}catch(n){return ue.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",n),null}},Il=async r=>{try{return await fetch(`file/delete${r}`),!0}catch(t){return console.error(t),!1}},ir=async r=>{try{const t=await fetch(`/file/download/files/uploads${r}`),n=await t.arrayBuffer(),o=t.headers["content-type"],l=new TextDecoder("utf-8").decode(n),a=new Blob([l],{type:o}),s=document.createElement("a");s.setAttribute("download",r),s.href=window.URL.createObjectURL(a),s.click()}catch(t){console.error(t.message)}},Rl=r=>{if(!r)return"";const t=r?.split(".");return t[t.length-1]},Ol=r=>{const t=Rl(r),n={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return n.imageFormat.includes(t)?"img":n.sheetsFormat.includes(t)?j.Table:n.textsFormat.includes(t)?j.FileCode:n.documentsFormat.includes(t)?j.FileText:n.archivesFormat.includes(t)?j.FileArchive:j.FileText},zl=["title"],Pl={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},$n=me(e.defineComponent({__name:"vs-input-file-list-item",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(r){const t=e.useModel(r,"value"),n=e.useModel(r,"item"),o=r,l=e.computed(()=>n.value?typeof n.value=="string"?n.value:n.value.file_path:""),a=c=>typeof c=="string"?c:c?.file_path||"",s=()=>{const c=l.value;Il(c),o.multiple&&Array.isArray(t.value)?t.value=t.value.filter(i=>a(i)!==c):t.value=""};return(c,i)=>(e.openBlock(),e.createElementBlock("div",{title:l.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Ol)(l.value)),{src:l.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:i[0]||(i[0]=d=>e.unref(ir)(l.value))},null,8,["src"])),e.createElementVNode("div",Pl,[e.createElementVNode("button",{type:"button",onClick:s,class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[e.createVNode(e.unref(j.Trash2),{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:i[1]||(i[1]=d=>e.unref(ir)(l.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[e.createVNode(e.unref(j.Download),{class:"w-4 h-4"})])])],8,zl))}}),[["__scopeId","data-v-67f822ce"]]),jl={class:"flex items-center gap-x-2"},Ul=["accept","multiple","disabled"],Hl={key:1,class:"flex items-center flex-wrap gap-2"},ql={key:1,class:"loader"},Gl={key:1,class:"loader"},cr=me(e.defineComponent({__name:"vs-input-file",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["change"],["update:modelValue"]),setup(r,{emit:t}){const n=r,o=e.useModel(r,"modelValue"),l=t,a=e.ref(null),s=e.ref(!1),c=e.inject("values"),i=e.computed(()=>n.format?n.format.split(",").map(w=>w.trim().toLowerCase()).filter(Boolean):[]),d=w=>{if(n.max_size&&w.size>n.max_size*1024*1024){const _=(w.size/1048576).toFixed(2);return ue.notify({type:"error",title:"Помилка!",message:`Файл "${w.name}" занадто великий. Максимальний розмір: ${n.max_size} МБ, розмір файлу: ${_} МБ`,position:"right-bottom"}),!1}return!0},u=w=>{if(!i.value.length)return!0;const _=`.${w.name.split(".").pop()?.toLowerCase()||""}`,k=i.value.includes(_);return k||ue.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${w.name}". Дозволені формати: ${i.value.join(", ")}`,position:"right-bottom"}),k},h=e.computed(()=>{const w={},_=[];if(!n.customParams?.length)return{params:w,missingSources:_};const k=c?.value??{};return n.customParams.forEach(C=>{if(!C)return;const[E,I]=C.split("="),A=E?.trim(),B=I?.trim();if(!A||!B)return;const $=k[B];if($==null||$===""){_.push(B);return}w[A]=$}),{params:w,missingSources:_}}),x=()=>{const{params:w}=h.value;return{api:n.api,customParams:Object.keys(w).length?w:void 0}},g=()=>{const w=h.value.missingSources;if(!w.length)return!0;const _=w.join(", ");return ue.notify({type:"warning",title:"Заповніть поля",message:`Поля (${_}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},m=w=>{ue.notify({type:"error",title:"Помилка завантаження",message:w||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},f=()=>{n.disabled||s.value||g()&&a.value?.click()},b=async w=>{const{files:_}=w.target;if(!_||_.length===0)return;if(!g()){a.value&&(a.value.value="");return}const k=Array.from(_);if(n.max_size&&k.filter(I=>!d(I)).length>0){a.value&&(a.value.value="");return}if(k.filter(E=>!u(E)).length>0){a.value&&(a.value.value="");return}s.value=!0;try{if(n.multiple){const E=Array.from(_).map(async $=>await sr($,x())),I=await Promise.all(E),A=I.filter($=>$?.file_path);if(A.length===0){m();return}A.length<I.length&&m("Деякі файли не вдалося завантажити. Перевірте їх та спробуйте знову.");const B=A.map($=>({file_id:$.file_id??$.file_path,file_path:$.file_path}));o.value=[...o.value||[],...B],l("change",o.value)}else{const E=_[0],I=await sr(E,x());if(!I?.file_path){m();return}o.value={file_id:I.file_id??I.file_path,file_path:I.file_path},l("change",o.value)}}catch(E){const I=E?.message||void 0;m(I)}finally{s.value=!1,a.value&&(a.value.value="")}};return(w,_)=>(e.openBlock(),e.createElementBlock("div",jl,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:a,type:"file",accept:n.format,multiple:w.multiple,onChange:b,disabled:s.value||w.disabled},null,40,Ul),!w.multiple&&o.value&&!Array.isArray(o.value)?(e.openBlock(),e.createBlock($n,{key:0,item:o.value,value:o.value,"onUpdate:value":_[0]||(_[0]=k=>o.value=k)},null,8,["item","value"])):w.multiple?(e.openBlock(),e.createElementBlock("div",Hl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(k,C)=>(e.openBlock(),e.createBlock($n,{multiple:w.multiple,key:C,value:o.value,"onUpdate:value":_[1]||(_[1]=E=>o.value=E),item:k},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:f,class:e.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",w.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[s.value?(e.openBlock(),e.createElementBlock("div",ql)):(e.openBlock(),e.createBlock(e.unref(j.Plus),{key:0,class:"h-4 w-4"}))],2)])):e.createCommentVNode("",!0),w.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:f,class:e.normalizeClass([w.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[s.value?(e.openBlock(),e.createElementBlock("div",Gl)):(e.openBlock(),e.createBlock(e.unref(j.Plus),{key:0,class:"h-4 w-4"}))],2))]))}}),[["__scopeId","data-v-b79e26bd"]]),Kl={class:"vs-input-file2 flex flex-col gap-4"},Wl={class:"flex items-center gap-x-2"},Yl=["accept","disabled"],Xl={key:0,class:"absolute inset-0 flex flex-col items-center justify-center gap-1 rounded-lg bg-white/90 text-xs font-medium text-slate-600"},Zl={key:0,class:"rounded-lg border border-[#CFD9E0] bg-white p-4 shadow-sm"},Jl={class:"flex items-center justify-between text-sm"},Ql={class:"truncate pr-4"},ea={class:"font-medium text-slate-800 truncate"},ta={class:"text-slate-500"},na={class:"text-slate-500 whitespace-nowrap"},ra={class:"mt-3 h-2 rounded-full bg-slate-100 overflow-hidden"},oa={class:"mt-3 flex flex-wrap gap-2 text-sm"},la={key:0,class:"mt-2 text-sm text-rose-600"},aa=e.defineComponent({__name:"vs-input-file2",props:e.mergeModels({format:{},max_size:{},api:{},chunkSize:{default:5*1024*1024},subdir:{default:""},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),o=e.ref(null),l=e.ref(null),a=e.ref(""),s=e.ref(0),c=e.ref(!1),i=e.ref(""),d=e.ref(null),u=e.inject("values"),h=e.computed(()=>t.format?t.format.split(",").map(F=>F.trim().toLowerCase()).filter(Boolean):[]),x=e.computed(()=>!l.value||!l.value.size?0:Math.min(100,Math.round(s.value/l.value.size*100))),g=e.computed(()=>l.value?`${b(s.value)} / ${b(l.value.size)}`:""),m=e.computed(()=>t.disabled?"opacity-50 cursor-not-allowed":c.value?"cursor-default text-blue-500":"cursor-pointer hover:border-blue-500 hover:bg-blue-50 hover:text-blue-500"),f=()=>{t.disabled||c.value||C()&&o.value?.click()},b=F=>{if(!Number.isFinite(F))return"0 B";const P=["B","KB","MB","GB"];let M=0,O=F;for(;O>=1024&&M<P.length-1;)O/=1024,M+=1;return`${O.toFixed(M===0?0:1)} ${P[M]}`},w=F=>{if(!t.max_size)return!0;const P=t.max_size*1024*1024;return F.size>P?(ue.notify({type:"error",title:"Файл занадто великий",message:`Максимальний розмір ${t.max_size} МБ`,position:"right-bottom"}),!1):!0},_=F=>{if(!h.value.length)return!0;const P=`.${F.name.split(".").pop()?.toLowerCase()||""}`;return h.value.includes(P)?!0:(ue.notify({type:"error",title:"Непідтримуваний формат",message:`Дозволені формати: ${h.value.join(", ")}`,position:"right-bottom"}),!1)},k=e.computed(()=>{const F={},P=[];if(!t.customParams?.length)return{params:F,missing:P};const M=u?.value??{};return t.customParams.forEach(O=>{if(!O)return;const[T,G]=O.split("="),W=T?.trim(),X=G?.trim();if(!W||!X)return;const ne=M[X];ne==null||ne===""?P.push(X):F[W]=ne}),{params:F,missing:P}}),C=()=>k.value.missing.length?(ue.notify({type:"warning",title:"Заповніть поля",message:`Потрібні значення: ${k.value.missing.join(", ")}`,position:"right-bottom"}),!1):!0,E=F=>{const P=F.target,M=P.files?.[0];if(M){if(!C()){P.value="";return}if(!w(M)||!_(M)){P.value="";return}l.value=M,s.value=0,a.value="",i.value=""}},I=async()=>{if(!l.value){f();return}try{i.value="";const F={id:a.value||"",fileName:l.value.name,subdir:t.subdir,size:l.value.size,...k.value.params},P=await fetch("/api/file/upload2/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F)});if(!P.ok)throw new Error("Не вдалося ініціалізувати завантаження");const M=await P.json();a.value=M.id||a.value,s.value=M.uploaded||0,await A()}catch(F){i.value=F?.message||"Помилка при старті завантаження"}},A=async()=>{if(!(!l.value||!a.value)){c.value=!0;try{for(;s.value<l.value.size;){const F=s.value,P=Math.min(F+t.chunkSize,l.value.size),M=l.value.slice(F,P);d.value=new AbortController;const O=await fetch(`/api/file/upload2/${a.value}`,{method:"PATCH",headers:{"Content-Range":`bytes ${F}-${P-1}/${l.value.size}`},body:M,signal:d.value.signal});if(!O.ok)throw new Error("Помилка завантаження частини");const T=await O.json().catch(()=>({}));if(T.uploaded!=null?s.value=Number(T.uploaded):s.value=P,T.finished||s.value>=l.value.size){c.value=!1;const G=T.file_path||T.url||a.value;n.value={file_id:T.file_id??a.value??G,file_path:G},ue.notify({type:"success",title:"Файл завантажено",message:l.value.name,position:"right-bottom"}),L();return}}}catch(F){if(F?.name==="AbortError")return;i.value=F?.message||"Помилка при завантаженні",c.value=!1}finally{d.value=null,c.value=!1}}},B=()=>{c.value&&(d.value?.abort(),d.value=null,c.value=!1)},$=async()=>{if(l.value){if(!a.value){await I();return}await A()}},S=()=>{d.value?.abort(),d.value=null,L()},L=()=>{const F=o.value;F&&(F.value=""),l.value=null,a.value="",s.value=0,i.value=""};return(F,P)=>(e.openBlock(),e.createElementBlock("div",Kl,[e.createElementVNode("div",Wl,[e.createElementVNode("input",{ref_key:"fileInput",ref:o,type:"file",class:"hidden",accept:t.format,disabled:c.value||t.disabled,onChange:E},null,40,Yl),n.value?(e.openBlock(),e.createBlock($n,{key:0,item:n.value,"onUpdate:item":P[0]||(P[0]=M=>n.value=M),value:n.value,"onUpdate:value":P[1]||(P[1]=M=>n.value=M)},null,8,["item","value"])):(e.openBlock(),e.createElementBlock("div",{key:1,onClick:f,class:e.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",m.value])},[c.value?(e.openBlock(),e.createElementBlock("div",Xl,[P[2]||(P[2]=e.createElementVNode("div",{class:"loader"},null,-1)),e.createElementVNode("span",null,e.toDisplayString(x.value)+"%",1)])):(e.openBlock(),e.createBlock(e.unref(j.Plus),{key:1,class:"h-4 w-4"}))],2))]),l.value&&!n.value?(e.openBlock(),e.createElementBlock("div",Zl,[e.createElementVNode("div",Jl,[e.createElementVNode("div",Ql,[e.createElementVNode("div",ea,e.toDisplayString(l.value.name),1),e.createElementVNode("div",ta,e.toDisplayString(b(l.value.size)),1)]),e.createElementVNode("div",na,e.toDisplayString(g.value),1)]),e.createElementVNode("div",ra,[e.createElementVNode("div",{class:"h-full rounded-full bg-blue-500 transition-all duration-300",style:e.normalizeStyle({width:`${x.value}%`})},null,4)]),e.createElementVNode("div",oa,[!c.value&&s.value>0&&s.value<(l.value?.size||0)?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:$}," Resume ")):e.createCommentVNode("",!0),c.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:B}," Pause ")):e.createCommentVNode("",!0),!c.value&&s.value===0?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",class:"rounded border border-slate-300 px-3 py-1",onClick:I}," Upload ")):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"rounded border border-rose-200 px-3 py-1 text-rose-600",onClick:S}," Cancel ")]),i.value?(e.openBlock(),e.createElementBlock("p",la,e.toDisplayString(i.value),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]))}}),Nn=me(aa,[["__scopeId","data-v-62ba7299"]]),sa={class:"flex items-center justify-center h-[30px] w-[30px]"},ia={class:"max-w-[55vw]"},ca={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},da={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},ua={class:"px-[5px]"},pa={class:""},Kt=e.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(r){const t=r,n=e.computed(()=>{try{return new Date(t.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function o(l){if(l<1024)return`${l} B`;const a=l/1024;return a<1024?`${a.toFixed(2)} KB`:`${(a/1024).toFixed(2)} MB`}return(l,a)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",sa,[e.createVNode(e.unref(j.FileText),{class:"icon icon-tabler icons-tabler-outline icon-tabler-file h-4 w-4"})]),e.createElementVNode("div",ia,[e.createElementVNode("p",ca,e.toDisplayString(l.item?.uploaded_name),1),e.createElementVNode("p",da,[e.createElementVNode("span",null,e.toDisplayString(l.item?.username),1),e.withDirectives(e.createElementVNode("span",ua,"|",512),[[e.vShow,l.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(n.value),1),a[0]||(a[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",pa,e.toDisplayString(o(l.item?.size)),1)])])],64))}}),fa={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},ma={key:0,class:"flex w-full gap-x-3 items-center"},ha={key:1,class:"flex gap-x-3 w-full items-center"},ga={key:2,class:"flex gap-x-3 w-full items-center"},ya=["href"],ba={key:3,class:"flex gap-x-3 w-full items-center"},ka={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},xa={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"},wa={class:"inline-block"},_a={class:"inline-block"},va=e.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(r,{emit:t}){const n=r,o=t;function l(u){return["pdf","json"].includes(u.ext)}function a(u){return["ppt","pptx","doc","docx","xls","xlsx"].includes(u.ext)}function s(u){const h=document.createElement("a");h.setAttribute("download",u?.uploaded_name),h.href=u?.file_path,h.click()}async function c(){try{await fetch(`${n.prefix}/widget/file/${n.item.entity_id}/${n.item.file_id}`),o("update")}catch(u){console.error(u)}}function i(){o("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:c,updateListOnConfirm:!0})}function d(u){(n.item.ext==="jpg"||n.item.ext==="png")&&o("openLightbox",{item:n.item,index:u})}return(u,h)=>(e.openBlock(),e.createElementBlock("div",fa,[u.item.ext==="jpg"||u.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",ma,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:h[0]||(h[0]=x=>d(u.index))},[e.createVNode(Kt,{item:u.item},null,8,["item"])])])):l(u.item)?(e.openBlock(),e.createElementBlock("div",ha,[e.createVNode(Kt,{item:u.item},null,8,["item"])])):a(u.item)?(e.openBlock(),e.createElementBlock("div",ga,[e.createElementVNode("a",{href:`/api/file-preview?id=${u.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(Kt,{item:u.item},null,8,["item"])],8,ya)])):(e.openBlock(),e.createElementBlock("div",ba,[e.createVNode(Kt,{item:u.item},null,8,["item"])])),e.createElementVNode("div",ka,[e.createElementVNode("div",xa,[e.createElementVNode("div",wa,[e.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:h[1]||(h[1]=x=>s(u.item))},[e.createVNode(e.unref(j.Download),{class:"h-4 w-4"})])]),h[3]||(h[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",_a,[e.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:h[2]||(h[2]=x=>i())},[e.createVNode(e.unref(j.Trash2),{class:"h-4 w-4"})])])])])]))}}),Ca={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},Ea={class:"flex w-full mb-[12px] items-center gap-x-2"},Ba={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},Va={class1:"ml-auto"},Sa={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"},$a={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},Na={class:"relative"},Aa={class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},Fa={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"},Ma={key:0},dr=e.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update"],setup(r,{emit:t}){const n=r,o=e.inject("form"),l=e.computed(()=>o.value.formId),a=e.ref(!1),s=e.ref(0),c=t,i=e.ref(!1),d=e.ref({}),u=e.ref([]),h=e.ref(""),x=e.computed(()=>Array.isArray(u.value)?u.value.filter(k=>k.ext==="jpg"||k.ext==="png").map(k=>k?.file_path):[]),g=e.computed(()=>h.value===""?u.value:u.value.filter(k=>k?.uploaded_name?.includes(h.value))),m=k=>{const C=x.value.findIndex(E=>E===k.item.file_path);C!==-1&&(a.value=!0,s.value=C)},f=async()=>{try{const k=await fetch(`${n.prefix}/widget/file/${l.value}`).then(C=>C.json());u.value=k?.rows}catch(k){console.error(k)}},b=async k=>{await Promise.all(Array.from(k.target.files).map(async C=>{const E=new FormData;E.append("file",C);try{const I=`${n.prefix}/widget/file/${l.value}`,A=await fetch(I,{method:"POST",body:E});return A.ok?(c("update","file-list"),C):(ue.notify({type:A.status>=400&&A.status<500?"warning":"error",title:"Error",message:`Error code: ${A.status}`}),null)}catch(I){return ue.notify({type:"error",title:"Error",message:I.message||"Unknown error"}),console.error(I),null}})),await f()},w=k=>{const C={...k};return k.cancel||(C.cancel=()=>{i.value=!1}),k.updateListOnConfirm&&(C.confirm=async()=>{await k.confirm(),i.value=!1,f()}),C},_=k=>{d.value=w(k),i.value=!0};return e.watch(l,k=>{k&&f()}),e.onMounted(()=>{l.value&&f()}),(k,C)=>{const E=e.resolveComponent("Lightbox"),I=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",Ca,[e.createElementVNode("div",Ea,[e.createElementVNode("h2",Ba," Файлів: "+e.toDisplayString(u.value?.length),1),e.createElementVNode("div",Va,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:C[0]||(C[0]=A=>b(A))},null,32),e.createElementVNode("div",Sa,[e.createVNode(e.unref(j.Upload),{class:"h-4 w-4"})])])])]),u.value?.length>4?(e.openBlock(),e.createElementBlock("div",$a,[e.createElementVNode("div",null,[e.createElementVNode("div",Na,[e.createElementVNode("div",Aa,[e.createVNode(e.unref(j.Search),{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400"})]),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":C[1]||(C[1]=A=>h.value=A),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[e.vModelText,h.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),u.value?.length?(e.openBlock(),e.createElementBlock("div",Fa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(A,B)=>(e.openBlock(),e.createBlock(va,{key:B,prefix:k.prefix,item:A,index:B,onUpdate:C[2]||(C[2]=$=>k.$emit("update","file-list")),onOpenModal:C[3]||(C[3]=$=>_($)),onOpenLightbox:C[4]||(C[4]=$=>m($))},null,8,["prefix","item","index"]))),128)),g.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Ma,C[8]||(C[8]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):e.createCommentVNode("",!0),e.createVNode(E,{modelValue:a.value,"onUpdate:modelValue":C[5]||(C[5]=A=>a.value=A),startIndex:s.value,"onUpdate:index":C[6]||(C[6]=A=>s.value=A),images:x.value},null,8,["modelValue","startIndex","images"]),e.createVNode(I,e.mergeProps({modelValue:i.value,"onUpdate:modelValue":C[7]||(C[7]=A=>i.value=A),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),Da={class:"flex items-center justify-between"},La={class:"text-[16px] text-gray-900 font-medium"},Ta={class:"grid gap-3"},Ia=me(e.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(r){const t=r,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,o=>{n.value=o}),(o,l)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Da,[e.createElementVNode("p",La,e.toDisplayString(r.title),1),e.createVNode(vn,{modelValue:n.value,"onUpdate:modelValue":l[0]||(l[0]=a=>n.value=a),style:e.normalizeStyle(r.style)},null,8,["modelValue","style"])]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Ta,[e.renderSlot(o.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),Ra={class:"text-[16px] text-gray-900 font-medium"},Oa={class:"grid gap-3"},za=me(e.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(r){const t=r,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,o=>{n.value=o}),(o,l)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("button",{type:"button",onClick:l[0]||(l[0]=a=>n.value=!n.value),class:"flex items-center gap-2"},[e.createVNode(e.unref(j.ChevronDown),{class:e.normalizeClass(["h-4 w-4 duration-300",[n.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",Ra,e.toDisplayString(r.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Oa,[e.renderSlot(o.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-0c825d65"]]),Pa={class:"flex items-center justify-between"},ja={switcher:Ia,accordion:za,default:e.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(r){return(t,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Pa,[e.createElementVNode("p",null,e.toDisplayString(r.title),1)]),e.renderSlot(t.$slots,"default")]))}})},Xe={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Ua=(r,t)=>String(r)===String(t),Ha=(r,t)=>String(r)!==String(t),qa=(r,t)=>r>t,Ga=(r,t)=>r>=t,Ka=(r,t)=>r<t,Wa=(r,t)=>r<=t,Ya=(r,t)=>Array.isArray(t)&&t.length===2?r>=t[0]&&r<=t[1]:!1,Xa=(r,t)=>String(r).startsWith(String(t)),Za=(r,t)=>String(r).endsWith(String(t)),Ja=(r,t)=>String(r).includes(String(t)),Qa=(r,t)=>Array.isArray(t)?t.includes(r):!1,es=(r,t)=>Array.isArray(t)?!t.includes(r):!0,ur=(r,t)=>{if(!t)return!0;switch(t?.[1]){case Xe.Equal:return Ua(r,t?.[2]);case Xe.Inequal:return Ha(r,t?.[2]);case Xe.Higer:return qa(r,t?.[2]);case Xe.HigerOrEqual:return Ga(r,t?.[2]);case Xe.Lower:return Ka(r,t?.[2]);case Xe.LowerOrEqual:return Wa(r,t?.[2]);case Xe.Between:return Ya(r,t?.[2]);case Xe.StartWith:return Xa(r,t?.[2]);case Xe.EndWith:return Za(r,t?.[2]);case Xe.Contain:return Ja(r,t?.[2]);case Xe.In:return Qa(r,t?.[2]);case Xe.NotIn:return es(r,t?.[2]);default:return!0}},pr=e.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(r){const t=r,n=e.inject("values",e.ref({})),o=e.inject("form"),l=e.computed(()=>t.schema?.filter(c=>{const i=c?.conditions;if(!i)return!0;const d=Array.isArray(i)?i[0]:i,u=t.name?n.value?.[t.name]?.[d]??n.value?.[d]:n.value?.[d];return ur(u,i)})),a=e.computed(()=>ja[t.view]),s=e.computed(()=>{if(n.value||(n.value={}),!t.name)return n.value;const c=n.value[t.name];if(c)return c;const i={};return n.value={...n.value,[t.name]:i},i});return(c,i)=>r.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),{key:0,title:r.title,style:e.normalizeStyle(r.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,d=>(e.openBlock(),e.createBlock(Mr,e.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:s.value[d.name],"onUpdate:modelValue":u=>s.value[d.name]=u,style:r.style,error:e.unref(o)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),ts=["aria-expanded","data-focus"],ns={class:"relative flex flex-1 items-center gap-1 py-0.5 pl-1 pr-0 overflow-hidden h-full min-w-0"},rs={key:0,class:"flex flex-nowrap items-center gap-1 overflow-x-auto overflow-y-hidden min-w-0 flex-1 py-0.5"},os={class:"flex items-center gap-1 min-w-0"},ls=["title"],as=["innerHTML"],ss=["onClick"],is={class:"flex-1 min-w-[2px]"},cs=["placeholder"],ds=["title"],us=["innerHTML"],ps={key:3,class:"truncate flex-1 min-w-0"},fs={key:2,class:"flex-1 min-w-[2px]"},ms=["placeholder"],hs={class:"flex items-center shrink-0"},gs=["disabled"],ys={key:1,class:"self-stretch w-px bg-[#ccc] my-[1px]"},bs=["disabled","title"],ks=["aria-disabled","onClick"],xs=["innerHTML"],ws={key:1,class:"px-3 py-2 text-center text-gray-500"},_s=["disabled"],An="w-[16px] h-[16px] flex items-center justify-center flex-shrink-0 text-current",Fn=me(e.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},start:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{},maxlength:{},minlength:{}},emits:["change","update:modelValue","value-selected"],setup(r,{emit:t}){const n=r,o=t,l=e.computed(()=>n.multiple),a=e.computed(()=>n.disabled);Ie(n.style);const s=e.computed({get:()=>n.modelValue,set:R=>o("update:modelValue",R)});!s.value&&n.defaultValue&&(s.value=n.defaultValue);const c=e.ref(null),i=e.ref(null),d=e.ref(null),u=e.ref(null),h=e.ref(!1),x=e.ref(!1),g=e.ref(null),m=e.ref([]),f=e.ref(-1),b=e.ref([]),w=e.ref(""),_=e.ref(null),k=e.ref("bottom"),C=e.ref({}),E=e.ref([]),I=e.computed(()=>{if(!E.value.length)return[];const R=m.value,Y=new Map(R.map(q=>[q.id?.toString(),q]));return E.value.map(q=>Y.get(q?.toString())).filter(q=>!!q)}),A=e.computed(()=>n.placeholder||"Select..."),B=e.computed(()=>W(g.value));e.computed(()=>l.value?!E.value.length&&w.value==="":!B.value&&w.value==="");const $=e.computed(()=>a.value?!1:l.value?E.value.length>0:!!s.value),S=R=>l.value?E.value.some(Y=>Y?.toString()===R?.toString()):s.value?.toString()===R?.toString(),L=e.computed(()=>{let R=m.value??[];if(!n.data&&w.value.trim()!==""){const Y=w.value.toLowerCase();R=R.filter(q=>{const se=W(q).toLowerCase(),xe=q.text?.toLowerCase?.()||"";return se.includes(Y)||xe.includes(Y)})}if(l.value&&E.value.length){const Y=new Set(E.value.map(q=>q?.toString()));R=R.filter(q=>!Y.has(q.id?.toString()))}return R}),F=e.inject("values"),P=e.inject("field-props"),M=/\{\{\s*([^}]+?)\s*\}\}/g,O=R=>(R?String(R):"").replace(/<[^>]*>/g,"").trim(),T=e.computed(()=>n.slot??n?.optionTemplate??""),G=R=>{if(!R)return"";const Y=T.value;return Y?Y.replace(M,(q,se)=>{const xe=se.trim(),be=R[xe];return be!=null?String(be):""}):R.text??""},W=R=>{if(!R)return"";if(!T.value)return R.text??"";const q=G(R);return O(q)||R.text||""},X=R=>R?R.icon??null:null,ne=R=>!!(R?.color&&!X(R)),we=R=>R?.color?{color:R.color}:void 0,ge=R=>!!X(R),J=(R,Y,q)=>{if(!P)return!1;const se=P.value?.[R]??{},xe=(ve,Ne,Ee)=>{if(!Ne.length)return ve;const[ze,...je]=Ne,We={...ve};if(!je.length)return We[ze]=Ee,We;const $t=typeof ve[ze]=="object"&&ve[ze]!==null?ve[ze]:{};return We[ze]=xe($t,je,Ee),We},be=xe(se,Y,q);return P.value={...P.value||{},[R]:be},!0},re=R=>{if(!n.set)return;const Y=F?.value;!Y&&!P||Object.entries(n.set).forEach(([q,se])=>{if(!q)return;const xe=R?R[se]:null,be=q.split(".").map(Ee=>Ee.trim()).filter(Boolean);if(!be.length)return;const[ve,...Ne]=be;Ne.length&&J(ve,Ne,xe??null)||Y&&(Y[ve]=xe??null)})},de=e.computed(()=>n.parent?F?.value?.[n.parent]?.toString()??null:null),ce=async R=>{if(!n.data){let Y=n.options??[];if(R?.trim()){const q=R.toLowerCase();Y=Y.filter(se=>{const xe=W(se).toLowerCase(),be=se.text?.toLowerCase?.()||"";return xe.includes(q)||be.includes(q)})}return Y}try{const Y=n.host??"",q=n.prefix??"api",se=n.api??`/${q}/suggest/${n.data}`,xe=`${Y}${se}`,be=new URLSearchParams;return be.set("json","1"),R&&be.set("key",R),de.value!==void 0&&de.value!==null&&de.value!==""&&be.set("parent",de.value),n.start===1&&be.set("start","1"),(await fetch(`${xe}?${be.toString()}`).then(Ne=>Ne.json()))?.data??[]}catch{return[]}},ye=async()=>{n.data?m.value=await ce(w.value):m.value=n.options?[...n.options]:[]},Le=async R=>{if(R==null||R==="")return null;const Y=m.value?.find(q=>q?.id?.toString()===String(R));if(Y)return Y;if(n.data)try{const q=n.host??"",se=n.prefix??"api",xe=n.api??`/${se}/suggest/${n.data}`,be=`${q}${xe}`,ve=new URLSearchParams;return ve.set("json","1"),ve.set("val",String(R)),de.value!==void 0&&de.value!==null&&de.value!==""&&ve.set("parent",de.value),n.start===1&&ve.set("start","1"),((await fetch(`${be}?${ve.toString()}`).then(ze=>ze.json()))?.data??[])?.[0]??null}catch{return null}return null},$e=async R=>{const Y=new Set(m.value.map(se=>se.id?.toString())),q=R.filter(se=>!Y.has(se?.toString()));q.length&&await q.reduce(async(se,xe)=>{await se;const be=await Le(xe);be&&m.value.push(be)},Promise.resolve())},tt=()=>{if(!L.value.length){f.value=-1;return}let R=0;if(!l.value&&g.value){const Y=g.value.id?.toString(),q=L.value.findIndex(se=>se.id?.toString()===Y);q>=0&&(R=q)}f.value=R,e.nextTick(()=>{_e(b.value[R],d.value)})},it=async()=>{a.value||(h.value=!0,await ye(),await e.nextTick(()=>{Q(),_.value?.focus()}),tt())},Re=()=>{h.value=!1,f.value=-1,e.nextTick(()=>{_.value?.blur()})},Be=async R=>{if(a.value)return;!h.value?await it():Re()},U=async()=>{if(!a.value){if(h.value){Re();return}await it()}},Z=()=>{l.value?(E.value=[],s.value=[],o("change",[]),ae(null,[])):(g.value=null,s.value=null,o("change",null),ae(null,null)),re(null),w.value="",e.nextTick(()=>_.value?.focus())},ee=R=>{l.value&&(E.value=E.value.filter(Y=>Y?.toString()!==R?.toString()),s.value=[...E.value],o("change",s.value),ae(null),e.nextTick(()=>_.value?.focus()))},ae=(R,Y)=>{const q=Y??(l.value?[...E.value]:R?.id??null);o("value-selected",{name:n.name,value:q,option:R})},ie=R=>{l.value?(S(R.id)||(E.value=[...E.value,R.id],s.value=[...E.value],o("change",s.value),ae(R)),w.value="",e.nextTick(()=>{_.value?.focus(),f.value=Math.min(f.value,L.value.length-1)}),re(null)):(g.value=R,s.value=R.id,o("change",s.value),ae(R),w.value="",Re(),re(R))},Ce=R=>{if(S(R.id)){l.value||Re();return}ie(R)},_e=(R,Y)=>{if(!R||!Y)return;const q=R.offsetTop,se=q+R.offsetHeight,xe=Y.scrollTop,be=xe+Y.clientHeight;let ve=Y.scrollTop;q<xe?ve=q-80:se>be&&(ve=se-Y.clientHeight+4);const Ne=Y;Ne.scrollTop=ve},z=R=>{let Y=R.parentElement;for(;Y;){if(Y.classList.contains("ui-dialog__content"))return Y;const q=window.getComputedStyle(Y),se=q.overflow+q.overflowY+q.overflowX;if(se.includes("auto")||se.includes("scroll")||Y===document.body||Y===document.documentElement)return Y;Y=Y.parentElement}return document.body},Q=()=>{if(!i.value)return;const R=i.value.getBoundingClientRect(),Y=window.innerHeight||document.documentElement.clientHeight,q=window.innerWidth||document.documentElement.clientWidth,se=8,xe=8,be=n.maxHeight||300,ve=Y-R.bottom-xe-se,Ne=R.top-xe-se,Ee=ve>=Ne,ze=Math.max(q-se*2,0);let{width:je}=R;ze>0&&je>ze&&(je=ze);let{left:We}=R;We+je+se>q&&(We=q-je-se),We=Math.max(We,se);const $t=Math.min(be,Math.max(Ee?ve:Ne,50));k.value=Ee?"bottom":"top",C.value={position:"fixed",left:`${We}px`,width:`${je}px`,maxHeight:`${$t}px`,transform:Ee?"none":"translateY(-100%)",top:Ee?`${R.bottom+xe}px`:`${R.top-xe}px`}},D=async R=>{a.value||!h.value&&(R.key==="ArrowDown"||R.key==="ArrowUp")&&(R.preventDefault(),await it())},K=R=>{if(!h.value)return;const{key:Y}=R;if(Y==="ArrowDown")R.preventDefault(),f.value+1<L.value.length&&(f.value+=1,_e(b.value[f.value],d.value));else if(Y==="ArrowUp")R.preventDefault(),f.value>0&&(f.value-=1,_e(b.value[f.value],d.value));else if(Y==="Enter"){R.preventDefault();const q=L.value[f.value];q&&ie(q),_.value?.blur()}else Y==="Escape"?(R.preventDefault(),Re()):Y==="Backspace"?l.value&&w.value===""&&E.value.length&&(E.value=E.value.slice(0,-1),s.value=[...E.value],o("change",s.value)):Y==="Home"?(f.value=0,_e(b.value[0],d.value)):Y==="End"?(f.value=L.value.length-1,_e(b.value[f.value],d.value)):Y==="Tab"&&Re()},ke=()=>{a.value||(x.value=!0)},Ze=()=>{x.value=!1,w.value=""},Oe=R=>{R.key==="Escape"&&h.value&&Re()},Ve=R=>{const Y=R.target;c.value?.contains(Y)||u.value?.contains(Y)||Re()},nt=R=>{h.value&&d.value&&!d.value.contains(R.target)&&Q()},rt=()=>{h.value&&Q()},Je=()=>{h.value&&Q()};e.watch(()=>n.options,R=>{R?.length&&(m.value=[...R],Te())},{immediate:!0});async function Te(){if(l.value)Array.isArray(s.value)?E.value=[...s.value]:(E.value=s.value==null?[]:[s.value],s.value=[...E.value]),n.data&&E.value.length&&(await $e(E.value),await e.nextTick());else{if(Array.isArray(s.value)){const R=s.value[0]??null;s.value=R??null}s.value!=null&&(g.value=await Le(s.value)),re(g.value??null)}}e.watch(s,()=>{Te()}),e.onMounted(async()=>{addEventListener("keydown",Oe),addEventListener("scroll",nt,!0),addEventListener("resize",rt),document.addEventListener("click",Ve,!0),i.value&&z(i.value).addEventListener("scroll",Je,!0),n.options?.length&&!n.data?m.value=[...n.options]:n.data&&(m.value=await ce("")),await Te(),bn.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",Oe),removeEventListener("scroll",nt,!0),removeEventListener("resize",rt),document.removeEventListener("click",Ve,!0),i.value&&z(i.value).removeEventListener("scroll",Je,!0)});const kt=e.ref(!1),Ut=e.ref({}),Ht=e.ref([]),gn=e.ref(null);async function Jn(){if(!(!n.add?.token||gn?.value.validate()))try{const Y=n.add.api??`/api/table/${n.add.token}`,q=await fetch(Y,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ut.value)}),se=await q.json().catch(()=>({})),xe=se?.error||se?.message,be=Number(se?.code)>=400;if(!q.ok||be){ue.notify({title:"Помилка",type:"error",message:xe||`Код помилки: ${se?.code||q.status}`});return}const ve=se?.id;if(!ve){ue.notify({title:"Помилка",type:"error",message:"Обʼєкт створено, але в відповіді відсутній ID."});return}if(!n.options?.length&&n.data){const Ne=await fetch(`${n.api??`/api/suggest/${n.data}`}?val=${ve}`).then(Ee=>Ee.json());g.value=Ne[0],m.value.push(Ne[0]),s.value=ve}kt.value=!1,ue.notify({title:"Успіх",message:"Обʼєкт успішно створено."})}catch(Y){ue.notify({title:"Помилка",type:"error",message:Y?.message||"Не вдалося створити обʼєкт."})}}async function xt(){if(!n.add)return null;const R=await fetch(`/api/template/form/${n.add.form}`).then(Y=>Y.json());return Ht.value=R.schema,kt.value=!0,null}function Qn(R,Y=200){let q;return(...se)=>{q&&clearTimeout(q),q=window.setTimeout(()=>R(...se),Y)}}const yn=Qn(async R=>{m.value=await ce(R)},200);e.watch(w,R=>{n.data&&yn(R.trim())}),e.watch(()=>n.options,R=>{!n.data&&R?.length&&(m.value=[...R],Te())},{immediate:!0}),e.watch(()=>n.parent??n.parentValue,()=>{n.data&&ye()});const bn=e.ref(!0);return e.watch(de,async()=>{if(n.data&&(bn.value||(l.value?(E.value=[],s.value=[],o("change",[])):(g.value=null,s.value=null,o("change",null))),await ye(),n.auto===1&&de.value&&m.value.length>0)){const R=m.value[0];R&&ie(R)}}),(R,Y)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(ue.VsModal),{visible:kt.value,"onUpdate:visible":Y[1]||(Y[1]=q=>kt.value=q),class:"z-[1000]",title:"Додати",buttonText:"Додати",onDone:Jn,teleport:R.teleport},{default:e.withCtx(()=>[e.createVNode(Qe,{schema:Ht.value,modelValue:Ut.value,"onUpdate:modelValue":Y[0]||(Y[0]=q=>Ut.value=q),ref_key:"addForm",ref:gn},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:c,onClick:Y[5]||(Y[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass])},[Y[6]||(Y[6]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),Y[7]||(Y[7]=e.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["vs-input-select__control flex min-h-[38px] items-center justify-between rounded transition-colors bg-white",a.value?"bg-gray-100 text-gray-400 cursor-not-allowed":""]),role:"combobox","aria-expanded":h.value,"aria-haspopup":"listbox",onKeydown:D,onClick:U,"data-focus":h.value||x.value?"true":"false",ref_key:"triggerRef",ref:i},[e.createElementVNode("div",ns,[l.value?(e.openBlock(),e.createElementBlock("div",rs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(I.value,q=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[rgb(230,230,230)] rounded-[2px] m-[2px] box-border max-w-full",key:q.id},[e.createElementVNode("div",os,[ne(q)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:e.normalizeStyle({backgroundColor:q?.color})},null,4)):e.createCommentVNode("",!0),!T.value&&ge(q)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(An),style:e.normalizeStyle(we(q)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(X(q)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"truncate text-[#172b4d] overflow-hidden max-w-[200px] px-0.5 pl-1.5",title:W(q)},[T.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:G(q)},null,8,as)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(q.text),1)],64))],8,ls)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border text-[#172b4d] hover:bg-[rgb(255,189,173)] hover:text-[rgb(222,53,11)] flex-shrink-0",onClick:e.withModifiers(se=>ee(q.id),["stop"])},[e.createVNode(e.unref(j.X),{"aria-hidden":"true",focusable:"false",class:"inline-block h-4 w-4"})],8,ss)]))),128)),e.createElementVNode("div",is,[!a.value&&R.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:_,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900 hover:cursor-pointer",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:E.value.length?" ":A.value,"onUpdate:modelValue":Y[2]||(Y[2]=q=>w.value=q),onFocus:ke,onBlur:Ze,onKeydown:K},null,40,cs)),[[e.vModelText,w.value]]):e.createCommentVNode("",!0)])])):!l.value&&B.value&&w.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900 absolute inset-x-0 pl-2 flex items-center gap-1 min-w-0"]),title:B.value},[ne(g.value)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block flex-shrink-0",style:e.normalizeStyle({backgroundColor:g.value?.color})},null,4)):e.createCommentVNode("",!0),!T.value&&ge(g.value)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(An),style:e.normalizeStyle(we(g.value)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(X(g.value)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),T.value?(e.openBlock(),e.createElementBlock("span",{key:2,class:"truncate flex-1 min-w-0",innerHTML:G(g.value)},null,8,us)):(e.openBlock(),e.createElementBlock("span",ps,e.toDisplayString(g.value?.text),1))],8,ds)):e.createCommentVNode("",!0),l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",fs,[!a.value&&R.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:_,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900 hover:cursor-pointer",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:B.value?" ":A.value,"onUpdate:modelValue":Y[3]||(Y[3]=q=>w.value=q),onFocus:ke,onBlur:Ze,onKeydown:K},null,40,ms)),[[e.vModelText,w.value]]):e.createCommentVNode("",!0)]))]),e.createElementVNode("div",hs,[$.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:a.value,onClick:e.withModifiers(Z,["stop"])},[e.createVNode(e.unref(j.X),{class:"h-4 w-4"})],8,gs)):e.createCommentVNode("",!0),$.value?(e.openBlock(),e.createElementBlock("div",ys)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:a.value,onClick:Y[4]||(Y[4]=e.withModifiers(q=>Be(),["stop"])),title:h.value?"Закрити список":"Відкрити список"},[e.createVNode(e.unref(j.ChevronDown),{class:"h-4 w-4"})],8,bs)])],42,ts),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[h.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:e.normalizeClass(["fixed z-[3000] rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]"]),style:e.normalizeStyle(C.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:C.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[L.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(L.value,(q,se)=>(e.openBlock(),e.createElementBlock("div",{key:q.id,ref_for:!0,ref:xe=>b.value[se]=xe,class:e.normalizeClass(["flex px-3 py-2 gap-2 cursor-pointer select-none text-gray-900",S(q.id)?"bg-[#2684ff] text-white":"bg-white hover:bg-[#deebff] hover:text-[#172b4d]",f.value===se&&!S(q.id)?"bg-[#deebff] text-[#172b4d]":""]),"aria-disabled":S(q.id)?"true":"false",role:"option",tabindex:"-1",onClick:xe=>Ce(q)},[ne(q)?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block flex-shrink-0",style:e.normalizeStyle({backgroundColor:q?.color})},null,4)):e.createCommentVNode("",!0),!T.value&&ge(q)?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass(An),style:e.normalizeStyle(we(q)),"aria-hidden":"true"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(X(q)),{class:"w-full h-full",focusable:"false"}))],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",f.value===q.id?"text-white":"",(f.value===se,"")])},[T.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:G(q)},null,8,xs)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(q.text),1)],64))],2)],10,ks))),128)):(e.openBlock(),e.createElementBlock("div",ws," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),n.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:xt,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:a.value,type:"button"},[e.createVNode(e.unref(j.Plus),{class:"h-4 w-4"}),Y[8]||(Y[8]=e.createElementVNode("span",null,"Додати",-1))],8,_s)):e.createCommentVNode("",!0)],512)],64))}}),[["__scopeId","data-v-4f31eacf"]]),vs=["placeholder","disabled"],fr=e.defineComponent({__name:"vs-input-textarea",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,{inputClass:n}=Ie(t.style),o=e.useModel(r,"modelValue"),l=e.computed(()=>!!t.disabled),a=e.computed(()=>t.placeholder??"");function s(){typeof o.value=="string"&&(o.value=o.value.trim())}return(c,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":i[0]||(i[0]=d=>o.value=d),placeholder:a.value,disabled:l.value,row:"2",onBlur:s,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,42,vs)),[[e.vModelText,o.value]])}}),mr=e.defineComponent({__name:"vs-input-richtext",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},format:{default:"html"},richtextProps:{default:()=>({})}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=e.defineAsyncComponent(()=>Promise.resolve().then(()=>rg)),n=r,{inputClass:o}=Ie(n.style),l=e.useModel(r,"modelValue"),a=e.computed(()=>!!n.disabled),s=e.computed(()=>n.placeholder??""),c=e.computed(()=>({height:"300px",format:n.format,...n.richtextProps}));return(i,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["!h-full",[i.customClass,e.unref(o)]]),style:e.normalizeStyle(a.value?{pointerEvents:"none",opacity:.6}:{})},[e.createVNode(e.unref(t),e.mergeProps({modelValue:l.value,"onUpdate:modelValue":d[0]||(d[0]=u=>l.value=u),placeholder:s.value},c.value),null,16,["modelValue","placeholder"])],6))}}),Cs={},Es={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Bs(r,t){return e.openBlock(),e.createElementBlock("svg",Es,t[0]||(t[0]=[e.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)]))}const Vs=me(Cs,[["render",Bs]]),Ss={class:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden flex flex-col"},$s={key:0,class:"flex flex-col gap-2 !p-4 border-b border-gray-200 sm:flex-row sm:items-center sm:justify-between bg-gray-50"},Ns={key:0,class:"relative w-full"},As={class:"flex flex-nowrap items-center justify-end gap-2 w-full overflow-x-auto"},Fs={class:"w-full overflow-x-auto"},Ms={class:"w-full min-w-[640px] table-auto divide-y divide-gray-200"},Ds={class:"bg-gray-50"},Ls={class:"border-b border-gray-200"},Ts={class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 w-12 text-center"},Is=["onClick"],Rs={key:0,class:"text-gray-400"},Os={key:0,colspan:"100%",class:"text-center"},zs={class:"w-full"},Ps={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},js=["onDragstart","onDragover","onDrop"],Us={class:"px-4 py-3 text-center align-middle"},Hs={class:"flex items-center justify-center"},qs=["innerHTML"],Gs={key:0,class:"flex items-center gap-3 text-sm text-gray-700"},Ks={key:0},Ws=["src"],Ys={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},Xs={key:1,class:"flex items-center justify-center"},Zs={key:2,class:"text-sm font-medium text-gray-900"},Js={class:"px-4 py-3 text-right whitespace-nowrap"},Qs={class:"flex items-center justify-end gap-2"},ei=["onClick"],ti=["onClick"],ni={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},hr=e.defineComponent({__name:"vs-input-datatable",props:e.mergeModels({actions:{},colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useSlots(),o=U=>t.actions===void 0?!0:t.actions.includes(U),l=["search","import","export","add"],a=e.computed(()=>l.some(U=>o(U))),s=e.useModel(r,"modelValue"),c=e.ref({}),i=e.ref(""),d=e.ref(null),u=e.ref("asc"),h=e.computed(()=>{const U=s.value??[],Z=i.value?U.filter(ie=>x.value?.some(Ce=>{const _e=Ce.key||Ce.name;if(!_e)return!1;const z=ie[_e];return z?Array.isArray(z)?z.join(", ").toLowerCase().includes(i.value.toLowerCase()):String(z).toLowerCase().includes(i.value.toLowerCase()):!1})):U;if(!d.value)return Z;const ee=d.value,ae=[...Z].sort((ie,Ce)=>{const _e=re(ie?.[ee]),z=re(Ce?.[ee]);return typeof _e=="number"&&typeof z=="number"?_e-z:String(_e).localeCompare(String(z))});return u.value==="asc"?ae:ae.reverse()}),x=e.computed(()=>(t.colModel??[]).filter(U=>!U.tableHidden)),g=e.ref(null),m=e.ref(null),f=e.ref(null),b=U=>{g.value=U},w=U=>{m.value=U},_=U=>{if(g.value===null||g.value===U){g.value=null,m.value=null;return}const Z=[...s.value],[ee]=Z.splice(g.value,1);Z.splice(U,0,ee),s.value=Z,g.value=null,m.value=null},k=()=>{f.value&&f.value.click()},C=U=>{const Z=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],ee=U.toLowerCase();return Z.some(ae=>ee.endsWith(ae))},E=U=>{const ee=U.target.files?.[0];if(!ee)return;const ae=new FileReader;ae.onload=ie=>{try{const Ce=ie.target?.result;if(typeof Ce=="string"){const _e=JSON.parse(Ce);Array.isArray(_e)&&s.value.push(..._e)}}catch(Ce){console.error("Error parsing file:",Ce)}},ae.readAsText(ee)},I=()=>{const U=JSON.stringify(s.value,null,2),Z=new Blob([U],{type:"application/json"}),ee=URL.createObjectURL(Z),ae=document.createElement("a");ae.href=ee,ae.download="data.json",ae.click(),URL.revokeObjectURL(ee)},A=new Set(["autocomplete","select","radio","checkbox","combobox"]),B=new Map,$=(U,Z)=>{const ee=`/api/suggest/${U}`,ae=ee.includes("?")?"&":"?",ie=Z?`&val=${Z}`:"";return`${ee}${ae}json=1${ie}`},S=U=>U==null||U===""?null:typeof U=="object"?U?.id!==void 0&&U.id!==null&&U.id!==""?U.id:null:U,L=U=>{const Z=new Set;return Array.isArray(s.value)&&s.value.forEach(ee=>{const ae=ee?.[U];if(ae==null||ae==="")return;if(Array.isArray(ae)){ae.forEach(Ce=>{const _e=S(Ce);_e!==null&&Z.add(_e)});return}const ie=S(ae);ie!==null&&Z.add(ie)}),Z},F=async()=>{if(!t.colModel?.length)return;const U=t.colModel.filter(Z=>Z.data&&A.has(Z.type?.toLowerCase()||""));U.length&&await Promise.all(U.map(async Z=>{const ee=Z.key||Z.name;if(!ee)return;const ae=L(ee),ie=Array.from(ae).map(z=>String(z)).sort(),Ce=ie.join(",");if(!ie.length||B.get(ee)===Ce)return;B.set(ee,Ce);const _e=ie.map(encodeURIComponent).join(",");try{const Q=await(await fetch($(Z.data,_e))).json();c.value[ee]=Q?.data??Q}catch(z){console.error("Failed to fetch column values",z)}}))};e.watch([()=>t.colModel,()=>s.value],()=>{F()},{immediate:!0,deep:!0});const P=e.ref(""),M=e.ref(!1);let O="edit",T=0;const G=U=>(U?.format||U?.type||"").toString().toLowerCase(),W=e.computed(()=>t.colModel?.filter(U=>G(U)!=="slot").map(U=>{const{slot:Z,...ee}=U;return ee})??[]),X=e.ref({}),ne=e.ref({}),we=U=>typeof U!="string"?!1:!!n[U],ge=(U,Z)=>Z?Z.split(".").reduce((ee,ae)=>ee==null?ee:ee[ae.trim()],U):U,J=(U,Z)=>typeof U!="string"?"":U.replace(/{{\s*([^}]+)\s*}}/g,(ee,ae)=>{const ie=ge(Z,ae.trim());return ie??""}),re=U=>{if(U==null||U==="")return"";if(typeof U=="number")return U;if(typeof U=="boolean")return U?1:0;if(typeof U=="string")return U.toLowerCase();if(Array.isArray(U))return U.map(Z=>re(Z)).join(", ");if(typeof U=="object"){if(U.text!==void 0)return String(U.text).toLowerCase();if(U.label!==void 0)return String(U.label).toLowerCase();if(U.id!==void 0)return String(U.id).toLowerCase()}return String(U).toLowerCase()},de=U=>{const Z=U.key||U.name;if(Z){if(d.value===Z){u.value=u.value==="asc"?"desc":"asc";return}d.value=Z,u.value="asc"}};async function ce(){P.value="Додати",M.value=!0,O="add",X.value={}}function ye(U,Z){if(!U?.length)return null;const ee=typeof Z=="object"?Z?.id:Z;return ee==null||ee===""?null:U.find(ae=>ae?.id?.toString()===ee.toString())?.text??null}function Le(U){return U==null||U===""?"-":Array.isArray(U)?U.map(Z=>typeof Z=="object"?Z?.text??Z?.id??"-":Z).join(", "):typeof U=="object"?U?.text??U?.id??"-":U}function $e(U,Z){const ee=Z.key||Z.name,ae=U?.[ee],ie=c.value[ee];if(!ae)return"-";if(Array.isArray(ae)){const _e=ae.map(z=>ye(ie,z)).filter(Boolean);return _e.length?_e.join(", "):Le(ae)}const Ce=ye(ie,ae);return Ce||Le(ae)}async function tt(U,Z){P.value="Редагувати",M.value=!0,O="edit",T=Z,X.value={...U}}function it(){const U=ne.value.validate();if(U){ue.notify({type:"warning",title:"Помилка валідації",message:Object.entries(U).map(([Z,ee])=>`${Z}: ${ee}`).join(`
|
|
2
|
+
`)});return}O==="add"?Array.isArray(s.value)?s.value=[...s.value,X.value]:s.value=[X.value]:s.value=s.value.map((Z,ee)=>ee===T?X.value:Z),M.value=!1}function Re(U){s.value=s.value.filter((Z,ee)=>ee!==U)}function Be(){M.value=!1}return(U,Z)=>(e.openBlock(),e.createElementBlock("div",Ss,[a.value?(e.openBlock(),e.createElementBlock("div",$s,[o("search")?(e.openBlock(),e.createElementBlock("div",Ns,[e.createVNode(e.unref(j.Search),{class:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-gray-400"}),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":Z[0]||(Z[0]=ee=>i.value=ee),placeholder:"Пошук",class:"w-full rounded-md border border-gray-200 bg-white pl-10 pr-3 py-2 text-sm text-gray-900 placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100"},null,512),[[e.vModelText,i.value]])])):e.createCommentVNode("",!0),e.createElementVNode("div",As,[o("import")?(e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"fileInput",ref:f,onChange:E,class:"hidden",accept:".json",type:"file"},null,544)):e.createCommentVNode("",!0),o("import")?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",onClick:k,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[e.createVNode(e.unref(j.Upload),{class:"h-4 w-4 text-gray-700"}),Z[4]||(Z[4]=e.createTextVNode(" Імпорт ",-1))])):e.createCommentVNode("",!0),o("export")?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:I,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[e.createVNode(e.unref(j.Download),{class:"h-4 w-4 text-gray-700"}),Z[5]||(Z[5]=e.createTextVNode(" Експорт ",-1))])):e.createCommentVNode("",!0),o("add")?(e.openBlock(),e.createElementBlock("button",{key:3,onClick:ce,type:"button",class:"inline-flex items-center gap-2 rounded-md bg-blue-500 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-600 transition-colors"},[e.createVNode(e.unref(j.Plus),{class:"h-4 w-4 text-white"}),Z[6]||(Z[6]=e.createTextVNode(" Додати ",-1))])):e.createCommentVNode("",!0)])])):e.createCommentVNode("",!0),e.createElementVNode("div",Fs,[e.createElementVNode("table",Ms,[e.createElementVNode("thead",Ds,[e.createElementVNode("tr",Ls,[e.createElementVNode("th",Ts,[e.createVNode(e.unref(j.GripVertical),{class:"mx-auto h-4 w-4 text-gray-400"})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,ee=>(e.openBlock(),e.createElementBlock("th",{key:ee.key,class:"px-4 py-3 text-left text-xs font-semibold text-gray-900"},[e.createElementVNode("button",{type:"button",onClick:ae=>de(ee),class:"flex items-center gap-1 text-xs font-semibold text-gray-700 hover:text-gray-900 transition-colors"},[e.createElementVNode("span",null,e.toDisplayString(ee.ua||ee.label),1),d.value===(ee.key||ee.name)?(e.openBlock(),e.createElementBlock("span",Rs,e.toDisplayString(u.value==="asc"?"▲":"▼"),1)):e.createCommentVNode("",!0)],8,Is)]))),128)),Z[7]||(Z[7]=e.createElementVNode("th",{class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 text-center w-[1%] whitespace-nowrap"}," Дії ",-1))])]),e.createElementVNode("tbody",{class:e.normalizeClass(["divide-y divide-gray-200",{"[&_tr:last-child]:border-0":!m.value}])},[h.value.length===0?(e.openBlock(),e.createElementBlock("td",Os,[e.createElementVNode("div",zs,[e.createElementVNode("div",Ps,[e.createVNode(Vs,{class:"w-48 mx-auto"}),Z[8]||(Z[8]=e.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[e.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),e.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(ee,ae)=>(e.openBlock(),e.createElementBlock("tr",{key:ee.id,class:e.normalizeClass(["border-b transition-colors hover:bg-gray-50 cursor-move text-sm text-gray-700",{"opacity-50":g.value===ae,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":m.value===ae}]),draggable:"true",onDragstart:ie=>b(ae),onDragover:e.withModifiers(ie=>w(ae),["prevent"]),onDrop:ie=>_(ae)},[e.createElementVNode("td",Us,[e.createElementVNode("div",Hs,[e.createVNode(e.unref(j.GripVertical),{class:"mx-auto h-4 w-4 text-slate-400 dark:text-slate-500"})])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,ie=>(e.openBlock(),e.createElementBlock("td",{key:ie.key,class:"px-4 py-3 align-middle"},[G(ie)==="slot"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[we(ie.slot)?e.renderSlot(U.$slots,ie.slot,{key:0,row:ee,value:ee[ie.key],column:ie}):(e.openBlock(),e.createElementBlock("div",{key:1,class:"text-sm text-gray-900",innerHTML:J(ie.slot,ee)},null,8,qs))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[G(ie)==="file"?(e.openBlock(),e.createElementBlock("div",Gs,[C($e(ee,ie))?(e.openBlock(),e.createElementBlock("div",Ks,[e.createElementVNode("img",{src:$e(ee,ie),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,Ws)])):(e.openBlock(),e.createElementBlock("div",Ys,[e.createVNode(e.unref(j.FileText),{class:"h-4 w-4 min-w-4"})]))])):G(ie)==="color"?(e.openBlock(),e.createElementBlock("div",Xs,[e.createElementVNode("span",{class:"inline-flex h-6 w-6 rounded border border-gray-200",style:e.normalizeStyle({backgroundColor:$e(ee,ie)||"#ffffff"})},null,4)])):(e.openBlock(),e.createElementBlock("div",Zs,e.toDisplayString($e(ee,ie)),1))],64))]))),128)),e.createElementVNode("td",Js,[e.createElementVNode("div",Qs,[e.createElementVNode("button",{onClick:ie=>tt(ee,ae),class:"p-1.5 text-gray-600 hover:text-blue-600 hover:bg-blue-50 rounded transition-colors"},[e.createVNode(e.unref(j.Pencil),{class:"h-4 w-4"})],8,ei),e.createElementVNode("button",{onClick:ie=>Re(ae),class:"p-1.5 text-gray-600 hover:text-red-600 hover:bg-red-50 rounded transition-colors"},[e.createVNode(e.unref(j.Trash2),{class:"h-4 w-4"})],8,ti)])])],42,js))),128))],2)])]),e.createVNode(e.unref(ue.VsModal),{visible:M.value,title:P.value,size:"lg",onClose:Be,teleport:"#modal"},{default:e.withCtx(()=>[e.createVNode(Qe,{schema:W.value,values:X.value,"onUpdate:values":Z[1]||(Z[1]=ee=>X.value=ee),form:ne.value,"onUpdate:form":Z[2]||(Z[2]=ee=>ne.value=ee)},null,8,["schema","values","form"]),e.createElementVNode("div",ni,[e.createElementVNode("button",{type:"button",onClick:Z[3]||(Z[3]=ee=>M.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:it,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"])]))}}),ri={},oi={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 li(r,t){return e.openBlock(),e.createElementBlock("svg",oi,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const ai=me(ri,[["render",li]]),si={},ii={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-polygon"};function ci(r,t){return e.openBlock(),e.createElementBlock("svg",ii,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M6.5 9.5l3.5 -3"></path><path d="M14 5.5l3 1.5"></path><path d="M18.5 10l-2.5 7"></path><path d="M13.5 17.5l-7 -5"></path>',9)]))}const di=me(si,[["render",ci]]),ui={},pi={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function fi(r,t){return e.openBlock(),e.createElementBlock("svg",pi,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M8 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M6 8v8"></path><path d="M18 16v-8"></path><path d="M8 6h8"></path><path d="M16 18h-8"></path>',9)]))}const mi=me(ui,[["render",fi]]),hi={class:"bg-white/30 p-1 rounded-md shadow w-fit"},gi={class:"flex gap-2"},yi=["onClick","title"],bi=["src"],ki=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(r,{emit:t}){const n=r,o=e.ref(Object.keys(n.basemaps)[0]),l=t;function a(i){l("onLayerChange",i),o.value=i}const s={z:13,x:4790,y:2762};function c(i){if(i?.preview)return i.preview;if(!i?.url)return;const d={"{z}":s.z,"{x}":s.x,"{y}":s.y};let u=i.url;return Object.entries(d).forEach(([h,x])=>{u=u.replace(new RegExp(h,"gi"),String(x))}),u}return(i,d)=>(e.openBlock(),e.createElementBlock("div",hi,[e.createElementVNode("div",gi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.basemaps,(u,h)=>(e.openBlock(),e.createElementBlock("div",{key:h,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":o.value===h}]),onClick:x=>a(h),title:u.name||h,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:c(u),alt:"",class:"w-10 h-10 object-cover"},null,8,bi)],10,yi))),128))])]))}}),wt=1e-10,Wt=/([+-]?\d{1,3})\s*[°º˚]\s*(\d{1,2})\s*['’′`]\s*(\d{1,2}(?:\.\d+)?)\s*["”″]\s*([NSEW])/gi,xi=/^[+-]?\d+(?:\.\d+)?$/;function wi(r,t,n){const o=r.split(/\r?\n/).map(d=>d.trim()).filter(Boolean);if(o.length<3)return{ok:!1,errors:[{line:0,message:"Має бути щонайменше 3 рядки координат."}]};if(o.length>100)return{ok:!1,errors:[{line:0,message:"Допускається не більше 100 рядків координат."}]};const l=[],a=[];if(o.forEach((d,u)=>{const h=u+1,x=t==="decimal"?_i(d,h,n):yr(d,h,n);if(!x.ok){l.push(...x.errors);return}const g=a[a.length-1];if(g&&kr(g,x.point)){l.push({line:h,message:"Послідовні точки не повинні дублюватися."});return}a.push(x.point)}),l.length)return{ok:!1,errors:l};if(new Set(a.map(Ci)).size<3)return{ok:!1,errors:[{line:0,message:"Полігон повинен містити мінімум 3 унікальні точки."}]};const c=[...a];let i=!1;return kr(c[0],c[c.length-1])||(c.push(c[0]),i=!0),Ei(c)?{ok:!1,errors:[{line:0,message:"Полігон має самоперетин."}]}:{ok:!0,ring:c,wasClosedAutomatically:i}}function _i(r,t,n){return gr(r,"decimal",n,t)}function gr(r,t,n,o=1){return t==="decimal"?vi(r,o,n):yr(r,o,n)}function vi(r,t,n){const o=[];if(/[A-Za-zА-Яа-яІіЇїЄєҐґ]/.test(r))return{ok:!1,errors:[{line:t,message:"У десятковому форматі не допускаються літери."}]};const l=r.split(/[\s,;]+/).filter(Boolean);if(l.length<2)return{ok:!1,errors:[{line:t,message:"Кожен рядок має містити дві координати."}]};if(l.length>2)return{ok:!1,errors:[{line:t,message:"У рядку дозволено лише одну пару координат."}]};if(!l.every(d=>xi.test(d)))return{ok:!1,errors:[{line:t,message:"Не вдалося розпізнати десяткові координати."}]};const a=Number(l[0]),s=Number(l[1]);if(!Number.isFinite(a)||!Number.isFinite(s))return{ok:!1,errors:[{line:t,message:"Не вдалося розпізнати десяткові координати."}]};const c=n==="lat-lon"?a:s,i=n==="lat-lon"?s:a;return(c<-90||c>90)&&o.push({line:t,message:"Широта поза діапазоном (-90..90)."}),(i<-180||i>180)&&o.push({line:t,message:"Довгота поза діапазоном (-180..180)."}),o.length?{ok:!1,errors:o}:{ok:!0,point:[i,c]}}function yr(r,t,n){Wt.lastIndex=0;const o=[...r.matchAll(Wt)];if(o.length<2)return{ok:!1,errors:[{line:t,message:"Не вдалося розпізнати DMS-координати."}]};if(o.length>2)return{ok:!1,errors:[{line:t,message:"У рядку дозволено лише одну пару координат."}]};if(Wt.lastIndex=0,r.replace(Wt," ").replace(/[\s,;]+/g,"").trim().length)return{ok:!1,errors:[{line:t,message:"У рядку виявлено зайві символи або значення."}]};const a=br(o[0],t,n==="lat-lon"?"lat":"lon"),s=br(o[1],t,n==="lat-lon"?"lon":"lat"),c=[];if(a.ok||c.push(a.error),s.ok||c.push(s.error),c.length)return{ok:!1,errors:c};const i=n==="lat-lon"?a.value:s.value;return{ok:!0,point:[n==="lat-lon"?s.value:a.value,i]}}function br(r,t,n){const o=Number(r[1]),l=Number(r[2]),a=Number(r[3]),s=String(r[4]).toUpperCase();if(!Number.isFinite(o)||!Number.isFinite(l)||!Number.isFinite(a))return{ok:!1,error:{line:t,message:"Невірні значення DMS-координат."}};if(n==="lat"&&!(s==="N"||s==="S")||n==="lon"&&!(s==="E"||s==="W"))return{ok:!1,error:{line:t,message:n==="lat"?"Для широти напрям повинен бути N або S.":"Для довготи напрям повинен бути E або W."}};if(l<0||l>59)return{ok:!1,error:{line:t,message:"Хвилини повинні бути в діапазоні 0..59."}};if(a<0||a>60)return{ok:!1,error:{line:t,message:"Секунди повинні бути в діапазоні 0..60."}};const d=Math.abs(o),u=n==="lat"?90:180;if(d>u)return{ok:!1,error:{line:t,message:n==="lat"?"Градуси широти повинні бути в діапазоні 0..90.":"Градуси довготи повинні бути в діапазоні 0..180."}};if(d===u&&(l!==0||a!==0))return{ok:!1,error:{line:t,message:n==="lat"?"Для 90° широти хвилини й секунди мають бути 0.":"Для 180° довготи хвилини й секунди мають бути 0."}};const h=d+l/60+a/3600;return{ok:!0,value:s==="S"||s==="W"?-h:h}}function Ci(r){return`${r[0].toFixed(12)}:${r[1].toFixed(12)}`}function kr(r,t){return Math.abs(r[0]-t[0])<wt&&Math.abs(r[1]-t[1])<wt}function Ei(r){if(r.length<4)return!1;for(let t=0;t<r.length-1;t+=1){const n=r[t],o=r[t+1];for(let l=t+1;l<r.length-1;l+=1){if(Math.abs(t-l)<=1||t===0&&l===r.length-2)continue;const a=r[l],s=r[l+1];if(Bi(n,o,a,s))return!0}}return!1}function Bi(r,t,n,o){const l=Yt(r,t,n),a=Yt(r,t,o),s=Yt(n,o,r),c=Yt(n,o,t);return!!(l!==a&&s!==c||l===0&&Xt(r,n,t)||a===0&&Xt(r,o,t)||s===0&&Xt(n,r,o)||c===0&&Xt(n,t,o))}function Yt(r,t,n){const o=(t[1]-r[1])*(n[0]-t[0])-(t[0]-r[0])*(n[1]-t[1]);return Math.abs(o)<wt?0:o>0?1:2}function Xt(r,t,n){return t[0]<=Math.max(r[0],n[0])+wt&&t[0]+wt>=Math.min(r[0],n[0])&&t[1]<=Math.max(r[1],n[1])+wt&&t[1]+wt>=Math.min(r[1],n[1])}const Vi={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},Si={key:0,class:"vs-select__options absolute z-50 mt-1 w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm"},$i=["onClick"],Ni={class:"relative flex-1 min-w-[140px]"},Ai=["placeholder"],Fi={type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},Mi="https://data.softpro.ua/api-user/gis-url-proxy",Di="https://geo.rv.ua/api-user/dzk.api",Li=me(e.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(r,{emit:t}){const n=r,o=t,l=["here","xy","parcel"],a=e.computed(()=>{const E=n.config?.tools?.filter(I=>l.includes(I));return E&&E.length?E:l}),s={here:"Пошук…",xy:`50.4501 30.5234 або 50°27'00"N 30°31'24"E`,parcel:"Пошук…"},c=e.computed(()=>{const E=n.config?.placeholder?.trim();return E||s[i.value]||"Пошук…"}),i=e.ref(a.value[0]??l[0]);e.watch(a,E=>{E.includes(i.value)||(i.value=E[0])});const d=e.ref(""),u=e.ref(!1),h=e.ref(null);e.watch(i,()=>{d.value="",u.value=!1});function x(E){i.value=E}function g(E){if(!u.value)return;const I=h.value;I&&!I.contains(E.target)&&(u.value=!1)}e.onMounted(()=>{window.addEventListener("click",g,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",g,!0)});function m(E){return E==="xy"?"Координати":E==="parcel"?"Кадастр":"Адреси"}function f(E){const I=gr(E.trim(),"dms","lat-lon");if(I.ok){const[T,G]=I.point;return{lat:G,lng:T}}const A=E.replace(/[,]+/g," ").trim();if(!A)return null;const B=A.split(/\s+/).filter(Boolean);if(B.length<2)return null;const $=B.slice(0,2).map(Number);if(!$.every(T=>Number.isFinite(T)))return null;const[S,L]=$;let F=S,P=L;const M=T=>Math.abs(T)<=90,O=T=>Math.abs(T)<=180;if(!M(F)||!O(P))if(M(P)&&O(F))F=L,P=S;else return null;return{lat:F,lng:P}}function b(E){return(E?.items||[]).map((A,B)=>({id:String(A?.id??B),title:A?.title||A?.address?.label||"Знайдений обʼєкт",lat:Number(A?.position?.lat),lng:Number(A?.position?.lng)})).filter(A=>Number.isFinite(A.lat)&&Number.isFinite(A.lng))}function w(E){const I=E?.result||E?.data||E;if(!I)return[];const A=I.geom_centroid;if(!A||!Array.isArray(A.coordinates))return[];const[B,$]=A.coordinates;return!Number.isFinite($)||!Number.isFinite(B)?[]:[{id:"parcel",title:I.cadnum||I.cad_num||"Земельна ділянка",lat:$,lng:B}]}function _(E){const A=E.replace(/\s+/g,"").split(":");if(A.length!==4)return!1;const B=[10,2,3,4];return A.every(($,S)=>$.length===B[S]&&/^\d+$/.test($))}function k(E){o("goToCoordinates",[E.lat,E.lng])}async function C(){const E=d.value.trim();if(E){if(i.value==="xy"){const I=f(E);if(!I){ue.notify({type:"warning",title:"Пошук координат",message:"Використайте `lat lon` або DMS у форматі `50°27'00\"N 30°31'24\"E`."});return}k(I),d.value="";return}try{const I=new URL(i.value==="here"?Mi:Di);if(i.value==="here")I.searchParams.set("searchtext",E);else{if(!_(E)){ue.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}I.searchParams.set("cad_num",E)}const A=await fetch(I.toString());if(!A.ok)throw new Error(`HTTP ${A.status}`);const B=await A.json(),$=i.value==="here"?b(B):w(B);if(!$.length)ue.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const S=$[0];k(S),d.value=""}}catch(I){const A=I?.message||"Помилка пошуку";ue.notify({type:"error",title:"Пошук",message:A})}}}return(E,I)=>(e.openBlock(),e.createElementBlock("div",Vi,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(C,["prevent"])},[a.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:h,class:"relative search-type w-[140px]"},[e.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:I[0]||(I[0]=A=>u.value=!u.value)},[e.createElementVNode("span",null,e.toDisplayString(m(i.value)),1),e.createVNode(e.unref(j.ChevronDown),{class:e.normalizeClass(["h-4 w-4 text-gray-500 transition-transform",{"rotate-180":u.value}])},null,8,["class"])]),u.value?(e.openBlock(),e.createElementBlock("div",Si,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,A=>(e.openBlock(),e.createElementBlock("li",{key:A,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:B=>x(A)},e.toDisplayString(m(A)),9,$i))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",Ni,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":I[1]||(I[1]=A=>d.value=A),placeholder:c.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,Ai),[[e.vModelText,d.value,void 0,{trim:!0}]]),e.createElementVNode("button",Fi,[e.createVNode(e.unref(j.Search),{class:"h-4 w-4"})])])],32)]))}}),[["__scopeId","data-v-8da4c870"]]),Ti={class:"pt-1 border-t border-gray-100"},Ii={class:"space-y-1"},Ri=e.defineComponent({__name:"AddCoordinates",emits:["submit","cancel"],setup(r,{emit:t}){const n=t,o=e.ref(null),l=e.ref(null),a=(i,d,u)=>Math.min(Math.max(i,d),u),s=()=>{if(o.value===null||l.value===null||!Number.isFinite(o.value)||!Number.isFinite(l.value))return;const i=a(o.value,-90,90),d=a(l.value,-180,180);n("submit",{lat:i,lng:d}),o.value=null,l.value=null},c=()=>{o.value=null,l.value=null,n("cancel")};return(i,d)=>(e.openBlock(),e.createElementBlock("div",Ti,[d[2]||(d[2]=e.createElementVNode("p",{class:"text-xs text-gray-600 mb-1"},"Додати точку за координатами:",-1)),e.createElementVNode("div",Ii,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[0]||(d[0]=u=>o.value=u),type:"number",step:"0.0001",class:"w-full px-2 py-1 text-xs border border-gray-300 rounded focus:outline-none focus:border-blue-500",placeholder:"Широта (50.4501)"},null,512),[[e.vModelText,o.value,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":d[1]||(d[1]=u=>l.value=u),type:"number",step:"0.0001",class:"w-full px-2 py-1 text-xs border border-gray-300 rounded focus:outline-none focus:border-blue-500",placeholder:"Довгота (30.5234)"},null,512),[[e.vModelText,l.value,void 0,{number:!0}]]),e.createElementVNode("div",{class:"flex gap-1.5"},[e.createElementVNode("button",{class:"flex-1 px-2 py-1 bg-blue-500 hover:bg-blue-600 text-white text-xs font-medium rounded transition-colors",type:"button",onClick:s}," Додати "),e.createElementVNode("button",{class:"px-2 py-1 bg-gray-200 hover:bg-gray-300 text-gray-700 text-xs font-medium rounded transition-colors",type:"button",onClick:c}," Скасувати ")])])]))}}),Oi=e.defineComponent({__name:"BtnAdd",emits:["click"],setup(r){return(t,n)=>(e.openBlock(),e.createElementBlock("button",{class:"flex-1 px-2 py-1.5 bg-blue-500 hover:bg-blue-600 text-white text-xs font-medium rounded transition-colors duration-150 flex items-center justify-center gap-1",onClick:n[0]||(n[0]=o=>t.$emit("click"))},[e.createVNode(e.unref(j.Plus),{size:12,"stroke-width":2}),n[1]||(n[1]=e.createTextVNode(" Додати ",-1))]))}}),zi=e.defineComponent({__name:"BtnClear",emits:["click"],setup(r){return(t,n)=>(e.openBlock(),e.createElementBlock("button",{class:"w-full px-2 py-1.5 bg-rose-500 hover:bg-rose-600 text-white text-xs font-medium rounded transition-colors duration-150 flex items-center justify-center gap-1",onClick:n[0]||(n[0]=o=>t.$emit("click"))},[e.createVNode(e.unref(j.Trash2),{size:12,"stroke-width":2}),n[1]||(n[1]=e.createTextVNode(" Очистити ",-1))]))}}),Pi=e.defineComponent({__name:"BtnComplete",emits:["click"],setup(r){return(t,n)=>(e.openBlock(),e.createElementBlock("button",{class:"flex-1 px-2 py-1.5 bg-emerald-500 hover:bg-emerald-600 text-white text-xs font-medium rounded transition-colors duration-150 flex items-center justify-center gap-1",onClick:n[0]||(n[0]=o=>t.$emit("click"))},[e.createVNode(e.unref(j.Circle),{size:12,"stroke-width":2}),n[1]||(n[1]=e.createTextVNode("Замкнути ",-1))]))}}),ji=new Intl.NumberFormat("uk-UA",{minimumFractionDigits:2,maximumFractionDigits:2});function _t(r){return ji.format(r)}function xr(r){return r>=1e3?`${_t(r/1e3)} км`:`${_t(r)} м`}const Ui={class:"flex items-center gap-1.5 text-xs bg-gray-50 rounded p-1.5"},Hi={key:0,class:"flex-1 flex gap-1"},qi={key:1,class:"flex-1 font-mono text-gray-700"},Gi=e.defineComponent({__name:"DotListItem",props:{id:{},index:{},coords:{}},emits:["update","delete"],setup(r,{emit:t}){const n=r,o=t,l=e.computed(()=>`${n.coords.lat.toFixed(4)}°, ${n.coords.lng.toFixed(4)}°`),a=e.ref(!1),s=e.ref(n.coords.lat),c=e.ref(n.coords.lng);e.watch(()=>n.coords,x=>{s.value=x.lat,c.value=x.lng},{deep:!0,immediate:!0});const i=(x,g,m)=>Math.min(Math.max(x,g),m),d=()=>{a.value=!0},u=()=>{if(!Number.isFinite(s.value)||!Number.isFinite(c.value))return;const x=i(s.value,-90,90),g=i(c.value,-180,180);o("update",{id:n.id,coords:{lat:x,lng:g}}),a.value=!1},h=()=>{o("delete",n.id)};return(x,g)=>(e.openBlock(),e.createElementBlock("div",Ui,[e.createVNode(e.unref(j.MapPin),{size:12,"stroke-width":2,class:"text-gray-400 flex-shrink-0"}),a.value?(e.openBlock(),e.createElementBlock("div",Hi,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":g[0]||(g[0]=m=>s.value=m),type:"number",step:"0.0001",min:"-90",max:"90",class:"flex-1 px-1.5 py-0.5 text-xs border border-gray-300 rounded focus:outline-none focus:border-blue-500",placeholder:"Широта"},null,512),[[e.vModelText,s.value,void 0,{number:!0}]]),e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":g[1]||(g[1]=m=>c.value=m),type:"number",step:"0.0001",min:"-180",max:"180",class:"flex-1 px-1.5 py-0.5 text-xs border border-gray-300 rounded focus:outline-none focus:border-blue-500",placeholder:"Довгота"},null,512),[[e.vModelText,c.value,void 0,{number:!0}]]),e.createElementVNode("button",{class:"px-1.5 py-0.5 bg-emerald-500 text-white rounded hover:bg-emerald-600 text-xs",type:"button",onClick:u}," ✓ ")])):(e.openBlock(),e.createElementBlock("span",qi,e.toDisplayString(l.value),1)),a.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:2,class:"text-blue-500 hover:text-blue-600 px-0.5",type:"button",onClick:d}," ✎ ")),e.createElementVNode("button",{class:"text-rose-500 hover:text-rose-600 px-0.5",type:"button",onClick:h}," ✕ ")]))}}),Ki={class:"ruler-control px-3 py-2.5 space-y-2"},Wi={type:"button",class:"ruler-row w-full flex items-center gap-2 cursor-pointer group text-left"},Yi={class:e.normalizeClass(["flex items-center justify-center w-5 h-5 rounded-full shrink-0 transition-colors pointer-events-none"]),title:"Сумарна довжина всіх відрізків","aria-hidden":"true"},Xi={class:"text-sm font-semibold text-slate-700"},Zi={class:"ruler-row"},Ji={type:"button",class:"w-full flex items-center gap-2 cursor-pointer group text-left"},Qi={class:e.normalizeClass(["flex items-center justify-center w-5 h-5 rounded-full shrink-0 transition-colors pointer-events-none"]),title:"Площа замкнутого контуру","aria-hidden":"true"},ec={class:"inline-flex rounded-md overflow-hidden border border-gray-200 bg-gray-100"},tc=["onClick"],nc={class:"flex items-center gap-2 mt-0.5 pl-7"},rc={key:0,class:"text-base font-semibold text-green-600"},oc={key:1,class:"text-xs text-gray-400"},lc={class:"ruler-row flex items-center gap-2 cursor-pointer"},ac={class:e.normalizeClass(["flex items-center justify-center w-5 h-5 rounded-full shrink-0 transition-colors pointer-events-none"]),title:"Список точок","aria-hidden":"true"},sc={class:"text-xs font-medium text-gray-600 flex-1"},ic={key:0,class:"pt-1.5 border-t border-gray-100 max-h-32 overflow-y-auto space-y-1"},cc=e.defineComponent({__name:"ControlPanel",props:{points:{},isShapeClosed:{type:Boolean}},emits:["update-point","delete-point"],setup(r){const t=r,n=e.ref(!1),o=e.ref("km2"),l=[{id:"km2",label:"км²"},{id:"ha",label:"га"},{id:"m2",label:"м²"}],a=()=>{n.value=!n.value},s=(m,f)=>{const b=$=>$*Math.PI/180,w=b(f.lat-m.lat),_=b(f.lng-m.lng),k=b(m.lat),C=b(f.lat),E=Math.sin(w/2),I=Math.sin(_/2);return 6371e3*(2*Math.asin(Math.sqrt(E*E+Math.cos(k)*Math.cos(C)*I*I)))},c=e.computed(()=>{if(t.points.length<2)return 0;let m=0;for(let f=1;f<t.points.length;f+=1)m+=s(t.points[f-1].coords,t.points[f].coords);return t.isShapeClosed&&t.points.length>=2&&(m+=s(t.points[t.points.length-1].coords,t.points[0].coords)),m}),i=e.computed(()=>c.value>=1e3?`${_t(c.value/1e3)} км`:`${_t(c.value)} м`);function d(m){if(m.length<3)return 0;const f=m[0].lat,b=m[0].lng,w=(k,C)=>{const E=(k-f)*110574;return{x:(C-b)*111320*Math.cos(f*Math.PI/180),y:E}};let _=0;for(let k=0;k<m.length;k++){const C=(k+1)%m.length,E=w(m[k].lat,m[k].lng),I=w(m[C].lat,m[C].lng);_+=E.x*I.y-E.y*I.x}return Math.abs(_)*.5}const u=e.computed(()=>{if(!t.isShapeClosed||t.points.length<3)return 0;const m=t.points.map(f=>f.coords);return d(m)}),h=e.computed(()=>u.value>0),x=e.computed(()=>{const m=u.value;if(m===0)return"—";if(o.value==="km2"){const b=m/1e6;return`${_t(b)} км²`}if(o.value==="ha"){const b=m/1e4;return`${_t(b)} га`}const f=m>=1?Math.round(m):m;return`${_t(f)} м²`}),g=e.computed(()=>{const m=t.points.length;return m===1?"1 точка":m>=2&&m<=4?`${m} точки`:`${m} точок`});return e.watch(()=>t.points.length,()=>{t.points.length===0&&(n.value=!1)}),(m,f)=>(e.openBlock(),e.createElementBlock("div",Ki,[e.createElementVNode("button",Wi,[e.createElementVNode("span",Yi,[e.createVNode(e.unref(j.Info),{size:12,"stroke-width":2.5})]),f[1]||(f[1]=e.createElementVNode("span",{class:"text-xs font-medium text-gray-600 flex-1"},"Загальна відстань",-1)),e.createElementVNode("span",Xi,e.toDisplayString(i.value),1)]),e.createElementVNode("div",Zi,[e.createElementVNode("button",Ji,[e.createElementVNode("span",Qi,[e.createVNode(e.unref(j.Info),{size:12,"stroke-width":2.5})]),f[2]||(f[2]=e.createElementVNode("span",{class:"text-xs font-medium text-gray-600 flex-1"},"Площа",-1)),e.createElementVNode("div",ec,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(l,(b,w)=>e.createElementVNode("button",{key:b.id,type:"button",class:e.normalizeClass(["px-2.5 py-1 text-xs font-medium transition-colors border-r border-gray-200 last:border-r-0",w===0&&"rounded-l-md",w===l.length-1&&"rounded-r-md",o.value===b.id?"bg-white text-green-600 font-semibold shadow-sm":"text-gray-600 hover:bg-gray-50"]),onClick:e.withModifiers(_=>o.value=b.id,["stop"])},e.toDisplayString(b.label),11,tc)),64))])]),e.createElementVNode("div",nc,[h.value?(e.openBlock(),e.createElementBlock("span",rc,e.toDisplayString(x.value),1)):(e.openBlock(),e.createElementBlock("span",oc,"—"))])]),e.createElementVNode("div",lc,[e.createElementVNode("span",ac,[e.createVNode(e.unref(j.Info),{size:12,"stroke-width":2.5})]),e.createElementVNode("span",sc,e.toDisplayString(g.value),1),e.createElementVNode("button",{type:"button",class:"text-xs text-blue-500 hover:text-blue-600 font-medium transition-colors",onClick:e.withModifiers(a,["stop"])}," Координати ")]),n.value?(e.openBlock(),e.createElementBlock("div",ic,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(m.points,(b,w)=>(e.openBlock(),e.createBlock(Gi,{key:b.id,id:b.id,index:w+1,coords:b.coords,onUpdate:f[0]||(f[0]=_=>m.$emit("update-point",_)),onDelete:_=>m.$emit("delete-point",b.id)},null,8,["id","index","coords","onDelete"]))),128))])):e.createCommentVNode("",!0)]))}}),dc={class:"px-3 py-3 bg-blue-50/50 border-b border-blue-100"},uc={class:"flex items-start gap-2"},pc=e.defineComponent({__name:"InfoHint",setup(r){return(t,n)=>(e.openBlock(),e.createElementBlock("div",dc,[e.createElementVNode("div",uc,[e.createVNode(e.unref(j.Info),{size:16,"stroke-width":2,class:"text-blue-600 flex-shrink-0 mt-0.5"}),n[0]||(n[0]=e.createElementVNode("div",{class:"space-y-1"},[e.createElementVNode("p",{class:"text-xs font-medium text-blue-900"}," Натискайте на карту, щоб додати точки вимірювання "),e.createElementVNode("p",{class:"text-[10px] text-blue-700"},' Або скористайтесь кнопкою "Додати" внизу для введення координат вручну ')],-1))])]))}}),fc={class:"space-y-1.5"},mc={class:"space-y-1 max-h-40 overflow-y-auto"},hc={class:"text-gray-700"},gc={class:"font-semibold text-slate-800"},yc=e.defineComponent({__name:"ToPointList",props:{points:{},isShapeClosed:{type:Boolean}},setup(r){const t=r;function n(a,s){const c=g=>g*Math.PI/180,i=c(s.lat-a.lat),d=c(s.lng-a.lng),u=c(a.lat),h=c(s.lat);return 6371e3*(2*Math.asin(Math.sqrt(Math.sin(i/2)**2+Math.cos(u)*Math.cos(h)*Math.sin(d/2)**2)))}function o(a){return xr(a)}const l=e.computed(()=>{const a=[],s=t.points;if(s.length<2)return a;for(let c=0;c<s.length;c++){const i=c===s.length-1&&t.isShapeClosed?0:c+1;if(i>=s.length)break;const d=n(s[c].coords,s[i].coords);a.push({from:c+1,to:i+1,label:o(d)})}return a});return(a,s)=>(e.openBlock(),e.createElementBlock("div",fc,[s[0]||(s[0]=e.createElementVNode("p",{class:"text-xs font-medium text-gray-600 mb-1.5"},"Відстань між точками:",-1)),e.createElementVNode("div",mc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(c,i)=>(e.openBlock(),e.createElementBlock("div",{key:i,class:"flex items-center justify-between text-xs py-1 px-2 rounded bg-gray-50"},[e.createElementVNode("span",hc,"Точка "+e.toDisplayString(c.from)+" → Точка "+e.toDisplayString(c.to),1),e.createElementVNode("span",gc,e.toDisplayString(c.label),1)]))),128))])]))}}),bc={class:"ruler-panel-wrap absolute bottom-12 right-4 z-[1001] animate-slide-up"},kc={class:"bg-white rounded-xl shadow-2xl border border-gray-200 overflow-hidden w-72"},xc={class:"bg-gradient-to-r from-blue-400 to-blue-500 px-3 py-2 flex items-center justify-between"},wc={class:"flex items-center gap-2"},_c={class:"w-6 h-6 bg-white/20 rounded-lg flex items-center justify-center"},vc={class:"flex border-b border-gray-200"},Cc={key:1,class:"px-3 py-2.5"},Ec={key:1,class:"text-xs text-gray-500"},Bc={class:"px-2.5 py-1.5 bg-gray-50 border-t border-gray-200 space-y-1.5"},Vc={class:"flex gap-1.5"},Sc=e.defineComponent({name:"RulerPanel",__name:"RulerPanel",emits:["close","tab-change","points-change","add-request","complete","shape-closed-change"],setup(r,{expose:t,emit:n}){const o=n,l=e.ref([]),a=e.computed(()=>l.value.length>0),s=e.ref(!1),c=e.ref(!1),i=e.ref("general");function d(S){i.value=S,o("tab-change",S)}e.onMounted(()=>{o("tab-change",i.value)});const u=e.computed(()=>l.value.length>=3&&!c.value);let h=1;const x=()=>l.value.map(S=>({id:S.id,coords:{...S.coords}})),g=()=>{l.value.length<3&&c.value&&(c.value=!1,o("shape-closed-change",!1)),o("points-change",x())},m=()=>{const S=h;return h+=1,S},f=S=>{l.value=[...l.value,{id:m(),coords:{lat:S.lat,lng:S.lng}}],g()},b=({id:S,coords:L})=>{const F=l.value.findIndex(M=>M.id===S);if(F===-1)return;const P=[...l.value];P[F]={id:S,coords:{...L}},l.value=P,g()},w=S=>{l.value=l.value.filter(L=>L.id!==S),g()},_=()=>{l.value=[],c.value&&(c.value=!1,o("shape-closed-change",!1)),g()},k=S=>{b(S)},C=S=>{w(S)},E=()=>{s.value=!0,o("add-request")},I=S=>{f(S),s.value=!1},A=()=>{s.value=!1},B=()=>{u.value&&(c.value=!0,o("complete"),o("shape-closed-change",!0))},$=()=>{_(),s.value=!1,o("close")};return t({addPoint:f,clearPoints:_}),(S,L)=>(e.openBlock(),e.createElementBlock("div",bc,[e.createElementVNode("div",kc,[e.createElementVNode("div",xc,[e.createElementVNode("div",wc,[e.createElementVNode("div",_c,[e.createVNode(e.unref(j.Ruler),{size:14,"stroke-width":2,class:"text-white"})]),L[2]||(L[2]=e.createElementVNode("h3",{class:"text-white font-semibold text-xs"},"Вимірювання",-1))]),e.createElementVNode("button",{class:"w-5 h-5 flex items-center justify-center rounded hover:bg-white/20 transition-colors","aria-label":"Закрити",onClick:$},[e.createVNode(e.unref(j.X),{size:14,"stroke-width":2,class:"text-white"})])]),e.createElementVNode("div",vc,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["flex-1 px-3 py-2 text-xs font-medium transition-colors",i.value==="general"?"text-blue-600 border-b-2 border-blue-500 bg-blue-50/50":"text-gray-500 hover:text-gray-700"]),onClick:L[0]||(L[0]=F=>d("general"))}," Загальна ",2),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["flex-1 px-3 py-2 text-xs font-medium transition-colors",i.value==="topoint"?"text-blue-600 border-b-2 border-blue-500 bg-blue-50/50":"text-gray-500 hover:text-gray-700"]),onClick:L[1]||(L[1]=F=>d("topoint"))}," До точки ",2)]),i.value==="general"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[a.value?(e.openBlock(),e.createBlock(cc,{key:1,points:l.value,"is-shape-closed":c.value,onUpdatePoint:k,onDeletePoint:C},null,8,["points","is-shape-closed"])):(e.openBlock(),e.createBlock(pc,{key:0}))],64)):(e.openBlock(),e.createElementBlock("div",Cc,[a.value?(e.openBlock(),e.createBlock(yc,{key:0,points:l.value,"is-shape-closed":c.value},null,8,["points","is-shape-closed"])):(e.openBlock(),e.createElementBlock("p",Ec,"Додайте точки на карті, щоб бачити відстані між ними."))])),e.createElementVNode("div",Bc,[e.createElementVNode("div",Vc,[s.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(Oi,{key:0,onClick:E})),u.value?(e.openBlock(),e.createBlock(Pi,{key:1,onClick:B})):e.createCommentVNode("",!0)]),s.value?(e.openBlock(),e.createBlock(Ri,{key:0,onSubmit:I,onCancel:A})):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createBlock(zi,{key:1,onClick:_})):e.createCommentVNode("",!0)])])]))}}),Ue="ruler-points",dt="ruler-line",ut="ruler-polygon",pt="ruler-segments",$c=e.defineComponent({__name:"RulerLayer",props:{map:{},points:{},isShapeClosed:{type:Boolean},labelMode:{}},setup(r){function t(m,f){const b=I=>I*Math.PI/180,w=b(f.lat-m.lat),_=b(f.lng-m.lng),k=b(m.lat),C=b(f.lat);return 6371e3*(2*Math.asin(Math.sqrt(Math.sin(w/2)**2+Math.cos(k)*Math.cos(C)*Math.sin(_/2)**2)))}function n(m){return xr(m)}const o=r;function l(){return{type:"FeatureCollection",features:[]}}function a(m,f,b){const w=b??"general",_=[];let k=0;_.push(0);for(let C=1;C<m.length;C++)k+=t(m[C-1].coords,m[C].coords),_.push(k);return f&&m.length>=2&&(k+=t(m[m.length-1].coords,m[0].coords)),{type:"FeatureCollection",features:m.map((C,E)=>{const I=w==="general"?E===0?"0":n(_[E]):E===0?"0":n(t(m[E-1].coords,m[E].coords));return{type:"Feature",geometry:{type:"Point",coordinates:[C.coords.lng,C.coords.lat]},properties:{id:C.id,index:E+1,label:I}}})}}function s(m,f){if(m.length<2)return l();const b=[];for(let w=0;w<m.length;w++){const _=w===m.length-1&&f?0:w+1;if(_>=m.length)break;const k=m[w].coords,C=m[_].coords,E=t(k,C);b.push({type:"Feature",geometry:{type:"LineString",coordinates:[[k.lng,k.lat],[C.lng,C.lat]]},properties:{distance:n(E)}})}return{type:"FeatureCollection",features:b}}function c(m,f){if(m.length<2)return l();const b=m.map(w=>[w.coords.lng,w.coords.lat]);return f&&b.push(b[0]),{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"LineString",coordinates:b},properties:{}}]}}function i(m){if(m.length<3)return l();const f=m.map(b=>[b.coords.lng,b.coords.lat]);return f.push(f[0]),{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:"Polygon",coordinates:[f]},properties:{}}]}}let d=!1;function u(m){m.getSource(Ue)||(m.addSource(Ue,{type:"geojson",data:l()}),m.addLayer({id:`${Ue}-circle`,type:"circle",source:Ue,paint:{"circle-radius":5,"circle-color":"#1e293b","circle-stroke-width":2,"circle-stroke-color":"#ffffff"}}),m.addLayer({id:`${Ue}-labels`,type:"symbol",source:Ue,layout:{"text-field":["get","label"],"text-size":14,"text-offset":[0,1.3]},paint:{"text-color":"#0f172a","text-halo-color":"#ffffff","text-halo-width":1}})),m.getSource(pt)||(m.addSource(pt,{type:"geojson",data:l()}),m.addLayer({id:`${pt}-labels`,type:"symbol",source:pt,layout:{"text-field":["get","distance"],"text-size":13,"symbol-placement":"line-center","text-rotation-alignment":"map","text-pitch-alignment":"map"},paint:{"text-color":"#1e293b","text-halo-color":"#ffffff","text-halo-width":1.5}})),m.getSource(dt)||(m.addSource(dt,{type:"geojson",data:l()}),m.addLayer({id:`${dt}-layer`,type:"line",source:dt,paint:{"line-color":"#3b82f6","line-width":2}})),m.getSource(ut)||(m.addSource(ut,{type:"geojson",data:l()}),m.addLayer({id:`${ut}-layer`,type:"fill",source:ut,paint:{"fill-color":"#93c5fd","fill-opacity":.25}})),d=!0}function h(m){if(m){try{m.getLayer(`${ut}-layer`)&&m.removeLayer(`${ut}-layer`),m.getSource(ut)&&m.removeSource(ut),m.getLayer(`${dt}-layer`)&&m.removeLayer(`${dt}-layer`),m.getSource(dt)&&m.removeSource(dt),m.getLayer(`${pt}-labels`)&&m.removeLayer(`${pt}-labels`),m.getSource(pt)&&m.removeSource(pt),m.getLayer(`${Ue}-labels`)&&m.removeLayer(`${Ue}-labels`),m.getLayer(`${Ue}-circle`)&&m.removeLayer(`${Ue}-circle`),m.getSource(Ue)&&m.removeSource(Ue)}catch{}d=!1}}function x(m){if(!m)return;const f=m.getSource(Ue),b=m.getSource(dt),w=m.getSource(ut),_=m.getSource(pt),k=o.points,C=o.labelMode??"general";f&&f.setData(a(k,o.isShapeClosed,C)),b&&b.setData(c(k,o.isShapeClosed)),w&&w.setData(i(k)),_&&_.setData(C==="topoint"?s(k,o.isShapeClosed):l())}function g(){const m=o.map;m&&(d||u(m),x(m))}return e.watch(()=>[o.points,o.isShapeClosed,o.labelMode],()=>g(),{deep:!0,immediate:!0}),e.watch(()=>o.map,()=>g(),{immediate:!0}),e.onBeforeUnmount(()=>{h(o.map)}),(m,f)=>null}});function Nc(r={}){const t=e.ref(!1),n=e.ref([]),o=e.ref(!1),l=e.ref("general"),a=e.ref(null);function s(){t.value?c():(t.value=!0,r.onActivate?.())}function c(){t.value=!1,n.value=[],o.value=!1,a.value?.clearPoints(),r.onDeactivate?.()}function i(g){n.value=g}function d(g){l.value=g}function u(g){o.value=g}function h(g){t.value&&a.value?.addPoint({lat:g.lat,lng:g.lng})}const x=e.computed(()=>n.value.length>0);return{isRulerActive:t,rulerPoints:n,rulerShapeClosed:o,rulerActiveTab:l,rulerPanelRef:a,hasRulerPoints:x,toggleRuler:s,closeRuler:c,onRulerPointsChange:i,onRulerTabChange:d,onRulerShapeClosedChange:u,handleRulerMapClick:h}}const Ac={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},Fc={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},Mc={class:"flex items-center gap-1"},Dc=["disabled"],Lc={key:0,class:"absolute z-[1600] mt-1 min-w-[120px] bg-white border border-gray-300 shadow-lg rounded-lg text-sm overflow-hidden"},Tc=["disabled"],Ic=["disabled"],Rc={class:"mt-4 flex justify-end gap-2"},Oc=["disabled"],zc={class:"absolute top-4 right-4 z-[1000]"},Pc={class:"flex flex-col gap-[2px]"},jc=["disabled"],Uc=["disabled"],Hc=["disabled"],qc=["disabled"],Gc={class:"bg-white/95 border border-gray-200 rounded-md shadow-xl px-3 py-2 max-w-[240px] text-[11px] sm:text-xs text-gray-900"},Kc={class:"space-y-0.5"},Wc={class:"text-gray-500"},Yc={class:"text-gray-900 text-right break-all"},Xc={class:"absolute left-4 bottom-[36px] z-[1000]"},Zc={class:"flex flex-col gap-2"},Jc={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},Qc={class:"flex flex-col gap-1"},ed=["checked","disabled","onChange"],td={class:"text-gray-700 text-xs font-medium"},nd={class:"absolute bottom-0 left-0 right-0 z-[1000] min-h-[28px] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},rd={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full px-2 pb-1"},od={class:"mr-auto flex items-center gap-2 min-w-0 relative"},ld={class:"shrink-0"},ad={key:0,class:"font-bold"},sd=["onClick","disabled"],id={key:0},cd={class:"flex items-center"},dd={class:"text-xs mr-2"},ud={key:0},pd={key:1},fd={key:0,class:"text-xs mr-2"},md={key:1,class:"text-xs mr-2"},hd=["disabled"],gd=["disabled"],Zt="__vs_form_maplibre_loader__",Jt="vs-global-bounds-src",Qt="vs-global-bounds-line",wr=me(e.defineComponent({__name:"vs-input-map",props:{tools:{},multi:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},handleZoom:{type:Boolean,default:!0},ctrlZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},katottg:{default:""},layers:{default:()=>[]},bounds:{},api:{},center:{default:void 0},zoom:{default:void 0},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue","valueSelected"],setup(r,{emit:t}){const n=r,o=t,l=e.useAttrs(),a=e.computed(()=>{const p=l?.multiple,y=l?.multi,v=V=>V===""||V===!0||V==="true"||V===1||V==="1";return!!n.multi||!!n.multiple||v(y)||v(p)}),s=e.computed(()=>!!n.disabled),c=e.ref(!1),i=e.ref(null),d=e.ref(0),u=e.ref(""),h=e.ref(null),x=e.ref([]),g=e.ref(null),m=e.ref(null),f=Nc({onActivate(){if(K)try{K.changeMode("simple_select",{featureIds:[]})}catch{}u.value=""},onDeactivate(){}});function b(){f.toggleRuler()}const w=e.getCurrentInstance(),_=w?.appContext?.config?.globalProperties?.$settings??{},k=_?.map??{},C=w?.vnode?.props??{};function E(p){return Object.prototype.hasOwnProperty.call(C,p)||Object.prototype.hasOwnProperty.call(C,p.replace(/[A-Z]/g,y=>`-${y.toLowerCase()}`))}const I=Array.isArray(k.center)&&k.center.length===2?k.center:Array.isArray(_.center)&&_.center.length===2?_.center:[30,50],A=typeof k.zoom=="number"?k.zoom:typeof _.zoom=="number"?_.zoom:typeof _.defaultZoom=="number"?_.defaultZoom:10,B=e.computed(()=>E("center")?n.center:k.center??n.center),$=e.computed(()=>E("zoom")?n.zoom:k.zoom??n.zoom),S=e.computed(()=>E("katottg")?String(n.katottg??""):String(k.katottg??n.katottg??"")),L=e.computed(()=>E("layers")?n.layers??[]:k.layers??n.layers??[]),F=e.computed(()=>E("bounds")?n.bounds:k.bounds??n.bounds),P=e.ref(Array.isArray(B.value)&&B.value.length===2?[...B.value]:I),M=e.ref(typeof $.value=="number"?$.value:A),O=e.ref(n.modelValue),T=e.ref(null),G=e.ref(null),W=e.ref([]),X=e.ref(!1),ne=e.ref(!1),we=e.ref([]),ge=e.ref({coordinates:"",format:"decimal",order:"lat-lon"}),J={coordinates:{type:"Textarea",label:"Координати вершин полігону (3-100 точок)",placeholder:`50.4501, 30.5234
|
|
3
3
|
50.4510, 30.5242
|
|
4
|
-
50.4494, 30.5260`},format:{type:"Radio",label:"Формат координат",options:[{id:"decimal",text:"Десяткові (Decimal)"},{id:"dms",text:"Градуси-хвилини-секунди (DMS)"}]},order:{type:"Radio",label:"Порядок координат",options:[{id:"lat-lon",text:"lat, lon"},{id:"lon-lat",text:"lon, lat"}]}};let re=!1,de=!1;const ce=e.reactive({}),ye=e.ref([]),Le=e.computed(()=>ye.value.map(p=>ce[p]).filter(Boolean)),$e=e.ref(null),tt=e.computed(()=>$e.value?.entries??[]),it=e.computed(()=>{if($e.value)return{left:`${$e.value.point.x+12}px`,top:`${$e.value.point.y+12}px`}}),Re=e.computed(()=>{if(Array.isArray(n.tools)&&n.tools.length)return n.tools;const p=l?.tools;return Array.isArray(p)?p.map(y=>String(y)):typeof p=="string"?p.split(",").map(y=>y.trim()).filter(Boolean):[]}),Be=e.computed(()=>{const p={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1,ruler:!1};if(!Re.value.length)return{...p,import:!0,export:!0,point:!0,line:!0,polygon:!0,rectangle:!0};const y=new Set(Re.value.map(v=>v.toLowerCase()));return{search:y.has("search"),import:y.has("import"),export:y.has("export"),point:y.has("point"),line:y.has("line"),polygon:y.has("polygon"),rectangle:y.has("rectangle"),ruler:y.has("ruler")}});function U(p){if(typeof p!="string"||!p.trim())return"";if(/^https?:\/\//i.test(p))return p;const y=window?.location?.origin??"",v=p.replace(/^\/+/,"");return v?y?`${y}/${v}`:`/${v}`:y}function Z(){const p=Array.isArray(k.basemaps)&&k.basemaps.length?k.basemaps:_.basemaps;if(Array.isArray(p)&&p.length){const v=p.map((V,N)=>{const H=String(V?.key??V?.id??V?.name??`b${N}`),te=U(String(V?.url??""));if(!te)return null;const oe=typeof V?.preview=="string"&&V.preview?U(V.preview):"";return[H,{...V,url:te,preview:oe}]}).filter(V=>Array.isArray(V)&&V.length===2).reduce((V,[N,H])=>(V[N]=H,V),{});if(Object.keys(v).length)return v}return{voyager:{name:"Оглядова карта",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/voyager/ua/13/4790/2762.png"},orto10:{name:"Ортофото 1:10K",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4790/2762.png"},osmb:{name:"Open Street Maps",url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",preview:"https://tile.openstreetmap.org.ua/styles/osm-bright/13/4790/2762.png"}}}const ee=Z(),ae=Object.keys(ee),ie=e.ref(ae.length?ae[0]:"");async function Ce(){if(typeof window>"u")return null;const p=window;if(p[Zt])return p[Zt];const y=H=>{if(Array.from(document.styleSheets).some(Se=>Se?.href?.includes(H)))return;const oe=document.createElement("link");oe.rel="stylesheet",oe.href=H,document.head.appendChild(oe)},v=async()=>{const H=new Function("u","return import(u)"),te=await H("https://esm.sh/maplibre-gl@3.6.2"),oe=te?.default??te;if(!oe)throw new Error("maplibre esm fallback failed");window.maplibregl=oe,window.mapboxgl=oe;const Se=await H("https://esm.sh/@mapbox/mapbox-gl-draw@1.5.0"),Ye=Se?.default??Se;if(!Ye)throw new Error("mapbox draw esm fallback failed");window.MapboxDraw=Ye},N=(async()=>{y("https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css"),y("https://unpkg.com/@mapbox/mapbox-gl-draw@1.5.0/dist/mapbox-gl-draw.css"),(!window.maplibregl||!window.MapboxDraw)&&await v();const H=window.maplibregl,te=window.MapboxDraw;if(!H)throw new Error("maplibregl not available after load");if(!te)throw new Error("MapboxDraw not available after load");return{maplibregl:H,MapboxDraw:te}})().catch(H=>{throw delete p[Zt],H});return p[Zt]=N,N}function _e(p){return{version:8,sources:{rasterSource:{type:"raster",tiles:[p],tileSize:256}},layers:[{id:"rasterLayer",type:"raster",source:"rasterSource"}]}}let z=null,Q=null,D=null,K=null,ke=[],Ze=null,Oe=null,Ve=null,nt=!1,rt=!1,Je=!1,Te=null;function kt(){return{onSetup(){const p=this.newFeature({type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[0,0],[0,0],[0,0],[0,0],[0,0]]]}});return this.addFeature(p),this.clearSelectedFeatures(),this.updateUIClasses({mouse:"add"}),this.setActionableState({trash:!0}),{rectangle:p,startPoint:null,hasCoordinates:!1}},onMouseMove(p,y){if(!p.startPoint)return;const[v,V]=p.startPoint,N=y.lngLat.lng,H=y.lngLat.lat;p.rectangle.setCoordinates([[[v,V],[N,V],[N,H],[v,H],[v,V]]])},onClick(p,y){if(!p.startPoint){p.startPoint=[y.lngLat.lng,y.lngLat.lat],p.hasCoordinates=!0,p.rectangle.setCoordinates([[[y.lngLat.lng,y.lngLat.lat],[y.lngLat.lng,y.lngLat.lat],[y.lngLat.lng,y.lngLat.lat],[y.lngLat.lng,y.lngLat.lat],[y.lngLat.lng,y.lngLat.lat]]]);return}const[v,V]=p.startPoint,N=y.lngLat.lng,H=y.lngLat.lat;return Math.abs(v-N)>0&&Math.abs(V-H)>0?(p.rectangle.setCoordinates([[[v,V],[N,V],[N,H],[v,H],[v,V]]]),this.map.fire("draw.create",{features:[p.rectangle.toGeoJSON()]}),this.changeMode("simple_select",{featureIds:[p.rectangle.id]})):(this.deleteFeature([p.rectangle.id],{silent:!0}),p.hasCoordinates=!1,this.changeMode("simple_select"))},onStop(){},onTrash(p){this.deleteFeature([p.rectangle.id],{silent:!0}),this.changeMode("simple_select")},toDisplayFeatures(p,y,v){const V=y.properties.id===p.rectangle.id;V&&!p.hasCoordinates||(y.properties.active=V?"true":"false",v(y))}}}const jt=[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","$type","Polygon"],["!=","active","true"]],paint:{"fill-color":"#3b82f6","fill-outline-color":"#3b82f6","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","$type","Polygon"],["==","active","true"]],paint:{"fill-color":"#2563eb","fill-outline-color":"#2563eb","fill-opacity":.2}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","$type","Polygon"],["!=","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3b82f6","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","$type","Polygon"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#2563eb","line-width":2}},{id:"gl-draw-lines-inactive",type:"line",filter:["all",["==","$type","LineString"],["!=","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3b82f6","line-width":2}},{id:"gl-draw-lines-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#2563eb","line-width":2}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["!=","active","true"]],paint:{"circle-radius":5,"circle-color":"#3b82f6"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":6,"circle-color":"#2563eb"}},{id:"gl-draw-polygon-and-line-vertex-halo-active",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-active",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#2563eb"}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","meta","midpoint"],["==","$type","Point"]],paint:{"circle-radius":4,"circle-color":"#1d4ed8"}}];function Ut(){const p=ie.value;return!p||!ee[p]?.url?"":ee[p].url}function gn(p,y){return p?.id?String(p.id):p?.url?`${p.url}-${y}`:`layer-${y}`}function Jn(p){const y=String(p?.url??"").trim();if(!y)return"";if(/^https?:\/\//i.test(y))return y;const v=window.location?.origin??"",V=y.replace(/^\/+/,"");return`${v}/${V}`}function xt(p){p&&$e.value?.layerId!==p||($e.value=null)}function Qn(p,y={}){return p.popup===!1?[]:Array.isArray(p.popup)?p.popup.length?p.popup.map(v=>{const V=v?.field||v?.name;if(!V)return null;const N=y[V];return N==null||N===""?null:{key:v.label||V,value:String(N)}}).filter(Boolean):[]:Object.entries(y).slice(0,5).map(([v,V])=>({key:v,value:V==null?"—":String(V)}))}function yn(p){if(!Array.isArray(p))return[];const y=V=>Array.isArray(V)&&V.length>=2&&Number.isFinite(Number(V[0]))&&Number.isFinite(Number(V[1])),v=V=>{if(!V.length)return V;const N=V[0],H=V[V.length-1];return!H||N[0]!==H[0]||N[1]!==H[1]?[...V,N]:V};if(p.length&&y(p[0])){const V=p.map(N=>[Number(N[0]),Number(N[1])]).filter(y);return V.length?[v(V)]:[]}return p.length&&Array.isArray(p[0])&&y(p[0][0])?p.map(N=>Array.isArray(N)?N.map(H=>[Number(H[0]),Number(H[1])]):[]).filter(N=>N.length).map(v):p.length&&Array.isArray(p[0])&&Array.isArray(p[0][0])&&y(p[0][0][0])?p.flatMap(N=>Array.isArray(N)?N:[]).map(N=>Array.isArray(N)?N.map(H=>[Number(H[0]),Number(H[1])]):[]).filter(N=>N.length).map(v):[]}function bn(p){const y=p.style??{},v=y.color??"#3b82f6";if(!y.colorAttr||!y.colorSet)return v;const V=Object.keys(y.colorSet);if(!V.length)return v;const N=["match",["to-string",["get",y.colorAttr]]];return V.forEach(H=>{N.push(String(H),y.colorSet?.[H]??v)}),N.push(v),N}function R(p){if(!D)return;p.handlers.forEach(v=>{try{D.off(v.type,v.layerId,v.handler)}catch{}}),p.handlers=[],[...p.layerIds,...p.boundsIds].forEach(v=>{D.getLayer(v)&&D.removeLayer(v)}),D.getSource(p.sourceId)&&D.removeSource(p.sourceId);const y=`vs-ov-bounds-src-${p.id}`;D.getSource(y)&&D.removeSource(y),xt(p.id)}function Y(p,y){if(!D)return[];const v=`vs-ov-bounds-src-${y}`,V=`vs-ov-bounds-line-${y}`,N=p.bounds??F.value??W.value,H=yn(N);if(!H.length)return[];const te={type:"FeatureCollection",features:H.map(oe=>({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:oe}}))};return D.getSource(v)&&D.removeSource(v),D.addSource(v,{type:"geojson",data:te}),D.addLayer({id:V,type:"line",source:v,paint:{"line-color":p.style?.stroke??p.style?.color??"#2563eb","line-width":p.style?.width??2,"line-opacity":p.style?.opacity??.8,"line-dasharray":[2,2]}}),[V]}function q(p){if(!D)return;R(p);const y=p.config,v=Jn(y);if(!v)return;const V=[],N=[];if(/\.v(?:m)?t(?:\?|$)/i.test(v)||/\.pbf(?:\?|$)/i.test(v)){const oe=y.sourceLayer||y.layer||y.service_layer||y.dataset?.layer||y.id;D.addSource(p.sourceId,{type:"vector",tiles:[v]});const Se=String(y.style?.type??"polygon").toLowerCase(),Ye=bn(y),ot=y.style?.opacity??.5;if(Se==="point"){const ct=`vs-ov-point-${p.id}`;D.addLayer({id:ct,type:"circle",source:p.sourceId,"source-layer":oe,paint:{"circle-color":Ye,"circle-radius":5,"circle-opacity":ot}}),V.push(ct)}else if(Se==="polyline"||Se==="line"){const ct=`vs-ov-line-${p.id}`;D.addLayer({id:ct,type:"line",source:p.sourceId,"source-layer":oe,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":Ye,"line-width":y.style?.width??2,"line-opacity":ot}}),V.push(ct)}else{const ct=`vs-ov-fill-${p.id}`,Gt=`vs-ov-border-${p.id}`;D.addLayer({id:ct,type:"fill",source:p.sourceId,"source-layer":oe,paint:{"fill-color":Ye,"fill-opacity":ot}}),D.addLayer({id:Gt,type:"line",source:p.sourceId,"source-layer":oe,paint:{"line-color":y.style?.stroke??y.style?.color??"#2563eb","line-width":y.style?.width??1,"line-opacity":ot}}),V.push(ct,Gt)}}else{D.addSource(p.sourceId,{type:"raster",tiles:[v],tileSize:256});const oe=`vs-ov-raster-${p.id}`;D.addLayer({id:oe,type:"raster",source:p.sourceId,paint:{"raster-opacity":y.style?.opacity??1}}),V.push(oe)}V.forEach(oe=>{const Se=ot=>{if(!ot?.features?.length){xt(p.id);return}const ct=ot.features[0]?.properties??{},Gt=Qn(p.config,ct);if(!Gt.length){xt(p.id);return}$e.value={layerId:p.id,entries:Gt,point:{x:ot.point.x,y:ot.point.y}}},Ye=()=>xt(p.id);D.on("mousemove",oe,Se),D.on("mouseleave",oe,Ye),N.push({layerId:oe,type:"mousemove",handler:Se},{layerId:oe,type:"mouseleave",handler:Ye})}),p.layerIds=V,p.boundsIds=Y(p.config,p.id),p.handlers=N;const te=p.visible?"visible":"none";[...p.layerIds,...p.boundsIds].forEach(oe=>{D.getLayer(oe)&&D.setLayoutProperty(oe,"visibility",te)})}function se(){if(!D)return;const y={type:"FeatureCollection",features:yn(F.value??W.value).map(v=>({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:v}}))};D.getSource(Jt)?D.getSource(Jt).setData(y):D.addSource(Jt,{type:"geojson",data:y}),D.getLayer(Qt)||D.addLayer({id:Qt,type:"line",source:Jt,paint:{"line-color":"#2563eb","line-width":2,"line-opacity":.8,"line-dasharray":[2,2]}})}function xe(p){if(!D||s.value)return;const y=ce[p];if(!y)return;y.visible=!y.visible;const v=y.visible?"visible":"none";[...y.layerIds,...y.boundsIds].forEach(V=>{D.getLayer(V)&&D.setLayoutProperty(V,"visibility",v)}),be(),y.visible||xt(p)}function be(){if(!D)return;const p=[],y=[],v=[],V=[];ye.value.forEach(te=>{const oe=ce[te];if(!oe)return;const Se=String(oe.config?.url??""),Ye=/\.v(?:m)?t(?:\?|$)/i.test(Se),ot=/\.png(?:\?|$)/i.test(Se);Ye?v.push(...oe.layerIds):ot?p.push(...oe.layerIds):y.push(...oe.layerIds),V.push(...oe.boundsIds)}),[...p,...y,...v,...V].forEach(te=>{D.getLayer(te)&&D.moveLayer(te)}),D.getLayer(Qt)&&D.moveLayer(Qt),(D.getStyle?.()?.layers??[]).map(te=>String(te?.id??"")).filter(te=>te.startsWith("gl-draw-")).forEach(te=>{D.getLayer(te)&&D.moveLayer(te)})}function ve(p){if(!ee[p]||(ie.value=p,!D))return;const y=Ut();if(!y)return;const v=D.getCenter?.(),V=D.getZoom?.(),N=K?.getAll?.();D.setStyle(_e(y)),D.once("style.load",()=>{if(D&&(v&&Number.isFinite(V)&&D.jumpTo({center:[v.lng,v.lat],zoom:V}),se(),ye.value.forEach(H=>{const te=ce[H];te&&q(te)}),be(),N?.features?.length&&K))try{N.features.forEach(H=>K.add(H)),d.value=N.features.length}catch{d.value=0}})}function Ne(p){return{type:"Feature",properties:{},geometry:p}}function Ee(p){if(!p)return null;try{return JSON.parse(JSON.stringify(p))}catch{return null}}function ze(p){if(!p)return null;const y=Ee(p.geometry);return y?{...p.id!==void 0?{id:p.id}:{},type:"Feature",properties:{...p.properties??{}},geometry:y}:null}function je(p){if(!p)return[];const y=(N,H)=>{if(!N?.type)return[];const te={...H??{}};return N.type==="MultiPoint"&&Array.isArray(N.coordinates)?N.coordinates.map(oe=>Ne({type:"Point",coordinates:oe})).map(oe=>({...oe,properties:te})):N.type==="MultiLineString"&&Array.isArray(N.coordinates)?N.coordinates.map(oe=>Ne({type:"LineString",coordinates:oe})).map(oe=>({...oe,properties:te})):N.type==="MultiPolygon"&&Array.isArray(N.coordinates)?N.coordinates.map(oe=>Ne({type:"Polygon",coordinates:oe})).map(oe=>({...oe,properties:te})):N.type==="GeometryCollection"&&Array.isArray(N.geometries)?N.geometries.flatMap(oe=>y(oe,te)):[{type:"Feature",properties:te,geometry:Ee(N)}]},v=N=>{if(!N)return null;if(N.type==="Feature"){const H=ze(N);return H?y(H.geometry,H.properties):null}return N.geom?.type&&Array.isArray(N.geom.coordinates)?y({type:N.geom.type,coordinates:N.geom.coordinates},N.properties??{}):N.type==="GeometryCollection"&&Array.isArray(N.geometries)?y(N,N.properties??{}):typeof N.type=="string"&&Array.isArray(N.coordinates)?y(Ee(N),N.properties??{}):null};if(p.type==="FeatureCollection")return(p.features??[]).flatMap(v).filter(Boolean);if(Array.isArray(p))return p.flatMap(N=>N?.type==="FeatureCollection"?je(N):[v(N)]).flat().filter(Boolean);const V=v(p);return V?Array.isArray(V)?V:[V]:[]}function We(p){if(!p.length)return null;if(!a.value)return Ee(p[0]?.geometry??null);const y=p.map(H=>Ee(H?.geometry)).filter(Boolean);return y.every(H=>H?.type==="Point")?{type:"MultiPoint",coordinates:y.map(H=>H.coordinates)}:y.every(H=>H?.type==="LineString")?{type:"MultiLineString",coordinates:y.map(H=>H.coordinates)}:y.every(H=>H?.type==="Polygon")?{type:"MultiPolygon",coordinates:y.map(H=>H.coordinates)}:{type:"GeometryCollection",geometries:y}}function St(p){if(!p)return"__null__";try{return JSON.stringify(p)}catch{return"__invalid__"}}function og(p,y){if(!Array.isArray(p)||!Array.isArray(y)||p.length<2||y.length<2)return!1;const v=1e-12;return Math.abs(Number(p[0])-Number(y[0]))<v&&Math.abs(Number(p[1])-Number(y[1]))<v}function wo(p,y){if(!Array.isArray(p)||p.length<4)return null;const V=og(p[0],p[p.length-1])?p.slice(0,-1):p.slice();return!Number.isInteger(y)||y<0||y>=V.length||V.length<=3||(V.splice(y,1),V.length<3)?null:[...V,[...V[0]]]}function _o(p,y){if(!Array.isArray(p)||p.length<2||!Number.isInteger(y)||y<0||y>=p.length||p.length<=2)return null;const v=p.slice();return v.splice(y,1),v.length<2?null:v}function lg(p,y){const v=Ee(p);if(!v||!Array.isArray(y))return null;if(v.type==="LineString"){const[V]=y,N=_o(v.coordinates,V);return N?(v.coordinates=N,v):null}if(v.type==="MultiLineString"){const[V,N]=y,H=v.coordinates?.[V],te=_o(H,N);return te?(v.coordinates[V]=te,v):null}if(v.type==="Polygon"){const[V,N]=y,H=v.coordinates?.[V],te=wo(H,N);return te?(v.coordinates[V]=te,v):null}if(v.type==="MultiPolygon"){const[V,N,H]=y,te=v.coordinates?.[V]?.[N],oe=wo(te,H);return oe?(v.coordinates[V][N]=oe,v):null}return null}function ag(p){return p?p.split(".").map(y=>Number(y)).filter(y=>Number.isInteger(y)&&y>=0):[]}function vo(p){return!K||!p?null:typeof K.get=="function"?K.get(p)??null:K.getAll?.()?.features?.find(v=>String(v?.id??"")===p)??null}function Co(p){const y=p?.properties?.id??p?.id;return y==null||y===""?null:String(y)}function sg(p){if(!D||!p)return null;const y=[[p.x-8,p.y-8],[p.x+8,p.y+8]],V=D.queryRenderedFeatures(y).find(N=>{const H=String(N?.properties?.meta??"");return H&&H!=="feature"?!1:!!Co(N)});return Co(V)}function ig(p,y){if(!K||!p||!y.length)return;const v=vo(p);if(!v?.geometry)return;const V=lg(v.geometry,y);if(!V)return;const N={...v,id:v.id??p,geometry:V};de=!0,re=!0;try{K.delete(p),K.add(N)}finally{re=!1,de=!1}qt(),ft()}function cg(p){if(!D||!K||s.value||f.isRulerActive.value||u.value!=="edit")return;const y=p?.point;if(!y)return;const v=[[y.x-8,y.y-8],[y.x+8,y.y+8]],N=D.queryRenderedFeatures(v).find(te=>te?.properties?.meta==="vertex"&&te?.properties?.parent&&te?.properties?.coord_path);if(!N)return;p?.originalEvent?.preventDefault?.(),p?.originalEvent?.stopPropagation?.();const H=ag(String(N.properties.coord_path));H.length&&ig(String(N.properties.parent),H)}function dg(p){const y=So(p);if(!y)return null;const[[v,V],[N,H]]=y;return{lat:(V+H)/2,lng:(v+N)/2}}function Eo(p){if(!Array.isArray(p)||p.length<3)return 0;const y=(V,N)=>{const H=V*2003750834e-2/180,te=Math.log(Math.tan((90+N)*Math.PI/360))/(Math.PI/180);return[H,te*2003750834e-2/180]};let v=0;for(let V=0;V<p.length-1;V+=1){const[N,H]=y(Number(p[V][0]),Number(p[V][1])),[te,oe]=y(Number(p[V+1][0]),Number(p[V+1][1]));v+=N*oe-te*H}return Math.abs(v/2)/1e6}function ug(p){if(!p?.type||!p?.coordinates)return null;if(p.type==="Polygon"){const y=p.coordinates?.[0];return Array.isArray(y)?Eo(y):null}return p.type==="MultiPolygon"?p.coordinates.reduce((y,v)=>{const V=v?.[0];return Array.isArray(V)?y+Eo(V):y},0):null}function er(p){if(!p){h.value=null;return}const y=dg(p);if(!y){h.value=null;return}h.value={type:String(p.type??"Feature"),center:y,areaKm2:ug(p)}}function tr(p){if(!p){const V=ke[ke.length-1],N=Ee(V?.geometry??null);Ze=N,er(N);return}const y=ke.find(V=>String(V?.id??"")===String(p))??null,v=Ee(y?.geometry??null);Ze=v,er(v)}function nr(p){x.value=(p??[]).map((y,v)=>{const V=String(y?.id??`feature-${v+1}`),N=Bo(String(y?.geometry?.type??"Feature"));return{id:V,label:`${N} ${v+1}`}})}function Bo(p){switch(String(p)){case"Point":return"Точка";case"MultiPoint":return"Мультиточка";case"LineString":return"Лінія";case"MultiLineString":return"Мультилінія";case"Polygon":return"Полігон";case"MultiPolygon":return"Мультиполігон";case"GeometryCollection":return"Колекція геометрій";default:return String(p||"Невідомо")}}function Vo(p,y){if(!Array.isArray(p)||!Array.isArray(y)||p.length!==2||y.length!==2)return!1;const v=1e-9;return Math.abs(Number(p[0])-Number(y[0]))<v&&Math.abs(Number(p[1])-Number(y[1]))<v}function So(p){if(!p)return null;let y=1/0,v=1/0,V=-1/0,N=-1/0;const H=te=>{if(Array.isArray(te)){if(te.length>=2&&Number.isFinite(te[0])&&Number.isFinite(te[1])){const oe=Number(te[0]),Se=Number(te[1]);y=Math.min(y,oe),v=Math.min(v,Se),V=Math.max(V,oe),N=Math.max(N,Se);return}te.forEach(H)}};return H(p.coordinates),!Number.isFinite(y)||!Number.isFinite(v)?null:[[y,v],[V,N]]}function $o(p){if(!D||!p)return;const y=So(p);if(!y)return;const[[v,V],[N,H]]=y;if(v===N&&V===H){D.easeTo({center:[v,V],zoom:Math.max(M.value,14)});return}D.fitBounds(y,{padding:30,duration:250,maxZoom:18})}function rr(){if(!K){d.value=0;return}const p=K.getAll();d.value=p?.features?.length??0}function Ht(){if(!K)return null;const y=K.getAll?.()?.features??[],v=H=>!!H&&y.some(te=>String(te?.id??"")===String(H??"")),V=K.getSelectedIds?.();if(Array.isArray(V)&&V.length>0){const H=V[0];return H!=null?String(H):null}if(v(Ve))return String(Ve);if(!y.length)return null;const N=a.value?y[y.length-1]:y[0];return N?.id!==void 0&&N?.id!==null?String(N.id):null}function qt(){if(!K)return;const p=K.getAll();if(d.value=p?.features?.length??0,!p?.features?.length){ke=[],x.value=[],Ze=null,Ve=null,h.value=null,re||(Oe="__null__",o("update:modelValue",null));return}const y=(p.features??[]).map(ze).filter(Boolean);if(ke=y,nr(y),Ve=Ht(),tr(Ve),!re){const v=We(y);Oe=St(v),o("update:modelValue",v)}}function kn(){if(!K)return;(K.getAll()?.features||[]).forEach(y=>K.delete(y.id)),x.value=[],rr()}function xn(p){if(!K)return;const y=je(p),v=a.value?y:y.slice(0,1);re=!0,kn(),v.forEach(H=>{try{K.add(H)}catch{}}),re=!1,ke=(K.getAll?.()?.features??v).map(ze).filter(Boolean),nr(ke),Ve=null;const N=Ee(ke[ke.length-1]?.geometry??null);Ze=Ee(N),rr(),er(N),N&&($o(N),s.value||ft())}function pg(){K&&(re=!0,kn(),ke.forEach(p=>{try{K.add(p)}catch{}}),re=!1,nr(ke),rr(),tr(Ve))}function $t(){if(K){try{K.changeMode("simple_select",{featureIds:[]})}catch{}u.value=""}}function wn(p){if(s.value||!K)return;f.isRulerActive.value&&f.closeRuler(),Je=!0,$t(),u.value=p;const y=p==="marker"?"draw_point":p==="polyline"?"draw_line_string":p==="rectangle"?"draw_rectangle":"draw_polygon";a.value||(re=!0,kn(),re=!1);try{K.changeMode(y)}catch{u.value=""}finally{requestAnimationFrame(()=>{Je=!1})}}function ft(p){if(s.value||!K||!K.getAll()?.features?.length)return;const v=p||Ht();if(v)try{K.changeMode("direct_select",{featureId:v}),Ve=v,tr(Ve),u.value="edit"}catch{u.value=""}}function fg(p){s.value||!K||!p||ft(p)}function mg(){if(!(s.value||!K)){if(a.value){const p=Ht();if(p)try{nt=!0,K.delete(p),nt=!1,qt();const y=Ht();y?ft(y):$t();return}catch{nt=!1}}$t(),kn(),ke=[],x.value=[],Ve=null,Oe="__null__",h.value=null,o("update:modelValue",null)}}function hg(){s.value||!Ze||$o(Ze)}function gg(p){if(!D||!z)return;const y=[p[1],p[0]];Te||(Te=new z.Marker({color:"#2563eb"})),Te.setLngLat(y).addTo(D),D.easeTo({center:y,zoom:13,duration:250})}function yg(){s.value||T.value?.click()}function bg(){s.value||(X.value=!X.value)}function No(p){if(!X.value)return;const y=G.value;y&&!y.contains(p.target)&&(X.value=!1)}function kg(){X.value=!1,yg()}function xg(){s.value||(we.value=[],X.value=!1,ne.value=!0)}function wg(){ne.value=!1,we.value=[]}function _g(){if(s.value||!K)return;const p=wi(ge.value.coordinates??"",ge.value.format||"decimal",ge.value.order||"lat-lon");if(!p.ok){we.value=p.errors,vg(p.errors);return}we.value=[],xn({type:"Polygon",coordinates:[p.ring]}),ne.value=!1,p.wasClosedAutomatically&&ue.notify({type:"info",title:"Імпорт координат",message:"Полігон був автоматично замкнений (перша і остання точки різнилися)."})}function vg(p){if(!p.length)return;const y=5;p.slice(0,y).forEach(v=>{const V=v.line>0?`Рядок ${v.line}`:"Загальна помилка";ue.notify({type:"warning",title:"Імпорт координат",message:`${V} — ${v.message}`})}),p.length>y&&ue.notify({type:"warning",title:"Імпорт координат",message:`Ще помилок: ${p.length-y}`})}function Cg(p){if(s.value||!K)return;X.value=!1;const y=p.target,v=y.files?.[0];if(!v)return;const V=new FileReader;V.onload=()=>{try{const N=JSON.parse(String(V.result));if(!je(N).length){ue.notify({type:"warning",title:"Імпорт файлу",message:"Файл не містить коректний GeoJSON-обʼєкт."});return}xn(N)}catch{ue.notify({type:"error",title:"Імпорт файлу",message:"Не вдалося прочитати файл. Перевірте формат GeoJSON/JSON."})}finally{y.value=""}},V.onerror=()=>{ue.notify({type:"error",title:"Імпорт файлу",message:"Помилка читання файлу."}),y.value=""},V.readAsText(v)}function Eg(){if(s.value||!K)return;const p=K.getAll(),y=new Blob([JSON.stringify(p,null,2)],{type:"application/json"}),v=URL.createObjectURL(y),V=document.createElement("a");V.href=v,V.download="data.geojson",V.click(),URL.revokeObjectURL(v)}return e.onMounted(async()=>{if(window.addEventListener("click",No,!0),!i.value)return;const p=await Ce();z=p.maplibregl,Q=p.MapboxDraw;const y=Ut();y&&(D=new z.Map({container:i.value,style:_e(y),center:[P.value[0],P.value[1]],zoom:M.value,attributionControl:!1}),g.value=D,D.addControl(new z.NavigationControl({showCompass:!0}),"bottom-right"),D.on("load",()=>{if(!(!Q||!D)){if(K=new Q({displayControlsDefault:!1,modes:{...Q.modes,draw_rectangle:kt()},controls:{point:!1,line_string:!1,polygon:!1,trash:!1},styles:jt}),D.addControl(K),D.on("click",v=>{if(f.isRulerActive.value){const N=v?.lngLat;if(!N)return;m.value?.addPoint?.({lat:N.lat,lng:N.lng});return}if(!K||s.value||u.value!=="edit")return;const V=sg(v?.point);!V||V===Ve||requestAnimationFrame(()=>{!K||s.value||ft(V)})}),D.on("draw.create",()=>{if(K&&!f.isRulerActive.value){if(!a.value){const v=K.getAll();if(v.features.length>1){const V=v.features[v.features.length-1];re=!0,v.features.slice(0,-1).forEach(N=>K.delete(N.id)),re=!1,V&&(re=!0,K.add(V),re=!1)}}qt(),ft()}}),D.on("draw.update",v=>{if(!rt&&!f.isRulerActive.value){if(v?.action==="move"){if(rt=!0,pg(),rt=!1,u.value==="edit"){const V=Ht(),N=V?vo(V):K?.getAll?.()?.features?.[0];if(N?.id)try{K.changeMode("direct_select",{featureId:N.id}),Ve=String(N.id)}catch{u.value=""}}return}qt()}}),D.on("draw.delete",()=>{de||nt||f.isRulerActive.value||u.value==="marker"||u.value==="polyline"||u.value==="polygon"||u.value==="rectangle"||(qt(),K?.getAll?.()?.features?.length||(Ve=null),u.value="",$t())}),D.on("draw.selectionchange",v=>{if(!K||rt||f.isRulerActive.value||u.value==="marker"||u.value==="polyline"||u.value==="polygon"||u.value==="rectangle")return;const V=v?.features?.[0]?.id!==void 0&&v?.features?.[0]?.id!==null?String(v.features[0].id):null;if(!s.value&&V){if(u.value==="edit"&&Ve===V)return;requestAnimationFrame(()=>{!K||s.value||ft(V)});return}const N=K.getSelectedIds?.(),H=Array.isArray(N)&&N.length>0?String(N[0]):null;if(!s.value&&H){if(u.value==="edit"&&Ve===H)return;requestAnimationFrame(()=>{!K||s.value||ft(H)});return}try{K.changeMode("simple_select",{featureIds:[]})}catch{}}),O.value!==void 0){const v=O.value;O.value=void 0,requestAnimationFrame(()=>{K&&xn(v)})}se(),ye.value.forEach(v=>{const V=ce[v];V&&q(V)}),be()}}),D.on("contextmenu",cg),D.on("zoomend",()=>{D&&(M.value=D.getZoom())}))}),e.onUnmounted(()=>{f.isRulerActive.value&&f.closeRuler(),window.removeEventListener("click",No,!0),Object.values(ce).forEach(p=>{D&&R(p)}),xt(),Te?.remove&&Te.remove(),Te=null,D?.remove&&D.remove(),D=null,K=null,g.value=null}),e.watch(()=>n.modelValue,p=>{if(!K){O.value=p;return}const y=We((a.value?je(p):je(p).slice(0,1))||[]),v=St(y);if(Oe&&v===Oe){Oe=null;return}Oe=null,xn(p)},{deep:!0}),e.watch(()=>L.value,p=>{const y=Array.isArray(p)?p:[],v=[],V=new Set;y.forEach((N,H)=>{if(!N)return;const te=gn(N,H);v.push(te),V.add(te);const oe={...N,id:te},Se=ce[te],Ye=Se?.visible??!!oe.visible;Se&&D&&R(Se),ce[te]={id:te,config:oe,visible:Ye,sourceId:`vs-ov-src-${te}`,layerIds:[],boundsIds:[],handlers:[]}}),Object.keys(ce).forEach(N=>{if(V.has(N))return;const H=ce[N];H&&D&&R(H),delete ce[N]}),ye.value=v,D&&(ye.value.forEach(N=>{const H=ce[N];H&&q(H)}),be())},{immediate:!0,deep:!0}),e.watch(()=>F.value,()=>{D&&(se(),ye.value.forEach(p=>{const y=ce[p];y&&q(y)}),be())},{deep:!0}),e.watch(()=>S.value,async p=>{if(W.value=[],!p){D&&(se(),ye.value.forEach(y=>{const v=ce[y];v&&q(v)}),be());return}try{const y=await fetch(`https://data.gki.com.ua/api-user/atu/${p}`);if(!y?.ok)return;const V=(await y.json())?.geometry?.coordinates;Array.isArray(V)&&V.length&&(W.value=V)}catch(y){console.error("Failed to fetch KATOTTG bounds",y)}finally{if(!D)return;se(),ye.value.forEach(y=>{const v=ce[y];v&&q(v)}),be()}},{immediate:!0}),e.watch(()=>B.value,p=>{if(!Array.isArray(p)||p.length!==2)return;const y=[Number(p[0]),Number(p[1])];if(Vo(P.value,y)||(P.value=[...y],!D))return;const v=D.getCenter?.();v&&Vo([v.lng,v.lat],P.value)||D.easeTo({center:[P.value[0],P.value[1]]})},{deep:!0}),e.watch(()=>$.value,p=>{typeof p=="number"&&(M.value=p,D&&D.setZoom(p))}),e.watch(s,p=>{p&&$t()}),e.watch(d,p=>{if(p>0){s.value||ft();return}Je||$t()}),e.watch(c,()=>{setTimeout(()=>{D?.resize&&D.resize()},50)}),(p,y)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",disabled:!c.value},[e.createElementVNode("div",{class:e.normalizeClass(["vs-map-wrapper relative w-full h-[400px]",{fullscreen:c.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:i,class:"w-full h-[calc(100%-28px)]"},null,512),Be.value.search||Be.value.import||Be.value.export?(e.openBlock(),e.createElementBlock("div",Ac,[Be.value.search?(e.openBlock(),e.createBlock(Li,{key:0,onGoToCoordinates:gg})):e.createCommentVNode("",!0),Be.value.import||Be.value.export?(e.openBlock(),e.createElementBlock("div",Fc,[e.createElementVNode("div",Mc,[Be.value.import?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"importMenuRef",ref:G,class:"relative"},[e.createElementVNode("button",{type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:bg,disabled:s.value},[y[8]||(y[8]=e.createTextVNode(" Імпорт ",-1)),e.createVNode(e.unref(j.ChevronDown),{class:e.normalizeClass(["h-4 w-4 transition-transform",{"rotate-180":X.value}])},null,8,["class"])],8,Dc),X.value?(e.openBlock(),e.createElementBlock("div",Lc,[Be.value.import?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"block w-full text-left px-3 py-2 hover:bg-gray-100 text-gray-900",onClick:kg}," З файлу ")):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"block w-full text-left px-3 py-2 hover:bg-gray-100 text-gray-900",onClick:xg}," З координат ")])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),Be.value.export?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:Eg,disabled:s.value||d.value===0}," Експорт ",8,Tc)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:T,type:"file",onChange:Cg,accept:".json,.geojson",class:"hidden",disabled:s.value},null,40,Ic)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createVNode(e.unref(ue.VsModal),{visible:ne.value,"onUpdate:visible":y[1]||(y[1]=v=>ne.value=v),title:"Імпорт координат полігону",size:"lg",teleport:"#modal"},{default:e.withCtx(()=>[e.createVNode(Qe,{schema:J,values:ge.value,"onUpdate:values":y[0]||(y[0]=v=>ge.value=v)},null,8,["values"]),e.createElementVNode("div",Rc,[e.createElementVNode("button",{type:"button",class:"px-3 py-2 rounded-md border border-gray-300 text-gray-700 text-sm hover:bg-gray-100",onClick:wg}," Скасувати "),e.createElementVNode("button",{type:"button",class:"px-3 py-2 rounded-md bg-blue-600 text-white text-sm hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed",onClick:_g,disabled:s.value}," Побудувати ",8,Oc)])]),_:1},8,["visible"]),e.createElementVNode("div",zc,[e.createElementVNode("div",Pc,[Be.value.point?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":u.value==="marker"}]),title:"Point",onClick:y[2]||(y[2]=v=>wn("marker")),disabled:s.value},[e.createVNode(e.unref(j.MapPin),{class:"h-4 w-4"})],10,jc)):e.createCommentVNode("",!0),Be.value.line?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":u.value==="polyline"}]),title:"Line",onClick:y[3]||(y[3]=v=>wn("polyline")),disabled:s.value},[e.createVNode(ai)],10,Uc)):e.createCommentVNode("",!0),Be.value.polygon?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":u.value==="polygon"}]),title:"Polygon",onClick:y[4]||(y[4]=v=>wn("polygon")),disabled:s.value},[e.createVNode(di)],10,Hc)):e.createCommentVNode("",!0),Be.value.rectangle?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":u.value==="rectangle"}]),title:"Rectangle",onClick:y[5]||(y[5]=v=>wn("rectangle")),disabled:s.value},[e.createVNode(mi)],10,qc)):e.createCommentVNode("",!0),Be.value.ruler?(e.openBlock(),e.createElementBlock("button",{key:4,class:e.normalizeClass(["vs-btn mt-3",{"vs-active":e.unref(f).isRulerActive.value}]),title:"Ruler",onClick:b},[e.createVNode(e.unref(j.Ruler),{class:"h-4 w-4"})],2)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:y[6]||(y[6]=v=>c.value=!c.value),title:"Full Screen"},[e.createVNode(e.unref(j.Maximize),{class:"h-4 w-4"})])])]),Be.value.ruler&&e.unref(f).isRulerActive.value?(e.openBlock(),e.createBlock(Sc,{key:1,ref_key:"rulerPanelRefEl",ref:m,onClose:y[7]||(y[7]=v=>e.unref(f).closeRuler()),onTabChange:e.unref(f).onRulerTabChange,onPointsChange:e.unref(f).onRulerPointsChange,onShapeClosedChange:e.unref(f).onRulerShapeClosedChange},null,8,["onTabChange","onPointsChange","onShapeClosedChange"])):e.createCommentVNode("",!0),Be.value.ruler&&e.unref(f).isRulerActive.value&&e.unref(f).hasRulerPoints.value?(e.openBlock(),e.createBlock($c,{key:2,map:g.value,points:e.unref(f).rulerPoints.value,"is-shape-closed":e.unref(f).rulerShapeClosed.value,"label-mode":e.unref(f).rulerActiveTab.value},null,8,["map","points","is-shape-closed","label-mode"])):e.createCommentVNode("",!0),tt.value.length?(e.openBlock(),e.createElementBlock("div",{key:3,class:"absolute z-[1500] pointer-events-none",style:e.normalizeStyle(it.value)},[e.createElementVNode("div",Gc,[e.createElementVNode("dl",Kc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(tt.value,v=>(e.openBlock(),e.createElementBlock("div",{key:`${v.key}-${v.value}`,class:"flex justify-between gap-2"},[e.createElementVNode("dt",Wc,e.toDisplayString(v.key),1),e.createElementVNode("dd",Yc,e.toDisplayString(v.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",Xc,[e.createElementVNode("div",Zc,[e.createVNode(ki,{basemaps:e.unref(ee),onOnLayerChange:ve},null,8,["basemaps"]),Le.value.length?(e.openBlock(),e.createElementBlock("div",Jc,[y[9]||(y[9]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),e.createElementVNode("div",Qc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Le.value,v=>(e.openBlock(),e.createElementBlock("label",{key:v.id,class:"flex items-center gap-2 cursor-pointer select-none"},[e.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:v.visible,disabled:s.value,onChange:V=>xe(v.id)},null,40,ed),e.createElementVNode("span",td,e.toDisplayString(v.config.title||v.config.name||v.id),1)]))),128))])])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",nd,[x.value.length||h.value?(e.openBlock(),e.createElementBlock("div",rd,[e.createElementVNode("div",od,[e.createElementVNode("div",ld,[y[10]||(y[10]=e.createTextVNode(" Тип: ",-1)),x.value.length<=1?(e.openBlock(),e.createElementBlock("span",ad,e.toDisplayString(h.value?Bo(h.value.type):x.value[0]?.label||"—"),1)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(x.value,(v,V)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:v.id},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["font-bold underline-offset-2",v.id===e.unref(Ve)?"text-blue-700 underline":"text-gray-700 hover:text-blue-700 hover:underline"]),onClick:N=>fg(v.id),disabled:s.value},e.toDisplayString(v.label),11,sd),V<x.value.length-1?(e.openBlock(),e.createElementBlock("span",id,", ")):e.createCommentVNode("",!0)],64))),128))])]),e.createElementVNode("div",cd,[e.createElementVNode("div",dd,[y[11]||(y[11]=e.createTextVNode(" Центр: ",-1)),h.value?(e.openBlock(),e.createElementBlock("b",ud,e.toDisplayString(h.value.center.lng.toFixed(5))+", "+e.toDisplayString(h.value.center.lat.toFixed(5)),1)):(e.openBlock(),e.createElementBlock("b",pd,"—"))]),h.value&&h.value.areaKm2!==null?(e.openBlock(),e.createElementBlock("div",fd,[y[12]||(y[12]=e.createTextVNode(" Площа: ",-1)),e.createElementVNode("b",null,e.toDisplayString(h.value.areaKm2.toFixed(1))+" km²",1)])):(e.openBlock(),e.createElementBlock("div",md,y[13]||(y[13]=[e.createTextVNode("Площа: ",-1),e.createElementVNode("b",null,"—",-1)]))),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:hg,disabled:s.value},[e.createVNode(e.unref(j.ZoomIn),{class:"h-3 w-3"})],8,hd),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Delete feature",onClick:mg,disabled:s.value},[e.createVNode(e.unref(j.Trash2),{class:"h-4 w-4"})],8,gd)])])):e.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-2e34d977"]]),yd=["data-focus"],bd={class:"flex items-center"},kd={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},xd=["onClick","aria-label"],wd={key:0,class:"absolute text-gray-500 truncate pl-2"},_d={class:"flex-1 min-w-[2px]"},vd=["placeholder"],Cd={class:"flex items-center shrink-0"},Ed=["disabled"],_r=e.defineComponent({__name:"vs-input-tag",props:e.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(r,{emit:t}){const n=r,o=t;Ie(n.style);const l=e.ref(null),a=e.ref(null),s=e.ref(null),c=e.ref(!1),i=e.ref(""),d=e.useModel(r,"modelValue"),u=e.computed(()=>n.placeholder||"Add tag…"),h=e.computed(()=>d.value?.length===0&&i.value===""),x=e.computed(()=>!n.disabled&&d.value?.length>0),g=e.computed(()=>n.disabled),m=async()=>{g.value||await e.nextTick(()=>s.value?.focus())},f=I=>{const A=I.trim();A!==""&&(!d.value||!Array.isArray(d.value)?d.value=[A]:n.unique?d.value.includes(A)||(d.value=[...d.value,A]):d.value=[...d.value,A],i.value="")},b=()=>{const I=i.value;I.trim()!==""&&f(I),i.value=""},w=I=>{const A=d.value.slice();A.splice(I,1),o("update:modelValue",A)},_=()=>{o("update:modelValue",[])},k=()=>{g.value||(c.value=!0)},C=()=>{c.value=!1,!g.value&&b()},E=I=>{const{key:A}=I;A==="Enter"?(I.preventDefault(),b()):A==="Backspace"&&i.value===""&&d.value.length>0&&w(d.value.length-1)};return(I,A)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:l,onClick:A[1]||(A[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass]),role:"group","aria-label":"Tag input"},[e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",c.value?"border-blue-500 ring-1 ring-blue-500":"",g.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":c.value?"true":"false",onClick:m},[e.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:a},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(B,$)=>(e.openBlock(),e.createElementBlock("div",{key:$,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",bd,[e.createElementVNode("div",kd,e.toDisplayString(B),1)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:e.withModifiers(S=>w($),["stop"]),"aria-label":`Remove ${B}`},[e.createVNode(e.unref(j.X),{"aria-hidden":"true",focusable:"false",class:"inline-block h-4 w-4"})],8,xd)]))),128)),h.value?(e.openBlock(),e.createElementBlock("div",wd,e.toDisplayString(u.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",_d,[g.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:s,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":A[0]||(A[0]=B=>i.value=B),onFocus:k,onBlur:C,onKeydown:E,placeholder:d.value&&d.value.length?"":void 0},null,40,vd)),[[e.vModelText,i.value]])])],512),e.createElementVNode("div",Cd,[x.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:g.value,onClick:e.withModifiers(_,["stop"])},[e.createVNode(e.unref(j.X),{class:"h-4 w-4"})],8,Ed)):e.createCommentVNode("",!0)])],10,yd)],2)],512))}}),Bd={class:"relative flex gap-1 bg-white w-full"},Vd=["disabled","placeholder"],vr=me(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=e.inject("values"),n=r,o=e.useModel(r,"modelValue");function l(s){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 s.toLowerCase().split("").map(i=>c[i]||i).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const a=()=>{const s=t?.value?.[n.parent||""]?.toString(),c=l(s);o.value=c.toString()};return(s,c)=>(e.openBlock(),e.createElementBlock("div",Bd,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:s.disabled,placeholder:s.placeholder,"onUpdate:modelValue":c[0]||(c[0]=i=>o.value=i),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,Vd),[[e.vModelText,o.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:a}," Gen ")]))}}),[["__scopeId","data-v-b0eba370"]]),Sd={class:"relative flex gap-1 bg-white w-full"},$d=["disabled","placeholder"],Nd=["disabled"],Ad={key:0},Fd={key:1},Cr=me(e.defineComponent({__name:"vs-input-codegen",props:e.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),o=e.ref(!1),l=e.computed(()=>t.init!==!1),a=e.computed(()=>!!t.table&&!!t.code),s=()=>{if(!a.value)return"";const d=encodeURIComponent(String(t.table)),u=encodeURIComponent(String(t.code));return`/api/code-gen/${d}/${u}`},c=async()=>{if(!a.value||o.value)return;const d=s();if(d){o.value=!0;try{const h=await(await fetch(d)).text();n.value=h}finally{o.value=!1}}},i=()=>{l.value&&(n.value||c())};return e.onMounted(()=>{i()}),e.watch(()=>[t.table,t.code,t.init],()=>{i()}),(d,u)=>(e.openBlock(),e.createElementBlock("div",Sd,[e.withDirectives(e.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":u[0]||(u[0]=h=>n.value=h),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,$d),[[e.vModelText,n.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:o.value||d.disabled||!a.value,onClick:c},[o.value?(e.openBlock(),e.createElementBlock("span",Fd,"...")):(e.openBlock(),e.createElementBlock("span",Ad,"Gen"))],8,Nd)]))}}),[["__scopeId","data-v-6ee5237d"]]),Md={class:"w-full"},Dd={ref:"sortableContainer",class:"flex flex-col gap-1"},Ld=["onDragstart","onDrop"],Td={class:"cursor-move",type:"button"},Id={class:"w-1/3"},Rd={class:"w-2/3"},Od=["onClick"],zd={key:0,class:"text-[14px] text-gray-700"},Pd={class:"mt-2 w-full flex items-center"},jd=["disabled"],Er=me(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=b=>`${b}-${Math.random().toString(36).substring(2,15)}`,o=e.inject("values"),l=r,a=t,s=l.addButtonText??"Додати",c=l.ignore??[],i=e.ref([]),d=e.ref(null);(()=>{const b=l.parent&&o?.value?.[l.parent]||l.modelValue||{};i.value=Object.entries(b).filter(([w])=>!c.includes(w)).map(([w,_])=>({id:n("key-value-"),key:w,value:_}))})();function h(b){d.value=b}function x(b){if(d.value===null||d.value===b)return;const w=i.value.splice(d.value,1)[0];i.value.splice(b,0,w),d.value=null}const g=e.computed(()=>i.value.some(b=>b.key&&!b.value||!b.key&&b.value)),m=()=>{i.value.push({id:n("key-value-"),key:"",value:""})},f=b=>{i.value=i.value.filter(w=>w.id!==b)};return e.watch(i,b=>{const w={};b.forEach(k=>{k.key&&k.value!==void 0&&(w[k.key]=k.value)});const _={};c.length&&c.forEach(k=>{_[k]=l.parent?o?.value?.[l.parent]?.[k]:void 0}),o?.value&&l.parent&&(o.value[l.parent]={..._,...w}),a("update:modelValue",w)},{deep:!0}),(b,w)=>(e.openBlock(),e.createElementBlock("div",Md,[e.createElementVNode("div",Dd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(_,k)=>(e.openBlock(),e.createElementBlock("div",{key:_.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===k}]),draggable:"true",onDragstart:C=>h(k),onDragover:w[0]||(w[0]=e.withModifiers(()=>{},["prevent"])),onDrop:C=>x(k)},[e.createElementVNode("button",Td,[e.createVNode(e.unref(j.GripVertical),{class:"h-4 w-4"})]),e.createElementVNode("div",Id,[e.createVNode(Et,{modelValue:_.key,"onUpdate:modelValue":C=>_.key=C,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Rd,[e.createVNode(Et,{modelValue:_.value,"onUpdate:modelValue":C=>_.value=C,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:C=>f(_.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[e.createVNode(e.unref(j.X),{class:"h-4 w-4"})],8,Od)],42,Ld))),128))],512),i.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",zd," Дані для відображення відсутні ")),e.createElementVNode("div",Pd,[e.createElementVNode("button",{type:"button",onClick:m,disabled:g.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(e.unref(j.Plus),{class:"h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(e.unref(s)),1)],8,jd)])]))}}),[["__scopeId","data-v-d8c3f9d6"]]),Ud={class:"w-full"},Hd={ref:"sortableContainer",class:"flex flex-col gap-1"},qd=["onDragstart","onDrop"],Gd=["disabled"],Kd={class:"flex-1"},Wd=["onClick","disabled"],Yd={key:0,class:"text-[14px] text-gray-700"},Xd={class:"mt-2 w-full flex items-center"},Zd=["disabled"],Br=me(e.defineComponent({__name:"vs-input-text-array",props:e.mergeModels({addButtonText:{default:"Додати"},inputType:{default:"text"},placeholder:{default:"Значення"},mask:{default:""},disabled:{type:Boolean,default:!1}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),o=e.ref([]),l=e.ref(null),a=e.computed(()=>!!t.disabled),s=e.computed(()=>t.placeholder??""),c=e.computed(()=>t.addButtonText??"Додати");let i=!1;const d=b=>`${b}-${Math.random().toString(36).substring(2,15)}`,u=b=>{const w=b??n.value??[];o.value=w.map((_,k)=>({id:o.value[k]?.id??d("text-array"),value:_??""}))};u(),e.watch(()=>n.value,b=>{if(i){i=!1;return}u(b||[])},{deep:!0}),e.watch(o,b=>{i=!0,n.value=b.map(w=>w.value).filter(w=>w!=null&&w!=="")},{deep:!0});const h=e.computed(()=>a.value||o.value.some(b=>!b.value));function x(){h.value||(o.value=[...o.value,{id:d("text-array"),value:""}])}function g(b){a.value||(o.value=o.value.filter(w=>w.id!==b))}function m(b){a.value||(l.value=b)}function f(b){if(a.value||l.value===null||l.value===b)return;const w=[...o.value],[_]=w.splice(l.value,1);w.splice(b,0,_),o.value=w,l.value=null}return(b,w)=>(e.openBlock(),e.createElementBlock("div",Ud,[e.createElementVNode("div",Hd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(_,k)=>(e.openBlock(),e.createElementBlock("div",{key:_.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":l.value===k}]),draggable:"true",onDragstart:C=>m(k),onDragover:w[0]||(w[0]=e.withModifiers(()=>{},["prevent"])),onDrop:C=>f(k)},[e.createElementVNode("button",{class:"cursor-move",type:"button",disabled:a.value},[e.createVNode(e.unref(j.GripVertical),{class:"h-4 w-4"})],8,Gd),e.createElementVNode("div",Kd,[b.inputType==="text"?(e.openBlock(),e.createBlock(Et,{key:0,modelValue:_.value,"onUpdate:modelValue":C=>_.value=C,disabled:a.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),b.inputType==="tel"?(e.openBlock(),e.createBlock(Vn,{key:1,modelValue:_.value,"onUpdate:modelValue":C=>_.value=C,disabled:a.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),b.inputType==="email"?(e.openBlock(),e.createBlock(Bn,{key:2,modelValue:_.value,"onUpdate:modelValue":C=>_.value=C,disabled:a.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),b.inputType==="mask"?(e.openBlock(),e.createBlock(En,{key:3,modelValue:_.value,"onUpdate:modelValue":C=>_.value=C,mask:b.mask,disabled:a.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","mask","disabled","placeholder"])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:C=>g(_.id),disabled:a.value,class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200 disabled:opacity-50"},[e.createVNode(e.unref(j.X),{class:"h-4 w-4"})],8,Wd)],42,qd))),128))],512),o.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Yd," Дані для відображення відсутні ")),e.createElementVNode("div",Xd,[e.createElementVNode("button",{type:"button",onClick:x,disabled:h.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(e.unref(j.Plus),{class:"h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(c.value),1)],8,Zd)])]))}}),[["__scopeId","data-v-2c229b1f"]]),Jd={class:"flex items-center gap-2 w-full"},Qd=["disabled"],eu=["disabled"],Vr=e.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,{inputClass:o}=Ie(n.style),l=t,a=e.computed({get:()=>n.modelValue||"#000000",set:c=>l("update:modelValue",c)}),s=e.computed(()=>!!n.disabled);return(c,i)=>(e.openBlock(),e.createElementBlock("div",Jd,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),disabled:s.value,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[c.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Qd),[[e.vModelText,a.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":i[1]||(i[1]=d=>a.value=d),disabled:s.value},null,8,eu),[[e.vModelText,a.value]])]))}}),tu={class:"flex items-center gap-2 w-full"},nu=["min","max","step","disabled"],ru=["disabled"],Sr=e.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,{inputClass:o}=Ie(n.style),l=t,a=e.computed({get:()=>Number(n.modelValue??n.min),set:c=>l("update:modelValue",Number(c))}),s=e.computed(()=>!!n.disabled);return(c,i)=>(e.openBlock(),e.createElementBlock("div",tu,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),min:c.min,max:c.max,step:c.step,disabled:s.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[c.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")])},null,10,nu),[[e.vModelText,a.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":i[1]||(i[1]=d=>a.value=d),disabled:s.value},null,8,ru),[[e.vModelText,a.value]])]))}}),ou=["placeholder","disabled","name"],lu=["type","value","onInput","placeholder","disabled"],au=["onClick"],$r=e.defineComponent({__name:"vs-input-array",props:e.mergeModels({count:{default:1},limit:{default:1},mask:{default:""},unmask:{type:Boolean,default:!1},inputType:{default:"text"},isAdded:{type:Boolean,default:!1},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.ref(t.count),o=e.computed(()=>t.limit),{inputClass:l}=Ie(t.style),a=e.useModel(r,"modelValue"),s=e.computed(()=>!!t.disabled),c=e.computed(()=>t.placeholder??"");e.watchEffect(()=>{const f=a.value?.length??0;f<n.value&&(a.value=[...a.value??[],...Array(n.value-f)])});const i=e.ref({}),d=e.ref({});function u(f,b){f&&(i.value[b]=f)}async function h(f,b){if(!f||t.inputType!=="mask")return;const{default:w}=await Promise.resolve().then(()=>qn);d.value[b]&&d.value[b].destroy(),d.value[b]=w(f,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),d.value[b].on("accept",()=>{const _=[...a.value||[]];_[b]=t.unmask?d.value[b].unmaskedValue:d.value[b].value,a.value=_}),d.value[b].on("complete",()=>{const _=[...a.value||[]];_[b]=t.unmask?d.value[b].unmaskedValue:d.value[b].value,a.value=_}),a.value?.[b]&&(d.value[b].value=a.value[b])}function x(f,b){if(s.value)return;const w=f.target.value??null,_=[...a.value];_[b]=t.inputType==="text"?w:Number(w),a.value=_}function g(){n.value+=1;const f=t.inputType==="text"||t.inputType==="mask"?null:0;a.value=[...a.value,f],t.inputType==="mask"&&setTimeout(()=>{const b=n.value-1;i.value[b]&&h(i.value[b],b)},0)}function m(f){if(n.value>1){d.value[f]&&(d.value[f].destroy(),delete d.value[f]),n.value-=1,a.value=a.value.filter((w,_)=>_!==f);const b={};Object.keys(d.value).forEach(w=>{const _=parseInt(w,10);_>f?b[_-1]=d.value[_]:_<f&&(b[_]=d.value[_])}),d.value=b}}return e.onMounted(()=>{if(t.inputType==="mask")for(let f=0;f<n.value;f+=1)i.value[f]&&h(i.value[f],f)}),e.onBeforeUnmount(()=>{Object.values(d.value).forEach(f=>{f&&f.destroy()})}),e.watch(()=>t.mask,f=>{t.inputType==="mask"&&Object.values(d.value).forEach(b=>{b&&b.updateOptions({mask:f,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})})}),e.watch(a,f=>{t.inputType==="mask"&&f&&f.forEach((b,w)=>{d.value[w]&&d.value[w].value!==b&&(d.value[w].value=b||"")})},{deep:!0}),(f,b)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["grid gap-2",`grid-cols-${o.value}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,w=>(e.openBlock(),e.createElementBlock("div",{key:w,class:"flex items-center gap-2 w-full"},[f.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:_=>u(_,w-1),placeholder:f.placeholder,disabled:f.disabled,name:`${f.name}[${w-1}]`,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(l),{"!border-red-600":f.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,ou)):(e.openBlock(),e.createElementBlock("input",{key:1,type:f.inputType,value:a.value?.[w-1],onInput:_=>x(_,w-1),placeholder:c.value,disabled:s.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(l),{"!border-red-600":f.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,lu)),!f.disabled&&w===n.value&&f.isAdded?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:e.withModifiers(g,["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-green-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(e.unref(j.Plus),{class:"h-4 w-4"})])):e.createCommentVNode("",!0),!f.disabled&&n.value>1&&f.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(_=>m(w-1),["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-red-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(e.unref(j.X),{class:"h-4 w-4"})],8,au)):e.createCommentVNode("",!0)]))),128))],2))}}),su=["aria-expanded","data-focus"],iu=["placeholder","disabled","readonly"],cu={class:"max-h-full"},du=["onClick","disabled"],uu={key:0,class:"px-3 py-2 text-sm text-stone-500"},pu={class:"flex flex-col gap-1"},fu=["onDragstart","onDrop"],mu=["disabled"],hu=["title"],gu=["disabled","onClick","aria-label"],yu={key:0,class:"text-xs text-stone-500"},en=me(e.defineComponent({__name:"vs-input-array-select",props:e.mergeModels({options:{default:()=>[]},data:{default:""},api:{default:""},prefix:{default:"api"},host:{default:""},parent:{},search:{type:Boolean,default:!0},maxHeight:{default:280},start:{default:0},slot:{},disabled:{type:Boolean,default:!1},style:{},customClass:{},modelValue:{},error:{},name:{},placeholder:{default:"Оберіть значення"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["change","update:modelValue","value-selected"],["update:modelValue"]),setup(r,{emit:t}){const n=r,o=t,l=e.useModel(r,"modelValue"),a=e.ref([]),s=e.ref(n.options??[]),c=e.ref({}),i=e.ref({}),d=e.ref({keyword:"",parent:null}),u=e.ref(""),h=e.ref(!1),x=e.ref(null),g=e.ref(null),m=e.ref(null),f=e.ref(null),b=e.ref(null),w=e.ref({});let _=!1,k=!1;const C=e.inject("values"),E=e.computed(()=>!!n.disabled),I=e.computed(()=>n.placeholder??"Оберіть значення"),A=e.computed(()=>n.search!==!1),B=e.computed(()=>{const z=n.parent??n.parentValue;return z?String(z):""}),$=e.computed(()=>B.value?C?.value?.[B.value]??null:null),S=z=>z==null?"__null__":String(z),L=z=>{if(!z)return"";const Q=z.label??z.text??z.name??z.ua??z.en;return Q?String(Q):z.id!==void 0&&z.id!==null?String(z.id):""},F=z=>{const Q=S(z);return i.value[Q]||(i.value[Q]=`array-select-${Q}-${Math.random().toString(36).slice(2,8)}`),i.value[Q]},P=e.computed(()=>new Set(a.value.map(z=>S(z.id)))),M=e.computed(()=>{const z=P.value;let Q=[...s.value];if(!n.data&&u.value.trim()){const D=u.value.toLowerCase();Q=Q.filter(K=>L(K).toLowerCase().includes(D))}return Q.filter(D=>!z.has(S(D.id)))}),O=()=>{if(!n.data)return"";const z=n.prefix??"api",Q=n.api??`/${z}/suggest/${n.data}`;return`${n.host??""}${Q}`},T=()=>{a.value.length&&(_=!0,a.value=a.value.map(z=>({...z,text:c.value[S(z.id)]??z.text})))},G=z=>{const Q=S(z.id),D=L(z);D&&(c.value[Q]=D)},W=z=>{s.value=z?[...z]:[],z?.forEach(G),T()},X=z=>{if(!z.length)return;const Q=new Map(s.value.map(D=>[S(D.id),D]));z.forEach(D=>{const K=S(D.id);Q.set(K,D),G(D)}),s.value=Array.from(Q.values()),T()},ne=async(z="")=>{if(!n.data)return[];const Q=O();if(!Q)return[];const D=new URLSearchParams;D.set("json","1"),z&&D.set("key",z),n.start===1&&D.set("start","1"),$.value!==null&&$.value!==void 0&&$.value!==""&&D.set("parent",String($.value));try{return(await(await fetch(`${Q}?${D.toString()}`)).json())?.data??[]}catch{return[]}},we=async z=>{if(!n.data||!z.length)return[];const Q=O();if(!Q)return[];const D=Array.from(new Set(z.map(ke=>S(ke)))),K=new URLSearchParams;K.set("json","1"),K.set("val",D.join(",")),n.start===1&&K.set("start","1"),$.value!==null&&$.value!==void 0&&$.value!==""&&K.set("parent",String($.value));try{const Oe=(await(await fetch(`${Q}?${K.toString()}`)).json())?.data??[];return X(Oe),Oe}catch{return[]}},ge=async(z="",{force:Q=!1}={})=>{if(!n.data)return;const D=$.value??null;if(!Q&&d.value.keyword===z&&d.value.parent===D&&s.value.length>0)return;d.value={keyword:z,parent:D};const ke=await ne(z);W(ke)},re=((z,Q=200)=>{let D;return(...K)=>{D&&clearTimeout(D),D=setTimeout(()=>z(...K),Q)}})(async z=>{n.data&&await ge(z,{force:!0})},250),de=e.ref(null),ce=()=>{if(!m.value)return;const z=m.value.getBoundingClientRect(),Q=window.innerHeight??document.documentElement.clientHeight,D=window.innerWidth??document.documentElement.clientWidth,K=8,ke=8,Ze=n.maxHeight??280,Oe=Q-z.bottom-ke-K,Ve=z.top-ke-K,nt=Oe>=Ve,rt=Math.max(D-K*2,0);let{width:Je}=z;rt>0&&Je>rt&&(Je=rt);let{left:Te}=z;Te+Je+K>D&&(Te=D-Je-K),Te=Math.max(Te,K);const kt=Math.min(Ze,Math.max(nt?Oe:Ve,50));w.value={position:"fixed",left:`${Te}px`,width:`${Je}px`,maxHeight:`${kt}px`,transform:nt?"none":"translateY(-100%)",top:nt?`${z.bottom+ke}px`:`${z.top-ke}px`}},ye=async(z="click")=>{E.value||h.value||(de.value=z,await ge(u.value.trim()),h.value=!0,await e.nextTick(),ce(),b.value?.focus())},Le=()=>{h.value=!1,de.value=null,e.nextTick(()=>{b.value?.blur()})},$e=async z=>{if(z.stopPropagation(),!E.value){if(h.value){if(de.value==="focus"){de.value=null;return}Le();return}await ye("click")}},tt=z=>{z.key==="Escape"&&Le()},it=z=>{if(!h.value)return;const Q=z.target;f.value?.contains(Q)||Le()},Re=z=>{const Q=z.target;g.value?.contains(Q)||f.value?.contains(Q)||Le()},Be=z=>{if(z.key==="Escape"){z.preventDefault(),Le();return}if(z.key==="Enter"){z.preventDefault();const Q=M.value[0];Q&&U(Q)}},U=z=>{if(!z)return;const Q=S(z.id);if(P.value.has(Q))return;G(z);const D={id:z.id,text:L(z)||String(z.id??""),key:F(z.id)};a.value=[...a.value,D],Z(z),u.value="",e.nextTick(()=>{b.value?.focus()})},Z=z=>{const Q=a.value.map(D=>D.id);o("value-selected",{name:n.name,value:Q,option:z})},ee=z=>{if(E.value)return;const Q=a.value.filter(D=>S(D.id)!==S(z));a.value=Q},ae=z=>{E.value||(x.value=z)},ie=z=>{if(E.value||x.value===null||x.value===z)return;const Q=[...a.value],[D]=Q.splice(x.value,1);Q.splice(z,0,D),x.value=null,a.value=Q},Ce=async()=>{const Q=(Array.isArray(l.value)?[...l.value]:[]).filter(K=>K!=null);if(n.data&&Q.length){const K=Q.filter(ke=>!c.value[S(ke)]);K.length&&await we(K)}const D=Q.map(K=>({id:K,text:c.value[S(K)]??String(K),key:F(K)}));_=!0,a.value=D};e.watch(a,z=>{if(_){_=!1;return}const Q=z.map(D=>D.id);k=!0,l.value=Q,o("change",Q)},{deep:!0}),e.watch(l,()=>{if(k){k=!1;return}Ce()},{deep:!0}),e.watch(u,z=>{!n.data||!h.value||re(z.trim())}),e.watch(E,z=>{z&&Le()}),e.watch(()=>n.options,async z=>{n.data||(W(z??[]),await Ce())},{immediate:!0,deep:!0}),e.watch(()=>n.data,async z=>{z&&(await ge(u.value.trim()),await Ce())},{immediate:!0});const _e=e.ref(!1);return e.watch($,async()=>{if(n.data){if(!_e.value){_e.value=!0;return}a.value=[],await ge(u.value.trim()),await Ce()}}),e.onMounted(async()=>{document.addEventListener("click",Re,!0),window.addEventListener("keydown",tt),window.addEventListener("scroll",it,!0),await Ce()}),e.onUnmounted(()=>{document.removeEventListener("click",Re,!0),window.removeEventListener("keydown",tt),window.removeEventListener("scroll",it,!0)}),(z,Q)=>(e.openBlock(),e.createElementBlock("div",{class:"flex flex-col gap-2 w-full",ref_key:"rootRef",ref:g},[e.createElementVNode("div",{class:"relative",onClick:Q[2]||(Q[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{ref_key:"triggerRef",ref:m,class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white px-3","border-gray-300 hover:border-[#b3d4ff]",h.value?"border-[#2684ff] ring-1 ring-[#2684ff] shadow-[0_0_0_1px_rgba(38,132,255,0.5)]":"",E.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":h.value,"aria-haspopup":"listbox","data-focus":h.value?"true":"false",onClick:$e},[e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:b,"onUpdate:modelValue":Q[0]||(Q[0]=D=>u.value=D),placeholder:I.value,disabled:E.value,readonly:!A.value,onFocus:Q[1]||(Q[1]=()=>ye("focus")),onKeydown:Be,class:"flex-1 bg-transparent border-0 outline-none px-0 py-1 text-sm text-stone-900 placeholder:text-stone-400"},null,40,iu),[[e.vModelText,u.value]]),e.createElementVNode("span",{class:e.normalizeClass(["text-stone-400 transition-transform duration-150",h.value?"rotate-180":""]),"aria-hidden":"true"},[e.createVNode(e.unref(j.ChevronDown),{class:"h-4 w-4"})],2)],10,su),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[h.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:f,class:"fixed z-[3000] rounded-md border border-stone-200 bg-white shadow-lg overflow-auto",style:e.normalizeStyle(w.value)},[e.createElementVNode("div",cu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,D=>(e.openBlock(),e.createElementBlock("button",{key:S(D.id),type:"button",class:"w-full px-3 py-2 text-left text-sm text-stone-900 hover:bg-stone-100 disabled:opacity-50",onClick:e.withModifiers(K=>U(D),["stop"]),disabled:E.value},e.toDisplayString(L(D)),9,du))),128)),M.value.length===0?(e.openBlock(),e.createElementBlock("p",uu," Немає варіантів ")):e.createCommentVNode("",!0)])],4)):e.createCommentVNode("",!0)]),_:1})]))]),e.createElementVNode("div",pu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(D,K)=>(e.openBlock(),e.createElementBlock("div",{key:D.key,class:e.normalizeClass(["flex items-center gap-2 rounded-md border border-stone-200 bg-white px-2 py-2",{"opacity-60":x.value===K}]),draggable:"true",onDragstart:ke=>ae(K),onDragover:Q[3]||(Q[3]=e.withModifiers(()=>{},["prevent"])),onDrop:ke=>ie(K),onDragend:Q[4]||(Q[4]=ke=>x.value=null)},[e.createElementVNode("button",{type:"button",class:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-stone-500 hover:text-stone-900",disabled:E.value,"aria-label":"Перетягнути"},[e.createVNode(e.unref(j.GripVertical),{class:"h-4 w-4"})],8,mu),e.createElementVNode("div",{class:"flex-1 text-sm text-stone-900",title:D.text},e.toDisplayString(D.text),9,hu),e.createElementVNode("button",{type:"button",class:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-stone-400 hover:text-stone-900",disabled:E.value,onClick:e.withModifiers(ke=>ee(D.id),["stop"]),"aria-label":`Видалити ${D.text}`},[e.createVNode(e.unref(j.X),{class:"h-4 w-4"})],8,gu)],42,fu))),128)),a.value.length===0?(e.openBlock(),e.createElementBlock("p",yu,"Немає вибраних значень")):e.createCommentVNode("",!0)])],512))}}),[["__scopeId","data-v-56e6cd88"]]),bu={class:"flex items-center gap-2 w-full"},ku={class:"relative flex-1"},xu=["placeholder","disabled","onKeydown"],wu=["disabled"],_u={key:0,class:"fixed inset-0 z-[1000] flex items-center justify-center bg-black/50"},vu={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},Cu={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},Eu=["onClick"],Bu={key:0,class:"p-4 text-sm text-gray-500"},Nr=e.defineComponent({__name:"vs-input-address",props:e.mergeModels({api:{default:""},geom:{default:""},includes:{default:()=>[]},bbox:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(r,{emit:t}){const n=/{{\s*([^}]+?)\s*}}/g,o=r,l=t,{inputClass:a}=Ie(o.style),s=e.useModel(r,"modelValue"),c=e.computed({get:()=>s.value,set:A=>{s.value=A}}),i=e.ref(!1),d=e.ref([]),u=e.ref(!1),h=e.ref(null);e.watch(u,A=>{typeof document>"u"||(A?(h.value=document.body.style.overflow,document.body.style.overflow="hidden"):h.value!=null?(document.body.style.overflow=h.value,h.value=null):document.body.style.removeProperty("overflow"))}),e.onBeforeUnmount(()=>{typeof document>"u"||(h.value!=null?document.body.style.overflow=h.value:document.body.style.removeProperty("overflow"))});const x=e.computed(()=>o.placeholder??""),g=e.computed(()=>!!o.disabled),m=A=>{if(!A)return null;if(Array.isArray(A))return A;if(typeof A=="string"){const B=A.split(",").map($=>$.trim()).filter(Boolean);return B.length!==4?null:B.map(Number)}return null},f=e.computed(()=>{const A=m(o.bbox);if(!A||A.length!==4)return null;const B=A.map(Number);return B.some($=>Number.isNaN($))?null:B}),b=e.computed(()=>{const A=f.value;if(!A)return"";const[B,$,S,L]=A;return`${B},${Math.max($,L)},${S},${Math.min($,L)}`});e.computed(()=>b.value?"1":"0");const w=e.inject("values");function _(){!g.value&&c.value.trim()&&k()}async function k(){const A=(c.value||"").trim();if(!A)return;let B=A;if(o.includes?.length&&w?.value){const S=o.includes.map(L=>w.value?.[L]).filter(Boolean);S.length&&(B=`${S.join(", ")}, ${A}`)}const $=I(B);if($){i.value=!0;try{const L=await(await fetch($)).json();d.value=Array.isArray(L)?L:[],u.value=!0}catch(S){console.error("Address search error:",S)}finally{i.value=!1}}}function C(){u.value=!u.value}function E(A){if(!A)return;u.value=!1;const B=parseFloat(A.lat),S={type:"Point",coordinates:[parseFloat(A.lon),B]};o.geom&&w?.value&&(w.value[o.geom]=S),l("update:geom",S)}function I(A){if(!o.api)return"";const B={value:encodeURIComponent(A),bbox:f.value?f.value.join(","):""};return o.api.replace(n,($,S)=>B[S.trim()]??"")}return(A,B)=>(e.openBlock(),e.createElementBlock("div",bu,[e.createElementVNode("div",ku,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":B[0]||(B[0]=$=>c.value=$),placeholder:x.value,disabled:g.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[e.unref(a),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:e.withKeys(e.withModifiers(_,["prevent"]),["enter"])},null,42,xu),[[e.vModelText,c.value]]),d.value.length?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:C,title:"Show search results"},[e.createVNode(e.unref(j.Info),{class:"h-4 w-4"})])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:k,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:i.value||!c.value?.trim()},[i.value?(e.openBlock(),e.createBlock(e.unref(j.LoaderCircle),{key:1,class:"h-5 w-5 animate-spin text-gray-400"})):(e.openBlock(),e.createBlock(e.unref(j.Search),{key:0,class:"h-4 w-4"}))],8,wu),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[u.value?(e.openBlock(),e.createElementBlock("div",_u,[e.createElementVNode("div",vu,[e.createElementVNode("div",Cu,[B[2]||(B[2]=e.createElementVNode("span",null,"Search results",-1)),e.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:B[1]||(B[1]=$=>u.value=!1),title:"Close"},[e.createVNode(e.unref(j.X),{class:"h-4 w-4"})])]),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,($,S)=>(e.openBlock(),e.createElementBlock("li",{key:S,onClick:L=>E($),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString($.display_name),9,Eu))),128))]),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Bu," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),Ar=(r="")=>`${r}${Math.floor(Math.random()*1e4)}`,Vu={class:"vs-datalist space-y-3"},Su={class:"space-y-3"},$u=["onClick","disabled"],Nu={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Au=["disabled"],Fu=me(e.defineComponent({__name:"vs-input-datalist",props:e.mergeModels({schema:{default:()=>[]},minItems:{default:0},maxItems:{default:void 0},addButtonText:{default:"Додати позицію"},emptyLabel:{default:"Немає рядків"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),o=e.computed(()=>Array.isArray(n.value)?n.value:[]),l=e.ref([]),a=e.computed(()=>t.schema?.map(f=>({...f,disabled:t.disabled||f.disabled}))??[]),s=e.computed(()=>a.value.map(f=>m(f))),c=e.computed(()=>t.disabled?!1:t.maxItems?o.value.length<t.maxItems:!0),i=e.computed(()=>t.disabled||o.value.length<=(t.minItems||0));e.watch(()=>o.value.length,()=>{d(),u()},{immediate:!0}),e.watch(()=>t.schema,u,{immediate:!0,deep:!0});function d(){const f=o.value.length;l.value.length<f?l.value=[...l.value,...Array.from({length:f-l.value.length},()=>Ar())]:l.value.length>f&&l.value.splice(f)}function u(){if(!t.minItems||o.value.length>=t.minItems)return;const f=t.minItems-o.value.length,b=Array.from({length:f},h);n.value=[...o.value,...b]}function h(){const f={};return a.value.forEach(b=>{f[b.name]=b?.default??null}),f}function x(){c.value&&(n.value=[...o.value,h()],d())}function g(f){i.value||(n.value=o.value.filter((b,w)=>w!==f),d(),u())}function m(f){return{...f}}return(f,b)=>(e.openBlock(),e.createElementBlock("div",Vu,[e.createElementVNode("div",Su,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(w,_)=>(e.openBlock(),e.createElementBlock("div",{key:l.value[_],class:"flex items-center gap-3"},[e.createVNode(Qe,{schema:s.value,layout:"inline",navigation:!1,values:o.value[_],"onUpdate:values":k=>o.value[_]=k,"form-id":l.value[_]},null,8,["schema","values","onUpdate:values","form-id"]),e.createElementVNode("button",{type:"button",class:"h-[38px] w-[38px] flex items-center justify-center text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",onClick:k=>g(_),disabled:i.value},[e.createVNode(e.unref(j.Trash2),{class:"h-4 w-4"})],8,$u)]))),128)),o.value.length===0?(e.openBlock(),e.createElementBlock("div",Nu,e.toDisplayString(t.emptyLabel),1)):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:x,disabled:!c.value},[e.createVNode(e.unref(j.Plus),{class:"h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Au)]))}}),[["__scopeId","data-v-260e3e66"]]),Mu={class:"vs-dataform space-y-4"},Du=["draggable","onDragstart","onDragover","onDragenter","onDrop"],Lu={class:"flex items-center gap-2"},Tu=["onClick"],Iu={class:"text-sm font-medium text-gray-700"},Ru={class:"flex items-center gap-2"},Ou=["title","onClick","disabled"],zu=["title","onClick","disabled"],Pu={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},ju=["disabled"],Uu=me(e.defineComponent({__name:"vs-input-dataform",props:e.mergeModels({schema:{default:()=>[]},minGroups:{default:0},maxGroups:{default:void 0},addButtonText:{default:"Додати групу фільтрів"},groupLabel:{default:void 0},duplicateTitle:{default:"Дублювати групу"},removeTitle:{default:"Видалити групу"},emptyLabel:{},view:{default:"default"},collapsible:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),o=e.ref([]),l=e.ref([]),a=e.ref(0),s=e.ref(null),c=e.ref(null),i=e.ref(null),d=e.computed(()=>t.groupLabel??"Group"),u=e.computed(()=>t.emptyLabel??"Ще немає груп"),h=e.computed(()=>t.schema?.map(J=>({...J,disabled:t.disabled||J.disabled}))??[]),x=e.computed(()=>h.value.map(J=>$(J))),g=e.computed(()=>t.view==="accordion"),m=e.computed(()=>!!(t.collapsible||g.value)),f=e.computed(()=>t.draggable!==!1),b=e.computed(()=>t.disabled?!1:t.maxGroups?n.value.length<t.maxGroups:!0),w=e.computed(()=>t.disabled||n.value.length<=(t.minGroups||0));e.watch(()=>n.value.length,()=>{_(),k(),C()},{immediate:!0}),e.watch(()=>t.schema,C,{immediate:!0,deep:!0}),e.watch(()=>t.view,()=>{k()},{immediate:!0});function _(){const J=n.value.length;o.value.length<J?o.value=[...o.value,...Array.from({length:J-o.value.length},()=>Ar())]:o.value.length>J&&o.value.splice(J)}function k(){const J=n.value.length;g.value?J===0?a.value=-1:a.value>=J?a.value=J-1:a.value<0&&(a.value=0):l.value.length<J?l.value=[...l.value,...Array.from({length:J-l.value.length},()=>!1)]:l.value.length>J&&l.value.splice(J)}function C(){if(!t.minGroups||n.value.length>=t.minGroups)return;const J=t.minGroups-n.value.length,re=Array.from({length:J},E);n.value=[...n.value,...re],k()}function E(){const J={};return h.value.forEach(re=>{J[re.name]=re?.default??null}),J}function I(){b.value&&(n.value=[...n.value,E()],_(),k())}function A(J){w.value||(n.value=n.value.filter((re,de)=>de!==J),_(),g.value?a.value>=n.value.length&&(a.value=n.value.length-1):l.value.splice(J,1),C())}function B(J){if(t.disabled)return;const re=JSON.parse(JSON.stringify(n.value[J]??{}));n.value=[...n.value.slice(0,J+1),re,...n.value.slice(J+1)],_(),g.value?a.value>J&&(a.value+=1):l.value.splice(J+1,0,l.value[J]??!1)}function $(J){return{...J}}function S(J){return g.value?a.value===-1&&J===0?!1:a.value!==J:!!l.value[J]}function L(J){if(m.value){if(g.value){a.value=J;return}l.value[J]=!l.value[J]}}function F(J,re){if(!f.value||t.disabled){re.preventDefault();return}s.value=J,c.value=J,i.value={groups:JSON.parse(JSON.stringify(n.value)),keys:[...o.value],states:[...l.value]},re.dataTransfer?.setData("text/plain",String(J)),re.dataTransfer?.setDragImage?.(re.currentTarget,0,0)}function P(J,re){!f.value||t.disabled||s.value!==null&&X(J,re)}function M(J,re){X(J,re)}function O(J){!f.value||t.disabled||ge()}function T(){i.value&&W(),s.value=null,c.value=null,i.value=null}function G(J,re){const de=[...n.value],[ce]=de.splice(J,1);de.splice(re,0,ce),n.value=de;const ye=[...o.value],[Le]=ye.splice(J,1);if(ye.splice(re,0,Le),o.value=ye,g.value)a.value===J&&(a.value=re);else{const $e=[...l.value],[tt]=$e.splice(J,1);$e.splice(re,0,tt),l.value=$e}}function W(){i.value&&(n.value=i.value.groups,o.value=i.value.keys,l.value=i.value.states,i.value=null,c.value=null)}function X(J,re){if(s.value===null)return;const de=ne(J,re);c.value=de,we(de)}function ne(J,re){if(!re?.currentTarget)return J;const de=re.currentTarget.getBoundingClientRect(),ye=re.clientY-de.top>de.height/2?J+1:J;return Math.max(0,Math.min(ye,n.value.length))}function we(J){const re=s.value;if(re===null)return;let de=J;if(de>n.value.length&&(de=n.value.length),de===re||de===re+1)return;const ce=de>re?de-1:de;G(re,ce),s.value=ce,c.value=de>re?ce+1:ce}function ge(){i.value=null,s.value=null,c.value=null}return(J,re)=>(e.openBlock(),e.createElementBlock("div",Mu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(de,ce)=>(e.openBlock(),e.createElementBlock("div",{key:o.value[ce],class:e.normalizeClass(["relative border border-gray-200 rounded-lg bg-white transition vs-dataform__group",[t.view==="accordion"?"overflow-hidden":S(ce)?"pt-6 px-6":"p-6"]]),draggable:f.value&&!t.disabled,onDragstart:ye=>F(ce,ye),onDragend:T,onDragover:e.withModifiers(ye=>P(ce,ye),["prevent"]),onDragenter:e.withModifiers(ye=>M(ce,ye),["prevent"]),onDrop:e.withModifiers(ye=>O(),["prevent"])},[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center justify-between gap-2 border-b border-gray-100 px-4 py-3",[t.view!=="accordion"?"-mx-6 -mt-6 px-6":"",t.view!=="accordion"&&!S(ce)?"rounded-t-lg":"rounded-lg"]])},[e.createElementVNode("div",Lu,[f.value?(e.openBlock(),e.createBlock(e.unref(j.GripVertical),{key:0,class:"h-4 w-4 text-gray-400","aria-hidden":"true"})):e.createCommentVNode("",!0),m.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"rounded-full p-1 text-gray-500 transition hover:bg-gray-100",onClick:ye=>L(ce)},[e.createVNode(e.unref(j.ChevronDown),{class:e.normalizeClass(["h-4 w-4 transition",S(ce)?"-rotate-90":"rotate-0"])},null,8,["class"])],8,Tu)):e.createCommentVNode("",!0),e.createElementVNode("div",Iu,e.toDisplayString(`${d.value} (${ce+1})`),1)]),e.createElementVNode("div",Ru,[e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.duplicateTitle,onClick:ye=>B(ce),disabled:t.disabled,draggable:"false"},[e.createVNode(e.unref(j.Copy),{class:"h-4 w-4"})],8,Ou),e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.removeTitle,onClick:ye=>A(ce),disabled:w.value,draggable:"false"},[e.createVNode(e.unref(j.Trash2),{class:"h-4 w-4"})],8,zu)])],2),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(t.view==="accordion"?"p-6":"pt-6")},[e.createVNode(Qe,{class:"vs-dataform__form",schema:x.value,layout:"inline",navigation:!1,values:n.value[ce],"onUpdate:values":ye=>n.value[ce]=ye,"form-id":o.value[ce],disabled:t.disabled},null,8,["schema","values","onUpdate:values","form-id","disabled"])],2),[[e.vShow,!S(ce)]])],42,Du))),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",Pu,e.toDisplayString(u.value),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:I,disabled:!b.value},[e.createVNode(e.unref(j.Plus),{class:"h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,ju)]))}}),[["__scopeId","data-v-cfbcfed8"]]),tn="__vs_form_monaco_loader__",vt="__vs_form_monaco_script_loader__",nn="__vs_form_monaco_editor_loader__",Mn=e.defineComponent({__name:"vs-input-monaco",props:e.mergeModels({syntax:{default:"xml"},theme:{default:"vs-light"},height:{default:280},minimap:{type:Boolean,default:!1},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r,{expose:t}){const n=r,o=e.useModel(r,"modelValue"),l=e.ref(null),a=e.computed(()=>typeof n.height=="number"?`${n.height}px`:n.height||"280px");let s=null,c=null,i=!1;const d=()=>{if(c)return Promise.resolve(c);if(typeof window>"u")return Promise.resolve(null);const m=window;if(m.monaco?.editor?.create)return c=m.monaco,Promise.resolve(c);if(m[tn])return m[tn];const b=(async()=>{const w=C=>{if(Array.from(document.styleSheets||[]).some(A=>A?.href?.includes(C)))return;const I=document.createElement("link");I.rel="stylesheet",I.href=C,document.head.appendChild(I)},_=C=>{if(m[vt]?.[C])return m[vt][C];m[vt]||={};const E=Array.from(document.scripts).find(I=>I.src===C);return E?(m[vt][C]=new Promise((I,A)=>{const B=E.readyState;if(E.dataset.loaded==="true"||B==="loaded"||B==="complete"){I();return}E.addEventListener("load",()=>{E.dataset.loaded="true",I()},{once:!0}),E.addEventListener("error",$=>A($),{once:!0})}),m[vt][C]):(m[vt][C]=new Promise((I,A)=>{const B=document.createElement("script");B.src=C,B.async=!0,B.onload=()=>{B.dataset.loaded="true",I()},B.onerror=$=>A($),document.body.appendChild(B)}),m[vt][C])},k="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs";return w(`${k}/editor/editor.main.min.css`),await _(`${k}/loader.min.js`),m[nn]||(m[nn]=new Promise((C,E)=>{window.require.config({paths:{vs:k}}),window.require(["vs/editor/editor.main"],()=>{c=window.monaco,m.monaco=c,C(c)},I=>E(I))}).catch(C=>{throw delete m[nn],C})),m[nn]})().catch(w=>{throw delete m[tn],w});return m[tn]=b,b},u=()=>{!l.value||!c||(s&&(s.dispose(),s=null),s=c.editor.create(l.value,{value:o.value||"",language:n.syntax,theme:n.theme,automaticLayout:!0,minimap:{enabled:!!n.minimap},readOnly:!!n.disabled}),s.onDidChangeModelContent(()=>{i||(o.value=s.getValue())}))},h=()=>{s?.focus()},x=()=>s,g=()=>c;return e.watch(()=>o.value,m=>{if(!s)return;const f=s.getValue();m!==f&&(i=!0,s.setValue(m||""),i=!1)}),e.watch(()=>n.syntax,m=>{!s||!c||c.editor.setModelLanguage(s.getModel(),m||"xml")}),e.watch(()=>n.theme,m=>{c&&c.editor.setTheme(m||"vs-light")}),e.watch(()=>n.disabled,m=>{s&&s.updateOptions({readOnly:!!m})}),e.watch(()=>n.minimap,m=>{s&&s.updateOptions({minimap:{enabled:!!m}})}),e.onMounted(async()=>{try{const m=await d();if(!m||!m.editor)return;c=m,u()}catch(m){console.error("Failed to load Monaco editor",m)}}),e.onBeforeUnmount(()=>{s&&(s.dispose(),s=null)}),t({focus:h,getEditor:x,getMonaco:g}),(m,f)=>(e.openBlock(),e.createElementBlock("div",{class:"w-full",style:e.normalizeStyle({height:a.value})},[e.createElementVNode("div",{ref_key:"editorContainer",ref:l,class:"w-full h-full overflow-hidden border border-[#CFD9E0] rounded"},null,512)],4))}}),Fr={VsInputText:Et,VsInputRadio:Sn,"vs-input-text":Et,"vs-input-password":Jo,"vs-input-textarea":fr,"vs-input-richtext":mr,"vs-input-mask":En,"vs-input-number":lr,"vs-input-radio":Sn,"vs-input-select":Fn,"vs-input-switcher":vn,"vs-input-static":Cn,"vs-input-container":pr,"vs-input-date":Ll,"vs-input-checkbox":ar,"vs-input-file":cr,"vs-input-file2":Nn,file2:Nn,File2:Nn,"vs-input-html":Cn,"vs-input-email":Bn,"vs-input-tel":Vn,"vs-input-datatable":hr,"vs-input-map":wr,"vs-input-file-list":dr,"vs-input-tags":_r,"vs-input-slug":vr,"vs-input-codegen":Cr,"vs-input-key-value":Er,"vs-input-text[]":Br,"vs-input-range":Sr,"vs-input-color":Vr,"vs-input-native-select":Fn,VsInputArraySelect:en,"vs-input-array":$r,"vs-input-array-select":en,"array-select":en,"vs-input-address":Nr,"vs-input-datalist":Fu,"vs-input-dataform":Uu,"vs-input-monaco":Mn},Hu=e.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(r){const t=r,n=e.inject("values");async function o(){try{if(!t.api)return;const l=t.api.replace("{{value}}",t.value),a=await fetch(l);if(!a.ok){ue.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const s=await a.json();if(!t.set||!n)return;for(const[c,i]of Object.entries(t.set))n.value[c]=s.result[i]}catch(l){console.error(t.error,l)}}return(l,a)=>(e.openBlock(),e.createElementBlock("button",{onClick:o,class:"vs-button relative inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-blue-500 hover:border-blue-500 hover:bg-blue-500 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 ml-0 md:ml-2 mt-2 md:mt-0 py-[8px] md:w-2/4 whitespace-nowrap w-full"},e.toDisplayString(l.button),1))}}),qu={class:"flex flex-col gap-1 w-full"},Gu=["innerHTML"],Mr=e.defineComponent({__name:"vs-compact-form-layout",props:e.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]},columns:{default:()=>({container:12,label:3})}},{modelValue:{default:null},modelModifiers:{}}),emits:e.mergeModels(["value-selected"],["update:modelValue"]),setup(r,{emit:t}){const n=r,o=e.useModel(r,"modelValue"),l=t,a=e.computed(()=>Xo[`${n.layout}`]),s=["label","placeholder","info","description","text","html"],c=e.ref(w()),i=e.computed(()=>m(n.item,c.value)),d=e.computed(()=>Fr?.[`vs-input-${n.item.type}`]),u=e.inject("field-props"),h=e.computed(()=>{const k=e.unref(d);if(!k)return new Set;const C=k.props??k.__vccOpts?.props;if(!C)return new Set;const E=Array.isArray(C)?C:Object.keys(C);return new Set(E)}),x=e.computed(()=>{const k={...i.value??{}},C=n.item?.name;C&&u?.value?.[C]&&Object.assign(k,u.value[C]);const E=h.value;return E.size?Object.fromEntries(Object.entries(k).filter(([I])=>E.has(I))):{}}),g=k=>{const C=typeof k=="object"&&k!==null?k:{value:k};l("value-selected",{...C,name:C.name??n.item?.name})};e.onMounted(()=>{c.value=w(),window.addEventListener("storage",_)}),e.onUnmounted(()=>{window.removeEventListener("storage",_)});function m(k,C){if(!k)return{};const E={...k};return s.forEach(I=>{const A=b(k,I,C);A!=null&&(E[I]=A)}),Array.isArray(k.options)&&(E.options=k.options.map(I=>f(I,C))),E}function f(k,C){if(!k)return k;const E={...k},I=b(k,"label",C),A=b(k,"text",C);return I!=null&&(E.label=I),A!=null?E.text=A:I!=null&&(E.text=I),E}function b(k,C,E){const I=`${C}:${E}`;if(k?.[I]!=null)return k[I];if(C==="label"&&k?.[E]!=null)return k[E];if(k?.[C]!=null)return k[C];if(C==="label"){if(k?.ua!=null)return k.ua;if(k?.en!=null)return k.en}if(C==="text"||C==="html"){if(k?.ua!=null)return k.ua;if(k?.en!=null)return k.en}return null}function w(){return typeof window>"u"?"uk":localStorage.getItem("locale")||"uk"}function _(){c.value=w()}return(k,C)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),{ua:i.value.ua,error:n.error||"",item:i.value,columns:n.columns,label:i.value.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${n.item.type}-component`])},[e.createElementVNode("div",qu,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value),e.mergeProps(x.value,{modelValue:o.value,"onUpdate:modelValue":C[0]||(C[0]=E=>o.value=E),onValueSelected:g}),null,16,["modelValue"])),i.value.description&&n.layout!=="settings"?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-sm text-gray-500",innerHTML:i.value.description},null,8,Gu)):e.createCommentVNode("",!0)]),i.value.behavior?.api&&i.value.behavior?.button?(e.openBlock(),e.createBlock(Hu,e.mergeProps({key:0},i.value.behavior,{value:o.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),Ku={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},Wu={class:"vs-compact-form-navigation__rail mt-[6px]"},Yu=["onClick"],Xu=me(e.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(r,{expose:t}){const n=r,o=e.ref([]),l=e.ref(""),a=e.ref(""),s=e.computed(()=>!!n.enabled),c=e.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),i=e.computed(()=>{const L=n.width;if(L==null)return{};const F=typeof L=="number"?`${L}px`:`${L}`;return{width:F,minWidth:F}});let d=null,u=0,h=0,x=null,g=null,m=null;const f=()=>$(),b=()=>_();e.watch(()=>n.target,async L=>{if(I(),!L){x=null,o.value=[],l.value="";return}x=L,s.value&&(await e.nextTick(),E(L),_())},{immediate:!0}),e.watch(()=>n.scrollContainer,L=>{if(!s.value){g=L??null;return}w(L??null),e.nextTick(()=>_())},{immediate:!0}),e.onMounted(()=>{n.scrollContainer||w(null),_()}),e.onBeforeUnmount(()=>{I(),w(null,!0),x=null,typeof window<"u"&&(u&&window.cancelAnimationFrame(u),h&&window.cancelAnimationFrame(h))});function w(L,F=!1){if(m&&(m(),m=null),F){g=null;return}if(g=L??null,typeof window>"u")return;const P=L??window,M=window;P.addEventListener("scroll",f,{passive:!0}),M.addEventListener("resize",b),m=()=>{P.removeEventListener("scroll",f),M.removeEventListener("resize",b)}}function _(){if(!s.value||!x)return;u&&typeof window<"u"&&window.cancelAnimationFrame(u);const L=()=>{k(),u=0};typeof window>"u"?L():u=window.requestAnimationFrame(L)}function k(){if(!s.value||!x)return;const L=Array.from(x.querySelectorAll("h1, h2")),F=new Set,P=[];L.forEach((M,O)=>{const T=M.textContent?.trim()??"";if(!T)return;let G=(M.getAttribute("id")??"").trim();G||(G=C(T)||`heading-${O+1}`);let W=G,X=1;for(;F.has(W);)W=`${G}-${X+=1}`;M.id!==W&&Object.assign(M,{id:W}),F.add(W),P.push({id:W,text:T,level:M.tagName.toLowerCase()==="h1"?1:2})}),o.value=P,P.length||(l.value=""),B()}function C(L){return L.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function E(L){!L||!s.value||typeof MutationObserver>"u"||(I(),d=new MutationObserver(()=>_()),d.observe(L,{childList:!0,subtree:!0}))}function I(){d&&(d.disconnect(),d=null)}function A(L){const F=g;if(!F)return typeof window>"u"?L.offsetTop:L.getBoundingClientRect().top+window.scrollY;const P=L.getBoundingClientRect(),M=F.getBoundingClientRect();return P.top-M.top+F.scrollTop}function B(){if(!s.value||!o.value.length)return;const L=g,F=(L?L.scrollTop:null)||(typeof window<"u"?window.scrollY:0),P=(L?L.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),M=F+P;let O=null;for(let G=0;G<o.value.length;G+=1){const W=o.value[G],X=document.getElementById(W.id);if(X){const ne=A(X);ne+X.offsetHeight>F&&ne<M&&(O=W.id)}}!O&&a.value&&(O=a.value),O&&(a.value=O);const T=L?L.scrollHeight-L.clientHeight:document.documentElement.scrollHeight-window.innerHeight;F+5>=T&&(O=o.value[o.value.length-1].id),O&&(l.value=O)}function $(){s.value&&(h&&window.cancelAnimationFrame(h),h=window.requestAnimationFrame(()=>{B(),h=0}))}function S(L){if(!s.value)return;const F=document.getElementById(L);if(!F)return;const P=g,M=Math.max(0,A(F));P?P.scrollTo({top:M,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:M,behavior:"smooth"})}return t({refresh:_}),(L,F)=>s.value&&o.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(c.value),style:e.normalizeStyle(i.value)},[e.createElementVNode("h2",Ku,e.toDisplayString(L.title),1),e.createElementVNode("div",Wu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,P=>(e.openBlock(),e.createElementBlock("div",{key:P.id,class:e.normalizeClass(["vs-compact-form-navigation__item relative",P.level===2?"vs-compact-form-navigation__item--nested":"",P.id===l.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick:M=>S(P.id),class:e.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",P.level===2?"pl-[15px]":"pl-[18px]",P.id===l.value?"text-gray-800":"text-gray-500"])},[e.createElementVNode("span",null,e.toDisplayString(P.text),1)],10,Yu)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-1584a562"]]),mt={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон",minlength:r=>`Мінімальна довжина — ${r} символів`,maxlength:r=>`Максимальна довжина — ${r} символів`},Zu=r=>typeof r=="string"?r.trim()?!1:mt.required:Array.isArray(r)?r.map(n=>typeof n=="string"?n.trim():n).filter(n=>n!=null&&n!=="").length?!1:mt.required:typeof r=="number"?Number?.isNaN(r)?mt?.required:!1:r?!1:mt.required,Ju=r=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return r?t.test(r)?!1:mt.email:!1},Qu=r=>{const t=/^\+[1-9]\d{1,14}$/;return r?t.test(r)?!1:mt.tel:!1},Dr=r=>r==null?0:typeof r=="string"?r.trim().length:Array.isArray(r)?r.length:typeof r=="number"?r.toString().length:String(r).length,ep=(r,t)=>{if(r==null)return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Dr(r)<n?t?.message||mt.minlength(n):!1},tp=(r,t)=>{if(r==null||r==="")return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Dr(r)>n?t?.message||mt.maxlength(n):!1},np=(r,t)=>{const n=t.pattern??t.regexp,o=typeof n=="string"?new RegExp(n):n;if(Array.isArray(r)){const l=r.filter(Boolean);return l.length===0||l.every(a=>o.test(a))?!1:t.message}return!o.test(r)&&r?t.message:!1},rp=(r,t)=>!1,op=(r,t)=>{switch(typeof t=="string"?t:t.type){case"required":return Zu(r);case"email":return Ju(r);case"tel":return Qu(r);case"regexp":return np(r,t);case"minlength":return ep(r,t);case"maxlength":return tp(r,t);case"custom":return rp();default:return!1}},lp={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function Lr(r){const t=r?.toLowerCase();return lp[t]||t}function Dn(r,t=!1){if(Array.isArray(r)){const o=[];return r.forEach(l=>{const a={...l};a.name=(l.name||l.id||l.key||"").toString(),a.type=Lr(l.type),a.label=l.label||l.ua,a.rules=l.rules||l.validators,a.type==="email"&&!a.rules&&(a.rules=["email"]),l.data&&(a.api=`/api/suggest/${l.data}`),a.disabled=a.disabled??t,Array.isArray(a.schema)&&(a.schema=Dn(a.schema,a.disabled)),o.push(a)}),o}const n=[];return Object.entries(r).forEach(o=>{const l={name:o[0],...o[1],type:Lr(o[1].type),label:o[1].label||o[1].ua,rules:o[1].rules||o[1].validators,disabled:o[1].disabled??t};l.type==="email"&&!l.rules&&(l.rules=["email"]),o[1].type?.includes("list")&&(l.multiple=!0),!l.api&&o[1].data&&(l.api=`/api/suggest/${o[1].data}`),Array.isArray(l.schema)&&(l.schema=Dn(l.schema,l.disabled)),n.push(l)}),n}function ap(r,t,n=!1){const o=e.computed(()=>Dn((Array.isArray(t),t),typeof n=="boolean"?n:n.value)),l=e.ref({});function a(d){const u=d?.conditions;if(!u)return!0;const h=Array.isArray(u)?u[0]:u,x=r?.value?.[h];return ur(x,u)}const s=(d=o.value,u=!0)=>(d.forEach(h=>{const x=[],g=Number(h?.minlength),m=Number(h?.maxlength);!Number.isNaN(g)&&Number.isFinite(g)&&x.push({type:"minlength",value:g}),!Number.isNaN(m)&&Number.isFinite(m)&&x.push({type:"maxlength",value:m});const f=[...x,...h.rules||[]];if(f.length){if(!a(h)){delete l.value[h.name];return}let b=!1,w=null;f.forEach(_=>{const k=op(r.value[h.name],_);k&&(b=!0,!w&&typeof k=="string"&&(w=k))}),b&&w?l.value[h.name]=w:delete l.value[h.name]}h.schema&&s(h.schema,!1)}),u&&Object.values(l.value).some(Boolean)?l.value:null),c=e.computed(()=>o.value?.filter(d=>d.hidden!==!0&&a(d)));return{errors:l,validate:s,reset:()=>{r.value={},l.value={}},visibleSchema:c}}const sp={class:"flex w-full h-full min-h-0 gap-6"},ip={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},Qe=e.defineComponent({__name:"vs-compact-form",props:e.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},modelValue:{default:()=>({})},modelModifiers:{},values:{default:void 0},valuesModifiers:{}}),emits:e.mergeModels(["handle-submit","update:modelValue","value-selected"],["update:form","update:modelValue","update:values"]),setup(r,{expose:t,emit:n}){const o=n,l=r,a=e.useModel(r,"form"),s=e.useModel(r,"modelValue"),c=e.useModel(r,"values"),i=e.computed({get:()=>c.value??s.value,set:F=>{s.value=F,c.value=F}}),{errors:d,validate:u,reset:h,visibleSchema:x}=ap(i,l.schema,e.toRef(l,"disabled")),g=e.ref(null),m=e.ref(null),f=e.ref({}),b=e.computed(()=>l.navigation),w=e.computed(()=>l.navWidth),_=e.computed(()=>l.style?.columns),k=Object.freeze({container:12,label:3}),C=e.computed(()=>l.columns??_.value??k),E=e.computed(()=>l.columns!=null||_.value!=null),I=e.computed(()=>E.value?"horizontal":l.layout),A=F=>F?.columns?"horizontal":I.value,B=F=>F?.columns??C.value,$=()=>{!l.formId&&i.value&&delete i.value.id,o("update:modelValue",i.value),u(),o("handle-submit",i.value)},S=F=>{o("value-selected",F)};t({validate:u,reset:h,errors:d}),e.onMounted(()=>{a.value={value:i.value,errors:d.value,reset:h,validate:u,formId:l.formId}});function L(F,P){if(F===P)return!0;if(typeof F!="object"||typeof P!="object"||!F||!P)return!1;const M=Object.keys(F),O=Object.keys(P);return M.length!==O.length?!1:M.every(T=>F[T]===P[T])}return e.provide("form",a),e.provide("values",i),e.provide("field-props",f),(F,P)=>(e.openBlock(),e.createElementBlock("div",sp,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:m},[e.createElementVNode("form",{ref_key:"formRef",ref:g,onSubmit:e.withModifiers($,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",I.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(x),(M,O)=>(e.openBlock(),e.createElementBlock("div",{key:M.name,class:e.normalizeClass(A(M)==="horizontal"?"col-span-12":`col-span-${M.col||12}`)},[e.createVNode(Mr,{style:e.normalizeStyle(F.style),item:M,layout:A(M),columns:B(M),"model-value":i.value[M.name],"onUpdate:modelValue":T=>{if(M.name==="id"&&!F.formId)return;const G=i.value[M.name];L(G,T)||(i.value[M.name]=T)},error:e.unref(d)[M.name],onValueSelected:S},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),A(M)==="settings"&&O+1!==e.unref(x).length?(e.openBlock(),e.createElementBlock("div",ip)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(Xu,{target:g.value,"scroll-container":m.value,enabled:b.value,width:w.value},null,8,["target","scroll-container","enabled","width"])]))}}),cp={class:"relative"},dp={class:"w-full h-full fixed top-0 start-0 bg-black bg-opacity-50"},up={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"},pp={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},fp={class:"font-medium text-gray-800 dark:text-[#ffffff]"},mp={class:"p-4 mim-h-0 h-full overflow-auto"},Tr=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{},api:{},method:{}},emits:["close","save","edit"],setup(r,{emit:t}){const n=r,o=t,l=e.ref(n.schema),a=e.ref(n.defaultValue?JSON.parse(JSON.stringify(n.defaultValue)):{}),s=e.ref({}),c=e.ref(n.token||""),i=e.ref(n.mode),d=()=>{const f=n.method?.trim().toUpperCase();return f==="GET"||f==="POST"||f==="PUT"?f:i.value==="add"?"POST":"PUT"},u=()=>{ue.notify({type:"success",title:"Успішно",message:`Дані успішно ${i.value==="add"?"збережено":"оновлено"}`})},h=f=>{const b={};f.id!==void 0&&f.id!==null&&(b.id=f.id),f.obj&&typeof f.obj=="object"&&Object.assign(b,f.obj),Object.keys(b).length&&(a.value={...a.value,...b})},x=async f=>{if(console.log(f),f.ok){await f.json().catch(()=>({})),u(),o("save",a.value);return}const b=await f.json().catch(()=>({})),w=b.message||b.error;if(f.status===400){ue.notify({type:"warning",title:"Помилка валідації",message:w||"Некоректні дані (400)"});return}if(f.status===500){ue.notify({type:"error",title:"Серверна помилка",message:w||"Виникла помилка на сервері (500)"});return}ue.notify({type:"error",title:"Помилка",message:`Статус: ${f.status}`})};async function g(){const f=s.value.validate();if(f){ue.notify({type:"warning",title:"Помилка валідації",message:Object.entries(f).map(([w,_])=>`${w}: ${_}`).join(`
|
|
5
|
-
`)});return}i.value==="add"&&a.value&&delete a.value.id;const b=n.api?.trim();if(b){const w=d();try{const _=await fetch(b,{method:w,headers:w==="GET"?void 0:{"Content-Type":"application/json"},body:w==="GET"?void 0:JSON.stringify(a.value)});await x(_)}catch(_){ue.notify({type:"error",title:"Помилка з’єднання",message:_.message||"Не вдалося виконати запит"})}return}if(c.value)try{const w=await fetch(`/api/table/${c.value}`,{method:i.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a.value)});await x(w)}catch(w){ue.notify({type:"error",title:"Помилка з’єднання",message:w.message||"Не вдалося виконати запит"})}else o("edit",a.value),m()}function m(){o("close")}return e.onMounted(async()=>{try{if(n.form&&!n.schema){const f=await fetch(`/api/template/form/${n.form}`);if(!f.ok){ue.notify({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const b=await f.json();l.value=b.schema,b.token&&(c.value=b.token)}else if(n.token&&!n.defaultValue){c.value=n.token;const f=await fetch(`/api/form/${c.value}`);if(!f.ok){ue.notify({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const b=await f.json();l.value=b.schema,b.data?a.value=b.data:i.value="add",h({id:b.id,obj:b.obj})}}catch(f){ue.notify({type:"error",title:"Error",message:f.message||"Unexpected error"}),console.error(f)}}),(f,b)=>(e.openBlock(),e.createElementBlock("div",cp,[e.createElementVNode("div",dp,[e.createElementVNode("div",up,[e.createElementVNode("div",pp,[e.createElementVNode("h3",fp,e.toDisplayString(i.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:m,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},[b[2]||(b[2]=e.createElementVNode("span",{class:"sr-only"},"Close",-1)),e.createVNode(e.unref(j.X),{class:"h-4 w-4 flex-shrink-0"})])]),e.createElementVNode("div",mp,[l.value?(e.openBlock(),e.createBlock(Qe,{key:0,schema:l.value,values:a.value,"onUpdate:values":b[0]||(b[0]=w=>a.value=w),form:s.value,"onUpdate:form":b[1]||(b[1]=w=>s.value=w),formId:c.value},null,8,["schema","values","form","formId"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"vs-form__head mr-5 mb-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},[e.createElementVNode("button",{type:"button",onClick:m,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:g,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"}," Зберегти ")])])])]))}}),hp=1440*60*1e3,gp=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],yp=["січ","лют","бер","квіт","трав","черв","лип","серп","вер","жовт","лист","груд"],bp=["нд","пн","вт","ср","чт","пт","сб"];function Fe(r){return r instanceof Date&&!Number.isNaN(r.getTime())}const Bt=r=>new Date(r.getTime());function Ct(r){const t=Bt(r);return t.setHours(0,0,0,0),t}function Nt(r){const t=Bt(r);return t.setHours(23,59,59,999),t}function Ln(r){return Ct(new Date(r.getFullYear(),r.getMonth(),1))}function Tn(r){return Nt(new Date(r.getFullYear(),r.getMonth()+1,0))}function In(r,t){const n=new Date(r),o=n.getDate();n.setDate(1),n.setMonth(n.getMonth()+t);const l=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();return n.setDate(Math.min(o,l)),n}function kp(r,t){return In(r,-1)}function rn(r,t){const n=new Date(r);return n.setFullYear(n.getFullYear()+t),n}function Ir(r,t){return rn(r,-t)}function Rr(r){return Ct(new Date(r.getFullYear(),0,1))}function Or(r){return Nt(new Date(r.getFullYear(),11,31))}function xp(r){const t=Math.floor(r.getFullYear()/10)*10;return Ct(new Date(t,0,1))}function wp(r){const t=Math.floor(r.getFullYear()/10)*10+9;return Nt(new Date(t,11,31))}const et=r=>r.getFullYear(),on=r=>Math.floor(r.getFullYear()/10)*10;function _p(r){const t=[];let n=Ct(r.start);const o=Ct(r.end);for(;n<=o;)t.push(Bt(n)),n=new Date(n.getTime()+hp);return t}function vp(r){const t=[];let n=Ln(r.start);const o=Tn(r.end);for(;n<=o;)t.push(Bt(n)),n=In(n,1);return t}function Cp(r){const t=[];let n=Rr(r.start);const o=Or(r.end);for(;n<=o;)t.push(Bt(n)),n=rn(n,1);return t}function Rn(r,t=1){const n=Ct(r),o=(n.getDay()-t+7)%7;return n.setDate(n.getDate()-o),n}function Ep(r,t=1){const n=Rn(r,t);return n.setDate(n.getDate()+6),Nt(n)}function Bp(r,t,n=0){const o=Rn(r,n),l=(t-n+7)%7;return o.setDate(o.getDate()+l),o}const ln=(r,t)=>!!r&&!!t&&r.getFullYear()===t.getFullYear()&&r.getMonth()===t.getMonth()&&r.getDate()===t.getDate(),On=(r,t)=>!!r&&!!t&&r.getFullYear()===t.getFullYear()&&r.getMonth()===t.getMonth(),zr=(r,t)=>!!r&&!!t&&r.getFullYear()===t.getFullYear(),Pr=(r,t)=>!!r&&!!t&&ln(r,t)&&r.getHours()===t.getHours(),Vp=(r,t)=>!!r&&!!t&&Pr(r,t)&&r.getMinutes()===t.getMinutes();function Sp(r,t){const n=r.getTime();return n>=t.start.getTime()&&n<=t.end.getTime()}const At=(r,t)=>!!r&&!!t&&r.getTime()<t.getTime(),Ft=(r,t)=>!!r&&!!t&&r.getTime()>t.getTime();function $p(r){const t=r.filter(n=>Fe(n));if(t.length)return t.reduce((n,o)=>n.getTime()>=o.getTime()?n:o)}function Np(r){const t=r.filter(n=>Fe(n));if(t.length)return t.reduce((n,o)=>n.getTime()<=o.getTime()?n:o)}function jr(r,t){const n=Bt(r);return typeof t.year=="number"&&n.setFullYear(t.year),typeof t.month=="number"&&n.setMonth(t.month),typeof t.date=="number"&&n.setDate(t.date),typeof t.hours=="number"&&n.setHours(t.hours),typeof t.minutes=="number"&&n.setMinutes(t.minutes),typeof t.seconds=="number"&&n.setSeconds(t.seconds),typeof t.milliseconds=="number"&&n.setMilliseconds(t.milliseconds),n}const an=(r,t=2)=>String(r).padStart(t,"0");function Ur(r,t){return t==="wide"?gp[r]:yp[r]}function Ap(r){return bp[r]}const Fp=[{token:"LLLL",format:r=>Ur(r.getMonth(),"wide")},{token:"LLL",format:r=>Ur(r.getMonth(),"abbreviated")},{token:"EE",format:r=>Ap(r.getDay())},{token:"yyyy",format:r=>String(r.getFullYear())},{token:"MM",format:r=>an(r.getMonth()+1)},{token:"dd",format:r=>an(r.getDate())},{token:"HH",format:r=>an(r.getHours())},{token:"mm",format:r=>an(r.getMinutes())}];function sn(r,t){if(!Fe(r))return"";let n="",o=0;for(;o<t.length;){const l=Fp.find(a=>t.startsWith(a.token,o));l?(n+=l.format(r),o+=l.token.length):(n+=t[o],o+=1)}return n}const Mp={"yyyy-MM-dd":/^(\d{4})-(\d{2})-(\d{2})$/,"dd.MM.yyyy":/^(\d{2})\.(\d{2})\.(\d{4})$/,"dd.MM.yyyy HH:mm":/^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2})$/,"HH:mm":/^(\d{2}):(\d{2})$/,"MM.yyyy":/^(\d{2})\.(\d{4})$/,yyyy:/^(\d{4})$/};function Hr(r,t){const n=Mp[t];if(!n){const l=new Date(r);return Fe(l)?l:null}const o=r.match(n);if(!o)return null;switch(t){case"yyyy-MM-dd":{const[,l,a,s]=o,c=new Date(Number(l),Number(a)-1,Number(s));return Fe(c)?c:null}case"dd.MM.yyyy":{const[,l,a,s]=o,c=new Date(Number(s),Number(a)-1,Number(l));return Fe(c)?c:null}case"dd.MM.yyyy HH:mm":{const[,l,a,s,c,i]=o,d=new Date(Number(s),Number(a)-1,Number(l),Number(c),Number(i));return Fe(d)?d:null}case"HH:mm":{const[,l,a]=o,s=new Date;return s.setHours(Number(l),Number(a),0,0),s}case"MM.yyyy":{const[,l,a]=o;return new Date(Number(a),Number(l)-1,1)}case"yyyy":{const[,l]=o;return new Date(Number(l),0,1)}default:return null}}const Dp=["year","month","day","time","custom"],Lp=e.defineComponent({components:{ChevronLeft:j.ChevronLeft,ChevronRight:j.ChevronRight},emits:{elementClick:r=>Fe(r),left:()=>!0,right:()=>!0,heading:()=>!0},props:{headingClickable:{type:Boolean,default:!1},leftDisabled:{type:Boolean,default:!1},rightDisabled:{type:Boolean,default:!1},columnCount:{type:Number,default:7},items:{type:Array,default:()=>[]},viewMode:{type:String,required:!0,validate:r=>typeof r=="string"&&Dp.includes(r)}}}),Tp={class:"v3dp__heading"},Ip=["disabled"],Rp=["disabled"],Op={class:"v3dp__body"},zp={class:"v3dp__subheading"},Pp={class:"v3dp__elements"},jp=["disabled","onClick"];function Up(r,t,n,o,l,a){const s=e.resolveComponent("ChevronLeft"),c=e.resolveComponent("ChevronRight");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["v3dp__popout",`v3dp__popout-${r.viewMode}`]),style:e.normalizeStyle({"--popout-column-definition":`repeat(${r.columnCount}, 1fr)`}),onMousedown:t[3]||(t[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Tp,[e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__left",disabled:r.leftDisabled,onClick:t[0]||(t[0]=e.withModifiers(i=>r.$emit("left"),["stop","prevent"]))},[e.renderSlot(r.$slots,"arrow-left",{},()=>[e.createVNode(s,{class:"v3dp__heading__icon h-4 w-4"})],!0)],8,Ip),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.headingClickable?"button":"span"),{class:"v3dp__heading__center",onClick:t[1]||(t[1]=e.withModifiers(i=>r.$emit("heading"),["stop","prevent"]))},{default:e.withCtx(()=>[e.renderSlot(r.$slots,"heading",{},void 0,!0)]),_:3})),e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__right",disabled:r.rightDisabled,onClick:t[2]||(t[2]=e.withModifiers(i=>r.$emit("right"),["stop","prevent"]))},[e.renderSlot(r.$slots,"arrow-right",{},()=>[e.createVNode(c,{class:"v3dp__heading__icon h-4 w-4"})],!0)],8,Rp)]),e.createElementVNode("div",Op,["subheading"in r.$slots?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",zp,[e.renderSlot(r.$slots,"subheading",{},void 0,!0)]),t[4]||(t[4]=e.createElementVNode("hr",{class:"v3dp__divider"},null,-1))],64)):e.createCommentVNode("",!0),e.createElementVNode("div",Pp,[e.renderSlot(r.$slots,"body",{},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.items,i=>(e.openBlock(),e.createElementBlock("button",{key:i.key,disabled:i.disabled,class:e.normalizeClass([{selected:i.selected,current:i.current},`v3dp__element__button__${r.viewMode}`]),onClick:e.withModifiers(d=>r.$emit("elementClick",i.value),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(i.display),1)],10,jp))),128))],!0)])])],38)}const cn=me(Lp,[["render",Up],["__scopeId","data-v-9e083852"]]),Hp=e.defineComponent({components:{PickerPopup:cn},emits:{"update:pageDate":r=>Fe(r),select:r=>Fe(r)},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(r,{emit:t}){const n=e.computed(()=>xp(r.pageDate)),o=e.computed(()=>wp(r.pageDate)),l=(h,x,g)=>!x&&!g?!0:!(x&&et(h)<et(x)||g&&et(h)>et(g)),a=e.computed(()=>Cp({start:n.value,end:o.value}).map(h=>({value:h,key:String(et(h)),display:et(h),selected:!!r.selected&&et(h)===et(r.selected),disabled:!l(h,r.lowerLimit,r.upperLimit)}))),s=e.computed(()=>{const h=et(n.value),x=et(o.value);return`${h} - ${x}`}),c=e.computed(()=>r.lowerLimit&&(on(r.lowerLimit)===on(r.pageDate)||At(r.pageDate,r.lowerLimit))),i=e.computed(()=>r.upperLimit&&(on(r.upperLimit)===on(r.pageDate)||Ft(r.pageDate,r.upperLimit)));return{years:a,heading:s,leftDisabled:c,rightDisabled:i,previousPage:()=>t("update:pageDate",Ir(r.pageDate,10)),nextPage:()=>t("update:pageDate",rn(r.pageDate,10))}}});function qp(r,t,n,o,l,a){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{columnCount:3,leftDisabled:r.leftDisabled,rightDisabled:r.rightDisabled,items:r.years,viewMode:"year",onLeft:r.previousPage,onRight:r.nextPage,onElementClick:t[0]||(t[0]=c=>r.$emit("select",c))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.heading),1)]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const Gp=me(Hp,[["render",qp]]),Kp=e.defineComponent({components:{PickerPopup:cn},emits:{"update:pageDate":r=>Fe(r),select:r=>Fe(r),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"LLL"},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(r,{emit:t}){const n=e.computed(()=>Rr(r.pageDate)),o=e.computed(()=>Or(r.pageDate)),l=e.computed(()=>x=>sn(x,r.format)),a=(x,g,m)=>!g&&!m?!0:!(g&&At(x,Ln(g))||m&&Ft(x,Tn(m))),s=e.computed(()=>vp({start:n.value,end:o.value}).map(x=>({value:x,display:l.value(x),key:l.value(x),selected:!!r.selected&&On(r.selected,x),disabled:!a(x,r.lowerLimit,r.upperLimit)}))),c=e.computed(()=>et(n.value)),i=e.computed(()=>r.lowerLimit&&(zr(r.lowerLimit,r.pageDate)||At(r.pageDate,r.lowerLimit))),d=e.computed(()=>r.upperLimit&&(zr(r.upperLimit,r.pageDate)||Ft(r.pageDate,r.upperLimit)));return{months:s,heading:c,leftDisabled:i,rightDisabled:d,previousPage:()=>t("update:pageDate",Ir(r.pageDate,1)),nextPage:()=>t("update:pageDate",rn(r.pageDate,1))}}});function Wp(r,t,n,o,l,a){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:3,items:r.months,leftDisabled:r.leftDisabled,rightDisabled:r.rightDisabled,viewMode:"month",onLeft:r.previousPage,onRight:r.nextPage,onHeading:t[0]||(t[0]=c=>r.$emit("back")),onElementClick:t[1]||(t[1]=c=>r.$emit("select",c))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.heading),1)]),_:1},8,["items","leftDisabled","rightDisabled","onLeft","onRight"])}const Yp=me(Kp,[["render",Wp]]),Xp=e.defineComponent({components:{PickerPopup:cn},emits:{"update:pageDate":r=>Fe(r),select:r=>Fe(r),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"dd"},headingFormat:{type:String,required:!1,default:"LLLL yyyy"},weekdayFormat:{type:String,required:!1,default:"EE"},weekStartsOn:{type:Number,required:!1,default:1,validator:r=>typeof r=="number"&&Number.isInteger(r)&&r>=0&&r<=6},customWeekdays:{type:Array,required:!1},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1}},setup(r,{emit:t}){const n=e.computed(()=>b=>w=>sn(w,b)),o=e.computed(()=>Ln(r.pageDate)),l=e.computed(()=>Tn(r.pageDate)),a=e.computed(()=>({start:o.value,end:l.value})),s=e.computed(()=>({start:Rn(o.value,r.weekStartsOn),end:Ep(l.value,r.weekStartsOn)})),c=e.computed(()=>r.customWeekdays?.length===7?r.customWeekdays:null),i=e.computed(()=>{const b=r.weekStartsOn,w=c.value;if(w)return Array.from({length:7}).map((k,C)=>w[(b+C)%7]);const _=n.value(r.weekdayFormat);return Array.from(Array(7)).map((k,C)=>(b+C)%7).map(k=>Bp(new Date,k,r.weekStartsOn)).map(_)}),d=(b,w,_,k)=>k?.dates?.some(C=>ln(b,C))||k?.predicate?.(b)?!1:!w&&!_?!0:!(w&&At(b,Ct(w))||_&&Ft(b,Nt(_))),u=e.computed(()=>{const b=new Date,w=n.value(r.format);return _p(s.value).map(_=>({value:_,display:w(_),selected:!!r.selected&&ln(r.selected,_),current:ln(b,_),disabled:!r.allowOutsideInterval&&!Sp(_,a.value)||!d(_,r.lowerLimit,r.upperLimit,r.disabledDates),key:n.value("yyyy-MM-dd")(_)}))}),h=e.computed(()=>n.value(r.headingFormat)(r.pageDate)),x=e.computed(()=>r.lowerLimit&&(On(r.lowerLimit,r.pageDate)||At(r.pageDate,r.lowerLimit))),g=e.computed(()=>r.upperLimit&&(On(r.upperLimit,r.pageDate)||Ft(r.pageDate,r.upperLimit)));return{weekDays:i,days:u,heading:h,leftDisabled:x,rightDisabled:g,previousPage:()=>t("update:pageDate",kp(r.pageDate)),nextPage:()=>t("update:pageDate",In(r.pageDate,1))}}});function Zp(r,t,n,o,l,a){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",leftDisabled:r.leftDisabled,rightDisabled:r.rightDisabled,items:r.days,viewMode:"day",onLeft:r.previousPage,onRight:r.nextPage,onHeading:t[0]||(t[0]=c=>r.$emit("back")),onElementClick:t[1]||(t[1]=c=>r.$emit("select",c))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.heading),1)]),subheading:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.weekDays,(c,i)=>(e.openBlock(),e.createElementBlock("span",{key:c,class:e.normalizeClass(`v3dp__subheading__weekday__${i}`)},e.toDisplayString(c),3))),128))]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const Jp=me(Xp,[["render",Zp]]);function qr(r,t){const n=r.getBoundingClientRect(),o={height:r.clientHeight,width:r.clientWidth},l=t.getBoundingClientRect();if(!(l.top>=n.top&&l.bottom<=n.top+o.height)){const s=l.top-n.top,c=l.bottom-n.bottom;Math.abs(s)<Math.abs(c)?r.scrollTop+=s:r.scrollTop+=c}}const Qp=e.defineComponent({components:{PickerPopup:cn},emits:{select:r=>Fe(r),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},visible:{type:Boolean,required:!0},disabledTime:{type:Object,required:!1}},setup(r,{emit:t}){const n=e.ref(null),o=e.ref(null),l=e.computed(()=>r.pageDate??r.selected),a=e.ref(l.value.getHours()),s=e.ref(l.value.getMinutes());e.watch(()=>r.selected,g=>{let m=0,f=0;g&&(m=g.getHours(),f=g.getMinutes()),a.value=m,s.value=f});const c=e.computed(()=>[...Array(24).keys()].map(g=>({value:g,date:jr(new Date(l.value.getTime()),{hours:g,minutes:s.value,seconds:0}),selected:a.value===g,ref:e.ref(null)}))),i=e.computed(()=>[...Array(60).keys()].map(g=>({value:g,date:jr(new Date(l.value.getTime()),{hours:a.value,minutes:g,seconds:0}),selected:s.value===g,ref:e.ref(null)}))),d=g=>{s.value=g.value,t("select",g.date)},u=()=>{const g=c.value.find(f=>f.ref.value?.classList?.contains("selected")??!1),m=i.value.find(f=>f.ref.value?.classList?.contains("selected")??!1);g&&m&&(qr(n.value,g.ref.value),qr(o.value,m.ref.value))};return e.watch(()=>r.visible,g=>{g&&e.nextTick(u)}),{hoursListRef:n,minutesListRef:o,hours:a,minutes:s,hoursList:c,minutesList:i,padStartZero:g=>`0${g}`.substr(-2),selectMinutes:d,isEnabled:g=>!(r.disabledTime?.dates?.some(m=>Pr(g,m)&&Vp(g,m))||r.disabledTime?.predicate?.(g)),scroll:u}}}),ef={ref:"hoursListRef",class:"v3dp__column"},tf=["disabled","onClick"],nf={ref:"minutesListRef",class:"v3dp__column"},rf=["disabled","onClick"];function of(r,t,n,o,l,a){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:2,leftDisabled:!0,rightDisabled:!0,viewMode:"time",onHeading:t[0]||(t[0]=c=>r.$emit("back"))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.padStartZero(r.hours))+":"+e.toDisplayString(r.padStartZero(r.minutes)),1)]),body:e.withCtx(()=>[e.createElementVNode("div",ef,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.hoursList,c=>(e.openBlock(),e.createElementBlock("button",{key:c.value,ref_for:!0,ref:c.ref,class:e.normalizeClass([{selected:c.selected},"v3dp__element_button__hour"]),disabled:!r.isEnabled(c.date),onClick:e.withModifiers(i=>r.hours=c.value,["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(r.padStartZero(c.value)),1)],10,tf))),128))],512),e.createElementVNode("div",nf,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.minutesList,c=>(e.openBlock(),e.createElementBlock("button",{key:c.value,ref_for:!0,ref:c.ref,class:e.normalizeClass([{selected:c.selected},"v3dp__element_button__minute"]),disabled:!r.isEnabled(c.date),onClick:e.withModifiers(i=>r.selectMinutes(c),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(r.padStartZero(c.value)),1)],10,rf))),128))],512)]),_:1})}const lf=me(Qp,[["render",of],["__scopeId","data-v-610b89e1"]]),dn=["time","day","month","year"],af=(r,t,n=void 0)=>{let o=n||new Date;const l=$p([r,o]);l&&(o=l);const a=Np([t,o]);return a&&(o=a),o},sf=e.defineComponent({components:{YearPicker:Gp,MonthPicker:Yp,DayPicker:Jp,TimePicker:lf},inheritAttrs:!1,props:{placeholder:{type:String,default:""},modelValue:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1},disabledTime:{type:Object,required:!1},upperLimit:{type:Date,required:!1},lowerLimit:{type:Date,required:!1},startingView:{type:String,required:!1,default:"day",validate:r=>typeof r=="string"&&dn.includes(r)},startingViewDate:{type:Date,required:!1,default:()=>new Date},dayPickerHeadingFormat:{type:String,required:!1,default:"LLLL yyyy"},monthListFormat:{type:String,required:!1,default:"LLL"},weekdayFormat:{type:String,required:!1,default:"EE"},dayFormat:{type:String,required:!1,default:"dd"},inputFormat:{type:String,required:!1,default:"yyyy-MM-dd"},weekDayNames:{type:Array,required:!1},weekStartsOn:{type:Number,required:!1,default:1,validator:r=>[0,1,2,3,4,5,6].includes(r)},disabled:{type:Boolean,required:!1,default:!1},clearable:{type:Boolean,required:!1,default:!1},typeable:{type:Boolean,required:!1,default:!1},minimumView:{type:String,required:!1,default:"day",validate:r=>typeof r=="string"&&dn.includes(r)}},emits:{"update:modelValue":r=>r==null||Fe(r),decadePageChanged:r=>!0,yearPageChanged:r=>!0,monthPageChanged:r=>!0,opened:()=>!0,closed:()=>!0},setup(r,{emit:t,attrs:n}){const o=e.ref("none"),l=e.ref(r.startingViewDate),a=e.ref(null),s=e.ref(!1),c=e.ref(""),i=O=>{const T=O.replace(/[a-zA-Z]/g,"0");return/0/.test(T)?T:""},d=e.computed(()=>i(r.inputFormat));let u=null,h=null;const x=()=>{u?.destroy(),u=null},g=async()=>{if(!h){const{default:O}=await Promise.resolve().then(()=>qn);h=O}return h},m=()=>{u&&u.value!==c.value&&(u.value=c.value??"")},f=async()=>{if(x(),!a.value||!d.value)return;u=(await g())(a.value,{mask:d.value,lazy:!0,overwrite:!0}),m()};e.watchEffect(()=>{if(!c.value)return;const O=Hr(c.value,r.inputFormat);O&&(l.value=O)}),e.watchEffect(()=>{c.value=r.modelValue&&Fe(r.modelValue)?sn(r.modelValue,r.inputFormat):""}),e.onMounted(()=>{d.value&&e.nextTick(()=>{f()})}),e.onBeforeUnmount(()=>{x()}),e.watch(d,O=>{O?e.nextTick(()=>{f()}):x()}),e.watch(c,()=>{m()});const b=(O="none")=>{r.disabled||(O!=="none"&&o.value==="none"&&(l.value=r.modelValue||af(r.lowerLimit,r.upperLimit,l.value)),o.value=O,t(O!=="none"?"opened":"closed"))};e.watchEffect(()=>{r.disabled&&(o.value="none")});const w=(O,T)=>{l.value=T,O==="year"?t("decadePageChanged",T):O==="month"?t("yearPageChanged",T):O==="day"&&t("monthPageChanged",T)},_=O=>{l.value=O,r.minimumView==="year"?(b("none"),t("update:modelValue",O)):o.value="month"},k=O=>{l.value=O,r.minimumView==="month"?(b("none"),t("update:modelValue",O)):o.value="day"},C=O=>{l.value=O,r.minimumView==="day"?(b("none"),t("update:modelValue",O)):o.value="time"},E=O=>{b("none"),t("update:modelValue",O)},I=()=>{r.clearable&&(b("none"),t("update:modelValue",null),l.value=r.startingViewDate)},A=()=>s.value=!0,B=()=>b(L.value),$=()=>{s.value=!1,b()},S=O=>{const T=O.keyCode?O.keyCode:O.which;if([27,13].includes(T)&&a.value.blur(),r.typeable){const W=Hr(a.value.value,r.inputFormat);W&&c.value===sn(W,r.inputFormat)&&(c.value=a.value.value,t("update:modelValue",W))}},L=e.computed(()=>{const O=dn.indexOf(r.startingView),T=dn.indexOf(r.minimumView);return O<T?r.minimumView:r.startingView}),F=O=>Object.fromEntries(Object.entries(O??{}).filter(([T,G])=>T.startsWith("--"))),P=e.computed(()=>r.weekDayNames?.length===7?r.weekDayNames:void 0);return{blur:$,focus:B,click:A,input:c,inputRef:a,pageDate:l,renderView:b,updatePageDate:w,selectYear:_,selectMonth:k,selectDay:C,selectTime:E,keyUp:S,normalizedWeekdayNames:P,viewShown:o,goBackFromTimepicker:()=>r.startingView==="time"&&r.minimumView==="time"?null:o.value="day",clearModelValue:I,initialView:L,log:O=>console.log(O),variables:F}}}),cf={class:"v3dp__input_wrapper"},df=["readonly","placeholder","disabled","tabindex"],uf={class:"v3dp__clearable"};function pf(r,t,n,o,l,a){const s=e.resolveComponent("year-picker"),c=e.resolveComponent("month-picker"),i=e.resolveComponent("day-picker"),d=e.resolveComponent("time-picker");return e.openBlock(),e.createElementBlock("div",{class:"v3dp__datepicker",style:e.normalizeStyle(r.variables(r.$attrs.style))},[e.createElementVNode("div",cf,[e.withDirectives(e.createElementVNode("input",e.mergeProps({type:"text",ref:"inputRef",readonly:!r.typeable,"onUpdate:modelValue":t[0]||(t[0]=u=>r.input=u)},r.$attrs,{placeholder:r.placeholder,disabled:r.disabled,tabindex:r.disabled?-1:0,onKeyup:t[1]||(t[1]=(...u)=>r.keyUp&&r.keyUp(...u)),onBlur:t[2]||(t[2]=(...u)=>r.blur&&r.blur(...u)),onFocus:t[3]||(t[3]=(...u)=>r.focus&&r.focus(...u)),onClick:t[4]||(t[4]=(...u)=>r.click&&r.click(...u))}),null,16,df),[[e.vModelText,r.input]]),e.withDirectives(e.createElementVNode("div",uf,[e.renderSlot(r.$slots,"clear",{onClear:r.clearModelValue},()=>[e.createElementVNode("i",{onClick:t[5]||(t[5]=u=>r.clearModelValue())},"x")])],512),[[e.vShow,r.clearable&&r.modelValue]])]),e.withDirectives(e.createVNode(s,{pageDate:r.pageDate,"onUpdate:pageDate":t[6]||(t[6]=u=>r.updatePageDate("year",u)),selected:r.modelValue,lowerLimit:r.lowerLimit,upperLimit:r.upperLimit,onSelect:r.selectYear},null,8,["pageDate","selected","lowerLimit","upperLimit","onSelect"]),[[e.vShow,r.viewShown==="year"]]),e.withDirectives(e.createVNode(c,{pageDate:r.pageDate,"onUpdate:pageDate":t[7]||(t[7]=u=>r.updatePageDate("month",u)),selected:r.modelValue,onSelect:r.selectMonth,lowerLimit:r.lowerLimit,upperLimit:r.upperLimit,format:r.monthListFormat,onBack:t[8]||(t[8]=u=>r.viewShown="year")},null,8,["pageDate","selected","onSelect","lowerLimit","upperLimit","format"]),[[e.vShow,r.viewShown==="month"]]),e.withDirectives(e.createVNode(i,{pageDate:r.pageDate,"onUpdate:pageDate":t[9]||(t[9]=u=>r.updatePageDate("day",u)),selected:r.modelValue,weekStartsOn:r.weekStartsOn,lowerLimit:r.lowerLimit,upperLimit:r.upperLimit,headingFormat:r.dayPickerHeadingFormat,disabledDates:r.disabledDates,weekdayFormat:r.weekdayFormat,"allow-outside-interval":r.allowOutsideInterval,format:r.dayFormat,"custom-weekdays":r.normalizedWeekdayNames,onSelect:r.selectDay,onBack:t[10]||(t[10]=u=>r.viewShown="month")},null,8,["pageDate","selected","weekStartsOn","lowerLimit","upperLimit","headingFormat","disabledDates","weekdayFormat","allow-outside-interval","format","custom-weekdays","onSelect"]),[[e.vShow,r.viewShown==="day"]]),e.withDirectives(e.createVNode(d,{pageDate:r.pageDate,visible:r.viewShown==="time",selected:r.modelValue,disabledTime:r.disabledTime,onSelect:r.selectTime,onBack:r.goBackFromTimepicker},null,8,["pageDate","visible","selected","disabledTime","onSelect","onBack"]),[[e.vShow,r.viewShown==="time"]])],4)}const ff=me(sf,[["render",pf]]),mf=me(e.defineComponent({__name:"vs-input-date2",props:{clearable:{type:Boolean,default:!0},now:{type:Boolean},editable:{type:Boolean,default:!0},time:{type:Boolean},isInfinity:{type:Boolean},mode:{default:"date"},weekStart:{},dayNames:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,o=t,{inputClass:l}=Ie(n.style),a=e.computed(()=>n.mode?n.mode:n.time?"datetime":"date"),s={date:"дд.мм.рррр",datetime:"дд.мм.рррр гг:хх",month:"мм.рррр",week:"рррр-тиждень",time:"гг:хх",year:"рррр"},c=e.computed(()=>n.placeholder||s[a.value]||""),i=e.computed(()=>["py-1.5 px-3 block w-full placeholder:text-[#767f8f] bg-white",l.value,n.customClass,{"!border-red-600":n.error}]),d=e.computed(()=>!n.modelValue&&n.now?new Date:null),u=e.computed({get:()=>k(n.modelValue??d.value,a.value)||void 0,set:T=>o("update:modelValue",C(T,a.value))}),h=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],x=e.computed(()=>{if(n.dayNames?.length)return n.dayNames.length===7?n.dayNames:h}),g=e.computed(()=>{const T=n.weekStart,G=typeof T=="string"?Number(T):T;return G===void 0||Number.isNaN(G)?1:Math.min(6,Math.max(0,G))}),m=e.computed(()=>{switch(a.value){case"time":return{startingView:"time",minimumView:"time"};case"month":return{startingView:"month",minimumView:"month"};case"year":return{startingView:"year",minimumView:"year"};case"datetime":return{startingView:"day",minimumView:"time"};default:return{startingView:"day",minimumView:"day"}}}),f={date:"dd.MM.yyyy",datetime:"dd.MM.yyyy HH:mm",month:"MM.yyyy",time:"HH:mm",week:"dd.MM.yyyy",year:"yyyy"},b=e.computed(()=>f[a.value]||"dd.MM.yyyy"),w=e.computed(()=>({"--vdp-selected-bg-color":n.style?.primaryColor||"#2563eb","--vdp-hover-bg-color":n.style?.primaryColor||"#2563eb","--vdp-selected-color":"#ffffff","--vdp-hover-color":"#ffffff","--vdp-border-radius":n.style?.size==="sm"?"6px":"8px","--vdp-elem-font-size":n.style?.size==="sm"?"0.75em":"0.85em"})),_=e.ref(!1);e.watch(()=>n.modelValue,T=>{T?_.value=!0:n.now||(_.value=!1)},{immediate:!0}),e.watchEffect(()=>{n.now&&!n.modelValue&&!_.value&&(o("update:modelValue",C(new Date,a.value)),_.value=!0)});function k(T,G){if(!T)return null;if(T instanceof Date&&!Number.isNaN(T.getTime()))return T;if(typeof T!="string")return null;switch(G){case"datetime":return B(T);case"time":return L(T);case"month":return $(T);case"year":return S(T);case"week":return F(T);case"date":default:return A(T)}}function C(T,G){if(!T)return null;const W=T instanceof Date?T:k(T,G);if(!W)return null;switch(G){case"datetime":return`${E(W)}T${I(W)}`;case"time":return I(W);case"month":return`${W.getFullYear()}-${O(W.getMonth()+1)}`;case"year":return`${W.getFullYear()}`;case"week":{const{year:X,week:ne}=P(W);return`${X}-W${O(ne)}`}case"date":default:return E(W)}}function E(T){return`${T.getFullYear()}-${O(T.getMonth()+1)}-${O(T.getDate())}`}function I(T){return`${O(T.getHours())}:${O(T.getMinutes())}`}function A(T){const G=T.split("-");if(G.length<3)return null;const[W,X,ne]=G.map(Number);return!W||!X||!ne?null:new Date(W,X-1,ne)}function B(T){const G=T.includes("T")?T:T.replace(" ","T"),W=new Date(G);return Number.isNaN(W.getTime())?null:W}function $(T){const[G,W]=T.split("-").map(Number);return!G||Number.isNaN(W)?null:new Date(G,(W||1)-1,1)}function S(T){const G=Number(T);return G?new Date(G,0,1):null}function L(T){const G=T.match(/^(\d{1,2}):(\d{2})$/);if(!G)return null;const[,W,X]=G,ne=new Date;return ne.setHours(Number(W),Number(X),0,0),ne}function F(T){const G=T.match(/^(\d{4})-W(\d{2})$/);if(!G)return null;const[,W,X]=G,ne=Number(X);return M(Number(W),ne)}function P(T){const G=new Date(Date.UTC(T.getFullYear(),T.getMonth(),T.getDate())),W=G.getUTCDay()||7;G.setUTCDate(G.getUTCDate()+4-W);const X=new Date(Date.UTC(G.getUTCFullYear(),0,1)),ne=Math.ceil(((G.getTime()-X.getTime())/864e5+1)/7);return{year:G.getUTCFullYear(),week:ne}}function M(T,G){if(!T||!G)return null;const W=new Date(T,0,1+(G-1)*7),X=W.getDay(),ne=W;return X<=4?ne.setDate(W.getDate()-W.getDay()+1):ne.setDate(W.getDate()+8-W.getDay()),ne}function O(T){return String(T).padStart(2,"0")}return(T,G)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vs-date-picker",n.customClass]),style:e.normalizeStyle(w.value)},[e.createVNode(ff,{modelValue:u.value,"onUpdate:modelValue":G[0]||(G[0]=W=>u.value=W),placeholder:c.value,disabled:n.disabled,clearable:n.clearable,typeable:n.editable,"week-day-names":x.value,"week-starts-on":g.value,"starting-view":m.value.startingView,"minimum-view":m.value.minimumView,"input-format":b.value,name:n.name,class:e.normalizeClass(i.value)},null,8,["modelValue","placeholder","disabled","clearable","typeable","week-day-names","week-starts-on","starting-view","minimum-view","input-format","name","class"])],6))}}),[["__scopeId","data-v-a65a2ac3"]]),hf={form:{richtext:{paragraph:"Paragraph",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",createTable:"Create Table",addColumn:"Add Column",addRow:"Add Row",deleteColumn:"Delete Column",deleteRow:"Delete Row",deleteTable:"Delete Table",mergeCells:"Merge Cells",splitCells:"Split Cells",linkTitle:"Enter Link",link:"Link",linkUrl:"Enter URL",editLink:"Edit Link",openLink:"Open Link",removeLink:"Remove Link",openInNewTab:"Open in New Tab",editor:"Editor",html:"HTML",markdown:"Markdown",create:"Create",update:"Update",cancel:"Cancel"}}},gf={form:{richtext:{paragraph:"Звичайний текст",heading1:"Заголовок 1",heading2:"Заголовок 2",heading3:"Заголовок 3",heading4:"Заголовок 4",heading5:"Заголовок 5",heading6:"Заголовок 6",createTable:"Створити таблицю",addColumn:"Додати колонку",addRow:"Додати рядок",deleteColumn:"Видалити колонку",deleteRow:"Видалити рядок",deleteTable:"Видалити таблицю",mergeCells:"Об'єднати комірки",splitCells:"Розділити комірки",linkTitle:"Додати посилання",link:"Посилання",linkUrl:"Введіть URL",editLink:"Редагувати посилання",openLink:"Відкрити посилання",removeLink:"Видалити посилання",openInNewTab:"Відкривати в новій вкладці",editor:"Редактор",html:"HTML",markdown:"Markdown",create:"Створити",update:"Оновити",cancel:"Скасувати"}}},Gr=hf.form.richtext,Kr=gf.form.richtext,zn={en:{form:{richtext:Gr}},uk:{form:{richtext:Kr}}},Wr=(r={mode:"edit",schema:null})=>new Promise(t=>{const{close:n}=ue.modal({title:r.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Tr,contentProps:{...r,onClose:()=>{t(null),n()},onSave:o=>{t(o),n()}}})});Qe.install=function(t){t.component("VForm",Qe),Object.assign(t.config.globalProperties,{$form:Wr}),t.provide("form",Wr),window.v3plugin||(window.v3plugin={})};function ht(r){return typeof r=="string"||r instanceof String}function Yr(r){var t;return typeof r=="object"&&r!=null&&(r==null||(t=r.constructor)==null?void 0:t.name)==="Object"}function Xr(r,t){return Array.isArray(t)?Xr(r,(n,o)=>t.includes(o)):Object.entries(r).reduce((n,o)=>{let[l,a]=o;return t(a,l)&&(n[l]=a),n},{})}const le={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function Zr(r){switch(r){case le.LEFT:return le.FORCE_LEFT;case le.RIGHT:return le.FORCE_RIGHT;default:return r}}function Pn(r){return r.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function un(r,t){if(t===r)return!0;const n=Array.isArray(t),o=Array.isArray(r);let l;if(n&&o){if(t.length!=r.length)return!1;for(l=0;l<t.length;l++)if(!un(t[l],r[l]))return!1;return!0}if(n!=o)return!1;if(t&&r&&typeof t=="object"&&typeof r=="object"){const a=t instanceof Date,s=r instanceof Date;if(a&&s)return t.getTime()==r.getTime();if(a!=s)return!1;const c=t instanceof RegExp,i=r instanceof RegExp;if(c&&i)return t.toString()==r.toString();if(c!=i)return!1;const d=Object.keys(t);for(l=0;l<d.length;l++)if(!Object.prototype.hasOwnProperty.call(r,d[l]))return!1;for(l=0;l<d.length;l++)if(!un(r[d[l]],t[d[l]]))return!1;return!0}else if(t&&r&&typeof t=="function"&&typeof r=="function")return t.toString()===r.toString();return!1}class yf{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?le.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?le.RIGHT:le.LEFT}}function fe(r,t){return new fe.InputMask(r,t)}function Jr(r){if(r==null)throw new Error("mask property should be defined");return r instanceof RegExp?fe.MaskedRegExp:ht(r)?fe.MaskedPattern:r===Date?fe.MaskedDate:r===Number?fe.MaskedNumber:Array.isArray(r)||r===Array?fe.MaskedDynamic:fe.Masked&&r.prototype instanceof fe.Masked?r:fe.Masked&&r instanceof fe.Masked?r.constructor:r instanceof Function?fe.MaskedFunction:(console.warn("Mask not found for mask",r),fe.Masked)}function Vt(r){if(!r)throw new Error("Options in not defined");if(fe.Masked){if(r.prototype instanceof fe.Masked)return{mask:r};const{mask:t=void 0,...n}=r instanceof fe.Masked?{mask:r}:Yr(r)&&r.mask instanceof fe.Masked?r:{};if(t){const o=t.mask;return{...Xr(t,(l,a)=>!a.startsWith("_")),mask:t.constructor,_mask:o,...n}}}return Yr(r)?{...r}:{mask:r}}function lt(r){if(fe.Masked&&r instanceof fe.Masked)return r;const t=Vt(r),n=Jr(t.mask);if(!n)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===n&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new n(t)}fe.createMask=lt;class pn{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return t??this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return t??this.value.length}select(t,n){if(!(t==null||n==null||t===this.selectionStart&&n===this.selectionEnd))try{this._unsafeSelect(t,n)}catch{}}get isActive(){return!1}}fe.MaskElement=pn;const Qr=90,bf=89;class Mt extends pn{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,n,o;return(t=(n=(o=this.input).getRootNode)==null?void 0:n.call(o))!=null?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){if(this._handlers.redo&&(t.keyCode===Qr&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===bf&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===Qr&&(t.metaKey||t.ctrlKey))return t.preventDefault(),this._handlers.undo(t);t.isComposing||this._handlers.selectionChange(t)}_onBeforeinput(t){if(t.inputType==="historyUndo"&&this._handlers.undo)return t.preventDefault(),this._handlers.undo(t);if(t.inputType==="historyRedo"&&this._handlers.redo)return t.preventDefault(),this._handlers.redo(t)}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}fe.HTMLMaskElement=Mt;class eo extends Mt{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,n){this.input.setSelectionRange(t,n)}get value(){return this.input.value}set value(t){this.input.value=t}}fe.HTMLMaskElement=Mt;class jn extends Mt{get _unsafeSelectionStart(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),o=n&&n.anchorOffset,l=n&&n.focusOffset;return l==null||o==null||o<l?o:l}get _unsafeSelectionEnd(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),o=n&&n.anchorOffset,l=n&&n.focusOffset;return l==null||o==null||o>l?o:l}_unsafeSelect(t,n){if(!this.rootElement.createRange)return;const o=this.rootElement.createRange();o.setStart(this.input.firstChild||this.input,t),o.setEnd(this.input.lastChild||this.input,n);const l=this.rootElement,a=l.getSelection&&l.getSelection();a&&(a.removeAllRanges(),a.addRange(o))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}fe.HTMLContenteditableMaskElement=jn;class fn{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>fn.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}fn.MAX_LENGTH=100;class to{constructor(t,n){this.el=t instanceof pn?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new jn(t):new eo(t),this.masked=lt(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new fn,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(t){var n;return t==null||((n=this.masked)==null?void 0:n.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof fe.Masked)&&this.masked.constructor===Jr(t)){this.masked.updateOptions({mask:t});return}const n=t instanceof fe.Masked?t:lt({mask:t});n.unmaskedValue=this.masked.unmaskedValue,this.masked=n}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,n){const o=this._listeners[t];o&&o.forEach(l=>l(n))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){!this.el||!this.el.isActive||(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const n=this.masked.unmaskedValue,o=this.masked.value,l=this.masked.rawInputValue,a=this.displayValue,s=this.unmaskedValue!==n||this.value!==o||this._rawInputValue!==l;this._unmaskedValue=n,this._value=o,this._rawInputValue=l,this.el.value!==a&&(this.el.value=a),t==="auto"?this.alignCursor():t!=null&&(this.cursorPos=t),s&&this._fireChangeEvents(),!this._historyChanging&&(s||this.history.isEmpty)&&this.history.push({unmaskedValue:n,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:n,...o}=t,l=!this.maskEquals(n),a=this.masked.optionsIsChanged(o);l&&(this.mask=n),a&&this.masked.updateOptions(o),(l||a)&&this.updateControl()}updateCursor(t){t!=null&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,le.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,n){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(n),this}off(t,n){if(!this._listeners[t])return this;if(!n)return delete this._listeners[t],this;const o=this._listeners[t].indexOf(n);return o>=0&&this._listeners[t].splice(o,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const n=new yf({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),o=this.masked.rawInputValue,l=this.masked.splice(n.startChangePos,n.removed.length,n.inserted,n.removeDirection,{input:!0,raw:!0}).offset,a=o===this.masked.rawInputValue?n.removeDirection:le.NONE;let s=this.masked.nearestInputPos(n.startChangePos+l,a);a!==le.NONE&&(s=this.masked.nearestInputPos(s,le.NONE)),this.updateControl(s),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}fe.InputMask=to;class he{static normalize(t){return Array.isArray(t)?t:[t,new he]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}fe.ChangeDetails=he;class at{constructor(t,n,o){t===void 0&&(t=""),n===void 0&&(n=0),this.value=t,this.from=n,this.stop=o}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||t!=null&&this.from>=t)return"";const n=this.value[0];return this.value=this.value.slice(1),n}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class Me{constructor(t){this._value="",this._update({...Me.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,n){n===void 0&&(n={input:!0}),this.reset(),this.append(t,n,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,n){return t}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),Math.min(this.displayValue.length,n-t)}extractInput(t,n,o){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this.displayValue.slice(t,n)}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new at(this.extractInput(t,n),t)}appendTail(t){return ht(t)&&(t=new at(String(t))),t.appendTo(this)}_appendCharRaw(t,n){return t?(this._value+=t,new he({inserted:t,rawInserted:t})):new he}_appendChar(t,n,o){n===void 0&&(n={});const l=this.state;let a;if([t,a]=this.doPrepareChar(t,n),t&&(a=a.aggregate(this._appendCharRaw(t,n)),!a.rawInserted&&this.autofix==="pad")){const s=this.state;this.state=l;let c=this.pad(n);const i=this._appendCharRaw(t,n);c=c.aggregate(i),i.rawInserted||c.equals(a)?a=c:this.state=s}if(a.inserted){let s,c=this.doValidate(n)!==!1;if(c&&o!=null){const i=this.state;if(this.overwrite===!0){s=o.state;for(let u=0;u<a.rawInserted.length;++u)o.unshift(this.displayValue.length-a.tailShift)}let d=this.appendTail(o);if(c=d.rawInserted.length===o.toString().length,!(c&&d.inserted)&&this.overwrite==="shift"){this.state=i,s=o.state;for(let u=0;u<a.rawInserted.length;++u)o.shift();d=this.appendTail(o),c=d.rawInserted.length===o.toString().length}c&&d.inserted&&(this.state=i)}c||(a=new he,this.state=l,o&&s&&(o.state=s))}return a}_appendPlaceholder(){return new he}_appendEager(){return new he}append(t,n,o){if(!ht(t))throw new Error("value should be string");const l=ht(o)?new at(String(o)):o;n!=null&&n.tail&&(n._beforeTailState=this.state);let a;[t,a]=this.doPrepare(t,n);for(let s=0;s<t.length;++s){const c=this._appendChar(t[s],n,l);if(!c.rawInserted&&!this.doSkipInvalid(t[s],n,l))break;a.aggregate(c)}return(this.eager===!0||this.eager==="append")&&n!=null&&n.input&&t&&a.aggregate(this._appendEager()),l!=null&&(a.tailShift+=this.appendTail(l).tailShift),a}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(n),new he}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const n=this.rawInputValue,o=this.value,l=t();return this.rawInputValue=n,this.value&&this.value!==o&&o.indexOf(this.value)===0&&(this.append(o.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,l}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const n=this.state,o=t(this);return this.state=n,delete this._isolated,o}doSkipInvalid(t,n,o){return!!this.skipInvalid}doPrepare(t,n){return n===void 0&&(n={}),he.normalize(this.prepare?this.prepare(t,this,n):t)}doPrepareChar(t,n){return n===void 0&&(n={}),he.normalize(this.prepareChar?this.prepareChar(t,this,n):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,n,o,l,a){o===void 0&&(o=""),l===void 0&&(l=le.NONE),a===void 0&&(a={input:!0});const s=t+n,c=this.extractTail(s),i=this.eager===!0||this.eager==="remove";let d;i&&(l=Zr(l),d=this.extractInput(0,s,{raw:!0}));let u=t;const h=new he;if(l!==le.NONE&&(u=this.nearestInputPos(t,n>1&&t!==0&&!i?le.NONE:l),h.tailShift=u-t),h.aggregate(this.remove(u)),i&&l!==le.NONE&&d===this.rawInputValue)if(l===le.FORCE_LEFT){let x;for(;d===this.rawInputValue&&(x=this.displayValue.length);)h.aggregate(new he({tailShift:-1})).aggregate(this.remove(x-1))}else l===le.FORCE_RIGHT&&c.unshift();return h.aggregate(this.append(o,a,c))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!un(this,t)}typedValueEquals(t){const n=this.typedValue;return t===n||Me.EMPTY_VALUES.includes(t)&&Me.EMPTY_VALUES.includes(n)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new he}}Me.DEFAULTS={skipInvalid:!0},Me.EMPTY_VALUES=[void 0,null,""],fe.Masked=Me;class gt{constructor(t,n){t===void 0&&(t=[]),n===void 0&&(n=0),this.chunks=t,this.from=n}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=ht(t)?new at(String(t)):t;const n=this.chunks[this.chunks.length-1],o=n&&(n.stop===t.stop||t.stop==null)&&t.from===n.from+n.toString().length;if(t instanceof at)o?n.extend(t.toString()):this.chunks.push(t);else if(t instanceof gt){if(t.stop==null){let l;for(;t.chunks.length&&t.chunks[0].stop==null;)l=t.chunks.shift(),l.from+=t.from,this.extend(l)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof fe.MaskedPattern))return new at(this.toString()).appendTo(t);const n=new he;for(let o=0;o<this.chunks.length;++o){const l=this.chunks[o],a=t._mapPosToBlock(t.displayValue.length),s=l.stop;let c;if(s!=null&&(!a||a.index<=s)&&((l instanceof gt||t._stops.indexOf(s)>=0)&&n.aggregate(t._appendPlaceholder(s)),c=l instanceof gt&&t._blocks[s]),c){const i=c.appendTail(l);n.aggregate(i);const d=l.toString().slice(i.rawInserted.length);d&&n.aggregate(t.append(d,{tail:!0}))}else n.aggregate(t.append(l.toString(),{tail:!0}))}return n}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:n,...o}=t;Object.assign(this,o),this.chunks=n.map(l=>{const a="chunks"in l?new gt:new at;return a.state=l,a})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const n=t!=null?t-this.from:t;let o=0;for(;o<this.chunks.length;){const l=this.chunks[o],a=l.unshift(n);if(l.toString()){if(!a)break;++o}else this.chunks.splice(o,1);if(a)return a}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const n=this.chunks[t],o=n.shift();if(n.toString()){if(!o)break;--t}else this.chunks.splice(t,1);if(o)return o}return""}}class kf{constructor(t,n){this.masked=t,this._log=[];const{offset:o,index:l}=t._mapPosToBlock(n)||(n<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=o,this.index=l,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((n=this.block)==null?void 0:n.displayValue.length)||0){var n;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,le.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,le.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,le.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,le.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,le.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,le.NONE),!0})}}class Un{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(n),this._value||(this._isRawInput=!1),new he}nearestInputPos(t,n){n===void 0&&(n=le.NONE);const o=0,l=this._value.length;switch(n){case le.LEFT:case le.FORCE_LEFT:return o;case le.NONE:case le.RIGHT:case le.FORCE_RIGHT:default:return l}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._isRawInput?n-t:0}extractInput(t,n,o){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),o===void 0&&(o={}),o.raw&&this._isRawInput&&this._value.slice(t,n)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new he;const o=this.eager===!0||this.eager==="append",a=this.char===t&&(this.isUnmasking||n.input||n.raw)&&(!n.raw||!o)&&!n.tail,s=new he({inserted:this.char,rawInserted:a?this.char:""});return this._value=this.char,this._isRawInput=a&&(n.raw||n.input),s}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new he;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new at("")}appendTail(t){return ht(t)&&(t=new at(String(t))),t.appendTo(this)}append(t,n,o){const l=this._appendChar(t[0],n);return o!=null&&(l.tailShift+=this.appendTail(o).tailShift),l}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=!!t._rawInputValue}pad(t){return this._appendPlaceholder()}}class Dt{constructor(t){const{parent:n,isOptional:o,placeholderChar:l,displayChar:a,lazy:s,eager:c,...i}=t;this.masked=lt(i),Object.assign(this,{parent:n,isOptional:o,placeholderChar:l,displayChar:a,lazy:s,eager:c})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),t===0&&n>=1?(this.isFilled=!1,this.masked.remove(t,n)):new he}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new he;const o=this.masked.state;let l=this.masked._appendChar(t,this.currentMaskFlags(n));return l.inserted&&this.doValidate(n)===!1&&(l=new he,this.masked.state=o),!l.inserted&&!this.isOptional&&!this.lazy&&!n.input&&(l.inserted=this.placeholderChar),l.skip=!l.inserted&&!this.isOptional,this.isFilled=!!l.inserted,l}append(t,n,o){return this.masked.append(t,this.currentMaskFlags(n),o)}_appendPlaceholder(){return this.isFilled||this.isOptional?new he:(this.isFilled=!0,new he({inserted:this.placeholderChar}))}_appendEager(){return new he}extractTail(t,n){return this.masked.extractTail(t,n)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,n,o){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.masked.extractInput(t,n,o)}nearestInputPos(t,n){n===void 0&&(n=le.NONE);const o=0,l=this.value.length,a=Math.min(Math.max(t,o),l);switch(n){case le.LEFT:case le.FORCE_LEFT:return this.isComplete?a:o;case le.RIGHT:case le.FORCE_RIGHT:return this.isComplete?a:l;case le.NONE:default:return a}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.value.slice(t,n).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var n;return{...t,_beforeTailState:(t==null||(n=t._beforeTailState)==null?void 0:n.masked)||t?._beforeTailState}}pad(t){return new he}}Dt.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 no extends Me{updateOptions(t){super.updateOptions(t)}_update(t){const n=t.mask;n&&(t.validate=o=>o.search(n)>=0),super._update(t)}}fe.MaskedRegExp=no;class De extends Me{constructor(t){super({...De.DEFAULTS,...t,definitions:Object.assign({},Dt.DEFAULT_DEFINITIONS,t?.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const n=this.mask;if(!n||!t)return;let o=!1,l=!1;for(let a=0;a<n.length;++a){if(this.blocks){const d=n.slice(a),u=Object.keys(this.blocks).filter(x=>d.indexOf(x)===0);u.sort((x,g)=>g.length-x.length);const h=u[0];if(h){const{expose:x,repeat:g,...m}=Vt(this.blocks[h]),f={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...m,repeat:g,parent:this},b=g!=null?new fe.RepeatBlock(f):lt(f);b&&(this._blocks.push(b),x&&(this.exposeBlock=b),this._maskedBlocks[h]||(this._maskedBlocks[h]=[]),this._maskedBlocks[h].push(this._blocks.length-1)),a+=h.length-1;continue}}let s=n[a],c=s in t;if(s===De.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){o=!o;continue}if(s==="["||s==="]"){l=!l;continue}if(s===De.ESCAPE_CHAR){if(++a,s=n[a],!s)break;c=!1}const i=c?new Dt({isOptional:l,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...Vt(t[s]),parent:this}):new Un({char:s,eager:this.eager,isUnmasking:o});this._blocks.push(i)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:n,...o}=t;this._blocks.forEach((l,a)=>l.state=n[a]),super.state=o}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,n)=>t+=n.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(n),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,n)=>t+=n.value,"")}set value(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(n),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(n),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,n)=>t+=n.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const n=new he;let o=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(o==null)return n;this._blocks[o].isFilled&&++o;for(let l=o;l<this._blocks.length;++l){const a=this._blocks[l]._appendEager();if(!a.inserted)break;n.aggregate(a)}return n}_appendCharRaw(t,n){n===void 0&&(n={});const o=this._mapPosToBlock(this.displayValue.length),l=new he;if(!o)return l;for(let s=o.index,c;c=this._blocks[s];++s){var a;const i=c._appendChar(t,{...n,_beforeTailState:(a=n._beforeTailState)==null||(a=a._blocks)==null?void 0:a[s]});if(l.aggregate(i),i.consumed)break}return l}extractTail(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const o=new gt;return t===n||this._forEachBlocksInRange(t,n,(l,a,s,c)=>{const i=l.extractTail(s,c);i.stop=this._findStopBefore(a),i.from=this._blockStartPos(a),i instanceof gt&&(i.blockIndex=a),o.extend(i)}),o}extractInput(t,n,o){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),o===void 0&&(o={}),t===n)return"";let l="";return this._forEachBlocksInRange(t,n,(a,s,c,i)=>{l+=a.extractInput(c,i,o)}),l}_findStopBefore(t){let n;for(let o=0;o<this._stops.length;++o){const l=this._stops[o];if(l<=t)n=l;else break}return n}_appendPlaceholder(t){const n=new he;if(this.lazy&&t==null)return n;const o=this._mapPosToBlock(this.displayValue.length);if(!o)return n;const l=o.index,a=t??this._blocks.length;return this._blocks.slice(l,a).forEach(s=>{if(!s.lazy||t!=null){var c;n.aggregate(s._appendPlaceholder((c=s._blocks)==null?void 0:c.length))}}),n}_mapPosToBlock(t){let n="";for(let o=0;o<this._blocks.length;++o){const l=this._blocks[o],a=n.length;if(n+=l.displayValue,t<=n.length)return{index:o,offset:t-a}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((n,o)=>n+=o.displayValue.length,0)}_forEachBlocksInRange(t,n,o){n===void 0&&(n=this.displayValue.length);const l=this._mapPosToBlock(t);if(l){const a=this._mapPosToBlock(n),s=a&&l.index===a.index,c=l.offset,i=a&&s?a.offset:this._blocks[l.index].displayValue.length;if(o(this._blocks[l.index],l.index,c,i),a&&!s){for(let d=l.index+1;d<a.index;++d)o(this._blocks[d],d,0,this._blocks[d].displayValue.length);o(this._blocks[a.index],a.index,0,a.offset)}}}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const o=super.remove(t,n);return this._forEachBlocksInRange(t,n,(l,a,s,c)=>{o.aggregate(l.remove(s,c))}),o}nearestInputPos(t,n){if(n===void 0&&(n=le.NONE),!this._blocks.length)return 0;const o=new kf(this,t);if(n===le.NONE)return o.pushRightBeforeInput()||(o.popState(),o.pushLeftBeforeInput())?o.pos:this.displayValue.length;if(n===le.LEFT||n===le.FORCE_LEFT){if(n===le.LEFT){if(o.pushRightBeforeFilled(),o.ok&&o.pos===t)return t;o.popState()}if(o.pushLeftBeforeInput(),o.pushLeftBeforeRequired(),o.pushLeftBeforeFilled(),n===le.LEFT){if(o.pushRightBeforeInput(),o.pushRightBeforeRequired(),o.ok&&o.pos<=t||(o.popState(),o.ok&&o.pos<=t))return o.pos;o.popState()}return o.ok?o.pos:n===le.FORCE_LEFT?0:(o.popState(),o.ok||(o.popState(),o.ok)?o.pos:0)}return n===le.RIGHT||n===le.FORCE_RIGHT?(o.pushRightBeforeInput(),o.pushRightBeforeRequired(),o.pushRightBeforeFilled()?o.pos:n===le.FORCE_RIGHT?this.displayValue.length:(o.popState(),o.ok||(o.popState(),o.ok)?o.pos:this.nearestInputPos(t,le.LEFT))):t}totalInputPositions(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);let o=0;return this._forEachBlocksInRange(t,n,(l,a,s,c)=>{o+=l.totalInputPositions(s,c)}),o}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const n=this._maskedBlocks[t];return n?n.map(o=>this._blocks[o]):[]}pad(t){const n=new he;return this._forEachBlocksInRange(0,this.displayValue.length,o=>n.aggregate(o.pad(t))),n}}De.DEFAULTS={...Me.DEFAULTS,lazy:!0,placeholderChar:"_"},De.STOP_CHAR="`",De.ESCAPE_CHAR="\\",De.InputDefinition=Dt,De.FixedDefinition=Un,fe.MaskedPattern=De;class Lt extends De{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:n=this.to||0,from:o=this.from||0,maxLength:l=this.maxLength||0,autofix:a=this.autofix,...s}=t;this.to=n,this.from=o,this.maxLength=Math.max(String(n).length,l),this.autofix=a;const c=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<i.length&&i[d]===c[d];)++d;s.mask=i.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(s)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let n="",o="";const[,l,a]=t.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(n="0".repeat(l.length)+a,o="9".repeat(l.length)+a),n=n.padEnd(this.maxLength,"0"),o=o.padEnd(this.maxLength,"9"),[n,o]}doPrepareChar(t,n){n===void 0&&(n={});let o;return[t,o]=super.doPrepareChar(t.replace(/\D/g,""),n),t||(o.skip=!this.isComplete),[t,o]}_appendCharRaw(t,n){if(n===void 0&&(n={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,n);const o=String(this.from).padStart(this.maxLength,"0"),l=String(this.to).padStart(this.maxLength,"0"),[a,s]=this.boundaries(this.value+t);return Number(s)<this.from?super._appendCharRaw(o[this.value.length],n):Number(a)>this.to?!n.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(o[this.value.length],n).aggregate(this._appendCharRaw(t,n)):super._appendCharRaw(l[this.value.length],n):super._appendCharRaw(t,n)}doValidate(t){const n=this.value;if(n.search(/[^0]/)===-1&&n.length<=this._matchFrom)return!0;const[l,a]=this.boundaries(n);return this.from<=Number(a)&&Number(l)<=this.to&&super.doValidate(t)}pad(t){const n=new he;if(this.value.length===this.maxLength)return n;const o=this.value,l=this.maxLength-this.value.length;if(l){this.reset();for(let a=0;a<l;++a)n.aggregate(super._appendCharRaw("0",t));o.split("").forEach(a=>this._appendCharRaw(a))}return n}}fe.MaskedRange=Lt;const xf="d{.}`m{.}`Y";class st extends De{static extractPatternOptions(t){const{mask:n,pattern:o,...l}=t;return{...l,mask:ht(n)?n:o}}constructor(t){super(st.extractPatternOptions({...st.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:n,pattern:o,blocks:l,...a}={...st.DEFAULTS,...t},s=Object.assign({},st.GET_DEFAULT_BLOCKS());t.min&&(s.Y.from=t.min.getFullYear()),t.max&&(s.Y.to=t.max.getFullYear()),t.min&&t.max&&s.Y.from===s.Y.to&&(s.m.from=t.min.getMonth()+1,s.m.to=t.max.getMonth()+1,s.m.from===s.m.to&&(s.d.from=t.min.getDate(),s.d.to=t.max.getDate())),Object.assign(s,this.blocks,l),super._update({...a,mask:ht(n)?n:o,blocks:s})}doValidate(t){const n=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&n!=null&&(this.min==null||this.min<=n)&&(this.max==null||n<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(st.extractPatternOptions(t))}}st.GET_DEFAULT_BLOCKS=()=>({d:{mask:Lt,from:1,to:31,maxLength:2},m:{mask:Lt,from:1,to:12,maxLength:2},Y:{mask:Lt,from:1900,to:9999}}),st.DEFAULTS={...De.DEFAULTS,mask:Date,pattern:xf,format:(r,t)=>{if(!r)return"";const n=String(r.getDate()).padStart(2,"0"),o=String(r.getMonth()+1).padStart(2,"0"),l=r.getFullYear();return[n,o,l].join(".")},parse:(r,t)=>{const[n,o,l]=r.split(".").map(Number);return new Date(l,o-1,n)}},fe.MaskedDate=st;class Tt extends Me{constructor(t){super({...Tt.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map(n=>{const{expose:o,...l}=Vt(n),a=lt({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...l});return o&&(this.exposeMask=a),a}):[])}_appendCharRaw(t,n){n===void 0&&(n={});const o=this._applyDispatch(t,n);return this.currentMask&&o.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(n))),o}_applyDispatch(t,n,o){t===void 0&&(t=""),n===void 0&&(n={}),o===void 0&&(o="");const l=n.tail&&n._beforeTailState!=null?n._beforeTailState._value:this.value,a=this.rawInputValue,s=n.tail&&n._beforeTailState!=null?n._beforeTailState._rawInputValue:a,c=a.slice(s.length),i=this.currentMask,d=new he,u=i?.state;return this.currentMask=this.doDispatch(t,{...n},o),this.currentMask&&(this.currentMask!==i?(this.currentMask.reset(),s&&(this.currentMask.append(s,{raw:!0}),d.tailShift=this.currentMask.value.length-l.length),c&&(d.tailShift+=this.currentMask.append(c,{raw:!0,tail:!0}).tailShift)):u&&(this.currentMask.state=u)),d}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const n=new he;return t&&n.aggregate(this._applyDispatch("",{},t)),n.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var n,o;return{...t,_beforeTailState:((n=t._beforeTailState)==null?void 0:n.currentMaskRef)===this.currentMask&&((o=t._beforeTailState)==null?void 0:o.currentMask)||t._beforeTailState}}doDispatch(t,n,o){return n===void 0&&(n={}),o===void 0&&(o=""),this.dispatch(t,this,n,o)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,n){n===void 0&&(n={});let[o,l]=super.doPrepare(t,n);if(this.currentMask){let a;[o,a]=super.doPrepare(o,this.currentMaskFlags(n)),l=l.aggregate(a)}return[o,l]}doPrepareChar(t,n){n===void 0&&(n={});let[o,l]=super.doPrepareChar(t,n);if(this.currentMask){let a;[o,a]=super.doPrepareChar(o,this.currentMaskFlags(n)),l=l.aggregate(a)}return[o,l]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(n=>n.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask){this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,this._applyDispatch();return}let n=String(t);this.currentMask&&(this.currentMask.typedValue=t,n=this.currentMask.unmaskedValue),this.unmaskedValue=n}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return!!((t=this.currentMask)!=null&&t.isComplete)}get isFilled(){var t;return!!((t=this.currentMask)!=null&&t.isFilled)}remove(t,n){const o=new he;return this.currentMask&&o.aggregate(this.currentMask.remove(t,n)).aggregate(this._applyDispatch()),o}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(n=>n.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:n,currentMaskRef:o,currentMask:l,...a}=t;n&&this.compiledMasks.forEach((s,c)=>s.state=n[c]),o!=null&&(this.currentMask=o,this.currentMask.state=l),super.state=a}extractInput(t,n,o){return this.currentMask?this.currentMask.extractInput(t,n,o):""}extractTail(t,n){return this.currentMask?this.currentMask.extractTail(t,n):super.extractTail(t,n)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,n){return this.currentMask?this.currentMask.nearestInputPos(t,n):super.nearestInputPos(t,n)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((n,o)=>{if(!t[o])return;const{mask:l,...a}=t[o];return un(n,a)&&n.maskEquals(l)}):super.maskEquals(t)}typedValueEquals(t){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(t))}}Tt.DEFAULTS={...Me.DEFAULTS,dispatch:(r,t,n,o)=>{if(!t.compiledMasks.length)return;const l=t.rawInputValue,a=t.compiledMasks.map((s,c)=>{const i=t.currentMask===s,d=i?s.displayValue.length:s.nearestInputPos(s.displayValue.length,le.FORCE_LEFT);return s.rawInputValue!==l?(s.reset(),s.append(l,{raw:!0})):i||s.remove(d),s.append(r,t.currentMaskFlags(n)),s.appendTail(o),{index:c,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(d,s.nearestInputPos(s.displayValue.length,le.FORCE_LEFT)))}});return a.sort((s,c)=>c.weight-s.weight||c.totalInputPositions-s.totalInputPositions),t.compiledMasks[a[0].index]}},fe.MaskedDynamic=Tt;class It extends De{constructor(t){super({...It.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:n,...o}=t;if(n){const l=n.map(c=>c.length),a=Math.min(...l),s=Math.max(...l)-a;o.mask="*".repeat(a),s&&(o.mask+="["+"*".repeat(s)+"]"),this.enum=n}super._update(o)}_appendCharRaw(t,n){n===void 0&&(n={});const o=Math.min(this.nearestInputPos(0,le.FORCE_RIGHT),this.value.length),l=this.enum.filter(a=>this.matchValue(a,this.unmaskedValue+t,o));if(l.length){l.length===1&&this._forEachBlocksInRange(0,this.value.length,(s,c)=>{const i=l[0][c];c>=this.value.length||i===s.value||(s.reset(),s._appendChar(i,n))});const a=super._appendCharRaw(l[0][this.value.length],n);return l.length===1&&l[0].slice(this.unmaskedValue.length).split("").forEach(s=>a.aggregate(super._appendCharRaw(s))),a}return new he({skip:!this.isComplete})}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new at("",t)}remove(t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),t===n)return new he;const o=Math.min(super.nearestInputPos(0,le.FORCE_RIGHT),this.value.length);let l;for(l=t;l>=0&&!(this.enum.filter(c=>this.matchValue(c,this.value.slice(o,l),o)).length>1);--l);const a=super.remove(l,n);return a.tailShift+=l-t,a}get isComplete(){return this.enum.indexOf(this.value)>=0}}It.DEFAULTS={...De.DEFAULTS,matchValue:(r,t,n)=>r.indexOf(t,n)===n},fe.MaskedEnum=It;class ro extends Me{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}fe.MaskedFunction=ro;var oo;class Pe extends Me{constructor(t){super({...Pe.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",o=(this.scale?"("+Pn(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+n+o),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Pn).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Pn(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const n=t.split(this.radix);return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),n.join(this.radix)}doPrepareChar(t,n){n===void 0&&(n={});const[o,l]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(n.input&&n.raw||!n.input&&!n.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),n);return t&&!o&&(l.skip=!0),o&&!this.allowPositive&&!this.value&&o!=="-"&&l.aggregate(this._appendChar("-")),[o,l]}_separatorsCount(t,n){n===void 0&&(n=!1);let o=0;for(let l=0;l<t;++l)this._value.indexOf(this.thousandsSeparator,l)===l&&(++o,n&&(t+=this.thousandsSeparator.length));return o}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,n,o){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n),this._removeThousandsSeparators(super.extractInput(t,n,o))}_appendCharRaw(t,n){n===void 0&&(n={});const o=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,l=this._separatorsCountFromSlice(o);this._value=this._removeThousandsSeparators(this.value);const a=this._value;this._value+=t;const s=this.number;let c=!isNaN(s),i=!1;if(c){let x;this.min!=null&&this.min<0&&this.number<this.min&&(x=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(x=this.max),x!=null&&(this.autofix?(this._value=this.format(x,this).replace(Pe.UNMASKED_RADIX,this.radix),i||(i=a===this._value&&!n.tail)):c=!1),c&&(c=!!this._value.match(this._numberRegExp))}let d;c?d=new he({inserted:this._value.slice(a.length),rawInserted:i?"":t,skip:i}):(this._value=a,d=new he),this._value=this._insertThousandsSeparators(this._value);const u=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,h=this._separatorsCountFromSlice(u);return d.tailShift+=(h-l)*this.thousandsSeparator.length,d}_findSeparatorAround(t){if(this.thousandsSeparator){const n=t-this.thousandsSeparator.length+1,o=this.value.indexOf(this.thousandsSeparator,n);if(o<=t)return o}return-1}_adjustRangeWithSeparators(t,n){const o=this._findSeparatorAround(t);o>=0&&(t=o);const l=this._findSeparatorAround(n);return l>=0&&(n=l+this.thousandsSeparator.length),[t,n]}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n);const o=this.value.slice(0,t),l=this.value.slice(n),a=this._separatorsCount(o.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(o+l));const s=this._separatorsCountFromSlice(o);return new he({tailShift:(s-a)*this.thousandsSeparator.length})}nearestInputPos(t,n){if(!this.thousandsSeparator)return t;switch(n){case le.NONE:case le.LEFT:case le.FORCE_LEFT:{const o=this._findSeparatorAround(t-1);if(o>=0){const l=o+this.thousandsSeparator.length;if(t<l||this.value.length<=l||n===le.FORCE_LEFT)return o}break}case le.RIGHT:case le.FORCE_RIGHT:{const o=this._findSeparatorAround(t);if(o>=0)return o+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let n=t;this.min!=null&&(n=Math.max(n,this.min)),this.max!=null&&(n=Math.min(n,this.max)),n!==t&&(this.unmaskedValue=this.format(n,this));let o=this.value;this.normalizeZeros&&(o=this._normalizeZeros(o)),this.padFractionalZeros&&this.scale>0&&(o=this._padFractionalZeros(o)),this._value=o}super.doCommit()}_normalizeZeros(t){const n=this._removeThousandsSeparators(t).split(this.radix);return n[0]=n[0].replace(/^(\D*)(0*)(\d*)/,(o,l,a,s)=>l+s),t.length&&!/\d$/.test(n[0])&&(n[0]=n[0]+"0"),n.length>1&&(n[1]=n[1].replace(/0*$/,""),n[1].length||(n.length=1)),this._insertThousandsSeparators(n.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const n=t.split(this.radix);return n.length<2&&n.push(""),n[1]=n[1].padEnd(this.scale,"0"),n.join(this.radix)}doSkipInvalid(t,n,o){n===void 0&&(n={});const l=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===Pe.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,n,o)&&!l}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,Pe.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(Pe.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||Pe.EMPTY_VALUES.includes(t)&&Pe.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}oo=Pe,Pe.UNMASKED_RADIX=".",Pe.EMPTY_VALUES=[...Me.EMPTY_VALUES,0],Pe.DEFAULTS={...Me.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[oo.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:r=>r.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},fe.MaskedNumber=Pe;const mn={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Hn(r,t,n){t===void 0&&(t=mn.MASKED),n===void 0&&(n=mn.MASKED);const o=lt(r);return l=>o.runIsolated(a=>(a[t]=l,a[n]))}function lo(r,t,n,o){return Hn(t,n,o)(r)}fe.PIPE_TYPE=mn,fe.createPipe=Hn,fe.pipe=lo;class ao extends De{get repeatFrom(){var t;return(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?t:0}get repeatTo(){var t;return(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var n,o,l;const{repeat:a,...s}=Vt(t);this._blockOpts=Object.assign({},this._blockOpts,s);const c=lt(this._blockOpts);this.repeat=(n=(o=a??c.repeat)!=null?o:this.repeat)!=null?n: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:c},eager:c.eager,overwrite:c.overwrite,skipInvalid:c.skipInvalid,lazy:c.lazy,placeholderChar:c.placeholderChar,displayChar:c.displayChar})}_allocateBlock(t){if(t<this._blocks.length)return this._blocks[t];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(lt(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,n){n===void 0&&(n={});const o=new he;for(let i=(l=(a=this._mapPosToBlock(this.displayValue.length))==null?void 0:a.index)!=null?l:Math.max(this._blocks.length-1,0),d,u;d=(s=this._blocks[i])!=null?s:u=!u&&this._allocateBlock(i);++i){var l,a,s,c;const h=d._appendChar(t,{...n,_beforeTailState:(c=n._beforeTailState)==null||(c=c._blocks)==null?void 0:c[i]});if(h.skip&&u){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(o.aggregate(h),h.consumed)break}return o}_trimEmptyTail(t,n){var o,l;t===void 0&&(t=0);const a=Math.max(((o=this._mapPosToBlock(t))==null?void 0:o.index)||0,this.repeatFrom,0);let s;n!=null&&(s=(l=this._mapPosToBlock(n))==null?void 0:l.index),s==null&&(s=this._blocks.length-1);let c=0;for(let i=s;a<=i&&!this._blocks[i].unmaskedValue;--i,++c);c&&(this._blocks.splice(s-c+1,c),this.mask=this.mask.slice(c))}reset(){super.reset(),this._trimEmptyTail()}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const o=super.remove(t,n);return this._trimEmptyTail(t,n),o}totalInputPositions(t,n){return t===void 0&&(t=0),n==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,n)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}fe.RepeatBlock=ao;try{globalThis.IMask=fe}catch{}const qn=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:he,ChunksTailDetails:gt,DIRECTION:le,HTMLContenteditableMaskElement:jn,HTMLInputMaskElement:eo,HTMLMaskElement:Mt,InputMask:to,MaskElement:pn,Masked:Me,MaskedDate:st,MaskedDynamic:Tt,MaskedEnum:It,MaskedFunction:ro,MaskedNumber:Pe,MaskedPattern:De,MaskedRange:Lt,MaskedRegExp:no,PIPE_TYPE:mn,PatternFixedDefinition:Un,PatternInputDefinition:Dt,RepeatBlock:ao,createMask:lt,createPipe:Hn,default:fe,forceDirection:Zr,normalizeOpts:Vt,pipe:lo},Symbol.toStringTag,{value:"Module"})),wf=async r=>{try{const t=new FormData;return t.append("unique","true"),t.append("file",r),(await(await fetch("/file/upload/uploads?id=&form=&table=",{method:"POST",body:t})).json())?.result}catch(t){console.error(t)}},_f=async(r,t,n)=>{const o=t.clipboardData?.items;if(o){const l=t.clipboardData?.getData("text/html"),a=t.clipboardData?.getData("text/plain");if(l){const{state:s,dispatch:c}=r,{tr:i}=s,d=n.fromSchema(r.state.schema),u=new DOMParser().parseFromString(l,"text/html").body,h=d.parse(u),x=i.replaceSelectionWith(h);return c(x),t.preventDefault(),!0}if(a){const{state:s,dispatch:c}=r,{tr:i}=s,d=i.insertText(a,s.selection.from,s.selection.to);return c(d),t.preventDefault(),!0}for(let s=0;s<o.length;s++){const c=o[s];if(c.type.startsWith("image/")){const i=c.getAsFile();if(i){const d=await wf(i),{schema:u}=r.state,h=u.nodes.image.create({src:d?.file_path}),x=r.state.tr.replaceSelectionWith(h);return r.dispatch(x),t.preventDefault(),!0}}}}return!1},vf="https://esm.sh",He="3.7.2",so="3.7.2",Cf=`?deps=@tiptap/core@${He},@tiptap/pm@${so}`,qe=r=>`${vf}/${r}${Cf}`,Ge={core:qe(`@tiptap/core@${He}`),starterKit:qe(`@tiptap/starter-kit@${He}`),textStyle:qe(`@tiptap/extension-text-style@${He}`),table:qe(`@tiptap/extension-table@${He}`),highlight:qe(`@tiptap/extension-highlight@${He}`),subscript:qe(`@tiptap/extension-subscript@${He}`),superscript:qe(`@tiptap/extension-superscript@${He}`),link:qe(`@tiptap/extension-link@${He}`),image:qe(`@tiptap/extension-image@${He}`),textAlign:qe(`@tiptap/extension-text-align@${He}`),heading:qe(`@tiptap/extension-heading@${He}`),paragraph:qe(`@tiptap/extension-paragraph@${He}`),pmModel:qe(`@tiptap/pm@${so}/model`)},Rt="__vs_form_tiptap_loader__",Ke=r=>import(r),Ae=(r,t)=>r?.[t]||r?.default?.[t]||r?.default?.default?.[t]||r?.default||r,io={1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"},Ef=r=>r.extend({addOptions(){return{...this.parent?.(),levels:[1,2,3,4,5,6]}}}).extend({addAttributes(){return{...this.parent?.(),level:{default:1,renderHTML:t=>{const n=t.level||1;return{class:`heading-level-${n}`,style:io[n]||io[1]}}}}}}),Bf=r=>r.configure({HTMLAttributes:{style:"min-height: 1rem;"}}),Vf=(r,t,n,o,l)=>{const a=t.extend({renderHTML({HTMLAttributes:s}){return["div",{style:"overflow-x: auto;"},["table",s,0]]},parseHTML(){return[{tag:"div.table-wrapper table",priority:100},{tag:"table"}]}});return r.extend({addExtensions(){return[a.configure({HTMLAttributes:{class:"editor-content"},resizable:!0}),n,o,l]}})},Sf=r=>r.extend({addAttributes(){return{...this.parent?.(),fontFamily:{default:null,parseHTML:t=>t.style.fontFamily?.replace(/['"]/g,""),renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}},fontSize:{default:null,parseHTML:t=>t.style.fontSize?.replace(/['"]/g,""),renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}},color:{default:null,parseHTML:t=>t.style.color?.replace(/['"]/g,""),renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}},backgroundColor:{default:null,parseHTML:t=>t.style.backgroundColor?.replace(/['"]/g,""),renderHTML:t=>!t.backgroundColor||t.backgroundColor==="transparent"?{}:{style:`background-color: ${t.backgroundColor}`}}}},addCommands(){return{setFontFamily:t=>({chain:n})=>n().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run(),setFontSize:t=>({chain:n})=>n().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run(),setColor:t=>({chain:n})=>n().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run(),setBackgroundColor:t=>({chain:n})=>n().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),$f=r=>r.create({name:"iframe",group:"block",inline:!1,atom:!0,selectable:!0,addAttributes(){return{src:{default:null},width:{default:"100%"},height:{default:"280"},frameborder:{default:"0"},allow:{default:null},allowfullscreen:{default:null},referrerpolicy:{default:null},loading:{default:null},class:{default:null},title:{default:null},style:{default:null}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:t}){return["iframe",t]}});async function Nf(){if(typeof window>"u")return null;const r=window;return r[Rt]||(r[Rt]=Promise.all([Ke(Ge.core),Ke(Ge.starterKit),Ke(Ge.textStyle),Ke(Ge.table),Ke(Ge.highlight),Ke(Ge.subscript),Ke(Ge.superscript),Ke(Ge.link),Ke(Ge.image),Ke(Ge.textAlign),Ke(Ge.heading),Ke(Ge.paragraph),Ke(Ge.pmModel)]).then(([t,n,o,l,a,s,c,i,d,u,h,x,g])=>{const m=Ae(t,"Editor"),f=Ae(t,"Node"),b=Ae(t,"Extension"),w=Ae(n,"StarterKit"),_=Ae(o,"TextStyle"),k=Ae(l,"TableKit"),C=Ae(l,"Table"),E=Ae(l,"TableRow"),I=Ae(l,"TableCell"),A=Ae(l,"TableHeader"),B=Ae(a,"Highlight"),$=Ae(s,"Subscript"),S=Ae(c,"Superscript"),L=Ae(i,"Link"),F=Ae(d,"Image"),P=Ae(u,"TextAlign"),M=Ae(h,"Heading"),O=Ae(x,"Paragraph"),T=Ae(g,"DOMParser");if(!m||!f||!w||!_||!k||!C||!E||!I||!A||!B||!$||!S||!L||!F||!P||!M||!O||!T)throw new Error("Failed to resolve one or more Tiptap modules");return{Editor:m,Extension:b,ProseMirrorDOMParser:T,StarterKit:w,ExtendedTextStyle:Sf(_),Highlight:B,Subscript:$,Superscript:S,Link:L,Image:F,TextAlign:P,CustomHeading:Ef(M),CustomParagraph:Bf(O),CustomTableKit:Vf(k,C,E,I,A),Iframe:$f(f)}}).catch(t=>{throw delete r[Rt],t})),r[Rt]}function Af(r){let t=!1;const n=e.shallowRef(null),o=e.ref(!1),l=e.ref(""),a=async(d,u="")=>{if(!d)return null;o.value=!0,l.value="";try{const h=await Nf();if(!h)return null;const x=new h.Editor({element:d,content:u,extensions:[h.StarterKit.configure({history:{depth:100,newGroupDelay:500},code:{HTMLAttributes:{class:"editor-code"}},codeBlock:{HTMLAttributes:{class:"editor-codeblock"}},paragraph:!1,heading:!1,link:!1}),h.Superscript,h.Subscript,h.ExtendedTextStyle,h.CustomParagraph,h.CustomHeading,h.Highlight,h.Image.configure({inline:!0,allowBase64:!0,HTMLAttributes:{class:"editor-image"}}),h.TextAlign.configure({types:["heading","paragraph"]}),h.Link.configure({HTMLAttributes:{class:"editor-link"},openOnClick:!1,autolink:!0}),h.CustomTableKit,h.Iframe],editorProps:{handlePaste:(g,m)=>_f(g,m,h.ProseMirrorDOMParser),handleKeyDown:(g,m)=>{if(m.key==="Tab"){const f=g.state,{$anchor:b}=f.selection;let w=!1;for(let _=b.depth;_>0;_--){const k=b.node(_);if(k&&(k.type.name==="bulletList"||k.type.name==="orderedList")){w=!0;break}}return w?!1:(m.preventDefault(),!0)}return!1}}});return n.value=e.markRaw(x),x}catch(h){return l.value="Failed to load rich text editor dependencies.",console.error("Failed to initialize rich text editor",h),null}finally{o.value=!1}},s=e.computed(()=>n.value||null);return e.watch(n,d=>{d&&n.value.on("update",u=>{if(!t){t=!0;const h=u.editor.getHTML();r.modelValue,setTimeout(()=>{t=!1},10)}})}),{editor:n,editorInstance:s,focusEditor:()=>{n.value&&!n.value.isFocused&&n.value.commands.focus()},createEditor:a,destroyEditor:()=>{n.value&&(n.value.destroy(),n.value=null)},isLoading:o,loadError:l}}function Ff(r,t,n,{toEditorContent:o,toSourceContent:l}={}){const a=e.ref(!1),s=e.ref(""),c=e.ref(null);return{isHtmlMode:a,htmlContent:s,htmlTextarea:c,toggleHtmlMode:async u=>{if(a.value=u,u)r.value&&(s.value=l?await l(r.value.getHTML(),t):r.value.getHTML()),e.nextTick(()=>{c.value&&c.value.focus?.()});else if(r.value){const h=o?await o(s.value,t):s.value;r.value.commands.setContent(h,!0),e.nextTick(()=>{r.value?.commands?.focus?.()})}},onHtmlInput:u=>{s.value=u,n&&n("update:modelValue",u)}}}function Mf(){const r=e.ref(!1);return{isFullscreen:r,toggleFullscreen:()=>{r.value=!r.value}}}const yt=r=>r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),Ot=r=>{let t=yt(r||"");return t=t.replace(/!\[([^\]]*)]\(([^)\s]+)(?:\s+"([^"]+)")?\)/g,(n,o,l,a)=>{const s=a?` title="${yt(a)}"`:"";return`<img src="${yt(l)}" alt="${yt(o)}"${s}>`}),t=t.replace(/\[([^\]]+)]\(([^)\s]+)(?:\s+"([^"]+)")?\)/g,(n,o,l,a)=>{const s=a?` title="${yt(a)}"`:"";return`<a href="${yt(l)}"${s} target="_blank" rel="noopener noreferrer">${o}</a>`}),t=t.replace(/`([^`]+)`/g,"<code>$1</code>"),t=t.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),t=t.replace(/__([^_]+)__/g,"<strong>$1</strong>"),t=t.replace(/~~([^~]+)~~/g,"<del>$1</del>"),t=t.replace(/\*([^*\n]+)\*/g,"<em>$1</em>"),t=t.replace(/_([^_\n]+)_/g,"<em>$1</em>"),t},zt=r=>/^\s*\d+\.\s+/.test(r),Gn=r=>/^\s*[-*+]\s+/.test(r),co=r=>/^\s*[-*+]\s+\[[ xX]\]\s+/.test(r),Kn=r=>/^\s*>\s?/.test(r),Wn=r=>/^\s*\|?(?:\s*:?-{3,}:?\s*\|)+\s*:?-{3,}:?\s*\|?\s*$/.test(r),uo=r=>r.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(t=>Ot(t.trim())),Df=(r,t)=>{const n=r[t],o=r[t+1];if(!n||!o||!n.includes("|")||!Wn(o))return null;const l=uo(n),a=[];let s=t+2;for(;s<r.length&&r[s].includes("|")&&r[s].trim()!=="";){const d=uo(r[s]);a.push(`<tr>${d.map(u=>`<td>${u}</td>`).join("")}</tr>`),s+=1}const c=`<thead><tr>${l.map(d=>`<th>${d}</th>`).join("")}</tr></thead>`,i=a.length?`<tbody>${a.join("")}</tbody>`:"";return{html:`<table>${c}${i}</table>`,nextIndex:s}},Lf=(r,t)=>{const n=zt(r[t]),o=n?"ol":"ul",l=[];let a=t;for(;a<r.length;){const s=r[a];if(s.trim()===""||!(n?zt(s):(Gn(s)||co(s))&&!zt(s)))break;const i=s.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.*)$/);if(i){const d=i[1].toLowerCase()==="x";l.push(`<li><input type="checkbox" disabled${d?" checked":""}> ${Ot(i[2])}</li>`)}else{const d=s.replace(/^\s*(?:[-*+]|\d+\.)\s+/,"");l.push(`<li>${Ot(d)}</li>`)}a+=1}return{html:`<${o}>${l.join("")}</${o}>`,nextIndex:a}},Tf=(r,t)=>{const o=r[t].replace(/^```/,"").trim(),l=[];let a=t+1;for(;a<r.length&&!r[a].startsWith("```");)l.push(r[a]),a+=1;return{html:`<pre><code${o?` class="language-${yt(o)}"`:""}>${yt(l.join(`
|
|
6
|
-
`))}</code></pre>`,nextIndex:a<r.length?a+1:a}},If=(r,t)=>{const n=[];let o=t;for(;o<r.length;){const l=r[o];if(l.trim()===""||l.startsWith("```")||/^#{1,6}\s+/.test(l)||/^---+$/.test(l.trim())||/^\*\*\*+$/.test(l.trim())||Kn(l)||
|
|
4
|
+
50.4494, 30.5260`},format:{type:"Radio",label:"Формат координат",options:[{id:"decimal",text:"Десяткові (Decimal)"},{id:"dms",text:"Градуси-хвилини-секунди (DMS)"}]},order:{type:"Radio",label:"Порядок координат",options:[{id:"lat-lon",text:"lat, lon"},{id:"lon-lat",text:"lon, lat"}]}};let re=!1,de=!1;const ce=e.reactive({}),ye=e.ref([]),Le=e.computed(()=>ye.value.map(p=>ce[p]).filter(Boolean)),$e=e.ref(null),tt=e.computed(()=>$e.value?.entries??[]),it=e.computed(()=>{if($e.value)return{left:`${$e.value.point.x+12}px`,top:`${$e.value.point.y+12}px`}}),Re=e.computed(()=>{if(Array.isArray(n.tools)&&n.tools.length)return n.tools;const p=l?.tools;return Array.isArray(p)?p.map(y=>String(y)):typeof p=="string"?p.split(",").map(y=>y.trim()).filter(Boolean):[]}),Be=e.computed(()=>{const p={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1,ruler:!1};if(!Re.value.length)return{...p,import:!0,export:!0,point:!0,line:!0,polygon:!0,rectangle:!0};const y=new Set(Re.value.map(v=>v.toLowerCase()));return{search:y.has("search"),import:y.has("import"),export:y.has("export"),point:y.has("point"),line:y.has("line"),polygon:y.has("polygon"),rectangle:y.has("rectangle"),ruler:y.has("ruler")}});function U(p){if(typeof p!="string"||!p.trim())return"";if(/^https?:\/\//i.test(p))return p;const y=window?.location?.origin??"",v=p.replace(/^\/+/,"");return v?y?`${y}/${v}`:`/${v}`:y}function Z(){const p=Array.isArray(k.basemaps)&&k.basemaps.length?k.basemaps:_.basemaps;if(Array.isArray(p)&&p.length){const v=p.map((V,N)=>{const H=String(V?.key??V?.id??V?.name??`b${N}`),te=U(String(V?.url??""));if(!te)return null;const oe=typeof V?.preview=="string"&&V.preview?U(V.preview):"";return[H,{...V,url:te,preview:oe}]}).filter(V=>Array.isArray(V)&&V.length===2).reduce((V,[N,H])=>(V[N]=H,V),{});if(Object.keys(v).length)return v}return{voyager:{name:"Оглядова карта",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/voyager/ua/13/4790/2762.png"},orto10:{name:"Ортофото 1:10K",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4790/2762.png"},osmb:{name:"Open Street Maps",url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",preview:"https://tile.openstreetmap.org.ua/styles/osm-bright/13/4790/2762.png"}}}const ee=Z(),ae=Object.keys(ee),ie=e.ref(ae.length?ae[0]:"");async function Ce(){if(typeof window>"u")return null;const p=window;if(p[Zt])return p[Zt];const y=H=>{if(Array.from(document.styleSheets).some(Se=>Se?.href?.includes(H)))return;const oe=document.createElement("link");oe.rel="stylesheet",oe.href=H,document.head.appendChild(oe)},v=async()=>{const H=new Function("u","return import(u)"),te=await H("https://esm.sh/maplibre-gl@3.6.2"),oe=te?.default??te;if(!oe)throw new Error("maplibre esm fallback failed");window.maplibregl=oe,window.mapboxgl=oe;const Se=await H("https://esm.sh/@mapbox/mapbox-gl-draw@1.5.0"),Ye=Se?.default??Se;if(!Ye)throw new Error("mapbox draw esm fallback failed");window.MapboxDraw=Ye},N=(async()=>{y("https://unpkg.com/maplibre-gl@3.6.2/dist/maplibre-gl.css"),y("https://unpkg.com/@mapbox/mapbox-gl-draw@1.5.0/dist/mapbox-gl-draw.css"),(!window.maplibregl||!window.MapboxDraw)&&await v();const H=window.maplibregl,te=window.MapboxDraw;if(!H)throw new Error("maplibregl not available after load");if(!te)throw new Error("MapboxDraw not available after load");return{maplibregl:H,MapboxDraw:te}})().catch(H=>{throw delete p[Zt],H});return p[Zt]=N,N}function _e(p){return{version:8,sources:{rasterSource:{type:"raster",tiles:[p],tileSize:256}},layers:[{id:"rasterLayer",type:"raster",source:"rasterSource"}]}}let z=null,Q=null,D=null,K=null,ke=[],Ze=null,Oe=null,Ve=null,nt=!1,rt=!1,Je=!1,Te=null;function kt(){return{onSetup(){const p=this.newFeature({type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[0,0],[0,0],[0,0],[0,0],[0,0]]]}});return this.addFeature(p),this.clearSelectedFeatures(),this.updateUIClasses({mouse:"add"}),this.setActionableState({trash:!0}),{rectangle:p,startPoint:null,hasCoordinates:!1}},onMouseMove(p,y){if(!p.startPoint)return;const[v,V]=p.startPoint,N=y.lngLat.lng,H=y.lngLat.lat;p.rectangle.setCoordinates([[[v,V],[N,V],[N,H],[v,H],[v,V]]])},onClick(p,y){if(!p.startPoint){p.startPoint=[y.lngLat.lng,y.lngLat.lat],p.hasCoordinates=!0,p.rectangle.setCoordinates([[[y.lngLat.lng,y.lngLat.lat],[y.lngLat.lng,y.lngLat.lat],[y.lngLat.lng,y.lngLat.lat],[y.lngLat.lng,y.lngLat.lat],[y.lngLat.lng,y.lngLat.lat]]]);return}const[v,V]=p.startPoint,N=y.lngLat.lng,H=y.lngLat.lat;return Math.abs(v-N)>0&&Math.abs(V-H)>0?(p.rectangle.setCoordinates([[[v,V],[N,V],[N,H],[v,H],[v,V]]]),this.map.fire("draw.create",{features:[p.rectangle.toGeoJSON()]}),this.changeMode("simple_select",{featureIds:[p.rectangle.id]})):(this.deleteFeature([p.rectangle.id],{silent:!0}),p.hasCoordinates=!1,this.changeMode("simple_select"))},onStop(){},onTrash(p){this.deleteFeature([p.rectangle.id],{silent:!0}),this.changeMode("simple_select")},toDisplayFeatures(p,y,v){const V=y.properties.id===p.rectangle.id;V&&!p.hasCoordinates||(y.properties.active=V?"true":"false",v(y))}}}const Ut=[{id:"gl-draw-polygon-fill-inactive",type:"fill",filter:["all",["==","$type","Polygon"],["!=","active","true"]],paint:{"fill-color":"#3b82f6","fill-outline-color":"#3b82f6","fill-opacity":.1}},{id:"gl-draw-polygon-fill-active",type:"fill",filter:["all",["==","$type","Polygon"],["==","active","true"]],paint:{"fill-color":"#2563eb","fill-outline-color":"#2563eb","fill-opacity":.2}},{id:"gl-draw-polygon-stroke-inactive",type:"line",filter:["all",["==","$type","Polygon"],["!=","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3b82f6","line-width":2}},{id:"gl-draw-polygon-stroke-active",type:"line",filter:["all",["==","$type","Polygon"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#2563eb","line-width":2}},{id:"gl-draw-lines-inactive",type:"line",filter:["all",["==","$type","LineString"],["!=","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#3b82f6","line-width":2}},{id:"gl-draw-lines-active",type:"line",filter:["all",["==","$type","LineString"],["==","active","true"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"#2563eb","line-width":2}},{id:"gl-draw-point-inactive",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["!=","active","true"]],paint:{"circle-radius":5,"circle-color":"#3b82f6"}},{id:"gl-draw-point-active",type:"circle",filter:["all",["==","$type","Point"],["!=","meta","midpoint"],["==","active","true"]],paint:{"circle-radius":6,"circle-color":"#2563eb"}},{id:"gl-draw-polygon-and-line-vertex-halo-active",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"]],paint:{"circle-radius":7,"circle-color":"#fff"}},{id:"gl-draw-polygon-and-line-vertex-active",type:"circle",filter:["all",["==","meta","vertex"],["==","$type","Point"]],paint:{"circle-radius":5,"circle-color":"#2563eb"}},{id:"gl-draw-polygon-midpoint",type:"circle",filter:["all",["==","meta","midpoint"],["==","$type","Point"]],paint:{"circle-radius":4,"circle-color":"#1d4ed8"}}];function Ht(){const p=ie.value;return!p||!ee[p]?.url?"":ee[p].url}function gn(p,y){return p?.id?String(p.id):p?.url?`${p.url}-${y}`:`layer-${y}`}function Jn(p){const y=String(p?.url??"").trim();if(!y)return"";if(/^https?:\/\//i.test(y))return y;const v=window.location?.origin??"",V=y.replace(/^\/+/,"");return`${v}/${V}`}function xt(p){p&&$e.value?.layerId!==p||($e.value=null)}function Qn(p,y={}){return p.popup===!1?[]:Array.isArray(p.popup)?p.popup.length?p.popup.map(v=>{const V=v?.field||v?.name;if(!V)return null;const N=y[V];return N==null||N===""?null:{key:v.label||V,value:String(N)}}).filter(Boolean):[]:Object.entries(y).slice(0,5).map(([v,V])=>({key:v,value:V==null?"—":String(V)}))}function yn(p){if(!Array.isArray(p))return[];const y=V=>Array.isArray(V)&&V.length>=2&&Number.isFinite(Number(V[0]))&&Number.isFinite(Number(V[1])),v=V=>{if(!V.length)return V;const N=V[0],H=V[V.length-1];return!H||N[0]!==H[0]||N[1]!==H[1]?[...V,N]:V};if(p.length&&y(p[0])){const V=p.map(N=>[Number(N[0]),Number(N[1])]).filter(y);return V.length?[v(V)]:[]}return p.length&&Array.isArray(p[0])&&y(p[0][0])?p.map(N=>Array.isArray(N)?N.map(H=>[Number(H[0]),Number(H[1])]):[]).filter(N=>N.length).map(v):p.length&&Array.isArray(p[0])&&Array.isArray(p[0][0])&&y(p[0][0][0])?p.flatMap(N=>Array.isArray(N)?N:[]).map(N=>Array.isArray(N)?N.map(H=>[Number(H[0]),Number(H[1])]):[]).filter(N=>N.length).map(v):[]}function bn(p){const y=p.style??{},v=y.color??"#3b82f6";if(!y.colorAttr||!y.colorSet)return v;const V=Object.keys(y.colorSet);if(!V.length)return v;const N=["match",["to-string",["get",y.colorAttr]]];return V.forEach(H=>{N.push(String(H),y.colorSet?.[H]??v)}),N.push(v),N}function R(p){if(!D)return;p.handlers.forEach(v=>{try{D.off(v.type,v.layerId,v.handler)}catch{}}),p.handlers=[],[...p.layerIds,...p.boundsIds].forEach(v=>{D.getLayer(v)&&D.removeLayer(v)}),D.getSource(p.sourceId)&&D.removeSource(p.sourceId);const y=`vs-ov-bounds-src-${p.id}`;D.getSource(y)&&D.removeSource(y),xt(p.id)}function Y(p,y){if(!D)return[];const v=`vs-ov-bounds-src-${y}`,V=`vs-ov-bounds-line-${y}`,N=p.bounds??F.value??W.value,H=yn(N);if(!H.length)return[];const te={type:"FeatureCollection",features:H.map(oe=>({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:oe}}))};return D.getSource(v)&&D.removeSource(v),D.addSource(v,{type:"geojson",data:te}),D.addLayer({id:V,type:"line",source:v,paint:{"line-color":p.style?.stroke??p.style?.color??"#2563eb","line-width":p.style?.width??2,"line-opacity":p.style?.opacity??.8,"line-dasharray":[2,2]}}),[V]}function q(p){if(!D)return;R(p);const y=p.config,v=Jn(y);if(!v)return;const V=[],N=[];if(/\.v(?:m)?t(?:\?|$)/i.test(v)||/\.pbf(?:\?|$)/i.test(v)){const oe=y.sourceLayer||y.layer||y.service_layer||y.dataset?.layer||y.id;D.addSource(p.sourceId,{type:"vector",tiles:[v]});const Se=String(y.style?.type??"polygon").toLowerCase(),Ye=bn(y),ot=y.style?.opacity??.5;if(Se==="point"){const ct=`vs-ov-point-${p.id}`;D.addLayer({id:ct,type:"circle",source:p.sourceId,"source-layer":oe,paint:{"circle-color":Ye,"circle-radius":5,"circle-opacity":ot}}),V.push(ct)}else if(Se==="polyline"||Se==="line"){const ct=`vs-ov-line-${p.id}`;D.addLayer({id:ct,type:"line",source:p.sourceId,"source-layer":oe,layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":Ye,"line-width":y.style?.width??2,"line-opacity":ot}}),V.push(ct)}else{const ct=`vs-ov-fill-${p.id}`,Gt=`vs-ov-border-${p.id}`;D.addLayer({id:ct,type:"fill",source:p.sourceId,"source-layer":oe,paint:{"fill-color":Ye,"fill-opacity":ot}}),D.addLayer({id:Gt,type:"line",source:p.sourceId,"source-layer":oe,paint:{"line-color":y.style?.stroke??y.style?.color??"#2563eb","line-width":y.style?.width??1,"line-opacity":ot}}),V.push(ct,Gt)}}else{D.addSource(p.sourceId,{type:"raster",tiles:[v],tileSize:256});const oe=`vs-ov-raster-${p.id}`;D.addLayer({id:oe,type:"raster",source:p.sourceId,paint:{"raster-opacity":y.style?.opacity??1}}),V.push(oe)}V.forEach(oe=>{const Se=ot=>{if(!ot?.features?.length){xt(p.id);return}const ct=ot.features[0]?.properties??{},Gt=Qn(p.config,ct);if(!Gt.length){xt(p.id);return}$e.value={layerId:p.id,entries:Gt,point:{x:ot.point.x,y:ot.point.y}}},Ye=()=>xt(p.id);D.on("mousemove",oe,Se),D.on("mouseleave",oe,Ye),N.push({layerId:oe,type:"mousemove",handler:Se},{layerId:oe,type:"mouseleave",handler:Ye})}),p.layerIds=V,p.boundsIds=Y(p.config,p.id),p.handlers=N;const te=p.visible?"visible":"none";[...p.layerIds,...p.boundsIds].forEach(oe=>{D.getLayer(oe)&&D.setLayoutProperty(oe,"visibility",te)})}function se(){if(!D)return;const y={type:"FeatureCollection",features:yn(F.value??W.value).map(v=>({type:"Feature",properties:{},geometry:{type:"LineString",coordinates:v}}))};D.getSource(Jt)?D.getSource(Jt).setData(y):D.addSource(Jt,{type:"geojson",data:y}),D.getLayer(Qt)||D.addLayer({id:Qt,type:"line",source:Jt,paint:{"line-color":"#2563eb","line-width":2,"line-opacity":.8,"line-dasharray":[2,2]}})}function xe(p){if(!D||s.value)return;const y=ce[p];if(!y)return;y.visible=!y.visible;const v=y.visible?"visible":"none";[...y.layerIds,...y.boundsIds].forEach(V=>{D.getLayer(V)&&D.setLayoutProperty(V,"visibility",v)}),be(),y.visible||xt(p)}function be(){if(!D)return;const p=[],y=[],v=[],V=[];ye.value.forEach(te=>{const oe=ce[te];if(!oe)return;const Se=String(oe.config?.url??""),Ye=/\.v(?:m)?t(?:\?|$)/i.test(Se),ot=/\.png(?:\?|$)/i.test(Se);Ye?v.push(...oe.layerIds):ot?p.push(...oe.layerIds):y.push(...oe.layerIds),V.push(...oe.boundsIds)}),[...p,...y,...v,...V].forEach(te=>{D.getLayer(te)&&D.moveLayer(te)}),D.getLayer(Qt)&&D.moveLayer(Qt),(D.getStyle?.()?.layers??[]).map(te=>String(te?.id??"")).filter(te=>te.startsWith("gl-draw-")).forEach(te=>{D.getLayer(te)&&D.moveLayer(te)})}function ve(p){if(!ee[p]||(ie.value=p,!D))return;const y=Ht();if(!y)return;const v=D.getCenter?.(),V=D.getZoom?.(),N=K?.getAll?.();D.setStyle(_e(y)),D.once("style.load",()=>{if(D&&(v&&Number.isFinite(V)&&D.jumpTo({center:[v.lng,v.lat],zoom:V}),se(),ye.value.forEach(H=>{const te=ce[H];te&&q(te)}),be(),N?.features?.length&&K))try{N.features.forEach(H=>K.add(H)),d.value=N.features.length}catch{d.value=0}})}function Ne(p){return{type:"Feature",properties:{},geometry:p}}function Ee(p){if(!p)return null;try{return JSON.parse(JSON.stringify(p))}catch{return null}}function ze(p){if(!p)return null;const y=Ee(p.geometry);return y?{...p.id!==void 0?{id:p.id}:{},type:"Feature",properties:{...p.properties??{}},geometry:y}:null}function je(p){if(!p)return[];const y=(N,H)=>{if(!N?.type)return[];const te={...H??{}};return N.type==="MultiPoint"&&Array.isArray(N.coordinates)?N.coordinates.map(oe=>Ne({type:"Point",coordinates:oe})).map(oe=>({...oe,properties:te})):N.type==="MultiLineString"&&Array.isArray(N.coordinates)?N.coordinates.map(oe=>Ne({type:"LineString",coordinates:oe})).map(oe=>({...oe,properties:te})):N.type==="MultiPolygon"&&Array.isArray(N.coordinates)?N.coordinates.map(oe=>Ne({type:"Polygon",coordinates:oe})).map(oe=>({...oe,properties:te})):N.type==="GeometryCollection"&&Array.isArray(N.geometries)?N.geometries.flatMap(oe=>y(oe,te)):[{type:"Feature",properties:te,geometry:Ee(N)}]},v=N=>{if(!N)return null;if(N.type==="Feature"){const H=ze(N);return H?y(H.geometry,H.properties):null}return N.geom?.type&&Array.isArray(N.geom.coordinates)?y({type:N.geom.type,coordinates:N.geom.coordinates},N.properties??{}):N.type==="GeometryCollection"&&Array.isArray(N.geometries)?y(N,N.properties??{}):typeof N.type=="string"&&Array.isArray(N.coordinates)?y(Ee(N),N.properties??{}):null};if(p.type==="FeatureCollection")return(p.features??[]).flatMap(v).filter(Boolean);if(Array.isArray(p))return p.flatMap(N=>N?.type==="FeatureCollection"?je(N):[v(N)]).flat().filter(Boolean);const V=v(p);return V?Array.isArray(V)?V:[V]:[]}function We(p){if(!p.length)return null;if(!a.value)return Ee(p[0]?.geometry??null);const y=p.map(H=>Ee(H?.geometry)).filter(Boolean);return y.every(H=>H?.type==="Point")?{type:"MultiPoint",coordinates:y.map(H=>H.coordinates)}:y.every(H=>H?.type==="LineString")?{type:"MultiLineString",coordinates:y.map(H=>H.coordinates)}:y.every(H=>H?.type==="Polygon")?{type:"MultiPolygon",coordinates:y.map(H=>H.coordinates)}:{type:"GeometryCollection",geometries:y}}function $t(p){if(!p)return"__null__";try{return JSON.stringify(p)}catch{return"__invalid__"}}function og(p,y){if(!Array.isArray(p)||!Array.isArray(y)||p.length<2||y.length<2)return!1;const v=1e-12;return Math.abs(Number(p[0])-Number(y[0]))<v&&Math.abs(Number(p[1])-Number(y[1]))<v}function wo(p,y){if(!Array.isArray(p)||p.length<4)return null;const V=og(p[0],p[p.length-1])?p.slice(0,-1):p.slice();return!Number.isInteger(y)||y<0||y>=V.length||V.length<=3||(V.splice(y,1),V.length<3)?null:[...V,[...V[0]]]}function _o(p,y){if(!Array.isArray(p)||p.length<2||!Number.isInteger(y)||y<0||y>=p.length||p.length<=2)return null;const v=p.slice();return v.splice(y,1),v.length<2?null:v}function lg(p,y){const v=Ee(p);if(!v||!Array.isArray(y))return null;if(v.type==="LineString"){const[V]=y,N=_o(v.coordinates,V);return N?(v.coordinates=N,v):null}if(v.type==="MultiLineString"){const[V,N]=y,H=v.coordinates?.[V],te=_o(H,N);return te?(v.coordinates[V]=te,v):null}if(v.type==="Polygon"){const[V,N]=y,H=v.coordinates?.[V],te=wo(H,N);return te?(v.coordinates[V]=te,v):null}if(v.type==="MultiPolygon"){const[V,N,H]=y,te=v.coordinates?.[V]?.[N],oe=wo(te,H);return oe?(v.coordinates[V][N]=oe,v):null}return null}function ag(p){return p?p.split(".").map(y=>Number(y)).filter(y=>Number.isInteger(y)&&y>=0):[]}function vo(p){return!K||!p?null:typeof K.get=="function"?K.get(p)??null:K.getAll?.()?.features?.find(v=>String(v?.id??"")===p)??null}function Co(p){const y=p?.properties?.id??p?.id;return y==null||y===""?null:String(y)}function sg(p){if(!D||!p)return null;const y=[[p.x-8,p.y-8],[p.x+8,p.y+8]],V=D.queryRenderedFeatures(y).find(N=>{const H=String(N?.properties?.meta??"");return H&&H!=="feature"?!1:!!Co(N)});return Co(V)}function ig(p,y){if(!K||!p||!y.length)return;const v=vo(p);if(!v?.geometry)return;const V=lg(v.geometry,y);if(!V)return;const N={...v,id:v.id??p,geometry:V};de=!0,re=!0;try{K.delete(p),K.add(N)}finally{re=!1,de=!1}Et(),ft()}function cg(p){if(!D||!K||s.value||f.isRulerActive.value||u.value!=="edit")return;const y=p?.point;if(!y)return;const v=[[y.x-8,y.y-8],[y.x+8,y.y+8]],N=D.queryRenderedFeatures(v).find(te=>te?.properties?.meta==="vertex"&&te?.properties?.parent&&te?.properties?.coord_path);if(!N)return;p?.originalEvent?.preventDefault?.(),p?.originalEvent?.stopPropagation?.();const H=ag(String(N.properties.coord_path));H.length&&ig(String(N.properties.parent),H)}function dg(p){const y=So(p);if(!y)return null;const[[v,V],[N,H]]=y;return{lat:(V+H)/2,lng:(v+N)/2}}function Eo(p){if(!Array.isArray(p)||p.length<3)return 0;const y=(V,N)=>{const H=V*2003750834e-2/180,te=Math.log(Math.tan((90+N)*Math.PI/360))/(Math.PI/180);return[H,te*2003750834e-2/180]};let v=0;for(let V=0;V<p.length-1;V+=1){const[N,H]=y(Number(p[V][0]),Number(p[V][1])),[te,oe]=y(Number(p[V+1][0]),Number(p[V+1][1]));v+=N*oe-te*H}return Math.abs(v/2)/1e6}function ug(p){if(!p?.type||!p?.coordinates)return null;if(p.type==="Polygon"){const y=p.coordinates?.[0];return Array.isArray(y)?Eo(y):null}return p.type==="MultiPolygon"?p.coordinates.reduce((y,v)=>{const V=v?.[0];return Array.isArray(V)?y+Eo(V):y},0):null}function er(p){if(!p){h.value=null;return}const y=dg(p);if(!y){h.value=null;return}h.value={type:String(p.type??"Feature"),center:y,areaKm2:ug(p)}}function tr(p){if(!p){const V=ke[ke.length-1],N=Ee(V?.geometry??null);Ze=N,er(N);return}const y=ke.find(V=>String(V?.id??"")===String(p))??null,v=Ee(y?.geometry??null);Ze=v,er(v)}function nr(p){x.value=(p??[]).map((y,v)=>{const V=String(y?.id??`feature-${v+1}`),N=Bo(String(y?.geometry?.type??"Feature"));return{id:V,label:`${N} ${v+1}`}})}function Bo(p){switch(String(p)){case"Point":return"Точка";case"MultiPoint":return"Мультиточка";case"LineString":return"Лінія";case"MultiLineString":return"Мультилінія";case"Polygon":return"Полігон";case"MultiPolygon":return"Мультиполігон";case"GeometryCollection":return"Колекція геометрій";default:return String(p||"Невідомо")}}function Vo(p,y){if(!Array.isArray(p)||!Array.isArray(y)||p.length!==2||y.length!==2)return!1;const v=1e-9;return Math.abs(Number(p[0])-Number(y[0]))<v&&Math.abs(Number(p[1])-Number(y[1]))<v}function So(p){if(!p)return null;let y=1/0,v=1/0,V=-1/0,N=-1/0;const H=te=>{if(Array.isArray(te)){if(te.length>=2&&Number.isFinite(te[0])&&Number.isFinite(te[1])){const oe=Number(te[0]),Se=Number(te[1]);y=Math.min(y,oe),v=Math.min(v,Se),V=Math.max(V,oe),N=Math.max(N,Se);return}te.forEach(H)}};return H(p.coordinates),!Number.isFinite(y)||!Number.isFinite(v)?null:[[y,v],[V,N]]}function $o(p){if(!D||!p)return;const y=So(p);if(!y)return;const[[v,V],[N,H]]=y;if(v===N&&V===H){D.easeTo({center:[v,V],zoom:Math.max(M.value,14)});return}D.fitBounds(y,{padding:30,duration:250,maxZoom:18})}function rr(){if(!K){d.value=0;return}const p=K.getAll();d.value=p?.features?.length??0}function qt(){if(!K)return null;const y=K.getAll?.()?.features??[],v=H=>!!H&&y.some(te=>String(te?.id??"")===String(H??"")),V=K.getSelectedIds?.();if(Array.isArray(V)&&V.length>0){const H=V[0];return H!=null?String(H):null}if(v(Ve))return String(Ve);if(!y.length)return null;const N=a.value?y[y.length-1]:y[0];return N?.id!==void 0&&N?.id!==null?String(N.id):null}function Et(){if(!K)return;const p=K.getAll();if(d.value=p?.features?.length??0,!p?.features?.length){ke=[],x.value=[],Ze=null,Ve=null,h.value=null,re||(Oe="__null__",o("update:modelValue",null));return}const y=(p.features??[]).map(ze).filter(Boolean);if(ke=y,nr(y),Ve=qt(),tr(Ve),!re){const v=We(y);Oe=$t(v),o("update:modelValue",v)}}function kn(){if(!K)return;(K.getAll()?.features||[]).forEach(y=>K.delete(y.id)),x.value=[],rr()}function xn(p){if(!K)return;const y=je(p),v=a.value?y:y.slice(0,1);re=!0,kn(),v.forEach(H=>{try{K.add(H)}catch{}}),re=!1,ke=(K.getAll?.()?.features??v).map(ze).filter(Boolean),nr(ke),Ve=null;const N=Ee(ke[ke.length-1]?.geometry??null);Ze=Ee(N),rr(),er(N),N&&($o(N),s.value||ft())}function pg(){K&&(re=!0,kn(),ke.forEach(p=>{try{K.add(p)}catch{}}),re=!1,nr(ke),rr(),tr(Ve))}function Nt(){if(K){try{K.changeMode("simple_select",{featureIds:[]})}catch{}u.value=""}}function wn(p){if(s.value||!K)return;f.isRulerActive.value&&f.closeRuler(),Je=!0,Nt(),u.value=p;const y=p==="marker"?"draw_point":p==="polyline"?"draw_line_string":p==="rectangle"?"draw_rectangle":"draw_polygon";a.value||(re=!0,kn(),re=!1);try{K.changeMode(y)}catch{u.value=""}finally{requestAnimationFrame(()=>{Je=!1})}}function ft(p){if(s.value||!K||!K.getAll()?.features?.length)return;const v=p||qt();if(v)try{K.changeMode("direct_select",{featureId:v}),Ve=v,tr(Ve),u.value="edit"}catch{u.value=""}}function fg(p){s.value||!K||!p||ft(p)}function mg(){if(!(s.value||!K)){if(a.value){const p=qt();if(p)try{nt=!0,K.delete(p),nt=!1,Et();const y=qt();y?ft(y):Nt();return}catch{nt=!1}}Nt(),kn(),ke=[],x.value=[],Ve=null,Oe="__null__",h.value=null,o("update:modelValue",null)}}function hg(){s.value||!Ze||$o(Ze)}function gg(p){if(!D||!z)return;const y=[p[1],p[0]];Te||(Te=new z.Marker({color:"#2563eb"})),Te.setLngLat(y).addTo(D),D.easeTo({center:y,zoom:13,duration:250})}function yg(){s.value||T.value?.click()}function bg(){s.value||(X.value=!X.value)}function No(p){if(!X.value)return;const y=G.value;y&&!y.contains(p.target)&&(X.value=!1)}function kg(){X.value=!1,yg()}function xg(){s.value||(we.value=[],X.value=!1,ne.value=!0)}function wg(){ne.value=!1,we.value=[]}function _g(){if(s.value||!K)return;const p=wi(ge.value.coordinates??"",ge.value.format||"decimal",ge.value.order||"lat-lon");if(!p.ok){we.value=p.errors,vg(p.errors);return}we.value=[],xn({type:"Polygon",coordinates:[p.ring]}),Et(),ne.value=!1,p.wasClosedAutomatically&&ue.notify({type:"info",title:"Імпорт координат",message:"Полігон був автоматично замкнений (перша і остання точки різнилися)."})}function vg(p){if(!p.length)return;const y=5;p.slice(0,y).forEach(v=>{const V=v.line>0?`Рядок ${v.line}`:"Загальна помилка";ue.notify({type:"warning",title:"Імпорт координат",message:`${V} — ${v.message}`})}),p.length>y&&ue.notify({type:"warning",title:"Імпорт координат",message:`Ще помилок: ${p.length-y}`})}function Cg(p){if(s.value||!K)return;X.value=!1;const y=p.target,v=y.files?.[0];if(!v)return;const V=new FileReader;V.onload=()=>{try{const N=JSON.parse(String(V.result));if(!je(N).length){ue.notify({type:"warning",title:"Імпорт файлу",message:"Файл не містить коректний GeoJSON-обʼєкт."});return}xn(N),Et()}catch{ue.notify({type:"error",title:"Імпорт файлу",message:"Не вдалося прочитати файл. Перевірте формат GeoJSON/JSON."})}finally{y.value=""}},V.onerror=()=>{ue.notify({type:"error",title:"Імпорт файлу",message:"Помилка читання файлу."}),y.value=""},V.readAsText(v)}function Eg(){if(s.value||!K)return;const p=K.getAll(),y=new Blob([JSON.stringify(p,null,2)],{type:"application/json"}),v=URL.createObjectURL(y),V=document.createElement("a");V.href=v,V.download="data.geojson",V.click(),URL.revokeObjectURL(v)}return e.onMounted(async()=>{if(window.addEventListener("click",No,!0),!i.value)return;const p=await Ce();z=p.maplibregl,Q=p.MapboxDraw;const y=Ht();y&&(D=new z.Map({container:i.value,style:_e(y),center:[P.value[0],P.value[1]],zoom:M.value,attributionControl:!1}),g.value=D,D.addControl(new z.NavigationControl({showCompass:!0}),"bottom-right"),D.on("load",()=>{if(!(!Q||!D)){if(K=new Q({displayControlsDefault:!1,modes:{...Q.modes,draw_rectangle:kt()},controls:{point:!1,line_string:!1,polygon:!1,trash:!1},styles:Ut}),D.addControl(K),D.on("click",v=>{if(f.isRulerActive.value){const N=v?.lngLat;if(!N)return;m.value?.addPoint?.({lat:N.lat,lng:N.lng});return}if(!K||s.value||u.value!=="edit")return;const V=sg(v?.point);!V||V===Ve||requestAnimationFrame(()=>{!K||s.value||ft(V)})}),D.on("draw.create",()=>{if(K&&!f.isRulerActive.value){if(!a.value){const v=K.getAll();if(v.features.length>1){const V=v.features[v.features.length-1];re=!0,v.features.slice(0,-1).forEach(N=>K.delete(N.id)),re=!1,V&&(re=!0,K.add(V),re=!1)}}Et(),ft()}}),D.on("draw.update",v=>{if(!rt&&!f.isRulerActive.value){if(v?.action==="move"){if(rt=!0,pg(),rt=!1,u.value==="edit"){const V=qt(),N=V?vo(V):K?.getAll?.()?.features?.[0];if(N?.id)try{K.changeMode("direct_select",{featureId:N.id}),Ve=String(N.id)}catch{u.value=""}}return}Et()}}),D.on("draw.delete",()=>{de||nt||f.isRulerActive.value||u.value==="marker"||u.value==="polyline"||u.value==="polygon"||u.value==="rectangle"||(Et(),K?.getAll?.()?.features?.length||(Ve=null),u.value="",Nt())}),D.on("draw.selectionchange",v=>{if(!K||rt||f.isRulerActive.value||u.value==="marker"||u.value==="polyline"||u.value==="polygon"||u.value==="rectangle")return;const V=v?.features?.[0]?.id!==void 0&&v?.features?.[0]?.id!==null?String(v.features[0].id):null;if(!s.value&&V){if(u.value==="edit"&&Ve===V)return;requestAnimationFrame(()=>{!K||s.value||ft(V)});return}const N=K.getSelectedIds?.(),H=Array.isArray(N)&&N.length>0?String(N[0]):null;if(!s.value&&H){if(u.value==="edit"&&Ve===H)return;requestAnimationFrame(()=>{!K||s.value||ft(H)});return}try{K.changeMode("simple_select",{featureIds:[]})}catch{}}),O.value!==void 0){const v=O.value;O.value=void 0,requestAnimationFrame(()=>{K&&xn(v)})}se(),ye.value.forEach(v=>{const V=ce[v];V&&q(V)}),be()}}),D.on("contextmenu",cg),D.on("zoomend",()=>{D&&(M.value=D.getZoom())}))}),e.onUnmounted(()=>{f.isRulerActive.value&&f.closeRuler(),window.removeEventListener("click",No,!0),Object.values(ce).forEach(p=>{D&&R(p)}),xt(),Te?.remove&&Te.remove(),Te=null,D?.remove&&D.remove(),D=null,K=null,g.value=null}),e.watch(()=>n.modelValue,p=>{if(!K){O.value=p;return}const y=We((a.value?je(p):je(p).slice(0,1))||[]),v=$t(y);if(Oe&&v===Oe){Oe=null;return}Oe=null,xn(p)},{deep:!0}),e.watch(()=>L.value,p=>{const y=Array.isArray(p)?p:[],v=[],V=new Set;y.forEach((N,H)=>{if(!N)return;const te=gn(N,H);v.push(te),V.add(te);const oe={...N,id:te},Se=ce[te],Ye=Se?.visible??!!oe.visible;Se&&D&&R(Se),ce[te]={id:te,config:oe,visible:Ye,sourceId:`vs-ov-src-${te}`,layerIds:[],boundsIds:[],handlers:[]}}),Object.keys(ce).forEach(N=>{if(V.has(N))return;const H=ce[N];H&&D&&R(H),delete ce[N]}),ye.value=v,D&&(ye.value.forEach(N=>{const H=ce[N];H&&q(H)}),be())},{immediate:!0,deep:!0}),e.watch(()=>F.value,()=>{D&&(se(),ye.value.forEach(p=>{const y=ce[p];y&&q(y)}),be())},{deep:!0}),e.watch(()=>S.value,async p=>{if(W.value=[],!p){D&&(se(),ye.value.forEach(y=>{const v=ce[y];v&&q(v)}),be());return}try{const y=await fetch(`https://data.gki.com.ua/api-user/atu/${p}`);if(!y?.ok)return;const V=(await y.json())?.geometry?.coordinates;Array.isArray(V)&&V.length&&(W.value=V)}catch(y){console.error("Failed to fetch KATOTTG bounds",y)}finally{if(!D)return;se(),ye.value.forEach(y=>{const v=ce[y];v&&q(v)}),be()}},{immediate:!0}),e.watch(()=>B.value,p=>{if(!Array.isArray(p)||p.length!==2)return;const y=[Number(p[0]),Number(p[1])];if(Vo(P.value,y)||(P.value=[...y],!D))return;const v=D.getCenter?.();v&&Vo([v.lng,v.lat],P.value)||D.easeTo({center:[P.value[0],P.value[1]]})},{deep:!0}),e.watch(()=>$.value,p=>{typeof p=="number"&&(M.value=p,D&&D.setZoom(p))}),e.watch(s,p=>{p&&Nt()}),e.watch(d,p=>{if(p>0){s.value||ft();return}Je||Nt()}),e.watch(c,()=>{setTimeout(()=>{D?.resize&&D.resize()},50)}),(p,y)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",disabled:!c.value},[e.createElementVNode("div",{class:e.normalizeClass(["vs-map-wrapper relative w-full h-[400px]",{fullscreen:c.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:i,class:"w-full h-[calc(100%-28px)]"},null,512),Be.value.search||Be.value.import||Be.value.export?(e.openBlock(),e.createElementBlock("div",Ac,[Be.value.search?(e.openBlock(),e.createBlock(Li,{key:0,onGoToCoordinates:gg})):e.createCommentVNode("",!0),Be.value.import||Be.value.export?(e.openBlock(),e.createElementBlock("div",Fc,[e.createElementVNode("div",Mc,[Be.value.import?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"importMenuRef",ref:G,class:"relative"},[e.createElementVNode("button",{type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:bg,disabled:s.value},[y[8]||(y[8]=e.createTextVNode(" Імпорт ",-1)),e.createVNode(e.unref(j.ChevronDown),{class:e.normalizeClass(["h-4 w-4 transition-transform",{"rotate-180":X.value}])},null,8,["class"])],8,Dc),X.value?(e.openBlock(),e.createElementBlock("div",Lc,[Be.value.import?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"block w-full text-left px-3 py-2 hover:bg-gray-100 text-gray-900",onClick:kg}," З файлу ")):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"block w-full text-left px-3 py-2 hover:bg-gray-100 text-gray-900",onClick:xg}," З координат ")])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),Be.value.export?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:Eg,disabled:s.value||d.value===0}," Експорт ",8,Tc)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:T,type:"file",onChange:Cg,accept:".json,.geojson",class:"hidden",disabled:s.value},null,40,Ic)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createVNode(e.unref(ue.VsModal),{visible:ne.value,"onUpdate:visible":y[1]||(y[1]=v=>ne.value=v),title:"Імпорт координат полігону",size:"lg",teleport:"#modal"},{default:e.withCtx(()=>[e.createVNode(Qe,{schema:J,values:ge.value,"onUpdate:values":y[0]||(y[0]=v=>ge.value=v)},null,8,["values"]),e.createElementVNode("div",Rc,[e.createElementVNode("button",{type:"button",class:"px-3 py-2 rounded-md border border-gray-300 text-gray-700 text-sm hover:bg-gray-100",onClick:wg}," Скасувати "),e.createElementVNode("button",{type:"button",class:"px-3 py-2 rounded-md bg-blue-600 text-white text-sm hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed",onClick:_g,disabled:s.value}," Побудувати ",8,Oc)])]),_:1},8,["visible"]),e.createElementVNode("div",zc,[e.createElementVNode("div",Pc,[Be.value.point?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":u.value==="marker"}]),title:"Point",onClick:y[2]||(y[2]=v=>wn("marker")),disabled:s.value},[e.createVNode(e.unref(j.MapPin),{class:"h-4 w-4"})],10,jc)):e.createCommentVNode("",!0),Be.value.line?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":u.value==="polyline"}]),title:"Line",onClick:y[3]||(y[3]=v=>wn("polyline")),disabled:s.value},[e.createVNode(ai)],10,Uc)):e.createCommentVNode("",!0),Be.value.polygon?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":u.value==="polygon"}]),title:"Polygon",onClick:y[4]||(y[4]=v=>wn("polygon")),disabled:s.value},[e.createVNode(di)],10,Hc)):e.createCommentVNode("",!0),Be.value.rectangle?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":u.value==="rectangle"}]),title:"Rectangle",onClick:y[5]||(y[5]=v=>wn("rectangle")),disabled:s.value},[e.createVNode(mi)],10,qc)):e.createCommentVNode("",!0),Be.value.ruler?(e.openBlock(),e.createElementBlock("button",{key:4,class:e.normalizeClass(["vs-btn mt-3",{"vs-active":e.unref(f).isRulerActive.value}]),title:"Ruler",onClick:b},[e.createVNode(e.unref(j.Ruler),{class:"h-4 w-4"})],2)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:y[6]||(y[6]=v=>c.value=!c.value),title:"Full Screen"},[e.createVNode(e.unref(j.Maximize),{class:"h-4 w-4"})])])]),Be.value.ruler&&e.unref(f).isRulerActive.value?(e.openBlock(),e.createBlock(Sc,{key:1,ref_key:"rulerPanelRefEl",ref:m,onClose:y[7]||(y[7]=v=>e.unref(f).closeRuler()),onTabChange:e.unref(f).onRulerTabChange,onPointsChange:e.unref(f).onRulerPointsChange,onShapeClosedChange:e.unref(f).onRulerShapeClosedChange},null,8,["onTabChange","onPointsChange","onShapeClosedChange"])):e.createCommentVNode("",!0),Be.value.ruler&&e.unref(f).isRulerActive.value&&e.unref(f).hasRulerPoints.value?(e.openBlock(),e.createBlock($c,{key:2,map:g.value,points:e.unref(f).rulerPoints.value,"is-shape-closed":e.unref(f).rulerShapeClosed.value,"label-mode":e.unref(f).rulerActiveTab.value},null,8,["map","points","is-shape-closed","label-mode"])):e.createCommentVNode("",!0),tt.value.length?(e.openBlock(),e.createElementBlock("div",{key:3,class:"absolute z-[1500] pointer-events-none",style:e.normalizeStyle(it.value)},[e.createElementVNode("div",Gc,[e.createElementVNode("dl",Kc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(tt.value,v=>(e.openBlock(),e.createElementBlock("div",{key:`${v.key}-${v.value}`,class:"flex justify-between gap-2"},[e.createElementVNode("dt",Wc,e.toDisplayString(v.key),1),e.createElementVNode("dd",Yc,e.toDisplayString(v.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",Xc,[e.createElementVNode("div",Zc,[e.createVNode(ki,{basemaps:e.unref(ee),onOnLayerChange:ve},null,8,["basemaps"]),Le.value.length?(e.openBlock(),e.createElementBlock("div",Jc,[y[9]||(y[9]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),e.createElementVNode("div",Qc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Le.value,v=>(e.openBlock(),e.createElementBlock("label",{key:v.id,class:"flex items-center gap-2 cursor-pointer select-none"},[e.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:v.visible,disabled:s.value,onChange:V=>xe(v.id)},null,40,ed),e.createElementVNode("span",td,e.toDisplayString(v.config.title||v.config.name||v.id),1)]))),128))])])):e.createCommentVNode("",!0)])]),e.createElementVNode("div",nd,[x.value.length||h.value?(e.openBlock(),e.createElementBlock("div",rd,[e.createElementVNode("div",od,[e.createElementVNode("div",ld,[y[10]||(y[10]=e.createTextVNode(" Тип: ",-1)),x.value.length<=1?(e.openBlock(),e.createElementBlock("span",ad,e.toDisplayString(h.value?Bo(h.value.type):x.value[0]?.label||"—"),1)):(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:1},e.renderList(x.value,(v,V)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:v.id},[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["font-bold underline-offset-2",v.id===e.unref(Ve)?"text-blue-700 underline":"text-gray-700 hover:text-blue-700 hover:underline"]),onClick:N=>fg(v.id),disabled:s.value},e.toDisplayString(v.label),11,sd),V<x.value.length-1?(e.openBlock(),e.createElementBlock("span",id,", ")):e.createCommentVNode("",!0)],64))),128))])]),e.createElementVNode("div",cd,[e.createElementVNode("div",dd,[y[11]||(y[11]=e.createTextVNode(" Центр: ",-1)),h.value?(e.openBlock(),e.createElementBlock("b",ud,e.toDisplayString(h.value.center.lng.toFixed(5))+", "+e.toDisplayString(h.value.center.lat.toFixed(5)),1)):(e.openBlock(),e.createElementBlock("b",pd,"—"))]),h.value&&h.value.areaKm2!==null?(e.openBlock(),e.createElementBlock("div",fd,[y[12]||(y[12]=e.createTextVNode(" Площа: ",-1)),e.createElementVNode("b",null,e.toDisplayString(h.value.areaKm2.toFixed(1))+" km²",1)])):(e.openBlock(),e.createElementBlock("div",md,y[13]||(y[13]=[e.createTextVNode("Площа: ",-1),e.createElementVNode("b",null,"—",-1)]))),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:hg,disabled:s.value},[e.createVNode(e.unref(j.ZoomIn),{class:"h-3 w-3"})],8,hd),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Delete feature",onClick:mg,disabled:s.value},[e.createVNode(e.unref(j.Trash2),{class:"h-4 w-4"})],8,gd)])])):e.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-7cd96e1c"]]),yd=["data-focus"],bd={class:"flex items-center"},kd={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},xd=["onClick","aria-label"],wd={key:0,class:"absolute text-gray-500 truncate pl-2"},_d={class:"flex-1 min-w-[2px]"},vd=["placeholder"],Cd={class:"flex items-center shrink-0"},Ed=["disabled"],_r=e.defineComponent({__name:"vs-input-tag",props:e.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(r,{emit:t}){const n=r,o=t;Ie(n.style);const l=e.ref(null),a=e.ref(null),s=e.ref(null),c=e.ref(!1),i=e.ref(""),d=e.useModel(r,"modelValue"),u=e.computed(()=>n.placeholder||"Add tag…"),h=e.computed(()=>d.value?.length===0&&i.value===""),x=e.computed(()=>!n.disabled&&d.value?.length>0),g=e.computed(()=>n.disabled),m=async()=>{g.value||await e.nextTick(()=>s.value?.focus())},f=I=>{const A=I.trim();A!==""&&(!d.value||!Array.isArray(d.value)?d.value=[A]:n.unique?d.value.includes(A)||(d.value=[...d.value,A]):d.value=[...d.value,A],i.value="")},b=()=>{const I=i.value;I.trim()!==""&&f(I),i.value=""},w=I=>{const A=d.value.slice();A.splice(I,1),o("update:modelValue",A)},_=()=>{o("update:modelValue",[])},k=()=>{g.value||(c.value=!0)},C=()=>{c.value=!1,!g.value&&b()},E=I=>{const{key:A}=I;A==="Enter"?(I.preventDefault(),b()):A==="Backspace"&&i.value===""&&d.value.length>0&&w(d.value.length-1)};return(I,A)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:l,onClick:A[1]||(A[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass]),role:"group","aria-label":"Tag input"},[e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",c.value?"border-blue-500 ring-1 ring-blue-500":"",g.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":c.value?"true":"false",onClick:m},[e.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:a},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(B,$)=>(e.openBlock(),e.createElementBlock("div",{key:$,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",bd,[e.createElementVNode("div",kd,e.toDisplayString(B),1)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:e.withModifiers(S=>w($),["stop"]),"aria-label":`Remove ${B}`},[e.createVNode(e.unref(j.X),{"aria-hidden":"true",focusable:"false",class:"inline-block h-4 w-4"})],8,xd)]))),128)),h.value?(e.openBlock(),e.createElementBlock("div",wd,e.toDisplayString(u.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",_d,[g.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:s,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":A[0]||(A[0]=B=>i.value=B),onFocus:k,onBlur:C,onKeydown:E,placeholder:d.value&&d.value.length?"":void 0},null,40,vd)),[[e.vModelText,i.value]])])],512),e.createElementVNode("div",Cd,[x.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:g.value,onClick:e.withModifiers(_,["stop"])},[e.createVNode(e.unref(j.X),{class:"h-4 w-4"})],8,Ed)):e.createCommentVNode("",!0)])],10,yd)],2)],512))}}),Bd={class:"relative flex gap-1 bg-white w-full"},Vd=["disabled","placeholder"],vr=me(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=e.inject("values"),n=r,o=e.useModel(r,"modelValue");function l(s){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 s.toLowerCase().split("").map(i=>c[i]||i).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const a=()=>{const s=t?.value?.[n.parent||""]?.toString(),c=l(s);o.value=c.toString()};return(s,c)=>(e.openBlock(),e.createElementBlock("div",Bd,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:s.disabled,placeholder:s.placeholder,"onUpdate:modelValue":c[0]||(c[0]=i=>o.value=i),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,Vd),[[e.vModelText,o.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:a}," Gen ")]))}}),[["__scopeId","data-v-b0eba370"]]),Sd={class:"relative flex gap-1 bg-white w-full"},$d=["disabled","placeholder"],Nd=["disabled"],Ad={key:0},Fd={key:1},Cr=me(e.defineComponent({__name:"vs-input-codegen",props:e.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),o=e.ref(!1),l=e.computed(()=>t.init!==!1),a=e.computed(()=>!!t.table&&!!t.code),s=()=>{if(!a.value)return"";const d=encodeURIComponent(String(t.table)),u=encodeURIComponent(String(t.code));return`/api/code-gen/${d}/${u}`},c=async()=>{if(!a.value||o.value)return;const d=s();if(d){o.value=!0;try{const h=await(await fetch(d)).text();n.value=h}finally{o.value=!1}}},i=()=>{l.value&&(n.value||c())};return e.onMounted(()=>{i()}),e.watch(()=>[t.table,t.code,t.init],()=>{i()}),(d,u)=>(e.openBlock(),e.createElementBlock("div",Sd,[e.withDirectives(e.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":u[0]||(u[0]=h=>n.value=h),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,$d),[[e.vModelText,n.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:o.value||d.disabled||!a.value,onClick:c},[o.value?(e.openBlock(),e.createElementBlock("span",Fd,"...")):(e.openBlock(),e.createElementBlock("span",Ad,"Gen"))],8,Nd)]))}}),[["__scopeId","data-v-6ee5237d"]]),Md={class:"w-full"},Dd={ref:"sortableContainer",class:"flex flex-col gap-1"},Ld=["onDragstart","onDrop"],Td={class:"cursor-move",type:"button"},Id={class:"w-1/3"},Rd={class:"w-2/3"},Od=["onClick"],zd={key:0,class:"text-[14px] text-gray-700"},Pd={class:"mt-2 w-full flex items-center"},jd=["disabled"],Er=me(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=b=>`${b}-${Math.random().toString(36).substring(2,15)}`,o=e.inject("values"),l=r,a=t,s=l.addButtonText??"Додати",c=l.ignore??[],i=e.ref([]),d=e.ref(null);(()=>{const b=l.parent&&o?.value?.[l.parent]||l.modelValue||{};i.value=Object.entries(b).filter(([w])=>!c.includes(w)).map(([w,_])=>({id:n("key-value-"),key:w,value:_}))})();function h(b){d.value=b}function x(b){if(d.value===null||d.value===b)return;const w=i.value.splice(d.value,1)[0];i.value.splice(b,0,w),d.value=null}const g=e.computed(()=>i.value.some(b=>b.key&&!b.value||!b.key&&b.value)),m=()=>{i.value.push({id:n("key-value-"),key:"",value:""})},f=b=>{i.value=i.value.filter(w=>w.id!==b)};return e.watch(i,b=>{const w={};b.forEach(k=>{k.key&&k.value!==void 0&&(w[k.key]=k.value)});const _={};c.length&&c.forEach(k=>{_[k]=l.parent?o?.value?.[l.parent]?.[k]:void 0}),o?.value&&l.parent&&(o.value[l.parent]={..._,...w}),a("update:modelValue",w)},{deep:!0}),(b,w)=>(e.openBlock(),e.createElementBlock("div",Md,[e.createElementVNode("div",Dd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(_,k)=>(e.openBlock(),e.createElementBlock("div",{key:_.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===k}]),draggable:"true",onDragstart:C=>h(k),onDragover:w[0]||(w[0]=e.withModifiers(()=>{},["prevent"])),onDrop:C=>x(k)},[e.createElementVNode("button",Td,[e.createVNode(e.unref(j.GripVertical),{class:"h-4 w-4"})]),e.createElementVNode("div",Id,[e.createVNode(Bt,{modelValue:_.key,"onUpdate:modelValue":C=>_.key=C,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Rd,[e.createVNode(Bt,{modelValue:_.value,"onUpdate:modelValue":C=>_.value=C,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:C=>f(_.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[e.createVNode(e.unref(j.X),{class:"h-4 w-4"})],8,Od)],42,Ld))),128))],512),i.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",zd," Дані для відображення відсутні ")),e.createElementVNode("div",Pd,[e.createElementVNode("button",{type:"button",onClick:m,disabled:g.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(e.unref(j.Plus),{class:"h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(e.unref(s)),1)],8,jd)])]))}}),[["__scopeId","data-v-d8c3f9d6"]]),Ud={class:"w-full"},Hd={ref:"sortableContainer",class:"flex flex-col gap-1"},qd=["onDragstart","onDrop"],Gd=["disabled"],Kd={class:"flex-1"},Wd=["onClick","disabled"],Yd={key:0,class:"text-[14px] text-gray-700"},Xd={class:"mt-2 w-full flex items-center"},Zd=["disabled"],Br=me(e.defineComponent({__name:"vs-input-text-array",props:e.mergeModels({addButtonText:{default:"Додати"},inputType:{default:"text"},placeholder:{default:"Значення"},mask:{default:""},disabled:{type:Boolean,default:!1}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),o=e.ref([]),l=e.ref(null),a=e.computed(()=>!!t.disabled),s=e.computed(()=>t.placeholder??""),c=e.computed(()=>t.addButtonText??"Додати");let i=!1;const d=b=>`${b}-${Math.random().toString(36).substring(2,15)}`,u=b=>{const w=b??n.value??[];o.value=w.map((_,k)=>({id:o.value[k]?.id??d("text-array"),value:_??""}))};u(),e.watch(()=>n.value,b=>{if(i){i=!1;return}u(b||[])},{deep:!0}),e.watch(o,b=>{i=!0,n.value=b.map(w=>w.value).filter(w=>w!=null&&w!=="")},{deep:!0});const h=e.computed(()=>a.value||o.value.some(b=>!b.value));function x(){h.value||(o.value=[...o.value,{id:d("text-array"),value:""}])}function g(b){a.value||(o.value=o.value.filter(w=>w.id!==b))}function m(b){a.value||(l.value=b)}function f(b){if(a.value||l.value===null||l.value===b)return;const w=[...o.value],[_]=w.splice(l.value,1);w.splice(b,0,_),o.value=w,l.value=null}return(b,w)=>(e.openBlock(),e.createElementBlock("div",Ud,[e.createElementVNode("div",Hd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(_,k)=>(e.openBlock(),e.createElementBlock("div",{key:_.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":l.value===k}]),draggable:"true",onDragstart:C=>m(k),onDragover:w[0]||(w[0]=e.withModifiers(()=>{},["prevent"])),onDrop:C=>f(k)},[e.createElementVNode("button",{class:"cursor-move",type:"button",disabled:a.value},[e.createVNode(e.unref(j.GripVertical),{class:"h-4 w-4"})],8,Gd),e.createElementVNode("div",Kd,[b.inputType==="text"?(e.openBlock(),e.createBlock(Bt,{key:0,modelValue:_.value,"onUpdate:modelValue":C=>_.value=C,disabled:a.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),b.inputType==="tel"?(e.openBlock(),e.createBlock(Vn,{key:1,modelValue:_.value,"onUpdate:modelValue":C=>_.value=C,disabled:a.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),b.inputType==="email"?(e.openBlock(),e.createBlock(Bn,{key:2,modelValue:_.value,"onUpdate:modelValue":C=>_.value=C,disabled:a.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),b.inputType==="mask"?(e.openBlock(),e.createBlock(En,{key:3,modelValue:_.value,"onUpdate:modelValue":C=>_.value=C,mask:b.mask,disabled:a.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","mask","disabled","placeholder"])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:C=>g(_.id),disabled:a.value,class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200 disabled:opacity-50"},[e.createVNode(e.unref(j.X),{class:"h-4 w-4"})],8,Wd)],42,qd))),128))],512),o.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Yd," Дані для відображення відсутні ")),e.createElementVNode("div",Xd,[e.createElementVNode("button",{type:"button",onClick:x,disabled:h.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(e.unref(j.Plus),{class:"h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(c.value),1)],8,Zd)])]))}}),[["__scopeId","data-v-2c229b1f"]]),Jd={class:"flex items-center gap-2 w-full"},Qd=["disabled"],eu=["disabled"],Vr=e.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,{inputClass:o}=Ie(n.style),l=t,a=e.computed({get:()=>n.modelValue||"#000000",set:c=>l("update:modelValue",c)}),s=e.computed(()=>!!n.disabled);return(c,i)=>(e.openBlock(),e.createElementBlock("div",Jd,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),disabled:s.value,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[c.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Qd),[[e.vModelText,a.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":i[1]||(i[1]=d=>a.value=d),disabled:s.value},null,8,eu),[[e.vModelText,a.value]])]))}}),tu={class:"flex items-center gap-2 w-full"},nu=["min","max","step","disabled"],ru=["disabled"],Sr=e.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,{inputClass:o}=Ie(n.style),l=t,a=e.computed({get:()=>Number(n.modelValue??n.min),set:c=>l("update:modelValue",Number(c))}),s=e.computed(()=>!!n.disabled);return(c,i)=>(e.openBlock(),e.createElementBlock("div",tu,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),min:c.min,max:c.max,step:c.step,disabled:s.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[c.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")])},null,10,nu),[[e.vModelText,a.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":i[1]||(i[1]=d=>a.value=d),disabled:s.value},null,8,ru),[[e.vModelText,a.value]])]))}}),ou=["placeholder","disabled","name"],lu=["type","value","onInput","placeholder","disabled"],au=["onClick"],$r=e.defineComponent({__name:"vs-input-array",props:e.mergeModels({count:{default:1},limit:{default:1},mask:{default:""},unmask:{type:Boolean,default:!1},inputType:{default:"text"},isAdded:{type:Boolean,default:!1},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.ref(t.count),o=e.computed(()=>t.limit),{inputClass:l}=Ie(t.style),a=e.useModel(r,"modelValue"),s=e.computed(()=>!!t.disabled),c=e.computed(()=>t.placeholder??"");e.watchEffect(()=>{const f=a.value?.length??0;f<n.value&&(a.value=[...a.value??[],...Array(n.value-f)])});const i=e.ref({}),d=e.ref({});function u(f,b){f&&(i.value[b]=f)}async function h(f,b){if(!f||t.inputType!=="mask")return;const{default:w}=await Promise.resolve().then(()=>qn);d.value[b]&&d.value[b].destroy(),d.value[b]=w(f,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),d.value[b].on("accept",()=>{const _=[...a.value||[]];_[b]=t.unmask?d.value[b].unmaskedValue:d.value[b].value,a.value=_}),d.value[b].on("complete",()=>{const _=[...a.value||[]];_[b]=t.unmask?d.value[b].unmaskedValue:d.value[b].value,a.value=_}),a.value?.[b]&&(d.value[b].value=a.value[b])}function x(f,b){if(s.value)return;const w=f.target.value??null,_=[...a.value];_[b]=t.inputType==="text"?w:Number(w),a.value=_}function g(){n.value+=1;const f=t.inputType==="text"||t.inputType==="mask"?null:0;a.value=[...a.value,f],t.inputType==="mask"&&setTimeout(()=>{const b=n.value-1;i.value[b]&&h(i.value[b],b)},0)}function m(f){if(n.value>1){d.value[f]&&(d.value[f].destroy(),delete d.value[f]),n.value-=1,a.value=a.value.filter((w,_)=>_!==f);const b={};Object.keys(d.value).forEach(w=>{const _=parseInt(w,10);_>f?b[_-1]=d.value[_]:_<f&&(b[_]=d.value[_])}),d.value=b}}return e.onMounted(()=>{if(t.inputType==="mask")for(let f=0;f<n.value;f+=1)i.value[f]&&h(i.value[f],f)}),e.onBeforeUnmount(()=>{Object.values(d.value).forEach(f=>{f&&f.destroy()})}),e.watch(()=>t.mask,f=>{t.inputType==="mask"&&Object.values(d.value).forEach(b=>{b&&b.updateOptions({mask:f,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})})}),e.watch(a,f=>{t.inputType==="mask"&&f&&f.forEach((b,w)=>{d.value[w]&&d.value[w].value!==b&&(d.value[w].value=b||"")})},{deep:!0}),(f,b)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["grid gap-2",`grid-cols-${o.value}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,w=>(e.openBlock(),e.createElementBlock("div",{key:w,class:"flex items-center gap-2 w-full"},[f.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:_=>u(_,w-1),placeholder:f.placeholder,disabled:f.disabled,name:`${f.name}[${w-1}]`,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(l),{"!border-red-600":f.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,ou)):(e.openBlock(),e.createElementBlock("input",{key:1,type:f.inputType,value:a.value?.[w-1],onInput:_=>x(_,w-1),placeholder:c.value,disabled:s.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(l),{"!border-red-600":f.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,lu)),!f.disabled&&w===n.value&&f.isAdded?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:e.withModifiers(g,["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-green-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(e.unref(j.Plus),{class:"h-4 w-4"})])):e.createCommentVNode("",!0),!f.disabled&&n.value>1&&f.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(_=>m(w-1),["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-red-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(e.unref(j.X),{class:"h-4 w-4"})],8,au)):e.createCommentVNode("",!0)]))),128))],2))}}),su=["aria-expanded","data-focus"],iu=["placeholder","disabled","readonly"],cu={class:"max-h-full"},du=["onClick","disabled"],uu={key:0,class:"px-3 py-2 text-sm text-stone-500"},pu={class:"flex flex-col gap-1"},fu=["onDragstart","onDrop"],mu=["disabled"],hu=["title"],gu=["disabled","onClick","aria-label"],yu={key:0,class:"text-xs text-stone-500"},en=me(e.defineComponent({__name:"vs-input-array-select",props:e.mergeModels({options:{default:()=>[]},data:{default:""},api:{default:""},prefix:{default:"api"},host:{default:""},parent:{},search:{type:Boolean,default:!0},maxHeight:{default:280},start:{default:0},slot:{},disabled:{type:Boolean,default:!1},style:{},customClass:{},modelValue:{},error:{},name:{},placeholder:{default:"Оберіть значення"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["change","update:modelValue","value-selected"],["update:modelValue"]),setup(r,{emit:t}){const n=r,o=t,l=e.useModel(r,"modelValue"),a=e.ref([]),s=e.ref(n.options??[]),c=e.ref({}),i=e.ref({}),d=e.ref({keyword:"",parent:null}),u=e.ref(""),h=e.ref(!1),x=e.ref(null),g=e.ref(null),m=e.ref(null),f=e.ref(null),b=e.ref(null),w=e.ref({});let _=!1,k=!1;const C=e.inject("values"),E=e.computed(()=>!!n.disabled),I=e.computed(()=>n.placeholder??"Оберіть значення"),A=e.computed(()=>n.search!==!1),B=e.computed(()=>{const z=n.parent??n.parentValue;return z?String(z):""}),$=e.computed(()=>B.value?C?.value?.[B.value]??null:null),S=z=>z==null?"__null__":String(z),L=z=>{if(!z)return"";const Q=z.label??z.text??z.name??z.ua??z.en;return Q?String(Q):z.id!==void 0&&z.id!==null?String(z.id):""},F=z=>{const Q=S(z);return i.value[Q]||(i.value[Q]=`array-select-${Q}-${Math.random().toString(36).slice(2,8)}`),i.value[Q]},P=e.computed(()=>new Set(a.value.map(z=>S(z.id)))),M=e.computed(()=>{const z=P.value;let Q=[...s.value];if(!n.data&&u.value.trim()){const D=u.value.toLowerCase();Q=Q.filter(K=>L(K).toLowerCase().includes(D))}return Q.filter(D=>!z.has(S(D.id)))}),O=()=>{if(!n.data)return"";const z=n.prefix??"api",Q=n.api??`/${z}/suggest/${n.data}`;return`${n.host??""}${Q}`},T=()=>{a.value.length&&(_=!0,a.value=a.value.map(z=>({...z,text:c.value[S(z.id)]??z.text})))},G=z=>{const Q=S(z.id),D=L(z);D&&(c.value[Q]=D)},W=z=>{s.value=z?[...z]:[],z?.forEach(G),T()},X=z=>{if(!z.length)return;const Q=new Map(s.value.map(D=>[S(D.id),D]));z.forEach(D=>{const K=S(D.id);Q.set(K,D),G(D)}),s.value=Array.from(Q.values()),T()},ne=async(z="")=>{if(!n.data)return[];const Q=O();if(!Q)return[];const D=new URLSearchParams;D.set("json","1"),z&&D.set("key",z),n.start===1&&D.set("start","1"),$.value!==null&&$.value!==void 0&&$.value!==""&&D.set("parent",String($.value));try{return(await(await fetch(`${Q}?${D.toString()}`)).json())?.data??[]}catch{return[]}},we=async z=>{if(!n.data||!z.length)return[];const Q=O();if(!Q)return[];const D=Array.from(new Set(z.map(ke=>S(ke)))),K=new URLSearchParams;K.set("json","1"),K.set("val",D.join(",")),n.start===1&&K.set("start","1"),$.value!==null&&$.value!==void 0&&$.value!==""&&K.set("parent",String($.value));try{const Oe=(await(await fetch(`${Q}?${K.toString()}`)).json())?.data??[];return X(Oe),Oe}catch{return[]}},ge=async(z="",{force:Q=!1}={})=>{if(!n.data)return;const D=$.value??null;if(!Q&&d.value.keyword===z&&d.value.parent===D&&s.value.length>0)return;d.value={keyword:z,parent:D};const ke=await ne(z);W(ke)},re=((z,Q=200)=>{let D;return(...K)=>{D&&clearTimeout(D),D=setTimeout(()=>z(...K),Q)}})(async z=>{n.data&&await ge(z,{force:!0})},250),de=e.ref(null),ce=()=>{if(!m.value)return;const z=m.value.getBoundingClientRect(),Q=window.innerHeight??document.documentElement.clientHeight,D=window.innerWidth??document.documentElement.clientWidth,K=8,ke=8,Ze=n.maxHeight??280,Oe=Q-z.bottom-ke-K,Ve=z.top-ke-K,nt=Oe>=Ve,rt=Math.max(D-K*2,0);let{width:Je}=z;rt>0&&Je>rt&&(Je=rt);let{left:Te}=z;Te+Je+K>D&&(Te=D-Je-K),Te=Math.max(Te,K);const kt=Math.min(Ze,Math.max(nt?Oe:Ve,50));w.value={position:"fixed",left:`${Te}px`,width:`${Je}px`,maxHeight:`${kt}px`,transform:nt?"none":"translateY(-100%)",top:nt?`${z.bottom+ke}px`:`${z.top-ke}px`}},ye=async(z="click")=>{E.value||h.value||(de.value=z,await ge(u.value.trim()),h.value=!0,await e.nextTick(),ce(),b.value?.focus())},Le=()=>{h.value=!1,de.value=null,e.nextTick(()=>{b.value?.blur()})},$e=async z=>{if(z.stopPropagation(),!E.value){if(h.value){if(de.value==="focus"){de.value=null;return}Le();return}await ye("click")}},tt=z=>{z.key==="Escape"&&Le()},it=z=>{if(!h.value)return;const Q=z.target;f.value?.contains(Q)||Le()},Re=z=>{const Q=z.target;g.value?.contains(Q)||f.value?.contains(Q)||Le()},Be=z=>{if(z.key==="Escape"){z.preventDefault(),Le();return}if(z.key==="Enter"){z.preventDefault();const Q=M.value[0];Q&&U(Q)}},U=z=>{if(!z)return;const Q=S(z.id);if(P.value.has(Q))return;G(z);const D={id:z.id,text:L(z)||String(z.id??""),key:F(z.id)};a.value=[...a.value,D],Z(z),u.value="",e.nextTick(()=>{b.value?.focus()})},Z=z=>{const Q=a.value.map(D=>D.id);o("value-selected",{name:n.name,value:Q,option:z})},ee=z=>{if(E.value)return;const Q=a.value.filter(D=>S(D.id)!==S(z));a.value=Q},ae=z=>{E.value||(x.value=z)},ie=z=>{if(E.value||x.value===null||x.value===z)return;const Q=[...a.value],[D]=Q.splice(x.value,1);Q.splice(z,0,D),x.value=null,a.value=Q},Ce=async()=>{const Q=(Array.isArray(l.value)?[...l.value]:[]).filter(K=>K!=null);if(n.data&&Q.length){const K=Q.filter(ke=>!c.value[S(ke)]);K.length&&await we(K)}const D=Q.map(K=>({id:K,text:c.value[S(K)]??String(K),key:F(K)}));_=!0,a.value=D};e.watch(a,z=>{if(_){_=!1;return}const Q=z.map(D=>D.id);k=!0,l.value=Q,o("change",Q)},{deep:!0}),e.watch(l,()=>{if(k){k=!1;return}Ce()},{deep:!0}),e.watch(u,z=>{!n.data||!h.value||re(z.trim())}),e.watch(E,z=>{z&&Le()}),e.watch(()=>n.options,async z=>{n.data||(W(z??[]),await Ce())},{immediate:!0,deep:!0}),e.watch(()=>n.data,async z=>{z&&(await ge(u.value.trim()),await Ce())},{immediate:!0});const _e=e.ref(!1);return e.watch($,async()=>{if(n.data){if(!_e.value){_e.value=!0;return}a.value=[],await ge(u.value.trim()),await Ce()}}),e.onMounted(async()=>{document.addEventListener("click",Re,!0),window.addEventListener("keydown",tt),window.addEventListener("scroll",it,!0),await Ce()}),e.onUnmounted(()=>{document.removeEventListener("click",Re,!0),window.removeEventListener("keydown",tt),window.removeEventListener("scroll",it,!0)}),(z,Q)=>(e.openBlock(),e.createElementBlock("div",{class:"flex flex-col gap-2 w-full",ref_key:"rootRef",ref:g},[e.createElementVNode("div",{class:"relative",onClick:Q[2]||(Q[2]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{ref_key:"triggerRef",ref:m,class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white px-3","border-gray-300 hover:border-[#b3d4ff]",h.value?"border-[#2684ff] ring-1 ring-[#2684ff] shadow-[0_0_0_1px_rgba(38,132,255,0.5)]":"",E.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":h.value,"aria-haspopup":"listbox","data-focus":h.value?"true":"false",onClick:$e},[e.withDirectives(e.createElementVNode("input",{ref_key:"inputRef",ref:b,"onUpdate:modelValue":Q[0]||(Q[0]=D=>u.value=D),placeholder:I.value,disabled:E.value,readonly:!A.value,onFocus:Q[1]||(Q[1]=()=>ye("focus")),onKeydown:Be,class:"flex-1 bg-transparent border-0 outline-none px-0 py-1 text-sm text-stone-900 placeholder:text-stone-400"},null,40,iu),[[e.vModelText,u.value]]),e.createElementVNode("span",{class:e.normalizeClass(["text-stone-400 transition-transform duration-150",h.value?"rotate-180":""]),"aria-hidden":"true"},[e.createVNode(e.unref(j.ChevronDown),{class:"h-4 w-4"})],2)],10,su),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[h.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:f,class:"fixed z-[3000] rounded-md border border-stone-200 bg-white shadow-lg overflow-auto",style:e.normalizeStyle(w.value)},[e.createElementVNode("div",cu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.value,D=>(e.openBlock(),e.createElementBlock("button",{key:S(D.id),type:"button",class:"w-full px-3 py-2 text-left text-sm text-stone-900 hover:bg-stone-100 disabled:opacity-50",onClick:e.withModifiers(K=>U(D),["stop"]),disabled:E.value},e.toDisplayString(L(D)),9,du))),128)),M.value.length===0?(e.openBlock(),e.createElementBlock("p",uu," Немає варіантів ")):e.createCommentVNode("",!0)])],4)):e.createCommentVNode("",!0)]),_:1})]))]),e.createElementVNode("div",pu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(D,K)=>(e.openBlock(),e.createElementBlock("div",{key:D.key,class:e.normalizeClass(["flex items-center gap-2 rounded-md border border-stone-200 bg-white px-2 py-2",{"opacity-60":x.value===K}]),draggable:"true",onDragstart:ke=>ae(K),onDragover:Q[3]||(Q[3]=e.withModifiers(()=>{},["prevent"])),onDrop:ke=>ie(K),onDragend:Q[4]||(Q[4]=ke=>x.value=null)},[e.createElementVNode("button",{type:"button",class:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-stone-500 hover:text-stone-900",disabled:E.value,"aria-label":"Перетягнути"},[e.createVNode(e.unref(j.GripVertical),{class:"h-4 w-4"})],8,mu),e.createElementVNode("div",{class:"flex-1 text-sm text-stone-900",title:D.text},e.toDisplayString(D.text),9,hu),e.createElementVNode("button",{type:"button",class:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-stone-400 hover:text-stone-900",disabled:E.value,onClick:e.withModifiers(ke=>ee(D.id),["stop"]),"aria-label":`Видалити ${D.text}`},[e.createVNode(e.unref(j.X),{class:"h-4 w-4"})],8,gu)],42,fu))),128)),a.value.length===0?(e.openBlock(),e.createElementBlock("p",yu,"Немає вибраних значень")):e.createCommentVNode("",!0)])],512))}}),[["__scopeId","data-v-56e6cd88"]]),bu={class:"flex items-center gap-2 w-full"},ku={class:"relative flex-1"},xu=["placeholder","disabled","onKeydown"],wu=["disabled"],_u={key:0,class:"fixed inset-0 z-[1000] flex items-center justify-center bg-black/50"},vu={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},Cu={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},Eu=["onClick"],Bu={key:0,class:"p-4 text-sm text-gray-500"},Nr=e.defineComponent({__name:"vs-input-address",props:e.mergeModels({api:{default:""},geom:{default:""},includes:{default:()=>[]},bbox:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(r,{emit:t}){const n=/{{\s*([^}]+?)\s*}}/g,o=r,l=t,{inputClass:a}=Ie(o.style),s=e.useModel(r,"modelValue"),c=e.computed({get:()=>s.value,set:A=>{s.value=A}}),i=e.ref(!1),d=e.ref([]),u=e.ref(!1),h=e.ref(null);e.watch(u,A=>{typeof document>"u"||(A?(h.value=document.body.style.overflow,document.body.style.overflow="hidden"):h.value!=null?(document.body.style.overflow=h.value,h.value=null):document.body.style.removeProperty("overflow"))}),e.onBeforeUnmount(()=>{typeof document>"u"||(h.value!=null?document.body.style.overflow=h.value:document.body.style.removeProperty("overflow"))});const x=e.computed(()=>o.placeholder??""),g=e.computed(()=>!!o.disabled),m=A=>{if(!A)return null;if(Array.isArray(A))return A;if(typeof A=="string"){const B=A.split(",").map($=>$.trim()).filter(Boolean);return B.length!==4?null:B.map(Number)}return null},f=e.computed(()=>{const A=m(o.bbox);if(!A||A.length!==4)return null;const B=A.map(Number);return B.some($=>Number.isNaN($))?null:B}),b=e.computed(()=>{const A=f.value;if(!A)return"";const[B,$,S,L]=A;return`${B},${Math.max($,L)},${S},${Math.min($,L)}`});e.computed(()=>b.value?"1":"0");const w=e.inject("values");function _(){!g.value&&c.value.trim()&&k()}async function k(){const A=(c.value||"").trim();if(!A)return;let B=A;if(o.includes?.length&&w?.value){const S=o.includes.map(L=>w.value?.[L]).filter(Boolean);S.length&&(B=`${S.join(", ")}, ${A}`)}const $=I(B);if($){i.value=!0;try{const L=await(await fetch($)).json();d.value=Array.isArray(L)?L:[],u.value=!0}catch(S){console.error("Address search error:",S)}finally{i.value=!1}}}function C(){u.value=!u.value}function E(A){if(!A)return;u.value=!1;const B=parseFloat(A.lat),S={type:"Point",coordinates:[parseFloat(A.lon),B]};o.geom&&w?.value&&(w.value[o.geom]=S),l("update:geom",S)}function I(A){if(!o.api)return"";const B={value:encodeURIComponent(A),bbox:f.value?f.value.join(","):""};return o.api.replace(n,($,S)=>B[S.trim()]??"")}return(A,B)=>(e.openBlock(),e.createElementBlock("div",bu,[e.createElementVNode("div",ku,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":B[0]||(B[0]=$=>c.value=$),placeholder:x.value,disabled:g.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[e.unref(a),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:e.withKeys(e.withModifiers(_,["prevent"]),["enter"])},null,42,xu),[[e.vModelText,c.value]]),d.value.length?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:C,title:"Show search results"},[e.createVNode(e.unref(j.Info),{class:"h-4 w-4"})])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:k,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:i.value||!c.value?.trim()},[i.value?(e.openBlock(),e.createBlock(e.unref(j.LoaderCircle),{key:1,class:"h-5 w-5 animate-spin text-gray-400"})):(e.openBlock(),e.createBlock(e.unref(j.Search),{key:0,class:"h-4 w-4"}))],8,wu),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[u.value?(e.openBlock(),e.createElementBlock("div",_u,[e.createElementVNode("div",vu,[e.createElementVNode("div",Cu,[B[2]||(B[2]=e.createElementVNode("span",null,"Search results",-1)),e.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:B[1]||(B[1]=$=>u.value=!1),title:"Close"},[e.createVNode(e.unref(j.X),{class:"h-4 w-4"})])]),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,($,S)=>(e.openBlock(),e.createElementBlock("li",{key:S,onClick:L=>E($),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString($.display_name),9,Eu))),128))]),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Bu," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),Ar=(r="")=>`${r}${Math.floor(Math.random()*1e4)}`,Vu={class:"vs-datalist space-y-3"},Su={class:"space-y-3"},$u=["onClick","disabled"],Nu={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Au=["disabled"],Fu=me(e.defineComponent({__name:"vs-input-datalist",props:e.mergeModels({schema:{default:()=>[]},minItems:{default:0},maxItems:{default:void 0},addButtonText:{default:"Додати позицію"},emptyLabel:{default:"Немає рядків"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),o=e.computed(()=>Array.isArray(n.value)?n.value:[]),l=e.ref([]),a=e.computed(()=>t.schema?.map(f=>({...f,disabled:t.disabled||f.disabled}))??[]),s=e.computed(()=>a.value.map(f=>m(f))),c=e.computed(()=>t.disabled?!1:t.maxItems?o.value.length<t.maxItems:!0),i=e.computed(()=>t.disabled||o.value.length<=(t.minItems||0));e.watch(()=>o.value.length,()=>{d(),u()},{immediate:!0}),e.watch(()=>t.schema,u,{immediate:!0,deep:!0});function d(){const f=o.value.length;l.value.length<f?l.value=[...l.value,...Array.from({length:f-l.value.length},()=>Ar())]:l.value.length>f&&l.value.splice(f)}function u(){if(!t.minItems||o.value.length>=t.minItems)return;const f=t.minItems-o.value.length,b=Array.from({length:f},h);n.value=[...o.value,...b]}function h(){const f={};return a.value.forEach(b=>{f[b.name]=b?.default??null}),f}function x(){c.value&&(n.value=[...o.value,h()],d())}function g(f){i.value||(n.value=o.value.filter((b,w)=>w!==f),d(),u())}function m(f){return{...f}}return(f,b)=>(e.openBlock(),e.createElementBlock("div",Vu,[e.createElementVNode("div",Su,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(w,_)=>(e.openBlock(),e.createElementBlock("div",{key:l.value[_],class:"flex items-center gap-3"},[e.createVNode(Qe,{schema:s.value,layout:"inline",navigation:!1,values:o.value[_],"onUpdate:values":k=>o.value[_]=k,"form-id":l.value[_]},null,8,["schema","values","onUpdate:values","form-id"]),e.createElementVNode("button",{type:"button",class:"h-[38px] w-[38px] flex items-center justify-center text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",onClick:k=>g(_),disabled:i.value},[e.createVNode(e.unref(j.Trash2),{class:"h-4 w-4"})],8,$u)]))),128)),o.value.length===0?(e.openBlock(),e.createElementBlock("div",Nu,e.toDisplayString(t.emptyLabel),1)):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:x,disabled:!c.value},[e.createVNode(e.unref(j.Plus),{class:"h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Au)]))}}),[["__scopeId","data-v-260e3e66"]]),Mu={class:"vs-dataform space-y-4"},Du=["draggable","onDragstart","onDragover","onDragenter","onDrop"],Lu={class:"flex items-center gap-2"},Tu=["onClick"],Iu={class:"text-sm font-medium text-gray-700"},Ru={class:"flex items-center gap-2"},Ou=["title","onClick","disabled"],zu=["title","onClick","disabled"],Pu={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},ju=["disabled"],Uu=me(e.defineComponent({__name:"vs-input-dataform",props:e.mergeModels({schema:{default:()=>[]},minGroups:{default:0},maxGroups:{default:void 0},addButtonText:{default:"Додати групу фільтрів"},groupLabel:{default:void 0},duplicateTitle:{default:"Дублювати групу"},removeTitle:{default:"Видалити групу"},emptyLabel:{},view:{default:"default"},collapsible:{type:Boolean,default:!1},draggable:{type:Boolean,default:!0},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const t=r,n=e.useModel(r,"modelValue"),o=e.ref([]),l=e.ref([]),a=e.ref(0),s=e.ref(null),c=e.ref(null),i=e.ref(null),d=e.computed(()=>t.groupLabel??"Group"),u=e.computed(()=>t.emptyLabel??"Ще немає груп"),h=e.computed(()=>t.schema?.map(J=>({...J,disabled:t.disabled||J.disabled}))??[]),x=e.computed(()=>h.value.map(J=>$(J))),g=e.computed(()=>t.view==="accordion"),m=e.computed(()=>!!(t.collapsible||g.value)),f=e.computed(()=>t.draggable!==!1),b=e.computed(()=>t.disabled?!1:t.maxGroups?n.value.length<t.maxGroups:!0),w=e.computed(()=>t.disabled||n.value.length<=(t.minGroups||0));e.watch(()=>n.value.length,()=>{_(),k(),C()},{immediate:!0}),e.watch(()=>t.schema,C,{immediate:!0,deep:!0}),e.watch(()=>t.view,()=>{k()},{immediate:!0});function _(){const J=n.value.length;o.value.length<J?o.value=[...o.value,...Array.from({length:J-o.value.length},()=>Ar())]:o.value.length>J&&o.value.splice(J)}function k(){const J=n.value.length;g.value?J===0?a.value=-1:a.value>=J?a.value=J-1:a.value<0&&(a.value=0):l.value.length<J?l.value=[...l.value,...Array.from({length:J-l.value.length},()=>!1)]:l.value.length>J&&l.value.splice(J)}function C(){if(!t.minGroups||n.value.length>=t.minGroups)return;const J=t.minGroups-n.value.length,re=Array.from({length:J},E);n.value=[...n.value,...re],k()}function E(){const J={};return h.value.forEach(re=>{J[re.name]=re?.default??null}),J}function I(){b.value&&(n.value=[...n.value,E()],_(),k())}function A(J){w.value||(n.value=n.value.filter((re,de)=>de!==J),_(),g.value?a.value>=n.value.length&&(a.value=n.value.length-1):l.value.splice(J,1),C())}function B(J){if(t.disabled)return;const re=JSON.parse(JSON.stringify(n.value[J]??{}));n.value=[...n.value.slice(0,J+1),re,...n.value.slice(J+1)],_(),g.value?a.value>J&&(a.value+=1):l.value.splice(J+1,0,l.value[J]??!1)}function $(J){return{...J}}function S(J){return g.value?a.value===-1&&J===0?!1:a.value!==J:!!l.value[J]}function L(J){if(m.value){if(g.value){a.value=J;return}l.value[J]=!l.value[J]}}function F(J,re){if(!f.value||t.disabled){re.preventDefault();return}s.value=J,c.value=J,i.value={groups:JSON.parse(JSON.stringify(n.value)),keys:[...o.value],states:[...l.value]},re.dataTransfer?.setData("text/plain",String(J)),re.dataTransfer?.setDragImage?.(re.currentTarget,0,0)}function P(J,re){!f.value||t.disabled||s.value!==null&&X(J,re)}function M(J,re){X(J,re)}function O(J){!f.value||t.disabled||ge()}function T(){i.value&&W(),s.value=null,c.value=null,i.value=null}function G(J,re){const de=[...n.value],[ce]=de.splice(J,1);de.splice(re,0,ce),n.value=de;const ye=[...o.value],[Le]=ye.splice(J,1);if(ye.splice(re,0,Le),o.value=ye,g.value)a.value===J&&(a.value=re);else{const $e=[...l.value],[tt]=$e.splice(J,1);$e.splice(re,0,tt),l.value=$e}}function W(){i.value&&(n.value=i.value.groups,o.value=i.value.keys,l.value=i.value.states,i.value=null,c.value=null)}function X(J,re){if(s.value===null)return;const de=ne(J,re);c.value=de,we(de)}function ne(J,re){if(!re?.currentTarget)return J;const de=re.currentTarget.getBoundingClientRect(),ye=re.clientY-de.top>de.height/2?J+1:J;return Math.max(0,Math.min(ye,n.value.length))}function we(J){const re=s.value;if(re===null)return;let de=J;if(de>n.value.length&&(de=n.value.length),de===re||de===re+1)return;const ce=de>re?de-1:de;G(re,ce),s.value=ce,c.value=de>re?ce+1:ce}function ge(){i.value=null,s.value=null,c.value=null}return(J,re)=>(e.openBlock(),e.createElementBlock("div",Mu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(de,ce)=>(e.openBlock(),e.createElementBlock("div",{key:o.value[ce],class:e.normalizeClass(["relative border border-gray-200 rounded-lg bg-white transition vs-dataform__group",[t.view==="accordion"?"overflow-hidden":S(ce)?"pt-6 px-6":"p-6"]]),draggable:f.value&&!t.disabled,onDragstart:ye=>F(ce,ye),onDragend:T,onDragover:e.withModifiers(ye=>P(ce,ye),["prevent"]),onDragenter:e.withModifiers(ye=>M(ce,ye),["prevent"]),onDrop:e.withModifiers(ye=>O(),["prevent"])},[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center justify-between gap-2 border-b border-gray-100 px-4 py-3",[t.view!=="accordion"?"-mx-6 -mt-6 px-6":"",t.view!=="accordion"&&!S(ce)?"rounded-t-lg":"rounded-lg"]])},[e.createElementVNode("div",Lu,[f.value?(e.openBlock(),e.createBlock(e.unref(j.GripVertical),{key:0,class:"h-4 w-4 text-gray-400","aria-hidden":"true"})):e.createCommentVNode("",!0),m.value?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"rounded-full p-1 text-gray-500 transition hover:bg-gray-100",onClick:ye=>L(ce)},[e.createVNode(e.unref(j.ChevronDown),{class:e.normalizeClass(["h-4 w-4 transition",S(ce)?"-rotate-90":"rotate-0"])},null,8,["class"])],8,Tu)):e.createCommentVNode("",!0),e.createElementVNode("div",Iu,e.toDisplayString(`${d.value} (${ce+1})`),1)]),e.createElementVNode("div",Ru,[e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.duplicateTitle,onClick:ye=>B(ce),disabled:t.disabled,draggable:"false"},[e.createVNode(e.unref(j.Copy),{class:"h-4 w-4"})],8,Ou),e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.removeTitle,onClick:ye=>A(ce),disabled:w.value,draggable:"false"},[e.createVNode(e.unref(j.Trash2),{class:"h-4 w-4"})],8,zu)])],2),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(t.view==="accordion"?"p-6":"pt-6")},[e.createVNode(Qe,{class:"vs-dataform__form",schema:x.value,layout:"inline",navigation:!1,values:n.value[ce],"onUpdate:values":ye=>n.value[ce]=ye,"form-id":o.value[ce],disabled:t.disabled},null,8,["schema","values","onUpdate:values","form-id","disabled"])],2),[[e.vShow,!S(ce)]])],42,Du))),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",Pu,e.toDisplayString(u.value),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:I,disabled:!b.value},[e.createVNode(e.unref(j.Plus),{class:"h-4 w-4"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,ju)]))}}),[["__scopeId","data-v-cfbcfed8"]]),tn="__vs_form_monaco_loader__",vt="__vs_form_monaco_script_loader__",nn="__vs_form_monaco_editor_loader__",Mn=e.defineComponent({__name:"vs-input-monaco",props:e.mergeModels({syntax:{default:"xml"},theme:{default:"vs-light"},height:{default:280},minimap:{type:Boolean,default:!1},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(r,{expose:t}){const n=r,o=e.useModel(r,"modelValue"),l=e.ref(null),a=e.computed(()=>typeof n.height=="number"?`${n.height}px`:n.height||"280px");let s=null,c=null,i=!1;const d=()=>{if(c)return Promise.resolve(c);if(typeof window>"u")return Promise.resolve(null);const m=window;if(m.monaco?.editor?.create)return c=m.monaco,Promise.resolve(c);if(m[tn])return m[tn];const b=(async()=>{const w=C=>{if(Array.from(document.styleSheets||[]).some(A=>A?.href?.includes(C)))return;const I=document.createElement("link");I.rel="stylesheet",I.href=C,document.head.appendChild(I)},_=C=>{if(m[vt]?.[C])return m[vt][C];m[vt]||={};const E=Array.from(document.scripts).find(I=>I.src===C);return E?(m[vt][C]=new Promise((I,A)=>{const B=E.readyState;if(E.dataset.loaded==="true"||B==="loaded"||B==="complete"){I();return}E.addEventListener("load",()=>{E.dataset.loaded="true",I()},{once:!0}),E.addEventListener("error",$=>A($),{once:!0})}),m[vt][C]):(m[vt][C]=new Promise((I,A)=>{const B=document.createElement("script");B.src=C,B.async=!0,B.onload=()=>{B.dataset.loaded="true",I()},B.onerror=$=>A($),document.body.appendChild(B)}),m[vt][C])},k="https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.52.0/min/vs";return w(`${k}/editor/editor.main.min.css`),await _(`${k}/loader.min.js`),m[nn]||(m[nn]=new Promise((C,E)=>{window.require.config({paths:{vs:k}}),window.require(["vs/editor/editor.main"],()=>{c=window.monaco,m.monaco=c,C(c)},I=>E(I))}).catch(C=>{throw delete m[nn],C})),m[nn]})().catch(w=>{throw delete m[tn],w});return m[tn]=b,b},u=()=>{!l.value||!c||(s&&(s.dispose(),s=null),s=c.editor.create(l.value,{value:o.value||"",language:n.syntax,theme:n.theme,automaticLayout:!0,minimap:{enabled:!!n.minimap},readOnly:!!n.disabled}),s.onDidChangeModelContent(()=>{i||(o.value=s.getValue())}))},h=()=>{s?.focus()},x=()=>s,g=()=>c;return e.watch(()=>o.value,m=>{if(!s)return;const f=s.getValue();m!==f&&(i=!0,s.setValue(m||""),i=!1)}),e.watch(()=>n.syntax,m=>{!s||!c||c.editor.setModelLanguage(s.getModel(),m||"xml")}),e.watch(()=>n.theme,m=>{c&&c.editor.setTheme(m||"vs-light")}),e.watch(()=>n.disabled,m=>{s&&s.updateOptions({readOnly:!!m})}),e.watch(()=>n.minimap,m=>{s&&s.updateOptions({minimap:{enabled:!!m}})}),e.onMounted(async()=>{try{const m=await d();if(!m||!m.editor)return;c=m,u()}catch(m){console.error("Failed to load Monaco editor",m)}}),e.onBeforeUnmount(()=>{s&&(s.dispose(),s=null)}),t({focus:h,getEditor:x,getMonaco:g}),(m,f)=>(e.openBlock(),e.createElementBlock("div",{class:"w-full",style:e.normalizeStyle({height:a.value})},[e.createElementVNode("div",{ref_key:"editorContainer",ref:l,class:"w-full h-full overflow-hidden border border-[#CFD9E0] rounded"},null,512)],4))}}),Fr={VsInputText:Bt,VsInputRadio:Sn,"vs-input-text":Bt,"vs-input-password":Jo,"vs-input-textarea":fr,"vs-input-richtext":mr,"vs-input-mask":En,"vs-input-number":lr,"vs-input-radio":Sn,"vs-input-select":Fn,"vs-input-switcher":vn,"vs-input-static":Cn,"vs-input-container":pr,"vs-input-date":Ll,"vs-input-checkbox":ar,"vs-input-file":cr,"vs-input-file2":Nn,file2:Nn,File2:Nn,"vs-input-html":Cn,"vs-input-email":Bn,"vs-input-tel":Vn,"vs-input-datatable":hr,"vs-input-map":wr,"vs-input-file-list":dr,"vs-input-tags":_r,"vs-input-slug":vr,"vs-input-codegen":Cr,"vs-input-key-value":Er,"vs-input-text[]":Br,"vs-input-range":Sr,"vs-input-color":Vr,"vs-input-native-select":Fn,VsInputArraySelect:en,"vs-input-array":$r,"vs-input-array-select":en,"array-select":en,"vs-input-address":Nr,"vs-input-datalist":Fu,"vs-input-dataform":Uu,"vs-input-monaco":Mn},Hu=e.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(r){const t=r,n=e.inject("values");async function o(){try{if(!t.api)return;const l=t.api.replace("{{value}}",t.value),a=await fetch(l);if(!a.ok){ue.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const s=await a.json();if(!t.set||!n)return;for(const[c,i]of Object.entries(t.set))n.value[c]=s.result[i]}catch(l){console.error(t.error,l)}}return(l,a)=>(e.openBlock(),e.createElementBlock("button",{onClick:o,class:"vs-button relative inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-blue-500 hover:border-blue-500 hover:bg-blue-500 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 ml-0 md:ml-2 mt-2 md:mt-0 py-[8px] md:w-2/4 whitespace-nowrap w-full"},e.toDisplayString(l.button),1))}}),qu={class:"flex flex-col gap-1 w-full"},Gu=["innerHTML"],Mr=e.defineComponent({__name:"vs-compact-form-layout",props:e.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]},columns:{default:()=>({container:12,label:3})}},{modelValue:{default:null},modelModifiers:{}}),emits:e.mergeModels(["value-selected"],["update:modelValue"]),setup(r,{emit:t}){const n=r,o=e.useModel(r,"modelValue"),l=t,a=e.computed(()=>Xo[`${n.layout}`]),s=["label","placeholder","info","description","text","html"],c=e.ref(w()),i=e.computed(()=>m(n.item,c.value)),d=e.computed(()=>Fr?.[`vs-input-${n.item.type}`]),u=e.inject("field-props"),h=e.computed(()=>{const k=e.unref(d);if(!k)return new Set;const C=k.props??k.__vccOpts?.props;if(!C)return new Set;const E=Array.isArray(C)?C:Object.keys(C);return new Set(E)}),x=e.computed(()=>{const k={...i.value??{}},C=n.item?.name;C&&u?.value?.[C]&&Object.assign(k,u.value[C]);const E=h.value;return E.size?Object.fromEntries(Object.entries(k).filter(([I])=>E.has(I))):k}),g=k=>{const C=typeof k=="object"&&k!==null?k:{value:k};l("value-selected",{...C,name:C.name??n.item?.name})};e.onMounted(()=>{c.value=w(),window.addEventListener("storage",_)}),e.onUnmounted(()=>{window.removeEventListener("storage",_)});function m(k,C){if(!k)return{};const E={...k};return s.forEach(I=>{const A=b(k,I,C);A!=null&&(E[I]=A)}),Array.isArray(k.options)&&(E.options=k.options.map(I=>f(I,C))),E}function f(k,C){if(!k)return k;const E={...k},I=b(k,"label",C),A=b(k,"text",C);return I!=null&&(E.label=I),A!=null?E.text=A:I!=null&&(E.text=I),E}function b(k,C,E){const I=`${C}:${E}`;if(k?.[I]!=null)return k[I];if(C==="label"&&k?.[E]!=null)return k[E];if(k?.[C]!=null)return k[C];if(C==="label"){if(k?.ua!=null)return k.ua;if(k?.en!=null)return k.en}if(C==="text"||C==="html"){if(k?.ua!=null)return k.ua;if(k?.en!=null)return k.en}return null}function w(){return typeof window>"u"?"uk":localStorage.getItem("locale")||"uk"}function _(){c.value=w()}return(k,C)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),{ua:i.value.ua,error:n.error||"",item:i.value,columns:n.columns,label:i.value.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${n.item.type}-component`])},[e.createElementVNode("div",qu,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d.value),e.mergeProps(x.value,{modelValue:o.value,"onUpdate:modelValue":C[0]||(C[0]=E=>o.value=E),onValueSelected:g}),null,16,["modelValue"])),i.value.description&&n.layout!=="settings"?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-sm text-gray-500",innerHTML:i.value.description},null,8,Gu)):e.createCommentVNode("",!0)]),i.value.behavior?.api&&i.value.behavior?.button?(e.openBlock(),e.createBlock(Hu,e.mergeProps({key:0},i.value.behavior,{value:o.value}),null,16,["value"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),Ku={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},Wu={class:"vs-compact-form-navigation__rail mt-[6px]"},Yu=["onClick"],Xu=me(e.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(r,{expose:t}){const n=r,o=e.ref([]),l=e.ref(""),a=e.ref(""),s=e.computed(()=>!!n.enabled),c=e.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),i=e.computed(()=>{const L=n.width;if(L==null)return{};const F=typeof L=="number"?`${L}px`:`${L}`;return{width:F,minWidth:F}});let d=null,u=0,h=0,x=null,g=null,m=null;const f=()=>$(),b=()=>_();e.watch(()=>n.target,async L=>{if(I(),!L){x=null,o.value=[],l.value="";return}x=L,s.value&&(await e.nextTick(),E(L),_())},{immediate:!0}),e.watch(()=>n.scrollContainer,L=>{if(!s.value){g=L??null;return}w(L??null),e.nextTick(()=>_())},{immediate:!0}),e.onMounted(()=>{n.scrollContainer||w(null),_()}),e.onBeforeUnmount(()=>{I(),w(null,!0),x=null,typeof window<"u"&&(u&&window.cancelAnimationFrame(u),h&&window.cancelAnimationFrame(h))});function w(L,F=!1){if(m&&(m(),m=null),F){g=null;return}if(g=L??null,typeof window>"u")return;const P=L??window,M=window;P.addEventListener("scroll",f,{passive:!0}),M.addEventListener("resize",b),m=()=>{P.removeEventListener("scroll",f),M.removeEventListener("resize",b)}}function _(){if(!s.value||!x)return;u&&typeof window<"u"&&window.cancelAnimationFrame(u);const L=()=>{k(),u=0};typeof window>"u"?L():u=window.requestAnimationFrame(L)}function k(){if(!s.value||!x)return;const L=Array.from(x.querySelectorAll("h1, h2")),F=new Set,P=[];L.forEach((M,O)=>{const T=M.textContent?.trim()??"";if(!T)return;let G=(M.getAttribute("id")??"").trim();G||(G=C(T)||`heading-${O+1}`);let W=G,X=1;for(;F.has(W);)W=`${G}-${X+=1}`;M.id!==W&&Object.assign(M,{id:W}),F.add(W),P.push({id:W,text:T,level:M.tagName.toLowerCase()==="h1"?1:2})}),o.value=P,P.length||(l.value=""),B()}function C(L){return L.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function E(L){!L||!s.value||typeof MutationObserver>"u"||(I(),d=new MutationObserver(()=>_()),d.observe(L,{childList:!0,subtree:!0}))}function I(){d&&(d.disconnect(),d=null)}function A(L){const F=g;if(!F)return typeof window>"u"?L.offsetTop:L.getBoundingClientRect().top+window.scrollY;const P=L.getBoundingClientRect(),M=F.getBoundingClientRect();return P.top-M.top+F.scrollTop}function B(){if(!s.value||!o.value.length)return;const L=g,F=(L?L.scrollTop:null)||(typeof window<"u"?window.scrollY:0),P=(L?L.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),M=F+P;let O=null;for(let G=0;G<o.value.length;G+=1){const W=o.value[G],X=document.getElementById(W.id);if(X){const ne=A(X);ne+X.offsetHeight>F&&ne<M&&(O=W.id)}}!O&&a.value&&(O=a.value),O&&(a.value=O);const T=L?L.scrollHeight-L.clientHeight:document.documentElement.scrollHeight-window.innerHeight;F+5>=T&&(O=o.value[o.value.length-1].id),O&&(l.value=O)}function $(){s.value&&(h&&window.cancelAnimationFrame(h),h=window.requestAnimationFrame(()=>{B(),h=0}))}function S(L){if(!s.value)return;const F=document.getElementById(L);if(!F)return;const P=g,M=Math.max(0,A(F));P?P.scrollTo({top:M,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:M,behavior:"smooth"})}return t({refresh:_}),(L,F)=>s.value&&o.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(c.value),style:e.normalizeStyle(i.value)},[e.createElementVNode("h2",Ku,e.toDisplayString(L.title),1),e.createElementVNode("div",Wu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,P=>(e.openBlock(),e.createElementBlock("div",{key:P.id,class:e.normalizeClass(["vs-compact-form-navigation__item relative",P.level===2?"vs-compact-form-navigation__item--nested":"",P.id===l.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick:M=>S(P.id),class:e.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",P.level===2?"pl-[15px]":"pl-[18px]",P.id===l.value?"text-gray-800":"text-gray-500"])},[e.createElementVNode("span",null,e.toDisplayString(P.text),1)],10,Yu)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-1584a562"]]),mt={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон",minlength:r=>`Мінімальна довжина — ${r} символів`,maxlength:r=>`Максимальна довжина — ${r} символів`},Zu=r=>typeof r=="string"?r.trim()?!1:mt.required:Array.isArray(r)?r.map(n=>typeof n=="string"?n.trim():n).filter(n=>n!=null&&n!=="").length?!1:mt.required:typeof r=="number"?Number?.isNaN(r)?mt?.required:!1:r?!1:mt.required,Ju=r=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return r?t.test(r)?!1:mt.email:!1},Qu=r=>{const t=/^\+[1-9]\d{1,14}$/;return r?t.test(r)?!1:mt.tel:!1},Dr=r=>r==null?0:typeof r=="string"?r.trim().length:Array.isArray(r)?r.length:typeof r=="number"?r.toString().length:String(r).length,ep=(r,t)=>{if(r==null)return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Dr(r)<n?t?.message||mt.minlength(n):!1},tp=(r,t)=>{if(r==null||r==="")return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Dr(r)>n?t?.message||mt.maxlength(n):!1},np=(r,t)=>{const n=t.pattern??t.regexp,o=typeof n=="string"?new RegExp(n):n;if(Array.isArray(r)){const l=r.filter(Boolean);return l.length===0||l.every(a=>o.test(a))?!1:t.message}return!o.test(r)&&r?t.message:!1},rp=(r,t)=>!1,op=(r,t)=>{switch(typeof t=="string"?t:t.type){case"required":return Zu(r);case"email":return Ju(r);case"tel":return Qu(r);case"regexp":return np(r,t);case"minlength":return ep(r,t);case"maxlength":return tp(r,t);case"custom":return rp();default:return!1}},lp={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function Lr(r){const t=r?.toLowerCase();return lp[t]||t}function Dn(r,t=!1){if(Array.isArray(r)){const o=[];return r.forEach(l=>{const a={...l};a.name=(l.name||l.id||l.key||"").toString(),a.type=Lr(l.type),a.label=l.label||l.ua,a.rules=l.rules||l.validators,a.type==="email"&&!a.rules&&(a.rules=["email"]),l.data&&(a.api=`/api/suggest/${l.data}`),a.disabled=a.disabled??t,Array.isArray(a.schema)&&(a.schema=Dn(a.schema,a.disabled)),o.push(a)}),o}const n=[];return Object.entries(r).forEach(o=>{const l={name:o[0],...o[1],type:Lr(o[1].type),label:o[1].label||o[1].ua,rules:o[1].rules||o[1].validators,disabled:o[1].disabled??t};l.type==="email"&&!l.rules&&(l.rules=["email"]),o[1].type?.includes("list")&&(l.multiple=!0),!l.api&&o[1].data&&(l.api=`/api/suggest/${o[1].data}`),Array.isArray(l.schema)&&(l.schema=Dn(l.schema,l.disabled)),n.push(l)}),n}function ap(r,t,n=!1){const o=e.computed(()=>Dn((Array.isArray(t),t),typeof n=="boolean"?n:n.value)),l=e.ref({});function a(d){const u=d?.conditions;if(!u)return!0;const h=Array.isArray(u)?u[0]:u,x=r?.value?.[h];return ur(x,u)}const s=(d=o.value,u=!0)=>(d.forEach(h=>{const x=[],g=Number(h?.minlength),m=Number(h?.maxlength);!Number.isNaN(g)&&Number.isFinite(g)&&x.push({type:"minlength",value:g}),!Number.isNaN(m)&&Number.isFinite(m)&&x.push({type:"maxlength",value:m});const f=[...x,...h.rules||[]];if(f.length){if(!a(h)){delete l.value[h.name];return}let b=!1,w=null;f.forEach(_=>{const k=op(r.value[h.name],_);k&&(b=!0,!w&&typeof k=="string"&&(w=k))}),b&&w?l.value[h.name]=w:delete l.value[h.name]}h.schema&&s(h.schema,!1)}),u&&Object.values(l.value).some(Boolean)?l.value:null),c=e.computed(()=>o.value?.filter(d=>d.hidden!==!0&&a(d)));return{errors:l,validate:s,reset:()=>{r.value={},l.value={}},visibleSchema:c}}const sp={class:"flex w-full h-full min-h-0 gap-6"},ip={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},Qe=e.defineComponent({__name:"vs-compact-form",props:e.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},modelValue:{default:()=>({})},modelModifiers:{},values:{default:void 0},valuesModifiers:{}}),emits:e.mergeModels(["handle-submit","update:modelValue","value-selected"],["update:form","update:modelValue","update:values"]),setup(r,{expose:t,emit:n}){const o=n,l=r,a=e.useModel(r,"form"),s=e.useModel(r,"modelValue"),c=e.useModel(r,"values"),i=e.computed({get:()=>c.value??s.value,set:F=>{s.value=F,c.value=F}}),{errors:d,validate:u,reset:h,visibleSchema:x}=ap(i,l.schema,e.toRef(l,"disabled")),g=e.ref(null),m=e.ref(null),f=e.ref({}),b=e.computed(()=>l.navigation),w=e.computed(()=>l.navWidth),_=e.computed(()=>l.style?.columns),k=Object.freeze({container:12,label:3}),C=e.computed(()=>l.columns??_.value??k),E=e.computed(()=>l.columns!=null||_.value!=null),I=e.computed(()=>E.value?"horizontal":l.layout),A=F=>F?.columns?"horizontal":I.value,B=F=>F?.columns??C.value,$=()=>{!l.formId&&i.value&&delete i.value.id,o("update:modelValue",i.value),u(),o("handle-submit",i.value)},S=F=>{o("value-selected",F)};t({validate:u,reset:h,errors:d}),e.onMounted(()=>{a.value={value:i.value,errors:d.value,reset:h,validate:u,formId:l.formId}});function L(F,P){if(F===P)return!0;if(typeof F!="object"||typeof P!="object"||!F||!P)return!1;const M=Object.keys(F),O=Object.keys(P);return M.length!==O.length?!1:M.every(T=>F[T]===P[T])}return e.provide("form",a),e.provide("values",i),e.provide("field-props",f),(F,P)=>(e.openBlock(),e.createElementBlock("div",sp,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:m},[e.createElementVNode("form",{ref_key:"formRef",ref:g,onSubmit:e.withModifiers($,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",I.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(x),(M,O)=>(e.openBlock(),e.createElementBlock("div",{key:M.name,class:e.normalizeClass(A(M)==="horizontal"?"col-span-12":`col-span-${M.col||12}`)},[e.createVNode(Mr,{style:e.normalizeStyle(F.style),item:M,layout:A(M),columns:B(M),"model-value":i.value[M.name],"onUpdate:modelValue":T=>{if(M.name==="id"&&!F.formId)return;const G=i.value[M.name];L(G,T)||(i.value[M.name]=T)},error:e.unref(d)[M.name],onValueSelected:S},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),A(M)==="settings"&&O+1!==e.unref(x).length?(e.openBlock(),e.createElementBlock("div",ip)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(Xu,{target:g.value,"scroll-container":m.value,enabled:b.value,width:w.value},null,8,["target","scroll-container","enabled","width"])]))}}),cp={class:"relative"},dp={class:"w-full h-full fixed top-0 start-0 bg-black bg-opacity-50"},up={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"},pp={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},fp={class:"font-medium text-gray-800 dark:text-[#ffffff]"},mp={class:"p-4 mim-h-0 h-full overflow-auto"},Tr=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{},api:{},method:{}},emits:["close","save","edit"],setup(r,{emit:t}){const n=r,o=t,l=e.ref(n.schema),a=e.ref(n.defaultValue?JSON.parse(JSON.stringify(n.defaultValue)):{}),s=e.ref({}),c=e.ref(n.token||""),i=e.ref(n.mode),d=()=>{const f=n.method?.trim().toUpperCase();return f==="GET"||f==="POST"||f==="PUT"?f:i.value==="add"?"POST":"PUT"},u=()=>{ue.notify({type:"success",title:"Успішно",message:`Дані успішно ${i.value==="add"?"збережено":"оновлено"}`})},h=f=>{const b={};f.id!==void 0&&f.id!==null&&(b.id=f.id),f.obj&&typeof f.obj=="object"&&Object.assign(b,f.obj),Object.keys(b).length&&(a.value={...a.value,...b})},x=async f=>{if(console.log(f),f.ok){await f.json().catch(()=>({})),u(),o("save",a.value);return}const b=await f.json().catch(()=>({})),w=b.message||b.error;if(f.status===400){ue.notify({type:"warning",title:"Помилка валідації",message:w||"Некоректні дані (400)"});return}if(f.status===500){ue.notify({type:"error",title:"Серверна помилка",message:w||"Виникла помилка на сервері (500)"});return}ue.notify({type:"error",title:"Помилка",message:`Статус: ${f.status}`})};async function g(){const f=s.value.validate();if(f){ue.notify({type:"warning",title:"Помилка валідації",message:Object.entries(f).map(([w,_])=>`${w}: ${_}`).join(`
|
|
5
|
+
`)});return}i.value==="add"&&a.value&&delete a.value.id;const b=n.api?.trim();if(b){const w=d();try{const _=await fetch(b,{method:w,headers:w==="GET"?void 0:{"Content-Type":"application/json"},body:w==="GET"?void 0:JSON.stringify(a.value)});await x(_)}catch(_){ue.notify({type:"error",title:"Помилка з’єднання",message:_.message||"Не вдалося виконати запит"})}return}if(c.value)try{const w=await fetch(`/api/table/${c.value}`,{method:i.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a.value)});await x(w)}catch(w){ue.notify({type:"error",title:"Помилка з’єднання",message:w.message||"Не вдалося виконати запит"})}else o("edit",a.value),m()}function m(){o("close")}return e.onMounted(async()=>{try{if(n.form&&!n.schema){const f=await fetch(`/api/template/form/${n.form}`);if(!f.ok){ue.notify({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const b=await f.json();l.value=b.schema,b.token&&(c.value=b.token)}else if(n.token&&!n.defaultValue){c.value=n.token;const f=await fetch(`/api/form/${c.value}`);if(!f.ok){ue.notify({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const b=await f.json();l.value=b.schema,b.data?a.value=b.data:i.value="add",h({id:b.id,obj:b.obj})}}catch(f){ue.notify({type:"error",title:"Error",message:f.message||"Unexpected error"}),console.error(f)}}),(f,b)=>(e.openBlock(),e.createElementBlock("div",cp,[e.createElementVNode("div",dp,[e.createElementVNode("div",up,[e.createElementVNode("div",pp,[e.createElementVNode("h3",fp,e.toDisplayString(i.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:m,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},[b[2]||(b[2]=e.createElementVNode("span",{class:"sr-only"},"Close",-1)),e.createVNode(e.unref(j.X),{class:"h-4 w-4 flex-shrink-0"})])]),e.createElementVNode("div",mp,[l.value?(e.openBlock(),e.createBlock(Qe,{key:0,schema:l.value,values:a.value,"onUpdate:values":b[0]||(b[0]=w=>a.value=w),form:s.value,"onUpdate:form":b[1]||(b[1]=w=>s.value=w),formId:c.value},null,8,["schema","values","form","formId"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"vs-form__head mr-5 mb-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},[e.createElementVNode("button",{type:"button",onClick:m,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:g,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"}," Зберегти ")])])])]))}}),hp=1440*60*1e3,gp=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],yp=["січ","лют","бер","квіт","трав","черв","лип","серп","вер","жовт","лист","груд"],bp=["нд","пн","вт","ср","чт","пт","сб"];function Fe(r){return r instanceof Date&&!Number.isNaN(r.getTime())}const Vt=r=>new Date(r.getTime());function Ct(r){const t=Vt(r);return t.setHours(0,0,0,0),t}function At(r){const t=Vt(r);return t.setHours(23,59,59,999),t}function Ln(r){return Ct(new Date(r.getFullYear(),r.getMonth(),1))}function Tn(r){return At(new Date(r.getFullYear(),r.getMonth()+1,0))}function In(r,t){const n=new Date(r),o=n.getDate();n.setDate(1),n.setMonth(n.getMonth()+t);const l=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();return n.setDate(Math.min(o,l)),n}function kp(r,t){return In(r,-1)}function rn(r,t){const n=new Date(r);return n.setFullYear(n.getFullYear()+t),n}function Ir(r,t){return rn(r,-t)}function Rr(r){return Ct(new Date(r.getFullYear(),0,1))}function Or(r){return At(new Date(r.getFullYear(),11,31))}function xp(r){const t=Math.floor(r.getFullYear()/10)*10;return Ct(new Date(t,0,1))}function wp(r){const t=Math.floor(r.getFullYear()/10)*10+9;return At(new Date(t,11,31))}const et=r=>r.getFullYear(),on=r=>Math.floor(r.getFullYear()/10)*10;function _p(r){const t=[];let n=Ct(r.start);const o=Ct(r.end);for(;n<=o;)t.push(Vt(n)),n=new Date(n.getTime()+hp);return t}function vp(r){const t=[];let n=Ln(r.start);const o=Tn(r.end);for(;n<=o;)t.push(Vt(n)),n=In(n,1);return t}function Cp(r){const t=[];let n=Rr(r.start);const o=Or(r.end);for(;n<=o;)t.push(Vt(n)),n=rn(n,1);return t}function Rn(r,t=1){const n=Ct(r),o=(n.getDay()-t+7)%7;return n.setDate(n.getDate()-o),n}function Ep(r,t=1){const n=Rn(r,t);return n.setDate(n.getDate()+6),At(n)}function Bp(r,t,n=0){const o=Rn(r,n),l=(t-n+7)%7;return o.setDate(o.getDate()+l),o}const ln=(r,t)=>!!r&&!!t&&r.getFullYear()===t.getFullYear()&&r.getMonth()===t.getMonth()&&r.getDate()===t.getDate(),On=(r,t)=>!!r&&!!t&&r.getFullYear()===t.getFullYear()&&r.getMonth()===t.getMonth(),zr=(r,t)=>!!r&&!!t&&r.getFullYear()===t.getFullYear(),Pr=(r,t)=>!!r&&!!t&&ln(r,t)&&r.getHours()===t.getHours(),Vp=(r,t)=>!!r&&!!t&&Pr(r,t)&&r.getMinutes()===t.getMinutes();function Sp(r,t){const n=r.getTime();return n>=t.start.getTime()&&n<=t.end.getTime()}const Ft=(r,t)=>!!r&&!!t&&r.getTime()<t.getTime(),Mt=(r,t)=>!!r&&!!t&&r.getTime()>t.getTime();function $p(r){const t=r.filter(n=>Fe(n));if(t.length)return t.reduce((n,o)=>n.getTime()>=o.getTime()?n:o)}function Np(r){const t=r.filter(n=>Fe(n));if(t.length)return t.reduce((n,o)=>n.getTime()<=o.getTime()?n:o)}function jr(r,t){const n=Vt(r);return typeof t.year=="number"&&n.setFullYear(t.year),typeof t.month=="number"&&n.setMonth(t.month),typeof t.date=="number"&&n.setDate(t.date),typeof t.hours=="number"&&n.setHours(t.hours),typeof t.minutes=="number"&&n.setMinutes(t.minutes),typeof t.seconds=="number"&&n.setSeconds(t.seconds),typeof t.milliseconds=="number"&&n.setMilliseconds(t.milliseconds),n}const an=(r,t=2)=>String(r).padStart(t,"0");function Ur(r,t){return t==="wide"?gp[r]:yp[r]}function Ap(r){return bp[r]}const Fp=[{token:"LLLL",format:r=>Ur(r.getMonth(),"wide")},{token:"LLL",format:r=>Ur(r.getMonth(),"abbreviated")},{token:"EE",format:r=>Ap(r.getDay())},{token:"yyyy",format:r=>String(r.getFullYear())},{token:"MM",format:r=>an(r.getMonth()+1)},{token:"dd",format:r=>an(r.getDate())},{token:"HH",format:r=>an(r.getHours())},{token:"mm",format:r=>an(r.getMinutes())}];function sn(r,t){if(!Fe(r))return"";let n="",o=0;for(;o<t.length;){const l=Fp.find(a=>t.startsWith(a.token,o));l?(n+=l.format(r),o+=l.token.length):(n+=t[o],o+=1)}return n}const Mp={"yyyy-MM-dd":/^(\d{4})-(\d{2})-(\d{2})$/,"dd.MM.yyyy":/^(\d{2})\.(\d{2})\.(\d{4})$/,"dd.MM.yyyy HH:mm":/^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2})$/,"HH:mm":/^(\d{2}):(\d{2})$/,"MM.yyyy":/^(\d{2})\.(\d{4})$/,yyyy:/^(\d{4})$/};function Hr(r,t){const n=Mp[t];if(!n){const l=new Date(r);return Fe(l)?l:null}const o=r.match(n);if(!o)return null;switch(t){case"yyyy-MM-dd":{const[,l,a,s]=o,c=new Date(Number(l),Number(a)-1,Number(s));return Fe(c)?c:null}case"dd.MM.yyyy":{const[,l,a,s]=o,c=new Date(Number(s),Number(a)-1,Number(l));return Fe(c)?c:null}case"dd.MM.yyyy HH:mm":{const[,l,a,s,c,i]=o,d=new Date(Number(s),Number(a)-1,Number(l),Number(c),Number(i));return Fe(d)?d:null}case"HH:mm":{const[,l,a]=o,s=new Date;return s.setHours(Number(l),Number(a),0,0),s}case"MM.yyyy":{const[,l,a]=o;return new Date(Number(a),Number(l)-1,1)}case"yyyy":{const[,l]=o;return new Date(Number(l),0,1)}default:return null}}const Dp=["year","month","day","time","custom"],Lp=e.defineComponent({components:{ChevronLeft:j.ChevronLeft,ChevronRight:j.ChevronRight},emits:{elementClick:r=>Fe(r),left:()=>!0,right:()=>!0,heading:()=>!0},props:{headingClickable:{type:Boolean,default:!1},leftDisabled:{type:Boolean,default:!1},rightDisabled:{type:Boolean,default:!1},columnCount:{type:Number,default:7},items:{type:Array,default:()=>[]},viewMode:{type:String,required:!0,validate:r=>typeof r=="string"&&Dp.includes(r)}}}),Tp={class:"v3dp__heading"},Ip=["disabled"],Rp=["disabled"],Op={class:"v3dp__body"},zp={class:"v3dp__subheading"},Pp={class:"v3dp__elements"},jp=["disabled","onClick"];function Up(r,t,n,o,l,a){const s=e.resolveComponent("ChevronLeft"),c=e.resolveComponent("ChevronRight");return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["v3dp__popout",`v3dp__popout-${r.viewMode}`]),style:e.normalizeStyle({"--popout-column-definition":`repeat(${r.columnCount}, 1fr)`}),onMousedown:t[3]||(t[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Tp,[e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__left",disabled:r.leftDisabled,onClick:t[0]||(t[0]=e.withModifiers(i=>r.$emit("left"),["stop","prevent"]))},[e.renderSlot(r.$slots,"arrow-left",{},()=>[e.createVNode(s,{class:"v3dp__heading__icon h-4 w-4"})],!0)],8,Ip),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.headingClickable?"button":"span"),{class:"v3dp__heading__center",onClick:t[1]||(t[1]=e.withModifiers(i=>r.$emit("heading"),["stop","prevent"]))},{default:e.withCtx(()=>[e.renderSlot(r.$slots,"heading",{},void 0,!0)]),_:3})),e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__right",disabled:r.rightDisabled,onClick:t[2]||(t[2]=e.withModifiers(i=>r.$emit("right"),["stop","prevent"]))},[e.renderSlot(r.$slots,"arrow-right",{},()=>[e.createVNode(c,{class:"v3dp__heading__icon h-4 w-4"})],!0)],8,Rp)]),e.createElementVNode("div",Op,["subheading"in r.$slots?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",zp,[e.renderSlot(r.$slots,"subheading",{},void 0,!0)]),t[4]||(t[4]=e.createElementVNode("hr",{class:"v3dp__divider"},null,-1))],64)):e.createCommentVNode("",!0),e.createElementVNode("div",Pp,[e.renderSlot(r.$slots,"body",{},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.items,i=>(e.openBlock(),e.createElementBlock("button",{key:i.key,disabled:i.disabled,class:e.normalizeClass([{selected:i.selected,current:i.current},`v3dp__element__button__${r.viewMode}`]),onClick:e.withModifiers(d=>r.$emit("elementClick",i.value),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(i.display),1)],10,jp))),128))],!0)])])],38)}const cn=me(Lp,[["render",Up],["__scopeId","data-v-9e083852"]]),Hp=e.defineComponent({components:{PickerPopup:cn},emits:{"update:pageDate":r=>Fe(r),select:r=>Fe(r)},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(r,{emit:t}){const n=e.computed(()=>xp(r.pageDate)),o=e.computed(()=>wp(r.pageDate)),l=(h,x,g)=>!x&&!g?!0:!(x&&et(h)<et(x)||g&&et(h)>et(g)),a=e.computed(()=>Cp({start:n.value,end:o.value}).map(h=>({value:h,key:String(et(h)),display:et(h),selected:!!r.selected&&et(h)===et(r.selected),disabled:!l(h,r.lowerLimit,r.upperLimit)}))),s=e.computed(()=>{const h=et(n.value),x=et(o.value);return`${h} - ${x}`}),c=e.computed(()=>r.lowerLimit&&(on(r.lowerLimit)===on(r.pageDate)||Ft(r.pageDate,r.lowerLimit))),i=e.computed(()=>r.upperLimit&&(on(r.upperLimit)===on(r.pageDate)||Mt(r.pageDate,r.upperLimit)));return{years:a,heading:s,leftDisabled:c,rightDisabled:i,previousPage:()=>t("update:pageDate",Ir(r.pageDate,10)),nextPage:()=>t("update:pageDate",rn(r.pageDate,10))}}});function qp(r,t,n,o,l,a){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{columnCount:3,leftDisabled:r.leftDisabled,rightDisabled:r.rightDisabled,items:r.years,viewMode:"year",onLeft:r.previousPage,onRight:r.nextPage,onElementClick:t[0]||(t[0]=c=>r.$emit("select",c))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.heading),1)]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const Gp=me(Hp,[["render",qp]]),Kp=e.defineComponent({components:{PickerPopup:cn},emits:{"update:pageDate":r=>Fe(r),select:r=>Fe(r),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"LLL"},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(r,{emit:t}){const n=e.computed(()=>Rr(r.pageDate)),o=e.computed(()=>Or(r.pageDate)),l=e.computed(()=>x=>sn(x,r.format)),a=(x,g,m)=>!g&&!m?!0:!(g&&Ft(x,Ln(g))||m&&Mt(x,Tn(m))),s=e.computed(()=>vp({start:n.value,end:o.value}).map(x=>({value:x,display:l.value(x),key:l.value(x),selected:!!r.selected&&On(r.selected,x),disabled:!a(x,r.lowerLimit,r.upperLimit)}))),c=e.computed(()=>et(n.value)),i=e.computed(()=>r.lowerLimit&&(zr(r.lowerLimit,r.pageDate)||Ft(r.pageDate,r.lowerLimit))),d=e.computed(()=>r.upperLimit&&(zr(r.upperLimit,r.pageDate)||Mt(r.pageDate,r.upperLimit)));return{months:s,heading:c,leftDisabled:i,rightDisabled:d,previousPage:()=>t("update:pageDate",Ir(r.pageDate,1)),nextPage:()=>t("update:pageDate",rn(r.pageDate,1))}}});function Wp(r,t,n,o,l,a){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:3,items:r.months,leftDisabled:r.leftDisabled,rightDisabled:r.rightDisabled,viewMode:"month",onLeft:r.previousPage,onRight:r.nextPage,onHeading:t[0]||(t[0]=c=>r.$emit("back")),onElementClick:t[1]||(t[1]=c=>r.$emit("select",c))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.heading),1)]),_:1},8,["items","leftDisabled","rightDisabled","onLeft","onRight"])}const Yp=me(Kp,[["render",Wp]]),Xp=e.defineComponent({components:{PickerPopup:cn},emits:{"update:pageDate":r=>Fe(r),select:r=>Fe(r),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"dd"},headingFormat:{type:String,required:!1,default:"LLLL yyyy"},weekdayFormat:{type:String,required:!1,default:"EE"},weekStartsOn:{type:Number,required:!1,default:1,validator:r=>typeof r=="number"&&Number.isInteger(r)&&r>=0&&r<=6},customWeekdays:{type:Array,required:!1},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1}},setup(r,{emit:t}){const n=e.computed(()=>b=>w=>sn(w,b)),o=e.computed(()=>Ln(r.pageDate)),l=e.computed(()=>Tn(r.pageDate)),a=e.computed(()=>({start:o.value,end:l.value})),s=e.computed(()=>({start:Rn(o.value,r.weekStartsOn),end:Ep(l.value,r.weekStartsOn)})),c=e.computed(()=>r.customWeekdays?.length===7?r.customWeekdays:null),i=e.computed(()=>{const b=r.weekStartsOn,w=c.value;if(w)return Array.from({length:7}).map((k,C)=>w[(b+C)%7]);const _=n.value(r.weekdayFormat);return Array.from(Array(7)).map((k,C)=>(b+C)%7).map(k=>Bp(new Date,k,r.weekStartsOn)).map(_)}),d=(b,w,_,k)=>k?.dates?.some(C=>ln(b,C))||k?.predicate?.(b)?!1:!w&&!_?!0:!(w&&Ft(b,Ct(w))||_&&Mt(b,At(_))),u=e.computed(()=>{const b=new Date,w=n.value(r.format);return _p(s.value).map(_=>({value:_,display:w(_),selected:!!r.selected&&ln(r.selected,_),current:ln(b,_),disabled:!r.allowOutsideInterval&&!Sp(_,a.value)||!d(_,r.lowerLimit,r.upperLimit,r.disabledDates),key:n.value("yyyy-MM-dd")(_)}))}),h=e.computed(()=>n.value(r.headingFormat)(r.pageDate)),x=e.computed(()=>r.lowerLimit&&(On(r.lowerLimit,r.pageDate)||Ft(r.pageDate,r.lowerLimit))),g=e.computed(()=>r.upperLimit&&(On(r.upperLimit,r.pageDate)||Mt(r.pageDate,r.upperLimit)));return{weekDays:i,days:u,heading:h,leftDisabled:x,rightDisabled:g,previousPage:()=>t("update:pageDate",kp(r.pageDate)),nextPage:()=>t("update:pageDate",In(r.pageDate,1))}}});function Zp(r,t,n,o,l,a){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",leftDisabled:r.leftDisabled,rightDisabled:r.rightDisabled,items:r.days,viewMode:"day",onLeft:r.previousPage,onRight:r.nextPage,onHeading:t[0]||(t[0]=c=>r.$emit("back")),onElementClick:t[1]||(t[1]=c=>r.$emit("select",c))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.heading),1)]),subheading:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.weekDays,(c,i)=>(e.openBlock(),e.createElementBlock("span",{key:c,class:e.normalizeClass(`v3dp__subheading__weekday__${i}`)},e.toDisplayString(c),3))),128))]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const Jp=me(Xp,[["render",Zp]]);function qr(r,t){const n=r.getBoundingClientRect(),o={height:r.clientHeight,width:r.clientWidth},l=t.getBoundingClientRect();if(!(l.top>=n.top&&l.bottom<=n.top+o.height)){const s=l.top-n.top,c=l.bottom-n.bottom;Math.abs(s)<Math.abs(c)?r.scrollTop+=s:r.scrollTop+=c}}const Qp=e.defineComponent({components:{PickerPopup:cn},emits:{select:r=>Fe(r),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},visible:{type:Boolean,required:!0},disabledTime:{type:Object,required:!1}},setup(r,{emit:t}){const n=e.ref(null),o=e.ref(null),l=e.computed(()=>r.pageDate??r.selected),a=e.ref(l.value.getHours()),s=e.ref(l.value.getMinutes());e.watch(()=>r.selected,g=>{let m=0,f=0;g&&(m=g.getHours(),f=g.getMinutes()),a.value=m,s.value=f});const c=e.computed(()=>[...Array(24).keys()].map(g=>({value:g,date:jr(new Date(l.value.getTime()),{hours:g,minutes:s.value,seconds:0}),selected:a.value===g,ref:e.ref(null)}))),i=e.computed(()=>[...Array(60).keys()].map(g=>({value:g,date:jr(new Date(l.value.getTime()),{hours:a.value,minutes:g,seconds:0}),selected:s.value===g,ref:e.ref(null)}))),d=g=>{s.value=g.value,t("select",g.date)},u=()=>{const g=c.value.find(f=>f.ref.value?.classList?.contains("selected")??!1),m=i.value.find(f=>f.ref.value?.classList?.contains("selected")??!1);g&&m&&(qr(n.value,g.ref.value),qr(o.value,m.ref.value))};return e.watch(()=>r.visible,g=>{g&&e.nextTick(u)}),{hoursListRef:n,minutesListRef:o,hours:a,minutes:s,hoursList:c,minutesList:i,padStartZero:g=>`0${g}`.substr(-2),selectMinutes:d,isEnabled:g=>!(r.disabledTime?.dates?.some(m=>Pr(g,m)&&Vp(g,m))||r.disabledTime?.predicate?.(g)),scroll:u}}}),ef={ref:"hoursListRef",class:"v3dp__column"},tf=["disabled","onClick"],nf={ref:"minutesListRef",class:"v3dp__column"},rf=["disabled","onClick"];function of(r,t,n,o,l,a){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:2,leftDisabled:!0,rightDisabled:!0,viewMode:"time",onHeading:t[0]||(t[0]=c=>r.$emit("back"))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.padStartZero(r.hours))+":"+e.toDisplayString(r.padStartZero(r.minutes)),1)]),body:e.withCtx(()=>[e.createElementVNode("div",ef,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.hoursList,c=>(e.openBlock(),e.createElementBlock("button",{key:c.value,ref_for:!0,ref:c.ref,class:e.normalizeClass([{selected:c.selected},"v3dp__element_button__hour"]),disabled:!r.isEnabled(c.date),onClick:e.withModifiers(i=>r.hours=c.value,["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(r.padStartZero(c.value)),1)],10,tf))),128))],512),e.createElementVNode("div",nf,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.minutesList,c=>(e.openBlock(),e.createElementBlock("button",{key:c.value,ref_for:!0,ref:c.ref,class:e.normalizeClass([{selected:c.selected},"v3dp__element_button__minute"]),disabled:!r.isEnabled(c.date),onClick:e.withModifiers(i=>r.selectMinutes(c),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(r.padStartZero(c.value)),1)],10,rf))),128))],512)]),_:1})}const lf=me(Qp,[["render",of],["__scopeId","data-v-610b89e1"]]),dn=["time","day","month","year"],af=(r,t,n=void 0)=>{let o=n||new Date;const l=$p([r,o]);l&&(o=l);const a=Np([t,o]);return a&&(o=a),o},sf=e.defineComponent({components:{YearPicker:Gp,MonthPicker:Yp,DayPicker:Jp,TimePicker:lf},inheritAttrs:!1,props:{placeholder:{type:String,default:""},modelValue:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1},disabledTime:{type:Object,required:!1},upperLimit:{type:Date,required:!1},lowerLimit:{type:Date,required:!1},startingView:{type:String,required:!1,default:"day",validate:r=>typeof r=="string"&&dn.includes(r)},startingViewDate:{type:Date,required:!1,default:()=>new Date},dayPickerHeadingFormat:{type:String,required:!1,default:"LLLL yyyy"},monthListFormat:{type:String,required:!1,default:"LLL"},weekdayFormat:{type:String,required:!1,default:"EE"},dayFormat:{type:String,required:!1,default:"dd"},inputFormat:{type:String,required:!1,default:"yyyy-MM-dd"},weekDayNames:{type:Array,required:!1},weekStartsOn:{type:Number,required:!1,default:1,validator:r=>[0,1,2,3,4,5,6].includes(r)},disabled:{type:Boolean,required:!1,default:!1},clearable:{type:Boolean,required:!1,default:!1},typeable:{type:Boolean,required:!1,default:!1},minimumView:{type:String,required:!1,default:"day",validate:r=>typeof r=="string"&&dn.includes(r)}},emits:{"update:modelValue":r=>r==null||Fe(r),decadePageChanged:r=>!0,yearPageChanged:r=>!0,monthPageChanged:r=>!0,opened:()=>!0,closed:()=>!0},setup(r,{emit:t,attrs:n}){const o=e.ref("none"),l=e.ref(r.startingViewDate),a=e.ref(null),s=e.ref(!1),c=e.ref(""),i=O=>{const T=O.replace(/[a-zA-Z]/g,"0");return/0/.test(T)?T:""},d=e.computed(()=>i(r.inputFormat));let u=null,h=null;const x=()=>{u?.destroy(),u=null},g=async()=>{if(!h){const{default:O}=await Promise.resolve().then(()=>qn);h=O}return h},m=()=>{u&&u.value!==c.value&&(u.value=c.value??"")},f=async()=>{if(x(),!a.value||!d.value)return;u=(await g())(a.value,{mask:d.value,lazy:!0,overwrite:!0}),m()};e.watchEffect(()=>{if(!c.value)return;const O=Hr(c.value,r.inputFormat);O&&(l.value=O)}),e.watchEffect(()=>{c.value=r.modelValue&&Fe(r.modelValue)?sn(r.modelValue,r.inputFormat):""}),e.onMounted(()=>{d.value&&e.nextTick(()=>{f()})}),e.onBeforeUnmount(()=>{x()}),e.watch(d,O=>{O?e.nextTick(()=>{f()}):x()}),e.watch(c,()=>{m()});const b=(O="none")=>{r.disabled||(O!=="none"&&o.value==="none"&&(l.value=r.modelValue||af(r.lowerLimit,r.upperLimit,l.value)),o.value=O,t(O!=="none"?"opened":"closed"))};e.watchEffect(()=>{r.disabled&&(o.value="none")});const w=(O,T)=>{l.value=T,O==="year"?t("decadePageChanged",T):O==="month"?t("yearPageChanged",T):O==="day"&&t("monthPageChanged",T)},_=O=>{l.value=O,r.minimumView==="year"?(b("none"),t("update:modelValue",O)):o.value="month"},k=O=>{l.value=O,r.minimumView==="month"?(b("none"),t("update:modelValue",O)):o.value="day"},C=O=>{l.value=O,r.minimumView==="day"?(b("none"),t("update:modelValue",O)):o.value="time"},E=O=>{b("none"),t("update:modelValue",O)},I=()=>{r.clearable&&(b("none"),t("update:modelValue",null),l.value=r.startingViewDate)},A=()=>s.value=!0,B=()=>b(L.value),$=()=>{s.value=!1,b()},S=O=>{const T=O.keyCode?O.keyCode:O.which;if([27,13].includes(T)&&a.value.blur(),r.typeable){const W=Hr(a.value.value,r.inputFormat);W&&c.value===sn(W,r.inputFormat)&&(c.value=a.value.value,t("update:modelValue",W))}},L=e.computed(()=>{const O=dn.indexOf(r.startingView),T=dn.indexOf(r.minimumView);return O<T?r.minimumView:r.startingView}),F=O=>Object.fromEntries(Object.entries(O??{}).filter(([T,G])=>T.startsWith("--"))),P=e.computed(()=>r.weekDayNames?.length===7?r.weekDayNames:void 0);return{blur:$,focus:B,click:A,input:c,inputRef:a,pageDate:l,renderView:b,updatePageDate:w,selectYear:_,selectMonth:k,selectDay:C,selectTime:E,keyUp:S,normalizedWeekdayNames:P,viewShown:o,goBackFromTimepicker:()=>r.startingView==="time"&&r.minimumView==="time"?null:o.value="day",clearModelValue:I,initialView:L,log:O=>console.log(O),variables:F}}}),cf={class:"v3dp__input_wrapper"},df=["readonly","placeholder","disabled","tabindex"],uf={class:"v3dp__clearable"};function pf(r,t,n,o,l,a){const s=e.resolveComponent("year-picker"),c=e.resolveComponent("month-picker"),i=e.resolveComponent("day-picker"),d=e.resolveComponent("time-picker");return e.openBlock(),e.createElementBlock("div",{class:"v3dp__datepicker",style:e.normalizeStyle(r.variables(r.$attrs.style))},[e.createElementVNode("div",cf,[e.withDirectives(e.createElementVNode("input",e.mergeProps({type:"text",ref:"inputRef",readonly:!r.typeable,"onUpdate:modelValue":t[0]||(t[0]=u=>r.input=u)},r.$attrs,{placeholder:r.placeholder,disabled:r.disabled,tabindex:r.disabled?-1:0,onKeyup:t[1]||(t[1]=(...u)=>r.keyUp&&r.keyUp(...u)),onBlur:t[2]||(t[2]=(...u)=>r.blur&&r.blur(...u)),onFocus:t[3]||(t[3]=(...u)=>r.focus&&r.focus(...u)),onClick:t[4]||(t[4]=(...u)=>r.click&&r.click(...u))}),null,16,df),[[e.vModelText,r.input]]),e.withDirectives(e.createElementVNode("div",uf,[e.renderSlot(r.$slots,"clear",{onClear:r.clearModelValue},()=>[e.createElementVNode("i",{onClick:t[5]||(t[5]=u=>r.clearModelValue())},"x")])],512),[[e.vShow,r.clearable&&r.modelValue]])]),e.withDirectives(e.createVNode(s,{pageDate:r.pageDate,"onUpdate:pageDate":t[6]||(t[6]=u=>r.updatePageDate("year",u)),selected:r.modelValue,lowerLimit:r.lowerLimit,upperLimit:r.upperLimit,onSelect:r.selectYear},null,8,["pageDate","selected","lowerLimit","upperLimit","onSelect"]),[[e.vShow,r.viewShown==="year"]]),e.withDirectives(e.createVNode(c,{pageDate:r.pageDate,"onUpdate:pageDate":t[7]||(t[7]=u=>r.updatePageDate("month",u)),selected:r.modelValue,onSelect:r.selectMonth,lowerLimit:r.lowerLimit,upperLimit:r.upperLimit,format:r.monthListFormat,onBack:t[8]||(t[8]=u=>r.viewShown="year")},null,8,["pageDate","selected","onSelect","lowerLimit","upperLimit","format"]),[[e.vShow,r.viewShown==="month"]]),e.withDirectives(e.createVNode(i,{pageDate:r.pageDate,"onUpdate:pageDate":t[9]||(t[9]=u=>r.updatePageDate("day",u)),selected:r.modelValue,weekStartsOn:r.weekStartsOn,lowerLimit:r.lowerLimit,upperLimit:r.upperLimit,headingFormat:r.dayPickerHeadingFormat,disabledDates:r.disabledDates,weekdayFormat:r.weekdayFormat,"allow-outside-interval":r.allowOutsideInterval,format:r.dayFormat,"custom-weekdays":r.normalizedWeekdayNames,onSelect:r.selectDay,onBack:t[10]||(t[10]=u=>r.viewShown="month")},null,8,["pageDate","selected","weekStartsOn","lowerLimit","upperLimit","headingFormat","disabledDates","weekdayFormat","allow-outside-interval","format","custom-weekdays","onSelect"]),[[e.vShow,r.viewShown==="day"]]),e.withDirectives(e.createVNode(d,{pageDate:r.pageDate,visible:r.viewShown==="time",selected:r.modelValue,disabledTime:r.disabledTime,onSelect:r.selectTime,onBack:r.goBackFromTimepicker},null,8,["pageDate","visible","selected","disabledTime","onSelect","onBack"]),[[e.vShow,r.viewShown==="time"]])],4)}const ff=me(sf,[["render",pf]]),mf=me(e.defineComponent({__name:"vs-input-date2",props:{clearable:{type:Boolean,default:!0},now:{type:Boolean},editable:{type:Boolean,default:!0},time:{type:Boolean},isInfinity:{type:Boolean},mode:{default:"date"},weekStart:{},dayNames:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(r,{emit:t}){const n=r,o=t,{inputClass:l}=Ie(n.style),a=e.computed(()=>n.mode?n.mode:n.time?"datetime":"date"),s={date:"дд.мм.рррр",datetime:"дд.мм.рррр гг:хх",month:"мм.рррр",week:"рррр-тиждень",time:"гг:хх",year:"рррр"},c=e.computed(()=>n.placeholder||s[a.value]||""),i=e.computed(()=>["py-1.5 px-3 block w-full placeholder:text-[#767f8f] bg-white",l.value,n.customClass,{"!border-red-600":n.error}]),d=e.computed(()=>!n.modelValue&&n.now?new Date:null),u=e.computed({get:()=>k(n.modelValue??d.value,a.value)||void 0,set:T=>o("update:modelValue",C(T,a.value))}),h=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],x=e.computed(()=>{if(n.dayNames?.length)return n.dayNames.length===7?n.dayNames:h}),g=e.computed(()=>{const T=n.weekStart,G=typeof T=="string"?Number(T):T;return G===void 0||Number.isNaN(G)?1:Math.min(6,Math.max(0,G))}),m=e.computed(()=>{switch(a.value){case"time":return{startingView:"time",minimumView:"time"};case"month":return{startingView:"month",minimumView:"month"};case"year":return{startingView:"year",minimumView:"year"};case"datetime":return{startingView:"day",minimumView:"time"};default:return{startingView:"day",minimumView:"day"}}}),f={date:"dd.MM.yyyy",datetime:"dd.MM.yyyy HH:mm",month:"MM.yyyy",time:"HH:mm",week:"dd.MM.yyyy",year:"yyyy"},b=e.computed(()=>f[a.value]||"dd.MM.yyyy"),w=e.computed(()=>({"--vdp-selected-bg-color":n.style?.primaryColor||"#2563eb","--vdp-hover-bg-color":n.style?.primaryColor||"#2563eb","--vdp-selected-color":"#ffffff","--vdp-hover-color":"#ffffff","--vdp-border-radius":n.style?.size==="sm"?"6px":"8px","--vdp-elem-font-size":n.style?.size==="sm"?"0.75em":"0.85em"})),_=e.ref(!1);e.watch(()=>n.modelValue,T=>{T?_.value=!0:n.now||(_.value=!1)},{immediate:!0}),e.watchEffect(()=>{n.now&&!n.modelValue&&!_.value&&(o("update:modelValue",C(new Date,a.value)),_.value=!0)});function k(T,G){if(!T)return null;if(T instanceof Date&&!Number.isNaN(T.getTime()))return T;if(typeof T!="string")return null;switch(G){case"datetime":return B(T);case"time":return L(T);case"month":return $(T);case"year":return S(T);case"week":return F(T);case"date":default:return A(T)}}function C(T,G){if(!T)return null;const W=T instanceof Date?T:k(T,G);if(!W)return null;switch(G){case"datetime":return`${E(W)}T${I(W)}`;case"time":return I(W);case"month":return`${W.getFullYear()}-${O(W.getMonth()+1)}`;case"year":return`${W.getFullYear()}`;case"week":{const{year:X,week:ne}=P(W);return`${X}-W${O(ne)}`}case"date":default:return E(W)}}function E(T){return`${T.getFullYear()}-${O(T.getMonth()+1)}-${O(T.getDate())}`}function I(T){return`${O(T.getHours())}:${O(T.getMinutes())}`}function A(T){const G=T.split("-");if(G.length<3)return null;const[W,X,ne]=G.map(Number);return!W||!X||!ne?null:new Date(W,X-1,ne)}function B(T){const G=T.includes("T")?T:T.replace(" ","T"),W=new Date(G);return Number.isNaN(W.getTime())?null:W}function $(T){const[G,W]=T.split("-").map(Number);return!G||Number.isNaN(W)?null:new Date(G,(W||1)-1,1)}function S(T){const G=Number(T);return G?new Date(G,0,1):null}function L(T){const G=T.match(/^(\d{1,2}):(\d{2})$/);if(!G)return null;const[,W,X]=G,ne=new Date;return ne.setHours(Number(W),Number(X),0,0),ne}function F(T){const G=T.match(/^(\d{4})-W(\d{2})$/);if(!G)return null;const[,W,X]=G,ne=Number(X);return M(Number(W),ne)}function P(T){const G=new Date(Date.UTC(T.getFullYear(),T.getMonth(),T.getDate())),W=G.getUTCDay()||7;G.setUTCDate(G.getUTCDate()+4-W);const X=new Date(Date.UTC(G.getUTCFullYear(),0,1)),ne=Math.ceil(((G.getTime()-X.getTime())/864e5+1)/7);return{year:G.getUTCFullYear(),week:ne}}function M(T,G){if(!T||!G)return null;const W=new Date(T,0,1+(G-1)*7),X=W.getDay(),ne=W;return X<=4?ne.setDate(W.getDate()-W.getDay()+1):ne.setDate(W.getDate()+8-W.getDay()),ne}function O(T){return String(T).padStart(2,"0")}return(T,G)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vs-date-picker",n.customClass]),style:e.normalizeStyle(w.value)},[e.createVNode(ff,{modelValue:u.value,"onUpdate:modelValue":G[0]||(G[0]=W=>u.value=W),placeholder:c.value,disabled:n.disabled,clearable:n.clearable,typeable:n.editable,"week-day-names":x.value,"week-starts-on":g.value,"starting-view":m.value.startingView,"minimum-view":m.value.minimumView,"input-format":b.value,name:n.name,class:e.normalizeClass(i.value)},null,8,["modelValue","placeholder","disabled","clearable","typeable","week-day-names","week-starts-on","starting-view","minimum-view","input-format","name","class"])],6))}}),[["__scopeId","data-v-a65a2ac3"]]),hf={form:{richtext:{paragraph:"Paragraph",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",heading6:"Heading 6",createTable:"Create Table",addColumn:"Add Column",addRow:"Add Row",deleteColumn:"Delete Column",deleteRow:"Delete Row",deleteTable:"Delete Table",mergeCells:"Merge Cells",splitCells:"Split Cells",linkTitle:"Enter Link",link:"Link",linkUrl:"Enter URL",editLink:"Edit Link",openLink:"Open Link",removeLink:"Remove Link",openInNewTab:"Open in New Tab",editor:"Editor",html:"HTML",markdown:"Markdown",create:"Create",update:"Update",cancel:"Cancel"}}},gf={form:{richtext:{paragraph:"Звичайний текст",heading1:"Заголовок 1",heading2:"Заголовок 2",heading3:"Заголовок 3",heading4:"Заголовок 4",heading5:"Заголовок 5",heading6:"Заголовок 6",createTable:"Створити таблицю",addColumn:"Додати колонку",addRow:"Додати рядок",deleteColumn:"Видалити колонку",deleteRow:"Видалити рядок",deleteTable:"Видалити таблицю",mergeCells:"Об'єднати комірки",splitCells:"Розділити комірки",linkTitle:"Додати посилання",link:"Посилання",linkUrl:"Введіть URL",editLink:"Редагувати посилання",openLink:"Відкрити посилання",removeLink:"Видалити посилання",openInNewTab:"Відкривати в новій вкладці",editor:"Редактор",html:"HTML",markdown:"Markdown",create:"Створити",update:"Оновити",cancel:"Скасувати"}}},Gr=hf.form.richtext,Kr=gf.form.richtext,zn={en:{form:{richtext:Gr}},uk:{form:{richtext:Kr}}},Wr=(r={mode:"edit",schema:null})=>new Promise(t=>{const{close:n}=ue.modal({title:r.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Tr,contentProps:{...r,onClose:()=>{t(null),n()},onSave:o=>{t(o),n()}}})});Qe.install=function(t){t.component("VForm",Qe),Object.assign(t.config.globalProperties,{$form:Wr}),t.provide("form",Wr),window.v3plugin||(window.v3plugin={})};function ht(r){return typeof r=="string"||r instanceof String}function Yr(r){var t;return typeof r=="object"&&r!=null&&(r==null||(t=r.constructor)==null?void 0:t.name)==="Object"}function Xr(r,t){return Array.isArray(t)?Xr(r,(n,o)=>t.includes(o)):Object.entries(r).reduce((n,o)=>{let[l,a]=o;return t(a,l)&&(n[l]=a),n},{})}const le={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function Zr(r){switch(r){case le.LEFT:return le.FORCE_LEFT;case le.RIGHT:return le.FORCE_RIGHT;default:return r}}function Pn(r){return r.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function un(r,t){if(t===r)return!0;const n=Array.isArray(t),o=Array.isArray(r);let l;if(n&&o){if(t.length!=r.length)return!1;for(l=0;l<t.length;l++)if(!un(t[l],r[l]))return!1;return!0}if(n!=o)return!1;if(t&&r&&typeof t=="object"&&typeof r=="object"){const a=t instanceof Date,s=r instanceof Date;if(a&&s)return t.getTime()==r.getTime();if(a!=s)return!1;const c=t instanceof RegExp,i=r instanceof RegExp;if(c&&i)return t.toString()==r.toString();if(c!=i)return!1;const d=Object.keys(t);for(l=0;l<d.length;l++)if(!Object.prototype.hasOwnProperty.call(r,d[l]))return!1;for(l=0;l<d.length;l++)if(!un(r[d[l]],t[d[l]]))return!1;return!0}else if(t&&r&&typeof t=="function"&&typeof r=="function")return t.toString()===r.toString();return!1}class yf{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?le.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?le.RIGHT:le.LEFT}}function fe(r,t){return new fe.InputMask(r,t)}function Jr(r){if(r==null)throw new Error("mask property should be defined");return r instanceof RegExp?fe.MaskedRegExp:ht(r)?fe.MaskedPattern:r===Date?fe.MaskedDate:r===Number?fe.MaskedNumber:Array.isArray(r)||r===Array?fe.MaskedDynamic:fe.Masked&&r.prototype instanceof fe.Masked?r:fe.Masked&&r instanceof fe.Masked?r.constructor:r instanceof Function?fe.MaskedFunction:(console.warn("Mask not found for mask",r),fe.Masked)}function St(r){if(!r)throw new Error("Options in not defined");if(fe.Masked){if(r.prototype instanceof fe.Masked)return{mask:r};const{mask:t=void 0,...n}=r instanceof fe.Masked?{mask:r}:Yr(r)&&r.mask instanceof fe.Masked?r:{};if(t){const o=t.mask;return{...Xr(t,(l,a)=>!a.startsWith("_")),mask:t.constructor,_mask:o,...n}}}return Yr(r)?{...r}:{mask:r}}function lt(r){if(fe.Masked&&r instanceof fe.Masked)return r;const t=St(r),n=Jr(t.mask);if(!n)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===n&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new n(t)}fe.createMask=lt;class pn{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return t??this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return t??this.value.length}select(t,n){if(!(t==null||n==null||t===this.selectionStart&&n===this.selectionEnd))try{this._unsafeSelect(t,n)}catch{}}get isActive(){return!1}}fe.MaskElement=pn;const Qr=90,bf=89;class Dt extends pn{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,n,o;return(t=(n=(o=this.input).getRootNode)==null?void 0:n.call(o))!=null?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){if(this._handlers.redo&&(t.keyCode===Qr&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===bf&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===Qr&&(t.metaKey||t.ctrlKey))return t.preventDefault(),this._handlers.undo(t);t.isComposing||this._handlers.selectionChange(t)}_onBeforeinput(t){if(t.inputType==="historyUndo"&&this._handlers.undo)return t.preventDefault(),this._handlers.undo(t);if(t.inputType==="historyRedo"&&this._handlers.redo)return t.preventDefault(),this._handlers.redo(t)}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}fe.HTMLMaskElement=Dt;class eo extends Dt{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,n){this.input.setSelectionRange(t,n)}get value(){return this.input.value}set value(t){this.input.value=t}}fe.HTMLMaskElement=Dt;class jn extends Dt{get _unsafeSelectionStart(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),o=n&&n.anchorOffset,l=n&&n.focusOffset;return l==null||o==null||o<l?o:l}get _unsafeSelectionEnd(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),o=n&&n.anchorOffset,l=n&&n.focusOffset;return l==null||o==null||o>l?o:l}_unsafeSelect(t,n){if(!this.rootElement.createRange)return;const o=this.rootElement.createRange();o.setStart(this.input.firstChild||this.input,t),o.setEnd(this.input.lastChild||this.input,n);const l=this.rootElement,a=l.getSelection&&l.getSelection();a&&(a.removeAllRanges(),a.addRange(o))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}fe.HTMLContenteditableMaskElement=jn;class fn{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>fn.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}fn.MAX_LENGTH=100;class to{constructor(t,n){this.el=t instanceof pn?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new jn(t):new eo(t),this.masked=lt(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new fn,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(t){var n;return t==null||((n=this.masked)==null?void 0:n.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof fe.Masked)&&this.masked.constructor===Jr(t)){this.masked.updateOptions({mask:t});return}const n=t instanceof fe.Masked?t:lt({mask:t});n.unmaskedValue=this.masked.unmaskedValue,this.masked=n}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,n){const o=this._listeners[t];o&&o.forEach(l=>l(n))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){!this.el||!this.el.isActive||(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const n=this.masked.unmaskedValue,o=this.masked.value,l=this.masked.rawInputValue,a=this.displayValue,s=this.unmaskedValue!==n||this.value!==o||this._rawInputValue!==l;this._unmaskedValue=n,this._value=o,this._rawInputValue=l,this.el.value!==a&&(this.el.value=a),t==="auto"?this.alignCursor():t!=null&&(this.cursorPos=t),s&&this._fireChangeEvents(),!this._historyChanging&&(s||this.history.isEmpty)&&this.history.push({unmaskedValue:n,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:n,...o}=t,l=!this.maskEquals(n),a=this.masked.optionsIsChanged(o);l&&(this.mask=n),a&&this.masked.updateOptions(o),(l||a)&&this.updateControl()}updateCursor(t){t!=null&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,le.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,n){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(n),this}off(t,n){if(!this._listeners[t])return this;if(!n)return delete this._listeners[t],this;const o=this._listeners[t].indexOf(n);return o>=0&&this._listeners[t].splice(o,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const n=new yf({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),o=this.masked.rawInputValue,l=this.masked.splice(n.startChangePos,n.removed.length,n.inserted,n.removeDirection,{input:!0,raw:!0}).offset,a=o===this.masked.rawInputValue?n.removeDirection:le.NONE;let s=this.masked.nearestInputPos(n.startChangePos+l,a);a!==le.NONE&&(s=this.masked.nearestInputPos(s,le.NONE)),this.updateControl(s),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}fe.InputMask=to;class he{static normalize(t){return Array.isArray(t)?t:[t,new he]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}fe.ChangeDetails=he;class at{constructor(t,n,o){t===void 0&&(t=""),n===void 0&&(n=0),this.value=t,this.from=n,this.stop=o}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||t!=null&&this.from>=t)return"";const n=this.value[0];return this.value=this.value.slice(1),n}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class Me{constructor(t){this._value="",this._update({...Me.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,n){n===void 0&&(n={input:!0}),this.reset(),this.append(t,n,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,n){return t}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),Math.min(this.displayValue.length,n-t)}extractInput(t,n,o){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this.displayValue.slice(t,n)}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new at(this.extractInput(t,n),t)}appendTail(t){return ht(t)&&(t=new at(String(t))),t.appendTo(this)}_appendCharRaw(t,n){return t?(this._value+=t,new he({inserted:t,rawInserted:t})):new he}_appendChar(t,n,o){n===void 0&&(n={});const l=this.state;let a;if([t,a]=this.doPrepareChar(t,n),t&&(a=a.aggregate(this._appendCharRaw(t,n)),!a.rawInserted&&this.autofix==="pad")){const s=this.state;this.state=l;let c=this.pad(n);const i=this._appendCharRaw(t,n);c=c.aggregate(i),i.rawInserted||c.equals(a)?a=c:this.state=s}if(a.inserted){let s,c=this.doValidate(n)!==!1;if(c&&o!=null){const i=this.state;if(this.overwrite===!0){s=o.state;for(let u=0;u<a.rawInserted.length;++u)o.unshift(this.displayValue.length-a.tailShift)}let d=this.appendTail(o);if(c=d.rawInserted.length===o.toString().length,!(c&&d.inserted)&&this.overwrite==="shift"){this.state=i,s=o.state;for(let u=0;u<a.rawInserted.length;++u)o.shift();d=this.appendTail(o),c=d.rawInserted.length===o.toString().length}c&&d.inserted&&(this.state=i)}c||(a=new he,this.state=l,o&&s&&(o.state=s))}return a}_appendPlaceholder(){return new he}_appendEager(){return new he}append(t,n,o){if(!ht(t))throw new Error("value should be string");const l=ht(o)?new at(String(o)):o;n!=null&&n.tail&&(n._beforeTailState=this.state);let a;[t,a]=this.doPrepare(t,n);for(let s=0;s<t.length;++s){const c=this._appendChar(t[s],n,l);if(!c.rawInserted&&!this.doSkipInvalid(t[s],n,l))break;a.aggregate(c)}return(this.eager===!0||this.eager==="append")&&n!=null&&n.input&&t&&a.aggregate(this._appendEager()),l!=null&&(a.tailShift+=this.appendTail(l).tailShift),a}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(n),new he}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const n=this.rawInputValue,o=this.value,l=t();return this.rawInputValue=n,this.value&&this.value!==o&&o.indexOf(this.value)===0&&(this.append(o.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,l}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const n=this.state,o=t(this);return this.state=n,delete this._isolated,o}doSkipInvalid(t,n,o){return!!this.skipInvalid}doPrepare(t,n){return n===void 0&&(n={}),he.normalize(this.prepare?this.prepare(t,this,n):t)}doPrepareChar(t,n){return n===void 0&&(n={}),he.normalize(this.prepareChar?this.prepareChar(t,this,n):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,n,o,l,a){o===void 0&&(o=""),l===void 0&&(l=le.NONE),a===void 0&&(a={input:!0});const s=t+n,c=this.extractTail(s),i=this.eager===!0||this.eager==="remove";let d;i&&(l=Zr(l),d=this.extractInput(0,s,{raw:!0}));let u=t;const h=new he;if(l!==le.NONE&&(u=this.nearestInputPos(t,n>1&&t!==0&&!i?le.NONE:l),h.tailShift=u-t),h.aggregate(this.remove(u)),i&&l!==le.NONE&&d===this.rawInputValue)if(l===le.FORCE_LEFT){let x;for(;d===this.rawInputValue&&(x=this.displayValue.length);)h.aggregate(new he({tailShift:-1})).aggregate(this.remove(x-1))}else l===le.FORCE_RIGHT&&c.unshift();return h.aggregate(this.append(o,a,c))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!un(this,t)}typedValueEquals(t){const n=this.typedValue;return t===n||Me.EMPTY_VALUES.includes(t)&&Me.EMPTY_VALUES.includes(n)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new he}}Me.DEFAULTS={skipInvalid:!0},Me.EMPTY_VALUES=[void 0,null,""],fe.Masked=Me;class gt{constructor(t,n){t===void 0&&(t=[]),n===void 0&&(n=0),this.chunks=t,this.from=n}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=ht(t)?new at(String(t)):t;const n=this.chunks[this.chunks.length-1],o=n&&(n.stop===t.stop||t.stop==null)&&t.from===n.from+n.toString().length;if(t instanceof at)o?n.extend(t.toString()):this.chunks.push(t);else if(t instanceof gt){if(t.stop==null){let l;for(;t.chunks.length&&t.chunks[0].stop==null;)l=t.chunks.shift(),l.from+=t.from,this.extend(l)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof fe.MaskedPattern))return new at(this.toString()).appendTo(t);const n=new he;for(let o=0;o<this.chunks.length;++o){const l=this.chunks[o],a=t._mapPosToBlock(t.displayValue.length),s=l.stop;let c;if(s!=null&&(!a||a.index<=s)&&((l instanceof gt||t._stops.indexOf(s)>=0)&&n.aggregate(t._appendPlaceholder(s)),c=l instanceof gt&&t._blocks[s]),c){const i=c.appendTail(l);n.aggregate(i);const d=l.toString().slice(i.rawInserted.length);d&&n.aggregate(t.append(d,{tail:!0}))}else n.aggregate(t.append(l.toString(),{tail:!0}))}return n}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:n,...o}=t;Object.assign(this,o),this.chunks=n.map(l=>{const a="chunks"in l?new gt:new at;return a.state=l,a})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const n=t!=null?t-this.from:t;let o=0;for(;o<this.chunks.length;){const l=this.chunks[o],a=l.unshift(n);if(l.toString()){if(!a)break;++o}else this.chunks.splice(o,1);if(a)return a}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const n=this.chunks[t],o=n.shift();if(n.toString()){if(!o)break;--t}else this.chunks.splice(t,1);if(o)return o}return""}}class kf{constructor(t,n){this.masked=t,this._log=[];const{offset:o,index:l}=t._mapPosToBlock(n)||(n<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=o,this.index=l,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((n=this.block)==null?void 0:n.displayValue.length)||0){var n;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,le.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,le.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,le.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,le.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,le.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,le.NONE),!0})}}class Un{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(n),this._value||(this._isRawInput=!1),new he}nearestInputPos(t,n){n===void 0&&(n=le.NONE);const o=0,l=this._value.length;switch(n){case le.LEFT:case le.FORCE_LEFT:return o;case le.NONE:case le.RIGHT:case le.FORCE_RIGHT:default:return l}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._isRawInput?n-t:0}extractInput(t,n,o){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),o===void 0&&(o={}),o.raw&&this._isRawInput&&this._value.slice(t,n)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new he;const o=this.eager===!0||this.eager==="append",a=this.char===t&&(this.isUnmasking||n.input||n.raw)&&(!n.raw||!o)&&!n.tail,s=new he({inserted:this.char,rawInserted:a?this.char:""});return this._value=this.char,this._isRawInput=a&&(n.raw||n.input),s}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new he;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new at("")}appendTail(t){return ht(t)&&(t=new at(String(t))),t.appendTo(this)}append(t,n,o){const l=this._appendChar(t[0],n);return o!=null&&(l.tailShift+=this.appendTail(o).tailShift),l}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=!!t._rawInputValue}pad(t){return this._appendPlaceholder()}}class Lt{constructor(t){const{parent:n,isOptional:o,placeholderChar:l,displayChar:a,lazy:s,eager:c,...i}=t;this.masked=lt(i),Object.assign(this,{parent:n,isOptional:o,placeholderChar:l,displayChar:a,lazy:s,eager:c})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),t===0&&n>=1?(this.isFilled=!1,this.masked.remove(t,n)):new he}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new he;const o=this.masked.state;let l=this.masked._appendChar(t,this.currentMaskFlags(n));return l.inserted&&this.doValidate(n)===!1&&(l=new he,this.masked.state=o),!l.inserted&&!this.isOptional&&!this.lazy&&!n.input&&(l.inserted=this.placeholderChar),l.skip=!l.inserted&&!this.isOptional,this.isFilled=!!l.inserted,l}append(t,n,o){return this.masked.append(t,this.currentMaskFlags(n),o)}_appendPlaceholder(){return this.isFilled||this.isOptional?new he:(this.isFilled=!0,new he({inserted:this.placeholderChar}))}_appendEager(){return new he}extractTail(t,n){return this.masked.extractTail(t,n)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,n,o){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.masked.extractInput(t,n,o)}nearestInputPos(t,n){n===void 0&&(n=le.NONE);const o=0,l=this.value.length,a=Math.min(Math.max(t,o),l);switch(n){case le.LEFT:case le.FORCE_LEFT:return this.isComplete?a:o;case le.RIGHT:case le.FORCE_RIGHT:return this.isComplete?a:l;case le.NONE:default:return a}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.value.slice(t,n).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var n;return{...t,_beforeTailState:(t==null||(n=t._beforeTailState)==null?void 0:n.masked)||t?._beforeTailState}}pad(t){return new he}}Lt.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 no extends Me{updateOptions(t){super.updateOptions(t)}_update(t){const n=t.mask;n&&(t.validate=o=>o.search(n)>=0),super._update(t)}}fe.MaskedRegExp=no;class De extends Me{constructor(t){super({...De.DEFAULTS,...t,definitions:Object.assign({},Lt.DEFAULT_DEFINITIONS,t?.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const n=this.mask;if(!n||!t)return;let o=!1,l=!1;for(let a=0;a<n.length;++a){if(this.blocks){const d=n.slice(a),u=Object.keys(this.blocks).filter(x=>d.indexOf(x)===0);u.sort((x,g)=>g.length-x.length);const h=u[0];if(h){const{expose:x,repeat:g,...m}=St(this.blocks[h]),f={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...m,repeat:g,parent:this},b=g!=null?new fe.RepeatBlock(f):lt(f);b&&(this._blocks.push(b),x&&(this.exposeBlock=b),this._maskedBlocks[h]||(this._maskedBlocks[h]=[]),this._maskedBlocks[h].push(this._blocks.length-1)),a+=h.length-1;continue}}let s=n[a],c=s in t;if(s===De.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){o=!o;continue}if(s==="["||s==="]"){l=!l;continue}if(s===De.ESCAPE_CHAR){if(++a,s=n[a],!s)break;c=!1}const i=c?new Lt({isOptional:l,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...St(t[s]),parent:this}):new Un({char:s,eager:this.eager,isUnmasking:o});this._blocks.push(i)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:n,...o}=t;this._blocks.forEach((l,a)=>l.state=n[a]),super.state=o}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,n)=>t+=n.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(n),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,n)=>t+=n.value,"")}set value(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(n),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(n),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,n)=>t+=n.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const n=new he;let o=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(o==null)return n;this._blocks[o].isFilled&&++o;for(let l=o;l<this._blocks.length;++l){const a=this._blocks[l]._appendEager();if(!a.inserted)break;n.aggregate(a)}return n}_appendCharRaw(t,n){n===void 0&&(n={});const o=this._mapPosToBlock(this.displayValue.length),l=new he;if(!o)return l;for(let s=o.index,c;c=this._blocks[s];++s){var a;const i=c._appendChar(t,{...n,_beforeTailState:(a=n._beforeTailState)==null||(a=a._blocks)==null?void 0:a[s]});if(l.aggregate(i),i.consumed)break}return l}extractTail(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const o=new gt;return t===n||this._forEachBlocksInRange(t,n,(l,a,s,c)=>{const i=l.extractTail(s,c);i.stop=this._findStopBefore(a),i.from=this._blockStartPos(a),i instanceof gt&&(i.blockIndex=a),o.extend(i)}),o}extractInput(t,n,o){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),o===void 0&&(o={}),t===n)return"";let l="";return this._forEachBlocksInRange(t,n,(a,s,c,i)=>{l+=a.extractInput(c,i,o)}),l}_findStopBefore(t){let n;for(let o=0;o<this._stops.length;++o){const l=this._stops[o];if(l<=t)n=l;else break}return n}_appendPlaceholder(t){const n=new he;if(this.lazy&&t==null)return n;const o=this._mapPosToBlock(this.displayValue.length);if(!o)return n;const l=o.index,a=t??this._blocks.length;return this._blocks.slice(l,a).forEach(s=>{if(!s.lazy||t!=null){var c;n.aggregate(s._appendPlaceholder((c=s._blocks)==null?void 0:c.length))}}),n}_mapPosToBlock(t){let n="";for(let o=0;o<this._blocks.length;++o){const l=this._blocks[o],a=n.length;if(n+=l.displayValue,t<=n.length)return{index:o,offset:t-a}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((n,o)=>n+=o.displayValue.length,0)}_forEachBlocksInRange(t,n,o){n===void 0&&(n=this.displayValue.length);const l=this._mapPosToBlock(t);if(l){const a=this._mapPosToBlock(n),s=a&&l.index===a.index,c=l.offset,i=a&&s?a.offset:this._blocks[l.index].displayValue.length;if(o(this._blocks[l.index],l.index,c,i),a&&!s){for(let d=l.index+1;d<a.index;++d)o(this._blocks[d],d,0,this._blocks[d].displayValue.length);o(this._blocks[a.index],a.index,0,a.offset)}}}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const o=super.remove(t,n);return this._forEachBlocksInRange(t,n,(l,a,s,c)=>{o.aggregate(l.remove(s,c))}),o}nearestInputPos(t,n){if(n===void 0&&(n=le.NONE),!this._blocks.length)return 0;const o=new kf(this,t);if(n===le.NONE)return o.pushRightBeforeInput()||(o.popState(),o.pushLeftBeforeInput())?o.pos:this.displayValue.length;if(n===le.LEFT||n===le.FORCE_LEFT){if(n===le.LEFT){if(o.pushRightBeforeFilled(),o.ok&&o.pos===t)return t;o.popState()}if(o.pushLeftBeforeInput(),o.pushLeftBeforeRequired(),o.pushLeftBeforeFilled(),n===le.LEFT){if(o.pushRightBeforeInput(),o.pushRightBeforeRequired(),o.ok&&o.pos<=t||(o.popState(),o.ok&&o.pos<=t))return o.pos;o.popState()}return o.ok?o.pos:n===le.FORCE_LEFT?0:(o.popState(),o.ok||(o.popState(),o.ok)?o.pos:0)}return n===le.RIGHT||n===le.FORCE_RIGHT?(o.pushRightBeforeInput(),o.pushRightBeforeRequired(),o.pushRightBeforeFilled()?o.pos:n===le.FORCE_RIGHT?this.displayValue.length:(o.popState(),o.ok||(o.popState(),o.ok)?o.pos:this.nearestInputPos(t,le.LEFT))):t}totalInputPositions(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);let o=0;return this._forEachBlocksInRange(t,n,(l,a,s,c)=>{o+=l.totalInputPositions(s,c)}),o}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const n=this._maskedBlocks[t];return n?n.map(o=>this._blocks[o]):[]}pad(t){const n=new he;return this._forEachBlocksInRange(0,this.displayValue.length,o=>n.aggregate(o.pad(t))),n}}De.DEFAULTS={...Me.DEFAULTS,lazy:!0,placeholderChar:"_"},De.STOP_CHAR="`",De.ESCAPE_CHAR="\\",De.InputDefinition=Lt,De.FixedDefinition=Un,fe.MaskedPattern=De;class Tt extends De{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:n=this.to||0,from:o=this.from||0,maxLength:l=this.maxLength||0,autofix:a=this.autofix,...s}=t;this.to=n,this.from=o,this.maxLength=Math.max(String(n).length,l),this.autofix=a;const c=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<i.length&&i[d]===c[d];)++d;s.mask=i.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(s)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let n="",o="";const[,l,a]=t.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(n="0".repeat(l.length)+a,o="9".repeat(l.length)+a),n=n.padEnd(this.maxLength,"0"),o=o.padEnd(this.maxLength,"9"),[n,o]}doPrepareChar(t,n){n===void 0&&(n={});let o;return[t,o]=super.doPrepareChar(t.replace(/\D/g,""),n),t||(o.skip=!this.isComplete),[t,o]}_appendCharRaw(t,n){if(n===void 0&&(n={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,n);const o=String(this.from).padStart(this.maxLength,"0"),l=String(this.to).padStart(this.maxLength,"0"),[a,s]=this.boundaries(this.value+t);return Number(s)<this.from?super._appendCharRaw(o[this.value.length],n):Number(a)>this.to?!n.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(o[this.value.length],n).aggregate(this._appendCharRaw(t,n)):super._appendCharRaw(l[this.value.length],n):super._appendCharRaw(t,n)}doValidate(t){const n=this.value;if(n.search(/[^0]/)===-1&&n.length<=this._matchFrom)return!0;const[l,a]=this.boundaries(n);return this.from<=Number(a)&&Number(l)<=this.to&&super.doValidate(t)}pad(t){const n=new he;if(this.value.length===this.maxLength)return n;const o=this.value,l=this.maxLength-this.value.length;if(l){this.reset();for(let a=0;a<l;++a)n.aggregate(super._appendCharRaw("0",t));o.split("").forEach(a=>this._appendCharRaw(a))}return n}}fe.MaskedRange=Tt;const xf="d{.}`m{.}`Y";class st extends De{static extractPatternOptions(t){const{mask:n,pattern:o,...l}=t;return{...l,mask:ht(n)?n:o}}constructor(t){super(st.extractPatternOptions({...st.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:n,pattern:o,blocks:l,...a}={...st.DEFAULTS,...t},s=Object.assign({},st.GET_DEFAULT_BLOCKS());t.min&&(s.Y.from=t.min.getFullYear()),t.max&&(s.Y.to=t.max.getFullYear()),t.min&&t.max&&s.Y.from===s.Y.to&&(s.m.from=t.min.getMonth()+1,s.m.to=t.max.getMonth()+1,s.m.from===s.m.to&&(s.d.from=t.min.getDate(),s.d.to=t.max.getDate())),Object.assign(s,this.blocks,l),super._update({...a,mask:ht(n)?n:o,blocks:s})}doValidate(t){const n=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&n!=null&&(this.min==null||this.min<=n)&&(this.max==null||n<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(st.extractPatternOptions(t))}}st.GET_DEFAULT_BLOCKS=()=>({d:{mask:Tt,from:1,to:31,maxLength:2},m:{mask:Tt,from:1,to:12,maxLength:2},Y:{mask:Tt,from:1900,to:9999}}),st.DEFAULTS={...De.DEFAULTS,mask:Date,pattern:xf,format:(r,t)=>{if(!r)return"";const n=String(r.getDate()).padStart(2,"0"),o=String(r.getMonth()+1).padStart(2,"0"),l=r.getFullYear();return[n,o,l].join(".")},parse:(r,t)=>{const[n,o,l]=r.split(".").map(Number);return new Date(l,o-1,n)}},fe.MaskedDate=st;class It extends Me{constructor(t){super({...It.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map(n=>{const{expose:o,...l}=St(n),a=lt({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...l});return o&&(this.exposeMask=a),a}):[])}_appendCharRaw(t,n){n===void 0&&(n={});const o=this._applyDispatch(t,n);return this.currentMask&&o.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(n))),o}_applyDispatch(t,n,o){t===void 0&&(t=""),n===void 0&&(n={}),o===void 0&&(o="");const l=n.tail&&n._beforeTailState!=null?n._beforeTailState._value:this.value,a=this.rawInputValue,s=n.tail&&n._beforeTailState!=null?n._beforeTailState._rawInputValue:a,c=a.slice(s.length),i=this.currentMask,d=new he,u=i?.state;return this.currentMask=this.doDispatch(t,{...n},o),this.currentMask&&(this.currentMask!==i?(this.currentMask.reset(),s&&(this.currentMask.append(s,{raw:!0}),d.tailShift=this.currentMask.value.length-l.length),c&&(d.tailShift+=this.currentMask.append(c,{raw:!0,tail:!0}).tailShift)):u&&(this.currentMask.state=u)),d}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const n=new he;return t&&n.aggregate(this._applyDispatch("",{},t)),n.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var n,o;return{...t,_beforeTailState:((n=t._beforeTailState)==null?void 0:n.currentMaskRef)===this.currentMask&&((o=t._beforeTailState)==null?void 0:o.currentMask)||t._beforeTailState}}doDispatch(t,n,o){return n===void 0&&(n={}),o===void 0&&(o=""),this.dispatch(t,this,n,o)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,n){n===void 0&&(n={});let[o,l]=super.doPrepare(t,n);if(this.currentMask){let a;[o,a]=super.doPrepare(o,this.currentMaskFlags(n)),l=l.aggregate(a)}return[o,l]}doPrepareChar(t,n){n===void 0&&(n={});let[o,l]=super.doPrepareChar(t,n);if(this.currentMask){let a;[o,a]=super.doPrepareChar(o,this.currentMaskFlags(n)),l=l.aggregate(a)}return[o,l]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(n=>n.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask){this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,this._applyDispatch();return}let n=String(t);this.currentMask&&(this.currentMask.typedValue=t,n=this.currentMask.unmaskedValue),this.unmaskedValue=n}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return!!((t=this.currentMask)!=null&&t.isComplete)}get isFilled(){var t;return!!((t=this.currentMask)!=null&&t.isFilled)}remove(t,n){const o=new he;return this.currentMask&&o.aggregate(this.currentMask.remove(t,n)).aggregate(this._applyDispatch()),o}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(n=>n.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:n,currentMaskRef:o,currentMask:l,...a}=t;n&&this.compiledMasks.forEach((s,c)=>s.state=n[c]),o!=null&&(this.currentMask=o,this.currentMask.state=l),super.state=a}extractInput(t,n,o){return this.currentMask?this.currentMask.extractInput(t,n,o):""}extractTail(t,n){return this.currentMask?this.currentMask.extractTail(t,n):super.extractTail(t,n)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,n){return this.currentMask?this.currentMask.nearestInputPos(t,n):super.nearestInputPos(t,n)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((n,o)=>{if(!t[o])return;const{mask:l,...a}=t[o];return un(n,a)&&n.maskEquals(l)}):super.maskEquals(t)}typedValueEquals(t){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(t))}}It.DEFAULTS={...Me.DEFAULTS,dispatch:(r,t,n,o)=>{if(!t.compiledMasks.length)return;const l=t.rawInputValue,a=t.compiledMasks.map((s,c)=>{const i=t.currentMask===s,d=i?s.displayValue.length:s.nearestInputPos(s.displayValue.length,le.FORCE_LEFT);return s.rawInputValue!==l?(s.reset(),s.append(l,{raw:!0})):i||s.remove(d),s.append(r,t.currentMaskFlags(n)),s.appendTail(o),{index:c,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(d,s.nearestInputPos(s.displayValue.length,le.FORCE_LEFT)))}});return a.sort((s,c)=>c.weight-s.weight||c.totalInputPositions-s.totalInputPositions),t.compiledMasks[a[0].index]}},fe.MaskedDynamic=It;class Rt extends De{constructor(t){super({...Rt.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:n,...o}=t;if(n){const l=n.map(c=>c.length),a=Math.min(...l),s=Math.max(...l)-a;o.mask="*".repeat(a),s&&(o.mask+="["+"*".repeat(s)+"]"),this.enum=n}super._update(o)}_appendCharRaw(t,n){n===void 0&&(n={});const o=Math.min(this.nearestInputPos(0,le.FORCE_RIGHT),this.value.length),l=this.enum.filter(a=>this.matchValue(a,this.unmaskedValue+t,o));if(l.length){l.length===1&&this._forEachBlocksInRange(0,this.value.length,(s,c)=>{const i=l[0][c];c>=this.value.length||i===s.value||(s.reset(),s._appendChar(i,n))});const a=super._appendCharRaw(l[0][this.value.length],n);return l.length===1&&l[0].slice(this.unmaskedValue.length).split("").forEach(s=>a.aggregate(super._appendCharRaw(s))),a}return new he({skip:!this.isComplete})}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new at("",t)}remove(t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),t===n)return new he;const o=Math.min(super.nearestInputPos(0,le.FORCE_RIGHT),this.value.length);let l;for(l=t;l>=0&&!(this.enum.filter(c=>this.matchValue(c,this.value.slice(o,l),o)).length>1);--l);const a=super.remove(l,n);return a.tailShift+=l-t,a}get isComplete(){return this.enum.indexOf(this.value)>=0}}Rt.DEFAULTS={...De.DEFAULTS,matchValue:(r,t,n)=>r.indexOf(t,n)===n},fe.MaskedEnum=Rt;class ro extends Me{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}fe.MaskedFunction=ro;var oo;class Pe extends Me{constructor(t){super({...Pe.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",o=(this.scale?"("+Pn(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+n+o),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Pn).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Pn(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const n=t.split(this.radix);return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),n.join(this.radix)}doPrepareChar(t,n){n===void 0&&(n={});const[o,l]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(n.input&&n.raw||!n.input&&!n.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),n);return t&&!o&&(l.skip=!0),o&&!this.allowPositive&&!this.value&&o!=="-"&&l.aggregate(this._appendChar("-")),[o,l]}_separatorsCount(t,n){n===void 0&&(n=!1);let o=0;for(let l=0;l<t;++l)this._value.indexOf(this.thousandsSeparator,l)===l&&(++o,n&&(t+=this.thousandsSeparator.length));return o}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,n,o){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n),this._removeThousandsSeparators(super.extractInput(t,n,o))}_appendCharRaw(t,n){n===void 0&&(n={});const o=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,l=this._separatorsCountFromSlice(o);this._value=this._removeThousandsSeparators(this.value);const a=this._value;this._value+=t;const s=this.number;let c=!isNaN(s),i=!1;if(c){let x;this.min!=null&&this.min<0&&this.number<this.min&&(x=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(x=this.max),x!=null&&(this.autofix?(this._value=this.format(x,this).replace(Pe.UNMASKED_RADIX,this.radix),i||(i=a===this._value&&!n.tail)):c=!1),c&&(c=!!this._value.match(this._numberRegExp))}let d;c?d=new he({inserted:this._value.slice(a.length),rawInserted:i?"":t,skip:i}):(this._value=a,d=new he),this._value=this._insertThousandsSeparators(this._value);const u=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,h=this._separatorsCountFromSlice(u);return d.tailShift+=(h-l)*this.thousandsSeparator.length,d}_findSeparatorAround(t){if(this.thousandsSeparator){const n=t-this.thousandsSeparator.length+1,o=this.value.indexOf(this.thousandsSeparator,n);if(o<=t)return o}return-1}_adjustRangeWithSeparators(t,n){const o=this._findSeparatorAround(t);o>=0&&(t=o);const l=this._findSeparatorAround(n);return l>=0&&(n=l+this.thousandsSeparator.length),[t,n]}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n);const o=this.value.slice(0,t),l=this.value.slice(n),a=this._separatorsCount(o.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(o+l));const s=this._separatorsCountFromSlice(o);return new he({tailShift:(s-a)*this.thousandsSeparator.length})}nearestInputPos(t,n){if(!this.thousandsSeparator)return t;switch(n){case le.NONE:case le.LEFT:case le.FORCE_LEFT:{const o=this._findSeparatorAround(t-1);if(o>=0){const l=o+this.thousandsSeparator.length;if(t<l||this.value.length<=l||n===le.FORCE_LEFT)return o}break}case le.RIGHT:case le.FORCE_RIGHT:{const o=this._findSeparatorAround(t);if(o>=0)return o+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let n=t;this.min!=null&&(n=Math.max(n,this.min)),this.max!=null&&(n=Math.min(n,this.max)),n!==t&&(this.unmaskedValue=this.format(n,this));let o=this.value;this.normalizeZeros&&(o=this._normalizeZeros(o)),this.padFractionalZeros&&this.scale>0&&(o=this._padFractionalZeros(o)),this._value=o}super.doCommit()}_normalizeZeros(t){const n=this._removeThousandsSeparators(t).split(this.radix);return n[0]=n[0].replace(/^(\D*)(0*)(\d*)/,(o,l,a,s)=>l+s),t.length&&!/\d$/.test(n[0])&&(n[0]=n[0]+"0"),n.length>1&&(n[1]=n[1].replace(/0*$/,""),n[1].length||(n.length=1)),this._insertThousandsSeparators(n.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const n=t.split(this.radix);return n.length<2&&n.push(""),n[1]=n[1].padEnd(this.scale,"0"),n.join(this.radix)}doSkipInvalid(t,n,o){n===void 0&&(n={});const l=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===Pe.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,n,o)&&!l}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,Pe.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(Pe.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||Pe.EMPTY_VALUES.includes(t)&&Pe.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}oo=Pe,Pe.UNMASKED_RADIX=".",Pe.EMPTY_VALUES=[...Me.EMPTY_VALUES,0],Pe.DEFAULTS={...Me.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[oo.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:r=>r.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},fe.MaskedNumber=Pe;const mn={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Hn(r,t,n){t===void 0&&(t=mn.MASKED),n===void 0&&(n=mn.MASKED);const o=lt(r);return l=>o.runIsolated(a=>(a[t]=l,a[n]))}function lo(r,t,n,o){return Hn(t,n,o)(r)}fe.PIPE_TYPE=mn,fe.createPipe=Hn,fe.pipe=lo;class ao extends De{get repeatFrom(){var t;return(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?t:0}get repeatTo(){var t;return(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var n,o,l;const{repeat:a,...s}=St(t);this._blockOpts=Object.assign({},this._blockOpts,s);const c=lt(this._blockOpts);this.repeat=(n=(o=a??c.repeat)!=null?o:this.repeat)!=null?n: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:c},eager:c.eager,overwrite:c.overwrite,skipInvalid:c.skipInvalid,lazy:c.lazy,placeholderChar:c.placeholderChar,displayChar:c.displayChar})}_allocateBlock(t){if(t<this._blocks.length)return this._blocks[t];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(lt(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,n){n===void 0&&(n={});const o=new he;for(let i=(l=(a=this._mapPosToBlock(this.displayValue.length))==null?void 0:a.index)!=null?l:Math.max(this._blocks.length-1,0),d,u;d=(s=this._blocks[i])!=null?s:u=!u&&this._allocateBlock(i);++i){var l,a,s,c;const h=d._appendChar(t,{...n,_beforeTailState:(c=n._beforeTailState)==null||(c=c._blocks)==null?void 0:c[i]});if(h.skip&&u){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(o.aggregate(h),h.consumed)break}return o}_trimEmptyTail(t,n){var o,l;t===void 0&&(t=0);const a=Math.max(((o=this._mapPosToBlock(t))==null?void 0:o.index)||0,this.repeatFrom,0);let s;n!=null&&(s=(l=this._mapPosToBlock(n))==null?void 0:l.index),s==null&&(s=this._blocks.length-1);let c=0;for(let i=s;a<=i&&!this._blocks[i].unmaskedValue;--i,++c);c&&(this._blocks.splice(s-c+1,c),this.mask=this.mask.slice(c))}reset(){super.reset(),this._trimEmptyTail()}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const o=super.remove(t,n);return this._trimEmptyTail(t,n),o}totalInputPositions(t,n){return t===void 0&&(t=0),n==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,n)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}fe.RepeatBlock=ao;try{globalThis.IMask=fe}catch{}const qn=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:he,ChunksTailDetails:gt,DIRECTION:le,HTMLContenteditableMaskElement:jn,HTMLInputMaskElement:eo,HTMLMaskElement:Dt,InputMask:to,MaskElement:pn,Masked:Me,MaskedDate:st,MaskedDynamic:It,MaskedEnum:Rt,MaskedFunction:ro,MaskedNumber:Pe,MaskedPattern:De,MaskedRange:Tt,MaskedRegExp:no,PIPE_TYPE:mn,PatternFixedDefinition:Un,PatternInputDefinition:Lt,RepeatBlock:ao,createMask:lt,createPipe:Hn,default:fe,forceDirection:Zr,normalizeOpts:St,pipe:lo},Symbol.toStringTag,{value:"Module"})),wf=async r=>{try{const t=new FormData;return t.append("unique","true"),t.append("file",r),(await(await fetch("/file/upload/uploads?id=&form=&table=",{method:"POST",body:t})).json())?.result}catch(t){console.error(t)}},_f=async(r,t,n)=>{const o=t.clipboardData?.items;if(o){const l=t.clipboardData?.getData("text/html"),a=t.clipboardData?.getData("text/plain");if(l){const{state:s,dispatch:c}=r,{tr:i}=s,d=n.fromSchema(r.state.schema),u=new DOMParser().parseFromString(l,"text/html").body,h=d.parse(u),x=i.replaceSelectionWith(h);return c(x),t.preventDefault(),!0}if(a){const{state:s,dispatch:c}=r,{tr:i}=s,d=i.insertText(a,s.selection.from,s.selection.to);return c(d),t.preventDefault(),!0}for(let s=0;s<o.length;s++){const c=o[s];if(c.type.startsWith("image/")){const i=c.getAsFile();if(i){const d=await wf(i),{schema:u}=r.state,h=u.nodes.image.create({src:d?.file_path}),x=r.state.tr.replaceSelectionWith(h);return r.dispatch(x),t.preventDefault(),!0}}}}return!1},vf="https://esm.sh",He="3.7.2",so="3.7.2",Cf=`?deps=@tiptap/core@${He},@tiptap/pm@${so}`,qe=r=>`${vf}/${r}${Cf}`,Ge={core:qe(`@tiptap/core@${He}`),starterKit:qe(`@tiptap/starter-kit@${He}`),textStyle:qe(`@tiptap/extension-text-style@${He}`),table:qe(`@tiptap/extension-table@${He}`),highlight:qe(`@tiptap/extension-highlight@${He}`),subscript:qe(`@tiptap/extension-subscript@${He}`),superscript:qe(`@tiptap/extension-superscript@${He}`),link:qe(`@tiptap/extension-link@${He}`),image:qe(`@tiptap/extension-image@${He}`),textAlign:qe(`@tiptap/extension-text-align@${He}`),heading:qe(`@tiptap/extension-heading@${He}`),paragraph:qe(`@tiptap/extension-paragraph@${He}`),pmModel:qe(`@tiptap/pm@${so}/model`)},Ot="__vs_form_tiptap_loader__",Ke=r=>import(r),Ae=(r,t)=>r?.[t]||r?.default?.[t]||r?.default?.default?.[t]||r?.default||r,io={1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"},Ef=r=>r.extend({addOptions(){return{...this.parent?.(),levels:[1,2,3,4,5,6]}}}).extend({addAttributes(){return{...this.parent?.(),level:{default:1,renderHTML:t=>{const n=t.level||1;return{class:`heading-level-${n}`,style:io[n]||io[1]}}}}}}),Bf=r=>r.configure({HTMLAttributes:{style:"min-height: 1rem;"}}),Vf=(r,t,n,o,l)=>{const a=t.extend({renderHTML({HTMLAttributes:s}){return["div",{style:"overflow-x: auto;"},["table",s,0]]},parseHTML(){return[{tag:"div.table-wrapper table",priority:100},{tag:"table"}]}});return r.extend({addExtensions(){return[a.configure({HTMLAttributes:{class:"editor-content"},resizable:!0}),n,o,l]}})},Sf=r=>r.extend({addAttributes(){return{...this.parent?.(),fontFamily:{default:null,parseHTML:t=>t.style.fontFamily?.replace(/['"]/g,""),renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}},fontSize:{default:null,parseHTML:t=>t.style.fontSize?.replace(/['"]/g,""),renderHTML:t=>t.fontSize?{style:`font-size: ${t.fontSize}`}:{}},color:{default:null,parseHTML:t=>t.style.color?.replace(/['"]/g,""),renderHTML:t=>t.color?{style:`color: ${t.color}`}:{}},backgroundColor:{default:null,parseHTML:t=>t.style.backgroundColor?.replace(/['"]/g,""),renderHTML:t=>!t.backgroundColor||t.backgroundColor==="transparent"?{}:{style:`background-color: ${t.backgroundColor}`}}}},addCommands(){return{setFontFamily:t=>({chain:n})=>n().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run(),setFontSize:t=>({chain:n})=>n().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run(),setColor:t=>({chain:n})=>n().setMark("textStyle",{color:t}).run(),unsetColor:()=>({chain:t})=>t().setMark("textStyle",{color:null}).removeEmptyTextStyle().run(),setBackgroundColor:t=>({chain:n})=>n().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),$f=r=>r.create({name:"iframe",group:"block",inline:!1,atom:!0,selectable:!0,addAttributes(){return{src:{default:null},width:{default:"100%"},height:{default:"280"},frameborder:{default:"0"},allow:{default:null},allowfullscreen:{default:null},referrerpolicy:{default:null},loading:{default:null},class:{default:null},title:{default:null},style:{default:null}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:t}){return["iframe",t]}});async function Nf(){if(typeof window>"u")return null;const r=window;return r[Ot]||(r[Ot]=Promise.all([Ke(Ge.core),Ke(Ge.starterKit),Ke(Ge.textStyle),Ke(Ge.table),Ke(Ge.highlight),Ke(Ge.subscript),Ke(Ge.superscript),Ke(Ge.link),Ke(Ge.image),Ke(Ge.textAlign),Ke(Ge.heading),Ke(Ge.paragraph),Ke(Ge.pmModel)]).then(([t,n,o,l,a,s,c,i,d,u,h,x,g])=>{const m=Ae(t,"Editor"),f=Ae(t,"Node"),b=Ae(t,"Extension"),w=Ae(n,"StarterKit"),_=Ae(o,"TextStyle"),k=Ae(l,"TableKit"),C=Ae(l,"Table"),E=Ae(l,"TableRow"),I=Ae(l,"TableCell"),A=Ae(l,"TableHeader"),B=Ae(a,"Highlight"),$=Ae(s,"Subscript"),S=Ae(c,"Superscript"),L=Ae(i,"Link"),F=Ae(d,"Image"),P=Ae(u,"TextAlign"),M=Ae(h,"Heading"),O=Ae(x,"Paragraph"),T=Ae(g,"DOMParser");if(!m||!f||!w||!_||!k||!C||!E||!I||!A||!B||!$||!S||!L||!F||!P||!M||!O||!T)throw new Error("Failed to resolve one or more Tiptap modules");return{Editor:m,Extension:b,ProseMirrorDOMParser:T,StarterKit:w,ExtendedTextStyle:Sf(_),Highlight:B,Subscript:$,Superscript:S,Link:L,Image:F,TextAlign:P,CustomHeading:Ef(M),CustomParagraph:Bf(O),CustomTableKit:Vf(k,C,E,I,A),Iframe:$f(f)}}).catch(t=>{throw delete r[Ot],t})),r[Ot]}function Af(r){let t=!1;const n=e.shallowRef(null),o=e.ref(!1),l=e.ref(""),a=async(d,u="")=>{if(!d)return null;o.value=!0,l.value="";try{const h=await Nf();if(!h)return null;const x=new h.Editor({element:d,content:u,extensions:[h.StarterKit.configure({history:{depth:100,newGroupDelay:500},code:{HTMLAttributes:{class:"editor-code"}},codeBlock:{HTMLAttributes:{class:"editor-codeblock"}},paragraph:!1,heading:!1,link:!1}),h.Superscript,h.Subscript,h.ExtendedTextStyle,h.CustomParagraph,h.CustomHeading,h.Highlight,h.Image.configure({inline:!0,allowBase64:!0,HTMLAttributes:{class:"editor-image"}}),h.TextAlign.configure({types:["heading","paragraph"]}),h.Link.configure({HTMLAttributes:{class:"editor-link"},openOnClick:!1,autolink:!0}),h.CustomTableKit,h.Iframe],editorProps:{handlePaste:(g,m)=>_f(g,m,h.ProseMirrorDOMParser),handleKeyDown:(g,m)=>{if(m.key==="Tab"){const f=g.state,{$anchor:b}=f.selection;let w=!1;for(let _=b.depth;_>0;_--){const k=b.node(_);if(k&&(k.type.name==="bulletList"||k.type.name==="orderedList")){w=!0;break}}return w?!1:(m.preventDefault(),!0)}return!1}}});return n.value=e.markRaw(x),x}catch(h){return l.value="Failed to load rich text editor dependencies.",console.error("Failed to initialize rich text editor",h),null}finally{o.value=!1}},s=e.computed(()=>n.value||null);return e.watch(n,d=>{d&&n.value.on("update",u=>{if(!t){t=!0;const h=u.editor.getHTML();r.modelValue,setTimeout(()=>{t=!1},10)}})}),{editor:n,editorInstance:s,focusEditor:()=>{n.value&&!n.value.isFocused&&n.value.commands.focus()},createEditor:a,destroyEditor:()=>{n.value&&(n.value.destroy(),n.value=null)},isLoading:o,loadError:l}}function Ff(r,t,n,{toEditorContent:o,toSourceContent:l}={}){const a=e.ref(!1),s=e.ref(""),c=e.ref(null);return{isHtmlMode:a,htmlContent:s,htmlTextarea:c,toggleHtmlMode:async u=>{if(a.value=u,u)r.value&&(s.value=l?await l(r.value.getHTML(),t):r.value.getHTML()),e.nextTick(()=>{c.value&&c.value.focus?.()});else if(r.value){const h=o?await o(s.value,t):s.value;r.value.commands.setContent(h,!0),e.nextTick(()=>{r.value?.commands?.focus?.()})}},onHtmlInput:u=>{s.value=u,n&&n("update:modelValue",u)}}}function Mf(){const r=e.ref(!1);return{isFullscreen:r,toggleFullscreen:()=>{r.value=!r.value}}}const yt=r=>r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),zt=r=>{let t=yt(r||"");return t=t.replace(/!\[([^\]]*)]\(([^)\s]+)(?:\s+"([^"]+)")?\)/g,(n,o,l,a)=>{const s=a?` title="${yt(a)}"`:"";return`<img src="${yt(l)}" alt="${yt(o)}"${s}>`}),t=t.replace(/\[([^\]]+)]\(([^)\s]+)(?:\s+"([^"]+)")?\)/g,(n,o,l,a)=>{const s=a?` title="${yt(a)}"`:"";return`<a href="${yt(l)}"${s} target="_blank" rel="noopener noreferrer">${o}</a>`}),t=t.replace(/`([^`]+)`/g,"<code>$1</code>"),t=t.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),t=t.replace(/__([^_]+)__/g,"<strong>$1</strong>"),t=t.replace(/~~([^~]+)~~/g,"<del>$1</del>"),t=t.replace(/\*([^*\n]+)\*/g,"<em>$1</em>"),t=t.replace(/_([^_\n]+)_/g,"<em>$1</em>"),t},Pt=r=>/^\s*\d+\.\s+/.test(r),Gn=r=>/^\s*[-*+]\s+/.test(r),co=r=>/^\s*[-*+]\s+\[[ xX]\]\s+/.test(r),Kn=r=>/^\s*>\s?/.test(r),Wn=r=>/^\s*\|?(?:\s*:?-{3,}:?\s*\|)+\s*:?-{3,}:?\s*\|?\s*$/.test(r),uo=r=>r.trim().replace(/^\|/,"").replace(/\|$/,"").split("|").map(t=>zt(t.trim())),Df=(r,t)=>{const n=r[t],o=r[t+1];if(!n||!o||!n.includes("|")||!Wn(o))return null;const l=uo(n),a=[];let s=t+2;for(;s<r.length&&r[s].includes("|")&&r[s].trim()!=="";){const d=uo(r[s]);a.push(`<tr>${d.map(u=>`<td>${u}</td>`).join("")}</tr>`),s+=1}const c=`<thead><tr>${l.map(d=>`<th>${d}</th>`).join("")}</tr></thead>`,i=a.length?`<tbody>${a.join("")}</tbody>`:"";return{html:`<table>${c}${i}</table>`,nextIndex:s}},Lf=(r,t)=>{const n=Pt(r[t]),o=n?"ol":"ul",l=[];let a=t;for(;a<r.length;){const s=r[a];if(s.trim()===""||!(n?Pt(s):(Gn(s)||co(s))&&!Pt(s)))break;const i=s.match(/^\s*[-*+]\s+\[([ xX])\]\s+(.*)$/);if(i){const d=i[1].toLowerCase()==="x";l.push(`<li><input type="checkbox" disabled${d?" checked":""}> ${zt(i[2])}</li>`)}else{const d=s.replace(/^\s*(?:[-*+]|\d+\.)\s+/,"");l.push(`<li>${zt(d)}</li>`)}a+=1}return{html:`<${o}>${l.join("")}</${o}>`,nextIndex:a}},Tf=(r,t)=>{const o=r[t].replace(/^```/,"").trim(),l=[];let a=t+1;for(;a<r.length&&!r[a].startsWith("```");)l.push(r[a]),a+=1;return{html:`<pre><code${o?` class="language-${yt(o)}"`:""}>${yt(l.join(`
|
|
6
|
+
`))}</code></pre>`,nextIndex:a<r.length?a+1:a}},If=(r,t)=>{const n=[];let o=t;for(;o<r.length;){const l=r[o];if(l.trim()===""||l.startsWith("```")||/^#{1,6}\s+/.test(l)||/^---+$/.test(l.trim())||/^\*\*\*+$/.test(l.trim())||Kn(l)||Pt(l)||Gn(l)||o+1<r.length&&l.includes("|")&&Wn(r[o+1]))break;n.push(l.trim()),o+=1}return{html:`<p>${zt(n.join(" "))}</p>`,nextIndex:o}},po=r=>{const n=(r||"").replace(/\r\n/g,`
|
|
7
7
|
`).split(`
|
|
8
|
-
`),o=[];let l=0;for(;l<n.length;){const a=n[l],s=a.trim();if(!s){l+=1;continue}if(a.startsWith("```")){const d=Tf(n,l);o.push(d.html),l=d.nextIndex;continue}const c=a.match(/^(#{1,6})\s+(.*)$/);if(c){const d=c[1].length;o.push(`<h${d}>${
|
|
9
|
-
`))}</blockquote>`);continue}if(
|
|
8
|
+
`),o=[];let l=0;for(;l<n.length;){const a=n[l],s=a.trim();if(!s){l+=1;continue}if(a.startsWith("```")){const d=Tf(n,l);o.push(d.html),l=d.nextIndex;continue}const c=a.match(/^(#{1,6})\s+(.*)$/);if(c){const d=c[1].length;o.push(`<h${d}>${zt(c[2])}</h${d}>`),l+=1;continue}if(/^---+$/.test(s)||/^\*\*\*+$/.test(s)){o.push("<hr>"),l+=1;continue}if(a.includes("|")&&l+1<n.length&&Wn(n[l+1])){const d=Df(n,l);if(d){o.push(d.html),l=d.nextIndex;continue}}if(Kn(a)){const d=[];for(;l<n.length&&Kn(n[l]);)d.push(n[l].replace(/^\s*>\s?/,"")),l+=1;o.push(`<blockquote>${po(d.join(`
|
|
9
|
+
`))}</blockquote>`);continue}if(Pt(a)||Gn(a)||co(a)){const d=Lf(n,l);o.push(d.html),l=d.nextIndex;continue}const i=If(n,l);o.push(i.html),l=i.nextIndex}return o.join("")},Yn=r=>(r.textContent||"").replace(/\u00a0/g," "),fo=r=>Array.from(r.childNodes).map(t=>Xn(t)).join(""),Rf=r=>{const t=Array.from(r.querySelectorAll("tr"));if(!t.length)return"";const n=c=>`| ${Array.from(c.children).map(d=>fo(d).trim()).join(" | ")} |`,o=t[0],l=o?Array.from(o.children).length:0,a=`| ${Array(Math.max(l,1)).fill("---").join(" | ")} |`,s=t.slice(1).map(c=>n(c));return[n(o),a,...s].join(`
|
|
10
10
|
`)},mo=(r,t=!1)=>Array.from(r.children).filter(n=>n.nodeType===Node.ELEMENT_NODE).map((n,o)=>{const l=n,a=l.querySelector('input[type="checkbox"]'),s=Array.from(l.childNodes).filter(c=>!(c instanceof HTMLInputElement)).map(c=>Xn(c)).join("").trim();return a?`- [${a.checked?"x":" "}] ${s}`:t?`${o+1}. ${s}`:`- ${s}`}).join(`
|
|
11
11
|
`);function Xn(r){if(r.nodeType===Node.TEXT_NODE)return Yn(r);if(r.nodeType!==Node.ELEMENT_NODE)return"";const t=r,n=t.tagName.toLowerCase(),o=fo(t);switch(n){case"br":return`
|
|
12
12
|
`;case"p":return`${o.trim()}
|
|
@@ -32,7 +32,7 @@ ${i}
|
|
|
32
32
|
`;default:return o}}const ho=r=>{if(!r)return"";if(typeof window>"u"||typeof DOMParser>"u")return r;const n=new DOMParser().parseFromString(r,"text/html");return Array.from(n.body.childNodes).map(o=>Xn(o)).join("").replace(/\n{3,}/g,`
|
|
33
33
|
|
|
34
34
|
`).trim()},Of=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),zf=r=>{if(!r)return"";if(typeof window>"u"||typeof DOMParser>"u")return r;const n=new DOMParser().parseFromString(r,"text/html"),o=" ",l=(a,s)=>{if(a.nodeType===Node.TEXT_NODE){const g=(a.textContent||"").replace(/\s+/g," ").trim();return g?[`${o.repeat(s)}${g}`]:[]}if(a.nodeType!==Node.ELEMENT_NODE)return[];const c=a,i=c.tagName.toLowerCase(),d=Array.from(c.attributes).map(g=>`${g.name}="${g.value}"`).join(" "),u=d?`<${i} ${d}>`:`<${i}>`,h=`</${i}>`;if(Of.has(i))return[`${o.repeat(s)}${u}`];const x=Array.from(c.childNodes).flatMap(g=>l(g,s+1));if(!x.length)return[`${o.repeat(s)}${u}${h}`];if(c.childNodes.length===1&&c.firstChild?.nodeType===Node.TEXT_NODE&&x.length===1){const g=x[0].trim();return[`${o.repeat(s)}${u}${g}${h}`]}return[`${o.repeat(s)}${u}`,...x,`${o.repeat(s)}${h}`]};return Array.from(n.body.childNodes).flatMap(a=>l(a,0)).join(`
|
|
35
|
-
`)},Zn=async(r,t)=>t!=="md"?r||"":po(r||""),Pf=async(r,t)=>t!=="md"?zf(r||""):ho(r||""),jf=async(r,t)=>t!=="md"?r||"":ho(r||""),Uf=r=>String(r).trim().toLowerCase().split("-")[0],Hf=()=>typeof window>"u"?"uk":Uf(localStorage.getItem("language")||localStorage.getItem("locale")||navigator.language||"uk"),qf=(r,t)=>{const n=t.replace(/^form\.richtext\./,"");return zn?.[r]?.form?.richtext?.[n]||zn?.uk?.form?.richtext?.[n]||t},go=r=>r.startsWith("form.richtext.")?r:`form.richtext.${r}`;function hn(){const t=e.getCurrentInstance()?.appContext?.config?.globalProperties,n=t?.$i18n;return{t:l=>{const a=t?.$t,s=t?.$te,c=typeof n?.te=="function"?n.te.bind(n):null;if(typeof a=="function"){const i=go(l);if((typeof s=="function"?s(i):typeof c=="function"?c(i):null)!==!1){const u=a(i);if(u&&u!==i)return u}}return qf(Hf(),go(l))}}}const Gf={components:{Quote:j.Quote},props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function Kf(r,t,n,o,l,a){const s=e.resolveComponent("Quote");return e.openBlock(),e.createElementBlock("button",{title:"Blockquote",onClick:t[0]||(t[0]=(...c)=>a.toggleBlockquote&&a.toggleBlockquote(...c)),class:e.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":n.editor?.isActive("blockquote")}])},[e.createVNode(s,{class:"h-4 w-4"})],2)}const Wf=me(Gf,[["render",Kf]]),Yf={components:{List:j.List},props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function Xf(r,t,n,o,l,a){const s=e.resolveComponent("List");return e.openBlock(),e.createElementBlock("button",{title:"Bullet List",onClick:t[0]||(t[0]=(...c)=>a.toggleBulletList&&a.toggleBulletList(...c)),class:e.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("bulletList")}])},[e.createVNode(s,{class:"h-4 w-4"})],2)}const Zf=me(Yf,[["render",Xf]]),Jf={components:{ListOrdered:j.ListOrdered},props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function Qf(r,t,n,o,l,a){const s=e.resolveComponent("ListOrdered");return e.openBlock(),e.createElementBlock("button",{title:"Ordered List",onClick:t[0]||(t[0]=(...c)=>a.toggleOrderedList&&a.toggleOrderedList(...c)),class:e.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("orderedList")}])},[e.createVNode(s,{class:"h-4 w-4"})],2)}const em=me(Jf,[["render",Qf]]),tm={components:{CodeXml:j.CodeXml},props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function nm(r,t,n,o,l,a){const s=e.resolveComponent("CodeXml");return e.openBlock(),e.createElementBlock("button",{title:"Code Block",onClick:t[0]||(t[0]=(...c)=>a.toggleCodeBlock&&a.toggleCodeBlock(...c)),class:e.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("codeBlock")}])},[e.createVNode(s,{class:"h-4 w-4"})],2)}const rm=me(tm,[["render",nm]]),om={components:{Bold:j.Bold},props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.commands.toggleBold()}}};function lm(r,t,n,o,l,a){const s=e.resolveComponent("Bold");return e.openBlock(),e.createElementBlock("button",{title:"Bold Text",onClick:t[0]||(t[0]=(...c)=>a.toggleBold&&a.toggleBold(...c)),class:e.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("bold")}])},[e.createVNode(s,{class:"h-4 w-4"}),t[1]||(t[1]=e.createElementVNode("span",{class:"sr-only"},"Bold",-1))],2)}const am=me(om,[["render",lm]]),sm={components:{Italic:j.Italic},props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function im(r,t,n,o,l,a){const s=e.resolveComponent("Italic");return e.openBlock(),e.createElementBlock("button",{title:"Italic Text",onClick:t[0]||(t[0]=(...c)=>a.toggleItalic&&a.toggleItalic(...c)),class:e.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("italic")}])},[e.createVNode(s,{class:"h-4 w-4"}),t[1]||(t[1]=e.createElementVNode("span",{class:"sr-only"},"Italic",-1))],2)}const cm=me(sm,[["render",im]]),dm={__name:"vs-editor-underline",props:{editor:Object},setup(r){const t=r,n=()=>{t.editor&&t.editor.chain().focus().toggleUnderline().run()};return(o,l)=>(e.openBlock(),e.createElementBlock("button",{title:"Underline",onClick:n,class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[r.editor?.isActive("underline")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[e.createVNode(e.unref(j.Underline),{class:"h-4 w-4"})],2))}},um={__name:"vs-editor-strike",props:{editor:Object},setup(r){const t=r,n=()=>{t.editor&&t.editor.chain().focus().toggleStrike().run()};return(o,l)=>(e.openBlock(),e.createElementBlock("button",{title:"Strikethrough",onClick:n,class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[r.editor?.isActive("strike")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[e.createVNode(e.unref(j.Strikethrough),{class:"h-4 w-4"})],2))}},pm={components:{X:j.X},props:{visible:{type:Boolean,default:()=>!1},modelValue:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""},closeClickBack:{type:Boolean,default:()=>!1}},emits:["update:visible","update:modelValue","onClose","confirm","cancel"],inheritAttrs:!1,name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){return!!this.$slots?.footer},checkSize(){return this.size==="small"?"md:w-5/12 w-9/12":this.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:r}){r==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("update:modelValue",!1),this.$emit("onClose")},handleConfirm(){this.$emit("confirm"),this.handleClose()},handleCancel(){this.$emit("cancel"),this.handleClose()},closeByClickBack(r,t){t&&r.target.classList.contains("vs-dialog-overlay")&&this.handleClose()}}},fm={key:0,class:"vsTailwind ui-dialog__wrapper"},mm={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},hm={class:"font-medium text-gray-800 dark:text-[#ffffff]"},gm={class:"ui-dialog__content p-4"},ym={key:0,class:"flex justify-end gap-x-2"};function bm(r,t,n,o,l,a){const s=e.resolveComponent("X");return e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.visible||n.modelValue?(e.openBlock(),e.createElementBlock("div",fm,[e.createElementVNode("div",{onMousedown:t[1]||(t[1]=c=>a.closeByClickBack(c,n.closeClickBack)),class:"vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[100001] bg-black bg-opacity-50"},[e.createVNode(e.Transition,{name:"content",appear:""},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["ui-dialog__modal 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",[a.checkSize]])},[e.createElementVNode("div",mm,[e.createElementVNode("h3",hm,e.toDisplayString(n.title),1),e.createElementVNode("button",{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",onClick:t[0]||(t[0]=(...c)=>a.handleClose&&a.handleClose(...c))},[t[2]||(t[2]=e.createElementVNode("span",{class:"sr-only"},"Close",-1)),e.createVNode(s,{class:"h-4 w-4 flex-shrink-0"})])]),e.createElementVNode("div",gm,[e.renderSlot(r.$slots,"default",{},void 0,!0)]),a.hasSlot?(e.openBlock(),e.createElementBlock("div",ym,[e.renderSlot(r.$slots,"footer",{handleClose:a.handleClose,handleConfirm:a.handleConfirm,handleCancel:a.handleCancel},void 0,!0)])):e.createCommentVNode("",!0)],2)]),_:3})],32)])):e.createCommentVNode("",!0)])}const yo=me(pm,[["render",bm],["__scopeId","data-v-56ad9010"]]),km=e.defineComponent({components:{IconClose:j.X,IconSearch:j.Search,IconEmail:j.Mail},inheritAttrs:!1,props:{icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"right"},type:{type:String,default:()=>"text"},style:{type:Object,default:()=>null},size:{type:String,default:()=>"md"},attrs:{type:Object,default:()=>{}}},emits:["onInput","update:modelValue","blur","focus"],computed:{checkSize(){return(this.style?.size||this.size)==="xs"?"h-[32px] text-sm":(this.style?.size||this.size)==="md"?"h-[38px] text-sm":(this.style?.size||this.size)==="lg"?"h-[46px] text-[20px]":"h-[38px] text-sm"},value:{get(){return this.modelValue},set(r){this.$emit("update:modelValue",r.trim())}},clearIconStyle(){return[{"right-8":this.icon&&this.iconPosition==="right","right-3":!this.icon||this.iconPosition!=="right","pointer-events-none":this.disabled}]},iconStylePosition(){return[{"left-3":this.icon&&this.iconPosition==="left","right-3":this.icon&&this.iconPosition==="right"}]},inputStyle(){return[{"!pr-8":this.clearable&&!this.icon,"!pr-7":this.clearable,"!pr-16":this.clearable&&this.icon&&this.iconPosition==="right","!pl-8":this.icon&&this.iconPosition==="left","!pr-[50px]":this.clearable&&this.value&&this.icon&&this.iconPosition==="right","!cursor-not-allowed bg-slate-100":this.disabled,"bg-white":!this.disabled}]}},methods:{handleInput(){this.$emit("onInput",this.modelValue)},handleBlur(){this.$emit("blur")},handleFocus(){this.$emit("focus")},clearInput(){this.$emit("update:modelValue",""),this.$emit("onInput","")},async inputFocus(){await this.$refs.vsText?.focus()}}}),xm={class:"vs-form-text relative bg-white rounded-lg"},wm={key:2,class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},_m=["disabled","type","placeholder"];function vm(r,t,n,o,l,a){const s=e.resolveComponent("IconClose"),c=e.resolveComponent("IconSearch"),i=e.resolveComponent("IconEmail");return e.openBlock(),e.createElementBlock("div",xm,[r.clearable&&r.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:t[0]||(t[0]=(...d)=>r.clearInput&&r.clearInput(...d))},[e.createVNode(s,{class:"h-4 w-4 stroke-gray-500 transition-all hover:stroke-red-500"})])):e.createCommentVNode("",!0),r.icon&&r.icon==="search"?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["absolute bottom-2/4 translate-y-2/4 cursor-pointer",r.iconStylePosition])},[e.createVNode(c,{class:"h-4 w-4 stroke-gray-500 transition-all"})],2)):r.icon&&r.icon==="email"?(e.openBlock(),e.createElementBlock("div",wm,[e.createVNode(i,{class:"h-4 w-4 stroke-gray-500 transition-all"})])):(e.openBlock(),e.createElementBlock("i",{key:3,class:e.normalizeClass(["absolute bottom-2/4 translate-y-2/4 text-gray-500 cursor-pointer",["ti "+r.icon,r.iconStylePosition]])},null,2)),r.clearable&&r.value?(e.openBlock(),e.createElementBlock("div",{key:4,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:t[1]||(t[1]=(...d)=>r.clearInput&&r.clearInput(...d))},[e.createVNode(s,{class:"h-4 w-4 stroke-gray-500 transition-all hover:stroke-red-500"})])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({ref:"vsText",disabled:r.disabled,type:r.type,onInput:t[2]||(t[2]=(...d)=>r.handleInput&&r.handleInput(...d)),placeholder:r.placeholder,"onUpdate:modelValue":t[3]||(t[3]=d=>r.value=d)},r.style?.attrs||r.attrs||{},{onFocus:t[4]||(t[4]=(...d)=>r.handleFocus&&r.handleFocus(...d)),onBlur:t[5]||(t[5]=(...d)=>r.handleBlur&&r.handleBlur(...d)),class:[[r.inputStyle,r.checkSize],"py-2 px-3 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-sm 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,16,_m),[[e.vModelDynamic,r.value]])])}const bo=me(km,[["render",vm],["__scopeId","data-v-eb21a54f"]]),Cm=["title"],Em={class:"flex flex-col gap-3 p-[20px]"},Bm={class:"relative flex items-center gap-2"},Vm={class:"flex-1"},Sm={key:0,class:"flex items-center gap-2 flex-shrink-0"},$m=["title"],Nm=["title"],Am={class:"flex items-center gap-2"},Fm={for:"openInNewTab",class:"text-sm text-gray-700 cursor-pointer"},Mm={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},Dm=Object.assign({inheritAttrs:!1},{__name:"vs-editor-link",props:{editor:Object},setup(r){const{t}=hn(),n=r,o=e.ref(!1),l=e.ref(""),a=e.ref(!1),s=e.ref(!1),c=()=>{if(!n.editor)return;n.editor.chain().focus().extendMarkRange("link").run();const x=n.editor.getAttributes("link");x.href?(a.value=!0,l.value=x.href,s.value=x.target==="_blank"):(a.value=!1,l.value="",s.value=!1),o.value=!0},i=()=>{o.value=!1,l.value="",a.value=!1,s.value=!1},d=()=>{if(!n.editor||!l.value.trim())return;let x=l.value.trim();x.match(/^https?:\/\//i)||(x="https://"+x),n.editor.chain().focus().setLink({href:x,target:s.value?"_blank":null}).run(),i()},u=()=>{n.editor&&(n.editor.chain().focus().unsetLink().run(),i())},h=()=>{if(!l.value)return;let x=l.value.trim();x.match(/^https?:\/\//i)||(x="https://"+x),window.open(x,"_blank","noopener,noreferrer")};return(x,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("button",{title:e.unref(t)("form.richtext.link")||"Посилання",onClick:c,class:e.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":r.editor?.isActive("link")}])},[e.createVNode(e.unref(j.Link2),{class:"h-4 w-4"})],10,Cm),e.createVNode(yo,{title:a.value?e.unref(t)("form.richtext.editLink")||"Редагувати посилання":e.unref(t)("form.richtext.linkTitle")||"Додати посилання",visible:o.value,"onUpdate:visible":g[2]||(g[2]=m=>o.value=m),size:"small"},{footer:e.withCtx(()=>[e.createElementVNode("div",Mm,[e.createElementVNode("button",{style:{border:"1px solid #000"},onClick:i,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"},e.toDisplayString(e.unref(t)("form.richtext.cancel")||"Скасувати"),1),e.createElementVNode("button",{onClick:d,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"},e.toDisplayString(a.value?e.unref(t)("form.richtext.update")||"Оновити":e.unref(t)("form.richtext.create")||"Створити"),1)])]),default:e.withCtx(()=>[e.createElementVNode("div",Em,[e.createElementVNode("div",Bm,[e.createElementVNode("div",Vm,[e.createVNode(bo,{modelValue:l.value,"onUpdate:modelValue":g[0]||(g[0]=m=>l.value=m),placeholder:e.unref(t)("form.richtext.linkUrl")||"Введіть URL",class:"w-full"},null,8,["modelValue","placeholder"])]),a.value?(e.openBlock(),e.createElementBlock("div",Sm,[e.createElementVNode("button",{onClick:h,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none transition-colors",title:e.unref(t)("form.richtext.openLink")||"Відкрити посилання"},[e.createVNode(e.unref(j.ExternalLink),{class:"h-4 w-4"})],8,$m),e.createElementVNode("button",{onClick:u,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-red-600 hover:bg-red-50 focus:outline-none transition-colors",title:e.unref(t)("form.richtext.removeLink")||"Видалити посилання"},[e.createVNode(e.unref(j.Trash2),{class:"h-4 w-4"})],8,Nm)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Am,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",id:"openInNewTab","onUpdate:modelValue":g[1]||(g[1]=m=>s.value=m),class:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500"},null,512),[[e.vModelCheckbox,s.value]]),e.createElementVNode("label",Fm,e.toDisplayString(e.unref(t)("form.richtext.openInNewTab")||"Відкривати в новій вкладці"),1)])])]),_:1},8,["title","visible"])],64))}}),Pt=async(r,t,n,o=10)=>{if(!t||!n)return;await e.nextTick();const l=await n?.getBoundingClientRect(),a=await t?.getBoundingClientRect();if(!a||!l)return;const s=await parseInt(t?.getBoundingClientRect()?.height),c=await parseInt(t?.getBoundingClientRect()?.width),i=await parseInt(n?.getBoundingClientRect()?.height),d=await parseInt(n?.getBoundingClientRect()?.width),u=await window.innerHeight,h=await window.innerWidth;let x=0,g=0;const m=a.bottom+o+i;switch(r){case"top":a.top-l.height-o<0?x=a.top-l.height+o+i+s:x=a.top-l.height-o,h>d+a.right+30?g=a.left-l.width/2+a.width/2:g=h-30-d;break;case"bottom":u>m?x=a.bottom+o:x=a.bottom-o-i-s,g=a.left-l.width/2+a.width/2;break;case"left":x=a.top-l.height/2+a.height/2,a.left-l.width-o>0?g=a.left-l.width-o:g=10;break;case"right":x=a.top-l.height/2+a.height/2,h-c>d?g=a.right+o:g=h-30-d;break;case"top-right":a.top-l.height-o<0?x=a.top-l.height+o+i+s:x=a.top-l.height-o,h-c>d?g=a.right+o:g=h-30-d;break;case"top-left":a.top-l.height-o<0?x=a.top-l.height+o+i+s:x=a.top-l.height-o,a.left-l.width-o>0?g=a.left-l.width-o:g=10;break;case"top-start":a.top-l.height-o<0?x=a.top-l.height+o+i+s:x=a.top-l.height-o,a.left>0?g=a.left:g=10;break;case"bottom-right":u>m?x=a.bottom+o:x=a.bottom-o-i-s,h-c>d?g=a.left:g=h-30-d;break;case"bottom-left":u>m?x=a.bottom+o:x=a.bottom-o-i-s,a.left>0?g=a.right-d:g=10;break;case"bottom-start":u>m?x=a.bottom+o:x=a.bottom-o-i-s,a.left>0?g=a.left:g=10;break}x+i>u?x=u-i-o:x<0&&(x=o),g+d>h?g=h-d-o:g<0&&(g=o),n instanceof HTMLElement&&(n.style.top=`${x}px`,n.style.left=`${g}px`,n.style.position="fixed")},Lm={class:"text-center"},Tm={class:"py-2 px-4 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"},bt=Object.assign({inheritAttrs:!1},{__name:"vs-popover",props:{isOpen:{type:Boolean,default:()=>!1},placement:{type:String,default:"top"},gap:{type:Number,default:8},width:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},trigger:{type:String,default:"click"},teleport:{type:String,default:"body"}},emits:["isvisible"],setup(r,{expose:t,emit:n}){const o=r,l=n,a=e.ref(!1),s=e.ref([]),c=e.ref(null),i=e.ref(null),d=e.ref(null);e.watch(a,k=>{k?(u(),window.addEventListener("resize",()=>Pt(o.placement,i.value,d.value)),Pt(o.placement,i.value,d.value)):window.removeEventListener("resize",()=>Pt(o.placement,i.value,d.value)),l("isvisible",k)}),e.onMounted(()=>{window.addEventListener("click",b),window.addEventListener("popstate",w),window.addEventListener("scroll",_,!0),u()}),e.onBeforeUnmount(()=>{window.removeEventListener("click",b),window.removeEventListener("popstate",w),h()});const u=()=>{let k=c.value;for(;k&&k!==document.body;)(k.scrollHeight>k.clientHeight||k.scrollWidth>k.clientWidth)&&(k.addEventListener("scroll",f),s.value.push(k)),k=k.parentElement;document.body&&(document.body.addEventListener("scroll",f),s.value.push(document.body))},h=()=>{s.value.forEach(k=>{k.removeEventListener("scroll",f)}),s.value=[]},x=()=>{a.value=!0,Pt(o.placement,i.value,d.value)},g=()=>{a.value=!1},m=async()=>{await Pt(o.placement,i.value,d.value),a.value=!a.value},f=()=>{a.value=!1},b=k=>{if(!k){a.value=!1;return}i.value?.contains(k.target)||d.value?.contains(k.target)||(a.value=!1)},w=()=>{a.value&&(a.value=!1)},_=k=>{a.value&&d.value&&!d.value.contains(k.target)&&(a.value=!1)};return t({togglePopover:m}),(k,C)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"popover",ref:c,class:"vs-popover inline-block"},[e.createElementVNode("div",Lm,[r.trigger==="click"?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"popoverRef",ref:i,onClick:m,class:e.normalizeClass({"pointer-events-none":r.disabled})},[e.renderSlot(k.$slots,"reference",{},()=>[C[0]||(C[0]=e.createElementVNode("button",null,"Click me!",-1))])],2)):e.createCommentVNode("",!0),r.trigger==="hover"?(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"popoverRef",ref:i,onMouseover:x,onMouseleave:g,class:e.normalizeClass({"pointer-events-none":r.disabled})},[e.renderSlot(k.$slots,"reference",{},()=>[C[1]||(C[1]=e.createElementVNode("button",null,"Click me!",-1))])],34)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.Teleport,{to:r.teleport},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["vsTailwind vs-popover__content",r.placement]),ref_key:"contentPop",ref:d,style:e.normalizeStyle({width:r.width?r.width+"px":"fit-content",zIndex:100001})},[e.createElementVNode("div",Tm,[e.renderSlot(k.$slots,"default",{},()=>[C[2]||(C[2]=e.createElementVNode("span",null,"Popover content",-1))])])],6),[[e.vShow,a.value]])]),_:3})],8,["to"]))])],512))}}),Im={class:"flex flex-col gap-[2px] p-[2px]"},Rm=["onClick"],Om={__name:"vs-editor-table",props:{editor:Object},setup(r){const{t}=hn(),n=r,o=e.ref(!1),l=e.ref("popover"),a=()=>{n.editor&&(n.editor.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),l.value.togglePopover())},s=()=>{n.editor&&(n.editor.chain().focus().addColumnAfter().run(),l.value.togglePopover())},c=()=>{n.editor&&(n.editor.chain().focus().addRowAfter().run(),l.value.togglePopover())},i=()=>{n.editor&&(n.editor.chain().focus().deleteColumn().run(),l.value.togglePopover())},d=()=>{n.editor&&(n.editor.chain().focus().deleteRow().run(),l.value.togglePopover())},u=()=>{n.editor&&(n.editor.chain().focus().deleteTable().run(),l.value.togglePopover())},h=()=>{n.editor&&(n.editor.chain().focus().mergeCells().run(),l.value.togglePopover())},x=()=>{n.editor&&(n.editor.chain().focus().splitCell().run(),l.value.togglePopover())},g=e.computed(()=>[{text:t("form.richtext.createTable"),function:a},{text:t("form.richtext.addColumn"),function:s},{text:t("form.richtext.addRow"),function:c},{text:t("form.richtext.deleteColumn"),function:i},{text:t("form.richtext.deleteRow"),function:d},{text:t("form.richtext.deleteTable"),function:u},{text:t("form.richtext.mergeCells"),function:h},{text:t("form.richtext.splitCells"),function:x}]);return(m,f)=>(e.openBlock(),e.createBlock(bt,{ref_key:"popover",ref:l,placement:"bottom",onIsvisible:f[0]||(f[0]=b=>o.value=b)},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Table",class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[o.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[e.createVNode(e.unref(j.Table2),{class:"h-4 w-4"})],2)]),default:e.withCtx(()=>[e.createElementVNode("div",Im,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(b,w)=>(e.openBlock(),e.createElementBlock("button",{key:w,onClick:b?.function,class:"px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded"},e.toDisplayString(b.text),9,Rm))),128))])]),_:1},512))}},zm={class:"flex gap-[4px] p-1"},Pm=["title","onClick"],jm={__name:"vs-editor-align",props:{editor:Object},setup(r){const t=r,n={left:j.AlignLeft,center:j.AlignCenter,right:j.AlignRight,justify:j.AlignJustify},o=e.ref(!1),l=e.ref("popover"),a=e.ref("left"),s=e.computed(()=>t.editor?t.editor.isActive("paragraph",{textAlign:"left"})||t.editor.isActive("heading",{textAlign:"left"}):!1),c=e.computed(()=>t.editor?t.editor.isActive("paragraph",{textAlign:"right"})||t.editor.isActive("heading",{textAlign:"right"}):!1),i=e.computed(()=>t.editor?t.editor.isActive("paragraph",{textAlign:"center"})||t.editor.isActive("heading",{textAlign:"center"}):!1),d=e.computed(()=>t.editor?t.editor.isActive("paragraph",{textAlign:"justify"})||t.editor.isActive("heading",{textAlign:"justify"}):!1),u=e.computed(()=>s.value||c.value||i.value||d.value),h=()=>{c.value?a.value="right":i.value?a.value="center":d.value?a.value="justify":a.value="left"};e.watch([s,c,i,d],()=>{h()},{immediate:!0}),e.onMounted(()=>{t.editor&&(t.editor.on("selectionUpdate",h),t.editor.on("update",h))}),e.onUnmounted(()=>{t.editor&&(t.editor.off("selectionUpdate",h),t.editor.off("update",h))});const x=m=>{t.editor&&(t.editor.chain().focus().setTextAlign(m).run(),a.value=m)},g=e.ref([{id:"left",isActive:s},{id:"center",isActive:i},{id:"right",isActive:c},{id:"justify",isActive:d}]);return(m,f)=>(e.openBlock(),e.createBlock(bt,{ref_key:"popover",ref:l,placement:"bottom",onIsvisible:f[0]||(f[0]=b=>o.value=b)},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Text Align",class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[u.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n[a.value]),{height:"16",width:"16"}))],2)]),default:e.withCtx(()=>[e.createElementVNode("div",zm,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,b=>(e.openBlock(),e.createElementBlock("button",{title:"Text align "+b?.id,class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":b?.isActive}]),key:b?.id,onClick:w=>x(b?.id)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n[b?.id]),{height:"16",width:"16"}))],10,Pm))),128))])]),_:1},512))}},Um={class:"flex flex-col gap-[2px] p-[2px]"},Hm=["onClick"],qm={__name:"vs-editor-type-tag",props:{editor:Object},setup(r){const{t}=hn(),n=r,o=e.ref(!1),l=e.ref("popover"),a=()=>{n.editor&&(n.editor?.chain().focus().setParagraph().run(),l.value.togglePopover())},s=i=>{n.editor&&(n.editor?.chain().focus().toggleHeading({level:i}).run(),l.value.togglePopover())},c=e.computed(()=>[{text:t("form.richtext.heading1"),id:1,style:"font-[700] text-[30px]"},{text:t("form.richtext.heading2"),id:2,style:"font-[700] text-[26px]"},{text:t("form.richtext.heading3"),id:3,style:"font-[700] text-[22px]"},{text:t("form.richtext.heading4"),id:4,style:"font-[700] text-[18px]"},{text:t("form.richtext.heading5"),id:5,style:"font-[500] text-[16px]"},{text:t("form.richtext.heading6"),id:6,style:"font-[400] text-[14px]"}]);return(i,d)=>(e.openBlock(),e.createBlock(bt,{ref_key:"popover",ref:l,placement:"bottom",onIsvisible:d[0]||(d[0]=u=>o.value=u)},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Type Tag",class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[o.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[e.createVNode(e.unref(j.Type),{class:"h-4 w-4"})],2)]),default:e.withCtx(()=>[e.createElementVNode("div",Um,[e.createElementVNode("button",{onClick:a,class:e.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded",[r.editor?.isActive("paragraph")?"bg-gray-100":""]])},e.toDisplayString(e.unref(t)("form.richtext.paragraph")),3),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(u,h)=>(e.openBlock(),e.createElementBlock("button",{key:h,onClick:x=>s(u?.id),class:e.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded leading-[100%]",[u?.style,r.editor?.isActive("heading",{level:u?.id})?"bg-gray-100":""]])},e.toDisplayString(e.unref(t)(`form.richtext.heading${u?.id}`)),11,Hm))),128))])]),_:1},512))}},Gm={components:{VsText:bo},inheritAttrs:!1,events:["update:modelValue"],props:{modelValue:{type:String},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},isTextInputShown:{type:Boolean,default:()=>!0}},computed:{value:{get(){return this.modelValue??""},set(r){this.$emit("update:modelValue",r)}}}},Km={class:"flex items-center w-full max-w-[182px]"},Wm=["disabled"];function Ym(r,t,n,o,l,a){const s=e.resolveComponent("vs-text");return e.openBlock(),e.createElementBlock("div",Km,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[0]||(t[0]=c=>a.value=c),type:"color",class:e.normalizeClass(["w-[38px] h-[38px] min-h-[38px] min-w-[38px] py-[2px] px-[3px] -ml-1 dark:bg-neutral-800 border dark:border-neutral-700 border-stone-200 rounded-lg",n.disabled?"cursor-not-allowed":"cursor-pointer"]),disabled:n.disabled},null,10,Wm),[[e.vModelText,a.value]]),n.isTextInputShown?(e.openBlock(),e.createBlock(s,{key:0,modelValue:a.value,"onUpdate:modelValue":t[1]||(t[1]=c=>a.value=c),class:"ml-2 w-full",disabled:n.disabled,clearable:n.clearable},null,8,["modelValue","disabled","clearable"])):e.createCommentVNode("",!0)])}const ko=me(Gm,[["render",Ym]]),Xm={class:"flex gap-[4px] mb-[8px]"},Zm={class:"grid grid-rows-3 grid-cols-7"},Jm={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},Qm=["onClick","title"],eh={__name:"vs-editor-color",props:{editor:Object},setup(r){const t=r,n=e.ref(null),o=e.ref("#000000"),l=e.computed(()=>t.editor&&t.editor.getAttributes("textStyle").color||"#000000"),a=e.computed(()=>l.value!=="#000000"),s=()=>{t.editor&&(o.value=l.value)};e.onMounted(()=>{t.editor&&(t.editor.on("selectionUpdate",s),t.editor.on("update",s),s())}),e.onUnmounted(()=>{t.editor&&(t.editor.off("selectionUpdate",s),t.editor.off("update",s))});const c=e.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),i=h=>{t.editor&&(t.editor.chain().focus().setColor(h).run(),o.value=h,n.value&&n.value.togglePopover())},d=()=>{i(o.value)},u=h=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple","#FFFFFF":"White","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[h]||h;return(h,x)=>(e.openBlock(),e.createBlock(bt,{ref_key:"popover",ref:n,placement:"bottom"},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Text Color",class:e.normalizeClass(["flex flex-col h-[30px] min-w-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":a.value}])},[x[1]||(x[1]=e.createElementVNode("span",{class:"leading-none"},"A",-1)),e.createElementVNode("span",{class:"block h-1 w-5",style:e.normalizeStyle({backgroundColor:o.value})},null,4)],2)]),default:e.withCtx(()=>[e.createElementVNode("div",null,[e.createElementVNode("div",Xm,[e.createVNode(ko,{modelValue:o.value,"onUpdate:modelValue":x[0]||(x[0]=g=>o.value=g)},null,8,["modelValue"]),e.createElementVNode("button",{onClick:d,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[e.createVNode(e.unref(j.Check),{class:"h-4 w-4 text-white"})])]),e.createElementVNode("div",Zm,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[e.createElementVNode("div",Jm,[e.createElementVNode("button",{class:"flex items-center justify-center w-full h-full",style:e.normalizeStyle({backgroundColor:g}),onClick:m=>i(g),title:u(g)},[o.value===g?(e.openBlock(),e.createBlock(e.unref(j.Check),{key:0,class:"h-4 w-4 text-gray-500"})):e.createCommentVNode("",!0)],12,Qm)])]))),128))])])]),_:1},512))}},th={class:"flex gap-[4px] mb-[8px]"},nh={class:"grid grid-rows-3 grid-cols-7"},rh={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},oh=["onClick","title"],lh=["onClick","title"],ah={__name:"vs-editor-background-color",props:{editor:Object},setup(r){const t=r,n=e.ref(null),o=e.ref("transparent"),l=e.computed(()=>t.editor&&t.editor.getAttributes("textStyle").backgroundColor||"transparent"),a=e.computed(()=>l.value!=="transparent"&&l.value!==""),s=()=>{t.editor&&(o.value=l.value)};e.onMounted(()=>{t.editor&&(t.editor.on("selectionUpdate",s),t.editor.on("update",s),s())}),e.onUnmounted(()=>{t.editor&&(t.editor.off("selectionUpdate",s),t.editor.off("update",s))});const c=e.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),i=h=>{t.editor&&(t.editor.chain().focus().setBackgroundColor(h).run(),o.value=h,n.value&&n.value.togglePopover())},d=()=>{i(o.value)},u=h=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple",transparent:"Transparent","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[h]||h;return(h,x)=>(e.openBlock(),e.createBlock(bt,{ref_key:"popover",ref:n,placement:"bottom"},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Background Color",class:e.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":a.value}])},[e.createVNode(e.unref(j.PaintBucket),{class:"h-4 w-4"}),e.createElementVNode("span",{class:"block h-1 w-5",style:e.normalizeStyle({backgroundColor:o.value})},null,4)],2)]),default:e.withCtx(()=>[e.createElementVNode("div",null,[e.createElementVNode("div",th,[e.createVNode(ko,{modelValue:o.value,"onUpdate:modelValue":x[0]||(x[0]=g=>o.value=g)},null,8,["modelValue"]),e.createElementVNode("button",{onClick:d,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[e.createVNode(e.unref(j.Check),{class:"h-4 w-4 text-white"})])]),e.createElementVNode("div",nh,[e.createElementVNode("button",{onClick:x[1]||(x[1]=g=>i("transparent")),class:"col-span-7 flex items-center justify-center gap-2 bg-gray-100 rounded-md py-1 mb-2 hover:bg-gray-200"},[e.createVNode(e.unref(j.Eraser),{class:"h-4 w-4"}),x[2]||(x[2]=e.createElementVNode("p",null,"no color",-1))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[e.createElementVNode("div",rh,[g!=="transparent"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"flex items-center justify-center w-full h-full",style:e.normalizeStyle({backgroundColor:g}),onClick:m=>i(g),title:u(g)},[o.value===g?(e.openBlock(),e.createBlock(e.unref(j.Check),{key:0,class:"h-4 w-4 text-gray-500"})):e.createCommentVNode("",!0)],12,oh)):e.createCommentVNode("",!0),g==="transparent"?(e.openBlock(),e.createElementBlock("button",{key:1,class:"flex items-center justify-center w-full h-full",onClick:m=>i(g),title:u(g)},[o.value===g?(e.openBlock(),e.createBlock(e.unref(j.Check),{key:0,class:"h-4 w-4 text-gray-500"})):e.createCommentVNode("",!0)],8,lh)):e.createCommentVNode("",!0)])]))),128))])])]),_:1},512))}},sh={__name:"vs-editor-highlight",props:{editor:Object},setup(r){const t=r,n=e.computed(()=>t.editor?.isActive("highlight")),o=()=>{t.editor&&t.editor.chain().focus().toggleHighlight().run()};return(l,a)=>(e.openBlock(),e.createElementBlock("button",{title:"Highlight",onClick:o,class:e.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-200":n.value}])},[e.createVNode(e.unref(j.Highlighter),{class:"h-4 w-4"})],2))}},ih={class:"truncate"},ch={class:"w-[200px]"},dh={class:"max-h-[200px] overflow-y-auto"},uh=["onClick"],ph={__name:"vs-editor-font-family",props:{editor:Object},setup(r){const t=r,n=e.ref("popover"),o=e.ref(!1),l=e.ref([{label:"Arial",value:"Arial, sans-serif"},{label:"Helvetica",value:"Helvetica, sans-serif"},{label:"Times New Roman",value:"Times New Roman, serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Verdana",value:"Verdana, sans-serif"},{label:"Courier New",value:"Courier New, monospace"},{label:"Comic Sans MS",value:"Comic Sans MS, cursive"},{label:"Impact",value:"Impact, sans-serif"},{label:"Trebuchet MS",value:"Trebuchet MS, sans-serif"},{label:"Palatino",value:"Palatino, serif"}]),a=e.computed(()=>{if(!t.editor)return"Arial, sans-serif";for(const d of l.value)if(t.editor.isActive("textStyle",{fontFamily:d.value}))return d.value;return"Arial, sans-serif"}),s=e.computed(()=>l.value.find(u=>u.value===a.value)?.label||"Arial"),c=d=>t.editor?t.editor.isActive("textStyle",{fontFamily:d}):!1,i=d=>{t.editor&&(t.editor.chain().focus().setFontFamily(d).run(),n.value&&n.value.togglePopover())};return(d,u)=>(e.openBlock(),e.createBlock(bt,{ref_key:"popover",ref:n,placement:"bottom",onIsvisible:u[0]||(u[0]=h=>o.value=h)},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Font Family",class:e.normalizeClass(["h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm",[o.value?"bg-gray-100 text-gray-900":"text-gray-700"]]),style:e.normalizeStyle({fontFamily:a.value})},[e.createElementVNode("span",ih,e.toDisplayString(s.value),1),e.createVNode(e.unref(j.ChevronDown),{class:"ml-1 h-3 w-3 text-gray-400"})],6)]),default:e.withCtx(()=>[e.createElementVNode("div",ch,[e.createElementVNode("ul",dh,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,h=>(e.openBlock(),e.createElementBlock("li",{key:h.value,class:e.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",{"bg-gray-100":c(h.value)}]),style:e.normalizeStyle({fontFamily:h.value}),onClick:x=>i(h.value)},e.toDisplayString(h.label),15,uh))),128))])])]),_:1},512))}},fh={class:"w-[120px]"},mh={class:"max-h-[200px] overflow-y-auto"},hh=["onClick"],gh={__name:"vs-editor-font-size",props:{editor:Object},setup(r){const t=r,n=e.ref("popover"),o=e.ref("14px"),l=e.computed(()=>t.editor&&t.editor.getAttributes("textStyle").fontSize||"14px"),a=e.computed(()=>l.value!=="14px"),s=()=>{t.editor&&(o.value=l.value)};e.onMounted(()=>{t.editor&&(t.editor.on("selectionUpdate",s),t.editor.on("update",s),s())}),e.onUnmounted(()=>{t.editor&&(t.editor.off("selectionUpdate",s),t.editor.off("update",s))});const c=e.ref([{label:"8px",value:"8px"},{label:"9px",value:"9px"},{label:"10px",value:"10px"},{label:"11px",value:"11px"},{label:"12px",value:"12px"},{label:"14px",value:"14px"},{label:"16px",value:"16px"},{label:"18px",value:"18px"},{label:"20px",value:"20px"},{label:"24px",value:"24px"},{label:"28px",value:"28px"},{label:"32px",value:"32px"},{label:"36px",value:"36px"},{label:"48px",value:"48px"},{label:"72px",value:"72px"}]),i=d=>{t.editor&&(t.editor.chain().focus().setFontSize(d).run(),o.value=d,n.value&&n.value.togglePopover())};return(d,u)=>(e.openBlock(),e.createBlock(bt,{ref_key:"popover",ref:n,placement:"bottom"},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Font Size",class:e.normalizeClass(["h-[30px] px-2 min-w-[30px] rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700 space-x-1",{"bg-gray-100 text-gray-900":a.value}])},[e.createVNode(e.unref(j.ALargeSmall),{class:"h-4 w-4"}),e.createVNode(e.unref(j.ChevronDown),{class:"h-3 w-3 text-gray-400"})],2)]),default:e.withCtx(()=>[e.createElementVNode("div",fh,[e.createElementVNode("ul",mh,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,h=>(e.openBlock(),e.createElementBlock("li",{key:h.value,class:"px-3 py-2 hover:bg-gray-100 cursor-pointer",onClick:x=>i(h.value)},e.toDisplayString(h.label),9,hh))),128))])])]),_:1},512))}},yh={components:{Superscript:j.Superscript},props:{editor:Object},methods:{toggleSuperscript(){this.editor&&this.editor.commands.toggleSuperscript()}}};function bh(r,t,n,o,l,a){const s=e.resolveComponent("Superscript");return e.openBlock(),e.createElementBlock("button",{title:"Superscript",onClick:t[0]||(t[0]=(...c)=>a.toggleSuperscript&&a.toggleSuperscript(...c)),class:e.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("superscript")}])},[e.createVNode(s,{class:"h-4 w-4"}),t[1]||(t[1]=e.createElementVNode("span",{class:"sr-only"},"Superscript",-1))],2)}const kh=me(yh,[["render",bh]]),xh={components:{Subscript:j.Subscript},props:{editor:Object},methods:{toggleSubscript(){this.editor&&this.editor.commands.toggleSubscript()}}};function wh(r,t,n,o,l,a){const s=e.resolveComponent("Subscript");return e.openBlock(),e.createElementBlock("button",{title:"Subscript",onClick:t[0]||(t[0]=(...c)=>a.toggleSubscript&&a.toggleSubscript(...c)),class:e.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("subscript")}])},[e.createVNode(s,{class:"h-4 w-4"}),t[1]||(t[1]=e.createElementVNode("span",{class:"sr-only"},"Subscript",-1))],2)}const _h=me(xh,[["render",wh]]),vh={title:"Heading",class:"h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700"},Ch={class:"truncate"},Eh={class:"max-h-[200px] overflow-y-auto"},Bh=["onClick"],Vh=me({__name:"vs-editor-heading",props:{editor:Object},setup(r){const t=r,n=e.ref("popover"),o=e.ref([{label:"Heading 1",value:1},{label:"Heading 2",value:2},{label:"Heading 3",value:3},{label:"Heading 4",value:4},{label:"Heading 5",value:5},{label:"Heading 6",value:6}]),l=e.computed(()=>{if(!t.editor)return"Paragraph";for(let i=1;i<=6;i++)if(t.editor.isActive("heading",{level:i}))return`H ${i}`;return"P"}),a=i=>({1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"})[i]||"",s=i=>{t.editor&&(t.editor.chain().focus().setHeading({level:i}).run(),n.value&&n.value.togglePopover())},c=()=>{t.editor&&(t.editor.chain().focus().setParagraph().run(),n.value&&n.value.togglePopover())};return(i,d)=>(e.openBlock(),e.createBlock(bt,{ref_key:"popover",ref:n,placement:"bottom"},{reference:e.withCtx(()=>[e.createElementVNode("button",vh,[e.createElementVNode("span",Ch,e.toDisplayString(l.value),1),e.createVNode(e.unref(j.ChevronDown),{class:"ml-1 h-3 w-3 text-gray-400"})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,[e.createElementVNode("ul",Eh,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,u=>(e.openBlock(),e.createElementBlock("li",{key:u.value,class:e.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",`heading-level-${u.value}`]),style:e.normalizeStyle(a(u.value)),onClick:h=>s(u.value)},e.toDisplayString(u.label),15,Bh))),128)),e.createElementVNode("li",{class:"px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm border-t border-gray-200 mt-1 pt-2",onClick:c}," Paragraph ")])])]),_:1},512))}},[["__scopeId","data-v-96f02f2a"]]),Sh={components:{RemoveFormatting:j.RemoveFormatting},props:{editor:Object},methods:{clearFormatting(){this.editor&&this.editor.commands.unsetAllMarks()}}};function $h(r,t,n,o,l,a){const s=e.resolveComponent("RemoveFormatting");return e.openBlock(),e.createElementBlock("button",{title:"Clear Formatting",onClick:t[0]||(t[0]=(...c)=>a.clearFormatting&&a.clearFormatting(...c)),class:"h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100"},[e.createVNode(s,{class:"h-4 w-4"}),t[1]||(t[1]=e.createElementVNode("span",{class:"sr-only"},"Clear Formatting",-1))])}const Nh=me(Sh,[["render",$h]]),Ah={class:"relative"},Fh={key:0,class:"mt-4"},Mh=["src","alt","title"],Dh={key:0,class:"text-sm text-red-500"},Lh={key:1,class:"mt-4"},Th={class:"text-sm text-gray-600 mb-2"},Ih={class:"flex flex-wrap gap-2"},Rh=["src","alt","onError"],Oh=["onClick"],zh={class:"flex justify-end gap-x-2 p-[20px]"},Ph=Object.assign({inheritAttrs:!1},{__name:"vs-editor-image",props:{editor:{type:Object,required:!0}},setup(r){const t=r,n=e.ref(!1),o=e.ref(!1),l=e.ref({}),a=e.ref(!1),s=e.ref([]),c=e.ref(null),i=e.ref({src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1}),d=e.computed(()=>{if(Array.isArray(i.value.file)){const B=i.value.file.filter(L=>L instanceof File),$=i.value.file.filter(L=>typeof L=="string"&&L.trim()!=="");return B.length+$.length>1}return i.value.file instanceof FileList?i.value.file.length>1:!1}),u=e.computed(()=>Array.isArray(i.value.file)?i.value.file.filter(B=>B instanceof File).length===1:i.value.file instanceof FileList?i.value.file.length===1:i.value.file instanceof File),h=e.computed(()=>{if(d.value)return"";if(i.value.src)return i.value.src;if(u.value){let B=null;if(Array.isArray(i.value.file)||i.value.file instanceof FileList?B=i.value.file[0]:i.value.file instanceof File&&(B=i.value.file),B instanceof File){const $=s.value.find(S=>S.file===B);return $?$.preview:""}else if(typeof B=="string")return B}return""}),x=e.computed(()=>[{name:"src",label:"URL зображення",type:"text",required:!1,placeholder:"https://example.com/image.png"},{name:"file",label:"Файл (можна вибрати кілька)",type:"file",multiple:!0,required:!1,placeholder:"Шлях до файлу зображення",accept:"image/*"},{name:"width",label:"Ширина",type:"number",required:!1,placeholder:"Ширина зображення",clearable:!0,min:0},{name:"height",label:"Висота",type:"number",required:!1,placeholder:"Висота зображення",clearable:!0,min:0},{name:"alt",label:"Альтернативний текст",type:"text",required:!1,placeholder:"Опис зображення"},{name:"title",label:"Заголовок (необов'язково)",type:"text",required:!1,placeholder:"Заголовок зображення"},{name:"link",label:"Посилання",type:"text",required:!1,placeholder:"https://example.com"},{name:"openInNewTab",label:"Відкривати у новій вкладці?",type:"switcher",required:!1}]),g=()=>{if(!t.editor)return;if(t.editor.isActive("image")){const{state:$}=t.editor,{selection:S}=$,{$from:L}=S;let F=null,P=null;if(L.parent.type.name==="image")F=L.before(L.depth),P=L.parent;else for(let ne=L.depth;ne>0;ne--){const we=L.node(ne),ge=L.before(ne);we.type.name==="paragraph"&&we.forEach((J,re)=>{if(J.type.name==="image"){const de=ge+re+1;(F===null||Math.abs(de-S.$from.pos)<Math.abs(F-S.$from.pos))&&(F=de,P=J)}})}if(F!==null&&P){try{t.editor.chain().focus().setNodeSelection(F).run()}catch{t.editor.chain().focus().setTextSelection(F).run()}c.value=F}else{t.editor.chain().focus().selectParentNode().run();const{state:ne}=t.editor;c.value=ne.selection.$from.pos}const M=P?P.attrs:t.editor.getAttributes("image");a.value=!0;let O="",T=!1;const G=t.editor.getAttributes("link");G&&G.href&&(O=G.href,T=G.target==="_blank");const W=M.src||"",X=W?[W]:[];i.value={src:W,file:X,alt:M.alt||"",title:M.title||"",width:M.width||"",height:M.height||"",link:O,openInNewTab:T}}else a.value=!1,i.value={src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1};o.value=!1,n.value=!0},m=()=>{n.value=!1,o.value=!1,a.value=!1,s.value=[],c.value=null,i.value={src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1}},f=async B=>{if(!B||B.length===0)return;const $=[];for(const S of B)if(S&&S.type&&S.type.startsWith("image/")&&!s.value.some(F=>F.file===S)){const F=new Promise((P,M)=>{const O=new FileReader;O.onload=T=>{s.value.push({file:S,preview:T.target.result,error:!1}),P()},O.onerror=M,O.readAsDataURL(S)});$.push(F)}await Promise.all($)},b=B=>{s.value.splice(B,1),Array.isArray(i.value.file)&&i.value.file.splice(B,1)},w=()=>{const B=i.value.width!==null&&i.value.width!==void 0&&i.value.width!==""&&String(i.value.width).trim()!==""?String(i.value.width).trim():"",$=i.value.height!==null&&i.value.height!==void 0&&i.value.height!==""&&String(i.value.height).trim()!==""?String(i.value.height).trim():"",S={};return B&&$?(S.width=B,S.height=$,S.style=`width: ${B}px; height: ${$}px; object-fit: fill;`):B?(S.width=B,S.height=void 0):$?(S.height=$,S.width=void 0):(S.width=void 0,S.height=void 0),S},_=(B,$=null,S=50)=>{const L=()=>{const{view:M}=B;if(!M||!M.dom)return;M.dom.querySelectorAll("img.editor-image[width][height]").forEach(G=>{if(G instanceof HTMLImageElement){const W=G.getAttribute("width"),X=G.getAttribute("height");W&&X&&W!=="auto"&&X!=="auto"&&W!==""&&X!==""&&!isNaN(Number(W))&&!isNaN(Number(X))&&(G.style.cssText=`
|
|
35
|
+
`)},Zn=async(r,t)=>t!=="md"?r||"":po(r||""),Pf=async(r,t)=>t!=="md"?zf(r||""):ho(r||""),jf=async(r,t)=>t!=="md"?r||"":ho(r||""),Uf=r=>String(r).trim().toLowerCase().split("-")[0],Hf=()=>typeof window>"u"?"uk":Uf(localStorage.getItem("language")||localStorage.getItem("locale")||navigator.language||"uk"),qf=(r,t)=>{const n=t.replace(/^form\.richtext\./,"");return zn?.[r]?.form?.richtext?.[n]||zn?.uk?.form?.richtext?.[n]||t},go=r=>r.startsWith("form.richtext.")?r:`form.richtext.${r}`;function hn(){const t=e.getCurrentInstance()?.appContext?.config?.globalProperties,n=t?.$i18n;return{t:l=>{const a=t?.$t,s=t?.$te,c=typeof n?.te=="function"?n.te.bind(n):null;if(typeof a=="function"){const i=go(l);if((typeof s=="function"?s(i):typeof c=="function"?c(i):null)!==!1){const u=a(i);if(u&&u!==i)return u}}return qf(Hf(),go(l))}}}const Gf={components:{Quote:j.Quote},props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function Kf(r,t,n,o,l,a){const s=e.resolveComponent("Quote");return e.openBlock(),e.createElementBlock("button",{title:"Blockquote",onClick:t[0]||(t[0]=(...c)=>a.toggleBlockquote&&a.toggleBlockquote(...c)),class:e.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":n.editor?.isActive("blockquote")}])},[e.createVNode(s,{class:"h-4 w-4"})],2)}const Wf=me(Gf,[["render",Kf]]),Yf={components:{List:j.List},props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function Xf(r,t,n,o,l,a){const s=e.resolveComponent("List");return e.openBlock(),e.createElementBlock("button",{title:"Bullet List",onClick:t[0]||(t[0]=(...c)=>a.toggleBulletList&&a.toggleBulletList(...c)),class:e.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("bulletList")}])},[e.createVNode(s,{class:"h-4 w-4"})],2)}const Zf=me(Yf,[["render",Xf]]),Jf={components:{ListOrdered:j.ListOrdered},props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function Qf(r,t,n,o,l,a){const s=e.resolveComponent("ListOrdered");return e.openBlock(),e.createElementBlock("button",{title:"Ordered List",onClick:t[0]||(t[0]=(...c)=>a.toggleOrderedList&&a.toggleOrderedList(...c)),class:e.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("orderedList")}])},[e.createVNode(s,{class:"h-4 w-4"})],2)}const em=me(Jf,[["render",Qf]]),tm={components:{CodeXml:j.CodeXml},props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function nm(r,t,n,o,l,a){const s=e.resolveComponent("CodeXml");return e.openBlock(),e.createElementBlock("button",{title:"Code Block",onClick:t[0]||(t[0]=(...c)=>a.toggleCodeBlock&&a.toggleCodeBlock(...c)),class:e.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("codeBlock")}])},[e.createVNode(s,{class:"h-4 w-4"})],2)}const rm=me(tm,[["render",nm]]),om={components:{Bold:j.Bold},props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.commands.toggleBold()}}};function lm(r,t,n,o,l,a){const s=e.resolveComponent("Bold");return e.openBlock(),e.createElementBlock("button",{title:"Bold Text",onClick:t[0]||(t[0]=(...c)=>a.toggleBold&&a.toggleBold(...c)),class:e.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("bold")}])},[e.createVNode(s,{class:"h-4 w-4"}),t[1]||(t[1]=e.createElementVNode("span",{class:"sr-only"},"Bold",-1))],2)}const am=me(om,[["render",lm]]),sm={components:{Italic:j.Italic},props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function im(r,t,n,o,l,a){const s=e.resolveComponent("Italic");return e.openBlock(),e.createElementBlock("button",{title:"Italic Text",onClick:t[0]||(t[0]=(...c)=>a.toggleItalic&&a.toggleItalic(...c)),class:e.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("italic")}])},[e.createVNode(s,{class:"h-4 w-4"}),t[1]||(t[1]=e.createElementVNode("span",{class:"sr-only"},"Italic",-1))],2)}const cm=me(sm,[["render",im]]),dm={__name:"vs-editor-underline",props:{editor:Object},setup(r){const t=r,n=()=>{t.editor&&t.editor.chain().focus().toggleUnderline().run()};return(o,l)=>(e.openBlock(),e.createElementBlock("button",{title:"Underline",onClick:n,class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[r.editor?.isActive("underline")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[e.createVNode(e.unref(j.Underline),{class:"h-4 w-4"})],2))}},um={__name:"vs-editor-strike",props:{editor:Object},setup(r){const t=r,n=()=>{t.editor&&t.editor.chain().focus().toggleStrike().run()};return(o,l)=>(e.openBlock(),e.createElementBlock("button",{title:"Strikethrough",onClick:n,class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[r.editor?.isActive("strike")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[e.createVNode(e.unref(j.Strikethrough),{class:"h-4 w-4"})],2))}},pm={components:{X:j.X},props:{visible:{type:Boolean,default:()=>!1},modelValue:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""},closeClickBack:{type:Boolean,default:()=>!1}},emits:["update:visible","update:modelValue","onClose","confirm","cancel"],inheritAttrs:!1,name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){return!!this.$slots?.footer},checkSize(){return this.size==="small"?"md:w-5/12 w-9/12":this.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:r}){r==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("update:modelValue",!1),this.$emit("onClose")},handleConfirm(){this.$emit("confirm"),this.handleClose()},handleCancel(){this.$emit("cancel"),this.handleClose()},closeByClickBack(r,t){t&&r.target.classList.contains("vs-dialog-overlay")&&this.handleClose()}}},fm={key:0,class:"vsTailwind ui-dialog__wrapper"},mm={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},hm={class:"font-medium text-gray-800 dark:text-[#ffffff]"},gm={class:"ui-dialog__content p-4"},ym={key:0,class:"flex justify-end gap-x-2"};function bm(r,t,n,o,l,a){const s=e.resolveComponent("X");return e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.visible||n.modelValue?(e.openBlock(),e.createElementBlock("div",fm,[e.createElementVNode("div",{onMousedown:t[1]||(t[1]=c=>a.closeByClickBack(c,n.closeClickBack)),class:"vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[100001] bg-black bg-opacity-50"},[e.createVNode(e.Transition,{name:"content",appear:""},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["ui-dialog__modal 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",[a.checkSize]])},[e.createElementVNode("div",mm,[e.createElementVNode("h3",hm,e.toDisplayString(n.title),1),e.createElementVNode("button",{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",onClick:t[0]||(t[0]=(...c)=>a.handleClose&&a.handleClose(...c))},[t[2]||(t[2]=e.createElementVNode("span",{class:"sr-only"},"Close",-1)),e.createVNode(s,{class:"h-4 w-4 flex-shrink-0"})])]),e.createElementVNode("div",gm,[e.renderSlot(r.$slots,"default",{},void 0,!0)]),a.hasSlot?(e.openBlock(),e.createElementBlock("div",ym,[e.renderSlot(r.$slots,"footer",{handleClose:a.handleClose,handleConfirm:a.handleConfirm,handleCancel:a.handleCancel},void 0,!0)])):e.createCommentVNode("",!0)],2)]),_:3})],32)])):e.createCommentVNode("",!0)])}const yo=me(pm,[["render",bm],["__scopeId","data-v-56ad9010"]]),km=e.defineComponent({components:{IconClose:j.X,IconSearch:j.Search,IconEmail:j.Mail},inheritAttrs:!1,props:{icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"right"},type:{type:String,default:()=>"text"},style:{type:Object,default:()=>null},size:{type:String,default:()=>"md"},attrs:{type:Object,default:()=>{}}},emits:["onInput","update:modelValue","blur","focus"],computed:{checkSize(){return(this.style?.size||this.size)==="xs"?"h-[32px] text-sm":(this.style?.size||this.size)==="md"?"h-[38px] text-sm":(this.style?.size||this.size)==="lg"?"h-[46px] text-[20px]":"h-[38px] text-sm"},value:{get(){return this.modelValue},set(r){this.$emit("update:modelValue",r.trim())}},clearIconStyle(){return[{"right-8":this.icon&&this.iconPosition==="right","right-3":!this.icon||this.iconPosition!=="right","pointer-events-none":this.disabled}]},iconStylePosition(){return[{"left-3":this.icon&&this.iconPosition==="left","right-3":this.icon&&this.iconPosition==="right"}]},inputStyle(){return[{"!pr-8":this.clearable&&!this.icon,"!pr-7":this.clearable,"!pr-16":this.clearable&&this.icon&&this.iconPosition==="right","!pl-8":this.icon&&this.iconPosition==="left","!pr-[50px]":this.clearable&&this.value&&this.icon&&this.iconPosition==="right","!cursor-not-allowed bg-slate-100":this.disabled,"bg-white":!this.disabled}]}},methods:{handleInput(){this.$emit("onInput",this.modelValue)},handleBlur(){this.$emit("blur")},handleFocus(){this.$emit("focus")},clearInput(){this.$emit("update:modelValue",""),this.$emit("onInput","")},async inputFocus(){await this.$refs.vsText?.focus()}}}),xm={class:"vs-form-text relative bg-white rounded-lg"},wm={key:2,class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},_m=["disabled","type","placeholder"];function vm(r,t,n,o,l,a){const s=e.resolveComponent("IconClose"),c=e.resolveComponent("IconSearch"),i=e.resolveComponent("IconEmail");return e.openBlock(),e.createElementBlock("div",xm,[r.clearable&&r.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:t[0]||(t[0]=(...d)=>r.clearInput&&r.clearInput(...d))},[e.createVNode(s,{class:"h-4 w-4 stroke-gray-500 transition-all hover:stroke-red-500"})])):e.createCommentVNode("",!0),r.icon&&r.icon==="search"?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["absolute bottom-2/4 translate-y-2/4 cursor-pointer",r.iconStylePosition])},[e.createVNode(c,{class:"h-4 w-4 stroke-gray-500 transition-all"})],2)):r.icon&&r.icon==="email"?(e.openBlock(),e.createElementBlock("div",wm,[e.createVNode(i,{class:"h-4 w-4 stroke-gray-500 transition-all"})])):(e.openBlock(),e.createElementBlock("i",{key:3,class:e.normalizeClass(["absolute bottom-2/4 translate-y-2/4 text-gray-500 cursor-pointer",["ti "+r.icon,r.iconStylePosition]])},null,2)),r.clearable&&r.value?(e.openBlock(),e.createElementBlock("div",{key:4,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:t[1]||(t[1]=(...d)=>r.clearInput&&r.clearInput(...d))},[e.createVNode(s,{class:"h-4 w-4 stroke-gray-500 transition-all hover:stroke-red-500"})])):e.createCommentVNode("",!0),e.withDirectives(e.createElementVNode("input",e.mergeProps({ref:"vsText",disabled:r.disabled,type:r.type,onInput:t[2]||(t[2]=(...d)=>r.handleInput&&r.handleInput(...d)),placeholder:r.placeholder,"onUpdate:modelValue":t[3]||(t[3]=d=>r.value=d)},r.style?.attrs||r.attrs||{},{onFocus:t[4]||(t[4]=(...d)=>r.handleFocus&&r.handleFocus(...d)),onBlur:t[5]||(t[5]=(...d)=>r.handleBlur&&r.handleBlur(...d)),class:[[r.inputStyle,r.checkSize],"py-2 px-3 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-sm 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,16,_m),[[e.vModelDynamic,r.value]])])}const bo=me(km,[["render",vm],["__scopeId","data-v-eb21a54f"]]),Cm=["title"],Em={class:"flex flex-col gap-3 p-[20px]"},Bm={class:"relative flex items-center gap-2"},Vm={class:"flex-1"},Sm={key:0,class:"flex items-center gap-2 flex-shrink-0"},$m=["title"],Nm=["title"],Am={class:"flex items-center gap-2"},Fm={for:"openInNewTab",class:"text-sm text-gray-700 cursor-pointer"},Mm={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},Dm=Object.assign({inheritAttrs:!1},{__name:"vs-editor-link",props:{editor:Object},setup(r){const{t}=hn(),n=r,o=e.ref(!1),l=e.ref(""),a=e.ref(!1),s=e.ref(!1),c=()=>{if(!n.editor)return;n.editor.chain().focus().extendMarkRange("link").run();const x=n.editor.getAttributes("link");x.href?(a.value=!0,l.value=x.href,s.value=x.target==="_blank"):(a.value=!1,l.value="",s.value=!1),o.value=!0},i=()=>{o.value=!1,l.value="",a.value=!1,s.value=!1},d=()=>{if(!n.editor||!l.value.trim())return;let x=l.value.trim();x.match(/^https?:\/\//i)||(x="https://"+x),n.editor.chain().focus().setLink({href:x,target:s.value?"_blank":null}).run(),i()},u=()=>{n.editor&&(n.editor.chain().focus().unsetLink().run(),i())},h=()=>{if(!l.value)return;let x=l.value.trim();x.match(/^https?:\/\//i)||(x="https://"+x),window.open(x,"_blank","noopener,noreferrer")};return(x,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("button",{title:e.unref(t)("form.richtext.link")||"Посилання",onClick:c,class:e.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":r.editor?.isActive("link")}])},[e.createVNode(e.unref(j.Link2),{class:"h-4 w-4"})],10,Cm),e.createVNode(yo,{title:a.value?e.unref(t)("form.richtext.editLink")||"Редагувати посилання":e.unref(t)("form.richtext.linkTitle")||"Додати посилання",visible:o.value,"onUpdate:visible":g[2]||(g[2]=m=>o.value=m),size:"small"},{footer:e.withCtx(()=>[e.createElementVNode("div",Mm,[e.createElementVNode("button",{style:{border:"1px solid #000"},onClick:i,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"},e.toDisplayString(e.unref(t)("form.richtext.cancel")||"Скасувати"),1),e.createElementVNode("button",{onClick:d,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"},e.toDisplayString(a.value?e.unref(t)("form.richtext.update")||"Оновити":e.unref(t)("form.richtext.create")||"Створити"),1)])]),default:e.withCtx(()=>[e.createElementVNode("div",Em,[e.createElementVNode("div",Bm,[e.createElementVNode("div",Vm,[e.createVNode(bo,{modelValue:l.value,"onUpdate:modelValue":g[0]||(g[0]=m=>l.value=m),placeholder:e.unref(t)("form.richtext.linkUrl")||"Введіть URL",class:"w-full"},null,8,["modelValue","placeholder"])]),a.value?(e.openBlock(),e.createElementBlock("div",Sm,[e.createElementVNode("button",{onClick:h,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none transition-colors",title:e.unref(t)("form.richtext.openLink")||"Відкрити посилання"},[e.createVNode(e.unref(j.ExternalLink),{class:"h-4 w-4"})],8,$m),e.createElementVNode("button",{onClick:u,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-red-600 hover:bg-red-50 focus:outline-none transition-colors",title:e.unref(t)("form.richtext.removeLink")||"Видалити посилання"},[e.createVNode(e.unref(j.Trash2),{class:"h-4 w-4"})],8,Nm)])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Am,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",id:"openInNewTab","onUpdate:modelValue":g[1]||(g[1]=m=>s.value=m),class:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500"},null,512),[[e.vModelCheckbox,s.value]]),e.createElementVNode("label",Fm,e.toDisplayString(e.unref(t)("form.richtext.openInNewTab")||"Відкривати в новій вкладці"),1)])])]),_:1},8,["title","visible"])],64))}}),jt=async(r,t,n,o=10)=>{if(!t||!n)return;await e.nextTick();const l=await n?.getBoundingClientRect(),a=await t?.getBoundingClientRect();if(!a||!l)return;const s=await parseInt(t?.getBoundingClientRect()?.height),c=await parseInt(t?.getBoundingClientRect()?.width),i=await parseInt(n?.getBoundingClientRect()?.height),d=await parseInt(n?.getBoundingClientRect()?.width),u=await window.innerHeight,h=await window.innerWidth;let x=0,g=0;const m=a.bottom+o+i;switch(r){case"top":a.top-l.height-o<0?x=a.top-l.height+o+i+s:x=a.top-l.height-o,h>d+a.right+30?g=a.left-l.width/2+a.width/2:g=h-30-d;break;case"bottom":u>m?x=a.bottom+o:x=a.bottom-o-i-s,g=a.left-l.width/2+a.width/2;break;case"left":x=a.top-l.height/2+a.height/2,a.left-l.width-o>0?g=a.left-l.width-o:g=10;break;case"right":x=a.top-l.height/2+a.height/2,h-c>d?g=a.right+o:g=h-30-d;break;case"top-right":a.top-l.height-o<0?x=a.top-l.height+o+i+s:x=a.top-l.height-o,h-c>d?g=a.right+o:g=h-30-d;break;case"top-left":a.top-l.height-o<0?x=a.top-l.height+o+i+s:x=a.top-l.height-o,a.left-l.width-o>0?g=a.left-l.width-o:g=10;break;case"top-start":a.top-l.height-o<0?x=a.top-l.height+o+i+s:x=a.top-l.height-o,a.left>0?g=a.left:g=10;break;case"bottom-right":u>m?x=a.bottom+o:x=a.bottom-o-i-s,h-c>d?g=a.left:g=h-30-d;break;case"bottom-left":u>m?x=a.bottom+o:x=a.bottom-o-i-s,a.left>0?g=a.right-d:g=10;break;case"bottom-start":u>m?x=a.bottom+o:x=a.bottom-o-i-s,a.left>0?g=a.left:g=10;break}x+i>u?x=u-i-o:x<0&&(x=o),g+d>h?g=h-d-o:g<0&&(g=o),n instanceof HTMLElement&&(n.style.top=`${x}px`,n.style.left=`${g}px`,n.style.position="fixed")},Lm={class:"text-center"},Tm={class:"py-2 px-4 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"},bt=Object.assign({inheritAttrs:!1},{__name:"vs-popover",props:{isOpen:{type:Boolean,default:()=>!1},placement:{type:String,default:"top"},gap:{type:Number,default:8},width:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},trigger:{type:String,default:"click"},teleport:{type:String,default:"body"}},emits:["isvisible"],setup(r,{expose:t,emit:n}){const o=r,l=n,a=e.ref(!1),s=e.ref([]),c=e.ref(null),i=e.ref(null),d=e.ref(null);e.watch(a,k=>{k?(u(),window.addEventListener("resize",()=>jt(o.placement,i.value,d.value)),jt(o.placement,i.value,d.value)):window.removeEventListener("resize",()=>jt(o.placement,i.value,d.value)),l("isvisible",k)}),e.onMounted(()=>{window.addEventListener("click",b),window.addEventListener("popstate",w),window.addEventListener("scroll",_,!0),u()}),e.onBeforeUnmount(()=>{window.removeEventListener("click",b),window.removeEventListener("popstate",w),h()});const u=()=>{let k=c.value;for(;k&&k!==document.body;)(k.scrollHeight>k.clientHeight||k.scrollWidth>k.clientWidth)&&(k.addEventListener("scroll",f),s.value.push(k)),k=k.parentElement;document.body&&(document.body.addEventListener("scroll",f),s.value.push(document.body))},h=()=>{s.value.forEach(k=>{k.removeEventListener("scroll",f)}),s.value=[]},x=()=>{a.value=!0,jt(o.placement,i.value,d.value)},g=()=>{a.value=!1},m=async()=>{await jt(o.placement,i.value,d.value),a.value=!a.value},f=()=>{a.value=!1},b=k=>{if(!k){a.value=!1;return}i.value?.contains(k.target)||d.value?.contains(k.target)||(a.value=!1)},w=()=>{a.value&&(a.value=!1)},_=k=>{a.value&&d.value&&!d.value.contains(k.target)&&(a.value=!1)};return t({togglePopover:m}),(k,C)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"popover",ref:c,class:"vs-popover inline-block"},[e.createElementVNode("div",Lm,[r.trigger==="click"?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"popoverRef",ref:i,onClick:m,class:e.normalizeClass({"pointer-events-none":r.disabled})},[e.renderSlot(k.$slots,"reference",{},()=>[C[0]||(C[0]=e.createElementVNode("button",null,"Click me!",-1))])],2)):e.createCommentVNode("",!0),r.trigger==="hover"?(e.openBlock(),e.createElementBlock("div",{key:1,ref_key:"popoverRef",ref:i,onMouseover:x,onMouseleave:g,class:e.normalizeClass({"pointer-events-none":r.disabled})},[e.renderSlot(k.$slots,"reference",{},()=>[C[1]||(C[1]=e.createElementVNode("button",null,"Click me!",-1))])],34)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.Teleport,{to:r.teleport},[e.createVNode(e.Transition,{name:"fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["vsTailwind vs-popover__content",r.placement]),ref_key:"contentPop",ref:d,style:e.normalizeStyle({width:r.width?r.width+"px":"fit-content",zIndex:100001})},[e.createElementVNode("div",Tm,[e.renderSlot(k.$slots,"default",{},()=>[C[2]||(C[2]=e.createElementVNode("span",null,"Popover content",-1))])])],6),[[e.vShow,a.value]])]),_:3})],8,["to"]))])],512))}}),Im={class:"flex flex-col gap-[2px] p-[2px]"},Rm=["onClick"],Om={__name:"vs-editor-table",props:{editor:Object},setup(r){const{t}=hn(),n=r,o=e.ref(!1),l=e.ref("popover"),a=()=>{n.editor&&(n.editor.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),l.value.togglePopover())},s=()=>{n.editor&&(n.editor.chain().focus().addColumnAfter().run(),l.value.togglePopover())},c=()=>{n.editor&&(n.editor.chain().focus().addRowAfter().run(),l.value.togglePopover())},i=()=>{n.editor&&(n.editor.chain().focus().deleteColumn().run(),l.value.togglePopover())},d=()=>{n.editor&&(n.editor.chain().focus().deleteRow().run(),l.value.togglePopover())},u=()=>{n.editor&&(n.editor.chain().focus().deleteTable().run(),l.value.togglePopover())},h=()=>{n.editor&&(n.editor.chain().focus().mergeCells().run(),l.value.togglePopover())},x=()=>{n.editor&&(n.editor.chain().focus().splitCell().run(),l.value.togglePopover())},g=e.computed(()=>[{text:t("form.richtext.createTable"),function:a},{text:t("form.richtext.addColumn"),function:s},{text:t("form.richtext.addRow"),function:c},{text:t("form.richtext.deleteColumn"),function:i},{text:t("form.richtext.deleteRow"),function:d},{text:t("form.richtext.deleteTable"),function:u},{text:t("form.richtext.mergeCells"),function:h},{text:t("form.richtext.splitCells"),function:x}]);return(m,f)=>(e.openBlock(),e.createBlock(bt,{ref_key:"popover",ref:l,placement:"bottom",onIsvisible:f[0]||(f[0]=b=>o.value=b)},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Table",class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[o.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[e.createVNode(e.unref(j.Table2),{class:"h-4 w-4"})],2)]),default:e.withCtx(()=>[e.createElementVNode("div",Im,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,(b,w)=>(e.openBlock(),e.createElementBlock("button",{key:w,onClick:b?.function,class:"px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded"},e.toDisplayString(b.text),9,Rm))),128))])]),_:1},512))}},zm={class:"flex gap-[4px] p-1"},Pm=["title","onClick"],jm={__name:"vs-editor-align",props:{editor:Object},setup(r){const t=r,n={left:j.AlignLeft,center:j.AlignCenter,right:j.AlignRight,justify:j.AlignJustify},o=e.ref(!1),l=e.ref("popover"),a=e.ref("left"),s=e.computed(()=>t.editor?t.editor.isActive("paragraph",{textAlign:"left"})||t.editor.isActive("heading",{textAlign:"left"}):!1),c=e.computed(()=>t.editor?t.editor.isActive("paragraph",{textAlign:"right"})||t.editor.isActive("heading",{textAlign:"right"}):!1),i=e.computed(()=>t.editor?t.editor.isActive("paragraph",{textAlign:"center"})||t.editor.isActive("heading",{textAlign:"center"}):!1),d=e.computed(()=>t.editor?t.editor.isActive("paragraph",{textAlign:"justify"})||t.editor.isActive("heading",{textAlign:"justify"}):!1),u=e.computed(()=>s.value||c.value||i.value||d.value),h=()=>{c.value?a.value="right":i.value?a.value="center":d.value?a.value="justify":a.value="left"};e.watch([s,c,i,d],()=>{h()},{immediate:!0}),e.onMounted(()=>{t.editor&&(t.editor.on("selectionUpdate",h),t.editor.on("update",h))}),e.onUnmounted(()=>{t.editor&&(t.editor.off("selectionUpdate",h),t.editor.off("update",h))});const x=m=>{t.editor&&(t.editor.chain().focus().setTextAlign(m).run(),a.value=m)},g=e.ref([{id:"left",isActive:s},{id:"center",isActive:i},{id:"right",isActive:c},{id:"justify",isActive:d}]);return(m,f)=>(e.openBlock(),e.createBlock(bt,{ref_key:"popover",ref:l,placement:"bottom",onIsvisible:f[0]||(f[0]=b=>o.value=b)},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Text Align",class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[u.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n[a.value]),{height:"16",width:"16"}))],2)]),default:e.withCtx(()=>[e.createElementVNode("div",zm,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(g.value,b=>(e.openBlock(),e.createElementBlock("button",{title:"Text align "+b?.id,class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":b?.isActive}]),key:b?.id,onClick:w=>x(b?.id)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n[b?.id]),{height:"16",width:"16"}))],10,Pm))),128))])]),_:1},512))}},Um={class:"flex flex-col gap-[2px] p-[2px]"},Hm=["onClick"],qm={__name:"vs-editor-type-tag",props:{editor:Object},setup(r){const{t}=hn(),n=r,o=e.ref(!1),l=e.ref("popover"),a=()=>{n.editor&&(n.editor?.chain().focus().setParagraph().run(),l.value.togglePopover())},s=i=>{n.editor&&(n.editor?.chain().focus().toggleHeading({level:i}).run(),l.value.togglePopover())},c=e.computed(()=>[{text:t("form.richtext.heading1"),id:1,style:"font-[700] text-[30px]"},{text:t("form.richtext.heading2"),id:2,style:"font-[700] text-[26px]"},{text:t("form.richtext.heading3"),id:3,style:"font-[700] text-[22px]"},{text:t("form.richtext.heading4"),id:4,style:"font-[700] text-[18px]"},{text:t("form.richtext.heading5"),id:5,style:"font-[500] text-[16px]"},{text:t("form.richtext.heading6"),id:6,style:"font-[400] text-[14px]"}]);return(i,d)=>(e.openBlock(),e.createBlock(bt,{ref_key:"popover",ref:l,placement:"bottom",onIsvisible:d[0]||(d[0]=u=>o.value=u)},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Type Tag",class:e.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[o.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[e.createVNode(e.unref(j.Type),{class:"h-4 w-4"})],2)]),default:e.withCtx(()=>[e.createElementVNode("div",Um,[e.createElementVNode("button",{onClick:a,class:e.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded",[r.editor?.isActive("paragraph")?"bg-gray-100":""]])},e.toDisplayString(e.unref(t)("form.richtext.paragraph")),3),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(u,h)=>(e.openBlock(),e.createElementBlock("button",{key:h,onClick:x=>s(u?.id),class:e.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded leading-[100%]",[u?.style,r.editor?.isActive("heading",{level:u?.id})?"bg-gray-100":""]])},e.toDisplayString(e.unref(t)(`form.richtext.heading${u?.id}`)),11,Hm))),128))])]),_:1},512))}},Gm={components:{VsText:bo},inheritAttrs:!1,events:["update:modelValue"],props:{modelValue:{type:String},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},isTextInputShown:{type:Boolean,default:()=>!0}},computed:{value:{get(){return this.modelValue??""},set(r){this.$emit("update:modelValue",r)}}}},Km={class:"flex items-center w-full max-w-[182px]"},Wm=["disabled"];function Ym(r,t,n,o,l,a){const s=e.resolveComponent("vs-text");return e.openBlock(),e.createElementBlock("div",Km,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":t[0]||(t[0]=c=>a.value=c),type:"color",class:e.normalizeClass(["w-[38px] h-[38px] min-h-[38px] min-w-[38px] py-[2px] px-[3px] -ml-1 dark:bg-neutral-800 border dark:border-neutral-700 border-stone-200 rounded-lg",n.disabled?"cursor-not-allowed":"cursor-pointer"]),disabled:n.disabled},null,10,Wm),[[e.vModelText,a.value]]),n.isTextInputShown?(e.openBlock(),e.createBlock(s,{key:0,modelValue:a.value,"onUpdate:modelValue":t[1]||(t[1]=c=>a.value=c),class:"ml-2 w-full",disabled:n.disabled,clearable:n.clearable},null,8,["modelValue","disabled","clearable"])):e.createCommentVNode("",!0)])}const ko=me(Gm,[["render",Ym]]),Xm={class:"flex gap-[4px] mb-[8px]"},Zm={class:"grid grid-rows-3 grid-cols-7"},Jm={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},Qm=["onClick","title"],eh={__name:"vs-editor-color",props:{editor:Object},setup(r){const t=r,n=e.ref(null),o=e.ref("#000000"),l=e.computed(()=>t.editor&&t.editor.getAttributes("textStyle").color||"#000000"),a=e.computed(()=>l.value!=="#000000"),s=()=>{t.editor&&(o.value=l.value)};e.onMounted(()=>{t.editor&&(t.editor.on("selectionUpdate",s),t.editor.on("update",s),s())}),e.onUnmounted(()=>{t.editor&&(t.editor.off("selectionUpdate",s),t.editor.off("update",s))});const c=e.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),i=h=>{t.editor&&(t.editor.chain().focus().setColor(h).run(),o.value=h,n.value&&n.value.togglePopover())},d=()=>{i(o.value)},u=h=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple","#FFFFFF":"White","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[h]||h;return(h,x)=>(e.openBlock(),e.createBlock(bt,{ref_key:"popover",ref:n,placement:"bottom"},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Text Color",class:e.normalizeClass(["flex flex-col h-[30px] min-w-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":a.value}])},[x[1]||(x[1]=e.createElementVNode("span",{class:"leading-none"},"A",-1)),e.createElementVNode("span",{class:"block h-1 w-5",style:e.normalizeStyle({backgroundColor:o.value})},null,4)],2)]),default:e.withCtx(()=>[e.createElementVNode("div",null,[e.createElementVNode("div",Xm,[e.createVNode(ko,{modelValue:o.value,"onUpdate:modelValue":x[0]||(x[0]=g=>o.value=g)},null,8,["modelValue"]),e.createElementVNode("button",{onClick:d,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[e.createVNode(e.unref(j.Check),{class:"h-4 w-4 text-white"})])]),e.createElementVNode("div",Zm,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[e.createElementVNode("div",Jm,[e.createElementVNode("button",{class:"flex items-center justify-center w-full h-full",style:e.normalizeStyle({backgroundColor:g}),onClick:m=>i(g),title:u(g)},[o.value===g?(e.openBlock(),e.createBlock(e.unref(j.Check),{key:0,class:"h-4 w-4 text-gray-500"})):e.createCommentVNode("",!0)],12,Qm)])]))),128))])])]),_:1},512))}},th={class:"flex gap-[4px] mb-[8px]"},nh={class:"grid grid-rows-3 grid-cols-7"},rh={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},oh=["onClick","title"],lh=["onClick","title"],ah={__name:"vs-editor-background-color",props:{editor:Object},setup(r){const t=r,n=e.ref(null),o=e.ref("transparent"),l=e.computed(()=>t.editor&&t.editor.getAttributes("textStyle").backgroundColor||"transparent"),a=e.computed(()=>l.value!=="transparent"&&l.value!==""),s=()=>{t.editor&&(o.value=l.value)};e.onMounted(()=>{t.editor&&(t.editor.on("selectionUpdate",s),t.editor.on("update",s),s())}),e.onUnmounted(()=>{t.editor&&(t.editor.off("selectionUpdate",s),t.editor.off("update",s))});const c=e.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),i=h=>{t.editor&&(t.editor.chain().focus().setBackgroundColor(h).run(),o.value=h,n.value&&n.value.togglePopover())},d=()=>{i(o.value)},u=h=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple",transparent:"Transparent","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[h]||h;return(h,x)=>(e.openBlock(),e.createBlock(bt,{ref_key:"popover",ref:n,placement:"bottom"},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Background Color",class:e.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":a.value}])},[e.createVNode(e.unref(j.PaintBucket),{class:"h-4 w-4"}),e.createElementVNode("span",{class:"block h-1 w-5",style:e.normalizeStyle({backgroundColor:o.value})},null,4)],2)]),default:e.withCtx(()=>[e.createElementVNode("div",null,[e.createElementVNode("div",th,[e.createVNode(ko,{modelValue:o.value,"onUpdate:modelValue":x[0]||(x[0]=g=>o.value=g)},null,8,["modelValue"]),e.createElementVNode("button",{onClick:d,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[e.createVNode(e.unref(j.Check),{class:"h-4 w-4 text-white"})])]),e.createElementVNode("div",nh,[e.createElementVNode("button",{onClick:x[1]||(x[1]=g=>i("transparent")),class:"col-span-7 flex items-center justify-center gap-2 bg-gray-100 rounded-md py-1 mb-2 hover:bg-gray-200"},[e.createVNode(e.unref(j.Eraser),{class:"h-4 w-4"}),x[2]||(x[2]=e.createElementVNode("p",null,"no color",-1))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,g=>(e.openBlock(),e.createElementBlock("div",{key:g,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[e.createElementVNode("div",rh,[g!=="transparent"?(e.openBlock(),e.createElementBlock("button",{key:0,class:"flex items-center justify-center w-full h-full",style:e.normalizeStyle({backgroundColor:g}),onClick:m=>i(g),title:u(g)},[o.value===g?(e.openBlock(),e.createBlock(e.unref(j.Check),{key:0,class:"h-4 w-4 text-gray-500"})):e.createCommentVNode("",!0)],12,oh)):e.createCommentVNode("",!0),g==="transparent"?(e.openBlock(),e.createElementBlock("button",{key:1,class:"flex items-center justify-center w-full h-full",onClick:m=>i(g),title:u(g)},[o.value===g?(e.openBlock(),e.createBlock(e.unref(j.Check),{key:0,class:"h-4 w-4 text-gray-500"})):e.createCommentVNode("",!0)],8,lh)):e.createCommentVNode("",!0)])]))),128))])])]),_:1},512))}},sh={__name:"vs-editor-highlight",props:{editor:Object},setup(r){const t=r,n=e.computed(()=>t.editor?.isActive("highlight")),o=()=>{t.editor&&t.editor.chain().focus().toggleHighlight().run()};return(l,a)=>(e.openBlock(),e.createElementBlock("button",{title:"Highlight",onClick:o,class:e.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-200":n.value}])},[e.createVNode(e.unref(j.Highlighter),{class:"h-4 w-4"})],2))}},ih={class:"truncate"},ch={class:"w-[200px]"},dh={class:"max-h-[200px] overflow-y-auto"},uh=["onClick"],ph={__name:"vs-editor-font-family",props:{editor:Object},setup(r){const t=r,n=e.ref("popover"),o=e.ref(!1),l=e.ref([{label:"Arial",value:"Arial, sans-serif"},{label:"Helvetica",value:"Helvetica, sans-serif"},{label:"Times New Roman",value:"Times New Roman, serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Verdana",value:"Verdana, sans-serif"},{label:"Courier New",value:"Courier New, monospace"},{label:"Comic Sans MS",value:"Comic Sans MS, cursive"},{label:"Impact",value:"Impact, sans-serif"},{label:"Trebuchet MS",value:"Trebuchet MS, sans-serif"},{label:"Palatino",value:"Palatino, serif"}]),a=e.computed(()=>{if(!t.editor)return"Arial, sans-serif";for(const d of l.value)if(t.editor.isActive("textStyle",{fontFamily:d.value}))return d.value;return"Arial, sans-serif"}),s=e.computed(()=>l.value.find(u=>u.value===a.value)?.label||"Arial"),c=d=>t.editor?t.editor.isActive("textStyle",{fontFamily:d}):!1,i=d=>{t.editor&&(t.editor.chain().focus().setFontFamily(d).run(),n.value&&n.value.togglePopover())};return(d,u)=>(e.openBlock(),e.createBlock(bt,{ref_key:"popover",ref:n,placement:"bottom",onIsvisible:u[0]||(u[0]=h=>o.value=h)},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Font Family",class:e.normalizeClass(["h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm",[o.value?"bg-gray-100 text-gray-900":"text-gray-700"]]),style:e.normalizeStyle({fontFamily:a.value})},[e.createElementVNode("span",ih,e.toDisplayString(s.value),1),e.createVNode(e.unref(j.ChevronDown),{class:"ml-1 h-3 w-3 text-gray-400"})],6)]),default:e.withCtx(()=>[e.createElementVNode("div",ch,[e.createElementVNode("ul",dh,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,h=>(e.openBlock(),e.createElementBlock("li",{key:h.value,class:e.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",{"bg-gray-100":c(h.value)}]),style:e.normalizeStyle({fontFamily:h.value}),onClick:x=>i(h.value)},e.toDisplayString(h.label),15,uh))),128))])])]),_:1},512))}},fh={class:"w-[120px]"},mh={class:"max-h-[200px] overflow-y-auto"},hh=["onClick"],gh={__name:"vs-editor-font-size",props:{editor:Object},setup(r){const t=r,n=e.ref("popover"),o=e.ref("14px"),l=e.computed(()=>t.editor&&t.editor.getAttributes("textStyle").fontSize||"14px"),a=e.computed(()=>l.value!=="14px"),s=()=>{t.editor&&(o.value=l.value)};e.onMounted(()=>{t.editor&&(t.editor.on("selectionUpdate",s),t.editor.on("update",s),s())}),e.onUnmounted(()=>{t.editor&&(t.editor.off("selectionUpdate",s),t.editor.off("update",s))});const c=e.ref([{label:"8px",value:"8px"},{label:"9px",value:"9px"},{label:"10px",value:"10px"},{label:"11px",value:"11px"},{label:"12px",value:"12px"},{label:"14px",value:"14px"},{label:"16px",value:"16px"},{label:"18px",value:"18px"},{label:"20px",value:"20px"},{label:"24px",value:"24px"},{label:"28px",value:"28px"},{label:"32px",value:"32px"},{label:"36px",value:"36px"},{label:"48px",value:"48px"},{label:"72px",value:"72px"}]),i=d=>{t.editor&&(t.editor.chain().focus().setFontSize(d).run(),o.value=d,n.value&&n.value.togglePopover())};return(d,u)=>(e.openBlock(),e.createBlock(bt,{ref_key:"popover",ref:n,placement:"bottom"},{reference:e.withCtx(()=>[e.createElementVNode("button",{title:"Font Size",class:e.normalizeClass(["h-[30px] px-2 min-w-[30px] rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700 space-x-1",{"bg-gray-100 text-gray-900":a.value}])},[e.createVNode(e.unref(j.ALargeSmall),{class:"h-4 w-4"}),e.createVNode(e.unref(j.ChevronDown),{class:"h-3 w-3 text-gray-400"})],2)]),default:e.withCtx(()=>[e.createElementVNode("div",fh,[e.createElementVNode("ul",mh,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,h=>(e.openBlock(),e.createElementBlock("li",{key:h.value,class:"px-3 py-2 hover:bg-gray-100 cursor-pointer",onClick:x=>i(h.value)},e.toDisplayString(h.label),9,hh))),128))])])]),_:1},512))}},yh={components:{Superscript:j.Superscript},props:{editor:Object},methods:{toggleSuperscript(){this.editor&&this.editor.commands.toggleSuperscript()}}};function bh(r,t,n,o,l,a){const s=e.resolveComponent("Superscript");return e.openBlock(),e.createElementBlock("button",{title:"Superscript",onClick:t[0]||(t[0]=(...c)=>a.toggleSuperscript&&a.toggleSuperscript(...c)),class:e.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("superscript")}])},[e.createVNode(s,{class:"h-4 w-4"}),t[1]||(t[1]=e.createElementVNode("span",{class:"sr-only"},"Superscript",-1))],2)}const kh=me(yh,[["render",bh]]),xh={components:{Subscript:j.Subscript},props:{editor:Object},methods:{toggleSubscript(){this.editor&&this.editor.commands.toggleSubscript()}}};function wh(r,t,n,o,l,a){const s=e.resolveComponent("Subscript");return e.openBlock(),e.createElementBlock("button",{title:"Subscript",onClick:t[0]||(t[0]=(...c)=>a.toggleSubscript&&a.toggleSubscript(...c)),class:e.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":n.editor?.isActive("subscript")}])},[e.createVNode(s,{class:"h-4 w-4"}),t[1]||(t[1]=e.createElementVNode("span",{class:"sr-only"},"Subscript",-1))],2)}const _h=me(xh,[["render",wh]]),vh={title:"Heading",class:"h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700"},Ch={class:"truncate"},Eh={class:"max-h-[200px] overflow-y-auto"},Bh=["onClick"],Vh=me({__name:"vs-editor-heading",props:{editor:Object},setup(r){const t=r,n=e.ref("popover"),o=e.ref([{label:"Heading 1",value:1},{label:"Heading 2",value:2},{label:"Heading 3",value:3},{label:"Heading 4",value:4},{label:"Heading 5",value:5},{label:"Heading 6",value:6}]),l=e.computed(()=>{if(!t.editor)return"Paragraph";for(let i=1;i<=6;i++)if(t.editor.isActive("heading",{level:i}))return`H ${i}`;return"P"}),a=i=>({1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"})[i]||"",s=i=>{t.editor&&(t.editor.chain().focus().setHeading({level:i}).run(),n.value&&n.value.togglePopover())},c=()=>{t.editor&&(t.editor.chain().focus().setParagraph().run(),n.value&&n.value.togglePopover())};return(i,d)=>(e.openBlock(),e.createBlock(bt,{ref_key:"popover",ref:n,placement:"bottom"},{reference:e.withCtx(()=>[e.createElementVNode("button",vh,[e.createElementVNode("span",Ch,e.toDisplayString(l.value),1),e.createVNode(e.unref(j.ChevronDown),{class:"ml-1 h-3 w-3 text-gray-400"})])]),default:e.withCtx(()=>[e.createElementVNode("div",null,[e.createElementVNode("ul",Eh,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,u=>(e.openBlock(),e.createElementBlock("li",{key:u.value,class:e.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",`heading-level-${u.value}`]),style:e.normalizeStyle(a(u.value)),onClick:h=>s(u.value)},e.toDisplayString(u.label),15,Bh))),128)),e.createElementVNode("li",{class:"px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm border-t border-gray-200 mt-1 pt-2",onClick:c}," Paragraph ")])])]),_:1},512))}},[["__scopeId","data-v-96f02f2a"]]),Sh={components:{RemoveFormatting:j.RemoveFormatting},props:{editor:Object},methods:{clearFormatting(){this.editor&&this.editor.commands.unsetAllMarks()}}};function $h(r,t,n,o,l,a){const s=e.resolveComponent("RemoveFormatting");return e.openBlock(),e.createElementBlock("button",{title:"Clear Formatting",onClick:t[0]||(t[0]=(...c)=>a.clearFormatting&&a.clearFormatting(...c)),class:"h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100"},[e.createVNode(s,{class:"h-4 w-4"}),t[1]||(t[1]=e.createElementVNode("span",{class:"sr-only"},"Clear Formatting",-1))])}const Nh=me(Sh,[["render",$h]]),Ah={class:"relative"},Fh={key:0,class:"mt-4"},Mh=["src","alt","title"],Dh={key:0,class:"text-sm text-red-500"},Lh={key:1,class:"mt-4"},Th={class:"text-sm text-gray-600 mb-2"},Ih={class:"flex flex-wrap gap-2"},Rh=["src","alt","onError"],Oh=["onClick"],zh={class:"flex justify-end gap-x-2 p-[20px]"},Ph=Object.assign({inheritAttrs:!1},{__name:"vs-editor-image",props:{editor:{type:Object,required:!0}},setup(r){const t=r,n=e.ref(!1),o=e.ref(!1),l=e.ref({}),a=e.ref(!1),s=e.ref([]),c=e.ref(null),i=e.ref({src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1}),d=e.computed(()=>{if(Array.isArray(i.value.file)){const B=i.value.file.filter(L=>L instanceof File),$=i.value.file.filter(L=>typeof L=="string"&&L.trim()!=="");return B.length+$.length>1}return i.value.file instanceof FileList?i.value.file.length>1:!1}),u=e.computed(()=>Array.isArray(i.value.file)?i.value.file.filter(B=>B instanceof File).length===1:i.value.file instanceof FileList?i.value.file.length===1:i.value.file instanceof File),h=e.computed(()=>{if(d.value)return"";if(i.value.src)return i.value.src;if(u.value){let B=null;if(Array.isArray(i.value.file)||i.value.file instanceof FileList?B=i.value.file[0]:i.value.file instanceof File&&(B=i.value.file),B instanceof File){const $=s.value.find(S=>S.file===B);return $?$.preview:""}else if(typeof B=="string")return B}return""}),x=e.computed(()=>[{name:"src",label:"URL зображення",type:"text",required:!1,placeholder:"https://example.com/image.png"},{name:"file",label:"Файл (можна вибрати кілька)",type:"file",multiple:!0,required:!1,placeholder:"Шлях до файлу зображення",accept:"image/*"},{name:"width",label:"Ширина",type:"number",required:!1,placeholder:"Ширина зображення",clearable:!0,min:0},{name:"height",label:"Висота",type:"number",required:!1,placeholder:"Висота зображення",clearable:!0,min:0},{name:"alt",label:"Альтернативний текст",type:"text",required:!1,placeholder:"Опис зображення"},{name:"title",label:"Заголовок (необов'язково)",type:"text",required:!1,placeholder:"Заголовок зображення"},{name:"link",label:"Посилання",type:"text",required:!1,placeholder:"https://example.com"},{name:"openInNewTab",label:"Відкривати у новій вкладці?",type:"switcher",required:!1}]),g=()=>{if(!t.editor)return;if(t.editor.isActive("image")){const{state:$}=t.editor,{selection:S}=$,{$from:L}=S;let F=null,P=null;if(L.parent.type.name==="image")F=L.before(L.depth),P=L.parent;else for(let ne=L.depth;ne>0;ne--){const we=L.node(ne),ge=L.before(ne);we.type.name==="paragraph"&&we.forEach((J,re)=>{if(J.type.name==="image"){const de=ge+re+1;(F===null||Math.abs(de-S.$from.pos)<Math.abs(F-S.$from.pos))&&(F=de,P=J)}})}if(F!==null&&P){try{t.editor.chain().focus().setNodeSelection(F).run()}catch{t.editor.chain().focus().setTextSelection(F).run()}c.value=F}else{t.editor.chain().focus().selectParentNode().run();const{state:ne}=t.editor;c.value=ne.selection.$from.pos}const M=P?P.attrs:t.editor.getAttributes("image");a.value=!0;let O="",T=!1;const G=t.editor.getAttributes("link");G&&G.href&&(O=G.href,T=G.target==="_blank");const W=M.src||"",X=W?[W]:[];i.value={src:W,file:X,alt:M.alt||"",title:M.title||"",width:M.width||"",height:M.height||"",link:O,openInNewTab:T}}else a.value=!1,i.value={src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1};o.value=!1,n.value=!0},m=()=>{n.value=!1,o.value=!1,a.value=!1,s.value=[],c.value=null,i.value={src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1}},f=async B=>{if(!B||B.length===0)return;const $=[];for(const S of B)if(S&&S.type&&S.type.startsWith("image/")&&!s.value.some(F=>F.file===S)){const F=new Promise((P,M)=>{const O=new FileReader;O.onload=T=>{s.value.push({file:S,preview:T.target.result,error:!1}),P()},O.onerror=M,O.readAsDataURL(S)});$.push(F)}await Promise.all($)},b=B=>{s.value.splice(B,1),Array.isArray(i.value.file)&&i.value.file.splice(B,1)},w=()=>{const B=i.value.width!==null&&i.value.width!==void 0&&i.value.width!==""&&String(i.value.width).trim()!==""?String(i.value.width).trim():"",$=i.value.height!==null&&i.value.height!==void 0&&i.value.height!==""&&String(i.value.height).trim()!==""?String(i.value.height).trim():"",S={};return B&&$?(S.width=B,S.height=$,S.style=`width: ${B}px; height: ${$}px; object-fit: fill;`):B?(S.width=B,S.height=void 0):$?(S.height=$,S.width=void 0):(S.width=void 0,S.height=void 0),S},_=(B,$=null,S=50)=>{const L=()=>{const{view:M}=B;if(!M||!M.dom)return;M.dom.querySelectorAll("img.editor-image[width][height]").forEach(G=>{if(G instanceof HTMLImageElement){const W=G.getAttribute("width"),X=G.getAttribute("height");W&&X&&W!=="auto"&&X!=="auto"&&W!==""&&X!==""&&!isNaN(Number(W))&&!isNaN(Number(X))&&(G.style.cssText=`
|
|
36
36
|
width: ${W}px !important;
|
|
37
37
|
height: ${X}px !important;
|
|
38
38
|
max-width: none !important;
|
|
@@ -48,4 +48,4 @@ ${i}
|
|
|
48
48
|
min-width: auto !important;
|
|
49
49
|
min-height: auto !important;
|
|
50
50
|
object-fit: fill !important;
|
|
51
|
-
`.replace(/\s+/g," ").trim())}})};return e.watch(c,A=>{A&&(e.nextTick(()=>{I(c.value)}),c.value.on("update",async B=>{const $=B.editor.getHTML(),S=await jf($,t.format);S!==t.modelValue&&$!=="<p></p>"&&(n.value=S),setTimeout(()=>{I(B.editor)},10)}))}),e.onMounted(async()=>{const A=await Zn(t.modelValue||"",t.format);await u(o.value,A),e.nextTick(()=>{c.value&&setTimeout(()=>{I(c.value)},100)})}),e.onBeforeUnmount(()=>{h()}),(A,B)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["bg-white rounded-md w-full",{"fixed left-0 right-0 top-0 bottom-0 z-[100000]":e.unref(_)}])},[e.createElementVNode("div",Xh,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E.value,$=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:$},[e.unref(c)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent($),{key:0,editor:e.unref(i),onToggleFullscreen:e.unref(k)},null,40,["editor","onToggleFullscreen"])):e.createCommentVNode("",!0)],64))),128))]),e.createElementVNode("div",{onClick:B[1]||(B[1]=(...$)=>e.unref(d)&&e.unref(d)(...$)),class:"relative w-full px-4 py-2 bg-white rounded-b-lg editor-content",style:e.normalizeStyle({height:e.unref(_)?"calc(95vh - 44px)":r.height})},[e.withDirectives(e.createElementVNode("div",Zh,[e.createElementVNode("div",{ref_key:"editorElement",ref:o,class:"relative w-full"},null,512),e.unref(x)?(e.openBlock(),e.createElementBlock("div",Jh,"Loading editor...")):e.createCommentVNode("",!0),e.unref(g)?(e.openBlock(),e.createElementBlock("div",Qh,e.toDisplayString(e.unref(g)),1)):e.createCommentVNode("",!0)],512),[[e.vShow,!e.unref(m)]]),e.withDirectives(e.createElementVNode("div",eg,[e.createVNode(Mn,{ref_key:"htmlTextarea",ref:b,modelValue:e.unref(f),"onUpdate:modelValue":B[0]||(B[0]=$=>e.isRef(f)?f.value=$:null),height:"100%",syntax:a.value,theme:"vs-light"},null,8,["modelValue","syntax"])],512),[[e.vShow,e.unref(m)]])],4),e.createElementVNode("div",tg,[e.createElementVNode("div",ng,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["min-w-[96px] h-[30px] px-[14px] border border-[#cfd6e0] bg-[#f3f5f8] text-[8px] font-bold uppercase tracking-[0.06em] leading-none cursor-pointer transition-colors duration-200 border-b-[1px] border-b-[#cfd6e0] rounded-none rounded-bl-[8px] hover:bg-[#eef1f5] hover:text-[#667284]",e.unref(m)?"text-[#8f99aa]":"!bg-white text-[#49556a] border-[#cfd6e0] border-t-transparent relative z-[1]"]),onClick:B[2]||(B[2]=$=>e.unref(w)(!1))},e.toDisplayString(e.unref(l)("form.richtext.editor")),3),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["min-w-[96px] h-[30px] px-[14px] border border-[#cfd6e0] border-l-0 bg-[#f3f5f8] text-[8px] font-bold uppercase tracking-[0.06em] leading-none cursor-pointer transition-colors duration-200 border-b-[1px] border-b-[#cfd6e0] rounded-none rounded-br-[8px] hover:bg-[#eef1f5] hover:text-[#667284]",e.unref(m)?"!bg-white text-[#49556a] border-[#cfd6e0] border-t-transparent relative z-[1]":"text-[#8f99aa]"]),onClick:B[3]||(B[3]=$=>e.unref(w)(!0))},e.toDisplayString(s.value),3)])])],2))}})},Symbol.toStringTag,{value:"Module"}));pe.ModalEdit=Tr,pe.VForm=Qe,pe.VsInputAddress=Nr,pe.VsInputArray=$r,pe.VsInputArraySelect=en,pe.VsInputCheckbox=ar,pe.VsInputCodegen=Cr,pe.VsInputColor=Vr,pe.VsInputContainer=pr,pe.VsInputDate=mf,pe.VsInputEmail=Bn,pe.VsInputFile=cr,pe.VsInputFileList=dr,pe.VsInputKeyValue=Er,pe.VsInputMask=En,pe.VsInputMonaco=Mn,pe.VsInputNumber=lr,pe.VsInputRadio=Sn,pe.VsInputRange=Sr,pe.VsInputRichtext=mr,pe.VsInputSelect=Fn,pe.VsInputSlug=vr,pe.VsInputStatic=Cn,pe.VsInputSwitcher=vn,pe.VsInputTag=_r,pe.VsInputTel=Vn,pe.VsInputText=
|
|
51
|
+
`.replace(/\s+/g," ").trim())}})};return e.watch(c,A=>{A&&(e.nextTick(()=>{I(c.value)}),c.value.on("update",async B=>{const $=B.editor.getHTML(),S=await jf($,t.format);S!==t.modelValue&&$!=="<p></p>"&&(n.value=S),setTimeout(()=>{I(B.editor)},10)}))}),e.onMounted(async()=>{const A=await Zn(t.modelValue||"",t.format);await u(o.value,A),e.nextTick(()=>{c.value&&setTimeout(()=>{I(c.value)},100)})}),e.onBeforeUnmount(()=>{h()}),(A,B)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["bg-white rounded-md w-full",{"fixed left-0 right-0 top-0 bottom-0 z-[100000]":e.unref(_)}])},[e.createElementVNode("div",Xh,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E.value,$=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:$},[e.unref(c)?(e.openBlock(),e.createBlock(e.resolveDynamicComponent($),{key:0,editor:e.unref(i),onToggleFullscreen:e.unref(k)},null,40,["editor","onToggleFullscreen"])):e.createCommentVNode("",!0)],64))),128))]),e.createElementVNode("div",{onClick:B[1]||(B[1]=(...$)=>e.unref(d)&&e.unref(d)(...$)),class:"relative w-full px-4 py-2 bg-white rounded-b-lg editor-content",style:e.normalizeStyle({height:e.unref(_)?"calc(95vh - 44px)":r.height})},[e.withDirectives(e.createElementVNode("div",Zh,[e.createElementVNode("div",{ref_key:"editorElement",ref:o,class:"relative w-full"},null,512),e.unref(x)?(e.openBlock(),e.createElementBlock("div",Jh,"Loading editor...")):e.createCommentVNode("",!0),e.unref(g)?(e.openBlock(),e.createElementBlock("div",Qh,e.toDisplayString(e.unref(g)),1)):e.createCommentVNode("",!0)],512),[[e.vShow,!e.unref(m)]]),e.withDirectives(e.createElementVNode("div",eg,[e.createVNode(Mn,{ref_key:"htmlTextarea",ref:b,modelValue:e.unref(f),"onUpdate:modelValue":B[0]||(B[0]=$=>e.isRef(f)?f.value=$:null),height:"100%",syntax:a.value,theme:"vs-light"},null,8,["modelValue","syntax"])],512),[[e.vShow,e.unref(m)]])],4),e.createElementVNode("div",tg,[e.createElementVNode("div",ng,[e.createElementVNode("button",{type:"button",class:e.normalizeClass(["min-w-[96px] h-[30px] px-[14px] border border-[#cfd6e0] bg-[#f3f5f8] text-[8px] font-bold uppercase tracking-[0.06em] leading-none cursor-pointer transition-colors duration-200 border-b-[1px] border-b-[#cfd6e0] rounded-none rounded-bl-[8px] hover:bg-[#eef1f5] hover:text-[#667284]",e.unref(m)?"text-[#8f99aa]":"!bg-white text-[#49556a] border-[#cfd6e0] border-t-transparent relative z-[1]"]),onClick:B[2]||(B[2]=$=>e.unref(w)(!1))},e.toDisplayString(e.unref(l)("form.richtext.editor")),3),e.createElementVNode("button",{type:"button",class:e.normalizeClass(["min-w-[96px] h-[30px] px-[14px] border border-[#cfd6e0] border-l-0 bg-[#f3f5f8] text-[8px] font-bold uppercase tracking-[0.06em] leading-none cursor-pointer transition-colors duration-200 border-b-[1px] border-b-[#cfd6e0] rounded-none rounded-br-[8px] hover:bg-[#eef1f5] hover:text-[#667284]",e.unref(m)?"!bg-white text-[#49556a] border-[#cfd6e0] border-t-transparent relative z-[1]":"text-[#8f99aa]"]),onClick:B[3]||(B[3]=$=>e.unref(w)(!0))},e.toDisplayString(s.value),3)])])],2))}})},Symbol.toStringTag,{value:"Module"}));pe.ModalEdit=Tr,pe.VForm=Qe,pe.VsInputAddress=Nr,pe.VsInputArray=$r,pe.VsInputArraySelect=en,pe.VsInputCheckbox=ar,pe.VsInputCodegen=Cr,pe.VsInputColor=Vr,pe.VsInputContainer=pr,pe.VsInputDate=mf,pe.VsInputEmail=Bn,pe.VsInputFile=cr,pe.VsInputFileList=dr,pe.VsInputKeyValue=Er,pe.VsInputMask=En,pe.VsInputMonaco=Mn,pe.VsInputNumber=lr,pe.VsInputRadio=Sn,pe.VsInputRange=Sr,pe.VsInputRichtext=mr,pe.VsInputSelect=Fn,pe.VsInputSlug=vr,pe.VsInputStatic=Cn,pe.VsInputSwitcher=vn,pe.VsInputTag=_r,pe.VsInputTel=Vn,pe.VsInputText=Bt,pe.VsInputTextArray=Br,pe.VsInputTextarea=fr,pe.default=Qe,pe.inputs=Fr,pe.richtextLocaleEn=Gr,pe.richtextLocaleUk=Kr,pe.richtextMessages=zn,pe.vsInputDatatable=hr,pe.vsInputMap=wr,Object.defineProperties(pe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|