@opengis/form 0.0.95 → 0.0.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/behavior.vue.d.ts +0 -1
- package/dist/components/behavior.vue.d.ts.map +1 -1
- package/dist/components/inputs/base/vs-input-richtext.vue.d.ts +21 -0
- package/dist/components/inputs/base/vs-input-richtext.vue.d.ts.map +1 -0
- package/dist/components/inputs/index.d.ts +19 -0
- package/dist/components/inputs/index.d.ts.map +1 -1
- package/dist/components/layouts/vs-compact-form-layout.vue.d.ts.map +1 -1
- package/dist/index-W-qQIppj-BsopI3Hz-CoGYBbIh.js +2383 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +35579 -4239
- package/dist/index.umd.cjs +150 -3
- package/package.json +3 -2
package/dist/index.umd.cjs
CHANGED
|
@@ -1,3 +1,150 @@
|
|
|
1
|
-
(function(ne,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):(ne=typeof globalThis<"u"?globalThis:ne||self,e(ne.FormBuilder={},ne.Vue,ne.OpenGISCore))})(this,function(ne,e,se){"use strict";const Zt=e.defineComponent({__name:"vs-info-tooltip",props:{text:{}},setup(l){const t=l,n=e.ref(!1),a=e.ref({top:"0px",left:"0px"});function o(s){if(!t.text)return;const i=s.currentTarget.getBoundingClientRect();a.value={top:`${i.bottom+4}px`,left:`${Math.min(i.left,window.innerWidth-230)}px`},n.value=!0}function r(){n.value=!1}return(s,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("span",{class:"inline-flex items-center",onMouseenter:o,onMouseleave:r},[e.renderSlot(s.$slots,"default",{},()=>[i[0]||(i[0]=e.createElementVNode("svg",{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",class:"text-gray-400 cursor-help"},[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),e.createElementVNode("path",{d:"M12 16v-4"}),e.createElementVNode("path",{d:"M12 8h.01"})],-1))])],32),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[n.value&&s.text?(e.openBlock(),e.createElementBlock("div",{key:0,style:e.normalizeStyle(a.value),class:"fixed z-[9999] max-w-xs p-2 bg-gray-900 text-white text-xs rounded-lg shadow-lg pointer-events-none"},e.toDisplayString(s.text),5)):e.createCommentVNode("",!0)]))],64))}}),Zn={class:"w-full relative"},Jn={key:0,class:"text-[14px] font-medium text-gray-900 mb-2 flex items-center gap-1"},Xn={class:"opacity-100"},Qn={key:0,class:"text-red-500 text-[14px]"},el={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},tl=e.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){const t=l,n=e.computed(()=>typeof t.item?.label=="string"&&t.item.label?t.item.label:t.item?.ua||t.label||t.ua),a=e.computed(()=>!!n.value),o=e.computed(()=>!!t.item?.rules?.includes("required")),r=e.computed(()=>t.item?.info||"");return(s,i)=>(e.openBlock(),e.createElementBlock("div",Zn,[a.value?(e.openBlock(),e.createElementBlock("div",Jn,[e.createElementVNode("span",Xn,e.toDisplayString(n.value),1),o.value?(e.openBlock(),e.createElementBlock("span",Qn,"*")):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createBlock(Zt,{key:1,text:r.value},null,8,["text"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(s.$slots,"default",e.mergeProps(s.$attrs,{class:{"opacity-60":s.item.disabled}})),s.error?(e.openBlock(),e.createElementBlock("span",el,e.toDisplayString(s.error),1)):e.createCommentVNode("",!0)]))}}),nl={class:"w-full relative flex flex-row items-center gap-2"},ll={key:0,class:"text-red-500 text-[14px]"},al={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},ol=e.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{default:()=>({container:12,label:3})}},setup(l){const t=l,n=e.computed(()=>t.item?.label||t.label||t.ua),a=e.computed(()=>t.item?.info||""),o=e.computed(()=>t.columns??{container:12,label:3}),r=e.computed(()=>{const{container:u,label:m}=o.value;return!u||u<=0?0:Math.min(Math.max(m??0,0),u)/u}),s=e.computed(()=>t.item?.type==="html"||r.value<=0?!1:!!n.value),i=e.computed(()=>{if(!s.value)return{};const u=`${r.value*100}%`;return{flexBasis:u,maxWidth:u}}),d=e.computed(()=>{const{container:u,label:m}=o.value;if(!u||u<=0)return{};if(t.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!s.value)return{flexBasis:"100%",maxWidth:"100%"};const h=Math.max(u-Math.max(m??0,0),0)/u;if(!h)return{};const E=`${h*100}%`;return{flexBasis:E,maxWidth:E}});return(u,m)=>(e.openBlock(),e.createElementBlock("div",nl,[s.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0 items-center gap-1",style:e.normalizeStyle(i.value)},[e.createTextVNode(e.toDisplayString(n.value)+" ",1),u.item?.rules?.includes("required")&&n.value?(e.openBlock(),e.createElementBlock("span",ll,"*")):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createBlock(Zt,{key:1,text:a.value},null,8,["text"])):e.createCommentVNode("",!0)],4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"flex-1 min-w-0",style:e.normalizeStyle(d.value)},[e.renderSlot(u.$slots,"default",e.normalizeProps(e.guardReactiveProps(u.$attrs)))],4),u.error?(e.openBlock(),e.createElementBlock("span",al,e.toDisplayString(u.error),1)):e.createCommentVNode("",!0)]))}}),rl={class:"w-full relative"},sl={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},il=e.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",rl,[e.renderSlot(t.$slots,"default",e.normalizeProps(e.guardReactiveProps(t.$attrs))),t.error?(e.openBlock(),e.createElementBlock("span",sl,e.toDisplayString(t.error),1)):e.createCommentVNode("",!0)]))}}),dl={class:"flex-1 min-w-0"},cl={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},ul={class:"truncate"},pl={key:0,class:"text-red-500 text-[14px]"},ml=["innerHTML"],hl={key:0,class:"mt-1 text-xs text-red-500"},fl={default:tl,horizontal:ol,inline:il,settings:e.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(l){const t=l,n=e.ref("uk");e.computed(()=>(t.item??{})?.[n.value]??t.ua??t.label??"");const a=e.computed(()=>t.item?.description??""),o=e.computed(()=>Array.isArray(t.item?.rules)&&t.item.rules.includes("required")),r=e.computed(()=>(typeof t.error=="string"?t.error:"")??""),s=()=>{const i=typeof localStorage<"u"?localStorage.getItem("locale"):null;n.value=i||"uk"};return e.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(n.value=localStorage.locale)}catch{}window.addEventListener("storage",s)}),e.onUnmounted(()=>{window.removeEventListener("storage",s)}),(i,d)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["w-full relative",{"opacity-60":i.item?.disabled}])},[e.createElementVNode("div",{class:e.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(i.item.type)?"flex flex-col":""]])},[e.createElementVNode("div",dl,[i.ua||i.label?(e.openBlock(),e.createElementBlock("p",cl,[e.createElementVNode("span",ul,e.toDisplayString(i.item[n.value]||i.ua||i.label),1),o.value?(e.openBlock(),e.createElementBlock("span",pl,"*")):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),a.value?(e.openBlock(),e.createElementBlock("p",{key:1,class:"text-xs text-slate-500 dark:text-slate-400",innerHTML:a.value},null,8,ml)):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(["w-full",["select","native-select"].includes(i.item.type)?"md:w-[30%]":"md:w-auto"])},[e.renderSlot(i.$slots,"default",e.normalizeProps(e.guardReactiveProps(i.$attrs)))],2)],2),r.value?(e.openBlock(),e.createElementBlock("p",hl,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0)],2))}})};function ye(l){return{inputClass:e.computed(()=>{const n=`disabled:opacity-50 disabled:cursor-not-allowed outline-none focus:ring-2 focus:ring-ring focus:ring-${l?.primaryColor||"blue"}-500 border border-solid border-stone-200 rounded-md text-sm text-stone-800 placeholder:text-stone-400 `;return l?.size==="sm"?`${n}h-[32px]`:`${n}h-[38px]`})}}const gl=["placeholder","disabled"],yl=e.defineComponent({__name:"vs-input-password",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=ye(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??"");return(s,i)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"password","onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),placeholder:r.value,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,gl)),[[e.vModelText,a.value]])}}),kl=["placeholder","disabled","maxlength","minlength"],ze=e.defineComponent({__name:"vs-input-text",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=ye(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??""),s=e.computed(()=>t.maxlength??void 0),i=e.computed(()=>t.minlength??void 0);function d(){typeof a.value=="string"&&(a.value=a.value.trim())}return(u,m)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"text","onUpdate:modelValue":m[0]||(m[0]=h=>a.value=h),placeholder:r.value,disabled:o.value,maxlength:s.value,minlength:i.value,onBlur:d,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[u.customClass,e.unref(n),{"!border-red-600":u.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,kl)),[[e.vModelText,a.value]])}}),bl=["placeholder","disabled","min","max"],Jt=e.defineComponent({__name:"vs-input-number",props:e.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=ye(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled);return(r,s)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":s[0]||(s[0]=i=>a.value=i),placeholder:r.placeholder,disabled:o.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"},min:r.min,max:r.max},null,10,bl)),[[e.vModelText,a.value]])}}),J=(l,t)=>{const n=l.__vccOpts||l;for(const[a,o]of t)n[a]=o;return n},wl={},xl={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 _l(l,t){return e.openBlock(),e.createElementBlock("svg",xl,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const El=J(wl,[["render",_l]]),Vl={class:"flex items-center gap-[4px]"},Bl=["value","id","disabled"],vl=["for"],Cl={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},Nl=e.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=t,a=l,o=e.computed({get:()=>a.modelValue,set:s=>n("update:modelValue",s)}),r=e.computed(()=>!!a.disabled);return(s,i)=>(e.openBlock(),e.createElementBlock("div",Vl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox",value:s.value,"onUpdate:modelValue":i[0]||(i[0]=d=>o.value=d),class:e.normalizeClass(["shrink-0 border border-solid hidden border-gray-700 w-3.5 h-3.5 rounded text-blue-600 focus:ring-offset-0 dark:bg-neutral-800 dark:border-neutral-700 cursor-pointer",{"!cursor-not-allowed":r.value}]),id:s.id,disabled:r.value},null,10,Bl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("label",{for:s.id,class:e.normalizeClass(["flex flex-1 checkbox-label items-center gap-x-2 cursor-pointer text-sm text-gray-800 dark:text-neutral-300",{"!cursor-not-allowed":r.value}])},[e.createElementVNode("div",{class:e.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[o.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",s.error?"border-red-600":""]])},[e.createVNode(El,{height:"12",width:"12"})],2),e.createElementVNode("span",Cl,[e.renderSlot(s.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(s.label),1)])])],10,vl)]))}}),Sl=["name","value","disabled"],Ml={class:"flex items-center gap-[6px] text-[14px]"},$l={key:0,class:"text-[16px]"},Dl=["src"],Al=e.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.computed({get:()=>n.modelValue,set:i=>{a("update:modelValue",i)}}),r=e.computed(()=>Array.isArray(o.value)?o.value.includes(n.value):o.value===!0||o.value===n.value),s=e.computed(()=>n.style?.size==="xs"?"p-1.5 text-xs":n.style?.size==="lg"?"p-3.5 text-[20px]":"p-2.5 text-xs");return(i,d)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[s.value,r.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[e.withDirectives(e.createElementVNode("input",{type:"checkbox",class:"hidden",name:i.id,value:i.value,"onUpdate:modelValue":d[0]||(d[0]=u=>o.value=u),disabled:i.disabled},null,8,Sl),[[e.vModelCheckbox,o.value]]),e.createElementVNode("span",Ml,[i.icon||i.imgUrl?(e.openBlock(),e.createElementBlock("span",$l,[i.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass(i.icon)},null,2)):e.createCommentVNode("",!0),i.imgUrl?(e.openBlock(),e.createElementBlock("img",{key:1,src:i.imgUrl,width:"16",height:"16",alt:"icon"},null,8,Dl)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.renderSlot(i.$slots,"default",{},()=>[e.createTextVNode(e.toDisplayString(i.label),1)])])],2))}}),Fl={class:"flex items-center"},Ct=e.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=`radio-${Math.floor(Math.random()*1e4)}`,r=e.computed({get:()=>Array.isArray(n.modelValue)?Array.isArray(n.modelValue)&&n.modelValue.includes(n.value):n.modelValue,set:i=>{if(Array.isArray(n.modelValue)){let d=[...n.modelValue];i?d.includes(n.value)||d.push(n.value):d=d.filter(u=>u!==n.value),a("update:modelValue",d)}else a("update:modelValue",i)}}),s=e.ref(`vs-checkbox-${n.view||"default"}`);return(i,d)=>(e.openBlock(),e.createElementBlock("div",Fl,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(s.value==="vs-checkbox-buttons"?e.unref(Al):e.unref(Nl)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:r.value,"onUpdate:modelValue":d[0]||(d[0]=u=>r.value=u),id:o,icon:i.icon,imgUrl:i.imgUrl,style:e.normalizeStyle(i.style),error:i.error},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),Ll={},Tl={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 Il(l,t){return e.openBlock(),e.createElementBlock("svg",Tl,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const Ol=J(Ll,[["render",Il]]),Rl={},zl={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-x"};function jl(l,t){return e.openBlock(),e.createElementBlock("svg",zl,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),e.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const Nt=J(Rl,[["render",jl]]),Pl={},Ul={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 Hl(l,t){return e.openBlock(),e.createElementBlock("svg",Ul,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M12 9h.01"},null,-1),e.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),e.createElementVNode("path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9 -9 9s-9 -1.8 -9 -9s1.8 -9 9 -9z"},null,-1)]))}const ql=J(Pl,[["render",Hl]]),Gl={key:0,class:"flex items-start gap-x-1"},Kl={key:0,class:"text-red-500 text-[14px]"},Yl=["title"],Wl=["disabled"],St=e.defineComponent({__name:"vs-input-switcher",props:e.mergeModels({rules:{default:()=>[]},view:{default:"checkbox"},label:{default:""},i:{default:""},text:{default:""},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue");return(a,o)=>t.view==="checkbox"?(e.openBlock(),e.createElementBlock("div",Gl,[e.createVNode(Ct,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),label:a.text,error:a.error||""},null,8,["modelValue","label","error"]),a.rules?.includes("required")?(e.openBlock(),e.createElementBlock("span",Kl,"*")):e.createCommentVNode("",!0),a.i?(e.openBlock(),e.createElementBlock("button",{key:1,class:"cursor-pointer",title:a.i,onClick:o[1]||(o[1]=e.withModifiers(()=>{},["prevent"]))},[e.createVNode(e.unref(ql),{class:"text-gray-500 w-[14px] h-[14px]"})],8,Yl)):e.createCommentVNode("",!0)])):(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:e.normalizeClass(["inline-flex h-5 w-9 shrink-0 px-[2px] cursor-pointer items-center rounded-full shadow-sm disabled:cursor-not-allowed disabled:opacity-50",[n.value?`bg-${a.style?.primaryColor||"blue"}-500`:"bg-stone-200",a.customClass]]),disabled:a.disabled,onClick:o[2]||(o[2]=r=>n.value=!n.value)},[e.createElementVNode("span",{"data-state":"checked",class:e.normalizeClass(["pointer-events-none block h-4 w-4 rounded-full bg-white shadow-lg ring-0 transition-transform",[n.value?"translate-x-4":"translate-x-0"]])},null,2)],10,Wl))}}),Zl=["id","innerHTML"],Mt=e.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",{id:t.name,class:e.normalizeClass(["text-gray-900",t.customClass]),innerHTML:t.html?t.html:t.text},null,10,Zl))}}),Jl=["placeholder","disabled","name"],$t=e.defineComponent({__name:"vs-input-mask",props:e.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=ye(t.style),a=e.useModel(l,"modelValue"),o=e.ref(null);let r=null;function s(i){const d={9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},u=new Set;let m=!1;for(let E=0;E<i.length;E+=1){const y=i[E];y==="{"?m=!0:y==="}"?m=!1:m&&u.add(y)}const h={};return Object.keys(d).forEach(E=>{u.has(E)||(h[E]=d[E])}),{mask:i,definitions:h,lazy:!1}}return e.onMounted(async()=>{if(o.value){const{default:i}=await Promise.resolve().then(()=>Gt),d=s(t.mask||"");r=i(o.value,d),r.on("accept",()=>{a.value=t.unmask?r.unmaskedValue:r.value}),r.on("complete",()=>{a.value=t.unmask?r.unmaskedValue:r.value}),r.value=a.value!=null?String(a.value):""}}),e.onBeforeUnmount(()=>{r?.destroy()}),e.watch(()=>t.mask,i=>{if(r){const d=s(i||"");r.updateOptions(d)}}),e.watch(a,i=>{r&&r.unmaskedValue!==i&&(r.value=i!=null?String(i):"")}),(i,d)=>(e.openBlock(),e.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:i.placeholder,disabled:i.disabled,name:i.name,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,10,Jl))}}),Xl={class:"relative w-full bg-white rounded-lg"},Ql=["placeholder","disabled"],Dt=e.defineComponent({__name:"vs-input-email",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=ye(t.style),a=e.useModel(l,"modelValue");return(o,r)=>(e.openBlock(),e.createElementBlock("div",Xl,[r[1]||(r[1]=e.createStaticVNode('<div class="absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="stroke-gray-500 transition-all"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M3 7a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v10a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-10z"></path><path d="M3 7l9 6l9 -6"></path></svg></div>',1)),e.withDirectives(e.createElementVNode("input",{type:"email","onUpdate:modelValue":r[0]||(r[0]=s=>a.value=s),placeholder:o.placeholder,disabled:o.disabled,class:e.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Ql),[[e.vModelText,a.value]])]))}}),ea={class:"relative w-full bg-white rounded-lg"},ta=["value","placeholder","disabled"],At=e.defineComponent({__name:"vs-input-tel",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=ye(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>a.value?a.value.startsWith("+")?a.value.slice(1):a.value:""),r=i=>{let{value:d}=i.target;d=d.replace(/^\+/,""),a.value=d?`+${d}`:""},s=i=>{const d=i,{data:u,inputType:m}=d;m&&m.startsWith("delete")||u&&/\D/.test(u)&&d.preventDefault()};return e.watch(()=>a.value,i=>{i&&!i.startsWith("+")?a.value=`+${i.replace(/^\+/,"")}`:i||(a.value="")},{immediate:!0}),(i,d)=>(e.openBlock(),e.createElementBlock("div",ea,[d[0]||(d[0]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"stroke-gray-500 transition-all"},[e.createElementVNode("path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"})])],-1)),d[1]||(d[1]=e.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[30px] text-gray-500 select-none pointer-events-none"}," + ",-1)),e.createElementVNode("input",{type:"tel",value:o.value,onInput:r,onBeforeinput:s,pattern:"^\\+[1-9]\\d{1,14}$",maxlength:"15",placeholder:i.placeholder,disabled:i.disabled,class:e.normalizeClass(["!pl-10 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(n),{"!border-red-600":i.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,ta)]))}}),na=["value","disabled"],la={class:"text-[13px] text-gray-700"},aa=e.defineComponent({__name:"vs-input-radio-default",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>!!t.disabled);return(o,r)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center gap-0",[t.customClass,a.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:"radio",value:t.value,disabled:a.value,class:"hidden"},null,8,na),[[e.vModelRadio,n.value]]),e.createElementVNode("span",{class:e.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${t.style?.primaryColor||"blue"}-500`,a.value?"opacity-50 cursor-not-allowed":""]])},[n.value==t.value?(e.openBlock(),e.createElementBlock("span",{key:0,class:e.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${t.style?.primaryColor||"blue"}-500`]])},null,2)):e.createCommentVNode("",!0)],2),e.createElementVNode("span",la,e.toDisplayString(t.text),1)],2))}}),oa=["value","disabled"],ra={class:"text-[13px] text-gray-700"},sa={"vs-input-radio-default":aa,"vs-input-radio-buttons":e.defineComponent({__name:"vs-input-radio-buttons",props:e.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>!!t.disabled);return(o,r)=>(e.openBlock(),e.createElementBlock("label",{class:e.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[n.value==t.value?`ring-2 ring-ring ring-${t.style?.primaryColor||"blue"}-500`:"",t.customClass,a.value?"cursor-not-allowed opacity-60":""]])},[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":r[0]||(r[0]=s=>n.value=s),type:"radio",value:t.value,disabled:a.value,class:"hidden"},null,8,oa),[[e.vModelRadio,n.value]]),e.createElementVNode("span",ra,e.toDisplayString(t.text),1)],2))}})},Ft=e.defineComponent({__name:"vs-input-radio",props:e.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>sa[`vs-input-radio-${t.view}`]);return(o,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass([o.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.options,s=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(a.value),e.mergeProps({key:s?.id,text:s.text,value:s.id.toString(),checked:n.value===s.id,modelValue:n.value,"onUpdate:modelValue":r[0]||(r[0]=i=>n.value=i)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),ia={key:1,class:"w-full flex flex-col gap-4"},da={key:0,class:"text-sm font-medium text-muted-foreground my-2"},ca="Без категорії",Xt=J(e.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},group:{default:void 0},values:{default:()=>[]},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,o=e.ref([]),r=e.reactive({}),s=y=>y?.value||y?.id||y?.text||y,i=y=>y.text||String(y),d=y=>`lg:col-span-${y||12}`,u=e.computed(()=>[n.position==="vertical"?"flex flex-col":"",n.colSpan?"grid":"flex justify-start"]),m=y=>y==null||y===""?null:typeof y=="string"||typeof y=="number"?y:String(y),h=e.computed(()=>{if(!n.group)return[];const y=new Map;o.value.forEach(f=>{const w=f[n.group],g=m(w);y.has(g)||y.set(g,[]),y.get(g)?.push(f)});const N=[];n.values?.length&&n.values.forEach(f=>{const w=m(f);N.push(w)});const b=new Set,k=f=>{const w=y.get(f)||[];if(!w.length)return null;const g=f===null?"group-null":`group-${String(f)}`,B=f===null?ca:String(f);return b.add(f),{key:g,label:B,options:w}},x=[];return N.forEach(f=>{const w=k(f);w&&x.push(w)}),y.forEach((f,w)=>{if(b.has(w))return;const g=k(w);g&&x.push(g)}),x}),E=async()=>{try{const y=await fetch(`/api/suggest/${n.data}`).then(N=>N.json());o.value=y?.data||y}catch(y){console.error(y)}};return e.watch(()=>n.modelValue,y=>{if(typeof y=="boolean"&&o.value.length===1){const N=s(o.value[0]);r[N]=y}else if(Array.isArray(y)){const N=new Set(y);o.value.forEach(b=>{if(!b.disabled){const k=s(b);r[k]=N.has(k)}})}},{immediate:!0}),e.watch(r,()=>{if(!o.value.length){a("update:modelValue",null);return}const y=Object.entries(r).filter(([,N])=>N).map(([N])=>N);a("update:modelValue",y.length===0?[]:y)},{deep:!0}),e.onMounted(()=>{if(n.data)E().then(()=>{if(typeof n.modelValue=="boolean"&&o.value.length===1){const y=s(o.value[0]);r[y]=n.modelValue}else if(Array.isArray(n.modelValue)){const y=new Set(n.modelValue);o.value.forEach(N=>{if(!N.disabled){const b=s(N);r[b]=y.has(b)}})}});else if(o.value=n.options,typeof n.modelValue=="boolean"&&o.value.length===1){const y=s(o.value[0]);r[y]=n.modelValue}else if(Array.isArray(n.modelValue)){const y=new Set(n.modelValue);o.value.forEach(N=>{if(!N.disabled){const b=s(N);r[b]=y.has(b)}})}}),(y,N)=>n.group?(e.openBlock(),e.createElementBlock("div",ia,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,b=>(e.openBlock(),e.createElementBlock("div",{key:b.key,class:"flex flex-col gap-2"},[b.label?(e.openBlock(),e.createElementBlock("span",da,e.toDisplayString(b.label),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["p-0 w-full gap-[12px]",u.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(b.options,k=>(e.openBlock(),e.createBlock(Ct,{modelValue:r[s(k)],"onUpdate:modelValue":x=>r[s(k)]=x,value:s(k),class:e.normalizeClass(d(y.colSpan)),disabled:n.disabled||k.disabled,label:i(k),key:`${b.key}-${s(k)}`,icon:k?.icon,imgUrl:k?.imgUrl,option:k,view:y.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["p-0 w-full gap-[10px]",u.value])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,b=>(e.openBlock(),e.createBlock(Ct,{modelValue:r[s(b)],"onUpdate:modelValue":k=>r[s(b)]=k,value:s(b),class:e.normalizeClass(d(y.colSpan)),disabled:n.disabled||b.disabled,label:i(b),key:s(b),icon:b?.icon,imgUrl:b?.imgUrl,option:b,view:y.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-8e66207e"]]),ua=["type","placeholder","disabled"],pa=e.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},mode:{default:"date"}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l;function a(m){return m?n.mode==="datetime"?(m.includes("T")?m:null)||m+(m.includes(" ")?"":"T00:00"):m?.split(" ")[0]:null}const{inputClass:o}=ye(n.style),r=t,s=e.computed({get:()=>a(n.modelValue),set:m=>r("update:modelValue",m)}),i=e.computed(()=>n.mode==="datetime"?"datetime-local":n.mode),d=e.computed(()=>!!n.disabled),u=e.computed(()=>n.placeholder??"");return(m,h)=>e.withDirectives((e.openBlock(),e.createElementBlock("input",{type:i.value,"onUpdate:modelValue":h[0]||(h[0]=E=>s.value=E),placeholder:u.value,disabled:d.value,ref:"date",class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[m.modelValue?"":"text-opacity-50",e.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,ua)),[[e.vModelDynamic,s.value]])}}),ma=(l,t)=>{if(!t||!Object.keys(t).length)return l;const[n,a=""]=l.split("?"),o=new URLSearchParams(a);Object.entries(t).forEach(([s,i])=>{i==null||i===""||o.set(s,String(i))});const r=o.toString();return r?`${n}?${r}`:n},Qt=async(l,t={})=>{try{const n=new FormData;n.append("unique","true"),n.append("file",l);const{api:a,id:o="1",form:r="form",table:s="table",customParams:i}=t,d=a||`/file/upload/uploads?id=${o||""}&form=${r||""}&table=${s||""}`,u=ma(d,i);return(await fetch(u,{method:"POST",body:n}).then(h=>h.json()))?.result}catch(n){return se.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",n),null}},ha=async l=>{try{return await fetch(`file/delete${l}`),!0}catch(t){return console.error(t),!1}},en=async l=>{try{const t=await fetch(`file/download/files/uploads${l}`),n=await t.arrayBuffer(),a=t.headers["content-type"],o=new TextDecoder("utf-8").decode(n),r=new Blob([o],{type:a}),s=document.createElement("a");s.setAttribute("download",l),s.href=window.URL.createObjectURL(r),s.click()}catch(t){console.error(t.message)}},fa={},ga={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 ya(l,t){return e.openBlock(),e.createElementBlock("svg",ga,t[0]||(t[0]=[e.createElementVNode("path",{d:"M5 12h14"},null,-1),e.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const Se=J(fa,[["render",ya]]),ka={},ba={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 wa(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",ba,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><line x1="9" y1="9" x2="10" y2="9"></line><line x1="9" y1="13" x2="15" y2="13"></line><line x1="9" y1="17" x2="15" y2="17"></line>',6)]))}const xa=J(ka,[["render",wa]]),_a={},Ea={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 Va(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Ea,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),e.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),e.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const Ba=J(_a,[["render",Va]]),va={},Ca={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 Na(l,t){return e.openBlock(),e.createElementBlock("svg",Ca,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M9 9l1 0"></path><path d="M9 13l6 0"></path><path d="M9 17l6 0"></path>',6)]))}const tn=J(va,[["render",Na]]),Sa={},Ma={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 $a(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Ma,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M6 20.735a2 2 0 0 1 -1 -1.735v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2h-1"></path><path d="M11 17a2 2 0 0 1 2 2v2a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1v-2a2 2 0 0 1 2 -2z"></path><line x1="11" y1="5" x2="10" y2="5"></line><line x1="13" y1="7" x2="12" y2="7"></line><line x1="11" y1="9" x2="10" y2="9"></line><line x1="13" y1="11" x2="12" y2="11"></line><line x1="11" y1="13" x2="10" y2="13"></line><line x1="13" y1="15" x2="12" y2="15"></line>',9)]))}const Da=J(Sa,[["render",$a]]),Aa={},Fa={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 La(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("svg",Fa,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M10 13l-1 2l1 2"></path><path d="M14 13l1 2l-1 2"></path>',5)]))}const Ta=J(Aa,[["render",La]]),Ia=l=>{if(!l)return"";const t=l?.split(".");return t[t.length-1]},Oa=l=>{const t=Ia(l),n={imageFormat:["tiff","jpg","jpeg","png","svg","ico","webp"],sheetsFormat:["xls","csv","xlsx"],archivesFormat:["zip","rar"],textsFormat:["json","geojson","txt","yml","yaml","shp"],documentsFormat:["pdf"]};return n.imageFormat.includes(t)?"img":n.sheetsFormat.includes(t)?Ba:n.textsFormat.includes(t)?Ta:n.documentsFormat.includes(t)?xa:n.archivesFormat.includes(t)?Da:tn},Ra={},za={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 ja(l,t){return e.openBlock(),e.createElementBlock("svg",za,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M4 7l16 0"></path><path d="M10 11l0 6"></path><path d="M14 11l0 6"></path><path d="M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"></path><path d="M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"></path>',6)]))}const je=J(Ra,[["render",ja]]),Pa={},Ua={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 Ha(l,t){return e.openBlock(),e.createElementBlock("svg",Ua,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const nn=J(Pa,[["render",Ha]]),qa=["title"],Ga={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},ln=J(e.defineComponent({__name:"vs-input-file-list-item",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(l){const t=e.useModel(l,"value"),n=e.useModel(l,"item"),a=l;return(o,r)=>(e.openBlock(),e.createElementBlock("div",{title:n.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Oa)(n.value)),{src:n.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:r[0]||(r[0]=s=>e.unref(en)(n.value))},null,8,["src"])),e.createElementVNode("div",Ga,[e.createElementVNode("button",{type:"button",onClick:r[1]||(r[1]=s=>{e.unref(ha)(n.value),t.value=a.multiple?t.value?.filter(i=>i!==n.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[e.createVNode(je,{class:"w-4 h-4"})]),e.createElementVNode("button",{type:"button",onClick:r[2]||(r[2]=s=>e.unref(en)(n.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[e.createVNode(nn,{class:"w-4 h-4"})])])],8,qa))}}),[["__scopeId","data-v-286cdbc0"]]),Ka={class:"flex items-center gap-x-2"},Ya=["accept","multiple","disabled"],Wa={key:1,class:"flex items-center flex-wrap gap-2"},Za={key:1,class:"loader"},Ja={key:1,class:"loader"},an=J(e.defineComponent({__name:"vs-input-file",props:e.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["change"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=e.useModel(l,"modelValue"),o=t,r=e.ref(null),s=e.ref(!1),i=e.inject("values"),d=e.computed(()=>n.format?n.format.split(",").map(f=>f.trim().toLowerCase()).filter(Boolean):[]),u=f=>Array.isArray(a.value)&&a.value[f]||"",m=f=>{if(n.max_size&&f.size>n.max_size*1024*1024){const w=(f.size/1048576).toFixed(2);return se.notify({type:"error",title:"Помилка!",message:`Файл "${f.name}" занадто великий. Максимальний розмір: ${n.max_size} МБ, розмір файлу: ${w} МБ`,position:"right-bottom"}),!1}return!0},h=f=>{if(!d.value.length)return!0;const w=`.${f.name.split(".").pop()?.toLowerCase()||""}`,g=d.value.includes(w);return g||se.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${f.name}". Дозволені формати: ${d.value.join(", ")}`,position:"right-bottom"}),g},E=e.computed(()=>{const f={},w=[];if(!n.customParams?.length)return{params:f,missingSources:w};const g=i?.value??{};return n.customParams.forEach(B=>{if(!B)return;const[V,v]=B.split("="),L=V?.trim(),j=v?.trim();if(!L||!j)return;const q=g[j];if(q==null||q===""){w.push(j);return}f[L]=q}),{params:f,missingSources:w}}),y=()=>{const f=E.value.params;return{api:n.api,customParams:Object.keys(f).length?f:void 0}},N=()=>{const f=E.value.missingSources;if(!f.length)return!0;const w=f.join(", ");return se.notify({type:"warning",title:"Заповніть поля",message:`Поля (${w}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},b=f=>{se.notify({type:"error",title:"Помилка завантаження",message:f||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},k=()=>{n.disabled||s.value||N()&&r.value?.click()},x=async f=>{const{files:w}=f.target;if(!w||w.length===0)return;if(!N()){r.value&&(r.value.value="");return}const g=Array.from(w);if(n.max_size&&g.filter(v=>!m(v)).length>0){r.value&&(r.value.value="");return}if(g.filter(V=>!h(V)).length>0){r.value&&(r.value.value="");return}s.value=!0;try{if(n.multiple){const V=Array.from(w).map(async q=>await Qt(q,y())),v=await Promise.all(V),j=v.filter(q=>q!==null).map(q=>q?.file_path).filter(Boolean);if(j.length===0){b();return}j.length<v.length&&b("Деякі файли не вдалося завантажити. Перевірте їх та спробуйте знову."),a.value=[...a.value||[],...j],o("change",a.value)}else{const V=w[0],v=await Qt(V,y());if(!v?.file_path){b();return}a.value=v?.file_path,o("change",a.value||"")}}catch(V){const v=V?.message||void 0;b(v)}finally{s.value=!1,r.value&&(r.value.value="")}};return(f,w)=>(e.openBlock(),e.createElementBlock("div",Ka,[e.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:r,type:"file",accept:n.format,multiple:f.multiple,onChange:x,disabled:s.value||f.disabled},null,40,Ya),!f.multiple&&a.value?(e.openBlock(),e.createBlock(ln,{key:0,item:a.value,"onUpdate:item":w[0]||(w[0]=g=>a.value=g),value:a.value,"onUpdate:value":w[1]||(w[1]=g=>a.value=g)},null,8,["item","value"])):f.multiple?(e.openBlock(),e.createElementBlock("div",Wa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(g,B)=>(e.openBlock(),e.createBlock(ln,{multiple:f.multiple,key:B,value:a.value,"onUpdate:value":w[2]||(w[2]=V=>a.value=V),item:u(B)},null,8,["multiple","value","item"]))),128)),e.createElementVNode("div",{onClick:k,class:e.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",f.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[s.value?(e.openBlock(),e.createElementBlock("div",Za)):(e.openBlock(),e.createBlock(Se,{key:0,class:"w-6 h-6"}))],2)])):e.createCommentVNode("",!0),f.multiple?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:2,onClick:k,class:e.normalizeClass([f.disabled||s.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[s.value?(e.openBlock(),e.createElementBlock("div",Ja)):(e.openBlock(),e.createBlock(Se,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-94bcb5d9"]]),Xa={class:"max-w-[55vw]"},Qa={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},eo={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},to={class:"px-[5px]"},no={class:""},rt=e.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(l){const t=l,n=e.computed(()=>{try{return new Date(t.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function a(o){if(o<1024)return`${o} B`;const r=o/1024;return r<1024?`${r.toFixed(2)} KB`:`${(r/1024).toFixed(2)} MB`}return(o,r)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[r[1]||(r[1]=e.createStaticVNode('<div class="flex items-center justify-center h-[30px] w-[30px]"><svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon icon-tabler icons-tabler-outline icon-tabler-file"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path></svg></div>',1)),e.createElementVNode("div",Xa,[e.createElementVNode("p",Qa,e.toDisplayString(o.item?.uploaded_name),1),e.createElementVNode("p",eo,[e.createElementVNode("span",null,e.toDisplayString(o.item?.username),1),e.withDirectives(e.createElementVNode("span",to,"|",512),[[e.vShow,o.item?.username]]),e.createElementVNode("span",null,e.toDisplayString(n.value),1),r[0]||(r[0]=e.createElementVNode("span",{class:"px-[5px]"},"|",-1)),e.createElementVNode("span",no,e.toDisplayString(a(o.item?.size)),1)])])],64))}}),lo={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},ao={key:0,class:"flex w-full gap-x-3 items-center"},oo={key:1,class:"flex gap-x-3 w-full items-center"},ro={key:2,class:"flex gap-x-3 w-full items-center"},so=["href"],io={key:3,class:"flex gap-x-3 w-full items-center"},co={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},uo={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"},po={class:"inline-block"},mo={class:"inline-block"},ho=e.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(l,{emit:t}){const n=l,a=t;function o(m){return["pdf","json"].includes(m.ext)}function r(m){return["ppt","pptx","doc","docx","xls","xlsx"].includes(m.ext)}function s(m){const h=document.createElement("a");h.setAttribute("download",m?.uploaded_name),h.href=m?.file_path,h.click()}async function i(){try{await fetch(`${n.prefix}/widget/file/${n.item.entity_id}/${n.item.file_id}`),a("update")}catch(m){console.error(m)}}function d(){a("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function u(m){(n.item.ext==="jpg"||n.item.ext==="png")&&a("openLightbox",{item:n.item,index:m})}return(m,h)=>(e.openBlock(),e.createElementBlock("div",lo,[m.item.ext==="jpg"||m.item.ext==="png"?(e.openBlock(),e.createElementBlock("div",ao,[e.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:h[0]||(h[0]=E=>u(m.index))},[e.createVNode(rt,{item:m.item},null,8,["item"])])])):o(m.item)?(e.openBlock(),e.createElementBlock("div",oo,[e.createVNode(rt,{item:m.item},null,8,["item"])])):r(m.item)?(e.openBlock(),e.createElementBlock("div",ro,[e.createElementVNode("a",{href:`/api/file-preview?id=${m.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[e.createVNode(rt,{item:m.item},null,8,["item"])],8,so)])):(e.openBlock(),e.createElementBlock("div",io,[e.createVNode(rt,{item:m.item},null,8,["item"])])),e.createElementVNode("div",co,[e.createElementVNode("div",uo,[e.createElementVNode("div",po,[e.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:h[1]||(h[1]=E=>s(m.item))},[e.createVNode(nn,{height:"14",width:"14"})])]),h[3]||(h[3]=e.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),e.createElementVNode("div",mo,[e.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:h[2]||(h[2]=E=>d())},[e.createVNode(je,{height:"14",width:"14"})])])])])]))}}),fo={},go={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 yo(l,t){return e.openBlock(),e.createElementBlock("svg",go,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const ko=J(fo,[["render",yo]]),bo={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},wo={class:"flex w-full mb-[12px] items-center gap-x-2"},xo={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},_o={class1:"ml-auto"},Eo={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"},Vo={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},Bo={class:"relative"},vo={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"},Co={key:0},on=e.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update"],setup(l,{emit:t}){const n=l,a=e.inject("form"),o=e.computed(()=>a.value.formId),r=e.ref(!1),s=e.ref(0),i=t,d=e.ref(!1),u=e.ref({}),m=e.ref([]),h=e.ref(""),E=e.computed(()=>Array.isArray(m.value)?m.value.filter(w=>w.ext==="jpg"||w.ext==="png").map(w=>w?.file_path):[]),y=e.computed(()=>h.value===""?m.value:m.value.filter(w=>w?.uploaded_name?.includes(h.value))),N=w=>{const g=E.value.findIndex(B=>B===w.item.file_path);g!==-1&&(r.value=!0,s.value=g)},b=async()=>{try{const w=await fetch(`${n.prefix}/widget/file/${o.value}`).then(g=>g.json());m.value=w?.rows}catch(w){console.error(w)}},k=async w=>{await Promise.all(Array.from(w.target.files).map(async g=>{const B=new FormData;B.append("file",g);try{const V=`${n.prefix}/widget/file/${o.value}`,v=await fetch(V,{method:"POST",body:B});return v.ok?(i("update","file-list"),g):(se.notify({type:v.status>=400&&v.status<500?"warning":"error",title:"Error",message:`Error code: ${v.status}`}),null)}catch(V){return se.notify({type:"error",title:"Error",message:V.message||"Unknown error"}),console.error(V),null}})),await b()},x=w=>{const g={...w};return w.cancel||(g.cancel=()=>{d.value=!1}),w.updateListOnConfirm&&(g.confirm=async()=>{await w.confirm(),d.value=!1,b()}),g},f=w=>{u.value=x(w),d.value=!0};return e.watch(o,w=>{w&&b()}),e.onMounted(()=>{o.value&&b()}),(w,g)=>{const B=e.resolveComponent("Lightbox"),V=e.resolveComponent("MessageBox");return e.openBlock(),e.createElementBlock("div",bo,[e.createElementVNode("div",wo,[e.createElementVNode("h2",xo," Файлів: "+e.toDisplayString(m.value?.length),1),e.createElementVNode("div",_o,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:g[0]||(g[0]=v=>k(v))},null,32),e.createElementVNode("div",Eo,[e.createVNode(ko,{height:"16",width:"16"})])])])]),m.value?.length>4?(e.openBlock(),e.createElementBlock("div",Vo,[e.createElementVNode("div",null,[e.createElementVNode("div",Bo,[g[8]||(g[8]=e.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[e.createElementVNode("svg",{class:"flex-shrink-0 text-gray-500 size-4 dark:text-neutral-400",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),e.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":g[1]||(g[1]=v=>h.value=v),class:"py-2 px-3 ps-10 pe-16 block w-full bg-gray-200 xl:bg-gray-100 rounded-lg text-sm focus:border-blue-500 h-[40px] focus:border-2 focus:outline-none disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:border-transparent dark:text-neutral-400 dark:placeholder:text-neutral-400 dark:focus:ring-neutral-600",placeholder:"Введіть назву файлу"},null,512),[[e.vModelText,h.value,void 0,{trim:!0}]])])])])):e.createCommentVNode("",!0),m.value?.length?(e.openBlock(),e.createElementBlock("div",vo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(y.value,(v,L)=>(e.openBlock(),e.createBlock(ho,{key:L,prefix:w.prefix,item:v,index:L,onUpdate:g[2]||(g[2]=j=>w.$emit("update","file-list")),onOpenModal:g[3]||(g[3]=j=>f(j)),onOpenLightbox:g[4]||(g[4]=j=>N(j))},null,8,["prefix","item","index"]))),128)),y.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Co,g[9]||(g[9]=[e.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):e.createCommentVNode("",!0),e.createVNode(B,{modelValue:r.value,"onUpdate:modelValue":g[5]||(g[5]=v=>r.value=v),startIndex:s.value,"onUpdate:index":g[6]||(g[6]=v=>s.value=v),images:E.value},null,8,["modelValue","startIndex","images"]),e.createVNode(V,e.mergeProps({modelValue:d.value,"onUpdate:modelValue":g[7]||(g[7]=v=>d.value=v),onConfirm:u.value.confirm},u.value),null,16,["modelValue","onConfirm"])])}}}),No={class:"flex items-center justify-between"},So={class:"text-[16px] text-gray-900 font-medium"},Mo={class:"grid gap-3"},$o=J(e.defineComponent({__name:"vs-container-switcher",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(l){const t=l,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,a=>{n.value=a}),(a,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",No,[e.createElementVNode("p",So,e.toDisplayString(l.title),1),e.createVNode(St,{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=r=>n.value=r),style:e.normalizeStyle(l.style)},null,8,["modelValue","style"])]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Mo,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),Do={class:"text-[16px] text-gray-900 font-medium"},Ao={class:"grid gap-3"},Fo=J(e.defineComponent({__name:"vs-container-accordion",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})},isOpen:{type:Boolean,default:!1}},setup(l){const t=l,n=e.ref(t.isOpen);return e.watch(()=>t.isOpen,a=>{n.value=a}),(a,o)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("button",{type:"button",onClick:o[0]||(o[0]=r=>n.value=!n.value),class:"flex items-center gap-2"},[e.createVNode(e.unref(Ol),{class:e.normalizeClass(["h-4 w-4 duration-300",[n.value?"-rotate-180":""]])},null,8,["class"]),e.createElementVNode("span",Do,e.toDisplayString(l.title),1)]),e.createVNode(e.Transition,{name:"slide-fade"},{default:e.withCtx(()=>[e.withDirectives(e.createElementVNode("div",Ao,[e.renderSlot(a.$slots,"default",{},void 0,!0)],512),[[e.vShow,n.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),Lo={class:"flex items-center justify-between"},To={switcher:$o,accordion:Fo,default:e.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(l){return(t,n)=>(e.openBlock(),e.createElementBlock("div",null,[e.createElementVNode("div",Lo,[e.createElementVNode("p",null,e.toDisplayString(l.title),1)]),e.renderSlot(t.$slots,"default")]))}})},xe={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Io=(l,t)=>String(l)===String(t),Oo=(l,t)=>String(l)!==String(t),Ro=(l,t)=>l>t,zo=(l,t)=>l>=t,jo=(l,t)=>l<t,Po=(l,t)=>l<=t,Uo=(l,t)=>Array.isArray(t)&&t.length===2?l>=t[0]&&l<=t[1]:!1,Ho=(l,t)=>String(l).startsWith(String(t)),qo=(l,t)=>String(l).endsWith(String(t)),Go=(l,t)=>String(l).includes(String(t)),Ko=(l,t)=>Array.isArray(t)?t.includes(l):!1,Yo=(l,t)=>Array.isArray(t)?!t.includes(l):!0,rn=(l,t)=>{if(!t)return!0;switch(t?.[1]){case xe.Equal:return Io(l,t?.[2]);case xe.Inequal:return Oo(l,t?.[2]);case xe.Higer:return Ro(l,t?.[2]);case xe.HigerOrEqual:return zo(l,t?.[2]);case xe.Lower:return jo(l,t?.[2]);case xe.LowerOrEqual:return Po(l,t?.[2]);case xe.Between:return Uo(l,t?.[2]);case xe.StartWith:return Ho(l,t?.[2]);case xe.EndWith:return qo(l,t?.[2]);case xe.Contain:return Go(l,t?.[2]);case xe.In:return Ko(l,t?.[2]);case xe.NotIn:return Yo(l,t?.[2]);default:return!0}},sn=e.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(l){const t=l,n=e.inject("values",e.ref({})),a=e.inject("form"),o=e.computed(()=>t.schema?.filter(i=>{const d=i?.conditions;if(!d)return!0;const u=Array.isArray(d)?d[0]:d,m=t.name?n.value?.[t.name]?.[u]??n.value?.[u]:n.value?.[u];return rn(m,d)})),r=e.computed(()=>To[t.view]),s=e.computed(()=>{if(n.value||(n.value={}),!t.name)return n.value;const i=n.value[t.name];if(i)return i;const d={};return n.value={...n.value,[t.name]:d},d});return(i,d)=>l.schema?.length?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{key:0,title:l.title,style:e.normalizeStyle(l.style)},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,u=>(e.openBlock(),e.createBlock(Vn,e.mergeProps({key:u.name},{ref_for:!0},u,{item:u,modelValue:s.value[u.name],"onUpdate:modelValue":m=>s.value[u.name]=m,style:l.style,error:e.unref(a)?.errors?.[u.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):e.createCommentVNode("",!0)}}),Wo=["aria-expanded","data-focus"],Zo={class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full"},Jo={key:0,class:"flex flex-nowrap items-center gap-1 overflow-x-auto overflow-y-hidden min-w-0 flex-1 py-0.5"},Xo={class:"flex items-center min-w-0"},Qo=["title"],er=["innerHTML"],tr=["onClick"],nr={class:"flex-1 min-w-[2px]"},lr=["placeholder"],ar=["title"],or=["innerHTML"],rr={key:2,class:"flex-1 min-w-[2px]"},sr=["placeholder"],ir={class:"flex items-center shrink-0"},dr=["disabled"],cr=["disabled","title"],ur=["aria-disabled","onClick"],pr=["innerHTML"],mr={key:1,class:"px-3 py-2 text-center text-gray-500"},hr=["disabled"],Lt=e.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},start:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{},maxlength:{},minlength:{}},emits:["change","update:modelValue","value-selected"],setup(l,{emit:t}){const n=l,a=t,o=e.computed(()=>n.multiple),r=e.computed(()=>n.disabled);ye(n.style);const s=e.computed({get:()=>n.modelValue,set:C=>a("update:modelValue",C)});!s.value&&n.defaultValue&&(s.value=n.defaultValue);const i=e.ref(null),d=e.ref(null),u=e.ref(null),m=e.ref(null),h=e.ref(!1),E=e.ref(!1),y=e.ref(null),N=e.ref([]),b=e.ref(-1),k=e.ref([]),x=e.ref(""),f=e.ref(null),w=e.ref("bottom"),g=e.ref({}),B=e.ref([]),V=e.computed(()=>{if(!B.value.length)return[];const C=N.value,$=new Map(C.map(c=>[c.id?.toString(),c]));return B.value.map(c=>$.get(c?.toString())).filter(c=>!!c)}),v=e.computed(()=>n.placeholder||"Select..."),L=e.computed(()=>P(y.value));e.computed(()=>o.value?!B.value.length&&x.value==="":!L.value&&x.value==="");const j=e.computed(()=>r.value?!1:o.value?B.value.length>0:!!s.value),q=C=>o.value?B.value.some($=>$?.toString()===C?.toString()):s.value?.toString()===C?.toString(),R=e.computed(()=>{let C=N.value??[];if(!n.data&&x.value.trim()!==""){const $=x.value.toLowerCase();C=C.filter(c=>{const p=P(c).toLowerCase(),_=c.text?.toLowerCase?.()||"";return p.includes($)||_.includes($)})}if(o.value&&B.value.length){const $=new Set(B.value.map(c=>c?.toString()));C=C.filter(c=>!$.has(c.id?.toString()))}return C}),K=e.inject("values"),G=e.inject("field-props"),Z=/\{\{\s*([^}]+?)\s*\}\}/g,O=C=>(C?String(C):"").replace(/<[^>]*>/g,"").trim(),D=e.computed(()=>n.slot??n?.optionTemplate??""),U=C=>{if(!C)return"";const $=D.value;return $?$.replace(Z,(c,p)=>{const _=p.trim(),S=C[_];return S!=null?String(S):""}):C.text??""},P=C=>{if(!C)return"";if(!D.value)return C.text??"";const c=U(C);return O(c)||C.text||""},ie=(C,$,c)=>{if(!G)return!1;const p=G.value?.[C]??{},_=(F,z,X)=>{if(!z.length)return F;const[W,...le]=z,re={...F};if(!le.length)return re[W]=X,re;const we=typeof F[W]=="object"&&F[W]!==null?F[W]:{};return re[W]=_(we,le,X),re},S=_(p,$,c);return G.value={...G.value||{},[C]:S},!0},ae=C=>{if(!n.set)return;const $=K?.value;!$&&!G||Object.entries(n.set).forEach(([c,p])=>{if(!c)return;const _=C?C[p]:null,S=c.split(".").map(X=>X.trim()).filter(Boolean);if(!S.length)return;const[F,...z]=S;z.length&&ie(F,z,_??null)||$&&($[F]=_??null)})},pe=e.computed(()=>n.parent?K?.value?.[n.parent]?.toString()??null:null),A=async C=>{if(!n.data){let $=n.options??[];if(C?.trim()){const c=C.toLowerCase();$=$.filter(p=>{const _=P(p).toLowerCase(),S=p.text?.toLowerCase?.()||"";return _.includes(c)||S.includes(c)})}return $}try{const $=n.host??"",c=n.prefix??"api",p=n.api??`/${c}/suggest/${n.data}`,_=`${$}${p}`,S=new URLSearchParams;return S.set("json","1"),C&&S.set("key",C),pe.value!==void 0&&pe.value!==null&&pe.value!==""&&S.set("parent",pe.value),n.start===1&&S.set("start","1"),(await fetch(`${_}?${S.toString()}`).then(z=>z.json()))?.data??[]}catch{return[]}},de=async()=>{n.data?N.value=await A(x.value):N.value=n.options?[...n.options]:[]},be=async C=>{if(C==null)return null;const $=N.value?.find(c=>c?.id?.toString()===String(C));if($)return $;if(n.data)try{const c=n.host??"",p=n.prefix??"api",_=n.api??`/${p}/suggest/${n.data}`,S=`${c}${_}`,F=new URLSearchParams;return F.set("json","1"),F.set("val",String(C)),pe.value!==void 0&&pe.value!==null&&pe.value!==""&&F.set("parent",pe.value),n.start===1&&F.set("start","1"),((await fetch(`${S}?${F.toString()}`).then(W=>W.json()))?.data??[])?.[0]??null}catch{return null}return null},ge=async C=>{const $=new Set(N.value.map(p=>p.id?.toString())),c=C.filter(p=>!$.has(p?.toString()));c.length&&await c.reduce(async(p,_)=>{await p;const S=await be(_);S&&N.value.push(S)},Promise.resolve())},Ie=async()=>{r.value||(h.value=!0,await de(),await e.nextTick(()=>{ce(),f.value?.focus(),R.value.length?b.value=0:b.value=-1}))},Ee=()=>{h.value=!1,b.value=-1},et=async C=>{if(r.value)return;!h.value?await Ie():Ee()},tt=async()=>{h.value?f.value?.focus():await Ie()},M=()=>{o.value?(B.value=[],s.value=[],a("change",[]),I(null,[])):(y.value=null,s.value=null,a("change",null),I(null,null)),ae(null),x.value="",e.nextTick(()=>f.value?.focus())},T=C=>{o.value&&(B.value=B.value.filter($=>$?.toString()!==C?.toString()),s.value=[...B.value],a("change",s.value),I(null),e.nextTick(()=>f.value?.focus()))},I=(C,$)=>{const c=$??(o.value?[...B.value]:C?.id??null);a("value-selected",{name:n.name,value:c,option:C})},Y=C=>{o.value?(q(C.id)||(B.value=[...B.value,C.id],s.value=[...B.value],a("change",s.value),I(C)),x.value="",e.nextTick(()=>{f.value?.focus(),b.value=Math.min(b.value,R.value.length-1)}),ae(null)):(y.value=C,s.value=C.id,a("change",s.value),I(C),x.value="",Ee(),ae(C))},ee=C=>{q(C.id)||Y(C)},oe=(C,$)=>{if(!C||!$)return;const c=C.offsetTop,p=c+C.offsetHeight,_=$.scrollTop,S=_+$.clientHeight;let F=$.scrollTop;c<_?F=c-80:p>S&&(F=p-$.clientHeight+4);const z=$;z.scrollTop=F},ue=C=>{let $=C.parentElement;for(;$;){if($.classList.contains("ui-dialog__content"))return $;const c=window.getComputedStyle($),p=c.overflow+c.overflowY+c.overflowX;if(p.includes("auto")||p.includes("scroll")||$===document.body||$===document.documentElement)return $;$=$.parentElement}return document.body},ce=()=>{if(!d.value)return;const C=d.value.getBoundingClientRect(),$=window.innerHeight||document.documentElement.clientHeight,c=window.innerWidth||document.documentElement.clientWidth,p=8,_=8,S=n.maxHeight||300,F=$-C.bottom-_-p,z=C.top-_-p,X=F>=z,W=Math.max(c-p*2,0);let{width:le}=C;W>0&&le>W&&(le=W);let{left:re}=C;re+le+p>c&&(re=c-le-p),re=Math.max(re,p);const we=Math.min(S,Math.max(X?F:z,50));w.value=X?"bottom":"top",g.value={position:"fixed",left:`${re}px`,width:`${le}px`,maxHeight:`${we}px`,transform:X?"none":"translateY(-100%)",top:X?`${C.bottom+_}px`:`${C.top-_}px`}},He=async C=>{r.value||!h.value&&(C.key==="ArrowDown"||C.key==="ArrowUp")&&(C.preventDefault(),await Ie())},Oe=C=>{if(!h.value)return;const{key:$}=C;if($==="ArrowDown")C.preventDefault(),b.value+1<R.value.length&&(b.value+=1,oe(k.value[b.value],u.value));else if($==="ArrowUp")C.preventDefault(),b.value>0&&(b.value-=1,oe(k.value[b.value],u.value));else if($==="Enter"){C.preventDefault();const c=R.value[b.value];c&&Y(c),f.value?.blur()}else $==="Escape"?(C.preventDefault(),Ee()):$==="Backspace"?o.value&&x.value===""&&B.value.length&&(B.value=B.value.slice(0,-1),s.value=[...B.value],a("change",s.value)):$==="Home"?(b.value=0,oe(k.value[0],u.value)):$==="End"?(b.value=R.value.length-1,oe(k.value[b.value],u.value)):$==="Tab"&&Ee()},Re=()=>{r.value||(E.value=!0)},wt=()=>{E.value=!1,x.value=""},xt=C=>{C.key==="Escape"&&h.value&&Ee()},nt=C=>{const $=C.target;i.value?.contains($)||m.value?.contains($)||Ee()},_t=C=>{h.value&&u.value&&!u.value.contains(C.target)&&ce()},Ae=()=>{h.value&&ce()},lt=()=>{h.value&&ce()};e.watch(()=>n.options,C=>{C?.length&&(N.value=[...C],Ne())},{immediate:!0});async function Ne(){if(o.value)Array.isArray(s.value)?B.value=[...s.value]:(B.value=s.value==null?[]:[s.value],s.value=[...B.value]),n.data&&B.value.length&&(await ge(B.value),await e.nextTick());else{if(Array.isArray(s.value)){const C=s.value[0]??null;s.value=C??null}s.value!=null&&(y.value=await be(s.value)),ae(y.value??null)}}e.watch(s,()=>{Ne()}),e.onMounted(async()=>{addEventListener("keydown",xt),addEventListener("scroll",_t,!0),addEventListener("resize",Ae),document.addEventListener("click",nt,!0),d.value&&ue(d.value).addEventListener("scroll",lt,!0),n.options?.length&&!n.data?N.value=[...n.options]:n.data&&(N.value=await A("")),await Ne(),vt.value=!1}),e.onUnmounted(()=>{removeEventListener("keydown",xt),removeEventListener("scroll",_t,!0),removeEventListener("resize",Ae),document.removeEventListener("click",nt,!0),d.value&&ue(d.value).removeEventListener("scroll",lt,!0)});const Ve=e.ref(!1),Fe=e.ref({}),Et=e.ref([]),Vt=e.ref(null);async function Bt(){if(!n.add?.token||Vt?.value.validate())return;const $=n.add.api??`/api/table/${n.add.token}`,{id:c}=await fetch($,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Fe.value)}).then(p=>p.json());if(!n.options?.length&&n.data){const p=await fetch(`${n.api??`/api/suggest/${n.data}`}?val=${c}`).then(_=>_.json());y.value=p[0],N.value.push(p[0]),s.value=c}Ve.value=!1,se.notify({title:"Success!",message:"Object created."})}async function Kt(){if(!n.add)return null;const C=await fetch(`/api/template/form/${n.add.form}`).then($=>$.json());return Et.value=C.schema,Ve.value=!0,null}function Yt(C,$=200){let c;return(...p)=>{c&&clearTimeout(c),c=window.setTimeout(()=>C(...p),$)}}const Wt=Yt(async C=>{N.value=await A(C)},200);e.watch(x,C=>{n.data&&Wt(C.trim())}),e.watch(()=>n.options,C=>{!n.data&&C?.length&&(N.value=[...C],Ne())},{immediate:!0}),e.watch(()=>n.parent??n.parentValue,()=>{n.data&&de()});const vt=e.ref(!0);return e.watch(pe,async()=>{if(n.data&&(vt.value||(o.value?(B.value=[],s.value=[],a("change",[])):(y.value=null,s.value=null,a("change",null))),await de(),n.auto===1&&pe.value&&N.value.length>0)){const C=N.value[0];C&&Y(C)}}),(C,$)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createVNode(e.unref(se.VsModal),{visible:Ve.value,"onUpdate:visible":$[1]||($[1]=c=>Ve.value=c),class:"z-[1000]",title:"Додати",buttonText:"Додати",onDone:Bt,teleport:C.teleport},{default:e.withCtx(()=>[e.createVNode(Me,{schema:Et.value,modelValue:Fe.value,"onUpdate:modelValue":$[0]||($[0]=c=>Fe.value=c),ref_key:"addForm",ref:Vt},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),e.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:$[5]||($[5]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass])},[$[10]||($[10]=e.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),$[11]||($[11]=e.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-[#b3d4ff]",h.value||E.value?"border-[#2684ff] ring-1 ring-[#2684ff]":"",r.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":h.value,"aria-haspopup":"listbox",onKeydown:He,onClick:tt,"data-focus":h.value||E.value?"true":"false",ref_key:"triggerRef",ref:d},[e.createElementVNode("div",Zo,[o.value?(e.openBlock(),e.createElementBlock("div",Jo,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(V.value,c=>(e.openBlock(),e.createElementBlock("div",{class:"flex min-w-0 bg-[rgb(230,230,230)] rounded-[2px] m-[2px] box-border max-w-full",key:c.id},[e.createElementVNode("div",Xo,[c?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:e.normalizeStyle({backgroundColor:c?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:"truncate text-[#172b4d] overflow-hidden max-w-[200px] px-0.5 pl-1.5",title:P(c)},[D.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:U(c)},null,8,er)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(c.text),1)],64))],8,Qo)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border text-[#172b4d] hover:bg-[rgb(255,189,173)] hover:text-[rgb(222,53,11)] flex-shrink-0",onClick:e.withModifiers(p=>T(c.id),["stop"])},$[6]||($[6]=[e.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,tr)]))),128)),e.createElementVNode("div",nr,[!r.value&&C.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:f,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:B.value.length?" ":v.value,"onUpdate:modelValue":$[2]||($[2]=c=>x.value=c),onFocus:Re,onBlur:wt,onKeydown:Oe},null,40,lr)),[[e.vModelText,x.value]]):e.createCommentVNode("",!0)])])):!o.value&&!E.value&&L.value&&x.value===""?(e.openBlock(),e.createElementBlock("div",{key:1,class:e.normalizeClass(["truncate text-gray-900"]),title:L.value},[y.value?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:e.normalizeStyle({backgroundColor:y.value?.color})},null,4)):e.createCommentVNode("",!0),D.value?(e.openBlock(),e.createElementBlock("span",{key:1,class:e.normalizeClass({"pl-5":y.value?.color}),innerHTML:U(y.value)},null,10,or)):(e.openBlock(),e.createElementBlock("span",{key:2,class:e.normalizeClass({"pl-5":y.value?.color})},e.toDisplayString(y.value?.text),3))],8,ar)):e.createCommentVNode("",!0),o.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",rr,[!r.value&&C.search?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:f,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:L.value?" ":v.value,"onUpdate:modelValue":$[3]||($[3]=c=>x.value=c),onFocus:Re,onBlur:wt,onKeydown:Oe},null,40,sr)),[[e.vModelText,x.value]]):e.createCommentVNode("",!0)]))]),e.createElementVNode("div",ir,[j.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:r.value,onClick:e.withModifiers(M,["stop"])},$[7]||($[7]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,dr)):e.createCommentVNode("",!0),$[9]||($[9]=e.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),e.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:r.value,onClick:$[4]||($[4]=e.withModifiers(c=>et(),["stop"])),title:h.value?"Закрити список":"Відкрити список"},$[8]||($[8]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})],-1)]),8,cr)])],42,Wo),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[h.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:m,class:e.normalizeClass(["fixed z-[3000] rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]"]),style:e.normalizeStyle(g.value),role:"listbox"},[e.createElementVNode("div",{class:"overflow-y-auto py-1",style:e.normalizeStyle({maxHeight:g.value.maxHeight||"300px"}),ref_key:"listRef",ref:u},[R.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(R.value,(c,p)=>(e.openBlock(),e.createElementBlock("div",{key:c.id,ref_for:!0,ref:_=>k.value[p]=_,class:e.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900",q(c.id)?"bg-[#2684ff] text-white":"bg-white hover:bg-[#deebff] hover:text-[#172b4d]",b.value===p&&!q(c.id)?"bg-[#deebff] text-[#172b4d]":""]),"aria-disabled":q(c.id)?"true":"false",role:"option",tabindex:"-1",onClick:_=>ee(c)},[c?.color?(e.openBlock(),e.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:e.normalizeStyle({backgroundColor:c?.color})},null,4)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(["leading-[19px]",b.value===c.id?"text-white":"",(b.value===p,"")])},[D.value?(e.openBlock(),e.createElementBlock("span",{key:0,innerHTML:U(c)},null,8,pr)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(c.text),1)],64))],2)],10,ur))),128)):(e.openBlock(),e.createElementBlock("div",mr," No options "))],4)],4)):e.createCommentVNode("",!0)]))],2),n.add?(e.openBlock(),e.createElementBlock("button",{key:0,onClick:Kt,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:r.value,type:"button"},[e.createVNode(Se,{width:"16",height:"16"}),$[12]||($[12]=e.createElementVNode("span",null,"Додати",-1))],8,hr)):e.createCommentVNode("",!0)],512)],64))}}),fr=["placeholder","disabled"],dn=e.defineComponent({__name:"vs-input-textarea",props:e.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,{inputClass:n}=ye(t.style),a=e.useModel(l,"modelValue"),o=e.computed(()=>!!t.disabled),r=e.computed(()=>t.placeholder??"");function s(){typeof a.value=="string"&&(a.value=a.value.trim())}return(i,d)=>e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{"onUpdate:modelValue":d[0]||(d[0]=u=>a.value=u),placeholder:r.value,disabled:o.value,row:"2",onBlur:s,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[e.unref(n)]]),style:{border:"1px solid #CFD9E0"}},null,42,fr)),[[e.vModelText,a.value]])}}),gr={},yr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search stroke-gray-500 transition-all"};function kr(l,t){return e.openBlock(),e.createElementBlock("svg",yr,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),e.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const br=J(gr,[["render",kr]]),wr={},xr={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 _r(l,t){return e.openBlock(),e.createElementBlock("svg",xr,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Er=J(wr,[["render",_r]]),Vr={},Br={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function vr(l,t){return e.openBlock(),e.createElementBlock("svg",Br,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),e.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),e.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Cr=J(Vr,[["render",vr]]),Nr={},Sr={xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function Mr(l,t){return e.openBlock(),e.createElementBlock("svg",Sr,t[0]||(t[0]=[e.createStaticVNode('<circle cx="9" cy="12" r="1"></circle><circle cx="9" cy="5" r="1"></circle><circle cx="9" cy="19" r="1"></circle><circle cx="15" cy="12" r="1"></circle><circle cx="15" cy="5" r="1"></circle><circle cx="15" cy="19" r="1"></circle>',6)]))}const cn=J(Nr,[["render",Mr]]),$r={},Dr={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function Ar(l,t){return e.openBlock(),e.createElementBlock("svg",Dr,t[0]||(t[0]=[e.createStaticVNode('<rect x="27" y="50.5" width="124" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="27" y="50.5" width="124" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-50 dark:stroke-neutral-700/10"></rect><rect x="34.5" y="58" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="61" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="66.5" y="73" width="77" height="6" rx="3" fill="currentColor" class="fill-gray-50 dark:fill-neutral-700/30"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" fill="currentColor" class="fill-white dark:fill-neutral-800"></rect><rect x="19.5" y="28.5" width="139" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/30"></rect><rect x="27" y="36" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="39" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><rect x="59" y="51" width="92" height="6" rx="3" fill="currentColor" class="fill-gray-100 dark:fill-neutral-700/70"></rect><g filter="url(#filter1)"><rect x="12" y="6" width="154" height="40" rx="8" fill="currentColor" class="fill-white dark:fill-neutral-800" shape-rendering="crispEdges"></rect><rect x="12.5" y="6.5" width="153" height="39" rx="7.5" stroke="currentColor" class="stroke-gray-100 dark:stroke-neutral-700/60" shape-rendering="crispEdges"></rect><rect x="20" y="14" width="24" height="24" rx="4" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="17" width="60" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect><rect x="52" y="29" width="106" height="6" rx="3" fill="currentColor" class="fill-gray-200 dark:fill-neutral-700"></rect></g><defs><filter id="filter1" x="0" y="0" width="178" height="64" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feFlood flood-opacity="0" result="BackgroundImageFix"></feFlood><feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"></feColorMatrix><feOffset dy="6"></feOffset><feGaussianBlur stdDeviation="6"></feGaussianBlur><feComposite in2="hardAlpha" operator="out"></feComposite><feColorMatrix type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.03 0"></feColorMatrix><feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1187_14810"></feBlend><feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1187_14810" result="shape"></feBlend></filter></defs>',12)]))}const Fr=J($r,[["render",Ar]]),Lr={},Tr={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 Ir(l,t){return e.openBlock(),e.createElementBlock("svg",Tr,t[0]||(t[0]=[e.createElementVNode("path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z"},null,-1)]))}const Or=J(Lr,[["render",Ir]]),Rr={class:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden flex flex-col"},zr={class:"flex flex-col gap-2 !p-4 border-b border-gray-200 sm:flex-row sm:items-center sm:justify-between bg-gray-50"},jr={class:"relative w-full"},Pr={class:"flex flex-wrap items-center justify-end gap-2 w-full"},Ur={class:"w-full overflow-x-auto"},Hr={class:"w-full min-w-[640px] divide-y divide-gray-200"},qr={class:"bg-gray-50"},Gr={class:"border-b border-gray-200"},Kr={class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 w-12 text-center"},Yr=["onClick"],Wr={key:0,class:"text-gray-400"},Zr={key:0,colspan:"100%",class:"text-center"},Jr={class:"w-full"},Xr={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},Qr=["onDragstart","onDragover","onDrop"],es={class:"px-4 py-3 text-center align-middle"},ts={class:"flex items-center justify-center"},ns=["innerHTML"],ls={key:0,class:"flex items-center gap-3 text-sm text-gray-700"},as={key:0},os=["src"],rs={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},ss={key:1,class:"flex items-center justify-center"},is={key:2,class:"text-sm font-medium text-gray-900"},ds={class:"px-4 py-3 text-right"},cs={class:"flex items-center justify-end gap-2"},us=["onClick"],ps=["onClick"],ms={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},un=e.defineComponent({__name:"vs-input-datatable",props:e.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useSlots(),a=e.useModel(l,"modelValue"),o=e.ref({}),r=e.ref(""),s=e.ref(null),i=e.ref("asc"),d=e.computed(()=>{const M=a.value??[],T=r.value?M.filter(ee=>t.colModel?.some(oe=>{const ue=oe.key||oe.name;if(!ue)return!1;const ce=ee[ue];return ce?Array.isArray(ce)?ce.join(", ").toLowerCase().includes(r.value.toLowerCase()):String(ce).toLowerCase().includes(r.value.toLowerCase()):!1})):M;if(!s.value)return T;const I=s.value,Y=[...T].sort((ee,oe)=>{const ue=ae(ee?.[I]),ce=ae(oe?.[I]);return typeof ue=="number"&&typeof ce=="number"?ue-ce:String(ue).localeCompare(String(ce))});return i.value==="asc"?Y:Y.reverse()}),u=e.ref(null),m=e.ref(null),h=e.ref(null),E=M=>{u.value=M},y=M=>{m.value=M},N=M=>{if(u.value===null||u.value===M){u.value=null,m.value=null;return}const T=[...a.value],[I]=T.splice(u.value,1);T.splice(M,0,I),a.value=T,u.value=null,m.value=null},b=()=>{h.value&&h.value.click()},k=M=>{const T=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],I=M.toLowerCase();return T.some(Y=>I.endsWith(Y))},x=M=>{const I=M.target.files?.[0];if(!I)return;const Y=new FileReader;Y.onload=ee=>{try{const oe=ee.target?.result;if(typeof oe=="string"){const ue=JSON.parse(oe);Array.isArray(ue)&&a.value.push(...ue)}}catch(oe){console.error("Error parsing file:",oe)}},Y.readAsText(I)},f=()=>{const M=JSON.stringify(a.value,null,2),T=new Blob([M],{type:"application/json"}),I=URL.createObjectURL(T),Y=document.createElement("a");Y.href=I,Y.download="data.json",Y.click(),URL.revokeObjectURL(I)},w=new Set(["autocomplete","select","radio","checkbox","combobox"]),g=new Map,B=(M,T)=>{const I=`/api/suggest/${M}`,Y=I.includes("?")?"&":"?",ee=T?`&val=${T}`:"";return`${I}${Y}json=1${ee}`},V=M=>M==null||M===""?null:typeof M=="object"?M?.id!==void 0&&M.id!==null&&M.id!==""?M.id:null:M,v=M=>{const T=new Set;return Array.isArray(a.value)&&a.value.forEach(I=>{const Y=I?.[M];if(Y==null||Y==="")return;if(Array.isArray(Y)){Y.forEach(oe=>{const ue=V(oe);ue!==null&&T.add(ue)});return}const ee=V(Y);ee!==null&&T.add(ee)}),T},L=async()=>{if(!t.colModel?.length)return;const M=t.colModel.filter(T=>T.data&&w.has(T.type?.toLowerCase()||""));M.length&&await Promise.all(M.map(async T=>{const I=T.key||T.name;if(!I)return;const Y=v(I),ee=Array.from(Y).map(ce=>String(ce)).sort(),oe=ee.join(",");if(!ee.length||g.get(I)===oe)return;g.set(I,oe);const ue=ee.map(encodeURIComponent).join(",");try{const He=await(await fetch(B(T.data,ue))).json();o.value[I]=He?.data??He}catch(ce){console.error("Failed to fetch column values",ce)}}))};e.watch([()=>t.colModel,()=>a.value],()=>{L()},{immediate:!0,deep:!0});const j=e.ref(""),q=e.ref(!1);let R="edit",K=0;const G=M=>(M?.format||M?.type||"").toString().toLowerCase(),Z=e.computed(()=>t.colModel?.filter(M=>G(M)!=="slot").map(M=>{const{slot:T,...I}=M;return I})??[]),O=e.ref({}),D=e.ref({}),U=M=>typeof M!="string"?!1:!!n[M],P=(M,T)=>T?T.split(".").reduce((I,Y)=>I==null?I:I[Y.trim()],M):M,ie=(M,T)=>typeof M!="string"?"":M.replace(/{{\s*([^}]+)\s*}}/g,(I,Y)=>{const ee=P(T,Y.trim());return ee??""}),ae=M=>{if(M==null||M==="")return"";if(typeof M=="number")return M;if(typeof M=="boolean")return M?1:0;if(typeof M=="string")return M.toLowerCase();if(Array.isArray(M))return M.map(T=>ae(T)).join(", ");if(typeof M=="object"){if(M.text!==void 0)return String(M.text).toLowerCase();if(M.label!==void 0)return String(M.label).toLowerCase();if(M.id!==void 0)return String(M.id).toLowerCase()}return String(M).toLowerCase()},pe=M=>{const T=M.key||M.name;if(T){if(s.value===T){i.value=i.value==="asc"?"desc":"asc";return}s.value=T,i.value="asc"}};async function A(){j.value="Додати",q.value=!0,R="add",O.value={}}function de(M,T){if(!M?.length)return null;const I=typeof T=="object"?T?.id:T;return I==null||I===""?null:M.find(Y=>Y?.id?.toString()===I.toString())?.text??null}function be(M){return M==null||M===""?"-":Array.isArray(M)?M.map(T=>typeof T=="object"?T?.text??T?.id??"-":T).join(", "):typeof M=="object"?M?.text??M?.id??"-":M}function ge(M,T){const I=T.key||T.name,Y=M?.[I],ee=o.value[I];if(!Y)return"-";if(Array.isArray(Y)){const ue=Y.map(ce=>de(ee,ce)).filter(Boolean);return ue.length?ue.join(", "):be(Y)}const oe=de(ee,Y);return oe||be(Y)}async function Ie(M,T){j.value="Редагувати",q.value=!0,R="edit",K=T,O.value={...M}}function Ee(){const M=D.value.validate();if(M){se.notify({type:"warning",title:"Помилка валідації",message:Object.entries(M).map(([T,I])=>`${T}: ${I}`).join(`
|
|
2
|
-
`)});return}R==="add"?Array.isArray(a.value)?a.value=[...a.value,O.value]:a.value=[O.value]:a.value=a.value.map((T,I)=>I===K?O.value:T),q.value=!1}function et(M){a.value=a.value.filter((T,I)=>I!==M)}function tt(){q.value=!1}return(M,T)=>(e.openBlock(),e.createElementBlock("div",Rr,[e.createElementVNode("div",zr,[e.createElementVNode("div",jr,[e.createVNode(br,{width:"16",height:"16",class:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":T[0]||(T[0]=I=>r.value=I),placeholder:"Пошук",class:"w-full rounded-md border border-gray-200 bg-white pl-10 pr-3 py-2 text-sm text-gray-900 placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100"},null,512),[[e.vModelText,r.value]])]),e.createElementVNode("div",Pr,[e.createElementVNode("input",{ref_key:"fileInput",ref:h,onChange:x,class:"hidden",accept:".json",type:"file"},null,544),e.createElementVNode("button",{type:"button",onClick:b,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[e.createVNode(Er,{class:"text-gray-700",width:"16",height:"16"}),T[4]||(T[4]=e.createTextVNode(" Імпорт ",-1))]),e.createElementVNode("button",{type:"button",onClick:f,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[e.createVNode(Cr,{class:"text-gray-700",width:"16",height:"16"}),T[5]||(T[5]=e.createTextVNode(" Експорт ",-1))]),e.createElementVNode("button",{onClick:A,type:"button",class:"inline-flex items-center gap-2 rounded-md bg-blue-500 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-600 transition-colors"},[e.createVNode(Se,{class:"text-white"}),T[6]||(T[6]=e.createTextVNode(" Додати ",-1))])])]),e.createElementVNode("div",Ur,[e.createElementVNode("table",Hr,[e.createElementVNode("thead",qr,[e.createElementVNode("tr",Gr,[e.createElementVNode("th",Kr,[e.createVNode(cn,{width:"20",height:"20",class:"mx-auto text-gray-400"})]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.colModel,I=>(e.openBlock(),e.createElementBlock("th",{key:I.key,class:"px-4 py-3 text-left text-xs font-semibold text-gray-900"},[e.createElementVNode("button",{type:"button",onClick:Y=>pe(I),class:"flex items-center gap-1 text-xs font-semibold text-gray-700 hover:text-gray-900 transition-colors"},[e.createElementVNode("span",null,e.toDisplayString(I.ua||I.label),1),s.value===(I.key||I.name)?(e.openBlock(),e.createElementBlock("span",Wr,e.toDisplayString(i.value==="asc"?"▲":"▼"),1)):e.createCommentVNode("",!0)],8,Yr)]))),128)),T[7]||(T[7]=e.createElementVNode("th",{class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 text-center"}," Дії ",-1))])]),e.createElementVNode("tbody",{class:e.normalizeClass(["divide-y divide-gray-200",{"[&_tr:last-child]:border-0":!m.value}])},[d.value.length===0?(e.openBlock(),e.createElementBlock("td",Zr,[e.createElementVNode("div",Jr,[e.createElementVNode("div",Xr,[e.createVNode(Fr,{class:"w-48 mx-auto"}),T[8]||(T[8]=e.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[e.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),e.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(I,Y)=>(e.openBlock(),e.createElementBlock("tr",{key:I.id,class:e.normalizeClass(["border-b transition-colors hover:bg-gray-50 cursor-move text-sm text-gray-700",{"opacity-50":u.value===Y,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":m.value===Y}]),draggable:"true",onDragstart:ee=>E(Y),onDragover:e.withModifiers(ee=>y(Y),["prevent"]),onDrop:ee=>N(Y)},[e.createElementVNode("td",es,[e.createElementVNode("div",ts,[e.createVNode(cn,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(M.colModel,ee=>(e.openBlock(),e.createElementBlock("td",{key:ee.key,class:"px-4 py-3 align-middle"},[G(ee)==="slot"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[U(ee.slot)?e.renderSlot(M.$slots,ee.slot,{key:0,row:I,value:I[ee.key],column:ee}):(e.openBlock(),e.createElementBlock("div",{key:1,class:"text-sm text-gray-900",innerHTML:ie(ee.slot,I)},null,8,ns))],64)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[G(ee)==="file"?(e.openBlock(),e.createElementBlock("div",ls,[k(ge(I,ee))?(e.openBlock(),e.createElementBlock("div",as,[e.createElementVNode("img",{src:ge(I,ee),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,os)])):(e.openBlock(),e.createElementBlock("div",rs,[e.createVNode(tn,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):G(ee)==="color"?(e.openBlock(),e.createElementBlock("div",ss,[e.createElementVNode("span",{class:"inline-flex h-6 w-6 rounded border border-gray-200",style:e.normalizeStyle({backgroundColor:ge(I,ee)||"#ffffff"})},null,4)])):(e.openBlock(),e.createElementBlock("div",is,e.toDisplayString(ge(I,ee)),1))],64))]))),128)),e.createElementVNode("td",ds,[e.createElementVNode("div",cs,[e.createElementVNode("button",{onClick:ee=>Ie(I,Y),class:"p-1.5 text-gray-600 hover:text-blue-600 hover:bg-blue-50 rounded transition-colors"},[e.createVNode(Or,{width:"16",height:"16"})],8,us),e.createElementVNode("button",{onClick:ee=>et(Y),class:"p-1.5 text-gray-600 hover:text-red-600 hover:bg-red-50 rounded transition-colors"},[e.createVNode(je,{width:"16",height:"16"})],8,ps)])])],42,Qr))),128))],2)])]),e.createVNode(e.unref(se.VsModal),{visible:q.value,title:j.value,size:"lg",onClose:tt,class:e.normalizeClass("z-50")},{default:e.withCtx(()=>[e.createVNode(Me,{schema:Z.value,values:O.value,"onUpdate:values":T[1]||(T[1]=I=>O.value=I),form:D.value,"onUpdate:form":T[2]||(T[2]=I=>D.value=I)},null,8,["schema","values","form"]),e.createElementVNode("div",ms,[e.createElementVNode("button",{type:"button",onClick:T[3]||(T[3]=I=>q.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:Ee,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])]),_:1},8,["visible","title"])]))}}),hs={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:"Клацніть на шари, щоб видалити їх"}}}}},fs={},gs={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 ys(l,t){return e.openBlock(),e.createElementBlock("svg",gs,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),e.createElementVNode("path",{d:"M17.657 16.657l-4.243 4.243a2 2 0 0 1 -2.827 0l-4.244 -4.243a8 8 0 1 1 11.314 0z"},null,-1)]))}const ks=J(fs,[["render",ys]]),bs={},ws={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 xs(l,t){return e.openBlock(),e.createElementBlock("svg",ws,t[0]||(t[0]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),e.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const _s=J(bs,[["render",xs]]),Es={},Vs={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 Bs(l,t){return e.openBlock(),e.createElementBlock("svg",Vs,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M12 5m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M19 8m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M5 11m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M15 19m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"></path><path d="M6.5 9.5l3.5 -3"></path><path d="M14 5.5l3 1.5"></path><path d="M18.5 10l-2.5 7"></path><path d="M13.5 17.5l-7 -5"></path>',9)]))}const vs=J(Es,[["render",Bs]]),Cs={},Ns={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 Ss(l,t){return e.openBlock(),e.createElementBlock("svg",Ns,t[0]||(t[0]=[e.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M8 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 18a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M20 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M8 6a2 2 0 1 0 -4 0a2 2 0 0 0 4 0z"></path><path d="M6 8v8"></path><path d="M18 16v-8"></path><path d="M8 6h8"></path><path d="M16 18h-8"></path>',9)]))}const Ms=J(Cs,[["render",Ss]]),$s={},Ds={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 As(l,t){return e.openBlock(),e.createElementBlock("svg",Ds,t[0]||(t[0]=[e.createElementVNode("title",null,null,-1),e.createElementVNode("desc",null,null,-1),e.createElementVNode("defs",null,null,-1),e.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[e.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[e.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[e.createElementVNode("path",{d:"M2,9 L0,9 L0,14 L5,14 L5,12 L2,12 L2,9 L2,9 Z M0,5 L2,5 L2,2 L5,2 L5,0 L0,0 L0,5 L0,5 Z M12,12 L9,12 L9,14 L14,14 L14,9 L12,9 L12,12 L12,12 Z M9,0 L9,2 L12,2 L12,5 L14,5 L14,0 L9,0 L9,0 Z",id:"Shape"})])])],-1)]))}const Fs=J($s,[["render",As]]),Ls={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},Ts={key:0,class:"vs-select__options absolute z-50 mt-1 w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm"},Is=["onClick"],Os={class:"relative flex-1 min-w-[140px]"},Rs=["placeholder"],zs="https://data.softpro.ua/api-user/gis-url-proxy",js="https://geo.rv.ua/api-user/dzk.api",Ps=J(e.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(l,{emit:t}){const n=l,a=t,o=["here","xy","parcel"],r=e.computed(()=>{const g=n.config?.tools?.filter(B=>o.includes(B));return g&&g.length?g:o}),s=e.computed(()=>n.config?.placeholder?.trim()||"Пошук…"),i=e.ref(r.value[0]??o[0]);e.watch(r,g=>{g.includes(i.value)||(i.value=g[0])});const d=e.ref(""),u=e.ref(!1),m=e.ref(null);e.watch(i,()=>{d.value="",u.value=!1});function h(g){i.value=g}function E(g){if(!u.value)return;const B=m.value;B&&!B.contains(g.target)&&(u.value=!1)}e.onMounted(()=>{window.addEventListener("click",E,!0)}),e.onBeforeUnmount(()=>{window.removeEventListener("click",E,!0)});function y(g){return g==="xy"?"Координати":g==="parcel"?"Кадастр":"Адреси"}function N(g){const B=g.replace(/[,]+/g," ").trim();if(!B)return null;const V=B.split(/\s+/).filter(Boolean);if(V.length<2)return null;const v=V.slice(0,2).map(Number);if(!v.every(Z=>Number.isFinite(Z)))return null;let[L,j]=v,q=L,R=j;const K=Z=>Math.abs(Z)<=90,G=Z=>Math.abs(Z)<=180;if(!K(q)||!G(R))if(K(R)&&G(q))q=j,R=L;else return null;return{lat:q,lng:R}}function b(g){return(g?.items||[]).map((V,v)=>({id:String(V?.id??v),title:V?.title||V?.address?.label||"Знайдений обʼєкт",lat:Number(V?.position?.lat),lng:Number(V?.position?.lng)})).filter(V=>Number.isFinite(V.lat)&&Number.isFinite(V.lng))}function k(g){const B=g?.result||g?.data||g;if(!B)return[];const V=B.geom_centroid;if(!V||!Array.isArray(V.coordinates))return[];const[v,L]=V.coordinates;return!Number.isFinite(L)||!Number.isFinite(v)?[]:[{id:"parcel",title:B.cadnum||B.cad_num||"Земельна ділянка",lat:L,lng:v}]}function x(g){const V=g.replace(/\s+/g,"").split(":");if(V.length!==4)return!1;const v=[10,2,3,4];return V.every((L,j)=>L.length===v[j]&&/^\d+$/.test(L))}function f(g){a("goToCoordinates",[g.lat,g.lng])}async function w(){const g=d.value.trim();if(g){if(i.value==="xy"){const B=N(g);if(!B){se.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}f(B),d.value="";return}try{const B=new URL(i.value==="here"?zs:js);if(i.value==="here")B.searchParams.set("searchtext",g);else{if(!x(g)){se.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}B.searchParams.set("cad_num",g)}const V=await fetch(B.toString());if(!V.ok)throw new Error(`HTTP ${V.status}`);const v=await V.json(),L=i.value==="here"?b(v):k(v);if(!L.length)se.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const j=L[0];f(j),d.value=""}}catch(B){const V=B?.message||"Помилка пошуку";se.notify({type:"error",title:"Пошук",message:V})}}}return(g,B)=>(e.openBlock(),e.createElementBlock("div",Ls,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(w,["prevent"])},[r.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:m,class:"relative search-type w-[140px]"},[e.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:B[0]||(B[0]=V=>u.value=!u.value)},[e.createElementVNode("span",null,e.toDisplayString(y(i.value)),1),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":u.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},B[2]||(B[2]=[e.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2))]),u.value?(e.openBlock(),e.createElementBlock("div",Ts,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,V=>(e.openBlock(),e.createElementBlock("li",{key:V,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:v=>h(V)},e.toDisplayString(y(V)),9,Is))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",Os,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":B[1]||(B[1]=V=>d.value=V),placeholder:s.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,Rs),[[e.vModelText,d.value,void 0,{trim:!0}]]),B[3]||(B[3]=e.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),[["__scopeId","data-v-3048520a"]]),Us={class:"bg-white/30 p-1 rounded-md shadow w-fit"},Hs={class:"flex gap-2"},qs=["onClick","title"],Gs=["src"],Ks=e.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(l,{emit:t}){const n=l,a=e.ref(Object.keys(n.basemaps)[0]),o=t;function r(d){o("onLayerChange",d),a.value=d}const s={z:13,x:4790,y:2762};function i(d){if(d?.preview)return d.preview;if(!d?.url)return;const u={"{z}":s.z,"{x}":s.x,"{y}":s.y};let m=d.url;return Object.entries(u).forEach(([h,E])=>{m=m.replace(new RegExp(h,"gi"),String(E))}),m}return(d,u)=>(e.openBlock(),e.createElementBlock("div",Us,[e.createElementVNode("div",Hs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.basemaps,(m,h)=>(e.openBlock(),e.createElementBlock("div",{key:h,class:e.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":a.value===h}]),onClick:E=>r(h),title:m.name||h,role:"button",tabindex:"0"},[e.createElementVNode("img",{src:i(m),alt:"",class:"w-10 h-10 object-cover"},null,8,Gs)],10,qs))),128))])]))}});function qe(l){return l?l.type==="Polygon"?{type:"MultiPolygon",coordinates:[l.coordinates]}:l.type==="Feature"?{...l,geometry:qe(l.geometry)}:l.type==="FeatureCollection"?{...l,features:(l.features||[]).map(t=>qe(t)).filter(Boolean)}:l:null}function Ys(l){return l?l.type==="FeatureCollection"||l.type==="Feature"?qe(l):l.geom?{type:"Feature",geometry:qe({type:l.geom.type,coordinates:l.geom.coordinates}),properties:{}}:l.type&&l.coordinates?{type:"Feature",geometry:qe(l),properties:{}}:null:null}const Ws={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},Zs={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},Js={class:"text-sm font-medium"},Xs={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},Qs={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},ei={class:"flex items-center gap-1"},ti=["disabled"],ni=["disabled"],li=["disabled"],ai={class:"bg-white/95 border border-gray-200 rounded-md shadow-xl px-3 py-2 max-w-[240px] text-[11px] sm:text-xs text-gray-900"},oi={class:"space-y-0.5"},ri={class:"text-gray-500"},si={class:"text-gray-900 text-right break-all"},ii={class:"absolute top-4 right-4 z-[1000]"},di={class:"flex flex-col gap-[2px]"},ci=["disabled"],ui=["disabled"],pi=["disabled"],mi=["disabled"],hi={class:"flex flex-col gap-2"},fi={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},gi={class:"flex flex-col gap-1"},yi=["checked","disabled","onChange"],ki={class:"text-gray-700 text-xs font-medium"},bi={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"},wi={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},xi={class:"shrink-0"},_i={class:"font-bold"},Ei={class:"flex items-center"},Vi={class:"text-xs mr-2"},Bi={key:0,class:"text-xs"},vi={key:1,class:"text-xs"},Ci=["disabled"],Ni=["disabled"],st="vs-base-tile-pane",it="vs-overlay-tile-pane",pn=J(e.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},ctrlZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},katottg:{default:""},layers:{default:()=>[]},bounds:{},api:{},center:{default:void 0},zoom:{default:void 0},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const a=e.getCurrentInstance()?.appContext?.config?.globalProperties?.$settings??{},o=Array.isArray(a.center)&&a.center.length===2?a.center:[50,30],r=typeof a.zoom=="number"?a.zoom:typeof a.defaultZoom=="number"?a.defaultZoom:10,s=l,i=t,d=e.computed(()=>!!s.disabled),u=e.ref(!1),m=e.ref(null),h=e.ref(!1),E=e.ref(""),y=e.ref(null),N=e.ref(null),b=e.ref(!1),k=e.ref(null),x=e.ref(null),f=e.ref(0),w=e.ref(Array.isArray(s.center)&&s.center.length===2?[...s.center]:o),g=e.ref(typeof s.zoom=="number"?s.zoom:r),B=e.ref([]),V=e.ref(s.modelValue);let v=!1;const L=e.ref(null),j=e.computed(()=>{const c={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!s.tools?.length)return{...c,point:!0,line:!0,polygon:!0,rectangle:!0};const p=new Set(s.tools.map(_=>_.toLowerCase()));return{search:p.has("search"),import:p.has("import"),export:p.has("export"),point:p.has("point"),line:p.has("line"),polygon:p.has("polygon"),rectangle:p.has("rectangle")}}),q=e.reactive({}),R=e.ref([]),K=e.computed(()=>R.value.map(c=>q[c]).filter(Boolean)),G=e.ref(null),Z=e.computed(()=>G.value?.entries??[]),O=e.computed(()=>{if(!G.value)return;const c=12,p=G.value.point.x+c,_=G.value.point.y+c;return{left:`${p}px`,top:`${_}px`}});function D(c){if(typeof c!="string"||!c.trim())return"";if(/^https?:\/\//i.test(c))return c;const p=window?.location?.origin??"",_=c.replace(/^\/+/,"");return _?p?`${p}/${_}`:`/${_}`:p}function U(){if(Array.isArray(a.basemaps)&&a.basemaps.length){const p=a.basemaps.map((_,S)=>{const F=String(_?.key??_?.id??_?.name??`b${S}`),z=D(String(_?.url??""));if(!z)return null;const X=typeof _?.preview=="string"&&_.preview?D(_.preview):"";return[F,{..._,url:z,preview:X}]}).filter(_=>Array.isArray(_)&&_.length===2).reduce((_,[S,F])=>(_[S]=F,_),{});if(Object.keys(p).length)return p}return{voyager:{name:"Оглядова карта",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/voyager/ua/13/4790/2762.png"},orto10:{name:"Ортофото 1:10K",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4790/2762.png"},osmb:{name:"Open Street Maps",url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",preview:"https://tile.openstreetmap.org.ua/styles/osm-bright/13/4790/2762.png"}}}const P=U(),ie=Object.keys(P),ae=e.ref(ie.length?ie[0]:"");let pe,A,de,be,ge=null;async function Ie(){const c=S=>{if(!Array.from(document.styleSheets).some(F=>F?.href?.includes(S))){const F=document.createElement("link");F.rel="stylesheet",F.href=S,document.head.appendChild(F)}},p=S=>new Promise((F,z)=>{if(Array.from(document.scripts).some(le=>le.src===S))return F();const W=document.createElement("script");W.src=S,W.async=!0,W.onload=()=>F(),W.onerror=le=>z(le),document.body.appendChild(W)});c("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),c("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css");try{await p("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js")}catch{}try{await p("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js")}catch{}try{await p("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js")}catch{}return window.L}function Ee(){const c=navigator.platform.toUpperCase().includes("MAC");return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Використовуйте два пальці для зуму карти.":c?"Використовуйте Ctrl або ⌘ + прокрутка для зуму карти.":"Використовуйте Ctrl + прокрутка для зуму карти."}function et(){if(!s.handleZoom||!m.value||!A)return null;let c;const p=S=>{const F=S.ctrlKey||S.metaKey||S.shiftKey;if(!s.ctrlZoom){h.value=!1,A.scrollWheelZoom.enable();return}if(!F){h.value=!0,E.value=Ee(),clearTimeout(c),c=window.setTimeout(()=>h.value=!1,1200);return}S.preventDefault(),S.stopPropagation(),h.value=!1,A.scrollWheelZoom.enable(),setTimeout(()=>A.scrollWheelZoom.disable(),120)},_=S=>{if(S.touches.length===1){if(!s.ctrlZoom)return;h.value=!0,E.value=Ee(),clearTimeout(c),c=window.setTimeout(()=>h.value=!1,3e3)}else h.value=!1};return m.value.addEventListener("wheel",p,{passive:!1}),m.value.addEventListener("touchstart",_,{passive:!0}),A.on("wheel",S=>{if(!s.ctrlZoom)return;S.originalEvent?.ctrlKey||S.originalEvent?.metaKey||S.originalEvent?.shiftKey||(S.originalEvent?.preventDefault?.(),S.originalEvent?.stopPropagation?.())}),()=>{m.value?.removeEventListener("wheel",p),m.value?.removeEventListener("touchstart",_),clearTimeout(c)}}function tt(c,p){return c?.id?String(c.id):c?.url?`${c.url}-${p}`:`layer-${p}`}function M(c){const p=(c?.url??"").trim();if(!p)return"";if(/^https?:\/\//i.test(p))return p;const _=window.location?.origin??"",S=p.replace(/^\/+/,"");return`${_}/${S}`}function T(c){const p=c?.style??{};return _=>{const S=p.colorAttr,F=p.colorSet??{},z=typeof S=="string"?F?.[_?.[S]]??p.color??"#3388ff":p.color??"#3388ff",X=p.stroke??z;return{weight:p.width??1,color:X,opacity:p.opacity??1,fill:p.type?p.type!=="polyline":!0,fillColor:z,fillOpacity:p.opacity??.5}}}function I(c){return c?.layer?.properties||c?.layer?.feature?.properties||c?.properties||{}}function Y(c,p={}){return c.popup===!1?[]:Array.isArray(c.popup)&&c.popup.length?c.popup.map(_=>{if(!_?.field)return null;const S=p[_.field];return S==null||S===""?null:{key:_.label||_.field,value:String(S)}}).filter(_=>!!_):Object.entries(p).filter(([_])=>typeof _=="string"&&_).slice(0,5).map(([_,S])=>({key:_,value:S==null?"—":String(S)}))}function ee(c,p){if(!A||!p?.latlng)return;const _=A.latLngToContainerPoint(p.latlng),S=I(p),F=Y(c,S);if(!F.length){oe(c.id);return}G.value={layerId:c.id,title:S?.name||c.title||c.name,properties:S,entries:F,point:{x:_.x,y:_.y}}}function oe(c){c&&G.value?.layerId!==c||(G.value=null)}function ue(c){const p=(c?.service??"").toLowerCase(),_=M(c),S=c.sourceLayer||c.layer||c.service_layer||c.service_key||c.map_key||c.dataset?.layer||c.id||c.table_name;if(p==="vtile"){const F=L.value;if(F?.vectorGrid?.protobuf&&!F?.maplibreGL){const z=F.vectorGrid.protobuf(_,{interactive:!0,maxNativeZoom:c.maxzoom??19,vectorTileLayerStyles:{[S??"default"]:T(c),default:T(c)}});return z?.on?.("mouseover",X=>ee(c,X)),z?.on?.("mousemove",X=>ee(c,X)),z?.on?.("mouseout",()=>oe(c.id)),z}if(F?.maplibreGL&&window?.maplibregl){const z=_;return z?F.maplibreGL({style:z,interactive:!1,pane:"overlayPane"}):null}return null}return p==="tile"||/^https?:\/\//i.test(_)||_.includes("{z}")?L.value.tileLayer(_,{opacity:c?.style?.opacity??1,pane:it}):L.value.tileLayer(_,{opacity:c?.style?.opacity??1,pane:it})}function ce(c){const p=L.value;if(!p)return null;const _=("bounds"in c?c.bounds:void 0)??s.bounds??B.value;if(!Array.isArray(_)||!_.length)return null;const F={color:c.style?.stroke??c.style?.color??"#2563eb",weight:c.style?.width??2,interactive:!1,opacity:c.style?.opacity??.8,dashArray:"4 4"},z=Array.isArray(c.bounds)&&c.bounds.length?c.bounds:_,X=He(z);if(!X.length||!p?.polyline)return null;const W=X.map(le=>{if(!le.length)return le;const re=le[0],we=le[le.length-1];return re&&we&&typeof we.equals=="function"&&!we.equals(re)?[...le,re]:le});return p.polyline(W,F)}function He(c){const p=L.value;if(!p||!Array.isArray(c))return[];const _=F=>{if(!Array.isArray(F)||F.length<2)return null;const[z,X]=F;return!Number.isFinite(Number(X))||!Number.isFinite(Number(z))?null:p.latLng(Number(X),Number(z))},S=F=>Array.isArray(F)&&F.length>=2&&F.every(z=>Number.isFinite(Number(z)));if(c.length&&S(c[0])){const F=c.map(_).filter(Boolean);return F.length?[F]:[]}return c.length&&Array.isArray(c[0])&&Array.isArray(c[0][0])&&S(c[0][0][0])?c.flatMap(z=>Array.isArray(z)?z:[]).map(z=>Array.isArray(z)?z.map(_).filter(Boolean):[]).filter(z=>z.length):c.length&&Array.isArray(c[0])&&S(c[0][0])?c.map(z=>Array.isArray(z)?z.map(_).filter(Boolean):[]).filter(z=>z.length):[]}function Oe(){if(!A||!L.value)return;ge&&A.hasLayer(ge)&&(A.removeLayer(ge),ge=null);const c=ce({id:"global-bounds",bounds:s.bounds??B.value,style:{}});c&&(ge=c,ge.addTo(A))}function Re(){!A||!L.value||R.value.forEach(c=>{const p=q[c];p&&(p.visible?(p.layer||(p.layer=ue(p.config)),p.boundsLayer||(p.boundsLayer=ce(p.config)),p.layer&&!A.hasLayer(p.layer)&&p.layer.addTo(A),p.boundsLayer&&!A.hasLayer(p.boundsLayer)&&p.boundsLayer.addTo(A)):(p.layer&&A.hasLayer(p.layer)&&A.removeLayer(p.layer),p.boundsLayer&&A.hasLayer(p.boundsLayer)&&A.removeLayer(p.boundsLayer),oe(p.id)))})}function wt(c){if(d.value)return;const p=q[c];p&&(p.visible=!p.visible,p.visible?(p.layer||(p.layer=ue(p.config)),p.boundsLayer||(p.boundsLayer=ce(p.config)),p.layer&&!A.hasLayer(p.layer)&&p.layer.addTo(A),p.boundsLayer&&!A.hasLayer(p.boundsLayer)&&p.boundsLayer.addTo(A)):(p.layer&&A.hasLayer(p.layer)&&A.removeLayer(p.layer),p.boundsLayer&&A.hasLayer(p.boundsLayer)&&A.removeLayer(p.boundsLayer),oe(p.id)))}e.watch(()=>s.layers,c=>{const p=Array.isArray(c)?c:[],_=[],S=new Set;p.forEach((F,z)=>{if(!F)return;const X=tt(F,z);_.push(X),S.add(X);const W=q[X],le={...F,id:X},re=W?.visible??!!le?.visible;W&&(W.layer&&A?.hasLayer(W.layer)&&A.removeLayer(W.layer),W.boundsLayer&&A?.hasLayer(W.boundsLayer)&&A.removeLayer(W.boundsLayer),oe(X)),q[X]={id:X,config:le,visible:re,layer:null,boundsLayer:null}}),Object.keys(q).forEach(F=>{if(!S.has(F)){const z=q[F];z?.layer&&A?.hasLayer(z.layer)&&A.removeLayer(z.layer),z?.boundsLayer&&A?.hasLayer(z.boundsLayer)&&A.removeLayer(z.boundsLayer),oe(F),delete q[F]}}),R.value=_,Re()},{immediate:!0,deep:!0}),e.watch(()=>s.bounds,()=>{A&&(Object.values(q).forEach(c=>{c.boundsLayer&&A.hasLayer(c.boundsLayer)&&A.removeLayer(c.boundsLayer),c.boundsLayer=null}),Oe(),Re())},{deep:!0}),e.watch(()=>s.katottg,async c=>{if(B.value=[],!c){Oe();return}try{const p=await fetch(`https://data.gki.com.ua/api-user/atu/${c}`);if(!p?.ok)return;const S=(await p.json())?.geometry?.coordinates;Array.isArray(S)&&S.length&&(B.value=S)}catch(p){console.error("Failed to fetch KATOTTG bounds",p)}finally{Oe(),Re()}},{immediate:!0}),e.watch(()=>s.modelValue,c=>{if(!A||!de){V.value=c;return}lt(c)},{deep:!0});function xt(c){const p=L.value;return c instanceof p.Circle?"Circle":c instanceof p.Rectangle?"Rectangle":c instanceof p.Polygon&&!(c instanceof p.Rectangle)?"Polygon":c instanceof p.Polyline&&!(c instanceof p.Polygon)?"Polyline":c instanceof p.Marker?"Point":"Feature"}function nt(c){const p=L.value;if(c instanceof p.Circle){const _=c.getRadius();return Math.PI*(_*_)/1e6}if(c instanceof p.Polygon||c instanceof p.Rectangle)try{const _=c.getLatLngs();if(!Array.isArray(_)||!_.length)return null;if(!Array.isArray(_[0])){const X=p.GeometryUtil?.geodesicArea?p.GeometryUtil.geodesicArea(_):0;return X?Math.abs(X)/1e6:0}const S=_[0];if(S.length>0&&(S[0]instanceof p.LatLng||typeof S[0]?.lat=="number")){const{feature:X}=c;if(X?.geometry?.type==="MultiPolygon"){const re=_.reduce((we,at)=>{if(!Array.isArray(at)||!at.length)return we;if(p.GeometryUtil?.geodesicArea){const ot=p.GeometryUtil.geodesicArea(at);if(ot)return we+Math.abs(ot)}return we},0);return re?re/1e6:0}const le=p.GeometryUtil?.geodesicArea?p.GeometryUtil.geodesicArea(_):0;return le?Math.abs(le)/1e6:0}const z=_.reduce((X,W)=>{if(!Array.isArray(W)||!W.length)return X;const le=Array.isArray(W[0])?W[0]:W;if(p.GeometryUtil?.geodesicArea){const re=p.GeometryUtil.geodesicArea(le);if(re)return X+Math.abs(re)}return X},0);return z?z/1e6:0}catch{return null}return null}function _t(c){return c instanceof L.value.Circle?c.getLatLng():c.getBounds?c.getBounds().getCenter():c.getLatLng?c.getLatLng():A.getCenter()}function Ae(c){const p=de.toGeoJSON(),_=[],S=[];let F=null;const z=W=>{if(W)switch(W.type){case"Point":F=W;break;case"Polygon":_.push(W.coordinates);break;case"MultiPolygon":_.push(...W.coordinates);break;case"LineString":S.push(W.coordinates);break;case"MultiLineString":S.push(...W.coordinates);break;case"GeometryCollection":(W.geometries||[]).forEach(z);break}};(p?.features||[]).forEach(W=>z(W.geometry));const X=F||(_.length?{type:_.length===1?"Polygon":"MultiPolygon",coordinates:_.length===1?_[0]:_}:S.length?{type:S.length===1?"LineString":"MultiLineString",coordinates:S.length===1?S[0]:S}:null);!c?.silent&&!v&&i("update:modelValue",X),f.value=de.getLayers().length}function lt(c){if(!de||!L.value)return;de.clearLayers();const p=Ys(c);if(!p){N.value=null,f.value=0;return}L.value.geoJSON(p).eachLayer(S=>de.addLayer(S)),v=!0,Ae({silent:!0}),v=!1,Ne();const _=de.getBounds?.();_?.isValid?.()&&A?.fitBounds(_,{padding:[24,24]})}function Ne(){const c=de.getLayers();if(!c.length){N.value=null,f.value=0;return}const p=c[c.length-1],_=xt(p),S=_t(p),F=de.toGeoJSON(),z=F?.features?.some(re=>re.geometry?.type==="MultiPolygon")||F?.geometry?.type==="MultiPolygon",X=c.length>1&&c.every(re=>re instanceof L.value.Polygon||re instanceof L.value.Rectangle),W=z||X;let le=null;if(W){const re=c.reduce((we,at)=>{const ot=nt(at);return we+(ot?ot*1e6:0)},0);le=re?re/1e6:0}else le=nt(p);N.value={type:_,center:S,areaKm2:le,layer:p},f.value=c.length}const Ve=e.ref("");function Fe(c){if(d.value||!A||!L.value)return;be?.disable&&be.disable();const p=L.value;switch(c){case"marker":be=new p.Draw.Marker(A);break;case"polyline":be=new p.Draw.Polyline(A);break;case"polygon":be=new p.Draw.Polygon(A);break;case"rectangle":be=new p.Draw.Rectangle(A);break}be.enable(),Ve.value=c}function Et(){if(d.value)return;const c=N.value?.layer;c&&(c.getBounds?A.fitBounds(c.getBounds(),{padding:[30,30]}):c.getLatLng&&A.setView(c.getLatLng(),Math.max(g.value,14)))}function Vt(){d.value||de&&(de.clearLayers(),i("update:modelValue",null),N.value=null,f.value=0)}const Bt=e.ref(null);function Kt(){d.value||Bt.value?.click()}function Yt(c){if(d.value)return;const p=c.target,_=p.files?.[0];if(!_)return;const S=new FileReader;S.onload=()=>{try{const F=JSON.parse(String(S.result));de.clearLayers(),F&&L.value.geoJSON(F).eachLayer(z=>de.addLayer(z)),Ae(),Ne()}finally{p.value=""}},S.readAsText(_)}function Wt(){if(d.value)return;const c=de.toGeoJSON(),p=new Blob([JSON.stringify(c,null,2)],{type:"application/json"}),_=URL.createObjectURL(p),S=document.createElement("a");S.href=_,S.download="data.geojson",S.click(),URL.revokeObjectURL(_)}function vt(c){!A||!L.value||!P[c]||(pe&&A.removeLayer(pe),pe=L.value.tileLayer(P[c].url,{maxZoom:19,minZoom:6,pane:st}).addTo(A),ae.value=c)}function C(c){if(!A||!L.value)return;const p=L.value.latLng(c[0],c[1]);A.setView(p,13)}let $=null;return e.onMounted(async()=>{L.value=await Ie();const c=L.value;c.drawLocal=hs,A=c.map(m.value,{zoomControl:!1,scrollWheelZoom:!1}).setView(w.value,g.value),c.control.zoom({position:"bottomright"}).addTo(A);const p=ae.value||Object.keys(P)[0];A.createPane(st),A.getPane(st).style.zIndex="180",A.createPane(it),A.getPane(it).style.zIndex="220",p&&P[p]&&(ae.value=p,pe=c.tileLayer(P[p].url,{maxZoom:19,minZoom:6,pane:st}).addTo(A)),de=new c.FeatureGroup().addTo(A),A.on(c.Draw.Event.CREATED,S=>{if(d.value)return;const{layer:F}=S;de.clearLayers(),de.addLayer(F),Ae(),Ne(),Ve.value=""}),A.on(c.Draw.Event.EDITED,()=>{d.value||(Ae(),Ne())}),A.on(c.Draw.Event.DELETED,()=>{d.value||(Ae(),Ne())});let _=!1;A.on("mousemove",S=>{_||(A.invalidateSize(),_=!0)}),A.on("zoomend",()=>{g.value=A.getZoom()}),$=et(),Re(),Oe(),V.value!==void 0&&(lt(V.value),V.value=void 0)}),e.watch(()=>s.center,c=>{!Array.isArray(c)||c.length!==2||(w.value=[...c],A&&A.setView(w.value,A.getZoom()))},{deep:!0}),e.watch(()=>s.zoom,c=>{typeof c=="number"&&(g.value=c,A&&A.setZoom(c))}),e.onUnmounted(()=>{$?.(),oe(),ge&&A?.hasLayer(ge)&&(A.removeLayer(ge),ge=null),A?.remove&&A.remove()}),e.watch(u,()=>{setTimeout(()=>{A?.invalidateSize&&A.invalidateSize()},50)}),e.watch(b,async c=>{if(!c||!x.value){k.value=null;return}await e.nextTick();const p=x.value.getBoundingClientRect();k.value={top:p.bottom+6,left:p.left}}),(c,p)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body",disabled:!u.value},[e.createElementVNode("div",{class:e.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:u.value}])},[e.createElementVNode("div",{ref_key:"mapContainer",ref:m,class:"w-full h-full"},null,512),e.createVNode(e.Transition,{name:"zoom-instructions","enter-active-class":"transition-all duration-200 ease-out","leave-active-class":"transition-all duration-500 ease-in","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:e.withCtx(()=>[h.value&&s.handleZoom?(e.openBlock(),e.createElementBlock("div",Ws,[e.createElementVNode("div",Zs,[e.createElementVNode("p",Js,e.toDisplayString(E.value),1)])])):e.createCommentVNode("",!0)]),_:1}),j.value.search||j.value.import||j.value.export?(e.openBlock(),e.createElementBlock("div",Xs,[j.value.search?(e.openBlock(),e.createBlock(Ps,{key:0,onGoToCoordinates:C})):e.createCommentVNode("",!0),j.value.import||j.value.export?(e.openBlock(),e.createElementBlock("div",Qs,[e.createElementVNode("div",ei,[j.value.import?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:Kt,disabled:d.value}," Import ",8,ti)):e.createCommentVNode("",!0),j.value.export?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:Wt,disabled:d.value||f.value===0}," Export ",8,ni)):e.createCommentVNode("",!0)]),e.createElementVNode("input",{ref_key:"importRef",ref:Bt,type:"file",onChange:Yt,accept:".json,.geojson",class:"hidden",disabled:d.value},null,40,li)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),Z.value.length?(e.openBlock(),e.createElementBlock("div",{key:1,class:"absolute z-[1500] pointer-events-none",style:e.normalizeStyle(O.value)},[e.createElementVNode("div",ai,[e.createElementVNode("dl",oi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Z.value,_=>(e.openBlock(),e.createElementBlock("div",{key:`${_.key}-${_.value}`,class:"flex justify-between gap-2"},[e.createElementVNode("dt",ri,e.toDisplayString(_.key),1),e.createElementVNode("dd",si,e.toDisplayString(_.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),e.createElementVNode("div",ii,[e.createElementVNode("div",di,[j.value.point?(e.openBlock(),e.createElementBlock("button",{key:0,class:e.normalizeClass(["vs-btn",{"vs-active":Ve.value==="marker"}]),title:"Point",onClick:p[0]||(p[0]=_=>Fe("marker")),disabled:d.value},[e.createVNode(ks)],10,ci)):e.createCommentVNode("",!0),j.value.line?(e.openBlock(),e.createElementBlock("button",{key:1,class:e.normalizeClass(["vs-btn",{"vs-active":Ve.value==="polyline"}]),title:"Line",onClick:p[1]||(p[1]=_=>Fe("polyline")),disabled:d.value},[e.createVNode(_s)],10,ui)):e.createCommentVNode("",!0),j.value.polygon?(e.openBlock(),e.createElementBlock("button",{key:2,class:e.normalizeClass(["vs-btn",{"vs-active":Ve.value==="polygon"}]),title:"Polygon",onClick:p[2]||(p[2]=_=>Fe("polygon")),disabled:d.value},[e.createVNode(vs)],10,pi)):e.createCommentVNode("",!0),j.value.rectangle?(e.openBlock(),e.createElementBlock("button",{key:3,class:e.normalizeClass(["vs-btn",{"vs-active":Ve.value==="rectangle"}]),title:"Rectangle",onClick:p[3]||(p[3]=_=>Fe("rectangle")),disabled:d.value},[e.createVNode(Ms)],10,mi)):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"vs-btn mt-5",onClick:p[4]||(p[4]=_=>u.value=!u.value),title:"Full Screen"},[e.createVNode(Fs,{style:{width:"12px",height:"12px"}})])])]),e.createElementVNode("div",{class:e.normalizeClass(["absolute left-4 z-[1000]",N.value?"bottom-8":"bottom-4"])},[e.createElementVNode("div",hi,[e.createVNode(Ks,{basemaps:e.unref(P),onOnLayerChange:vt},null,8,["basemaps"]),K.value.length?(e.openBlock(),e.createElementBlock("div",fi,[p[9]||(p[9]=e.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),e.createElementVNode("div",gi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(K.value,_=>(e.openBlock(),e.createElementBlock("label",{key:_.id,class:"flex items-center gap-2 cursor-pointer select-none"},[e.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:_.visible,disabled:d.value,onChange:S=>wt(_.id)},null,40,yi),e.createElementVNode("span",ki,e.toDisplayString(_.config.title||_.config.name||_.id),1)]))),128))])])):e.createCommentVNode("",!0)])],2),e.createElementVNode("div",bi,[N.value?(e.openBlock(),e.createElementBlock("div",wi,[e.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:p[5]||(p[5]=_=>b.value=!0),onMouseleave:p[6]||(p[6]=_=>b.value=!1)},[e.createElementVNode("div",xi,[p[10]||(p[10]=e.createTextVNode(" Type: ",-1)),e.createElementVNode("span",_i,e.toDisplayString(N.value.type),1)]),y.value?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"addressEl",ref:x,class:"text-gray-500 text-xs truncate cursor-help",style:{"max-width":"260px"}}," Address: "+e.toDisplayString(y.value),513)):e.createCommentVNode("",!0),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[b.value&&y.value&&k.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"fixed z-[99999] pointer-events-none bg-gray-800 text-white text-xs px-2 py-1 rounded shadow whitespace-nowrap",style:e.normalizeStyle({top:k.value.top+"px",left:k.value.left+"px"})},e.toDisplayString(y.value),5)):e.createCommentVNode("",!0)]))],32),e.createElementVNode("div",Ei,[e.createElementVNode("div",Vi,[p[11]||(p[11]=e.createTextVNode(" Center: ",-1)),e.createElementVNode("b",null,e.toDisplayString(N.value.center.lat.toFixed(5))+", "+e.toDisplayString(N.value.center.lng.toFixed(5)),1)]),N.value.areaKm2!==null?(e.openBlock(),e.createElementBlock("div",Bi,[p[12]||(p[12]=e.createTextVNode(" Area: ",-1)),e.createElementVNode("b",null,e.toDisplayString(N.value.areaKm2.toFixed(1))+" km²",1)])):(e.openBlock(),e.createElementBlock("div",vi,p[13]||(p[13]=[e.createTextVNode("Area: ",-1),e.createElementVNode("b",null,"—",-1)]))),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:p[7]||(p[7]=_=>Et()),disabled:d.value},p[14]||(p[14]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"w-3 h-3"},[e.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),e.createElementVNode("path",{d:"M7 10l6 0"}),e.createElementVNode("path",{d:"M10 7l0 6"}),e.createElementVNode("path",{d:"M21 21l-6 -6"})],-1)]),8,Ci),e.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Delete feature",onClick:p[8]||(p[8]=_=>Vt()),disabled:d.value},[e.createVNode(je,{class:"w-3 h-3"})],8,Ni)])])):e.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-28dc067b"]]),Si=["data-focus"],Mi={class:"flex items-center"},$i={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},Di=["onClick","aria-label"],Ai={key:0,class:"absolute text-gray-500 truncate pl-2"},Fi={class:"flex-1 min-w-[2px]"},Li=["placeholder"],Ti={class:"flex items-center shrink-0"},Ii=["disabled"],mn=e.defineComponent({__name:"vs-input-tag",props:e.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=t;ye(n.style);const o=e.ref(null),r=e.ref(null),s=e.ref(null),i=e.ref(!1),d=e.ref(""),u=e.useModel(l,"modelValue"),m=e.computed(()=>n.placeholder||"Add tag…"),h=e.computed(()=>u.value?.length===0&&d.value===""),E=e.computed(()=>!n.disabled&&u.value?.length>0),y=e.computed(()=>n.disabled),N=async()=>{y.value||await e.nextTick(()=>s.value?.focus())},b=V=>{const v=V.trim();v!==""&&(!u.value||!Array.isArray(u.value)?u.value=[v]:n.unique?u.value.includes(v)||(u.value=[...u.value,v]):u.value=[...u.value,v],d.value="")},k=()=>{const V=d.value;V.trim()!==""&&b(V),d.value=""},x=V=>{const v=u.value.slice();v.splice(V,1),a("update:modelValue",v)},f=()=>{a("update:modelValue",[])},w=()=>{y.value||(i.value=!0)},g=()=>{i.value=!1,!y.value&&k()},B=V=>{const{key:v}=V;v==="Enter"?(V.preventDefault(),k()):v==="Backspace"&&d.value===""&&u.value.length>0&&x(u.value.length-1)};return(V,v)=>(e.openBlock(),e.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:v[1]||(v[1]=e.withModifiers(()=>{},["stop"]))},[e.createElementVNode("div",{class:e.normalizeClass(["relative w-full font-sans",n.customClass]),role:"group","aria-label":"Tag input"},[e.createElementVNode("div",{class:e.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",i.value?"border-blue-500 ring-1 ring-blue-500":"",y.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:N},[e.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:r},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(L,j)=>(e.openBlock(),e.createElementBlock("div",{key:j,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[e.createElementVNode("div",Mi,[e.createElementVNode("div",$i,e.toDisplayString(L),1)]),e.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:e.withModifiers(q=>x(j),["stop"]),"aria-label":`Remove ${L}`},v[2]||(v[2]=[e.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,Di)]))),128)),h.value?(e.openBlock(),e.createElementBlock("div",Ai,e.toDisplayString(m.value),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Fi,[y.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"inputRef",ref:s,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":v[0]||(v[0]=L=>d.value=L),onFocus:w,onBlur:g,onKeydown:B,placeholder:u.value&&u.value.length?"":void 0},null,40,Li)),[[e.vModelText,d.value]])])],512),e.createElementVNode("div",Ti,[E.value?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:y.value,onClick:e.withModifiers(f,["stop"])},v[3]||(v[3]=[e.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[e.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,Ii)):e.createCommentVNode("",!0)])],10,Si)],2)],512))}}),Oi={class:"relative flex gap-1 bg-white w-full"},Ri=["disabled","placeholder"],hn=J(e.defineComponent({__name:"vs-input-slug",props:e.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=e.inject("values"),n=l,a=e.useModel(l,"modelValue");function o(s){const i={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ы:"y",э:"e",ю:"yu",я:"ya",ь:"",ъ:"",є:"ye",і:"i",ї:"yi",ґ:"g"};return s.toLowerCase().split("").map(d=>i[d]||d).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const r=()=>{const s=t?.value?.[n.parent||""]?.toString(),i=o(s);a.value=i.toString()};return(s,i)=>(e.openBlock(),e.createElementBlock("div",Oi,[e.withDirectives(e.createElementVNode("input",{ref:"vsText",disabled:s.disabled,placeholder:s.placeholder,"onUpdate:modelValue":i[0]||(i[0]=d=>a.value=d),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,Ri),[[e.vModelText,a.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:r}," Gen ")]))}}),[["__scopeId","data-v-b0eba370"]]),zi={class:"relative flex gap-1 bg-white w-full"},ji=["disabled","placeholder"],Pi=["disabled"],Ui={key:0},Hi={key:1},fn=J(e.defineComponent({__name:"vs-input-codegen",props:e.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref(!1),o=e.computed(()=>t.init!==!1),r=e.computed(()=>!!t.table&&!!t.code),s=()=>{if(!r.value)return"";const u=encodeURIComponent(String(t.table)),m=encodeURIComponent(String(t.code));return`/api/code-gen/${u}/${m}`},i=async()=>{if(!r.value||a.value)return;const u=s();if(u){a.value=!0;try{const h=await(await fetch(u)).text();n.value=h}finally{a.value=!1}}},d=()=>{o.value&&(n.value||i())};return e.onMounted(()=>{d()}),e.watch(()=>[t.table,t.code,t.init],()=>{d()}),(u,m)=>(e.openBlock(),e.createElementBlock("div",zi,[e.withDirectives(e.createElementVNode("input",{disabled:u.disabled,placeholder:u.placeholder,"onUpdate:modelValue":m[0]||(m[0]=h=>n.value=h),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,ji),[[e.vModelText,n.value]]),e.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:a.value||u.disabled||!r.value,onClick:i},[a.value?(e.openBlock(),e.createElementBlock("span",Hi,"...")):(e.openBlock(),e.createElementBlock("span",Ui,"Gen"))],8,Pi)]))}}),[["__scopeId","data-v-6ee5237d"]]),qi={class:"w-full"},Gi={ref:"sortableContainer",class:"flex flex-col gap-1"},Ki=["onDragstart","onDrop"],Yi={class:"w-1/3"},Wi={class:"w-2/3"},Zi=["onClick"],Ji={key:0,class:"text-[14px] text-gray-700"},Xi={class:"mt-2 w-full flex items-center"},Qi=["disabled"],gn=J(e.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=k=>`${k}-${Math.random().toString(36).substring(2,15)}`,a=e.inject("values"),o=l,r=t,s=o.addButtonText??"Додати",i=o.ignore??[],d=e.ref([]),u=e.ref(null);(()=>{const k=o.parent&&a?.value?.[o.parent]||o.modelValue||{};d.value=Object.entries(k).filter(([x])=>!i.includes(x)).map(([x,f])=>({id:n("key-value-"),key:x,value:f}))})();function h(k){u.value=k}function E(k){if(u.value===null||u.value===k)return;const x=d.value.splice(u.value,1)[0];d.value.splice(k,0,x),u.value=null}const y=e.computed(()=>d.value.some(k=>k.key&&!k.value||!k.key&&k.value)),N=()=>{d.value.push({id:n("key-value-"),key:"",value:""})},b=k=>{d.value=d.value.filter(x=>x.id!==k)};return e.watch(d,k=>{const x={};k.forEach(w=>{w.key&&w.value!==void 0&&(x[w.key]=w.value)});const f={};i.length&&i.forEach(w=>{f[w]=o.parent?a?.value?.[o.parent]?.[w]:void 0}),a?.value&&o.parent&&(a.value[o.parent]={...f,...x}),r("update:modelValue",x)},{deep:!0}),(k,x)=>(e.openBlock(),e.createElementBlock("div",qi,[e.createElementVNode("div",Gi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(f,w)=>(e.openBlock(),e.createElementBlock("div",{key:f.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":u.value===w}]),draggable:"true",onDragstart:g=>h(w),onDragover:x[0]||(x[0]=e.withModifiers(()=>{},["prevent"])),onDrop:g=>E(w)},[x[1]||(x[1]=e.createStaticVNode('<button class="cursor-move" data-v-a0f7fbfc><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-a0f7fbfc><circle cx="15" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="18" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="18" r="1.5" data-v-a0f7fbfc></circle></svg></button>',1)),e.createElementVNode("div",Yi,[e.createVNode(ze,{modelValue:f.key,"onUpdate:modelValue":g=>f.key=g,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("div",Wi,[e.createVNode(ze,{modelValue:f.value,"onUpdate:modelValue":g=>f.value=g,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),e.createElementVNode("button",{onClick:g=>b(f.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[e.createVNode(e.unref(Nt),{height:"16",width:"16"})],8,Zi)],42,Ki))),128))],512),d.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",Ji," Дані для відображення відсутні ")),e.createElementVNode("div",Xi,[e.createElementVNode("button",{type:"button",onClick:N,disabled:y.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(Se,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(e.unref(s)),1)],8,Qi)])]))}}),[["__scopeId","data-v-a0f7fbfc"]]),ed={class:"w-full"},td={ref:"sortableContainer",class:"flex flex-col gap-1"},nd=["onDragstart","onDrop"],ld=["disabled"],ad={class:"flex-1"},od=["onClick","disabled"],rd={key:0,class:"text-[14px] text-gray-700"},sd={class:"mt-2 w-full flex items-center"},id=["disabled"],yn=J(e.defineComponent({__name:"vs-input-text-array",props:e.mergeModels({addButtonText:{default:"Додати"},inputType:{default:"text"},placeholder:{default:"Значення"},mask:{default:""},disabled:{type:Boolean,default:!1}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.ref(null),r=e.computed(()=>!!t.disabled),s=e.computed(()=>t.placeholder??""),i=e.computed(()=>t.addButtonText??"Додати");let d=!1;const u=k=>`${k}-${Math.random().toString(36).substring(2,15)}`,m=k=>{const x=k??n.value??[];a.value=x.map((f,w)=>({id:a.value[w]?.id??u("text-array"),value:f??""}))};m(),e.watch(()=>n.value,k=>{if(d){d=!1;return}m(k||[])},{deep:!0}),e.watch(a,k=>{d=!0,n.value=k.map(x=>x.value).filter(x=>x!=null&&x!=="")},{deep:!0});const h=e.computed(()=>r.value||a.value.some(k=>!k.value));function E(){h.value||(a.value=[...a.value,{id:u("text-array"),value:""}])}function y(k){r.value||(a.value=a.value.filter(x=>x.id!==k))}function N(k){r.value||(o.value=k)}function b(k){if(r.value||o.value===null||o.value===k)return;const x=[...a.value],[f]=x.splice(o.value,1);x.splice(k,0,f),a.value=x,o.value=null}return(k,x)=>(e.openBlock(),e.createElementBlock("div",ed,[e.createElementVNode("div",td,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(f,w)=>(e.openBlock(),e.createElementBlock("div",{key:f.id,class:e.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":o.value===w}]),draggable:"true",onDragstart:g=>N(w),onDragover:x[0]||(x[0]=e.withModifiers(()=>{},["prevent"])),onDrop:g=>b(w)},[e.createElementVNode("button",{class:"cursor-move",type:"button",disabled:r.value},x[1]||(x[1]=[e.createStaticVNode('<svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-66316a33><circle cx="15" cy="12" r="1.5" data-v-66316a33></circle><circle cx="15" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="12" r="1.5" data-v-66316a33></circle><circle cx="21" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="18" r="1.5" data-v-66316a33></circle><circle cx="15" cy="18" r="1.5" data-v-66316a33></circle></svg>',1)]),8,ld),e.createElementVNode("div",ad,[k.inputType==="text"?(e.openBlock(),e.createBlock(ze,{key:0,modelValue:f.value,"onUpdate:modelValue":g=>f.value=g,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),k.inputType==="tel"?(e.openBlock(),e.createBlock(At,{key:1,modelValue:f.value,"onUpdate:modelValue":g=>f.value=g,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),k.inputType==="email"?(e.openBlock(),e.createBlock(Dt,{key:2,modelValue:f.value,"onUpdate:modelValue":g=>f.value=g,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):e.createCommentVNode("",!0),k.inputType==="mask"?(e.openBlock(),e.createBlock($t,{key:3,modelValue:f.value,"onUpdate:modelValue":g=>f.value=g,mask:k.mask,disabled:r.value,placeholder:s.value},null,8,["modelValue","onUpdate:modelValue","mask","disabled","placeholder"])):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:g=>y(f.id),disabled:r.value,class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200 disabled:opacity-50"},[e.createVNode(e.unref(Nt),{height:"16",width:"16"})],8,od)],42,nd))),128))],512),a.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("span",rd," Дані для відображення відсутні ")),e.createElementVNode("div",sd,[e.createElementVNode("button",{type:"button",onClick:E,disabled:h.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[e.createVNode(Se,{height:"14",width:"14"}),e.createTextVNode(" "+e.toDisplayString(i.value),1)],8,id)])]))}}),[["__scopeId","data-v-66316a33"]]),dd={class:"flex items-center gap-2 w-full"},cd=["disabled"],ud=["disabled"],kn=e.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,{inputClass:a}=ye(n.style),o=t,r=e.computed({get:()=>n.modelValue||"#000000",set:i=>o("update:modelValue",i)}),s=e.computed(()=>!!n.disabled);return(i,d)=>(e.openBlock(),e.createElementBlock("div",dd,[e.withDirectives(e.createElementVNode("input",{type:"color","onUpdate:modelValue":d[0]||(d[0]=u=>r.value=u),disabled:s.value,ref:"color",class:e.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[i.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,cd),[[e.vModelText,r.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":d[1]||(d[1]=u=>r.value=u),disabled:s.value},null,8,ud),[[e.vModelText,r.value]])]))}}),pd={class:"flex items-center gap-2 w-full"},md=["min","max","step","disabled"],hd=["disabled"],bn=e.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,{inputClass:a}=ye(n.style),o=t,r=e.computed({get:()=>Number(n.modelValue??n.min),set:i=>o("update:modelValue",Number(i))}),s=e.computed(()=>!!n.disabled);return(i,d)=>(e.openBlock(),e.createElementBlock("div",pd,[e.withDirectives(e.createElementVNode("input",{type:"range","onUpdate:modelValue":d[0]||(d[0]=u=>r.value=u),min:i.min,max:i.max,step:i.step,disabled:s.value,ref:"range",class:e.normalizeClass(["w-full cursor-pointer accent-blue-500",[i.modelValue?"":"text-opacity-50",e.unref(a)].join(" ")])},null,10,md),[[e.vModelText,r.value]]),e.withDirectives(e.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":d[1]||(d[1]=u=>r.value=u),disabled:s.value},null,8,hd),[[e.vModelText,r.value]])]))}}),fd=["placeholder","disabled","name"],gd=["type","value","onInput","placeholder","disabled"],yd=["onClick"],wn=e.defineComponent({__name:"vs-input-array",props:e.mergeModels({count:{default:1},limit:{default:1},mask:{default:""},unmask:{type:Boolean,default:!1},inputType:{default:"text"},isAdded:{type:Boolean,default:!1},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.ref(t.count),a=e.computed(()=>t.limit),{inputClass:o}=ye(t.style),r=e.useModel(l,"modelValue"),s=e.computed(()=>!!t.disabled),i=e.computed(()=>t.placeholder??"");e.watchEffect(()=>{const b=r.value?.length??0;b<n.value&&(r.value=[...r.value??[],...Array(n.value-b)])});const d=e.ref({}),u=e.ref({});function m(b,k){b&&(d.value[k]=b)}async function h(b,k){if(!b||t.inputType!=="mask")return;const{default:x}=await Promise.resolve().then(()=>Gt);u.value[k]&&u.value[k].destroy(),u.value[k]=x(b,{mask:t.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),u.value[k].on("accept",()=>{const f=[...r.value||[]];f[k]=t.unmask?u.value[k].unmaskedValue:u.value[k].value,r.value=f}),u.value[k].on("complete",()=>{const f=[...r.value||[]];f[k]=t.unmask?u.value[k].unmaskedValue:u.value[k].value,r.value=f}),r.value?.[k]&&(u.value[k].value=r.value[k])}function E(b,k){if(s.value)return;const x=b.target.value??null,f=[...r.value];f[k]=t.inputType==="text"?x:Number(x),r.value=f}function y(){n.value+=1;const b=t.inputType==="text"||t.inputType==="mask"?null:0;r.value=[...r.value,b],t.inputType==="mask"&&setTimeout(()=>{const k=n.value-1;d.value[k]&&h(d.value[k],k)},0)}function N(b){if(n.value>1){u.value[b]&&(u.value[b].destroy(),delete u.value[b]),n.value-=1,r.value=r.value.filter((x,f)=>f!==b);const k={};Object.keys(u.value).forEach(x=>{const f=parseInt(x,10);f>b?k[f-1]=u.value[f]:f<b&&(k[f]=u.value[f])}),u.value=k}}return e.onMounted(()=>{if(t.inputType==="mask")for(let b=0;b<n.value;b+=1)d.value[b]&&h(d.value[b],b)}),e.onBeforeUnmount(()=>{Object.values(u.value).forEach(b=>{b&&b.destroy()})}),e.watch(()=>t.mask,b=>{t.inputType==="mask"&&Object.values(u.value).forEach(k=>{k&&k.updateOptions({mask:b,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})})}),e.watch(r,b=>{t.inputType==="mask"&&b&&b.forEach((k,x)=>{u.value[x]&&u.value[x].value!==k&&(u.value[x].value=k||"")})},{deep:!0}),(b,k)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["grid gap-2",`grid-cols-${a.value}`])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,x=>(e.openBlock(),e.createElementBlock("div",{key:x,class:"flex items-center gap-2 w-full"},[b.inputType==="mask"?(e.openBlock(),e.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:f=>m(f,x-1),placeholder:b.placeholder,disabled:b.disabled,name:`${b.name}[${x-1}]`,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":b.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,fd)):(e.openBlock(),e.createElementBlock("input",{key:1,type:b.inputType,value:r.value?.[x-1],onInput:f=>E(f,x-1),placeholder:i.value,disabled:s.value,class:e.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[e.unref(o),{"!border-red-600":b.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,gd)),!b.disabled&&x===n.value&&b.isAdded?(e.openBlock(),e.createElementBlock("button",{key:2,type:"button",onClick:e.withModifiers(y,["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-green-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(Se,{height:"18",width:"18"})])):e.createCommentVNode("",!0),!b.disabled&&n.value>1&&b.isAdded?(e.openBlock(),e.createElementBlock("button",{key:3,type:"button",onClick:e.withModifiers(f=>N(x-1),["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-red-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[e.createVNode(Nt,{height:"18",width:"18"})],8,yd)):e.createCommentVNode("",!0)]))),128))],2))}}),kd={class:"flex items-center gap-2 w-full"},bd={class:"relative flex-1"},wd=["placeholder","disabled","onKeydown"],xd=["disabled"],_d={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},Ed={key:1,class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},Vd={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},Bd={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},vd={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},Cd=["onClick"],Nd={key:0,class:"p-4 text-sm text-gray-500"},xn=e.defineComponent({__name:"vs-input-address",props:e.mergeModels({api:{default:""},geom:{default:""},includes:{default:()=>[]},bbox:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:e.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(l,{emit:t}){const n=/{{\s*([^}]+?)\s*}}/g,a=l,o=t,{inputClass:r}=ye(a.style),s=e.useModel(l,"modelValue"),i=e.computed({get:()=>s.value,set:V=>{s.value=V}}),d=e.ref(!1),u=e.ref([]),m=e.ref(!1),h=e.computed(()=>a.placeholder??""),E=e.computed(()=>!!a.disabled),y=V=>{if(!V)return null;if(Array.isArray(V))return V;if(typeof V=="string"){const v=V.split(",").map(L=>L.trim()).filter(Boolean);return v.length!==4?null:v.map(Number)}return null},N=e.computed(()=>{const V=y(a.bbox);if(!V||V.length!==4)return null;const v=V.map(Number);return v.some(L=>Number.isNaN(L))?null:v}),b=e.computed(()=>{const V=N.value;if(!V)return"";const[v,L,j,q]=V;return`${v},${Math.max(L,q)},${j},${Math.min(L,q)}`});e.computed(()=>b.value?"1":"0");const k=e.inject("values");function x(){!E.value&&i.value.trim()&&f()}async function f(){const V=(i.value||"").trim();if(!V)return;let v=V;if(a.includes?.length&&k?.value){const j=a.includes.map(q=>k.value?.[q]).filter(Boolean);j.length&&(v=`${j.join(", ")}, ${V}`)}const L=B(v);if(L){d.value=!0;try{const q=await(await fetch(L)).json();u.value=Array.isArray(q)?q:[],m.value=!0}catch(j){console.error("Address search error:",j)}finally{d.value=!1}}}function w(){m.value=!m.value}function g(V){if(!V)return;m.value=!1;const v=parseFloat(V.lat),j={type:"Point",coordinates:[parseFloat(V.lon),v]};a.geom&&k?.value&&(k.value[a.geom]=j),o("update:geom",j)}function B(V){if(!a.api)return"";const v={value:encodeURIComponent(V),bbox:b.value};return a.api.replace(n,(L,j)=>v[j.trim()]??"")}return(V,v)=>(e.openBlock(),e.createElementBlock("div",kd,[e.createElementVNode("div",bd,[e.withDirectives(e.createElementVNode("input",{type:"text","onUpdate:modelValue":v[0]||(v[0]=L=>i.value=L),placeholder:h.value,disabled:E.value,class:e.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[e.unref(r),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:e.withKeys(e.withModifiers(x,["prevent"]),["enter"])},null,42,wd),[[e.vModelText,i.value]]),u.value.length?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:w,title:"Show search results"},v[2]||(v[2]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),e.createElementVNode("path",{d:"M12 16v-4"}),e.createElementVNode("path",{d:"M12 8h.01"})],-1)]))):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",onClick:f,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:d.value||!i.value?.trim()},[d.value?(e.openBlock(),e.createElementBlock("svg",Ed,v[4]||(v[4]=[e.createElementVNode("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e.createElementVNode("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)]))):(e.openBlock(),e.createElementBlock("svg",_d,v[3]||(v[3]=[e.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),e.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},null,-1)])))],8,xd),(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[m.value?(e.openBlock(),e.createElementBlock("div",Vd,[e.createElementVNode("div",Bd,[e.createElementVNode("div",vd,[v[6]||(v[6]=e.createElementVNode("span",null,"Search results",-1)),e.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:v[1]||(v[1]=L=>m.value=!1),title:"Close"},v[5]||(v[5]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)]))]),e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(L,j)=>(e.openBlock(),e.createElementBlock("li",{key:j,onClick:q=>g(L),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},e.toDisplayString(L.display_name),9,Cd))),128))]),u.value.length?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Nd," No results found "))])])):e.createCommentVNode("",!0)]))]))}}),_n=(l="")=>`${l}${Math.floor(Math.random()*1e4)}`,Sd={class:"vs-datalist space-y-3"},Md={class:"space-y-3"},$d=["onClick","disabled"],Dd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},Ad=["disabled"],Fd=J(e.defineComponent({__name:"vs-input-datalist",props:e.mergeModels({schema:{default:()=>[]},minItems:{default:0},maxItems:{default:void 0},addButtonText:{default:"Додати позицію"},emptyLabel:{default:"Немає рядків"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.computed(()=>Array.isArray(n.value)?n.value:[]),o=e.ref([]),r=e.computed(()=>t.schema?.map(b=>({...b,disabled:t.disabled||b.disabled}))??[]),s=e.computed(()=>r.value.map(b=>N(b))),i=e.computed(()=>t.disabled?!1:t.maxItems?a.value.length<t.maxItems:!0),d=e.computed(()=>t.disabled||a.value.length<=(t.minItems||0));e.watch(()=>a.value.length,()=>{u(),m()},{immediate:!0}),e.watch(()=>t.schema,m,{immediate:!0,deep:!0});function u(){const b=a.value.length;o.value.length<b?o.value=[...o.value,...Array.from({length:b-o.value.length},()=>_n())]:o.value.length>b&&o.value.splice(b)}function m(){if(!t.minItems||a.value.length>=t.minItems)return;const b=t.minItems-a.value.length,k=Array.from({length:b},h);n.value=[...a.value,...k]}function h(){const b={};return r.value.forEach(k=>{b[k.name]=k?.default??null}),b}function E(){i.value&&(n.value=[...a.value,h()],u())}function y(b){d.value||(n.value=a.value.filter((k,x)=>x!==b),u(),m())}function N(b){return{...b}}return(b,k)=>(e.openBlock(),e.createElementBlock("div",Sd,[e.createElementVNode("div",Md,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(x,f)=>(e.openBlock(),e.createElementBlock("div",{key:o.value[f],class:"flex items-center gap-3"},[e.createVNode(Me,{schema:s.value,layout:"inline",navigation:!1,values:a.value[f],"onUpdate:values":w=>a.value[f]=w,"form-id":o.value[f]},null,8,["schema","values","onUpdate:values","form-id"]),e.createElementVNode("button",{type:"button",class:"h-[38px] w-[38px] flex items-center justify-center text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",onClick:w=>y(f),disabled:d.value},[e.createVNode(je,{class:"w-5 h-5"})],8,$d)]))),128)),a.value.length===0?(e.openBlock(),e.createElementBlock("div",Dd,e.toDisplayString(t.emptyLabel),1)):e.createCommentVNode("",!0)]),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:E,disabled:!i.value},[e.createVNode(Se,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,Ad)]))}}),[["__scopeId","data-v-e8a02c8e"]]),Ld={};function Td(l,t){return e.openBlock(),e.createElementBlock("svg",e.mergeProps({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},l.$attrs),t[0]||(t[0]=[e.createElementVNode("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"},null,-1),e.createElementVNode("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"},null,-1)]),16)}const Id=J(Ld,[["render",Td]]),Od={class:"vs-dataform space-y-4"},Rd={class:"flex items-center justify-between mb-3"},zd={class:"text-sm font-medium text-gray-700"},jd={class:"flex items-center gap-2"},Pd=["title","onClick","disabled"],Ud=["title","onClick","disabled"],Hd={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},qd=["disabled"],En={VsInputText:ze,VsInputRadio:Ft,"vs-input-text":ze,"vs-input-password":yl,"vs-input-textarea":dn,"vs-input-mask":$t,"vs-input-number":Jt,"vs-input-radio":Ft,"vs-input-select":Lt,"vs-input-switcher":St,"vs-input-static":Mt,"vs-input-container":sn,"vs-input-date":pa,"vs-input-checkbox":Xt,"vs-input-file":an,"vs-input-html":Mt,"vs-input-email":Dt,"vs-input-tel":At,"vs-input-datatable":un,"vs-input-map":pn,"vs-input-file-list":on,"vs-input-tags":mn,"vs-input-slug":hn,"vs-input-codegen":fn,"vs-input-key-value":gn,"vs-input-text[]":yn,"vs-input-range":bn,"vs-input-color":kn,"vs-input-native-select":Lt,"vs-input-array":wn,"vs-input-address":xn,"vs-input-datalist":Fd,"vs-input-dataform":J(e.defineComponent({__name:"vs-input-dataform",props:e.mergeModels({schema:{default:()=>[]},minGroups:{default:0},maxGroups:{default:void 0},addButtonText:{default:"Додати групу фільтрів"},groupLabel:{default:"Якщо поле"},duplicateTitle:{default:"Дублювати групу"},removeTitle:{default:"Видалити групу"},emptyLabel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(l){const t=l,n=e.useModel(l,"modelValue"),a=e.ref([]),o=e.computed(()=>t.groupLabel),r=e.computed(()=>t.emptyLabel??"Ще немає груп"),s=e.computed(()=>t.schema?.map(x=>({...x,disabled:t.disabled||x.disabled}))??[]),i=e.computed(()=>s.value.map(x=>k(x))),d=e.computed(()=>t.disabled?!1:t.maxGroups?n.value.length<t.maxGroups:!0),u=e.computed(()=>t.disabled||n.value.length<=(t.minGroups||0));e.watch(()=>n.value.length,()=>{m(),h()},{immediate:!0}),e.watch(()=>t.schema,h,{immediate:!0,deep:!0});function m(){const x=n.value.length;a.value.length<x?a.value=[...a.value,...Array.from({length:x-a.value.length},()=>_n())]:a.value.length>x&&a.value.splice(x)}function h(){if(!t.minGroups||n.value.length>=t.minGroups)return;const x=t.minGroups-n.value.length,f=Array.from({length:x},E);n.value=[...n.value,...f]}function E(){const x={};return s.value.forEach(f=>{x[f.name]=f?.default??null}),x}function y(){d.value&&(n.value=[...n.value,E()],m())}function N(x){u.value||(n.value=n.value.filter((f,w)=>w!==x),m(),h())}function b(x){if(t.disabled)return;const f=JSON.parse(JSON.stringify(n.value[x]??{}));n.value=[...n.value.slice(0,x+1),f,...n.value.slice(x+1)],m()}function k(x){return{...x}}return(x,f)=>(e.openBlock(),e.createElementBlock("div",Od,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.value,(w,g)=>(e.openBlock(),e.createElementBlock("div",{key:a.value[g],class:"relative border border-gray-200 rounded-lg p-6 bg-white"},[e.createElementVNode("div",Rd,[e.createElementVNode("div",zd,e.toDisplayString(o.value),1),e.createElementVNode("div",jd,[e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.duplicateTitle,onClick:B=>b(g),disabled:t.disabled},[e.createVNode(Id,{class:"w-5 h-5"})],8,Pd),e.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:t.removeTitle,onClick:B=>N(g),disabled:u.value},[e.createVNode(je,{class:"w-5 h-5"})],8,Ud)])]),e.createVNode(Me,{class:"vs-dataform__form",schema:i.value,layout:"inline",navigation:!1,values:n.value[g],"onUpdate:values":B=>n.value[g]=B,"form-id":a.value[g],disabled:t.disabled},null,8,["schema","values","onUpdate:values","form-id","disabled"])]))),128)),n.value.length===0?(e.openBlock(),e.createElementBlock("div",Hd,e.toDisplayString(r.value),1)):e.createCommentVNode("",!0),e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:y,disabled:!d.value},[e.createVNode(Se,{class:"w-5 h-5"}),e.createTextVNode(" "+e.toDisplayString(t.addButtonText),1)],8,qd)]))}}),[["__scopeId","data-v-4dc5a1a3"]])},Gd=e.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{},auto:{type:Boolean}},setup(l){const t=l,n=e.inject("values");async function a(){try{if(!t.api)return;const o=t.api.replace("{{value}}",t.value),r=await fetch(o);if(!r.ok){se.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const s=await r.json();if(!t.set||!n)return;for(const[i,d]of Object.entries(t.set))n.value[i]=s.result[d]}catch(o){console.error(t.error,o)}}return e.watch(()=>t.value,(o,r)=>{(t.auto||!t.button)&&o!=null&&o!==r&&a()},{immediate:!1}),(o,r)=>(e.openBlock(),e.createElementBlock("button",{onClick:a,class:"vs-button relative inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-blue-500 hover:border-blue-500 hover:bg-blue-500 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 ml-0 md:ml-2 mt-2 md:mt-0 py-[8px] md:w-2/4 whitespace-nowrap w-full"},e.toDisplayString(o.button),1))}}),Kd={class:"flex flex-col gap-1 w-full"},Yd=["innerHTML"],Vn=e.defineComponent({__name:"vs-compact-form-layout",props:e.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]},columns:{default:()=>({container:12,label:3})}},{modelValue:{default:null},modelModifiers:{}}),emits:e.mergeModels(["value-selected"],["update:modelValue"]),setup(l,{emit:t}){const n=l,a=e.useModel(l,"modelValue"),o=t,r=e.computed(()=>fl[`${n.layout}`]),s=["label","placeholder","info","description","text","html"],i=e.ref(x()),d=e.computed(()=>N(n.item,i.value)),u=e.computed(()=>En?.[`vs-input-${n.item.type}`]),m=e.inject("field-props"),h=e.computed(()=>{const w=e.unref(u);if(!w)return new Set;const g=w.props??w.__vccOpts?.props;if(!g)return new Set;const B=Array.isArray(g)?g:Object.keys(g);return new Set(B)}),E=e.computed(()=>{const w={...d.value??{}},g=n.item?.name;g&&m?.value?.[g]&&Object.assign(w,m.value[g]);const B=h.value;return B.size?Object.fromEntries(Object.entries(w).filter(([V])=>B.has(V))):{}}),y=w=>{const g=typeof w=="object"&&w!==null?w:{value:w};o("value-selected",{...g,name:g.name??n.item?.name})};e.onMounted(()=>{i.value=x(),window.addEventListener("storage",f)}),e.onUnmounted(()=>{window.removeEventListener("storage",f)});function N(w,g){if(!w)return{};const B={...w};return s.forEach(V=>{const v=k(w,V,g);v!=null&&(B[V]=v)}),Array.isArray(w.options)&&(B.options=w.options.map(V=>b(V,g))),B}function b(w,g){if(!w)return w;const B={...w},V=k(w,"label",g),v=k(w,"text",g);return V!=null&&(B.label=V),v!=null?B.text=v:V!=null&&(B.text=V),B}function k(w,g,B){const V=`${g}:${B}`;if(w?.[V]!=null)return w[V];if(g==="label"&&w?.[B]!=null)return w[B];if(w?.[g]!=null)return w[g];if(g==="label"){if(w?.ua!=null)return w.ua;if(w?.en!=null)return w.en}if(g==="text"||g==="html"){if(w?.ua!=null)return w.ua;if(w?.en!=null)return w.en}return null}function x(){return typeof window>"u"?"uk":localStorage.getItem("locale")||"uk"}function f(){i.value=x()}return(w,g)=>(e.openBlock(),e.createBlock(e.resolveDynamicComponent(r.value),{ua:d.value.ua,error:n.error||"",item:d.value,columns:n.columns,label:d.value.label},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["flex w-full",`${n.item.type}-component`])},[e.createElementVNode("div",Kd,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u.value),e.mergeProps(E.value,{modelValue:a.value,"onUpdate:modelValue":g[0]||(g[0]=B=>a.value=B),onValueSelected:y}),null,16,["modelValue"])),d.value.description&&n.layout!=="settings"?(e.openBlock(),e.createElementBlock("p",{key:0,class:"text-sm text-gray-500",innerHTML:d.value.description},null,8,Yd)):e.createCommentVNode("",!0)]),d.value.behavior?.set?(e.openBlock(),e.createBlock(Gd,e.mergeProps({key:0},d.value.behavior,{value:a.value,auto:!!d.value.behavior?.set}),null,16,["value","auto"])):e.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),Wd={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},Zd={class:"vs-compact-form-navigation__rail mt-[6px]"},Jd=["onClick"],Xd=J(e.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(l,{expose:t}){const n=l,a=e.ref([]),o=e.ref(""),r=e.ref(""),s=e.computed(()=>!!n.enabled),i=e.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),d=e.computed(()=>{const R=n.width;if(R==null)return{};const K=typeof R=="number"?`${R}px`:`${R}`;return{width:K,minWidth:K}});let u=null,m=0,h=0,E=null,y=null,N=null;const b=()=>j(),k=()=>f();e.watch(()=>n.target,async R=>{if(V(),!R){E=null,a.value=[],o.value="";return}E=R,s.value&&(await e.nextTick(),B(R),f())},{immediate:!0}),e.watch(()=>n.scrollContainer,R=>{if(!s.value){y=R??null;return}x(R??null),e.nextTick(()=>f())},{immediate:!0}),e.onMounted(()=>{n.scrollContainer||x(null),f()}),e.onBeforeUnmount(()=>{V(),x(null,!0),E=null,typeof window<"u"&&(m&&window.cancelAnimationFrame(m),h&&window.cancelAnimationFrame(h))});function x(R,K=!1){if(N&&(N(),N=null),K){y=null;return}if(y=R??null,typeof window>"u")return;const G=R??window,Z=window;G.addEventListener("scroll",b,{passive:!0}),Z.addEventListener("resize",k),N=()=>{G.removeEventListener("scroll",b),Z.removeEventListener("resize",k)}}function f(){if(!s.value||!E)return;m&&typeof window<"u"&&window.cancelAnimationFrame(m);const R=()=>{w(),m=0};typeof window>"u"?R():m=window.requestAnimationFrame(R)}function w(){if(!s.value||!E)return;const R=Array.from(E.querySelectorAll("h1, h2")),K=new Set,G=[];R.forEach((Z,O)=>{const D=Z.textContent?.trim()??"";if(!D)return;let U=(Z.getAttribute("id")??"").trim();U||(U=g(D)||`heading-${O+1}`);let P=U,ie=1;for(;K.has(P);)P=`${U}-${ie+=1}`;Z.id!==P&&Object.assign(Z,{id:P}),K.add(P),G.push({id:P,text:D,level:Z.tagName.toLowerCase()==="h1"?1:2})}),a.value=G,G.length||(o.value=""),L()}function g(R){return R.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function B(R){!R||!s.value||typeof MutationObserver>"u"||(V(),u=new MutationObserver(()=>f()),u.observe(R,{childList:!0,subtree:!0}))}function V(){u&&(u.disconnect(),u=null)}function v(R){const K=y;if(!K)return typeof window>"u"?R.offsetTop:R.getBoundingClientRect().top+window.scrollY;const G=R.getBoundingClientRect(),Z=K.getBoundingClientRect();return G.top-Z.top+K.scrollTop}function L(){if(!s.value||!a.value.length)return;const R=y,K=(R?R.scrollTop:null)||(typeof window<"u"?window.scrollY:0),G=(R?R.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),Z=K+G;let O=null;for(let U=0;U<a.value.length;U+=1){const P=a.value[U],ie=document.getElementById(P.id);if(ie){const ae=v(ie);ae+ie.offsetHeight>K&&ae<Z&&(O=P.id)}}!O&&r.value&&(O=r.value),O&&(r.value=O);const D=R?R.scrollHeight-R.clientHeight:document.documentElement.scrollHeight-window.innerHeight;K+5>=D&&(O=a.value[a.value.length-1].id),O&&(o.value=O)}function j(){s.value&&(h&&window.cancelAnimationFrame(h),h=window.requestAnimationFrame(()=>{L(),h=0}))}function q(R){if(!s.value)return;const K=document.getElementById(R);if(!K)return;const G=y,Z=Math.max(0,v(K));G?G.scrollTo({top:Z,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:Z,behavior:"smooth"})}return t({refresh:f}),(R,K)=>s.value&&a.value.length?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(i.value),style:e.normalizeStyle(d.value)},[e.createElementVNode("h2",Wd,e.toDisplayString(R.title),1),e.createElementVNode("div",Zd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,G=>(e.openBlock(),e.createElementBlock("div",{key:G.id,class:e.normalizeClass(["vs-compact-form-navigation__item relative",G.level===2?"vs-compact-form-navigation__item--nested":"",G.id===o.value?"vs-compact-form-navigation__item--active":""])},[e.createElementVNode("button",{type:"button",onClick:Z=>q(G.id),class:e.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",G.level===2?"pl-[15px]":"pl-[18px]",G.id===o.value?"text-gray-800":"text-gray-500"])},[e.createElementVNode("span",null,e.toDisplayString(G.text),1)],10,Jd)],2))),128))])],6)):e.createCommentVNode("",!0)}}),[["__scopeId","data-v-1584a562"]]),Le={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон",minlength:l=>`Мінімальна довжина — ${l} символів`,maxlength:l=>`Максимальна довжина — ${l} символів`},Qd=l=>typeof l=="string"?l.trim()?!1:Le.required:Array.isArray(l)?l.map(n=>typeof n=="string"?n.trim():n).filter(n=>n!=null&&n!=="").length?!1:Le.required:l?!1:Le.required,ec=l=>{const t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return l?t.test(l)?!1:Le.email:!1},tc=l=>{const t=/^\+[1-9]\d{1,14}$/;return l?t.test(l)?!1:Le.tel:!1},Bn=l=>l==null?0:typeof l=="string"?l.trim().length:Array.isArray(l)?l.length:typeof l=="number"?l.toString().length:String(l).length,nc=(l,t)=>{if(l==null)return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Bn(l)<n?t?.message||Le.minlength(n):!1},lc=(l,t)=>{if(l==null||l==="")return!1;const n=Number(t?.value??t?.length);return Number.isFinite(n)&&Bn(l)>n?t?.message||Le.maxlength(n):!1},ac=(l,t)=>{const n=t.pattern??t.regexp,a=typeof n=="string"?new RegExp(n):n;if(Array.isArray(l)){const o=l.filter(Boolean);return o.length===0||o.every(r=>a.test(r))?!1:t.message}return!a.test(l)&&l?t.message:!1},oc=(l,t)=>!1,rc=(l,t)=>{switch(typeof t=="string"?t:t.type){case"required":return Qd(l);case"email":return ec(l);case"tel":return tc(l);case"regexp":return ac(l,t);case"minlength":return nc(l,t);case"maxlength":return lc(l,t);case"custom":return oc();default:return!1}},sc={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function vn(l){const t=l?.toLowerCase();return sc[t]||t}function Tt(l,t=!1){if(Array.isArray(l)){const a=[];return l.forEach(o=>{const r={...o};r.name=(o.name||o.id||o.key||"").toString(),r.type=vn(o.type),r.label=o.label||o.ua,r.rules=o.rules||o.validators,r.type==="email"&&!r.rules&&(r.rules=["email"]),o.data&&(r.api=`/api/suggest/${o.data}`),r.disabled=r.disabled||t,Array.isArray(r.schema)&&(r.schema=Tt(r.schema,r.disabled)),a.push(r)}),a}const n=[];return Object.entries(l).forEach(a=>{const o={name:a[0],...a[1],type:vn(a[1].type),label:a[1].label||a[1].ua,rules:a[1].rules||a[1].validators,disabled:a[1].disabled||t};o.type==="email"&&!o.rules&&(o.rules=["email"]),a[1].type?.includes("list")&&(o.multiple=!0),!o.api&&a[1].data&&(o.api=`/api/suggest/${a[1].data}`),Array.isArray(o.schema)&&(o.schema=Tt(o.schema,o.disabled)),n.push(o)}),n}function ic(l,t,n=!1){const a=e.computed(()=>Tt((Array.isArray(t),t),typeof n=="boolean"?n:n.value)),o=e.ref({});function r(u){const m=u?.conditions;if(!m)return!0;const h=Array.isArray(m)?m[0]:m,E=l?.value?.[h];return rn(E,m)}const s=(u=a.value,m=!0)=>(u.forEach(h=>{const E=[],y=Number(h?.minlength),N=Number(h?.maxlength);!Number.isNaN(y)&&Number.isFinite(y)&&E.push({type:"minlength",value:y}),!Number.isNaN(N)&&Number.isFinite(N)&&E.push({type:"maxlength",value:N});const b=[...E,...h.rules||[]];if(b.length){if(!r(h)){delete o.value[h.name];return}let k=!1,x=null;b.forEach(f=>{const w=rc(l.value[h.name],f);w&&(k=!0,!x&&typeof w=="string"&&(x=w))}),k&&x?o.value[h.name]=x:delete o.value[h.name]}h.schema&&s(h.schema,!1)}),m&&Object.values(o.value).some(Boolean)?o.value:null),i=e.computed(()=>a.value?.filter(u=>u.hidden!==!0&&r(u)));return{errors:o,validate:s,reset:()=>{l.value={},o.value={}},visibleSchema:i}}const dc={class:"flex w-full h-full min-h-0 gap-6"},cc={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},Me=e.defineComponent({__name:"vs-compact-form",props:e.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},modelValue:{default:()=>({})},modelModifiers:{},values:{default:void 0},valuesModifiers:{}}),emits:e.mergeModels(["handle-submit","update:modelValue","value-selected"],["update:form","update:modelValue","update:values"]),setup(l,{expose:t,emit:n}){const a=n,o=l,r=e.useModel(l,"form"),s=e.useModel(l,"modelValue"),i=e.useModel(l,"values"),d=e.computed({get:()=>i.value??s.value,set:K=>{s.value=K,i.value=K}}),{errors:u,validate:m,reset:h,visibleSchema:E}=ic(d,o.schema,e.toRef(o,"disabled")),y=e.ref(null),N=e.ref(null),b=e.ref({}),k=e.computed(()=>o.navigation),x=e.computed(()=>o.navWidth),f=e.computed(()=>o.style?.columns),w=Object.freeze({container:12,label:3}),g=e.computed(()=>o.columns??f.value??w),B=e.computed(()=>o.columns!=null||f.value!=null),V=e.computed(()=>B.value?"horizontal":o.layout),v=K=>K?.columns?"horizontal":V.value,L=K=>K?.columns??g.value,j=()=>{a("update:modelValue",d.value),m(),a("handle-submit",d.value)},q=K=>{a("value-selected",K)};t({validate:m,reset:h,errors:u}),e.onMounted(()=>{r.value={value:d.value,errors:u.value,reset:h,validate:m,formId:o.formId}});function R(K,G){if(K===G)return!0;if(typeof K!="object"||typeof G!="object"||!K||!G)return!1;const Z=Object.keys(K),O=Object.keys(G);return Z.length!==O.length?!1:Z.every(D=>K[D]===G[D])}return e.provide("form",r),e.provide("values",d),e.provide("field-props",b),(K,G)=>(e.openBlock(),e.createElementBlock("div",dc,[e.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:N},[e.createElementVNode("form",{ref_key:"formRef",ref:y,onSubmit:e.withModifiers(j,["prevent"]),class:e.normalizeClass(["grid grid-cols-12 p-1",V.value==="default"?"gap-6":"gap-4"])},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(E),(Z,O)=>(e.openBlock(),e.createElementBlock("div",{key:Z.name,class:e.normalizeClass(v(Z)==="horizontal"?"col-span-12":`col-span-${Z.col||12}`)},[e.createVNode(Vn,{style:e.normalizeStyle(K.style),item:Z,layout:v(Z),columns:L(Z),"model-value":d.value[Z.name],"onUpdate:modelValue":D=>{const U=d.value[Z.name];R(U,D)||(d.value[Z.name]=D)},error:e.unref(u)[Z.name],onValueSelected:q},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),v(Z)==="settings"&&O+1!==e.unref(E).length?(e.openBlock(),e.createElementBlock("div",cc)):e.createCommentVNode("",!0)],2))),128))],34)],512),e.createVNode(Xd,{target:y.value,"scroll-container":N.value,enabled:k.value,width:x.value},null,8,["target","scroll-container","enabled","width"])]))}}),uc={class:"relative"},pc={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},mc={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"},hc={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},fc={class:"font-medium text-gray-800 dark:text-[#ffffff]"},gc={class:"p-4 mim-h-0 h-full overflow-auto"},Cn=e.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(l,{emit:t}){const n=l,a=t,o=e.ref(n.schema),r=e.ref(n.defaultValue?JSON.parse(JSON.stringify(n.defaultValue)):{}),s=e.ref({}),i=e.ref(n.token||""),d=e.ref(n.mode);async function u(){const h=s.value.validate();if(h){se.notify({type:"warning",title:"Помилка валідації",message:Object.entries(h).map(([E,y])=>`${E}: ${y}`).join(`
|
|
3
|
-
`)});return}if(i.value)try{const E=await fetch(`/api/table/${i.value}`,{method:d.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(r.value)});if(E.ok)await E.json(),se.notify({type:"success",title:"Успішно",message:`Дані успішно ${d.value==="add"?"збережено":"оновлено"}`}),a("save",r.value);else if(E.status===400){const y=await E.json().catch(()=>({}));se.notify({type:"warning",title:"Помилка валідації",message:y.message||"Некоректні дані (400)"})}else E.status===500?se.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):se.notify({type:"error",title:"Помилка",message:`Статус: ${E.status}`})}catch(E){se.notify({type:"error",title:"Помилка з’єднання",message:E.message||"Не вдалося виконати запит"})}else a("edit",r.value),m()}function m(){a("close")}return e.onMounted(async()=>{try{if(n.form&&!n.schema){const h=await fetch(`/api/template/form/${n.form}`);if(!h.ok){se.notify({type:h.status>=400&&h.status<500?"warning":"error",title:"Error",message:`Error code: ${h.status}`});return}const E=await h.json();o.value=E.schema,i.value=E.token}else if(n.token&&!n.defaultValue){i.value=n.token;const h=await fetch(`/api/form/${i.value}`);if(!h.ok){se.notify({type:h.status>=400&&h.status<500?"warning":"error",title:"Error",message:`Error code: ${h.status}`});return}const E=await h.json();o.value=E.schema,E.data?r.value=E.data:d.value="add",E.obj&&(r.value={...r.value,...E.obj})}}catch(h){se.notify({type:"error",title:"Error",message:h.message||"Unexpected error"}),console.error(h)}}),(h,E)=>(e.openBlock(),e.createElementBlock("div",uc,[e.createElementVNode("div",pc,[e.createElementVNode("div",mc,[e.createElementVNode("div",hc,[e.createElementVNode("h3",fc,e.toDisplayString(d.value==="add"?"Додати":"Змінити"),1),e.createElementVNode("button",{onClick:m,type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600"},E[2]||(E[2]=[e.createElementVNode("span",{class:"sr-only"},"Close",-1),e.createElementVNode("svg",{class:"flex-shrink-0 w-4 h-4",xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[e.createElementVNode("path",{d:"M18 6 6 18"}),e.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),e.createElementVNode("div",gc,[o.value?(e.openBlock(),e.createBlock(Me,{key:0,schema:o.value,values:r.value,"onUpdate:values":E[0]||(E[0]=y=>r.value=y),form:s.value,"onUpdate:form":E[1]||(E[1]=y=>s.value=y)},null,8,["schema","values","form"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:"vs-form__head mr-5 mb-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},[e.createElementVNode("button",{type:"button",onClick:m,class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),e.createElementVNode("button",{onClick:u,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])])])]))}}),yc=1440*60*1e3,kc=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],bc=["січ","лют","бер","квіт","трав","черв","лип","серп","вер","жовт","лист","груд"],wc=["нд","пн","вт","ср","чт","пт","сб"];function me(l){return l instanceof Date&&!Number.isNaN(l.getTime())}const Pe=l=>new Date(l.getTime());function Te(l){const t=Pe(l);return t.setHours(0,0,0,0),t}function Ge(l){const t=Pe(l);return t.setHours(23,59,59,999),t}function It(l){return Te(new Date(l.getFullYear(),l.getMonth(),1))}function Ot(l){return Ge(new Date(l.getFullYear(),l.getMonth()+1,0))}function Rt(l,t){const n=new Date(l),a=n.getDate();n.setDate(1),n.setMonth(n.getMonth()+t);const o=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();return n.setDate(Math.min(a,o)),n}function xc(l,t){return Rt(l,-1)}function dt(l,t){const n=new Date(l);return n.setFullYear(n.getFullYear()+t),n}function Nn(l,t){return dt(l,-t)}function Sn(l){return Te(new Date(l.getFullYear(),0,1))}function Mn(l){return Ge(new Date(l.getFullYear(),11,31))}function _c(l){const t=Math.floor(l.getFullYear()/10)*10;return Te(new Date(t,0,1))}function Ec(l){const t=Math.floor(l.getFullYear()/10)*10+9;return Ge(new Date(t,11,31))}const _e=l=>l.getFullYear(),ct=l=>Math.floor(l.getFullYear()/10)*10;function Vc(l){const t=[];let n=Te(l.start);const a=Te(l.end);for(;n<=a;)t.push(Pe(n)),n=new Date(n.getTime()+yc);return t}function Bc(l){const t=[];let n=It(l.start);const a=Ot(l.end);for(;n<=a;)t.push(Pe(n)),n=Rt(n,1);return t}function vc(l){const t=[];let n=Sn(l.start);const a=Mn(l.end);for(;n<=a;)t.push(Pe(n)),n=dt(n,1);return t}function zt(l,t=1){const n=Te(l),a=(n.getDay()-t+7)%7;return n.setDate(n.getDate()-a),n}function Cc(l,t=1){const n=zt(l,t);return n.setDate(n.getDate()+6),Ge(n)}function Nc(l,t,n=0){const a=zt(l,n),o=(t-n+7)%7;return a.setDate(a.getDate()+o),a}const ut=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth()&&l.getDate()===t.getDate(),jt=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear()&&l.getMonth()===t.getMonth(),$n=(l,t)=>!!l&&!!t&&l.getFullYear()===t.getFullYear(),Dn=(l,t)=>!!l&&!!t&&ut(l,t)&&l.getHours()===t.getHours(),Sc=(l,t)=>!!l&&!!t&&Dn(l,t)&&l.getMinutes()===t.getMinutes();function Mc(l,t){const n=l.getTime();return n>=t.start.getTime()&&n<=t.end.getTime()}const Ke=(l,t)=>!!l&&!!t&&l.getTime()<t.getTime(),Ye=(l,t)=>!!l&&!!t&&l.getTime()>t.getTime();function $c(l){const t=l.filter(n=>me(n));if(t.length)return t.reduce((n,a)=>n.getTime()>=a.getTime()?n:a)}function Dc(l){const t=l.filter(n=>me(n));if(t.length)return t.reduce((n,a)=>n.getTime()<=a.getTime()?n:a)}function An(l,t){const n=Pe(l);return typeof t.year=="number"&&n.setFullYear(t.year),typeof t.month=="number"&&n.setMonth(t.month),typeof t.date=="number"&&n.setDate(t.date),typeof t.hours=="number"&&n.setHours(t.hours),typeof t.minutes=="number"&&n.setMinutes(t.minutes),typeof t.seconds=="number"&&n.setSeconds(t.seconds),typeof t.milliseconds=="number"&&n.setMilliseconds(t.milliseconds),n}const pt=(l,t=2)=>String(l).padStart(t,"0");function Fn(l,t){return t==="wide"?kc[l]:bc[l]}function Ac(l){return wc[l]}const Fc=[{token:"LLLL",format:l=>Fn(l.getMonth(),"wide")},{token:"LLL",format:l=>Fn(l.getMonth(),"abbreviated")},{token:"EE",format:l=>Ac(l.getDay())},{token:"yyyy",format:l=>String(l.getFullYear())},{token:"MM",format:l=>pt(l.getMonth()+1)},{token:"dd",format:l=>pt(l.getDate())},{token:"HH",format:l=>pt(l.getHours())},{token:"mm",format:l=>pt(l.getMinutes())}];function mt(l,t){if(!me(l))return"";let n="",a=0;for(;a<t.length;){const o=Fc.find(r=>t.startsWith(r.token,a));o?(n+=o.format(l),a+=o.token.length):(n+=t[a],a+=1)}return n}const Lc={"yyyy-MM-dd":/^(\d{4})-(\d{2})-(\d{2})$/,"dd.MM.yyyy":/^(\d{2})\.(\d{2})\.(\d{4})$/,"dd.MM.yyyy HH:mm":/^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2})$/,"HH:mm":/^(\d{2}):(\d{2})$/,"MM.yyyy":/^(\d{2})\.(\d{4})$/,yyyy:/^(\d{4})$/};function Ln(l,t){const n=Lc[t];if(!n){const o=new Date(l);return me(o)?o:null}const a=l.match(n);if(!a)return null;switch(t){case"yyyy-MM-dd":{const[,o,r,s]=a,i=new Date(Number(o),Number(r)-1,Number(s));return me(i)?i:null}case"dd.MM.yyyy":{const[,o,r,s]=a,i=new Date(Number(s),Number(r)-1,Number(o));return me(i)?i:null}case"dd.MM.yyyy HH:mm":{const[,o,r,s,i,d]=a,u=new Date(Number(s),Number(r)-1,Number(o),Number(i),Number(d));return me(u)?u:null}case"HH:mm":{const[,o,r]=a,s=new Date;return s.setHours(Number(o),Number(r),0,0),s}case"MM.yyyy":{const[,o,r]=a;return new Date(Number(r),Number(o)-1,1)}case"yyyy":{const[,o]=a;return new Date(Number(o),0,1)}default:return null}}const Tc=["year","month","day","time","custom"],Ic=e.defineComponent({emits:{elementClick:l=>me(l),left:()=>!0,right:()=>!0,heading:()=>!0},props:{headingClickable:{type:Boolean,default:!1},leftDisabled:{type:Boolean,default:!1},rightDisabled:{type:Boolean,default:!1},columnCount:{type:Number,default:7},items:{type:Array,default:()=>[]},viewMode:{type:String,required:!0,validate:l=>typeof l=="string"&&Tc.includes(l)}}}),Oc={class:"v3dp__heading"},Rc=["disabled"],zc=["disabled"],jc={class:"v3dp__body"},Pc={class:"v3dp__subheading"},Uc={class:"v3dp__elements"},Hc=["disabled","onClick"];function qc(l,t,n,a,o,r){return e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["v3dp__popout",`v3dp__popout-${l.viewMode}`]),style:e.normalizeStyle({"--popout-column-definition":`repeat(${l.columnCount}, 1fr)`}),onMousedown:t[3]||(t[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",Oc,[e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__left",disabled:l.leftDisabled,onClick:t[0]||(t[0]=e.withModifiers(s=>l.$emit("left"),["stop","prevent"]))},[e.renderSlot(l.$slots,"arrow-left",{},()=>[t[4]||(t[4]=e.createElementVNode("svg",{class:"v3dp__heading__icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 8"},[e.createElementVNode("g",{fill:"none","fill-rule":"evenodd"},[e.createElementVNode("path",{stroke:"none",d:"M-9 16V-8h24v24z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 0L1 4l4 4"})])],-1))],!0)],8,Rc),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l.headingClickable?"button":"span"),{class:"v3dp__heading__center",onClick:t[1]||(t[1]=e.withModifiers(s=>l.$emit("heading"),["stop","prevent"]))},{default:e.withCtx(()=>[e.renderSlot(l.$slots,"heading",{},void 0,!0)]),_:3})),e.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__right",disabled:l.rightDisabled,onClick:t[2]||(t[2]=e.withModifiers(s=>l.$emit("right"),["stop","prevent"]))},[e.renderSlot(l.$slots,"arrow-right",{},()=>[t[5]||(t[5]=e.createElementVNode("svg",{class:"v3dp__heading__icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 8"},[e.createElementVNode("g",{fill:"none","fill-rule":"evenodd"},[e.createElementVNode("path",{stroke:"none",d:"M15-8v24H-9V-8z"}),e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M1 8l4-4-4-4"})])],-1))],!0)],8,zc)]),e.createElementVNode("div",jc,["subheading"in l.$slots?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",Pc,[e.renderSlot(l.$slots,"subheading",{},void 0,!0)]),t[6]||(t[6]=e.createElementVNode("hr",{class:"v3dp__divider"},null,-1))],64)):e.createCommentVNode("",!0),e.createElementVNode("div",Uc,[e.renderSlot(l.$slots,"body",{},()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.items,s=>(e.openBlock(),e.createElementBlock("button",{key:s.key,disabled:s.disabled,class:e.normalizeClass([{selected:s.selected,current:s.current},`v3dp__element__button__${l.viewMode}`]),onClick:e.withModifiers(i=>l.$emit("elementClick",s.value),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(s.display),1)],10,Hc))),128))],!0)])])],38)}const ht=J(Ic,[["render",qc],["__scopeId","data-v-3b9aea7a"]]),Gc=e.defineComponent({components:{PickerPopup:ht},emits:{"update:pageDate":l=>me(l),select:l=>me(l)},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(l,{emit:t}){const n=e.computed(()=>_c(l.pageDate)),a=e.computed(()=>Ec(l.pageDate)),o=(h,E,y)=>!E&&!y?!0:!(E&&_e(h)<_e(E)||y&&_e(h)>_e(y)),r=e.computed(()=>vc({start:n.value,end:a.value}).map(h=>({value:h,key:String(_e(h)),display:_e(h),selected:!!l.selected&&_e(h)===_e(l.selected),disabled:!o(h,l.lowerLimit,l.upperLimit)}))),s=e.computed(()=>{const h=_e(n.value),E=_e(a.value);return`${h} - ${E}`}),i=e.computed(()=>l.lowerLimit&&(ct(l.lowerLimit)===ct(l.pageDate)||Ke(l.pageDate,l.lowerLimit))),d=e.computed(()=>l.upperLimit&&(ct(l.upperLimit)===ct(l.pageDate)||Ye(l.pageDate,l.upperLimit)));return{years:r,heading:s,leftDisabled:i,rightDisabled:d,previousPage:()=>t("update:pageDate",Nn(l.pageDate,10)),nextPage:()=>t("update:pageDate",dt(l.pageDate,10))}}});function Kc(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{columnCount:3,leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,items:l.years,viewMode:"year",onLeft:l.previousPage,onRight:l.nextPage,onElementClick:t[0]||(t[0]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const Yc=J(Gc,[["render",Kc]]),Wc=e.defineComponent({components:{PickerPopup:ht},emits:{"update:pageDate":l=>me(l),select:l=>me(l),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"LLL"},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(l,{emit:t}){const n=e.computed(()=>Sn(l.pageDate)),a=e.computed(()=>Mn(l.pageDate)),o=e.computed(()=>E=>mt(E,l.format)),r=(E,y,N)=>!y&&!N?!0:!(y&&Ke(E,It(y))||N&&Ye(E,Ot(N))),s=e.computed(()=>Bc({start:n.value,end:a.value}).map(E=>({value:E,display:o.value(E),key:o.value(E),selected:!!l.selected&&jt(l.selected,E),disabled:!r(E,l.lowerLimit,l.upperLimit)}))),i=e.computed(()=>_e(n.value)),d=e.computed(()=>l.lowerLimit&&($n(l.lowerLimit,l.pageDate)||Ke(l.pageDate,l.lowerLimit))),u=e.computed(()=>l.upperLimit&&($n(l.upperLimit,l.pageDate)||Ye(l.pageDate,l.upperLimit)));return{months:s,heading:i,leftDisabled:d,rightDisabled:u,previousPage:()=>t("update:pageDate",Nn(l.pageDate,1)),nextPage:()=>t("update:pageDate",dt(l.pageDate,1))}}});function Zc(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:3,items:l.months,leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,viewMode:"month",onLeft:l.previousPage,onRight:l.nextPage,onHeading:t[0]||(t[0]=i=>l.$emit("back")),onElementClick:t[1]||(t[1]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),_:1},8,["items","leftDisabled","rightDisabled","onLeft","onRight"])}const Jc=J(Wc,[["render",Zc]]),Xc=e.defineComponent({components:{PickerPopup:ht},emits:{"update:pageDate":l=>me(l),select:l=>me(l),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"dd"},headingFormat:{type:String,required:!1,default:"LLLL yyyy"},weekdayFormat:{type:String,required:!1,default:"EE"},weekStartsOn:{type:Number,required:!1,default:1,validator:l=>typeof l=="number"&&Number.isInteger(l)&&l>=0&&l<=6},customWeekdays:{type:Array,required:!1},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1}},setup(l,{emit:t}){const n=e.computed(()=>k=>x=>mt(x,k)),a=e.computed(()=>It(l.pageDate)),o=e.computed(()=>Ot(l.pageDate)),r=e.computed(()=>({start:a.value,end:o.value})),s=e.computed(()=>({start:zt(a.value,l.weekStartsOn),end:Cc(o.value,l.weekStartsOn)})),i=e.computed(()=>l.customWeekdays?.length===7?l.customWeekdays:null),d=e.computed(()=>{const k=l.weekStartsOn,x=i.value;if(x)return Array.from({length:7}).map((w,g)=>x[(k+g)%7]);const f=n.value(l.weekdayFormat);return Array.from(Array(7)).map((w,g)=>(k+g)%7).map(w=>Nc(new Date,w,l.weekStartsOn)).map(f)}),u=(k,x,f,w)=>w?.dates?.some(g=>ut(k,g))||w?.predicate?.(k)?!1:!x&&!f?!0:!(x&&Ke(k,Te(x))||f&&Ye(k,Ge(f))),m=e.computed(()=>{const k=new Date,x=n.value(l.format);return Vc(s.value).map(f=>({value:f,display:x(f),selected:!!l.selected&&ut(l.selected,f),current:ut(k,f),disabled:!l.allowOutsideInterval&&!Mc(f,r.value)||!u(f,l.lowerLimit,l.upperLimit,l.disabledDates),key:n.value("yyyy-MM-dd")(f)}))}),h=e.computed(()=>n.value(l.headingFormat)(l.pageDate)),E=e.computed(()=>l.lowerLimit&&(jt(l.lowerLimit,l.pageDate)||Ke(l.pageDate,l.lowerLimit))),y=e.computed(()=>l.upperLimit&&(jt(l.upperLimit,l.pageDate)||Ye(l.pageDate,l.upperLimit)));return{weekDays:d,days:m,heading:h,leftDisabled:E,rightDisabled:y,previousPage:()=>t("update:pageDate",xc(l.pageDate)),nextPage:()=>t("update:pageDate",Rt(l.pageDate,1))}}});function Qc(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",leftDisabled:l.leftDisabled,rightDisabled:l.rightDisabled,items:l.days,viewMode:"day",onLeft:l.previousPage,onRight:l.nextPage,onHeading:t[0]||(t[0]=i=>l.$emit("back")),onElementClick:t[1]||(t[1]=i=>l.$emit("select",i))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.heading),1)]),subheading:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.weekDays,(i,d)=>(e.openBlock(),e.createElementBlock("span",{key:i,class:e.normalizeClass(`v3dp__subheading__weekday__${d}`)},e.toDisplayString(i),3))),128))]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const eu=J(Xc,[["render",Qc]]);function Tn(l,t){const n=l.getBoundingClientRect(),a={height:l.clientHeight,width:l.clientWidth},o=t.getBoundingClientRect();if(!(o.top>=n.top&&o.bottom<=n.top+a.height)){const s=o.top-n.top,i=o.bottom-n.bottom;Math.abs(s)<Math.abs(i)?l.scrollTop+=s:l.scrollTop+=i}}const tu=e.defineComponent({components:{PickerPopup:ht},emits:{select:l=>me(l),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},visible:{type:Boolean,required:!0},disabledTime:{type:Object,required:!1}},setup(l,{emit:t}){const n=e.ref(null),a=e.ref(null),o=e.computed(()=>l.pageDate??l.selected),r=e.ref(o.value.getHours()),s=e.ref(o.value.getMinutes());e.watch(()=>l.selected,y=>{let N=0,b=0;y&&(N=y.getHours(),b=y.getMinutes()),r.value=N,s.value=b});const i=e.computed(()=>[...Array(24).keys()].map(y=>({value:y,date:An(new Date(o.value.getTime()),{hours:y,minutes:s.value,seconds:0}),selected:r.value===y,ref:e.ref(null)}))),d=e.computed(()=>[...Array(60).keys()].map(y=>({value:y,date:An(new Date(o.value.getTime()),{hours:r.value,minutes:y,seconds:0}),selected:s.value===y,ref:e.ref(null)}))),u=y=>{s.value=y.value,t("select",y.date)},m=()=>{const y=i.value.find(b=>b.ref.value?.classList?.contains("selected")??!1),N=d.value.find(b=>b.ref.value?.classList?.contains("selected")??!1);y&&N&&(Tn(n.value,y.ref.value),Tn(a.value,N.ref.value))};return e.watch(()=>l.visible,y=>{y&&e.nextTick(m)}),{hoursListRef:n,minutesListRef:a,hours:r,minutes:s,hoursList:i,minutesList:d,padStartZero:y=>`0${y}`.substr(-2),selectMinutes:u,isEnabled:y=>!(l.disabledTime?.dates?.some(N=>Dn(y,N)&&Sc(y,N))||l.disabledTime?.predicate?.(y)),scroll:m}}}),nu={ref:"hoursListRef",class:"v3dp__column"},lu=["disabled","onClick"],au={ref:"minutesListRef",class:"v3dp__column"},ou=["disabled","onClick"];function ru(l,t,n,a,o,r){const s=e.resolveComponent("picker-popup");return e.openBlock(),e.createBlock(s,{headingClickable:"",columnCount:2,leftDisabled:!0,rightDisabled:!0,viewMode:"time",onHeading:t[0]||(t[0]=i=>l.$emit("back"))},{heading:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(l.padStartZero(l.hours))+":"+e.toDisplayString(l.padStartZero(l.minutes)),1)]),body:e.withCtx(()=>[e.createElementVNode("div",nu,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.hoursList,i=>(e.openBlock(),e.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:e.normalizeClass([{selected:i.selected},"v3dp__element_button__hour"]),disabled:!l.isEnabled(i.date),onClick:e.withModifiers(d=>l.hours=i.value,["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,lu))),128))],512),e.createElementVNode("div",au,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.minutesList,i=>(e.openBlock(),e.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:e.normalizeClass([{selected:i.selected},"v3dp__element_button__minute"]),disabled:!l.isEnabled(i.date),onClick:e.withModifiers(d=>l.selectMinutes(i),["stop","prevent"])},[e.createElementVNode("span",null,e.toDisplayString(l.padStartZero(i.value)),1)],10,ou))),128))],512)]),_:1})}const su=J(tu,[["render",ru],["__scopeId","data-v-c075af58"]]),ft=["time","day","month","year"],iu=(l,t,n=void 0)=>{let a=n||new Date;const o=$c([l,a]);o&&(a=o);const r=Dc([t,a]);return r&&(a=r),a},du=e.defineComponent({components:{YearPicker:Yc,MonthPicker:Jc,DayPicker:eu,TimePicker:su},inheritAttrs:!1,props:{placeholder:{type:String,default:""},modelValue:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1},disabledTime:{type:Object,required:!1},upperLimit:{type:Date,required:!1},lowerLimit:{type:Date,required:!1},startingView:{type:String,required:!1,default:"day",validate:l=>typeof l=="string"&&ft.includes(l)},startingViewDate:{type:Date,required:!1,default:()=>new Date},dayPickerHeadingFormat:{type:String,required:!1,default:"LLLL yyyy"},monthListFormat:{type:String,required:!1,default:"LLL"},weekdayFormat:{type:String,required:!1,default:"EE"},dayFormat:{type:String,required:!1,default:"dd"},inputFormat:{type:String,required:!1,default:"yyyy-MM-dd"},weekDayNames:{type:Array,required:!1},weekStartsOn:{type:Number,required:!1,default:1,validator:l=>[0,1,2,3,4,5,6].includes(l)},disabled:{type:Boolean,required:!1,default:!1},clearable:{type:Boolean,required:!1,default:!1},typeable:{type:Boolean,required:!1,default:!1},minimumView:{type:String,required:!1,default:"day",validate:l=>typeof l=="string"&&ft.includes(l)}},emits:{"update:modelValue":l=>l==null||me(l),decadePageChanged:l=>!0,yearPageChanged:l=>!0,monthPageChanged:l=>!0,opened:()=>!0,closed:()=>!0},setup(l,{emit:t,attrs:n}){const a=e.ref("none"),o=e.ref(l.startingViewDate),r=e.ref(null),s=e.ref(!1),i=e.ref(""),d=O=>{const D=O.replace(/[a-zA-Z]/g,"0");return/0/.test(D)?D:""},u=e.computed(()=>d(l.inputFormat));let m=null,h=null;const E=()=>{m?.destroy(),m=null},y=async()=>{if(!h){const{default:O}=await Promise.resolve().then(()=>Gt);h=O}return h},N=()=>{m&&m.value!==i.value&&(m.value=i.value??"")},b=async()=>{if(E(),!r.value||!u.value)return;m=(await y())(r.value,{mask:u.value,lazy:!0,overwrite:!0}),N()};e.watchEffect(()=>{if(!i.value)return;const O=Ln(i.value,l.inputFormat);O&&(o.value=O)}),e.watchEffect(()=>{i.value=l.modelValue&&me(l.modelValue)?mt(l.modelValue,l.inputFormat):""}),e.onMounted(()=>{u.value&&e.nextTick(()=>{b()})}),e.onBeforeUnmount(()=>{E()}),e.watch(u,O=>{O?e.nextTick(()=>{b()}):E()}),e.watch(i,()=>{N()});const k=(O="none")=>{l.disabled||(O!=="none"&&a.value==="none"&&(o.value=l.modelValue||iu(l.lowerLimit,l.upperLimit,o.value)),a.value=O,t(O!=="none"?"opened":"closed"))};e.watchEffect(()=>{l.disabled&&(a.value="none")});const x=(O,D)=>{o.value=D,O==="year"?t("decadePageChanged",D):O==="month"?t("yearPageChanged",D):O==="day"&&t("monthPageChanged",D)},f=O=>{o.value=O,l.minimumView==="year"?(k("none"),t("update:modelValue",O)):a.value="month"},w=O=>{o.value=O,l.minimumView==="month"?(k("none"),t("update:modelValue",O)):a.value="day"},g=O=>{o.value=O,l.minimumView==="day"?(k("none"),t("update:modelValue",O)):a.value="time"},B=O=>{k("none"),t("update:modelValue",O)},V=()=>{l.clearable&&(k("none"),t("update:modelValue",null),o.value=l.startingViewDate)},v=()=>s.value=!0,L=()=>k(R.value),j=()=>{s.value=!1,k()},q=O=>{const D=O.keyCode?O.keyCode:O.which;if([27,13].includes(D)&&r.value.blur(),l.typeable){const P=Ln(r.value.value,l.inputFormat);P&&i.value===mt(P,l.inputFormat)&&(i.value=r.value.value,t("update:modelValue",P))}},R=e.computed(()=>{const O=ft.indexOf(l.startingView),D=ft.indexOf(l.minimumView);return O<D?l.minimumView:l.startingView}),K=O=>Object.fromEntries(Object.entries(O??{}).filter(([D,U])=>D.startsWith("--"))),G=e.computed(()=>l.weekDayNames?.length===7?l.weekDayNames:void 0);return{blur:j,focus:L,click:v,input:i,inputRef:r,pageDate:o,renderView:k,updatePageDate:x,selectYear:f,selectMonth:w,selectDay:g,selectTime:B,keyUp:q,normalizedWeekdayNames:G,viewShown:a,goBackFromTimepicker:()=>l.startingView==="time"&&l.minimumView==="time"?null:a.value="day",clearModelValue:V,initialView:R,log:O=>console.log(O),variables:K}}}),cu={class:"v3dp__input_wrapper"},uu=["readonly","placeholder","disabled","tabindex"],pu={class:"v3dp__clearable"};function mu(l,t,n,a,o,r){const s=e.resolveComponent("year-picker"),i=e.resolveComponent("month-picker"),d=e.resolveComponent("day-picker"),u=e.resolveComponent("time-picker");return e.openBlock(),e.createElementBlock("div",{class:"v3dp__datepicker",style:e.normalizeStyle(l.variables(l.$attrs.style))},[e.createElementVNode("div",cu,[e.withDirectives(e.createElementVNode("input",e.mergeProps({type:"text",ref:"inputRef",readonly:!l.typeable,"onUpdate:modelValue":t[0]||(t[0]=m=>l.input=m)},l.$attrs,{placeholder:l.placeholder,disabled:l.disabled,tabindex:l.disabled?-1:0,onKeyup:t[1]||(t[1]=(...m)=>l.keyUp&&l.keyUp(...m)),onBlur:t[2]||(t[2]=(...m)=>l.blur&&l.blur(...m)),onFocus:t[3]||(t[3]=(...m)=>l.focus&&l.focus(...m)),onClick:t[4]||(t[4]=(...m)=>l.click&&l.click(...m))}),null,16,uu),[[e.vModelText,l.input]]),e.withDirectives(e.createElementVNode("div",pu,[e.renderSlot(l.$slots,"clear",{onClear:l.clearModelValue},()=>[e.createElementVNode("i",{onClick:t[5]||(t[5]=m=>l.clearModelValue())},"x")])],512),[[e.vShow,l.clearable&&l.modelValue]])]),e.withDirectives(e.createVNode(s,{pageDate:l.pageDate,"onUpdate:pageDate":t[6]||(t[6]=m=>l.updatePageDate("year",m)),selected:l.modelValue,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,onSelect:l.selectYear},null,8,["pageDate","selected","lowerLimit","upperLimit","onSelect"]),[[e.vShow,l.viewShown==="year"]]),e.withDirectives(e.createVNode(i,{pageDate:l.pageDate,"onUpdate:pageDate":t[7]||(t[7]=m=>l.updatePageDate("month",m)),selected:l.modelValue,onSelect:l.selectMonth,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,format:l.monthListFormat,onBack:t[8]||(t[8]=m=>l.viewShown="year")},null,8,["pageDate","selected","onSelect","lowerLimit","upperLimit","format"]),[[e.vShow,l.viewShown==="month"]]),e.withDirectives(e.createVNode(d,{pageDate:l.pageDate,"onUpdate:pageDate":t[9]||(t[9]=m=>l.updatePageDate("day",m)),selected:l.modelValue,weekStartsOn:l.weekStartsOn,lowerLimit:l.lowerLimit,upperLimit:l.upperLimit,headingFormat:l.dayPickerHeadingFormat,disabledDates:l.disabledDates,weekdayFormat:l.weekdayFormat,"allow-outside-interval":l.allowOutsideInterval,format:l.dayFormat,"custom-weekdays":l.normalizedWeekdayNames,onSelect:l.selectDay,onBack:t[10]||(t[10]=m=>l.viewShown="month")},null,8,["pageDate","selected","weekStartsOn","lowerLimit","upperLimit","headingFormat","disabledDates","weekdayFormat","allow-outside-interval","format","custom-weekdays","onSelect"]),[[e.vShow,l.viewShown==="day"]]),e.withDirectives(e.createVNode(u,{pageDate:l.pageDate,visible:l.viewShown==="time",selected:l.modelValue,disabledTime:l.disabledTime,onSelect:l.selectTime,onBack:l.goBackFromTimepicker},null,8,["pageDate","visible","selected","disabledTime","onSelect","onBack"]),[[e.vShow,l.viewShown==="time"]])],4)}const hu=J(du,[["render",mu]]),fu=J(e.defineComponent({__name:"vs-input-date2",props:{clearable:{type:Boolean,default:!0},now:{type:Boolean},editable:{type:Boolean,default:!0},time:{type:Boolean},isInfinity:{type:Boolean},mode:{default:"date"},weekStart:{},dayNames:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(l,{emit:t}){const n=l,a=t,{inputClass:o}=ye(n.style),r=e.computed(()=>n.mode?n.mode:n.time?"datetime":"date"),s={date:"дд.мм.рррр",datetime:"дд.мм.рррр гг:хх",month:"мм.рррр",week:"рррр-тиждень",time:"гг:хх",year:"рррр"},i=e.computed(()=>n.placeholder||s[r.value]||""),d=e.computed(()=>["py-1.5 px-3 block w-full placeholder:text-[#767f8f] bg-white",o.value,n.customClass,{"!border-red-600":n.error}]),u=e.computed(()=>!n.modelValue&&n.now?new Date:null),m=e.computed({get:()=>w(n.modelValue??u.value,r.value)||void 0,set:D=>a("update:modelValue",g(D,r.value))}),h=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],E=e.computed(()=>{if(n.dayNames?.length)return n.dayNames.length===7?n.dayNames:h}),y=e.computed(()=>{const D=n.weekStart,U=typeof D=="string"?Number(D):D;return U===void 0||Number.isNaN(U)?1:Math.min(6,Math.max(0,U))}),N=e.computed(()=>{switch(r.value){case"time":return{startingView:"time",minimumView:"time"};case"month":return{startingView:"month",minimumView:"month"};case"year":return{startingView:"year",minimumView:"year"};case"datetime":return{startingView:"day",minimumView:"time"};default:return{startingView:"day",minimumView:"day"}}}),b={date:"dd.MM.yyyy",datetime:"dd.MM.yyyy HH:mm",month:"MM.yyyy",time:"HH:mm",week:"dd.MM.yyyy",year:"yyyy"},k=e.computed(()=>b[r.value]||"dd.MM.yyyy"),x=e.computed(()=>({"--vdp-selected-bg-color":n.style?.primaryColor||"#2563eb","--vdp-hover-bg-color":n.style?.primaryColor||"#2563eb","--vdp-selected-color":"#ffffff","--vdp-hover-color":"#ffffff","--vdp-border-radius":n.style?.size==="sm"?"6px":"8px","--vdp-elem-font-size":n.style?.size==="sm"?"0.75em":"0.85em"})),f=e.ref(!1);e.watch(()=>n.modelValue,D=>{D?f.value=!0:n.now||(f.value=!1)},{immediate:!0}),e.watchEffect(()=>{n.now&&!n.modelValue&&!f.value&&(a("update:modelValue",g(new Date,r.value)),f.value=!0)});function w(D,U){if(!D)return null;if(D instanceof Date&&!Number.isNaN(D.getTime()))return D;if(typeof D!="string")return null;switch(U){case"datetime":return L(D);case"time":return R(D);case"month":return j(D);case"year":return q(D);case"week":return K(D);case"date":default:return v(D)}}function g(D,U){if(!D)return null;const P=D instanceof Date?D:w(D,U);if(!P)return null;switch(U){case"datetime":return`${B(P)}T${V(P)}`;case"time":return V(P);case"month":return`${P.getFullYear()}-${O(P.getMonth()+1)}`;case"year":return`${P.getFullYear()}`;case"week":{const{year:ie,week:ae}=G(P);return`${ie}-W${O(ae)}`}case"date":default:return B(P)}}function B(D){return`${D.getFullYear()}-${O(D.getMonth()+1)}-${O(D.getDate())}`}function V(D){return`${O(D.getHours())}:${O(D.getMinutes())}`}function v(D){const U=D.split("-");if(U.length<3)return null;const[P,ie,ae]=U.map(Number);return!P||!ie||!ae?null:new Date(P,ie-1,ae)}function L(D){const U=D.includes("T")?D:D.replace(" ","T"),P=new Date(U);return Number.isNaN(P.getTime())?null:P}function j(D){const[U,P]=D.split("-").map(Number);return!U||Number.isNaN(P)?null:new Date(U,(P||1)-1,1)}function q(D){const U=Number(D);return U?new Date(U,0,1):null}function R(D){const U=D.match(/^(\d{1,2}):(\d{2})$/);if(!U)return null;const[,P,ie]=U,ae=new Date;return ae.setHours(Number(P),Number(ie),0,0),ae}function K(D){const U=D.match(/^(\d{4})-W(\d{2})$/);if(!U)return null;const[,P,ie]=U,ae=Number(ie);return Z(Number(P),ae)}function G(D){const U=new Date(Date.UTC(D.getFullYear(),D.getMonth(),D.getDate())),P=U.getUTCDay()||7;U.setUTCDate(U.getUTCDate()+4-P);const ie=new Date(Date.UTC(U.getUTCFullYear(),0,1)),ae=Math.ceil(((U.getTime()-ie.getTime())/864e5+1)/7);return{year:U.getUTCFullYear(),week:ae}}function Z(D,U){if(!D||!U)return null;const P=new Date(D,0,1+(U-1)*7),ie=P.getDay(),ae=P;return ie<=4?ae.setDate(P.getDate()-P.getDay()+1):ae.setDate(P.getDate()+8-P.getDay()),ae}function O(D){return String(D).padStart(2,"0")}return(D,U)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["vs-date-picker",n.customClass]),style:e.normalizeStyle(x.value)},[e.createVNode(hu,{modelValue:m.value,"onUpdate:modelValue":U[0]||(U[0]=P=>m.value=P),placeholder:i.value,disabled:n.disabled,clearable:n.clearable,typeable:n.editable,"week-day-names":E.value,"week-starts-on":y.value,"starting-view":N.value.startingView,"minimum-view":N.value.minimumView,"input-format":k.value,name:n.name,class:e.normalizeClass(d.value)},null,8,["modelValue","placeholder","disabled","clearable","typeable","week-day-names","week-starts-on","starting-view","minimum-view","input-format","name","class"])],6))}}),[["__scopeId","data-v-a65a2ac3"]]),In=(l={mode:"edit",schema:null})=>new Promise(t=>{const{close:n}=se.modal({title:l.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:Cn,contentProps:{...l,onClose:()=>{t(null),n()},onSave:a=>{t(a),n()}}})});Me.install=function(t){t.component("VForm",Me),Object.assign(t.config.globalProperties,{$form:In}),t.provide("form",In),window.v3plugin||(window.v3plugin={})};function $e(l){return typeof l=="string"||l instanceof String}function On(l){var t;return typeof l=="object"&&l!=null&&(l==null||(t=l.constructor)==null?void 0:t.name)==="Object"}function Rn(l,t){return Array.isArray(t)?Rn(l,(n,a)=>t.includes(a)):Object.entries(l).reduce((n,a)=>{let[o,r]=a;return t(r,o)&&(n[o]=r),n},{})}const H={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function zn(l){switch(l){case H.LEFT:return H.FORCE_LEFT;case H.RIGHT:return H.FORCE_RIGHT;default:return l}}function Pt(l){return l.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function gt(l,t){if(t===l)return!0;const n=Array.isArray(t),a=Array.isArray(l);let o;if(n&&a){if(t.length!=l.length)return!1;for(o=0;o<t.length;o++)if(!gt(t[o],l[o]))return!1;return!0}if(n!=a)return!1;if(t&&l&&typeof t=="object"&&typeof l=="object"){const r=t instanceof Date,s=l instanceof Date;if(r&&s)return t.getTime()==l.getTime();if(r!=s)return!1;const i=t instanceof RegExp,d=l instanceof RegExp;if(i&&d)return t.toString()==l.toString();if(i!=d)return!1;const u=Object.keys(t);for(o=0;o<u.length;o++)if(!Object.prototype.hasOwnProperty.call(l,u[o]))return!1;for(o=0;o<u.length;o++)if(!gt(l[u[o]],t[u[o]]))return!1;return!0}else if(t&&l&&typeof t=="function"&&typeof l=="function")return t.toString()===l.toString();return!1}class gu{constructor(t){for(Object.assign(this,t);this.value.slice(0,this.startChangePos)!==this.oldValue.slice(0,this.startChangePos);)--this.oldSelection.start;if(this.insertedCount)for(;this.value.slice(this.cursorPos)!==this.oldValue.slice(this.oldSelection.end);)this.value.length-this.cursorPos<this.oldValue.length-this.oldSelection.end?++this.oldSelection.end:++this.cursorPos}get startChangePos(){return Math.min(this.cursorPos,this.oldSelection.start)}get insertedCount(){return this.cursorPos-this.startChangePos}get inserted(){return this.value.substr(this.startChangePos,this.insertedCount)}get removedCount(){return Math.max(this.oldSelection.end-this.startChangePos||this.oldValue.length-this.value.length,0)}get removed(){return this.oldValue.substr(this.startChangePos,this.removedCount)}get head(){return this.value.substring(0,this.startChangePos)}get tail(){return this.value.substring(this.startChangePos+this.insertedCount)}get removeDirection(){return!this.removedCount||this.insertedCount?H.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?H.RIGHT:H.LEFT}}function Q(l,t){return new Q.InputMask(l,t)}function jn(l){if(l==null)throw new Error("mask property should be defined");return l instanceof RegExp?Q.MaskedRegExp:$e(l)?Q.MaskedPattern:l===Date?Q.MaskedDate:l===Number?Q.MaskedNumber:Array.isArray(l)||l===Array?Q.MaskedDynamic:Q.Masked&&l.prototype instanceof Q.Masked?l:Q.Masked&&l instanceof Q.Masked?l.constructor:l instanceof Function?Q.MaskedFunction:(console.warn("Mask not found for mask",l),Q.Masked)}function Ue(l){if(!l)throw new Error("Options in not defined");if(Q.Masked){if(l.prototype instanceof Q.Masked)return{mask:l};const{mask:t=void 0,...n}=l instanceof Q.Masked?{mask:l}:On(l)&&l.mask instanceof Q.Masked?l:{};if(t){const a=t.mask;return{...Rn(t,(o,r)=>!r.startsWith("_")),mask:t.constructor,_mask:a,...n}}}return On(l)?{...l}:{mask:l}}function Be(l){if(Q.Masked&&l instanceof Q.Masked)return l;const t=Ue(l),n=jn(t.mask);if(!n)throw new Error("Masked class is not found for provided mask "+t.mask+", appropriate module needs to be imported manually before creating mask.");return t.mask===n&&delete t.mask,t._mask&&(t.mask=t._mask,delete t._mask),new n(t)}Q.createMask=Be;class yt{get selectionStart(){let t;try{t=this._unsafeSelectionStart}catch{}return t??this.value.length}get selectionEnd(){let t;try{t=this._unsafeSelectionEnd}catch{}return t??this.value.length}select(t,n){if(!(t==null||n==null||t===this.selectionStart&&n===this.selectionEnd))try{this._unsafeSelect(t,n)}catch{}}get isActive(){return!1}}Q.MaskElement=yt;const Pn=90,yu=89;class We extends yt{constructor(t){super(),this.input=t,this._onKeydown=this._onKeydown.bind(this),this._onInput=this._onInput.bind(this),this._onBeforeinput=this._onBeforeinput.bind(this),this._onCompositionEnd=this._onCompositionEnd.bind(this)}get rootElement(){var t,n,a;return(t=(n=(a=this.input).getRootNode)==null?void 0:n.call(a))!=null?t:document}get isActive(){return this.input===this.rootElement.activeElement}bindEvents(t){this.input.addEventListener("keydown",this._onKeydown),this.input.addEventListener("input",this._onInput),this.input.addEventListener("beforeinput",this._onBeforeinput),this.input.addEventListener("compositionend",this._onCompositionEnd),this.input.addEventListener("drop",t.drop),this.input.addEventListener("click",t.click),this.input.addEventListener("focus",t.focus),this.input.addEventListener("blur",t.commit),this._handlers=t}_onKeydown(t){if(this._handlers.redo&&(t.keyCode===Pn&&t.shiftKey&&(t.metaKey||t.ctrlKey)||t.keyCode===yu&&t.ctrlKey))return t.preventDefault(),this._handlers.redo(t);if(this._handlers.undo&&t.keyCode===Pn&&(t.metaKey||t.ctrlKey))return t.preventDefault(),this._handlers.undo(t);t.isComposing||this._handlers.selectionChange(t)}_onBeforeinput(t){if(t.inputType==="historyUndo"&&this._handlers.undo)return t.preventDefault(),this._handlers.undo(t);if(t.inputType==="historyRedo"&&this._handlers.redo)return t.preventDefault(),this._handlers.redo(t)}_onCompositionEnd(t){this._handlers.input(t)}_onInput(t){t.isComposing||this._handlers.input(t)}unbindEvents(){this.input.removeEventListener("keydown",this._onKeydown),this.input.removeEventListener("input",this._onInput),this.input.removeEventListener("beforeinput",this._onBeforeinput),this.input.removeEventListener("compositionend",this._onCompositionEnd),this.input.removeEventListener("drop",this._handlers.drop),this.input.removeEventListener("click",this._handlers.click),this.input.removeEventListener("focus",this._handlers.focus),this.input.removeEventListener("blur",this._handlers.commit),this._handlers={}}}Q.HTMLMaskElement=We;class Un extends We{constructor(t){super(t),this.input=t}get _unsafeSelectionStart(){return this.input.selectionStart!=null?this.input.selectionStart:this.value.length}get _unsafeSelectionEnd(){return this.input.selectionEnd}_unsafeSelect(t,n){this.input.setSelectionRange(t,n)}get value(){return this.input.value}set value(t){this.input.value=t}}Q.HTMLMaskElement=We;class Ut extends We{get _unsafeSelectionStart(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),a=n&&n.anchorOffset,o=n&&n.focusOffset;return o==null||a==null||a<o?a:o}get _unsafeSelectionEnd(){const t=this.rootElement,n=t.getSelection&&t.getSelection(),a=n&&n.anchorOffset,o=n&&n.focusOffset;return o==null||a==null||a>o?a:o}_unsafeSelect(t,n){if(!this.rootElement.createRange)return;const a=this.rootElement.createRange();a.setStart(this.input.firstChild||this.input,t),a.setEnd(this.input.lastChild||this.input,n);const o=this.rootElement,r=o.getSelection&&o.getSelection();r&&(r.removeAllRanges(),r.addRange(a))}get value(){return this.input.textContent||""}set value(t){this.input.textContent=t}}Q.HTMLContenteditableMaskElement=Ut;class kt{constructor(){this.states=[],this.currentIndex=0}get currentState(){return this.states[this.currentIndex]}get isEmpty(){return this.states.length===0}push(t){this.currentIndex<this.states.length-1&&(this.states.length=this.currentIndex+1),this.states.push(t),this.states.length>kt.MAX_LENGTH&&this.states.shift(),this.currentIndex=this.states.length-1}go(t){return this.currentIndex=Math.min(Math.max(this.currentIndex+t,0),this.states.length-1),this.currentState}undo(){return this.go(-1)}redo(){return this.go(1)}clear(){this.states.length=0,this.currentIndex=0}}kt.MAX_LENGTH=100;class Hn{constructor(t,n){this.el=t instanceof yt?t:t.isContentEditable&&t.tagName!=="INPUT"&&t.tagName!=="TEXTAREA"?new Ut(t):new Un(t),this.masked=Be(n),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new kt,this._saveSelection=this._saveSelection.bind(this),this._onInput=this._onInput.bind(this),this._onChange=this._onChange.bind(this),this._onDrop=this._onDrop.bind(this),this._onFocus=this._onFocus.bind(this),this._onClick=this._onClick.bind(this),this._onUndo=this._onUndo.bind(this),this._onRedo=this._onRedo.bind(this),this.alignCursor=this.alignCursor.bind(this),this.alignCursorFriendly=this.alignCursorFriendly.bind(this),this._bindEvents(),this.updateValue(),this._onChange()}maskEquals(t){var n;return t==null||((n=this.masked)==null?void 0:n.maskEquals(t))}get mask(){return this.masked.mask}set mask(t){if(this.maskEquals(t))return;if(!(t instanceof Q.Masked)&&this.masked.constructor===jn(t)){this.masked.updateOptions({mask:t});return}const n=t instanceof Q.Masked?t:Be({mask:t});n.unmaskedValue=this.masked.unmaskedValue,this.masked=n}get value(){return this._value}set value(t){this.value!==t&&(this.masked.value=t,this.updateControl("auto"))}get unmaskedValue(){return this._unmaskedValue}set unmaskedValue(t){this.unmaskedValue!==t&&(this.masked.unmaskedValue=t,this.updateControl("auto"))}get rawInputValue(){return this._rawInputValue}set rawInputValue(t){this.rawInputValue!==t&&(this.masked.rawInputValue=t,this.updateControl(),this.alignCursor())}get typedValue(){return this.masked.typedValue}set typedValue(t){this.masked.typedValueEquals(t)||(this.masked.typedValue=t,this.updateControl("auto"))}get displayValue(){return this.masked.displayValue}_bindEvents(){this.el.bindEvents({selectionChange:this._saveSelection,input:this._onInput,drop:this._onDrop,click:this._onClick,focus:this._onFocus,commit:this._onChange,undo:this._onUndo,redo:this._onRedo})}_unbindEvents(){this.el&&this.el.unbindEvents()}_fireEvent(t,n){const a=this._listeners[t];a&&a.forEach(o=>o(n))}get selectionStart(){return this._cursorChanging?this._changingCursorPos:this.el.selectionStart}get cursorPos(){return this._cursorChanging?this._changingCursorPos:this.el.selectionEnd}set cursorPos(t){!this.el||!this.el.isActive||(this.el.select(t,t),this._saveSelection())}_saveSelection(){this.displayValue!==this.el.value&&console.warn("Element value was changed outside of mask. Syncronize mask using `mask.updateValue()` to work properly."),this._selection={start:this.selectionStart,end:this.cursorPos}}updateValue(){this.masked.value=this.el.value,this._value=this.masked.value,this._unmaskedValue=this.masked.unmaskedValue,this._rawInputValue=this.masked.rawInputValue}updateControl(t){const n=this.masked.unmaskedValue,a=this.masked.value,o=this.masked.rawInputValue,r=this.displayValue,s=this.unmaskedValue!==n||this.value!==a||this._rawInputValue!==o;this._unmaskedValue=n,this._value=a,this._rawInputValue=o,this.el.value!==r&&(this.el.value=r),t==="auto"?this.alignCursor():t!=null&&(this.cursorPos=t),s&&this._fireChangeEvents(),!this._historyChanging&&(s||this.history.isEmpty)&&this.history.push({unmaskedValue:n,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(t){const{mask:n,...a}=t,o=!this.maskEquals(n),r=this.masked.optionsIsChanged(a);o&&(this.mask=n),r&&this.masked.updateOptions(a),(o||r)&&this.updateControl()}updateCursor(t){t!=null&&(this.cursorPos=t,this._delayUpdateCursor(t))}_delayUpdateCursor(t){this._abortUpdateCursor(),this._changingCursorPos=t,this._cursorChanging=setTimeout(()=>{this.el&&(this.cursorPos=this._changingCursorPos,this._abortUpdateCursor())},10)}_fireChangeEvents(){this._fireEvent("accept",this._inputEvent),this.masked.isComplete&&this._fireEvent("complete",this._inputEvent)}_abortUpdateCursor(){this._cursorChanging&&(clearTimeout(this._cursorChanging),delete this._cursorChanging)}alignCursor(){this.cursorPos=this.masked.nearestInputPos(this.masked.nearestInputPos(this.cursorPos,H.LEFT))}alignCursorFriendly(){this.selectionStart===this.cursorPos&&this.alignCursor()}on(t,n){return this._listeners[t]||(this._listeners[t]=[]),this._listeners[t].push(n),this}off(t,n){if(!this._listeners[t])return this;if(!n)return delete this._listeners[t],this;const a=this._listeners[t].indexOf(n);return a>=0&&this._listeners[t].splice(a,1),this}_onInput(t){this._inputEvent=t,this._abortUpdateCursor();const n=new gu({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),a=this.masked.rawInputValue,o=this.masked.splice(n.startChangePos,n.removed.length,n.inserted,n.removeDirection,{input:!0,raw:!0}).offset,r=a===this.masked.rawInputValue?n.removeDirection:H.NONE;let s=this.masked.nearestInputPos(n.startChangePos+o,r);r!==H.NONE&&(s=this.masked.nearestInputPos(s,H.NONE)),this.updateControl(s),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(t){t.preventDefault(),t.stopPropagation()}_onFocus(t){this.alignCursorFriendly()}_onClick(t){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(t){t&&(this._historyChanging=!0,this.unmaskedValue=t.unmaskedValue,this.el.select(t.selection.start,t.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}Q.InputMask=Hn;class te{static normalize(t){return Array.isArray(t)?t:[t,new te]}constructor(t){Object.assign(this,{inserted:"",rawInserted:"",tailShift:0,skip:!1},t)}aggregate(t){return this.inserted+=t.inserted,this.rawInserted+=t.rawInserted,this.tailShift+=t.tailShift,this.skip=this.skip||t.skip,this}get offset(){return this.tailShift+this.inserted.length}get consumed(){return!!this.rawInserted||this.skip}equals(t){return this.inserted===t.inserted&&this.tailShift===t.tailShift&&this.rawInserted===t.rawInserted&&this.skip===t.skip}}Q.ChangeDetails=te;class ve{constructor(t,n,a){t===void 0&&(t=""),n===void 0&&(n=0),this.value=t,this.from=n,this.stop=a}toString(){return this.value}extend(t){this.value+=String(t)}appendTo(t){return t.append(this.toString(),{tail:!0}).aggregate(t._appendPlaceholder())}get state(){return{value:this.value,from:this.from,stop:this.stop}}set state(t){Object.assign(this,t)}unshift(t){if(!this.value.length||t!=null&&this.from>=t)return"";const n=this.value[0];return this.value=this.value.slice(1),n}shift(){if(!this.value.length)return"";const t=this.value[this.value.length-1];return this.value=this.value.slice(0,-1),t}}class he{constructor(t){this._value="",this._update({...he.DEFAULTS,...t}),this._initialized=!0}updateOptions(t){this.optionsIsChanged(t)&&this.withValueRefresh(this._update.bind(this,t))}_update(t){Object.assign(this,t)}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value}reset(){this._value=""}get value(){return this._value}set value(t){this.resolve(t,{input:!0})}resolve(t,n){n===void 0&&(n={input:!0}),this.reset(),this.append(t,n,""),this.doCommit()}get unmaskedValue(){return this.value}set unmaskedValue(t){this.resolve(t,{})}get typedValue(){return this.parse?this.parse(this.value,this):this.unmaskedValue}set typedValue(t){this.format?this.value=this.format(t,this):this.unmaskedValue=String(t)}get rawInputValue(){return this.extractInput(0,this.displayValue.length,{raw:!0})}set rawInputValue(t){this.resolve(t,{raw:!0})}get displayValue(){return this.value}get isComplete(){return!0}get isFilled(){return this.isComplete}nearestInputPos(t,n){return t}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),Math.min(this.displayValue.length,n-t)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this.displayValue.slice(t,n)}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new ve(this.extractInput(t,n),t)}appendTail(t){return $e(t)&&(t=new ve(String(t))),t.appendTo(this)}_appendCharRaw(t,n){return t?(this._value+=t,new te({inserted:t,rawInserted:t})):new te}_appendChar(t,n,a){n===void 0&&(n={});const o=this.state;let r;if([t,r]=this.doPrepareChar(t,n),t&&(r=r.aggregate(this._appendCharRaw(t,n)),!r.rawInserted&&this.autofix==="pad")){const s=this.state;this.state=o;let i=this.pad(n);const d=this._appendCharRaw(t,n);i=i.aggregate(d),d.rawInserted||i.equals(r)?r=i:this.state=s}if(r.inserted){let s,i=this.doValidate(n)!==!1;if(i&&a!=null){const d=this.state;if(this.overwrite===!0){s=a.state;for(let m=0;m<r.rawInserted.length;++m)a.unshift(this.displayValue.length-r.tailShift)}let u=this.appendTail(a);if(i=u.rawInserted.length===a.toString().length,!(i&&u.inserted)&&this.overwrite==="shift"){this.state=d,s=a.state;for(let m=0;m<r.rawInserted.length;++m)a.shift();u=this.appendTail(a),i=u.rawInserted.length===a.toString().length}i&&u.inserted&&(this.state=d)}i||(r=new te,this.state=o,a&&s&&(a.state=s))}return r}_appendPlaceholder(){return new te}_appendEager(){return new te}append(t,n,a){if(!$e(t))throw new Error("value should be string");const o=$e(a)?new ve(String(a)):a;n!=null&&n.tail&&(n._beforeTailState=this.state);let r;[t,r]=this.doPrepare(t,n);for(let s=0;s<t.length;++s){const i=this._appendChar(t[s],n,o);if(!i.rawInserted&&!this.doSkipInvalid(t[s],n,o))break;r.aggregate(i)}return(this.eager===!0||this.eager==="append")&&n!=null&&n.input&&t&&r.aggregate(this._appendEager()),o!=null&&(r.tailShift+=this.appendTail(o).tailShift),r}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),this._value=this.displayValue.slice(0,t)+this.displayValue.slice(n),new te}withValueRefresh(t){if(this._refreshing||!this._initialized)return t();this._refreshing=!0;const n=this.rawInputValue,a=this.value,o=t();return this.rawInputValue=n,this.value&&this.value!==a&&a.indexOf(this.value)===0&&(this.append(a.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,o}runIsolated(t){if(this._isolated||!this._initialized)return t(this);this._isolated=!0;const n=this.state,a=t(this);return this.state=n,delete this._isolated,a}doSkipInvalid(t,n,a){return!!this.skipInvalid}doPrepare(t,n){return n===void 0&&(n={}),te.normalize(this.prepare?this.prepare(t,this,n):t)}doPrepareChar(t,n){return n===void 0&&(n={}),te.normalize(this.prepareChar?this.prepareChar(t,this,n):t)}doValidate(t){return(!this.validate||this.validate(this.value,this,t))&&(!this.parent||this.parent.doValidate(t))}doCommit(){this.commit&&this.commit(this.value,this)}splice(t,n,a,o,r){a===void 0&&(a=""),o===void 0&&(o=H.NONE),r===void 0&&(r={input:!0});const s=t+n,i=this.extractTail(s),d=this.eager===!0||this.eager==="remove";let u;d&&(o=zn(o),u=this.extractInput(0,s,{raw:!0}));let m=t;const h=new te;if(o!==H.NONE&&(m=this.nearestInputPos(t,n>1&&t!==0&&!d?H.NONE:o),h.tailShift=m-t),h.aggregate(this.remove(m)),d&&o!==H.NONE&&u===this.rawInputValue)if(o===H.FORCE_LEFT){let E;for(;u===this.rawInputValue&&(E=this.displayValue.length);)h.aggregate(new te({tailShift:-1})).aggregate(this.remove(E-1))}else o===H.FORCE_RIGHT&&i.unshift();return h.aggregate(this.append(a,r,i))}maskEquals(t){return this.mask===t}optionsIsChanged(t){return!gt(this,t)}typedValueEquals(t){const n=this.typedValue;return t===n||he.EMPTY_VALUES.includes(t)&&he.EMPTY_VALUES.includes(n)||(this.format?this.format(t,this)===this.format(this.typedValue,this):!1)}pad(t){return new te}}he.DEFAULTS={skipInvalid:!0},he.EMPTY_VALUES=[void 0,null,""],Q.Masked=he;class De{constructor(t,n){t===void 0&&(t=[]),n===void 0&&(n=0),this.chunks=t,this.from=n}toString(){return this.chunks.map(String).join("")}extend(t){if(!String(t))return;t=$e(t)?new ve(String(t)):t;const n=this.chunks[this.chunks.length-1],a=n&&(n.stop===t.stop||t.stop==null)&&t.from===n.from+n.toString().length;if(t instanceof ve)a?n.extend(t.toString()):this.chunks.push(t);else if(t instanceof De){if(t.stop==null){let o;for(;t.chunks.length&&t.chunks[0].stop==null;)o=t.chunks.shift(),o.from+=t.from,this.extend(o)}t.toString()&&(t.stop=t.blockIndex,this.chunks.push(t))}}appendTo(t){if(!(t instanceof Q.MaskedPattern))return new ve(this.toString()).appendTo(t);const n=new te;for(let a=0;a<this.chunks.length;++a){const o=this.chunks[a],r=t._mapPosToBlock(t.displayValue.length),s=o.stop;let i;if(s!=null&&(!r||r.index<=s)&&((o instanceof De||t._stops.indexOf(s)>=0)&&n.aggregate(t._appendPlaceholder(s)),i=o instanceof De&&t._blocks[s]),i){const d=i.appendTail(o);n.aggregate(d);const u=o.toString().slice(d.rawInserted.length);u&&n.aggregate(t.append(u,{tail:!0}))}else n.aggregate(t.append(o.toString(),{tail:!0}))}return n}get state(){return{chunks:this.chunks.map(t=>t.state),from:this.from,stop:this.stop,blockIndex:this.blockIndex}}set state(t){const{chunks:n,...a}=t;Object.assign(this,a),this.chunks=n.map(o=>{const r="chunks"in o?new De:new ve;return r.state=o,r})}unshift(t){if(!this.chunks.length||t!=null&&this.from>=t)return"";const n=t!=null?t-this.from:t;let a=0;for(;a<this.chunks.length;){const o=this.chunks[a],r=o.unshift(n);if(o.toString()){if(!r)break;++a}else this.chunks.splice(a,1);if(r)return r}return""}shift(){if(!this.chunks.length)return"";let t=this.chunks.length-1;for(;0<=t;){const n=this.chunks[t],a=n.shift();if(n.toString()){if(!a)break;--t}else this.chunks.splice(t,1);if(a)return a}return""}}class ku{constructor(t,n){this.masked=t,this._log=[];const{offset:a,index:o}=t._mapPosToBlock(n)||(n<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=a,this.index=o,this.ok=!1}get block(){return this.masked._blocks[this.index]}get pos(){return this.masked._blockStartPos(this.index)+this.offset}get state(){return{index:this.index,offset:this.offset,ok:this.ok}}set state(t){Object.assign(this,t)}pushState(){this._log.push(this.state)}popState(){const t=this._log.pop();return t&&(this.state=t),t}bindBlock(){this.block||(this.index<0&&(this.index=0,this.offset=0),this.index>=this.masked._blocks.length&&(this.index=this.masked._blocks.length-1,this.offset=this.block.displayValue.length))}_pushLeft(t){for(this.pushState(),this.bindBlock();0<=this.index;--this.index,this.offset=((n=this.block)==null?void 0:n.displayValue.length)||0){var n;if(t())return this.ok=!0}return this.ok=!1}_pushRight(t){for(this.pushState(),this.bindBlock();this.index<this.masked._blocks.length;++this.index,this.offset=0)if(t())return this.ok=!0;return this.ok=!1}pushLeftBeforeFilled(){return this._pushLeft(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,H.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,H.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,H.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,H.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,H.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,H.NONE),!0})}}class Ht{constructor(t){Object.assign(this,t),this._value="",this.isFixed=!0}get value(){return this._value}get unmaskedValue(){return this.isUnmasking?this.value:""}get rawInputValue(){return this._isRawInput?this.value:""}get displayValue(){return this.value}reset(){this._isRawInput=!1,this._value=""}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._value=this._value.slice(0,t)+this._value.slice(n),this._value||(this._isRawInput=!1),new te}nearestInputPos(t,n){n===void 0&&(n=H.NONE);const a=0,o=this._value.length;switch(n){case H.LEFT:case H.FORCE_LEFT:return a;case H.NONE:case H.RIGHT:case H.FORCE_RIGHT:default:return o}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),this._isRawInput?n-t:0}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this._value.length),a===void 0&&(a={}),a.raw&&this._isRawInput&&this._value.slice(t,n)||""}get isComplete(){return!0}get isFilled(){return!!this._value}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new te;const a=this.eager===!0||this.eager==="append",r=this.char===t&&(this.isUnmasking||n.input||n.raw)&&(!n.raw||!a)&&!n.tail,s=new te({inserted:this.char,rawInserted:r?this.char:""});return this._value=this.char,this._isRawInput=r&&(n.raw||n.input),s}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const t=new te;return this.isFilled||(this._value=t.inserted=this.char),t}extractTail(){return new ve("")}appendTail(t){return $e(t)&&(t=new ve(String(t))),t.appendTo(this)}append(t,n,a){const o=this._appendChar(t[0],n);return a!=null&&(o.tailShift+=this.appendTail(a).tailShift),o}doCommit(){}get state(){return{_value:this._value,_rawInputValue:this.rawInputValue}}set state(t){this._value=t._value,this._isRawInput=!!t._rawInputValue}pad(t){return this._appendPlaceholder()}}class Ze{constructor(t){const{parent:n,isOptional:a,placeholderChar:o,displayChar:r,lazy:s,eager:i,...d}=t;this.masked=Be(d),Object.assign(this,{parent:n,isOptional:a,placeholderChar:o,displayChar:r,lazy:s,eager:i})}reset(){this.isFilled=!1,this.masked.reset()}remove(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),t===0&&n>=1?(this.isFilled=!1,this.masked.remove(t,n)):new te}get value(){return this.masked.value||(this.isFilled&&!this.isOptional?this.placeholderChar:"")}get unmaskedValue(){return this.masked.unmaskedValue}get rawInputValue(){return this.masked.rawInputValue}get displayValue(){return this.masked.value&&this.displayChar||this.value}get isComplete(){return!!this.masked.value||this.isOptional}_appendChar(t,n){if(n===void 0&&(n={}),this.isFilled)return new te;const a=this.masked.state;let o=this.masked._appendChar(t,this.currentMaskFlags(n));return o.inserted&&this.doValidate(n)===!1&&(o=new te,this.masked.state=a),!o.inserted&&!this.isOptional&&!this.lazy&&!n.input&&(o.inserted=this.placeholderChar),o.skip=!o.inserted&&!this.isOptional,this.isFilled=!!o.inserted,o}append(t,n,a){return this.masked.append(t,this.currentMaskFlags(n),a)}_appendPlaceholder(){return this.isFilled||this.isOptional?new te:(this.isFilled=!0,new te({inserted:this.placeholderChar}))}_appendEager(){return new te}extractTail(t,n){return this.masked.extractTail(t,n)}appendTail(t){return this.masked.appendTail(t)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.masked.extractInput(t,n,a)}nearestInputPos(t,n){n===void 0&&(n=H.NONE);const a=0,o=this.value.length,r=Math.min(Math.max(t,a),o);switch(n){case H.LEFT:case H.FORCE_LEFT:return this.isComplete?r:a;case H.RIGHT:case H.FORCE_RIGHT:return this.isComplete?r:o;case H.NONE:default:return r}}totalInputPositions(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.value.length),this.value.slice(t,n).length}doValidate(t){return this.masked.doValidate(this.currentMaskFlags(t))&&(!this.parent||this.parent.doValidate(this.currentMaskFlags(t)))}doCommit(){this.masked.doCommit()}get state(){return{_value:this.value,_rawInputValue:this.rawInputValue,masked:this.masked.state,isFilled:this.isFilled}}set state(t){this.masked.state=t.masked,this.isFilled=t.isFilled}currentMaskFlags(t){var n;return{...t,_beforeTailState:(t==null||(n=t._beforeTailState)==null?void 0:n.masked)||t?._beforeTailState}}pad(t){return new te}}Ze.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 qn extends he{updateOptions(t){super.updateOptions(t)}_update(t){const n=t.mask;n&&(t.validate=a=>a.search(n)>=0),super._update(t)}}Q.MaskedRegExp=qn;class fe extends he{constructor(t){super({...fe.DEFAULTS,...t,definitions:Object.assign({},Ze.DEFAULT_DEFINITIONS,t?.definitions)})}updateOptions(t){super.updateOptions(t)}_update(t){t.definitions=Object.assign({},this.definitions,t.definitions),super._update(t),this._rebuildMask()}_rebuildMask(){const t=this.definitions;this._blocks=[],this.exposeBlock=void 0,this._stops=[],this._maskedBlocks={};const n=this.mask;if(!n||!t)return;let a=!1,o=!1;for(let r=0;r<n.length;++r){if(this.blocks){const u=n.slice(r),m=Object.keys(this.blocks).filter(E=>u.indexOf(E)===0);m.sort((E,y)=>y.length-E.length);const h=m[0];if(h){const{expose:E,repeat:y,...N}=Ue(this.blocks[h]),b={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...N,repeat:y,parent:this},k=y!=null?new Q.RepeatBlock(b):Be(b);k&&(this._blocks.push(k),E&&(this.exposeBlock=k),this._maskedBlocks[h]||(this._maskedBlocks[h]=[]),this._maskedBlocks[h].push(this._blocks.length-1)),r+=h.length-1;continue}}let s=n[r],i=s in t;if(s===fe.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(s==="{"||s==="}"){a=!a;continue}if(s==="["||s==="]"){o=!o;continue}if(s===fe.ESCAPE_CHAR){if(++r,s=n[r],!s)break;i=!1}const d=i?new Ze({isOptional:o,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...Ue(t[s]),parent:this}):new Ht({char:s,eager:this.eager,isUnmasking:a});this._blocks.push(d)}}get state(){return{...super.state,_blocks:this._blocks.map(t=>t.state)}}set state(t){if(!t){this.reset();return}const{_blocks:n,...a}=t;this._blocks.forEach((o,r)=>o.state=n[r]),super.state=a}reset(){super.reset(),this._blocks.forEach(t=>t.reset())}get isComplete(){return this.exposeBlock?this.exposeBlock.isComplete:this._blocks.every(t=>t.isComplete)}get isFilled(){return this._blocks.every(t=>t.isFilled)}get isFixed(){return this._blocks.every(t=>t.isFixed)}get isOptional(){return this._blocks.every(t=>t.isOptional)}doCommit(){this._blocks.forEach(t=>t.doCommit()),super.doCommit()}get unmaskedValue(){return this.exposeBlock?this.exposeBlock.unmaskedValue:this._blocks.reduce((t,n)=>t+=n.unmaskedValue,"")}set unmaskedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.unmaskedValue=t,this.appendTail(n),this.doCommit()}else super.unmaskedValue=t}get value(){return this.exposeBlock?this.exposeBlock.value:this._blocks.reduce((t,n)=>t+=n.value,"")}set value(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.value=t,this.appendTail(n),this.doCommit()}else super.value=t}get typedValue(){return this.exposeBlock?this.exposeBlock.typedValue:super.typedValue}set typedValue(t){if(this.exposeBlock){const n=this.extractTail(this._blockStartPos(this._blocks.indexOf(this.exposeBlock))+this.exposeBlock.displayValue.length);this.exposeBlock.typedValue=t,this.appendTail(n),this.doCommit()}else super.typedValue=t}get displayValue(){return this._blocks.reduce((t,n)=>t+=n.displayValue,"")}appendTail(t){return super.appendTail(t).aggregate(this._appendPlaceholder())}_appendEager(){var t;const n=new te;let a=(t=this._mapPosToBlock(this.displayValue.length))==null?void 0:t.index;if(a==null)return n;this._blocks[a].isFilled&&++a;for(let o=a;o<this._blocks.length;++o){const r=this._blocks[o]._appendEager();if(!r.inserted)break;n.aggregate(r)}return n}_appendCharRaw(t,n){n===void 0&&(n={});const a=this._mapPosToBlock(this.displayValue.length),o=new te;if(!a)return o;for(let s=a.index,i;i=this._blocks[s];++s){var r;const d=i._appendChar(t,{...n,_beforeTailState:(r=n._beforeTailState)==null||(r=r._blocks)==null?void 0:r[s]});if(o.aggregate(d),d.consumed)break}return o}extractTail(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=new De;return t===n||this._forEachBlocksInRange(t,n,(o,r,s,i)=>{const d=o.extractTail(s,i);d.stop=this._findStopBefore(r),d.from=this._blockStartPos(r),d instanceof De&&(d.blockIndex=r),a.extend(d)}),a}extractInput(t,n,a){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),a===void 0&&(a={}),t===n)return"";let o="";return this._forEachBlocksInRange(t,n,(r,s,i,d)=>{o+=r.extractInput(i,d,a)}),o}_findStopBefore(t){let n;for(let a=0;a<this._stops.length;++a){const o=this._stops[a];if(o<=t)n=o;else break}return n}_appendPlaceholder(t){const n=new te;if(this.lazy&&t==null)return n;const a=this._mapPosToBlock(this.displayValue.length);if(!a)return n;const o=a.index,r=t??this._blocks.length;return this._blocks.slice(o,r).forEach(s=>{if(!s.lazy||t!=null){var i;n.aggregate(s._appendPlaceholder((i=s._blocks)==null?void 0:i.length))}}),n}_mapPosToBlock(t){let n="";for(let a=0;a<this._blocks.length;++a){const o=this._blocks[a],r=n.length;if(n+=o.displayValue,t<=n.length)return{index:a,offset:t-r}}}_blockStartPos(t){return this._blocks.slice(0,t).reduce((n,a)=>n+=a.displayValue.length,0)}_forEachBlocksInRange(t,n,a){n===void 0&&(n=this.displayValue.length);const o=this._mapPosToBlock(t);if(o){const r=this._mapPosToBlock(n),s=r&&o.index===r.index,i=o.offset,d=r&&s?r.offset:this._blocks[o.index].displayValue.length;if(a(this._blocks[o.index],o.index,i,d),r&&!s){for(let u=o.index+1;u<r.index;++u)a(this._blocks[u],u,0,this._blocks[u].displayValue.length);a(this._blocks[r.index],r.index,0,r.offset)}}}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=super.remove(t,n);return this._forEachBlocksInRange(t,n,(o,r,s,i)=>{a.aggregate(o.remove(s,i))}),a}nearestInputPos(t,n){if(n===void 0&&(n=H.NONE),!this._blocks.length)return 0;const a=new ku(this,t);if(n===H.NONE)return a.pushRightBeforeInput()||(a.popState(),a.pushLeftBeforeInput())?a.pos:this.displayValue.length;if(n===H.LEFT||n===H.FORCE_LEFT){if(n===H.LEFT){if(a.pushRightBeforeFilled(),a.ok&&a.pos===t)return t;a.popState()}if(a.pushLeftBeforeInput(),a.pushLeftBeforeRequired(),a.pushLeftBeforeFilled(),n===H.LEFT){if(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.ok&&a.pos<=t||(a.popState(),a.ok&&a.pos<=t))return a.pos;a.popState()}return a.ok?a.pos:n===H.FORCE_LEFT?0:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:0)}return n===H.RIGHT||n===H.FORCE_RIGHT?(a.pushRightBeforeInput(),a.pushRightBeforeRequired(),a.pushRightBeforeFilled()?a.pos:n===H.FORCE_RIGHT?this.displayValue.length:(a.popState(),a.ok||(a.popState(),a.ok)?a.pos:this.nearestInputPos(t,H.LEFT))):t}totalInputPositions(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);let a=0;return this._forEachBlocksInRange(t,n,(o,r,s,i)=>{a+=o.totalInputPositions(s,i)}),a}maskedBlock(t){return this.maskedBlocks(t)[0]}maskedBlocks(t){const n=this._maskedBlocks[t];return n?n.map(a=>this._blocks[a]):[]}pad(t){const n=new te;return this._forEachBlocksInRange(0,this.displayValue.length,a=>n.aggregate(a.pad(t))),n}}fe.DEFAULTS={...he.DEFAULTS,lazy:!0,placeholderChar:"_"},fe.STOP_CHAR="`",fe.ESCAPE_CHAR="\\",fe.InputDefinition=Ze,fe.FixedDefinition=Ht,Q.MaskedPattern=fe;class Je extends fe{get _matchFrom(){return this.maxLength-String(this.from).length}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){const{to:n=this.to||0,from:a=this.from||0,maxLength:o=this.maxLength||0,autofix:r=this.autofix,...s}=t;this.to=n,this.from=a,this.maxLength=Math.max(String(n).length,o),this.autofix=r;const i=String(this.from).padStart(this.maxLength,"0"),d=String(this.to).padStart(this.maxLength,"0");let u=0;for(;u<d.length&&d[u]===i[u];)++u;s.mask=d.slice(0,u).replace(/0/g,"\\0")+"0".repeat(this.maxLength-u),super._update(s)}get isComplete(){return super.isComplete&&!!this.value}boundaries(t){let n="",a="";const[,o,r]=t.match(/^(\D*)(\d*)(\D*)/)||[];return r&&(n="0".repeat(o.length)+r,a="9".repeat(o.length)+r),n=n.padEnd(this.maxLength,"0"),a=a.padEnd(this.maxLength,"9"),[n,a]}doPrepareChar(t,n){n===void 0&&(n={});let a;return[t,a]=super.doPrepareChar(t.replace(/\D/g,""),n),t||(a.skip=!this.isComplete),[t,a]}_appendCharRaw(t,n){if(n===void 0&&(n={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(t,n);const a=String(this.from).padStart(this.maxLength,"0"),o=String(this.to).padStart(this.maxLength,"0"),[r,s]=this.boundaries(this.value+t);return Number(s)<this.from?super._appendCharRaw(a[this.value.length],n):Number(r)>this.to?!n.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(a[this.value.length],n).aggregate(this._appendCharRaw(t,n)):super._appendCharRaw(o[this.value.length],n):super._appendCharRaw(t,n)}doValidate(t){const n=this.value;if(n.search(/[^0]/)===-1&&n.length<=this._matchFrom)return!0;const[o,r]=this.boundaries(n);return this.from<=Number(r)&&Number(o)<=this.to&&super.doValidate(t)}pad(t){const n=new te;if(this.value.length===this.maxLength)return n;const a=this.value,o=this.maxLength-this.value.length;if(o){this.reset();for(let r=0;r<o;++r)n.aggregate(super._appendCharRaw("0",t));a.split("").forEach(r=>this._appendCharRaw(r))}return n}}Q.MaskedRange=Je;const bu="d{.}`m{.}`Y";class Ce extends fe{static extractPatternOptions(t){const{mask:n,pattern:a,...o}=t;return{...o,mask:$e(n)?n:a}}constructor(t){super(Ce.extractPatternOptions({...Ce.DEFAULTS,...t}))}updateOptions(t){super.updateOptions(t)}_update(t){const{mask:n,pattern:a,blocks:o,...r}={...Ce.DEFAULTS,...t},s=Object.assign({},Ce.GET_DEFAULT_BLOCKS());t.min&&(s.Y.from=t.min.getFullYear()),t.max&&(s.Y.to=t.max.getFullYear()),t.min&&t.max&&s.Y.from===s.Y.to&&(s.m.from=t.min.getMonth()+1,s.m.to=t.max.getMonth()+1,s.m.from===s.m.to&&(s.d.from=t.min.getDate(),s.d.to=t.max.getDate())),Object.assign(s,this.blocks,o),super._update({...r,mask:$e(n)?n:a,blocks:s})}doValidate(t){const n=this.date;return super.doValidate(t)&&(!this.isComplete||this.isDateExist(this.value)&&n!=null&&(this.min==null||this.min<=n)&&(this.max==null||n<=this.max))}isDateExist(t){return this.format(this.parse(t,this),this).indexOf(t)>=0}get date(){return this.typedValue}set date(t){this.typedValue=t}get typedValue(){return this.isComplete?super.typedValue:null}set typedValue(t){super.typedValue=t}maskEquals(t){return t===Date||super.maskEquals(t)}optionsIsChanged(t){return super.optionsIsChanged(Ce.extractPatternOptions(t))}}Ce.GET_DEFAULT_BLOCKS=()=>({d:{mask:Je,from:1,to:31,maxLength:2},m:{mask:Je,from:1,to:12,maxLength:2},Y:{mask:Je,from:1900,to:9999}}),Ce.DEFAULTS={...fe.DEFAULTS,mask:Date,pattern:bu,format:(l,t)=>{if(!l)return"";const n=String(l.getDate()).padStart(2,"0"),a=String(l.getMonth()+1).padStart(2,"0"),o=l.getFullYear();return[n,a,o].join(".")},parse:(l,t)=>{const[n,a,o]=l.split(".").map(Number);return new Date(o,a-1,n)}},Q.MaskedDate=Ce;class Xe extends he{constructor(t){super({...Xe.DEFAULTS,...t}),this.currentMask=void 0}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),"mask"in t&&(this.exposeMask=void 0,this.compiledMasks=Array.isArray(t.mask)?t.mask.map(n=>{const{expose:a,...o}=Ue(n),r=Be({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...o});return a&&(this.exposeMask=r),r}):[])}_appendCharRaw(t,n){n===void 0&&(n={});const a=this._applyDispatch(t,n);return this.currentMask&&a.aggregate(this.currentMask._appendChar(t,this.currentMaskFlags(n))),a}_applyDispatch(t,n,a){t===void 0&&(t=""),n===void 0&&(n={}),a===void 0&&(a="");const o=n.tail&&n._beforeTailState!=null?n._beforeTailState._value:this.value,r=this.rawInputValue,s=n.tail&&n._beforeTailState!=null?n._beforeTailState._rawInputValue:r,i=r.slice(s.length),d=this.currentMask,u=new te,m=d?.state;return this.currentMask=this.doDispatch(t,{...n},a),this.currentMask&&(this.currentMask!==d?(this.currentMask.reset(),s&&(this.currentMask.append(s,{raw:!0}),u.tailShift=this.currentMask.value.length-o.length),i&&(u.tailShift+=this.currentMask.append(i,{raw:!0,tail:!0}).tailShift)):m&&(this.currentMask.state=m)),u}_appendPlaceholder(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendPlaceholder()),t}_appendEager(){const t=this._applyDispatch();return this.currentMask&&t.aggregate(this.currentMask._appendEager()),t}appendTail(t){const n=new te;return t&&n.aggregate(this._applyDispatch("",{},t)),n.aggregate(this.currentMask?this.currentMask.appendTail(t):super.appendTail(t))}currentMaskFlags(t){var n,a;return{...t,_beforeTailState:((n=t._beforeTailState)==null?void 0:n.currentMaskRef)===this.currentMask&&((a=t._beforeTailState)==null?void 0:a.currentMask)||t._beforeTailState}}doDispatch(t,n,a){return n===void 0&&(n={}),a===void 0&&(a=""),this.dispatch(t,this,n,a)}doValidate(t){return super.doValidate(t)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(t)))}doPrepare(t,n){n===void 0&&(n={});let[a,o]=super.doPrepare(t,n);if(this.currentMask){let r;[a,r]=super.doPrepare(a,this.currentMaskFlags(n)),o=o.aggregate(r)}return[a,o]}doPrepareChar(t,n){n===void 0&&(n={});let[a,o]=super.doPrepareChar(t,n);if(this.currentMask){let r;[a,r]=super.doPrepareChar(a,this.currentMaskFlags(n)),o=o.aggregate(r)}return[a,o]}reset(){var t;(t=this.currentMask)==null||t.reset(),this.compiledMasks.forEach(n=>n.reset())}get value(){return this.exposeMask?this.exposeMask.value:this.currentMask?this.currentMask.value:""}set value(t){this.exposeMask?(this.exposeMask.value=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.value=t}get unmaskedValue(){return this.exposeMask?this.exposeMask.unmaskedValue:this.currentMask?this.currentMask.unmaskedValue:""}set unmaskedValue(t){this.exposeMask?(this.exposeMask.unmaskedValue=t,this.currentMask=this.exposeMask,this._applyDispatch()):super.unmaskedValue=t}get typedValue(){return this.exposeMask?this.exposeMask.typedValue:this.currentMask?this.currentMask.typedValue:""}set typedValue(t){if(this.exposeMask){this.exposeMask.typedValue=t,this.currentMask=this.exposeMask,this._applyDispatch();return}let n=String(t);this.currentMask&&(this.currentMask.typedValue=t,n=this.currentMask.unmaskedValue),this.unmaskedValue=n}get displayValue(){return this.currentMask?this.currentMask.displayValue:""}get isComplete(){var t;return!!((t=this.currentMask)!=null&&t.isComplete)}get isFilled(){var t;return!!((t=this.currentMask)!=null&&t.isFilled)}remove(t,n){const a=new te;return this.currentMask&&a.aggregate(this.currentMask.remove(t,n)).aggregate(this._applyDispatch()),a}get state(){var t;return{...super.state,_rawInputValue:this.rawInputValue,compiledMasks:this.compiledMasks.map(n=>n.state),currentMaskRef:this.currentMask,currentMask:(t=this.currentMask)==null?void 0:t.state}}set state(t){const{compiledMasks:n,currentMaskRef:a,currentMask:o,...r}=t;n&&this.compiledMasks.forEach((s,i)=>s.state=n[i]),a!=null&&(this.currentMask=a,this.currentMask.state=o),super.state=r}extractInput(t,n,a){return this.currentMask?this.currentMask.extractInput(t,n,a):""}extractTail(t,n){return this.currentMask?this.currentMask.extractTail(t,n):super.extractTail(t,n)}doCommit(){this.currentMask&&this.currentMask.doCommit(),super.doCommit()}nearestInputPos(t,n){return this.currentMask?this.currentMask.nearestInputPos(t,n):super.nearestInputPos(t,n)}get overwrite(){return this.currentMask?this.currentMask.overwrite:this._overwrite}set overwrite(t){this._overwrite=t}get eager(){return this.currentMask?this.currentMask.eager:this._eager}set eager(t){this._eager=t}get skipInvalid(){return this.currentMask?this.currentMask.skipInvalid:this._skipInvalid}set skipInvalid(t){this._skipInvalid=t}get autofix(){return this.currentMask?this.currentMask.autofix:this._autofix}set autofix(t){this._autofix=t}maskEquals(t){return Array.isArray(t)?this.compiledMasks.every((n,a)=>{if(!t[a])return;const{mask:o,...r}=t[a];return gt(n,r)&&n.maskEquals(o)}):super.maskEquals(t)}typedValueEquals(t){var n;return!!((n=this.currentMask)!=null&&n.typedValueEquals(t))}}Xe.DEFAULTS={...he.DEFAULTS,dispatch:(l,t,n,a)=>{if(!t.compiledMasks.length)return;const o=t.rawInputValue,r=t.compiledMasks.map((s,i)=>{const d=t.currentMask===s,u=d?s.displayValue.length:s.nearestInputPos(s.displayValue.length,H.FORCE_LEFT);return s.rawInputValue!==o?(s.reset(),s.append(o,{raw:!0})):d||s.remove(u),s.append(l,t.currentMaskFlags(n)),s.appendTail(a),{index:i,weight:s.rawInputValue.length,totalInputPositions:s.totalInputPositions(0,Math.max(u,s.nearestInputPos(s.displayValue.length,H.FORCE_LEFT)))}});return r.sort((s,i)=>i.weight-s.weight||i.totalInputPositions-s.totalInputPositions),t.compiledMasks[r[0].index]}},Q.MaskedDynamic=Xe;class Qe extends fe{constructor(t){super({...Qe.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){const{enum:n,...a}=t;if(n){const o=n.map(i=>i.length),r=Math.min(...o),s=Math.max(...o)-r;a.mask="*".repeat(r),s&&(a.mask+="["+"*".repeat(s)+"]"),this.enum=n}super._update(a)}_appendCharRaw(t,n){n===void 0&&(n={});const a=Math.min(this.nearestInputPos(0,H.FORCE_RIGHT),this.value.length),o=this.enum.filter(r=>this.matchValue(r,this.unmaskedValue+t,a));if(o.length){o.length===1&&this._forEachBlocksInRange(0,this.value.length,(s,i)=>{const d=o[0][i];i>=this.value.length||d===s.value||(s.reset(),s._appendChar(d,n))});const r=super._appendCharRaw(o[0][this.value.length],n);return o.length===1&&o[0].slice(this.unmaskedValue.length).split("").forEach(s=>r.aggregate(super._appendCharRaw(s))),r}return new te({skip:!this.isComplete})}extractTail(t,n){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),new ve("",t)}remove(t,n){if(t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),t===n)return new te;const a=Math.min(super.nearestInputPos(0,H.FORCE_RIGHT),this.value.length);let o;for(o=t;o>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(a,o),a)).length>1);--o);const r=super.remove(o,n);return r.tailShift+=o-t,r}get isComplete(){return this.enum.indexOf(this.value)>=0}}Qe.DEFAULTS={...fe.DEFAULTS,matchValue:(l,t,n)=>l.indexOf(t,n)===n},Q.MaskedEnum=Qe;class Gn extends he{updateOptions(t){super.updateOptions(t)}_update(t){super._update({...t,validate:t.mask})}}Q.MaskedFunction=Gn;var Kn;class ke extends he{constructor(t){super({...ke.DEFAULTS,...t})}updateOptions(t){super.updateOptions(t)}_update(t){super._update(t),this._updateRegExps()}_updateRegExps(){const t="^"+(this.allowNegative?"[+|\\-]?":""),n="\\d*",a=(this.scale?"("+Pt(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(t+n+a),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Pt).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Pt(this.thousandsSeparator),"g")}_removeThousandsSeparators(t){return t.replace(this._thousandsSeparatorRegExp,"")}_insertThousandsSeparators(t){const n=t.split(this.radix);return n[0]=n[0].replace(/\B(?=(\d{3})+(?!\d))/g,this.thousandsSeparator),n.join(this.radix)}doPrepareChar(t,n){n===void 0&&(n={});const[a,o]=super.doPrepareChar(this._removeThousandsSeparators(this.scale&&this.mapToRadix.length&&(n.input&&n.raw||!n.input&&!n.raw)?t.replace(this._mapToRadixRegExp,this.radix):t),n);return t&&!a&&(o.skip=!0),a&&!this.allowPositive&&!this.value&&a!=="-"&&o.aggregate(this._appendChar("-")),[a,o]}_separatorsCount(t,n){n===void 0&&(n=!1);let a=0;for(let o=0;o<t;++o)this._value.indexOf(this.thousandsSeparator,o)===o&&(++a,n&&(t+=this.thousandsSeparator.length));return a}_separatorsCountFromSlice(t){return t===void 0&&(t=this._value),this._separatorsCount(this._removeThousandsSeparators(t).length,!0)}extractInput(t,n,a){return t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n),this._removeThousandsSeparators(super.extractInput(t,n,a))}_appendCharRaw(t,n){n===void 0&&(n={});const a=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,o=this._separatorsCountFromSlice(a);this._value=this._removeThousandsSeparators(this.value);const r=this._value;this._value+=t;const s=this.number;let i=!isNaN(s),d=!1;if(i){let E;this.min!=null&&this.min<0&&this.number<this.min&&(E=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(E=this.max),E!=null&&(this.autofix?(this._value=this.format(E,this).replace(ke.UNMASKED_RADIX,this.radix),d||(d=r===this._value&&!n.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let u;i?u=new te({inserted:this._value.slice(r.length),rawInserted:d?"":t,skip:d}):(this._value=r,u=new te),this._value=this._insertThousandsSeparators(this._value);const m=n.tail&&n._beforeTailState?n._beforeTailState._value:this._value,h=this._separatorsCountFromSlice(m);return u.tailShift+=(h-o)*this.thousandsSeparator.length,u}_findSeparatorAround(t){if(this.thousandsSeparator){const n=t-this.thousandsSeparator.length+1,a=this.value.indexOf(this.thousandsSeparator,n);if(a<=t)return a}return-1}_adjustRangeWithSeparators(t,n){const a=this._findSeparatorAround(t);a>=0&&(t=a);const o=this._findSeparatorAround(n);return o>=0&&(n=o+this.thousandsSeparator.length),[t,n]}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length),[t,n]=this._adjustRangeWithSeparators(t,n);const a=this.value.slice(0,t),o=this.value.slice(n),r=this._separatorsCount(a.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(a+o));const s=this._separatorsCountFromSlice(a);return new te({tailShift:(s-r)*this.thousandsSeparator.length})}nearestInputPos(t,n){if(!this.thousandsSeparator)return t;switch(n){case H.NONE:case H.LEFT:case H.FORCE_LEFT:{const a=this._findSeparatorAround(t-1);if(a>=0){const o=a+this.thousandsSeparator.length;if(t<o||this.value.length<=o||n===H.FORCE_LEFT)return a}break}case H.RIGHT:case H.FORCE_RIGHT:{const a=this._findSeparatorAround(t);if(a>=0)return a+this.thousandsSeparator.length}}return t}doCommit(){if(this.value){const t=this.number;let n=t;this.min!=null&&(n=Math.max(n,this.min)),this.max!=null&&(n=Math.min(n,this.max)),n!==t&&(this.unmaskedValue=this.format(n,this));let a=this.value;this.normalizeZeros&&(a=this._normalizeZeros(a)),this.padFractionalZeros&&this.scale>0&&(a=this._padFractionalZeros(a)),this._value=a}super.doCommit()}_normalizeZeros(t){const n=this._removeThousandsSeparators(t).split(this.radix);return n[0]=n[0].replace(/^(\D*)(0*)(\d*)/,(a,o,r,s)=>o+s),t.length&&!/\d$/.test(n[0])&&(n[0]=n[0]+"0"),n.length>1&&(n[1]=n[1].replace(/0*$/,""),n[1].length||(n.length=1)),this._insertThousandsSeparators(n.join(this.radix))}_padFractionalZeros(t){if(!t)return t;const n=t.split(this.radix);return n.length<2&&n.push(""),n[1]=n[1].padEnd(this.scale,"0"),n.join(this.radix)}doSkipInvalid(t,n,a){n===void 0&&(n={});const o=this.scale===0&&t!==this.thousandsSeparator&&(t===this.radix||t===ke.UNMASKED_RADIX||this.mapToRadix.includes(t));return super.doSkipInvalid(t,n,a)&&!o}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,ke.UNMASKED_RADIX)}set unmaskedValue(t){super.unmaskedValue=t}get typedValue(){return this.parse(this.unmaskedValue,this)}set typedValue(t){this.rawInputValue=this.format(t,this).replace(ke.UNMASKED_RADIX,this.radix)}get number(){return this.typedValue}set number(t){this.typedValue=t}get allowNegative(){return this.min!=null&&this.min<0||this.max!=null&&this.max<0}get allowPositive(){return this.min!=null&&this.min>0||this.max!=null&&this.max>0}typedValueEquals(t){return(super.typedValueEquals(t)||ke.EMPTY_VALUES.includes(t)&&ke.EMPTY_VALUES.includes(this.typedValue))&&!(t===0&&this.value==="")}}Kn=ke,ke.UNMASKED_RADIX=".",ke.EMPTY_VALUES=[...he.EMPTY_VALUES,0],ke.DEFAULTS={...he.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Kn.UNMASKED_RADIX],min:Number.MIN_SAFE_INTEGER,max:Number.MAX_SAFE_INTEGER,scale:2,normalizeZeros:!0,padFractionalZeros:!1,parse:Number,format:l=>l.toLocaleString("en-US",{useGrouping:!1,maximumFractionDigits:20})},Q.MaskedNumber=ke;const bt={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function qt(l,t,n){t===void 0&&(t=bt.MASKED),n===void 0&&(n=bt.MASKED);const a=Be(l);return o=>a.runIsolated(r=>(r[t]=o,r[n]))}function Yn(l,t,n,a){return qt(t,n,a)(l)}Q.PIPE_TYPE=bt,Q.createPipe=qt,Q.pipe=Yn;class Wn extends fe{get repeatFrom(){var t;return(t=Array.isArray(this.repeat)?this.repeat[0]:this.repeat===1/0?0:this.repeat)!=null?t:0}get repeatTo(){var t;return(t=Array.isArray(this.repeat)?this.repeat[1]:this.repeat)!=null?t:1/0}constructor(t){super(t)}updateOptions(t){super.updateOptions(t)}_update(t){var n,a,o;const{repeat:r,...s}=Ue(t);this._blockOpts=Object.assign({},this._blockOpts,s);const i=Be(this._blockOpts);this.repeat=(n=(a=r??i.repeat)!=null?a:this.repeat)!=null?n:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((o=this._blocks)==null?void 0:o.length)||0,this.repeatFrom)),blocks:{m:i},eager:i.eager,overwrite:i.overwrite,skipInvalid:i.skipInvalid,lazy:i.lazy,placeholderChar:i.placeholderChar,displayChar:i.displayChar})}_allocateBlock(t){if(t<this._blocks.length)return this._blocks[t];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(Be(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(t,n){n===void 0&&(n={});const a=new te;for(let d=(o=(r=this._mapPosToBlock(this.displayValue.length))==null?void 0:r.index)!=null?o:Math.max(this._blocks.length-1,0),u,m;u=(s=this._blocks[d])!=null?s:m=!m&&this._allocateBlock(d);++d){var o,r,s,i;const h=u._appendChar(t,{...n,_beforeTailState:(i=n._beforeTailState)==null||(i=i._blocks)==null?void 0:i[d]});if(h.skip&&m){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(a.aggregate(h),h.consumed)break}return a}_trimEmptyTail(t,n){var a,o;t===void 0&&(t=0);const r=Math.max(((a=this._mapPosToBlock(t))==null?void 0:a.index)||0,this.repeatFrom,0);let s;n!=null&&(s=(o=this._mapPosToBlock(n))==null?void 0:o.index),s==null&&(s=this._blocks.length-1);let i=0;for(let d=s;r<=d&&!this._blocks[d].unmaskedValue;--d,++i);i&&(this._blocks.splice(s-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(t,n){t===void 0&&(t=0),n===void 0&&(n=this.displayValue.length);const a=super.remove(t,n);return this._trimEmptyTail(t,n),a}totalInputPositions(t,n){return t===void 0&&(t=0),n==null&&this.repeatTo===1/0?1/0:super.totalInputPositions(t,n)}get state(){return super.state}set state(t){this._blocks.length=t._blocks.length,this.mask=this.mask.slice(0,this._blocks.length),super.state=t}}Q.RepeatBlock=Wn;try{globalThis.IMask=Q}catch{}const Gt=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:te,ChunksTailDetails:De,DIRECTION:H,HTMLContenteditableMaskElement:Ut,HTMLInputMaskElement:Un,HTMLMaskElement:We,InputMask:Hn,MaskElement:yt,Masked:he,MaskedDate:Ce,MaskedDynamic:Xe,MaskedEnum:Qe,MaskedFunction:Gn,MaskedNumber:ke,MaskedPattern:fe,MaskedRange:Je,MaskedRegExp:qn,PIPE_TYPE:bt,PatternFixedDefinition:Ht,PatternInputDefinition:Ze,RepeatBlock:Wn,createMask:Be,createPipe:qt,default:Q,forceDirection:zn,normalizeOpts:Ue,pipe:Yn},Symbol.toStringTag,{value:"Module"}));ne.ModalEdit=Cn,ne.VForm=Me,ne.VsInputAddress=xn,ne.VsInputArray=wn,ne.VsInputCheckbox=Xt,ne.VsInputCodegen=fn,ne.VsInputColor=kn,ne.VsInputContainer=sn,ne.VsInputDate=fu,ne.VsInputEmail=Dt,ne.VsInputFile=an,ne.VsInputFileList=on,ne.VsInputKeyValue=gn,ne.VsInputMask=$t,ne.VsInputNumber=Jt,ne.VsInputRadio=Ft,ne.VsInputRange=bn,ne.VsInputSelect=Lt,ne.VsInputSlug=hn,ne.VsInputStatic=Mt,ne.VsInputSwitcher=St,ne.VsInputTag=mn,ne.VsInputTel=At,ne.VsInputText=ze,ne.VsInputTextArray=yn,ne.VsInputTextarea=dn,ne.default=Me,ne.inputs=En,ne.vsInputDatatable=un,ne.vsInputMap=pn,Object.defineProperties(ne,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(Fe,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("vue"),require("@opengis/core")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core"],o):(Fe=typeof globalThis<"u"?globalThis:Fe||self,o(Fe.FormBuilder={},Fe.Vue,Fe.OpenGISCore))})(this,function(Fe,o,nt){"use strict";const Fd=o.defineComponent({__name:"vs-info-tooltip",props:{text:{}},setup(n){const e=n,t=o.ref(!1),r=o.ref({top:"0px",left:"0px"});function s(a){if(!e.text)return;const i=a.currentTarget.getBoundingClientRect();r.value={top:`${i.bottom+4}px`,left:`${Math.min(i.left,window.innerWidth-230)}px`},t.value=!0}function l(){t.value=!1}return(a,i)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createElementVNode("span",{class:"inline-flex items-center",onMouseenter:s,onMouseleave:l},[o.renderSlot(a.$slots,"default",{},()=>[i[0]||(i[0]=o.createElementVNode("svg",{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",class:"text-gray-400 cursor-help"},[o.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),o.createElementVNode("path",{d:"M12 16v-4"}),o.createElementVNode("path",{d:"M12 8h.01"})],-1))])],32),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[t.value&&a.text?(o.openBlock(),o.createElementBlock("div",{key:0,style:o.normalizeStyle(r.value),class:"fixed z-[9999] max-w-xs p-2 bg-gray-900 text-white text-xs rounded-lg shadow-lg pointer-events-none"},o.toDisplayString(a.text),5)):o.createCommentVNode("",!0)]))],64))}}),Qg={class:"w-full relative"},ey={key:0,class:"text-[14px] font-medium text-gray-900 mb-2 flex items-center gap-1"},ty={class:"opacity-100"},ny={key:0,class:"text-red-500 text-[14px]"},ry={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},oy=o.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){const e=n,t=o.computed(()=>typeof e.item?.label=="string"&&e.item.label?e.item.label:e.item?.ua||e.label||e.ua),r=o.computed(()=>!!t.value),s=o.computed(()=>!!e.item?.rules?.includes("required")),l=o.computed(()=>e.item?.info||"");return(a,i)=>(o.openBlock(),o.createElementBlock("div",Qg,[r.value?(o.openBlock(),o.createElementBlock("div",ey,[o.createElementVNode("span",ty,o.toDisplayString(t.value),1),s.value?(o.openBlock(),o.createElementBlock("span",ny,"*")):o.createCommentVNode("",!0),l.value?(o.openBlock(),o.createBlock(Fd,{key:1,text:l.value},null,8,["text"])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),o.renderSlot(a.$slots,"default",o.mergeProps(a.$attrs,{class:{"opacity-60":a.item.disabled}})),a.error?(o.openBlock(),o.createElementBlock("span",ry,o.toDisplayString(a.error),1)):o.createCommentVNode("",!0)]))}}),sy={class:"w-full relative flex flex-row items-center gap-2"},ly={key:0,class:"text-red-500 text-[14px]"},ay={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},iy=o.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{default:()=>({container:12,label:3})}},setup(n){const e=n,t=o.computed(()=>e.item?.label||e.label||e.ua),r=o.computed(()=>e.item?.info||""),s=o.computed(()=>e.columns??{container:12,label:3}),l=o.computed(()=>{const{container:d,label:u}=s.value;return!d||d<=0?0:Math.min(Math.max(u??0,0),d)/d}),a=o.computed(()=>e.item?.type==="html"||l.value<=0?!1:!!t.value),i=o.computed(()=>{if(!a.value)return{};const d=`${l.value*100}%`;return{flexBasis:d,maxWidth:d}}),c=o.computed(()=>{const{container:d,label:u}=s.value;if(!d||d<=0)return{};if(e.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!a.value)return{flexBasis:"100%",maxWidth:"100%"};const p=Math.max(d-Math.max(u??0,0),0)/d;if(!p)return{};const h=`${p*100}%`;return{flexBasis:h,maxWidth:h}});return(d,u)=>(o.openBlock(),o.createElementBlock("div",sy,[a.value?(o.openBlock(),o.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0 items-center gap-1",style:o.normalizeStyle(i.value)},[o.createTextVNode(o.toDisplayString(t.value)+" ",1),d.item?.rules?.includes("required")&&t.value?(o.openBlock(),o.createElementBlock("span",ly,"*")):o.createCommentVNode("",!0),r.value?(o.openBlock(),o.createBlock(Fd,{key:1,text:r.value},null,8,["text"])):o.createCommentVNode("",!0)],4)):o.createCommentVNode("",!0),o.createElementVNode("div",{class:"flex-1 min-w-0",style:o.normalizeStyle(c.value)},[o.renderSlot(d.$slots,"default",o.normalizeProps(o.guardReactiveProps(d.$attrs)))],4),d.error?(o.openBlock(),o.createElementBlock("span",ay,o.toDisplayString(d.error),1)):o.createCommentVNode("",!0)]))}}),cy={class:"w-full relative"},dy={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},uy=o.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){return(e,t)=>(o.openBlock(),o.createElementBlock("div",cy,[o.renderSlot(e.$slots,"default",o.normalizeProps(o.guardReactiveProps(e.$attrs))),e.error?(o.openBlock(),o.createElementBlock("span",dy,o.toDisplayString(e.error),1)):o.createCommentVNode("",!0)]))}}),py={class:"flex-1 min-w-0"},hy={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},fy={class:"truncate"},my={key:0,class:"text-red-500 text-[14px]"},gy=["innerHTML"],yy={key:0,class:"mt-1 text-xs text-red-500"},by={default:oy,horizontal:iy,inline:uy,settings:o.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){const e=n,t=o.ref("uk");o.computed(()=>(e.item??{})?.[t.value]??e.ua??e.label??"");const r=o.computed(()=>e.item?.description??""),s=o.computed(()=>Array.isArray(e.item?.rules)&&e.item.rules.includes("required")),l=o.computed(()=>(typeof e.error=="string"?e.error:"")??""),a=()=>{const i=typeof localStorage<"u"?localStorage.getItem("locale"):null;t.value=i||"uk"};return o.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(t.value=localStorage.locale)}catch{}window.addEventListener("storage",a)}),o.onUnmounted(()=>{window.removeEventListener("storage",a)}),(i,c)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["w-full relative",{"opacity-60":i.item?.disabled}])},[o.createElementVNode("div",{class:o.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(i.item.type)?"flex flex-col":""]])},[o.createElementVNode("div",py,[i.ua||i.label?(o.openBlock(),o.createElementBlock("p",hy,[o.createElementVNode("span",fy,o.toDisplayString(i.item[t.value]||i.ua||i.label),1),s.value?(o.openBlock(),o.createElementBlock("span",my,"*")):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),r.value?(o.openBlock(),o.createElementBlock("p",{key:1,class:"text-xs text-slate-500 dark:text-slate-400",innerHTML:r.value},null,8,gy)):o.createCommentVNode("",!0)]),o.createElementVNode("div",{class:o.normalizeClass(["w-full",["select","native-select"].includes(i.item.type)?"md:w-[30%]":"md:w-auto"])},[o.renderSlot(i.$slots,"default",o.normalizeProps(o.guardReactiveProps(i.$attrs)))],2)],2),l.value?(o.openBlock(),o.createElementBlock("p",yy,o.toDisplayString(l.value),1)):o.createCommentVNode("",!0)],2))}})};function Ot(n){return{inputClass:o.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 ky=["placeholder","disabled"],wy=o.defineComponent({__name:"vs-input-password",props:o.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=Ot(e.style),r=o.useModel(n,"modelValue"),s=o.computed(()=>!!e.disabled),l=o.computed(()=>e.placeholder??"");return(a,i)=>o.withDirectives((o.openBlock(),o.createElementBlock("input",{type:"password","onUpdate:modelValue":i[0]||(i[0]=c=>r.value=c),placeholder:l.value,disabled:s.value,class:o.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[o.unref(t),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,ky)),[[o.vModelText,r.value]])}}),xy=["placeholder","disabled","maxlength","minlength"],Xr=o.defineComponent({__name:"vs-input-text",props:o.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=Ot(e.style),r=o.useModel(n,"modelValue"),s=o.computed(()=>!!e.disabled),l=o.computed(()=>e.placeholder??""),a=o.computed(()=>e.maxlength??void 0),i=o.computed(()=>e.minlength??void 0);function c(){typeof r.value=="string"&&(r.value=r.value.trim())}return(d,u)=>o.withDirectives((o.openBlock(),o.createElementBlock("input",{type:"text","onUpdate:modelValue":u[0]||(u[0]=p=>r.value=p),placeholder:l.value,disabled:s.value,maxlength:a.value,minlength:i.value,onBlur:c,class:o.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[d.customClass,o.unref(t),{"!border-red-600":d.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,xy)),[[o.vModelText,r.value]])}}),vy=["placeholder","disabled","min","max"],$d=o.defineComponent({__name:"vs-input-number",props:o.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=Ot(e.style),r=o.useModel(n,"modelValue"),s=o.computed(()=>!!e.disabled);return(l,a)=>o.withDirectives((o.openBlock(),o.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":a[0]||(a[0]=i=>r.value=i),placeholder:l.placeholder,disabled:s.value,class:o.normalizeClass(["py-1.5 px-3 block w-full bg-white",[o.unref(t)]]),style:{border:"1px solid #CFD9E0"},min:l.min,max:l.max},null,10,vy)),[[o.vModelText,r.value]])}}),Ve=(n,e)=>{const t=n.__vccOpts||n;for(const[r,s]of e)t[r]=s;return t},Ey={},Cy={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 _y(n,e){return o.openBlock(),o.createElementBlock("svg",Cy,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const Sy=Ve(Ey,[["render",_y]]),Ny={class:"flex items-center gap-[4px]"},Vy=["value","id","disabled"],My=["for"],By={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},Ay=o.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=e,r=n,s=o.computed({get:()=>r.modelValue,set:a=>t("update:modelValue",a)}),l=o.computed(()=>!!r.disabled);return(a,i)=>(o.openBlock(),o.createElementBlock("div",Ny,[o.withDirectives(o.createElementVNode("input",{type:"checkbox",value:a.value,"onUpdate:modelValue":i[0]||(i[0]=c=>s.value=c),class:o.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":l.value}]),id:a.id,disabled:l.value},null,10,Vy),[[o.vModelCheckbox,s.value]]),o.createElementVNode("label",{for:a.id,class:o.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":l.value}])},[o.createElementVNode("div",{class:o.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[s.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",a.error?"border-red-600":""]])},[o.createVNode(Sy,{height:"12",width:"12"})],2),o.createElementVNode("span",By,[o.renderSlot(a.$slots,"default",{},()=>[o.createTextVNode(o.toDisplayString(a.label),1)])])],10,My)]))}}),Ty=["name","value","disabled"],Ly={class:"flex items-center gap-[6px] text-[14px]"},Dy={key:0,class:"text-[16px]"},Oy=["src"],Iy=o.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,s=o.computed({get:()=>t.modelValue,set:i=>{r("update:modelValue",i)}}),l=o.computed(()=>Array.isArray(s.value)?s.value.includes(t.value):s.value===!0||s.value===t.value),a=o.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(i,c)=>(o.openBlock(),o.createElementBlock("label",{class:o.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[a.value,l.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[o.withDirectives(o.createElementVNode("input",{type:"checkbox",class:"hidden",name:i.id,value:i.value,"onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),disabled:i.disabled},null,8,Ty),[[o.vModelCheckbox,s.value]]),o.createElementVNode("span",Ly,[i.icon||i.imgUrl?(o.openBlock(),o.createElementBlock("span",Dy,[i.icon?(o.openBlock(),o.createElementBlock("i",{key:0,class:o.normalizeClass(i.icon)},null,2)):o.createCommentVNode("",!0),i.imgUrl?(o.openBlock(),o.createElementBlock("img",{key:1,src:i.imgUrl,width:"16",height:"16",alt:"icon"},null,8,Oy)):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),o.renderSlot(i.$slots,"default",{},()=>[o.createTextVNode(o.toDisplayString(i.label),1)])])],2))}}),Fy={class:"flex items-center"},$a=o.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,s=`radio-${Math.floor(Math.random()*1e4)}`,l=o.computed({get:()=>Array.isArray(t.modelValue)?Array.isArray(t.modelValue)&&t.modelValue.includes(t.value):t.modelValue,set:i=>{if(Array.isArray(t.modelValue)){let c=[...t.modelValue];i?c.includes(t.value)||c.push(t.value):c=c.filter(d=>d!==t.value),r("update:modelValue",c)}else r("update:modelValue",i)}}),a=o.ref(`vs-checkbox-${t.view||"default"}`);return(i,c)=>(o.openBlock(),o.createElementBlock("div",Fy,[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(a.value==="vs-checkbox-buttons"?o.unref(Iy):o.unref(Ay)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:l.value,"onUpdate:modelValue":c[0]||(c[0]=d=>l.value=d),id:s,icon:i.icon,imgUrl:i.imgUrl,style:o.normalizeStyle(i.style),error:i.error},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),$y={},Ry={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 Py(n,e){return o.openBlock(),o.createElementBlock("svg",Ry,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const zy=Ve($y,[["render",Py]]),jy={},Hy={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 Uy(n,e){return o.openBlock(),o.createElementBlock("svg",Hy,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),o.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const Ra=Ve(jy,[["render",Uy]]),Wy={},Ky={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 qy(n,e){return o.openBlock(),o.createElementBlock("svg",Ky,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M12 9h.01"},null,-1),o.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),o.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 Gy=Ve(Wy,[["render",qy]]),Yy={key:0,class:"flex items-start gap-x-1"},Jy={key:0,class:"text-red-500 text-[14px]"},Zy=["title"],Xy=["disabled"],Pa=o.defineComponent({__name:"vs-input-switcher",props:o.mergeModels({rules:{default:()=>[]},view:{default:"checkbox"},label:{default:""},i:{default:""},text:{default:""},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=o.useModel(n,"modelValue");return(r,s)=>e.view==="checkbox"?(o.openBlock(),o.createElementBlock("div",Yy,[o.createVNode($a,{modelValue:t.value,"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l),label:r.text,error:r.error||""},null,8,["modelValue","label","error"]),r.rules?.includes("required")?(o.openBlock(),o.createElementBlock("span",Jy,"*")):o.createCommentVNode("",!0),r.i?(o.openBlock(),o.createElementBlock("button",{key:1,class:"cursor-pointer",title:r.i,onClick:s[1]||(s[1]=o.withModifiers(()=>{},["prevent"]))},[o.createVNode(o.unref(Gy),{class:"text-gray-500 w-[14px] h-[14px]"})],8,Zy)):o.createCommentVNode("",!0)])):(o.openBlock(),o.createElementBlock("button",{key:1,type:"button",class:o.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-${r.style?.primaryColor||"blue"}-500`:"bg-stone-200",r.customClass]]),disabled:r.disabled,onClick:s[2]||(s[2]=l=>t.value=!t.value)},[o.createElementVNode("span",{"data-state":"checked",class:o.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,Xy))}}),Qy=["id","innerHTML"],za=o.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},setup(n){return(e,t)=>(o.openBlock(),o.createElementBlock("div",{id:e.name,class:o.normalizeClass(["text-gray-900",e.customClass]),innerHTML:e.html?e.html:e.text},null,10,Qy))}}),eb=["placeholder","disabled","name"],ja=o.defineComponent({__name:"vs-input-mask",props:o.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=Ot(e.style),r=o.useModel(n,"modelValue"),s=o.ref(null);let l=null;function a(i){const c={9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},d=new Set;let u=!1;for(let h=0;h<i.length;h+=1){const f=i[h];f==="{"?u=!0:f==="}"?u=!1:u&&d.add(f)}const p={};return Object.keys(c).forEach(h=>{d.has(h)||(p[h]=c[h])}),{mask:i,definitions:p,lazy:!1}}return o.onMounted(async()=>{if(s.value){const{default:i}=await Promise.resolve().then(()=>Md),c=a(e.mask||"");l=i(s.value,c),l.on("accept",()=>{r.value=e.unmask?l.unmaskedValue:l.value}),l.on("complete",()=>{r.value=e.unmask?l.unmaskedValue:l.value}),l.value=r.value!=null?String(r.value):""}}),o.onBeforeUnmount(()=>{l?.destroy()}),o.watch(()=>e.mask,i=>{if(l){const c=a(i||"");l.updateOptions(c)}}),o.watch(r,i=>{l&&l.unmaskedValue!==i&&(l.value=i!=null?String(i):"")}),(i,c)=>(o.openBlock(),o.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:s,placeholder:i.placeholder,disabled:i.disabled,name:i.name,class:o.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[o.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,eb))}}),tb={class:"relative w-full bg-white rounded-lg"},nb=["placeholder","disabled"],Ha=o.defineComponent({__name:"vs-input-email",props:o.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=Ot(e.style),r=o.useModel(n,"modelValue");return(s,l)=>(o.openBlock(),o.createElementBlock("div",tb,[l[1]||(l[1]=o.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)),o.withDirectives(o.createElementVNode("input",{type:"email","onUpdate:modelValue":l[0]||(l[0]=a=>r.value=a),placeholder:s.placeholder,disabled:s.disabled,class:o.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[o.unref(t),{"!border-red-600":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,nb),[[o.vModelText,r.value]])]))}}),rb={class:"relative w-full bg-white rounded-lg"},ob=["value","placeholder","disabled"],Ua=o.defineComponent({__name:"vs-input-tel",props:o.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=Ot(e.style),r=o.useModel(n,"modelValue"),s=o.computed(()=>r.value?r.value.startsWith("+")?r.value.slice(1):r.value:""),l=i=>{let{value:c}=i.target;c=c.replace(/^\+/,""),r.value=c?`+${c}`:""},a=i=>{const c=i,{data:d,inputType:u}=c;u&&u.startsWith("delete")||d&&/\D/.test(d)&&c.preventDefault()};return o.watch(()=>r.value,i=>{i&&!i.startsWith("+")?r.value=`+${i.replace(/^\+/,"")}`:i||(r.value="")},{immediate:!0}),(i,c)=>(o.openBlock(),o.createElementBlock("div",rb,[c[0]||(c[0]=o.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"stroke-gray-500 transition-all"},[o.createElementVNode("path",{d:"M13.832 16.568a1 1 0 0 0 1.213-.303l.355-.465A2 2 0 0 1 17 15h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2A18 18 0 0 1 2 4a2 2 0 0 1 2-2h3a2 2 0 0 1 2 2v3a2 2 0 0 1-.8 1.6l-.468.351a1 1 0 0 0-.292 1.233 14 14 0 0 0 6.392 6.384"})])],-1)),c[1]||(c[1]=o.createElementVNode("div",{class:"absolute bottom-2/4 translate-y-2/4 left-[30px] text-gray-500 select-none pointer-events-none"}," + ",-1)),o.createElementVNode("input",{type:"tel",value:s.value,onInput:l,onBeforeinput:a,pattern:"^\\+[1-9]\\d{1,14}$",maxlength:"15",placeholder:i.placeholder,disabled:i.disabled,class:o.normalizeClass(["!pl-10 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[o.unref(t),{"!border-red-600":i.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,ob)]))}}),sb=["value","disabled"],lb={class:"text-[13px] text-gray-700"},ab=o.defineComponent({__name:"vs-input-radio-default",props:o.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=o.useModel(n,"modelValue"),r=o.computed(()=>!!e.disabled);return(s,l)=>(o.openBlock(),o.createElementBlock("label",{class:o.normalizeClass(["flex items-center gap-0",[e.customClass,r.value?"cursor-not-allowed opacity-60":""]])},[o.withDirectives(o.createElementVNode("input",{"onUpdate:modelValue":l[0]||(l[0]=a=>t.value=a),type:"radio",value:e.value,disabled:r.value,class:"hidden"},null,8,sb),[[o.vModelRadio,t.value]]),o.createElementVNode("span",{class:o.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${e.style?.primaryColor||"blue"}-500`,r.value?"opacity-50 cursor-not-allowed":""]])},[t.value==e.value?(o.openBlock(),o.createElementBlock("span",{key:0,class:o.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${e.style?.primaryColor||"blue"}-500`]])},null,2)):o.createCommentVNode("",!0)],2),o.createElementVNode("span",lb,o.toDisplayString(e.text),1)],2))}}),ib=["value","disabled"],cb={class:"text-[13px] text-gray-700"},db={"vs-input-radio-default":ab,"vs-input-radio-buttons":o.defineComponent({__name:"vs-input-radio-buttons",props:o.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=o.useModel(n,"modelValue"),r=o.computed(()=>!!e.disabled);return(s,l)=>(o.openBlock(),o.createElementBlock("label",{class:o.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[t.value==e.value?`ring-2 ring-ring ring-${e.style?.primaryColor||"blue"}-500`:"",e.customClass,r.value?"cursor-not-allowed opacity-60":""]])},[o.withDirectives(o.createElementVNode("input",{"onUpdate:modelValue":l[0]||(l[0]=a=>t.value=a),type:"radio",value:e.value,disabled:r.value,class:"hidden"},null,8,ib),[[o.vModelRadio,t.value]]),o.createElementVNode("span",cb,o.toDisplayString(e.text),1)],2))}})},Wa=o.defineComponent({__name:"vs-input-radio",props:o.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=o.useModel(n,"modelValue"),r=o.computed(()=>db[`vs-input-radio-${e.view}`]);return(s,l)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass([s.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.options,a=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(r.value),o.mergeProps({key:a?.id,text:a.text,value:a.id.toString(),checked:t.value===a.id,modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i)},{ref_for:!0},s.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),ub={key:1,class:"w-full flex flex-col gap-4"},pb={key:0,class:"text-sm font-medium text-muted-foreground my-2"},hb="Без категорії",Rd=Ve(o.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},group:{default:void 0},values:{default:()=>[]},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,s=o.ref([]),l=o.reactive({}),a=f=>f?.value||f?.id||f?.text||f,i=f=>f.text||String(f),c=f=>`lg:col-span-${f||12}`,d=o.computed(()=>[t.position==="vertical"?"flex flex-col":"",t.colSpan?"grid":"flex justify-start"]),u=f=>f==null||f===""?null:typeof f=="string"||typeof f=="number"?f:String(f),p=o.computed(()=>{if(!t.group)return[];const f=new Map;s.value.forEach(k=>{const x=k[t.group],w=u(x);f.has(w)||f.set(w,[]),f.get(w)?.push(k)});const m=[];t.values?.length&&t.values.forEach(k=>{const x=u(k);m.push(x)});const g=new Set,y=k=>{const x=f.get(k)||[];if(!x.length)return null;const w=k===null?"group-null":`group-${String(k)}`,v=k===null?hb:String(k);return g.add(k),{key:w,label:v,options:x}},b=[];return m.forEach(k=>{const x=y(k);x&&b.push(x)}),f.forEach((k,x)=>{if(g.has(x))return;const w=y(x);w&&b.push(w)}),b}),h=async()=>{try{const f=await fetch(`/api/suggest/${t.data}`).then(m=>m.json());s.value=f?.data||f}catch(f){console.error(f)}};return o.watch(()=>t.modelValue,f=>{if(typeof f=="boolean"&&s.value.length===1){const m=a(s.value[0]);l[m]=f}else if(Array.isArray(f)){const m=new Set(f);s.value.forEach(g=>{if(!g.disabled){const y=a(g);l[y]=m.has(y)}})}},{immediate:!0}),o.watch(l,()=>{if(!s.value.length){r("update:modelValue",null);return}const f=Object.entries(l).filter(([,m])=>m).map(([m])=>m);r("update:modelValue",f.length===0?[]:f)},{deep:!0}),o.onMounted(()=>{if(t.data)h().then(()=>{if(typeof t.modelValue=="boolean"&&s.value.length===1){const f=a(s.value[0]);l[f]=t.modelValue}else if(Array.isArray(t.modelValue)){const f=new Set(t.modelValue);s.value.forEach(m=>{if(!m.disabled){const g=a(m);l[g]=f.has(g)}})}});else if(s.value=t.options,typeof t.modelValue=="boolean"&&s.value.length===1){const f=a(s.value[0]);l[f]=t.modelValue}else if(Array.isArray(t.modelValue)){const f=new Set(t.modelValue);s.value.forEach(m=>{if(!m.disabled){const g=a(m);l[g]=f.has(g)}})}}),(f,m)=>t.group?(o.openBlock(),o.createElementBlock("div",ub,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(p.value,g=>(o.openBlock(),o.createElementBlock("div",{key:g.key,class:"flex flex-col gap-2"},[g.label?(o.openBlock(),o.createElementBlock("span",pb,o.toDisplayString(g.label),1)):o.createCommentVNode("",!0),o.createElementVNode("div",{class:o.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(g.options,y=>(o.openBlock(),o.createBlock($a,{modelValue:l[a(y)],"onUpdate:modelValue":b=>l[a(y)]=b,value:a(y),class:o.normalizeClass(c(f.colSpan)),disabled:t.disabled||y.disabled,label:i(y),key:`${g.key}-${a(y)}`,icon:y?.icon,imgUrl:y?.imgUrl,option:y,view:f.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(o.openBlock(),o.createElementBlock("div",{key:0,class:o.normalizeClass(["p-0 w-full gap-[10px]",d.value])},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.value,g=>(o.openBlock(),o.createBlock($a,{modelValue:l[a(g)],"onUpdate:modelValue":y=>l[a(g)]=y,value:a(g),class:o.normalizeClass(c(f.colSpan)),disabled:t.disabled||g.disabled,label:i(g),key:a(g),icon:g?.icon,imgUrl:g?.imgUrl,option:g,view:f.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),[["__scopeId","data-v-8e66207e"]]),fb=["type","placeholder","disabled"],mb=o.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},mode:{default:"date"}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n;function r(u){return u?t.mode==="datetime"?(u.includes("T")?u:null)||u+(u.includes(" ")?"":"T00:00"):u?.split(" ")[0]:null}const{inputClass:s}=Ot(t.style),l=e,a=o.computed({get:()=>r(t.modelValue),set:u=>l("update:modelValue",u)}),i=o.computed(()=>t.mode==="datetime"?"datetime-local":t.mode),c=o.computed(()=>!!t.disabled),d=o.computed(()=>t.placeholder??"");return(u,p)=>o.withDirectives((o.openBlock(),o.createElementBlock("input",{type:i.value,"onUpdate:modelValue":p[0]||(p[0]=h=>a.value=h),placeholder:d.value,disabled:c.value,ref:"date",class:o.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[u.modelValue?"":"text-opacity-50",o.unref(s)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,fb)),[[o.vModelDynamic,a.value]])}}),gb=(n,e)=>{if(!e||!Object.keys(e).length)return n;const[t,r=""]=n.split("?"),s=new URLSearchParams(r);Object.entries(e).forEach(([a,i])=>{i==null||i===""||s.set(a,String(i))});const l=s.toString();return l?`${t}?${l}`:t},Pd=async(n,e={})=>{try{const t=new FormData;t.append("unique","true"),t.append("file",n);const{api:r,id:s="1",form:l="form",table:a="table",customParams:i}=e,c=r||`/file/upload/uploads?id=${s||""}&form=${l||""}&table=${a||""}`,d=gb(c,i);return(await fetch(d,{method:"POST",body:t}).then(p=>p.json()))?.result}catch(t){return nt.notify({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",t),null}},yb=async n=>{try{return await fetch(`file/delete${n}`),!0}catch(e){return console.error(e),!1}},zd=async n=>{try{const e=await fetch(`file/download/files/uploads${n}`),t=await e.arrayBuffer(),r=e.headers["content-type"],s=new TextDecoder("utf-8").decode(t),l=new Blob([s],{type:r}),a=document.createElement("a");a.setAttribute("download",n),a.href=window.URL.createObjectURL(l),a.click()}catch(e){console.error(e.message)}},bb={},kb={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 wb(n,e){return o.openBlock(),o.createElementBlock("svg",kb,e[0]||(e[0]=[o.createElementVNode("path",{d:"M5 12h14"},null,-1),o.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const zn=Ve(bb,[["render",wb]]),xb={},vb={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 Eb(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("svg",vb,e[0]||(e[0]=[o.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 Cb=Ve(xb,[["render",Eb]]),_b={},Sb={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 Nb(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("svg",Sb,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),o.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),o.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const Vb=Ve(_b,[["render",Nb]]),Mb={},Bb={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 Ab(n,e){return o.openBlock(),o.createElementBlock("svg",Bb,e[0]||(e[0]=[o.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M9 9l1 0"></path><path d="M9 13l6 0"></path><path d="M9 17l6 0"></path>',6)]))}const jd=Ve(Mb,[["render",Ab]]),Tb={},Lb={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 Db(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("svg",Lb,e[0]||(e[0]=[o.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 Ob=Ve(Tb,[["render",Db]]),Ib={},Fb={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 $b(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("svg",Fb,e[0]||(e[0]=[o.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 Rb=Ve(Ib,[["render",$b]]),Pb=n=>{if(!n)return"";const e=n?.split(".");return e[e.length-1]},zb=n=>{const e=Pb(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)?Vb:t.textsFormat.includes(e)?Rb:t.documentsFormat.includes(e)?Cb:t.archivesFormat.includes(e)?Ob:jd},jb={},Hb={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 Ub(n,e){return o.openBlock(),o.createElementBlock("svg",Hb,e[0]||(e[0]=[o.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 Qr=Ve(jb,[["render",Ub]]),Wb={},Kb={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 qb(n,e){return o.openBlock(),o.createElementBlock("svg",Kb,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),o.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),o.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Hd=Ve(Wb,[["render",qb]]),Gb=["title"],Yb={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},Ud=Ve(o.defineComponent({__name:"vs-input-file-list-item",props:o.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(n){const e=o.useModel(n,"value"),t=o.useModel(n,"item"),r=n;return(s,l)=>(o.openBlock(),o.createElementBlock("div",{title:t.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(zb)(t.value)),{src:t.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:l[0]||(l[0]=a=>o.unref(zd)(t.value))},null,8,["src"])),o.createElementVNode("div",Yb,[o.createElementVNode("button",{type:"button",onClick:l[1]||(l[1]=a=>{o.unref(yb)(t.value),e.value=r.multiple?e.value?.filter(i=>i!==t.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[o.createVNode(Qr,{class:"w-4 h-4"})]),o.createElementVNode("button",{type:"button",onClick:l[2]||(l[2]=a=>o.unref(zd)(t.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[o.createVNode(Hd,{class:"w-4 h-4"})])])],8,Gb))}}),[["__scopeId","data-v-286cdbc0"]]),Jb={class:"flex items-center gap-x-2"},Zb=["accept","multiple","disabled"],Xb={key:1,class:"flex items-center flex-wrap gap-2"},Qb={key:1,class:"loader"},ek={key:1,class:"loader"},Wd=Ve(o.defineComponent({__name:"vs-input-file",props:o.mergeModels({format:{},multiple:{type:Boolean},max_size:{},api:{},customParams:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{},modelModifiers:{}}),emits:o.mergeModels(["change"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=o.useModel(n,"modelValue"),s=e,l=o.ref(null),a=o.ref(!1),i=o.inject("values"),c=o.computed(()=>t.format?t.format.split(",").map(k=>k.trim().toLowerCase()).filter(Boolean):[]),d=k=>Array.isArray(r.value)&&r.value[k]||"",u=k=>{if(t.max_size&&k.size>t.max_size*1024*1024){const x=(k.size/1048576).toFixed(2);return nt.notify({type:"error",title:"Помилка!",message:`Файл "${k.name}" занадто великий. Максимальний розмір: ${t.max_size} МБ, розмір файлу: ${x} МБ`,position:"right-bottom"}),!1}return!0},p=k=>{if(!c.value.length)return!0;const x=`.${k.name.split(".").pop()?.toLowerCase()||""}`,w=c.value.includes(x);return w||nt.notify({type:"error",title:"Помилка!",message:`Неприпустимий формат файлу "${k.name}". Дозволені формати: ${c.value.join(", ")}`,position:"right-bottom"}),w},h=o.computed(()=>{const k={},x=[];if(!t.customParams?.length)return{params:k,missingSources:x};const w=i?.value??{};return t.customParams.forEach(v=>{if(!v)return;const[_,E]=v.split("="),S=_?.trim(),I=E?.trim();if(!S||!I)return;const A=w[I];if(A==null||A===""){x.push(I);return}k[S]=A}),{params:k,missingSources:x}}),f=()=>{const k=h.value.params;return{api:t.api,customParams:Object.keys(k).length?k:void 0}},m=()=>{const k=h.value.missingSources;if(!k.length)return!0;const x=k.join(", ");return nt.notify({type:"warning",title:"Заповніть поля",message:`Поля (${x}) необхідні для завантаження файлу`,position:"right-bottom"}),!1},g=k=>{nt.notify({type:"error",title:"Помилка завантаження",message:k||"Не вдалося завантажити файл. Спробуйте ще раз.",position:"right-bottom"})},y=()=>{t.disabled||a.value||m()&&l.value?.click()},b=async k=>{const{files:x}=k.target;if(!x||x.length===0)return;if(!m()){l.value&&(l.value.value="");return}const w=Array.from(x);if(t.max_size&&w.filter(E=>!u(E)).length>0){l.value&&(l.value.value="");return}if(w.filter(_=>!p(_)).length>0){l.value&&(l.value.value="");return}a.value=!0;try{if(t.multiple){const _=Array.from(x).map(async A=>await Pd(A,f())),E=await Promise.all(_),I=E.filter(A=>A!==null).map(A=>A?.file_path).filter(Boolean);if(I.length===0){g();return}I.length<E.length&&g("Деякі файли не вдалося завантажити. Перевірте їх та спробуйте знову."),r.value=[...r.value||[],...I],s("change",r.value)}else{const _=x[0],E=await Pd(_,f());if(!E?.file_path){g();return}r.value=E?.file_path,s("change",r.value||"")}}catch(_){const E=_?.message||void 0;g(E)}finally{a.value=!1,l.value&&(l.value.value="")}};return(k,x)=>(o.openBlock(),o.createElementBlock("div",Jb,[o.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:l,type:"file",accept:t.format,multiple:k.multiple,onChange:b,disabled:a.value||k.disabled},null,40,Zb),!k.multiple&&r.value?(o.openBlock(),o.createBlock(Ud,{key:0,item:r.value,"onUpdate:item":x[0]||(x[0]=w=>r.value=w),value:r.value,"onUpdate:value":x[1]||(x[1]=w=>r.value=w)},null,8,["item","value"])):k.multiple?(o.openBlock(),o.createElementBlock("div",Xb,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(w,v)=>(o.openBlock(),o.createBlock(Ud,{multiple:k.multiple,key:v,value:r.value,"onUpdate:value":x[2]||(x[2]=_=>r.value=_),item:d(v)},null,8,["multiple","value","item"]))),128)),o.createElementVNode("div",{onClick:y,class:o.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",k.disabled||a.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[a.value?(o.openBlock(),o.createElementBlock("div",Qb)):(o.openBlock(),o.createBlock(zn,{key:0,class:"w-6 h-6"}))],2)])):o.createCommentVNode("",!0),k.multiple?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",{key:2,onClick:y,class:o.normalizeClass([k.disabled||a.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[a.value?(o.openBlock(),o.createElementBlock("div",ek)):(o.openBlock(),o.createBlock(zn,{key:0,class:"w-6 h-6"}))],2))]))}}),[["__scopeId","data-v-94bcb5d9"]]),tk={class:"max-w-[55vw]"},nk={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},rk={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},ok={class:"px-[5px]"},sk={class:""},Os=o.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(n){const e=n,t=o.computed(()=>{try{return new Date(e.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function r(s){if(s<1024)return`${s} B`;const l=s/1024;return l<1024?`${l.toFixed(2)} KB`:`${(l/1024).toFixed(2)} MB`}return(s,l)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[l[1]||(l[1]=o.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)),o.createElementVNode("div",tk,[o.createElementVNode("p",nk,o.toDisplayString(s.item?.uploaded_name),1),o.createElementVNode("p",rk,[o.createElementVNode("span",null,o.toDisplayString(s.item?.username),1),o.withDirectives(o.createElementVNode("span",ok,"|",512),[[o.vShow,s.item?.username]]),o.createElementVNode("span",null,o.toDisplayString(t.value),1),l[0]||(l[0]=o.createElementVNode("span",{class:"px-[5px]"},"|",-1)),o.createElementVNode("span",sk,o.toDisplayString(r(s.item?.size)),1)])])],64))}}),lk={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},ak={key:0,class:"flex w-full gap-x-3 items-center"},ik={key:1,class:"flex gap-x-3 w-full items-center"},ck={key:2,class:"flex gap-x-3 w-full items-center"},dk=["href"],uk={key:3,class:"flex gap-x-3 w-full items-center"},pk={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},hk={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"},fk={class:"inline-block"},mk={class:"inline-block"},gk=o.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(n,{emit:e}){const t=n,r=e;function s(u){return["pdf","json"].includes(u.ext)}function l(u){return["ppt","pptx","doc","docx","xls","xlsx"].includes(u.ext)}function a(u){const p=document.createElement("a");p.setAttribute("download",u?.uploaded_name),p.href=u?.file_path,p.click()}async function i(){try{await fetch(`${t.prefix}/widget/file/${t.item.entity_id}/${t.item.file_id}`),r("update")}catch(u){console.error(u)}}function c(){r("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function d(u){(t.item.ext==="jpg"||t.item.ext==="png")&&r("openLightbox",{item:t.item,index:u})}return(u,p)=>(o.openBlock(),o.createElementBlock("div",lk,[u.item.ext==="jpg"||u.item.ext==="png"?(o.openBlock(),o.createElementBlock("div",ak,[o.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:p[0]||(p[0]=h=>d(u.index))},[o.createVNode(Os,{item:u.item},null,8,["item"])])])):s(u.item)?(o.openBlock(),o.createElementBlock("div",ik,[o.createVNode(Os,{item:u.item},null,8,["item"])])):l(u.item)?(o.openBlock(),o.createElementBlock("div",ck,[o.createElementVNode("a",{href:`/api/file-preview?id=${u.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[o.createVNode(Os,{item:u.item},null,8,["item"])],8,dk)])):(o.openBlock(),o.createElementBlock("div",uk,[o.createVNode(Os,{item:u.item},null,8,["item"])])),o.createElementVNode("div",pk,[o.createElementVNode("div",hk,[o.createElementVNode("div",fk,[o.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:p[1]||(p[1]=h=>a(u.item))},[o.createVNode(Hd,{height:"14",width:"14"})])]),p[3]||(p[3]=o.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),o.createElementVNode("div",mk,[o.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:p[2]||(p[2]=h=>c())},[o.createVNode(Qr,{height:"14",width:"14"})])])])])]))}}),yk={},bk={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 kk(n,e){return o.openBlock(),o.createElementBlock("svg",bk,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),o.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),o.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const wk=Ve(yk,[["render",kk]]),xk={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},vk={class:"flex w-full mb-[12px] items-center gap-x-2"},Ek={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},Ck={class1:"ml-auto"},_k={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"},Sk={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},Nk={class:"relative"},Vk={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"},Mk={key:0},Kd=o.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update"],setup(n,{emit:e}){const t=n,r=o.inject("form"),s=o.computed(()=>r.value.formId),l=o.ref(!1),a=o.ref(0),i=e,c=o.ref(!1),d=o.ref({}),u=o.ref([]),p=o.ref(""),h=o.computed(()=>Array.isArray(u.value)?u.value.filter(x=>x.ext==="jpg"||x.ext==="png").map(x=>x?.file_path):[]),f=o.computed(()=>p.value===""?u.value:u.value.filter(x=>x?.uploaded_name?.includes(p.value))),m=x=>{const w=h.value.findIndex(v=>v===x.item.file_path);w!==-1&&(l.value=!0,a.value=w)},g=async()=>{try{const x=await fetch(`${t.prefix}/widget/file/${s.value}`).then(w=>w.json());u.value=x?.rows}catch(x){console.error(x)}},y=async x=>{await Promise.all(Array.from(x.target.files).map(async w=>{const v=new FormData;v.append("file",w);try{const _=`${t.prefix}/widget/file/${s.value}`,E=await fetch(_,{method:"POST",body:v});return E.ok?(i("update","file-list"),w):(nt.notify({type:E.status>=400&&E.status<500?"warning":"error",title:"Error",message:`Error code: ${E.status}`}),null)}catch(_){return nt.notify({type:"error",title:"Error",message:_.message||"Unknown error"}),console.error(_),null}})),await g()},b=x=>{const w={...x};return x.cancel||(w.cancel=()=>{c.value=!1}),x.updateListOnConfirm&&(w.confirm=async()=>{await x.confirm(),c.value=!1,g()}),w},k=x=>{d.value=b(x),c.value=!0};return o.watch(s,x=>{x&&g()}),o.onMounted(()=>{s.value&&g()}),(x,w)=>{const v=o.resolveComponent("Lightbox"),_=o.resolveComponent("MessageBox");return o.openBlock(),o.createElementBlock("div",xk,[o.createElementVNode("div",vk,[o.createElementVNode("h2",Ek," Файлів: "+o.toDisplayString(u.value?.length),1),o.createElementVNode("div",Ck,[o.createElementVNode("label",null,[o.createElementVNode("input",{type:"file",class:"hidden",onChange:w[0]||(w[0]=E=>y(E))},null,32),o.createElementVNode("div",_k,[o.createVNode(wk,{height:"16",width:"16"})])])])]),u.value?.length>4?(o.openBlock(),o.createElementBlock("div",Sk,[o.createElementVNode("div",null,[o.createElementVNode("div",Nk,[w[8]||(w[8]=o.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[o.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"},[o.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),o.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),o.withDirectives(o.createElementVNode("input",{type:"text","onUpdate:modelValue":w[1]||(w[1]=E=>p.value=E),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),[[o.vModelText,p.value,void 0,{trim:!0}]])])])])):o.createCommentVNode("",!0),u.value?.length?(o.openBlock(),o.createElementBlock("div",Vk,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(f.value,(E,S)=>(o.openBlock(),o.createBlock(gk,{key:S,prefix:x.prefix,item:E,index:S,onUpdate:w[2]||(w[2]=I=>x.$emit("update","file-list")),onOpenModal:w[3]||(w[3]=I=>k(I)),onOpenLightbox:w[4]||(w[4]=I=>m(I))},null,8,["prefix","item","index"]))),128)),f.value.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Mk,w[9]||(w[9]=[o.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):o.createCommentVNode("",!0),o.createVNode(v,{modelValue:l.value,"onUpdate:modelValue":w[5]||(w[5]=E=>l.value=E),startIndex:a.value,"onUpdate:index":w[6]||(w[6]=E=>a.value=E),images:h.value},null,8,["modelValue","startIndex","images"]),o.createVNode(_,o.mergeProps({modelValue:c.value,"onUpdate:modelValue":w[7]||(w[7]=E=>c.value=E),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),Bk={class:"flex items-center justify-between"},Ak={class:"text-[16px] text-gray-900 font-medium"},Tk={class:"grid gap-3"},Lk=Ve(o.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=o.ref(e.isOpen);return o.watch(()=>e.isOpen,r=>{t.value=r}),(r,s)=>(o.openBlock(),o.createElementBlock("div",null,[o.createElementVNode("div",Bk,[o.createElementVNode("p",Ak,o.toDisplayString(n.title),1),o.createVNode(Pa,{modelValue:t.value,"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l),style:o.normalizeStyle(n.style)},null,8,["modelValue","style"])]),o.createVNode(o.Transition,{name:"slide-fade"},{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("div",Tk,[o.renderSlot(r.$slots,"default",{},void 0,!0)],512),[[o.vShow,t.value]])]),_:3})]))}}),[["__scopeId","data-v-90320b87"]]),Dk={class:"text-[16px] text-gray-900 font-medium"},Ok={class:"grid gap-3"},Ik=Ve(o.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=o.ref(e.isOpen);return o.watch(()=>e.isOpen,r=>{t.value=r}),(r,s)=>(o.openBlock(),o.createElementBlock("div",null,[o.createElementVNode("button",{type:"button",onClick:s[0]||(s[0]=l=>t.value=!t.value),class:"flex items-center gap-2"},[o.createVNode(o.unref(zy),{class:o.normalizeClass(["h-4 w-4 duration-300",[t.value?"-rotate-180":""]])},null,8,["class"]),o.createElementVNode("span",Dk,o.toDisplayString(n.title),1)]),o.createVNode(o.Transition,{name:"slide-fade"},{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("div",Ok,[o.renderSlot(r.$slots,"default",{},void 0,!0)],512),[[o.vShow,t.value]])]),_:3})]))}}),[["__scopeId","data-v-590eff11"]]),Fk={class:"flex items-center justify-between"},$k={switcher:Lk,accordion:Ik,default:o.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(n){return(e,t)=>(o.openBlock(),o.createElementBlock("div",null,[o.createElementVNode("div",Fk,[o.createElementVNode("p",null,o.toDisplayString(n.title),1)]),o.renderSlot(e.$slots,"default")]))}})},ln={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},Rk=(n,e)=>String(n)===String(e),Pk=(n,e)=>String(n)!==String(e),zk=(n,e)=>n>e,jk=(n,e)=>n>=e,Hk=(n,e)=>n<e,Uk=(n,e)=>n<=e,Wk=(n,e)=>Array.isArray(e)&&e.length===2?n>=e[0]&&n<=e[1]:!1,Kk=(n,e)=>String(n).startsWith(String(e)),qk=(n,e)=>String(n).endsWith(String(e)),Gk=(n,e)=>String(n).includes(String(e)),Yk=(n,e)=>Array.isArray(e)?e.includes(n):!1,Jk=(n,e)=>Array.isArray(e)?!e.includes(n):!0,qd=(n,e)=>{if(!e)return!0;switch(e?.[1]){case ln.Equal:return Rk(n,e?.[2]);case ln.Inequal:return Pk(n,e?.[2]);case ln.Higer:return zk(n,e?.[2]);case ln.HigerOrEqual:return jk(n,e?.[2]);case ln.Lower:return Hk(n,e?.[2]);case ln.LowerOrEqual:return Uk(n,e?.[2]);case ln.Between:return Wk(n,e?.[2]);case ln.StartWith:return Kk(n,e?.[2]);case ln.EndWith:return qk(n,e?.[2]);case ln.Contain:return Gk(n,e?.[2]);case ln.In:return Yk(n,e?.[2]);case ln.NotIn:return Jk(n,e?.[2]);default:return!0}},Gd=o.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(n){const e=n,t=o.inject("values",o.ref({})),r=o.inject("form"),s=o.computed(()=>e.schema?.filter(i=>{const c=i?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,u=e.name?t.value?.[e.name]?.[d]??t.value?.[d]:t.value?.[d];return qd(u,c)})),l=o.computed(()=>$k[e.view]),a=o.computed(()=>{if(t.value||(t.value={}),!e.name)return t.value;const i=t.value[e.name];if(i)return i;const c={};return t.value={...t.value,[e.name]:c},c});return(i,c)=>n.schema?.length?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(l.value),{key:0,title:n.title,style:o.normalizeStyle(n.style)},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.value,d=>(o.openBlock(),o.createBlock(dg,o.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:a.value[d.name],"onUpdate:modelValue":u=>a.value[d.name]=u,style:n.style,error:o.unref(r)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):o.createCommentVNode("",!0)}}),Zk=["aria-expanded","data-focus"],Xk={class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full"},Qk={key:0,class:"flex flex-nowrap items-center gap-1 overflow-x-auto overflow-y-hidden min-w-0 flex-1 py-0.5"},e1={class:"flex items-center min-w-0"},t1=["title"],n1=["innerHTML"],r1=["onClick"],o1={class:"flex-1 min-w-[2px]"},s1=["placeholder"],l1=["title"],a1=["innerHTML"],i1={key:2,class:"flex-1 min-w-[2px]"},c1=["placeholder"],d1={class:"flex items-center shrink-0"},u1=["disabled"],p1=["disabled","title"],h1=["aria-disabled","onClick"],f1=["innerHTML"],m1={key:1,class:"px-3 py-2 text-center text-gray-500"},g1=["disabled"],Ka=o.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},start:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{},maxlength:{},minlength:{}},emits:["change","update:modelValue","value-selected"],setup(n,{emit:e}){const t=n,r=e,s=o.computed(()=>t.multiple),l=o.computed(()=>t.disabled);Ot(t.style);const a=o.computed({get:()=>t.modelValue,set:z=>r("update:modelValue",z)});!a.value&&t.defaultValue&&(a.value=t.defaultValue);const i=o.ref(null),c=o.ref(null),d=o.ref(null),u=o.ref(null),p=o.ref(!1),h=o.ref(!1),f=o.ref(null),m=o.ref([]),g=o.ref(-1),y=o.ref([]),b=o.ref(""),k=o.ref(null),x=o.ref("bottom"),w=o.ref({}),v=o.ref([]),_=o.computed(()=>{if(!v.value.length)return[];const z=m.value,q=new Map(z.map(C=>[C.id?.toString(),C]));return v.value.map(C=>q.get(C?.toString())).filter(C=>!!C)}),E=o.computed(()=>t.placeholder||"Select..."),S=o.computed(()=>H(f.value));o.computed(()=>s.value?!v.value.length&&b.value==="":!S.value&&b.value==="");const I=o.computed(()=>l.value?!1:s.value?v.value.length>0:!!a.value),A=z=>s.value?v.value.some(q=>q?.toString()===z?.toString()):a.value?.toString()===z?.toString(),V=o.computed(()=>{let z=m.value??[];if(!t.data&&b.value.trim()!==""){const q=b.value.toLowerCase();z=z.filter(C=>{const N=H(C).toLowerCase(),j=C.text?.toLowerCase?.()||"";return N.includes(q)||j.includes(q)})}if(s.value&&v.value.length){const q=new Set(v.value.map(C=>C?.toString()));z=z.filter(C=>!q.has(C.id?.toString()))}return z}),M=o.inject("values"),U=o.inject("field-props"),R=/\{\{\s*([^}]+?)\s*\}\}/g,$=z=>(z?String(z):"").replace(/<[^>]*>/g,"").trim(),D=o.computed(()=>t.slot??t?.optionTemplate??""),P=z=>{if(!z)return"";const q=D.value;return q?q.replace(R,(C,N)=>{const j=N.trim(),J=z[j];return J!=null?String(J):""}):z.text??""},H=z=>{if(!z)return"";if(!D.value)return z.text??"";const C=P(z);return $(C)||z.text||""},G=(z,q,C)=>{if(!U)return!1;const N=U.value?.[z]??{},j=(le,ue,Ee)=>{if(!ue.length)return le;const[Ce,...Ge]=ue,Je={...le};if(!Ge.length)return Je[Ce]=Ee,Je;const sn=typeof le[Ce]=="object"&&le[Ce]!==null?le[Ce]:{};return Je[Ce]=j(sn,Ge,Ee),Je},J=j(N,q,C);return U.value={...U.value||{},[z]:J},!0},ie=z=>{if(!t.set)return;const q=M?.value;!q&&!U||Object.entries(t.set).forEach(([C,N])=>{if(!C)return;const j=z?z[N]:null,J=C.split(".").map(Ee=>Ee.trim()).filter(Boolean);if(!J.length)return;const[le,...ue]=J;ue.length&&G(le,ue,j??null)||q&&(q[le]=j??null)})},Ae=o.computed(()=>t.parent?M?.value?.[t.parent]?.toString()??null:null),Q=async z=>{if(!t.data){let q=t.options??[];if(z?.trim()){const C=z.toLowerCase();q=q.filter(N=>{const j=H(N).toLowerCase(),J=N.text?.toLowerCase?.()||"";return j.includes(C)||J.includes(C)})}return q}try{const q=t.host??"",C=t.prefix??"api",N=t.api??`/${C}/suggest/${t.data}`,j=`${q}${N}`,J=new URLSearchParams;return J.set("json","1"),z&&J.set("key",z),Ae.value!==void 0&&Ae.value!==null&&Ae.value!==""&&J.set("parent",Ae.value),t.start===1&&J.set("start","1"),(await fetch(`${j}?${J.toString()}`).then(ue=>ue.json()))?.data??[]}catch{return[]}},Pe=async()=>{t.data?m.value=await Q(b.value):m.value=t.options?[...t.options]:[]},ze=async z=>{if(z==null)return null;const q=m.value?.find(C=>C?.id?.toString()===String(z));if(q)return q;if(t.data)try{const C=t.host??"",N=t.prefix??"api",j=t.api??`/${N}/suggest/${t.data}`,J=`${C}${j}`,le=new URLSearchParams;return le.set("json","1"),le.set("val",String(z)),Ae.value!==void 0&&Ae.value!==null&&Ae.value!==""&&le.set("parent",Ae.value),t.start===1&&le.set("start","1"),((await fetch(`${J}?${le.toString()}`).then(Ce=>Ce.json()))?.data??[])?.[0]??null}catch{return null}return null},We=async z=>{const q=new Set(m.value.map(N=>N.id?.toString())),C=z.filter(N=>!q.has(N?.toString()));C.length&&await C.reduce(async(N,j)=>{await N;const J=await ze(j);J&&m.value.push(J)},Promise.resolve())},St=async()=>{l.value||(p.value=!0,await Pe(),await o.nextTick(()=>{Ke(),k.value?.focus(),V.value.length?g.value=0:g.value=-1}))},gt=()=>{p.value=!1,g.value=-1},Wt=async z=>{if(l.value)return;!p.value?await St():gt()},on=async()=>{p.value?k.value?.focus():await St()},Y=()=>{s.value?(v.value=[],a.value=[],r("change",[]),ae(null,[])):(f.value=null,a.value=null,r("change",null),ae(null,null)),ie(null),b.value="",o.nextTick(()=>k.value?.focus())},re=z=>{s.value&&(v.value=v.value.filter(q=>q?.toString()!==z?.toString()),a.value=[...v.value],r("change",a.value),ae(null),o.nextTick(()=>k.value?.focus()))},ae=(z,q)=>{const C=q??(s.value?[...v.value]:z?.id??null);r("value-selected",{name:t.name,value:C,option:z})},fe=z=>{s.value?(A(z.id)||(v.value=[...v.value,z.id],a.value=[...v.value],r("change",a.value),ae(z)),b.value="",o.nextTick(()=>{k.value?.focus(),g.value=Math.min(g.value,V.value.length-1)}),ie(null)):(f.value=z,a.value=z.id,r("change",a.value),ae(z),b.value="",gt(),ie(z))},be=z=>{A(z.id)||fe(z)},Oe=(z,q)=>{if(!z||!q)return;const C=z.offsetTop,N=C+z.offsetHeight,j=q.scrollTop,J=j+q.clientHeight;let le=q.scrollTop;C<j?le=C-80:N>J&&(le=N-q.clientHeight+4);const ue=q;ue.scrollTop=le},He=z=>{let q=z.parentElement;for(;q;){if(q.classList.contains("ui-dialog__content"))return q;const C=window.getComputedStyle(q),N=C.overflow+C.overflowY+C.overflowX;if(N.includes("auto")||N.includes("scroll")||q===document.body||q===document.documentElement)return q;q=q.parentElement}return document.body},Ke=()=>{if(!c.value)return;const z=c.value.getBoundingClientRect(),q=window.innerHeight||document.documentElement.clientHeight,C=window.innerWidth||document.documentElement.clientWidth,N=8,j=8,J=t.maxHeight||300,le=q-z.bottom-j-N,ue=z.top-j-N,Ee=le>=ue,Ce=Math.max(C-N*2,0);let{width:Ge}=z;Ce>0&&Ge>Ce&&(Ge=Ce);let{left:Je}=z;Je+Ge+N>C&&(Je=C-Ge-N),Je=Math.max(Je,N);const sn=Math.min(J,Math.max(Ee?le:ue,50));x.value=Ee?"bottom":"top",w.value={position:"fixed",left:`${Je}px`,width:`${Ge}px`,maxHeight:`${sn}px`,transform:Ee?"none":"translateY(-100%)",top:Ee?`${z.bottom+j}px`:`${z.top-j}px`}},B=async z=>{l.value||!p.value&&(z.key==="ArrowDown"||z.key==="ArrowUp")&&(z.preventDefault(),await St())},O=z=>{if(!p.value)return;const{key:q}=z;if(q==="ArrowDown")z.preventDefault(),g.value+1<V.value.length&&(g.value+=1,Oe(y.value[g.value],d.value));else if(q==="ArrowUp")z.preventDefault(),g.value>0&&(g.value-=1,Oe(y.value[g.value],d.value));else if(q==="Enter"){z.preventDefault();const C=V.value[g.value];C&&fe(C),k.value?.blur()}else q==="Escape"?(z.preventDefault(),gt()):q==="Backspace"?s.value&&b.value===""&&v.value.length&&(v.value=v.value.slice(0,-1),a.value=[...v.value],r("change",a.value)):q==="Home"?(g.value=0,Oe(y.value[0],d.value)):q==="End"?(g.value=V.value.length-1,Oe(y.value[g.value],d.value)):q==="Tab"&>()},Z=()=>{l.value||(h.value=!0)},he=()=>{h.value=!1,b.value=""},ve=z=>{z.key==="Escape"&&p.value&>()},W=z=>{const q=z.target;i.value?.contains(q)||u.value?.contains(q)||gt()},X=z=>{p.value&&d.value&&!d.value.contains(z.target)&&Ke()},Ne=()=>{p.value&&Ke()},qe=()=>{p.value&&Ke()};o.watch(()=>t.options,z=>{z?.length&&(m.value=[...z],lt())},{immediate:!0});async function lt(){if(s.value)Array.isArray(a.value)?v.value=[...a.value]:(v.value=a.value==null?[]:[a.value],a.value=[...v.value]),t.data&&v.value.length&&(await We(v.value),await o.nextTick());else{if(Array.isArray(a.value)){const z=a.value[0]??null;a.value=z??null}a.value!=null&&(f.value=await ze(a.value)),ie(f.value??null)}}o.watch(a,()=>{lt()}),o.onMounted(async()=>{addEventListener("keydown",ve),addEventListener("scroll",X,!0),addEventListener("resize",Ne),document.addEventListener("click",W,!0),c.value&&He(c.value).addEventListener("scroll",qe,!0),t.options?.length&&!t.data?m.value=[...t.options]:t.data&&(m.value=await Q("")),await lt(),se.value=!1}),o.onUnmounted(()=>{removeEventListener("keydown",ve),removeEventListener("scroll",X,!0),removeEventListener("resize",Ne),document.removeEventListener("click",W,!0),c.value&&He(c.value).removeEventListener("scroll",qe,!0)});const T=o.ref(!1),F=o.ref({}),te=o.ref([]),ce=o.ref(null);async function me(){if(!t.add?.token||ce?.value.validate())return;const q=t.add.api??`/api/table/${t.add.token}`,{id:C}=await fetch(q,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(F.value)}).then(N=>N.json());if(!t.options?.length&&t.data){const N=await fetch(`${t.api??`/api/suggest/${t.data}`}?val=${C}`).then(j=>j.json());f.value=N[0],m.value.push(N[0]),a.value=C}T.value=!1,nt.notify({title:"Success!",message:"Object created."})}async function Te(){if(!t.add)return null;const z=await fetch(`/api/template/form/${t.add.form}`).then(q=>q.json());return te.value=z.schema,T.value=!0,null}function K(z,q=200){let C;return(...N)=>{C&&clearTimeout(C),C=window.setTimeout(()=>z(...N),q)}}const ee=K(async z=>{m.value=await Q(z)},200);o.watch(b,z=>{t.data&&ee(z.trim())}),o.watch(()=>t.options,z=>{!t.data&&z?.length&&(m.value=[...z],lt())},{immediate:!0}),o.watch(()=>t.parent??t.parentValue,()=>{t.data&&Pe()});const se=o.ref(!0);return o.watch(Ae,async()=>{if(t.data&&(se.value||(s.value?(v.value=[],a.value=[],r("change",[])):(f.value=null,a.value=null,r("change",null))),await Pe(),t.auto===1&&Ae.value&&m.value.length>0)){const z=m.value[0];z&&fe(z)}}),(z,q)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(o.unref(nt.VsModal),{visible:T.value,"onUpdate:visible":q[1]||(q[1]=C=>T.value=C),class:"z-[1000]",title:"Додати",buttonText:"Додати",onDone:me,teleport:z.teleport},{default:o.withCtx(()=>[o.createVNode(Qn,{schema:te.value,modelValue:F.value,"onUpdate:modelValue":q[0]||(q[0]=C=>F.value=C),ref_key:"addForm",ref:ce},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),o.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:q[5]||(q[5]=o.withModifiers(()=>{},["stop"]))},[o.createElementVNode("div",{class:o.normalizeClass(["relative w-full font-sans",t.customClass])},[q[10]||(q[10]=o.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),q[11]||(q[11]=o.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),o.createElementVNode("div",{class:o.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-[#b3d4ff]",p.value||h.value?"border-[#2684ff] ring-1 ring-[#2684ff]":"",l.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":p.value,"aria-haspopup":"listbox",onKeydown:B,onClick:on,"data-focus":p.value||h.value?"true":"false",ref_key:"triggerRef",ref:c},[o.createElementVNode("div",Xk,[s.value?(o.openBlock(),o.createElementBlock("div",Qk,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(_.value,C=>(o.openBlock(),o.createElementBlock("div",{class:"flex min-w-0 bg-[rgb(230,230,230)] rounded-[2px] m-[2px] box-border max-w-full",key:C.id},[o.createElementVNode("div",e1,[C?.color?(o.openBlock(),o.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:o.normalizeStyle({backgroundColor:C?.color})},null,4)):o.createCommentVNode("",!0),o.createElementVNode("div",{class:"truncate text-[#172b4d] overflow-hidden max-w-[200px] px-0.5 pl-1.5",title:H(C)},[D.value?(o.openBlock(),o.createElementBlock("span",{key:0,innerHTML:P(C)},null,8,n1)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(C.text),1)],64))],8,t1)]),o.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border text-[#172b4d] hover:bg-[rgb(255,189,173)] hover:text-[rgb(222,53,11)] flex-shrink-0",onClick:o.withModifiers(N=>re(C.id),["stop"])},q[6]||(q[6]=[o.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[o.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,r1)]))),128)),o.createElementVNode("div",o1,[!l.value&&z.search?o.withDirectives((o.openBlock(),o.createElementBlock("input",{key:0,ref_key:"inputRef",ref:k,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:v.value.length?" ":E.value,"onUpdate:modelValue":q[2]||(q[2]=C=>b.value=C),onFocus:Z,onBlur:he,onKeydown:O},null,40,s1)),[[o.vModelText,b.value]]):o.createCommentVNode("",!0)])])):!s.value&&!h.value&&S.value&&b.value===""?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["truncate text-gray-900"]),title:S.value},[f.value?.color?(o.openBlock(),o.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:o.normalizeStyle({backgroundColor:f.value?.color})},null,4)):o.createCommentVNode("",!0),D.value?(o.openBlock(),o.createElementBlock("span",{key:1,class:o.normalizeClass({"pl-5":f.value?.color}),innerHTML:P(f.value)},null,10,a1)):(o.openBlock(),o.createElementBlock("span",{key:2,class:o.normalizeClass({"pl-5":f.value?.color})},o.toDisplayString(f.value?.text),3))],8,l1)):o.createCommentVNode("",!0),s.value?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",i1,[!l.value&&z.search?o.withDirectives((o.openBlock(),o.createElementBlock("input",{key:0,ref_key:"inputRef",ref:k,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:S.value?" ":E.value,"onUpdate:modelValue":q[3]||(q[3]=C=>b.value=C),onFocus:Z,onBlur:he,onKeydown:O},null,40,c1)),[[o.vModelText,b.value]]):o.createCommentVNode("",!0)]))]),o.createElementVNode("div",d1,[I.value?(o.openBlock(),o.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:l.value,onClick:o.withModifiers(Y,["stop"])},q[7]||(q[7]=[o.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[o.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,u1)):o.createCommentVNode("",!0),q[9]||(q[9]=o.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),o.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:l.value,onClick:q[4]||(q[4]=o.withModifiers(C=>Wt(),["stop"])),title:p.value?"Закрити список":"Відкрити список"},q[8]||(q[8]=[o.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[o.createElementVNode("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})],-1)]),8,p1)])],42,Zk),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[p.value?(o.openBlock(),o.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:o.normalizeClass(["fixed z-[3000] rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]"]),style:o.normalizeStyle(w.value),role:"listbox"},[o.createElementVNode("div",{class:"overflow-y-auto py-1",style:o.normalizeStyle({maxHeight:w.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[V.value.length?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:0},o.renderList(V.value,(C,N)=>(o.openBlock(),o.createElementBlock("div",{key:C.id,ref_for:!0,ref:j=>y.value[N]=j,class:o.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900",A(C.id)?"bg-[#2684ff] text-white":"bg-white hover:bg-[#deebff] hover:text-[#172b4d]",g.value===N&&!A(C.id)?"bg-[#deebff] text-[#172b4d]":""]),"aria-disabled":A(C.id)?"true":"false",role:"option",tabindex:"-1",onClick:j=>be(C)},[C?.color?(o.openBlock(),o.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:o.normalizeStyle({backgroundColor:C?.color})},null,4)):o.createCommentVNode("",!0),o.createElementVNode("div",{class:o.normalizeClass(["leading-[19px]",g.value===C.id?"text-white":"",(g.value===N,"")])},[D.value?(o.openBlock(),o.createElementBlock("span",{key:0,innerHTML:P(C)},null,8,f1)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(C.text),1)],64))],2)],10,h1))),128)):(o.openBlock(),o.createElementBlock("div",m1," No options "))],4)],4)):o.createCommentVNode("",!0)]))],2),t.add?(o.openBlock(),o.createElementBlock("button",{key:0,onClick:Te,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:l.value,type:"button"},[o.createVNode(zn,{width:"16",height:"16"}),q[12]||(q[12]=o.createElementVNode("span",null,"Додати",-1))],8,g1)):o.createCommentVNode("",!0)],512)],64))}}),y1=["placeholder","disabled"],Yd=o.defineComponent({__name:"vs-input-textarea",props:o.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=Ot(e.style),r=o.useModel(n,"modelValue"),s=o.computed(()=>!!e.disabled),l=o.computed(()=>e.placeholder??"");function a(){typeof r.value=="string"&&(r.value=r.value.trim())}return(i,c)=>o.withDirectives((o.openBlock(),o.createElementBlock("textarea",{"onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),placeholder:l.value,disabled:s.value,row:"2",onBlur:a,class:o.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[o.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,42,y1)),[[o.vModelText,r.value]])}});function Nt(n){this.content=n}Nt.prototype={constructor:Nt,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var r=t&&t!=n?this.remove(t):this,s=r.find(n),l=r.content.slice();return s==-1?l.push(t||n,e):(l[s+1]=e,t&&(l[s]=t)),new Nt(l)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Nt(t)},addToStart:function(n,e){return new Nt([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Nt(t)},addBefore:function(n,e,t){var r=this.remove(e),s=r.content.slice(),l=r.find(n);return s.splice(l==-1?s.length:l,0,e,t),new Nt(s)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Nt.from(n),n.size?new Nt(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Nt.from(n),n.size?new Nt(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Nt.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}},Nt.from=function(n){if(n instanceof Nt)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Nt(e)};function Jd(n,e,t){for(let r=0;;r++){if(r==n.childCount||r==e.childCount)return n.childCount==e.childCount?null:t;let s=n.child(r),l=e.child(r);if(s==l){t+=s.nodeSize;continue}if(!s.sameMarkup(l))return t;if(s.isText&&s.text!=l.text){for(let a=0;s.text[a]==l.text[a];a++)t++;return t}if(s.content.size||l.content.size){let a=Jd(s.content,l.content,t+1);if(a!=null)return a}t+=s.nodeSize}}function Zd(n,e,t,r){for(let s=n.childCount,l=e.childCount;;){if(s==0||l==0)return s==l?null:{a:t,b:r};let a=n.child(--s),i=e.child(--l),c=a.nodeSize;if(a==i){t-=c,r-=c;continue}if(!a.sameMarkup(i))return{a:t,b:r};if(a.isText&&a.text!=i.text){let d=0,u=Math.min(a.text.length,i.text.length);for(;d<u&&a.text[a.text.length-d-1]==i.text[i.text.length-d-1];)d++,t--,r--;return{a:t,b:r}}if(a.content.size||i.content.size){let d=Zd(a.content,i.content,t-1,r-1);if(d)return d}t-=c,r-=c}}let ne=class Kt{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,t,r,s=0,l){for(let a=0,i=0;i<t;a++){let c=this.content[a],d=i+c.nodeSize;if(d>e&&r(c,s+i,l||null,a)!==!1&&c.content.size){let u=i+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,t-u),r,s+u)}i=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,r,s){let l="",a=!0;return this.nodesBetween(e,t,(i,c)=>{let d=i.isText?i.text.slice(Math.max(e,c)-c,t-c):i.isLeaf?s?typeof s=="function"?s(i):s:i.type.spec.leafText?i.type.spec.leafText(i):"":"";i.isBlock&&(i.isLeaf&&d||i.isTextblock)&&r&&(a?a=!1:l+=r),l+=d},0),l}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,r=e.firstChild,s=this.content.slice(),l=0;for(t.isText&&t.sameMarkup(r)&&(s[s.length-1]=t.withText(t.text+r.text),l=1);l<e.content.length;l++)s.push(e.content[l]);return new Kt(s,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let r=[],s=0;if(t>e)for(let l=0,a=0;a<t;l++){let i=this.content[l],c=a+i.nodeSize;c>e&&((a<e||c>t)&&(i.isText?i=i.cut(Math.max(0,e-a),Math.min(i.text.length,t-a)):i=i.cut(Math.max(0,e-a-1),Math.min(i.content.size,t-a-1))),r.push(i),s+=i.nodeSize),a=c}return new Kt(r,s)}cutByIndex(e,t){return e==t?Kt.empty:e==0&&t==this.content.length?this:new Kt(this.content.slice(e,t))}replaceChild(e,t){let r=this.content[e];if(r==t)return this;let s=this.content.slice(),l=this.size+t.nodeSize-r.nodeSize;return s[e]=t,new Kt(s,l)}addToStart(e){return new Kt([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Kt(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,r=0;t<this.content.length;t++){let s=this.content[t];e(s,r,t),r+=s.nodeSize}}findDiffStart(e,t=0){return Jd(this,e,t)}findDiffEnd(e,t=this.size,r=e.size){return Zd(this,e,t,r)}findIndex(e){if(e==0)return Is(0,e);if(e==this.size)return Is(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,r=0;;t++){let s=this.child(t),l=r+s.nodeSize;if(l>=e)return l==e?Is(t+1,l):Is(t,r);r=l}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return Kt.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Kt(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Kt.empty;let t,r=0;for(let s=0;s<e.length;s++){let l=e[s];r+=l.nodeSize,s&&l.isText&&e[s-1].sameMarkup(l)?(t||(t=e.slice(0,s)),t[t.length-1]=l.withText(t[t.length-1].text+l.text)):t&&t.push(l)}return new Kt(t||e,r)}static from(e){if(!e)return Kt.empty;if(e instanceof Kt)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Kt([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};ne.empty=new ne([],0);const qa={index:0,offset:0};function Is(n,e){return qa.index=n,qa.offset=e,qa}function Fs(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let r=0;r<n.length;r++)if(!Fs(n[r],e[r]))return!1}else{for(let r in n)if(!(r in e)||!Fs(n[r],e[r]))return!1;for(let r in e)if(!(r in n))return!1}return!0}let et=class Dd{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,r=!1;for(let s=0;s<e.length;s++){let l=e[s];if(this.eq(l))return e;if(this.type.excludes(l.type))t||(t=e.slice(0,s));else{if(l.type.excludes(this.type))return e;!r&&l.type.rank>this.type.rank&&(t||(t=e.slice(0,s)),t.push(this),r=!0),t&&t.push(l)}}return t||(t=e.slice()),r||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Fs(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[t.type];if(!r)throw new RangeError(`There is no mark type ${t.type} in this schema`);let s=r.create(t.attrs);return r.checkAttrs(s.attrs),s}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(t[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Dd.none;if(e instanceof Dd)return[e];let t=e.slice();return t.sort((r,s)=>r.type.rank-s.type.rank),t}};et.none=[];class $s extends Error{}class de{constructor(e,t,r){this.content=e,this.openStart=t,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let r=Qd(this.content,e+this.openStart,t);return r&&new de(r,this.openStart,this.openEnd)}removeBetween(e,t){return new de(Xd(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return de.empty;let r=t.openStart||0,s=t.openEnd||0;if(typeof r!="number"||typeof s!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new de(ne.fromJSON(e,t.content),r,s)}static maxOpen(e,t=!0){let r=0,s=0;for(let l=e.firstChild;l&&!l.isLeaf&&(t||!l.type.spec.isolating);l=l.firstChild)r++;for(let l=e.lastChild;l&&!l.isLeaf&&(t||!l.type.spec.isolating);l=l.lastChild)s++;return new de(e,r,s)}}de.empty=new de(ne.empty,0,0);function Xd(n,e,t){let{index:r,offset:s}=n.findIndex(e),l=n.maybeChild(r),{index:a,offset:i}=n.findIndex(t);if(s==e||l.isText){if(i!=t&&!n.child(a).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(r!=a)throw new RangeError("Removing non-flat range");return n.replaceChild(r,l.copy(Xd(l.content,e-s-1,t-s-1)))}function Qd(n,e,t,r){let{index:s,offset:l}=n.findIndex(e),a=n.maybeChild(s);if(l==e||a.isText)return r&&!r.canReplace(s,s,t)?null:n.cut(0,e).append(t).append(n.cut(e));let i=Qd(a.content,e-l-1,t,a);return i&&n.replaceChild(s,a.copy(i))}function b1(n,e,t){if(t.openStart>n.depth)throw new $s("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new $s("Inconsistent open depths");return eu(n,e,t,0)}function eu(n,e,t,r){let s=n.index(r),l=n.node(r);if(s==e.index(r)&&r<n.depth-t.openStart){let a=eu(n,e,t,r+1);return l.copy(l.content.replaceChild(s,a))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==r&&e.depth==r){let a=n.parent,i=a.content;return Mr(a,i.cut(0,n.parentOffset).append(t.content).append(i.cut(e.parentOffset)))}else{let{start:a,end:i}=k1(t,n);return Mr(l,nu(n,a,i,e,r))}else return Mr(l,Rs(n,e,r))}function tu(n,e){if(!e.type.compatibleContent(n.type))throw new $s("Cannot join "+e.type.name+" onto "+n.type.name)}function Ga(n,e,t){let r=n.node(t);return tu(r,e.node(t)),r}function Vr(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function No(n,e,t,r){let s=(e||n).node(t),l=0,a=e?e.index(t):s.childCount;n&&(l=n.index(t),n.depth>t?l++:n.textOffset&&(Vr(n.nodeAfter,r),l++));for(let i=l;i<a;i++)Vr(s.child(i),r);e&&e.depth==t&&e.textOffset&&Vr(e.nodeBefore,r)}function Mr(n,e){return n.type.checkContent(e),n.copy(e)}function nu(n,e,t,r,s){let l=n.depth>s&&Ga(n,e,s+1),a=r.depth>s&&Ga(t,r,s+1),i=[];return No(null,n,s,i),l&&a&&e.index(s)==t.index(s)?(tu(l,a),Vr(Mr(l,nu(n,e,t,r,s+1)),i)):(l&&Vr(Mr(l,Rs(n,e,s+1)),i),No(e,t,s,i),a&&Vr(Mr(a,Rs(t,r,s+1)),i)),No(r,null,s,i),new ne(i)}function Rs(n,e,t){let r=[];if(No(null,n,t,r),n.depth>t){let s=Ga(n,e,t+1);Vr(Mr(s,Rs(n,e,t+1)),r)}return No(e,null,t,r),new ne(r)}function k1(n,e){let t=e.depth-n.openStart,r=e.node(t).copy(n.content);for(let s=t-1;s>=0;s--)r=e.node(s).copy(ne.from(r));return{start:r.resolveNoCache(n.openStart+t),end:r.resolveNoCache(r.content.size-n.openEnd-t)}}class Vo{constructor(e,t,r){this.pos=e,this.path=t,this.parentOffset=r,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],s=e.child(t);return r?e.child(t).cut(r):s}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let r=this.path[t*3],s=t==0?0:this.path[t*3-1]+1;for(let l=0;l<e;l++)s+=r.child(l).nodeSize;return s}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return et.none;if(this.textOffset)return e.child(t).marks;let r=e.maybeChild(t-1),s=e.maybeChild(t);if(!r){let i=r;r=s,s=i}let l=r.marks;for(var a=0;a<l.length;a++)l[a].type.spec.inclusive===!1&&(!s||!l[a].isInSet(s.marks))&&(l=l[a--].removeFromSet(l));return l}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let r=t.marks,s=e.parent.maybeChild(e.index());for(var l=0;l<r.length;l++)r[l].type.spec.inclusive===!1&&(!s||!r[l].isInSet(s.marks))&&(r=r[l--].removeFromSet(r));return r}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!t||t(this.node(r))))return new Ps(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let r=[],s=0,l=t;for(let a=e;;){let{index:i,offset:c}=a.content.findIndex(l),d=l-c;if(r.push(a,i,s+c),!d||(a=a.child(i),a.isText))break;l=d-1,s+=c+1}return new Vo(t,r,l)}static resolveCached(e,t){let r=ru.get(e);if(r)for(let l=0;l<r.elts.length;l++){let a=r.elts[l];if(a.pos==t)return a}else ru.set(e,r=new w1);let s=r.elts[r.i]=Vo.resolve(e,t);return r.i=(r.i+1)%x1,s}}class w1{constructor(){this.elts=[],this.i=0}}const x1=12,ru=new WeakMap;class Ps{constructor(e,t,r){this.$from=e,this.$to=t,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const v1=Object.create(null);let tr=class Od{constructor(e,t,r,s=et.none){this.type=e,this.attrs=t,this.marks=s,this.content=r||ne.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,r,s=0){this.content.nodesBetween(e,t,r,s,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,r,s){return this.content.textBetween(e,t,r,s)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,r){return this.type==e&&Fs(this.attrs,t||e.defaultAttrs||v1)&&et.sameSet(this.marks,r||et.none)}copy(e=null){return e==this.content?this:new Od(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Od(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,r=!1){if(e==t)return de.empty;let s=this.resolve(e),l=this.resolve(t),a=r?0:s.sharedDepth(t),i=s.start(a),c=s.node(a).content.cut(s.pos-i,l.pos-i);return new de(c,s.depth-a,l.depth-a)}replace(e,t,r){return b1(this.resolve(e),this.resolve(t),r)}nodeAt(e){for(let t=this;;){let{index:r,offset:s}=t.content.findIndex(e);if(t=t.maybeChild(r),!t)return null;if(s==e||t.isText)return t;e-=s+1}}childAfter(e){let{index:t,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(t),index:t,offset:r};let s=this.content.child(t-1);return{node:s,index:t-1,offset:r-s.nodeSize}}resolve(e){return Vo.resolveCached(this,e)}resolveNoCache(e){return Vo.resolve(this,e)}rangeHasMark(e,t,r){let s=!1;return t>e&&this.nodesBetween(e,t,l=>(r.isInSet(l.marks)&&(s=!0),!s)),s}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),ou(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,r=ne.empty,s=0,l=r.childCount){let a=this.contentMatchAt(e).matchFragment(r,s,l),i=a&&a.matchFragment(this.content,t);if(!i||!i.validEnd)return!1;for(let c=s;c<l;c++)if(!this.type.allowsMarks(r.child(c).marks))return!1;return!0}canReplaceWith(e,t,r,s){if(s&&!this.type.allowsMarks(s))return!1;let l=this.contentMatchAt(e).matchType(r),a=l&&l.matchFragment(this.content,t);return a?a.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=et.none;for(let t=0;t<this.marks.length;t++){let r=this.marks[t];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!et.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let r;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,r)}let s=ne.fromJSON(e,t.content),l=e.nodeType(t.type).create(t.attrs,s,r);return l.type.checkAttrs(l.attrs),l}};tr.prototype.text=void 0;class zs extends tr{constructor(e,t,r,s){if(super(e,t,null,s),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ou(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new zs(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new zs(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function ou(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class Br{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let r=new E1(e,t);if(r.next==null)return Br.empty;let s=su(r);r.next&&r.err("Unexpected trailing text");let l=B1(M1(s));return A1(l,r),l}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,r=e.childCount){let s=this;for(let l=t;s&&l<r;l++)s=s.matchType(e.child(l).type);return s}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let r=0;r<e.next.length;r++)if(this.next[t].type==e.next[r].type)return!0;return!1}fillBefore(e,t=!1,r=0){let s=[this];function l(a,i){let c=a.matchFragment(e,r);if(c&&(!t||c.validEnd))return ne.from(i.map(d=>d.createAndFill()));for(let d=0;d<a.next.length;d++){let{type:u,next:p}=a.next[d];if(!(u.isText||u.hasRequiredAttrs())&&s.indexOf(p)==-1){s.push(p);let h=l(p,i.concat(u));if(h)return h}}return null}return l(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let s=r.shift(),l=s.match;if(l.matchType(e)){let a=[];for(let i=s;i.type;i=i.via)a.push(i.type);return a.reverse()}for(let a=0;a<l.next.length;a++){let{type:i,next:c}=l.next[a];!i.isLeaf&&!i.hasRequiredAttrs()&&!(i.name in t)&&(!s.type||c.validEnd)&&(r.push({match:i.contentMatch,type:i,via:s}),t[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(r){e.push(r);for(let s=0;s<r.next.length;s++)e.indexOf(r.next[s].next)==-1&&t(r.next[s].next)}return t(this),e.map((r,s)=>{let l=s+(r.validEnd?"*":" ")+" ";for(let a=0;a<r.next.length;a++)l+=(a?", ":"")+r.next[a].type.name+"->"+e.indexOf(r.next[a].next);return l}).join(`
|
|
2
|
+
`)}}Br.empty=new Br(!0);class E1{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function su(n){let e=[];do e.push(C1(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function C1(n){let e=[];do e.push(_1(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function _1(n){let e=V1(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=S1(n,e);else break;return e}function lu(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function S1(n,e){let t=lu(n),r=t;return n.eat(",")&&(n.next!="}"?r=lu(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:r,expr:e}}function N1(n,e){let t=n.nodeTypes,r=t[e];if(r)return[r];let s=[];for(let l in t){let a=t[l];a.isInGroup(e)&&s.push(a)}return s.length==0&&n.err("No node type or group '"+e+"' found"),s}function V1(n){if(n.eat("(")){let e=su(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=N1(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function M1(n){let e=[[]];return s(l(n,0),t()),e;function t(){return e.push([])-1}function r(a,i,c){let d={term:c,to:i};return e[a].push(d),d}function s(a,i){a.forEach(c=>c.to=i)}function l(a,i){if(a.type=="choice")return a.exprs.reduce((c,d)=>c.concat(l(d,i)),[]);if(a.type=="seq")for(let c=0;;c++){let d=l(a.exprs[c],i);if(c==a.exprs.length-1)return d;s(d,i=t())}else if(a.type=="star"){let c=t();return r(i,c),s(l(a.expr,c),c),[r(c)]}else if(a.type=="plus"){let c=t();return s(l(a.expr,i),c),s(l(a.expr,c),c),[r(c)]}else{if(a.type=="opt")return[r(i)].concat(l(a.expr,i));if(a.type=="range"){let c=i;for(let d=0;d<a.min;d++){let u=t();s(l(a.expr,c),u),c=u}if(a.max==-1)s(l(a.expr,c),c);else for(let d=a.min;d<a.max;d++){let u=t();r(c,u),s(l(a.expr,c),u),c=u}return[r(c)]}else{if(a.type=="name")return[r(i,void 0,a.value)];throw new Error("Unknown expr type")}}}}function au(n,e){return e-n}function iu(n,e){let t=[];return r(e),t.sort(au);function r(s){let l=n[s];if(l.length==1&&!l[0].term)return r(l[0].to);t.push(s);for(let a=0;a<l.length;a++){let{term:i,to:c}=l[a];!i&&t.indexOf(c)==-1&&r(c)}}}function B1(n){let e=Object.create(null);return t(iu(n,0));function t(r){let s=[];r.forEach(a=>{n[a].forEach(({term:i,to:c})=>{if(!i)return;let d;for(let u=0;u<s.length;u++)s[u][0]==i&&(d=s[u][1]);iu(n,c).forEach(u=>{d||s.push([i,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let l=e[r.join(",")]=new Br(r.indexOf(n.length-1)>-1);for(let a=0;a<s.length;a++){let i=s[a][1].sort(au);l.next.push({type:s[a][0],next:e[i.join(",")]||t(i)})}return l}}function A1(n,e){for(let t=0,r=[n];t<r.length;t++){let s=r[t],l=!s.validEnd,a=[];for(let i=0;i<s.next.length;i++){let{type:c,next:d}=s.next[i];a.push(c.name),l&&!(c.isText||c.hasRequiredAttrs())&&(l=!1),r.indexOf(d)==-1&&r.push(d)}l&&e.err("Only non-generatable nodes ("+a.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function cu(n){let e=Object.create(null);for(let t in n){let r=n[t];if(!r.hasDefault)return null;e[t]=r.default}return e}function du(n,e){let t=Object.create(null);for(let r in n){let s=e&&e[r];if(s===void 0){let l=n[r];if(l.hasDefault)s=l.default;else throw new RangeError("No value supplied for attribute "+r)}t[r]=s}return t}function uu(n,e,t,r){for(let s in e)if(!(s in n))throw new RangeError(`Unsupported attribute ${s} for ${t} of type ${s}`);for(let s in n){let l=n[s];l.validate&&l.validate(e[s])}}function pu(n,e){let t=Object.create(null);if(e)for(let r in e)t[r]=new L1(n,r,e[r]);return t}let hu=class Gg{constructor(e,t,r){this.name=e,this.schema=t,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=pu(e,r.attrs),this.defaultAttrs=cu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Br.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:du(this.attrs,e)}create(e=null,t,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new tr(this,this.computeAttrs(e),ne.from(t),et.setFrom(r))}createChecked(e=null,t,r){return t=ne.from(t),this.checkContent(t),new tr(this,this.computeAttrs(e),t,et.setFrom(r))}createAndFill(e=null,t,r){if(e=this.computeAttrs(e),t=ne.from(t),t.size){let a=this.contentMatch.fillBefore(t);if(!a)return null;t=a.append(t)}let s=this.contentMatch.matchFragment(t),l=s&&s.fillBefore(ne.empty,!0);return l?new tr(this,e,t.append(l),et.setFrom(r)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){uu(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?t&&t.push(e[r]):t||(t=e.slice(0,r));return t?t.length?t:et.none:e}static compile(e,t){let r=Object.create(null);e.forEach((l,a)=>r[l]=new Gg(l,t,a));let s=t.spec.topNode||"doc";if(!r[s])throw new RangeError("Schema is missing its top node type ('"+s+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let l in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function T1(n,e,t){let r=t.split("|");return s=>{let l=s===null?"null":typeof s;if(r.indexOf(l)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${n}, got ${l}`)}}class L1{constructor(e,t,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?T1(e,t,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class js{constructor(e,t,r,s){this.name=e,this.rank=t,this.schema=r,this.spec=s,this.attrs=pu(e,s.attrs),this.excluded=null;let l=cu(this.attrs);this.instance=l?new et(this,l):null}create(e=null){return!e&&this.instance?this.instance:new et(this,du(this.attrs,e))}static compile(e,t){let r=Object.create(null),s=0;return e.forEach((l,a)=>r[l]=new js(l,s++,t,a)),r}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){uu(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class fu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let s in e)t[s]=e[s];t.nodes=Nt.from(e.nodes),t.marks=Nt.from(e.marks||{}),this.nodes=hu.compile(this.spec.nodes,this),this.marks=js.compile(this.spec.marks,this);let r=Object.create(null);for(let s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");let l=this.nodes[s],a=l.spec.content||"",i=l.spec.marks;if(l.contentMatch=r[a]||(r[a]=Br.parse(a,this.nodes)),l.inlineContent=l.contentMatch.inlineContent,l.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!l.isInline||!l.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=l}l.markSet=i=="_"?null:i?mu(this,i.split(" ")):i==""||!l.inlineContent?[]:null}for(let s in this.marks){let l=this.marks[s],a=l.spec.excludes;l.excluded=a==null?[l]:a==""?[]:mu(this,a.split(" "))}this.nodeFromJSON=s=>tr.fromJSON(this,s),this.markFromJSON=s=>et.fromJSON(this,s),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,r,s){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof hu){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,r,s)}text(e,t){let r=this.nodes.text;return new zs(r,r.defaultAttrs,e,et.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function mu(n,e){let t=[];for(let r=0;r<e.length;r++){let s=e[r],l=n.marks[s],a=l;if(l)t.push(l);else for(let i in n.marks){let c=n.marks[i];(s=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(s)>-1)&&t.push(a=c)}if(!a)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return t}function D1(n){return n.tag!=null}function O1(n){return n.style!=null}let eo=class Id{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let r=this.matchedStyles=[];t.forEach(s=>{if(D1(s))this.tags.push(s);else if(O1(s)){let l=/[^=]*/.exec(s.style)[0];r.indexOf(l)<0&&r.push(l),this.styles.push(s)}}),this.normalizeLists=!this.tags.some(s=>{if(!/^(ul|ol)\b/.test(s.tag)||!s.node)return!1;let l=e.nodes[s.node];return l.contentMatch.matchType(l)})}parse(e,t={}){let r=new ku(this,t,!1);return r.addAll(e,et.none,t.from,t.to),r.finish()}parseSlice(e,t={}){let r=new ku(this,t,!0);return r.addAll(e,et.none,t.from,t.to),de.maxOpen(r.finish())}matchTag(e,t,r){for(let s=r?this.tags.indexOf(r)+1:0;s<this.tags.length;s++){let l=this.tags[s];if($1(e,l.tag)&&(l.namespace===void 0||e.namespaceURI==l.namespace)&&(!l.context||t.matchesContext(l.context))){if(l.getAttrs){let a=l.getAttrs(e);if(a===!1)continue;l.attrs=a||void 0}return l}}}matchStyle(e,t,r,s){for(let l=s?this.styles.indexOf(s)+1:0;l<this.styles.length;l++){let a=this.styles[l],i=a.style;if(!(i.indexOf(e)!=0||a.context&&!r.matchesContext(a.context)||i.length>e.length&&(i.charCodeAt(e.length)!=61||i.slice(e.length+1)!=t))){if(a.getAttrs){let c=a.getAttrs(t);if(c===!1)continue;a.attrs=c||void 0}return a}}}static schemaRules(e){let t=[];function r(s){let l=s.priority==null?50:s.priority,a=0;for(;a<t.length;a++){let i=t[a];if((i.priority==null?50:i.priority)<l)break}t.splice(a,0,s)}for(let s in e.marks){let l=e.marks[s].spec.parseDOM;l&&l.forEach(a=>{r(a=wu(a)),a.mark||a.ignore||a.clearMark||(a.mark=s)})}for(let s in e.nodes){let l=e.nodes[s].spec.parseDOM;l&&l.forEach(a=>{r(a=wu(a)),a.node||a.ignore||a.mark||(a.node=s)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Id(e,Id.schemaRules(e)))}};const gu={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},I1={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},yu={ol:!0,ul:!0},Mo=1,Ya=2,Bo=4;function bu(n,e,t){return e!=null?(e?Mo:0)|(e==="full"?Ya:0):n&&n.whitespace=="pre"?Mo|Ya:t&~Bo}class Hs{constructor(e,t,r,s,l,a){this.type=e,this.attrs=t,this.marks=r,this.solid=s,this.options=a,this.content=[],this.activeMarks=et.none,this.match=l||(a&Bo?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(ne.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let r=this.type.contentMatch,s;return(s=r.findWrapping(e.type))?(this.match=r,s):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Mo)){let r=this.content[this.content.length-1],s;if(r&&r.isText&&(s=/[ \t\r\n\u000c]+$/.exec(r.text))){let l=r;r.text.length==s[0].length?this.content.pop():this.content[this.content.length-1]=l.withText(l.text.slice(0,l.text.length-s[0].length))}}let t=ne.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(ne.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!gu.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ku{constructor(e,t,r){this.parser=e,this.options=t,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let s=t.topNode,l,a=bu(null,t.preserveWhitespace,0)|(r?Bo:0);s?l=new Hs(s.type,s.attrs,et.none,!0,t.topMatch||s.type.contentMatch,a):r?l=new Hs(null,null,et.none,!0,null,a):l=new Hs(e.schema.topNodeType,null,et.none,!0,null,a),this.nodes=[l],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let r=e.nodeValue,s=this.top,l=s.options&Ya?"full":this.localPreserveWS||(s.options&Mo)>0;if(l==="full"||s.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(l)l!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
|
|
3
|
+
`);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let a=s.content[s.content.length-1],i=e.previousSibling;(!a||i&&i.nodeName=="BR"||a.isText&&/[ \t\r\n\u000c]$/.test(a.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),t,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,t,r){let s=this.localPreserveWS,l=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let a=e.nodeName.toLowerCase(),i;yu.hasOwnProperty(a)&&this.parser.normalizeLists&&F1(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,r));e:if(c?c.ignore:I1.hasOwnProperty(a))this.findInside(e),this.ignoreFallback(e,t);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let d,u=this.needsBlock;if(gu.hasOwnProperty(a))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),d=!0,l.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let p=c&&c.skip?t:this.readStyles(e,t);p&&this.addAll(e,p),d&&this.sync(l),this.needsBlock=u}else{let d=this.readStyles(e,t);d&&this.addElementByRule(e,c,d,c.consuming===!1?i:void 0)}this.localPreserveWS=s}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
4
|
+
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let r=e.style;if(r&&r.length)for(let s=0;s<this.parser.matchedStyles.length;s++){let l=this.parser.matchedStyles[s],a=r.getPropertyValue(l);if(a)for(let i=void 0;;){let c=this.parser.matchStyle(l,a,this,i);if(!c)break;if(c.ignore)return null;if(c.clearMark?t=t.filter(d=>!c.clearMark(d)):t=t.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)i=c;else break}}return t}addElementByRule(e,t,r,s){let l,a;if(t.node)if(a=this.parser.schema.nodes[t.node],a.isLeaf)this.insertNode(a.create(t.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let c=this.enter(a,t.attrs||null,r,t.preserveWhitespace);c&&(l=!0,r=c)}else{let c=this.parser.schema.marks[t.mark];r=r.concat(c.create(t.attrs))}let i=this.top;if(a&&a.isLeaf)this.findInside(e);else if(s)this.addElement(e,r,s);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,r,!1));else{let c=e;typeof t.contentElement=="string"?c=e.querySelector(t.contentElement):typeof t.contentElement=="function"?c=t.contentElement(e):t.contentElement&&(c=t.contentElement),this.findAround(e,c,!0),this.addAll(c,r),this.findAround(e,c,!1)}l&&this.sync(i)&&this.open--}addAll(e,t,r,s){let l=r||0;for(let a=r?e.childNodes[r]:e.firstChild,i=s==null?null:e.childNodes[s];a!=i;a=a.nextSibling,++l)this.findAtPoint(e,l),this.addDOM(a,t);this.findAtPoint(e,l)}findPlace(e,t,r){let s,l;for(let a=this.open,i=0;a>=0;a--){let c=this.nodes[a],d=c.findWrapping(e);if(d&&(!s||s.length>d.length+i)&&(s=d,l=c,!d.length))break;if(c.solid){if(r)break;i+=2}}if(!s)return null;this.sync(l);for(let a=0;a<s.length;a++)t=this.enterInner(s[a],null,t,!1);return t}insertNode(e,t,r){if(e.isInline&&this.needsBlock&&!this.top.type){let l=this.textblockFromContext();l&&(t=this.enterInner(l,null,t))}let s=this.findPlace(e,t,r);if(s){this.closeExtra();let l=this.top;l.match&&(l.match=l.match.matchType(e.type));let a=et.none;for(let i of s.concat(e.marks))(l.type?l.type.allowsMarkType(i.type):xu(i.type,e.type))&&(a=i.addToSet(a));return l.content.push(e.mark(a)),!0}return!1}enter(e,t,r,s){let l=this.findPlace(e.create(t),r,!1);return l&&(l=this.enterInner(e,t,r,!0,s)),l}enterInner(e,t,r,s=!1,l){this.closeExtra();let a=this.top;a.match=a.match&&a.match.matchType(e);let i=bu(e,l,a.options);a.options&Bo&&a.content.length==0&&(i|=Bo);let c=et.none;return r=r.filter(d=>(a.type?a.type.allowsMarkType(d.type):xu(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new Hs(e,t,c,s,null,i)),this.open++,r}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Mo)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let r=this.nodes[t].content;for(let s=r.length-1;s>=0;s--)e+=r[s].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==t&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,r){if(e!=t&&this.find)for(let s=0;s<this.find.length;s++)this.find[s].pos==null&&e.nodeType==1&&e.contains(this.find[s].node)&&t.compareDocumentPosition(this.find[s].node)&(r?2:4)&&(this.find[s].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),r=this.options.context,s=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),l=-(r?r.depth+1:0)+(s?0:1),a=(i,c)=>{for(;i>=0;i--){let d=t[i];if(d==""){if(i==t.length-1||i==0)continue;for(;c>=l;c--)if(a(i-1,c))return!0;return!1}else{let u=c>0||c==0&&s?this.nodes[c].type:r&&c>=l?r.node(c-l).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;c--}}return!0};return a(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let t in this.parser.schema.nodes){let r=this.parser.schema.nodes[t];if(r.isTextblock&&r.defaultAttrs)return r}}}function F1(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&yu.hasOwnProperty(r)&&t?(t.appendChild(e),e=t):r=="li"?t=e:r&&(t=null)}}function $1(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function wu(n){let e={};for(let t in n)e[t]=n[t];return e}function xu(n,e){let t=e.schema.nodes;for(let r in t){let s=t[r];if(!s.allowsMarkType(n))continue;let l=[],a=i=>{l.push(i);for(let c=0;c<i.edgeCount;c++){let{type:d,next:u}=i.edge(c);if(d==e||l.indexOf(u)<0&&a(u))return!0}};if(a(s.contentMatch))return!0}}class Ar{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},r){r||(r=Ja(t).createDocumentFragment());let s=r,l=[];return e.forEach(a=>{if(l.length||a.marks.length){let i=0,c=0;for(;i<l.length&&c<a.marks.length;){let d=a.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(l[i][0])||d.type.spec.spanning===!1)break;i++,c++}for(;i<l.length;)s=l.pop()[1];for(;c<a.marks.length;){let d=a.marks[c++],u=this.serializeMark(d,a.isInline,t);u&&(l.push([d,s]),s.appendChild(u.dom),s=u.contentDOM||u.dom)}}s.appendChild(this.serializeNodeInner(a,t))}),r}serializeNodeInner(e,t){let{dom:r,contentDOM:s}=Us(Ja(t),this.nodes[e.type.name](e),null,e.attrs);if(s){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,s)}return r}serializeNode(e,t={}){let r=this.serializeNodeInner(e,t);for(let s=e.marks.length-1;s>=0;s--){let l=this.serializeMark(e.marks[s],e.isInline,t);l&&((l.contentDOM||l.dom).appendChild(r),r=l.dom)}return r}serializeMark(e,t,r={}){let s=this.marks[e.type.name];return s&&Us(Ja(r),s(e,t),null,e.attrs)}static renderSpec(e,t,r=null,s){return Us(e,t,r,s)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Ar(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=vu(e.nodes);return t.text||(t.text=r=>r.text),t}static marksFromSchema(e){return vu(e.marks)}}function vu(n){let e={};for(let t in n){let r=n[t].spec.toDOM;r&&(e[t]=r)}return e}function Ja(n){return n.document||window.document}const Eu=new WeakMap;function R1(n){let e=Eu.get(n);return e===void 0&&Eu.set(n,e=P1(n)),e}function P1(n){let e=null;function t(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let s=0;s<r.length;s++)t(r[s]);else for(let s in r)t(r[s])}return t(n),e}function Us(n,e,t,r){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let s=e[0],l;if(typeof s!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(l=R1(r))&&l.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let a=s.indexOf(" ");a>0&&(t=s.slice(0,a),s=s.slice(a+1));let i,c=t?n.createElementNS(t,s):n.createElement(s),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let p in d)if(d[p]!=null){let h=p.indexOf(" ");h>0?c.setAttributeNS(p.slice(0,h),p.slice(h+1),d[p]):p=="style"&&c.style?c.style.cssText=d[p]:c.setAttribute(p,d[p])}}for(let p=u;p<e.length;p++){let h=e[p];if(h===0){if(p<e.length-1||p>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:f,contentDOM:m}=Us(n,h,t,r);if(c.appendChild(f),m){if(i)throw new RangeError("Multiple content holes");i=m}}}return{dom:c,contentDOM:i}}const Cu=65535,_u=Math.pow(2,16);function z1(n,e){return n+e*_u}function Su(n){return n&Cu}function j1(n){return(n-(n&Cu))/_u}const Nu=1,Vu=2,Ws=4,Mu=8;class Za{constructor(e,t,r){this.pos=e,this.delInfo=t,this.recover=r}get deleted(){return(this.delInfo&Mu)>0}get deletedBefore(){return(this.delInfo&(Nu|Ws))>0}get deletedAfter(){return(this.delInfo&(Vu|Ws))>0}get deletedAcross(){return(this.delInfo&Ws)>0}}class Qt{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Qt.empty)return Qt.empty}recover(e){let t=0,r=Su(e);if(!this.inverted)for(let s=0;s<r;s++)t+=this.ranges[s*3+2]-this.ranges[s*3+1];return this.ranges[r*3]+t+j1(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,r){let s=0,l=this.inverted?2:1,a=this.inverted?1:2;for(let i=0;i<this.ranges.length;i+=3){let c=this.ranges[i]-(this.inverted?s:0);if(c>e)break;let d=this.ranges[i+l],u=this.ranges[i+a],p=c+d;if(e<=p){let h=d?e==c?-1:e==p?1:t:t,f=c+s+(h<0?0:u);if(r)return f;let m=e==(t<0?c:p)?null:z1(i/3,e-c),g=e==c?Vu:e==p?Nu:Ws;return(t<0?e!=c:e!=p)&&(g|=Mu),new Za(f,g,m)}s+=u-d}return r?e+s:new Za(e+s,0,null)}touches(e,t){let r=0,s=Su(t),l=this.inverted?2:1,a=this.inverted?1:2;for(let i=0;i<this.ranges.length;i+=3){let c=this.ranges[i]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[i+l],u=c+d;if(e<=u&&i==s*3)return!0;r+=this.ranges[i+a]-d}return!1}forEach(e){let t=this.inverted?2:1,r=this.inverted?1:2;for(let s=0,l=0;s<this.ranges.length;s+=3){let a=this.ranges[s],i=a-(this.inverted?l:0),c=a+(this.inverted?0:l),d=this.ranges[s+t],u=this.ranges[s+r];e(i,i+d,c,c+u),l+=u-d}}invert(){return new Qt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Qt.empty:new Qt(e<0?[0,-e,0]:[0,0,e])}}Qt.empty=new Qt([]);class Ao{constructor(e,t,r=0,s=e?e.length:0){this.mirror=t,this.from=r,this.to=s,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Ao(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,r=this._maps.length;t<e._maps.length;t++){let s=e.getMirror(t);this.appendMap(e._maps[t],s!=null&&s<t?r+s:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,r=this._maps.length+e._maps.length;t>=0;t--){let s=e.getMirror(t);this.appendMap(e._maps[t].invert(),s!=null&&s>t?r-s-1:void 0)}}invert(){let e=new Ao;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,r){let s=0;for(let l=this.from;l<this.to;l++){let a=this._maps[l],i=a.mapResult(e,t);if(i.recover!=null){let c=this.getMirror(l);if(c!=null&&c>l&&c<this.to){l=c,e=this._maps[c].recover(i.recover);continue}}s|=i.delInfo,e=i.pos}return r?e:new Za(e,s,null)}}const Xa=Object.create(null);class It{getMap(){return Qt.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Xa[t.stepType];if(!r)throw new RangeError(`No step type ${t.stepType} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in Xa)throw new RangeError("Duplicate use of step JSON ID "+e);return Xa[e]=t,t.prototype.jsonID=e,t}}class yt{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new yt(e,null)}static fail(e){return new yt(null,e)}static fromReplace(e,t,r,s){try{return yt.ok(e.replace(t,r,s))}catch(l){if(l instanceof $s)return yt.fail(l.message);throw l}}}function Qa(n,e,t){let r=[];for(let s=0;s<n.childCount;s++){let l=n.child(s);l.content.size&&(l=l.copy(Qa(l.content,e,l))),l.isInline&&(l=e(l,t,s)),r.push(l)}return ne.fromArray(r)}class nr extends It{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=e.resolve(this.from),s=r.node(r.sharedDepth(this.to)),l=new de(Qa(t.content,(a,i)=>!a.isAtom||!i.type.allowsMarkType(this.mark.type)?a:a.mark(this.mark.addToSet(a.marks)),s),t.openStart,t.openEnd);return yt.fromReplace(e,this.from,this.to,l)}invert(){return new yn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new nr(t.pos,r.pos,this.mark)}merge(e){return e instanceof nr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new nr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new nr(t.from,t.to,e.markFromJSON(t.mark))}}It.jsonID("addMark",nr);class yn extends It{constructor(e,t,r){super(),this.from=e,this.to=t,this.mark=r}apply(e){let t=e.slice(this.from,this.to),r=new de(Qa(t.content,s=>s.mark(this.mark.removeFromSet(s.marks)),e),t.openStart,t.openEnd);return yt.fromReplace(e,this.from,this.to,r)}invert(){return new nr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new yn(t.pos,r.pos,this.mark)}merge(e){return e instanceof yn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new yn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new yn(t.from,t.to,e.markFromJSON(t.mark))}}It.jsonID("removeMark",yn);class rr extends It{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return yt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return yt.fromReplace(e,this.pos,this.pos+1,new de(ne.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(let s=0;s<t.marks.length;s++)if(!t.marks[s].isInSet(r))return new rr(this.pos,t.marks[s]);return new rr(this.pos,this.mark)}}return new Tr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new rr(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new rr(t.pos,e.markFromJSON(t.mark))}}It.jsonID("addNodeMark",rr);class Tr extends It{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return yt.fail("No node at mark step's position");let r=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return yt.fromReplace(e,this.pos,this.pos+1,new de(ne.from(r),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new rr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Tr(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Tr(t.pos,e.markFromJSON(t.mark))}}It.jsonID("removeNodeMark",Tr);class vt extends It{constructor(e,t,r,s=!1){super(),this.from=e,this.to=t,this.slice=r,this.structure=s}apply(e){return this.structure&&ei(e,this.from,this.to)?yt.fail("Structure replace would overwrite content"):yt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Qt([this.from,this.to-this.from,this.slice.size])}invert(e){return new vt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new vt(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof vt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?de.empty:new de(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new vt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?de.empty:new de(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new vt(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new vt(t.from,t.to,de.fromJSON(e,t.slice),!!t.structure)}}It.jsonID("replace",vt);class Et extends It{constructor(e,t,r,s,l,a,i=!1){super(),this.from=e,this.to=t,this.gapFrom=r,this.gapTo=s,this.slice=l,this.insert=a,this.structure=i}apply(e){if(this.structure&&(ei(e,this.from,this.gapFrom)||ei(e,this.gapTo,this.to)))return yt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return yt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,t.content);return r?yt.fromReplace(e,this.from,this.to,r):yt.fail("Content does not fit in gap")}getMap(){return new Qt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Et(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),s=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),l=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||s<t.pos||l>r.pos?null:new Et(t.pos,r.pos,s,l,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Et(t.from,t.to,t.gapFrom,t.gapTo,de.fromJSON(e,t.slice),t.insert,!!t.structure)}}It.jsonID("replaceAround",Et);function ei(n,e,t){let r=n.resolve(e),s=t-e,l=r.depth;for(;s>0&&l>0&&r.indexAfter(l)==r.node(l).childCount;)l--,s--;if(s>0){let a=r.node(l).maybeChild(r.indexAfter(l));for(;s>0;){if(!a||a.isLeaf)return!0;a=a.firstChild,s--}}return!1}function H1(n,e,t,r){let s=[],l=[],a,i;n.doc.nodesBetween(e,t,(c,d,u)=>{if(!c.isInline)return;let p=c.marks;if(!r.isInSet(p)&&u.type.allowsMarkType(r.type)){let h=Math.max(d,e),f=Math.min(d+c.nodeSize,t),m=r.addToSet(p);for(let g=0;g<p.length;g++)p[g].isInSet(m)||(a&&a.to==h&&a.mark.eq(p[g])?a.to=f:s.push(a=new yn(h,f,p[g])));i&&i.to==h?i.to=f:l.push(i=new nr(h,f,r))}}),s.forEach(c=>n.step(c)),l.forEach(c=>n.step(c))}function U1(n,e,t,r){let s=[],l=0;n.doc.nodesBetween(e,t,(a,i)=>{if(!a.isInline)return;l++;let c=null;if(r instanceof js){let d=a.marks,u;for(;u=r.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else r?r.isInSet(a.marks)&&(c=[r]):c=a.marks;if(c&&c.length){let d=Math.min(i+a.nodeSize,t);for(let u=0;u<c.length;u++){let p=c[u],h;for(let f=0;f<s.length;f++){let m=s[f];m.step==l-1&&p.eq(s[f].style)&&(h=m)}h?(h.to=d,h.step=l):s.push({style:p,from:Math.max(i,e),to:d,step:l})}}}),s.forEach(a=>n.step(new yn(a.from,a.to,a.style)))}function ti(n,e,t,r=t.contentMatch,s=!0){let l=n.doc.nodeAt(e),a=[],i=e+1;for(let c=0;c<l.childCount;c++){let d=l.child(c),u=i+d.nodeSize,p=r.matchType(d.type);if(!p)a.push(new vt(i,u,de.empty));else{r=p;for(let h=0;h<d.marks.length;h++)t.allowsMarkType(d.marks[h].type)||n.step(new yn(i,u,d.marks[h]));if(s&&d.isText&&t.whitespace!="pre"){let h,f=/\r?\n|\r/g,m;for(;h=f.exec(d.text);)m||(m=new de(ne.from(t.schema.text(" ",t.allowedMarks(d.marks))),0,0)),a.push(new vt(i+h.index,i+h.index+h[0].length,m))}}i=u}if(!r.validEnd){let c=r.fillBefore(ne.empty,!0);n.replace(i,i,new de(c,0,0))}for(let c=a.length-1;c>=0;c--)n.step(a[c])}function W1(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function to(n){let e=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let t=n.depth;;--t){let r=n.$from.node(t),s=n.$from.index(t),l=n.$to.indexAfter(t);if(t<n.depth&&r.canReplace(s,l,e))return t;if(t==0||r.type.spec.isolating||!W1(r,s,l))break}return null}function K1(n,e,t){let{$from:r,$to:s,depth:l}=e,a=r.before(l+1),i=s.after(l+1),c=a,d=i,u=ne.empty,p=0;for(let m=l,g=!1;m>t;m--)g||r.index(m)>0?(g=!0,u=ne.from(r.node(m).copy(u)),p++):c--;let h=ne.empty,f=0;for(let m=l,g=!1;m>t;m--)g||s.after(m+1)<s.end(m)?(g=!0,h=ne.from(s.node(m).copy(h)),f++):d++;n.step(new Et(c,d,a,i,new de(u.append(h),p,f),u.size-p,!0))}function ni(n,e,t=null,r=n){let s=q1(n,e),l=s&&G1(r,e);return l?s.map(Bu).concat({type:e,attrs:t}).concat(l.map(Bu)):null}function Bu(n){return{type:n,attrs:null}}function q1(n,e){let{parent:t,startIndex:r,endIndex:s}=n,l=t.contentMatchAt(r).findWrapping(e);if(!l)return null;let a=l.length?l[0]:e;return t.canReplaceWith(r,s,a)?l:null}function G1(n,e){let{parent:t,startIndex:r,endIndex:s}=n,l=t.child(r),a=e.contentMatch.findWrapping(l.type);if(!a)return null;let i=(a.length?a[a.length-1]:e).contentMatch;for(let c=r;i&&c<s;c++)i=i.matchType(t.child(c).type);return!i||!i.validEnd?null:a}function Y1(n,e,t){let r=ne.empty;for(let a=t.length-1;a>=0;a--){if(r.size){let i=t[a].type.contentMatch.matchFragment(r);if(!i||!i.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=ne.from(t[a].type.create(t[a].attrs,r))}let s=e.start,l=e.end;n.step(new Et(s,l,s,l,new de(r,0,0),t.length,!0))}function J1(n,e,t,r,s){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let l=n.steps.length;n.doc.nodesBetween(e,t,(a,i)=>{let c=typeof s=="function"?s(a):s;if(a.isTextblock&&!a.hasMarkup(r,c)&&Z1(n.doc,n.mapping.slice(l).map(i),r)){let d=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!m?d=!1:!f&&m&&(d=!0)}d===!1&&Tu(n,a,i,l),ti(n,n.mapping.slice(l).map(i,1),r,void 0,d===null);let u=n.mapping.slice(l),p=u.map(i,1),h=u.map(i+a.nodeSize,1);return n.step(new Et(p,h,p+1,h-1,new de(ne.from(r.create(c,null,a.marks)),0,0),1,!0)),d===!0&&Au(n,a,i,l),!1}})}function Au(n,e,t,r){e.forEach((s,l)=>{if(s.isText){let a,i=/\r?\n|\r/g;for(;a=i.exec(s.text);){let c=n.mapping.slice(r).map(t+1+l+a.index);n.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function Tu(n,e,t,r){e.forEach((s,l)=>{if(s.type==s.type.schema.linebreakReplacement){let a=n.mapping.slice(r).map(t+1+l);n.replaceWith(a,a+1,e.type.schema.text(`
|
|
5
|
+
`))}})}function Z1(n,e,t){let r=n.resolve(e),s=r.index();return r.parent.canReplaceWith(s,s+1,t)}function X1(n,e,t,r,s){let l=n.doc.nodeAt(e);if(!l)throw new RangeError("No node at given position");t||(t=l.type);let a=t.create(r,null,s||l.marks);if(l.isLeaf)return n.replaceWith(e,e+l.nodeSize,a);if(!t.validContent(l.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Et(e,e+l.nodeSize,e+1,e+l.nodeSize-1,new de(ne.from(a),0,0),1,!0))}function jn(n,e,t=1,r){let s=n.resolve(e),l=s.depth-t,a=r&&r[r.length-1]||s.parent;if(l<0||s.parent.type.spec.isolating||!s.parent.canReplace(s.index(),s.parent.childCount)||!a.type.validContent(s.parent.content.cutByIndex(s.index(),s.parent.childCount)))return!1;for(let d=s.depth-1,u=t-2;d>l;d--,u--){let p=s.node(d),h=s.index(d);if(p.type.spec.isolating)return!1;let f=p.content.cutByIndex(h,p.childCount),m=r&&r[u+1];m&&(f=f.replaceChild(0,m.type.create(m.attrs)));let g=r&&r[u]||p;if(!p.canReplace(h+1,p.childCount)||!g.type.validContent(f))return!1}let i=s.indexAfter(l),c=r&&r[0];return s.node(l).canReplaceWith(i,i,c?c.type:s.node(l+1).type)}function Q1(n,e,t=1,r){let s=n.doc.resolve(e),l=ne.empty,a=ne.empty;for(let i=s.depth,c=s.depth-t,d=t-1;i>c;i--,d--){l=ne.from(s.node(i).copy(l));let u=r&&r[d];a=ne.from(u?u.type.create(u.attrs,a):s.node(i).copy(a))}n.step(new vt(e,e,new de(l.append(a),t,t),!0))}function or(n,e){let t=n.resolve(e),r=t.index();return Lu(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(r,r+1)}function ew(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let s=0;s<e.childCount;s++){let l=e.child(s),a=l.type==r?n.type.schema.nodes.text:l.type;if(t=t.matchType(a),!t||!n.type.allowsMarks(l.marks))return!1}return t.validEnd}function Lu(n,e){return!!(n&&e&&!n.isLeaf&&ew(n,e))}function Ks(n,e,t=-1){let r=n.resolve(e);for(let s=r.depth;;s--){let l,a,i=r.index(s);if(s==r.depth?(l=r.nodeBefore,a=r.nodeAfter):t>0?(l=r.node(s+1),i++,a=r.node(s).maybeChild(i)):(l=r.node(s).maybeChild(i-1),a=r.node(s+1)),l&&!l.isTextblock&&Lu(l,a)&&r.node(s).canReplace(i,i+1))return e;if(s==0)break;e=t<0?r.before(s):r.after(s)}}function tw(n,e,t){let r=null,{linebreakReplacement:s}=n.doc.type.schema,l=n.doc.resolve(e-t),a=l.node().type;if(s&&a.inlineContent){let u=a.whitespace=="pre",p=!!a.contentMatch.matchType(s);u&&!p?r=!1:!u&&p&&(r=!0)}let i=n.steps.length;if(r===!1){let u=n.doc.resolve(e+t);Tu(n,u.node(),u.before(),i)}a.inlineContent&&ti(n,e+t-1,a,l.node().contentMatchAt(l.index()),r==null);let c=n.mapping.slice(i),d=c.map(e-t);if(n.step(new vt(d,c.map(e+t,-1),de.empty,!0)),r===!0){let u=n.doc.resolve(d);Au(n,u.node(),u.before(),n.steps.length)}return n}function nw(n,e,t){let r=n.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),t))return e;if(r.parentOffset==0)for(let s=r.depth-1;s>=0;s--){let l=r.index(s);if(r.node(s).canReplaceWith(l,l,t))return r.before(s+1);if(l>0)return null}if(r.parentOffset==r.parent.content.size)for(let s=r.depth-1;s>=0;s--){let l=r.indexAfter(s);if(r.node(s).canReplaceWith(l,l,t))return r.after(s+1);if(l<r.node(s).childCount)return null}return null}function Du(n,e,t){let r=n.resolve(e);if(!t.content.size)return e;let s=t.content;for(let l=0;l<t.openStart;l++)s=s.firstChild.content;for(let l=1;l<=(t.openStart==0&&t.size?2:1);l++)for(let a=r.depth;a>=0;a--){let i=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,c=r.index(a)+(i>0?1:0),d=r.node(a),u=!1;if(l==1)u=d.canReplace(c,c,s);else{let p=d.contentMatchAt(c).findWrapping(s.firstChild.type);u=p&&d.canReplaceWith(c,c,p[0])}if(u)return i==0?r.pos:i<0?r.before(a+1):r.after(a+1)}return null}function qs(n,e,t=e,r=de.empty){if(e==t&&!r.size)return null;let s=n.resolve(e),l=n.resolve(t);return Ou(s,l,r)?new vt(e,t,r):new rw(s,l,r).fit()}function Ou(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class rw{constructor(e,t,r){this.$from=e,this.$to=t,this.unplaced=r,this.frontier=[],this.placed=ne.empty;for(let s=0;s<=e.depth;s++){let l=e.node(s);this.frontier.push({type:l.type,match:l.contentMatchAt(e.indexAfter(s))})}for(let s=e.depth;s>0;s--)this.placed=ne.from(e.node(s).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let d=this.findFittable();d?this.placeNodes(d):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,r=this.$from,s=this.close(e<0?this.$to:r.doc.resolve(e));if(!s)return null;let l=this.placed,a=r.depth,i=s.depth;for(;a&&i&&l.childCount==1;)l=l.firstChild.content,a--,i--;let c=new de(l,a,i);return e>-1?new Et(r.pos,e,this.$to.pos,this.$to.end(),c,t):c.size||r.pos!=this.$to.pos?new vt(r.pos,s.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,r=0,s=this.unplaced.openEnd;r<e;r++){let l=t.firstChild;if(t.childCount>1&&(s=0),l.type.spec.isolating&&s<=r){e=r;break}t=l.content}for(let t=1;t<=2;t++)for(let r=t==1?e:this.unplaced.openStart;r>=0;r--){let s,l=null;r?(l=ri(this.unplaced.content,r-1).firstChild,s=l.content):s=this.unplaced.content;let a=s.firstChild;for(let i=this.depth;i>=0;i--){let{type:c,match:d}=this.frontier[i],u,p=null;if(t==1&&(a?d.matchType(a.type)||(p=d.fillBefore(ne.from(a),!1)):l&&c.compatibleContent(l.type)))return{sliceDepth:r,frontierDepth:i,parent:l,inject:p};if(t==2&&a&&(u=d.findWrapping(a.type)))return{sliceDepth:r,frontierDepth:i,parent:l,wrap:u};if(l&&d.matchType(l.type))break}}}openMore(){let{content:e,openStart:t,openEnd:r}=this.unplaced,s=ri(e,t);return!s.childCount||s.firstChild.isLeaf?!1:(this.unplaced=new de(e,t+1,Math.max(r,s.size+t>=e.size-r?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:r}=this.unplaced,s=ri(e,t);if(s.childCount<=1&&t>0){let l=e.size-t<=t+s.size;this.unplaced=new de(To(e,t-1,1),t-1,l?t-1:r)}else this.unplaced=new de(To(e,t,1),t,r)}placeNodes({sliceDepth:e,frontierDepth:t,parent:r,inject:s,wrap:l}){for(;this.depth>t;)this.closeFrontierNode();if(l)for(let g=0;g<l.length;g++)this.openFrontierNode(l[g]);let a=this.unplaced,i=r?r.content:a.content,c=a.openStart-e,d=0,u=[],{match:p,type:h}=this.frontier[t];if(s){for(let g=0;g<s.childCount;g++)u.push(s.child(g));p=p.matchFragment(s)}let f=i.size+e-(a.content.size-a.openEnd);for(;d<i.childCount;){let g=i.child(d),y=p.matchType(g.type);if(!y)break;d++,(d>1||c==0||g.content.size)&&(p=y,u.push(Iu(g.mark(h.allowedMarks(g.marks)),d==1?c:0,d==i.childCount?f:-1)))}let m=d==i.childCount;m||(f=-1),this.placed=Lo(this.placed,t,ne.from(u)),this.frontier[t].match=p,m&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=i;g<f;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?de.empty:new de(To(a.content,e-1,1),e-1,f<0?a.openEnd:e-1):new de(To(a.content,e,d),a.openStart,a.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!oi(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:r}=this.$to,s=this.$to.after(r);for(;r>1&&s==this.$to.end(--r);)++s;return s}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:r,type:s}=this.frontier[t],l=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),a=oi(e,t,s,r,l);if(a){for(let i=t-1;i>=0;i--){let{match:c,type:d}=this.frontier[i],u=oi(e,i,d,c,!0);if(!u||u.childCount)continue e}return{depth:t,fit:a,move:l?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Lo(this.placed,t.depth,t.fit)),e=t.move;for(let r=t.depth+1;r<=e.depth;r++){let s=e.node(r),l=s.type.contentMatch.fillBefore(s.content,!0,e.index(r));this.openFrontierNode(s.type,s.attrs,l)}return e}openFrontierNode(e,t=null,r){let s=this.frontier[this.depth];s.match=s.match.matchType(e),this.placed=Lo(this.placed,this.depth,ne.from(e.create(t,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(ne.empty,!0);e.childCount&&(this.placed=Lo(this.placed,this.frontier.length,e))}}function To(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(To(n.firstChild.content,e-1,t)))}function Lo(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Lo(n.lastChild.content,e-1,t)))}function ri(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Iu(n,e,t){if(e<=0)return n;let r=n.content;return e>1&&(r=r.replaceChild(0,Iu(r.firstChild,e-1,r.childCount==1?t-1:0))),e>0&&(r=n.type.contentMatch.fillBefore(r).append(r),t<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(ne.empty,!0)))),n.copy(r)}function oi(n,e,t,r,s){let l=n.node(e),a=s?n.indexAfter(e):n.index(e);if(a==l.childCount&&!t.compatibleContent(l.type))return null;let i=r.fillBefore(l.content,!0,a);return i&&!ow(t,l.content,a)?i:null}function ow(n,e,t){for(let r=t;r<e.childCount;r++)if(!n.allowsMarks(e.child(r).marks))return!0;return!1}function sw(n){return n.spec.defining||n.spec.definingForContent}function lw(n,e,t,r){if(!r.size)return n.deleteRange(e,t);let s=n.doc.resolve(e),l=n.doc.resolve(t);if(Ou(s,l,r))return n.step(new vt(e,t,r));let a=$u(s,n.doc.resolve(t));a[a.length-1]==0&&a.pop();let i=-(s.depth+1);a.unshift(i);for(let h=s.depth,f=s.pos-1;h>0;h--,f--){let m=s.node(h).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;a.indexOf(h)>-1?i=h:s.before(h)==f&&a.splice(1,0,-h)}let c=a.indexOf(i),d=[],u=r.openStart;for(let h=r.content,f=0;;f++){let m=h.firstChild;if(d.push(m),f==r.openStart)break;h=m.content}for(let h=u-1;h>=0;h--){let f=d[h],m=sw(f.type);if(m&&!f.sameMarkup(s.node(Math.abs(i)-1)))u=h;else if(m||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+u+1)%(r.openStart+1),m=d[f];if(m)for(let g=0;g<a.length;g++){let y=a[(g+c)%a.length],b=!0;y<0&&(b=!1,y=-y);let k=s.node(y-1),x=s.index(y-1);if(k.canReplaceWith(x,x,m.type,m.marks))return n.replace(s.before(y),b?l.after(y):t,new de(Fu(r.content,0,r.openStart,f),f,r.openEnd))}}let p=n.steps.length;for(let h=a.length-1;h>=0&&(n.replace(e,t,r),!(n.steps.length>p));h--){let f=a[h];f<0||(e=s.before(f),t=l.after(f))}}function Fu(n,e,t,r,s){if(e<t){let l=n.firstChild;n=n.replaceChild(0,l.copy(Fu(l.content,e+1,t,r,l)))}if(e>r){let l=s.contentMatchAt(0),a=l.fillBefore(n).append(n);n=a.append(l.matchFragment(a).fillBefore(ne.empty,!0))}return n}function aw(n,e,t,r){if(!r.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let s=nw(n.doc,e,r.type);s!=null&&(e=t=s)}n.replaceRange(e,t,new de(ne.from(r),0,0))}function iw(n,e,t){let r=n.doc.resolve(e),s=n.doc.resolve(t),l=$u(r,s);for(let a=0;a<l.length;a++){let i=l[a],c=a==l.length-1;if(c&&i==0||r.node(i).type.contentMatch.validEnd)return n.delete(r.start(i),s.end(i));if(i>0&&(c||r.node(i-1).canReplace(r.index(i-1),s.indexAfter(i-1))))return n.delete(r.before(i),s.after(i))}for(let a=1;a<=r.depth&&a<=s.depth;a++)if(e-r.start(a)==r.depth-a&&t>r.end(a)&&s.end(a)-t!=s.depth-a&&r.start(a-1)==s.start(a-1)&&r.node(a-1).canReplace(r.index(a-1),s.index(a-1)))return n.delete(r.before(a),t);n.delete(e,t)}function $u(n,e){let t=[],r=Math.min(n.depth,e.depth);for(let s=r;s>=0;s--){let l=n.start(s);if(l<n.pos-(n.depth-s)||e.end(s)>e.pos+(e.depth-s)||n.node(s).type.spec.isolating||e.node(s).type.spec.isolating)break;(l==e.start(s)||s==n.depth&&s==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&s&&e.start(s-1)==l-1)&&t.push(s)}return t}class no extends It{constructor(e,t,r){super(),this.pos=e,this.attr=t,this.value=r}apply(e){let t=e.nodeAt(this.pos);if(!t)return yt.fail("No node at attribute step's position");let r=Object.create(null);for(let l in t.attrs)r[l]=t.attrs[l];r[this.attr]=this.value;let s=t.type.create(r,null,t.marks);return yt.fromReplace(e,this.pos,this.pos+1,new de(ne.from(s),0,t.isLeaf?0:1))}getMap(){return Qt.empty}invert(e){return new no(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new no(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new no(t.pos,t.attr,t.value)}}It.jsonID("attr",no);class Do extends It{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let s in e.attrs)t[s]=e.attrs[s];t[this.attr]=this.value;let r=e.type.create(t,e.content,e.marks);return yt.ok(r)}getMap(){return Qt.empty}invert(e){return new Do(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Do(t.attr,t.value)}}It.jsonID("docAttr",Do);let ro=class extends Error{};ro=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t},ro.prototype=Object.create(Error.prototype),ro.prototype.constructor=ro,ro.prototype.name="TransformError";class si{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Ao}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new ro(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,r=de.empty){let s=qs(this.doc,e,t,r);return s&&this.step(s),this}replaceWith(e,t,r){return this.replace(e,t,new de(ne.from(r),0,0))}delete(e,t){return this.replace(e,t,de.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,r){return lw(this,e,t,r),this}replaceRangeWith(e,t,r){return aw(this,e,t,r),this}deleteRange(e,t){return iw(this,e,t),this}lift(e,t){return K1(this,e,t),this}join(e,t=1){return tw(this,e,t),this}wrap(e,t){return Y1(this,e,t),this}setBlockType(e,t=e,r,s=null){return J1(this,e,t,r,s),this}setNodeMarkup(e,t,r=null,s){return X1(this,e,t,r,s),this}setNodeAttribute(e,t,r){return this.step(new no(e,t,r)),this}setDocAttribute(e,t){return this.step(new Do(e,t)),this}addNodeMark(e,t){return this.step(new rr(e,t)),this}removeNodeMark(e,t){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(t instanceof et)t.isInSet(r.marks)&&this.step(new Tr(e,t));else{let s=r.marks,l,a=[];for(;l=t.isInSet(s);)a.push(new Tr(e,l)),s=l.removeFromSet(s);for(let i=a.length-1;i>=0;i--)this.step(a[i])}return this}split(e,t=1,r){return Q1(this,e,t,r),this}addMark(e,t,r){return H1(this,e,t,r),this}removeMark(e,t,r){return U1(this,e,t,r),this}clearIncompatible(e,t,r){return ti(this,e,t,r),this}}const li=Object.create(null);class _e{constructor(e,t,r){this.$anchor=e,this.$head=t,this.ranges=r||[new Ru(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=de.empty){let r=t.content.lastChild,s=null;for(let i=0;i<t.openEnd;i++)s=r,r=r.lastChild;let l=e.steps.length,a=this.ranges;for(let i=0;i<a.length;i++){let{$from:c,$to:d}=a[i],u=e.mapping.slice(l);e.replaceRange(u.map(c.pos),u.map(d.pos),i?de.empty:t),i==0&&ju(e,l,(r?r.isInline:s&&s.isTextblock)?-1:1)}}replaceWith(e,t){let r=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:i}=s[l],c=e.mapping.slice(r),d=c.map(a.pos),u=c.map(i.pos);l?e.deleteRange(d,u):(e.replaceRangeWith(d,u,t),ju(e,r,t.isInline?-1:1))}}static findFrom(e,t,r=!1){let s=e.parent.inlineContent?new xe(e):oo(e.node(0),e.parent,e.pos,e.index(),t,r);if(s)return s;for(let l=e.depth-1;l>=0;l--){let a=t<0?oo(e.node(0),e.node(l),e.before(l+1),e.index(l),t,r):oo(e.node(0),e.node(l),e.after(l+1),e.index(l)+1,t,r);if(a)return a}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new en(e.node(0))}static atStart(e){return oo(e,e,0,0,1)||new en(e)}static atEnd(e){return oo(e,e,e.content.size,e.childCount,-1)||new en(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=li[t.type];if(!r)throw new RangeError(`No selection type ${t.type} defined`);return r.fromJSON(e,t)}static jsonID(e,t){if(e in li)throw new RangeError("Duplicate use of selection JSON ID "+e);return li[e]=t,t.prototype.jsonID=e,t}getBookmark(){return xe.between(this.$anchor,this.$head).getBookmark()}}_e.prototype.visible=!0;class Ru{constructor(e,t){this.$from=e,this.$to=t}}let Pu=!1;function zu(n){!Pu&&!n.parent.inlineContent&&(Pu=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class xe extends _e{constructor(e,t=e){zu(e),zu(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return _e.near(r);let s=e.resolve(t.map(this.anchor));return new xe(s.parent.inlineContent?s:r,r)}replace(e,t=de.empty){if(super.replace(e,t),t==de.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof xe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Gs(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new xe(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){let s=e.resolve(t);return new this(s,r==t?s:e.resolve(r))}static between(e,t,r){let s=e.pos-t.pos;if((!r||s)&&(r=s>=0?1:-1),!t.parent.inlineContent){let l=_e.findFrom(t,r,!0)||_e.findFrom(t,-r,!0);if(l)t=l.$head;else return _e.near(t,r)}return e.parent.inlineContent||(s==0?e=t:(e=(_e.findFrom(e,-r,!0)||_e.findFrom(e,r,!0)).$anchor,e.pos<t.pos!=s<0&&(e=t))),new xe(e,t)}}_e.jsonID("text",xe);class Gs{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Gs(e.map(this.anchor),e.map(this.head))}resolve(e){return xe.between(e.resolve(this.anchor),e.resolve(this.head))}}class we extends _e{constructor(e){let t=e.nodeAfter,r=e.node(0).resolve(e.pos+t.nodeSize);super(e,r),this.node=t}map(e,t){let{deleted:r,pos:s}=t.mapResult(this.anchor),l=e.resolve(s);return r?_e.near(l):new we(l)}content(){return new de(ne.from(this.node),0,0)}eq(e){return e instanceof we&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ai(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new we(e.resolve(t.anchor))}static create(e,t){return new we(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}we.prototype.visible=!1,_e.jsonID("node",we);class ai{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:r}=e.mapResult(this.anchor);return t?new Gs(r,r):new ai(r)}resolve(e){let t=e.resolve(this.anchor),r=t.nodeAfter;return r&&we.isSelectable(r)?new we(t):_e.near(t)}}class en extends _e{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=de.empty){if(t==de.empty){e.delete(0,e.doc.content.size);let r=_e.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new en(e)}map(e){return new en(e)}eq(e){return e instanceof en}getBookmark(){return cw}}_e.jsonID("all",en);const cw={map(){return this},resolve(n){return new en(n)}};function oo(n,e,t,r,s,l=!1){if(e.inlineContent)return xe.create(n,t);for(let a=r-(s>0?0:1);s>0?a<e.childCount:a>=0;a+=s){let i=e.child(a);if(i.isAtom){if(!l&&we.isSelectable(i))return we.create(n,t-(s<0?i.nodeSize:0))}else{let c=oo(n,i,t+s,s<0?i.childCount:0,s,l);if(c)return c}t+=i.nodeSize*s}return null}function ju(n,e,t){let r=n.steps.length-1;if(r<e)return;let s=n.steps[r];if(!(s instanceof vt||s instanceof Et))return;let l=n.mapping.maps[r],a;l.forEach((i,c,d,u)=>{a==null&&(a=u)}),n.setSelection(_e.near(n.doc.resolve(a),t))}const Hu=1,Ys=2,Uu=4;class dw extends si{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Hu)&~Ys,this.storedMarks=null,this}get selectionSet(){return(this.updated&Hu)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ys,this}ensureMarks(e){return et.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ys)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Ys,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let r=this.selection;return t&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||et.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,r){let s=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(s.text(e),!0):this.deleteSelection();{if(r==null&&(r=t),r=r??t,!e)return this.deleteRange(t,r);let l=this.storedMarks;if(!l){let a=this.doc.resolve(t);l=r==t?a.marks():a.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(t,r,s.text(e,l)),this.selection.empty||this.setSelection(_e.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Uu,this}get scrolledIntoView(){return(this.updated&Uu)>0}}function Wu(n,e){return!e||!n?n:n.bind(e)}class Oo{constructor(e,t,r){this.name=e,this.init=Wu(t.init,r),this.apply=Wu(t.apply,r)}}const uw=[new Oo("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Oo("selection",{init(n,e){return n.selection||_e.atStart(e.doc)},apply(n){return n.selection}}),new Oo("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,r){return r.selection.$cursor?n.storedMarks:null}}),new Oo("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class ii{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=uw.slice(),t&&t.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Oo(r.key,r.spec.state,r))})}}class so{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=t){let s=this.config.plugins[r];if(s.spec.filterTransaction&&!s.spec.filterTransaction.call(s,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],r=this.applyInner(e),s=null;for(;;){let l=!1;for(let a=0;a<this.config.plugins.length;a++){let i=this.config.plugins[a];if(i.spec.appendTransaction){let c=s?s[a].n:0,d=s?s[a].state:this,u=c<t.length&&i.spec.appendTransaction.call(i,c?t.slice(c):t,d,r);if(u&&r.filterTransaction(u,a)){if(u.setMeta("appendedTransaction",e),!s){s=[];for(let p=0;p<this.config.plugins.length;p++)s.push(p<a?{state:r,n:t.length}:{state:this,n:0})}t.push(u),r=r.applyInner(u),l=!0}s&&(s[a]={state:r,n:t.length})}}if(!l)return{state:r,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new so(this.config),r=this.config.fields;for(let s=0;s<r.length;s++){let l=r[s];t[l.name]=l.apply(e,this[l.name],this,t)}return t}get tr(){return new dw(this)}static create(e){let t=new ii(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new so(t);for(let s=0;s<t.fields.length;s++)r[t.fields[s].name]=t.fields[s].init(e,r);return r}reconfigure(e){let t=new ii(this.schema,e.plugins),r=t.fields,s=new so(t);for(let l=0;l<r.length;l++){let a=r[l].name;s[a]=this.hasOwnProperty(a)?this[a]:r[l].init(e,s)}return s}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let s=e[r],l=s.spec.state;l&&l.toJSON&&(t[r]=l.toJSON.call(s,this[s.key]))}return t}static fromJSON(e,t,r){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let s=new ii(e.schema,e.plugins),l=new so(s);return s.fields.forEach(a=>{if(a.name=="doc")l.doc=tr.fromJSON(e.schema,t.doc);else if(a.name=="selection")l.selection=_e.fromJSON(l.doc,t.selection);else if(a.name=="storedMarks")t.storedMarks&&(l.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let i in r){let c=r[i],d=c.spec.state;if(c.key==a.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(t,i)){l[a.name]=d.fromJSON.call(c,e,t[i],l);return}}l[a.name]=a.init(e,l)}}),l}}function Ku(n,e,t){for(let r in n){let s=n[r];s instanceof Function?s=s.bind(e):r=="handleDOMEvents"&&(s=Ku(s,e,{})),t[r]=s}return t}class ct{constructor(e){this.spec=e,this.props={},e.props&&Ku(e.props,this,this.props),this.key=e.key?e.key.key:qu("plugin")}getState(e){return e[this.key]}}const ci=Object.create(null);function qu(n){return n in ci?n+"$"+ ++ci[n]:(ci[n]=0,n+"$")}let mt=class{constructor(e="key"){this.key=qu(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};const Vt=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},lo=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let di=null;const Hn=function(n,e,t){let r=di||(di=document.createRange());return r.setEnd(n,t??n.nodeValue.length),r.setStart(n,e||0),r},pw=function(){di=null},Lr=function(n,e,t,r){return t&&(Gu(n,e,t,r,-1)||Gu(n,e,t,r,1))},hw=/^(img|br|input|textarea|hr)$/i;function Gu(n,e,t,r,s){for(var l;;){if(n==t&&e==r)return!0;if(e==(s<0?0:an(n))){let a=n.parentNode;if(!a||a.nodeType!=1||Io(n)||hw.test(n.nodeName)||n.contentEditable=="false")return!1;e=Vt(n)+(s<0?0:1),n=a}else if(n.nodeType==1){let a=n.childNodes[e+(s<0?-1:0)];if(a.nodeType==1&&a.contentEditable=="false")if(!((l=a.pmViewDesc)===null||l===void 0)&&l.ignoreForSelection)e+=s;else return!1;else n=a,e=s<0?an(n):0}else return!1}}function an(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function fw(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=an(n)}else if(n.parentNode&&!Io(n))e=Vt(n),n=n.parentNode;else return null}}function mw(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!Io(n))e=Vt(n)+1,n=n.parentNode;else return null}}function gw(n,e,t){for(let r=e==0,s=e==an(n);r||s;){if(n==t)return!0;let l=Vt(n);if(n=n.parentNode,!n)return!1;r=r&&l==0,s=s&&l==an(n)}}function Io(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const Js=function(n){return n.focusNode&&Lr(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Dr(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function yw(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function bw(n,e,t){if(n.caretPositionFromPoint)try{let r=n.caretPositionFromPoint(e,t);if(r)return{node:r.offsetNode,offset:Math.min(an(r.offsetNode),r.offset)}}catch{}if(n.caretRangeFromPoint){let r=n.caretRangeFromPoint(e,t);if(r)return{node:r.startContainer,offset:Math.min(an(r.startContainer),r.startOffset)}}}const _n=typeof navigator<"u"?navigator:null,Yu=typeof document<"u"?document:null,sr=_n&&_n.userAgent||"",ui=/Edge\/(\d+)/.exec(sr),Ju=/MSIE \d/.exec(sr),pi=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(sr),qt=!!(Ju||pi||ui),lr=Ju?document.documentMode:pi?+pi[1]:ui?+ui[1]:0,cn=!qt&&/gecko\/(\d+)/i.test(sr);cn&&+(/Firefox\/(\d+)/.exec(sr)||[0,0])[1];const hi=!qt&&/Chrome\/(\d+)/.exec(sr),Ft=!!hi,Zu=hi?+hi[1]:0,zt=!qt&&!!_n&&/Apple Computer/.test(_n.vendor),ao=zt&&(/Mobile\/\w+/.test(sr)||!!_n&&_n.maxTouchPoints>2),dn=ao||(_n?/Mac/.test(_n.platform):!1),kw=_n?/Win/.test(_n.platform):!1,Un=/Android \d/.test(sr),Fo=!!Yu&&"webkitFontSmoothing"in Yu.documentElement.style,ww=Fo?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function xw(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Wn(n,e){return typeof n=="number"?n:n[e]}function vw(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,r=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*r}}function Xu(n,e,t){let r=n.someProp("scrollThreshold")||0,s=n.someProp("scrollMargin")||5,l=n.dom.ownerDocument;for(let a=t||n.dom;a;){if(a.nodeType!=1){a=lo(a);continue}let i=a,c=i==l.body,d=c?xw(l):vw(i),u=0,p=0;if(e.top<d.top+Wn(r,"top")?p=-(d.top-e.top+Wn(s,"top")):e.bottom>d.bottom-Wn(r,"bottom")&&(p=e.bottom-e.top>d.bottom-d.top?e.top+Wn(s,"top")-d.top:e.bottom-d.bottom+Wn(s,"bottom")),e.left<d.left+Wn(r,"left")?u=-(d.left-e.left+Wn(s,"left")):e.right>d.right-Wn(r,"right")&&(u=e.right-d.right+Wn(s,"right")),u||p)if(c)l.defaultView.scrollBy(u,p);else{let f=i.scrollLeft,m=i.scrollTop;p&&(i.scrollTop+=p),u&&(i.scrollLeft+=u);let g=i.scrollLeft-f,y=i.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let h=c?"fixed":getComputedStyle(a).position;if(/^(fixed|sticky)$/.test(h))break;a=h=="absolute"?a.offsetParent:lo(a)}}function Ew(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),r,s;for(let l=(e.left+e.right)/2,a=t+1;a<Math.min(innerHeight,e.bottom);a+=5){let i=n.root.elementFromPoint(l,a);if(!i||i==n.dom||!n.dom.contains(i))continue;let c=i.getBoundingClientRect();if(c.top>=t-20){r=i,s=c.top;break}}return{refDOM:r,refTop:s,stack:Qu(n.dom)}}function Qu(n){let e=[],t=n.ownerDocument;for(let r=n;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=t);r=lo(r));return e}function Cw({refDOM:n,refTop:e,stack:t}){let r=n?n.getBoundingClientRect().top:0;ep(t,r==0?0:r-e)}function ep(n,e){for(let t=0;t<n.length;t++){let{dom:r,top:s,left:l}=n[t];r.scrollTop!=s+e&&(r.scrollTop=s+e),r.scrollLeft!=l&&(r.scrollLeft=l)}}let io=null;function _w(n){if(n.setActive)return n.setActive();if(io)return n.focus(io);let e=Qu(n);n.focus(io==null?{get preventScroll(){return io={preventScroll:!0},!0}}:void 0),io||(io=!1,ep(e,0))}function tp(n,e){let t,r=2e8,s,l=0,a=e.top,i=e.top,c,d;for(let u=n.firstChild,p=0;u;u=u.nextSibling,p++){let h;if(u.nodeType==1)h=u.getClientRects();else if(u.nodeType==3)h=Hn(u).getClientRects();else continue;for(let f=0;f<h.length;f++){let m=h[f];if(m.top<=a&&m.bottom>=i){a=Math.max(m.bottom,a),i=Math.min(m.top,i);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<r){t=u,r=g,s=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&g&&(l=p+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(l=p+1)}}return!t&&c&&(t=c,s=d,r=0),t&&t.nodeType==3?Sw(t,s):!t||r&&t.nodeType==1?{node:n,offset:l}:tp(t,s)}function Sw(n,e){let t=n.nodeValue.length,r=document.createRange();for(let s=0;s<t;s++){r.setEnd(n,s+1),r.setStart(n,s);let l=ar(r,1);if(l.top!=l.bottom&&fi(e,l))return{node:n,offset:s+(e.left>=(l.left+l.right)/2?1:0)}}return{node:n,offset:0}}function fi(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function Nw(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function Vw(n,e,t){let{node:r,offset:s}=tp(e,t),l=-1;if(r.nodeType==1&&!r.firstChild){let a=r.getBoundingClientRect();l=a.left!=a.right&&t.left>(a.left+a.right)/2?1:-1}return n.docView.posFromDOM(r,s,l)}function Mw(n,e,t,r){let s=-1;for(let l=e,a=!1;l!=n.dom;){let i=n.docView.nearestDesc(l,!0),c;if(!i)return null;if(i.dom.nodeType==1&&(i.node.isBlock&&i.parent||!i.contentDOM)&&((c=i.dom.getBoundingClientRect()).width||c.height)&&(i.node.isBlock&&i.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(i.dom.nodeName)&&(!a&&c.left>r.left||c.top>r.top?s=i.posBefore:(!a&&c.right<r.left||c.bottom<r.top)&&(s=i.posAfter),a=!0),!i.contentDOM&&s<0&&!i.node.isText))return(i.node.isBlock?r.top<(c.top+c.bottom)/2:r.left<(c.left+c.right)/2)?i.posBefore:i.posAfter;l=i.dom.parentNode}return s>-1?s:n.docView.posFromDOM(e,t,-1)}function np(n,e,t){let r=n.childNodes.length;if(r&&t.top<t.bottom)for(let s=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-t.top)/(t.bottom-t.top))-2)),l=s;;){let a=n.childNodes[l];if(a.nodeType==1){let i=a.getClientRects();for(let c=0;c<i.length;c++){let d=i[c];if(fi(e,d))return np(a,e,d)}}if((l=(l+1)%r)==s)break}return n}function Bw(n,e){let t=n.dom.ownerDocument,r,s=0,l=bw(t,e.left,e.top);l&&({node:r,offset:s}=l);let a=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),i;if(!a||!n.dom.contains(a.nodeType!=1?a.parentNode:a)){let d=n.dom.getBoundingClientRect();if(!fi(e,d)||(a=np(n.dom,e,d),!a))return null}if(zt)for(let d=a;r&&d;d=lo(d))d.draggable&&(r=void 0);if(a=Nw(a,e),r){if(cn&&r.nodeType==1&&(s=Math.min(s,r.childNodes.length),s<r.childNodes.length)){let u=r.childNodes[s],p;u.nodeName=="IMG"&&(p=u.getBoundingClientRect()).right<=e.left&&p.bottom>e.top&&s++}let d;Fo&&s&&r.nodeType==1&&(d=r.childNodes[s-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&s--,r==n.dom&&s==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?i=n.state.doc.content.size:(s==0||r.nodeType!=1||r.childNodes[s-1].nodeName!="BR")&&(i=Mw(n,r,s,e))}i==null&&(i=Vw(n,a,e));let c=n.docView.nearestDesc(a,!0);return{pos:i,inside:c?c.posAtStart-c.border:-1}}function rp(n){return n.top<n.bottom||n.left<n.right}function ar(n,e){let t=n.getClientRects();if(t.length){let r=t[e<0?0:t.length-1];if(rp(r))return r}return Array.prototype.find.call(t,rp)||n.getBoundingClientRect()}const Aw=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function op(n,e,t){let{node:r,offset:s,atom:l}=n.docView.domFromPos(e,t<0?-1:1),a=Fo||cn;if(r.nodeType==3)if(a&&(Aw.test(r.nodeValue)||(t<0?!s:s==r.nodeValue.length))){let i=ar(Hn(r,s,s),t);if(cn&&s&&/\s/.test(r.nodeValue[s-1])&&s<r.nodeValue.length){let c=ar(Hn(r,s-1,s-1),-1);if(c.top==i.top){let d=ar(Hn(r,s,s+1),-1);if(d.top!=i.top)return $o(d,d.left<c.left)}}return i}else{let i=s,c=s,d=t<0?1:-1;return t<0&&!s?(c++,d=-1):t>=0&&s==r.nodeValue.length?(i--,d=1):t<0?i--:c++,$o(ar(Hn(r,i,c),d),d<0)}if(!n.state.doc.resolve(e-(l||0)).parent.inlineContent){if(l==null&&s&&(t<0||s==an(r))){let i=r.childNodes[s-1];if(i.nodeType==1)return mi(i.getBoundingClientRect(),!1)}if(l==null&&s<an(r)){let i=r.childNodes[s];if(i.nodeType==1)return mi(i.getBoundingClientRect(),!0)}return mi(r.getBoundingClientRect(),t>=0)}if(l==null&&s&&(t<0||s==an(r))){let i=r.childNodes[s-1],c=i.nodeType==3?Hn(i,an(i)-(a?0:1)):i.nodeType==1&&(i.nodeName!="BR"||!i.nextSibling)?i:null;if(c)return $o(ar(c,1),!1)}if(l==null&&s<an(r)){let i=r.childNodes[s];for(;i.pmViewDesc&&i.pmViewDesc.ignoreForCoords;)i=i.nextSibling;let c=i?i.nodeType==3?Hn(i,0,a?0:1):i.nodeType==1?i:null:null;if(c)return $o(ar(c,-1),!0)}return $o(ar(r.nodeType==3?Hn(r):r,-t),t>=0)}function $o(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function mi(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function sp(n,e,t){let r=n.state,s=n.root.activeElement;r!=e&&n.updateState(e),s!=n.dom&&n.focus();try{return t()}finally{r!=e&&n.updateState(r),s!=n.dom&&s&&s.focus()}}function Tw(n,e,t){let r=e.selection,s=t=="up"?r.$from:r.$to;return sp(n,e,()=>{let{node:l}=n.docView.domFromPos(s.pos,t=="up"?-1:1);for(;;){let i=n.docView.nearestDesc(l,!0);if(!i)break;if(i.node.isBlock){l=i.contentDOM||i.dom;break}l=i.dom.parentNode}let a=op(n,s.pos,1);for(let i=l.firstChild;i;i=i.nextSibling){let c;if(i.nodeType==1)c=i.getClientRects();else if(i.nodeType==3)c=Hn(i,0,i.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(t=="up"?a.top-u.top>(u.bottom-a.top)*2:u.bottom-a.bottom>(a.bottom-u.top)*2))return!1}}return!0})}const Lw=/[\u0590-\u08ac]/;function Dw(n,e,t){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let s=r.parentOffset,l=!s,a=s==r.parent.content.size,i=n.domSelection();return i?!Lw.test(r.parent.textContent)||!i.modify?t=="left"||t=="backward"?l:a:sp(n,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:p}=n.domSelectionRange(),h=i.caretBidiLevel;i.modify("move",t,"character");let f=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),y=m&&!f.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==g;try{i.collapse(u,p),c&&(c!=u||d!=p)&&i.extend&&i.extend(c,d)}catch{}return h!=null&&(i.caretBidiLevel=h),y}):r.pos==r.start()||r.pos==r.end()}let lp=null,ap=null,ip=!1;function Ow(n,e,t){return lp==e&&ap==t?ip:(lp=e,ap=t,ip=t=="up"||t=="down"?Tw(n,e,t):Dw(n,e,t))}const un=0,cp=1,Or=2,Sn=3;class Ro{constructor(e,t,r,s){this.parent=e,this.children=t,this.dom=r,this.contentDOM=s,this.dirty=un,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,r=this.posAtStart;;t++){let s=this.children[t];if(s==e)return r;r+=s.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let l,a;if(e==this.contentDOM)l=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;l=e.previousSibling}for(;l&&!((a=l.pmViewDesc)&&a.parent==this);)l=l.previousSibling;return l?this.posBeforeChild(a)+a.size:this.posAtStart}else{let l,a;if(e==this.contentDOM)l=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;l=e.nextSibling}for(;l&&!((a=l.pmViewDesc)&&a.parent==this);)l=l.nextSibling;return l?this.posBeforeChild(a):this.posAtEnd}let s;if(e==this.dom&&this.contentDOM)s=t>Vt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))s=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let l=e;;l=l.parentNode){if(l==this.dom){s=!1;break}if(l.previousSibling)break}if(s==null&&t==e.childNodes.length)for(let l=e;;l=l.parentNode){if(l==this.dom){s=!0;break}if(l.nextSibling)break}}return s??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let r=!0,s=e;s;s=s.parentNode){let l=this.getDesc(s),a;if(l&&(!t||l.node))if(r&&(a=l.nodeDOM)&&!(a.nodeType==1?a.contains(e.nodeType==1?e:e.parentNode):a==e))r=!1;else return l}}getDesc(e){let t=e.pmViewDesc;for(let r=t;r;r=r.parent)if(r==this)return t}posFromDOM(e,t,r){for(let s=e;s;s=s.parentNode){let l=this.getDesc(s);if(l)return l.localPosFromDOM(e,t,r)}return-1}descAt(e){for(let t=0,r=0;t<this.children.length;t++){let s=this.children[t],l=r+s.size;if(r==e&&l!=r){for(;!s.border&&s.children.length;)for(let a=0;a<s.children.length;a++){let i=s.children[a];if(i.size){s=i;break}}return s}if(e<l)return s.descAt(e-r-s.border);r=l}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,s=0;for(let l=0;r<this.children.length;r++){let a=this.children[r],i=l+a.size;if(i>e||a instanceof pp){s=e-l;break}l=i}if(s)return this.children[r].domFromPos(s-this.children[r].border,t);for(let l;r&&!(l=this.children[r-1]).size&&l instanceof dp&&l.side>=0;r--);if(t<=0){let l,a=!0;for(;l=r?this.children[r-1]:null,!(!l||l.dom.parentNode==this.contentDOM);r--,a=!1);return l&&t&&a&&!l.border&&!l.domAtom?l.domFromPos(l.size,t):{node:this.contentDOM,offset:l?Vt(l.dom)+1:0}}else{let l,a=!0;for(;l=r<this.children.length?this.children[r]:null,!(!l||l.dom.parentNode==this.contentDOM);r++,a=!1);return l&&a&&!l.border&&!l.domAtom?l.domFromPos(0,t):{node:this.contentDOM,offset:l?Vt(l.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let s=-1,l=-1;for(let a=r,i=0;;i++){let c=this.children[i],d=a+c.size;if(s==-1&&e<=d){let u=a+c.border;if(e>=u&&t<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,t,u);e=a;for(let p=i;p>0;p--){let h=this.children[p-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){s=Vt(h.dom)+1;break}e-=h.size}s==-1&&(s=0)}if(s>-1&&(d>t||i==this.children.length-1)){t=d;for(let u=i+1;u<this.children.length;u++){let p=this.children[u];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(-1)){l=Vt(p.dom);break}t+=p.size}l==-1&&(l=this.contentDOM.childNodes.length);break}a=d}return{node:this.contentDOM,from:e,to:t,fromOffset:s,toOffset:l}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:r}=this.domFromPos(e,0);if(t.nodeType!=1||r==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[r]}setSelection(e,t,r,s=!1){let l=Math.min(e,t),a=Math.max(e,t);for(let f=0,m=0;f<this.children.length;f++){let g=this.children[f],y=m+g.size;if(l>m&&a<y)return g.setSelection(e-m-g.border,t-m-g.border,r,s);m=y}let i=this.domFromPos(e,e?-1:1),c=t==e?i:this.domFromPos(t,t?-1:1),d=r.root.getSelection(),u=r.domSelectionRange(),p=!1;if((cn||zt)&&e==t){let{node:f,offset:m}=i;if(f.nodeType==3){if(p=!!(m&&f.nodeValue[m-1]==`
|
|
6
|
+
`),p&&m==f.nodeValue.length)for(let g=f,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(i=c={node:y.parentNode,offset:Vt(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=f.childNodes[m-1];p=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(cn&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let f=u.focusNode.childNodes[u.focusOffset];f&&f.contentEditable=="false"&&(s=!0)}if(!(s||p&&zt)&&Lr(i.node,i.offset,u.anchorNode,u.anchorOffset)&&Lr(c.node,c.offset,u.focusNode,u.focusOffset))return;let h=!1;if((d.extend||e==t)&&!(p&&cn)){d.collapse(i.node,i.offset);try{e!=t&&d.extend(c.node,c.offset),h=!0}catch{}}if(!h){if(e>t){let m=i;i=c,c=m}let f=document.createRange();f.setEnd(c.node,c.offset),f.setStart(i.node,i.offset),d.removeAllRanges(),d.addRange(f)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let r=0,s=0;s<this.children.length;s++){let l=this.children[s],a=r+l.size;if(r==a?e<=a&&t>=r:e<a&&t>r){let i=r+l.border,c=a-l.border;if(e>=i&&t<=c){this.dirty=e==r||t==a?Or:cp,e==i&&t==c&&(l.contentLost||l.dom.parentNode!=this.contentDOM)?l.dirty=Sn:l.markDirty(e-i,t-i);return}else l.dirty=l.dom==l.contentDOM&&l.dom.parentNode==this.contentDOM&&!l.children.length?Or:Sn}r=a}this.dirty=Or}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let r=e==1?Or:cp;t.dirty<r&&(t.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class dp extends Ro{constructor(e,t,r,s){let l,a=t.type.toDOM;if(typeof a=="function"&&(a=a(r,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)})),!t.type.spec.raw){if(a.nodeType!=1){let i=document.createElement("span");i.appendChild(a),a=i}a.contentEditable="false",a.classList.add("ProseMirror-widget")}super(e,[],a,null),this.widget=t,this.widget=t,l=this}matchesWidget(e){return this.dirty==un&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Iw extends Ro{constructor(e,t,r,s){super(e,[],t,null),this.textDOM=r,this.text=s}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Ir extends Ro{constructor(e,t,r,s,l){super(e,[],r,s),this.mark=t,this.spec=l}static create(e,t,r,s){let l=s.nodeViews[t.type.name],a=l&&l(t,s,r);return(!a||!a.dom)&&(a=Ar.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new Ir(e,t,a.dom,a.contentDOM||a.dom,a)}parseRule(){return this.dirty&Sn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Sn&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=un){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=un}}slice(e,t,r){let s=Ir.create(this.parent,this.mark,!0,r),l=this.children,a=this.size;t<a&&(l=yi(l,t,a,r)),e>0&&(l=yi(l,0,e,r));for(let i=0;i<l.length;i++)l[i].parent=s;return s.children=l,s}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ir extends Ro{constructor(e,t,r,s,l,a,i,c,d){super(e,[],l,a),this.node=t,this.outerDeco=r,this.innerDeco=s,this.nodeDOM=i}static create(e,t,r,s,l,a){let i=l.nodeViews[t.type.name],c,d=i&&i(t,l,()=>{if(!c)return a;if(c.parent)return c.parent.posBeforeChild(c)},r,s),u=d&&d.dom,p=d&&d.contentDOM;if(t.isText){if(!u)u=document.createTextNode(t.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:p}=Ar.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!p&&!t.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),t.type.spec.draggable&&(u.draggable=!0));let h=u;return u=mp(u,r,t),d?c=new Fw(e,t,r,s,u,p||null,h,d,l,a+1):t.isText?new Zs(e,t,r,s,u,h,l):new ir(e,t,r,s,u,p||null,h,l,a+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let r=this.children[t];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>ne.empty)}return e}matchesNode(e,t,r){return this.dirty==un&&e.eq(this.node)&&Xs(t,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let r=this.node.inlineContent,s=t,l=e.composing?this.localCompositionInfo(e,t):null,a=l&&l.pos>-1?l:null,i=l&&l.pos<0,c=new Rw(this,a&&a.node,e);jw(this.node,this.innerDeco,(d,u,p)=>{d.spec.marks?c.syncToMarks(d.spec.marks,r,e):d.type.side>=0&&!p&&c.syncToMarks(u==this.node.childCount?et.none:this.node.child(u).marks,r,e),c.placeWidget(d,e,s)},(d,u,p,h)=>{c.syncToMarks(d.marks,r,e);let f;c.findNodeMatch(d,u,p,h)||i&&e.state.selection.from>s&&e.state.selection.to<s+d.nodeSize&&(f=c.findIndexWithChild(l.node))>-1&&c.updateNodeAt(d,u,p,f,e)||c.updateNextNode(d,u,p,e,h,s)||c.addNode(d,u,p,e,s),s+=d.nodeSize}),c.syncToMarks([],r,e),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==Or)&&(a&&this.protectLocalComposition(e,a),hp(this.contentDOM,this.children,e),ao&&Hw(this.dom))}localCompositionInfo(e,t){let{from:r,to:s}=e.state.selection;if(!(e.state.selection instanceof xe)||r<t||s>t+this.node.content.size)return null;let l=e.input.compositionNode;if(!l||!this.dom.contains(l.parentNode))return null;if(this.node.inlineContent){let a=l.nodeValue,i=Uw(this.node.content,a,r-t,s-t);return i<0?null:{node:l,pos:i,text:a}}else return{node:l,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:r,text:s}){if(this.getDesc(t))return;let l=t;for(;l.parentNode!=this.contentDOM;l=l.parentNode){for(;l.previousSibling;)l.parentNode.removeChild(l.previousSibling);for(;l.nextSibling;)l.parentNode.removeChild(l.nextSibling);l.pmViewDesc&&(l.pmViewDesc=void 0)}let a=new Iw(this,l,t,s);e.input.compositionNodes.push(a),this.children=yi(this.children,r,r+s.length,e,a)}update(e,t,r,s){return this.dirty==Sn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,r,s),!0)}updateInner(e,t,r,s){this.updateOuterDeco(t),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(s,this.posAtStart),this.dirty=un}updateOuterDeco(e){if(Xs(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=fp(this.dom,this.nodeDOM,gi(this.outerDeco,this.node,t),gi(e,this.node,t)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function up(n,e,t,r,s){mp(r,e,n);let l=new ir(void 0,n,e,t,r,r,r,s,0);return l.contentDOM&&l.updateChildren(s,0),l}class Zs extends ir{constructor(e,t,r,s,l,a,i){super(e,t,r,s,l,null,a,i,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,r,s){return this.dirty==Sn||this.dirty!=un&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=un||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,s.trackWrites==this.nodeDOM&&(s.trackWrites=null)),this.node=e,this.dirty=un,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,r){let s=this.node.cut(e,t),l=document.createTextNode(s.text);return new Zs(this.parent,s,this.outerDeco,this.innerDeco,l,l,r)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Sn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class pp extends Ro{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==un&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Fw extends ir{constructor(e,t,r,s,l,a,i,c,d,u){super(e,t,r,s,l,a,i,d,u),this.spec=c}update(e,t,r,s){if(this.dirty==Sn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let l=this.spec.update(e,t,r);return l&&this.updateInner(e,t,r,s),l}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,r,s)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,r,s){this.spec.setSelection?this.spec.setSelection(e,t,r.root):super.setSelection(e,t,r,s)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function hp(n,e,t){let r=n.firstChild,s=!1;for(let l=0;l<e.length;l++){let a=e[l],i=a.dom;if(i.parentNode==n){for(;i!=r;)r=gp(r),s=!0;r=r.nextSibling}else s=!0,n.insertBefore(i,r);if(a instanceof Ir){let c=r?r.previousSibling:n.lastChild;hp(a.contentDOM,a.children,t),r=c?c.nextSibling:n.firstChild}}for(;r;)r=gp(r),s=!0;s&&t.trackWrites==n&&(t.trackWrites=null)}const Po=function(n){n&&(this.nodeName=n)};Po.prototype=Object.create(null);const Fr=[new Po];function gi(n,e,t){if(n.length==0)return Fr;let r=t?Fr[0]:new Po,s=[r];for(let l=0;l<n.length;l++){let a=n[l].type.attrs;if(a){a.nodeName&&s.push(r=new Po(a.nodeName));for(let i in a){let c=a[i];c!=null&&(t&&s.length==1&&s.push(r=new Po(e.isInline?"span":"div")),i=="class"?r.class=(r.class?r.class+" ":"")+c:i=="style"?r.style=(r.style?r.style+";":"")+c:i!="nodeName"&&(r[i]=c))}}}return s}function fp(n,e,t,r){if(t==Fr&&r==Fr)return e;let s=e;for(let l=0;l<r.length;l++){let a=r[l],i=t[l];if(l){let c;i&&i.nodeName==a.nodeName&&s!=n&&(c=s.parentNode)&&c.nodeName.toLowerCase()==a.nodeName||(c=document.createElement(a.nodeName),c.pmIsDeco=!0,c.appendChild(s),i=Fr[0]),s=c}$w(s,i||Fr[0],a)}return s}function $w(n,e,t){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in t)&&n.removeAttribute(r);for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&t[r]!=e[r]&&n.setAttribute(r,t[r]);if(e.class!=t.class){let r=e.class?e.class.split(" ").filter(Boolean):[],s=t.class?t.class.split(" ").filter(Boolean):[];for(let l=0;l<r.length;l++)s.indexOf(r[l])==-1&&n.classList.remove(r[l]);for(let l=0;l<s.length;l++)r.indexOf(s[l])==-1&&n.classList.add(s[l]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,s;for(;s=r.exec(e.style);)n.style.removeProperty(s[1])}t.style&&(n.style.cssText+=t.style)}}function mp(n,e,t){return fp(n,n,Fr,gi(e,t,n.nodeType!=1))}function Xs(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function gp(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Rw{constructor(e,t,r){this.lock=t,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Pw(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let r=e;r<t;r++)this.top.children[r].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,r){let s=0,l=this.stack.length>>1,a=Math.min(l,e.length);for(;s<a&&(s==l-1?this.top:this.stack[s+1<<1]).matchesMark(e[s])&&e[s].type.spec.spanning!==!1;)s++;for(;s<l;)this.destroyRest(),this.top.dirty=un,this.index=this.stack.pop(),this.top=this.stack.pop(),l--;for(;l<e.length;){this.stack.push(this.top,this.index+1);let i=-1;for(let c=this.index;c<Math.min(this.index+3,this.top.children.length);c++){let d=this.top.children[c];if(d.matchesMark(e[l])&&!this.isLocked(d.dom)){i=c;break}}if(i>-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let c=Ir.create(this.top,e[l],t,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,l++}}findNodeMatch(e,t,r,s){let l=-1,a;if(s>=this.preMatch.index&&(a=this.preMatch.matches[s-this.preMatch.index]).parent==this.top&&a.matchesNode(e,t,r))l=this.top.children.indexOf(a,this.index);else for(let i=this.index,c=Math.min(this.top.children.length,i+5);i<c;i++){let d=this.top.children[i];if(d.matchesNode(e,t,r)&&!this.preMatch.matched.has(d)){l=i;break}}return l<0?!1:(this.destroyBetween(this.index,l),this.index++,!0)}updateNodeAt(e,t,r,s,l){let a=this.top.children[s];return a.dirty==Sn&&a.dom==a.contentDOM&&(a.dirty=Or),a.update(e,t,r,l)?(this.destroyBetween(this.index,s),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let s=this.index;s<this.top.children.length;s++)if(this.top.children[s]==r)return s}return-1}e=t}}updateNextNode(e,t,r,s,l,a){for(let i=this.index;i<this.top.children.length;i++){let c=this.top.children[i];if(c instanceof ir){let d=this.preMatch.matched.get(c);if(d!=null&&d!=l)return!1;let u=c.dom,p,h=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=Sn&&Xs(t,c.outerDeco));if(!h&&c.update(e,t,r,s))return this.destroyBetween(this.index,i),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!h&&(p=this.recreateWrapper(c,e,t,r,s,a)))return this.destroyBetween(this.index,i),this.top.children[this.index]=p,p.contentDOM&&(p.dirty=Or,p.updateChildren(s,a+1),p.dirty=un),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,r,s,l,a){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Xs(r,e.outerDeco)||!s.eq(e.innerDeco))return null;let i=ir.create(this.top,t,r,s,l,a);if(i.contentDOM){i.children=e.children,e.children=[];for(let c of i.children)c.parent=i}return e.destroy(),i}addNode(e,t,r,s,l){let a=ir.create(this.top,e,t,r,s,l);a.contentDOM&&a.updateChildren(s,l+1),this.top.children.splice(this.index++,0,a),this.changed=!0}placeWidget(e,t,r){let s=this.index<this.top.children.length?this.top.children[this.index]:null;if(s&&s.matchesWidget(e)&&(e==s.widget||!s.widget.type.toDOM.parentNode))this.index++;else{let l=new dp(this.top,e,t,r);this.top.children.splice(this.index++,0,l),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof Ir;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof Zs)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((zt||Ft)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let s=new pp(this.top,[],r,null);t!=this.top?t.children.push(s):t.children.splice(this.index++,0,s),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Pw(n,e){let t=e,r=t.children.length,s=n.childCount,l=new Map,a=[];e:for(;s>0;){let i;for(;;)if(r){let d=t.children[r-1];if(d instanceof Ir)t=d,r=d.children.length;else{i=d,r--;break}}else{if(t==e)break e;r=t.parent.children.indexOf(t),t=t.parent}let c=i.node;if(c){if(c!=n.child(s-1))break;--s,l.set(i,s),a.push(i)}}return{index:s,matched:l,matches:a.reverse()}}function zw(n,e){return n.type.side-e.type.side}function jw(n,e,t,r){let s=e.locals(n),l=0;if(s.length==0){for(let d=0;d<n.childCount;d++){let u=n.child(d);r(u,s,e.forChild(l,u),d),l+=u.nodeSize}return}let a=0,i=[],c=null;for(let d=0;;){let u,p;for(;a<s.length&&s[a].to==l;){let y=s[a++];y.widget&&(u?(p||(p=[u])).push(y):u=y)}if(u)if(p){p.sort(zw);for(let y=0;y<p.length;y++)t(p[y],d,!!c)}else t(u,d,!!c);let h,f;if(c)f=-1,h=c,c=null;else if(d<n.childCount)f=d,h=n.child(d++);else break;for(let y=0;y<i.length;y++)i[y].to<=l&&i.splice(y--,1);for(;a<s.length&&s[a].from<=l&&s[a].to>l;)i.push(s[a++]);let m=l+h.nodeSize;if(h.isText){let y=m;a<s.length&&s[a].from<y&&(y=s[a].from);for(let b=0;b<i.length;b++)i[b].to<y&&(y=i[b].to);y<m&&(c=h.cut(y-l),h=h.cut(0,y-l),m=y,f=-1)}else for(;a<s.length&&s[a].to<m;)a++;let g=h.isInline&&!h.isLeaf?i.filter(y=>!y.inline):i.slice();r(h,g,e.forChild(l,h),f),l=m}}function Hw(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function Uw(n,e,t,r){for(let s=0,l=0;s<n.childCount&&l<=r;){let a=n.child(s++),i=l;if(l+=a.nodeSize,!a.isText)continue;let c=a.text;for(;s<n.childCount;){let d=n.child(s++);if(l+=d.nodeSize,!d.isText)break;c+=d.text}if(l>=t){if(l>=r&&c.slice(r-e.length-i,r-i)==e)return r-e.length;let d=i<r?c.lastIndexOf(e,r-i-1):-1;if(d>=0&&d+e.length+i>=t)return i+d;if(t==r&&c.length>=r+e.length-i&&c.slice(r-i,r-i+e.length)==e)return r}}return-1}function yi(n,e,t,r,s){let l=[];for(let a=0,i=0;a<n.length;a++){let c=n[a],d=i,u=i+=c.size;d>=t||u<=e?l.push(c):(d<e&&l.push(c.slice(0,e-d,r)),s&&(l.push(s),s=void 0),u>t&&l.push(c.slice(t-d,c.size,r)))}return l}function bi(n,e=null){let t=n.domSelectionRange(),r=n.state.doc;if(!t.focusNode)return null;let s=n.docView.nearestDesc(t.focusNode),l=s&&s.size==0,a=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(a<0)return null;let i=r.resolve(a),c,d;if(Js(t)){for(c=a;s&&!s.node;)s=s.parent;let p=s.node;if(s&&p.isAtom&&we.isSelectable(p)&&s.parent&&!(p.isInline&&gw(t.focusNode,t.focusOffset,s.dom))){let h=s.posBefore;d=new we(a==h?i:r.resolve(h))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let p=a,h=a;for(let f=0;f<t.rangeCount;f++){let m=t.getRangeAt(f);p=Math.min(p,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),h=Math.max(h,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(p<0)return null;[c,a]=h==n.state.selection.anchor?[h,p]:[p,h],i=r.resolve(a)}else c=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(c<0)return null}let u=r.resolve(c);if(!d){let p=e=="pointer"||n.state.selection.head<i.pos&&!l?1:-1;d=wi(n,u,i,p)}return d}function yp(n){return n.editable?n.hasFocus():Cp(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Kn(n,e=!1){let t=n.state.selection;if(xp(n,t),!!yp(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&Ft){let r=n.domSelectionRange(),s=n.domObserver.currentSelection;if(r.anchorNode&&s.anchorNode&&Lr(r.anchorNode,r.anchorOffset,s.anchorNode,s.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)Kw(n);else{let{anchor:r,head:s}=t,l,a;bp&&!(t instanceof xe)&&(t.$from.parent.inlineContent||(l=kp(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(a=kp(n,t.to))),n.docView.setSelection(r,s,n,e),bp&&(l&&wp(l),a&&wp(a)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Ww(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const bp=zt||Ft&&Zu<63;function kp(n,e){let{node:t,offset:r}=n.docView.domFromPos(e,0),s=r<t.childNodes.length?t.childNodes[r]:null,l=r?t.childNodes[r-1]:null;if(zt&&s&&s.contentEditable=="false")return ki(s);if((!s||s.contentEditable=="false")&&(!l||l.contentEditable=="false")){if(s)return ki(s);if(l)return ki(l)}}function ki(n){return n.contentEditable="true",zt&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function wp(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Ww(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),r=t.anchorNode,s=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=r||t.anchorOffset!=s)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!yp(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function Kw(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,r=t.nodeName=="IMG";r?e.collapse(t.parentNode,Vt(t)+1):e.collapse(t,0),!r&&!n.state.selection.visible&&qt&&lr<=11&&(t.disabled=!0,t.disabled=!1)}function xp(n,e){if(e instanceof we){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(vp(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else vp(n)}function vp(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function wi(n,e,t,r){return n.someProp("createSelectionBetween",s=>s(n,e,t))||xe.between(e,t,r)}function Ep(n){return n.editable&&!n.hasFocus()?!1:Cp(n)}function Cp(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function qw(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return Lr(e.node,e.offset,t.anchorNode,t.anchorOffset)}function xi(n,e){let{$anchor:t,$head:r}=n.selection,s=e>0?t.max(r):t.min(r),l=s.parent.inlineContent?s.depth?n.doc.resolve(e>0?s.after():s.before()):null:s;return l&&_e.findFrom(l,e)}function cr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function _p(n,e,t){let r=n.state.selection;if(r instanceof xe)if(t.indexOf("s")>-1){let{$head:s}=r,l=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter;if(!l||l.isText||!l.isLeaf)return!1;let a=n.state.doc.resolve(s.pos+l.nodeSize*(e<0?-1:1));return cr(n,new xe(r.$anchor,a))}else if(r.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let s=xi(n.state,e);return s&&s instanceof we?cr(n,s):!1}else if(!(dn&&t.indexOf("m")>-1)){let s=r.$head,l=s.textOffset?null:e<0?s.nodeBefore:s.nodeAfter,a;if(!l||l.isText)return!1;let i=e<0?s.pos-l.nodeSize:s.pos;return l.isAtom||(a=n.docView.descAt(i))&&!a.contentDOM?we.isSelectable(l)?cr(n,new we(e<0?n.state.doc.resolve(s.pos-l.nodeSize):s)):Fo?cr(n,new xe(n.state.doc.resolve(e<0?i:i+l.nodeSize))):!1:!1}}else return!1;else{if(r instanceof we&&r.node.isInline)return cr(n,new xe(e>0?r.$to:r.$from));{let s=xi(n.state,e);return s?cr(n,s):!1}}}function Qs(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function zo(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function co(n,e){return e<0?Gw(n):Yw(n)}function Gw(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s,l,a=!1;for(cn&&t.nodeType==1&&r<Qs(t)&&zo(t.childNodes[r],-1)&&(a=!0);;)if(r>0){if(t.nodeType!=1)break;{let i=t.childNodes[r-1];if(zo(i,-1))s=t,l=--r;else if(i.nodeType==3)t=i,r=t.nodeValue.length;else break}}else{if(Sp(t))break;{let i=t.previousSibling;for(;i&&zo(i,-1);)s=t.parentNode,l=Vt(i),i=i.previousSibling;if(i)t=i,r=Qs(t);else{if(t=t.parentNode,t==n.dom)break;r=0}}}a?vi(n,t,r):s&&vi(n,s,l)}function Yw(n){let e=n.domSelectionRange(),t=e.focusNode,r=e.focusOffset;if(!t)return;let s=Qs(t),l,a;for(;;)if(r<s){if(t.nodeType!=1)break;let i=t.childNodes[r];if(zo(i,1))l=t,a=++r;else break}else{if(Sp(t))break;{let i=t.nextSibling;for(;i&&zo(i,1);)l=i.parentNode,a=Vt(i)+1,i=i.nextSibling;if(i)t=i,r=0,s=Qs(t);else{if(t=t.parentNode,t==n.dom)break;r=s=0}}}l&&vi(n,l,a)}function Sp(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function Jw(n,e){for(;n&&e==n.childNodes.length&&!Io(n);)e=Vt(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function Zw(n,e){for(;n&&!e&&!Io(n);)e=Vt(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function vi(n,e,t){if(e.nodeType!=3){let l,a;(a=Jw(e,t))?(e=a,t=0):(l=Zw(e,t))&&(e=l,t=l.nodeValue.length)}let r=n.domSelection();if(!r)return;if(Js(r)){let l=document.createRange();l.setEnd(e,t),l.setStart(e,t),r.removeAllRanges(),r.addRange(l)}else r.extend&&r.extend(e,t);n.domObserver.setCurSelection();let{state:s}=n;setTimeout(()=>{n.state==s&&Kn(n)},50)}function Np(n,e){let t=n.state.doc.resolve(e);if(!(Ft||kw)&&t.parent.inlineContent){let r=n.coordsAtPos(e);if(e>t.start()){let s=n.coordsAtPos(e-1),l=(s.top+s.bottom)/2;if(l>r.top&&l<r.bottom&&Math.abs(s.left-r.left)>1)return s.left<r.left?"ltr":"rtl"}if(e<t.end()){let s=n.coordsAtPos(e+1),l=(s.top+s.bottom)/2;if(l>r.top&&l<r.bottom&&Math.abs(s.left-r.left)>1)return s.left>r.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Vp(n,e,t){let r=n.state.selection;if(r instanceof xe&&!r.empty||t.indexOf("s")>-1||dn&&t.indexOf("m")>-1)return!1;let{$from:s,$to:l}=r;if(!s.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let a=xi(n.state,e);if(a&&a instanceof we)return cr(n,a)}if(!s.parent.inlineContent){let a=e<0?s:l,i=r instanceof en?_e.near(a,e):_e.findFrom(a,e);return i?cr(n,i):!1}return!1}function Mp(n,e){if(!(n.state.selection instanceof xe))return!0;let{$head:t,$anchor:r,empty:s}=n.state.selection;if(!t.sameParent(r))return!0;if(!s)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let l=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(l&&!l.isText){let a=n.state.tr;return e<0?a.delete(t.pos-l.nodeSize,t.pos):a.delete(t.pos,t.pos+l.nodeSize),n.dispatch(a),!0}return!1}function Bp(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function Xw(n){if(!zt||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;Bp(n,r,"true"),setTimeout(()=>Bp(n,r,"false"),20)}return!1}function Qw(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function ex(n,e){let t=e.keyCode,r=Qw(e);if(t==8||dn&&t==72&&r=="c")return Mp(n,-1)||co(n,-1);if(t==46&&!e.shiftKey||dn&&t==68&&r=="c")return Mp(n,1)||co(n,1);if(t==13||t==27)return!0;if(t==37||dn&&t==66&&r=="c"){let s=t==37?Np(n,n.state.selection.from)=="ltr"?-1:1:-1;return _p(n,s,r)||co(n,s)}else if(t==39||dn&&t==70&&r=="c"){let s=t==39?Np(n,n.state.selection.from)=="ltr"?1:-1:1;return _p(n,s,r)||co(n,s)}else{if(t==38||dn&&t==80&&r=="c")return Vp(n,-1,r)||co(n,-1);if(t==40||dn&&t==78&&r=="c")return Xw(n)||Vp(n,1,r)||co(n,1);if(r==(dn?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function Ei(n,e){n.someProp("transformCopied",f=>{e=f(e,n)});let t=[],{content:r,openStart:s,openEnd:l}=e;for(;s>1&&l>1&&r.childCount==1&&r.firstChild.childCount==1;){s--,l--;let f=r.firstChild;t.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let a=n.someProp("clipboardSerializer")||Ar.fromSchema(n.state.schema),i=$p(),c=i.createElement("div");c.appendChild(a.serializeFragment(r,{document:i}));let d=c.firstChild,u,p=0;for(;d&&d.nodeType==1&&(u=Ip[d.nodeName.toLowerCase()]);){for(let f=u.length-1;f>=0;f--){let m=i.createElement(u[f]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),p++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${s} ${l}${p?` -${p}`:""} ${JSON.stringify(t)}`);let h=n.someProp("clipboardTextSerializer",f=>f(e,n))||e.content.textBetween(0,e.content.size,`
|
|
7
|
+
|
|
8
|
+
`);return{dom:c,text:h,slice:e}}function Ap(n,e,t,r,s){let l=s.parent.type.spec.code,a,i;if(!t&&!e)return null;let c=!!e&&(r||l||!t);if(c){if(n.someProp("transformPastedText",h=>{e=h(e,l||r,n)}),l)return i=new de(ne.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
|
9
|
+
`))),0,0),n.someProp("transformPasted",h=>{i=h(i,n,!0)}),i;let p=n.someProp("clipboardTextParser",h=>h(e,s,r,n));if(p)i=p;else{let h=s.marks(),{schema:f}=n.state,m=Ar.fromSchema(f);a=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=a.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(f.text(g,h)))})}}else n.someProp("transformPastedHTML",p=>{t=p(t,n)}),a=ox(t),Fo&&sx(a);let d=a&&a.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let p=+u[3];p>0;p--){let h=a.firstChild;for(;h&&h.nodeType!=1;)h=h.nextSibling;if(!h)break;a=h}if(i||(i=(n.someProp("clipboardParser")||n.someProp("domParser")||eo.fromSchema(n.state.schema)).parseSlice(a,{preserveWhitespace:!!(c||u),context:s,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!tx.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)i=lx(Op(i,+u[1],+u[2]),u[4]);else if(i=de.maxOpen(nx(i.content,s),!0),i.openStart||i.openEnd){let p=0,h=0;for(let f=i.content.firstChild;p<i.openStart&&!f.type.spec.isolating;p++,f=f.firstChild);for(let f=i.content.lastChild;h<i.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);i=Op(i,p,h)}return n.someProp("transformPasted",p=>{i=p(i,n,c)}),i}const tx=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function nx(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.index(t)),s,l=[];if(n.forEach(a=>{if(!l)return;let i=r.findWrapping(a.type),c;if(!i)return l=null;if(c=l.length&&s.length&&Lp(i,s,a,l[l.length-1],0))l[l.length-1]=c;else{l.length&&(l[l.length-1]=Dp(l[l.length-1],s.length));let d=Tp(a,i);l.push(d),r=r.matchType(d.type),s=i}}),l)return ne.from(l)}return n}function Tp(n,e,t=0){for(let r=e.length-1;r>=t;r--)n=e[r].create(null,ne.from(n));return n}function Lp(n,e,t,r,s){if(s<n.length&&s<e.length&&n[s]==e[s]){let l=Lp(n,e,t,r.lastChild,s+1);if(l)return r.copy(r.content.replaceChild(r.childCount-1,l));if(r.contentMatchAt(r.childCount).matchType(s==n.length-1?t.type:n[s+1]))return r.copy(r.content.append(ne.from(Tp(t,n,s+1))))}}function Dp(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,Dp(n.lastChild,e-1)),r=n.contentMatchAt(n.childCount).fillBefore(ne.empty,!0);return n.copy(t.append(r))}function Ci(n,e,t,r,s,l){let a=e<0?n.firstChild:n.lastChild,i=a.content;return n.childCount>1&&(l=0),s<r-1&&(i=Ci(i,e,t,r,s+1,l)),s>=t&&(i=e<0?a.contentMatchAt(0).fillBefore(i,l<=s).append(i):i.append(a.contentMatchAt(a.childCount).fillBefore(ne.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,a.copy(i))}function Op(n,e,t){return e<n.openStart&&(n=new de(Ci(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new de(Ci(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const Ip={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Fp=null;function $p(){return Fp||(Fp=document.implementation.createHTMLDocument("title"))}let _i=null;function rx(n){let e=window.trustedTypes;return e?(_i||(_i=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),_i.createHTML(n)):n}function ox(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=$p().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),s;if((s=r&&Ip[r[1].toLowerCase()])&&(n=s.map(l=>"<"+l+">").join("")+n+s.map(l=>"</"+l+">").reverse().join("")),t.innerHTML=rx(n),s)for(let l=0;l<s.length;l++)t=t.querySelector(s[l])||t;return t}function sx(n){let e=n.querySelectorAll(Ft?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let r=e[t];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function lx(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return n}let{content:s,openStart:l,openEnd:a}=n;for(let i=r.length-2;i>=0;i-=2){let c=t.nodes[r[i]];if(!c||c.hasRequiredAttrs())break;s=ne.from(c.create(r[i+1],s)),l++,a++}return new de(s,l,a)}const jt={},Ht={},ax={touchstart:!0,touchmove:!0};class ix{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function cx(n){for(let e in jt){let t=jt[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>{ux(n,r)&&!Ni(n,r)&&(n.editable||!(r.type in Ht))&&t(n,r)},ax[e]?{passive:!0}:void 0)}zt&&n.dom.addEventListener("input",()=>null),Si(n)}function dr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function dx(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Si(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>Ni(n,r))})}function Ni(n,e){return n.someProp("handleDOMEvents",t=>{let r=t[e.type];return r?r(n,e)||e.defaultPrevented:!1})}function ux(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function px(n,e){!Ni(n,e)&&jt[e.type]&&(n.editable||!(e.type in Ht))&&jt[e.type](n,e)}Ht.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!Pp(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Un&&Ft&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),ao&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",s=>s(n,Dr(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,t))||ex(n,t)?t.preventDefault():dr(n,"key")},Ht.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)},Ht.keypress=(n,e)=>{let t=e;if(Pp(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||dn&&t.metaKey)return;if(n.someProp("handleKeyPress",s=>s(n,t))){t.preventDefault();return}let r=n.state.selection;if(!(r instanceof xe)||!r.$from.sameParent(r.$to)){let s=String.fromCharCode(t.charCode),l=()=>n.state.tr.insertText(s).scrollIntoView();!/[\r\n]/.test(s)&&!n.someProp("handleTextInput",a=>a(n,r.$from.pos,r.$to.pos,s,l))&&n.dispatch(l()),t.preventDefault()}};function el(n){return{left:n.clientX,top:n.clientY}}function hx(n,e){let t=e.x-n.clientX,r=e.y-n.clientY;return t*t+r*r<100}function Vi(n,e,t,r,s){if(r==-1)return!1;let l=n.state.doc.resolve(r);for(let a=l.depth+1;a>0;a--)if(n.someProp(e,i=>a>l.depth?i(n,t,l.nodeAfter,l.before(a),s,!0):i(n,t,l.node(a),l.before(a),s,!1)))return!0;return!1}function uo(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let r=n.state.tr.setSelection(e);r.setMeta("pointer",!0),n.dispatch(r)}function fx(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),r=t.nodeAfter;return r&&r.isAtom&&we.isSelectable(r)?(uo(n,new we(t)),!0):!1}function mx(n,e){if(e==-1)return!1;let t=n.state.selection,r,s;t instanceof we&&(r=t.node);let l=n.state.doc.resolve(e);for(let a=l.depth+1;a>0;a--){let i=a>l.depth?l.nodeAfter:l.node(a);if(we.isSelectable(i)){r&&t.$from.depth>0&&a>=t.$from.depth&&l.before(t.$from.depth+1)==t.$from.pos?s=l.before(t.$from.depth):s=l.before(a);break}}return s!=null?(uo(n,we.create(n.state.doc,s)),!0):!1}function gx(n,e,t,r,s){return Vi(n,"handleClickOn",e,t,r)||n.someProp("handleClick",l=>l(n,e,r))||(s?mx(n,t):fx(n,t))}function yx(n,e,t,r){return Vi(n,"handleDoubleClickOn",e,t,r)||n.someProp("handleDoubleClick",s=>s(n,e,r))}function bx(n,e,t,r){return Vi(n,"handleTripleClickOn",e,t,r)||n.someProp("handleTripleClick",s=>s(n,e,r))||kx(n,t,r)}function kx(n,e,t){if(t.button!=0)return!1;let r=n.state.doc;if(e==-1)return r.inlineContent?(uo(n,xe.create(r,0,r.content.size)),!0):!1;let s=r.resolve(e);for(let l=s.depth+1;l>0;l--){let a=l>s.depth?s.nodeAfter:s.node(l),i=s.before(l);if(a.inlineContent)uo(n,xe.create(r,i+1,i+1+a.content.size));else if(we.isSelectable(a))uo(n,we.create(r,i));else continue;return!0}}function Mi(n){return tl(n)}const Rp=dn?"metaKey":"ctrlKey";jt.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let r=Mi(n),s=Date.now(),l="singleClick";s-n.input.lastClick.time<500&&hx(t,n.input.lastClick)&&!t[Rp]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?l="doubleClick":n.input.lastClick.type=="doubleClick"&&(l="tripleClick")),n.input.lastClick={time:s,x:t.clientX,y:t.clientY,type:l,button:t.button};let a=n.posAtCoords(el(t));a&&(l=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new wx(n,a,t,!!r)):(l=="doubleClick"?yx:bx)(n,a.pos,a.inside,t)?t.preventDefault():dr(n,"pointer"))};class wx{constructor(e,t,r,s){this.view=e,this.pos=t,this.event=r,this.flushed=s,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Rp],this.allowDefault=r.shiftKey;let l,a;if(t.inside>-1)l=e.state.doc.nodeAt(t.inside),a=t.inside;else{let u=e.state.doc.resolve(t.pos);l=u.parent,a=u.depth?u.before():0}const i=s?null:r.target,c=i?e.docView.nearestDesc(i,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:d}=e.state;(r.button==0&&l.type.spec.draggable&&l.type.spec.selectable!==!1||d instanceof we&&d.from<=a&&d.to>a)&&(this.mightDrag={node:l,pos:a,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&cn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),dr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Kn(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(el(e))),this.updateAllowDefault(e),this.allowDefault||!t?dr(this.view,"pointer"):gx(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||zt&&this.mightDrag&&!this.mightDrag.node.isAtom||Ft&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(uo(this.view,_e.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):dr(this.view,"pointer")}move(e){this.updateAllowDefault(e),dr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}jt.touchstart=n=>{n.input.lastTouch=Date.now(),Mi(n),dr(n,"pointer")},jt.touchmove=n=>{n.input.lastTouch=Date.now(),dr(n,"pointer")},jt.contextmenu=n=>Mi(n);function Pp(n,e){return n.composing?!0:zt&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const xx=Un?5e3:-1;Ht.compositionstart=Ht.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof xe&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||t.marks(),tl(n,!0),n.markCursor=null;else if(tl(n,!e.selection.empty),cn&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let r=n.domSelectionRange();for(let s=r.focusNode,l=r.focusOffset;s&&s.nodeType==1&&l!=0;){let a=l<0?s.lastChild:s.childNodes[l-1];if(!a)break;if(a.nodeType==3){let i=n.domSelection();i&&i.collapse(a,a.nodeValue.length);break}else s=a,l=-1}}n.input.composing=!0}zp(n,xx)},Ht.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,zp(n,20))};function zp(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>tl(n),e))}function jp(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Ex());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function vx(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=fw(e.focusNode,e.focusOffset),r=mw(e.focusNode,e.focusOffset);if(t&&r&&t!=r){let s=r.pmViewDesc,l=n.domObserver.lastChangedTextNode;if(t==l||r==l)return l;if(!s||!s.isText(r.nodeValue))return r;if(n.input.compositionNode==r){let a=t.pmViewDesc;if(!(!a||!a.isText(t.nodeValue)))return r}}return t||r}function Ex(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function tl(n,e=!1){if(!(Un&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),jp(n),e||n.docView&&n.docView.dirty){let t=bi(n),r=n.state.selection;return t&&!t.eq(r)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function Cx(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),s=document.createRange();s.selectNodeContents(e),n.dom.blur(),r.removeAllRanges(),r.addRange(s),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const jo=qt&&lr<15||ao&&ww<604;jt.copy=Ht.cut=(n,e)=>{let t=e,r=n.state.selection,s=t.type=="cut";if(r.empty)return;let l=jo?null:t.clipboardData,a=r.content(),{dom:i,text:c}=Ei(n,a);l?(t.preventDefault(),l.clearData(),l.setData("text/html",i.innerHTML),l.setData("text/plain",c)):Cx(n,i),s&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function _x(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Sx(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let s=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),t?Ho(n,r.value,null,s,e):Ho(n,r.textContent,r.innerHTML,s,e)},50)}function Ho(n,e,t,r,s){let l=Ap(n,e,t,r,n.state.selection.$from);if(n.someProp("handlePaste",c=>c(n,s,l||de.empty)))return!0;if(!l)return!1;let a=_x(l),i=a?n.state.tr.replaceSelectionWith(a,r):n.state.tr.replaceSelection(l);return n.dispatch(i.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Hp(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}Ht.paste=(n,e)=>{let t=e;if(n.composing&&!Un)return;let r=jo?null:t.clipboardData,s=n.input.shiftKey&&n.input.lastKeyCode!=45;r&&Ho(n,Hp(r),r.getData("text/html"),s,t)?t.preventDefault():Sx(n,t)};class Up{constructor(e,t,r){this.slice=e,this.move=t,this.node=r}}const Nx=dn?"altKey":"ctrlKey";function Wp(n,e){return n.someProp("dragCopies",r=>!r(e))??!e[Nx]}jt.dragstart=(n,e)=>{let t=e,r=n.input.mouseDown;if(r&&r.done(),!t.dataTransfer)return;let s=n.state.selection,l=s.empty?null:n.posAtCoords(el(t)),a;if(!(l&&l.pos>=s.from&&l.pos<=(s instanceof we?s.to-1:s.to))){if(r&&r.mightDrag)a=we.create(n.state.doc,r.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let p=n.docView.nearestDesc(t.target,!0);p&&p.node.type.spec.draggable&&p!=n.docView&&(a=we.create(n.state.doc,p.posBefore))}}let i=(a||n.state.selection).content(),{dom:c,text:d,slice:u}=Ei(n,i);(!t.dataTransfer.files.length||!Ft||Zu>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(jo?"Text":"text/html",c.innerHTML),t.dataTransfer.effectAllowed="copyMove",jo||t.dataTransfer.setData("text/plain",d),n.dragging=new Up(u,Wp(n,t),a)},jt.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)},Ht.dragover=Ht.dragenter=(n,e)=>e.preventDefault(),Ht.drop=(n,e)=>{let t=e,r=n.dragging;if(n.dragging=null,!t.dataTransfer)return;let s=n.posAtCoords(el(t));if(!s)return;let l=n.state.doc.resolve(s.pos),a=r&&r.slice;a?n.someProp("transformPasted",m=>{a=m(a,n,!1)}):a=Ap(n,Hp(t.dataTransfer),jo?null:t.dataTransfer.getData("text/html"),!1,l);let i=!!(r&&Wp(n,t));if(n.someProp("handleDrop",m=>m(n,t,a||de.empty,i))){t.preventDefault();return}if(!a)return;t.preventDefault();let c=a?Du(n.state.doc,l.pos,a):l.pos;c==null&&(c=l.pos);let d=n.state.tr;if(i){let{node:m}=r;m?m.replace(d):d.deleteSelection()}let u=d.mapping.map(c),p=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,h=d.doc;if(p?d.replaceRangeWith(u,u,a.content.firstChild):d.replaceRange(u,u,a),d.doc.eq(h))return;let f=d.doc.resolve(u);if(p&&we.isSelectable(a.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(a.content.firstChild))d.setSelection(new we(f));else{let m=d.mapping.map(c);d.mapping.maps[d.mapping.maps.length-1].forEach((g,y,b,k)=>m=k),d.setSelection(wi(n,f,d.doc.resolve(m)))}n.focus(),n.dispatch(d.setMeta("uiEvent","drop"))},jt.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Kn(n)},20))},jt.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)},jt.beforeinput=(n,e)=>{if(Ft&&Un&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:t}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=t||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",s=>s(n,Dr(8,"Backspace")))))return;let{$cursor:r}=n.state.selection;r&&r.pos>0&&n.dispatch(n.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let n in Ht)jt[n]=Ht[n];function Uo(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class nl{constructor(e,t){this.toDOM=e,this.spec=t||$r,this.side=this.spec.side||0}map(e,t,r,s){let{pos:l,deleted:a}=e.mapResult(t.from+s,this.side<0?-1:1);return a?null:new Ct(l-r,l-r,this)}valid(){return!0}eq(e){return this==e||e instanceof nl&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Uo(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ur{constructor(e,t){this.attrs=e,this.spec=t||$r}map(e,t,r,s){let l=e.map(t.from+s,this.spec.inclusiveStart?-1:1)-r,a=e.map(t.to+s,this.spec.inclusiveEnd?1:-1)-r;return l>=a?null:new Ct(l,a,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof ur&&Uo(this.attrs,e.attrs)&&Uo(this.spec,e.spec)}static is(e){return e.type instanceof ur}destroy(){}}class Bi{constructor(e,t){this.attrs=e,this.spec=t||$r}map(e,t,r,s){let l=e.mapResult(t.from+s,1);if(l.deleted)return null;let a=e.mapResult(t.to+s,-1);return a.deleted||a.pos<=l.pos?null:new Ct(l.pos-r,a.pos-r,this)}valid(e,t){let{index:r,offset:s}=e.content.findIndex(t.from),l;return s==t.from&&!(l=e.child(r)).isText&&s+l.nodeSize==t.to}eq(e){return this==e||e instanceof Bi&&Uo(this.attrs,e.attrs)&&Uo(this.spec,e.spec)}destroy(){}}class Ct{constructor(e,t,r){this.from=e,this.to=t,this.type=r}copy(e,t){return new Ct(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,r){return this.type.map(e,this,t,r)}static widget(e,t,r){return new Ct(e,e,new nl(t,r))}static inline(e,t,r,s){return new Ct(e,t,new ur(r,s))}static node(e,t,r,s){return new Ct(e,t,new Bi(r,s))}get spec(){return this.type.spec}get inline(){return this.type instanceof ur}get widget(){return this.type instanceof nl}}const po=[],$r={};class rt{constructor(e,t){this.local=e.length?e:po,this.children=t.length?t:po}static create(e,t){return t.length?rl(t,e,0,$r):$t}find(e,t,r){let s=[];return this.findInner(e??0,t??1e9,s,0,r),s}findInner(e,t,r,s,l){for(let a=0;a<this.local.length;a++){let i=this.local[a];i.from<=t&&i.to>=e&&(!l||l(i.spec))&&r.push(i.copy(i.from+s,i.to+s))}for(let a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){let i=this.children[a]+1;this.children[a+2].findInner(e-i,t-i,r,s+i,l)}}map(e,t,r){return this==$t||e.maps.length==0?this:this.mapInner(e,t,0,0,r||$r)}mapInner(e,t,r,s,l){let a;for(let i=0;i<this.local.length;i++){let c=this.local[i].map(e,r,s);c&&c.type.valid(t,c)?(a||(a=[])).push(c):l.onRemove&&l.onRemove(this.local[i].spec)}return this.children.length?Vx(this.children,a||[],e,t,r,s,l):a?new rt(a.sort(Rr),po):$t}add(e,t){return t.length?this==$t?rt.create(e,t):this.addInner(e,t,0):this}addInner(e,t,r){let s,l=0;e.forEach((i,c)=>{let d=c+r,u;if(u=qp(t,i,d)){for(s||(s=this.children.slice());l<s.length&&s[l]<c;)l+=3;s[l]==c?s[l+2]=s[l+2].addInner(i,u,d+1):s.splice(l,0,c,c+i.nodeSize,rl(u,i,d+1,$r)),l+=3}});let a=Kp(l?Gp(t):t,-r);for(let i=0;i<a.length;i++)a[i].type.valid(e,a[i])||a.splice(i--,1);return new rt(a.length?this.local.concat(a).sort(Rr):this.local,s||this.children)}remove(e){return e.length==0||this==$t?this:this.removeInner(e,0)}removeInner(e,t){let r=this.children,s=this.local;for(let l=0;l<r.length;l+=3){let a,i=r[l]+t,c=r[l+1]+t;for(let u=0,p;u<e.length;u++)(p=e[u])&&p.from>i&&p.to<c&&(e[u]=null,(a||(a=[])).push(p));if(!a)continue;r==this.children&&(r=this.children.slice());let d=r[l+2].removeInner(a,i+1);d!=$t?r[l+2]=d:(r.splice(l,3),l-=3)}if(s.length){for(let l=0,a;l<e.length;l++)if(a=e[l])for(let i=0;i<s.length;i++)s[i].eq(a,t)&&(s==this.local&&(s=this.local.slice()),s.splice(i--,1))}return r==this.children&&s==this.local?this:s.length||r.length?new rt(s,r):$t}forChild(e,t){if(this==$t)return this;if(t.isLeaf)return rt.empty;let r,s;for(let i=0;i<this.children.length;i+=3)if(this.children[i]>=e){this.children[i]==e&&(r=this.children[i+2]);break}let l=e+1,a=l+t.content.size;for(let i=0;i<this.local.length;i++){let c=this.local[i];if(c.from<a&&c.to>l&&c.type instanceof ur){let d=Math.max(l,c.from)-l,u=Math.min(a,c.to)-l;d<u&&(s||(s=[])).push(c.copy(d,u))}}if(s){let i=new rt(s.sort(Rr),po);return r?new pr([i,r]):i}return r||$t}eq(e){if(this==e)return!0;if(!(e instanceof rt)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return Ai(this.localsInner(e))}localsInner(e){if(this==$t)return po;if(e.inlineContent||!this.local.some(ur.is))return this.local;let t=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ur||t.push(this.local[r]);return t}forEachSet(e){e(this)}}rt.empty=new rt([],[]),rt.removeOverlap=Ai;const $t=rt.empty;class pr{constructor(e){this.members=e}map(e,t){const r=this.members.map(s=>s.map(e,t,$r));return pr.from(r)}forChild(e,t){if(t.isLeaf)return rt.empty;let r=[];for(let s=0;s<this.members.length;s++){let l=this.members[s].forChild(e,t);l!=$t&&(l instanceof pr?r=r.concat(l.members):r.push(l))}return pr.from(r)}eq(e){if(!(e instanceof pr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,r=!0;for(let s=0;s<this.members.length;s++){let l=this.members[s].localsInner(e);if(l.length)if(!t)t=l;else{r&&(t=t.slice(),r=!1);for(let a=0;a<l.length;a++)t.push(l[a])}}return t?Ai(r?t:t.sort(Rr)):po}static from(e){switch(e.length){case 0:return $t;case 1:return e[0];default:return new pr(e.every(t=>t instanceof rt)?e:e.reduce((t,r)=>t.concat(r instanceof rt?r:r.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Vx(n,e,t,r,s,l,a){let i=n.slice();for(let d=0,u=l;d<t.maps.length;d++){let p=0;t.maps[d].forEach((h,f,m,g)=>{let y=g-m-(f-h);for(let b=0;b<i.length;b+=3){let k=i[b+1];if(k<0||h>k+u-p)continue;let x=i[b]+u-p;f>=x?i[b+1]=h<=x?-2:-1:h>=u&&y&&(i[b]+=y,i[b+1]+=y)}p+=y}),u=t.maps[d].map(u,-1)}let c=!1;for(let d=0;d<i.length;d+=3)if(i[d+1]<0){if(i[d+1]==-2){c=!0,i[d+1]=-1;continue}let u=t.map(n[d]+l),p=u-s;if(p<0||p>=r.content.size){c=!0;continue}let h=t.map(n[d+1]+l,-1),f=h-s,{index:m,offset:g}=r.content.findIndex(p),y=r.maybeChild(m);if(y&&g==p&&g+y.nodeSize==f){let b=i[d+2].mapInner(t,y,u+1,n[d]+l+1,a);b!=$t?(i[d]=p,i[d+1]=f,i[d+2]=b):(i[d+1]=-2,c=!0)}else c=!0}if(c){let d=Mx(i,n,e,t,s,l,a),u=rl(d,r,0,a);e=u.local;for(let p=0;p<i.length;p+=3)i[p+1]<0&&(i.splice(p,3),p-=3);for(let p=0,h=0;p<u.children.length;p+=3){let f=u.children[p];for(;h<i.length&&i[h]<f;)h+=3;i.splice(h,0,u.children[p],u.children[p+1],u.children[p+2])}}return new rt(e.sort(Rr),i)}function Kp(n,e){if(!e||!n.length)return n;let t=[];for(let r=0;r<n.length;r++){let s=n[r];t.push(new Ct(s.from+e,s.to+e,s.type))}return t}function Mx(n,e,t,r,s,l,a){function i(c,d){for(let u=0;u<c.local.length;u++){let p=c.local[u].map(r,s,d);p?t.push(p):a.onRemove&&a.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)i(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<n.length;c+=3)n[c+1]==-1&&i(n[c+2],e[c]+l+1);return t}function qp(n,e,t){if(e.isLeaf)return null;let r=t+e.nodeSize,s=null;for(let l=0,a;l<n.length;l++)(a=n[l])&&a.from>t&&a.to<r&&((s||(s=[])).push(a),n[l]=null);return s}function Gp(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function rl(n,e,t,r){let s=[],l=!1;e.forEach((i,c)=>{let d=qp(n,i,c+t);if(d){l=!0;let u=rl(d,i,t+c+1,r);u!=$t&&s.push(c,c+i.nodeSize,u)}});let a=Kp(l?Gp(n):n,-t).sort(Rr);for(let i=0;i<a.length;i++)a[i].type.valid(e,a[i])||(r.onRemove&&r.onRemove(a[i].spec),a.splice(i--,1));return a.length||s.length?new rt(a,s):$t}function Rr(n,e){return n.from-e.from||n.to-e.to}function Ai(n){let e=n;for(let t=0;t<e.length-1;t++){let r=e[t];if(r.from!=r.to)for(let s=t+1;s<e.length;s++){let l=e[s];if(l.from==r.from){l.to!=r.to&&(e==n&&(e=n.slice()),e[s]=l.copy(l.from,r.to),Yp(e,s+1,l.copy(r.to,l.to)));continue}else{l.from<r.to&&(e==n&&(e=n.slice()),e[t]=r.copy(r.from,l.from),Yp(e,s,r.copy(l.from,r.to)));break}}}return e}function Yp(n,e,t){for(;e<n.length&&Rr(t,n[e])>0;)e++;n.splice(e,0,t)}function Ti(n){let e=[];return n.someProp("decorations",t=>{let r=t(n.state);r&&r!=$t&&e.push(r)}),n.cursorWrapper&&e.push(rt.create(n.state.doc,[n.cursorWrapper.deco])),pr.from(e)}const Bx={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Ax=qt&&lr<=11;class Tx{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class Lx{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Tx,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let s=0;s<r.length;s++)this.queue.push(r[s]);qt&&lr<=11&&r.some(s=>s.type=="childList"&&s.removedNodes.length||s.type=="characterData"&&s.oldValue.length>s.target.nodeValue.length)?this.flushSoon():this.flush()}),Ax&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,Bx)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Ep(this.view)){if(this.suppressingSelectionUpdates)return Kn(this.view);if(qt&&lr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Lr(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,r;for(let l=e.focusNode;l;l=lo(l))t.add(l);for(let l=e.anchorNode;l;l=lo(l))if(t.has(l)){r=l;break}let s=r&&this.view.docView.nearestDesc(r);if(s&&s.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let r=e.domSelectionRange(),s=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&Ep(e)&&!this.ignoreSelectionChange(r),l=-1,a=-1,i=!1,c=[];if(e.editable)for(let u=0;u<t.length;u++){let p=this.registerMutation(t[u],c);p&&(l=l<0?p.from:Math.min(p.from,l),a=a<0?p.to:Math.max(p.to,a),p.typeOver&&(i=!0))}if(cn&&c.length){let u=c.filter(p=>p.nodeName=="BR");if(u.length==2){let[p,h]=u;p.parentNode&&p.parentNode.parentNode==h.parentNode?h.remove():p.remove()}else{let{focusNode:p}=this.currentSelection;for(let h of u){let f=h.parentNode;f&&f.nodeName=="LI"&&(!p||Ix(e,p)!=f)&&h.remove()}}}let d=null;l<0&&s&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Js(r)&&(d=bi(e))&&d.eq(_e.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Kn(e),this.currentSelection.set(r),e.scrollToSelection()):(l>-1||s)&&(l>-1&&(e.docView.markDirty(l,a),Dx(e)),this.handleDOMChange(l,a,i,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||Kn(e),this.currentSelection.set(r))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let p=e.addedNodes[u];t.push(p),p.nodeType==3&&(this.lastChangedTextNode=p)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let s=e.previousSibling,l=e.nextSibling;if(qt&&lr<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:p,nextSibling:h}=e.addedNodes[u];(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(s=p),(!h||Array.prototype.indexOf.call(e.addedNodes,h)<0)&&(l=h)}let a=s&&s.parentNode==e.target?Vt(s)+1:0,i=r.localPosFromDOM(e.target,a,-1),c=l&&l.parentNode==e.target?Vt(l):e.target.childNodes.length,d=r.localPosFromDOM(e.target,c,1);return{from:i,to:d}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Jp=new WeakMap,Zp=!1;function Dx(n){if(!Jp.has(n)&&(Jp.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=cn,Zp)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),Zp=!0}}function Xp(n,e){let t=e.startContainer,r=e.startOffset,s=e.endContainer,l=e.endOffset,a=n.domAtPos(n.state.selection.anchor);return Lr(a.node,a.offset,s,l)&&([t,r,s,l]=[s,l,t,r]),{anchorNode:t,anchorOffset:r,focusNode:s,focusOffset:l}}function Ox(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return Xp(n,s)}let t;function r(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",r,!0),t?Xp(n,t):null}function Ix(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let r=n.docView.nearestDesc(t,!0);if(r&&r.node.isBlock)return t}return null}function Fx(n,e,t){let{node:r,fromOffset:s,toOffset:l,from:a,to:i}=n.docView.parseRange(e,t),c=n.domSelectionRange(),d,u=c.anchorNode;if(u&&n.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],Js(c)||d.push({node:c.focusNode,offset:c.focusOffset})),Ft&&n.input.lastKeyCode===8)for(let y=l;y>s;y--){let b=r.childNodes[y-1],k=b.pmViewDesc;if(b.nodeName=="BR"&&!k){l=y;break}if(!k||k.size)break}let p=n.state.doc,h=n.someProp("domParser")||eo.fromSchema(n.state.schema),f=p.resolve(a),m=null,g=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:s,to:l,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:$x,context:f});if(d&&d[0].pos!=null){let y=d[0].pos,b=d[1]&&d[1].pos;b==null&&(b=y),m={anchor:y+a,head:b+a}}return{doc:g,sel:m,from:a,to:i}}function $x(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(zt&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||zt&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const Rx=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Px(n,e,t,r,s){let l=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let E=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,S=bi(n,E);if(S&&!n.state.selection.eq(S)){if(Ft&&Un&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",A=>A(n,Dr(13,"Enter"))))return;let I=n.state.tr.setSelection(S);E=="pointer"?I.setMeta("pointer",!0):E=="key"&&I.scrollIntoView(),l&&I.setMeta("composition",l),n.dispatch(I)}return}let a=n.state.doc.resolve(e),i=a.sharedDepth(t);e=a.before(i+1),t=n.state.doc.resolve(t).after(i+1);let c=n.state.selection,d=Fx(n,e,t),u=n.state.doc,p=u.slice(d.from,d.to),h,f;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(h=n.state.selection.to,f="end"):(h=n.state.selection.from,f="start"),n.input.lastKeyCode=null;let m=Hx(p.content,d.doc.content,d.from,h,f);if(m&&n.input.domChangeCount++,(ao&&n.input.lastIOSEnter>Date.now()-225||Un)&&s.some(E=>E.nodeType==1&&!Rx.test(E.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",E=>E(n,Dr(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(r&&c instanceof xe&&!c.empty&&c.$head.sameParent(c.$anchor)&&!n.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let E=Qp(n,n.state.doc,d.sel);if(E&&!E.eq(n.state.selection)){let S=n.state.tr.setSelection(E);l&&S.setMeta("composition",l),n.dispatch(S)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof xe&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=d.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=d.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),qt&&lr<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)==" "&&(m.start--,m.endA--,m.endB--);let g=d.doc.resolveNoCache(m.start-d.from),y=d.doc.resolveNoCache(m.endB-d.from),b=u.resolve(m.start),k=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((ao&&n.input.lastIOSEnter>Date.now()-225&&(!k||s.some(E=>E.nodeName=="DIV"||E.nodeName=="P"))||!k&&g.pos<d.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(d.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",E=>E(n,Dr(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&jx(u,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",E=>E(n,Dr(8,"Backspace")))){Un&&Ft&&n.domObserver.suppressSelectionUpdates();return}Ft&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),Un&&!k&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,y=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{n.someProp("handleKeyDown",function(E){return E(n,Dr(13,"Enter"))})},20));let x=m.start,w=m.endA,v=E=>{let S=E||n.state.tr.replace(x,w,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let I=Qp(n,S.doc,d.sel);I&&!(Ft&&n.composing&&I.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(I.head==x||I.head==S.mapping.map(w)-1)||qt&&I.empty&&I.head==x)&&S.setSelection(I)}return l&&S.setMeta("composition",l),S.scrollIntoView()},_;if(k){if(g.pos==y.pos){qt&&lr<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Kn(n),20));let E=v(n.state.tr.delete(x,w)),S=u.resolve(m.start).marksAcross(u.resolve(m.endA));S&&E.ensureMarks(S),n.dispatch(E)}else if(m.endA==m.endB&&(_=zx(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let E=v(n.state.tr);_.type=="add"?E.addMark(x,w,_.mark):E.removeMark(x,w,_.mark),n.dispatch(E)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let E=g.parent.textBetween(g.parentOffset,y.parentOffset),S=()=>v(n.state.tr.insertText(E,x,w));n.someProp("handleTextInput",I=>I(n,x,w,E,S))||n.dispatch(S())}}else n.dispatch(v())}function Qp(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:wi(n,e.resolve(t.anchor),e.resolve(t.head))}function zx(n,e){let t=n.firstChild.marks,r=e.firstChild.marks,s=t,l=r,a,i,c;for(let u=0;u<r.length;u++)s=r[u].removeFromSet(s);for(let u=0;u<t.length;u++)l=t[u].removeFromSet(l);if(s.length==1&&l.length==0)i=s[0],a="add",c=u=>u.mark(i.addToSet(u.marks));else if(s.length==0&&l.length==1)i=l[0],a="remove",c=u=>u.mark(i.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(ne.from(d).eq(n))return{mark:i,type:a}}function jx(n,e,t,r,s){if(t-e<=s.pos-r.pos||Li(r,!0,!1)<s.pos)return!1;let l=n.resolve(e);if(!r.parent.isTextblock){let i=l.nodeAfter;return i!=null&&t==e+i.nodeSize}if(l.parentOffset<l.parent.content.size||!l.parent.isTextblock)return!1;let a=n.resolve(Li(l,!0,!0));return!a.parent.isTextblock||a.pos>t||Li(a,!0,!1)<t?!1:r.parent.content.cut(r.parentOffset).eq(a.parent.content)}function Li(n,e,t){let r=n.depth,s=e?n.end():n.pos;for(;r>0&&(e||n.indexAfter(r)==n.node(r).childCount);)r--,s++,e=!1;if(t){let l=n.node(r).maybeChild(n.indexAfter(r));for(;l&&!l.isLeaf;)l=l.firstChild,s++}return s}function Hx(n,e,t,r,s){let l=n.findDiffStart(e,t);if(l==null)return null;let{a,b:i}=n.findDiffEnd(e,t+n.size,t+e.size);if(s=="end"){let c=Math.max(0,l-Math.min(a,i));r-=a+c-l}if(a<l&&n.size<e.size){let c=r<=l&&r>=a?l-r:0;l-=c,l&&l<e.size&&eh(e.textBetween(l-1,l+1))&&(l+=c?1:-1),i=l+(i-a),a=l}else if(i<l){let c=r<=l&&r>=i?l-r:0;l-=c,l&&l<n.size&&eh(n.textBetween(l-1,l+1))&&(l+=c?1:-1),a=l+(a-i),i=l}return{start:l,endA:a,endB:i}}function eh(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class th{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new ix,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(lh),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=oh(this),rh(this),this.nodeViews=sh(this),this.docView=up(this.state.doc,nh(this),Ti(this),this.dom,this),this.domObserver=new Lx(this,(r,s,l,a)=>Px(this,r,s,l,a)),this.domObserver.start(),cx(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Si(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(lh),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let r in this._props)t[r]=this._props[r];t.state=this.state;for(let r in e)t[r]=e[r];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var r;let s=this.state,l=!1,a=!1;e.storedMarks&&this.composing&&(jp(this),a=!0),this.state=e;let i=s.plugins!=e.plugins||this._props.plugins!=t.plugins;if(i||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let f=sh(this);Wx(f,this.nodeViews)&&(this.nodeViews=f,l=!0)}(i||t.handleDOMEvents!=this._props.handleDOMEvents)&&Si(this),this.editable=oh(this),rh(this);let c=Ti(this),d=nh(this),u=s.plugins!=e.plugins&&!s.doc.eq(e.doc)?"reset":e.scrollToSelection>s.scrollToSelection?"to selection":"preserve",p=l||!this.docView.matchesNode(e.doc,d,c);(p||!e.selection.eq(s.selection))&&(a=!0);let h=u=="preserve"&&a&&this.dom.style.overflowAnchor==null&&Ew(this);if(a){this.domObserver.stop();let f=p&&(qt||Ft)&&!this.composing&&!s.selection.empty&&!e.selection.empty&&Ux(s.selection,e.selection);if(p){let m=Ft?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=vx(this)),(l||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=up(e.doc,d,c,this.dom,this)),m&&!this.trackWrites&&(f=!0)}f||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&qw(this))?Kn(this,f):(xp(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(s),!((r=this.dragging)===null||r===void 0)&&r.node&&!s.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,s),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():h&&Cw(h)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))&&!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof we){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Xu(this,t.getBoundingClientRect(),e)}else Xu(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let r=this.directPlugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let r=this.state.plugins[t];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let r=this.pluginViews[t];r.update&&r.update(this,e)}}updateDraggedNode(e,t){let r=e.node,s=-1;if(this.state.doc.nodeAt(r.from)==r.node)s=r.from;else{let l=r.from+(this.state.doc.content.size-t.doc.content.size);(l>0&&this.state.doc.nodeAt(l))==r.node&&(s=l)}this.dragging=new Up(e.slice,e.move,s<0?void 0:we.create(this.state.doc,s))}someProp(e,t){let r=this._props&&this._props[e],s;if(r!=null&&(s=t?t(r):r))return s;for(let a=0;a<this.directPlugins.length;a++){let i=this.directPlugins[a].props[e];if(i!=null&&(s=t?t(i):i))return s}let l=this.state.plugins;if(l)for(let a=0;a<l.length;a++){let i=l[a].props[e];if(i!=null&&(s=t?t(i):i))return s}}hasFocus(){if(qt){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&_w(this.dom),Kn(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Bw(this,e)}coordsAtPos(e,t=1){return op(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,r=-1){let s=this.docView.posFromDOM(e,t,r);if(s==null)throw new RangeError("DOM position not inside the editor");return s}endOfTextblock(e,t){return Ow(this,t||this.state,e)}pasteHTML(e,t){return Ho(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return Ho(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return Ei(this,e)}destroy(){this.docView&&(dx(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Ti(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,pw())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return px(this,e)}domSelectionRange(){let e=this.domSelection();return e?zt&&this.root.nodeType===11&&yw(this.dom.ownerDocument)==this.dom&&Ox(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}th.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function nh(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let r in t)r=="class"?e.class+=" "+t[r]:r=="style"?e.style=(e.style?e.style+";":"")+t[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(t[r]))}),e.translate||(e.translate="no"),[Ct.node(0,n.state.doc.content.size,e)]}function rh(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Ct.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function oh(n){return!n.someProp("editable",e=>e(n.state)===!1)}function Ux(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function sh(n){let e=Object.create(null);function t(r){for(let s in r)Object.prototype.hasOwnProperty.call(e,s)||(e[s]=r[s])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function Wx(n,e){let t=0,r=0;for(let s in n){if(n[s]!=e[s])return!0;t++}for(let s in e)r++;return t!=r}function lh(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var hr={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ol={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Kx=typeof navigator<"u"&&/Mac/.test(navigator.platform),qx=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Mt=0;Mt<10;Mt++)hr[48+Mt]=hr[96+Mt]=String(Mt);for(var Mt=1;Mt<=24;Mt++)hr[Mt+111]="F"+Mt;for(var Mt=65;Mt<=90;Mt++)hr[Mt]=String.fromCharCode(Mt+32),ol[Mt]=String.fromCharCode(Mt);for(var Di in hr)ol.hasOwnProperty(Di)||(ol[Di]=hr[Di]);function Gx(n){var e=Kx&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||qx&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?ol:hr)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Yx=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Jx=typeof navigator<"u"&&/Win/.test(navigator.platform);function Zx(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let r,s,l,a;for(let i=0;i<e.length-1;i++){let c=e[i];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))l=!0;else if(/^mod$/i.test(c))Yx?a=!0:s=!0;else throw new Error("Unrecognized modifier name: "+c)}return r&&(t="Alt-"+t),s&&(t="Ctrl-"+t),a&&(t="Meta-"+t),l&&(t="Shift-"+t),t}function Xx(n){let e=Object.create(null);for(let t in n)e[Zx(t)]=n[t];return e}function Oi(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function Qx(n){return new ct({props:{handleKeyDown:Ii(n)}})}function Ii(n){let e=Xx(n);return function(t,r){let s=Gx(r),l,a=e[Oi(s,r)];if(a&&a(t.state,t.dispatch,t))return!0;if(s.length==1&&s!=" "){if(r.shiftKey){let i=e[Oi(s,r,!1)];if(i&&i(t.state,t.dispatch,t))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Jx&&r.ctrlKey&&r.altKey)&&(l=hr[r.keyCode])&&l!=s){let i=e[Oi(l,r)];if(i&&i(t.state,t.dispatch,t))return!0}}return!1}}const Fi=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function ah(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const ih=(n,e,t)=>{let r=ah(n,t);if(!r)return!1;let s=$i(r);if(!s){let a=r.blockRange(),i=a&&to(a);return i==null?!1:(e&&e(n.tr.lift(a,i).scrollIntoView()),!0)}let l=s.nodeBefore;if(yh(n,s,e,-1))return!0;if(r.parent.content.size==0&&(ho(l,"end")||we.isSelectable(l)))for(let a=r.depth;;a--){let i=qs(n.doc,r.before(a),r.after(a),de.empty);if(i&&i.slice.size<i.to-i.from){if(e){let c=n.tr.step(i);c.setSelection(ho(l,"end")?_e.findFrom(c.doc.resolve(c.mapping.map(s.pos,-1)),-1):we.create(c.doc,s.pos-l.nodeSize)),e(c.scrollIntoView())}return!0}if(a==1||r.node(a-1).childCount>1)break}return l.isAtom&&s.depth==r.depth-1?(e&&e(n.tr.delete(s.pos-l.nodeSize,s.pos).scrollIntoView()),!0):!1},e2=(n,e,t)=>{let r=ah(n,t);if(!r)return!1;let s=$i(r);return s?ch(n,s,e):!1},t2=(n,e,t)=>{let r=uh(n,t);if(!r)return!1;let s=Ri(r);return s?ch(n,s,e):!1};function ch(n,e,t){let r=e.nodeBefore,s=r,l=e.pos-1;for(;!s.isTextblock;l--){if(s.type.spec.isolating)return!1;let u=s.lastChild;if(!u)return!1;s=u}let a=e.nodeAfter,i=a,c=e.pos+1;for(;!i.isTextblock;c++){if(i.type.spec.isolating)return!1;let u=i.firstChild;if(!u)return!1;i=u}let d=qs(n.doc,l,c,de.empty);if(!d||d.from!=l||d instanceof vt&&d.slice.size>=c-l)return!1;if(t){let u=n.tr.step(d);u.setSelection(xe.create(u.doc,l)),t(u.scrollIntoView())}return!0}function ho(n,e,t=!1){for(let r=n;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(t&&r.childCount!=1)return!1}return!1}const dh=(n,e,t)=>{let{$head:r,empty:s}=n.selection,l=r;if(!s)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):r.parentOffset>0)return!1;l=$i(r)}let a=l&&l.nodeBefore;return!a||!we.isSelectable(a)?!1:(e&&e(n.tr.setSelection(we.create(n.doc,l.pos-a.nodeSize)).scrollIntoView()),!0)};function $i(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function uh(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const ph=(n,e,t)=>{let r=uh(n,t);if(!r)return!1;let s=Ri(r);if(!s)return!1;let l=s.nodeAfter;if(yh(n,s,e,1))return!0;if(r.parent.content.size==0&&(ho(l,"start")||we.isSelectable(l))){let a=qs(n.doc,r.before(),r.after(),de.empty);if(a&&a.slice.size<a.to-a.from){if(e){let i=n.tr.step(a);i.setSelection(ho(l,"start")?_e.findFrom(i.doc.resolve(i.mapping.map(s.pos)),1):we.create(i.doc,i.mapping.map(s.pos))),e(i.scrollIntoView())}return!0}}return l.isAtom&&s.depth==r.depth-1?(e&&e(n.tr.delete(s.pos,s.pos+l.nodeSize).scrollIntoView()),!0):!1},hh=(n,e,t)=>{let{$head:r,empty:s}=n.selection,l=r;if(!s)return!1;if(r.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;l=Ri(r)}let a=l&&l.nodeAfter;return!a||!we.isSelectable(a)?!1:(e&&e(n.tr.setSelection(we.create(n.doc,l.pos)).scrollIntoView()),!0)};function Ri(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const n2=(n,e)=>{let t=n.selection,r=t instanceof we,s;if(r){if(t.node.isTextblock||!or(n.doc,t.from))return!1;s=t.from}else if(s=Ks(n.doc,t.from,-1),s==null)return!1;if(e){let l=n.tr.join(s);r&&l.setSelection(we.create(l.doc,s-n.doc.resolve(s).nodeBefore.nodeSize)),e(l.scrollIntoView())}return!0},r2=(n,e)=>{let t=n.selection,r;if(t instanceof we){if(t.node.isTextblock||!or(n.doc,t.to))return!1;r=t.to}else if(r=Ks(n.doc,t.to,1),r==null)return!1;return e&&e(n.tr.join(r).scrollIntoView()),!0},o2=(n,e)=>{let{$from:t,$to:r}=n.selection,s=t.blockRange(r),l=s&&to(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)},fh=(n,e)=>{let{$head:t,$anchor:r}=n.selection;return!t.parent.type.spec.code||!t.sameParent(r)?!1:(e&&e(n.tr.insertText(`
|
|
10
|
+
`).scrollIntoView()),!0)};function Pi(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const s2=(n,e)=>{let{$head:t,$anchor:r}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(r))return!1;let s=t.node(-1),l=t.indexAfter(-1),a=Pi(s.contentMatchAt(l));if(!a||!s.canReplaceWith(l,l,a))return!1;if(e){let i=t.after(),c=n.tr.replaceWith(i,i,a.createAndFill());c.setSelection(_e.near(c.doc.resolve(i),1)),e(c.scrollIntoView())}return!0},mh=(n,e)=>{let t=n.selection,{$from:r,$to:s}=t;if(t instanceof en||r.parent.inlineContent||s.parent.inlineContent)return!1;let l=Pi(s.parent.contentMatchAt(s.indexAfter()));if(!l||!l.isTextblock)return!1;if(e){let a=(!r.parentOffset&&s.index()<s.parent.childCount?r:s).pos,i=n.tr.insert(a,l.createAndFill());i.setSelection(xe.create(i.doc,a+1)),e(i.scrollIntoView())}return!0},gh=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let l=t.before();if(jn(n.doc,l))return e&&e(n.tr.split(l).scrollIntoView()),!0}let r=t.blockRange(),s=r&&to(r);return s==null?!1:(e&&e(n.tr.lift(r,s).scrollIntoView()),!0)};function l2(n){return(e,t)=>{let{$from:r,$to:s}=e.selection;if(e.selection instanceof we&&e.selection.node.isBlock)return!r.parentOffset||!jn(e.doc,r.pos)?!1:(t&&t(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let l=[],a,i,c=!1,d=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){c=r.end(f)==r.pos+(r.depth-f),d=r.start(f)==r.pos-(r.depth-f),i=Pi(r.node(f-1).contentMatchAt(r.indexAfter(f-1))),l.unshift(c&&i?{type:i}:null),a=f;break}else{if(f==1)return!1;l.unshift(null)}let u=e.tr;(e.selection instanceof xe||e.selection instanceof en)&&u.deleteSelection();let p=u.mapping.map(r.pos),h=jn(u.doc,p,l.length,l);if(h||(l[0]=i?{type:i}:null,h=jn(u.doc,p,l.length,l)),!h)return!1;if(u.split(p,l.length,l),!c&&d&&r.node(a).type!=i){let f=u.mapping.map(r.before(a)),m=u.doc.resolve(f);i&&r.node(a-1).canReplaceWith(m.index(),m.index()+1,i)&&u.setNodeMarkup(u.mapping.map(r.before(a)),i)}return t&&t(u.scrollIntoView()),!0}}const a2=l2(),i2=(n,e)=>{let{$from:t,to:r}=n.selection,s,l=t.sharedDepth(r);return l==0?!1:(s=t.before(l),e&&e(n.tr.setSelection(we.create(n.doc,s))),!0)};function c2(n,e,t){let r=e.nodeBefore,s=e.nodeAfter,l=e.index();return!r||!s||!r.type.compatibleContent(s.type)?!1:!r.content.size&&e.parent.canReplace(l-1,l)?(t&&t(n.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(l,l+1)||!(s.isTextblock||or(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function yh(n,e,t,r){let s=e.nodeBefore,l=e.nodeAfter,a,i,c=s.type.spec.isolating||l.type.spec.isolating;if(!c&&c2(n,e,t))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(a=(i=s.contentMatchAt(s.childCount)).findWrapping(l.type))&&i.matchType(a[0]||l.type).validEnd){if(t){let f=e.pos+l.nodeSize,m=ne.empty;for(let b=a.length-1;b>=0;b--)m=ne.from(a[b].create(null,m));m=ne.from(s.copy(m));let g=n.tr.step(new Et(e.pos-1,f,e.pos,f,new de(m,1,0),a.length,!0)),y=g.doc.resolve(f+2*a.length);y.nodeAfter&&y.nodeAfter.type==s.type&&or(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let u=l.type.spec.isolating||r>0&&c?null:_e.findFrom(e,1),p=u&&u.$from.blockRange(u.$to),h=p&&to(p);if(h!=null&&h>=e.depth)return t&&t(n.tr.lift(p,h).scrollIntoView()),!0;if(d&&ho(l,"start",!0)&&ho(s,"end")){let f=s,m=[];for(;m.push(f),!f.isTextblock;)f=f.lastChild;let g=l,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(f.canReplace(f.childCount,f.childCount,g.content)){if(t){let b=ne.empty;for(let x=m.length-1;x>=0;x--)b=ne.from(m[x].copy(b));let k=n.tr.step(new Et(e.pos-m.length,e.pos+l.nodeSize,e.pos+y,e.pos+l.nodeSize-y,new de(b,m.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function bh(n){return function(e,t){let r=e.selection,s=n<0?r.$from:r.$to,l=s.depth;for(;s.node(l).isInline;){if(!l)return!1;l--}return s.node(l).isTextblock?(t&&t(e.tr.setSelection(xe.create(e.doc,n<0?s.start(l):s.end(l)))),!0):!1}}const d2=bh(-1),u2=bh(1);function p2(n,e=null){return function(t,r){let{$from:s,$to:l}=t.selection,a=s.blockRange(l),i=a&&ni(a,n,e);return i?(r&&r(t.tr.wrap(a,i).scrollIntoView()),!0):!1}}function kh(n,e=null){return function(t,r){let s=!1;for(let l=0;l<t.selection.ranges.length&&!s;l++){let{$from:{pos:a},$to:{pos:i}}=t.selection.ranges[l];t.doc.nodesBetween(a,i,(c,d)=>{if(s)return!1;if(!(!c.isTextblock||c.hasMarkup(n,e)))if(c.type==n)s=!0;else{let u=t.doc.resolve(d),p=u.index();s=u.parent.canReplaceWith(p,p+1,n)}})}if(!s)return!1;if(r){let l=t.tr;for(let a=0;a<t.selection.ranges.length;a++){let{$from:{pos:i},$to:{pos:c}}=t.selection.ranges[a];l.setBlockType(i,c,n,e)}r(l.scrollIntoView())}return!0}}function zi(...n){return function(e,t,r){for(let s=0;s<n.length;s++)if(n[s](e,t,r))return!0;return!1}}zi(Fi,ih,dh),zi(Fi,ph,hh),zi(fh,mh,gh,a2),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function h2(n,e=null){return function(t,r){let{$from:s,$to:l}=t.selection,a=s.blockRange(l);if(!a)return!1;let i=r?t.tr:null;return f2(i,a,n,e)?(r&&r(i.scrollIntoView()),!0):!1}}function f2(n,e,t,r=null){let s=!1,l=e,a=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=a.resolve(e.start-2);l=new Ps(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new Ps(e.$from,a.resolve(e.$to.end(e.depth)),e.depth)),s=!0}let i=ni(l,t,r,e);return i?(n&&m2(n,e,i,s,t),!0):!1}function m2(n,e,t,r,s){let l=ne.empty;for(let u=t.length-1;u>=0;u--)l=ne.from(t[u].type.create(t[u].attrs,l));n.step(new Et(e.start-(r?2:0),e.end,e.start,e.end,new de(l,0,0),t.length,!0));let a=0;for(let u=0;u<t.length;u++)t[u].type==s&&(a=u+1);let i=t.length-a,c=e.start+t.length-(r?2:0),d=e.parent;for(let u=e.startIndex,p=e.endIndex,h=!0;u<p;u++,h=!1)!h&&jn(n.doc,c,i)&&(n.split(c,i),c+=2*i),c+=d.child(u).nodeSize;return n}function g2(n){return function(e,t){let{$from:r,$to:s}=e.selection,l=r.blockRange(s,a=>a.childCount>0&&a.firstChild.type==n);return l?t?r.node(l.depth-1).type==n?y2(e,t,n,l):b2(e,t,l):!0:!1}}function y2(n,e,t,r){let s=n.tr,l=r.end,a=r.$to.end(r.depth);l<a&&(s.step(new Et(l-1,a,l,a,new de(ne.from(t.create(null,r.parent.copy())),1,0),1,!0)),r=new Ps(s.doc.resolve(r.$from.pos),s.doc.resolve(a),r.depth));const i=to(r);if(i==null)return!1;s.lift(r,i);let c=s.doc.resolve(s.mapping.map(l,-1)-1);return or(s.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&s.join(c.pos),e(s.scrollIntoView()),!0}function b2(n,e,t){let r=n.tr,s=t.parent;for(let f=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)f-=s.child(m).nodeSize,r.delete(f-1,f+1);let l=r.doc.resolve(t.start),a=l.nodeAfter;if(r.mapping.map(t.end)!=t.start+l.nodeAfter.nodeSize)return!1;let i=t.startIndex==0,c=t.endIndex==s.childCount,d=l.node(-1),u=l.index(-1);if(!d.canReplace(u+(i?0:1),u+1,a.content.append(c?ne.empty:ne.from(s))))return!1;let p=l.pos,h=p+a.nodeSize;return r.step(new Et(p-(i?1:0),h+(c?1:0),p+1,h-1,new de((i?ne.empty:ne.from(s.copy(ne.empty))).append(c?ne.empty:ne.from(s.copy(ne.empty))),i?0:1,c?0:1),i?0:1)),e(r.scrollIntoView()),!0}function k2(n){return function(e,t){let{$from:r,$to:s}=e.selection,l=r.blockRange(s,d=>d.childCount>0&&d.firstChild.type==n);if(!l)return!1;let a=l.startIndex;if(a==0)return!1;let i=l.parent,c=i.child(a-1);if(c.type!=n)return!1;if(t){let d=c.lastChild&&c.lastChild.type==i.type,u=ne.from(d?n.create():null),p=new de(ne.from(n.create(null,ne.from(i.type.create(null,u)))),d?3:1,0),h=l.start,f=l.end;t(e.tr.step(new Et(h-(d?3:1),f,h,f,p,1,!0)).scrollIntoView())}return!0}}var w2=Object.defineProperty,wh=(n,e)=>{for(var t in e)w2(n,t,{get:e[t],enumerable:!0})};function sl(n){const{state:e,transaction:t}=n;let{selection:r}=t,{doc:s}=t,{storedMarks:l}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return l},get selection(){return r},get doc(){return s},get tr(){return r=t.selection,s=t.doc,l=t.storedMarks,t}}}var ll=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:r}=e,{tr:s}=t,l=this.buildProps(s);return Object.fromEntries(Object.entries(n).map(([a,i])=>[a,(...c)=>{const d=i(...c)(l);return!s.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(s),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:r,state:s}=this,{view:l}=r,a=[],i=!!n,c=n||s.tr,d=()=>(!i&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(c),a.every(p=>p===!0)),u={...Object.fromEntries(Object.entries(t).map(([p,h])=>[p,(...f)=>{const m=this.buildProps(c,e),g=h(...f)(m);return a.push(g),u}])),run:d};return u}createCan(n){const{rawCommands:e,state:t}=this,r=!1,s=n||t.tr,l=this.buildProps(s,r);return{...Object.fromEntries(Object.entries(e).map(([a,i])=>[a,(...c)=>i(...c)({...l,dispatch:void 0})])),chain:()=>this.createChain(s,r)}}buildProps(n,e=!0){const{rawCommands:t,editor:r,state:s}=this,{view:l}=r,a={tr:n,editor:r,view:l,state:sl({state:s,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([i,c])=>[i,(...d)=>c(...d)(a)]))}};return a}},x2=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(r=>r.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(r=>r!==e):delete this.callbacks[n]),this}once(n,e){const t=(...r)=>{this.off(n,t),e.apply(this,r)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}};function xh(n,e){const t=new si(n);return e.forEach(r=>{r.steps.forEach(s=>{t.step(s)})}),t}var vh=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const r=e[t];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&vh(r)}return n};function al(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return vh(t)}function Wo(n,e,t){if(n instanceof tr||n instanceof ne)return n;t={slice:!0,parseOptions:{},...t};const r=typeof n=="object"&&n!==null,s=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return ne.fromArray(n.map(a=>e.nodeFromJSON(a)));const l=e.nodeFromJSON(n);return t.errorOnInvalidContent&&l.check(),l}catch(l){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:l});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",l),Wo("",e,t)}if(s){if(t.errorOnInvalidContent){let a=!1,i="";const c=new fu({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:d=>(a=!0,i=typeof d=="string"?d:d.outerHTML,null)}]}})});if(t.slice?eo.fromSchema(c).parseSlice(al(n),t.parseOptions):eo.fromSchema(c).parse(al(n),t.parseOptions),t.errorOnInvalidContent&&a)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}const l=eo.fromSchema(e);return t.slice?l.parseSlice(al(n),t.parseOptions).content:l.parse(al(n),t.parseOptions)}return Wo("",e,t)}function ji(n,e,t={},r={}){return Wo(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:r.errorOnInvalidContent})}function v2(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function E2(n,e,t){const r=[];return n.nodesBetween(e.from,e.to,(s,l)=>{t(s)&&r.push({node:s,pos:l})}),r}function Eh(n,e){for(let t=n.depth;t>0;t-=1){const r=n.node(t);if(e(r))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:r}}}function il(n){return e=>Eh(e.$from,n)}function ke(n,e,t){return n.config[e]===void 0&&n.parent?ke(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?ke(n.parent,e,t):null}):n.config[e]}function Hi(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},r=ke(e,"addExtensions",t);return r?[e,...Hi(r())]:e}).flat(10)}function Ui(n,e){const t=Ar.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function Ch(n){return typeof n=="function"}function Ye(n,e=void 0,...t){return Ch(n)?e?n.bind(e)(...t):n(...t):n}function C2(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Ko(n){const e=n.filter(s=>s.type==="extension"),t=n.filter(s=>s.type==="node"),r=n.filter(s=>s.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:r}}function _h(n){const e=[],{nodeExtensions:t,markExtensions:r}=Ko(n),s=[...t,...r],l={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(a=>{const i={name:a.name,options:a.options,storage:a.storage,extensions:s},c=ke(a,"addGlobalAttributes",i);c&&c().forEach(d=>{d.types.forEach(u=>{Object.entries(d.attributes).forEach(([p,h])=>{e.push({type:u,name:p,attribute:{...l,...h}})})})})}),s.forEach(a=>{const i={name:a.name,options:a.options,storage:a.storage},c=ke(a,"addAttributes",i);if(!c)return;const d=c();Object.entries(d).forEach(([u,p])=>{const h={...l,...p};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,e.push({type:a.name,name:u,attribute:h})})}),e}function Ze(...n){return n.filter(e=>!!e).reduce((e,t)=>{const r={...e};return Object.entries(t).forEach(([s,l])=>{if(!r[s]){r[s]=l;return}if(s==="class"){const a=l?String(l).split(" "):[],i=r[s]?r[s].split(" "):[],c=a.filter(d=>!i.includes(d));r[s]=[...i,...c].join(" ")}else if(s==="style"){const a=l?l.split(";").map(d=>d.trim()).filter(Boolean):[],i=r[s]?r[s].split(";").map(d=>d.trim()).filter(Boolean):[],c=new Map;i.forEach(d=>{const[u,p]=d.split(":").map(h=>h.trim());c.set(u,p)}),a.forEach(d=>{const[u,p]=d.split(":").map(h=>h.trim());c.set(u,p)}),r[s]=Array.from(c.entries()).map(([d,u])=>`${d}: ${u}`).join("; ")}else r[s]=l}),r},{})}function cl(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,r)=>Ze(t,r),{})}function _2(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function Sh(n,e){return"style"in n?n:{...n,getAttrs:t=>{const r=n.getAttrs?n.getAttrs(t):n.attrs;if(r===!1)return!1;const s=e.reduce((l,a)=>{const i=a.attribute.parseHTML?a.attribute.parseHTML(t):_2(t.getAttribute(a.name));return i==null?l:{...l,[a.name]:i}},{});return{...r,...s}}}}function Nh(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&C2(t)?!1:t!=null))}function S2(n,e){var t;const r=_h(n),{nodeExtensions:s,markExtensions:l}=Ko(n),a=(t=s.find(d=>ke(d,"topNode")))==null?void 0:t.name,i=Object.fromEntries(s.map(d=>{const u=r.filter(b=>b.type===d.name),p={name:d.name,options:d.options,storage:d.storage,editor:e},h=n.reduce((b,k)=>{const x=ke(k,"extendNodeSchema",p);return{...b,...x?x(d):{}}},{}),f=Nh({...h,content:Ye(ke(d,"content",p)),marks:Ye(ke(d,"marks",p)),group:Ye(ke(d,"group",p)),inline:Ye(ke(d,"inline",p)),atom:Ye(ke(d,"atom",p)),selectable:Ye(ke(d,"selectable",p)),draggable:Ye(ke(d,"draggable",p)),code:Ye(ke(d,"code",p)),whitespace:Ye(ke(d,"whitespace",p)),linebreakReplacement:Ye(ke(d,"linebreakReplacement",p)),defining:Ye(ke(d,"defining",p)),isolating:Ye(ke(d,"isolating",p)),attrs:Object.fromEntries(u.map(b=>{var k,x;return[b.name,{default:(k=b?.attribute)==null?void 0:k.default,validate:(x=b?.attribute)==null?void 0:x.validate}]}))}),m=Ye(ke(d,"parseHTML",p));m&&(f.parseDOM=m.map(b=>Sh(b,u)));const g=ke(d,"renderHTML",p);g&&(f.toDOM=b=>g({node:b,HTMLAttributes:cl(b,u)}));const y=ke(d,"renderText",p);return y&&(f.toText=y),[d.name,f]})),c=Object.fromEntries(l.map(d=>{const u=r.filter(y=>y.type===d.name),p={name:d.name,options:d.options,storage:d.storage,editor:e},h=n.reduce((y,b)=>{const k=ke(b,"extendMarkSchema",p);return{...y,...k?k(d):{}}},{}),f=Nh({...h,inclusive:Ye(ke(d,"inclusive",p)),excludes:Ye(ke(d,"excludes",p)),group:Ye(ke(d,"group",p)),spanning:Ye(ke(d,"spanning",p)),code:Ye(ke(d,"code",p)),attrs:Object.fromEntries(u.map(y=>{var b,k;return[y.name,{default:(b=y?.attribute)==null?void 0:b.default,validate:(k=y?.attribute)==null?void 0:k.validate}]}))}),m=Ye(ke(d,"parseHTML",p));m&&(f.parseDOM=m.map(y=>Sh(y,u)));const g=ke(d,"renderHTML",p);return g&&(f.toDOM=y=>g({mark:y,HTMLAttributes:cl(y,u)})),[d.name,f]}));return new fu({topNode:a,nodes:i,marks:c})}function N2(n){const e=n.filter((t,r)=>n.indexOf(t)!==r);return Array.from(new Set(e))}function Wi(n){return n.sort((e,t)=>{const r=ke(e,"priority")||100,s=ke(t,"priority")||100;return r>s?-1:r<s?1:0})}function Vh(n){const e=Wi(Hi(n)),t=N2(e.map(r=>r.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function Mh(n,e,t){const{from:r,to:s}=e,{blockSeparator:l=`
|
|
11
|
+
|
|
12
|
+
`,textSerializers:a={}}=t||{};let i="";return n.nodesBetween(r,s,(c,d,u,p)=>{var h;c.isBlock&&d>r&&(i+=l);const f=a?.[c.type.name];if(f)return u&&(i+=f({node:c,pos:d,parent:u,index:p,range:e})),!1;c.isText&&(i+=(h=c?.text)==null?void 0:h.slice(Math.max(r,d)-d,s-d))}),i}function V2(n,e){const t={from:0,to:n.content.size};return Mh(n,t,e)}function Bh(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function qn(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}function Ah(n,e){const t=qn(e,n.schema),{from:r,to:s,empty:l}=n.selection,a=[];l?(n.storedMarks&&a.push(...n.storedMarks),a.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,s,c=>{a.push(...c.marks)});const i=a.find(c=>c.type.name===t.name);return i?{...i.attrs}:{}}function bt(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}function M2(n,e){const t=bt(e,n.schema),{from:r,to:s}=n.selection,l=[];n.doc.nodesBetween(r,s,i=>{l.push(i)});const a=l.reverse().find(i=>i.type.name===t.name);return a?{...a.attrs}:{}}function dl(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function Th(n,e){const t=dl(typeof e=="string"?e:e.name,n.schema);return t==="node"?M2(n,e):t==="mark"?Ah(n,e):{}}function B2(n,e=JSON.stringify){const t={};return n.filter(r=>{const s=e(r);return Object.prototype.hasOwnProperty.call(t,s)?!1:t[s]=!0})}function A2(n){const e=B2(n);return e.length===1?e:e.filter((t,r)=>!e.filter((s,l)=>l!==r).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function Lh(n){const{mapping:e,steps:t}=n,r=[];return e.maps.forEach((s,l)=>{const a=[];if(s.ranges.length)s.forEach((i,c)=>{a.push({from:i,to:c})});else{const{from:i,to:c}=t[l];if(i===void 0||c===void 0)return;a.push({from:i,to:c})}a.forEach(({from:i,to:c})=>{const d=e.slice(l).map(i,-1),u=e.slice(l).map(c),p=e.invert().map(d,-1),h=e.invert().map(u);r.push({oldRange:{from:p,to:h},newRange:{from:d,to:u}})})}),A2(r)}function Ki(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function ul(n,e,t={strict:!0}){const r=Object.keys(e);return r.length?r.every(s=>t.strict?e[s]===n[s]:Ki(e[s])?e[s].test(n[s]):e[s]===n[s]):!0}function Dh(n,e,t={}){return n.find(r=>r.type===e&&ul(Object.fromEntries(Object.keys(t).map(s=>[s,r.attrs[s]])),t))}function Oh(n,e,t={}){return!!Dh(n,e,t)}function qi(n,e,t){var r;if(!n||!e)return;let s=n.parent.childAfter(n.parentOffset);if((!s.node||!s.node.marks.some(d=>d.type===e))&&(s=n.parent.childBefore(n.parentOffset)),!s.node||!s.node.marks.some(d=>d.type===e)||(t=t||((r=s.node.marks[0])==null?void 0:r.attrs),!Dh([...s.node.marks],e,t)))return;let l=s.index,a=n.start()+s.offset,i=l+1,c=a+s.node.nodeSize;for(;l>0&&Oh([...n.parent.child(l-1).marks],e,t);)l-=1,a-=n.parent.child(l).nodeSize;for(;i<n.parent.childCount&&Oh([...n.parent.child(i).marks],e,t);)c+=n.parent.child(i).nodeSize,i+=1;return{from:a,to:c}}function Gi(n,e,t){const r=[];return n===e?t.resolve(n).marks().forEach(s=>{const l=t.resolve(n),a=qi(l,s.type);a&&r.push({mark:s,...a})}):t.nodesBetween(n,e,(s,l)=>{!s||s?.nodeSize===void 0||r.push(...s.marks.map(a=>({from:l,to:l+s.nodeSize,mark:a})))}),r}var T2=(n,e,t,r=20)=>{const s=n.doc.resolve(t);let l=r,a=null;for(;l>0&&a===null;){const i=s.node(l);i?.type.name===e?a=i:l-=1}return[a,l]};function Yi(n,e){return e.nodes[n]||e.marks[n]||null}function pl(n,e,t){return Object.fromEntries(Object.entries(t).filter(([r])=>{const s=n.find(l=>l.type===e&&l.name===r);return s?s.attribute.keepOnSplit:!1}))}var L2=(n,e=500)=>{let t="";const r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-e),r,(s,l,a,i)=>{var c,d;const u=((d=(c=s.type.spec).toText)==null?void 0:d.call(c,{node:s,pos:l,parent:a,index:i}))||s.textContent||"%leaf%";t+=s.isAtom&&!s.isText?u:u.slice(0,Math.max(0,r-l))}),t};function Ji(n,e,t={}){const{empty:r,ranges:s}=n.selection,l=e?qn(e,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(u=>l?l.name===u.type.name:!0).find(u=>ul(u.attrs,t,{strict:!1}));let a=0;const i=[];if(s.forEach(({$from:u,$to:p})=>{const h=u.pos,f=p.pos;n.doc.nodesBetween(h,f,(m,g)=>{if(!m.isText&&!m.marks.length)return;const y=Math.max(h,g),b=Math.min(f,g+m.nodeSize),k=b-y;a+=k,i.push(...m.marks.map(x=>({mark:x,from:y,to:b})))})}),a===0)return!1;const c=i.filter(u=>l?l.name===u.mark.type.name:!0).filter(u=>ul(u.mark.attrs,t,{strict:!1})).reduce((u,p)=>u+p.to-p.from,0),d=i.filter(u=>l?u.mark.type!==l&&u.mark.type.excludes(l):!0).reduce((u,p)=>u+p.to-p.from,0);return(c>0?c+d:c)>=a}function fr(n,e,t={}){const{from:r,to:s,empty:l}=n.selection,a=e?bt(e,n.schema):null,i=[];n.doc.nodesBetween(r,s,(u,p)=>{if(u.isText)return;const h=Math.max(r,p),f=Math.min(s,p+u.nodeSize);i.push({node:u,from:h,to:f})});const c=s-r,d=i.filter(u=>a?a.name===u.node.type.name:!0).filter(u=>ul(u.node.attrs,t,{strict:!1}));return l?!!d.length:d.reduce((u,p)=>u+p.to-p.from,0)>=c}function D2(n,e,t={}){if(!e)return fr(n,null,t)||Ji(n,null,t);const r=dl(e,n.schema);return r==="node"?fr(n,e,t):r==="mark"?Ji(n,e,t):!1}var O2=(n,e)=>{const{$from:t,$to:r,$anchor:s}=n.selection;if(e){const l=il(i=>i.type.name===e)(n.selection);if(!l)return!1;const a=n.doc.resolve(l.pos+1);return s.pos+1===a.end()}return!(r.parentOffset<r.parent.nodeSize-2||t.pos!==r.pos)},I2=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function Ih(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function Fh(n,e){const{nodeExtensions:t}=Ko(e),r=t.find(a=>a.name===n);if(!r)return!1;const s={name:r.name,options:r.options,storage:r.storage},l=Ye(ke(r,"group",s));return typeof l!="string"?!1:l.split(" ").includes("list")}function hl(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var r;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!=null?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let s=!0;return n.content.forEach(l=>{s!==!1&&(hl(l,{ignoreWhitespace:t,checkChildren:e})||(s=!1))}),s}return!1}function $h(n){return n instanceof we}function Rh(n){return n instanceof xe}function Pr(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function Ph(n,e=null){if(!e)return null;const t=_e.atStart(n),r=_e.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return r;const s=t.from,l=r.to;return e==="all"?xe.create(n,Pr(0,s,l),Pr(n.content.size,s,l)):xe.create(n,Pr(e,s,l),Pr(e,s,l))}function F2(n,e,t){const r=n.steps.length-1;if(r<e)return;const s=n.steps[r];if(!(s instanceof vt||s instanceof Et))return;const l=n.mapping.maps[r];let a=0;l.forEach((i,c,d,u)=>{a===0&&(a=u)}),n.setSelection(_e.near(n.doc.resolve(a),t))}var fl=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},$2=(n,e)=>{if(Ki(e))return e.exec(n);const t=e(n);if(!t)return null;const r=[t.text];return r.index=t.index,r.input=n,r.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(t.replaceWith)),r};function ml(n){var e;const{editor:t,from:r,to:s,text:l,rules:a,plugin:i}=n,{view:c}=t;if(c.composing)return!1;const d=c.state.doc.resolve(r);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(h=>h.type.spec.code))return!1;let u=!1;const p=L2(d)+l;return a.forEach(h=>{if(u)return;const f=$2(p,h.find);if(!f)return;const m=c.state.tr,g=sl({state:c.state,transaction:m}),y={from:r-(f[0].length-l.length),to:s},{commands:b,chain:k,can:x}=new ll({editor:t,state:g});h.handler({state:g,range:y,match:f,commands:b,chain:k,can:x})===null||!m.steps.length||(h.undoable&&m.setMeta(i,{transform:m,from:r,to:s,text:l}),c.dispatch(m),u=!0)}),u}function R2(n){const{editor:e,rules:t}=n,r=new ct({state:{init(){return null},apply(s,l,a){const i=s.getMeta(r);if(i)return i;const c=s.getMeta("applyInputRules");return c&&setTimeout(()=>{let{text:d}=c;typeof d=="string"?d=d:d=Ui(ne.from(d),a.schema);const{from:u}=c,p=u+d.length;ml({editor:e,from:u,to:p,text:d,rules:t,plugin:r})}),s.selectionSet||s.docChanged?null:l}},props:{handleTextInput(s,l,a,i){return ml({editor:e,from:l,to:a,text:i,rules:t,plugin:r})},handleDOMEvents:{compositionend:s=>(setTimeout(()=>{const{$cursor:l}=s.state.selection;l&&ml({editor:e,from:l.pos,to:l.pos,text:"",rules:t,plugin:r})}),!1)},handleKeyDown(s,l){if(l.key!=="Enter")return!1;const{$cursor:a}=s.state.selection;return a?ml({editor:e,from:a.pos,to:a.pos,text:`
|
|
13
|
+
`,rules:t,plugin:r}):!1}},isInputRules:!0});return r}function P2(n){return Object.prototype.toString.call(n).slice(8,-1)}function gl(n){return P2(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function zh(n,e){const t={...n};return gl(n)&&gl(e)&&Object.keys(e).forEach(r=>{gl(e[r])&&gl(n[r])?t[r]=zh(n[r],e[r]):t[r]=e[r]}),t}var Zi=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{...Ye(ke(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Ye(ke(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>zh(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},bn=class Yg extends Zi{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new Yg(t)}static handleExit({editor:e,mark:t}){const{tr:r}=e.state,s=e.state.selection.$from;if(s.pos===s.end()){const l=s.marks();if(!l.find(i=>i?.type.name===t.name))return!1;const a=l.find(i=>i?.type.name===t.name);return a&&r.removeStoredMark(a),r.insertText(" ",s.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function z2(n){return typeof n=="number"}var j2=class{constructor(n){this.find=n.find,this.handler=n.handler}},H2=(n,e,t)=>{if(Ki(e))return[...n.matchAll(e)];const r=e(n,t);return r?r.map(s=>{const l=[s.text];return l.index=s.index,l.input=n,l.data=s.data,s.replaceWith&&(s.text.includes(s.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),l.push(s.replaceWith)),l}):[]};function U2(n){const{editor:e,state:t,from:r,to:s,rule:l,pasteEvent:a,dropEvent:i}=n,{commands:c,chain:d,can:u}=new ll({editor:e,state:t}),p=[];return t.doc.nodesBetween(r,s,(h,f)=>{var m,g,y,b,k;if((g=(m=h.type)==null?void 0:m.spec)!=null&&g.code||!(h.isText||h.isTextblock||h.isInline))return;const x=(k=(b=(y=h.content)==null?void 0:y.size)!=null?b:h.nodeSize)!=null?k:0,w=Math.max(r,f),v=Math.min(s,f+x);if(w>=v)return;const _=h.isText?h.text||"":h.textBetween(w-f,v-f,void 0,"");H2(_,l.find,a).forEach(E=>{if(E.index===void 0)return;const S=w+E.index+1,I=S+E[0].length,A={from:t.tr.mapping.map(S),to:t.tr.mapping.map(I)},V=l.handler({state:t,range:A,match:E,commands:c,chain:d,can:u,pasteEvent:a,dropEvent:i});p.push(V)})}),p.every(h=>h!==null)}var yl=null,W2=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function K2(n){const{editor:e,rules:t}=n;let r=null,s=!1,l=!1,a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,i;try{i=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{i=null}const c=({state:d,from:u,to:p,rule:h,pasteEvt:f})=>{const m=d.tr,g=sl({state:d,transaction:m});if(!(!U2({editor:e,state:g,from:Math.max(u-1,0),to:p.b-1,rule:h,pasteEvent:f,dropEvent:i})||!m.steps.length)){try{i=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{i=null}return a=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,m}};return t.map(d=>new ct({view(u){const p=f=>{var m;r=(m=u.dom.parentElement)!=null&&m.contains(f.target)?u.dom.parentElement:null,r&&(yl=e)},h=()=>{yl&&(yl=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(u,p)=>{if(l=r===u.dom.parentElement,i=p,!l){const h=yl;h?.isEditable&&setTimeout(()=>{const f=h.state.selection;f&&h.commands.deleteRange({from:f.from,to:f.to})},10)}return!1},paste:(u,p)=>{var h;const f=(h=p.clipboardData)==null?void 0:h.getData("text/html");return a=p,s=!!f?.includes("data-pm-slice"),!1}}},appendTransaction:(u,p,h)=>{const f=u[0],m=f.getMeta("uiEvent")==="paste"&&!s,g=f.getMeta("uiEvent")==="drop"&&!l,y=f.getMeta("applyPasteRules"),b=!!y;if(!m&&!g&&!b)return;if(b){let{text:w}=y;typeof w=="string"?w=w:w=Ui(ne.from(w),h.schema);const{from:v}=y,_=v+w.length,E=W2(w);return c({rule:d,state:h,from:v,to:{b:_},pasteEvt:E})}const k=p.doc.content.findDiffStart(h.doc.content),x=p.doc.content.findDiffEnd(h.doc.content);if(!(!z2(k)||!x||k===x.b))return c({rule:d,state:h,from:k,to:x,pasteEvt:a})}}))}var bl=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.extensions=Vh(n),this.schema=S2(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Yi(e.name,this.schema)},r=ke(e,"addCommands",t);return r?{...n,...r()}:n},{})}get plugins(){const{editor:n}=this;return Wi([...this.extensions].reverse()).flatMap(e=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:n,type:Yi(e.name,this.schema)},r=[],s=ke(e,"addKeyboardShortcuts",t);let l={};if(e.type==="mark"&&ke(e,"exitable",t)&&(l.ArrowRight=()=>bn.handleExit({editor:n,mark:e})),s){const u=Object.fromEntries(Object.entries(s()).map(([p,h])=>[p,()=>h({editor:n})]));l={...l,...u}}const a=Qx(l);r.push(a);const i=ke(e,"addInputRules",t);if(Ih(e,n.options.enableInputRules)&&i){const u=i();if(u&&u.length){const p=R2({editor:n,rules:u}),h=Array.isArray(p)?p:[p];r.push(...h)}}const c=ke(e,"addPasteRules",t);if(Ih(e,n.options.enablePasteRules)&&c){const u=c();if(u&&u.length){const p=K2({editor:n,rules:u});r.push(...p)}}const d=ke(e,"addProseMirrorPlugins",t);if(d){const u=d();r.push(...u)}return r})}get attributes(){return _h(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=Ko(this.extensions);return Object.fromEntries(e.filter(t=>!!ke(t,"addNodeView")).map(t=>{const r=this.attributes.filter(i=>i.type===t.name),s={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:bt(t.name,this.schema)},l=ke(t,"addNodeView",s);if(!l)return[];const a=(i,c,d,u,p)=>{const h=cl(i,r);return l()({node:i,view:c,getPos:d,decorations:u,innerDecorations:p,editor:n,extension:t,HTMLAttributes:h})};return[t.name,a]}))}get markViews(){const{editor:n}=this,{markExtensions:e}=Ko(this.extensions);return Object.fromEntries(e.filter(t=>!!ke(t,"addMarkView")).map(t=>{const r=this.attributes.filter(i=>i.type===t.name),s={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:qn(t.name,this.schema)},l=ke(t,"addMarkView",s);if(!l)return[];const a=(i,c,d)=>{const u=cl(i,r);return l()({mark:i,view:c,inline:d,editor:n,extension:t,HTMLAttributes:u,updateAttributes:p=>{aE(i,n,p)}})};return[t.name,a]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Yi(e.name,this.schema)};e.type==="mark"&&((t=Ye(ke(e,"keepOnSplit",r)))==null||t)&&this.splittableMarks.push(e.name);const s=ke(e,"onBeforeCreate",r),l=ke(e,"onCreate",r),a=ke(e,"onUpdate",r),i=ke(e,"onSelectionUpdate",r),c=ke(e,"onTransaction",r),d=ke(e,"onFocus",r),u=ke(e,"onBlur",r),p=ke(e,"onDestroy",r);s&&this.editor.on("beforeCreate",s),l&&this.editor.on("create",l),a&&this.editor.on("update",a),i&&this.editor.on("selectionUpdate",i),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),p&&this.editor.on("destroy",p)})}};bl.resolve=Vh,bl.sort=Wi,bl.flatten=Hi;var q2={};wh(q2,{ClipboardTextSerializer:()=>jh,Commands:()=>qh,Delete:()=>Gh,Drop:()=>Yh,Editable:()=>Jh,FocusEvents:()=>Xh,Keymap:()=>Qh,Paste:()=>ef,Tabindex:()=>tf,focusEventsPluginKey:()=>Zh});var Xe=class Jg extends Zi{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Jg(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},jh=Xe.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ct({key:new mt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:r,selection:s}=e,{ranges:l}=s,a=Math.min(...l.map(d=>d.$from.pos)),i=Math.max(...l.map(d=>d.$to.pos)),c=Bh(t);return Mh(r,{from:a,to:i},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),Hh={};wh(Hh,{blur:()=>G2,clearContent:()=>Y2,clearNodes:()=>J2,command:()=>Z2,createParagraphNear:()=>X2,cut:()=>Q2,deleteCurrentNode:()=>ev,deleteNode:()=>tv,deleteRange:()=>nv,deleteSelection:()=>rv,enter:()=>ov,exitCode:()=>sv,extendMarkRange:()=>lv,first:()=>av,focus:()=>cv,forEach:()=>dv,insertContent:()=>uv,insertContentAt:()=>hv,joinBackward:()=>gv,joinDown:()=>mv,joinForward:()=>yv,joinItemBackward:()=>bv,joinItemForward:()=>kv,joinTextblockBackward:()=>wv,joinTextblockForward:()=>xv,joinUp:()=>fv,keyboardShortcut:()=>Ev,lift:()=>Cv,liftEmptyBlock:()=>_v,liftListItem:()=>Sv,newlineInCode:()=>Nv,resetAttributes:()=>Vv,scrollIntoView:()=>Mv,selectAll:()=>Bv,selectNodeBackward:()=>Av,selectNodeForward:()=>Tv,selectParentNode:()=>Lv,selectTextblockEnd:()=>Dv,selectTextblockStart:()=>Ov,setContent:()=>Iv,setMark:()=>$v,setMeta:()=>Rv,setNode:()=>Pv,setNodeSelection:()=>zv,setTextSelection:()=>jv,sinkListItem:()=>Hv,splitBlock:()=>Uv,splitListItem:()=>Wv,toggleList:()=>Kv,toggleMark:()=>qv,toggleNode:()=>Gv,toggleWrap:()=>Yv,undoInputRule:()=>Jv,unsetAllMarks:()=>Zv,unsetMark:()=>Xv,updateAttributes:()=>Qv,wrapIn:()=>eE,wrapInList:()=>tE});var G2=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),Y2=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),J2=()=>({state:n,tr:e,dispatch:t})=>{const{selection:r}=e,{ranges:s}=r;return t&&s.forEach(({$from:l,$to:a})=>{n.doc.nodesBetween(l.pos,a.pos,(i,c)=>{if(i.type.isText)return;const{doc:d,mapping:u}=e,p=d.resolve(u.map(c)),h=d.resolve(u.map(c+i.nodeSize)),f=p.blockRange(h);if(!f)return;const m=to(f);if(i.type.isTextblock){const{defaultType:g}=p.parent.contentMatchAt(p.index());e.setNodeMarkup(f.start,g)}(m||m===0)&&e.lift(f,m)})}),!0},Z2=n=>e=>n(e),X2=()=>({state:n,dispatch:e})=>mh(n,e),Q2=(n,e)=>({editor:t,tr:r})=>{const{state:s}=t,l=s.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);const a=r.mapping.map(e);return r.insert(a,l.content),r.setSelection(new xe(r.doc.resolve(Math.max(a-1,0)))),!0},ev=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,r=t.$anchor.node();if(r.content.size>0)return!1;const s=n.selection.$anchor;for(let l=s.depth;l>0;l-=1)if(s.node(l).type===r.type){if(e){const a=s.before(l),i=s.after(l);n.delete(a,i).scrollIntoView()}return!0}return!1},tv=n=>({tr:e,state:t,dispatch:r})=>{const s=bt(n,t.schema),l=e.selection.$anchor;for(let a=l.depth;a>0;a-=1)if(l.node(a).type===s){if(r){const i=l.before(a),c=l.after(a);e.delete(i,c).scrollIntoView()}return!0}return!1},nv=n=>({tr:e,dispatch:t})=>{const{from:r,to:s}=n;return t&&e.delete(r,s),!0},rv=()=>({state:n,dispatch:e})=>Fi(n,e),ov=()=>({commands:n})=>n.keyboardShortcut("Enter"),sv=()=>({state:n,dispatch:e})=>s2(n,e),lv=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const l=qn(n,r.schema),{doc:a,selection:i}=t,{$from:c,from:d,to:u}=i;if(s){const p=qi(c,l,e);if(p&&p.from<=d&&p.to>=u){const h=xe.create(a,p.from,p.to);t.setSelection(h)}}return!0},av=n=>e=>{const t=typeof n=="function"?n(e):n;for(let r=0;r<t.length;r+=1)if(t[r](e))return!0;return!1};function iv(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Xi(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var cv=(n=null,e={})=>({editor:t,view:r,tr:s,dispatch:l})=>{e={scrollIntoView:!0,...e};const a=()=>{(Xi()||iv())&&r.dom.focus(),requestAnimationFrame(()=>{t.isDestroyed||(r.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(l&&n===null&&!Rh(t.state.selection))return a(),!0;const i=Ph(s.doc,n)||t.state.selection,c=t.state.selection.eq(i);return l&&(c||s.setSelection(i),c&&s.storedMarks&&s.setStoredMarks(s.storedMarks),a()),!0},dv=(n,e)=>t=>n.every((r,s)=>e(r,{...t,index:s})),uv=(n,e)=>({tr:t,commands:r})=>r.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),pv=n=>!("type"in n),hv=(n,e,t)=>({tr:r,dispatch:s,editor:l})=>{var a;if(s){t={parseOptions:l.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let i;const c=g=>{l.emit("contentError",{editor:l,error:g,disableCollaboration:()=>{"collaboration"in l.storage&&typeof l.storage.collaboration=="object"&&l.storage.collaboration&&(l.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!l.options.enableContentCheck&&l.options.emitContentError)try{Wo(e,l.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(g){c(g)}try{i=Wo(e,l.schema,{parseOptions:d,errorOnInvalidContent:(a=t.errorOnInvalidContent)!=null?a:l.options.enableContentCheck})}catch(g){return c(g),!1}let{from:u,to:p}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},h=!0,f=!0;if((pv(i)?i:[i]).forEach(g=>{g.check(),h=h?g.isText&&g.marks.length===0:!1,f=f?g.isBlock:!1}),u===p&&f){const{parent:g}=r.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,p+=1)}let m;if(h){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof ne){let g="";e.forEach(y=>{y.text&&(g+=y.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;r.insertText(m,u,p)}else{m=i;const g=r.doc.resolve(u),y=g.node(),b=g.parentOffset===0,k=y.isText||y.isTextblock,x=y.content.size>0;b&&k&&x&&(u=Math.max(0,u-1)),r.replaceWith(u,p,m)}t.updateSelection&&F2(r,r.steps.length-1,-1),t.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:m}),t.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:m})}return!0},fv=()=>({state:n,dispatch:e})=>n2(n,e),mv=()=>({state:n,dispatch:e})=>r2(n,e),gv=()=>({state:n,dispatch:e})=>ih(n,e),yv=()=>({state:n,dispatch:e})=>ph(n,e),bv=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Ks(n.doc,n.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},kv=()=>({state:n,dispatch:e,tr:t})=>{try{const r=Ks(n.doc,n.selection.$from.pos,1);return r==null?!1:(t.join(r,2),e&&e(t),!0)}catch{return!1}},wv=()=>({state:n,dispatch:e})=>e2(n,e),xv=()=>({state:n,dispatch:e})=>t2(n,e);function Uh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function vv(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let r,s,l,a;for(let i=0;i<e.length-1;i+=1){const c=e[i];if(/^(cmd|meta|m)$/i.test(c))a=!0;else if(/^a(lt)?$/i.test(c))r=!0;else if(/^(c|ctrl|control)$/i.test(c))s=!0;else if(/^s(hift)?$/i.test(c))l=!0;else if(/^mod$/i.test(c))Xi()||Uh()?a=!0:s=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return r&&(t=`Alt-${t}`),s&&(t=`Ctrl-${t}`),a&&(t=`Meta-${t}`),l&&(t=`Shift-${t}`),t}var Ev=n=>({editor:e,view:t,tr:r,dispatch:s})=>{const l=vv(n).split(/-(?!$)/),a=l.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),i=new KeyboardEvent("keydown",{key:a==="Space"?" ":a,altKey:l.includes("Alt"),ctrlKey:l.includes("Ctrl"),metaKey:l.includes("Meta"),shiftKey:l.includes("Shift"),bubbles:!0,cancelable:!0});return e.captureTransaction(()=>{t.someProp("handleKeyDown",d=>d(t,i))})?.steps.forEach(d=>{const u=d.map(r.mapping);u&&s&&r.maybeStep(u)}),!0},Cv=(n,e={})=>({state:t,dispatch:r})=>{const s=bt(n,t.schema);return fr(t,s,e)?o2(t,r):!1},_v=()=>({state:n,dispatch:e})=>gh(n,e),Sv=n=>({state:e,dispatch:t})=>{const r=bt(n,e.schema);return g2(r)(e,t)},Nv=()=>({state:n,dispatch:e})=>fh(n,e);function Wh(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((r,s)=>(t.includes(s)||(r[s]=n[s]),r),{})}var Vv=(n,e)=>({tr:t,state:r,dispatch:s})=>{let l=null,a=null;const i=dl(typeof n=="string"?n:n.name,r.schema);return i?(i==="node"&&(l=bt(n,r.schema)),i==="mark"&&(a=qn(n,r.schema)),s&&t.selection.ranges.forEach(c=>{r.doc.nodesBetween(c.$from.pos,c.$to.pos,(d,u)=>{l&&l===d.type&&t.setNodeMarkup(u,void 0,Wh(d.attrs,e)),a&&d.marks.length&&d.marks.forEach(p=>{a===p.type&&t.addMark(u,u+d.nodeSize,a.create(Wh(p.attrs,e)))})})}),!0):!1},Mv=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),Bv=()=>({tr:n,dispatch:e})=>{if(e){const t=new en(n.doc);n.setSelection(t)}return!0},Av=()=>({state:n,dispatch:e})=>dh(n,e),Tv=()=>({state:n,dispatch:e})=>hh(n,e),Lv=()=>({state:n,dispatch:e})=>i2(n,e),Dv=()=>({state:n,dispatch:e})=>u2(n,e),Ov=()=>({state:n,dispatch:e})=>d2(n,e),Iv=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:r={}}={})=>({editor:s,tr:l,dispatch:a,commands:i})=>{const{doc:c}=l;if(r.preserveWhitespace!=="full"){const d=ji(n,s.schema,r,{errorOnInvalidContent:e??s.options.enableContentCheck});return a&&l.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!t),!0}return a&&l.setMeta("preventUpdate",!t),i.insertContentAt({from:0,to:c.content.size},n,{parseOptions:r,errorOnInvalidContent:e??s.options.enableContentCheck})};function Fv(n,e,t){var r;const{selection:s}=e;let l=null;if(Rh(s)&&(l=s.$cursor),l){const i=(r=n.storedMarks)!=null?r:l.marks();return l.parent.type.allowsMarkType(t)&&(!!t.isInSet(i)||!i.some(c=>c.type.excludes(t)))}const{ranges:a}=s;return a.some(({$from:i,$to:c})=>{let d=i.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(i.pos,c.pos,(u,p,h)=>{if(d)return!1;if(u.isInline){const f=!h||h.type.allowsMarkType(t),m=!!t.isInSet(u.marks)||!u.marks.some(g=>g.type.excludes(t));d=f&&m}return!d}),d})}var $v=(n,e={})=>({tr:t,state:r,dispatch:s})=>{const{selection:l}=t,{empty:a,ranges:i}=l,c=qn(n,r.schema);if(s)if(a){const d=Ah(r,c);t.addStoredMark(c.create({...d,...e}))}else i.forEach(d=>{const u=d.$from.pos,p=d.$to.pos;r.doc.nodesBetween(u,p,(h,f)=>{const m=Math.max(f,u),g=Math.min(f+h.nodeSize,p);h.marks.find(y=>y.type===c)?h.marks.forEach(y=>{c===y.type&&t.addMark(m,g,c.create({...y.attrs,...e}))}):t.addMark(m,g,c.create(e))})});return Fv(r,t,c)},Rv=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),Pv=(n,e={})=>({state:t,dispatch:r,chain:s})=>{const l=bt(n,t.schema);let a;return t.selection.$anchor.sameParent(t.selection.$head)&&(a=t.selection.$anchor.parent.attrs),l.isTextblock?s().command(({commands:i})=>kh(l,{...a,...e})(t)?!0:i.clearNodes()).command(({state:i})=>kh(l,{...a,...e})(i,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},zv=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,s=Pr(n,0,r.content.size),l=we.create(r,s);e.setSelection(l)}return!0},jv=n=>({tr:e,dispatch:t})=>{if(t){const{doc:r}=e,{from:s,to:l}=typeof n=="number"?{from:n,to:n}:n,a=xe.atStart(r).from,i=xe.atEnd(r).to,c=Pr(s,a,i),d=Pr(l,a,i),u=xe.create(r,c,d);e.setSelection(u)}return!0},Hv=n=>({state:e,dispatch:t})=>{const r=bt(n,e.schema);return k2(r)(e,t)};function Kh(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const r=t.filter(s=>e?.includes(s.type.name));n.tr.ensureMarks(r)}}var Uv=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:r,editor:s})=>{const{selection:l,doc:a}=e,{$from:i,$to:c}=l,d=s.extensionManager.attributes,u=pl(d,i.node().type.name,i.node().attrs);if(l instanceof we&&l.node.isBlock)return!i.parentOffset||!jn(a,i.pos)?!1:(r&&(n&&Kh(t,s.extensionManager.splittableMarks),e.split(i.pos).scrollIntoView()),!0);if(!i.parent.isBlock)return!1;const p=c.parentOffset===c.parent.content.size,h=i.depth===0?void 0:v2(i.node(-1).contentMatchAt(i.indexAfter(-1)));let f=p&&h?[{type:h,attrs:u}]:void 0,m=jn(e.doc,e.mapping.map(i.pos),1,f);if(!f&&!m&&jn(e.doc,e.mapping.map(i.pos),1,h?[{type:h}]:void 0)&&(m=!0,f=h?[{type:h,attrs:u}]:void 0),r){if(m&&(l instanceof xe&&e.deleteSelection(),e.split(e.mapping.map(i.pos),1,f),h&&!p&&!i.parentOffset&&i.parent.type!==h)){const g=e.mapping.map(i.before()),y=e.doc.resolve(g);i.node(-1).canReplaceWith(y.index(),y.index()+1,h)&&e.setNodeMarkup(e.mapping.map(i.before()),h)}n&&Kh(t,s.extensionManager.splittableMarks),e.scrollIntoView()}return m},Wv=(n,e={})=>({tr:t,state:r,dispatch:s,editor:l})=>{var a;const i=bt(n,r.schema),{$from:c,$to:d}=r.selection,u=r.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const p=c.node(-1);if(p.type!==i)return!1;const h=l.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==i||c.index(-2)!==c.node(-2).childCount-1)return!1;if(s){let b=ne.empty;const k=c.index(-1)?1:c.index(-2)?2:3;for(let S=c.depth-k;S>=c.depth-3;S-=1)b=ne.from(c.node(S).copy(b));const x=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,w={...pl(h,c.node().type.name,c.node().attrs),...e},v=((a=i.contentMatch.defaultType)==null?void 0:a.createAndFill(w))||void 0;b=b.append(ne.from(i.createAndFill(null,v)||void 0));const _=c.before(c.depth-(k-1));t.replace(_,c.after(-x),new de(b,4-k,0));let E=-1;t.doc.nodesBetween(_,t.doc.content.size,(S,I)=>{if(E>-1)return!1;S.isTextblock&&S.content.size===0&&(E=I+1)}),E>-1&&t.setSelection(xe.near(t.doc.resolve(E))),t.scrollIntoView()}return!0}const f=d.pos===c.end()?p.contentMatchAt(0).defaultType:null,m={...pl(h,p.type.name,p.attrs),...e},g={...pl(h,c.node().type.name,c.node().attrs),...e};t.delete(c.pos,d.pos);const y=f?[{type:i,attrs:m},{type:f,attrs:g}]:[{type:i,attrs:m}];if(!jn(t.doc,c.pos,2))return!1;if(s){const{selection:b,storedMarks:k}=r,{splittableMarks:x}=l.extensionManager,w=k||b.$to.parentOffset&&b.$from.marks();if(t.split(c.pos,2,y).scrollIntoView(),!w||!s)return!0;const v=w.filter(_=>x.includes(_.type.name));t.ensureMarks(v)}return!0},Qi=(n,e)=>{const t=il(l=>l.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(r===void 0)return!0;const s=n.doc.nodeAt(r);return t.node.type===s?.type&&or(n.doc,t.pos)&&n.join(t.pos),!0},ec=(n,e)=>{const t=il(l=>l.type===e)(n.selection);if(!t)return!0;const r=n.doc.resolve(t.start).after(t.depth);if(r===void 0)return!0;const s=n.doc.nodeAt(r);return t.node.type===s?.type&&or(n.doc,r)&&n.join(r),!0},Kv=(n,e,t,r={})=>({editor:s,tr:l,state:a,dispatch:i,chain:c,commands:d,can:u})=>{const{extensions:p,splittableMarks:h}=s.extensionManager,f=bt(n,a.schema),m=bt(e,a.schema),{selection:g,storedMarks:y}=a,{$from:b,$to:k}=g,x=b.blockRange(k),w=y||g.$to.parentOffset&&g.$from.marks();if(!x)return!1;const v=il(_=>Fh(_.type.name,p))(g);if(x.depth>=1&&v&&x.depth-v.depth<=1){if(v.node.type===f)return d.liftListItem(m);if(Fh(v.node.type.name,p)&&f.validContent(v.node.content)&&i)return c().command(()=>(l.setNodeMarkup(v.pos,f),!0)).command(()=>Qi(l,f)).command(()=>ec(l,f)).run()}return!t||!w||!i?c().command(()=>u().wrapInList(f,r)?!0:d.clearNodes()).wrapInList(f,r).command(()=>Qi(l,f)).command(()=>ec(l,f)).run():c().command(()=>{const _=u().wrapInList(f,r),E=w.filter(S=>h.includes(S.type.name));return l.ensureMarks(E),_?!0:d.clearNodes()}).wrapInList(f,r).command(()=>Qi(l,f)).command(()=>ec(l,f)).run()},qv=(n,e={},t={})=>({state:r,commands:s})=>{const{extendEmptyMarkRange:l=!1}=t,a=qn(n,r.schema);return Ji(r,a,e)?s.unsetMark(a,{extendEmptyMarkRange:l}):s.setMark(a,e)},Gv=(n,e,t={})=>({state:r,commands:s})=>{const l=bt(n,r.schema),a=bt(e,r.schema),i=fr(r,l,t);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),i?s.setNode(a,c):s.setNode(l,{...c,...t})},Yv=(n,e={})=>({state:t,commands:r})=>{const s=bt(n,t.schema);return fr(t,s,e)?r.lift(s):r.wrapIn(s,e)},Jv=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let r=0;r<t.length;r+=1){const s=t[r];let l;if(s.spec.isInputRules&&(l=s.getState(n))){if(e){const a=n.tr,i=l.transform;for(let c=i.steps.length-1;c>=0;c-=1)a.step(i.steps[c].invert(i.docs[c]));if(l.text){const c=a.doc.resolve(l.from).marks();a.replaceWith(l.from,l.to,n.schema.text(l.text,c))}else a.delete(l.from,l.to)}return!0}}return!1},Zv=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:r,ranges:s}=t;return r||e&&s.forEach(l=>{n.removeMark(l.$from.pos,l.$to.pos)}),!0},Xv=(n,e={})=>({tr:t,state:r,dispatch:s})=>{var l;const{extendEmptyMarkRange:a=!1}=e,{selection:i}=t,c=qn(n,r.schema),{$from:d,empty:u,ranges:p}=i;if(!s)return!0;if(u&&a){let{from:h,to:f}=i;const m=(l=d.marks().find(y=>y.type===c))==null?void 0:l.attrs,g=qi(d,c,m);g&&(h=g.from,f=g.to),t.removeMark(h,f,c)}else p.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,c)});return t.removeStoredMark(c),!0},Qv=(n,e={})=>({tr:t,state:r,dispatch:s})=>{let l=null,a=null;const i=dl(typeof n=="string"?n:n.name,r.schema);return i?(i==="node"&&(l=bt(n,r.schema)),i==="mark"&&(a=qn(n,r.schema)),s&&t.selection.ranges.forEach(c=>{const d=c.$from.pos,u=c.$to.pos;let p,h,f,m;t.selection.empty?r.doc.nodesBetween(d,u,(g,y)=>{l&&l===g.type&&(f=Math.max(y,d),m=Math.min(y+g.nodeSize,u),p=y,h=g)}):r.doc.nodesBetween(d,u,(g,y)=>{y<d&&l&&l===g.type&&(f=Math.max(y,d),m=Math.min(y+g.nodeSize,u),p=y,h=g),y>=d&&y<=u&&(l&&l===g.type&&t.setNodeMarkup(y,void 0,{...g.attrs,...e}),a&&g.marks.length&&g.marks.forEach(b=>{if(a===b.type){const k=Math.max(y,d),x=Math.min(y+g.nodeSize,u);t.addMark(k,x,a.create({...b.attrs,...e}))}}))}),h&&(p!==void 0&&t.setNodeMarkup(p,void 0,{...h.attrs,...e}),a&&h.marks.length&&h.marks.forEach(g=>{a===g.type&&t.addMark(f,m,a.create({...g.attrs,...e}))}))}),!0):!1},eE=(n,e={})=>({state:t,dispatch:r})=>{const s=bt(n,t.schema);return p2(s,e)(t,r)},tE=(n,e={})=>({state:t,dispatch:r})=>{const s=bt(n,t.schema);return h2(s,e)(t,r)},qh=Xe.create({name:"commands",addCommands(){return{...Hh}}}),Gh=Xe.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,r,s;const l=()=>{var a,i,c,d;if((d=(c=(i=(a=this.editor.options.coreExtensionOptions)==null?void 0:a.delete)==null?void 0:i.filterTransaction)==null?void 0:c.call(i,n))!=null?d:n.getMeta("y-sync$"))return;const u=xh(n.before,[n,...e]);Lh(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(f,m)=>{const g=m+f.nodeSize-2,y=h.oldRange.from<=m&&g<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:f,from:m,to:g,newFrom:u.mapping.map(m),newTo:u.mapping.map(g),deletedRange:h.oldRange,newRange:h.newRange,partial:!y,editor:this.editor,transaction:n,combinedTransform:u})})});const p=u.mapping;u.steps.forEach((h,f)=>{var m,g;if(h instanceof yn){const y=p.slice(f).map(h.from,-1),b=p.slice(f).map(h.to),k=p.invert().map(y,-1),x=p.invert().map(b),w=(m=u.doc.nodeAt(y-1))==null?void 0:m.marks.some(_=>_.eq(h.mark)),v=(g=u.doc.nodeAt(b))==null?void 0:g.marks.some(_=>_.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:k,to:x},newRange:{from:y,to:b},partial:!!(v||w),editor:this.editor,transaction:n,combinedTransform:u})}})};(s=(r=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:r.async)==null||s?setTimeout(l,0):l()}}),Yh=Xe.create({name:"drop",addProseMirrorPlugins(){return[new ct({key:new mt("tiptapDrop"),props:{handleDrop:(n,e,t,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:r})}}})]}}),Jh=Xe.create({name:"editable",addProseMirrorPlugins(){return[new ct({key:new mt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Zh=new mt("focusEvents"),Xh=Xe.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ct({key:Zh,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const r=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,t)=>{n.isFocused=!1;const r=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),Qh=Xe.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:a})=>{const{selection:i,doc:c}=a,{empty:d,$anchor:u}=i,{pos:p,parent:h}=u,f=u.parent.isTextblock&&p>0?a.doc.resolve(p-1):u,m=f.parent.type.spec.isolating,g=u.pos-u.parentOffset,y=m&&f.parent.childCount===1?g===u.pos:_e.atStart(c).from===p;return!d||!h.type.isTextblock||h.textContent.length||!y||y&&u.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),t={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...t},s={...t,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Xi()||Uh()?s:r},addProseMirrorPlugins(){return[new ct({key:new mt("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(f=>f.getMeta("composition")))return;const r=n.some(f=>f.docChanged)&&!e.doc.eq(t.doc),s=n.some(f=>f.getMeta("preventClearDocument"));if(!r||s)return;const{empty:l,from:a,to:i}=e.selection,c=_e.atStart(e.doc).from,d=_e.atEnd(e.doc).to;if(l||!(a===c&&i===d)||!hl(t.doc))return;const u=t.tr,p=sl({state:t,transaction:u}),{commands:h}=new ll({editor:this.editor,state:p});if(h.clearNodes(),!!u.steps.length)return u}})]}}),ef=Xe.create({name:"paste",addProseMirrorPlugins(){return[new ct({key:new mt("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),tf=Xe.create({name:"tabindex",addProseMirrorPlugins(){return[new ct({key:new mt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),nE=class So{constructor(e,t,r=!1,s=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=t,this.currentNode=s}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:t,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new So(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new So(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new So(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,r)=>{const s=t.isBlock&&!t.isTextblock,l=t.isAtom&&!t.isText,a=this.pos+r+(l?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const i=this.resolvedPos.doc.resolve(a);if(!s&&i.depth<=this.depth)return;const c=new So(i,this.editor,s,s?t:null);s&&(c.actualDepth=this.depth+1),e.push(new So(i,this.editor,s,s?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let r=null,s=this.parent;for(;s&&!r;){if(s.node.type.name===e)if(Object.keys(t).length>0){const l=s.node.attrs,a=Object.keys(t);for(let i=0;i<a.length;i+=1){const c=a[i];if(l[c]!==t[c])break}}else r=s;s=s.parent}return r}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},r=!1){let s=[];if(!this.children||this.children.length===0)return s;const l=Object.keys(t);return this.children.forEach(a=>{r&&s.length>0||(a.node.type.name===e&&l.every(i=>t[i]===a.node.attrs[i])&&s.push(a),!(r&&s.length>0)&&(s=s.concat(a.querySelectorAll(e,t,r))))}),s}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},rE=`.ProseMirror {
|
|
14
|
+
position: relative;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.ProseMirror {
|
|
18
|
+
word-wrap: break-word;
|
|
19
|
+
white-space: pre-wrap;
|
|
20
|
+
white-space: break-spaces;
|
|
21
|
+
-webkit-font-variant-ligatures: none;
|
|
22
|
+
font-variant-ligatures: none;
|
|
23
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.ProseMirror [contenteditable="false"] {
|
|
27
|
+
white-space: normal;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
31
|
+
white-space: pre-wrap;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.ProseMirror pre {
|
|
35
|
+
white-space: pre-wrap;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
img.ProseMirror-separator {
|
|
39
|
+
display: inline !important;
|
|
40
|
+
border: none !important;
|
|
41
|
+
margin: 0 !important;
|
|
42
|
+
width: 0 !important;
|
|
43
|
+
height: 0 !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.ProseMirror-gapcursor {
|
|
47
|
+
display: none;
|
|
48
|
+
pointer-events: none;
|
|
49
|
+
position: absolute;
|
|
50
|
+
margin: 0;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.ProseMirror-gapcursor:after {
|
|
54
|
+
content: "";
|
|
55
|
+
display: block;
|
|
56
|
+
position: absolute;
|
|
57
|
+
top: -2px;
|
|
58
|
+
width: 20px;
|
|
59
|
+
border-top: 1px solid black;
|
|
60
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
@keyframes ProseMirror-cursor-blink {
|
|
64
|
+
to {
|
|
65
|
+
visibility: hidden;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.ProseMirror-hideselection *::selection {
|
|
70
|
+
background: transparent;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
74
|
+
background: transparent;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.ProseMirror-hideselection * {
|
|
78
|
+
caret-color: transparent;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
82
|
+
display: block;
|
|
83
|
+
}`;function oE(n,e,t){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const s=document.createElement("style");return e&&s.setAttribute("nonce",e),s.setAttribute("data-tiptap-style",""),s.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(s),s}var sE=class extends x2{constructor(n={}){super(),this.css=null,this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(n),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:s,moved:l})=>this.options.onDrop(r,s,l)),this.on("paste",({event:r,slice:s})=>this.options.onPaste(r,s)),this.on("delete",this.options.onDelete);const e=this.createDoc(),t=Ph(e,this.options.autofocus);this.editorState=so.create({doc:e,schema:this.schema,selection:t||void 0}),this.options.element&&this.mount(this.options.element)}mount(n){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(n),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const n=this.editorView.dom;n?.editor&&delete n.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(n){console.warn("Failed to remove CSS element:",n)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=oE(rE,this.options.injectNonce))}setOptions(n={}){this.options={...this.options,...n},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(n,e=!0){this.setOptions({editable:n}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:n=>{this.editorState=n},dispatch:n=>{this.dispatchTransaction(n)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(n,e)=>{if(e==="state")return this.editorState;if(e in n)return Reflect.get(n,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(n,e){const t=Ch(e)?e(n,[...this.state.plugins]):[...this.state.plugins,n],r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}unregisterPlugin(n){if(this.isDestroyed)return;const e=this.state.plugins;let t=e;if([].concat(n).forEach(s=>{const l=typeof s=="string"?`${s}$`:s.key;t=t.filter(a=>!a.key.startsWith(l))}),e.length===t.length)return;const r=this.state.reconfigure({plugins:t});return this.view.updateState(r),r}createExtensionManager(){var n,e;const t=[...this.options.enableCoreExtensions?[Jh,jh.configure({blockSeparator:(e=(n=this.options.coreExtensionOptions)==null?void 0:n.clipboardTextSerializer)==null?void 0:e.blockSeparator}),qh,Xh,Qh,tf,Yh,ef,Gh].filter(r=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[r.name]!==!1:!0):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r?.type));this.extensionManager=new bl(t,this)}createCommandManager(){this.commandManager=new ll({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let n;try{n=ji(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(t=>t.name!=="collaboration"),this.createExtensionManager()}}),n=ji(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return n}createView(n){var e;this.editorView=new th(n,{...this.options.editorProps,attributes:{role:"textbox",...(e=this.options.editorProps)==null?void 0:e.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const t=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(t),this.prependClass(),this.injectCSS();const r=this.view.dom;r.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(n){this.isCapturingTransaction=!0,n(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(n){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=n;return}n.steps.forEach(d=>{var u;return(u=this.capturedTransaction)==null?void 0:u.step(d)});return}const{state:e,transactions:t}=this.state.applyTransaction(n),r=!this.state.selection.eq(e.selection),s=t.includes(n),l=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:n,nextState:e}),!s)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:n,appendedTransactions:t.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:n});const a=t.findLast(d=>d.getMeta("focus")||d.getMeta("blur")),i=a?.getMeta("focus"),c=a?.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:a}),c&&this.emit("blur",{editor:this,event:c.event,transaction:a}),!(n.getMeta("preventUpdate")||!t.some(d=>d.docChanged)||l.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:n,appendedTransactions:t.slice(1)})}getAttributes(n){return Th(this.state,n)}isActive(n,e){const t=typeof n=="string"?n:null,r=typeof n=="string"?e:n;return D2(this.state,t,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Ui(this.state.doc.content,this.schema)}getText(n){const{blockSeparator:e=`
|
|
84
|
+
|
|
85
|
+
`,textSerializers:t={}}=n||{};return V2(this.state.doc,{blockSeparator:e,textSerializers:{...Bh(this.schema),...t}})}get isEmpty(){return hl(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var n,e;return(e=(n=this.editorView)==null?void 0:n.isDestroyed)!=null?e:!0}$node(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelector(n,e))||null}$nodes(n,e){var t;return((t=this.$doc)==null?void 0:t.querySelectorAll(n,e))||null}$pos(n){const e=this.state.doc.resolve(n);return new nE(e,this)}get $doc(){return this.$pos(0)}};function zr(n){return new fl({find:n.find,handler:({state:e,range:t,match:r})=>{const s=Ye(n.getAttributes,void 0,r);if(s===!1||s===null)return null;const{tr:l}=e,a=r[r.length-1],i=r[0];if(a){const c=i.search(/\S/),d=t.from+i.indexOf(a),u=d+a.length;if(Gi(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(f=>f===n.type&&f!==h.mark.type)).filter(h=>h.to>d).length)return null;u<t.to&&l.delete(u,t.to),d>t.from&&l.delete(t.from+c,d);const p=t.from+c+a.length;l.addMark(t.from+c,p,n.type.create(s||{})),l.removeStoredMark(n.type)}},undoable:n.undoable})}function nf(n){return new fl({find:n.find,handler:({state:e,range:t,match:r})=>{const s=Ye(n.getAttributes,void 0,r)||{},{tr:l}=e,a=t.from;let i=t.to;const c=n.type.create(s);if(r[1]){const d=r[0].lastIndexOf(r[1]);let u=a+d;u>i?u=i:i=u+r[1].length;const p=r[0][r[0].length-1];l.insertText(p,a+r[0].length-1),l.replaceWith(u,i,c)}else if(r[0]){const d=n.type.isInline?a:a-1;l.insert(d,n.type.create(s)).delete(l.mapping.map(a),l.mapping.map(i))}l.scrollIntoView()},undoable:n.undoable})}function tc(n){return new fl({find:n.find,handler:({state:e,range:t,match:r})=>{const s=e.doc.resolve(t.from),l=Ye(n.getAttributes,void 0,r)||{};if(!s.node(-1).canReplaceWith(s.index(-1),s.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,l)},undoable:n.undoable})}function fo(n){return new fl({find:n.find,handler:({state:e,range:t,match:r,chain:s})=>{const l=Ye(n.getAttributes,void 0,r)||{},a=e.tr.delete(t.from,t.to),i=a.doc.resolve(t.from).blockRange(),c=i&&ni(i,n.type,l);if(!c)return null;if(a.wrap(i,c),n.keepMarks&&n.editor){const{selection:u,storedMarks:p}=e,{splittableMarks:h}=n.editor.extensionManager,f=p||u.$to.parentOffset&&u.$from.marks();if(f){const m=f.filter(g=>h.includes(g.type.name));a.ensureMarks(m)}}if(n.keepAttributes){const u=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";s().updateAttributes(u,l).run()}const d=a.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&or(a.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&a.join(t.from-1)},undoable:n.undoable})}function lE(n,e){const{selection:t}=n,{$from:r}=t;if(t instanceof we){const l=r.index();return r.parent.canReplaceWith(l,l+1,e)}let s=r.depth;for(;s>=0;){const l=r.index(s);if(r.node(s).contentMatchAt(l).matchType(e))return!0;s-=1}return!1}function aE(n,e,t={}){const{state:r}=e,{doc:s,tr:l}=r,a=n;s.descendants((i,c)=>{const d=l.mapping.map(c),u=l.mapping.map(c)+i.nodeSize;let p=null;if(i.marks.forEach(f=>{if(f!==a)return!1;p=f}),!p)return;let h=!1;if(Object.keys(t).forEach(f=>{t[f]!==p.attrs[f]&&(h=!0)}),h){const f=n.type.create({...n.attrs,...t});l.removeMark(d,u,n.type),l.addMark(d,u,f)}}),l.docChanged&&e.view.dispatch(l)}var wt=class Zg extends Zi{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Zg(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function mr(n){return new j2({find:n.find,handler:({state:e,range:t,match:r,pasteEvent:s})=>{const l=Ye(n.getAttributes,void 0,r,s);if(l===!1||l===null)return null;const{tr:a}=e,i=r[r.length-1],c=r[0];let d=t.to;if(i){const u=c.search(/\S/),p=t.from+c.indexOf(i),h=p+i.length;if(Gi(t.from,t.to,e.doc).filter(f=>f.mark.type.excluded.find(m=>m===n.type&&m!==f.mark.type)).filter(f=>f.to>p).length)return null;h<t.to&&a.delete(h,t.to),p>t.from&&a.delete(t.from+u,p),d=t.from+u+i.length,a.addMark(t.from+u,d,n.type.create(l||{})),a.removeStoredMark(n.type)}}})}function rf(n){return o.customRef((e,t)=>({get(){return e(),n},set(r){n=r,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var iE=class extends sE{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=rf(this.view.state),this.reactiveExtensionStorage=rf(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),o.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(n,e){const t=super.registerPlugin(n,e);return this.reactiveState&&(this.reactiveState.value=t),t}unregisterPlugin(n){const e=super.unregisterPlugin(n);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},cE=o.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=o.ref(),t=o.getCurrentInstance();return o.watchEffect(()=>{const r=n.editor;r&&r.options.element&&e.value&&o.nextTick(()=>{var s;if(!e.value||!((s=r.view.dom)!=null&&s.firstChild))return;const l=o.unref(e.value);e.value.append(r.view.dom),r.contentComponent=t.ctx._,t&&(r.appContext={...t.appContext,provides:t.provides}),r.setOptions({element:l}),r.createNodeViews()})}),o.onBeforeUnmount(()=>{const r=n.editor;r&&(r.contentComponent=null,r.appContext=null)}),{rootEl:e}},render(){return o.h("div",{ref:n=>{this.rootEl=n}})}});o.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return o.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),o.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return o.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(n=this.$slots).default)==null?void 0:e.call(n))}});var dE=(n={})=>{const e=o.shallowRef();return o.onMounted(()=>{e.value=new iE(n)}),o.onBeforeUnmount(()=>{var t,r,s;const l=(t=e.value)==null?void 0:t.view.dom,a=l?.cloneNode(!0);(r=l?.parentNode)==null||r.replaceChild(a,l),(s=e.value)==null||s.destroy()}),e};o.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return o.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var uE=20,of=(n,e=0)=>{const t=[];return!n.children.length||e>uE||Array.from(n.children).forEach(r=>{r.tagName==="SPAN"?t.push(r):r.children.length&&t.push(...of(r,e+1))}),t},pE=n=>{if(!n.children.length)return;const e=of(n);e&&e.forEach(t=>{var r,s;const l=t.getAttribute("style"),a=(s=(r=t.parentElement)==null?void 0:r.closest("span"))==null?void 0:s.getAttribute("style");t.setAttribute("style",`${a};${l}`)})},nc=bn.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&pE(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",Ze(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleTextStyle:n=>({commands:e})=>e.toggleMark(this.name,n),removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,r)=>{if(t.isTextblock)return!0;t.marks.filter(s=>s.type===this.type).some(s=>Object.values(s.attrs).some(l=>!!l))||n.removeMark(r,r+t.nodeSize,this.type)}),!0}}}}),hE=Xe.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const r=t.split(";").map(s=>s.trim()).filter(Boolean);for(let s=r.length-1;s>=0;s-=1){const l=r[s].split(":");if(l.length>=2){const a=l[0].trim().toLowerCase(),i=l.slice(1).join(":").trim();if(a==="background-color")return i.replace(/['"]+/g,"")}}}return(e=n.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.backgroundColor?{style:`background-color: ${n.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:n=>({chain:e})=>e().setMark("textStyle",{backgroundColor:n}).run(),unsetBackgroundColor:()=>({chain:n})=>n().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),fE=Xe.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const r=t.split(";").map(s=>s.trim()).filter(Boolean);for(let s=r.length-1;s>=0;s-=1){const l=r[s].split(":");if(l.length>=2){const a=l[0].trim().toLowerCase(),i=l.slice(1).join(":").trim();if(a==="color")return i.replace(/['"]+/g,"")}}}return(e=n.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),mE=Xe.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>n.style.fontFamily,renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),gE=Xe.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:n=>n.style.fontSize,renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),yE=Xe.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:n=>n.style.lineHeight,renderHTML:n=>n.lineHeight?{style:`line-height: ${n.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:n=>({chain:e})=>e().setMark("textStyle",{lineHeight:n}).run(),unsetLineHeight:()=>({chain:n})=>n().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}}),bE=Xe.create({name:"textStyleKit",addExtensions(){const n=[];return this.options.backgroundColor!==!1&&n.push(hE.configure(this.options.backgroundColor)),this.options.color!==!1&&n.push(fE.configure(this.options.color)),this.options.fontFamily!==!1&&n.push(mE.configure(this.options.fontFamily)),this.options.fontSize!==!1&&n.push(gE.configure(this.options.fontSize)),this.options.lineHeight!==!1&&n.push(yE.configure(this.options.lineHeight)),this.options.textStyle!==!1&&n.push(nc.configure(this.options.textStyle)),n}}),rc,oc;if(typeof WeakMap<"u"){let n=new WeakMap;rc=e=>n.get(e),oc=(e,t)=>(n.set(e,t),t)}else{const n=[];let e=0;rc=t=>{for(let r=0;r<n.length;r+=2)if(n[r]==t)return n[r+1]},oc=(t,r)=>(e==10&&(e=0),n[e++]=t,n[e++]=r)}var pt=class{constructor(e,t,r,s){this.width=e,this.height=t,this.map=r,this.problems=s}findCell(e){for(let t=0;t<this.map.length;t++){const r=this.map[t];if(r!=e)continue;const s=t%this.width,l=t/this.width|0;let a=s+1,i=l+1;for(let c=1;a<this.width&&this.map[t+c]==r;c++)a++;for(let c=1;i<this.height&&this.map[t+this.width*c]==r;c++)i++;return{left:s,top:l,right:a,bottom:i}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,r){const{left:s,right:l,top:a,bottom:i}=this.findCell(e);return t=="horiz"?(r<0?s==0:l==this.width)?null:this.map[a*this.width+(r<0?s-1:l)]:(r<0?a==0:i==this.height)?null:this.map[s+this.width*(r<0?a-1:i)]}rectBetween(e,t){const{left:r,right:s,top:l,bottom:a}=this.findCell(e),{left:i,right:c,top:d,bottom:u}=this.findCell(t);return{left:Math.min(r,i),top:Math.min(l,d),right:Math.max(s,c),bottom:Math.max(a,u)}}cellsInRect(e){const t=[],r={};for(let s=e.top;s<e.bottom;s++)for(let l=e.left;l<e.right;l++){const a=s*this.width+l,i=this.map[a];r[i]||(r[i]=!0,!(l==e.left&&l&&this.map[a-1]==i||s==e.top&&s&&this.map[a-this.width]==i)&&t.push(i))}return t}positionAt(e,t,r){for(let s=0,l=0;;s++){const a=l+r.child(s).nodeSize;if(s==e){let i=t+e*this.width;const c=(e+1)*this.width;for(;i<c&&this.map[i]<l;)i++;return i==c?a-1:this.map[i]}l=a}}static get(e){return rc(e)||oc(e,kE(e))}};function kE(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=wE(n),t=n.childCount,r=[];let s=0,l=null;const a=[];for(let d=0,u=e*t;d<u;d++)r[d]=0;for(let d=0,u=0;d<t;d++){const p=n.child(d);u++;for(let m=0;;m++){for(;s<r.length&&r[s]!=0;)s++;if(m==p.childCount)break;const g=p.child(m),{colspan:y,rowspan:b,colwidth:k}=g.attrs;for(let x=0;x<b;x++){if(x+d>=t){(l||(l=[])).push({type:"overlong_rowspan",pos:u,n:b-x});break}const w=s+x*e;for(let v=0;v<y;v++){r[w+v]==0?r[w+v]=u:(l||(l=[])).push({type:"collision",row:d,pos:u,n:y-v});const _=k&&k[v];if(_){const E=(w+v)%e*2,S=a[E];S==null||S!=_&&a[E+1]==1?(a[E]=_,a[E+1]=1):S==_&&a[E+1]++}}}s+=y,u+=g.nodeSize}const h=(d+1)*e;let f=0;for(;s<h;)r[s++]==0&&f++;f&&(l||(l=[])).push({type:"missing",row:d,n:f}),u++}(e===0||t===0)&&(l||(l=[])).push({type:"zero_sized"});const i=new pt(e,t,r,l);let c=!1;for(let d=0;!c&&d<a.length;d+=2)a[d]!=null&&a[d+1]<t&&(c=!0);return c&&xE(i,a,n),i}function wE(n){let e=-1,t=!1;for(let r=0;r<n.childCount;r++){const s=n.child(r);let l=0;if(t)for(let a=0;a<r;a++){const i=n.child(a);for(let c=0;c<i.childCount;c++){const d=i.child(c);a+d.attrs.rowspan>r&&(l+=d.attrs.colspan)}}for(let a=0;a<s.childCount;a++){const i=s.child(a);l+=i.attrs.colspan,i.attrs.rowspan>1&&(t=!0)}e==-1?e=l:e!=l&&(e=Math.max(e,l))}return e}function xE(n,e,t){n.problems||(n.problems=[]);const r={};for(let s=0;s<n.map.length;s++){const l=n.map[s];if(r[l])continue;r[l]=!0;const a=t.nodeAt(l);if(!a)throw new RangeError(`No cell with offset ${l} found`);let i=null;const c=a.attrs;for(let d=0;d<c.colspan;d++){const u=(s+d)%n.width,p=e[u*2];p!=null&&(!c.colwidth||c.colwidth[d]!=p)&&((i||(i=vE(c)))[d]=p)}i&&n.problems.unshift({type:"colwidth mismatch",pos:l,colwidth:i})}}function vE(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function Rt(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const r=n.nodes[t],s=r.spec.tableRole;s&&(e[s]=r)}}return e}var gr=new mt("selectingCells");function mo(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function EE(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function kn(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function kl(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=mo(e.$head)||CE(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function CE(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function sc(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function _E(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function lc(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function sf(n,e,t){const r=n.node(-1),s=pt.get(r),l=n.start(-1),a=s.nextCell(n.pos-l,e,t);return a==null?null:n.node(0).resolve(l+a)}function jr(n,e,t=1){const r={...n,colspan:n.colspan-t};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,t),r.colwidth.some(s=>s>0)||(r.colwidth=null)),r}function lf(n,e,t=1){const r={...n,colspan:n.colspan+t};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let s=0;s<t;s++)r.colwidth.splice(e,0,0)}return r}function SE(n,e,t){const r=Rt(e.type.schema).header_cell;for(let s=0;s<n.height;s++)if(e.nodeAt(n.map[t+s*n.width]).type!=r)return!1;return!0}var ot=class er extends _e{constructor(e,t=e){const r=e.node(-1),s=pt.get(r),l=e.start(-1),a=s.rectBetween(e.pos-l,t.pos-l),i=e.node(0),c=s.cellsInRect(a).filter(u=>u!=t.pos-l);c.unshift(t.pos-l);const d=c.map(u=>{const p=r.nodeAt(u);if(!p)throw RangeError(`No cell with offset ${u} found`);const h=l+u+1;return new Ru(i.resolve(h),i.resolve(h+p.content.size))});super(d[0].$from,d[0].$to,d),this.$anchorCell=e,this.$headCell=t}map(e,t){const r=e.resolve(t.map(this.$anchorCell.pos)),s=e.resolve(t.map(this.$headCell.pos));if(sc(r)&&sc(s)&&lc(r,s)){const l=this.$anchorCell.node(-1)!=r.node(-1);return l&&this.isRowSelection()?er.rowSelection(r,s):l&&this.isColSelection()?er.colSelection(r,s):new er(r,s)}return xe.between(r,s)}content(){const e=this.$anchorCell.node(-1),t=pt.get(e),r=this.$anchorCell.start(-1),s=t.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),l={},a=[];for(let c=s.top;c<s.bottom;c++){const d=[];for(let u=c*t.width+s.left,p=s.left;p<s.right;p++,u++){const h=t.map[u];if(l[h])continue;l[h]=!0;const f=t.findCell(h);let m=e.nodeAt(h);if(!m)throw RangeError(`No cell with offset ${h} found`);const g=s.left-f.left,y=f.right-s.right;if(g>0||y>0){let b=m.attrs;if(g>0&&(b=jr(b,0,g)),y>0&&(b=jr(b,b.colspan-y,y)),f.left<s.left){if(m=m.type.createAndFill(b),!m)throw RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(f.top<s.top||f.bottom>s.bottom){const b={...m.attrs,rowspan:Math.min(f.bottom,s.bottom)-Math.max(f.top,s.top)};f.top<s.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}d.push(m)}a.push(e.child(c).copy(ne.from(d)))}const i=this.isColSelection()&&this.isRowSelection()?e:a;return new de(ne.from(i),1,1)}replace(e,t=de.empty){const r=e.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){const{$from:i,$to:c}=s[a],d=e.mapping.slice(r);e.replace(d.map(i.pos),d.map(c.pos),a?de.empty:t)}const l=_e.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);l&&e.setSelection(l)}replaceWith(e,t){this.replace(e,new de(ne.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),r=pt.get(t),s=this.$anchorCell.start(-1),l=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s));for(let a=0;a<l.length;a++)e(t.nodeAt(l[a]),s+l[a])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,s=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,s)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const r=e.node(-1),s=pt.get(r),l=e.start(-1),a=s.findCell(e.pos-l),i=s.findCell(t.pos-l),c=e.node(0);return a.top<=i.top?(a.top>0&&(e=c.resolve(l+s.map[a.left])),i.bottom<s.height&&(t=c.resolve(l+s.map[s.width*(s.height-1)+i.right-1]))):(i.top>0&&(t=c.resolve(l+s.map[i.left])),a.bottom<s.height&&(e=c.resolve(l+s.map[s.width*(s.height-1)+a.right-1]))),new er(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=pt.get(e),r=this.$anchorCell.start(-1),s=t.colCount(this.$anchorCell.pos-r),l=t.colCount(this.$headCell.pos-r);if(Math.min(s,l)>0)return!1;const a=s+this.$anchorCell.nodeAfter.attrs.colspan,i=l+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,i)==t.width}eq(e){return e instanceof er&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const r=e.node(-1),s=pt.get(r),l=e.start(-1),a=s.findCell(e.pos-l),i=s.findCell(t.pos-l),c=e.node(0);return a.left<=i.left?(a.left>0&&(e=c.resolve(l+s.map[a.top*s.width])),i.right<s.width&&(t=c.resolve(l+s.map[s.width*(i.top+1)-1]))):(i.left>0&&(t=c.resolve(l+s.map[i.top*s.width])),a.right<s.width&&(e=c.resolve(l+s.map[s.width*(a.top+1)-1]))),new er(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new er(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,r=t){return new er(e.resolve(t),e.resolve(r))}getBookmark(){return new NE(this.$anchorCell.pos,this.$headCell.pos)}};ot.prototype.visible=!1,_e.jsonID("cell",ot);var NE=class Xg{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Xg(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),r=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&r.index()<r.parent.childCount&&lc(t,r)?new ot(t,r):_e.near(r,1)}};function VE(n){if(!(n.selection instanceof ot))return null;const e=[];return n.selection.forEachCell((t,r)=>{e.push(Ct.node(r,r+t.nodeSize,{class:"selectedCell"}))}),rt.create(n.doc,e)}function ME({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,r=e.pos,s=n.depth;for(;s>=0&&!(n.after(s+1)<n.end(s));s--,t++);for(let l=e.depth;l>=0&&!(e.before(l+1)>e.start(l));l--,r--);return t==r&&/row|table/.test(n.node(s).type.spec.tableRole)}function BE({$from:n,$to:e}){let t,r;for(let s=n.depth;s>0;s--){const l=n.node(s);if(l.type.spec.tableRole==="cell"||l.type.spec.tableRole==="header_cell"){t=l;break}}for(let s=e.depth;s>0;s--){const l=e.node(s);if(l.type.spec.tableRole==="cell"||l.type.spec.tableRole==="header_cell"){r=l;break}}return t!==r&&e.parentOffset===0}function AE(n,e,t){const r=(e||n).selection,s=(e||n).doc;let l,a;if(r instanceof we&&(a=r.node.type.spec.tableRole)){if(a=="cell"||a=="header_cell")l=ot.create(s,r.from);else if(a=="row"){const i=s.resolve(r.from+1);l=ot.rowSelection(i,i)}else if(!t){const i=pt.get(r.node),c=r.from+1,d=c+i.map[i.width*i.height-1];l=ot.create(s,c+1,d)}}else r instanceof xe&&ME(r)?l=xe.create(s,r.from):r instanceof xe&&BE(r)&&(l=xe.create(s,r.$from.start(),r.$from.end()));return l&&(e||(e=n.tr)).setSelection(l),e}var TE=new mt("fix-tables");function af(n,e,t,r){const s=n.childCount,l=e.childCount;e:for(let a=0,i=0;a<l;a++){const c=e.child(a);for(let d=i,u=Math.min(s,a+3);d<u;d++)if(n.child(d)==c){i=d+1,t+=c.nodeSize;continue e}r(c,t),i<s&&n.child(i).sameMarkup(c)?af(n.child(i),c,t+1,r):c.nodesBetween(0,c.content.size,r,t+1),t+=c.nodeSize}}function cf(n,e){let t;const r=(s,l)=>{s.type.spec.tableRole=="table"&&(t=LE(n,s,l,t))};return e?e.doc!=n.doc&&af(e.doc,n.doc,0,r):n.doc.descendants(r),t}function LE(n,e,t,r){const s=pt.get(e);if(!s.problems)return r;r||(r=n.tr);const l=[];for(let c=0;c<s.height;c++)l.push(0);for(let c=0;c<s.problems.length;c++){const d=s.problems[c];if(d.type=="collision"){const u=e.nodeAt(d.pos);if(!u)continue;const p=u.attrs;for(let h=0;h<p.rowspan;h++)l[d.row+h]+=d.n;r.setNodeMarkup(r.mapping.map(t+1+d.pos),null,jr(p,p.colspan-d.n,d.n))}else if(d.type=="missing")l[d.row]+=d.n;else if(d.type=="overlong_rowspan"){const u=e.nodeAt(d.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+d.pos),null,{...u.attrs,rowspan:u.attrs.rowspan-d.n})}else if(d.type=="colwidth mismatch"){const u=e.nodeAt(d.pos);if(!u)continue;r.setNodeMarkup(r.mapping.map(t+1+d.pos),null,{...u.attrs,colwidth:d.colwidth})}else if(d.type=="zero_sized"){const u=r.mapping.map(t);r.delete(u,u+e.nodeSize)}}let a,i;for(let c=0;c<l.length;c++)l[c]&&(a==null&&(a=c),i=c);for(let c=0,d=t+1;c<s.height;c++){const u=e.child(c),p=d+u.nodeSize,h=l[c];if(h>0){let f="cell";u.firstChild&&(f=u.firstChild.type.spec.tableRole);const m=[];for(let y=0;y<h;y++){const b=Rt(n.schema)[f].createAndFill();b&&m.push(b)}const g=(c==0||a==c-1)&&i==c?d+1:p-1;r.insert(r.mapping.map(g),m)}d=p}return r.setMeta(TE,{fixTables:!0})}function Nn(n){const e=n.selection,t=kl(n),r=t.node(-1),s=t.start(-1),l=pt.get(r);return{...e instanceof ot?l.rectBetween(e.$anchorCell.pos-s,e.$headCell.pos-s):l.findCell(t.pos-s),tableStart:s,map:l,table:r}}function df(n,{map:e,tableStart:t,table:r},s){let l=s>0?-1:0;SE(e,r,s+l)&&(l=s==0||s==e.width?null:0);for(let a=0;a<e.height;a++){const i=a*e.width+s;if(s>0&&s<e.width&&e.map[i-1]==e.map[i]){const c=e.map[i],d=r.nodeAt(c);n.setNodeMarkup(n.mapping.map(t+c),null,lf(d.attrs,s-e.colCount(c))),a+=d.attrs.rowspan-1}else{const c=l==null?Rt(r.type.schema).cell:r.nodeAt(e.map[i+l]).type,d=e.positionAt(a,s,r);n.insert(n.mapping.map(t+d),c.createAndFill())}}return n}function DE(n,e){if(!kn(n))return!1;if(e){const t=Nn(n);e(df(n.tr,t,t.left))}return!0}function OE(n,e){if(!kn(n))return!1;if(e){const t=Nn(n);e(df(n.tr,t,t.right))}return!0}function IE(n,{map:e,table:t,tableStart:r},s){const l=n.mapping.maps.length;for(let a=0;a<e.height;){const i=a*e.width+s,c=e.map[i],d=t.nodeAt(c),u=d.attrs;if(s>0&&e.map[i-1]==c||s<e.width-1&&e.map[i+1]==c)n.setNodeMarkup(n.mapping.slice(l).map(r+c),null,jr(u,s-e.colCount(c)));else{const p=n.mapping.slice(l).map(r+c);n.delete(p,p+d.nodeSize)}a+=u.rowspan}}function FE(n,e){if(!kn(n))return!1;if(e){const t=Nn(n),r=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let s=t.right-1;IE(r,t,s),s!=t.left;s--){const l=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!l)throw RangeError("No table found");t.table=l,t.map=pt.get(l)}e(r)}return!0}function $E(n,e,t){var r;const s=Rt(e.type.schema).header_cell;for(let l=0;l<n.width;l++)if(((r=e.nodeAt(n.map[l+t*n.width]))==null?void 0:r.type)!=s)return!1;return!0}function uf(n,{map:e,tableStart:t,table:r},s){var l;let a=t;for(let d=0;d<s;d++)a+=r.child(d).nodeSize;const i=[];let c=s>0?-1:0;$E(e,r,s+c)&&(c=s==0||s==e.height?null:0);for(let d=0,u=e.width*s;d<e.width;d++,u++)if(s>0&&s<e.height&&e.map[u]==e.map[u-e.width]){const p=e.map[u],h=r.nodeAt(p).attrs;n.setNodeMarkup(t+p,null,{...h,rowspan:h.rowspan+1}),d+=h.colspan-1}else{const p=c==null?Rt(r.type.schema).cell:(l=r.nodeAt(e.map[u+c*e.width]))==null?void 0:l.type,h=p?.createAndFill();h&&i.push(h)}return n.insert(a,Rt(r.type.schema).row.create(null,i)),n}function RE(n,e){if(!kn(n))return!1;if(e){const t=Nn(n);e(uf(n.tr,t,t.top))}return!0}function PE(n,e){if(!kn(n))return!1;if(e){const t=Nn(n);e(uf(n.tr,t,t.bottom))}return!0}function zE(n,{map:e,table:t,tableStart:r},s){let l=0;for(let d=0;d<s;d++)l+=t.child(d).nodeSize;const a=l+t.child(s).nodeSize,i=n.mapping.maps.length;n.delete(l+r,a+r);const c=new Set;for(let d=0,u=s*e.width;d<e.width;d++,u++){const p=e.map[u];if(!c.has(p)){if(c.add(p),s>0&&p==e.map[u-e.width]){const h=t.nodeAt(p).attrs;n.setNodeMarkup(n.mapping.slice(i).map(p+r),null,{...h,rowspan:h.rowspan-1}),d+=h.colspan-1}else if(s<e.height&&p==e.map[u+e.width]){const h=t.nodeAt(p),f=h.attrs,m=h.type.create({...f,rowspan:h.attrs.rowspan-1},h.content),g=e.positionAt(s+1,d,t);n.insert(n.mapping.slice(i).map(r+g),m),d+=f.colspan-1}}}}function jE(n,e){if(!kn(n))return!1;if(e){const t=Nn(n),r=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let s=t.bottom-1;zE(r,t,s),s!=t.top;s--){const l=t.tableStart?r.doc.nodeAt(t.tableStart-1):r.doc;if(!l)throw RangeError("No table found");t.table=l,t.map=pt.get(t.table)}e(r)}return!0}function pf(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function HE({width:n,height:e,map:t},r){let s=r.top*n+r.left,l=s,a=(r.bottom-1)*n+r.left,i=s+(r.right-r.left-1);for(let c=r.top;c<r.bottom;c++){if(r.left>0&&t[l]==t[l-1]||r.right<n&&t[i]==t[i+1])return!0;l+=n,i+=n}for(let c=r.left;c<r.right;c++){if(r.top>0&&t[s]==t[s-n]||r.bottom<e&&t[a]==t[a+n])return!0;s++,a++}return!1}function hf(n,e){const t=n.selection;if(!(t instanceof ot)||t.$anchorCell.pos==t.$headCell.pos)return!1;const r=Nn(n),{map:s}=r;if(HE(s,r))return!1;if(e){const l=n.tr,a={};let i=ne.empty,c,d;for(let u=r.top;u<r.bottom;u++)for(let p=r.left;p<r.right;p++){const h=s.map[u*s.width+p],f=r.table.nodeAt(h);if(!(a[h]||!f))if(a[h]=!0,c==null)c=h,d=f;else{pf(f)||(i=i.append(f.content));const m=l.mapping.map(h+r.tableStart);l.delete(m,m+f.nodeSize)}}if(c==null||d==null)return!0;if(l.setNodeMarkup(c+r.tableStart,null,{...lf(d.attrs,d.attrs.colspan,r.right-r.left-d.attrs.colspan),rowspan:r.bottom-r.top}),i.size){const u=c+1+d.content.size,p=pf(d)?c+1:u;l.replaceWith(p+r.tableStart,u+r.tableStart,i)}l.setSelection(new ot(l.doc.resolve(c+r.tableStart))),e(l)}return!0}function ff(n,e){const t=Rt(n.schema);return UE(({node:r})=>t[r.type.spec.tableRole])(n,e)}function UE(n){return(e,t)=>{var r;const s=e.selection;let l,a;if(s instanceof ot){if(s.$anchorCell.pos!=s.$headCell.pos)return!1;l=s.$anchorCell.nodeAfter,a=s.$anchorCell.pos}else{if(l=EE(s.$from),!l)return!1;a=(r=mo(s.$from))==null?void 0:r.pos}if(l==null||a==null||l.attrs.colspan==1&&l.attrs.rowspan==1)return!1;if(t){let i=l.attrs;const c=[],d=i.colwidth;i.rowspan>1&&(i={...i,rowspan:1}),i.colspan>1&&(i={...i,colspan:1});const u=Nn(e),p=e.tr;for(let f=0;f<u.right-u.left;f++)c.push(d?{...i,colwidth:d&&d[f]?[d[f]]:null}:i);let h;for(let f=u.top;f<u.bottom;f++){let m=u.map.positionAt(f,u.left,u.table);f==u.top&&(m+=l.nodeSize);for(let g=u.left,y=0;g<u.right;g++,y++)g==u.left&&f==u.top||p.insert(h=p.mapping.map(m+u.tableStart,1),n({node:l,row:f,col:g}).createAndFill(c[y]))}p.setNodeMarkup(a,n({node:l,row:u.top,col:u.left}),c[0]),s instanceof ot&&p.setSelection(new ot(p.doc.resolve(s.$anchorCell.pos),h?p.doc.resolve(h):void 0)),t(p)}return!0}}function WE(n,e){return function(t,r){if(!kn(t))return!1;const s=kl(t);if(s.nodeAfter.attrs[n]===e)return!1;if(r){const l=t.tr;t.selection instanceof ot?t.selection.forEachCell((a,i)=>{a.attrs[n]!==e&&l.setNodeMarkup(i,null,{...a.attrs,[n]:e})}):l.setNodeMarkup(s.pos,null,{...s.nodeAfter.attrs,[n]:e}),r(l)}return!0}}function KE(n){return function(e,t){if(!kn(e))return!1;if(t){const r=Rt(e.schema),s=Nn(e),l=e.tr,a=s.map.cellsInRect(n=="column"?{left:s.left,top:0,right:s.right,bottom:s.map.height}:n=="row"?{left:0,top:s.top,right:s.map.width,bottom:s.bottom}:s),i=a.map(c=>s.table.nodeAt(c));for(let c=0;c<a.length;c++)i[c].type==r.header_cell&&l.setNodeMarkup(s.tableStart+a[c],r.cell,i[c].attrs);if(l.steps.length==0)for(let c=0;c<a.length;c++)l.setNodeMarkup(s.tableStart+a[c],r.header_cell,i[c].attrs);t(l)}return!0}}function mf(n,e,t){const r=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let s=0;s<r.length;s++){const l=e.table.nodeAt(r[s]);if(l&&l.type!==t.header_cell)return!1}return!0}function qo(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?KE(n):function(t,r){if(!kn(t))return!1;if(r){const s=Rt(t.schema),l=Nn(t),a=t.tr,i=mf("row",l,s),c=mf("column",l,s),d=(n==="column"?i:n==="row"&&c)?1:0,u=n=="column"?{left:0,top:d,right:1,bottom:l.map.height}:n=="row"?{left:d,top:0,right:l.map.width,bottom:1}:l,p=n=="column"?c?s.cell:s.header_cell:n=="row"?i?s.cell:s.header_cell:s.cell;l.map.cellsInRect(u).forEach(h=>{const f=h+l.tableStart,m=a.doc.nodeAt(f);m&&a.setNodeMarkup(f,p,m.attrs)}),r(a)}return!0}}qo("row",{useDeprecatedLogic:!0}),qo("column",{useDeprecatedLogic:!0});var qE=qo("cell",{useDeprecatedLogic:!0});function GE(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let r=n.index(-1)-1,s=n.before();r>=0;r--){const l=n.node(-1).child(r),a=l.lastChild;if(a)return s-1-a.nodeSize;s-=l.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let r=n.indexAfter(-1),s=n.after();r<t.childCount;r++){const l=t.child(r);if(l.childCount)return s+1;s+=l.nodeSize}}return null}function gf(n){return function(e,t){if(!kn(e))return!1;const r=GE(kl(e),n);if(r==null)return!1;if(t){const s=e.doc.resolve(r);t(e.tr.setSelection(xe.between(s,_E(s))).scrollIntoView())}return!0}}function YE(n,e){const t=n.selection.$anchor;for(let r=t.depth;r>0;r--)if(t.node(r).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(r),t.after(r)).scrollIntoView()),!0;return!1}function wl(n,e){const t=n.selection;if(!(t instanceof ot))return!1;if(e){const r=n.tr,s=Rt(n.schema).cell.createAndFill().content;t.forEachCell((l,a)=>{l.content.eq(s)||r.replace(r.mapping.map(a+1),r.mapping.map(a+l.nodeSize-1),new de(s,0,0))}),r.docChanged&&e(r)}return!0}function JE(n){if(!n.size)return null;let{content:e,openStart:t,openEnd:r}=n;for(;e.childCount==1&&(t>0&&r>0||e.child(0).type.spec.tableRole=="table");)t--,r--,e=e.child(0).content;const s=e.child(0),l=s.type.spec.tableRole,a=s.type.schema,i=[];if(l=="row")for(let c=0;c<e.childCount;c++){let d=e.child(c).content;const u=c?0:Math.max(0,t-1),p=c<e.childCount-1?0:Math.max(0,r-1);(u||p)&&(d=ac(Rt(a).row,new de(d,u,p)).content),i.push(d)}else if(l=="cell"||l=="header_cell")i.push(t||r?ac(Rt(a).row,new de(e,t,r)).content:e);else return null;return ZE(a,i)}function ZE(n,e){const t=[];for(let s=0;s<e.length;s++){const l=e[s];for(let a=l.childCount-1;a>=0;a--){const{rowspan:i,colspan:c}=l.child(a).attrs;for(let d=s;d<s+i;d++)t[d]=(t[d]||0)+c}}let r=0;for(let s=0;s<t.length;s++)r=Math.max(r,t[s]);for(let s=0;s<t.length;s++)if(s>=e.length&&e.push(ne.empty),t[s]<r){const l=Rt(n).cell.createAndFill(),a=[];for(let i=t[s];i<r;i++)a.push(l);e[s]=e[s].append(ne.from(a))}return{height:e.length,width:r,rows:e}}function ac(n,e){const t=n.createAndFill();return new si(t).replace(0,t.content.size,e).doc}function XE({width:n,height:e,rows:t},r,s){if(n!=r){const l=[],a=[];for(let i=0;i<t.length;i++){const c=t[i],d=[];for(let u=l[i]||0,p=0;u<r;p++){let h=c.child(p%c.childCount);u+h.attrs.colspan>r&&(h=h.type.createChecked(jr(h.attrs,h.attrs.colspan,u+h.attrs.colspan-r),h.content)),d.push(h),u+=h.attrs.colspan;for(let f=1;f<h.attrs.rowspan;f++)l[i+f]=(l[i+f]||0)+h.attrs.colspan}a.push(ne.from(d))}t=a,n=r}if(e!=s){const l=[];for(let a=0,i=0;a<s;a++,i++){const c=[],d=t[i%e];for(let u=0;u<d.childCount;u++){let p=d.child(u);a+p.attrs.rowspan>s&&(p=p.type.create({...p.attrs,rowspan:Math.max(1,s-p.attrs.rowspan)},p.content)),c.push(p)}l.push(ne.from(c))}t=l,e=s}return{width:n,height:e,rows:t}}function QE(n,e,t,r,s,l,a){const i=n.doc.type.schema,c=Rt(i);let d,u;if(s>e.width)for(let p=0,h=0;p<e.height;p++){const f=t.child(p);h+=f.nodeSize;const m=[];let g;f.lastChild==null||f.lastChild.type==c.cell?g=d||(d=c.cell.createAndFill()):g=u||(u=c.header_cell.createAndFill());for(let y=e.width;y<s;y++)m.push(g);n.insert(n.mapping.slice(a).map(h-1+r),m)}if(l>e.height){const p=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,s);m++){const y=m>=e.width?!1:t.nodeAt(e.map[g+m]).type==c.header_cell;p.push(y?u||(u=c.header_cell.createAndFill()):d||(d=c.cell.createAndFill()))}const h=c.row.create(null,ne.from(p)),f=[];for(let m=e.height;m<l;m++)f.push(h);n.insert(n.mapping.slice(a).map(r+t.nodeSize-2),f)}return!!(d||u)}function yf(n,e,t,r,s,l,a,i){if(a==0||a==e.height)return!1;let c=!1;for(let d=s;d<l;d++){const u=a*e.width+d,p=e.map[u];if(e.map[u-e.width]==p){c=!0;const h=t.nodeAt(p),{top:f,left:m}=e.findCell(p);n.setNodeMarkup(n.mapping.slice(i).map(p+r),null,{...h.attrs,rowspan:a-f}),n.insert(n.mapping.slice(i).map(e.positionAt(a,m,t)),h.type.createAndFill({...h.attrs,rowspan:f+h.attrs.rowspan-a})),d+=h.attrs.colspan-1}}return c}function bf(n,e,t,r,s,l,a,i){if(a==0||a==e.width)return!1;let c=!1;for(let d=s;d<l;d++){const u=d*e.width+a,p=e.map[u];if(e.map[u-1]==p){c=!0;const h=t.nodeAt(p),f=e.colCount(p),m=n.mapping.slice(i).map(p+r);n.setNodeMarkup(m,null,jr(h.attrs,a-f,h.attrs.colspan-(a-f))),n.insert(m+h.nodeSize,h.type.createAndFill(jr(h.attrs,0,a-f))),d+=h.attrs.rowspan-1}}return c}function kf(n,e,t,r,s){let l=t?n.doc.nodeAt(t-1):n.doc;if(!l)throw new Error("No table found");let a=pt.get(l);const{top:i,left:c}=r,d=c+s.width,u=i+s.height,p=n.tr;let h=0;function f(){if(l=t?p.doc.nodeAt(t-1):p.doc,!l)throw new Error("No table found");a=pt.get(l),h=p.mapping.maps.length}QE(p,a,l,t,d,u,h)&&f(),yf(p,a,l,t,c,d,i,h)&&f(),yf(p,a,l,t,c,d,u,h)&&f(),bf(p,a,l,t,i,u,c,h)&&f(),bf(p,a,l,t,i,u,d,h)&&f();for(let m=i;m<u;m++){const g=a.positionAt(m,c,l),y=a.positionAt(m,d,l);p.replace(p.mapping.slice(h).map(g+t),p.mapping.slice(h).map(y+t),new de(s.rows[m-i],0,0))}f(),p.setSelection(new ot(p.doc.resolve(t+a.positionAt(i,c,l)),p.doc.resolve(t+a.positionAt(u-1,d-1,l)))),e(p)}var eC=Ii({ArrowLeft:vl("horiz",-1),ArrowRight:vl("horiz",1),ArrowUp:vl("vert",-1),ArrowDown:vl("vert",1),"Shift-ArrowLeft":El("horiz",-1),"Shift-ArrowRight":El("horiz",1),"Shift-ArrowUp":El("vert",-1),"Shift-ArrowDown":El("vert",1),Backspace:wl,"Mod-Backspace":wl,Delete:wl,"Mod-Delete":wl});function xl(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function vl(n,e){return(t,r,s)=>{if(!s)return!1;const l=t.selection;if(l instanceof ot)return xl(t,r,_e.near(l.$headCell,e));if(n!="horiz"&&!l.empty)return!1;const a=wf(s,n,e);if(a==null)return!1;if(n=="horiz")return xl(t,r,_e.near(t.doc.resolve(l.head+e),e));{const i=t.doc.resolve(a),c=sf(i,n,e);let d;return c?d=_e.near(c,1):e<0?d=_e.near(t.doc.resolve(i.before(-1)),-1):d=_e.near(t.doc.resolve(i.after(-1)),1),xl(t,r,d)}}}function El(n,e){return(t,r,s)=>{if(!s)return!1;const l=t.selection;let a;if(l instanceof ot)a=l;else{const c=wf(s,n,e);if(c==null)return!1;a=new ot(t.doc.resolve(c))}const i=sf(a.$headCell,n,e);return i?xl(t,r,new ot(a.$anchorCell,i)):!1}}function tC(n,e){const t=n.state.doc,r=mo(t.resolve(e));return r?(n.dispatch(n.state.tr.setSelection(new ot(r))),!0):!1}function nC(n,e,t){if(!kn(n.state))return!1;let r=JE(t);const s=n.state.selection;if(s instanceof ot){r||(r={width:1,height:1,rows:[ne.from(ac(Rt(n.state.schema).cell,t))]});const l=s.$anchorCell.node(-1),a=s.$anchorCell.start(-1),i=pt.get(l).rectBetween(s.$anchorCell.pos-a,s.$headCell.pos-a);return r=XE(r,i.right-i.left,i.bottom-i.top),kf(n.state,n.dispatch,a,i,r),!0}else if(r){const l=kl(n.state),a=l.start(-1);return kf(n.state,n.dispatch,a,pt.get(l.node(-1)).findCell(l.pos-a),r),!0}else return!1}function rC(n,e){var t;if(e.ctrlKey||e.metaKey)return;const r=xf(n,e.target);let s;if(e.shiftKey&&n.state.selection instanceof ot)l(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(s=mo(n.state.selection.$anchor))!=null&&((t=ic(n,e))==null?void 0:t.pos)!=s.pos)l(s,e),e.preventDefault();else if(!r)return;function l(c,d){let u=ic(n,d);const p=gr.getState(n.state)==null;if(!u||!lc(c,u))if(p)u=c;else return;const h=new ot(c,u);if(p||!n.state.selection.eq(h)){const f=n.state.tr.setSelection(h);p&&f.setMeta(gr,c.pos),n.dispatch(f)}}function a(){n.root.removeEventListener("mouseup",a),n.root.removeEventListener("dragstart",a),n.root.removeEventListener("mousemove",i),gr.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(gr,-1))}function i(c){const d=c,u=gr.getState(n.state);let p;if(u!=null)p=n.state.doc.resolve(u);else if(xf(n,d.target)!=r&&(p=ic(n,e),!p))return a();p&&l(p,d)}n.root.addEventListener("mouseup",a),n.root.addEventListener("dragstart",a),n.root.addEventListener("mousemove",i)}function wf(n,e,t){if(!(n.state.selection instanceof xe))return null;const{$head:r}=n.state.selection;for(let s=r.depth-1;s>=0;s--){const l=r.node(s);if((t<0?r.index(s):r.indexAfter(s))!=(t<0?0:l.childCount))return null;if(l.type.spec.tableRole=="cell"||l.type.spec.tableRole=="header_cell"){const a=r.before(s),i=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(i)?a:null}}return null}function xf(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function ic(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});return t&&t?mo(n.state.doc.resolve(t.pos)):null}var oC=class{constructor(n,e){this.node=n,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),cc(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,cc(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function cc(n,e,t,r,s,l){var a;let i=0,c=!0,d=e.firstChild;const u=n.firstChild;if(u){for(let p=0,h=0;p<u.childCount;p++){const{colspan:f,colwidth:m}=u.child(p).attrs;for(let g=0;g<f;g++,h++){const y=s==h?l:m&&m[g],b=y?y+"px":"";if(i+=y||r,y||(c=!1),d)d.style.width!=b&&(d.style.width=b),d=d.nextSibling;else{const k=document.createElement("col");k.style.width=b,e.appendChild(k)}}}for(;d;){const p=d.nextSibling;(a=d.parentNode)==null||a.removeChild(d),d=p}c?(t.style.width=i+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=i+"px")}}var tn=new mt("tableColumnResizing");function sC({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:r=oC,lastColumnResizable:s=!0}={}){const l=new ct({key:tn,state:{init(a,i){var c,d;const u=(d=(c=l.spec)==null?void 0:c.props)==null?void 0:d.nodeViews,p=Rt(i.schema).table.name;return r&&u&&(u[p]=(h,f)=>new r(h,t,f)),new lC(-1,!1)},apply(a,i){return i.apply(a)}},props:{attributes:a=>{const i=tn.getState(a);return i&&i.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(a,i)=>{aC(a,i,n,s)},mouseleave:a=>{iC(a)},mousedown:(a,i)=>{cC(a,i,e,t)}},decorations:a=>{const i=tn.getState(a);if(i&&i.activeHandle>-1)return fC(a,i.activeHandle)},nodeViews:{}}});return l}var lC=class Fa{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,r=e.getMeta(tn);if(r&&r.setHandle!=null)return new Fa(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Fa(t.activeHandle,r.setDragging);if(t.activeHandle>-1&&e.docChanged){let s=e.mapping.map(t.activeHandle,-1);return sc(e.doc.resolve(s))||(s=-1),new Fa(s,t.dragging)}return t}};function aC(n,e,t,r){if(!n.editable)return;const s=tn.getState(n.state);if(s&&!s.dragging){const l=uC(e.target);let a=-1;if(l){const{left:i,right:c}=l.getBoundingClientRect();e.clientX-i<=t?a=vf(n,e,"left",t):c-e.clientX<=t&&(a=vf(n,e,"right",t))}if(a!=s.activeHandle){if(!r&&a!==-1){const i=n.state.doc.resolve(a),c=i.node(-1),d=pt.get(c),u=i.start(-1);if(d.colCount(i.pos-u)+i.nodeAfter.attrs.colspan-1==d.width-1)return}Cf(n,a)}}}function iC(n){if(!n.editable)return;const e=tn.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&Cf(n,-1)}function cC(n,e,t,r){var s;if(!n.editable)return!1;const l=(s=n.dom.ownerDocument.defaultView)!=null?s:window,a=tn.getState(n.state);if(!a||a.activeHandle==-1||a.dragging)return!1;const i=n.state.doc.nodeAt(a.activeHandle),c=dC(n,a.activeHandle,i.attrs);n.dispatch(n.state.tr.setMeta(tn,{setDragging:{startX:e.clientX,startWidth:c}}));function d(p){l.removeEventListener("mouseup",d),l.removeEventListener("mousemove",u);const h=tn.getState(n.state);h?.dragging&&(pC(n,h.activeHandle,Ef(h.dragging,p,t)),n.dispatch(n.state.tr.setMeta(tn,{setDragging:null})))}function u(p){if(!p.which)return d(p);const h=tn.getState(n.state);if(h&&h.dragging){const f=Ef(h.dragging,p,t);_f(n,h.activeHandle,f,r)}}return _f(n,a.activeHandle,c,r),l.addEventListener("mouseup",d),l.addEventListener("mousemove",u),e.preventDefault(),!0}function dC(n,e,{colspan:t,colwidth:r}){const s=r&&r[r.length-1];if(s)return s;const l=n.domAtPos(e);let a=l.node.childNodes[l.offset].offsetWidth,i=t;if(r)for(let c=0;c<t;c++)r[c]&&(a-=r[c],i--);return a/i}function uC(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function vf(n,e,t,r){const s=t=="right"?-r:r,l=n.posAtCoords({left:e.clientX+s,top:e.clientY});if(!l)return-1;const{pos:a}=l,i=mo(n.state.doc.resolve(a));if(!i)return-1;if(t=="right")return i.pos;const c=pt.get(i.node(-1)),d=i.start(-1),u=c.map.indexOf(i.pos-d);return u%c.width==0?-1:d+c.map[u-1]}function Ef(n,e,t){const r=e.clientX-n.startX;return Math.max(t,n.startWidth+r)}function Cf(n,e){n.dispatch(n.state.tr.setMeta(tn,{setHandle:e}))}function pC(n,e,t){const r=n.state.doc.resolve(e),s=r.node(-1),l=pt.get(s),a=r.start(-1),i=l.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,c=n.state.tr;for(let d=0;d<l.height;d++){const u=d*l.width+i;if(d&&l.map[u]==l.map[u-l.width])continue;const p=l.map[u],h=s.nodeAt(p).attrs,f=h.colspan==1?0:i-l.colCount(p);if(h.colwidth&&h.colwidth[f]==t)continue;const m=h.colwidth?h.colwidth.slice():hC(h.colspan);m[f]=t,c.setNodeMarkup(a+p,null,{...h,colwidth:m})}c.docChanged&&n.dispatch(c)}function _f(n,e,t,r){const s=n.state.doc.resolve(e),l=s.node(-1),a=s.start(-1),i=pt.get(l).colCount(s.pos-a)+s.nodeAfter.attrs.colspan-1;let c=n.domAtPos(s.start(-1)).node;for(;c&&c.nodeName!="TABLE";)c=c.parentNode;c&&cc(l,c.firstChild,c,r,i,t)}function hC(n){return Array(n).fill(0)}function fC(n,e){var t;const r=[],s=n.doc.resolve(e),l=s.node(-1);if(!l)return rt.empty;const a=pt.get(l),i=s.start(-1),c=a.colCount(s.pos-i)+s.nodeAfter.attrs.colspan-1;for(let d=0;d<a.height;d++){const u=c+d*a.width;if((c==a.width-1||a.map[u]!=a.map[u+1])&&(d==0||a.map[u]!=a.map[u-a.width])){const p=a.map[u],h=i+p+l.nodeAt(p).nodeSize-1,f=document.createElement("div");f.className="column-resize-handle",(t=tn.getState(n))!=null&&t.dragging&&r.push(Ct.node(i+p,i+p+l.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),r.push(Ct.widget(h,f))}}return rt.create(n.doc,r)}function mC({allowTableNodeSelection:n=!1}={}){return new ct({key:gr,state:{init(){return null},apply(e,t){const r=e.getMeta(gr);if(r!=null)return r==-1?null:r;if(t==null||!e.docChanged)return t;const{deleted:s,pos:l}=e.mapping.mapResult(t);return s?null:l}},props:{decorations:VE,handleDOMEvents:{mousedown:rC},createSelectionBetween(e){return gr.getState(e.state)!=null?e.state.selection:null},handleTripleClick:tC,handleKeyDown:eC,handlePaste:nC},appendTransaction(e,t,r){return AE(r,cf(r,t),n)}})}var Sf=wt.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{var e,t;const r=n.getAttribute("colwidth"),s=r?r.split(",").map(l=>parseInt(l,10)):null;if(!s){const l=(e=n.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),a=Array.from(((t=n.parentElement)==null?void 0:t.children)||[]).indexOf(n);if(a&&a>-1&&l&&l[a]){const i=l[a].getAttribute("width");return i?[parseInt(i,10)]:null}}return s}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",Ze(this.options.HTMLAttributes,n),0]}}),Nf=wt.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(t=>parseInt(t,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",Ze(this.options.HTMLAttributes,n),0]}}),Vf=wt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",Ze(this.options.HTMLAttributes,n),0]}});function dc(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function Mf(n,e,t,r,s,l){var a;let i=0,c=!0,d=e.firstChild;const u=n.firstChild;if(u!==null)for(let p=0,h=0;p<u.childCount;p+=1){const{colspan:f,colwidth:m}=u.child(p).attrs;for(let g=0;g<f;g+=1,h+=1){const y=s===h?l:m&&m[g],b=y?`${y}px`:"";if(i+=y||r,y||(c=!1),d){if(d.style.width!==b){const[k,x]=dc(r,y);d.style.setProperty(k,x)}d=d.nextSibling}else{const k=document.createElement("col"),[x,w]=dc(r,y);k.style.setProperty(x,w),e.appendChild(k)}}}for(;d;){const p=d.nextSibling;(a=d.parentNode)==null||a.removeChild(d),d=p}c?(t.style.width=`${i}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${i}px`)}var gC=class{constructor(n,e){this.node=n,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Mf(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!==this.node.type?!1:(this.node=n,Mf(n,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(n){const e=n.target,t=this.dom.contains(e),r=this.contentDOM.contains(e);return!!(t&&!r&&(n.type==="attributes"||n.type==="childList"||n.type==="characterData"))}};function yC(n,e,t,r){let s=0,l=!0;const a=[],i=n.firstChild;if(!i)return{};for(let u=0,p=0;u<i.childCount;u+=1){const{colspan:h,colwidth:f}=i.child(u).attrs;for(let m=0;m<h;m+=1,p+=1){const g=t===p?r:f&&f[m];s+=g||e,g||(l=!1);const[y,b]=dc(e,g);a.push(["col",{style:`${y}: ${b}`}])}}const c=l?`${s}px`:"",d=l?"":`${s}px`;return{colgroup:["colgroup",{},...a],tableWidth:c,tableMinWidth:d}}function Bf(n,e){return n.createAndFill()}function bC(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const r=n.nodes[t];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),n.cached.tableNodeTypes=e,e}function kC(n,e,t,r,s){const l=bC(n),a=[],i=[];for(let d=0;d<t;d+=1){const u=Bf(l.cell);if(u&&i.push(u),r){const p=Bf(l.header_cell);p&&a.push(p)}}const c=[];for(let d=0;d<e;d+=1)c.push(l.row.createChecked(null,r&&d===0?a:i));return l.table.createChecked(null,c)}function wC(n){return n instanceof ot}var Cl=({editor:n})=>{const{selection:e}=n.state;if(!wC(e))return!1;let t=0;return Eh(e.ranges[0].$from,s=>s.type.name==="table")?.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},Af=wt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:gC,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){const{colgroup:t,tableWidth:r,tableMinWidth:s}=yC(n,this.options.cellMinWidth);return["table",Ze(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${s}`}),t,["tbody",0]]},addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:r,dispatch:s,editor:l})=>{const a=kC(l.schema,n,e,t);if(s){const i=r.selection.from+1;r.replaceSelectionWith(a).scrollIntoView().setSelection(xe.near(r.doc.resolve(i)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>DE(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>OE(n,e),deleteColumn:()=>({state:n,dispatch:e})=>FE(n,e),addRowBefore:()=>({state:n,dispatch:e})=>RE(n,e),addRowAfter:()=>({state:n,dispatch:e})=>PE(n,e),deleteRow:()=>({state:n,dispatch:e})=>jE(n,e),deleteTable:()=>({state:n,dispatch:e})=>YE(n,e),mergeCells:()=>({state:n,dispatch:e})=>hf(n,e),splitCell:()=>({state:n,dispatch:e})=>ff(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>qo("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>qo("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>qE(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>hf(n,e)?!0:ff(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:r})=>WE(n,e)(t,r),goToNextCell:()=>({state:n,dispatch:e})=>gf(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>gf(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&cf(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const r=ot.create(e.doc,n.anchorCell,n.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Cl,"Mod-Backspace":Cl,Delete:Cl,"Mod-Delete":Cl}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[sC({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],mC({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:Ye(ke(n,"tableRole",e))}}}),xC=Xe.create({name:"tableKit",addExtensions(){const n=[];return this.options.table!==!1&&n.push(Af.configure(this.options.table)),this.options.tableCell!==!1&&n.push(Sf.configure(this.options.tableCell)),this.options.tableHeader!==!1&&n.push(Nf.configure(this.options.tableHeader)),this.options.tableRow!==!1&&n.push(Vf.configure(this.options.tableRow)),n}});const vC=Af.extend({renderHTML({HTMLAttributes:n}){return["div",{style:"overflow-x: auto;"},["table",n,0]]},parseHTML(){return[{tag:"div.table-wrapper table",priority:100},{tag:"table"}]}}),EC=xC.extend({addExtensions(){return[vC.configure({HTMLAttributes:{class:"editor-content"},resizable:!0}),Vf,Sf,Nf]}});var CC=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,_C=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,SC=bn.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",Ze(this.options.HTMLAttributes,n),0]},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[zr({find:CC,type:this.type})]},addPasteRules(){return[mr({find:_C,type:this.type})]}}),NC=bn.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",Ze(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),VC=bn.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",Ze(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),_l=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...r}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,r,t]},MC=/^\s*>\s$/,BC=wt.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return _l("blockquote",{...Ze(this.options.HTMLAttributes,n),children:_l("slot",{})})},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[fo({find:MC,type:this.type})]}}),AC=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,TC=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,LC=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,DC=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,OC=bn.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return _l("strong",{...Ze(this.options.HTMLAttributes,n),children:_l("slot",{})})},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[zr({find:AC,type:this.type}),zr({find:LC,type:this.type})]},addPasteRules(){return[mr({find:TC,type:this.type}),mr({find:DC,type:this.type})]}}),IC=/(^|[^`])`([^`]+)`(?!`)$/,FC=/(^|[^`])`([^`]+)`(?!`)/g,$C=bn.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",Ze(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[zr({find:IC,type:this.type})]},addPasteRules(){return[mr({find:FC,type:this.type})]}}),RC=/^```([a-z]+)?[\s\n]$/,PC=/^~~~([a-z]+)?[\s\n]$/,zC=wt.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;return[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(s=>s.startsWith(t)).map(s=>s.replace(t,""))[0]||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",Ze(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{if(!this.options.enableTabIndentation)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:s}=t;if(r.parent.type!==this.type)return!1;const l=" ".repeat(this.options.tabSize);return s?n.commands.insertContent(l):n.commands.command(({tr:a})=>{const{from:i,to:c}=t,d=e.doc.textBetween(i,c,`
|
|
86
|
+
`,`
|
|
87
|
+
`).split(`
|
|
88
|
+
`).map(u=>l+u).join(`
|
|
89
|
+
`);return a.replaceWith(i,c,e.schema.text(d)),!0})},"Shift-Tab":({editor:n})=>{if(!this.options.enableTabIndentation)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:s}=t;return r.parent.type!==this.type?!1:s?n.commands.command(({tr:l})=>{var a;const{pos:i}=r,c=r.start(),d=r.end(),u=e.doc.textBetween(c,d,`
|
|
90
|
+
`,`
|
|
91
|
+
`).split(`
|
|
92
|
+
`);let p=0,h=0;const f=i-c;for(let b=0;b<u.length;b+=1){if(h+u[b].length>=f){p=b;break}h+=u[b].length+1}const m=((a=u[p].match(/^ */))==null?void 0:a[0])||"",g=Math.min(m.length,this.options.tabSize);if(g===0)return!0;let y=c;for(let b=0;b<p;b+=1)y+=u[b].length+1;return l.delete(y,y+g),i-y<=g&&l.setSelection(xe.create(l.doc,y)),!0}):n.commands.command(({tr:l})=>{const{from:a,to:i}=t,c=e.doc.textBetween(a,i,`
|
|
93
|
+
`,`
|
|
94
|
+
`).split(`
|
|
95
|
+
`).map(d=>{var u;const p=((u=d.match(/^ */))==null?void 0:u[0])||"",h=Math.min(p.length,this.options.tabSize);return d.slice(h)}).join(`
|
|
96
|
+
`);return l.replaceWith(a,i,e.schema.text(c)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:r,empty:s}=t;if(!s||r.parent.type!==this.type)return!1;const l=r.parentOffset===r.parent.nodeSize-2,a=r.parent.textContent.endsWith(`
|
|
97
|
+
|
|
98
|
+
`);return!l||!a?!1:n.chain().command(({tr:i})=>(i.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:r}=e,{$from:s,empty:l}=t;if(!l||s.parent.type!==this.type||s.parentOffset!==s.parent.nodeSize-2)return!1;const a=s.after();return a===void 0?!1:r.nodeAt(a)?n.commands.command(({tr:i})=>(i.setSelection(_e.near(r.resolve(a))),!0)):n.commands.exitCode()}}},addInputRules(){return[tc({find:RC,type:this.type,getAttributes:n=>({language:n[1]})}),tc({find:PC,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new ct({key:new mt("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),s=r?JSON.parse(r):void 0,l=s?.mode;if(!t||!l)return!1;const{tr:a,schema:i}=n.state,c=i.text(t.replace(/\r\n?/g,`
|
|
99
|
+
`));return a.replaceSelectionWith(this.type.create({language:l},c)),a.selection.$from.parent.type!==this.type&&a.setSelection(xe.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta("paste",!0),n.dispatch(a),!0}}})]}}),jC=wt.create({name:"doc",topNode:!0,content:"block+"}),HC=wt.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",Ze(this.options.HTMLAttributes,n)]},renderText(){return`
|
|
100
|
+
`},addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:s,storedMarks:l}=t;if(s.$from.parent.type.spec.isolating)return!1;const{keepMarks:a}=this.options,{splittableMarks:i}=r.extensionManager,c=l||s.$to.parentOffset&&s.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:u})=>{if(u&&c&&a){const p=c.filter(h=>i.includes(h.type.name));d.ensureMarks(p)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Tf=wt.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,Ze(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>tc({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),UC=wt.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",Ze(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!lE(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:r}=t,s=n();return $h(t)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command(({tr:l,dispatch:a})=>{var i;if(a){const{$to:c}=l.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?l.setSelection(xe.create(l.doc,c.pos+1)):c.nodeAfter.isBlock?l.setSelection(we.create(l.doc,c.pos)):l.setSelection(xe.create(l.doc,c.pos));else{const u=(i=c.parent.type.contentMatch.defaultType)==null?void 0:i.create();u&&(l.insert(d,u),l.setSelection(xe.create(l.doc,d+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[nf({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),WC=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,KC=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,qC=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,GC=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,YC=bn.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",Ze(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[zr({find:WC,type:this.type}),zr({find:qC,type:this.type})]},addPasteRules(){return[mr({find:KC,type:this.type}),mr({find:GC,type:this.type})]}});const JC="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",ZC="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",uc="numeric",pc="ascii",hc="alpha",Go="asciinumeric",Yo="alphanumeric",fc="domain",Lf="emoji",XC="scheme",QC="slashscheme",mc="whitespace";function e_(n,e){return n in e||(e[n]=[]),e[n]}function Hr(n,e,t){e[uc]&&(e[Go]=!0,e[Yo]=!0),e[pc]&&(e[Go]=!0,e[hc]=!0),e[Go]&&(e[Yo]=!0),e[hc]&&(e[Yo]=!0),e[Yo]&&(e[fc]=!0),e[Lf]&&(e[fc]=!0);for(const r in e){const s=e_(r,t);s.indexOf(n)<0&&s.push(n)}}function t_(n,e){const t={};for(const r in e)e[r].indexOf(n)>=0&&(t[r]=!0);return t}function Gt(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}Gt.groups={},Gt.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let r=0;r<e.jr.length;r++){const s=e.jr[r][0],l=e.jr[r][1];if(l&&s.test(n))return l}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,r){for(let s=0;s<n.length;s++)this.tt(n[s],e,t,r)},tr(n,e,t,r){r=r||Gt.groups;let s;return e&&e.j?s=e:(s=new Gt(e),t&&r&&Hr(e,t,r)),this.jr.push([n,s]),s},ts(n,e,t,r){let s=this;const l=n.length;if(!l)return s;for(let a=0;a<l-1;a++)s=s.tt(n[a]);return s.tt(n[l-1],e,t,r)},tt(n,e,t,r){r=r||Gt.groups;const s=this;if(e&&e.j)return s.j[n]=e,e;const l=e;let a,i=s.go(n);if(i?(a=new Gt,Object.assign(a.j,i.j),a.jr.push.apply(a.jr,i.jr),a.jd=i.jd,a.t=i.t):a=new Gt,l){if(r)if(a.t&&typeof a.t=="string"){const c=Object.assign(t_(a.t,r),t);Hr(l,c,r)}else t&&Hr(l,t,r);a.t=l}return s.j[n]=a,a}};const Ie=(n,e,t,r,s)=>n.ta(e,t,r,s),ht=(n,e,t,r,s)=>n.tr(e,t,r,s),Df=(n,e,t,r,s)=>n.ts(e,t,r,s),oe=(n,e,t,r,s)=>n.tt(e,t,r,s),Gn="WORD",gc="UWORD",Of="ASCIINUMERICAL",If="ALPHANUMERICAL",Jo="LOCALHOST",yc="TLD",bc="UTLD",Sl="SCHEME",go="SLASH_SCHEME",kc="NUM",wc="WS",xc="NL",Zo="OPENBRACE",Xo="CLOSEBRACE",Nl="OPENBRACKET",Vl="CLOSEBRACKET",Ml="OPENPAREN",Bl="CLOSEPAREN",Al="OPENANGLEBRACKET",Tl="CLOSEANGLEBRACKET",Ll="FULLWIDTHLEFTPAREN",Dl="FULLWIDTHRIGHTPAREN",Ol="LEFTCORNERBRACKET",Il="RIGHTCORNERBRACKET",Fl="LEFTWHITECORNERBRACKET",$l="RIGHTWHITECORNERBRACKET",Rl="FULLWIDTHLESSTHAN",Pl="FULLWIDTHGREATERTHAN",zl="AMPERSAND",jl="APOSTROPHE",Hl="ASTERISK",yr="AT",Ul="BACKSLASH",Wl="BACKTICK",Kl="CARET",br="COLON",vc="COMMA",ql="DOLLAR",Vn="DOT",Gl="EQUALS",Ec="EXCLAMATION",pn="HYPHEN",Qo="PERCENT",Yl="PIPE",Jl="PLUS",Zl="POUND",es="QUERY",Cc="QUOTE",Ff="FULLWIDTHMIDDLEDOT",_c="SEMI",Mn="SLASH",ts="TILDE",Xl="UNDERSCORE",$f="EMOJI",Ql="SYM";var Rf=Object.freeze({__proto__:null,ALPHANUMERICAL:If,AMPERSAND:zl,APOSTROPHE:jl,ASCIINUMERICAL:Of,ASTERISK:Hl,AT:yr,BACKSLASH:Ul,BACKTICK:Wl,CARET:Kl,CLOSEANGLEBRACKET:Tl,CLOSEBRACE:Xo,CLOSEBRACKET:Vl,CLOSEPAREN:Bl,COLON:br,COMMA:vc,DOLLAR:ql,DOT:Vn,EMOJI:$f,EQUALS:Gl,EXCLAMATION:Ec,FULLWIDTHGREATERTHAN:Pl,FULLWIDTHLEFTPAREN:Ll,FULLWIDTHLESSTHAN:Rl,FULLWIDTHMIDDLEDOT:Ff,FULLWIDTHRIGHTPAREN:Dl,HYPHEN:pn,LEFTCORNERBRACKET:Ol,LEFTWHITECORNERBRACKET:Fl,LOCALHOST:Jo,NL:xc,NUM:kc,OPENANGLEBRACKET:Al,OPENBRACE:Zo,OPENBRACKET:Nl,OPENPAREN:Ml,PERCENT:Qo,PIPE:Yl,PLUS:Jl,POUND:Zl,QUERY:es,QUOTE:Cc,RIGHTCORNERBRACKET:Il,RIGHTWHITECORNERBRACKET:$l,SCHEME:Sl,SEMI:_c,SLASH:Mn,SLASH_SCHEME:go,SYM:Ql,TILDE:ts,TLD:yc,UNDERSCORE:Xl,UTLD:bc,UWORD:gc,WORD:Gn,WS:wc});const Yn=/[a-z]/,ns=new RegExp("\\p{L}","u"),Sc=new RegExp("\\p{Emoji}","u"),Jn=/\d/,Nc=/\s/,Pf="\r",Vc=`
|
|
101
|
+
`,n_="️",r_="",Mc="";let ea=null,ta=null;function o_(n=[]){const e={};Gt.groups=e;const t=new Gt;ea==null&&(ea=jf(JC)),ta==null&&(ta=jf(ZC)),oe(t,"'",jl),oe(t,"{",Zo),oe(t,"}",Xo),oe(t,"[",Nl),oe(t,"]",Vl),oe(t,"(",Ml),oe(t,")",Bl),oe(t,"<",Al),oe(t,">",Tl),oe(t,"(",Ll),oe(t,")",Dl),oe(t,"「",Ol),oe(t,"」",Il),oe(t,"『",Fl),oe(t,"』",$l),oe(t,"<",Rl),oe(t,">",Pl),oe(t,"&",zl),oe(t,"*",Hl),oe(t,"@",yr),oe(t,"`",Wl),oe(t,"^",Kl),oe(t,":",br),oe(t,",",vc),oe(t,"$",ql),oe(t,".",Vn),oe(t,"=",Gl),oe(t,"!",Ec),oe(t,"-",pn),oe(t,"%",Qo),oe(t,"|",Yl),oe(t,"+",Jl),oe(t,"#",Zl),oe(t,"?",es),oe(t,'"',Cc),oe(t,"/",Mn),oe(t,";",_c),oe(t,"~",ts),oe(t,"_",Xl),oe(t,"\\",Ul),oe(t,"・",Ff);const r=ht(t,Jn,kc,{[uc]:!0});ht(r,Jn,r);const s=ht(r,Yn,Of,{[Go]:!0}),l=ht(r,ns,If,{[Yo]:!0}),a=ht(t,Yn,Gn,{[pc]:!0});ht(a,Jn,s),ht(a,Yn,a),ht(s,Jn,s),ht(s,Yn,s);const i=ht(t,ns,gc,{[hc]:!0});ht(i,Yn),ht(i,Jn,l),ht(i,ns,i),ht(l,Jn,l),ht(l,Yn),ht(l,ns,l);const c=oe(t,Vc,xc,{[mc]:!0}),d=oe(t,Pf,wc,{[mc]:!0}),u=ht(t,Nc,wc,{[mc]:!0});oe(t,Mc,u),oe(d,Vc,c),oe(d,Mc,u),ht(d,Nc,u),oe(u,Pf),oe(u,Vc),ht(u,Nc,u),oe(u,Mc,u);const p=ht(t,Sc,$f,{[Lf]:!0});oe(p,"#"),ht(p,Sc,p),oe(p,n_,p);const h=oe(p,r_);oe(h,"#"),ht(h,Sc,p);const f=[[Yn,a],[Jn,s]],m=[[Yn,null],[ns,i],[Jn,l]];for(let g=0;g<ea.length;g++)kr(t,ea[g],yc,Gn,f);for(let g=0;g<ta.length;g++)kr(t,ta[g],bc,gc,m);Hr(yc,{tld:!0,ascii:!0},e),Hr(bc,{utld:!0,alpha:!0},e),kr(t,"file",Sl,Gn,f),kr(t,"mailto",Sl,Gn,f),kr(t,"http",go,Gn,f),kr(t,"https",go,Gn,f),kr(t,"ftp",go,Gn,f),kr(t,"ftps",go,Gn,f),Hr(Sl,{scheme:!0,ascii:!0},e),Hr(go,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],b=n[g][1]?{[XC]:!0}:{[QC]:!0};y.indexOf("-")>=0?b[fc]=!0:Yn.test(y)?Jn.test(y)?b[Go]=!0:b[pc]=!0:b[uc]=!0,Df(t,y,y,b)}return Df(t,"localhost",Jo,{ascii:!0}),t.jd=new Gt(Ql),{start:t,tokens:Object.assign({groups:e},Rf)}}function zf(n,e){const t=s_(e.replace(/[A-Z]/g,i=>i.toLowerCase())),r=t.length,s=[];let l=0,a=0;for(;a<r;){let i=n,c=null,d=0,u=null,p=-1,h=-1;for(;a<r&&(c=i.go(t[a]));)i=c,i.accepts()?(p=0,h=0,u=i):p>=0&&(p+=t[a].length,h++),d+=t[a].length,l+=t[a].length,a++;l-=p,a-=h,d-=p,s.push({t:u.t,v:e.slice(l-d,l),s:l-d,e:l})}return s}function s_(n){const e=[],t=n.length;let r=0;for(;r<t;){let s=n.charCodeAt(r),l,a=s<55296||s>56319||r+1===t||(l=n.charCodeAt(r+1))<56320||l>57343?n[r]:n.slice(r,r+2);e.push(a),r+=a.length}return e}function kr(n,e,t,r,s){let l;const a=e.length;for(let i=0;i<a-1;i++){const c=e[i];n.j[c]?l=n.j[c]:(l=new Gt(r),l.jr=s.slice(),n.j[c]=l),n=l}return l=new Gt(t),l.jr=s.slice(),n.j[e[a-1]]=l,l}function jf(n){const e=[],t=[];let r=0,s="0123456789";for(;r<n.length;){let l=0;for(;s.indexOf(n[r+l])>=0;)l++;if(l>0){e.push(t.join(""));for(let a=parseInt(n.substring(r,r+l),10);a>0;a--)t.pop();r+=l}else t.push(n[r]),r++}return e}const rs={defaultProtocol:"http",events:null,format:Hf,formatHref:Hf,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Bc(n,e=null){let t=Object.assign({},rs);n&&(t=Object.assign(t,n instanceof Bc?n.o:n));const r=t.ignoreTags,s=[];for(let l=0;l<r.length;l++)s.push(r[l].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=s}Bc.prototype={o:rs,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let s=this.o[n];return s&&(typeof s=="object"?(s=t.t in s?s[t.t]:rs[n],typeof s=="function"&&r&&(s=s(e,t))):typeof s=="function"&&r&&(s=s(e,t.t,t)),s)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function Hf(n){return n}function Uf(n,e){this.t="token",this.v=n,this.tk=e}Uf.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=rs.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),s=n.get("tagName",t,e),l=this.toFormattedString(n),a={},i=n.get("className",t,e),c=n.get("target",t,e),d=n.get("rel",t,e),u=n.getObj("attributes",t,e),p=n.getObj("events",t,e);return a.href=r,i&&(a.class=i),c&&(a.target=c),d&&(a.rel=d),u&&Object.assign(a,u),{tagName:s,attributes:a,content:l,eventListeners:p}}};function na(n,e){class t extends Uf{constructor(s,l){super(s,l),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const Wf=na("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Kf=na("text"),l_=na("nl"),ra=na("url",{isLink:!0,toHref(n=rs.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Jo&&n[1].t===br}}),hn=n=>new Gt(n);function a_({groups:n}){const e=n.domain.concat([zl,Hl,yr,Ul,Wl,Kl,ql,Gl,pn,kc,Qo,Yl,Jl,Zl,Mn,Ql,ts,Xl]),t=[jl,br,vc,Vn,Ec,Qo,es,Cc,_c,Al,Tl,Zo,Xo,Vl,Nl,Ml,Bl,Ll,Dl,Ol,Il,Fl,$l,Rl,Pl],r=[zl,jl,Hl,Ul,Wl,Kl,ql,Gl,pn,Zo,Xo,Qo,Yl,Jl,Zl,es,Mn,Ql,ts,Xl],s=hn(),l=oe(s,ts);Ie(l,r,l),Ie(l,n.domain,l);const a=hn(),i=hn(),c=hn();Ie(s,n.domain,a),Ie(s,n.scheme,i),Ie(s,n.slashscheme,c),Ie(a,r,l),Ie(a,n.domain,a);const d=oe(a,yr);oe(l,yr,d),oe(i,yr,d),oe(c,yr,d);const u=oe(l,Vn);Ie(u,r,l),Ie(u,n.domain,l);const p=hn();Ie(d,n.domain,p),Ie(p,n.domain,p);const h=oe(p,Vn);Ie(h,n.domain,p);const f=hn(Wf);Ie(h,n.tld,f),Ie(h,n.utld,f),oe(d,Jo,f);const m=oe(p,pn);oe(m,pn,m),Ie(m,n.domain,p),Ie(f,n.domain,p),oe(f,Vn,h),oe(f,pn,m);const g=oe(f,br);Ie(g,n.numeric,Wf);const y=oe(a,pn),b=oe(a,Vn);oe(y,pn,y),Ie(y,n.domain,a),Ie(b,r,l),Ie(b,n.domain,a);const k=hn(ra);Ie(b,n.tld,k),Ie(b,n.utld,k),Ie(k,n.domain,a),Ie(k,r,l),oe(k,Vn,b),oe(k,pn,y),oe(k,yr,d);const x=oe(k,br),w=hn(ra);Ie(x,n.numeric,w);const v=hn(ra),_=hn();Ie(v,e,v),Ie(v,t,_),Ie(_,e,v),Ie(_,t,_),oe(k,Mn,v),oe(w,Mn,v);const E=oe(i,br),S=oe(c,br),I=oe(S,Mn),A=oe(I,Mn);Ie(i,n.domain,a),oe(i,Vn,b),oe(i,pn,y),Ie(c,n.domain,a),oe(c,Vn,b),oe(c,pn,y),Ie(E,n.domain,v),oe(E,Mn,v),oe(E,es,v),Ie(A,n.domain,v),Ie(A,e,v),oe(A,Mn,v);const V=[[Zo,Xo],[Nl,Vl],[Ml,Bl],[Al,Tl],[Ll,Dl],[Ol,Il],[Fl,$l],[Rl,Pl]];for(let M=0;M<V.length;M++){const[U,R]=V[M],$=oe(v,U);oe(_,U,$),oe($,R,v);const D=hn(ra);Ie($,e,D);const P=hn();Ie($,t),Ie(D,e,D),Ie(D,t,P),Ie(P,e,D),Ie(P,t,P),oe(D,R,v),oe(P,R,v)}return oe(s,Jo,k),oe(s,xc,l_),{start:s,tokens:Rf}}function i_(n,e,t){let r=t.length,s=0,l=[],a=[];for(;s<r;){let i=n,c=null,d=null,u=0,p=null,h=-1;for(;s<r&&!(c=i.go(t[s].t));)a.push(t[s++]);for(;s<r&&(d=c||i.go(t[s].t));)c=null,i=d,i.accepts()?(h=0,p=i):h>=0&&h++,s++,u++;if(h<0)s-=u,s<r&&(a.push(t[s]),s++);else{a.length>0&&(l.push(Ac(Kf,e,a)),a=[]),s-=h,u-=h;const f=p.t,m=t.slice(s-u,s);l.push(Ac(f,e,m))}}return a.length>0&&l.push(Ac(Kf,e,a)),l}function Ac(n,e,t){const r=t[0].s,s=t[t.length-1].e,l=e.slice(r,s);return new n(l,t)}const c_=typeof console<"u"&&console&&console.warn||(()=>{}),d_="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",at={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function u_(){return Gt.groups={},at.scanner=null,at.parser=null,at.tokenQueue=[],at.pluginQueue=[],at.customSchemes=[],at.initialized=!1,at}function qf(n,e=!1){if(at.initialized&&c_(`linkifyjs: already initialized - will not register custom scheme "${n}" ${d_}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
|
|
102
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
103
|
+
2. Cannot start or end with "-"
|
|
104
|
+
3. "-" cannot repeat`);at.customSchemes.push([n,e])}function p_(){at.scanner=o_(at.customSchemes);for(let n=0;n<at.tokenQueue.length;n++)at.tokenQueue[n][1]({scanner:at.scanner});at.parser=a_(at.scanner.tokens);for(let n=0;n<at.pluginQueue.length;n++)at.pluginQueue[n][1]({scanner:at.scanner,parser:at.parser});return at.initialized=!0,at}function Tc(n){return at.initialized||p_(),i_(at.parser.start,n,zf(at.scanner.start,n))}Tc.scan=zf;function Gf(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new Bc(t),s=Tc(n),l=[];for(let a=0;a<s.length;a++){const i=s[a];i.isLink&&(!e||i.t===e)&&r.check(i)&&l.push(i.toFormattedObject(r))}return l}var Lc="[\0- -\u2029 ]",h_=new RegExp(Lc),f_=new RegExp(`${Lc}$`),m_=new RegExp(Lc,"g");function g_(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function y_(n){return new ct({key:new mt("autolink"),appendTransaction:(e,t,r)=>{const s=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),l=e.some(c=>c.getMeta("preventAutolink"));if(!s||l)return;const{tr:a}=r,i=xh(t.doc,[...e]);if(Lh(i).forEach(({newRange:c})=>{const d=E2(r.doc,c,h=>h.isTextblock);let u,p;if(d.length>1)u=d[0],p=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ");else if(d.length){const h=r.doc.textBetween(c.from,c.to," "," ");if(!f_.test(h))return;u=d[0],p=r.doc.textBetween(u.pos,c.to,void 0," ")}if(u&&p){const h=p.split(h_).filter(Boolean);if(h.length<=0)return!1;const f=h[h.length-1],m=u.pos+p.lastIndexOf(f);if(!f)return!1;const g=Tc(f).map(y=>y.toObject(n.defaultProtocol));if(!g_(g))return!1;g.filter(y=>y.isLink).map(y=>({...y,from:m+y.start+1,to:m+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>n.validate(y.value)).filter(y=>n.shouldAutoLink(y.value)).forEach(y=>{Gi(y.from,y.to,r.doc).some(b=>b.mark.type===n.type)||a.addMark(y.from,y.to,n.type.create({href:y.href}))})}}),!!a.steps.length)return a}})}function b_(n){return new ct({key:new mt("handleClickLink"),props:{handleClick:(e,t,r)=>{var s,l;if(r.button!==0||!e.editable)return!1;let a=null;if(r.target instanceof HTMLAnchorElement)a=r.target;else{let u=r.target;const p=[];for(;u.nodeName!=="DIV";)p.push(u),u=u.parentNode;a=p.find(h=>h.nodeName==="A")}if(!a)return!1;const i=Th(e.state,n.type.name),c=(s=a?.href)!=null?s:i.href,d=(l=a?.target)!=null?l:i.target;return n.enableClickSelection&&n.editor.commands.extendMarkRange(n.type.name),a&&c?(window.open(c,d),!0):!1}}})}function k_(n){return new ct({key:new mt("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:s}=e,{selection:l}=s,{empty:a}=l;if(a)return!1;let i="";r.content.forEach(d=>{i+=d.textContent});const c=Gf(i,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===i);return!i||!c?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function Ur(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const s=typeof r=="string"?r:r.scheme;s&&t.push(s)}),!n||n.replace(m_,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Yf=bn.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){qf(n);return}qf(n.scheme,n.optionalSlashes)})},onDestroy(){u_()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!Ur(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!Ur(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!Ur(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Ze(this.options.HTMLAttributes,n),0]:["a",Ze(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!Ur(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:r=>!!Ur(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[mr({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,s=Gf(n).filter(l=>l.isLink&&this.options.isAllowedUri(l.value,{defaultValidate:a=>!!Ur(a,t),protocols:t,defaultProtocol:r}));s.length&&s.forEach(l=>e.push({text:l.value,data:{href:l.href},index:l.start}))}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(y_({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:s=>!!Ur(s,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push(b_({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(k_({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),w_=Object.defineProperty,x_=(n,e)=>{for(var t in e)w_(n,t,{get:e[t],enumerable:!0})},v_="listItem",Jf="textStyle",Zf=/^\s*([-+*])\s$/,Xf=wt.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",Ze(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(v_,this.editor.getAttributes(Jf)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=fo({find:Zf,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=fo({find:Zf,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Jf),editor:this.editor})),[n]}}),Qf=wt.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Ze(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),E_={};x_(E_,{findListItemPos:()=>ss,getNextListDepth:()=>Dc,handleBackspace:()=>Oc,handleDelete:()=>Ic,hasListBefore:()=>em,hasListItemAfter:()=>C_,hasListItemBefore:()=>tm,listItemHasSubList:()=>nm,nextListIsDeeper:()=>rm,nextListIsHigher:()=>om});var ss=(n,e)=>{const{$from:t}=e.selection,r=bt(n,e.schema);let s=null,l=t.depth,a=t.pos,i=null;for(;l>0&&i===null;)s=t.node(l),s.type===r?i=l:(l-=1,a-=1);return i===null?null:{$pos:e.doc.resolve(a),depth:i}},Dc=(n,e)=>{const t=ss(n,e);if(!t)return!1;const[,r]=T2(e,n,t.$pos.pos+4);return r},em=(n,e,t)=>{const{$anchor:r}=n.selection,s=Math.max(0,r.pos-2),l=n.doc.resolve(s).node();return!(!l||!t.includes(l.type.name))},tm=(n,e)=>{var t;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-2);return!(s.index()===0||((t=s.nodeBefore)==null?void 0:t.type.name)!==n)},nm=(n,e,t)=>{if(!t)return!1;const r=bt(n,e.schema);let s=!1;return t.descendants(l=>{l.type===r&&(s=!0)}),s},Oc=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!fr(n.state,e)&&em(n.state,e,t)){const{$anchor:a}=n.state.selection,i=n.state.doc.resolve(a.before()-1),c=[];i.node().descendants((p,h)=>{p.type.name===e&&c.push({node:p,pos:h})});const d=c.at(-1);if(!d)return!1;const u=n.state.doc.resolve(i.start()+d.pos+1);return n.chain().cut({from:a.start()-1,to:a.end()+1},u.end()).joinForward().run()}if(!fr(n.state,e)||!I2(n.state))return!1;const r=ss(e,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),l=nm(e,n.state,s);return tm(e,n.state)&&!l?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},rm=(n,e)=>{const t=Dc(n,e),r=ss(n,e);return!r||!t?!1:t>r.depth},om=(n,e)=>{const t=Dc(n,e),r=ss(n,e);return!r||!t?!1:t<r.depth},Ic=(n,e)=>{if(!fr(n.state,e)||!O2(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:s}=t;return!t.empty&&r.sameParent(s)?!1:rm(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():om(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},C_=(n,e)=>{var t;const{$anchor:r}=e.selection,s=e.doc.resolve(r.pos-r.parentOffset-2);return!(s.index()===s.parent.childCount-1||((t=s.nodeAfter)==null?void 0:t.type.name)!==n)},sm=Xe.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Ic(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Ic(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Oc(n,t,r)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:r})=>{n.state.schema.nodes[t]!==void 0&&Oc(n,t,r)&&(e=!0)}),e}}}}),__="listItem",lm="textStyle",am=/^(\d+)\.\s$/,im=wt.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",Ze(this.options.HTMLAttributes,t),0]:["ol",Ze(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(__,this.editor.getAttributes(lm)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=fo({find:am,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=fo({find:am,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(lm)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),S_=/^\s*(\[([( |x])?\])\s$/,N_=wt.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",Ze(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:r})=>{const s=document.createElement("li"),l=document.createElement("label"),a=document.createElement("span"),i=document.createElement("input"),c=document.createElement("div"),d=u=>{var p,h;i.ariaLabel=((h=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:h.call(p,u,i.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return d(n),l.contentEditable="false",i.type="checkbox",i.addEventListener("mousedown",u=>u.preventDefault()),i.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){i.checked=!i.checked;return}const{checked:p}=u.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const f=t();if(typeof f!="number")return!1;const m=h.doc.nodeAt(f);return h.setNodeMarkup(f,void 0,{...m?.attrs,checked:p}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,p)||(i.checked=!i.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,p])=>{s.setAttribute(u,p)}),s.dataset.checked=n.attrs.checked,i.checked=n.attrs.checked,l.append(i,a),s.append(l,c),Object.entries(e).forEach(([u,p])=>{s.setAttribute(u,p)}),{dom:s,contentDOM:c,update:u=>u.type!==this.type?!1:(s.dataset.checked=u.attrs.checked,i.checked=u.attrs.checked,d(u),!0)}}},addInputRules(){return[fo({find:S_,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),V_=wt.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",Ze(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Xe.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Xf.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Qf.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(sm.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(im.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(N_.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(V_.configure(this.options.taskList)),n}});var cm=wt.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",Ze(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),M_=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,B_=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,A_=bn.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",Ze(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[zr({find:M_,type:this.type})]},addPasteRules(){return[mr({find:B_,type:this.type})]}}),T_=wt.create({name:"text",group:"inline"}),L_=bn.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",Ze(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function D_(n={}){return new ct({view(e){return new O_(e,n)}})}class O_{constructor(e,t){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=t.width)!==null&&r!==void 0?r:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(s=>{let l=a=>{this[s](a)};return e.dom.addEventListener(s,l),{name:s,handler:l}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,r,s=this.editorView.dom,l=s.getBoundingClientRect(),a=l.width/s.offsetWidth,i=l.height/s.offsetHeight;if(t){let p=e.nodeBefore,h=e.nodeAfter;if(p||h){let f=this.editorView.nodeDOM(this.cursorPos-(p?p.nodeSize:0));if(f){let m=f.getBoundingClientRect(),g=p?m.bottom:m.top;p&&h&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*i;r={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!r){let p=this.editorView.coordsAtPos(this.cursorPos),h=this.width/2*a;r={left:p.left-h,right:p.left+h,top:p.top,bottom:p.bottom}}let c=this.editorView.dom.offsetParent;this.element||(this.element=c.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let d,u;if(!c||c==document.body&&getComputedStyle(c).position=="static")d=-pageXOffset,u=-pageYOffset;else{let p=c.getBoundingClientRect(),h=p.width/c.offsetWidth,f=p.height/c.offsetHeight;d=p.left-c.scrollLeft*h,u=p.top-c.scrollTop*f}this.element.style.left=(r.left-d)/a+"px",this.element.style.top=(r.top-u)/i+"px",this.element.style.width=(r.right-r.left)/a+"px",this.element.style.height=(r.bottom-r.top)/i+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),s=r&&r.type.spec.disableDropCursor,l=typeof s=="function"?s(this.editorView,t,e):s;if(t&&!l){let a=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let i=Du(this.editorView.state.doc,a,this.editorView.dragging.slice);i!=null&&(a=i)}this.setCursor(a),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class ft extends _e{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return ft.valid(r)?new ft(r):_e.near(r)}content(){return de.empty}eq(e){return e instanceof ft&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new ft(e.resolve(t.pos))}getBookmark(){return new Fc(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!I_(e)||!F_(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let s=t.contentMatchAt(e.index()).defaultType;return s&&s.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&ft.valid(e))return e;let s=e.pos,l=null;for(let a=e.depth;;a--){let i=e.node(a);if(t>0?e.indexAfter(a)<i.childCount:e.index(a)>0){l=i.child(t>0?e.indexAfter(a):e.index(a)-1);break}else if(a==0)return null;s+=t;let c=e.doc.resolve(s);if(ft.valid(c))return c}for(;;){let a=t>0?l.firstChild:l.lastChild;if(!a){if(l.isAtom&&!l.isText&&!we.isSelectable(l)){e=e.doc.resolve(s+l.nodeSize*t),r=!1;continue e}break}l=a,s+=t;let i=e.doc.resolve(s);if(ft.valid(i))return i}return null}}}ft.prototype.visible=!1,ft.findFrom=ft.findGapCursorFrom,_e.jsonID("gapcursor",ft);class Fc{constructor(e){this.pos=e}map(e){return new Fc(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return ft.valid(t)?new ft(t):_e.near(t)}}function I_(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),r=n.node(e);if(t==0){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t-1);;s=s.lastChild){if(s.childCount==0&&!s.inlineContent||s.isAtom||s.type.spec.isolating)return!0;if(s.inlineContent)return!1}}return!0}function F_(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),r=n.node(e);if(t==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let s=r.child(t);;s=s.firstChild){if(s.childCount==0&&!s.inlineContent||s.isAtom||s.type.spec.isolating)return!0;if(s.inlineContent)return!1}}return!0}function $_(){return new ct({props:{decorations:j_,createSelectionBetween(n,e,t){return e.pos==t.pos&&ft.valid(t)?new ft(t):null},handleClick:P_,handleKeyDown:R_,handleDOMEvents:{beforeinput:z_}}})}const R_=Ii({ArrowLeft:oa("horiz",-1),ArrowRight:oa("horiz",1),ArrowUp:oa("vert",-1),ArrowDown:oa("vert",1)});function oa(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,s,l){let a=r.selection,i=e>0?a.$to:a.$from,c=a.empty;if(a instanceof xe){if(!l.endOfTextblock(t)||i.depth==0)return!1;c=!1,i=r.doc.resolve(e>0?i.after():i.before())}let d=ft.findGapCursorFrom(i,e,c);return d?(s&&s(r.tr.setSelection(new ft(d))),!0):!1}}function P_(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!ft.valid(r))return!1;let s=n.posAtCoords({left:t.clientX,top:t.clientY});return s&&s.inside>-1&&we.isSelectable(n.state.doc.nodeAt(s.inside))?!1:(n.dispatch(n.state.tr.setSelection(new ft(r))),!0)}function z_(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof ft))return!1;let{$from:t}=n.state.selection,r=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let s=ne.empty;for(let a=r.length-1;a>=0;a--)s=ne.from(r[a].createAndFill(null,s));let l=n.state.tr.replace(t.pos,t.pos,new de(s,0,0));return l.setSelection(xe.near(l.doc.resolve(t.pos+1))),n.dispatch(l),!1}function j_(n){if(!(n.selection instanceof ft))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",rt.create(n.doc,[Ct.widget(n.selection.head,e,{key:"gapcursor"})])}var sa=200,_t=function(){};_t.prototype.append=function(n){return n.length?(n=_t.from(n),!this.length&&n||n.length<sa&&this.leafAppend(n)||this.length<sa&&n.leafPrepend(this)||this.appendInner(n)):this},_t.prototype.prepend=function(n){return n.length?_t.from(n).append(this):this},_t.prototype.appendInner=function(n){return new H_(this,n)},_t.prototype.slice=function(n,e){return n===void 0&&(n=0),e===void 0&&(e=this.length),n>=e?_t.empty:this.sliceInner(Math.max(0,n),Math.min(this.length,e))},_t.prototype.get=function(n){if(!(n<0||n>=this.length))return this.getInner(n)},_t.prototype.forEach=function(n,e,t){e===void 0&&(e=0),t===void 0&&(t=this.length),e<=t?this.forEachInner(n,e,t,0):this.forEachInvertedInner(n,e,t,0)},_t.prototype.map=function(n,e,t){e===void 0&&(e=0),t===void 0&&(t=this.length);var r=[];return this.forEach(function(s,l){return r.push(n(s,l))},e,t),r},_t.from=function(n){return n instanceof _t?n:n&&n.length?new dm(n):_t.empty};var dm=function(n){function e(r){n.call(this),this.values=r}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,s){return r==0&&s==this.length?this:new e(this.values.slice(r,s))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,s,l,a){for(var i=s;i<l;i++)if(r(this.values[i],a+i)===!1)return!1},e.prototype.forEachInvertedInner=function(r,s,l,a){for(var i=s-1;i>=l;i--)if(r(this.values[i],a+i)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=sa)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=sa)return new e(r.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e}(_t);_t.empty=new dm([]);var H_=function(n){function e(t,r){n.call(this),this.left=t,this.right=r,this.length=t.length+r.length,this.depth=Math.max(t.depth,r.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return t<this.left.length?this.left.get(t):this.right.get(t-this.left.length)},e.prototype.forEachInner=function(t,r,s,l){var a=this.left.length;if(r<a&&this.left.forEachInner(t,r,Math.min(s,a),l)===!1||s>a&&this.right.forEachInner(t,Math.max(r-a,0),Math.min(this.length,s)-a,l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(t,r,s,l){var a=this.left.length;if(r>a&&this.right.forEachInvertedInner(t,r-a,Math.max(s,a)-a,l+a)===!1||s<a&&this.left.forEachInvertedInner(t,Math.min(r,a),s,l)===!1)return!1},e.prototype.sliceInner=function(t,r){if(t==0&&r==this.length)return this;var s=this.left.length;return r<=s?this.left.slice(t,r):t>=s?this.right.slice(t-s,r-s):this.left.slice(t,s).append(this.right.slice(0,r-s))},e.prototype.leafAppend=function(t){var r=this.right.leafAppend(t);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(t){var r=this.left.leafPrepend(t);if(r)return new e(r,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(_t);const U_=500;class wn{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let s,l;t&&(s=this.remapping(r,this.items.length),l=s.maps.length);let a=e.tr,i,c,d=[],u=[];return this.items.forEach((p,h)=>{if(!p.step){s||(s=this.remapping(r,h+1),l=s.maps.length),l--,u.push(p);return}if(s){u.push(new Bn(p.map));let f=p.step.map(s.slice(l)),m;f&&a.maybeStep(f).doc&&(m=a.mapping.maps[a.mapping.maps.length-1],d.push(new Bn(m,void 0,void 0,d.length+u.length))),l--,m&&s.appendMap(m,l)}else a.maybeStep(p.step);if(p.selection)return i=s?p.selection.map(s.slice(l)):p.selection,c=new wn(this.items.slice(0,r).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:a,selection:i}}addTransform(e,t,r,s){let l=[],a=this.eventCount,i=this.items,c=!s&&i.length?i.get(i.length-1):null;for(let u=0;u<e.steps.length;u++){let p=e.steps[u].invert(e.docs[u]),h=new Bn(e.mapping.maps[u],p,t),f;(f=c&&c.merge(h))&&(h=f,u?l.pop():i=i.slice(0,i.length-1)),l.push(h),t&&(a++,t=void 0),s||(c=h)}let d=a-r.depth;return d>K_&&(i=W_(i,d),a-=d),new wn(i.append(l),a)}remapping(e,t){let r=new Ao;return this.items.forEach((s,l)=>{let a=s.mirrorOffset!=null&&l-s.mirrorOffset>=e?r.maps.length-s.mirrorOffset:void 0;r.appendMap(s.map,a)},e,t),r}addMaps(e){return this.eventCount==0?this:new wn(this.items.append(e.map(t=>new Bn(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],s=Math.max(0,this.items.length-t),l=e.mapping,a=e.steps.length,i=this.eventCount;this.items.forEach(h=>{h.selection&&i--},s);let c=t;this.items.forEach(h=>{let f=l.getMirror(--c);if(f==null)return;a=Math.min(a,f);let m=l.maps[f];if(h.step){let g=e.steps[f].invert(e.docs[f]),y=h.selection&&h.selection.map(l.slice(c+1,f));y&&i++,r.push(new Bn(m,g,y))}else r.push(new Bn(m))},s);let d=[];for(let h=t;h<a;h++)d.push(new Bn(l.maps[h]));let u=this.items.slice(0,s).append(d).append(r),p=new wn(u,i);return p.emptyItemCount()>U_&&(p=p.compress(this.items.length-r.length)),p}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),r=t.maps.length,s=[],l=0;return this.items.forEach((a,i)=>{if(i>=e)s.push(a),a.selection&&l++;else if(a.step){let c=a.step.map(t.slice(r)),d=c&&c.getMap();if(r--,d&&t.appendMap(d,r),c){let u=a.selection&&a.selection.map(t.slice(r));u&&l++;let p=new Bn(d.invert(),c,u),h,f=s.length-1;(h=s.length&&s[f].merge(p))?s[f]=h:s.push(p)}}else a.map&&r--},this.items.length,0),new wn(_t.from(s.reverse()),l)}}wn.empty=new wn(_t.empty,0);function W_(n,e){let t;return n.forEach((r,s)=>{if(r.selection&&e--==0)return t=s,!1}),n.slice(t)}class Bn{constructor(e,t,r,s){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=s}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new Bn(t.getMap().invert(),t,this.selection)}}}class wr{constructor(e,t,r,s,l){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=s,this.prevComposition=l}}const K_=20;function q_(n,e,t,r){let s=t.getMeta(Wr),l;if(s)return s.historyState;t.getMeta(J_)&&(n=new wr(n.done,n.undone,null,0,-1));let a=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(a&&a.getMeta(Wr))return a.getMeta(Wr).redo?new wr(n.done.addTransform(t,void 0,r,la(e)),n.undone,um(t.mapping.maps),n.prevTime,n.prevComposition):new wr(n.done,n.undone.addTransform(t,void 0,r,la(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(a&&a.getMeta("addToHistory")===!1)){let i=t.getMeta("composition"),c=n.prevTime==0||!a&&n.prevComposition!=i&&(n.prevTime<(t.time||0)-r.newGroupDelay||!G_(t,n.prevRanges)),d=a?$c(n.prevRanges,t.mapping):um(t.mapping.maps);return new wr(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,la(e)),wn.empty,d,t.time,i??n.prevComposition)}else return(l=t.getMeta("rebased"))?new wr(n.done.rebased(t,l),n.undone.rebased(t,l),$c(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new wr(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),$c(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function G_(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,s)=>{for(let l=0;l<e.length;l+=2)r<=e[l+1]&&s>=e[l]&&(t=!0)}),t}function um(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,s,l,a)=>e.push(l,a));return e}function $c(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let s=e.map(n[r],1),l=e.map(n[r+1],-1);s<=l&&t.push(s,l)}return t}function Y_(n,e,t){let r=la(e),s=Wr.get(e).spec.config,l=(t?n.undone:n.done).popEvent(e,r);if(!l)return null;let a=l.selection.resolve(l.transform.doc),i=(t?n.done:n.undone).addTransform(l.transform,e.selection.getBookmark(),s,r),c=new wr(t?i:l.remaining,t?l.remaining:i,null,0,-1);return l.transform.setSelection(a).setMeta(Wr,{redo:t,historyState:c})}let Rc=!1,pm=null;function la(n){let e=n.plugins;if(pm!=e){Rc=!1,pm=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Rc=!0;break}}return Rc}const Wr=new mt("history"),J_=new mt("closeHistory");function Z_(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new ct({key:Wr,state:{init(){return new wr(wn.empty,wn.empty,null,0,-1)},apply(e,t,r){return q_(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,s=r=="historyUndo"?fm:r=="historyRedo"?mm:null;return s?(t.preventDefault(),s(e.state,e.dispatch)):!1}}}})}function hm(n,e){return(t,r)=>{let s=Wr.getState(t);if(!s||(n?s.undone:s.done).eventCount==0)return!1;if(r){let l=Y_(s,t,n);l&&r(l.scrollIntoView())}return!0}}const fm=hm(!1),mm=hm(!0);Xe.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=n?.node||this.editor.state.doc;if((n?.mode||this.options.mode)==="textSize"){const t=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(t)}return e.nodeSize},this.storage.words=n=>{const e=n?.node||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new ct({key:new mt("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const s=this.options.limit;if(s==null||s===0){n=!0;return}const l=this.storage.characters({node:r.doc});if(l>s){const a=l-s,i=0,c=a;console.warn(`[CharacterCount] Initial content exceeded limit of ${s} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(i,c);return n=!0,d}n=!0},filterTransaction:(e,t)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const s=this.storage.characters({node:t.doc}),l=this.storage.characters({node:e.doc});if(l<=r||s>r&&l>r&&l<=s)return!0;if(s>r&&l>r&&l>s||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,i=l-r,c=a-i,d=a;return e.deleteRange(c,d),!(this.storage.characters({node:e.doc})>r)}})]}});var X_=Xe.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[D_(this.options)]}});Xe.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ct({key:new mt("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:s}=e,l=[];if(!t||!r)return rt.create(n,[]);let a=0;this.options.mode==="deepest"&&n.descendants((c,d)=>{if(!c.isText){if(!(s>=d&&s<=d+c.nodeSize-1))return!1;a+=1}});let i=0;return n.descendants((c,d)=>{if(c.isText||!(s>=d&&s<=d+c.nodeSize-1))return!1;if(i+=1,this.options.mode==="deepest"&&a-i>0||this.options.mode==="shallowest"&&i>1)return this.options.mode==="deepest";l.push(Ct.node(d,d+c.nodeSize,{class:this.options.className}))}),rt.create(n,l)}}})]}});var Q_=Xe.create({name:"gapCursor",addProseMirrorPlugins(){return[$_()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=Ye(ke(n,"allowGapCursor",t)))!=null?e:null}}});Xe.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ct({key:new mt("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,s=[];if(!t)return null;const l=this.editor.isEmpty;return n.descendants((a,i)=>{const c=r>=i&&r<=i+a.nodeSize,d=!a.isLeaf&&hl(a);if((c||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];l&&u.push(this.options.emptyEditorClass);const p=Ct.node(i,i+a.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:i,hasAnchor:c}):this.options.placeholder});s.push(p)}return this.options.includeChildren}),rt.create(n,s)}}})]}}),Xe.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new ct({key:new mt("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||$h(t.selection)||n.view.dragging?null:rt.create(t.doc,[Ct.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function gm({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var eS=Xe.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){const n=new mt(this.name),e=Object.entries(this.editor.schema.nodes).map(([,t])=>t).filter(t=>(this.options.notAfter||[]).concat(this.options.node).includes(t.name));return[new ct({key:n,appendTransaction:(t,r,s)=>{const{doc:l,tr:a,schema:i}=s,c=n.getState(s),d=l.content.size,u=i.nodes[this.options.node];if(c)return a.insert(d,u.create())},state:{init:(t,r)=>{const s=r.tr.doc.lastChild;return!gm({node:s,types:e})},apply:(t,r)=>{if(!t.docChanged)return r;const s=t.doc.lastChild;return!gm({node:s,types:e})}}})]}}),tS=Xe.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>fm(n,e),redo:()=>({state:n,dispatch:e})=>mm(n,e)}},addProseMirrorPlugins(){return[Z_(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),nS=Xe.create({name:"starterKit",addExtensions(){var n,e,t,r;const s=[];return this.options.bold!==!1&&s.push(OC.configure(this.options.bold)),this.options.blockquote!==!1&&s.push(BC.configure(this.options.blockquote)),this.options.bulletList!==!1&&s.push(Xf.configure(this.options.bulletList)),this.options.code!==!1&&s.push($C.configure(this.options.code)),this.options.codeBlock!==!1&&s.push(zC.configure(this.options.codeBlock)),this.options.document!==!1&&s.push(jC.configure(this.options.document)),this.options.dropcursor!==!1&&s.push(X_.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&s.push(Q_.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&s.push(HC.configure(this.options.hardBreak)),this.options.heading!==!1&&s.push(Tf.configure(this.options.heading)),this.options.undoRedo!==!1&&s.push(tS.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&s.push(UC.configure(this.options.horizontalRule)),this.options.italic!==!1&&s.push(YC.configure(this.options.italic)),this.options.listItem!==!1&&s.push(Qf.configure(this.options.listItem)),this.options.listKeymap!==!1&&s.push(sm.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&s.push(Yf.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&s.push(im.configure(this.options.orderedList)),this.options.paragraph!==!1&&s.push(cm.configure(this.options.paragraph)),this.options.strike!==!1&&s.push(A_.configure(this.options.strike)),this.options.text!==!1&&s.push(T_.configure(this.options.text)),this.options.underline!==!1&&s.push(L_.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&s.push(eS.configure((r=this.options)==null?void 0:r.trailingNode)),s}}),rS=nS,oS=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,sS=wt.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",Ze(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[nf({find:oS,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),lS=Xe.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).every(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).every(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}});const aS=async n=>{try{const e=new FormData;return e.append("unique","true"),e.append("file",n),(await(await fetch("/file/upload/uploads?id=&form=&table=",{method:"POST",body:e})).json())?.result}catch(e){console.error(e)}},iS=async(n,e)=>{const t=e.clipboardData?.items;if(t){const r=e.clipboardData?.getData("text/html"),s=e.clipboardData?.getData("text/plain");if(r){const{state:l,dispatch:a}=n,{tr:i}=l,c=eo.fromSchema(n.state.schema),d=new DOMParser().parseFromString(r,"text/html").body,u=c.parse(d),p=i.replaceSelectionWith(u);return a(p),e.preventDefault(),!0}if(s){const{state:l,dispatch:a}=n,{tr:i}=l,c=i.insertText(s,l.selection.from,l.selection.to);return a(c),e.preventDefault(),!0}for(let l=0;l<t.length;l++){const a=t[l];if(a.type.startsWith("image/")){const i=a.getAsFile();if(i){const c=await aS(i),{schema:d}=n.state,u=d.nodes.image.create({src:c?.file_path}),p=n.state.tr.replaceSelectionWith(u);return n.dispatch(p),e.preventDefault(),!0}}}}return!1},cS={1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"},dS=Tf.extend({addOptions(){return{...this.parent?.(),levels:[1,2,3,4,5,6]}}}).extend({addAttributes(){return{...this.parent?.(),level:{default:1,renderHTML:n=>{const e=n.level||1;return{class:`heading-level-${e}`,style:cS[e-1]}}}}}}),uS=cm.configure({HTMLAttributes:{style:"min-height: 1rem;"}}),pS=nc.extend({addAttributes(){return{...this.parent?.(),fontFamily:{default:null,parseHTML:n=>n.style.fontFamily?.replace(/['"]/g,""),renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),hS=nc.extend({addAttributes(){return{...this.parent?.(),fontSize:{default:null,parseHTML:n=>n.style.fontSize?.replace(/['"]/g,""),renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),fS=wt.create({name:"iframe",group:"block",inline:!1,atom:!0,selectable:!0,addAttributes(){return{src:{default:null},width:{default:"100%"},height:{default:"280"},frameborder:{default:"0"},allow:{default:null},allowfullscreen:{default:null},referrerpolicy:{default:null},loading:{default:null},class:{default:null},title:{default:null},style:{default:null}}},parseHTML(){return[{tag:"iframe"}]},renderHTML({HTMLAttributes:n}){return["iframe",n]}});function mS(n){let e=!1;const t=dE({content:n.modelValue,extensions:[rS.configure({history:{depth:100,newGroupDelay:500},code:{HTMLAttributes:{class:"editor-code"}},codeBlock:{HTMLAttributes:{class:"editor-codeblock"}},paragraph:!1,heading:!1,link:!1}),VC,NC,bE,pS,hS,uS,dS,SC,sS.configure({inline:!0,allowBase64:!0,HTMLAttributes:{class:"editor-image"}}),lS.configure({types:["heading","paragraph"]}),Yf.configure({HTMLAttributes:{class:"editor-link"},openOnClick:!1,autolink:!0}),EC,fS],editorProps:{handlePaste:iS,handleKeyDown:(s,l)=>{if(l.key==="Tab"){const a=s.state,{selection:i}=a,{$anchor:c}=i;let d=!1;for(let u=c.depth;u>0;u--){const p=c.node(u);if(p&&(p.type.name==="bulletList"||p.type.name==="orderedList")){d=!0;break}}return d?!1:(l.preventDefault(),!0)}return!1}}}),r=o.computed(()=>t.value||null);return o.watch(t,s=>{s&&t.value.on("update",l=>{e||(e=!0,l.editor.getHTML(),n.modelValue,setTimeout(()=>{e=!1},10))})}),{editor:t,editorInstance:r,focusEditor:()=>{t.value&&!t.value.isFocused&&t.value.commands.focus()}}}function gS(n,e){const t=o.ref(!1),r=o.ref(""),s=o.ref(null);return{isHtmlMode:t,htmlContent:r,htmlTextarea:s,toggleHtmlMode:l=>{t.value=l,l?(n.value&&(r.value=n.value.getHTML()),o.nextTick(()=>{s.value&&(s.value.focus(),setTimeout(()=>{s.value.formatCode()},100))})):n.value&&r.value&&n.value.commands.setContent(r.value,!0)},onHtmlInput:l=>{r.value=l,e&&e("update:modelValue",l)}}}function yS(){const n=o.ref(!1);return{isFullscreen:n,toggleFullscreen:()=>{n.value=!n.value}}}const it=(n,e)=>{const t=n.__vccOpts||n;for(const[r,s]of e)t[r]=s;return t},bS={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function kS(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("button",{title:"Blockquote",onClick:e[0]||(e[0]=(...a)=>l.toggleBlockquote&&l.toggleBlockquote(...a)),class:o.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":t.editor?.isActive("blockquote")}])},[...e[1]||(e[1]=[o.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[o.createElementVNode("path",{"fill-rule":"evenodd",d:"M6 6a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3H5a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2H6Zm9 0a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h3a3 3 0 0 1-3 3h-1a1 1 0 1 0 0 2h1a5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3Z"})],-1)])],2)}const wS=it(bS,[["render",kS]]),xS={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function vS(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("button",{title:"Bullet List",onClick:e[0]||(e[0]=(...a)=>l.toggleBulletList&&l.toggleBulletList(...a)),class:o.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("bulletList")}])},[...e[1]||(e[1]=[o.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[o.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"})],-1)])],2)}const ES=it(xS,[["render",vS]]),CS={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function _S(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("button",{title:"Ordered List",onClick:e[0]||(e[0]=(...a)=>l.toggleOrderedList&&l.toggleOrderedList(...a)),class:o.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("orderedList")}])},[...e[1]||(e[1]=[o.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[o.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6h8m-8 6h8m-8 6h8M4 16a2 2 0 1 1 3.321 1.5L4 20h5M4 5l2-1v6m-2 0h4"})],-1)])],2)}const SS=it(CS,[["render",_S]]),NS={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function VS(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("button",{title:"Code Block",onClick:e[0]||(e[0]=(...a)=>l.toggleCodeBlock&&l.toggleCodeBlock(...a)),class:o.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("codeBlock")}])},[...e[1]||(e[1]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[o.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8 8-4 4 4 4m8 0 4-4-4-4m-2-3-4 14"})],-1)])],2)}const MS=it(NS,[["render",VS]]),BS={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.commands.toggleBold()}}};function AS(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("button",{title:"Bold Text",onClick:e[0]||(e[0]=(...a)=>l.toggleBold&&l.toggleBold(...a)),class:o.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("bold")}])},[...e[1]||(e[1]=[o.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[o.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 5h4.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0-7H6m2 7h6.5a3.5 3.5 0 1 1 0 7H8m0-7v7m0 0H6"})],-1),o.createElementVNode("span",{class:"sr-only"},"Bold",-1)])],2)}const TS=it(BS,[["render",AS]]),LS={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function DS(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("button",{title:"Italic Text",onClick:e[0]||(e[0]=(...a)=>l.toggleItalic&&l.toggleItalic(...a)),class:o.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("italic")}])},[...e[1]||(e[1]=[o.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[o.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"m8.874 19 6.143-14M6 19h6.33m-.66-14H18"})],-1),o.createElementVNode("span",{class:"sr-only"},"Italic",-1)])],2)}const OS=it(LS,[["render",DS]]),IS={__name:"vs-editor-underline",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().toggleUnderline().run()};return(r,s)=>(o.openBlock(),o.createElementBlock("button",{title:"Underline",onClick:t,class:o.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[n.editor?.isActive("underline")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...s[0]||(s[0]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o.createElementVNode("path",{d:"M6 4v6a6 6 0 0 0 12 0V4"}),o.createElementVNode("line",{x1:"4",x2:"20",y1:"20",y2:"20"})],-1)])],2))}},FS={__name:"vs-editor-strike",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().toggleStrike().run()};return(r,s)=>(o.openBlock(),o.createElementBlock("button",{title:"Strikethrough",onClick:t,class:o.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100",[n.editor?.isActive("strike")?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...s[0]||(s[0]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-strikethrough"},[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),o.createElementVNode("path",{d:"M5 12l14 0"}),o.createElementVNode("path",{d:"M16 6.5a4 2 0 0 0 -4 -1.5h-1a3.5 3.5 0 0 0 0 7h2a3.5 3.5 0 0 1 0 7h-1.5a4 2 0 0 1 -4 -1.5"})],-1)])],2))}},$S={props:{visible:{type:Boolean,default:()=>!1},modelValue:{type:Boolean,default:()=>!1},title:{type:String,default:()=>""},size:{type:String,default:()=>""},closeClickBack:{type:Boolean,default:()=>!1}},emits:["update:visible","update:modelValue","onClose","confirm","cancel"],inheritAttrs:!1,name:"vs-dialog",mounted(){window.addEventListener("keydown",this.checkKey)},unmounted(){window.removeEventListener("keydown",this.checkKey)},computed:{hasSlot(){return!!this.$slots?.footer},checkSize(){return this.size==="small"?"md:w-5/12 w-9/12":this.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"}},methods:{checkKey({key:n}){n==="Escape"&&this.handleClose()},handleClose(){this.$emit("update:visible",!1),this.$emit("update:modelValue",!1),this.$emit("onClose")},handleConfirm(){this.$emit("confirm"),this.handleClose()},handleCancel(){this.$emit("cancel"),this.handleClose()},closeByClickBack(n,e){e&&n.target.classList.contains("vs-dialog-overlay")&&this.handleClose()}}},RS={key:0,class:"vsTailwind ui-dialog__wrapper"},PS={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},zS={class:"font-medium text-gray-800 dark:text-[#ffffff]"},jS={class:"ui-dialog__content p-4"},HS={key:0,class:"flex justify-end gap-x-2"};function US(n,e,t,r,s,l){return o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[t.visible||t.modelValue?(o.openBlock(),o.createElementBlock("div",RS,[o.createElementVNode("div",{onMousedown:e[1]||(e[1]=a=>l.closeByClickBack(a,t.closeClickBack)),class:"vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[100001] bg-black bg-opacity-50"},[o.createVNode(o.Transition,{name:"content",appear:""},{default:o.withCtx(()=>[o.createElementVNode("div",{class:o.normalizeClass(["ui-dialog__modal opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",[l.checkSize]])},[o.createElementVNode("div",PS,[o.createElementVNode("h3",zS,o.toDisplayString(t.title),1),o.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:e[0]||(e[0]=(...a)=>l.handleClose&&l.handleClose(...a))},[...e[2]||(e[2]=[o.createElementVNode("span",{class:"sr-only"},"Close",-1),o.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"},[o.createElementVNode("path",{d:"M18 6 6 18"}),o.createElementVNode("path",{d:"m6 6 12 12"})],-1)])])]),o.createElementVNode("div",jS,[o.renderSlot(n.$slots,"default",{},void 0,!0)]),l.hasSlot?(o.openBlock(),o.createElementBlock("div",HS,[o.renderSlot(n.$slots,"footer",{handleClose:l.handleClose,handleConfirm:l.handleConfirm,handleCancel:l.handleCancel},void 0,!0)])):o.createCommentVNode("",!0)],2)]),_:3})],32)])):o.createCommentVNode("",!0)])}const ym=it($S,[["render",US],["__scopeId","data-v-6d0970a6"]]),WS={},KS={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 qS(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("svg",KS,[...e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),o.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])])}const GS=it(WS,[["render",qS]]),YS={},JS={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-search"};function ZS(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("svg",JS,[...e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),o.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)])])}const XS=it(YS,[["render",ZS]]),QS={},eN={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-mail"};function tN(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("svg",eN,[...e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("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"},null,-1),o.createElementVNode("path",{d:"M3 7l9 6l9 -6"},null,-1)])])}const nN=it(QS,[["render",tN]]),rN=o.defineComponent({components:{IconClose:GS,IconSearch:XS,IconEmail:nN},inheritAttrs:!1,props:{icon:{type:String,default:()=>""},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},modelValue:{type:String,default:()=>""},placeholder:{type:String,default:()=>""},iconPosition:{type:String,default:()=>"right"},type:{type:String,default:()=>"text"},style:{type:Object,default:()=>null},size:{type:String,default:()=>"md"},attrs:{type:Object,default:()=>{}}},emits:["onInput","update:modelValue","blur","focus"],computed:{checkSize(){if((this.style?.size||this.size)==="xs")return"h-[32px] text-sm";if((this.style?.size||this.size)==="md")return"h-[38px] text-sm";this.style?.size||this.size},value:{get(){return this.modelValue},set(n){this.$emit("update:modelValue",n.trim())}},clearIconStyle(){return[{"right-8":this.icon&&this.iconPosition==="right","right-3":!this.icon||this.iconPosition!=="right","pointer-events-none":this.disabled}]},iconStylePosition(){return[{"left-3":this.icon&&this.iconPosition==="left","right-3":this.icon&&this.iconPosition==="right"}]},inputStyle(){return[{"!pr-8":this.clearable&&!this.icon,"!pr-7":this.clearable,"!pr-16":this.clearable&&this.icon&&this.iconPosition==="right","!pl-8":this.icon&&this.iconPosition==="left","!pr-[50px]":this.clearable&&this.value&&this.icon&&this.iconPosition==="right","!cursor-not-allowed bg-slate-100":this.disabled,"bg-white":!this.disabled}]}},methods:{handleInput(){this.$emit("onInput",this.modelValue)},handleBlur(){this.$emit("blur")},handleFocus(){this.$emit("focus")},clearInput(){this.$emit("update:modelValue",""),this.$emit("onInput","")},async inputFocus(){const{vsText:n}=await this.$refs;await n.focus()}}}),oN={class:"vs-form-text relative bg-white rounded-lg"},sN={key:2,class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},lN=["disabled","type","placeholder"];function aN(n,e,t,r,s,l){const a=o.resolveComponent("IconClose"),i=o.resolveComponent("IconSearch"),c=o.resolveComponent("IconEmail");return o.openBlock(),o.createElementBlock("div",oN,[n.clearable&&n.value?(o.openBlock(),o.createElementBlock("div",{key:0,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[0]||(e[0]=(...d)=>n.clearInput&&n.clearInput(...d))},[o.createVNode(a,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):o.createCommentVNode("",!0),n.icon&&n.icon==="search"?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["absolute bottom-2/4 translate-y-2/4 cursor-pointer",n.iconStylePosition])},[o.createVNode(i,{width:"15px",height:"15px",class:"stroke-gray-500 transition-all"})],2)):n.icon&&n.icon==="email"?(o.openBlock(),o.createElementBlock("div",sN,[o.createVNode(c,{width:"16",height:"16",class:"stroke-gray-500 transition-all"})])):(o.openBlock(),o.createElementBlock("i",{key:3,class:o.normalizeClass(["absolute bottom-2/4 translate-y-2/4 text-gray-500 cursor-pointer",["ti "+n.icon,n.iconStylePosition]])},null,2)),n.clearable&&n.value?(o.openBlock(),o.createElementBlock("div",{key:4,class:"absolute bottom-2/4 translate-y-2/4 right-3 cursor-pointer",onClick:e[1]||(e[1]=(...d)=>n.clearInput&&n.clearInput(...d))},[o.createVNode(a,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):o.createCommentVNode("",!0),o.withDirectives(o.createElementVNode("input",o.mergeProps({ref:"vsText",disabled:n.disabled,type:n.type,onInput:e[2]||(e[2]=(...d)=>n.handleInput&&n.handleInput(...d)),placeholder:n.placeholder,"onUpdate:modelValue":e[3]||(e[3]=d=>n.value=d)},n.style?.attrs||n.attrs||{},{onFocus:e[4]||(e[4]=(...d)=>n.handleFocus&&n.handleFocus(...d)),onBlur:e[5]||(e[5]=(...d)=>n.handleBlur&&n.handleBlur(...d)),class:[[n.inputStyle,n.checkSize],"py-2 px-3 block w-full border border-solid placeholder:text-nowrap border-stone-200 rounded-lg text-sm text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"]}),null,16,lN),[[o.vModelDynamic,n.value]])])}const bm=it(rN,[["render",aN],["__scopeId","data-v-749b581f"]]);function Pc(){const n=o.ref("uk");return{t:e=>({en:{type_tag:"Type Tag",heading_1:"Heading 1",heading_2:"Heading 2",heading_3:"Heading 3",paragraph:"Paragraph",createTable:"Create Table",addColumn:"Add Column",addRow:"Add Row",deleteColumn:"Delete Column",deleteRow:"Delete Row",deleteTable:"Delete Table",mergeCells:"Merge Cells",splitCells:"Split Cells",linkTitle:"Enter Link",link:"Link",linkUrl:"Enter URL",editLink:"Edit Link",openLink:"Open link",removeLink:"Remove link",openInNewTab:"Open in new tab",create:"Create",update:"Update",cancel:"Cancel"},uk:{type_tag:"Тип тегу",heading_1:"Заголовок 1",heading_2:"Заголовок 2",heading_3:"Заголовок 3",paragraph:"Параграф",createTable:"Створити Таблицю",addColumn:"Додати Колону",addRow:"Додати Рядок",deleteColumn:"Вилучити Колону",deleteRow:"Вилучити Рядок",deleteTable:"Вилучити Таблицю",mergeCells:"Об'єднати Клітинки",splitCells:"Розділити Клітинки",linkTitle:"Додати посилання",link:"Посилання",linkUrl:"Введіть URL",editLink:"Редагувати посилання",openLink:"Відкрити посилання",removeLink:"Видалити посилання",openInNewTab:"Відкривати в новій вкладці",create:"Створити",update:"Оновити",cancel:"Скасувати"}})[n.value]?.[e]||e,locale:n}}const iN=["title"],cN={class:"flex flex-col gap-3 p-[20px]"},dN={class:"relative flex items-center gap-2"},uN={class:"flex-1"},pN={key:0,class:"flex items-center gap-2 flex-shrink-0"},hN=["title"],fN=["title"],mN={class:"flex items-center gap-2"},gN={for:"openInNewTab",class:"text-sm text-gray-700 cursor-pointer"},yN={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},bN=Object.assign({inheritAttrs:!1},{__name:"vs-editor-link",props:{editor:Object},setup(n){const{t:e}=Pc(),t=n,r=o.ref(!1),s=o.ref(""),l=o.ref(!1),a=o.ref(!1),i=()=>{if(!t.editor)return;t.editor.chain().focus().extendMarkRange("link").run();const h=t.editor.getAttributes("link");h.href?(l.value=!0,s.value=h.href,a.value=h.target==="_blank"):(l.value=!1,s.value="",a.value=!1),r.value=!0},c=()=>{r.value=!1,s.value="",l.value=!1,a.value=!1},d=()=>{if(!t.editor||!s.value.trim())return;let h=s.value.trim();h.match(/^https?:\/\//i)||(h="https://"+h),t.editor.chain().focus().setLink({href:h,target:a.value?"_blank":null}).run(),c()},u=()=>{t.editor&&(t.editor.chain().focus().unsetLink().run(),c())},p=()=>{if(!s.value)return;let h=s.value.trim();h.match(/^https?:\/\//i)||(h="https://"+h),window.open(h,"_blank","noopener,noreferrer")};return(h,f)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createElementVNode("button",{title:o.unref(e)("link")||"Посилання",onClick:i,class:o.normalizeClass(["text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none",{"bg-gray-100 text-gray-900":n.editor?.isActive("link")}])},[...f[3]||(f[3]=[o.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[o.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13.213 9.787a3.391 3.391 0 0 0-4.795 0l-3.425 3.426a3.39 3.39 0 0 0 4.795 4.794l.321-.304m-.321-4.49a3.39 3.39 0 0 0 4.795 0l3.424-3.426a3.39 3.39 0 0 0-4.794-4.795l-1.028.961"})],-1)])],10,iN),o.createVNode(ym,{title:l.value?o.unref(e)("editLink")||"Редагувати посилання":o.unref(e)("linkTitle")||"Додати посилання",visible:r.value,"onUpdate:visible":f[2]||(f[2]=m=>r.value=m),size:"small"},{footer:o.withCtx(()=>[o.createElementVNode("div",yN,[o.createElementVNode("button",{style:{border:"1px solid #000"},onClick:c,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm whitespace-nowrap text-black border-gray-200 rounded-lg !border-gray-200 hover:bg-gray-100 duration-300"},o.toDisplayString(o.unref(e)("cancel")||"Скасувати"),1),o.createElementVNode("button",{onClick:d,class:"py-2 px-3 inline-flex items-center gap-x-2 text-[14px] font-[400] whitespace-nowrap text-white bg-blue-500 rounded-lg !border-gray-200 hover:bg-blue-700 duration-300"},o.toDisplayString(l.value?o.unref(e)("update")||"Оновити":o.unref(e)("create")||"Створити"),1)])]),default:o.withCtx(()=>[o.createElementVNode("div",cN,[o.createElementVNode("div",dN,[o.createElementVNode("div",uN,[o.createVNode(bm,{modelValue:s.value,"onUpdate:modelValue":f[0]||(f[0]=m=>s.value=m),placeholder:o.unref(e)("linkUrl")||"Введіть URL",class:"w-full"},null,8,["modelValue","placeholder"])]),l.value?(o.openBlock(),o.createElementBlock("div",pN,[o.createElementVNode("button",{onClick:p,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none transition-colors",title:o.unref(e)("openLink")||"Відкрити посилання"},[...f[4]||(f[4]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[o.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M10 6H6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-4M14 4h6m0 0v6m0-6L10 14"})],-1)])],8,hN),o.createElementVNode("button",{onClick:u,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-red-600 hover:bg-red-50 focus:outline-none transition-colors",title:o.unref(e)("removeLink")||"Видалити посилання"},[...f[5]||(f[5]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[o.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})],-1)])],8,fN)])):o.createCommentVNode("",!0)]),o.createElementVNode("div",mN,[o.withDirectives(o.createElementVNode("input",{type:"checkbox",id:"openInNewTab","onUpdate:modelValue":f[1]||(f[1]=m=>a.value=m),class:"w-4 h-4 text-blue-600 bg-gray-100 border-gray-300 rounded focus:ring-blue-500"},null,512),[[o.vModelCheckbox,a.value]]),o.createElementVNode("label",gN,o.toDisplayString(o.unref(e)("openInNewTab")||"Відкривати в новій вкладці"),1)])])]),_:1},8,["title","visible"])],64))}}),ls=async(n,e,t,r=10)=>{if(!e||!t)return;await o.nextTick();const s=await t?.getBoundingClientRect(),l=await e?.getBoundingClientRect();if(!l||!s)return;const a=await parseInt(e?.getBoundingClientRect()?.height),i=await parseInt(e?.getBoundingClientRect()?.width),c=await parseInt(t?.getBoundingClientRect()?.height),d=await parseInt(t?.getBoundingClientRect()?.width),u=await window.innerHeight,p=await window.innerWidth;let h=0,f=0;const m=l.bottom+r+c;switch(n){case"top":l.top-s.height-r<0?h=l.top-s.height+r+c+a:h=l.top-s.height-r,p>d+l.right+30?f=l.left-s.width/2+l.width/2:f=p-30-d;break;case"bottom":u>m?h=l.bottom+r:h=l.bottom-r-c-a,f=l.left-s.width/2+l.width/2;break;case"left":h=l.top-s.height/2+l.height/2,l.left-s.width-r>0?f=l.left-s.width-r:f=10;break;case"right":h=l.top-s.height/2+l.height/2,p-i>d?f=l.right+r:f=p-30-d;break;case"top-right":l.top-s.height-r<0?h=l.top-s.height+r+c+a:h=l.top-s.height-r,p-i>d?f=l.right+r:f=p-30-d;break;case"top-left":l.top-s.height-r<0?h=l.top-s.height+r+c+a:h=l.top-s.height-r,l.left-s.width-r>0?f=l.left-s.width-r:f=10;break;case"top-start":l.top-s.height-r<0?h=l.top-s.height+r+c+a:h=l.top-s.height-r,l.left>0?f=l.left:f=10;break;case"bottom-right":u>m?h=l.bottom+r:h=l.bottom-r-c-a,p-i>d?f=l.left:f=p-30-d;break;case"bottom-left":u>m?h=l.bottom+r:h=l.bottom-r-c-a,l.left>0?f=l.right-d:f=10;break;case"bottom-start":u>m?h=l.bottom+r:h=l.bottom-r-c-a,l.left>0?f=l.left:f=10;break}h+c>u?h=u-c-r:h<0&&(h=r),f+d>p?f=p-d-r:f<0&&(f=r),t instanceof HTMLElement&&(t.style.top=`${h}px`,t.style.left=`${f}px`,t.style.position="fixed")},kN={class:"text-center"},wN={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"},xr=Object.assign({inheritAttrs:!1},{__name:"vs-popover",props:{isOpen:{type:Boolean,default:()=>!1},placement:{type:String,default:"top"},gap:{type:Number,default:8},width:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},trigger:{type:String,default:"click"},teleport:{type:String,default:"body"}},emits:["isvisible"],setup(n,{expose:e,emit:t}){const r=n,s=t,l=o.ref(!1),a=o.ref([]),i=o.ref(null),c=o.ref(null),d=o.ref(null);o.watch(l,x=>{x?(u(),window.addEventListener("resize",()=>ls(r.placement,c.value,d.value)),ls(r.placement,c.value,d.value)):window.removeEventListener("resize",()=>ls(r.placement,c.value,d.value)),s("isvisible",x)}),o.onMounted(()=>{window.addEventListener("click",y),window.addEventListener("popstate",b),window.addEventListener("scroll",k,!0),u()}),o.onBeforeUnmount(()=>{window.removeEventListener("click",y),window.removeEventListener("popstate",b),p()});const u=()=>{let x=i.value;for(;x&&x!==document.body;)(x.scrollHeight>x.clientHeight||x.scrollWidth>x.clientWidth)&&(x.addEventListener("scroll",g),a.value.push(x)),x=x.parentElement;document.body&&(document.body.addEventListener("scroll",g),a.value.push(document.body))},p=()=>{a.value.forEach(x=>{x.removeEventListener("scroll",g)}),a.value=[]},h=()=>{l.value=!0,ls(r.placement,c.value,d.value)},f=()=>{l.value=!1},m=async()=>{await ls(r.placement,c.value,d.value),l.value=!l.value},g=()=>{l.value=!1},y=x=>{if(!x){l.value=!1;return}c.value?.contains(x.target)||d.value?.contains(x.target)||(l.value=!1)},b=()=>{l.value&&(l.value=!1)},k=x=>{l.value&&d.value&&!d.value.contains(x.target)&&(l.value=!1)};return e({togglePopover:m}),(x,w)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"popover",ref:i,class:"vs-popover inline-block"},[o.createElementVNode("div",kN,[n.trigger==="click"?(o.openBlock(),o.createElementBlock("div",{key:0,ref_key:"popoverRef",ref:c,onClick:m,class:o.normalizeClass({"pointer-events-none":n.disabled})},[o.renderSlot(x.$slots,"reference",{},()=>[w[0]||(w[0]=o.createElementVNode("button",null,"Click me!",-1))])],2)):o.createCommentVNode("",!0),n.trigger==="hover"?(o.openBlock(),o.createElementBlock("div",{key:1,ref_key:"popoverRef",ref:c,onMouseover:h,onMouseleave:f,class:o.normalizeClass({"pointer-events-none":n.disabled})},[o.renderSlot(x.$slots,"reference",{},()=>[w[1]||(w[1]=o.createElementVNode("button",null,"Click me!",-1))])],34)):o.createCommentVNode("",!0),(o.openBlock(),o.createBlock(o.Teleport,{to:n.teleport},[o.createVNode(o.Transition,{name:"fade"},{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("div",{class:o.normalizeClass(["vsTailwind vs-popover__content",n.placement]),ref_key:"contentPop",ref:d,style:o.normalizeStyle({width:n.width?n.width+"px":"fit-content",zIndex:100001})},[o.createElementVNode("div",wN,[o.renderSlot(x.$slots,"default",{},()=>[w[2]||(w[2]=o.createElementVNode("span",null,"Popover content",-1))])])],6),[[o.vShow,l.value]])]),_:3})],8,["to"]))])],512))}}),xN={class:"flex flex-col gap-[2px] p-[2px]"},vN=["onClick"],EN={__name:"vs-editor-table",props:{editor:Object},setup(n){const{t:e}=Pc(),t=n,r=o.ref(!1),s=o.ref("popover"),l=()=>{t.editor&&(t.editor.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),s.value.togglePopover())},a=()=>{t.editor&&(t.editor.chain().focus().addColumnAfter().run(),s.value.togglePopover())},i=()=>{t.editor&&(t.editor.chain().focus().addRowAfter().run(),s.value.togglePopover())},c=()=>{t.editor&&(t.editor.chain().focus().deleteColumn().run(),s.value.togglePopover())},d=()=>{t.editor&&(t.editor.chain().focus().deleteRow().run(),s.value.togglePopover())},u=()=>{t.editor&&(t.editor.chain().focus().deleteTable().run(),s.value.togglePopover())},p=()=>{t.editor&&(t.editor.chain().focus().mergeCells().run(),s.value.togglePopover())},h=()=>{t.editor&&(t.editor.chain().focus().splitCell().run(),s.value.togglePopover())},f=o.computed(()=>[{text:e("createTable"),function:l},{text:e("addColumn"),function:a},{text:e("addRow"),function:i},{text:e("deleteColumn"),function:c},{text:e("deleteRow"),function:d},{text:e("deleteTable"),function:u},{text:e("mergeCells"),function:p},{text:e("splitCells"),function:h}]);return(m,g)=>(o.openBlock(),o.createBlock(xr,{ref_key:"popover",ref:s,placement:"bottom",onIsvisible:g[0]||(g[0]=y=>r.value=y)},{reference:o.withCtx(()=>[o.createElementVNode("button",{title:"Table",class:o.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[r.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...g[1]||(g[1]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-table"},[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),o.createElementVNode("path",{d:"M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"}),o.createElementVNode("path",{d:"M3 10h18"}),o.createElementVNode("path",{d:"M10 3v18"})],-1)])],2)]),default:o.withCtx(()=>[o.createElementVNode("div",xN,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(f.value,(y,b)=>(o.openBlock(),o.createElementBlock("button",{key:b,onClick:y?.function,class:"px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded"},o.toDisplayString(y.text),9,vN))),128))])]),_:1},512))}},CN={},_N={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-align-center"};function SN(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("svg",_N,[...e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M4 6l16 0"},null,-1),o.createElementVNode("path",{d:"M8 12l8 0"},null,-1),o.createElementVNode("path",{d:"M6 18l12 0"},null,-1)])])}const NN=it(CN,[["render",SN]]),VN={},MN={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-align-right"};function BN(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("svg",MN,[...e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M4 6l16 0"},null,-1),o.createElementVNode("path",{d:"M10 12l10 0"},null,-1),o.createElementVNode("path",{d:"M6 18l14 0"},null,-1)])])}const AN=it(VN,[["render",BN]]),TN={},LN={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-align-left"};function DN(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("svg",LN,[...e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M4 6l16 0"},null,-1),o.createElementVNode("path",{d:"M4 12l10 0"},null,-1),o.createElementVNode("path",{d:"M4 18l14 0"},null,-1)])])}const ON=it(TN,[["render",DN]]),IN={},FN={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-align-justify"};function $N(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("svg",FN,[...e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M4 6h16"},null,-1),o.createElementVNode("path",{d:"M4 12h16"},null,-1),o.createElementVNode("path",{d:"M4 18h16"},null,-1)])])}const RN=it(IN,[["render",$N]]),km={left:ON,center:NN,right:AN,justify:RN},PN={class:"flex gap-[4px] p-1"},zN=["title","onClick"],jN={__name:"vs-editor-align",props:{editor:Object},setup(n){const e=n,t=o.ref(!1),r=o.ref("popover"),s=o.ref("left"),l=o.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"left"})||e.editor.isActive("heading",{textAlign:"left"}):!1),a=o.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"right"})||e.editor.isActive("heading",{textAlign:"right"}):!1),i=o.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"center"})||e.editor.isActive("heading",{textAlign:"center"}):!1),c=o.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"justify"})||e.editor.isActive("heading",{textAlign:"justify"}):!1),d=o.computed(()=>l.value||a.value||i.value||c.value),u=()=>{a.value?s.value="right":i.value?s.value="center":c.value?s.value="justify":s.value="left"};o.watch([l,a,i,c],()=>{u()},{immediate:!0}),o.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",u),e.editor.on("update",u))}),o.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",u),e.editor.off("update",u))});const p=f=>{e.editor&&(e.editor.chain().focus().setTextAlign(f).run(),s.value=f)},h=o.ref([{id:"left",isActive:l},{id:"center",isActive:i},{id:"right",isActive:a},{id:"justify",isActive:c}]);return(f,m)=>(o.openBlock(),o.createBlock(xr,{ref_key:"popover",ref:r,placement:"bottom",onIsvisible:m[0]||(m[0]=g=>t.value=g)},{reference:o.withCtx(()=>[o.createElementVNode("button",{title:"Text Align",class:o.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[d.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(km)[s.value]),{height:"16",width:"16"}))],2)]),default:o.withCtx(()=>[o.createElementVNode("div",PN,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(h.value,g=>(o.openBlock(),o.createElementBlock("button",{title:"Text align "+g?.id,class:o.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":g?.isActive}]),key:g?.id,onClick:y=>p(g?.id)},[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(km)[g?.id]),{height:"16",width:"16"}))],10,zN))),128))])]),_:1},512))}},HN={class:"flex flex-col gap-[2px] p-[2px]"},UN=["onClick"],WN={__name:"vs-editor-type-tag",props:{editor:Object},setup(n){const{t:e}=Pc(),t=n,r=o.ref(!1),s=o.ref("popover"),l=()=>{t.editor&&(t.editor?.chain().focus().setParagraph().run(),s.value.togglePopover())},a=c=>{t.editor&&(t.editor?.chain().focus().toggleHeading({level:c}).run(),s.value.togglePopover())},i=o.computed(()=>[{text:e("richtext.heading1"),id:1,style:"font-[700] text-[30px]"},{text:e("richtext.heading2"),id:2,style:"font-[700] text-[26px]"},{text:e("richtext.heading3"),id:3,style:"font-[700] text-[22px]"},{text:e("richtext.heading4"),id:4,style:"font-[700] text-[18px]"},{text:e("richtext.heading5"),id:5,style:"font-[500] text-[16px]"},{text:e("richtext.heading6"),id:6,style:"font-[400] text-[14px]"}]);return(c,d)=>(o.openBlock(),o.createBlock(xr,{ref_key:"popover",ref:s,placement:"bottom",onIsvisible:d[0]||(d[0]=u=>r.value=u)},{reference:o.withCtx(()=>[o.createElementVNode("button",{title:"Type Tag",class:o.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100",[r.value?"bg-gray-100 text-gray-900":"text-gray-500"]])},[...d[1]||(d[1]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-text-size"},[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),o.createElementVNode("path",{d:"M3 7v-2h13v2"}),o.createElementVNode("path",{d:"M10 5v14"}),o.createElementVNode("path",{d:"M12 19h-4"}),o.createElementVNode("path",{d:"M15 13v-1h6v1"}),o.createElementVNode("path",{d:"M18 12v7"}),o.createElementVNode("path",{d:"M17 19h2"})],-1)])],2)]),default:o.withCtx(()=>[o.createElementVNode("div",HN,[o.createElementVNode("button",{onClick:l,class:o.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded",[n.editor?.isActive("paragraph")?"bg-gray-100":""]])},o.toDisplayString(o.unref(e)("richtext.paragraph")),3),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,(u,p)=>(o.openBlock(),o.createElementBlock("button",{key:p,onClick:h=>a(u?.id),class:o.normalizeClass(["px-2 py-1 text-gray-500 text-start hover:text-gray-900 hover:bg-gray-100 rounded leading-[100%]",[u?.style,n.editor?.isActive("heading",{level:u?.id})?"bg-gray-100":""]])},o.toDisplayString(o.unref(e)(`richtext.heading${u?.id}`)),11,UN))),128))])]),_:1},512))}},KN={},qN={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 GN(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("svg",qN,[...e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)])])}const as=it(KN,[["render",GN]]),YN={components:{VsText:bm},inheritAttrs:!1,events:["update:modelValue"],props:{modelValue:{type:String},disabled:{type:Boolean,default:()=>!1},clearable:{type:Boolean,default:()=>!1},isTextInputShown:{type:Boolean,default:()=>!0}},computed:{value:{get(){return this.modelValue},set(n){this.$emit("update:modelValue",n)}}}},JN={class:"flex items-center w-full max-w-[182px]"},ZN=["disabled"];function XN(n,e,t,r,s,l){const a=o.resolveComponent("vs-text");return o.openBlock(),o.createElementBlock("div",JN,[o.withDirectives(o.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=i=>l.value=i),type:"color",class:o.normalizeClass(["w-[38px] h-[38px] min-h-[38px] min-w-[38px] py-[2px] px-[3px] -ml-1 dark:bg-neutral-800 border dark:border-neutral-700 border-stone-200 rounded-lg",t.disabled?"cursor-not-allowed":"cursor-pointer"]),disabled:t.disabled},null,10,ZN),[[o.vModelText,l.value]]),t.isTextInputShown?(o.openBlock(),o.createBlock(a,{key:0,modelValue:l.value,"onUpdate:modelValue":e[1]||(e[1]=i=>l.value=i),class:"ml-2 w-full",disabled:t.disabled,clearable:t.clearable},null,8,["modelValue","disabled","clearable"])):o.createCommentVNode("",!0)])}const wm=it(YN,[["render",XN]]),QN={class:"flex gap-[4px] mb-[8px]"},eV={class:"grid grid-rows-3 grid-cols-7"},tV={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},nV=["onClick","title"],rV={__name:"vs-editor-color",props:{editor:Object},setup(n){const e=n,t=o.ref("popover"),r=o.ref("#000000"),s=o.computed(()=>e.editor&&e.editor.getAttributes("textStyle").color||"#000000"),l=o.computed(()=>s.value!=="#000000"),a=()=>{e.editor&&(r.value=s.value)};o.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",a),e.editor.on("update",a),a())}),o.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",a),e.editor.off("update",a))});const i=o.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),c=p=>{e.editor&&(e.editor.chain().focus().setColor(p).run(),r.value=p,t.value&&t.value.togglePopover())},d=()=>{c(r.value)},u=p=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple","#FFFFFF":"White","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[p]||p;return(p,h)=>(o.openBlock(),o.createBlock(xr,{ref_key:"popover",ref:t,placement:"bottom"},{reference:o.withCtx(()=>[o.createElementVNode("button",{title:"Text Color",class:o.normalizeClass(["flex flex-col h-[30px] min-w-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":l.value}])},[h[1]||(h[1]=o.createElementVNode("span",{class:"leading-none"},"A",-1)),o.createElementVNode("span",{class:"block h-1 w-5",style:o.normalizeStyle({backgroundColor:r.value})},null,4)],2)]),default:o.withCtx(()=>[o.createElementVNode("div",null,[o.createElementVNode("div",QN,[o.createVNode(wm,{modelValue:r.value,"onUpdate:modelValue":h[0]||(h[0]=f=>r.value=f)},null,8,["modelValue"]),o.createElementVNode("button",{onClick:d,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[o.createVNode(as,{class:"h-[24px] w-[24px] text-white"})])]),o.createElementVNode("div",eV,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,f=>(o.openBlock(),o.createElementBlock("div",{key:f,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[o.createElementVNode("div",tV,[o.createElementVNode("button",{class:"flex items-center justify-center w-full h-full",style:o.normalizeStyle({backgroundColor:f}),onClick:m=>c(f),title:u(f)},[r.value===f?(o.openBlock(),o.createBlock(as,{key:0,class:"h-5 w-5 text-gray-500"})):o.createCommentVNode("",!0)],12,nV)])]))),128))])])]),_:1},512))}},oV={class:"flex gap-[4px] mb-[8px]"},sV={class:"grid grid-rows-3 grid-cols-7"},lV={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},aV=["onClick","title"],iV=["onClick","title"],cV={__name:"vs-editor-background-color",props:{editor:Object},setup(n){const e=n,t=o.ref("popover"),r=o.ref("transparent"),s=o.computed(()=>e.editor&&e.editor.getAttributes("textStyle").backgroundColor||"transparent"),l=o.computed(()=>s.value!=="transparent"&&s.value!==""),a=()=>{e.editor&&(r.value=s.value)};o.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",a),e.editor.on("update",a),a())}),o.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",a),e.editor.off("update",a))});const i=o.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),c=p=>{e.editor&&(e.editor.chain().focus().setBackgroundColor(p).run(),r.value=p,t.value&&t.value.togglePopover())},d=()=>{c(r.value)},u=p=>({"#172B4D":"Default","#0747A6":"Bright blue","#008DA6":"Bright blue-green","#006644":"Bright green","#FF991F":"Bright orange","#BF2600":"Bright red","#403294":"Bright purple","#97A0AF":"Gray","#4C9AFF":"Blue","#00B8D9":"Blue-green","#36B37E":"Green","#FFC400":"Yellow","#FF5630":"Red","#6554C0":"Purple",transparent:"Transparent","#B3D4FF":"Bright blue","#B3F5FF":"Bright blue-green","#ABF5D1":"Bright green","#FFF0B3":"Bright yellow","#FFBDAD":"Bright red","#EAE6FF":"Bright purple"})[p]||p;return(p,h)=>(o.openBlock(),o.createBlock(xr,{ref_key:"popover",ref:t,placement:"bottom"},{reference:o.withCtx(()=>[o.createElementVNode("button",{title:"Background Color",class:o.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":l.value}])},[h[2]||(h[2]=o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o.createElementVNode("path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z"}),o.createElementVNode("path",{d:"m5 2 5 5"}),o.createElementVNode("path",{d:"M2 13h15"}),o.createElementVNode("path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z"})],-1)),o.createElementVNode("span",{class:"block h-1 w-5",style:o.normalizeStyle({backgroundColor:r.value})},null,4)],2)]),default:o.withCtx(()=>[o.createElementVNode("div",null,[o.createElementVNode("div",oV,[o.createVNode(wm,{modelValue:r.value,"onUpdate:modelValue":h[0]||(h[0]=f=>r.value=f)},null,8,["modelValue"]),o.createElementVNode("button",{onClick:d,class:"h-[38px] w-[38px] bg-blue-500 shrink-0 border rounded-md flex items-center justify-center hover:bg-blue-700 duration-300"},[o.createVNode(as,{class:"h-[24px] w-[24px] text-white"})])]),o.createElementVNode("div",sV,[o.createElementVNode("button",{onClick:h[1]||(h[1]=f=>c("transparent")),class:"col-span-7 flex items-center justify-center gap-2 bg-gray-100 rounded-md py-1 mb-2 hover:bg-gray-200"},[...h[3]||(h[3]=[o.createElementVNode("svg",{fill:"#000000",width:"16",height:"16",viewBox:"0 0 52 52","data-name":"Layer 1",xmlns:"http://www.w3.org/2000/svg"},[o.createElementVNode("g",{id:"SVGRepo_bgCarrier","stroke-width":"0"}),o.createElementVNode("g",{id:"SVGRepo_tracerCarrier","stroke-linecap":"round","stroke-linejoin":"round"}),o.createElementVNode("g",{id:"SVGRepo_iconCarrier"},[o.createElementVNode("path",{d:"M48.5,5.6,46.4,3.5a1.67,1.67,0,0,0-2.4.3L32.59,15.21c-.77-1.3-1.51-2.61-2.21-4a36.5,36.5,0,0,1-3.15-8.36c-.13-.53-.39-.91-1-.89s-.86.4-1,.93c-.06.26-.11.51-.17.76A48.3,48.3,0,0,1,21,13.7,97.47,97.47,0,0,1,14.13,25a16,16,0,0,0-3,11.12c0,.14,0,.29.06.43L3.8,44a1.87,1.87,0,0,0-.3,2.4l2.1,2.1A1.67,1.67,0,0,0,8,48.2L48.2,8A1.67,1.67,0,0,0,48.5,5.6Z"}),o.createElementVNode("path",{d:"M38.42,23.79l-22,22.31A14.47,14.47,0,0,0,26.22,50a15.48,15.48,0,0,0,7-1.44c4.94-2.51,8.11-6.4,8.94-12A15.22,15.22,0,0,0,39,24.66C38.87,24.44,38.58,24,38.42,23.79Z"})])],-1),o.createElementVNode("p",null,"no color",-1)])]),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,f=>(o.openBlock(),o.createElementBlock("div",{key:f,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[o.createElementVNode("div",lV,[f!=="transparent"?(o.openBlock(),o.createElementBlock("button",{key:0,class:"flex items-center justify-center w-full h-full",style:o.normalizeStyle({backgroundColor:f}),onClick:m=>c(f),title:u(f)},[r.value===f?(o.openBlock(),o.createBlock(as,{key:0,class:"h-5 w-5 text-gray-500"})):o.createCommentVNode("",!0)],12,aV)):o.createCommentVNode("",!0),f==="transparent"?(o.openBlock(),o.createElementBlock("button",{key:1,class:"flex items-center justify-center w-full h-full",onClick:m=>c(f),title:u(f)},[r.value===f?(o.openBlock(),o.createBlock(as,{key:0,class:"h-5 w-5 text-gray-500"})):o.createCommentVNode("",!0)],8,iV)):o.createCommentVNode("",!0)])]))),128))])])]),_:1},512))}},dV={__name:"vs-editor-highlight",props:{editor:Object},setup(n){const e=n,t=o.computed(()=>e.editor?.isActive("highlight")),r=()=>{e.editor&&e.editor.chain().focus().toggleHighlight().run()};return(s,l)=>(o.openBlock(),o.createElementBlock("button",{title:"Highlight",onClick:r,class:o.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-200":t.value}])},[...l[0]||(l[0]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o.createElementVNode("path",{d:"m9 11-6 6v3h9l3-3"}),o.createElementVNode("path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4"})],-1)])],2))}},uV={class:"truncate"},pV={class:"w-[200px]"},hV={class:"max-h-[200px] overflow-y-auto"},fV=["onClick"],mV={__name:"vs-editor-font-family",props:{editor:Object},setup(n){const e=n,t=o.ref("popover"),r=o.ref(!1),s=o.ref([{label:"Arial",value:"Arial, sans-serif"},{label:"Helvetica",value:"Helvetica, sans-serif"},{label:"Times New Roman",value:"Times New Roman, serif"},{label:"Georgia",value:"Georgia, serif"},{label:"Verdana",value:"Verdana, sans-serif"},{label:"Courier New",value:"Courier New, monospace"},{label:"Comic Sans MS",value:"Comic Sans MS, cursive"},{label:"Impact",value:"Impact, sans-serif"},{label:"Trebuchet MS",value:"Trebuchet MS, sans-serif"},{label:"Palatino",value:"Palatino, serif"}]),l=o.computed(()=>{if(!e.editor)return"Arial, sans-serif";for(const d of s.value)if(e.editor.isActive("textStyle",{fontFamily:d.value}))return d.value;return"Arial, sans-serif"}),a=o.computed(()=>s.value.find(d=>d.value===l.value)?.label||"Arial"),i=d=>e.editor?e.editor.isActive("textStyle",{fontFamily:d}):!1,c=d=>{e.editor&&(e.editor.chain().focus().setFontFamily(d).run(),t.value&&t.value.togglePopover())};return(d,u)=>(o.openBlock(),o.createBlock(xr,{ref_key:"popover",ref:t,placement:"bottom",onIsvisible:u[0]||(u[0]=p=>r.value=p)},{reference:o.withCtx(()=>[o.createElementVNode("button",{title:"Font Family",class:o.normalizeClass(["h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm",[r.value?"bg-gray-100 text-gray-900":"text-gray-700"]]),style:o.normalizeStyle({fontFamily:l.value})},[o.createElementVNode("span",uV,o.toDisplayString(a.value),1),u[1]||(u[1]=o.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1))],6)]),default:o.withCtx(()=>[o.createElementVNode("div",pV,[o.createElementVNode("ul",hV,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.value,p=>(o.openBlock(),o.createElementBlock("li",{key:p.value,class:o.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",{"bg-gray-100":i(p.value)}]),style:o.normalizeStyle({fontFamily:p.value}),onClick:h=>c(p.value)},o.toDisplayString(p.label),15,fV))),128))])])]),_:1},512))}},gV={class:"w-[120px]"},yV={class:"max-h-[200px] overflow-y-auto"},bV=["onClick"],kV={__name:"vs-editor-font-size",props:{editor:Object},setup(n){const e=n,t=o.ref("popover"),r=o.ref("14px"),s=o.computed(()=>e.editor&&e.editor.getAttributes("textStyle").fontSize||"14px"),l=o.computed(()=>s.value!=="14px"),a=()=>{e.editor&&(r.value=s.value)};o.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",a),e.editor.on("update",a),a())}),o.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",a),e.editor.off("update",a))});const i=o.ref([{label:"8px",value:"8px"},{label:"9px",value:"9px"},{label:"10px",value:"10px"},{label:"11px",value:"11px"},{label:"12px",value:"12px"},{label:"14px",value:"14px"},{label:"16px",value:"16px"},{label:"18px",value:"18px"},{label:"20px",value:"20px"},{label:"24px",value:"24px"},{label:"28px",value:"28px"},{label:"32px",value:"32px"},{label:"36px",value:"36px"},{label:"48px",value:"48px"},{label:"72px",value:"72px"}]),c=d=>{e.editor&&(e.editor.chain().focus().setFontSize(d).run(),r.value=d,t.value&&t.value.togglePopover())};return(d,u)=>(o.openBlock(),o.createBlock(xr,{ref_key:"popover",ref:t,placement:"bottom"},{reference:o.withCtx(()=>[o.createElementVNode("button",{title:"Font Size",class:o.normalizeClass(["h-[30px] px-2 min-w-[30px] rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700 space-x-1",{"bg-gray-100 text-gray-900":l.value}])},[...u[0]||(u[0]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"lucide lucide-alarge-small-icon lucide-a-large-small"},[o.createElementVNode("path",{d:"m15 16 2.536-7.328a1.02 1.02 1 0 1 1.928 0L22 16"}),o.createElementVNode("path",{d:"M15.697 14h5.606"}),o.createElementVNode("path",{d:"m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16"}),o.createElementVNode("path",{d:"M3.304 13h6.392"})],-1),o.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1)])],2)]),default:o.withCtx(()=>[o.createElementVNode("div",gV,[o.createElementVNode("ul",yV,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,p=>(o.openBlock(),o.createElementBlock("li",{key:p.value,class:"px-3 py-2 hover:bg-gray-100 cursor-pointer",onClick:h=>c(p.value)},o.toDisplayString(p.label),9,bV))),128))])])]),_:1},512))}},wV={props:{editor:Object},methods:{toggleSuperscript(){this.editor&&this.editor.commands.toggleSuperscript()}}};function xV(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("button",{title:"Superscript",onClick:e[0]||(e[0]=(...a)=>l.toggleSuperscript&&l.toggleSuperscript(...a)),class:o.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("superscript")}])},[...e[1]||(e[1]=[o.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-superscript-icon lucide-superscript"><path d="m4 19 8-8"></path><path d="m12 19-8-8"></path><path d="M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06"></path></svg><span class="sr-only">Superscript</span>',2)])],2)}const vV=it(wV,[["render",xV]]),EV={props:{editor:Object},methods:{toggleSubscript(){this.editor&&this.editor.commands.toggleSubscript()}}};function CV(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("button",{title:"Subscript",onClick:e[0]||(e[0]=(...a)=>l.toggleSubscript&&l.toggleSubscript(...a)),class:o.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",{"bg-gray-100 text-gray-900":t.editor?.isActive("subscript")}])},[...e[1]||(e[1]=[o.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-subscript-icon lucide-subscript"><path d="m4 5 8 8"></path><path d="m12 5-8 8"></path><path d="M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07"></path></svg><span class="sr-only">Subscript</span>',2)])],2)}const _V=it(EV,[["render",CV]]),SV={title:"Heading",class:"h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700"},NV={class:"truncate"},VV={class:"max-h-[200px] overflow-y-auto"},MV=["onClick"],BV={__name:"vs-editor-heading",props:{editor:Object},setup(n){const e=n,t=o.ref("popover"),r=o.ref([{label:"Heading 1",value:1},{label:"Heading 2",value:2},{label:"Heading 3",value:3},{label:"Heading 4",value:4},{label:"Heading 5",value:5},{label:"Heading 6",value:6}]),s=o.computed(()=>{if(!e.editor)return"Paragraph";for(let c=1;c<=6;c++)if(e.editor.isActive("heading",{level:c}))return`H ${c}`;return"P"}),l=c=>({1:"font-weight:700; font-size:30px;",2:"font-weight:700; font-size:26px;",3:"font-weight:700; font-size:22px;",4:"font-weight:700; font-size:18px;",5:"font-weight:500; font-size:16px;",6:"font-weight:400; font-size:14px;"})[c]||"",a=c=>{e.editor&&(e.editor.chain().focus().setHeading({level:c}).run(),t.value&&t.value.togglePopover())},i=()=>{e.editor&&(e.editor.chain().focus().setParagraph().run(),t.value&&t.value.togglePopover())};return(c,d)=>(o.openBlock(),o.createBlock(xr,{ref_key:"popover",ref:t,placement:"bottom"},{reference:o.withCtx(()=>[o.createElementVNode("button",SV,[o.createElementVNode("span",NV,o.toDisplayString(s.value),1),d[0]||(d[0]=o.createElementVNode("svg",{class:"ml-1 text-gray-400",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1))])]),default:o.withCtx(()=>[o.createElementVNode("div",null,[o.createElementVNode("ul",VV,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,u=>(o.openBlock(),o.createElementBlock("li",{key:u.value,class:o.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",`heading-level-${u.value}`]),style:o.normalizeStyle(l(u.value)),onClick:p=>a(u.value)},o.toDisplayString(u.label),15,MV))),128)),o.createElementVNode("li",{class:"px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm border-t border-gray-200 mt-1 pt-2",onClick:i}," Paragraph ")])])]),_:1},512))}},AV=it(BV,[["__scopeId","data-v-ef7c378e"]]),TV={props:{editor:Object},methods:{clearFormatting(){this.editor&&this.editor.commands.unsetAllMarks()}}};function LV(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("button",{title:"Clear Formatting",onClick:e[0]||(e[0]=(...a)=>l.clearFormatting&&l.clearFormatting(...a)),class:"h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100"},[...e[1]||(e[1]=[o.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-remove-formatting-icon lucide-remove-formatting"><path d="M4 7V4h16v3"></path><path d="M5 20h6"></path><path d="M13 4 8 20"></path><path d="m15 15 5 5"></path><path d="m20 15-5 5"></path></svg><span class="sr-only">Clear Formatting</span>',2)])])}const DV=it(TV,[["render",LV]]),is=(n,e)=>{const t=n.__vccOpts||n;for(const[r,s]of e)t[r]=s;return t};o.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 OV={key:0,class:"vsTailwind ui-dialog__wrapper text-gray-800"},IV={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},FV={class:"font-medium text-gray-800 dark:text-[#ffffff]"},$V={class:"ui-dialog__content p-4"},RV={key:0,class:"flex justify-end gap-x-2"},PV={key:1,class:"flex justify-end items-center gap-x-2 py-3 px-4 border-t border-gray-200 dark:border-neutral-700"},zV=o.defineComponent({__name:"vs-modal",props:{title:{default:""},template:{},visible:{type:Boolean,default:!1},size:{default:"small"},closeClickBack:{type:Boolean,default:!1},content:{},buttonText:{},contentProps:{},teleport:{default:"body"}},emits:["update:visible","close","done"],setup(n,{emit:e}){const t=n,r=e,s=o.computed(()=>t.size==="small"?"md:w-5/12 w-9/12":t.size==="medium"?"md:w-6/12 w-9/12":"lg:w-7/12 w-11/12"),l=o.useAttrs();function a(){r("done")}function i(){r("update:visible",!1),r("close")}function c(u){u.key==="Escape"&&i()}function d(u,p){p&&u.target.classList.contains("vs-dialog-overlay")&&i()}return o.onMounted(()=>{window.addEventListener("keydown",c)}),o.onUnmounted(()=>{window.removeEventListener("keydown",c)}),(u,p)=>(o.openBlock(),o.createBlock(o.Teleport,{to:u.teleport},[u.visible?(o.openBlock(),o.createElementBlock("div",OV,[o.createElementVNode("div",{onMousedown:p[0]||(p[0]=h=>d(h,u.closeClickBack)),class:o.normalizeClass(["vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 bg-black bg-opacity-50",[o.unref(l).class]])},[o.createVNode(o.Transition,{name:"content",appear:""},{default:o.withCtx(()=>[o.createElementVNode("div",{class:o.normalizeClass(["ui-dialog__modal opacity-1 flex flex-col bg-white dark:bg-[#1A1A1A] border dark:border-[#454545] pointer-events-auto shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-xl",s.value])},[o.createElementVNode("div",IV,[o.createElementVNode("h3",FV,o.toDisplayString(u.title),1),o.createElementVNode("button",{type:"button",class:"size-8 inline-flex justify-center items-center gap-x-2 rounded-full border border-transparent bg-gray-100 text-gray-800 hover:bg-gray-200 focus:outline-none focus:bg-gray-200 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:text-neutral-400 dark:focus:bg-neutral-600",onClick:i},[...p[1]||(p[1]=[o.createElementVNode("span",{class:"sr-only"},"Close",-1),o.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"},[o.createElementVNode("path",{d:"M18 6 6 18"}),o.createElementVNode("path",{d:"m6 6 12 12"})],-1)])])]),o.createElementVNode("div",$V,[o.renderSlot(u.$slots,"default",{},void 0,!0)]),u.$slots.footer?(o.openBlock(),o.createElementBlock("div",RV,[o.renderSlot(u.$slots,"footer",{handleClose:i},void 0,!0)])):o.createCommentVNode("",!0),u.buttonText?(o.openBlock(),o.createElementBlock("div",PV,[o.createElementVNode("button",{type:"button",class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white 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",onClick:i}," Close "),o.createElementVNode("button",{type:"button",onClick:a,class:"py-2 px-3 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 focus:outline-hidden focus:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none"},o.toDisplayString(u.buttonText),1)])):o.createCommentVNode("",!0)],2)]),_:3})],34)])):o.createCommentVNode("",!0)],8,["to"]))}}),zc=is(zV,[["__scopeId","data-v-a6807cab"]]),jV={},HV={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 UV(n,e){return o.openBlock(),o.createElementBlock("svg",HV,[...e[0]||(e[0]=[o.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 WV=is(jV,[["render",UV]]),KV={},qV={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 GV(n,e){return o.openBlock(),o.createElementBlock("svg",qV,[...e[0]||(e[0]=[o.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 YV=is(KV,[["render",GV]]),JV={},ZV={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 XV(n,e){return o.openBlock(),o.createElementBlock("svg",ZV,[...e[0]||(e[0]=[o.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 QV=is(JV,[["render",XV]]),eM={},tM={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 nM(n,e){return o.openBlock(),o.createElementBlock("svg",tM,[...e[0]||(e[0]=[o.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"},null,-1)])])}const rM=is(eM,[["render",nM]]),oM={class:"rounded-md border border-gray-300 bg-white p-4 shadow-sm"},sM={class:"flex items-start gap-4 opacity-100 scale-5 transition-all duration-300"},lM={class:"flex-1"},aM={class:"font-medium text-gray-900"},iM={class:"mt-0.5 text-sm text-gray-700"},cM=o.defineComponent({__name:"vs-notify",props:{type:{},title:{},message:{}},setup(n){const e={success:WV,warning:YV,error:rM,info:QV};return(t,r)=>(o.openBlock(),o.createElementBlock("div",oM,[o.createElementVNode("div",sM,[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(e[t.type]))),o.createElementVNode("div",lM,[o.createElementVNode("strong",aM,o.toDisplayString(t.title),1),o.createElementVNode("p",iM,o.toDisplayString(t.message),1)]),r[0]||(r[0]=o.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"},[o.createElementVNode("span",{class:"sr-only"},"Dismiss popup"),o.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"},[o.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})])],-1))])]))}});o.reactive({visible:!0});const dM=n=>{const{template:e="",title:t="",content:r,contentProps:s={},size:l="medium"}=n||{},a=document.querySelector("body");if(!a)return console.error('Modal root element with id "#modal" not found!'),{close:()=>{}};const i=document.createElement("div");a.appendChild(i);const c={title:t,template:e,visible:!0,size:l,closeClickBack:!0,onClose:u},d=o.createApp({render(){return o.h(zc,c,{default:()=>[r?o.h(r,s):o.h("p",e)]})}});function u(){d.unmount(),i.remove()}return d.mount(i),{close:u}},aa={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"},dt=n=>{const{type:e="info",title:t,message:r,position:s="right-bottom"}=n||{};let l=document.querySelector("#notify-root");l||(l=document.createElement("div"),l.id="notify-root",l.className=`fixed z-[2000] flex flex-col gap-3 ${aa[s]} p-6 max-w-md mx-auto font-sans antialiased`,document.body.appendChild(l)),l.className.includes(aa[s])||(Object.values(aa).forEach(c=>{l.classList.remove(...c.split(" "))}),l.classList.add(...aa[s].split(" ")));const a=document.createElement("div");l.appendChild(a);const i=o.createApp({render(){return o.h(cM,{type:e,title:t,message:r,onClose:()=>{i.unmount(),a.remove()}})}});i.mount(a),a.querySelector("button")?.addEventListener("click",()=>{a.classList.add("opacity-0","scale-95","transition-all","duration-300"),setTimeout(()=>{i.unmount(),a.remove()},350)}),setTimeout(()=>{a.classList.add("opacity-0","scale-95","transition-all","duration-300"),setTimeout(()=>{i.unmount(),a.remove()},350)},3500)},uM={class:"w-full relative"},pM={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},hM={class:"opacity-100"},fM={key:0,class:"text-red-500 text-[14px]"},mM={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},gM=o.defineComponent({__name:"vs-layout-default",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){const e=o.ref("uk"),t=r=>{r.detail.key==="locale"&&(e.value=r.detail.newValue)};return o.onMounted(()=>{e.value=localStorage.locale,window.addEventListener("storage",t)}),o.onUnmounted(()=>{window.removeEventListener("resize",t)}),(r,s)=>(o.openBlock(),o.createElementBlock("div",uM,[r.ua||r.label?(o.openBlock(),o.createElementBlock("div",pM,[o.createElementVNode("span",hM,o.toDisplayString(r.item[e.value]||r.ua||r.label),1),r.item?.rules?.includes("required")?(o.openBlock(),o.createElementBlock("span",fM,"*")):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),o.renderSlot(r.$slots,"default",o.mergeProps(r.$attrs,{class:{"opacity-60":r.item.disabled}})),r.error?(o.openBlock(),o.createElementBlock("span",mM,o.toDisplayString(r.error),1)):o.createCommentVNode("",!0)]))}}),yM={class:"w-full relative flex flex-row items-center gap-2"},bM={key:0,class:"text-red-500 text-[14px]"},kM={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},wM=o.defineComponent({__name:"vs-layout-horizontal",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{default:()=>({container:12,label:3})}},setup(n){const e=n,t=o.computed(()=>e.columns??{container:12,label:3}),r=o.computed(()=>{const{container:i,label:c}=t.value;return!i||i<=0?0:Math.min(Math.max(c??0,0),i)/i}),s=o.computed(()=>e.item?.type==="html"||r.value<=0?!1:!!(e.ua||e.label)),l=o.computed(()=>{if(!s.value)return{};const i=`${r.value*100}%`;return{flexBasis:i,maxWidth:i}}),a=o.computed(()=>{const{container:i,label:c}=t.value;if(!i||i<=0)return{};if(e.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!s.value)return{flexBasis:"100%",maxWidth:"100%"};const d=Math.max(i-Math.max(c??0,0),0)/i;if(!d)return{};const u=`${d*100}%`;return{flexBasis:u,maxWidth:u}});return(i,c)=>(o.openBlock(),o.createElementBlock("div",yM,[s.value?(o.openBlock(),o.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0",style:o.normalizeStyle(l.value)},[o.createTextVNode(o.toDisplayString(i.ua||i.label)+" ",1),i.item?.rules?.includes("required")&&(i.ua||i.label)?(o.openBlock(),o.createElementBlock("span",bM,"*")):o.createCommentVNode("",!0)],4)):o.createCommentVNode("",!0),o.createElementVNode("div",{class:"flex-1 min-w-0",style:o.normalizeStyle(a.value)},[o.renderSlot(i.$slots,"default",o.normalizeProps(o.guardReactiveProps(i.$attrs)))],4),i.error?(o.openBlock(),o.createElementBlock("span",kM,o.toDisplayString(i.error),1)):o.createCommentVNode("",!0)]))}}),xM={class:"w-full relative"},vM={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},EM=o.defineComponent({__name:"vs-layout-inline",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){return(e,t)=>(o.openBlock(),o.createElementBlock("div",xM,[o.renderSlot(e.$slots,"default",o.normalizeProps(o.guardReactiveProps(e.$attrs))),e.error?(o.openBlock(),o.createElementBlock("span",vM,o.toDisplayString(e.error),1)):o.createCommentVNode("",!0)]))}}),CM={class:"flex-1 min-w-0"},_M={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},SM={class:"truncate"},NM={key:0,class:"text-red-500 text-[14px]"},VM={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},MM={key:0,class:"mt-1 text-xs text-red-500"},BM=o.defineComponent({__name:"vs-layout-settings",props:{ua:{default:""},uk:{},en:{},de:{},es:{},fr:{},item:{default:()=>({})},error:{type:[String,Boolean],default:""},label:{default:""},columns:{}},setup(n){const e=n,t=o.ref("uk");o.computed(()=>(e.item??{})?.[t.value]??e.ua??e.label??"");const r=o.computed(()=>e.item?.description??""),s=o.computed(()=>Array.isArray(e.item?.rules)&&e.item.rules.includes("required")),l=o.computed(()=>(typeof e.error=="string"?e.error:"")??""),a=i=>{i.key==="locale"&&(t.value=i.newValue??"uk")};return o.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(t.value=localStorage.locale)}catch{}window.addEventListener("storage",a)}),o.onUnmounted(()=>{window.removeEventListener("storage",a)}),(i,c)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["w-full relative",{"opacity-60":i.item?.disabled}])},[o.createElementVNode("div",{class:o.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(i.item.type)?"flex flex-col":""]])},[o.createElementVNode("div",CM,[i.ua||i.label?(o.openBlock(),o.createElementBlock("p",_M,[o.createElementVNode("span",SM,o.toDisplayString(i.item[t.value]||i.ua||i.label),1),s.value?(o.openBlock(),o.createElementBlock("span",NM,"*")):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),r.value?(o.openBlock(),o.createElementBlock("p",VM,o.toDisplayString(r.value),1)):o.createCommentVNode("",!0)]),o.createElementVNode("div",{class:o.normalizeClass(["w-full",["select","native-select"].includes(i.item.type)?"md:w-[30%]":"md:w-auto"])},[o.renderSlot(i.$slots,"default",o.normalizeProps(o.guardReactiveProps(i.$attrs)))],2)],2),l.value?(o.openBlock(),o.createElementBlock("p",MM,o.toDisplayString(l.value),1)):o.createCommentVNode("",!0)],2))}}),AM={default:gM,horizontal:wM,inline:EM,settings:BM};function nn(n){return{inputClass:o.computed(()=>{const e=`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"?`${e}h-[32px]`:`${e}h-[38px]`})}}const TM=["placeholder","disabled"],LM=o.defineComponent({__name:"vs-input-password",props:o.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=nn(e.style),r=o.useModel(n,"modelValue"),s=o.computed(()=>!!e.disabled),l=o.computed(()=>e.placeholder??"");return(a,i)=>o.withDirectives((o.openBlock(),o.createElementBlock("input",{type:"password","onUpdate:modelValue":i[0]||(i[0]=c=>r.value=c),placeholder:l.value,disabled:s.value,class:o.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[o.unref(t),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,TM)),[[o.vModelText,r.value]])}}),DM=["placeholder","disabled"],ia=o.defineComponent({__name:"vs-input-text",props:o.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=nn(e.style),r=o.useModel(n,"modelValue"),s=o.computed(()=>!!e.disabled),l=o.computed(()=>e.placeholder??"");return(a,i)=>o.withDirectives((o.openBlock(),o.createElementBlock("input",{type:"text","onUpdate:modelValue":i[0]||(i[0]=c=>r.value=c),placeholder:l.value,disabled:s.value,class:o.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[o.unref(t),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,DM)),[[o.vModelText,r.value]])}}),OM=["placeholder","disabled","min","max"],IM=o.defineComponent({__name:"vs-input-number",props:o.mergeModels({min:{},max:{},style:{default:()=>({})},customClass:{},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=nn(e.style),r=o.useModel(n,"modelValue"),s=o.computed(()=>!!e.disabled);return(l,a)=>o.withDirectives((o.openBlock(),o.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":a[0]||(a[0]=i=>r.value=i),placeholder:l.placeholder,disabled:s.value,class:o.normalizeClass(["py-1.5 px-3 block w-full bg-white",[o.unref(t)]]),style:{border:"1px solid #CFD9E0"},min:l.min,max:l.max},null,10,OM)),[[o.vModelText,r.value]])}}),Re=(n,e)=>{const t=n.__vccOpts||n;for(const[r,s]of e)t[r]=s;return t},FM={},$M={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 RM(n,e){return o.openBlock(),o.createElementBlock("svg",$M,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const PM=Re(FM,[["render",RM]]),zM={class:"flex items-center gap-[4px]"},jM=["value","id","disabled"],HM=["for"],UM={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},WM=o.defineComponent({__name:"vs-checkbox-default",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},id:{},modelValue:{default:""},info:{},error:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=e,r=n,s=o.computed({get:()=>r.modelValue,set:a=>t("update:modelValue",a)}),l=o.computed(()=>!!r.disabled);return(a,i)=>(o.openBlock(),o.createElementBlock("div",zM,[o.withDirectives(o.createElementVNode("input",{type:"checkbox",value:a.value,"onUpdate:modelValue":i[0]||(i[0]=c=>s.value=c),class:o.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":l.value}]),id:a.id,disabled:l.value},null,10,jM),[[o.vModelCheckbox,s.value]]),o.createElementVNode("label",{for:a.id,class:o.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":l.value}])},[o.createElementVNode("div",{class:o.normalizeClass(["h-[16px] text-white w-[16px] flex items-center justify-center shrink-0 border rounded",[s.value?"bg-blue-600 border-blue-600":"bg-white border-gray-600",a.error?"border-red-600":""]])},[o.createVNode(PM,{height:"12",width:"12"})],2),o.createElementVNode("span",UM,[o.renderSlot(a.$slots,"default",{},()=>[o.createTextVNode(o.toDisplayString(a.label),1)])])],10,HM)]))}}),KM=["name","value","disabled"],qM={class:"flex items-center gap-[6px] text-[14px]"},GM={key:0,class:"text-[16px]"},YM=["src"],JM=o.defineComponent({__name:"vs-checkbox-buttons",props:{value:{type:[String,Number,Boolean],default:""},label:{default:""},modelValue:{default:""},disabled:{type:Boolean},id:{},icon:{},imgUrl:{},style:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,s=o.computed({get:()=>t.modelValue,set:i=>{r("update:modelValue",i)}}),l=o.computed(()=>Array.isArray(s.value)?s.value.includes(t.value):s.value===!0||s.value===t.value),a=o.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(i,c)=>(o.openBlock(),o.createElementBlock("label",{class:o.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[a.value,l.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[o.withDirectives(o.createElementVNode("input",{type:"checkbox",class:"hidden",name:i.id,value:i.value,"onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),disabled:i.disabled},null,8,KM),[[o.vModelCheckbox,s.value]]),o.createElementVNode("span",qM,[i.icon||i.imgUrl?(o.openBlock(),o.createElementBlock("span",GM,[i.icon?(o.openBlock(),o.createElementBlock("i",{key:0,class:o.normalizeClass(i.icon)},null,2)):o.createCommentVNode("",!0),i.imgUrl?(o.openBlock(),o.createElementBlock("img",{key:1,src:i.imgUrl,width:"16",height:"16",alt:"icon"},null,8,YM)):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),o.renderSlot(i.$slots,"default",{},()=>[o.createTextVNode(o.toDisplayString(i.label),1)])])],2))}}),ZM={class:"flex items-center"},jc=o.defineComponent({__name:"vs-input-checkbox-item",props:{value:{default:""},label:{default:""},disabled:{type:Boolean,default:!1},view:{default:"default"},modelValue:{type:[Boolean,Array],default:!1},icon:{},imgUrl:{},slots:{},option:{},style:{},error:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,s=`radio-${Math.floor(Math.random()*1e4)}`,l=o.computed({get:()=>Array.isArray(t.modelValue)?Array.isArray(t.modelValue)&&t.modelValue.includes(t.value):t.modelValue,set:i=>{if(Array.isArray(t.modelValue)){let c=[...t.modelValue];i?c.includes(t.value)||c.push(t.value):c=c.filter(d=>d!==t.value),r("update:modelValue",c)}else r("update:modelValue",i)}}),a=o.ref(`vs-checkbox-${t.view||"default"}`);return(i,c)=>(o.openBlock(),o.createElementBlock("div",ZM,[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(a.value==="vs-checkbox-buttons"?o.unref(JM):o.unref(WM)),{value:i.value,label:i.label,info:i.option?.info,disabled:i.disabled,modelValue:l.value,"onUpdate:modelValue":c[0]||(c[0]=d=>l.value=d),id:s,icon:i.icon,imgUrl:i.imgUrl,style:o.normalizeStyle(i.style),error:i.error},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(i.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),XM={},QM={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 eB(n,e){return o.openBlock(),o.createElementBlock("svg",QM,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const tB=Re(XM,[["render",eB]]),nB={},rB={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 oB(n,e){return o.openBlock(),o.createElementBlock("svg",rB,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),o.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const sB=Re(nB,[["render",oB]]),lB={},aB={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 iB(n,e){return o.openBlock(),o.createElementBlock("svg",aB,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M12 9h.01"},null,-1),o.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),o.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 cB=Re(lB,[["render",iB]]),dB={key:0,class:"flex items-start gap-x-1"},uB={key:0,class:"text-red-500 text-[14px]"},pB=["title"],hB=["disabled"],xm=o.defineComponent({__name:"vs-input-switcher",props:o.mergeModels({rules:{default:()=>[]},view:{default:"checkbox"},label:{default:""},i:{default:""},text:{default:""},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{}},{modelValue:{type:Boolean,default:!1},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=o.useModel(n,"modelValue");return(r,s)=>e.view==="checkbox"?(o.openBlock(),o.createElementBlock("div",dB,[o.createVNode(jc,{modelValue:t.value,"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l),label:r.text,error:r.error||""},null,8,["modelValue","label","error"]),r.rules?.includes("required")?(o.openBlock(),o.createElementBlock("span",uB,"*")):o.createCommentVNode("",!0),r.i?(o.openBlock(),o.createElementBlock("button",{key:1,class:"cursor-pointer",title:r.i,onClick:s[1]||(s[1]=o.withModifiers(()=>{},["prevent"]))},[o.createVNode(o.unref(cB),{class:"text-gray-500 w-[14px] h-[14px]"})],8,pB)):o.createCommentVNode("",!0)])):(o.openBlock(),o.createElementBlock("button",{key:1,type:"button",class:o.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-${r.style?.primaryColor||"blue"}-500`:"bg-stone-200",r.customClass]]),disabled:r.disabled,onClick:s[2]||(s[2]=l=>t.value=!t.value)},[o.createElementVNode("span",{"data-state":"checked",class:o.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,hB))}}),fB=["id","innerHTML"],vm=o.defineComponent({__name:"vs-input-static",props:{text:{default:""},html:{default:""},style:{},customClass:{default:""},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},setup(n){return(e,t)=>(o.openBlock(),o.createElementBlock("div",{id:e.name,class:o.normalizeClass(["text-gray-900",e.customClass]),innerHTML:e.html?e.html:e.text},null,10,fB))}}),mB=["placeholder","disabled","name"],gB=o.defineComponent({__name:"vs-input-mask",props:o.mergeModels({name:{},mask:{default:""},unmask:{type:Boolean,default:!1},placeholder:{default:"_"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=nn(e.style),r=o.useModel(n,"modelValue"),s=o.ref(null);let l=null;return o.onMounted(async()=>{if(s.value){const{default:a}=await Promise.resolve().then(()=>zP);l=a(s.value,{mask:e.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),l.on("accept",()=>{r.value=e.unmask?l.unmaskedValue:l.value}),l.on("complete",()=>{r.value=e.unmask?l.unmaskedValue:l.value}),l.value=r.value??""}}),o.onBeforeUnmount(()=>{l?.destroy()}),o.watch(()=>e.mask,a=>{l&&l.updateOptions({mask:a,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),o.watch(r,a=>{l&&l.unmaskedValue!==a&&(l.value=a||"")}),(a,i)=>(o.openBlock(),o.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:s,placeholder:a.placeholder,disabled:a.disabled,name:a.name,class:o.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[o.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,mB))}}),yB={class:"relative w-full bg-white rounded-lg"},bB=["placeholder","disabled"],kB=o.defineComponent({__name:"vs-input-email",props:o.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:null},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=nn(e.style),r=o.useModel(n,"modelValue");return(s,l)=>(o.openBlock(),o.createElementBlock("div",yB,[l[1]||(l[1]=o.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)),o.withDirectives(o.createElementVNode("input",{type:"email","onUpdate:modelValue":l[0]||(l[0]=a=>r.value=a),placeholder:s.placeholder,disabled:s.disabled,class:o.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[o.unref(t),{"!border-red-600":s.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,bB),[[o.vModelText,r.value]])]))}}),wB=["value","disabled"],xB={class:"text-[13px] text-gray-700"},vB=o.defineComponent({__name:"vs-input-radio-default",props:o.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=o.useModel(n,"modelValue"),r=o.computed(()=>!!e.disabled);return(s,l)=>(o.openBlock(),o.createElementBlock("label",{class:o.normalizeClass(["flex items-center gap-0",[e.customClass,r.value?"cursor-not-allowed opacity-60":""]])},[o.withDirectives(o.createElementVNode("input",{"onUpdate:modelValue":l[0]||(l[0]=a=>t.value=a),type:"radio",value:e.value,disabled:r.value,class:"hidden"},null,8,wB),[[o.vModelRadio,t.value]]),o.createElementVNode("span",{class:o.normalizeClass(["w-[16px] shrink-0 h-[16px] border rounded-full flex items-center justify-center mr-[10px]",[`border-${e.style?.primaryColor||"blue"}-500`,r.value?"opacity-50 cursor-not-allowed":""]])},[t.value==e.value?(o.openBlock(),o.createElementBlock("span",{key:0,class:o.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${e.style?.primaryColor||"blue"}-500`]])},null,2)):o.createCommentVNode("",!0)],2),o.createElementVNode("span",xB,o.toDisplayString(e.text),1)],2))}}),EB=["value","disabled"],CB={class:"text-[13px] text-gray-700"},_B=o.defineComponent({__name:"vs-input-radio-buttons",props:o.mergeModels({style:{},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{},value:{},text:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=o.useModel(n,"modelValue"),r=o.computed(()=>!!e.disabled);return(s,l)=>(o.openBlock(),o.createElementBlock("label",{class:o.normalizeClass(["flex items-center border rounded-lg px-2 py-1",[t.value==e.value?`ring-2 ring-ring ring-${e.style?.primaryColor||"blue"}-500`:"",e.customClass,r.value?"cursor-not-allowed opacity-60":""]])},[o.withDirectives(o.createElementVNode("input",{"onUpdate:modelValue":l[0]||(l[0]=a=>t.value=a),type:"radio",value:e.value,disabled:r.value,class:"hidden"},null,8,EB),[[o.vModelRadio,t.value]]),o.createElementVNode("span",CB,o.toDisplayString(e.text),1)],2))}}),SB={"vs-input-radio-default":vB,"vs-input-radio-buttons":_B},Em=o.defineComponent({__name:"vs-input-radio",props:o.mergeModels({options:{},position:{default:"vertical"},view:{default:"default"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=o.useModel(n,"modelValue"),r=o.computed(()=>SB[`vs-input-radio-${e.view}`]);return(s,l)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass([s.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.options,a=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(r.value),o.mergeProps({key:a?.id,text:a.text,value:a.id.toString(),checked:t.value===a.id,modelValue:t.value,"onUpdate:modelValue":l[0]||(l[0]=i=>t.value=i)},{ref_for:!0},s.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),NB={key:1,class:"w-full flex flex-col gap-4"},VB={key:0,class:"text-sm font-medium text-muted-foreground my-2"},MB="Без категорії",BB=o.defineComponent({__name:"vs-input-checkbox",props:{options:{default:()=>[]},position:{default:"vertical"},slots:{default:null},colSpan:{default:0},data:{},view:{},group:{default:void 0},values:{default:()=>[]},style:{},customClass:{},disabled:{type:Boolean},modelValue:{default:!1},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,s=o.ref([]),l=o.reactive({}),a=f=>f?.value||f?.id||f?.text||f,i=f=>f.text||String(f),c=f=>`lg:col-span-${f||12}`,d=o.computed(()=>[t.position==="vertical"?"flex flex-col":"",t.colSpan?"grid":"flex justify-start"]),u=f=>f==null||f===""?null:typeof f=="string"||typeof f=="number"?f:String(f),p=o.computed(()=>{if(!t.group)return[];const f=new Map;s.value.forEach(k=>{const x=k[t.group],w=u(x);f.has(w)||f.set(w,[]),f.get(w)?.push(k)});const m=[];t.values?.length&&t.values.forEach(k=>{const x=u(k);m.push(x)});const g=new Set,y=k=>{const x=f.get(k)||[];if(!x.length)return null;const w=k===null?"group-null":`group-${String(k)}`,v=k===null?MB:String(k);return g.add(k),{key:w,label:v,options:x}},b=[];return m.forEach(k=>{const x=y(k);x&&b.push(x)}),f.forEach((k,x)=>{if(g.has(x))return;const w=y(x);w&&b.push(w)}),b}),h=async()=>{try{const f=await fetch(`/api/suggest/${t.data}`).then(m=>m.json());s.value=f?.data||f}catch(f){console.error(f)}};return o.watch(()=>t.modelValue,f=>{if(typeof f=="boolean"&&s.value.length===1){const m=a(s.value[0]);l[m]=f}else if(Array.isArray(f)){const m=new Set(f);s.value.forEach(g=>{if(!g.disabled){const y=a(g);l[y]=m.has(y)}})}},{immediate:!0}),o.watch(l,()=>{if(!s.value.length){r("update:modelValue",null);return}const f=Object.entries(l).filter(([,m])=>m).map(([m])=>m);r("update:modelValue",f.length===0?[]:f)},{deep:!0}),o.onMounted(()=>{if(t.data)h().then(()=>{if(typeof t.modelValue=="boolean"&&s.value.length===1){const f=a(s.value[0]);l[f]=t.modelValue}else if(Array.isArray(t.modelValue)){const f=new Set(t.modelValue);s.value.forEach(m=>{if(!m.disabled){const g=a(m);l[g]=f.has(g)}})}});else if(s.value=t.options,typeof t.modelValue=="boolean"&&s.value.length===1){const f=a(s.value[0]);l[f]=t.modelValue}else if(Array.isArray(t.modelValue)){const f=new Set(t.modelValue);s.value.forEach(m=>{if(!m.disabled){const g=a(m);l[g]=f.has(g)}})}}),(f,m)=>t.group?(o.openBlock(),o.createElementBlock("div",NB,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(p.value,g=>(o.openBlock(),o.createElementBlock("div",{key:g.key,class:"flex flex-col gap-2"},[g.label?(o.openBlock(),o.createElementBlock("span",VB,o.toDisplayString(g.label),1)):o.createCommentVNode("",!0),o.createElementVNode("div",{class:o.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(g.options,y=>(o.openBlock(),o.createBlock(jc,{modelValue:l[a(y)],"onUpdate:modelValue":b=>l[a(y)]=b,value:a(y),class:o.normalizeClass(c(f.colSpan)),disabled:t.disabled||y.disabled,label:i(y),key:`${g.key}-${a(y)}`,icon:y?.icon,imgUrl:y?.imgUrl,option:y,view:f.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(o.openBlock(),o.createElementBlock("div",{key:0,class:o.normalizeClass(["p-0 w-full gap-[10px]",d.value])},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.value,g=>(o.openBlock(),o.createBlock(jc,{modelValue:l[a(g)],"onUpdate:modelValue":y=>l[a(g)]=y,value:a(g),class:o.normalizeClass(c(f.colSpan)),disabled:t.disabled||g.disabled,label:i(g),key:a(g),icon:g?.icon,imgUrl:g?.imgUrl,option:g,view:f.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),AB=Re(BB,[["__scopeId","data-v-8e66207e"]]),TB=["type","placeholder","disabled"],LB=o.defineComponent({__name:"vs-input-date1",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},mode:{default:"date"}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n;function r(u){return u?t.mode==="datetime"?(u.includes("T")?u:null)||u+(u.includes(" ")?"":"T00:00"):u?.split(" ")[0]:null}const{inputClass:s}=nn(t.style),l=e,a=o.computed({get:()=>r(t.modelValue),set:u=>l("update:modelValue",u)}),i=o.computed(()=>t.mode==="datetime"?"datetime-local":t.mode),c=o.computed(()=>!!t.disabled),d=o.computed(()=>t.placeholder??"");return(u,p)=>o.withDirectives((o.openBlock(),o.createElementBlock("input",{type:i.value,"onUpdate:modelValue":p[0]||(p[0]=h=>a.value=h),placeholder:d.value,disabled:c.value,ref:"date",class:o.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[u.modelValue?"":"text-opacity-50",o.unref(s)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,TB)),[[o.vModelDynamic,a.value]])}}),Cm=async(n,e,t,r)=>{try{const s=new FormData;return s.append("unique","true"),s.append("file",n),(await fetch(`/file/upload/uploads?id=${e||""}&form=${t||""}&table=${r||""}`,{method:"POST",body:s}).then(l=>l.json()))?.result}catch(s){return dt({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",s),null}},DB=async n=>{try{return await fetch(`file/delete${n}`),!0}catch(e){return console.error(e),!1}},_m=async n=>{try{const e=await fetch(`file/download/files/uploads${n}`),t=await e.arrayBuffer(),r=e.headers["content-type"],s=new TextDecoder("utf-8").decode(t),l=new Blob([s],{type:r}),a=document.createElement("a");a.setAttribute("download",n),a.href=window.URL.createObjectURL(l),a.click()}catch(e){console.error(e.message)}},OB={},IB={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 FB(n,e){return o.openBlock(),o.createElementBlock("svg",IB,e[0]||(e[0]=[o.createElementVNode("path",{d:"M5 12h14"},null,-1),o.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const cs=Re(OB,[["render",FB]]),$B={},RB={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 PB(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("svg",RB,e[0]||(e[0]=[o.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 zB=Re($B,[["render",PB]]),jB={},HB={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 UB(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("svg",HB,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),o.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),o.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const WB=Re(jB,[["render",UB]]),KB={},qB={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 GB(n,e){return o.openBlock(),o.createElementBlock("svg",qB,e[0]||(e[0]=[o.createStaticVNode('<path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M14 3v4a1 1 0 0 0 1 1h4"></path><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2z"></path><path d="M9 9l1 0"></path><path d="M9 13l6 0"></path><path d="M9 17l6 0"></path>',6)]))}const Sm=Re(KB,[["render",GB]]),YB={},JB={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 ZB(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("svg",JB,e[0]||(e[0]=[o.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 XB=Re(YB,[["render",ZB]]),QB={},eA={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 tA(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("svg",eA,e[0]||(e[0]=[o.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 nA=Re(QB,[["render",tA]]),rA=n=>{if(!n)return"";const e=n?.split(".");return e[e.length-1]},oA=n=>{const e=rA(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)?WB:t.textsFormat.includes(e)?nA:t.documentsFormat.includes(e)?zB:t.archivesFormat.includes(e)?XB:Sm},sA={},lA={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 aA(n,e){return o.openBlock(),o.createElementBlock("svg",lA,e[0]||(e[0]=[o.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 ca=Re(sA,[["render",aA]]),iA={},cA={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 dA(n,e){return o.openBlock(),o.createElementBlock("svg",cA,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),o.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),o.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Nm=Re(iA,[["render",dA]]),uA=["title"],pA={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},hA=o.defineComponent({__name:"vs-input-file-list-item",props:o.mergeModels({format:{},multiple:{type:Boolean},max_size:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{value:{},valueModifiers:{},item:{},itemModifiers:{}}),emits:["update:value","update:item"],setup(n){const e=o.useModel(n,"value"),t=o.useModel(n,"item"),r=n;return(s,l)=>(o.openBlock(),o.createElementBlock("div",{title:t.value,class:"h-[120px] w-[120px] border text-gray-300 border-dashed border-[#CFD9E0] rounded-lg overflow-hidden relative item-file"},[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(oA)(t.value)),{src:t.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:l[0]||(l[0]=a=>o.unref(_m)(t.value))},null,8,["src"])),o.createElementVNode("div",pA,[o.createElementVNode("button",{type:"button",onClick:l[1]||(l[1]=a=>{o.unref(DB)(t.value),e.value=r.multiple?e.value?.filter(i=>i!==t.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[o.createVNode(ca,{class:"w-4 h-4"})]),o.createElementVNode("button",{type:"button",onClick:l[2]||(l[2]=a=>o.unref(_m)(t.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[o.createVNode(Nm,{class:"w-4 h-4"})])])],8,uA))}}),Vm=Re(hA,[["__scopeId","data-v-286cdbc0"]]),fA={class:"flex items-center gap-x-2"},mA=["multiple","disabled"],gA={key:1,class:"flex items-center flex-wrap gap-2"},yA={key:1,class:"loader"},bA={key:1,class:"loader"},kA=o.defineComponent({__name:"vs-input-file",props:o.mergeModels({format:{},multiple:{type:Boolean},max_size:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{},modelModifiers:{}}),emits:o.mergeModels(["change"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=o.useModel(n,"modelValue"),s=e,l=o.ref(null),a=o.ref(!1),i=u=>Array.isArray(r.value)&&r.value[u]||"",c=u=>{if(t.max_size&&u.size>t.max_size*1024*1024){const p=(u.size/1048576).toFixed(2);return dt({type:"error",title:"Помилка!",message:`Файл "${u.name}" занадто великий. Максимальний розмір: ${t.max_size} МБ, розмір файлу: ${p} МБ`,position:"right-bottom"}),!1}return!0},d=async u=>{const{files:p}=u.target;if(!p||p.length===0)return;const h=Array.from(p);if(t.max_size&&h.filter(f=>!c(f)).length>0){l.value&&(l.value.value="");return}a.value=!0;try{if(t.multiple){const f=Array.from(p).map(async g=>t.format&&!g.name.endsWith(t.format)?null:await Cm(g,"1","form","table")),m=(await Promise.all(f)).filter(g=>g!==null).map(g=>g?.file_path).filter(Boolean);r.value=[...r.value||[],...m],s("change",r.value)}else{const f=p[0];if(t.format&&!f.name.endsWith(t.format))return;const m=await Cm(f,"1","form","table");r.value=m?.file_path,s("change",r.value||"")}}finally{a.value=!1,l.value&&(l.value.value="")}};return(u,p)=>(o.openBlock(),o.createElementBlock("div",fA,[o.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:l,type:"file",multiple:u.multiple,onChange:d,disabled:a.value||u.disabled},null,40,mA),!u.multiple&&r.value?(o.openBlock(),o.createBlock(Vm,{key:0,item:r.value,"onUpdate:item":p[0]||(p[0]=h=>r.value=h),value:r.value,"onUpdate:value":p[1]||(p[1]=h=>r.value=h)},null,8,["item","value"])):u.multiple?(o.openBlock(),o.createElementBlock("div",gA,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(h,f)=>(o.openBlock(),o.createBlock(Vm,{multiple:u.multiple,key:f,value:r.value,"onUpdate:value":p[2]||(p[2]=m=>r.value=m),item:i(f)},null,8,["multiple","value","item"]))),128)),o.createElementVNode("div",{onClick:p[3]||(p[3]=h=>!u.disabled&&!a.value&&l.value?.click()),class:o.normalizeClass(["relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-[#CFD9E0] rounded-lg flex items-center justify-center transition-all duration-300",u.disabled||a.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[a.value?(o.openBlock(),o.createElementBlock("div",yA)):(o.openBlock(),o.createBlock(cs,{key:0,class:"w-6 h-6"}))],2)])):o.createCommentVNode("",!0),u.multiple?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",{key:2,onClick:p[4]||(p[4]=h=>l.value?.click()),class:o.normalizeClass([u.disabled||a.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500","relative h-[120px] w-[120px] border text-gray-300 hover:text-blue-500 border-dashed border-gray-300 rounded-lg flex items-center justify-center cursor-pointer hover:border-blue-500 transition-all duration-300 hover:bg-blue-50"])},[a.value?(o.openBlock(),o.createElementBlock("div",bA)):(o.openBlock(),o.createBlock(cs,{key:0,class:"w-6 h-6"}))],2))]))}}),wA=Re(kA,[["__scopeId","data-v-e613a523"]]),xA={class:"max-w-[55vw]"},vA={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},EA={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},CA={class:"px-[5px]"},_A={class:""},da=o.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(n){const e=n,t=o.computed(()=>{try{return new Date(e.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function r(s){if(s<1024)return`${s} B`;const l=s/1024;return l<1024?`${l.toFixed(2)} KB`:`${(l/1024).toFixed(2)} MB`}return(s,l)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[l[1]||(l[1]=o.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)),o.createElementVNode("div",xA,[o.createElementVNode("p",vA,o.toDisplayString(s.item?.uploaded_name),1),o.createElementVNode("p",EA,[o.createElementVNode("span",null,o.toDisplayString(s.item?.username),1),o.withDirectives(o.createElementVNode("span",CA,"|",512),[[o.vShow,s.item?.username]]),o.createElementVNode("span",null,o.toDisplayString(t.value),1),l[0]||(l[0]=o.createElementVNode("span",{class:"px-[5px]"},"|",-1)),o.createElementVNode("span",_A,o.toDisplayString(r(s.item?.size)),1)])])],64))}}),SA={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},NA={key:0,class:"flex w-full gap-x-3 items-center"},VA={key:1,class:"flex gap-x-3 w-full items-center"},MA={key:2,class:"flex gap-x-3 w-full items-center"},BA=["href"],AA={key:3,class:"flex gap-x-3 w-full items-center"},TA={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},LA={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"},DA={class:"inline-block"},OA={class:"inline-block"},IA=o.defineComponent({__name:"vs-widget-file-item",props:{item:{default:null},index:{default:0},prefix:{default:"/api"}},emits:["update","openModal","openLightbox"],setup(n,{emit:e}){const t=n,r=e;function s(u){return["pdf","json"].includes(u.ext)}function l(u){return["ppt","pptx","doc","docx","xls","xlsx"].includes(u.ext)}function a(u){const p=document.createElement("a");p.setAttribute("download",u?.uploaded_name),p.href=u?.file_path,p.click()}async function i(){try{await fetch(`${t.prefix}/widget/file/${t.item.entity_id}/${t.item.file_id}`),r("update")}catch(u){console.error(u)}}function c(){r("openModal",{title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати",confirm:i,updateListOnConfirm:!0})}function d(u){(t.item.ext==="jpg"||t.item.ext==="png")&&r("openLightbox",{item:t.item,index:u})}return(u,p)=>(o.openBlock(),o.createElementBlock("div",SA,[u.item.ext==="jpg"||u.item.ext==="png"?(o.openBlock(),o.createElementBlock("div",NA,[o.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:p[0]||(p[0]=h=>d(u.index))},[o.createVNode(da,{item:u.item},null,8,["item"])])])):s(u.item)?(o.openBlock(),o.createElementBlock("div",VA,[o.createVNode(da,{item:u.item},null,8,["item"])])):l(u.item)?(o.openBlock(),o.createElementBlock("div",MA,[o.createElementVNode("a",{href:`/api/file-preview?id=${u.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[o.createVNode(da,{item:u.item},null,8,["item"])],8,BA)])):(o.openBlock(),o.createElementBlock("div",AA,[o.createVNode(da,{item:u.item},null,8,["item"])])),o.createElementVNode("div",TA,[o.createElementVNode("div",LA,[o.createElementVNode("div",DA,[o.createElementVNode("button",{class:"inline-flex p-[6px] justify-center items-center gap-x-2 rounded-lg border border-transparent text-gray-500 hover:bg-gray-100 disabled:opacity-50 disabled:pointer-events-none dark:text-neutral-400 focus:outline-none focus:bg-gray-100 dark:hover:bg-neutral-700 dark:focus:bg-neutral-700",onClick:p[1]||(p[1]=h=>a(u.item))},[o.createVNode(Nm,{height:"14",width:"14"})])]),p[3]||(p[3]=o.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),o.createElementVNode("div",OA,[o.createElementVNode("button",{type:"button",class:"size-[30px] inline-flex justify-center items-center gap-x-2 rounded-lg border border-transparent text-red-600 hover:bg-red-100 disabled:opacity-50 disabled:pointer-events-none focus:outline-none focus:bg-red-100 dark:text-red-500 dark:hover:bg-red-500/20 dark:focus:bg-red-500/20",onClick:p[2]||(p[2]=h=>c())},[o.createVNode(ca,{height:"14",width:"14"})])])])])]))}}),FA={},$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",class:"icon icon-tabler icons-tabler-outline icon-tabler-download"};function RA(n,e){return o.openBlock(),o.createElementBlock("svg",$A,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),o.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),o.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const PA=Re(FA,[["render",RA]]),zA={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},jA={class:"flex w-full mb-[12px] items-center gap-x-2"},HA={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},UA={class1:"ml-auto"},WA={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"},KA={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},qA={class:"relative"},GA={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"},YA={key:0},JA=o.defineComponent({__name:"vs-input-file-list",props:{id:{default:""},prefix:{default:"/api"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update"],setup(n,{emit:e}){const t=n,r=o.inject("form"),s=o.computed(()=>r.value.formId),l=o.ref(!1),a=o.ref(0),i=e,c=o.ref(!1),d=o.ref({}),u=o.ref([]),p=o.ref(""),h=o.computed(()=>Array.isArray(u.value)?u.value.filter(x=>x.ext==="jpg"||x.ext==="png").map(x=>x?.file_path):[]),f=o.computed(()=>p.value===""?u.value:u.value.filter(x=>x?.uploaded_name?.includes(p.value))),m=x=>{const w=h.value.findIndex(v=>v===x.item.file_path);w!==-1&&(l.value=!0,a.value=w)},g=async()=>{try{const x=await fetch(`${t.prefix}/widget/file/${s.value}`).then(w=>w.json());u.value=x?.rows}catch(x){console.error(x)}},y=async x=>{await Promise.all(Array.from(x.target.files).map(async w=>{const v=new FormData;v.append("file",w);try{const _=`${t.prefix}/widget/file/${s.value}`,E=await fetch(_,{method:"POST",body:v});return E.ok?(i("update","file-list"),w):(dt({type:E.status>=400&&E.status<500?"warning":"error",title:"Error",message:`Error code: ${E.status}`}),null)}catch(_){return dt({type:"error",title:"Error",message:_.message||"Unknown error"}),console.error(_),null}})),await g()},b=x=>{const w={...x};return x.cancel||(w.cancel=()=>{c.value=!1}),x.updateListOnConfirm&&(w.confirm=async()=>{await x.confirm(),c.value=!1,g()}),w},k=x=>{d.value=b(x),c.value=!0};return o.watch(s,x=>{x&&g()}),o.onMounted(()=>{s.value&&g()}),(x,w)=>{const v=o.resolveComponent("Lightbox"),_=o.resolveComponent("MessageBox");return o.openBlock(),o.createElementBlock("div",zA,[o.createElementVNode("div",jA,[o.createElementVNode("h2",HA," Файлів: "+o.toDisplayString(u.value?.length),1),o.createElementVNode("div",UA,[o.createElementVNode("label",null,[o.createElementVNode("input",{type:"file",class:"hidden",onChange:w[0]||(w[0]=E=>y(E))},null,32),o.createElementVNode("div",WA,[o.createVNode(PA,{height:"16",width:"16"})])])])]),u.value?.length>4?(o.openBlock(),o.createElementBlock("div",KA,[o.createElementVNode("div",null,[o.createElementVNode("div",qA,[w[8]||(w[8]=o.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[o.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"},[o.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),o.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),o.withDirectives(o.createElementVNode("input",{type:"text","onUpdate:modelValue":w[1]||(w[1]=E=>p.value=E),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),[[o.vModelText,p.value,void 0,{trim:!0}]])])])])):o.createCommentVNode("",!0),u.value?.length?(o.openBlock(),o.createElementBlock("div",GA,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(f.value,(E,S)=>(o.openBlock(),o.createBlock(IA,{key:S,prefix:x.prefix,item:E,index:S,onUpdate:w[2]||(w[2]=I=>x.$emit("update","file-list")),onOpenModal:w[3]||(w[3]=I=>k(I)),onOpenLightbox:w[4]||(w[4]=I=>m(I))},null,8,["prefix","item","index"]))),128)),f.value.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",YA,w[9]||(w[9]=[o.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):o.createCommentVNode("",!0),o.createVNode(v,{modelValue:l.value,"onUpdate:modelValue":w[5]||(w[5]=E=>l.value=E),startIndex:a.value,"onUpdate:index":w[6]||(w[6]=E=>a.value=E),images:h.value},null,8,["modelValue","startIndex","images"]),o.createVNode(_,o.mergeProps({modelValue:c.value,"onUpdate:modelValue":w[7]||(w[7]=E=>c.value=E),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),ZA={class:"flex items-center justify-between"},XA={class:"text-[16px] text-gray-900 font-medium"},QA={class:"grid gap-3"},e4=o.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=o.ref(e.isOpen);return o.watch(()=>e.isOpen,r=>{t.value=r}),(r,s)=>(o.openBlock(),o.createElementBlock("div",null,[o.createElementVNode("div",ZA,[o.createElementVNode("p",XA,o.toDisplayString(n.title),1),o.createVNode(xm,{modelValue:t.value,"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l),style:o.normalizeStyle(n.style)},null,8,["modelValue","style"])]),o.createVNode(o.Transition,{name:"slide-fade"},{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("div",QA,[o.renderSlot(r.$slots,"default",{},void 0,!0)],512),[[o.vShow,t.value]])]),_:3})]))}}),t4=Re(e4,[["__scopeId","data-v-90320b87"]]),n4={class:"text-[16px] text-gray-900 font-medium"},r4={class:"grid gap-3"},o4=o.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=o.ref(e.isOpen);return o.watch(()=>e.isOpen,r=>{t.value=r}),(r,s)=>(o.openBlock(),o.createElementBlock("div",null,[o.createElementVNode("button",{type:"button",onClick:s[0]||(s[0]=l=>t.value=!t.value),class:"flex items-center gap-2"},[o.createVNode(o.unref(tB),{class:o.normalizeClass(["h-4 w-4 duration-300",[t.value?"-rotate-180":""]])},null,8,["class"]),o.createElementVNode("span",n4,o.toDisplayString(n.title),1)]),o.createVNode(o.Transition,{name:"slide-fade"},{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("div",r4,[o.renderSlot(r.$slots,"default",{},void 0,!0)],512),[[o.vShow,t.value]])]),_:3})]))}}),s4=Re(o4,[["__scopeId","data-v-590eff11"]]),l4={class:"flex items-center justify-between"},a4=o.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(n){return(e,t)=>(o.openBlock(),o.createElementBlock("div",null,[o.createElementVNode("div",l4,[o.createElementVNode("p",null,o.toDisplayString(n.title),1)]),o.renderSlot(e.$slots,"default")]))}}),i4={switcher:t4,accordion:s4,default:a4},fn={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},c4=(n,e)=>String(n)===String(e),d4=(n,e)=>String(n)!==String(e),u4=(n,e)=>n>e,p4=(n,e)=>n>=e,h4=(n,e)=>n<e,f4=(n,e)=>n<=e,m4=(n,e)=>Array.isArray(e)&&e.length===2?n>=e[0]&&n<=e[1]:!1,g4=(n,e)=>String(n).startsWith(String(e)),y4=(n,e)=>String(n).endsWith(String(e)),b4=(n,e)=>String(n).includes(String(e)),k4=(n,e)=>Array.isArray(e)?e.includes(n):!1,w4=(n,e)=>Array.isArray(e)?!e.includes(n):!0,Mm=(n,e)=>{if(!e)return!0;switch(e?.[1]){case fn.Equal:return c4(n,e?.[2]);case fn.Inequal:return d4(n,e?.[2]);case fn.Higer:return u4(n,e?.[2]);case fn.HigerOrEqual:return p4(n,e?.[2]);case fn.Lower:return h4(n,e?.[2]);case fn.LowerOrEqual:return f4(n,e?.[2]);case fn.Between:return m4(n,e?.[2]);case fn.StartWith:return g4(n,e?.[2]);case fn.EndWith:return y4(n,e?.[2]);case fn.Contain:return b4(n,e?.[2]);case fn.In:return k4(n,e?.[2]);case fn.NotIn:return w4(n,e?.[2]);default:return!0}},x4=o.defineComponent({__name:"vs-input-container",props:{style:{type:Object,default:()=>({})},title:{type:String,default:""},view:{type:String,default:"default"},name:{type:String,default:""},schema:{type:Array,default:()=>[]}},setup(n){const e=n,t=o.inject("values",o.ref({})),r=o.inject("form"),s=o.computed(()=>e.schema?.filter(i=>{const c=i?.conditions;if(!c)return!0;const d=Array.isArray(c)?c[0]:c,u=e.name?t.value?.[e.name]?.[d]??t.value?.[d]:t.value?.[d];return Mm(u,c)})),l=o.computed(()=>i4[e.view]),a=o.computed(()=>{if(t.value||(t.value={}),!e.name)return t.value;const i=t.value[e.name];if(i)return i;const c={};return t.value={...t.value,[e.name]:c},c});return(i,c)=>n.schema?.length?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(l.value),{key:0,title:n.title,style:o.normalizeStyle(n.style)},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.value,d=>(o.openBlock(),o.createBlock(Tm,o.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:a.value[d.name],"onUpdate:modelValue":u=>a.value[d.name]=u,style:n.style,error:o.unref(r)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):o.createCommentVNode("",!0)}}),v4=["aria-expanded","data-focus"],E4={key:0,class:"flex flex-wrap items-center gap-1 overflow-y-auto min-w-0 flex-1"},C4={class:"flex items-center min-w-0"},_4=["title"],S4=["innerHTML"],N4=["onClick"],V4={class:"flex-1 min-w-[2px]"},M4=["placeholder"],B4=["title"],A4=["innerHTML"],T4={key:2,class:"flex-1 min-w-[2px]"},L4=["placeholder"],D4={class:"flex items-center shrink-0"},O4=["disabled"],I4=["disabled","title"],F4=["aria-disabled","onClick"],$4=["innerHTML"],R4={key:1,class:"px-3 py-2 text-center text-gray-500"},P4=["disabled"],Bm=o.defineComponent({__name:"vs-input-select",props:{multiple:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},mode:{},defaultValue:{},search:{type:Boolean,default:!0},placeholder:{default:"Оберіть значення"},prefix:{default:"api"},host:{default:""},data:{default:""},options:{default:()=>[]},api:{default:null},maxHeight:{default:400},parent:{},set:{},slot:{},add:{},teleport:{default:"body"},auto:{default:0},style:{default:()=>({})},customClass:{default:""},modelValue:{},error:{default:null},name:{}},emits:["change","update:modelValue"],setup(n,{emit:e}){const t=n,r=e,s=o.computed(()=>t.multiple),l=o.computed(()=>t.disabled);nn(t.style);const a=o.computed({get:()=>t.modelValue,set:K=>r("update:modelValue",K)});!a.value&&t.defaultValue&&(a.value=t.defaultValue);const i=o.ref(null),c=o.ref(null),d=o.ref(null),u=o.ref(null),p=o.ref(!1),h=o.ref(!1),f=o.ref(null),m=o.ref([]),g=o.ref(-1),y=o.ref([]),b=o.ref(""),k=o.ref(null),x=o.ref("bottom"),w=o.ref({}),v=o.ref([]),_=o.computed(()=>{if(!v.value.length)return[];const K=m.value,ee=new Map(K.map(se=>[se.id?.toString(),se]));return v.value.map(se=>ee.get(se?.toString())).filter(se=>!!se)}),E=o.computed(()=>t.placeholder||"Select..."),S=o.computed(()=>P(f.value));o.computed(()=>s.value?!v.value.length&&b.value==="":!S.value&&b.value==="");const I=o.computed(()=>l.value?!1:s.value?v.value.length>0:!!a.value),A=K=>s.value?v.value.some(ee=>ee?.toString()===K?.toString()):a.value?.toString()===K?.toString(),V=o.computed(()=>{let K=m.value??[];if(!t.data&&b.value.trim()!==""){const ee=b.value.toLowerCase();K=K.filter(se=>{const z=P(se).toLowerCase(),q=se.text?.toLowerCase?.()||"";return z.includes(ee)||q.includes(ee)})}if(s.value&&v.value.length){const ee=new Set(v.value.map(se=>se?.toString()));K=K.filter(se=>!ee.has(se.id?.toString()))}return K}),M=o.inject("values"),U=/\{\{\s*([^}]+?)\s*\}\}/g,R=K=>(K?String(K):"").replace(/<[^>]*>/g,"").trim(),$=o.computed(()=>t.slot??t?.optionTemplate??""),D=K=>{if(!K)return"";const ee=$.value;return ee?ee.replace(U,(se,z)=>{const q=z.trim(),C=K[q];return C!=null?String(C):""}):K.text??""},P=K=>{if(!K)return"";if(!$.value)return K.text??"";const ee=D(K);return R(ee)||K.text||""},H=K=>{t.set&&M?.value&&Object.entries(t.set).forEach(([ee,se])=>{if(!ee)return;const z=K?K[se]:null;M.value[ee]=z??null})},G=o.computed(()=>t.parent?M?.value?.[t.parent]?.toString()??null:null),ie=async K=>{if(!t.data){let ee=t.options??[];if(K?.trim()){const se=K.toLowerCase();ee=ee.filter(z=>{const q=P(z).toLowerCase(),C=z.text?.toLowerCase?.()||"";return q.includes(se)||C.includes(se)})}return ee}try{const ee=t.host??"",se=t.prefix??"api",z=t.api??`/${se}/suggest/${t.data}`,q=`${ee}${z}`,C=new URLSearchParams;return C.set("json","1"),K&&C.set("key",K),G.value!==void 0&&G.value!==null&&G.value!==""&&C.set("parent",G.value),(await fetch(`${q}?${C.toString()}`).then(N=>N.json()))?.data??[]}catch{return[]}},Ae=async()=>{t.data?m.value=await ie(b.value):m.value=t.options?[...t.options]:[]},Q=async K=>{if(K==null)return null;const ee=m.value?.find(se=>se?.id?.toString()===String(K));if(ee)return ee;if(t.data)try{const se=t.host??"",z=t.prefix??"api",q=t.api??`/${z}/suggest/${t.data}`,C=`${se}${q}`,N=new URLSearchParams;return N.set("json","1"),N.set("val",String(K)),G.value!==void 0&&G.value!==null&&G.value!==""&&N.set("parent",G.value),((await fetch(`${C}?${N.toString()}`).then(j=>j.json()))?.data??[])?.[0]??null}catch{return null}return null},Pe=async K=>{const ee=new Set(m.value.map(z=>z.id?.toString())),se=K.filter(z=>!ee.has(z?.toString()));se.length&&await se.reduce(async(z,q)=>{await z;const C=await Q(q);C&&m.value.push(C)},Promise.resolve())},ze=async()=>{l.value||(p.value=!0,await Ae(),await o.nextTick(()=>{be(),k.value?.focus(),V.value.length?g.value=0:g.value=-1}))},We=()=>{p.value=!1,g.value=-1},St=async K=>{l.value||(p.value?We():await ze())},gt=async()=>{p.value?k.value?.focus():await ze()},Wt=()=>{s.value?(v.value=[],a.value=[],r("change",[])):(f.value=null,a.value=null,r("change",null)),H(null),b.value="",o.nextTick(()=>k.value?.focus())},on=K=>{s.value&&(v.value=v.value.filter(ee=>ee?.toString()!==K?.toString()),a.value=[...v.value],r("change",a.value),o.nextTick(()=>k.value?.focus()))},Y=K=>{s.value?(A(K.id)||(v.value=[...v.value,K.id],a.value=[...v.value],r("change",a.value)),b.value="",o.nextTick(()=>{k.value?.focus(),g.value=Math.min(g.value,V.value.length-1)}),H(null)):(f.value=K,a.value=K.id,r("change",a.value),b.value="",We(),H(K))},re=K=>{A(K.id)||Y(K)},ae=(K,ee)=>{if(!K||!ee)return;const se=K.offsetTop,z=se+K.offsetHeight,q=ee.scrollTop,C=q+ee.clientHeight;let N=ee.scrollTop;se<q?N=se-80:z>C&&(N=z-ee.clientHeight+4);const j=ee;j.scrollTop=N},fe=K=>{let ee=K.parentElement;for(;ee;){if(ee.classList.contains("ui-dialog__content"))return ee;const se=window.getComputedStyle(ee),z=se.overflow+se.overflowY+se.overflowX;if(z.includes("auto")||z.includes("scroll")||ee===document.body||ee===document.documentElement)return ee;ee=ee.parentElement}return document.body},be=()=>{if(!c.value)return;const K=c.value.getBoundingClientRect(),ee=window.innerHeight||document.documentElement.clientHeight,se=window.innerWidth||document.documentElement.clientWidth,z=8,q=8,C=t.maxHeight||300,N=ee-K.bottom-q-z,j=K.top-q-z,J=N>=j,le=Math.max(se-z*2,0);let{width:ue}=K;le>0&&ue>le&&(ue=le);let{left:Ee}=K;Ee+ue+z>se&&(Ee=se-ue-z),Ee=Math.max(Ee,z);const Ce=Math.min(C,Math.max(J?N:j,50));x.value=J?"bottom":"top",w.value={position:"fixed",left:`${Ee}px`,width:`${ue}px`,minWidth:"300px",maxHeight:`${Ce}px`,transform:J?"none":"translateY(-100%)",top:J?`${K.bottom+q}px`:`${K.top-q}px`}},Oe=async K=>{l.value||!p.value&&(K.key==="ArrowDown"||K.key==="ArrowUp")&&(K.preventDefault(),await ze())},He=K=>{if(!p.value)return;const{key:ee}=K;if(ee==="ArrowDown")K.preventDefault(),g.value+1<V.value.length&&(g.value+=1,ae(y.value[g.value],d.value));else if(ee==="ArrowUp")K.preventDefault(),g.value>0&&(g.value-=1,ae(y.value[g.value],d.value));else if(ee==="Enter"){K.preventDefault();const se=V.value[g.value];se&&Y(se),k.value?.blur()}else ee==="Escape"?(K.preventDefault(),We()):ee==="Backspace"?s.value&&b.value===""&&v.value.length&&(v.value=v.value.slice(0,-1),a.value=[...v.value],r("change",a.value)):ee==="Home"?(g.value=0,ae(y.value[0],d.value)):ee==="End"?(g.value=V.value.length-1,ae(y.value[g.value],d.value)):ee==="Tab"&&We()},Ke=()=>{l.value||(h.value=!0)},B=()=>{h.value=!1,b.value=""},O=K=>{K.key==="Escape"&&p.value&&We()},Z=K=>{const ee=K.target;i.value?.contains(ee)||u.value?.contains(ee)||We()},he=K=>{p.value&&d.value&&!d.value.contains(K.target)&&be()},ve=()=>{p.value&&be()},W=()=>{p.value&&be()};o.watch(()=>t.options,K=>{K?.length&&(m.value=[...K],X())},{immediate:!0});async function X(){if(s.value)Array.isArray(a.value)?v.value=[...a.value]:(v.value=a.value==null?[]:[a.value],a.value=[...v.value]),t.data&&v.value.length&&(await Pe(v.value),await o.nextTick());else{if(Array.isArray(a.value)){const K=a.value[0]??null;a.value=K??null}a.value!=null&&(f.value=await Q(a.value)),H(f.value??null)}}o.watch(a,()=>{X()}),o.onMounted(async()=>{addEventListener("keydown",O),addEventListener("scroll",he,!0),addEventListener("resize",ve),document.addEventListener("click",Z,!0),c.value&&fe(c.value).addEventListener("scroll",W,!0),t.options?.length&&!t.data?m.value=[...t.options]:t.data&&(m.value=await ie("")),await X(),Te.value=!1}),o.onUnmounted(()=>{removeEventListener("keydown",O),removeEventListener("scroll",he,!0),removeEventListener("resize",ve),document.removeEventListener("click",Z,!0),c.value&&fe(c.value).removeEventListener("scroll",W,!0)});const Ne=o.ref(!1),qe=o.ref({}),lt=o.ref([]),T=o.ref(null);async function F(){if(!t.add?.token||T?.value.validate())return;const K=t.add.api??`/api/table/${t.add.token}`,{id:ee}=await fetch(K,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(qe.value)}).then(se=>se.json());if(!t.options?.length&&t.data){const{data:se}=await fetch(`${t.api??`/api/suggest/${t.data}`}?val=${ee}`).then(z=>z.json());f.value=se[0],m.value.push(se[0]),a.value=ee}Ne.value=!1,dt({title:"Success!",message:"Object created."})}async function te(){if(!t.add)return null;const K=await fetch(`/api/template/form/${t.add.form}`).then(ee=>ee.json());return lt.value=K.schema,Ne.value=!0,null}function ce(K,ee=200){let se;return(...z)=>{se&&clearTimeout(se),se=window.setTimeout(()=>K(...z),ee)}}const me=ce(async K=>{m.value=await ie(K)},200);o.watch(b,K=>{t.data&&me(K.trim())}),o.watch(()=>t.options,K=>{!t.data&&K?.length&&(m.value=[...K],X())},{immediate:!0}),o.watch(()=>t.parent??t.parentValue,()=>{t.data&&Ae()});const Te=o.ref(!0);return o.watch(G,async()=>{if(t.data&&(Te.value||(s.value?(v.value=[],a.value=[],r("change",[])):(f.value=null,a.value=null,r("change",null))),await Ae(),t.auto===1&&G.value&&m.value.length>0)){const K=m.value[0];K&&Y(K)}}),(K,ee)=>(o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(o.unref(zc),{visible:Ne.value,"onUpdate:visible":ee[1]||(ee[1]=se=>Ne.value=se),title:"Додати",buttonText:"Додати",onDone:F,teleport:K.teleport},{default:o.withCtx(()=>[o.createVNode(yo,{schema:lt.value,modelValue:qe.value,"onUpdate:modelValue":ee[0]||(ee[0]=se=>qe.value=se),ref_key:"addForm",ref:T},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),o.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:i,onClick:ee[5]||(ee[5]=o.withModifiers(()=>{},["stop"]))},[o.createElementVNode("div",{class:o.normalizeClass(["relative w-full font-sans",t.customClass])},[ee[10]||(ee[10]=o.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),ee[11]||(ee[11]=o.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),o.createElementVNode("div",{class:o.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",p.value||h.value?"border-blue-500 ring-1 ring-blue-500":"",l.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":p.value,"aria-haspopup":"listbox",onKeydown:Oe,onClick:gt,"data-focus":p.value||h.value?"true":"false"},[o.createElementVNode("div",{class:"flex flex-1 items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden h-full",ref_key:"triggerRef",ref:c},[s.value?(o.openBlock(),o.createElementBlock("div",E4,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(_.value,se=>(o.openBlock(),o.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border max-w-full",key:se.id},[o.createElementVNode("div",C4,[se?.color?(o.openBlock(),o.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:o.normalizeStyle({backgroundColor:se?.color})},null,4)):o.createCommentVNode("",!0),o.createElementVNode("div",{class:"truncate text-gray-900 overflow-hidden max-w-[200px] px-0.5 py-[2px] pl-1.5",title:P(se)},[$.value?(o.openBlock(),o.createElementBlock("span",{key:0,innerHTML:D(se)},null,8,S4)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(se.text),1)],64))],8,_4)]),o.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b] flex-shrink-0",onClick:o.withModifiers(z=>on(se.id),["stop"])},ee[6]||(ee[6]=[o.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[o.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,N4)]))),128)),o.createElementVNode("div",V4,[!l.value&&K.search?o.withDirectives((o.openBlock(),o.createElementBlock("input",{key:0,ref_key:"inputRef",ref:k,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:v.value.length?" ":E.value,"onUpdate:modelValue":ee[2]||(ee[2]=se=>b.value=se),onFocus:Ke,onBlur:B,onKeydown:He},null,40,M4)),[[o.vModelText,b.value]]):o.createCommentVNode("",!0)])])):!s.value&&!h.value&&S.value&&b.value===""?(o.openBlock(),o.createElementBlock("div",{key:1,class:o.normalizeClass(["truncate text-gray-900"]),title:S.value},[f.value?.color?(o.openBlock(),o.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:o.normalizeStyle({backgroundColor:f.value?.color})},null,4)):o.createCommentVNode("",!0),$.value?(o.openBlock(),o.createElementBlock("span",{key:1,class:o.normalizeClass({"pl-5":f.value?.color}),innerHTML:D(f.value)},null,10,A4)):(o.openBlock(),o.createElementBlock("span",{key:2,class:o.normalizeClass({"pl-5":f.value?.color})},o.toDisplayString(f.value?.text),3))],8,B4)):o.createCommentVNode("",!0),s.value?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",T4,[!l.value&&K.search?o.withDirectives((o.openBlock(),o.createElementBlock("input",{key:0,ref_key:"inputRef",ref:k,class:"w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-autocomplete":"list",placeholder:S.value?" ":E.value,"onUpdate:modelValue":ee[3]||(ee[3]=se=>b.value=se),onFocus:Ke,onBlur:B,onKeydown:He},null,40,L4)),[[o.vModelText,b.value]]):o.createCommentVNode("",!0)]))],512),o.createElementVNode("div",D4,[I.value?(o.openBlock(),o.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:l.value,onClick:o.withModifiers(Wt,["stop"])},ee[7]||(ee[7]=[o.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[o.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,O4)):o.createCommentVNode("",!0),ee[9]||(ee[9]=o.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),o.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:l.value,onClick:ee[4]||(ee[4]=o.withModifiers(se=>St(),["stop"])),title:p.value?"Закрити список":"Відкрити список"},ee[8]||(ee[8]=[o.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[o.createElementVNode("path",{d:"M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"})],-1)]),8,I4)])],42,v4),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[p.value?(o.openBlock(),o.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:o.normalizeClass(["fixed z-[3000] rounded bg-white shadow-[0_0_0_1px_rgba(0,0,0,0.1),0_4px_11px_rgba(0,0,0,0.1)]"]),style:o.normalizeStyle(w.value),role:"listbox"},[o.createElementVNode("div",{class:"overflow-y-auto py-1",style:o.normalizeStyle({maxHeight:w.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[V.value.length?(o.openBlock(!0),o.createElementBlock(o.Fragment,{key:0},o.renderList(V.value,(se,z)=>(o.openBlock(),o.createElementBlock("div",{key:se.id,ref_for:!0,ref:q=>y.value[z]=q,class:o.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900 ",A(se.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",g.value===z&&!A(se.id)?"bg-blue-100":""]),"aria-disabled":A(se.id)?"true":"false",role:"option",tabindex:"-1",onClick:q=>re(se)},[se?.color?(o.openBlock(),o.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:o.normalizeStyle({backgroundColor:se?.color})},null,4)):o.createCommentVNode("",!0),o.createElementVNode("div",{class:o.normalizeClass(["leading-[19px]",g.value===se.id?"text-white":"",(g.value,"")])},[$.value?(o.openBlock(),o.createElementBlock("span",{key:0,innerHTML:D(se)},null,8,$4)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.createTextVNode(o.toDisplayString(se.text),1)],64))],2)],10,F4))),128)):(o.openBlock(),o.createElementBlock("div",R4," No options "))],4)],4)):o.createCommentVNode("",!0)]))],2),t.add?(o.openBlock(),o.createElementBlock("button",{key:0,onClick:te,class:"bg-white hover:bg-gray-100 text-sm text-gray-900 py-[10px] px-3 border border-stone-200 rounded-md h-[38px] flex items-center gap-2",disabled:l.value,type:"button"},[o.createVNode(cs,{width:"16",height:"16"}),ee[12]||(ee[12]=o.createElementVNode("span",null,"Додати",-1))],8,P4)):o.createCommentVNode("",!0)],512)],64))}}),z4=["placeholder","disabled"],j4=o.defineComponent({__name:"vs-input-textarea",props:o.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=nn(e.style),r=o.useModel(n,"modelValue"),s=o.computed(()=>!!e.disabled),l=o.computed(()=>e.placeholder??"");return(a,i)=>o.withDirectives((o.openBlock(),o.createElementBlock("textarea",{"onUpdate:modelValue":i[0]||(i[0]=c=>r.value=c),placeholder:l.value,disabled:s.value,row:"2",class:o.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[o.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,z4)),[[o.vModelText,r.value]])}}),H4={},U4={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 W4(n,e){return o.openBlock(),o.createElementBlock("svg",U4,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),o.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const K4=Re(H4,[["render",W4]]),q4={},G4={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 Y4(n,e){return o.openBlock(),o.createElementBlock("svg",G4,e[0]||(e[0]=[o.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),o.createElementVNode("path",{d:"M7 20V4"},null,-1),o.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),o.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const J4=Re(q4,[["render",Y4]]),Z4={},X4={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 Q4(n,e){return o.openBlock(),o.createElementBlock("svg",X4,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),o.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),o.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const eT=Re(Z4,[["render",Q4]]),tT={},nT={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 rT(n,e){return o.openBlock(),o.createElementBlock("svg",nT,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),o.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),o.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const oT=Re(tT,[["render",rT]]),sT={},lT={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 aT(n,e){return o.openBlock(),o.createElementBlock("svg",lT,e[0]||(e[0]=[o.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 Am=Re(sT,[["render",aT]]),iT={},cT={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function dT(n,e){return o.openBlock(),o.createElementBlock("svg",cT,e[0]||(e[0]=[o.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 uT=Re(iT,[["render",dT]]),pT={},hT={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 fT(n,e){return o.openBlock(),o.createElementBlock("svg",hT,e[0]||(e[0]=[o.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 mT=Re(pT,[["render",fT]]),gT={class:"vs-datatable border rounded-xl w-full flex-grow"},yT={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},bT={class:"relative w-full"},kT={class:"table-wrapper flex gap-2"},wT={class:"vs-popover inline-block text-slate-700"},xT={class:"text-center"},vT={class:""},ET={class:"py-1 px-0 w-full text-sm text-stone-800 bg-white shadow-[0_10px_40px_10px_rgba(0,0,0,0.08)] rounded-lg focus:outline-none focus:bg-stone-100 dark:bg-neutral-900 dark:text-neutral-200 dark:focus:bg-neutral-800 after:h-4 after:absolute after:-bottom-4 after:start-0 after:w-full before:h-4 before:absolute before:-top-4 before:start-0 before:w-full"},CT={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},_T={class:"text-sm items-center text-gray-800 flex gap-1"},ST={class:"w-full overflow-x-auto"},NT={class:"w-full table-auto caption-bottom text-sm"},VT={class:"[&_tr]:border-b"},MT={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"},BT={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"},AT={key:0,colspan:"100%",class:"text-center"},TT={class:"w-full"},LT={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},DT=["onDragstart","onDragover","onDrop"],OT={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},IT={class:"flex items-center justify-center"},FT={key:0,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},$T={key:0},RT=["src"],PT={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},zT=["innerHTML"],jT={key:2,class:"line-clamp-2 rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},HT={key:3,class:"inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors"},UT={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},WT={class:"flex items-center justify-center gap-2"},KT=["onClick"],qT=["onClick"],GT={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},YT=o.defineComponent({__name:"vs-input-datatable",props:o.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=o.useModel(n,"modelValue"),r=o.ref({}),s=o.ref(""),l=o.computed(()=>{if(!s.value)return t.value??[];const $=s.value.toLowerCase();return t.value.filter(D=>e.colModel?.some(P=>{const H=D[P.key];return H?Array.isArray(H)?H.join(", ").toLowerCase().includes($):String(H).toLowerCase().includes($):!1}))}),a=o.ref(null),i=o.ref(null),c=o.ref(!1),d=o.ref(null),u=o.ref({top:0,left:0}),p=$=>{a.value=$},h=$=>{i.value=$},f=$=>{if(a.value===null||a.value===$){a.value=null,i.value=null;return}const D=[...t.value],[P]=D.splice(a.value,1);D.splice($,0,P),t.value=D,a.value=null,i.value=null},m=$=>{const D=$.currentTarget.getBoundingClientRect();u.value={top:D.bottom+window.scrollY,left:D.left+window.scrollX},c.value=!c.value},g=()=>{d.value&&d.value.click()},y=$=>{const D=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],P=$.toLowerCase();return D.some(H=>P.endsWith(H))},b=$=>{const D=$.target.files?.[0];if(!D)return;const P=new FileReader;P.onload=H=>{try{const G=H.target?.result;if(typeof G=="string"){const ie=JSON.parse(G);Array.isArray(ie)&&t.value.push(...ie)}}catch(G){console.error("Error parsing file:",G)}},P.readAsText(D)},k=()=>{const $=JSON.stringify(t.value,null,2),D=new Blob([$],{type:"application/json"}),P=URL.createObjectURL(D),H=document.createElement("a");H.href=P,H.download="data.json",H.click(),URL.revokeObjectURL(P)};o.onMounted(async()=>{const $=e.colModel?.filter(D=>D.data);$?.length&&Promise.all($.map(async D=>{const P=await(await fetch(`/api/suggest/${D.data}`)).json();r.value[D.key]=P.data}))});const x=o.ref(""),w=o.ref(!1);let v="edit",_=0;const E=o.ref({}),S=o.ref({});async function I(){x.value="Додати",w.value=!0,v="add",E.value={}}function A($,D){const P=D.key||D.name;return r.value[P]&&$[P]?r.value[P].find(H=>H.id.toString()===$[P].toString())?.text??$[P]:$[P]||"-"}async function V($,D){x.value="Редагувати",w.value=!0,v="edit",_=D,E.value={...$}}function M(){const $=S.value.validate();if($){dt({type:"warning",title:"Помилка валідації",message:Object.entries($).map(([D,P])=>`${D}: ${P}`).join(`
|
|
105
|
+
`)});return}v==="add"?Array.isArray(t.value)?t.value=[...t.value,E.value]:t.value=[E.value]:t.value=t.value.map((D,P)=>P===_?E.value:D),w.value=!1}function U($){t.value=t.value.filter((D,P)=>P!==$)}function R(){w.value=!1}return($,D)=>(o.openBlock(),o.createElementBlock("div",gT,[o.createElementVNode("div",yT,[o.createElementVNode("div",bT,[o.createVNode(K4,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),o.withDirectives(o.createElementVNode("input",{type:"text","onUpdate:modelValue":D[0]||(D[0]=P=>s.value=P),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),[[o.vModelText,s.value]])]),o.createElementVNode("div",kT,[o.createElementVNode("input",{ref_key:"fileInput",ref:d,onChange:b,class:"hidden",accept:".json",type:"file"},null,544),o.createElementVNode("div",wT,[o.createElementVNode("div",xT,[o.createElementVNode("div",vT,[o.createElementVNode("button",{onClick:m,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"},[o.createVNode(J4,{height:"16",width:"16"})])])])])]),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[c.value?(o.openBlock(),o.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:o.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:u.value.top+"px",left:u.value.left+"px"}])},[o.createElementVNode("div",ET,[o.createElementVNode("div",CT,[o.createElementVNode("button",{onClick:g,class:"text-slate-700 flex items-center gap-1 px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[o.createVNode(eT,{class:"text-black",width:"14",height:"14"}),D[4]||(D[4]=o.createTextVNode(" Імпортувати ",-1))]),o.createElementVNode("button",{onClick:k,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[o.createElementVNode("span",_T,[o.createVNode(oT,{class:"text-black",width:"14",height:"14"}),D[5]||(D[5]=o.createTextVNode(" Експортувати ",-1))])])])])],4)):o.createCommentVNode("",!0)])),o.createElementVNode("button",{onClick:I,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"},[o.createVNode(cs),D[6]||(D[6]=o.createTextVNode(" Додати ",-1))])]),o.createElementVNode("div",ST,[o.createElementVNode("table",NT,[o.createElementVNode("thead",VT,[o.createElementVNode("tr",MT,[o.createElementVNode("th",BT,[o.createVNode(Am,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList($.colModel,P=>(o.openBlock(),o.createElementBlock("th",{key:P.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]"},o.toDisplayString(P.ua||P.label),1))),128)),D[7]||(D[7]=o.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))])]),o.createElementVNode("tbody",{class:o.normalizeClass({"[&_tr:last-child]:border-0":!i.value})},[l.value.length===0?(o.openBlock(),o.createElementBlock("td",AT,[o.createElementVNode("div",TT,[o.createElementVNode("div",LT,[o.createVNode(uT,{class:"w-48 mx-auto"}),D[8]||(D[8]=o.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[o.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),o.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.value,(P,H)=>(o.openBlock(),o.createElementBlock("tr",{key:P.id,class:o.normalizeClass(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move",{"opacity-50":a.value===H,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":i.value===H}]),draggable:"true",onDragstart:G=>p(H),onDragover:o.withModifiers(G=>h(H),["prevent"]),onDrop:G=>f(H)},[o.createElementVNode("td",OT,[o.createElementVNode("div",IT,[o.createVNode(Am,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList($.colModel,G=>(o.openBlock(),o.createElementBlock("td",{key:G.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[G.type==="file"?(o.openBlock(),o.createElementBlock("div",FT,[y(A(P,G))?(o.openBlock(),o.createElementBlock("div",$T,[o.createElementVNode("img",{src:A(P,G),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,RT)])):(o.openBlock(),o.createElementBlock("div",PT,[o.createVNode(Sm,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):G.type==="tiptap-editor"?(o.openBlock(),o.createElementBlock("div",{key:1,class:"rounded-md border px-2.5 py-0.5 text-xs font-semibold focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 border-transparent bg-slate-100 dark:bg-slate-700 text-slate-700 dark:text-slate-300 hover:bg-slate-200 dark:hover:bg-slate-600 transition-colors line-clamp-3",innerHTML:A(P,G)},null,8,zT)):G.type==="reference"?(o.openBlock(),o.createElementBlock("div",jT,o.toDisplayString(A(P,G)),1)):(o.openBlock(),o.createElementBlock("div",HT,o.toDisplayString(A(P,G)),1))]))),128)),o.createElementVNode("td",UT,[o.createElementVNode("div",WT,[o.createElementVNode("button",{onClick:G=>V(P,H),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"},[o.createVNode(mT,{width:"24",height:"24",class:"w-3 h-3"})],8,KT),o.createElementVNode("button",{onClick:G=>U(H),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"},[o.createVNode(ca,{width:"24",height:"24",class:"w-3 h-3"})],8,qT)])])],42,DT))),128))],2)])]),o.createVNode(o.unref(zc),{teleport:"#modal",visible:w.value,title:x.value,size:"lg",onClose:R},{default:o.withCtx(()=>[o.createVNode(yo,{schema:e.colModel,values:E.value,"onUpdate:values":D[1]||(D[1]=P=>E.value=P),form:S.value,"onUpdate:form":D[2]||(D[2]=P=>S.value=P)},null,8,["schema","values","form"]),o.createElementVNode("div",GT,[o.createElementVNode("button",{type:"button",onClick:D[3]||(D[3]=P=>w.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),o.createElementVNode("button",{onClick:M,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])]),_:1},8,["visible","title"])]))}}),JT={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 ds(n){return n?n.type==="Polygon"?{type:"MultiPolygon",coordinates:[n.coordinates]}:n.type==="Feature"?{...n,geometry:ds(n.geometry)}:n.type==="FeatureCollection"?{...n,features:(n.features||[]).map(e=>ds(e)).filter(Boolean)}:n:null}function ZT(n){return n?n.type==="FeatureCollection"||n.type==="Feature"?ds(n):n.geom?{type:"Feature",geometry:ds({type:n.geom.type,coordinates:n.geom.coordinates}),properties:{}}:n.type&&n.coordinates?{type:"Feature",geometry:ds(n),properties:{}}:null:null}const XT={},QT={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 eL(n,e){return o.openBlock(),o.createElementBlock("svg",QT,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),o.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 tL=Re(XT,[["render",eL]]),nL={},rL={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 oL(n,e){return o.openBlock(),o.createElementBlock("svg",rL,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),o.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),o.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const sL=Re(nL,[["render",oL]]),lL={},aL={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 iL(n,e){return o.openBlock(),o.createElementBlock("svg",aL,e[0]||(e[0]=[o.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 cL=Re(lL,[["render",iL]]),dL={},uL={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 pL(n,e){return o.openBlock(),o.createElementBlock("svg",uL,e[0]||(e[0]=[o.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 hL=Re(dL,[["render",pL]]),fL={},mL={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 gL(n,e){return o.openBlock(),o.createElementBlock("svg",mL,e[0]||(e[0]=[o.createElementVNode("title",null,null,-1),o.createElementVNode("desc",null,null,-1),o.createElementVNode("defs",null,null,-1),o.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[o.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[o.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[o.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 yL=Re(fL,[["render",gL]]),bL={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},kL={key:0,class:"vs-select__options absolute z-50 mt-1 w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm"},wL=["onClick"],xL={class:"relative flex-1 min-w-[140px]"},vL=["placeholder"],EL="https://data.softpro.ua/api-user/gis-url-proxy",CL="https://geo.rv.ua/api-user/dzk.api",_L=o.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(n,{emit:e}){const t=n,r=e,s=["here","xy","parcel"],l=o.computed(()=>{const w=t.config?.tools?.filter(v=>s.includes(v));return w&&w.length?w:s}),a=o.computed(()=>t.config?.placeholder?.trim()||"Пошук…"),i=o.ref(l.value[0]??s[0]);o.watch(l,w=>{w.includes(i.value)||(i.value=w[0])});const c=o.ref(""),d=o.ref(!1),u=o.ref(null);o.watch(i,()=>{c.value="",d.value=!1});function p(w){i.value=w}function h(w){if(!d.value)return;const v=u.value;v&&!v.contains(w.target)&&(d.value=!1)}o.onMounted(()=>{window.addEventListener("click",h,!0)}),o.onBeforeUnmount(()=>{window.removeEventListener("click",h,!0)});function f(w){return w==="xy"?"Координати":w==="parcel"?"Кадастр":"Адреси"}function m(w){const v=w.replace(/[,]+/g," ").trim();if(!v)return null;const _=v.split(/\s+/).filter(Boolean);if(_.length<2)return null;const E=_.slice(0,2).map(Number);if(!E.every(R=>Number.isFinite(R)))return null;let[S,I]=E,A=S,V=I;const M=R=>Math.abs(R)<=90,U=R=>Math.abs(R)<=180;if(!M(A)||!U(V))if(M(V)&&U(A))A=I,V=S;else return null;return{lat:A,lng:V}}function g(w){return(w?.items||[]).map((v,_)=>({id:String(v?.id??_),title:v?.title||v?.address?.label||"Знайдений обʼєкт",lat:Number(v?.position?.lat),lng:Number(v?.position?.lng)})).filter(v=>Number.isFinite(v.lat)&&Number.isFinite(v.lng))}function y(w){const v=w?.result||w?.data||w;if(!v)return[];const _=v.geom_centroid;if(!_||!Array.isArray(_.coordinates))return[];const[E,S]=_.coordinates;return!Number.isFinite(S)||!Number.isFinite(E)?[]:[{id:"parcel",title:v.cadnum||v.cad_num||"Земельна ділянка",lat:S,lng:E}]}function b(w){const v=w.replace(/\s+/g,"").split(":");if(v.length!==4)return!1;const _=[10,2,3,4];return v.every((E,S)=>E.length===_[S]&&/^\d+$/.test(E))}function k(w){r("goToCoordinates",[w.lat,w.lng])}async function x(){const w=c.value.trim();if(w){if(i.value==="xy"){const v=m(w);if(!v){dt({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}k(v),c.value="";return}try{const v=new URL(i.value==="here"?EL:CL);if(i.value==="here")v.searchParams.set("searchtext",w);else{if(!b(w)){dt({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}v.searchParams.set("cad_num",w)}const _=await fetch(v.toString());if(!_.ok)throw new Error(`HTTP ${_.status}`);const E=await _.json(),S=i.value==="here"?g(E):y(E);if(!S.length)dt({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const I=S[0];k(I),c.value=""}}catch(v){const _=v?.message||"Помилка пошуку";dt({type:"error",title:"Пошук",message:_})}}}return(w,v)=>(o.openBlock(),o.createElementBlock("div",bL,[o.createElementVNode("form",{class:"flex gap-2",onSubmit:o.withModifiers(x,["prevent"])},[l.value.length>1?(o.openBlock(),o.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:"relative search-type w-[140px]"},[o.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:v[0]||(v[0]=_=>d.value=!d.value)},[o.createElementVNode("span",null,o.toDisplayString(f(i.value)),1),(o.openBlock(),o.createElementBlock("svg",{class:o.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":d.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v[2]||(v[2]=[o.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2))]),d.value?(o.openBlock(),o.createElementBlock("div",kL,[o.createElementVNode("ul",null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.value,_=>(o.openBlock(),o.createElementBlock("li",{key:_,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:E=>p(_)},o.toDisplayString(f(_)),9,wL))),128))])])):o.createCommentVNode("",!0)],512)):o.createCommentVNode("",!0),o.createElementVNode("div",xL,[o.withDirectives(o.createElementVNode("input",{"onUpdate:modelValue":v[1]||(v[1]=_=>c.value=_),placeholder:a.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,vL),[[o.vModelText,c.value,void 0,{trim:!0}]]),v[3]||(v[3]=o.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[o.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),SL=Re(_L,[["__scopeId","data-v-3048520a"]]),NL={class:"bg-white/30 p-1 rounded-md shadow"},VL={class:"flex gap-2"},ML=["onClick","title"],BL=["src"],AL=o.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(n,{emit:e}){const t=o.ref(Object.keys(n.basemaps)[0]),r=e;function s(l){r("onLayerChange",l),t.value=l}return(l,a)=>(o.openBlock(),o.createElementBlock("div",NL,[o.createElementVNode("div",VL,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.basemaps,(i,c)=>(o.openBlock(),o.createElementBlock("div",{key:c,class:o.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":t.value===c}]),onClick:d=>s(c),title:i.name||c,role:"button",tabindex:"0"},[o.createElementVNode("img",{src:i.preview,alt:"",class:"w-10 h-10 object-cover"},null,8,BL)],10,ML))),128))])]))}}),TL={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},LL={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},DL={class:"text-sm font-medium"},OL={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},IL={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},FL={class:"flex items-center gap-1"},$L=["disabled"],RL=["disabled"],PL=["disabled"],zL={class:"absolute top-4 right-4 z-[1000]"},jL={class:"flex flex-col gap-[2px]"},HL=["disabled"],UL=["disabled"],WL=["disabled"],KL=["disabled"],qL={class:"flex flex-col gap-2"},GL={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},YL={class:"flex flex-col gap-1"},JL=["checked","disabled","onChange"],ZL={class:"text-gray-700 text-xs font-medium"},XL={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"},QL={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},e3={class:"shrink-0"},t3={class:"font-bold"},n3={class:"flex items-center"},r3={class:"text-xs mr-2"},o3={key:0,class:"text-xs"},s3={key:1,class:"text-xs"},l3=["disabled"],a3=["disabled"],i3=o.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},layers:{default:()=>[]},api:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=o.getCurrentInstance(),r=n,s=e,l=o.computed(()=>{const T={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!r.tools||!r.tools.length)return T;const F=new Set(r.tools.map(te=>te.toLowerCase()));return{search:F.has("search"),import:F.has("import"),export:F.has("export"),point:F.has("point"),line:F.has("line"),polygon:F.has("polygon"),rectangle:F.has("rectangle")}}),a=o.computed(()=>!!r.disabled),i=o.ref(!1),c=o.ref(null),d=o.ref(null),u=o.ref(!1),p=o.ref(""),h=o.reactive({}),f=o.ref([]),m=o.computed(()=>f.value.map(T=>h[T]).filter(T=>!!T)),g=o.computed(()=>Array.isArray(r.layers)&&r.layers.some(T=>`${T?.service??""}`.toLowerCase()==="vtile"));let y,b,k;function x(){return navigator.platform.toUpperCase().indexOf("MAC")>=0,/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Використовуйте два пальці для зуму карти.":"Використовуйте Ctrl + прокрутка для зуму карти."}const w=o.ref(null),v=o.ref(null);let _=null;const E=o.ref(null),S=T=>{T.ctrlKey&&T.preventDefault()};function I(T,F){return T?.id?String(T.id):T?.url?`${T.url}-${F}`:`layer-${F}`}function A(T){if(!T)return"";if(/^https?:\/\//i.test(T))return T.replace(/\/+$/,"");const F=T.replace(/^\/+/,"").replace(/\/+$/,"");return F?`/${F}`:""}function V(T){const F=T?.url??"";if(!F||/^https?:\/\//i.test(F))return F;const te=typeof window<"u"&&window.location?.origin?window.location.origin:"";if(F.startsWith("/"))return te?`${te}${F}`:F;const ce=A(T?.prefix),me=A(r.prefix),Te=ce||me,K=F.replace(/^\/+/,""),ee=Te?`${Te.replace(/\/$/,"")}/${K}`:`/${K}`;return te?`${te}${ee}`:ee}function M(T){const F=T?.style??{};return te=>{const ce=F.colorAttr,me=F.colorSet??{},Te=typeof ce=="string"?me?.[te?.[ce]]??F.color??"#3388ff":F.color??"#3388ff",K=F.stroke??Te;return{weight:F.width??1,color:K,opacity:F.opacity??1,fill:F.type?F.type!=="polyline":!0,fillColor:Te,fillOpacity:F.opacity??.5}}}function U(T){const F=T?.colorSet||T?.colors;if(T?.colorAttr&&F){const te=Object.entries(F).flat();return["match",["get",T.colorAttr],...te,T.color??"#94a3b8"]}return T?.color??"#3388ff"}function R(T,F,te){if(!T)return[];const ce=[],me=U(T);return T.icon&&ce.push({id:`${F}-icon`,type:"symbol",source:F,"source-layer":te,minzoom:T.iconZoom||0,layout:{"icon-image":T.icon,"icon-size":1,"icon-allow-overlap":!0,"icon-ignore-placement":!0}}),T.pointZoom&&ce.push({id:`${F}-point`,type:"circle",source:F,"source-layer":te,maxzoom:T.pointZoom,paint:{"circle-stroke-color":T.stroke||"#fff","circle-opacity":T.opacity??1,"circle-color":me,"circle-stroke-width":T.width??1,"circle-radius":T.radius??5}}),T.type==="polygon"?ce.push({id:`${F}-fill`,type:"fill",source:F,"source-layer":te,minzoom:T.pointZoom||0,paint:{"fill-color":me,"fill-opacity":T.opacity??.5,"fill-outline-color":T.stroke||me}}):T.type==="line"?ce.push({id:`${F}-line`,type:"line",source:F,"source-layer":te,paint:{"line-color":me,"line-opacity":T.opacity??1,"line-width":T.width??1.5}}):T.icon||ce.push({id:`${F}-circle`,type:"circle",source:F,"source-layer":te,paint:{"circle-stroke-color":T.stroke||"#fff","circle-opacity":T.opacity??1,"circle-color":me,"circle-stroke-width":T.width??1,"circle-radius":T.radius??5}}),ce}function $(T,F){const te=T.id||`source-${Math.random().toString(36).slice(2,8)}`,ce=T.sourceLayer||T.layer||T.service_layer||T.service_key||T.map_key||T.dataset?.layer||T.id||T.table_name||te,me=R(T.style||{},te,ce||te);return me.length?{version:8,glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",sources:{[te]:{type:"vector",tiles:[F],minzoom:T.minzoom??0,maxzoom:T.maxzoom??19}},layers:me}:null}function D(T){const F=(T?.service??"").toLowerCase(),te=V(T),ce=T.sourceLayer||T.layer||T.service_layer||T.service_key||T.map_key||T.dataset?.layer||T.id||T.table_name;if(console.info("[vs-input-map] create overlay layer",{id:T.id,service:F,url:te,sourceLayer:ce,hasSourceLayer:!!ce}),F==="vtile"){if(L?.vectorGrid?.protobuf&&!L?.maplibreGL)return console.info("[vs-input-map] using Leaflet.vectorGrid"),L.vectorGrid.protobuf(te,{interactive:!0,vectorTileLayerStyles:{default:M(T)}});if(L?.maplibreGL&&window?.maplibregl){console.info("[vs-input-map] using maplibre-gl-leaflet");const me=$(T,te);return me?L.maplibreGL({style:me,interactive:!1,pane:"overlayPane"}):(console.warn("[vs-input-map] maplibre spec is empty",T.id),null)}return null}return F==="tile"||/^https?:\/\//i.test(te)||te.includes("{z}")?L.tileLayer(te,{opacity:T?.style?.opacity??1}):L.tileLayer(te,{opacity:T?.style?.opacity??1})}function P(){y&&f.value.forEach(T=>{const F=h[T];F&&(F.visible?(F.layer||(F.layer=D(F.config)),F.layer&&!y.hasLayer(F.layer)?(console.info("[vs-input-map] add overlay layer to map",F.id),F.layer.addTo(y)):F.layer||console.warn("[vs-input-map] overlay layer is null",F.id)):F.layer&&y.hasLayer(F.layer)&&(console.info("[vs-input-map] remove overlay layer from map",F.id),y.removeLayer(F.layer)))})}function H(T){if(a.value)return;const F=h[T];F&&(F.visible=!F.visible,y&&(console.info("[vs-input-map] toggle overlay",{id:T,nextVisible:F.visible,hasLayerInstance:!!F.layer}),F.visible?(F.layer||(F.layer=D(F.config)),F.layer&&!y.hasLayer(F.layer)&&(console.info("[vs-input-map] add overlay layer to map",F.id),F.layer.addTo(y))):F.layer&&y.hasLayer(F.layer)&&y.removeLayer(F.layer)))}function G(){if(!r.handleZoom)return null;let T;const F=ce=>{const me=ce.ctrlKey||ce.metaKey,Te=ce.shiftKey;if(!me&&!Te){u.value=!0,p.value=x(),clearTimeout(T),T=window.setTimeout(()=>{u.value=!1},1e3);return}u.value=!1,y.scrollWheelZoom.enable(),setTimeout(()=>{y.scrollWheelZoom.disable()},100)},te=ce=>{if(ce.touches.length===1){u.value=!0,p.value=x(),clearTimeout(T),T=window.setTimeout(()=>{u.value=!1},3e3);return}u.value=!1};return v.value&&(v.value.addEventListener("wheel",F,{passive:!1}),v.value.addEventListener("touchstart",te,{passive:!0})),y&&y.on("wheel",ce=>{const me=ce.originalEvent.ctrlKey||ce.originalEvent.metaKey,Te=ce.originalEvent.shiftKey;!me&&!Te&&(ce.originalEvent.preventDefault(),ce.originalEvent.stopPropagation())}),()=>{v.value&&(v.value.removeEventListener("wheel",F),v.value.removeEventListener("touchstart",te)),y&&y.off("wheel"),clearTimeout(T)}}const ie=o.ref(null),Ae=o.ref(6),Q=o.ref(0),Pe=o.ref(t?.appContext.config.globalProperties.$settings?.center||[50,30]),ze=o.ref(null),We=qe();let St;const gt=o.ref("topo100");function Wt(T){return T?T.type==="Polygon"?{type:"MultiPolygon",coordinates:[T.coordinates]}:(T.type,T):null}function on(){return new Promise((T,F)=>{window.L&&window.L.Draw&&T(0);const te=Te=>{if(Array.from(document.styleSheets).some(ee=>ee?.href?.includes(Te)))return;const K=document.createElement("link");K.rel="stylesheet",K.href=Te,document.head.appendChild(K)},ce=Te=>new Promise((K,ee)=>{const se=Array.from(document.scripts).find(q=>q.src===Te);if(se){se.addEventListener("load",()=>K()),se.addEventListener("error",q=>ee(q));return}const z=document.createElement("script");z.src=Te,z.async=!0,z.onload=()=>K(),z.onerror=q=>ee(q),document.body.appendChild(z)});te("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),te("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),g.value&&te("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.css");let me=ce("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>ce("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js"));g.value?me=me.then(()=>ce("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.js")).then(()=>(window.maplibregl&&!window.mapboxgl&&(window.mapboxgl=window.maplibregl),ce("https://unpkg.com/@maplibre/maplibre-gl-leaflet@0.0.20/leaflet-maplibre-gl.js"))):me=me.then(()=>ce("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js").catch(()=>Promise.resolve())),me.then(()=>T(0)).catch(F)})}function Y(){const T=b.toGeoJSON(),F=[];let te=null;const ce=Te=>{if(Te)switch(Te.type){case"Point":te=Te;break;case"Polygon":F.push(Te.coordinates);break;case"MultiPolygon":F.push(...Te.coordinates);break;case"GeometryCollection":(Te.geometries||[]).forEach(ce);break}};(T?.features||[]).forEach(Te=>ce(Te.geometry));const me=te||(F.length?{type:"MultiPolygon",coordinates:F}:null);s("update:modelValue",me?Wt(me):null),Q.value=b.getLayers().length}function re(T=30){const F=b.getLayers();if(!F.length)return;const te=L.featureGroup(F).getBounds();te&&te.isValid()&&y.fitBounds(te,{padding:[T,T]})}function ae(){a.value||E.value?.click()}const fe=o.ref("");o.watch(l,T=>{fe.value&&!Object.entries(T).filter(([F,te])=>te).map(([F])=>F).includes(fe.value)&&(k?.disable&&k.disable(),fe.value="")}),o.watch(()=>r.layers,T=>{const F=Array.isArray(T)?T:[],te=[],ce=new Set;F.forEach((me,Te)=>{if(!me)return;const K=I(me,Te);te.push(K),ce.add(K),console.info("[vs-input-map] overlay register",{id:K,service:me?.service,url:me?.url});const ee=h[K];ee?h[K]={...ee,config:{...me,id:K}}:h[K]={id:K,config:{...me,id:K},visible:me?.overlay!==!1,layer:null}}),Object.keys(h).forEach(me=>{if(ce.has(me))return;const Te=h[me];Te?.layer&&y?.hasLayer&&y.hasLayer(Te.layer)&&y.removeLayer(Te.layer),delete h[me]}),f.value=te,P()},{immediate:!0,deep:!0}),o.watch(a,T=>{T&&k&&(k.disable(),fe.value=""),b&&b.eachLayer(F=>{T?F.dragging?.disable?.():F.dragging?.enable&&(F.dragging.enable(),F.dragging.enabled?.())})});function be(T){return T instanceof L.Circle?"Circle":T instanceof L.Rectangle?"Rectangle":T instanceof L.Polygon&&!(T instanceof L.Rectangle)?"Polygon":T instanceof L.Polyline&&!(T instanceof L.Polygon)?"Polyline":T instanceof L.Marker?"Point":"Feature"}function Oe(T){if(T instanceof L.Circle){const F=T.getRadius();return Math.PI*(F*F)/1e6}if(T instanceof L.Polygon||T instanceof L.Rectangle)try{const F=T.getLatLngs(),te=Array.isArray(F[0])?F[0]:F,ce=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea(te):0;return ce?ce/1e6:0}catch{return null}return null}function He(T){return T instanceof L.Circle?T.getLatLng():T.getBounds?T.getBounds().getCenter():T.getLatLng?T.getLatLng():y.getCenter()}async function Ke(T,F){if(w.value="",!r.api?.length)return;const[te,ce]=r.api;try{const me=new URL(te);me.searchParams.set("lat",String(T)),me.searchParams.set("lon",String(F));const Te=await fetch(me.toString());if(!Te.ok)throw new Error("Request failed");const K=await Te.json();ce&&K[ce]!==void 0?w.value=String(K[ce]):w.value=JSON.stringify(K)}catch(me){console.error("[vs-input-map] reverse geocode failed:",me),w.value=null}}function B(){const T=b.getLayers();if(!T.length){ze.value=null,Q.value=0;return}const F=T[T.length-1],te=be(F),ce=He(F),me=Oe(F);ze.value={type:te,center:ce,areaKm2:me,layer:F},Q.value=T.length,Ke(ce.lat,ce.lng)}function O(){if(a.value)return;const T=ze.value?.layer;T&&(T instanceof L.Circle&&T.getBounds?y.fitBounds(T.getBounds(),{padding:[30,30]}):T.getBounds?y.fitBounds(T.getBounds(),{padding:[30,30]}):T.getLatLng&&y.setView(T.getLatLng(),Math.max(Ae.value,14)))}function Z(){if(a.value)return;const T=ze.value?.layer;T&&(b.removeLayer(T),Y(),B())}o.onMounted(async()=>{document.addEventListener("wheel",S,{passive:!1}),await on(),L.drawLocal=JT;const T=r.handleZoom;y=L.map(v.value,{zoomControl:!1,scrollWheelZoom:!T}).setView(Pe.value,10),setTimeout(()=>{_=G()},100),L.control.zoom({position:"bottomright"}).addTo(y),gt.value=Object.keys(We)[0],St=L.tileLayer(We[gt.value].url,{maxZoom:19,minZoom:6}).addTo(y),b=new L.FeatureGroup().addTo(y),y.on(L.Draw.Event.CREATED,ce=>{if(a.value)return;const{layer:me}=ce;b.clearLayers(),b.addLayer(me),Y(),re(),fe.value=""}),y.on(L.Draw.Event.EDITED,()=>{a.value||(Y(),B(),re())}),y.on(L.Draw.Event.DELETED,()=>{a.value||(Y(),B(),re())});let F=!1;y.on("mousemove",ce=>{F||(y.invalidateSize(),F=!0),ie.value=ce.latlng}),y.on("zoomend",()=>{Ae.value=y.getZoom()});const te=ZT(r.modelValue);if(te){const ce=[];L.geoJSON(te).eachLayer(me=>ce.push(me)),ce.length&&b.addLayer(ce[0]),Y(),B(),re()}P()}),o.onUnmounted(()=>{document.removeEventListener("wheel",S),_&&_(),Object.values(h).forEach(T=>{T?.layer&&(y?.hasLayer?.(T.layer)&&y.removeLayer(T.layer),typeof T.layer.remove=="function"&&T.layer.remove())})});function he(T){if(!a.value&&y){switch(k&&k.disable(),T){case"marker":k=new L.Draw.Marker(y);break;case"polyline":k=new L.Draw.Polyline(y);break;case"polygon":k=new L.Draw.Polygon(y);break;case"rectangle":k=new L.Draw.Rectangle(y);break;default:k=new L.Draw.Rectangle(y);break}k&&(k.enable(),fe.value=T)}}function ve(){if(a.value)return;const T=b.toGeoJSON(),F=new Blob([JSON.stringify(T,null,2)],{type:"application/json"}),te=URL.createObjectURL(F),ce=document.createElement("a");ce.href=te,ce.download="data.geojson",ce.click(),URL.revokeObjectURL(te)}function W(T){if(a.value)return;const F=T.target,te=F.files?.[0];if(!te)return;const ce=new FileReader;ce.onload=()=>{if(typeof ce.result=="string")try{const me=JSON.parse(ce.result);b.clearLayers(),me&&L.geoJSON({type:"Feature",geometry:me}).eachLayer(Te=>{b.addLayer(Te)}),Y(),B(),re()}finally{F.value=""}},ce.readAsText(te)}function X(T){y&&(St&&y.removeLayer(St),St=L.tileLayer(We[T].url,{maxZoom:19,minZoom:6}).addTo(y),gt.value=T)}function Ne(T){const F=L.latLng(T[0],T[1]);y.setView(F,13)}o.watch(()=>r.modelValue,T=>{const F=Wt(T);if(T&&F!==T){s("update:modelValue",F);return}b.clearLayers(),F&&L.geoJSON({type:"Feature",geometry:F}).eachLayer(te=>{if(b.addLayer(te),a.value){te.dragging?.disable?.();return}te.dragging?.enable?.(),te.dragging?.enabled?.(),te.on("dragend",ce=>{const me=ce.target.getLatLng();s("update:modelValue",{type:"Point",coordinates:[me.lng,me.lat]})})}),Q.value=b.getLayers().length,B(),re()});function qe(){return t?.appContext.config.globalProperties.$settings?.basemaps?t?.appContext.config.globalProperties.$settings?.basemaps.map((T,F)=>Object.assign(T,{key:`b${F}`,preview:T.preview||T.url.replace("{z}/{x}/{y}.png","13/4790/2762.png")})).reduce((T,F)=>({...T,[F.key]:F}),{}):{topo100:{url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/voyager/ua/13/4790/2762.png"},orto10:{url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4790/2762.png"},osmb:{url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",preview:"https://tile.openstreetmap.org.ua/styles/osm-bright/13/4790/2762.png"}}}const lt=o.ref(!1);return o.watch(lt,()=>{setTimeout(()=>{y.invalidateSize()},50)}),o.watch(i,async T=>{if(!T||!d.value){c.value=null;return}await o.nextTick();const F=d.value.getBoundingClientRect();c.value={top:F.bottom+6,left:F.left}}),o.onUnmounted(()=>{i.value=!1,c.value=null}),(T,F)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:lt.value}])},[o.createElementVNode("div",{ref_key:"mapContainer",ref:v,class:"w-full h-full"},null,512),o.createVNode(o.Transition,{name:"zoom-instructions","enter-active-class":"transition-all duration-200 ease-out","leave-active-class":"transition-all duration-500 ease-in","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:o.withCtx(()=>[u.value&&r.handleZoom?(o.openBlock(),o.createElementBlock("div",TL,[o.createElementVNode("div",LL,[o.createElementVNode("p",DL,o.toDisplayString(p.value),1)])])):o.createCommentVNode("",!0)]),_:1}),l.value.search||l.value.import||l.value.export?(o.openBlock(),o.createElementBlock("div",OL,[l.value.search?(o.openBlock(),o.createBlock(SL,{key:0,onGoToCoordinates:Ne})):o.createCommentVNode("",!0),l.value.import||l.value.export?(o.openBlock(),o.createElementBlock("div",IL,[o.createElementVNode("div",FL,[l.value.import?(o.openBlock(),o.createElementBlock("button",{key:0,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:ae,disabled:a.value}," Import ",8,$L)):o.createCommentVNode("",!0),l.value.export?(o.openBlock(),o.createElementBlock("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:ve,disabled:a.value||Q.value===0}," Export ",8,RL)):o.createCommentVNode("",!0)]),o.createElementVNode("input",{ref_key:"importRef",ref:E,type:"file",onChange:W,accept:".json,.geojson",class:"hidden",disabled:a.value},null,40,PL)])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),o.createElementVNode("div",zL,[o.createElementVNode("div",jL,[l.value.point?(o.openBlock(),o.createElementBlock("button",{key:0,class:o.normalizeClass(["vs-btn",{"vs-active":fe.value==="marker"}]),title:"Point",onClick:F[0]||(F[0]=te=>he("marker")),disabled:a.value},[o.createVNode(tL)],10,HL)):o.createCommentVNode("",!0),l.value.line?(o.openBlock(),o.createElementBlock("button",{key:1,class:o.normalizeClass(["vs-btn",{"vs-active":fe.value==="polyline"}]),title:"Line",onClick:F[1]||(F[1]=te=>he("polyline")),disabled:a.value},[o.createVNode(sL)],10,UL)):o.createCommentVNode("",!0),l.value.polygon?(o.openBlock(),o.createElementBlock("button",{key:2,class:o.normalizeClass(["vs-btn",{"vs-active":fe.value==="polygon"}]),title:"Polygon",onClick:F[2]||(F[2]=te=>he("polygon")),disabled:a.value},[o.createVNode(cL)],10,WL)):o.createCommentVNode("",!0),l.value.rectangle?(o.openBlock(),o.createElementBlock("button",{key:3,class:o.normalizeClass(["vs-btn",{"vs-active":fe.value==="rectangle"}]),title:"Rectangle",onClick:F[3]||(F[3]=te=>he("rectangle")),disabled:a.value},[o.createVNode(hL)],10,KL)):o.createCommentVNode("",!0),o.createElementVNode("button",{class:"vs-btn mt-5",onClick:F[4]||(F[4]=te=>lt.value=!lt.value),title:"Full Screen"},[o.createVNode(yL,{style:{width:"12px",height:"12px"}})])])]),o.createElementVNode("div",{class:o.normalizeClass(["absolute left-4 z-[1000]",ze.value?"bottom-8":"bottom-4"])},[o.createElementVNode("div",qL,[o.createVNode(AL,{basemaps:o.unref(We),onOnLayerChange:X},null,8,["basemaps"]),m.value.length?(o.openBlock(),o.createElementBlock("div",GL,[F[9]||(F[9]=o.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Layers",-1)),o.createElementVNode("div",YL,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(m.value,te=>(o.openBlock(),o.createElementBlock("label",{key:te.id,class:"flex items-center gap-2 cursor-pointer select-none"},[o.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:te.visible,disabled:a.value,onChange:ce=>H(te.id)},null,40,JL),o.createElementVNode("span",ZL,o.toDisplayString(te.config.title||te.config.name||te.id),1)]))),128))])])):o.createCommentVNode("",!0)])],2),o.createElementVNode("div",XL,[ze.value?(o.openBlock(),o.createElementBlock("div",QL,[o.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:F[5]||(F[5]=te=>i.value=!0),onMouseleave:F[6]||(F[6]=te=>i.value=!1)},[o.createElementVNode("div",e3,[F[10]||(F[10]=o.createTextVNode(" Type: ",-1)),o.createElementVNode("span",t3,o.toDisplayString(ze.value.type),1)]),w.value?(o.openBlock(),o.createElementBlock("div",{key:0,ref_key:"addressEl",ref:d,class:"text-gray-500 text-xs truncate cursor-help",style:{"max-width":"260px"}}," Address: "+o.toDisplayString(w.value),513)):o.createCommentVNode("",!0),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[i.value&&w.value&&c.value?(o.openBlock(),o.createElementBlock("div",{key:0,class:"fixed z-[99999] pointer-events-none bg-gray-800 text-white text-xs px-2 py-1 rounded shadow whitespace-nowrap",style:o.normalizeStyle({top:c.value.top+"px",left:c.value.left+"px"})},o.toDisplayString(w.value),5)):o.createCommentVNode("",!0)]))],32),o.createElementVNode("div",n3,[o.createElementVNode("div",r3,[F[11]||(F[11]=o.createTextVNode(" Center: ",-1)),o.createElementVNode("b",null,o.toDisplayString(ze.value.center.lat.toFixed(5))+", "+o.toDisplayString(ze.value.center.lng.toFixed(5)),1)]),ze.value.areaKm2!==null?(o.openBlock(),o.createElementBlock("div",o3,[F[12]||(F[12]=o.createTextVNode(" Area: ",-1)),o.createElementVNode("b",null,o.toDisplayString(ze.value.areaKm2.toFixed(1))+" km²",1)])):(o.openBlock(),o.createElementBlock("div",s3,F[13]||(F[13]=[o.createTextVNode("Area: ",-1),o.createElementVNode("b",null,"—",-1)]))),o.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:F[7]||(F[7]=te=>O()),disabled:a.value},F[14]||(F[14]=[o.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-150e767b><path d="M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0" data-v-150e767b></path><path d="M7 10l6 0" data-v-150e767b></path><path d="M10 7l0 6" data-v-150e767b></path><path d="M21 21l-6 -6" data-v-150e767b></path></svg>',1)]),8,l3),o.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Delete feature",onClick:F[8]||(F[8]=te=>Z()),disabled:a.value},[o.createVNode(ca,{class:"w-3 h-3"})],8,a3)])])):o.createCommentVNode("",!0)])],2))}}),c3=Re(i3,[["__scopeId","data-v-150e767b"]]),d3=["data-focus"],u3={class:"flex items-center"},p3={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},h3=["onClick","aria-label"],f3={key:0,class:"absolute text-gray-500 truncate pl-2"},m3={class:"flex-1 min-w-[2px]"},g3=["placeholder"],y3={class:"flex items-center shrink-0"},b3=["disabled"],k3=o.defineComponent({__name:"vs-input-tag",props:o.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"}},{modelValue:{default:[]},modelModifiers:{}}),emits:o.mergeModels(["update:modelValue"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=e;nn(t.style);const s=o.ref(null),l=o.ref(null),a=o.ref(null),i=o.ref(!1),c=o.ref(""),d=o.useModel(n,"modelValue"),u=o.computed(()=>t.placeholder||"Add tag…"),p=o.computed(()=>d.value?.length===0&&c.value===""),h=o.computed(()=>!t.disabled&&d.value?.length>0),f=o.computed(()=>t.disabled),m=async()=>{f.value||await o.nextTick(()=>a.value?.focus())},g=_=>{const E=_.trim();E!==""&&(!d.value||!Array.isArray(d.value)?d.value=[E]:t.unique?d.value.includes(E)||(d.value=[...d.value,E]):d.value=[...d.value,E],c.value="")},y=()=>{const _=c.value;_.trim()!==""&&g(_),c.value=""},b=_=>{const E=d.value.slice();E.splice(_,1),r("update:modelValue",E)},k=()=>{r("update:modelValue",[])},x=()=>{f.value||(i.value=!0)},w=()=>{i.value=!1,!f.value&&y()},v=_=>{const{key:E}=_;E==="Enter"?(_.preventDefault(),y()):E==="Backspace"&&c.value===""&&d.value.length>0&&b(d.value.length-1)};return(_,E)=>(o.openBlock(),o.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:s,onClick:E[1]||(E[1]=o.withModifiers(()=>{},["stop"]))},[o.createElementVNode("div",{class:o.normalizeClass(["relative w-full font-sans",t.customClass]),role:"group","aria-label":"Tag input"},[o.createElementVNode("div",{class:o.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",i.value?"border-blue-500 ring-1 ring-blue-500":"",f.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:m},[o.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:l},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(d.value,(S,I)=>(o.openBlock(),o.createElementBlock("div",{key:I,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[o.createElementVNode("div",u3,[o.createElementVNode("div",p3,o.toDisplayString(S),1)]),o.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:o.withModifiers(A=>b(I),["stop"]),"aria-label":`Remove ${S}`},E[2]||(E[2]=[o.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[o.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,h3)]))),128)),p.value?(o.openBlock(),o.createElementBlock("div",f3,o.toDisplayString(u.value),1)):o.createCommentVNode("",!0),o.createElementVNode("div",m3,[f.value?o.createCommentVNode("",!0):o.withDirectives((o.openBlock(),o.createElementBlock("input",{key:0,ref_key:"inputRef",ref:a,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":E[0]||(E[0]=S=>c.value=S),onFocus:x,onBlur:w,onKeydown:v,placeholder:d.value&&d.value.length?"":void 0},null,40,g3)),[[o.vModelText,c.value]])])],512),o.createElementVNode("div",y3,[h.value?(o.openBlock(),o.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:f.value,onClick:o.withModifiers(k,["stop"])},E[3]||(E[3]=[o.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[o.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,b3)):o.createCommentVNode("",!0)])],10,d3)],2)],512))}}),w3={class:"relative flex gap-1 bg-white w-full"},x3=["disabled","placeholder"],v3=o.defineComponent({__name:"vs-input-slug",props:o.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=o.inject("values"),t=n,r=o.useModel(n,"modelValue");function s(a){const i={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ы:"y",э:"e",ю:"yu",я:"ya",ь:"",ъ:"",є:"ye",і:"i",ї:"yi",ґ:"g"};return a.toLowerCase().split("").map(c=>i[c]||c).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const l=()=>{const a=e?.value?.[t.parent||""]?.toString(),i=s(a);r.value=i.toString()};return(a,i)=>(o.openBlock(),o.createElementBlock("div",w3,[o.withDirectives(o.createElementVNode("input",{ref:"vsText",disabled:a.disabled,placeholder:a.placeholder,"onUpdate:modelValue":i[0]||(i[0]=c=>r.value=c),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,x3),[[o.vModelText,r.value]]),o.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:l}," Gen ")]))}}),E3=Re(v3,[["__scopeId","data-v-b0eba370"]]),C3={class:"relative flex gap-1 bg-white w-full"},_3=["disabled","placeholder"],S3=["disabled"],N3={key:0},V3={key:1},M3=o.defineComponent({__name:"vs-input-codegen",props:o.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=o.useModel(n,"modelValue"),r=o.ref(!1),s=o.computed(()=>e.init!==!1),l=o.computed(()=>!!e.table&&!!e.code),a=()=>{if(!l.value)return"";const d=encodeURIComponent(String(e.table)),u=encodeURIComponent(String(e.code));return`/api/code-gen/${d}/${u}`},i=async()=>{if(!l.value||r.value)return;const d=a();if(d){r.value=!0;try{const u=await(await fetch(d)).text();t.value=u}finally{r.value=!1}}},c=()=>{s.value&&(t.value||i())};return o.onMounted(()=>{c()}),o.watch(()=>[e.table,e.code,e.init],()=>{c()}),(d,u)=>(o.openBlock(),o.createElementBlock("div",C3,[o.withDirectives(o.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":u[0]||(u[0]=p=>t.value=p),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,_3),[[o.vModelText,t.value]]),o.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:r.value||d.disabled||!l.value,onClick:i},[r.value?(o.openBlock(),o.createElementBlock("span",V3,"...")):(o.openBlock(),o.createElementBlock("span",N3,"Gen"))],8,S3)]))}}),B3=Re(M3,[["__scopeId","data-v-6ee5237d"]]),A3={class:"w-full"},T3={ref:"sortableContainer",class:"flex flex-col gap-1"},L3=["onDragstart","onDrop"],D3={class:"w-1/3"},O3={class:"w-2/3"},I3=["onClick"],F3={key:0,class:"text-[14px] text-gray-700"},$3={class:"mt-2 w-full flex items-center"},R3=["disabled"],P3=o.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=g=>`${g}-${Math.random().toString(36).substring(2,15)}`,r=o.inject("values"),s=n,l=e,a=s.addButtonText??"Додати",i=s.ignore??[],c=o.ref([]),d=o.ref(null);(()=>{const g=s.parent&&r?.value?.[s.parent]||s.modelValue||{};c.value=Object.entries(g).filter(([y])=>!i.includes(y)).map(([y,b])=>({id:t("key-value-"),key:y,value:b}))})();function u(g){d.value=g}function p(g){if(d.value===null||d.value===g)return;const y=c.value.splice(d.value,1)[0];c.value.splice(g,0,y),d.value=null}const h=o.computed(()=>c.value.some(g=>g.key&&!g.value||!g.key&&g.value)),f=()=>{c.value.push({id:t("key-value-"),key:"",value:""})},m=g=>{c.value=c.value.filter(y=>y.id!==g)};return o.watch(c,g=>{const y={};g.forEach(k=>{k.key&&k.value!==void 0&&(y[k.key]=k.value)});const b={};i.length&&i.forEach(k=>{b[k]=s.parent?r?.value?.[s.parent]?.[k]:void 0}),r?.value&&s.parent&&(r.value[s.parent]={...b,...y}),l("update:modelValue",y)},{deep:!0}),(g,y)=>(o.openBlock(),o.createElementBlock("div",A3,[o.createElementVNode("div",T3,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(c.value,(b,k)=>(o.openBlock(),o.createElementBlock("div",{key:b.id,class:o.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===k}]),draggable:"true",onDragstart:x=>u(k),onDragover:y[0]||(y[0]=o.withModifiers(()=>{},["prevent"])),onDrop:x=>p(k)},[y[1]||(y[1]=o.createStaticVNode('<button class="cursor-move" data-v-a0f7fbfc><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-a0f7fbfc><circle cx="15" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="18" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="18" r="1.5" data-v-a0f7fbfc></circle></svg></button>',1)),o.createElementVNode("div",D3,[o.createVNode(ia,{modelValue:b.key,"onUpdate:modelValue":x=>b.key=x,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),o.createElementVNode("div",O3,[o.createVNode(ia,{modelValue:b.value,"onUpdate:modelValue":x=>b.value=x,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),o.createElementVNode("button",{onClick:x=>m(b.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[o.createVNode(o.unref(sB),{height:"16",width:"16"})],8,I3)],42,L3))),128))],512),c.value.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("span",F3," Дані для відображення відсутні ")),o.createElementVNode("div",$3,[o.createElementVNode("button",{type:"button",onClick:f,disabled:h.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[o.createVNode(cs,{height:"14",width:"14"}),o.createTextVNode(" "+o.toDisplayString(o.unref(a)),1)],8,R3)])]))}}),z3=Re(P3,[["__scopeId","data-v-a0f7fbfc"]]),j3={class:"flex items-center gap-2 w-full"},H3=["disabled"],U3=["disabled"],W3=o.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,{inputClass:r}=nn(t.style),s=e,l=o.computed({get:()=>t.modelValue||"#000000",set:i=>s("update:modelValue",i)}),a=o.computed(()=>!!t.disabled);return(i,c)=>(o.openBlock(),o.createElementBlock("div",j3,[o.withDirectives(o.createElementVNode("input",{type:"color","onUpdate:modelValue":c[0]||(c[0]=d=>l.value=d),disabled:a.value,ref:"color",class:o.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[i.modelValue?"":"text-opacity-50",o.unref(r)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,H3),[[o.vModelText,l.value]]),o.withDirectives(o.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":c[1]||(c[1]=d=>l.value=d),disabled:a.value},null,8,U3),[[o.vModelText,l.value]])]))}}),K3={class:"flex items-center gap-2 w-full"},q3=["min","max","step","disabled"],G3=["disabled"],Y3=o.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,{inputClass:r}=nn(t.style),s=e,l=o.computed({get:()=>Number(t.modelValue??t.min),set:i=>s("update:modelValue",Number(i))}),a=o.computed(()=>!!t.disabled);return(i,c)=>(o.openBlock(),o.createElementBlock("div",K3,[o.withDirectives(o.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>l.value=d),min:i.min,max:i.max,step:i.step,disabled:a.value,ref:"range",class:o.normalizeClass(["w-full cursor-pointer accent-blue-500",[i.modelValue?"":"text-opacity-50",o.unref(r)].join(" ")])},null,10,q3),[[o.vModelText,l.value]]),o.withDirectives(o.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":c[1]||(c[1]=d=>l.value=d),disabled:a.value},null,8,G3),[[o.vModelText,l.value]])]))}}),J3=["type","value","onInput","placeholder","disabled"],Z3=o.defineComponent({__name:"vs-input-array",props:o.mergeModels({count:{default:1},limit:{default:n=>n.count??1},inputType:{default:"text"},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=nn(e.style),r=o.useModel(n,"modelValue"),s=o.computed(()=>!!e.disabled),l=o.computed(()=>e.placeholder??"");o.watchEffect(()=>{const i=r.value?.length??0;i<e.count&&(r.value=[...r.value??[],...Array(e.count-i)])});function a(i,c){if(s.value)return;const d=i.target.value,u=[...r.value];u[c]=e.inputType==="text"?d:Number(d),r.value=u}return(i,c)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["grid gap-2",`grid-cols-${i.limit}`])},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.count,d=>(o.openBlock(),o.createElementBlock("input",{type:i.inputType,value:r.value?.[d-1]??"",onInput:u=>a(u,d-1),placeholder:l.value,disabled:s.value,class:o.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[o.unref(t),{"!border-red-600":i.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,J3))),256))],2))}}),X3={class:"flex items-center gap-2 w-full"},Q3={class:"relative flex-1"},eD=["placeholder","disabled","onKeydown"],tD=["disabled"],nD={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},rD={key:1,class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},oD={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},sD={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},lD={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},aD=["onClick"],iD={key:0,class:"p-4 text-sm text-gray-500"},cD=o.defineComponent({__name:"vs-input-address",props:o.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},api:{default:""},geom:{default:""},includes:{default:()=>[]}},{modelValue:{default:""},modelModifiers:{}}),emits:o.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=e,{inputClass:s}=nn(t.style),l=o.useModel(n,"modelValue"),a=o.computed({get:()=>l.value,set:b=>{l.value=b}}),i=o.ref(!1),c=o.ref([]),d=o.ref(!1),u=o.computed(()=>t.placeholder??""),p=o.computed(()=>!!t.disabled),h=o.inject("values");function f(){!p.value&&a.value.trim()&&m()}async function m(){const b=(a.value||"").trim();if(!b)return;let k=b;if(t.includes?.length&&h?.value){const w=t.includes.map(v=>h.value?.[v]).filter(Boolean);w.length&&(k=`${w.join(", ")}, ${b}`)}const x=t.api.replace("{{value}}",encodeURIComponent(k));i.value=!0;try{const w=await(await fetch(x)).json();c.value=Array.isArray(w)?w:[],d.value=!0}catch(w){console.error("Address search error:",w)}finally{i.value=!1}}function g(){d.value=!d.value}function y(b){if(!b)return;d.value=!1;const k=parseFloat(b.lat),x={type:"Point",coordinates:[parseFloat(b.lon),k]};t.geom&&h?.value&&(h.value[t.geom]=x),r("update:geom",x)}return(b,k)=>(o.openBlock(),o.createElementBlock("div",X3,[o.createElementVNode("div",Q3,[o.withDirectives(o.createElementVNode("input",{type:"text","onUpdate:modelValue":k[0]||(k[0]=x=>a.value=x),placeholder:u.value,disabled:p.value,class:o.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[o.unref(s),{"!border-red-600":t.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:o.withKeys(o.withModifiers(f,["prevent"]),["enter"])},null,42,eD),[[o.vModelText,a.value]]),c.value.length?(o.openBlock(),o.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:g,title:"Show search results"},k[2]||(k[2]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),o.createElementVNode("path",{d:"M12 16v-4"}),o.createElementVNode("path",{d:"M12 8h.01"})],-1)]))):o.createCommentVNode("",!0)]),o.createElementVNode("button",{type:"button",onClick:m,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:i.value||!a.value?.trim()},[i.value?(o.openBlock(),o.createElementBlock("svg",rD,k[4]||(k[4]=[o.createElementVNode("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),o.createElementVNode("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)]))):(o.openBlock(),o.createElementBlock("svg",nD,k[3]||(k[3]=[o.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),o.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},null,-1)])))],8,tD),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[d.value?(o.openBlock(),o.createElementBlock("div",oD,[o.createElementVNode("div",sD,[o.createElementVNode("div",lD,[k[6]||(k[6]=o.createElementVNode("span",null,"Search results",-1)),o.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:k[1]||(k[1]=x=>d.value=!1),title:"Close"},k[5]||(k[5]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)]))]),o.createElementVNode("ul",null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(c.value,(x,w)=>(o.openBlock(),o.createElementBlock("li",{key:w,onClick:v=>y(x),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},o.toDisplayString(x.display_name),9,aD))),128))]),c.value.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",iD," No results found "))])])):o.createCommentVNode("",!0)]))]))}}),dD={VsInputText:ia,VsInputRadio:Em,"vs-input-text":ia,"vs-input-password":LM,"vs-input-textarea":j4,"vs-input-mask":gB,"vs-input-number":IM,"vs-input-radio":Em,"vs-input-select":Bm,"vs-input-switcher":xm,"vs-input-static":vm,"vs-input-container":x4,"vs-input-date":LB,"vs-input-checkbox":AB,"vs-input-file":wA,"vs-input-html":vm,"vs-input-email":kB,"vs-input-datatable":YT,"vs-input-map":c3,"vs-input-file-list":JA,"vs-input-tags":k3,"vs-input-slug":E3,"vs-input-codegen":B3,"vs-input-key-value":z3,"vs-input-range":Y3,"vs-input-color":W3,"vs-input-native-select":Bm,"vs-input-array":Z3,"vs-input-address":cD},uD=o.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(n){const e=n,t=o.inject("values");async function r(){try{if(!e.api)return;const s=e.api.replace("{{value}}",e.value),l=await fetch(s);if(!l.ok){dt({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const a=await l.json();if(!e.set||!t)return;for(const[i,c]of Object.entries(e.set))t.value[i]=a.result[c]}catch(s){console.error(e.error,s)}}return(s,l)=>(o.openBlock(),o.createElementBlock("button",{onClick:r,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"},o.toDisplayString(s.button),1))}}),pD={class:"flex flex-col gap-1 w-full"},hD={key:0,class:"text-sm text-gray-500"},Tm=o.defineComponent({__name:"vs-compact-form-layout",props:o.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]},columns:{default:()=>({container:12,label:3})}},{modelValue:{default:null},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=o.useModel(n,"modelValue"),r=o.computed(()=>AM[`${e.layout}`]),s=o.computed(()=>dD?.[`vs-input-${e.item.type}`]),l=o.computed(()=>{const i=o.unref(s);if(!i)return new Set;const c=i.props??i.__vccOpts?.props;if(!c)return new Set;const d=Array.isArray(c)?c:Object.keys(c);return new Set(d)}),a=o.computed(()=>{const i=e.item??{},c=l.value;return c.size?Object.fromEntries(Object.entries(i).filter(([d])=>c.has(d))):{}});return(i,c)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(r.value),{ua:e.item.ua,error:e.error||"",item:i.item,columns:e.columns,label:e.item.label},{default:o.withCtx(()=>[o.createElementVNode("div",{class:o.normalizeClass(["flex w-full",`${e.item.type}-component`])},[o.createElementVNode("div",pD,[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(s.value),o.mergeProps(a.value,{modelValue:t.value,"onUpdate:modelValue":c[0]||(c[0]=d=>t.value=d)}),null,16,["modelValue"])),i.item.description&&e.layout!=="settings"?(o.openBlock(),o.createElementBlock("p",hD,o.toDisplayString(i.item.description),1)):o.createCommentVNode("",!0)]),i.item.behavior?.api&&i.item.behavior?.button?(o.openBlock(),o.createBlock(uD,o.mergeProps({key:0},i.item.behavior,{value:t.value}),null,16,["value"])):o.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),fD={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},mD={class:"vs-compact-form-navigation__rail mt-[6px]"},gD=["onClick"],yD=o.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(n,{expose:e}){const t=n,r=o.ref([]),s=o.ref(""),l=o.ref(""),a=o.computed(()=>!!t.enabled),i=o.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),c=o.computed(()=>{const V=t.width;if(V==null)return{};const M=typeof V=="number"?`${V}px`:`${V}`;return{width:M,minWidth:M}});let d=null,u=0,p=0,h=null,f=null,m=null;const g=()=>I(),y=()=>k();o.watch(()=>t.target,async V=>{if(_(),!V){h=null,r.value=[],s.value="";return}h=V,a.value&&(await o.nextTick(),v(V),k())},{immediate:!0}),o.watch(()=>t.scrollContainer,V=>{if(!a.value){f=V??null;return}b(V??null),o.nextTick(()=>k())},{immediate:!0}),o.onMounted(()=>{t.scrollContainer||b(null),k()}),o.onBeforeUnmount(()=>{_(),b(null,!0),h=null,typeof window<"u"&&(u&&window.cancelAnimationFrame(u),p&&window.cancelAnimationFrame(p))});function b(V,M=!1){if(m&&(m(),m=null),M){f=null;return}if(f=V??null,typeof window>"u")return;const U=V??window,R=window;U.addEventListener("scroll",g,{passive:!0}),R.addEventListener("resize",y),m=()=>{U.removeEventListener("scroll",g),R.removeEventListener("resize",y)}}function k(){if(!a.value||!h)return;u&&typeof window<"u"&&window.cancelAnimationFrame(u);const V=()=>{x(),u=0};typeof window>"u"?V():u=window.requestAnimationFrame(V)}function x(){if(!a.value||!h)return;const V=Array.from(h.querySelectorAll("h1, h2")),M=new Set,U=[];V.forEach((R,$)=>{const D=R.textContent?.trim()??"";if(!D)return;let P=(R.getAttribute("id")??"").trim();P||(P=w(D)||`heading-${$+1}`);let H=P,G=1;for(;M.has(H);)H=`${P}-${G+=1}`;R.id!==H&&Object.assign(R,{id:H}),M.add(H),U.push({id:H,text:D,level:R.tagName.toLowerCase()==="h1"?1:2})}),r.value=U,U.length||(s.value=""),S()}function w(V){return V.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function v(V){!V||!a.value||typeof MutationObserver>"u"||(_(),d=new MutationObserver(()=>k()),d.observe(V,{childList:!0,subtree:!0}))}function _(){d&&(d.disconnect(),d=null)}function E(V){const M=f;if(!M)return typeof window>"u"?V.offsetTop:V.getBoundingClientRect().top+window.scrollY;const U=V.getBoundingClientRect(),R=M.getBoundingClientRect();return U.top-R.top+M.scrollTop}function S(){if(!a.value||!r.value.length)return;const V=f,M=(V?V.scrollTop:null)||(typeof window<"u"?window.scrollY:0),U=(V?V.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),R=M+U;let $=null;for(let P=0;P<r.value.length;P+=1){const H=r.value[P],G=document.getElementById(H.id);if(G){const ie=E(G);ie+G.offsetHeight>M&&ie<R&&($=H.id)}}!$&&l.value&&($=l.value),$&&(l.value=$);const D=V?V.scrollHeight-V.clientHeight:document.documentElement.scrollHeight-window.innerHeight;M+5>=D&&($=r.value[r.value.length-1].id),$&&(s.value=$)}function I(){a.value&&(p&&window.cancelAnimationFrame(p),p=window.requestAnimationFrame(()=>{S(),p=0}))}function A(V){if(!a.value)return;const M=document.getElementById(V);if(!M)return;const U=f,R=Math.max(0,E(M));U?U.scrollTo({top:R,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:R,behavior:"smooth"})}return e({refresh:k}),(V,M)=>a.value&&r.value.length?(o.openBlock(),o.createElementBlock("div",{key:0,class:o.normalizeClass(i.value),style:o.normalizeStyle(c.value)},[o.createElementVNode("h2",fD,o.toDisplayString(V.title),1),o.createElementVNode("div",mD,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,U=>(o.openBlock(),o.createElementBlock("div",{key:U.id,class:o.normalizeClass(["vs-compact-form-navigation__item relative",U.level===2?"vs-compact-form-navigation__item--nested":"",U.id===s.value?"vs-compact-form-navigation__item--active":""])},[o.createElementVNode("button",{type:"button",onClick:R=>A(U.id),class:o.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",U.level===2?"pl-[15px]":"pl-[18px]",U.id===s.value?"text-gray-800":"text-gray-500"])},[o.createElementVNode("span",null,o.toDisplayString(U.text),1)],10,gD)],2))),128))])],6)):o.createCommentVNode("",!0)}}),bD=Re(yD,[["__scopeId","data-v-1584a562"]]),Lm={required:"Це поле є обов’язковим",email:"Неправильний email"},kD=n=>n?!1:Lm.required,wD=n=>n?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?!1:Lm.email:!1,xD=(n,e)=>{const t=e.pattern??e.regexp;return!(typeof t=="string"?new RegExp(t):t).test(n)&&n?e.message:!1},vD=(n,e)=>!1,ED=(n,e)=>{switch(typeof e=="string"?e:e.type){case"required":return kD(n);case"email":return wD(n);case"regexp":return xD(n,e);case"custom":return vD();default:return!1}},CD={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file",dropzone:"file"};function Dm(n){const e=n.toLowerCase();return CD[e]||e}function Hc(n,e=!1){if(Array.isArray(n)){const r=[];return n.forEach(s=>{const l={...s};l.name=(s.name||s.id||s.key||"").toString(),l.type=Dm(s.type),l.label=s.label||s.ua,l.rules=s.rules||s.validators,l.type==="email"&&!l.rules&&(l.rules=["email"]),s.data&&(l.api=`/api/suggest/${s.data}`),l.disabled=e||l.disabled,Array.isArray(l.schema)&&(l.schema=Hc(l.schema,l.disabled)),r.push(l)}),r}const t=[];return Object.entries(n).forEach(r=>{const s={name:r[0],...r[1],type:Dm(r[1].type),label:r[1].label||r[1].ua,rules:r[1].rules||r[1].validators,disabled:e};s.type==="email"&&!s.rules&&(s.rules=["email"]),r[1].type.includes("list")&&(s.multiple=!0),!s.api&&r[1].data&&(s.api=`/api/suggest/${r[1].data}`),Array.isArray(s.schema)&&(s.schema=Hc(s.schema,s.disabled)),t.push(s)}),t}function _D(n,e,t=!1){const r=o.computed(()=>Hc(e,typeof t=="boolean"?t:t.value)),s=o.ref({});function l(c){const d=c?.conditions;if(!d)return!0;const u=Array.isArray(d)?d[0]:d,p=n?.value?.[u];return Mm(p,d)}const a=(c=r.value,d=!0)=>(c.forEach(u=>{if(u.rules){if(!l(u)){delete s.value[u.name];return}let p=!1,h=null;u.rules.forEach(f=>{const m=ED(n.value[u.name],f);m&&(p=!0,!h&&typeof m=="string"&&(h=m))}),p&&h?s.value[u.name]=h:delete s.value[u.name]}u.schema&&a(u.schema,!1)}),d&&Object.values(s.value).some(Boolean)?s.value:null),i=o.computed(()=>r.value?.filter(c=>c.hidden!==!0&&l(c)));return{errors:s,validate:a,reset:()=>{n.value={},s.value={}},visibleSchema:i}}const SD={class:"flex w-full h-full min-h-0 gap-6"},ND={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},yo=o.defineComponent({__name:"vs-compact-form",props:o.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},values:{default:()=>({})},valuesModifiers:{}}),emits:o.mergeModels(["handle-submit","update:modelValue"],["update:form","update:values"]),setup(n,{expose:e,emit:t}){const r=t,s=n,l=o.useModel(n,"form"),a=o.useModel(n,"values"),{errors:i,validate:c,reset:d,visibleSchema:u}=_D(a,s.schema,o.toRef(s,"disabled")),p=o.ref(null),h=o.ref(null),f=o.computed(()=>s.navigation),m=o.computed(()=>s.navWidth),g=o.computed(()=>s.style?.columns),y=Object.freeze({container:12,label:3}),b=o.computed(()=>s.columns??g.value??y),k=o.computed(()=>s.columns!=null||g.value!=null),x=o.computed(()=>k.value?"horizontal":s.layout),w=S=>S?.columns?"horizontal":x.value,v=S=>S?.columns??b.value,_=()=>{r("update:modelValue",a.value),c(),r("handle-submit",a.value)};e({validate:c,reset:d,errors:i}),o.onMounted(()=>{s.modelValue&&(a.value=s.modelValue),l.value={value:a.value,errors:i.value,reset:d,validate:c,formId:s.formId}});function E(S,I){if(S===I)return!0;if(typeof S!="object"||typeof I!="object"||!S||!I)return!1;const A=Object.keys(S),V=Object.keys(I);return A.length!==V.length?!1:A.every(M=>S[M]===I[M])}return o.provide("form",l),o.provide("values",a),(S,I)=>(o.openBlock(),o.createElementBlock("div",SD,[o.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:h},[o.createElementVNode("form",{ref_key:"formRef",ref:p,onSubmit:o.withModifiers(_,["prevent"]),class:o.normalizeClass(["grid grid-cols-12 p-1",x.value==="default"?"gap-6":"gap-4"])},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(u),(A,V)=>(o.openBlock(),o.createElementBlock("div",{key:A.name,class:o.normalizeClass(w(A)==="horizontal"?"col-span-12":`col-span-${A.col||12}`)},[o.createVNode(Tm,{style:o.normalizeStyle(S.style),item:A,layout:w(A),columns:v(A),"model-value":a.value[A.name],"onUpdate:modelValue":M=>{const U=a.value[A.name];E(U,M)||(a.value[A.name]=M)},error:o.unref(i)[A.name]},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),w(A)==="settings"&&V+1!==o.unref(u).length?(o.openBlock(),o.createElementBlock("div",ND)):o.createCommentVNode("",!0)],2))),128))],34)],512),o.createVNode(bD,{target:p.value,"scroll-container":h.value,enabled:f.value,width:m.value},null,8,["target","scroll-container","enabled","width"])]))}}),VD={class:"relative"},MD={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},BD={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"},AD={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},TD={class:"font-medium text-gray-800 dark:text-[#ffffff]"},LD={class:"p-4 mim-h-0 h-full overflow-auto"},DD=o.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(n,{emit:e}){const t=n,r=e,s=o.ref(t.schema),l=o.ref(t.defaultValue?JSON.parse(JSON.stringify(t.defaultValue)):{}),a=o.ref({}),i=o.ref(),c=o.ref(t.mode);async function d(){const p=a.value.validate();if(p){dt({type:"warning",title:"Помилка валідації",message:Object.entries(p).map(([h,f])=>`${h}: ${f}`).join(`
|
|
106
|
+
`)});return}if(i.value)try{const h=await fetch(`/api/table/${i.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(l.value)});if(h.ok)await h.json(),dt({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`}),r("save",l.value);else if(h.status===400){const f=await h.json().catch(()=>({}));dt({type:"warning",title:"Помилка валідації",message:f.message||"Некоректні дані (400)"})}else h.status===500?dt({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):dt({type:"error",title:"Помилка",message:`Статус: ${h.status}`})}catch(h){dt({type:"error",title:"Помилка з’єднання",message:h.message||"Не вдалося виконати запит"})}}function u(){r("close")}return o.onMounted(async()=>{try{if(t.form){const p=await fetch(`/api/template/form/${t.form}`);if(!p.ok){dt({type:p.status>=400&&p.status<500?"warning":"error",title:"Error",message:`Error code: ${p.status}`});return}const h=await p.json();s.value=h.schema,i.value=h.token}else if(t.token){i.value=t.token;const p=await fetch(`/api/form/${i.value}`);if(!p.ok){dt({type:p.status>=400&&p.status<500?"warning":"error",title:"Error",message:`Error code: ${p.status}`});return}const h=await p.json();s.value=h.schema,h.data?l.value=h.data:c.value="add"}}catch(p){dt({type:"error",title:"Error",message:p.message||"Unexpected error"}),console.error(p)}}),(p,h)=>(o.openBlock(),o.createElementBlock("div",VD,[o.createElementVNode("div",MD,[o.createElementVNode("div",BD,[o.createElementVNode("div",AD,[o.createElementVNode("h3",TD,o.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),o.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]=[o.createElementVNode("span",{class:"sr-only"},"Close",-1),o.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"},[o.createElementVNode("path",{d:"M18 6 6 18"}),o.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),o.createElementVNode("div",LD,[s.value?(o.openBlock(),o.createBlock(yo,{key:0,schema:s.value,values:l.value,"onUpdate:values":h[0]||(h[0]=f=>l.value=f),form:a.value,"onUpdate:form":h[1]||(h[1]=f=>a.value=f)},null,8,["schema","values","form"])):o.createCommentVNode("",!0)]),o.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"},[o.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"}," Скасувати "),o.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"}," Зберегти ")])])])]))}}),Om=(n={mode:"edit",schema:null})=>new Promise(e=>{const{close:t}=dM({title:n.mode==="add"?"Додати":"Редагувати",template:"",size:"medium",content:DD,contentProps:{...n,onClose:()=>{e(null),t()},onSave:r=>{e(r),t()}}})});yo.install=function(n){n.component("VForm",yo),Object.assign(n.config.globalProperties,{$form:Om}),n.provide("form",Om),window.v3plugin||(window.v3plugin={})};const OD={class:"relative"},ID={key:0,class:"mt-4"},FD=["src","alt","title"],$D={key:0,class:"text-sm text-red-500"},RD={key:1,class:"mt-4"},PD={class:"text-sm text-gray-600 mb-2"},zD={class:"flex flex-wrap gap-2"},jD=["src","alt","onError"],HD=["onClick"],UD={class:"flex justify-end gap-x-2 p-[20px]"},WD=Object.assign({inheritAttrs:!1},{__name:"vs-editor-image",props:{editor:{type:Object,required:!0}},setup(n){const e=n,t=o.ref(!1),r=o.ref(!1),s=o.ref({}),l=o.ref(!1),a=o.ref([]),i=o.ref(null),c=o.ref({src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1}),d=o.computed(()=>{if(Array.isArray(c.value.file)){const S=c.value.file.filter(A=>A instanceof File),I=c.value.file.filter(A=>typeof A=="string"&&A.trim()!=="");return S.length+I.length>1}return c.value.file instanceof FileList?c.value.file.length>1:!1}),u=o.computed(()=>Array.isArray(c.value.file)?c.value.file.filter(S=>S instanceof File).length===1:c.value.file instanceof FileList?c.value.file.length===1:c.value.file instanceof File),p=o.computed(()=>{if(d.value)return"";if(c.value.src)return c.value.src;if(u.value){let S=null;if(Array.isArray(c.value.file)||c.value.file instanceof FileList?S=c.value.file[0]:c.value.file instanceof File&&(S=c.value.file),S instanceof File){const I=a.value.find(A=>A.file===S);return I?I.preview:""}else if(typeof S=="string")return S}return""}),h=o.computed(()=>[{name:"src",label:"URL зображення",type:"text",required:!1,placeholder:"https://example.com/image.png"},{name:"file",label:"Файл (можна вибрати кілька)",type:"file",multiple:!0,required:!1,placeholder:"Шлях до файлу зображення",accept:"image/*"},{name:"width",label:"Ширина",type:"number",required:!1,placeholder:"Ширина зображення",clearable:!0,min:0},{name:"height",label:"Висота",type:"number",required:!1,placeholder:"Висота зображення",clearable:!0,min:0},{name:"alt",label:"Альтернативний текст",type:"text",required:!1,placeholder:"Опис зображення"},{name:"title",label:"Заголовок (необов'язково)",type:"text",required:!1,placeholder:"Заголовок зображення"},{name:"link",label:"Посилання",type:"text",required:!1,placeholder:"https://example.com"},{name:"openInNewTab",label:"Відкривати у новій вкладці?",type:"switcher",required:!1}]),f=()=>{if(e.editor){if(e.editor.isActive("image")){const{state:S}=e.editor,{selection:I}=S,{$from:A}=I;let V=null,M=null;if(A.parent.type.name==="image")V=A.before(A.depth),M=A.parent;else for(let G=A.depth;G>0;G--){const ie=A.node(G),Ae=A.before(G);ie.type.name==="paragraph"&&ie.forEach((Q,Pe)=>{if(Q.type.name==="image"){const ze=Ae+Pe+1;(V===null||Math.abs(ze-I.$from.pos)<Math.abs(V-I.$from.pos))&&(V=ze,M=Q)}})}if(V!==null&&M){try{e.editor.chain().focus().setNodeSelection(V).run()}catch{e.editor.chain().focus().setTextSelection(V).run()}i.value=V}else{e.editor.chain().focus().selectParentNode().run();const{state:G}=e.editor;i.value=G.selection.$from.pos}const U=M?M.attrs:e.editor.getAttributes("image");l.value=!0;let R="",$=!1;const D=e.editor.getAttributes("link");D&&D.href&&(R=D.href,$=D.target==="_blank");const P=U.src||"",H=P?[P]:[];c.value={src:P,file:H,alt:U.alt||"",title:U.title||"",width:U.width||"",height:U.height||"",link:R,openInNewTab:$}}else l.value=!1,c.value={src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1};r.value=!1,t.value=!0}},m=()=>{t.value=!1,r.value=!1,l.value=!1,a.value=[],i.value=null,c.value={src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1}},g=async S=>{if(!S||S.length===0)return;const I=[];for(const A of S)if(A&&A.type&&A.type.startsWith("image/")&&!a.value.some(V=>V.file===A)){const V=new Promise((M,U)=>{const R=new FileReader;R.onload=$=>{a.value.push({file:A,preview:$.target.result,error:!1}),M()},R.onerror=U,R.readAsDataURL(A)});I.push(V)}await Promise.all(I)},y=S=>{a.value.splice(S,1),Array.isArray(c.value.file)&&c.value.file.splice(S,1)},b=()=>{const S=c.value.width!==null&&c.value.width!==void 0&&c.value.width!==""&&String(c.value.width).trim()!==""?String(c.value.width).trim():"",I=c.value.height!==null&&c.value.height!==void 0&&c.value.height!==""&&String(c.value.height).trim()!==""?String(c.value.height).trim():"",A={};return S&&I?(A.width=S,A.height=I,A.style=`width: ${S}px; height: ${I}px; object-fit: fill;`):S?(A.width=S,A.height=void 0):I?(A.height=I,A.width=void 0):(A.width=void 0,A.height=void 0),A},k=(S,I=null,A=50)=>{const V=()=>{const{view:R}=S;!R||!R.dom||R.dom.querySelectorAll("img.editor-image[width][height]").forEach($=>{if($ instanceof HTMLImageElement){const D=$.getAttribute("width"),P=$.getAttribute("height");D&&P&&D!=="auto"&&P!=="auto"&&D!==""&&P!==""&&!isNaN(Number(D))&&!isNaN(Number(P))&&($.style.cssText=`
|
|
107
|
+
width: ${D}px !important;
|
|
108
|
+
height: ${P}px !important;
|
|
109
|
+
max-width: none !important;
|
|
110
|
+
max-height: none !important;
|
|
111
|
+
min-width: auto !important;
|
|
112
|
+
min-height: auto !important;
|
|
113
|
+
object-fit: fill !important;
|
|
114
|
+
`.replace(/\s+/g," ").trim())}})},M=c.value.width,U=c.value.height;M&&U&&M!==""&&U!==""?[0,A,A*2,A*3,A*4].forEach(R=>{setTimeout(V,R)}):(V(),setTimeout(V,A))},x=async()=>{let S=[],I=[];if(Array.isArray(c.value.file)?(S=c.value.file.filter(R=>R instanceof File),I=c.value.file.filter(R=>typeof R=="string"&&R.trim()!=="")):c.value.file instanceof FileList?S=Array.from(c.value.file):c.value.file instanceof File?S=[c.value.file]:typeof c.value.file=="string"&&c.value.file.trim()!==""&&(I=[c.value.file]),S.length===0&&I.length===0&&s.value&&s.value.file){const R=s.value.file;Array.isArray(R)?(S=R.filter($=>$ instanceof File),I=R.filter($=>typeof $=="string"&&$.trim()!=="")):R instanceof FileList?S=Array.from(R):R instanceof File?S=[R]:typeof R=="string"&&R.trim()!==""&&(I=[R])}if(I.length>0&&!l.value){for(const R of I)a.value.some($=>$.url===R)||a.value.push({url:R,preview:R,error:!1});if(S.length===0&&a.value.length>0){await v();return}}const A=S.length,V=A+I.length;if(!(l.value&&A<=1)&&A>0){const R=S.filter($=>!a.value.some(D=>D.file===$));R.length>0&&await g(R)}if(!l.value){if(V>1||d.value||a.value.length>1){if(a.value.length>0){await v();return}else if(A>0){if(await g(S),a.value.length>0){await v();return}}else if(I.length>0){await v();return}}else if(a.value.length>1){await v();return}}let M=c.value.src;if(u.value){let R=null;if(Array.isArray(c.value.file)||c.value.file instanceof FileList?R=c.value.file[0]:(c.value.file instanceof File||typeof c.value.file=="string")&&(R=c.value.file),R instanceof File)try{const $=new FileReader,D=await new Promise((P,H)=>{$.onload=G=>P(G.target.result),$.onerror=H,$.readAsDataURL(R)});M=D,l.value&&(c.value.src=D)}catch($){console.error("Помилка при читанні файлу:",$),dt({type:"error",title:"Помилка",message:"Не вдалося прочитати файл"});return}else typeof R=="string"&&R.trim()!==""&&(M=R.trim(),l.value&&R.trim()!==c.value.src&&(c.value.src=R.trim(),M=R.trim()))}else if(Array.isArray(c.value.file)&&c.value.file.length===1){const R=c.value.file[0];typeof R=="string"&&R.trim()!==""&&(M=R.trim(),(!c.value.src||c.value.src!==R.trim())&&(c.value.src=R.trim()))}else typeof c.value.file=="string"&&c.value.file.trim()!==""&&(M=c.value.file.trim(),(!c.value.src||c.value.src!==c.value.file.trim())&&(c.value.src=c.value.file.trim()));const U=M||Array.isArray(c.value.file)&&c.value.file.length>0&&(c.value.file.some(R=>R instanceof File)||c.value.file.some(R=>typeof R=="string"&&R.trim()!==""))||c.value.file instanceof FileList&&c.value.file.length>0||typeof c.value.file=="string"&&c.value.file.trim()!=="";if(!M&&!U){dt({type:"warning",title:"Попередження",message:"Будь ласка, введіть URL зображення або виберіть файл"});return}if(!d.value&&!U&&await s.value.validate()){dt({type:"warning",title:"Попередження",message:"Будь ласка, заповніть всі обов'язкові поля"});return}if(e.editor&&M)if(l.value&&i.value!==null){const{state:R}=e.editor;try{e.editor.chain().focus().setNodeSelection(i.value).run()}catch{e.editor.chain().focus().setTextSelection(i.value).run()}const $=e.editor.getAttributes("link"),D=$&&$.href,P=b(),H={src:M,alt:c.value.alt||"",title:c.value.title||"",...P};if((!c.value.width||c.value.width==="")&&(H.width=void 0),(!c.value.height||c.value.height==="")&&(H.height=void 0),e.editor.chain().focus().updateAttributes("image",H).run(),setTimeout(()=>{const{view:G}=e.editor;!G||!G.dom||G.dom.querySelectorAll("img.editor-image").forEach(ie=>{if(ie instanceof HTMLImageElement){const Ae=ie.getAttribute("src")||ie.src;(Ae===M||Ae.includes(M.split("/").pop()))&&(c.value.width&&c.value.height?(ie.style.setProperty("width",`${c.value.width}px`,"important"),ie.style.setProperty("height",`${c.value.height}px`,"important"),ie.style.setProperty("object-fit","fill","important"),ie.style.setProperty("max-width","none","important"),ie.style.setProperty("max-height","none","important")):(ie.style.removeProperty("width"),ie.style.removeProperty("height"),ie.style.removeProperty("object-fit"),ie.style.removeProperty("max-width"),ie.style.removeProperty("max-height")))}})},20),c.value.link&&c.value.link.trim()!==""){let G=c.value.link.trim();G.match(/^https?:\/\//i)||(G="https://"+G),D?e.editor.chain().focus().extendMarkRange("link").setLink({href:G,target:c.value.openInNewTab?"_blank":null}).run():e.editor.chain().focus().selectParentNode().setLink({href:G,target:c.value.openInNewTab?"_blank":null}).run()}else D&&e.editor.chain().focus().extendMarkRange("link").unsetLink().run()}else{const{state:R}=e.editor,{selection:$}=R,{$anchor:D}=$;let P=null;for(let H=D.depth;H>0;H--){const G=D.node(H);if(G&&G.type.name==="paragraph"){P=G;break}}if(P&&P.content.content.some(H=>H.type.name==="image")){const H=w(P,D.before(D.depth));if(H!==null){const G=b(),ie=R.schema.nodes.image.create({src:M,alt:c.value.alt||"",title:c.value.title||"",...G});if(c.value.link&&c.value.link.trim()!==""){let Ae=c.value.link.trim();Ae.match(/^https?:\/\//i)||(Ae="https://"+Ae);const Q=R.schema.marks.link.create({href:Ae,target:c.value.openInNewTab?"_blank":null}),Pe=ie.type.create(ie.attrs,ie.content,[Q]);e.editor.chain().focus().insertContentAt(H+1,Pe).run(),k(e.editor,M)}else e.editor.chain().focus().insertContentAt(H+1,ie).run(),k(e.editor,M)}else if(c.value.link&&c.value.link.trim()!==""){const G=b();e.editor.chain().focus().setImage({src:M,alt:c.value.alt||"",title:c.value.title||"",...G}).run(),setTimeout(()=>{let ie=c.value.link.trim();ie.match(/^https?:\/\//i)||(ie="https://"+ie),e.editor.chain().focus().selectParentNode().setLink({href:ie,target:c.value.openInNewTab?"_blank":null}).run(),k(e.editor,M,20)},10)}else{const G=b();e.editor.chain().focus().setImage({src:M,alt:c.value.alt||"",title:c.value.title||"",...G}).run(),k(e.editor,M)}}else if(c.value.link&&c.value.link.trim()!==""){const H=b();e.editor.chain().focus().setImage({src:M,alt:c.value.alt||"",title:c.value.title||"",...H}).run(),setTimeout(()=>{let G=c.value.link.trim();G.match(/^https?:\/\//i)||(G="https://"+G),e.editor.chain().focus().selectParentNode().setLink({href:G,target:c.value.openInNewTab?"_blank":null}).run(),k(e.editor,M,20)},10)}else{const H=b();e.editor.chain().focus().setImage({src:M,alt:c.value.alt||"",title:c.value.title||"",...H}).run(),k(e.editor,M)}}m()},w=(S,I)=>{let A=null;return S.forEach((V,M)=>{V.type.name==="image"&&(A=I+M+1)}),A},v=async()=>{if(e.editor){if(a.value.length===0)if(Array.isArray(c.value.file)&&c.value.file.length>0){const S=c.value.file.filter(A=>typeof A=="string"&&A.trim()!==""),I=c.value.file.filter(A=>A instanceof File);for(const A of S)a.value.some(V=>V.url===A||V.preview===A)||a.value.push({url:A,preview:A,error:!1});I.length>0&&await g(I)}else d.value&&await g(c.value.file);if(a.value.length!==0)try{const S=[],I=b();for(const A of a.value){const V=A.url||A.preview||"";if(!V)continue;const M=e.editor.schema.nodes.image.create({src:V,alt:c.value.alt||"",title:c.value.title||"",...I});S.push(M)}S.length>0&&(e.editor.chain().focus().command(({tr:A,dispatch:V})=>{if(V){const{selection:M}=A,{$anchor:U}=M;let R=M.$anchor.pos,$=null,D=null;for(let H=U.depth;H>0;H--){const G=U.node(H);if(G&&G.type.name==="paragraph"){$=G,D=U.start(H);break}}if($){let H=null;$.forEach((G,ie)=>{G.type.name==="image"&&(H=D+ie+1)}),H!==null?R=H+1:R=D+$.content.size}let P=R;return S.forEach(H=>{A.insert(P,H),P+=H.nodeSize}),!0}return!1}).run(),c.value.width&&c.value.height&&setTimeout(()=>{const{view:A}=e.editor;A&&A.dom&&A.dom.querySelectorAll("img.editor-image").forEach(V=>{V instanceof HTMLImageElement&&Array.from(a.value).some(M=>{const U=M.url||M.preview||"",R=V.src||V.getAttribute("src")||"";return R===U||R.includes(U.split("/").pop())})&&(V.style.setProperty("width",`${c.value.width}px`,"important"),V.style.setProperty("height",`${c.value.height}px`,"important"),V.style.setProperty("object-fit","fill","important"),V.style.setProperty("max-width","none","important"),V.style.setProperty("max-height","none","important"))})},50)),m()}catch(S){console.error("Помилка при додаванні зображень:",S),dt({type:"error",title:"Помилка",message:"Не вдалося додати зображення"})}}},_=async()=>{await x()},E=()=>{m()};return o.watch(()=>c.value.file,async(S,I)=>{if(r.value=!1,!(l.value&&Array.isArray(S)&&S.length===1&&typeof S[0]=="string"&&!S.some(A=>A instanceof File)))if(Array.isArray(S)&&S.length>0){const A=S.filter(M=>M instanceof File),V=S.filter(M=>typeof M=="string"&&M.trim()!=="");if(A.length>0&&(l.value?l.value&&A.length===1&&V.length===0&&(a.value=[]):a.value=[],(!l.value||A.length>1||V.length>0)&&await g(A),l.value&&A.length===1&&V.length===0)){const M=new FileReader;M.onload=U=>{c.value.src=U.target.result},M.readAsDataURL(A[0])}if(V.length>0)if(l.value)l.value&&V.length===1&&A.length===0&&(c.value.src=V[0]);else{A.length===0&&(a.value=[]);for(const M of V)a.value.some(U=>U.url===M||U.preview===M)||a.value.push({url:M,preview:M,error:!1})}}else S&&typeof S=="object"&&S instanceof FileList?(l.value||(a.value=[]),await g(Array.from(S))):S&&typeof S=="object"&&!Array.isArray(S)&&S instanceof File?(l.value||(a.value=[]),await g([S])):l.value||(a.value=[])},{immediate:!1}),o.watch(()=>c.value.src,()=>{r.value=!1}),(S,I)=>(o.openBlock(),o.createElementBlock("div",OD,[o.createElementVNode("button",{onClick:f,class:o.normalizeClass(["h-[30px] w-[30px] flex items-center justify-center text-gray-500 rounded-full cursor-pointer hover:text-gray-900 hover:bg-gray-100",n.editor?.isActive("image")?"bg-gray-200 text-gray-900":""]),title:"Додати зображення"},[...I[4]||(I[4]=[o.createStaticVNode('<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"></rect><circle cx="9" cy="9" r="2"></circle><path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"></path></svg><span class="sr-only">Додати зображення</span>',2)])],2),o.createVNode(ym,{modelValue:t.value,"onUpdate:modelValue":I[3]||(I[3]=A=>t.value=A),title:l.value?"Редагувати зображення":"Додати зображення"},{footer:o.withCtx(()=>[o.createElementVNode("div",UD,[o.createElementVNode("button",{onClick:E,type:"button",class:"px-4 py-2 text-sm font-medium text-gray-700 bg-white border border-gray-300 rounded-md hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500"}," Скасувати "),o.createElementVNode("button",{onClick:_,type:"button",class:"px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500"},o.toDisplayString(l.value?"Оновити зображення":"Додати зображення"),1)])]),default:o.withCtx(()=>[o.createVNode(o.unref(yo),{modelValue:c.value,"onUpdate:modelValue":I[0]||(I[0]=A=>c.value=A),schema:h.value,form:s.value,"onUpdate:form":I[1]||(I[1]=A=>s.value=A)},null,8,["modelValue","schema","form"]),p.value&&!d.value?(o.openBlock(),o.createElementBlock("div",ID,[I[5]||(I[5]=o.createElementVNode("p",{class:"text-sm text-gray-600 mb-2"},"Попередній перегляд:",-1)),o.withDirectives(o.createElementVNode("img",{src:p.value,alt:c.value.alt||"Попередній перегляд зображення",title:c.value.title,class:"max-w-full h-auto max-h-32 rounded border",onError:I[2]||(I[2]=A=>r.value=!0)},null,40,FD),[[o.vShow,!r.value]]),r.value?(o.openBlock(),o.createElementBlock("p",$D," Не вдалося завантажити попередній перегляд зображення ")):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),a.value.length>0?(o.openBlock(),o.createElementBlock("div",RD,[o.createElementVNode("p",PD,"Попередній перегляд ("+o.toDisplayString(a.value.length)+" зображень):",1),I[6]||(I[6]=o.createElementVNode("p",{class:"text-xs text-gray-500 mb-2"}," Зображення будуть розміщені в ряд, якщо вони помістяться по ширині ",-1)),o.createElementVNode("div",zD,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.value,(A,V)=>(o.openBlock(),o.createElementBlock("div",{key:V,class:"relative"},[o.withDirectives(o.createElementVNode("img",{src:A.preview,alt:`Попередній перегляд ${V+1}`,class:"max-w-[100px] max-h-[100px] rounded border object-contain",onError:M=>A.error=!0},null,40,jD),[[o.vShow,!A.error]]),o.createElementVNode("button",{onClick:M=>y(V),class:"absolute -top-2 -right-2 bg-red-500 text-white rounded-full w-5 h-5 flex items-center justify-center text-xs hover:bg-red-600",type:"button"}," × ",8,HD)]))),128))])])):o.createCommentVNode("",!0)]),_:1},8,["modelValue","title"])]))}}),KD={class:"flex items-center"},qD=["disabled"],GD=["disabled"],YD=Object.assign({inheritAttrs:!1},{__name:"vs-editor-history",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor?.can().undo()&&e.editor.chain().focus().undo().run()},r=()=>{e.editor?.can().redo()&&e.editor.chain().focus().redo().run()};return(s,l)=>(o.openBlock(),o.createElementBlock("div",KD,[o.createElementVNode("button",{onClick:t,class:o.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-l-full hover:text-gray-900 hover:bg-gray-100 border-r border-gray-200",[n.editor?.can().undo()?"text-gray-500":"text-gray-300 cursor-not-allowed"]]),disabled:!n.editor?.can().undo(),title:"Undo (Ctrl+Z)"},[...l[0]||(l[0]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o.createElementVNode("path",{d:"M3 7v6h6"}),o.createElementVNode("path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"})],-1)])],10,qD),o.createElementVNode("button",{onClick:r,class:o.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-r-full hover:text-gray-900 hover:bg-gray-100",[n.editor?.can().redo()?"text-gray-500":"text-gray-300 cursor-not-allowed"]]),disabled:!n.editor?.can().redo(),title:"Redo (Ctrl+Y)"},[...l[1]||(l[1]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o.createElementVNode("path",{d:"M21 7v6h-6"}),o.createElementVNode("path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13"})],-1)])],10,GD)]))}}),JD=it(YD,[["__scopeId","data-v-b5a7cc5a"]]),ZD={class:"relative"},XD=Object.assign({inheritAttrs:!1},{__name:"vs-editor-help",props:{editor:Object},setup(n){const e=o.ref(!1),t=o.ref(null),r=()=>{e.value=!e.value},s=()=>{e.value=!1};return(l,a)=>(o.openBlock(),o.createElementBlock("div",ZD,[o.createElementVNode("button",{ref_key:"helpButton",ref:t,onClick:r,class:o.normalizeClass(["w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 text-gray-500",[e.value?"bg-gray-100 text-gray-900":"text-gray-500"]]),title:"Markdown Shortcuts Help"},[...a[1]||(a[1]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),o.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),o.createElementVNode("line",{x1:"12",x2:"12.01",y1:"17",y2:"17"})],-1)])],2),e.value?(o.openBlock(),o.createElementBlock("div",{key:0,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[100001]",onClick:s},[o.createElementVNode("div",{class:"bg-white rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] overflow-y-auto",onClick:a[0]||(a[0]=o.withModifiers(()=>{},["stop"]))},[o.createElementVNode("div",{class:"p-6"},[o.createElementVNode("div",{class:"flex justify-between items-center mb-4"},[a[3]||(a[3]=o.createElementVNode("h2",{class:"text-xl font-semibold text-gray-900"},"Common Markdown Syntax & Shortcuts",-1)),o.createElementVNode("button",{onClick:s,class:"text-gray-400 hover:text-gray-600 transition-colors"},[...a[2]||(a[2]=[o.createElementVNode("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[o.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),a[4]||(a[4]=o.createStaticVNode('<div class="space-y-6" data-v-72ce3024><div data-v-72ce3024><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-72ce3024>Markdown Syntax</h3><div class="overflow-x-auto" data-v-72ce3024><table class="w-full border-collapse" data-v-72ce3024><thead data-v-72ce3024><tr class="bg-gray-50" data-v-72ce3024><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Element</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Example</th></tr></thead><tbody class="text-sm" data-v-72ce3024><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Bold</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>**bold text**</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>__bold text__</code></td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Italics</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>*italic text*</code> or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>_italic text_</code></td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Strikethrough</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>~strikethrough text~</code></td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Headings</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024># Heading 1</code>, <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>## Heading 2</code>, etc., up to <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>###### Heading 6</code></td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Unordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use an asterisk (*), dash (-), or plus sign (+) followed by a space. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Ordered Lists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use a number followed by a period and a space (e.g., <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>1. First item</code>). </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Blockquotes</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Start with a greater-than sign (>) followed by a space. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Inline Code</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Surround with backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>`</code>). </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Code Blocks</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Enclose with three backticks (<code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>```</code>) before and after the code. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Images</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024></code> syntax. </td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Links</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Use <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>[Link Text](url)</code> syntax. </td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024>Checklists</td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024> Create a list item with <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>- [ ]</code> for an incomplete task or <code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>- [x]</code> for a completed one. </td></tr></tbody></table></div></div><div data-v-72ce3024><h3 class="text-lg font-medium text-gray-800 mb-3" data-v-72ce3024>Common Editing Shortcuts</h3><div class="overflow-x-auto" data-v-72ce3024><table class="w-full border-collapse" data-v-72ce3024><thead data-v-72ce3024><tr class="bg-gray-50" data-v-72ce3024><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Shortcut</th><th class="border border-gray-200 px-3 py-2 text-left font-medium text-gray-700" data-v-72ce3024>Action</th></tr></thead><tbody class="text-sm" data-v-72ce3024><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+A</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Select all text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+B</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Apply bold formatting</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+C</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Copy selected text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+I</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Apply italic formatting</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+K</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Open the insert link dialog</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+S</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Save the current document</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+V</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Paste copied text</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+X</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Cut selected text</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+Y</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Redo the last action</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Alt+Shift+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Redo the last action</td></tr><tr data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Ctrl+Z</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Undo the last action</td></tr><tr class="bg-gray-25" data-v-72ce3024><td class="border border-gray-200 px-3 py-2 font-medium" data-v-72ce3024><code class="bg-gray-100 px-2 py-1 rounded" data-v-72ce3024>Alt+Backspace</code></td><td class="border border-gray-200 px-3 py-2" data-v-72ce3024>Undo the last action</td></tr></tbody></table></div></div></div>',1))])])])):o.createCommentVNode("",!0)]))}}),QD=it(XD,[["__scopeId","data-v-72ce3024"]]),eO={__name:"vs-editor-horizontal-rule",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().setHorizontalRule().run()};return(r,s)=>(o.openBlock(),o.createElementBlock("button",{title:"Horizontal Rule",onClick:t,class:"flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex"},[...s[0]||(s[0]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o.createElementVNode("line",{x1:"3",x2:"21",y1:"12",y2:"12"})],-1)])]))}},tO={__name:"vs-editor-fullscreen",props:{editor:Object},emits:["toggle-fullscreen"],setup(n,{emit:e}){const t=e,r=()=>{t("toggle-fullscreen")};return(s,l)=>(o.openBlock(),o.createElementBlock("button",{title:"Fullscreen",onClick:r,class:"w-[30px] h-[30px] flex items-center justify-center text-gray-500 rounded-full hover:text-gray-900 hover:bg-gray-100"},[...l[0]||(l[0]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o.createElementVNode("path",{d:"M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3"})],-1)])]))}},nO=["title"],rO={class:"vs-editor-html-mode__text"},oO={__name:"vs-editor-html-mode",props:{editor:{type:Object,required:!0}},emits:["toggle-html-mode"],setup(n,{emit:e}){const t=e,r=o.ref(!1),s=()=>{r.value=!r.value,t("toggle-html-mode",r.value)};return(l,a)=>(o.openBlock(),o.createElementBlock("button",{onClick:s,class:o.normalizeClass([{"is-active":r.value},"vs-editor-html-mode"]),type:"button",title:r.value?"Switch to Rich Text Mode":"Switch to HTML Mode"},[a[0]||(a[0]=o.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o.createElementVNode("polyline",{points:"16,18 22,12 16,6"}),o.createElementVNode("polyline",{points:"8,6 2,12 8,18"})],-1)),o.createElementVNode("span",rO,o.toDisplayString((r.value,"HTML")),1)],10,nO))}},sO=it(oO,[["__scopeId","data-v-99a48167"]]),lO=Object.assign({inheritAttrs:!1},{__name:"vs-editor-tab",props:{editor:{type:Object,required:!0}},setup(n){const e=n,t=()=>{e.editor&&(e.editor.isActive("bulletList")||e.editor.isActive("orderedList"))&&e.editor.chain().focus().sinkListItem("listItem").run()};return(r,s)=>(o.openBlock(),o.createElementBlock("button",{title:"Tab (Increase List Indent)",onClick:t,class:"text-gray-500 w-[30px] h-[30px] flex items-center justify-center rounded-full hover:text-gray-900 hover:bg-gray-100 focus:outline-none"},[...s[0]||(s[0]=[o.createStaticVNode('<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="icon icon-tabler icons-tabler-outline icon-tabler-indent-increase"><path stroke="none" d="M0 0h24v24H0z" fill="none"></path><path d="M20 6l-11 0"></path><path d="M20 12l-7 0"></path><path d="M20 18l-11 0"></path><path d="M4 8l4 4l-4 4"></path></svg>',1)])]))}}),aO={bold:TS,italic:OS,color:rV,background_color:cV,highlight:dV,bullet_list:ES,ordered_list:SS,blockquote:wS,codeblock:MS,underline:IS,strike:FS,link:bN,table:EN,text_align:jN,type_tag:WN,font_family:mV,font_size:kV,superscript:vV,subscript:_V,heading:AV,clear_formatting:DV,image:WD,history:JD,help:QD,horizontal_rule:eO,fullscreen:tO,html_mode:sO,tab:lO},Im={basic:["history","font_family","font_size","bold","italic","underline","strike","text_align","bullet_list","ordered_list","link","image","clear_formatting","help"],default:["history","heading","font_family","font_size","bold","italic","underline","strike","superscript","subscript","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table","link","image","horizontal_rule","clear_formatting","fullscreen","help","html_mode"],full:["history","heading","font_family","font_size","bold","italic","underline","strike","color","background_color","highlight","text_align","bullet_list","ordered_list","blockquote","codeblock","table","link","image","horizontal_rule","superscript","subscript","clear_formatting","fullscreen","help","html_mode"]},iO={__name:"monaco-editor",props:{modelValue:{type:String,default:""},height:{type:String,default:"280px"},language:{type:String,default:"html"},theme:{type:String,default:"vs"}},emits:["update:modelValue","change"],setup(n,{expose:e,emit:t}){const r=n,s=t,l=o.ref(null);let a=null,i=null,c=!1,d=null;const u=()=>{const V=document.querySelector("link[data-monaco-editor-css]");if(!V)return!1;try{return V.sheet||V.styleSheet||V.href}catch{return!1}},p=()=>u()?new Promise(V=>setTimeout(V,50)):new Promise((V,M)=>{const U=document.createElement("link");U.rel="stylesheet",U.href="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/editor/editor.main.css",U.setAttribute("data-monaco-editor-css","true");const R=()=>{const H=()=>{u()?setTimeout(()=>V(),100):setTimeout(H,50)};H()};U.addEventListener?(U.addEventListener("load",R),U.addEventListener("error",()=>M(new Error("Failed to load Monaco Editor CSS")))):(U.onload=R,U.onerror=()=>M(new Error("Failed to load Monaco Editor CSS"))),document.head.appendChild(U);let $=0;const D=20,P=setInterval(()=>{$++,u()?(clearInterval(P),setTimeout(()=>V(),100)):$>=D&&(clearInterval(P),setTimeout(()=>V(),100))},50)}),h=()=>document.querySelector("script[data-monaco-editor-loader]")?Promise.resolve():new Promise((V,M)=>{const U=document.createElement("script");U.src="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/loader.js",U.setAttribute("data-monaco-editor-loader","true"),U.onload=()=>V(),U.onerror=()=>M(new Error("Failed to load Monaco Editor loader")),document.head.appendChild(U)}),f=()=>d||(window.monaco&&window.monaco.editor?(i=window.monaco,Promise.resolve(i)):(d=new Promise((V,M)=>{if(c){const U=setInterval(()=>{window.monaco&&window.monaco.editor&&(clearInterval(U),i=window.monaco,V(i))},50);return}c=!0,p().then(()=>h()).then(()=>{const U=setInterval(()=>{window.require&&(clearInterval(U),window.require.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"}}),window.require(["vs/editor/editor.main"],()=>{i=window.monaco,c=!1,V(i)},R=>{c=!1,console.error("Failed to load Monaco Editor:",R),M(R)}))},50);setTimeout(()=>{clearInterval(U),c=!1,M(new Error("Monaco Editor loader not found"))},1e4)}).catch(U=>{c=!1,M(U)})}),d)),m=V=>{try{const M=document.createElement("div");M.innerHTML=V;const U=($,D=0)=>{const P=" ".repeat(D);let H="";if($.nodeType===Node.TEXT_NODE){const G=$.textContent.trim();return G&&(H+=P+G+`
|
|
115
|
+
`),H}if($.nodeType===Node.ELEMENT_NODE){const G=$.tagName.toLowerCase(),ie=Array.from($.attributes).map(Q=>`${Q.name}="${Q.value}"`).join(" "),Ae=$.children.length>0;$.textContent.trim()&&!Ae?H+=P+`<${G}${ie?" "+ie:""}>${$.textContent}</${G}>
|
|
116
|
+
`:Ae?(H+=P+`<${G}${ie?" "+ie:""}>
|
|
117
|
+
`,Array.from($.childNodes).forEach(Q=>{H+=U(Q,D+1)}),H+=P+`</${G}>
|
|
118
|
+
`):H+=P+`<${G}${ie?" "+ie:""} />
|
|
119
|
+
`}return H};let R="";return Array.from(M.childNodes).forEach($=>{R+=U($)}),R.trim()}catch(M){return console.warn("HTML formatting error:",M),V}},g=async()=>{if(!l.value)return;if(!i)try{await f();let M=!1,U=0;for(;!M&&U<10;){const R=document.querySelector("link[data-monaco-editor-css]");if(R&&(R.sheet||R.styleSheet))try{const $=R.sheet||R.styleSheet;$&&$.cssRules&&$.cssRules.length>0&&(M=!0)}catch{M=!0}M||(await new Promise($=>setTimeout($,50)),U++)}}catch(M){console.error("Failed to load Monaco Editor:",M);return}const V=r.language;if(a=i.editor.create(l.value,{value:r.modelValue,language:V,theme:r.theme,automaticLayout:!0,minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:"on",lineNumbers:"on",folding:!0,lineDecorationsWidth:0,lineNumbersMinChars:3,renderLineHighlight:"line",selectOnLineNumbers:!0,roundedSelection:!1,readOnly:!1,cursorStyle:"line",cursorBlinking:"blink",cursorSmoothCaretAnimation:!0,cursorWidth:1,fontFamily:"'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace",fontSize:13,lineHeight:1.5,tabSize:2,insertSpaces:!0,detectIndentation:!1,trimAutoWhitespace:!0,formatOnPaste:!0,formatOnType:!0,autoClosingBrackets:"always",autoClosingQuotes:"always",autoSurround:"languageDefined",bracketPairColorization:{enabled:!0},guides:{bracketPairs:!0,indentation:!0},fixedOverflowWidgets:!1,overflowWidgetsDomNode:l.value,suggest:{showKeywords:!0,showSnippets:!0,showClasses:!0,showFunctions:!0,showVariables:!0,showModules:!0,showProperties:!0,showEvents:!0,showOperators:!0,showUnits:!0,showValues:!0,showColors:!0,showFiles:!0,showReferences:!0,showFolders:!0,showTypeParameters:!0,showIssues:!0,showUsers:!0,showWords:!0,showCustomcolors:!0,showInterfaces:!0,showText:!0,showEnums:!0,showStructs:!0,showTypeAliases:!0,showConstants:!0,showConstructors:!0,showFields:!0,showMethods:!0,showNamespaces:!0,showPackages:!0,showSymbols:!0,showTypeParameters:!0},quickSuggestions:{other:!0,comments:!1,strings:!0},html:{format:{enable:!0,tabSize:2,insertSpaces:!0,wrapLineLength:120,unformatted:"default",contentUnformatted:"pre,code,textarea",indentInnerHtml:!1,preserveNewLines:!0,maxPreserveNewLines:2,indentHandlebars:!1,endWithNewline:!1,extraLiners:"head, body, /html",wrapAttributes:"auto"},suggest:{html5:!0,angular1:!1,ionic:!1},validate:{scripts:!0,styles:!0}},scrollbar:{vertical:"auto",horizontal:"auto",verticalScrollbarSize:8,horizontalScrollbarSize:8,useShadows:!0,verticalHasArrows:!1,horizontalHasArrows:!1,verticalSliderSize:4,horizontalSliderSize:4,arrowSize:0,verticalSliderHasArrows:!1,horizontalSliderHasArrows:!1}}),r.language==="html"){i.languages.register({id:"html"}),i.languages.setMonarchTokensProvider("html",{tokenizer:{root:[[/<!--/,"comment","@comment"],[/<[^>]+>/,"tag"],[/\w+\s*=\s*"[^"]*"/,"attribute"],[/\w+\s*=\s*'[^']*'/,"attribute"],[/"[^"]*"/,"string"],[/'[^']*'/,"string"],[/\b(doctype|html|head|body|title|meta|link|script|style|div|span|p|h1|h2|h3|h4|h5|h6|ul|ol|li|table|tr|td|th|form|input|button|img|a|br|hr)\b/i,"keyword"],[/\d+/,"number"],[/\s+/,"white"],[/./,"text"]],comment:[[/-->/,"comment","@pop"],[/./,"comment"]]}});try{i.languages.setLanguageConfiguration("html",{wordPattern:/(-?\d*\.\d\w*)|([^\`\~\!\@\#\%\^\&\*\(\)\-\=\+\[\{\]\}\\\|\;\:\'\"\,\.\<\>\/\?\s]+)/g,comments:{blockComment:["<!--","-->"]},brackets:[["<",">"],["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"<",close:">",notIn:["string"]},{open:'"',close:'"',notIn:["string"]},{open:"'",close:"'",notIn:["string"]}],surroundingPairs:[{open:"<",close:">"},{open:'"',close:'"'},{open:"'",close:"'"}]})}catch(M){console.warn("HTML language configuration failed:",M)}}a.onDidChangeModelContent(()=>{const M=a.getValue();s("update:modelValue",M),s("change",M)})},y=V=>{a&&V!==a.getValue()&&a.setValue(V)},b=V=>{if(a&&i)if(r.language==="html"){const M=V==="vs-dark"||V==="hc-black";i.editor.defineTheme("html-custom",{base:M?"vs-dark":"vs",inherit:!0,rules:[{token:"tag",foreground:M?"#4FC1FF":"#0066CC",fontStyle:"bold"},{token:"attribute",foreground:M?"#9CDCFE":"#0000FF"},{token:"string",foreground:M?"#FF6B6B":"#CC0000"},{token:"comment",foreground:M?"#6A9955":"#008000",fontStyle:"italic"},{token:"keyword",foreground:M?"#FFA500":"#FF6600",fontStyle:"bold"},{token:"number",foreground:M?"#B5CEA8":"#098658"},{token:"text",foreground:M?"#D4D4D4":"#000000"},{token:"white",foreground:M?"#D4D4D4":"#000000"}],colors:{"editor.background":M?"#1e1e1e":"#ffffff","editor.foreground":M?"#d4d4d4":"#000000"}}),i.editor.setTheme("html-custom")}else i.editor.setTheme(V)},k=V=>{a&&i&&i.editor.setModelLanguage(a.getModel(),V)},x=()=>{a&&a.focus()},w=()=>a?a.getPosition():null,v=V=>{a&&V&&(a.setPosition(V),a.revealPosition(V))},_=()=>{if(a){const V=a.getSelection();return a.getModel().getValueInRange(V)}return""},E=V=>{if(a){const M=a.getSelection();a.executeEdits("replace-selection",[{range:M,text:V,forceMoveMarkers:!0}])}},S=()=>{if(a){const V=a.getValue(),M=m(V);M!==V&&(a.setValue(M),a.setPosition({lineNumber:1,column:1}))}},I=()=>{if(r.language==="html"&&i)try{i.languages.registerCompletionItemProvider("html",{provideCompletionItems:(V,M)=>({suggestions:[{label:"class",kind:i.languages.CompletionItemKind.Property,insertText:'class="$1"',insertTextRules:i.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"CSS class attribute"},{label:"id",kind:i.languages.CompletionItemKind.Property,insertText:'id="$1"',insertTextRules:i.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Unique identifier"},{label:"style",kind:i.languages.CompletionItemKind.Property,insertText:'style="$1"',insertTextRules:i.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Inline CSS styles"},{label:"data-*",kind:i.languages.CompletionItemKind.Property,insertText:'data-$1="$2"',insertTextRules:i.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"Custom data attribute"}]})})}catch(V){console.warn("HTML completion provider failed:",V)}},A=()=>{a&&a.layout()};return o.onMounted(async()=>{await o.nextTick();try{await f(),await o.nextTick(),await g(),I(),window.addEventListener("resize",A)}catch(V){console.error("Failed to initialize Monaco Editor:",V)}}),o.onUnmounted(()=>{a&&a.dispose(),window.removeEventListener("resize",A)}),o.watch(()=>r.modelValue,y),o.watch(()=>r.theme,b),o.watch(()=>r.language,k),o.watch(()=>r.height,()=>{o.nextTick(()=>{A()})}),e({editor:a,focus:x,getPosition:w,setPosition:v,getSelectedText:_,replaceSelection:E,formatCode:S}),(V,M)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"monacoContainer",ref:l,class:"monaco-editor-container",style:o.normalizeStyle({height:n.height})},null,4))}},cO=it(iO,[["__scopeId","data-v-b1d773a1"]]),dO={class:"flex align-middle gap-x-0.5 border-b flex-wrap border-b-gray-200 px-[10px] py-[6px] border-solid border-transparent"},uO={key:1,class:"html-source-editor"},pO=Object.assign({inheritAttrs:!1},{__name:"vs-richtext",props:o.mergeModels({modelValue:{type:String,default:()=>""},height:{type:String,default:()=>"300px"},toolbar:{type:[Array,String],default:()=>"default"}},{modelValue:{},modelModifiers:{}}),emits:o.mergeModels(["update:modelValue"],["update:modelValue"]),setup(n){const e=n,t=o.useModel(n,"modelValue"),{editor:r,editorInstance:s,focusEditor:l}=mS(e),{isHtmlMode:a,htmlContent:i,htmlTextarea:c,toggleHtmlMode:d,onHtmlInput:u}=gS(r,(y,b)=>{y==="update:modelValue"&&(t.value=b)}),{isFullscreen:p,toggleFullscreen:h}=yS(),f=o.computed(()=>typeof e.toolbar=="string"?Im[e.toolbar]||Im.default:e.toolbar),m=o.computed(()=>f.value.map(y=>aO[y]).filter(Boolean));o.watch(()=>e.modelValue,y=>{if(r.value){const b=y||"",k=r.value.getHTML();b!==k&&b!=="<p></p>"&&r.value.commands.setContent(b,!1)}},{immediate:!0});const g=y=>{!y||!y.view||!y.view.dom||y.view.dom.querySelectorAll("img.editor-image[width][height]").forEach(b=>{if(b instanceof HTMLImageElement){const k=b.getAttribute("width"),x=b.getAttribute("height");k&&x&&k!=="auto"&&x!=="auto"&&k!==""&&x!==""&&!isNaN(Number(k))&&!isNaN(Number(x))&&(b.style.cssText=`
|
|
120
|
+
width: ${k}px !important;
|
|
121
|
+
height: ${x}px !important;
|
|
122
|
+
max-width: none !important;
|
|
123
|
+
max-height: none !important;
|
|
124
|
+
min-width: auto !important;
|
|
125
|
+
min-height: auto !important;
|
|
126
|
+
object-fit: fill !important;
|
|
127
|
+
`.replace(/\s+/g," ").trim())}})};return o.watch(r,y=>{y&&(o.nextTick(()=>{g(r.value)}),r.value.on("update",b=>{const k=b.editor.getHTML();k!==e.modelValue&&k!=="<p></p>"&&(t.value=k),setTimeout(()=>{g(b.editor)},10)}))}),o.onMounted(()=>{o.nextTick(()=>{r.value&&setTimeout(()=>{g(r.value)},100)})}),(y,b)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["bg-white border border border-solid border-gray-200 rounded-xl w-full",{"fixed left-0 right-0 top-0 bottom-0 z-[100000]":o.unref(p)}])},[o.createElementVNode("div",dO,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(m.value,k=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:k},[o.unref(r)?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(k),{key:0,editor:o.unref(s),onToggleFullscreen:o.unref(h),onToggleHtmlMode:o.unref(d)},null,40,["editor","onToggleFullscreen","onToggleHtmlMode"])):o.createCommentVNode("",!0)],64))),128))]),o.createElementVNode("div",{onClick:b[2]||(b[2]=(...k)=>o.unref(l)&&o.unref(l)(...k)),class:"relative w-full px-4 py-2 bg-white rounded-b-lg editor-content dark:bg-gray-800",style:o.normalizeStyle({height:o.unref(p)?"95vh":n.height})},[o.unref(a)?(o.openBlock(),o.createElementBlock("div",uO,[o.createVNode(cO,{ref_key:"htmlTextarea",ref:c,modelValue:o.unref(i),"onUpdate:modelValue":b[0]||(b[0]=k=>o.isRef(i)?i.value=k:null),height:o.unref(p)?"calc(95vh - 100px)":"100%",language:"html",theme:"vs",onChange:b[1]||(b[1]=k=>o.unref(u)(k))},null,8,["modelValue","height"])])):(o.openBlock(),o.createBlock(o.unref(cE),{key:0,editor:o.unref(r),class:"relative w-full"},null,8,["editor"]))],4)],2))}});/*!
|
|
128
|
+
* shared v11.1.12
|
|
129
|
+
* (c) 2025 kazuya kawaguchi
|
|
130
|
+
* Released under the MIT License.
|
|
131
|
+
*/function An(n,e){typeof console<"u"&&(console.warn("[intlify] "+n),e&&console.warn(e.stack))}const Fm={};function Uc(n){Fm[n]||(Fm[n]=!0,An(n))}const xn=typeof window<"u";let rn,Kr;if(process.env.NODE_ENV!=="production"){const n=xn&&window.performance;n&&n.mark&&n.measure&&n.clearMarks&&n.clearMeasures&&(rn=e=>{n.mark(e)},Kr=(e,t,r)=>{n.measure(e,t,r),n.clearMarks(t),n.clearMarks(r)})}const hO=/\{([0-9a-zA-Z]+)\}/g;function ua(n,...e){return e.length===1&&je(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),n.replace(hO,(t,r)=>e.hasOwnProperty(r)?e[r]:"")}const Tn=(n,e=!1)=>e?Symbol.for(n):Symbol(n),fO=(n,e,t)=>mO({l:n,k:e,s:t}),mO=n=>JSON.stringify(n).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),kt=n=>typeof n=="number"&&isFinite(n),gO=n=>Wc(n)==="[object Date]",bo=n=>Wc(n)==="[object RegExp]",pa=n=>$e(n)&&Object.keys(n).length===0,xt=Object.assign,yO=Object.create,Qe=(n=null)=>yO(n);let $m;const qr=()=>$m||($m=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:Qe());function Rm(n){return n.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/").replace(/=/g,"=")}function Pm(n){return n.replace(/&(?![a-zA-Z0-9#]{2,6};)/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function bO(n){return n=n.replace(/(\w+)\s*=\s*"([^"]*)"/g,(e,t,r)=>`${t}="${Pm(r)}"`),n=n.replace(/(\w+)\s*=\s*'([^']*)'/g,(e,t,r)=>`${t}='${Pm(r)}'`),/\s*on\w+\s*=\s*["']?[^"'>]+["']?/gi.test(n)&&(process.env.NODE_ENV!=="production"&&An("Potentially dangerous event handlers detected in translation. Consider removing onclick, onerror, etc. from your translation messages."),n=n.replace(/(\s+)(on)(\w+\s*=)/gi,"$1on$3")),[/(\s+(?:href|src|action|formaction)\s*=\s*["']?)\s*javascript:/gi,/(style\s*=\s*["'][^"']*url\s*\(\s*)javascript:/gi].forEach(e=>{n=n.replace(e,"$1javascript:")}),n}const kO=Object.prototype.hasOwnProperty;function vn(n,e){return kO.call(n,e)}const ut=Array.isArray,tt=n=>typeof n=="function",pe=n=>typeof n=="string",Ue=n=>typeof n=="boolean",je=n=>n!==null&&typeof n=="object",wO=n=>je(n)&&tt(n.then)&&tt(n.catch),zm=Object.prototype.toString,Wc=n=>zm.call(n),$e=n=>Wc(n)==="[object Object]",xO=n=>n==null?"":ut(n)||$e(n)&&n.toString===zm?JSON.stringify(n,null,2):String(n);function Kc(n,e=""){return n.reduce((t,r,s)=>s===0?t+r:t+e+r,"")}const jm=2;function vO(n,e=0,t=n.length){const r=n.split(/\r?\n/);let s=0;const l=[];for(let a=0;a<r.length;a++)if(s+=r[a].length+1,s>=e){for(let i=a-jm;i<=a+jm||t>s;i++){if(i<0||i>=r.length)continue;const c=i+1;l.push(`${c}${" ".repeat(3-String(c).length)}| ${r[i]}`);const d=r[i].length;if(i===a){const u=e-(s-d)+1,p=Math.max(1,t>s?d-u:t-e);l.push(" | "+" ".repeat(u)+"^".repeat(p))}else if(i>a){if(t>s){const u=Math.max(Math.min(t-s,d),1);l.push(" | "+"^".repeat(u))}s+=d+1}}break}return l.join(`
|
|
132
|
+
`)}function qc(){const n=new Map;return{events:n,on(e,t){const r=n.get(e);r&&r.push(t)||n.set(e,[t])},off(e,t){const r=n.get(e);r&&r.splice(r.indexOf(t)>>>0,1)},emit(e,t){(n.get(e)||[]).slice().map(r=>r(t)),(n.get("*")||[]).slice().map(r=>r(e,t))}}}const ha=n=>!je(n)||ut(n);function fa(n,e){if(ha(n)||ha(e))throw new Error("Invalid value");const t=[{src:n,des:e}];for(;t.length;){const{src:r,des:s}=t.pop();Object.keys(r).forEach(l=>{l!=="__proto__"&&(je(r[l])&&!je(s[l])&&(s[l]=Array.isArray(r[l])?[]:Qe()),ha(s[l])||ha(r[l])?s[l]=r[l]:t.push({src:r[l],des:s[l]}))})}}/*!
|
|
133
|
+
* message-compiler v11.1.12
|
|
134
|
+
* (c) 2025 kazuya kawaguchi
|
|
135
|
+
* Released under the MIT License.
|
|
136
|
+
*/function EO(n,e,t){return{line:n,column:e,offset:t}}function Gc(n,e,t){return{start:n,end:e}}const Se={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16},CO=17,_O={[Se.EXPECTED_TOKEN]:"Expected token: '{0}'",[Se.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[Se.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[Se.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[Se.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[Se.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[Se.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[Se.EMPTY_PLACEHOLDER]:"Empty placeholder",[Se.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[Se.INVALID_LINKED_FORMAT]:"Invalid linked format",[Se.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[Se.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[Se.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[Se.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[Se.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[Se.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function ko(n,e,t={}){const{domain:r,messages:s,args:l}=t,a=process.env.NODE_ENV!=="production"?ua((s||_O)[n]||"",...l||[]):n,i=new SyntaxError(String(a));return i.code=n,e&&(i.location=e),i.domain=r,i}function SO(n){throw n}const NO=/<\/?[\w\s="/.':;#-\/]+>/,VO=n=>NO.test(n),Ln=" ",MO="\r",Ut=`
|
|
137
|
+
`,BO="\u2028",AO="\u2029";function TO(n){const e=n;let t=0,r=1,s=1,l=0;const a=E=>e[E]===MO&&e[E+1]===Ut,i=E=>e[E]===Ut,c=E=>e[E]===AO,d=E=>e[E]===BO,u=E=>a(E)||i(E)||c(E)||d(E),p=()=>t,h=()=>r,f=()=>s,m=()=>l,g=E=>a(E)||c(E)||d(E)?Ut:e[E],y=()=>g(t),b=()=>g(t+l);function k(){return l=0,u(t)&&(r++,s=0),a(t)&&t++,t++,s++,e[t]}function x(){return a(t+l)&&l++,l++,e[t+l]}function w(){t=0,r=1,s=1,l=0}function v(E=0){l=E}function _(){const E=t+l;for(;E!==t;)k();l=0}return{index:p,line:h,column:f,peekOffset:m,charAt:g,currentChar:y,currentPeek:b,next:k,peek:x,reset:w,resetPeek:v,skipToPeek:_}}const Zn=void 0,Hm="'",LO="tokenizer";function DO(n,e={}){const t=e.location!==!1,r=TO(n),s=()=>r.index(),l=()=>EO(r.line(),r.column(),r.index()),a=l(),i=s(),c={currentType:13,offset:i,startLoc:a,endLoc:a,lastType:13,lastOffset:i,lastStartLoc:a,lastEndLoc:a,braceNest:0,inLinked:!1,text:""},d=()=>c,{onError:u}=e;function p(B,O,Z,...he){const ve=d();if(O.column+=Z,O.offset+=Z,u){const W=t?Gc(ve.startLoc,O):null,X=ko(B,W,{domain:LO,args:he});u(X)}}function h(B,O,Z){B.endLoc=l(),B.currentType=O;const he={type:O};return t&&(he.loc=Gc(B.startLoc,B.endLoc)),Z!=null&&(he.value=Z),he}const f=B=>h(B,13);function m(B,O){return B.currentChar()===O?(B.next(),O):(p(Se.EXPECTED_TOKEN,l(),0,O),"")}function g(B){let O="";for(;B.currentPeek()===Ln||B.currentPeek()===Ut;)O+=B.currentPeek(),B.peek();return O}function y(B){const O=g(B);return B.skipToPeek(),O}function b(B){if(B===Zn)return!1;const O=B.charCodeAt(0);return O>=97&&O<=122||O>=65&&O<=90||O===95}function k(B){if(B===Zn)return!1;const O=B.charCodeAt(0);return O>=48&&O<=57}function x(B,O){const{currentType:Z}=O;if(Z!==2)return!1;g(B);const he=b(B.currentPeek());return B.resetPeek(),he}function w(B,O){const{currentType:Z}=O;if(Z!==2)return!1;g(B);const he=B.currentPeek()==="-"?B.peek():B.currentPeek(),ve=k(he);return B.resetPeek(),ve}function v(B,O){const{currentType:Z}=O;if(Z!==2)return!1;g(B);const he=B.currentPeek()===Hm;return B.resetPeek(),he}function _(B,O){const{currentType:Z}=O;if(Z!==7)return!1;g(B);const he=B.currentPeek()===".";return B.resetPeek(),he}function E(B,O){const{currentType:Z}=O;if(Z!==8)return!1;g(B);const he=b(B.currentPeek());return B.resetPeek(),he}function S(B,O){const{currentType:Z}=O;if(!(Z===7||Z===11))return!1;g(B);const he=B.currentPeek()===":";return B.resetPeek(),he}function I(B,O){const{currentType:Z}=O;if(Z!==9)return!1;const he=()=>{const W=B.currentPeek();return W==="{"?b(B.peek()):W==="@"||W==="|"||W===":"||W==="."||W===Ln||!W?!1:W===Ut?(B.peek(),he()):V(B,!1)},ve=he();return B.resetPeek(),ve}function A(B){g(B);const O=B.currentPeek()==="|";return B.resetPeek(),O}function V(B,O=!0){const Z=(ve=!1,W="")=>{const X=B.currentPeek();return X==="{"||X==="@"||!X?ve:X==="|"?!(W===Ln||W===Ut):X===Ln?(B.peek(),Z(!0,Ln)):X===Ut?(B.peek(),Z(!0,Ut)):!0},he=Z();return O&&B.resetPeek(),he}function M(B,O){const Z=B.currentChar();return Z===Zn?Zn:O(Z)?(B.next(),Z):null}function U(B){const O=B.charCodeAt(0);return O>=97&&O<=122||O>=65&&O<=90||O>=48&&O<=57||O===95||O===36}function R(B){return M(B,U)}function $(B){const O=B.charCodeAt(0);return O>=97&&O<=122||O>=65&&O<=90||O>=48&&O<=57||O===95||O===36||O===45}function D(B){return M(B,$)}function P(B){const O=B.charCodeAt(0);return O>=48&&O<=57}function H(B){return M(B,P)}function G(B){const O=B.charCodeAt(0);return O>=48&&O<=57||O>=65&&O<=70||O>=97&&O<=102}function ie(B){return M(B,G)}function Ae(B){let O="",Z="";for(;O=H(B);)Z+=O;return Z}function Q(B){let O="";for(;;){const Z=B.currentChar();if(Z==="{"||Z==="}"||Z==="@"||Z==="|"||!Z)break;if(Z===Ln||Z===Ut)if(V(B))O+=Z,B.next();else{if(A(B))break;O+=Z,B.next()}else O+=Z,B.next()}return O}function Pe(B){y(B);let O="",Z="";for(;O=D(B);)Z+=O;const he=B.currentChar();if(he&&he!=="}"&&he!==Zn&&he!==Ln&&he!==Ut&&he!==" "){const ve=Y(B);return p(Se.INVALID_TOKEN_IN_PLACEHOLDER,l(),0,Z+ve),Z+ve}return B.currentChar()===Zn&&p(Se.UNTERMINATED_CLOSING_BRACE,l(),0),Z}function ze(B){y(B);let O="";return B.currentChar()==="-"?(B.next(),O+=`-${Ae(B)}`):O+=Ae(B),B.currentChar()===Zn&&p(Se.UNTERMINATED_CLOSING_BRACE,l(),0),O}function We(B){return B!==Hm&&B!==Ut}function St(B){y(B),m(B,"'");let O="",Z="";for(;O=M(B,We);)O==="\\"?Z+=gt(B):Z+=O;const he=B.currentChar();return he===Ut||he===Zn?(p(Se.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,l(),0),he===Ut&&(B.next(),m(B,"'")),Z):(m(B,"'"),Z)}function gt(B){const O=B.currentChar();switch(O){case"\\":case"'":return B.next(),`\\${O}`;case"u":return Wt(B,O,4);case"U":return Wt(B,O,6);default:return p(Se.UNKNOWN_ESCAPE_SEQUENCE,l(),0,O),""}}function Wt(B,O,Z){m(B,O);let he="";for(let ve=0;ve<Z;ve++){const W=ie(B);if(!W){p(Se.INVALID_UNICODE_ESCAPE_SEQUENCE,l(),0,`\\${O}${he}${B.currentChar()}`);break}he+=W}return`\\${O}${he}`}function on(B){return B!=="{"&&B!=="}"&&B!==Ln&&B!==Ut}function Y(B){y(B);let O="",Z="";for(;O=M(B,on);)Z+=O;return Z}function re(B){let O="",Z="";for(;O=R(B);)Z+=O;return Z}function ae(B){const O=Z=>{const he=B.currentChar();return he==="{"||he==="@"||he==="|"||he==="("||he===")"||!he||he===Ln?Z:(Z+=he,B.next(),O(Z))};return O("")}function fe(B){y(B);const O=m(B,"|");return y(B),O}function be(B,O){let Z=null;switch(B.currentChar()){case"{":return O.braceNest>=1&&p(Se.NOT_ALLOW_NEST_PLACEHOLDER,l(),0),B.next(),Z=h(O,2,"{"),y(B),O.braceNest++,Z;case"}":return O.braceNest>0&&O.currentType===2&&p(Se.EMPTY_PLACEHOLDER,l(),0),B.next(),Z=h(O,3,"}"),O.braceNest--,O.braceNest>0&&y(B),O.inLinked&&O.braceNest===0&&(O.inLinked=!1),Z;case"@":return O.braceNest>0&&p(Se.UNTERMINATED_CLOSING_BRACE,l(),0),Z=Oe(B,O)||f(O),O.braceNest=0,Z;default:{let he=!0,ve=!0,W=!0;if(A(B))return O.braceNest>0&&p(Se.UNTERMINATED_CLOSING_BRACE,l(),0),Z=h(O,1,fe(B)),O.braceNest=0,O.inLinked=!1,Z;if(O.braceNest>0&&(O.currentType===4||O.currentType===5||O.currentType===6))return p(Se.UNTERMINATED_CLOSING_BRACE,l(),0),O.braceNest=0,He(B,O);if(he=x(B,O))return Z=h(O,4,Pe(B)),y(B),Z;if(ve=w(B,O))return Z=h(O,5,ze(B)),y(B),Z;if(W=v(B,O))return Z=h(O,6,St(B)),y(B),Z;if(!he&&!ve&&!W)return Z=h(O,12,Y(B)),p(Se.INVALID_TOKEN_IN_PLACEHOLDER,l(),0,Z.value),y(B),Z;break}}return Z}function Oe(B,O){const{currentType:Z}=O;let he=null;const ve=B.currentChar();switch((Z===7||Z===8||Z===11||Z===9)&&(ve===Ut||ve===Ln)&&p(Se.INVALID_LINKED_FORMAT,l(),0),ve){case"@":return B.next(),he=h(O,7,"@"),O.inLinked=!0,he;case".":return y(B),B.next(),h(O,8,".");case":":return y(B),B.next(),h(O,9,":");default:return A(B)?(he=h(O,1,fe(B)),O.braceNest=0,O.inLinked=!1,he):_(B,O)||S(B,O)?(y(B),Oe(B,O)):E(B,O)?(y(B),h(O,11,re(B))):I(B,O)?(y(B),ve==="{"?be(B,O)||he:h(O,10,ae(B))):(Z===7&&p(Se.INVALID_LINKED_FORMAT,l(),0),O.braceNest=0,O.inLinked=!1,He(B,O))}}function He(B,O){let Z={type:13};if(O.braceNest>0)return be(B,O)||f(O);if(O.inLinked)return Oe(B,O)||f(O);switch(B.currentChar()){case"{":return be(B,O)||f(O);case"}":return p(Se.UNBALANCED_CLOSING_BRACE,l(),0),B.next(),h(O,3,"}");case"@":return Oe(B,O)||f(O);default:{if(A(B))return Z=h(O,1,fe(B)),O.braceNest=0,O.inLinked=!1,Z;if(V(B))return h(O,0,Q(B));break}}return Z}function Ke(){const{currentType:B,offset:O,startLoc:Z,endLoc:he}=c;return c.lastType=B,c.lastOffset=O,c.lastStartLoc=Z,c.lastEndLoc=he,c.offset=s(),c.startLoc=l(),r.currentChar()===Zn?h(c,13):He(r,c)}return{nextToken:Ke,currentOffset:s,currentPosition:l,context:d}}const OO="parser",IO=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function FO(n,e,t){switch(n){case"\\\\":return"\\";case"\\'":return"'";default:{const r=parseInt(e||t,16);return r<=55295||r>=57344?String.fromCodePoint(r):"�"}}}function $O(n={}){const e=n.location!==!1,{onError:t}=n;function r(b,k,x,w,...v){const _=b.currentPosition();if(_.offset+=w,_.column+=w,t){const E=e?Gc(x,_):null,S=ko(k,E,{domain:OO,args:v});t(S)}}function s(b,k,x){const w={type:b};return e&&(w.start=k,w.end=k,w.loc={start:x,end:x}),w}function l(b,k,x,w){e&&(b.end=k,b.loc&&(b.loc.end=x))}function a(b,k){const x=b.context(),w=s(3,x.offset,x.startLoc);return w.value=k,l(w,b.currentOffset(),b.currentPosition()),w}function i(b,k){const x=b.context(),{lastOffset:w,lastStartLoc:v}=x,_=s(5,w,v);return _.index=parseInt(k,10),b.nextToken(),l(_,b.currentOffset(),b.currentPosition()),_}function c(b,k){const x=b.context(),{lastOffset:w,lastStartLoc:v}=x,_=s(4,w,v);return _.key=k,b.nextToken(),l(_,b.currentOffset(),b.currentPosition()),_}function d(b,k){const x=b.context(),{lastOffset:w,lastStartLoc:v}=x,_=s(9,w,v);return _.value=k.replace(IO,FO),b.nextToken(),l(_,b.currentOffset(),b.currentPosition()),_}function u(b){const k=b.nextToken(),x=b.context(),{lastOffset:w,lastStartLoc:v}=x,_=s(8,w,v);return k.type!==11?(r(b,Se.UNEXPECTED_EMPTY_LINKED_MODIFIER,x.lastStartLoc,0),_.value="",l(_,w,v),{nextConsumeToken:k,node:_}):(k.value==null&&r(b,Se.UNEXPECTED_LEXICAL_ANALYSIS,x.lastStartLoc,0,Dn(k)),_.value=k.value||"",l(_,b.currentOffset(),b.currentPosition()),{node:_})}function p(b,k){const x=b.context(),w=s(7,x.offset,x.startLoc);return w.value=k,l(w,b.currentOffset(),b.currentPosition()),w}function h(b){const k=b.context(),x=s(6,k.offset,k.startLoc);let w=b.nextToken();if(w.type===8){const v=u(b);x.modifier=v.node,w=v.nextConsumeToken||b.nextToken()}switch(w.type!==9&&r(b,Se.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Dn(w)),w=b.nextToken(),w.type===2&&(w=b.nextToken()),w.type){case 10:w.value==null&&r(b,Se.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Dn(w)),x.key=p(b,w.value||"");break;case 4:w.value==null&&r(b,Se.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Dn(w)),x.key=c(b,w.value||"");break;case 5:w.value==null&&r(b,Se.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Dn(w)),x.key=i(b,w.value||"");break;case 6:w.value==null&&r(b,Se.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Dn(w)),x.key=d(b,w.value||"");break;default:{r(b,Se.UNEXPECTED_EMPTY_LINKED_KEY,k.lastStartLoc,0);const v=b.context(),_=s(7,v.offset,v.startLoc);return _.value="",l(_,v.offset,v.startLoc),x.key=_,l(x,v.offset,v.startLoc),{nextConsumeToken:w,node:x}}}return l(x,b.currentOffset(),b.currentPosition()),{node:x}}function f(b){const k=b.context(),x=k.currentType===1?b.currentOffset():k.offset,w=k.currentType===1?k.endLoc:k.startLoc,v=s(2,x,w);v.items=[];let _=null;do{const I=_||b.nextToken();switch(_=null,I.type){case 0:I.value==null&&r(b,Se.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Dn(I)),v.items.push(a(b,I.value||""));break;case 5:I.value==null&&r(b,Se.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Dn(I)),v.items.push(i(b,I.value||""));break;case 4:I.value==null&&r(b,Se.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Dn(I)),v.items.push(c(b,I.value||""));break;case 6:I.value==null&&r(b,Se.UNEXPECTED_LEXICAL_ANALYSIS,k.lastStartLoc,0,Dn(I)),v.items.push(d(b,I.value||""));break;case 7:{const A=h(b);v.items.push(A.node),_=A.nextConsumeToken||null;break}}}while(k.currentType!==13&&k.currentType!==1);const E=k.currentType===1?k.lastOffset:b.currentOffset(),S=k.currentType===1?k.lastEndLoc:b.currentPosition();return l(v,E,S),v}function m(b,k,x,w){const v=b.context();let _=w.items.length===0;const E=s(1,k,x);E.cases=[],E.cases.push(w);do{const S=f(b);_||(_=S.items.length===0),E.cases.push(S)}while(v.currentType!==13);return _&&r(b,Se.MUST_HAVE_MESSAGES_IN_PLURAL,x,0),l(E,b.currentOffset(),b.currentPosition()),E}function g(b){const k=b.context(),{offset:x,startLoc:w}=k,v=f(b);return k.currentType===13?v:m(b,x,w,v)}function y(b){const k=DO(b,xt({},n)),x=k.context(),w=s(0,x.offset,x.startLoc);return e&&w.loc&&(w.loc.source=b),w.body=g(k),n.onCacheKey&&(w.cacheKey=n.onCacheKey(b)),x.currentType!==13&&r(k,Se.UNEXPECTED_LEXICAL_ANALYSIS,x.lastStartLoc,0,b[x.offset]||""),l(w,k.currentOffset(),k.currentPosition()),w}return{parse:y}}function Dn(n){if(n.type===13)return"EOF";const e=(n.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function RO(n,e={}){const t={ast:n,helpers:new Set};return{context:()=>t,helper:r=>(t.helpers.add(r),r)}}function Um(n,e){for(let t=0;t<n.length;t++)Yc(n[t],e)}function Yc(n,e){switch(n.type){case 1:Um(n.cases,e),e.helper("plural");break;case 2:Um(n.items,e);break;case 6:{Yc(n.key,e),e.helper("linked"),e.helper("type");break}case 5:e.helper("interpolate"),e.helper("list");break;case 4:e.helper("interpolate"),e.helper("named");break}}function PO(n,e={}){const t=RO(n);t.helper("normalize"),n.body&&Yc(n.body,t);const r=t.context();n.helpers=Array.from(r.helpers)}function zO(n){const e=n.body;return e.type===2?Wm(e):e.cases.forEach(t=>Wm(t)),n}function Wm(n){if(n.items.length===1){const e=n.items[0];(e.type===3||e.type===9)&&(n.static=e.value,delete e.value)}else{const e=[];for(let t=0;t<n.items.length;t++){const r=n.items[t];if(!(r.type===3||r.type===9)||r.value==null)break;e.push(r.value)}if(e.length===n.items.length){n.static=Kc(e);for(let t=0;t<n.items.length;t++){const r=n.items[t];(r.type===3||r.type===9)&&delete r.value}}}}const jO="minifier";function wo(n){switch(n.t=n.type,n.type){case 0:{const e=n;wo(e.body),e.b=e.body,delete e.body;break}case 1:{const e=n,t=e.cases;for(let r=0;r<t.length;r++)wo(t[r]);e.c=t,delete e.cases;break}case 2:{const e=n,t=e.items;for(let r=0;r<t.length;r++)wo(t[r]);e.i=t,delete e.items,e.static&&(e.s=e.static,delete e.static);break}case 3:case 9:case 8:case 7:{const e=n;e.value&&(e.v=e.value,delete e.value);break}case 6:{const e=n;wo(e.key),e.k=e.key,delete e.key,e.modifier&&(wo(e.modifier),e.m=e.modifier,delete e.modifier);break}case 5:{const e=n;e.i=e.index,delete e.index;break}case 4:{const e=n;e.k=e.key,delete e.key;break}default:if(process.env.NODE_ENV!=="production")throw ko(Se.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:jO,args:[n.type]})}delete n.type}const HO="parser";function UO(n,e){const{filename:t,breakLineCode:r,needIndent:s}=e,l=e.location!==!1,a={filename:t,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:r,needIndent:s,indentLevel:0};l&&n.loc&&(a.source=n.loc.source);const i=()=>a;function c(f,m){a.code+=f}function d(f,m=!0){const g=m?r:"";c(s?g+" ".repeat(f):g)}function u(f=!0){const m=++a.indentLevel;f&&d(m)}function p(f=!0){const m=--a.indentLevel;f&&d(m)}function h(){d(a.indentLevel)}return{context:i,push:c,indent:u,deindent:p,newline:h,helper:f=>`_${f}`,needIndent:()=>a.needIndent}}function WO(n,e){const{helper:t}=n;n.push(`${t("linked")}(`),xo(n,e.key),e.modifier?(n.push(", "),xo(n,e.modifier),n.push(", _type")):n.push(", undefined, _type"),n.push(")")}function KO(n,e){const{helper:t,needIndent:r}=n;n.push(`${t("normalize")}([`),n.indent(r());const s=e.items.length;for(let l=0;l<s&&(xo(n,e.items[l]),l!==s-1);l++)n.push(", ");n.deindent(r()),n.push("])")}function qO(n,e){const{helper:t,needIndent:r}=n;if(e.cases.length>1){n.push(`${t("plural")}([`),n.indent(r());const s=e.cases.length;for(let l=0;l<s&&(xo(n,e.cases[l]),l!==s-1);l++)n.push(", ");n.deindent(r()),n.push("])")}}function GO(n,e){e.body?xo(n,e.body):n.push("null")}function xo(n,e){const{helper:t}=n;switch(e.type){case 0:GO(n,e);break;case 1:qO(n,e);break;case 2:KO(n,e);break;case 6:WO(n,e);break;case 8:n.push(JSON.stringify(e.value),e);break;case 7:n.push(JSON.stringify(e.value),e);break;case 5:n.push(`${t("interpolate")}(${t("list")}(${e.index}))`,e);break;case 4:n.push(`${t("interpolate")}(${t("named")}(${JSON.stringify(e.key)}))`,e);break;case 9:n.push(JSON.stringify(e.value),e);break;case 3:n.push(JSON.stringify(e.value),e);break;default:if(process.env.NODE_ENV!=="production")throw ko(Se.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:HO,args:[e.type]})}}const YO=(n,e={})=>{const t=pe(e.mode)?e.mode:"normal",r=pe(e.filename)?e.filename:"message.intl";e.sourceMap;const s=e.breakLineCode!=null?e.breakLineCode:t==="arrow"?";":`
|
|
138
|
+
`,l=e.needIndent?e.needIndent:t!=="arrow",a=n.helpers||[],i=UO(n,{filename:r,breakLineCode:s,needIndent:l});i.push(t==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),i.indent(l),a.length>0&&(i.push(`const { ${Kc(a.map(u=>`${u}: _${u}`),", ")} } = ctx`),i.newline()),i.push("return "),xo(i,n),i.deindent(l),i.push("}"),delete n.helpers;const{code:c,map:d}=i.context();return{ast:n,code:c,map:d?d.toJSON():void 0}};function JO(n,e={}){const t=xt({},e),r=!!t.jit,s=!!t.minify,l=t.optimize==null?!0:t.optimize,a=$O(t).parse(n);return r?(l&&zO(a),s&&wo(a),{ast:a,code:""}):(PO(a,t),YO(a,t))}/*!
|
|
139
|
+
* core-base v11.1.12
|
|
140
|
+
* (c) 2025 kazuya kawaguchi
|
|
141
|
+
* Released under the MIT License.
|
|
142
|
+
*/function ZO(){typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(qr().__INTLIFY_PROD_DEVTOOLS__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(qr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function mn(n){return je(n)&&Jc(n)===0&&(vn(n,"b")||vn(n,"body"))}const Km=["b","body"];function XO(n){return vr(n,Km)}const qm=["c","cases"];function QO(n){return vr(n,qm,[])}const Gm=["s","static"];function e5(n){return vr(n,Gm)}const Ym=["i","items"];function t5(n){return vr(n,Ym,[])}const Jm=["t","type"];function Jc(n){return vr(n,Jm)}const Zm=["v","value"];function ma(n,e){const t=vr(n,Zm);if(t!=null)return t;throw us(e)}const Xm=["m","modifier"];function n5(n){return vr(n,Xm)}const Qm=["k","key"];function r5(n){const e=vr(n,Qm);if(e)return e;throw us(6)}function vr(n,e,t){for(let r=0;r<e.length;r++){const s=e[r];if(vn(n,s)&&n[s]!=null)return n[s]}return t}const e0=[...Km,...qm,...Gm,...Ym,...Qm,...Xm,...Zm,...Jm];function us(n){return new Error(`unhandled node type: ${n}`)}function Zc(n){return e=>o5(e,n)}function o5(n,e){const t=XO(e);if(t==null)throw us(0);if(Jc(t)===1){const r=QO(t);return n.plural(r.reduce((s,l)=>[...s,t0(n,l)],[]))}else return t0(n,t)}function t0(n,e){const t=e5(e);if(t!=null)return n.type==="text"?t:n.normalize([t]);{const r=t5(e).reduce((s,l)=>[...s,Xc(n,l)],[]);return n.normalize(r)}}function Xc(n,e){const t=Jc(e);switch(t){case 3:return ma(e,t);case 9:return ma(e,t);case 4:{const r=e;if(vn(r,"k")&&r.k)return n.interpolate(n.named(r.k));if(vn(r,"key")&&r.key)return n.interpolate(n.named(r.key));throw us(t)}case 5:{const r=e;if(vn(r,"i")&&kt(r.i))return n.interpolate(n.list(r.i));if(vn(r,"index")&&kt(r.index))return n.interpolate(n.list(r.index));throw us(t)}case 6:{const r=e,s=n5(r),l=r5(r);return n.linked(Xc(n,l),s?Xc(n,s):void 0,n.type)}case 7:return ma(e,t);case 8:return ma(e,t);default:throw new Error(`unhandled node on format message part: ${t}`)}}const s5="Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.";function l5(n,e){e&&VO(n)&&An(ua(s5,{source:n}))}const a5=n=>n;let ga=Qe();function i5(n,e={}){let t=!1;const r=e.onError||SO;return e.onError=s=>{t=!0,r(s)},{...JO(n,e),detectError:t}}function c5(n,e){if(!__INTLIFY_DROP_MESSAGE_COMPILER__&&pe(n)){const t=Ue(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&l5(n,t);const r=(e.onCacheKey||a5)(n),s=ga[r];if(s)return s;const{ast:l,detectError:a}=i5(n,{...e,location:process.env.NODE_ENV!=="production",jit:!0}),i=Zc(l);return a?i:ga[r]=i}else{if(process.env.NODE_ENV!=="production"&&!mn(n))return An(`the message that is resolve with key '${e.key}' is not supported for jit compilation`),()=>n;const t=n.cacheKey;return t?ga[t]||(ga[t]=Zc(n)):Zc(n)}}let ps=null;function d5(n){ps=n}function u5(n,e,t){ps&&ps.emit("i18n:init",{timestamp:Date.now(),i18n:n,version:e,meta:t})}const p5=h5("function:translate");function h5(n){return e=>ps&&ps.emit(n,e)}const Pt={INVALID_ARGUMENT:CO,INVALID_DATE_ARGUMENT:18,INVALID_ISO_DATE_ARGUMENT:19,NOT_SUPPORT_NON_STRING_MESSAGE:20,NOT_SUPPORT_LOCALE_PROMISE_VALUE:21,NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:22,NOT_SUPPORT_LOCALE_TYPE:23},f5=24;function Xn(n){return ko(n,null,process.env.NODE_ENV!=="production"?{messages:m5}:void 0)}const m5={[Pt.INVALID_ARGUMENT]:"Invalid arguments",[Pt.INVALID_DATE_ARGUMENT]:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",[Pt.INVALID_ISO_DATE_ARGUMENT]:"The argument provided is not a valid ISO date string",[Pt.NOT_SUPPORT_NON_STRING_MESSAGE]:"Not support non-string message",[Pt.NOT_SUPPORT_LOCALE_PROMISE_VALUE]:"cannot support promise value",[Pt.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]:"cannot support async function",[Pt.NOT_SUPPORT_LOCALE_TYPE]:"cannot support locale type"};function Qc(n,e){return e.locale!=null?n0(e.locale):n0(n.locale)}let ed;function n0(n){if(pe(n))return n;if(tt(n)){if(n.resolvedOnce&&ed!=null)return ed;if(n.constructor.name==="Function"){const e=n();if(wO(e))throw Xn(Pt.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return ed=e}else throw Xn(Pt.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw Xn(Pt.NOT_SUPPORT_LOCALE_TYPE)}function g5(n,e,t){return[...new Set([t,...ut(e)?e:je(e)?Object.keys(e):pe(e)?[e]:[t]])]}function r0(n,e,t){const r=pe(t)?t:hs,s=n;s.__localeChainCache||(s.__localeChainCache=new Map);let l=s.__localeChainCache.get(r);if(!l){l=[];let a=[t];for(;ut(a);)a=o0(l,a,e);const i=ut(e)||!$e(e)?e:e.default?e.default:null;a=pe(i)?[i]:i,ut(a)&&o0(l,a,!1),s.__localeChainCache.set(r,l)}return l}function o0(n,e,t){let r=!0;for(let s=0;s<e.length&&Ue(r);s++){const l=e[s];pe(l)&&(r=y5(n,e[s],t))}return r}function y5(n,e,t){let r;const s=e.split("-");do{const l=s.join("-");r=b5(n,l,t),s.splice(-1,1)}while(s.length&&r===!0);return r}function b5(n,e,t){let r=!1;if(!n.includes(e)&&(r=!0,e)){r=e[e.length-1]!=="!";const s=e.replace(/!/g,"");n.push(s),(ut(t)||$e(t))&&t[s]&&(r=t[s])}return r}const Er=[];Er[0]={w:[0],i:[3,0],"[":[4],o:[7]},Er[1]={w:[1],".":[2],"[":[4],o:[7]},Er[2]={w:[2],i:[3,0],0:[3,0]},Er[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},Er[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},Er[5]={"'":[4,0],o:8,l:[5,0]},Er[6]={'"':[4,0],o:8,l:[6,0]};const k5=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function w5(n){return k5.test(n)}function x5(n){const e=n.charCodeAt(0),t=n.charCodeAt(n.length-1);return e===t&&(e===34||e===39)?n.slice(1,-1):n}function v5(n){if(n==null)return"o";switch(n.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return n;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function E5(n){const e=n.trim();return n.charAt(0)==="0"&&isNaN(parseInt(n))?!1:w5(e)?x5(e):"*"+e}function C5(n){const e=[];let t=-1,r=0,s=0,l,a,i,c,d,u,p;const h=[];h[0]=()=>{a===void 0?a=i:a+=i},h[1]=()=>{a!==void 0&&(e.push(a),a=void 0)},h[2]=()=>{h[0](),s++},h[3]=()=>{if(s>0)s--,r=4,h[0]();else{if(s=0,a===void 0||(a=E5(a),a===!1))return!1;h[1]()}};function f(){const m=n[t+1];if(r===5&&m==="'"||r===6&&m==='"')return t++,i="\\"+m,h[0](),!0}for(;r!==null;)if(t++,l=n[t],!(l==="\\"&&f())){if(c=v5(l),p=Er[r],d=p[c]||p.l||8,d===8||(r=d[0],d[1]!==void 0&&(u=h[d[1]],u&&(i=l,u()===!1))))return;if(r===7)return e}}const s0=new Map;function _5(n,e){return je(n)?n[e]:null}function S5(n,e){if(!je(n))return null;let t=s0.get(e);if(t||(t=C5(e),t&&s0.set(e,t)),!t)return null;const r=t.length;let s=n,l=0;for(;l<r;){const a=t[l];if(e0.includes(a)&&mn(s))return null;const i=s[a];if(i===void 0||tt(s))return null;s=i,l++}return s}const Yt={NOT_FOUND_KEY:1,FALLBACK_TO_TRANSLATE:2,CANNOT_FORMAT_NUMBER:3,FALLBACK_TO_NUMBER_FORMAT:4,CANNOT_FORMAT_DATE:5,FALLBACK_TO_DATE_FORMAT:6,EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:7},N5=8,V5={[Yt.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[Yt.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[Yt.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[Yt.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[Yt.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[Yt.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[Yt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]:"This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future."};function Gr(n,...e){return ua(V5[n],...e)}const M5="11.1.12",ya=-1,hs="en-US",ba="",l0=n=>`${n.charAt(0).toLocaleUpperCase()}${n.substr(1)}`;function B5(){return{upper:(n,e)=>e==="text"&&pe(n)?n.toUpperCase():e==="vnode"&&je(n)&&"__v_isVNode"in n?n.children.toUpperCase():n,lower:(n,e)=>e==="text"&&pe(n)?n.toLowerCase():e==="vnode"&&je(n)&&"__v_isVNode"in n?n.children.toLowerCase():n,capitalize:(n,e)=>e==="text"&&pe(n)?l0(n):e==="vnode"&&je(n)&&"__v_isVNode"in n?l0(n.children):n}}let a0;function A5(n){a0=n}let i0;function T5(n){i0=n}let c0;function L5(n){c0=n}let d0=null;const u0=n=>{d0=n},D5=()=>d0;let p0=0;function O5(n={}){const e=tt(n.onWarn)?n.onWarn:An,t=pe(n.version)?n.version:M5,r=pe(n.locale)||tt(n.locale)?n.locale:hs,s=tt(r)?hs:r,l=ut(n.fallbackLocale)||$e(n.fallbackLocale)||pe(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:s,a=$e(n.messages)?n.messages:td(s),i=$e(n.datetimeFormats)?n.datetimeFormats:td(s),c=$e(n.numberFormats)?n.numberFormats:td(s),d=xt(Qe(),n.modifiers,B5()),u=n.pluralRules||Qe(),p=tt(n.missing)?n.missing:null,h=Ue(n.missingWarn)||bo(n.missingWarn)?n.missingWarn:!0,f=Ue(n.fallbackWarn)||bo(n.fallbackWarn)?n.fallbackWarn:!0,m=!!n.fallbackFormat,g=!!n.unresolving,y=tt(n.postTranslation)?n.postTranslation:null,b=$e(n.processor)?n.processor:null,k=Ue(n.warnHtmlMessage)?n.warnHtmlMessage:!0,x=!!n.escapeParameter,w=tt(n.messageCompiler)?n.messageCompiler:a0;process.env.NODE_ENV!=="production"&&tt(n.messageCompiler)&&Uc(Gr(Yt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));const v=tt(n.messageResolver)?n.messageResolver:i0||_5,_=tt(n.localeFallbacker)?n.localeFallbacker:c0||g5,E=je(n.fallbackContext)?n.fallbackContext:void 0,S=n,I=je(S.__datetimeFormatters)?S.__datetimeFormatters:new Map,A=je(S.__numberFormatters)?S.__numberFormatters:new Map,V=je(S.__meta)?S.__meta:{};p0++;const M={version:t,cid:p0,locale:r,fallbackLocale:l,messages:a,modifiers:d,pluralRules:u,missing:p,missingWarn:h,fallbackWarn:f,fallbackFormat:m,unresolving:g,postTranslation:y,processor:b,warnHtmlMessage:k,escapeParameter:x,messageCompiler:w,messageResolver:v,localeFallbacker:_,fallbackContext:E,onWarn:e,__meta:V};return M.datetimeFormats=i,M.numberFormats=c,M.__datetimeFormatters=I,M.__numberFormatters=A,process.env.NODE_ENV!=="production"&&(M.__v_emitter=S.__v_emitter!=null?S.__v_emitter:void 0),(process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__)&&u5(M,t,V),M}const td=n=>({[n]:Qe()});function ka(n,e){return n instanceof RegExp?n.test(e):n}function h0(n,e){return n instanceof RegExp?n.test(e):n}function nd(n,e,t,r,s){const{missing:l,onWarn:a}=n;if(process.env.NODE_ENV!=="production"){const i=n.__v_emitter;i&&i.emit("missing",{locale:t,key:e,type:s,groupId:`${s}:${e}`})}if(l!==null){const i=l(n,t,e,s);return pe(i)?i:e}else return process.env.NODE_ENV!=="production"&&h0(r,e)&&a(Gr(Yt.NOT_FOUND_KEY,{key:e,locale:t})),e}function fs(n,e,t){const r=n;r.__localeChainCache=new Map,n.localeFallbacker(n,t,e)}function f0(n,e){return n===e?!1:n.split("-")[0]===e.split("-")[0]}function I5(n,e){const t=e.indexOf(n);if(t===-1)return!1;for(let r=t+1;r<e.length;r++)if(f0(n,e[r]))return!0;return!1}const m0=typeof Intl<"u",g0={dateTimeFormat:m0&&typeof Intl.DateTimeFormat<"u",numberFormat:m0&&typeof Intl.NumberFormat<"u"};function y0(n,...e){const{datetimeFormats:t,unresolving:r,fallbackLocale:s,onWarn:l,localeFallbacker:a}=n,{__datetimeFormatters:i}=n;if(process.env.NODE_ENV!=="production"&&!g0.dateTimeFormat)return l(Gr(Yt.CANNOT_FORMAT_DATE)),ba;const[c,d,u,p]=rd(...e),h=Ue(u.missingWarn)?u.missingWarn:n.missingWarn,f=Ue(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn,m=!!u.part,g=Qc(n,u),y=a(n,s,g);if(!pe(c)||c==="")return new Intl.DateTimeFormat(g,p).format(d);let b={},k,x=null,w=g,v=null;const _="datetime format";for(let I=0;I<y.length;I++){if(k=v=y[I],process.env.NODE_ENV!=="production"&&g!==k&&ka(f,c)&&l(Gr(Yt.FALLBACK_TO_DATE_FORMAT,{key:c,target:k})),process.env.NODE_ENV!=="production"&&g!==k){const A=n.__v_emitter;A&&A.emit("fallback",{type:_,key:c,from:w,to:v,groupId:`${_}:${c}`})}if(b=t[k]||{},x=b[c],$e(x))break;nd(n,c,k,h,_),w=v}if(!$e(x)||!pe(k))return r?ya:c;let E=`${k}__${c}`;pa(p)||(E=`${E}__${JSON.stringify(p)}`);let S=i.get(E);return S||(S=new Intl.DateTimeFormat(k,xt({},x,p)),i.set(E,S)),m?S.formatToParts(d):S.format(d)}const b0=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function rd(...n){const[e,t,r,s]=n,l=Qe();let a=Qe(),i;if(pe(e)){const c=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!c)throw Xn(Pt.INVALID_ISO_DATE_ARGUMENT);const d=c[3]?c[3].trim().startsWith("T")?`${c[1].trim()}${c[3].trim()}`:`${c[1].trim()}T${c[3].trim()}`:c[1].trim();i=new Date(d);try{i.toISOString()}catch{throw Xn(Pt.INVALID_ISO_DATE_ARGUMENT)}}else if(gO(e)){if(isNaN(e.getTime()))throw Xn(Pt.INVALID_DATE_ARGUMENT);i=e}else if(kt(e))i=e;else throw Xn(Pt.INVALID_ARGUMENT);return pe(t)?l.key=t:$e(t)&&Object.keys(t).forEach(c=>{b0.includes(c)?a[c]=t[c]:l[c]=t[c]}),pe(r)?l.locale=r:$e(r)&&(a=r),$e(s)&&(a=s),[l.key||"",i,l,a]}function k0(n,e,t){const r=n;for(const s in t){const l=`${e}__${s}`;r.__datetimeFormatters.has(l)&&r.__datetimeFormatters.delete(l)}}function w0(n,...e){const{numberFormats:t,unresolving:r,fallbackLocale:s,onWarn:l,localeFallbacker:a}=n,{__numberFormatters:i}=n;if(process.env.NODE_ENV!=="production"&&!g0.numberFormat)return l(Gr(Yt.CANNOT_FORMAT_NUMBER)),ba;const[c,d,u,p]=od(...e),h=Ue(u.missingWarn)?u.missingWarn:n.missingWarn,f=Ue(u.fallbackWarn)?u.fallbackWarn:n.fallbackWarn,m=!!u.part,g=Qc(n,u),y=a(n,s,g);if(!pe(c)||c==="")return new Intl.NumberFormat(g,p).format(d);let b={},k,x=null,w=g,v=null;const _="number format";for(let I=0;I<y.length;I++){if(k=v=y[I],process.env.NODE_ENV!=="production"&&g!==k&&ka(f,c)&&l(Gr(Yt.FALLBACK_TO_NUMBER_FORMAT,{key:c,target:k})),process.env.NODE_ENV!=="production"&&g!==k){const A=n.__v_emitter;A&&A.emit("fallback",{type:_,key:c,from:w,to:v,groupId:`${_}:${c}`})}if(b=t[k]||{},x=b[c],$e(x))break;nd(n,c,k,h,_),w=v}if(!$e(x)||!pe(k))return r?ya:c;let E=`${k}__${c}`;pa(p)||(E=`${E}__${JSON.stringify(p)}`);let S=i.get(E);return S||(S=new Intl.NumberFormat(k,xt({},x,p)),i.set(E,S)),m?S.formatToParts(d):S.format(d)}const x0=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function od(...n){const[e,t,r,s]=n,l=Qe();let a=Qe();if(!kt(e))throw Xn(Pt.INVALID_ARGUMENT);const i=e;return pe(t)?l.key=t:$e(t)&&Object.keys(t).forEach(c=>{x0.includes(c)?a[c]=t[c]:l[c]=t[c]}),pe(r)?l.locale=r:$e(r)&&(a=r),$e(s)&&(a=s),[l.key||"",i,l,a]}function v0(n,e,t){const r=n;for(const s in t){const l=`${e}__${s}`;r.__numberFormatters.has(l)&&r.__numberFormatters.delete(l)}}const F5=n=>n,$5=n=>"",R5="text",P5=n=>n.length===0?"":Kc(n),z5=xO;function E0(n,e){return n=Math.abs(n),e===2?n?n>1?1:0:1:n?Math.min(n,2):0}function j5(n){const e=kt(n.pluralIndex)?n.pluralIndex:-1;return n.named&&(kt(n.named.count)||kt(n.named.n))?kt(n.named.count)?n.named.count:kt(n.named.n)?n.named.n:e:e}function H5(n,e){e.count||(e.count=n),e.n||(e.n=n)}function U5(n={}){const e=n.locale,t=j5(n),r=je(n.pluralRules)&&pe(e)&&tt(n.pluralRules[e])?n.pluralRules[e]:E0,s=je(n.pluralRules)&&pe(e)&&tt(n.pluralRules[e])?E0:void 0,l=y=>y[r(t,y.length,s)],a=n.list||[],i=y=>a[y],c=n.named||Qe();kt(n.pluralIndex)&&H5(t,c);const d=y=>c[y];function u(y,b){return(tt(n.messages)?n.messages(y,!!b):je(n.messages)?n.messages[y]:!1)||(n.parent?n.parent.message(y):$5)}const p=y=>n.modifiers?n.modifiers[y]:F5,h=$e(n.processor)&&tt(n.processor.normalize)?n.processor.normalize:P5,f=$e(n.processor)&&tt(n.processor.interpolate)?n.processor.interpolate:z5,m=$e(n.processor)&&pe(n.processor.type)?n.processor.type:R5,g={list:i,named:d,plural:l,linked:(y,...b)=>{const[k,x]=b;let w="text",v="";b.length===1?je(k)?(v=k.modifier||v,w=k.type||w):pe(k)&&(v=k||v):b.length===2&&(pe(k)&&(v=k||v),pe(x)&&(w=x||w));const _=u(y,!0)(g),E=w==="vnode"&&ut(_)&&v?_[0]:_;return v?p(v)(E,w):E},message:u,type:m,interpolate:f,normalize:h,values:xt(Qe(),a,c)};return g}const C0=()=>"",En=n=>tt(n);function _0(n,...e){const{fallbackFormat:t,postTranslation:r,unresolving:s,messageCompiler:l,fallbackLocale:a,messages:i}=n,[c,d]=sd(...e),u=Ue(d.missingWarn)?d.missingWarn:n.missingWarn,p=Ue(d.fallbackWarn)?d.fallbackWarn:n.fallbackWarn,h=Ue(d.escapeParameter)?d.escapeParameter:n.escapeParameter,f=!!d.resolvedMessage,m=pe(d.default)||Ue(d.default)?Ue(d.default)?l?c:()=>c:d.default:t?l?c:()=>c:null,g=t||m!=null&&(pe(m)||tt(m)),y=Qc(n,d);h&&W5(d);let[b,k,x]=f?[c,y,i[y]||Qe()]:S0(n,c,y,a,p,u),w=b,v=c;if(!f&&!(pe(w)||mn(w)||En(w))&&g&&(w=m,v=w),!f&&(!(pe(w)||mn(w)||En(w))||!pe(k)))return s?ya:c;if(process.env.NODE_ENV!=="production"&&pe(w)&&n.messageCompiler==null)return An(`The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return '${c}'.`),c;let _=!1;const E=()=>{_=!0},S=En(w)?w:N0(n,c,k,w,v,E);if(_)return w;const I=Y5(n,k,x,d),A=U5(I),V=K5(n,S,A);let M=r?r(V,c):V;if(h&&pe(M)&&(M=bO(M)),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const U={timestamp:Date.now(),key:pe(c)?c:En(w)?w.key:"",locale:k||(En(w)?w.locale:""),format:pe(w)?w:En(w)?w.source:"",message:M};U.meta=xt({},n.__meta,{}),p5(U)}return M}function W5(n){ut(n.list)?n.list=n.list.map(e=>pe(e)?Rm(e):e):je(n.named)&&Object.keys(n.named).forEach(e=>{pe(n.named[e])&&(n.named[e]=Rm(n.named[e]))})}function S0(n,e,t,r,s,l){const{messages:a,onWarn:i,messageResolver:c,localeFallbacker:d}=n,u=d(n,r,t);let p=Qe(),h,f=null,m=t,g=null;const y="translate";for(let b=0;b<u.length;b++){if(h=g=u[b],process.env.NODE_ENV!=="production"&&t!==h&&!f0(t,h)&&ka(s,e)&&i(Gr(Yt.FALLBACK_TO_TRANSLATE,{key:e,target:h})),process.env.NODE_ENV!=="production"&&t!==h){const v=n.__v_emitter;v&&v.emit("fallback",{type:y,key:e,from:m,to:g,groupId:`${y}:${e}`})}p=a[h]||Qe();let k=null,x,w;if(process.env.NODE_ENV!=="production"&&xn&&(k=window.performance.now(),x="intlify-message-resolve-start",w="intlify-message-resolve-end",rn&&rn(x)),(f=c(p,e))===null&&(f=p[e]),process.env.NODE_ENV!=="production"&&xn){const v=window.performance.now(),_=n.__v_emitter;_&&k&&f&&_.emit("message-resolve",{type:"message-resolve",key:e,message:f,time:v-k,groupId:`${y}:${e}`}),x&&w&&rn&&Kr&&(rn(w),Kr("intlify message resolve",x,w))}if(pe(f)||mn(f)||En(f))break;if(!I5(h,u)){const v=nd(n,e,h,l,y);v!==e&&(f=v)}m=g}return[f,h,p]}function N0(n,e,t,r,s,l){const{messageCompiler:a,warnHtmlMessage:i}=n;if(En(r)){const h=r;return h.locale=h.locale||t,h.key=h.key||e,h}if(a==null){const h=()=>r;return h.locale=t,h.key=e,h}let c=null,d,u;process.env.NODE_ENV!=="production"&&xn&&(c=window.performance.now(),d="intlify-message-compilation-start",u="intlify-message-compilation-end",rn&&rn(d));const p=a(r,q5(n,t,s,r,i,l));if(process.env.NODE_ENV!=="production"&&xn){const h=window.performance.now(),f=n.__v_emitter;f&&c&&f.emit("message-compilation",{type:"message-compilation",message:r,time:h-c,groupId:`translate:${e}`}),d&&u&&rn&&Kr&&(rn(u),Kr("intlify message compilation",d,u))}return p.locale=t,p.key=e,p.source=r,p}function K5(n,e,t){let r=null,s,l;process.env.NODE_ENV!=="production"&&xn&&(r=window.performance.now(),s="intlify-message-evaluation-start",l="intlify-message-evaluation-end",rn&&rn(s));const a=e(t);if(process.env.NODE_ENV!=="production"&&xn){const i=window.performance.now(),c=n.__v_emitter;c&&r&&c.emit("message-evaluation",{type:"message-evaluation",value:a,time:i-r,groupId:`translate:${e.key}`}),s&&l&&rn&&Kr&&(rn(l),Kr("intlify message evaluation",s,l))}return a}function sd(...n){const[e,t,r]=n,s=Qe();if(!pe(e)&&!kt(e)&&!En(e)&&!mn(e))throw Xn(Pt.INVALID_ARGUMENT);const l=kt(e)?String(e):e;return kt(t)?s.plural=t:pe(t)?s.default=t:$e(t)&&!pa(t)?s.named=t:ut(t)&&(s.list=t),kt(r)?s.plural=r:pe(r)?s.default=r:$e(r)&&xt(s,r),[l,s]}function q5(n,e,t,r,s,l){return{locale:e,key:t,warnHtmlMessage:s,onError:a=>{if(l&&l(a),process.env.NODE_ENV!=="production"){const i=G5(r),c=`Message compilation error: ${a.message}`,d=a.location&&i&&vO(i,a.location.start.offset,a.location.end.offset),u=n.__v_emitter;u&&i&&u.emit("compile-error",{message:i,error:a.message,start:a.location&&a.location.start.offset,end:a.location&&a.location.end.offset,groupId:`translate:${t}`}),console.error(d?`${c}
|
|
143
|
+
${d}`:c)}else throw a},onCacheKey:a=>fO(e,t,a)}}function G5(n){if(pe(n))return n;if(n.loc&&n.loc.source)return n.loc.source}function Y5(n,e,t,r){const{modifiers:s,pluralRules:l,messageResolver:a,fallbackLocale:i,fallbackWarn:c,missingWarn:d,fallbackContext:u}=n,p={locale:e,modifiers:s,pluralRules:l,messages:(h,f)=>{let m=a(t,h);if(m==null&&(u||f)){const[,,g]=S0(u||n,h,e,i,c,d);m=a(g,h)}if(pe(m)||mn(m)){let g=!1;const y=N0(n,h,e,m,h,()=>{g=!0});return g?C0:y}else return En(m)?m:C0}};return n.processor&&(p.processor=n.processor),r.list&&(p.list=r.list),r.named&&(p.named=r.named),kt(r.plural)&&(p.pluralIndex=r.plural),p}ZO();function J5(){return V0().__VUE_DEVTOOLS_GLOBAL_HOOK__}function V0(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const Z5=typeof Proxy=="function",X5="devtools-plugin:setup",Q5="plugin:settings:set";let ms,ld;function eI(){var n;return ms!==void 0||(typeof window<"u"&&window.performance?(ms=!0,ld=window.performance):typeof globalThis<"u"&&!((n=globalThis.perf_hooks)===null||n===void 0)&&n.performance?(ms=!0,ld=globalThis.perf_hooks.performance):ms=!1),ms}function tI(){return eI()?ld.now():Date.now()}class nI{constructor(e,t){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=t;const r={};if(e.settings)for(const a in e.settings){const i=e.settings[a];r[a]=i.defaultValue}const s=`__vue-devtools-plugin-settings__${e.id}`;let l=Object.assign({},r);try{const a=localStorage.getItem(s),i=JSON.parse(a);Object.assign(l,i)}catch{}this.fallbacks={getSettings(){return l},setSettings(a){try{localStorage.setItem(s,JSON.stringify(a))}catch{}l=a},now(){return tI()}},t&&t.on(Q5,(a,i)=>{a===this.plugin.id&&this.fallbacks.setSettings(i)}),this.proxiedOn=new Proxy({},{get:(a,i)=>this.target?this.target.on[i]:(...c)=>{this.onQueue.push({method:i,args:c})}}),this.proxiedTarget=new Proxy({},{get:(a,i)=>this.target?this.target[i]:i==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(i)?(...c)=>(this.targetQueue.push({method:i,args:c,resolve:()=>{}}),this.fallbacks[i](...c)):(...c)=>new Promise(d=>{this.targetQueue.push({method:i,args:c,resolve:d})})})}async setRealTarget(e){this.target=e;for(const t of this.onQueue)this.target.on[t.method](...t.args);for(const t of this.targetQueue)t.resolve(await this.target[t.method](...t.args))}}function rI(n,e){const t=n,r=V0(),s=J5(),l=Z5&&t.enableEarlyProxy;if(s&&(r.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!l))s.emit(X5,n,e);else{const a=l?new nI(t,s):null;(r.__VUE_DEVTOOLS_PLUGINS__=r.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:t,setupFn:e,proxy:a}),a&&e(a.proxiedTarget)}}/*!
|
|
144
|
+
* vue-i18n v11.1.12
|
|
145
|
+
* (c) 2025 kazuya kawaguchi
|
|
146
|
+
* Released under the MIT License.
|
|
147
|
+
*/const oI="11.1.12";function sI(){typeof __VUE_I18N_FULL_INSTALL__!="boolean"&&(qr().__VUE_I18N_FULL_INSTALL__=!0),typeof __VUE_I18N_LEGACY_API__!="boolean"&&(qr().__VUE_I18N_LEGACY_API__=!0),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(qr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1),typeof __INTLIFY_PROD_DEVTOOLS__!="boolean"&&(qr().__INTLIFY_PROD_DEVTOOLS__=!1)}const st={UNEXPECTED_RETURN_TYPE:f5,INVALID_ARGUMENT:25,MUST_BE_CALL_SETUP_TOP:26,NOT_INSTALLED:27,REQUIRED_VALUE:28,INVALID_VALUE:29,CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:30,NOT_INSTALLED_WITH_PROVIDE:31,UNEXPECTED_ERROR:32,NOT_COMPATIBLE_LEGACY_VUE_I18N:33,NOT_AVAILABLE_COMPOSITION_IN_LEGACY:34};function Jt(n,...e){return ko(n,null,process.env.NODE_ENV!=="production"?{messages:lI,args:e}:void 0)}const lI={[st.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[st.INVALID_ARGUMENT]:"Invalid argument",[st.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[st.NOT_INSTALLED]:"Need to install with `app.use` function",[st.UNEXPECTED_ERROR]:"Unexpected error",[st.REQUIRED_VALUE]:"Required in value: {0}",[st.INVALID_VALUE]:"Invalid value",[st.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[st.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[st.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[st.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly"},ad=Tn("__translateVNode"),id=Tn("__datetimeParts"),cd=Tn("__numberParts"),Yr=Tn("__enableEmitter"),gs=Tn("__disableEmitter"),M0=Tn("__setPluralRules"),B0=Tn("__injectWithOption"),dd=Tn("__dispose"),gn={FALLBACK_TO_ROOT:N5,NOT_FOUND_PARENT_SCOPE:9,IGNORE_OBJ_FLATTEN:10,DEPRECATE_LEGACY_MODE:11,DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE:12,DUPLICATE_USE_I18N_CALLING:13},aI={[gn.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[gn.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[gn.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[gn.DEPRECATE_LEGACY_MODE]:`Legacy API mode has been deprecated in v11. Use Composition API mode instead.
|
|
148
|
+
About how to use the Composition API mode, see https://vue-i18n.intlify.dev/guide/advanced/composition.html`,[gn.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE]:"'v-t' has been deprecated in v11. Use translate APIs ('t' or '$t') instead.",[gn.DUPLICATE_USE_I18N_CALLING]:"Duplicate `useI18n` calling by local scope. Please don't call it on local scope, due to it does not work properly in component."};function vo(n,...e){return ua(aI[n],...e)}function ys(n){if(!je(n)||mn(n))return n;for(const e in n)if(vn(n,e))if(!e.includes("."))je(n[e])&&ys(n[e]);else{const t=e.split("."),r=t.length-1;let s=n,l=!1;for(let a=0;a<r;a++){if(t[a]==="__proto__")throw new Error(`unsafe key: ${t[a]}`);if(t[a]in s||(s[t[a]]=Qe()),!je(s[t[a]])){process.env.NODE_ENV!=="production"&&An(vo(gn.IGNORE_OBJ_FLATTEN,{key:t[a]})),l=!0;break}s=s[t[a]]}if(l||(mn(s)?e0.includes(t[r])||delete n[e]:(s[t[r]]=n[e],delete n[e])),!mn(s)){const a=s[t[r]];je(a)&&ys(a)}}return n}function ud(n,e){const{messages:t,__i18n:r,messageResolver:s,flatJson:l}=e,a=$e(t)?t:ut(r)?Qe():{[n]:Qe()};if(ut(r)&&r.forEach(i=>{if("locale"in i&&"resource"in i){const{locale:c,resource:d}=i;c?(a[c]=a[c]||Qe(),fa(d,a[c])):fa(d,a)}else pe(i)&&fa(JSON.parse(i),a)}),s==null&&l)for(const i in a)vn(a,i)&&ys(a[i]);return a}function iI(n){return n.type}function A0(n,e,t){let r=je(e.messages)?e.messages:Qe();"__i18nGlobal"in t&&(r=ud(n.locale.value,{messages:r,__i18n:t.__i18nGlobal}));const s=Object.keys(r);s.length&&s.forEach(l=>{n.mergeLocaleMessage(l,r[l])});{if(je(e.datetimeFormats)){const l=Object.keys(e.datetimeFormats);l.length&&l.forEach(a=>{n.mergeDateTimeFormat(a,e.datetimeFormats[a])})}if(je(e.numberFormats)){const l=Object.keys(e.numberFormats);l.length&&l.forEach(a=>{n.mergeNumberFormat(a,e.numberFormats[a])})}}}function T0(n){return o.createVNode(o.Text,null,n,0)}const L0=()=>[],cI=()=>!1;let D0=0;function O0(n){return(e,t,r,s)=>n(t,r,o.getCurrentInstance()||void 0,s)}function pd(n={}){const{__root:e,__injectWithOption:t}=n,r=e===void 0,s=n.flatJson,l=xn?o.ref:o.shallowRef;let a=Ue(n.inheritLocale)?n.inheritLocale:!0;const i=l(e&&a?e.locale.value:pe(n.locale)?n.locale:hs),c=l(e&&a?e.fallbackLocale.value:pe(n.fallbackLocale)||ut(n.fallbackLocale)||$e(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:i.value),d=l(ud(i.value,n)),u=l($e(n.datetimeFormats)?n.datetimeFormats:{[i.value]:{}}),p=l($e(n.numberFormats)?n.numberFormats:{[i.value]:{}});let h=e?e.missingWarn:Ue(n.missingWarn)||bo(n.missingWarn)?n.missingWarn:!0,f=e?e.fallbackWarn:Ue(n.fallbackWarn)||bo(n.fallbackWarn)?n.fallbackWarn:!0,m=e?e.fallbackRoot:Ue(n.fallbackRoot)?n.fallbackRoot:!0,g=!!n.fallbackFormat,y=tt(n.missing)?n.missing:null,b=tt(n.missing)?O0(n.missing):null,k=tt(n.postTranslation)?n.postTranslation:null,x=e?e.warnHtmlMessage:Ue(n.warnHtmlMessage)?n.warnHtmlMessage:!0,w=!!n.escapeParameter;const v=e?e.modifiers:$e(n.modifiers)?n.modifiers:{};let _=n.pluralRules||e&&e.pluralRules,E;E=(()=>{r&&u0(null);const W={version:oI,locale:i.value,fallbackLocale:c.value,messages:d.value,modifiers:v,pluralRules:_,missing:b===null?void 0:b,missingWarn:h,fallbackWarn:f,fallbackFormat:g,unresolving:!0,postTranslation:k===null?void 0:k,warnHtmlMessage:x,escapeParameter:w,messageResolver:n.messageResolver,messageCompiler:n.messageCompiler,__meta:{framework:"vue"}};W.datetimeFormats=u.value,W.numberFormats=p.value,W.__datetimeFormatters=$e(E)?E.__datetimeFormatters:void 0,W.__numberFormatters=$e(E)?E.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(W.__v_emitter=$e(E)?E.__v_emitter:void 0);const X=O5(W);return r&&u0(X),X})(),fs(E,i.value,c.value);function S(){return[i.value,c.value,d.value,u.value,p.value]}const I=o.computed({get:()=>i.value,set:W=>{E.locale=W,i.value=W}}),A=o.computed({get:()=>c.value,set:W=>{E.fallbackLocale=W,c.value=W,fs(E,i.value,W)}}),V=o.computed(()=>d.value),M=o.computed(()=>u.value),U=o.computed(()=>p.value);function R(){return tt(k)?k:null}function $(W){k=W,E.postTranslation=W}function D(){return y}function P(W){W!==null&&(b=O0(W)),y=W,E.missing=b}function H(W,X){return W!=="translate"||!X.resolvedMessage}const G=(W,X,Ne,qe,lt,T)=>{S();let F;try{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(E.fallbackContext=e?D5():void 0),F=W(E)}finally{process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__,r||(E.fallbackContext=void 0)}if(Ne!=="translate exists"&&kt(F)&&F===ya||Ne==="translate exists"&&!F){const[te,ce]=X();if(process.env.NODE_ENV!=="production"&&e&&pe(te)&&H(Ne,ce)&&(m&&(ka(f,te)||h0(h,te))&&An(vo(gn.FALLBACK_TO_ROOT,{key:te,type:Ne})),process.env.NODE_ENV!=="production")){const{__v_emitter:me}=E;me&&m&&me.emit("fallback",{type:Ne,key:te,to:"global",groupId:`${Ne}:${te}`})}return e&&m?qe(e):lt(te)}else{if(T(F))return F;throw Jt(st.UNEXPECTED_RETURN_TYPE)}};function ie(...W){return G(X=>Reflect.apply(_0,null,[X,...W]),()=>sd(...W),"translate",X=>Reflect.apply(X.t,X,[...W]),X=>X,X=>pe(X))}function Ae(...W){const[X,Ne,qe]=W;if(qe&&!je(qe))throw Jt(st.INVALID_ARGUMENT);return ie(X,Ne,xt({resolvedMessage:!0},qe||{}))}function Q(...W){return G(X=>Reflect.apply(y0,null,[X,...W]),()=>rd(...W),"datetime format",X=>Reflect.apply(X.d,X,[...W]),()=>ba,X=>pe(X)||ut(X))}function Pe(...W){return G(X=>Reflect.apply(w0,null,[X,...W]),()=>od(...W),"number format",X=>Reflect.apply(X.n,X,[...W]),()=>ba,X=>pe(X)||ut(X))}function ze(W){return W.map(X=>pe(X)||kt(X)||Ue(X)?T0(String(X)):X)}const We={normalize:ze,interpolate:W=>W,type:"vnode"};function St(...W){return G(X=>{let Ne;const qe=X;try{qe.processor=We,Ne=Reflect.apply(_0,null,[qe,...W])}finally{qe.processor=null}return Ne},()=>sd(...W),"translate",X=>X[ad](...W),X=>[T0(X)],X=>ut(X))}function gt(...W){return G(X=>Reflect.apply(w0,null,[X,...W]),()=>od(...W),"number format",X=>X[cd](...W),L0,X=>pe(X)||ut(X))}function Wt(...W){return G(X=>Reflect.apply(y0,null,[X,...W]),()=>rd(...W),"datetime format",X=>X[id](...W),L0,X=>pe(X)||ut(X))}function on(W){_=W,E.pluralRules=_}function Y(W,X){return G(()=>{if(!W)return!1;const Ne=pe(X)?X:i.value,qe=fe(Ne),lt=E.messageResolver(qe,W);return mn(lt)||En(lt)||pe(lt)},()=>[W],"translate exists",Ne=>Reflect.apply(Ne.te,Ne,[W,X]),cI,Ne=>Ue(Ne))}function re(W){let X=null;const Ne=r0(E,c.value,i.value);for(let qe=0;qe<Ne.length;qe++){const lt=d.value[Ne[qe]]||{},T=E.messageResolver(lt,W);if(T!=null){X=T;break}}return X}function ae(W){return re(W)??(e?e.tm(W)||{}:{})}function fe(W){return d.value[W]||{}}function be(W,X){if(s){const Ne={[W]:X};for(const qe in Ne)vn(Ne,qe)&&ys(Ne[qe]);X=Ne[W]}d.value[W]=X,E.messages=d.value}function Oe(W,X){d.value[W]=d.value[W]||{};const Ne={[W]:X};if(s)for(const qe in Ne)vn(Ne,qe)&&ys(Ne[qe]);X=Ne[W],fa(X,d.value[W]),E.messages=d.value}function He(W){return u.value[W]||{}}function Ke(W,X){u.value[W]=X,E.datetimeFormats=u.value,k0(E,W,X)}function B(W,X){u.value[W]=xt(u.value[W]||{},X),E.datetimeFormats=u.value,k0(E,W,X)}function O(W){return p.value[W]||{}}function Z(W,X){p.value[W]=X,E.numberFormats=p.value,v0(E,W,X)}function he(W,X){p.value[W]=xt(p.value[W]||{},X),E.numberFormats=p.value,v0(E,W,X)}D0++,e&&xn&&(o.watch(e.locale,W=>{a&&(i.value=W,E.locale=W,fs(E,i.value,c.value))}),o.watch(e.fallbackLocale,W=>{a&&(c.value=W,E.fallbackLocale=W,fs(E,i.value,c.value))}));const ve={id:D0,locale:I,fallbackLocale:A,get inheritLocale(){return a},set inheritLocale(W){a=W,W&&e&&(i.value=e.locale.value,c.value=e.fallbackLocale.value,fs(E,i.value,c.value))},get availableLocales(){return Object.keys(d.value).sort()},messages:V,get modifiers(){return v},get pluralRules(){return _||{}},get isGlobal(){return r},get missingWarn(){return h},set missingWarn(W){h=W,E.missingWarn=h},get fallbackWarn(){return f},set fallbackWarn(W){f=W,E.fallbackWarn=f},get fallbackRoot(){return m},set fallbackRoot(W){m=W},get fallbackFormat(){return g},set fallbackFormat(W){g=W,E.fallbackFormat=g},get warnHtmlMessage(){return x},set warnHtmlMessage(W){x=W,E.warnHtmlMessage=W},get escapeParameter(){return w},set escapeParameter(W){w=W,E.escapeParameter=W},t:ie,getLocaleMessage:fe,setLocaleMessage:be,mergeLocaleMessage:Oe,getPostTranslationHandler:R,setPostTranslationHandler:$,getMissingHandler:D,setMissingHandler:P,[M0]:on};return ve.datetimeFormats=M,ve.numberFormats=U,ve.rt=Ae,ve.te=Y,ve.tm=ae,ve.d=Q,ve.n=Pe,ve.getDateTimeFormat=He,ve.setDateTimeFormat=Ke,ve.mergeDateTimeFormat=B,ve.getNumberFormat=O,ve.setNumberFormat=Z,ve.mergeNumberFormat=he,ve[B0]=t,ve[ad]=St,ve[id]=Wt,ve[cd]=gt,process.env.NODE_ENV!=="production"&&(ve[Yr]=W=>{E.__v_emitter=W},ve[gs]=()=>{E.__v_emitter=void 0}),ve}const I0="vue-i18n: composer properties",hd={"vue-devtools-plugin-vue-i18n":"Vue I18n DevTools","vue-i18n-resource-inspector":"Vue I18n DevTools","vue-i18n-timeline":"Vue I18n"},dI={"vue-i18n-resource-inspector":"Search for scopes ..."},uI={"vue-i18n-timeline":16764185};let fd;async function pI(n,e){return new Promise((t,r)=>{try{rI({id:"vue-devtools-plugin-vue-i18n",label:hd["vue-devtools-plugin-vue-i18n"],packageName:"vue-i18n",homepage:"https://vue-i18n.intlify.dev",logo:"https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png",componentStateTypes:[I0],app:n},s=>{fd=s,s.on.visitComponentTree(({componentInstance:a,treeNode:i})=>{hI(a,i,e)}),s.on.inspectComponent(({componentInstance:a,instanceData:i})=>{a.vnode.el&&a.vnode.el.__VUE_I18N__&&i&&(e.mode==="legacy"?a.vnode.el.__VUE_I18N__!==e.global.__composer&&$0(i,a.vnode.el.__VUE_I18N__):$0(i,a.vnode.el.__VUE_I18N__))}),s.addInspector({id:"vue-i18n-resource-inspector",label:hd["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:dI["vue-i18n-resource-inspector"]}),s.on.getInspectorTree(a=>{a.app===n&&a.inspectorId==="vue-i18n-resource-inspector"&&bI(a,e)});const l=new Map;s.on.getInspectorState(async a=>{if(a.app===n&&a.inspectorId==="vue-i18n-resource-inspector")if(s.unhighlightElement(),wI(a,e),a.nodeId==="global"){if(!l.has(a.app)){const[i]=await s.getComponentInstances(a.app);l.set(a.app,i)}s.highlightElement(l.get(a.app))}else{const i=kI(a.nodeId,e);i&&s.highlightElement(i)}}),s.on.editInspectorState(a=>{a.app===n&&a.inspectorId==="vue-i18n-resource-inspector"&&vI(a,e)}),s.addTimelineLayer({id:"vue-i18n-timeline",label:hd["vue-i18n-timeline"],color:uI["vue-i18n-timeline"]}),t(!0)})}catch(s){console.error(s),r(!1)}})}function F0(n){return n.type.name||n.type.displayName||n.type.__file||"Anonymous"}function hI(n,e,t){const r=t.mode==="composition"?t.global:t.global.__composer;if(n&&n.vnode.el&&n.vnode.el.__VUE_I18N__&&n.vnode.el.__VUE_I18N__!==r){const s={label:`i18n (${F0(n)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(s)}}function $0(n,e){const t=I0;n.state.push({type:t,key:"locale",editable:!0,value:e.locale.value}),n.state.push({type:t,key:"availableLocales",editable:!1,value:e.availableLocales}),n.state.push({type:t,key:"fallbackLocale",editable:!0,value:e.fallbackLocale.value}),n.state.push({type:t,key:"inheritLocale",editable:!0,value:e.inheritLocale}),n.state.push({type:t,key:"messages",editable:!1,value:md(e.messages.value)}),n.state.push({type:t,key:"datetimeFormats",editable:!1,value:e.datetimeFormats.value}),n.state.push({type:t,key:"numberFormats",editable:!1,value:e.numberFormats.value})}function md(n){const e={};return Object.keys(n).forEach(t=>{const r=n[t];tt(r)&&"source"in r?e[t]=yI(r):mn(r)&&r.loc&&r.loc.source?e[t]=r.loc.source:je(r)?e[t]=md(r):e[t]=r}),e}const fI={"<":"<",">":">",'"':""","&":"&"};function mI(n){return n.replace(/[<>"&]/g,gI)}function gI(n){return fI[n]||n}function yI(n){return{_custom:{type:"function",display:`<span>ƒ</span> ${n.source?`("${mI(n.source)}")`:"(?)"}`}}}function bI(n,e){n.rootNodes.push({id:"global",label:"Global Scope"});const t=e.mode==="composition"?e.global:e.global.__composer;for(const[r,s]of e.__instances){const l=e.mode==="composition"?s:s.__composer;t!==l&&n.rootNodes.push({id:l.id.toString(),label:`${F0(r)} Scope`})}}function kI(n,e){let t=null;if(n!=="global"){for(const[r,s]of e.__instances.entries())if(s.id.toString()===n){t=r;break}}return t}function R0(n,e){if(n==="global")return e.mode==="composition"?e.global:e.global.__composer;{const t=Array.from(e.__instances.values()).find(r=>r.id.toString()===n);return t?e.mode==="composition"?t:t.__composer:null}}function wI(n,e){const t=R0(n.nodeId,e);return t&&(n.state=xI(t)),null}function xI(n){const e={},t="Locale related info",r=[{type:t,key:"locale",editable:!0,value:n.locale.value},{type:t,key:"fallbackLocale",editable:!0,value:n.fallbackLocale.value},{type:t,key:"availableLocales",editable:!1,value:n.availableLocales},{type:t,key:"inheritLocale",editable:!0,value:n.inheritLocale}];e[t]=r;const s="Locale messages info",l=[{type:s,key:"messages",editable:!1,value:md(n.messages.value)}];e[s]=l;{const a="Datetime formats info",i=[{type:a,key:"datetimeFormats",editable:!1,value:n.datetimeFormats.value}];e[a]=i;const c="Datetime formats info",d=[{type:c,key:"numberFormats",editable:!1,value:n.numberFormats.value}];e[c]=d}return e}function bs(n,e){if(fd){let t;e&&"groupId"in e&&(t=e.groupId,delete e.groupId),fd.addTimelineEvent({layerId:"vue-i18n-timeline",event:{title:n,groupId:t,time:Date.now(),meta:{},data:e||{},logType:n==="compile-error"?"error":n==="fallback"||n==="missing"?"warning":"default"}})}}function vI(n,e){const t=R0(n.nodeId,e);if(t){const[r]=n.path;r==="locale"&&pe(n.state.value)?t.locale.value=n.state.value:r==="fallbackLocale"&&(pe(n.state.value)||ut(n.state.value)||je(n.state.value))?t.fallbackLocale.value=n.state.value:r==="inheritLocale"&&Ue(n.state.value)&&(t.inheritLocale=n.state.value)}}function EI(n){const e=pe(n.locale)?n.locale:hs,t=pe(n.fallbackLocale)||ut(n.fallbackLocale)||$e(n.fallbackLocale)||n.fallbackLocale===!1?n.fallbackLocale:e,r=tt(n.missing)?n.missing:void 0,s=Ue(n.silentTranslationWarn)||bo(n.silentTranslationWarn)?!n.silentTranslationWarn:!0,l=Ue(n.silentFallbackWarn)||bo(n.silentFallbackWarn)?!n.silentFallbackWarn:!0,a=Ue(n.fallbackRoot)?n.fallbackRoot:!0,i=!!n.formatFallbackMessages,c=$e(n.modifiers)?n.modifiers:{},d=n.pluralizationRules,u=tt(n.postTranslation)?n.postTranslation:void 0,p=pe(n.warnHtmlInMessage)?n.warnHtmlInMessage!=="off":!0,h=!!n.escapeParameterHtml,f=Ue(n.sync)?n.sync:!0;let m=n.messages;if($e(n.sharedMessages)){const v=n.sharedMessages;m=Object.keys(v).reduce((_,E)=>{const S=_[E]||(_[E]={});return xt(S,v[E]),_},m||{})}const{__i18n:g,__root:y,__injectWithOption:b}=n,k=n.datetimeFormats,x=n.numberFormats,w=n.flatJson;return{locale:e,fallbackLocale:t,messages:m,flatJson:w,datetimeFormats:k,numberFormats:x,missing:r,missingWarn:s,fallbackWarn:l,fallbackRoot:a,fallbackFormat:i,modifiers:c,pluralRules:d,postTranslation:u,warnHtmlMessage:p,escapeParameter:h,messageResolver:n.messageResolver,inheritLocale:f,__i18n:g,__root:y,__injectWithOption:b}}function gd(n={}){const e=pd(EI(n)),{__extender:t}=n,r={id:e.id,get locale(){return e.locale.value},set locale(s){e.locale.value=s},get fallbackLocale(){return e.fallbackLocale.value},set fallbackLocale(s){e.fallbackLocale.value=s},get messages(){return e.messages.value},get datetimeFormats(){return e.datetimeFormats.value},get numberFormats(){return e.numberFormats.value},get availableLocales(){return e.availableLocales},get missing(){return e.getMissingHandler()},set missing(s){e.setMissingHandler(s)},get silentTranslationWarn(){return Ue(e.missingWarn)?!e.missingWarn:e.missingWarn},set silentTranslationWarn(s){e.missingWarn=Ue(s)?!s:s},get silentFallbackWarn(){return Ue(e.fallbackWarn)?!e.fallbackWarn:e.fallbackWarn},set silentFallbackWarn(s){e.fallbackWarn=Ue(s)?!s:s},get modifiers(){return e.modifiers},get formatFallbackMessages(){return e.fallbackFormat},set formatFallbackMessages(s){e.fallbackFormat=s},get postTranslation(){return e.getPostTranslationHandler()},set postTranslation(s){e.setPostTranslationHandler(s)},get sync(){return e.inheritLocale},set sync(s){e.inheritLocale=s},get warnHtmlInMessage(){return e.warnHtmlMessage?"warn":"off"},set warnHtmlInMessage(s){e.warnHtmlMessage=s!=="off"},get escapeParameterHtml(){return e.escapeParameter},set escapeParameterHtml(s){e.escapeParameter=s},get pluralizationRules(){return e.pluralRules||{}},__composer:e,t(...s){return Reflect.apply(e.t,e,[...s])},rt(...s){return Reflect.apply(e.rt,e,[...s])},te(s,l){return e.te(s,l)},tm(s){return e.tm(s)},getLocaleMessage(s){return e.getLocaleMessage(s)},setLocaleMessage(s,l){e.setLocaleMessage(s,l)},mergeLocaleMessage(s,l){e.mergeLocaleMessage(s,l)},d(...s){return Reflect.apply(e.d,e,[...s])},getDateTimeFormat(s){return e.getDateTimeFormat(s)},setDateTimeFormat(s,l){e.setDateTimeFormat(s,l)},mergeDateTimeFormat(s,l){e.mergeDateTimeFormat(s,l)},n(...s){return Reflect.apply(e.n,e,[...s])},getNumberFormat(s){return e.getNumberFormat(s)},setNumberFormat(s,l){e.setNumberFormat(s,l)},mergeNumberFormat(s,l){e.mergeNumberFormat(s,l)}};return r.__extender=t,process.env.NODE_ENV!=="production"&&(r.__enableEmitter=s=>{const l=e;l[Yr]&&l[Yr](s)},r.__disableEmitter=()=>{const s=e;s[gs]&&s[gs]()}),r}function CI(n,e,t){return{beforeCreate(){const r=o.getCurrentInstance();if(!r)throw Jt(st.UNEXPECTED_ERROR);const s=this.$options;if(s.i18n){const l=s.i18n;if(s.__i18n&&(l.__i18n=s.__i18n),l.__root=e,this===this.$root)this.$i18n=P0(n,l);else{l.__injectWithOption=!0,l.__extender=t.__vueI18nExtend,this.$i18n=gd(l);const a=this.$i18n;a.__extender&&(a.__disposer=a.__extender(this.$i18n))}}else if(s.__i18n)if(this===this.$root)this.$i18n=P0(n,s);else{this.$i18n=gd({__i18n:s.__i18n,__injectWithOption:!0,__extender:t.__vueI18nExtend,__root:e});const l=this.$i18n;l.__extender&&(l.__disposer=l.__extender(this.$i18n))}else this.$i18n=n;s.__i18nGlobal&&A0(e,s,s),this.$t=(...l)=>this.$i18n.t(...l),this.$rt=(...l)=>this.$i18n.rt(...l),this.$te=(l,a)=>this.$i18n.te(l,a),this.$d=(...l)=>this.$i18n.d(...l),this.$n=(...l)=>this.$i18n.n(...l),this.$tm=l=>this.$i18n.tm(l),t.__setInstance(r,this.$i18n)},mounted(){if(process.env.NODE_ENV!=="production"&&this.$el&&this.$i18n){const r=this.$i18n;this.$el.__VUE_I18N__=r.__composer;const s=this.__v_emitter=qc();r.__enableEmitter&&r.__enableEmitter(s),s.on("*",bs)}},unmounted(){const r=o.getCurrentInstance();if(!r)throw Jt(st.UNEXPECTED_ERROR);const s=this.$i18n;process.env.NODE_ENV!=="production"&&this.$el&&this.$el.__VUE_I18N__&&(this.__v_emitter&&(this.__v_emitter.off("*",bs),delete this.__v_emitter),this.$i18n&&(s.__disableEmitter&&s.__disableEmitter(),delete this.$el.__VUE_I18N__)),delete this.$t,delete this.$rt,delete this.$te,delete this.$d,delete this.$n,delete this.$tm,s.__disposer&&(s.__disposer(),delete s.__disposer,delete s.__extender),t.__deleteInstance(r),delete this.$i18n}}}function P0(n,e){n.locale=e.locale||n.locale,n.fallbackLocale=e.fallbackLocale||n.fallbackLocale,n.missing=e.missing||n.missing,n.silentTranslationWarn=e.silentTranslationWarn||n.silentFallbackWarn,n.silentFallbackWarn=e.silentFallbackWarn||n.silentFallbackWarn,n.formatFallbackMessages=e.formatFallbackMessages||n.formatFallbackMessages,n.postTranslation=e.postTranslation||n.postTranslation,n.warnHtmlInMessage=e.warnHtmlInMessage||n.warnHtmlInMessage,n.escapeParameterHtml=e.escapeParameterHtml||n.escapeParameterHtml,n.sync=e.sync||n.sync,n.__composer[M0](e.pluralizationRules||n.pluralizationRules);const t=ud(n.locale,{messages:e.messages,__i18n:e.__i18n});return Object.keys(t).forEach(r=>n.mergeLocaleMessage(r,t[r])),e.datetimeFormats&&Object.keys(e.datetimeFormats).forEach(r=>n.mergeDateTimeFormat(r,e.datetimeFormats[r])),e.numberFormats&&Object.keys(e.numberFormats).forEach(r=>n.mergeNumberFormat(r,e.numberFormats[r])),n}const yd={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:n=>n==="parent"||n==="global",default:"parent"},i18n:{type:Object}};function _I({slots:n},e){return e.length===1&&e[0]==="default"?(n.default?n.default():[]).reduce((t,r)=>[...t,...r.type===o.Fragment?r.children:[r]],[]):e.reduce((t,r)=>{const s=n[r];return s&&(t[r]=s()),t},Qe())}function z0(){return o.Fragment}const SI=o.defineComponent({name:"i18n-t",props:xt({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:n=>kt(n)||!isNaN(n)}},yd),setup(n,e){const{slots:t,attrs:r}=e,s=n.i18n||bd({useScope:n.scope,__useComponent:!0});return()=>{const l=Object.keys(t).filter(p=>p[0]!=="_"),a=Qe();n.locale&&(a.locale=n.locale),n.plural!==void 0&&(a.plural=pe(n.plural)?+n.plural:n.plural);const i=_I(e,l),c=s[ad](n.keypath,i,a),d=xt(Qe(),r),u=pe(n.tag)||je(n.tag)?n.tag:z0();return o.h(u,d,c)}}}),j0=SI;function NI(n){return ut(n)&&!pe(n[0])}function H0(n,e,t,r){const{slots:s,attrs:l}=e;return()=>{const a={part:!0};let i=Qe();n.locale&&(a.locale=n.locale),pe(n.format)?a.key=n.format:je(n.format)&&(pe(n.format.key)&&(a.key=n.format.key),i=Object.keys(n.format).reduce((h,f)=>t.includes(f)?xt(Qe(),h,{[f]:n.format[f]}):h,Qe()));const c=r(n.value,a,i);let d=[a.key];ut(c)?d=c.map((h,f)=>{const m=s[h.type],g=m?m({[h.type]:h.value,index:f,parts:c}):[h.value];return NI(g)&&(g[0].key=`${h.type}-${f}`),g}):pe(c)&&(d=[c]);const u=xt(Qe(),l),p=pe(n.tag)||je(n.tag)?n.tag:z0();return o.h(p,u,d)}}const VI=o.defineComponent({name:"i18n-n",props:xt({value:{type:Number,required:!0},format:{type:[String,Object]}},yd),setup(n,e){const t=n.i18n||bd({useScope:n.scope,__useComponent:!0});return H0(n,e,x0,(...r)=>t[cd](...r))}}),U0=VI;function MI(n,e){const t=n;if(n.mode==="composition")return t.__getInstance(e)||n.global;{const r=t.__getInstance(e);return r!=null?r.__composer:n.global.__composer}}function BI(n){const e=t=>{process.env.NODE_ENV!=="production"&&Uc(vo(gn.DEPRECATE_TRANSLATE_CUSTOME_DIRECTIVE));const{instance:r,value:s}=t;if(!r||!r.$)throw Jt(st.UNEXPECTED_ERROR);const l=MI(n,r.$),a=W0(s);return[Reflect.apply(l.t,l,[...K0(a)]),l]};return{created:(t,r)=>{const[s,l]=e(r);xn&&n.global===l&&(t.__i18nWatcher=o.watch(l.locale,()=>{r.instance&&r.instance.$forceUpdate()})),t.__composer=l,t.textContent=s},unmounted:t=>{xn&&t.__i18nWatcher&&(t.__i18nWatcher(),t.__i18nWatcher=void 0,delete t.__i18nWatcher),t.__composer&&(t.__composer=void 0,delete t.__composer)},beforeUpdate:(t,{value:r})=>{if(t.__composer){const s=t.__composer,l=W0(r);t.textContent=Reflect.apply(s.t,s,[...K0(l)])}},getSSRProps:t=>{const[r]=e(t);return{textContent:r}}}}function W0(n){if(pe(n))return{path:n};if($e(n)){if(!("path"in n))throw Jt(st.REQUIRED_VALUE,"path");return n}else throw Jt(st.INVALID_VALUE)}function K0(n){const{path:e,locale:t,args:r,choice:s,plural:l}=n,a={},i=r||{};return pe(t)&&(a.locale=t),kt(s)&&(a.plural=s),kt(l)&&(a.plural=l),[e,i,a]}function AI(n,e,...t){const r=$e(t[0])?t[0]:{};(!Ue(r.globalInstall)||r.globalInstall)&&([j0.name,"I18nT"].forEach(s=>n.component(s,j0)),[U0.name,"I18nN"].forEach(s=>n.component(s,U0)),[G0.name,"I18nD"].forEach(s=>n.component(s,G0))),n.directive("t",BI(e))}const TI=Tn("global-vue-i18n");function LI(n={}){const e=__VUE_I18N_LEGACY_API__&&Ue(n.legacy)?n.legacy:__VUE_I18N_LEGACY_API__;process.env.NODE_ENV!=="production"&&e&&Uc(vo(gn.DEPRECATE_LEGACY_MODE));const t=Ue(n.globalInjection)?n.globalInjection:!0,r=new Map,[s,l]=DI(n,e),a=Tn(process.env.NODE_ENV!=="production"?"vue-i18n":"");function i(p){return r.get(p)||null}function c(p,h){r.set(p,h)}function d(p){r.delete(p)}const u={get mode(){return __VUE_I18N_LEGACY_API__&&e?"legacy":"composition"},async install(p,...h){if(process.env.NODE_ENV!=="production"&&(p.__VUE_I18N__=u),p.__VUE_I18N_SYMBOL__=a,p.provide(p.__VUE_I18N_SYMBOL__,u),$e(h[0])){const g=h[0];u.__composerExtend=g.__composerExtend,u.__vueI18nExtend=g.__vueI18nExtend}let f=null;!e&&t&&(f=jI(p,u.global)),__VUE_I18N_FULL_INSTALL__&&AI(p,u,...h),__VUE_I18N_LEGACY_API__&&e&&p.mixin(CI(l,l.__composer,u));const m=p.unmount;if(p.unmount=()=>{f&&f(),u.dispose(),m()},process.env.NODE_ENV!=="production"){if(!await pI(p,u))throw Jt(st.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const g=qc();if(e){const y=l;y.__enableEmitter&&y.__enableEmitter(g)}else{const y=l;y[Yr]&&y[Yr](g)}g.on("*",bs)}},get global(){return l},dispose(){s.stop()},__instances:r,__getInstance:i,__setInstance:c,__deleteInstance:d};return u}function bd(n={}){const e=o.getCurrentInstance();if(e==null)throw Jt(st.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw Jt(st.NOT_INSTALLED);const t=OI(e),r=FI(t),s=iI(e),l=II(n,s);if(l==="global")return A0(r,n,s),r;if(l==="parent"){let c=$I(t,e,n.__useComponent);return c==null&&(process.env.NODE_ENV!=="production"&&An(vo(gn.NOT_FOUND_PARENT_SCOPE)),c=r),c}const a=t;let i=a.__getInstance(e);if(i==null){const c=xt({},n);"__i18n"in s&&(c.__i18n=s.__i18n),r&&(c.__root=r),i=pd(c),a.__composerExtend&&(i[dd]=a.__composerExtend(i)),PI(a,e,i),a.__setInstance(e,i)}else process.env.NODE_ENV!=="production"&&l==="local"&&An(vo(gn.DUPLICATE_USE_I18N_CALLING));return i}function DI(n,e){const t=o.effectScope(),r=__VUE_I18N_LEGACY_API__&&e?t.run(()=>gd(n)):t.run(()=>pd(n));if(r==null)throw Jt(st.UNEXPECTED_ERROR);return[t,r]}function OI(n){const e=o.inject(n.isCE?TI:n.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw Jt(n.isCE?st.NOT_INSTALLED_WITH_PROVIDE:st.UNEXPECTED_ERROR);return e}function II(n,e){return pa(n)?"__i18n"in e?"local":"global":n.useScope?n.useScope:"local"}function FI(n){return n.mode==="composition"?n.global:n.global.__composer}function $I(n,e,t=!1){let r=null;const s=e.root;let l=RI(e,t);for(;l!=null;){const a=n;if(n.mode==="composition")r=a.__getInstance(l);else if(__VUE_I18N_LEGACY_API__){const i=a.__getInstance(l);i!=null&&(r=i.__composer,t&&r&&!r[B0]&&(r=null))}if(r!=null||s===l)break;l=l.parent}return r}function RI(n,e=!1){return n==null?null:e&&n.vnode.ctx||n.parent}function PI(n,e,t){let r=null;o.onMounted(()=>{if(process.env.NODE_ENV!=="production"&&e.vnode.el){e.vnode.el.__VUE_I18N__=t,r=qc();const s=t;s[Yr]&&s[Yr](r),r.on("*",bs)}},e),o.onUnmounted(()=>{const s=t;process.env.NODE_ENV!=="production"&&e.vnode.el&&e.vnode.el.__VUE_I18N__&&(r&&r.off("*",bs),s[gs]&&s[gs](),delete e.vnode.el.__VUE_I18N__),n.__deleteInstance(e);const l=s[dd];l&&(l(),delete s[dd])},e)}const zI=["locale","fallbackLocale","availableLocales"],q0=["t","rt","d","n","tm","te"];function jI(n,e){const t=Object.create(null);return zI.forEach(r=>{const s=Object.getOwnPropertyDescriptor(e,r);if(!s)throw Jt(st.UNEXPECTED_ERROR);const l=o.isRef(s.value)?{get(){return s.value.value},set(a){s.value.value=a}}:{get(){return s.get&&s.get()}};Object.defineProperty(t,r,l)}),n.config.globalProperties.$i18n=t,q0.forEach(r=>{const s=Object.getOwnPropertyDescriptor(e,r);if(!s||!s.value)throw Jt(st.UNEXPECTED_ERROR);Object.defineProperty(n.config.globalProperties,`$${r}`,s)}),()=>{delete n.config.globalProperties.$i18n,q0.forEach(r=>{delete n.config.globalProperties[`$${r}`]})}}const HI=o.defineComponent({name:"i18n-d",props:xt({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},yd),setup(n,e){const t=n.i18n||bd({useScope:n.scope,__useComponent:!0});return H0(n,e,b0,(...r)=>t[id](...r))}}),G0=HI;if(sI(),A5(c5),T5(S5),L5(r0),process.env.NODE_ENV!=="production"||__INTLIFY_PROD_DEVTOOLS__){const n=qr();n.__INTLIFY__=!0,d5(n.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const UI={},WI={},KI="Paragraph",qI="Heading 1",GI="Heading 2",YI="Heading 3",JI="Heading 4",ZI="Heading 5",XI="Heading 6",QI="Create Table",eF="Add Column",tF="Add Row",nF="Delete Column",rF="Delete Row",oF="Delete Table",sF="Enter Link",lF="Create",aF="Cancel",iF={paragraph:KI,heading1:qI,heading2:GI,heading3:YI,heading4:JI,heading5:ZI,heading6:XI,createTable:QI,addColumn:eF,addRow:tF,deleteColumn:nF,deleteRow:rF,deleteTable:oF,linkTitle:sF,create:lF,cancel:aF},cF="Звичайний текст",dF="Заголовок 1",uF="Заголовок 2",pF="Заголовок 3",hF="Заголовок 4",fF="Заголовок 5",mF="Заголовок 6",gF="Створити таблицю",yF="Додати колонку",bF="Додати рядок",kF="Видалити колонку",wF="Видалити рядок",xF="Видалити таблицю",vF="Додати посилання",EF="Посилання",CF="Введіть URL",_F="Редагувати посилання",SF="Відкрити посилання",NF="Видалити посилання",VF="Відкривати в новій вкладці",MF="Створити",BF="Оновити",AF="Скасувати",TF={paragraph:cF,heading1:dF,heading2:uF,heading3:pF,heading4:hF,heading5:fF,heading6:mF,createTable:gF,addColumn:yF,addRow:bF,deleteColumn:kF,deleteRow:wF,deleteTable:xF,linkTitle:vF,link:EF,linkUrl:CF,editLink:_F,openLink:SF,removeLink:NF,openInNewTab:VF,create:MF,update:BF,cancel:AF};LI({legacy:!1,locale:"uk",fallbackLocale:"en",messages:{en:{...UI,tiptap:iF},uk:{...WI,tiptap:TF}}});const Y0=o.defineComponent({__name:"vs-input-richtext",props:o.mergeModels({style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},richtextProps:{default:()=>({})}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,{inputClass:t}=Ot(e.style),r=o.useModel(n,"modelValue"),s=o.computed(()=>!!e.disabled),l=o.computed(()=>e.placeholder??""),a=o.computed(()=>({height:"300px",...e.richtextProps}));return(i,c)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["richtext-wrapper !h-full !border-transparent",[i.customClass,o.unref(t),{"richtext-disabled":s.value}]]),style:o.normalizeStyle(s.value?{pointerEvents:"none",opacity:.6}:{})},[o.createVNode(o.unref(pO),o.mergeProps({modelValue:r.value,"onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d),placeholder:l.value},a.value),null,16,["modelValue","placeholder"])],6))}}),LF={},DF={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 OF(n,e){return o.openBlock(),o.createElementBlock("svg",DF,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),o.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const IF=Ve(LF,[["render",OF]]),FF={},$F={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 RF(n,e){return o.openBlock(),o.createElementBlock("svg",$F,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),o.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),o.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const PF=Ve(FF,[["render",RF]]),zF={},jF={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 HF(n,e){return o.openBlock(),o.createElementBlock("svg",jF,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),o.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),o.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const UF=Ve(zF,[["render",HF]]),WF={},KF={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 qF(n,e){return o.openBlock(),o.createElementBlock("svg",KF,e[0]||(e[0]=[o.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 J0=Ve(WF,[["render",qF]]),GF={},YF={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function JF(n,e){return o.openBlock(),o.createElementBlock("svg",YF,e[0]||(e[0]=[o.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 ZF=Ve(GF,[["render",JF]]),XF={},QF={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 e6(n,e){return o.openBlock(),o.createElementBlock("svg",QF,e[0]||(e[0]=[o.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 t6=Ve(XF,[["render",e6]]),n6={class:"bg-white rounded-lg shadow-sm border border-gray-200 overflow-hidden flex flex-col"},r6={class:"flex flex-col gap-2 !p-4 border-b border-gray-200 sm:flex-row sm:items-center sm:justify-between bg-gray-50"},o6={class:"relative w-full"},s6={class:"flex flex-wrap items-center justify-end gap-2 w-full"},l6={class:"w-full overflow-x-auto"},a6={class:"w-full min-w-[640px] divide-y divide-gray-200"},i6={class:"bg-gray-50"},c6={class:"border-b border-gray-200"},d6={class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 w-12 text-center"},u6=["onClick"],p6={key:0,class:"text-gray-400"},h6={key:0,colspan:"100%",class:"text-center"},f6={class:"w-full"},m6={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},g6=["onDragstart","onDragover","onDrop"],y6={class:"px-4 py-3 text-center align-middle"},b6={class:"flex items-center justify-center"},k6=["innerHTML"],w6={key:0,class:"flex items-center gap-3 text-sm text-gray-700"},x6={key:0},v6=["src"],E6={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},C6={key:1,class:"flex items-center justify-center"},_6={key:2,class:"text-sm font-medium text-gray-900"},S6={class:"px-4 py-3 text-right"},N6={class:"flex items-center justify-end gap-2"},V6=["onClick"],M6=["onClick"],B6={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},Z0=o.defineComponent({__name:"vs-input-datatable",props:o.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=o.useSlots(),r=o.useModel(n,"modelValue"),s=o.ref({}),l=o.ref(""),a=o.ref(null),i=o.ref("asc"),c=o.computed(()=>{const Y=r.value??[],re=l.value?Y.filter(be=>e.colModel?.some(Oe=>{const He=Oe.key||Oe.name;if(!He)return!1;const Ke=be[He];return Ke?Array.isArray(Ke)?Ke.join(", ").toLowerCase().includes(l.value.toLowerCase()):String(Ke).toLowerCase().includes(l.value.toLowerCase()):!1})):Y;if(!a.value)return re;const ae=a.value,fe=[...re].sort((be,Oe)=>{const He=ie(be?.[ae]),Ke=ie(Oe?.[ae]);return typeof He=="number"&&typeof Ke=="number"?He-Ke:String(He).localeCompare(String(Ke))});return i.value==="asc"?fe:fe.reverse()}),d=o.ref(null),u=o.ref(null),p=o.ref(null),h=Y=>{d.value=Y},f=Y=>{u.value=Y},m=Y=>{if(d.value===null||d.value===Y){d.value=null,u.value=null;return}const re=[...r.value],[ae]=re.splice(d.value,1);re.splice(Y,0,ae),r.value=re,d.value=null,u.value=null},g=()=>{p.value&&p.value.click()},y=Y=>{const re=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],ae=Y.toLowerCase();return re.some(fe=>ae.endsWith(fe))},b=Y=>{const ae=Y.target.files?.[0];if(!ae)return;const fe=new FileReader;fe.onload=be=>{try{const Oe=be.target?.result;if(typeof Oe=="string"){const He=JSON.parse(Oe);Array.isArray(He)&&r.value.push(...He)}}catch(Oe){console.error("Error parsing file:",Oe)}},fe.readAsText(ae)},k=()=>{const Y=JSON.stringify(r.value,null,2),re=new Blob([Y],{type:"application/json"}),ae=URL.createObjectURL(re),fe=document.createElement("a");fe.href=ae,fe.download="data.json",fe.click(),URL.revokeObjectURL(ae)},x=new Set(["autocomplete","select","radio","checkbox","combobox"]),w=new Map,v=(Y,re)=>{const ae=`/api/suggest/${Y}`,fe=ae.includes("?")?"&":"?",be=re?`&val=${re}`:"";return`${ae}${fe}json=1${be}`},_=Y=>Y==null||Y===""?null:typeof Y=="object"?Y?.id!==void 0&&Y.id!==null&&Y.id!==""?Y.id:null:Y,E=Y=>{const re=new Set;return Array.isArray(r.value)&&r.value.forEach(ae=>{const fe=ae?.[Y];if(fe==null||fe==="")return;if(Array.isArray(fe)){fe.forEach(Oe=>{const He=_(Oe);He!==null&&re.add(He)});return}const be=_(fe);be!==null&&re.add(be)}),re},S=async()=>{if(!e.colModel?.length)return;const Y=e.colModel.filter(re=>re.data&&x.has(re.type?.toLowerCase()||""));Y.length&&await Promise.all(Y.map(async re=>{const ae=re.key||re.name;if(!ae)return;const fe=E(ae),be=Array.from(fe).map(Ke=>String(Ke)).sort(),Oe=be.join(",");if(!be.length||w.get(ae)===Oe)return;w.set(ae,Oe);const He=be.map(encodeURIComponent).join(",");try{const B=await(await fetch(v(re.data,He))).json();s.value[ae]=B?.data??B}catch(Ke){console.error("Failed to fetch column values",Ke)}}))};o.watch([()=>e.colModel,()=>r.value],()=>{S()},{immediate:!0,deep:!0});const I=o.ref(""),A=o.ref(!1);let V="edit",M=0;const U=Y=>(Y?.format||Y?.type||"").toString().toLowerCase(),R=o.computed(()=>e.colModel?.filter(Y=>U(Y)!=="slot").map(Y=>{const{slot:re,...ae}=Y;return ae})??[]),$=o.ref({}),D=o.ref({}),P=Y=>typeof Y!="string"?!1:!!t[Y],H=(Y,re)=>re?re.split(".").reduce((ae,fe)=>ae==null?ae:ae[fe.trim()],Y):Y,G=(Y,re)=>typeof Y!="string"?"":Y.replace(/{{\s*([^}]+)\s*}}/g,(ae,fe)=>{const be=H(re,fe.trim());return be??""}),ie=Y=>{if(Y==null||Y==="")return"";if(typeof Y=="number")return Y;if(typeof Y=="boolean")return Y?1:0;if(typeof Y=="string")return Y.toLowerCase();if(Array.isArray(Y))return Y.map(re=>ie(re)).join(", ");if(typeof Y=="object"){if(Y.text!==void 0)return String(Y.text).toLowerCase();if(Y.label!==void 0)return String(Y.label).toLowerCase();if(Y.id!==void 0)return String(Y.id).toLowerCase()}return String(Y).toLowerCase()},Ae=Y=>{const re=Y.key||Y.name;if(re){if(a.value===re){i.value=i.value==="asc"?"desc":"asc";return}a.value=re,i.value="asc"}};async function Q(){I.value="Додати",A.value=!0,V="add",$.value={}}function Pe(Y,re){if(!Y?.length)return null;const ae=typeof re=="object"?re?.id:re;return ae==null||ae===""?null:Y.find(fe=>fe?.id?.toString()===ae.toString())?.text??null}function ze(Y){return Y==null||Y===""?"-":Array.isArray(Y)?Y.map(re=>typeof re=="object"?re?.text??re?.id??"-":re).join(", "):typeof Y=="object"?Y?.text??Y?.id??"-":Y}function We(Y,re){const ae=re.key||re.name,fe=Y?.[ae],be=s.value[ae];if(!fe)return"-";if(Array.isArray(fe)){const He=fe.map(Ke=>Pe(be,Ke)).filter(Boolean);return He.length?He.join(", "):ze(fe)}const Oe=Pe(be,fe);return Oe||ze(fe)}async function St(Y,re){I.value="Редагувати",A.value=!0,V="edit",M=re,$.value={...Y}}function gt(){const Y=D.value.validate();if(Y){nt.notify({type:"warning",title:"Помилка валідації",message:Object.entries(Y).map(([re,ae])=>`${re}: ${ae}`).join(`
|
|
149
|
+
`)});return}V==="add"?Array.isArray(r.value)?r.value=[...r.value,$.value]:r.value=[$.value]:r.value=r.value.map((re,ae)=>ae===M?$.value:re),A.value=!1}function Wt(Y){r.value=r.value.filter((re,ae)=>ae!==Y)}function on(){A.value=!1}return(Y,re)=>(o.openBlock(),o.createElementBlock("div",n6,[o.createElementVNode("div",r6,[o.createElementVNode("div",o6,[o.createVNode(IF,{width:"16",height:"16",class:"absolute left-3 top-1/2 -translate-y-1/2 text-gray-400"}),o.withDirectives(o.createElementVNode("input",{type:"text","onUpdate:modelValue":re[0]||(re[0]=ae=>l.value=ae),placeholder:"Пошук",class:"w-full rounded-md border border-gray-200 bg-white pl-10 pr-3 py-2 text-sm text-gray-900 placeholder:text-gray-400 focus:border-blue-500 focus:outline-none focus:ring-2 focus:ring-blue-100"},null,512),[[o.vModelText,l.value]])]),o.createElementVNode("div",s6,[o.createElementVNode("input",{ref_key:"fileInput",ref:p,onChange:b,class:"hidden",accept:".json",type:"file"},null,544),o.createElementVNode("button",{type:"button",onClick:g,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[o.createVNode(PF,{class:"text-gray-700",width:"16",height:"16"}),re[4]||(re[4]=o.createTextVNode(" Імпорт ",-1))]),o.createElementVNode("button",{type:"button",onClick:k,class:"inline-flex items-center gap-2 rounded-md border border-gray-200 bg-white px-3 py-2 text-sm font-medium text-gray-700 hover:border-gray-300 hover:bg-gray-50 transition-colors"},[o.createVNode(UF,{class:"text-gray-700",width:"16",height:"16"}),re[5]||(re[5]=o.createTextVNode(" Експорт ",-1))]),o.createElementVNode("button",{onClick:Q,type:"button",class:"inline-flex items-center gap-2 rounded-md bg-blue-500 px-3 py-2 text-sm font-semibold text-white shadow-sm hover:bg-blue-600 transition-colors"},[o.createVNode(zn,{class:"text-white"}),re[6]||(re[6]=o.createTextVNode(" Додати ",-1))])])]),o.createElementVNode("div",l6,[o.createElementVNode("table",a6,[o.createElementVNode("thead",i6,[o.createElementVNode("tr",c6,[o.createElementVNode("th",d6,[o.createVNode(J0,{width:"20",height:"20",class:"mx-auto text-gray-400"})]),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Y.colModel,ae=>(o.openBlock(),o.createElementBlock("th",{key:ae.key,class:"px-4 py-3 text-left text-xs font-semibold text-gray-900"},[o.createElementVNode("button",{type:"button",onClick:fe=>Ae(ae),class:"flex items-center gap-1 text-xs font-semibold text-gray-700 hover:text-gray-900 transition-colors"},[o.createElementVNode("span",null,o.toDisplayString(ae.ua||ae.label),1),a.value===(ae.key||ae.name)?(o.openBlock(),o.createElementBlock("span",p6,o.toDisplayString(i.value==="asc"?"▲":"▼"),1)):o.createCommentVNode("",!0)],8,u6)]))),128)),re[7]||(re[7]=o.createElementVNode("th",{class:"px-4 py-3 text-left text-xs font-semibold text-gray-900 text-center"}," Дії ",-1))])]),o.createElementVNode("tbody",{class:o.normalizeClass(["divide-y divide-gray-200",{"[&_tr:last-child]:border-0":!u.value}])},[c.value.length===0?(o.openBlock(),o.createElementBlock("td",h6,[o.createElementVNode("div",f6,[o.createElementVNode("div",m6,[o.createVNode(ZF,{class:"w-48 mx-auto"}),re[8]||(re[8]=o.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[o.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),o.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):o.createCommentVNode("",!0),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(c.value,(ae,fe)=>(o.openBlock(),o.createElementBlock("tr",{key:ae.id,class:o.normalizeClass(["border-b transition-colors hover:bg-gray-50 cursor-move text-sm text-gray-700",{"opacity-50":d.value===fe,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":u.value===fe}]),draggable:"true",onDragstart:be=>h(fe),onDragover:o.withModifiers(be=>f(fe),["prevent"]),onDrop:be=>m(fe)},[o.createElementVNode("td",y6,[o.createElementVNode("div",b6,[o.createVNode(J0,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Y.colModel,be=>(o.openBlock(),o.createElementBlock("td",{key:be.key,class:"px-4 py-3 align-middle"},[U(be)==="slot"?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[P(be.slot)?o.renderSlot(Y.$slots,be.slot,{key:0,row:ae,value:ae[be.key],column:be}):(o.openBlock(),o.createElementBlock("div",{key:1,class:"text-sm text-gray-900",innerHTML:G(be.slot,ae)},null,8,k6))],64)):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[U(be)==="file"?(o.openBlock(),o.createElementBlock("div",w6,[y(We(ae,be))?(o.openBlock(),o.createElementBlock("div",x6,[o.createElementVNode("img",{src:We(ae,be),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,v6)])):(o.openBlock(),o.createElementBlock("div",E6,[o.createVNode(jd,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):U(be)==="color"?(o.openBlock(),o.createElementBlock("div",C6,[o.createElementVNode("span",{class:"inline-flex h-6 w-6 rounded border border-gray-200",style:o.normalizeStyle({backgroundColor:We(ae,be)||"#ffffff"})},null,4)])):(o.openBlock(),o.createElementBlock("div",_6,o.toDisplayString(We(ae,be)),1))],64))]))),128)),o.createElementVNode("td",S6,[o.createElementVNode("div",N6,[o.createElementVNode("button",{onClick:be=>St(ae,fe),class:"p-1.5 text-gray-600 hover:text-blue-600 hover:bg-blue-50 rounded transition-colors"},[o.createVNode(t6,{width:"16",height:"16"})],8,V6),o.createElementVNode("button",{onClick:be=>Wt(fe),class:"p-1.5 text-gray-600 hover:text-red-600 hover:bg-red-50 rounded transition-colors"},[o.createVNode(Qr,{width:"16",height:"16"})],8,M6)])])],42,g6))),128))],2)])]),o.createVNode(o.unref(nt.VsModal),{visible:A.value,title:I.value,size:"lg",onClose:on,class:o.normalizeClass("z-50")},{default:o.withCtx(()=>[o.createVNode(Qn,{schema:R.value,values:$.value,"onUpdate:values":re[1]||(re[1]=ae=>$.value=ae),form:D.value,"onUpdate:form":re[2]||(re[2]=ae=>D.value=ae)},null,8,["schema","values","form"]),o.createElementVNode("div",B6,[o.createElementVNode("button",{type:"button",onClick:re[3]||(re[3]=ae=>A.value=!1),class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border !border-gray-200 hover:text-white bg-white text-red-500 hover:border-red-500 hover:bg-red-500 focus:ring-red-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1 mr-2"}," Скасувати "),o.createElementVNode("button",{onClick:gt,type:"button",class:"vs-button inline-flex border-solid justify-center items-center gap-2 rounded-md font-semibold focus:outline-none text-sm transition-all border-1 border-transparent text-white bg-blue-500 hover:bg-blue-600 focus:ring-blue-500 py-1.5 px-5 focus:ring-1 focus:ring-offset-1"}," Зберегти ")])]),_:1},8,["visible","title"])]))}}),A6={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:"Клацніть на шари, щоб видалити їх"}}}}},T6={},L6={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 D6(n,e){return o.openBlock(),o.createElementBlock("svg",L6,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),o.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 O6=Ve(T6,[["render",D6]]),I6={},F6={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 $6(n,e){return o.openBlock(),o.createElementBlock("svg",F6,e[0]||(e[0]=[o.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),o.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),o.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),o.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const R6=Ve(I6,[["render",$6]]),P6={},z6={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 j6(n,e){return o.openBlock(),o.createElementBlock("svg",z6,e[0]||(e[0]=[o.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 H6=Ve(P6,[["render",j6]]),U6={},W6={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 K6(n,e){return o.openBlock(),o.createElementBlock("svg",W6,e[0]||(e[0]=[o.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 q6=Ve(U6,[["render",K6]]),G6={},Y6={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 J6(n,e){return o.openBlock(),o.createElementBlock("svg",Y6,e[0]||(e[0]=[o.createElementVNode("title",null,null,-1),o.createElementVNode("desc",null,null,-1),o.createElementVNode("defs",null,null,-1),o.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[o.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[o.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[o.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 Z6=Ve(G6,[["render",J6]]),X6={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},Q6={key:0,class:"vs-select__options absolute z-50 mt-1 w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm"},e$=["onClick"],t$={class:"relative flex-1 min-w-[140px]"},n$=["placeholder"],r$="https://data.softpro.ua/api-user/gis-url-proxy",o$="https://geo.rv.ua/api-user/dzk.api",s$=Ve(o.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(n,{emit:e}){const t=n,r=e,s=["here","xy","parcel"],l=o.computed(()=>{const w=t.config?.tools?.filter(v=>s.includes(v));return w&&w.length?w:s}),a=o.computed(()=>t.config?.placeholder?.trim()||"Пошук…"),i=o.ref(l.value[0]??s[0]);o.watch(l,w=>{w.includes(i.value)||(i.value=w[0])});const c=o.ref(""),d=o.ref(!1),u=o.ref(null);o.watch(i,()=>{c.value="",d.value=!1});function p(w){i.value=w}function h(w){if(!d.value)return;const v=u.value;v&&!v.contains(w.target)&&(d.value=!1)}o.onMounted(()=>{window.addEventListener("click",h,!0)}),o.onBeforeUnmount(()=>{window.removeEventListener("click",h,!0)});function f(w){return w==="xy"?"Координати":w==="parcel"?"Кадастр":"Адреси"}function m(w){const v=w.replace(/[,]+/g," ").trim();if(!v)return null;const _=v.split(/\s+/).filter(Boolean);if(_.length<2)return null;const E=_.slice(0,2).map(Number);if(!E.every(R=>Number.isFinite(R)))return null;let[S,I]=E,A=S,V=I;const M=R=>Math.abs(R)<=90,U=R=>Math.abs(R)<=180;if(!M(A)||!U(V))if(M(V)&&U(A))A=I,V=S;else return null;return{lat:A,lng:V}}function g(w){return(w?.items||[]).map((_,E)=>({id:String(_?.id??E),title:_?.title||_?.address?.label||"Знайдений обʼєкт",lat:Number(_?.position?.lat),lng:Number(_?.position?.lng)})).filter(_=>Number.isFinite(_.lat)&&Number.isFinite(_.lng))}function y(w){const v=w?.result||w?.data||w;if(!v)return[];const _=v.geom_centroid;if(!_||!Array.isArray(_.coordinates))return[];const[E,S]=_.coordinates;return!Number.isFinite(S)||!Number.isFinite(E)?[]:[{id:"parcel",title:v.cadnum||v.cad_num||"Земельна ділянка",lat:S,lng:E}]}function b(w){const _=w.replace(/\s+/g,"").split(":");if(_.length!==4)return!1;const E=[10,2,3,4];return _.every((S,I)=>S.length===E[I]&&/^\d+$/.test(S))}function k(w){r("goToCoordinates",[w.lat,w.lng])}async function x(){const w=c.value.trim();if(w){if(i.value==="xy"){const v=m(w);if(!v){nt.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}k(v),c.value="";return}try{const v=new URL(i.value==="here"?r$:o$);if(i.value==="here")v.searchParams.set("searchtext",w);else{if(!b(w)){nt.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}v.searchParams.set("cad_num",w)}const _=await fetch(v.toString());if(!_.ok)throw new Error(`HTTP ${_.status}`);const E=await _.json(),S=i.value==="here"?g(E):y(E);if(!S.length)nt.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const I=S[0];k(I),c.value=""}}catch(v){const _=v?.message||"Помилка пошуку";nt.notify({type:"error",title:"Пошук",message:_})}}}return(w,v)=>(o.openBlock(),o.createElementBlock("div",X6,[o.createElementVNode("form",{class:"flex gap-2",onSubmit:o.withModifiers(x,["prevent"])},[l.value.length>1?(o.openBlock(),o.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:"relative search-type w-[140px]"},[o.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:v[0]||(v[0]=_=>d.value=!d.value)},[o.createElementVNode("span",null,o.toDisplayString(f(i.value)),1),(o.openBlock(),o.createElementBlock("svg",{class:o.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":d.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},v[2]||(v[2]=[o.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2))]),d.value?(o.openBlock(),o.createElementBlock("div",Q6,[o.createElementVNode("ul",null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(l.value,_=>(o.openBlock(),o.createElementBlock("li",{key:_,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:E=>p(_)},o.toDisplayString(f(_)),9,e$))),128))])])):o.createCommentVNode("",!0)],512)):o.createCommentVNode("",!0),o.createElementVNode("div",t$,[o.withDirectives(o.createElementVNode("input",{"onUpdate:modelValue":v[1]||(v[1]=_=>c.value=_),placeholder:a.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,n$),[[o.vModelText,c.value,void 0,{trim:!0}]]),v[3]||(v[3]=o.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[o.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1))])],32)]))}}),[["__scopeId","data-v-3048520a"]]),l$={class:"bg-white/30 p-1 rounded-md shadow w-fit"},a$={class:"flex gap-2"},i$=["onClick","title"],c$=["src"],d$=o.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(n,{emit:e}){const t=n,r=o.ref(Object.keys(t.basemaps)[0]),s=e;function l(c){s("onLayerChange",c),r.value=c}const a={z:13,x:4790,y:2762};function i(c){if(c?.preview)return c.preview;if(!c?.url)return;const d={"{z}":a.z,"{x}":a.x,"{y}":a.y};let u=c.url;return Object.entries(d).forEach(([p,h])=>{u=u.replace(new RegExp(p,"gi"),String(h))}),u}return(c,d)=>(o.openBlock(),o.createElementBlock("div",l$,[o.createElementVNode("div",a$,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(c.basemaps,(u,p)=>(o.openBlock(),o.createElementBlock("div",{key:p,class:o.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":r.value===p}]),onClick:h=>l(p),title:u.name||p,role:"button",tabindex:"0"},[o.createElementVNode("img",{src:i(u),alt:"",class:"w-10 h-10 object-cover"},null,8,c$)],10,i$))),128))])]))}});function ks(n){return n?n.type==="Polygon"?{type:"MultiPolygon",coordinates:[n.coordinates]}:n.type==="Feature"?{...n,geometry:ks(n.geometry)}:n.type==="FeatureCollection"?{...n,features:(n.features||[]).map(e=>ks(e)).filter(Boolean)}:n:null}function u$(n){return n?n.type==="FeatureCollection"||n.type==="Feature"?ks(n):n.geom?{type:"Feature",geometry:ks({type:n.geom.type,coordinates:n.geom.coordinates}),properties:{}}:n.type&&n.coordinates?{type:"Feature",geometry:ks(n),properties:{}}:null:null}const p$={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},h$={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},f$={class:"text-sm font-medium"},m$={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},g$={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},y$={class:"flex items-center gap-1"},b$=["disabled"],k$=["disabled"],w$=["disabled"],x$={class:"bg-white/95 border border-gray-200 rounded-md shadow-xl px-3 py-2 max-w-[240px] text-[11px] sm:text-xs text-gray-900"},v$={class:"space-y-0.5"},E$={class:"text-gray-500"},C$={class:"text-gray-900 text-right break-all"},_$={class:"absolute top-4 right-4 z-[1000]"},S$={class:"flex flex-col gap-[2px]"},N$=["disabled"],V$=["disabled"],M$=["disabled"],B$=["disabled"],A$={class:"flex flex-col gap-2"},T$={key:0,class:"bg-white/95 border border-gray-200 rounded-md shadow-sm px-3 py-2 text-xs text-gray-700 min-w-[200px]"},L$={class:"flex flex-col gap-1"},D$=["checked","disabled","onChange"],O$={class:"text-gray-700 text-xs font-medium"},I$={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"},F$={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},$$={class:"shrink-0"},R$={class:"font-bold"},P$={class:"flex items-center"},z$={class:"text-xs mr-2"},j$={key:0,class:"text-xs"},H$={key:1,class:"text-xs"},U$=["disabled"],W$=["disabled"],wa="vs-base-tile-pane",xa="vs-overlay-tile-pane",X0=Ve(o.defineComponent({__name:"vs-input-map",props:{tools:{},handleZoom:{type:Boolean,default:!0},ctrlZoom:{type:Boolean,default:!0},geomType:{default:()=>[]},prefix:{default:""},katottg:{default:""},layers:{default:()=>[]},bounds:{},api:{},center:{default:void 0},zoom:{default:void 0},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(n,{emit:e}){const r=o.getCurrentInstance()?.appContext?.config?.globalProperties?.$settings??{},s=Array.isArray(r.center)&&r.center.length===2?r.center:[50,30],l=typeof r.zoom=="number"?r.zoom:typeof r.defaultZoom=="number"?r.defaultZoom:10,a=n,i=e,c=o.computed(()=>!!a.disabled),d=o.ref(!1),u=o.ref(null),p=o.ref(!1),h=o.ref(""),f=o.ref(null),m=o.ref(null),g=o.ref(!1),y=o.ref(null),b=o.ref(null),k=o.ref(0),x=o.ref(Array.isArray(a.center)&&a.center.length===2?[...a.center]:s),w=o.ref(typeof a.zoom=="number"?a.zoom:l),v=o.ref([]),_=o.ref(a.modelValue);let E=!1;const S=o.ref(null),I=o.computed(()=>{const C={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!a.tools?.length)return{...C,point:!0,line:!0,polygon:!0,rectangle:!0};const N=new Set(a.tools.map(j=>j.toLowerCase()));return{search:N.has("search"),import:N.has("import"),export:N.has("export"),point:N.has("point"),line:N.has("line"),polygon:N.has("polygon"),rectangle:N.has("rectangle")}}),A=o.reactive({}),V=o.ref([]),M=o.computed(()=>V.value.map(C=>A[C]).filter(Boolean)),U=o.ref(null),R=o.computed(()=>U.value?.entries??[]),$=o.computed(()=>{if(!U.value)return;const C=12,N=U.value.point.x+C,j=U.value.point.y+C;return{left:`${N}px`,top:`${j}px`}});function D(C){if(typeof C!="string"||!C.trim())return"";if(/^https?:\/\//i.test(C))return C;const N=window?.location?.origin??"",j=C.replace(/^\/+/,"");return j?N?`${N}/${j}`:`/${j}`:N}function P(){if(Array.isArray(r.basemaps)&&r.basemaps.length){const N=r.basemaps.map((j,J)=>{const le=String(j?.key??j?.id??j?.name??`b${J}`),ue=D(String(j?.url??""));if(!ue)return null;const Ee=typeof j?.preview=="string"&&j.preview?D(j.preview):"";return[le,{...j,url:ue,preview:Ee}]}).filter(j=>Array.isArray(j)&&j.length===2).reduce((j,[J,le])=>(j[J]=le,j),{});if(Object.keys(N).length)return N}return{voyager:{name:"Оглядова карта",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/voyager/ua/13/4790/2762.png"},orto10:{name:"Ортофото 1:10K",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png",preview:"https://data.gki.com.ua/api-user/rtile/orto10/ua/13/4790/2762.png"},osmb:{name:"Open Street Maps",url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png",preview:"https://tile.openstreetmap.org.ua/styles/osm-bright/13/4790/2762.png"}}}const H=P(),G=Object.keys(H),ie=o.ref(G.length?G[0]:"");let Ae,Q,Pe,ze,We=null;async function St(){const C=J=>{if(!Array.from(document.styleSheets).some(le=>le?.href?.includes(J))){const le=document.createElement("link");le.rel="stylesheet",le.href=J,document.head.appendChild(le)}},N=J=>new Promise((le,ue)=>{if(Array.from(document.scripts).some(Ge=>Ge.src===J))return le();const Ce=document.createElement("script");Ce.src=J,Ce.async=!0,Ce.onload=()=>le(),Ce.onerror=Ge=>ue(Ge),document.body.appendChild(Ce)});C("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),C("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css");try{await N("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js")}catch{}try{await N("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js")}catch{}try{await N("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js")}catch{}return window.L}function gt(){const C=navigator.platform.toUpperCase().includes("MAC");return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Використовуйте два пальці для зуму карти.":C?"Використовуйте Ctrl або ⌘ + прокрутка для зуму карти.":"Використовуйте Ctrl + прокрутка для зуму карти."}function Wt(){if(!a.handleZoom||!u.value||!Q)return null;let C;const N=J=>{const le=J.ctrlKey||J.metaKey||J.shiftKey;if(!a.ctrlZoom){p.value=!1,Q.scrollWheelZoom.enable();return}if(!le){p.value=!0,h.value=gt(),clearTimeout(C),C=window.setTimeout(()=>p.value=!1,1200);return}J.preventDefault(),J.stopPropagation(),p.value=!1,Q.scrollWheelZoom.enable(),setTimeout(()=>Q.scrollWheelZoom.disable(),120)},j=J=>{if(J.touches.length===1){if(!a.ctrlZoom)return;p.value=!0,h.value=gt(),clearTimeout(C),C=window.setTimeout(()=>p.value=!1,3e3)}else p.value=!1};return u.value.addEventListener("wheel",N,{passive:!1}),u.value.addEventListener("touchstart",j,{passive:!0}),Q.on("wheel",J=>{if(!a.ctrlZoom)return;J.originalEvent?.ctrlKey||J.originalEvent?.metaKey||J.originalEvent?.shiftKey||(J.originalEvent?.preventDefault?.(),J.originalEvent?.stopPropagation?.())}),()=>{u.value?.removeEventListener("wheel",N),u.value?.removeEventListener("touchstart",j),clearTimeout(C)}}function on(C,N){return C?.id?String(C.id):C?.url?`${C.url}-${N}`:`layer-${N}`}function Y(C){const N=(C?.url??"").trim();if(!N)return"";if(/^https?:\/\//i.test(N))return N;const j=window.location?.origin??"",J=N.replace(/^\/+/,"");return`${j}/${J}`}function re(C){const N=C?.style??{};return j=>{const J=N.colorAttr,le=N.colorSet??{},ue=typeof J=="string"?le?.[j?.[J]]??N.color??"#3388ff":N.color??"#3388ff",Ee=N.stroke??ue;return{weight:N.width??1,color:Ee,opacity:N.opacity??1,fill:N.type?N.type!=="polyline":!0,fillColor:ue,fillOpacity:N.opacity??.5}}}function ae(C){return C?.layer?.properties||C?.layer?.feature?.properties||C?.properties||{}}function fe(C,N={}){return C.popup===!1?[]:Array.isArray(C.popup)&&C.popup.length?C.popup.map(j=>{if(!j?.field)return null;const J=N[j.field];return J==null||J===""?null:{key:j.label||j.field,value:String(J)}}).filter(j=>!!j):Object.entries(N).filter(([j])=>typeof j=="string"&&j).slice(0,5).map(([j,J])=>({key:j,value:J==null?"—":String(J)}))}function be(C,N){if(!Q||!N?.latlng)return;const j=Q.latLngToContainerPoint(N.latlng),J=ae(N),le=fe(C,J);if(!le.length){Oe(C.id);return}U.value={layerId:C.id,title:J?.name||C.title||C.name,properties:J,entries:le,point:{x:j.x,y:j.y}}}function Oe(C){C&&U.value?.layerId!==C||(U.value=null)}function He(C){const N=(C?.service??"").toLowerCase(),j=Y(C),J=C.sourceLayer||C.layer||C.service_layer||C.service_key||C.map_key||C.dataset?.layer||C.id||C.table_name;if(N==="vtile"){const le=S.value;if(le?.vectorGrid?.protobuf&&!le?.maplibreGL){const ue=le.vectorGrid.protobuf(j,{interactive:!0,maxNativeZoom:C.maxzoom??19,vectorTileLayerStyles:{[J??"default"]:re(C),default:re(C)}});return ue?.on?.("mouseover",Ee=>be(C,Ee)),ue?.on?.("mousemove",Ee=>be(C,Ee)),ue?.on?.("mouseout",()=>Oe(C.id)),ue}if(le?.maplibreGL&&window?.maplibregl){const ue=j;return ue?le.maplibreGL({style:ue,interactive:!1,pane:"overlayPane"}):null}return null}return N==="tile"||/^https?:\/\//i.test(j)||j.includes("{z}")?S.value.tileLayer(j,{opacity:C?.style?.opacity??1,pane:xa}):S.value.tileLayer(j,{opacity:C?.style?.opacity??1,pane:xa})}function Ke(C){const N=S.value;if(!N)return null;const j=("bounds"in C?C.bounds:void 0)??a.bounds??v.value;if(!Array.isArray(j)||!j.length)return null;const le={color:C.style?.stroke??C.style?.color??"#2563eb",weight:C.style?.width??2,interactive:!1,opacity:C.style?.opacity??.8,dashArray:"4 4"},ue=Array.isArray(C.bounds)&&C.bounds.length?C.bounds:j,Ee=B(ue);if(!Ee.length||!N?.polyline)return null;const Ce=Ee.map(Ge=>{if(!Ge.length)return Ge;const Je=Ge[0],sn=Ge[Ge.length-1];return Je&&sn&&typeof sn.equals=="function"&&!sn.equals(Je)?[...Ge,Je]:Ge});return N.polyline(Ce,le)}function B(C){const N=S.value;if(!N||!Array.isArray(C))return[];const j=le=>{if(!Array.isArray(le)||le.length<2)return null;const[ue,Ee]=le;return!Number.isFinite(Number(Ee))||!Number.isFinite(Number(ue))?null:N.latLng(Number(Ee),Number(ue))},J=le=>Array.isArray(le)&&le.length>=2&&le.every(ue=>Number.isFinite(Number(ue)));if(C.length&&J(C[0])){const le=C.map(j).filter(Boolean);return le.length?[le]:[]}return C.length&&Array.isArray(C[0])&&Array.isArray(C[0][0])&&J(C[0][0][0])?C.flatMap(ue=>Array.isArray(ue)?ue:[]).map(ue=>Array.isArray(ue)?ue.map(j).filter(Boolean):[]).filter(ue=>ue.length):C.length&&Array.isArray(C[0])&&J(C[0][0])?C.map(ue=>Array.isArray(ue)?ue.map(j).filter(Boolean):[]).filter(ue=>ue.length):[]}function O(){if(!Q||!S.value)return;We&&Q.hasLayer(We)&&(Q.removeLayer(We),We=null);const C=Ke({id:"global-bounds",bounds:a.bounds??v.value,style:{}});C&&(We=C,We.addTo(Q))}function Z(){!Q||!S.value||V.value.forEach(C=>{const N=A[C];N&&(N.visible?(N.layer||(N.layer=He(N.config)),N.boundsLayer||(N.boundsLayer=Ke(N.config)),N.layer&&!Q.hasLayer(N.layer)&&N.layer.addTo(Q),N.boundsLayer&&!Q.hasLayer(N.boundsLayer)&&N.boundsLayer.addTo(Q)):(N.layer&&Q.hasLayer(N.layer)&&Q.removeLayer(N.layer),N.boundsLayer&&Q.hasLayer(N.boundsLayer)&&Q.removeLayer(N.boundsLayer),Oe(N.id)))})}function he(C){if(c.value)return;const N=A[C];N&&(N.visible=!N.visible,N.visible?(N.layer||(N.layer=He(N.config)),N.boundsLayer||(N.boundsLayer=Ke(N.config)),N.layer&&!Q.hasLayer(N.layer)&&N.layer.addTo(Q),N.boundsLayer&&!Q.hasLayer(N.boundsLayer)&&N.boundsLayer.addTo(Q)):(N.layer&&Q.hasLayer(N.layer)&&Q.removeLayer(N.layer),N.boundsLayer&&Q.hasLayer(N.boundsLayer)&&Q.removeLayer(N.boundsLayer),Oe(N.id)))}o.watch(()=>a.layers,C=>{const N=Array.isArray(C)?C:[],j=[],J=new Set;N.forEach((le,ue)=>{if(!le)return;const Ee=on(le,ue);j.push(Ee),J.add(Ee);const Ce=A[Ee],Ge={...le,id:Ee},Je=Ce?.visible??!!Ge?.visible;Ce&&(Ce.layer&&Q?.hasLayer(Ce.layer)&&Q.removeLayer(Ce.layer),Ce.boundsLayer&&Q?.hasLayer(Ce.boundsLayer)&&Q.removeLayer(Ce.boundsLayer),Oe(Ee)),A[Ee]={id:Ee,config:Ge,visible:Je,layer:null,boundsLayer:null}}),Object.keys(A).forEach(le=>{if(!J.has(le)){const ue=A[le];ue?.layer&&Q?.hasLayer(ue.layer)&&Q.removeLayer(ue.layer),ue?.boundsLayer&&Q?.hasLayer(ue.boundsLayer)&&Q.removeLayer(ue.boundsLayer),Oe(le),delete A[le]}}),V.value=j,Z()},{immediate:!0,deep:!0}),o.watch(()=>a.bounds,()=>{Q&&(Object.values(A).forEach(C=>{C.boundsLayer&&Q.hasLayer(C.boundsLayer)&&Q.removeLayer(C.boundsLayer),C.boundsLayer=null}),O(),Z())},{deep:!0}),o.watch(()=>a.katottg,async C=>{if(v.value=[],!C){O();return}try{const N=await fetch(`https://data.gki.com.ua/api-user/atu/${C}`);if(!N?.ok)return;const J=(await N.json())?.geometry?.coordinates;Array.isArray(J)&&J.length&&(v.value=J)}catch(N){console.error("Failed to fetch KATOTTG bounds",N)}finally{O(),Z()}},{immediate:!0}),o.watch(()=>a.modelValue,C=>{if(!Q||!Pe){_.value=C;return}qe(C)},{deep:!0});function ve(C){const N=S.value;return C instanceof N.Circle?"Circle":C instanceof N.Rectangle?"Rectangle":C instanceof N.Polygon&&!(C instanceof N.Rectangle)?"Polygon":C instanceof N.Polyline&&!(C instanceof N.Polygon)?"Polyline":C instanceof N.Marker?"Point":"Feature"}function W(C){const N=S.value;if(C instanceof N.Circle){const j=C.getRadius();return Math.PI*(j*j)/1e6}if(C instanceof N.Polygon||C instanceof N.Rectangle)try{const j=C.getLatLngs();if(!Array.isArray(j)||!j.length)return null;if(!Array.isArray(j[0])){const Ee=N.GeometryUtil?.geodesicArea?N.GeometryUtil.geodesicArea(j):0;return Ee?Math.abs(Ee)/1e6:0}const J=j[0];if(J.length>0&&(J[0]instanceof N.LatLng||typeof J[0]?.lat=="number")){const{feature:Ee}=C;if(Ee?.geometry?.type==="MultiPolygon"){const Je=j.reduce((sn,Ls)=>{if(!Array.isArray(Ls)||!Ls.length)return sn;if(N.GeometryUtil?.geodesicArea){const Ds=N.GeometryUtil.geodesicArea(Ls);if(Ds)return sn+Math.abs(Ds)}return sn},0);return Je?Je/1e6:0}const Ge=N.GeometryUtil?.geodesicArea?N.GeometryUtil.geodesicArea(j):0;return Ge?Math.abs(Ge)/1e6:0}const ue=j.reduce((Ee,Ce)=>{if(!Array.isArray(Ce)||!Ce.length)return Ee;const Ge=Array.isArray(Ce[0])?Ce[0]:Ce;if(N.GeometryUtil?.geodesicArea){const Je=N.GeometryUtil.geodesicArea(Ge);if(Je)return Ee+Math.abs(Je)}return Ee},0);return ue?ue/1e6:0}catch{return null}return null}function X(C){return C instanceof S.value.Circle?C.getLatLng():C.getBounds?C.getBounds().getCenter():C.getLatLng?C.getLatLng():Q.getCenter()}function Ne(C){const N=Pe.toGeoJSON(),j=[],J=[];let le=null;const ue=Ce=>{if(Ce)switch(Ce.type){case"Point":le=Ce;break;case"Polygon":j.push(Ce.coordinates);break;case"MultiPolygon":j.push(...Ce.coordinates);break;case"LineString":J.push(Ce.coordinates);break;case"MultiLineString":J.push(...Ce.coordinates);break;case"GeometryCollection":(Ce.geometries||[]).forEach(ue);break}};(N?.features||[]).forEach(Ce=>ue(Ce.geometry));const Ee=le||(j.length?{type:j.length===1?"Polygon":"MultiPolygon",coordinates:j.length===1?j[0]:j}:J.length?{type:J.length===1?"LineString":"MultiLineString",coordinates:J.length===1?J[0]:J}:null);!C?.silent&&!E&&i("update:modelValue",Ee),k.value=Pe.getLayers().length}function qe(C){if(!Pe||!S.value)return;Pe.clearLayers();const N=u$(C);if(!N){m.value=null,k.value=0;return}S.value.geoJSON(N).eachLayer(J=>Pe.addLayer(J)),E=!0,Ne({silent:!0}),E=!1,lt();const j=Pe.getBounds?.();j?.isValid?.()&&Q?.fitBounds(j,{padding:[24,24]})}function lt(){const C=Pe.getLayers();if(!C.length){m.value=null,k.value=0;return}const N=C[C.length-1],j=ve(N),J=X(N),le=Pe.toGeoJSON(),ue=le?.features?.some(Je=>Je.geometry?.type==="MultiPolygon")||le?.geometry?.type==="MultiPolygon",Ee=C.length>1&&C.every(Je=>Je instanceof S.value.Polygon||Je instanceof S.value.Rectangle),Ce=ue||Ee;let Ge=null;if(Ce){const Je=C.reduce((sn,Ls)=>{const Ds=W(Ls);return sn+(Ds?Ds*1e6:0)},0);Ge=Je?Je/1e6:0}else Ge=W(N);m.value={type:j,center:J,areaKm2:Ge,layer:N},k.value=C.length}const T=o.ref("");function F(C){if(c.value||!Q||!S.value)return;ze?.disable&&ze.disable();const N=S.value;switch(C){case"marker":ze=new N.Draw.Marker(Q);break;case"polyline":ze=new N.Draw.Polyline(Q);break;case"polygon":ze=new N.Draw.Polygon(Q);break;case"rectangle":ze=new N.Draw.Rectangle(Q);break}ze.enable(),T.value=C}function te(){if(c.value)return;const C=m.value?.layer;C&&(C.getBounds?Q.fitBounds(C.getBounds(),{padding:[30,30]}):C.getLatLng&&Q.setView(C.getLatLng(),Math.max(w.value,14)))}function ce(){c.value||Pe&&(Pe.clearLayers(),i("update:modelValue",null),m.value=null,k.value=0)}const me=o.ref(null);function Te(){c.value||me.value?.click()}function K(C){if(c.value)return;const N=C.target,j=N.files?.[0];if(!j)return;const J=new FileReader;J.onload=()=>{try{const le=JSON.parse(String(J.result));Pe.clearLayers(),le&&S.value.geoJSON(le).eachLayer(ue=>Pe.addLayer(ue)),Ne(),lt()}finally{N.value=""}},J.readAsText(j)}function ee(){if(c.value)return;const C=Pe.toGeoJSON(),N=new Blob([JSON.stringify(C,null,2)],{type:"application/json"}),j=URL.createObjectURL(N),J=document.createElement("a");J.href=j,J.download="data.geojson",J.click(),URL.revokeObjectURL(j)}function se(C){!Q||!S.value||!H[C]||(Ae&&Q.removeLayer(Ae),Ae=S.value.tileLayer(H[C].url,{maxZoom:19,minZoom:6,pane:wa}).addTo(Q),ie.value=C)}function z(C){if(!Q||!S.value)return;const N=S.value.latLng(C[0],C[1]);Q.setView(N,13)}let q=null;return o.onMounted(async()=>{S.value=await St();const C=S.value;C.drawLocal=A6,Q=C.map(u.value,{zoomControl:!1,scrollWheelZoom:!1}).setView(x.value,w.value),C.control.zoom({position:"bottomright"}).addTo(Q);const N=ie.value||Object.keys(H)[0];Q.createPane(wa),Q.getPane(wa).style.zIndex="180",Q.createPane(xa),Q.getPane(xa).style.zIndex="220",N&&H[N]&&(ie.value=N,Ae=C.tileLayer(H[N].url,{maxZoom:19,minZoom:6,pane:wa}).addTo(Q)),Pe=new C.FeatureGroup().addTo(Q),Q.on(C.Draw.Event.CREATED,J=>{if(c.value)return;const{layer:le}=J;Pe.clearLayers(),Pe.addLayer(le),Ne(),lt(),T.value=""}),Q.on(C.Draw.Event.EDITED,()=>{c.value||(Ne(),lt())}),Q.on(C.Draw.Event.DELETED,()=>{c.value||(Ne(),lt())});let j=!1;Q.on("mousemove",J=>{j||(Q.invalidateSize(),j=!0)}),Q.on("zoomend",()=>{w.value=Q.getZoom()}),q=Wt(),Z(),O(),_.value!==void 0&&(qe(_.value),_.value=void 0)}),o.watch(()=>a.center,C=>{!Array.isArray(C)||C.length!==2||(x.value=[...C],Q&&Q.setView(x.value,Q.getZoom()))},{deep:!0}),o.watch(()=>a.zoom,C=>{typeof C=="number"&&(w.value=C,Q&&Q.setZoom(C))}),o.onUnmounted(()=>{q?.(),Oe(),We&&Q?.hasLayer(We)&&(Q.removeLayer(We),We=null),Q?.remove&&Q.remove()}),o.watch(d,()=>{setTimeout(()=>{Q?.invalidateSize&&Q.invalidateSize()},50)}),o.watch(g,async C=>{if(!C||!b.value){y.value=null;return}await o.nextTick();const N=b.value.getBoundingClientRect();y.value={top:N.bottom+6,left:N.left}}),(C,N)=>(o.openBlock(),o.createBlock(o.Teleport,{to:"body",disabled:!d.value},[o.createElementVNode("div",{class:o.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:d.value}])},[o.createElementVNode("div",{ref_key:"mapContainer",ref:u,class:"w-full h-full"},null,512),o.createVNode(o.Transition,{name:"zoom-instructions","enter-active-class":"transition-all duration-200 ease-out","leave-active-class":"transition-all duration-500 ease-in","enter-from-class":"opacity-0","enter-to-class":"opacity-100","leave-from-class":"opacity-100","leave-to-class":"opacity-0"},{default:o.withCtx(()=>[p.value&&a.handleZoom?(o.openBlock(),o.createElementBlock("div",p$,[o.createElementVNode("div",h$,[o.createElementVNode("p",f$,o.toDisplayString(h.value),1)])])):o.createCommentVNode("",!0)]),_:1}),I.value.search||I.value.import||I.value.export?(o.openBlock(),o.createElementBlock("div",m$,[I.value.search?(o.openBlock(),o.createBlock(s$,{key:0,onGoToCoordinates:z})):o.createCommentVNode("",!0),I.value.import||I.value.export?(o.openBlock(),o.createElementBlock("div",g$,[o.createElementVNode("div",y$,[I.value.import?(o.openBlock(),o.createElementBlock("button",{key:0,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:Te,disabled:c.value}," Import ",8,b$)):o.createCommentVNode("",!0),I.value.export?(o.openBlock(),o.createElementBlock("button",{key:1,type:"button",class:"inline-flex items-center gap-2 text-sm font-medium border rounded-md px-3 py-2 bg-white text-blue-600 border-stone-200 hover:bg-blue-500 hover:text-white transition",onClick:ee,disabled:c.value||k.value===0}," Export ",8,k$)):o.createCommentVNode("",!0)]),o.createElementVNode("input",{ref_key:"importRef",ref:me,type:"file",onChange:K,accept:".json,.geojson",class:"hidden",disabled:c.value},null,40,w$)])):o.createCommentVNode("",!0)])):o.createCommentVNode("",!0),R.value.length?(o.openBlock(),o.createElementBlock("div",{key:1,class:"absolute z-[1500] pointer-events-none",style:o.normalizeStyle($.value)},[o.createElementVNode("div",x$,[o.createElementVNode("dl",v$,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(R.value,j=>(o.openBlock(),o.createElementBlock("div",{key:`${j.key}-${j.value}`,class:"flex justify-between gap-2"},[o.createElementVNode("dt",E$,o.toDisplayString(j.key),1),o.createElementVNode("dd",C$,o.toDisplayString(j.value),1)]))),128))])])],4)):o.createCommentVNode("",!0),o.createElementVNode("div",_$,[o.createElementVNode("div",S$,[I.value.point?(o.openBlock(),o.createElementBlock("button",{key:0,class:o.normalizeClass(["vs-btn",{"vs-active":T.value==="marker"}]),title:"Point",onClick:N[0]||(N[0]=j=>F("marker")),disabled:c.value},[o.createVNode(O6)],10,N$)):o.createCommentVNode("",!0),I.value.line?(o.openBlock(),o.createElementBlock("button",{key:1,class:o.normalizeClass(["vs-btn",{"vs-active":T.value==="polyline"}]),title:"Line",onClick:N[1]||(N[1]=j=>F("polyline")),disabled:c.value},[o.createVNode(R6)],10,V$)):o.createCommentVNode("",!0),I.value.polygon?(o.openBlock(),o.createElementBlock("button",{key:2,class:o.normalizeClass(["vs-btn",{"vs-active":T.value==="polygon"}]),title:"Polygon",onClick:N[2]||(N[2]=j=>F("polygon")),disabled:c.value},[o.createVNode(H6)],10,M$)):o.createCommentVNode("",!0),I.value.rectangle?(o.openBlock(),o.createElementBlock("button",{key:3,class:o.normalizeClass(["vs-btn",{"vs-active":T.value==="rectangle"}]),title:"Rectangle",onClick:N[3]||(N[3]=j=>F("rectangle")),disabled:c.value},[o.createVNode(q6)],10,B$)):o.createCommentVNode("",!0),o.createElementVNode("button",{class:"vs-btn mt-5",onClick:N[4]||(N[4]=j=>d.value=!d.value),title:"Full Screen"},[o.createVNode(Z6,{style:{width:"12px",height:"12px"}})])])]),o.createElementVNode("div",{class:o.normalizeClass(["absolute left-4 z-[1000]",m.value?"bottom-8":"bottom-4"])},[o.createElementVNode("div",A$,[o.createVNode(d$,{basemaps:o.unref(H),onOnLayerChange:se},null,8,["basemaps"]),M.value.length?(o.openBlock(),o.createElementBlock("div",T$,[N[9]||(N[9]=o.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Шари",-1)),o.createElementVNode("div",L$,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(M.value,j=>(o.openBlock(),o.createElementBlock("label",{key:j.id,class:"flex items-center gap-2 cursor-pointer select-none"},[o.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:j.visible,disabled:c.value,onChange:J=>he(j.id)},null,40,D$),o.createElementVNode("span",O$,o.toDisplayString(j.config.title||j.config.name||j.id),1)]))),128))])])):o.createCommentVNode("",!0)])],2),o.createElementVNode("div",I$,[m.value?(o.openBlock(),o.createElementBlock("div",F$,[o.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:N[5]||(N[5]=j=>g.value=!0),onMouseleave:N[6]||(N[6]=j=>g.value=!1)},[o.createElementVNode("div",$$,[N[10]||(N[10]=o.createTextVNode(" Type: ",-1)),o.createElementVNode("span",R$,o.toDisplayString(m.value.type),1)]),f.value?(o.openBlock(),o.createElementBlock("div",{key:0,ref_key:"addressEl",ref:b,class:"text-gray-500 text-xs truncate cursor-help",style:{"max-width":"260px"}}," Address: "+o.toDisplayString(f.value),513)):o.createCommentVNode("",!0),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[g.value&&f.value&&y.value?(o.openBlock(),o.createElementBlock("div",{key:0,class:"fixed z-[99999] pointer-events-none bg-gray-800 text-white text-xs px-2 py-1 rounded shadow whitespace-nowrap",style:o.normalizeStyle({top:y.value.top+"px",left:y.value.left+"px"})},o.toDisplayString(f.value),5)):o.createCommentVNode("",!0)]))],32),o.createElementVNode("div",P$,[o.createElementVNode("div",z$,[N[11]||(N[11]=o.createTextVNode(" Center: ",-1)),o.createElementVNode("b",null,o.toDisplayString(m.value.center.lat.toFixed(5))+", "+o.toDisplayString(m.value.center.lng.toFixed(5)),1)]),m.value.areaKm2!==null?(o.openBlock(),o.createElementBlock("div",j$,[N[12]||(N[12]=o.createTextVNode(" Area: ",-1)),o.createElementVNode("b",null,o.toDisplayString(m.value.areaKm2.toFixed(1))+" km²",1)])):(o.openBlock(),o.createElementBlock("div",H$,N[13]||(N[13]=[o.createTextVNode("Area: ",-1),o.createElementVNode("b",null,"—",-1)]))),o.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md mr-1 cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Zoom to feature",onClick:N[7]||(N[7]=j=>te()),disabled:c.value},N[14]||(N[14]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"w-3 h-3"},[o.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"}),o.createElementVNode("path",{d:"M7 10l6 0"}),o.createElementVNode("path",{d:"M10 7l0 6"}),o.createElementVNode("path",{d:"M21 21l-6 -6"})],-1)]),8,U$),o.createElementVNode("button",{class:"tool bg-gray-100 py-1.5 px-2 rounded-lg text-md cursor-pointer hover:bg-blue-500 hover:text-white transition-all",title:"Delete feature",onClick:N[8]||(N[8]=j=>ce()),disabled:c.value},[o.createVNode(Qr,{class:"w-3 h-3"})],8,W$)])])):o.createCommentVNode("",!0)])],2)],8,["disabled"]))}}),[["__scopeId","data-v-28dc067b"]]),K$=["data-focus"],q$={class:"flex items-center"},G$={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},Y$=["onClick","aria-label"],J$={key:0,class:"absolute text-gray-500 truncate pl-2"},Z$={class:"flex-1 min-w-[2px]"},X$=["placeholder"],Q$={class:"flex items-center shrink-0"},eR=["disabled"],Q0=o.defineComponent({__name:"vs-input-tag",props:o.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:o.mergeModels(["update:modelValue"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=e;Ot(t.style);const s=o.ref(null),l=o.ref(null),a=o.ref(null),i=o.ref(!1),c=o.ref(""),d=o.useModel(n,"modelValue"),u=o.computed(()=>t.placeholder||"Add tag…"),p=o.computed(()=>d.value?.length===0&&c.value===""),h=o.computed(()=>!t.disabled&&d.value?.length>0),f=o.computed(()=>t.disabled),m=async()=>{f.value||await o.nextTick(()=>a.value?.focus())},g=_=>{const E=_.trim();E!==""&&(!d.value||!Array.isArray(d.value)?d.value=[E]:t.unique?d.value.includes(E)||(d.value=[...d.value,E]):d.value=[...d.value,E],c.value="")},y=()=>{const _=c.value;_.trim()!==""&&g(_),c.value=""},b=_=>{const E=d.value.slice();E.splice(_,1),r("update:modelValue",E)},k=()=>{r("update:modelValue",[])},x=()=>{f.value||(i.value=!0)},w=()=>{i.value=!1,!f.value&&y()},v=_=>{const{key:E}=_;E==="Enter"?(_.preventDefault(),y()):E==="Backspace"&&c.value===""&&d.value.length>0&&b(d.value.length-1)};return(_,E)=>(o.openBlock(),o.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:s,onClick:E[1]||(E[1]=o.withModifiers(()=>{},["stop"]))},[o.createElementVNode("div",{class:o.normalizeClass(["relative w-full font-sans",t.customClass]),role:"group","aria-label":"Tag input"},[o.createElementVNode("div",{class:o.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",i.value?"border-blue-500 ring-1 ring-blue-500":"",f.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":i.value?"true":"false",onClick:m},[o.createElementVNode("div",{class:"flex flex-1 flex-wrap items-center gap-1 py-0.5 pl-2 pr-0 overflow-hidden",ref_key:"chipsRef",ref:l},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(d.value,(S,I)=>(o.openBlock(),o.createElementBlock("div",{key:I,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[o.createElementVNode("div",q$,[o.createElementVNode("div",G$,o.toDisplayString(S),1)]),o.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:o.withModifiers(A=>b(I),["stop"]),"aria-label":`Remove ${S}`},E[2]||(E[2]=[o.createElementVNode("svg",{height:"14",width:"14",viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",class:"inline-block fill-current stroke-current leading-none stroke-0"},[o.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,Y$)]))),128)),p.value?(o.openBlock(),o.createElementBlock("div",J$,o.toDisplayString(u.value),1)):o.createCommentVNode("",!0),o.createElementVNode("div",Z$,[f.value?o.createCommentVNode("",!0):o.withDirectives((o.openBlock(),o.createElementBlock("input",{key:0,ref_key:"inputRef",ref:a,class:"pl-2 w-full bg-transparent outline-none border-0 m-0 p-0 text-gray-900",autocapitalize:"none",autocomplete:"off",autocorrect:"off",spellcheck:"false",type:"text",tabindex:"0","aria-label":"Add tag","onUpdate:modelValue":E[0]||(E[0]=S=>c.value=S),onFocus:x,onBlur:w,onKeydown:v,placeholder:d.value&&d.value.length?"":void 0},null,40,X$)),[[o.vModelText,c.value]])])],512),o.createElementVNode("div",Q$,[h.value?(o.openBlock(),o.createElementBlock("button",{key:0,type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-label":"Clear all tags",disabled:f.value,onClick:o.withModifiers(k,["stop"])},E[3]||(E[3]=[o.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[o.createElementVNode("path",{d:"M14.348 14.849c-0.469 0.469-1.229 0.469-1.697 0l-2.651-3.030-2.651 3.029c-0.469 0.469-1.229 0.469-1.697 0-0.469-0.469-0.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-0.469-0.469-0.469-1.228 0-1.697s1.228-0.469 1.697 0l2.652 3.031 2.651-3.031c0.469-0.469 1.228-0.469 1.697 0s0.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c0.469 0.469 0.469 1.229 0 1.698z"})],-1)]),8,eR)):o.createCommentVNode("",!0)])],10,K$)],2)],512))}}),tR={class:"relative flex gap-1 bg-white w-full"},nR=["disabled","placeholder"],eg=Ve(o.defineComponent({__name:"vs-input-slug",props:o.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=o.inject("values"),t=n,r=o.useModel(n,"modelValue");function s(a){const i={а:"a",б:"b",в:"v",г:"g",д:"d",е:"e",ё:"e",ж:"zh",з:"z",и:"i",й:"y",к:"k",л:"l",м:"m",н:"n",о:"o",п:"p",р:"r",с:"s",т:"t",у:"u",ф:"f",х:"kh",ц:"ts",ч:"ch",ш:"sh",щ:"shch",ы:"y",э:"e",ю:"yu",я:"ya",ь:"",ъ:"",є:"ye",і:"i",ї:"yi",ґ:"g"};return a.toLowerCase().split("").map(c=>i[c]||c).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const l=()=>{const a=e?.value?.[t.parent||""]?.toString(),i=s(a);r.value=i.toString()};return(a,i)=>(o.openBlock(),o.createElementBlock("div",tR,[o.withDirectives(o.createElementVNode("input",{ref:"vsText",disabled:a.disabled,placeholder:a.placeholder,"onUpdate:modelValue":i[0]||(i[0]=c=>r.value=c),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,nR),[[o.vModelText,r.value]]),o.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:l}," Gen ")]))}}),[["__scopeId","data-v-b0eba370"]]),rR={class:"relative flex gap-1 bg-white w-full"},oR=["disabled","placeholder"],sR=["disabled"],lR={key:0},aR={key:1},tg=Ve(o.defineComponent({__name:"vs-input-codegen",props:o.mergeModels({table:{},code:{},init:{type:Boolean},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=o.useModel(n,"modelValue"),r=o.ref(!1),s=o.computed(()=>e.init!==!1),l=o.computed(()=>!!e.table&&!!e.code),a=()=>{if(!l.value)return"";const d=encodeURIComponent(String(e.table)),u=encodeURIComponent(String(e.code));return`/api/code-gen/${d}/${u}`},i=async()=>{if(!l.value||r.value)return;const d=a();if(d){r.value=!0;try{const p=await(await fetch(d)).text();t.value=p}finally{r.value=!1}}},c=()=>{s.value&&(t.value||i())};return o.onMounted(()=>{c()}),o.watch(()=>[e.table,e.code,e.init],()=>{c()}),(d,u)=>(o.openBlock(),o.createElementBlock("div",rR,[o.withDirectives(o.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":u[0]||(u[0]=p=>t.value=p),class:"block w-full px-3 py-2 text-sm border border-solid rounded-lg placeholder:text-nowrap border-stone-200 text-stone-800 placeholder:text-stone-400 focus:outline focus:z-10 focus:border-blue-500 focus:ring-blue-500 focus:outline-blue-500"},null,8,oR),[[o.vModelText,t.value]]),o.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200 disabled:opacity-50 disabled:cursor-not-allowed",disabled:r.value||d.disabled||!l.value,onClick:i},[r.value?(o.openBlock(),o.createElementBlock("span",aR,"...")):(o.openBlock(),o.createElementBlock("span",lR,"Gen"))],8,sR)]))}}),[["__scopeId","data-v-6ee5237d"]]),iR={class:"w-full"},cR={ref:"sortableContainer",class:"flex flex-col gap-1"},dR=["onDragstart","onDrop"],uR={class:"w-1/3"},pR={class:"w-2/3"},hR=["onClick"],fR={key:0,class:"text-[14px] text-gray-700"},mR={class:"mt-2 w-full flex items-center"},gR=["disabled"],ng=Ve(o.defineComponent({__name:"vs-input-key-value",props:{parent:{},ignore:{},addButtonText:{},modelValue:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=y=>`${y}-${Math.random().toString(36).substring(2,15)}`,r=o.inject("values"),s=n,l=e,a=s.addButtonText??"Додати",i=s.ignore??[],c=o.ref([]),d=o.ref(null);(()=>{const y=s.parent&&r?.value?.[s.parent]||s.modelValue||{};c.value=Object.entries(y).filter(([b])=>!i.includes(b)).map(([b,k])=>({id:t("key-value-"),key:b,value:k}))})();function p(y){d.value=y}function h(y){if(d.value===null||d.value===y)return;const b=c.value.splice(d.value,1)[0];c.value.splice(y,0,b),d.value=null}const f=o.computed(()=>c.value.some(y=>y.key&&!y.value||!y.key&&y.value)),m=()=>{c.value.push({id:t("key-value-"),key:"",value:""})},g=y=>{c.value=c.value.filter(b=>b.id!==y)};return o.watch(c,y=>{const b={};y.forEach(x=>{x.key&&x.value!==void 0&&(b[x.key]=x.value)});const k={};i.length&&i.forEach(x=>{k[x]=s.parent?r?.value?.[s.parent]?.[x]:void 0}),r?.value&&s.parent&&(r.value[s.parent]={...k,...b}),l("update:modelValue",b)},{deep:!0}),(y,b)=>(o.openBlock(),o.createElementBlock("div",iR,[o.createElementVNode("div",cR,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(c.value,(k,x)=>(o.openBlock(),o.createElementBlock("div",{key:k.id,class:o.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===x}]),draggable:"true",onDragstart:w=>p(x),onDragover:b[0]||(b[0]=o.withModifiers(()=>{},["prevent"])),onDrop:w=>h(x)},[b[1]||(b[1]=o.createStaticVNode('<button class="cursor-move" data-v-a0f7fbfc><svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-a0f7fbfc><circle cx="15" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="12" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="24" r="1.5" data-v-a0f7fbfc></circle><circle cx="21" cy="18" r="1.5" data-v-a0f7fbfc></circle><circle cx="15" cy="18" r="1.5" data-v-a0f7fbfc></circle></svg></button>',1)),o.createElementVNode("div",uR,[o.createVNode(Xr,{modelValue:k.key,"onUpdate:modelValue":w=>k.key=w,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),o.createElementVNode("div",pR,[o.createVNode(Xr,{modelValue:k.value,"onUpdate:modelValue":w=>k.value=w,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),o.createElementVNode("button",{onClick:w=>g(k.id),class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200"},[o.createVNode(o.unref(Ra),{height:"16",width:"16"})],8,hR)],42,dR))),128))],512),c.value.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("span",fR," Дані для відображення відсутні ")),o.createElementVNode("div",mR,[o.createElementVNode("button",{type:"button",onClick:m,disabled:f.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[o.createVNode(zn,{height:"14",width:"14"}),o.createTextVNode(" "+o.toDisplayString(o.unref(a)),1)],8,gR)])]))}}),[["__scopeId","data-v-a0f7fbfc"]]),yR={class:"w-full"},bR={ref:"sortableContainer",class:"flex flex-col gap-1"},kR=["onDragstart","onDrop"],wR=["disabled"],xR={class:"flex-1"},vR=["onClick","disabled"],ER={key:0,class:"text-[14px] text-gray-700"},CR={class:"mt-2 w-full flex items-center"},_R=["disabled"],rg=Ve(o.defineComponent({__name:"vs-input-text-array",props:o.mergeModels({addButtonText:{default:"Додати"},inputType:{default:"text"},placeholder:{default:"Значення"},mask:{default:""},disabled:{type:Boolean,default:!1}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=o.useModel(n,"modelValue"),r=o.ref([]),s=o.ref(null),l=o.computed(()=>!!e.disabled),a=o.computed(()=>e.placeholder??""),i=o.computed(()=>e.addButtonText??"Додати");let c=!1;const d=y=>`${y}-${Math.random().toString(36).substring(2,15)}`,u=y=>{const b=y??t.value??[];r.value=b.map((k,x)=>({id:r.value[x]?.id??d("text-array"),value:k??""}))};u(),o.watch(()=>t.value,y=>{if(c){c=!1;return}u(y||[])},{deep:!0}),o.watch(r,y=>{c=!0,t.value=y.map(b=>b.value).filter(b=>b!=null&&b!=="")},{deep:!0});const p=o.computed(()=>l.value||r.value.some(y=>!y.value));function h(){p.value||(r.value=[...r.value,{id:d("text-array"),value:""}])}function f(y){l.value||(r.value=r.value.filter(b=>b.id!==y))}function m(y){l.value||(s.value=y)}function g(y){if(l.value||s.value===null||s.value===y)return;const b=[...r.value],[k]=b.splice(s.value,1);b.splice(y,0,k),r.value=b,s.value=null}return(y,b)=>(o.openBlock(),o.createElementBlock("div",yR,[o.createElementVNode("div",bR,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(k,x)=>(o.openBlock(),o.createElementBlock("div",{key:k.id,class:o.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":s.value===x}]),draggable:"true",onDragstart:w=>m(x),onDragover:b[0]||(b[0]=o.withModifiers(()=>{},["prevent"])),onDrop:w=>g(x)},[o.createElementVNode("button",{class:"cursor-move",type:"button",disabled:l.value},b[1]||(b[1]=[o.createStaticVNode('<svg fill="#000000" width="20" height="20" viewBox="0 0 36 36" data-v-66316a33><circle cx="15" cy="12" r="1.5" data-v-66316a33></circle><circle cx="15" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="12" r="1.5" data-v-66316a33></circle><circle cx="21" cy="24" r="1.5" data-v-66316a33></circle><circle cx="21" cy="18" r="1.5" data-v-66316a33></circle><circle cx="15" cy="18" r="1.5" data-v-66316a33></circle></svg>',1)]),8,wR),o.createElementVNode("div",xR,[y.inputType==="text"?(o.openBlock(),o.createBlock(Xr,{key:0,modelValue:k.value,"onUpdate:modelValue":w=>k.value=w,disabled:l.value,placeholder:a.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):o.createCommentVNode("",!0),y.inputType==="tel"?(o.openBlock(),o.createBlock(Ua,{key:1,modelValue:k.value,"onUpdate:modelValue":w=>k.value=w,disabled:l.value,placeholder:a.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):o.createCommentVNode("",!0),y.inputType==="email"?(o.openBlock(),o.createBlock(Ha,{key:2,modelValue:k.value,"onUpdate:modelValue":w=>k.value=w,disabled:l.value,placeholder:a.value},null,8,["modelValue","onUpdate:modelValue","disabled","placeholder"])):o.createCommentVNode("",!0),y.inputType==="mask"?(o.openBlock(),o.createBlock(ja,{key:3,modelValue:k.value,"onUpdate:modelValue":w=>k.value=w,mask:y.mask,disabled:l.value,placeholder:a.value},null,8,["modelValue","onUpdate:modelValue","mask","disabled","placeholder"])):o.createCommentVNode("",!0)]),o.createElementVNode("button",{type:"button",onClick:w=>f(k.id),disabled:l.value,class:"shrink-0 w-[30px] text-gray-600 h-[30px] rounded-full flex items-center justify-center bg-gray-100 hover:bg-gray-200 disabled:opacity-50"},[o.createVNode(o.unref(Ra),{height:"16",width:"16"})],8,vR)],42,kR))),128))],512),r.value.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("span",ER," Дані для відображення відсутні ")),o.createElementVNode("div",CR,[o.createElementVNode("button",{type:"button",onClick:h,disabled:p.value,class:"py-1.5 px-2 flex items-center gap-x-1 text-xs font-medium rounded-full border border-dashed border-gray-200 bg-white text-gray-800 hover:bg-gray-50 disabled:opacity-50 disabled:cursor-not-allowed"},[o.createVNode(zn,{height:"14",width:"14"}),o.createTextVNode(" "+o.toDisplayString(i.value),1)],8,_R)])]))}}),[["__scopeId","data-v-66316a33"]]),SR={class:"flex items-center gap-2 w-full"},NR=["disabled"],VR=["disabled"],og=o.defineComponent({__name:"vs-input-color",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,{inputClass:r}=Ot(t.style),s=e,l=o.computed({get:()=>t.modelValue||"#000000",set:i=>s("update:modelValue",i)}),a=o.computed(()=>!!t.disabled);return(i,c)=>(o.openBlock(),o.createElementBlock("div",SR,[o.withDirectives(o.createElementVNode("input",{type:"color","onUpdate:modelValue":c[0]||(c[0]=d=>l.value=d),disabled:a.value,ref:"color",class:o.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[i.modelValue?"":"text-opacity-50",o.unref(r)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,NR),[[o.vModelText,l.value]]),o.withDirectives(o.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2","onUpdate:modelValue":c[1]||(c[1]=d=>l.value=d),disabled:a.value},null,8,VR),[[o.vModelText,l.value]])]))}}),MR={class:"flex items-center gap-2 w-full"},BR=["min","max","step","disabled"],AR=["disabled"],sg=o.defineComponent({__name:"vs-input-range",props:{style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:""},maxlength:{},minlength:{},min:{default:0},max:{default:100},step:{default:1}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,{inputClass:r}=Ot(t.style),s=e,l=o.computed({get:()=>Number(t.modelValue??t.min),set:i=>s("update:modelValue",Number(i))}),a=o.computed(()=>!!t.disabled);return(i,c)=>(o.openBlock(),o.createElementBlock("div",MR,[o.withDirectives(o.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>l.value=d),min:i.min,max:i.max,step:i.step,disabled:a.value,ref:"range",class:o.normalizeClass(["w-full cursor-pointer accent-blue-500",[i.modelValue?"":"text-opacity-50",o.unref(r)].join(" ")])},null,10,BR),[[o.vModelText,l.value]]),o.withDirectives(o.createElementVNode("input",{class:"text-sm text-gray-600 border border-solid border-stone-200 rounded-md p-2 max-w-[100px]",type:"number","onUpdate:modelValue":c[1]||(c[1]=d=>l.value=d),disabled:a.value},null,8,AR),[[o.vModelText,l.value]])]))}}),TR=["placeholder","disabled","name"],LR=["type","value","onInput","placeholder","disabled"],DR=["onClick"],lg=o.defineComponent({__name:"vs-input-array",props:o.mergeModels({count:{default:1},limit:{default:1},mask:{default:""},unmask:{type:Boolean,default:!1},inputType:{default:"text"},isAdded:{type:Boolean,default:!1},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=o.ref(e.count),r=o.computed(()=>e.limit),{inputClass:s}=Ot(e.style),l=o.useModel(n,"modelValue"),a=o.computed(()=>!!e.disabled),i=o.computed(()=>e.placeholder??"");o.watchEffect(()=>{const g=l.value?.length??0;g<t.value&&(l.value=[...l.value??[],...Array(t.value-g)])});const c=o.ref({}),d=o.ref({});function u(g,y){g&&(c.value[y]=g)}async function p(g,y){if(!g||e.inputType!=="mask")return;const{default:b}=await Promise.resolve().then(()=>Md);d.value[y]&&d.value[y].destroy(),d.value[y]=b(g,{mask:e.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),d.value[y].on("accept",()=>{const k=[...l.value||[]];k[y]=e.unmask?d.value[y].unmaskedValue:d.value[y].value,l.value=k}),d.value[y].on("complete",()=>{const k=[...l.value||[]];k[y]=e.unmask?d.value[y].unmaskedValue:d.value[y].value,l.value=k}),l.value?.[y]&&(d.value[y].value=l.value[y])}function h(g,y){if(a.value)return;const b=g.target.value??null,k=[...l.value];k[y]=e.inputType==="text"?b:Number(b),l.value=k}function f(){t.value+=1;const g=e.inputType==="text"||e.inputType==="mask"?null:0;l.value=[...l.value,g],e.inputType==="mask"&&setTimeout(()=>{const y=t.value-1;c.value[y]&&p(c.value[y],y)},0)}function m(g){if(t.value>1){d.value[g]&&(d.value[g].destroy(),delete d.value[g]),t.value-=1,l.value=l.value.filter((b,k)=>k!==g);const y={};Object.keys(d.value).forEach(b=>{const k=parseInt(b,10);k>g?y[k-1]=d.value[k]:k<g&&(y[k]=d.value[k])}),d.value=y}}return o.onMounted(()=>{if(e.inputType==="mask")for(let g=0;g<t.value;g+=1)c.value[g]&&p(c.value[g],g)}),o.onBeforeUnmount(()=>{Object.values(d.value).forEach(g=>{g&&g.destroy()})}),o.watch(()=>e.mask,g=>{e.inputType==="mask"&&Object.values(d.value).forEach(y=>{y&&y.updateOptions({mask:g,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})})}),o.watch(l,g=>{e.inputType==="mask"&&g&&g.forEach((y,b)=>{d.value[b]&&d.value[b].value!==y&&(d.value[b].value=y||"")})},{deep:!0}),(g,y)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["grid gap-2",`grid-cols-${r.value}`])},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(t.value,b=>(o.openBlock(),o.createElementBlock("div",{key:b,class:"flex items-center gap-2 w-full"},[g.inputType==="mask"?(o.openBlock(),o.createElementBlock("input",{key:0,type:"text",ref_for:!0,ref:k=>u(k,b-1),placeholder:g.placeholder,disabled:g.disabled,name:`${g.name}[${b-1}]`,class:o.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[o.unref(s),{"!border-red-600":g.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,TR)):(o.openBlock(),o.createElementBlock("input",{key:1,type:g.inputType,value:l.value?.[b-1],onInput:k=>h(k,b-1),placeholder:i.value,disabled:a.value,class:o.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[o.unref(s),{"!border-red-600":g.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,LR)),!g.disabled&&b===t.value&&g.isAdded?(o.openBlock(),o.createElementBlock("button",{key:2,type:"button",onClick:o.withModifiers(f,["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-green-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[o.createVNode(zn,{height:"18",width:"18"})])):o.createCommentVNode("",!0),!g.disabled&&t.value>1&&g.isAdded?(o.openBlock(),o.createElementBlock("button",{key:3,type:"button",onClick:o.withModifiers(k=>m(b-1),["stop"]),class:"cursor-pointer shrink-0 w-[38px] text-red-600 h-[38px] rounded-md flex items-center justify-center border border-stone-200 hover:bg-stone-100"},[o.createVNode(Ra,{height:"18",width:"18"})],8,DR)):o.createCommentVNode("",!0)]))),128))],2))}}),OR={class:"flex items-center gap-2 w-full"},IR={class:"relative flex-1"},FR=["placeholder","disabled","onKeydown"],$R=["disabled"],RR={key:0,xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},PR={key:1,class:"animate-spin h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},zR={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},jR={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},HR={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},UR=["onClick"],WR={key:0,class:"p-4 text-sm text-gray-500"},ag=o.defineComponent({__name:"vs-input-address",props:o.mergeModels({api:{default:""},geom:{default:""},includes:{default:()=>[]},bbox:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:""},modelModifiers:{}}),emits:o.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(n,{emit:e}){const t=/{{\s*([^}]+?)\s*}}/g,r=n,s=e,{inputClass:l}=Ot(r.style),a=o.useModel(n,"modelValue"),i=o.computed({get:()=>a.value,set:_=>{a.value=_}}),c=o.ref(!1),d=o.ref([]),u=o.ref(!1),p=o.computed(()=>r.placeholder??""),h=o.computed(()=>!!r.disabled),f=_=>{if(!_)return null;if(Array.isArray(_))return _;if(typeof _=="string"){const E=_.split(",").map(S=>S.trim()).filter(Boolean);return E.length!==4?null:E.map(Number)}return null},m=o.computed(()=>{const _=f(r.bbox);if(!_||_.length!==4)return null;const E=_.map(Number);return E.some(S=>Number.isNaN(S))?null:E}),g=o.computed(()=>{const _=m.value;if(!_)return"";const[E,S,I,A]=_;return`${E},${Math.max(S,A)},${I},${Math.min(S,A)}`});o.computed(()=>g.value?"1":"0");const y=o.inject("values");function b(){!h.value&&i.value.trim()&&k()}async function k(){const _=(i.value||"").trim();if(!_)return;let E=_;if(r.includes?.length&&y?.value){const I=r.includes.map(A=>y.value?.[A]).filter(Boolean);I.length&&(E=`${I.join(", ")}, ${_}`)}const S=v(E);if(S){c.value=!0;try{const A=await(await fetch(S)).json();d.value=Array.isArray(A)?A:[],u.value=!0}catch(I){console.error("Address search error:",I)}finally{c.value=!1}}}function x(){u.value=!u.value}function w(_){if(!_)return;u.value=!1;const E=parseFloat(_.lat),I={type:"Point",coordinates:[parseFloat(_.lon),E]};r.geom&&y?.value&&(y.value[r.geom]=I),s("update:geom",I)}function v(_){if(!r.api)return"";const E={value:encodeURIComponent(_),bbox:g.value};return r.api.replace(t,(S,I)=>E[I.trim()]??"")}return(_,E)=>(o.openBlock(),o.createElementBlock("div",OR,[o.createElementVNode("div",IR,[o.withDirectives(o.createElementVNode("input",{type:"text","onUpdate:modelValue":E[0]||(E[0]=S=>i.value=S),placeholder:p.value,disabled:h.value,class:o.normalizeClass(["py-1.5 px-3 block w-full bg-white border rounded-md placeholder:text-gray-400 focus:ring-2 focus:ring-blue-500",[o.unref(l),{"!border-red-600":r.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:o.withKeys(o.withModifiers(b,["prevent"]),["enter"])},null,42,FR),[[o.vModelText,i.value]]),d.value.length?(o.openBlock(),o.createElementBlock("button",{key:0,type:"button",class:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-blue-600",onClick:x,title:"Show search results"},E[2]||(E[2]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),o.createElementVNode("path",{d:"M12 16v-4"}),o.createElementVNode("path",{d:"M12 8h.01"})],-1)]))):o.createCommentVNode("",!0)]),o.createElementVNode("button",{type:"button",onClick:k,class:"flex items-center justify-center px-2 py-2 border rounded-md bg-white hover:bg-gray-50 text-gray-600 hover:text-blue-600 disabled:opacity-50 h-[38px]",disabled:c.value||!i.value?.trim()},[c.value?(o.openBlock(),o.createElementBlock("svg",PR,E[4]||(E[4]=[o.createElementVNode("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),o.createElementVNode("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)]))):(o.openBlock(),o.createElementBlock("svg",RR,E[3]||(E[3]=[o.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),o.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},null,-1)])))],8,$R),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[u.value?(o.openBlock(),o.createElementBlock("div",zR,[o.createElementVNode("div",jR,[o.createElementVNode("div",HR,[E[6]||(E[6]=o.createElementVNode("span",null,"Search results",-1)),o.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:E[1]||(E[1]=S=>u.value=!1),title:"Close"},E[5]||(E[5]=[o.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[o.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),o.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)]))]),o.createElementVNode("ul",null,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(d.value,(S,I)=>(o.openBlock(),o.createElementBlock("li",{key:I,onClick:A=>w(S),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},o.toDisplayString(S.display_name),9,UR))),128))]),d.value.length?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",WR," No results found "))])])):o.createCommentVNode("",!0)]))]))}}),ig=(n="")=>`${n}${Math.floor(Math.random()*1e4)}`,KR={class:"vs-datalist space-y-3"},qR={class:"space-y-3"},GR=["onClick","disabled"],YR={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},JR=["disabled"],ZR=Ve(o.defineComponent({__name:"vs-input-datalist",props:o.mergeModels({schema:{default:()=>[]},minItems:{default:0},maxItems:{default:void 0},addButtonText:{default:"Додати позицію"},emptyLabel:{default:"Немає рядків"},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=o.useModel(n,"modelValue"),r=o.computed(()=>Array.isArray(t.value)?t.value:[]),s=o.ref([]),l=o.computed(()=>e.schema?.map(g=>({...g,disabled:e.disabled||g.disabled}))??[]),a=o.computed(()=>l.value.map(g=>m(g))),i=o.computed(()=>e.disabled?!1:e.maxItems?r.value.length<e.maxItems:!0),c=o.computed(()=>e.disabled||r.value.length<=(e.minItems||0));o.watch(()=>r.value.length,()=>{d(),u()},{immediate:!0}),o.watch(()=>e.schema,u,{immediate:!0,deep:!0});function d(){const g=r.value.length;s.value.length<g?s.value=[...s.value,...Array.from({length:g-s.value.length},()=>ig())]:s.value.length>g&&s.value.splice(g)}function u(){if(!e.minItems||r.value.length>=e.minItems)return;const g=e.minItems-r.value.length,y=Array.from({length:g},p);t.value=[...r.value,...y]}function p(){const g={};return l.value.forEach(y=>{g[y.name]=y?.default??null}),g}function h(){i.value&&(t.value=[...r.value,p()],d())}function f(g){c.value||(t.value=r.value.filter((y,b)=>b!==g),d(),u())}function m(g){return{...g}}return(g,y)=>(o.openBlock(),o.createElementBlock("div",KR,[o.createElementVNode("div",qR,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(b,k)=>(o.openBlock(),o.createElementBlock("div",{key:s.value[k],class:"flex items-center gap-3"},[o.createVNode(Qn,{schema:a.value,layout:"inline",navigation:!1,values:r.value[k],"onUpdate:values":x=>r.value[k]=x,"form-id":s.value[k]},null,8,["schema","values","onUpdate:values","form-id"]),o.createElementVNode("button",{type:"button",class:"h-[38px] w-[38px] flex items-center justify-center text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",onClick:x=>f(k),disabled:c.value},[o.createVNode(Qr,{class:"w-5 h-5"})],8,GR)]))),128)),r.value.length===0?(o.openBlock(),o.createElementBlock("div",YR,o.toDisplayString(e.emptyLabel),1)):o.createCommentVNode("",!0)]),o.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:h,disabled:!i.value},[o.createVNode(zn,{class:"w-5 h-5"}),o.createTextVNode(" "+o.toDisplayString(e.addButtonText),1)],8,JR)]))}}),[["__scopeId","data-v-e8a02c8e"]]),XR={};function QR(n,e){return o.openBlock(),o.createElementBlock("svg",o.mergeProps({xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},n.$attrs),e[0]||(e[0]=[o.createElementVNode("rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"},null,-1),o.createElementVNode("path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"},null,-1)]),16)}const e8=Ve(XR,[["render",QR]]),t8={class:"vs-dataform space-y-4"},n8={class:"flex items-center justify-between mb-3"},r8={class:"text-sm font-medium text-gray-700"},o8={class:"flex items-center gap-2"},s8=["title","onClick","disabled"],l8=["title","onClick","disabled"],a8={key:0,class:"rounded-lg border border-dashed border-gray-200 p-4 text-sm text-gray-500"},i8=["disabled"],cg={VsInputText:Xr,VsInputRadio:Wa,"vs-input-text":Xr,"vs-input-password":wy,"vs-input-textarea":Yd,"vs-input-richtext":Y0,"vs-input-mask":ja,"vs-input-number":$d,"vs-input-radio":Wa,"vs-input-select":Ka,"vs-input-switcher":Pa,"vs-input-static":za,"vs-input-container":Gd,"vs-input-date":mb,"vs-input-checkbox":Rd,"vs-input-file":Wd,"vs-input-html":za,"vs-input-email":Ha,"vs-input-tel":Ua,"vs-input-datatable":Z0,"vs-input-map":X0,"vs-input-file-list":Kd,"vs-input-tags":Q0,"vs-input-slug":eg,"vs-input-codegen":tg,"vs-input-key-value":ng,"vs-input-text[]":rg,"vs-input-range":sg,"vs-input-color":og,"vs-input-native-select":Ka,"vs-input-array":lg,"vs-input-address":ag,"vs-input-datalist":ZR,"vs-input-dataform":Ve(o.defineComponent({__name:"vs-input-dataform",props:o.mergeModels({schema:{default:()=>[]},minGroups:{default:0},maxGroups:{default:void 0},addButtonText:{default:"Додати групу фільтрів"},groupLabel:{default:"Якщо поле"},duplicateTitle:{default:"Дублювати групу"},removeTitle:{default:"Видалити групу"},emptyLabel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{},maxlength:{},minlength:{}},{modelValue:{default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=o.useModel(n,"modelValue"),r=o.ref([]),s=o.computed(()=>e.groupLabel),l=o.computed(()=>e.emptyLabel??"Ще немає груп"),a=o.computed(()=>e.schema?.map(b=>({...b,disabled:e.disabled||b.disabled}))??[]),i=o.computed(()=>a.value.map(b=>y(b))),c=o.computed(()=>e.disabled?!1:e.maxGroups?t.value.length<e.maxGroups:!0),d=o.computed(()=>e.disabled||t.value.length<=(e.minGroups||0));o.watch(()=>t.value.length,()=>{u(),p()},{immediate:!0}),o.watch(()=>e.schema,p,{immediate:!0,deep:!0});function u(){const b=t.value.length;r.value.length<b?r.value=[...r.value,...Array.from({length:b-r.value.length},()=>ig())]:r.value.length>b&&r.value.splice(b)}function p(){if(!e.minGroups||t.value.length>=e.minGroups)return;const b=e.minGroups-t.value.length,k=Array.from({length:b},h);t.value=[...t.value,...k]}function h(){const b={};return a.value.forEach(k=>{b[k.name]=k?.default??null}),b}function f(){c.value&&(t.value=[...t.value,h()],u())}function m(b){d.value||(t.value=t.value.filter((k,x)=>x!==b),u(),p())}function g(b){if(e.disabled)return;const k=JSON.parse(JSON.stringify(t.value[b]??{}));t.value=[...t.value.slice(0,b+1),k,...t.value.slice(b+1)],u()}function y(b){return{...b}}return(b,k)=>(o.openBlock(),o.createElementBlock("div",t8,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(t.value,(x,w)=>(o.openBlock(),o.createElementBlock("div",{key:r.value[w],class:"relative border border-gray-200 rounded-lg p-6 bg-white"},[o.createElementVNode("div",n8,[o.createElementVNode("div",r8,o.toDisplayString(s.value),1),o.createElementVNode("div",o8,[o.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:e.duplicateTitle,onClick:v=>g(w),disabled:e.disabled},[o.createVNode(e8,{class:"w-5 h-5"})],8,s8),o.createElementVNode("button",{type:"button",class:"p-2 text-gray-400 hover:text-gray-600 hover:bg-gray-50 rounded-lg transition-all disabled:opacity-40",title:e.removeTitle,onClick:v=>m(w),disabled:d.value},[o.createVNode(Qr,{class:"w-5 h-5"})],8,l8)])]),o.createVNode(Qn,{class:"vs-dataform__form",schema:i.value,layout:"inline",navigation:!1,values:t.value[w],"onUpdate:values":v=>t.value[w]=v,"form-id":r.value[w],disabled:e.disabled},null,8,["schema","values","onUpdate:values","form-id","disabled"])]))),128)),t.value.length===0?(o.openBlock(),o.createElementBlock("div",a8,o.toDisplayString(l.value),1)):o.createCommentVNode("",!0),o.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-gray-600 hover:text-gray-900 font-medium transition-colors text-sm",onClick:f,disabled:!c.value},[o.createVNode(zn,{class:"w-5 h-5"}),o.createTextVNode(" "+o.toDisplayString(e.addButtonText),1)],8,i8)]))}}),[["__scopeId","data-v-4dc5a1a3"]])},c8=o.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(n){const e=n,t=o.inject("values");async function r(){try{if(!e.api)return;const s=e.api.replace("{{value}}",e.value),l=await fetch(s);if(!l.ok){nt.notify({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const a=await l.json();if(!e.set||!t)return;for(const[i,c]of Object.entries(e.set))t.value[i]=a.result[c]}catch(s){console.error(e.error,s)}}return(s,l)=>(o.openBlock(),o.createElementBlock("button",{onClick:r,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"},o.toDisplayString(s.button),1))}}),d8={class:"flex flex-col gap-1 w-full"},u8=["innerHTML"],dg=o.defineComponent({__name:"vs-compact-form-layout",props:o.mergeModels({item:{default:{}},layout:{default:"default"},style:{default:{}},type:{default:""},error:{type:[String,Boolean]},columns:{default:()=>({container:12,label:3})}},{modelValue:{default:null},modelModifiers:{}}),emits:o.mergeModels(["value-selected"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=o.useModel(n,"modelValue"),s=e,l=o.computed(()=>by[`${t.layout}`]),a=["label","placeholder","info","description","text","html"],i=o.ref(b()),c=o.computed(()=>m(t.item,i.value)),d=o.computed(()=>cg?.[`vs-input-${t.item.type}`]),u=o.inject("field-props"),p=o.computed(()=>{const x=o.unref(d);if(!x)return new Set;const w=x.props??x.__vccOpts?.props;if(!w)return new Set;const v=Array.isArray(w)?w:Object.keys(w);return new Set(v)}),h=o.computed(()=>{const x={...c.value??{}},w=t.item?.name;w&&u?.value?.[w]&&Object.assign(x,u.value[w]);const v=p.value;return v.size?Object.fromEntries(Object.entries(x).filter(([_])=>v.has(_))):{}}),f=x=>{const w=typeof x=="object"&&x!==null?x:{value:x};s("value-selected",{...w,name:w.name??t.item?.name})};o.onMounted(()=>{i.value=b(),window.addEventListener("storage",k)}),o.onUnmounted(()=>{window.removeEventListener("storage",k)});function m(x,w){if(!x)return{};const v={...x};return a.forEach(_=>{const E=y(x,_,w);E!=null&&(v[_]=E)}),Array.isArray(x.options)&&(v.options=x.options.map(_=>g(_,w))),v}function g(x,w){if(!x)return x;const v={...x},_=y(x,"label",w),E=y(x,"text",w);return _!=null&&(v.label=_),E!=null?v.text=E:_!=null&&(v.text=_),v}function y(x,w,v){const _=`${w}:${v}`;if(x?.[_]!=null)return x[_];if(w==="label"&&x?.[v]!=null)return x[v];if(x?.[w]!=null)return x[w];if(w==="label"){if(x?.ua!=null)return x.ua;if(x?.en!=null)return x.en}if(w==="text"||w==="html"){if(x?.ua!=null)return x.ua;if(x?.en!=null)return x.en}return null}function b(){return typeof window>"u"?"uk":localStorage.getItem("locale")||"uk"}function k(){i.value=b()}return(x,w)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(l.value),{ua:c.value.ua,error:t.error||"",item:c.value,columns:t.columns,label:c.value.label},{default:o.withCtx(()=>[o.createElementVNode("div",{class:o.normalizeClass(["flex w-full",`${t.item.type}-component`])},[o.createElementVNode("div",d8,[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(d.value),o.mergeProps(h.value,{modelValue:r.value,"onUpdate:modelValue":w[0]||(w[0]=v=>r.value=v),onValueSelected:f}),null,16,["modelValue"])),c.value.description&&t.layout!=="settings"?(o.openBlock(),o.createElementBlock("p",{key:0,class:"text-sm text-gray-500",innerHTML:c.value.description},null,8,u8)):o.createCommentVNode("",!0)]),c.value.behavior?.api&&c.value.behavior?.button?(o.openBlock(),o.createBlock(c8,o.mergeProps({key:0},c.value.behavior,{value:r.value}),null,16,["value"])):o.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),p8={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},h8={class:"vs-compact-form-navigation__rail mt-[6px]"},f8=["onClick"],m8=Ve(o.defineComponent({__name:"vs-compact-form-navigation",props:{target:{},scrollContainer:{},title:{default:"Навігація"},enabled:{type:Boolean,default:!0},width:{default:400}},setup(n,{expose:e}){const t=n,r=o.ref([]),s=o.ref(""),l=o.ref(""),a=o.computed(()=>!!t.enabled),i=o.computed(()=>["vs-compact-form-navigation flex flex-col pl-[6px] pt-[8px] pr-[8px]","sticky top-0 self-start shrink-0","max-h-full min-h-0 overflow-y-auto"]),c=o.computed(()=>{const V=t.width;if(V==null)return{};const M=typeof V=="number"?`${V}px`:`${V}`;return{width:M,minWidth:M}});let d=null,u=0,p=0,h=null,f=null,m=null;const g=()=>I(),y=()=>k();o.watch(()=>t.target,async V=>{if(_(),!V){h=null,r.value=[],s.value="";return}h=V,a.value&&(await o.nextTick(),v(V),k())},{immediate:!0}),o.watch(()=>t.scrollContainer,V=>{if(!a.value){f=V??null;return}b(V??null),o.nextTick(()=>k())},{immediate:!0}),o.onMounted(()=>{t.scrollContainer||b(null),k()}),o.onBeforeUnmount(()=>{_(),b(null,!0),h=null,typeof window<"u"&&(u&&window.cancelAnimationFrame(u),p&&window.cancelAnimationFrame(p))});function b(V,M=!1){if(m&&(m(),m=null),M){f=null;return}if(f=V??null,typeof window>"u")return;const U=V??window,R=window;U.addEventListener("scroll",g,{passive:!0}),R.addEventListener("resize",y),m=()=>{U.removeEventListener("scroll",g),R.removeEventListener("resize",y)}}function k(){if(!a.value||!h)return;u&&typeof window<"u"&&window.cancelAnimationFrame(u);const V=()=>{x(),u=0};typeof window>"u"?V():u=window.requestAnimationFrame(V)}function x(){if(!a.value||!h)return;const V=Array.from(h.querySelectorAll("h1, h2")),M=new Set,U=[];V.forEach((R,$)=>{const D=R.textContent?.trim()??"";if(!D)return;let P=(R.getAttribute("id")??"").trim();P||(P=w(D)||`heading-${$+1}`);let H=P,G=1;for(;M.has(H);)H=`${P}-${G+=1}`;R.id!==H&&Object.assign(R,{id:H}),M.add(H),U.push({id:H,text:D,level:R.tagName.toLowerCase()==="h1"?1:2})}),r.value=U,U.length||(s.value=""),S()}function w(V){return V.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function v(V){!V||!a.value||typeof MutationObserver>"u"||(_(),d=new MutationObserver(()=>k()),d.observe(V,{childList:!0,subtree:!0}))}function _(){d&&(d.disconnect(),d=null)}function E(V){const M=f;if(!M)return typeof window>"u"?V.offsetTop:V.getBoundingClientRect().top+window.scrollY;const U=V.getBoundingClientRect(),R=M.getBoundingClientRect();return U.top-R.top+M.scrollTop}function S(){if(!a.value||!r.value.length)return;const V=f,M=(V?V.scrollTop:null)||(typeof window<"u"?window.scrollY:0),U=(V?V.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),R=M+U;let $=null;for(let P=0;P<r.value.length;P+=1){const H=r.value[P],G=document.getElementById(H.id);if(G){const ie=E(G);ie+G.offsetHeight>M&&ie<R&&($=H.id)}}!$&&l.value&&($=l.value),$&&(l.value=$);const D=V?V.scrollHeight-V.clientHeight:document.documentElement.scrollHeight-window.innerHeight;M+5>=D&&($=r.value[r.value.length-1].id),$&&(s.value=$)}function I(){a.value&&(p&&window.cancelAnimationFrame(p),p=window.requestAnimationFrame(()=>{S(),p=0}))}function A(V){if(!a.value)return;const M=document.getElementById(V);if(!M)return;const U=f,R=Math.max(0,E(M));U?U.scrollTo({top:R,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:R,behavior:"smooth"})}return e({refresh:k}),(V,M)=>a.value&&r.value.length?(o.openBlock(),o.createElementBlock("div",{key:0,class:o.normalizeClass(i.value),style:o.normalizeStyle(c.value)},[o.createElementVNode("h2",p8,o.toDisplayString(V.title),1),o.createElementVNode("div",h8,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,U=>(o.openBlock(),o.createElementBlock("div",{key:U.id,class:o.normalizeClass(["vs-compact-form-navigation__item relative",U.level===2?"vs-compact-form-navigation__item--nested":"",U.id===s.value?"vs-compact-form-navigation__item--active":""])},[o.createElementVNode("button",{type:"button",onClick:R=>A(U.id),class:o.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",U.level===2?"pl-[15px]":"pl-[18px]",U.id===s.value?"text-gray-800":"text-gray-500"])},[o.createElementVNode("span",null,o.toDisplayString(U.text),1)],10,f8)],2))),128))])],6)):o.createCommentVNode("",!0)}}),[["__scopeId","data-v-1584a562"]]),Jr={required:"Це поле є обов’язковим",email:"Неправильний email",tel:"Неправильний телефон",minlength:n=>`Мінімальна довжина — ${n} символів`,maxlength:n=>`Максимальна довжина — ${n} символів`},g8=n=>typeof n=="string"?n.trim()?!1:Jr.required:Array.isArray(n)?n.map(t=>typeof t=="string"?t.trim():t).filter(t=>t!=null&&t!=="").length?!1:Jr.required:n?!1:Jr.required,y8=n=>{const e=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return n?e.test(n)?!1:Jr.email:!1},b8=n=>{const e=/^\+[1-9]\d{1,14}$/;return n?e.test(n)?!1:Jr.tel:!1},ug=n=>n==null?0:typeof n=="string"?n.trim().length:Array.isArray(n)?n.length:typeof n=="number"?n.toString().length:String(n).length,k8=(n,e)=>{if(n==null)return!1;const t=Number(e?.value??e?.length);return Number.isFinite(t)&&ug(n)<t?e?.message||Jr.minlength(t):!1},w8=(n,e)=>{if(n==null||n==="")return!1;const t=Number(e?.value??e?.length);return Number.isFinite(t)&&ug(n)>t?e?.message||Jr.maxlength(t):!1},x8=(n,e)=>{const t=e.pattern??e.regexp,r=typeof t=="string"?new RegExp(t):t;if(Array.isArray(n)){const s=n.filter(Boolean);return s.length===0||s.every(l=>r.test(l))?!1:e.message}return!r.test(n)&&n?e.message:!1},v8=(n,e)=>!1,E8=(n,e)=>{switch(typeof e=="string"?e:e.type){case"required":return g8(n);case"email":return y8(n);case"tel":return b8(n);case"regexp":return x8(n,e);case"minlength":return k8(n,e);case"maxlength":return w8(n,e);case"custom":return v8();default:return!1}},C8={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",file:"file",dropzone:"file"};function pg(n){const e=n?.toLowerCase();return C8[e]||e}function kd(n,e=!1){if(Array.isArray(n)){const r=[];return n.forEach(s=>{const l={...s};l.name=(s.name||s.id||s.key||"").toString(),l.type=pg(s.type),l.label=s.label||s.ua,l.rules=s.rules||s.validators,l.type==="email"&&!l.rules&&(l.rules=["email"]),s.data&&(l.api=`/api/suggest/${s.data}`),l.disabled=l.disabled||e,Array.isArray(l.schema)&&(l.schema=kd(l.schema,l.disabled)),r.push(l)}),r}const t=[];return Object.entries(n).forEach(r=>{const s={name:r[0],...r[1],type:pg(r[1].type),label:r[1].label||r[1].ua,rules:r[1].rules||r[1].validators,disabled:r[1].disabled||e};s.type==="email"&&!s.rules&&(s.rules=["email"]),r[1].type?.includes("list")&&(s.multiple=!0),!s.api&&r[1].data&&(s.api=`/api/suggest/${r[1].data}`),Array.isArray(s.schema)&&(s.schema=kd(s.schema,s.disabled)),t.push(s)}),t}function _8(n,e,t=!1){const r=o.computed(()=>kd((Array.isArray(e),e),typeof t=="boolean"?t:t.value)),s=o.ref({});function l(d){const u=d?.conditions;if(!u)return!0;const p=Array.isArray(u)?u[0]:u,h=n?.value?.[p];return qd(h,u)}const a=(d=r.value,u=!0)=>(d.forEach(p=>{const h=[],f=Number(p?.minlength),m=Number(p?.maxlength);!Number.isNaN(f)&&Number.isFinite(f)&&h.push({type:"minlength",value:f}),!Number.isNaN(m)&&Number.isFinite(m)&&h.push({type:"maxlength",value:m});const g=[...h,...p.rules||[]];if(g.length){if(!l(p)){delete s.value[p.name];return}let y=!1,b=null;g.forEach(k=>{const x=E8(n.value[p.name],k);x&&(y=!0,!b&&typeof x=="string"&&(b=x))}),y&&b?s.value[p.name]=b:delete s.value[p.name]}p.schema&&a(p.schema,!1)}),u&&Object.values(s.value).some(Boolean)?s.value:null),i=o.computed(()=>r.value?.filter(d=>d.hidden!==!0&&l(d)));return{errors:s,validate:a,reset:()=>{n.value={},s.value={}},visibleSchema:i}}const S8={class:"flex w-full h-full min-h-0 gap-6"},N8={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},Qn=o.defineComponent({__name:"vs-compact-form",props:o.mergeModels({schema:{default:()=>[]},style:{default:()=>({})},modelValue:{},layout:{default:()=>"default"},formId:{default:()=>""},disabled:{type:Boolean,default:!1},navigation:{type:Boolean,default:!1},navWidth:{default:400},columns:{}},{form:{default:()=>({})},formModifiers:{},modelValue:{default:()=>({})},modelModifiers:{},values:{default:void 0},valuesModifiers:{}}),emits:o.mergeModels(["handle-submit","update:modelValue","value-selected"],["update:form","update:modelValue","update:values"]),setup(n,{expose:e,emit:t}){const r=t,s=n,l=o.useModel(n,"form"),a=o.useModel(n,"modelValue"),i=o.useModel(n,"values"),c=o.computed({get:()=>i.value??a.value,set:M=>{a.value=M,i.value=M}}),{errors:d,validate:u,reset:p,visibleSchema:h}=_8(c,s.schema,o.toRef(s,"disabled")),f=o.ref(null),m=o.ref(null),g=o.ref({}),y=o.computed(()=>s.navigation),b=o.computed(()=>s.navWidth),k=o.computed(()=>s.style?.columns),x=Object.freeze({container:12,label:3}),w=o.computed(()=>s.columns??k.value??x),v=o.computed(()=>s.columns!=null||k.value!=null),_=o.computed(()=>v.value?"horizontal":s.layout),E=M=>M?.columns?"horizontal":_.value,S=M=>M?.columns??w.value,I=()=>{r("update:modelValue",c.value),u(),r("handle-submit",c.value)},A=M=>{r("value-selected",M)};e({validate:u,reset:p,errors:d}),o.onMounted(()=>{l.value={value:c.value,errors:d.value,reset:p,validate:u,formId:s.formId}});function V(M,U){if(M===U)return!0;if(typeof M!="object"||typeof U!="object"||!M||!U)return!1;const R=Object.keys(M),$=Object.keys(U);return R.length!==$.length?!1:R.every(D=>M[D]===U[D])}return o.provide("form",l),o.provide("values",c),o.provide("field-props",g),(M,U)=>(o.openBlock(),o.createElementBlock("div",S8,[o.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:m},[o.createElementVNode("form",{ref_key:"formRef",ref:f,onSubmit:o.withModifiers(I,["prevent"]),class:o.normalizeClass(["grid grid-cols-12 p-1",_.value==="default"?"gap-6":"gap-4"])},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(h),(R,$)=>(o.openBlock(),o.createElementBlock("div",{key:R.name,class:o.normalizeClass(E(R)==="horizontal"?"col-span-12":`col-span-${R.col||12}`)},[o.createVNode(dg,{style:o.normalizeStyle(M.style),item:R,layout:E(R),columns:S(R),"model-value":c.value[R.name],"onUpdate:modelValue":D=>{const P=c.value[R.name];V(P,D)||(c.value[R.name]=D)},error:o.unref(d)[R.name],onValueSelected:A},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),E(R)==="settings"&&$+1!==o.unref(h).length?(o.openBlock(),o.createElementBlock("div",N8)):o.createCommentVNode("",!0)],2))),128))],34)],512),o.createVNode(m8,{target:f.value,"scroll-container":m.value,enabled:y.value,width:b.value},null,8,["target","scroll-container","enabled","width"])]))}}),V8={class:"relative"},M8={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},B8={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"},A8={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},T8={class:"font-medium text-gray-800 dark:text-[#ffffff]"},L8={class:"p-4 mim-h-0 h-full overflow-auto"},hg=o.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(n,{emit:e}){const t=n,r=e,s=o.ref(t.schema),l=o.ref(t.defaultValue?JSON.parse(JSON.stringify(t.defaultValue)):{}),a=o.ref({}),i=o.ref(t.token||""),c=o.ref(t.mode);async function d(){const p=a.value.validate();if(p){nt.notify({type:"warning",title:"Помилка валідації",message:Object.entries(p).map(([h,f])=>`${h}: ${f}`).join(`
|
|
150
|
+
`)});return}if(i.value)try{const h=await fetch(`/api/table/${i.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(l.value)});if(h.ok)await h.json(),nt.notify({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`}),r("save",l.value);else if(h.status===400){const f=await h.json().catch(()=>({}));nt.notify({type:"warning",title:"Помилка валідації",message:f.message||"Некоректні дані (400)"})}else h.status===500?nt.notify({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):nt.notify({type:"error",title:"Помилка",message:`Статус: ${h.status}`})}catch(h){nt.notify({type:"error",title:"Помилка з’єднання",message:h.message||"Не вдалося виконати запит"})}else r("edit",l.value),u()}function u(){r("close")}return o.onMounted(async()=>{try{if(t.form&&!t.schema){const p=await fetch(`/api/template/form/${t.form}`);if(!p.ok){nt.notify({type:p.status>=400&&p.status<500?"warning":"error",title:"Error",message:`Error code: ${p.status}`});return}const h=await p.json();s.value=h.schema,i.value=h.token}else if(t.token&&!t.defaultValue){i.value=t.token;const p=await fetch(`/api/form/${i.value}`);if(!p.ok){nt.notify({type:p.status>=400&&p.status<500?"warning":"error",title:"Error",message:`Error code: ${p.status}`});return}const h=await p.json();s.value=h.schema,h.data?l.value=h.data:c.value="add",h.obj&&(l.value={...l.value,...h.obj})}}catch(p){nt.notify({type:"error",title:"Error",message:p.message||"Unexpected error"}),console.error(p)}}),(p,h)=>(o.openBlock(),o.createElementBlock("div",V8,[o.createElementVNode("div",M8,[o.createElementVNode("div",B8,[o.createElementVNode("div",A8,[o.createElementVNode("h3",T8,o.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),o.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]=[o.createElementVNode("span",{class:"sr-only"},"Close",-1),o.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"},[o.createElementVNode("path",{d:"M18 6 6 18"}),o.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),o.createElementVNode("div",L8,[s.value?(o.openBlock(),o.createBlock(Qn,{key:0,schema:s.value,values:l.value,"onUpdate:values":h[0]||(h[0]=f=>l.value=f),form:a.value,"onUpdate:form":h[1]||(h[1]=f=>a.value=f)},null,8,["schema","values","form"])):o.createCommentVNode("",!0)]),o.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"},[o.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"}," Скасувати "),o.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"}," Зберегти ")])])])]))}}),D8=1440*60*1e3,O8=["січень","лютий","березень","квітень","травень","червень","липень","серпень","вересень","жовтень","листопад","грудень"],I8=["січ","лют","бер","квіт","трав","черв","лип","серп","вер","жовт","лист","груд"],F8=["нд","пн","вт","ср","чт","пт","сб"];function Bt(n){return n instanceof Date&&!Number.isNaN(n.getTime())}const Eo=n=>new Date(n.getTime());function Zr(n){const e=Eo(n);return e.setHours(0,0,0,0),e}function ws(n){const e=Eo(n);return e.setHours(23,59,59,999),e}function wd(n){return Zr(new Date(n.getFullYear(),n.getMonth(),1))}function xd(n){return ws(new Date(n.getFullYear(),n.getMonth()+1,0))}function vd(n,e){const t=new Date(n),r=t.getDate();t.setDate(1),t.setMonth(t.getMonth()+e);const s=new Date(t.getFullYear(),t.getMonth()+1,0).getDate();return t.setDate(Math.min(r,s)),t}function $8(n,e){return vd(n,-1)}function va(n,e){const t=new Date(n);return t.setFullYear(t.getFullYear()+e),t}function fg(n,e){return va(n,-e)}function mg(n){return Zr(new Date(n.getFullYear(),0,1))}function gg(n){return ws(new Date(n.getFullYear(),11,31))}function R8(n){const e=Math.floor(n.getFullYear()/10)*10;return Zr(new Date(e,0,1))}function P8(n){const e=Math.floor(n.getFullYear()/10)*10+9;return ws(new Date(e,11,31))}const Cn=n=>n.getFullYear(),Ea=n=>Math.floor(n.getFullYear()/10)*10;function z8(n){const e=[];let t=Zr(n.start);const r=Zr(n.end);for(;t<=r;)e.push(Eo(t)),t=new Date(t.getTime()+D8);return e}function j8(n){const e=[];let t=wd(n.start);const r=xd(n.end);for(;t<=r;)e.push(Eo(t)),t=vd(t,1);return e}function H8(n){const e=[];let t=mg(n.start);const r=gg(n.end);for(;t<=r;)e.push(Eo(t)),t=va(t,1);return e}function Ed(n,e=1){const t=Zr(n),r=(t.getDay()-e+7)%7;return t.setDate(t.getDate()-r),t}function U8(n,e=1){const t=Ed(n,e);return t.setDate(t.getDate()+6),ws(t)}function W8(n,e,t=0){const r=Ed(n,t),s=(e-t+7)%7;return r.setDate(r.getDate()+s),r}const Ca=(n,e)=>!!n&&!!e&&n.getFullYear()===e.getFullYear()&&n.getMonth()===e.getMonth()&&n.getDate()===e.getDate(),Cd=(n,e)=>!!n&&!!e&&n.getFullYear()===e.getFullYear()&&n.getMonth()===e.getMonth(),yg=(n,e)=>!!n&&!!e&&n.getFullYear()===e.getFullYear(),bg=(n,e)=>!!n&&!!e&&Ca(n,e)&&n.getHours()===e.getHours(),K8=(n,e)=>!!n&&!!e&&bg(n,e)&&n.getMinutes()===e.getMinutes();function q8(n,e){const t=n.getTime();return t>=e.start.getTime()&&t<=e.end.getTime()}const xs=(n,e)=>!!n&&!!e&&n.getTime()<e.getTime(),vs=(n,e)=>!!n&&!!e&&n.getTime()>e.getTime();function G8(n){const e=n.filter(t=>Bt(t));if(e.length)return e.reduce((t,r)=>t.getTime()>=r.getTime()?t:r)}function Y8(n){const e=n.filter(t=>Bt(t));if(e.length)return e.reduce((t,r)=>t.getTime()<=r.getTime()?t:r)}function kg(n,e){const t=Eo(n);return typeof e.year=="number"&&t.setFullYear(e.year),typeof e.month=="number"&&t.setMonth(e.month),typeof e.date=="number"&&t.setDate(e.date),typeof e.hours=="number"&&t.setHours(e.hours),typeof e.minutes=="number"&&t.setMinutes(e.minutes),typeof e.seconds=="number"&&t.setSeconds(e.seconds),typeof e.milliseconds=="number"&&t.setMilliseconds(e.milliseconds),t}const _a=(n,e=2)=>String(n).padStart(e,"0");function wg(n,e){return e==="wide"?O8[n]:I8[n]}function J8(n){return F8[n]}const Z8=[{token:"LLLL",format:n=>wg(n.getMonth(),"wide")},{token:"LLL",format:n=>wg(n.getMonth(),"abbreviated")},{token:"EE",format:n=>J8(n.getDay())},{token:"yyyy",format:n=>String(n.getFullYear())},{token:"MM",format:n=>_a(n.getMonth()+1)},{token:"dd",format:n=>_a(n.getDate())},{token:"HH",format:n=>_a(n.getHours())},{token:"mm",format:n=>_a(n.getMinutes())}];function Sa(n,e){if(!Bt(n))return"";let t="",r=0;for(;r<e.length;){const s=Z8.find(l=>e.startsWith(l.token,r));s?(t+=s.format(n),r+=s.token.length):(t+=e[r],r+=1)}return t}const X8={"yyyy-MM-dd":/^(\d{4})-(\d{2})-(\d{2})$/,"dd.MM.yyyy":/^(\d{2})\.(\d{2})\.(\d{4})$/,"dd.MM.yyyy HH:mm":/^(\d{2})\.(\d{2})\.(\d{4}) (\d{2}):(\d{2})$/,"HH:mm":/^(\d{2}):(\d{2})$/,"MM.yyyy":/^(\d{2})\.(\d{4})$/,yyyy:/^(\d{4})$/};function xg(n,e){const t=X8[e];if(!t){const s=new Date(n);return Bt(s)?s:null}const r=n.match(t);if(!r)return null;switch(e){case"yyyy-MM-dd":{const[,s,l,a]=r,i=new Date(Number(s),Number(l)-1,Number(a));return Bt(i)?i:null}case"dd.MM.yyyy":{const[,s,l,a]=r,i=new Date(Number(a),Number(l)-1,Number(s));return Bt(i)?i:null}case"dd.MM.yyyy HH:mm":{const[,s,l,a,i,c]=r,d=new Date(Number(a),Number(l)-1,Number(s),Number(i),Number(c));return Bt(d)?d:null}case"HH:mm":{const[,s,l]=r,a=new Date;return a.setHours(Number(s),Number(l),0,0),a}case"MM.yyyy":{const[,s,l]=r;return new Date(Number(l),Number(s)-1,1)}case"yyyy":{const[,s]=r;return new Date(Number(s),0,1)}default:return null}}const Q8=["year","month","day","time","custom"],eP=o.defineComponent({emits:{elementClick:n=>Bt(n),left:()=>!0,right:()=>!0,heading:()=>!0},props:{headingClickable:{type:Boolean,default:!1},leftDisabled:{type:Boolean,default:!1},rightDisabled:{type:Boolean,default:!1},columnCount:{type:Number,default:7},items:{type:Array,default:()=>[]},viewMode:{type:String,required:!0,validate:n=>typeof n=="string"&&Q8.includes(n)}}}),tP={class:"v3dp__heading"},nP=["disabled"],rP=["disabled"],oP={class:"v3dp__body"},sP={class:"v3dp__subheading"},lP={class:"v3dp__elements"},aP=["disabled","onClick"];function iP(n,e,t,r,s,l){return o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["v3dp__popout",`v3dp__popout-${n.viewMode}`]),style:o.normalizeStyle({"--popout-column-definition":`repeat(${n.columnCount}, 1fr)`}),onMousedown:e[3]||(e[3]=o.withModifiers(()=>{},["prevent"]))},[o.createElementVNode("div",tP,[o.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__left",disabled:n.leftDisabled,onClick:e[0]||(e[0]=o.withModifiers(a=>n.$emit("left"),["stop","prevent"]))},[o.renderSlot(n.$slots,"arrow-left",{},()=>[e[4]||(e[4]=o.createElementVNode("svg",{class:"v3dp__heading__icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 8"},[o.createElementVNode("g",{fill:"none","fill-rule":"evenodd"},[o.createElementVNode("path",{stroke:"none",d:"M-9 16V-8h24v24z"}),o.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M5 0L1 4l4 4"})])],-1))],!0)],8,nP),(o.openBlock(),o.createBlock(o.resolveDynamicComponent(n.headingClickable?"button":"span"),{class:"v3dp__heading__center",onClick:e[1]||(e[1]=o.withModifiers(a=>n.$emit("heading"),["stop","prevent"]))},{default:o.withCtx(()=>[o.renderSlot(n.$slots,"heading",{},void 0,!0)]),_:3})),o.createElementVNode("button",{class:"v3dp__heading__button v3dp__heading__button__right",disabled:n.rightDisabled,onClick:e[2]||(e[2]=o.withModifiers(a=>n.$emit("right"),["stop","prevent"]))},[o.renderSlot(n.$slots,"arrow-right",{},()=>[e[5]||(e[5]=o.createElementVNode("svg",{class:"v3dp__heading__icon",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 6 8"},[o.createElementVNode("g",{fill:"none","fill-rule":"evenodd"},[o.createElementVNode("path",{stroke:"none",d:"M15-8v24H-9V-8z"}),o.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M1 8l4-4-4-4"})])],-1))],!0)],8,rP)]),o.createElementVNode("div",oP,["subheading"in n.$slots?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createElementVNode("div",sP,[o.renderSlot(n.$slots,"subheading",{},void 0,!0)]),e[6]||(e[6]=o.createElementVNode("hr",{class:"v3dp__divider"},null,-1))],64)):o.createCommentVNode("",!0),o.createElementVNode("div",lP,[o.renderSlot(n.$slots,"body",{},()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(n.items,a=>(o.openBlock(),o.createElementBlock("button",{key:a.key,disabled:a.disabled,class:o.normalizeClass([{selected:a.selected,current:a.current},`v3dp__element__button__${n.viewMode}`]),onClick:o.withModifiers(i=>n.$emit("elementClick",a.value),["stop","prevent"])},[o.createElementVNode("span",null,o.toDisplayString(a.display),1)],10,aP))),128))],!0)])])],38)}const Na=Ve(eP,[["render",iP],["__scopeId","data-v-3b9aea7a"]]),cP=o.defineComponent({components:{PickerPopup:Na},emits:{"update:pageDate":n=>Bt(n),select:n=>Bt(n)},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(n,{emit:e}){const t=o.computed(()=>R8(n.pageDate)),r=o.computed(()=>P8(n.pageDate)),s=(p,h,f)=>!h&&!f?!0:!(h&&Cn(p)<Cn(h)||f&&Cn(p)>Cn(f)),l=o.computed(()=>H8({start:t.value,end:r.value}).map(p=>({value:p,key:String(Cn(p)),display:Cn(p),selected:!!n.selected&&Cn(p)===Cn(n.selected),disabled:!s(p,n.lowerLimit,n.upperLimit)}))),a=o.computed(()=>{const p=Cn(t.value),h=Cn(r.value);return`${p} - ${h}`}),i=o.computed(()=>n.lowerLimit&&(Ea(n.lowerLimit)===Ea(n.pageDate)||xs(n.pageDate,n.lowerLimit))),c=o.computed(()=>n.upperLimit&&(Ea(n.upperLimit)===Ea(n.pageDate)||vs(n.pageDate,n.upperLimit)));return{years:l,heading:a,leftDisabled:i,rightDisabled:c,previousPage:()=>e("update:pageDate",fg(n.pageDate,10)),nextPage:()=>e("update:pageDate",va(n.pageDate,10))}}});function dP(n,e,t,r,s,l){const a=o.resolveComponent("picker-popup");return o.openBlock(),o.createBlock(a,{columnCount:3,leftDisabled:n.leftDisabled,rightDisabled:n.rightDisabled,items:n.years,viewMode:"year",onLeft:n.previousPage,onRight:n.nextPage,onElementClick:e[0]||(e[0]=i=>n.$emit("select",i))},{heading:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(n.heading),1)]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const uP=Ve(cP,[["render",dP]]),pP=o.defineComponent({components:{PickerPopup:Na},emits:{"update:pageDate":n=>Bt(n),select:n=>Bt(n),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"LLL"},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1}},setup(n,{emit:e}){const t=o.computed(()=>mg(n.pageDate)),r=o.computed(()=>gg(n.pageDate)),s=o.computed(()=>h=>Sa(h,n.format)),l=(h,f,m)=>!f&&!m?!0:!(f&&xs(h,wd(f))||m&&vs(h,xd(m))),a=o.computed(()=>j8({start:t.value,end:r.value}).map(h=>({value:h,display:s.value(h),key:s.value(h),selected:!!n.selected&&Cd(n.selected,h),disabled:!l(h,n.lowerLimit,n.upperLimit)}))),i=o.computed(()=>Cn(t.value)),c=o.computed(()=>n.lowerLimit&&(yg(n.lowerLimit,n.pageDate)||xs(n.pageDate,n.lowerLimit))),d=o.computed(()=>n.upperLimit&&(yg(n.upperLimit,n.pageDate)||vs(n.pageDate,n.upperLimit)));return{months:a,heading:i,leftDisabled:c,rightDisabled:d,previousPage:()=>e("update:pageDate",fg(n.pageDate,1)),nextPage:()=>e("update:pageDate",va(n.pageDate,1))}}});function hP(n,e,t,r,s,l){const a=o.resolveComponent("picker-popup");return o.openBlock(),o.createBlock(a,{headingClickable:"",columnCount:3,items:n.months,leftDisabled:n.leftDisabled,rightDisabled:n.rightDisabled,viewMode:"month",onLeft:n.previousPage,onRight:n.nextPage,onHeading:e[0]||(e[0]=i=>n.$emit("back")),onElementClick:e[1]||(e[1]=i=>n.$emit("select",i))},{heading:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(n.heading),1)]),_:1},8,["items","leftDisabled","rightDisabled","onLeft","onRight"])}const fP=Ve(pP,[["render",hP]]),mP=o.defineComponent({components:{PickerPopup:Na},emits:{"update:pageDate":n=>Bt(n),select:n=>Bt(n),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},format:{type:String,required:!1,default:"dd"},headingFormat:{type:String,required:!1,default:"LLLL yyyy"},weekdayFormat:{type:String,required:!1,default:"EE"},weekStartsOn:{type:Number,required:!1,default:1,validator:n=>typeof n=="number"&&Number.isInteger(n)&&n>=0&&n<=6},customWeekdays:{type:Array,required:!1},lowerLimit:{type:Date,required:!1},upperLimit:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1}},setup(n,{emit:e}){const t=o.computed(()=>y=>b=>Sa(b,y)),r=o.computed(()=>wd(n.pageDate)),s=o.computed(()=>xd(n.pageDate)),l=o.computed(()=>({start:r.value,end:s.value})),a=o.computed(()=>({start:Ed(r.value,n.weekStartsOn),end:U8(s.value,n.weekStartsOn)})),i=o.computed(()=>n.customWeekdays?.length===7?n.customWeekdays:null),c=o.computed(()=>{const y=n.weekStartsOn,b=i.value;if(b)return Array.from({length:7}).map((x,w)=>b[(y+w)%7]);const k=t.value(n.weekdayFormat);return Array.from(Array(7)).map((x,w)=>(y+w)%7).map(x=>W8(new Date,x,n.weekStartsOn)).map(k)}),d=(y,b,k,x)=>x?.dates?.some(w=>Ca(y,w))||x?.predicate?.(y)?!1:!b&&!k?!0:!(b&&xs(y,Zr(b))||k&&vs(y,ws(k))),u=o.computed(()=>{const y=new Date,b=t.value(n.format);return z8(a.value).map(k=>({value:k,display:b(k),selected:!!n.selected&&Ca(n.selected,k),current:Ca(y,k),disabled:!n.allowOutsideInterval&&!q8(k,l.value)||!d(k,n.lowerLimit,n.upperLimit,n.disabledDates),key:t.value("yyyy-MM-dd")(k)}))}),p=o.computed(()=>t.value(n.headingFormat)(n.pageDate)),h=o.computed(()=>n.lowerLimit&&(Cd(n.lowerLimit,n.pageDate)||xs(n.pageDate,n.lowerLimit))),f=o.computed(()=>n.upperLimit&&(Cd(n.upperLimit,n.pageDate)||vs(n.pageDate,n.upperLimit)));return{weekDays:c,days:u,heading:p,leftDisabled:h,rightDisabled:f,previousPage:()=>e("update:pageDate",$8(n.pageDate)),nextPage:()=>e("update:pageDate",vd(n.pageDate,1))}}});function gP(n,e,t,r,s,l){const a=o.resolveComponent("picker-popup");return o.openBlock(),o.createBlock(a,{headingClickable:"",leftDisabled:n.leftDisabled,rightDisabled:n.rightDisabled,items:n.days,viewMode:"day",onLeft:n.previousPage,onRight:n.nextPage,onHeading:e[0]||(e[0]=i=>n.$emit("back")),onElementClick:e[1]||(e[1]=i=>n.$emit("select",i))},{heading:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(n.heading),1)]),subheading:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(n.weekDays,(i,c)=>(o.openBlock(),o.createElementBlock("span",{key:i,class:o.normalizeClass(`v3dp__subheading__weekday__${c}`)},o.toDisplayString(i),3))),128))]),_:1},8,["leftDisabled","rightDisabled","items","onLeft","onRight"])}const yP=Ve(mP,[["render",gP]]);function vg(n,e){const t=n.getBoundingClientRect(),r={height:n.clientHeight,width:n.clientWidth},s=e.getBoundingClientRect();if(!(s.top>=t.top&&s.bottom<=t.top+r.height)){const a=s.top-t.top,i=s.bottom-t.bottom;Math.abs(a)<Math.abs(i)?n.scrollTop+=a:n.scrollTop+=i}}const bP=o.defineComponent({components:{PickerPopup:Na},emits:{select:n=>Bt(n),back:()=>!0},props:{selected:{type:Date,required:!1},pageDate:{type:Date,required:!0},visible:{type:Boolean,required:!0},disabledTime:{type:Object,required:!1}},setup(n,{emit:e}){const t=o.ref(null),r=o.ref(null),s=o.computed(()=>n.pageDate??n.selected),l=o.ref(s.value.getHours()),a=o.ref(s.value.getMinutes());o.watch(()=>n.selected,f=>{let m=0,g=0;f&&(m=f.getHours(),g=f.getMinutes()),l.value=m,a.value=g});const i=o.computed(()=>[...Array(24).keys()].map(f=>({value:f,date:kg(new Date(s.value.getTime()),{hours:f,minutes:a.value,seconds:0}),selected:l.value===f,ref:o.ref(null)}))),c=o.computed(()=>[...Array(60).keys()].map(f=>({value:f,date:kg(new Date(s.value.getTime()),{hours:l.value,minutes:f,seconds:0}),selected:a.value===f,ref:o.ref(null)}))),d=f=>{a.value=f.value,e("select",f.date)},u=()=>{const f=i.value.find(g=>g.ref.value?.classList?.contains("selected")??!1),m=c.value.find(g=>g.ref.value?.classList?.contains("selected")??!1);f&&m&&(vg(t.value,f.ref.value),vg(r.value,m.ref.value))};return o.watch(()=>n.visible,f=>{f&&o.nextTick(u)}),{hoursListRef:t,minutesListRef:r,hours:l,minutes:a,hoursList:i,minutesList:c,padStartZero:f=>`0${f}`.substr(-2),selectMinutes:d,isEnabled:f=>!(n.disabledTime?.dates?.some(m=>bg(f,m)&&K8(f,m))||n.disabledTime?.predicate?.(f)),scroll:u}}}),kP={ref:"hoursListRef",class:"v3dp__column"},wP=["disabled","onClick"],xP={ref:"minutesListRef",class:"v3dp__column"},vP=["disabled","onClick"];function EP(n,e,t,r,s,l){const a=o.resolveComponent("picker-popup");return o.openBlock(),o.createBlock(a,{headingClickable:"",columnCount:2,leftDisabled:!0,rightDisabled:!0,viewMode:"time",onHeading:e[0]||(e[0]=i=>n.$emit("back"))},{heading:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(n.padStartZero(n.hours))+":"+o.toDisplayString(n.padStartZero(n.minutes)),1)]),body:o.withCtx(()=>[o.createElementVNode("div",kP,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(n.hoursList,i=>(o.openBlock(),o.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:o.normalizeClass([{selected:i.selected},"v3dp__element_button__hour"]),disabled:!n.isEnabled(i.date),onClick:o.withModifiers(c=>n.hours=i.value,["stop","prevent"])},[o.createElementVNode("span",null,o.toDisplayString(n.padStartZero(i.value)),1)],10,wP))),128))],512),o.createElementVNode("div",xP,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(n.minutesList,i=>(o.openBlock(),o.createElementBlock("button",{key:i.value,ref_for:!0,ref:i.ref,class:o.normalizeClass([{selected:i.selected},"v3dp__element_button__minute"]),disabled:!n.isEnabled(i.date),onClick:o.withModifiers(c=>n.selectMinutes(i),["stop","prevent"])},[o.createElementVNode("span",null,o.toDisplayString(n.padStartZero(i.value)),1)],10,vP))),128))],512)]),_:1})}const CP=Ve(bP,[["render",EP],["__scopeId","data-v-c075af58"]]),Va=["time","day","month","year"],_P=(n,e,t=void 0)=>{let r=t||new Date;const s=G8([n,r]);s&&(r=s);const l=Y8([e,r]);return l&&(r=l),r},SP=o.defineComponent({components:{YearPicker:uP,MonthPicker:fP,DayPicker:yP,TimePicker:CP},inheritAttrs:!1,props:{placeholder:{type:String,default:""},modelValue:{type:Date,required:!1},disabledDates:{type:Object,required:!1},allowOutsideInterval:{type:Boolean,required:!1,default:!1},disabledTime:{type:Object,required:!1},upperLimit:{type:Date,required:!1},lowerLimit:{type:Date,required:!1},startingView:{type:String,required:!1,default:"day",validate:n=>typeof n=="string"&&Va.includes(n)},startingViewDate:{type:Date,required:!1,default:()=>new Date},dayPickerHeadingFormat:{type:String,required:!1,default:"LLLL yyyy"},monthListFormat:{type:String,required:!1,default:"LLL"},weekdayFormat:{type:String,required:!1,default:"EE"},dayFormat:{type:String,required:!1,default:"dd"},inputFormat:{type:String,required:!1,default:"yyyy-MM-dd"},weekDayNames:{type:Array,required:!1},weekStartsOn:{type:Number,required:!1,default:1,validator:n=>[0,1,2,3,4,5,6].includes(n)},disabled:{type:Boolean,required:!1,default:!1},clearable:{type:Boolean,required:!1,default:!1},typeable:{type:Boolean,required:!1,default:!1},minimumView:{type:String,required:!1,default:"day",validate:n=>typeof n=="string"&&Va.includes(n)}},emits:{"update:modelValue":n=>n==null||Bt(n),decadePageChanged:n=>!0,yearPageChanged:n=>!0,monthPageChanged:n=>!0,opened:()=>!0,closed:()=>!0},setup(n,{emit:e,attrs:t}){const r=o.ref("none"),s=o.ref(n.startingViewDate),l=o.ref(null),a=o.ref(!1),i=o.ref(""),c=$=>{const D=$.replace(/[a-zA-Z]/g,"0");return/0/.test(D)?D:""},d=o.computed(()=>c(n.inputFormat));let u=null,p=null;const h=()=>{u?.destroy(),u=null},f=async()=>{if(!p){const{default:$}=await Promise.resolve().then(()=>Md);p=$}return p},m=()=>{u&&u.value!==i.value&&(u.value=i.value??"")},g=async()=>{if(h(),!l.value||!d.value)return;u=(await f())(l.value,{mask:d.value,lazy:!0,overwrite:!0}),m()};o.watchEffect(()=>{if(!i.value)return;const $=xg(i.value,n.inputFormat);$&&(s.value=$)}),o.watchEffect(()=>{i.value=n.modelValue&&Bt(n.modelValue)?Sa(n.modelValue,n.inputFormat):""}),o.onMounted(()=>{d.value&&o.nextTick(()=>{g()})}),o.onBeforeUnmount(()=>{h()}),o.watch(d,$=>{$?o.nextTick(()=>{g()}):h()}),o.watch(i,()=>{m()});const y=($="none")=>{n.disabled||($!=="none"&&r.value==="none"&&(s.value=n.modelValue||_P(n.lowerLimit,n.upperLimit,s.value)),r.value=$,e($!=="none"?"opened":"closed"))};o.watchEffect(()=>{n.disabled&&(r.value="none")});const b=($,D)=>{s.value=D,$==="year"?e("decadePageChanged",D):$==="month"?e("yearPageChanged",D):$==="day"&&e("monthPageChanged",D)},k=$=>{s.value=$,n.minimumView==="year"?(y("none"),e("update:modelValue",$)):r.value="month"},x=$=>{s.value=$,n.minimumView==="month"?(y("none"),e("update:modelValue",$)):r.value="day"},w=$=>{s.value=$,n.minimumView==="day"?(y("none"),e("update:modelValue",$)):r.value="time"},v=$=>{y("none"),e("update:modelValue",$)},_=()=>{n.clearable&&(y("none"),e("update:modelValue",null),s.value=n.startingViewDate)},E=()=>a.value=!0,S=()=>y(V.value),I=()=>{a.value=!1,y()},A=$=>{const D=$.keyCode?$.keyCode:$.which;if([27,13].includes(D)&&l.value.blur(),n.typeable){const H=xg(l.value.value,n.inputFormat);H&&i.value===Sa(H,n.inputFormat)&&(i.value=l.value.value,e("update:modelValue",H))}},V=o.computed(()=>{const $=Va.indexOf(n.startingView),D=Va.indexOf(n.minimumView);return $<D?n.minimumView:n.startingView}),M=$=>Object.fromEntries(Object.entries($??{}).filter(([D,P])=>D.startsWith("--"))),U=o.computed(()=>n.weekDayNames?.length===7?n.weekDayNames:void 0);return{blur:I,focus:S,click:E,input:i,inputRef:l,pageDate:s,renderView:y,updatePageDate:b,selectYear:k,selectMonth:x,selectDay:w,selectTime:v,keyUp:A,normalizedWeekdayNames:U,viewShown:r,goBackFromTimepicker:()=>n.startingView==="time"&&n.minimumView==="time"?null:r.value="day",clearModelValue:_,initialView:V,log:$=>console.log($),variables:M}}}),NP={class:"v3dp__input_wrapper"},VP=["readonly","placeholder","disabled","tabindex"],MP={class:"v3dp__clearable"};function BP(n,e,t,r,s,l){const a=o.resolveComponent("year-picker"),i=o.resolveComponent("month-picker"),c=o.resolveComponent("day-picker"),d=o.resolveComponent("time-picker");return o.openBlock(),o.createElementBlock("div",{class:"v3dp__datepicker",style:o.normalizeStyle(n.variables(n.$attrs.style))},[o.createElementVNode("div",NP,[o.withDirectives(o.createElementVNode("input",o.mergeProps({type:"text",ref:"inputRef",readonly:!n.typeable,"onUpdate:modelValue":e[0]||(e[0]=u=>n.input=u)},n.$attrs,{placeholder:n.placeholder,disabled:n.disabled,tabindex:n.disabled?-1:0,onKeyup:e[1]||(e[1]=(...u)=>n.keyUp&&n.keyUp(...u)),onBlur:e[2]||(e[2]=(...u)=>n.blur&&n.blur(...u)),onFocus:e[3]||(e[3]=(...u)=>n.focus&&n.focus(...u)),onClick:e[4]||(e[4]=(...u)=>n.click&&n.click(...u))}),null,16,VP),[[o.vModelText,n.input]]),o.withDirectives(o.createElementVNode("div",MP,[o.renderSlot(n.$slots,"clear",{onClear:n.clearModelValue},()=>[o.createElementVNode("i",{onClick:e[5]||(e[5]=u=>n.clearModelValue())},"x")])],512),[[o.vShow,n.clearable&&n.modelValue]])]),o.withDirectives(o.createVNode(a,{pageDate:n.pageDate,"onUpdate:pageDate":e[6]||(e[6]=u=>n.updatePageDate("year",u)),selected:n.modelValue,lowerLimit:n.lowerLimit,upperLimit:n.upperLimit,onSelect:n.selectYear},null,8,["pageDate","selected","lowerLimit","upperLimit","onSelect"]),[[o.vShow,n.viewShown==="year"]]),o.withDirectives(o.createVNode(i,{pageDate:n.pageDate,"onUpdate:pageDate":e[7]||(e[7]=u=>n.updatePageDate("month",u)),selected:n.modelValue,onSelect:n.selectMonth,lowerLimit:n.lowerLimit,upperLimit:n.upperLimit,format:n.monthListFormat,onBack:e[8]||(e[8]=u=>n.viewShown="year")},null,8,["pageDate","selected","onSelect","lowerLimit","upperLimit","format"]),[[o.vShow,n.viewShown==="month"]]),o.withDirectives(o.createVNode(c,{pageDate:n.pageDate,"onUpdate:pageDate":e[9]||(e[9]=u=>n.updatePageDate("day",u)),selected:n.modelValue,weekStartsOn:n.weekStartsOn,lowerLimit:n.lowerLimit,upperLimit:n.upperLimit,headingFormat:n.dayPickerHeadingFormat,disabledDates:n.disabledDates,weekdayFormat:n.weekdayFormat,"allow-outside-interval":n.allowOutsideInterval,format:n.dayFormat,"custom-weekdays":n.normalizedWeekdayNames,onSelect:n.selectDay,onBack:e[10]||(e[10]=u=>n.viewShown="month")},null,8,["pageDate","selected","weekStartsOn","lowerLimit","upperLimit","headingFormat","disabledDates","weekdayFormat","allow-outside-interval","format","custom-weekdays","onSelect"]),[[o.vShow,n.viewShown==="day"]]),o.withDirectives(o.createVNode(d,{pageDate:n.pageDate,visible:n.viewShown==="time",selected:n.modelValue,disabledTime:n.disabledTime,onSelect:n.selectTime,onBack:n.goBackFromTimepicker},null,8,["pageDate","visible","selected","disabledTime","onSelect","onBack"]),[[o.vShow,n.viewShown==="time"]])],4)}const AP=Ve(SP,[["render",BP]]),TP=Ve(o.defineComponent({__name:"vs-input-date2",props:{clearable:{type:Boolean,default:!0},now:{type:Boolean},editable:{type:Boolean,default:!0},time:{type:Boolean},isInfinity:{type:Boolean},mode:{default:"date"},weekStart:{},dayNames:{},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{default:""},name:{},placeholder:{default:""},maxlength:{},minlength:{}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,r=e,{inputClass:s}=Ot(t.style),l=o.computed(()=>t.mode?t.mode:t.time?"datetime":"date"),a={date:"дд.мм.рррр",datetime:"дд.мм.рррр гг:хх",month:"мм.рррр",week:"рррр-тиждень",time:"гг:хх",year:"рррр"},i=o.computed(()=>t.placeholder||a[l.value]||""),c=o.computed(()=>["py-1.5 px-3 block w-full placeholder:text-[#767f8f] bg-white",s.value,t.customClass,{"!border-red-600":t.error}]),d=o.computed(()=>!t.modelValue&&t.now?new Date:null),u=o.computed({get:()=>x(t.modelValue??d.value,l.value)||void 0,set:D=>r("update:modelValue",w(D,l.value))}),p=["Пн","Вт","Ср","Чт","Пт","Сб","Нд"],h=o.computed(()=>{if(t.dayNames?.length)return t.dayNames.length===7?t.dayNames:p}),f=o.computed(()=>{const D=t.weekStart,P=typeof D=="string"?Number(D):D;return P===void 0||Number.isNaN(P)?1:Math.min(6,Math.max(0,P))}),m=o.computed(()=>{switch(l.value){case"time":return{startingView:"time",minimumView:"time"};case"month":return{startingView:"month",minimumView:"month"};case"year":return{startingView:"year",minimumView:"year"};case"datetime":return{startingView:"day",minimumView:"time"};default:return{startingView:"day",minimumView:"day"}}}),g={date:"dd.MM.yyyy",datetime:"dd.MM.yyyy HH:mm",month:"MM.yyyy",time:"HH:mm",week:"dd.MM.yyyy",year:"yyyy"},y=o.computed(()=>g[l.value]||"dd.MM.yyyy"),b=o.computed(()=>({"--vdp-selected-bg-color":t.style?.primaryColor||"#2563eb","--vdp-hover-bg-color":t.style?.primaryColor||"#2563eb","--vdp-selected-color":"#ffffff","--vdp-hover-color":"#ffffff","--vdp-border-radius":t.style?.size==="sm"?"6px":"8px","--vdp-elem-font-size":t.style?.size==="sm"?"0.75em":"0.85em"})),k=o.ref(!1);o.watch(()=>t.modelValue,D=>{D?k.value=!0:t.now||(k.value=!1)},{immediate:!0}),o.watchEffect(()=>{t.now&&!t.modelValue&&!k.value&&(r("update:modelValue",w(new Date,l.value)),k.value=!0)});function x(D,P){if(!D)return null;if(D instanceof Date&&!Number.isNaN(D.getTime()))return D;if(typeof D!="string")return null;switch(P){case"datetime":return S(D);case"time":return V(D);case"month":return I(D);case"year":return A(D);case"week":return M(D);case"date":default:return E(D)}}function w(D,P){if(!D)return null;const H=D instanceof Date?D:x(D,P);if(!H)return null;switch(P){case"datetime":return`${v(H)}T${_(H)}`;case"time":return _(H);case"month":return`${H.getFullYear()}-${$(H.getMonth()+1)}`;case"year":return`${H.getFullYear()}`;case"week":{const{year:G,week:ie}=U(H);return`${G}-W${$(ie)}`}case"date":default:return v(H)}}function v(D){return`${D.getFullYear()}-${$(D.getMonth()+1)}-${$(D.getDate())}`}function _(D){return`${$(D.getHours())}:${$(D.getMinutes())}`}function E(D){const P=D.split("-");if(P.length<3)return null;const[H,G,ie]=P.map(Number);return!H||!G||!ie?null:new Date(H,G-1,ie)}function S(D){const P=D.includes("T")?D:D.replace(" ","T"),H=new Date(P);return Number.isNaN(H.getTime())?null:H}function I(D){const[P,H]=D.split("-").map(Number);return!P||Number.isNaN(H)?null:new Date(P,(H||1)-1,1)}function A(D){const P=Number(D);return P?new Date(P,0,1):null}function V(D){const P=D.match(/^(\d{1,2}):(\d{2})$/);if(!P)return null;const[,H,G]=P,ie=new Date;return ie.setHours(Number(H),Number(G),0,0),ie}function M(D){const P=D.match(/^(\d{4})-W(\d{2})$/);if(!P)return null;const[,H,G]=P,ie=Number(G);return R(Number(H),ie)}function U(D){const P=new Date(Date.UTC(D.getFullYear(),D.getMonth(),D.getDate())),H=P.getUTCDay()||7;P.setUTCDate(P.getUTCDate()+4-H);const G=new Date(Date.UTC(P.getUTCFullYear(),0,1)),ie=Math.ceil(((P.getTime()-G.getTime())/864e5+1)/7);return{year:P.getUTCFullYear(),week:ie}}function R(D,P){if(!D||!P)return null;const H=new Date(D,0,1+(P-1)*7),G=H.getDay(),ie=H;return G<=4?ie.setDate(H.getDate()-H.getDay()+1):ie.setDate(H.getDate()+8-H.getDay()),ie}function $(D){return String(D).padStart(2,"0")}return(D,P)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["vs-date-picker",t.customClass]),style:o.normalizeStyle(b.value)},[o.createVNode(AP,{modelValue:u.value,"onUpdate:modelValue":P[0]||(P[0]=H=>u.value=H),placeholder:i.value,disabled:t.disabled,clearable:t.clearable,typeable:t.editable,"week-day-names":h.value,"week-starts-on":f.value,"starting-view":m.value.startingView,"minimum-view":m.value.minimumView,"input-format":y.value,name:t.name,class:o.normalizeClass(c.value)},null,8,["modelValue","placeholder","disabled","clearable","typeable","week-day-names","week-starts-on","starting-view","minimum-view","input-format","name","class"])],6))}}),[["__scopeId","data-v-a65a2ac3"]]),Eg=(n={mode:"edit",schema:null})=>new Promise(e=>{const{close:t}=nt.modal({title:n.mode==="add"?"Додати":"Редагувати",template:"",visible:!0,size:"medium",closeClickBack:!0,content:hg,contentProps:{...n,onClose:()=>{e(null),t()},onSave:r=>{e(r),t()}}})});Qn.install=function(e){e.component("VForm",Qn),Object.assign(e.config.globalProperties,{$form:Eg}),e.provide("form",Eg),window.v3plugin||(window.v3plugin={})};function Cr(n){return typeof n=="string"||n instanceof String}function Cg(n){var e;return typeof n=="object"&&n!=null&&(n==null||(e=n.constructor)==null?void 0:e.name)==="Object"}function _g(n,e){return Array.isArray(e)?_g(n,(t,r)=>e.includes(r)):Object.entries(n).reduce((t,r)=>{let[s,l]=r;return e(l,s)&&(t[s]=l),t},{})}const ge={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function Sg(n){switch(n){case ge.LEFT:return ge.FORCE_LEFT;case ge.RIGHT:return ge.FORCE_RIGHT;default:return n}}function _d(n){return n.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function Ma(n,e){if(e===n)return!0;const t=Array.isArray(e),r=Array.isArray(n);let s;if(t&&r){if(e.length!=n.length)return!1;for(s=0;s<e.length;s++)if(!Ma(e[s],n[s]))return!1;return!0}if(t!=r)return!1;if(e&&n&&typeof e=="object"&&typeof n=="object"){const l=e instanceof Date,a=n instanceof Date;if(l&&a)return e.getTime()==n.getTime();if(l!=a)return!1;const i=e instanceof RegExp,c=n instanceof RegExp;if(i&&c)return e.toString()==n.toString();if(i!=c)return!1;const d=Object.keys(e);for(s=0;s<d.length;s++)if(!Object.prototype.hasOwnProperty.call(n,d[s]))return!1;for(s=0;s<d.length;s++)if(!Ma(n[d[s]],e[d[s]]))return!1;return!0}else if(e&&n&&typeof e=="function"&&typeof n=="function")return e.toString()===n.toString();return!1}class LP{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?ge.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?ge.RIGHT:ge.LEFT}}function Me(n,e){return new Me.InputMask(n,e)}function Ng(n){if(n==null)throw new Error("mask property should be defined");return n instanceof RegExp?Me.MaskedRegExp:Cr(n)?Me.MaskedPattern:n===Date?Me.MaskedDate:n===Number?Me.MaskedNumber:Array.isArray(n)||n===Array?Me.MaskedDynamic:Me.Masked&&n.prototype instanceof Me.Masked?n:Me.Masked&&n instanceof Me.Masked?n.constructor:n instanceof Function?Me.MaskedFunction:(console.warn("Mask not found for mask",n),Me.Masked)}function Co(n){if(!n)throw new Error("Options in not defined");if(Me.Masked){if(n.prototype instanceof Me.Masked)return{mask:n};const{mask:e=void 0,...t}=n instanceof Me.Masked?{mask:n}:Cg(n)&&n.mask instanceof Me.Masked?n:{};if(e){const r=e.mask;return{..._g(e,(s,l)=>!l.startsWith("_")),mask:e.constructor,_mask:r,...t}}}return Cg(n)?{...n}:{mask:n}}function On(n){if(Me.Masked&&n instanceof Me.Masked)return n;const e=Co(n),t=Ng(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)}Me.createMask=On;class Ba{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}}Me.MaskElement=Ba;const Vg=90,DP=89;class Es extends Ba{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,r;return(e=(t=(r=this.input).getRootNode)==null?void 0:t.call(r))!=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===Vg&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===DP&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===Vg&&(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={}}}Me.HTMLMaskElement=Es;class Mg extends Es{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}}Me.HTMLMaskElement=Es;class Sd extends Es{get _unsafeSelectionStart(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),r=t&&t.anchorOffset,s=t&&t.focusOffset;return s==null||r==null||r<s?r:s}get _unsafeSelectionEnd(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),r=t&&t.anchorOffset,s=t&&t.focusOffset;return s==null||r==null||r>s?r:s}_unsafeSelect(e,t){if(!this.rootElement.createRange)return;const r=this.rootElement.createRange();r.setStart(this.input.firstChild||this.input,e),r.setEnd(this.input.lastChild||this.input,t);const s=this.rootElement,l=s.getSelection&&s.getSelection();l&&(l.removeAllRanges(),l.addRange(r))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}Me.HTMLContenteditableMaskElement=Sd;class Aa{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>Aa.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}}Aa.MAX_LENGTH=100;class Bg{constructor(e,t){this.el=e instanceof Ba?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new Sd(e):new Mg(e),this.masked=On(t),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Aa,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 Me.Masked)&&this.masked.constructor===Ng(e)){this.masked.updateOptions({mask:e});return}const t=e instanceof Me.Masked?e:On({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 r=this._listeners[e];r&&r.forEach(s=>s(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,r=this.masked.value,s=this.masked.rawInputValue,l=this.displayValue,a=this.unmaskedValue!==t||this.value!==r||this._rawInputValue!==s;this._unmaskedValue=t,this._value=r,this._rawInputValue=s,this.el.value!==l&&(this.el.value=l),e==="auto"?this.alignCursor():e!=null&&(this.cursorPos=e),a&&this._fireChangeEvents(),!this._historyChanging&&(a||this.history.isEmpty)&&this.history.push({unmaskedValue:t,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:t,...r}=e,s=!this.maskEquals(t),l=this.masked.optionsIsChanged(r);s&&(this.mask=t),l&&this.masked.updateOptions(r),(s||l)&&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,ge.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 r=this._listeners[e].indexOf(t);return r>=0&&this._listeners[e].splice(r,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const t=new LP({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),r=this.masked.rawInputValue,s=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection,{input:!0,raw:!0}).offset,l=r===this.masked.rawInputValue?t.removeDirection:ge.NONE;let a=this.masked.nearestInputPos(t.startChangePos+s,l);l!==ge.NONE&&(a=this.masked.nearestInputPos(a,ge.NONE)),this.updateControl(a),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}Me.InputMask=Bg;class Le{static normalize(e){return Array.isArray(e)?e:[e,new Le]}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}}Me.ChangeDetails=Le;class In{constructor(e,t,r){e===void 0&&(e=""),t===void 0&&(t=0),this.value=e,this.from=t,this.stop=r}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 At{constructor(e){this._value="",this._update({...At.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,r){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 In(this.extractInput(e,t),e)}appendTail(e){return Cr(e)&&(e=new In(String(e))),e.appendTo(this)}_appendCharRaw(e,t){return e?(this._value+=e,new Le({inserted:e,rawInserted:e})):new Le}_appendChar(e,t,r){t===void 0&&(t={});const s=this.state;let l;if([e,l]=this.doPrepareChar(e,t),e&&(l=l.aggregate(this._appendCharRaw(e,t)),!l.rawInserted&&this.autofix==="pad")){const a=this.state;this.state=s;let i=this.pad(t);const c=this._appendCharRaw(e,t);i=i.aggregate(c),c.rawInserted||i.equals(l)?l=i:this.state=a}if(l.inserted){let a,i=this.doValidate(t)!==!1;if(i&&r!=null){const c=this.state;if(this.overwrite===!0){a=r.state;for(let u=0;u<l.rawInserted.length;++u)r.unshift(this.displayValue.length-l.tailShift)}let d=this.appendTail(r);if(i=d.rawInserted.length===r.toString().length,!(i&&d.inserted)&&this.overwrite==="shift"){this.state=c,a=r.state;for(let u=0;u<l.rawInserted.length;++u)r.shift();d=this.appendTail(r),i=d.rawInserted.length===r.toString().length}i&&d.inserted&&(this.state=c)}i||(l=new Le,this.state=s,r&&a&&(r.state=a))}return l}_appendPlaceholder(){return new Le}_appendEager(){return new Le}append(e,t,r){if(!Cr(e))throw new Error("value should be string");const s=Cr(r)?new In(String(r)):r;t!=null&&t.tail&&(t._beforeTailState=this.state);let l;[e,l]=this.doPrepare(e,t);for(let a=0;a<e.length;++a){const i=this._appendChar(e[a],t,s);if(!i.rawInserted&&!this.doSkipInvalid(e[a],t,s))break;l.aggregate(i)}return(this.eager===!0||this.eager==="append")&&t!=null&&t.input&&e&&l.aggregate(this._appendEager()),s!=null&&(l.tailShift+=this.appendTail(s).tailShift),l}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 Le}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const t=this.rawInputValue,r=this.value,s=e();return this.rawInputValue=t,this.value&&this.value!==r&&r.indexOf(this.value)===0&&(this.append(r.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,s}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const t=this.state,r=e(this);return this.state=t,delete this._isolated,r}doSkipInvalid(e,t,r){return!!this.skipInvalid}doPrepare(e,t){return t===void 0&&(t={}),Le.normalize(this.prepare?this.prepare(e,this,t):e)}doPrepareChar(e,t){return t===void 0&&(t={}),Le.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,r,s,l){r===void 0&&(r=""),s===void 0&&(s=ge.NONE),l===void 0&&(l={input:!0});const a=e+t,i=this.extractTail(a),c=this.eager===!0||this.eager==="remove";let d;c&&(s=Sg(s),d=this.extractInput(0,a,{raw:!0}));let u=e;const p=new Le;if(s!==ge.NONE&&(u=this.nearestInputPos(e,t>1&&e!==0&&!c?ge.NONE:s),p.tailShift=u-e),p.aggregate(this.remove(u)),c&&s!==ge.NONE&&d===this.rawInputValue)if(s===ge.FORCE_LEFT){let h;for(;d===this.rawInputValue&&(h=this.displayValue.length);)p.aggregate(new Le({tailShift:-1})).aggregate(this.remove(h-1))}else s===ge.FORCE_RIGHT&&i.unshift();return p.aggregate(this.append(r,l,i))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!Ma(this,e)}typedValueEquals(e){const t=this.typedValue;return e===t||At.EMPTY_VALUES.includes(e)&&At.EMPTY_VALUES.includes(t)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new Le}}At.DEFAULTS={skipInvalid:!0},At.EMPTY_VALUES=[void 0,null,""],Me.Masked=At;class _r{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=Cr(e)?new In(String(e)):e;const t=this.chunks[this.chunks.length-1],r=t&&(t.stop===e.stop||e.stop==null)&&e.from===t.from+t.toString().length;if(e instanceof In)r?t.extend(e.toString()):this.chunks.push(e);else if(e instanceof _r){if(e.stop==null){let s;for(;e.chunks.length&&e.chunks[0].stop==null;)s=e.chunks.shift(),s.from+=e.from,this.extend(s)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof Me.MaskedPattern))return new In(this.toString()).appendTo(e);const t=new Le;for(let r=0;r<this.chunks.length;++r){const s=this.chunks[r],l=e._mapPosToBlock(e.displayValue.length),a=s.stop;let i;if(a!=null&&(!l||l.index<=a)&&((s instanceof _r||e._stops.indexOf(a)>=0)&&t.aggregate(e._appendPlaceholder(a)),i=s instanceof _r&&e._blocks[a]),i){const c=i.appendTail(s);t.aggregate(c);const d=s.toString().slice(c.rawInserted.length);d&&t.aggregate(e.append(d,{tail:!0}))}else t.aggregate(e.append(s.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,...r}=e;Object.assign(this,r),this.chunks=t.map(s=>{const l="chunks"in s?new _r:new In;return l.state=s,l})}unshift(e){if(!this.chunks.length||e!=null&&this.from>=e)return"";const t=e!=null?e-this.from:e;let r=0;for(;r<this.chunks.length;){const s=this.chunks[r],l=s.unshift(t);if(s.toString()){if(!l)break;++r}else this.chunks.splice(r,1);if(l)return l}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const t=this.chunks[e],r=t.shift();if(t.toString()){if(!r)break;--e}else this.chunks.splice(e,1);if(r)return r}return""}}class OP{constructor(e,t){this.masked=e,this._log=[];const{offset:r,index:s}=e._mapPosToBlock(t)||(t<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=r,this.index=s,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,ge.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,ge.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,ge.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,ge.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,ge.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,ge.NONE),!0})}}class Nd{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 Le}nearestInputPos(e,t){t===void 0&&(t=ge.NONE);const r=0,s=this._value.length;switch(t){case ge.LEFT:case ge.FORCE_LEFT:return r;case ge.NONE:case ge.RIGHT:case ge.FORCE_RIGHT:default:return s}}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),this._isRawInput?t-e:0}extractInput(e,t,r){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),r===void 0&&(r={}),r.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 Le;const r=this.eager===!0||this.eager==="append",l=this.char===e&&(this.isUnmasking||t.input||t.raw)&&(!t.raw||!r)&&!t.tail,a=new Le({inserted:this.char,rawInserted:l?this.char:""});return this._value=this.char,this._isRawInput=l&&(t.raw||t.input),a}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new Le;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new In("")}appendTail(e){return Cr(e)&&(e=new In(String(e))),e.appendTo(this)}append(e,t,r){const s=this._appendChar(e[0],t);return r!=null&&(s.tailShift+=this.appendTail(r).tailShift),s}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 Cs{constructor(e){const{parent:t,isOptional:r,placeholderChar:s,displayChar:l,lazy:a,eager:i,...c}=e;this.masked=On(c),Object.assign(this,{parent:t,isOptional:r,placeholderChar:s,displayChar:l,lazy:a,eager:i})}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 Le}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 Le;const r=this.masked.state;let s=this.masked._appendChar(e,this.currentMaskFlags(t));return s.inserted&&this.doValidate(t)===!1&&(s=new Le,this.masked.state=r),!s.inserted&&!this.isOptional&&!this.lazy&&!t.input&&(s.inserted=this.placeholderChar),s.skip=!s.inserted&&!this.isOptional,this.isFilled=!!s.inserted,s}append(e,t,r){return this.masked.append(e,this.currentMaskFlags(t),r)}_appendPlaceholder(){return this.isFilled||this.isOptional?new Le:(this.isFilled=!0,new Le({inserted:this.placeholderChar}))}_appendEager(){return new Le}extractTail(e,t){return this.masked.extractTail(e,t)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,t,r){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),this.masked.extractInput(e,t,r)}nearestInputPos(e,t){t===void 0&&(t=ge.NONE);const r=0,s=this.value.length,l=Math.min(Math.max(e,r),s);switch(t){case ge.LEFT:case ge.FORCE_LEFT:return this.isComplete?l:r;case ge.RIGHT:case ge.FORCE_RIGHT:return this.isComplete?l:s;case ge.NONE:default:return l}}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 Le}}Cs.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 Ag extends At{updateOptions(e){super.updateOptions(e)}_update(e){const t=e.mask;t&&(e.validate=r=>r.search(t)>=0),super._update(e)}}Me.MaskedRegExp=Ag;class Tt extends At{constructor(e){super({...Tt.DEFAULTS,...e,definitions:Object.assign({},Cs.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 r=!1,s=!1;for(let l=0;l<t.length;++l){if(this.blocks){const d=t.slice(l),u=Object.keys(this.blocks).filter(h=>d.indexOf(h)===0);u.sort((h,f)=>f.length-h.length);const p=u[0];if(p){const{expose:h,repeat:f,...m}=Co(this.blocks[p]),g={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...m,repeat:f,parent:this},y=f!=null?new Me.RepeatBlock(g):On(g);y&&(this._blocks.push(y),h&&(this.exposeBlock=y),this._maskedBlocks[p]||(this._maskedBlocks[p]=[]),this._maskedBlocks[p].push(this._blocks.length-1)),l+=p.length-1;continue}}let a=t[l],i=a in e;if(a===Tt.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(a==="{"||a==="}"){r=!r;continue}if(a==="["||a==="]"){s=!s;continue}if(a===Tt.ESCAPE_CHAR){if(++l,a=t[l],!a)break;i=!1}const c=i?new Cs({isOptional:s,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,...Co(e[a]),parent:this}):new Nd({char:a,eager:this.eager,isUnmasking:r});this._blocks.push(c)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e){this.reset();return}const{_blocks:t,...r}=e;this._blocks.forEach((s,l)=>s.state=t[l]),super.state=r}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 Le;let r=(e=this._mapPosToBlock(this.displayValue.length))==null?void 0:e.index;if(r==null)return t;this._blocks[r].isFilled&&++r;for(let s=r;s<this._blocks.length;++s){const l=this._blocks[s]._appendEager();if(!l.inserted)break;t.aggregate(l)}return t}_appendCharRaw(e,t){t===void 0&&(t={});const r=this._mapPosToBlock(this.displayValue.length),s=new Le;if(!r)return s;for(let a=r.index,i;i=this._blocks[a];++a){var l;const c=i._appendChar(e,{...t,_beforeTailState:(l=t._beforeTailState)==null||(l=l._blocks)==null?void 0:l[a]});if(s.aggregate(c),c.consumed)break}return s}extractTail(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const r=new _r;return e===t||this._forEachBlocksInRange(e,t,(s,l,a,i)=>{const c=s.extractTail(a,i);c.stop=this._findStopBefore(l),c.from=this._blockStartPos(l),c instanceof _r&&(c.blockIndex=l),r.extend(c)}),r}extractInput(e,t,r){if(e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),r===void 0&&(r={}),e===t)return"";let s="";return this._forEachBlocksInRange(e,t,(l,a,i,c)=>{s+=l.extractInput(i,c,r)}),s}_findStopBefore(e){let t;for(let r=0;r<this._stops.length;++r){const s=this._stops[r];if(s<=e)t=s;else break}return t}_appendPlaceholder(e){const t=new Le;if(this.lazy&&e==null)return t;const r=this._mapPosToBlock(this.displayValue.length);if(!r)return t;const s=r.index,l=e??this._blocks.length;return this._blocks.slice(s,l).forEach(a=>{if(!a.lazy||e!=null){var i;t.aggregate(a._appendPlaceholder((i=a._blocks)==null?void 0:i.length))}}),t}_mapPosToBlock(e){let t="";for(let r=0;r<this._blocks.length;++r){const s=this._blocks[r],l=t.length;if(t+=s.displayValue,e<=t.length)return{index:r,offset:e-l}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce((t,r)=>t+=r.displayValue.length,0)}_forEachBlocksInRange(e,t,r){t===void 0&&(t=this.displayValue.length);const s=this._mapPosToBlock(e);if(s){const l=this._mapPosToBlock(t),a=l&&s.index===l.index,i=s.offset,c=l&&a?l.offset:this._blocks[s.index].displayValue.length;if(r(this._blocks[s.index],s.index,i,c),l&&!a){for(let d=s.index+1;d<l.index;++d)r(this._blocks[d],d,0,this._blocks[d].displayValue.length);r(this._blocks[l.index],l.index,0,l.offset)}}}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const r=super.remove(e,t);return this._forEachBlocksInRange(e,t,(s,l,a,i)=>{r.aggregate(s.remove(a,i))}),r}nearestInputPos(e,t){if(t===void 0&&(t=ge.NONE),!this._blocks.length)return 0;const r=new OP(this,e);if(t===ge.NONE)return r.pushRightBeforeInput()||(r.popState(),r.pushLeftBeforeInput())?r.pos:this.displayValue.length;if(t===ge.LEFT||t===ge.FORCE_LEFT){if(t===ge.LEFT){if(r.pushRightBeforeFilled(),r.ok&&r.pos===e)return e;r.popState()}if(r.pushLeftBeforeInput(),r.pushLeftBeforeRequired(),r.pushLeftBeforeFilled(),t===ge.LEFT){if(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.ok&&r.pos<=e||(r.popState(),r.ok&&r.pos<=e))return r.pos;r.popState()}return r.ok?r.pos:t===ge.FORCE_LEFT?0:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:0)}return t===ge.RIGHT||t===ge.FORCE_RIGHT?(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.pushRightBeforeFilled()?r.pos:t===ge.FORCE_RIGHT?this.displayValue.length:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:this.nearestInputPos(e,ge.LEFT))):e}totalInputPositions(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);let r=0;return this._forEachBlocksInRange(e,t,(s,l,a,i)=>{r+=s.totalInputPositions(a,i)}),r}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const t=this._maskedBlocks[e];return t?t.map(r=>this._blocks[r]):[]}pad(e){const t=new Le;return this._forEachBlocksInRange(0,this.displayValue.length,r=>t.aggregate(r.pad(e))),t}}Tt.DEFAULTS={...At.DEFAULTS,lazy:!0,placeholderChar:"_"},Tt.STOP_CHAR="`",Tt.ESCAPE_CHAR="\\",Tt.InputDefinition=Cs,Tt.FixedDefinition=Nd,Me.MaskedPattern=Tt;class _s extends Tt{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:r=this.from||0,maxLength:s=this.maxLength||0,autofix:l=this.autofix,...a}=e;this.to=t,this.from=r,this.maxLength=Math.max(String(t).length,s),this.autofix=l;const i=String(this.from).padStart(this.maxLength,"0"),c=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<c.length&&c[d]===i[d];)++d;a.mask=c.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(a)}get isComplete(){return super.isComplete&&!!this.value}boundaries(e){let t="",r="";const[,s,l]=e.match(/^(\D*)(\d*)(\D*)/)||[];return l&&(t="0".repeat(s.length)+l,r="9".repeat(s.length)+l),t=t.padEnd(this.maxLength,"0"),r=r.padEnd(this.maxLength,"9"),[t,r]}doPrepareChar(e,t){t===void 0&&(t={});let r;return[e,r]=super.doPrepareChar(e.replace(/\D/g,""),t),e||(r.skip=!this.isComplete),[e,r]}_appendCharRaw(e,t){if(t===void 0&&(t={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,t);const r=String(this.from).padStart(this.maxLength,"0"),s=String(this.to).padStart(this.maxLength,"0"),[l,a]=this.boundaries(this.value+e);return Number(a)<this.from?super._appendCharRaw(r[this.value.length],t):Number(l)>this.to?!t.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(r[this.value.length],t).aggregate(this._appendCharRaw(e,t)):super._appendCharRaw(s[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[s,l]=this.boundaries(t);return this.from<=Number(l)&&Number(s)<=this.to&&super.doValidate(e)}pad(e){const t=new Le;if(this.value.length===this.maxLength)return t;const r=this.value,s=this.maxLength-this.value.length;if(s){this.reset();for(let l=0;l<s;++l)t.aggregate(super._appendCharRaw("0",e));r.split("").forEach(l=>this._appendCharRaw(l))}return t}}Me.MaskedRange=_s;const IP="d{.}`m{.}`Y";class Fn extends Tt{static extractPatternOptions(e){const{mask:t,pattern:r,...s}=e;return{...s,mask:Cr(t)?t:r}}constructor(e){super(Fn.extractPatternOptions({...Fn.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:t,pattern:r,blocks:s,...l}={...Fn.DEFAULTS,...e},a=Object.assign({},Fn.GET_DEFAULT_BLOCKS());e.min&&(a.Y.from=e.min.getFullYear()),e.max&&(a.Y.to=e.max.getFullYear()),e.min&&e.max&&a.Y.from===a.Y.to&&(a.m.from=e.min.getMonth()+1,a.m.to=e.max.getMonth()+1,a.m.from===a.m.to&&(a.d.from=e.min.getDate(),a.d.to=e.max.getDate())),Object.assign(a,this.blocks,s),super._update({...l,mask:Cr(t)?t:r,blocks:a})}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(Fn.extractPatternOptions(e))}}Fn.GET_DEFAULT_BLOCKS=()=>({d:{mask:_s,from:1,to:31,maxLength:2},m:{mask:_s,from:1,to:12,maxLength:2},Y:{mask:_s,from:1900,to:9999}}),Fn.DEFAULTS={...Tt.DEFAULTS,mask:Date,pattern:IP,format:(n,e)=>{if(!n)return"";const t=String(n.getDate()).padStart(2,"0"),r=String(n.getMonth()+1).padStart(2,"0"),s=n.getFullYear();return[t,r,s].join(".")},parse:(n,e)=>{const[t,r,s]=n.split(".").map(Number);return new Date(s,r-1,t)}},Me.MaskedDate=Fn;class Ss extends At{constructor(e){super({...Ss.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:r,...s}=Co(t),l=On({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...s});return r&&(this.exposeMask=l),l}):[])}_appendCharRaw(e,t){t===void 0&&(t={});const r=this._applyDispatch(e,t);return this.currentMask&&r.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(t))),r}_applyDispatch(e,t,r){e===void 0&&(e=""),t===void 0&&(t={}),r===void 0&&(r="");const s=t.tail&&t._beforeTailState!=null?t._beforeTailState._value:this.value,l=this.rawInputValue,a=t.tail&&t._beforeTailState!=null?t._beforeTailState._rawInputValue:l,i=l.slice(a.length),c=this.currentMask,d=new Le,u=c?.state;return this.currentMask=this.doDispatch(e,{...t},r),this.currentMask&&(this.currentMask!==c?(this.currentMask.reset(),a&&(this.currentMask.append(a,{raw:!0}),d.tailShift=this.currentMask.value.length-s.length),i&&(d.tailShift+=this.currentMask.append(i,{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 Le;return e&&t.aggregate(this._applyDispatch("",{},e)),t.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var t,r;return{...e,_beforeTailState:((t=e._beforeTailState)==null?void 0:t.currentMaskRef)===this.currentMask&&((r=e._beforeTailState)==null?void 0:r.currentMask)||e._beforeTailState}}doDispatch(e,t,r){return t===void 0&&(t={}),r===void 0&&(r=""),this.dispatch(e,this,t,r)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,t){t===void 0&&(t={});let[r,s]=super.doPrepare(e,t);if(this.currentMask){let l;[r,l]=super.doPrepare(r,this.currentMaskFlags(t)),s=s.aggregate(l)}return[r,s]}doPrepareChar(e,t){t===void 0&&(t={});let[r,s]=super.doPrepareChar(e,t);if(this.currentMask){let l;[r,l]=super.doPrepareChar(r,this.currentMaskFlags(t)),s=s.aggregate(l)}return[r,s]}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 r=new Le;return this.currentMask&&r.aggregate(this.currentMask.remove(e,t)).aggregate(this._applyDispatch()),r}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:r,currentMask:s,...l}=e;t&&this.compiledMasks.forEach((a,i)=>a.state=t[i]),r!=null&&(this.currentMask=r,this.currentMask.state=s),super.state=l}extractInput(e,t,r){return this.currentMask?this.currentMask.extractInput(e,t,r):""}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,r)=>{if(!e[r])return;const{mask:s,...l}=e[r];return Ma(t,l)&&t.maskEquals(s)}):super.maskEquals(e)}typedValueEquals(e){var t;return!!((t=this.currentMask)!=null&&t.typedValueEquals(e))}}Ss.DEFAULTS={...At.DEFAULTS,dispatch:(n,e,t,r)=>{if(!e.compiledMasks.length)return;const s=e.rawInputValue,l=e.compiledMasks.map((a,i)=>{const c=e.currentMask===a,d=c?a.displayValue.length:a.nearestInputPos(a.displayValue.length,ge.FORCE_LEFT);return a.rawInputValue!==s?(a.reset(),a.append(s,{raw:!0})):c||a.remove(d),a.append(n,e.currentMaskFlags(t)),a.appendTail(r),{index:i,weight:a.rawInputValue.length,totalInputPositions:a.totalInputPositions(0,Math.max(d,a.nearestInputPos(a.displayValue.length,ge.FORCE_LEFT)))}});return l.sort((a,i)=>i.weight-a.weight||i.totalInputPositions-a.totalInputPositions),e.compiledMasks[l[0].index]}},Me.MaskedDynamic=Ss;class Ns extends Tt{constructor(e){super({...Ns.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:t,...r}=e;if(t){const s=t.map(i=>i.length),l=Math.min(...s),a=Math.max(...s)-l;r.mask="*".repeat(l),a&&(r.mask+="["+"*".repeat(a)+"]"),this.enum=t}super._update(r)}_appendCharRaw(e,t){t===void 0&&(t={});const r=Math.min(this.nearestInputPos(0,ge.FORCE_RIGHT),this.value.length),s=this.enum.filter(l=>this.matchValue(l,this.unmaskedValue+e,r));if(s.length){s.length===1&&this._forEachBlocksInRange(0,this.value.length,(a,i)=>{const c=s[0][i];i>=this.value.length||c===a.value||(a.reset(),a._appendChar(c,t))});const l=super._appendCharRaw(s[0][this.value.length],t);return s.length===1&&s[0].slice(this.unmaskedValue.length).split("").forEach(a=>l.aggregate(super._appendCharRaw(a))),l}return new Le({skip:!this.isComplete})}extractTail(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),new In("",e)}remove(e,t){if(e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),e===t)return new Le;const r=Math.min(super.nearestInputPos(0,ge.FORCE_RIGHT),this.value.length);let s;for(s=e;s>=0&&!(this.enum.filter(i=>this.matchValue(i,this.value.slice(r,s),r)).length>1);--s);const l=super.remove(s,t);return l.tailShift+=s-e,l}get isComplete(){return this.enum.indexOf(this.value)>=0}}Ns.DEFAULTS={...Tt.DEFAULTS,matchValue:(n,e,t)=>n.indexOf(e,t)===t},Me.MaskedEnum=Ns;class Tg extends At{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}Me.MaskedFunction=Tg;var Lg;class Zt extends At{constructor(e){super({...Zt.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),t="\\d*",r=(this.scale?"("+_d(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+t+r),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(_d).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(_d(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[r,s]=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&&!r&&(s.skip=!0),r&&!this.allowPositive&&!this.value&&r!=="-"&&s.aggregate(this._appendChar("-")),[r,s]}_separatorsCount(e,t){t===void 0&&(t=!1);let r=0;for(let s=0;s<e;++s)this._value.indexOf(this.thousandsSeparator,s)===s&&(++r,t&&(e+=this.thousandsSeparator.length));return r}_separatorsCountFromSlice(e){return e===void 0&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,t,r){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,r))}_appendCharRaw(e,t){t===void 0&&(t={});const r=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,s=this._separatorsCountFromSlice(r);this._value=this._removeThousandsSeparators(this.value);const l=this._value;this._value+=e;const a=this.number;let i=!isNaN(a),c=!1;if(i){let h;this.min!=null&&this.min<0&&this.number<this.min&&(h=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(h=this.max),h!=null&&(this.autofix?(this._value=this.format(h,this).replace(Zt.UNMASKED_RADIX,this.radix),c||(c=l===this._value&&!t.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let d;i?d=new Le({inserted:this._value.slice(l.length),rawInserted:c?"":e,skip:c}):(this._value=l,d=new Le),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-s)*this.thousandsSeparator.length,d}_findSeparatorAround(e){if(this.thousandsSeparator){const t=e-this.thousandsSeparator.length+1,r=this.value.indexOf(this.thousandsSeparator,t);if(r<=e)return r}return-1}_adjustRangeWithSeparators(e,t){const r=this._findSeparatorAround(e);r>=0&&(e=r);const s=this._findSeparatorAround(t);return s>=0&&(t=s+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 r=this.value.slice(0,e),s=this.value.slice(t),l=this._separatorsCount(r.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(r+s));const a=this._separatorsCountFromSlice(r);return new Le({tailShift:(a-l)*this.thousandsSeparator.length})}nearestInputPos(e,t){if(!this.thousandsSeparator)return e;switch(t){case ge.NONE:case ge.LEFT:case ge.FORCE_LEFT:{const r=this._findSeparatorAround(e-1);if(r>=0){const s=r+this.thousandsSeparator.length;if(e<s||this.value.length<=s||t===ge.FORCE_LEFT)return r}break}case ge.RIGHT:case ge.FORCE_RIGHT:{const r=this._findSeparatorAround(e);if(r>=0)return r+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 r=this.value;this.normalizeZeros&&(r=this._normalizeZeros(r)),this.padFractionalZeros&&this.scale>0&&(r=this._padFractionalZeros(r)),this._value=r}super.doCommit()}_normalizeZeros(e){const t=this._removeThousandsSeparators(e).split(this.radix);return t[0]=t[0].replace(/^(\D*)(0*)(\d*)/,(r,s,l,a)=>s+a),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,r){t===void 0&&(t={});const s=this.scale===0&&e!==this.thousandsSeparator&&(e===this.radix||e===Zt.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,t,r)&&!s}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,Zt.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(Zt.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)||Zt.EMPTY_VALUES.includes(e)&&Zt.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}Lg=Zt,Zt.UNMASKED_RADIX=".",Zt.EMPTY_VALUES=[...At.EMPTY_VALUES,0],Zt.DEFAULTS={...At.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Lg.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})},Me.MaskedNumber=Zt;const Ta={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Vd(n,e,t){e===void 0&&(e=Ta.MASKED),t===void 0&&(t=Ta.MASKED);const r=On(n);return s=>r.runIsolated(l=>(l[e]=s,l[t]))}function Dg(n,e,t,r){return Vd(e,t,r)(n)}Me.PIPE_TYPE=Ta,Me.createPipe=Vd,Me.pipe=Dg;class Og extends Tt{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,r,s;const{repeat:l,...a}=Co(e);this._blockOpts=Object.assign({},this._blockOpts,a);const i=On(this._blockOpts);this.repeat=(t=(r=l??i.repeat)!=null?r:this.repeat)!=null?t:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((s=this._blocks)==null?void 0:s.length)||0,this.repeatFrom)),blocks:{m:i},eager:i.eager,overwrite:i.overwrite,skipInvalid:i.skipInvalid,lazy:i.lazy,placeholderChar:i.placeholderChar,displayChar:i.displayChar})}_allocateBlock(e){if(e<this._blocks.length)return this._blocks[e];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push(On(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(e,t){t===void 0&&(t={});const r=new Le;for(let c=(s=(l=this._mapPosToBlock(this.displayValue.length))==null?void 0:l.index)!=null?s:Math.max(this._blocks.length-1,0),d,u;d=(a=this._blocks[c])!=null?a:u=!u&&this._allocateBlock(c);++c){var s,l,a,i;const p=d._appendChar(e,{...t,_beforeTailState:(i=t._beforeTailState)==null||(i=i._blocks)==null?void 0:i[c]});if(p.skip&&u){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(r.aggregate(p),p.consumed)break}return r}_trimEmptyTail(e,t){var r,s;e===void 0&&(e=0);const l=Math.max(((r=this._mapPosToBlock(e))==null?void 0:r.index)||0,this.repeatFrom,0);let a;t!=null&&(a=(s=this._mapPosToBlock(t))==null?void 0:s.index),a==null&&(a=this._blocks.length-1);let i=0;for(let c=a;l<=c&&!this._blocks[c].unmaskedValue;--c,++i);i&&(this._blocks.splice(a-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const r=super.remove(e,t);return this._trimEmptyTail(e,t),r}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}}Me.RepeatBlock=Og;try{globalThis.IMask=Me}catch{}const Md=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:Le,ChunksTailDetails:_r,DIRECTION:ge,HTMLContenteditableMaskElement:Sd,HTMLInputMaskElement:Mg,HTMLMaskElement:Es,InputMask:Bg,MaskElement:Ba,Masked:At,MaskedDate:Fn,MaskedDynamic:Ss,MaskedEnum:Ns,MaskedFunction:Tg,MaskedNumber:Zt,MaskedPattern:Tt,MaskedRange:_s,MaskedRegExp:Ag,PIPE_TYPE:Ta,PatternFixedDefinition:Nd,PatternInputDefinition:Cs,RepeatBlock:Og,createMask:On,createPipe:Vd,default:Me,forceDirection:Sg,normalizeOpts:Co,pipe:Dg},Symbol.toStringTag,{value:"Module"}));function Sr(n){return typeof n=="string"||n instanceof String}function Ig(n){var e;return typeof n=="object"&&n!=null&&(n==null||(e=n.constructor)==null?void 0:e.name)==="Object"}function Fg(n,e){return Array.isArray(e)?Fg(n,(t,r)=>e.includes(r)):Object.entries(n).reduce((t,r)=>{let[s,l]=r;return e(l,s)&&(t[s]=l),t},{})}const ye={NONE:"NONE",LEFT:"LEFT",FORCE_LEFT:"FORCE_LEFT",RIGHT:"RIGHT",FORCE_RIGHT:"FORCE_RIGHT"};function $g(n){switch(n){case ye.LEFT:return ye.FORCE_LEFT;case ye.RIGHT:return ye.FORCE_RIGHT;default:return n}}function Bd(n){return n.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}function La(n,e){if(e===n)return!0;const t=Array.isArray(e),r=Array.isArray(n);let s;if(t&&r){if(e.length!=n.length)return!1;for(s=0;s<e.length;s++)if(!La(e[s],n[s]))return!1;return!0}if(t!=r)return!1;if(e&&n&&typeof e=="object"&&typeof n=="object"){const l=e instanceof Date,a=n instanceof Date;if(l&&a)return e.getTime()==n.getTime();if(l!=a)return!1;const i=e instanceof RegExp,c=n instanceof RegExp;if(i&&c)return e.toString()==n.toString();if(i!=c)return!1;const d=Object.keys(e);for(s=0;s<d.length;s++)if(!Object.prototype.hasOwnProperty.call(n,d[s]))return!1;for(s=0;s<d.length;s++)if(!La(n[d[s]],e[d[s]]))return!1;return!0}else if(e&&n&&typeof e=="function"&&typeof n=="function")return e.toString()===n.toString();return!1}class FP{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?ye.NONE:(this.oldSelection.end===this.cursorPos||this.oldSelection.start===this.cursorPos)&&this.oldSelection.end===this.oldSelection.start?ye.RIGHT:ye.LEFT}}function Be(n,e){return new Be.InputMask(n,e)}function Rg(n){if(n==null)throw new Error("mask property should be defined");return n instanceof RegExp?Be.MaskedRegExp:Sr(n)?Be.MaskedPattern:n===Date?Be.MaskedDate:n===Number?Be.MaskedNumber:Array.isArray(n)||n===Array?Be.MaskedDynamic:Be.Masked&&n.prototype instanceof Be.Masked?n:Be.Masked&&n instanceof Be.Masked?n.constructor:n instanceof Function?Be.MaskedFunction:(console.warn("Mask not found for mask",n),Be.Masked)}function _o(n){if(!n)throw new Error("Options in not defined");if(Be.Masked){if(n.prototype instanceof Be.Masked)return{mask:n};const{mask:e=void 0,...t}=n instanceof Be.Masked?{mask:n}:Ig(n)&&n.mask instanceof Be.Masked?n:{};if(e){const r=e.mask;return{...Fg(e,(s,l)=>!l.startsWith("_")),mask:e.constructor,_mask:r,...t}}}return Ig(n)?{...n}:{mask:n}}function $n(n){if(Be.Masked&&n instanceof Be.Masked)return n;const e=_o(n),t=Rg(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)}Be.createMask=$n;class Da{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}}Be.MaskElement=Da;const Pg=90,$P=89;class Vs extends Da{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,r;return(e=(t=(r=this.input).getRootNode)==null?void 0:t.call(r))!=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===Pg&&e.shiftKey&&(e.metaKey||e.ctrlKey)||e.keyCode===$P&&e.ctrlKey))return e.preventDefault(),this._handlers.redo(e);if(this._handlers.undo&&e.keyCode===Pg&&(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={}}}Be.HTMLMaskElement=Vs;class zg extends Vs{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}}Be.HTMLMaskElement=Vs;class Ad extends Vs{get _unsafeSelectionStart(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),r=t&&t.anchorOffset,s=t&&t.focusOffset;return s==null||r==null||r<s?r:s}get _unsafeSelectionEnd(){const e=this.rootElement,t=e.getSelection&&e.getSelection(),r=t&&t.anchorOffset,s=t&&t.focusOffset;return s==null||r==null||r>s?r:s}_unsafeSelect(e,t){if(!this.rootElement.createRange)return;const r=this.rootElement.createRange();r.setStart(this.input.firstChild||this.input,e),r.setEnd(this.input.lastChild||this.input,t);const s=this.rootElement,l=s.getSelection&&s.getSelection();l&&(l.removeAllRanges(),l.addRange(r))}get value(){return this.input.textContent||""}set value(e){this.input.textContent=e}}Be.HTMLContenteditableMaskElement=Ad;class Oa{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>Oa.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}}Oa.MAX_LENGTH=100;class jg{constructor(e,t){this.el=e instanceof Da?e:e.isContentEditable&&e.tagName!=="INPUT"&&e.tagName!=="TEXTAREA"?new Ad(e):new zg(e),this.masked=$n(t),this._listeners={},this._value="",this._unmaskedValue="",this._rawInputValue="",this.history=new Oa,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 Be.Masked)&&this.masked.constructor===Rg(e)){this.masked.updateOptions({mask:e});return}const t=e instanceof Be.Masked?e:$n({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 r=this._listeners[e];r&&r.forEach(s=>s(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,r=this.masked.value,s=this.masked.rawInputValue,l=this.displayValue,a=this.unmaskedValue!==t||this.value!==r||this._rawInputValue!==s;this._unmaskedValue=t,this._value=r,this._rawInputValue=s,this.el.value!==l&&(this.el.value=l),e==="auto"?this.alignCursor():e!=null&&(this.cursorPos=e),a&&this._fireChangeEvents(),!this._historyChanging&&(a||this.history.isEmpty)&&this.history.push({unmaskedValue:t,selection:{start:this.selectionStart,end:this.cursorPos}})}updateOptions(e){const{mask:t,...r}=e,s=!this.maskEquals(t),l=this.masked.optionsIsChanged(r);s&&(this.mask=t),l&&this.masked.updateOptions(r),(s||l)&&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,ye.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 r=this._listeners[e].indexOf(t);return r>=0&&this._listeners[e].splice(r,1),this}_onInput(e){this._inputEvent=e,this._abortUpdateCursor();const t=new FP({value:this.el.value,cursorPos:this.cursorPos,oldValue:this.displayValue,oldSelection:this._selection}),r=this.masked.rawInputValue,s=this.masked.splice(t.startChangePos,t.removed.length,t.inserted,t.removeDirection,{input:!0,raw:!0}).offset,l=r===this.masked.rawInputValue?t.removeDirection:ye.NONE;let a=this.masked.nearestInputPos(t.startChangePos+s,l);l!==ye.NONE&&(a=this.masked.nearestInputPos(a,ye.NONE)),this.updateControl(a),delete this._inputEvent}_onChange(){this.displayValue!==this.el.value&&this.updateValue(),this.masked.doCommit(),this.updateControl(),this._saveSelection()}_onDrop(e){e.preventDefault(),e.stopPropagation()}_onFocus(e){this.alignCursorFriendly()}_onClick(e){this.alignCursorFriendly()}_onUndo(){this._applyHistoryState(this.history.undo())}_onRedo(){this._applyHistoryState(this.history.redo())}_applyHistoryState(e){e&&(this._historyChanging=!0,this.unmaskedValue=e.unmaskedValue,this.el.select(e.selection.start,e.selection.end),this._saveSelection(),this._historyChanging=!1)}destroy(){this._unbindEvents(),this._listeners.length=0,delete this.el}}Be.InputMask=jg;class De{static normalize(e){return Array.isArray(e)?e:[e,new De]}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}}Be.ChangeDetails=De;class Rn{constructor(e,t,r){e===void 0&&(e=""),t===void 0&&(t=0),this.value=e,this.from=t,this.stop=r}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 Lt{constructor(e){this._value="",this._update({...Lt.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,r){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 Rn(this.extractInput(e,t),e)}appendTail(e){return Sr(e)&&(e=new Rn(String(e))),e.appendTo(this)}_appendCharRaw(e,t){return e?(this._value+=e,new De({inserted:e,rawInserted:e})):new De}_appendChar(e,t,r){t===void 0&&(t={});const s=this.state;let l;if([e,l]=this.doPrepareChar(e,t),e&&(l=l.aggregate(this._appendCharRaw(e,t)),!l.rawInserted&&this.autofix==="pad")){const a=this.state;this.state=s;let i=this.pad(t);const c=this._appendCharRaw(e,t);i=i.aggregate(c),c.rawInserted||i.equals(l)?l=i:this.state=a}if(l.inserted){let a,i=this.doValidate(t)!==!1;if(i&&r!=null){const c=this.state;if(this.overwrite===!0){a=r.state;for(let u=0;u<l.rawInserted.length;++u)r.unshift(this.displayValue.length-l.tailShift)}let d=this.appendTail(r);if(i=d.rawInserted.length===r.toString().length,!(i&&d.inserted)&&this.overwrite==="shift"){this.state=c,a=r.state;for(let u=0;u<l.rawInserted.length;++u)r.shift();d=this.appendTail(r),i=d.rawInserted.length===r.toString().length}i&&d.inserted&&(this.state=c)}i||(l=new De,this.state=s,r&&a&&(r.state=a))}return l}_appendPlaceholder(){return new De}_appendEager(){return new De}append(e,t,r){if(!Sr(e))throw new Error("value should be string");const s=Sr(r)?new Rn(String(r)):r;t!=null&&t.tail&&(t._beforeTailState=this.state);let l;[e,l]=this.doPrepare(e,t);for(let a=0;a<e.length;++a){const i=this._appendChar(e[a],t,s);if(!i.rawInserted&&!this.doSkipInvalid(e[a],t,s))break;l.aggregate(i)}return(this.eager===!0||this.eager==="append")&&t!=null&&t.input&&e&&l.aggregate(this._appendEager()),s!=null&&(l.tailShift+=this.appendTail(s).tailShift),l}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 De}withValueRefresh(e){if(this._refreshing||!this._initialized)return e();this._refreshing=!0;const t=this.rawInputValue,r=this.value,s=e();return this.rawInputValue=t,this.value&&this.value!==r&&r.indexOf(this.value)===0&&(this.append(r.slice(this.displayValue.length),{},""),this.doCommit()),delete this._refreshing,s}runIsolated(e){if(this._isolated||!this._initialized)return e(this);this._isolated=!0;const t=this.state,r=e(this);return this.state=t,delete this._isolated,r}doSkipInvalid(e,t,r){return!!this.skipInvalid}doPrepare(e,t){return t===void 0&&(t={}),De.normalize(this.prepare?this.prepare(e,this,t):e)}doPrepareChar(e,t){return t===void 0&&(t={}),De.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,r,s,l){r===void 0&&(r=""),s===void 0&&(s=ye.NONE),l===void 0&&(l={input:!0});const a=e+t,i=this.extractTail(a),c=this.eager===!0||this.eager==="remove";let d;c&&(s=$g(s),d=this.extractInput(0,a,{raw:!0}));let u=e;const p=new De;if(s!==ye.NONE&&(u=this.nearestInputPos(e,t>1&&e!==0&&!c?ye.NONE:s),p.tailShift=u-e),p.aggregate(this.remove(u)),c&&s!==ye.NONE&&d===this.rawInputValue)if(s===ye.FORCE_LEFT){let h;for(;d===this.rawInputValue&&(h=this.displayValue.length);)p.aggregate(new De({tailShift:-1})).aggregate(this.remove(h-1))}else s===ye.FORCE_RIGHT&&i.unshift();return p.aggregate(this.append(r,l,i))}maskEquals(e){return this.mask===e}optionsIsChanged(e){return!La(this,e)}typedValueEquals(e){const t=this.typedValue;return e===t||Lt.EMPTY_VALUES.includes(e)&&Lt.EMPTY_VALUES.includes(t)||(this.format?this.format(e,this)===this.format(this.typedValue,this):!1)}pad(e){return new De}}Lt.DEFAULTS={skipInvalid:!0},Lt.EMPTY_VALUES=[void 0,null,""],Be.Masked=Lt;class Nr{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=Sr(e)?new Rn(String(e)):e;const t=this.chunks[this.chunks.length-1],r=t&&(t.stop===e.stop||e.stop==null)&&e.from===t.from+t.toString().length;if(e instanceof Rn)r?t.extend(e.toString()):this.chunks.push(e);else if(e instanceof Nr){if(e.stop==null){let s;for(;e.chunks.length&&e.chunks[0].stop==null;)s=e.chunks.shift(),s.from+=e.from,this.extend(s)}e.toString()&&(e.stop=e.blockIndex,this.chunks.push(e))}}appendTo(e){if(!(e instanceof Be.MaskedPattern))return new Rn(this.toString()).appendTo(e);const t=new De;for(let r=0;r<this.chunks.length;++r){const s=this.chunks[r],l=e._mapPosToBlock(e.displayValue.length),a=s.stop;let i;if(a!=null&&(!l||l.index<=a)&&((s instanceof Nr||e._stops.indexOf(a)>=0)&&t.aggregate(e._appendPlaceholder(a)),i=s instanceof Nr&&e._blocks[a]),i){const c=i.appendTail(s);t.aggregate(c);const d=s.toString().slice(c.rawInserted.length);d&&t.aggregate(e.append(d,{tail:!0}))}else t.aggregate(e.append(s.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,...r}=e;Object.assign(this,r),this.chunks=t.map(s=>{const l="chunks"in s?new Nr:new Rn;return l.state=s,l})}unshift(e){if(!this.chunks.length||e!=null&&this.from>=e)return"";const t=e!=null?e-this.from:e;let r=0;for(;r<this.chunks.length;){const s=this.chunks[r],l=s.unshift(t);if(s.toString()){if(!l)break;++r}else this.chunks.splice(r,1);if(l)return l}return""}shift(){if(!this.chunks.length)return"";let e=this.chunks.length-1;for(;0<=e;){const t=this.chunks[e],r=t.shift();if(t.toString()){if(!r)break;--e}else this.chunks.splice(e,1);if(r)return r}return""}}class RP{constructor(e,t){this.masked=e,this._log=[];const{offset:r,index:s}=e._mapPosToBlock(t)||(t<0?{index:0,offset:0}:{index:this.masked._blocks.length,offset:0});this.offset=r,this.index=s,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,ye.FORCE_LEFT),this.offset!==0))return!0})}pushLeftBeforeInput(){return this._pushLeft(()=>{if(!this.block.isFixed)return this.offset=this.block.nearestInputPos(this.offset,ye.LEFT),!0})}pushLeftBeforeRequired(){return this._pushLeft(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,ye.LEFT),!0})}pushRightBeforeFilled(){return this._pushRight(()=>{if(!(this.block.isFixed||!this.block.value)&&(this.offset=this.block.nearestInputPos(this.offset,ye.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,ye.NONE),!0})}pushRightBeforeRequired(){return this._pushRight(()=>{if(!(this.block.isFixed||this.block.isOptional&&!this.block.value))return this.offset=this.block.nearestInputPos(this.offset,ye.NONE),!0})}}class Td{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 De}nearestInputPos(e,t){t===void 0&&(t=ye.NONE);const r=0,s=this._value.length;switch(t){case ye.LEFT:case ye.FORCE_LEFT:return r;case ye.NONE:case ye.RIGHT:case ye.FORCE_RIGHT:default:return s}}totalInputPositions(e,t){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),this._isRawInput?t-e:0}extractInput(e,t,r){return e===void 0&&(e=0),t===void 0&&(t=this._value.length),r===void 0&&(r={}),r.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 De;const r=this.eager===!0||this.eager==="append",s=this.char===e&&(this.isUnmasking||t.input||t.raw)&&(!t.raw||!r)&&!t.tail,l=new De({inserted:this.char,rawInserted:s?this.char:""});return this._value=this.char,this._isRawInput=s&&(t.raw||t.input),l}_appendEager(){return this._appendChar(this.char,{tail:!0})}_appendPlaceholder(){const e=new De;return this.isFilled||(this._value=e.inserted=this.char),e}extractTail(){return new Rn("")}appendTail(e){return Sr(e)&&(e=new Rn(String(e))),e.appendTo(this)}append(e,t,r){const s=this._appendChar(e[0],t);return r!=null&&(s.tailShift+=this.appendTail(r).tailShift),s}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 Ms{constructor(e){const{parent:t,isOptional:r,placeholderChar:s,displayChar:l,lazy:a,eager:i,...c}=e;this.masked=$n(c),Object.assign(this,{parent:t,isOptional:r,placeholderChar:s,displayChar:l,lazy:a,eager:i})}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 De}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 De;const r=this.masked.state;let s=this.masked._appendChar(e,this.currentMaskFlags(t));return s.inserted&&this.doValidate(t)===!1&&(s=new De,this.masked.state=r),!s.inserted&&!this.isOptional&&!this.lazy&&!t.input&&(s.inserted=this.placeholderChar),s.skip=!s.inserted&&!this.isOptional,this.isFilled=!!s.inserted,s}append(e,t,r){return this.masked.append(e,this.currentMaskFlags(t),r)}_appendPlaceholder(){return this.isFilled||this.isOptional?new De:(this.isFilled=!0,new De({inserted:this.placeholderChar}))}_appendEager(){return new De}extractTail(e,t){return this.masked.extractTail(e,t)}appendTail(e){return this.masked.appendTail(e)}extractInput(e,t,r){return e===void 0&&(e=0),t===void 0&&(t=this.value.length),this.masked.extractInput(e,t,r)}nearestInputPos(e,t){t===void 0&&(t=ye.NONE);const r=0,s=this.value.length,l=Math.min(Math.max(e,r),s);switch(t){case ye.LEFT:case ye.FORCE_LEFT:return this.isComplete?l:r;case ye.RIGHT:case ye.FORCE_RIGHT:return this.isComplete?l:s;case ye.NONE:default:return l}}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 De}}Ms.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 Hg extends Lt{updateOptions(e){super.updateOptions(e)}_update(e){const t=e.mask;t&&(e.validate=r=>r.search(t)>=0),super._update(e)}}Be.MaskedRegExp=Hg;class Dt extends Lt{constructor(e){super({...Dt.DEFAULTS,...e,definitions:Object.assign({},Ms.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 r=!1,s=!1;for(let l=0;l<t.length;++l){if(this.blocks){const d=t.slice(l),u=Object.keys(this.blocks).filter(h=>d.indexOf(h)===0);u.sort((h,f)=>f.length-h.length);const p=u[0];if(p){const{expose:h,repeat:f,...m}=_o(this.blocks[p]),g={lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,overwrite:this.overwrite,autofix:this.autofix,...m,repeat:f,parent:this},y=f!=null?new Be.RepeatBlock(g):$n(g);y&&(this._blocks.push(y),h&&(this.exposeBlock=y),this._maskedBlocks[p]||(this._maskedBlocks[p]=[]),this._maskedBlocks[p].push(this._blocks.length-1)),l+=p.length-1;continue}}let a=t[l],i=a in e;if(a===Dt.STOP_CHAR){this._stops.push(this._blocks.length);continue}if(a==="{"||a==="}"){r=!r;continue}if(a==="["||a==="]"){s=!s;continue}if(a===Dt.ESCAPE_CHAR){if(++l,a=t[l],!a)break;i=!1}const c=i?new Ms({isOptional:s,lazy:this.lazy,eager:this.eager,placeholderChar:this.placeholderChar,displayChar:this.displayChar,..._o(e[a]),parent:this}):new Td({char:a,eager:this.eager,isUnmasking:r});this._blocks.push(c)}}get state(){return{...super.state,_blocks:this._blocks.map(e=>e.state)}}set state(e){if(!e){this.reset();return}const{_blocks:t,...r}=e;this._blocks.forEach((s,l)=>s.state=t[l]),super.state=r}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 De;let r=(e=this._mapPosToBlock(this.displayValue.length))==null?void 0:e.index;if(r==null)return t;this._blocks[r].isFilled&&++r;for(let s=r;s<this._blocks.length;++s){const l=this._blocks[s]._appendEager();if(!l.inserted)break;t.aggregate(l)}return t}_appendCharRaw(e,t){t===void 0&&(t={});const r=this._mapPosToBlock(this.displayValue.length),s=new De;if(!r)return s;for(let a=r.index,i;i=this._blocks[a];++a){var l;const c=i._appendChar(e,{...t,_beforeTailState:(l=t._beforeTailState)==null||(l=l._blocks)==null?void 0:l[a]});if(s.aggregate(c),c.consumed)break}return s}extractTail(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const r=new Nr;return e===t||this._forEachBlocksInRange(e,t,(s,l,a,i)=>{const c=s.extractTail(a,i);c.stop=this._findStopBefore(l),c.from=this._blockStartPos(l),c instanceof Nr&&(c.blockIndex=l),r.extend(c)}),r}extractInput(e,t,r){if(e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),r===void 0&&(r={}),e===t)return"";let s="";return this._forEachBlocksInRange(e,t,(l,a,i,c)=>{s+=l.extractInput(i,c,r)}),s}_findStopBefore(e){let t;for(let r=0;r<this._stops.length;++r){const s=this._stops[r];if(s<=e)t=s;else break}return t}_appendPlaceholder(e){const t=new De;if(this.lazy&&e==null)return t;const r=this._mapPosToBlock(this.displayValue.length);if(!r)return t;const s=r.index,l=e??this._blocks.length;return this._blocks.slice(s,l).forEach(a=>{if(!a.lazy||e!=null){var i;t.aggregate(a._appendPlaceholder((i=a._blocks)==null?void 0:i.length))}}),t}_mapPosToBlock(e){let t="";for(let r=0;r<this._blocks.length;++r){const s=this._blocks[r],l=t.length;if(t+=s.displayValue,e<=t.length)return{index:r,offset:e-l}}}_blockStartPos(e){return this._blocks.slice(0,e).reduce((t,r)=>t+=r.displayValue.length,0)}_forEachBlocksInRange(e,t,r){t===void 0&&(t=this.displayValue.length);const s=this._mapPosToBlock(e);if(s){const l=this._mapPosToBlock(t),a=l&&s.index===l.index,i=s.offset,c=l&&a?l.offset:this._blocks[s.index].displayValue.length;if(r(this._blocks[s.index],s.index,i,c),l&&!a){for(let d=s.index+1;d<l.index;++d)r(this._blocks[d],d,0,this._blocks[d].displayValue.length);r(this._blocks[l.index],l.index,0,l.offset)}}}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const r=super.remove(e,t);return this._forEachBlocksInRange(e,t,(s,l,a,i)=>{r.aggregate(s.remove(a,i))}),r}nearestInputPos(e,t){if(t===void 0&&(t=ye.NONE),!this._blocks.length)return 0;const r=new RP(this,e);if(t===ye.NONE)return r.pushRightBeforeInput()||(r.popState(),r.pushLeftBeforeInput())?r.pos:this.displayValue.length;if(t===ye.LEFT||t===ye.FORCE_LEFT){if(t===ye.LEFT){if(r.pushRightBeforeFilled(),r.ok&&r.pos===e)return e;r.popState()}if(r.pushLeftBeforeInput(),r.pushLeftBeforeRequired(),r.pushLeftBeforeFilled(),t===ye.LEFT){if(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.ok&&r.pos<=e||(r.popState(),r.ok&&r.pos<=e))return r.pos;r.popState()}return r.ok?r.pos:t===ye.FORCE_LEFT?0:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:0)}return t===ye.RIGHT||t===ye.FORCE_RIGHT?(r.pushRightBeforeInput(),r.pushRightBeforeRequired(),r.pushRightBeforeFilled()?r.pos:t===ye.FORCE_RIGHT?this.displayValue.length:(r.popState(),r.ok||(r.popState(),r.ok)?r.pos:this.nearestInputPos(e,ye.LEFT))):e}totalInputPositions(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);let r=0;return this._forEachBlocksInRange(e,t,(s,l,a,i)=>{r+=s.totalInputPositions(a,i)}),r}maskedBlock(e){return this.maskedBlocks(e)[0]}maskedBlocks(e){const t=this._maskedBlocks[e];return t?t.map(r=>this._blocks[r]):[]}pad(e){const t=new De;return this._forEachBlocksInRange(0,this.displayValue.length,r=>t.aggregate(r.pad(e))),t}}Dt.DEFAULTS={...Lt.DEFAULTS,lazy:!0,placeholderChar:"_"},Dt.STOP_CHAR="`",Dt.ESCAPE_CHAR="\\",Dt.InputDefinition=Ms,Dt.FixedDefinition=Td,Be.MaskedPattern=Dt;class Bs extends Dt{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:r=this.from||0,maxLength:s=this.maxLength||0,autofix:l=this.autofix,...a}=e;this.to=t,this.from=r,this.maxLength=Math.max(String(t).length,s),this.autofix=l;const i=String(this.from).padStart(this.maxLength,"0"),c=String(this.to).padStart(this.maxLength,"0");let d=0;for(;d<c.length&&c[d]===i[d];)++d;a.mask=c.slice(0,d).replace(/0/g,"\\0")+"0".repeat(this.maxLength-d),super._update(a)}get isComplete(){return super.isComplete&&!!this.value}boundaries(e){let t="",r="";const[,s,l]=e.match(/^(\D*)(\d*)(\D*)/)||[];return l&&(t="0".repeat(s.length)+l,r="9".repeat(s.length)+l),t=t.padEnd(this.maxLength,"0"),r=r.padEnd(this.maxLength,"9"),[t,r]}doPrepareChar(e,t){t===void 0&&(t={});let r;return[e,r]=super.doPrepareChar(e.replace(/\D/g,""),t),e||(r.skip=!this.isComplete),[e,r]}_appendCharRaw(e,t){if(t===void 0&&(t={}),!this.autofix||this.value.length+1>this.maxLength)return super._appendCharRaw(e,t);const r=String(this.from).padStart(this.maxLength,"0"),s=String(this.to).padStart(this.maxLength,"0"),[l,a]=this.boundaries(this.value+e);return Number(a)<this.from?super._appendCharRaw(r[this.value.length],t):Number(l)>this.to?!t.tail&&this.autofix==="pad"&&this.value.length+1<this.maxLength?super._appendCharRaw(r[this.value.length],t).aggregate(this._appendCharRaw(e,t)):super._appendCharRaw(s[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,s]=this.boundaries(t);return this.from<=Number(s)&&Number(r)<=this.to&&super.doValidate(e)}pad(e){const t=new De;if(this.value.length===this.maxLength)return t;const r=this.value,s=this.maxLength-this.value.length;if(s){this.reset();for(let l=0;l<s;++l)t.aggregate(super._appendCharRaw("0",e));r.split("").forEach(l=>this._appendCharRaw(l))}return t}}Be.MaskedRange=Bs;const PP="d{.}`m{.}`Y";class Pn extends Dt{static extractPatternOptions(e){const{mask:t,pattern:r,...s}=e;return{...s,mask:Sr(t)?t:r}}constructor(e){super(Pn.extractPatternOptions({...Pn.DEFAULTS,...e}))}updateOptions(e){super.updateOptions(e)}_update(e){const{mask:t,pattern:r,blocks:s,...l}={...Pn.DEFAULTS,...e},a=Object.assign({},Pn.GET_DEFAULT_BLOCKS());e.min&&(a.Y.from=e.min.getFullYear()),e.max&&(a.Y.to=e.max.getFullYear()),e.min&&e.max&&a.Y.from===a.Y.to&&(a.m.from=e.min.getMonth()+1,a.m.to=e.max.getMonth()+1,a.m.from===a.m.to&&(a.d.from=e.min.getDate(),a.d.to=e.max.getDate())),Object.assign(a,this.blocks,s),super._update({...l,mask:Sr(t)?t:r,blocks:a})}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(Pn.extractPatternOptions(e))}}Pn.GET_DEFAULT_BLOCKS=()=>({d:{mask:Bs,from:1,to:31,maxLength:2},m:{mask:Bs,from:1,to:12,maxLength:2},Y:{mask:Bs,from:1900,to:9999}}),Pn.DEFAULTS={...Dt.DEFAULTS,mask:Date,pattern:PP,format:(n,e)=>{if(!n)return"";const t=String(n.getDate()).padStart(2,"0"),r=String(n.getMonth()+1).padStart(2,"0"),s=n.getFullYear();return[t,r,s].join(".")},parse:(n,e)=>{const[t,r,s]=n.split(".").map(Number);return new Date(s,r-1,t)}},Be.MaskedDate=Pn;class As extends Lt{constructor(e){super({...As.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:r,...s}=_o(t),l=$n({overwrite:this._overwrite,eager:this._eager,skipInvalid:this._skipInvalid,...s});return r&&(this.exposeMask=l),l}):[])}_appendCharRaw(e,t){t===void 0&&(t={});const r=this._applyDispatch(e,t);return this.currentMask&&r.aggregate(this.currentMask._appendChar(e,this.currentMaskFlags(t))),r}_applyDispatch(e,t,r){e===void 0&&(e=""),t===void 0&&(t={}),r===void 0&&(r="");const s=t.tail&&t._beforeTailState!=null?t._beforeTailState._value:this.value,l=this.rawInputValue,a=t.tail&&t._beforeTailState!=null?t._beforeTailState._rawInputValue:l,i=l.slice(a.length),c=this.currentMask,d=new De,u=c?.state;return this.currentMask=this.doDispatch(e,{...t},r),this.currentMask&&(this.currentMask!==c?(this.currentMask.reset(),a&&(this.currentMask.append(a,{raw:!0}),d.tailShift=this.currentMask.value.length-s.length),i&&(d.tailShift+=this.currentMask.append(i,{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 De;return e&&t.aggregate(this._applyDispatch("",{},e)),t.aggregate(this.currentMask?this.currentMask.appendTail(e):super.appendTail(e))}currentMaskFlags(e){var t,r;return{...e,_beforeTailState:((t=e._beforeTailState)==null?void 0:t.currentMaskRef)===this.currentMask&&((r=e._beforeTailState)==null?void 0:r.currentMask)||e._beforeTailState}}doDispatch(e,t,r){return t===void 0&&(t={}),r===void 0&&(r=""),this.dispatch(e,this,t,r)}doValidate(e){return super.doValidate(e)&&(!this.currentMask||this.currentMask.doValidate(this.currentMaskFlags(e)))}doPrepare(e,t){t===void 0&&(t={});let[r,s]=super.doPrepare(e,t);if(this.currentMask){let l;[r,l]=super.doPrepare(r,this.currentMaskFlags(t)),s=s.aggregate(l)}return[r,s]}doPrepareChar(e,t){t===void 0&&(t={});let[r,s]=super.doPrepareChar(e,t);if(this.currentMask){let l;[r,l]=super.doPrepareChar(r,this.currentMaskFlags(t)),s=s.aggregate(l)}return[r,s]}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 r=new De;return this.currentMask&&r.aggregate(this.currentMask.remove(e,t)).aggregate(this._applyDispatch()),r}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:r,currentMask:s,...l}=e;t&&this.compiledMasks.forEach((a,i)=>a.state=t[i]),r!=null&&(this.currentMask=r,this.currentMask.state=s),super.state=l}extractInput(e,t,r){return this.currentMask?this.currentMask.extractInput(e,t,r):""}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,r)=>{if(!e[r])return;const{mask:s,...l}=e[r];return La(t,l)&&t.maskEquals(s)}):super.maskEquals(e)}typedValueEquals(e){var t;return!!((t=this.currentMask)!=null&&t.typedValueEquals(e))}}As.DEFAULTS={...Lt.DEFAULTS,dispatch:(n,e,t,r)=>{if(!e.compiledMasks.length)return;const s=e.rawInputValue,l=e.compiledMasks.map((a,i)=>{const c=e.currentMask===a,d=c?a.displayValue.length:a.nearestInputPos(a.displayValue.length,ye.FORCE_LEFT);return a.rawInputValue!==s?(a.reset(),a.append(s,{raw:!0})):c||a.remove(d),a.append(n,e.currentMaskFlags(t)),a.appendTail(r),{index:i,weight:a.rawInputValue.length,totalInputPositions:a.totalInputPositions(0,Math.max(d,a.nearestInputPos(a.displayValue.length,ye.FORCE_LEFT)))}});return l.sort((a,i)=>i.weight-a.weight||i.totalInputPositions-a.totalInputPositions),e.compiledMasks[l[0].index]}},Be.MaskedDynamic=As;class Ts extends Dt{constructor(e){super({...Ts.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){const{enum:t,...r}=e;if(t){const s=t.map(i=>i.length),l=Math.min(...s),a=Math.max(...s)-l;r.mask="*".repeat(l),a&&(r.mask+="["+"*".repeat(a)+"]"),this.enum=t}super._update(r)}_appendCharRaw(e,t){t===void 0&&(t={});const r=Math.min(this.nearestInputPos(0,ye.FORCE_RIGHT),this.value.length),s=this.enum.filter(l=>this.matchValue(l,this.unmaskedValue+e,r));if(s.length){s.length===1&&this._forEachBlocksInRange(0,this.value.length,(a,i)=>{const c=s[0][i];i>=this.value.length||c===a.value||(a.reset(),a._appendChar(c,t))});const l=super._appendCharRaw(s[0][this.value.length],t);return s.length===1&&s[0].slice(this.unmaskedValue.length).split("").forEach(a=>l.aggregate(super._appendCharRaw(a))),l}return new De({skip:!this.isComplete})}extractTail(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),new Rn("",e)}remove(e,t){if(e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length),e===t)return new De;const r=Math.min(super.nearestInputPos(0,ye.FORCE_RIGHT),this.value.length);let s;for(s=e;s>=0&&!(this.enum.filter(a=>this.matchValue(a,this.value.slice(r,s),r)).length>1);--s);const l=super.remove(s,t);return l.tailShift+=s-e,l}get isComplete(){return this.enum.indexOf(this.value)>=0}}Ts.DEFAULTS={...Dt.DEFAULTS,matchValue:(n,e,t)=>n.indexOf(e,t)===t},Be.MaskedEnum=Ts;class Ug extends Lt{updateOptions(e){super.updateOptions(e)}_update(e){super._update({...e,validate:e.mask})}}Be.MaskedFunction=Ug;var Wg;class Xt extends Lt{constructor(e){super({...Xt.DEFAULTS,...e})}updateOptions(e){super.updateOptions(e)}_update(e){super._update(e),this._updateRegExps()}_updateRegExps(){const e="^"+(this.allowNegative?"[+|\\-]?":""),t="\\d*",r=(this.scale?"("+Bd(this.radix)+"\\d{0,"+this.scale+"})?":"")+"$";this._numberRegExp=new RegExp(e+t+r),this._mapToRadixRegExp=new RegExp("["+this.mapToRadix.map(Bd).join("")+"]","g"),this._thousandsSeparatorRegExp=new RegExp(Bd(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[r,s]=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&&!r&&(s.skip=!0),r&&!this.allowPositive&&!this.value&&r!=="-"&&s.aggregate(this._appendChar("-")),[r,s]}_separatorsCount(e,t){t===void 0&&(t=!1);let r=0;for(let s=0;s<e;++s)this._value.indexOf(this.thousandsSeparator,s)===s&&(++r,t&&(e+=this.thousandsSeparator.length));return r}_separatorsCountFromSlice(e){return e===void 0&&(e=this._value),this._separatorsCount(this._removeThousandsSeparators(e).length,!0)}extractInput(e,t,r){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,r))}_appendCharRaw(e,t){t===void 0&&(t={});const r=t.tail&&t._beforeTailState?t._beforeTailState._value:this._value,s=this._separatorsCountFromSlice(r);this._value=this._removeThousandsSeparators(this.value);const l=this._value;this._value+=e;const a=this.number;let i=!isNaN(a),c=!1;if(i){let h;this.min!=null&&this.min<0&&this.number<this.min&&(h=this.min),this.max!=null&&this.max>0&&this.number>this.max&&(h=this.max),h!=null&&(this.autofix?(this._value=this.format(h,this).replace(Xt.UNMASKED_RADIX,this.radix),c||(c=l===this._value&&!t.tail)):i=!1),i&&(i=!!this._value.match(this._numberRegExp))}let d;i?d=new De({inserted:this._value.slice(l.length),rawInserted:c?"":e,skip:c}):(this._value=l,d=new De),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-s)*this.thousandsSeparator.length,d}_findSeparatorAround(e){if(this.thousandsSeparator){const t=e-this.thousandsSeparator.length+1,r=this.value.indexOf(this.thousandsSeparator,t);if(r<=e)return r}return-1}_adjustRangeWithSeparators(e,t){const r=this._findSeparatorAround(e);r>=0&&(e=r);const s=this._findSeparatorAround(t);return s>=0&&(t=s+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 r=this.value.slice(0,e),s=this.value.slice(t),l=this._separatorsCount(r.length);this._value=this._insertThousandsSeparators(this._removeThousandsSeparators(r+s));const a=this._separatorsCountFromSlice(r);return new De({tailShift:(a-l)*this.thousandsSeparator.length})}nearestInputPos(e,t){if(!this.thousandsSeparator)return e;switch(t){case ye.NONE:case ye.LEFT:case ye.FORCE_LEFT:{const r=this._findSeparatorAround(e-1);if(r>=0){const s=r+this.thousandsSeparator.length;if(e<s||this.value.length<=s||t===ye.FORCE_LEFT)return r}break}case ye.RIGHT:case ye.FORCE_RIGHT:{const r=this._findSeparatorAround(e);if(r>=0)return r+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 r=this.value;this.normalizeZeros&&(r=this._normalizeZeros(r)),this.padFractionalZeros&&this.scale>0&&(r=this._padFractionalZeros(r)),this._value=r}super.doCommit()}_normalizeZeros(e){const t=this._removeThousandsSeparators(e).split(this.radix);return t[0]=t[0].replace(/^(\D*)(0*)(\d*)/,(r,s,l,a)=>s+a),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,r){t===void 0&&(t={});const s=this.scale===0&&e!==this.thousandsSeparator&&(e===this.radix||e===Xt.UNMASKED_RADIX||this.mapToRadix.includes(e));return super.doSkipInvalid(e,t,r)&&!s}get unmaskedValue(){return this._removeThousandsSeparators(this._normalizeZeros(this.value)).replace(this.radix,Xt.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(Xt.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)||Xt.EMPTY_VALUES.includes(e)&&Xt.EMPTY_VALUES.includes(this.typedValue))&&!(e===0&&this.value==="")}}Wg=Xt,Xt.UNMASKED_RADIX=".",Xt.EMPTY_VALUES=[...Lt.EMPTY_VALUES,0],Xt.DEFAULTS={...Lt.DEFAULTS,mask:Number,radix:",",thousandsSeparator:"",mapToRadix:[Wg.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})},Be.MaskedNumber=Xt;const Ia={MASKED:"value",UNMASKED:"unmaskedValue",TYPED:"typedValue"};function Ld(n,e,t){e===void 0&&(e=Ia.MASKED),t===void 0&&(t=Ia.MASKED);const r=$n(n);return s=>r.runIsolated(l=>(l[e]=s,l[t]))}function Kg(n,e,t,r){return Ld(e,t,r)(n)}Be.PIPE_TYPE=Ia,Be.createPipe=Ld,Be.pipe=Kg;class qg extends Dt{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,r,s;const{repeat:l,...a}=_o(e);this._blockOpts=Object.assign({},this._blockOpts,a);const i=$n(this._blockOpts);this.repeat=(t=(r=l??i.repeat)!=null?r:this.repeat)!=null?t:1/0,super._update({mask:"m".repeat(Math.max(this.repeatTo===1/0&&((s=this._blocks)==null?void 0:s.length)||0,this.repeatFrom)),blocks:{m:i},eager:i.eager,overwrite:i.overwrite,skipInvalid:i.skipInvalid,lazy:i.lazy,placeholderChar:i.placeholderChar,displayChar:i.displayChar})}_allocateBlock(e){if(e<this._blocks.length)return this._blocks[e];if(this.repeatTo===1/0||this._blocks.length<this.repeatTo)return this._blocks.push($n(this._blockOpts)),this.mask+="m",this._blocks[this._blocks.length-1]}_appendCharRaw(e,t){t===void 0&&(t={});const r=new De;for(let c=(s=(l=this._mapPosToBlock(this.displayValue.length))==null?void 0:l.index)!=null?s:Math.max(this._blocks.length-1,0),d,u;d=(a=this._blocks[c])!=null?a:u=!u&&this._allocateBlock(c);++c){var s,l,a,i;const p=d._appendChar(e,{...t,_beforeTailState:(i=t._beforeTailState)==null||(i=i._blocks)==null?void 0:i[c]});if(p.skip&&u){this._blocks.pop(),this.mask=this.mask.slice(1);break}if(r.aggregate(p),p.consumed)break}return r}_trimEmptyTail(e,t){var r,s;e===void 0&&(e=0);const l=Math.max(((r=this._mapPosToBlock(e))==null?void 0:r.index)||0,this.repeatFrom,0);let a;t!=null&&(a=(s=this._mapPosToBlock(t))==null?void 0:s.index),a==null&&(a=this._blocks.length-1);let i=0;for(let c=a;l<=c&&!this._blocks[c].unmaskedValue;--c,++i);i&&(this._blocks.splice(a-i+1,i),this.mask=this.mask.slice(i))}reset(){super.reset(),this._trimEmptyTail()}remove(e,t){e===void 0&&(e=0),t===void 0&&(t=this.displayValue.length);const r=super.remove(e,t);return this._trimEmptyTail(e,t),r}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}}Be.RepeatBlock=qg;try{globalThis.IMask=Be}catch{}const zP=Object.freeze(Object.defineProperty({__proto__:null,ChangeDetails:De,ChunksTailDetails:Nr,DIRECTION:ye,HTMLContenteditableMaskElement:Ad,HTMLInputMaskElement:zg,HTMLMaskElement:Vs,InputMask:jg,MaskElement:Da,Masked:Lt,MaskedDate:Pn,MaskedDynamic:As,MaskedEnum:Ts,MaskedFunction:Ug,MaskedNumber:Xt,MaskedPattern:Dt,MaskedRange:Bs,MaskedRegExp:Hg,PIPE_TYPE:Ia,PatternFixedDefinition:Td,PatternInputDefinition:Ms,RepeatBlock:qg,createMask:$n,createPipe:Ld,default:Be,forceDirection:$g,normalizeOpts:_o,pipe:Kg},Symbol.toStringTag,{value:"Module"}));Fe.ModalEdit=hg,Fe.VForm=Qn,Fe.VsInputAddress=ag,Fe.VsInputArray=lg,Fe.VsInputCheckbox=Rd,Fe.VsInputCodegen=tg,Fe.VsInputColor=og,Fe.VsInputContainer=Gd,Fe.VsInputDate=TP,Fe.VsInputEmail=Ha,Fe.VsInputFile=Wd,Fe.VsInputFileList=Kd,Fe.VsInputKeyValue=ng,Fe.VsInputMask=ja,Fe.VsInputNumber=$d,Fe.VsInputRadio=Wa,Fe.VsInputRange=sg,Fe.VsInputRichtext=Y0,Fe.VsInputSelect=Ka,Fe.VsInputSlug=eg,Fe.VsInputStatic=za,Fe.VsInputSwitcher=Pa,Fe.VsInputTag=Q0,Fe.VsInputTel=Ua,Fe.VsInputText=Xr,Fe.VsInputTextArray=rg,Fe.VsInputTextarea=Yd,Fe.default=Qn,Fe.inputs=cg,Fe.vsInputDatatable=Z0,Fe.vsInputMap=X0,Object.defineProperties(Fe,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|