@opengis/form 0.0.12 → 0.0.14
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-W-qQIppj.js +2383 -0
- package/dist/index.css +1 -1
- package/dist/index.js +2588 -4238
- package/dist/index.umd.cjs +2 -2
- package/package.json +9 -5
package/dist/index.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(n,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(n=typeof globalThis<"u"?globalThis:n||self,e(n.FormBuilder={},n.Vue))})(this,function(exports,vue){"use strict";const _hoisted_1$N={class:"w-full relative"},_hoisted_2$j={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},_hoisted_3$c={key:0,class:"text-red-500 text-[14px]"},_hoisted_4$b={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},_sfc_main$T=vue.defineComponent({__name:"vs-layout-default",props:{ua:{type:String,default:""},item:{type:Object,default:()=>({})},error:{type:String,default:""},label:{type:String,default:""}},setup(n){return(e,t)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$N,[n.ua||n.label?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$j,[vue.createElementVNode("span",null,vue.toDisplayString(n.ua||n.label),1),n.item?.rules?.includes("required")?(vue.openBlock(),vue.createElementBlock("span",_hoisted_3$c,"*")):vue.createCommentVNode("",!0)])):vue.createCommentVNode("",!0),vue.renderSlot(e.$slots,"default",vue.normalizeProps(vue.guardReactiveProps(e.$attrs))),n.error?(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$b,vue.toDisplayString(n.error),1)):vue.createCommentVNode("",!0)]))}}),_hoisted_1$M={class:"w-full relative flex flex-row items-center gap-2"},_hoisted_2$i={key:0,class:"text-sm text-gray-900 font-medium flex shrink-0 w-3/12 max-w-[250px]"},_hoisted_3$b={key:0,class:"text-red-500 text-[14px]"},_hoisted_4$a={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},_sfc_main$S=vue.defineComponent({__name:"vs-layout-horizontal",props:{ua:{type:String,default:""},item:{type:Object,default:()=>({})},error:{type:String,default:""},label:{type:String,default:""}},setup(n){return(e,t)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$M,[n.item?.type!=="html"?(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$i,[vue.createTextVNode(vue.toDisplayString(n.ua||n.label)+" ",1),n.item?.rules?.includes("required")&&(n.ua||n.label)?(vue.openBlock(),vue.createElementBlock("span",_hoisted_3$b,"*")):vue.createCommentVNode("",!0)])):vue.createCommentVNode("",!0),vue.renderSlot(e.$slots,"default",vue.normalizeProps(vue.guardReactiveProps(e.$attrs))),n.error?(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$a,vue.toDisplayString(n.error),1)):vue.createCommentVNode("",!0)]))}}),_hoisted_1$L={class:"w-full relative"},_hoisted_2$h={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},_sfc_main$R=vue.defineComponent({__name:"vs-layout-inline",props:{ua:{type:String,default:""},item:{type:Object,default:()=>({})},error:{type:String,default:""},label:{type:String,default:""}},setup(n){return(e,t)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$L,[vue.renderSlot(e.$slots,"default",vue.normalizeProps(vue.guardReactiveProps(e.$attrs))),n.error?(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$h,vue.toDisplayString(n.error),1)):vue.createCommentVNode("",!0)]))}}),layouts$1={default:_sfc_main$T,horizontal:_sfc_main$S,inline:_sfc_main$R};function useStyle(n){return{inputClass:vue.computed(()=>{const t=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${n?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return n?.size==="sm"?t+"h-[32px]":t+"h-[38px]"})}}const _hoisted_1$K=["placeholder","disabled"],_sfc_main$Q=vue.defineComponent({__name:"vs-input-text",props:vue.mergeModels({style:{type:Object,default:()=>({})},customClass:{type:String,default:""},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1},error:{type:String,default:null}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=useStyle(e.style),s=vue.useModel(n,"modelValue");return(r,a)=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("input",{type:"text","onUpdate:modelValue":a[0]||(a[0]=i=>s.value=i),placeholder:n.placeholder,disabled:n.disabled,class:vue.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f]",[vue.unref(t),{"!border-red-600":n.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,_hoisted_1$K)),[[vue.vModelText,s.value]])}}),_hoisted_1$J=["placeholder"],_sfc_main$P=vue.defineComponent({__name:"vs-input-number",props:vue.mergeModels({style:{type:Object,default:()=>({})},placeholder:{type:String,default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=useStyle(e.style),s=vue.useModel(n,"modelValue");return(r,a)=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":a[0]||(a[0]=i=>s.value=i),placeholder:n.placeholder,class:vue.normalizeClass(["py-1.5 px-3 block w-full",[vue.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,_hoisted_1$J)),[[vue.vModelText,s.value]])}}),_export_sfc=(n,e)=>{const t=n.__vccOpts||n;for(const[s,r]of e)t[s]=r;return t},_sfc_main$O={},_hoisted_1$I={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function _sfc_render$m(n,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$I,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const IconCheck=_export_sfc(_sfc_main$O,[["render",_sfc_render$m]]),_hoisted_1$H={class:"flex items-center gap-[4px]"},_hoisted_2$g=["value","id","disabled"],_hoisted_3$a=["for"],_hoisted_4$9={class:"text-[14px] text-gray-700 flex items-center gap-x-1 ml-1 dark:text-neutral-400"},_sfc_main$N=vue.defineComponent({__name:"vs-checkbox-default",props:{value:{type:[String,Number],default:""},label:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},id:{type:[String,Number]},modelValue:Boolean,info:{type:String,default:()=>""},error:{type:String,default:()=>null}},emits:["update:modelValue"],setup(n,{emit:e}){const t=e,s=n,r=vue.computed({get:()=>s.modelValue,set:a=>t("update:modelValue",a)});return(a,i)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$H,[vue.withDirectives(vue.createElementVNode("input",{type:"checkbox",value:n.value,"onUpdate:modelValue":i[0]||(i[0]=o=>r.value=o),class:vue.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":n.disabled}]),id:n.id,disabled:n.disabled},null,10,_hoisted_2$g),[[vue.vModelCheckbox,r.value]]),vue.createElementVNode("label",{for:n.id,class:vue.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":n.disabled}])},[vue.createElementVNode("div",{class:vue.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[r.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",n.error?"border-red-600":""]])},[vue.createVNode(IconCheck,{height:"12",width:"12"})],2),vue.createElementVNode("span",_hoisted_4$9,[vue.renderSlot(a.$slots,"default",{},()=>[vue.createTextVNode(vue.toDisplayString(n.label),1)])])],10,_hoisted_3$a)]))}}),_hoisted_1$G=["name","value","disabled"],_hoisted_2$f={class:"flex items-center gap-[6px] text-[14px]"},_hoisted_3$9={key:0,class:"text-[16px]"},_hoisted_4$8=["src"],_sfc_main$M=vue.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{type:[String,Number],default:""},modelValue:{type:[Array,String,Boolean],default:""},disabled:{type:Boolean,default:!1},id:{type:[String,Number]},icon:{type:String},imgUrl:{type:String},style:{type:Object,default:()=>null}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,s=e,r=vue.computed({get:()=>t.modelValue,set:o=>{s("update:modelValue",o)}}),a=vue.computed(()=>Array.isArray(r.value)?r.value.includes(t.value):r.value===!0||r.value===t.value),i=vue.computed(()=>t.style?.size==="xs"?"p-1.5 text-xs":t.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(o,l)=>(vue.openBlock(),vue.createElementBlock("label",{class:vue.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",[i.value,a.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[vue.withDirectives(vue.createElementVNode("input",{type:"checkbox",class:"hidden",name:n.id,value:n.value,"onUpdate:modelValue":l[0]||(l[0]=u=>r.value=u),disabled:n.disabled},null,8,_hoisted_1$G),[[vue.vModelCheckbox,r.value]]),vue.createElementVNode("span",_hoisted_2$f,[n.icon||n.imgUrl?(vue.openBlock(),vue.createElementBlock("span",_hoisted_3$9,[n.icon?(vue.openBlock(),vue.createElementBlock("i",{key:0,class:vue.normalizeClass(n.icon)},null,2)):vue.createCommentVNode("",!0),n.imgUrl?(vue.openBlock(),vue.createElementBlock("img",{key:1,src:n.imgUrl,width:"16",height:"16",alt:"icon"},null,8,_hoisted_4$8)):vue.createCommentVNode("",!0)])):vue.createCommentVNode("",!0),vue.renderSlot(o.$slots,"default",{},()=>[vue.createTextVNode(vue.toDisplayString(n.label),1)])])],2))}}),VsCheckboxViews={"vs-checkbox-default":_sfc_main$N,"vs-checkbox-buttons":_sfc_main$M},_hoisted_1$F={class:"flex items-center"},_sfc_main$L=vue.defineComponent({__name:"vs-input-checkbox-item",props:{value:{type:[String,Number],default:""},label:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},view:{type:String,default:()=>"default"},modelValue:{type:[Array,Boolean],default:!1},icon:{type:String},imgUrl:{type:String},slots:{type:Object,default:()=>null},option:{type:[Object,String]},style:{type:String,default:()=>null},error:{type:String,default:()=>null}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,s=e,r=`radio-${Math.floor(Math.random()*1e4)}`,a=vue.computed({get:()=>Array.isArray(t.modelValue)?Array.isArray(t.modelValue)&&t.modelValue.includes(t.value):t.modelValue,set:o=>{if(Array.isArray(t.modelValue)){let l=[...t.modelValue];o?l.includes(t.value)||l.push(t.value):l=l.filter(u=>u!==t.value),s("update:modelValue",l)}else s("update:modelValue",o)}}),i=vue.ref(`vs-checkbox-${t.view||"default"}`);return(o,l)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$F,[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(vue.unref(VsCheckboxViews)?.[i.value]),{value:n.value,label:n.label,info:n.option?.info,disabled:n.disabled,modelValue:a.value,"onUpdate:modelValue":l[0]||(l[0]=u=>a.value=u),id:r,icon:n.icon,imgUrl:n.imgUrl,style:vue.normalizeStyle(n.style),error:n.error},{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(n.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),_sfc_main$K={},_hoisted_1$E={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function _sfc_render$l(n,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$E,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const IconChevronDown=_export_sfc(_sfc_main$K,[["render",_sfc_render$l]]),_sfc_main$J={},_hoisted_1$D={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$k(n,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$D,e[0]||(e[0]=[vue.createElementVNode("path",{d:"m7 15 5 5 5-5"},null,-1),vue.createElementVNode("path",{d:"m7 9 5-5 5 5"},null,-1)]))}const IconChevronTopBottom=_export_sfc(_sfc_main$J,[["render",_sfc_render$k]]),_sfc_main$I={},_hoisted_1$C={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function _sfc_render$j(n,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$C,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),vue.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const IconClose=_export_sfc(_sfc_main$I,[["render",_sfc_render$j]]),_sfc_main$H={},_hoisted_1$B={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$i(n,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$B,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M12 9h.01"},null,-1),vue.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),vue.createElementVNode("path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z"},null,-1)]))}const IconInfo=_export_sfc(_sfc_main$H,[["render",_sfc_render$i]]),_hoisted_1$A={key:0,class:"flex items-start gap-x-1"},_hoisted_2$e={key:0,class:"text-red-500 text-[14px]"},_hoisted_3$8=["title"],_hoisted_4$7=["disabled"],_sfc_main$G=vue.defineComponent({__name:"vs-input-switcher",props:vue.mergeModels({view:{type:String,default:"switch"},label:{type:String,default:""},rules:{type:Array,default:()=>[]},i:{type:String,default:""},text:{type:String,default:""},style:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},customClass:{type:String,default:""},error:{type:String,default:""}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=vue.useModel(n,"modelValue");return(t,s)=>n.view==="checkbox"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$A,[vue.createVNode(_sfc_main$L,{modelValue:e.value,"onUpdate:modelValue":s[0]||(s[0]=r=>e.value=r),label:n.text,error:n.error},null,8,["modelValue","label","error"]),n.rules?.includes("required")?(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$e,"*")):vue.createCommentVNode("",!0),n.i?(vue.openBlock(),vue.createElementBlock("button",{key:1,class:"cursor-pointer",title:n.i,onClick:s[1]||(s[1]=vue.withModifiers(()=>{},["prevent"]))},[vue.createVNode(vue.unref(IconInfo),{class:"text-gray-500 w-[14px] h-[14px]"})],8,_hoisted_3$8)):vue.createCommentVNode("",!0)])):(vue.openBlock(),vue.createElementBlock("button",{key:1,type:"button",class:vue.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",[e.value?`bg-${n.style?.primaryColor||"blue"}-500`:"bg-stone-200",n.customClass]]),disabled:n.disabled,onClick:s[2]||(s[2]=r=>e.value=!e.value)},[vue.createElementVNode("span",{"data-state":"checked",class:vue.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[e.value?"translate-x-4":"translate-x-0"]])},null,2)],10,_hoisted_4$7))}}),_hoisted_1$z=["innerHTML"],_sfc_main$F=vue.defineComponent({__name:"vs-input-static",props:{html:{type:String,default:""},text:{type:String,default:""},customClass:{type:String,default:""}},setup(n){return(e,t)=>(vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass(n.customClass),innerHTML:(n.html==="",n.text)},null,10,_hoisted_1$z))}});function isString(n){return typeof n=="string"||n instanceof String}function isObject(n){var e;return typeof n=="object"&&n!=null&&(n==null||(e=n.constructor)==null?void 0:e.name)==="Object"}function pick(n,e){return Array.isArray(e)?pick(n,(t,s)=>e.includes(s)):Object.entries(n).reduce((t,s)=>{let[r,a]=s;return e(a,r)&&(t[r]=a),t},{})}const DIRECTION={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function forceDirection(n){switch(n){case DIRECTION.LEFT:return DIRECTION.FORCE_LEFT;case DIRECTION.RIGHT:return DIRECTION.FORCE_RIGHT;default:return n}}function escapeRegExp(n){return n.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function objectIncludes(n,e){if(e===n)return!0;const t=Array.isArray(e),s=Array.isArray(n);let r;if(t&&s){if(e.length!=n.length)return!1;for(r=0;r<e.length;r++)if(!objectIncludes(e[r],n[r]))return!1;return!0}if(t!=s)return!1;if(e&&n&&typeof e=="object"&&typeof n=="object"){const a=e instanceof Date,i=n instanceof Date;if(a&&i)return e.getTime()==n.getTime();if(a!=i)return!1;const o=e instanceof RegExp,l=n instanceof RegExp;if(o&&l)return e.toString()==n.toString();if(o!=l)return!1;const u=Object.keys(e);for(r=0;r<u.length;r++)if(!Object.prototype.hasOwnProperty.call(n,u[r]))return!1;for(r=0;r<u.length;r++)if(!objectIncludes(n[u[r]],e[u[r]]))return!1;return!0}else if(e&&n&&typeof e=="function"&&typeof n=="function")return e.toString()===n.toString();return!1}class ActionDetails{constructor(e){for(Object.assign(this,e);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?DIRECTION.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?DIRECTION.RIGHT:DIRECTION.LEFT}}function IMask(n,e){return new IMask.InputMask(n,e)}function maskedClass(n){if(n==null)throw new Error("mask property should be defined");return n instanceof RegExp?IMask.MaskedRegExp:isString(n)?IMask.MaskedPattern:n===Date?IMask.MaskedDate:n===Number?IMask.MaskedNumber:Array.isArray(n)||n===Array?IMask.MaskedDynamic:IMask.Masked&&n.prototype instanceof IMask.Masked?n:IMask.Masked&&n instanceof IMask.Masked?n.constructor:n instanceof Function?IMask.MaskedFunction:(console.warn("Mask not found for mask",n),IMask.Masked)}function normalizeOpts(n){if(!n)throw new Error("Options in not defined");if(IMask.Masked){if(n.prototype instanceof IMask.Masked)return{mask:n};const{mask:e=void 0,...t}=n instanceof IMask.Masked?{mask:n}:isObject(n)&&n.mask instanceof IMask.Masked?n:{};if(e){const s=e.mask;return{...pick(e,(r,a)=>!a.startsWith("_")),mask:e.constructor,_mask:s,...t}}}return isObject(n)?{...n}:{mask:n}}function createMask(n){if(IMask.Masked&&n instanceof IMask.Masked)return n;const e=normalizeOpts(n),t=maskedClass(e.mask);if(!t)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===t&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new t(e)}IMask.createMask=createMask;class MaskElement{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return e??this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return e??this.value.length}select(e,t){if(!(e==null||t==null||e===this.selectionStart&&t===this.selectionEnd))try{this._unsafeSelect(e,t)}catch{}}get isActive(){return!1}}IMask.MaskElement=MaskElement;const KEY_Z=90,KEY_Y=89;class HTMLMaskElement extends MaskElement{constructor(e){super(),this.input=e,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var e,t,s;return(e=(t=(s=this.input).getRootNode)==null?void 0:t.call(s))!=null?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){if(this._handlers.redo&&(e.keyCode===KEY_Z&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===KEY_Y&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===KEY_Z&&(e.metaKey||e.ctrlKey))return e.preventDefault(),this._handlers.undo(e);e.isComposing||this._handlers.selectionChange(e)}_onBeforeinput(e){if(e.inputType==="historyUndo"&&this._handlers.undo)return e.preventDefault(),this._handlers.undo(e);if(e.inputType==="historyRedo"&&this._handlers.redo)return e.preventDefault(),this._handlers.redo(e)}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}IMask.HTMLMaskElement=HTMLMaskElement;class HTMLInputMaskElement extends HTMLMaskElement{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,t){this.input.setSelectionRange(e,t)}get value(){return this.input.value}set value(e){this.input.value=e}}IMask.HTMLMaskElement=HTMLMaskElement;class HTMLContenteditableMaskElement extends HTMLMaskElement{get _unsafeSelectionStart(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,r=t&&t.focusOffset;return r==null||s==null||s<r?s:r}get _unsafeSelectionEnd(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,r=t&&t.focusOffset;return r==null||s==null||s>r?s:r}_unsafeSelect(e,t){if(!this.rootElement.createRange)return;const s=this.rootElement.createRange();s.setStart(this.input.firstChild||this.input,e),s.setEnd(this.input.lastChild||this.input,t);const r=this.rootElement,a=r.getSelection&&r.getSelection();a&&(a.removeAllRanges(),a.addRange(s))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}IMask.HTMLContenteditableMaskElement=HTMLContenteditableMaskElement;class InputHistory{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>InputHistory.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}InputHistory.MAX_LENGTH=100;class InputMask{constructor(e,t){this.el=e instanceof MaskElement?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new HTMLContenteditableMaskElement(e):new HTMLInputMaskElement(e),this.masked=createMask(t),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new InputHistory,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(e){var t;return e==null||((t=this.masked)==null?void 0:t.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof IMask.Masked)&&this.masked.constructor===maskedClass(e)){this.masked.updateOptions({mask:e});return}const t=e instanceof IMask.Masked?e:createMask({mask:e});t.unmaskedValue=this.masked.unmaskedValue,this.masked=t}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(e,t){const s=this._listeners[e];s&&s.forEach(r=>r(t))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){!this.el||!this.el.isActive||(this.el.select(e,e),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(e){const t=this.masked.unmaskedValue,s=this.masked.value,r=this.masked.rawInputValue,a=this.displayValue,i=this.unmaskedValue!==t||this.value!==s||this._rawInputValue!==r;this._unmaskedValue=t,this._value=s,this._rawInputValue=r,this.el.value!==a&&(this.el.value=a),e==="auto"?this.alignCursor():e!=null&&(this.cursorPos=e),i&&this._fireChangeEvents(),!this._historyChanging&&(i||this.history.isEmpty)&&this.history.push({unmaskedValue:t,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:t,...s}=e,r=!this.maskEquals(t),a=this.masked.optionsIsChanged(s);r&&(this.mask=t),a&&this.masked.updateOptions(s),(r||a)&&this.updateControl()}updateCursor(e){e!=null&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,DIRECTION.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,t){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),this}off(e,t){if(!this._listeners[e])return this;if(!t)return delete this._listeners[e],this;const s=this._listeners[e].indexOf(t);return s>=0&&this._listeners[e].splice(s,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const t=new ActionDetails({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),s=this.masked.rawInputValue,r=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection,{input:!0,raw:!0}).offset,a=s===this.masked.rawInputValue?t.removeDirection:DIRECTION.NONE;let i=this.masked.nearestInputPos(t.startChangePos+r,a);a!==DIRECTION.NONE&&(i=this.masked.nearestInputPos(i,DIRECTION.NONE)),this.updateControl(i),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}IMask.InputMask=InputMask;class ChangeDetails{static normalize(e){return Array.isArray(e)?e:[e,new ChangeDetails]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}IMask.ChangeDetails=ChangeDetails;class ContinuousTailDetails{constructor(e,t,s){e===void 0&&(e=""),t===void 0&&(t=0),this.value=e,this.from=t,this.stop=s}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||e!=null&&this.from>=e)return"";const t=this.value[0];return this.value=this.value.slice(1),t}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class Masked{constructor(e){this._value="",this._update({...Masked.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,t){t===void 0&&(t={input:!0}),this.reset(),this.append(e,t,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,t){return e}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),Math.min(this.displayValue.length,t-e)}extractInput(e,t,s){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),this.displayValue.slice(e,t)}extractTail(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),new ContinuousTailDetails(this.extractInput(e,t),e)}appendTail(e){return isString(e)&&(e=new ContinuousTailDetails(String(e))),e.appendTo(this)}_appendCharRaw(e,t){return e?(this._value+=e,new ChangeDetails({inserted:e,rawInserted:e})):new ChangeDetails}_appendChar(e,t,s){t===void 0&&(t={});const r=this.state;let a;if([e,a]=this.doPrepareChar(e,t),e&&(a=a.aggregate(this._appendCharRaw(e,t)),!a.rawInserted&&this.autofix==="pad")){const i=this.state;this.state=r;let o=this.pad(t);const l=this._appendCharRaw(e,t);o=o.aggregate(l),l.rawInserted||o.equals(a)?a=o:this.state=i}if(a.inserted){let i,o=this.doValidate(t)!==!1;if(o&&s!=null){const l=this.state;if(this.overwrite===!0){i=s.state;for(let d=0;d<a.rawInserted.length;++d)s.unshift(this.displayValue.length-a.tailShift)}let u=this.appendTail(s);if(o=u.rawInserted.length===s.toString().length,!(o&&u.inserted)&&this.overwrite==="shift"){this.state=l,i=s.state;for(let d=0;d<a.rawInserted.length;++d)s.shift();u=this.appendTail(s),o=u.rawInserted.length===s.toString().length}o&&u.inserted&&(this.state=l)}o||(a=new ChangeDetails,this.state=r,s&&i&&(s.state=i))}return a}_appendPlaceholder(){return new ChangeDetails}_appendEager(){return new ChangeDetails}append(e,t,s){if(!isString(e))throw new Error("value should be string");const r=isString(s)?new ContinuousTailDetails(String(s)):s;t!=null&&t.tail&&(t._beforeTailState=this.state);let a;[e,a]=this.doPrepare(e,t);for(let i=0;i<e.length;++i){const o=this._appendChar(e[i],t,r);if(!o.rawInserted&&!this.doSkipInvalid(e[i],t,r))break;a.aggregate(o)}return(this.eager===!0||this.eager==="append")&&t!=null&&t.input&&e&&a.aggregate(this._appendEager()),r!=null&&(a.tailShift+=this.appendTail(r).tailShift),a}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(t),new ChangeDetails}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const t=this.rawInputValue,s=this.value,r=e();return this.rawInputValue=t,this.value&&this.value!==s&&s.indexOf(this.value)===0&&(this.append(s.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,r}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const t=this.state,s=e(this);return this.state=t,delete this._isolated,s}doSkipInvalid(e,t,s){return!!this.skipInvalid}doPrepare(e,t){return t===void 0&&(t={}),ChangeDetails.normalize(this.prepare?this.prepare(e,this,t):e)}doPrepareChar(e,t){return t===void 0&&(t={}),ChangeDetails.normalize(this.prepareChar?this.prepareChar(e,this,t):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,t,s,r,a){s===void 0&&(s=""),r===void 0&&(r=DIRECTION.NONE),a===void 0&&(a={input:!0});const i=e+t,o=this.extractTail(i),l=this.eager===!0||this.eager==="remove";let u;l&&(r=forceDirection(r),u=this.extractInput(0,i,{raw:!0}));let d=e;const h=new ChangeDetails;if(r!==DIRECTION.NONE&&(d=this.nearestInputPos(e,t>1&&e!==0&&!l?DIRECTION.NONE:r),h.tailShift=d-e),h.aggregate(this.remove(d)),l&&r!==DIRECTION.NONE&&u===this.rawInputValue)if(r===DIRECTION.FORCE_LEFT){let c;for(;u===this.rawInputValue&&(c=this.displayValue.length);)h.aggregate(new ChangeDetails({tailShift:-1})).aggregate(this.remove(c-1))}else r===DIRECTION.FORCE_RIGHT&&o.unshift();return h.aggregate(this.append(s,a,o))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!objectIncludes(this,e)}typedValueEquals(e){const t=this.typedValue;return e===t||Masked.EMPTY_VALUES.includes(e)&&Masked.EMPTY_VALUES.includes(t)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new ChangeDetails}}Masked.DEFAULTS={skipInvalid:!0},Masked.EMPTY_VALUES=[void 0,null,""],IMask.Masked=Masked;class ChunksTailDetails{constructor(e,t){e===void 0&&(e=[]),t===void 0&&(t=0),this.chunks=e,this.from=t}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=isString(e)?new ContinuousTailDetails(String(e)):e;const t=this.chunks[this.chunks.length-1],s=t&&(t.stop===e.stop||e.stop==null)&&e.from===t.from+t.toString().length;if(e instanceof ContinuousTailDetails)s?t.extend(e.toString()):this.chunks.push(e);else if(e instanceof ChunksTailDetails){if(e.stop==null){let r;for(;e.chunks.length&&e.chunks[0].stop==null;)r=e.chunks.shift(),r.from+=e.from,this.extend(r)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof IMask.MaskedPattern))return new ContinuousTailDetails(this.toString()).appendTo(e);const t=new ChangeDetails;for(let s=0;s<this.chunks.length;++s){const r=this.chunks[s],a=e._mapPosToBlock(e.displayValue.length),i=r.stop;let o;if(i!=null&&(!a||a.index<=i)&&((r instanceof ChunksTailDetails||e._stops.indexOf(i)>=0)&&t.aggregate(e._appendPlaceholder(i)),o=r instanceof ChunksTailDetails&&e._blocks[i]),o){const l=o.appendTail(r);t.aggregate(l);const u=r.toString().slice(l.rawInserted.length);u&&t.aggregate(e.append(u,{tail:!0}))}else t.aggregate(e.append(r.toString(),{tail:!0}))}return t}get state(){return{chunks:this.chunks.map(e=>e.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:t,...s}=e;Object.assign(this,s),this.chunks=t.map(r=>{const a="chunks"in r?new ChunksTailDetails:new ContinuousTailDetails;return a.state=r,a})}unshift(e){if(!this.chunks.length||e!=null&&this.from>=e)return"";const t=e!=null?e-this.from:e;let s=0;for(;s<this.chunks.length;){const r=this.chunks[s],a=r.unshift(t);if(r.toString()){if(!a)break;++s}else this.chunks.splice(s,1);if(a)return a}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const t=this.chunks[e],s=t.shift();if(t.toString()){if(!s)break;--e}else this.chunks.splice(e,1);if(s)return s}return""}}class PatternCursor{constructor(e,t){this.masked=e,this._log=[];const{offset:s,index:r}=e._mapPosToBlock(t)||(t<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=s,this.index=r,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((t=this.block)==null?void 0:t.displayValue.length)||0){var t;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,DIRECTION.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,DIRECTION.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,DIRECTION.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,DIRECTION.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,DIRECTION.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,DIRECTION.NONE),!0})}}class PatternFixedDefinition{constructor(e){Object.assign(this,e),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(t),this._value||(this._isRawInput=!1),new ChangeDetails}nearestInputPos(e,t){t===void 0&&(t=DIRECTION.NONE);const s=0,r=this._value.length;switch(t){case DIRECTION.LEFT:case DIRECTION.FORCE_LEFT:return s;case DIRECTION.NONE:case DIRECTION.RIGHT:case DIRECTION.FORCE_RIGHT:default:return r}}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),this._isRawInput?t-e:0}extractInput(e,t,s){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),s===void 0&&(s={}),s.raw&&this._isRawInput&&this._value.slice(e,t)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(e,t){if(t===void 0&&(t={}),this.isFilled)return new ChangeDetails;const s=this.eager===!0||this.eager==="append",a=this.char===e&&(this.isUnmasking||t.input||t.raw)&&(!t.raw||!s)&&!t.tail,i=new ChangeDetails({inserted:this.char,rawInserted:a?this.char:""});return this._value=this.char,this._isRawInput=a&&(t.raw||t.input),i}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new ChangeDetails;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new ContinuousTailDetails("")}appendTail(e){return isString(e)&&(e=new ContinuousTailDetails(String(e))),e.appendTo(this)}append(e,t,s){const r=this._appendChar(e[0],t);return s!=null&&(r.tailShift+=this.appendTail(s).tailShift),r}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=!!e._rawInputValue}pad(e){return this._appendPlaceholder()}}class PatternInputDefinition{constructor(e){const{parent:t,isOptional:s,placeholderChar:r,displayChar:a,lazy:i,eager:o,...l}=e;this.masked=createMask(l),Object.assign(this,{parent:t,isOptional:s,placeholderChar:r,displayChar:a,lazy:i,eager:o})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),e===0&&t>=1?(this.isFilled=!1,this.masked.remove(e,t)):new ChangeDetails}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(e,t){if(t===void 0&&(t={}),this.isFilled)return new ChangeDetails;const s=this.masked.state;let r=this.masked._appendChar(e,this.currentMaskFlags(t));return r.inserted&&this.doValidate(t)===!1&&(r=new ChangeDetails,this.masked.state=s),!r.inserted&&!this.isOptional&&!this.lazy&&!t.input&&(r.inserted=this.placeholderChar),r.skip=!r.inserted&&!this.isOptional,this.isFilled=!!r.inserted,r}append(e,t,s){return this.masked.append(e,this.currentMaskFlags(t),s)}_appendPlaceholder(){return this.isFilled||this.isOptional?new ChangeDetails:(this.isFilled=!0,new ChangeDetails({inserted:this.placeholderChar}))}_appendEager(){return new ChangeDetails}extractTail(e,t){return this.masked.extractTail(e,t)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,t,s){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),this.masked.extractInput(e,t,s)}nearestInputPos(e,t){t===void 0&&(t=DIRECTION.NONE);const s=0,r=this.value.length,a=Math.min(Math.max(e,s),r);switch(t){case DIRECTION.LEFT:case DIRECTION.FORCE_LEFT:return this.isComplete?a:s;case DIRECTION.RIGHT:case DIRECTION.FORCE_RIGHT:return this.isComplete?a:r;case DIRECTION.NONE:default:return a}}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),this.value.slice(e,t).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var t;return{...e,_beforeTailState:(e==null||(t=e._beforeTailState)==null?void 0:t.masked)||e?._beforeTailState}}pad(e){return new ChangeDetails}}PatternInputDefinition.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 MaskedRegExp extends Masked{updateOptions(e){super.updateOptions(e)}_update(e){const t=e.mask;t&&(e.validate=s=>s.search(t)>=0),super._update(e)}}IMask.MaskedRegExp=MaskedRegExp;class MaskedPattern extends Masked{constructor(e){super({...MaskedPattern.DEFAULTS,...e,definitions:Object.assign({},PatternInputDefinition.DEFAULT_DEFINITIONS,e?.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const t=this.mask;if(!t||!e)return;let s=!1,r=!1;for(let a=0;a<t.length;++a){if(this.blocks){const u=t.slice(a),d=Object.keys(this.blocks).filter(c=>u.indexOf(c)===0);d.sort((c,v)=>v.length-c.length);const h=d[0];if(h){const{expose:c,repeat:v,...C}=normalizeOpts(this.blocks[h]),B={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...C,repeat:v,parent:this},I=v!=null?new IMask.RepeatBlock(B):createMask(B);I&&(this._blocks.push(I),c&&(this.exposeBlock=I),this._maskedBlocks[h]||(this._maskedBlocks[h]=[]),this._maskedBlocks[h].push(this._blocks.length-1)),a+=h.length-1;continue}}let i=t[a],o=i in e;if(i===MaskedPattern.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(i==="{"||i==="}"){s=!s;continue}if(i==="["||i==="]"){r=!r;continue}if(i===MaskedPattern.ESCAPE_CHAR){if(++a,i=t[a],!i)break;o=!1}const l=o?new PatternInputDefinition({isOptional:r,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...normalizeOpts(e[i]),parent:this}):new PatternFixedDefinition({char:i,eager:this.eager,isUnmasking:s});this._blocks.push(l)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e){this.reset();return}const{_blocks:t,...s}=e;this._blocks.forEach((r,a)=>r.state=t[a]),super.state=s}reset(){super.reset(),this._blocks.forEach(e=>e.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(e=>e.isComplete)}get isFilled(){return this._blocks.every(e=>e.isFilled)}get isFixed(){return this._blocks.every(e=>e.isFixed)}get isOptional(){return this._blocks.every(e=>e.isOptional)}doCommit(){this._blocks.forEach(e=>e.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((e,t)=>e+=t.unmaskedValue,"")}set unmaskedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(t),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((e,t)=>e+=t.value,"")}set value(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(t),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(t),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce((e,t)=>e+=t.displayValue,"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const t=new ChangeDetails;let s=(e=this._mapPosToBlock(this.displayValue.length))==null?void 0:e.index;if(s==null)return t;this._blocks[s].isFilled&&++s;for(let r=s;r<this._blocks.length;++r){const a=this._blocks[r]._appendEager();if(!a.inserted)break;t.aggregate(a)}return t}_appendCharRaw(e,t){t===void 0&&(t={});const s=this._mapPosToBlock(this.displayValue.length),r=new ChangeDetails;if(!s)return r;for(let i=s.index,o;o=this._blocks[i];++i){var a;const l=o._appendChar(e,{...t,_beforeTailState:(a=t._beforeTailState)==null||(a=a._blocks)==null?void 0:a[i]});if(r.aggregate(l),l.consumed)break}return r}extractTail(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const s=new ChunksTailDetails;return e===t||this._forEachBlocksInRange(e,t,(r,a,i,o)=>{const l=r.extractTail(i,o);l.stop=this._findStopBefore(a),l.from=this._blockStartPos(a),l instanceof ChunksTailDetails&&(l.blockIndex=a),s.extend(l)}),s}extractInput(e,t,s){if(e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),s===void 0&&(s={}),e===t)return"";let r="";return this._forEachBlocksInRange(e,t,(a,i,o,l)=>{r+=a.extractInput(o,l,s)}),r}_findStopBefore(e){let t;for(let s=0;s<this._stops.length;++s){const r=this._stops[s];if(r<=e)t=r;else break}return t}_appendPlaceholder(e){const t=new ChangeDetails;if(this.lazy&&e==null)return t;const s=this._mapPosToBlock(this.displayValue.length);if(!s)return t;const r=s.index,a=e??this._blocks.length;return this._blocks.slice(r,a).forEach(i=>{if(!i.lazy||e!=null){var o;t.aggregate(i._appendPlaceholder((o=i._blocks)==null?void 0:o.length))}}),t}_mapPosToBlock(e){let t="";for(let s=0;s<this._blocks.length;++s){const r=this._blocks[s],a=t.length;if(t+=r.displayValue,e<=t.length)return{index:s,offset:e-a}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce((t,s)=>t+=s.displayValue.length,0)}_forEachBlocksInRange(e,t,s){t===void 0&&(t=this.displayValue.length);const r=this._mapPosToBlock(e);if(r){const a=this._mapPosToBlock(t),i=a&&r.index===a.index,o=r.offset,l=a&&i?a.offset:this._blocks[r.index].displayValue.length;if(s(this._blocks[r.index],r.index,o,l),a&&!i){for(let u=r.index+1;u<a.index;++u)s(this._blocks[u],u,0,this._blocks[u].displayValue.length);s(this._blocks[a.index],a.index,0,a.offset)}}}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const s=super.remove(e,t);return this._forEachBlocksInRange(e,t,(r,a,i,o)=>{s.aggregate(r.remove(i,o))}),s}nearestInputPos(e,t){if(t===void 0&&(t=DIRECTION.NONE),!this._blocks.length)return 0;const s=new PatternCursor(this,e);if(t===DIRECTION.NONE)return s.pushRightBeforeInput()||(s.popState(),s.pushLeftBeforeInput())?s.pos:this.displayValue.length;if(t===DIRECTION.LEFT||t===DIRECTION.FORCE_LEFT){if(t===DIRECTION.LEFT){if(s.pushRightBeforeFilled(),s.ok&&s.pos===e)return e;s.popState()}if(s.pushLeftBeforeInput(),s.pushLeftBeforeRequired(),s.pushLeftBeforeFilled(),t===DIRECTION.LEFT){if(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.ok&&s.pos<=e||(s.popState(),s.ok&&s.pos<=e))return s.pos;s.popState()}return s.ok?s.pos:t===DIRECTION.FORCE_LEFT?0:(s.popState(),s.ok||(s.popState(),s.ok)?s.pos:0)}return t===DIRECTION.RIGHT||t===DIRECTION.FORCE_RIGHT?(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.pushRightBeforeFilled()?s.pos:t===DIRECTION.FORCE_RIGHT?this.displayValue.length:(s.popState(),s.ok||(s.popState(),s.ok)?s.pos:this.nearestInputPos(e,DIRECTION.LEFT))):e}totalInputPositions(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);let s=0;return this._forEachBlocksInRange(e,t,(r,a,i,o)=>{s+=r.totalInputPositions(i,o)}),s}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const t=this._maskedBlocks[e];return t?t.map(s=>this._blocks[s]):[]}pad(e){const t=new ChangeDetails;return this._forEachBlocksInRange(0,this.displayValue.length,s=>t.aggregate(s.pad(e))),t}}MaskedPattern.DEFAULTS={...Masked.DEFAULTS,lazy:!0,placeholderChar:"_"},MaskedPattern.STOP_CHAR="`",MaskedPattern.ESCAPE_CHAR="\\",MaskedPattern.InputDefinition=PatternInputDefinition,MaskedPattern.FixedDefinition=PatternFixedDefinition,IMask.MaskedPattern=MaskedPattern;class MaskedRange extends MaskedPattern{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:t=this.to||0,from:s=this.from||0,maxLength:r=this.maxLength||0,autofix:a=this.autofix,...i}=e;this.to=t,this.from=s,this.maxLength=Math.max(String(t).length,r),this.autofix=a;const o=String(this.from).padStart(this.maxLength,"0"),l=String(this.to).padStart(this.maxLength,"0");let u=0;for(;u<l.length&&l[u]===o[u];)++u;i.mask=l.slice(0,u).replace(/0/g,"\\0")+"0".repeat(this.maxLength-u),super._update(i)}get isComplete(){return super.isComplete&&!!this.value}boundaries(e){let t="",s="";const[,r,a]=e.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(t="0".repeat(r.length)+a,s="9".repeat(r.length)+a),t=t.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[t,s]}doPrepareChar(e,t){t===void 0&&(t={});let s;return[e,s]=super.doPrepareChar(e.replace(/\D/g,""),t),e||(s.skip=!this.isComplete),[e,s]}_appendCharRaw(e,t){if(t===void 0&&(t={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,t);const s=String(this.from).padStart(this.maxLength,"0"),r=String(this.to).padStart(this.maxLength,"0"),[a,i]=this.boundaries(this.value+e);return Number(i)<this.from?super._appendCharRaw(s[this.value.length],t):Number(a)>this.to?!t.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(s[this.value.length],t).aggregate(this._appendCharRaw(e,t)):super._appendCharRaw(r[this.value.length],t):super._appendCharRaw(e,t)}doValidate(e){const t=this.value;if(t.search(/[^0]/)===-1&&t.length<=this._matchFrom)return!0;const[r,a]=this.boundaries(t);return this.from<=Number(a)&&Number(r)<=this.to&&super.doValidate(e)}pad(e){const t=new ChangeDetails;if(this.value.length===this.maxLength)return t;const s=this.value,r=this.maxLength-this.value.length;if(r){this.reset();for(let a=0;a<r;++a)t.aggregate(super._appendCharRaw("0",e));s.split("").forEach(a=>this._appendCharRaw(a))}return t}}IMask.MaskedRange=MaskedRange;const DefaultPattern="d{.}`m{.}`Y";class MaskedDate extends MaskedPattern{static extractPatternOptions(e){const{mask:t,pattern:s,...r}=e;return{...r,mask:isString(t)?t:s}}constructor(e){super(MaskedDate.extractPatternOptions({...MaskedDate.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:t,pattern:s,blocks:r,...a}={...MaskedDate.DEFAULTS,...e},i=Object.assign({},MaskedDate.GET_DEFAULT_BLOCKS());e.min&&(i.Y.from=e.min.getFullYear()),e.max&&(i.Y.to=e.max.getFullYear()),e.min&&e.max&&i.Y.from===i.Y.to&&(i.m.from=e.min.getMonth()+1,i.m.to=e.max.getMonth()+1,i.m.from===i.m.to&&(i.d.from=e.min.getDate(),i.d.to=e.max.getDate())),Object.assign(i,this.blocks,r),super._update({...a,mask:isString(t)?t:s,blocks:i})}doValidate(e){const t=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&t!=null&&(this.min==null||this.min<=t)&&(this.max==null||t<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(MaskedDate.extractPatternOptions(e))}}MaskedDate.GET_DEFAULT_BLOCKS=()=>({d:{mask:MaskedRange,from:1,to:31,maxLength:2},m:{mask:MaskedRange,from:1,to:12,maxLength:2},Y:{mask:MaskedRange,from:1900,to:9999}}),MaskedDate.DEFAULTS={...MaskedPattern.DEFAULTS,mask:Date,pattern:DefaultPattern,format:(n,e)=>{if(!n)return"";const t=String(n.getDate()).padStart(2,"0"),s=String(n.getMonth()+1).padStart(2,"0"),r=n.getFullYear();return[t,s,r].join(".")},parse:(n,e)=>{const[t,s,r]=n.split(".").map(Number);return new Date(r,s-1,t)}},IMask.MaskedDate=MaskedDate;class MaskedDynamic extends Masked{constructor(e){super({...MaskedDynamic.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map(t=>{const{expose:s,...r}=normalizeOpts(t),a=createMask({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...r});return s&&(this.exposeMask=a),a}):[])}_appendCharRaw(e,t){t===void 0&&(t={});const s=this._applyDispatch(e,t);return this.currentMask&&s.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(t))),s}_applyDispatch(e,t,s){e===void 0&&(e=""),t===void 0&&(t={}),s===void 0&&(s="");const r=t.tail&&t._beforeTailState!=null?t._beforeTailState._value:this.value,a=this.rawInputValue,i=t.tail&&t._beforeTailState!=null?t._beforeTailState._rawInputValue:a,o=a.slice(i.length),l=this.currentMask,u=new ChangeDetails,d=l?.state;return this.currentMask=this.doDispatch(e,{...t},s),this.currentMask&&(this.currentMask!==l?(this.currentMask.reset(),i&&(this.currentMask.append(i,{raw:!0}),u.tailShift=this.currentMask.value.length-r.length),o&&(u.tailShift+=this.currentMask.append(o,{raw:!0,tail:!0}).tailShift)):d&&(this.currentMask.state=d)),u}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const t=new ChangeDetails;return e&&t.aggregate(this._applyDispatch("",{},e)),t.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var t,s;return{...e,_beforeTailState:((t=e._beforeTailState)==null?void 0:t.currentMaskRef)===this.currentMask&&((s=e._beforeTailState)==null?void 0:s.currentMask)||e._beforeTailState}}doDispatch(e,t,s){return t===void 0&&(t={}),s===void 0&&(s=""),this.dispatch(e,this,t,s)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,t){t===void 0&&(t={});let[s,r]=super.doPrepare(e,t);if(this.currentMask){let a;[s,a]=super.doPrepare(s,this.currentMaskFlags(t)),r=r.aggregate(a)}return[s,r]}doPrepareChar(e,t){t===void 0&&(t={});let[s,r]=super.doPrepareChar(e,t);if(this.currentMask){let a;[s,a]=super.doPrepareChar(s,this.currentMaskFlags(t)),r=r.aggregate(a)}return[s,r]}reset(){var e;(e=this.currentMask)==null||e.reset(),this.compiledMasks.forEach(t=>t.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask){this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,this._applyDispatch();return}let t=String(e);this.currentMask&&(this.currentMask.typedValue=e,t=this.currentMask.unmaskedValue),this.unmaskedValue=t}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return!!((e=this.currentMask)!=null&&e.isComplete)}get isFilled(){var e;return!!((e=this.currentMask)!=null&&e.isFilled)}remove(e,t){const s=new ChangeDetails;return this.currentMask&&s.aggregate(this.currentMask.remove(e,t)).aggregate(this._applyDispatch()),s}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(t=>t.state),currentMaskRef:this.currentMask,currentMask:(e=this.currentMask)==null?void 0:e.state}}set state(e){const{compiledMasks:t,currentMaskRef:s,currentMask:r,...a}=e;t&&this.compiledMasks.forEach((i,o)=>i.state=t[o]),s!=null&&(this.currentMask=s,this.currentMask.state=r),super.state=a}extractInput(e,t,s){return this.currentMask?this.currentMask.extractInput(e,t,s):""}extractTail(e,t){return this.currentMask?this.currentMask.extractTail(e,t):super.extractTail(e,t)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,t){return this.currentMask?this.currentMask.nearestInputPos(e,t):super.nearestInputPos(e,t)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every((t,s)=>{if(!e[s])return;const{mask:r,...a}=e[s];return objectIncludes(t,a)&&t.maskEquals(r)}):super.maskEquals(e)}typedValueEquals(e){var t;return!!((t=this.currentMask)!=null&&t.typedValueEquals(e))}}MaskedDynamic.DEFAULTS={...Masked.DEFAULTS,dispatch:(n,e,t,s)=>{if(!e.compiledMasks.length)return;const r=e.rawInputValue,a=e.compiledMasks.map((i,o)=>{const l=e.currentMask===i,u=l?i.displayValue.length:i.nearestInputPos(i.displayValue.length,DIRECTION.FORCE_LEFT);return i.rawInputValue!==r?(i.reset(),i.append(r,{raw:!0})):l||i.remove(u),i.append(n,e.currentMaskFlags(t)),i.appendTail(s),{index:o,weight:i.rawInputValue.length,totalInputPositions:i.totalInputPositions(0,Math.max(u,i.nearestInputPos(i.displayValue.length,DIRECTION.FORCE_LEFT)))}});return a.sort((i,o)=>o.weight-i.weight||o.totalInputPositions-i.totalInputPositions),e.compiledMasks[a[0].index]}},IMask.MaskedDynamic=MaskedDynamic;class MaskedEnum extends MaskedPattern{constructor(e){super({...MaskedEnum.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:t,...s}=e;if(t){const r=t.map(o=>o.length),a=Math.min(...r),i=Math.max(...r)-a;s.mask="*".repeat(a),i&&(s.mask+="["+"*".repeat(i)+"]"),this.enum=t}super._update(s)}_appendCharRaw(e,t){t===void 0&&(t={});const s=Math.min(this.nearestInputPos(0,DIRECTION.FORCE_RIGHT),this.value.length),r=this.enum.filter(a=>this.matchValue(a,this.unmaskedValue+e,s));if(r.length){r.length===1&&this._forEachBlocksInRange(0,this.value.length,(i,o)=>{const l=r[0][o];o>=this.value.length||l===i.value||(i.reset(),i._appendChar(l,t))});const a=super._appendCharRaw(r[0][this.value.length],t);return r.length===1&&r[0].slice(this.unmaskedValue.length).split("").forEach(i=>a.aggregate(super._appendCharRaw(i))),a}return new ChangeDetails({skip:!this.isComplete})}extractTail(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),new ContinuousTailDetails("",e)}remove(e,t){if(e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),e===t)return new ChangeDetails;const s=Math.min(super.nearestInputPos(0,DIRECTION.FORCE_RIGHT),this.value.length);let r;for(r=e;r>=0&&!(this.enum.filter(o=>this.matchValue(o,this.value.slice(s,r),s)).length>1);--r);const a=super.remove(r,t);return a.tailShift+=r-e,a}get isComplete(){return this.enum.indexOf(this.value)>=0}}MaskedEnum.DEFAULTS={...MaskedPattern.DEFAULTS,matchValue:(n,e,t)=>n.indexOf(e,t)===t},IMask.MaskedEnum=MaskedEnum;class MaskedFunction extends Masked{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}IMask.MaskedFunction=MaskedFunction;var _MaskedNumber;class MaskedNumber extends Masked{constructor(e){super({...MaskedNumber.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),t="\\d*",s=(this.scale?"("+escapeRegExp(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+t+s),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(escapeRegExp).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(escapeRegExp(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const t=e.split(this.radix);return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),t.join(this.radix)}doPrepareChar(e,t){t===void 0&&(t={});const[s,r]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(t.input&&t.raw||!t.input&&!t.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),t);return e&&!s&&(r.skip=!0),s&&!this.allowPositive&&!this.value&&s!=="-"&&r.aggregate(this._appendChar("-")),[s,r]}_separatorsCount(e,t){t===void 0&&(t=!1);let s=0;for(let r=0;r<e;++r)this._value.indexOf(this.thousandsSeparator,r)===r&&(++s,t&&(e+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(e){return e===void 0&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,t,s){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t),this._removeThousandsSeparators(super.extractInput(e,t,s))}_appendCharRaw(e,t){t===void 0&&(t={});const s=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,r=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);const a=this._value;this._value+=e;const i=this.number;let o=!isNaN(i),l=!1;if(o){let c;this.min!=null&&this.min<0&&this.number<this.min&&(c=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(c=this.max),c!=null&&(this.autofix?(this._value=this.format(c,this).replace(MaskedNumber.UNMASKED_RADIX,this.radix),l||(l=a===this._value&&!t.tail)):o=!1),o&&(o=!!this._value.match(this._numberRegExp))}let u;o?u=new ChangeDetails({inserted:this._value.slice(a.length),rawInserted:l?"":e,skip:l}):(this._value=a,u=new ChangeDetails),this._value=this._insertThousandsSeparators(this._value);const d=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,h=this._separatorsCountFromSlice(d);return u.tailShift+=(h-r)*this.thousandsSeparator.length,u}_findSeparatorAround(e){if(this.thousandsSeparator){const t=e-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,t);if(s<=e)return s}return-1}_adjustRangeWithSeparators(e,t){const s=this._findSeparatorAround(e);s>=0&&(e=s);const r=this._findSeparatorAround(t);return r>=0&&(t=r+this.thousandsSeparator.length),[e,t]}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t);const s=this.value.slice(0,e),r=this.value.slice(t),a=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+r));const i=this._separatorsCountFromSlice(s);return new ChangeDetails({tailShift:(i-a)*this.thousandsSeparator.length})}nearestInputPos(e,t){if(!this.thousandsSeparator)return e;switch(t){case DIRECTION.NONE:case DIRECTION.LEFT:case DIRECTION.FORCE_LEFT:{const s=this._findSeparatorAround(e-1);if(s>=0){const r=s+this.thousandsSeparator.length;if(e<r||this.value.length<=r||t===DIRECTION.FORCE_LEFT)return s}break}case DIRECTION.RIGHT:case DIRECTION.FORCE_RIGHT:{const s=this._findSeparatorAround(e);if(s>=0)return s+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let t=e;this.min!=null&&(t=Math.max(t,this.min)),this.max!=null&&(t=Math.min(t,this.max)),t!==e&&(this.unmaskedValue=this.format(t,this));let s=this.value;this.normalizeZeros&&(s=this._normalizeZeros(s)),this.padFractionalZeros&&this.scale>0&&(s=this._padFractionalZeros(s)),this._value=s}super.doCommit()}_normalizeZeros(e){const t=this._removeThousandsSeparators(e).split(this.radix);return t[0]=t[0].replace(/^(\D*)(0*)(\d*)/,(s,r,a,i)=>r+i),e.length&&!/\d$/.test(t[0])&&(t[0]=t[0]+"0"),t.length>1&&(t[1]=t[1].replace(/0*$/,""),t[1].length||(t.length=1)),this._insertThousandsSeparators(t.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const t=e.split(this.radix);return t.length<2&&t.push(""),t[1]=t[1].padEnd(this.scale,"0"),t.join(this.radix)}doSkipInvalid(e,t,s){t===void 0&&(t={});const r=this.scale===0&&e!==this.thousandsSeparator&&(e===this.radix||e===MaskedNumber.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,t,s)&&!r}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,MaskedNumber.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(MaskedNumber.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(e){return(super.typedValueEquals(e)||MaskedNumber.EMPTY_VALUES.includes(e)&&MaskedNumber.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}_MaskedNumber=MaskedNumber,MaskedNumber.UNMASKED_RADIX=".",MaskedNumber.EMPTY_VALUES=[...Masked.EMPTY_VALUES,0],MaskedNumber.DEFAULTS={...Masked.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[_MaskedNumber.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:n=>n.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},IMask.MaskedNumber=MaskedNumber;const PIPE_TYPE={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function createPipe(n,e,t){e===void 0&&(e=PIPE_TYPE.MASKED),t===void 0&&(t=PIPE_TYPE.MASKED);const s=createMask(n);return r=>s.runIsolated(a=>(a[e]=r,a[t]))}function pipe(n,e,t,s){return createPipe(e,t,s)(n)}IMask.PIPE_TYPE=PIPE_TYPE,IMask.createPipe=createPipe,IMask.pipe=pipe;class RepeatBlock extends MaskedPattern{get repeatFrom(){var e;return(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?e:0}get repeatTo(){var e;return(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var t,s,r;const{repeat:a,...i}=normalizeOpts(e);this._blockOpts=Object.assign({},this._blockOpts,i);const o=createMask(this._blockOpts);this.repeat=(t=(s=a??o.repeat)!=null?s:this.repeat)!=null?t:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((r=this._blocks)==null?void 0:r.length)||0,this.repeatFrom)),blocks:{m:o},eager:o.eager,overwrite:o.overwrite,skipInvalid:o.skipInvalid,lazy:o.lazy,placeholderChar:o.placeholderChar,displayChar:o.displayChar})}_allocateBlock(e){if(e<this._blocks.length)return this._blocks[e];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(createMask(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(e,t){t===void 0&&(t={});const s=new ChangeDetails;for(let l=(r=(a=this._mapPosToBlock(this.displayValue.length))==null?void 0:a.index)!=null?r:Math.max(this._blocks.length-1,0),u,d;u=(i=this._blocks[l])!=null?i:d=!d&&this._allocateBlock(l);++l){var r,a,i,o;const h=u._appendChar(e,{...t,_beforeTailState:(o=t._beforeTailState)==null||(o=o._blocks)==null?void 0:o[l]});if(h.skip&&d){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(s.aggregate(h),h.consumed)break}return s}_trimEmptyTail(e,t){var s,r;e===void 0&&(e=0);const a=Math.max(((s=this._mapPosToBlock(e))==null?void 0:s.index)||0,this.repeatFrom,0);let i;t!=null&&(i=(r=this._mapPosToBlock(t))==null?void 0:r.index),i==null&&(i=this._blocks.length-1);let o=0;for(let l=i;a<=l&&!this._blocks[l].unmaskedValue;--l,++o);o&&(this._blocks.splice(i-o+1,o),this.mask=this.mask.slice(o))}reset(){super.reset(),this._trimEmptyTail()}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const s=super.remove(e,t);return this._trimEmptyTail(e,t),s}totalInputPositions(e,t){return e===void 0&&(e=0),t==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,t)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}}IMask.RepeatBlock=RepeatBlock;try{globalThis.IMask=IMask}catch{}const _hoisted_1$y=["placeholder","disabled"],_sfc_main$E=vue.defineComponent({__name:"vs-input-mask",props:vue.mergeModels({style:{default:()=>({})},customClass:{default:""},placeholder:{default:""},disabled:{type:Boolean,default:!1},mask:{default:""},unmask:{type:Boolean,default:!1},placeholderChar:{default:"_"}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=useStyle(e.style),s=vue.useModel(n,"modelValue"),r=vue.ref(null);let a=null;return vue.onMounted(()=>{r.value&&(a=IMask(r.value,{mask:e.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1,placeholderChar:"_"}),a.on("accept",()=>{s.value=e.unmask?a.unmaskedValue:a.value}),a.on("complete",()=>{s.value=e.unmask?a.unmaskedValue:a.value}),a.value=s.value??"")}),vue.onBeforeUnmount(()=>{a?.destroy()}),vue.watch(()=>e.mask,i=>{a&&a.updateOptions({mask:i,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),vue.watch(s,i=>{a&&a.unmaskedValue!==i&&(a.value=i||"")}),(i,o)=>(vue.openBlock(),vue.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:r,placeholder:i.placeholder,disabled:i.disabled,class:vue.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f]",[vue.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,_hoisted_1$y))}}),_hoisted_1$x=["innerHTML"],_sfc_main$D=vue.defineComponent({__name:"vs-input-html",props:{text:{type:String,default:""}},setup(n){const e=n;return(t,s)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createElementVNode("div",{innerHTML:e?.text},null,8,_hoisted_1$x)]))}}),_hoisted_1$w={class:"relative w-full bg-white rounded-lg"},_hoisted_2$d=["placeholder","disabled"],_sfc_main$C=vue.defineComponent({__name:"vs-input-email",props:vue.mergeModels({style:{type:Object,default:()=>({})},customClass:{type:String,default:""},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1},error:{type:String,default:null}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=useStyle(e.style),s=vue.useModel(n,"modelValue");return(r,a)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$w,[a[1]||(a[1]=vue.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),vue.withDirectives(vue.createElementVNode("input",{type:"email","onUpdate:modelValue":a[0]||(a[0]=i=>s.value=i),placeholder:n.placeholder,disabled:n.disabled,class:vue.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f]",[vue.unref(t),{"!border-red-600":n.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,_hoisted_2$d),[[vue.vModelText,s.value]])]))}}),_hoisted_1$v=["value","disabled"],_hoisted_2$c={class:"text-[13px] text-gray-700"},_sfc_main$B=vue.defineComponent({__name:"vs-input-radio-default",props:vue.mergeModels({text:{type:String,required:!0},value:{type:String,required:!0},style:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},customClass:{type:String,default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=vue.useModel(n,"modelValue");return(t,s)=>(vue.openBlock(),vue.createElementBlock("label",{class:vue.normalizeClass(["flex items-center gap-0",[n.customClass]])},[vue.withDirectives(vue.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=r=>e.value=r),type:"radio",value:n.value,disabled:n.disabled,class:"hidden"},null,8,_hoisted_1$v),[[vue.vModelRadio,e.value]]),vue.createElementVNode("span",{class:vue.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${n.style?.primaryColor||"blue"}-500`,n.disabled?"opacity-50 cursor-not-allowed":""]])},[e.value==n.value?(vue.openBlock(),vue.createElementBlock("span",{key:0,class:vue.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${n.style?.primaryColor||"blue"}-500`]])},null,2)):vue.createCommentVNode("",!0)],2),vue.createElementVNode("span",_hoisted_2$c,vue.toDisplayString(n.text),1)],2))}}),_hoisted_1$u=["value","disabled"],_hoisted_2$b={class:"text-[13px] text-gray-700"},_sfc_main$A=vue.defineComponent({__name:"vs-input-radio-buttons",props:vue.mergeModels({text:{type:String,required:!0},value:{type:String,required:!0},style:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},customClass:{type:String,default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=vue.useModel(n,"modelValue");return(t,s)=>(vue.openBlock(),vue.createElementBlock("label",{class:vue.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[e.value==n.value?`ring-2 ring-ring ring-${n.style?.primaryColor||"blue"}-500`:"",n.customClass]])},[vue.withDirectives(vue.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=r=>e.value=r),type:"radio",value:n.value,disabled:n.disabled,class:"hidden"},null,8,_hoisted_1$u),[[vue.vModelRadio,e.value]]),vue.createElementVNode("span",_hoisted_2$b,vue.toDisplayString(n.text),1)],2))}}),layouts={"vs-input-radio-default":_sfc_main$B,"vs-input-radio-buttons":_sfc_main$A},_sfc_main$z=vue.defineComponent({__name:"vs-input-radio",props:vue.mergeModels({options:{type:Array,required:!0},position:{type:String,default:"vertical"},view:{type:String,default:"default"}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=vue.useModel(n,"modelValue"),s=vue.computed(()=>layouts[`vs-input-radio-${e.view}`]);return(r,a)=>(vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass([n.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.options,i=>(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(s.value),vue.mergeProps({key:i?.id,text:i.text,value:i.id.toString(),checked:t.value===i.id,modelValue:t.value,"onUpdate:modelValue":a[0]||(a[0]=o=>t.value=o)},{ref_for:!0},r.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),_sfc_main$y=vue.defineComponent({__name:"vs-input-checkbox",props:{options:{type:Array,default:()=>[]},modelValue:{type:[Boolean,Array],default:!1},position:{default:()=>"vertical"},slots:{type:Object,default:()=>null},view:{type:String,default:()=>null},colSpan:{type:Number,default:()=>0},data:{type:String,default:()=>null}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,s=e,r=vue.ref([]),a=vue.reactive({}),i=d=>d?.value||d?.id||d?.text||d,o=d=>d.text||String(d),l=d=>`lg:col-span-${d||12}`,u=async()=>{try{const d=await fetch(`/api/suggest/${t.data}`).then(h=>h.json());r.value=d?.data||d}catch(d){console.error(d)}};return vue.watch(()=>t.modelValue,d=>{if(typeof d=="boolean"&&r.value.length===1){const h=i(r.value[0]);a[h]=d}else if(Array.isArray(d)){const h=new Set(d);r.value.forEach(c=>{if(!c.disabled){const v=i(c);a[v]=h.has(v)}})}},{immediate:!0}),vue.watch(a,()=>{if(!r.value.length){s("update:modelValue",null);return}const d=Object.entries(a).filter(([,h])=>h).map(([h])=>h);s("update:modelValue",d.length===0?null:d)},{deep:!0}),vue.onMounted(()=>{if(t.data)u().then(()=>{if(typeof t.modelValue=="boolean"&&r.value.length===1){const d=i(r.value[0]);a[d]=t.modelValue}else if(Array.isArray(t.modelValue)){const d=new Set(t.modelValue);r.value.forEach(h=>{if(!h.disabled){const c=i(h);a[c]=d.has(c)}})}});else if(r.value=t.options,typeof t.modelValue=="boolean"&&r.value.length===1){const d=i(r.value[0]);a[d]=t.modelValue}else if(Array.isArray(t.modelValue)){const d=new Set(t.modelValue);r.value.forEach(h=>{if(!h.disabled){const c=i(h);a[c]=d.has(c)}})}}),(d,h)=>(vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass(["p-0 w-full gap-[6px]",[n.position==="vertical"?"flex-col":"",n.colSpan?"grid":"flex justify-start"]])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.value,c=>(vue.openBlock(),vue.createBlock(_sfc_main$L,{modelValue:a[i(c)],"onUpdate:modelValue":v=>a[i(c)]=v,value:i(c),class:vue.normalizeClass(l(n.colSpan)),disabled:c.disabled,label:o(c),key:i(c),icon:c?.icon,imgUrl:c?.imgUrl,option:c,slots:n.slots,view:n.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","slots","view"]))),128))],2))}}),VsInputCheckbox=_export_sfc(_sfc_main$y,[["__scopeId","data-v-b687dec2"]]),_hoisted_1$t=["placeholder","disabled"],_sfc_main$x=vue.defineComponent({__name:"vs-input-date1",props:vue.mergeModels({style:{type:Object,default:()=>({})},customClass:{type:String,default:""},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=useStyle(e.style),s=vue.useModel(n,"modelValue");return(r,a)=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("input",{type:"date","onUpdate:modelValue":a[0]||(a[0]=i=>s.value=i),placeholder:n.placeholder,disabled:n.disabled,class:vue.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f]",[vue.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,_hoisted_1$t)),[[vue.vModelText,s.value]])}}),$=(n,e)=>{const t=n.__vccOpts||n;for(const[s,r]of e)t[s]=r;return t};vue.defineComponent({props:{modelValue:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1}},data(){return{}},mounted(){this.modelValue||this.$emit("update:modelValue",!1)},computed:{modelState:{get(){return this.modelValue},set(n){this.$emit("update:modelValue",n)}},labelCursorClasses(){return[{"cursor-not-allowed":this.disabled},{"cursor-pointer":!this.disabled}]}},methods:{handleEnterDown(n){const{keyCode:e}=n;e===13&&(this.modelState=!this.modelState)},addKeyHandler(){window.addEventListener("keydown",this.handleEnterDown)},removeKeyHandler(){window.removeEventListener("keydown",this.handleEnterDown)}}});const Vt={},zt={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6 text-green-600"};function Et(n,e){return vue.openBlock(),vue.createElementBlock("svg",zt,e[0]||(e[0]=[vue.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M9 12.75L11.25 15 15 9.75M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)]))}const Lt=$(Vt,[["render",Et]]),jt={},Mt={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"orange",class:"size-6 text-orange-600"};function Pt(n,e){return vue.openBlock(),vue.createElementBlock("svg",Mt,e[0]||(e[0]=[vue.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M12 9v3m0 3h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)]))}const Tt=$(jt,[["render",Pt]]),It={},Rt={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-6 text-blue-600"};function Ot(n,e){return vue.openBlock(),vue.createElementBlock("svg",Rt,e[0]||(e[0]=[vue.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m11.25 11.25.041-.02a.75.75 0 0 1 1.063.852l-.708 2.836a.75.75 0 0 0 1.063.853l.041-.021M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9-3.75h.008v.008H12V8.25Z"},null,-1)]))}const Dt=$(It,[["render",Ot]]),Ht={},Nt={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"red",class:"size-6 text-red-600"};function At(n,e){return vue.openBlock(),vue.createElementBlock("svg",Nt,e[0]||(e[0]=[vue.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"},null,-1)]))}const Kt=$(Ht,[["render",At]]),qt={class:"rounded-md border border-gray-300 bg-white p-4 shadow-sm"},Ut={class:"flex items-start gap-4 opacity-100 scale-5 transition-all duration-300"},Wt={class:"flex-1"},Gt={class:"font-medium text-gray-900"},Zt={class:"mt-0.5 text-sm text-gray-700"},le=vue.defineComponent({__name:"vs-notify",props:{type:{},title:{},message:{}},setup(n){const e={success:Lt,warning:Tt,error:Kt,info:Dt};return(t,s)=>(vue.openBlock(),vue.createElementBlock("div",qt,[vue.createElementVNode("div",Ut,[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(e[t.type]))),vue.createElementVNode("div",Wt,[vue.createElementVNode("strong",Gt,vue.toDisplayString(t.title),1),vue.createElementVNode("p",Zt,vue.toDisplayString(t.message),1)]),s[0]||(s[0]=vue.createElementVNode("button",{class:"m-3 rounded-full p-1.5 text-gray-500 transition-colors hover:bg-gray-50 hover:text-gray-700",type:"button","aria-label":"Dismiss notify"},[vue.createElementVNode("span",{class:"sr-only"},"Dismiss popup"),vue.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",class:"size-5"},[vue.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})])],-1))])]))}});vue.reactive({visible:!0});const H={top:"top-4 left-1/2 transform -translate-x-1/2","left-bottom":"bottom-4 left-4 transform","right-bottom":"bottom-4 right-4 transform",bottom:"bottom-4 left-1/2 transform -translate-x-1/2"},jo=n=>{const{type:e="info",title:t,message:s,position:r="right-bottom"}=n||{};let a=document.querySelector("#notify-root");a||(a=document.createElement("div"),a.id="notify-root",a.className=`fixed z-[100] flex flex-col gap-3 ${H[r]} p-6 max-w-md mx-auto font-sans antialiased`,document.body.appendChild(a)),a.className.includes(H[r])||(Object.values(H).forEach(l=>{a.classList.remove(...l.split(" "))}),a.classList.add(...H[r].split(" ")));const i=document.createElement("div");a.appendChild(i);const o=vue.createApp({render(){return vue.h(le,{type:e,title:t,message:s,onClose:()=>{o.unmount(),i.remove()}})}});o.mount(i),i.querySelector("button")?.addEventListener("click",()=>{i.classList.add("opacity-0","scale-95","transition-all","duration-300"),setTimeout(()=>{o.unmount(),i.remove()},350)}),setTimeout(()=>{i.classList.add("opacity-0","scale-95","transition-all","duration-300"),setTimeout(()=>{o.unmount(),i.remove()},350)},3500)},fileUpload=async(n,e,t,s)=>{try{const r=new FormData;return r.append("unique","true"),r.append("file",n),(await fetch(`/file/upload/uploads?id=${e||""}&form=${t||""}&table=${s||""}`,{method:"POST",body:r}).then(i=>i.json()))?.result}catch(r){jo({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",r)}},fileDelete=async n=>{try{return await fetch(`file/delete${n}`),!0}catch(e){return console.error(e),!1}},fileDownload=async n=>{try{const e=await fetch(`file/download/files/uploads${n}`),t=await e.arrayBuffer(),s=e.headers["content-type"],r=new TextDecoder("utf-8").decode(t),a=new Blob([r],{type:s}),i=document.createElement("a");i.setAttribute("download",n),i.href=window.URL.createObjectURL(a),i.click()}catch(e){console.error(e.message)}},_sfc_main$w={},_hoisted_1$s={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$h(n,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$s,e[0]||(e[0]=[vue.createElementVNode("path",{d:"M5 12h14"},null,-1),vue.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const IconPlus=_export_sfc(_sfc_main$w,[["render",_sfc_render$h]]),_sfc_main$v={},_hoisted_1$r={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-text",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$g(n,e,t,s,r,a){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$r,e[0]||(e[0]=[vue.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><line x1="9" y1="9" x2="10" y2="9"></line><line x1="9" y1="13" x2="15" y2="13"></line><line x1="9" y1="17" x2="15" y2="17"></line>',6)]))}const iconPdf=_export_sfc(_sfc_main$v,[["render",_sfc_render$g]]),_sfc_main$u={},_hoisted_1$q={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-table",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$f(n,e,t,s,r,a){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$q,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),vue.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),vue.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const IconCsv=_export_sfc(_sfc_main$u,[["render",_sfc_render$f]]),_sfc_main$t={},_hoisted_1$p={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file-unknown"};function _sfc_render$e(n,e,t,s,r,a){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$p,e[0]||(e[0]=[vue.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M12 17v.01"></path><path d="M12 14a1.5 1.5 0 1 0 -1.14 -2.474"></path>',5)]))}const IconFile=_export_sfc(_sfc_main$t,[["render",_sfc_render$e]]),_sfc_main$s={},_hoisted_1$o={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-zip",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$d(n,e,t,s,r,a){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$o,e[0]||(e[0]=[vue.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1"></path><path d="M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2z"></path><line x1="11" y1="5" x2="10" y2="5"></line><line x1="13" y1="7" x2="12" y2="7"></line><line x1="11" y1="9" x2="10" y2="9"></line><line x1="13" y1="11" x2="12" y2="11"></line><line x1="11" y1="13" x2="10" y2="13"></line><line x1="13" y1="15" x2="12" y2="15"></line>',9)]))}const IconZip=_export_sfc(_sfc_main$s,[["render",_sfc_render$d]]),_sfc_main$r={},_hoisted_1$n={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-code",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$c(n,e,t,s,r,a){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$n,e[0]||(e[0]=[vue.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M10 13l-1 2l1 2"></path><path d="M14 13l1 2l-1 2"></path>',5)]))}const IconGeojson=_export_sfc(_sfc_main$r,[["render",_sfc_render$c]]),getFileType=n=>{if(!n)return"";const e=n?.split(".");return e[e.length-1]},fileFormatPreview=n=>{const e=getFileType(n),t={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 t.imageFormat.includes(e)?"img":t.sheetsFormat.includes(e)?IconCsv:t.textsFormat.includes(e)?IconGeojson:t.documentsFormat.includes(e)?iconPdf:t.archivesFormat.includes(e)?IconZip:IconFile},_sfc_main$q={},_hoisted_1$m={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function _sfc_render$b(n,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$m,e[0]||(e[0]=[vue.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const IconDelete=_export_sfc(_sfc_main$q,[["render",_sfc_render$b]]),_sfc_main$p={},_hoisted_1$l={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function _sfc_render$a(n,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$l,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),vue.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),vue.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const IconDownload=_export_sfc(_sfc_main$p,[["render",_sfc_render$a]]),_hoisted_1$k={class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},_hoisted_2$a={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},_sfc_main$o=vue.defineComponent({__name:"vs-input-file-list-item",props:vue.mergeModels({multiple:{type:Boolean}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(n){const e=vue.useModel(n,"value"),t=vue.useModel(n,"item"),s=n;return(r,a)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$k,[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(vue.unref(fileFormatPreview)(t.value)),{src:t.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:a[0]||(a[0]=i=>vue.unref(fileDownload)(t.value))},null,8,["src"])),vue.createElementVNode("div",_hoisted_2$a,[vue.createElementVNode("button",{type:"button",onClick:a[1]||(a[1]=i=>{vue.unref(fileDelete)(t.value),e.value=s.multiple?e.value?.filter(o=>o!==t.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[vue.createVNode(IconDelete,{class:"w-4 h-4"})]),vue.createElementVNode("button",{type:"button",onClick:a[2]||(a[2]=i=>vue.unref(fileDownload)(t.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[vue.createVNode(IconDownload,{class:"w-4 h-4"})])])]))}}),VsInputFileListItem=_export_sfc(_sfc_main$o,[["__scopeId","data-v-bc0f6d32"]]),_hoisted_1$j={class:"flex items-center gap-x-2"},_hoisted_2$9={key:1,class:"flex items-center flex-wrap gap-2"},_sfc_main$n=vue.defineComponent({__name:"vs-input-file",props:vue.mergeModels({multiple:{type:Boolean},format:{},disabled:{type:Boolean}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=vue.useModel(n,"modelValue"),s=vue.ref(null),r=i=>Array.isArray(t.value)&&t.value[i]||"",a=async i=>{if(e.format){const u=i.target.files?.[0];if(!u||!u.name.endsWith(e.format))return}const o=i.target.files?.[0];if(!o)return;const l=await fileUpload(o,"1","form","table");t.value=e.multiple?[...t.value||[],l?.file_path]:l?.file_path};return(i,o)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$j,[vue.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:s,type:"file",onChange:a},null,544),!i.multiple&&t.value?(vue.openBlock(),vue.createBlock(VsInputFileListItem,{key:0,item:t.value,"onUpdate:item":o[0]||(o[0]=l=>t.value=l),value:t.value,"onUpdate:value":o[1]||(o[1]=l=>t.value=l)},null,8,["item","value"])):i.multiple?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$9,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(t.value,(l,u)=>(vue.openBlock(),vue.createBlock(VsInputFileListItem,{multiple:i.multiple,key:u,value:t.value,"onUpdate:value":o[2]||(o[2]=d=>t.value=d),item:r(u)},null,8,["multiple","value","item"]))),128)),vue.createElementVNode("div",{onClick:o[3]||(o[3]=l=>!i.disabled&&s.value?.click()),class:vue.normalizeClass(["h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",i.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[vue.createVNode(IconPlus,{class:"w-6 h-6"})],2)])):vue.createCommentVNode("",!0),i.multiple?vue.createCommentVNode("",!0):(vue.openBlock(),vue.createElementBlock("div",{key:2,onClick:o[4]||(o[4]=l=>s.value?.click()),class:vue.normalizeClass([i.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[vue.createVNode(IconPlus,{class:"w-6 h-6"})],2))]))}}),_sfc_main$m={componens:{IconFile},props:{item:null},computed:{createDate(){try{return new Date(this.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}},methods:{formatBytes(n){if(n<1024)return`${n} B`;const e=n/1024;return e<1024?`${e.toFixed(2)} KB`:`${(e/1024).toFixed(2)} MB`}}},_hoisted_1$i={class:"max-w-[55vw]"},_hoisted_2$8={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},_hoisted_3$7={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},_hoisted_4$6={class:"px-[5px]"},_hoisted_5$6={class:""};function _sfc_render$9(n,e,t,s,r,a){return vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[e[1]||(e[1]=vue.createStaticVNode('<div class="flex items-center justify-center h-[30px] w-[30px]"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path></svg></div>',1)),vue.createElementVNode("div",_hoisted_1$i,[vue.createElementVNode("p",_hoisted_2$8,vue.toDisplayString(t.item?.uploaded_name),1),vue.createElementVNode("p",_hoisted_3$7,[vue.createElementVNode("span",null,vue.toDisplayString(t.item?.username),1),vue.withDirectives(vue.createElementVNode("span",_hoisted_4$6,"|",512),[[vue.vShow,t.item?.username]]),vue.createElementVNode("span",null,vue.toDisplayString(a.createDate),1),e[0]||(e[0]=vue.createElementVNode("span",{class:"px-[5px]"},"|",-1)),vue.createElementVNode("span",_hoisted_5$6,vue.toDisplayString(a.formatBytes(t.item?.size)),1)])])],64)}const VsWidgetFileInfo=_export_sfc(_sfc_main$m,[["render",_sfc_render$9]]),_sfc_main$l={components:{VsWidgetFileInfo,IconDownload,IconTrash:IconDelete},props:{item:null,index:{type:Number,default:0},prefix:{type:String,default:"/api"}},data(){return{optionsFile:{defaultType:"iframe"}}},computed:{createDate(){try{return new Date(this.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}},methods:{isSupportedFile(n){return["pdf","json"].includes(n.ext)},isSupportedAllFile(n){return["ppt","pptx","doc","docx","xls","xlsx"].includes(n.ext)},async downloadFile(n){const e=document.createElement("a");e.setAttribute("download",n?.uploaded_name),e.href=n?.file_path,e.click()},confirnDeleteFile(){this.$emit("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:this.deleteFile,updateListOnConfirm:!0})},async deleteFile(){try{await fetch(`${this.prefix}/widget/file/${this.item.entity_id}/${this.item.file_id}`),this.$emit("update")}catch(n){console.error(n)}},changeLightbox(n){(this.item.ext==="jpg"||this.item.ext==="png")&&this.$emit("openLightbox",{item:this.item,index:n})}}},_hoisted_1$h={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},_hoisted_2$7={key:0,class:"flex w-full gap-x-3 items-center"},_hoisted_3$6={key:1,class:"flex gap-x-3 w-full items-center"},_hoisted_4$5={key:2,class:"flex gap-x-3 w-full items-center"},_hoisted_5$5=["href"],_hoisted_6$5={key:3,class:"flex gap-x-3 w-full items-center"},_hoisted_7$4={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},_hoisted_8$3={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"},_hoisted_9$3={class:"inline-block"},_hoisted_10$1={class:"inline-block"};function _sfc_render$8(n,e,t,s,r,a){const i=vue.resolveComponent("VsWidgetFileInfo"),o=vue.resolveComponent("IconDownload"),l=vue.resolveComponent("IconTrash");return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$h,[t.item.ext==="jpg"||t.item.ext==="png"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$7,[vue.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:e[0]||(e[0]=u=>a.changeLightbox(t.index))},[vue.createVNode(i,{item:t.item},null,8,["item"])])])):a.isSupportedFile(t.item)?(vue.openBlock(),vue.createElementBlock("div",_hoisted_3$6,[vue.createVNode(i,{item:t.item},null,8,["item"])])):a.isSupportedAllFile(t.item)?(vue.openBlock(),vue.createElementBlock("div",_hoisted_4$5,[vue.createElementVNode("a",{href:`/api/file-preview?id=${t.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[vue.createVNode(i,{item:t.item},null,8,["item"])],8,_hoisted_5$5)])):(vue.openBlock(),vue.createElementBlock("div",_hoisted_6$5,[vue.createVNode(i,{item:t.item},null,8,["item"])])),vue.createElementVNode("div",_hoisted_7$4,[vue.createElementVNode("div",_hoisted_8$3,[vue.createElementVNode("div",_hoisted_9$3,[vue.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:e[1]||(e[1]=u=>a.downloadFile(t.item))},[vue.createVNode(o,{height:"14",width:"14"})])]),e[3]||(e[3]=vue.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),vue.createElementVNode("div",_hoisted_10$1,[vue.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:e[2]||(e[2]=u=>a.confirnDeleteFile())},[vue.createVNode(l,{height:"14",width:"14"})])])])])])}const VsWidgetFileItem=_export_sfc(_sfc_main$l,[["render",_sfc_render$8]]),_sfc_main$k={},_hoisted_1$g={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function _sfc_render$7(n,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$g,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),vue.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),vue.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const IconUpload=_export_sfc(_sfc_main$k,[["render",_sfc_render$7]]),_hoisted_1$f={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},_hoisted_2$6={class:"flex w-full mb-[12px] items-center gap-x-2"},_hoisted_3$5={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},_hoisted_4$4={class1:"ml-auto"},_hoisted_5$4={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"},_hoisted_6$4={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},_hoisted_7$3={class:"relative"},_hoisted_8$2={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"},_hoisted_9$2={key:0},_sfc_main$j={__name:"vs-input-file-list",props:{id:{type:String,default:""},prefix:{type:String,default:"/api"}},emits:["update"],setup(n,{emit:e}){const t=n,s=vue.inject("form"),r=vue.computed(()=>s.value.formId),a=vue.ref(!1),i=vue.ref(0),o=e,l=vue.ref(!1),u=vue.ref({}),d=vue.ref([]),h=vue.ref(""),c=vue.computed(()=>Array.isArray(d.value)?d.value.filter(p=>p.ext==="jpg"||p.ext==="png").map(p=>p?.file_path):[]);console.log("images",c.value);const v=vue.computed(()=>h.value===""?d.value:d.value.filter(p=>p?.uploaded_name.includes(h.value))),C=p=>{const f=c.value.findIndex(V=>V===p.item.file_path);f!==-1&&(a.value=!0,i.value=f)},B=async()=>{try{const p=await fetch(`${t.prefix}/widget/file/${r.value}`).then(f=>f.json());d.value=p?.rows}catch(p){console.error(p)}},I=async p=>{await Promise.all(Array.from(p.target.files).map(async f=>{const V=new FormData;V.append("file",f);try{const S=`${t.prefix}/widget/file/${r.value}`;return await fetch(S,{method:"POST",body:V}),o("update","file-list"),f}catch(S){return console.error(S),null}})),await B()},b=p=>{const f={...p};return p.cancel||(f.cancel=()=>{l.value=!1}),p.updateListOnConfirm&&(f.confirm=async()=>{await p.confirm(),l.value=!1,B()}),f},_=p=>{u.value=b(p),l.value=!0};return vue.watch(r,p=>{p&&B()}),vue.onMounted(()=>{r.value&&B()}),(p,f)=>{const V=vue.resolveComponent("Lightbox"),S=vue.resolveComponent("MessageBox");return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$f,[vue.createElementVNode("div",_hoisted_2$6,[vue.createElementVNode("h2",_hoisted_3$5," Файлів: "+vue.toDisplayString(d.value?.length),1),vue.createElementVNode("div",_hoisted_4$4,[vue.createElementVNode("label",null,[vue.createElementVNode("input",{type:"file",class:"hidden",onChange:f[0]||(f[0]=k=>I(k))},null,32),vue.createElementVNode("div",_hoisted_5$4,[vue.createVNode(IconUpload,{height:"16",width:"16"})])])])]),d.value?.length>4?(vue.openBlock(),vue.createElementBlock("div",_hoisted_6$4,[vue.createElementVNode("div",null,[vue.createElementVNode("div",_hoisted_7$3,[f[8]||(f[8]=vue.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[vue.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[vue.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),vue.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),vue.withDirectives(vue.createElementVNode("input",{type:"text","onUpdate:modelValue":f[1]||(f[1]=k=>h.value=k),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),[[vue.vModelText,h.value,void 0,{trim:!0}]])])])])):vue.createCommentVNode("",!0),d.value?.length?(vue.openBlock(),vue.createElementBlock("div",_hoisted_8$2,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(v.value,(k,x)=>(vue.openBlock(),vue.createBlock(VsWidgetFileItem,{key:x,id:n.id,prefix:n.prefix,item:k,index:x,onUpdate:f[2]||(f[2]=y=>p.$emit("update","file-list")),onOpenModal:f[3]||(f[3]=y=>_(y)),onOpenLightbox:f[4]||(f[4]=y=>C(y))},null,8,["id","prefix","item","index"]))),128)),v.value.length?vue.createCommentVNode("",!0):(vue.openBlock(),vue.createElementBlock("div",_hoisted_9$2,f[9]||(f[9]=[vue.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):vue.createCommentVNode("",!0),vue.createVNode(V,{modelValue:a.value,"onUpdate:modelValue":f[5]||(f[5]=k=>a.value=k),startIndex:i.value,"onUpdate:index":f[6]||(f[6]=k=>i.value=k),images:c.value},null,8,["modelValue","startIndex","images"]),vue.createVNode(S,{modelValue:l.value,"onUpdate:modelValue":f[7]||(f[7]=k=>l.value=k),onConfirm:u.value.confirm,title:u.value.title,message:u.value.message,confirmButtonText:u.value.confirmButtonText,cancelButtonText:u.value.cancelButtonText},null,8,["modelValue","onConfirm","title","message","confirmButtonText","cancelButtonText"])])}}},_hoisted_1$e={class:"flex items-center justify-between"},_hoisted_2$5={class:"text-[16px] text-gray-900 font-medium"},_hoisted_3$4={class:"grid gap-3"},_sfc_main$i=vue.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(n){const e=n,t=vue.ref(e.isOpen);return vue.watch(()=>e.isOpen,s=>{t.value=s}),(s,r)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createElementVNode("div",_hoisted_1$e,[vue.createElementVNode("p",_hoisted_2$5,vue.toDisplayString(n.title),1),vue.createVNode(_sfc_main$G,{modelValue:t.value,"onUpdate:modelValue":r[0]||(r[0]=a=>t.value=a),style:vue.normalizeStyle(n.style)},null,8,["modelValue","style"])]),vue.createVNode(vue.Transition,{name:"slide-fade"},{default:vue.withCtx(()=>[vue.withDirectives(vue.createElementVNode("div",_hoisted_3$4,[vue.renderSlot(s.$slots,"default",{},void 0,!0)],512),[[vue.vShow,t.value]])]),_:3})]))}}),VsContainerSwitcher=_export_sfc(_sfc_main$i,[["__scopeId","data-v-479564a3"]]),_hoisted_1$d={class:"text-[16px] text-gray-900 font-medium"},_hoisted_2$4={class:"grid gap-3"},_sfc_main$h=vue.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(n){const e=n,t=vue.ref(e.isOpen);return vue.watch(()=>e.isOpen,s=>{t.value=s}),(s,r)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createElementVNode("button",{type:"button",onClick:r[0]||(r[0]=a=>t.value=!t.value),class:"flex items-center gap-2"},[vue.createVNode(vue.unref(IconChevronDown),{class:vue.normalizeClass(["h-4 w-4 duration-300",[t.value?"-rotate-180":""]])},null,8,["class"]),vue.createElementVNode("span",_hoisted_1$d,vue.toDisplayString(n.title),1)]),vue.createVNode(vue.Transition,{name:"slide-fade"},{default:vue.withCtx(()=>[vue.withDirectives(vue.createElementVNode("div",_hoisted_2$4,[vue.renderSlot(s.$slots,"default",{},void 0,!0)],512),[[vue.vShow,t.value]])]),_:3})]))}}),VsContainerAccordion=_export_sfc(_sfc_main$h,[["__scopeId","data-v-a37284e6"]]),_hoisted_1$c={class:"flex items-center justify-between"},_sfc_main$g=vue.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(n){return(e,t)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createElementVNode("div",_hoisted_1$c,[vue.createElementVNode("p",null,vue.toDisplayString(n.title),1)]),vue.renderSlot(e.$slots,"default")]))}}),views={switcher:VsContainerSwitcher,accordion:VsContainerAccordion,default:_sfc_main$g},FormConditionsTypes={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},checkEqual=(n,e)=>String(n)===String(e),checkInequal=(n,e)=>String(n)!==String(e),checkHigher=(n,e)=>n>e,checkHigherOrEqual=(n,e)=>n>=e,checkLower=(n,e)=>n<e,checkLowerOrEqual=(n,e)=>n<=e,checkBetween=(n,e)=>Array.isArray(e)&&e.length===2?n>=e[0]&&n<=e[1]:!1,checkStartWith=(n,e)=>String(n).startsWith(String(e)),checkEndWith=(n,e)=>String(n).endsWith(String(e)),checkContain=(n,e)=>String(n).includes(String(e)),checkIn=(n,e)=>Array.isArray(e)?e.includes(n):!1,checkNotIn=(n,e)=>Array.isArray(e)?!e.includes(n):!0,isVisible=(n,e)=>{if(!e)return!0;switch(e?.[1]){case FormConditionsTypes.Equal:return checkEqual(n,e?.[2]);case FormConditionsTypes.Inequal:return checkInequal(n,e?.[2]);case FormConditionsTypes.Higer:return checkHigher(n,e?.[2]);case FormConditionsTypes.HigerOrEqual:return checkHigherOrEqual(n,e?.[2]);case FormConditionsTypes.Lower:return checkLower(n,e?.[2]);case FormConditionsTypes.LowerOrEqual:return checkLowerOrEqual(n,e?.[2]);case FormConditionsTypes.Between:return checkBetween(n,e?.[2]);case FormConditionsTypes.StartWith:return checkStartWith(n,e?.[2]);case FormConditionsTypes.EndWith:return checkEndWith(n,e?.[2]);case FormConditionsTypes.Contain:return checkContain(n,e?.[2]);case FormConditionsTypes.In:return checkIn(n,e?.[2]);case FormConditionsTypes.NotIn:return checkNotIn(n,e?.[2]);default:return!0}},_sfc_main$f=vue.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},schema:{type:Array,default:()=>[]}},setup(n){const e=n,t=vue.inject("formValues",{default:{}}),s=vue.inject("form"),r=vue.computed(()=>e.schema?.filter(i=>{const o=i?.conditions;if(!o)return!0;const l=Array.isArray(o)?o[0]:o,u=t?.value?.[l];return isVisible(u,o)})),a=vue.computed(()=>views[e.view]);return(i,o)=>n.schema?.length?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(a.value),{key:0,title:n.title,style:vue.normalizeStyle(n.style)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(r.value,l=>(vue.openBlock(),vue.createBlock(_sfc_main$1,vue.mergeProps({key:l.name},{ref_for:!0},l,{item:l,modelValue:vue.unref(t)[l.name],"onUpdate:modelValue":u=>vue.unref(t)[l.name]=u,style:n.style,error:vue.unref(s)?.errors?.[l.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):vue.createCommentVNode("",!0)}}),_hoisted_1$b={class:"relative"},_hoisted_2$3={class:"w-full h-full fixed top-0 start-0 z-[80] bg-black bg-opacity-50"},_hoisted_3$3={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"},_hoisted_4$3={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},_hoisted_5$3={class:"font-medium text-gray-800 dark:text-[#ffffff]"},_hoisted_6$3={class:"p-4 mim-h-0 h-full overflow-auto"},_sfc_main$e=vue.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(n,{emit:e}){const t=n,s=e,r=vue.ref(t.schema),a=vue.ref(t.defaultValue?JSON.parse(JSON.stringify(t.defaultValue)):{}),i=vue.ref({}),o=vue.ref();async function l(){const d=i.value.validate();if(d){jo({type:"warning",title:"Validation",message:Object.entries(d).map(([h,c])=>`${h}: ${c}`).join(`
|
|
2
|
-
`)});return}s("save",a.value)}function u(){s("close")}return vue.onMounted(async()=>{if(t.form){const d=await fetch(`/api/template/form/${t.form}`).then(h=>h.json());r.value=d.schema}else if(t.token){o.value=t.token;const d=await fetch(`/api/template/form/${o.value}`).then(c=>c.json()),h=await fetch(`/api/table/${o.value}`).then(c=>c.json());a.value=h,r.value=d.schema}}),(d,h)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$b,[vue.createElementVNode("div",_hoisted_2$3,[vue.createElementVNode("div",_hoisted_3$3,[vue.createElementVNode("div",_hoisted_4$3,[vue.createElementVNode("h3",_hoisted_5$3,vue.toDisplayString(d.mode==="add"?"Додати":"Змінити"),1),vue.createElementVNode("button",{onClick:u,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},h[2]||(h[2]=[vue.createElementVNode("span",{class:"sr-only"},"Close",-1),vue.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[vue.createElementVNode("path",{d:"M18 6 6 18"}),vue.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),vue.createElementVNode("div",_hoisted_6$3,[r.value?(vue.openBlock(),vue.createBlock(_sfc_main,{key:0,schema:r.value,values:a.value,"onUpdate:values":h[0]||(h[0]=c=>a.value=c),form:i.value,"onUpdate:form":h[1]||(h[1]=c=>i.value=c)},null,8,["schema","values","form"])):vue.createCommentVNode("",!0)]),vue.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"},[vue.createElementVNode("button",{type:"button",onClick:u,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"}," Скасувати "),vue.createElementVNode("button",{onClick:l,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"}," Зберегти ")])])])]))}}),form=(n={mode:"edit",schema:null})=>new Promise((e,t)=>{const s=document.querySelector("body");if(!s){console.error('Modal root element with id "#modal" not found!');return}const r=document.createElement("div");s.appendChild(r);const a=vue.createApp({render(){return vue.h(_sfc_main$e,{...n,onClose:()=>{e(null),i()},onSave:o=>{e(o),console.log(o),i()}})}});function i(){a.unmount(),r.remove()}a.mount(r)}),dynamicPosition=async(n,e,t,s=10)=>{if(!e||!t)return;await vue.nextTick();const r=await t?.getBoundingClientRect(),a=await e?.getBoundingClientRect();if(!a||!r)return;const i=await parseInt(e?.getBoundingClientRect()?.height.toString()),o=await parseInt(e?.getBoundingClientRect()?.width.toString()),l=await parseInt(t?.getBoundingClientRect()?.height.toString()),u=await parseInt(t?.getBoundingClientRect()?.width.toString()),d=await window.innerHeight,h=await window.innerWidth;let c=0,v=0;const C=a.bottom+s+l;switch(n){case"top":a.top-r.height-s<0?c=a.top-r.height+s+l+i:c=a.top-r.height-s,h>u+a.right+30?v=a.left-r.width/2+a.width/2:v=h-30-u;break;case"bottom":d>C?c=a.bottom+s:c=a.bottom-s-l-i,v=a.left-r.width/2+a.width/2;break;case"left":c=a.top-r.height/2+a.height/2,a.left-r.width-s>0?v=a.left-r.width-s:v=10;break;case"right":c=a.top-r.height/2+a.height/2,h-o>u?v=a.right+s:v=h-30-u;break;case"top-right":a.top-r.height-s<0?c=a.top-r.height+s+l+i:c=a.top-r.height-s,h-o>u?v=a.right+s:v=h-30-u;break;case"top-left":a.top-r.height-s<0?c=a.top-r.height+s+l+i:c=a.top-r.height-s,a.left-r.width-s>0?v=a.left-r.width-s:v=10;break;case"top-start":a.top-r.height-s<0?c=a.top-r.height+s+l+i:c=a.top-r.height-s,a.left>0?v=a.left:v=10;break;case"bottom-right":d>C?c=a.bottom+s:c=a.bottom-s-l-i,h-o>u?v=a.left:v=h-30-u;break;case"bottom-left":d>C?c=a.bottom+s:c=a.bottom-s-l-i,a.left>0?v=a.right-u:v=10;break;case"bottom-start":d>C?c=a.bottom+s:c=a.bottom-s-l-i,a.left>0?v=a.left:v=10;break}c+l>d?c=d-l-s:c<0&&(c=s),v+u>h?v=h-u-s:v<0&&(v=s),t instanceof HTMLElement&&(t.style.top=`${c}px`,t.style.left=`${v}px`,t.style.position="fixed")},_sfc_main$d={},_hoisted_1$a={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};function _sfc_render$6(n,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$a,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),vue.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const IconMagnifyingGlass=_export_sfc(_sfc_main$d,[["render",_sfc_render$6]]),_hoisted_1$9=["disabled"],_hoisted_2$2={key:1},_hoisted_3$2={key:2,class:"text-gray-400"},_hoisted_4$2={class:"absolute top-[50%] text-gray-500 translate-y-[-50%] right-[10px] pointer-events-none"},_hoisted_5$2={key:0,class:"sticky top-[-4px] text-[12px] bg-white p-1 z-[2] px-4 text-gray-400"},_hoisted_6$2={class:"h-[30px] shrink-0 flex items-center relative justify-center"},_hoisted_7$2=["onClick"],_hoisted_8$1={class:"flex items-center gap-[8px] w-full"},_hoisted_9$1={key:2},_sfc_main$c=vue.defineComponent({__name:"vs-input-select",props:vue.mergeModels({placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:null},options:{default:()=>[]},maxHeight:{default:400},slots:{default:null},customClass:{default:""},style:{default:()=>({})},disabled:{type:Boolean},mode:{default:"search"},add:{},api:{},search:{type:Boolean},error:{default:null}},{modelValue:{type:[Number,String],default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=vue.computed(()=>e.mode||(e.api||e.search?"search":null)),{inputClass:s}=useStyle(e.style),r=vue.useModel(n,"modelValue"),a=vue.ref({}),i=vue.ref(null),o=vue.ref(null),l=vue.ref(!1),u=vue.ref(null),d=vue.ref([]),h=vue.ref(-1),c=vue.ref([]),v=vue.ref(""),C=vue.ref(null);let B=null;const I=vue.computed(()=>{if(d.value?.length){const g=d.value?.filter(m=>m?.id!==u.value?.id);return[u.value].concat(g)?.filter(m=>m!==null)}return[]}),b=async()=>{try{const{data:g}=await fetch(`${e.host}/${e.prefix}/suggest/${e.data}?json=1&key=${v.value}`).then(m=>m.json());return g}catch{return[]}},_=async g=>{document.body.click(),l.value=g!==void 0?g:!l.value,l.value&&!d.value?.length&&(!e.options?.length&&e.data?d.value=await b():e.options?.length&&(d.value=[...e.options])),l.value&&i.value?(a.value.width=`${i.value.getBoundingClientRect()?.width}px`,t.value==="search"&&C.value?.focus(),o.value&&dynamicPosition("bottom-start",i.value,o.value)):h.value=-1},p=()=>l.value?_(!1):null,f=g=>{u.value=g,r.value=g.id,_(!1)},V=(g,m)=>{if(!g||!m)return;const E=g.offsetTop,D=E+g.offsetHeight,F=m.scrollTop,N=F+m.clientHeight;E<F?Object.assign(m,{scrollTop:E-80}):D>N&&Object.assign(m,{scrollTop:D-m.clientHeight+4})},S=g=>{if(!l.value)return;const{keyCode:m}=g;if([38,40,13].includes(m)&&g.preventDefault(),m===38){if(h.value===0)return;h.value-=1,V(c.value[h.value],o.value)}else if(m===40){if(h.value+1>=I.value?.length)return;h.value+=1,V(c.value[h.value],o.value)}else if(m===13){const E=I.value[h.value];E&&f(E)}},k=async g=>{if(l.value)return;const{keyCode:m}=g;[38,40].includes(m)&&(await g.preventDefault(),h.value=0,setTimeout(()=>_()))},x=g=>{l.value&&i.value&&o.value&&!o.value.contains(g.target)&&(l.value=!1)},y=g=>{g?.key==="Escape"&&l.value&&_(!1)};async function w(g){if(!g)return null;const m=d.value?.find(D=>D?.id.toString()===g?.toString());if(m)return m;const{data:E}=await fetch(`${e.host}/${e.prefix}/suggest/${e.data}?json=1&val=${g}`).then(D=>D.json());return E[0]}vue.onMounted(async()=>{addEventListener("click",p),addEventListener("keydown",S),addEventListener("scroll",x,!0),addEventListener("keydown",y),e.options&&(d.value=e.options),r.value&&!e.options?.length&&e.data&&(d.value=await b()),u.value=await w(r.value?.toString())}),vue.onUnmounted(()=>{removeEventListener("click",p),removeEventListener("keydown",S),removeEventListener("scroll",x,!0),removeEventListener("keydown",y)}),vue.watch(v,g=>{let m=!1;(g===""||g.trimStart().length!==0)&&(m=!0),m&&(B&&clearTimeout(B),B=setTimeout(async()=>{!e.options?.length&&e.data?d.value=await b():d.value=e.options.filter(E=>E.text.toLowerCase().includes(g.toLowerCase()))},200))});async function M(){if(!e.add)return;const g=await form({form:e.add.form,mode:"add"});if(!g)return;const m=await fetch(`/api/table/${e.add.token}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}).then(E=>E.json());r.value=m.id,u.value=await w(m.id)}return(g,m)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[vue.createElementVNode("div",{class:"relative w-full",ref_key:"select",ref:i,onClick:m[5]||(m[5]=vue.withModifiers(()=>{},["stop"]))},[vue.createElementVNode("button",{type:"button",class:vue.normalizeClass(["block w-full flex items-center gap-[8px] pl-[16px] py-[5px] bg-white w-[calc(100%)] overflow-ellipsis",[l.value?`ring-rind ring-2 ring-${g.style?.primaryColor||"blue"}-500`:"",u.value?.text?"pr-[50px]":"pr-[25px]",vue.unref(s),g.customClass,{"!border-red-600":g.error}]]),onKeydown:k,onClick:m[0]||(m[0]=E=>_(!l.value)),disabled:g.disabled,style:{border:"1px solid #CFD9E0"}},[u.value?.color?(vue.openBlock(),vue.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block",style:vue.normalizeStyle({backgroundColor:u.value?.color})},null,4)):vue.createCommentVNode("",!0),u.value?.text?(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$2,vue.toDisplayString(u.value?.text),1)):(vue.openBlock(),vue.createElementBlock("span",_hoisted_3$2,vue.toDisplayString(g.placeholder),1))],42,_hoisted_1$9),vue.createElementVNode("span",_hoisted_4$2,[vue.createVNode(vue.unref(IconChevronTopBottom),{height:"14",width:"14"})]),u.value?.text?(vue.openBlock(),vue.createElementBlock("button",{key:0,type:"button",onClick:m[1]||(m[1]=E=>{r.value=null,u.value=null}),class:"absolute top-[50%] text-gray-500 translate-y-[-50%] hover:text-red-600 right-[30px]"},[vue.createVNode(vue.unref(IconClose),{height:"14",width:"14"})])):vue.createCommentVNode("",!0),(vue.openBlock(),vue.createBlock(vue.Teleport,{to:"body"},[vue.withDirectives(vue.createElementVNode("ul",{class:"z-[90] border rounded-lg fixed flex flex-col gap-[2px] p-1 bg-white overflow-auto [&::-webkit-scrollbar]:h-2 [&::-webkit-scrollbar]:w-[6px] [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-stone-100 [&::-webkit-scrollbar-thumb]:bg-stone-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500",ref_key:"list",ref:o,style:vue.normalizeStyle({width:a.value.width,maxHeight:g.maxHeight+"px",backgroundColor:"white"}),onClick:m[4]||(m[4]=vue.withModifiers(()=>{},["stop"]))},[t.value==="search"?(vue.openBlock(),vue.createElementBlock("li",_hoisted_5$2,[vue.createElementVNode("div",_hoisted_6$2,[vue.withDirectives(vue.createElementVNode("input",{"onUpdate:modelValue":m[2]||(m[2]=E=>v.value=E),class:"w-full h-full text-[13px] px-4 border rounded-sm pl-9 focus:outline-none focus:ring-ring focus:ring-1 focus:ring-blue-500",placeholder:"Пошук",type:"text",ref_key:"inputRef",ref:C},null,512),[[vue.vModelText,v.value]]),vue.createVNode(IconMagnifyingGlass,{width:"15px",height:"15px",class:"absolute text-gray-400 -translate-y-1/2 left-4 top-1/2"}),v.value!=""?(vue.openBlock(),vue.createBlock(vue.unref(IconClose),{key:0,width:"15px",height:"15px",onClick:m[3]||(m[3]=E=>v.value=""),class:"absolute text-gray-400 -translate-y-1/2 cursor-pointer hover:text-red-500 right-4 top-1/2"})):vue.createCommentVNode("",!0)])])):vue.createCommentVNode("",!0),I.value?.length?(vue.openBlock(),vue.createElementBlock(vue.Fragment,{key:1},[m[6]||(m[6]=vue.createElementVNode("li",{class:"sticky top-[-4px] text-[12px] bg-white p-1 z-[2] px-4 text-gray-400"}," Натисніть Enter для вибору, ↑↓ для навігації, Esc для закриття ",-1)),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(I.value,(E,D)=>(vue.openBlock(),vue.createElementBlock("li",{onClick:F=>f(E),key:E?.id,ref_for:!0,ref:F=>c.value[D]=F,class:vue.normalizeClass(["cursor-pointer relative py-2 px-4 w-full text-[14px] text-gray-700 hover:bg-gray-100 rounded-lg",[h.value==D?"bg-gray-100":""]])},[vue.createElementVNode("span",_hoisted_8$1,[E?.color?(vue.openBlock(),vue.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block",style:vue.normalizeStyle({backgroundColor:E?.color})},null,4)):vue.createCommentVNode("",!0),vue.createTextVNode(" "+vue.toDisplayString(E?.text),1)]),r.value==E?.id?(vue.openBlock(),vue.createBlock(vue.unref(IconCheck),{key:0,height:"14",width:"14","stroke-width":"2",class:"absolute right-[16px] top-[50%] translate-y-[-50%] text-blue-600"})):vue.createCommentVNode("",!0)],10,_hoisted_7$2))),128))],64)):(vue.openBlock(),vue.createElementBlock("li",_hoisted_9$1,"Дані відсутні"))],4),[[vue.vShow,l.value]])]))],512),e.add?(vue.openBlock(),vue.createElementBlock("button",{key:0,onClick:M,class:"ml-auto bg-white hover:bg-gray-100 text-sm text-gray-900 leadig-[18.5px] py-[10px] px-[12px] border border-solid border-stone-200 rounded-md h-[38px] max-h-[40px] gap-[8px] flex items-center"},[vue.createVNode(IconPlus,{width:"16",height:"16"}),m[7]||(m[7]=vue.createElementVNode("span",null,"Додати",-1))])):vue.createCommentVNode("",!0)],64))}}),_hoisted_1$8=["placeholder","disabled"],_sfc_main$b=vue.defineComponent({__name:"vs-input-textarea",props:vue.mergeModels({style:{type:Object,default:()=>({})},customClass:{type:String,default:""},placeholder:{type:String,default:""},disabled:{type:Boolean,default:!1}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=useStyle(e.style),s=vue.useModel(n,"modelValue");return(r,a)=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("textarea",{"onUpdate:modelValue":a[0]||(a[0]=i=>s.value=i),placeholder:n.placeholder,disabled:n.disabled,row:"2",class:vue.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto",[vue.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,_hoisted_1$8)),[[vue.vModelText,s.value]])}}),_sfc_main$a={},_hoisted_1$7={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$5(n,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$7,e[0]||(e[0]=[vue.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),vue.createElementVNode("path",{d:"M7 20V4"},null,-1),vue.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),vue.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const IconArrowTopBottom=_export_sfc(_sfc_main$a,[["render",_sfc_render$5]]),_sfc_main$9={},_hoisted_1$6={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$4(n,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$6,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),vue.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),vue.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const IconImport=_export_sfc(_sfc_main$9,[["render",_sfc_render$4]]),_sfc_main$8={},_hoisted_1$5={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$3(n,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$5,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),vue.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),vue.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const IconExport=_export_sfc(_sfc_main$8,[["render",_sfc_render$3]]),_sfc_main$7={},_hoisted_1$4={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$2(n,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$4,e[0]||(e[0]=[vue.createStaticVNode('<circle cx="9" cy="12" r="1"></circle><circle cx="9" cy="5" r="1"></circle><circle cx="9" cy="19" r="1"></circle><circle cx="15" cy="12" r="1"></circle><circle cx="15" cy="5" r="1"></circle><circle cx="15" cy="19" r="1"></circle>',6)]))}const IconGripVertical=_export_sfc(_sfc_main$7,[["render",_sfc_render$2]]),_sfc_main$6={},_hoisted_1$3={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function _sfc_render$1(n,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$3,e[0]||(e[0]=[vue.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 IconNoData=_export_sfc(_sfc_main$6,[["render",_sfc_render$1]]),_sfc_main$5={},_hoisted_1$2={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render(n,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$2,e[0]||(e[0]=[vue.createElementVNode("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"},null,-1)]))}const IconPen=_export_sfc(_sfc_main$5,[["render",_sfc_render]]),_hoisted_1$1={class:"vs-datatable border rounded-xl w-full flex-grow"},_hoisted_2$1={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},_hoisted_3$1={class:"relative w-full"},_hoisted_4$1={class:"table-wrapper flex gap-2"},_hoisted_5$1={class:"vs-popover inline-block"},_hoisted_6$1={class:"text-center"},_hoisted_7$1={class:""},_hoisted_8={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"},_hoisted_9={class:"flex flex-col p-[2px] gap-[2px] w-[140px]"},_hoisted_10={class:"text-sm items-center text-gray-800 flex gap-1"},_hoisted_11={class:"w-full overflow-x-auto"},_hoisted_12={class:"w-full table-auto caption-bottom text-sm"},_hoisted_13={class:"[&_tr]:border-b"},_hoisted_14={class:"border-b data-[state=selected]:bg-muted bg-slate-50/50 dark:bg-slate-700/50 hover:bg-slate-50/80 dark:hover:bg-slate-700/80 transition-colors"},_hoisted_15={class:"h-10 px-2 align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] w-12 text-center"},_hoisted_16={key:0,colspan:"100%",class:"text-center"},_hoisted_17={class:"w-full"},_hoisted_18={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},_hoisted_19=["onDragstart","onDragover","onDrop"],_hoisted_20={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},_hoisted_21={class:"flex items-center justify-center"},_hoisted_22={class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},_hoisted_23={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},_hoisted_24={class:"flex items-center justify-center gap-2"},_hoisted_25=["onClick"],_hoisted_26=["onClick"],_sfc_main$4=vue.defineComponent({__name:"vs-input-datatable",props:vue.mergeModels({colModel:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=vue.ref(e.colModel),s=vue.useModel(n,"modelValue"),r=vue.ref({}),a=vue.ref(""),i=vue.computed(()=>{if(!a.value)return s.value;const k=a.value.toLowerCase();return s.value.filter(x=>t.value.some(y=>{const w=x[y.key];return w?Array.isArray(w)?w.join(", ").toLowerCase().includes(k):String(w).toLowerCase().includes(k):!1}))}),o=vue.ref(null),l=vue.ref(null),u=vue.ref(!1),d=vue.ref(null),h=vue.ref({top:0,left:0}),c=k=>{o.value=k},v=k=>{l.value=k},C=k=>{if(o.value===null||o.value===k){o.value=null,l.value=null;return}const x=[...s.value],[y]=x.splice(o.value,1);x.splice(k,0,y),s.value=x,o.value=null,l.value=null},B=k=>{const y=k.currentTarget.getBoundingClientRect();h.value={top:y.bottom+window.scrollY,left:y.left+window.scrollX},u.value=!u.value},I=()=>{d.value&&d.value.click()},b=k=>{const y=k.target.files?.[0];if(!y)return;const w=new FileReader;w.onload=M=>{try{const g=M.target?.result;if(typeof g=="string"){const m=JSON.parse(g);Array.isArray(m)&&s.value.push(...m)}}catch(g){console.error("Error parsing file:",g)}},w.readAsText(y)},_=()=>{const k=JSON.stringify(s.value,null,2),x=new Blob([k],{type:"application/json"}),y=URL.createObjectURL(x),w=document.createElement("a");w.href=y,w.download="data.json",w.click(),URL.revokeObjectURL(y)};vue.onMounted(async()=>{});async function p(){const k=await form({schema:e.colModel,mode:"add"});k&&(s.value=[...s.value,k])}function f(k,x){return r.value[x.key]&&k[x.key]?r.value[x.key].find(y=>y.id.toString()===k[x.key].toString())?.text??k[x.key]:k[x.key]||"-"}async function V(k,x){const y=await form({schema:e.colModel,mode:"add",defaultValue:k});y&&(s.value=s.value.map((w,M)=>M===x?y:w))}function S(k){s.value=s.value.filter((x,y)=>y!==k)}return(k,x)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$1,[vue.createElementVNode("div",_hoisted_2$1,[vue.createElementVNode("div",_hoisted_3$1,[vue.createVNode(IconMagnifyingGlass,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),vue.withDirectives(vue.createElementVNode("input",{type:"text","onUpdate:modelValue":x[0]||(x[0]=y=>a.value=y),placeholder:"Пошук",class:"py-2 px-3 pl-10 w-full bg-gray-100 h-[36px] rounded-[8px] text-[15px] leading-[18px] focus:border-1 text-stone-800 placeholder:text-[#6B7280] focus:outline-blue-500 focus:outline-2"},null,512),[[vue.vModelText,a.value]])]),vue.createElementVNode("div",_hoisted_4$1,[vue.createElementVNode("input",{ref_key:"fileInput",ref:d,onChange:b,class:"hidden",accept:".json",type:"file"},null,544),vue.createElementVNode("div",_hoisted_5$1,[vue.createElementVNode("div",_hoisted_6$1,[vue.createElementVNode("div",_hoisted_7$1,[vue.createElementVNode("button",{onClick:B,class:"bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[vue.createVNode(IconArrowTopBottom,{height:"16",width:"16"})])])])])]),(vue.openBlock(),vue.createBlock(vue.Teleport,{to:"body"},[u.value?(vue.openBlock(),vue.createElementBlock("div",{key:0,class:"vsTailwind vs-popover__content bottom",style:vue.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:h.value.top+"px",left:h.value.left+"px"}])},[vue.createElementVNode("div",_hoisted_8,[vue.createElementVNode("div",_hoisted_9,[vue.createElementVNode("button",{onClick:I,class:"flex items-center gap-1 px-3 py-1 rounded-md cursor-pointer group hover:bg-gray-100"},[vue.createVNode(IconImport,{class:"text-black",width:"14",height:"14"}),x[1]||(x[1]=vue.createTextVNode(" Імпортувати "))]),vue.createElementVNode("button",{onClick:_,class:"flex items-center px-3 py-1 rounded-md cursor-pointer group hover:bg-gray-100"},[vue.createElementVNode("span",_hoisted_10,[vue.createVNode(IconExport,{class:"text-black",width:"14",height:"14"}),x[2]||(x[2]=vue.createTextVNode(" Експортувати "))])])])])],4)):vue.createCommentVNode("",!0)])),vue.createElementVNode("button",{onClick:p,class:"bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[vue.createVNode(IconPlus),x[3]||(x[3]=vue.createTextVNode(" Додати "))])]),vue.createElementVNode("div",_hoisted_11,[vue.createElementVNode("table",_hoisted_12,[vue.createElementVNode("thead",_hoisted_13,[vue.createElementVNode("tr",_hoisted_14,[vue.createElementVNode("th",_hoisted_15,[vue.createVNode(IconGripVertical,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(t.value,y=>(vue.openBlock(),vue.createElementBlock("th",{key:y.key,class:"h-10 px-2 text-left align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 min-w-[150px]"},vue.toDisplayString(y.ua),1))),128)),x[4]||(x[4]=vue.createElementVNode("th",{class:"h-10 px-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 text-center"}," Дії ",-1))])]),vue.createElementVNode("tbody",{class:vue.normalizeClass({"[&_tr:last-child]:border-0":!l.value})},[i.value.length===0?(vue.openBlock(),vue.createElementBlock("td",_hoisted_16,[vue.createElementVNode("div",_hoisted_17,[vue.createElementVNode("div",_hoisted_18,[vue.createVNode(IconNoData,{class:"w-48 mx-auto"}),x[5]||(x[5]=vue.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[vue.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),vue.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):vue.createCommentVNode("",!0),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(i.value,(y,w)=>(vue.openBlock(),vue.createElementBlock("tr",{key:y.id,class:vue.normalizeClass(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move",{"opacity-50":o.value===w,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":l.value===w}]),draggable:"true",onDragstart:M=>c(w),onDragover:vue.withModifiers(M=>v(w),["prevent"]),onDrop:M=>C(w)},[vue.createElementVNode("td",_hoisted_20,[vue.createElementVNode("div",_hoisted_21,[vue.createVNode(IconGripVertical,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(t.value,M=>(vue.openBlock(),vue.createElementBlock("td",{key:M.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[vue.createElementVNode("div",_hoisted_22,vue.toDisplayString(f(y,M)),1)]))),128)),vue.createElementVNode("td",_hoisted_23,[vue.createElementVNode("div",_hoisted_24,[vue.createElementVNode("button",{onClick:M=>V(y,w),class:"inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-blue-50 dark:hover:bg-slate-600 hover:border-blue-300 dark:hover:border-slate-500 hover:text-blue-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[vue.createVNode(IconPen,{width:"24",height:"24",class:"w-3 h-3"})],8,_hoisted_25),vue.createElementVNode("button",{onClick:M=>S(w),class:"inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-red-50 dark:hover:bg-slate-600 hover:border-red-300 dark:hover:border-slate-500 hover:text-red-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[vue.createVNode(IconDelete,{width:"24",height:"24",class:"w-3 h-3"})],8,_hoisted_26)])])],42,_hoisted_19))),128))],2)])])]))}}),MAP_LOCALE={draw:{toolbar:{actions:{title:"Скасувати малювання",text:"Скасувати"},finish:{title:"Завершити малювання",text:"Завершити"},undo:{title:"Видалити останню точку",text:"Видалити останню"},buttons:{polyline:"Намалювати лінію",polygon:"Намалювати полігон",rectangle:"Намалювати прямокутник",circle:"Намалювати коло",marker:"Додати точку",circlemarker:"Додати маркер-коло"}},handlers:{circle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати коло",end:"Відпустіть кнопку миші, щоб завершити"},radius:"Радіус"},circlemarker:{tooltip:{start:"Клацніть на карту, щоб додати маркер-коло"}},marker:{tooltip:{start:"Клацніть на карту, щоб додати точку"}},polygon:{tooltip:{start:"Клацніть, щоб почати малювати полігон",cont:"Клацайте, щоб продовжити малювати полігон",end:"Клацніть першу точку, щоб завершити полігон"}},polyline:{error:"<strong>Помилка:</strong> лінія не може перетинатися сама з собою",tooltip:{start:"Клацніть, щоб почати малювати лінію",cont:"Клацайте, щоб продовжити малювати лінію",end:"Клацніть останню точку, щоб завершити лінію"}},rectangle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати прямокутник",end:"Відпустіть кнопку миші, щоб завершити"}},simpleshape:{tooltip:{end:"Відпустіть кнопку миші, щоб завершити"}}}},edit:{toolbar:{actions:{save:{title:"Зберегти зміни",text:"Зберегти"},cancel:{title:"Скасувати редагування",text:"Скасувати"},clearAll:{title:"Очистити всі шари",text:"Очистити все"}},buttons:{edit:"Редагувати шари",editDisabled:"Немає шарів для редагування",remove:"Видалити шари",removeDisabled:"Немає шарів для видалення"}},handlers:{edit:{tooltip:{text:"Перетягніть маркери, щоб редагувати шари",subtext:"Натисніть 'Скасувати', щоб повернутися"}},remove:{tooltip:{text:"Клацніть на шари, щоб видалити їх"}}}}};function normalizeToGeoJSON(n){return n?n.type==="FeatureCollection"||n.type==="Feature"?n:n.geom?{type:"Feature",geometry:{type:n.geom.type,coordinates:n.geom.coordinates},properties:{}}:n.type&&n.coordinates?{type:"Feature",geometry:n,properties:{}}:null:null}const _hoisted_1={class:"leaflet-map-wrapper relative w-full h-[600px]"},_hoisted_2={class:"absolute top-4 right-4 z-[1000] space-y-2 bg-white/90 p-2 rounded shadow flex flex-col"},_hoisted_3={class:"absolute bottom-4 left-4 z-[1000] bg-white/90 p-2 rounded shadow"},_hoisted_4={class:"flex gap-2"},_hoisted_5=["onClick"],_hoisted_6=["src"],_hoisted_7={class:"text-xs text-center"},_sfc_main$3=vue.defineComponent({__name:"vs-input-map",props:{modelValue:{type:Object,default:()=>({})}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,s=e,r=vue.ref(null);let a,i,o;const l=vue.ref(null),u={OSM:{url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",preview:"https://a.tile.openstreetmap.org/0/0/0.png"},CartoLight:{url:"https://cartodb-basemaps-a.global.ssl.fastly.net/light_all/{z}/{x}/{y}{r}.png",preview:"https://cartodb-basemaps-a.global.ssl.fastly.net/light_all/3/4/2.png"},Satellite:{url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}",preview:"https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/3/2/4"}};let d;function h(){return new Promise(b=>{window.L&&b(0);const _=document.createElement("link");_.rel="stylesheet",_.href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css",document.head.appendChild(_);const p=document.createElement("link");p.rel="stylesheet",p.href="https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css",document.head.appendChild(p);const f=document.createElement("script");f.src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js",f.onload=()=>{const V=document.createElement("script");V.src="https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js",V.onload=()=>b(0),document.body.appendChild(V)},document.body.appendChild(f)})}function c(){const b=i.toGeoJSON();s("update:modelValue",b)}vue.onMounted(async()=>{await h(),L.drawLocal=MAP_LOCALE,a=L.map(r.value).setView([50.45,30.52],6),d=L.tileLayer(u.OSM.url,{maxZoom:19}).addTo(a),i=new L.FeatureGroup().addTo(a),a.on(L.Draw.Event.CREATED,_=>{const{layer:p}=_;i.addLayer(p),c()}),a.on(L.Draw.Event.EDITED,c),a.on(L.Draw.Event.DELETED,c);const b=normalizeToGeoJSON(t.modelValue);b&&L.geoJSON(b).eachLayer(_=>i.addLayer(_))});function v(b){if(a){switch(o&&o.disable(),b){case"marker":o=new L.Draw.Marker(a);break;case"polyline":o=new L.Draw.Polyline(a);break;case"polygon":o=new L.Draw.Polygon(a);break;case"rectangle":o=new L.Draw.Rectangle(a);break;case"circle":o=new L.Draw.Circle(a);break;default:o=new L.Draw.Circle(a);break}o&&o.enable()}}function C(){const b=i.toGeoJSON(),_=new Blob([JSON.stringify(b,null,2)],{type:"application/json"}),p=URL.createObjectURL(_),f=document.createElement("a");f.href=p,f.download="data.geojson",f.click(),URL.revokeObjectURL(p)}function B(b){const _=b.target.files[0];if(!_)return;const p=new FileReader;p.onload=()=>{if(typeof p.result!="string")return;const f=JSON.parse(p.result);i.clearLayers(),L.geoJSON(f).eachLayer(V=>i.addLayer(V)),c()},p.readAsText(_)}function I(b){a&&(a.removeLayer(d),d=L.tileLayer(u[b].url,{maxZoom:19}).addTo(a))}return vue.watch(()=>t.modelValue,b=>{const _=normalizeToGeoJSON(b);_&&(i.clearLayers(),L.geoJSON(_).eachLayer(p=>i.addLayer(p)))}),(b,_)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1,[vue.createElementVNode("div",{ref_key:"mapContainer",ref:r,class:"w-full h-full"},null,512),vue.createElementVNode("div",_hoisted_2,[vue.createElementVNode("button",{onClick:_[0]||(_[0]=p=>v("marker")),class:"btn"},"Точка"),vue.createElementVNode("button",{onClick:_[1]||(_[1]=p=>v("polyline")),class:"btn"},"Лінія"),vue.createElementVNode("button",{onClick:_[2]||(_[2]=p=>v("polygon")),class:"btn"},"Полігон"),vue.createElementVNode("button",{onClick:_[3]||(_[3]=p=>v("rectangle")),class:"btn"},"Прямокутник"),vue.createElementVNode("button",{onClick:_[4]||(_[4]=p=>v("circle")),class:"btn"},"Коло"),_[6]||(_[6]=vue.createElementVNode("hr",{class:"my-2"},null,-1)),vue.createElementVNode("button",{onClick:C,class:"btn"},"Експорт"),vue.createElementVNode("button",{onClick:_[5]||(_[5]=p=>l.value?.click()),class:"btn"},"Імпорт"),vue.createElementVNode("input",{ref_key:"importRef",ref:l,type:"file",onChange:B,class:"hidden"},null,544)]),vue.createElementVNode("div",_hoisted_3,[vue.createElementVNode("div",_hoisted_4,[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(u,(p,f)=>vue.createElementVNode("div",{key:f,class:"cursor-pointer border rounded overflow-hidden",onClick:V=>I(f)},[vue.createElementVNode("img",{src:p.preview,alt:"",class:"w-20 h-20 object-cover"},null,8,_hoisted_6),vue.createElementVNode("div",_hoisted_7,vue.toDisplayString(f),1)],8,_hoisted_5)),64))])])]))}}),inputs={VsInputText:_sfc_main$Q,VsInputRadio:_sfc_main$z,"vs-input-text":_sfc_main$Q,"vs-input-textarea":_sfc_main$b,"vs-input-mask":_sfc_main$E,"vs-input-number":_sfc_main$P,"vs-input-radio":_sfc_main$z,"vs-input-select":_sfc_main$c,"vs-input-switcher":_sfc_main$G,"vs-input-static":_sfc_main$F,"vs-input-container":_sfc_main$f,"vs-input-date":_sfc_main$x,"vs-input-checkbox":VsInputCheckbox,"vs-input-file":_sfc_main$n,"vs-input-html":_sfc_main$D,"vs-input-email":_sfc_main$C,"vs-input-datatable":_sfc_main$4,"vs-input-map":_sfc_main$3,"vs-input-file-list":_sfc_main$j},_sfc_main$2=vue.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(n){const e=n,t=vue.inject("values");async function s(){try{if(!e.api)return;const r=e.api.replace("{{value}}",e.value),a=await fetch(r);if(!a.ok){jo({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const i=await a.json();if(!e.set||!t)return;for(const[o,l]of Object.entries(e.set))t.value[o]=i.result[l]}catch(r){console.error(e.error,r)}}return(r,a)=>(vue.openBlock(),vue.createElementBlock("button",{onClick:s,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"},vue.toDisplayString(r.button),1))}}),_sfc_main$1=vue.defineComponent({__name:"vs-compact-form-layout",props:{type:{type:String,default:""},style:{type:Object,default:()=>({})},item:{type:Object,default:()=>({})},layout:{type:String,default:"default"}},setup(n){const e=n,t=vue.computed(()=>layouts$1[`${e.layout}`]),s=vue.computed(()=>inputs?.[`vs-input-${e.type}`]);return(r,a)=>(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(t.value),vue.mergeProps(r.$attrs,{style:n.style,item:n.item}),{default:vue.withCtx(()=>[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(s.value),vue.mergeProps(r.$attrs,{style:n.style}),null,16,["style"])),n.item.behavior?(vue.openBlock(),vue.createBlock(_sfc_main$2,vue.mergeProps({key:0},n.item.behavior,{value:r.$attrs.modelValue}),null,16,["value"])):vue.createCommentVNode("",!0)]),_:1},16,["style","item"]))}}),formErrorsUa={required:"Це поле є обов’язковим",email:"Неправильний email"},required=n=>n?!1:formErrorsUa.required,email=n=>!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)&&n?formErrorsUa.email:!1,regexp=(n,e)=>{const t=e.pattern??e.regexp;return!(typeof t=="string"?new RegExp(t):t).test(n)&&n?e.message:!1},custom=(value,customRule)=>{const func=eval(customRule.function);return func(value)?!1:customRule.message},checkFormRules=(n,e)=>{switch(typeof e=="string"?e:e.type){case"required":return required(n);case"email":return email(n);case"regexp":return regexp(n,e);case"custom":return custom(n,e);default:return!1}},mathTable={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file"};function convertType(n){const e=n.toLowerCase();return mathTable[e]||e}function convertSchema(n){if(Array.isArray(n)){const t=[];return n.forEach(s=>{const r={...s};r.name=(s.name||s.id||s.key).toString(),r.type=convertType(s.type),r.label=s.label||s.ua,r.rules=s.rules||s.validators,s.data&&(r.api=`/api/suggest/${s.data}`),t.push(r)}),t}const e=[];return Object.entries(n).forEach(t=>{const s={name:t[0],...t[1],type:convertType(t[1].type),label:t[1].label||t[1].ua,rules:t[1].rules||t[1].validators};t[1].type.includes("list")&&(s.multiple=!0),t[1].data&&(s.api=`/api/suggest/${t[1].data}`),e.push(s)}),e}function useForm(n,e){const t=convertSchema(e),s=vue.ref({});function r(l){const u=l?.conditions;if(!u)return!0;const d=Array.isArray(u)?u[0]:u,h=n?.value?.[d];return isVisible(h,u)}const a=(l=t,u=!0)=>(l.forEach(d=>{if(d.rules){if(!r(d)){console.log(d.name,"skip hidden"),delete s.value[d.name];return}d.rules.forEach(h=>{const c=checkFormRules(n.value[d.name],h);c?s.value[d.name]=c:delete s.value[d.name]})}d.schema&&a(d.schema,!1)}),u&&Object.values(s.value).some(Boolean)?s.value:null),i=vue.computed(()=>t?.filter(l=>r(l)));return{errors:s,validate:a,reset:()=>{n.value={},s.value={}},visibleSchema:i}}const _sfc_main=vue.defineComponent({__name:"vs-compact-form",props:vue.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},layout:{default:()=>"default"},formId:{default:()=>""}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:vue.mergeModels(["handle-submit"],["update:form","update:values"]),setup(n,{emit:e}){const t=e,s=n,r=vue.useAttrs(),a=vue.useModel(n,"form"),i=vue.useModel(n,"values"),{errors:o,validate:l,reset:u,visibleSchema:d}=useForm(i,s.schema),h=()=>{l(),t("handle-submit",i.value)};return vue.onMounted(()=>{a.value.value=i.value,a.value.errors=o.value,a.value.reset=u,a.value.validate=l,a.value.formId=s.formId}),vue.provide("form",a),vue.provide("values",i),(c,v)=>(vue.openBlock(),vue.createElementBlock("form",{onSubmit:vue.withModifiers(h,["prevent"]),class:vue.normalizeClass(["grid grid-cols-12",c.layout==="default"?"gap-6":"gap-4"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(d),C=>(vue.openBlock(),vue.createBlock(_sfc_main$1,vue.mergeProps({key:C.name,class:c.layout==="horizontal"?"col-span-12":`col-span-${C.col||12} `},{ref_for:!0},{...vue.unref(r),...c.style,...C},{item:C,layout:c.layout,modelValue:i.value[C.name],"onUpdate:modelValue":B=>i.value[C.name]=B,style:c.style,error:vue.unref(o)[C.name]}),null,16,["class","item","layout","modelValue","onUpdate:modelValue","style","error"]))),128))],34))}});_sfc_main.install=function n(e){e.component("VForm",_sfc_main),e.config.globalProperties.$form=form,e.provide("form",form),window.v3plugin||(window.v3plugin={}),window.v3plugin.$form=e.config.globalProperties.$form},exports.VForm=_sfc_main,exports.VsInputText=_sfc_main$Q,exports.default=_sfc_main,Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(o,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@opengis/core")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core"],e):(o=typeof globalThis<"u"?globalThis:o||self,e(o.FormBuilder={},o.Vue,o.OpenGISCore))})(this,function(exports,vue,core){"use strict";const _hoisted_1$T={class:"w-full relative"},_hoisted_2$l={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},_hoisted_3$e={key:0,class:"text-red-500 text-[14px]"},_hoisted_4$d={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},_sfc_main$Y=vue.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},item:{default:()=>({})},error:{default:""},label:{default:""}},setup(o){return(e,t)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$T,[e.ua||e.label?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$l,[vue.createElementVNode("span",null,vue.toDisplayString(e.ua||e.label),1),e.item?.rules?.includes("required")?(vue.openBlock(),vue.createElementBlock("span",_hoisted_3$e,"*")):vue.createCommentVNode("",!0)])):vue.createCommentVNode("",!0),vue.renderSlot(e.$slots,"default",vue.normalizeProps(vue.guardReactiveProps(e.$attrs))),e.error?(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$d,vue.toDisplayString(e.error),1)):vue.createCommentVNode("",!0)]))}}),_hoisted_1$S={class:"w-full relative flex flex-row items-center gap-2"},_hoisted_2$k={key:0,class:"text-sm text-gray-900 font-medium flex shrink-0 w-3/12 max-w-[250px]"},_hoisted_3$d={key:0,class:"text-red-500 text-[14px]"},_hoisted_4$c={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},_sfc_main$X=vue.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},item:{default:()=>({})},error:{default:""},label:{default:""}},setup(o){return(e,t)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$S,[e.item?.type!=="html"?(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$k,[vue.createTextVNode(vue.toDisplayString(e.ua||e.label)+" ",1),e.item?.rules?.includes("required")&&(e.ua||e.label)?(vue.openBlock(),vue.createElementBlock("span",_hoisted_3$d,"*")):vue.createCommentVNode("",!0)])):vue.createCommentVNode("",!0),vue.renderSlot(e.$slots,"default",vue.normalizeProps(vue.guardReactiveProps(e.$attrs))),e.error?(vue.openBlock(),vue.createElementBlock("span",_hoisted_4$c,vue.toDisplayString(e.error),1)):vue.createCommentVNode("",!0)]))}}),_hoisted_1$R={class:"w-full relative"},_hoisted_2$j={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},_sfc_main$W=vue.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},item:{default:()=>({})},error:{default:""},label:{default:""}},setup(o){return(e,t)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$R,[vue.renderSlot(e.$slots,"default",vue.normalizeProps(vue.guardReactiveProps(e.$attrs))),e.error?(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$j,vue.toDisplayString(e.error),1)):vue.createCommentVNode("",!0)]))}}),layouts$1={default:_sfc_main$Y,horizontal:_sfc_main$X,inline:_sfc_main$W};function useStyle(o){return{inputClass:vue.computed(()=>{const t=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${o?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return o?.size==="sm"?t+"h-[32px]":t+"h-[38px]"})}}const _hoisted_1$Q=["placeholder","disabled"],_sfc_main$V=vue.defineComponent({__name:"vs-input-text",props:vue.mergeModels({style:{default:()=>({})},customClass:{default:""},placeholder:{default:""},disabled:{type:Boolean,default:!1},type:{},value:{},name:{},rules:{},error:{default:""},text:{},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{},prefix:{},host:{},data:{},options:{},maxHeight:{},slots:{},mode:{},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{},view:{},colSpan:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,{inputClass:t}=useStyle(e.style),s=vue.useModel(o,"modelValue");return(n,a)=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("input",{type:"text","onUpdate:modelValue":a[0]||(a[0]=l=>s.value=l),placeholder:n.placeholder,disabled:n.disabled,class:vue.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f]",[vue.unref(t),{"!border-red-600":n.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,_hoisted_1$Q)),[[vue.vModelText,s.value]])}}),_hoisted_1$P=["placeholder"],_sfc_main$U=vue.defineComponent({__name:"vs-input-number",props:vue.mergeModels({style:{default:()=>({})},customClass:{},placeholder:{default:""},disabled:{type:Boolean},type:{},value:{},name:{},rules:{},error:{},text:{},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{},prefix:{},host:{},data:{},options:{},maxHeight:{},slots:{},mode:{},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{},view:{},colSpan:{}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,{inputClass:t}=useStyle(e.style),s=vue.useModel(o,"modelValue");return(n,a)=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":a[0]||(a[0]=l=>s.value=l),placeholder:n.placeholder,class:vue.normalizeClass(["py-1.5 px-3 block w-full",[vue.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,_hoisted_1$P)),[[vue.vModelText,s.value]])}}),_export_sfc=(o,e)=>{const t=o.__vccOpts||o;for(const[s,n]of e)t[s]=n;return t},_sfc_main$T={},_hoisted_1$O={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"4","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-check"};function _sfc_render$n(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$O,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const IconCheck=_export_sfc(_sfc_main$T,[["render",_sfc_render$n]]),_hoisted_1$N={class:"flex items-center gap-[4px]"},_hoisted_2$i=["value","id","disabled"],_hoisted_3$c=["for"],_hoisted_4$b={class:"text-[14px] text-gray-700 flex items-center gap-x-1 ml-1 dark:text-neutral-400"},_sfc_main$S=vue.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{default:null}},emits:["update:modelValue"],setup(o,{emit:e}){const t=e,s=o,n=vue.computed({get:()=>s.modelValue,set:a=>t("update:modelValue",a)});return(a,l)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$N,[vue.withDirectives(vue.createElementVNode("input",{type:"checkbox",value:a.value,"onUpdate:modelValue":l[0]||(l[0]=r=>n.value=r),class:vue.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":a.disabled}]),id:a.id,disabled:a.disabled},null,10,_hoisted_2$i),[[vue.vModelCheckbox,n.value]]),vue.createElementVNode("label",{for:a.id,class:vue.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":a.disabled}])},[vue.createElementVNode("div",{class:vue.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[n.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",a.error?"border-red-600":""]])},[vue.createVNode(IconCheck,{height:"12",width:"12"})],2),vue.createElementVNode("span",_hoisted_4$b,[vue.renderSlot(a.$slots,"default",{},()=>[vue.createTextVNode(vue.toDisplayString(a.label),1)])])],10,_hoisted_3$c)]))}}),_hoisted_1$M=["name","value","disabled"],_hoisted_2$h={class:"flex items-center gap-[6px] text-[14px]"},_hoisted_3$b={key:0,class:"text-[16px]"},_hoisted_4$a=["src"],_sfc_main$R=vue.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean,default:!1},id:{},icon:{},imgUrl:{},style:{default:null}},emits:["update:modelValue"],setup(o,{emit:e}){const t=o,s=e,n=vue.computed({get:()=>t.modelValue,set:r=>{s("update:modelValue",r)}}),a=vue.computed(()=>Array.isArray(n.value)?n.value.includes(t.value):n.value===!0||n.value===t.value),l=vue.computed(()=>t.style?.size==="xs"?"p-1.5 text-xs":t.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(r,i)=>(vue.openBlock(),vue.createElementBlock("label",{class:vue.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",[l.value,a.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[vue.withDirectives(vue.createElementVNode("input",{type:"checkbox",class:"hidden",name:r.id,value:r.value,"onUpdate:modelValue":i[0]||(i[0]=d=>n.value=d),disabled:r.disabled},null,8,_hoisted_1$M),[[vue.vModelCheckbox,n.value]]),vue.createElementVNode("span",_hoisted_2$h,[r.icon||r.imgUrl?(vue.openBlock(),vue.createElementBlock("span",_hoisted_3$b,[r.icon?(vue.openBlock(),vue.createElementBlock("i",{key:0,class:vue.normalizeClass(r.icon)},null,2)):vue.createCommentVNode("",!0),r.imgUrl?(vue.openBlock(),vue.createElementBlock("img",{key:1,src:r.imgUrl,width:"16",height:"16",alt:"icon"},null,8,_hoisted_4$a)):vue.createCommentVNode("",!0)])):vue.createCommentVNode("",!0),vue.renderSlot(r.$slots,"default",{},()=>[vue.createTextVNode(vue.toDisplayString(r.label),1)])])],2))}}),VsCheckboxViews={"vs-checkbox-default":_sfc_main$S,"vs-checkbox-buttons":_sfc_main$R},_hoisted_1$L={class:"flex items-center"},_sfc_main$Q=vue.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:{default:null},option:{},style:{default:null},error:{default:null}},emits:["update:modelValue"],setup(o,{emit:e}){const t=o,s=e,n=`radio-${Math.floor(Math.random()*1e4)}`,a=vue.computed({get:()=>Array.isArray(t.modelValue)?Array.isArray(t.modelValue)&&t.modelValue.includes(t.value):t.modelValue,set:r=>{if(Array.isArray(t.modelValue)){let i=[...t.modelValue];r?i.includes(t.value)||i.push(t.value):i=i.filter(d=>d!==t.value),s("update:modelValue",i)}else s("update:modelValue",r)}}),l=vue.ref(`vs-checkbox-${t.view||"default"}`);return(r,i)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$L,[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(vue.unref(VsCheckboxViews)?.[l.value]),{value:r.value,label:r.label,info:r.option?.info,disabled:r.disabled,modelValue:a.value,"onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),id:n,icon:r.icon,imgUrl:r.imgUrl,style:vue.normalizeStyle(r.style),error:r.error},{default:vue.withCtx(()=>[vue.createTextVNode(vue.toDisplayString(r.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),_sfc_main$P={},_hoisted_1$K={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-chevron-down"};function _sfc_render$m(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$K,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const IconChevronDown=_export_sfc(_sfc_main$P,[["render",_sfc_render$m]]),_sfc_main$O={},_hoisted_1$J={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$l(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$J,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M12 9h.01"},null,-1),vue.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),vue.createElementVNode("path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z"},null,-1)]))}const IconInfo=_export_sfc(_sfc_main$O,[["render",_sfc_render$l]]),_hoisted_1$I={key:0,class:"flex items-start gap-x-1"},_hoisted_2$g={key:0,class:"text-red-500 text-[14px]"},_hoisted_3$a=["title"],_hoisted_4$9=["disabled"],_sfc_main$N=vue.defineComponent({__name:"vs-input-switcher",props:vue.mergeModels({style:{default:()=>({})},customClass:{default:""},placeholder:{},disabled:{type:Boolean,default:!1},type:{},value:{},name:{},rules:{default:()=>[]},error:{default:""},text:{default:""},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{},prefix:{},host:{},data:{},options:{},maxHeight:{},slots:{},mode:{},add:{},api:{},search:{type:Boolean},i:{default:""},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{},view:{default:"checkbox"},colSpan:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,t=vue.useModel(o,"modelValue");return(s,n)=>e.view==="checkbox"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$I,[vue.createVNode(_sfc_main$Q,{modelValue:t.value,"onUpdate:modelValue":n[0]||(n[0]=a=>t.value=a),label:s.text,error:s.error},null,8,["modelValue","label","error"]),s.rules?.includes("required")?(vue.openBlock(),vue.createElementBlock("span",_hoisted_2$g,"*")):vue.createCommentVNode("",!0),s.i?(vue.openBlock(),vue.createElementBlock("button",{key:1,class:"cursor-pointer",title:s.i,onClick:n[1]||(n[1]=vue.withModifiers(()=>{},["prevent"]))},[vue.createVNode(vue.unref(IconInfo),{class:"text-gray-500 w-[14px] h-[14px]"})],8,_hoisted_3$a)):vue.createCommentVNode("",!0)])):(vue.openBlock(),vue.createElementBlock("button",{key:1,type:"button",class:vue.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",[t.value?`bg-${s.style?.primaryColor||"blue"}-500`:"bg-stone-200",s.customClass]]),disabled:s.disabled,onClick:n[2]||(n[2]=a=>t.value=!t.value)},[vue.createElementVNode("span",{"data-state":"checked",class:vue.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[t.value?"translate-x-4":"translate-x-0"]])},null,2)],10,_hoisted_4$9))}}),_hoisted_1$H=["innerHTML"],_sfc_main$M=vue.defineComponent({__name:"vs-input-static",props:{style:{},customClass:{default:""},placeholder:{},disabled:{type:Boolean},type:{},value:{},name:{},rules:{},error:{},text:{default:""},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{default:""},prefix:{},host:{},data:{},options:{},maxHeight:{},slots:{},mode:{},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{},view:{},colSpan:{}},setup(o){const e=o;return(t,s)=>(vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass(t.customClass),innerHTML:(e.html==="",e.text)},null,10,_hoisted_1$H))}}),_hoisted_1$G=["placeholder","disabled","name"],_sfc_main$L=vue.defineComponent({__name:"vs-input-mask",props:vue.mergeModels({style:{default:()=>({})},customClass:{default:""},placeholder:{default:""},disabled:{type:Boolean,default:!1},type:{},value:{},name:{},rules:{},error:{},text:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholderChar:{default:"_"},html:{},prefix:{},host:{},data:{},options:{},maxHeight:{},slots:{},mode:{},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{},view:{},colSpan:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,{inputClass:t}=useStyle(e.style),s=vue.useModel(o,"modelValue"),n=vue.ref(null);let a=null;return vue.onMounted(async()=>{if(n.value){const{default:l}=await Promise.resolve().then(()=>index);a=l(n.value,{mask:e.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1,placeholderChar:"_"}),a.on("accept",()=>{s.value=e.unmask?a.unmaskedValue:a.value}),a.on("complete",()=>{s.value=e.unmask?a.unmaskedValue:a.value}),a.value=s.value??""}}),vue.onBeforeUnmount(()=>{a?.destroy()}),vue.watch(()=>e.mask,l=>{a&&a.updateOptions({mask:l,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),vue.watch(s,l=>{a&&a.unmaskedValue!==l&&(a.value=l||"")}),(l,r)=>(vue.openBlock(),vue.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:n,placeholder:l.placeholder,disabled:l.disabled,name:l.name,class:vue.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f]",[vue.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,_hoisted_1$G))}}),_hoisted_1$F=["innerHTML"],_sfc_main$K=vue.defineComponent({__name:"vs-input-html",props:{style:{},customClass:{},placeholder:{},disabled:{type:Boolean},type:{},value:{},name:{},rules:{},error:{},text:{default:""},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{},prefix:{},host:{},data:{},options:{},maxHeight:{},slots:{},mode:{},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{},view:{},colSpan:{}},setup(o){return(e,t)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createElementVNode("div",{innerHTML:e.text},null,8,_hoisted_1$F)]))}}),_hoisted_1$E={class:"relative w-full bg-white rounded-lg"},_hoisted_2$f=["placeholder","disabled"],_sfc_main$J=vue.defineComponent({__name:"vs-input-email",props:vue.mergeModels({style:{default:()=>({})},customClass:{default:""},placeholder:{default:""},disabled:{type:Boolean,default:!1},type:{},value:{},name:{},rules:{},error:{default:null},text:{},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{},prefix:{},host:{},data:{},options:{},maxHeight:{},slots:{},mode:{},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{},view:{},colSpan:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,{inputClass:t}=useStyle(e.style),s=vue.useModel(o,"modelValue");return(n,a)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$E,[a[1]||(a[1]=vue.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),vue.withDirectives(vue.createElementVNode("input",{type:"email","onUpdate:modelValue":a[0]||(a[0]=l=>s.value=l),placeholder:n.placeholder,disabled:n.disabled,class:vue.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f]",[vue.unref(t),{"!border-red-600":n.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,_hoisted_2$f),[[vue.vModelText,s.value]])]))}}),_hoisted_1$D=["value","disabled"],_hoisted_2$e={class:"text-[13px] text-gray-700"},_sfc_main$I=vue.defineComponent({__name:"vs-input-radio-default",props:vue.mergeModels({style:{default:{}},customClass:{default:""},placeholder:{},disabled:{type:Boolean,default:!1},type:{},value:{},name:{},rules:{},error:{},text:{},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{},prefix:{},host:{},data:{},options:{},maxHeight:{},slots:{},mode:{},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{},view:{},colSpan:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=vue.useModel(o,"modelValue");return(t,s)=>(vue.openBlock(),vue.createElementBlock("label",{class:vue.normalizeClass(["flex items-center gap-0",[t.customClass]])},[vue.withDirectives(vue.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),type:"radio",value:t.value,disabled:t.disabled,class:"hidden"},null,8,_hoisted_1$D),[[vue.vModelRadio,e.value]]),vue.createElementVNode("span",{class:vue.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${t.style?.primaryColor||"blue"}-500`,t.disabled?"opacity-50 cursor-not-allowed":""]])},[e.value==t.value?(vue.openBlock(),vue.createElementBlock("span",{key:0,class:vue.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${t.style?.primaryColor||"blue"}-500`]])},null,2)):vue.createCommentVNode("",!0)],2),vue.createElementVNode("span",_hoisted_2$e,vue.toDisplayString(t.text),1)],2))}}),_hoisted_1$C=["value","disabled"],_hoisted_2$d={class:"text-[13px] text-gray-700"},_sfc_main$H=vue.defineComponent({__name:"vs-input-radio-buttons",props:vue.mergeModels({style:{default:{}},customClass:{default:""},placeholder:{},disabled:{type:Boolean,default:!1},type:{},value:{},name:{},rules:{},error:{},text:{},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{},prefix:{},host:{},data:{},options:{},maxHeight:{},slots:{},mode:{},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{},view:{},colSpan:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=vue.useModel(o,"modelValue");return(t,s)=>(vue.openBlock(),vue.createElementBlock("label",{class:vue.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[e.value==t.value?`ring-2 ring-ring ring-${t.style?.primaryColor||"blue"}-500`:"",t.customClass]])},[vue.withDirectives(vue.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=n=>e.value=n),type:"radio",value:t.value,disabled:t.disabled,class:"hidden"},null,8,_hoisted_1$C),[[vue.vModelRadio,e.value]]),vue.createElementVNode("span",_hoisted_2$d,vue.toDisplayString(t.text),1)],2))}}),layouts={"vs-input-radio-default":_sfc_main$I,"vs-input-radio-buttons":_sfc_main$H},_sfc_main$G=vue.defineComponent({__name:"vs-input-radio",props:vue.mergeModels({style:{},customClass:{},placeholder:{},disabled:{type:Boolean},type:{},value:{},name:{},rules:{},error:{},text:{},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{},prefix:{},host:{},data:{},options:{},maxHeight:{},slots:{},mode:{},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{default:"vertical"},view:{default:"default"},colSpan:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,t=vue.useModel(o,"modelValue"),s=vue.computed(()=>layouts[`vs-input-radio-${e.view}`]);return(n,a)=>(vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass([n.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.options,l=>(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(s.value),vue.mergeProps({key:l?.id,text:l.text,value:l.id.toString(),checked:t.value===l.id,modelValue:t.value,"onUpdate:modelValue":a[0]||(a[0]=r=>t.value=r)},{ref_for:!0},n.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),_sfc_main$F=vue.defineComponent({__name:"vs-input-checkbox",props:{style:{},customClass:{},placeholder:{},disabled:{type:Boolean},type:{},value:{},name:{},rules:{},error:{},text:{},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{},prefix:{},host:{},data:{default:null},options:{default:()=>[]},maxHeight:{},slots:{default:null},mode:{},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{default:!1},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{default:"vertical"},view:{default:null},colSpan:{default:0}},emits:["update:modelValue"],setup(o,{emit:e}){const t=o;console.log(t.position);const s=e,n=vue.ref([]),a=vue.reactive({}),l=u=>u?.value||u?.id||u?.text||u,r=u=>u.text||String(u),i=u=>`lg:col-span-${u||12}`,d=async()=>{try{const u=await fetch(`/api/suggest/${t.data}`).then(p=>p.json());n.value=u?.data||u}catch(u){console.error(u)}};return vue.watch(()=>t.modelValue,u=>{if(typeof u=="boolean"&&n.value.length===1){const p=l(n.value[0]);a[p]=u}else if(Array.isArray(u)){const p=new Set(u);n.value.forEach(c=>{if(!c.disabled){const b=l(c);a[b]=p.has(b)}})}},{immediate:!0}),vue.watch(a,()=>{if(!n.value.length){s("update:modelValue",null);return}const u=Object.entries(a).filter(([,p])=>p).map(([p])=>p);s("update:modelValue",u.length===0?null:u)},{deep:!0}),vue.onMounted(()=>{if(t.data)d().then(()=>{if(typeof t.modelValue=="boolean"&&n.value.length===1){const u=l(n.value[0]);a[u]=t.modelValue}else if(Array.isArray(t.modelValue)){const u=new Set(t.modelValue);n.value.forEach(p=>{if(!p.disabled){const c=l(p);a[c]=u.has(c)}})}});else if(n.value=t.options,typeof t.modelValue=="boolean"&&n.value.length===1){const u=l(n.value[0]);a[u]=t.modelValue}else if(Array.isArray(t.modelValue)){const u=new Set(t.modelValue);n.value.forEach(p=>{if(!p.disabled){const c=l(p);a[c]=u.has(c)}})}}),(u,p)=>(vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass(["p-0 w-full gap-[6px]",[u.position==="vertical"?"flex-col":"",u.colSpan?"grid":"flex justify-start"]])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.value,c=>(vue.openBlock(),vue.createBlock(_sfc_main$Q,{modelValue:a[l(c)],"onUpdate:modelValue":b=>a[l(c)]=b,value:l(c),class:vue.normalizeClass(i(u.colSpan)),disabled:c.disabled,label:r(c),key:l(c),icon:c?.icon,imgUrl:c?.imgUrl,option:c,slots:u.slots,view:u.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","slots","view"]))),128))],2))}}),VsInputCheckbox=_export_sfc(_sfc_main$F,[["__scopeId","data-v-9fe1d355"]]),_hoisted_1$B=["placeholder","disabled"],_sfc_main$E=vue.defineComponent({__name:"vs-input-date1",props:vue.mergeModels({style:{default:()=>({})},customClass:{default:""},placeholder:{default:""},disabled:{type:Boolean,default:!1},type:{},value:{},name:{},rules:{},error:{},text:{},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{},prefix:{},host:{},data:{},options:{},maxHeight:{},slots:{},mode:{},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{},view:{},colSpan:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,{inputClass:t}=useStyle(e.style),s=vue.useModel(o,"modelValue");return(n,a)=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("input",{type:"date","onUpdate:modelValue":a[0]||(a[0]=l=>s.value=l),placeholder:n.placeholder,disabled:n.disabled,class:vue.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f]",[vue.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,_hoisted_1$B)),[[vue.vModelText,s.value]])}}),fileUpload=async(o,e,t,s)=>{try{const n=new FormData;return n.append("unique","true"),n.append("file",o),(await fetch(`/file/upload/uploads?id=${e||""}&form=${t||""}&table=${s||""}`,{method:"POST",body:n}).then(l=>l.json()))?.result}catch(n){return core.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",n),null}},fileDelete=async o=>{try{return await fetch(`file/delete${o}`),!0}catch(e){return console.error(e),!1}},fileDownload=async o=>{try{const e=await fetch(`file/download/files/uploads${o}`),t=await e.arrayBuffer(),s=e.headers["content-type"],n=new TextDecoder("utf-8").decode(t),a=new Blob([n],{type:s}),l=document.createElement("a");l.setAttribute("download",o),l.href=window.URL.createObjectURL(a),l.click()}catch(e){console.error(e.message)}},_sfc_main$D={},_hoisted_1$A={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$k(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$A,e[0]||(e[0]=[vue.createElementVNode("path",{d:"M5 12h14"},null,-1),vue.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const IconPlus=_export_sfc(_sfc_main$D,[["render",_sfc_render$k]]),_sfc_main$C={},_hoisted_1$z={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-text",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$j(o,e,t,s,n,a){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$z,e[0]||(e[0]=[vue.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><line x1="9" y1="9" x2="10" y2="9"></line><line x1="9" y1="13" x2="15" y2="13"></line><line x1="9" y1="17" x2="15" y2="17"></line>',6)]))}const iconPdf=_export_sfc(_sfc_main$C,[["render",_sfc_render$j]]),_sfc_main$B={},_hoisted_1$y={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-table",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$i(o,e,t,s,n,a){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$y,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),vue.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),vue.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const IconCsv=_export_sfc(_sfc_main$B,[["render",_sfc_render$i]]),_sfc_main$A={},_hoisted_1$x={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-file-unknown"};function _sfc_render$h(o,e,t,s,n,a){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$x,e[0]||(e[0]=[vue.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M12 17v.01"></path><path d="M12 14a1.5 1.5 0 1 0 -1.14 -2.474"></path>',5)]))}const IconFile=_export_sfc(_sfc_main$A,[["render",_sfc_render$h]]),_sfc_main$z={},_hoisted_1$w={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-zip",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$g(o,e,t,s,n,a){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$w,e[0]||(e[0]=[vue.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1"></path><path d="M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2z"></path><line x1="11" y1="5" x2="10" y2="5"></line><line x1="13" y1="7" x2="12" y2="7"></line><line x1="11" y1="9" x2="10" y2="9"></line><line x1="13" y1="11" x2="12" y2="11"></line><line x1="11" y1="13" x2="10" y2="13"></line><line x1="13" y1="15" x2="12" y2="15"></line>',9)]))}const IconZip=_export_sfc(_sfc_main$z,[["render",_sfc_render$g]]),_sfc_main$y={},_hoisted_1$v={xmlns:"http://www.w3.org/2000/svg",class:"icon icon-tabler icon-tabler-file-code",width:"44",height:"44",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",fill:"none","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$f(o,e,t,s,n,a){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$v,e[0]||(e[0]=[vue.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M10 13l-1 2l1 2"></path><path d="M14 13l1 2l-1 2"></path>',5)]))}const IconGeojson=_export_sfc(_sfc_main$y,[["render",_sfc_render$f]]),getFileType=o=>{if(!o)return"";const e=o?.split(".");return e[e.length-1]},fileFormatPreview=o=>{const e=getFileType(o),t={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 t.imageFormat.includes(e)?"img":t.sheetsFormat.includes(e)?IconCsv:t.textsFormat.includes(e)?IconGeojson:t.documentsFormat.includes(e)?iconPdf:t.archivesFormat.includes(e)?IconZip:IconFile},_sfc_main$x={},_hoisted_1$u={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function _sfc_render$e(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$u,e[0]||(e[0]=[vue.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const IconDelete=_export_sfc(_sfc_main$x,[["render",_sfc_render$e]]),_sfc_main$w={},_hoisted_1$t={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function _sfc_render$d(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$t,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),vue.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),vue.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const IconDownload=_export_sfc(_sfc_main$w,[["render",_sfc_render$d]]),_hoisted_1$s={class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},_hoisted_2$c={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},_sfc_main$v=vue.defineComponent({__name:"vs-input-file-list-item",props:vue.mergeModels({style:{},customClass:{},placeholder:{},disabled:{type:Boolean},type:{},value:{},name:{},rules:{},error:{},text:{},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{},prefix:{},host:{},data:{},options:{},maxHeight:{},slots:{},mode:{},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{},view:{},colSpan:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(o){const e=vue.useModel(o,"value"),t=vue.useModel(o,"item"),s=o;return(n,a)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$s,[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(vue.unref(fileFormatPreview)(t.value)),{src:t.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:a[0]||(a[0]=l=>vue.unref(fileDownload)(t.value))},null,8,["src"])),vue.createElementVNode("div",_hoisted_2$c,[vue.createElementVNode("button",{type:"button",onClick:a[1]||(a[1]=l=>{vue.unref(fileDelete)(t.value),e.value=s.multiple?e.value?.filter(r=>r!==t.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[vue.createVNode(IconDelete,{class:"w-4 h-4"})]),vue.createElementVNode("button",{type:"button",onClick:a[2]||(a[2]=l=>vue.unref(fileDownload)(t.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[vue.createVNode(IconDownload,{class:"w-4 h-4"})])])]))}}),VsInputFileListItem=_export_sfc(_sfc_main$v,[["__scopeId","data-v-02a1389c"]]),_hoisted_1$r={class:"flex items-center gap-x-2"},_hoisted_2$b={key:1,class:"flex items-center flex-wrap gap-2"},_sfc_main$u=vue.defineComponent({__name:"vs-input-file",props:vue.mergeModels({style:{},customClass:{},placeholder:{},disabled:{type:Boolean},type:{},value:{},name:{},rules:{},error:{},text:{},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{},prefix:{},host:{},data:{},options:{},maxHeight:{},slots:{},mode:{},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{},view:{},colSpan:{}},{modelValue:{},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,t=vue.useModel(o,"modelValue"),s=vue.ref(null),n=l=>Array.isArray(t.value)&&t.value[l]||"",a=async l=>{if(e.format){const d=l.target.files?.[0];if(!d||!d.name.endsWith(e.format))return}const r=l.target.files?.[0];if(!r)return;const i=await fileUpload(r,"1","form","table");t.value=e.multiple?[...t.value||[],i?.file_path]:i?.file_path};return(l,r)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$r,[vue.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:s,type:"file",onChange:a},null,544),!l.multiple&&t.value?(vue.openBlock(),vue.createBlock(VsInputFileListItem,{key:0,item:t.value,"onUpdate:item":r[0]||(r[0]=i=>t.value=i),value:t.value,"onUpdate:value":r[1]||(r[1]=i=>t.value=i)},null,8,["item","value"])):l.multiple?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$b,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(t.value,(i,d)=>(vue.openBlock(),vue.createBlock(VsInputFileListItem,{multiple:l.multiple,key:d,value:t.value,"onUpdate:value":r[2]||(r[2]=u=>t.value=u),item:n(d)},null,8,["multiple","value","item"]))),128)),vue.createElementVNode("div",{onClick:r[3]||(r[3]=i=>!l.disabled&&s.value?.click()),class:vue.normalizeClass(["h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",l.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[vue.createVNode(IconPlus,{class:"w-6 h-6"})],2)])):vue.createCommentVNode("",!0),l.multiple?vue.createCommentVNode("",!0):(vue.openBlock(),vue.createElementBlock("div",{key:2,onClick:r[4]||(r[4]=i=>s.value?.click()),class:vue.normalizeClass([l.disabled?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[vue.createVNode(IconPlus,{class:"w-6 h-6"})],2))]))}}),_hoisted_1$q={class:"max-w-[55vw]"},_hoisted_2$a={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},_hoisted_3$9={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},_hoisted_4$8={class:"px-[5px]"},_hoisted_5$7={class:""},_sfc_main$t=vue.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(o){const e=o,t=vue.computed(()=>{try{return new Date(e.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function s(n){if(n<1024)return`${n} B`;const a=n/1024;return a<1024?`${a.toFixed(2)} KB`:`${(a/1024).toFixed(2)} MB`}return(n,a)=>(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,[a[1]||(a[1]=vue.createStaticVNode('<div class="flex items-center justify-center h-[30px] w-[30px]"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path></svg></div>',1)),vue.createElementVNode("div",_hoisted_1$q,[vue.createElementVNode("p",_hoisted_2$a,vue.toDisplayString(n.item?.uploaded_name),1),vue.createElementVNode("p",_hoisted_3$9,[vue.createElementVNode("span",null,vue.toDisplayString(n.item?.username),1),vue.withDirectives(vue.createElementVNode("span",_hoisted_4$8,"|",512),[[vue.vShow,n.item?.username]]),vue.createElementVNode("span",null,vue.toDisplayString(t.value),1),a[0]||(a[0]=vue.createElementVNode("span",{class:"px-[5px]"},"|",-1)),vue.createElementVNode("span",_hoisted_5$7,vue.toDisplayString(s(n.item?.size)),1)])])],64))}}),_hoisted_1$p={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},_hoisted_2$9={key:0,class:"flex w-full gap-x-3 items-center"},_hoisted_3$8={key:1,class:"flex gap-x-3 w-full items-center"},_hoisted_4$7={key:2,class:"flex gap-x-3 w-full items-center"},_hoisted_5$6=["href"],_hoisted_6$6={key:3,class:"flex gap-x-3 w-full items-center"},_hoisted_7$5={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},_hoisted_8$5={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"},_hoisted_9$4={class:"inline-block"},_hoisted_10$3={class:"inline-block"},_sfc_main$s=vue.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(o,{emit:e}){const t=o,s=e;vue.reactive({defaultType:"iframe"});function n(u){return["pdf","json"].includes(u.ext)}function a(u){return["ppt","pptx","doc","docx","xls","xlsx"].includes(u.ext)}function l(u){const p=document.createElement("a");p.setAttribute("download",u?.uploaded_name),p.href=u?.file_path,p.click()}function r(){s("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}async function i(){try{await fetch(`${t.prefix}/widget/file/${t.item.entity_id}/${t.item.file_id}`),s("update")}catch(u){console.error(u)}}function d(u){(t.item.ext==="jpg"||t.item.ext==="png")&&s("openLightbox",{item:t.item,index:u})}return vue.computed(()=>{try{return new Date(t.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}}),(u,p)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$p,[u.item.ext==="jpg"||u.item.ext==="png"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_2$9,[vue.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:p[0]||(p[0]=c=>d(u.index))},[vue.createVNode(_sfc_main$t,{item:u.item},null,8,["item"])])])):n(u.item)?(vue.openBlock(),vue.createElementBlock("div",_hoisted_3$8,[vue.createVNode(_sfc_main$t,{item:u.item},null,8,["item"])])):a(u.item)?(vue.openBlock(),vue.createElementBlock("div",_hoisted_4$7,[vue.createElementVNode("a",{href:`/api/file-preview?id=${u.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[vue.createVNode(_sfc_main$t,{item:u.item},null,8,["item"])],8,_hoisted_5$6)])):(vue.openBlock(),vue.createElementBlock("div",_hoisted_6$6,[vue.createVNode(_sfc_main$t,{item:u.item},null,8,["item"])])),vue.createElementVNode("div",_hoisted_7$5,[vue.createElementVNode("div",_hoisted_8$5,[vue.createElementVNode("div",_hoisted_9$4,[vue.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:p[1]||(p[1]=c=>l(u.item))},[vue.createVNode(IconDownload,{height:"14",width:"14"})])]),p[3]||(p[3]=vue.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),vue.createElementVNode("div",_hoisted_10$3,[vue.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:p[2]||(p[2]=c=>r())},[vue.createVNode(IconDelete,{height:"14",width:"14"})])])])])]))}}),_sfc_main$r={},_hoisted_1$o={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function _sfc_render$c(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$o,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),vue.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),vue.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const IconUpload=_export_sfc(_sfc_main$r,[["render",_sfc_render$c]]),_hoisted_1$n={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},_hoisted_2$8={class:"flex w-full mb-[12px] items-center gap-x-2"},_hoisted_3$7={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},_hoisted_4$6={class1:"ml-auto"},_hoisted_5$5={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"},_hoisted_6$5={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},_hoisted_7$4={class:"relative"},_hoisted_8$4={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"},_hoisted_9$3={key:0},_sfc_main$q=vue.defineComponent({__name:"vs-input-file-list",props:{style:{},customClass:{},placeholder:{},disabled:{type:Boolean},type:{},value:{},name:{},rules:{},error:{},text:{},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{},prefix:{default:"/api"},host:{},data:{},options:{},maxHeight:{},slots:{},mode:{},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{},view:{},colSpan:{}},emits:["update"],setup(o,{emit:e}){const t=o,s=vue.inject("form"),n=vue.computed(()=>s.value.formId),a=vue.ref(!1),l=vue.ref(0),r=e,i=vue.ref(!1),d=vue.ref({}),u=vue.ref([]),p=vue.ref(""),c=vue.computed(()=>Array.isArray(u.value)?u.value.filter(k=>k.ext==="jpg"||k.ext==="png").map(k=>k?.file_path):[]);console.log("images",c.value);const b=vue.computed(()=>p.value===""?u.value:u.value.filter(k=>k?.uploaded_name?.includes(p.value))),E=k=>{const v=c.value.findIndex(I=>I===k.item.file_path);v!==-1&&(a.value=!0,l.value=v)},V=async()=>{try{const k=await fetch(`${t.prefix}/widget/file/${n.value}`).then(v=>v.json());u.value=k?.rows}catch(k){console.error(k)}},M=async k=>{await Promise.all(Array.from(k.target.files).map(async v=>{const I=new FormData;I.append("file",v);try{const y=`${t.prefix}/widget/file/${n.value}`;return await fetch(y,{method:"POST",body:I}),r("update","file-list"),v}catch(y){return console.error(y),null}})),await V()},$=k=>{const v={...k};return k.cancel||(v.cancel=()=>{i.value=!1}),k.updateListOnConfirm&&(v.confirm=async()=>{await k.confirm(),i.value=!1,V()}),v},w=k=>{d.value=$(k),i.value=!0};return vue.watch(n,k=>{k&&V()}),vue.onMounted(()=>{n.value&&V()}),(k,v)=>{const I=vue.resolveComponent("Lightbox"),y=vue.resolveComponent("MessageBox");return vue.openBlock(),vue.createElementBlock("div",_hoisted_1$n,[vue.createElementVNode("div",_hoisted_2$8,[vue.createElementVNode("h2",_hoisted_3$7," Файлів: "+vue.toDisplayString(u.value?.length),1),vue.createElementVNode("div",_hoisted_4$6,[vue.createElementVNode("label",null,[vue.createElementVNode("input",{type:"file",class:"hidden",onChange:v[0]||(v[0]=_=>M(_))},null,32),vue.createElementVNode("div",_hoisted_5$5,[vue.createVNode(IconUpload,{height:"16",width:"16"})])])])]),u.value?.length>4?(vue.openBlock(),vue.createElementBlock("div",_hoisted_6$5,[vue.createElementVNode("div",null,[vue.createElementVNode("div",_hoisted_7$4,[v[8]||(v[8]=vue.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[vue.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[vue.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),vue.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),vue.withDirectives(vue.createElementVNode("input",{type:"text","onUpdate:modelValue":v[1]||(v[1]=_=>p.value=_),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[vue.vModelText,p.value,void 0,{trim:!0}]])])])])):vue.createCommentVNode("",!0),u.value?.length?(vue.openBlock(),vue.createElementBlock("div",_hoisted_8$4,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(b.value,(_,x)=>(vue.openBlock(),vue.createBlock(_sfc_main$s,{key:x,prefix:k.prefix,item:_,index:x,onUpdate:v[2]||(v[2]=B=>k.$emit("update","file-list")),onOpenModal:v[3]||(v[3]=B=>w(B)),onOpenLightbox:v[4]||(v[4]=B=>E(B))},null,8,["prefix","item","index"]))),128)),b.value.length?vue.createCommentVNode("",!0):(vue.openBlock(),vue.createElementBlock("div",_hoisted_9$3,v[9]||(v[9]=[vue.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):vue.createCommentVNode("",!0),vue.createVNode(I,{modelValue:a.value,"onUpdate:modelValue":v[5]||(v[5]=_=>a.value=_),startIndex:l.value,"onUpdate:index":v[6]||(v[6]=_=>l.value=_),images:c.value},null,8,["modelValue","startIndex","images"]),vue.createVNode(y,vue.mergeProps({modelValue:i.value,"onUpdate:modelValue":v[7]||(v[7]=_=>i.value=_),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),_hoisted_1$m={class:"flex items-center justify-between"},_hoisted_2$7={class:"text-[16px] text-gray-900 font-medium"},_hoisted_3$6={class:"grid gap-3"},_sfc_main$p=vue.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(o){const e=o,t=vue.ref(e.isOpen);return vue.watch(()=>e.isOpen,s=>{t.value=s}),(s,n)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createElementVNode("div",_hoisted_1$m,[vue.createElementVNode("p",_hoisted_2$7,vue.toDisplayString(o.title),1),vue.createVNode(_sfc_main$N,{modelValue:t.value,"onUpdate:modelValue":n[0]||(n[0]=a=>t.value=a),style:vue.normalizeStyle(o.style)},null,8,["modelValue","style"])]),vue.createVNode(vue.Transition,{name:"slide-fade"},{default:vue.withCtx(()=>[vue.withDirectives(vue.createElementVNode("div",_hoisted_3$6,[vue.renderSlot(s.$slots,"default",{},void 0,!0)],512),[[vue.vShow,t.value]])]),_:3})]))}}),VsContainerSwitcher=_export_sfc(_sfc_main$p,[["__scopeId","data-v-479564a3"]]),_hoisted_1$l={class:"text-[16px] text-gray-900 font-medium"},_hoisted_2$6={class:"grid gap-3"},_sfc_main$o=vue.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(o){const e=o,t=vue.ref(e.isOpen);return vue.watch(()=>e.isOpen,s=>{t.value=s}),(s,n)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createElementVNode("button",{type:"button",onClick:n[0]||(n[0]=a=>t.value=!t.value),class:"flex items-center gap-2"},[vue.createVNode(vue.unref(IconChevronDown),{class:vue.normalizeClass(["h-4 w-4 duration-300",[t.value?"-rotate-180":""]])},null,8,["class"]),vue.createElementVNode("span",_hoisted_1$l,vue.toDisplayString(o.title),1)]),vue.createVNode(vue.Transition,{name:"slide-fade"},{default:vue.withCtx(()=>[vue.withDirectives(vue.createElementVNode("div",_hoisted_2$6,[vue.renderSlot(s.$slots,"default",{},void 0,!0)],512),[[vue.vShow,t.value]])]),_:3})]))}}),VsContainerAccordion=_export_sfc(_sfc_main$o,[["__scopeId","data-v-a37284e6"]]),_hoisted_1$k={class:"flex items-center justify-between"},_sfc_main$n=vue.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(o){return(e,t)=>(vue.openBlock(),vue.createElementBlock("div",null,[vue.createElementVNode("div",_hoisted_1$k,[vue.createElementVNode("p",null,vue.toDisplayString(o.title),1)]),vue.renderSlot(e.$slots,"default")]))}}),views={switcher:VsContainerSwitcher,accordion:VsContainerAccordion,default:_sfc_main$n},FormConditionsTypes={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},checkEqual=(o,e)=>String(o)===String(e),checkInequal=(o,e)=>String(o)!==String(e),checkHigher=(o,e)=>o>e,checkHigherOrEqual=(o,e)=>o>=e,checkLower=(o,e)=>o<e,checkLowerOrEqual=(o,e)=>o<=e,checkBetween=(o,e)=>Array.isArray(e)&&e.length===2?o>=e[0]&&o<=e[1]:!1,checkStartWith=(o,e)=>String(o).startsWith(String(e)),checkEndWith=(o,e)=>String(o).endsWith(String(e)),checkContain=(o,e)=>String(o).includes(String(e)),checkIn=(o,e)=>Array.isArray(e)?e.includes(o):!1,checkNotIn=(o,e)=>Array.isArray(e)?!e.includes(o):!0,isVisible=(o,e)=>{if(!e)return!0;switch(e?.[1]){case FormConditionsTypes.Equal:return checkEqual(o,e?.[2]);case FormConditionsTypes.Inequal:return checkInequal(o,e?.[2]);case FormConditionsTypes.Higer:return checkHigher(o,e?.[2]);case FormConditionsTypes.HigerOrEqual:return checkHigherOrEqual(o,e?.[2]);case FormConditionsTypes.Lower:return checkLower(o,e?.[2]);case FormConditionsTypes.LowerOrEqual:return checkLowerOrEqual(o,e?.[2]);case FormConditionsTypes.Between:return checkBetween(o,e?.[2]);case FormConditionsTypes.StartWith:return checkStartWith(o,e?.[2]);case FormConditionsTypes.EndWith:return checkEndWith(o,e?.[2]);case FormConditionsTypes.Contain:return checkContain(o,e?.[2]);case FormConditionsTypes.In:return checkIn(o,e?.[2]);case FormConditionsTypes.NotIn:return checkNotIn(o,e?.[2]);default:return!0}},_sfc_main$m=vue.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},schema:{type:Array,default:()=>[]}},setup(o){const e=o,t=vue.inject("formValues",{default:{}}),s=vue.inject("form"),n=vue.computed(()=>e.schema?.filter(l=>{const r=l?.conditions;if(!r)return!0;const i=Array.isArray(r)?r[0]:r,d=t?.value?.[i];return isVisible(d,r)})),a=vue.computed(()=>views[e.view]);return(l,r)=>o.schema?.length?(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(a.value),{key:0,title:o.title,style:vue.normalizeStyle(o.style)},{default:vue.withCtx(()=>[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(n.value,i=>(vue.openBlock(),vue.createBlock(_sfc_main$1,vue.mergeProps({key:i.name},{ref_for:!0},i,{item:i,modelValue:vue.unref(t)[i.name],"onUpdate:modelValue":d=>vue.unref(t)[i.name]=d,style:o.style,error:vue.unref(s)?.errors?.[i.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):vue.createCommentVNode("",!0)}});function mitt(o){return{all:o=o||new Map,on:function(e,t){var s=o.get(e);s?s.push(t):o.set(e,[t])},off:function(e,t){var s=o.get(e);s&&(t?s.splice(s.indexOf(t)>>>0,1):o.set(e,[]))},emit:function(e,t){var s=o.get(e);s&&s.slice().map(function(n){n(t)}),(s=o.get("*"))&&s.slice().map(function(n){n(e,t)})}}}const emitter=mitt(),_hoisted_1$j={class:"relative"},_hoisted_2$5={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},_hoisted_3$5={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"},_hoisted_4$5={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},_hoisted_5$4={class:"font-medium text-gray-800 dark:text-[#ffffff]"},_hoisted_6$4={class:"p-4 mim-h-0 h-full overflow-auto"},_sfc_main$l=vue.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(o,{emit:e}){const t=o,s=e,n=vue.ref(t.schema),a=vue.ref(t.defaultValue?JSON.parse(JSON.stringify(t.defaultValue)):{}),l=vue.ref({}),r=vue.ref(),i=vue.ref(t.mode);async function d(){const p=l.value.validate();if(p){core.notify({type:"warning",title:"Validation",message:Object.entries(p).map(([c,b])=>`${c}: ${b}`).join(`
|
|
2
|
+
`)});return}r.value&&(await fetch("/api/table/"+r.value,{method:i.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(a.value)}).then(c=>c.json()),core.notify({type:"success",title:"Успішно",message:`Дані успішно ${i.value==="add"?"збережено":"оновленно"}`}),emitter.emit("saveDormData",a.value)),s("save",a.value)}function u(){s("close")}return vue.onMounted(async()=>{if(t.form){const p=await fetch(`/api/template/form/${t.form}`).then(c=>c.json());n.value=p.schema,r.value=p.token}else if(t.token){r.value=t.token;const p=await fetch(`/api/form/${r.value}`).then(c=>c.json());n.value=p.schema,p.data?a.value=p.data:i.value="add"}}),(p,c)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$j,[vue.createElementVNode("div",_hoisted_2$5,[vue.createElementVNode("div",_hoisted_3$5,[vue.createElementVNode("div",_hoisted_4$5,[vue.createElementVNode("h3",_hoisted_5$4,vue.toDisplayString(i.value==="add"?"Додати":"Змінити"),1),vue.createElementVNode("button",{onClick:u,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"},c[2]||(c[2]=[vue.createElementVNode("span",{class:"sr-only"},"Close",-1),vue.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[vue.createElementVNode("path",{d:"M18 6 6 18"}),vue.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),vue.createElementVNode("div",_hoisted_6$4,[n.value?(vue.openBlock(),vue.createBlock(_sfc_main,{key:0,schema:n.value,values:a.value,"onUpdate:values":c[0]||(c[0]=b=>a.value=b),form:l.value,"onUpdate:form":c[1]||(c[1]=b=>l.value=b)},null,8,["schema","values","form"])):vue.createCommentVNode("",!0)]),vue.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"},[vue.createElementVNode("button",{type:"button",onClick:u,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"}," Скасувати "),vue.createElementVNode("button",{onClick:d,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])])])]))}}),form=(o={mode:"edit",schema:null})=>new Promise((e,t)=>{const s=document.querySelector("body");if(!s){console.error('Modal root element with id "#modal" not found!');return}const n=document.createElement("div");s.appendChild(n);const a=vue.createApp({render(){return vue.h(_sfc_main$l,{...o,onClose:()=>{e(null),l()},onSave:r=>{e(r),console.log(r),l()}})}});function l(){a.unmount(),n.remove()}a.mount(n)}),_hoisted_1$i={class:"select-container w-full"},_hoisted_2$4=["aria-expanded"],_hoisted_3$4={key:1,class:"placeholder"},_hoisted_4$4=["data-value"],_hoisted_5$3={class:"right-side"},_hoisted_6$3={key:0,class:"dropdown-menu"},_hoisted_7$3=["onClick"],_hoisted_8$3={key:0,class:"option-no-value"},_sfc_main$k=vue.defineComponent({__name:"vs-input-select",props:vue.mergeModels({style:{default:()=>({})},customClass:{default:""},placeholder:{default:"Оберіть значення"},disabled:{type:Boolean},type:{},value:{},name:{},rules:{},error:{default:null},text:{},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{},prefix:{default:"api"},host:{default:""},data:{default:null},options:{default:()=>[]},maxHeight:{default:400},slots:{default:null},mode:{default:"search"},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{},view:{},colSpan:{}},{modelValue:{type:[Number,String],default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,t=vue.computed(()=>e.mode||(e.api||e.search?"search":null));useStyle(e.style);const s=vue.useModel(o,"modelValue"),n=vue.ref(null),a=vue.ref(!1),l=vue.ref(!1),r=vue.ref({}),i=vue.ref(null),d=vue.ref(null),u=vue.ref(null),p=vue.ref([]),c=vue.ref(-1),b=vue.ref([]),E=vue.ref(""),V=vue.ref(null);let M=null;const $=vue.computed(()=>{if(p.value?.length){const h=p.value?.filter(m=>m?.id!==u.value?.id);return[u.value].concat(h)?.filter(m=>m!==null)}return[]}),w=async()=>{try{const{data:h}=await fetch(`${e.host}/${e.prefix}/suggest/${e.data}?json=1&key=${E.value}`).then(m=>m.json());return h}catch{return[]}},k=async h=>{document.body.click(),a.value=h!==void 0?h:!a.value,a.value&&!p.value?.length&&(!e.options?.length&&e.data?p.value=await w():e.options?.length&&(p.value=[...e.options])),a.value&&i.value?(r.value.width=`${i.value.getBoundingClientRect()?.width}px`,t.value==="search"&&V.value?.focus()):c.value=-1},v=()=>a.value?k(!1):null,I=h=>{u.value=h,s.value=h.id,l.value=!1,k(!1)};function y(){u.value=null,s.value=null,a.value=!0}const _=(h,m)=>{if(!h||!m)return;const C=h.offsetTop,D=C+h.offsetHeight,F=m.scrollTop,T=F+m.clientHeight;C<F?Object.assign(m,{scrollTop:C-80}):D>T&&Object.assign(m,{scrollTop:D-m.clientHeight+4})},x=h=>{if(!a.value)return;const{keyCode:m}=h;if([38,40,13].includes(m)&&h.preventDefault(),m===38){if(c.value===0)return;c.value-=1,_(b.value[c.value],d.value)}else if(m===40){if(c.value+1>=$.value?.length)return;c.value+=1,_(b.value[c.value],d.value)}else if(m===13){const C=$.value[c.value];C&&I(C)}},B=async h=>{if(a.value)return;const{keyCode:m}=h;[38,40].includes(m)&&(await h.preventDefault(),c.value=0,setTimeout(()=>k()))},N=h=>{a.value&&i.value&&d.value&&!d.value.contains(h.target)&&(a.value=!1)},S=h=>{h?.key==="Escape"&&a.value&&k(!1)};async function A(h){if(!h)return null;const m=p.value?.find(D=>D?.id.toString()===h?.toString());if(m)return m;const{data:C}=await fetch(`${e.host}/${e.prefix}/suggest/${e.data}?json=1&val=${h}`).then(D=>D.json());return C[0]}vue.onMounted(async()=>{addEventListener("click",v),addEventListener("keydown",x),addEventListener("scroll",N,!0),addEventListener("keydown",S),e.options&&(p.value=e.options),s.value&&!e.options?.length&&e.data&&(p.value=await w()),u.value=await A(s.value?.toString())}),vue.onUnmounted(()=>{removeEventListener("click",v),removeEventListener("keydown",x),removeEventListener("scroll",N,!0),removeEventListener("keydown",S)}),vue.watch(E,h=>{let m=!1;(h===""||h.trimStart().length!==0)&&(m=!0),m&&(M&&clearTimeout(M),M=setTimeout(async()=>{!e.options?.length&&e.data?p.value=await w():p.value=e.options.filter(C=>C.text.toLowerCase().includes(h.toLowerCase()))},200))});async function P(){if(!e.add)return;const h=await form({form:e.add.form,mode:"add"});if(!h)return;const m=await fetch(`/api/table/${e.add.token}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(h)}).then(C=>C.json());s.value=m.id,u.value=await A(m.id)}vue.watch(s,h=>{const m=p.value.find(C=>C.id===h);m&&(u.value=m,k(!1))});const z=()=>{a.value=!0,l.value=!l.value,V.value?.focus(),a.value&&vue.nextTick(()=>{k(!0),V.value?.focus()})},U=()=>{l.value=!1,E.value=""},O=()=>{l.value=!0,E.value=""},f=()=>{a.value=!1,E.value=""},g=h=>{n.value?.contains(h.target)||f()};return vue.onMounted(()=>document.addEventListener("click",g,!0)),vue.onBeforeUnmount(()=>document.removeEventListener("click",g)),(h,m)=>(vue.openBlock(),vue.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"select",ref:i,onClick:m[1]||(m[1]=vue.withModifiers(()=>{},["stop"]))},[vue.createElementVNode("div",_hoisted_1$i,[m[5]||(m[5]=vue.createElementVNode("span",{id:"react-select-live-region",class:"a11yText"},null,-1)),m[6]||(m[6]=vue.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"a11yText"},null,-1)),vue.createElementVNode("div",{onKeydown:B,class:vue.normalizeClass(l.value?"select-control-focus":"select-control"),role:"combobox","aria-expanded":a.value,"aria-haspopup":"true"},[vue.createElementVNode("div",{class:"input-wrapper",onClick:z,style:{display:"grid"},ref_key:"triggerRef",ref:n},[u.value?.text&&E.value===""?(vue.openBlock(),vue.createElementBlock("div",{key:0,class:vue.normalizeClass(["singleValue",a.value?"text-gray-500":"text-gray-900"])},vue.toDisplayString(u.value?.text),3)):vue.createCommentVNode("",!0),!E.value&&!u.value?.text?(vue.openBlock(),vue.createElementBlock("div",_hoisted_3$4,vue.toDisplayString(h.placeholder),1)):vue.createCommentVNode("",!0),vue.createElementVNode("div",{class:"input-container","data-value":E.value},[l.value?vue.withDirectives((vue.openBlock(),vue.createElementBlock("input",{key:0,ref_key:"inputRef",ref:V,onFocus:O,onBlur:U,autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",role:"combobox","onUpdate:modelValue":m[0]||(m[0]=C=>E.value=C)},null,544)),[[vue.vModelText,E.value]]):vue.createCommentVNode("",!0)],8,_hoisted_4$4)],512),vue.createElementVNode("div",_hoisted_5$3,[s.value?(vue.openBlock(),vue.createElementBlock("div",{key:0,onClick:y,class:vue.normalizeClass(a.value?"indicatorContainer-open":"indicatorContainer"),"aria-hidden":"true"},m[2]||(m[2]=[vue.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"side-icon"},[vue.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),2)):vue.createCommentVNode("",!0),m[4]||(m[4]=vue.createElementVNode("span",{class:"indicatorSeparator"},null,-1)),vue.createElementVNode("div",{class:vue.normalizeClass(a.value?"indicatorContainer-open":"indicatorContainer"),"aria-hidden":"true",onClick:z},m[3]||(m[3]=[vue.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"side-icon"},[vue.createElementVNode("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})],-1)]),2)])],42,_hoisted_2$4),a.value?(vue.openBlock(),vue.createElementBlock("div",_hoisted_6$3,[vue.createElementVNode("div",{class:"menu-container text-gray-900",ref_key:"list",ref:d},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList($.value,(C,D)=>(vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass([s.value==C?.id?"single-option-active":"single-option",c.value==D?"!bg-blue-100":""]),key:C.id,onClick:F=>I(C),ref_for:!0,ref:F=>b.value[D]=F,"aria-disabled":"false",id:"react-select-3-option-0",tabindex:"-1",role:"option"},vue.toDisplayString(C?.text),11,_hoisted_7$3))),128)),$.value.length===0?(vue.openBlock(),vue.createElementBlock("div",_hoisted_8$3," No options ")):vue.createCommentVNode("",!0)],512)])):vue.createCommentVNode("",!0)]),e.add?(vue.openBlock(),vue.createElementBlock("button",{key:0,onClick:P,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 leadig-[18.5px] py-[10] px-[12px] border border-solid border-stone-200 rounded-md h-[38px] max-h-[40] gap-[8px] flex items-center"},[vue.createVNode(IconPlus,{width:"16",height:"16"}),m[7]||(m[7]=vue.createElementVNode("span",null,"Додати",-1))])):vue.createCommentVNode("",!0)],512))}}),VsInputSelect=_export_sfc(_sfc_main$k,[["__scopeId","data-v-3a40c8bb"]]),_hoisted_1$h=["placeholder","disabled"],_sfc_main$j=vue.defineComponent({__name:"vs-input-textarea",props:vue.mergeModels({style:{default:()=>({})},customClass:{default:""},placeholder:{default:""},disabled:{type:Boolean,default:!1},type:{},value:{},name:{},rules:{},error:{},text:{},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{},prefix:{},host:{},data:{},options:{},maxHeight:{},slots:{},mode:{},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{},view:{},colSpan:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,{inputClass:t}=useStyle(e.style),s=vue.useModel(o,"modelValue");return(n,a)=>vue.withDirectives((vue.openBlock(),vue.createElementBlock("textarea",{"onUpdate:modelValue":a[0]||(a[0]=l=>s.value=l),placeholder:n.placeholder,disabled:n.disabled,row:"2",class:vue.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto",[vue.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,_hoisted_1$h)),[[vue.vModelText,s.value]])}}),_sfc_main$i={},_hoisted_1$g={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};function _sfc_render$b(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$g,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),vue.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const IconMagnifyingGlass=_export_sfc(_sfc_main$i,[["render",_sfc_render$b]]),_sfc_main$h={},_hoisted_1$f={class:"flex-shrink-0 mt-0.5 size-3.5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$a(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$f,e[0]||(e[0]=[vue.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),vue.createElementVNode("path",{d:"M7 20V4"},null,-1),vue.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),vue.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const IconArrowTopBottom=_export_sfc(_sfc_main$h,[["render",_sfc_render$a]]),_sfc_main$g={},_hoisted_1$e={xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$9(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$e,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),vue.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),vue.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const IconImport=_export_sfc(_sfc_main$g,[["render",_sfc_render$9]]),_sfc_main$f={},_hoisted_1$d={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$8(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$d,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),vue.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),vue.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const IconExport=_export_sfc(_sfc_main$f,[["render",_sfc_render$8]]),_sfc_main$e={},_hoisted_1$c={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$7(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$c,e[0]||(e[0]=[vue.createStaticVNode('<circle cx="9" cy="12" r="1"></circle><circle cx="9" cy="5" r="1"></circle><circle cx="9" cy="19" r="1"></circle><circle cx="15" cy="12" r="1"></circle><circle cx="15" cy="5" r="1"></circle><circle cx="15" cy="19" r="1"></circle>',6)]))}const IconGripVertical=_export_sfc(_sfc_main$e,[["render",_sfc_render$7]]),_sfc_main$d={},_hoisted_1$b={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function _sfc_render$6(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$b,e[0]||(e[0]=[vue.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 IconNoData=_export_sfc(_sfc_main$d,[["render",_sfc_render$6]]),_sfc_main$c={},_hoisted_1$a={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function _sfc_render$5(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$a,e[0]||(e[0]=[vue.createElementVNode("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"},null,-1)]))}const IconPen=_export_sfc(_sfc_main$c,[["render",_sfc_render$5]]),_hoisted_1$9={class:"vs-datatable border rounded-xl w-full flex-grow"},_hoisted_2$3={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},_hoisted_3$3={class:"relative w-full"},_hoisted_4$3={class:"table-wrapper flex gap-2"},_hoisted_5$2={class:"vs-popover inline-block text-slate-700"},_hoisted_6$2={class:"text-center"},_hoisted_7$2={class:""},_hoisted_8$2={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"},_hoisted_9$2={class:"flex flex-col p-[2px] gap-[2px] w-[140px]"},_hoisted_10$2={class:"text-sm items-center text-gray-800 flex gap-1"},_hoisted_11$2={class:"w-full overflow-x-auto"},_hoisted_12$2={class:"w-full table-auto caption-bottom text-sm"},_hoisted_13$2={class:"[&_tr]:border-b"},_hoisted_14$2={class:"border-b data-[state=selected]:bg-muted bg-slate-50/50 dark:bg-slate-700/50 hover:bg-slate-50/80 dark:hover:bg-slate-700/80 transition-colors"},_hoisted_15$2={class:"h-10 px-2 align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] w-12 text-center"},_hoisted_16$2={key:0,colspan:"100%",class:"text-center"},_hoisted_17$2={class:"w-full"},_hoisted_18$2={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},_hoisted_19$1=["onDragstart","onDragover","onDrop"],_hoisted_20$1={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},_hoisted_21={class:"flex items-center justify-center"},_hoisted_22={class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},_hoisted_23={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},_hoisted_24={class:"flex items-center justify-center gap-2"},_hoisted_25=["onClick"],_hoisted_26=["onClick"],_sfc_main$b=vue.defineComponent({__name:"vs-input-datatable",props:vue.mergeModels({style:{},customClass:{},placeholder:{},disabled:{type:Boolean},type:{},value:{},name:{},rules:{},error:{},text:{},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{},prefix:{},host:{},data:{},options:{},maxHeight:{},slots:{},mode:{},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{},view:{},colSpan:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,t=vue.useModel(o,"modelValue"),s=vue.ref({}),n=vue.ref(""),a=vue.computed(()=>{if(!n.value)return t.value??[];const y=n.value.toLowerCase();return t.value.filter(_=>e.colModel?.some(x=>{const B=_[x.key];return B?Array.isArray(B)?B.join(", ").toLowerCase().includes(y):String(B).toLowerCase().includes(y):!1}))});console.log(a.value);const l=vue.ref(null),r=vue.ref(null),i=vue.ref(!1),d=vue.ref(null),u=vue.ref({top:0,left:0}),p=y=>{l.value=y},c=y=>{r.value=y},b=y=>{if(l.value===null||l.value===y){l.value=null,r.value=null;return}const _=[...t.value],[x]=_.splice(l.value,1);_.splice(y,0,x),t.value=_,l.value=null,r.value=null},E=y=>{const x=y.currentTarget.getBoundingClientRect();u.value={top:x.bottom+window.scrollY,left:x.left+window.scrollX},i.value=!i.value},V=()=>{d.value&&d.value.click()},M=y=>{const x=y.target.files?.[0];if(!x)return;const B=new FileReader;B.onload=N=>{try{const S=N.target?.result;if(typeof S=="string"){const A=JSON.parse(S);Array.isArray(A)&&t.value.push(...A)}}catch(S){console.error("Error parsing file:",S)}},B.readAsText(x)},$=()=>{const y=JSON.stringify(t.value,null,2),_=new Blob([y],{type:"application/json"}),x=URL.createObjectURL(_),B=document.createElement("a");B.href=x,B.download="data.json",B.click(),URL.revokeObjectURL(x)};vue.onMounted(async()=>{const y=e.colModel?.filter(_=>_.data);y?.length&&Promise.all(y.map(async _=>{s.value[_.key]=await fetch(`/api/suggest/${_.data}`).then(x=>x.json())}))});async function w(){const y=await form({schema:e.colModel,mode:"add"});y&&(Array.isArray(t.value)?t.value=[...t.value,y]:t.value=[y])}function k(y,_){return s.value[_.key]&&y[_.key]?s.value[_.key].find(x=>x.id.toString()===y[_.key].toString())?.text??y[_.key]:y[_.key]||"-"}async function v(y,_){const x=await form({schema:e.colModel,mode:"add",defaultValue:y});x&&(t.value=t.value.map((B,N)=>N===_?x:B))}function I(y){t.value=t.value.filter((_,x)=>x!==y)}return(y,_)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$9,[vue.createElementVNode("div",_hoisted_2$3,[vue.createElementVNode("div",_hoisted_3$3,[vue.createVNode(IconMagnifyingGlass,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),vue.withDirectives(vue.createElementVNode("input",{type:"text","onUpdate:modelValue":_[0]||(_[0]=x=>n.value=x),placeholder:"Пошук",class:"py-2 px-3 pl-10 w-full bg-gray-100 h-[36px] rounded-[8px] text-[15px] leading-[18px] focus:border-1 text-stone-800 placeholder:text-[#6B7280] focus:outline-blue-500 focus:outline-2"},null,512),[[vue.vModelText,n.value]])]),vue.createElementVNode("div",_hoisted_4$3,[vue.createElementVNode("input",{ref_key:"fileInput",ref:d,onChange:M,class:"hidden",accept:".json",type:"file"},null,544),vue.createElementVNode("div",_hoisted_5$2,[vue.createElementVNode("div",_hoisted_6$2,[vue.createElementVNode("div",_hoisted_7$2,[vue.createElementVNode("button",{onClick:E,class:"bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[vue.createVNode(IconArrowTopBottom,{height:"16",width:"16"})])])])])]),(vue.openBlock(),vue.createBlock(vue.Teleport,{to:"body"},[i.value?(vue.openBlock(),vue.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:vue.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:u.value.top+"px",left:u.value.left+"px"}])},[vue.createElementVNode("div",_hoisted_8$2,[vue.createElementVNode("div",_hoisted_9$2,[vue.createElementVNode("button",{onClick:V,class:"text-slate-700 flex items-center gap-1 px-3 py-1 rounded-md cursor-pointer group hover:bg-gray-100"},[vue.createVNode(IconImport,{class:"text-black",width:"14",height:"14"}),_[1]||(_[1]=vue.createTextVNode(" Імпортувати "))]),vue.createElementVNode("button",{onClick:$,class:"text-slate-700 flex items-center px-3 py-1 rounded-md cursor-pointer group hover:bg-gray-100"},[vue.createElementVNode("span",_hoisted_10$2,[vue.createVNode(IconExport,{class:"text-black",width:"14",height:"14"}),_[2]||(_[2]=vue.createTextVNode(" Експортувати "))])])])])],4)):vue.createCommentVNode("",!0)])),vue.createElementVNode("button",{onClick:w,class:"text-slate-700 bg-white hover:bg-gray-100 font-semibold text-[15px] leadig-[18.5px] py-[10px] px-[12px] border border-[#E5E7EB] rounded-[8px] h-[38px] max-h-[38px] gap-[8px] flex items-center"},[vue.createVNode(IconPlus),_[3]||(_[3]=vue.createTextVNode(" Додати "))])]),vue.createElementVNode("div",_hoisted_11$2,[vue.createElementVNode("table",_hoisted_12$2,[vue.createElementVNode("thead",_hoisted_13$2,[vue.createElementVNode("tr",_hoisted_14$2,[vue.createElementVNode("th",_hoisted_15$2,[vue.createVNode(IconGripVertical,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(y.colModel,x=>(vue.openBlock(),vue.createElementBlock("th",{key:x.key,class:"h-10 px-2 text-left align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 min-w-[150px]"},vue.toDisplayString(x.ua),1))),128)),_[4]||(_[4]=vue.createElementVNode("th",{class:"h-10 px-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] font-semibold text-slate-700 dark:text-slate-300 text-center"}," Дії ",-1))])]),vue.createElementVNode("tbody",{class:vue.normalizeClass({"[&_tr:last-child]:border-0":!r.value})},[a.value.length===0?(vue.openBlock(),vue.createElementBlock("td",_hoisted_16$2,[vue.createElementVNode("div",_hoisted_17$2,[vue.createElementVNode("div",_hoisted_18$2,[vue.createVNode(IconNoData,{class:"w-48 mx-auto"}),_[5]||(_[5]=vue.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[vue.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),vue.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):vue.createCommentVNode("",!0),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(a.value,(x,B)=>(vue.openBlock(),vue.createElementBlock("tr",{key:x.id,class:vue.normalizeClass(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move",{"opacity-50":l.value===B,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":r.value===B}]),draggable:"true",onDragstart:N=>p(B),onDragover:vue.withModifiers(N=>c(B),["prevent"]),onDrop:N=>b(B)},[vue.createElementVNode("td",_hoisted_20$1,[vue.createElementVNode("div",_hoisted_21,[vue.createVNode(IconGripVertical,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(y.colModel,N=>(vue.openBlock(),vue.createElementBlock("td",{key:N.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[vue.createElementVNode("div",_hoisted_22,vue.toDisplayString(k(x,N)),1)]))),128)),vue.createElementVNode("td",_hoisted_23,[vue.createElementVNode("div",_hoisted_24,[vue.createElementVNode("button",{onClick:N=>v(x,B),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-blue-50 dark:hover:bg-slate-600 hover:border-blue-300 dark:hover:border-slate-500 hover:text-blue-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[vue.createVNode(IconPen,{width:"24",height:"24",class:"w-3 h-3"})],8,_hoisted_25),vue.createElementVNode("button",{onClick:N=>I(B),class:"text-slate-700 inline-flex items-center justify-center whitespace-nowrap font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 border rounded-md text-xs h-7 w-7 p-0 border-slate-300 dark:border-slate-600 bg-white dark:bg-slate-700 hover:bg-red-50 dark:hover:bg-slate-600 hover:border-red-300 dark:hover:border-slate-500 hover:text-red-600 dark:hover:text-slate-200 transition-all duration-200 shadow-sm"},[vue.createVNode(IconDelete,{width:"24",height:"24",class:"w-3 h-3"})],8,_hoisted_26)])])],42,_hoisted_19$1))),128))],2)])])]))}}),MAP_LOCALE={draw:{toolbar:{actions:{title:"Скасувати малювання",text:"Скасувати"},finish:{title:"Завершити малювання",text:"Завершити"},undo:{title:"Видалити останню точку",text:"Видалити останню"},buttons:{polyline:"Намалювати лінію",polygon:"Намалювати полігон",rectangle:"Намалювати прямокутник",circle:"Намалювати коло",marker:"Додати точку",circlemarker:"Додати маркер-коло"}},handlers:{circle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати коло",end:"Відпустіть кнопку миші, щоб завершити"},radius:"Радіус"},circlemarker:{tooltip:{start:"Клацніть на карту, щоб додати маркер-коло"}},marker:{tooltip:{start:"Клацніть на карту, щоб додати точку"}},polygon:{tooltip:{start:"Клацніть, щоб почати малювати полігон",cont:"Клацайте, щоб продовжити малювати полігон",end:"Клацніть першу точку, щоб завершити полігон"}},polyline:{error:"<strong>Помилка:</strong> лінія не може перетинатися сама з собою",tooltip:{start:"Клацніть, щоб почати малювати лінію",cont:"Клацайте, щоб продовжити малювати лінію",end:"Клацніть останню точку, щоб завершити лінію"}},rectangle:{tooltip:{start:"Клацніть і тягніть, щоб намалювати прямокутник",end:"Відпустіть кнопку миші, щоб завершити"}},simpleshape:{tooltip:{end:"Відпустіть кнопку миші, щоб завершити"}}}},edit:{toolbar:{actions:{save:{title:"Зберегти зміни",text:"Зберегти"},cancel:{title:"Скасувати редагування",text:"Скасувати"},clearAll:{title:"Очистити всі шари",text:"Очистити все"}},buttons:{edit:"Редагувати шари",editDisabled:"Немає шарів для редагування",remove:"Видалити шари",removeDisabled:"Немає шарів для видалення"}},handlers:{edit:{tooltip:{text:"Перетягніть маркери, щоб редагувати шари",subtext:"Натисніть 'Скасувати', щоб повернутися"}},remove:{tooltip:{text:"Клацніть на шари, щоб видалити їх"}}}}};function normalizeToGeoJSON(o){return o?o.type==="FeatureCollection"||o.type==="Feature"?o:o.geom?{type:"Feature",geometry:{type:o.geom.type,coordinates:o.geom.coordinates},properties:{}}:o.type&&o.coordinates?{type:"Feature",geometry:o,properties:{}}:null:null}const _sfc_main$a={},_hoisted_1$8={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",stroke:"currentColor",fill:"none","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-map-pin"};function _sfc_render$4(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$8,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),vue.createElementVNode("path",{d:"M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z"},null,-1)]))}const IconMapPin=_export_sfc(_sfc_main$a,[["render",_sfc_render$4]]),_sfc_main$9={},_hoisted_1$7={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 _sfc_render$3(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$7,e[0]||(e[0]=[vue.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),vue.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),vue.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),vue.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const IconLine=_export_sfc(_sfc_main$9,[["render",_sfc_render$3]]),_sfc_main$8={},_hoisted_1$6={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 _sfc_render$2(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$6,e[0]||(e[0]=[vue.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 IconPoligon=_export_sfc(_sfc_main$8,[["render",_sfc_render$2]]),_sfc_main$7={},_hoisted_1$5={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-topology-ring-3"};function _sfc_render$1(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$5,e[0]||(e[0]=[vue.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 IconPoligonRectangle=_export_sfc(_sfc_main$7,[["render",_sfc_render$1]]),_sfc_main$6={},_hoisted_1$4={version:"1.1",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg","xmlns:sketch":"http://www.bohemiancoding.com/sketch/ns","xmlns:xlink":"http://www.w3.org/1999/xlink",class:"fullscreen-icon"};function _sfc_render(o,e){return vue.openBlock(),vue.createElementBlock("svg",_hoisted_1$4,e[0]||(e[0]=[vue.createElementVNode("title",null,null,-1),vue.createElementVNode("desc",null,null,-1),vue.createElementVNode("defs",null,null,-1),vue.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[vue.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[vue.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[vue.createElementVNode("path",{d:"M2,9 L0,9 L0,14 L5,14 L5,12 L2,12 L2,9 L2,9 Z M0,5 L2,5 L2,2 L5,2 L5,0 L0,0 L0,5 L0,5 Z M12,12 L9,12 L9,14 L14,14 L14,9 L12,9 L12,12 L12,12 Z M9,0 L9,2 L12,2 L12,5 L14,5 L14,0 L9,0 L9,0 Z",id:"Shape"})])])],-1)]))}const IconFullScreen=_export_sfc(_sfc_main$6,[["render",_sfc_render]]),_hoisted_1$3={class:"form-geom__search"},_hoisted_2$2={class:"map-search__input"},_hoisted_3$2={class:"flex flex-nowrap relative"},_hoisted_4$2={class:"form-autocomplete relative min-w-[6rem] vsTailwind map-search__select hidden"},_hoisted_5$1={class:"flex items-center w-full"},_hoisted_6$1={class:"max-w-[90%] truncate"},_hoisted_7$1={key:0,class:"absolute z-[3100] mt-0.5 left-0 right-0"},_hoisted_8$1={class:"form-autocomplete__wrapper mt-[10px] z-50 w-full min-w-36 max-h-72 p-0 space-y-0.5 bg-white rounded-xl shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] dark:bg-neutral-900 top-full opened"},_hoisted_9$1={class:"form-autocomplete__list vsTailwind px-2 pb-2 pt-0 max-h-200 relative [&::-webkit-scrollbar]:w-2 [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-track]:bg-gray-100 [&::-webkit-scrollbar-thumb]:bg-gray-300 dark:[&::-webkit-scrollbar-track]:bg-neutral-700 dark:[&::-webkit-scrollbar-thumb]:bg-neutral-500 dark:bg-neutral-900"},_hoisted_10$1=["onClick"],_hoisted_11$1={class:"flex justify-between items-center w-full"},_hoisted_12$1={class:"flex items-center"},_hoisted_13$1={key:0,class:"flex-shrink-0 w-3.5 h-3.5 text-blue-600",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},_hoisted_14$1={class:"relative w-full"},_hoisted_15$1={class:"vs-form-text relative bg-white rounded-lg"},_hoisted_16$1={key:1,class:"absolute left-0 right-0 top-full z-[3200] bg-white border border-gray-200 rounded-b-lg shadow-lg max-h-72 overflow-auto"},_hoisted_17$1={key:0},_hoisted_18$1=["onClick"],_hoisted_19={key:1,class:"px-3 py-2 text-xs text-gray-500"},_hoisted_20={key:2,class:"px-3 py-2 text-xs text-gray-400"},_sfc_main$5=vue.defineComponent({__name:"map-search",props:{placeholder:{default:"50, 30"}},emits:["goToCoordinates"],setup(o,{emit:e}){const t=e,s=vue.ref(!1),n=vue.ref("coordinates"),a=vue.ref(""),l=vue.ref([]),r=vue.ref(!1),i=vue.ref(!1);let d;const u=[{value:"coordinates",label:"Пошук по кординатам"},{value:"atu",label:"АТУ"},{value:"address",label:"Адресса"},{value:"search_here",label:"Пошук HERE"}],p=vue.computed(()=>u.find(w=>w.value===n.value)?.label??"АТУ");function c(w){n.value=w.value,s.value=!1,a.value="",a.value&&V()}function b(w){w.target.closest(".map-search__input")||(s.value=!1)}vue.onMounted(()=>document.addEventListener("click",b)),vue.onUnmounted(()=>document.removeEventListener("click",b));async function E(w){let k;n.value==="atu"?k="/api/suggest/atu.nsdi.ato_level":n.value==="address"?k="/api/suggest/map.address_id":n.value==="search_here"&&(k="/api/gis-url-proxy");const v=new URL(k);return n.value==="search_here"?v.searchParams.set("searchtext",w):(n.value==="atu"||n.value==="address")&&v.searchParams.set("key",w),v.searchParams.set("limit","20"),v.searchParams.set("q",w),(await fetch(v.toString())).json()}function V(){if(r.value=!0,i.value=!0,n.value==="coordinates"){const w=a.value.trim().split(",");if(w.length===2){const k=parseFloat(w[0]),v=parseFloat(w[1]);!Number.isNaN(k)&&!Number.isNaN(v)&&t("goToCoordinates",[k,v])}return}d&&window.clearTimeout(d),d=window.setTimeout(async()=>{const w=a.value.trim();if(!w){l.value=[],i.value=!1;return}try{const k=await E(w);l.value=Array.isArray(k.features)?k.features:[]}catch{l.value=[]}finally{i.value=!1}},300)}function M(){a.value="",l.value=[],r.value=!1,i.value=!1}function $(w){t("goToCoordinates",w),r.value=!1,i.value=!1,l.value=[]}return(w,k)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$3,[vue.createElementVNode("div",_hoisted_2$2,[vue.createElementVNode("div",_hoisted_3$2,[vue.createElementVNode("div",_hoisted_4$2,[vue.createElementVNode("button",{type:"button",onClick:k[0]||(k[0]=v=>s.value=!s.value),class:"h-[40px] relative px-4 pe-9 flex text-nowrap w-full cursor-pointer bg-white border border-solid border-stone-200 rounded-lg text-start text-sm text-stone-800 focus:outline-none focus:ring-1 focus:ring-blue-600 dark:bg-neutral-800 dark:border-neutral-700 dark:text-neutral-200"},[vue.createElementVNode("div",_hoisted_5$1,[vue.createElementVNode("span",_hoisted_6$1,vue.toDisplayString(p.value),1)]),k[3]||(k[3]=vue.createElementVNode("svg",{class:"stroke-gray-500 absolute right-3 translate-y-1/2 bottom-1/2",width:"15",height:"15",viewBox:"0 0 24 24",fill:"none"},[vue.createElementVNode("path",{d:"M6 9l6 6 6-6","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"})],-1))]),s.value?(vue.openBlock(),vue.createElementBlock("div",_hoisted_7$1,[vue.createElementVNode("div",_hoisted_8$1,[vue.createElementVNode("div",_hoisted_9$1,[(vue.openBlock(),vue.createElementBlock(vue.Fragment,null,vue.renderList(u,v=>vue.createElementVNode("div",{onClick:I=>c(v),key:v.value,class:"form-autocomplete__item cursor-pointer hs-selected:bg-stone-100 dark:hs-selected:bg-neutral-800 py-2 px-4 w-full text-sm text-gray-800 hover:bg-gray-100 rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:hover:bg-neutral-800 dark:text-neutral-200 dark:focus:bg-neutral-800 cursor-default"},[vue.createElementVNode("div",_hoisted_11$1,[vue.createElementVNode("div",_hoisted_12$1,[vue.createElementVNode("div",null,vue.toDisplayString(v.label),1)]),v.value===n.value?(vue.openBlock(),vue.createElementBlock("svg",_hoisted_13$1,k[4]||(k[4]=[vue.createElementVNode("polyline",{points:"20 6 9 17 4 12"},null,-1)]))):vue.createCommentVNode("",!0)])],8,_hoisted_10$1)),64))])])])):vue.createCommentVNode("",!0)]),vue.createElementVNode("div",_hoisted_14$1,[vue.createElementVNode("div",_hoisted_15$1,[k[6]||(k[6]=vue.createElementVNode("i",{class:"absolute bottom-1/2 translate-y-1/2 left-3 text-gray-500"},[vue.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor"},[vue.createElementVNode("circle",{cx:"11",cy:"11",r:"8","stroke-width":"2"}),vue.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65","stroke-width":"2"})])],-1)),vue.withDirectives(vue.createElementVNode("input",{type:"text","onUpdate:modelValue":k[1]||(k[1]=v=>a.value=v),onInput:V,onFocus:k[2]||(k[2]=v=>r.value=!0),placeholder:"Пошук...",class:"bg-white h-[38px] text-sm py-2 px-3 ps-9 pe-8 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,544),[[vue.vModelText,a.value]]),a.value?(vue.openBlock(),vue.createElementBlock("button",{key:0,onClick:M,class:"absolute right-2 bottom-1/2 translate-y-1/2 text-gray-500 hover:text-red-500","aria-label":"Очистити",type:"button"},k[5]||(k[5]=[vue.createElementVNode("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2"},[vue.createElementVNode("path",{d:"M18 6L6 18M6 6l12 12","stroke-linecap":"round","stroke-linejoin":"round"})],-1)]))):vue.createCommentVNode("",!0),r.value&&n.value!=="coordinates"?(vue.openBlock(),vue.createElementBlock("div",_hoisted_16$1,[l.value.length?(vue.openBlock(),vue.createElementBlock("ul",_hoisted_17$1,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(l.value,v=>(vue.openBlock(),vue.createElementBlock("li",{key:v.properties.place_id,onClick:I=>$(v),class:"px-3 py-2 text-sm cursor-pointer hover:bg-gray-100"},vue.toDisplayString(v.properties.display_name),9,_hoisted_18$1))),128))])):i.value?(vue.openBlock(),vue.createElementBlock("div",_hoisted_19,"Шукаю…")):(vue.openBlock(),vue.createElementBlock("div",_hoisted_20,"Нічого не знайдено"))])):vue.createCommentVNode("",!0)])])])])]))}}),_hoisted_1$2={class:"bg-white/95 p-2 rounded-xl shadow border border-gray-200"},_hoisted_2$1={class:"flex gap-2"},_hoisted_3$1=["onClick","title"],_hoisted_4$1=["src"],_sfc_main$4=vue.defineComponent({__name:"map-layers",props:{basemaps:{},defaultLayer:{}},emits:["onLayerChange"],setup(o,{emit:e}){const t=o,s=vue.ref(t.defaultLayer??""),n=e;function a(l){n("onLayerChange",l),s.value=l}return(l,r)=>(vue.openBlock(),vue.createElementBlock("div",_hoisted_1$2,[vue.createElementVNode("div",_hoisted_2$1,[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(l.basemaps,(i,d)=>(vue.openBlock(),vue.createElementBlock("div",{key:d,class:vue.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":s.value===d}]),onClick:u=>a(d),title:d,role:"button",tabindex:"0"},[vue.createElementVNode("img",{src:i.preview,alt:"",class:"w-14 h-14 object-cover"},null,8,_hoisted_4$1)],10,_hoisted_3$1))),128))])]))}}),_hoisted_1$1={class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},_hoisted_2={class:"form-geom__panel flex gap-1 items-start mt-2"},_hoisted_3={class:"flex items-center gap-1"},_hoisted_4=["disabled"],_hoisted_5={class:"absolute top-4 right-4 z-[1000]"},_hoisted_6={class:"flex flex-col gap-[2px]"},_hoisted_7=["aria-pressed"],_hoisted_8=["aria-pressed"],_hoisted_9=["aria-pressed"],_hoisted_10=["aria-pressed"],_hoisted_11={class:"absolute bottom-0 left-0 right-0 z-[1000] bg-white/95 border-t border-gray-200 text-xs text-gray-700 flex items-center gap-4 pt-1"},_hoisted_12={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},_hoisted_13={class:"mr-auto"},_hoisted_14={class:"font-bold"},_hoisted_15={class:"flex items-center"},_hoisted_16={class:"text-xs mr-2"},_hoisted_17={key:0,class:"text-xs"},_hoisted_18={key:1,class:"text-xs"},_sfc_main$3=vue.defineComponent({__name:"vs-input-map",props:{style:{},customClass:{},placeholder:{},disabled:{type:Boolean},type:{},value:{},name:{},rules:{},error:{},text:{},mask:{},unmask:{type:Boolean},placeholderChar:{},html:{},prefix:{},host:{},data:{},options:{},maxHeight:{},slots:{},mode:{},add:{},api:{},search:{type:Boolean},i:{},time:{type:Boolean},modelValue:{},clearable:{type:Boolean},now:{type:Boolean},editable:{type:Boolean},isInfinity:{type:Boolean},multiple:{type:Boolean},format:{},colModel:{},position:{},view:{},colSpan:{}},emits:["update:modelValue"],setup(o,{emit:e}){const t=o,s=e,n=vue.ref(null);let a,l,r;const i=vue.ref(null),d=vue.ref(null),u=vue.ref(6),p=vue.ref(0),c=vue.ref(null),b={topo100:{url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/voyager/ua/13/4790/2762.png"},orto10:{url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4790/2762.png"},osmb:{url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",preview:"https://tile.openstreetmap.org.ua/styles/osm-bright/13/4790/2762.png"}};let E;const V=vue.ref("topo100");function M(){return new Promise((f,g)=>{window.L&&window.L.Draw&&f(0);const h=C=>{if(Array.from(document.styleSheets).some(T=>T?.href?.includes(C)))return;const F=document.createElement("link");F.rel="stylesheet",F.href=C,document.head.appendChild(F)},m=C=>new Promise((D,F)=>{const T=Array.from(document.scripts).find(j=>j.src===C);if(T){T.addEventListener("load",()=>D()),T.addEventListener("error",j=>F(j));return}const R=document.createElement("script");R.src=C,R.async=!0,R.onload=()=>D(),R.onerror=j=>F(j),document.body.appendChild(R)});h("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),h("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),m("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>m("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js")).then(()=>f(0)).catch(g)})}function $(){const f=l.toGeoJSON();s("update:modelValue",f),p.value=l.getLayers().length}function w(f=30){const g=l.getLayers();if(!g.length)return;const m=L.featureGroup(g).getBounds();m&&m.isValid()&&a.fitBounds(m,{padding:[f,f]})}function k(){i.value?.click()}const v=vue.ref("");function I(f){return f instanceof L.Circle?"Circle":f instanceof L.Rectangle?"Rectangle":f instanceof L.Polygon&&!(f instanceof L.Rectangle)?"Polygon":f instanceof L.Polyline&&!(f instanceof L.Polygon)?"Polyline":f instanceof L.Marker?"Point":"Feature"}function y(f){if(f instanceof L.Circle){const g=f.getRadius();return Math.PI*(g*g)/1e6}if(f instanceof L.Polygon||f instanceof L.Rectangle)try{const g=f.getLatLngs(),h=Array.isArray(g[0])?g[0]:g,m=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea(h):0;return m?m/1e6:0}catch{return null}return null}function _(f){return f instanceof L.Circle?f.getLatLng():f.getBounds?f.getBounds().getCenter():f.getLatLng?f.getLatLng():a.getCenter()}function x(){const f=l.getLayers();if(!f.length){c.value=null,p.value=0;return}const g=f[f.length-1],h=I(g),m=_(g),C=y(g);c.value={type:h,center:m,areaKm2:C,layer:g},p.value=f.length}function B(){const f=c.value?.layer;f&&(f instanceof L.Circle&&f.getBounds?a.fitBounds(f.getBounds(),{padding:[30,30]}):f.getBounds?a.fitBounds(f.getBounds(),{padding:[30,30]}):f.getLatLng&&a.setView(f.getLatLng(),Math.max(u.value,14)))}function N(){const f=c.value?.layer;f&&(l.removeLayer(f),$(),x())}vue.onMounted(async()=>{await M(),L.drawLocal=MAP_LOCALE,a=L.map(n.value,{zoomControl:!1}).setView([50,30],10),L.control.zoom({position:"bottomright"}).addTo(a),E=L.tileLayer(b.topo100.url,{maxZoom:19,minZoom:6}).addTo(a),V.value="topo100",l=new L.FeatureGroup().addTo(a),a.on(L.Draw.Event.CREATED,g=>{const{layer:h}=g;l.clearLayers(),l.addLayer(h),$(),x(),w(),v.value=""}),a.on(L.Draw.Event.EDITED,()=>{$(),x(),w()}),a.on(L.Draw.Event.DELETED,()=>{$(),x(),w()}),a.on("mousemove",g=>{d.value=g.latlng}),a.on("zoomend",()=>{u.value=a.getZoom()});const f=normalizeToGeoJSON(t.modelValue);if(f){const g=[];L.geoJSON(f).eachLayer(h=>g.push(h)),g.length&&l.addLayer(g[0]),$(),x(),w()}});function S(f){if(a){switch(r&&r.disable(),f){case"marker":r=new L.Draw.Marker(a);break;case"polyline":r=new L.Draw.Polyline(a);break;case"polygon":r=new L.Draw.Polygon(a);break;case"rectangle":r=new L.Draw.Rectangle(a);break;default:r=new L.Draw.Rectangle(a);break}r&&(r.enable(),v.value=f)}}function A(){const f=l.toGeoJSON(),g=new Blob([JSON.stringify(f,null,2)],{type:"application/json"}),h=URL.createObjectURL(g),m=document.createElement("a");m.href=h,m.download="data.geojson",m.click(),URL.revokeObjectURL(h)}function P(f){const g=f.target.files?.[0];if(!g)return;const h=new FileReader;h.onload=()=>{if(typeof h.result=="string")try{const m=JSON.parse(h.result);l.clearLayers();const C=[];L.geoJSON(m).eachLayer(D=>C.push(D)),C.length&&l.addLayer(C[0]),$(),x(),w()}finally{f.target.value=""}},h.readAsText(g)}function z(f){a&&(E&&a.removeLayer(E),E=L.tileLayer(b[f].url,{maxZoom:19,minZoom:6}).addTo(a),V.value=f)}function U(f){const g=L.latLng(f[0],f[1]);a.setView(g,13)}vue.watch(()=>t.modelValue,f=>{const g=normalizeToGeoJSON(f);if(l.clearLayers(),g){const h=[];L.geoJSON(g).eachLayer(m=>h.push(m)),h.length&&l.addLayer(h[0])}p.value=l.getLayers().length,x(),w()});const O=vue.ref(!1);return(f,g)=>(vue.openBlock(),vue.createElementBlock("div",{class:vue.normalizeClass(["leaflet-map-wrapper relative w-full h-[600px]",{fullscreen:O.value}])},[vue.createElementVNode("div",{ref_key:"mapContainer",ref:n,class:"w-full h-full"},null,512),vue.createElementVNode("div",_hoisted_1$1,[vue.createVNode(_sfc_main$5,{onGoToCoordinates:U}),vue.createElementVNode("div",_hoisted_2,[vue.createElementVNode("div",_hoisted_3,[vue.createElementVNode("button",{type:"button",class:"vs-btn-row",onClick:k},"Імпорт"),vue.createElementVNode("button",{type:"button",class:"vs-btn-row",onClick:A,disabled:p.value===0},"Експорт ",8,_hoisted_4)]),vue.createElementVNode("input",{ref_key:"importRef",ref:i,type:"file",onChange:P,accept:".json,.geojson",class:"hidden"},null,544)])]),vue.createElementVNode("div",_hoisted_5,[vue.createElementVNode("div",_hoisted_6,[vue.createElementVNode("button",{class:vue.normalizeClass(["vs-btn",{"vs-active":v.value==="marker"}]),"aria-pressed":v.value==="marker",title:"Point (P)","aria-label":"Draw point",onClick:g[0]||(g[0]=h=>S("marker"))},[vue.createVNode(IconMapPin)],10,_hoisted_7),vue.createElementVNode("button",{class:vue.normalizeClass(["vs-btn",{"vs-active":v.value==="polyline"}]),"aria-pressed":v.value==="polyline",title:"Line (L)","aria-label":"Draw polyline",onClick:g[1]||(g[1]=h=>S("polyline"))},[vue.createVNode(IconLine)],10,_hoisted_8),vue.createElementVNode("button",{class:vue.normalizeClass(["vs-btn",{"vs-active":v.value==="polygon"}]),"aria-pressed":v.value==="polygon",title:"Polygon (G)","aria-label":"Draw polygon",onClick:g[2]||(g[2]=h=>S("polygon"))},[vue.createVNode(IconPoligon)],10,_hoisted_9),vue.createElementVNode("button",{class:vue.normalizeClass(["vs-btn",{"vs-active":v.value==="rectangle"}]),"aria-pressed":v.value==="rectangle",title:"Rectangle (R)","aria-label":"Draw rectangle",onClick:g[3]||(g[3]=h=>S("rectangle"))},[vue.createVNode(IconPoligonRectangle)],10,_hoisted_10),vue.createElementVNode("button",{class:"vs-btn",onClick:g[4]||(g[4]=h=>O.value=!O.value)},[vue.createVNode(IconFullScreen,{style:{width:"12px",height:"12px"}})])])]),vue.createElementVNode("div",{class:vue.normalizeClass(["absolute left-4 z-[1000]",c.value?"bottom-8":"bottom-4"])},[vue.createVNode(_sfc_main$4,{basemaps:b,"default-layer":"topo100",onOnLayerChange:z})],2),vue.createElementVNode("div",_hoisted_11,[c.value?(vue.openBlock(),vue.createElementBlock("div",_hoisted_12,[vue.createElementVNode("div",_hoisted_13,[g[7]||(g[7]=vue.createTextVNode(" Тип: ")),vue.createElementVNode("span",_hoisted_14,vue.toDisplayString(c.value.type),1)]),vue.createElementVNode("div",_hoisted_15,[vue.createElementVNode("div",_hoisted_16,[g[8]||(g[8]=vue.createTextVNode(" Центр: ")),vue.createElementVNode("b",null,vue.toDisplayString(c.value.center.lat.toFixed(5))+", "+vue.toDisplayString(c.value.center.lng.toFixed(5)),1)]),c.value.areaKm2!==null?(vue.openBlock(),vue.createElementBlock("div",_hoisted_17,[g[9]||(g[9]=vue.createTextVNode(" Площа: ")),vue.createElementVNode("b",null,vue.toDisplayString(c.value.areaKm2.toFixed(1))+"км²",1)])):(vue.openBlock(),vue.createElementBlock("div",_hoisted_18,g[10]||(g[10]=[vue.createTextVNode(" Площа: "),vue.createElementVNode("b",null,"—",-1)]))),vue.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Наблизити",onClick:g[5]||(g[5]=h=>B())},g[11]||(g[11]=[vue.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-3 h-3" data-v-b66f94e1><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" data-v-b66f94e1></path><path d="M7 10l6 0" data-v-b66f94e1></path><path d="M10 7l0 6" data-v-b66f94e1></path><path d="M21 21l-6 -6" data-v-b66f94e1></path></svg>',1)])),vue.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Видалити",onClick:g[6]||(g[6]=h=>N())},[vue.createVNode(IconDelete,{class:"w-3 h-3"})])])])):vue.createCommentVNode("",!0)])],2))}}),vsInputMap=_export_sfc(_sfc_main$3,[["__scopeId","data-v-b66f94e1"]]),inputs={VsInputText:_sfc_main$V,VsInputRadio:_sfc_main$G,"vs-input-text":_sfc_main$V,"vs-input-textarea":_sfc_main$j,"vs-input-mask":_sfc_main$L,"vs-input-number":_sfc_main$U,"vs-input-radio":_sfc_main$G,"vs-input-select":VsInputSelect,"vs-input-switcher":_sfc_main$N,"vs-input-static":_sfc_main$M,"vs-input-container":_sfc_main$m,"vs-input-date":_sfc_main$E,"vs-input-checkbox":VsInputCheckbox,"vs-input-file":_sfc_main$u,"vs-input-html":_sfc_main$K,"vs-input-email":_sfc_main$J,"vs-input-datatable":_sfc_main$b,"vs-input-map":vsInputMap,"vs-input-file-list":_sfc_main$q},_sfc_main$2=vue.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(o){const e=o,t=vue.inject("values");async function s(){try{if(!e.api)return;const n=e.api.replace("{{value}}",e.value),a=await fetch(n);if(!a.ok){core.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const l=await a.json();if(!e.set||!t)return;for(const[r,i]of Object.entries(e.set))t.value[r]=l.result[i]}catch(n){console.error(e.error,n)}}return(n,a)=>(vue.openBlock(),vue.createElementBlock("button",{onClick:s,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"},vue.toDisplayString(n.button),1))}}),_hoisted_1={class:"flex"},_sfc_main$1=vue.defineComponent({__name:"vs-compact-form-layout",props:vue.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(o){const e=o,t=vue.useModel(o,"modelValue"),s=vue.computed(()=>layouts$1[`${e.layout}`]),n=vue.computed(()=>inputs?.[`vs-input-${e.item.type}`]),a=vue.computed(()=>{const r=vue.unref(n);if(!r)return new Set;const i=r.props??r.__vccOpts?.props;if(!i)return new Set;const d=Array.isArray(i)?i:Object.keys(i);return new Set(d)}),l=vue.computed(()=>{const r=e.item??{},i=a.value;return i.size?Object.fromEntries(Object.entries(r).filter(([d])=>i.has(d))):{}});return(r,i)=>(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(s.value),{ua:e.item.ua,error:e.error,label:e.item.label},{default:vue.withCtx(()=>[vue.createElementVNode("div",_hoisted_1,[(vue.openBlock(),vue.createBlock(vue.resolveDynamicComponent(n.value),vue.mergeProps(l.value,{modelValue:t.value,"onUpdate:modelValue":i[0]||(i[0]=d=>t.value=d)}),null,16,["modelValue"])),r.item.behavior?(vue.openBlock(),vue.createBlock(_sfc_main$2,vue.mergeProps({key:0},r.item.behavior,{value:t.value}),null,16,["value"])):vue.createCommentVNode("",!0)])]),_:1},8,["ua","error","label"]))}}),formErrorsUa={required:"Це поле є обов’язковим",email:"Неправильний email"},required=o=>o?!1:formErrorsUa.required,email=o=>!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o)&&o?formErrorsUa.email:!1,regexp=(o,e)=>{const t=e.pattern??e.regexp;return!(typeof t=="string"?new RegExp(t):t).test(o)&&o?e.message:!1},custom=(value,customRule)=>{const func=eval(customRule.function);return func(value)?!1:customRule.message},checkFormRules=(o,e)=>{switch(typeof e=="string"?e:e.type){case"required":return required(o);case"email":return email(o);case"regexp":return regexp(o,e);case"custom":return custom(o,e);default:return!1}},mathTable={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file"};function convertType(o){const e=o.toLowerCase();return mathTable[e]||e}function convertSchema(o){if(Array.isArray(o)){const t=[];return o.forEach(s=>{const n={...s};n.name=(s.name||s.id||s.key).toString(),n.type=convertType(s.type),n.label=s.label||s.ua,n.rules=s.rules||s.validators,s.data&&(n.api=`/api/suggest/${s.data}`),t.push(n)}),t}const e=[];return Object.entries(o).forEach(t=>{const s={name:t[0],...t[1],type:convertType(t[1].type),label:t[1].label||t[1].ua,rules:t[1].rules||t[1].validators};t[1].type.includes("list")&&(s.multiple=!0),t[1].data&&(s.api=`/api/suggest/${t[1].data}`),e.push(s)}),e}function useForm(o,e){const t=convertSchema(e),s=vue.ref({});function n(i){const d=i?.conditions;if(!d)return!0;const u=Array.isArray(d)?d[0]:d,p=o?.value?.[u];return isVisible(p,d)}const a=(i=t,d=!0)=>(i.forEach(u=>{if(u.rules){if(!n(u)){console.log(u.name,"skip hidden"),delete s.value[u.name];return}u.rules.forEach(p=>{const c=checkFormRules(o.value[u.name],p);c?s.value[u.name]=c:delete s.value[u.name]})}u.schema&&a(u.schema,!1)}),d&&Object.values(s.value).some(Boolean)?s.value:null),l=vue.computed(()=>t?.filter(i=>n(i)));return{errors:s,validate:a,reset:()=>{o.value={},s.value={}},visibleSchema:l}}const _sfc_main=vue.defineComponent({__name:"vs-compact-form",props:vue.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},layout:{default:()=>"default"},formId:{default:()=>""}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:vue.mergeModels(["handle-submit"],["update:form","update:values"]),setup(o,{emit:e}){const t=e,s=o,n=vue.useModel(o,"form"),a=vue.useModel(o,"values"),{errors:l,validate:r,reset:i,visibleSchema:d}=useForm(a,s.schema),u=()=>{r(),t("handle-submit",a.value)};vue.onMounted(()=>{n.value.value=a.value,n.value.errors=l.value,n.value.reset=i,n.value.validate=r,n.value.formId=s.formId});function p(c,b){if(c===b)return!0;if(typeof c!="object"||typeof b!="object"||!c||!b)return!1;const E=Object.keys(c),V=Object.keys(b);return E.length!==V.length?!1:E.every(M=>c[M]===b[M])}return vue.provide("form",n),vue.provide("values",a),(c,b)=>(vue.openBlock(),vue.createElementBlock("form",{onSubmit:vue.withModifiers(u,["prevent"]),class:vue.normalizeClass(["grid grid-cols-12",c.layout==="default"?"gap-6":"gap-4"])},[(vue.openBlock(!0),vue.createElementBlock(vue.Fragment,null,vue.renderList(vue.unref(d),E=>(vue.openBlock(),vue.createBlock(_sfc_main$1,{key:E.name,class:vue.normalizeClass(c.layout==="horizontal"?"col-span-12":`col-span-${E.col||12} `),style:vue.normalizeStyle(c.style),item:E,layout:c.layout,"model-value":a.value[E.name],"onUpdate:modelValue":V=>{const M=a.value[E.name];p(M,V)||(a.value[E.name]=V)},error:vue.unref(l)[E.name]},null,8,["class","style","item","layout","model-value","onUpdate:modelValue","error"]))),128))],34))}});_sfc_main.install=function o(e){e.component("VForm",_sfc_main),e.config.globalProperties.$form=form,e.provide("form",form),window.v3plugin||(window.v3plugin={}),window.v3plugin.$form=e.config.globalProperties.$form};function isString(o){return typeof o=="string"||o instanceof String}function isObject(o){var e;return typeof o=="object"&&o!=null&&(o==null||(e=o.constructor)==null?void 0:e.name)==="Object"}function pick(o,e){return Array.isArray(e)?pick(o,(t,s)=>e.includes(s)):Object.entries(o).reduce((t,s)=>{let[n,a]=s;return e(a,n)&&(t[n]=a),t},{})}const DIRECTION={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function forceDirection(o){switch(o){case DIRECTION.LEFT:return DIRECTION.FORCE_LEFT;case DIRECTION.RIGHT:return DIRECTION.FORCE_RIGHT;default:return o}}function escapeRegExp(o){return o.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function objectIncludes(o,e){if(e===o)return!0;const t=Array.isArray(e),s=Array.isArray(o);let n;if(t&&s){if(e.length!=o.length)return!1;for(n=0;n<e.length;n++)if(!objectIncludes(e[n],o[n]))return!1;return!0}if(t!=s)return!1;if(e&&o&&typeof e=="object"&&typeof o=="object"){const a=e instanceof Date,l=o instanceof Date;if(a&&l)return e.getTime()==o.getTime();if(a!=l)return!1;const r=e instanceof RegExp,i=o instanceof RegExp;if(r&&i)return e.toString()==o.toString();if(r!=i)return!1;const d=Object.keys(e);for(n=0;n<d.length;n++)if(!Object.prototype.hasOwnProperty.call(o,d[n]))return!1;for(n=0;n<d.length;n++)if(!objectIncludes(o[d[n]],e[d[n]]))return!1;return!0}else if(e&&o&&typeof e=="function"&&typeof o=="function")return e.toString()===o.toString();return!1}class ActionDetails{constructor(e){for(Object.assign(this,e);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?DIRECTION.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?DIRECTION.RIGHT:DIRECTION.LEFT}}function IMask(o,e){return new IMask.InputMask(o,e)}function maskedClass(o){if(o==null)throw new Error("mask property should be defined");return o instanceof RegExp?IMask.MaskedRegExp:isString(o)?IMask.MaskedPattern:o===Date?IMask.MaskedDate:o===Number?IMask.MaskedNumber:Array.isArray(o)||o===Array?IMask.MaskedDynamic:IMask.Masked&&o.prototype instanceof IMask.Masked?o:IMask.Masked&&o instanceof IMask.Masked?o.constructor:o instanceof Function?IMask.MaskedFunction:(console.warn("Mask not found for mask",o),IMask.Masked)}function normalizeOpts(o){if(!o)throw new Error("Options in not defined");if(IMask.Masked){if(o.prototype instanceof IMask.Masked)return{mask:o};const{mask:e=void 0,...t}=o instanceof IMask.Masked?{mask:o}:isObject(o)&&o.mask instanceof IMask.Masked?o:{};if(e){const s=e.mask;return{...pick(e,(n,a)=>!a.startsWith("_")),mask:e.constructor,_mask:s,...t}}}return isObject(o)?{...o}:{mask:o}}function createMask(o){if(IMask.Masked&&o instanceof IMask.Masked)return o;const e=normalizeOpts(o),t=maskedClass(e.mask);if(!t)throw new Error("Masked class is not found for provided mask "+e.mask+", appropriate module needs to be imported manually before creating mask.");return e.mask===t&&delete e.mask,e._mask&&(e.mask=e._mask,delete e._mask),new t(e)}IMask.createMask=createMask;class MaskElement{get selectionStart(){let e;try{e=this._unsafeSelectionStart}catch{}return e??this.value.length}get selectionEnd(){let e;try{e=this._unsafeSelectionEnd}catch{}return e??this.value.length}select(e,t){if(!(e==null||t==null||e===this.selectionStart&&t===this.selectionEnd))try{this._unsafeSelect(e,t)}catch{}}get isActive(){return!1}}IMask.MaskElement=MaskElement;const KEY_Z=90,KEY_Y=89;class HTMLMaskElement extends MaskElement{constructor(e){super(),this.input=e,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var e,t,s;return(e=(t=(s=this.input).getRootNode)==null?void 0:t.call(s))!=null?e:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(e){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",e.drop),this.input.addEventListener("click",e.click),this.input.addEventListener("focus",e.focus),this.input.addEventListener("blur",e.commit),this._handlers=e}_onKeydown(e){if(this._handlers.redo&&(e.keyCode===KEY_Z&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===KEY_Y&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===KEY_Z&&(e.metaKey||e.ctrlKey))return e.preventDefault(),this._handlers.undo(e);e.isComposing||this._handlers.selectionChange(e)}_onBeforeinput(e){if(e.inputType==="historyUndo"&&this._handlers.undo)return e.preventDefault(),this._handlers.undo(e);if(e.inputType==="historyRedo"&&this._handlers.redo)return e.preventDefault(),this._handlers.redo(e)}_onCompositionEnd(e){this._handlers.input(e)}_onInput(e){e.isComposing||this._handlers.input(e)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}IMask.HTMLMaskElement=HTMLMaskElement;class HTMLInputMaskElement extends HTMLMaskElement{constructor(e){super(e),this.input=e}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(e,t){this.input.setSelectionRange(e,t)}get value(){return this.input.value}set value(e){this.input.value=e}}IMask.HTMLMaskElement=HTMLMaskElement;class HTMLContenteditableMaskElement extends HTMLMaskElement{get _unsafeSelectionStart(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,n=t&&t.focusOffset;return n==null||s==null||s<n?s:n}get _unsafeSelectionEnd(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),s=t&&t.anchorOffset,n=t&&t.focusOffset;return n==null||s==null||s>n?s:n}_unsafeSelect(e,t){if(!this.rootElement.createRange)return;const s=this.rootElement.createRange();s.setStart(this.input.firstChild||this.input,e),s.setEnd(this.input.lastChild||this.input,t);const n=this.rootElement,a=n.getSelection&&n.getSelection();a&&(a.removeAllRanges(),a.addRange(s))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}IMask.HTMLContenteditableMaskElement=HTMLContenteditableMaskElement;class InputHistory{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(e){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(e),this.states.length>InputHistory.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(e){return this.currentIndex=Math.min(Math.max(this.currentIndex+e,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}InputHistory.MAX_LENGTH=100;class InputMask{constructor(e,t){this.el=e instanceof MaskElement?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new HTMLContenteditableMaskElement(e):new HTMLInputMaskElement(e),this.masked=createMask(t),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new InputHistory,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(e){var t;return e==null||((t=this.masked)==null?void 0:t.maskEquals(e))}get mask(){return this.masked.mask}set mask(e){if(this.maskEquals(e))return;if(!(e instanceof IMask.Masked)&&this.masked.constructor===maskedClass(e)){this.masked.updateOptions({mask:e});return}const t=e instanceof IMask.Masked?e:createMask({mask:e});t.unmaskedValue=this.masked.unmaskedValue,this.masked=t}get value(){return this._value}set value(e){this.value!==e&&(this.masked.value=e,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(e){this.unmaskedValue!==e&&(this.masked.unmaskedValue=e,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(e){this.rawInputValue!==e&&(this.masked.rawInputValue=e,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(e){this.masked.typedValueEquals(e)||(this.masked.typedValue=e,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(e,t){const s=this._listeners[e];s&&s.forEach(n=>n(t))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(e){!this.el||!this.el.isActive||(this.el.select(e,e),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(e){const t=this.masked.unmaskedValue,s=this.masked.value,n=this.masked.rawInputValue,a=this.displayValue,l=this.unmaskedValue!==t||this.value!==s||this._rawInputValue!==n;this._unmaskedValue=t,this._value=s,this._rawInputValue=n,this.el.value!==a&&(this.el.value=a),e==="auto"?this.alignCursor():e!=null&&(this.cursorPos=e),l&&this._fireChangeEvents(),!this._historyChanging&&(l||this.history.isEmpty)&&this.history.push({unmaskedValue:t,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:t,...s}=e,n=!this.maskEquals(t),a=this.masked.optionsIsChanged(s);n&&(this.mask=t),a&&this.masked.updateOptions(s),(n||a)&&this.updateControl()}updateCursor(e){e!=null&&(this.cursorPos=e,this._delayUpdateCursor(e))}_delayUpdateCursor(e){this._abortUpdateCursor(),this._changingCursorPos=e,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,DIRECTION.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(e,t){return this._listeners[e]||(this._listeners[e]=[]),this._listeners[e].push(t),this}off(e,t){if(!this._listeners[e])return this;if(!t)return delete this._listeners[e],this;const s=this._listeners[e].indexOf(t);return s>=0&&this._listeners[e].splice(s,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const t=new ActionDetails({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),s=this.masked.rawInputValue,n=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection,{input:!0,raw:!0}).offset,a=s===this.masked.rawInputValue?t.removeDirection:DIRECTION.NONE;let l=this.masked.nearestInputPos(t.startChangePos+n,a);a!==DIRECTION.NONE&&(l=this.masked.nearestInputPos(l,DIRECTION.NONE)),this.updateControl(l),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}IMask.InputMask=InputMask;class ChangeDetails{static normalize(e){return Array.isArray(e)?e:[e,new ChangeDetails]}constructor(e){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},e)}aggregate(e){return this.inserted+=e.inserted,this.rawInserted+=e.rawInserted,this.tailShift+=e.tailShift,this.skip=this.skip||e.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(e){return this.inserted===e.inserted&&this.tailShift===e.tailShift&&this.rawInserted===e.rawInserted&&this.skip===e.skip}}IMask.ChangeDetails=ChangeDetails;class ContinuousTailDetails{constructor(e,t,s){e===void 0&&(e=""),t===void 0&&(t=0),this.value=e,this.from=t,this.stop=s}toString(){return this.value}extend(e){this.value+=String(e)}appendTo(e){return e.append(this.toString(),{tail:!0}).aggregate(e._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(e){Object.assign(this,e)}unshift(e){if(!this.value.length||e!=null&&this.from>=e)return"";const t=this.value[0];return this.value=this.value.slice(1),t}shift(){if(!this.value.length)return"";const e=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),e}}class Masked{constructor(e){this._value="",this._update({...Masked.DEFAULTS,...e}),this._initialized=!0}updateOptions(e){this.optionsIsChanged(e)&&this.withValueRefresh(this._update.bind(this,e))}_update(e){Object.assign(this,e)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value}reset(){this._value=""}get value(){return this._value}set value(e){this.resolve(e,{input:!0})}resolve(e,t){t===void 0&&(t={input:!0}),this.reset(),this.append(e,t,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(e){this.resolve(e,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(e){this.format?this.value=this.format(e,this):this.unmaskedValue=String(e)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(e){this.resolve(e,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(e,t){return e}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),Math.min(this.displayValue.length,t-e)}extractInput(e,t,s){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),this.displayValue.slice(e,t)}extractTail(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),new ContinuousTailDetails(this.extractInput(e,t),e)}appendTail(e){return isString(e)&&(e=new ContinuousTailDetails(String(e))),e.appendTo(this)}_appendCharRaw(e,t){return e?(this._value+=e,new ChangeDetails({inserted:e,rawInserted:e})):new ChangeDetails}_appendChar(e,t,s){t===void 0&&(t={});const n=this.state;let a;if([e,a]=this.doPrepareChar(e,t),e&&(a=a.aggregate(this._appendCharRaw(e,t)),!a.rawInserted&&this.autofix==="pad")){const l=this.state;this.state=n;let r=this.pad(t);const i=this._appendCharRaw(e,t);r=r.aggregate(i),i.rawInserted||r.equals(a)?a=r:this.state=l}if(a.inserted){let l,r=this.doValidate(t)!==!1;if(r&&s!=null){const i=this.state;if(this.overwrite===!0){l=s.state;for(let u=0;u<a.rawInserted.length;++u)s.unshift(this.displayValue.length-a.tailShift)}let d=this.appendTail(s);if(r=d.rawInserted.length===s.toString().length,!(r&&d.inserted)&&this.overwrite==="shift"){this.state=i,l=s.state;for(let u=0;u<a.rawInserted.length;++u)s.shift();d=this.appendTail(s),r=d.rawInserted.length===s.toString().length}r&&d.inserted&&(this.state=i)}r||(a=new ChangeDetails,this.state=n,s&&l&&(s.state=l))}return a}_appendPlaceholder(){return new ChangeDetails}_appendEager(){return new ChangeDetails}append(e,t,s){if(!isString(e))throw new Error("value should be string");const n=isString(s)?new ContinuousTailDetails(String(s)):s;t!=null&&t.tail&&(t._beforeTailState=this.state);let a;[e,a]=this.doPrepare(e,t);for(let l=0;l<e.length;++l){const r=this._appendChar(e[l],t,n);if(!r.rawInserted&&!this.doSkipInvalid(e[l],t,n))break;a.aggregate(r)}return(this.eager===!0||this.eager==="append")&&t!=null&&t.input&&e&&a.aggregate(this._appendEager()),n!=null&&(a.tailShift+=this.appendTail(n).tailShift),a}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),this._value=this.displayValue.slice(0,e)+this.displayValue.slice(t),new ChangeDetails}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const t=this.rawInputValue,s=this.value,n=e();return this.rawInputValue=t,this.value&&this.value!==s&&s.indexOf(this.value)===0&&(this.append(s.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,n}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const t=this.state,s=e(this);return this.state=t,delete this._isolated,s}doSkipInvalid(e,t,s){return!!this.skipInvalid}doPrepare(e,t){return t===void 0&&(t={}),ChangeDetails.normalize(this.prepare?this.prepare(e,this,t):e)}doPrepareChar(e,t){return t===void 0&&(t={}),ChangeDetails.normalize(this.prepareChar?this.prepareChar(e,this,t):e)}doValidate(e){return(!this.validate||this.validate(this.value,this,e))&&(!this.parent||this.parent.doValidate(e))}doCommit(){this.commit&&this.commit(this.value,this)}splice(e,t,s,n,a){s===void 0&&(s=""),n===void 0&&(n=DIRECTION.NONE),a===void 0&&(a={input:!0});const l=e+t,r=this.extractTail(l),i=this.eager===!0||this.eager==="remove";let d;i&&(n=forceDirection(n),d=this.extractInput(0,l,{raw:!0}));let u=e;const p=new ChangeDetails;if(n!==DIRECTION.NONE&&(u=this.nearestInputPos(e,t>1&&e!==0&&!i?DIRECTION.NONE:n),p.tailShift=u-e),p.aggregate(this.remove(u)),i&&n!==DIRECTION.NONE&&d===this.rawInputValue)if(n===DIRECTION.FORCE_LEFT){let c;for(;d===this.rawInputValue&&(c=this.displayValue.length);)p.aggregate(new ChangeDetails({tailShift:-1})).aggregate(this.remove(c-1))}else n===DIRECTION.FORCE_RIGHT&&r.unshift();return p.aggregate(this.append(s,a,r))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!objectIncludes(this,e)}typedValueEquals(e){const t=this.typedValue;return e===t||Masked.EMPTY_VALUES.includes(e)&&Masked.EMPTY_VALUES.includes(t)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new ChangeDetails}}Masked.DEFAULTS={skipInvalid:!0},Masked.EMPTY_VALUES=[void 0,null,""],IMask.Masked=Masked;class ChunksTailDetails{constructor(e,t){e===void 0&&(e=[]),t===void 0&&(t=0),this.chunks=e,this.from=t}toString(){return this.chunks.map(String).join("")}extend(e){if(!String(e))return;e=isString(e)?new ContinuousTailDetails(String(e)):e;const t=this.chunks[this.chunks.length-1],s=t&&(t.stop===e.stop||e.stop==null)&&e.from===t.from+t.toString().length;if(e instanceof ContinuousTailDetails)s?t.extend(e.toString()):this.chunks.push(e);else if(e instanceof ChunksTailDetails){if(e.stop==null){let n;for(;e.chunks.length&&e.chunks[0].stop==null;)n=e.chunks.shift(),n.from+=e.from,this.extend(n)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof IMask.MaskedPattern))return new ContinuousTailDetails(this.toString()).appendTo(e);const t=new ChangeDetails;for(let s=0;s<this.chunks.length;++s){const n=this.chunks[s],a=e._mapPosToBlock(e.displayValue.length),l=n.stop;let r;if(l!=null&&(!a||a.index<=l)&&((n instanceof ChunksTailDetails||e._stops.indexOf(l)>=0)&&t.aggregate(e._appendPlaceholder(l)),r=n instanceof ChunksTailDetails&&e._blocks[l]),r){const i=r.appendTail(n);t.aggregate(i);const d=n.toString().slice(i.rawInserted.length);d&&t.aggregate(e.append(d,{tail:!0}))}else t.aggregate(e.append(n.toString(),{tail:!0}))}return t}get state(){return{chunks:this.chunks.map(e=>e.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(e){const{chunks:t,...s}=e;Object.assign(this,s),this.chunks=t.map(n=>{const a="chunks"in n?new ChunksTailDetails:new ContinuousTailDetails;return a.state=n,a})}unshift(e){if(!this.chunks.length||e!=null&&this.from>=e)return"";const t=e!=null?e-this.from:e;let s=0;for(;s<this.chunks.length;){const n=this.chunks[s],a=n.unshift(t);if(n.toString()){if(!a)break;++s}else this.chunks.splice(s,1);if(a)return a}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const t=this.chunks[e],s=t.shift();if(t.toString()){if(!s)break;--e}else this.chunks.splice(e,1);if(s)return s}return""}}class PatternCursor{constructor(e,t){this.masked=e,this._log=[];const{offset:s,index:n}=e._mapPosToBlock(t)||(t<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=s,this.index=n,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(e){Object.assign(this,e)}pushState(){this._log.push(this.state)}popState(){const e=this._log.pop();return e&&(this.state=e),e}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(e){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((t=this.block)==null?void 0:t.displayValue.length)||0){var t;if(e())return this.ok=!0}return this.ok=!1}_pushRight(e){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(e())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,DIRECTION.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,DIRECTION.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,DIRECTION.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,DIRECTION.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,DIRECTION.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,DIRECTION.NONE),!0})}}class PatternFixedDefinition{constructor(e){Object.assign(this,e),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),this._value=this._value.slice(0,e)+this._value.slice(t),this._value||(this._isRawInput=!1),new ChangeDetails}nearestInputPos(e,t){t===void 0&&(t=DIRECTION.NONE);const s=0,n=this._value.length;switch(t){case DIRECTION.LEFT:case DIRECTION.FORCE_LEFT:return s;case DIRECTION.NONE:case DIRECTION.RIGHT:case DIRECTION.FORCE_RIGHT:default:return n}}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),this._isRawInput?t-e:0}extractInput(e,t,s){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),s===void 0&&(s={}),s.raw&&this._isRawInput&&this._value.slice(e,t)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(e,t){if(t===void 0&&(t={}),this.isFilled)return new ChangeDetails;const s=this.eager===!0||this.eager==="append",a=this.char===e&&(this.isUnmasking||t.input||t.raw)&&(!t.raw||!s)&&!t.tail,l=new ChangeDetails({inserted:this.char,rawInserted:a?this.char:""});return this._value=this.char,this._isRawInput=a&&(t.raw||t.input),l}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new ChangeDetails;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new ContinuousTailDetails("")}appendTail(e){return isString(e)&&(e=new ContinuousTailDetails(String(e))),e.appendTo(this)}append(e,t,s){const n=this._appendChar(e[0],t);return s!=null&&(n.tailShift+=this.appendTail(s).tailShift),n}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(e){this._value=e._value,this._isRawInput=!!e._rawInputValue}pad(e){return this._appendPlaceholder()}}class PatternInputDefinition{constructor(e){const{parent:t,isOptional:s,placeholderChar:n,displayChar:a,lazy:l,eager:r,...i}=e;this.masked=createMask(i),Object.assign(this,{parent:t,isOptional:s,placeholderChar:n,displayChar:a,lazy:l,eager:r})}reset(){this.isFilled=!1,this.masked.reset()}remove(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),e===0&&t>=1?(this.isFilled=!1,this.masked.remove(e,t)):new ChangeDetails}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(e,t){if(t===void 0&&(t={}),this.isFilled)return new ChangeDetails;const s=this.masked.state;let n=this.masked._appendChar(e,this.currentMaskFlags(t));return n.inserted&&this.doValidate(t)===!1&&(n=new ChangeDetails,this.masked.state=s),!n.inserted&&!this.isOptional&&!this.lazy&&!t.input&&(n.inserted=this.placeholderChar),n.skip=!n.inserted&&!this.isOptional,this.isFilled=!!n.inserted,n}append(e,t,s){return this.masked.append(e,this.currentMaskFlags(t),s)}_appendPlaceholder(){return this.isFilled||this.isOptional?new ChangeDetails:(this.isFilled=!0,new ChangeDetails({inserted:this.placeholderChar}))}_appendEager(){return new ChangeDetails}extractTail(e,t){return this.masked.extractTail(e,t)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,t,s){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),this.masked.extractInput(e,t,s)}nearestInputPos(e,t){t===void 0&&(t=DIRECTION.NONE);const s=0,n=this.value.length,a=Math.min(Math.max(e,s),n);switch(t){case DIRECTION.LEFT:case DIRECTION.FORCE_LEFT:return this.isComplete?a:s;case DIRECTION.RIGHT:case DIRECTION.FORCE_RIGHT:return this.isComplete?a:n;case DIRECTION.NONE:default:return a}}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),this.value.slice(e,t).length}doValidate(e){return this.masked.doValidate(this.currentMaskFlags(e))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(e)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(e){this.masked.state=e.masked,this.isFilled=e.isFilled}currentMaskFlags(e){var t;return{...e,_beforeTailState:(e==null||(t=e._beforeTailState)==null?void 0:t.masked)||e?._beforeTailState}}pad(e){return new ChangeDetails}}PatternInputDefinition.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 MaskedRegExp extends Masked{updateOptions(e){super.updateOptions(e)}_update(e){const t=e.mask;t&&(e.validate=s=>s.search(t)>=0),super._update(e)}}IMask.MaskedRegExp=MaskedRegExp;class MaskedPattern extends Masked{constructor(e){super({...MaskedPattern.DEFAULTS,...e,definitions:Object.assign({},PatternInputDefinition.DEFAULT_DEFINITIONS,e?.definitions)})}updateOptions(e){super.updateOptions(e)}_update(e){e.definitions=Object.assign({},this.definitions,e.definitions),super._update(e),this._rebuildMask()}_rebuildMask(){const e=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const t=this.mask;if(!t||!e)return;let s=!1,n=!1;for(let a=0;a<t.length;++a){if(this.blocks){const d=t.slice(a),u=Object.keys(this.blocks).filter(c=>d.indexOf(c)===0);u.sort((c,b)=>b.length-c.length);const p=u[0];if(p){const{expose:c,repeat:b,...E}=normalizeOpts(this.blocks[p]),V={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...E,repeat:b,parent:this},M=b!=null?new IMask.RepeatBlock(V):createMask(V);M&&(this._blocks.push(M),c&&(this.exposeBlock=M),this._maskedBlocks[p]||(this._maskedBlocks[p]=[]),this._maskedBlocks[p].push(this._blocks.length-1)),a+=p.length-1;continue}}let l=t[a],r=l in e;if(l===MaskedPattern.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(l==="{"||l==="}"){s=!s;continue}if(l==="["||l==="]"){n=!n;continue}if(l===MaskedPattern.ESCAPE_CHAR){if(++a,l=t[a],!l)break;r=!1}const i=r?new PatternInputDefinition({isOptional:n,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...normalizeOpts(e[l]),parent:this}):new PatternFixedDefinition({char:l,eager:this.eager,isUnmasking:s});this._blocks.push(i)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e){this.reset();return}const{_blocks:t,...s}=e;this._blocks.forEach((n,a)=>n.state=t[a]),super.state=s}reset(){super.reset(),this._blocks.forEach(e=>e.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(e=>e.isComplete)}get isFilled(){return this._blocks.every(e=>e.isFilled)}get isFixed(){return this._blocks.every(e=>e.isFixed)}get isOptional(){return this._blocks.every(e=>e.isOptional)}doCommit(){this._blocks.forEach(e=>e.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((e,t)=>e+=t.unmaskedValue,"")}set unmaskedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=e,this.appendTail(t),this.doCommit()}else super.unmaskedValue=e}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((e,t)=>e+=t.value,"")}set value(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=e,this.appendTail(t),this.doCommit()}else super.value=e}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(e){if(this.exposeBlock){const t=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=e,this.appendTail(t),this.doCommit()}else super.typedValue=e}get displayValue(){return this._blocks.reduce((e,t)=>e+=t.displayValue,"")}appendTail(e){return super.appendTail(e).aggregate(this._appendPlaceholder())}_appendEager(){var e;const t=new ChangeDetails;let s=(e=this._mapPosToBlock(this.displayValue.length))==null?void 0:e.index;if(s==null)return t;this._blocks[s].isFilled&&++s;for(let n=s;n<this._blocks.length;++n){const a=this._blocks[n]._appendEager();if(!a.inserted)break;t.aggregate(a)}return t}_appendCharRaw(e,t){t===void 0&&(t={});const s=this._mapPosToBlock(this.displayValue.length),n=new ChangeDetails;if(!s)return n;for(let l=s.index,r;r=this._blocks[l];++l){var a;const i=r._appendChar(e,{...t,_beforeTailState:(a=t._beforeTailState)==null||(a=a._blocks)==null?void 0:a[l]});if(n.aggregate(i),i.consumed)break}return n}extractTail(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const s=new ChunksTailDetails;return e===t||this._forEachBlocksInRange(e,t,(n,a,l,r)=>{const i=n.extractTail(l,r);i.stop=this._findStopBefore(a),i.from=this._blockStartPos(a),i instanceof ChunksTailDetails&&(i.blockIndex=a),s.extend(i)}),s}extractInput(e,t,s){if(e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),s===void 0&&(s={}),e===t)return"";let n="";return this._forEachBlocksInRange(e,t,(a,l,r,i)=>{n+=a.extractInput(r,i,s)}),n}_findStopBefore(e){let t;for(let s=0;s<this._stops.length;++s){const n=this._stops[s];if(n<=e)t=n;else break}return t}_appendPlaceholder(e){const t=new ChangeDetails;if(this.lazy&&e==null)return t;const s=this._mapPosToBlock(this.displayValue.length);if(!s)return t;const n=s.index,a=e??this._blocks.length;return this._blocks.slice(n,a).forEach(l=>{if(!l.lazy||e!=null){var r;t.aggregate(l._appendPlaceholder((r=l._blocks)==null?void 0:r.length))}}),t}_mapPosToBlock(e){let t="";for(let s=0;s<this._blocks.length;++s){const n=this._blocks[s],a=t.length;if(t+=n.displayValue,e<=t.length)return{index:s,offset:e-a}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce((t,s)=>t+=s.displayValue.length,0)}_forEachBlocksInRange(e,t,s){t===void 0&&(t=this.displayValue.length);const n=this._mapPosToBlock(e);if(n){const a=this._mapPosToBlock(t),l=a&&n.index===a.index,r=n.offset,i=a&&l?a.offset:this._blocks[n.index].displayValue.length;if(s(this._blocks[n.index],n.index,r,i),a&&!l){for(let d=n.index+1;d<a.index;++d)s(this._blocks[d],d,0,this._blocks[d].displayValue.length);s(this._blocks[a.index],a.index,0,a.offset)}}}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const s=super.remove(e,t);return this._forEachBlocksInRange(e,t,(n,a,l,r)=>{s.aggregate(n.remove(l,r))}),s}nearestInputPos(e,t){if(t===void 0&&(t=DIRECTION.NONE),!this._blocks.length)return 0;const s=new PatternCursor(this,e);if(t===DIRECTION.NONE)return s.pushRightBeforeInput()||(s.popState(),s.pushLeftBeforeInput())?s.pos:this.displayValue.length;if(t===DIRECTION.LEFT||t===DIRECTION.FORCE_LEFT){if(t===DIRECTION.LEFT){if(s.pushRightBeforeFilled(),s.ok&&s.pos===e)return e;s.popState()}if(s.pushLeftBeforeInput(),s.pushLeftBeforeRequired(),s.pushLeftBeforeFilled(),t===DIRECTION.LEFT){if(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.ok&&s.pos<=e||(s.popState(),s.ok&&s.pos<=e))return s.pos;s.popState()}return s.ok?s.pos:t===DIRECTION.FORCE_LEFT?0:(s.popState(),s.ok||(s.popState(),s.ok)?s.pos:0)}return t===DIRECTION.RIGHT||t===DIRECTION.FORCE_RIGHT?(s.pushRightBeforeInput(),s.pushRightBeforeRequired(),s.pushRightBeforeFilled()?s.pos:t===DIRECTION.FORCE_RIGHT?this.displayValue.length:(s.popState(),s.ok||(s.popState(),s.ok)?s.pos:this.nearestInputPos(e,DIRECTION.LEFT))):e}totalInputPositions(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);let s=0;return this._forEachBlocksInRange(e,t,(n,a,l,r)=>{s+=n.totalInputPositions(l,r)}),s}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const t=this._maskedBlocks[e];return t?t.map(s=>this._blocks[s]):[]}pad(e){const t=new ChangeDetails;return this._forEachBlocksInRange(0,this.displayValue.length,s=>t.aggregate(s.pad(e))),t}}MaskedPattern.DEFAULTS={...Masked.DEFAULTS,lazy:!0,placeholderChar:"_"},MaskedPattern.STOP_CHAR="`",MaskedPattern.ESCAPE_CHAR="\\",MaskedPattern.InputDefinition=PatternInputDefinition,MaskedPattern.FixedDefinition=PatternFixedDefinition,IMask.MaskedPattern=MaskedPattern;class MaskedRange extends MaskedPattern{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){const{to:t=this.to||0,from:s=this.from||0,maxLength:n=this.maxLength||0,autofix:a=this.autofix,...l}=e;this.to=t,this.from=s,this.maxLength=Math.max(String(t).length,n),this.autofix=a;const r=String(this.from).padStart(this.maxLength,"0"),i=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<i.length&&i[d]===r[d];)++d;l.mask=i.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(l)}get isComplete(){return super.isComplete&&!!this.value}boundaries(e){let t="",s="";const[,n,a]=e.match(/^(\D*)(\d*)(\D*)/)||[];return a&&(t="0".repeat(n.length)+a,s="9".repeat(n.length)+a),t=t.padEnd(this.maxLength,"0"),s=s.padEnd(this.maxLength,"9"),[t,s]}doPrepareChar(e,t){t===void 0&&(t={});let s;return[e,s]=super.doPrepareChar(e.replace(/\D/g,""),t),e||(s.skip=!this.isComplete),[e,s]}_appendCharRaw(e,t){if(t===void 0&&(t={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,t);const s=String(this.from).padStart(this.maxLength,"0"),n=String(this.to).padStart(this.maxLength,"0"),[a,l]=this.boundaries(this.value+e);return Number(l)<this.from?super._appendCharRaw(s[this.value.length],t):Number(a)>this.to?!t.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(s[this.value.length],t).aggregate(this._appendCharRaw(e,t)):super._appendCharRaw(n[this.value.length],t):super._appendCharRaw(e,t)}doValidate(e){const t=this.value;if(t.search(/[^0]/)===-1&&t.length<=this._matchFrom)return!0;const[n,a]=this.boundaries(t);return this.from<=Number(a)&&Number(n)<=this.to&&super.doValidate(e)}pad(e){const t=new ChangeDetails;if(this.value.length===this.maxLength)return t;const s=this.value,n=this.maxLength-this.value.length;if(n){this.reset();for(let a=0;a<n;++a)t.aggregate(super._appendCharRaw("0",e));s.split("").forEach(a=>this._appendCharRaw(a))}return t}}IMask.MaskedRange=MaskedRange;const DefaultPattern="d{.}`m{.}`Y";class MaskedDate extends MaskedPattern{static extractPatternOptions(e){const{mask:t,pattern:s,...n}=e;return{...n,mask:isString(t)?t:s}}constructor(e){super(MaskedDate.extractPatternOptions({...MaskedDate.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:t,pattern:s,blocks:n,...a}={...MaskedDate.DEFAULTS,...e},l=Object.assign({},MaskedDate.GET_DEFAULT_BLOCKS());e.min&&(l.Y.from=e.min.getFullYear()),e.max&&(l.Y.to=e.max.getFullYear()),e.min&&e.max&&l.Y.from===l.Y.to&&(l.m.from=e.min.getMonth()+1,l.m.to=e.max.getMonth()+1,l.m.from===l.m.to&&(l.d.from=e.min.getDate(),l.d.to=e.max.getDate())),Object.assign(l,this.blocks,n),super._update({...a,mask:isString(t)?t:s,blocks:l})}doValidate(e){const t=this.date;return super.doValidate(e)&&(!this.isComplete||this.isDateExist(this.value)&&t!=null&&(this.min==null||this.min<=t)&&(this.max==null||t<=this.max))}isDateExist(e){return this.format(this.parse(e,this),this).indexOf(e)>=0}get date(){return this.typedValue}set date(e){this.typedValue=e}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(e){super.typedValue=e}maskEquals(e){return e===Date||super.maskEquals(e)}optionsIsChanged(e){return super.optionsIsChanged(MaskedDate.extractPatternOptions(e))}}MaskedDate.GET_DEFAULT_BLOCKS=()=>({d:{mask:MaskedRange,from:1,to:31,maxLength:2},m:{mask:MaskedRange,from:1,to:12,maxLength:2},Y:{mask:MaskedRange,from:1900,to:9999}}),MaskedDate.DEFAULTS={...MaskedPattern.DEFAULTS,mask:Date,pattern:DefaultPattern,format:(o,e)=>{if(!o)return"";const t=String(o.getDate()).padStart(2,"0"),s=String(o.getMonth()+1).padStart(2,"0"),n=o.getFullYear();return[t,s,n].join(".")},parse:(o,e)=>{const[t,s,n]=o.split(".").map(Number);return new Date(n,s-1,t)}},IMask.MaskedDate=MaskedDate;class MaskedDynamic extends Masked{constructor(e){super({...MaskedDynamic.DEFAULTS,...e}),this.currentMask=void 0}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),"mask"in e&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(e.mask)?e.mask.map(t=>{const{expose:s,...n}=normalizeOpts(t),a=createMask({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...n});return s&&(this.exposeMask=a),a}):[])}_appendCharRaw(e,t){t===void 0&&(t={});const s=this._applyDispatch(e,t);return this.currentMask&&s.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(t))),s}_applyDispatch(e,t,s){e===void 0&&(e=""),t===void 0&&(t={}),s===void 0&&(s="");const n=t.tail&&t._beforeTailState!=null?t._beforeTailState._value:this.value,a=this.rawInputValue,l=t.tail&&t._beforeTailState!=null?t._beforeTailState._rawInputValue:a,r=a.slice(l.length),i=this.currentMask,d=new ChangeDetails,u=i?.state;return this.currentMask=this.doDispatch(e,{...t},s),this.currentMask&&(this.currentMask!==i?(this.currentMask.reset(),l&&(this.currentMask.append(l,{raw:!0}),d.tailShift=this.currentMask.value.length-n.length),r&&(d.tailShift+=this.currentMask.append(r,{raw:!0,tail:!0}).tailShift)):u&&(this.currentMask.state=u)),d}_appendPlaceholder(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendPlaceholder()),e}_appendEager(){const e=this._applyDispatch();return this.currentMask&&e.aggregate(this.currentMask._appendEager()),e}appendTail(e){const t=new ChangeDetails;return e&&t.aggregate(this._applyDispatch("",{},e)),t.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var t,s;return{...e,_beforeTailState:((t=e._beforeTailState)==null?void 0:t.currentMaskRef)===this.currentMask&&((s=e._beforeTailState)==null?void 0:s.currentMask)||e._beforeTailState}}doDispatch(e,t,s){return t===void 0&&(t={}),s===void 0&&(s=""),this.dispatch(e,this,t,s)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,t){t===void 0&&(t={});let[s,n]=super.doPrepare(e,t);if(this.currentMask){let a;[s,a]=super.doPrepare(s,this.currentMaskFlags(t)),n=n.aggregate(a)}return[s,n]}doPrepareChar(e,t){t===void 0&&(t={});let[s,n]=super.doPrepareChar(e,t);if(this.currentMask){let a;[s,a]=super.doPrepareChar(s,this.currentMaskFlags(t)),n=n.aggregate(a)}return[s,n]}reset(){var e;(e=this.currentMask)==null||e.reset(),this.compiledMasks.forEach(t=>t.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(e){this.exposeMask?(this.exposeMask.value=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=e}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(e){this.exposeMask?(this.exposeMask.unmaskedValue=e,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=e}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(e){if(this.exposeMask){this.exposeMask.typedValue=e,this.currentMask=this.exposeMask,this._applyDispatch();return}let t=String(e);this.currentMask&&(this.currentMask.typedValue=e,t=this.currentMask.unmaskedValue),this.unmaskedValue=t}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var e;return!!((e=this.currentMask)!=null&&e.isComplete)}get isFilled(){var e;return!!((e=this.currentMask)!=null&&e.isFilled)}remove(e,t){const s=new ChangeDetails;return this.currentMask&&s.aggregate(this.currentMask.remove(e,t)).aggregate(this._applyDispatch()),s}get state(){var e;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(t=>t.state),currentMaskRef:this.currentMask,currentMask:(e=this.currentMask)==null?void 0:e.state}}set state(e){const{compiledMasks:t,currentMaskRef:s,currentMask:n,...a}=e;t&&this.compiledMasks.forEach((l,r)=>l.state=t[r]),s!=null&&(this.currentMask=s,this.currentMask.state=n),super.state=a}extractInput(e,t,s){return this.currentMask?this.currentMask.extractInput(e,t,s):""}extractTail(e,t){return this.currentMask?this.currentMask.extractTail(e,t):super.extractTail(e,t)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(e,t){return this.currentMask?this.currentMask.nearestInputPos(e,t):super.nearestInputPos(e,t)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(e){this._overwrite=e}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(e){this._eager=e}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(e){this._skipInvalid=e}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(e){this._autofix=e}maskEquals(e){return Array.isArray(e)?this.compiledMasks.every((t,s)=>{if(!e[s])return;const{mask:n,...a}=e[s];return objectIncludes(t,a)&&t.maskEquals(n)}):super.maskEquals(e)}typedValueEquals(e){var t;return!!((t=this.currentMask)!=null&&t.typedValueEquals(e))}}MaskedDynamic.DEFAULTS={...Masked.DEFAULTS,dispatch:(o,e,t,s)=>{if(!e.compiledMasks.length)return;const n=e.rawInputValue,a=e.compiledMasks.map((l,r)=>{const i=e.currentMask===l,d=i?l.displayValue.length:l.nearestInputPos(l.displayValue.length,DIRECTION.FORCE_LEFT);return l.rawInputValue!==n?(l.reset(),l.append(n,{raw:!0})):i||l.remove(d),l.append(o,e.currentMaskFlags(t)),l.appendTail(s),{index:r,weight:l.rawInputValue.length,totalInputPositions:l.totalInputPositions(0,Math.max(d,l.nearestInputPos(l.displayValue.length,DIRECTION.FORCE_LEFT)))}});return a.sort((l,r)=>r.weight-l.weight||r.totalInputPositions-l.totalInputPositions),e.compiledMasks[a[0].index]}},IMask.MaskedDynamic=MaskedDynamic;class MaskedEnum extends MaskedPattern{constructor(e){super({...MaskedEnum.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:t,...s}=e;if(t){const n=t.map(r=>r.length),a=Math.min(...n),l=Math.max(...n)-a;s.mask="*".repeat(a),l&&(s.mask+="["+"*".repeat(l)+"]"),this.enum=t}super._update(s)}_appendCharRaw(e,t){t===void 0&&(t={});const s=Math.min(this.nearestInputPos(0,DIRECTION.FORCE_RIGHT),this.value.length),n=this.enum.filter(a=>this.matchValue(a,this.unmaskedValue+e,s));if(n.length){n.length===1&&this._forEachBlocksInRange(0,this.value.length,(l,r)=>{const i=n[0][r];r>=this.value.length||i===l.value||(l.reset(),l._appendChar(i,t))});const a=super._appendCharRaw(n[0][this.value.length],t);return n.length===1&&n[0].slice(this.unmaskedValue.length).split("").forEach(l=>a.aggregate(super._appendCharRaw(l))),a}return new ChangeDetails({skip:!this.isComplete})}extractTail(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),new ContinuousTailDetails("",e)}remove(e,t){if(e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),e===t)return new ChangeDetails;const s=Math.min(super.nearestInputPos(0,DIRECTION.FORCE_RIGHT),this.value.length);let n;for(n=e;n>=0&&!(this.enum.filter(r=>this.matchValue(r,this.value.slice(s,n),s)).length>1);--n);const a=super.remove(n,t);return a.tailShift+=n-e,a}get isComplete(){return this.enum.indexOf(this.value)>=0}}MaskedEnum.DEFAULTS={...MaskedPattern.DEFAULTS,matchValue:(o,e,t)=>o.indexOf(e,t)===t},IMask.MaskedEnum=MaskedEnum;class MaskedFunction extends Masked{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}IMask.MaskedFunction=MaskedFunction;var _MaskedNumber;class MaskedNumber extends Masked{constructor(e){super({...MaskedNumber.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),t="\\d*",s=(this.scale?"("+escapeRegExp(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+t+s),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(escapeRegExp).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(escapeRegExp(this.thousandsSeparator),"g")}_removeThousandsSeparators(e){return e.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(e){const t=e.split(this.radix);return t[0]=t[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),t.join(this.radix)}doPrepareChar(e,t){t===void 0&&(t={});const[s,n]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(t.input&&t.raw||!t.input&&!t.raw)?e.replace(this._mapToRadixRegExp,this.radix):e),t);return e&&!s&&(n.skip=!0),s&&!this.allowPositive&&!this.value&&s!=="-"&&n.aggregate(this._appendChar("-")),[s,n]}_separatorsCount(e,t){t===void 0&&(t=!1);let s=0;for(let n=0;n<e;++n)this._value.indexOf(this.thousandsSeparator,n)===n&&(++s,t&&(e+=this.thousandsSeparator.length));return s}_separatorsCountFromSlice(e){return e===void 0&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,t,s){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t),this._removeThousandsSeparators(super.extractInput(e,t,s))}_appendCharRaw(e,t){t===void 0&&(t={});const s=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,n=this._separatorsCountFromSlice(s);this._value=this._removeThousandsSeparators(this.value);const a=this._value;this._value+=e;const l=this.number;let r=!isNaN(l),i=!1;if(r){let c;this.min!=null&&this.min<0&&this.number<this.min&&(c=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(c=this.max),c!=null&&(this.autofix?(this._value=this.format(c,this).replace(MaskedNumber.UNMASKED_RADIX,this.radix),i||(i=a===this._value&&!t.tail)):r=!1),r&&(r=!!this._value.match(this._numberRegExp))}let d;r?d=new ChangeDetails({inserted:this._value.slice(a.length),rawInserted:i?"":e,skip:i}):(this._value=a,d=new ChangeDetails),this._value=this._insertThousandsSeparators(this._value);const u=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,p=this._separatorsCountFromSlice(u);return d.tailShift+=(p-n)*this.thousandsSeparator.length,d}_findSeparatorAround(e){if(this.thousandsSeparator){const t=e-this.thousandsSeparator.length+1,s=this.value.indexOf(this.thousandsSeparator,t);if(s<=e)return s}return-1}_adjustRangeWithSeparators(e,t){const s=this._findSeparatorAround(e);s>=0&&(e=s);const n=this._findSeparatorAround(t);return n>=0&&(t=n+this.thousandsSeparator.length),[e,t]}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),[e,t]=this._adjustRangeWithSeparators(e,t);const s=this.value.slice(0,e),n=this.value.slice(t),a=this._separatorsCount(s.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(s+n));const l=this._separatorsCountFromSlice(s);return new ChangeDetails({tailShift:(l-a)*this.thousandsSeparator.length})}nearestInputPos(e,t){if(!this.thousandsSeparator)return e;switch(t){case DIRECTION.NONE:case DIRECTION.LEFT:case DIRECTION.FORCE_LEFT:{const s=this._findSeparatorAround(e-1);if(s>=0){const n=s+this.thousandsSeparator.length;if(e<n||this.value.length<=n||t===DIRECTION.FORCE_LEFT)return s}break}case DIRECTION.RIGHT:case DIRECTION.FORCE_RIGHT:{const s=this._findSeparatorAround(e);if(s>=0)return s+this.thousandsSeparator.length}}return e}doCommit(){if(this.value){const e=this.number;let t=e;this.min!=null&&(t=Math.max(t,this.min)),this.max!=null&&(t=Math.min(t,this.max)),t!==e&&(this.unmaskedValue=this.format(t,this));let s=this.value;this.normalizeZeros&&(s=this._normalizeZeros(s)),this.padFractionalZeros&&this.scale>0&&(s=this._padFractionalZeros(s)),this._value=s}super.doCommit()}_normalizeZeros(e){const t=this._removeThousandsSeparators(e).split(this.radix);return t[0]=t[0].replace(/^(\D*)(0*)(\d*)/,(s,n,a,l)=>n+l),e.length&&!/\d$/.test(t[0])&&(t[0]=t[0]+"0"),t.length>1&&(t[1]=t[1].replace(/0*$/,""),t[1].length||(t.length=1)),this._insertThousandsSeparators(t.join(this.radix))}_padFractionalZeros(e){if(!e)return e;const t=e.split(this.radix);return t.length<2&&t.push(""),t[1]=t[1].padEnd(this.scale,"0"),t.join(this.radix)}doSkipInvalid(e,t,s){t===void 0&&(t={});const n=this.scale===0&&e!==this.thousandsSeparator&&(e===this.radix||e===MaskedNumber.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,t,s)&&!n}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,MaskedNumber.UNMASKED_RADIX)}set unmaskedValue(e){super.unmaskedValue=e}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(e){this.rawInputValue=this.format(e,this).replace(MaskedNumber.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(e){this.typedValue=e}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(e){return(super.typedValueEquals(e)||MaskedNumber.EMPTY_VALUES.includes(e)&&MaskedNumber.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}_MaskedNumber=MaskedNumber,MaskedNumber.UNMASKED_RADIX=".",MaskedNumber.EMPTY_VALUES=[...Masked.EMPTY_VALUES,0],MaskedNumber.DEFAULTS={...Masked.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[_MaskedNumber.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:o=>o.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},IMask.MaskedNumber=MaskedNumber;const PIPE_TYPE={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function createPipe(o,e,t){e===void 0&&(e=PIPE_TYPE.MASKED),t===void 0&&(t=PIPE_TYPE.MASKED);const s=createMask(o);return n=>s.runIsolated(a=>(a[e]=n,a[t]))}function pipe(o,e,t,s){return createPipe(e,t,s)(o)}IMask.PIPE_TYPE=PIPE_TYPE,IMask.createPipe=createPipe,IMask.pipe=pipe;class RepeatBlock extends MaskedPattern{get repeatFrom(){var e;return(e=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?e:0}get repeatTo(){var e;return(e=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?e:1/0}constructor(e){super(e)}updateOptions(e){super.updateOptions(e)}_update(e){var t,s,n;const{repeat:a,...l}=normalizeOpts(e);this._blockOpts=Object.assign({},this._blockOpts,l);const r=createMask(this._blockOpts);this.repeat=(t=(s=a??r.repeat)!=null?s:this.repeat)!=null?t:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((n=this._blocks)==null?void 0:n.length)||0,this.repeatFrom)),blocks:{m:r},eager:r.eager,overwrite:r.overwrite,skipInvalid:r.skipInvalid,lazy:r.lazy,placeholderChar:r.placeholderChar,displayChar:r.displayChar})}_allocateBlock(e){if(e<this._blocks.length)return this._blocks[e];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(createMask(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(e,t){t===void 0&&(t={});const s=new ChangeDetails;for(let i=(n=(a=this._mapPosToBlock(this.displayValue.length))==null?void 0:a.index)!=null?n:Math.max(this._blocks.length-1,0),d,u;d=(l=this._blocks[i])!=null?l:u=!u&&this._allocateBlock(i);++i){var n,a,l,r;const p=d._appendChar(e,{...t,_beforeTailState:(r=t._beforeTailState)==null||(r=r._blocks)==null?void 0:r[i]});if(p.skip&&u){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(s.aggregate(p),p.consumed)break}return s}_trimEmptyTail(e,t){var s,n;e===void 0&&(e=0);const a=Math.max(((s=this._mapPosToBlock(e))==null?void 0:s.index)||0,this.repeatFrom,0);let l;t!=null&&(l=(n=this._mapPosToBlock(t))==null?void 0:n.index),l==null&&(l=this._blocks.length-1);let r=0;for(let i=l;a<=i&&!this._blocks[i].unmaskedValue;--i,++r);r&&(this._blocks.splice(l-r+1,r),this.mask=this.mask.slice(r))}reset(){super.reset(),this._trimEmptyTail()}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const s=super.remove(e,t);return this._trimEmptyTail(e,t),s}totalInputPositions(e,t){return e===void 0&&(e=0),t==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(e,t)}get state(){return super.state}set state(e){this._blocks.length=e._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=e}}IMask.RepeatBlock=RepeatBlock;try{globalThis.IMask=IMask}catch{}const index=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails,ChunksTailDetails,DIRECTION,HTMLContenteditableMaskElement,HTMLInputMaskElement,HTMLMaskElement,InputMask,MaskElement,Masked,MaskedDate,MaskedDynamic,MaskedEnum,MaskedFunction,MaskedNumber,MaskedPattern,MaskedRange,MaskedRegExp,PIPE_TYPE,PatternFixedDefinition,PatternInputDefinition,RepeatBlock,createMask,createPipe,default:IMask,forceDirection,normalizeOpts,pipe},Symbol.toStringTag,{value:"Module"}));exports.ModalEdit=_sfc_main$l,exports.VForm=_sfc_main,exports.VsInputText=_sfc_main$V,exports.default=_sfc_main,Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|