@opengis/widgets 0.0.62 → 0.0.64

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
@@ -576,7 +576,7 @@ const Us = ke("x", [
576
576
  try {
577
577
  const T = await fetch("/api/suggest/change_type");
578
578
  if (!T.ok) return;
579
- const _ = (await T.json())?.data;
579
+ const N = await T.json(), _ = Array.isArray(N) ? N : N?.data;
580
580
  if (!Array.isArray(_)) return;
581
581
  const S = /* @__PURE__ */ new Map();
582
582
  for (const I of _)
@@ -1,4 +1,4 @@
1
- (function(he,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@opengis/core")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core"],e):(he=typeof globalThis<"u"?globalThis:he||self,e(he.WidgetLib={},he.Vue,he.OpenGISCore))})(this,(function(he,e,Ne){"use strict";function Br(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,s.get?s:{enumerable:!0,get:()=>t[o]})}}return n.default=t,Object.freeze(n)}const $r=Br(e);const jo=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Tr=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,o,s)=>s?s.toUpperCase():o.toLowerCase()),Lr=t=>{const n=Tr(t);return n.charAt(0).toUpperCase()+n.slice(1)},Ar=(...t)=>t.filter((n,o,s)=>!!n&&n.trim()!==""&&s.indexOf(n)===o).join(" ").trim();var an={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const Dr=({size:t,strokeWidth:n=2,absoluteStrokeWidth:o,color:s,iconNode:r,name:i,class:l,...a},{slots:c})=>e.h("svg",{...an,width:t||an.width,height:t||an.height,stroke:s||an.stroke,"stroke-width":o?Number(n)*24/Number(t):n,class:Ar("lucide",...i?[`lucide-${jo(Lr(i))}-icon`,`lucide-${jo(i)}`]:["lucide-icon"]),...a},[...r.map(d=>e.h(...d)),...c.default?[c.default()]:[]]);const ae=(t,n)=>(o,{slots:s})=>e.h(Dr,{...o,iconNode:n,name:t},s);const Ir=ae("archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);const Or=ae("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Mr=ae("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Rr=ae("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]);const Fr=ae("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const Pr=ae("copy-plus",[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const Ho=ae("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);const zr=ae("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);const St=ae("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const jr=ae("file",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);const Hr=ae("grid-3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);const Ur=ae("heart",[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]]);const qr=ae("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);const Wr=ae("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);const Uo=ae("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);const Kr=ae("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);const Gr=ae("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);const qo=ae("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Zr=ae("reply",[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]);const Wo=ae("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);const Jr=ae("sheet",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"3",x2:"21",y1:"9",y2:"9",key:"1vqk6q"}],["line",{x1:"3",x2:"21",y1:"15",y2:"15",key:"o2sbyz"}],["line",{x1:"9",x2:"9",y1:"9",y2:"21",key:"1ib60c"}],["line",{x1:"15",x2:"15",y1:"9",y2:"21",key:"1n26ft"}]]);const Ko=ae("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);const cn=ae("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);const Yr=ae("user-check",[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);const Go=ae("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);const Xr=ae("video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);const zn=ae("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Qr={class:"border-t pt-3 mt-4"},Vr={class:"flex gap-2"},ei={class:"relative flex items-center justify-center shrink-0 overflow-hidden rounded-full h-5 w-5 bg-gray-200"},ti={class:"flex-1 space-y-2"},ni={class:"flex justify-between items-center"},oi={class:"flex gap-2"},si=["disabled"],Zo=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,i=()=>{s.value.trim()&&(r("sendComment",s.value),s.value="")},l=a=>{(a.ctrlKey||a.metaKey)&&a.key==="Enter"&&(a.preventDefault(),i())};return(a,c)=>(e.openBlock(),e.createElementBlock("div",Qr,[e.createElementVNode("div",Vr,[e.createElementVNode("span",ei,[e.createVNode(e.unref(Go),{class:"h-3 w-3 text-gray-500"})]),e.createElementVNode("div",ti,[e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),onKeydown:l,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",ni,[c[4]||(c[4]=e.createElementVNode("span",{class:"text-xs text-gray-500 hidden sm:inline"},"Cmd+Enter to send",-1)),e.createElementVNode("div",oi,[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]=d=>o.value=!1)},[e.createVNode(e.unref(zn),{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:i},[e.createVNode(e.unref(Wo),{class:"h-3 w-3 mr-1"}),c[3]||(c[3]=e.createTextVNode(" Send ",-1))],8,si)])])])])]))}}),ri={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"},ii=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(),i=e.ref(!0),l=async d=>{s.value&&r.value&&!r.value.contains(d.target)&&!i.value&&(s.value=!1),i.value=!1},a=()=>{s.value=!1,o("edit")},c=()=>{s.value=!1,o("delete")};return e.onMounted(()=>{document.addEventListener("click",l)}),e.onUnmounted(()=>{document.removeEventListener("click",l)}),(d,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",ri,[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(Ko),{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(cn),{class:"h-3 w-3 mr-2"}),m[1]||(m[1]=e.createTextVNode(" Delete ",-1))])])],512))}}),li={class:"space-y-2"},ai={class:"relative flex items-center justify-center shrink-0 overflow-hidden rounded-full h-5 w-5 bg-gray-200"},ci={class:"flex-1 min-w-0 space-y-1 relative"},di={class:"flex items-center gap-2"},fi={class:"font-medium text-xs"},pi={class:"text-xs text-gray-500"},ui={key:0,class:"text-xs text-gray-700 leading-relaxed"},mi={class:"flex justify-between text-xs"},hi={class:"flex items-center gap-2"},gi={key:0,class:"flex gap-2"},yi=["disabled"],vi={key:0,class:"ml-8 space-y-1 border-l-2 border-gray-100 pl-3"},bi=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),i=e.ref("w-full p-2 rounded text-xs resize-none bg-transparent outline-none"),l=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),d=e.ref(!1),m=e.ref(!1),f=S=>{const k=new Date,_=Math.floor((k.getTime()-S.getTime())/(1e3*60*60));return _<1?`${Math.floor((k.getTime()-S.getTime())/6e4)}m`:_<24?`${_}h`:`${Math.floor(_/24)}d`},h=()=>{m.value=!m.value,m.value?o("like",s.comment.id,"add"):o("like",s.comment.id,"delete")},E=()=>{o("edit",s.comment.id,r.value),d.value=!1},b=(S,k)=>{o("like",S,k)},v=(S,k)=>{o("edit",S,k)};return(S,k)=>{const _=e.resolveComponent("CommentItem",!0);return e.openBlock(),e.createElementBlock("div",li,[e.createElementVNode("div",{class:e.normalizeClass(["group flex gap-2 p-2 rounded hover:bg-gray-50 transition-colors relative",d.value?"bg-gray-50":""])},[e.createElementVNode("span",ai,[e.createVNode(e.unref(Go),{class:"h-3 w-3 text-gray-500"})]),e.createElementVNode("div",ci,[e.createElementVNode("div",di,[e.createElementVNode("span",fi,e.toDisplayString(t.comment?.author),1),e.createElementVNode("span",pi,e.toDisplayString(f(t.comment?.createdAt)),1)]),d.value?e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{key:1,"onUpdate:modelValue":k[0]||(k[0]=C=>r.value=C),class:e.normalizeClass(d.value?l.value:i.value)},null,2)),[[e.vModelText,r.value]]):(e.openBlock(),e.createElementBlock("p",ui,e.toDisplayString(t.comment?.text),1)),e.createElementVNode("div",mi,[e.createElementVNode("div",hi,[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:k[1]||(k[1]=C=>h())},[e.createVNode(e.unref(Ur),{class:e.normalizeClass(["h-3 w-3",m.value?"fill-blue-600":""])},null,8,["class"]),e.createTextVNode(" "+e.toDisplayString(t.comment?.likes),1)],2),t.isInside?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"text-gray-500 hover:text-blue-600 transition-colors",onClick:k[2]||(k[2]=C=>c.value=!0)},[e.createVNode(e.unref(Zr),{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:k[3]||(k[3]=C=>a.value=!0)},[e.createVNode(e.unref(zr),{class:"h-3 w-3"})])]),d.value?(e.openBlock(),e.createElementBlock("div",gi,[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:k[4]||(k[4]=C=>d.value=!1)},[e.createVNode(e.unref(zn),{class:"h-3 w-3"}),k[11]||(k[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:k[5]||(k[5]=C=>E())},[e.createVNode(e.unref(Wo),{class:"h-3 w-3 mr-1"}),k[12]||(k[12]=e.createTextVNode(" Send ",-1))],8,yi)])):e.createCommentVNode("",!0)])]),a.value?(e.openBlock(),e.createBlock(ii,{key:0,showMoreOptions:a.value,"onUpdate:showMoreOptions":k[6]||(k[6]=C=>a.value=C),onEdit:k[7]||(k[7]=C=>d.value=!0),onDelete:k[8]||(k[8]=C=>S.$emit("delete",t.comment?.id)),comment:t.comment},null,8,["showMoreOptions","comment"])):e.createCommentVNode("",!0)],2),t.isInside?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",vi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.comment?.replies,C=>(e.openBlock(),e.createBlock(_,{key:C.id,comment:C,isInside:!0,onDelete:w=>S.$emit("delete",C.id),onLike:b,onEdit:v},null,8,["comment","onDelete"]))),128)),c.value&&!t.isInside?(e.openBlock(),e.createBlock(Zo,{key:0,onSendComment:k[9]||(k[9]=C=>S.$emit("reply",t.comment?.id,C)),isReply:c.value,"onUpdate:isReply":k[10]||(k[10]=C=>c.value=C)},null,8,["isReply"])):e.createCommentVNode("",!0)]))])}}}),ki=["id"],Ei={key:0,class:"text-xl font-semibold text-gray-900 mb-4"},dn=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 i(){if(!o.id)return;const f=await fetch(`/api/widget/comment/${o.id}`).then(h=>h.json());r.value=f.rows.map(h=>({id:h.communication_id,author:h.username,text:h.body,createdAt:new Date(h.cdate)}))}r.value.length===0&&i();const l=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 i()),s("add",f)},a=(f,h)=>{o?.onLike?.(f,h),s("like",f,h)},c=(f,h)=>{o.onReply?.(f,h),s("reply",f,h)},d=async(f,h)=>{o.onEdit?o.onEdit(f,h):o.id&&(await fetch(`/api/widget/comment/${o.id}/${f}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:h})}),await i()),s("edit",f,h)},m=async f=>{o.onDelete?o.onDelete(f):o.id&&(await fetch(`/api/widget/comment/${o.id}/${f}`,{method:"DELETE"}),await i()),s("delete",f)};return(f,h)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["mx-auto font-sans",t.className]),id:t.id,style:e.normalizeStyle(t.style)},[t.title?(e.openBlock(),e.createElementBlock("h3",Ei,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass([t.maxHeight?"overflow-y-auto":"","space-y-3"]),style:e.normalizeStyle({maxHeight:t.maxHeight+"px"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,E=>(e.openBlock(),e.createBlock(bi,{key:E.id,comment:E,onReply:c,onLike:a,onDelete:h[0]||(h[0]=b=>m(b)),onEdit:d},null,8,["comment"]))),128))],6),e.createVNode(Zo,{onSendComment:h[1]||(h[1]=E=>l(E))})],14,ki))}}),Jo={CopyPlus:Pr,SquarePen:Ko,Trash2:cn},Yo=new Map([["file",{name:"File",color:"bg-green-100 text-green-700 border-green-200",icon:St}],["post",{name:"Post",color:"bg-blue-100 text-blue-700 border-blue-200",icon:Jr}],["user",{name:"User",color:"bg-purple-100 text-purple-700 border-purple-200",icon:Yr}],["custom",{name:"Custom",color:"bg-gray-100 text-gray-700 border-gray-200",icon:qr}]]),wi={class:"mx-auto font-sans"},xi={class:"bg-white rounded-lg border border-neutral-200 p-4 sm:p-6"},Ni={key:0,class:"py-8 text-center text-gray-500 text-sm"},Ci={key:1,class:"py-8 text-center text-gray-500 text-sm"},Si={key:2,class:"space-y-6"},_i={class:"flex justify-end"},Bi={class:"flex items-center gap-2 mb-3 sticky top-0 bg-white py-2 z-20"},$i={class:"text-xs font-semibold text-gray-800 uppercase tracking-wide"},Ti={class:"text-xs text-gray-500"},Li={class:"relative"},Ai={class:"bg-white border border-neutral-200 rounded-lg overflow-hidden divide-y divide-neutral-200"},Di=["onClick"],Ii={class:"flex-shrink-0 w-3.5 h-3.5 flex items-center justify-center"},Oi={class:"flex-1 min-w-0 flex items-center gap-2 text-sm"},Mi={class:"font-medium text-gray-800"},Ri={class:"text-gray-500"},Fi=["title"],Pi={class:"flex-shrink-0 flex items-center gap-2 text-xs text-gray-500 whitespace-nowrap"},zi={class:"px-4 pb-3 pl-[60px] space-y-2"},ji={class:"space-y-1.5"},Hi={class:"text-gray-500 font-[600] text-[0.92rem] min-w-[80px]"},Ui={class:"pl-2 text-gray-500 line-through"},qi={class:"text-gray-800 font-semibold"},Wi={key:0,class:"mt-4 text-center"},Ki={class:"text-xs text-gray-500"},fn=e.defineComponent({__name:"HistoryWidget",props:{data:{},title:{},maxHeight:{},hideChangesValuesKeys:{},iconSource:{default:"entityType"},showEntityId:{type:Boolean,default:!1},id:{},className:{},style:{}},setup(t){const n=t,o=e.ref(Array.isArray(n.data)?[...n.data]:[]),s=e.ref(!1),r=e.reactive({}),i=e.ref(new Map);function l(_){return _?Array.isArray(_)?_:Object.entries(_).map(([C,w],x)=>({changeDataId:`legacy-${x}`,entityKey:C,valueOld:String(w?.old??""),valueNew:String(w?.new??"")})):[]}function a(_){return l(_.changes).length>0}o.value.forEach(_=>{a(_)&&(r[_.id]=!0)}),e.onMounted(async()=>{try{const _=await fetch("/api/suggest/change_type");if(!_.ok)return;const w=(await _.json())?.data;if(!Array.isArray(w))return;const x=new Map;for(const $ of w)$?.id!=null&&x.set(String($.id).toLowerCase(),{text:$.text??$.id,icon:$.icon??null});i.value=x}catch{}}),o.value.length===0&&n.id&&k(),e.watch(()=>n.id,()=>{n.id&&k()});function c(_){return Yo.get(_)??Yo.get("custom")}function d(_){if(n.iconSource==="actionType"){const w=i.value.get((_.action??"").toLowerCase())?.icon;if(w&&w in Jo)return Jo[w]}return c(_.entityType)?.icon}const m=e.computed(()=>new Set(n.hideChangesValuesKeys??[]));function f(_){return i.value.get((_??"").toLowerCase())?.text??_??""}function h(_){try{return new Date(_+"T00:00:00").toLocaleDateString("uk-UA",{day:"numeric",month:"long",year:"numeric"})}catch{return _}}const E=e.computed(()=>{const _=new Map;for(const C of o.value){const w=C.changeDate??C.timestamp?.toLocaleDateString("uk-UA")??"unknown";if(!_.has(w)){const x=C.changeDate?h(C.changeDate):C.timestamp?.toLocaleDateString("uk-UA",{day:"numeric",month:"long",year:"numeric"})??"Без дати";_.set(w,{dateKey:w,dateDisplay:x,rows:[]})}_.get(w).rows.push(C)}return Array.from(_.values()).sort((C,w)=>w.dateKey.localeCompare(C.dateKey))}),b=e.computed(()=>o.value.filter(a).some(_=>!r[_.id]));function v(_){r[_]=!r[_]}function S(){const _=b.value;o.value.forEach(C=>{a(C)&&(r[C.id]=_)})}async function k(){if(n.id){s.value=!0;try{const _=await fetch(`/api/widget/history/${n.id}`);if(!_.ok){o.value=[];return}const w=((await _.json()).rows??[]).map(x=>({id:x.change_id??x.entity_id??"",entityId:x.entity_id??"",entityType:x.entity_type??"custom",action:x.change_type??"",userId:x.change_user_id??"",userName:x.username??"",timestamp:new Date(x.cdate),changeDate:x.change_date,login:x.login,avatar:x.avatar??null,changes:Array.isArray(x.changes)?x.changes.map($=>({changeDataId:$.change_data_id,entityKey:$.entity_key,valueOld:$.value_old??"",valueNew:$.value_new??""})):[]}));o.value=w,w.forEach(x=>{a(x)&&(r[x.id]=!0)})}finally{s.value=!1}}}return(_,C)=>(e.openBlock(),e.createElementBlock("div",wi,[e.createElementVNode("div",xi,[e.createElementVNode("div",{class:"overflow-y-auto",style:e.normalizeStyle({maxHeight:t.maxHeight?t.maxHeight+"px":"calc(100vh - 320px)"})},[s.value?(e.openBlock(),e.createElementBlock("div",Ni," Завантаження... ")):o.value.length===0?(e.openBlock(),e.createElementBlock("div",Ci," Немає записів ")):(e.openBlock(),e.createElementBlock("div",Si,[e.createElementVNode("div",_i,[e.createElementVNode("button",{onClick:S,class:"flex items-center gap-2 text-sm font-semibold text-gray-800 hover:text-blue-600 transition-colors px-4 py-2 rounded-lg border border-neutral-300 hover:border-blue-500 bg-white hover:shadow-sm"},[e.createVNode(e.unref(Rr),{class:e.normalizeClass(["w-4 h-4",{"rotate-180":b.value}])},null,8,["class"]),e.createElementVNode("span",null,e.toDisplayString(b.value?"Розгорнути всі":"Згорнути всі"),1)])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E.value,w=>(e.openBlock(),e.createElementBlock("div",{key:w.dateKey},[e.createElementVNode("div",Bi,[e.createElementVNode("h3",$i,e.toDisplayString(w.dateDisplay),1),C[0]||(C[0]=e.createElementVNode("div",{class:"flex-1 h-[1px] bg-neutral-200"},null,-1)),e.createElementVNode("span",Ti,e.toDisplayString(w.rows.length),1)]),e.createElementVNode("div",Li,[C[1]||(C[1]=e.createElementVNode("div",{class:"absolute left-[58px] top-6 bottom-0 w-[1px] bg-neutral-200"},null,-1)),e.createElementVNode("div",Ai,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.rows,x=>(e.openBlock(),e.createElementBlock("div",{key:x.id,class:"hover:bg-neutral-50 transition-colors"},[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center gap-3 px-4 py-2.5",{"cursor-pointer":a(x)}]),onClick:$=>a(x)&&v(x.id)},[e.createElementVNode("div",Ii,[a(x)?(e.openBlock(),e.createBlock(e.unref(Mr),{key:0,class:e.normalizeClass(["w-3.5 h-3.5 text-gray-500 transition-transform duration-200",{"rotate-180":r[x.id]}]),"stroke-width":"1.5"},null,8,["class"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(`flex-shrink-0 w-8 h-8 rounded-full border-2 border-white shadow-sm flex items-center justify-center relative z-10 ${c(x.entityType)?.color??"bg-gray-100"}`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d(x)),{class:"w-4 h-4 relative z-10","stroke-width":"1.5"}))],2),e.createElementVNode("div",Oi,[e.createElementVNode("span",Mi,e.toDisplayString(x.userName),1),e.createElementVNode("span",Ri,e.toDisplayString(f(x.action)),1),t.showEntityId&&x.entityId?(e.openBlock(),e.createElementBlock("span",{key:0,class:"rounded border border-neutral-300 bg-neutral-50 px-1.5 py-0.5 font-mono text-[0.65rem] text-gray-600 max-w-[140px] truncate",title:x.entityId},e.toDisplayString(x.entityId),9,Fi)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Pi,[e.createElementVNode("span",null,e.toDisplayString(x.timestamp?.toLocaleTimeString("uk-UA",{hour:"2-digit",minute:"2-digit"})),1)])],10,Di),e.withDirectives(e.createElementVNode("div",zi,[e.createElementVNode("div",ji,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l(x.changes),$=>(e.openBlock(),e.createElementBlock("div",{key:$.changeDataId,class:"flex items-center gap-2 text-sm pl-2"},[e.createElementVNode("span",Hi,e.toDisplayString($.entityKey),1),m.value.has($.entityKey)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("span",Ui,e.toDisplayString($.valueOld),1),e.createVNode(e.unref(Or),{class:"w-3 h-3 text-neutral-400","stroke-width":"1.5"}),e.createElementVNode("span",qi,e.toDisplayString($.valueNew),1)],64))]))),128))])],512),[[e.vShow,a(x)&&r[x.id]]])]))),128))])])]))),128))]))],4),!s.value&&o.value.length>0?(e.openBlock(),e.createElementBlock("div",Wi,[e.createElementVNode("p",Ki,e.toDisplayString(o.value.length)+" записів",1)])):e.createCommentVNode("",!0)])]))}}),Gi={key:0,class:"text-xl font-semibold"},Zi={class:"flex gap-1"},Ji={key:0},Yi=["accept"],Xi={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"},Qi=e.defineComponent({__name:"FileHeader",props:e.mergeModels({editable:{type:Boolean,default:!0},title:{},accept:{}},{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",t.title?"justify-between sm:items-center":"justify-end sm:items-center"])},[t.title?(e.openBlock(),e.createElementBlock("h3",Gi,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Zi,[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]=i=>n.value="list")},[e.createVNode(e.unref(Kr),{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]=i=>n.value="grid")},[e.createVNode(e.unref(Hr),{class:"h-4 w-4"})],2),t.editable?(e.openBlock(),e.createElementBlock("label",Ji,[e.createElementVNode("input",{type:"file",class:"hidden",accept:t.accept,onChange:r[2]||(r[2]=i=>s.$emit("onAddFile",i))},null,40,Yi),e.createElementVNode("div",Xi,[e.createVNode(e.unref(qo),{class:"h-4 w-4"}),r[3]||(r[3]=e.createTextVNode(" Додати файл ",-1))])])):e.createCommentVNode("",!0)])],2))}}),jn={pdf:{color:"bg-red-100 text-red-700 border-red-200",icon:St,label:"PDF"},sketch:{color:"bg-gray-100 text-gray-700 border-gray-200",icon:jr,label:"SKETCH"},mp4:{color:"bg-purple-100 text-purple-700 border-purple-200",icon:Xr,label:"VIDEO"},docx:{color:"bg-blue-100 text-blue-700 border-blue-200",icon:St,label:"DOC"},zip:{color:"bg-orange-100 text-orange-700 border-orange-200",icon:Ir,label:"ARCHIVE"},png:{color:"bg-green-100 text-green-700 border-green-200",icon:Uo,label:"IMAGE"},jpg:{color:"bg-green-100 text-green-700 border-green-200",icon:Uo,label:"IMAGE"},xlsx:{color:"bg-emerald-100 text-emerald-700 border-emerald-200",icon:St,label:"EXCEL"},pptx:{color:"bg-amber-100 text-amber-700 border-amber-200",icon:St,label:"PPT"}};function Xo(t,n="en"){const o={month:"short",day:"numeric"};return new Intl.DateTimeFormat(n,o).format(t)}function Qo(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 Vi={class:"space-y-0.5"},el=["onClick"],tl=["onClick"],nl={class:"flex items-center gap-2"},ol={class:"font-medium text-xs truncate hover:text-blue-600 cursor-pointer"},sl={class:"hidden sm:block text-xs text-gray-500 w-16 text-right"},rl={class:"hidden md:block text-xs text-gray-500 w-12 text-right"},il={class:"flex items-center gap-1"},ll=["onClick"],al=["onClick"],cl=e.defineComponent({__name:"FileList",props:{files:{}},emits:["delete","download","openLightbox"],setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",Vi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.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(jn)[s?.ext]?.color||"bg-blue-100 text-blue-700 border-blue-200"])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(jn)[s?.ext]?.icon||e.unref(jn).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",nl,[e.createElementVNode("span",ol,e.toDisplayString(s?.uploaded_name||s?.name),1)])],8,tl),e.createElementVNode("div",sl,e.toDisplayString(e.unref(Qo)(s.size)),1),e.createElementVNode("div",rl,e.toDisplayString(e.unref(Xo)(s.createdAt)),1),e.createElementVNode("div",il,[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(Ho),{class:"h-3 w-3"})],8,ll),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(cn),{class:"h-3 w-3"})],8,al)])],8,el))),128))]))}}),dl={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3"},fl=["onClick"],pl={class:"space-y-2"},ul={class:"flex justify-center items-center w-full aspect-[4/3] bg-gray-100 rounded overflow-hidden"},ml=["src"],hl={class:"space-y-1"},gl=["title"],yl={class:"text-xs text-gray-500 text-left"},vl={class:"absolute top-2 right-1 flex items-center gap-1"},bl=["onClick"],kl=["onClick"],El=e.defineComponent({__name:"FileGrid",props:{files:{}},emits:["delete","download","openLightbox"],setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",dl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.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",pl,[e.createElementVNode("div",ul,[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,ml)):(e.openBlock(),e.createBlock(e.unref(St),{key:1,class:"h-10 w-10 text-gray-500"}))]),e.createElementVNode("div",hl,[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,gl),e.createElementVNode("p",yl,e.toDisplayString(e.unref(Xo)(s.createdAt))+", "+e.toDisplayString(e.unref(Qo)(s.size)),1)])]),e.createElementVNode("div",vl,[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(Ho),{class:"h-3 w-3"})],8,bl),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(cn),{class:"h-3 w-3"})],8,kl)])],8,fl))),128))]))}}),wl={class:"mx-auto font-sans"},xl={key:1},pn=e.defineComponent({__name:"FilesWidget",props:{title:{},view:{},files:{default:()=>[]},format:{default:()=>[]},editable:{type:Boolean,default:!0},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),i=e.ref(!1),l=e.ref(0),a=e.ref(o.files??[]),c=e.computed(()=>{const g=(o.format??[]).map(P=>typeof P=="string"?P.trim():P==null?"":String(P).trim()).filter(P=>P.length>0),D=[];return g.forEach(P=>{const z=P.toLowerCase(),G=z.indexOf("/"),Z=G>=0;let I,F=!1,N;if(Z){I=z;const te=z.slice(G+1);F=te==="*",!F&&te&&(N=`.${te.replace(/^\.+/,"")}`)}else N=z.startsWith(".")?z:`.${z.replace(/^\.+/,"")}`;const j=Z?I:N??"";j&&D.push({acceptValue:j,mime:I,wildcard:F,extension:N})}),D.length?D:null}),d=e.computed(()=>{const B=c.value;if(!B)return;const g=B.map(D=>D.acceptValue).filter(Boolean);return g.length?g.join(","):void 0}),m=B=>{if(!c.value)return!0;const g=B.type?.toLowerCase(),D=B.name?.toLowerCase();return c.value.some(P=>{if(P.mime){if(g){if(P.wildcard){const z=P.mime.split("/")[0];if(g.startsWith(`${z}/`))return!0}else if(g===P.mime)return!0}return!!(P.extension&&D?.endsWith(P.extension))}return!!(P.extension&&D?.endsWith(P.extension))})},f=n;a.value.length===0&&w();const h=(B,g)=>{r.value=g,s.value=!0},E=()=>{r.value&&(k(r.value),r.value=null,s.value=!1)},b=e.computed(()=>Array.isArray(a.value)?a.value.map(B=>B?.file_path):[]),v=B=>{const g=b.value.findIndex(D=>D===B.file_path);g!==-1&&(i.value=!0,l.value=g)},S=B=>{o.onAddFile?o.onAddFile(B):x(B),f("add",B)},k=B=>{o.onDelete?o.onDelete(B):$(B),f("delete",B)},_=B=>{const g=document.createElement("a");g.setAttribute("download",B?.uploaded_name||B?.name),g.href=B?.file_path||B?.path,g.click()},C=e.ref(o.view==="grid"?"grid":"list");async function w(){if(!o.id)return;const B=await fetch(`/api/widget/file/${o.id}`).then(g=>g.json());B.rows.forEach(g=>{g.timestamp=new Date(g.cdate),g.id=g.entity_id,g.entityType=g.entity_type,g.entityId=g.entity_id,g.entityType=g.entity_type,g.action=g.change_type,g.userId=g.change_user_id,g.userName=g.username,g.timestamp=new Date(g.cdate),g.description=g.username,g.status=g.username}),a.value=B.rows}const x=async B=>{const D=B.target?.files;if(!D||D.length===0)return;const P=Array.from(D),z=[],G=[];if(P.forEach(Z=>{m(Z)?z.push(Z):G.push(Z)}),G.length&&console.warn(`Файлы пропущены, потому что не соответствуют разрешённым форматам: ${G.map(Z=>Z.name).join(", ")}`),z.length!==0)try{await Promise.all(z.map(async Z=>{const I=new FormData;I.append("file",Z);const F=`/api/widget/file/${o.id}`,N=await fetch(F,{method:"POST",body:I});if(!N.ok)throw new Error(`HTTP error! status: ${N.status}`);return Z})),await w()}catch(Z){console.error("Помилка при завантаженні файлів:",Z)}},$=async B=>{try{await fetch(`/api/widget/file/${o.id}/${B}`,{method:"DELETE"}),await w()}catch(g){console.error(g)}};return(B,g)=>{const D=e.resolveComponent("MessageBox"),P=e.resolveComponent("Lightbox");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",wl,[e.createVNode(Qi,{modelValue:C.value,"onUpdate:modelValue":g[0]||(g[0]=z=>C.value=z),title:o.title,onOnAddFile:g[1]||(g[1]=z=>S(z)),editable:o.editable,accept:d.value},null,8,["modelValue","title","editable","accept"]),a.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(t.maxHeight?"overflow-y-auto":""),style:e.normalizeStyle({maxHeight:t.maxHeight+"px"})},[C.value==="list"?(e.openBlock(),e.createBlock(cl,{key:0,onDelete:h,onDownload:_,onOpenLightbox:g[2]||(g[2]=z=>v(z)),files:a.value},null,8,["files"])):e.createCommentVNode("",!0),C.value==="grid"?(e.openBlock(),e.createBlock(El,{key:1,onDelete:h,onDownload:_,onOpenLightbox:g[3]||(g[3]=z=>v(z)),files:a.value},null,8,["files"])):e.createCommentVNode("",!0)],6)):(e.openBlock(),e.createElementBlock("div",xl,[...g[6]||(g[6]=[e.createElementVNode("div",{class:"flex items-center justify-center h-full"},[e.createElementVNode("p",{class:"text-gray-500 leading-[3]"},"Файлів не знайдено")],-1)])]))]),e.createVNode(D,{modelValue:s.value,"onUpdate:modelValue":g[4]||(g[4]=z=>s.value=z),onConfirm:E,title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати"},null,8,["modelValue"]),e.createVNode(P,{modelValue:i.value,"onUpdate:modelValue":g[5]||(g[5]=z=>i.value=z),images:b.value,"start-index":l.value},null,8,["modelValue","images","start-index"])],64)}}}),Nl={key:0,class:"image-wrapper h-full max-h-[400px]",id:"lightbox-gallery"},Cl=["onClick"],Sl={key:0,rel:"noreferrer",class:"relative block h-full w-full"},_l=["src"],Bl={key:0,class:"thumb-cover"},$l=e.defineComponent({__name:"GalleryContent",props:{title:{},items:{},columns:{},maxHeight:{},format:{},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),i=t,l=e.computed(()=>Array.isArray(i.items)?i.items.map(c=>c?.file_path):[]),a=c=>{const d=l.value.findIndex(m=>m===c.file_path);d!==-1&&(s.value=!0,r.value=d)};return(c,d)=>{const m=e.resolveComponent("Lightbox");return t.items?.length>=1?(e.openBlock(),e.createElementBlock("div",Nl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(f,h)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["h-full w-full image"+h,"cursor-pointer bg-teal-500 rounded-[3px]"]),key:h,onClick:e.withModifiers(E=>a(f),["stop"])},[h<5?(e.openBlock(),e.createElementBlock("div",Sl,[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]",h===0?"max-h-[411px]":"max-h-[calc((411px-3px)/2)]"])},null,10,_l),h===4&&t.items?.length>5?(e.openBlock(),e.createElementBlock("div",Bl," +"+e.toDisplayString(t.items?.length-5),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],10,Cl))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Math.max(0,5-t.items.length),f=>(e.openBlock(),e.createElementBlock("div",{key:"empty-"+f,class:e.normalizeClass(["h-full w-full image"+(t.items.length+f-1),"bg-gray-300 rounded-[3px]"])},null,2))),128)),e.createVNode(m,{modelValue:s.value,"onUpdate:modelValue":d[0]||(d[0]=f=>s.value=f),images:l.value,"start-index":r.value,delete:"true",download:"true",onDelete:d[1]||(d[1]=f=>o("delete",f))},null,8,["modelValue","images","start-index"])])):e.createCommentVNode("",!0)}}}),Tl={key:0,class:"text-xl font-semibold"},Ll={class:"flex gap-1"},Al=["accept"],Dl={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"},Il=e.defineComponent({__name:"widgetHeader",props:{title:{},accept:{}},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",t.title?"justify-between sm:items-center":"justify-end sm:items-center"])},[t.title?(e.openBlock(),e.createElementBlock("h3",Tl,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Ll,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",accept:t.accept??"image/*",class:"hidden",onChange:o[0]||(o[0]=s=>n.$emit("onAddImage",s)),multiple:""},null,40,Al),e.createElementVNode("div",Dl,[e.createVNode(e.unref(qo),{class:"h-4 w-4"}),o[1]||(o[1]=e.createTextVNode(" Додати зображення ",-1))])])])],2))}}),Ol={class:"w-full mx-auto font-sans",ref:"containerRef"},Ml={key:1},un=e.defineComponent({__name:"GalleryWidget",props:{title:{},items:{default:()=>[]},columns:{},maxHeight:{},format:{},onAddImage:{},onDelete:{},id:{},className:{},style:{}},emits:["delete","add","openLightbox"],setup(t,{emit:n}){const o=t,s=w=>{if(!w)return[];const x=Array.isArray(w)?w:w.split(",");return Array.from(new Set(x.map($=>$.trim().replace(/^\./,"").toLowerCase()).filter(Boolean)))},r=["jpg","jpeg","png","gif","webp","bmp","svg","avif","heic","tiff"],i=e.computed(()=>{const w=s(o.format);return w.length>0?w:void 0}),l=e.computed(()=>{const w=i.value;return!w||w.length===0?"image/*":w.map(x=>x.startsWith(".")?x:`.${x}`).join(",")}),a=w=>w?.split(".").pop()?.toLowerCase()??"",c=w=>{const x=w?.toLowerCase();return!!x&&!!i.value&&i.value.includes(x)},d=w=>{const x=w?.toLowerCase();return!!x&&r.includes(x)},m=w=>{const x=w.type?.toLowerCase(),$=w.ext?.toLowerCase();return x?.startsWith("image/")?i.value?c($):!0:$?i.value?c($):d($):!1},f=w=>{if(!w.type?.toLowerCase()?.startsWith("image/"))return!1;if(!i.value)return!0;const $=a(w.name);return c($)},h=w=>w.filter(m),E=e.ref(h(o.items??[])),b=n;E.value.length===0&&_();const v=w=>{o.onAddImage?o.onAddImage(w):k(w),b("add",w)},S=w=>{const x=E.value.find($=>$.file_path===w)?.file_id;x&&(o.onDelete?o.onDelete(x):C(x))},k=async w=>{const x=w.target;if(!x?.files||x.files.length===0)return;const $=Array.from(x.files),B=$.filter(D=>f(D)),g=i.value?.join(", ")??"image/*";if(B.length===0){console.warn(`Допустимі формати: ${g}. Завантажте зображення дозволеного типу.`);return}B.length!==$.length&&console.warn(`Частина файлів відфільтрована; дозволені формати: ${g}.`);try{await Promise.all(B.map(async D=>{const P=new FormData;P.append("file",D);const z=`/api/widget/file/${o.id}`,G=await fetch(z,{method:"POST",body:P});if(!G.ok)throw new Error(`HTTP error! status: ${G.status}`);return D})),await _()}catch(D){console.error("Помилка при завантаженні файлів:",D)}};async function _(){if(!o.id)return;const w=await fetch(`/api/widget/file/${o.id}`).then(x=>x.json());E.value=h(w.rows)}const C=async w=>{try{await fetch(`/api/widget/file/${o.id}/${w}`,{method:"DELETE"}),await _()}catch(x){console.error(x)}};return(w,x)=>(e.openBlock(),e.createElementBlock("div",Ol,[e.createVNode(Il,{title:t.title,accept:l.value,onOnAddImage:x[0]||(x[0]=$=>v($))},null,8,["title","accept"]),E.value.length>0?(e.openBlock(),e.createBlock($l,{key:0,items:E.value,onDelete:x[1]||(x[1]=$=>S($))},null,8,["items"])):(e.openBlock(),e.createElementBlock("div",Ml,[...x[2]||(x[2]=[e.createElementVNode("div",{class:"flex items-center justify-center h-full"},[e.createElementVNode("p",{class:"text-gray-500 leading-[3]"},"Зображень не знайдено")],-1)])]))],512))}}),Rl={class:"text-value"},Fl={class:"text-sm text-gray-900"},Pl=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",Rl,[e.createElementVNode("span",Fl,e.toDisplayString(o.value),1)]))}}),ot=(t,n)=>{const o=t.__vccOpts||t;for(const[s,r]of n)o[s]=r;return o},zl=ot(Pl,[["__scopeId","data-v-c14550b7"]]),jl={class:"link-value"},Hl=["href"],Ul=ot(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",jl,[e.createElementVNode("a",{href:String(t.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,Hl)]))}}),[["__scopeId","data-v-e6eb07a6"]]),ql={class:"date-value"},Wl={class:"text-sm text-gray-900"},Kl=ot(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",ql,[e.createElementVNode("span",Wl,e.toDisplayString(o.value),1)]))}}),[["__scopeId","data-v-b9600618"]]),Gl={class:"status-value"},Zl={key:0,class:"mr-1"},Jl=ot(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,i)=>(e.openBlock(),e.createElementBlock("div",Gl,[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",Zl,[e.createElementVNode("i",{class:e.normalizeClass(s.value)},null,2)])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(String(t.item.value)),1)],2)]))}}),[["__scopeId","data-v-c72e0b01"]]),Yl={class:"custom-value"},Xl={class:"text-sm text-gray-900"},Ql=ot(e.defineComponent({__name:"CustomValue",props:{item:{}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",Yl,[e.renderSlot(n.$slots,"default",{item:t.item,value:t.item.value},()=>[e.createElementVNode("span",Xl,e.toDisplayString(String(t.item.value)),1)],!0)]))}}),[["__scopeId","data-v-11a73810"]]),Vl=["id"],ea={key:0,class:"text-xl font-semibold text-gray-900 mb-4"},ta={key:1,class:"overflow-x-auto"},na={class:"min-w-full divide-y divide-gray-200"},oa={class:"bg-white divide-y divide-gray-200"},sa={class:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"},ra={class:"flex items-center gap-2"},ia=["title"],la={class:"px-6 py-4 whitespace-nowrap text-sm text-gray-500"},aa={key:2,class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"},ca={class:"flex items-start gap-3"},da={key:0,class:"flex-shrink-0"},fa={class:"flex-1 min-w-0"},pa={class:"flex items-center gap-2 mb-2"},ua={class:"text-sm font-medium text-gray-900"},ma=["title"],ha={key:3,class:"overflow-x-auto"},ga={class:"min-w-full divide-y divide-gray-200"},ya={class:"bg-white divide-y divide-gray-200"},va={class:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"},ba={class:"flex items-center gap-2"},ka=["title"],Ea={class:"px-6 py-4 whitespace-nowrap text-sm text-gray-500"},Hn=ot(e.defineComponent({__name:"DescriptionListWidget",props:{title:{},items:{},view:{},id:{},className:{},style:{}},setup(t){const n=o=>{switch(o.type){case"link":return Ul;case"date":return Kl;case"status":return Jl;case"custom":return Ql;default:return zl}};return(o,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["description-list-widget",t.className]),id:t.id,style:e.normalizeStyle(t.style)},[t.title?(e.openBlock(),e.createElementBlock("h3",ea,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),t.view==="table"?(e.openBlock(),e.createElementBlock("div",ta,[e.createElementVNode("table",na,[e.createElementVNode("tbody",oa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,r=>(e.openBlock(),e.createElementBlock("tr",{key:r.id||r.label},[e.createElementVNode("td",sa,[e.createElementVNode("div",ra,[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,ia)):e.createCommentVNode("",!0)])]),e.createElementVNode("td",la,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])]))),128))])])])):t.view==="grid"?(e.openBlock(),e.createElementBlock("div",aa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.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",ca,[r.icon?(e.openBlock(),e.createElementBlock("div",da,[e.createElementVNode("i",{class:e.normalizeClass([r.icon,"text-gray-500 text-lg"])},null,2)])):e.createCommentVNode("",!0),e.createElementVNode("div",fa,[e.createElementVNode("div",pa,[e.createElementVNode("h4",ua,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,ma)):e.createCommentVNode("",!0)]),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])])]))),128))])):(e.openBlock(),e.createElementBlock("div",ha,[e.createElementVNode("table",ga,[e.createElementVNode("tbody",ya,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,r=>(e.openBlock(),e.createElementBlock("tr",{key:r.id||r.label},[e.createElementVNode("td",va,[e.createElementVNode("div",ba,[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,ka)):e.createCommentVNode("",!0)])]),e.createElementVNode("td",Ea,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])]))),128))])])]))],14,Vl))}}),[["__scopeId","data-v-36d43e50"]]);function Vo(t){return new Promise((n,o)=>{if(typeof document>"u"){o(new Error("Document is not available"));return}if(Array.from(document.scripts||[]).some(i=>i.src===t)){n();return}const r=document.createElement("script");r.src=t,r.async=!0,r.onload=()=>n(),r.onerror=()=>o(new Error(`Failed to load ${t}`)),document.body.appendChild(r)})}function wa(t){if(typeof document>"u"||Array.from(document.styleSheets||[]).some(s=>s.href===t))return;const o=document.createElement("link");o.rel="stylesheet",o.href=t,document.head.appendChild(o)}const xa="https://unpkg.com/imask@7.6.1/dist/imask.min.js";let Un=null;function Na(){if(typeof window>"u")return;const t=window.IMask;if(typeof t=="function")return t;if(t&&typeof t.default=="function")return t.default}function Ca(){return Un||(Un=Vo(xa).then(()=>{const t=Na();if(!t)throw new Error("IMask is not available after loading the script");return t})),Un}function Sa(){return typeof window>"u"?"":window.location?.origin??""}function es(){if(!(typeof window>"u"))return window.maplibregl}const ts=Symbol("vs-widget-map");function qn(t){if(t==null||t==="")return"";if(typeof t=="object")try{return JSON.stringify(t)}catch{return""}return String(t)}function _a(t){const n=['<div class="map-popup">'];return n.push('<div class="map-popup__body">'),t.forEach(o=>{n.push(`<div class="flex flex-col"><span class="font-bold text-slate-700">${o.label}: </span><span class="text-slate-700">${o.value}</span></div>`)}),n.push("</div></div>"),n.join("")}function Ba(t){return typeof t=="string"?document.getElementById(t):"value"in t?t.value??null:t}function Wn(t){if(!t)return"";const n=t.trim();if(!n)return"";const s=n.replace(/\\n/g,"").replace(/\\r/g,"").replace(/\\t/g,"").replace(/\s+/g,"");if(!s)return"";if(/^https?:\/\//i.test(s))return s;const r=Sa(),i=s.replace(/^\/+/,"");return r?`${r}/${i}`:i?`/${i}`:""}function $a(t){const n=(t?.service??"").toLowerCase();if(n)return n;const o=(t?.url??"").toLowerCase();return/(\.mvt|\.pbf|\.vtile|\.vmt)(\?|$)/.test(o)?"vtile":/(\.png|\.jpg|\.jpeg|\.webp)(\?|$)/.test(o)?"raster":/service=wms|request=getmap|\/(wms|ows)(\?|$)/.test(o)?"wms":""}function Ta(t){return t.sourceLayer||t.layer||t.service_layer||t.service_key||t.map_key||t.dataset?.layer||t.id?.toString()}function mn(t){if(t!=null){if(typeof t=="number")return t;if(typeof t=="string"){const n=t.trim();if(!n)return;const o=Number(n);return Number.isFinite(o)?o:void 0}}}const ns=["#1d4ed8","#db2777","#059669","#f97316","#0ea5e9","#d946ef","#facc15","#14b8a6","#e11d48","#16a34a"];function La(t){const n=t?.color??ns[0],o=(t?.colorAttr??"").trim();if(!o)return n;const s=t?.colorSet&&Object.keys(t.colorSet).length>0,r={};if(s&&t?.colorSet?Object.entries(t.colorSet).forEach(([l,a])=>{const c=typeof a=="string"?a.trim():"",d=String(l).trim();c&&d&&(r[d]=c)}):ns.forEach((l,a)=>{r[String(a+1)]=l}),!Object.keys(r).length)return n;const i=["match",["to-string",["coalesce",["get",o],""]]];return Object.entries(r).forEach(([l,a])=>{i.push(String(l),a)}),i.push(n),i}const jt="map-highlight-source",Aa="map-highlight-fill",Da="map-highlight-line";function Ia(t){return t?typeof t.toJSON=="function"?t.toJSON():t.geometry?{type:"Feature",geometry:t.geometry,properties:t.properties??{}}:null:null}function os(t,n){return t?t.replace(/\{([^}]+)\}/g,(o,s)=>{const r=n?.[s];return r==null?"":String(r)}):""}async function Oa(){return wa("https://unpkg.com/maplibre-gl@^5.6.2/dist/maplibre-gl.css"),await Vo("https://unpkg.com/maplibre-gl@^5.6.2/dist/maplibre-gl.js"),es()}function hn(t){const n=e.inject(ts,void 0);if(!t){if(!n)throw new Error("useMap() must be called inside a map provider");return n}if(n)return n;const o=e.ref(null),s=e.ref(!1),r=e.ref({selectedBasemap:"",geometryVisible:!0,overlays:[]}),i=e.ref([]),l=e.ref([]),a=e.ref(null),c=e.ref(null),d=e.ref(null);let m=t.style??null,f=null;const h=u=>{u&&(o.value?o.value.setStyle(u):m=u)},E=()=>{r.value.overlays=l.value.map(u=>({id:u.id,name:u.config.name,visible:u.visible}))},b=u=>{const A=Array.isArray(u)?u:[];i.value=A,A.some(U=>U.key===r.value.selectedBasemap)||(r.value.selectedBasemap=A[0]?.key??"")},v=u=>{u&&l.value.forEach(A=>{A.layerIds.forEach(R=>{u.getLayer(R)&&u.removeLayer(R)}),u.getSource(A.sourceId)&&u.removeSource(A.sourceId),A.layerIds=[]})},S=()=>{const u=o.value;!u||typeof u.isStyleLoaded!="function"||!u.isStyleLoaded()||(l.value.forEach(A=>{k(u,A)}),z())},k=(u,A)=>{const R=$a(A.config);R==="vtile"?C(u,A):R==="raster"&&_(u,A)},_=(u,A)=>{const R=A.config,U=A.sourceId,Y=Wn(R.url);if(!Y)return;u.getSource(U)||u.addSource(U,{type:"raster",tiles:[Y],minzoom:R.minzoom??0,maxzoom:R.maxzoom??24});const q=`${A.id}-raster`;u.getLayer(q)||u.addLayer({id:q,type:"raster",source:U,layout:{visibility:A.visible?"visible":"none"}}),A.layerIds=[q],w(u,A)},C=(u,A)=>{const R=A.config,U=A.sourceId,Y=Wn(R.url);if(!Y)return;u.getSource(U)||u.addSource(U,{type:"vector",tiles:[Y],minzoom:R.minzoom??0,maxzoom:R.maxzoom??24});const q=R.style??{},oe=La(q),fe=[],ie={visibility:A.visible?"visible":"none"},De=Ta(R),Ke={source:U,layout:ie};if(De&&(Ke["source-layer"]=De),(q.type??"polygon").toLowerCase()==="point"){const Pe=`${A.id}-circle`;u.getLayer(Pe)||u.addLayer({id:Pe,type:"circle",...Ke,paint:{"circle-color":oe,"circle-opacity":q.opacity??1,"circle-radius":q.radius??q.width??3,"circle-stroke-color":q.stroke??q.color??"#ffffff","circle-stroke-width":q.width??1}}),fe.push(Pe);const Ge=q.text??q.label;if(Ge){const et=`${A.id}-symbol`,sn=mn(q.textSize)??10,Ft=q.textHaloColor??q.stroke??"#ffffff",Pt=mn(q.textHaloWidth)??1,wt=mn(q.textZoom??q.pointZoom),xt={"text-color":q.textColor??"#000000","text-halo-color":Ft,"text-halo-width":Pt},pt={id:et,type:"symbol",...Ke,layout:{"text-field":["coalesce",["get",Ge],""],"text-size":sn,"text-anchor":"top"},paint:xt};wt!=null&&(pt.minzoom=wt),u.getLayer(et)||u.addLayer(pt),fe.push(et)}}else{const Pe=`${A.id}-fill`;u.getLayer(Pe)||u.addLayer({id:Pe,type:"fill",...Ke,paint:{"fill-color":oe,"fill-opacity":q.opacity??.5,"fill-outline-color":q.stroke??q.color??"#0ea5e9"}}),fe.push(Pe);const Ge=`${A.id}-line`;u.getLayer(Ge)||u.addLayer({id:Ge,type:"line",...Ke,paint:{"line-color":q.stroke??q.color??"#0b74c4","line-width":mn(q.width??q.border)??1,"line-opacity":q.opacity??1}}),fe.push(Ge)}A.layerIds=fe,w(u,A)},w=(u,A)=>{const R=A.visible?"visible":"none";A.layerIds.forEach(U=>{u.getLayer(U)&&u.setLayoutProperty(U,"visibility",R)})},x=u=>{const A=Array.isArray(u)?u:[];v(o.value??void 0),d.value=null,I();const R=A.map((U,Y)=>{if(!U)return null;const q=Wn(U.url);if(!q)return null;const oe=U.id!=null?String(U.id):`overlay-${Y}`;return{id:oe,config:{...U,id:oe,url:q},visible:!1,sourceId:`${oe}-source`,layerIds:[]}}).filter(U=>!!U);l.value=R,E(),S()},$=(u,A)=>{const R=l.value.find(Y=>Y.id===u);if(!R)return;R.visible=A,E();const U=o.value;if(!(!U||typeof U.isStyleLoaded!="function"||!U.isStyleLoaded())){if(!R.layerIds.length){k(U,R);return}w(U,R)}},B=()=>{a.value&&(a.value.remove(),a.value=null)},g=(u,A={})=>!Array.isArray(u.popup)||!u.popup.length?[]:u.popup.map(R=>({label:R.label??R.field,value:qn(A?.[R.field])})).filter(R=>R.label&&R.value!==void 0),D=u=>{const A=o.value;if(!A||!u?.point)return;const R=A.queryRenderedFeatures(u.point);for(const U of R){const Y=U.layer?.id??U.sourceLayer;if(!Y)continue;const q=He(Y);if(!q)continue;const oe=g(q,U.properties??U.layer?.properties??{});if(!oe.length)continue;const fe=_a(oe),ie=es();if(!ie)return;const De=u.lngLat;if(c.value===Y&&a.value){a.value.setLngLat(De),a.value.setHTML(fe);return}c.value=Y,B(),a.value=new ie.Popup({closeButton:!1,closeOnClick:!1}).setLngLat(De).setHTML(fe).addTo(A);return}c.value=null,B()},P=()=>{c.value=null,B()},z=()=>{const u=o.value;!u||typeof u.isStyleLoaded!="function"||!u.isStyleLoaded()||u.getSource(jt)||(u.addSource(jt,{type:"geojson",data:{type:"FeatureCollection",features:[]}}),u.addLayer({id:Aa,type:"fill",source:jt,paint:{"fill-color":"#2563eb","fill-opacity":.35}}),u.addLayer({id:Da,type:"line",source:jt,paint:{"line-color":"#1d4ed8","line-width":2}}))},G=u=>{const A=o.value;if(!A||typeof A.isStyleLoaded!="function"||!A.isStyleLoaded())return;z();const R=A.getSource(jt);if(!(!R||typeof R.setData!="function")){if(!u){R.setData({type:"FeatureCollection",features:[]});return}R.setData({type:"FeatureCollection",features:[u]})}},Z=u=>{const A=Ia(u);A&&G(A)},I=()=>{G(null)},F=()=>{d.value=null,I()},N=u=>{if(u)return typeof u=="string"?u:u.field??u.name??u.key??u.label},j=u=>{if(u)return typeof u=="string"?u:u.label??u.title??u.field??u.name},te=(u,A)=>!u||!u.length?[]:u.map(R=>{const U=N(R);if(!U)return null;const Y=j(R),q=qn(A?.[U]);return!Y||q===""?null:{label:Y,value:q}}).filter(R=>!!R),Re=(u,A)=>!Array.isArray(u)||!u.length?[]:u.map(R=>{if(!R?.name)return null;const U=R.title??R.name,Y=qn(A?.[R.name]);return!U||Y===""?null:{label:U,value:Y}}).filter(R=>!!R),ye=(u,A)=>!Array.isArray(u)||!u.length?[]:u.map(U=>{const Y=os(U.url,A),q=U.label??U.url;return Y?{label:q,url:Y,target:U.target}:null}).filter(U=>!!U),me=async(u,A)=>{const R=os(u,A);if(!R)return null;try{const U=await fetch(R);return U.ok?await U.json():null}catch{return null}},we=async(u,A)=>{const R=A.properties??A.layer?.properties??{},U=te(u.card?.rows,R);let Y,q;if(u.card?.api){const ie=await me(u.card.api,R);ie&&(typeof ie.html=="string"&&ie.html.trim()&&(Y=ie.html),Array.isArray(ie.columns)&&ie.columns.length&&(q=ie.columns))}let oe=U;if(!Y&&q){const ie=Re(q,R);ie.length&&(oe=ie)}if(!oe.length&&!Y)return null;const fe=ye(u.card?.actions,R);return{title:R?.name??u.name,rows:oe,html:Y,actions:fe.length?fe:void 0}},ft=async u=>{const A=o.value;if(!A||!u?.point)return;const R=A.queryRenderedFeatures(u.point);for(const U of R){const Y=U.layer?.id??U.sourceLayer;if(!Y)continue;const q=He(Y);if(!q||!q.card)continue;const oe=await we(q,U);if(oe){d.value=oe,Z(U);return}}d.value=null,I()},Et=()=>{const u=o.value;u&&(u.on("mousemove",D),u.on("mouseleave",P),u.on("click",ft))},Be=()=>{const u=o.value;u&&(u.off("mousemove",D),u.off("mouseleave",P),u.off("click",ft),B(),I())},He=u=>{if(u)return l.value.find(A=>A.layerIds.includes(u))?.config},W=async()=>{const u=await Oa(),A=Ba(t.container);if(!u||!A)return;const R={container:A,center:t.center??[30.524,50.45],zoom:t.zoom??10,style:m??t.style??{version:8,sources:{},layers:[]},attributionControl:!1,...t.mapOptions};o.value=new u.Map(R);const U=()=>{S()};f=U,o.value.on("style.load",U),o.value.on("load",()=>{s.value=!0,m&&o.value&&(o.value.setStyle(m),m=null),S(),Et()})};e.onMounted(W),e.onBeforeUnmount(()=>{Be(),o.value&&f&&o.value.off("style.load",f),v(o.value??void 0),o.value?.remove(),o.value=null,s.value=!1});const K={map:o,ready:s,setStyle:h,flyTo:u=>o.value?.flyTo(u),fitBounds:(u,A)=>o.value?.fitBounds(u,A),setCenter:u=>o.value?.setCenter(u),setZoom:u=>o.value?.setZoom(u),addControl:(u,A)=>o.value?.addControl(u,A),removeControl:u=>o.value?.removeControl(u),on:(u,...A)=>o.value?.on(u,...A),off:(u,...A)=>o.value?.off(u,...A),project:u=>o.value?.project(u),unproject:u=>o.value?.unproject(u),state:r,basemapOptions:i,setOverlays:x,toggleOverlay:$,getOverlayConfig:He,selectedCard:d,setBasemapOptions:b,clearCard:F};return e.provide(ts,K),K}const Ma={class:"map-base-layer-menu"},Ra={key:1,class:"z-[500] bg-white absolute top-[10px] right-[10px] p-1.5 border rounded-lg text-sm cursor-pointer layers-button"},Fa={class:"flex items-center justify-between p-2 border-b"},Pa={class:"p-2 border-b"},za={class:"flex items-center"},ja=["value","checked","onChange"],Ha={class:"ml-2"},Ua={class:"p-2"},qa={class:"flex items-center"},Wa=["checked"],Ka=["checked","onChange"],Ga={class:"ml-2"},Za=e.defineComponent({__name:"LayerMenu",setup(t){const{state:n,basemapOptions:o,setBasemap:s,toggleGeometry:r,toggleOverlay:i}=hn(),l=e.ref(!1),a=`map-base-basemap-${Math.random().toString(36).slice(2,7)}`,c=e.computed(()=>o.value),d=e.computed(()=>n.value.selectedBasemap??""),m=e.computed(()=>n.value.geometryVisible??!0),f=e.computed(()=>n.value.overlays??[]),h=v=>{s?.(v)},E=()=>{r?.(!m.value)},b=v=>{i?.(v.id,!v.visible)};return(v,S)=>(e.openBlock(),e.createElementBlock("div",Ma,[l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,onClick:S[0]||(S[0]=k=>l.value=!0),class:"z-[500] bg-white absolute top-[10px] right-[10px] p-1.5 text-sm border rounded-lg cursor-pointer layers-button"}," Шари ")),l.value?(e.openBlock(),e.createElementBlock("div",Ra,[e.createElementVNode("div",Fa,[S[3]||(S[3]=e.createElementVNode("div",null,"Шари",-1)),e.createElementVNode("button",{type:"button",class:"text-gray-500 hover:text-gray-800",onClick:S[1]||(S[1]=k=>l.value=!1)},[...S[2]||(S[2]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"w-4 h-4"},[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),e.createElementVNode("path",{d:"M18 6l-12 12"}),e.createElementVNode("path",{d:"M6 6l12 12"})],-1)])])]),e.createElementVNode("div",Pa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,k=>(e.openBlock(),e.createElementBlock("div",{key:k.key},[e.createElementVNode("label",za,[e.createElementVNode("input",{type:"radio",name:a,value:k.key,checked:d.value===k.key,onChange:_=>h(k.key)},null,40,ja),e.createElementVNode("span",Ha,e.toDisplayString(k.name||k.key),1)])]))),128))]),e.createElementVNode("div",Ua,[e.createElementVNode("label",qa,[e.createElementVNode("input",{type:"checkbox",checked:m.value,onChange:E},null,40,Wa),S[4]||(S[4]=e.createElementVNode("span",{class:"ml-2"},"Геометрія/Межі",-1))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,k=>(e.openBlock(),e.createElementBlock("label",{class:"flex items-center",key:k.id},[e.createElementVNode("input",{type:"checkbox",checked:k.visible,onChange:_=>b(k)},null,40,Ka),e.createElementVNode("span",Ga,e.toDisplayString(k.name||k.id),1)]))),128))])])):e.createCommentVNode("",!0)]))}}),Ja={key:0,class:"absolute bottom-[35px] left-[10px] z-[400] bg-white border border-gray-200 rounded-md shadow px-3 py-2 text-[11px] sm:text-xs space-y-1 max-w-[220px]"},Ya={class:"leading-tight"},Xa=e.defineComponent({__name:"Legend",props:{items:{}},setup(t){return(n,o)=>t.items.length?(e.openBlock(),e.createElementBlock("div",Ja,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,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",Ya,e.toDisplayString(s.label),1)]))),128))])):e.createCommentVNode("",!0)}}),Qa={class:"flex items-center gap-2 bg-white border border-gray-200 rounded-lg shadow-[0_10px_22px_rgba(15,23,42,0.16)] px-3 py-2 text-[11px] text-slate-900 max-w-[220px]"},Va={class:"font-mono"},ec=e.defineComponent({__name:"CursorCoordinates",props:{coordinates:{}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",Qa,[e.createElementVNode("span",Va,e.toDisplayString(t.coordinates),1)]))}}),tc={class:"map-search-widget absolute top-[10px] left-[10px] flex flex-col gap-2 rounded-xl widget min-w-[200px]"},nc=["title"],oc={key:0,class:"vs-select__options absolute z-50 mt-1 w-auto min-w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm text-gray-900"},sc=["onClick"],rc=["placeholder"],ic={class:"divide-y divide-gray-100"},lc=["onClick"],ac=600,cc="0000000000:00:000:0000",dc=30,fc=8,pc="https://data.softpro.ua/api-user/gis-url-proxy",uc="https://geo.rv.ua/api-user/dzk.api",mc="https://nominatim.openstreetmap.org/search",hc=e.defineComponent({__name:"MapSearchWidget",props:{config:{}},setup(t){const n=t,o=hn(),s=e.getCurrentInstance();function r(){return s?.appContext.config.globalProperties?.$settings?.map?.searchViewbox}const l=!!r()?["xy","parcel","address"]:["xy","parcel"],a=e.computed(()=>{const W=n.config?.tools?.filter(K=>l.includes(K));return W&&W.length?W:l}),c=e.computed(()=>n.config?.placeholder?.trim()||"Пошук…"),d=e.ref(a.value[0]);e.watch(a,W=>{W.includes(d.value)||(d.value=W[0])});const m=e.ref(""),f=e.ref(!1),h=e.ref(null),E=e.ref(null),b=e.ref(null),v=e.ref([]),S=e.ref(null),k=e.computed(()=>d.value==="address"&&v.value.length>0);let _=null,C=null,w=null;const x=e.reactive({position:"absolute",left:"0px",top:"0px",width:"100%",display:"none"});function $(){if(!E.value)return;const W=E.value.getBoundingClientRect(),K=W.width+dc,u=W.left+window.scrollX,A=W.bottom+window.scrollY+fc;x.left=`${u}px`,x.top=`${A}px`,x.width=`${K}px`,x.display="block"}const B=()=>{k.value&&$()};function g(){_&&(clearTimeout(_),_=null)}function D(){C?.destroy(),C=null}async function P(){if(d.value!=="parcel")return;const W=b.value;if(!W)return;const K=await Ca();d.value==="parcel"&&(D(),C=K(W,{mask:cc,lazy:!1,placeholderChar:"_"}),C.on("accept",()=>{m.value=C?.value??""}))}function z(){return(C?.value??m.value).trim()}function G(){if(!(typeof window>"u"))return window.maplibregl}function Z(W){const K=o.map.value;if(!K)return;const u=G();if(u){if(w){w.setLngLat([W.lat,W.lng]);return}w=new u.Marker({color:"#2563eb"}).setLngLat([W.lat,W.lng]).addTo(K)}}function I(){w&&(w.remove(),w=null)}e.watch(d,W=>{m.value="",f.value=!1,v.value=[],g(),W==="parcel"?e.nextTick(()=>{P().catch(K=>{Ne.notify({type:"error",title:"Маска кадастру",message:K?.message||"Не вдалося ініціалізувати маску"})})}):D()}),e.watch(k,W=>{W?e.nextTick(()=>{$()}):x.display="none"}),e.watch(m,W=>{if(d.value!=="address"){v.value=[],g();return}if(!W.trim()){v.value=[],g();return}g(),_=window.setTimeout(()=>{we(W).catch(K=>{const u=K?.message||"Помилка пошуку адреси";Ne.notify({type:"error",title:"Пошук адреси",message:u})})},ac)});function F(W){d.value=W}function N(W){const K=W.target;if(f.value){const u=h.value;u&&!u.contains(K)&&(f.value=!1)}if(k.value){const u=S.value;u&&!u.contains(K)&&(v.value=[])}}e.onMounted(()=>{window.addEventListener("click",N,!0),window.addEventListener("scroll",B,!0),window.addEventListener("resize",B),d.value==="parcel"&&e.nextTick(()=>{P().catch(W=>{Ne.notify({type:"error",title:"Маска кадастру",message:W?.message||"Не вдалося ініціалізувати маску"})})})}),e.onBeforeUnmount(()=>{window.removeEventListener("click",N,!0),window.removeEventListener("scroll",B,!0),window.removeEventListener("resize",B),g(),D(),I()});function j(W){return W==="xy"?"Координати":W==="parcel"?"Кадастр":"Адреси"}function te(W){const K=W.replace(/[,]+/g," ").trim();if(!K)return null;const u=K.split(/\s+/).filter(Boolean);if(u.length<2)return null;console.log(u);const A=u.slice(0,2).map(Number);if(console.log(A),!A.every(ie=>Number.isFinite(ie)))return null;let[R,U]=A,Y=R,q=U;const oe=ie=>Math.abs(ie)<=90,fe=ie=>Math.abs(ie)<=180;if(!oe(Y)||!fe(q))if(oe(q)&&fe(Y))Y=R,q=U;else return null;return console.log(Y,q),{lat:Y,lng:q}}function Re(W){return(W?.items||[]).map((u,A)=>{const R=Number(u?.position?.lat),U=Number(u?.position?.lng);return!Number.isFinite(R)||!Number.isFinite(U)?null:{id:String(u?.id??A),title:u?.title||u?.address?.label||"Знайдений обʼєкт",lat:R,lng:U}}).filter(u=>!!u)}function ye(W){const K=W?.result||W?.data||W;if(!K)return[];const u=K.geom_centroid;if(!u||!Array.isArray(u.coordinates))return[];const[A,R]=u.coordinates;return!Number.isFinite(A)||!Number.isFinite(R)?[]:[{id:"parcel",title:K.cadnum||K.cad_num||"Земельна ділянка",lat:A,lng:R}]}function me(W){return(Array.isArray(W?.features)?W.features:[]).map((u,A)=>{const R=u?.geometry?.coordinates,U=Number(R?.[0]),Y=Number(R?.[1]);if(!Number.isFinite(U)||!Number.isFinite(Y))return null;const q=u?.properties||{},oe=q?.geocoding?.label||q?.display_name||q?.label||"Адреса";return{id:String(q?.geocoding?.place_id||q?.place_id||A),title:oe,lat:U,lng:Y}}).filter(u=>!!u)}async function we(W){v.value=[],g();const K=new URL(mc);K.searchParams.set("format","geojson"),K.searchParams.set("q",W),K.searchParams.set("addressdetails","1"),K.searchParams.set("bounded","1");const u=r();u&&K.searchParams.set("viewbox",u);const A=await fetch(K.toString());if(!A.ok)throw new Error(`HTTP ${A.status}`);const R=await A.json(),U=me(R);if(!U.length){Ne.notify({type:"warning",title:"Пошук адреси",message:"Не знайдено результатів"});return}v.value=U}function ft(W){Be(W),v.value=[],m.value=""}function Et(W){const u=W.replace(/\s+/g,"").split(":");if(u.length!==4)return!1;const A=[10,2,3,4];return u.every((R,U)=>R.length===A[U]&&/^\d+$/.test(R))}function Be(W){const K=n.config?.zoom??17;o.flyTo?.({center:[W.lat,W.lng],zoom:K}),Z(W)}async function He(){const W=d.value==="parcel"?z():m.value.trim();if(W){if(d.value==="xy"){const K=te(W);if(console.log(K),!K){Ne.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}Be(K),m.value="";return}if(d.value==="address"){try{await we(W)}catch(K){const u=K?.message||"Помилка пошуку адреси";Ne.notify({type:"error",title:"Пошук адреси",message:u})}return}try{const K=new URL(d.value==="here"?pc:uc);if(d.value==="here")K.searchParams.set("searchtext",W);else{if(!Et(W)){Ne.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}K.searchParams.set("cad_num",W)}const u=await fetch(K.toString());if(!u.ok)throw new Error(`HTTP ${u.status}`);const A=await u.json(),R=d.value==="here"?Re(A):ye(A);if(!R.length)Ne.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const U=R[0];Be(U),d.value==="parcel"&&C&&(C.value=""),m.value=""}}catch(K){const u=K?.message||"Помилка пошуку";Ne.notify({type:"error",title:"Пошук",message:u})}}}return(W,K)=>(e.openBlock(),e.createElementBlock("div",tc,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(He,["prevent"])},[a.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:h,class:"relative search-type w-[100px]"},[e.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:K[0]||(K[0]=u=>f.value=!f.value)},[e.createElementVNode("span",{class:"block w-full truncate",title:j(d.value)},e.toDisplayString(j(d.value)),9,nc),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":f.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[...K[3]||(K[3]=[e.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))]),f.value?(e.openBlock(),e.createElementBlock("div",oc,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,u=>(e.openBlock(),e.createElementBlock("li",{key:u,class:"px-3 py-2 cursor-pointer hover:bg-gray-100 text-gray-900",onClick:A=>F(u)},e.toDisplayString(j(u)),9,sc))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"searchWrapperRef",ref:E,class:"relative flex-1 min-w-[140px] bg-white rounded-md"},[d.value==="parcel"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"parcelInputRef",ref:b,"onUpdate:modelValue":K[1]||(K[1]=u=>m.value=u),placeholder:"0000000000:00:000:0000",inputmode:"numeric",type:"text",class:"vs-input !h-[34px] transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,512)),[[e.vModelText,m.value,void 0,{trim:!0}]]):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,"onUpdate:modelValue":K[2]||(K[2]=u=>m.value=u),placeholder:c.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,rc)),[[e.vModelText,m.value,void 0,{trim:!0}]]),K[4]||(K[4]=e.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1)),k.value?(e.openBlock(),e.createBlock(e.Teleport,{key:2,to:"body"},[e.createElementVNode("div",{ref_key:"addressResultsRef",ref:S,class:"vs-select__options mt-1 bg-white border border-gray-300 shadow-lg rounded-lg text-sm text-gray-900 z-50 max-h-60 overflow-auto",style:e.normalizeStyle(x)},[e.createElementVNode("ul",ic,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,u=>(e.openBlock(),e.createElementBlock("li",{key:u.id,class:"px-3 py-2 cursor-pointer hover:bg-gray-50",onClick:A=>ft(u)},e.toDisplayString(u.title),9,lc))),128))])],4)])):e.createCommentVNode("",!0)],512)],32)]))}}),gc={class:"map-center-control"},yc=["aria-label"],vc=e.defineComponent({directives:{tooltip:Ne.TooltipDirective},__name:"MapCenterControl",props:{center:{},zoom:{},targetCenter:{},targetZoom:{},targetLabel:{},targetAriaLabel:{}},setup(t){const n=t,{map:o,ready:s}=hn(),r=e.ref(null),i=e.ref(null),l=e.ref(null),a=e.ref(null);function c(b){if(Array.isArray(b)&&b.length>=2){const[v,S]=b.slice(0,2).map(k=>Number(k));return Number.isNaN(v)||Number.isNaN(S)?null:[v,S]}if(b&&typeof b=="object"){const v=b,S=v.lng??v.lon??v.long??v.x,k=v.lat??v.y;if(S!=null&&k!=null){const _=Number(S),C=Number(k);if(!Number.isNaN(_)&&!Number.isNaN(C))return[_,C]}}if(typeof b=="string"){const v=b.split(",").map(S=>Number(S.trim()));if(v.length>=2&&v.every(S=>!Number.isNaN(S)))return[v[0],v[1]]}return null}e.watch(()=>n.center,b=>{const v=c(b);v&&(r.value=v)},{immediate:!0}),e.watch(()=>n.zoom,b=>{const v=Number(b);Number.isNaN(v)||(i.value=v)},{immediate:!0}),e.watch(()=>n.targetCenter,b=>{l.value=c(b)},{immediate:!0}),e.watch(()=>n.targetZoom,b=>{const v=Number(b);a.value=Number.isNaN(v)?null:v},{immediate:!0});const d=e.computed(()=>n.targetLabel?.trim()||"Точка"),m=e.computed(()=>n.targetAriaLabel||"Перейти до точки"),f=e.computed(()=>!!l.value);e.onMounted(async()=>{const b=o.value;if(b){if(!r.value){const v=b.getCenter();r.value=[v.lng,v.lat]}i.value==null&&(i.value=b.getZoom())}});function h(){const b=o.value;if(!b)return;const v=r.value||(()=>{const k=b.getCenter();return[k.lng,k.lat]})(),S=i.value??b.getZoom();b.flyTo({center:v,zoom:S})}function E(){const b=o.value;if(!b||!l.value)return;const v=a.value??i.value??b.getZoom();b.flyTo({center:l.value,zoom:v})}return(b,v)=>{const S=e.resolveDirective("tooltip");return e.openBlock(),e.createElementBlock("div",gc,[f.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("button",{key:0,id:"center-btn",type:"button",class:"group relative flex items-center justify-center w-9 h-9 rounded-xl shadow-lg transition-transform transition-shadow duration-200 bg-white text-gray-700 hover:bg-gray-50 hover:scale-105 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400/60 focus-visible:ring-offset-2","aria-label":"Повернути центр",onClick:e.withModifiers(h,["stop"])},[e.createVNode(e.unref(Wr),{class:"w-4 h-4"})])),[[S,"Центр мапи"]]),f.value?e.withDirectives((e.openBlock(),e.createElementBlock("button",{key:1,id:"goto-target-btn",type:"button",class:"group relative flex items-center justify-center w-9 h-9 rounded-xl shadow-lg transition-transform transition-shadow duration-200 bg-white text-gray-700 hover:bg-gray-50 hover:scale-105 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400/60 focus-visible:ring-offset-2","aria-label":m.value,onClick:e.withModifiers(E,["stop"])},[e.createVNode(e.unref(Gr),{class:"w-4 h-4"})],8,yc)),[[S,d.value]]):e.createCommentVNode("",!0)])}}}),ss=ot(vc,[["__scopeId","data-v-73fcd71f"]]),bc={key:1,class:"absolute bottom-[50px] right-[10px] flex flex-col items-center gap-2 pointer-events-none z-[520]"},kc={key:0,class:"flex flex-col items-center gap-2 pointer-events-auto"},Ec=["aria-label"],wc={key:2,class:"absolute top-[10px] right-[10px] z-[600] min-w-[220px] max-w-[320px] bg-white border border-gray-200 rounded-[0.75rem] p-3 shadow-[0_25px_45px_rgba(15,23,42,0.2)]"},xc={class:"text-slate-900 font-semibold mb-1"},Nc=["innerHTML"],Cc={key:1,class:"space-y-2"},Sc={class:"text-gray-500"},_c={class:"font-medium text-slate-900"},Bc={key:2,class:"mt-2 flex flex-col gap-2"},$c=["href","target"],ut="map-basemap-source",Ht="map-basemap-layer",Tc=20,_t="map-katottg-geometry-source",gn="map-katottg-geometry-line",st="map-geometry-source",Bt="map-geometry-fill",$t="map-geometry-line",Tt="map-geometry-circle",yn=e.defineComponent({__name:"MapWidget",props:{height:{default:350},center:{},zoom:{},geom:{},layers:{},legend:{},tools:{},katottg:{}},setup(t){const n=t,o=[{key:"topo100",name:"Topographic 100",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png"},{key:"orto10",name:"Орто 10",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png"},{key:"osmb",name:"OSM Bright",url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png"}],i=(e.getCurrentInstance()?.appContext.config.globalProperties?.$settings??{})?.map??{};function l(p){if(p){if(Array.isArray(p)&&p.length>=2){const M=Number(p[0]),H=Number(p[1]);return!Number.isFinite(M)||!Number.isFinite(H)?void 0:[M,H]}if(typeof p=="object"){const M=p,H=M.lng??M.lon??M.long??M.x,X=M.lat??M.y;if(H!=null&&X!=null){const _e=Number(H),Ye=Number(X);if(Number.isFinite(_e)&&Number.isFinite(Ye))return[_e,Ye]}}}}function a(p){if(p==null)return;const M=Number(p);return Number.isFinite(M)?M:void 0}const c=()=>typeof window>"u"?"":window.location?.origin??"",d=p=>{if(!p)return"";const M=p.trim();if(!M)return"";const X=M.replace(/\n/g,"").replace(/\r/g,"").replace(/\t/g,"").replace(/\s+/g,"");if(!X)return"";if(/^https?:\/\//i.test(X))return X;const _e=c(),Ye=X.replace(/^\/+/,"");return _e?`${_e}/${Ye}`:Ye?`/${Ye}`:""},m=e.computed(()=>n.katottg!=null?n.katottg:i.katottg),f=e.computed(()=>(Array.isArray(i.basemaps)&&i.basemaps.length?i.basemaps:o).map((H,X)=>{const _e=typeof H.url=="string"?H.url.trim():"";return _e?{key:(H.key??H.name??`base-${X}`).trim()||`base-${X}`,url:_e,name:H.name??H.key??`Layer ${X+1}`}:null}).filter(H=>!!H)),h=l(i.center),E=a(i.zoom),b=zo(n.geom),v=Sr(b),S=v?[(v[0]+v[2])/2,(v[1]+v[3])/2]:void 0,k=e.ref(null),_=e.computed(()=>l(n.center)??null),C=e.computed(()=>_.value??h??null),w=p=>p?{version:8,sources:{[ut]:{type:"raster",tiles:[p],tileSize:256}},layers:[{id:Ht,type:"raster",source:ut,layout:{visibility:"visible"}}]}:{version:8,sources:{},layers:[]},x=d(f.value[0]?.url),$=hn({container:k,center:S??C.value??void 0,zoom:n.zoom??E,style:w(x)}),{map:B,setCenter:g,setZoom:D,state:P,getOverlayConfig:z,selectedCard:G,setBasemapOptions:Z,clearCard:I,addControl:F,removeControl:N,ready:j}=$,te=e.computed({get:()=>P.value.selectedBasemap??"",set:p=>{P.value.selectedBasemap=p}}),Re=e.computed({get:()=>P.value.geometryVisible??!0,set:p=>{P.value.geometryVisible=p}}),ye=e.computed(()=>{const p=n.height;return{height:typeof p=="number"?`${p}px`:String(p)}}),me=e.ref(!1),we=e.ref(!1),ft=e.computed(()=>me.value?"!fixed inset-0 w-screen h-screen z-[9999] bg-white":"relative w-full"),Et=e.computed(()=>{const p=["w-full","h-full"];return me.value||p.push(`min-h-[${ye.value.height}]`),p.join(" ")}),Be=e.computed(()=>G.value),He=()=>I?.(),W=e.ref(S??C.value??null),K=e.ref(n.zoom??E??null),u=e.ref(C.value);e.watch(C,p=>{u.value=p},{immediate:!0});const A=e.computed(()=>u.value??null),R=e.computed(()=>typeof n.zoom=="number"?n.zoom:typeof K.value=="number"?K.value:Tc),U=["home","fullscreen","scale","position"],Y=e.computed(()=>!Array.isArray(n.tools)||!n.tools.length?U:n.tools.filter(p=>U.includes(p))),q=p=>Y.value.includes(p);e.watch([B,j],([p,M])=>{if(!(!p||!M)){if(!W.value){const H=p.getCenter();W.value=[H.lng,H.lat]}K.value==null&&(K.value=p.getZoom())}},{immediate:!0});const oe=e.ref(null),fe=e.ref(""),ie=e.ref(null),De=p=>p?we.value?!0:typeof p.isStyleLoaded=="function"&&p.isStyleLoaded()?(we.value=!0,!0):!1:!1,Ke=p=>{if(!p)return"";const M=Number(p.lat??p[1]),H=Number(p.lng??p[0]);return!Number.isFinite(M)||!Number.isFinite(H)?"":`${H.toFixed(5)}, ${M.toFixed(5)}`},on=p=>{p?.lngLat&&(fe.value=Ke(p.lngLat))},Pe=()=>{fe.value=""},Ge=p=>{p&&(p.on("mousemove",on),p.on("mouseleave",Pe),ie.value=p)},et=p=>{p&&(p.off("mousemove",on),p.off("mouseleave",Pe),ie.value=null)},sn=e.computed(()=>q("scale"));e.watch([B,j],([p,M],[H])=>{H&&et(H),!(!p||!M)&&Ge(p)},{immediate:!0}),e.watch([B,j,sn],([p,M,H])=>{if(oe.value&&N&&(N(oe.value),oe.value=null),!p||!M||!H)return;const X=window?.maplibregl;X&&(oe.value=new X.ScaleControl({unit:"metric"}),F?.(oe.value,"bottom-left"))},{immediate:!0});const Ft=e.computed(()=>Array.isArray(n.legend)?n.legend.map((p,M)=>{const H=typeof p?.color=="string"?p.color.trim():"",X=typeof p?.label=="string"?p.label.trim():"";return!H||!X?null:{color:H,label:X,key:`${X}-${M}`}}).filter(p=>!!p):[]),Pt=e.computed(()=>Array.isArray(n.layers)&&n.layers.length?n.layers:Array.isArray(i.layers)&&i.layers.length?i.layers:[]);e.watch(f,p=>{if(Z?.(p),!p.length){te.value="";return}p.some(M=>M.key===te.value)||(te.value=p[0].key)},{immediate:!0});const wt=p=>{if(!p?.getStyle)return;const M=p.getStyle()??{},H=Array.isArray(M.layers)?M.layers:[];return H.length?H.find(_e=>_e.type!=="background")?.id??H[0]?.id:void 0},xt=p=>{p&&(p.getLayer(Ht)&&p.removeLayer(Ht),p.getSource(ut)&&p.removeSource(ut))},pt=(p,M)=>{if(!p)return;const H=wt(p);p.addSource(ut,{type:"raster",tiles:[M],tileSize:256}),p.addLayer({id:Ht,type:"raster",source:ut,layout:{visibility:"visible"}},H)},Mo=p=>{if(!p)return;const M=d(p.url);if(!M){tt.value=null;return}tt.value=M,xt(B.value),T()},tt=e.ref(null),y=e.ref(x||null),O=p=>{if(!p||p.__pendingBasemapHooked)return;p.__pendingBasemapHooked=!0;const M=()=>{p.__pendingBasemapHooked=!1,T()};p.once("style.load",M),p.once("styledata",M)},T=()=>{const p=B.value,M=tt.value;if(!(!M||!p)){if(!De(p)){O(p);return}if(y.value===M&&p.getSource(ut)&&p.getLayer(Ht)){tt.value=null;return}xt(p),pt(p,M),y.value=M,tt.value=null}},L=()=>{const p=te.value;if(!p)return;const M=f.value.find(H=>H.key===p);M&&Mo(M)};e.watch(te,()=>{L()},{immediate:!0}),e.watch(Pt,p=>{$.setOverlays?.(p)},{immediate:!0,deep:!0});const J=e.ref(null);let le=0;const ne=e.computed(()=>zo(J.value)),xe={fill:{"fill-color":"#0ea5e9","fill-opacity":.25},line:{"line-color":"#0b74c4","line-width":2},circle:{"circle-color":"#0ea5e9","circle-stroke-color":"#ffffff","circle-stroke-width":2,"circle-radius":7,"circle-opacity":.95}},nt={"line-color":"#1d4ed8","line-width":2,"line-dasharray":[6,4]},re=e.ref(b),Ue=e.ref(v),ve=e.ref(!1),Ze=e.computed(()=>{if(!Ue.value)return null;const[p,M,H,X]=Ue.value;return[(p+H)/2,(M+X)/2]}),zt=e.computed(()=>!!Ue.value),qe=e.ref(!!v);e.ref(!1);const Ro=()=>{me.value=!me.value},Je=e.ref(!1),Fo=()=>{const p=B.value;if(!p||!De(p))return;const M=re.value;if(!M){Tu(p),rn();return}let H=p.getSource(st);H?H.setData(M):(p.addSource(st,{type:"geojson",data:M}),$u(p),H=p.getSource(st)),Nr(p,Re.value?"visible":"none"),Lu(),rn(),Ue.value&&(!qe.value&&(ve.value||!Je.value)?(p.fitBounds(Ue.value,{padding:40,maxZoom:16,duration:0}),Je.value=!0,ve.value=!1):qe.value&&(qe.value=!1,ve.value=!1,Je.value=!0))},$u=p=>{const M=xe;p.getLayer(Bt)||p.addLayer({id:Bt,type:"fill",source:st,paint:M.fill}),p.getLayer($t)||p.addLayer({id:$t,type:"line",source:st,paint:M.line}),p.getLayer(Tt)||p.addLayer({id:Tt,type:"circle",source:st,paint:M.circle,filter:["==","$type","Point"]})},Tu=p=>{[Tt,$t,Bt].forEach(M=>{p.getLayer(M)&&p.removeLayer(M)}),p.getSource(st)&&p.removeSource(st)},Nr=(p,M)=>{De(p)&&[Tt,$t,Bt].forEach(H=>{p.getLayer(H)&&p.setLayoutProperty(H,"visibility",M)})},Lu=()=>{const p=B.value;if(!p||!De(p))return;const M=xe;p.getLayer(Bt)&&Object.entries(M.fill).forEach(([H,X])=>{p.setPaintProperty(Bt,H,X)}),p.getLayer($t)&&Object.entries(M.line).forEach(([H,X])=>{p.setPaintProperty($t,H,X)}),p.getLayer(Tt)&&Object.entries(M.circle).forEach(([H,X])=>{p.setPaintProperty(Tt,H,X)})},Cr=p=>{p.getLayer(gn)||p.addLayer({id:gn,type:"line",source:_t,layout:{visibility:"visible"},paint:nt})},rn=()=>{const p=B.value;if(!p||!De(p))return;const M=ne.value??{type:"FeatureCollection",features:[]};if(!p.getSource(_t)){p.addSource(_t,{type:"geojson",data:M}),Cr(p);return}const H=p.getSource(_t);H&&typeof H.setData=="function"&&H.setData(M),Cr(p)},Au=p=>{p.getLayer(gn)&&p.removeLayer(gn),p.getSource(_t)&&p.removeSource(_t)},Du=async p=>{const M=typeof p=="string"?p.trim():"",H=++le;if(!M){J.value=null;return}try{const X=await fetch(`https://data.gki.com.ua/api-user/atu/${M}`);if(le!==H)return;if(!X.ok){J.value=null;return}const _e=await X.json();if(le!==H)return;J.value=_e}catch{if(le!==H)return;J.value=null}};e.watch(m,p=>{Du(p)},{immediate:!0}),e.watch(ne,()=>{rn()},{immediate:!0}),e.watch(()=>n.geom,p=>{re.value=zo(p),Ue.value=Sr(re.value),Ze.value&&(W.value=Ze.value),Je.value=!1,ve.value=!0,Fo()},{deep:!0,immediate:!0}),e.watch(Re,()=>{const p=B.value;p&&De(p)&&Nr(p,Re.value?"visible":"none")});const Nt=()=>{we.value=!0,Fo(),rn(),T()},Po=()=>{Fo(),rn()};e.watch(B,(p,M)=>{M&&(M.off("style.load",Nt),M.off("load",Nt),M.off("idle",Po)),we.value=!1,p&&(p.on("load",Nt),p.on("style.load",Nt),p.on("idle",Po),typeof p.isStyleLoaded=="function"&&p.isStyleLoaded()&&Nt())}),e.watch(_,p=>{!B.value||!p||zt.value||g(p)}),e.watch(()=>n.zoom,p=>{!B.value||typeof p!="number"||D(p)}),e.onBeforeUnmount(()=>{oe.value&&N&&N(oe.value),ie.value?et(ie.value):B.value&&et(B.value);const p=B.value;p&&(Au(p),p.off("style.load",Nt),p.off("load",Nt),p.off("idle",Po))});function Iu(p){p&&(te.value=p)}function Ou(p){Re.value=p}$.setBasemap=Iu,$.toggleGeometry=Ou,$.setOverlays?.(Pt.value);function zo(p){if(!p)return null;if(p.type==="FeatureCollection")return p;if(p.type==="Feature")return{type:"FeatureCollection",features:[p]};const M=p.geometry??p;if(!M?.type)return null;if(M.type==="GeometryCollection"&&Array.isArray(M.geometries)){const H=M.geometries.filter(X=>X&&typeof X.type=="string").map(X=>({type:"Feature",geometry:X}));return H.length?{type:"FeatureCollection",features:H}:null}if(M.type==="MultiPoint"&&Array.isArray(M.coordinates)){const H=M.coordinates.filter(X=>Array.isArray(X)&&X.length>=2).map(X=>({type:"Feature",geometry:{type:"Point",coordinates:X}}));return H.length?{type:"FeatureCollection",features:H}:null}return{type:"FeatureCollection",features:[{type:"Feature",geometry:M}]}}function Sr(p){if(!p?.features?.length)return null;let M=1/0,H=1/0,X=-1/0,_e=-1/0;const Ye=ln=>{if(typeof ln[0]=="number"){const[Ct,_r]=ln;M=Math.min(M,Ct),H=Math.min(H,_r),X=Math.max(X,Ct),_e=Math.max(_e,_r);return}ln.forEach(Ct=>Ye(Ct))};return p.features.forEach(ln=>{const Ct=ln?.geometry?.coordinates;Ct&&Ye(Ct)}),M===1/0||H===1/0?null:[M,H,X,_e]}return(p,M)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(ft.value),style:e.normalizeStyle(me.value?void 0:ye.value)},[e.createElementVNode("div",{ref_key:"mapContainer",ref:k,class:e.normalizeClass(Et.value)},null,2),e.createVNode(Xa,{items:Ft.value},null,8,["items"]),q("search")?(e.openBlock(),e.createBlock(hc,{key:0})):e.createCommentVNode("",!0),q("home")||q("fullscreen")?(e.openBlock(),e.createElementBlock("div",bc,[q("home")?(e.openBlock(),e.createElementBlock("div",kc,[e.createVNode(ss,{center:A.value,zoom:R.value},null,8,["center","zoom"]),t.geom?(e.openBlock(),e.createBlock(ss,{key:0,"target-center":Ze.value,"target-zoom":R.value,"target-label":"Об'єкт","target-aria-label":"Перейти до об'єкта"},null,8,["target-center","target-zoom"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),q("fullscreen")?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"group relative flex items-center justify-center w-9 h-9 rounded-xl shadow-lg transition-transform duration-200 bg-white text-gray-700 hover:bg-gray-50 hover:scale-105 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400/60 focus-visible:ring-offset-2 pointer-events-auto",onClick:Ro,"aria-label":me.value?"Вихід з повноекранного режиму":"Увімкнути повноекранний режим"},[...M[0]||(M[0]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",class:"w-5 h-5"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4 8V4h4M20 8V4h-4M4 16v4h4m12-4v4h-4"})],-1)])],8,Ec)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),Be.value?(e.openBlock(),e.createElementBlock("div",wc,[e.createElementVNode("button",{type:"button",class:"absolute top-2 right-2 h-6 w-6 flex items-center justify-center rounded-full text-slate-500 hover:text-slate-900","aria-label":"Закрити",onClick:He},[...M[1]||(M[1]=[e.createElementVNode("span",{"aria-hidden":"true"},"×",-1)])]),e.createElementVNode("div",xc,e.toDisplayString(Be.value.title||"Об'єкт"),1),Be.value.html?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["text-[0.75rem] text-slate-700 leading-relaxed overflow-auto",`max-h-[calc(${ye.value.height}-120px)]`]),innerHTML:Be.value.html},null,10,Nc)):(e.openBlock(),e.createElementBlock("div",Cc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Be.value.rows,H=>(e.openBlock(),e.createElementBlock("div",{key:H.label,class:"flex justify-between text-[0.85rem] text-slate-700"},[e.createElementVNode("span",Sc,e.toDisplayString(H.label)+":",1),e.createElementVNode("span",_c,e.toDisplayString(H.value),1)]))),128))])),Be.value.actions?.length?(e.openBlock(),e.createElementBlock("div",Bc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Be.value.actions,H=>(e.openBlock(),e.createElementBlock("a",{key:H.url,class:"bg-sky-600 hover:bg-sky-700 transition-colors text-white font-semibold text-center py-[0.55rem] rounded-md w-full",href:H.url,target:H.target??void 0,rel:"noreferrer"},e.toDisplayString(H.label),9,$c))),128))])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createVNode(Za),q("position")&&fe.value?(e.openBlock(),e.createBlock(ec,{key:3,class:"absolute bottom-[10px] right-[10px] z-[500]",coordinates:fe.value},null,8,["coordinates"])):e.createCommentVNode("",!0)],6))}});function We(t){const n=Object.create(null);for(const o of t.split(","))n[o]=1;return o=>o in n}const Lc=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const Kn=()=>{},vn=()=>!1,Gn=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),rt=Object.assign,Xe=Array.isArray,be=t=>typeof t=="string",Zn=t=>typeof t=="symbol",Ac=t=>t!==null&&typeof t=="object",rs=We(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Dc=We("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),Jn=t=>{const n=Object.create(null);return(o=>n[o]||(n[o]=t(o)))},Ic=/-\w/g,it=Jn(t=>t.replace(Ic,n=>n.slice(1).toUpperCase())),Yn=Jn(t=>t.charAt(0).toUpperCase()+t.slice(1)),Oc=Jn(t=>t?`on${Yn(t)}`:""),Ut={1:"TEXT",2:"CLASS",4:"STYLE",8:"PROPS",16:"FULL_PROPS",32:"NEED_HYDRATION",64:"STABLE_FRAGMENT",128:"KEYED_FRAGMENT",256:"UNKEYED_FRAGMENT",512:"NEED_PATCH",1024:"DYNAMIC_SLOTS",2048:"DEV_ROOT_FRAGMENT",[-1]:"CACHED",[-2]:"BAIL"},Mc={1:"STABLE",2:"DYNAMIC",3:"FORWARDED"},Rc=/;(?![^(]*\))/g,Fc=/:([^]+)/,Pc=/\/\*[^]*?\*\//g;function zc(t){const n={};return t.replace(Pc,"").split(Rc).forEach(o=>{if(o){const s=o.split(Fc);s.length>1&&(n[s[0].trim()]=s[1].trim())}}),n}const jc="html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot",Hc="svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view",Uc="annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics",qc="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr",Wc=We(jc),Kc=We(Hc),Gc=We(Uc),Zc=We(qc);const qt=Symbol(process.env.NODE_ENV!=="production"?"Fragment":""),Wt=Symbol(process.env.NODE_ENV!=="production"?"Teleport":""),Xn=Symbol(process.env.NODE_ENV!=="production"?"Suspense":""),bn=Symbol(process.env.NODE_ENV!=="production"?"KeepAlive":""),is=Symbol(process.env.NODE_ENV!=="production"?"BaseTransition":""),mt=Symbol(process.env.NODE_ENV!=="production"?"openBlock":""),ls=Symbol(process.env.NODE_ENV!=="production"?"createBlock":""),as=Symbol(process.env.NODE_ENV!=="production"?"createElementBlock":""),Qn=Symbol(process.env.NODE_ENV!=="production"?"createVNode":""),Vn=Symbol(process.env.NODE_ENV!=="production"?"createElementVNode":""),Kt=Symbol(process.env.NODE_ENV!=="production"?"createCommentVNode":""),eo=Symbol(process.env.NODE_ENV!=="production"?"createTextVNode":""),cs=Symbol(process.env.NODE_ENV!=="production"?"createStaticVNode":""),to=Symbol(process.env.NODE_ENV!=="production"?"resolveComponent":""),no=Symbol(process.env.NODE_ENV!=="production"?"resolveDynamicComponent":""),oo=Symbol(process.env.NODE_ENV!=="production"?"resolveDirective":""),so=Symbol(process.env.NODE_ENV!=="production"?"resolveFilter":""),ro=Symbol(process.env.NODE_ENV!=="production"?"withDirectives":""),io=Symbol(process.env.NODE_ENV!=="production"?"renderList":""),ds=Symbol(process.env.NODE_ENV!=="production"?"renderSlot":""),fs=Symbol(process.env.NODE_ENV!=="production"?"createSlots":""),kn=Symbol(process.env.NODE_ENV!=="production"?"toDisplayString":""),En=Symbol(process.env.NODE_ENV!=="production"?"mergeProps":""),lo=Symbol(process.env.NODE_ENV!=="production"?"normalizeClass":""),ao=Symbol(process.env.NODE_ENV!=="production"?"normalizeStyle":""),Gt=Symbol(process.env.NODE_ENV!=="production"?"normalizeProps":""),Zt=Symbol(process.env.NODE_ENV!=="production"?"guardReactiveProps":""),co=Symbol(process.env.NODE_ENV!=="production"?"toHandlers":""),fo=Symbol(process.env.NODE_ENV!=="production"?"camelize":""),Jc=Symbol(process.env.NODE_ENV!=="production"?"capitalize":""),po=Symbol(process.env.NODE_ENV!=="production"?"toHandlerKey":""),wn=Symbol(process.env.NODE_ENV!=="production"?"setBlockTracking":""),Yc=Symbol(process.env.NODE_ENV!=="production"?"pushScopeId":""),Xc=Symbol(process.env.NODE_ENV!=="production"?"popScopeId":""),uo=Symbol(process.env.NODE_ENV!=="production"?"withCtx":""),Qc=Symbol(process.env.NODE_ENV!=="production"?"unref":""),Vc=Symbol(process.env.NODE_ENV!=="production"?"isRef":""),mo=Symbol(process.env.NODE_ENV!=="production"?"withMemo":""),ps=Symbol(process.env.NODE_ENV!=="production"?"isMemoSame":""),Lt={[qt]:"Fragment",[Wt]:"Teleport",[Xn]:"Suspense",[bn]:"KeepAlive",[is]:"BaseTransition",[mt]:"openBlock",[ls]:"createBlock",[as]:"createElementBlock",[Qn]:"createVNode",[Vn]:"createElementVNode",[Kt]:"createCommentVNode",[eo]:"createTextVNode",[cs]:"createStaticVNode",[to]:"resolveComponent",[no]:"resolveDynamicComponent",[oo]:"resolveDirective",[so]:"resolveFilter",[ro]:"withDirectives",[io]:"renderList",[ds]:"renderSlot",[fs]:"createSlots",[kn]:"toDisplayString",[En]:"mergeProps",[lo]:"normalizeClass",[ao]:"normalizeStyle",[Gt]:"normalizeProps",[Zt]:"guardReactiveProps",[co]:"toHandlers",[fo]:"camelize",[Jc]:"capitalize",[po]:"toHandlerKey",[wn]:"setBlockTracking",[Yc]:"pushScopeId",[Xc]:"popScopeId",[uo]:"withCtx",[Qc]:"unref",[Vc]:"isRef",[mo]:"withMemo",[ps]:"isMemoSame"};function ed(t){Object.getOwnPropertySymbols(t).forEach(n=>{Lt[n]=t[n]})}const Ie={start:{line:1,column:1,offset:0},end:{line:1,column:1,offset:0},source:""};function td(t,n=""){return{type:0,source:n,children:t,helpers:new Set,components:[],directives:[],hoists:[],imports:[],cached:[],temps:0,codegenNode:void 0,loc:Ie}}function Jt(t,n,o,s,r,i,l,a=!1,c=!1,d=!1,m=Ie){return t&&(a?(t.helper(mt),t.helper(It(t.inSSR,d))):t.helper(Dt(t.inSSR,d)),l&&t.helper(ro)),{type:13,tag:n,props:o,children:s,patchFlag:r,dynamicProps:i,directives:l,isBlock:a,disableTracking:c,isComponent:d,loc:m}}function ht(t,n=Ie){return{type:17,loc:n,elements:t}}function Fe(t,n=Ie){return{type:15,loc:n,properties:t}}function ue(t,n){return{type:16,loc:Ie,key:be(t)?Q(t,!0):t,value:n}}function Q(t,n=!1,o=Ie,s=0){return{type:4,loc:o,content:t,isStatic:n,constType:n?3:s}}function ze(t,n=Ie){return{type:8,loc:n,children:t}}function ge(t,n=[],o=Ie){return{type:14,loc:o,callee:t,arguments:n}}function At(t,n=void 0,o=!1,s=!1,r=Ie){return{type:18,params:t,returns:n,newline:o,isSlot:s,loc:r}}function ho(t,n,o,s=!0){return{type:19,test:t,consequent:n,alternate:o,newline:s,loc:Ie}}function nd(t,n,o=!1,s=!1){return{type:20,index:t,value:n,needPauseTracking:o,inVOnce:s,needArraySpread:!1,loc:Ie}}function od(t){return{type:21,body:t,loc:Ie}}function Dt(t,n){return t||n?Qn:Vn}function It(t,n){return t||n?ls:as}function go(t,{helper:n,removeHelper:o,inSSR:s}){t.isBlock||(t.isBlock=!0,o(Dt(s,t.isComponent)),n(mt),n(It(s,t.isComponent)))}const us=new Uint8Array([123,123]),ms=new Uint8Array([125,125]);function hs(t){return t>=97&&t<=122||t>=65&&t<=90}function Oe(t){return t===32||t===10||t===9||t===12||t===13}function lt(t){return t===47||t===62||Oe(t)}function xn(t){const n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}const ke={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97])};class sd{constructor(n,o){this.stack=n,this.cbs=o,this.state=1,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=1,this.inRCDATA=!1,this.inXML=!1,this.inVPre=!1,this.newlines=[],this.mode=0,this.delimiterOpen=us,this.delimiterClose=ms,this.delimiterIndex=-1,this.currentSequence=void 0,this.sequenceIndex=0}get inSFCRoot(){return this.mode===2&&this.stack.length===0}reset(){this.state=1,this.mode=0,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=1,this.inRCDATA=!1,this.currentSequence=void 0,this.newlines.length=0,this.delimiterOpen=us,this.delimiterClose=ms}getPos(n){let o=1,s=n+1;const r=this.newlines.length;let i=-1;if(r>100){let l=-1,a=r;for(;l+1<a;){const c=l+a>>>1;this.newlines[c]<n?l=c:a=c}i=l}else for(let l=r-1;l>=0;l--)if(n>this.newlines[l]){i=l;break}return i>=0&&(o=i+2,s=n-this.newlines[i]),{column:s,line:o,offset:n}}peek(){return this.buffer.charCodeAt(this.index+1)}stateText(n){n===60?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=5,this.sectionStart=this.index):!this.inVPre&&n===this.delimiterOpen[0]&&(this.state=2,this.delimiterIndex=0,this.stateInterpolationOpen(n))}stateInterpolationOpen(n){if(n===this.delimiterOpen[this.delimiterIndex])if(this.delimiterIndex===this.delimiterOpen.length-1){const o=this.index+1-this.delimiterOpen.length;o>this.sectionStart&&this.cbs.ontext(this.sectionStart,o),this.state=3,this.sectionStart=o}else this.delimiterIndex++;else this.inRCDATA?(this.state=32,this.stateInRCDATA(n)):(this.state=1,this.stateText(n))}stateInterpolation(n){n===this.delimiterClose[0]&&(this.state=4,this.delimiterIndex=0,this.stateInterpolationClose(n))}stateInterpolationClose(n){n===this.delimiterClose[this.delimiterIndex]?this.delimiterIndex===this.delimiterClose.length-1?(this.cbs.oninterpolation(this.sectionStart,this.index+1),this.inRCDATA?this.state=32:this.state=1,this.sectionStart=this.index+1):this.delimiterIndex++:(this.state=3,this.stateInterpolation(n))}stateSpecialStartSequence(n){const o=this.sequenceIndex===this.currentSequence.length;if(!(o?lt(n):(n|32)===this.currentSequence[this.sequenceIndex]))this.inRCDATA=!1;else if(!o){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=6,this.stateInTagName(n)}stateInRCDATA(n){if(this.sequenceIndex===this.currentSequence.length){if(n===62||Oe(n)){const o=this.index-this.currentSequence.length;if(this.sectionStart<o){const s=this.index;this.index=o,this.cbs.ontext(this.sectionStart,o),this.index=s}this.sectionStart=o+2,this.stateInClosingTagName(n),this.inRCDATA=!1;return}this.sequenceIndex=0}(n|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===ke.TitleEnd||this.currentSequence===ke.TextareaEnd&&!this.inSFCRoot?!this.inVPre&&n===this.delimiterOpen[0]&&(this.state=2,this.delimiterIndex=0,this.stateInterpolationOpen(n)):this.fastForwardTo(60)&&(this.sequenceIndex=1):this.sequenceIndex=+(n===60)}stateCDATASequence(n){n===ke.Cdata[this.sequenceIndex]?++this.sequenceIndex===ke.Cdata.length&&(this.state=28,this.currentSequence=ke.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=23,this.stateInDeclaration(n))}fastForwardTo(n){for(;++this.index<this.buffer.length;){const o=this.buffer.charCodeAt(this.index);if(o===10&&this.newlines.push(this.index),o===n)return!0}return this.index=this.buffer.length-1,!1}stateInCommentLike(n){n===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===ke.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index-2):this.cbs.oncomment(this.sectionStart,this.index-2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=1):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):n!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}startSpecial(n,o){this.enterRCDATA(n,o),this.state=31}enterRCDATA(n,o){this.inRCDATA=!0,this.currentSequence=n,this.sequenceIndex=o}stateBeforeTagName(n){n===33?(this.state=22,this.sectionStart=this.index+1):n===63?(this.state=24,this.sectionStart=this.index+1):hs(n)?(this.sectionStart=this.index,this.mode===0?this.state=6:this.inSFCRoot?this.state=34:this.inXML?this.state=6:n===116?this.state=30:this.state=n===115?29:6):n===47?this.state=8:(this.state=1,this.stateText(n))}stateInTagName(n){lt(n)&&this.handleTagName(n)}stateInSFCRootTagName(n){if(lt(n)){const o=this.buffer.slice(this.sectionStart,this.index);o!=="template"&&this.enterRCDATA(xn("</"+o),0),this.handleTagName(n)}}handleTagName(n){this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=11,this.stateBeforeAttrName(n)}stateBeforeClosingTagName(n){Oe(n)||(n===62?(process.env.NODE_ENV!=="production"&&this.cbs.onerr(14,this.index),this.state=1,this.sectionStart=this.index+1):(this.state=hs(n)?9:27,this.sectionStart=this.index))}stateInClosingTagName(n){(n===62||Oe(n))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=10,this.stateAfterClosingTagName(n))}stateAfterClosingTagName(n){n===62&&(this.state=1,this.sectionStart=this.index+1)}stateBeforeAttrName(n){n===62?(this.cbs.onopentagend(this.index),this.inRCDATA?this.state=32:this.state=1,this.sectionStart=this.index+1):n===47?(this.state=7,process.env.NODE_ENV!=="production"&&this.peek()!==62&&this.cbs.onerr(22,this.index)):n===60&&this.peek()===47?(this.cbs.onopentagend(this.index),this.state=5,this.sectionStart=this.index):Oe(n)||(process.env.NODE_ENV!=="production"&&n===61&&this.cbs.onerr(19,this.index),this.handleAttrStart(n))}handleAttrStart(n){n===118&&this.peek()===45?(this.state=13,this.sectionStart=this.index):n===46||n===58||n===64||n===35?(this.cbs.ondirname(this.index,this.index+1),this.state=14,this.sectionStart=this.index+1):(this.state=12,this.sectionStart=this.index)}stateInSelfClosingTag(n){n===62?(this.cbs.onselfclosingtag(this.index),this.state=1,this.sectionStart=this.index+1,this.inRCDATA=!1):Oe(n)||(this.state=11,this.stateBeforeAttrName(n))}stateInAttrName(n){n===61||lt(n)?(this.cbs.onattribname(this.sectionStart,this.index),this.handleAttrNameEnd(n)):process.env.NODE_ENV!=="production"&&(n===34||n===39||n===60)&&this.cbs.onerr(17,this.index)}stateInDirName(n){n===61||lt(n)?(this.cbs.ondirname(this.sectionStart,this.index),this.handleAttrNameEnd(n)):n===58?(this.cbs.ondirname(this.sectionStart,this.index),this.state=14,this.sectionStart=this.index+1):n===46&&(this.cbs.ondirname(this.sectionStart,this.index),this.state=16,this.sectionStart=this.index+1)}stateInDirArg(n){n===61||lt(n)?(this.cbs.ondirarg(this.sectionStart,this.index),this.handleAttrNameEnd(n)):n===91?this.state=15:n===46&&(this.cbs.ondirarg(this.sectionStart,this.index),this.state=16,this.sectionStart=this.index+1)}stateInDynamicDirArg(n){n===93?this.state=14:(n===61||lt(n))&&(this.cbs.ondirarg(this.sectionStart,this.index+1),this.handleAttrNameEnd(n),process.env.NODE_ENV!=="production"&&this.cbs.onerr(27,this.index))}stateInDirModifier(n){n===61||lt(n)?(this.cbs.ondirmodifier(this.sectionStart,this.index),this.handleAttrNameEnd(n)):n===46&&(this.cbs.ondirmodifier(this.sectionStart,this.index),this.sectionStart=this.index+1)}handleAttrNameEnd(n){this.sectionStart=this.index,this.state=17,this.cbs.onattribnameend(this.index),this.stateAfterAttrName(n)}stateAfterAttrName(n){n===61?this.state=18:n===47||n===62?(this.cbs.onattribend(0,this.sectionStart),this.sectionStart=-1,this.state=11,this.stateBeforeAttrName(n)):Oe(n)||(this.cbs.onattribend(0,this.sectionStart),this.handleAttrStart(n))}stateBeforeAttrValue(n){n===34?(this.state=19,this.sectionStart=this.index+1):n===39?(this.state=20,this.sectionStart=this.index+1):Oe(n)||(this.sectionStart=this.index,this.state=21,this.stateInAttrValueNoQuotes(n))}handleInAttrValue(n,o){(n===o||this.fastForwardTo(o))&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(o===34?3:2,this.index+1),this.state=11)}stateInAttrValueDoubleQuotes(n){this.handleInAttrValue(n,34)}stateInAttrValueSingleQuotes(n){this.handleInAttrValue(n,39)}stateInAttrValueNoQuotes(n){Oe(n)||n===62?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(1,this.index),this.state=11,this.stateBeforeAttrName(n)):(process.env.NODE_ENV!=="production"&&n===34||n===39||n===60||n===61||n===96)&&this.cbs.onerr(18,this.index)}stateBeforeDeclaration(n){n===91?(this.state=26,this.sequenceIndex=0):this.state=n===45?25:23}stateInDeclaration(n){(n===62||this.fastForwardTo(62))&&(this.state=1,this.sectionStart=this.index+1)}stateInProcessingInstruction(n){(n===62||this.fastForwardTo(62))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=1,this.sectionStart=this.index+1)}stateBeforeComment(n){n===45?(this.state=28,this.currentSequence=ke.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=23}stateInSpecialComment(n){(n===62||this.fastForwardTo(62))&&(this.cbs.oncomment(this.sectionStart,this.index),this.state=1,this.sectionStart=this.index+1)}stateBeforeSpecialS(n){n===ke.ScriptEnd[3]?this.startSpecial(ke.ScriptEnd,4):n===ke.StyleEnd[3]?this.startSpecial(ke.StyleEnd,4):(this.state=6,this.stateInTagName(n))}stateBeforeSpecialT(n){n===ke.TitleEnd[3]?this.startSpecial(ke.TitleEnd,4):n===ke.TextareaEnd[3]?this.startSpecial(ke.TextareaEnd,4):(this.state=6,this.stateInTagName(n))}startEntity(){}stateInEntity(){}parse(n){for(this.buffer=n;this.index<this.buffer.length;){const o=this.buffer.charCodeAt(this.index);switch(o===10&&this.state!==33&&this.newlines.push(this.index),this.state){case 1:{this.stateText(o);break}case 2:{this.stateInterpolationOpen(o);break}case 3:{this.stateInterpolation(o);break}case 4:{this.stateInterpolationClose(o);break}case 31:{this.stateSpecialStartSequence(o);break}case 32:{this.stateInRCDATA(o);break}case 26:{this.stateCDATASequence(o);break}case 19:{this.stateInAttrValueDoubleQuotes(o);break}case 12:{this.stateInAttrName(o);break}case 13:{this.stateInDirName(o);break}case 14:{this.stateInDirArg(o);break}case 15:{this.stateInDynamicDirArg(o);break}case 16:{this.stateInDirModifier(o);break}case 28:{this.stateInCommentLike(o);break}case 27:{this.stateInSpecialComment(o);break}case 11:{this.stateBeforeAttrName(o);break}case 6:{this.stateInTagName(o);break}case 34:{this.stateInSFCRootTagName(o);break}case 9:{this.stateInClosingTagName(o);break}case 5:{this.stateBeforeTagName(o);break}case 17:{this.stateAfterAttrName(o);break}case 20:{this.stateInAttrValueSingleQuotes(o);break}case 18:{this.stateBeforeAttrValue(o);break}case 8:{this.stateBeforeClosingTagName(o);break}case 10:{this.stateAfterClosingTagName(o);break}case 29:{this.stateBeforeSpecialS(o);break}case 30:{this.stateBeforeSpecialT(o);break}case 21:{this.stateInAttrValueNoQuotes(o);break}case 7:{this.stateInSelfClosingTag(o);break}case 23:{this.stateInDeclaration(o);break}case 22:{this.stateBeforeDeclaration(o);break}case 25:{this.stateBeforeComment(o);break}case 24:{this.stateInProcessingInstruction(o);break}case 33:{this.stateInEntity();break}}this.index++}this.cleanup(),this.finish()}cleanup(){this.sectionStart!==this.index&&(this.state===1||this.state===32&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===19||this.state===20||this.state===21)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}finish(){this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const n=this.buffer.length;this.sectionStart>=n||(this.state===28?this.currentSequence===ke.CdataEnd?this.cbs.oncdata(this.sectionStart,n):this.cbs.oncomment(this.sectionStart,n):this.state===6||this.state===11||this.state===18||this.state===17||this.state===12||this.state===13||this.state===14||this.state===15||this.state===16||this.state===20||this.state===19||this.state===21||this.state===9||this.cbs.ontext(this.sectionStart,n))}emitCodePoint(n,o){}}const rd={COMPILER_IS_ON_ELEMENT:{message:'Platform-native elements with "is" prop will no longer be treated as components in Vue 3 unless the "is" value is explicitly prefixed with "vue:".',link:"https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html"},COMPILER_V_BIND_SYNC:{message:t=>`.sync modifier for v-bind has been removed. Use v-model with argument instead. \`v-bind:${t}.sync\` should be changed to \`v-model:${t}\`.`,link:"https://v3-migration.vuejs.org/breaking-changes/v-model.html"},COMPILER_V_BIND_OBJECT_ORDER:{message:'v-bind="obj" usage is now order sensitive and behaves like JavaScript object spread: it will now overwrite an existing non-mergeable attribute that appears before v-bind in the case of conflict. To retain 2.x behavior, move v-bind to make it the first attribute. You can also suppress this warning if the usage is intended.',link:"https://v3-migration.vuejs.org/breaking-changes/v-bind.html"},COMPILER_V_ON_NATIVE:{message:".native modifier for v-on has been removed as is no longer necessary.",link:"https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html"},COMPILER_V_IF_V_FOR_PRECEDENCE:{message:"v-if / v-for precedence when used on the same element has changed in Vue 3: v-if now takes higher precedence and will no longer have access to v-for scope variables. It is best to avoid the ambiguity with <template> tags or use a computed property that filters v-for data source.",link:"https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html"},COMPILER_NATIVE_TEMPLATE:{message:"<template> with no special directives will render as a native template element instead of its inner content in Vue 3."},COMPILER_INLINE_TEMPLATE:{message:'"inline-template" has been removed in Vue 3.',link:"https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html"},COMPILER_FILTERS:{message:'filters have been removed in Vue 3. The "|" symbol will be treated as native JavaScript bitwise OR operator. Use method calls or computed properties instead.',link:"https://v3-migration.vuejs.org/breaking-changes/filters.html"}};function yo(t,{compatConfig:n}){const o=n&&n[t];return t==="MODE"?o||3:o}function at(t,n){const o=yo("MODE",n),s=yo(t,n);return o===3?s===!0:s!==!1}function Ot(t,n,o,...s){const r=at(t,n);return process.env.NODE_ENV!=="production"&&r&&Nn(t,n,o,...s),r}function Nn(t,n,o,...s){if(yo(t,n)==="suppress-warning")return;const{message:i,link:l}=rd[t],a=`(deprecation ${t}) ${typeof i=="function"?i(...s):i}${l?`
1
+ (function(he,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@opengis/core")):typeof define=="function"&&define.amd?define(["exports","vue","@opengis/core"],e):(he=typeof globalThis<"u"?globalThis:he||self,e(he.WidgetLib={},he.Vue,he.OpenGISCore))})(this,(function(he,e,Ne){"use strict";function Br(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const s=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,s.get?s:{enumerable:!0,get:()=>t[o]})}}return n.default=t,Object.freeze(n)}const $r=Br(e);const jo=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),Tr=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,o,s)=>s?s.toUpperCase():o.toLowerCase()),Lr=t=>{const n=Tr(t);return n.charAt(0).toUpperCase()+n.slice(1)},Ar=(...t)=>t.filter((n,o,s)=>!!n&&n.trim()!==""&&s.indexOf(n)===o).join(" ").trim();var an={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};const Dr=({size:t,strokeWidth:n=2,absoluteStrokeWidth:o,color:s,iconNode:r,name:i,class:l,...a},{slots:c})=>e.h("svg",{...an,width:t||an.width,height:t||an.height,stroke:s||an.stroke,"stroke-width":o?Number(n)*24/Number(t):n,class:Ar("lucide",...i?[`lucide-${jo(Lr(i))}-icon`,`lucide-${jo(i)}`]:["lucide-icon"]),...a},[...r.map(d=>e.h(...d)),...c.default?[c.default()]:[]]);const ae=(t,n)=>(o,{slots:s})=>e.h(Dr,{...o,iconNode:n,name:t},s);const Ir=ae("archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);const Or=ae("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Mr=ae("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Rr=ae("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]);const Fr=ae("circle-check-big",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);const Pr=ae("copy-plus",[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);const Ho=ae("download",[["path",{d:"M12 15V3",key:"m9g1x1"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["path",{d:"m7 10 5 5 5-5",key:"brsn70"}]]);const zr=ae("ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);const St=ae("file-text",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);const jr=ae("file",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);const Hr=ae("grid-3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);const Ur=ae("heart",[["path",{d:"M2 9.5a5.5 5.5 0 0 1 9.591-3.676.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5",key:"mvr1a0"}]]);const qr=ae("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);const Wr=ae("house",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);const Uo=ae("image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);const Kr=ae("list",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);const Gr=ae("map-pin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);const qo=ae("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const Zr=ae("reply",[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]);const Wo=ae("send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);const Jr=ae("sheet",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"3",x2:"21",y1:"9",y2:"9",key:"1vqk6q"}],["line",{x1:"3",x2:"21",y1:"15",y2:"15",key:"o2sbyz"}],["line",{x1:"9",x2:"9",y1:"9",y2:"21",key:"1ib60c"}],["line",{x1:"15",x2:"15",y1:"9",y2:"21",key:"1n26ft"}]]);const Ko=ae("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);const cn=ae("trash-2",[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]]);const Yr=ae("user-check",[["path",{d:"m16 11 2 2 4-4",key:"9rsbq5"}],["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]);const Go=ae("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);const Xr=ae("video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);const zn=ae("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),Qr={class:"border-t pt-3 mt-4"},Vr={class:"flex gap-2"},ei={class:"relative flex items-center justify-center shrink-0 overflow-hidden rounded-full h-5 w-5 bg-gray-200"},ti={class:"flex-1 space-y-2"},ni={class:"flex justify-between items-center"},oi={class:"flex gap-2"},si=["disabled"],Zo=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,i=()=>{s.value.trim()&&(r("sendComment",s.value),s.value="")},l=a=>{(a.ctrlKey||a.metaKey)&&a.key==="Enter"&&(a.preventDefault(),i())};return(a,c)=>(e.openBlock(),e.createElementBlock("div",Qr,[e.createElementVNode("div",Vr,[e.createElementVNode("span",ei,[e.createVNode(e.unref(Go),{class:"h-3 w-3 text-gray-500"})]),e.createElementVNode("div",ti,[e.withDirectives(e.createElementVNode("textarea",{"onUpdate:modelValue":c[0]||(c[0]=d=>s.value=d),onKeydown:l,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",ni,[c[4]||(c[4]=e.createElementVNode("span",{class:"text-xs text-gray-500 hidden sm:inline"},"Cmd+Enter to send",-1)),e.createElementVNode("div",oi,[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]=d=>o.value=!1)},[e.createVNode(e.unref(zn),{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:i},[e.createVNode(e.unref(Wo),{class:"h-3 w-3 mr-1"}),c[3]||(c[3]=e.createTextVNode(" Send ",-1))],8,si)])])])])]))}}),ri={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"},ii=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(),i=e.ref(!0),l=async d=>{s.value&&r.value&&!r.value.contains(d.target)&&!i.value&&(s.value=!1),i.value=!1},a=()=>{s.value=!1,o("edit")},c=()=>{s.value=!1,o("delete")};return e.onMounted(()=>{document.addEventListener("click",l)}),e.onUnmounted(()=>{document.removeEventListener("click",l)}),(d,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",ri,[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(Ko),{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(cn),{class:"h-3 w-3 mr-2"}),m[1]||(m[1]=e.createTextVNode(" Delete ",-1))])])],512))}}),li={class:"space-y-2"},ai={class:"relative flex items-center justify-center shrink-0 overflow-hidden rounded-full h-5 w-5 bg-gray-200"},ci={class:"flex-1 min-w-0 space-y-1 relative"},di={class:"flex items-center gap-2"},fi={class:"font-medium text-xs"},pi={class:"text-xs text-gray-500"},ui={key:0,class:"text-xs text-gray-700 leading-relaxed"},mi={class:"flex justify-between text-xs"},hi={class:"flex items-center gap-2"},gi={key:0,class:"flex gap-2"},yi=["disabled"],vi={key:0,class:"ml-8 space-y-1 border-l-2 border-gray-100 pl-3"},bi=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),i=e.ref("w-full p-2 rounded text-xs resize-none bg-transparent outline-none"),l=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),d=e.ref(!1),m=e.ref(!1),f=S=>{const k=new Date,_=Math.floor((k.getTime()-S.getTime())/(1e3*60*60));return _<1?`${Math.floor((k.getTime()-S.getTime())/6e4)}m`:_<24?`${_}h`:`${Math.floor(_/24)}d`},h=()=>{m.value=!m.value,m.value?o("like",s.comment.id,"add"):o("like",s.comment.id,"delete")},E=()=>{o("edit",s.comment.id,r.value),d.value=!1},b=(S,k)=>{o("like",S,k)},v=(S,k)=>{o("edit",S,k)};return(S,k)=>{const _=e.resolveComponent("CommentItem",!0);return e.openBlock(),e.createElementBlock("div",li,[e.createElementVNode("div",{class:e.normalizeClass(["group flex gap-2 p-2 rounded hover:bg-gray-50 transition-colors relative",d.value?"bg-gray-50":""])},[e.createElementVNode("span",ai,[e.createVNode(e.unref(Go),{class:"h-3 w-3 text-gray-500"})]),e.createElementVNode("div",ci,[e.createElementVNode("div",di,[e.createElementVNode("span",fi,e.toDisplayString(t.comment?.author),1),e.createElementVNode("span",pi,e.toDisplayString(f(t.comment?.createdAt)),1)]),d.value?e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{key:1,"onUpdate:modelValue":k[0]||(k[0]=C=>r.value=C),class:e.normalizeClass(d.value?l.value:i.value)},null,2)),[[e.vModelText,r.value]]):(e.openBlock(),e.createElementBlock("p",ui,e.toDisplayString(t.comment?.text),1)),e.createElementVNode("div",mi,[e.createElementVNode("div",hi,[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:k[1]||(k[1]=C=>h())},[e.createVNode(e.unref(Ur),{class:e.normalizeClass(["h-3 w-3",m.value?"fill-blue-600":""])},null,8,["class"]),e.createTextVNode(" "+e.toDisplayString(t.comment?.likes),1)],2),t.isInside?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("button",{key:0,class:"text-gray-500 hover:text-blue-600 transition-colors",onClick:k[2]||(k[2]=C=>c.value=!0)},[e.createVNode(e.unref(Zr),{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:k[3]||(k[3]=C=>a.value=!0)},[e.createVNode(e.unref(zr),{class:"h-3 w-3"})])]),d.value?(e.openBlock(),e.createElementBlock("div",gi,[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:k[4]||(k[4]=C=>d.value=!1)},[e.createVNode(e.unref(zn),{class:"h-3 w-3"}),k[11]||(k[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:k[5]||(k[5]=C=>E())},[e.createVNode(e.unref(Wo),{class:"h-3 w-3 mr-1"}),k[12]||(k[12]=e.createTextVNode(" Send ",-1))],8,yi)])):e.createCommentVNode("",!0)])]),a.value?(e.openBlock(),e.createBlock(ii,{key:0,showMoreOptions:a.value,"onUpdate:showMoreOptions":k[6]||(k[6]=C=>a.value=C),onEdit:k[7]||(k[7]=C=>d.value=!0),onDelete:k[8]||(k[8]=C=>S.$emit("delete",t.comment?.id)),comment:t.comment},null,8,["showMoreOptions","comment"])):e.createCommentVNode("",!0)],2),t.isInside?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",vi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.comment?.replies,C=>(e.openBlock(),e.createBlock(_,{key:C.id,comment:C,isInside:!0,onDelete:w=>S.$emit("delete",C.id),onLike:b,onEdit:v},null,8,["comment","onDelete"]))),128)),c.value&&!t.isInside?(e.openBlock(),e.createBlock(Zo,{key:0,onSendComment:k[9]||(k[9]=C=>S.$emit("reply",t.comment?.id,C)),isReply:c.value,"onUpdate:isReply":k[10]||(k[10]=C=>c.value=C)},null,8,["isReply"])):e.createCommentVNode("",!0)]))])}}}),ki=["id"],Ei={key:0,class:"text-xl font-semibold text-gray-900 mb-4"},dn=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 i(){if(!o.id)return;const f=await fetch(`/api/widget/comment/${o.id}`).then(h=>h.json());r.value=f.rows.map(h=>({id:h.communication_id,author:h.username,text:h.body,createdAt:new Date(h.cdate)}))}r.value.length===0&&i();const l=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 i()),s("add",f)},a=(f,h)=>{o?.onLike?.(f,h),s("like",f,h)},c=(f,h)=>{o.onReply?.(f,h),s("reply",f,h)},d=async(f,h)=>{o.onEdit?o.onEdit(f,h):o.id&&(await fetch(`/api/widget/comment/${o.id}/${f}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:h})}),await i()),s("edit",f,h)},m=async f=>{o.onDelete?o.onDelete(f):o.id&&(await fetch(`/api/widget/comment/${o.id}/${f}`,{method:"DELETE"}),await i()),s("delete",f)};return(f,h)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["mx-auto font-sans",t.className]),id:t.id,style:e.normalizeStyle(t.style)},[t.title?(e.openBlock(),e.createElementBlock("h3",Ei,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",{class:e.normalizeClass([t.maxHeight?"overflow-y-auto":"","space-y-3"]),style:e.normalizeStyle({maxHeight:t.maxHeight+"px"})},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,E=>(e.openBlock(),e.createBlock(bi,{key:E.id,comment:E,onReply:c,onLike:a,onDelete:h[0]||(h[0]=b=>m(b)),onEdit:d},null,8,["comment"]))),128))],6),e.createVNode(Zo,{onSendComment:h[1]||(h[1]=E=>l(E))})],14,ki))}}),Jo={CopyPlus:Pr,SquarePen:Ko,Trash2:cn},Yo=new Map([["file",{name:"File",color:"bg-green-100 text-green-700 border-green-200",icon:St}],["post",{name:"Post",color:"bg-blue-100 text-blue-700 border-blue-200",icon:Jr}],["user",{name:"User",color:"bg-purple-100 text-purple-700 border-purple-200",icon:Yr}],["custom",{name:"Custom",color:"bg-gray-100 text-gray-700 border-gray-200",icon:qr}]]),wi={class:"mx-auto font-sans"},xi={class:"bg-white rounded-lg border border-neutral-200 p-4 sm:p-6"},Ni={key:0,class:"py-8 text-center text-gray-500 text-sm"},Ci={key:1,class:"py-8 text-center text-gray-500 text-sm"},Si={key:2,class:"space-y-6"},_i={class:"flex justify-end"},Bi={class:"flex items-center gap-2 mb-3 sticky top-0 bg-white py-2 z-20"},$i={class:"text-xs font-semibold text-gray-800 uppercase tracking-wide"},Ti={class:"text-xs text-gray-500"},Li={class:"relative"},Ai={class:"bg-white border border-neutral-200 rounded-lg overflow-hidden divide-y divide-neutral-200"},Di=["onClick"],Ii={class:"flex-shrink-0 w-3.5 h-3.5 flex items-center justify-center"},Oi={class:"flex-1 min-w-0 flex items-center gap-2 text-sm"},Mi={class:"font-medium text-gray-800"},Ri={class:"text-gray-500"},Fi=["title"],Pi={class:"flex-shrink-0 flex items-center gap-2 text-xs text-gray-500 whitespace-nowrap"},zi={class:"px-4 pb-3 pl-[60px] space-y-2"},ji={class:"space-y-1.5"},Hi={class:"text-gray-500 font-[600] text-[0.92rem] min-w-[80px]"},Ui={class:"pl-2 text-gray-500 line-through"},qi={class:"text-gray-800 font-semibold"},Wi={key:0,class:"mt-4 text-center"},Ki={class:"text-xs text-gray-500"},fn=e.defineComponent({__name:"HistoryWidget",props:{data:{},title:{},maxHeight:{},hideChangesValuesKeys:{},iconSource:{default:"entityType"},showEntityId:{type:Boolean,default:!1},id:{},className:{},style:{}},setup(t){const n=t,o=e.ref(Array.isArray(n.data)?[...n.data]:[]),s=e.ref(!1),r=e.reactive({}),i=e.ref(new Map);function l(_){return _?Array.isArray(_)?_:Object.entries(_).map(([C,w],x)=>({changeDataId:`legacy-${x}`,entityKey:C,valueOld:String(w?.old??""),valueNew:String(w?.new??"")})):[]}function a(_){return l(_.changes).length>0}o.value.forEach(_=>{a(_)&&(r[_.id]=!0)}),e.onMounted(async()=>{try{const _=await fetch("/api/suggest/change_type");if(!_.ok)return;const C=await _.json(),w=Array.isArray(C)?C:C?.data;if(!Array.isArray(w))return;const x=new Map;for(const $ of w)$?.id!=null&&x.set(String($.id).toLowerCase(),{text:$.text??$.id,icon:$.icon??null});i.value=x}catch{}}),o.value.length===0&&n.id&&k(),e.watch(()=>n.id,()=>{n.id&&k()});function c(_){return Yo.get(_)??Yo.get("custom")}function d(_){if(n.iconSource==="actionType"){const w=i.value.get((_.action??"").toLowerCase())?.icon;if(w&&w in Jo)return Jo[w]}return c(_.entityType)?.icon}const m=e.computed(()=>new Set(n.hideChangesValuesKeys??[]));function f(_){return i.value.get((_??"").toLowerCase())?.text??_??""}function h(_){try{return new Date(_+"T00:00:00").toLocaleDateString("uk-UA",{day:"numeric",month:"long",year:"numeric"})}catch{return _}}const E=e.computed(()=>{const _=new Map;for(const C of o.value){const w=C.changeDate??C.timestamp?.toLocaleDateString("uk-UA")??"unknown";if(!_.has(w)){const x=C.changeDate?h(C.changeDate):C.timestamp?.toLocaleDateString("uk-UA",{day:"numeric",month:"long",year:"numeric"})??"Без дати";_.set(w,{dateKey:w,dateDisplay:x,rows:[]})}_.get(w).rows.push(C)}return Array.from(_.values()).sort((C,w)=>w.dateKey.localeCompare(C.dateKey))}),b=e.computed(()=>o.value.filter(a).some(_=>!r[_.id]));function v(_){r[_]=!r[_]}function S(){const _=b.value;o.value.forEach(C=>{a(C)&&(r[C.id]=_)})}async function k(){if(n.id){s.value=!0;try{const _=await fetch(`/api/widget/history/${n.id}`);if(!_.ok){o.value=[];return}const w=((await _.json()).rows??[]).map(x=>({id:x.change_id??x.entity_id??"",entityId:x.entity_id??"",entityType:x.entity_type??"custom",action:x.change_type??"",userId:x.change_user_id??"",userName:x.username??"",timestamp:new Date(x.cdate),changeDate:x.change_date,login:x.login,avatar:x.avatar??null,changes:Array.isArray(x.changes)?x.changes.map($=>({changeDataId:$.change_data_id,entityKey:$.entity_key,valueOld:$.value_old??"",valueNew:$.value_new??""})):[]}));o.value=w,w.forEach(x=>{a(x)&&(r[x.id]=!0)})}finally{s.value=!1}}}return(_,C)=>(e.openBlock(),e.createElementBlock("div",wi,[e.createElementVNode("div",xi,[e.createElementVNode("div",{class:"overflow-y-auto",style:e.normalizeStyle({maxHeight:t.maxHeight?t.maxHeight+"px":"calc(100vh - 320px)"})},[s.value?(e.openBlock(),e.createElementBlock("div",Ni," Завантаження... ")):o.value.length===0?(e.openBlock(),e.createElementBlock("div",Ci," Немає записів ")):(e.openBlock(),e.createElementBlock("div",Si,[e.createElementVNode("div",_i,[e.createElementVNode("button",{onClick:S,class:"flex items-center gap-2 text-sm font-semibold text-gray-800 hover:text-blue-600 transition-colors px-4 py-2 rounded-lg border border-neutral-300 hover:border-blue-500 bg-white hover:shadow-sm"},[e.createVNode(e.unref(Rr),{class:e.normalizeClass(["w-4 h-4",{"rotate-180":b.value}])},null,8,["class"]),e.createElementVNode("span",null,e.toDisplayString(b.value?"Розгорнути всі":"Згорнути всі"),1)])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(E.value,w=>(e.openBlock(),e.createElementBlock("div",{key:w.dateKey},[e.createElementVNode("div",Bi,[e.createElementVNode("h3",$i,e.toDisplayString(w.dateDisplay),1),C[0]||(C[0]=e.createElementVNode("div",{class:"flex-1 h-[1px] bg-neutral-200"},null,-1)),e.createElementVNode("span",Ti,e.toDisplayString(w.rows.length),1)]),e.createElementVNode("div",Li,[C[1]||(C[1]=e.createElementVNode("div",{class:"absolute left-[58px] top-6 bottom-0 w-[1px] bg-neutral-200"},null,-1)),e.createElementVNode("div",Ai,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.rows,x=>(e.openBlock(),e.createElementBlock("div",{key:x.id,class:"hover:bg-neutral-50 transition-colors"},[e.createElementVNode("div",{class:e.normalizeClass(["flex items-center gap-3 px-4 py-2.5",{"cursor-pointer":a(x)}]),onClick:$=>a(x)&&v(x.id)},[e.createElementVNode("div",Ii,[a(x)?(e.openBlock(),e.createBlock(e.unref(Mr),{key:0,class:e.normalizeClass(["w-3.5 h-3.5 text-gray-500 transition-transform duration-200",{"rotate-180":r[x.id]}]),"stroke-width":"1.5"},null,8,["class"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",{class:e.normalizeClass(`flex-shrink-0 w-8 h-8 rounded-full border-2 border-white shadow-sm flex items-center justify-center relative z-10 ${c(x.entityType)?.color??"bg-gray-100"}`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d(x)),{class:"w-4 h-4 relative z-10","stroke-width":"1.5"}))],2),e.createElementVNode("div",Oi,[e.createElementVNode("span",Mi,e.toDisplayString(x.userName),1),e.createElementVNode("span",Ri,e.toDisplayString(f(x.action)),1),t.showEntityId&&x.entityId?(e.openBlock(),e.createElementBlock("span",{key:0,class:"rounded border border-neutral-300 bg-neutral-50 px-1.5 py-0.5 font-mono text-[0.65rem] text-gray-600 max-w-[140px] truncate",title:x.entityId},e.toDisplayString(x.entityId),9,Fi)):e.createCommentVNode("",!0)]),e.createElementVNode("div",Pi,[e.createElementVNode("span",null,e.toDisplayString(x.timestamp?.toLocaleTimeString("uk-UA",{hour:"2-digit",minute:"2-digit"})),1)])],10,Di),e.withDirectives(e.createElementVNode("div",zi,[e.createElementVNode("div",ji,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l(x.changes),$=>(e.openBlock(),e.createElementBlock("div",{key:$.changeDataId,class:"flex items-center gap-2 text-sm pl-2"},[e.createElementVNode("span",Hi,e.toDisplayString($.entityKey),1),m.value.has($.entityKey)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("span",Ui,e.toDisplayString($.valueOld),1),e.createVNode(e.unref(Or),{class:"w-3 h-3 text-neutral-400","stroke-width":"1.5"}),e.createElementVNode("span",qi,e.toDisplayString($.valueNew),1)],64))]))),128))])],512),[[e.vShow,a(x)&&r[x.id]]])]))),128))])])]))),128))]))],4),!s.value&&o.value.length>0?(e.openBlock(),e.createElementBlock("div",Wi,[e.createElementVNode("p",Ki,e.toDisplayString(o.value.length)+" записів",1)])):e.createCommentVNode("",!0)])]))}}),Gi={key:0,class:"text-xl font-semibold"},Zi={class:"flex gap-1"},Ji={key:0},Yi=["accept"],Xi={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"},Qi=e.defineComponent({__name:"FileHeader",props:e.mergeModels({editable:{type:Boolean,default:!0},title:{},accept:{}},{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",t.title?"justify-between sm:items-center":"justify-end sm:items-center"])},[t.title?(e.openBlock(),e.createElementBlock("h3",Gi,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Zi,[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]=i=>n.value="list")},[e.createVNode(e.unref(Kr),{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]=i=>n.value="grid")},[e.createVNode(e.unref(Hr),{class:"h-4 w-4"})],2),t.editable?(e.openBlock(),e.createElementBlock("label",Ji,[e.createElementVNode("input",{type:"file",class:"hidden",accept:t.accept,onChange:r[2]||(r[2]=i=>s.$emit("onAddFile",i))},null,40,Yi),e.createElementVNode("div",Xi,[e.createVNode(e.unref(qo),{class:"h-4 w-4"}),r[3]||(r[3]=e.createTextVNode(" Додати файл ",-1))])])):e.createCommentVNode("",!0)])],2))}}),jn={pdf:{color:"bg-red-100 text-red-700 border-red-200",icon:St,label:"PDF"},sketch:{color:"bg-gray-100 text-gray-700 border-gray-200",icon:jr,label:"SKETCH"},mp4:{color:"bg-purple-100 text-purple-700 border-purple-200",icon:Xr,label:"VIDEO"},docx:{color:"bg-blue-100 text-blue-700 border-blue-200",icon:St,label:"DOC"},zip:{color:"bg-orange-100 text-orange-700 border-orange-200",icon:Ir,label:"ARCHIVE"},png:{color:"bg-green-100 text-green-700 border-green-200",icon:Uo,label:"IMAGE"},jpg:{color:"bg-green-100 text-green-700 border-green-200",icon:Uo,label:"IMAGE"},xlsx:{color:"bg-emerald-100 text-emerald-700 border-emerald-200",icon:St,label:"EXCEL"},pptx:{color:"bg-amber-100 text-amber-700 border-amber-200",icon:St,label:"PPT"}};function Xo(t,n="en"){const o={month:"short",day:"numeric"};return new Intl.DateTimeFormat(n,o).format(t)}function Qo(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 Vi={class:"space-y-0.5"},el=["onClick"],tl=["onClick"],nl={class:"flex items-center gap-2"},ol={class:"font-medium text-xs truncate hover:text-blue-600 cursor-pointer"},sl={class:"hidden sm:block text-xs text-gray-500 w-16 text-right"},rl={class:"hidden md:block text-xs text-gray-500 w-12 text-right"},il={class:"flex items-center gap-1"},ll=["onClick"],al=["onClick"],cl=e.defineComponent({__name:"FileList",props:{files:{}},emits:["delete","download","openLightbox"],setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",Vi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.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(jn)[s?.ext]?.color||"bg-blue-100 text-blue-700 border-blue-200"])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(jn)[s?.ext]?.icon||e.unref(jn).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",nl,[e.createElementVNode("span",ol,e.toDisplayString(s?.uploaded_name||s?.name),1)])],8,tl),e.createElementVNode("div",sl,e.toDisplayString(e.unref(Qo)(s.size)),1),e.createElementVNode("div",rl,e.toDisplayString(e.unref(Xo)(s.createdAt)),1),e.createElementVNode("div",il,[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(Ho),{class:"h-3 w-3"})],8,ll),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(cn),{class:"h-3 w-3"})],8,al)])],8,el))),128))]))}}),dl={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3"},fl=["onClick"],pl={class:"space-y-2"},ul={class:"flex justify-center items-center w-full aspect-[4/3] bg-gray-100 rounded overflow-hidden"},ml=["src"],hl={class:"space-y-1"},gl=["title"],yl={class:"text-xs text-gray-500 text-left"},vl={class:"absolute top-2 right-1 flex items-center gap-1"},bl=["onClick"],kl=["onClick"],El=e.defineComponent({__name:"FileGrid",props:{files:{}},emits:["delete","download","openLightbox"],setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",dl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.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",pl,[e.createElementVNode("div",ul,[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,ml)):(e.openBlock(),e.createBlock(e.unref(St),{key:1,class:"h-10 w-10 text-gray-500"}))]),e.createElementVNode("div",hl,[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,gl),e.createElementVNode("p",yl,e.toDisplayString(e.unref(Xo)(s.createdAt))+", "+e.toDisplayString(e.unref(Qo)(s.size)),1)])]),e.createElementVNode("div",vl,[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(Ho),{class:"h-3 w-3"})],8,bl),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(cn),{class:"h-3 w-3"})],8,kl)])],8,fl))),128))]))}}),wl={class:"mx-auto font-sans"},xl={key:1},pn=e.defineComponent({__name:"FilesWidget",props:{title:{},view:{},files:{default:()=>[]},format:{default:()=>[]},editable:{type:Boolean,default:!0},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),i=e.ref(!1),l=e.ref(0),a=e.ref(o.files??[]),c=e.computed(()=>{const g=(o.format??[]).map(P=>typeof P=="string"?P.trim():P==null?"":String(P).trim()).filter(P=>P.length>0),D=[];return g.forEach(P=>{const z=P.toLowerCase(),G=z.indexOf("/"),Z=G>=0;let I,F=!1,N;if(Z){I=z;const te=z.slice(G+1);F=te==="*",!F&&te&&(N=`.${te.replace(/^\.+/,"")}`)}else N=z.startsWith(".")?z:`.${z.replace(/^\.+/,"")}`;const j=Z?I:N??"";j&&D.push({acceptValue:j,mime:I,wildcard:F,extension:N})}),D.length?D:null}),d=e.computed(()=>{const B=c.value;if(!B)return;const g=B.map(D=>D.acceptValue).filter(Boolean);return g.length?g.join(","):void 0}),m=B=>{if(!c.value)return!0;const g=B.type?.toLowerCase(),D=B.name?.toLowerCase();return c.value.some(P=>{if(P.mime){if(g){if(P.wildcard){const z=P.mime.split("/")[0];if(g.startsWith(`${z}/`))return!0}else if(g===P.mime)return!0}return!!(P.extension&&D?.endsWith(P.extension))}return!!(P.extension&&D?.endsWith(P.extension))})},f=n;a.value.length===0&&w();const h=(B,g)=>{r.value=g,s.value=!0},E=()=>{r.value&&(k(r.value),r.value=null,s.value=!1)},b=e.computed(()=>Array.isArray(a.value)?a.value.map(B=>B?.file_path):[]),v=B=>{const g=b.value.findIndex(D=>D===B.file_path);g!==-1&&(i.value=!0,l.value=g)},S=B=>{o.onAddFile?o.onAddFile(B):x(B),f("add",B)},k=B=>{o.onDelete?o.onDelete(B):$(B),f("delete",B)},_=B=>{const g=document.createElement("a");g.setAttribute("download",B?.uploaded_name||B?.name),g.href=B?.file_path||B?.path,g.click()},C=e.ref(o.view==="grid"?"grid":"list");async function w(){if(!o.id)return;const B=await fetch(`/api/widget/file/${o.id}`).then(g=>g.json());B.rows.forEach(g=>{g.timestamp=new Date(g.cdate),g.id=g.entity_id,g.entityType=g.entity_type,g.entityId=g.entity_id,g.entityType=g.entity_type,g.action=g.change_type,g.userId=g.change_user_id,g.userName=g.username,g.timestamp=new Date(g.cdate),g.description=g.username,g.status=g.username}),a.value=B.rows}const x=async B=>{const D=B.target?.files;if(!D||D.length===0)return;const P=Array.from(D),z=[],G=[];if(P.forEach(Z=>{m(Z)?z.push(Z):G.push(Z)}),G.length&&console.warn(`Файлы пропущены, потому что не соответствуют разрешённым форматам: ${G.map(Z=>Z.name).join(", ")}`),z.length!==0)try{await Promise.all(z.map(async Z=>{const I=new FormData;I.append("file",Z);const F=`/api/widget/file/${o.id}`,N=await fetch(F,{method:"POST",body:I});if(!N.ok)throw new Error(`HTTP error! status: ${N.status}`);return Z})),await w()}catch(Z){console.error("Помилка при завантаженні файлів:",Z)}},$=async B=>{try{await fetch(`/api/widget/file/${o.id}/${B}`,{method:"DELETE"}),await w()}catch(g){console.error(g)}};return(B,g)=>{const D=e.resolveComponent("MessageBox"),P=e.resolveComponent("Lightbox");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",wl,[e.createVNode(Qi,{modelValue:C.value,"onUpdate:modelValue":g[0]||(g[0]=z=>C.value=z),title:o.title,onOnAddFile:g[1]||(g[1]=z=>S(z)),editable:o.editable,accept:d.value},null,8,["modelValue","title","editable","accept"]),a.value.length>0?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(t.maxHeight?"overflow-y-auto":""),style:e.normalizeStyle({maxHeight:t.maxHeight+"px"})},[C.value==="list"?(e.openBlock(),e.createBlock(cl,{key:0,onDelete:h,onDownload:_,onOpenLightbox:g[2]||(g[2]=z=>v(z)),files:a.value},null,8,["files"])):e.createCommentVNode("",!0),C.value==="grid"?(e.openBlock(),e.createBlock(El,{key:1,onDelete:h,onDownload:_,onOpenLightbox:g[3]||(g[3]=z=>v(z)),files:a.value},null,8,["files"])):e.createCommentVNode("",!0)],6)):(e.openBlock(),e.createElementBlock("div",xl,[...g[6]||(g[6]=[e.createElementVNode("div",{class:"flex items-center justify-center h-full"},[e.createElementVNode("p",{class:"text-gray-500 leading-[3]"},"Файлів не знайдено")],-1)])]))]),e.createVNode(D,{modelValue:s.value,"onUpdate:modelValue":g[4]||(g[4]=z=>s.value=z),onConfirm:E,title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати"},null,8,["modelValue"]),e.createVNode(P,{modelValue:i.value,"onUpdate:modelValue":g[5]||(g[5]=z=>i.value=z),images:b.value,"start-index":l.value},null,8,["modelValue","images","start-index"])],64)}}}),Nl={key:0,class:"image-wrapper h-full max-h-[400px]",id:"lightbox-gallery"},Cl=["onClick"],Sl={key:0,rel:"noreferrer",class:"relative block h-full w-full"},_l=["src"],Bl={key:0,class:"thumb-cover"},$l=e.defineComponent({__name:"GalleryContent",props:{title:{},items:{},columns:{},maxHeight:{},format:{},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),i=t,l=e.computed(()=>Array.isArray(i.items)?i.items.map(c=>c?.file_path):[]),a=c=>{const d=l.value.findIndex(m=>m===c.file_path);d!==-1&&(s.value=!0,r.value=d)};return(c,d)=>{const m=e.resolveComponent("Lightbox");return t.items?.length>=1?(e.openBlock(),e.createElementBlock("div",Nl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(f,h)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["h-full w-full image"+h,"cursor-pointer bg-teal-500 rounded-[3px]"]),key:h,onClick:e.withModifiers(E=>a(f),["stop"])},[h<5?(e.openBlock(),e.createElementBlock("div",Sl,[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]",h===0?"max-h-[411px]":"max-h-[calc((411px-3px)/2)]"])},null,10,_l),h===4&&t.items?.length>5?(e.openBlock(),e.createElementBlock("div",Bl," +"+e.toDisplayString(t.items?.length-5),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],10,Cl))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Math.max(0,5-t.items.length),f=>(e.openBlock(),e.createElementBlock("div",{key:"empty-"+f,class:e.normalizeClass(["h-full w-full image"+(t.items.length+f-1),"bg-gray-300 rounded-[3px]"])},null,2))),128)),e.createVNode(m,{modelValue:s.value,"onUpdate:modelValue":d[0]||(d[0]=f=>s.value=f),images:l.value,"start-index":r.value,delete:"true",download:"true",onDelete:d[1]||(d[1]=f=>o("delete",f))},null,8,["modelValue","images","start-index"])])):e.createCommentVNode("",!0)}}}),Tl={key:0,class:"text-xl font-semibold"},Ll={class:"flex gap-1"},Al=["accept"],Dl={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"},Il=e.defineComponent({__name:"widgetHeader",props:{title:{},accept:{}},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",t.title?"justify-between sm:items-center":"justify-end sm:items-center"])},[t.title?(e.openBlock(),e.createElementBlock("h3",Tl,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",Ll,[e.createElementVNode("label",null,[e.createElementVNode("input",{type:"file",accept:t.accept??"image/*",class:"hidden",onChange:o[0]||(o[0]=s=>n.$emit("onAddImage",s)),multiple:""},null,40,Al),e.createElementVNode("div",Dl,[e.createVNode(e.unref(qo),{class:"h-4 w-4"}),o[1]||(o[1]=e.createTextVNode(" Додати зображення ",-1))])])])],2))}}),Ol={class:"w-full mx-auto font-sans",ref:"containerRef"},Ml={key:1},un=e.defineComponent({__name:"GalleryWidget",props:{title:{},items:{default:()=>[]},columns:{},maxHeight:{},format:{},onAddImage:{},onDelete:{},id:{},className:{},style:{}},emits:["delete","add","openLightbox"],setup(t,{emit:n}){const o=t,s=w=>{if(!w)return[];const x=Array.isArray(w)?w:w.split(",");return Array.from(new Set(x.map($=>$.trim().replace(/^\./,"").toLowerCase()).filter(Boolean)))},r=["jpg","jpeg","png","gif","webp","bmp","svg","avif","heic","tiff"],i=e.computed(()=>{const w=s(o.format);return w.length>0?w:void 0}),l=e.computed(()=>{const w=i.value;return!w||w.length===0?"image/*":w.map(x=>x.startsWith(".")?x:`.${x}`).join(",")}),a=w=>w?.split(".").pop()?.toLowerCase()??"",c=w=>{const x=w?.toLowerCase();return!!x&&!!i.value&&i.value.includes(x)},d=w=>{const x=w?.toLowerCase();return!!x&&r.includes(x)},m=w=>{const x=w.type?.toLowerCase(),$=w.ext?.toLowerCase();return x?.startsWith("image/")?i.value?c($):!0:$?i.value?c($):d($):!1},f=w=>{if(!w.type?.toLowerCase()?.startsWith("image/"))return!1;if(!i.value)return!0;const $=a(w.name);return c($)},h=w=>w.filter(m),E=e.ref(h(o.items??[])),b=n;E.value.length===0&&_();const v=w=>{o.onAddImage?o.onAddImage(w):k(w),b("add",w)},S=w=>{const x=E.value.find($=>$.file_path===w)?.file_id;x&&(o.onDelete?o.onDelete(x):C(x))},k=async w=>{const x=w.target;if(!x?.files||x.files.length===0)return;const $=Array.from(x.files),B=$.filter(D=>f(D)),g=i.value?.join(", ")??"image/*";if(B.length===0){console.warn(`Допустимі формати: ${g}. Завантажте зображення дозволеного типу.`);return}B.length!==$.length&&console.warn(`Частина файлів відфільтрована; дозволені формати: ${g}.`);try{await Promise.all(B.map(async D=>{const P=new FormData;P.append("file",D);const z=`/api/widget/file/${o.id}`,G=await fetch(z,{method:"POST",body:P});if(!G.ok)throw new Error(`HTTP error! status: ${G.status}`);return D})),await _()}catch(D){console.error("Помилка при завантаженні файлів:",D)}};async function _(){if(!o.id)return;const w=await fetch(`/api/widget/file/${o.id}`).then(x=>x.json());E.value=h(w.rows)}const C=async w=>{try{await fetch(`/api/widget/file/${o.id}/${w}`,{method:"DELETE"}),await _()}catch(x){console.error(x)}};return(w,x)=>(e.openBlock(),e.createElementBlock("div",Ol,[e.createVNode(Il,{title:t.title,accept:l.value,onOnAddImage:x[0]||(x[0]=$=>v($))},null,8,["title","accept"]),E.value.length>0?(e.openBlock(),e.createBlock($l,{key:0,items:E.value,onDelete:x[1]||(x[1]=$=>S($))},null,8,["items"])):(e.openBlock(),e.createElementBlock("div",Ml,[...x[2]||(x[2]=[e.createElementVNode("div",{class:"flex items-center justify-center h-full"},[e.createElementVNode("p",{class:"text-gray-500 leading-[3]"},"Зображень не знайдено")],-1)])]))],512))}}),Rl={class:"text-value"},Fl={class:"text-sm text-gray-900"},Pl=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",Rl,[e.createElementVNode("span",Fl,e.toDisplayString(o.value),1)]))}}),ot=(t,n)=>{const o=t.__vccOpts||t;for(const[s,r]of n)o[s]=r;return o},zl=ot(Pl,[["__scopeId","data-v-c14550b7"]]),jl={class:"link-value"},Hl=["href"],Ul=ot(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",jl,[e.createElementVNode("a",{href:String(t.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,Hl)]))}}),[["__scopeId","data-v-e6eb07a6"]]),ql={class:"date-value"},Wl={class:"text-sm text-gray-900"},Kl=ot(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",ql,[e.createElementVNode("span",Wl,e.toDisplayString(o.value),1)]))}}),[["__scopeId","data-v-b9600618"]]),Gl={class:"status-value"},Zl={key:0,class:"mr-1"},Jl=ot(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,i)=>(e.openBlock(),e.createElementBlock("div",Gl,[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",Zl,[e.createElementVNode("i",{class:e.normalizeClass(s.value)},null,2)])):e.createCommentVNode("",!0),e.createTextVNode(" "+e.toDisplayString(String(t.item.value)),1)],2)]))}}),[["__scopeId","data-v-c72e0b01"]]),Yl={class:"custom-value"},Xl={class:"text-sm text-gray-900"},Ql=ot(e.defineComponent({__name:"CustomValue",props:{item:{}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",Yl,[e.renderSlot(n.$slots,"default",{item:t.item,value:t.item.value},()=>[e.createElementVNode("span",Xl,e.toDisplayString(String(t.item.value)),1)],!0)]))}}),[["__scopeId","data-v-11a73810"]]),Vl=["id"],ea={key:0,class:"text-xl font-semibold text-gray-900 mb-4"},ta={key:1,class:"overflow-x-auto"},na={class:"min-w-full divide-y divide-gray-200"},oa={class:"bg-white divide-y divide-gray-200"},sa={class:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"},ra={class:"flex items-center gap-2"},ia=["title"],la={class:"px-6 py-4 whitespace-nowrap text-sm text-gray-500"},aa={key:2,class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"},ca={class:"flex items-start gap-3"},da={key:0,class:"flex-shrink-0"},fa={class:"flex-1 min-w-0"},pa={class:"flex items-center gap-2 mb-2"},ua={class:"text-sm font-medium text-gray-900"},ma=["title"],ha={key:3,class:"overflow-x-auto"},ga={class:"min-w-full divide-y divide-gray-200"},ya={class:"bg-white divide-y divide-gray-200"},va={class:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"},ba={class:"flex items-center gap-2"},ka=["title"],Ea={class:"px-6 py-4 whitespace-nowrap text-sm text-gray-500"},Hn=ot(e.defineComponent({__name:"DescriptionListWidget",props:{title:{},items:{},view:{},id:{},className:{},style:{}},setup(t){const n=o=>{switch(o.type){case"link":return Ul;case"date":return Kl;case"status":return Jl;case"custom":return Ql;default:return zl}};return(o,s)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["description-list-widget",t.className]),id:t.id,style:e.normalizeStyle(t.style)},[t.title?(e.openBlock(),e.createElementBlock("h3",ea,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),t.view==="table"?(e.openBlock(),e.createElementBlock("div",ta,[e.createElementVNode("table",na,[e.createElementVNode("tbody",oa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,r=>(e.openBlock(),e.createElementBlock("tr",{key:r.id||r.label},[e.createElementVNode("td",sa,[e.createElementVNode("div",ra,[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,ia)):e.createCommentVNode("",!0)])]),e.createElementVNode("td",la,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])]))),128))])])])):t.view==="grid"?(e.openBlock(),e.createElementBlock("div",aa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.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",ca,[r.icon?(e.openBlock(),e.createElementBlock("div",da,[e.createElementVNode("i",{class:e.normalizeClass([r.icon,"text-gray-500 text-lg"])},null,2)])):e.createCommentVNode("",!0),e.createElementVNode("div",fa,[e.createElementVNode("div",pa,[e.createElementVNode("h4",ua,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,ma)):e.createCommentVNode("",!0)]),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])])]))),128))])):(e.openBlock(),e.createElementBlock("div",ha,[e.createElementVNode("table",ga,[e.createElementVNode("tbody",ya,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,r=>(e.openBlock(),e.createElementBlock("tr",{key:r.id||r.label},[e.createElementVNode("td",va,[e.createElementVNode("div",ba,[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,ka)):e.createCommentVNode("",!0)])]),e.createElementVNode("td",Ea,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])]))),128))])])]))],14,Vl))}}),[["__scopeId","data-v-36d43e50"]]);function Vo(t){return new Promise((n,o)=>{if(typeof document>"u"){o(new Error("Document is not available"));return}if(Array.from(document.scripts||[]).some(i=>i.src===t)){n();return}const r=document.createElement("script");r.src=t,r.async=!0,r.onload=()=>n(),r.onerror=()=>o(new Error(`Failed to load ${t}`)),document.body.appendChild(r)})}function wa(t){if(typeof document>"u"||Array.from(document.styleSheets||[]).some(s=>s.href===t))return;const o=document.createElement("link");o.rel="stylesheet",o.href=t,document.head.appendChild(o)}const xa="https://unpkg.com/imask@7.6.1/dist/imask.min.js";let Un=null;function Na(){if(typeof window>"u")return;const t=window.IMask;if(typeof t=="function")return t;if(t&&typeof t.default=="function")return t.default}function Ca(){return Un||(Un=Vo(xa).then(()=>{const t=Na();if(!t)throw new Error("IMask is not available after loading the script");return t})),Un}function Sa(){return typeof window>"u"?"":window.location?.origin??""}function es(){if(!(typeof window>"u"))return window.maplibregl}const ts=Symbol("vs-widget-map");function qn(t){if(t==null||t==="")return"";if(typeof t=="object")try{return JSON.stringify(t)}catch{return""}return String(t)}function _a(t){const n=['<div class="map-popup">'];return n.push('<div class="map-popup__body">'),t.forEach(o=>{n.push(`<div class="flex flex-col"><span class="font-bold text-slate-700">${o.label}: </span><span class="text-slate-700">${o.value}</span></div>`)}),n.push("</div></div>"),n.join("")}function Ba(t){return typeof t=="string"?document.getElementById(t):"value"in t?t.value??null:t}function Wn(t){if(!t)return"";const n=t.trim();if(!n)return"";const s=n.replace(/\\n/g,"").replace(/\\r/g,"").replace(/\\t/g,"").replace(/\s+/g,"");if(!s)return"";if(/^https?:\/\//i.test(s))return s;const r=Sa(),i=s.replace(/^\/+/,"");return r?`${r}/${i}`:i?`/${i}`:""}function $a(t){const n=(t?.service??"").toLowerCase();if(n)return n;const o=(t?.url??"").toLowerCase();return/(\.mvt|\.pbf|\.vtile|\.vmt)(\?|$)/.test(o)?"vtile":/(\.png|\.jpg|\.jpeg|\.webp)(\?|$)/.test(o)?"raster":/service=wms|request=getmap|\/(wms|ows)(\?|$)/.test(o)?"wms":""}function Ta(t){return t.sourceLayer||t.layer||t.service_layer||t.service_key||t.map_key||t.dataset?.layer||t.id?.toString()}function mn(t){if(t!=null){if(typeof t=="number")return t;if(typeof t=="string"){const n=t.trim();if(!n)return;const o=Number(n);return Number.isFinite(o)?o:void 0}}}const ns=["#1d4ed8","#db2777","#059669","#f97316","#0ea5e9","#d946ef","#facc15","#14b8a6","#e11d48","#16a34a"];function La(t){const n=t?.color??ns[0],o=(t?.colorAttr??"").trim();if(!o)return n;const s=t?.colorSet&&Object.keys(t.colorSet).length>0,r={};if(s&&t?.colorSet?Object.entries(t.colorSet).forEach(([l,a])=>{const c=typeof a=="string"?a.trim():"",d=String(l).trim();c&&d&&(r[d]=c)}):ns.forEach((l,a)=>{r[String(a+1)]=l}),!Object.keys(r).length)return n;const i=["match",["to-string",["coalesce",["get",o],""]]];return Object.entries(r).forEach(([l,a])=>{i.push(String(l),a)}),i.push(n),i}const jt="map-highlight-source",Aa="map-highlight-fill",Da="map-highlight-line";function Ia(t){return t?typeof t.toJSON=="function"?t.toJSON():t.geometry?{type:"Feature",geometry:t.geometry,properties:t.properties??{}}:null:null}function os(t,n){return t?t.replace(/\{([^}]+)\}/g,(o,s)=>{const r=n?.[s];return r==null?"":String(r)}):""}async function Oa(){return wa("https://unpkg.com/maplibre-gl@^5.6.2/dist/maplibre-gl.css"),await Vo("https://unpkg.com/maplibre-gl@^5.6.2/dist/maplibre-gl.js"),es()}function hn(t){const n=e.inject(ts,void 0);if(!t){if(!n)throw new Error("useMap() must be called inside a map provider");return n}if(n)return n;const o=e.ref(null),s=e.ref(!1),r=e.ref({selectedBasemap:"",geometryVisible:!0,overlays:[]}),i=e.ref([]),l=e.ref([]),a=e.ref(null),c=e.ref(null),d=e.ref(null);let m=t.style??null,f=null;const h=u=>{u&&(o.value?o.value.setStyle(u):m=u)},E=()=>{r.value.overlays=l.value.map(u=>({id:u.id,name:u.config.name,visible:u.visible}))},b=u=>{const A=Array.isArray(u)?u:[];i.value=A,A.some(U=>U.key===r.value.selectedBasemap)||(r.value.selectedBasemap=A[0]?.key??"")},v=u=>{u&&l.value.forEach(A=>{A.layerIds.forEach(R=>{u.getLayer(R)&&u.removeLayer(R)}),u.getSource(A.sourceId)&&u.removeSource(A.sourceId),A.layerIds=[]})},S=()=>{const u=o.value;!u||typeof u.isStyleLoaded!="function"||!u.isStyleLoaded()||(l.value.forEach(A=>{k(u,A)}),z())},k=(u,A)=>{const R=$a(A.config);R==="vtile"?C(u,A):R==="raster"&&_(u,A)},_=(u,A)=>{const R=A.config,U=A.sourceId,Y=Wn(R.url);if(!Y)return;u.getSource(U)||u.addSource(U,{type:"raster",tiles:[Y],minzoom:R.minzoom??0,maxzoom:R.maxzoom??24});const q=`${A.id}-raster`;u.getLayer(q)||u.addLayer({id:q,type:"raster",source:U,layout:{visibility:A.visible?"visible":"none"}}),A.layerIds=[q],w(u,A)},C=(u,A)=>{const R=A.config,U=A.sourceId,Y=Wn(R.url);if(!Y)return;u.getSource(U)||u.addSource(U,{type:"vector",tiles:[Y],minzoom:R.minzoom??0,maxzoom:R.maxzoom??24});const q=R.style??{},oe=La(q),fe=[],ie={visibility:A.visible?"visible":"none"},De=Ta(R),Ke={source:U,layout:ie};if(De&&(Ke["source-layer"]=De),(q.type??"polygon").toLowerCase()==="point"){const Pe=`${A.id}-circle`;u.getLayer(Pe)||u.addLayer({id:Pe,type:"circle",...Ke,paint:{"circle-color":oe,"circle-opacity":q.opacity??1,"circle-radius":q.radius??q.width??3,"circle-stroke-color":q.stroke??q.color??"#ffffff","circle-stroke-width":q.width??1}}),fe.push(Pe);const Ge=q.text??q.label;if(Ge){const et=`${A.id}-symbol`,sn=mn(q.textSize)??10,Ft=q.textHaloColor??q.stroke??"#ffffff",Pt=mn(q.textHaloWidth)??1,wt=mn(q.textZoom??q.pointZoom),xt={"text-color":q.textColor??"#000000","text-halo-color":Ft,"text-halo-width":Pt},pt={id:et,type:"symbol",...Ke,layout:{"text-field":["coalesce",["get",Ge],""],"text-size":sn,"text-anchor":"top"},paint:xt};wt!=null&&(pt.minzoom=wt),u.getLayer(et)||u.addLayer(pt),fe.push(et)}}else{const Pe=`${A.id}-fill`;u.getLayer(Pe)||u.addLayer({id:Pe,type:"fill",...Ke,paint:{"fill-color":oe,"fill-opacity":q.opacity??.5,"fill-outline-color":q.stroke??q.color??"#0ea5e9"}}),fe.push(Pe);const Ge=`${A.id}-line`;u.getLayer(Ge)||u.addLayer({id:Ge,type:"line",...Ke,paint:{"line-color":q.stroke??q.color??"#0b74c4","line-width":mn(q.width??q.border)??1,"line-opacity":q.opacity??1}}),fe.push(Ge)}A.layerIds=fe,w(u,A)},w=(u,A)=>{const R=A.visible?"visible":"none";A.layerIds.forEach(U=>{u.getLayer(U)&&u.setLayoutProperty(U,"visibility",R)})},x=u=>{const A=Array.isArray(u)?u:[];v(o.value??void 0),d.value=null,I();const R=A.map((U,Y)=>{if(!U)return null;const q=Wn(U.url);if(!q)return null;const oe=U.id!=null?String(U.id):`overlay-${Y}`;return{id:oe,config:{...U,id:oe,url:q},visible:!1,sourceId:`${oe}-source`,layerIds:[]}}).filter(U=>!!U);l.value=R,E(),S()},$=(u,A)=>{const R=l.value.find(Y=>Y.id===u);if(!R)return;R.visible=A,E();const U=o.value;if(!(!U||typeof U.isStyleLoaded!="function"||!U.isStyleLoaded())){if(!R.layerIds.length){k(U,R);return}w(U,R)}},B=()=>{a.value&&(a.value.remove(),a.value=null)},g=(u,A={})=>!Array.isArray(u.popup)||!u.popup.length?[]:u.popup.map(R=>({label:R.label??R.field,value:qn(A?.[R.field])})).filter(R=>R.label&&R.value!==void 0),D=u=>{const A=o.value;if(!A||!u?.point)return;const R=A.queryRenderedFeatures(u.point);for(const U of R){const Y=U.layer?.id??U.sourceLayer;if(!Y)continue;const q=He(Y);if(!q)continue;const oe=g(q,U.properties??U.layer?.properties??{});if(!oe.length)continue;const fe=_a(oe),ie=es();if(!ie)return;const De=u.lngLat;if(c.value===Y&&a.value){a.value.setLngLat(De),a.value.setHTML(fe);return}c.value=Y,B(),a.value=new ie.Popup({closeButton:!1,closeOnClick:!1}).setLngLat(De).setHTML(fe).addTo(A);return}c.value=null,B()},P=()=>{c.value=null,B()},z=()=>{const u=o.value;!u||typeof u.isStyleLoaded!="function"||!u.isStyleLoaded()||u.getSource(jt)||(u.addSource(jt,{type:"geojson",data:{type:"FeatureCollection",features:[]}}),u.addLayer({id:Aa,type:"fill",source:jt,paint:{"fill-color":"#2563eb","fill-opacity":.35}}),u.addLayer({id:Da,type:"line",source:jt,paint:{"line-color":"#1d4ed8","line-width":2}}))},G=u=>{const A=o.value;if(!A||typeof A.isStyleLoaded!="function"||!A.isStyleLoaded())return;z();const R=A.getSource(jt);if(!(!R||typeof R.setData!="function")){if(!u){R.setData({type:"FeatureCollection",features:[]});return}R.setData({type:"FeatureCollection",features:[u]})}},Z=u=>{const A=Ia(u);A&&G(A)},I=()=>{G(null)},F=()=>{d.value=null,I()},N=u=>{if(u)return typeof u=="string"?u:u.field??u.name??u.key??u.label},j=u=>{if(u)return typeof u=="string"?u:u.label??u.title??u.field??u.name},te=(u,A)=>!u||!u.length?[]:u.map(R=>{const U=N(R);if(!U)return null;const Y=j(R),q=qn(A?.[U]);return!Y||q===""?null:{label:Y,value:q}}).filter(R=>!!R),Re=(u,A)=>!Array.isArray(u)||!u.length?[]:u.map(R=>{if(!R?.name)return null;const U=R.title??R.name,Y=qn(A?.[R.name]);return!U||Y===""?null:{label:U,value:Y}}).filter(R=>!!R),ye=(u,A)=>!Array.isArray(u)||!u.length?[]:u.map(U=>{const Y=os(U.url,A),q=U.label??U.url;return Y?{label:q,url:Y,target:U.target}:null}).filter(U=>!!U),me=async(u,A)=>{const R=os(u,A);if(!R)return null;try{const U=await fetch(R);return U.ok?await U.json():null}catch{return null}},we=async(u,A)=>{const R=A.properties??A.layer?.properties??{},U=te(u.card?.rows,R);let Y,q;if(u.card?.api){const ie=await me(u.card.api,R);ie&&(typeof ie.html=="string"&&ie.html.trim()&&(Y=ie.html),Array.isArray(ie.columns)&&ie.columns.length&&(q=ie.columns))}let oe=U;if(!Y&&q){const ie=Re(q,R);ie.length&&(oe=ie)}if(!oe.length&&!Y)return null;const fe=ye(u.card?.actions,R);return{title:R?.name??u.name,rows:oe,html:Y,actions:fe.length?fe:void 0}},ft=async u=>{const A=o.value;if(!A||!u?.point)return;const R=A.queryRenderedFeatures(u.point);for(const U of R){const Y=U.layer?.id??U.sourceLayer;if(!Y)continue;const q=He(Y);if(!q||!q.card)continue;const oe=await we(q,U);if(oe){d.value=oe,Z(U);return}}d.value=null,I()},Et=()=>{const u=o.value;u&&(u.on("mousemove",D),u.on("mouseleave",P),u.on("click",ft))},Be=()=>{const u=o.value;u&&(u.off("mousemove",D),u.off("mouseleave",P),u.off("click",ft),B(),I())},He=u=>{if(u)return l.value.find(A=>A.layerIds.includes(u))?.config},W=async()=>{const u=await Oa(),A=Ba(t.container);if(!u||!A)return;const R={container:A,center:t.center??[30.524,50.45],zoom:t.zoom??10,style:m??t.style??{version:8,sources:{},layers:[]},attributionControl:!1,...t.mapOptions};o.value=new u.Map(R);const U=()=>{S()};f=U,o.value.on("style.load",U),o.value.on("load",()=>{s.value=!0,m&&o.value&&(o.value.setStyle(m),m=null),S(),Et()})};e.onMounted(W),e.onBeforeUnmount(()=>{Be(),o.value&&f&&o.value.off("style.load",f),v(o.value??void 0),o.value?.remove(),o.value=null,s.value=!1});const K={map:o,ready:s,setStyle:h,flyTo:u=>o.value?.flyTo(u),fitBounds:(u,A)=>o.value?.fitBounds(u,A),setCenter:u=>o.value?.setCenter(u),setZoom:u=>o.value?.setZoom(u),addControl:(u,A)=>o.value?.addControl(u,A),removeControl:u=>o.value?.removeControl(u),on:(u,...A)=>o.value?.on(u,...A),off:(u,...A)=>o.value?.off(u,...A),project:u=>o.value?.project(u),unproject:u=>o.value?.unproject(u),state:r,basemapOptions:i,setOverlays:x,toggleOverlay:$,getOverlayConfig:He,selectedCard:d,setBasemapOptions:b,clearCard:F};return e.provide(ts,K),K}const Ma={class:"map-base-layer-menu"},Ra={key:1,class:"z-[500] bg-white absolute top-[10px] right-[10px] p-1.5 border rounded-lg text-sm cursor-pointer layers-button"},Fa={class:"flex items-center justify-between p-2 border-b"},Pa={class:"p-2 border-b"},za={class:"flex items-center"},ja=["value","checked","onChange"],Ha={class:"ml-2"},Ua={class:"p-2"},qa={class:"flex items-center"},Wa=["checked"],Ka=["checked","onChange"],Ga={class:"ml-2"},Za=e.defineComponent({__name:"LayerMenu",setup(t){const{state:n,basemapOptions:o,setBasemap:s,toggleGeometry:r,toggleOverlay:i}=hn(),l=e.ref(!1),a=`map-base-basemap-${Math.random().toString(36).slice(2,7)}`,c=e.computed(()=>o.value),d=e.computed(()=>n.value.selectedBasemap??""),m=e.computed(()=>n.value.geometryVisible??!0),f=e.computed(()=>n.value.overlays??[]),h=v=>{s?.(v)},E=()=>{r?.(!m.value)},b=v=>{i?.(v.id,!v.visible)};return(v,S)=>(e.openBlock(),e.createElementBlock("div",Ma,[l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,onClick:S[0]||(S[0]=k=>l.value=!0),class:"z-[500] bg-white absolute top-[10px] right-[10px] p-1.5 text-sm border rounded-lg cursor-pointer layers-button"}," Шари ")),l.value?(e.openBlock(),e.createElementBlock("div",Ra,[e.createElementVNode("div",Fa,[S[3]||(S[3]=e.createElementVNode("div",null,"Шари",-1)),e.createElementVNode("button",{type:"button",class:"text-gray-500 hover:text-gray-800",onClick:S[1]||(S[1]=k=>l.value=!1)},[...S[2]||(S[2]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",class:"w-4 h-4"},[e.createElementVNode("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),e.createElementVNode("path",{d:"M18 6l-12 12"}),e.createElementVNode("path",{d:"M6 6l12 12"})],-1)])])]),e.createElementVNode("div",Pa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,k=>(e.openBlock(),e.createElementBlock("div",{key:k.key},[e.createElementVNode("label",za,[e.createElementVNode("input",{type:"radio",name:a,value:k.key,checked:d.value===k.key,onChange:_=>h(k.key)},null,40,ja),e.createElementVNode("span",Ha,e.toDisplayString(k.name||k.key),1)])]))),128))]),e.createElementVNode("div",Ua,[e.createElementVNode("label",qa,[e.createElementVNode("input",{type:"checkbox",checked:m.value,onChange:E},null,40,Wa),S[4]||(S[4]=e.createElementVNode("span",{class:"ml-2"},"Геометрія/Межі",-1))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(f.value,k=>(e.openBlock(),e.createElementBlock("label",{class:"flex items-center",key:k.id},[e.createElementVNode("input",{type:"checkbox",checked:k.visible,onChange:_=>b(k)},null,40,Ka),e.createElementVNode("span",Ga,e.toDisplayString(k.name||k.id),1)]))),128))])])):e.createCommentVNode("",!0)]))}}),Ja={key:0,class:"absolute bottom-[35px] left-[10px] z-[400] bg-white border border-gray-200 rounded-md shadow px-3 py-2 text-[11px] sm:text-xs space-y-1 max-w-[220px]"},Ya={class:"leading-tight"},Xa=e.defineComponent({__name:"Legend",props:{items:{}},setup(t){return(n,o)=>t.items.length?(e.openBlock(),e.createElementBlock("div",Ja,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,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",Ya,e.toDisplayString(s.label),1)]))),128))])):e.createCommentVNode("",!0)}}),Qa={class:"flex items-center gap-2 bg-white border border-gray-200 rounded-lg shadow-[0_10px_22px_rgba(15,23,42,0.16)] px-3 py-2 text-[11px] text-slate-900 max-w-[220px]"},Va={class:"font-mono"},ec=e.defineComponent({__name:"CursorCoordinates",props:{coordinates:{}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",Qa,[e.createElementVNode("span",Va,e.toDisplayString(t.coordinates),1)]))}}),tc={class:"map-search-widget absolute top-[10px] left-[10px] flex flex-col gap-2 rounded-xl widget min-w-[200px]"},nc=["title"],oc={key:0,class:"vs-select__options absolute z-50 mt-1 w-auto min-w-full bg-white border border-gray-300 shadow-lg rounded-lg text-sm text-gray-900"},sc=["onClick"],rc=["placeholder"],ic={class:"divide-y divide-gray-100"},lc=["onClick"],ac=600,cc="0000000000:00:000:0000",dc=30,fc=8,pc="https://data.softpro.ua/api-user/gis-url-proxy",uc="https://geo.rv.ua/api-user/dzk.api",mc="https://nominatim.openstreetmap.org/search",hc=e.defineComponent({__name:"MapSearchWidget",props:{config:{}},setup(t){const n=t,o=hn(),s=e.getCurrentInstance();function r(){return s?.appContext.config.globalProperties?.$settings?.map?.searchViewbox}const l=!!r()?["xy","parcel","address"]:["xy","parcel"],a=e.computed(()=>{const W=n.config?.tools?.filter(K=>l.includes(K));return W&&W.length?W:l}),c=e.computed(()=>n.config?.placeholder?.trim()||"Пошук…"),d=e.ref(a.value[0]);e.watch(a,W=>{W.includes(d.value)||(d.value=W[0])});const m=e.ref(""),f=e.ref(!1),h=e.ref(null),E=e.ref(null),b=e.ref(null),v=e.ref([]),S=e.ref(null),k=e.computed(()=>d.value==="address"&&v.value.length>0);let _=null,C=null,w=null;const x=e.reactive({position:"absolute",left:"0px",top:"0px",width:"100%",display:"none"});function $(){if(!E.value)return;const W=E.value.getBoundingClientRect(),K=W.width+dc,u=W.left+window.scrollX,A=W.bottom+window.scrollY+fc;x.left=`${u}px`,x.top=`${A}px`,x.width=`${K}px`,x.display="block"}const B=()=>{k.value&&$()};function g(){_&&(clearTimeout(_),_=null)}function D(){C?.destroy(),C=null}async function P(){if(d.value!=="parcel")return;const W=b.value;if(!W)return;const K=await Ca();d.value==="parcel"&&(D(),C=K(W,{mask:cc,lazy:!1,placeholderChar:"_"}),C.on("accept",()=>{m.value=C?.value??""}))}function z(){return(C?.value??m.value).trim()}function G(){if(!(typeof window>"u"))return window.maplibregl}function Z(W){const K=o.map.value;if(!K)return;const u=G();if(u){if(w){w.setLngLat([W.lat,W.lng]);return}w=new u.Marker({color:"#2563eb"}).setLngLat([W.lat,W.lng]).addTo(K)}}function I(){w&&(w.remove(),w=null)}e.watch(d,W=>{m.value="",f.value=!1,v.value=[],g(),W==="parcel"?e.nextTick(()=>{P().catch(K=>{Ne.notify({type:"error",title:"Маска кадастру",message:K?.message||"Не вдалося ініціалізувати маску"})})}):D()}),e.watch(k,W=>{W?e.nextTick(()=>{$()}):x.display="none"}),e.watch(m,W=>{if(d.value!=="address"){v.value=[],g();return}if(!W.trim()){v.value=[],g();return}g(),_=window.setTimeout(()=>{we(W).catch(K=>{const u=K?.message||"Помилка пошуку адреси";Ne.notify({type:"error",title:"Пошук адреси",message:u})})},ac)});function F(W){d.value=W}function N(W){const K=W.target;if(f.value){const u=h.value;u&&!u.contains(K)&&(f.value=!1)}if(k.value){const u=S.value;u&&!u.contains(K)&&(v.value=[])}}e.onMounted(()=>{window.addEventListener("click",N,!0),window.addEventListener("scroll",B,!0),window.addEventListener("resize",B),d.value==="parcel"&&e.nextTick(()=>{P().catch(W=>{Ne.notify({type:"error",title:"Маска кадастру",message:W?.message||"Не вдалося ініціалізувати маску"})})})}),e.onBeforeUnmount(()=>{window.removeEventListener("click",N,!0),window.removeEventListener("scroll",B,!0),window.removeEventListener("resize",B),g(),D(),I()});function j(W){return W==="xy"?"Координати":W==="parcel"?"Кадастр":"Адреси"}function te(W){const K=W.replace(/[,]+/g," ").trim();if(!K)return null;const u=K.split(/\s+/).filter(Boolean);if(u.length<2)return null;console.log(u);const A=u.slice(0,2).map(Number);if(console.log(A),!A.every(ie=>Number.isFinite(ie)))return null;let[R,U]=A,Y=R,q=U;const oe=ie=>Math.abs(ie)<=90,fe=ie=>Math.abs(ie)<=180;if(!oe(Y)||!fe(q))if(oe(q)&&fe(Y))Y=R,q=U;else return null;return console.log(Y,q),{lat:Y,lng:q}}function Re(W){return(W?.items||[]).map((u,A)=>{const R=Number(u?.position?.lat),U=Number(u?.position?.lng);return!Number.isFinite(R)||!Number.isFinite(U)?null:{id:String(u?.id??A),title:u?.title||u?.address?.label||"Знайдений обʼєкт",lat:R,lng:U}}).filter(u=>!!u)}function ye(W){const K=W?.result||W?.data||W;if(!K)return[];const u=K.geom_centroid;if(!u||!Array.isArray(u.coordinates))return[];const[A,R]=u.coordinates;return!Number.isFinite(A)||!Number.isFinite(R)?[]:[{id:"parcel",title:K.cadnum||K.cad_num||"Земельна ділянка",lat:A,lng:R}]}function me(W){return(Array.isArray(W?.features)?W.features:[]).map((u,A)=>{const R=u?.geometry?.coordinates,U=Number(R?.[0]),Y=Number(R?.[1]);if(!Number.isFinite(U)||!Number.isFinite(Y))return null;const q=u?.properties||{},oe=q?.geocoding?.label||q?.display_name||q?.label||"Адреса";return{id:String(q?.geocoding?.place_id||q?.place_id||A),title:oe,lat:U,lng:Y}}).filter(u=>!!u)}async function we(W){v.value=[],g();const K=new URL(mc);K.searchParams.set("format","geojson"),K.searchParams.set("q",W),K.searchParams.set("addressdetails","1"),K.searchParams.set("bounded","1");const u=r();u&&K.searchParams.set("viewbox",u);const A=await fetch(K.toString());if(!A.ok)throw new Error(`HTTP ${A.status}`);const R=await A.json(),U=me(R);if(!U.length){Ne.notify({type:"warning",title:"Пошук адреси",message:"Не знайдено результатів"});return}v.value=U}function ft(W){Be(W),v.value=[],m.value=""}function Et(W){const u=W.replace(/\s+/g,"").split(":");if(u.length!==4)return!1;const A=[10,2,3,4];return u.every((R,U)=>R.length===A[U]&&/^\d+$/.test(R))}function Be(W){const K=n.config?.zoom??17;o.flyTo?.({center:[W.lat,W.lng],zoom:K}),Z(W)}async function He(){const W=d.value==="parcel"?z():m.value.trim();if(W){if(d.value==="xy"){const K=te(W);if(console.log(K),!K){Ne.notify({type:"warning",title:"Пошук координат",message:"Не знайдено або невірний формат координат"});return}Be(K),m.value="";return}if(d.value==="address"){try{await we(W)}catch(K){const u=K?.message||"Помилка пошуку адреси";Ne.notify({type:"error",title:"Пошук адреси",message:u})}return}try{const K=new URL(d.value==="here"?pc:uc);if(d.value==="here")K.searchParams.set("searchtext",W);else{if(!Et(W)){Ne.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}K.searchParams.set("cad_num",W)}const u=await fetch(K.toString());if(!u.ok)throw new Error(`HTTP ${u.status}`);const A=await u.json(),R=d.value==="here"?Re(A):ye(A);if(!R.length)Ne.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const U=R[0];Be(U),d.value==="parcel"&&C&&(C.value=""),m.value=""}}catch(K){const u=K?.message||"Помилка пошуку";Ne.notify({type:"error",title:"Пошук",message:u})}}}return(W,K)=>(e.openBlock(),e.createElementBlock("div",tc,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(He,["prevent"])},[a.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:h,class:"relative search-type w-[100px]"},[e.createElementVNode("button",{type:"button",class:"vstSelect-input transition-all text-left bg-white border border-gray-200 text-gray-900 rounded-lg focus:ring-blue-500 focus:border-blue-100 block w-full py-1.5 px-3 text-sm cursor-pointer flex items-center justify-between gap-2",onClick:K[0]||(K[0]=u=>f.value=!f.value)},[e.createElementVNode("span",{class:"block w-full truncate",title:j(d.value)},e.toDisplayString(j(d.value)),9,nc),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":f.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[...K[3]||(K[3]=[e.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))]),f.value?(e.openBlock(),e.createElementBlock("div",oc,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,u=>(e.openBlock(),e.createElementBlock("li",{key:u,class:"px-3 py-2 cursor-pointer hover:bg-gray-100 text-gray-900",onClick:A=>F(u)},e.toDisplayString(j(u)),9,sc))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"searchWrapperRef",ref:E,class:"relative flex-1 min-w-[140px] bg-white rounded-md"},[d.value==="parcel"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"parcelInputRef",ref:b,"onUpdate:modelValue":K[1]||(K[1]=u=>m.value=u),placeholder:"0000000000:00:000:0000",inputmode:"numeric",type:"text",class:"vs-input !h-[34px] transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,512)),[[e.vModelText,m.value,void 0,{trim:!0}]]):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,"onUpdate:modelValue":K[2]||(K[2]=u=>m.value=u),placeholder:c.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,rc)),[[e.vModelText,m.value,void 0,{trim:!0}]]),K[4]||(K[4]=e.createElementVNode("button",{type:"submit",class:"absolute inset-y-0 right-2 flex items-center text-gray-400 hover:text-gray-600","aria-label":"Пошук"},[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",class:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","stroke-width":"2"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"m21 21-4.35-4.35m0 0A7.5 7.5 0 1 0 5 5a7.5 7.5 0 0 0 11.65 11.65Z"})])],-1)),k.value?(e.openBlock(),e.createBlock(e.Teleport,{key:2,to:"body"},[e.createElementVNode("div",{ref_key:"addressResultsRef",ref:S,class:"vs-select__options mt-1 bg-white border border-gray-300 shadow-lg rounded-lg text-sm text-gray-900 z-50 max-h-60 overflow-auto",style:e.normalizeStyle(x)},[e.createElementVNode("ul",ic,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(v.value,u=>(e.openBlock(),e.createElementBlock("li",{key:u.id,class:"px-3 py-2 cursor-pointer hover:bg-gray-50",onClick:A=>ft(u)},e.toDisplayString(u.title),9,lc))),128))])],4)])):e.createCommentVNode("",!0)],512)],32)]))}}),gc={class:"map-center-control"},yc=["aria-label"],vc=e.defineComponent({directives:{tooltip:Ne.TooltipDirective},__name:"MapCenterControl",props:{center:{},zoom:{},targetCenter:{},targetZoom:{},targetLabel:{},targetAriaLabel:{}},setup(t){const n=t,{map:o,ready:s}=hn(),r=e.ref(null),i=e.ref(null),l=e.ref(null),a=e.ref(null);function c(b){if(Array.isArray(b)&&b.length>=2){const[v,S]=b.slice(0,2).map(k=>Number(k));return Number.isNaN(v)||Number.isNaN(S)?null:[v,S]}if(b&&typeof b=="object"){const v=b,S=v.lng??v.lon??v.long??v.x,k=v.lat??v.y;if(S!=null&&k!=null){const _=Number(S),C=Number(k);if(!Number.isNaN(_)&&!Number.isNaN(C))return[_,C]}}if(typeof b=="string"){const v=b.split(",").map(S=>Number(S.trim()));if(v.length>=2&&v.every(S=>!Number.isNaN(S)))return[v[0],v[1]]}return null}e.watch(()=>n.center,b=>{const v=c(b);v&&(r.value=v)},{immediate:!0}),e.watch(()=>n.zoom,b=>{const v=Number(b);Number.isNaN(v)||(i.value=v)},{immediate:!0}),e.watch(()=>n.targetCenter,b=>{l.value=c(b)},{immediate:!0}),e.watch(()=>n.targetZoom,b=>{const v=Number(b);a.value=Number.isNaN(v)?null:v},{immediate:!0});const d=e.computed(()=>n.targetLabel?.trim()||"Точка"),m=e.computed(()=>n.targetAriaLabel||"Перейти до точки"),f=e.computed(()=>!!l.value);e.onMounted(async()=>{const b=o.value;if(b){if(!r.value){const v=b.getCenter();r.value=[v.lng,v.lat]}i.value==null&&(i.value=b.getZoom())}});function h(){const b=o.value;if(!b)return;const v=r.value||(()=>{const k=b.getCenter();return[k.lng,k.lat]})(),S=i.value??b.getZoom();b.flyTo({center:v,zoom:S})}function E(){const b=o.value;if(!b||!l.value)return;const v=a.value??i.value??b.getZoom();b.flyTo({center:l.value,zoom:v})}return(b,v)=>{const S=e.resolveDirective("tooltip");return e.openBlock(),e.createElementBlock("div",gc,[f.value?e.createCommentVNode("",!0):e.withDirectives((e.openBlock(),e.createElementBlock("button",{key:0,id:"center-btn",type:"button",class:"group relative flex items-center justify-center w-9 h-9 rounded-xl shadow-lg transition-transform transition-shadow duration-200 bg-white text-gray-700 hover:bg-gray-50 hover:scale-105 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400/60 focus-visible:ring-offset-2","aria-label":"Повернути центр",onClick:e.withModifiers(h,["stop"])},[e.createVNode(e.unref(Wr),{class:"w-4 h-4"})])),[[S,"Центр мапи"]]),f.value?e.withDirectives((e.openBlock(),e.createElementBlock("button",{key:1,id:"goto-target-btn",type:"button",class:"group relative flex items-center justify-center w-9 h-9 rounded-xl shadow-lg transition-transform transition-shadow duration-200 bg-white text-gray-700 hover:bg-gray-50 hover:scale-105 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400/60 focus-visible:ring-offset-2","aria-label":m.value,onClick:e.withModifiers(E,["stop"])},[e.createVNode(e.unref(Gr),{class:"w-4 h-4"})],8,yc)),[[S,d.value]]):e.createCommentVNode("",!0)])}}}),ss=ot(vc,[["__scopeId","data-v-73fcd71f"]]),bc={key:1,class:"absolute bottom-[50px] right-[10px] flex flex-col items-center gap-2 pointer-events-none z-[520]"},kc={key:0,class:"flex flex-col items-center gap-2 pointer-events-auto"},Ec=["aria-label"],wc={key:2,class:"absolute top-[10px] right-[10px] z-[600] min-w-[220px] max-w-[320px] bg-white border border-gray-200 rounded-[0.75rem] p-3 shadow-[0_25px_45px_rgba(15,23,42,0.2)]"},xc={class:"text-slate-900 font-semibold mb-1"},Nc=["innerHTML"],Cc={key:1,class:"space-y-2"},Sc={class:"text-gray-500"},_c={class:"font-medium text-slate-900"},Bc={key:2,class:"mt-2 flex flex-col gap-2"},$c=["href","target"],ut="map-basemap-source",Ht="map-basemap-layer",Tc=20,_t="map-katottg-geometry-source",gn="map-katottg-geometry-line",st="map-geometry-source",Bt="map-geometry-fill",$t="map-geometry-line",Tt="map-geometry-circle",yn=e.defineComponent({__name:"MapWidget",props:{height:{default:350},center:{},zoom:{},geom:{},layers:{},legend:{},tools:{},katottg:{}},setup(t){const n=t,o=[{key:"topo100",name:"Topographic 100",url:"https://data.gki.com.ua/api-user/rtile/voyager/ua/{z}/{x}/{y}.png"},{key:"orto10",name:"Орто 10",url:"https://data.gki.com.ua/api-user/rtile/orto10/ua/{z}/{x}/{y}.png"},{key:"osmb",name:"OSM Bright",url:"https://tile.openstreetmap.org.ua/styles/osm-bright/{z}/{x}/{y}.png"}],i=(e.getCurrentInstance()?.appContext.config.globalProperties?.$settings??{})?.map??{};function l(p){if(p){if(Array.isArray(p)&&p.length>=2){const M=Number(p[0]),H=Number(p[1]);return!Number.isFinite(M)||!Number.isFinite(H)?void 0:[M,H]}if(typeof p=="object"){const M=p,H=M.lng??M.lon??M.long??M.x,X=M.lat??M.y;if(H!=null&&X!=null){const _e=Number(H),Ye=Number(X);if(Number.isFinite(_e)&&Number.isFinite(Ye))return[_e,Ye]}}}}function a(p){if(p==null)return;const M=Number(p);return Number.isFinite(M)?M:void 0}const c=()=>typeof window>"u"?"":window.location?.origin??"",d=p=>{if(!p)return"";const M=p.trim();if(!M)return"";const X=M.replace(/\n/g,"").replace(/\r/g,"").replace(/\t/g,"").replace(/\s+/g,"");if(!X)return"";if(/^https?:\/\//i.test(X))return X;const _e=c(),Ye=X.replace(/^\/+/,"");return _e?`${_e}/${Ye}`:Ye?`/${Ye}`:""},m=e.computed(()=>n.katottg!=null?n.katottg:i.katottg),f=e.computed(()=>(Array.isArray(i.basemaps)&&i.basemaps.length?i.basemaps:o).map((H,X)=>{const _e=typeof H.url=="string"?H.url.trim():"";return _e?{key:(H.key??H.name??`base-${X}`).trim()||`base-${X}`,url:_e,name:H.name??H.key??`Layer ${X+1}`}:null}).filter(H=>!!H)),h=l(i.center),E=a(i.zoom),b=zo(n.geom),v=Sr(b),S=v?[(v[0]+v[2])/2,(v[1]+v[3])/2]:void 0,k=e.ref(null),_=e.computed(()=>l(n.center)??null),C=e.computed(()=>_.value??h??null),w=p=>p?{version:8,sources:{[ut]:{type:"raster",tiles:[p],tileSize:256}},layers:[{id:Ht,type:"raster",source:ut,layout:{visibility:"visible"}}]}:{version:8,sources:{},layers:[]},x=d(f.value[0]?.url),$=hn({container:k,center:S??C.value??void 0,zoom:n.zoom??E,style:w(x)}),{map:B,setCenter:g,setZoom:D,state:P,getOverlayConfig:z,selectedCard:G,setBasemapOptions:Z,clearCard:I,addControl:F,removeControl:N,ready:j}=$,te=e.computed({get:()=>P.value.selectedBasemap??"",set:p=>{P.value.selectedBasemap=p}}),Re=e.computed({get:()=>P.value.geometryVisible??!0,set:p=>{P.value.geometryVisible=p}}),ye=e.computed(()=>{const p=n.height;return{height:typeof p=="number"?`${p}px`:String(p)}}),me=e.ref(!1),we=e.ref(!1),ft=e.computed(()=>me.value?"!fixed inset-0 w-screen h-screen z-[9999] bg-white":"relative w-full"),Et=e.computed(()=>{const p=["w-full","h-full"];return me.value||p.push(`min-h-[${ye.value.height}]`),p.join(" ")}),Be=e.computed(()=>G.value),He=()=>I?.(),W=e.ref(S??C.value??null),K=e.ref(n.zoom??E??null),u=e.ref(C.value);e.watch(C,p=>{u.value=p},{immediate:!0});const A=e.computed(()=>u.value??null),R=e.computed(()=>typeof n.zoom=="number"?n.zoom:typeof K.value=="number"?K.value:Tc),U=["home","fullscreen","scale","position"],Y=e.computed(()=>!Array.isArray(n.tools)||!n.tools.length?U:n.tools.filter(p=>U.includes(p))),q=p=>Y.value.includes(p);e.watch([B,j],([p,M])=>{if(!(!p||!M)){if(!W.value){const H=p.getCenter();W.value=[H.lng,H.lat]}K.value==null&&(K.value=p.getZoom())}},{immediate:!0});const oe=e.ref(null),fe=e.ref(""),ie=e.ref(null),De=p=>p?we.value?!0:typeof p.isStyleLoaded=="function"&&p.isStyleLoaded()?(we.value=!0,!0):!1:!1,Ke=p=>{if(!p)return"";const M=Number(p.lat??p[1]),H=Number(p.lng??p[0]);return!Number.isFinite(M)||!Number.isFinite(H)?"":`${H.toFixed(5)}, ${M.toFixed(5)}`},on=p=>{p?.lngLat&&(fe.value=Ke(p.lngLat))},Pe=()=>{fe.value=""},Ge=p=>{p&&(p.on("mousemove",on),p.on("mouseleave",Pe),ie.value=p)},et=p=>{p&&(p.off("mousemove",on),p.off("mouseleave",Pe),ie.value=null)},sn=e.computed(()=>q("scale"));e.watch([B,j],([p,M],[H])=>{H&&et(H),!(!p||!M)&&Ge(p)},{immediate:!0}),e.watch([B,j,sn],([p,M,H])=>{if(oe.value&&N&&(N(oe.value),oe.value=null),!p||!M||!H)return;const X=window?.maplibregl;X&&(oe.value=new X.ScaleControl({unit:"metric"}),F?.(oe.value,"bottom-left"))},{immediate:!0});const Ft=e.computed(()=>Array.isArray(n.legend)?n.legend.map((p,M)=>{const H=typeof p?.color=="string"?p.color.trim():"",X=typeof p?.label=="string"?p.label.trim():"";return!H||!X?null:{color:H,label:X,key:`${X}-${M}`}}).filter(p=>!!p):[]),Pt=e.computed(()=>Array.isArray(n.layers)&&n.layers.length?n.layers:Array.isArray(i.layers)&&i.layers.length?i.layers:[]);e.watch(f,p=>{if(Z?.(p),!p.length){te.value="";return}p.some(M=>M.key===te.value)||(te.value=p[0].key)},{immediate:!0});const wt=p=>{if(!p?.getStyle)return;const M=p.getStyle()??{},H=Array.isArray(M.layers)?M.layers:[];return H.length?H.find(_e=>_e.type!=="background")?.id??H[0]?.id:void 0},xt=p=>{p&&(p.getLayer(Ht)&&p.removeLayer(Ht),p.getSource(ut)&&p.removeSource(ut))},pt=(p,M)=>{if(!p)return;const H=wt(p);p.addSource(ut,{type:"raster",tiles:[M],tileSize:256}),p.addLayer({id:Ht,type:"raster",source:ut,layout:{visibility:"visible"}},H)},Mo=p=>{if(!p)return;const M=d(p.url);if(!M){tt.value=null;return}tt.value=M,xt(B.value),T()},tt=e.ref(null),y=e.ref(x||null),O=p=>{if(!p||p.__pendingBasemapHooked)return;p.__pendingBasemapHooked=!0;const M=()=>{p.__pendingBasemapHooked=!1,T()};p.once("style.load",M),p.once("styledata",M)},T=()=>{const p=B.value,M=tt.value;if(!(!M||!p)){if(!De(p)){O(p);return}if(y.value===M&&p.getSource(ut)&&p.getLayer(Ht)){tt.value=null;return}xt(p),pt(p,M),y.value=M,tt.value=null}},L=()=>{const p=te.value;if(!p)return;const M=f.value.find(H=>H.key===p);M&&Mo(M)};e.watch(te,()=>{L()},{immediate:!0}),e.watch(Pt,p=>{$.setOverlays?.(p)},{immediate:!0,deep:!0});const J=e.ref(null);let le=0;const ne=e.computed(()=>zo(J.value)),xe={fill:{"fill-color":"#0ea5e9","fill-opacity":.25},line:{"line-color":"#0b74c4","line-width":2},circle:{"circle-color":"#0ea5e9","circle-stroke-color":"#ffffff","circle-stroke-width":2,"circle-radius":7,"circle-opacity":.95}},nt={"line-color":"#1d4ed8","line-width":2,"line-dasharray":[6,4]},re=e.ref(b),Ue=e.ref(v),ve=e.ref(!1),Ze=e.computed(()=>{if(!Ue.value)return null;const[p,M,H,X]=Ue.value;return[(p+H)/2,(M+X)/2]}),zt=e.computed(()=>!!Ue.value),qe=e.ref(!!v);e.ref(!1);const Ro=()=>{me.value=!me.value},Je=e.ref(!1),Fo=()=>{const p=B.value;if(!p||!De(p))return;const M=re.value;if(!M){Tu(p),rn();return}let H=p.getSource(st);H?H.setData(M):(p.addSource(st,{type:"geojson",data:M}),$u(p),H=p.getSource(st)),Nr(p,Re.value?"visible":"none"),Lu(),rn(),Ue.value&&(!qe.value&&(ve.value||!Je.value)?(p.fitBounds(Ue.value,{padding:40,maxZoom:16,duration:0}),Je.value=!0,ve.value=!1):qe.value&&(qe.value=!1,ve.value=!1,Je.value=!0))},$u=p=>{const M=xe;p.getLayer(Bt)||p.addLayer({id:Bt,type:"fill",source:st,paint:M.fill}),p.getLayer($t)||p.addLayer({id:$t,type:"line",source:st,paint:M.line}),p.getLayer(Tt)||p.addLayer({id:Tt,type:"circle",source:st,paint:M.circle,filter:["==","$type","Point"]})},Tu=p=>{[Tt,$t,Bt].forEach(M=>{p.getLayer(M)&&p.removeLayer(M)}),p.getSource(st)&&p.removeSource(st)},Nr=(p,M)=>{De(p)&&[Tt,$t,Bt].forEach(H=>{p.getLayer(H)&&p.setLayoutProperty(H,"visibility",M)})},Lu=()=>{const p=B.value;if(!p||!De(p))return;const M=xe;p.getLayer(Bt)&&Object.entries(M.fill).forEach(([H,X])=>{p.setPaintProperty(Bt,H,X)}),p.getLayer($t)&&Object.entries(M.line).forEach(([H,X])=>{p.setPaintProperty($t,H,X)}),p.getLayer(Tt)&&Object.entries(M.circle).forEach(([H,X])=>{p.setPaintProperty(Tt,H,X)})},Cr=p=>{p.getLayer(gn)||p.addLayer({id:gn,type:"line",source:_t,layout:{visibility:"visible"},paint:nt})},rn=()=>{const p=B.value;if(!p||!De(p))return;const M=ne.value??{type:"FeatureCollection",features:[]};if(!p.getSource(_t)){p.addSource(_t,{type:"geojson",data:M}),Cr(p);return}const H=p.getSource(_t);H&&typeof H.setData=="function"&&H.setData(M),Cr(p)},Au=p=>{p.getLayer(gn)&&p.removeLayer(gn),p.getSource(_t)&&p.removeSource(_t)},Du=async p=>{const M=typeof p=="string"?p.trim():"",H=++le;if(!M){J.value=null;return}try{const X=await fetch(`https://data.gki.com.ua/api-user/atu/${M}`);if(le!==H)return;if(!X.ok){J.value=null;return}const _e=await X.json();if(le!==H)return;J.value=_e}catch{if(le!==H)return;J.value=null}};e.watch(m,p=>{Du(p)},{immediate:!0}),e.watch(ne,()=>{rn()},{immediate:!0}),e.watch(()=>n.geom,p=>{re.value=zo(p),Ue.value=Sr(re.value),Ze.value&&(W.value=Ze.value),Je.value=!1,ve.value=!0,Fo()},{deep:!0,immediate:!0}),e.watch(Re,()=>{const p=B.value;p&&De(p)&&Nr(p,Re.value?"visible":"none")});const Nt=()=>{we.value=!0,Fo(),rn(),T()},Po=()=>{Fo(),rn()};e.watch(B,(p,M)=>{M&&(M.off("style.load",Nt),M.off("load",Nt),M.off("idle",Po)),we.value=!1,p&&(p.on("load",Nt),p.on("style.load",Nt),p.on("idle",Po),typeof p.isStyleLoaded=="function"&&p.isStyleLoaded()&&Nt())}),e.watch(_,p=>{!B.value||!p||zt.value||g(p)}),e.watch(()=>n.zoom,p=>{!B.value||typeof p!="number"||D(p)}),e.onBeforeUnmount(()=>{oe.value&&N&&N(oe.value),ie.value?et(ie.value):B.value&&et(B.value);const p=B.value;p&&(Au(p),p.off("style.load",Nt),p.off("load",Nt),p.off("idle",Po))});function Iu(p){p&&(te.value=p)}function Ou(p){Re.value=p}$.setBasemap=Iu,$.toggleGeometry=Ou,$.setOverlays?.(Pt.value);function zo(p){if(!p)return null;if(p.type==="FeatureCollection")return p;if(p.type==="Feature")return{type:"FeatureCollection",features:[p]};const M=p.geometry??p;if(!M?.type)return null;if(M.type==="GeometryCollection"&&Array.isArray(M.geometries)){const H=M.geometries.filter(X=>X&&typeof X.type=="string").map(X=>({type:"Feature",geometry:X}));return H.length?{type:"FeatureCollection",features:H}:null}if(M.type==="MultiPoint"&&Array.isArray(M.coordinates)){const H=M.coordinates.filter(X=>Array.isArray(X)&&X.length>=2).map(X=>({type:"Feature",geometry:{type:"Point",coordinates:X}}));return H.length?{type:"FeatureCollection",features:H}:null}return{type:"FeatureCollection",features:[{type:"Feature",geometry:M}]}}function Sr(p){if(!p?.features?.length)return null;let M=1/0,H=1/0,X=-1/0,_e=-1/0;const Ye=ln=>{if(typeof ln[0]=="number"){const[Ct,_r]=ln;M=Math.min(M,Ct),H=Math.min(H,_r),X=Math.max(X,Ct),_e=Math.max(_e,_r);return}ln.forEach(Ct=>Ye(Ct))};return p.features.forEach(ln=>{const Ct=ln?.geometry?.coordinates;Ct&&Ye(Ct)}),M===1/0||H===1/0?null:[M,H,X,_e]}return(p,M)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(ft.value),style:e.normalizeStyle(me.value?void 0:ye.value)},[e.createElementVNode("div",{ref_key:"mapContainer",ref:k,class:e.normalizeClass(Et.value)},null,2),e.createVNode(Xa,{items:Ft.value},null,8,["items"]),q("search")?(e.openBlock(),e.createBlock(hc,{key:0})):e.createCommentVNode("",!0),q("home")||q("fullscreen")?(e.openBlock(),e.createElementBlock("div",bc,[q("home")?(e.openBlock(),e.createElementBlock("div",kc,[e.createVNode(ss,{center:A.value,zoom:R.value},null,8,["center","zoom"]),t.geom?(e.openBlock(),e.createBlock(ss,{key:0,"target-center":Ze.value,"target-zoom":R.value,"target-label":"Об'єкт","target-aria-label":"Перейти до об'єкта"},null,8,["target-center","target-zoom"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),q("fullscreen")?(e.openBlock(),e.createElementBlock("button",{key:1,type:"button",class:"group relative flex items-center justify-center w-9 h-9 rounded-xl shadow-lg transition-transform duration-200 bg-white text-gray-700 hover:bg-gray-50 hover:scale-105 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-400/60 focus-visible:ring-offset-2 pointer-events-auto",onClick:Ro,"aria-label":me.value?"Вихід з повноекранного режиму":"Увімкнути повноекранний режим"},[...M[0]||(M[0]=[e.createElementVNode("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"2",stroke:"currentColor",class:"w-5 h-5"},[e.createElementVNode("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M4 8V4h4M20 8V4h-4M4 16v4h4m12-4v4h-4"})],-1)])],8,Ec)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),Be.value?(e.openBlock(),e.createElementBlock("div",wc,[e.createElementVNode("button",{type:"button",class:"absolute top-2 right-2 h-6 w-6 flex items-center justify-center rounded-full text-slate-500 hover:text-slate-900","aria-label":"Закрити",onClick:He},[...M[1]||(M[1]=[e.createElementVNode("span",{"aria-hidden":"true"},"×",-1)])]),e.createElementVNode("div",xc,e.toDisplayString(Be.value.title||"Об'єкт"),1),Be.value.html?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["text-[0.75rem] text-slate-700 leading-relaxed overflow-auto",`max-h-[calc(${ye.value.height}-120px)]`]),innerHTML:Be.value.html},null,10,Nc)):(e.openBlock(),e.createElementBlock("div",Cc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Be.value.rows,H=>(e.openBlock(),e.createElementBlock("div",{key:H.label,class:"flex justify-between text-[0.85rem] text-slate-700"},[e.createElementVNode("span",Sc,e.toDisplayString(H.label)+":",1),e.createElementVNode("span",_c,e.toDisplayString(H.value),1)]))),128))])),Be.value.actions?.length?(e.openBlock(),e.createElementBlock("div",Bc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Be.value.actions,H=>(e.openBlock(),e.createElementBlock("a",{key:H.url,class:"bg-sky-600 hover:bg-sky-700 transition-colors text-white font-semibold text-center py-[0.55rem] rounded-md w-full",href:H.url,target:H.target??void 0,rel:"noreferrer"},e.toDisplayString(H.label),9,$c))),128))])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createVNode(Za),q("position")&&fe.value?(e.openBlock(),e.createBlock(ec,{key:3,class:"absolute bottom-[10px] right-[10px] z-[500]",coordinates:fe.value},null,8,["coordinates"])):e.createCommentVNode("",!0)],6))}});function We(t){const n=Object.create(null);for(const o of t.split(","))n[o]=1;return o=>o in n}const Lc=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const Kn=()=>{},vn=()=>!1,Gn=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),rt=Object.assign,Xe=Array.isArray,be=t=>typeof t=="string",Zn=t=>typeof t=="symbol",Ac=t=>t!==null&&typeof t=="object",rs=We(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),Dc=We("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),Jn=t=>{const n=Object.create(null);return(o=>n[o]||(n[o]=t(o)))},Ic=/-\w/g,it=Jn(t=>t.replace(Ic,n=>n.slice(1).toUpperCase())),Yn=Jn(t=>t.charAt(0).toUpperCase()+t.slice(1)),Oc=Jn(t=>t?`on${Yn(t)}`:""),Ut={1:"TEXT",2:"CLASS",4:"STYLE",8:"PROPS",16:"FULL_PROPS",32:"NEED_HYDRATION",64:"STABLE_FRAGMENT",128:"KEYED_FRAGMENT",256:"UNKEYED_FRAGMENT",512:"NEED_PATCH",1024:"DYNAMIC_SLOTS",2048:"DEV_ROOT_FRAGMENT",[-1]:"CACHED",[-2]:"BAIL"},Mc={1:"STABLE",2:"DYNAMIC",3:"FORWARDED"},Rc=/;(?![^(]*\))/g,Fc=/:([^]+)/,Pc=/\/\*[^]*?\*\//g;function zc(t){const n={};return t.replace(Pc,"").split(Rc).forEach(o=>{if(o){const s=o.split(Fc);s.length>1&&(n[s[0].trim()]=s[1].trim())}}),n}const jc="html,body,base,head,link,meta,style,title,address,article,aside,footer,header,hgroup,h1,h2,h3,h4,h5,h6,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,summary,template,blockquote,iframe,tfoot",Hc="svg,animate,animateMotion,animateTransform,circle,clipPath,color-profile,defs,desc,discard,ellipse,feBlend,feColorMatrix,feComponentTransfer,feComposite,feConvolveMatrix,feDiffuseLighting,feDisplacementMap,feDistantLight,feDropShadow,feFlood,feFuncA,feFuncB,feFuncG,feFuncR,feGaussianBlur,feImage,feMerge,feMergeNode,feMorphology,feOffset,fePointLight,feSpecularLighting,feSpotLight,feTile,feTurbulence,filter,foreignObject,g,hatch,hatchpath,image,line,linearGradient,marker,mask,mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,text,textPath,title,tspan,unknown,use,view",Uc="annotation,annotation-xml,maction,maligngroup,malignmark,math,menclose,merror,mfenced,mfrac,mfraction,mglyph,mi,mlabeledtr,mlongdiv,mmultiscripts,mn,mo,mover,mpadded,mphantom,mprescripts,mroot,mrow,ms,mscarries,mscarry,msgroup,msline,mspace,msqrt,msrow,mstack,mstyle,msub,msubsup,msup,mtable,mtd,mtext,mtr,munder,munderover,none,semantics",qc="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr",Wc=We(jc),Kc=We(Hc),Gc=We(Uc),Zc=We(qc);const qt=Symbol(process.env.NODE_ENV!=="production"?"Fragment":""),Wt=Symbol(process.env.NODE_ENV!=="production"?"Teleport":""),Xn=Symbol(process.env.NODE_ENV!=="production"?"Suspense":""),bn=Symbol(process.env.NODE_ENV!=="production"?"KeepAlive":""),is=Symbol(process.env.NODE_ENV!=="production"?"BaseTransition":""),mt=Symbol(process.env.NODE_ENV!=="production"?"openBlock":""),ls=Symbol(process.env.NODE_ENV!=="production"?"createBlock":""),as=Symbol(process.env.NODE_ENV!=="production"?"createElementBlock":""),Qn=Symbol(process.env.NODE_ENV!=="production"?"createVNode":""),Vn=Symbol(process.env.NODE_ENV!=="production"?"createElementVNode":""),Kt=Symbol(process.env.NODE_ENV!=="production"?"createCommentVNode":""),eo=Symbol(process.env.NODE_ENV!=="production"?"createTextVNode":""),cs=Symbol(process.env.NODE_ENV!=="production"?"createStaticVNode":""),to=Symbol(process.env.NODE_ENV!=="production"?"resolveComponent":""),no=Symbol(process.env.NODE_ENV!=="production"?"resolveDynamicComponent":""),oo=Symbol(process.env.NODE_ENV!=="production"?"resolveDirective":""),so=Symbol(process.env.NODE_ENV!=="production"?"resolveFilter":""),ro=Symbol(process.env.NODE_ENV!=="production"?"withDirectives":""),io=Symbol(process.env.NODE_ENV!=="production"?"renderList":""),ds=Symbol(process.env.NODE_ENV!=="production"?"renderSlot":""),fs=Symbol(process.env.NODE_ENV!=="production"?"createSlots":""),kn=Symbol(process.env.NODE_ENV!=="production"?"toDisplayString":""),En=Symbol(process.env.NODE_ENV!=="production"?"mergeProps":""),lo=Symbol(process.env.NODE_ENV!=="production"?"normalizeClass":""),ao=Symbol(process.env.NODE_ENV!=="production"?"normalizeStyle":""),Gt=Symbol(process.env.NODE_ENV!=="production"?"normalizeProps":""),Zt=Symbol(process.env.NODE_ENV!=="production"?"guardReactiveProps":""),co=Symbol(process.env.NODE_ENV!=="production"?"toHandlers":""),fo=Symbol(process.env.NODE_ENV!=="production"?"camelize":""),Jc=Symbol(process.env.NODE_ENV!=="production"?"capitalize":""),po=Symbol(process.env.NODE_ENV!=="production"?"toHandlerKey":""),wn=Symbol(process.env.NODE_ENV!=="production"?"setBlockTracking":""),Yc=Symbol(process.env.NODE_ENV!=="production"?"pushScopeId":""),Xc=Symbol(process.env.NODE_ENV!=="production"?"popScopeId":""),uo=Symbol(process.env.NODE_ENV!=="production"?"withCtx":""),Qc=Symbol(process.env.NODE_ENV!=="production"?"unref":""),Vc=Symbol(process.env.NODE_ENV!=="production"?"isRef":""),mo=Symbol(process.env.NODE_ENV!=="production"?"withMemo":""),ps=Symbol(process.env.NODE_ENV!=="production"?"isMemoSame":""),Lt={[qt]:"Fragment",[Wt]:"Teleport",[Xn]:"Suspense",[bn]:"KeepAlive",[is]:"BaseTransition",[mt]:"openBlock",[ls]:"createBlock",[as]:"createElementBlock",[Qn]:"createVNode",[Vn]:"createElementVNode",[Kt]:"createCommentVNode",[eo]:"createTextVNode",[cs]:"createStaticVNode",[to]:"resolveComponent",[no]:"resolveDynamicComponent",[oo]:"resolveDirective",[so]:"resolveFilter",[ro]:"withDirectives",[io]:"renderList",[ds]:"renderSlot",[fs]:"createSlots",[kn]:"toDisplayString",[En]:"mergeProps",[lo]:"normalizeClass",[ao]:"normalizeStyle",[Gt]:"normalizeProps",[Zt]:"guardReactiveProps",[co]:"toHandlers",[fo]:"camelize",[Jc]:"capitalize",[po]:"toHandlerKey",[wn]:"setBlockTracking",[Yc]:"pushScopeId",[Xc]:"popScopeId",[uo]:"withCtx",[Qc]:"unref",[Vc]:"isRef",[mo]:"withMemo",[ps]:"isMemoSame"};function ed(t){Object.getOwnPropertySymbols(t).forEach(n=>{Lt[n]=t[n]})}const Ie={start:{line:1,column:1,offset:0},end:{line:1,column:1,offset:0},source:""};function td(t,n=""){return{type:0,source:n,children:t,helpers:new Set,components:[],directives:[],hoists:[],imports:[],cached:[],temps:0,codegenNode:void 0,loc:Ie}}function Jt(t,n,o,s,r,i,l,a=!1,c=!1,d=!1,m=Ie){return t&&(a?(t.helper(mt),t.helper(It(t.inSSR,d))):t.helper(Dt(t.inSSR,d)),l&&t.helper(ro)),{type:13,tag:n,props:o,children:s,patchFlag:r,dynamicProps:i,directives:l,isBlock:a,disableTracking:c,isComponent:d,loc:m}}function ht(t,n=Ie){return{type:17,loc:n,elements:t}}function Fe(t,n=Ie){return{type:15,loc:n,properties:t}}function ue(t,n){return{type:16,loc:Ie,key:be(t)?Q(t,!0):t,value:n}}function Q(t,n=!1,o=Ie,s=0){return{type:4,loc:o,content:t,isStatic:n,constType:n?3:s}}function ze(t,n=Ie){return{type:8,loc:n,children:t}}function ge(t,n=[],o=Ie){return{type:14,loc:o,callee:t,arguments:n}}function At(t,n=void 0,o=!1,s=!1,r=Ie){return{type:18,params:t,returns:n,newline:o,isSlot:s,loc:r}}function ho(t,n,o,s=!0){return{type:19,test:t,consequent:n,alternate:o,newline:s,loc:Ie}}function nd(t,n,o=!1,s=!1){return{type:20,index:t,value:n,needPauseTracking:o,inVOnce:s,needArraySpread:!1,loc:Ie}}function od(t){return{type:21,body:t,loc:Ie}}function Dt(t,n){return t||n?Qn:Vn}function It(t,n){return t||n?ls:as}function go(t,{helper:n,removeHelper:o,inSSR:s}){t.isBlock||(t.isBlock=!0,o(Dt(s,t.isComponent)),n(mt),n(It(s,t.isComponent)))}const us=new Uint8Array([123,123]),ms=new Uint8Array([125,125]);function hs(t){return t>=97&&t<=122||t>=65&&t<=90}function Oe(t){return t===32||t===10||t===9||t===12||t===13}function lt(t){return t===47||t===62||Oe(t)}function xn(t){const n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}const ke={Cdata:new Uint8Array([67,68,65,84,65,91]),CdataEnd:new Uint8Array([93,93,62]),CommentEnd:new Uint8Array([45,45,62]),ScriptEnd:new Uint8Array([60,47,115,99,114,105,112,116]),StyleEnd:new Uint8Array([60,47,115,116,121,108,101]),TitleEnd:new Uint8Array([60,47,116,105,116,108,101]),TextareaEnd:new Uint8Array([60,47,116,101,120,116,97,114,101,97])};class sd{constructor(n,o){this.stack=n,this.cbs=o,this.state=1,this.buffer="",this.sectionStart=0,this.index=0,this.entityStart=0,this.baseState=1,this.inRCDATA=!1,this.inXML=!1,this.inVPre=!1,this.newlines=[],this.mode=0,this.delimiterOpen=us,this.delimiterClose=ms,this.delimiterIndex=-1,this.currentSequence=void 0,this.sequenceIndex=0}get inSFCRoot(){return this.mode===2&&this.stack.length===0}reset(){this.state=1,this.mode=0,this.buffer="",this.sectionStart=0,this.index=0,this.baseState=1,this.inRCDATA=!1,this.currentSequence=void 0,this.newlines.length=0,this.delimiterOpen=us,this.delimiterClose=ms}getPos(n){let o=1,s=n+1;const r=this.newlines.length;let i=-1;if(r>100){let l=-1,a=r;for(;l+1<a;){const c=l+a>>>1;this.newlines[c]<n?l=c:a=c}i=l}else for(let l=r-1;l>=0;l--)if(n>this.newlines[l]){i=l;break}return i>=0&&(o=i+2,s=n-this.newlines[i]),{column:s,line:o,offset:n}}peek(){return this.buffer.charCodeAt(this.index+1)}stateText(n){n===60?(this.index>this.sectionStart&&this.cbs.ontext(this.sectionStart,this.index),this.state=5,this.sectionStart=this.index):!this.inVPre&&n===this.delimiterOpen[0]&&(this.state=2,this.delimiterIndex=0,this.stateInterpolationOpen(n))}stateInterpolationOpen(n){if(n===this.delimiterOpen[this.delimiterIndex])if(this.delimiterIndex===this.delimiterOpen.length-1){const o=this.index+1-this.delimiterOpen.length;o>this.sectionStart&&this.cbs.ontext(this.sectionStart,o),this.state=3,this.sectionStart=o}else this.delimiterIndex++;else this.inRCDATA?(this.state=32,this.stateInRCDATA(n)):(this.state=1,this.stateText(n))}stateInterpolation(n){n===this.delimiterClose[0]&&(this.state=4,this.delimiterIndex=0,this.stateInterpolationClose(n))}stateInterpolationClose(n){n===this.delimiterClose[this.delimiterIndex]?this.delimiterIndex===this.delimiterClose.length-1?(this.cbs.oninterpolation(this.sectionStart,this.index+1),this.inRCDATA?this.state=32:this.state=1,this.sectionStart=this.index+1):this.delimiterIndex++:(this.state=3,this.stateInterpolation(n))}stateSpecialStartSequence(n){const o=this.sequenceIndex===this.currentSequence.length;if(!(o?lt(n):(n|32)===this.currentSequence[this.sequenceIndex]))this.inRCDATA=!1;else if(!o){this.sequenceIndex++;return}this.sequenceIndex=0,this.state=6,this.stateInTagName(n)}stateInRCDATA(n){if(this.sequenceIndex===this.currentSequence.length){if(n===62||Oe(n)){const o=this.index-this.currentSequence.length;if(this.sectionStart<o){const s=this.index;this.index=o,this.cbs.ontext(this.sectionStart,o),this.index=s}this.sectionStart=o+2,this.stateInClosingTagName(n),this.inRCDATA=!1;return}this.sequenceIndex=0}(n|32)===this.currentSequence[this.sequenceIndex]?this.sequenceIndex+=1:this.sequenceIndex===0?this.currentSequence===ke.TitleEnd||this.currentSequence===ke.TextareaEnd&&!this.inSFCRoot?!this.inVPre&&n===this.delimiterOpen[0]&&(this.state=2,this.delimiterIndex=0,this.stateInterpolationOpen(n)):this.fastForwardTo(60)&&(this.sequenceIndex=1):this.sequenceIndex=+(n===60)}stateCDATASequence(n){n===ke.Cdata[this.sequenceIndex]?++this.sequenceIndex===ke.Cdata.length&&(this.state=28,this.currentSequence=ke.CdataEnd,this.sequenceIndex=0,this.sectionStart=this.index+1):(this.sequenceIndex=0,this.state=23,this.stateInDeclaration(n))}fastForwardTo(n){for(;++this.index<this.buffer.length;){const o=this.buffer.charCodeAt(this.index);if(o===10&&this.newlines.push(this.index),o===n)return!0}return this.index=this.buffer.length-1,!1}stateInCommentLike(n){n===this.currentSequence[this.sequenceIndex]?++this.sequenceIndex===this.currentSequence.length&&(this.currentSequence===ke.CdataEnd?this.cbs.oncdata(this.sectionStart,this.index-2):this.cbs.oncomment(this.sectionStart,this.index-2),this.sequenceIndex=0,this.sectionStart=this.index+1,this.state=1):this.sequenceIndex===0?this.fastForwardTo(this.currentSequence[0])&&(this.sequenceIndex=1):n!==this.currentSequence[this.sequenceIndex-1]&&(this.sequenceIndex=0)}startSpecial(n,o){this.enterRCDATA(n,o),this.state=31}enterRCDATA(n,o){this.inRCDATA=!0,this.currentSequence=n,this.sequenceIndex=o}stateBeforeTagName(n){n===33?(this.state=22,this.sectionStart=this.index+1):n===63?(this.state=24,this.sectionStart=this.index+1):hs(n)?(this.sectionStart=this.index,this.mode===0?this.state=6:this.inSFCRoot?this.state=34:this.inXML?this.state=6:n===116?this.state=30:this.state=n===115?29:6):n===47?this.state=8:(this.state=1,this.stateText(n))}stateInTagName(n){lt(n)&&this.handleTagName(n)}stateInSFCRootTagName(n){if(lt(n)){const o=this.buffer.slice(this.sectionStart,this.index);o!=="template"&&this.enterRCDATA(xn("</"+o),0),this.handleTagName(n)}}handleTagName(n){this.cbs.onopentagname(this.sectionStart,this.index),this.sectionStart=-1,this.state=11,this.stateBeforeAttrName(n)}stateBeforeClosingTagName(n){Oe(n)||(n===62?(process.env.NODE_ENV!=="production"&&this.cbs.onerr(14,this.index),this.state=1,this.sectionStart=this.index+1):(this.state=hs(n)?9:27,this.sectionStart=this.index))}stateInClosingTagName(n){(n===62||Oe(n))&&(this.cbs.onclosetag(this.sectionStart,this.index),this.sectionStart=-1,this.state=10,this.stateAfterClosingTagName(n))}stateAfterClosingTagName(n){n===62&&(this.state=1,this.sectionStart=this.index+1)}stateBeforeAttrName(n){n===62?(this.cbs.onopentagend(this.index),this.inRCDATA?this.state=32:this.state=1,this.sectionStart=this.index+1):n===47?(this.state=7,process.env.NODE_ENV!=="production"&&this.peek()!==62&&this.cbs.onerr(22,this.index)):n===60&&this.peek()===47?(this.cbs.onopentagend(this.index),this.state=5,this.sectionStart=this.index):Oe(n)||(process.env.NODE_ENV!=="production"&&n===61&&this.cbs.onerr(19,this.index),this.handleAttrStart(n))}handleAttrStart(n){n===118&&this.peek()===45?(this.state=13,this.sectionStart=this.index):n===46||n===58||n===64||n===35?(this.cbs.ondirname(this.index,this.index+1),this.state=14,this.sectionStart=this.index+1):(this.state=12,this.sectionStart=this.index)}stateInSelfClosingTag(n){n===62?(this.cbs.onselfclosingtag(this.index),this.state=1,this.sectionStart=this.index+1,this.inRCDATA=!1):Oe(n)||(this.state=11,this.stateBeforeAttrName(n))}stateInAttrName(n){n===61||lt(n)?(this.cbs.onattribname(this.sectionStart,this.index),this.handleAttrNameEnd(n)):process.env.NODE_ENV!=="production"&&(n===34||n===39||n===60)&&this.cbs.onerr(17,this.index)}stateInDirName(n){n===61||lt(n)?(this.cbs.ondirname(this.sectionStart,this.index),this.handleAttrNameEnd(n)):n===58?(this.cbs.ondirname(this.sectionStart,this.index),this.state=14,this.sectionStart=this.index+1):n===46&&(this.cbs.ondirname(this.sectionStart,this.index),this.state=16,this.sectionStart=this.index+1)}stateInDirArg(n){n===61||lt(n)?(this.cbs.ondirarg(this.sectionStart,this.index),this.handleAttrNameEnd(n)):n===91?this.state=15:n===46&&(this.cbs.ondirarg(this.sectionStart,this.index),this.state=16,this.sectionStart=this.index+1)}stateInDynamicDirArg(n){n===93?this.state=14:(n===61||lt(n))&&(this.cbs.ondirarg(this.sectionStart,this.index+1),this.handleAttrNameEnd(n),process.env.NODE_ENV!=="production"&&this.cbs.onerr(27,this.index))}stateInDirModifier(n){n===61||lt(n)?(this.cbs.ondirmodifier(this.sectionStart,this.index),this.handleAttrNameEnd(n)):n===46&&(this.cbs.ondirmodifier(this.sectionStart,this.index),this.sectionStart=this.index+1)}handleAttrNameEnd(n){this.sectionStart=this.index,this.state=17,this.cbs.onattribnameend(this.index),this.stateAfterAttrName(n)}stateAfterAttrName(n){n===61?this.state=18:n===47||n===62?(this.cbs.onattribend(0,this.sectionStart),this.sectionStart=-1,this.state=11,this.stateBeforeAttrName(n)):Oe(n)||(this.cbs.onattribend(0,this.sectionStart),this.handleAttrStart(n))}stateBeforeAttrValue(n){n===34?(this.state=19,this.sectionStart=this.index+1):n===39?(this.state=20,this.sectionStart=this.index+1):Oe(n)||(this.sectionStart=this.index,this.state=21,this.stateInAttrValueNoQuotes(n))}handleInAttrValue(n,o){(n===o||this.fastForwardTo(o))&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(o===34?3:2,this.index+1),this.state=11)}stateInAttrValueDoubleQuotes(n){this.handleInAttrValue(n,34)}stateInAttrValueSingleQuotes(n){this.handleInAttrValue(n,39)}stateInAttrValueNoQuotes(n){Oe(n)||n===62?(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=-1,this.cbs.onattribend(1,this.index),this.state=11,this.stateBeforeAttrName(n)):(process.env.NODE_ENV!=="production"&&n===34||n===39||n===60||n===61||n===96)&&this.cbs.onerr(18,this.index)}stateBeforeDeclaration(n){n===91?(this.state=26,this.sequenceIndex=0):this.state=n===45?25:23}stateInDeclaration(n){(n===62||this.fastForwardTo(62))&&(this.state=1,this.sectionStart=this.index+1)}stateInProcessingInstruction(n){(n===62||this.fastForwardTo(62))&&(this.cbs.onprocessinginstruction(this.sectionStart,this.index),this.state=1,this.sectionStart=this.index+1)}stateBeforeComment(n){n===45?(this.state=28,this.currentSequence=ke.CommentEnd,this.sequenceIndex=2,this.sectionStart=this.index+1):this.state=23}stateInSpecialComment(n){(n===62||this.fastForwardTo(62))&&(this.cbs.oncomment(this.sectionStart,this.index),this.state=1,this.sectionStart=this.index+1)}stateBeforeSpecialS(n){n===ke.ScriptEnd[3]?this.startSpecial(ke.ScriptEnd,4):n===ke.StyleEnd[3]?this.startSpecial(ke.StyleEnd,4):(this.state=6,this.stateInTagName(n))}stateBeforeSpecialT(n){n===ke.TitleEnd[3]?this.startSpecial(ke.TitleEnd,4):n===ke.TextareaEnd[3]?this.startSpecial(ke.TextareaEnd,4):(this.state=6,this.stateInTagName(n))}startEntity(){}stateInEntity(){}parse(n){for(this.buffer=n;this.index<this.buffer.length;){const o=this.buffer.charCodeAt(this.index);switch(o===10&&this.state!==33&&this.newlines.push(this.index),this.state){case 1:{this.stateText(o);break}case 2:{this.stateInterpolationOpen(o);break}case 3:{this.stateInterpolation(o);break}case 4:{this.stateInterpolationClose(o);break}case 31:{this.stateSpecialStartSequence(o);break}case 32:{this.stateInRCDATA(o);break}case 26:{this.stateCDATASequence(o);break}case 19:{this.stateInAttrValueDoubleQuotes(o);break}case 12:{this.stateInAttrName(o);break}case 13:{this.stateInDirName(o);break}case 14:{this.stateInDirArg(o);break}case 15:{this.stateInDynamicDirArg(o);break}case 16:{this.stateInDirModifier(o);break}case 28:{this.stateInCommentLike(o);break}case 27:{this.stateInSpecialComment(o);break}case 11:{this.stateBeforeAttrName(o);break}case 6:{this.stateInTagName(o);break}case 34:{this.stateInSFCRootTagName(o);break}case 9:{this.stateInClosingTagName(o);break}case 5:{this.stateBeforeTagName(o);break}case 17:{this.stateAfterAttrName(o);break}case 20:{this.stateInAttrValueSingleQuotes(o);break}case 18:{this.stateBeforeAttrValue(o);break}case 8:{this.stateBeforeClosingTagName(o);break}case 10:{this.stateAfterClosingTagName(o);break}case 29:{this.stateBeforeSpecialS(o);break}case 30:{this.stateBeforeSpecialT(o);break}case 21:{this.stateInAttrValueNoQuotes(o);break}case 7:{this.stateInSelfClosingTag(o);break}case 23:{this.stateInDeclaration(o);break}case 22:{this.stateBeforeDeclaration(o);break}case 25:{this.stateBeforeComment(o);break}case 24:{this.stateInProcessingInstruction(o);break}case 33:{this.stateInEntity();break}}this.index++}this.cleanup(),this.finish()}cleanup(){this.sectionStart!==this.index&&(this.state===1||this.state===32&&this.sequenceIndex===0?(this.cbs.ontext(this.sectionStart,this.index),this.sectionStart=this.index):(this.state===19||this.state===20||this.state===21)&&(this.cbs.onattribdata(this.sectionStart,this.index),this.sectionStart=this.index))}finish(){this.handleTrailingData(),this.cbs.onend()}handleTrailingData(){const n=this.buffer.length;this.sectionStart>=n||(this.state===28?this.currentSequence===ke.CdataEnd?this.cbs.oncdata(this.sectionStart,n):this.cbs.oncomment(this.sectionStart,n):this.state===6||this.state===11||this.state===18||this.state===17||this.state===12||this.state===13||this.state===14||this.state===15||this.state===16||this.state===20||this.state===19||this.state===21||this.state===9||this.cbs.ontext(this.sectionStart,n))}emitCodePoint(n,o){}}const rd={COMPILER_IS_ON_ELEMENT:{message:'Platform-native elements with "is" prop will no longer be treated as components in Vue 3 unless the "is" value is explicitly prefixed with "vue:".',link:"https://v3-migration.vuejs.org/breaking-changes/custom-elements-interop.html"},COMPILER_V_BIND_SYNC:{message:t=>`.sync modifier for v-bind has been removed. Use v-model with argument instead. \`v-bind:${t}.sync\` should be changed to \`v-model:${t}\`.`,link:"https://v3-migration.vuejs.org/breaking-changes/v-model.html"},COMPILER_V_BIND_OBJECT_ORDER:{message:'v-bind="obj" usage is now order sensitive and behaves like JavaScript object spread: it will now overwrite an existing non-mergeable attribute that appears before v-bind in the case of conflict. To retain 2.x behavior, move v-bind to make it the first attribute. You can also suppress this warning if the usage is intended.',link:"https://v3-migration.vuejs.org/breaking-changes/v-bind.html"},COMPILER_V_ON_NATIVE:{message:".native modifier for v-on has been removed as is no longer necessary.",link:"https://v3-migration.vuejs.org/breaking-changes/v-on-native-modifier-removed.html"},COMPILER_V_IF_V_FOR_PRECEDENCE:{message:"v-if / v-for precedence when used on the same element has changed in Vue 3: v-if now takes higher precedence and will no longer have access to v-for scope variables. It is best to avoid the ambiguity with <template> tags or use a computed property that filters v-for data source.",link:"https://v3-migration.vuejs.org/breaking-changes/v-if-v-for.html"},COMPILER_NATIVE_TEMPLATE:{message:"<template> with no special directives will render as a native template element instead of its inner content in Vue 3."},COMPILER_INLINE_TEMPLATE:{message:'"inline-template" has been removed in Vue 3.',link:"https://v3-migration.vuejs.org/breaking-changes/inline-template-attribute.html"},COMPILER_FILTERS:{message:'filters have been removed in Vue 3. The "|" symbol will be treated as native JavaScript bitwise OR operator. Use method calls or computed properties instead.',link:"https://v3-migration.vuejs.org/breaking-changes/filters.html"}};function yo(t,{compatConfig:n}){const o=n&&n[t];return t==="MODE"?o||3:o}function at(t,n){const o=yo("MODE",n),s=yo(t,n);return o===3?s===!0:s!==!1}function Ot(t,n,o,...s){const r=at(t,n);return process.env.NODE_ENV!=="production"&&r&&Nn(t,n,o,...s),r}function Nn(t,n,o,...s){if(yo(t,n)==="suppress-warning")return;const{message:i,link:l}=rd[t],a=`(deprecation ${t}) ${typeof i=="function"?i(...s):i}${l?`
2
2
  Details: ${l}`:""}`,c=new SyntaxError(a);c.code=t,o&&(c.loc=o),n.onWarn(c)}function vo(t){throw t}function gs(t){process.env.NODE_ENV!=="production"&&console.warn(`[Vue warn] ${t.message}`)}function se(t,n,o,s){const r=process.env.NODE_ENV!=="production"?(o||id)[t]+(s||""):`https://vuejs.org/error-reference/#compiler-${t}`,i=new SyntaxError(String(r));return i.code=t,i.loc=n,i}const id={0:"Illegal comment.",1:"CDATA section is allowed only in XML context.",2:"Duplicate attribute.",3:"End tag cannot have attributes.",4:"Illegal '/' in tags.",5:"Unexpected EOF in tag.",6:"Unexpected EOF in CDATA section.",7:"Unexpected EOF in comment.",8:"Unexpected EOF in script.",9:"Unexpected EOF in tag.",10:"Incorrectly closed comment.",11:"Incorrectly opened comment.",12:"Illegal tag name. Use '&lt;' to print '<'.",13:"Attribute value was expected.",14:"End tag name was expected.",15:"Whitespace was expected.",16:"Unexpected '<!--' in comment.",17:`Attribute name cannot contain U+0022 ("), U+0027 ('), and U+003C (<).`,18:"Unquoted attribute value cannot contain U+0022 (\"), U+0027 ('), U+003C (<), U+003D (=), and U+0060 (`).",19:"Attribute name cannot start with '='.",21:"'<?' is allowed only in XML context.",20:"Unexpected null character.",22:"Illegal '/' in tags.",23:"Invalid end tag.",24:"Element is missing end tag.",25:"Interpolation end sign was not found.",27:"End bracket for dynamic directive argument was not found. Note that dynamic directive argument cannot contain spaces.",26:"Legal directive name was expected.",28:"v-if/v-else-if is missing expression.",29:"v-if/else branches must use unique keys.",30:"v-else/v-else-if has no adjacent v-if or v-else-if.",31:"v-for is missing expression.",32:"v-for has invalid expression.",33:"<template v-for> key should be placed on the <template> tag.",34:"v-bind is missing expression.",53:"v-bind with same-name shorthand only allows static argument.",35:"v-on is missing expression.",36:"Unexpected custom directive on <slot> outlet.",37:"Mixed v-slot usage on both the component and nested <template>. When there are multiple named slots, all slots should use <template> syntax to avoid scope ambiguity.",38:"Duplicate slot names found. ",39:"Extraneous children found when component already has explicitly named default slot. These children will be ignored.",40:"v-slot can only be used on components or <template> tags.",41:"v-model is missing expression.",42:"v-model value must be a valid JavaScript member expression.",43:"v-model cannot be used on v-for or v-slot scope variables because they are not writable.",44:`v-model cannot be used on a prop, because local prop bindings are not writable.
3
3
  Use a v-bind binding combined with a v-on listener that emits update:x event instead.`,45:"v-model cannot be used on a const binding because it is not writable.",46:"Error parsing JavaScript expression: ",47:"<KeepAlive> expects exactly one child component.",52:"@vnode-* hooks in templates are no longer supported. Use the vue: prefix instead. For example, @vnode-mounted should be changed to @vue:mounted. @vnode-* hooks support has been removed in 3.4.",48:'"prefixIdentifiers" option is not supported in this build of compiler.',49:"ES module mode is not supported in this build of compiler.",50:'"cacheHandlers" option is only supported when the "prefixIdentifiers" option is enabled.',51:'"scopeId" option is only supported in module mode.',54:""},$e=t=>t.type===4&&t.isStatic;function ys(t){switch(t){case"Teleport":case"teleport":return Wt;case"Suspense":case"suspense":return Xn;case"KeepAlive":case"keep-alive":return bn;case"BaseTransition":case"base-transition":return is}}const ld=/^$|^\d|[^\$\w\xA0-\uFFFF]/,bo=t=>!ld.test(t),vs=/[A-Za-z_$\xA0-\uFFFF]/,ad=/[\.\?\w$\xA0-\uFFFF]/,cd=/\s+[.[]\s*|\s*[.[]\s+/g,bs=t=>t.type===4?t.content:t.loc.source,ks=t=>{const n=bs(t).trim().replace(cd,a=>a.trim());let o=0,s=[],r=0,i=0,l=null;for(let a=0;a<n.length;a++){const c=n.charAt(a);switch(o){case 0:if(c==="[")s.push(o),o=1,r++;else if(c==="(")s.push(o),o=2,i++;else if(!(a===0?vs:ad).test(c))return!1;break;case 1:c==="'"||c==='"'||c==="`"?(s.push(o),o=3,l=c):c==="["?r++:c==="]"&&(--r||(o=s.pop()));break;case 2:if(c==="'"||c==='"'||c==="`")s.push(o),o=3,l=c;else if(c==="(")i++;else if(c===")"){if(a===n.length-1)return!1;--i||(o=s.pop())}break;case 3:c===l&&(o=s.pop(),l=null);break}}return!r&&!i},dd=/^\s*(?:async\s*)?(?:\([^)]*?\)|[\w$_]+)\s*(?::[^=]+)?=>|^\s*(?:async\s+)?function(?:\s+[\w$]+)?\s*\(/,fd=t=>dd.test(bs(t));function Es(t,n){if(!t)throw new Error(n||"unexpected compiler condition")}function Te(t,n,o=!1){for(let s=0;s<t.props.length;s++){const r=t.props[s];if(r.type===7&&(o||r.exp)&&(be(n)?r.name===n:n.test(r.name)))return r}}function Yt(t,n,o=!1,s=!1){for(let r=0;r<t.props.length;r++){const i=t.props[r];if(i.type===6){if(o)continue;if(i.name===n&&(i.value||s))return i}else if(i.name==="bind"&&(i.exp||s)&&ct(i.arg,n))return i}}function ct(t,n){return!!(t&&$e(t)&&t.content===n)}function pd(t){return t.props.some(n=>n.type===7&&n.name==="bind"&&(!n.arg||n.arg.type!==4||!n.arg.isStatic))}function ko(t){return t.type===5||t.type===2}function ws(t){return t.type===7&&t.name==="pre"}function ud(t){return t.type===7&&t.name==="slot"}function Cn(t){return t.type===1&&t.tagType===3}function Sn(t){return t.type===1&&t.tagType===2}const md=new Set([Gt,Zt]);function xs(t,n=[]){if(t&&!be(t)&&t.type===14){const o=t.callee;if(!be(o)&&md.has(o))return xs(t.arguments[0],n.concat(t))}return[t,n]}function _n(t,n,o){let s,r=t.type===13?t.props:t.arguments[2],i=[],l;if(r&&!be(r)&&r.type===14){const a=xs(r);r=a[0],i=a[1],l=i[i.length-1]}if(r==null||be(r))s=Fe([n]);else if(r.type===14){const a=r.arguments[0];!be(a)&&a.type===15?Ns(n,a)||a.properties.unshift(n):r.callee===co?s=ge(o.helper(En),[Fe([n]),r]):r.arguments.unshift(Fe([n])),!s&&(s=r)}else r.type===15?(Ns(n,r)||r.properties.unshift(n),s=r):(s=ge(o.helper(En),[Fe([n]),r]),l&&l.callee===Zt&&(l=i[i.length-2]));t.type===13?l?l.arguments[0]=s:t.props=s:l?l.arguments[0]=s:t.arguments[2]=s}function Ns(t,n){let o=!1;if(t.key.type===4){const s=t.key.content;o=n.properties.some(r=>r.key.type===4&&r.key.content===s)}return o}function Xt(t,n){return`_${n}_${t.replace(/[^\w]/g,(o,s)=>o==="-"?"_":t.charCodeAt(s).toString())}`}function hd(t){return t.type===14&&t.callee===mo?t.arguments[1].returns:t}const gd=/([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;function Cs(t){for(let n=0;n<t.length;n++)if(!Oe(t.charCodeAt(n)))return!1;return!0}function Eo(t){return t.type===2&&Cs(t.content)||t.type===12&&Eo(t.content)}function wo(t){return t.type===3||Eo(t)}const Ss={parseMode:"base",ns:0,delimiters:["{{","}}"],getNamespace:()=>0,isVoidTag:vn,isPreTag:vn,isIgnoreNewlineTag:vn,isCustomElement:vn,onError:vo,onWarn:gs,comments:process.env.NODE_ENV!=="production",prefixIdentifiers:!1};let ee=Ss,Qt=null,Qe="",Ce=null,V=null,Le="",Ve=-1,gt=-1,xo=0,dt=!1,No=null;const de=[],ce=new sd(de,{onerr:Ae,ontext(t,n){Bn(Ee(t,n),t,n)},ontextentity(t,n,o){Bn(t,n,o)},oninterpolation(t,n){if(dt)return Bn(Ee(t,n),t,n);let o=t+ce.delimiterOpen.length,s=n-ce.delimiterClose.length;for(;Oe(Qe.charCodeAt(o));)o++;for(;Oe(Qe.charCodeAt(s-1));)s--;let r=Ee(o,s);r.includes("&")&&(r=ee.decodeEntities(r,!1)),Co({type:5,content:Tn(r,!1,pe(o,s)),loc:pe(t,n)})},onopentagname(t,n){const o=Ee(t,n);Ce={type:1,tag:o,ns:ee.getNamespace(o,de[0],ee.ns),tagType:0,props:[],children:[],loc:pe(t-1,n),codegenNode:void 0}},onopentagend(t){Bs(t)},onclosetag(t,n){const o=Ee(t,n);if(!ee.isVoidTag(o)){let s=!1;for(let r=0;r<de.length;r++)if(de[r].tag.toLowerCase()===o.toLowerCase()){s=!0,r>0&&Ae(24,de[0].loc.start.offset);for(let l=0;l<=r;l++){const a=de.shift();$n(a,n,l<r)}break}s||Ae(23,$s(t,60))}},onselfclosingtag(t){const n=Ce.tag;Ce.isSelfClosing=!0,Bs(t),de[0]&&de[0].tag===n&&$n(de.shift(),t)},onattribname(t,n){V={type:6,name:Ee(t,n),nameLoc:pe(t,n),value:void 0,loc:pe(t)}},ondirname(t,n){const o=Ee(t,n),s=o==="."||o===":"?"bind":o==="@"?"on":o==="#"?"slot":o.slice(2);if(!dt&&s===""&&Ae(26,t),dt||s==="")V={type:6,name:o,nameLoc:pe(t,n),value:void 0,loc:pe(t)};else if(V={type:7,name:s,rawName:o,exp:void 0,arg:void 0,modifiers:o==="."?[Q("prop")]:[],loc:pe(t)},s==="pre"){dt=ce.inVPre=!0,No=Ce;const r=Ce.props;for(let i=0;i<r.length;i++)r[i].type===7&&(r[i]=Sd(r[i]))}},ondirarg(t,n){if(t===n)return;const o=Ee(t,n);if(dt&&!ws(V))V.name+=o,yt(V.nameLoc,n);else{const s=o[0]!=="[";V.arg=Tn(s?o:o.slice(1,-1),s,pe(t,n),s?3:0)}},ondirmodifier(t,n){const o=Ee(t,n);if(dt&&!ws(V))V.name+="."+o,yt(V.nameLoc,n);else if(V.name==="slot"){const s=V.arg;s&&(s.content+="."+o,yt(s.loc,n))}else{const s=Q(o,!0,pe(t,n));V.modifiers.push(s)}},onattribdata(t,n){Le+=Ee(t,n),Ve<0&&(Ve=t),gt=n},onattribentity(t,n,o){Le+=t,Ve<0&&(Ve=n),gt=o},onattribnameend(t){const n=V.loc.start.offset,o=Ee(n,t);V.type===7&&(V.rawName=o),Ce.props.some(s=>(s.type===7?s.rawName:s.name)===o)&&Ae(2,n)},onattribend(t,n){if(Ce&&V){if(yt(V.loc,n),t!==0)if(Le.includes("&")&&(Le=ee.decodeEntities(Le,!0)),V.type===6)V.name==="class"&&(Le=As(Le).trim()),t===1&&!Le&&Ae(13,n),V.value={type:2,content:Le,loc:t===1?pe(Ve,gt):pe(Ve-1,gt+1)},ce.inSFCRoot&&Ce.tag==="template"&&V.name==="lang"&&Le&&Le!=="html"&&ce.enterRCDATA(xn("</template"),0);else{let o=0;V.exp=Tn(Le,!1,pe(Ve,gt),0,o),V.name==="for"&&(V.forParseResult=vd(V.exp));let s=-1;V.name==="bind"&&(s=V.modifiers.findIndex(r=>r.content==="sync"))>-1&&Ot("COMPILER_V_BIND_SYNC",ee,V.loc,V.arg.loc.source)&&(V.name="model",V.modifiers.splice(s,1))}(V.type!==7||V.name!=="pre")&&Ce.props.push(V)}Le="",Ve=gt=-1},oncomment(t,n){ee.comments&&Co({type:3,content:Ee(t,n),loc:pe(t-4,n+3)})},onend(){const t=Qe.length;if(process.env.NODE_ENV!=="production"&&ce.state!==1)switch(ce.state){case 5:case 8:Ae(5,t);break;case 3:case 4:Ae(25,ce.sectionStart);break;case 28:ce.currentSequence===ke.CdataEnd?Ae(6,t):Ae(7,t);break;case 6:case 7:case 9:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:Ae(9,t);break}for(let n=0;n<de.length;n++)$n(de[n],t-1),Ae(24,de[n].loc.start.offset)},oncdata(t,n){de[0].ns!==0?Bn(Ee(t,n),t,n):Ae(1,t-9)},onprocessinginstruction(t){(de[0]?de[0].ns:ee.ns)===0&&Ae(21,t-1)}}),_s=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,yd=/^\(|\)$/g;function vd(t){const n=t.loc,o=t.content,s=o.match(gd);if(!s)return;const[,r,i]=s,l=(f,h,E=!1)=>{const b=n.start.offset+h,v=b+f.length;return Tn(f,!1,pe(b,v),0,E?1:0)},a={source:l(i.trim(),o.indexOf(i,r.length)),value:void 0,key:void 0,index:void 0,finalized:!1};let c=r.trim().replace(yd,"").trim();const d=r.indexOf(c),m=c.match(_s);if(m){c=c.replace(_s,"").trim();const f=m[1].trim();let h;if(f&&(h=o.indexOf(f,d+c.length),a.key=l(f,h,!0)),m[2]){const E=m[2].trim();E&&(a.index=l(E,o.indexOf(E,a.key?h+f.length:d+c.length),!0))}}return c&&(a.value=l(c,d,!0)),a}function Ee(t,n){return Qe.slice(t,n)}function Bs(t){ce.inSFCRoot&&(Ce.innerLoc=pe(t+1,t+1)),Co(Ce);const{tag:n,ns:o}=Ce;o===0&&ee.isPreTag(n)&&xo++,ee.isVoidTag(n)?$n(Ce,t):(de.unshift(Ce),(o===1||o===2)&&(ce.inXML=!0)),Ce=null}function Bn(t,n,o){{const i=de[0]&&de[0].tag;i!=="script"&&i!=="style"&&t.includes("&")&&(t=ee.decodeEntities(t,!1))}const s=de[0]||Qt,r=s.children[s.children.length-1];r&&r.type===2?(r.content+=t,yt(r.loc,o)):s.children.push({type:2,content:t,loc:pe(n,o)})}function $n(t,n,o=!1){o?yt(t.loc,$s(n,60)):yt(t.loc,bd(n,62)+1),ce.inSFCRoot&&(t.children.length?t.innerLoc.end=rt({},t.children[t.children.length-1].loc.end):t.innerLoc.end=rt({},t.innerLoc.start),t.innerLoc.source=Ee(t.innerLoc.start.offset,t.innerLoc.end.offset));const{tag:s,ns:r,children:i}=t;if(dt||(s==="slot"?t.tagType=2:Ts(t)?t.tagType=3:Ed(t)&&(t.tagType=1)),ce.inRCDATA||(t.children=Ls(i)),r===0&&ee.isIgnoreNewlineTag(s)){const l=i[0];l&&l.type===2&&(l.content=l.content.replace(/^\r?\n/,""))}r===0&&ee.isPreTag(s)&&xo--,No===t&&(dt=ce.inVPre=!1,No=null),ce.inXML&&(de[0]?de[0].ns:ee.ns)===0&&(ce.inXML=!1);{const l=t.props;if(process.env.NODE_ENV!=="production"&&at("COMPILER_V_IF_V_FOR_PRECEDENCE",ee)){let c=!1,d=!1;for(let m=0;m<l.length;m++){const f=l[m];if(f.type===7&&(f.name==="if"?c=!0:f.name==="for"&&(d=!0)),c&&d){Nn("COMPILER_V_IF_V_FOR_PRECEDENCE",ee,t.loc);break}}}if(!ce.inSFCRoot&&at("COMPILER_NATIVE_TEMPLATE",ee)&&t.tag==="template"&&!Ts(t)){process.env.NODE_ENV!=="production"&&Nn("COMPILER_NATIVE_TEMPLATE",ee,t.loc);const c=de[0]||Qt,d=c.children.indexOf(t);c.children.splice(d,1,...t.children)}const a=l.find(c=>c.type===6&&c.name==="inline-template");a&&Ot("COMPILER_INLINE_TEMPLATE",ee,a.loc)&&t.children.length&&(a.value={type:2,content:Ee(t.children[0].loc.start.offset,t.children[t.children.length-1].loc.end.offset),loc:a.loc})}}function bd(t,n){let o=t;for(;Qe.charCodeAt(o)!==n&&o<Qe.length-1;)o++;return o}function $s(t,n){let o=t;for(;Qe.charCodeAt(o)!==n&&o>=0;)o--;return o}const kd=new Set(["if","else","else-if","for","slot"]);function Ts({tag:t,props:n}){if(t==="template"){for(let o=0;o<n.length;o++)if(n[o].type===7&&kd.has(n[o].name))return!0}return!1}function Ed({tag:t,props:n}){if(ee.isCustomElement(t))return!1;if(t==="component"||wd(t.charCodeAt(0))||ys(t)||ee.isBuiltInComponent&&ee.isBuiltInComponent(t)||ee.isNativeTag&&!ee.isNativeTag(t))return!0;for(let o=0;o<n.length;o++){const s=n[o];if(s.type===6){if(s.name==="is"&&s.value){if(s.value.content.startsWith("vue:"))return!0;if(Ot("COMPILER_IS_ON_ELEMENT",ee,s.loc))return!0}}else if(s.name==="bind"&&ct(s.arg,"is")&&Ot("COMPILER_IS_ON_ELEMENT",ee,s.loc))return!0}return!1}function wd(t){return t>64&&t<91}const xd=/\r\n/g;function Ls(t){const n=ee.whitespace!=="preserve";let o=!1;for(let s=0;s<t.length;s++){const r=t[s];if(r.type===2)if(xo)r.content=r.content.replace(xd,`
4
4
  `);else if(Cs(r.content)){const i=t[s-1]&&t[s-1].type,l=t[s+1]&&t[s+1].type;!i||!l||n&&(i===3&&(l===3||l===1)||i===1&&(l===3||l===1&&Nd(r.content)))?(o=!0,t[s]=null):r.content=" "}else n&&(r.content=As(r.content))}return o?t.filter(Boolean):t}function Nd(t){for(let n=0;n<t.length;n++){const o=t.charCodeAt(n);if(o===10||o===13)return!0}return!1}function As(t){let n="",o=!1;for(let s=0;s<t.length;s++)Oe(t.charCodeAt(s))?o||(n+=" ",o=!0):(n+=t[s],o=!1);return n}function Co(t){(de[0]||Qt).children.push(t)}function pe(t,n){return{start:ce.getPos(t),end:n==null?n:ce.getPos(n),source:n==null?n:Ee(t,n)}}function Cd(t){return pe(t.start.offset,t.end.offset)}function yt(t,n){t.end=ce.getPos(n),t.source=Ee(t.start.offset,n)}function Sd(t){const n={type:6,name:t.rawName,nameLoc:pe(t.loc.start.offset,t.loc.start.offset+t.rawName.length),value:void 0,loc:t.loc};if(t.exp){const o=t.exp.loc;o.end.offset<t.loc.end.offset&&(o.start.offset--,o.start.column--,o.end.offset++,o.end.column++),n.value={type:2,content:t.exp.content,loc:o}}return n}function Tn(t,n=!1,o,s=0,r=0){return Q(t,n,o,s)}function Ae(t,n,o){ee.onError(se(t,pe(n,n),void 0,o))}function _d(){ce.reset(),Ce=null,V=null,Le="",Ve=-1,gt=-1,de.length=0}function Bd(t,n){if(_d(),Qe=t,ee=rt({},Ss),n){let r;for(r in n)n[r]!=null&&(ee[r]=n[r])}if(process.env.NODE_ENV!=="production"&&!ee.decodeEntities)throw new Error("[@vue/compiler-core] decodeEntities option is required in browser builds.");ce.mode=ee.parseMode==="html"?1:ee.parseMode==="sfc"?2:0,ce.inXML=ee.ns===1||ee.ns===2;const o=n&&n.delimiters;o&&(ce.delimiterOpen=xn(o[0]),ce.delimiterClose=xn(o[1]));const s=Qt=td([],t);return ce.parse(Qe),s.loc=pe(0,t.length),s.children=Ls(s.children),Qt=null,s}function $d(t,n){Ln(t,void 0,n,!!Ds(t))}function Ds(t){const n=t.children.filter(o=>o.type!==3);return n.length===1&&n[0].type===1&&!Sn(n[0])?n[0]:null}function Ln(t,n,o,s=!1,r=!1){const{children:i}=t,l=[];for(let m=0;m<i.length;m++){const f=i[m];if(f.type===1&&f.tagType===0){const h=s?0:Me(f,o);if(h>0){if(h>=2){f.codegenNode.patchFlag=-1,l.push(f);continue}}else{const E=f.codegenNode;if(E.type===13){const b=E.patchFlag;if((b===void 0||b===512||b===1)&&Os(f,o)>=2){const v=Ms(f);v&&(E.props=o.hoist(v))}E.dynamicProps&&(E.dynamicProps=o.hoist(E.dynamicProps))}}}else if(f.type===12&&(s?0:Me(f,o))>=2){f.codegenNode.type===14&&f.codegenNode.arguments.length>0&&f.codegenNode.arguments.push(-1+(process.env.NODE_ENV!=="production"?` /* ${Ut[-1]} */`:"")),l.push(f);continue}if(f.type===1){const h=f.tagType===1;h&&o.scopes.vSlot++,Ln(f,t,o,!1,r),h&&o.scopes.vSlot--}else if(f.type===11)Ln(f,t,o,f.children.length===1,!0);else if(f.type===9)for(let h=0;h<f.branches.length;h++)Ln(f.branches[h],t,o,f.branches[h].children.length===1,r)}let a=!1;if(l.length===i.length&&t.type===1){if(t.tagType===0&&t.codegenNode&&t.codegenNode.type===13&&Xe(t.codegenNode.children))t.codegenNode.children=c(ht(t.codegenNode.children)),a=!0;else if(t.tagType===1&&t.codegenNode&&t.codegenNode.type===13&&t.codegenNode.children&&!Xe(t.codegenNode.children)&&t.codegenNode.children.type===15){const m=d(t.codegenNode,"default");m&&(m.returns=c(ht(m.returns)),a=!0)}else if(t.tagType===3&&n&&n.type===1&&n.tagType===1&&n.codegenNode&&n.codegenNode.type===13&&n.codegenNode.children&&!Xe(n.codegenNode.children)&&n.codegenNode.children.type===15){const m=Te(t,"slot",!0),f=m&&m.arg&&d(n.codegenNode,m.arg);f&&(f.returns=c(ht(f.returns)),a=!0)}}if(!a)for(const m of l)m.codegenNode=o.cache(m.codegenNode);function c(m){const f=o.cache(m);return f.needArraySpread=!0,f}function d(m,f){if(m.children&&!Xe(m.children)&&m.children.type===15){const h=m.children.properties.find(E=>E.key===f||E.key.content===f);return h&&h.value}}l.length&&o.transformHoist&&o.transformHoist(i,o,t)}function Me(t,n){const{constantCache:o}=n;switch(t.type){case 1:if(t.tagType!==0)return 0;const s=o.get(t);if(s!==void 0)return s;const r=t.codegenNode;if(r.type!==13||r.isBlock&&t.tag!=="svg"&&t.tag!=="foreignObject"&&t.tag!=="math")return 0;if(r.patchFlag===void 0){let l=3;const a=Os(t,n);if(a===0)return o.set(t,0),0;a<l&&(l=a);for(let c=0;c<t.children.length;c++){const d=Me(t.children[c],n);if(d===0)return o.set(t,0),0;d<l&&(l=d)}if(l>1)for(let c=0;c<t.props.length;c++){const d=t.props[c];if(d.type===7&&d.name==="bind"&&d.exp){const m=Me(d.exp,n);if(m===0)return o.set(t,0),0;m<l&&(l=m)}}if(r.isBlock){for(let c=0;c<t.props.length;c++)if(t.props[c].type===7)return o.set(t,0),0;n.removeHelper(mt),n.removeHelper(It(n.inSSR,r.isComponent)),r.isBlock=!1,n.helper(Dt(n.inSSR,r.isComponent))}return o.set(t,l),l}else return o.set(t,0),0;case 2:case 3:return 3;case 9:case 11:case 10:return 0;case 5:case 12:return Me(t.content,n);case 4:return t.constType;case 8:let i=3;for(let l=0;l<t.children.length;l++){const a=t.children[l];if(be(a)||Zn(a))continue;const c=Me(a,n);if(c===0)return 0;c<i&&(i=c)}return i;case 20:return 2;default:return process.env.NODE_ENV,0}}const Td=new Set([lo,ao,Gt,Zt]);function Is(t,n){if(t.type===14&&!be(t.callee)&&Td.has(t.callee)){const o=t.arguments[0];if(o.type===4)return Me(o,n);if(o.type===14)return Is(o,n)}return 0}function Os(t,n){let o=3;const s=Ms(t);if(s&&s.type===15){const{properties:r}=s;for(let i=0;i<r.length;i++){const{key:l,value:a}=r[i],c=Me(l,n);if(c===0)return c;c<o&&(o=c);let d;if(a.type===4?d=Me(a,n):a.type===14?d=Is(a,n):d=0,d===0)return d;d<o&&(o=d)}}return o}function Ms(t){const n=t.codegenNode;if(n.type===13)return n.props}function Ld(t,{filename:n="",prefixIdentifiers:o=!1,hoistStatic:s=!1,hmr:r=!1,cacheHandlers:i=!1,nodeTransforms:l=[],directiveTransforms:a={},transformHoist:c=null,isBuiltInComponent:d=Kn,isCustomElement:m=Kn,expressionPlugins:f=[],scopeId:h=null,slotted:E=!0,ssr:b=!1,inSSR:v=!1,ssrCssVars:S="",bindingMetadata:k=Lc,inline:_=!1,isTS:C=!1,onError:w=vo,onWarn:x=gs,compatConfig:$}){const B=n.replace(/\?.*$/,"").match(/([^/\\]+)\.\w+$/),g={filename:n,selfName:B&&Yn(it(B[1])),prefixIdentifiers:o,hoistStatic:s,hmr:r,cacheHandlers:i,nodeTransforms:l,directiveTransforms:a,transformHoist:c,isBuiltInComponent:d,isCustomElement:m,expressionPlugins:f,scopeId:h,slotted:E,ssr:b,inSSR:v,ssrCssVars:S,bindingMetadata:k,inline:_,isTS:C,onError:w,onWarn:x,compatConfig:$,root:t,helpers:new Map,components:new Set,directives:new Set,hoists:[],imports:[],cached:[],constantCache:new WeakMap,temps:0,identifiers:Object.create(null),scopes:{vFor:0,vSlot:0,vPre:0,vOnce:0},parent:null,grandParent:null,currentNode:t,childIndex:0,inVOnce:!1,helper(D){const P=g.helpers.get(D)||0;return g.helpers.set(D,P+1),D},removeHelper(D){const P=g.helpers.get(D);if(P){const z=P-1;z?g.helpers.set(D,z):g.helpers.delete(D)}},helperString(D){return`_${Lt[g.helper(D)]}`},replaceNode(D){if(process.env.NODE_ENV!=="production"){if(!g.currentNode)throw new Error("Node being replaced is already removed.");if(!g.parent)throw new Error("Cannot replace root node.")}g.parent.children[g.childIndex]=g.currentNode=D},removeNode(D){if(process.env.NODE_ENV!=="production"&&!g.parent)throw new Error("Cannot remove root node.");const P=g.parent.children,z=D?P.indexOf(D):g.currentNode?g.childIndex:-1;if(process.env.NODE_ENV!=="production"&&z<0)throw new Error("node being removed is not a child of current parent");!D||D===g.currentNode?(g.currentNode=null,g.onNodeRemoved()):g.childIndex>z&&(g.childIndex--,g.onNodeRemoved()),g.parent.children.splice(z,1)},onNodeRemoved:Kn,addIdentifiers(D){},removeIdentifiers(D){},hoist(D){be(D)&&(D=Q(D)),g.hoists.push(D);const P=Q(`_hoisted_${g.hoists.length}`,!1,D.loc,2);return P.hoisted=D,P},cache(D,P=!1,z=!1){const G=nd(g.cached.length,D,P,z);return g.cached.push(G),G}};return g.filters=new Set,g}function Ad(t,n){const o=Ld(t,n);An(t,o),n.hoistStatic&&$d(t,o),n.ssr||Dd(t,o),t.helpers=new Set([...o.helpers.keys()]),t.components=[...o.components],t.directives=[...o.directives],t.imports=o.imports,t.hoists=o.hoists,t.temps=o.temps,t.cached=o.cached,t.transformed=!0,t.filters=[...o.filters]}function Dd(t,n){const{helper:o}=n,{children:s}=t;if(s.length===1){const r=Ds(t);if(r&&r.codegenNode){const i=r.codegenNode;i.type===13&&go(i,n),t.codegenNode=i}else t.codegenNode=s[0]}else if(s.length>1){let r=64;process.env.NODE_ENV!=="production"&&s.filter(i=>i.type!==3).length===1&&(r|=2048),t.codegenNode=Jt(n,o(qt),void 0,t.children,r,void 0,void 0,!0,void 0,!1)}}function Id(t,n){let o=0;const s=()=>{o--};for(;o<t.children.length;o++){const r=t.children[o];be(r)||(n.grandParent=n.parent,n.parent=t,n.childIndex=o,n.onNodeRemoved=s,An(r,n))}}function An(t,n){n.currentNode=t;const{nodeTransforms:o}=n,s=[];for(let i=0;i<o.length;i++){const l=o[i](t,n);if(l&&(Xe(l)?s.push(...l):s.push(l)),n.currentNode)t=n.currentNode;else return}switch(t.type){case 3:n.ssr||n.helper(Kt);break;case 5:n.ssr||n.helper(kn);break;case 9:for(let i=0;i<t.branches.length;i++)An(t.branches[i],n);break;case 10:case 11:case 1:case 0:Id(t,n);break}n.currentNode=t;let r=s.length;for(;r--;)s[r]()}function Rs(t,n){const o=be(t)?s=>s===t:s=>t.test(s);return(s,r)=>{if(s.type===1){const{props:i}=s;if(s.tagType===3&&i.some(ud))return;const l=[];for(let a=0;a<i.length;a++){const c=i[a];if(c.type===7&&o(c.name)){i.splice(a,1),a--;const d=n(s,c,r);d&&l.push(d)}}return l}}}const Dn="/*@__PURE__*/",Fs=t=>`${Lt[t]}: _${Lt[t]}`;function Od(t,{mode:n="function",prefixIdentifiers:o=n==="module",sourceMap:s=!1,filename:r="template.vue.html",scopeId:i=null,optimizeImports:l=!1,runtimeGlobalName:a="Vue",runtimeModuleName:c="vue",ssrRuntimeModuleName:d="vue/server-renderer",ssr:m=!1,isTS:f=!1,inSSR:h=!1}){const E={mode:n,prefixIdentifiers:o,sourceMap:s,filename:r,scopeId:i,optimizeImports:l,runtimeGlobalName:a,runtimeModuleName:c,ssrRuntimeModuleName:d,ssr:m,isTS:f,inSSR:h,source:t.source,code:"",column:1,line:1,offset:0,indentLevel:0,pure:!1,map:void 0,helper(v){return`_${Lt[v]}`},push(v,S=-2,k){E.code+=v},indent(){b(++E.indentLevel)},deindent(v=!1){v?--E.indentLevel:b(--E.indentLevel)},newline(){b(E.indentLevel)}};function b(v){E.push(`
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@opengis/widgets",
3
3
  "private": false,
4
- "version": "0.0.62",
4
+ "version": "0.0.64",
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",