@opengis/richtext 0.0.29 → 0.0.30

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.
@@ -103,7 +103,7 @@ img.ProseMirror-separator {
103
103
  2. Cannot start or end with "-"
104
104
  3. "-" cannot repeat`);Ve.customSchemes.push([n,e])}function Ox(){Ve.scanner=Sx(Ve.customSchemes);for(let n=0;n<Ve.tokenQueue.length;n++)Ve.tokenQueue[n][1]({scanner:Ve.scanner});Ve.parser=Tx(Ve.scanner.tokens);for(let n=0;n<Ve.pluginQueue.length;n++)Ve.pluginQueue[n][1]({scanner:Ve.scanner,parser:Ve.parser});return Ve.initialized=!0,Ve}function Ca(n){return Ve.initialized||Ox(),Ax(Ve.parser.start,n,ip(Ve.scanner.start,n))}Ca.scan=ip;function hp(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 wa(t),o=Ca(n),s=[];for(let l=0;l<o.length;l++){const a=o[l];a.isLink&&(!e||a.t===e)&&r.check(a)&&s.push(a.toFormattedObject(r))}return s}var va="[\0-   ᠎ -\u2029  ]",Ix=new RegExp(va),Dx=new RegExp(`${va}$`),Rx=new RegExp(va,"g");function Fx(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function Px(n){return new Oe({key:new $e("autolink"),appendTransaction:(e,t,r)=>{const o=e.some(d=>d.docChanged)&&!t.doc.eq(r.doc),s=e.some(d=>d.getMeta("preventAutolink"));if(!o||s)return;const{tr:l}=r,a=Uu(t.doc,[...e]);if(nf(a).forEach(({newRange:d})=>{const u=Uy(r.doc,d,h=>h.isTextblock);let f,p;if(u.length>1)f=u[0],p=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const h=r.doc.textBetween(d.from,d.to," "," ");if(!Dx.test(h))return;f=u[0],p=r.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&p){const h=p.split(Ix).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],g=f.pos+p.lastIndexOf(m);if(!m)return!1;const y=Ca(m).map(b=>b.toObject(n.defaultProtocol));if(!Fx(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:g+b.start+1,to:g+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate(b.value)).filter(b=>n.shouldAutoLink(b.value)).forEach(b=>{Pi(b.from,b.to,r.doc).some(k=>k.mark.type===n.type)||l.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!l.steps.length)return l}})}function $x(n){return new Oe({key:new $e("handleClickLink"),props:{handleClick:(e,t,r)=>{var o,s;if(r.button!==0||!e.editable)return!1;let l=null;if(r.target instanceof HTMLAnchorElement)l=r.target;else{let u=r.target;const f=[];for(;u.nodeName!=="DIV";)f.push(u),u=u.parentNode;l=f.find(p=>p.nodeName==="A")}if(!l)return!1;const a=tf(e.state,n.type.name),c=(o=l?.href)!=null?o:a.href,d=(s=l?.target)!=null?s:a.target;return n.enableClickSelection&&n.editor.commands.extendMarkRange(n.type.name),l&&c?(window.open(c,d),!0):!1}}})}function zx(n){return new Oe({key:new $e("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:o}=e,{selection:s}=o,{empty:l}=s;if(l)return!1;let a="";r.content.forEach(d=>{a+=d.textContent});const c=hp(a,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===a);return!a||!c?!1:n.editor.commands.setMark(n.type,{href:c.href})}}})}function hr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const o=typeof r=="string"?r:r.scheme;o&&t.push(o)}),!n||n.replace(Rx,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var mp=Ht.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"){pp(n);return}pp(n.scheme,n.optionalSlashes)})},onDestroy(){Lx()},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)=>!!hr(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=>!!hr(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=>!!hr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",xe(this.options.HTMLAttributes,n),0]:["a",xe(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:r=>!!hr(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=>!!hr(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[$n({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:r}=this.options,o=hp(n).filter(s=>s.isLink&&this.options.isAllowedUri(s.value,{defaultValidate:l=>!!hr(l,t),protocols:t,defaultProtocol:r}));o.length&&o.forEach(s=>e.push({text:s.value,data:{href:s.href},index:s.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(Px({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:o=>!!hr(o,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&n.push($x({type:this.type,editor:this.editor,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(zx({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}}),Hx=Object.defineProperty,jx=(n,e)=>{for(var t in e)Hx(n,t,{get:e[t],enumerable:!0})},Ux="listItem",gp="textStyle",yp=/^\s*([-+*])\s$/,bp=Ue.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",xe(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(Ux,this.editor.getAttributes(gp)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Or({find:yp,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Or({find:yp,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(gp),editor:this.editor})),[n]}}),kp=Ue.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",xe(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)}}}),Wx={};jx(Wx,{findListItemPos:()=>_o,getNextListDepth:()=>_a,handleBackspace:()=>Sa,handleDelete:()=>Na,hasListBefore:()=>xp,hasListItemAfter:()=>Kx,hasListItemBefore:()=>wp,listItemHasSubList:()=>Ep,nextListIsDeeper:()=>Cp,nextListIsHigher:()=>vp});var _o=(n,e)=>{const{$from:t}=e.selection,r=He(n,e.schema);let o=null,s=t.depth,l=t.pos,a=null;for(;s>0&&a===null;)o=t.node(s),o.type===r?a=s:(s-=1,l-=1);return a===null?null:{$pos:e.doc.resolve(l),depth:a}},_a=(n,e)=>{const t=_o(n,e);if(!t)return!1;const[,r]=Qy(e,n,t.$pos.pos+4);return r},xp=(n,e,t)=>{const{$anchor:r}=n.selection,o=Math.max(0,r.pos-2),s=n.doc.resolve(o).node();return!(!s||!t.includes(s.type.name))},wp=(n,e)=>{var t;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-2);return!(o.index()===0||((t=o.nodeBefore)==null?void 0:t.type.name)!==n)},Ep=(n,e,t)=>{if(!t)return!1;const r=He(n,e.schema);let o=!1;return t.descendants(s=>{s.type===r&&(o=!0)}),o},Sa=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Pn(n.state,e)&&xp(n.state,e,t)){const{$anchor:a}=n.state.selection,c=n.state.doc.resolve(a.before()-1),d=[];c.node().descendants((p,h)=>{p.type.name===e&&d.push({node:p,pos:h})});const u=d.at(-1);if(!u)return!1;const f=n.state.doc.resolve(c.start()+u.pos+1);return n.chain().cut({from:a.start()-1,to:a.end()+1},f.end()).joinForward().run()}if(!Pn(n.state,e)||!rb(n.state))return!1;const r=_o(e,n.state);if(!r)return!1;const s=n.state.doc.resolve(r.$pos.pos-2).node(r.depth),l=Ep(e,n.state,s);return wp(e,n.state)&&!l?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},Cp=(n,e)=>{const t=_a(n,e),r=_o(n,e);return!r||!t?!1:t>r.depth},vp=(n,e)=>{const t=_a(n,e),r=_o(n,e);return!r||!t?!1:t<r.depth},Na=(n,e)=>{if(!Pn(n.state,e)||!nb(n.state,e))return!1;const{selection:t}=n.state,{$from:r,$to:o}=t;return!t.empty&&r.sameParent(o)?!1:Cp(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():vp(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},Kx=(n,e)=>{var t;const{$anchor:r}=e.selection,o=e.doc.resolve(r.pos-r.parentOffset-2);return!(o.index()===o.parent.childCount-1||((t=o.nodeAfter)==null?void 0:t.type.name)!==n)},_p=Ee.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&&Na(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&&Na(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&&Sa(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&&Sa(n,t,r)&&(e=!0)}),e}}}}),qx="listItem",Sp="textStyle",Np=/^(\d+)\.\s$/,Mp=Ue.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",xe(this.options.HTMLAttributes,t),0]:["ol",xe(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(qx,this.editor.getAttributes(Sp)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Or({find:Np,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=Or({find:Np,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Sp)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),Gx=/^\s*(\[([( |x])?\])\s$/,Jx=Ue.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",xe(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 o=document.createElement("li"),s=document.createElement("label"),l=document.createElement("span"),a=document.createElement("input"),c=document.createElement("div"),d=u=>{var f,p;a.ariaLabel=((p=(f=this.options.a11y)==null?void 0:f.checkboxLabel)==null?void 0:p.call(f,u,a.checked))||`Task item checkbox for ${u.textContent||"empty task item"}`};return d(n),s.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",u=>u.preventDefault()),a.addEventListener("change",u=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){a.checked=!a.checked;return}const{checked:f}=u.target;r.isEditable&&typeof t=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:p})=>{const h=t();if(typeof h!="number")return!1;const m=p.doc.nodeAt(h);return p.setNodeMarkup(h,void 0,{...m?.attrs,checked:f}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,f)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([u,f])=>{o.setAttribute(u,f)}),o.dataset.checked=n.attrs.checked,a.checked=n.attrs.checked,s.append(a,l),o.append(s,c),Object.entries(e).forEach(([u,f])=>{o.setAttribute(u,f)}),{dom:o,contentDOM:c,update:u=>u.type!==this.type?!1:(o.dataset.checked=u.attrs.checked,a.checked=u.attrs.checked,d(u),!0)}}},addInputRules(){return[Or({find:Gx,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),Yx=Ue.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",xe(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()}}});Ee.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(bp.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(kp.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(_p.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Mp.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Jx.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Yx.configure(this.options.taskList)),n}});var Tp=Ue.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",xe(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Xx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Zx=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Qx=Ht.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",xe(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[ur({find:Xx,type:this.type})]},addPasteRules(){return[$n({find:Zx,type:this.type})]}}),ew=Ue.create({name:"text",group:"inline"}),tw=Ht.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",xe(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 nw(n={}){return new Oe({view(e){return new rw(e,n)}})}class rw{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(o=>{let s=l=>{this[o](l)};return e.dom.addEventListener(o,s),{name:o,handler:s}})}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,o=this.editorView.dom,s=o.getBoundingClientRect(),l=s.width/o.offsetWidth,a=s.height/o.offsetHeight;if(t){let f=e.nodeBefore,p=e.nodeAfter;if(f||p){let h=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(h){let m=h.getBoundingClientRect(),g=f?m.bottom:m.top;f&&p&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*a;r={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!r){let f=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*l;r={left:f.left-p,right:f.left+p,top:f.top,bottom:f.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 f=c.getBoundingClientRect(),p=f.width/c.offsetWidth,h=f.height/c.offsetHeight;d=f.left-c.scrollLeft*p,u=f.top-c.scrollTop*h}this.element.style.left=(r.left-d)/l+"px",this.element.style.top=(r.top-u)/a+"px",this.element.style.width=(r.right-r.left)/l+"px",this.element.style.height=(r.bottom-r.top)/a+"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),o=r&&r.type.spec.disableDropCursor,s=typeof o=="function"?o(this.editorView,t,e):o;if(t&&!s){let l=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=rd(this.editorView.state.doc,l,this.editorView.dragging.slice);a!=null&&(l=a)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Pe extends le{constructor(e){super(e,e)}map(e,t){let r=e.resolve(t.map(this.head));return Pe.valid(r)?new Pe(r):le.near(r)}content(){return J.empty}eq(e){return e instanceof Pe&&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 Pe(e.resolve(t.pos))}getBookmark(){return new Ma(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!ow(e)||!sw(e))return!1;let r=t.type.spec.allowGapCursor;if(r!=null)return r;let o=t.contentMatchAt(e.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(e,t,r=!1){e:for(;;){if(!r&&Pe.valid(e))return e;let o=e.pos,s=null;for(let l=e.depth;;l--){let a=e.node(l);if(t>0?e.indexAfter(l)<a.childCount:e.index(l)>0){s=a.child(t>0?e.indexAfter(l):e.index(l)-1);break}else if(l==0)return null;o+=t;let c=e.doc.resolve(o);if(Pe.valid(c))return c}for(;;){let l=t>0?s.firstChild:s.lastChild;if(!l){if(s.isAtom&&!s.isText&&!ne.isSelectable(s)){e=e.doc.resolve(o+s.nodeSize*t),r=!1;continue e}break}s=l,o+=t;let a=e.doc.resolve(o);if(Pe.valid(a))return a}return null}}}Pe.prototype.visible=!1,Pe.findFrom=Pe.findGapCursorFrom,le.jsonID("gapcursor",Pe);class Ma{constructor(e){this.pos=e}map(e){return new Ma(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Pe.valid(t)?new Pe(t):le.near(t)}}function ow(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 o=r.child(t-1);;o=o.lastChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function sw(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 o=r.child(t);;o=o.firstChild){if(o.childCount==0&&!o.inlineContent||o.isAtom||o.type.spec.isolating)return!0;if(o.inlineContent)return!1}}return!0}function lw(){return new Oe({props:{decorations:dw,createSelectionBetween(n,e,t){return e.pos==t.pos&&Pe.valid(t)?new Pe(t):null},handleClick:aw,handleKeyDown:iw,handleDOMEvents:{beforeinput:cw}}})}const iw=Ni({ArrowLeft:hl("horiz",-1),ArrowRight:hl("horiz",1),ArrowUp:hl("vert",-1),ArrowDown:hl("vert",1)});function hl(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,o,s){let l=r.selection,a=e>0?l.$to:l.$from,c=l.empty;if(l instanceof oe){if(!s.endOfTextblock(t)||a.depth==0)return!1;c=!1,a=r.doc.resolve(e>0?a.after():a.before())}let d=Pe.findGapCursorFrom(a,e,c);return d?(o&&o(r.tr.setSelection(new Pe(d))),!0):!1}}function aw(n,e,t){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(e);if(!Pe.valid(r))return!1;let o=n.posAtCoords({left:t.clientX,top:t.clientY});return o&&o.inside>-1&&ne.isSelectable(n.state.doc.nodeAt(o.inside))?!1:(n.dispatch(n.state.tr.setSelection(new Pe(r))),!0)}function cw(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof Pe))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 o=I.empty;for(let l=r.length-1;l>=0;l--)o=I.from(r[l].createAndFill(null,o));let s=n.state.tr.replace(t.pos,t.pos,new J(o,0,0));return s.setSelection(oe.near(s.doc.resolve(t.pos+1))),n.dispatch(s),!1}function dw(n){if(!(n.selection instanceof Pe))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Me.create(n.doc,[Ye.widget(n.selection.head,e,{key:"gapcursor"})])}var ml=200,Xe=function(){};Xe.prototype.append=function(e){return e.length?(e=Xe.from(e),!this.length&&e||e.length<ml&&this.leafAppend(e)||this.length<ml&&e.leafPrepend(this)||this.appendInner(e)):this},Xe.prototype.prepend=function(e){return e.length?Xe.from(e).append(this):this},Xe.prototype.appendInner=function(e){return new uw(this,e)},Xe.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?Xe.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},Xe.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},Xe.prototype.forEach=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length),t<=r?this.forEachInner(e,t,r,0):this.forEachInvertedInner(e,t,r,0)},Xe.prototype.map=function(e,t,r){t===void 0&&(t=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(s,l){return o.push(e(s,l))},t,r),o},Xe.from=function(e){return e instanceof Xe?e:e&&e.length?new Ap(e):Xe.empty};var Ap=(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(o,s){return o==0&&s==this.length?this:new e(this.values.slice(o,s))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,s,l,a){for(var c=s;c<l;c++)if(o(this.values[c],a+c)===!1)return!1},e.prototype.forEachInvertedInner=function(o,s,l,a){for(var c=s-1;c>=l;c--)if(o(this.values[c],a+c)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=ml)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=ml)return new e(o.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(Xe);Xe.empty=new Ap([]);var uw=(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(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,o,s,l){var a=this.left.length;if(o<a&&this.left.forEachInner(r,o,Math.min(s,a),l)===!1||s>a&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,s)-a,l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,s,l){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(s,a)-a,l+a)===!1||s<a&&this.left.forEachInvertedInner(r,Math.min(o,a),s,l)===!1)return!1},e.prototype.sliceInner=function(r,o){if(r==0&&o==this.length)return this;var s=this.left.length;return o<=s?this.left.slice(r,o):r>=s?this.right.slice(r-s,o-s):this.left.slice(r,s).append(this.right.slice(0,o-s))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(Xe);const fw=500;class Ut{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 o,s;t&&(o=this.remapping(r,this.items.length),s=o.maps.length);let l=e.tr,a,c,d=[],u=[];return this.items.forEach((f,p)=>{if(!f.step){o||(o=this.remapping(r,p+1),s=o.maps.length),s--,u.push(f);return}if(o){u.push(new en(f.map));let h=f.step.map(o.slice(s)),m;h&&l.maybeStep(h).doc&&(m=l.mapping.maps[l.mapping.maps.length-1],d.push(new en(m,void 0,void 0,d.length+u.length))),s--,m&&o.appendMap(m,s)}else l.maybeStep(f.step);if(f.selection)return a=o?f.selection.map(o.slice(s)):f.selection,c=new Ut(this.items.slice(0,r).append(u.reverse().concat(d)),this.eventCount-1),!1},this.items.length,0),{remaining:c,transform:l,selection:a}}addTransform(e,t,r,o){let s=[],l=this.eventCount,a=this.items,c=!o&&a.length?a.get(a.length-1):null;for(let u=0;u<e.steps.length;u++){let f=e.steps[u].invert(e.docs[u]),p=new en(e.mapping.maps[u],f,t),h;(h=c&&c.merge(p))&&(p=h,u?s.pop():a=a.slice(0,a.length-1)),s.push(p),t&&(l++,t=void 0),o||(c=p)}let d=l-r.depth;return d>hw&&(a=pw(a,d),l-=d),new Ut(a.append(s),l)}remapping(e,t){let r=new Xr;return this.items.forEach((o,s)=>{let l=o.mirrorOffset!=null&&s-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,l)},e,t),r}addMaps(e){return this.eventCount==0?this:new Ut(this.items.append(e.map(t=>new en(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-t),s=e.mapping,l=e.steps.length,a=this.eventCount;this.items.forEach(p=>{p.selection&&a--},o);let c=t;this.items.forEach(p=>{let h=s.getMirror(--c);if(h==null)return;l=Math.min(l,h);let m=s.maps[h];if(p.step){let g=e.steps[h].invert(e.docs[h]),y=p.selection&&p.selection.map(s.slice(c+1,h));y&&a++,r.push(new en(m,g,y))}else r.push(new en(m))},o);let d=[];for(let p=t;p<l;p++)d.push(new en(s.maps[p]));let u=this.items.slice(0,o).append(d).append(r),f=new Ut(u,a);return f.emptyItemCount()>fw&&(f=f.compress(this.items.length-r.length)),f}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,o=[],s=0;return this.items.forEach((l,a)=>{if(a>=e)o.push(l),l.selection&&s++;else if(l.step){let c=l.step.map(t.slice(r)),d=c&&c.getMap();if(r--,d&&t.appendMap(d,r),c){let u=l.selection&&l.selection.map(t.slice(r));u&&s++;let f=new en(d.invert(),c,u),p,h=o.length-1;(p=o.length&&o[h].merge(f))?o[h]=p:o.push(f)}}else l.map&&r--},this.items.length,0),new Ut(Xe.from(o.reverse()),s)}}Ut.empty=new Ut(Xe.empty,0);function pw(n,e){let t;return n.forEach((r,o)=>{if(r.selection&&e--==0)return t=o,!1}),n.slice(t)}class en{constructor(e,t,r,o){this.map=e,this.step=t,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new en(t.getMap().invert(),t,this.selection)}}}class Wn{constructor(e,t,r,o,s){this.done=e,this.undone=t,this.prevRanges=r,this.prevTime=o,this.prevComposition=s}}const hw=20;function mw(n,e,t,r){let o=t.getMeta(mr),s;if(o)return o.historyState;t.getMeta(bw)&&(n=new Wn(n.done,n.undone,null,0,-1));let l=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(l&&l.getMeta(mr))return l.getMeta(mr).redo?new Wn(n.done.addTransform(t,void 0,r,gl(e)),n.undone,Bp(t.mapping.maps),n.prevTime,n.prevComposition):new Wn(n.done,n.undone.addTransform(t,void 0,r,gl(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let a=t.getMeta("composition"),c=n.prevTime==0||!l&&n.prevComposition!=a&&(n.prevTime<(t.time||0)-r.newGroupDelay||!gw(t,n.prevRanges)),d=l?Ta(n.prevRanges,t.mapping):Bp(t.mapping.maps);return new Wn(n.done.addTransform(t,c?e.selection.getBookmark():void 0,r,gl(e)),Ut.empty,d,t.time,a??n.prevComposition)}else return(s=t.getMeta("rebased"))?new Wn(n.done.rebased(t,s),n.undone.rebased(t,s),Ta(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new Wn(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Ta(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function gw(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((r,o)=>{for(let s=0;s<e.length;s+=2)r<=e[s+1]&&o>=e[s]&&(t=!0)}),t}function Bp(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((r,o,s,l)=>e.push(s,l));return e}function Ta(n,e){if(!n)return null;let t=[];for(let r=0;r<n.length;r+=2){let o=e.map(n[r],1),s=e.map(n[r+1],-1);o<=s&&t.push(o,s)}return t}function yw(n,e,t){let r=gl(e),o=mr.get(e).spec.config,s=(t?n.undone:n.done).popEvent(e,r);if(!s)return null;let l=s.selection.resolve(s.transform.doc),a=(t?n.done:n.undone).addTransform(s.transform,e.selection.getBookmark(),o,r),c=new Wn(t?a:s.remaining,t?s.remaining:a,null,0,-1);return s.transform.setSelection(l).setMeta(mr,{redo:t,historyState:c})}let Aa=!1,Vp=null;function gl(n){let e=n.plugins;if(Vp!=e){Aa=!1,Vp=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){Aa=!0;break}}return Aa}const mr=new $e("history"),bw=new $e("closeHistory");function kw(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new Oe({key:mr,state:{init(){return new Wn(Ut.empty,Ut.empty,null,0,-1)},apply(e,t,r){return mw(t,r,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let r=t.inputType,o=r=="historyUndo"?Op:r=="historyRedo"?Ip:null;return o?(t.preventDefault(),o(e.state,e.dispatch)):!1}}}})}function Lp(n,e){return(t,r)=>{let o=mr.getState(t);if(!o||(n?o.undone:o.done).eventCount==0)return!1;if(r){let s=yw(o,t,n);s&&r(e?s.scrollIntoView():s)}return!0}}const Op=Lp(!1,!0),Ip=Lp(!0,!0);Ee.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 r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}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 Oe({key:new $e("characterCount"),appendTransaction:(e,t,r)=>{if(n)return;const o=this.options.limit;if(o==null||o===0){n=!0;return}const s=this.storage.characters({node:r.doc});if(s>o){const l=s-o,a=0,c=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const d=r.tr.deleteRange(a,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 o=this.storage.characters({node:t.doc}),s=this.storage.characters({node:e.doc});if(s<=r||o>r&&s>r&&s<=o)return!0;if(o>r&&s>r&&s>o||!e.getMeta("paste"))return!1;const a=e.selection.$head.pos,c=s-r,d=a-c,u=a;return e.deleteRange(d,u),!(this.storage.characters({node:e.doc})>r)}})]}});var xw=Ee.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[nw(this.options)]}});Ee.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Oe({key:new $e("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:r}=this.editor,{anchor:o}=e,s=[];if(!t||!r)return Me.create(n,[]);let l=0;this.options.mode==="deepest"&&n.descendants((c,d)=>{if(c.isText)return;if(!(o>=d&&o<=d+c.nodeSize-1))return!1;l+=1});let a=0;return n.descendants((c,d)=>{if(c.isText||!(o>=d&&o<=d+c.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&l-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";s.push(Ye.node(d,d+c.nodeSize,{class:this.options.className}))}),Me.create(n,s)}}})]}});var ww=Ee.create({name:"gapCursor",addProseMirrorPlugins(){return[lw()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=ke(te(n,"allowGapCursor",t)))!=null?e:null}}});Ee.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new Oe({key:new $e("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=e,o=[];if(!t)return null;const s=this.editor.isEmpty;return n.descendants((l,a)=>{const c=r>=a&&r<=a+l.nodeSize,d=!l.isLeaf&&Cs(l);if((c||!this.options.showOnlyCurrent)&&d){const u=[this.options.emptyNodeClass];s&&u.push(this.options.emptyEditorClass);const f=Ye.node(a,a+l.nodeSize,{class:u.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:l,pos:a,hasAnchor:c}):this.options.placeholder});o.push(f)}return this.options.includeChildren}),Me.create(n,o)}}})]}}),Ee.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new Oe({key:new $e("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||af(t.selection)||n.view.dragging?null:Me.create(t.doc,[Ye.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Dp({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||e?.type===n}var Ew=Ee.create({name:"trailingNode",addOptions(){return{node:"paragraph",notAfter:[]}},addProseMirrorPlugins(){const n=new $e(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 Oe({key:n,appendTransaction:(t,r,o)=>{const{doc:s,tr:l,schema:a}=o,c=n.getState(o),d=s.content.size,u=a.nodes[this.options.node];if(c)return l.insert(d,u.create())},state:{init:(t,r)=>{const o=r.tr.doc.lastChild;return!Dp({node:o,types:e})},apply:(t,r)=>{if(!t.docChanged)return r;const o=t.doc.lastChild;return!Dp({node:o,types:e})}}})]}}),Cw=Ee.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>Op(n,e),redo:()=>({state:n,dispatch:e})=>Ip(n,e)}},addProseMirrorPlugins(){return[kw(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()}}}),vw=Ee.create({name:"starterKit",addExtensions(){var n,e,t,r;const o=[];return this.options.bold!==!1&&o.push(rx.configure(this.options.bold)),this.options.blockquote!==!1&&o.push(Zk.configure(this.options.blockquote)),this.options.bulletList!==!1&&o.push(bp.configure(this.options.bulletList)),this.options.code!==!1&&o.push(lx.configure(this.options.code)),this.options.codeBlock!==!1&&o.push(cx.configure(this.options.codeBlock)),this.options.document!==!1&&o.push(dx.configure(this.options.document)),this.options.dropcursor!==!1&&o.push(xw.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&o.push(ww.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&o.push(ux.configure(this.options.hardBreak)),this.options.heading!==!1&&o.push(Zf.configure(this.options.heading)),this.options.undoRedo!==!1&&o.push(Cw.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&o.push(fx.configure(this.options.horizontalRule)),this.options.italic!==!1&&o.push(yx.configure(this.options.italic)),this.options.listItem!==!1&&o.push(kp.configure(this.options.listItem)),this.options.listKeymap!==!1&&o.push(_p.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&o.push(mp.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&o.push(Mp.configure(this.options.orderedList)),this.options.paragraph!==!1&&o.push(Tp.configure(this.options.paragraph)),this.options.strike!==!1&&o.push(Qx.configure(this.options.strike)),this.options.text!==!1&&o.push(ew.configure(this.options.text)),this.options.underline!==!1&&o.push(tw.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&o.push(Ew.configure((r=this.options)==null?void 0:r.trailingNode)),o}}),_w=vw,Sw=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Nw=Ue.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",xe(this.options.HTMLAttributes,n)]},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[Sf({find:Sw,type:this.type,getAttributes:n=>{const[,,e,t,r]=n;return{src:t,alt:e,title:r}}})]}}),Mw=Ee.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 Tw=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)}},Aw=async(n,e)=>{const t=e.clipboardData?.items;if(t){const r=e.clipboardData?.getData("text/html"),o=e.clipboardData?.getData("text/plain");if(r){const{state:s,dispatch:l}=n,{tr:a}=s,c=wr.fromSchema(n.state.schema),d=new DOMParser().parseFromString(r,"text/html").body,u=c.parse(d),f=a.replaceSelectionWith(u);return l(f),e.preventDefault(),!0}if(o){const{state:s,dispatch:l}=n,{tr:a}=s,c=a.insertText(o,s.selection.from,s.selection.to);return l(c),e.preventDefault(),!0}for(let s=0;s<t.length;s++){const l=t[s];if(l.type.startsWith("image/")){const a=l.getAsFile();if(a){const c=await Tw(a),{schema:d}=n.state,u=d.nodes.image.create({src:c?.file_path}),f=n.state.tr.replaceSelectionWith(u);return n.dispatch(f),e.preventDefault(),!0}}}}return!1},Bw={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;"},Vw=Zf.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:Bw[e-1]}}}}}}),Lw=Tp.configure({HTMLAttributes:{style:"min-height: 1rem;"}}),Ow=qi.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()}}}),Iw=qi.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()}}}),Dw=Ue.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 Rp(n){let e=!1;const t=A1({content:n.modelValue,extensions:[_w.configure({history:{depth:100,newGroupDelay:500},code:{HTMLAttributes:{class:"editor-code"}},codeBlock:{HTMLAttributes:{class:"editor-codeblock"}},paragraph:!1,heading:!1,link:!1}),Yk,Jk,F1,Ow,Iw,Lw,Vw,Gk,Nw.configure({inline:!0,allowBase64:!0,HTMLAttributes:{class:"editor-image"}}),Mw.configure({types:["heading","paragraph"]}),mp.configure({HTMLAttributes:{class:"editor-link"},openOnClick:!1,autolink:!0}),Wk.configure({table:{HTMLAttributes:{class:"editor-content"},resizable:!0}}),Dw],editorProps:{handlePaste:Aw,handleKeyDown:(s,l)=>{if(l.key==="Tab"){const a=s.state,{selection:c}=a,{$anchor:d}=c;let u=!1;for(let f=d.depth;f>0;f--){const p=d.node(f);if(p&&(p.type.name==="bulletList"||p.type.name==="orderedList")){u=!0;break}}return u?!1:(l.preventDefault(),!0)}return!1}}}),r=i.computed(()=>t.value||null);return i.watch(t,s=>{s&&t.value.on("update",l=>{if(!e){e=!0;const a=l.editor.getHTML();n.modelValue,setTimeout(()=>{e=!1},10)}})}),{editor:t,editorInstance:r,focusEditor:()=>{t.value&&!t.value.isFocused&&t.value.commands.focus()}}}function Fp(n,e){const t=i.ref(!1),r=i.ref(""),o=i.ref(null);return{isHtmlMode:t,htmlContent:r,htmlTextarea:o,toggleHtmlMode:a=>{t.value=a,a?(n.value&&(r.value=n.value.getHTML()),i.nextTick(()=>{o.value&&(o.value.focus(),setTimeout(()=>{o.value.formatCode()},100))})):n.value&&r.value&&n.value.commands.setContent(r.value,!0)},onHtmlInput:a=>{r.value=a,e&&e("update:modelValue",a)}}}function Pp(){const n=i.ref(!1);return{isFullscreen:n,toggleFullscreen:()=>{n.value=!n.value}}}const Le=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t},Rw={props:{editor:Object},methods:{toggleBlockquote(){this.editor&&this.editor.chain().toggleBlockquote().run()}}};function Fw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Blockquote",onClick:e[0]||(e[0]=(...l)=>s.toggleBlockquote&&s.toggleBlockquote(...l)),class:i.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]=[i.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 24 24"},[i.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 Pw=Le(Rw,[["render",Fw]]),$w={props:{editor:Object},methods:{toggleBulletList(){this.editor&&this.editor.chain().focus().toggleBulletList().run()}}};function zw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Bullet List",onClick:e[0]||(e[0]=(...l)=>s.toggleBulletList&&s.toggleBulletList(...l)),class:i.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]=[i.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[i.createElementVNode("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"2",d:"M9 8h10M9 12h10M9 16h10M4.99 8H5m-.02 4h.01m0 4H5"})],-1)])],2)}const Hw=Le($w,[["render",zw]]),jw={props:{editor:Object},methods:{toggleOrderedList(){this.editor&&this.editor.chain().focus().toggleOrderedList().run()}}};function Uw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Ordered List",onClick:e[0]||(e[0]=(...l)=>s.toggleOrderedList&&s.toggleOrderedList(...l)),class:i.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]=[i.createElementVNode("svg",{height:"16",width:"16",xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"},[i.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 Ww=Le(jw,[["render",Uw]]),Kw={props:{editor:Object},methods:{toggleCodeBlock(){this.editor&&this.editor.chain().focus().toggleCodeBlock().run()}}};function qw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Code Block",onClick:e[0]||(e[0]=(...l)=>s.toggleCodeBlock&&s.toggleCodeBlock(...l)),class:i.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]=[i.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.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 Gw=Le(Kw,[["render",qw]]),Jw={props:{editor:Object},methods:{toggleBold(){this.editor&&this.editor.commands.toggleBold()}}};function Yw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Bold Text",onClick:e[0]||(e[0]=(...l)=>s.toggleBold&&s.toggleBold(...l)),class:i.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]=[i.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.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),i.createElementVNode("span",{class:"sr-only"},"Bold",-1)])],2)}const Xw=Le(Jw,[["render",Yw]]),Zw={props:{editor:Object},methods:{toggleItalic(){this.editor&&this.editor.chain().toggleItalic().run()}}};function Qw(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Italic Text",onClick:e[0]||(e[0]=(...l)=>s.toggleItalic&&s.toggleItalic(...l)),class:i.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]=[i.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.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),i.createElementVNode("span",{class:"sr-only"},"Italic",-1)])],2)}const eE=Le(Zw,[["render",Qw]]),tE={__name:"vs-editor-underline",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().toggleUnderline().run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Underline",onClick:t,class:i.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"]])},[...o[0]||(o[0]=[i.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"},[i.createElementVNode("path",{d:"M6 4v6a6 6 0 0 0 12 0V4"}),i.createElementVNode("line",{x1:"4",x2:"20",y1:"20",y2:"20"})],-1)])],2))}},nE={__name:"vs-editor-strike",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().toggleStrike().run()};return(r,o)=>(i.openBlock(),i.createElementBlock("button",{title:"Strikethrough",onClick:t,class:i.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"]])},[...o[0]||(o[0]=[i.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"},[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.createElementVNode("path",{d:"M5 12l14 0"}),i.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))}},rE={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()}}},oE={key:0,class:"vsTailwind ui-dialog__wrapper"},sE={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},lE={class:"font-medium text-gray-800 dark:text-[#ffffff]"},iE={class:"ui-dialog__content p-4"},aE={key:0,class:"flex justify-end gap-x-2"};function cE(n,e,t,r,o,s){return i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[t.visible||t.modelValue?(i.openBlock(),i.createElementBlock("div",oE,[i.createElementVNode("div",{onMousedown:e[1]||(e[1]=l=>s.closeByClickBack(l,t.closeClickBack)),class:"vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 z-[100001] bg-black bg-opacity-50"},[i.createVNode(i.Transition,{name:"content",appear:""},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.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.checkSize]])},[i.createElementVNode("div",sE,[i.createElementVNode("h3",lE,i.toDisplayString(t.title),1),i.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]=(...l)=>s.handleClose&&s.handleClose(...l))},[...e[2]||(e[2]=[i.createElementVNode("span",{class:"sr-only"},"Close",-1),i.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"},[i.createElementVNode("path",{d:"M18 6 6 18"}),i.createElementVNode("path",{d:"m6 6 12 12"})],-1)])])]),i.createElementVNode("div",iE,[i.renderSlot(n.$slots,"default",{},void 0,!0)]),s.hasSlot?(i.openBlock(),i.createElementBlock("div",aE,[i.renderSlot(n.$slots,"footer",{handleClose:s.handleClose,handleConfirm:s.handleConfirm,handleCancel:s.handleCancel},void 0,!0)])):i.createCommentVNode("",!0)],2)]),_:3})],32)])):i.createCommentVNode("",!0)])}const $p=Le(rE,[["render",cE],["__scopeId","data-v-6d0970a6"]]),dE={},uE={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 fE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",uE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),i.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])])}const pE=Le(dE,[["render",fE]]),hE={},mE={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 gE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",mE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),i.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)])])}const yE=Le(hE,[["render",gE]]),bE={},kE={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 xE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",kE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.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),i.createElementVNode("path",{d:"M3 7l9 6l9 -6"},null,-1)])])}const wE=Le(bE,[["render",xE]]),EE=i.defineComponent({components:{IconClose:pE,IconSearch:yE,IconEmail:wE},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()}}}),CE={class:"vs-form-text relative bg-white rounded-lg"},vE={key:2,class:"absolute bottom-2/4 translate-y-2/4 left-[10px] cursor-pointer"},_E=["disabled","type","placeholder"];function SE(n,e,t,r,o,s){const l=i.resolveComponent("IconClose"),a=i.resolveComponent("IconSearch"),c=i.resolveComponent("IconEmail");return i.openBlock(),i.createElementBlock("div",CE,[n.clearable&&n.value?(i.openBlock(),i.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))},[i.createVNode(l,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):i.createCommentVNode("",!0),n.icon&&n.icon==="search"?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["absolute bottom-2/4 translate-y-2/4 cursor-pointer",n.iconStylePosition])},[i.createVNode(a,{width:"15px",height:"15px",class:"stroke-gray-500 transition-all"})],2)):n.icon&&n.icon==="email"?(i.openBlock(),i.createElementBlock("div",vE,[i.createVNode(c,{width:"16",height:"16",class:"stroke-gray-500 transition-all"})])):(i.openBlock(),i.createElementBlock("i",{key:3,class:i.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?(i.openBlock(),i.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))},[i.createVNode(l,{width:"15px",height:"15px",class:"stroke-gray-500 hover:stroke-red-500 transition-all"})])):i.createCommentVNode("",!0),i.withDirectives(i.createElementVNode("input",i.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,_E),[[i.vModelDynamic,n.value]])])}const zp=Le(EE,[["render",SE],["__scopeId","data-v-749b581f"]]);function Ba(){const n=i.ref("en");return{t:t=>({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"},uk:{type_tag:"Тип тегу",heading_1:"Заголовок 1",heading_2:"Заголовок 2",heading_3:"Заголовок 3",paragraph:"Параграф",createTable:"Створити Таблицю",addColumn:"Додати Колону",addRow:"Додати Рядок",deleteColumn:"Вилучити Колону",deleteRow:"Вилучити Рядок",deleteTable:"Вилучити Таблицю",mergeCells:"Об'єднати Клітинки",splitCells:"Розділити Клітинки",linkTitle:"Введіть Посилання"}})[n.value]?.[t]||t,locale:n}}const NE={class:"flex flex-col gap-3 p-[20px]"},ME={class:"relative flex items-center gap-2"},TE={class:"flex-1"},AE={key:0,class:"flex items-center gap-2 flex-shrink-0"},BE={class:"flex justify-end p-[20px] gap-[10px] border-t w-full"},VE=Object.assign({inheritAttrs:!1},{__name:"vs-editor-link",props:{editor:Object},setup(n){const{t:e}=Ba(),t=n,r=i.ref(!1),o=i.ref(""),s=i.ref(!1),l=()=>{if(!t.editor)return;t.editor.chain().focus().extendMarkRange("link").run();const f=t.editor.getAttributes("link");f.href?(s.value=!0,o.value=f.href):(s.value=!1,o.value=""),r.value=!0},a=()=>{r.value=!1,o.value="",s.value=!1},c=()=>{if(!t.editor||!o.value.trim())return;let f=o.value.trim();f.match(/^https?:\/\//i)||(f="https://"+f),t.editor.chain().focus().setLink({href:f}).run(),a()},d=()=>{t.editor&&(t.editor.chain().focus().unsetLink().run(),a())},u=()=>{if(!o.value)return;let f=o.value.trim();f.match(/^https?:\/\//i)||(f="https://"+f),window.open(f,"_blank","noopener,noreferrer")};return(f,p)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createElementVNode("button",{title:"Link",onClick:l,class:i.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")}])},[...p[2]||(p[2]=[i.createElementVNode("svg",{"aria-hidden":"true",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none",viewBox:"0 0 24 24"},[i.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)])],2),i.createVNode($p,{title:s.value?i.unref(e)("editLink")||"Edit Link":i.unref(e)("linkTitle")||"Add Link",visible:r.value,"onUpdate:visible":p[1]||(p[1]=h=>r.value=h),size:"small"},{footer:i.withCtx(()=>[i.createElementVNode("div",BE,[i.createElementVNode("button",{style:{border:"1px solid #000"},onClick:a,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"},i.toDisplayString(i.unref(e)("cancel")||"Cancel"),1),i.createElementVNode("button",{onClick:c,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"},i.toDisplayString(s.value?i.unref(e)("update")||"Update":i.unref(e)("create")||"Create"),1)])]),default:i.withCtx(()=>[i.createElementVNode("div",NE,[i.createElementVNode("div",ME,[i.createElementVNode("div",TE,[i.createVNode(zp,{modelValue:o.value,"onUpdate:modelValue":p[0]||(p[0]=h=>o.value=h),placeholder:i.unref(e)("linkUrl")||"Enter URL",class:"w-full"},null,8,["modelValue","placeholder"])]),s.value?(i.openBlock(),i.createElementBlock("div",AE,[i.createElementVNode("button",{onClick:u,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:"Open link"},[...p[3]||(p[3]=[i.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"},[i.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)])]),i.createElementVNode("button",{onClick:d,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:"Remove link"},[...p[4]||(p[4]=[i.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"},[i.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)])])])):i.createCommentVNode("",!0)])])]),_:1},8,["title","visible"])],64))}}),So=async(n,e,t,r=10)=>{if(!e||!t)return;await i.nextTick();const o=await t?.getBoundingClientRect(),s=await e?.getBoundingClientRect();if(!s||!o)return;const l=await parseInt(e?.getBoundingClientRect()?.height),a=await parseInt(e?.getBoundingClientRect()?.width),c=await parseInt(t?.getBoundingClientRect()?.height),d=await parseInt(t?.getBoundingClientRect()?.width),u=await window.innerHeight,f=await window.innerWidth;let p=0,h=0;const m=s.bottom+r+c;switch(n){case"top":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,f>d+s.right+30?h=s.left-o.width/2+s.width/2:h=f-30-d;break;case"bottom":u>m?p=s.bottom+r:p=s.bottom-r-c-l,h=s.left-o.width/2+s.width/2;break;case"left":p=s.top-o.height/2+s.height/2,s.left-o.width-r>0?h=s.left-o.width-r:h=10;break;case"right":p=s.top-o.height/2+s.height/2,f-a>d?h=s.right+r:h=f-30-d;break;case"top-right":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,f-a>d?h=s.right+r:h=f-30-d;break;case"top-left":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,s.left-o.width-r>0?h=s.left-o.width-r:h=10;break;case"top-start":s.top-o.height-r<0?p=s.top-o.height+r+c+l:p=s.top-o.height-r,s.left>0?h=s.left:h=10;break;case"bottom-right":u>m?p=s.bottom+r:p=s.bottom-r-c-l,f-a>d?h=s.left:h=f-30-d;break;case"bottom-left":u>m?p=s.bottom+r:p=s.bottom-r-c-l,s.left>0?h=s.right-d:h=10;break;case"bottom-start":u>m?p=s.bottom+r:p=s.bottom-r-c-l,s.left>0?h=s.left:h=10;break}p+c>u?p=u-c-r:p<0&&(p=r),h+d>f?h=f-d-r:h<0&&(h=r),t instanceof HTMLElement&&(t.style.top=`${p}px`,t.style.left=`${h}px`,t.style.position="fixed")},LE={class:"text-center"},OE={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"},Kn=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,o=t,s=i.ref(!1),l=i.ref([]),a=i.ref(null),c=i.ref(null),d=i.ref(null);i.watch(s,C=>{C?(u(),window.addEventListener("resize",()=>So(r.placement,c.value,d.value)),So(r.placement,c.value,d.value)):window.removeEventListener("resize",()=>So(r.placement,c.value,d.value)),o("isvisible",C)}),i.onMounted(()=>{window.addEventListener("click",y),window.addEventListener("popstate",b),window.addEventListener("scroll",k,!0),u()}),i.onBeforeUnmount(()=>{window.removeEventListener("click",y),window.removeEventListener("popstate",b),f()});const u=()=>{let C=a.value;for(;C&&C!==document.body;)(C.scrollHeight>C.clientHeight||C.scrollWidth>C.clientWidth)&&(C.addEventListener("scroll",g),l.value.push(C)),C=C.parentElement;document.body&&(document.body.addEventListener("scroll",g),l.value.push(document.body))},f=()=>{l.value.forEach(C=>{C.removeEventListener("scroll",g)}),l.value=[]},p=()=>{s.value=!0,So(r.placement,c.value,d.value)},h=()=>{s.value=!1},m=async()=>{await So(r.placement,c.value,d.value),s.value=!s.value},g=()=>{s.value=!1},y=C=>{if(!C){s.value=!1;return}c.value?.contains(C.target)||d.value?.contains(C.target)||(s.value=!1)},b=()=>{s.value&&(s.value=!1)},k=C=>{s.value&&d.value&&!d.value.contains(C.target)&&(s.value=!1)};return e({togglePopover:m}),(C,x)=>(i.openBlock(),i.createElementBlock("div",{ref_key:"popover",ref:a,class:"vs-popover inline-block"},[i.createElementVNode("div",LE,[n.trigger==="click"?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"popoverRef",ref:c,onClick:m,class:i.normalizeClass({"pointer-events-none":n.disabled})},[i.renderSlot(C.$slots,"reference",{},()=>[x[0]||(x[0]=i.createElementVNode("button",null,"Click me!",-1))])],2)):i.createCommentVNode("",!0),n.trigger==="hover"?(i.openBlock(),i.createElementBlock("div",{key:1,ref_key:"popoverRef",ref:c,onMouseover:p,onMouseleave:h,class:i.normalizeClass({"pointer-events-none":n.disabled})},[i.renderSlot(C.$slots,"reference",{},()=>[x[1]||(x[1]=i.createElementVNode("button",null,"Click me!",-1))])],34)):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.Teleport,{to:n.teleport},[i.createVNode(i.Transition,{name:"fade"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("div",{class:i.normalizeClass(["vsTailwind vs-popover__content",n.placement]),ref_key:"contentPop",ref:d,style:i.normalizeStyle({width:n.width?n.width+"px":"fit-content",zIndex:100001})},[i.createElementVNode("div",OE,[i.renderSlot(C.$slots,"default",{},()=>[x[2]||(x[2]=i.createElementVNode("span",null,"Popover content",-1))])])],6),[[i.vShow,s.value]])]),_:3})],8,["to"]))])],512))}}),IE={class:"flex flex-col gap-[2px] p-[2px]"},DE=["onClick"],RE={__name:"vs-editor-table",props:{editor:Object},setup(n){const{t:e}=Ba(),t=n,r=i.ref(!1),o=i.ref("popover"),s=()=>{t.editor&&(t.editor.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),o.value.togglePopover())},l=()=>{t.editor&&(t.editor.chain().focus().addColumnAfter().run(),o.value.togglePopover())},a=()=>{t.editor&&(t.editor.chain().focus().addRowAfter().run(),o.value.togglePopover())},c=()=>{t.editor&&(t.editor.chain().focus().deleteColumn().run(),o.value.togglePopover())},d=()=>{t.editor&&(t.editor.chain().focus().deleteRow().run(),o.value.togglePopover())},u=()=>{t.editor&&(t.editor.chain().focus().deleteTable().run(),o.value.togglePopover())},f=()=>{t.editor&&(t.editor.chain().focus().mergeCells().run(),o.value.togglePopover())},p=()=>{t.editor&&(t.editor.chain().focus().splitCell().run(),o.value.togglePopover())},h=i.computed(()=>[{text:e("createTable"),function:s},{text:e("addColumn"),function:l},{text:e("addRow"),function:a},{text:e("deleteColumn"),function:c},{text:e("deleteRow"),function:d},{text:e("deleteTable"),function:u},{text:e("mergeCells"),function:f},{text:e("splitCells"),function:p}]);return(m,g)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:o,placement:"bottom",onIsvisible:g[0]||(g[0]=y=>r.value=y)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Table",class:i.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]=[i.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"},[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.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"}),i.createElementVNode("path",{d:"M3 10h18"}),i.createElementVNode("path",{d:"M10 3v18"})],-1)])],2)]),default:i.withCtx(()=>[i.createElementVNode("div",IE,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,(y,b)=>(i.openBlock(),i.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"},i.toDisplayString(y.text),9,DE))),128))])]),_:1},512))}},FE={},PE={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 $E(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",PE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6l16 0"},null,-1),i.createElementVNode("path",{d:"M8 12l8 0"},null,-1),i.createElementVNode("path",{d:"M6 18l12 0"},null,-1)])])}const zE=Le(FE,[["render",$E]]),HE={},jE={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 UE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",jE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6l16 0"},null,-1),i.createElementVNode("path",{d:"M10 12l10 0"},null,-1),i.createElementVNode("path",{d:"M6 18l14 0"},null,-1)])])}const WE=Le(HE,[["render",UE]]),KE={},qE={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 GE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",qE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6l16 0"},null,-1),i.createElementVNode("path",{d:"M4 12l10 0"},null,-1),i.createElementVNode("path",{d:"M4 18l14 0"},null,-1)])])}const JE=Le(KE,[["render",GE]]),YE={},XE={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 ZE(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",XE,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 6h16"},null,-1),i.createElementVNode("path",{d:"M4 12h16"},null,-1),i.createElementVNode("path",{d:"M4 18h16"},null,-1)])])}const Hp={left:JE,center:zE,right:WE,justify:Le(YE,[["render",ZE]])},QE={class:"flex gap-[4px] p-1"},e2=["title","onClick"],t2={__name:"vs-editor-align",props:{editor:Object},setup(n){const e=n,t=i.ref(!1),r=i.ref("popover"),o=i.ref("left"),s=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"left"})||e.editor.isActive("heading",{textAlign:"left"}):!1),l=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"right"})||e.editor.isActive("heading",{textAlign:"right"}):!1),a=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"center"})||e.editor.isActive("heading",{textAlign:"center"}):!1),c=i.computed(()=>e.editor?e.editor.isActive("paragraph",{textAlign:"justify"})||e.editor.isActive("heading",{textAlign:"justify"}):!1),d=i.computed(()=>s.value||l.value||a.value||c.value),u=()=>{l.value?o.value="right":a.value?o.value="center":c.value?o.value="justify":o.value="left"};i.watch([s,l,a,c],()=>{u()},{immediate:!0}),i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",u),e.editor.on("update",u))}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",u),e.editor.off("update",u))});const f=h=>{e.editor&&(e.editor.chain().focus().setTextAlign(h).run(),o.value=h)},p=i.ref([{id:"left",isActive:s},{id:"center",isActive:a},{id:"right",isActive:l},{id:"justify",isActive:c}]);return(h,m)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:r,placement:"bottom",onIsvisible:m[0]||(m[0]=g=>t.value=g)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Text Align",class:i.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"]])},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(Hp)[o.value]),{height:"16",width:"16"}))],2)]),default:i.withCtx(()=>[i.createElementVNode("div",QE,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(p.value,g=>(i.openBlock(),i.createElementBlock("button",{title:"Text align "+g?.id,class:i.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=>f(g?.id)},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(Hp)[g?.id]),{height:"16",width:"16"}))],10,e2))),128))])]),_:1},512))}},n2={class:"flex flex-col gap-[2px] p-[2px]"},r2=["onClick"],o2={__name:"vs-editor-type-tag",props:{editor:Object},setup(n){const{t:e}=Ba(),t=n,r=i.ref(!1),o=i.ref("popover"),s=()=>{t.editor&&(t.editor?.chain().focus().setParagraph().run(),o.value.togglePopover())},l=c=>{t.editor&&(t.editor?.chain().focus().toggleHeading({level:c}).run(),o.value.togglePopover())},a=i.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)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:o,placement:"bottom",onIsvisible:d[0]||(d[0]=u=>r.value=u)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Type Tag",class:i.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]=[i.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"},[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.createElementVNode("path",{d:"M3 7v-2h13v2"}),i.createElementVNode("path",{d:"M10 5v14"}),i.createElementVNode("path",{d:"M12 19h-4"}),i.createElementVNode("path",{d:"M15 13v-1h6v1"}),i.createElementVNode("path",{d:"M18 12v7"}),i.createElementVNode("path",{d:"M17 19h2"})],-1)])],2)]),default:i.withCtx(()=>[i.createElementVNode("div",n2,[i.createElementVNode("button",{onClick:s,class:i.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":""]])},i.toDisplayString(i.unref(e)("richtext.paragraph")),3),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,(u,f)=>(i.openBlock(),i.createElementBlock("button",{key:f,onClick:p=>l(u?.id),class:i.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":""]])},i.toDisplayString(i.unref(e)(`richtext.heading${u?.id}`)),11,r2))),128))])]),_:1},512))}},s2={},l2={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 i2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",l2,[...e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)])])}const No=Le(s2,[["render",i2]]),a2={components:{VsText:zp},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)}}}},c2={class:"flex items-center w-full max-w-[182px]"},d2=["disabled"];function u2(n,e,t,r,o,s){const l=i.resolveComponent("vs-text");return i.openBlock(),i.createElementBlock("div",c2,[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":e[0]||(e[0]=a=>s.value=a),type:"color",class:i.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,d2),[[i.vModelText,s.value]]),t.isTextInputShown?(i.openBlock(),i.createBlock(l,{key:0,modelValue:s.value,"onUpdate:modelValue":e[1]||(e[1]=a=>s.value=a),class:"ml-2 w-full",disabled:t.disabled,clearable:t.clearable},null,8,["modelValue","disabled","clearable"])):i.createCommentVNode("",!0)])}const jp=Le(a2,[["render",u2]]),f2={class:"flex gap-[4px] mb-[8px]"},p2={class:"grid grid-rows-3 grid-cols-7"},h2={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},m2=["onClick","title"],g2={__name:"vs-editor-color",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref("#000000"),o=i.computed(()=>e.editor&&e.editor.getAttributes("textStyle").color||"#000000"),s=i.computed(()=>o.value!=="#000000"),l=()=>{e.editor&&(r.value=o.value)};i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",l),e.editor.on("update",l),l())}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",l),e.editor.off("update",l))});const a=i.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),c=f=>{e.editor&&(e.editor.chain().focus().setColor(f).run(),r.value=f,t.value&&t.value.togglePopover())},d=()=>{c(r.value)},u=f=>({"#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"})[f]||f;return(f,p)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Text Color",class:i.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":s.value}])},[p[1]||(p[1]=i.createElementVNode("span",{class:"leading-none"},"A",-1)),i.createElementVNode("span",{class:"block h-1 w-5",style:i.normalizeStyle({backgroundColor:r.value})},null,4)],2)]),default:i.withCtx(()=>[i.createElementVNode("div",null,[i.createElementVNode("div",f2,[i.createVNode(jp,{modelValue:r.value,"onUpdate:modelValue":p[0]||(p[0]=h=>r.value=h)},null,8,["modelValue"]),i.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"},[i.createVNode(No,{class:"h-[24px] w-[24px] text-white"})])]),i.createElementVNode("div",p2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,h=>(i.openBlock(),i.createElementBlock("div",{key:h,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[i.createElementVNode("div",h2,[i.createElementVNode("button",{class:"flex items-center justify-center w-full h-full",style:i.normalizeStyle({backgroundColor:h}),onClick:m=>c(h),title:u(h)},[r.value===h?(i.openBlock(),i.createBlock(No,{key:0,class:"h-5 w-5 text-gray-500"})):i.createCommentVNode("",!0)],12,m2)])]))),128))])])]),_:1},512))}},y2={class:"flex gap-[4px] mb-[8px]"},b2={class:"grid grid-rows-3 grid-cols-7"},k2={class:"w-full h-full rounded border border-gray-300 overflow-hidden"},x2=["onClick","title"],w2=["onClick","title"],E2={__name:"vs-editor-background-color",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref("transparent"),o=i.computed(()=>e.editor&&e.editor.getAttributes("textStyle").backgroundColor||"transparent"),s=i.computed(()=>o.value!=="transparent"&&o.value!==""),l=()=>{e.editor&&(r.value=o.value)};i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",l),e.editor.on("update",l),l())}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",l),e.editor.off("update",l))});const a=i.ref(["#172B4D","#0747A6","#008DA6","#006644","#FF991F","#BF2600","#403294","#97A0AF","#4C9AFF","#00B8D9","#36B37E","#FFC400","#FF5630","#6554C0","#FFFFFF","#B3D4FF","#B3F5FF","#ABF5D1","#FFF0B3","#FFBDAD","#EAE6FF"]),c=f=>{e.editor&&(e.editor.chain().focus().setBackgroundColor(f).run(),r.value=f,t.value&&t.value.togglePopover())},d=()=>{c(r.value)},u=f=>({"#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"})[f]||f;return(f,p)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Background Color",class:i.normalizeClass(["flex flex-col h-[30px] px-1 rounded-full hover:bg-gray-100 justify-center items-center relative flex",{"bg-gray-100":s.value}])},[p[2]||(p[2]=i.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"},[i.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"}),i.createElementVNode("path",{d:"m5 2 5 5"}),i.createElementVNode("path",{d:"M2 13h15"}),i.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)),i.createElementVNode("span",{class:"block h-1 w-5",style:i.normalizeStyle({backgroundColor:r.value})},null,4)],2)]),default:i.withCtx(()=>[i.createElementVNode("div",null,[i.createElementVNode("div",y2,[i.createVNode(jp,{modelValue:r.value,"onUpdate:modelValue":p[0]||(p[0]=h=>r.value=h)},null,8,["modelValue"]),i.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"},[i.createVNode(No,{class:"h-[24px] w-[24px] text-white"})])]),i.createElementVNode("div",b2,[i.createElementVNode("button",{onClick:p[1]||(p[1]=h=>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"},[...p[3]||(p[3]=[i.createElementVNode("svg",{fill:"#000000",width:"16",height:"16",viewBox:"0 0 52 52","data-name":"Layer 1",xmlns:"http://www.w3.org/2000/svg"},[i.createElementVNode("g",{id:"SVGRepo_bgCarrier","stroke-width":"0"}),i.createElementVNode("g",{id:"SVGRepo_tracerCarrier","stroke-linecap":"round","stroke-linejoin":"round"}),i.createElementVNode("g",{id:"SVGRepo_iconCarrier"},[i.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"}),i.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),i.createElementVNode("p",null,"no color",-1)])]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,h=>(i.openBlock(),i.createElementBlock("div",{key:h,class:"h-8 w-8 p-0.5 rounded border border-transparent hover:border-gray-200 transition-transform cursor-pointer"},[i.createElementVNode("div",k2,[h!=="transparent"?(i.openBlock(),i.createElementBlock("button",{key:0,class:"flex items-center justify-center w-full h-full",style:i.normalizeStyle({backgroundColor:h}),onClick:m=>c(h),title:u(h)},[r.value===h?(i.openBlock(),i.createBlock(No,{key:0,class:"h-5 w-5 text-gray-500"})):i.createCommentVNode("",!0)],12,x2)):i.createCommentVNode("",!0),h==="transparent"?(i.openBlock(),i.createElementBlock("button",{key:1,class:"flex items-center justify-center w-full h-full",onClick:m=>c(h),title:u(h)},[r.value===h?(i.openBlock(),i.createBlock(No,{key:0,class:"h-5 w-5 text-gray-500"})):i.createCommentVNode("",!0)],8,w2)):i.createCommentVNode("",!0)])]))),128))])])]),_:1},512))}},C2={__name:"vs-editor-highlight",props:{editor:Object},setup(n){const e=n,t=i.computed(()=>e.editor?.isActive("highlight")),r=()=>{e.editor&&e.editor.chain().focus().toggleHighlight().run()};return(o,s)=>(i.openBlock(),i.createElementBlock("button",{title:"Highlight",onClick:r,class:i.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}])},[...s[0]||(s[0]=[i.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"},[i.createElementVNode("path",{d:"m9 11-6 6v3h9l3-3"}),i.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))}},v2={class:"truncate"},_2={class:"w-[200px]"},S2={class:"max-h-[200px] overflow-y-auto"},N2=["onClick"],M2={__name:"vs-editor-font-family",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref(!1),o=i.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"}]),s=i.computed(()=>{if(!e.editor)return"Arial, sans-serif";for(const d of o.value)if(e.editor.isActive("textStyle",{fontFamily:d.value}))return d.value;return"Arial, sans-serif"}),l=i.computed(()=>o.value.find(u=>u.value===s.value)?.label||"Arial"),a=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)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom",onIsvisible:u[0]||(u[0]=f=>r.value=f)},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Font Family",class:i.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:i.normalizeStyle({fontFamily:s.value})},[i.createElementVNode("span",v2,i.toDisplayString(l.value),1),u[1]||(u[1]=i.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"},[i.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1))],6)]),default:i.withCtx(()=>[i.createElementVNode("div",_2,[i.createElementVNode("ul",S2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,f=>(i.openBlock(),i.createElementBlock("li",{key:f.value,class:i.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",{"bg-gray-100":a(f.value)}]),style:i.normalizeStyle({fontFamily:f.value}),onClick:p=>c(f.value)},i.toDisplayString(f.label),15,N2))),128))])])]),_:1},512))}},T2={class:"w-[120px]"},A2={class:"max-h-[200px] overflow-y-auto"},B2=["onClick"],V2={__name:"vs-editor-font-size",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.ref("14px"),o=i.computed(()=>e.editor&&e.editor.getAttributes("textStyle").fontSize||"14px"),s=i.computed(()=>o.value!=="14px"),l=()=>{e.editor&&(r.value=o.value)};i.onMounted(()=>{e.editor&&(e.editor.on("selectionUpdate",l),e.editor.on("update",l),l())}),i.onUnmounted(()=>{e.editor&&(e.editor.off("selectionUpdate",l),e.editor.off("update",l))});const a=i.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)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",{title:"Font Size",class:i.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":s.value}])},[...u[0]||(u[0]=[i.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"},[i.createElementVNode("path",{d:"m15 16 2.536-7.328a1.02 1.02 1 0 1 1.928 0L22 16"}),i.createElementVNode("path",{d:"M15.697 14h5.606"}),i.createElementVNode("path",{d:"m2 16 4.039-9.69a.5.5 0 0 1 .923 0L11 16"}),i.createElementVNode("path",{d:"M3.304 13h6.392"})],-1),i.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"},[i.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1)])],2)]),default:i.withCtx(()=>[i.createElementVNode("div",T2,[i.createElementVNode("ul",A2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.value,f=>(i.openBlock(),i.createElementBlock("li",{key:f.value,class:"px-3 py-2 hover:bg-gray-100 cursor-pointer",onClick:p=>c(f.value)},i.toDisplayString(f.label),9,B2))),128))])])]),_:1},512))}},L2={props:{editor:Object},methods:{toggleSuperscript(){this.editor&&this.editor.commands.toggleSuperscript()}}};function O2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Superscript",onClick:e[0]||(e[0]=(...l)=>s.toggleSuperscript&&s.toggleSuperscript(...l)),class:i.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]=[i.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 I2=Le(L2,[["render",O2]]),D2={props:{editor:Object},methods:{toggleSubscript(){this.editor&&this.editor.commands.toggleSubscript()}}};function R2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Subscript",onClick:e[0]||(e[0]=(...l)=>s.toggleSubscript&&s.toggleSubscript(...l)),class:i.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]=[i.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 F2=Le(D2,[["render",R2]]),P2={title:"Heading",class:"h-[30px] px-2 rounded-full hover:bg-gray-100 justify-center items-center flex text-sm text-gray-700"},$2={class:"truncate"},z2={class:"max-h-[200px] overflow-y-auto"},H2=["onClick"],j2=Le({__name:"vs-editor-heading",props:{editor:Object},setup(n){const e=n,t=i.ref("popover"),r=i.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}]),o=i.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"}),s=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]||"",l=c=>{e.editor&&(e.editor.chain().focus().setHeading({level:c}).run(),t.value&&t.value.togglePopover())},a=()=>{e.editor&&(e.editor.chain().focus().setParagraph().run(),t.value&&t.value.togglePopover())};return(c,d)=>(i.openBlock(),i.createBlock(Kn,{ref_key:"popover",ref:t,placement:"bottom"},{reference:i.withCtx(()=>[i.createElementVNode("button",P2,[i.createElementVNode("span",$2,i.toDisplayString(o.value),1),d[0]||(d[0]=i.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"},[i.createElementVNode("polyline",{points:"6,9 12,15 18,9"})],-1))])]),default:i.withCtx(()=>[i.createElementVNode("div",null,[i.createElementVNode("ul",z2,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,u=>(i.openBlock(),i.createElementBlock("li",{key:u.value,class:i.normalizeClass(["px-3 py-2 hover:bg-gray-100 cursor-pointer text-sm",`heading-level-${u.value}`]),style:i.normalizeStyle(s(u.value)),onClick:f=>l(u.value)},i.toDisplayString(u.label),15,H2))),128)),i.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:a}," Paragraph ")])])]),_:1},512))}},[["__scopeId","data-v-ef7c378e"]]),U2={props:{editor:Object},methods:{clearFormatting(){this.editor&&this.editor.commands.unsetAllMarks()}}};function W2(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("button",{title:"Clear Formatting",onClick:e[0]||(e[0]=(...l)=>s.clearFormatting&&s.clearFormatting(...l)),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]=[i.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 K2=Le(U2,[["render",W2]]),Mo=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t};i.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 q2={key:0,class:"vsTailwind ui-dialog__wrapper text-gray-800"},G2={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},J2={class:"font-medium text-gray-800 dark:text-[#ffffff]"},Y2={class:"ui-dialog__content p-4"},X2={key:0,class:"flex justify-end gap-x-2"},Z2={key:1,class:"flex justify-end items-center gap-x-2 py-3 px-4 border-t border-gray-200 dark:border-neutral-700"},Q2=i.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,o=i.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"),s=i.useAttrs();function l(){r("done")}function a(){r("update:visible",!1),r("close")}function c(u){u.key==="Escape"&&a()}function d(u,f){f&&u.target.classList.contains("vs-dialog-overlay")&&a()}return i.onMounted(()=>{window.addEventListener("keydown",c)}),i.onUnmounted(()=>{window.removeEventListener("keydown",c)}),(u,f)=>(i.openBlock(),i.createBlock(i.Teleport,{to:u.teleport},[u.visible?(i.openBlock(),i.createElementBlock("div",q2,[i.createElementVNode("div",{onMousedown:f[0]||(f[0]=p=>d(p,u.closeClickBack)),class:i.normalizeClass(["vs-dialog-overlay vs-dialog w-full h-full fixed top-0 start-0 bg-black bg-opacity-50",[i.unref(s).class]])},[i.createVNode(i.Transition,{name:"content",appear:""},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.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",o.value])},[i.createElementVNode("div",G2,[i.createElementVNode("h3",J2,i.toDisplayString(u.title),1),i.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:a},[...f[1]||(f[1]=[i.createElementVNode("span",{class:"sr-only"},"Close",-1),i.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"},[i.createElementVNode("path",{d:"M18 6 6 18"}),i.createElementVNode("path",{d:"m6 6 12 12"})],-1)])])]),i.createElementVNode("div",Y2,[i.renderSlot(u.$slots,"default",{},void 0,!0)]),u.$slots.footer?(i.openBlock(),i.createElementBlock("div",X2,[i.renderSlot(u.$slots,"footer",{handleClose:a},void 0,!0)])):i.createCommentVNode("",!0),u.buttonText?(i.openBlock(),i.createElementBlock("div",Z2,[i.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:a}," Close "),i.createElementVNode("button",{type:"button",onClick:l,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"},i.toDisplayString(u.buttonText),1)])):i.createCommentVNode("",!0)],2)]),_:3})],34)])):i.createCommentVNode("",!0)],8,["to"]))}}),Va=Mo(Q2,[["__scopeId","data-v-a6807cab"]]),eC={},tC={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 nC(n,e){return i.openBlock(),i.createElementBlock("svg",tC,[...e[0]||(e[0]=[i.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 rC=Mo(eC,[["render",nC]]),oC={},sC={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 lC(n,e){return i.openBlock(),i.createElementBlock("svg",sC,[...e[0]||(e[0]=[i.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 iC=Mo(oC,[["render",lC]]),aC={},cC={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 dC(n,e){return i.openBlock(),i.createElementBlock("svg",cC,[...e[0]||(e[0]=[i.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 uC=Mo(aC,[["render",dC]]),fC={},pC={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 hC(n,e){return i.openBlock(),i.createElementBlock("svg",pC,[...e[0]||(e[0]=[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"},null,-1)])])}const mC=Mo(fC,[["render",hC]]),gC={class:"rounded-md border border-gray-300 bg-white p-4 shadow-sm"},yC={class:"flex items-start gap-4 opacity-100 scale-5 transition-all duration-300"},bC={class:"flex-1"},kC={class:"font-medium text-gray-900"},xC={class:"mt-0.5 text-sm text-gray-700"},wC=i.defineComponent({__name:"vs-notify",props:{type:{},title:{},message:{}},setup(n){const e={success:rC,warning:iC,error:mC,info:uC};return(t,r)=>(i.openBlock(),i.createElementBlock("div",gC,[i.createElementVNode("div",yC,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(e[t.type]))),i.createElementVNode("div",bC,[i.createElementVNode("strong",kC,i.toDisplayString(t.title),1),i.createElementVNode("p",xC,i.toDisplayString(t.message),1)]),r[0]||(r[0]=i.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"},[i.createElementVNode("span",{class:"sr-only"},"Dismiss popup"),i.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"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M6 18L18 6M6 6l12 12"})])],-1))])]))}});i.reactive({visible:!0});const EC=n=>{const{template:e="",title:t="",content:r,contentProps:o={},size:s="medium"}=n||{},l=document.querySelector("body");if(!l)return console.error('Modal root element with id "#modal" not found!'),{close:()=>{}};const a=document.createElement("div");l.appendChild(a);const c={title:t,template:e,visible:!0,size:s,closeClickBack:!0,onClose:u},d=i.createApp({render(){return i.h(Va,c,{default:()=>[r?i.h(r,o):i.h("p",e)]})}});function u(){d.unmount(),a.remove()}return d.mount(a),{close:u}},yl={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"},Ie=n=>{const{type:e="info",title:t,message:r,position:o="right-bottom"}=n||{};let s=document.querySelector("#notify-root");s||(s=document.createElement("div"),s.id="notify-root",s.className=`fixed z-[2000] flex flex-col gap-3 ${yl[o]} p-6 max-w-md mx-auto font-sans antialiased`,document.body.appendChild(s)),s.className.includes(yl[o])||(Object.values(yl).forEach(c=>{s.classList.remove(...c.split(" "))}),s.classList.add(...yl[o].split(" ")));const l=document.createElement("div");s.appendChild(l);const a=i.createApp({render(){return i.h(wC,{type:e,title:t,message:r,onClose:()=>{a.unmount(),l.remove()}})}});a.mount(l),l.querySelector("button")?.addEventListener("click",()=>{l.classList.add("opacity-0","scale-95","transition-all","duration-300"),setTimeout(()=>{a.unmount(),l.remove()},350)}),setTimeout(()=>{l.classList.add("opacity-0","scale-95","transition-all","duration-300"),setTimeout(()=>{a.unmount(),l.remove()},350)},3500)},CC={class:"w-full relative"},vC={key:0,class:"text-[14px] font-medium text-gray-900 mb-2"},_C={class:"opacity-100"},SC={key:0,class:"text-red-500 text-[14px]"},NC={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},MC=i.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=i.ref("uk"),t=r=>{r.detail.key==="locale"&&(e.value=r.detail.newValue)};return i.onMounted(()=>{e.value=localStorage.locale,window.addEventListener("storage",t)}),i.onUnmounted(()=>{window.removeEventListener("resize",t)}),(r,o)=>(i.openBlock(),i.createElementBlock("div",CC,[r.ua||r.label?(i.openBlock(),i.createElementBlock("div",vC,[i.createElementVNode("span",_C,i.toDisplayString(r.item[e.value]||r.ua||r.label),1),r.item?.rules?.includes("required")?(i.openBlock(),i.createElementBlock("span",SC,"*")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.renderSlot(r.$slots,"default",i.mergeProps(r.$attrs,{class:{"opacity-60":r.item.disabled}})),r.error?(i.openBlock(),i.createElementBlock("span",NC,i.toDisplayString(r.error),1)):i.createCommentVNode("",!0)]))}}),TC={class:"w-full relative flex flex-row items-center gap-2"},AC={key:0,class:"text-red-500 text-[14px]"},BC={key:1,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},VC=i.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=i.computed(()=>e.columns??{container:12,label:3}),r=i.computed(()=>{const{container:a,label:c}=t.value;return!a||a<=0?0:Math.min(Math.max(c??0,0),a)/a}),o=i.computed(()=>e.item?.type==="html"||r.value<=0?!1:!!(e.ua||e.label)),s=i.computed(()=>{if(!o.value)return{};const a=`${r.value*100}%`;return{flexBasis:a,maxWidth:a}}),l=i.computed(()=>{const{container:a,label:c}=t.value;if(!a||a<=0)return{};if(e.item?.type==="html")return{flexBasis:"100%",maxWidth:"100%"};if(!o.value)return{flexBasis:"100%",maxWidth:"100%"};const d=Math.max(a-Math.max(c??0,0),0)/a;if(!d)return{};const u=`${d*100}%`;return{flexBasis:u,maxWidth:u}});return(a,c)=>(i.openBlock(),i.createElementBlock("div",TC,[o.value?(i.openBlock(),i.createElementBlock("span",{key:0,class:"text-sm text-gray-900 font-medium flex shrink-0",style:i.normalizeStyle(s.value)},[i.createTextVNode(i.toDisplayString(a.ua||a.label)+" ",1),a.item?.rules?.includes("required")&&(a.ua||a.label)?(i.openBlock(),i.createElementBlock("span",AC,"*")):i.createCommentVNode("",!0)],4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"flex-1 min-w-0",style:i.normalizeStyle(l.value)},[i.renderSlot(a.$slots,"default",i.normalizeProps(i.guardReactiveProps(a.$attrs)))],4),a.error?(i.openBlock(),i.createElementBlock("span",BC,i.toDisplayString(a.error),1)):i.createCommentVNode("",!0)]))}}),LC={class:"w-full relative"},OC={key:0,class:"text-red-500 text-[10px] absolute bottom-[-14px]"},IC=i.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)=>(i.openBlock(),i.createElementBlock("div",LC,[i.renderSlot(e.$slots,"default",i.normalizeProps(i.guardReactiveProps(e.$attrs))),e.error?(i.openBlock(),i.createElementBlock("span",OC,i.toDisplayString(e.error),1)):i.createCommentVNode("",!0)]))}}),DC={class:"flex-1 min-w-0"},RC={key:0,class:"text-sm font-medium text-slate-700 dark:text-slate-200 flex items-center gap-1"},FC={class:"truncate"},PC={key:0,class:"text-red-500 text-[14px]"},$C={key:1,class:"text-xs text-slate-500 dark:text-slate-400"},zC={key:0,class:"mt-1 text-xs text-red-500"},HC=i.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=i.ref("uk");i.computed(()=>(e.item??{})?.[t.value]??e.ua??e.label??"");const r=i.computed(()=>e.item?.description??""),o=i.computed(()=>Array.isArray(e.item?.rules)&&e.item.rules.includes("required")),s=i.computed(()=>(typeof e.error=="string"?e.error:"")??""),l=a=>{a.key==="locale"&&(t.value=a.newValue??"uk")};return i.onMounted(()=>{try{typeof localStorage<"u"&&localStorage.locale&&(t.value=localStorage.locale)}catch{}window.addEventListener("storage",l)}),i.onUnmounted(()=>{window.removeEventListener("storage",l)}),(a,c)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["w-full relative",{"opacity-60":a.item?.disabled}])},[i.createElementVNode("div",{class:i.normalizeClass(["gap-2 md:flex-row md:items-center md:justify-between",[["switcher","native-select"].includes(a.item.type)?"flex flex-col":""]])},[i.createElementVNode("div",DC,[a.ua||a.label?(i.openBlock(),i.createElementBlock("p",RC,[i.createElementVNode("span",FC,i.toDisplayString(a.item[t.value]||a.ua||a.label),1),o.value?(i.openBlock(),i.createElementBlock("span",PC,"*")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),r.value?(i.openBlock(),i.createElementBlock("p",$C,i.toDisplayString(r.value),1)):i.createCommentVNode("",!0)]),i.createElementVNode("div",{class:i.normalizeClass(["w-full",["select","native-select"].includes(a.item.type)?"md:w-[30%]":"md:w-auto"])},[i.renderSlot(a.$slots,"default",i.normalizeProps(i.guardReactiveProps(a.$attrs)))],2)],2),s.value?(i.openBlock(),i.createElementBlock("p",zC,i.toDisplayString(s.value),1)):i.createCommentVNode("",!0)],2))}}),jC={default:MC,horizontal:VC,inline:IC,settings:HC};function vt(n){return{inputClass:i.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 UC=["placeholder","disabled"],WC=i.defineComponent({__name:"vs-input-password",props:i.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}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");return(l,a)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:"password","onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),placeholder:s.value,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,UC)),[[i.vModelText,r.value]])}}),KC=["placeholder","disabled"],bl=i.defineComponent({__name:"vs-input-text",props:i.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}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");return(l,a)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:"text","onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),placeholder:s.value,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":l.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,KC)),[[i.vModelText,r.value]])}}),qC=["placeholder","disabled","min","max"],GC=i.defineComponent({__name:"vs-input-number",props:i.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}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled);return(s,l)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:"number",step:"any","onUpdate:modelValue":l[0]||(l[0]=a=>r.value=a),placeholder:s.placeholder,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full bg-white",[i.unref(t)]]),style:{border:"1px solid #CFD9E0"},min:s.min,max:s.max},null,10,qC)),[[i.vModelText,r.value]])}}),ge=(n,e)=>{const t=n.__vccOpts||n;for(const[r,o]of e)t[r]=o;return t},JC={},YC={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 XC(n,e){return i.openBlock(),i.createElementBlock("svg",YC,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M5 12l5 5l10 -10"},null,-1)]))}const ZC=ge(JC,[["render",XC]]),QC={class:"flex items-center gap-[4px]"},ev=["value","id","disabled"],tv=["for"],nv={class:"text-[14px] text-gray-700 flex items-center dark:text-neutral-400"},rv=i.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,o=i.computed({get:()=>r.modelValue,set:l=>t("update:modelValue",l)}),s=i.computed(()=>!!r.disabled);return(l,a)=>(i.openBlock(),i.createElementBlock("div",QC,[i.withDirectives(i.createElementVNode("input",{type:"checkbox",value:l.value,"onUpdate:modelValue":a[0]||(a[0]=c=>o.value=c),class:i.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":s.value}]),id:l.id,disabled:s.value},null,10,ev),[[i.vModelCheckbox,o.value]]),i.createElementVNode("label",{for:l.id,class:i.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":s.value}])},[i.createElementVNode("div",{class:i.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",l.error?"border-red-600":""]])},[i.createVNode(ZC,{height:"12",width:"12"})],2),i.createElementVNode("span",nv,[i.renderSlot(l.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(l.label),1)])])],10,tv)]))}}),ov=["name","value","disabled"],sv={class:"flex items-center gap-[6px] text-[14px]"},lv={key:0,class:"text-[16px]"},iv=["src"],av=i.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,o=i.computed({get:()=>t.modelValue,set:a=>{r("update:modelValue",a)}}),s=i.computed(()=>Array.isArray(o.value)?o.value.includes(t.value):o.value===!0||o.value===t.value),l=i.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(a,c)=>(i.openBlock(),i.createElementBlock("label",{class:i.normalizeClass(["group relative flex justify-center items-center gap-x-3 text-center bg-white text-gray-800 ring-ring ring-2 cursor-pointer rounded-lg",[l.value,s.value?"ring-blue-500":"border border-gray-200 ring-transparent"]])},[i.withDirectives(i.createElementVNode("input",{type:"checkbox",class:"hidden",name:a.id,value:a.value,"onUpdate:modelValue":c[0]||(c[0]=d=>o.value=d),disabled:a.disabled},null,8,ov),[[i.vModelCheckbox,o.value]]),i.createElementVNode("span",sv,[a.icon||a.imgUrl?(i.openBlock(),i.createElementBlock("span",lv,[a.icon?(i.openBlock(),i.createElementBlock("i",{key:0,class:i.normalizeClass(a.icon)},null,2)):i.createCommentVNode("",!0),a.imgUrl?(i.openBlock(),i.createElementBlock("img",{key:1,src:a.imgUrl,width:"16",height:"16",alt:"icon"},null,8,iv)):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.renderSlot(a.$slots,"default",{},()=>[i.createTextVNode(i.toDisplayString(a.label),1)])])],2))}}),cv={class:"flex items-center"},La=i.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,o=`radio-${Math.floor(Math.random()*1e4)}`,s=i.computed({get:()=>Array.isArray(t.modelValue)?Array.isArray(t.modelValue)&&t.modelValue.includes(t.value):t.modelValue,set:a=>{if(Array.isArray(t.modelValue)){let c=[...t.modelValue];a?c.includes(t.value)||c.push(t.value):c=c.filter(d=>d!==t.value),r("update:modelValue",c)}else r("update:modelValue",a)}}),l=i.ref(`vs-checkbox-${t.view||"default"}`);return(a,c)=>(i.openBlock(),i.createElementBlock("div",cv,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(l.value==="vs-checkbox-buttons"?i.unref(av):i.unref(rv)),{value:a.value,label:a.label,info:a.option?.info,disabled:a.disabled,modelValue:s.value,"onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),id:o,icon:a.icon,imgUrl:a.imgUrl,style:i.normalizeStyle(a.style),error:a.error},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(a.label),1)]),_:1},8,["value","label","info","disabled","modelValue","icon","imgUrl","style","error"]))]))}}),dv={},uv={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 fv(n,e){return i.openBlock(),i.createElementBlock("svg",uv,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M6 9l6 6l6 -6"},null,-1)]))}const pv=ge(dv,[["render",fv]]),hv={},mv={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 gv(n,e){return i.openBlock(),i.createElementBlock("svg",mv,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),i.createElementVNode("path",{d:"M6 6l12 12"},null,-1)]))}const yv=ge(hv,[["render",gv]]),bv={},kv={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 xv(n,e){return i.openBlock(),i.createElementBlock("svg",kv,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M12 9h.01"},null,-1),i.createElementVNode("path",{d:"M11 12h1v4h1"},null,-1),i.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 wv=ge(bv,[["render",xv]]),Ev={key:0,class:"flex items-start gap-x-1"},Cv={key:0,class:"text-red-500 text-[14px]"},vv=["title"],_v=["disabled"],Up=i.defineComponent({__name:"vs-input-switcher",props:i.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=i.useModel(n,"modelValue");return(r,o)=>e.view==="checkbox"?(i.openBlock(),i.createElementBlock("div",Ev,[i.createVNode(La,{modelValue:t.value,"onUpdate:modelValue":o[0]||(o[0]=s=>t.value=s),label:r.text,error:r.error||""},null,8,["modelValue","label","error"]),r.rules?.includes("required")?(i.openBlock(),i.createElementBlock("span",Cv,"*")):i.createCommentVNode("",!0),r.i?(i.openBlock(),i.createElementBlock("button",{key:1,class:"cursor-pointer",title:r.i,onClick:o[1]||(o[1]=i.withModifiers(()=>{},["prevent"]))},[i.createVNode(i.unref(wv),{class:"text-gray-500 w-[14px] h-[14px]"})],8,vv)):i.createCommentVNode("",!0)])):(i.openBlock(),i.createElementBlock("button",{key:1,type:"button",class:i.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:o[2]||(o[2]=s=>t.value=!t.value)},[i.createElementVNode("span",{"data-state":"checked",class:i.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,_v))}}),Sv=["id","innerHTML"],Wp=i.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)=>(i.openBlock(),i.createElementBlock("div",{id:e.name,class:i.normalizeClass(["text-gray-900",e.customClass]),innerHTML:e.html?e.html:e.text},null,10,Sv))}}),Nv=["placeholder","disabled","name"],Mv=i.defineComponent({__name:"vs-input-mask",props:i.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}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.ref(null);let s=null;return i.onMounted(async()=>{if(o.value){const{default:l}=await Promise.resolve().then(()=>lO);s=l(o.value,{mask:e.mask||"",definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/},lazy:!1}),s.on("accept",()=>{r.value=e.unmask?s.unmaskedValue:s.value}),s.on("complete",()=>{r.value=e.unmask?s.unmaskedValue:s.value}),s.value=r.value??""}}),i.onBeforeUnmount(()=>{s?.destroy()}),i.watch(()=>e.mask,l=>{s&&s.updateOptions({mask:l,definitions:{9:/[0-9]/,A:/[a-zA-Z]/,"*":/[a-zA-Z0-9]/}})}),i.watch(r,l=>{s&&s.unmaskedValue!==l&&(s.value=l||"")}),(l,a)=>(i.openBlock(),i.createElementBlock("input",{type:"text",ref_key:"inputEl",ref:o,placeholder:l.placeholder,disabled:l.disabled,name:l.name,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,Nv))}}),Tv={class:"relative w-full bg-white rounded-lg"},Av=["placeholder","disabled"],Bv=i.defineComponent({__name:"vs-input-email",props:i.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}=vt(e.style),r=i.useModel(n,"modelValue");return(o,s)=>(i.openBlock(),i.createElementBlock("div",Tv,[s[1]||(s[1]=i.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)),i.withDirectives(i.createElementVNode("input",{type:"email","onUpdate:modelValue":s[0]||(s[0]=l=>r.value=l),placeholder:o.placeholder,disabled:o.disabled,class:i.normalizeClass(["!pl-8 py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":o.error}]]),style:{border:"1px solid #CFD9E0"}},null,10,Av),[[i.vModelText,r.value]])]))}}),Vv=["value","disabled"],Lv={class:"text-[13px] text-gray-700"},Ov=i.defineComponent({__name:"vs-input-radio-default",props:i.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=i.useModel(n,"modelValue"),r=i.computed(()=>!!e.disabled);return(o,s)=>(i.openBlock(),i.createElementBlock("label",{class:i.normalizeClass(["flex items-center gap-0",[e.customClass,r.value?"cursor-not-allowed opacity-60":""]])},[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l),type:"radio",value:e.value,disabled:r.value,class:"hidden"},null,8,Vv),[[i.vModelRadio,t.value]]),i.createElementVNode("span",{class:i.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?(i.openBlock(),i.createElementBlock("span",{key:0,class:i.normalizeClass(["w-[12px] h-[12px] shrink-0 rounded-full",[`bg-${e.style?.primaryColor||"blue"}-500`]])},null,2)):i.createCommentVNode("",!0)],2),i.createElementVNode("span",Lv,i.toDisplayString(e.text),1)],2))}}),Iv=["value","disabled"],Dv={class:"text-[13px] text-gray-700"},Rv=i.defineComponent({__name:"vs-input-radio-buttons",props:i.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=i.useModel(n,"modelValue"),r=i.computed(()=>!!e.disabled);return(o,s)=>(i.openBlock(),i.createElementBlock("label",{class:i.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":""]])},[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>t.value=l),type:"radio",value:e.value,disabled:r.value,class:"hidden"},null,8,Iv),[[i.vModelRadio,t.value]]),i.createElementVNode("span",Dv,i.toDisplayString(e.text),1)],2))}}),Fv={"vs-input-radio-default":Ov,"vs-input-radio-buttons":Rv},Kp=i.defineComponent({__name:"vs-input-radio",props:i.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=i.useModel(n,"modelValue"),r=i.computed(()=>Fv[`vs-input-radio-${e.view}`]);return(o,s)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass([o.position==="horizontal"?"flex items-center flex-wrap gap-2":""])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.options,l=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(r.value),i.mergeProps({key:l?.id,text:l.text,value:l.id.toString(),checked:t.value===l.id,modelValue:t.value,"onUpdate:modelValue":s[0]||(s[0]=a=>t.value=a)},{ref_for:!0},o.$attrs),null,16,["text","value","checked","modelValue"]))),128))],2))}}),Pv={key:1,class:"w-full flex flex-col gap-4"},$v={key:0,class:"text-sm font-medium text-muted-foreground my-2"},zv="Без категорії",Hv=i.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,o=i.ref([]),s=i.reactive({}),l=h=>h?.value||h?.id||h?.text||h,a=h=>h.text||String(h),c=h=>`lg:col-span-${h||12}`,d=i.computed(()=>[t.position==="vertical"?"flex flex-col":"",t.colSpan?"grid":"flex justify-start"]),u=h=>h==null||h===""?null:typeof h=="string"||typeof h=="number"?h:String(h),f=i.computed(()=>{if(!t.group)return[];const h=new Map;o.value.forEach(k=>{const C=k[t.group],x=u(C);h.has(x)||h.set(x,[]),h.get(x)?.push(k)});const m=[];t.values?.length&&t.values.forEach(k=>{const C=u(k);m.push(C)});const g=new Set,y=k=>{const C=h.get(k)||[];if(!C.length)return null;const x=k===null?"group-null":`group-${String(k)}`,w=k===null?zv:String(k);return g.add(k),{key:x,label:w,options:C}},b=[];return m.forEach(k=>{const C=y(k);C&&b.push(C)}),h.forEach((k,C)=>{if(g.has(C))return;const x=y(C);x&&b.push(x)}),b}),p=async()=>{try{const h=await fetch(`/api/suggest/${t.data}`).then(m=>m.json());o.value=h?.data||h}catch(h){console.error(h)}};return i.watch(()=>t.modelValue,h=>{if(typeof h=="boolean"&&o.value.length===1){const m=l(o.value[0]);s[m]=h}else if(Array.isArray(h)){const m=new Set(h);o.value.forEach(g=>{if(!g.disabled){const y=l(g);s[y]=m.has(y)}})}},{immediate:!0}),i.watch(s,()=>{if(!o.value.length){r("update:modelValue",null);return}const h=Object.entries(s).filter(([,m])=>m).map(([m])=>m);r("update:modelValue",h.length===0?[]:h)},{deep:!0}),i.onMounted(()=>{if(t.data)p().then(()=>{if(typeof t.modelValue=="boolean"&&o.value.length===1){const h=l(o.value[0]);s[h]=t.modelValue}else if(Array.isArray(t.modelValue)){const h=new Set(t.modelValue);o.value.forEach(m=>{if(!m.disabled){const g=l(m);s[g]=h.has(g)}})}});else if(o.value=t.options,typeof t.modelValue=="boolean"&&o.value.length===1){const h=l(o.value[0]);s[h]=t.modelValue}else if(Array.isArray(t.modelValue)){const h=new Set(t.modelValue);o.value.forEach(m=>{if(!m.disabled){const g=l(m);s[g]=h.has(g)}})}}),(h,m)=>t.group?(i.openBlock(),i.createElementBlock("div",Pv,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(f.value,g=>(i.openBlock(),i.createElementBlock("div",{key:g.key,class:"flex flex-col gap-2"},[g.label?(i.openBlock(),i.createElementBlock("span",$v,i.toDisplayString(g.label),1)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["p-0 w-full gap-[12px]",d.value])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(g.options,y=>(i.openBlock(),i.createBlock(La,{modelValue:s[l(y)],"onUpdate:modelValue":b=>s[l(y)]=b,value:l(y),class:i.normalizeClass(c(h.colSpan)),disabled:t.disabled||y.disabled,label:a(y),key:`${g.key}-${l(y)}`,icon:y?.icon,imgUrl:y?.imgUrl,option:y,view:h.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2)]))),128))])):(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(["p-0 w-full gap-[10px]",d.value])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,g=>(i.openBlock(),i.createBlock(La,{modelValue:s[l(g)],"onUpdate:modelValue":y=>s[l(g)]=y,value:l(g),class:i.normalizeClass(c(h.colSpan)),disabled:t.disabled||g.disabled,label:a(g),key:l(g),icon:g?.icon,imgUrl:g?.imgUrl,option:g,view:h.view},null,8,["modelValue","onUpdate:modelValue","value","class","disabled","label","icon","imgUrl","option","view"]))),128))],2))}}),jv=ge(Hv,[["__scopeId","data-v-8e66207e"]]),Uv=["type","placeholder","disabled"],Wv=i.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:o}=vt(t.style),s=e,l=i.computed({get:()=>r(t.modelValue),set:u=>s("update:modelValue",u)}),a=i.computed(()=>t.mode==="datetime"?"datetime-local":t.mode),c=i.computed(()=>!!t.disabled),d=i.computed(()=>t.placeholder??"");return(u,f)=>i.withDirectives((i.openBlock(),i.createElementBlock("input",{type:a.value,"onUpdate:modelValue":f[0]||(f[0]=p=>l.value=p),placeholder:d.value,disabled:c.value,ref:"date",class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[u.modelValue?"":"text-opacity-50",i.unref(o)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,Uv)),[[i.vModelDynamic,l.value]])}}),qp=async(n,e,t,r)=>{try{const o=new FormData;return o.append("unique","true"),o.append("file",n),(await fetch(`/file/upload/uploads?id=${e||""}&form=${t||""}&table=${r||""}`,{method:"POST",body:o}).then(s=>s.json()))?.result}catch(o){return Ie({type:"error",title:"Помилка!",message:"Сталась помилка під час завантаження файлу",position:"right-bottom"}),console.error("Сталась помилка завантаження файлу",o),null}},Kv=async n=>{try{return await fetch(`file/delete${n}`),!0}catch(e){return console.error(e),!1}},Gp=async n=>{try{const e=await fetch(`file/download/files/uploads${n}`),t=await e.arrayBuffer(),r=e.headers["content-type"],o=new TextDecoder("utf-8").decode(t),s=new Blob([o],{type:r}),l=document.createElement("a");l.setAttribute("download",n),l.href=window.URL.createObjectURL(s),l.click()}catch(e){console.error(e.message)}},qv={},Gv={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 Jv(n,e){return i.openBlock(),i.createElementBlock("svg",Gv,e[0]||(e[0]=[i.createElementVNode("path",{d:"M5 12h14"},null,-1),i.createElementVNode("path",{d:"M12 5v14"},null,-1)]))}const To=ge(qv,[["render",Jv]]),Yv={},Xv={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 Zv(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",Xv,e[0]||(e[0]=[i.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 Qv=ge(Yv,[["render",Zv]]),e_={},t_={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 n_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",t_,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("rect",{x:"4",y:"4",width:"16",height:"16",rx:"2"},null,-1),i.createElementVNode("line",{x1:"4",y1:"10",x2:"20",y2:"10"},null,-1),i.createElementVNode("line",{x1:"10",y1:"4",x2:"10",y2:"20"},null,-1)]))}const r_=ge(e_,[["render",n_]]),o_={},s_={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"};function l_(n,e){return i.openBlock(),i.createElementBlock("svg",s_,e[0]||(e[0]=[i.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 Jp=ge(o_,[["render",l_]]),i_={},a_={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 c_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",a_,e[0]||(e[0]=[i.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 d_=ge(i_,[["render",c_]]),u_={},f_={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 p_(n,e,t,r,o,s){return i.openBlock(),i.createElementBlock("svg",f_,e[0]||(e[0]=[i.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 h_=ge(u_,[["render",p_]]),m_=n=>{if(!n)return"";const e=n?.split(".");return e[e.length-1]},g_=n=>{const e=m_(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)?r_:t.textsFormat.includes(e)?h_:t.documentsFormat.includes(e)?Qv:t.archivesFormat.includes(e)?d_:Jp},y_={},b_={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"icon icon-tabler icons-tabler-outline icon-tabler-trash"};function k_(n,e){return i.openBlock(),i.createElementBlock("svg",b_,e[0]||(e[0]=[i.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 kl=ge(y_,[["render",k_]]),x_={},w_={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 E_(n,e){return i.openBlock(),i.createElementBlock("svg",w_,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Yp=ge(x_,[["render",E_]]),C_=["title"],v_={class:"absolute hidden top-0 right-0 flex items-center gap-x-2 w-full h-full justify-center"},__=i.defineComponent({__name:"vs-input-file-list-item",props:i.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=i.useModel(n,"value"),t=i.useModel(n,"item"),r=n;return(o,s)=>(i.openBlock(),i.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"},[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(i.unref(g_)(t.value)),{src:t.value,alt:"file",class:"w-full h-full object-cover cursor-pointer",onClick:s[0]||(s[0]=l=>i.unref(Gp)(t.value))},null,8,["src"])),i.createElementVNode("div",v_,[i.createElementVNode("button",{type:"button",onClick:s[1]||(s[1]=l=>{i.unref(Kv)(t.value),e.value=r.multiple?e.value?.filter(a=>a!==t.value):""}),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-red-500"},[i.createVNode(kl,{class:"w-4 h-4"})]),i.createElementVNode("button",{type:"button",onClick:s[2]||(s[2]=l=>i.unref(Gp)(t.value)),class:"w-6 h-6 flex items-center justify-center text-gray-500 bg-gray-200 rounded-lg hover:text-blue-500"},[i.createVNode(Yp,{class:"w-4 h-4"})])])],8,C_))}}),Xp=ge(__,[["__scopeId","data-v-286cdbc0"]]),S_={class:"flex items-center gap-x-2"},N_=["multiple","disabled"],M_={key:1,class:"flex items-center flex-wrap gap-2"},T_={key:1,class:"loader"},A_={key:1,class:"loader"},B_=i.defineComponent({__name:"vs-input-file",props:i.mergeModels({format:{},multiple:{type:Boolean},max_size:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{},modelModifiers:{}}),emits:i.mergeModels(["change"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=i.useModel(n,"modelValue"),o=e,s=i.ref(null),l=i.ref(!1),a=u=>Array.isArray(r.value)&&r.value[u]||"",c=u=>{if(t.max_size&&u.size>t.max_size*1024*1024){const f=(u.size/1048576).toFixed(2);return Ie({type:"error",title:"Помилка!",message:`Файл "${u.name}" занадто великий. Максимальний розмір: ${t.max_size} МБ, розмір файлу: ${f} МБ`,position:"right-bottom"}),!1}return!0},d=async u=>{const{files:f}=u.target;if(!f||f.length===0)return;const p=Array.from(f);if(t.max_size&&p.filter(h=>!c(h)).length>0){s.value&&(s.value.value="");return}l.value=!0;try{if(t.multiple){const h=Array.from(f).map(async g=>t.format&&!g.name.endsWith(t.format)?null:await qp(g,"1","form","table")),m=(await Promise.all(h)).filter(g=>g!==null).map(g=>g?.file_path).filter(Boolean);r.value=[...r.value||[],...m],o("change",r.value)}else{const h=f[0];if(t.format&&!h.name.endsWith(t.format))return;const m=await qp(h,"1","form","table");r.value=m?.file_path,o("change",r.value||"")}}finally{l.value=!1,s.value&&(s.value.value="")}};return(u,f)=>(i.openBlock(),i.createElementBlock("div",S_,[i.createElementVNode("input",{class:"hidden",ref_key:"fileInput",ref:s,type:"file",multiple:u.multiple,onChange:d,disabled:l.value||u.disabled},null,40,N_),!u.multiple&&r.value?(i.openBlock(),i.createBlock(Xp,{key:0,item:r.value,"onUpdate:item":f[0]||(f[0]=p=>r.value=p),value:r.value,"onUpdate:value":f[1]||(f[1]=p=>r.value=p)},null,8,["item","value"])):u.multiple?(i.openBlock(),i.createElementBlock("div",M_,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,(p,h)=>(i.openBlock(),i.createBlock(Xp,{multiple:u.multiple,key:h,value:r.value,"onUpdate:value":f[2]||(f[2]=m=>r.value=m),item:a(h)},null,8,["multiple","value","item"]))),128)),i.createElementVNode("div",{onClick:f[3]||(f[3]=p=>!u.disabled&&!l.value&&s.value?.click()),class:i.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||l.value?"opacity-50 cursor-not-allowed":"cursor-pointer hover:border-blue-500 hover:bg-blue-50"])},[l.value?(i.openBlock(),i.createElementBlock("div",T_)):(i.openBlock(),i.createBlock(To,{key:0,class:"w-6 h-6"}))],2)])):i.createCommentVNode("",!0),u.multiple?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",{key:2,onClick:f[4]||(f[4]=p=>s.value?.click()),class:i.normalizeClass([u.disabled||l.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"])},[l.value?(i.openBlock(),i.createElementBlock("div",A_)):(i.openBlock(),i.createBlock(To,{key:0,class:"w-6 h-6"}))],2))]))}}),V_=ge(B_,[["__scopeId","data-v-e613a523"]]),L_={class:"max-w-[55vw]"},O_={class:"text-sm font-semibold text-gray-800 truncate dark:text-neutral-200"},I_={class:"flex items-center text-xs text-gray-500 truncate dark:text-neutral-500"},D_={class:"px-[5px]"},R_={class:""},xl=i.defineComponent({__name:"vs-widget-file-info",props:{item:{default:null}},setup(n){const e=n,t=i.computed(()=>{try{return new Date(e.item.cdate).toLocaleDateString("uk-UA",{day:"2-digit",month:"long",year:"numeric"})}catch{return""}});function r(o){if(o<1024)return`${o} B`;const s=o/1024;return s<1024?`${s.toFixed(2)} KB`:`${(s/1024).toFixed(2)} MB`}return(o,s)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[s[1]||(s[1]=i.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)),i.createElementVNode("div",L_,[i.createElementVNode("p",O_,i.toDisplayString(o.item?.uploaded_name),1),i.createElementVNode("p",I_,[i.createElementVNode("span",null,i.toDisplayString(o.item?.username),1),i.withDirectives(i.createElementVNode("span",D_,"|",512),[[i.vShow,o.item?.username]]),i.createElementVNode("span",null,i.toDisplayString(t.value),1),s[0]||(s[0]=i.createElementVNode("span",{class:"px-[5px]"},"|",-1)),i.createElementVNode("span",R_,i.toDisplayString(r(o.item?.size)),1)])])],64))}}),F_={class:"p-3 relative group flex items-center gap-x-3 border border-gray-200 bg-white rounded-md w-full"},P_={key:0,class:"flex w-full gap-x-3 items-center"},$_={key:1,class:"flex gap-x-3 w-full items-center"},z_={key:2,class:"flex gap-x-3 w-full items-center"},H_=["href"],j_={key:3,class:"flex gap-x-3 w-full items-center"},U_={class:"lg:absolute lg:top-3 lg:end-1 opacity-100"},W_={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"},K_={class:"inline-block"},q_={class:"inline-block"},G_=i.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 o(u){return["pdf","json"].includes(u.ext)}function s(u){return["ppt","pptx","doc","docx","xls","xlsx"].includes(u.ext)}function l(u){const f=document.createElement("a");f.setAttribute("download",u?.uploaded_name),f.href=u?.file_path,f.click()}async function a(){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:a,updateListOnConfirm:!0})}function d(u){(t.item.ext==="jpg"||t.item.ext==="png")&&r("openLightbox",{item:t.item,index:u})}return(u,f)=>(i.openBlock(),i.createElementBlock("div",F_,[u.item.ext==="jpg"||u.item.ext==="png"?(i.openBlock(),i.createElementBlock("div",P_,[i.createElementVNode("div",{class:"max-w-[55vw] cursor-pointer flex gap-x-3 w-full items-center",onClick:f[0]||(f[0]=p=>d(u.index))},[i.createVNode(xl,{item:u.item},null,8,["item"])])])):o(u.item)?(i.openBlock(),i.createElementBlock("div",$_,[i.createVNode(xl,{item:u.item},null,8,["item"])])):s(u.item)?(i.openBlock(),i.createElementBlock("div",z_,[i.createElementVNode("a",{href:`/api/file-preview?id=${u.item.file_id}`,target:"_blank",class:"flex gap-x-3 w-full items-center"},[i.createVNode(xl,{item:u.item},null,8,["item"])],8,H_)])):(i.openBlock(),i.createElementBlock("div",j_,[i.createVNode(xl,{item:u.item},null,8,["item"])])),i.createElementVNode("div",U_,[i.createElementVNode("div",W_,[i.createElementVNode("div",K_,[i.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:f[1]||(f[1]=p=>l(u.item))},[i.createVNode(Yp,{height:"14",width:"14"})])]),f[3]||(f[3]=i.createElementVNode("div",{class:"w-px h-5 mx-1 bg-gray-200 dark:bg-neutral-700"},null,-1)),i.createElementVNode("div",q_,[i.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:f[2]||(f[2]=p=>c())},[i.createVNode(kl,{height:"14",width:"14"})])])])])]))}}),J_={},Y_={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 X_(n,e){return i.openBlock(),i.createElementBlock("svg",Y_,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const Z_=ge(J_,[["render",X_]]),Q_={class:"flex flex-col widget-file xl:bg-white xl:rounded-xl dark:xl:bg-neutral-800 dark:xl:border-neutral-700 w-full"},eS={class:"flex w-full mb-[12px] items-center gap-x-2"},tS={class:"font-semibold text-gray-800 dark:text-neutral-200 text-[14px]"},nS={class1:"ml-auto"},rS={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"},oS={key:0,class:"py-4 mb-4 space-y-4 border-gray-200 border-y dark:border-neutral-700"},sS={class:"relative"},lS={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"},iS={key:0},aS=i.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=i.inject("form"),o=i.computed(()=>r.value.formId),s=i.ref(!1),l=i.ref(0),a=e,c=i.ref(!1),d=i.ref({}),u=i.ref([]),f=i.ref(""),p=i.computed(()=>Array.isArray(u.value)?u.value.filter(C=>C.ext==="jpg"||C.ext==="png").map(C=>C?.file_path):[]),h=i.computed(()=>f.value===""?u.value:u.value.filter(C=>C?.uploaded_name?.includes(f.value))),m=C=>{const x=p.value.findIndex(w=>w===C.item.file_path);x!==-1&&(s.value=!0,l.value=x)},g=async()=>{try{const C=await fetch(`${t.prefix}/widget/file/${o.value}`).then(x=>x.json());u.value=C?.rows}catch(C){console.error(C)}},y=async C=>{await Promise.all(Array.from(C.target.files).map(async x=>{const w=new FormData;w.append("file",x);try{const S=`${t.prefix}/widget/file/${o.value}`,E=await fetch(S,{method:"POST",body:w});return E.ok?(a("update","file-list"),x):(Ie({type:E.status>=400&&E.status<500?"warning":"error",title:"Error",message:`Error code: ${E.status}`}),null)}catch(S){return Ie({type:"error",title:"Error",message:S.message||"Unknown error"}),console.error(S),null}})),await g()},b=C=>{const x={...C};return C.cancel||(x.cancel=()=>{c.value=!1}),C.updateListOnConfirm&&(x.confirm=async()=>{await C.confirm(),c.value=!1,g()}),x},k=C=>{d.value=b(C),c.value=!0};return i.watch(o,C=>{C&&g()}),i.onMounted(()=>{o.value&&g()}),(C,x)=>{const w=i.resolveComponent("Lightbox"),S=i.resolveComponent("MessageBox");return i.openBlock(),i.createElementBlock("div",Q_,[i.createElementVNode("div",eS,[i.createElementVNode("h2",tS," Файлів: "+i.toDisplayString(u.value?.length),1),i.createElementVNode("div",nS,[i.createElementVNode("label",null,[i.createElementVNode("input",{type:"file",class:"hidden",onChange:x[0]||(x[0]=E=>y(E))},null,32),i.createElementVNode("div",rS,[i.createVNode(Z_,{height:"16",width:"16"})])])])]),u.value?.length>4?(i.openBlock(),i.createElementBlock("div",oS,[i.createElementVNode("div",null,[i.createElementVNode("div",sS,[x[8]||(x[8]=i.createElementVNode("div",{class:"absolute inset-y-0 start-0 flex items-center pointer-events-none z-[1] ps-3.5"},[i.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"},[i.createElementVNode("circle",{cx:"11",cy:"11",r:"8"}),i.createElementVNode("path",{d:"m21 21-4.3-4.3"})])],-1)),i.withDirectives(i.createElementVNode("input",{type:"text","onUpdate:modelValue":x[1]||(x[1]=E=>f.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),[[i.vModelText,f.value,void 0,{trim:!0}]])])])])):i.createCommentVNode("",!0),u.value?.length?(i.openBlock(),i.createElementBlock("div",lS,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(h.value,(E,T)=>(i.openBlock(),i.createBlock(G_,{key:T,prefix:C.prefix,item:E,index:T,onUpdate:x[2]||(x[2]=D=>C.$emit("update","file-list")),onOpenModal:x[3]||(x[3]=D=>k(D)),onOpenLightbox:x[4]||(x[4]=D=>m(D))},null,8,["prefix","item","index"]))),128)),h.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",iS,x[9]||(x[9]=[i.createElementVNode("p",{class:"text-sm text-gray-600 font-sm"}," Файлів з такою назвою не існує, введіть інше пошукове слово ",-1)])))])):i.createCommentVNode("",!0),i.createVNode(w,{modelValue:s.value,"onUpdate:modelValue":x[5]||(x[5]=E=>s.value=E),startIndex:l.value,"onUpdate:index":x[6]||(x[6]=E=>l.value=E),images:p.value},null,8,["modelValue","startIndex","images"]),i.createVNode(S,i.mergeProps({modelValue:c.value,"onUpdate:modelValue":x[7]||(x[7]=E=>c.value=E),onConfirm:d.value.confirm},d.value),null,16,["modelValue","onConfirm"])])}}}),cS={class:"flex items-center justify-between"},dS={class:"text-[16px] text-gray-900 font-medium"},uS={class:"grid gap-3"},fS=i.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=i.ref(e.isOpen);return i.watch(()=>e.isOpen,r=>{t.value=r}),(r,o)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",cS,[i.createElementVNode("p",dS,i.toDisplayString(n.title),1),i.createVNode(Up,{modelValue:t.value,"onUpdate:modelValue":o[0]||(o[0]=s=>t.value=s),style:i.normalizeStyle(n.style)},null,8,["modelValue","style"])]),i.createVNode(i.Transition,{name:"slide-fade"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("div",uS,[i.renderSlot(r.$slots,"default",{},void 0,!0)],512),[[i.vShow,t.value]])]),_:3})]))}}),pS=ge(fS,[["__scopeId","data-v-90320b87"]]),hS={class:"text-[16px] text-gray-900 font-medium"},mS={class:"grid gap-3"},gS=i.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=i.ref(e.isOpen);return i.watch(()=>e.isOpen,r=>{t.value=r}),(r,o)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("button",{type:"button",onClick:o[0]||(o[0]=s=>t.value=!t.value),class:"flex items-center gap-2"},[i.createVNode(i.unref(pv),{class:i.normalizeClass(["h-4 w-4 duration-300",[t.value?"-rotate-180":""]])},null,8,["class"]),i.createElementVNode("span",hS,i.toDisplayString(n.title),1)]),i.createVNode(i.Transition,{name:"slide-fade"},{default:i.withCtx(()=>[i.withDirectives(i.createElementVNode("div",mS,[i.renderSlot(r.$slots,"default",{},void 0,!0)],512),[[i.vShow,t.value]])]),_:3})]))}}),yS=ge(gS,[["__scopeId","data-v-590eff11"]]),bS={class:"flex items-center justify-between"},kS=i.defineComponent({__name:"vs-container-default",props:{title:{type:String,default:""},style:{type:Object,default:()=>({})}},setup(n){return(e,t)=>(i.openBlock(),i.createElementBlock("div",null,[i.createElementVNode("div",bS,[i.createElementVNode("p",null,i.toDisplayString(n.title),1)]),i.renderSlot(e.$slots,"default")]))}}),xS={switcher:pS,accordion:yS,default:kS},Ot={Equal:"==",Inequal:"!=",Higer:">",HigerOrEqual:">=",Lower:"<",LowerOrEqual:"<=",Between:"between",StartWith:"^",EndWith:"$",Contain:"*",In:"in",NotIn:"not_in"},wS=(n,e)=>String(n)===String(e),ES=(n,e)=>String(n)!==String(e),CS=(n,e)=>n>e,vS=(n,e)=>n>=e,_S=(n,e)=>n<e,SS=(n,e)=>n<=e,NS=(n,e)=>Array.isArray(e)&&e.length===2?n>=e[0]&&n<=e[1]:!1,MS=(n,e)=>String(n).startsWith(String(e)),TS=(n,e)=>String(n).endsWith(String(e)),AS=(n,e)=>String(n).includes(String(e)),BS=(n,e)=>Array.isArray(e)?e.includes(n):!1,VS=(n,e)=>Array.isArray(e)?!e.includes(n):!0,Zp=(n,e)=>{if(!e)return!0;switch(e?.[1]){case Ot.Equal:return wS(n,e?.[2]);case Ot.Inequal:return ES(n,e?.[2]);case Ot.Higer:return CS(n,e?.[2]);case Ot.HigerOrEqual:return vS(n,e?.[2]);case Ot.Lower:return _S(n,e?.[2]);case Ot.LowerOrEqual:return SS(n,e?.[2]);case Ot.Between:return NS(n,e?.[2]);case Ot.StartWith:return MS(n,e?.[2]);case Ot.EndWith:return TS(n,e?.[2]);case Ot.Contain:return AS(n,e?.[2]);case Ot.In:return BS(n,e?.[2]);case Ot.NotIn:return VS(n,e?.[2]);default:return!0}},LS=i.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=i.inject("values",i.ref({})),r=i.inject("form"),o=i.computed(()=>e.schema?.filter(a=>{const c=a?.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 Zp(u,c)})),s=i.computed(()=>xS[e.view]),l=i.computed(()=>{if(t.value||(t.value={}),!e.name)return t.value;const a=t.value[e.name];if(a)return a;const c={};return t.value={...t.value,[e.name]:c},c});return(a,c)=>n.schema?.length?(i.openBlock(),i.createBlock(i.resolveDynamicComponent(s.value),{key:0,title:n.title,style:i.normalizeStyle(n.style)},{default:i.withCtx(()=>[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(o.value,d=>(i.openBlock(),i.createBlock(th,i.mergeProps({key:d.name},{ref_for:!0},d,{item:d,modelValue:l.value[d.name],"onUpdate:modelValue":u=>l.value[d.name]=u,style:n.style,error:i.unref(r)?.errors?.[d.name]}),null,16,["item","modelValue","onUpdate:modelValue","style","error"]))),128))]),_:1},8,["title","style"])):i.createCommentVNode("",!0)}}),OS=["aria-expanded","data-focus"],IS={key:0,class:"flex flex-wrap items-center gap-1 overflow-y-auto min-w-0 flex-1"},DS={class:"flex items-center min-w-0"},RS=["title"],FS=["innerHTML"],PS=["onClick"],$S={class:"flex-1 min-w-[2px]"},zS=["placeholder"],HS=["title"],jS=["innerHTML"],US={key:2,class:"flex-1 min-w-[2px]"},WS=["placeholder"],KS={class:"flex items-center shrink-0"},qS=["disabled"],GS=["disabled","title"],JS=["aria-disabled","onClick"],YS=["innerHTML"],XS={key:1,class:"px-3 py-2 text-center text-gray-500"},ZS=["disabled"],Qp=i.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,o=i.computed(()=>t.multiple),s=i.computed(()=>t.disabled);vt(t.style);const l=i.computed({get:()=>t.modelValue,set:V=>r("update:modelValue",V)});!l.value&&t.defaultValue&&(l.value=t.defaultValue);const a=i.ref(null),c=i.ref(null),d=i.ref(null),u=i.ref(null),f=i.ref(!1),p=i.ref(!1),h=i.ref(null),m=i.ref([]),g=i.ref(-1),y=i.ref([]),b=i.ref(""),k=i.ref(null),C=i.ref("bottom"),x=i.ref({}),w=i.ref([]),S=i.computed(()=>{if(!w.value.length)return[];const V=m.value,F=new Map(V.map(W=>[W.id?.toString(),W]));return w.value.map(W=>F.get(W?.toString())).filter(W=>!!W)}),E=i.computed(()=>t.placeholder||"Select..."),T=i.computed(()=>q(h.value));i.computed(()=>o.value?!w.value.length&&b.value==="":!T.value&&b.value==="");const D=i.computed(()=>s.value?!1:o.value?w.value.length>0:!!l.value),U=V=>o.value?w.value.some(F=>F?.toString()===V?.toString()):l.value?.toString()===V?.toString(),B=i.computed(()=>{let V=m.value??[];if(!t.data&&b.value.trim()!==""){const F=b.value.toLowerCase();V=V.filter(W=>{const ae=q(W).toLowerCase(),_e=W.text?.toLowerCase?.()||"";return ae.includes(F)||_e.includes(F)})}if(o.value&&w.value.length){const F=new Set(w.value.map(W=>W?.toString()));V=V.filter(W=>!F.has(W.id?.toString()))}return V}),A=i.inject("values"),j=/\{\{\s*([^}]+?)\s*\}\}/g,Y=V=>(V?String(V):"").replace(/<[^>]*>/g,"").trim(),z=i.computed(()=>t.slot??t?.optionTemplate??""),K=V=>{if(!V)return"";const F=z.value;return F?F.replace(j,(W,ae)=>{const _e=ae.trim(),Ze=V[_e];return Ze!=null?String(Ze):""}):V.text??""},q=V=>{if(!V)return"";if(!z.value)return V.text??"";const F=K(V);return Y(F)||V.text||""},re=V=>{t.set&&A?.value&&Object.entries(t.set).forEach(([F,W])=>{if(!F)return;const ae=V?V[W]:null;A.value[F]=ae??null})},se=i.computed(()=>t.parent?A?.value?.[t.parent]?.toString()??null:null),ve=async V=>{if(!t.data){let F=t.options??[];if(V?.trim()){const W=V.toLowerCase();F=F.filter(ae=>{const _e=q(ae).toLowerCase(),Ze=ae.text?.toLowerCase?.()||"";return _e.includes(W)||Ze.includes(W)})}return F}try{const F=t.host??"",W=t.prefix??"api",ae=t.api??`/${W}/suggest/${t.data}`,_e=`${F}${ae}`,Ze=new URLSearchParams;return Ze.set("json","1"),V&&Ze.set("key",V),se.value!==void 0&&se.value!==null&&se.value!==""&&Ze.set("parent",se.value),(await fetch(`${_e}?${Ze.toString()}`).then(Nt=>Nt.json()))?.data??[]}catch{return[]}},pt=async()=>{t.data?m.value=await ve(b.value):m.value=t.options?[...t.options]:[]},St=async V=>{if(V==null)return null;const F=m.value?.find(W=>W?.id?.toString()===String(V));if(F)return F;if(t.data)try{const W=t.host??"",ae=t.prefix??"api",_e=t.api??`/${ae}/suggest/${t.data}`,Ze=`${W}${_e}`,Nt=new URLSearchParams;return Nt.set("json","1"),Nt.set("val",String(V)),se.value!==void 0&&se.value!==null&&se.value!==""&&Nt.set("parent",se.value),((await fetch(`${Ze}?${Nt.toString()}`).then(Wr=>Wr.json()))?.data??[])?.[0]??null}catch{return null}return null},Ft=async V=>{const F=new Set(m.value.map(ae=>ae.id?.toString())),W=V.filter(ae=>!F.has(ae?.toString()));W.length&&await W.reduce(async(ae,_e)=>{await ae;const Ze=await St(_e);Ze&&m.value.push(Ze)},Promise.resolve())},Ke=async()=>{s.value||(f.value=!0,await pt(),await i.nextTick(()=>{$t(),k.value?.focus(),B.value.length?g.value=0:g.value=-1}))},ht=()=>{f.value=!1,g.value=-1},En=async V=>{s.value||(f.value?ht():await Ke())},Cn=async()=>{f.value?k.value?.focus():await Ke()},vn=()=>{o.value?(w.value=[],l.value=[],r("change",[])):(h.value=null,l.value=null,r("change",null)),re(null),b.value="",i.nextTick(()=>k.value?.focus())},xr=V=>{o.value&&(w.value=w.value.filter(F=>F?.toString()!==V?.toString()),l.value=[...w.value],r("change",l.value),i.nextTick(()=>k.value?.focus()))},mt=V=>{o.value?(U(V.id)||(w.value=[...w.value,V.id],l.value=[...w.value],r("change",l.value)),b.value="",i.nextTick(()=>{k.value?.focus(),g.value=Math.min(g.value,B.value.length-1)}),re(null)):(h.value=V,l.value=V.id,r("change",l.value),b.value="",ht(),re(V))},Pt=V=>{U(V.id)||mt(V)},cn=(V,F)=>{if(!V||!F)return;const W=V.offsetTop,ae=W+V.offsetHeight,_e=F.scrollTop,Ze=_e+F.clientHeight;let Nt=F.scrollTop;W<_e?Nt=W-80:ae>Ze&&(Nt=ae-F.clientHeight+4);const Wr=F;Wr.scrollTop=Nt},qe=V=>{let F=V.parentElement;for(;F;){if(F.classList.contains("ui-dialog__content"))return F;const W=window.getComputedStyle(F),ae=W.overflow+W.overflowY+W.overflowX;if(ae.includes("auto")||ae.includes("scroll")||F===document.body||F===document.documentElement)return F;F=F.parentElement}return document.body},$t=()=>{if(!c.value)return;const V=c.value.getBoundingClientRect(),F=window.innerHeight||document.documentElement.clientHeight,W=window.innerWidth||document.documentElement.clientWidth,ae=8,_e=8,Ze=t.maxHeight||300,Nt=F-V.bottom-_e-ae,Wr=V.top-_e-ae,Dl=Nt>=Wr,mc=Math.max(W-ae*2,0);let{width:jo}=V;mc>0&&jo>mc&&(jo=mc);let{left:Uo}=V;Uo+jo+ae>W&&(Uo=W-jo-ae),Uo=Math.max(Uo,ae);const iO=Math.min(Ze,Math.max(Dl?Nt:Wr,50));C.value=Dl?"bottom":"top",x.value={position:"fixed",left:`${Uo}px`,width:`${jo}px`,minWidth:"300px",maxHeight:`${iO}px`,transform:Dl?"none":"translateY(-100%)",top:Dl?`${V.bottom+_e}px`:`${V.top-_e}px`}},qt=async V=>{s.value||!f.value&&(V.key==="ArrowDown"||V.key==="ArrowUp")&&(V.preventDefault(),await Ke())},dn=V=>{if(!f.value)return;const{key:F}=V;if(F==="ArrowDown")V.preventDefault(),g.value+1<B.value.length&&(g.value+=1,cn(y.value[g.value],d.value));else if(F==="ArrowUp")V.preventDefault(),g.value>0&&(g.value-=1,cn(y.value[g.value],d.value));else if(F==="Enter"){V.preventDefault();const W=B.value[g.value];W&&mt(W),k.value?.blur()}else F==="Escape"?(V.preventDefault(),ht()):F==="Backspace"?o.value&&b.value===""&&w.value.length&&(w.value=w.value.slice(0,-1),l.value=[...w.value],r("change",l.value)):F==="Home"?(g.value=0,cn(y.value[0],d.value)):F==="End"?(g.value=B.value.length-1,cn(y.value[g.value],d.value)):F==="Tab"&&ht()},Xn=()=>{s.value||(p.value=!0)},_=()=>{p.value=!1,b.value=""},N=V=>{V.key==="Escape"&&f.value&&ht()},R=V=>{const F=V.target;a.value?.contains(F)||u.value?.contains(F)||ht()},Z=V=>{f.value&&d.value&&!d.value.contains(V.target)&&$t()},we=()=>{f.value&&$t()},Be=()=>{f.value&&$t()};i.watch(()=>t.options,V=>{V?.length&&(m.value=[...V],pe())},{immediate:!0});async function pe(){if(o.value)Array.isArray(l.value)?w.value=[...l.value]:(w.value=l.value==null?[]:[l.value],l.value=[...w.value]),t.data&&w.value.length&&(await Ft(w.value),await i.nextTick());else{if(Array.isArray(l.value)){const V=l.value[0]??null;l.value=V??null}l.value!=null&&(h.value=await St(l.value)),re(h.value??null)}}i.watch(l,()=>{pe()}),i.onMounted(async()=>{addEventListener("keydown",N),addEventListener("scroll",Z,!0),addEventListener("resize",we),document.addEventListener("click",R,!0),c.value&&qe(c.value).addEventListener("scroll",Be,!0),t.options?.length&&!t.data?m.value=[...t.options]:t.data&&(m.value=await ve("")),await pe(),fe.value=!1}),i.onUnmounted(()=>{removeEventListener("keydown",N),removeEventListener("scroll",Z,!0),removeEventListener("resize",we),document.removeEventListener("click",R,!0),c.value&&qe(c.value).removeEventListener("scroll",Be,!0)});const O=i.ref(!1),P=i.ref({}),he=i.ref([]),v=i.ref(null);async function M(){if(!t.add?.token||v?.value.validate())return;const V=t.add.api??`/api/table/${t.add.token}`,{id:F}=await fetch(V,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(P.value)}).then(W=>W.json());if(!t.options?.length&&t.data){const{data:W}=await fetch(`${t.api??`/api/suggest/${t.data}`}?val=${F}`).then(ae=>ae.json());h.value=W[0],m.value.push(W[0]),l.value=F}O.value=!1,Ie({title:"Success!",message:"Object created."})}async function H(){if(!t.add)return null;const V=await fetch(`/api/template/form/${t.add.form}`).then(F=>F.json());return he.value=V.schema,O.value=!0,null}function G(V,F=200){let W;return(...ae)=>{W&&clearTimeout(W),W=window.setTimeout(()=>V(...ae),F)}}const Q=G(async V=>{m.value=await ve(V)},200);i.watch(b,V=>{t.data&&Q(V.trim())}),i.watch(()=>t.options,V=>{!t.data&&V?.length&&(m.value=[...V],pe())},{immediate:!0}),i.watch(()=>t.parent??t.parentValue,()=>{t.data&&pt()});const fe=i.ref(!0);return i.watch(se,async()=>{if(t.data&&(fe.value||(o.value?(w.value=[],l.value=[],r("change",[])):(h.value=null,l.value=null,r("change",null))),await pt(),t.auto===1&&se.value&&m.value.length>0)){const V=m.value[0];V&&mt(V)}}),(V,F)=>(i.openBlock(),i.createElementBlock(i.Fragment,null,[i.createVNode(i.unref(Va),{visible:O.value,"onUpdate:visible":F[1]||(F[1]=W=>O.value=W),title:"Додати",buttonText:"Додати",onDone:M,teleport:V.teleport},{default:i.withCtx(()=>[i.createVNode(Rr,{schema:he.value,modelValue:P.value,"onUpdate:modelValue":F[0]||(F[0]=W=>P.value=W),ref_key:"addForm",ref:v},null,8,["schema","modelValue"])]),_:1},8,["visible","teleport"]),i.createElementVNode("div",{class:"flex gap-1 w-full",ref_key:"selectRoot",ref:a,onClick:F[5]||(F[5]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:i.normalizeClass(["relative w-full font-sans",t.customClass])},[F[10]||(F[10]=i.createElementVNode("span",{id:"react-select-live-region",class:"sr-only"},null,-1)),F[11]||(F[11]=i.createElementVNode("span",{"aria-live":"polite","aria-atomic":"false","aria-relevant":"additions text",role:"log",class:"sr-only"},null,-1)),i.createElementVNode("div",{class:i.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",f.value||p.value?"border-blue-500 ring-1 ring-blue-500":"",s.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),role:"combobox","aria-expanded":f.value,"aria-haspopup":"listbox",onKeydown:qt,onClick:Cn,"data-focus":f.value||p.value?"true":"false"},[i.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},[o.value?(i.openBlock(),i.createElementBlock("div",IS,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(S.value,W=>(i.openBlock(),i.createElementBlock("div",{class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border max-w-full",key:W.id},[i.createElementVNode("div",DS,[W?.color?(i.openBlock(),i.createElementBlock("span",{key:0,class:"w-[16px] h-[16px] rounded-md block ml-1.5 flex-shrink-0",style:i.normalizeStyle({backgroundColor:W?.color})},null,4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:"truncate text-gray-900 overflow-hidden max-w-[200px] px-0.5 py-[2px] pl-1.5",title:q(W)},[z.value?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:K(W)},null,8,FS)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(W.text),1)],64))],8,RS)]),i.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b] flex-shrink-0",onClick:i.withModifiers(ae=>xr(W.id),["stop"])},F[6]||(F[6]=[i.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"},[i.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,PS)]))),128)),i.createElementVNode("div",$S,[!s.value&&V.search?i.withDirectives((i.openBlock(),i.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:w.value.length?" ":E.value,"onUpdate:modelValue":F[2]||(F[2]=W=>b.value=W),onFocus:Xn,onBlur:_,onKeydown:dn},null,40,zS)),[[i.vModelText,b.value]]):i.createCommentVNode("",!0)])])):!o.value&&!p.value&&T.value&&b.value===""?(i.openBlock(),i.createElementBlock("div",{key:1,class:i.normalizeClass(["truncate text-gray-900"]),title:T.value},[h.value?.color?(i.openBlock(),i.createElementBlock("span",{key:0,class:"w-[14px] h-[14px] rounded-md block mr-1 mt-1 absolute",style:i.normalizeStyle({backgroundColor:h.value?.color})},null,4)):i.createCommentVNode("",!0),z.value?(i.openBlock(),i.createElementBlock("span",{key:1,class:i.normalizeClass({"pl-5":h.value?.color}),innerHTML:K(h.value)},null,10,jS)):(i.openBlock(),i.createElementBlock("span",{key:2,class:i.normalizeClass({"pl-5":h.value?.color})},i.toDisplayString(h.value?.text),3))],8,HS)):i.createCommentVNode("",!0),o.value?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",US,[!s.value&&V.search?i.withDirectives((i.openBlock(),i.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:T.value?" ":E.value,"onUpdate:modelValue":F[3]||(F[3]=W=>b.value=W),onFocus:Xn,onBlur:_,onKeydown:dn},null,40,WS)),[[i.vModelText,b.value]]):i.createCommentVNode("",!0)]))],512),i.createElementVNode("div",KS,[D.value?(i.openBlock(),i.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:s.value,onClick:i.withModifiers(vn,["stop"])},F[7]||(F[7]=[i.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[i.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,qS)):i.createCommentVNode("",!0),F[9]||(F[9]=i.createElementVNode("div",{class:"self-stretch w-px bg-[#ccc] my-[1px]"},null,-1)),i.createElementVNode("button",{type:"button",class:"px-2 text-gray-400 hover:text-gray-500 transition-colors disabled:opacity-50","aria-hidden":"true",disabled:s.value,onClick:F[4]||(F[4]=i.withModifiers(W=>En(),["stop"])),title:f.value?"Закрити список":"Відкрити список"},F[8]||(F[8]=[i.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[i.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,GS)])],42,OS),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[f.value?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:i.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:i.normalizeStyle(x.value),role:"listbox"},[i.createElementVNode("div",{class:"overflow-y-auto py-1",style:i.normalizeStyle({maxHeight:x.value.maxHeight||"300px"}),ref_key:"listRef",ref:d},[B.value.length?(i.openBlock(!0),i.createElementBlock(i.Fragment,{key:0},i.renderList(B.value,(W,ae)=>(i.openBlock(),i.createElementBlock("div",{key:W.id,ref_for:!0,ref:_e=>y.value[ae]=_e,class:i.normalizeClass(["flex px-3 py-2 cursor-default select-none text-gray-900 ",U(W.id)?"bg-blue-500 text-white":"bg-white hover:bg-blue-100",g.value===ae&&!U(W.id)?"bg-blue-100":""]),"aria-disabled":U(W.id)?"true":"false",role:"option",tabindex:"-1",onClick:_e=>Pt(W)},[W?.color?(i.openBlock(),i.createElementBlock("span",{key:0,class:"w-[11px] h-[11px] rounded-full block mr-1 mt-1.5",style:i.normalizeStyle({backgroundColor:W?.color})},null,4)):i.createCommentVNode("",!0),i.createElementVNode("div",{class:i.normalizeClass(["leading-[19px]",g.value===W.id?"text-white":"",(g.value,"")])},[z.value?(i.openBlock(),i.createElementBlock("span",{key:0,innerHTML:K(W)},null,8,YS)):(i.openBlock(),i.createElementBlock(i.Fragment,{key:1},[i.createTextVNode(i.toDisplayString(W.text),1)],64))],2)],10,JS))),128)):(i.openBlock(),i.createElementBlock("div",XS," No options "))],4)],4)):i.createCommentVNode("",!0)]))],2),t.add?(i.openBlock(),i.createElementBlock("button",{key:0,onClick:H,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:s.value,type:"button"},[i.createVNode(To,{width:"16",height:"16"}),F[12]||(F[12]=i.createElementVNode("span",null,"Додати",-1))],8,ZS)):i.createCommentVNode("",!0)],512)],64))}}),QS=["placeholder","disabled"],eN=i.defineComponent({__name:"vs-input-textarea",props:i.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}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");return(l,a)=>i.withDirectives((i.openBlock(),i.createElementBlock("textarea",{"onUpdate:modelValue":a[0]||(a[0]=c=>r.value=c),placeholder:s.value,disabled:o.value,row:"2",class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] h-auto bg-white",[i.unref(t)]]),style:{border:"1px solid #CFD9E0"}},null,10,QS)),[[i.vModelText,r.value]])}}),tN={},nN={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 rN(n,e){return i.openBlock(),i.createElementBlock("svg",nN,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},null,-1),i.createElementVNode("path",{d:"M21 21l-6 -6"},null,-1)]))}const oN=ge(tN,[["render",rN]]),sN={},lN={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 iN(n,e){return i.openBlock(),i.createElementBlock("svg",lN,e[0]||(e[0]=[i.createElementVNode("path",{d:"m3 16 4 4 4-4"},null,-1),i.createElementVNode("path",{d:"M7 20V4"},null,-1),i.createElementVNode("path",{d:"m21 8-4-4-4 4"},null,-1),i.createElementVNode("path",{d:"M17 4v16"},null,-1)]))}const aN=ge(sN,[["render",iN]]),cN={},dN={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 uN(n,e){return i.openBlock(),i.createElementBlock("svg",dN,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 9l5 -5l5 5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const fN=ge(cN,[["render",uN]]),pN={},hN={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 mN(n,e){return i.openBlock(),i.createElementBlock("svg",hN,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2 -2v-2"},null,-1),i.createElementVNode("path",{d:"M7 11l5 5l5 -5"},null,-1),i.createElementVNode("path",{d:"M12 4l0 12"},null,-1)]))}const gN=ge(pN,[["render",mN]]),yN={},bN={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 kN(n,e){return i.openBlock(),i.createElementBlock("svg",bN,e[0]||(e[0]=[i.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 eh=ge(yN,[["render",kN]]),xN={},wN={viewBox:"0 0 178 90",fill:"none",xmlns:"http://www.w3.org/2000/svg"};function EN(n,e){return i.openBlock(),i.createElementBlock("svg",wN,e[0]||(e[0]=[i.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 CN=ge(xN,[["render",EN]]),vN={},_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"};function SN(n,e){return i.openBlock(),i.createElementBlock("svg",_N,e[0]||(e[0]=[i.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 NN=ge(vN,[["render",SN]]),MN={class:"vs-datatable border rounded-xl w-full flex-grow"},TN={class:"flex items-center npm gap-[16px] justify-between p-[20px] pb-[16px]"},AN={class:"relative w-full"},BN={class:"table-wrapper flex gap-2"},VN={class:"vs-popover inline-block text-slate-700"},LN={class:"text-center"},ON={class:""},IN={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"},DN={class:"flex flex-col p-[1px] gap-[2px] w-[140px]"},RN={class:"text-sm items-center text-gray-800 flex gap-1"},FN={class:"w-full overflow-x-auto"},PN={class:"w-full table-auto caption-bottom text-sm"},$N={class:"[&_tr]:border-b"},zN={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"},HN={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"},jN={key:0,colspan:"100%",class:"text-center"},UN={class:"w-full"},WN={class:"p-5 min-h-[200px] flex flex-col justify-center items-center text-center"},KN=["onDragstart","onDragover","onDrop"],qN={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px] text-center"},GN={class:"flex items-center justify-center"},JN={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"},YN={key:0},XN=["src"],ZN={key:1,class:"rounded-md max-w-[45px] w-[45px] max-h-[45px] h-[45px] bg-gray-200 flex items-center justify-center"},QN=["innerHTML"],eM={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"},tM={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"},nM={class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},rM={class:"flex items-center justify-center gap-2"},oM=["onClick"],sM=["onClick"],lM={class:"vs-form__head mr-5 mt-3 flex items-center justify-end sticky top-0 left-0 z-[60] bg-white"},iM=i.defineComponent({__name:"vs-input-datatable",props:i.mergeModels({colModel:{},style:{},customClass:{},disabled:{type:Boolean},modelValue:{},error:{},name:{},placeholder:{}},{modelValue:{default:[]},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=n,t=i.useModel(n,"modelValue"),r=i.ref({}),o=i.ref(""),s=i.computed(()=>{if(!o.value)return t.value??[];const z=o.value.toLowerCase();return t.value.filter(K=>e.colModel?.some(q=>{const re=K[q.key];return re?Array.isArray(re)?re.join(", ").toLowerCase().includes(z):String(re).toLowerCase().includes(z):!1}))}),l=i.ref(null),a=i.ref(null),c=i.ref(!1),d=i.ref(null),u=i.ref({top:0,left:0}),f=z=>{l.value=z},p=z=>{a.value=z},h=z=>{if(l.value===null||l.value===z){l.value=null,a.value=null;return}const K=[...t.value],[q]=K.splice(l.value,1);K.splice(z,0,q),t.value=K,l.value=null,a.value=null},m=z=>{const K=z.currentTarget.getBoundingClientRect();u.value={top:K.bottom+window.scrollY,left:K.left+window.scrollX},c.value=!c.value},g=()=>{d.value&&d.value.click()},y=z=>{const K=[".jpg",".jpeg",".png",".gif",".bmp",".webp",".svg",".ico",".tiff",".tif"],q=z.toLowerCase();return K.some(re=>q.endsWith(re))},b=z=>{const K=z.target.files?.[0];if(!K)return;const q=new FileReader;q.onload=re=>{try{const se=re.target?.result;if(typeof se=="string"){const ve=JSON.parse(se);Array.isArray(ve)&&t.value.push(...ve)}}catch(se){console.error("Error parsing file:",se)}},q.readAsText(K)},k=()=>{const z=JSON.stringify(t.value,null,2),K=new Blob([z],{type:"application/json"}),q=URL.createObjectURL(K),re=document.createElement("a");re.href=q,re.download="data.json",re.click(),URL.revokeObjectURL(q)};i.onMounted(async()=>{const z=e.colModel?.filter(K=>K.data);z?.length&&Promise.all(z.map(async K=>{const q=await(await fetch(`/api/suggest/${K.data}`)).json();r.value[K.key]=q.data}))});const C=i.ref(""),x=i.ref(!1);let w="edit",S=0;const E=i.ref({}),T=i.ref({});async function D(){C.value="Додати",x.value=!0,w="add",E.value={}}function U(z,K){const q=K.key||K.name;return r.value[q]&&z[q]?r.value[q].find(re=>re.id.toString()===z[q].toString())?.text??z[q]:z[q]||"-"}async function B(z,K){C.value="Редагувати",x.value=!0,w="edit",S=K,E.value={...z}}function A(){const z=T.value.validate();if(z){Ie({type:"warning",title:"Помилка валідації",message:Object.entries(z).map(([K,q])=>`${K}: ${q}`).join(`
105
105
  `)});return}w==="add"?Array.isArray(t.value)?t.value=[...t.value,E.value]:t.value=[E.value]:t.value=t.value.map((K,q)=>q===S?E.value:K),x.value=!1}function j(z){t.value=t.value.filter((K,q)=>q!==z)}function Y(){x.value=!1}return(z,K)=>(i.openBlock(),i.createElementBlock("div",MN,[i.createElementVNode("div",TN,[i.createElementVNode("div",AN,[i.createVNode(oN,{width:"14",height:"14",class:"absolute left-3 top-1/2 transform -translate-y-1/2 text-stone-500"}),i.withDirectives(i.createElementVNode("input",{type:"text","onUpdate:modelValue":K[0]||(K[0]=q=>o.value=q),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),[[i.vModelText,o.value]])]),i.createElementVNode("div",BN,[i.createElementVNode("input",{ref_key:"fileInput",ref:d,onChange:b,class:"hidden",accept:".json",type:"file"},null,544),i.createElementVNode("div",VN,[i.createElementVNode("div",LN,[i.createElementVNode("div",ON,[i.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"},[i.createVNode(aN,{height:"16",width:"16"})])])])])]),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[c.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"text-slate-700 vsTailwind vs-popover__content bottom",style:i.normalizeStyle([{width:"fit-content","z-index":"10002",position:"fixed"},{position:"absolute",top:u.value.top+"px",left:u.value.left+"px"}])},[i.createElementVNode("div",IN,[i.createElementVNode("div",DN,[i.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"},[i.createVNode(fN,{class:"text-black",width:"14",height:"14"}),K[4]||(K[4]=i.createTextVNode(" Імпортувати ",-1))]),i.createElementVNode("button",{onClick:k,class:"text-slate-700 flex items-center px-3 py-2 rounded-md cursor-pointer group hover:bg-gray-100"},[i.createElementVNode("span",RN,[i.createVNode(gN,{class:"text-black",width:"14",height:"14"}),K[5]||(K[5]=i.createTextVNode(" Експортувати ",-1))])])])])],4)):i.createCommentVNode("",!0)])),i.createElementVNode("button",{onClick:D,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"},[i.createVNode(To),K[6]||(K[6]=i.createTextVNode(" Додати ",-1))])]),i.createElementVNode("div",FN,[i.createElementVNode("table",PN,[i.createElementVNode("thead",$N,[i.createElementVNode("tr",zN,[i.createElementVNode("th",HN,[i.createVNode(eh,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(z.colModel,q=>(i.openBlock(),i.createElementBlock("th",{key:q.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]"},i.toDisplayString(q.ua||q.label),1))),128)),K[7]||(K[7]=i.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))])]),i.createElementVNode("tbody",{class:i.normalizeClass({"[&_tr:last-child]:border-0":!a.value})},[s.value.length===0?(i.openBlock(),i.createElementBlock("td",jN,[i.createElementVNode("div",UN,[i.createElementVNode("div",WN,[i.createVNode(CN,{class:"w-48 mx-auto"}),K[8]||(K[8]=i.createElementVNode("div",{class:"max-w-sm mx-auto mt-6"},[i.createElementVNode("p",{class:"font-medium text-gray-800 dark:text-neutral-200"},"Нічого не знайдено"),i.createElementVNode("p",{class:"mt-2 text-sm text-gray-500 dark:text-neutral-500"})],-1))])])])):i.createCommentVNode("",!0),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,(q,re)=>(i.openBlock(),i.createElementBlock("tr",{key:q.id,class:i.normalizeClass(["border-b data-[state=selected]:bg-muted transition-all duration-200 hover:bg-slate-50/60 dark:hover:bg-slate-700/60 cursor-move",{"opacity-50":l.value===re,"border-t-2 border-b-2 border-blue-500 bg-blue-50 dark:bg-blue-900/20":a.value===re}]),draggable:"true",onDragstart:se=>f(re),onDragover:i.withModifiers(se=>p(re),["prevent"]),onDrop:se=>h(re)},[i.createElementVNode("td",qN,[i.createElementVNode("div",GN,[i.createVNode(eh,{width:"24",height:"24",class:"w-4 h-4 mx-auto text-slate-400 dark:text-slate-500"})])]),(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(z.colModel,se=>(i.openBlock(),i.createElementBlock("td",{key:se.key,class:"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]"},[se.type==="file"?(i.openBlock(),i.createElementBlock("div",JN,[y(U(q,se))?(i.openBlock(),i.createElementBlock("div",YN,[i.createElementVNode("img",{src:U(q,se),alt:"alt",width:"45",class:"rounded-md max-w-[45px] h-[45px] object-cover"},null,8,XN)])):(i.openBlock(),i.createElementBlock("div",ZN,[i.createVNode(Jp,{class:"w-[25px] min-w-[25px] h-[25px]"})]))])):se.type==="tiptap-editor"?(i.openBlock(),i.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:U(q,se)},null,8,QN)):se.type==="reference"?(i.openBlock(),i.createElementBlock("div",eM,i.toDisplayString(U(q,se)),1)):(i.openBlock(),i.createElementBlock("div",tM,i.toDisplayString(U(q,se)),1))]))),128)),i.createElementVNode("td",nM,[i.createElementVNode("div",rM,[i.createElementVNode("button",{onClick:se=>B(q,re),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"},[i.createVNode(NN,{width:"24",height:"24",class:"w-3 h-3"})],8,oM),i.createElementVNode("button",{onClick:se=>j(re),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"},[i.createVNode(kl,{width:"24",height:"24",class:"w-3 h-3"})],8,sM)])])],42,KN))),128))],2)])]),i.createVNode(i.unref(Va),{teleport:"#modal",visible:x.value,title:C.value,size:"lg",onClose:Y},{default:i.withCtx(()=>[i.createVNode(Rr,{schema:e.colModel,values:E.value,"onUpdate:values":K[1]||(K[1]=q=>E.value=q),form:T.value,"onUpdate:form":K[2]||(K[2]=q=>T.value=q)},null,8,["schema","values","form"]),i.createElementVNode("div",lM,[i.createElementVNode("button",{type:"button",onClick:K[3]||(K[3]=q=>x.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"}," Скасувати "),i.createElementVNode("button",{onClick:A,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"])]))}}),aM={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 Ao(n){return n?n.type==="Polygon"?{type:"MultiPolygon",coordinates:[n.coordinates]}:n.type==="Feature"?{...n,geometry:Ao(n.geometry)}:n.type==="FeatureCollection"?{...n,features:(n.features||[]).map(e=>Ao(e)).filter(Boolean)}:n:null}function cM(n){return n?n.type==="FeatureCollection"||n.type==="Feature"?Ao(n):n.geom?{type:"Feature",geometry:Ao({type:n.geom.type,coordinates:n.geom.coordinates}),properties:{}}:n.type&&n.coordinates?{type:"Feature",geometry:Ao(n),properties:{}}:null:null}const dM={},uM={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 fM(n,e){return i.openBlock(),i.createElementBlock("svg",uM,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M9 11a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},null,-1),i.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 pM=ge(dM,[["render",fM]]),hM={},mM={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 gM(n,e){return i.openBlock(),i.createElementBlock("svg",mM,e[0]||(e[0]=[i.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),i.createElementVNode("path",{d:"M6 18m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),i.createElementVNode("path",{d:"M18 6m-2 0a2 2 0 1 0 4 0a2 2 0 1 0 -4 0"},null,-1),i.createElementVNode("path",{d:"M7.5 16.5l9 -9"},null,-1)]))}const yM=ge(hM,[["render",gM]]),bM={},kM={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 xM(n,e){return i.openBlock(),i.createElementBlock("svg",kM,e[0]||(e[0]=[i.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 wM=ge(bM,[["render",xM]]),EM={},CM={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 vM(n,e){return i.openBlock(),i.createElementBlock("svg",CM,e[0]||(e[0]=[i.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 _M=ge(EM,[["render",vM]]),SM={},NM={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 MM(n,e){return i.openBlock(),i.createElementBlock("svg",NM,e[0]||(e[0]=[i.createElementVNode("title",null,null,-1),i.createElementVNode("desc",null,null,-1),i.createElementVNode("defs",null,null,-1),i.createElementVNode("g",{fill:"none","fill-rule":"evenodd",id:"Page-1",stroke:"none","stroke-width":"1"},[i.createElementVNode("g",{fill:"#000000",id:"Core",transform:"translate(-215.000000, -257.000000)"},[i.createElementVNode("g",{id:"fullscreen",transform:"translate(215.000000, 257.000000)"},[i.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 TM=ge(SM,[["render",MM]]),AM={class:"map-search-widget flex flex-col gap-2 rounded-xl widget min-w-[200px]"},BM={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"},VM=["onClick"],LM={class:"relative flex-1 min-w-[140px]"},OM=["placeholder"],IM="https://data.softpro.ua/api-user/gis-url-proxy",DM="https://geo.rv.ua/api-user/dzk.api",RM=i.defineComponent({__name:"map-search",props:{config:{}},emits:["goToCoordinates"],setup(n,{emit:e}){const t=n,r=e,o=["here","xy","parcel"],s=i.computed(()=>{const x=t.config?.tools?.filter(w=>o.includes(w));return x&&x.length?x:o}),l=i.computed(()=>t.config?.placeholder?.trim()||"Пошук…"),a=i.ref(s.value[0]??o[0]);i.watch(s,x=>{x.includes(a.value)||(a.value=x[0])});const c=i.ref(""),d=i.ref(!1),u=i.ref(null);i.watch(a,()=>{c.value="",d.value=!1});function f(x){a.value=x}function p(x){if(!d.value)return;const w=u.value;w&&!w.contains(x.target)&&(d.value=!1)}i.onMounted(()=>{window.addEventListener("click",p,!0)}),i.onBeforeUnmount(()=>{window.removeEventListener("click",p,!0)});function h(x){return x==="xy"?"Координати":x==="parcel"?"Кадастр":"Адреси"}function m(x){const w=x.replace(/[,]+/g," ").trim();if(!w)return null;const S=w.split(/\s+/).filter(Boolean);if(S.length<2)return null;const E=S.slice(0,2).map(Number);if(!E.every(Y=>Number.isFinite(Y)))return null;let[T,D]=E,U=T,B=D;const A=Y=>Math.abs(Y)<=90,j=Y=>Math.abs(Y)<=180;if(!A(U)||!j(B))if(A(B)&&j(U))U=D,B=T;else return null;return{lat:U,lng:B}}function g(x){return(x?.items||[]).map((w,S)=>({id:String(w?.id??S),title:w?.title||w?.address?.label||"Знайдений обʼєкт",lat:Number(w?.position?.lat),lng:Number(w?.position?.lng)})).filter(w=>Number.isFinite(w.lat)&&Number.isFinite(w.lng))}function y(x){const w=x?.result||x?.data||x;if(!w)return[];const S=w.geom_centroid;if(!S||!Array.isArray(S.coordinates))return[];const[E,T]=S.coordinates;return!Number.isFinite(T)||!Number.isFinite(E)?[]:[{id:"parcel",title:w.cadnum||w.cad_num||"Земельна ділянка",lat:T,lng:E}]}function b(x){const w=x.replace(/\s+/g,"").split(":");if(w.length!==4)return!1;const S=[10,2,3,4];return w.every((E,T)=>E.length===S[T]&&/^\d+$/.test(E))}function k(x){r("goToCoordinates",[x.lat,x.lng])}async function C(){const x=c.value.trim();if(x){if(a.value==="xy"){const w=m(x);if(!w){Ie({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}k(w),c.value="";return}try{const w=new URL(a.value==="here"?IM:DM);if(a.value==="here")w.searchParams.set("searchtext",x);else{if(!b(x)){Ie({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}w.searchParams.set("cad_num",x)}const S=await fetch(w.toString());if(!S.ok)throw new Error(`HTTP ${S.status}`);const E=await S.json(),T=a.value==="here"?g(E):y(E);if(!T.length)Ie({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const D=T[0];k(D),c.value=""}}catch(w){const S=w?.message||"Помилка пошуку";Ie({type:"error",title:"Пошук",message:S})}}}return(x,w)=>(i.openBlock(),i.createElementBlock("div",AM,[i.createElementVNode("form",{class:"flex gap-2",onSubmit:i.withModifiers(C,["prevent"])},[s.value.length>1?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:u,class:"relative search-type w-[140px]"},[i.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:w[0]||(w[0]=S=>d.value=!d.value)},[i.createElementVNode("span",null,i.toDisplayString(h(a.value)),1),(i.openBlock(),i.createElementBlock("svg",{class:i.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"},w[2]||(w[2]=[i.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)]),2))]),d.value?(i.openBlock(),i.createElementBlock("div",BM,[i.createElementVNode("ul",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.value,S=>(i.openBlock(),i.createElementBlock("li",{key:S,class:"px-3 py-2 cursor-pointer hover:bg-gray-100",onClick:E=>f(S)},i.toDisplayString(h(S)),9,VM))),128))])])):i.createCommentVNode("",!0)],512)):i.createCommentVNode("",!0),i.createElementVNode("div",LM,[i.withDirectives(i.createElementVNode("input",{"onUpdate:modelValue":w[1]||(w[1]=S=>c.value=S),placeholder:l.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,OM),[[i.vModelText,c.value,void 0,{trim:!0}]]),w[3]||(w[3]=i.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[i.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"},[i.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)]))}}),FM=ge(RM,[["__scopeId","data-v-3048520a"]]),PM={class:"bg-white/30 p-1 rounded-md shadow"},$M={class:"flex gap-2"},zM=["onClick","title"],HM=["src"],jM=i.defineComponent({__name:"map-layers",props:{basemaps:{}},emits:["onLayerChange"],setup(n,{emit:e}){const t=i.ref(Object.keys(n.basemaps)[0]),r=e;function o(s){r("onLayerChange",s),t.value=s}return(s,l)=>(i.openBlock(),i.createElementBlock("div",PM,[i.createElementVNode("div",$M,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(s.basemaps,(a,c)=>(i.openBlock(),i.createElementBlock("div",{key:c,class:i.normalizeClass(["cursor-pointer border rounded-lg overflow-hidden hover:shadow-sm",{"ring-2 ring-blue-500 border-blue-300":t.value===c}]),onClick:d=>o(c),title:a.name||c,role:"button",tabindex:"0"},[i.createElementVNode("img",{src:a.preview,alt:"",class:"w-10 h-10 object-cover"},null,8,HM)],10,zM))),128))])]))}}),UM={key:0,class:"absolute inset-0 z-[2000] flex items-center justify-center pointer-events-none bg-black/20"},WM={class:"bg-black/50 text-white px-6 py-2 rounded-lg text-center max-w-sm mx-4 backdrop-blur-sm"},KM={class:"text-sm font-medium"},qM={key:0,class:"absolute top-4 left-4 z-[1000] w-[calc(100%-20px)] sm:w-[350px]"},GM={key:1,class:"form-geom__panel flex gap-1 items-start mt-2"},JM={class:"flex items-center gap-1"},YM=["disabled"],XM=["disabled"],ZM=["disabled"],QM={class:"absolute top-4 right-4 z-[1000]"},eT={class:"flex flex-col gap-[2px]"},tT=["disabled"],nT=["disabled"],rT=["disabled"],oT=["disabled"],sT={class:"flex flex-col gap-2"},lT={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]"},iT={class:"flex flex-col gap-1"},aT=["checked","disabled","onChange"],cT={class:"text-gray-700 text-xs font-medium"},dT={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"},uT={key:0,class:"form-geom__feature flex items-center text-xs transition-all gap-2 w-full"},fT={class:"shrink-0"},pT={class:"font-bold"},hT={class:"flex items-center"},mT={class:"text-xs mr-2"},gT={key:0,class:"text-xs"},yT={key:1,class:"text-xs"},bT=["disabled"],kT=["disabled"],xT=i.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=i.getCurrentInstance(),r=n,o=e,s=i.computed(()=>{const v={search:!1,import:!1,export:!1,point:!1,line:!1,polygon:!1,rectangle:!1};if(!r.tools||!r.tools.length)return v;const M=new Set(r.tools.map(H=>H.toLowerCase()));return{search:M.has("search"),import:M.has("import"),export:M.has("export"),point:M.has("point"),line:M.has("line"),polygon:M.has("polygon"),rectangle:M.has("rectangle")}}),l=i.computed(()=>!!r.disabled),a=i.ref(!1),c=i.ref(null),d=i.ref(null),u=i.ref(!1),f=i.ref(""),p=i.reactive({}),h=i.ref([]),m=i.computed(()=>h.value.map(v=>p[v]).filter(v=>!!v)),g=i.computed(()=>Array.isArray(r.layers)&&r.layers.some(v=>`${v?.service??""}`.toLowerCase()==="vtile"));let y,b,k;function C(){return navigator.platform.toUpperCase().indexOf("MAC")>=0,/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"Використовуйте два пальці для зуму карти.":"Використовуйте Ctrl + прокрутка для зуму карти."}const x=i.ref(null),w=i.ref(null);let S=null;const E=i.ref(null),T=v=>{v.ctrlKey&&v.preventDefault()};function D(v,M){return v?.id?String(v.id):v?.url?`${v.url}-${M}`:`layer-${M}`}function U(v){if(!v)return"";if(/^https?:\/\//i.test(v))return v.replace(/\/+$/,"");const M=v.replace(/^\/+/,"").replace(/\/+$/,"");return M?`/${M}`:""}function B(v){const M=v?.url??"";if(!M||/^https?:\/\//i.test(M))return M;const H=typeof window<"u"&&window.location?.origin?window.location.origin:"";if(M.startsWith("/"))return H?`${H}${M}`:M;const G=U(v?.prefix),Q=U(r.prefix),fe=G||Q,V=M.replace(/^\/+/,""),F=fe?`${fe.replace(/\/$/,"")}/${V}`:`/${V}`;return H?`${H}${F}`:F}function A(v){const M=v?.style??{};return H=>{const G=M.colorAttr,Q=M.colorSet??{},fe=typeof G=="string"?Q?.[H?.[G]]??M.color??"#3388ff":M.color??"#3388ff",V=M.stroke??fe;return{weight:M.width??1,color:V,opacity:M.opacity??1,fill:M.type?M.type!=="polyline":!0,fillColor:fe,fillOpacity:M.opacity??.5}}}function j(v){const M=v?.colorSet||v?.colors;if(v?.colorAttr&&M){const H=Object.entries(M).flat();return["match",["get",v.colorAttr],...H,v.color??"#94a3b8"]}return v?.color??"#3388ff"}function Y(v,M,H){if(!v)return[];const G=[],Q=j(v);return v.icon&&G.push({id:`${M}-icon`,type:"symbol",source:M,"source-layer":H,minzoom:v.iconZoom||0,layout:{"icon-image":v.icon,"icon-size":1,"icon-allow-overlap":!0,"icon-ignore-placement":!0}}),v.pointZoom&&G.push({id:`${M}-point`,type:"circle",source:M,"source-layer":H,maxzoom:v.pointZoom,paint:{"circle-stroke-color":v.stroke||"#fff","circle-opacity":v.opacity??1,"circle-color":Q,"circle-stroke-width":v.width??1,"circle-radius":v.radius??5}}),v.type==="polygon"?G.push({id:`${M}-fill`,type:"fill",source:M,"source-layer":H,minzoom:v.pointZoom||0,paint:{"fill-color":Q,"fill-opacity":v.opacity??.5,"fill-outline-color":v.stroke||Q}}):v.type==="line"?G.push({id:`${M}-line`,type:"line",source:M,"source-layer":H,paint:{"line-color":Q,"line-opacity":v.opacity??1,"line-width":v.width??1.5}}):v.icon||G.push({id:`${M}-circle`,type:"circle",source:M,"source-layer":H,paint:{"circle-stroke-color":v.stroke||"#fff","circle-opacity":v.opacity??1,"circle-color":Q,"circle-stroke-width":v.width??1,"circle-radius":v.radius??5}}),G}function z(v,M){const H=v.id||`source-${Math.random().toString(36).slice(2,8)}`,G=v.sourceLayer||v.layer||v.service_layer||v.service_key||v.map_key||v.dataset?.layer||v.id||v.table_name||H,Q=Y(v.style||{},H,G||H);return Q.length?{version:8,glyphs:"https://demotiles.maplibre.org/font/{fontstack}/{range}.pbf",sources:{[H]:{type:"vector",tiles:[M],minzoom:v.minzoom??0,maxzoom:v.maxzoom??19}},layers:Q}:null}function K(v){const M=(v?.service??"").toLowerCase(),H=B(v),G=v.sourceLayer||v.layer||v.service_layer||v.service_key||v.map_key||v.dataset?.layer||v.id||v.table_name;if(console.info("[vs-input-map] create overlay layer",{id:v.id,service:M,url:H,sourceLayer:G,hasSourceLayer:!!G}),M==="vtile"){if(L?.vectorGrid?.protobuf&&!L?.maplibreGL)return console.info("[vs-input-map] using Leaflet.vectorGrid"),L.vectorGrid.protobuf(H,{interactive:!0,vectorTileLayerStyles:{default:A(v)}});if(L?.maplibreGL&&window?.maplibregl){console.info("[vs-input-map] using maplibre-gl-leaflet");const Q=z(v,H);return Q?L.maplibreGL({style:Q,interactive:!1,pane:"overlayPane"}):(console.warn("[vs-input-map] maplibre spec is empty",v.id),null)}return null}return M==="tile"||/^https?:\/\//i.test(H)||H.includes("{z}")?L.tileLayer(H,{opacity:v?.style?.opacity??1}):L.tileLayer(H,{opacity:v?.style?.opacity??1})}function q(){y&&h.value.forEach(v=>{const M=p[v];M&&(M.visible?(M.layer||(M.layer=K(M.config)),M.layer&&!y.hasLayer(M.layer)?(console.info("[vs-input-map] add overlay layer to map",M.id),M.layer.addTo(y)):M.layer||console.warn("[vs-input-map] overlay layer is null",M.id)):M.layer&&y.hasLayer(M.layer)&&(console.info("[vs-input-map] remove overlay layer from map",M.id),y.removeLayer(M.layer)))})}function re(v){if(l.value)return;const M=p[v];M&&(M.visible=!M.visible,y&&(console.info("[vs-input-map] toggle overlay",{id:v,nextVisible:M.visible,hasLayerInstance:!!M.layer}),M.visible?(M.layer||(M.layer=K(M.config)),M.layer&&!y.hasLayer(M.layer)&&(console.info("[vs-input-map] add overlay layer to map",M.id),M.layer.addTo(y))):M.layer&&y.hasLayer(M.layer)&&y.removeLayer(M.layer)))}function se(){if(!r.handleZoom)return null;let v;const M=G=>{const Q=G.ctrlKey||G.metaKey,fe=G.shiftKey;if(!Q&&!fe){u.value=!0,f.value=C(),clearTimeout(v),v=window.setTimeout(()=>{u.value=!1},1e3);return}u.value=!1,y.scrollWheelZoom.enable(),setTimeout(()=>{y.scrollWheelZoom.disable()},100)},H=G=>{if(G.touches.length===1){u.value=!0,f.value=C(),clearTimeout(v),v=window.setTimeout(()=>{u.value=!1},3e3);return}u.value=!1};return w.value&&(w.value.addEventListener("wheel",M,{passive:!1}),w.value.addEventListener("touchstart",H,{passive:!0})),y&&y.on("wheel",G=>{const Q=G.originalEvent.ctrlKey||G.originalEvent.metaKey,fe=G.originalEvent.shiftKey;!Q&&!fe&&(G.originalEvent.preventDefault(),G.originalEvent.stopPropagation())}),()=>{w.value&&(w.value.removeEventListener("wheel",M),w.value.removeEventListener("touchstart",H)),y&&y.off("wheel"),clearTimeout(v)}}const ve=i.ref(null),pt=i.ref(6),St=i.ref(0),Ft=i.ref(t?.appContext.config.globalProperties.$settings?.center||[50,30]),Ke=i.ref(null),ht=P();let En;const Cn=i.ref("topo100");function vn(v){return v?v.type==="Polygon"?{type:"MultiPolygon",coordinates:[v.coordinates]}:(v.type,v):null}function xr(){return new Promise((v,M)=>{window.L&&window.L.Draw&&v(0);const H=fe=>{if(Array.from(document.styleSheets).some(F=>F?.href?.includes(fe)))return;const V=document.createElement("link");V.rel="stylesheet",V.href=fe,document.head.appendChild(V)},G=fe=>new Promise((V,F)=>{const W=Array.from(document.scripts).find(_e=>_e.src===fe);if(W){W.addEventListener("load",()=>V()),W.addEventListener("error",_e=>F(_e));return}const ae=document.createElement("script");ae.src=fe,ae.async=!0,ae.onload=()=>V(),ae.onerror=_e=>F(_e),document.body.appendChild(ae)});H("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),H("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css"),g.value&&H("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.css");let Q=G("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").then(()=>G("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js"));g.value?Q=Q.then(()=>G("https://unpkg.com/maplibre-gl@4.5.0/dist/maplibre-gl.js")).then(()=>(window.maplibregl&&!window.mapboxgl&&(window.mapboxgl=window.maplibregl),G("https://unpkg.com/@maplibre/maplibre-gl-leaflet@0.0.20/leaflet-maplibre-gl.js"))):Q=Q.then(()=>G("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js").catch(()=>Promise.resolve())),Q.then(()=>v(0)).catch(M)})}function mt(){const v=b.toGeoJSON(),M=[];let H=null;const G=fe=>{if(fe)switch(fe.type){case"Point":H=fe;break;case"Polygon":M.push(fe.coordinates);break;case"MultiPolygon":M.push(...fe.coordinates);break;case"GeometryCollection":(fe.geometries||[]).forEach(G);break}};(v?.features||[]).forEach(fe=>G(fe.geometry));const Q=H||(M.length?{type:"MultiPolygon",coordinates:M}:null);o("update:modelValue",Q?vn(Q):null),St.value=b.getLayers().length}function Pt(v=30){const M=b.getLayers();if(!M.length)return;const H=L.featureGroup(M).getBounds();H&&H.isValid()&&y.fitBounds(H,{padding:[v,v]})}function cn(){l.value||E.value?.click()}const qe=i.ref("");i.watch(s,v=>{qe.value&&!Object.entries(v).filter(([M,H])=>H).map(([M])=>M).includes(qe.value)&&(k?.disable&&k.disable(),qe.value="")}),i.watch(()=>r.layers,v=>{const M=Array.isArray(v)?v:[],H=[],G=new Set;M.forEach((Q,fe)=>{if(!Q)return;const V=D(Q,fe);H.push(V),G.add(V),console.info("[vs-input-map] overlay register",{id:V,service:Q?.service,url:Q?.url});const F=p[V];F?p[V]={...F,config:{...Q,id:V}}:p[V]={id:V,config:{...Q,id:V},visible:Q?.overlay!==!1,layer:null}}),Object.keys(p).forEach(Q=>{if(G.has(Q))return;const fe=p[Q];fe?.layer&&y?.hasLayer&&y.hasLayer(fe.layer)&&y.removeLayer(fe.layer),delete p[Q]}),h.value=H,q()},{immediate:!0,deep:!0}),i.watch(l,v=>{v&&k&&(k.disable(),qe.value=""),b&&b.eachLayer(M=>{v?M.dragging?.disable?.():M.dragging?.enable&&(M.dragging.enable(),M.dragging.enabled?.())})});function $t(v){return v instanceof L.Circle?"Circle":v instanceof L.Rectangle?"Rectangle":v instanceof L.Polygon&&!(v instanceof L.Rectangle)?"Polygon":v instanceof L.Polyline&&!(v instanceof L.Polygon)?"Polyline":v instanceof L.Marker?"Point":"Feature"}function qt(v){if(v instanceof L.Circle){const M=v.getRadius();return Math.PI*(M*M)/1e6}if(v instanceof L.Polygon||v instanceof L.Rectangle)try{const M=v.getLatLngs(),H=Array.isArray(M[0])?M[0]:M,G=L.GeometryUtil?.geodesicArea?L.GeometryUtil.geodesicArea(H):0;return G?G/1e6:0}catch{return null}return null}function dn(v){return v instanceof L.Circle?v.getLatLng():v.getBounds?v.getBounds().getCenter():v.getLatLng?v.getLatLng():y.getCenter()}async function Xn(v,M){if(x.value="",!r.api?.length)return;const[H,G]=r.api;try{const Q=new URL(H);Q.searchParams.set("lat",String(v)),Q.searchParams.set("lon",String(M));const fe=await fetch(Q.toString());if(!fe.ok)throw new Error("Request failed");const V=await fe.json();G&&V[G]!==void 0?x.value=String(V[G]):x.value=JSON.stringify(V)}catch(Q){console.error("[vs-input-map] reverse geocode failed:",Q),x.value=null}}function _(){const v=b.getLayers();if(!v.length){Ke.value=null,St.value=0;return}const M=v[v.length-1],H=$t(M),G=dn(M),Q=qt(M);Ke.value={type:H,center:G,areaKm2:Q,layer:M},St.value=v.length,Xn(G.lat,G.lng)}function N(){if(l.value)return;const v=Ke.value?.layer;v&&(v instanceof L.Circle&&v.getBounds?y.fitBounds(v.getBounds(),{padding:[30,30]}):v.getBounds?y.fitBounds(v.getBounds(),{padding:[30,30]}):v.getLatLng&&y.setView(v.getLatLng(),Math.max(pt.value,14)))}function R(){if(l.value)return;const v=Ke.value?.layer;v&&(b.removeLayer(v),mt(),_())}i.onMounted(async()=>{document.addEventListener("wheel",T,{passive:!1}),await xr(),L.drawLocal=aM;const v=r.handleZoom;y=L.map(w.value,{zoomControl:!1,scrollWheelZoom:!v}).setView(Ft.value,10),setTimeout(()=>{S=se()},100),L.control.zoom({position:"bottomright"}).addTo(y),Cn.value=Object.keys(ht)[0],En=L.tileLayer(ht[Cn.value].url,{maxZoom:19,minZoom:6}).addTo(y),b=new L.FeatureGroup().addTo(y),y.on(L.Draw.Event.CREATED,G=>{if(l.value)return;const{layer:Q}=G;b.clearLayers(),b.addLayer(Q),mt(),Pt(),qe.value=""}),y.on(L.Draw.Event.EDITED,()=>{l.value||(mt(),_(),Pt())}),y.on(L.Draw.Event.DELETED,()=>{l.value||(mt(),_(),Pt())});let M=!1;y.on("mousemove",G=>{M||(y.invalidateSize(),M=!0),ve.value=G.latlng}),y.on("zoomend",()=>{pt.value=y.getZoom()});const H=cM(r.modelValue);if(H){const G=[];L.geoJSON(H).eachLayer(Q=>G.push(Q)),G.length&&b.addLayer(G[0]),mt(),_(),Pt()}q()}),i.onUnmounted(()=>{document.removeEventListener("wheel",T),S&&S(),Object.values(p).forEach(v=>{v?.layer&&(y?.hasLayer?.(v.layer)&&y.removeLayer(v.layer),typeof v.layer.remove=="function"&&v.layer.remove())})});function Z(v){if(!l.value&&y){switch(k&&k.disable(),v){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(),qe.value=v)}}function we(){if(l.value)return;const v=b.toGeoJSON(),M=new Blob([JSON.stringify(v,null,2)],{type:"application/json"}),H=URL.createObjectURL(M),G=document.createElement("a");G.href=H,G.download="data.geojson",G.click(),URL.revokeObjectURL(H)}function Be(v){if(l.value)return;const M=v.target,H=M.files?.[0];if(!H)return;const G=new FileReader;G.onload=()=>{if(typeof G.result=="string")try{const Q=JSON.parse(G.result);b.clearLayers(),Q&&L.geoJSON({type:"Feature",geometry:Q}).eachLayer(fe=>{b.addLayer(fe)}),mt(),_(),Pt()}finally{M.value=""}},G.readAsText(H)}function pe(v){y&&(En&&y.removeLayer(En),En=L.tileLayer(ht[v].url,{maxZoom:19,minZoom:6}).addTo(y),Cn.value=v)}function O(v){const M=L.latLng(v[0],v[1]);y.setView(M,13)}i.watch(()=>r.modelValue,v=>{const M=vn(v);if(v&&M!==v){o("update:modelValue",M);return}b.clearLayers(),M&&L.geoJSON({type:"Feature",geometry:M}).eachLayer(H=>{if(b.addLayer(H),l.value){H.dragging?.disable?.();return}H.dragging?.enable?.(),H.dragging?.enabled?.(),H.on("dragend",G=>{const Q=G.target.getLatLng();o("update:modelValue",{type:"Point",coordinates:[Q.lng,Q.lat]})})}),St.value=b.getLayers().length,_(),Pt()});function P(){return t?.appContext.config.globalProperties.$settings?.basemaps?t?.appContext.config.globalProperties.$settings?.basemaps.map((v,M)=>Object.assign(v,{key:`b${M}`,preview:v.preview||v.url.replace("{z}/{x}/{y}.png","13/4790/2762.png")})).reduce((v,M)=>({...v,[M.key]:M}),{}):{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 he=i.ref(!1);return i.watch(he,()=>{setTimeout(()=>{y.invalidateSize()},50)}),i.watch(a,async v=>{if(!v||!d.value){c.value=null;return}await i.nextTick();const M=d.value.getBoundingClientRect();c.value={top:M.bottom+6,left:M.left}}),i.onUnmounted(()=>{a.value=!1,c.value=null}),(v,M)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["leaflet-map-wrapper relative w-full h-[400px]",{fullscreen:he.value}])},[i.createElementVNode("div",{ref_key:"mapContainer",ref:w,class:"w-full h-full"},null,512),i.createVNode(i.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:i.withCtx(()=>[u.value&&r.handleZoom?(i.openBlock(),i.createElementBlock("div",UM,[i.createElementVNode("div",WM,[i.createElementVNode("p",KM,i.toDisplayString(f.value),1)])])):i.createCommentVNode("",!0)]),_:1}),s.value.search||s.value.import||s.value.export?(i.openBlock(),i.createElementBlock("div",qM,[s.value.search?(i.openBlock(),i.createBlock(FM,{key:0,onGoToCoordinates:O})):i.createCommentVNode("",!0),s.value.import||s.value.export?(i.openBlock(),i.createElementBlock("div",GM,[i.createElementVNode("div",JM,[s.value.import?(i.openBlock(),i.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:cn,disabled:l.value}," Import ",8,YM)):i.createCommentVNode("",!0),s.value.export?(i.openBlock(),i.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:we,disabled:l.value||St.value===0}," Export ",8,XM)):i.createCommentVNode("",!0)]),i.createElementVNode("input",{ref_key:"importRef",ref:E,type:"file",onChange:Be,accept:".json,.geojson",class:"hidden",disabled:l.value},null,40,ZM)])):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),i.createElementVNode("div",QM,[i.createElementVNode("div",eT,[s.value.point?(i.openBlock(),i.createElementBlock("button",{key:0,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="marker"}]),title:"Point",onClick:M[0]||(M[0]=H=>Z("marker")),disabled:l.value},[i.createVNode(pM)],10,tT)):i.createCommentVNode("",!0),s.value.line?(i.openBlock(),i.createElementBlock("button",{key:1,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="polyline"}]),title:"Line",onClick:M[1]||(M[1]=H=>Z("polyline")),disabled:l.value},[i.createVNode(yM)],10,nT)):i.createCommentVNode("",!0),s.value.polygon?(i.openBlock(),i.createElementBlock("button",{key:2,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="polygon"}]),title:"Polygon",onClick:M[2]||(M[2]=H=>Z("polygon")),disabled:l.value},[i.createVNode(wM)],10,rT)):i.createCommentVNode("",!0),s.value.rectangle?(i.openBlock(),i.createElementBlock("button",{key:3,class:i.normalizeClass(["vs-btn",{"vs-active":qe.value==="rectangle"}]),title:"Rectangle",onClick:M[3]||(M[3]=H=>Z("rectangle")),disabled:l.value},[i.createVNode(_M)],10,oT)):i.createCommentVNode("",!0),i.createElementVNode("button",{class:"vs-btn mt-5",onClick:M[4]||(M[4]=H=>he.value=!he.value),title:"Full Screen"},[i.createVNode(TM,{style:{width:"12px",height:"12px"}})])])]),i.createElementVNode("div",{class:i.normalizeClass(["absolute left-4 z-[1000]",Ke.value?"bottom-8":"bottom-4"])},[i.createElementVNode("div",sT,[i.createVNode(jM,{basemaps:i.unref(ht),onOnLayerChange:pe},null,8,["basemaps"]),m.value.length?(i.openBlock(),i.createElementBlock("div",lT,[M[9]||(M[9]=i.createElementVNode("p",{class:"font-semibold text-[11px] uppercase tracking-wide text-gray-500 mb-2"},"Layers",-1)),i.createElementVNode("div",iT,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(m.value,H=>(i.openBlock(),i.createElementBlock("label",{key:H.id,class:"flex items-center gap-2 cursor-pointer select-none"},[i.createElementVNode("input",{type:"checkbox",class:"rounded border-gray-300 text-blue-600 focus:ring-blue-500",checked:H.visible,disabled:l.value,onChange:G=>re(H.id)},null,40,aT),i.createElementVNode("span",cT,i.toDisplayString(H.config.title||H.config.name||H.id),1)]))),128))])])):i.createCommentVNode("",!0)])],2),i.createElementVNode("div",dT,[Ke.value?(i.openBlock(),i.createElementBlock("div",uT,[i.createElementVNode("div",{class:"mr-auto flex items-center gap-2 min-w-0 relative",onMouseenter:M[5]||(M[5]=H=>a.value=!0),onMouseleave:M[6]||(M[6]=H=>a.value=!1)},[i.createElementVNode("div",fT,[M[10]||(M[10]=i.createTextVNode(" Type: ",-1)),i.createElementVNode("span",pT,i.toDisplayString(Ke.value.type),1)]),x.value?(i.openBlock(),i.createElementBlock("div",{key:0,ref_key:"addressEl",ref:d,class:"text-gray-500 text-xs truncate cursor-help",style:{"max-width":"260px"}}," Address: "+i.toDisplayString(x.value),513)):i.createCommentVNode("",!0),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[a.value&&x.value&&c.value?(i.openBlock(),i.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:i.normalizeStyle({top:c.value.top+"px",left:c.value.left+"px"})},i.toDisplayString(x.value),5)):i.createCommentVNode("",!0)]))],32),i.createElementVNode("div",hT,[i.createElementVNode("div",mT,[M[11]||(M[11]=i.createTextVNode(" Center: ",-1)),i.createElementVNode("b",null,i.toDisplayString(Ke.value.center.lat.toFixed(5))+", "+i.toDisplayString(Ke.value.center.lng.toFixed(5)),1)]),Ke.value.areaKm2!==null?(i.openBlock(),i.createElementBlock("div",gT,[M[12]||(M[12]=i.createTextVNode(" Area: ",-1)),i.createElementVNode("b",null,i.toDisplayString(Ke.value.areaKm2.toFixed(1))+" km²",1)])):(i.openBlock(),i.createElementBlock("div",yT,M[13]||(M[13]=[i.createTextVNode("Area: ",-1),i.createElementVNode("b",null,"—",-1)]))),i.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:M[7]||(M[7]=H=>N()),disabled:l.value},M[14]||(M[14]=[i.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,bT),i.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:M[8]||(M[8]=H=>R()),disabled:l.value},[i.createVNode(kl,{class:"w-3 h-3"})],8,kT)])])):i.createCommentVNode("",!0)])],2))}}),wT=ge(xT,[["__scopeId","data-v-150e767b"]]),ET=["data-focus"],CT={class:"flex items-center"},vT={class:"overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-[#333] text-[85%] px-0.5 py-[3px] pl-1.5 box-border"},_T=["onClick","aria-label"],ST={key:0,class:"absolute text-gray-500 truncate pl-2"},NT={class:"flex-1 min-w-[2px]"},MT=["placeholder"],TT={class:"flex items-center shrink-0"},AT=["disabled"],BT=i.defineComponent({__name:"vs-input-tag",props:i.mergeModels({unique:{type:Boolean,default:!0},style:{default:()=>({})},customClass:{default:""},disabled:{type:Boolean,default:!1},modelValue:{},error:{},name:{},placeholder:{default:"Введіть тег"}},{modelValue:{default:[]},modelModifiers:{}}),emits:i.mergeModels(["update:modelValue"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=e;vt(t.style);const o=i.ref(null),s=i.ref(null),l=i.ref(null),a=i.ref(!1),c=i.ref(""),d=i.useModel(n,"modelValue"),u=i.computed(()=>t.placeholder||"Add tag…"),f=i.computed(()=>d.value?.length===0&&c.value===""),p=i.computed(()=>!t.disabled&&d.value?.length>0),h=i.computed(()=>t.disabled),m=async()=>{h.value||await i.nextTick(()=>l.value?.focus())},g=S=>{const E=S.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 S=c.value;S.trim()!==""&&g(S),c.value=""},b=S=>{const E=d.value.slice();E.splice(S,1),r("update:modelValue",E)},k=()=>{r("update:modelValue",[])},C=()=>{h.value||(a.value=!0)},x=()=>{a.value=!1,!h.value&&y()},w=S=>{const{key:E}=S;E==="Enter"?(S.preventDefault(),y()):E==="Backspace"&&c.value===""&&d.value.length>0&&b(d.value.length-1)};return(S,E)=>(i.openBlock(),i.createElementBlock("div",{class:"flex gap-1 w-full",ref_key:"root",ref:o,onClick:E[1]||(E[1]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:i.normalizeClass(["relative w-full font-sans",t.customClass]),role:"group","aria-label":"Tag input"},[i.createElementVNode("div",{class:i.normalizeClass(["flex min-h-[38px] items-center justify-between rounded border transition-colors bg-white","border-gray-300 hover:border-gray-400",a.value?"border-blue-500 ring-1 ring-blue-500":"",h.value?"bg-gray-100 text-gray-400 cursor-not-allowed hover:border-gray-300":""]),"data-focus":a.value?"true":"false",onClick:m},[i.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:s},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(d.value,(T,D)=>(i.openBlock(),i.createElementBlock("div",{key:D,class:"flex min-w-0 bg-[#e6e6e6] rounded-sm m-0.5 box-border"},[i.createElementVNode("div",CT,[i.createElementVNode("div",vT,i.toDisplayString(T),1)]),i.createElementVNode("div",{role:"button",class:"flex items-center rounded-sm px-1 box-border hover:bg-[#ffbdad] hover:text-[#de350b]",onClick:i.withModifiers(U=>b(D),["stop"]),"aria-label":`Remove ${T}`},E[2]||(E[2]=[i.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"},[i.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,_T)]))),128)),f.value?(i.openBlock(),i.createElementBlock("div",ST,i.toDisplayString(u.value),1)):i.createCommentVNode("",!0),i.createElementVNode("div",NT,[h.value?i.createCommentVNode("",!0):i.withDirectives((i.openBlock(),i.createElementBlock("input",{key:0,ref_key:"inputRef",ref:l,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]=T=>c.value=T),onFocus:C,onBlur:x,onKeydown:w,placeholder:d.value&&d.value.length?"":void 0},null,40,MT)),[[i.vModelText,c.value]])])],512),i.createElementVNode("div",TT,[p.value?(i.openBlock(),i.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:h.value,onClick:i.withModifiers(k,["stop"])},E[3]||(E[3]=[i.createElementVNode("svg",{height:"20",width:"20",viewBox:"0 0 20 20",class:"fill-current"},[i.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,AT)):i.createCommentVNode("",!0)])],10,ET)],2)],512))}}),VT={class:"relative flex gap-1 bg-white w-full"},LT=["disabled","placeholder"],OT=i.defineComponent({__name:"vs-input-slug",props:i.mergeModels({disabled:{type:Boolean},placeholder:{},parent:{}},{modelValue:{default:""},modelModifiers:{}}),emits:["update:modelValue"],setup(n){const e=i.inject("values"),t=n,r=i.useModel(n,"modelValue");function o(l){const a={а:"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 l.toLowerCase().split("").map(c=>a[c]||c).join("").replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}const s=()=>{const l=e?.value?.[t.parent||""]?.toString(),a=o(l);r.value=a.toString()};return(l,a)=>(i.openBlock(),i.createElementBlock("div",VT,[i.withDirectives(i.createElementVNode("input",{ref:"vsText",disabled:l.disabled,placeholder:l.placeholder,"onUpdate:modelValue":a[0]||(a[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,LT),[[i.vModelText,r.value]]),i.createElementVNode("button",{class:"px-2 bg-gray-100 border rounded-lg hover:bg-gray-200",onClick:s}," Gen ")]))}}),IT=ge(OT,[["__scopeId","data-v-b0eba370"]]),DT={class:"relative flex gap-1 bg-white w-full"},RT=["disabled","placeholder"],FT=["disabled"],PT={key:0},$T={key:1},zT=i.defineComponent({__name:"vs-input-codegen",props:i.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=i.useModel(n,"modelValue"),r=i.ref(!1),o=i.computed(()=>e.init!==!1),s=i.computed(()=>!!e.table&&!!e.code),l=()=>{if(!s.value)return"";const d=encodeURIComponent(String(e.table)),u=encodeURIComponent(String(e.code));return`/api/code-gen/${d}/${u}`},a=async()=>{if(!s.value||r.value)return;const d=l();if(d){r.value=!0;try{const u=await(await fetch(d)).text();t.value=u}finally{r.value=!1}}},c=()=>{o.value&&(t.value||a())};return i.onMounted(()=>{c()}),i.watch(()=>[e.table,e.code,e.init],()=>{c()}),(d,u)=>(i.openBlock(),i.createElementBlock("div",DT,[i.withDirectives(i.createElementVNode("input",{disabled:d.disabled,placeholder:d.placeholder,"onUpdate:modelValue":u[0]||(u[0]=f=>t.value=f),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,RT),[[i.vModelText,t.value]]),i.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||!s.value,onClick:a},[r.value?(i.openBlock(),i.createElementBlock("span",$T,"...")):(i.openBlock(),i.createElementBlock("span",PT,"Gen"))],8,FT)]))}}),HT=ge(zT,[["__scopeId","data-v-6ee5237d"]]),jT={class:"w-full"},UT={ref:"sortableContainer",class:"flex flex-col gap-1"},WT=["onDragstart","onDrop"],KT={class:"w-1/3"},qT={class:"w-2/3"},GT=["onClick"],JT={key:0,class:"text-[14px] text-gray-700"},YT={class:"mt-2 w-full flex items-center"},XT=["disabled"],ZT=i.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=i.inject("values"),o=n,s=e,l=o.addButtonText??"Додати",a=o.ignore??[],c=i.ref([]),d=i.ref(null);(()=>{const g=o.parent&&r?.value?.[o.parent]||o.modelValue||{};c.value=Object.entries(g).filter(([y])=>!a.includes(y)).map(([y,b])=>({id:t("key-value-"),key:y,value:b}))})();function u(g){d.value=g}function f(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 p=i.computed(()=>c.value.some(g=>g.key&&!g.value||!g.key&&g.value)),h=()=>{c.value.push({id:t("key-value-"),key:"",value:""})},m=g=>{c.value=c.value.filter(y=>y.id!==g)};return i.watch(c,g=>{const y={};g.forEach(k=>{k.key&&k.value!==void 0&&(y[k.key]=k.value)});const b={};a.length&&a.forEach(k=>{b[k]=o.parent?r?.value?.[o.parent]?.[k]:void 0}),r?.value&&o.parent&&(r.value[o.parent]={...b,...y}),s("update:modelValue",y)},{deep:!0}),(g,y)=>(i.openBlock(),i.createElementBlock("div",jT,[i.createElementVNode("div",UT,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.value,(b,k)=>(i.openBlock(),i.createElementBlock("div",{key:b.id,class:i.normalizeClass(["flex items-center gap-2 w-full",{"opacity-50":d.value===k}]),draggable:"true",onDragstart:C=>u(k),onDragover:y[0]||(y[0]=i.withModifiers(()=>{},["prevent"])),onDrop:C=>f(k)},[y[1]||(y[1]=i.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)),i.createElementVNode("div",KT,[i.createVNode(bl,{modelValue:b.key,"onUpdate:modelValue":C=>b.key=C,placeholder:"Ключ"},null,8,["modelValue","onUpdate:modelValue"])]),i.createElementVNode("div",qT,[i.createVNode(bl,{modelValue:b.value,"onUpdate:modelValue":C=>b.value=C,placeholder:"Значення"},null,8,["modelValue","onUpdate:modelValue"])]),i.createElementVNode("button",{onClick:C=>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"},[i.createVNode(i.unref(yv),{height:"16",width:"16"})],8,GT)],42,WT))),128))],512),c.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("span",JT," Дані для відображення відсутні ")),i.createElementVNode("div",YT,[i.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"},[i.createVNode(To,{height:"14",width:"14"}),i.createTextVNode(" "+i.toDisplayString(i.unref(l)),1)],8,XT)])]))}}),QT=ge(ZT,[["__scopeId","data-v-a0f7fbfc"]]),eA={class:"flex items-center gap-2 w-full"},tA=["disabled"],nA=["disabled"],rA=i.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}=vt(t.style),o=e,s=i.computed({get:()=>t.modelValue||"#000000",set:a=>o("update:modelValue",a)}),l=i.computed(()=>!!t.disabled);return(a,c)=>(i.openBlock(),i.createElementBlock("div",eA,[i.withDirectives(i.createElementVNode("input",{type:"color","onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),disabled:l.value,ref:"color",class:i.normalizeClass(["py-1.5 px-1 block w-full bg-white cursor-pointer max-w-[50px]",[a.modelValue?"":"text-opacity-50",i.unref(r)].join(" ")]),style:{border:"1px solid #CFD9E0"}},null,10,tA),[[i.vModelText,s.value]]),i.withDirectives(i.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=>s.value=d),disabled:l.value},null,8,nA),[[i.vModelText,s.value]])]))}}),oA={class:"flex items-center gap-2 w-full"},sA=["min","max","step","disabled"],lA=["disabled"],iA=i.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}=vt(t.style),o=e,s=i.computed({get:()=>Number(t.modelValue??t.min),set:a=>o("update:modelValue",Number(a))}),l=i.computed(()=>!!t.disabled);return(a,c)=>(i.openBlock(),i.createElementBlock("div",oA,[i.withDirectives(i.createElementVNode("input",{type:"range","onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),min:a.min,max:a.max,step:a.step,disabled:l.value,ref:"range",class:i.normalizeClass(["w-full cursor-pointer accent-blue-500",[a.modelValue?"":"text-opacity-50",i.unref(r)].join(" ")])},null,10,sA),[[i.vModelText,s.value]]),i.withDirectives(i.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=>s.value=d),disabled:l.value},null,8,lA),[[i.vModelText,s.value]])]))}}),aA=["type","value","onInput","placeholder","disabled"],cA=i.defineComponent({__name:"vs-input-array",props:i.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}=vt(e.style),r=i.useModel(n,"modelValue"),o=i.computed(()=>!!e.disabled),s=i.computed(()=>e.placeholder??"");i.watchEffect(()=>{const a=r.value?.length??0;a<e.count&&(r.value=[...r.value??[],...Array(e.count-a)])});function l(a,c){if(o.value)return;const d=a.target.value,u=[...r.value];u[c]=e.inputType==="text"?d:Number(d),r.value=u}return(a,c)=>(i.openBlock(),i.createElementBlock("div",{class:i.normalizeClass(["grid gap-2",`grid-cols-${a.limit}`])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(a.count,d=>(i.openBlock(),i.createElementBlock("input",{type:a.inputType,value:r.value?.[d-1]??"",onInput:u=>l(u,d-1),placeholder:s.value,disabled:o.value,class:i.normalizeClass(["py-1.5 px-3 block w-full placeholder:text[#767f8f] bg-white",[i.unref(t),{"!border-red-600":a.error}]]),style:{border:"1px solid #CFD9E0"}},null,42,aA))),256))],2))}}),dA={class:"flex items-center gap-2 w-full"},uA={class:"relative flex-1"},fA=["placeholder","disabled","onKeydown"],pA=["disabled"],hA={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"},mA={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"},gA={key:0,class:"fixed inset-0 z-50 flex items-center justify-center bg-black/50"},yA={class:"bg-white text-gray-900 rounded-lg shadow-lg w-[480px] max-h-[80vh] overflow-y-auto"},bA={class:"p-3 border-b font-semibold text-gray-900 flex justify-between items-center"},kA=["onClick"],xA={key:0,class:"p-4 text-sm text-gray-500"},wA=i.defineComponent({__name:"vs-input-address",props:i.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:i.mergeModels(["update:modelValue","update:geom"],["update:modelValue"]),setup(n,{emit:e}){const t=n,r=e,{inputClass:o}=vt(t.style),s=i.useModel(n,"modelValue"),l=i.computed({get:()=>s.value,set:b=>{s.value=b}}),a=i.ref(!1),c=i.ref([]),d=i.ref(!1),u=i.computed(()=>t.placeholder??""),f=i.computed(()=>!!t.disabled),p=i.inject("values");function h(){!f.value&&l.value.trim()&&m()}async function m(){const b=(l.value||"").trim();if(!b)return;let k=b;if(t.includes?.length&&p?.value){const x=t.includes.map(w=>p.value?.[w]).filter(Boolean);x.length&&(k=`${x.join(", ")}, ${b}`)}const C=t.api.replace("{{value}}",encodeURIComponent(k));a.value=!0;try{const x=await(await fetch(C)).json();c.value=Array.isArray(x)?x:[],d.value=!0}catch(x){console.error("Address search error:",x)}finally{a.value=!1}}function g(){d.value=!d.value}function y(b){if(!b)return;d.value=!1;const k=parseFloat(b.lat),C={type:"Point",coordinates:[parseFloat(b.lon),k]};t.geom&&p?.value&&(p.value[t.geom]=C),r("update:geom",C)}return(b,k)=>(i.openBlock(),i.createElementBlock("div",dA,[i.createElementVNode("div",uA,[i.withDirectives(i.createElementVNode("input",{type:"text","onUpdate:modelValue":k[0]||(k[0]=C=>l.value=C),placeholder:u.value,disabled:f.value,class:i.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",[i.unref(o),{"!border-red-600":t.error}]]),style:{border:"1px solid #CFD9E0"},onKeydown:i.withKeys(i.withModifiers(h,["prevent"]),["enter"])},null,42,fA),[[i.vModelText,l.value]]),c.value.length?(i.openBlock(),i.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]=[i.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"},[i.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),i.createElementVNode("path",{d:"M12 16v-4"}),i.createElementVNode("path",{d:"M12 8h.01"})],-1)]))):i.createCommentVNode("",!0)]),i.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:a.value||!l.value?.trim()},[a.value?(i.openBlock(),i.createElementBlock("svg",mA,k[4]||(k[4]=[i.createElementVNode("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),i.createElementVNode("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4a4 4 0 00-4 4H4z"},null,-1)]))):(i.openBlock(),i.createElementBlock("svg",hA,k[3]||(k[3]=[i.createElementVNode("circle",{cx:"11",cy:"11",r:"8"},null,-1),i.createElementVNode("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"},null,-1)])))],8,pA),(i.openBlock(),i.createBlock(i.Teleport,{to:"body"},[d.value?(i.openBlock(),i.createElementBlock("div",gA,[i.createElementVNode("div",yA,[i.createElementVNode("div",bA,[k[6]||(k[6]=i.createElementVNode("span",null,"Search results",-1)),i.createElementVNode("button",{class:"text-gray-500 hover:text-blue-600",onClick:k[1]||(k[1]=C=>d.value=!1),title:"Close"},k[5]||(k[5]=[i.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"},[i.createElementVNode("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),i.createElementVNode("line",{x1:"6",y1:"6",x2:"18",y2:"18"})],-1)]))]),i.createElementVNode("ul",null,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(c.value,(C,x)=>(i.openBlock(),i.createElementBlock("li",{key:x,onClick:w=>y(C),class:"px-3 py-2 cursor-pointer hover:bg-gray-100 border-b text-sm"},i.toDisplayString(C.display_name),9,kA))),128))]),c.value.length?i.createCommentVNode("",!0):(i.openBlock(),i.createElementBlock("div",xA," No results found "))])])):i.createCommentVNode("",!0)]))]))}}),EA={VsInputText:bl,VsInputRadio:Kp,"vs-input-text":bl,"vs-input-password":WC,"vs-input-textarea":eN,"vs-input-mask":Mv,"vs-input-number":GC,"vs-input-radio":Kp,"vs-input-select":Qp,"vs-input-switcher":Up,"vs-input-static":Wp,"vs-input-container":LS,"vs-input-date":Wv,"vs-input-checkbox":jv,"vs-input-file":V_,"vs-input-html":Wp,"vs-input-email":Bv,"vs-input-datatable":iM,"vs-input-map":wT,"vs-input-file-list":aS,"vs-input-tags":BT,"vs-input-slug":IT,"vs-input-codegen":HT,"vs-input-key-value":QT,"vs-input-range":iA,"vs-input-color":rA,"vs-input-native-select":Qp,"vs-input-array":cA,"vs-input-address":wA},CA=i.defineComponent({__name:"behavior",props:{api:{},set:{},button:{},error:{},value:{}},setup(n){const e=n,t=i.inject("values");async function r(){try{if(!e.api)return;const o=e.api.replace("{{value}}",e.value),s=await fetch(o);if(!s.ok){Ie({type:"warning",title:"Validation",message:"При спробі завантажити дані виникла помилка."});return}const l=await s.json();if(!e.set||!t)return;for(const[a,c]of Object.entries(e.set))t.value[a]=l.result[c]}catch(o){console.error(e.error,o)}}return(o,s)=>(i.openBlock(),i.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"},i.toDisplayString(o.button),1))}}),vA={class:"flex flex-col gap-1 w-full"},_A={key:0,class:"text-sm text-gray-500"},th=i.defineComponent({__name:"vs-compact-form-layout",props:i.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=i.useModel(n,"modelValue"),r=i.computed(()=>jC[`${e.layout}`]),o=i.computed(()=>EA?.[`vs-input-${e.item.type}`]),s=i.computed(()=>{const a=i.unref(o);if(!a)return new Set;const c=a.props??a.__vccOpts?.props;if(!c)return new Set;const d=Array.isArray(c)?c:Object.keys(c);return new Set(d)}),l=i.computed(()=>{const a=e.item??{},c=s.value;return c.size?Object.fromEntries(Object.entries(a).filter(([d])=>c.has(d))):{}});return(a,c)=>(i.openBlock(),i.createBlock(i.resolveDynamicComponent(r.value),{ua:e.item.ua,error:e.error||"",item:a.item,columns:e.columns,label:e.item.label},{default:i.withCtx(()=>[i.createElementVNode("div",{class:i.normalizeClass(["flex w-full",`${e.item.type}-component`])},[i.createElementVNode("div",vA,[(i.openBlock(),i.createBlock(i.resolveDynamicComponent(o.value),i.mergeProps(l.value,{modelValue:t.value,"onUpdate:modelValue":c[0]||(c[0]=d=>t.value=d)}),null,16,["modelValue"])),a.item.description&&e.layout!=="settings"?(i.openBlock(),i.createElementBlock("p",_A,i.toDisplayString(a.item.description),1)):i.createCommentVNode("",!0)]),a.item.behavior?.api&&a.item.behavior?.button?(i.openBlock(),i.createBlock(CA,i.mergeProps({key:0},a.item.behavior,{value:t.value}),null,16,["value"])):i.createCommentVNode("",!0)],2)]),_:1},8,["ua","error","item","columns","label"]))}}),SA={class:"text-sm text-gray-800 mb-[4px] font-medium dark:text-neutral-300"},NA={class:"vs-compact-form-navigation__rail mt-[6px]"},MA=["onClick"],TA=i.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=i.ref([]),o=i.ref(""),s=i.ref(""),l=i.computed(()=>!!t.enabled),a=i.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=i.computed(()=>{const B=t.width;if(B==null)return{};const A=typeof B=="number"?`${B}px`:`${B}`;return{width:A,minWidth:A}});let d=null,u=0,f=0,p=null,h=null,m=null;const g=()=>D(),y=()=>k();i.watch(()=>t.target,async B=>{if(S(),!B){p=null,r.value=[],o.value="";return}p=B,l.value&&(await i.nextTick(),w(B),k())},{immediate:!0}),i.watch(()=>t.scrollContainer,B=>{if(!l.value){h=B??null;return}b(B??null),i.nextTick(()=>k())},{immediate:!0}),i.onMounted(()=>{t.scrollContainer||b(null),k()}),i.onBeforeUnmount(()=>{S(),b(null,!0),p=null,typeof window<"u"&&(u&&window.cancelAnimationFrame(u),f&&window.cancelAnimationFrame(f))});function b(B,A=!1){if(m&&(m(),m=null),A){h=null;return}if(h=B??null,typeof window>"u")return;const j=B??window,Y=window;j.addEventListener("scroll",g,{passive:!0}),Y.addEventListener("resize",y),m=()=>{j.removeEventListener("scroll",g),Y.removeEventListener("resize",y)}}function k(){if(!l.value||!p)return;u&&typeof window<"u"&&window.cancelAnimationFrame(u);const B=()=>{C(),u=0};typeof window>"u"?B():u=window.requestAnimationFrame(B)}function C(){if(!l.value||!p)return;const B=Array.from(p.querySelectorAll("h1, h2")),A=new Set,j=[];B.forEach((Y,z)=>{const K=Y.textContent?.trim()??"";if(!K)return;let q=(Y.getAttribute("id")??"").trim();q||(q=x(K)||`heading-${z+1}`);let re=q,se=1;for(;A.has(re);)re=`${q}-${se+=1}`;Y.id!==re&&Object.assign(Y,{id:re}),A.add(re),j.push({id:re,text:K,level:Y.tagName.toLowerCase()==="h1"?1:2})}),r.value=j,j.length||(o.value=""),T()}function x(B){return B.toLowerCase().replace(/[^a-z0-9\s-]/g,"").trim().replace(/\s+/g,"-")}function w(B){!B||!l.value||typeof MutationObserver>"u"||(S(),d=new MutationObserver(()=>k()),d.observe(B,{childList:!0,subtree:!0}))}function S(){d&&(d.disconnect(),d=null)}function E(B){const A=h;if(!A)return typeof window>"u"?B.offsetTop:B.getBoundingClientRect().top+window.scrollY;const j=B.getBoundingClientRect(),Y=A.getBoundingClientRect();return j.top-Y.top+A.scrollTop}function T(){if(!l.value||!r.value.length)return;const B=h,A=(B?B.scrollTop:null)||(typeof window<"u"?window.scrollY:0),j=(B?B.clientHeight:null)||(typeof window<"u"?window.innerHeight:0),Y=A+j;let z=null;for(let q=0;q<r.value.length;q+=1){const re=r.value[q],se=document.getElementById(re.id);if(se){const ve=E(se);ve+se.offsetHeight>A&&ve<Y&&(z=re.id)}}!z&&s.value&&(z=s.value),z&&(s.value=z);const K=B?B.scrollHeight-B.clientHeight:document.documentElement.scrollHeight-window.innerHeight;A+5>=K&&(z=r.value[r.value.length-1].id),z&&(o.value=z)}function D(){l.value&&(f&&window.cancelAnimationFrame(f),f=window.requestAnimationFrame(()=>{T(),f=0}))}function U(B){if(!l.value)return;const A=document.getElementById(B);if(!A)return;const j=h,Y=Math.max(0,E(A));j?j.scrollTo({top:Y,behavior:"smooth"}):typeof window<"u"&&window.scrollTo({top:Y,behavior:"smooth"})}return e({refresh:k}),(B,A)=>l.value&&r.value.length?(i.openBlock(),i.createElementBlock("div",{key:0,class:i.normalizeClass(a.value),style:i.normalizeStyle(c.value)},[i.createElementVNode("h2",SA,i.toDisplayString(B.title),1),i.createElementVNode("div",NA,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(r.value,j=>(i.openBlock(),i.createElementBlock("div",{key:j.id,class:i.normalizeClass(["vs-compact-form-navigation__item relative",j.level===2?"vs-compact-form-navigation__item--nested":"",j.id===o.value?"vs-compact-form-navigation__item--active":""])},[i.createElementVNode("button",{type:"button",onClick:Y=>U(j.id),class:i.normalizeClass(["vs-compact-form-navigation__button flex gap-x-3 py-[6px] pr-3 text-sm duration-200 hover:text-gray-800",j.level===2?"pl-[15px]":"pl-[18px]",j.id===o.value?"text-gray-800":"text-gray-500"])},[i.createElementVNode("span",null,i.toDisplayString(j.text),1)],10,MA)],2))),128))])],6)):i.createCommentVNode("",!0)}}),AA=ge(TA,[["__scopeId","data-v-1584a562"]]),nh={required:"Це поле є обов’язковим",email:"Неправильний email"},BA=n=>n?!1:nh.required,VA=n=>n?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(n)?!1:nh.email:!1,LA=(n,e)=>{const t=e.pattern??e.regexp;return!(typeof t=="string"?new RegExp(t):t).test(n)&&n?e.message:!1},OA=(n,e)=>!1,IA=(n,e)=>{switch(typeof e=="string"?e:e.type){case"required":return BA(n);case"email":return VA(n);case"regexp":return LA(n,e);case"custom":return OA();default:return!1}},DA={autocomplete:"select",combobox:"select",datepicker:"date",markedtext:"mask",html:"static",geom:"map",filelist:"file-list",datalist:"datatable",file:"file",dropzone:"file"};function rh(n){const e=n.toLowerCase();return DA[e]||e}function Oa(n,e=!1){if(Array.isArray(n)){const r=[];return n.forEach(o=>{const s={...o};s.name=(o.name||o.id||o.key||"").toString(),s.type=rh(o.type),s.label=o.label||o.ua,s.rules=o.rules||o.validators,s.type==="email"&&!s.rules&&(s.rules=["email"]),o.data&&(s.api=`/api/suggest/${o.data}`),s.disabled=e||s.disabled,Array.isArray(s.schema)&&(s.schema=Oa(s.schema,s.disabled)),r.push(s)}),r}const t=[];return Object.entries(n).forEach(r=>{const o={name:r[0],...r[1],type:rh(r[1].type),label:r[1].label||r[1].ua,rules:r[1].rules||r[1].validators,disabled:e};o.type==="email"&&!o.rules&&(o.rules=["email"]),r[1].type.includes("list")&&(o.multiple=!0),!o.api&&r[1].data&&(o.api=`/api/suggest/${r[1].data}`),Array.isArray(o.schema)&&(o.schema=Oa(o.schema,o.disabled)),t.push(o)}),t}function RA(n,e,t=!1){const r=i.computed(()=>Oa(e,typeof t=="boolean"?t:t.value)),o=i.ref({});function s(c){const d=c?.conditions;if(!d)return!0;const u=Array.isArray(d)?d[0]:d,f=n?.value?.[u];return Zp(f,d)}const l=(c=r.value,d=!0)=>(c.forEach(u=>{if(u.rules){if(!s(u)){delete o.value[u.name];return}let f=!1,p=null;u.rules.forEach(h=>{const m=IA(n.value[u.name],h);m&&(f=!0,!p&&typeof m=="string"&&(p=m))}),f&&p?o.value[u.name]=p:delete o.value[u.name]}u.schema&&l(u.schema,!1)}),d&&Object.values(o.value).some(Boolean)?o.value:null),a=i.computed(()=>r.value?.filter(c=>c.hidden!==!0&&s(c)));return{errors:o,validate:l,reset:()=>{n.value={},o.value={}},visibleSchema:a}}const FA={class:"flex w-full h-full min-h-0 gap-6"},PA={key:0,"data-orientation":"horizontal",role:"none",class:"mt-1 shrink-0 h-[1px] w-full bg-slate-100 dark:bg-slate-600"},Rr=i.defineComponent({__name:"vs-compact-form",props:i.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:i.mergeModels(["handle-submit","update:modelValue"],["update:form","update:values"]),setup(n,{expose:e,emit:t}){const r=t,o=n,s=i.useModel(n,"form"),l=i.useModel(n,"values"),{errors:a,validate:c,reset:d,visibleSchema:u}=RA(l,o.schema,i.toRef(o,"disabled")),f=i.ref(null),p=i.ref(null),h=i.computed(()=>o.navigation),m=i.computed(()=>o.navWidth),g=i.computed(()=>o.style?.columns),y=Object.freeze({container:12,label:3}),b=i.computed(()=>o.columns??g.value??y),k=i.computed(()=>o.columns!=null||g.value!=null),C=i.computed(()=>k.value?"horizontal":o.layout),x=T=>T?.columns?"horizontal":C.value,w=T=>T?.columns??b.value,S=()=>{r("update:modelValue",l.value),c(),r("handle-submit",l.value)};e({validate:c,reset:d,errors:a}),i.onMounted(()=>{o.modelValue&&(l.value=o.modelValue),s.value={value:l.value,errors:a.value,reset:d,validate:c,formId:o.formId}});function E(T,D){if(T===D)return!0;if(typeof T!="object"||typeof D!="object"||!T||!D)return!1;const U=Object.keys(T),B=Object.keys(D);return U.length!==B.length?!1:U.every(A=>T[A]===D[A])}return i.provide("form",s),i.provide("values",l),(T,D)=>(i.openBlock(),i.createElementBlock("div",FA,[i.createElementVNode("div",{class:"flex-1 min-h-0 overflow-y-auto overflow-x-visible",ref_key:"formScrollContainer",ref:p},[i.createElementVNode("form",{ref_key:"formRef",ref:f,onSubmit:i.withModifiers(S,["prevent"]),class:i.normalizeClass(["grid grid-cols-12 p-1",C.value==="default"?"gap-6":"gap-4"])},[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(i.unref(u),(U,B)=>(i.openBlock(),i.createElementBlock("div",{key:U.name,class:i.normalizeClass(x(U)==="horizontal"?"col-span-12":`col-span-${U.col||12}`)},[i.createVNode(th,{style:i.normalizeStyle(T.style),item:U,layout:x(U),columns:w(U),"model-value":l.value[U.name],"onUpdate:modelValue":A=>{const j=l.value[U.name];E(j,A)||(l.value[U.name]=A)},error:i.unref(a)[U.name]},null,8,["style","item","layout","columns","model-value","onUpdate:modelValue","error"]),x(U)==="settings"&&B+1!==i.unref(u).length?(i.openBlock(),i.createElementBlock("div",PA)):i.createCommentVNode("",!0)],2))),128))],34)],512),i.createVNode(AA,{target:f.value,"scroll-container":p.value,enabled:h.value,width:m.value},null,8,["target","scroll-container","enabled","width"])]))}}),$A={class:"relative"},zA={class:"w-full h-full fixed top-0 start-0 z-[1000] bg-black bg-opacity-50"},HA={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"},jA={class:"py-2.5 px-4 flex justify-between items-center border-0 border-b border-solid border-gray-200 dark:border-b-[#454545]"},UA={class:"font-medium text-gray-800 dark:text-[#ffffff]"},WA={class:"p-4 mim-h-0 h-full overflow-auto"},KA=i.defineComponent({__name:"modal-edit",props:{schema:{},defaultValue:{},mode:{},token:{},form:{}},emits:["close","save","edit"],setup(n,{emit:e}){const t=n,r=e,o=i.ref(t.schema),s=i.ref(t.defaultValue?JSON.parse(JSON.stringify(t.defaultValue)):{}),l=i.ref({}),a=i.ref(),c=i.ref(t.mode);async function d(){const f=l.value.validate();if(f){Ie({type:"warning",title:"Помилка валідації",message:Object.entries(f).map(([p,h])=>`${p}: ${h}`).join(`
106
- `)});return}if(a.value)try{const p=await fetch(`/api/table/${a.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s.value)});if(p.ok)await p.json(),Ie({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`}),r("save",s.value);else if(p.status===400){const h=await p.json().catch(()=>({}));Ie({type:"warning",title:"Помилка валідації",message:h.message||"Некоректні дані (400)"})}else p.status===500?Ie({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):Ie({type:"error",title:"Помилка",message:`Статус: ${p.status}`})}catch(p){Ie({type:"error",title:"Помилка з’єднання",message:p.message||"Не вдалося виконати запит"})}}function u(){r("close")}return i.onMounted(async()=>{try{if(t.form){const f=await fetch(`/api/template/form/${t.form}`);if(!f.ok){Ie({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const p=await f.json();o.value=p.schema,a.value=p.token}else if(t.token){a.value=t.token;const f=await fetch(`/api/form/${a.value}`);if(!f.ok){Ie({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const p=await f.json();o.value=p.schema,p.data?s.value=p.data:c.value="add"}}catch(f){Ie({type:"error",title:"Error",message:f.message||"Unexpected error"}),console.error(f)}}),(f,p)=>(i.openBlock(),i.createElementBlock("div",$A,[i.createElementVNode("div",zA,[i.createElementVNode("div",HA,[i.createElementVNode("div",jA,[i.createElementVNode("h3",UA,i.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),i.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"},p[2]||(p[2]=[i.createElementVNode("span",{class:"sr-only"},"Close",-1),i.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"},[i.createElementVNode("path",{d:"M18 6 6 18"}),i.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),i.createElementVNode("div",WA,[o.value?(i.openBlock(),i.createBlock(Rr,{key:0,schema:o.value,values:s.value,"onUpdate:values":p[0]||(p[0]=h=>s.value=h),form:l.value,"onUpdate:form":p[1]||(p[1]=h=>l.value=h)},null,8,["schema","values","form"])):i.createCommentVNode("",!0)]),i.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"},[i.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"}," Скасувати "),i.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"}," Зберегти ")])])])]))}}),oh=(n={mode:"edit",schema:null})=>new Promise(e=>{const{close:t}=EC({title:n.mode==="add"?"Додати":"Редагувати",template:"",size:"medium",content:KA,contentProps:{...n,onClose:()=>{e(null),t()},onSave:r=>{e(r),t()}}})});Rr.install=function(n){n.component("VForm",Rr),Object.assign(n.config.globalProperties,{$form:oh}),n.provide("form",oh),window.v3plugin||(window.v3plugin={})};const qA={class:"relative"},GA={key:0,class:"mt-4"},JA=["src","alt","title"],YA={key:0,class:"text-sm text-red-500"},XA={key:1,class:"mt-4"},ZA={class:"text-sm text-gray-600 mb-2"},QA={class:"flex flex-wrap gap-2"},eB=["src","alt","onError"],tB=["onClick"],nB={class:"flex justify-end gap-x-2 p-[20px]"},rB=Object.assign({inheritAttrs:!1},{__name:"vs-editor-image",props:{editor:{type:Object,required:!0}},setup(n){const e=n,t=i.ref(!1),r=i.ref(!1),o=i.ref({}),s=i.ref(!1),l=i.ref([]),a=i.ref({src:"",file:"",alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1}),c=i.computed(()=>Array.isArray(a.value.file)&&a.value.file.length>1),d=i.computed(()=>Array.isArray(a.value.file)&&a.value.file.length===1),u=i.computed(()=>{if(c.value)return"";if(a.value.src)return a.value.src;if(d.value&&a.value.file[0]instanceof File){const w=l.value.find(S=>S.file===a.value.file[0]);return w?w.preview:""}return(typeof a.value.file=="string"?a.value.file:"")||""}),f=i.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:"Ширина зображення"},{name:"height",label:"Висота",type:"number",required:!1,placeholder:"Висота зображення"},{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}]),p=()=>{if(!e.editor)return;if(e.editor.isActive("image")){e.editor.chain().focus().selectParentNode().run();const S=e.editor.getAttributes("image");s.value=!0;let E="",T=!1;const D=e.editor.getAttributes("link");D&&D.href&&(E=D.href,T=D.target==="_blank"),a.value={src:S.src||"",file:S.src||"",alt:S.alt||"",title:S.title||"",width:S.width||"",height:S.height||"",link:E,openInNewTab:T}}else s.value=!1,a.value={src:"",file:"",alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1};r.value=!1,t.value=!0},h=()=>{t.value=!1,r.value=!1,s.value=!1,l.value=[],a.value={src:"",file:"",alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1}},m=async w=>{if(!w||w.length===0){l.value=[];return}l.value=[];for(const S of w)if(S&&S.type&&S.type.startsWith("image/")){const E=new FileReader;E.onload=T=>{l.value.push({file:S,preview:T.target.result,error:!1})},E.readAsDataURL(S)}},g=w=>{l.value.splice(w,1),Array.isArray(a.value.file)&&(a.value.file.splice(w,1),a.value.file.length===0&&(a.value.file=""))},y=async()=>{if(c.value&&(l.value.length===0&&await m(a.value.file),l.value.length>0)){await k();return}let w=a.value.src;if(d.value){const E=a.value.file[0];if(E instanceof File)try{const T=new FileReader;w=await new Promise((U,B)=>{T.onload=A=>U(A.target.result),T.onerror=B,T.readAsDataURL(E)})}catch(T){console.error("Помилка при читанні файлу:",T),Ie({type:"error",title:"Помилка",message:"Не вдалося прочитати файл"});return}else typeof E=="string"&&(w=E)}else a.value.file&&typeof a.value.file=="string"&&(w=a.value.file);const S=w||a.value.file&&(typeof a.value.file=="string"&&a.value.file.trim()!==""||Array.isArray(a.value.file)&&a.value.file.length>0||a.value.file instanceof FileList&&a.value.file.length>0);if(!w&&!S){Ie({type:"warning",title:"Попередження",message:"Будь ласка, введіть URL зображення або виберіть файл"});return}if(!c.value&&!S&&await o.value.validate()){Ie({type:"warning",title:"Попередження",message:"Будь ласка, заповніть всі обов'язкові поля"});return}if(e.editor&&w)if(s.value){const{state:E}=e.editor,{selection:T}=E,{$anchor:D}=T,U=e.editor.getAttributes("link"),B=U&&U.href;if(e.editor.chain().focus().updateAttributes("image",{src:w,alt:a.value.alt||"",title:a.value.title||"",width:a.value.width||"",height:a.value.height||""}).run(),a.value.link&&a.value.link.trim()!==""){let A=a.value.link.trim();A.match(/^https?:\/\//i)||(A="https://"+A),B?e.editor.chain().focus().extendMarkRange("link").setLink({href:A,target:a.value.openInNewTab?"_blank":null}).run():e.editor.chain().focus().selectParentNode().setLink({href:A,target:a.value.openInNewTab?"_blank":null}).run()}else B&&e.editor.chain().focus().extendMarkRange("link").unsetLink().run()}else{const{state:E}=e.editor,{selection:T}=E,{$anchor:D}=T;let U=null;for(let A=D.depth;A>0;A--){const j=D.node(A);if(j&&j.type.name==="paragraph"){U=j;break}}if(U&&U.content.content.some(A=>A.type.name==="image")){const A=b(U,D.before(D.depth));if(A!==null){const j=E.schema.nodes.image.create({src:w,alt:a.value.alt||"",title:a.value.title||"",width:a.value.width||"",height:a.value.height||""});if(a.value.link&&a.value.link.trim()!==""){let Y=a.value.link.trim();Y.match(/^https?:\/\//i)||(Y="https://"+Y);const z=E.schema.marks.link.create({href:Y,target:a.value.openInNewTab?"_blank":null}),K=j.type.create(j.attrs,j.content,[z]);e.editor.chain().focus().insertContentAt(A+1,K).run()}else e.editor.chain().focus().insertContentAt(A+1,j).run()}else a.value.link&&a.value.link.trim()!==""?(e.editor.chain().focus().setImage({src:w,alt:a.value.alt||"",title:a.value.title||"",width:a.value.width||"",height:a.value.height||""}).run(),setTimeout(()=>{let j=a.value.link.trim();j.match(/^https?:\/\//i)||(j="https://"+j),e.editor.chain().focus().selectParentNode().setLink({href:j,target:a.value.openInNewTab?"_blank":null}).run()},10)):e.editor.chain().focus().setImage({src:w,alt:a.value.alt||"",title:a.value.title||"",width:a.value.width||"",height:a.value.height||""}).run()}else a.value.link&&a.value.link.trim()!==""?(e.editor.chain().focus().setImage({src:w,alt:a.value.alt||"",title:a.value.title||"",width:a.value.width||"",height:a.value.height||""}).run(),setTimeout(()=>{let A=a.value.link.trim();A.match(/^https?:\/\//i)||(A="https://"+A),e.editor.chain().focus().selectParentNode().setLink({href:A,target:a.value.openInNewTab?"_blank":null}).run()},10)):e.editor.chain().focus().setImage({src:w,alt:a.value.alt||"",title:a.value.title||"",width:a.value.width||"",height:a.value.height||""}).run()}h()},b=(w,S)=>{let E=null;return w.forEach((T,D)=>{T.type.name==="image"&&(E=S+D+1)}),E},k=async()=>{if(e.editor&&(l.value.length===0&&c.value&&await m(a.value.file),l.value.length!==0))try{const w=[];for(const S of l.value){const E=S.preview,T=e.editor.schema.nodes.image.create({src:E,alt:"",width:"",height:""});w.push(T)}w.length>0&&e.editor.chain().focus().command(({tr:S,dispatch:E})=>{if(E){const{selection:T}=S,{$anchor:D}=T;let U=T.$anchor.pos,B=null,A=null;for(let Y=D.depth;Y>0;Y--){const z=D.node(Y);if(z&&z.type.name==="paragraph"){B=z,A=D.start(Y);break}}if(B){let Y=null;B.forEach((z,K)=>{z.type.name==="image"&&(Y=A+K+1)}),Y!==null?U=Y+1:U=A+B.content.size}let j=U;return w.forEach(Y=>{S.insert(j,Y),j+=Y.nodeSize}),!0}return!1}).run(),h()}catch(w){console.error("Помилка при додаванні зображень:",w),Ie({type:"error",title:"Помилка",message:"Не вдалося додати зображення"})}},C=async()=>{await y()},x=()=>{h()};return i.watch(()=>a.value.file,async w=>{r.value=!1,Array.isArray(w)&&w.length>0?await m(w):w&&typeof w=="object"&&w instanceof FileList?await m(Array.from(w)):w&&typeof w=="object"&&!Array.isArray(w)&&w instanceof File?await m([w]):l.value=[]},{immediate:!0}),i.watch(()=>a.value.src,()=>{r.value=!1}),(w,S)=>(i.openBlock(),i.createElementBlock("div",qA,[i.createElementVNode("button",{onClick:p,class:i.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:"Додати зображення"},[...S[4]||(S[4]=[i.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),i.createVNode($p,{modelValue:t.value,"onUpdate:modelValue":S[3]||(S[3]=E=>t.value=E),title:s.value?"Редагувати зображення":"Додати зображення"},{footer:i.withCtx(()=>[i.createElementVNode("div",nB,[i.createElementVNode("button",{onClick:x,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"}," Скасувати "),i.createElementVNode("button",{onClick:C,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"},i.toDisplayString(s.value?"Оновити зображення":"Додати зображення"),1)])]),default:i.withCtx(()=>[i.createVNode(i.unref(Rr),{modelValue:a.value,"onUpdate:modelValue":S[0]||(S[0]=E=>a.value=E),schema:f.value,form:o.value,"onUpdate:form":S[1]||(S[1]=E=>o.value=E)},null,8,["modelValue","schema","form"]),u.value&&!c.value?(i.openBlock(),i.createElementBlock("div",GA,[S[5]||(S[5]=i.createElementVNode("p",{class:"text-sm text-gray-600 mb-2"},"Попередній перегляд:",-1)),i.withDirectives(i.createElementVNode("img",{src:u.value,alt:a.value.alt||"Попередній перегляд зображення",title:a.value.title,class:"max-w-full h-auto max-h-32 rounded border",onError:S[2]||(S[2]=E=>r.value=!0)},null,40,JA),[[i.vShow,!r.value]]),r.value?(i.openBlock(),i.createElementBlock("p",YA," Не вдалося завантажити попередній перегляд зображення ")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),l.value.length>0?(i.openBlock(),i.createElementBlock("div",XA,[i.createElementVNode("p",ZA,"Попередній перегляд ("+i.toDisplayString(l.value.length)+" зображень):",1),S[6]||(S[6]=i.createElementVNode("p",{class:"text-xs text-gray-500 mb-2"}," Зображення будуть розміщені в ряд, якщо вони помістяться по ширині ",-1)),i.createElementVNode("div",QA,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,(E,T)=>(i.openBlock(),i.createElementBlock("div",{key:T,class:"relative"},[i.withDirectives(i.createElementVNode("img",{src:E.preview,alt:`Попередній перегляд ${T+1}`,class:"max-w-[100px] max-h-[100px] rounded border object-contain",onError:D=>E.error=!0},null,40,eB),[[i.vShow,!E.error]]),i.createElementVNode("button",{onClick:D=>g(T),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,tB)]))),128))])])):i.createCommentVNode("",!0)]),_:1},8,["modelValue","title"])]))}}),oB={class:"flex items-center"},sB=["disabled"],lB=["disabled"],iB=Le(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(o,s)=>(i.openBlock(),i.createElementBlock("div",oB,[i.createElementVNode("button",{onClick:t,class:i.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)"},[...s[0]||(s[0]=[i.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"},[i.createElementVNode("path",{d:"M3 7v6h6"}),i.createElementVNode("path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"})],-1)])],10,sB),i.createElementVNode("button",{onClick:r,class:i.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)"},[...s[1]||(s[1]=[i.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"},[i.createElementVNode("path",{d:"M21 7v6h-6"}),i.createElementVNode("path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13"})],-1)])],10,lB)]))}}),[["__scopeId","data-v-b5a7cc5a"]]),aB={class:"relative"},cB=Le(Object.assign({inheritAttrs:!1},{__name:"vs-editor-help",props:{editor:Object},setup(n){const e=i.ref(!1),t=i.ref(null),r=()=>{e.value=!e.value},o=()=>{e.value=!1};return(s,l)=>(i.openBlock(),i.createElementBlock("div",aB,[i.createElementVNode("button",{ref_key:"helpButton",ref:t,onClick:r,class:i.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"},[...l[1]||(l[1]=[i.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"},[i.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),i.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i.createElementVNode("line",{x1:"12",x2:"12.01",y1:"17",y2:"17"})],-1)])],2),e.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[100001]",onClick:o},[i.createElementVNode("div",{class:"bg-white rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] overflow-y-auto",onClick:l[0]||(l[0]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:"p-6"},[i.createElementVNode("div",{class:"flex justify-between items-center mb-4"},[l[3]||(l[3]=i.createElementVNode("h2",{class:"text-xl font-semibold text-gray-900"},"Common Markdown Syntax & Shortcuts",-1)),i.createElementVNode("button",{onClick:o,class:"text-gray-400 hover:text-gray-600 transition-colors"},[...l[2]||(l[2]=[i.createElementVNode("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),l[4]||(l[4]=i.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 (&gt;) 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>![alt text](url)</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))])])])):i.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-72ce3024"]]),dB={__name:"vs-editor-horizontal-rule",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().setHorizontalRule().run()};return(r,o)=>(i.openBlock(),i.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"},[...o[0]||(o[0]=[i.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"},[i.createElementVNode("line",{x1:"3",x2:"21",y1:"12",y2:"12"})],-1)])]))}},uB={__name:"vs-editor-fullscreen",props:{editor:Object},emits:["toggle-fullscreen"],setup(n,{emit:e}){const t=e,r=()=>{t("toggle-fullscreen")};return(o,s)=>(i.openBlock(),i.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"},[...s[0]||(s[0]=[i.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"},[i.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)])]))}},fB=["title"],pB={class:"vs-editor-html-mode__text"},sh={bold:Xw,italic:eE,color:g2,background_color:E2,highlight:C2,bullet_list:Hw,ordered_list:Ww,blockquote:Pw,codeblock:Gw,underline:tE,strike:nE,link:VE,table:RE,text_align:t2,type_tag:o2,font_family:M2,font_size:V2,superscript:I2,subscript:F2,heading:j2,clear_formatting:K2,image:rB,history:iB,help:cB,horizontal_rule:dB,fullscreen:uB,html_mode:Le({__name:"vs-editor-html-mode",props:{editor:{type:Object,required:!0}},emits:["toggle-html-mode"],setup(n,{emit:e}){const t=e,r=i.ref(!1),o=()=>{r.value=!r.value,t("toggle-html-mode",r.value)};return(s,l)=>(i.openBlock(),i.createElementBlock("button",{onClick:o,class:i.normalizeClass([{"is-active":r.value},"vs-editor-html-mode"]),type:"button",title:r.value?"Switch to Rich Text Mode":"Switch to HTML Mode"},[l[0]||(l[0]=i.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"16,18 22,12 16,6"}),i.createElementVNode("polyline",{points:"8,6 2,12 8,18"})],-1)),i.createElementVNode("span",pB,i.toDisplayString((r.value,"HTML")),1)],10,fB))}},[["__scopeId","data-v-99a48167"]]),tab: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,o)=>(i.openBlock(),i.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"},[...o[0]||(o[0]=[i.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)])]))}})},wl={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"]},hB=Le({__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,o=t,s=i.ref(null);let l=null,a=null,c=!1,d=null;const u=()=>{const B=document.querySelector("link[data-monaco-editor-css]");if(!B)return!1;try{return B.sheet||B.styleSheet||B.href}catch{return!1}},f=()=>u()?new Promise(B=>setTimeout(B,50)):new Promise((B,A)=>{const j=document.createElement("link");j.rel="stylesheet",j.href="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/editor/editor.main.css",j.setAttribute("data-monaco-editor-css","true");const Y=()=>{const re=()=>{u()?setTimeout(()=>B(),100):setTimeout(re,50)};re()};j.addEventListener?(j.addEventListener("load",Y),j.addEventListener("error",()=>A(new Error("Failed to load Monaco Editor CSS")))):(j.onload=Y,j.onerror=()=>A(new Error("Failed to load Monaco Editor CSS"))),document.head.appendChild(j);let z=0;const K=20,q=setInterval(()=>{z++,u()?(clearInterval(q),setTimeout(()=>B(),100)):z>=K&&(clearInterval(q),setTimeout(()=>B(),100))},50)}),p=()=>document.querySelector("script[data-monaco-editor-loader]")?Promise.resolve():new Promise((A,j)=>{const Y=document.createElement("script");Y.src="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/loader.js",Y.setAttribute("data-monaco-editor-loader","true"),Y.onload=()=>A(),Y.onerror=()=>j(new Error("Failed to load Monaco Editor loader")),document.head.appendChild(Y)}),h=()=>d||(window.monaco&&window.monaco.editor?(a=window.monaco,Promise.resolve(a)):(d=new Promise((B,A)=>{if(c){const j=setInterval(()=>{window.monaco&&window.monaco.editor&&(clearInterval(j),a=window.monaco,B(a))},50);return}c=!0,f().then(()=>p()).then(()=>{const j=setInterval(()=>{window.require&&(clearInterval(j),window.require.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"}}),window.require(["vs/editor/editor.main"],()=>{a=window.monaco,c=!1,B(a)},Y=>{c=!1,console.error("Failed to load Monaco Editor:",Y),A(Y)}))},50);setTimeout(()=>{clearInterval(j),c=!1,A(new Error("Monaco Editor loader not found"))},1e4)}).catch(j=>{c=!1,A(j)})}),d)),m=B=>{try{const A=document.createElement("div");A.innerHTML=B;const j=(z,K=0)=>{const q=" ".repeat(K);let re="";if(z.nodeType===Node.TEXT_NODE){const se=z.textContent.trim();return se&&(re+=q+se+`
106
+ `)});return}if(a.value)try{const p=await fetch(`/api/table/${a.value}`,{method:c.value==="add"?"POST":"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s.value)});if(p.ok)await p.json(),Ie({type:"success",title:"Успішно",message:`Дані успішно ${c.value==="add"?"збережено":"оновлено"}`}),r("save",s.value);else if(p.status===400){const h=await p.json().catch(()=>({}));Ie({type:"warning",title:"Помилка валідації",message:h.message||"Некоректні дані (400)"})}else p.status===500?Ie({type:"error",title:"Серверна помилка",message:"Виникла помилка на сервері (500)"}):Ie({type:"error",title:"Помилка",message:`Статус: ${p.status}`})}catch(p){Ie({type:"error",title:"Помилка з’єднання",message:p.message||"Не вдалося виконати запит"})}}function u(){r("close")}return i.onMounted(async()=>{try{if(t.form){const f=await fetch(`/api/template/form/${t.form}`);if(!f.ok){Ie({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const p=await f.json();o.value=p.schema,a.value=p.token}else if(t.token){a.value=t.token;const f=await fetch(`/api/form/${a.value}`);if(!f.ok){Ie({type:f.status>=400&&f.status<500?"warning":"error",title:"Error",message:`Error code: ${f.status}`});return}const p=await f.json();o.value=p.schema,p.data?s.value=p.data:c.value="add"}}catch(f){Ie({type:"error",title:"Error",message:f.message||"Unexpected error"}),console.error(f)}}),(f,p)=>(i.openBlock(),i.createElementBlock("div",$A,[i.createElementVNode("div",zA,[i.createElementVNode("div",HA,[i.createElementVNode("div",jA,[i.createElementVNode("h3",UA,i.toDisplayString(c.value==="add"?"Додати":"Змінити"),1),i.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"},p[2]||(p[2]=[i.createElementVNode("span",{class:"sr-only"},"Close",-1),i.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"},[i.createElementVNode("path",{d:"M18 6 6 18"}),i.createElementVNode("path",{d:"m6 6 12 12"})],-1)]))]),i.createElementVNode("div",WA,[o.value?(i.openBlock(),i.createBlock(Rr,{key:0,schema:o.value,values:s.value,"onUpdate:values":p[0]||(p[0]=h=>s.value=h),form:l.value,"onUpdate:form":p[1]||(p[1]=h=>l.value=h)},null,8,["schema","values","form"])):i.createCommentVNode("",!0)]),i.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"},[i.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"}," Скасувати "),i.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"}," Зберегти ")])])])]))}}),oh=(n={mode:"edit",schema:null})=>new Promise(e=>{const{close:t}=EC({title:n.mode==="add"?"Додати":"Редагувати",template:"",size:"medium",content:KA,contentProps:{...n,onClose:()=>{e(null),t()},onSave:r=>{e(r),t()}}})});Rr.install=function(n){n.component("VForm",Rr),Object.assign(n.config.globalProperties,{$form:oh}),n.provide("form",oh),window.v3plugin||(window.v3plugin={})};const qA={class:"relative"},GA={key:0,class:"mt-4"},JA=["src","alt","title"],YA={key:0,class:"text-sm text-red-500"},XA={key:1,class:"mt-4"},ZA={class:"text-sm text-gray-600 mb-2"},QA={class:"flex flex-wrap gap-2"},eB=["src","alt","onError"],tB=["onClick"],nB={class:"flex justify-end gap-x-2 p-[20px]"},rB=Object.assign({inheritAttrs:!1},{__name:"vs-editor-image",props:{editor:{type:Object,required:!0}},setup(n){const e=n,t=i.ref(!1),r=i.ref(!1),o=i.ref({}),s=i.ref(!1),l=i.ref([]),a=i.ref({src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1}),c=i.computed(()=>Array.isArray(a.value.file)&&a.value.file.length>1),d=i.computed(()=>Array.isArray(a.value.file)&&a.value.file.length===1),u=i.computed(()=>{if(c.value)return"";if(a.value.src)return a.value.src;if(d.value){const w=a.value.file[0];if(w instanceof File){const S=l.value.find(E=>E.file===w);return S?S.preview:""}else if(typeof w=="string")return w}return""}),f=i.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:"Ширина зображення"},{name:"height",label:"Висота",type:"number",required:!1,placeholder:"Висота зображення"},{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}]),p=()=>{if(!e.editor)return;if(e.editor.isActive("image")){e.editor.chain().focus().selectParentNode().run();const S=e.editor.getAttributes("image");s.value=!0;let E="",T=!1;const D=e.editor.getAttributes("link");D&&D.href&&(E=D.href,T=D.target==="_blank");const U=S.src?[S.src]:[];a.value={src:S.src||"",file:U,alt:S.alt||"",title:S.title||"",width:S.width||"",height:S.height||"",link:E,openInNewTab:T}}else s.value=!1,a.value={src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1};r.value=!1,t.value=!0},h=()=>{t.value=!1,r.value=!1,s.value=!1,l.value=[],a.value={src:"",file:[],alt:"",title:"",width:"",height:"",link:"",openInNewTab:!1}},m=async w=>{if(!w||w.length===0){l.value=[];return}l.value=[];for(const S of w)if(S&&S.type&&S.type.startsWith("image/")){const E=new FileReader;E.onload=T=>{l.value.push({file:S,preview:T.target.result,error:!1})},E.readAsDataURL(S)}},g=w=>{l.value.splice(w,1),Array.isArray(a.value.file)&&a.value.file.splice(w,1)},y=async()=>{if(c.value&&(l.value.length===0&&await m(a.value.file),l.value.length>0)){await k();return}let w=a.value.src;if(d.value){const E=a.value.file[0];if(E instanceof File)try{const T=new FileReader;w=await new Promise((U,B)=>{T.onload=A=>U(A.target.result),T.onerror=B,T.readAsDataURL(E)})}catch(T){console.error("Помилка при читанні файлу:",T),Ie({type:"error",title:"Помилка",message:"Не вдалося прочитати файл"});return}else typeof E=="string"&&(w=E)}else d.value&&typeof a.value.file[0]=="string"&&(w=a.value.file[0]);const S=w||Array.isArray(a.value.file)&&a.value.file.length>0||a.value.file instanceof FileList&&a.value.file.length>0;if(!w&&!S){Ie({type:"warning",title:"Попередження",message:"Будь ласка, введіть URL зображення або виберіть файл"});return}if(!c.value&&!S&&await o.value.validate()){Ie({type:"warning",title:"Попередження",message:"Будь ласка, заповніть всі обов'язкові поля"});return}if(e.editor&&w)if(s.value){const{state:E}=e.editor,{selection:T}=E,{$anchor:D}=T,U=e.editor.getAttributes("link"),B=U&&U.href;if(e.editor.chain().focus().updateAttributes("image",{src:w,alt:a.value.alt||"",title:a.value.title||"",width:a.value.width||"",height:a.value.height||""}).run(),a.value.link&&a.value.link.trim()!==""){let A=a.value.link.trim();A.match(/^https?:\/\//i)||(A="https://"+A),B?e.editor.chain().focus().extendMarkRange("link").setLink({href:A,target:a.value.openInNewTab?"_blank":null}).run():e.editor.chain().focus().selectParentNode().setLink({href:A,target:a.value.openInNewTab?"_blank":null}).run()}else B&&e.editor.chain().focus().extendMarkRange("link").unsetLink().run()}else{const{state:E}=e.editor,{selection:T}=E,{$anchor:D}=T;let U=null;for(let A=D.depth;A>0;A--){const j=D.node(A);if(j&&j.type.name==="paragraph"){U=j;break}}if(U&&U.content.content.some(A=>A.type.name==="image")){const A=b(U,D.before(D.depth));if(A!==null){const j=E.schema.nodes.image.create({src:w,alt:a.value.alt||"",title:a.value.title||"",width:a.value.width||"",height:a.value.height||""});if(a.value.link&&a.value.link.trim()!==""){let Y=a.value.link.trim();Y.match(/^https?:\/\//i)||(Y="https://"+Y);const z=E.schema.marks.link.create({href:Y,target:a.value.openInNewTab?"_blank":null}),K=j.type.create(j.attrs,j.content,[z]);e.editor.chain().focus().insertContentAt(A+1,K).run()}else e.editor.chain().focus().insertContentAt(A+1,j).run()}else a.value.link&&a.value.link.trim()!==""?(e.editor.chain().focus().setImage({src:w,alt:a.value.alt||"",title:a.value.title||"",width:a.value.width||"",height:a.value.height||""}).run(),setTimeout(()=>{let j=a.value.link.trim();j.match(/^https?:\/\//i)||(j="https://"+j),e.editor.chain().focus().selectParentNode().setLink({href:j,target:a.value.openInNewTab?"_blank":null}).run()},10)):e.editor.chain().focus().setImage({src:w,alt:a.value.alt||"",title:a.value.title||"",width:a.value.width||"",height:a.value.height||""}).run()}else a.value.link&&a.value.link.trim()!==""?(e.editor.chain().focus().setImage({src:w,alt:a.value.alt||"",title:a.value.title||"",width:a.value.width||"",height:a.value.height||""}).run(),setTimeout(()=>{let A=a.value.link.trim();A.match(/^https?:\/\//i)||(A="https://"+A),e.editor.chain().focus().selectParentNode().setLink({href:A,target:a.value.openInNewTab?"_blank":null}).run()},10)):e.editor.chain().focus().setImage({src:w,alt:a.value.alt||"",title:a.value.title||"",width:a.value.width||"",height:a.value.height||""}).run()}h()},b=(w,S)=>{let E=null;return w.forEach((T,D)=>{T.type.name==="image"&&(E=S+D+1)}),E},k=async()=>{if(e.editor&&(l.value.length===0&&c.value&&await m(a.value.file),l.value.length!==0))try{const w=[];for(const S of l.value){const E=S.preview,T=e.editor.schema.nodes.image.create({src:E,alt:"",width:"",height:""});w.push(T)}w.length>0&&e.editor.chain().focus().command(({tr:S,dispatch:E})=>{if(E){const{selection:T}=S,{$anchor:D}=T;let U=T.$anchor.pos,B=null,A=null;for(let Y=D.depth;Y>0;Y--){const z=D.node(Y);if(z&&z.type.name==="paragraph"){B=z,A=D.start(Y);break}}if(B){let Y=null;B.forEach((z,K)=>{z.type.name==="image"&&(Y=A+K+1)}),Y!==null?U=Y+1:U=A+B.content.size}let j=U;return w.forEach(Y=>{S.insert(j,Y),j+=Y.nodeSize}),!0}return!1}).run(),h()}catch(w){console.error("Помилка при додаванні зображень:",w),Ie({type:"error",title:"Помилка",message:"Не вдалося додати зображення"})}},C=async()=>{await y()},x=()=>{h()};return i.watch(()=>a.value.file,async w=>{r.value=!1,Array.isArray(w)&&w.length>0?await m(w):w&&typeof w=="object"&&w instanceof FileList?await m(Array.from(w)):w&&typeof w=="object"&&!Array.isArray(w)&&w instanceof File?await m([w]):l.value=[]},{immediate:!0}),i.watch(()=>a.value.src,()=>{r.value=!1}),(w,S)=>(i.openBlock(),i.createElementBlock("div",qA,[i.createElementVNode("button",{onClick:p,class:i.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:"Додати зображення"},[...S[4]||(S[4]=[i.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),i.createVNode($p,{modelValue:t.value,"onUpdate:modelValue":S[3]||(S[3]=E=>t.value=E),title:s.value?"Редагувати зображення":"Додати зображення"},{footer:i.withCtx(()=>[i.createElementVNode("div",nB,[i.createElementVNode("button",{onClick:x,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"}," Скасувати "),i.createElementVNode("button",{onClick:C,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"},i.toDisplayString(s.value?"Оновити зображення":"Додати зображення"),1)])]),default:i.withCtx(()=>[i.createVNode(i.unref(Rr),{modelValue:a.value,"onUpdate:modelValue":S[0]||(S[0]=E=>a.value=E),schema:f.value,form:o.value,"onUpdate:form":S[1]||(S[1]=E=>o.value=E)},null,8,["modelValue","schema","form"]),u.value&&!c.value?(i.openBlock(),i.createElementBlock("div",GA,[S[5]||(S[5]=i.createElementVNode("p",{class:"text-sm text-gray-600 mb-2"},"Попередній перегляд:",-1)),i.withDirectives(i.createElementVNode("img",{src:u.value,alt:a.value.alt||"Попередній перегляд зображення",title:a.value.title,class:"max-w-full h-auto max-h-32 rounded border",onError:S[2]||(S[2]=E=>r.value=!0)},null,40,JA),[[i.vShow,!r.value]]),r.value?(i.openBlock(),i.createElementBlock("p",YA," Не вдалося завантажити попередній перегляд зображення ")):i.createCommentVNode("",!0)])):i.createCommentVNode("",!0),l.value.length>0?(i.openBlock(),i.createElementBlock("div",XA,[i.createElementVNode("p",ZA,"Попередній перегляд ("+i.toDisplayString(l.value.length)+" зображень):",1),S[6]||(S[6]=i.createElementVNode("p",{class:"text-xs text-gray-500 mb-2"}," Зображення будуть розміщені в ряд, якщо вони помістяться по ширині ",-1)),i.createElementVNode("div",QA,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(l.value,(E,T)=>(i.openBlock(),i.createElementBlock("div",{key:T,class:"relative"},[i.withDirectives(i.createElementVNode("img",{src:E.preview,alt:`Попередній перегляд ${T+1}`,class:"max-w-[100px] max-h-[100px] rounded border object-contain",onError:D=>E.error=!0},null,40,eB),[[i.vShow,!E.error]]),i.createElementVNode("button",{onClick:D=>g(T),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,tB)]))),128))])])):i.createCommentVNode("",!0)]),_:1},8,["modelValue","title"])]))}}),oB={class:"flex items-center"},sB=["disabled"],lB=["disabled"],iB=Le(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(o,s)=>(i.openBlock(),i.createElementBlock("div",oB,[i.createElementVNode("button",{onClick:t,class:i.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)"},[...s[0]||(s[0]=[i.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"},[i.createElementVNode("path",{d:"M3 7v6h6"}),i.createElementVNode("path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13"})],-1)])],10,sB),i.createElementVNode("button",{onClick:r,class:i.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)"},[...s[1]||(s[1]=[i.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"},[i.createElementVNode("path",{d:"M21 7v6h-6"}),i.createElementVNode("path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3L21 13"})],-1)])],10,lB)]))}}),[["__scopeId","data-v-b5a7cc5a"]]),aB={class:"relative"},cB=Le(Object.assign({inheritAttrs:!1},{__name:"vs-editor-help",props:{editor:Object},setup(n){const e=i.ref(!1),t=i.ref(null),r=()=>{e.value=!e.value},o=()=>{e.value=!1};return(s,l)=>(i.openBlock(),i.createElementBlock("div",aB,[i.createElementVNode("button",{ref_key:"helpButton",ref:t,onClick:r,class:i.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"},[...l[1]||(l[1]=[i.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"},[i.createElementVNode("circle",{cx:"12",cy:"12",r:"10"}),i.createElementVNode("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i.createElementVNode("line",{x1:"12",x2:"12.01",y1:"17",y2:"17"})],-1)])],2),e.value?(i.openBlock(),i.createElementBlock("div",{key:0,class:"fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center z-[100001]",onClick:o},[i.createElementVNode("div",{class:"bg-white rounded-lg shadow-xl max-w-2xl w-full mx-4 max-h-[80vh] overflow-y-auto",onClick:l[0]||(l[0]=i.withModifiers(()=>{},["stop"]))},[i.createElementVNode("div",{class:"p-6"},[i.createElementVNode("div",{class:"flex justify-between items-center mb-4"},[l[3]||(l[3]=i.createElementVNode("h2",{class:"text-xl font-semibold text-gray-900"},"Common Markdown Syntax & Shortcuts",-1)),i.createElementVNode("button",{onClick:o,class:"text-gray-400 hover:text-gray-600 transition-colors"},[...l[2]||(l[2]=[i.createElementVNode("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[i.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)])])]),l[4]||(l[4]=i.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 (&gt;) 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>![alt text](url)</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))])])])):i.createCommentVNode("",!0)]))}}),[["__scopeId","data-v-72ce3024"]]),dB={__name:"vs-editor-horizontal-rule",props:{editor:Object},setup(n){const e=n,t=()=>{e.editor&&e.editor.chain().focus().setHorizontalRule().run()};return(r,o)=>(i.openBlock(),i.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"},[...o[0]||(o[0]=[i.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"},[i.createElementVNode("line",{x1:"3",x2:"21",y1:"12",y2:"12"})],-1)])]))}},uB={__name:"vs-editor-fullscreen",props:{editor:Object},emits:["toggle-fullscreen"],setup(n,{emit:e}){const t=e,r=()=>{t("toggle-fullscreen")};return(o,s)=>(i.openBlock(),i.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"},[...s[0]||(s[0]=[i.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"},[i.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)])]))}},fB=["title"],pB={class:"vs-editor-html-mode__text"},sh={bold:Xw,italic:eE,color:g2,background_color:E2,highlight:C2,bullet_list:Hw,ordered_list:Ww,blockquote:Pw,codeblock:Gw,underline:tE,strike:nE,link:VE,table:RE,text_align:t2,type_tag:o2,font_family:M2,font_size:V2,superscript:I2,subscript:F2,heading:j2,clear_formatting:K2,image:rB,history:iB,help:cB,horizontal_rule:dB,fullscreen:uB,html_mode:Le({__name:"vs-editor-html-mode",props:{editor:{type:Object,required:!0}},emits:["toggle-html-mode"],setup(n,{emit:e}){const t=e,r=i.ref(!1),o=()=>{r.value=!r.value,t("toggle-html-mode",r.value)};return(s,l)=>(i.openBlock(),i.createElementBlock("button",{onClick:o,class:i.normalizeClass([{"is-active":r.value},"vs-editor-html-mode"]),type:"button",title:r.value?"Switch to Rich Text Mode":"Switch to HTML Mode"},[l[0]||(l[0]=i.createElementVNode("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},[i.createElementVNode("polyline",{points:"16,18 22,12 16,6"}),i.createElementVNode("polyline",{points:"8,6 2,12 8,18"})],-1)),i.createElementVNode("span",pB,i.toDisplayString((r.value,"HTML")),1)],10,fB))}},[["__scopeId","data-v-99a48167"]]),tab: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,o)=>(i.openBlock(),i.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"},[...o[0]||(o[0]=[i.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)])]))}})},wl={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"]},hB=Le({__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,o=t,s=i.ref(null);let l=null,a=null,c=!1,d=null;const u=()=>{const B=document.querySelector("link[data-monaco-editor-css]");if(!B)return!1;try{return B.sheet||B.styleSheet||B.href}catch{return!1}},f=()=>u()?new Promise(B=>setTimeout(B,50)):new Promise((B,A)=>{const j=document.createElement("link");j.rel="stylesheet",j.href="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/editor/editor.main.css",j.setAttribute("data-monaco-editor-css","true");const Y=()=>{const re=()=>{u()?setTimeout(()=>B(),100):setTimeout(re,50)};re()};j.addEventListener?(j.addEventListener("load",Y),j.addEventListener("error",()=>A(new Error("Failed to load Monaco Editor CSS")))):(j.onload=Y,j.onerror=()=>A(new Error("Failed to load Monaco Editor CSS"))),document.head.appendChild(j);let z=0;const K=20,q=setInterval(()=>{z++,u()?(clearInterval(q),setTimeout(()=>B(),100)):z>=K&&(clearInterval(q),setTimeout(()=>B(),100))},50)}),p=()=>document.querySelector("script[data-monaco-editor-loader]")?Promise.resolve():new Promise((A,j)=>{const Y=document.createElement("script");Y.src="https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs/loader.js",Y.setAttribute("data-monaco-editor-loader","true"),Y.onload=()=>A(),Y.onerror=()=>j(new Error("Failed to load Monaco Editor loader")),document.head.appendChild(Y)}),h=()=>d||(window.monaco&&window.monaco.editor?(a=window.monaco,Promise.resolve(a)):(d=new Promise((B,A)=>{if(c){const j=setInterval(()=>{window.monaco&&window.monaco.editor&&(clearInterval(j),a=window.monaco,B(a))},50);return}c=!0,f().then(()=>p()).then(()=>{const j=setInterval(()=>{window.require&&(clearInterval(j),window.require.config({paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.54.0/min/vs"}}),window.require(["vs/editor/editor.main"],()=>{a=window.monaco,c=!1,B(a)},Y=>{c=!1,console.error("Failed to load Monaco Editor:",Y),A(Y)}))},50);setTimeout(()=>{clearInterval(j),c=!1,A(new Error("Monaco Editor loader not found"))},1e4)}).catch(j=>{c=!1,A(j)})}),d)),m=B=>{try{const A=document.createElement("div");A.innerHTML=B;const j=(z,K=0)=>{const q=" ".repeat(K);let re="";if(z.nodeType===Node.TEXT_NODE){const se=z.textContent.trim();return se&&(re+=q+se+`
107
107
  `),re}if(z.nodeType===Node.ELEMENT_NODE){const se=z.tagName.toLowerCase(),ve=Array.from(z.attributes).map(Ft=>`${Ft.name}="${Ft.value}"`).join(" "),pt=z.children.length>0;z.textContent.trim()&&!pt?re+=q+`<${se}${ve?" "+ve:""}>${z.textContent}</${se}>
108
108
  `:pt?(re+=q+`<${se}${ve?" "+ve:""}>
109
109
  `,Array.from(z.childNodes).forEach(Ft=>{re+=j(Ft,K+1)}),re+=q+`</${se}>