@opengis/widgets 0.0.36 → 0.0.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1666,7 +1666,7 @@ const ll = {
1666
1666
  class: "absolute bottom-3 left-3 z-[400] bg-white/90 border border-gray-200 rounded-md shadow px-3 py-2 text-[11px] sm:text-xs space-y-1 max-w-[220px]"
1667
1667
  }, ml = { class: "leading-tight" }, gl = {
1668
1668
  key: 4,
1669
- class: "bg-white absolute top-[10px] right-[10px] z-[500] border rounded-lg cursor-pointer"
1669
+ class: "bg-white absolute top-[10px] right-[10px] z-[500] border rounded-lg cursor-pointer max-w-[400px]"
1670
1670
  }, yl = { class: "flex items-center justify-between p-2 border-b" }, vl = { class: "p-2 border-b" }, bl = { class: "flex items-center" }, wl = ["value"], xl = { class: "ml-2" }, kl = { class: "p-2" }, _l = { class: "flex items-center" }, El = ["checked", "onChange"], Sl = { class: "ml-2" }, Wn = /* @__PURE__ */ ie({
1671
1671
  __name: "MapWidget",
1672
1672
  props: {
@@ -2019,7 +2019,7 @@ const ll = {
2019
2019
  v.push(y), T.add(y);
2020
2020
  const x = R[y];
2021
2021
  x && x.config.url !== c.url && (x.layer && p?.hasLayer(x.layer) && p.removeLayer(x.layer), x.layer = null);
2022
- const M = x?.visible ?? c.visible ?? c.overlay !== !1;
2022
+ const M = x?.visible ?? c.visible ?? !1;
2023
2023
  R[y] = {
2024
2024
  id: y,
2025
2025
  config: { ...c, id: y },
@@ -128,7 +128,7 @@
128
128
  *
129
129
  * This source code is licensed under the ISC license.
130
130
  * See the LICENSE file in the root directory of this source tree.
131
- */const rn=Y("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),or={class:"border-t pt-3 mt-4"},sr={class:"flex gap-2"},rr={class:"relative flex items-center justify-center shrink-0 overflow-hidden rounded-full h-5 w-5 bg-gray-200"},ir={class:"flex-1 space-y-2"},lr={class:"flex justify-between items-center"},ar={class:"flex gap-2"},cr=["disabled"],mo=e.defineComponent({__name:"CommentInputZone",props:{isReply:{type:Boolean,required:!1,default:!1},isReplyModifiers:{}},emits:e.mergeModels(["sendComment"],["update:isReply"]),setup(t,{emit:n}){const o=e.useModel(t,"isReply"),s=e.ref(""),r=n,l=()=>{s.value.trim()&&(r("sendComment",s.value),s.value="")},i=a=>{(a.ctrlKey||a.metaKey)&&a.key==="Enter"&&(a.preventDefault(),l())};return(a,c)=>(e.openBlock(),e.createElementBlock("div",or,[e.createElementVNode("div",sr,[e.createElementVNode("span",rr,[e.createVNode(e.unref(sn),{class:"h-3 w-3 text-gray-500"})]),e.createElementVNode("div",ir,[e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":c[0]||(c[0]=p=>s.value=p),onKeydown:i,placeholder:"Add a comment...",class:"w-full min-h-[60px] p-2 border border-gray-200 rounded text-xs resize-none focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-transparent"},null,544),[[e.vModelText,s.value]]),e.createElementVNode("div",lr,[c[4]||(c[4]=e.createElementVNode("span",{class:"text-xs text-gray-500 hidden sm:inline"},"Cmd+Enter to send",-1)),e.createElementVNode("div",ar,[o.value?(e.openBlock(),e.createElementBlock("button",{key:0,class:"inline-flex items-center justify-center gap-2 text-white whitespace-nowrap font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 bg-red-500 hover:bg-opacity-80 rounded-md h-6 text-xs px-2",onClick:c[1]||(c[1]=p=>o.value=!1)},[e.createVNode(e.unref(rn),{class:"h-3 w-3"}),c[2]||(c[2]=e.createTextVNode(" Cancel ",-1))])):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"inline-flex items-center justify-center gap-2 text-white whitespace-nowrap font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 bg-black text-primary-foreground hover:bg-opacity-80 rounded-md h-6 text-xs px-2",disabled:!s.value.trim(),onClick:l},[e.createVNode(e.unref(fo),{class:"h-3 w-3 mr-1"}),c[3]||(c[3]=e.createTextVNode(" Send ",-1))],8,cr)])])])])]))}}),dr={class:"z-50 min-w-32 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md w-32 outline-none pointer-events-auto"},pr=e.defineComponent({__name:"CommentDetails",props:{showMoreOptions:{type:Boolean,required:!0,default:!1},showMoreOptionsModifiers:{}},emits:e.mergeModels(["edit","delete"],["update:showMoreOptions"]),setup(t,{emit:n}){const o=n,s=e.useModel(t,"showMoreOptions"),r=e.ref(),l=e.ref(!0),i=async p=>{s.value&&r.value&&!r.value.contains(p.target)&&!l.value&&(s.value=!1),l.value=!1},a=()=>{s.value=!1,o("edit")},c=()=>{s.value=!1,o("delete")};return e.onMounted(()=>{document.addEventListener("click",i)}),e.onUnmounted(()=>{document.removeEventListener("click",i)}),(p,m)=>(e.openBlock(),e.createElementBlock("div",{class:"absolute bg-white left-0 top-full transform min-w-max z-50",ref_key:"moreOptionsRef",ref:r},[e.createElementVNode("div",dr,[e.createElementVNode("div",{class:"relative cursor-pointer flex select-none items-center gap-2 rounded-sm px-2 py-2 outline-hidden transition-colors disabled:pointer-events-none disabled:opacity-50 text-xs hover:bg-gray-100 transition-colors duration-300",onClick:a},[e.createVNode(e.unref(er),{class:"h-3 w-3 mr-2"}),m[0]||(m[0]=e.createTextVNode(" Edit ",-1))]),e.createElementVNode("div",{class:"relative cursor-pointer flex select-none items-center gap-2 rounded-sm px-2 py-2 outline-hidden transition-colors disabled:pointer-events-none disabled:opacity-50 text-xs text-red-600 hover:bg-gray-100 transition-colors duration-300",onClick:c},[e.createVNode(e.unref(on),{class:"h-3 w-3 mr-2"}),m[1]||(m[1]=e.createTextVNode(" Delete ",-1))])])],512))}}),fr={class:"space-y-2"},mr={class:"relative flex items-center justify-center shrink-0 overflow-hidden rounded-full h-5 w-5 bg-gray-200"},ur={class:"flex-1 min-w-0 space-y-1 relative"},hr={class:"flex items-center gap-2"},gr={class:"font-medium text-xs"},yr={class:"text-xs text-gray-500"},vr={key:0,class:"text-xs text-gray-700 leading-relaxed"},br={class:"flex justify-between text-xs"},kr={class:"flex items-center gap-2"},Er={key:0,class:"flex gap-2"},wr=["disabled"],Nr={key:0,class:"ml-8 space-y-1 border-l-2 border-gray-100 pl-3"},xr=e.defineComponent({__name:"CommentItem",props:{comment:{},isInside:{type:Boolean}},emits:["like","reply","edit","delete"],setup(t,{emit:n}){const o=n,s=t,r=e.ref(s.comment.text),l=e.ref("w-full p-2 rounded text-xs resize-none bg-transparent outline-none"),i=e.ref("w-full min-h-[60px] p-2 border border-gray-200 rounded text-xs resize-none focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-transparent"),a=e.ref(!1),c=e.ref(!1),p=e.ref(!1),m=e.ref(!1),f=w=>{const C=new Date,R=Math.floor((C.getTime()-w.getTime())/(1e3*60*60));return R<1?`${Math.floor((C.getTime()-w.getTime())/6e4)}m`:R<24?`${R}h`:`${Math.floor(R/24)}d`},u=()=>{m.value=!m.value,m.value?o("like",s.comment.id,"add"):o("like",s.comment.id,"delete")},k=()=>{o("edit",s.comment.id,r.value),p.value=!1},_=(w,C)=>{o("like",w,C)},x=(w,C)=>{o("edit",w,C)};return(w,C)=>{const R=e.resolveComponent("CommentItem",!0);return e.openBlock(),e.createElementBlock("div",fr,[e.createElementVNode("div",{class:e.normalizeClass(["group flex gap-2 p-2 rounded hover:bg-gray-50 transition-colors relative",p.value?"bg-gray-50":""])},[e.createElementVNode("span",mr,[e.createVNode(e.unref(sn),{class:"h-3 w-3 text-gray-500"})]),e.createElementVNode("div",ur,[e.createElementVNode("div",hr,[e.createElementVNode("span",gr,e.toDisplayString(w.comment?.author),1),e.createElementVNode("span",yr,e.toDisplayString(f(w.comment?.createdAt)),1)]),p.value?e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{key:1,"onUpdate:modelValue":C[0]||(C[0]=T=>r.value=T),class:e.normalizeClass(p.value?i.value:l.value)},null,2)),[[e.vModelText,r.value]]):(e.openBlock(),e.createElementBlock("p",vr,e.toDisplayString(w.comment?.text),1)),e.createElementVNode("div",br,[e.createElementVNode("div",kr,[e.createElementVNode("button",{class:e.normalizeClass(["flex items-center gap-1",m.value?"text-blue-600":"text-gray-500 hover:text-blue-600 transition-colors"]),onClick:C[1]||(C[1]=T=>u())},[e.createVNode(e.unref(Zs),{class:e.normalizeClass(["h-3 w-3",m.value?"fill-blue-600":""])},null,8,["class"]),e.createTextVNode(" "+e.toDisplayString(w.comment?.likes),1)],2),w.isInside?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"text-gray-500 hover:text-blue-600 transition-colors",onClick:C[2]||(C[2]=T=>c.value=!0)},[e.createVNode(e.unref(Qs),{class:"h-3 w-3"})])),e.createElementVNode("button",{class:"text-gray-400 hover:text-gray-600 transition-colors opacity-0 group-hover:opacity-100",type:"button",onClick:C[3]||(C[3]=T=>a.value=!0)},[e.createVNode(e.unref(Ks),{class:"h-3 w-3"})])]),p.value?(e.openBlock(),e.createElementBlock("div",Er,[e.createElementVNode("button",{class:"inline-flex items-center justify-center gap-2 text-white whitespace-nowrap font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 bg-red-500 hover:bg-opacity-80 rounded-md h-6 text-xs px-2",onClick:C[4]||(C[4]=T=>p.value=!1)},[e.createVNode(e.unref(rn),{class:"h-3 w-3"}),C[11]||(C[11]=e.createTextVNode(" Cancel ",-1))]),e.createElementVNode("button",{class:"inline-flex items-center justify-center gap-2 text-white whitespace-nowrap font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 bg-black text-primary-foreground hover:bg-opacity-80 rounded-md h-6 text-xs px-2",disabled:!r.value.trim(),onClick:C[5]||(C[5]=T=>k())},[e.createVNode(e.unref(fo),{class:"h-3 w-3 mr-1"}),C[12]||(C[12]=e.createTextVNode(" Send ",-1))],8,wr)])):e.createCommentVNode("",!0)])]),a.value?(e.openBlock(),e.createBlock(pr,{key:0,showMoreOptions:a.value,"onUpdate:showMoreOptions":C[6]||(C[6]=T=>a.value=T),onEdit:C[7]||(C[7]=T=>p.value=!0),onDelete:C[8]||(C[8]=T=>w.$emit("delete",w.comment?.id)),comment:w.comment},null,8,["showMoreOptions","comment"])):e.createCommentVNode("",!0)],2),w.isInside?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Nr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.comment?.replies,T=>(e.openBlock(),e.createBlock(R,{key:T.id,comment:T,isInside:!0,onDelete:D=>w.$emit("delete",T.id),onLike:_,onEdit:x},null,8,["comment","onDelete"]))),128)),c.value&&!w.isInside?(e.openBlock(),e.createBlock(mo,{key:0,onSendComment:C[9]||(C[9]=T=>w.$emit("reply",w.comment?.id,T)),isReply:c.value,"onUpdate:isReply":C[10]||(C[10]=T=>c.value=T)},null,8,["isReply"])):e.createCommentVNode("",!0)]))])}}}),_r=["id"],Cr={key:0,class:"text-xl font-semibold text-gray-900 mb-4"},wt=e.defineComponent({__name:"CommentsWidget",props:{title:{},comments:{},maxHeight:{},onAddComment:{type:Function},onReply:{type:Function},onLike:{type:Function},onDelete:{type:Function},onEdit:{type:Function},id:{},className:{},style:{}},emits:["add","reply","like","delete","edit"],setup(t,{emit:n}){const o=t,s=n,r=e.ref(o.comments??[]);async function l(){if(!o.id)return;const f=await fetch(`/api/widget/comment/${o.id}`).then(u=>u.json());r.value=f.rows.map(u=>({id:u.communication_id,author:u.username,text:u.body,createdAt:new Date(u.cdate)}))}r.value.length===0&&l();const i=async f=>{o.onAddComment?o.onAddComment(f):o.id&&(await fetch(`/api/widget/comment/${o.id}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:f})}),await l()),s("add",f)},a=(f,u)=>{o?.onLike?.(f,u),s("like",f,u)},c=(f,u)=>{o.onReply?.(f,u),s("reply",f,u)},p=async(f,u)=>{o.onEdit?o.onEdit(f,u):o.id&&(await fetch(`/api/widget/comment/${o.id}/${f}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:u})}),await l()),s("edit",f,u)},m=async f=>{o.onDelete?o.onDelete(f):o.id&&(await fetch(`/api/widget/comment/${o.id}/${f}`,{method:"DELETE"}),await l()),s("delete",f)};return(f,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["mx-auto font-sans",f.className]),id:f.id,style:e.normalizeStyle(f.style)},[f.title?(e.openBlock(),e.createElementBlock("h3",Cr,e.toDisplayString(f.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass([f.maxHeight?"overflow-y-auto":"","space-y-3"]),style:e.normalizeStyle({maxHeight:f.maxHeight+"px"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,k=>(e.openBlock(),e.createBlock(xr,{key:k.id,comment:k,onReply:c,onLike:a,onDelete:u[0]||(u[0]=_=>m(_)),onEdit:p},null,8,["comment"]))),128))],6),e.createVNode(mo,{onSendComment:u[1]||(u[1]=k=>i(k))})],14,_r))}}),uo=new Map([["file",{name:"File",color:"bg-green-100 text-green-700 border-green-200",icon:Ge}],["post",{name:"Post",color:"bg-blue-100 text-blue-700 border-blue-200",icon:Vs}],["user",{name:"User",color:"bg-purple-100 text-purple-700 border-purple-200",icon:tr}],["custom",{name:"Custom",color:"bg-gray-100 text-gray-700 border-gray-200",icon:Ys}]]),Sr={class:"mx-auto font-sans"},Br={key:0,class:"text-xl font-semibold text-gray-900 mb-4"},Tr={class:"relative"},$r={class:"space-y-3"},Dr={class:"flex-1 min-w-0 pb-2"},Lr={class:"flex items-center gap-1.5 mb-1 mt-0.5"},Or={class:"relative flex items-center justify-center shrink-0 overflow-hidden rounded-full h-5 w-5 bg-gray-200"},Ar={class:"font-medium text-xs"},Ir={class:"text-xs text-gray-500"},Mr={class:"space-y-1"},Rr={class:"text-xs text-gray-700"},Pr={class:"capitalize mr-1"},Fr={key:0,class:"inline-flex items-center rounded-full border py-0.5 font-semibold transition-colors text-foreground text-xs h-4 px-1 capitalize"},zr={key:0,class:"flex items-center gap-1 text-xs"},jr={key:0,class:"bg-red-50 text-red-600 px-1.5 py-0.5 rounded text-xs border border-red-200"},Hr={key:2,class:"bg-green-50 text-green-600 px-1.5 py-0.5 rounded text-xs border border-green-200"},Nt=e.defineComponent({__name:"HistoryWidget",props:{data:{},title:{},maxHeight:{},id:{},className:{},style:{}},setup(t){const n=t,o=e.ref(Array.isArray(n.data)?n.data:[]);o.value.length===0&&n.id&&s();async function s(){const r=await fetch(`/api/widget/history/${n.id}`);if(!r.ok)return{data:[]};const l=await r.json();l.rows.forEach(i=>{i.timestamp=new Date(i.cdate),i.id=i.entity_id,i.entityType=i.entity_type,i.entityId=i.entity_id,i.action=i.change_type,i.userId=i.change_user_id,i.userName=i.username,i.timestamp=new Date(i.cdate),i.description=i.username,i.status=i.username}),o.value=l.rows}return(r,l)=>(e.openBlock(),e.createElementBlock("div",Sr,[r.title?(e.openBlock(),e.createElementBlock("h3",Br,e.toDisplayString(r.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(r.maxHeight?"overflow-y-auto":""),style:e.normalizeStyle({maxHeight:r.maxHeight+"px"})},[e.createElementVNode("div",Tr,[l[0]||(l[0]=e.createElementVNode("div",{class:"absolute left-3 top-0 bottom-0 w-0.5 bg-gray-200"},null,-1)),e.createElementVNode("div",$r,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,i=>(e.openBlock(),e.createElementBlock("div",{class:"relative flex items-start gap-2",key:i?.id},[e.createElementVNode("div",{class:e.normalizeClass(`flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center border bg-white relative z-10 ${e.unref(uo).get(i?.entityType)?.color}`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(uo).get(i?.entityType)?.icon),{class:"h-3 w-3"}))],2),e.createElementVNode("div",Dr,[e.createElementVNode("div",Lr,[e.createElementVNode("span",Or,[e.createVNode(e.unref(sn),{class:"h-3 w-3 text-gray-500"})]),e.createElementVNode("span",Ar,e.toDisplayString(i?.userName),1),e.createElementVNode("span",Ir,e.toDisplayString(i?.timestamp.toLocaleDateString("ua-UA",{day:"2-digit",month:"2-digit",year:"numeric"}))+" "+e.toDisplayString(i?.timestamp.toLocaleTimeString("ua-UA",{hour:"2-digit",minute:"2-digit"})),1)]),e.createElementVNode("div",Mr,[e.createElementVNode("div",Rr,[e.createElementVNode("span",Pr,e.toDisplayString(i?.action),1),i?.entityId?(e.openBlock(),e.createElementBlock("span",Fr,e.toDisplayString(i?.entityId),1)):e.createCommentVNode("",!0)]),i?.changes?.[i?.entityId]?(e.openBlock(),e.createElementBlock("div",zr,[i?.changes?.[i?.entityId]?.old?(e.openBlock(),e.createElementBlock("span",jr,e.toDisplayString(i?.changes?.[i?.entityId]?.old),1)):e.createCommentVNode("",!0),i?.changes?.[i?.entityId]?.old&&i?.changes?.[i?.entityId]?.new?(e.openBlock(),e.createBlock(e.unref(qs),{key:1,class:"h-2 w-2 text-gray-400"})):e.createCommentVNode("",!0),i?.changes?.[i?.entityId]?.new?(e.openBlock(),e.createElementBlock("span",Hr,e.toDisplayString(i?.changes?.[i?.entityId]?.new),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])])]))),128))])])],6)]))}}),Ur={key:0,class:"text-xl font-semibold"},qr={class:"flex gap-1"},Wr={class:"ring-offset-background focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 border-input bg-background hover:bg-accent hover:text-accent-foreground border rounded-md text-xs h-7 px-2 cursor-pointer"},Kr=e.defineComponent({__name:"FileHeader",props:e.mergeModels({title:{}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["onAddFile"],["update:modelValue"]),setup(t){const n=e.useModel(t,"modelValue"),o={active:"bg-blue-100 text-black hover:bg-blue-100",inactive:"bg-white text-black hover:bg-blue-100"};return(s,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex flex-col sm:flex-row gap-3 mb-4",s.title?"justify-between sm:items-center":"justify-end sm:items-center"])},[s.title?(e.openBlock(),e.createElementBlock("h3",Ur,e.toDisplayString(s.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",qr,[e.createElementVNode("button",{class:e.normalizeClass(["ring-offset-background inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium transition-colors border-input border rounded-md text-xs h-7 px-2",n.value==="list"?o.active:o.inactive]),onClick:r[0]||(r[0]=l=>n.value="list")},[e.createVNode(e.unref(Xs),{class:"h-4 w-4"})],2),e.createElementVNode("button",{class:e.normalizeClass(["ring-offset-background inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium transition-colors border-input border rounded-md text-xs h-7 px-2",n.value==="grid"?o.active:o.inactive]),onClick:r[1]||(r[1]=l=>n.value="grid")},[e.createVNode(e.unref(Js),{class:"h-4 w-4"})],2),e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:r[2]||(r[2]=l=>s.$emit("onAddFile",l))},null,32),e.createElementVNode("div",Wr,[e.createVNode(e.unref(po),{class:"h-4 w-4"}),r[3]||(r[3]=e.createTextVNode(" Додати файл ",-1))])])])],2))}}),ln={pdf:{color:"bg-red-100 text-red-700 border-red-200",icon:Ge,label:"PDF"},sketch:{color:"bg-gray-100 text-gray-700 border-gray-200",icon:Gs,label:"SKETCH"},mp4:{color:"bg-purple-100 text-purple-700 border-purple-200",icon:nr,label:"VIDEO"},docx:{color:"bg-blue-100 text-blue-700 border-blue-200",icon:Ge,label:"DOC"},zip:{color:"bg-orange-100 text-orange-700 border-orange-200",icon:Us,label:"ARCHIVE"},png:{color:"bg-green-100 text-green-700 border-green-200",icon:co,label:"IMAGE"},jpg:{color:"bg-green-100 text-green-700 border-green-200",icon:co,label:"IMAGE"},xlsx:{color:"bg-emerald-100 text-emerald-700 border-emerald-200",icon:Ge,label:"EXCEL"},pptx:{color:"bg-amber-100 text-amber-700 border-amber-200",icon:Ge,label:"PPT"}};function ho(t,n="en"){const o={month:"short",day:"numeric"};return new Intl.DateTimeFormat(n,o).format(t)}function go(t){if(t===0)return"0 B";const n=1024,o=["B","KB","MB","GB","TB"],s=Math.floor(Math.log(t)/Math.log(n));return`${parseFloat((t/Math.pow(n,s)).toFixed(1))} ${o[s]}`}const Gr={class:"space-y-0.5"},Jr=["onClick"],Zr=["onClick"],Yr={class:"flex items-center gap-2"},Xr={class:"font-medium text-xs truncate hover:text-blue-600 cursor-pointer"},Qr={class:"hidden sm:block text-xs text-gray-500 w-16 text-right"},Vr={class:"hidden md:block text-xs text-gray-500 w-12 text-right"},ei={class:"flex items-center gap-1"},ti=["onClick"],ni=["onClick"],oi=e.defineComponent({__name:"FileList",props:{files:{}},emits:["delete","download","openLightbox"],setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",Gr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.files,s=>(e.openBlock(),e.createElementBlock("div",{class:"flex items-center gap-2 p-1.5 rounded hover:bg-gray-50 group border-b border-gray-100 last:border-b-0",key:s.id,onClick:e.withModifiers(r=>n.$emit("openLightbox",s),["stop"])},[e.createElementVNode("div",{class:e.normalizeClass(["p-1 rounded",e.unref(ln)[s?.ext]?.color||"bg-blue-100 text-blue-700 border-blue-200"])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(ln)[s?.ext]?.icon||e.unref(ln).pdf.icon),{class:"h-3 w-3"}))],2),e.createElementVNode("div",{class:"flex-1 min-w-0",onClick:r=>n.$emit("openLightbox",s)},[e.createElementVNode("div",Yr,[e.createElementVNode("span",Xr,e.toDisplayString(s?.uploaded_name||s?.name),1)])],8,Zr),e.createElementVNode("div",Qr,e.toDisplayString(e.unref(go)(s.size)),1),e.createElementVNode("div",Vr,e.toDisplayString(e.unref(ho)(s.createdAt)),1),e.createElementVNode("div",ei,[e.createElementVNode("button",{onClick:e.withModifiers(r=>n.$emit("download",s),["stop"]),class:"ring-offset-background focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover:bg-accent hover:text-accent-foreground rounded-md h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity"},[e.createVNode(e.unref(ao),{class:"h-3 w-3"})],8,ti),e.createElementVNode("button",{class:"ring-offset-background focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover:bg-accent rounded-md h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity text-red-600 hover:text-red-700",onClick:e.withModifiers(r=>n.$emit("delete",r,s?.file_id),["stop"])},[e.createVNode(e.unref(on),{class:"h-3 w-3"})],8,ni)])],8,Jr))),128))]))}}),si={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3"},ri=["onClick"],ii={class:"space-y-2"},li={class:"flex justify-center items-center w-full aspect-[4/3] bg-gray-100 rounded overflow-hidden"},ai=["src"],ci={class:"space-y-1"},di=["title"],pi={class:"text-xs text-gray-500 text-left"},fi={class:"absolute top-2 right-1 flex items-center gap-1"},mi=["onClick"],ui=["onClick"],hi=e.defineComponent({__name:"FileGrid",props:{files:{}},emits:["delete","download","openLightbox"],setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",si,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.files,s=>(e.openBlock(),e.createElementBlock("div",{key:s.id,onClick:e.withModifiers(r=>n.$emit("openLightbox",s),["stop"]),class:"group relative border rounded-lg p-2 hover:shadow-md transition-all bg-white hover:bg-gray-50 cursor-pointer"},[e.createElementVNode("div",ii,[e.createElementVNode("div",li,[s.ext==="png"||s.ext==="jpg"||s.ext==="jpeg"||s.ext==="gif"||s.ext==="svg"||s.ext==="webp"?(e.openBlock(),e.createElementBlock("img",{key:0,src:`/file/resize?filepath=${s?.file_path}&w=500`,alt:"file",class:"w-full h-full object-cover"},null,8,ai)):(e.openBlock(),e.createBlock(e.unref(Ge),{key:1,class:"h-10 w-10 text-gray-500"}))]),e.createElementVNode("div",ci,[e.createElementVNode("h3",{class:"font-medium text-xs leading-tight text-left",title:s.uploaded_name||s.name},e.toDisplayString(s.uploaded_name||s.name),9,di),e.createElementVNode("p",pi,e.toDisplayString(e.unref(ho)(s.createdAt))+", "+e.toDisplayString(e.unref(go)(s.size)),1)])]),e.createElementVNode("div",fi,[e.createElementVNode("button",{onClick:e.withModifiers(r=>n.$emit("download",s),["stop"]),class:"ring-offset-background focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover:bg-accent hover:text-accent-foreground rounded-md h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity hover:bg-red-50"},[e.createVNode(e.unref(ao),{class:"h-3 w-3"})],8,mi),e.createElementVNode("button",{class:"ring-offset-background focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 rounded-md h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity text-red-600 hover:text-red-700 hover:bg-red-50",onClick:e.withModifiers(r=>n.$emit("delete",r,s?.file_id),["stop"])},[e.createVNode(e.unref(on),{class:"h-3 w-3"})],8,ui)])],8,ri))),128))]))}}),gi={class:"mx-auto font-sans"},yi={key:1},xt=e.defineComponent({__name:"FilesWidget",props:{title:{},view:{},files:{default:()=>[]},maxHeight:{},onAddFile:{},id:{},className:{},style:{},onDelete:{}},emits:["delete","add","openLightbox"],setup(t,{emit:n}){const o=t,s=e.ref(!1),r=e.ref(null),l=e.ref(!1),i=e.ref(0),a=e.ref(o.files??[]),c=n;a.value.length===0&&C();const p=(D,B)=>{r.value=B,s.value=!0},m=()=>{r.value&&(_(r.value),r.value=null,s.value=!1)},f=e.computed(()=>Array.isArray(a.value)?a.value.map(D=>D?.file_path):[]),u=D=>{const B=f.value.findIndex(H=>H===D.file_path);B!==-1&&(l.value=!0,i.value=B)},k=D=>{o.onAddFile?o.onAddFile(D):R(D),c("add",D)},_=D=>{o.onDelete?o.onDelete(D):T(D),c("delete",D)},x=D=>{const B=document.createElement("a");B.setAttribute("download",D?.uploaded_name||D?.name),B.href=D?.file_path||D?.path,B.click()},w=e.ref("list");async function C(){if(!o.id)return;const D=await fetch(`/api/widget/file/${o.id}`).then(B=>B.json());D.rows.forEach(B=>{B.timestamp=new Date(B.cdate),B.id=B.entity_id,B.entityType=B.entity_type,B.entityId=B.entity_id,B.entityType=B.entity_type,B.action=B.change_type,B.userId=B.change_user_id,B.userName=B.username,B.timestamp=new Date(B.cdate),B.description=B.username,B.status=B.username}),a.value=D.rows}const R=async D=>{if(!(!D.target||!D.target.files||D.target.files.length===0))try{await Promise.all(Array.from(D.target.files).map(async B=>{const H=new FormData;H.append("file",B);const K=`/api/widget/file/${o.id}`,M=await fetch(K,{method:"POST",body:H});if(!M.ok)throw new Error(`HTTP error! status: ${M.status}`);return B})),await C()}catch(B){console.error("Помилка при завантаженні файлів:",B)}},T=async D=>{try{await fetch(`/api/widget/file/${o.id}/${D}`,{method:"DELETE"}),await C()}catch(B){console.error(B)}};return(D,B)=>{const H=e.resolveComponent("MessageBox"),K=e.resolveComponent("Lightbox");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",gi,[e.createVNode(Kr,{modelValue:w.value,"onUpdate:modelValue":B[0]||(B[0]=M=>w.value=M),title:o.title,onOnAddFile:B[1]||(B[1]=M=>k(M))},null,8,["modelValue","title"]),a.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(D.maxHeight?"overflow-y-auto":""),style:e.normalizeStyle({maxHeight:D.maxHeight+"px"})},[w.value==="list"?(e.openBlock(),e.createBlock(oi,{key:0,onDelete:p,onDownload:x,onOpenLightbox:B[2]||(B[2]=M=>u(M)),files:a.value},null,8,["files"])):e.createCommentVNode("",!0),w.value==="grid"?(e.openBlock(),e.createBlock(hi,{key:1,onDelete:p,onDownload:x,onOpenLightbox:B[3]||(B[3]=M=>u(M)),files:a.value},null,8,["files"])):e.createCommentVNode("",!0)],6)):(e.openBlock(),e.createElementBlock("div",yi,B[6]||(B[6]=[e.createElementVNode("div",{class:"flex items-center justify-center h-full"},[e.createElementVNode("p",{class:"text-gray-500 leading-[3]"},"Файлів не знайдено")],-1)])))]),e.createVNode(H,{modelValue:s.value,"onUpdate:modelValue":B[4]||(B[4]=M=>s.value=M),onConfirm:m,title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати"},null,8,["modelValue"]),e.createVNode(K,{modelValue:l.value,"onUpdate:modelValue":B[5]||(B[5]=M=>l.value=M),images:f.value,"start-index":i.value},null,8,["modelValue","images","start-index"])],64)}}}),vi={key:0,class:"image-wrapper h-full max-h-[400px]",id:"lightbox-gallery"},bi=["onClick"],ki={key:0,rel:"noreferrer",class:"relative block h-full w-full"},Ei=["src"],wi={key:0,class:"thumb-cover"},Ni=e.defineComponent({__name:"GalleryContent",props:{title:{},items:{},columns:{},maxHeight:{},onAddImage:{type:Function},onDelete:{type:Function},id:{},className:{},style:{}},emits:["delete"],setup(t,{emit:n}){const o=n,s=e.ref(!1),r=e.ref(0),l=t,i=e.computed(()=>Array.isArray(l.items)?l.items.map(c=>c?.file_path):[]),a=c=>{const p=i.value.findIndex(m=>m===c.file_path);p!==-1&&(s.value=!0,r.value=p)};return(c,p)=>{const m=e.resolveComponent("Lightbox");return c.items?.length>=1?(e.openBlock(),e.createElementBlock("div",vi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.items,(f,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["h-full w-full image"+u,"cursor-pointer bg-teal-500 rounded-[3px]"]),key:u,onClick:e.withModifiers(k=>a(f),["stop"])},[u<5?(e.openBlock(),e.createElementBlock("div",ki,[e.createElementVNode("img",{src:`/file/resize?filepath=${f?.file_path}&w=500`,alt:"alt",height:"auto",width:"100%",class:e.normalizeClass(["object-cover h-full w-full bg-gray-200 rounded-[3px]",u===0?"max-h-[411px]":"max-h-[calc((411px-3px)/2)]"])},null,10,Ei),u===4&&c.items?.length>5?(e.openBlock(),e.createElementBlock("div",wi," +"+e.toDisplayString(c.items?.length-5),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],10,bi))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Math.max(0,5-c.items.length),f=>(e.openBlock(),e.createElementBlock("div",{key:"empty-"+f,class:e.normalizeClass(["h-full w-full image"+(c.items.length+f-1),"bg-gray-300 rounded-[3px]"])},null,2))),128)),e.createVNode(m,{modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=f=>s.value=f),images:i.value,"start-index":r.value,delete:"true",download:"true",onDelete:p[1]||(p[1]=f=>o("delete",f))},null,8,["modelValue","images","start-index"])])):e.createCommentVNode("",!0)}}}),xi={key:0,class:"text-xl font-semibold"},_i={class:"flex gap-1"},Ci={class:"ring-offset-background focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 border-input bg-background hover:bg-accent hover:text-accent-foreground border rounded-md text-xs h-7 px-2 cursor-pointer"},Si=e.defineComponent({__name:"widgetHeader",props:{title:{}},emits:["onAddImage"],setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex flex-col sm:flex-row gap-3 mb-4",n.title?"justify-between sm:items-center":"justify-end sm:items-center"])},[n.title?(e.openBlock(),e.createElementBlock("h3",xi,e.toDisplayString(n.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",_i,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:o[0]||(o[0]=s=>n.$emit("onAddImage",s))},null,32),e.createElementVNode("div",Ci,[e.createVNode(e.unref(po),{class:"h-4 w-4"}),o[1]||(o[1]=e.createTextVNode(" Додати зображення ",-1))])])])],2))}}),Bi={class:"w-full mx-auto font-sans",ref:"containerRef"},Ti={key:1},_t=e.defineComponent({__name:"GalleryWidget",props:{title:{},items:{default:()=>[]},columns:{},maxHeight:{},onAddImage:{},onDelete:{},id:{},className:{},style:{}},emits:["delete","add","openLightbox"],setup(t,{emit:n}){const o=t,s=e.ref(o.items??[]),r=n;s.value.length===0&&c();const l=m=>{o.onAddImage?o.onAddImage(m):a(m),r("add",m)},i=m=>{const f=s.value.find(u=>u.file_path===m)?.file_id;f&&(o.onDelete?o.onDelete(f):p(f))},a=async m=>{if(!(!m.target||!m.target.files||m.target.files.length===0))try{await Promise.all(Array.from(m.target.files).map(async f=>{const u=new FormData;u.append("file",f);const k=`/api/widget/file/${o.id}`,_=await fetch(k,{method:"POST",body:u});if(!_.ok)throw new Error(`HTTP error! status: ${_.status}`);return f})),await c()}catch(f){console.error("Помилка при завантаженні файлів:",f)}};async function c(){if(!o.id)return;const m=await fetch(`/api/widget/file/${o.id}`).then(f=>f.json());s.value=m.rows}const p=async m=>{try{await fetch(`/api/widget/file/${o.id}/${m}`,{method:"DELETE"}),await c()}catch(f){console.error(f)}};return(m,f)=>(e.openBlock(),e.createElementBlock("div",Bi,[e.createVNode(Si,{title:m.title,onOnAddImage:f[0]||(f[0]=u=>l(u))},null,8,["title"]),s.value.length>0?(e.openBlock(),e.createBlock(Ni,{key:0,items:s.value,onDelete:f[1]||(f[1]=u=>i(u))},null,8,["items"])):(e.openBlock(),e.createElementBlock("div",Ti,f[2]||(f[2]=[e.createElementVNode("div",{class:"flex items-center justify-center h-full"},[e.createElementVNode("p",{class:"text-gray-500 leading-[3]"},"Зображень не знайдено")],-1)])))],512))}}),$i={class:"text-value"},Di={class:"text-sm text-gray-900"},Li=e.defineComponent({__name:"TextValue",props:{item:{}},setup(t){const n=t,o=e.computed(()=>{const s=n.item.value;return typeof s=="boolean"?s?"Так":"Ні":s==null?"—":String(s)});return(s,r)=>(e.openBlock(),e.createElementBlock("div",$i,[e.createElementVNode("span",Di,e.toDisplayString(o.value),1)]))}}),Re=(t,n)=>{const o=t.__vccOpts||t;for(const[s,r]of n)o[s]=r;return o},Oi=Re(Li,[["__scopeId","data-v-34a76c89"]]),Ai={class:"link-value"},Ii=["href"],Mi=Re(e.defineComponent({__name:"LinkValue",props:{item:{}},setup(t){const n=t,o=e.computed(()=>{const s=String(n.item.value);try{const r=new URL(s);return r.hostname+r.pathname}catch{return s}});return(s,r)=>(e.openBlock(),e.createElementBlock("div",Ai,[e.createElementVNode("a",{href:String(s.item.value),target:"_blank",rel:"noopener noreferrer",class:"text-blue-600 hover:text-blue-800 underline text-sm"},[e.createTextVNode(e.toDisplayString(o.value)+" ",1),r[0]||(r[0]=e.createElementVNode("i",{class:"fas fa-external-link-alt ml-1 text-xs"},null,-1))],8,Ii)]))}}),[["__scopeId","data-v-932f028c"]]),Ri={class:"date-value"},Pi={class:"text-sm text-gray-900"},Fi=Re(e.defineComponent({__name:"DateValue",props:{item:{}},setup(t){const n=t,o=e.computed(()=>{const s=n.item.value;if(s instanceof Date)return s.toLocaleDateString("uk-UA",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"});if(typeof s=="string"){const r=new Date(s);if(!isNaN(r.getTime()))return r.toLocaleDateString("uk-UA",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})}return String(s)});return(s,r)=>(e.openBlock(),e.createElementBlock("div",Ri,[e.createElementVNode("span",Pi,e.toDisplayString(o.value),1)]))}}),[["__scopeId","data-v-cd4df08e"]]),zi={class:"status-value"},ji={key:0,class:"mr-1"},Hi=Re(e.defineComponent({__name:"StatusValue",props:{item:{}},setup(t){const n=t,o=e.computed(()=>{switch(String(n.item.value).toLowerCase()){case"active":case"активний":case"успішно":case"success":return"bg-green-100 text-green-800";case"inactive":case"неактивний":case"pending":case"очікує":return"bg-yellow-100 text-yellow-800";case"error":case"помилка":case"failed":case"неуспішно":return"bg-red-100 text-red-800";case"draft":case"чернетка":return"bg-gray-100 text-gray-800";default:return"bg-blue-100 text-blue-800"}}),s=e.computed(()=>{switch(String(n.item.value).toLowerCase()){case"active":case"активний":case"успішно":case"success":return"fas fa-check-circle";case"inactive":case"неактивний":case"pending":case"очікує":return"fas fa-clock";case"error":case"помилка":case"failed":case"неуспішно":return"fas fa-exclamation-circle";case"draft":case"чернетка":return"fas fa-edit";default:return"fas fa-info-circle"}});return(r,l)=>(e.openBlock(),e.createElementBlock("div",zi,[e.createElementVNode("span",{class:e.normalizeClass(["inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",o.value])},[s.value?(e.openBlock(),e.createElementBlock("span",ji,[e.createElementVNode("i",{class:e.normalizeClass(s.value)},null,2)])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(String(r.item.value)),1)],2)]))}}),[["__scopeId","data-v-aea1f529"]]),Ui={class:"custom-value"},qi={class:"text-sm text-gray-900"},Wi=Re(e.defineComponent({__name:"CustomValue",props:{item:{}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",Ui,[e.renderSlot(n.$slots,"default",{item:n.item,value:n.item.value},()=>[e.createElementVNode("span",qi,e.toDisplayString(String(n.item.value)),1)],!0)]))}}),[["__scopeId","data-v-12c8b3f3"]]),Ki=["id"],Gi={key:0,class:"text-xl font-semibold text-gray-900 mb-4"},Ji={key:1,class:"overflow-x-auto"},Zi={class:"min-w-full divide-y divide-gray-200"},Yi={class:"bg-white divide-y divide-gray-200"},Xi={class:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"},Qi={class:"flex items-center gap-2"},Vi=["title"],el={class:"px-6 py-4 whitespace-nowrap text-sm text-gray-500"},tl={key:2,class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"},nl={class:"flex items-start gap-3"},ol={key:0,class:"flex-shrink-0"},sl={class:"flex-1 min-w-0"},rl={class:"flex items-center gap-2 mb-2"},il={class:"text-sm font-medium text-gray-900"},ll=["title"],al={key:3,class:"overflow-x-auto"},cl={class:"min-w-full divide-y divide-gray-200"},dl={class:"bg-white divide-y divide-gray-200"},pl={class:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"},fl={class:"flex items-center gap-2"},ml=["title"],ul={class:"px-6 py-4 whitespace-nowrap text-sm text-gray-500"},an=Re(e.defineComponent({__name:"DescriptionListWidget",props:{title:{},items:{},view:{},id:{},className:{},style:{}},setup(t){const n=o=>{switch(o.type){case"link":return Mi;case"date":return Fi;case"status":return Hi;case"custom":return Wi;default:return Oi}};return(o,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["description-list-widget",o.className]),id:o.id,style:e.normalizeStyle(o.style)},[o.title?(e.openBlock(),e.createElementBlock("h3",Gi,e.toDisplayString(o.title),1)):e.createCommentVNode("",!0),o.view==="table"?(e.openBlock(),e.createElementBlock("div",Ji,[e.createElementVNode("table",Zi,[e.createElementVNode("tbody",Yi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.items,r=>(e.openBlock(),e.createElementBlock("tr",{key:r.id||r.label},[e.createElementVNode("td",Xi,[e.createElementVNode("div",Qi,[r.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass([r.icon,"text-gray-500"])},null,2)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(r.label)+" ",1),r.tooltip?(e.openBlock(),e.createElementBlock("span",{key:1,class:"text-gray-400 cursor-help",title:r.tooltip},s[0]||(s[0]=[e.createElementVNode("i",{class:"fas fa-info-circle text-xs"},null,-1)]),8,Vi)):e.createCommentVNode("",!0)])]),e.createElementVNode("td",el,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])]))),128))])])])):o.view==="grid"?(e.openBlock(),e.createElementBlock("div",tl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.items,r=>(e.openBlock(),e.createElementBlock("div",{key:r.id||r.label,class:"description-item-card bg-white border border-gray-200 rounded-lg p-4"},[e.createElementVNode("div",nl,[r.icon?(e.openBlock(),e.createElementBlock("div",ol,[e.createElementVNode("i",{class:e.normalizeClass([r.icon,"text-gray-500 text-lg"])},null,2)])):e.createCommentVNode("",!0),e.createElementVNode("div",sl,[e.createElementVNode("div",rl,[e.createElementVNode("h4",il,e.toDisplayString(r.label),1),r.tooltip?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-gray-400 cursor-help",title:r.tooltip},s[1]||(s[1]=[e.createElementVNode("i",{class:"fas fa-info-circle text-xs"},null,-1)]),8,ll)):e.createCommentVNode("",!0)]),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])])]))),128))])):(e.openBlock(),e.createElementBlock("div",al,[e.createElementVNode("table",cl,[e.createElementVNode("tbody",dl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.items,r=>(e.openBlock(),e.createElementBlock("tr",{key:r.id||r.label},[e.createElementVNode("td",pl,[e.createElementVNode("div",fl,[r.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass([r.icon,"text-gray-500"])},null,2)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(r.label)+" ",1),r.tooltip?(e.openBlock(),e.createElementBlock("span",{key:1,class:"text-gray-400 cursor-help",title:r.tooltip},s[2]||(s[2]=[e.createElementVNode("i",{class:"fas fa-info-circle text-xs"},null,-1)]),8,ml)):e.createCommentVNode("",!0)])]),e.createElementVNode("td",ul,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])]))),128))])])]))],14,Ki))}}),[["__scopeId","data-v-106790ef"]]),hl={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 yo(t){return t?t.type==="FeatureCollection"||t.type==="Feature"?t:t.geom?{type:"Feature",geometry:{type:t.geom.type,coordinates:t.geom.coordinates},properties:{}}:t.type&&t.coordinates?{type:"Feature",geometry:t,properties:{}}:null:null}const gl={key:0,class:"absolute inset-0 z-[600] flex items-center justify-center pointer-events-none bg-black/20"},yl={class:"bg-black/70 text-white text-xs sm:text-sm px-4 py-2 rounded-md shadow"},vl={class:"bg-white/95 border border-gray-200 rounded-md shadow-xl px-3 py-2 max-w-[240px] text-[11px] sm:text-xs text-gray-900"},bl={class:"space-y-0.5"},kl={class:"text-gray-500"},El={class:"text-gray-900 text-right break-all"},wl={key:2,class:"absolute bottom-3 left-3 z-[400] bg-white/90 border border-gray-200 rounded-md shadow px-3 py-2 text-[11px] sm:text-xs space-y-1 max-w-[220px]"},Nl={class:"leading-tight"},xl={key:4,class:"bg-white absolute top-[10px] right-[10px] z-[500] border rounded-lg cursor-pointer"},_l={class:"flex items-center justify-between p-2 border-b"},Cl={class:"p-2 border-b"},Sl={class:"flex items-center"},Bl=["value"],Tl={class:"ml-2"},$l={class:"p-2"},Dl={class:"flex items-center"},Ll=["checked","onChange"],Ol={class:"ml-2"},Ct=e.defineComponent({__name:"MapWidget",props:{pattern:{},geom:{},id:{},katottg:{},tms:{},layers:{},title:{},height:{},bounds:{},legend:{}},setup(t){function n(h){let y=h?.parent??null;for(;y;){const S=y.props?.view;if(S==="tabs"||S==="vertical-tabs")return!0;y=y.parent??null}return!1}const o=t,s=e.getCurrentInstance(),r=e.inject("vsCardTabsContext",!1),l=e.computed(()=>(typeof r=="boolean"?r:r.value)?!0:n(s)),i=s?.appContext.config.globalProperties?.$settings??{},a=(()=>{const h=Array.isArray(i.center)?i.center:[],y=Number(h[0]),S=Number(h[1]);return Number.isFinite(y)&&Number.isFinite(S)?[y,S]:[50,30]})(),c=s?.uid??Math.floor(Math.random()*1e4),p=e.ref(null);let m,f,u,k;const _=be(),x=e.ref(Object.keys(_)[0]),w=`base-layer-${c}`;let C;const R=e.ref(!0),T=e.ref(!1),D=e.ref(!1),B=e.ref(!1),H=e.ref("Використовуйте Ctrl + колесо миші для зміни масштабу");let K=null;const M=e.ref([]),I=e.reactive({}),F=e.ref([]),z=e.computed(()=>F.value.map(h=>I[h]).filter(Boolean)),E=e.ref(null),$=e.computed(()=>E.value?.entries??[]),N=e.computed(()=>{if(!E.value)return;const h=12,y=E.value.point.x+h,S=E.value.point.y+h;return{left:`${y}px`,top:`${S}px`}}),L=e.computed(()=>Array.isArray(o.legend)?o.legend.map((h,y)=>{const S=typeof h?.color=="string"?h.color.trim():"",d=typeof h?.label=="string"?h.label.trim():"";return!S||!d?null:{color:S,label:d,key:`${d}-${y}`}}).filter(h=>!!h):[]),J=e.computed(()=>{if(T.value)return"fixed inset-0 w-screen h-screen z-[9999] bg-white";const h=["relative","h-full"];return o.height||h.push("min-h-[300px]"),o.title&&!l.value&&h.push("pb-[3.25rem]"),h.join(" ")}),ae=e.computed(()=>T.value||o.height==null?void 0:{height:typeof o.height=="number"?`${o.height}px`:String(o.height)}),Me=e.computed(()=>{const h=["w-full","h-full"];return!o.height&&!T.value&&h.push("min-h-[300px]"),h.join(" ")});async function Be(){const h=d=>{if(!Array.from(document.styleSheets??[]).some(g=>g?.href?.includes(d))){const g=document.createElement("link");g.rel="stylesheet",g.href=d,document.head.appendChild(g)}};h("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),h("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css");const y=d=>new Promise((v,g)=>{if(Array.from(document.scripts??[]).some(P=>P.src===d))return v();const A=document.createElement("script");A.src=d,A.async=!0,A.onload=()=>v(),A.onerror=P=>g(P),document.body.appendChild(A)});return await y("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").catch(()=>{}),await y("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js").catch(()=>{}),await y("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js").catch(()=>{}),window.L}function be(){const h=y=>y.map((S,d)=>{const v=typeof S?.key=="string"&&S.key?S.key:`b${d}`,g=Ne(S?.url);return g?{...S,key:v,url:g}:null}).filter(S=>!!S).reduce((S,d)=>({...S,[d.key]:d}),{});return Array.isArray(i?.basemaps)&&i.basemaps.length?h(i.basemaps):h([{key:"topo100",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png"},{key:"orto10",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png"},{key:"osmb",url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png"}])}function Ne(h){if(typeof h!="string"||!h.trim())return"";const y=h.trim();if(/^https?:\/\//i.test(y))return y;const S=window.location?.origin??"",d=y.replace(/^\/+/,"");return S?`${S}/${d}`:`/${d}`}function xe(h,y){return h?.id!=null?String(h.id):h?.url?`${h.url}-${y}`:`layer-${y}`}function Xn(h){if(!h||typeof h!="object")return;const y={},S=b=>{if(typeof b=="string"){const O=b.trim().replace(/,+$/,"");return O?/^-?\d+(\.\d+)?$/.test(O)?Number(O):O:void 0}return b},d=()=>(y.colorSet||(y.colorSet={}),y.colorSet),v=(b,O)=>{if(b==null||typeof O!="string")return;const A=O.trim().replace(/,+$/,"");A&&(d()[String(b)]=A)},g=b=>{const O=["color","fill","hex","valueColor","value_color"].map(P=>b[P]).find(P=>typeof P=="string"&&P.trim());if(!O)return!1;const A=["value","key","id","code","status"].map(P=>b[P]).find(P=>P!=null&&P!=="");return A==null?!1:(v(A,O),!0)};return Object.entries(h).forEach(([b,O])=>{if(b==="colorSet"&&O!=null){Array.isArray(O)?O.forEach(P=>{P&&(typeof P=="object"&&g(P)||typeof P=="object"&&Object.entries(P).forEach(([V,ke])=>v(V,typeof ke=="string"?ke:void 0)))}):typeof O=="object"&&(g(O)||Object.entries(O).forEach(([P,V])=>v(P,typeof V=="string"?V:void 0)));return}const A=S(O);if(A!==void 0){if(b==="border"){typeof A=="number"&&y.width==null?y.width=A:typeof A=="string"&&y.stroke==null&&(y.stroke=A);return}y[b]=A}}),y.colorSet&&!Object.keys(y.colorSet).length&&delete y.colorSet,Object.keys(y).length?y:void 0}function Qn(){if(Array.isArray(o.layers)&&o.layers.length)return o.layers.map((y,S)=>{if(!y)return null;const d=xe(y,S),v=y.url||(o.pattern&&d?o.pattern.replace("{{id}}",String(y.id??d)):"");return v?{...y,id:d,url:v,name:y.name||`Шар ${S+1}`,style:Xn(y.style)}:null}).filter(y=>!!y?.url);const h=Array.isArray(o.tms)?o.tms:o.tms?.split(",");return h?h.map((y,S)=>{if(!y)return null;const d=typeof y=="string"?y.trim():`${y}`;if(!d)return null;const v=`legacy-${S}`,g=o.pattern?o.pattern.replace("{{id}}",d):d;return{id:v,name:`Шар ${S+1}`,url:g,visible:!0}}).filter(y=>!!y?.url):[]}function ht(h){const y=(h?.url??"").trim();if(!y)return"";if(/^https?:\/\//i.test(y))return y;const S=window.location?.origin??"",d=y.replace(/^\/+/,"");return`${S}/${d}`}function Zt(h){const y=h.style??{};return S=>{const d=y.colorAttr,v=y.colorSet??{},g=typeof d=="string"?v?.[S?.[d]]??y.color??"#3388ff":y.color??"#3388ff",b=y.stroke??g;return{weight:y.width??1,color:b,opacity:y.opacity??1,fill:y.type?y.type!=="polyline":!0,fillColor:g,fillOpacity:y.opacity??.5}}}function Yt(h,y){if(!m||!y?.latlng||h.popup===!1)return;const S=m.latLngToContainerPoint(y.latlng),d=gt(y),v=Xt(h,d);if(!v.length){tt(h.id);return}E.value={layerId:h.id,title:d?.name??h.name,properties:d,entries:v,point:{x:S.x,y:S.y}}}function tt(h){h&&E.value?.layerId!==h||(E.value=null)}function gt(h){return h?.layer?.properties||h?.layer?.feature?.properties||h?.properties||h?.data||{}}function Xt(h,y={}){const S=d=>d==null||d===""?"—":typeof d=="object"?JSON.stringify(d):String(d);return h.popup&&Array.isArray(h.popup)&&h.popup.length?h.popup.map(d=>({label:d.label||d.field,value:S(y?.[d.field])})):Object.entries(y).map(([d,v])=>({label:d,value:S(v)}))}function Vn(h,y){if(!m||h.popup===!1||!y?.latlng)return;const S=gt(y),d=Xt(h,S);if(!d.length)return;const v=['<div class="map-popup">'];v.push('<div class="map-popup__body">'),d.forEach(g=>{v.push(`<div class="map-popup__row"><span class="map-popup__label">${g.label}: </span><span class="map-popup__value">${g.value}</span></div>`)}),v.push("</div></div>"),k.popup({maxWidth:360}).setLatLng(y.latlng).setContent(v.join("")).openOn(m)}e.onMounted(async()=>{k=await Be(),k.drawLocal={...hl};const h=typeof i?.zoom=="number"&&Number.isFinite(i.zoom)?i.zoom:10;m=k.map(p.value,{zoomControl:!1}).setView(a,h),k.control.zoom({position:"bottomright"}).addTo(m),C=k.tileLayer(_[x.value].url,{maxZoom:19}).addTo(m),f=new k.FeatureGroup().addTo(m),bt(),We(),K=tn();const y=yo(o.geom);if(y){const S=[];k.geoJSON(y).eachLayer(d=>S.push(d)),S.length&&f.addLayer(S[0]),kt()}if(p.value){const S=new ResizeObserver(()=>{m&&m.invalidateSize()});S.observe(p.value),e.onBeforeUnmount(()=>{S.disconnect()})}});function eo(){if(!f)return;f.clearLayers();const h=yo(o.geom);if(!h)return;const y=[];k.geoJSON(h).eachLayer(S=>y.push(S)),y.length&&(y.forEach(S=>f.addLayer(S)),kt())}e.onBeforeUnmount(()=>{K?.(),no(),u&&m?.hasLayer(u)&&m.removeLayer(u)});function Te(h){const y=(h?.service??"").toLowerCase();if(y)return y;const S=(h?.url??"").toLowerCase();return/\.(mvt|pbf|vtile|vmt)(\?|$)/.test(S)?"vtile":/service=wms|request=getmap|\/(wms|ows)(\?|$)/.test(S)?"wms":""}function Qt(h){const y=Te(h),S=ht(h),v={opacity:h?.style?.opacity??1,...h.options??{}},g=!!(h?.style&&Object.keys(h.style).length),b=h.sourceLayer||h.layer||h.service_layer||h.service_key||h.map_key||h.dataset?.layer||h.id;if(y==="vtile"){const O=k?.vectorGrid;if(O?.protobuf&&(g||!k?.maplibreGL)){const A=O.protobuf(S,{interactive:!0,maxNativeZoom:h.maxzoom??19,vectorTileLayerStyles:{[b??"default"]:Zt(h),default:Zt(h)}});return A.on?.("mouseover",P=>Yt(h,P)),A.on?.("mousemove",P=>Yt(h,P)),A.on?.("mouseout",()=>tt(h.id)),A.on?.("click",P=>Vn(h,P)),A}if(!g&&k?.maplibreGL&&window?.maplibregl){const A=S;return k.maplibreGL({style:A,interactive:!1,pane:"overlayPane"})}}if(y==="wms"&&k?.tileLayer?.wms){const O={...h.params??{}};return b&&!O.layers&&(O.layers=b),O.format==null&&(O.format="image/png"),O.transparent==null&&(O.transparent=!0),k.tileLayer.wms(S,{...O,...v})}return k.tileLayer(S,v)}function yt(h){const y=("bounds"in h?h.bounds:void 0)??o.bounds??M.value;if(!Array.isArray(y)||!y.length||!k)return null;const d={color:h.style?.stroke??h.style?.color??"#2563eb",weight:h.style?.width??2,interactive:!1,opacity:h.style?.opacity??.8,dashArray:"4 4"},v=Array.isArray(h.bounds)&&h.bounds.length?h.bounds:y,g=to(v);if(!g.length||!k.polyline)return null;const b=g.map(O=>{if(!O.length)return O;const A=O[0],P=O[O.length-1];return A&&P&&(!P.equals||!P.equals(A))?[...O,A]:O});return k.polyline(b,d)}function to(h){const y=v=>{if(!Array.isArray(v)||v.length<2)return null;const[g,b]=v;return!Number.isFinite(Number(b))||!Number.isFinite(Number(g))?null:k.latLng(Number(b),Number(g))},S=v=>Array.isArray(v)&&v.length>=2&&v.every(g=>Number.isFinite(Number(g))),d=v=>Array.isArray(v)?v.map(y).filter(Boolean):[];if(!Array.isArray(h))return[];if(h.length&&S(h[0])){const v=h.map(y).filter(Boolean);return v.length?[v]:[]}if(h.length&&Array.isArray(h[0])){if(S(h[0][0]))return h.map(g=>d(g)).filter(g=>g.length);if(Array.isArray(h[0][0])&&S(h[0][0][0]))return h.flatMap(g=>Array.isArray(g)?g.map(b=>d(b)).filter(b=>b.length):[]).filter(g=>g.length)}return[]}function no(){Object.values(I).forEach(h=>{h.layer&&m?.hasLayer(h.layer)&&m.removeLayer(h.layer),h.boundsLayer&&m?.hasLayer(h.boundsLayer)&&m.removeLayer(h.boundsLayer),h.layer=null,h.boundsLayer=null}),tt()}function We(){if(!m)return;u&&m.hasLayer(u)&&m.removeLayer(u);const h=yt({id:"global-bounds",bounds:o.bounds,style:{}});h?(u=h,u.addTo(m)):u=null}function vt(){m&&F.value.forEach(h=>{const y=I[h];y&&(y.visible?(y.layer||(y.layer=Qt(y.config)),y.boundsLayer||(y.boundsLayer=yt(y.config)),y.layer&&!m.hasLayer(y.layer)&&y.layer.addTo(m),y.boundsLayer&&!m.hasLayer(y.boundsLayer)&&y.boundsLayer.addTo(m)):(y.layer&&m.hasLayer(y.layer)&&m.removeLayer(y.layer),y.boundsLayer&&m.hasLayer(y.boundsLayer)&&m.removeLayer(y.boundsLayer)))})}function bt(){const h=Qn(),y=[],S=new Set;h.forEach((d,v)=>{const g=xe(d,v);y.push(g),S.add(g);const b=I[g];b&&b.config.url!==d.url&&(b.layer&&m?.hasLayer(b.layer)&&m.removeLayer(b.layer),b.layer=null);const O=b?.visible??d.visible??d.overlay!==!1;I[g]={id:g,config:{...d,id:g},visible:O,layer:b?.layer??null,boundsLayer:b?.boundsLayer??null}}),Object.keys(I).forEach(d=>{if(!S.has(d)){const v=I[d];v?.layer&&m?.hasLayer(v.layer)&&m.removeLayer(v.layer),delete I[d]}}),F.value=y,m&&vt()}function oo(h,y){const S=typeof y=="boolean"?y:y.target?.checked;if(S==null)return;const d=I[h];d&&(d.visible=S,d.visible?(d.layer||(d.layer=Qt(d.config)),d.boundsLayer||(d.boundsLayer=yt(d.config)),d.layer&&!m.hasLayer(d.layer)&&d.layer.addTo(m),d.boundsLayer&&!m.hasLayer(d.boundsLayer)&&d.boundsLayer.addTo(m)):(d.layer&&m.hasLayer(d.layer)&&(m.removeLayer(d.layer),tt(h)),d.boundsLayer&&m.hasLayer(d.boundsLayer)&&m.removeLayer(d.boundsLayer)))}function so(h){Vt(h),x.value=h}function Vt(h){if(!m||!_[h])return;C&&C.removeFrom(m);const y=_[h];C=k.tileLayer(y.url,y.options||{}).addTo(m),C.bringToBack()}function en(){!m||!f||R.value&&!m.hasLayer(f)&&f.addTo(m)}function ro(){so(x.value)}function io(){R.value?f.addTo(m):f.removeFrom(m)}function kt(h=30){const y=f.getLayers();if(!y.length)return;const d=k.featureGroup(y).getBounds();d&&d.isValid()&&m.fitBounds(d,{padding:[h,h],maxZoom:16})}function tn(){if(!m||!p.value)return null;m.scrollWheelZoom.disable(),H.value="Використовуйте Ctrl + колесо миші для зміни масштабу";let h;const y=(d=1500)=>{B.value=!0,h&&clearTimeout(h),h=window.setTimeout(()=>B.value=!1,d)},S=d=>{if(!(d.ctrlKey||d.metaKey||d.shiftKey)){y(),m.scrollWheelZoom.disable();return}d.preventDefault(),d.stopPropagation(),m.scrollWheelZoom.enable(),B.value=!1,h&&clearTimeout(h),h=window.setTimeout(()=>m.scrollWheelZoom.disable(),200)};return p.value.addEventListener("wheel",S,{passive:!1}),()=>{m.scrollWheelZoom.enable(),p.value?.removeEventListener("wheel",S),h&&clearTimeout(h),B.value=!1}}return e.watch(T,async()=>{await e.nextTick(),requestAnimationFrame(()=>{m?.invalidateSize(!0),Vt(x.value),en(),vt(),u&&!m?.hasLayer(u)&&u.addTo(m)})}),e.watch(()=>o.layers,()=>bt(),{deep:!0}),e.watch(()=>[o.tms,o.pattern],()=>{o.layers?.length||bt()}),e.watch(()=>o.bounds,()=>We(),{deep:!0}),e.watch(()=>o.geom,()=>eo(),{deep:!0}),e.watch(()=>o.katottg,async h=>{if(M.value=[],!h){We();return}try{const y=await fetch(`https://data.gki.com.ua/api-user/atu/${h}`);if(!y?.ok)return;const d=(await y.json())?.geometry?.coordinates;Array.isArray(d)&&d.length&&(M.value=d)}catch(y){console.error("Failed to fetch KATOTTG bounds",y)}finally{We(),vt()}},{immediate:!0}),(h,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(J.value),style:e.normalizeStyle(ae.value)},[e.createElementVNode("div",{ref_key:"mapContainer",ref:p,class:e.normalizeClass(Me.value)},null,2),B.value?(e.openBlock(),e.createElementBlock("div",gl,[e.createElementVNode("div",yl,e.toDisplayString(H.value),1)])):e.createCommentVNode("",!0),$.value.length?(e.openBlock(),e.createElementBlock("div",{key:1,class:"absolute z-[550] pointer-events-none",style:e.normalizeStyle(N.value)},[e.createElementVNode("div",vl,[e.createElementVNode("dl",bl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.value,S=>(e.openBlock(),e.createElementBlock("div",{key:`${S.label}-${S.value}`,class:"flex justify-between gap-2"},[e.createElementVNode("dt",kl,e.toDisplayString(S.label),1),e.createElementVNode("dd",El,e.toDisplayString(S.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),L.value.length?(e.openBlock(),e.createElementBlock("div",wl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(L.value,S=>(e.openBlock(),e.createElementBlock("div",{key:S.key,class:"flex items-center gap-2 text-gray-800"},[e.createElementVNode("span",{class:"w-3.5 h-3.5 rounded-[2px] border border-black/10 shrink-0",style:e.normalizeStyle({backgroundColor:S.color})},null,4),e.createElementVNode("span",Nl,e.toDisplayString(S.label),1)]))),128))])):e.createCommentVNode("",!0),D.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:3,onClick:y[0]||(y[0]=S=>D.value=!0),class:"z-[500] bg-white absolute top-[10px] right-[10px] p-2 border rounded-lg cursor-pointer layers-button"}," Шари ")),D.value?(e.openBlock(),e.createElementBlock("div",xl,[e.createElementVNode("div",_l,[y[5]||(y[5]=e.createElementVNode("div",null,"Шари",-1)),(e.openBlock(),e.createElementBlock("svg",{onClick:y[1]||(y[1]=S=>D.value=!1),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-4 h-4"},y[4]||(y[4]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),e.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])))]),e.createElementVNode("div",Cl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(_),(S,d)=>(e.openBlock(),e.createElementBlock("div",{key:`base-${d}`},[e.createElementVNode("label",Sl,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:w,value:d,"onUpdate:modelValue":y[2]||(y[2]=v=>x.value=v),onChange:ro},null,40,Bl),[[e.vModelRadio,x.value]]),e.createElementVNode("span",Tl,e.toDisplayString(S.name||d),1)])]))),128))]),e.createElementVNode("div",$l,[e.createElementVNode("label",Dl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":y[3]||(y[3]=S=>R.value=S),onChange:io},null,544),[[e.vModelCheckbox,R.value]]),y[6]||(y[6]=e.createElementVNode("span",{class:"ml-2"},"Геометрія/Межі",-1))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(z.value,S=>(e.openBlock(),e.createElementBlock("label",{class:"flex items-center",key:S.id},[e.createElementVNode("input",{type:"checkbox",checked:S.visible,onChange:d=>oo(S.id,d)},null,40,Ll),e.createElementVNode("span",Ol,e.toDisplayString(S.config.name||S.id),1)]))),128))])])):e.createCommentVNode("",!0)],6))}});/**
131
+ */const rn=Y("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),or={class:"border-t pt-3 mt-4"},sr={class:"flex gap-2"},rr={class:"relative flex items-center justify-center shrink-0 overflow-hidden rounded-full h-5 w-5 bg-gray-200"},ir={class:"flex-1 space-y-2"},lr={class:"flex justify-between items-center"},ar={class:"flex gap-2"},cr=["disabled"],mo=e.defineComponent({__name:"CommentInputZone",props:{isReply:{type:Boolean,required:!1,default:!1},isReplyModifiers:{}},emits:e.mergeModels(["sendComment"],["update:isReply"]),setup(t,{emit:n}){const o=e.useModel(t,"isReply"),s=e.ref(""),r=n,l=()=>{s.value.trim()&&(r("sendComment",s.value),s.value="")},i=a=>{(a.ctrlKey||a.metaKey)&&a.key==="Enter"&&(a.preventDefault(),l())};return(a,c)=>(e.openBlock(),e.createElementBlock("div",or,[e.createElementVNode("div",sr,[e.createElementVNode("span",rr,[e.createVNode(e.unref(sn),{class:"h-3 w-3 text-gray-500"})]),e.createElementVNode("div",ir,[e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":c[0]||(c[0]=p=>s.value=p),onKeydown:i,placeholder:"Add a comment...",class:"w-full min-h-[60px] p-2 border border-gray-200 rounded text-xs resize-none focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-transparent"},null,544),[[e.vModelText,s.value]]),e.createElementVNode("div",lr,[c[4]||(c[4]=e.createElementVNode("span",{class:"text-xs text-gray-500 hidden sm:inline"},"Cmd+Enter to send",-1)),e.createElementVNode("div",ar,[o.value?(e.openBlock(),e.createElementBlock("button",{key:0,class:"inline-flex items-center justify-center gap-2 text-white whitespace-nowrap font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 bg-red-500 hover:bg-opacity-80 rounded-md h-6 text-xs px-2",onClick:c[1]||(c[1]=p=>o.value=!1)},[e.createVNode(e.unref(rn),{class:"h-3 w-3"}),c[2]||(c[2]=e.createTextVNode(" Cancel ",-1))])):e.createCommentVNode("",!0),e.createElementVNode("button",{class:"inline-flex items-center justify-center gap-2 text-white whitespace-nowrap font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 bg-black text-primary-foreground hover:bg-opacity-80 rounded-md h-6 text-xs px-2",disabled:!s.value.trim(),onClick:l},[e.createVNode(e.unref(fo),{class:"h-3 w-3 mr-1"}),c[3]||(c[3]=e.createTextVNode(" Send ",-1))],8,cr)])])])])]))}}),dr={class:"z-50 min-w-32 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md w-32 outline-none pointer-events-auto"},pr=e.defineComponent({__name:"CommentDetails",props:{showMoreOptions:{type:Boolean,required:!0,default:!1},showMoreOptionsModifiers:{}},emits:e.mergeModels(["edit","delete"],["update:showMoreOptions"]),setup(t,{emit:n}){const o=n,s=e.useModel(t,"showMoreOptions"),r=e.ref(),l=e.ref(!0),i=async p=>{s.value&&r.value&&!r.value.contains(p.target)&&!l.value&&(s.value=!1),l.value=!1},a=()=>{s.value=!1,o("edit")},c=()=>{s.value=!1,o("delete")};return e.onMounted(()=>{document.addEventListener("click",i)}),e.onUnmounted(()=>{document.removeEventListener("click",i)}),(p,m)=>(e.openBlock(),e.createElementBlock("div",{class:"absolute bg-white left-0 top-full transform min-w-max z-50",ref_key:"moreOptionsRef",ref:r},[e.createElementVNode("div",dr,[e.createElementVNode("div",{class:"relative cursor-pointer flex select-none items-center gap-2 rounded-sm px-2 py-2 outline-hidden transition-colors disabled:pointer-events-none disabled:opacity-50 text-xs hover:bg-gray-100 transition-colors duration-300",onClick:a},[e.createVNode(e.unref(er),{class:"h-3 w-3 mr-2"}),m[0]||(m[0]=e.createTextVNode(" Edit ",-1))]),e.createElementVNode("div",{class:"relative cursor-pointer flex select-none items-center gap-2 rounded-sm px-2 py-2 outline-hidden transition-colors disabled:pointer-events-none disabled:opacity-50 text-xs text-red-600 hover:bg-gray-100 transition-colors duration-300",onClick:c},[e.createVNode(e.unref(on),{class:"h-3 w-3 mr-2"}),m[1]||(m[1]=e.createTextVNode(" Delete ",-1))])])],512))}}),fr={class:"space-y-2"},mr={class:"relative flex items-center justify-center shrink-0 overflow-hidden rounded-full h-5 w-5 bg-gray-200"},ur={class:"flex-1 min-w-0 space-y-1 relative"},hr={class:"flex items-center gap-2"},gr={class:"font-medium text-xs"},yr={class:"text-xs text-gray-500"},vr={key:0,class:"text-xs text-gray-700 leading-relaxed"},br={class:"flex justify-between text-xs"},kr={class:"flex items-center gap-2"},Er={key:0,class:"flex gap-2"},wr=["disabled"],Nr={key:0,class:"ml-8 space-y-1 border-l-2 border-gray-100 pl-3"},xr=e.defineComponent({__name:"CommentItem",props:{comment:{},isInside:{type:Boolean}},emits:["like","reply","edit","delete"],setup(t,{emit:n}){const o=n,s=t,r=e.ref(s.comment.text),l=e.ref("w-full p-2 rounded text-xs resize-none bg-transparent outline-none"),i=e.ref("w-full min-h-[60px] p-2 border border-gray-200 rounded text-xs resize-none focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-transparent"),a=e.ref(!1),c=e.ref(!1),p=e.ref(!1),m=e.ref(!1),f=w=>{const C=new Date,R=Math.floor((C.getTime()-w.getTime())/(1e3*60*60));return R<1?`${Math.floor((C.getTime()-w.getTime())/6e4)}m`:R<24?`${R}h`:`${Math.floor(R/24)}d`},u=()=>{m.value=!m.value,m.value?o("like",s.comment.id,"add"):o("like",s.comment.id,"delete")},k=()=>{o("edit",s.comment.id,r.value),p.value=!1},_=(w,C)=>{o("like",w,C)},x=(w,C)=>{o("edit",w,C)};return(w,C)=>{const R=e.resolveComponent("CommentItem",!0);return e.openBlock(),e.createElementBlock("div",fr,[e.createElementVNode("div",{class:e.normalizeClass(["group flex gap-2 p-2 rounded hover:bg-gray-50 transition-colors relative",p.value?"bg-gray-50":""])},[e.createElementVNode("span",mr,[e.createVNode(e.unref(sn),{class:"h-3 w-3 text-gray-500"})]),e.createElementVNode("div",ur,[e.createElementVNode("div",hr,[e.createElementVNode("span",gr,e.toDisplayString(w.comment?.author),1),e.createElementVNode("span",yr,e.toDisplayString(f(w.comment?.createdAt)),1)]),p.value?e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{key:1,"onUpdate:modelValue":C[0]||(C[0]=T=>r.value=T),class:e.normalizeClass(p.value?i.value:l.value)},null,2)),[[e.vModelText,r.value]]):(e.openBlock(),e.createElementBlock("p",vr,e.toDisplayString(w.comment?.text),1)),e.createElementVNode("div",br,[e.createElementVNode("div",kr,[e.createElementVNode("button",{class:e.normalizeClass(["flex items-center gap-1",m.value?"text-blue-600":"text-gray-500 hover:text-blue-600 transition-colors"]),onClick:C[1]||(C[1]=T=>u())},[e.createVNode(e.unref(Zs),{class:e.normalizeClass(["h-3 w-3",m.value?"fill-blue-600":""])},null,8,["class"]),e.createTextVNode(" "+e.toDisplayString(w.comment?.likes),1)],2),w.isInside?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"text-gray-500 hover:text-blue-600 transition-colors",onClick:C[2]||(C[2]=T=>c.value=!0)},[e.createVNode(e.unref(Qs),{class:"h-3 w-3"})])),e.createElementVNode("button",{class:"text-gray-400 hover:text-gray-600 transition-colors opacity-0 group-hover:opacity-100",type:"button",onClick:C[3]||(C[3]=T=>a.value=!0)},[e.createVNode(e.unref(Ks),{class:"h-3 w-3"})])]),p.value?(e.openBlock(),e.createElementBlock("div",Er,[e.createElementVNode("button",{class:"inline-flex items-center justify-center gap-2 text-white whitespace-nowrap font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 bg-red-500 hover:bg-opacity-80 rounded-md h-6 text-xs px-2",onClick:C[4]||(C[4]=T=>p.value=!1)},[e.createVNode(e.unref(rn),{class:"h-3 w-3"}),C[11]||(C[11]=e.createTextVNode(" Cancel ",-1))]),e.createElementVNode("button",{class:"inline-flex items-center justify-center gap-2 text-white whitespace-nowrap font-medium transition-colors disabled:pointer-events-none disabled:opacity-50 bg-black text-primary-foreground hover:bg-opacity-80 rounded-md h-6 text-xs px-2",disabled:!r.value.trim(),onClick:C[5]||(C[5]=T=>k())},[e.createVNode(e.unref(fo),{class:"h-3 w-3 mr-1"}),C[12]||(C[12]=e.createTextVNode(" Send ",-1))],8,wr)])):e.createCommentVNode("",!0)])]),a.value?(e.openBlock(),e.createBlock(pr,{key:0,showMoreOptions:a.value,"onUpdate:showMoreOptions":C[6]||(C[6]=T=>a.value=T),onEdit:C[7]||(C[7]=T=>p.value=!0),onDelete:C[8]||(C[8]=T=>w.$emit("delete",w.comment?.id)),comment:w.comment},null,8,["showMoreOptions","comment"])):e.createCommentVNode("",!0)],2),w.isInside?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",Nr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.comment?.replies,T=>(e.openBlock(),e.createBlock(R,{key:T.id,comment:T,isInside:!0,onDelete:D=>w.$emit("delete",T.id),onLike:_,onEdit:x},null,8,["comment","onDelete"]))),128)),c.value&&!w.isInside?(e.openBlock(),e.createBlock(mo,{key:0,onSendComment:C[9]||(C[9]=T=>w.$emit("reply",w.comment?.id,T)),isReply:c.value,"onUpdate:isReply":C[10]||(C[10]=T=>c.value=T)},null,8,["isReply"])):e.createCommentVNode("",!0)]))])}}}),_r=["id"],Cr={key:0,class:"text-xl font-semibold text-gray-900 mb-4"},wt=e.defineComponent({__name:"CommentsWidget",props:{title:{},comments:{},maxHeight:{},onAddComment:{type:Function},onReply:{type:Function},onLike:{type:Function},onDelete:{type:Function},onEdit:{type:Function},id:{},className:{},style:{}},emits:["add","reply","like","delete","edit"],setup(t,{emit:n}){const o=t,s=n,r=e.ref(o.comments??[]);async function l(){if(!o.id)return;const f=await fetch(`/api/widget/comment/${o.id}`).then(u=>u.json());r.value=f.rows.map(u=>({id:u.communication_id,author:u.username,text:u.body,createdAt:new Date(u.cdate)}))}r.value.length===0&&l();const i=async f=>{o.onAddComment?o.onAddComment(f):o.id&&(await fetch(`/api/widget/comment/${o.id}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:f})}),await l()),s("add",f)},a=(f,u)=>{o?.onLike?.(f,u),s("like",f,u)},c=(f,u)=>{o.onReply?.(f,u),s("reply",f,u)},p=async(f,u)=>{o.onEdit?o.onEdit(f,u):o.id&&(await fetch(`/api/widget/comment/${o.id}/${f}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:u})}),await l()),s("edit",f,u)},m=async f=>{o.onDelete?o.onDelete(f):o.id&&(await fetch(`/api/widget/comment/${o.id}/${f}`,{method:"DELETE"}),await l()),s("delete",f)};return(f,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["mx-auto font-sans",f.className]),id:f.id,style:e.normalizeStyle(f.style)},[f.title?(e.openBlock(),e.createElementBlock("h3",Cr,e.toDisplayString(f.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass([f.maxHeight?"overflow-y-auto":"","space-y-3"]),style:e.normalizeStyle({maxHeight:f.maxHeight+"px"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,k=>(e.openBlock(),e.createBlock(xr,{key:k.id,comment:k,onReply:c,onLike:a,onDelete:u[0]||(u[0]=_=>m(_)),onEdit:p},null,8,["comment"]))),128))],6),e.createVNode(mo,{onSendComment:u[1]||(u[1]=k=>i(k))})],14,_r))}}),uo=new Map([["file",{name:"File",color:"bg-green-100 text-green-700 border-green-200",icon:Ge}],["post",{name:"Post",color:"bg-blue-100 text-blue-700 border-blue-200",icon:Vs}],["user",{name:"User",color:"bg-purple-100 text-purple-700 border-purple-200",icon:tr}],["custom",{name:"Custom",color:"bg-gray-100 text-gray-700 border-gray-200",icon:Ys}]]),Sr={class:"mx-auto font-sans"},Br={key:0,class:"text-xl font-semibold text-gray-900 mb-4"},Tr={class:"relative"},$r={class:"space-y-3"},Dr={class:"flex-1 min-w-0 pb-2"},Lr={class:"flex items-center gap-1.5 mb-1 mt-0.5"},Or={class:"relative flex items-center justify-center shrink-0 overflow-hidden rounded-full h-5 w-5 bg-gray-200"},Ar={class:"font-medium text-xs"},Ir={class:"text-xs text-gray-500"},Mr={class:"space-y-1"},Rr={class:"text-xs text-gray-700"},Pr={class:"capitalize mr-1"},Fr={key:0,class:"inline-flex items-center rounded-full border py-0.5 font-semibold transition-colors text-foreground text-xs h-4 px-1 capitalize"},zr={key:0,class:"flex items-center gap-1 text-xs"},jr={key:0,class:"bg-red-50 text-red-600 px-1.5 py-0.5 rounded text-xs border border-red-200"},Hr={key:2,class:"bg-green-50 text-green-600 px-1.5 py-0.5 rounded text-xs border border-green-200"},Nt=e.defineComponent({__name:"HistoryWidget",props:{data:{},title:{},maxHeight:{},id:{},className:{},style:{}},setup(t){const n=t,o=e.ref(Array.isArray(n.data)?n.data:[]);o.value.length===0&&n.id&&s();async function s(){const r=await fetch(`/api/widget/history/${n.id}`);if(!r.ok)return{data:[]};const l=await r.json();l.rows.forEach(i=>{i.timestamp=new Date(i.cdate),i.id=i.entity_id,i.entityType=i.entity_type,i.entityId=i.entity_id,i.action=i.change_type,i.userId=i.change_user_id,i.userName=i.username,i.timestamp=new Date(i.cdate),i.description=i.username,i.status=i.username}),o.value=l.rows}return(r,l)=>(e.openBlock(),e.createElementBlock("div",Sr,[r.title?(e.openBlock(),e.createElementBlock("h3",Br,e.toDisplayString(r.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass(r.maxHeight?"overflow-y-auto":""),style:e.normalizeStyle({maxHeight:r.maxHeight+"px"})},[e.createElementVNode("div",Tr,[l[0]||(l[0]=e.createElementVNode("div",{class:"absolute left-3 top-0 bottom-0 w-0.5 bg-gray-200"},null,-1)),e.createElementVNode("div",$r,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,i=>(e.openBlock(),e.createElementBlock("div",{class:"relative flex items-start gap-2",key:i?.id},[e.createElementVNode("div",{class:e.normalizeClass(`flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center border bg-white relative z-10 ${e.unref(uo).get(i?.entityType)?.color}`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(uo).get(i?.entityType)?.icon),{class:"h-3 w-3"}))],2),e.createElementVNode("div",Dr,[e.createElementVNode("div",Lr,[e.createElementVNode("span",Or,[e.createVNode(e.unref(sn),{class:"h-3 w-3 text-gray-500"})]),e.createElementVNode("span",Ar,e.toDisplayString(i?.userName),1),e.createElementVNode("span",Ir,e.toDisplayString(i?.timestamp.toLocaleDateString("ua-UA",{day:"2-digit",month:"2-digit",year:"numeric"}))+" "+e.toDisplayString(i?.timestamp.toLocaleTimeString("ua-UA",{hour:"2-digit",minute:"2-digit"})),1)]),e.createElementVNode("div",Mr,[e.createElementVNode("div",Rr,[e.createElementVNode("span",Pr,e.toDisplayString(i?.action),1),i?.entityId?(e.openBlock(),e.createElementBlock("span",Fr,e.toDisplayString(i?.entityId),1)):e.createCommentVNode("",!0)]),i?.changes?.[i?.entityId]?(e.openBlock(),e.createElementBlock("div",zr,[i?.changes?.[i?.entityId]?.old?(e.openBlock(),e.createElementBlock("span",jr,e.toDisplayString(i?.changes?.[i?.entityId]?.old),1)):e.createCommentVNode("",!0),i?.changes?.[i?.entityId]?.old&&i?.changes?.[i?.entityId]?.new?(e.openBlock(),e.createBlock(e.unref(qs),{key:1,class:"h-2 w-2 text-gray-400"})):e.createCommentVNode("",!0),i?.changes?.[i?.entityId]?.new?(e.openBlock(),e.createElementBlock("span",Hr,e.toDisplayString(i?.changes?.[i?.entityId]?.new),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)])])]))),128))])])],6)]))}}),Ur={key:0,class:"text-xl font-semibold"},qr={class:"flex gap-1"},Wr={class:"ring-offset-background focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 border-input bg-background hover:bg-accent hover:text-accent-foreground border rounded-md text-xs h-7 px-2 cursor-pointer"},Kr=e.defineComponent({__name:"FileHeader",props:e.mergeModels({title:{}},{modelValue:{},modelModifiers:{}}),emits:e.mergeModels(["onAddFile"],["update:modelValue"]),setup(t){const n=e.useModel(t,"modelValue"),o={active:"bg-blue-100 text-black hover:bg-blue-100",inactive:"bg-white text-black hover:bg-blue-100"};return(s,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex flex-col sm:flex-row gap-3 mb-4",s.title?"justify-between sm:items-center":"justify-end sm:items-center"])},[s.title?(e.openBlock(),e.createElementBlock("h3",Ur,e.toDisplayString(s.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",qr,[e.createElementVNode("button",{class:e.normalizeClass(["ring-offset-background inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium transition-colors border-input border rounded-md text-xs h-7 px-2",n.value==="list"?o.active:o.inactive]),onClick:r[0]||(r[0]=l=>n.value="list")},[e.createVNode(e.unref(Xs),{class:"h-4 w-4"})],2),e.createElementVNode("button",{class:e.normalizeClass(["ring-offset-background inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium transition-colors border-input border rounded-md text-xs h-7 px-2",n.value==="grid"?o.active:o.inactive]),onClick:r[1]||(r[1]=l=>n.value="grid")},[e.createVNode(e.unref(Js),{class:"h-4 w-4"})],2),e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:r[2]||(r[2]=l=>s.$emit("onAddFile",l))},null,32),e.createElementVNode("div",Wr,[e.createVNode(e.unref(po),{class:"h-4 w-4"}),r[3]||(r[3]=e.createTextVNode(" Додати файл ",-1))])])])],2))}}),ln={pdf:{color:"bg-red-100 text-red-700 border-red-200",icon:Ge,label:"PDF"},sketch:{color:"bg-gray-100 text-gray-700 border-gray-200",icon:Gs,label:"SKETCH"},mp4:{color:"bg-purple-100 text-purple-700 border-purple-200",icon:nr,label:"VIDEO"},docx:{color:"bg-blue-100 text-blue-700 border-blue-200",icon:Ge,label:"DOC"},zip:{color:"bg-orange-100 text-orange-700 border-orange-200",icon:Us,label:"ARCHIVE"},png:{color:"bg-green-100 text-green-700 border-green-200",icon:co,label:"IMAGE"},jpg:{color:"bg-green-100 text-green-700 border-green-200",icon:co,label:"IMAGE"},xlsx:{color:"bg-emerald-100 text-emerald-700 border-emerald-200",icon:Ge,label:"EXCEL"},pptx:{color:"bg-amber-100 text-amber-700 border-amber-200",icon:Ge,label:"PPT"}};function ho(t,n="en"){const o={month:"short",day:"numeric"};return new Intl.DateTimeFormat(n,o).format(t)}function go(t){if(t===0)return"0 B";const n=1024,o=["B","KB","MB","GB","TB"],s=Math.floor(Math.log(t)/Math.log(n));return`${parseFloat((t/Math.pow(n,s)).toFixed(1))} ${o[s]}`}const Gr={class:"space-y-0.5"},Jr=["onClick"],Zr=["onClick"],Yr={class:"flex items-center gap-2"},Xr={class:"font-medium text-xs truncate hover:text-blue-600 cursor-pointer"},Qr={class:"hidden sm:block text-xs text-gray-500 w-16 text-right"},Vr={class:"hidden md:block text-xs text-gray-500 w-12 text-right"},ei={class:"flex items-center gap-1"},ti=["onClick"],ni=["onClick"],oi=e.defineComponent({__name:"FileList",props:{files:{}},emits:["delete","download","openLightbox"],setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",Gr,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.files,s=>(e.openBlock(),e.createElementBlock("div",{class:"flex items-center gap-2 p-1.5 rounded hover:bg-gray-50 group border-b border-gray-100 last:border-b-0",key:s.id,onClick:e.withModifiers(r=>n.$emit("openLightbox",s),["stop"])},[e.createElementVNode("div",{class:e.normalizeClass(["p-1 rounded",e.unref(ln)[s?.ext]?.color||"bg-blue-100 text-blue-700 border-blue-200"])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(ln)[s?.ext]?.icon||e.unref(ln).pdf.icon),{class:"h-3 w-3"}))],2),e.createElementVNode("div",{class:"flex-1 min-w-0",onClick:r=>n.$emit("openLightbox",s)},[e.createElementVNode("div",Yr,[e.createElementVNode("span",Xr,e.toDisplayString(s?.uploaded_name||s?.name),1)])],8,Zr),e.createElementVNode("div",Qr,e.toDisplayString(e.unref(go)(s.size)),1),e.createElementVNode("div",Vr,e.toDisplayString(e.unref(ho)(s.createdAt)),1),e.createElementVNode("div",ei,[e.createElementVNode("button",{onClick:e.withModifiers(r=>n.$emit("download",s),["stop"]),class:"ring-offset-background focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover:bg-accent hover:text-accent-foreground rounded-md h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity"},[e.createVNode(e.unref(ao),{class:"h-3 w-3"})],8,ti),e.createElementVNode("button",{class:"ring-offset-background focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover:bg-accent rounded-md h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity text-red-600 hover:text-red-700",onClick:e.withModifiers(r=>n.$emit("delete",r,s?.file_id),["stop"])},[e.createVNode(e.unref(on),{class:"h-3 w-3"})],8,ni)])],8,Jr))),128))]))}}),si={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3"},ri=["onClick"],ii={class:"space-y-2"},li={class:"flex justify-center items-center w-full aspect-[4/3] bg-gray-100 rounded overflow-hidden"},ai=["src"],ci={class:"space-y-1"},di=["title"],pi={class:"text-xs text-gray-500 text-left"},fi={class:"absolute top-2 right-1 flex items-center gap-1"},mi=["onClick"],ui=["onClick"],hi=e.defineComponent({__name:"FileGrid",props:{files:{}},emits:["delete","download","openLightbox"],setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",si,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(n.files,s=>(e.openBlock(),e.createElementBlock("div",{key:s.id,onClick:e.withModifiers(r=>n.$emit("openLightbox",s),["stop"]),class:"group relative border rounded-lg p-2 hover:shadow-md transition-all bg-white hover:bg-gray-50 cursor-pointer"},[e.createElementVNode("div",ii,[e.createElementVNode("div",li,[s.ext==="png"||s.ext==="jpg"||s.ext==="jpeg"||s.ext==="gif"||s.ext==="svg"||s.ext==="webp"?(e.openBlock(),e.createElementBlock("img",{key:0,src:`/file/resize?filepath=${s?.file_path}&w=500`,alt:"file",class:"w-full h-full object-cover"},null,8,ai)):(e.openBlock(),e.createBlock(e.unref(Ge),{key:1,class:"h-10 w-10 text-gray-500"}))]),e.createElementVNode("div",ci,[e.createElementVNode("h3",{class:"font-medium text-xs leading-tight text-left",title:s.uploaded_name||s.name},e.toDisplayString(s.uploaded_name||s.name),9,di),e.createElementVNode("p",pi,e.toDisplayString(e.unref(ho)(s.createdAt))+", "+e.toDisplayString(e.unref(go)(s.size)),1)])]),e.createElementVNode("div",fi,[e.createElementVNode("button",{onClick:e.withModifiers(r=>n.$emit("download",s),["stop"]),class:"ring-offset-background focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover:bg-accent hover:text-accent-foreground rounded-md h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity hover:bg-red-50"},[e.createVNode(e.unref(ao),{class:"h-3 w-3"})],8,mi),e.createElementVNode("button",{class:"ring-offset-background focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap text-sm font-medium focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 rounded-md h-6 w-6 p-0 opacity-0 group-hover:opacity-100 transition-opacity text-red-600 hover:text-red-700 hover:bg-red-50",onClick:e.withModifiers(r=>n.$emit("delete",r,s?.file_id),["stop"])},[e.createVNode(e.unref(on),{class:"h-3 w-3"})],8,ui)])],8,ri))),128))]))}}),gi={class:"mx-auto font-sans"},yi={key:1},xt=e.defineComponent({__name:"FilesWidget",props:{title:{},view:{},files:{default:()=>[]},maxHeight:{},onAddFile:{},id:{},className:{},style:{},onDelete:{}},emits:["delete","add","openLightbox"],setup(t,{emit:n}){const o=t,s=e.ref(!1),r=e.ref(null),l=e.ref(!1),i=e.ref(0),a=e.ref(o.files??[]),c=n;a.value.length===0&&C();const p=(D,B)=>{r.value=B,s.value=!0},m=()=>{r.value&&(_(r.value),r.value=null,s.value=!1)},f=e.computed(()=>Array.isArray(a.value)?a.value.map(D=>D?.file_path):[]),u=D=>{const B=f.value.findIndex(H=>H===D.file_path);B!==-1&&(l.value=!0,i.value=B)},k=D=>{o.onAddFile?o.onAddFile(D):R(D),c("add",D)},_=D=>{o.onDelete?o.onDelete(D):T(D),c("delete",D)},x=D=>{const B=document.createElement("a");B.setAttribute("download",D?.uploaded_name||D?.name),B.href=D?.file_path||D?.path,B.click()},w=e.ref("list");async function C(){if(!o.id)return;const D=await fetch(`/api/widget/file/${o.id}`).then(B=>B.json());D.rows.forEach(B=>{B.timestamp=new Date(B.cdate),B.id=B.entity_id,B.entityType=B.entity_type,B.entityId=B.entity_id,B.entityType=B.entity_type,B.action=B.change_type,B.userId=B.change_user_id,B.userName=B.username,B.timestamp=new Date(B.cdate),B.description=B.username,B.status=B.username}),a.value=D.rows}const R=async D=>{if(!(!D.target||!D.target.files||D.target.files.length===0))try{await Promise.all(Array.from(D.target.files).map(async B=>{const H=new FormData;H.append("file",B);const K=`/api/widget/file/${o.id}`,M=await fetch(K,{method:"POST",body:H});if(!M.ok)throw new Error(`HTTP error! status: ${M.status}`);return B})),await C()}catch(B){console.error("Помилка при завантаженні файлів:",B)}},T=async D=>{try{await fetch(`/api/widget/file/${o.id}/${D}`,{method:"DELETE"}),await C()}catch(B){console.error(B)}};return(D,B)=>{const H=e.resolveComponent("MessageBox"),K=e.resolveComponent("Lightbox");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",gi,[e.createVNode(Kr,{modelValue:w.value,"onUpdate:modelValue":B[0]||(B[0]=M=>w.value=M),title:o.title,onOnAddFile:B[1]||(B[1]=M=>k(M))},null,8,["modelValue","title"]),a.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(D.maxHeight?"overflow-y-auto":""),style:e.normalizeStyle({maxHeight:D.maxHeight+"px"})},[w.value==="list"?(e.openBlock(),e.createBlock(oi,{key:0,onDelete:p,onDownload:x,onOpenLightbox:B[2]||(B[2]=M=>u(M)),files:a.value},null,8,["files"])):e.createCommentVNode("",!0),w.value==="grid"?(e.openBlock(),e.createBlock(hi,{key:1,onDelete:p,onDownload:x,onOpenLightbox:B[3]||(B[3]=M=>u(M)),files:a.value},null,8,["files"])):e.createCommentVNode("",!0)],6)):(e.openBlock(),e.createElementBlock("div",yi,B[6]||(B[6]=[e.createElementVNode("div",{class:"flex items-center justify-center h-full"},[e.createElementVNode("p",{class:"text-gray-500 leading-[3]"},"Файлів не знайдено")],-1)])))]),e.createVNode(H,{modelValue:s.value,"onUpdate:modelValue":B[4]||(B[4]=M=>s.value=M),onConfirm:m,title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати"},null,8,["modelValue"]),e.createVNode(K,{modelValue:l.value,"onUpdate:modelValue":B[5]||(B[5]=M=>l.value=M),images:f.value,"start-index":i.value},null,8,["modelValue","images","start-index"])],64)}}}),vi={key:0,class:"image-wrapper h-full max-h-[400px]",id:"lightbox-gallery"},bi=["onClick"],ki={key:0,rel:"noreferrer",class:"relative block h-full w-full"},Ei=["src"],wi={key:0,class:"thumb-cover"},Ni=e.defineComponent({__name:"GalleryContent",props:{title:{},items:{},columns:{},maxHeight:{},onAddImage:{type:Function},onDelete:{type:Function},id:{},className:{},style:{}},emits:["delete"],setup(t,{emit:n}){const o=n,s=e.ref(!1),r=e.ref(0),l=t,i=e.computed(()=>Array.isArray(l.items)?l.items.map(c=>c?.file_path):[]),a=c=>{const p=i.value.findIndex(m=>m===c.file_path);p!==-1&&(s.value=!0,r.value=p)};return(c,p)=>{const m=e.resolveComponent("Lightbox");return c.items?.length>=1?(e.openBlock(),e.createElementBlock("div",vi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.items,(f,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["h-full w-full image"+u,"cursor-pointer bg-teal-500 rounded-[3px]"]),key:u,onClick:e.withModifiers(k=>a(f),["stop"])},[u<5?(e.openBlock(),e.createElementBlock("div",ki,[e.createElementVNode("img",{src:`/file/resize?filepath=${f?.file_path}&w=500`,alt:"alt",height:"auto",width:"100%",class:e.normalizeClass(["object-cover h-full w-full bg-gray-200 rounded-[3px]",u===0?"max-h-[411px]":"max-h-[calc((411px-3px)/2)]"])},null,10,Ei),u===4&&c.items?.length>5?(e.openBlock(),e.createElementBlock("div",wi," +"+e.toDisplayString(c.items?.length-5),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],10,bi))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Math.max(0,5-c.items.length),f=>(e.openBlock(),e.createElementBlock("div",{key:"empty-"+f,class:e.normalizeClass(["h-full w-full image"+(c.items.length+f-1),"bg-gray-300 rounded-[3px]"])},null,2))),128)),e.createVNode(m,{modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=f=>s.value=f),images:i.value,"start-index":r.value,delete:"true",download:"true",onDelete:p[1]||(p[1]=f=>o("delete",f))},null,8,["modelValue","images","start-index"])])):e.createCommentVNode("",!0)}}}),xi={key:0,class:"text-xl font-semibold"},_i={class:"flex gap-1"},Ci={class:"ring-offset-background focus-visible:outline-hidden focus-visible:ring-ring inline-flex items-center justify-center gap-2 whitespace-nowrap font-medium transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 border-input bg-background hover:bg-accent hover:text-accent-foreground border rounded-md text-xs h-7 px-2 cursor-pointer"},Si=e.defineComponent({__name:"widgetHeader",props:{title:{}},emits:["onAddImage"],setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["flex flex-col sm:flex-row gap-3 mb-4",n.title?"justify-between sm:items-center":"justify-end sm:items-center"])},[n.title?(e.openBlock(),e.createElementBlock("h3",xi,e.toDisplayString(n.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",_i,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",class:"hidden",onChange:o[0]||(o[0]=s=>n.$emit("onAddImage",s))},null,32),e.createElementVNode("div",Ci,[e.createVNode(e.unref(po),{class:"h-4 w-4"}),o[1]||(o[1]=e.createTextVNode(" Додати зображення ",-1))])])])],2))}}),Bi={class:"w-full mx-auto font-sans",ref:"containerRef"},Ti={key:1},_t=e.defineComponent({__name:"GalleryWidget",props:{title:{},items:{default:()=>[]},columns:{},maxHeight:{},onAddImage:{},onDelete:{},id:{},className:{},style:{}},emits:["delete","add","openLightbox"],setup(t,{emit:n}){const o=t,s=e.ref(o.items??[]),r=n;s.value.length===0&&c();const l=m=>{o.onAddImage?o.onAddImage(m):a(m),r("add",m)},i=m=>{const f=s.value.find(u=>u.file_path===m)?.file_id;f&&(o.onDelete?o.onDelete(f):p(f))},a=async m=>{if(!(!m.target||!m.target.files||m.target.files.length===0))try{await Promise.all(Array.from(m.target.files).map(async f=>{const u=new FormData;u.append("file",f);const k=`/api/widget/file/${o.id}`,_=await fetch(k,{method:"POST",body:u});if(!_.ok)throw new Error(`HTTP error! status: ${_.status}`);return f})),await c()}catch(f){console.error("Помилка при завантаженні файлів:",f)}};async function c(){if(!o.id)return;const m=await fetch(`/api/widget/file/${o.id}`).then(f=>f.json());s.value=m.rows}const p=async m=>{try{await fetch(`/api/widget/file/${o.id}/${m}`,{method:"DELETE"}),await c()}catch(f){console.error(f)}};return(m,f)=>(e.openBlock(),e.createElementBlock("div",Bi,[e.createVNode(Si,{title:m.title,onOnAddImage:f[0]||(f[0]=u=>l(u))},null,8,["title"]),s.value.length>0?(e.openBlock(),e.createBlock(Ni,{key:0,items:s.value,onDelete:f[1]||(f[1]=u=>i(u))},null,8,["items"])):(e.openBlock(),e.createElementBlock("div",Ti,f[2]||(f[2]=[e.createElementVNode("div",{class:"flex items-center justify-center h-full"},[e.createElementVNode("p",{class:"text-gray-500 leading-[3]"},"Зображень не знайдено")],-1)])))],512))}}),$i={class:"text-value"},Di={class:"text-sm text-gray-900"},Li=e.defineComponent({__name:"TextValue",props:{item:{}},setup(t){const n=t,o=e.computed(()=>{const s=n.item.value;return typeof s=="boolean"?s?"Так":"Ні":s==null?"—":String(s)});return(s,r)=>(e.openBlock(),e.createElementBlock("div",$i,[e.createElementVNode("span",Di,e.toDisplayString(o.value),1)]))}}),Re=(t,n)=>{const o=t.__vccOpts||t;for(const[s,r]of n)o[s]=r;return o},Oi=Re(Li,[["__scopeId","data-v-34a76c89"]]),Ai={class:"link-value"},Ii=["href"],Mi=Re(e.defineComponent({__name:"LinkValue",props:{item:{}},setup(t){const n=t,o=e.computed(()=>{const s=String(n.item.value);try{const r=new URL(s);return r.hostname+r.pathname}catch{return s}});return(s,r)=>(e.openBlock(),e.createElementBlock("div",Ai,[e.createElementVNode("a",{href:String(s.item.value),target:"_blank",rel:"noopener noreferrer",class:"text-blue-600 hover:text-blue-800 underline text-sm"},[e.createTextVNode(e.toDisplayString(o.value)+" ",1),r[0]||(r[0]=e.createElementVNode("i",{class:"fas fa-external-link-alt ml-1 text-xs"},null,-1))],8,Ii)]))}}),[["__scopeId","data-v-932f028c"]]),Ri={class:"date-value"},Pi={class:"text-sm text-gray-900"},Fi=Re(e.defineComponent({__name:"DateValue",props:{item:{}},setup(t){const n=t,o=e.computed(()=>{const s=n.item.value;if(s instanceof Date)return s.toLocaleDateString("uk-UA",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"});if(typeof s=="string"){const r=new Date(s);if(!isNaN(r.getTime()))return r.toLocaleDateString("uk-UA",{year:"numeric",month:"long",day:"numeric",hour:"2-digit",minute:"2-digit"})}return String(s)});return(s,r)=>(e.openBlock(),e.createElementBlock("div",Ri,[e.createElementVNode("span",Pi,e.toDisplayString(o.value),1)]))}}),[["__scopeId","data-v-cd4df08e"]]),zi={class:"status-value"},ji={key:0,class:"mr-1"},Hi=Re(e.defineComponent({__name:"StatusValue",props:{item:{}},setup(t){const n=t,o=e.computed(()=>{switch(String(n.item.value).toLowerCase()){case"active":case"активний":case"успішно":case"success":return"bg-green-100 text-green-800";case"inactive":case"неактивний":case"pending":case"очікує":return"bg-yellow-100 text-yellow-800";case"error":case"помилка":case"failed":case"неуспішно":return"bg-red-100 text-red-800";case"draft":case"чернетка":return"bg-gray-100 text-gray-800";default:return"bg-blue-100 text-blue-800"}}),s=e.computed(()=>{switch(String(n.item.value).toLowerCase()){case"active":case"активний":case"успішно":case"success":return"fas fa-check-circle";case"inactive":case"неактивний":case"pending":case"очікує":return"fas fa-clock";case"error":case"помилка":case"failed":case"неуспішно":return"fas fa-exclamation-circle";case"draft":case"чернетка":return"fas fa-edit";default:return"fas fa-info-circle"}});return(r,l)=>(e.openBlock(),e.createElementBlock("div",zi,[e.createElementVNode("span",{class:e.normalizeClass(["inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium",o.value])},[s.value?(e.openBlock(),e.createElementBlock("span",ji,[e.createElementVNode("i",{class:e.normalizeClass(s.value)},null,2)])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(String(r.item.value)),1)],2)]))}}),[["__scopeId","data-v-aea1f529"]]),Ui={class:"custom-value"},qi={class:"text-sm text-gray-900"},Wi=Re(e.defineComponent({__name:"CustomValue",props:{item:{}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",Ui,[e.renderSlot(n.$slots,"default",{item:n.item,value:n.item.value},()=>[e.createElementVNode("span",qi,e.toDisplayString(String(n.item.value)),1)],!0)]))}}),[["__scopeId","data-v-12c8b3f3"]]),Ki=["id"],Gi={key:0,class:"text-xl font-semibold text-gray-900 mb-4"},Ji={key:1,class:"overflow-x-auto"},Zi={class:"min-w-full divide-y divide-gray-200"},Yi={class:"bg-white divide-y divide-gray-200"},Xi={class:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"},Qi={class:"flex items-center gap-2"},Vi=["title"],el={class:"px-6 py-4 whitespace-nowrap text-sm text-gray-500"},tl={key:2,class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"},nl={class:"flex items-start gap-3"},ol={key:0,class:"flex-shrink-0"},sl={class:"flex-1 min-w-0"},rl={class:"flex items-center gap-2 mb-2"},il={class:"text-sm font-medium text-gray-900"},ll=["title"],al={key:3,class:"overflow-x-auto"},cl={class:"min-w-full divide-y divide-gray-200"},dl={class:"bg-white divide-y divide-gray-200"},pl={class:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"},fl={class:"flex items-center gap-2"},ml=["title"],ul={class:"px-6 py-4 whitespace-nowrap text-sm text-gray-500"},an=Re(e.defineComponent({__name:"DescriptionListWidget",props:{title:{},items:{},view:{},id:{},className:{},style:{}},setup(t){const n=o=>{switch(o.type){case"link":return Mi;case"date":return Fi;case"status":return Hi;case"custom":return Wi;default:return Oi}};return(o,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["description-list-widget",o.className]),id:o.id,style:e.normalizeStyle(o.style)},[o.title?(e.openBlock(),e.createElementBlock("h3",Gi,e.toDisplayString(o.title),1)):e.createCommentVNode("",!0),o.view==="table"?(e.openBlock(),e.createElementBlock("div",Ji,[e.createElementVNode("table",Zi,[e.createElementVNode("tbody",Yi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.items,r=>(e.openBlock(),e.createElementBlock("tr",{key:r.id||r.label},[e.createElementVNode("td",Xi,[e.createElementVNode("div",Qi,[r.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass([r.icon,"text-gray-500"])},null,2)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(r.label)+" ",1),r.tooltip?(e.openBlock(),e.createElementBlock("span",{key:1,class:"text-gray-400 cursor-help",title:r.tooltip},s[0]||(s[0]=[e.createElementVNode("i",{class:"fas fa-info-circle text-xs"},null,-1)]),8,Vi)):e.createCommentVNode("",!0)])]),e.createElementVNode("td",el,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])]))),128))])])])):o.view==="grid"?(e.openBlock(),e.createElementBlock("div",tl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.items,r=>(e.openBlock(),e.createElementBlock("div",{key:r.id||r.label,class:"description-item-card bg-white border border-gray-200 rounded-lg p-4"},[e.createElementVNode("div",nl,[r.icon?(e.openBlock(),e.createElementBlock("div",ol,[e.createElementVNode("i",{class:e.normalizeClass([r.icon,"text-gray-500 text-lg"])},null,2)])):e.createCommentVNode("",!0),e.createElementVNode("div",sl,[e.createElementVNode("div",rl,[e.createElementVNode("h4",il,e.toDisplayString(r.label),1),r.tooltip?(e.openBlock(),e.createElementBlock("span",{key:0,class:"text-gray-400 cursor-help",title:r.tooltip},s[1]||(s[1]=[e.createElementVNode("i",{class:"fas fa-info-circle text-xs"},null,-1)]),8,ll)):e.createCommentVNode("",!0)]),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])])]))),128))])):(e.openBlock(),e.createElementBlock("div",al,[e.createElementVNode("table",cl,[e.createElementVNode("tbody",dl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.items,r=>(e.openBlock(),e.createElementBlock("tr",{key:r.id||r.label},[e.createElementVNode("td",pl,[e.createElementVNode("div",fl,[r.icon?(e.openBlock(),e.createElementBlock("i",{key:0,class:e.normalizeClass([r.icon,"text-gray-500"])},null,2)):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(r.label)+" ",1),r.tooltip?(e.openBlock(),e.createElementBlock("span",{key:1,class:"text-gray-400 cursor-help",title:r.tooltip},s[2]||(s[2]=[e.createElementVNode("i",{class:"fas fa-info-circle text-xs"},null,-1)]),8,ml)):e.createCommentVNode("",!0)])]),e.createElementVNode("td",ul,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])]))),128))])])]))],14,Ki))}}),[["__scopeId","data-v-106790ef"]]),hl={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 yo(t){return t?t.type==="FeatureCollection"||t.type==="Feature"?t:t.geom?{type:"Feature",geometry:{type:t.geom.type,coordinates:t.geom.coordinates},properties:{}}:t.type&&t.coordinates?{type:"Feature",geometry:t,properties:{}}:null:null}const gl={key:0,class:"absolute inset-0 z-[600] flex items-center justify-center pointer-events-none bg-black/20"},yl={class:"bg-black/70 text-white text-xs sm:text-sm px-4 py-2 rounded-md shadow"},vl={class:"bg-white/95 border border-gray-200 rounded-md shadow-xl px-3 py-2 max-w-[240px] text-[11px] sm:text-xs text-gray-900"},bl={class:"space-y-0.5"},kl={class:"text-gray-500"},El={class:"text-gray-900 text-right break-all"},wl={key:2,class:"absolute bottom-3 left-3 z-[400] bg-white/90 border border-gray-200 rounded-md shadow px-3 py-2 text-[11px] sm:text-xs space-y-1 max-w-[220px]"},Nl={class:"leading-tight"},xl={key:4,class:"bg-white absolute top-[10px] right-[10px] z-[500] border rounded-lg cursor-pointer max-w-[400px]"},_l={class:"flex items-center justify-between p-2 border-b"},Cl={class:"p-2 border-b"},Sl={class:"flex items-center"},Bl=["value"],Tl={class:"ml-2"},$l={class:"p-2"},Dl={class:"flex items-center"},Ll=["checked","onChange"],Ol={class:"ml-2"},Ct=e.defineComponent({__name:"MapWidget",props:{pattern:{},geom:{},id:{},katottg:{},tms:{},layers:{},title:{},height:{},bounds:{},legend:{}},setup(t){function n(h){let y=h?.parent??null;for(;y;){const S=y.props?.view;if(S==="tabs"||S==="vertical-tabs")return!0;y=y.parent??null}return!1}const o=t,s=e.getCurrentInstance(),r=e.inject("vsCardTabsContext",!1),l=e.computed(()=>(typeof r=="boolean"?r:r.value)?!0:n(s)),i=s?.appContext.config.globalProperties?.$settings??{},a=(()=>{const h=Array.isArray(i.center)?i.center:[],y=Number(h[0]),S=Number(h[1]);return Number.isFinite(y)&&Number.isFinite(S)?[y,S]:[50,30]})(),c=s?.uid??Math.floor(Math.random()*1e4),p=e.ref(null);let m,f,u,k;const _=be(),x=e.ref(Object.keys(_)[0]),w=`base-layer-${c}`;let C;const R=e.ref(!0),T=e.ref(!1),D=e.ref(!1),B=e.ref(!1),H=e.ref("Використовуйте Ctrl + колесо миші для зміни масштабу");let K=null;const M=e.ref([]),I=e.reactive({}),F=e.ref([]),z=e.computed(()=>F.value.map(h=>I[h]).filter(Boolean)),E=e.ref(null),$=e.computed(()=>E.value?.entries??[]),N=e.computed(()=>{if(!E.value)return;const h=12,y=E.value.point.x+h,S=E.value.point.y+h;return{left:`${y}px`,top:`${S}px`}}),L=e.computed(()=>Array.isArray(o.legend)?o.legend.map((h,y)=>{const S=typeof h?.color=="string"?h.color.trim():"",d=typeof h?.label=="string"?h.label.trim():"";return!S||!d?null:{color:S,label:d,key:`${d}-${y}`}}).filter(h=>!!h):[]),J=e.computed(()=>{if(T.value)return"fixed inset-0 w-screen h-screen z-[9999] bg-white";const h=["relative","h-full"];return o.height||h.push("min-h-[300px]"),o.title&&!l.value&&h.push("pb-[3.25rem]"),h.join(" ")}),ae=e.computed(()=>T.value||o.height==null?void 0:{height:typeof o.height=="number"?`${o.height}px`:String(o.height)}),Me=e.computed(()=>{const h=["w-full","h-full"];return!o.height&&!T.value&&h.push("min-h-[300px]"),h.join(" ")});async function Be(){const h=d=>{if(!Array.from(document.styleSheets??[]).some(g=>g?.href?.includes(d))){const g=document.createElement("link");g.rel="stylesheet",g.href=d,document.head.appendChild(g)}};h("https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),h("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.css");const y=d=>new Promise((v,g)=>{if(Array.from(document.scripts??[]).some(P=>P.src===d))return v();const A=document.createElement("script");A.src=d,A.async=!0,A.onload=()=>v(),A.onerror=P=>g(P),document.body.appendChild(A)});return await y("https://unpkg.com/leaflet@1.9.4/dist/leaflet.js").catch(()=>{}),await y("https://unpkg.com/leaflet-draw@1.0.4/dist/leaflet.draw.js").catch(()=>{}),await y("https://unpkg.com/leaflet.vectorgrid@1.3.0/dist/Leaflet.VectorGrid.bundled.js").catch(()=>{}),window.L}function be(){const h=y=>y.map((S,d)=>{const v=typeof S?.key=="string"&&S.key?S.key:`b${d}`,g=Ne(S?.url);return g?{...S,key:v,url:g}:null}).filter(S=>!!S).reduce((S,d)=>({...S,[d.key]:d}),{});return Array.isArray(i?.basemaps)&&i.basemaps.length?h(i.basemaps):h([{key:"topo100",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png"},{key:"orto10",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png"},{key:"osmb",url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png"}])}function Ne(h){if(typeof h!="string"||!h.trim())return"";const y=h.trim();if(/^https?:\/\//i.test(y))return y;const S=window.location?.origin??"",d=y.replace(/^\/+/,"");return S?`${S}/${d}`:`/${d}`}function xe(h,y){return h?.id!=null?String(h.id):h?.url?`${h.url}-${y}`:`layer-${y}`}function Xn(h){if(!h||typeof h!="object")return;const y={},S=b=>{if(typeof b=="string"){const O=b.trim().replace(/,+$/,"");return O?/^-?\d+(\.\d+)?$/.test(O)?Number(O):O:void 0}return b},d=()=>(y.colorSet||(y.colorSet={}),y.colorSet),v=(b,O)=>{if(b==null||typeof O!="string")return;const A=O.trim().replace(/,+$/,"");A&&(d()[String(b)]=A)},g=b=>{const O=["color","fill","hex","valueColor","value_color"].map(P=>b[P]).find(P=>typeof P=="string"&&P.trim());if(!O)return!1;const A=["value","key","id","code","status"].map(P=>b[P]).find(P=>P!=null&&P!=="");return A==null?!1:(v(A,O),!0)};return Object.entries(h).forEach(([b,O])=>{if(b==="colorSet"&&O!=null){Array.isArray(O)?O.forEach(P=>{P&&(typeof P=="object"&&g(P)||typeof P=="object"&&Object.entries(P).forEach(([V,ke])=>v(V,typeof ke=="string"?ke:void 0)))}):typeof O=="object"&&(g(O)||Object.entries(O).forEach(([P,V])=>v(P,typeof V=="string"?V:void 0)));return}const A=S(O);if(A!==void 0){if(b==="border"){typeof A=="number"&&y.width==null?y.width=A:typeof A=="string"&&y.stroke==null&&(y.stroke=A);return}y[b]=A}}),y.colorSet&&!Object.keys(y.colorSet).length&&delete y.colorSet,Object.keys(y).length?y:void 0}function Qn(){if(Array.isArray(o.layers)&&o.layers.length)return o.layers.map((y,S)=>{if(!y)return null;const d=xe(y,S),v=y.url||(o.pattern&&d?o.pattern.replace("{{id}}",String(y.id??d)):"");return v?{...y,id:d,url:v,name:y.name||`Шар ${S+1}`,style:Xn(y.style)}:null}).filter(y=>!!y?.url);const h=Array.isArray(o.tms)?o.tms:o.tms?.split(",");return h?h.map((y,S)=>{if(!y)return null;const d=typeof y=="string"?y.trim():`${y}`;if(!d)return null;const v=`legacy-${S}`,g=o.pattern?o.pattern.replace("{{id}}",d):d;return{id:v,name:`Шар ${S+1}`,url:g,visible:!0}}).filter(y=>!!y?.url):[]}function ht(h){const y=(h?.url??"").trim();if(!y)return"";if(/^https?:\/\//i.test(y))return y;const S=window.location?.origin??"",d=y.replace(/^\/+/,"");return`${S}/${d}`}function Zt(h){const y=h.style??{};return S=>{const d=y.colorAttr,v=y.colorSet??{},g=typeof d=="string"?v?.[S?.[d]]??y.color??"#3388ff":y.color??"#3388ff",b=y.stroke??g;return{weight:y.width??1,color:b,opacity:y.opacity??1,fill:y.type?y.type!=="polyline":!0,fillColor:g,fillOpacity:y.opacity??.5}}}function Yt(h,y){if(!m||!y?.latlng||h.popup===!1)return;const S=m.latLngToContainerPoint(y.latlng),d=gt(y),v=Xt(h,d);if(!v.length){tt(h.id);return}E.value={layerId:h.id,title:d?.name??h.name,properties:d,entries:v,point:{x:S.x,y:S.y}}}function tt(h){h&&E.value?.layerId!==h||(E.value=null)}function gt(h){return h?.layer?.properties||h?.layer?.feature?.properties||h?.properties||h?.data||{}}function Xt(h,y={}){const S=d=>d==null||d===""?"—":typeof d=="object"?JSON.stringify(d):String(d);return h.popup&&Array.isArray(h.popup)&&h.popup.length?h.popup.map(d=>({label:d.label||d.field,value:S(y?.[d.field])})):Object.entries(y).map(([d,v])=>({label:d,value:S(v)}))}function Vn(h,y){if(!m||h.popup===!1||!y?.latlng)return;const S=gt(y),d=Xt(h,S);if(!d.length)return;const v=['<div class="map-popup">'];v.push('<div class="map-popup__body">'),d.forEach(g=>{v.push(`<div class="map-popup__row"><span class="map-popup__label">${g.label}: </span><span class="map-popup__value">${g.value}</span></div>`)}),v.push("</div></div>"),k.popup({maxWidth:360}).setLatLng(y.latlng).setContent(v.join("")).openOn(m)}e.onMounted(async()=>{k=await Be(),k.drawLocal={...hl};const h=typeof i?.zoom=="number"&&Number.isFinite(i.zoom)?i.zoom:10;m=k.map(p.value,{zoomControl:!1}).setView(a,h),k.control.zoom({position:"bottomright"}).addTo(m),C=k.tileLayer(_[x.value].url,{maxZoom:19}).addTo(m),f=new k.FeatureGroup().addTo(m),bt(),We(),K=tn();const y=yo(o.geom);if(y){const S=[];k.geoJSON(y).eachLayer(d=>S.push(d)),S.length&&f.addLayer(S[0]),kt()}if(p.value){const S=new ResizeObserver(()=>{m&&m.invalidateSize()});S.observe(p.value),e.onBeforeUnmount(()=>{S.disconnect()})}});function eo(){if(!f)return;f.clearLayers();const h=yo(o.geom);if(!h)return;const y=[];k.geoJSON(h).eachLayer(S=>y.push(S)),y.length&&(y.forEach(S=>f.addLayer(S)),kt())}e.onBeforeUnmount(()=>{K?.(),no(),u&&m?.hasLayer(u)&&m.removeLayer(u)});function Te(h){const y=(h?.service??"").toLowerCase();if(y)return y;const S=(h?.url??"").toLowerCase();return/\.(mvt|pbf|vtile|vmt)(\?|$)/.test(S)?"vtile":/service=wms|request=getmap|\/(wms|ows)(\?|$)/.test(S)?"wms":""}function Qt(h){const y=Te(h),S=ht(h),v={opacity:h?.style?.opacity??1,...h.options??{}},g=!!(h?.style&&Object.keys(h.style).length),b=h.sourceLayer||h.layer||h.service_layer||h.service_key||h.map_key||h.dataset?.layer||h.id;if(y==="vtile"){const O=k?.vectorGrid;if(O?.protobuf&&(g||!k?.maplibreGL)){const A=O.protobuf(S,{interactive:!0,maxNativeZoom:h.maxzoom??19,vectorTileLayerStyles:{[b??"default"]:Zt(h),default:Zt(h)}});return A.on?.("mouseover",P=>Yt(h,P)),A.on?.("mousemove",P=>Yt(h,P)),A.on?.("mouseout",()=>tt(h.id)),A.on?.("click",P=>Vn(h,P)),A}if(!g&&k?.maplibreGL&&window?.maplibregl){const A=S;return k.maplibreGL({style:A,interactive:!1,pane:"overlayPane"})}}if(y==="wms"&&k?.tileLayer?.wms){const O={...h.params??{}};return b&&!O.layers&&(O.layers=b),O.format==null&&(O.format="image/png"),O.transparent==null&&(O.transparent=!0),k.tileLayer.wms(S,{...O,...v})}return k.tileLayer(S,v)}function yt(h){const y=("bounds"in h?h.bounds:void 0)??o.bounds??M.value;if(!Array.isArray(y)||!y.length||!k)return null;const d={color:h.style?.stroke??h.style?.color??"#2563eb",weight:h.style?.width??2,interactive:!1,opacity:h.style?.opacity??.8,dashArray:"4 4"},v=Array.isArray(h.bounds)&&h.bounds.length?h.bounds:y,g=to(v);if(!g.length||!k.polyline)return null;const b=g.map(O=>{if(!O.length)return O;const A=O[0],P=O[O.length-1];return A&&P&&(!P.equals||!P.equals(A))?[...O,A]:O});return k.polyline(b,d)}function to(h){const y=v=>{if(!Array.isArray(v)||v.length<2)return null;const[g,b]=v;return!Number.isFinite(Number(b))||!Number.isFinite(Number(g))?null:k.latLng(Number(b),Number(g))},S=v=>Array.isArray(v)&&v.length>=2&&v.every(g=>Number.isFinite(Number(g))),d=v=>Array.isArray(v)?v.map(y).filter(Boolean):[];if(!Array.isArray(h))return[];if(h.length&&S(h[0])){const v=h.map(y).filter(Boolean);return v.length?[v]:[]}if(h.length&&Array.isArray(h[0])){if(S(h[0][0]))return h.map(g=>d(g)).filter(g=>g.length);if(Array.isArray(h[0][0])&&S(h[0][0][0]))return h.flatMap(g=>Array.isArray(g)?g.map(b=>d(b)).filter(b=>b.length):[]).filter(g=>g.length)}return[]}function no(){Object.values(I).forEach(h=>{h.layer&&m?.hasLayer(h.layer)&&m.removeLayer(h.layer),h.boundsLayer&&m?.hasLayer(h.boundsLayer)&&m.removeLayer(h.boundsLayer),h.layer=null,h.boundsLayer=null}),tt()}function We(){if(!m)return;u&&m.hasLayer(u)&&m.removeLayer(u);const h=yt({id:"global-bounds",bounds:o.bounds,style:{}});h?(u=h,u.addTo(m)):u=null}function vt(){m&&F.value.forEach(h=>{const y=I[h];y&&(y.visible?(y.layer||(y.layer=Qt(y.config)),y.boundsLayer||(y.boundsLayer=yt(y.config)),y.layer&&!m.hasLayer(y.layer)&&y.layer.addTo(m),y.boundsLayer&&!m.hasLayer(y.boundsLayer)&&y.boundsLayer.addTo(m)):(y.layer&&m.hasLayer(y.layer)&&m.removeLayer(y.layer),y.boundsLayer&&m.hasLayer(y.boundsLayer)&&m.removeLayer(y.boundsLayer)))})}function bt(){const h=Qn(),y=[],S=new Set;h.forEach((d,v)=>{const g=xe(d,v);y.push(g),S.add(g);const b=I[g];b&&b.config.url!==d.url&&(b.layer&&m?.hasLayer(b.layer)&&m.removeLayer(b.layer),b.layer=null);const O=b?.visible??d.visible??!1;I[g]={id:g,config:{...d,id:g},visible:O,layer:b?.layer??null,boundsLayer:b?.boundsLayer??null}}),Object.keys(I).forEach(d=>{if(!S.has(d)){const v=I[d];v?.layer&&m?.hasLayer(v.layer)&&m.removeLayer(v.layer),delete I[d]}}),F.value=y,m&&vt()}function oo(h,y){const S=typeof y=="boolean"?y:y.target?.checked;if(S==null)return;const d=I[h];d&&(d.visible=S,d.visible?(d.layer||(d.layer=Qt(d.config)),d.boundsLayer||(d.boundsLayer=yt(d.config)),d.layer&&!m.hasLayer(d.layer)&&d.layer.addTo(m),d.boundsLayer&&!m.hasLayer(d.boundsLayer)&&d.boundsLayer.addTo(m)):(d.layer&&m.hasLayer(d.layer)&&(m.removeLayer(d.layer),tt(h)),d.boundsLayer&&m.hasLayer(d.boundsLayer)&&m.removeLayer(d.boundsLayer)))}function so(h){Vt(h),x.value=h}function Vt(h){if(!m||!_[h])return;C&&C.removeFrom(m);const y=_[h];C=k.tileLayer(y.url,y.options||{}).addTo(m),C.bringToBack()}function en(){!m||!f||R.value&&!m.hasLayer(f)&&f.addTo(m)}function ro(){so(x.value)}function io(){R.value?f.addTo(m):f.removeFrom(m)}function kt(h=30){const y=f.getLayers();if(!y.length)return;const d=k.featureGroup(y).getBounds();d&&d.isValid()&&m.fitBounds(d,{padding:[h,h],maxZoom:16})}function tn(){if(!m||!p.value)return null;m.scrollWheelZoom.disable(),H.value="Використовуйте Ctrl + колесо миші для зміни масштабу";let h;const y=(d=1500)=>{B.value=!0,h&&clearTimeout(h),h=window.setTimeout(()=>B.value=!1,d)},S=d=>{if(!(d.ctrlKey||d.metaKey||d.shiftKey)){y(),m.scrollWheelZoom.disable();return}d.preventDefault(),d.stopPropagation(),m.scrollWheelZoom.enable(),B.value=!1,h&&clearTimeout(h),h=window.setTimeout(()=>m.scrollWheelZoom.disable(),200)};return p.value.addEventListener("wheel",S,{passive:!1}),()=>{m.scrollWheelZoom.enable(),p.value?.removeEventListener("wheel",S),h&&clearTimeout(h),B.value=!1}}return e.watch(T,async()=>{await e.nextTick(),requestAnimationFrame(()=>{m?.invalidateSize(!0),Vt(x.value),en(),vt(),u&&!m?.hasLayer(u)&&u.addTo(m)})}),e.watch(()=>o.layers,()=>bt(),{deep:!0}),e.watch(()=>[o.tms,o.pattern],()=>{o.layers?.length||bt()}),e.watch(()=>o.bounds,()=>We(),{deep:!0}),e.watch(()=>o.geom,()=>eo(),{deep:!0}),e.watch(()=>o.katottg,async h=>{if(M.value=[],!h){We();return}try{const y=await fetch(`https://data.gki.com.ua/api-user/atu/${h}`);if(!y?.ok)return;const d=(await y.json())?.geometry?.coordinates;Array.isArray(d)&&d.length&&(M.value=d)}catch(y){console.error("Failed to fetch KATOTTG bounds",y)}finally{We(),vt()}},{immediate:!0}),(h,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(J.value),style:e.normalizeStyle(ae.value)},[e.createElementVNode("div",{ref_key:"mapContainer",ref:p,class:e.normalizeClass(Me.value)},null,2),B.value?(e.openBlock(),e.createElementBlock("div",gl,[e.createElementVNode("div",yl,e.toDisplayString(H.value),1)])):e.createCommentVNode("",!0),$.value.length?(e.openBlock(),e.createElementBlock("div",{key:1,class:"absolute z-[550] pointer-events-none",style:e.normalizeStyle(N.value)},[e.createElementVNode("div",vl,[e.createElementVNode("dl",bl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList($.value,S=>(e.openBlock(),e.createElementBlock("div",{key:`${S.label}-${S.value}`,class:"flex justify-between gap-2"},[e.createElementVNode("dt",kl,e.toDisplayString(S.label),1),e.createElementVNode("dd",El,e.toDisplayString(S.value),1)]))),128))])])],4)):e.createCommentVNode("",!0),L.value.length?(e.openBlock(),e.createElementBlock("div",wl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(L.value,S=>(e.openBlock(),e.createElementBlock("div",{key:S.key,class:"flex items-center gap-2 text-gray-800"},[e.createElementVNode("span",{class:"w-3.5 h-3.5 rounded-[2px] border border-black/10 shrink-0",style:e.normalizeStyle({backgroundColor:S.color})},null,4),e.createElementVNode("span",Nl,e.toDisplayString(S.label),1)]))),128))])):e.createCommentVNode("",!0),D.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:3,onClick:y[0]||(y[0]=S=>D.value=!0),class:"z-[500] bg-white absolute top-[10px] right-[10px] p-2 border rounded-lg cursor-pointer layers-button"}," Шари ")),D.value?(e.openBlock(),e.createElementBlock("div",xl,[e.createElementVNode("div",_l,[y[5]||(y[5]=e.createElementVNode("div",null,"Шари",-1)),(e.openBlock(),e.createElementBlock("svg",{onClick:y[1]||(y[1]=S=>D.value=!1),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-4 h-4"},y[4]||(y[4]=[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"},null,-1),e.createElementVNode("path",{d:"M18 6l-12 12"},null,-1),e.createElementVNode("path",{d:"M6 6l12 12"},null,-1)])))]),e.createElementVNode("div",Cl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(_),(S,d)=>(e.openBlock(),e.createElementBlock("div",{key:`base-${d}`},[e.createElementVNode("label",Sl,[e.withDirectives(e.createElementVNode("input",{type:"radio",name:w,value:d,"onUpdate:modelValue":y[2]||(y[2]=v=>x.value=v),onChange:ro},null,40,Bl),[[e.vModelRadio,x.value]]),e.createElementVNode("span",Tl,e.toDisplayString(S.name||d),1)])]))),128))]),e.createElementVNode("div",$l,[e.createElementVNode("label",Dl,[e.withDirectives(e.createElementVNode("input",{type:"checkbox","onUpdate:modelValue":y[3]||(y[3]=S=>R.value=S),onChange:io},null,544),[[e.vModelCheckbox,R.value]]),y[6]||(y[6]=e.createElementVNode("span",{class:"ml-2"},"Геометрія/Межі",-1))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(z.value,S=>(e.openBlock(),e.createElementBlock("label",{class:"flex items-center",key:S.id},[e.createElementVNode("input",{type:"checkbox",checked:S.visible,onChange:d=>oo(S.id,d)},null,40,Ll),e.createElementVNode("span",Ol,e.toDisplayString(S.config.name||S.id),1)]))),128))])])):e.createCommentVNode("",!0)],6))}});/**
132
132
  * @vue/shared v3.5.18
133
133
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
134
134
  * @license MIT
@@ -1 +1 @@
1
- {"version":3,"file":"MapWidget.vue.d.ts","sourceRoot":"","sources":["../../../src/widgets/map/MapWidget.vue"],"names":[],"mappings":"AA0hCA,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,UAAU,gBAAgB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,cAAc;IACtB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,KAAK,CAAC,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC;IACnC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C;AAED,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAgBD,UAAU,cAAc;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;CAC3B;;AA8mCD,wBAMG"}
1
+ {"version":3,"file":"MapWidget.vue.d.ts","sourceRoot":"","sources":["../../../src/widgets/map/MapWidget.vue"],"names":[],"mappings":"AA0hCA,UAAU,aAAa;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,UAAU,gBAAgB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,cAAc;IACtB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,KAAK,CAAC,EAAE,gBAAgB,EAAE,GAAG,KAAK,CAAC;IACnC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC3C;AAED,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAgBD,UAAU,cAAc;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IACxB,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IACf,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;CAC3B;;AA+mCD,wBAMG"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@opengis/widgets",
3
3
  "private": false,
4
- "version": "0.0.36",
4
+ "version": "0.0.38",
5
5
  "type": "module",
6
6
  "description": "A collection of independent widgets for comments, history, files, and gallery",
7
7
  "types": "./dist/index.d.ts",