@opengis/widgets 0.0.66 → 0.0.67
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 +1 -1
- package/dist/index.umd.cjs +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2058,7 +2058,7 @@ const za = { class: "map-base-layer-menu" }, Ha = {
|
|
|
2058
2058
|
if (!ft.value) return null;
|
|
2059
2059
|
const [d, F, q, te] = ft.value;
|
|
2060
2060
|
return [(d + q) / 2, (F + te) / 2];
|
|
2061
|
-
}), Xt = G(() => !!ft.value), Je = B(
|
|
2061
|
+
}), Xt = G(() => !!ft.value), Je = B(!1);
|
|
2062
2062
|
B(!1);
|
|
2063
2063
|
const hs = () => {
|
|
2064
2064
|
$e.value = !$e.value;
|
package/dist/index.umd.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(ve,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):(ve=typeof globalThis<"u"?globalThis:ve||self,e(ve.WidgetLib={},ve.Vue,ve.OpenGISCore))})(this,(function(ve,e,Ce){"use strict";function Rr(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 zr=Rr(e);const qo=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),jr=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,o,s)=>s?s.toUpperCase():o.toLowerCase()),Hr=t=>{const n=jr(t);return n.charAt(0).toUpperCase()+n.slice(1)},Ur=(...t)=>t.filter((n,o,s)=>!!n&&n.trim()!==""&&s.indexOf(n)===o).join(" ").trim();var dn={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 Wr=({size:t,strokeWidth:n=2,absoluteStrokeWidth:o,color:s,iconNode:r,name:i,class:l,...a},{slots:c})=>e.h("svg",{...dn,width:t||dn.width,height:t||dn.height,stroke:s||dn.stroke,"stroke-width":o?Number(n)*24/Number(t):n,class:Ur("lucide",...i?[`lucide-${qo(Hr(i))}-icon`,`lucide-${qo(i)}`]:["lucide-icon"]),...a},[...r.map(d=>e.h(...d)),...c.default?[c.default()]:[]]);const ae=(t,n)=>(o,{slots:s})=>e.h(Wr,{...o,iconNode:n,name:t},s);const qr=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 Kr=ae("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Ko=ae("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Gr=ae("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]);const Zr=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 Yr=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 Go=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 Jr=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 _t=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 Xr=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 Qr=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 Vr=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 ei=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 ti=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 Zo=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 ni=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 oi=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 Yo=ae("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const si=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 Jo=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 ri=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 Xo=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 fn=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 ii=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 Qo=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 li=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 Wn=ae("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ai={class:"border-t pt-3 mt-4"},ci={class:"flex gap-2"},di={class:"relative flex items-center justify-center shrink-0 overflow-hidden rounded-full h-5 w-5 bg-gray-200"},fi={class:"flex-1 space-y-2"},pi={class:"flex justify-between items-center"},ui={class:"flex gap-2"},mi=["disabled"],Vo=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",ai,[e.createElementVNode("div",ci,[e.createElementVNode("span",di,[e.createVNode(e.unref(Qo),{class:"h-3 w-3 text-gray-500"})]),e.createElementVNode("div",fi,[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",pi,[c[4]||(c[4]=e.createElementVNode("span",{class:"text-xs text-gray-500 hidden sm:inline"},"Cmd+Enter to send",-1)),e.createElementVNode("div",ui,[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(Wn),{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(Jo),{class:"h-3 w-3 mr-1"}),c[3]||(c[3]=e.createTextVNode(" Send ",-1))],8,mi)])])])])]))}}),hi={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"},gi=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,u)=>(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",hi,[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(Xo),{class:"h-3 w-3 mr-2"}),u[0]||(u[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(fn),{class:"h-3 w-3 mr-2"}),u[1]||(u[1]=e.createTextVNode(" Delete ",-1))])])],512))}}),yi={class:"space-y-2"},vi={class:"relative flex items-center justify-center shrink-0 overflow-hidden rounded-full h-5 w-5 bg-gray-200"},bi={class:"flex-1 min-w-0 space-y-1 relative"},ki={class:"flex items-center gap-2"},Ei={class:"font-medium text-xs"},wi={class:"text-xs text-gray-500"},xi={key:0,class:"text-xs text-gray-700 leading-relaxed"},Ni={class:"flex justify-between text-xs"},Ci={class:"flex items-center gap-2"},Si={key:0,class:"flex gap-2"},_i=["disabled"],Bi={key:0,class:"ml-8 space-y-1 border-l-2 border-gray-100 pl-3"},$i=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),u=e.ref(!1),p=x=>{const _=new Date,W=Math.floor((_.getTime()-x.getTime())/(1e3*60*60));return W<1?`${Math.floor((_.getTime()-x.getTime())/6e4)}m`:W<24?`${W}h`:`${Math.floor(W/24)}d`},m=()=>{u.value=!u.value,u.value?o("like",s.comment.id,"add"):o("like",s.comment.id,"delete")},S=()=>{o("edit",s.comment.id,r.value),d.value=!1},w=(x,_)=>{o("like",x,_)},g=(x,_)=>{o("edit",x,_)};return(x,_)=>{const W=e.resolveComponent("CommentItem",!0);return e.openBlock(),e.createElementBlock("div",yi,[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",vi,[e.createVNode(e.unref(Qo),{class:"h-3 w-3 text-gray-500"})]),e.createElementVNode("div",bi,[e.createElementVNode("div",ki,[e.createElementVNode("span",Ei,e.toDisplayString(t.comment?.author),1),e.createElementVNode("span",wi,e.toDisplayString(p(t.comment?.createdAt)),1)]),d.value?e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{key:1,"onUpdate:modelValue":_[0]||(_[0]=N=>r.value=N),class:e.normalizeClass(d.value?l.value:i.value)},null,2)),[[e.vModelText,r.value]]):(e.openBlock(),e.createElementBlock("p",xi,e.toDisplayString(t.comment?.text),1)),e.createElementVNode("div",Ni,[e.createElementVNode("div",Ci,[e.createElementVNode("button",{class:e.normalizeClass(["flex items-center gap-1",u.value?"text-blue-600":"text-gray-500 hover:text-blue-600 transition-colors"]),onClick:_[1]||(_[1]=N=>m())},[e.createVNode(e.unref(Vr),{class:e.normalizeClass(["h-3 w-3",u.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:_[2]||(_[2]=N=>c.value=!0)},[e.createVNode(e.unref(si),{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:_[3]||(_[3]=N=>a.value=!0)},[e.createVNode(e.unref(Jr),{class:"h-3 w-3"})])]),d.value?(e.openBlock(),e.createElementBlock("div",Si,[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:_[4]||(_[4]=N=>d.value=!1)},[e.createVNode(e.unref(Wn),{class:"h-3 w-3"}),_[11]||(_[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:_[5]||(_[5]=N=>S())},[e.createVNode(e.unref(Jo),{class:"h-3 w-3 mr-1"}),_[12]||(_[12]=e.createTextVNode(" Send ",-1))],8,_i)])):e.createCommentVNode("",!0)])]),a.value?(e.openBlock(),e.createBlock(gi,{key:0,showMoreOptions:a.value,"onUpdate:showMoreOptions":_[6]||(_[6]=N=>a.value=N),onEdit:_[7]||(_[7]=N=>d.value=!0),onDelete:_[8]||(_[8]=N=>x.$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",Bi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.comment?.replies,N=>(e.openBlock(),e.createBlock(W,{key:N.id,comment:N,isInside:!0,onDelete:C=>x.$emit("delete",N.id),onLike:w,onEdit:g},null,8,["comment","onDelete"]))),128)),c.value&&!t.isInside?(e.openBlock(),e.createBlock(Vo,{key:0,onSendComment:_[9]||(_[9]=N=>x.$emit("reply",t.comment?.id,N)),isReply:c.value,"onUpdate:isReply":_[10]||(_[10]=N=>c.value=N)},null,8,["isReply"])):e.createCommentVNode("",!0)]))])}}}),Ti=["id"],Li={key:0,class:"text-xl font-semibold text-gray-900 mb-4"},pn=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 p=await fetch(`/api/widget/comment/${o.id}`).then(m=>m.json());r.value=p.rows.map(m=>({id:m.communication_id,author:m.username,text:m.body,createdAt:new Date(m.cdate)}))}r.value.length===0&&i();const l=async p=>{o.onAddComment?o.onAddComment(p):o.id&&(await fetch(`/api/widget/comment/${o.id}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:p})}),await i()),s("add",p)},a=(p,m)=>{o?.onLike?.(p,m),s("like",p,m)},c=(p,m)=>{o.onReply?.(p,m),s("reply",p,m)},d=async(p,m)=>{o.onEdit?o.onEdit(p,m):o.id&&(await fetch(`/api/widget/comment/${o.id}/${p}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:m})}),await i()),s("edit",p,m)},u=async p=>{o.onDelete?o.onDelete(p):o.id&&(await fetch(`/api/widget/comment/${o.id}/${p}`,{method:"DELETE"}),await i()),s("delete",p)};return(p,m)=>(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",Li,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,S=>(e.openBlock(),e.createBlock($i,{key:S.id,comment:S,onReply:c,onLike:a,onDelete:m[0]||(m[0]=w=>u(w)),onEdit:d},null,8,["comment"]))),128))],6),e.createVNode(Vo,{onSendComment:m[1]||(m[1]=S=>l(S))})],14,Ti))}}),es={CopyPlus:Yr,SquarePen:Xo,Trash2:fn},ts=new Map([["file",{name:"File",color:"bg-green-100 text-green-700 border-green-200",icon:_t}],["post",{name:"Post",color:"bg-blue-100 text-blue-700 border-blue-200",icon:ri}],["user",{name:"User",color:"bg-purple-100 text-purple-700 border-purple-200",icon:ii}],["custom",{name:"Custom",color:"bg-gray-100 text-gray-700 border-gray-200",icon:ei}]]);function ns(t){if(t==null||typeof t!="string")return null;const n=t.trim();if(!n)return null;const o=/^([-\d.]+)\s*,\s*([-\d.]+)$/.exec(n);if(o){const a=Number(o[1]),c=Number(o[2]);if(Number.isFinite(a)&&Number.isFinite(c))return{type:"Point",coordinates:[a,c]}}const s=n.indexOf("(");if(s<0)return null;const r=n.slice(0,s).trim().toUpperCase(),i=n.slice(s).replace(/[()]/g,""),l=a=>a.trim().split(/\s+/).map(Number);try{if(r==="POINT"){const a=l(i);return!Number.isFinite(a[0])||!Number.isFinite(a[1])?null:{type:"Point",coordinates:a}}if(r==="LINESTRING"){const a=i.split(",").map(l);return!a.length||a.some(c=>!Number.isFinite(c[0])||!Number.isFinite(c[1]))?null:{type:"LineString",coordinates:a}}if(r==="POLYGON"){const a=i.split(",").map(l);return!a.length||a.some(c=>!Number.isFinite(c[0])||!Number.isFinite(c[1]))?null:{type:"Polygon",coordinates:[a]}}}catch{return null}return null}function os(t){if(t==null||typeof t!="string")return!1;const n=t.trim().toUpperCase();return n.startsWith("POINT(")||n.startsWith("LINESTRING(")||n.startsWith("POLYGON(")}function ss(t){if(!t)return null;let n=1/0,o=1/0,s=-1/0,r=-1/0;const i=a=>{if(typeof a[0]=="number"){const[c,d]=a;n=Math.min(n,c),o=Math.min(o,d),s=Math.max(s,c),r=Math.max(r,d);return}a.forEach(c=>i(c))},l=t.coordinates;return!l||(i(l),n===1/0||o===1/0)?null:[n,o,s,r]}function Ai(t,n){return t?n?[Math.min(t[0],n[0]),Math.min(t[1],n[1]),Math.max(t[2],n[2]),Math.max(t[3],n[3])]:t:n}function un(t){if(!t)return[];const n=t.coordinates;if(!n)return[];if(t.type==="Point")return[n];if(t.type==="LineString")return n;if(t.type==="Polygon"){const o=n[0]??[];if(o.length<2)return o;const s=o[0],r=o[o.length-1],i=1e-8;return Math.abs(s[0]-r[0])<i&&Math.abs(s[1]-r[1])<i?o.slice(0,-1):o}return[]}const mn=1e-8;function Di(t,n){const o=un(t),s=un(n);if(!o.length&&!s.length)return 0;if(!o.length)return s.length;if(!s.length)return o.length;const r=(d,u)=>Math.abs(d[0]-u[0])<mn&&Math.abs(d[1]-u[1])<mn,i=new Set,l=new Set;for(let d=0;d<o.length;d++)for(let u=0;u<s.length;u++)if(r(o[d],s[u])){i.add(d),l.add(u);break}const a=o.length-i.size,c=s.length-l.size;return Math.max(a,c)}function Ii(t,n){const o=un(t),s=un(n),r=(d,u)=>Math.abs(d[0]-u[0])<mn&&Math.abs(d[1]-u[1])<mn,i=new Set,l=new Set;for(let d=0;d<o.length;d++)for(let u=0;u<s.length;u++)if(r(o[d],s[u])){i.add(d),l.add(u);break}const a=o.filter((d,u)=>!i.has(u)),c=s.filter((d,u)=>!l.has(u));return{removed:a,added:c}}function rs(t){return t?{type:"FeatureCollection",features:[{type:"Feature",geometry:t}]}:null}function is(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 Oi(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 Mi="https://unpkg.com/imask@7.6.1/dist/imask.min.js";let qn=null;function Fi(){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 Pi(){return qn||(qn=is(Mi).then(()=>{const t=Fi();if(!t)throw new Error("IMask is not available after loading the script");return t})),qn}function Ri(){return typeof window>"u"?"":window.location?.origin??""}function ls(){if(!(typeof window>"u"))return window.maplibregl}const as=Symbol("vs-widget-map");function Kn(t){if(t==null||t==="")return"";if(typeof t=="object")try{return JSON.stringify(t)}catch{return""}return String(t)}function zi(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 ji(t){return typeof t=="string"?document.getElementById(t):"value"in t?t.value??null:t}function Gn(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=Ri(),i=s.replace(/^\/+/,"");return r?`${r}/${i}`:i?`/${i}`:""}function Hi(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 Ui(t){return t.sourceLayer||t.layer||t.service_layer||t.service_key||t.map_key||t.dataset?.layer||t.id?.toString()}function hn(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 cs=["#1d4ed8","#db2777","#059669","#f97316","#0ea5e9","#d946ef","#facc15","#14b8a6","#e11d48","#16a34a"];function Wi(t){const n=t?.color??cs[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)}):cs.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 Wt="map-highlight-source",qi="map-highlight-fill",Ki="map-highlight-line";function Gi(t){return t?typeof t.toJSON=="function"?t.toJSON():t.geometry?{type:"Feature",geometry:t.geometry,properties:t.properties??{}}:null:null}function ds(t,n){return t?t.replace(/\{([^}]+)\}/g,(o,s)=>{const r=n?.[s];return r==null?"":String(r)}):""}async function Zi(){return Oi("https://unpkg.com/maplibre-gl@^5.6.2/dist/maplibre-gl.css"),await is("https://unpkg.com/maplibre-gl@^5.6.2/dist/maplibre-gl.js"),ls()}function gn(t){const n=e.inject(as,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 u=t.style??null,p=null;const m=h=>{h&&(o.value?o.value.setStyle(h):u=h)},S=()=>{r.value.overlays=l.value.map(h=>({id:h.id,name:h.config.name,visible:h.visible}))},w=h=>{const j=Array.isArray(h)?h:[];i.value=j,j.some($=>$.key===r.value.selectedBasemap)||(r.value.selectedBasemap=j[0]?.key??"")},g=h=>{h&&l.value.forEach(j=>{j.layerIds.forEach(b=>{h.getLayer(b)&&h.removeLayer(b)}),h.getSource(j.sourceId)&&h.removeSource(j.sourceId),j.layerIds=[]})},x=()=>{const h=o.value;!h||typeof h.isStyleLoaded!="function"||!h.isStyleLoaded()||(l.value.forEach(j=>{_(h,j)}),H())},_=(h,j)=>{const b=Hi(j.config);b==="vtile"?N(h,j):b==="raster"&&W(h,j)},W=(h,j)=>{const b=j.config,$=j.sourceId,O=Gn(b.url);if(!O)return;h.getSource($)||h.addSource($,{type:"raster",tiles:[O],minzoom:b.minzoom??0,maxzoom:b.maxzoom??24});const P=`${j.id}-raster`;h.getLayer(P)||h.addLayer({id:P,type:"raster",source:$,layout:{visibility:j.visible?"visible":"none"}}),j.layerIds=[P],C(h,j)},N=(h,j)=>{const b=j.config,$=j.sourceId,O=Gn(b.url);if(!O)return;h.getSource($)||h.addSource($,{type:"vector",tiles:[O],minzoom:b.minzoom??0,maxzoom:b.maxzoom??24});const P=b.style??{},Z=Wi(P),X=[],se={visibility:j.visible?"visible":"none"},ie=Ui(b),pe={source:$,layout:se};if(ie&&(pe["source-layer"]=ie),(P.type??"polygon").toLowerCase()==="point"){const Ee=`${j.id}-circle`;h.getLayer(Ee)||h.addLayer({id:Ee,type:"circle",...pe,paint:{"circle-color":Z,"circle-opacity":P.opacity??1,"circle-radius":P.radius??P.width??3,"circle-stroke-color":P.stroke??P.color??"#ffffff","circle-stroke-width":P.width??1}}),X.push(Ee);const Te=P.text??P.label;if(Te){const nt=`${j.id}-symbol`,an=hn(P.textSize)??10,zt=P.textHaloColor??P.stroke??"#ffffff",jt=hn(P.textHaloWidth)??1,xt=hn(P.textZoom??P.pointZoom),Nt={"text-color":P.textColor??"#000000","text-halo-color":zt,"text-halo-width":jt},ut={id:nt,type:"symbol",...pe,layout:{"text-field":["coalesce",["get",Te],""],"text-size":an,"text-anchor":"top"},paint:Nt};xt!=null&&(ut.minzoom=xt),h.getLayer(nt)||h.addLayer(ut),X.push(nt)}}else{const Ee=`${j.id}-fill`;h.getLayer(Ee)||h.addLayer({id:Ee,type:"fill",...pe,paint:{"fill-color":Z,"fill-opacity":P.opacity??.5,"fill-outline-color":P.stroke??P.color??"#0ea5e9"}}),X.push(Ee);const Te=`${j.id}-line`;h.getLayer(Te)||h.addLayer({id:Te,type:"line",...pe,paint:{"line-color":P.stroke??P.color??"#0b74c4","line-width":hn(P.width??P.border)??1,"line-opacity":P.opacity??1}}),X.push(Te)}j.layerIds=X,C(h,j)},C=(h,j)=>{const b=j.visible?"visible":"none";j.layerIds.forEach($=>{h.getLayer($)&&h.setLayoutProperty($,"visibility",b)})},T=h=>{const j=Array.isArray(h)?h:[];g(o.value??void 0),d.value=null,I();const b=j.map(($,O)=>{if(!$)return null;const P=Gn($.url);if(!P)return null;const Z=$.id!=null?String($.id):`overlay-${O}`;return{id:Z,config:{...$,id:Z,url:P},visible:!1,sourceId:`${Z}-source`,layerIds:[]}}).filter($=>!!$);l.value=b,S(),x()},v=(h,j)=>{const b=l.value.find(O=>O.id===h);if(!b)return;b.visible=j,S();const $=o.value;if(!(!$||typeof $.isStyleLoaded!="function"||!$.isStyleLoaded())){if(!b.layerIds.length){_($,b);return}C($,b)}},E=()=>{a.value&&(a.value.remove(),a.value=null)},y=(h,j={})=>!Array.isArray(h.popup)||!h.popup.length?[]:h.popup.map(b=>({label:b.label??b.field,value:Kn(j?.[b.field])})).filter(b=>b.label&&b.value!==void 0),D=h=>{const j=o.value;if(!j||!h?.point)return;const b=j.queryRenderedFeatures(h.point);for(const $ of b){const O=$.layer?.id??$.sourceLayer;if(!O)continue;const P=je(O);if(!P)continue;const Z=y(P,$.properties??$.layer?.properties??{});if(!Z.length)continue;const X=zi(Z),se=ls();if(!se)return;const ie=h.lngLat;if(c.value===O&&a.value){a.value.setLngLat(ie),a.value.setHTML(X);return}c.value=O,E(),a.value=new se.Popup({closeButton:!1,closeOnClick:!1}).setLngLat(ie).setHTML(X).addTo(j);return}c.value=null,E()},R=()=>{c.value=null,E()},H=()=>{const h=o.value;!h||typeof h.isStyleLoaded!="function"||!h.isStyleLoaded()||h.getSource(Wt)||(h.addSource(Wt,{type:"geojson",data:{type:"FeatureCollection",features:[]}}),h.addLayer({id:qi,type:"fill",source:Wt,paint:{"fill-color":"#2563eb","fill-opacity":.35}}),h.addLayer({id:Ki,type:"line",source:Wt,paint:{"line-color":"#1d4ed8","line-width":2}}))},K=h=>{const j=o.value;if(!j||typeof j.isStyleLoaded!="function"||!j.isStyleLoaded())return;H();const b=j.getSource(Wt);if(!(!b||typeof b.setData!="function")){if(!h){b.setData({type:"FeatureCollection",features:[]});return}b.setData({type:"FeatureCollection",features:[h]})}},G=h=>{const j=Gi(h);j&&K(j)},I=()=>{K(null)},z=()=>{d.value=null,I()},B=h=>{if(h)return typeof h=="string"?h:h.field??h.name??h.key??h.label},q=h=>{if(h)return typeof h=="string"?h:h.label??h.title??h.field??h.name},ee=(h,j)=>!h||!h.length?[]:h.map(b=>{const $=B(b);if(!$)return null;const O=q(b),P=Kn(j?.[$]);return!O||P===""?null:{label:O,value:P}}).filter(b=>!!b),Be=(h,j)=>!Array.isArray(h)||!h.length?[]:h.map(b=>{if(!b?.name)return null;const $=b.title??b.name,O=Kn(j?.[b.name]);return!$||O===""?null:{label:$,value:O}}).filter(b=>!!b),me=(h,j)=>!Array.isArray(h)||!h.length?[]:h.map($=>{const O=ds($.url,j),P=$.label??$.url;return O?{label:P,url:O,target:$.target}:null}).filter($=>!!$),he=async(h,j)=>{const b=ds(h,j);if(!b)return null;try{const $=await fetch(b);return $.ok?await $.json():null}catch{return null}},$e=async(h,j)=>{const b=j.properties??j.layer?.properties??{},$=ee(h.card?.rows,b);let O,P;if(h.card?.api){const se=await he(h.card.api,b);se&&(typeof se.html=="string"&&se.html.trim()&&(O=se.html),Array.isArray(se.columns)&&se.columns.length&&(P=se.columns))}let Z=$;if(!O&&P){const se=Be(P,b);se.length&&(Z=se)}if(!Z.length&&!O)return null;const X=me(h.card?.actions,b);return{title:b?.name??h.name,rows:Z,html:O,actions:X.length?X:void 0}},pt=async h=>{const j=o.value;if(!j||!h?.point)return;const b=j.queryRenderedFeatures(h.point);for(const $ of b){const O=$.layer?.id??$.sourceLayer;if(!O)continue;const P=je(O);if(!P||!P.card)continue;const Z=await $e(P,$);if(Z){d.value=Z,G($);return}}d.value=null,I()},wt=()=>{const h=o.value;h&&(h.on("mousemove",D),h.on("mouseleave",R),h.on("click",pt))},Pe=()=>{const h=o.value;h&&(h.off("mousemove",D),h.off("mouseleave",R),h.off("click",pt),E(),I())},je=h=>{if(h)return l.value.find(j=>j.layerIds.includes(h))?.config},tt=async()=>{const h=await Zi(),j=ji(t.container);if(!h||!j)return;const b={container:j,center:t.center??[30.524,50.45],zoom:t.zoom??10,style:u??t.style??{version:8,sources:{},layers:[]},attributionControl:!1,...t.mapOptions};o.value=new h.Map(b);const $=()=>{x()};p=$,o.value.on("style.load",$),o.value.on("load",()=>{s.value=!0,u&&o.value&&(o.value.setStyle(u),u=null),x(),wt()})};e.onMounted(tt),e.onBeforeUnmount(()=>{Pe(),o.value&&p&&o.value.off("style.load",p),g(o.value??void 0),o.value?.remove(),o.value=null,s.value=!1});const Ke={map:o,ready:s,setStyle:m,flyTo:h=>o.value?.flyTo(h),fitBounds:(h,j)=>o.value?.fitBounds(h,j),setCenter:h=>o.value?.setCenter(h),setZoom:h=>o.value?.setZoom(h),addControl:(h,j)=>o.value?.addControl(h,j),removeControl:h=>o.value?.removeControl(h),on:(h,...j)=>o.value?.on(h,...j),off:(h,...j)=>o.value?.off(h,...j),project:h=>o.value?.project(h),unproject:h=>o.value?.unproject(h),state:r,basemapOptions:i,setOverlays:T,toggleOverlay:v,getOverlayConfig:je,selectedCard:d,setBasemapOptions:w,clearCard:z};return e.provide(as,Ke),Ke}const Yi={class:"map-base-layer-menu"},Ji={key:1,class:"z-[500] bg-white absolute top-[10px] right-[10px] p-1.5 border rounded-lg text-sm cursor-pointer layers-button"},Xi={class:"flex items-center justify-between p-2 border-b"},Qi={class:"p-2 border-b"},Vi={class:"flex items-center"},el=["value","checked","onChange"],tl={class:"ml-2"},nl={class:"p-2"},ol={class:"flex items-center"},sl=["checked"],rl=["checked","onChange"],il={class:"ml-2"},ll=e.defineComponent({__name:"LayerMenu",setup(t){const{state:n,basemapOptions:o,setBasemap:s,toggleGeometry:r,toggleOverlay:i}=gn(),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??""),u=e.computed(()=>n.value.geometryVisible??!0),p=e.computed(()=>n.value.overlays??[]),m=g=>{s?.(g)},S=()=>{r?.(!u.value)},w=g=>{i?.(g.id,!g.visible)};return(g,x)=>(e.openBlock(),e.createElementBlock("div",Yi,[l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,onClick:x[0]||(x[0]=_=>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",Ji,[e.createElementVNode("div",Xi,[x[3]||(x[3]=e.createElementVNode("div",null,"Шари",-1)),e.createElementVNode("button",{type:"button",class:"text-gray-500 hover:text-gray-800",onClick:x[1]||(x[1]=_=>l.value=!1)},[...x[2]||(x[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",Qi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,_=>(e.openBlock(),e.createElementBlock("div",{key:_.key},[e.createElementVNode("label",Vi,[e.createElementVNode("input",{type:"radio",name:a,value:_.key,checked:d.value===_.key,onChange:W=>m(_.key)},null,40,el),e.createElementVNode("span",tl,e.toDisplayString(_.name||_.key),1)])]))),128))]),e.createElementVNode("div",nl,[e.createElementVNode("label",ol,[e.createElementVNode("input",{type:"checkbox",checked:u.value,onChange:S},null,40,sl),x[4]||(x[4]=e.createElementVNode("span",{class:"ml-2"},"Геометрія/Межі",-1))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,_=>(e.openBlock(),e.createElementBlock("label",{class:"flex items-center",key:_.id},[e.createElementVNode("input",{type:"checkbox",checked:_.visible,onChange:W=>w(_)},null,40,rl),e.createElementVNode("span",il,e.toDisplayString(_.name||_.id),1)]))),128))])])):e.createCommentVNode("",!0)]))}}),al={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]"},cl={class:"leading-tight"},dl=e.defineComponent({__name:"Legend",props:{items:{}},setup(t){return(n,o)=>t.items.length?(e.openBlock(),e.createElementBlock("div",al,[(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",cl,e.toDisplayString(s.label),1)]))),128))])):e.createCommentVNode("",!0)}}),fl={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]"},pl={class:"font-mono"},ul=e.defineComponent({__name:"CursorCoordinates",props:{coordinates:{}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",fl,[e.createElementVNode("span",pl,e.toDisplayString(t.coordinates),1)]))}}),ml={class:"map-search-widget absolute top-[10px] left-[10px] flex flex-col gap-2 rounded-xl widget min-w-[200px]"},hl=["title"],gl={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"},yl=["onClick"],vl=["placeholder"],bl={class:"divide-y divide-gray-100"},kl=["onClick"],El=600,wl="0000000000:00:000:0000",xl=30,Nl=8,Cl="https://data.softpro.ua/api-user/gis-url-proxy",Sl="https://geo.rv.ua/api-user/dzk.api",_l="https://nominatim.openstreetmap.org/search",Bl=e.defineComponent({__name:"MapSearchWidget",props:{config:{}},setup(t){const n=t,o=gn(),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 b=n.config?.tools?.filter($=>l.includes($));return b&&b.length?b:l}),c={here:"Пошук…",xy:`50.4501 30.5234 або 50°27'00"N 30°31'24"E`,parcel:"Пошук…",address:"Пошук…"},d=e.computed(()=>{const b=n.config?.placeholder?.trim();return b||c[u.value]||"Пошук…"}),u=e.ref(a.value[0]);e.watch(a,b=>{b.includes(u.value)||(u.value=b[0])});const p=e.ref(""),m=e.ref(!1),S=e.ref(null),w=e.ref(null),g=e.ref(null),x=e.ref([]),_=e.ref(null),W=e.computed(()=>u.value==="address"&&x.value.length>0);let N=null,C=null,T=null;const v=e.reactive({position:"absolute",left:"0px",top:"0px",width:"100%",display:"none"});function E(){if(!w.value)return;const b=w.value.getBoundingClientRect(),$=b.width+xl,O=b.left+window.scrollX,P=b.bottom+window.scrollY+Nl;v.left=`${O}px`,v.top=`${P}px`,v.width=`${$}px`,v.display="block"}const y=()=>{W.value&&E()};function D(){N&&(clearTimeout(N),N=null)}function R(){C?.destroy(),C=null}async function H(){if(u.value!=="parcel")return;const b=g.value;if(!b)return;const $=await Pi();u.value==="parcel"&&(R(),C=$(b,{mask:wl,lazy:!1,placeholderChar:"_"}),C.on("accept",()=>{p.value=C?.value??""}))}function K(){return(C?.value??p.value).trim()}function G(){if(!(typeof window>"u"))return window.maplibregl}function I(b){const $=o.map.value;if(!$)return;const O=G();if(O){if(T){T.setLngLat([b.lng,b.lat]);return}T=new O.Marker({color:"#2563eb"}).setLngLat([b.lng,b.lat]).addTo($)}}function z(){T&&(T.remove(),T=null)}e.watch(u,b=>{p.value="",m.value=!1,x.value=[],D(),b==="parcel"?e.nextTick(()=>{H().catch($=>{Ce.notify({type:"error",title:"Маска кадастру",message:$?.message||"Не вдалося ініціалізувати маску"})})}):R()}),e.watch(W,b=>{b?e.nextTick(()=>{E()}):v.display="none"}),e.watch(p,b=>{if(u.value!=="address"){x.value=[],D();return}if(!b.trim()){x.value=[],D();return}D(),N=window.setTimeout(()=>{je(b).catch($=>{const O=$?.message||"Помилка пошуку адреси";Ce.notify({type:"error",title:"Пошук адреси",message:O})})},El)});function B(b){u.value=b}function q(b){const $=b.target;if(m.value){const O=S.value;O&&!O.contains($)&&(m.value=!1)}if(W.value){const O=_.value;O&&!O.contains($)&&(x.value=[])}}e.onMounted(()=>{window.addEventListener("click",q,!0),window.addEventListener("scroll",y,!0),window.addEventListener("resize",y),u.value==="parcel"&&e.nextTick(()=>{H().catch(b=>{Ce.notify({type:"error",title:"Маска кадастру",message:b?.message||"Не вдалося ініціалізувати маску"})})})}),e.onBeforeUnmount(()=>{window.removeEventListener("click",q,!0),window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",y),D(),R(),z()});function ee(b){return b==="xy"?"Координати":b==="parcel"?"Кадастр":"Адреси"}const Be=/([+-]?\d{1,3})\s*[°º˚]\s*(\d{1,2})\s*['’′`]\s*(\d{1,2}(?:\.\d+)?)\s*["”″]\s*([NSEW])/gi;function me(b,$){const O=Number(b[1]),P=Number(b[2]),Z=Number(b[3]),X=String(b[4]).toUpperCase();if(!Number.isFinite(O)||!Number.isFinite(P)||!Number.isFinite(Z)||$==="lat"&&!(X==="N"||X==="S")||$==="lng"&&!(X==="E"||X==="W")||P<0||P>59||Z<0||Z>59)return null;const pe=Math.abs(O),He=$==="lat"?90:180;if(pe>He||pe===He&&(P!==0||Z!==0))return null;const Ee=pe+P/60+Z/3600;return X==="S"||X==="W"?-Ee:Ee}function he(b){const $=b.trim();if(!$)return{ok:!1};Be.lastIndex=0;const O=[...$.matchAll(Be)];if(O.length!==2)return{ok:!1};if(Be.lastIndex=0,$.replace(Be," ").replace(/[\s,;]+/g,"").trim().length)return{ok:!1};const Z=me(O[0],"lat"),X=me(O[1],"lng");return!Number.isFinite(Z)||!Number.isFinite(X)?{ok:!1}:{ok:!0,lat:Z,lng:X}}function $e(b){const $=he(b);if($.ok)return $;const O=b.replace(/[,]+/g," ").trim();if(!O)return{ok:!1};const P=O.split(/\s+/).filter(Boolean);if(P.length<2)return{ok:!1};const Z=P.slice(0,2).map(Number);if(!Z.every(Te=>Number.isFinite(Te)))return{ok:!1};let[X,se]=Z,ie=X,pe=se;const He=Te=>Math.abs(Te)<=90,Ee=Te=>Math.abs(Te)<=180;if(!He(ie)||!Ee(pe))if(He(pe)&&Ee(ie))ie=se,pe=X;else return{ok:!1};return{ok:!0,lat:ie,lng:pe}}function pt(b){return(b?.items||[]).map((O,P)=>{const Z=Number(O?.position?.lat),X=Number(O?.position?.lng);return!Number.isFinite(Z)||!Number.isFinite(X)?null:{id:String(O?.id??P),title:O?.title||O?.address?.label||"Знайдений обʼєкт",lat:Z,lng:X}}).filter(O=>!!O)}function wt(b){const $=b?.result||b?.data||b;if(!$)return[];const O=$.geom_centroid;if(!O||!Array.isArray(O.coordinates))return[];const[P,Z]=O.coordinates;return!Number.isFinite(Z)||!Number.isFinite(P)?[]:[{id:"parcel",title:$.cadnum||$.cad_num||"Земельна ділянка",lat:Z,lng:P}]}function Pe(b){return(Array.isArray(b?.features)?b.features:[]).map((O,P)=>{const Z=O?.geometry?.coordinates,X=Number(Z?.[0]),se=Number(Z?.[1]);if(!Number.isFinite(se)||!Number.isFinite(X))return null;const ie=O?.properties||{},pe=ie?.geocoding?.label||ie?.display_name||ie?.label||"Адреса";return{id:String(ie?.geocoding?.place_id||ie?.place_id||P),title:pe,lat:se,lng:X}}).filter(O=>!!O)}async function je(b){x.value=[],D();const $=new URL(_l);$.searchParams.set("format","geojson"),$.searchParams.set("q",b),$.searchParams.set("addressdetails","1"),$.searchParams.set("bounded","1");const O=r();O&&$.searchParams.set("viewbox",O);const P=await fetch($.toString());if(!P.ok)throw new Error(`HTTP ${P.status}`);const Z=await P.json(),X=Pe(Z);if(!X.length){Ce.notify({type:"warning",title:"Пошук адреси",message:"Не знайдено результатів"});return}x.value=X}function tt(b){h(b),x.value=[],p.value=""}function Ke(b){const O=b.replace(/\s+/g,"").split(":");if(O.length!==4)return!1;const P=[10,2,3,4];return O.every((Z,X)=>Z.length===P[X]&&/^\d+$/.test(Z))}function h(b){const $=n.config?.zoom??17;o.flyTo?.({center:[b.lng,b.lat],zoom:$}),I(b)}async function j(){const b=u.value==="parcel"?K():p.value.trim();if(b){if(u.value==="xy"){const $=$e(b);if(!$.ok){Ce.notify({type:"warning",title:"Пошук координат",message:"Використайте `lat lon` або DMS у форматі `50°27'00\"N 30°31'24\"E`."});return}h($),p.value="";return}if(u.value==="address"){try{await je(b)}catch($){const O=$?.message||"Помилка пошуку адреси";Ce.notify({type:"error",title:"Пошук адреси",message:O})}return}try{const $=new URL(u.value==="here"?Cl:Sl);if(u.value==="here")$.searchParams.set("searchtext",b);else{if(!Ke(b)){Ce.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}$.searchParams.set("cad_num",b)}const O=await fetch($.toString());if(!O.ok)throw new Error(`HTTP ${O.status}`);const P=await O.json(),Z=u.value==="here"?pt(P):wt(P);if(!Z.length)Ce.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const X=Z[0];h(X),u.value==="parcel"&&C&&(C.value=""),p.value=""}}catch($){const O=$?.message||"Помилка пошуку";Ce.notify({type:"error",title:"Пошук",message:O})}}}return(b,$)=>(e.openBlock(),e.createElementBlock("div",ml,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(j,["prevent"])},[a.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:S,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:$[0]||($[0]=O=>m.value=!m.value)},[e.createElementVNode("span",{class:"block w-full truncate",title:ee(u.value)},e.toDisplayString(ee(u.value)),9,hl),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":m.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[...$[3]||($[3]=[e.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))]),m.value?(e.openBlock(),e.createElementBlock("div",gl,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,O=>(e.openBlock(),e.createElementBlock("li",{key:O,class:"px-3 py-2 cursor-pointer hover:bg-gray-100 text-gray-900",onClick:P=>B(O)},e.toDisplayString(ee(O)),9,yl))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"searchWrapperRef",ref:w,class:"relative flex-1 min-w-[140px] bg-white rounded-md"},[u.value==="parcel"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"parcelInputRef",ref:g,"onUpdate:modelValue":$[1]||($[1]=O=>p.value=O),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,p.value,void 0,{trim:!0}]]):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,"onUpdate:modelValue":$[2]||($[2]=O=>p.value=O),placeholder:d.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,vl)),[[e.vModelText,p.value,void 0,{trim:!0}]]),$[4]||($[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)),W.value?(e.openBlock(),e.createBlock(e.Teleport,{key:2,to:"body"},[e.createElementVNode("div",{ref_key:"addressResultsRef",ref:_,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(v)},[e.createElementVNode("ul",bl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,O=>(e.openBlock(),e.createElementBlock("li",{key:O.id,class:"px-3 py-2 cursor-pointer hover:bg-gray-50",onClick:P=>tt(O)},e.toDisplayString(O.title),9,kl))),128))])],4)])):e.createCommentVNode("",!0)],512)],32)]))}}),$l={class:"map-center-control"},Tl=["aria-label"],Ll=e.defineComponent({directives:{tooltip:Ce.TooltipDirective},__name:"MapCenterControl",props:{center:{},zoom:{},targetCenter:{},targetZoom:{},targetLabel:{},targetAriaLabel:{}},setup(t){const n=t,{map:o,ready:s}=gn(),r=e.ref(null),i=e.ref(null),l=e.ref(null),a=e.ref(null);function c(w){if(Array.isArray(w)&&w.length>=2){const[g,x]=w.slice(0,2).map(_=>Number(_));return Number.isNaN(g)||Number.isNaN(x)?null:[g,x]}if(w&&typeof w=="object"){const g=w,x=g.lng??g.lon??g.long??g.x,_=g.lat??g.y;if(x!=null&&_!=null){const W=Number(x),N=Number(_);if(!Number.isNaN(W)&&!Number.isNaN(N))return[W,N]}}if(typeof w=="string"){const g=w.split(",").map(x=>Number(x.trim()));if(g.length>=2&&g.every(x=>!Number.isNaN(x)))return[g[0],g[1]]}return null}e.watch(()=>n.center,w=>{const g=c(w);g&&(r.value=g)},{immediate:!0}),e.watch(()=>n.zoom,w=>{const g=Number(w);Number.isNaN(g)||(i.value=g)},{immediate:!0}),e.watch(()=>n.targetCenter,w=>{l.value=c(w)},{immediate:!0}),e.watch(()=>n.targetZoom,w=>{const g=Number(w);a.value=Number.isNaN(g)?null:g},{immediate:!0});const d=e.computed(()=>n.targetLabel?.trim()||"Точка"),u=e.computed(()=>n.targetAriaLabel||"Перейти до точки"),p=e.computed(()=>!!l.value);e.onMounted(async()=>{const w=o.value;if(w){if(!r.value){const g=w.getCenter();r.value=[g.lng,g.lat]}i.value==null&&(i.value=w.getZoom())}});function m(){const w=o.value;if(!w)return;const g=r.value||(()=>{const _=w.getCenter();return[_.lng,_.lat]})(),x=i.value??w.getZoom();w.flyTo({center:g,zoom:x})}function S(){const w=o.value;if(!w||!l.value)return;const g=a.value??i.value??w.getZoom();w.flyTo({center:l.value,zoom:g})}return(w,g)=>{const x=e.resolveDirective("tooltip");return e.openBlock(),e.createElementBlock("div",$l,[p.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(m,["stop"])},[e.createVNode(e.unref(ti),{class:"w-4 h-4"})])),[[x,"Центр мапи"]]),p.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":u.value,onClick:e.withModifiers(S,["stop"])},[e.createVNode(e.unref(oi),{class:"w-4 h-4"})],8,Tl)),[[x,d.value]]):e.createCommentVNode("",!0)])}}}),Xe=(t,n)=>{const o=t.__vccOpts||t;for(const[s,r]of n)o[s]=r;return o},fs=Xe(Ll,[["__scopeId","data-v-73fcd71f"]]),Al={key:1,class:"absolute bottom-[50px] right-[10px] flex flex-col items-center gap-2 pointer-events-none z-[520]"},Dl={key:0,class:"flex flex-col items-center gap-2 pointer-events-auto"},Il=["aria-label"],Ol={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)]"},Ml={class:"text-slate-900 font-semibold mb-1"},Fl=["innerHTML"],Pl={key:1,class:"space-y-2"},Rl={class:"text-gray-500"},zl={class:"font-medium text-slate-900"},jl={key:2,class:"mt-2 flex flex-col gap-2"},Hl=["href","target"],mt="map-basemap-source",qt="map-basemap-layer",Ul=20,Bt="map-katottg-geometry-source",yn="map-katottg-geometry-line",rt="map-geometry-source",$t="map-geometry-fill",Tt="map-geometry-line",Lt="map-geometry-circle",Kt="map-highlight-points-source",Zn="map-highlight-points-layer",At=e.defineComponent({__name:"MapWidget",props:{height:{default:350},center:{},zoom:{},geom:{},bounds:{},highlightPoints:{},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(f){if(f){if(Array.isArray(f)&&f.length>=2){const F=Number(f[0]),U=Number(f[1]);return!Number.isFinite(F)||!Number.isFinite(U)?void 0:[F,U]}if(typeof f=="object"){const F=f,U=F.lng??F.lon??F.long??F.x,Y=F.lat??F.y;if(U!=null&&Y!=null){const ye=Number(U),Ue=Number(Y);if(Number.isFinite(ye)&&Number.isFinite(Ue))return[ye,Ue]}}}}function a(f){if(f==null)return;const F=Number(f);return Number.isFinite(F)?F:void 0}const c=()=>typeof window>"u"?"":window.location?.origin??"",d=f=>{if(!f)return"";const F=f.trim();if(!F)return"";const Y=F.replace(/\n/g,"").replace(/\r/g,"").replace(/\t/g,"").replace(/\s+/g,"");if(!Y)return"";if(/^https?:\/\//i.test(Y))return Y;const ye=c(),Ue=Y.replace(/^\/+/,"");return ye?`${ye}/${Ue}`:Ue?`/${Ue}`:""},u=e.computed(()=>n.katottg!=null?n.katottg:i.katottg),p=e.computed(()=>(Array.isArray(i.basemaps)&&i.basemaps.length?i.basemaps:o).map((U,Y)=>{const ye=typeof U.url=="string"?U.url.trim():"";return ye?{key:(U.key??U.name??`base-${Y}`).trim()||`base-${Y}`,url:ye,name:U.name??U.key??`Layer ${Y+1}`}:null}).filter(U=>!!U)),m=l(i.center),S=a(i.zoom),w=Wo(n.geom),g=Fr(w),x=g?[(g[0]+g[2])/2,(g[1]+g[3])/2]:void 0,_=e.ref(null),W=e.computed(()=>l(n.center)??null),N=e.computed(()=>W.value??m??null),C=f=>f?{version:8,sources:{[mt]:{type:"raster",tiles:[f],tileSize:256}},layers:[{id:qt,type:"raster",source:mt,layout:{visibility:"visible"}}]}:{version:8,sources:{},layers:[]},T=d(p.value[0]?.url),v=gn({container:_,center:x??N.value??void 0,zoom:n.zoom??S,style:C(T)}),{map:E,setCenter:y,setZoom:D,state:R,getOverlayConfig:H,selectedCard:K,setBasemapOptions:G,clearCard:I,addControl:z,removeControl:B,ready:q}=v,ee=e.computed({get:()=>R.value.selectedBasemap??"",set:f=>{R.value.selectedBasemap=f}}),Be=e.computed({get:()=>R.value.geometryVisible??!0,set:f=>{R.value.geometryVisible=f}}),me=e.computed(()=>{const f=n.height;return{height:typeof f=="number"?`${f}px`:String(f)}}),he=e.ref(!1),$e=e.ref(!1),pt=e.computed(()=>he.value?"!fixed inset-0 w-screen h-screen z-[9999] bg-white":"relative w-full"),wt=e.computed(()=>{const f=["w-full","h-full"];return he.value||f.push(`min-h-[${me.value.height}]`),f.join(" ")}),Pe=e.computed(()=>K.value),je=()=>I?.(),tt=e.ref(x??N.value??null),Ke=e.ref(n.zoom??S??null),h=e.ref(N.value);e.watch(N,f=>{h.value=f},{immediate:!0});const j=e.computed(()=>h.value??null),b=e.computed(()=>typeof n.zoom=="number"?n.zoom:typeof Ke.value=="number"?Ke.value:Ul),$=["home","fullscreen","scale","position","search"],O=e.computed(()=>!Array.isArray(n.tools)||!n.tools.length?$:n.tools.filter(f=>$.includes(f))),P=f=>O.value.includes(f);e.watch([E,q],([f,F])=>{if(!(!f||!F)){if(!tt.value){const U=f.getCenter();tt.value=[U.lng,U.lat]}Ke.value==null&&(Ke.value=f.getZoom())}},{immediate:!0});const Z=e.ref(null),X=e.ref(""),se=e.ref(null),ie=f=>f?$e.value?!0:typeof f.isStyleLoaded=="function"&&f.isStyleLoaded()?($e.value=!0,!0):!1:!1,pe=f=>{if(!f)return"";const F=Number(f.lat??f[1]),U=Number(f.lng??f[0]);return!Number.isFinite(F)||!Number.isFinite(U)?"":`${U.toFixed(5)}, ${F.toFixed(5)}`},He=f=>{f?.lngLat&&(X.value=pe(f.lngLat))},Ee=()=>{X.value=""},Te=f=>{f&&(f.on("mousemove",He),f.on("mouseleave",Ee),se.value=f)},nt=f=>{f&&(f.off("mousemove",He),f.off("mouseleave",Ee),se.value=null)},an=e.computed(()=>P("scale"));e.watch([E,q],([f,F],[U])=>{U&&nt(U),!(!f||!F)&&Te(f)},{immediate:!0}),e.watch([E,q,an],([f,F,U])=>{if(Z.value&&B&&(B(Z.value),Z.value=null),!f||!F||!U)return;const Y=window?.maplibregl;Y&&(Z.value=new Y.ScaleControl({unit:"metric"}),z?.(Z.value,"bottom-left"))},{immediate:!0});const zt=e.computed(()=>Array.isArray(n.legend)?n.legend.map((f,F)=>{const U=typeof f?.color=="string"?f.color.trim():"",Y=typeof f?.label=="string"?f.label.trim():"";return!U||!Y?null:{color:U,label:Y,key:`${Y}-${F}`}}).filter(f=>!!f):[]),jt=e.computed(()=>Array.isArray(n.layers)&&n.layers.length?n.layers:Array.isArray(i.layers)&&i.layers.length?i.layers:[]);e.watch(p,f=>{if(G?.(f),!f.length){ee.value="";return}f.some(F=>F.key===ee.value)||(ee.value=f[0].key)},{immediate:!0});const xt=f=>{if(!f?.getStyle)return;const F=f.getStyle()??{},U=Array.isArray(F.layers)?F.layers:[];return U.length?U.find(ye=>ye.type!=="background")?.id??U[0]?.id:void 0},Nt=f=>{f&&(f.getLayer(qt)&&f.removeLayer(qt),f.getSource(mt)&&f.removeSource(mt))},ut=(f,F)=>{if(!f)return;const U=xt(f);f.addSource(mt,{type:"raster",tiles:[F],tileSize:256}),f.addLayer({id:qt,type:"raster",source:mt,layout:{visibility:"visible"}},U)},jo=f=>{if(!f)return;const F=d(f.url);if(!F){ot.value=null;return}ot.value=F,Nt(E.value),L()},ot=e.ref(null),k=e.ref(T||null),M=f=>{if(!f||f.__pendingBasemapHooked)return;f.__pendingBasemapHooked=!0;const F=()=>{f.__pendingBasemapHooked=!1,L()};f.once("style.load",F),f.once("styledata",F)},L=()=>{const f=E.value,F=ot.value;if(!(!F||!f)){if(!ie(f)){M(f);return}if(k.value===F&&f.getSource(mt)&&f.getLayer(qt)){ot.value=null;return}Nt(f),ut(f,F),k.value=F,ot.value=null}},A=()=>{const f=ee.value;if(!f)return;const F=p.value.find(U=>U.key===f);F&&jo(F)};e.watch(ee,()=>{A()},{immediate:!0}),e.watch(jt,f=>{v.setOverlays?.(f)},{immediate:!0,deep:!0});const J=e.ref(null);let le=0;const ne=e.computed(()=>Wo(J.value)),Ne={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}},st={"line-color":"#1d4ed8","line-width":2,"line-dasharray":[6,4]},re=e.ref(w),Ye=e.ref(g),ge=e.ref(!1),Je=e.computed(()=>{if(!Ye.value)return null;const[f,F,U,Y]=Ye.value;return[(f+U)/2,(F+Y)/2]}),Ht=e.computed(()=>!!Ye.value),Re=e.ref(!!g);e.ref(!1);const Ho=()=>{he.value=!he.value},Ge=e.ref(!1),Un=()=>{const f=E.value;if(!f||!ie(f))return;const F=re.value;if(!F){tm(f),Ir(f),cn();return}Dr(f);let U=f.getSource(rt);U?U.setData(F):(f.addSource(rt,{type:"geojson",data:F}),em(f),U=f.getSource(rt)),Or(f,Be.value?"visible":"none"),nm(),cn();const Y=n.bounds??Ye.value;if(Y){const ye=[[Y[0],Y[1]],[Y[2],Y[3]]],Ue=!!n.bounds;!Ge.value&&(Ue||!Re.value&&(ge.value||!0))?(typeof f.resize=="function"&&f.resize(),f.fitBounds(ye,{padding:20,maxZoom:18,duration:0}),Ge.value=!0,ge.value=!1,Re.value&&(Re.value=!1)):Re.value&&(Re.value=!1,ge.value=!1,Ge.value=!0)}},em=f=>{const F=Ne;f.getLayer($t)||f.addLayer({id:$t,type:"fill",source:rt,paint:F.fill}),f.getLayer(Tt)||f.addLayer({id:Tt,type:"line",source:rt,paint:F.line}),f.getLayer(Lt)||f.addLayer({id:Lt,type:"circle",source:rt,paint:F.circle,filter:["==","$type","Point"]})},tm=f=>{[Lt,Tt,$t].forEach(F=>{f.getLayer(F)&&f.removeLayer(F)}),f.getSource(rt)&&f.removeSource(rt)},Dr=f=>{const F=n.highlightPoints;if(!F?.length){Ir(f);return}const U={type:"FeatureCollection",features:F.map(ye=>({type:"Feature",geometry:{type:"Point",coordinates:ye},properties:{}}))};let Y=f.getSource(Kt);Y?Y.setData(U):(f.addSource(Kt,{type:"geojson",data:U}),f.addLayer({id:Zn,type:"circle",source:Kt,paint:{"circle-radius":4,"circle-color":"#dc2626","circle-stroke-color":"#fff","circle-stroke-width":2}}))},Ir=f=>{f.getLayer(Zn)&&f.removeLayer(Zn),f.getSource(Kt)&&f.removeSource(Kt)},Or=(f,F)=>{ie(f)&&[Lt,Tt,$t].forEach(U=>{f.getLayer(U)&&f.setLayoutProperty(U,"visibility",F)})},nm=()=>{const f=E.value;if(!f||!ie(f))return;const F=Ne;f.getLayer($t)&&Object.entries(F.fill).forEach(([U,Y])=>{f.setPaintProperty($t,U,Y)}),f.getLayer(Tt)&&Object.entries(F.line).forEach(([U,Y])=>{f.setPaintProperty(Tt,U,Y)}),f.getLayer(Lt)&&Object.entries(F.circle).forEach(([U,Y])=>{f.setPaintProperty(Lt,U,Y)})},Mr=f=>{f.getLayer(yn)||f.addLayer({id:yn,type:"line",source:Bt,layout:{visibility:"visible"},paint:st})},cn=()=>{const f=E.value;if(!f||!ie(f))return;const F=ne.value??{type:"FeatureCollection",features:[]};if(!f.getSource(Bt)){f.addSource(Bt,{type:"geojson",data:F}),Mr(f);return}const U=f.getSource(Bt);U&&typeof U.setData=="function"&&U.setData(F),Mr(f)},om=f=>{f.getLayer(yn)&&f.removeLayer(yn),f.getSource(Bt)&&f.removeSource(Bt)},sm=async f=>{const F=typeof f=="string"?f.trim():"",U=++le;if(!F){J.value=null;return}try{const Y=await fetch(`https://data.gki.com.ua/api-user/atu/${F}`);if(le!==U)return;if(!Y.ok){J.value=null;return}const ye=await Y.json();if(le!==U)return;J.value=ye}catch{if(le!==U)return;J.value=null}};e.watch(u,f=>{sm(f)},{immediate:!0}),e.watch(ne,()=>{cn()},{immediate:!0}),e.watch(()=>n.geom,f=>{re.value=Wo(f),Ye.value=Fr(re.value),Je.value&&(tt.value=Je.value),Ge.value=!1,ge.value=!0,Un()},{deep:!0,immediate:!0}),e.watch(()=>n.bounds,()=>{n.bounds&&(Ge.value=!1,ge.value=!0,Un())},{deep:!0}),e.watch(()=>n.highlightPoints,()=>{const f=E.value;f&&ie(f)&&Dr(f)},{deep:!0}),e.watch(Be,()=>{const f=E.value;f&&ie(f)&&Or(f,Be.value?"visible":"none")});const Ct=()=>{$e.value=!0,Un(),cn(),L()},Uo=()=>{Un(),cn()};e.watch(E,(f,F)=>{F&&(F.off("style.load",Ct),F.off("load",Ct),F.off("idle",Uo)),$e.value=!1,f&&(f.on("load",Ct),f.on("style.load",Ct),f.on("idle",Uo),typeof f.isStyleLoaded=="function"&&f.isStyleLoaded()&&Ct())}),e.watch(W,f=>{!E.value||!f||Ht.value||y(f)}),e.watch(()=>n.zoom,f=>{!E.value||typeof f!="number"||D(f)}),e.onBeforeUnmount(()=>{Z.value&&B&&B(Z.value),se.value?nt(se.value):E.value&&nt(E.value);const f=E.value;f&&(om(f),f.off("style.load",Ct),f.off("load",Ct),f.off("idle",Uo))});function rm(f){f&&(ee.value=f)}function im(f){Be.value=f}v.setBasemap=rm,v.toggleGeometry=im,v.setOverlays?.(jt.value);function Wo(f){if(!f)return null;if(f.type==="FeatureCollection")return f;if(f.type==="Feature")return{type:"FeatureCollection",features:[f]};const F=f.geometry??f;if(!F?.type)return null;if(F.type==="GeometryCollection"&&Array.isArray(F.geometries)){const U=F.geometries.filter(Y=>Y&&typeof Y.type=="string").map(Y=>({type:"Feature",geometry:Y}));return U.length?{type:"FeatureCollection",features:U}:null}if(F.type==="MultiPoint"&&Array.isArray(F.coordinates)){const U=F.coordinates.filter(Y=>Array.isArray(Y)&&Y.length>=2).map(Y=>({type:"Feature",geometry:{type:"Point",coordinates:Y}}));return U.length?{type:"FeatureCollection",features:U}:null}return{type:"FeatureCollection",features:[{type:"Feature",geometry:F}]}}function Fr(f){if(!f?.features?.length)return null;let F=1/0,U=1/0,Y=-1/0,ye=-1/0;const Ue=Ut=>{if(typeof Ut[0]=="number"){const[St,Pr]=Ut;F=Math.min(F,St),U=Math.min(U,Pr),Y=Math.max(Y,St),ye=Math.max(ye,Pr);return}Ut.forEach(St=>Ue(St))};return f.features.forEach(Ut=>{const St=Ut?.geometry?.coordinates;St&&Ue(St)}),F===1/0||U===1/0?null:[F,U,Y,ye]}return(f,F)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(pt.value),style:e.normalizeStyle(he.value?void 0:me.value)},[e.createElementVNode("div",{ref_key:"mapContainer",ref:_,class:e.normalizeClass(wt.value)},null,2),e.createVNode(dl,{items:zt.value},null,8,["items"]),P("search")?(e.openBlock(),e.createBlock(Bl,{key:0})):e.createCommentVNode("",!0),P("home")||P("fullscreen")?(e.openBlock(),e.createElementBlock("div",Al,[P("home")?(e.openBlock(),e.createElementBlock("div",Dl,[e.createVNode(fs,{center:j.value,zoom:b.value},null,8,["center","zoom"]),t.geom?(e.openBlock(),e.createBlock(fs,{key:0,"target-center":Je.value,"target-zoom":b.value,"target-label":"Об'єкт","target-aria-label":"Перейти до об'єкта"},null,8,["target-center","target-zoom"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),P("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:Ho,"aria-label":he.value?"Вихід з повноекранного режиму":"Увімкнути повноекранний режим"},[...F[0]||(F[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,Il)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),Pe.value?(e.openBlock(),e.createElementBlock("div",Ol,[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:je},[...F[1]||(F[1]=[e.createElementVNode("span",{"aria-hidden":"true"},"×",-1)])]),e.createElementVNode("div",Ml,e.toDisplayString(Pe.value.title||"Об'єкт"),1),Pe.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(${me.value.height}-120px)]`]),innerHTML:Pe.value.html},null,10,Fl)):(e.openBlock(),e.createElementBlock("div",Pl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Pe.value.rows,U=>(e.openBlock(),e.createElementBlock("div",{key:U.label,class:"flex justify-between text-[0.85rem] text-slate-700"},[e.createElementVNode("span",Rl,e.toDisplayString(U.label)+":",1),e.createElementVNode("span",zl,e.toDisplayString(U.value),1)]))),128))])),Pe.value.actions?.length?(e.openBlock(),e.createElementBlock("div",jl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Pe.value.actions,U=>(e.openBlock(),e.createElementBlock("a",{key:U.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:U.url,target:U.target??void 0,rel:"noreferrer"},e.toDisplayString(U.label),9,Hl))),128))])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createVNode(ll),P("position")&&X.value?(e.openBlock(),e.createBlock(ul,{key:3,class:"absolute bottom-[10px] right-[10px] z-[500]",coordinates:X.value},null,8,["coordinates"])):e.createCommentVNode("",!0)],6))}}),Wl={class:"text-sm text-gray-600"},ql={key:0,class:"inline-flex items-center gap-1"},Kl={class:"mt-2 border border-neutral-200 rounded-lg overflow-hidden bg-neutral-50"},Gl={key:0,class:"grid grid-cols-2 divide-x divide-neutral-200"},Zl={class:"p-3"},Yl={key:0,class:"geom-change-mini-map h-[120px] rounded border border-neutral-100 overflow-hidden",style:{"min-height":"120px"}},Jl={key:1,class:"h-[120px] rounded border border-neutral-100 flex items-center justify-center bg-white text-xs text-gray-400"},Xl={class:"p-3"},Ql={key:0,class:"geom-change-mini-map h-[120px] rounded border border-neutral-100 overflow-hidden",style:{"min-height":"120px"}},Vl={key:1,class:"h-[120px] rounded border border-neutral-100 flex items-center justify-center bg-white text-xs text-gray-400"},ea=Xe(e.defineComponent({__name:"GeomChange",props:{oldWkt:{default:null},newWkt:{default:null}},setup(t){const n=t,o=e.ref(!1),s=e.computed(()=>ns(n.oldWkt)),r=e.computed(()=>ns(n.newWkt)),i=e.computed(()=>{const g=n.oldWkt;return g==null||String(g).trim()===""?!1:!s.value}),l=e.computed(()=>{const g=n.newWkt;return g==null||String(g).trim()===""?!1:!r.value}),a=e.computed(()=>rs(s.value)),c=e.computed(()=>rs(r.value)),d=e.computed(()=>s.value?ss(s.value):null),u=e.computed(()=>r.value?ss(r.value):null),p=e.computed(()=>Ai(d.value,u.value)),m=e.computed(()=>{const g=Di(s.value,r.value);return g>0?g:null}),S=e.computed(()=>Ii(s.value,r.value)),w=e.computed(()=>{const g=m.value;return g==null?"":g===1?"вершина змінена":g>=2&&g<=4?"вершини змінено":"вершин змінено"});return(g,x)=>(e.openBlock(),e.createElementBlock("div",Wl,[e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-xs text-gray-500 hover:text-gray-800 transition-colors py-1 mt-1",onClick:x[0]||(x[0]=_=>o.value=!o.value)},[e.createVNode(e.unref(Ko),{class:e.normalizeClass(["w-3.5 h-3.5",{"rotate-180":o.value}]),"stroke-width":1.5},null,8,["class"]),x[2]||(x[2]=e.createElementVNode("span",{class:"font-medium"},"Переглянути зміни геометрії",-1)),m.value!=null?(e.openBlock(),e.createElementBlock("span",ql,[x[1]||(x[1]=e.createElementVNode("span",{class:"w-1.5 h-1.5 rounded-full bg-rose-950"},null,-1)),e.createTextVNode(" "+e.toDisplayString(m.value)+" "+e.toDisplayString(w.value),1)])):e.createCommentVNode("",!0)]),e.withDirectives(e.createElementVNode("div",Kl,[o.value?(e.openBlock(),e.createElementBlock("div",Gl,[e.createElementVNode("div",Zl,[x[3]||(x[3]=e.createElementVNode("div",{class:"text-xs font-medium text-gray-500 mb-2"},"Було",-1)),a.value?(e.openBlock(),e.createElementBlock("div",Yl,[e.createVNode(At,{geom:a.value,bounds:p.value,"highlight-points":S.value.removed,height:"120px",tools:["scale"]},null,8,["geom","bounds","highlight-points"])])):(e.openBlock(),e.createElementBlock("div",Jl,e.toDisplayString(i.value?"Не вдалося прочитати геометрію":"—"),1))]),e.createElementVNode("div",Xl,[x[4]||(x[4]=e.createElementVNode("div",{class:"text-xs font-medium text-gray-500 mb-2"},"Стало",-1)),c.value?(e.openBlock(),e.createElementBlock("div",Ql,[e.createVNode(At,{geom:c.value,bounds:p.value,"highlight-points":S.value.added,height:"120px",tools:["scale"]},null,8,["geom","bounds","highlight-points"])])):(e.openBlock(),e.createElementBlock("div",Vl,e.toDisplayString(l.value?"Не вдалося прочитати геометрію":"—"),1))])])):e.createCommentVNode("",!0)],512),[[e.vShow,o.value]])]))}}),[["__scopeId","data-v-2c0770bb"]]),ta={class:"mx-auto font-sans"},na={class:"bg-white rounded-lg border border-neutral-200 p-4 sm:p-6"},oa={key:0,class:"py-8 text-center text-gray-500 text-sm"},sa={key:1,class:"py-8 text-center text-gray-500 text-sm"},ra={key:2,class:"space-y-6"},ia={class:"flex justify-end"},la={class:"flex items-center gap-2 mb-3 sticky top-0 bg-white py-2 z-20"},aa={class:"text-xs font-semibold text-gray-800 uppercase tracking-wide"},ca={class:"text-xs text-gray-500"},da={class:"relative"},fa={class:"bg-white border border-neutral-200 rounded-lg overflow-hidden divide-y divide-neutral-200"},pa=["onClick"],ua={class:"flex-shrink-0 w-3.5 h-3.5 flex items-center justify-center"},ma={class:"flex-1 min-w-0 flex items-center gap-2 text-sm"},ha={class:"font-medium text-gray-800"},ga={class:"text-gray-500"},ya={key:0},va=["title"],ba={class:"flex-shrink-0 flex items-center gap-2 text-xs text-gray-500 whitespace-nowrap"},ka={class:"px-4 pb-3 pl-[60px] space-y-2"},Ea={class:"space-y-1.5"},wa={class:"text-gray-500 font-[600] text-[0.92rem] min-w-[80px]"},xa={key:1,class:"flex items-center gap-2"},Na={class:"pl-2 text-gray-500 line-through"},Ca={class:"text-gray-800 font-semibold"},Sa={key:0,class:"mt-4 text-center"},_a={class:"text-xs text-gray-500"},vn=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(N){return N?Array.isArray(N)?N:Object.entries(N).map(([C,T],v)=>({changeDataId:`legacy-${v}`,entityKey:C,valueOld:String(T?.old??""),valueNew:String(T?.new??"")})):[]}function a(N){return l(N.changes).length>0}e.onMounted(async()=>{try{const N=await fetch("/api/suggest/change_type");if(!N.ok)return;const C=await N.json(),T=Array.isArray(C)?C:C?.data;if(!Array.isArray(T))return;const v=new Map;for(const E of T)E?.id!=null&&v.set(String(E.id).toLowerCase(),{text:E.text??E.id,icon:E.icon??null});i.value=v}catch{}}),o.value.length===0&&n.id&&W(),e.watch(()=>n.id,()=>{n.id&&W()});function c(N){return ts.get(N)??ts.get("custom")}function d(N){if(n.iconSource==="actionType"){const T=i.value.get((N.action??"").toLowerCase())?.icon;if(T&&T in es)return es[T]}return c(N.entityType)?.icon}const u=e.computed(()=>new Set(n.hideChangesValuesKeys??[]));function p(N){return i.value.get((N??"").toLowerCase())?.text??N??""}function m(N,C=3){const T=l(N.changes).map(E=>E.entityKey);if(T.length===0)return"";const v=T.slice(0,C).join(", ");return T.length>C?`${v} ...`:v}function S(N){try{return new Date(N+"T00:00:00").toLocaleDateString("uk-UA",{day:"numeric",month:"long",year:"numeric"})}catch{return N}}const w=e.computed(()=>{const N=new Map;for(const C of o.value){const T=C.changeDate??C.timestamp?.toLocaleDateString("uk-UA")??"unknown";if(!N.has(T)){const v=C.changeDate?S(C.changeDate):C.timestamp?.toLocaleDateString("uk-UA",{day:"numeric",month:"long",year:"numeric"})??"Без дати";N.set(T,{dateKey:T,dateDisplay:v,rows:[]})}N.get(T).rows.push(C)}return Array.from(N.values()).sort((C,T)=>T.dateKey.localeCompare(C.dateKey))}),g=e.computed(()=>o.value.filter(a).some(N=>!r[N.id]));function x(N){r[N]=!r[N]}function _(){const N=g.value;o.value.forEach(C=>{a(C)&&(r[C.id]=N)})}async function W(){if(n.id){s.value=!0;try{const N=await fetch(`/api/widget/history/${n.id}`);if(!N.ok){o.value=[];return}const T=((await N.json()).rows??[]).map(v=>({id:v.change_id??v.entity_id??"",entityId:v.entity_id??"",entityType:v.entity_type??"custom",action:v.change_type??"",userId:v.change_user_id??"",userName:v.username??"",timestamp:new Date(v.cdate),changeDate:v.change_date,login:v.login,avatar:v.avatar??null,changes:Array.isArray(v.changes)?v.changes.map(E=>({changeDataId:E.change_data_id,entityKey:E.entity_key,valueOld:E.value_old??"",valueNew:E.value_new??""})):[]}));o.value=T}finally{s.value=!1}}}return(N,C)=>(e.openBlock(),e.createElementBlock("div",ta,[e.createElementVNode("div",na,[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",oa," Завантаження... ")):o.value.length===0?(e.openBlock(),e.createElementBlock("div",sa," Немає записів ")):(e.openBlock(),e.createElementBlock("div",ra,[e.createElementVNode("div",ia,[e.createElementVNode("button",{onClick:_,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(Gr),{class:e.normalizeClass(["w-4 h-4",{"rotate-180":g.value}])},null,8,["class"]),e.createElementVNode("span",null,e.toDisplayString(g.value?"Розгорнути всі":"Згорнути всі"),1)])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,T=>(e.openBlock(),e.createElementBlock("div",{key:T.dateKey},[e.createElementVNode("div",la,[e.createElementVNode("h3",aa,e.toDisplayString(T.dateDisplay),1),C[0]||(C[0]=e.createElementVNode("div",{class:"flex-1 h-[1px] bg-neutral-200"},null,-1)),e.createElementVNode("span",ca,e.toDisplayString(T.rows.length),1)]),e.createElementVNode("div",da,[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",fa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.rows,v=>(e.openBlock(),e.createElementBlock("div",{key:v.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(v)}]),onClick:E=>a(v)&&x(v.id)},[e.createElementVNode("div",ua,[a(v)?(e.openBlock(),e.createBlock(e.unref(Ko),{key:0,class:e.normalizeClass(["w-3.5 h-3.5 text-gray-500 transition-transform duration-200",{"rotate-180":r[v.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(v.entityType)?.color??"bg-gray-100"}`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d(v)),{class:"w-4 h-4 relative z-10","stroke-width":"1.5"}))],2),e.createElementVNode("div",ma,[e.createElementVNode("span",ha,e.toDisplayString(v.userName),1),e.createElementVNode("span",ga,[e.createTextVNode(e.toDisplayString(p(v.action)),1),m(v)?(e.openBlock(),e.createElementBlock("span",ya,": "+e.toDisplayString(m(v)),1)):e.createCommentVNode("",!0)]),t.showEntityId&&v.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:v.entityId},e.toDisplayString(v.entityId),9,va)):e.createCommentVNode("",!0)]),e.createElementVNode("div",ba,[e.createElementVNode("span",null,e.toDisplayString(v.timestamp?.toLocaleTimeString("uk-UA",{hour:"2-digit",minute:"2-digit"})),1)])],10,pa),e.withDirectives(e.createElementVNode("div",ka,[e.createElementVNode("div",Ea,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l(v.changes),E=>(e.openBlock(),e.createElementBlock("div",{key:E.changeDataId,class:"flex flex-col gap-2 text-sm pl-2"},[e.createElementVNode("span",wa,e.toDisplayString(E.entityKey),1),u.value.has(E.entityKey)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(os)(E.valueOld)||e.unref(os)(E.valueNew)?(e.openBlock(),e.createBlock(ea,{key:0,"old-wkt":E.valueOld,"new-wkt":E.valueNew},null,8,["old-wkt","new-wkt"])):(e.openBlock(),e.createElementBlock("div",xa,[e.createElementVNode("span",Na,e.toDisplayString(E.valueOld),1),e.createVNode(e.unref(Kr),{class:"w-3 h-3 text-neutral-400 flex-shrink-0","stroke-width":"1.5"}),e.createElementVNode("span",Ca,e.toDisplayString(E.valueNew),1)]))],64))]))),128))])],512),[[e.vShow,a(v)&&r[v.id]]])]))),128))])])]))),128))]))],4),!s.value&&o.value.length>0?(e.openBlock(),e.createElementBlock("div",Sa,[e.createElementVNode("p",_a,e.toDisplayString(o.value.length)+" записів",1)])):e.createCommentVNode("",!0)])]))}}),Ba={key:0,class:"text-xl font-semibold"},$a={class:"flex gap-1"},Ta={key:0},La=["accept"],Aa={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"},Da=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",Ba,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",$a,[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(ni),{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(Qr),{class:"h-4 w-4"})],2),t.editable?(e.openBlock(),e.createElementBlock("label",Ta,[e.createElementVNode("input",{type:"file",class:"hidden",accept:t.accept,onChange:r[2]||(r[2]=i=>s.$emit("onAddFile",i))},null,40,La),e.createElementVNode("div",Aa,[e.createVNode(e.unref(Yo),{class:"h-4 w-4"}),r[3]||(r[3]=e.createTextVNode(" Додати файл ",-1))])])):e.createCommentVNode("",!0)])],2))}}),Yn={pdf:{color:"bg-red-100 text-red-700 border-red-200",icon:_t,label:"PDF"},sketch:{color:"bg-gray-100 text-gray-700 border-gray-200",icon:Xr,label:"SKETCH"},mp4:{color:"bg-purple-100 text-purple-700 border-purple-200",icon:li,label:"VIDEO"},docx:{color:"bg-blue-100 text-blue-700 border-blue-200",icon:_t,label:"DOC"},zip:{color:"bg-orange-100 text-orange-700 border-orange-200",icon:qr,label:"ARCHIVE"},png:{color:"bg-green-100 text-green-700 border-green-200",icon:Zo,label:"IMAGE"},jpg:{color:"bg-green-100 text-green-700 border-green-200",icon:Zo,label:"IMAGE"},xlsx:{color:"bg-emerald-100 text-emerald-700 border-emerald-200",icon:_t,label:"EXCEL"},pptx:{color:"bg-amber-100 text-amber-700 border-amber-200",icon:_t,label:"PPT"}};function ps(t,n="en"){const o={month:"short",day:"numeric"};return new Intl.DateTimeFormat(n,o).format(t)}function us(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 Ia={class:"space-y-0.5"},Oa=["onClick"],Ma=["onClick"],Fa={class:"flex items-center gap-2"},Pa={class:"font-medium text-xs truncate hover:text-blue-600 cursor-pointer"},Ra={class:"hidden sm:block text-xs text-gray-500 w-16 text-right"},za={class:"hidden md:block text-xs text-gray-500 w-12 text-right"},ja={class:"flex items-center gap-1"},Ha=["onClick"],Ua=["onClick"],Wa=e.defineComponent({__name:"FileList",props:{files:{}},emits:["delete","download","openLightbox"],setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",Ia,[(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(Yn)[s?.ext]?.color||"bg-blue-100 text-blue-700 border-blue-200"])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Yn)[s?.ext]?.icon||e.unref(Yn).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",Fa,[e.createElementVNode("span",Pa,e.toDisplayString(s?.uploaded_name||s?.name),1)])],8,Ma),e.createElementVNode("div",Ra,e.toDisplayString(e.unref(us)(s.size)),1),e.createElementVNode("div",za,e.toDisplayString(e.unref(ps)(s.createdAt)),1),e.createElementVNode("div",ja,[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(Go),{class:"h-3 w-3"})],8,Ha),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(fn),{class:"h-3 w-3"})],8,Ua)])],8,Oa))),128))]))}}),qa={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3"},Ka=["onClick"],Ga={class:"space-y-2"},Za={class:"flex justify-center items-center w-full aspect-[4/3] bg-gray-100 rounded overflow-hidden"},Ya=["src"],Ja={class:"space-y-1"},Xa=["title"],Qa={class:"text-xs text-gray-500 text-left"},Va={class:"absolute top-2 right-1 flex items-center gap-1"},ec=["onClick"],tc=["onClick"],nc=e.defineComponent({__name:"FileGrid",props:{files:{}},emits:["delete","download","openLightbox"],setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",qa,[(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",Ga,[e.createElementVNode("div",Za,[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,Ya)):(e.openBlock(),e.createBlock(e.unref(_t),{key:1,class:"h-10 w-10 text-gray-500"}))]),e.createElementVNode("div",Ja,[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,Xa),e.createElementVNode("p",Qa,e.toDisplayString(e.unref(ps)(s.createdAt))+", "+e.toDisplayString(e.unref(us)(s.size)),1)])]),e.createElementVNode("div",Va,[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(Go),{class:"h-3 w-3"})],8,ec),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(fn),{class:"h-3 w-3"})],8,tc)])],8,Ka))),128))]))}}),oc={class:"mx-auto font-sans"},sc={key:1},bn=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 y=(o.format??[]).map(R=>typeof R=="string"?R.trim():R==null?"":String(R).trim()).filter(R=>R.length>0),D=[];return y.forEach(R=>{const H=R.toLowerCase(),K=H.indexOf("/"),G=K>=0;let I,z=!1,B;if(G){I=H;const ee=H.slice(K+1);z=ee==="*",!z&&ee&&(B=`.${ee.replace(/^\.+/,"")}`)}else B=H.startsWith(".")?H:`.${H.replace(/^\.+/,"")}`;const q=G?I:B??"";q&&D.push({acceptValue:q,mime:I,wildcard:z,extension:B})}),D.length?D:null}),d=e.computed(()=>{const E=c.value;if(!E)return;const y=E.map(D=>D.acceptValue).filter(Boolean);return y.length?y.join(","):void 0}),u=E=>{if(!c.value)return!0;const y=E.type?.toLowerCase(),D=E.name?.toLowerCase();return c.value.some(R=>{if(R.mime){if(y){if(R.wildcard){const H=R.mime.split("/")[0];if(y.startsWith(`${H}/`))return!0}else if(y===R.mime)return!0}return!!(R.extension&&D?.endsWith(R.extension))}return!!(R.extension&&D?.endsWith(R.extension))})},p=n;a.value.length===0&&C();const m=(E,y)=>{r.value=y,s.value=!0},S=()=>{r.value&&(_(r.value),r.value=null,s.value=!1)},w=e.computed(()=>Array.isArray(a.value)?a.value.map(E=>E?.file_path):[]),g=E=>{const y=w.value.findIndex(D=>D===E.file_path);y!==-1&&(i.value=!0,l.value=y)},x=E=>{o.onAddFile?o.onAddFile(E):T(E),p("add",E)},_=E=>{o.onDelete?o.onDelete(E):v(E),p("delete",E)},W=E=>{const y=document.createElement("a");y.setAttribute("download",E?.uploaded_name||E?.name),y.href=E?.file_path||E?.path,y.click()},N=e.ref(o.view==="grid"?"grid":"list");async function C(){if(!o.id)return;const E=await fetch(`/api/widget/file/${o.id}`).then(y=>y.json());E.rows.forEach(y=>{y.timestamp=new Date(y.cdate),y.id=y.entity_id,y.entityType=y.entity_type,y.entityId=y.entity_id,y.entityType=y.entity_type,y.action=y.change_type,y.userId=y.change_user_id,y.userName=y.username,y.timestamp=new Date(y.cdate),y.description=y.username,y.status=y.username}),a.value=E.rows}const T=async E=>{const D=E.target?.files;if(!D||D.length===0)return;const R=Array.from(D),H=[],K=[];if(R.forEach(G=>{u(G)?H.push(G):K.push(G)}),K.length&&console.warn(`Файлы пропущены, потому что не соответствуют разрешённым форматам: ${K.map(G=>G.name).join(", ")}`),H.length!==0)try{await Promise.all(H.map(async G=>{const I=new FormData;I.append("file",G);const z=`/api/widget/file/${o.id}`,B=await fetch(z,{method:"POST",body:I});if(!B.ok)throw new Error(`HTTP error! status: ${B.status}`);return G})),await C()}catch(G){console.error("Помилка при завантаженні файлів:",G)}},v=async E=>{try{await fetch(`/api/widget/file/${o.id}/${E}`,{method:"DELETE"}),await C()}catch(y){console.error(y)}};return(E,y)=>{const D=e.resolveComponent("MessageBox"),R=e.resolveComponent("Lightbox");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",oc,[e.createVNode(Da,{modelValue:N.value,"onUpdate:modelValue":y[0]||(y[0]=H=>N.value=H),title:o.title,onOnAddFile:y[1]||(y[1]=H=>x(H)),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"})},[N.value==="list"?(e.openBlock(),e.createBlock(Wa,{key:0,onDelete:m,onDownload:W,onOpenLightbox:y[2]||(y[2]=H=>g(H)),files:a.value},null,8,["files"])):e.createCommentVNode("",!0),N.value==="grid"?(e.openBlock(),e.createBlock(nc,{key:1,onDelete:m,onDownload:W,onOpenLightbox:y[3]||(y[3]=H=>g(H)),files:a.value},null,8,["files"])):e.createCommentVNode("",!0)],6)):(e.openBlock(),e.createElementBlock("div",sc,[...y[6]||(y[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":y[4]||(y[4]=H=>s.value=H),onConfirm:S,title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати"},null,8,["modelValue"]),e.createVNode(R,{modelValue:i.value,"onUpdate:modelValue":y[5]||(y[5]=H=>i.value=H),images:w.value,"start-index":l.value},null,8,["modelValue","images","start-index"])],64)}}}),rc={key:0,class:"image-wrapper h-full max-h-[400px]",id:"lightbox-gallery"},ic=["onClick"],lc={key:0,rel:"noreferrer",class:"relative block h-full w-full"},ac=["src"],cc={key:0,class:"thumb-cover"},dc=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(u=>u===c.file_path);d!==-1&&(s.value=!0,r.value=d)};return(c,d)=>{const u=e.resolveComponent("Lightbox");return t.items?.length>=1?(e.openBlock(),e.createElementBlock("div",rc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(p,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["h-full w-full image"+m,"cursor-pointer bg-teal-500 rounded-[3px]"]),key:m,onClick:e.withModifiers(S=>a(p),["stop"])},[m<5?(e.openBlock(),e.createElementBlock("div",lc,[e.createElementVNode("img",{src:`/file/resize?filepath=${p?.file_path}&w=500`,alt:"alt",height:"auto",width:"100%",class:e.normalizeClass(["object-cover h-full w-full bg-gray-200 rounded-[3px]",m===0?"max-h-[411px]":"max-h-[calc((411px-3px)/2)]"])},null,10,ac),m===4&&t.items?.length>5?(e.openBlock(),e.createElementBlock("div",cc," +"+e.toDisplayString(t.items?.length-5),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],10,ic))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Math.max(0,5-t.items.length),p=>(e.openBlock(),e.createElementBlock("div",{key:"empty-"+p,class:e.normalizeClass(["h-full w-full image"+(t.items.length+p-1),"bg-gray-300 rounded-[3px]"])},null,2))),128)),e.createVNode(u,{modelValue:s.value,"onUpdate:modelValue":d[0]||(d[0]=p=>s.value=p),images:l.value,"start-index":r.value,delete:"true",download:"true",onDelete:d[1]||(d[1]=p=>o("delete",p))},null,8,["modelValue","images","start-index"])])):e.createCommentVNode("",!0)}}}),fc={key:0,class:"text-xl font-semibold"},pc={class:"flex gap-1"},uc=["accept"],mc={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"},hc=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",fc,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",pc,[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,uc),e.createElementVNode("div",mc,[e.createVNode(e.unref(Yo),{class:"h-4 w-4"}),o[1]||(o[1]=e.createTextVNode(" Додати зображення ",-1))])])])],2))}}),gc={class:"w-full mx-auto font-sans",ref:"containerRef"},yc={key:1},kn=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=C=>{if(!C)return[];const T=Array.isArray(C)?C:C.split(",");return Array.from(new Set(T.map(v=>v.trim().replace(/^\./,"").toLowerCase()).filter(Boolean)))},r=["jpg","jpeg","png","gif","webp","bmp","svg","avif","heic","tiff"],i=e.computed(()=>{const C=s(o.format);return C.length>0?C:void 0}),l=e.computed(()=>{const C=i.value;return!C||C.length===0?"image/*":C.map(T=>T.startsWith(".")?T:`.${T}`).join(",")}),a=C=>C?.split(".").pop()?.toLowerCase()??"",c=C=>{const T=C?.toLowerCase();return!!T&&!!i.value&&i.value.includes(T)},d=C=>{const T=C?.toLowerCase();return!!T&&r.includes(T)},u=C=>{const T=C.type?.toLowerCase(),v=C.ext?.toLowerCase();return T?.startsWith("image/")?i.value?c(v):!0:v?i.value?c(v):d(v):!1},p=C=>{if(!C.type?.toLowerCase()?.startsWith("image/"))return!1;if(!i.value)return!0;const v=a(C.name);return c(v)},m=C=>C.filter(u),S=e.ref(m(o.items??[])),w=n;S.value.length===0&&W();const g=C=>{o.onAddImage?o.onAddImage(C):_(C),w("add",C)},x=C=>{const T=S.value.find(v=>v.file_path===C)?.file_id;T&&(o.onDelete?o.onDelete(T):N(T))},_=async C=>{const T=C.target;if(!T?.files||T.files.length===0)return;const v=Array.from(T.files),E=v.filter(D=>p(D)),y=i.value?.join(", ")??"image/*";if(E.length===0){console.warn(`Допустимі формати: ${y}. Завантажте зображення дозволеного типу.`);return}E.length!==v.length&&console.warn(`Частина файлів відфільтрована; дозволені формати: ${y}.`);try{await Promise.all(E.map(async D=>{const R=new FormData;R.append("file",D);const H=`/api/widget/file/${o.id}`,K=await fetch(H,{method:"POST",body:R});if(!K.ok)throw new Error(`HTTP error! status: ${K.status}`);return D})),await W()}catch(D){console.error("Помилка при завантаженні файлів:",D)}};async function W(){if(!o.id)return;const C=await fetch(`/api/widget/file/${o.id}`).then(T=>T.json());S.value=m(C.rows)}const N=async C=>{try{await fetch(`/api/widget/file/${o.id}/${C}`,{method:"DELETE"}),await W()}catch(T){console.error(T)}};return(C,T)=>(e.openBlock(),e.createElementBlock("div",gc,[e.createVNode(hc,{title:t.title,accept:l.value,onOnAddImage:T[0]||(T[0]=v=>g(v))},null,8,["title","accept"]),S.value.length>0?(e.openBlock(),e.createBlock(dc,{key:0,items:S.value,onDelete:T[1]||(T[1]=v=>x(v))},null,8,["items"])):(e.openBlock(),e.createElementBlock("div",yc,[...T[2]||(T[2]=[e.createElementVNode("div",{class:"flex items-center justify-center h-full"},[e.createElementVNode("p",{class:"text-gray-500 leading-[3]"},"Зображень не знайдено")],-1)])]))],512))}}),vc={class:"text-value"},bc={class:"text-sm text-gray-900"},kc=Xe(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",vc,[e.createElementVNode("span",bc,e.toDisplayString(o.value),1)]))}}),[["__scopeId","data-v-c14550b7"]]),Ec={class:"link-value"},wc=["href"],xc=Xe(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",Ec,[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,wc)]))}}),[["__scopeId","data-v-e6eb07a6"]]),Nc={class:"date-value"},Cc={class:"text-sm text-gray-900"},Sc=Xe(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",Nc,[e.createElementVNode("span",Cc,e.toDisplayString(o.value),1)]))}}),[["__scopeId","data-v-b9600618"]]),_c={class:"status-value"},Bc={key:0,class:"mr-1"},$c=Xe(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",_c,[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",Bc,[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"]]),Tc={class:"custom-value"},Lc={class:"text-sm text-gray-900"},Ac=Xe(e.defineComponent({__name:"CustomValue",props:{item:{}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",Tc,[e.renderSlot(n.$slots,"default",{item:t.item,value:t.item.value},()=>[e.createElementVNode("span",Lc,e.toDisplayString(String(t.item.value)),1)],!0)]))}}),[["__scopeId","data-v-11a73810"]]),Dc=["id"],Ic={key:0,class:"text-xl font-semibold text-gray-900 mb-4"},Oc={key:1,class:"overflow-x-auto"},Mc={class:"min-w-full divide-y divide-gray-200"},Fc={class:"bg-white divide-y divide-gray-200"},Pc={class:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"},Rc={class:"flex items-center gap-2"},zc=["title"],jc={class:"px-6 py-4 whitespace-nowrap text-sm text-gray-500"},Hc={key:2,class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"},Uc={class:"flex items-start gap-3"},Wc={key:0,class:"flex-shrink-0"},qc={class:"flex-1 min-w-0"},Kc={class:"flex items-center gap-2 mb-2"},Gc={class:"text-sm font-medium text-gray-900"},Zc=["title"],Yc={key:3,class:"overflow-x-auto"},Jc={class:"min-w-full divide-y divide-gray-200"},Xc={class:"bg-white divide-y divide-gray-200"},Qc={class:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"},Vc={class:"flex items-center gap-2"},ed=["title"],td={class:"px-6 py-4 whitespace-nowrap text-sm text-gray-500"},Jn=Xe(e.defineComponent({__name:"DescriptionListWidget",props:{title:{},items:{},view:{},id:{},className:{},style:{}},setup(t){const n=o=>{switch(o.type){case"link":return xc;case"date":return Sc;case"status":return $c;case"custom":return Ac;default:return kc}};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",Ic,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),t.view==="table"?(e.openBlock(),e.createElementBlock("div",Oc,[e.createElementVNode("table",Mc,[e.createElementVNode("tbody",Fc,[(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",Pc,[e.createElementVNode("div",Rc,[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,zc)):e.createCommentVNode("",!0)])]),e.createElementVNode("td",jc,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])]))),128))])])])):t.view==="grid"?(e.openBlock(),e.createElementBlock("div",Hc,[(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",Uc,[r.icon?(e.openBlock(),e.createElementBlock("div",Wc,[e.createElementVNode("i",{class:e.normalizeClass([r.icon,"text-gray-500 text-lg"])},null,2)])):e.createCommentVNode("",!0),e.createElementVNode("div",qc,[e.createElementVNode("div",Kc,[e.createElementVNode("h4",Gc,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,Zc)):e.createCommentVNode("",!0)]),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])])]))),128))])):(e.openBlock(),e.createElementBlock("div",Yc,[e.createElementVNode("table",Jc,[e.createElementVNode("tbody",Xc,[(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",Qc,[e.createElementVNode("div",Vc,[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,ed)):e.createCommentVNode("",!0)])]),e.createElementVNode("td",td,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])]))),128))])])]))],14,Dc))}}),[["__scopeId","data-v-36d43e50"]]);function Ze(t){const n=Object.create(null);for(const o of t.split(","))n[o]=1;return o=>o in n}const nd=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const Xn=()=>{},En=()=>!1,Qn=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),it=Object.assign,Qe=Array.isArray,ke=t=>typeof t=="string",Vn=t=>typeof t=="symbol",od=t=>t!==null&&typeof t=="object",ms=Ze(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),sd=Ze("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),eo=t=>{const n=Object.create(null);return(o=>n[o]||(n[o]=t(o)))},rd=/-\w/g,lt=eo(t=>t.replace(rd,n=>n.slice(1).toUpperCase())),to=eo(t=>t.charAt(0).toUpperCase()+t.slice(1)),id=eo(t=>t?`on${to(t)}`:""),Gt={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"},ld={1:"STABLE",2:"DYNAMIC",3:"FORWARDED"},ad=/;(?![^(]*\))/g,cd=/:([^]+)/,dd=/\/\*[^]*?\*\//g;function fd(t){const n={};return t.replace(dd,"").split(ad).forEach(o=>{if(o){const s=o.split(cd);s.length>1&&(n[s[0].trim()]=s[1].trim())}}),n}const pd="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",ud="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",md="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",hd="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr",gd=Ze(pd),yd=Ze(ud),vd=Ze(md),bd=Ze(hd);const Zt=Symbol(process.env.NODE_ENV!=="production"?"Fragment":""),Yt=Symbol(process.env.NODE_ENV!=="production"?"Teleport":""),no=Symbol(process.env.NODE_ENV!=="production"?"Suspense":""),wn=Symbol(process.env.NODE_ENV!=="production"?"KeepAlive":""),hs=Symbol(process.env.NODE_ENV!=="production"?"BaseTransition":""),ht=Symbol(process.env.NODE_ENV!=="production"?"openBlock":""),gs=Symbol(process.env.NODE_ENV!=="production"?"createBlock":""),ys=Symbol(process.env.NODE_ENV!=="production"?"createElementBlock":""),oo=Symbol(process.env.NODE_ENV!=="production"?"createVNode":""),so=Symbol(process.env.NODE_ENV!=="production"?"createElementVNode":""),Jt=Symbol(process.env.NODE_ENV!=="production"?"createCommentVNode":""),ro=Symbol(process.env.NODE_ENV!=="production"?"createTextVNode":""),vs=Symbol(process.env.NODE_ENV!=="production"?"createStaticVNode":""),io=Symbol(process.env.NODE_ENV!=="production"?"resolveComponent":""),lo=Symbol(process.env.NODE_ENV!=="production"?"resolveDynamicComponent":""),ao=Symbol(process.env.NODE_ENV!=="production"?"resolveDirective":""),co=Symbol(process.env.NODE_ENV!=="production"?"resolveFilter":""),fo=Symbol(process.env.NODE_ENV!=="production"?"withDirectives":""),po=Symbol(process.env.NODE_ENV!=="production"?"renderList":""),bs=Symbol(process.env.NODE_ENV!=="production"?"renderSlot":""),ks=Symbol(process.env.NODE_ENV!=="production"?"createSlots":""),xn=Symbol(process.env.NODE_ENV!=="production"?"toDisplayString":""),Nn=Symbol(process.env.NODE_ENV!=="production"?"mergeProps":""),uo=Symbol(process.env.NODE_ENV!=="production"?"normalizeClass":""),mo=Symbol(process.env.NODE_ENV!=="production"?"normalizeStyle":""),Xt=Symbol(process.env.NODE_ENV!=="production"?"normalizeProps":""),Qt=Symbol(process.env.NODE_ENV!=="production"?"guardReactiveProps":""),ho=Symbol(process.env.NODE_ENV!=="production"?"toHandlers":""),go=Symbol(process.env.NODE_ENV!=="production"?"camelize":""),kd=Symbol(process.env.NODE_ENV!=="production"?"capitalize":""),yo=Symbol(process.env.NODE_ENV!=="production"?"toHandlerKey":""),Cn=Symbol(process.env.NODE_ENV!=="production"?"setBlockTracking":""),Ed=Symbol(process.env.NODE_ENV!=="production"?"pushScopeId":""),wd=Symbol(process.env.NODE_ENV!=="production"?"popScopeId":""),vo=Symbol(process.env.NODE_ENV!=="production"?"withCtx":""),xd=Symbol(process.env.NODE_ENV!=="production"?"unref":""),Nd=Symbol(process.env.NODE_ENV!=="production"?"isRef":""),bo=Symbol(process.env.NODE_ENV!=="production"?"withMemo":""),Es=Symbol(process.env.NODE_ENV!=="production"?"isMemoSame":""),Dt={[Zt]:"Fragment",[Yt]:"Teleport",[no]:"Suspense",[wn]:"KeepAlive",[hs]:"BaseTransition",[ht]:"openBlock",[gs]:"createBlock",[ys]:"createElementBlock",[oo]:"createVNode",[so]:"createElementVNode",[Jt]:"createCommentVNode",[ro]:"createTextVNode",[vs]:"createStaticVNode",[io]:"resolveComponent",[lo]:"resolveDynamicComponent",[ao]:"resolveDirective",[co]:"resolveFilter",[fo]:"withDirectives",[po]:"renderList",[bs]:"renderSlot",[ks]:"createSlots",[xn]:"toDisplayString",[Nn]:"mergeProps",[uo]:"normalizeClass",[mo]:"normalizeStyle",[Xt]:"normalizeProps",[Qt]:"guardReactiveProps",[ho]:"toHandlers",[go]:"camelize",[kd]:"capitalize",[yo]:"toHandlerKey",[Cn]:"setBlockTracking",[Ed]:"pushScopeId",[wd]:"popScopeId",[vo]:"withCtx",[xd]:"unref",[Nd]:"isRef",[bo]:"withMemo",[Es]:"isMemoSame"};function Cd(t){Object.getOwnPropertySymbols(t).forEach(n=>{Dt[n]=t[n]})}const Oe={start:{line:1,column:1,offset:0},end:{line:1,column:1,offset:0},source:""};function Sd(t,n=""){return{type:0,source:n,children:t,helpers:new Set,components:[],directives:[],hoists:[],imports:[],cached:[],temps:0,codegenNode:void 0,loc:Oe}}function Vt(t,n,o,s,r,i,l,a=!1,c=!1,d=!1,u=Oe){return t&&(a?(t.helper(ht),t.helper(Mt(t.inSSR,d))):t.helper(Ot(t.inSSR,d)),l&&t.helper(fo)),{type:13,tag:n,props:o,children:s,patchFlag:r,dynamicProps:i,directives:l,isBlock:a,disableTracking:c,isComponent:d,loc:u}}function gt(t,n=Oe){return{type:17,loc:n,elements:t}}function ze(t,n=Oe){return{type:15,loc:n,properties:t}}function ue(t,n){return{type:16,loc:Oe,key:ke(t)?Q(t,!0):t,value:n}}function Q(t,n=!1,o=Oe,s=0){return{type:4,loc:o,content:t,isStatic:n,constType:n?3:s}}function We(t,n=Oe){return{type:8,loc:n,children:t}}function be(t,n=[],o=Oe){return{type:14,loc:o,callee:t,arguments:n}}function It(t,n=void 0,o=!1,s=!1,r=Oe){return{type:18,params:t,returns:n,newline:o,isSlot:s,loc:r}}function ko(t,n,o,s=!0){return{type:19,test:t,consequent:n,alternate:o,newline:s,loc:Oe}}function _d(t,n,o=!1,s=!1){return{type:20,index:t,value:n,needPauseTracking:o,inVOnce:s,needArraySpread:!1,loc:Oe}}function Bd(t){return{type:21,body:t,loc:Oe}}function Ot(t,n){return t||n?oo:so}function Mt(t,n){return t||n?gs:ys}function Eo(t,{helper:n,removeHelper:o,inSSR:s}){t.isBlock||(t.isBlock=!0,o(Ot(s,t.isComponent)),n(ht),n(Mt(s,t.isComponent)))}const ws=new Uint8Array([123,123]),xs=new Uint8Array([125,125]);function Ns(t){return t>=97&&t<=122||t>=65&&t<=90}function Me(t){return t===32||t===10||t===9||t===12||t===13}function at(t){return t===47||t===62||Me(t)}function Sn(t){const n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}const we={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 $d{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=ws,this.delimiterClose=xs,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=ws,this.delimiterClose=xs}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?at(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||Me(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===we.TitleEnd||this.currentSequence===we.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===we.Cdata[this.sequenceIndex]?++this.sequenceIndex===we.Cdata.length&&(this.state=28,this.currentSequence=we.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===we.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):Ns(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){at(n)&&this.handleTagName(n)}stateInSFCRootTagName(n){if(at(n)){const o=this.buffer.slice(this.sectionStart,this.index);o!=="template"&&this.enterRCDATA(Sn("</"+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){Me(n)||(n===62?(process.env.NODE_ENV!=="production"&&this.cbs.onerr(14,this.index),this.state=1,this.sectionStart=this.index+1):(this.state=Ns(n)?9:27,this.sectionStart=this.index))}stateInClosingTagName(n){(n===62||Me(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):Me(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):Me(n)||(this.state=11,this.stateBeforeAttrName(n))}stateInAttrName(n){n===61||at(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||at(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||at(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||at(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||at(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)):Me(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):Me(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){Me(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=we.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===we.ScriptEnd[3]?this.startSpecial(we.ScriptEnd,4):n===we.StyleEnd[3]?this.startSpecial(we.StyleEnd,4):(this.state=6,this.stateInTagName(n))}stateBeforeSpecialT(n){n===we.TitleEnd[3]?this.startSpecial(we.TitleEnd,4):n===we.TextareaEnd[3]?this.startSpecial(we.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===we.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 Td={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 wo(t,{compatConfig:n}){const o=n&&n[t];return t==="MODE"?o||3:o}function ct(t,n){const o=wo("MODE",n),s=wo(t,n);return o===3?s===!0:s!==!1}function Ft(t,n,o,...s){const r=ct(t,n);return process.env.NODE_ENV!=="production"&&r&&_n(t,n,o,...s),r}function _n(t,n,o,...s){if(wo(t,n)==="suppress-warning")return;const{message:i,link:l}=Td[t],a=`(deprecation ${t}) ${typeof i=="function"?i(...s):i}${l?`
|
|
1
|
+
(function(ve,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):(ve=typeof globalThis<"u"?globalThis:ve||self,e(ve.WidgetLib={},ve.Vue,ve.OpenGISCore))})(this,(function(ve,e,Ce){"use strict";function Rr(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 zr=Rr(e);const qo=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),jr=t=>t.replace(/^([A-Z])|[\s-_]+(\w)/g,(n,o,s)=>s?s.toUpperCase():o.toLowerCase()),Hr=t=>{const n=jr(t);return n.charAt(0).toUpperCase()+n.slice(1)},Ur=(...t)=>t.filter((n,o,s)=>!!n&&n.trim()!==""&&s.indexOf(n)===o).join(" ").trim();var dn={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 Wr=({size:t,strokeWidth:n=2,absoluteStrokeWidth:o,color:s,iconNode:r,name:i,class:l,...a},{slots:c})=>e.h("svg",{...dn,width:t||dn.width,height:t||dn.height,stroke:s||dn.stroke,"stroke-width":o?Number(n)*24/Number(t):n,class:Ur("lucide",...i?[`lucide-${qo(Hr(i))}-icon`,`lucide-${qo(i)}`]:["lucide-icon"]),...a},[...r.map(d=>e.h(...d)),...c.default?[c.default()]:[]]);const ae=(t,n)=>(o,{slots:s})=>e.h(Wr,{...o,iconNode:n,name:t},s);const qr=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 Kr=ae("arrow-right",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);const Ko=ae("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);const Gr=ae("chevrons-up",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]);const Zr=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 Yr=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 Go=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 Jr=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 _t=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 Xr=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 Qr=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 Vr=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 ei=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 ti=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 Zo=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 ni=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 oi=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 Yo=ae("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);const si=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 Jo=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 ri=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 Xo=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 fn=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 ii=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 Qo=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 li=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 Wn=ae("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),ai={class:"border-t pt-3 mt-4"},ci={class:"flex gap-2"},di={class:"relative flex items-center justify-center shrink-0 overflow-hidden rounded-full h-5 w-5 bg-gray-200"},fi={class:"flex-1 space-y-2"},pi={class:"flex justify-between items-center"},ui={class:"flex gap-2"},mi=["disabled"],Vo=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",ai,[e.createElementVNode("div",ci,[e.createElementVNode("span",di,[e.createVNode(e.unref(Qo),{class:"h-3 w-3 text-gray-500"})]),e.createElementVNode("div",fi,[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",pi,[c[4]||(c[4]=e.createElementVNode("span",{class:"text-xs text-gray-500 hidden sm:inline"},"Cmd+Enter to send",-1)),e.createElementVNode("div",ui,[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(Wn),{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(Jo),{class:"h-3 w-3 mr-1"}),c[3]||(c[3]=e.createTextVNode(" Send ",-1))],8,mi)])])])])]))}}),hi={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"},gi=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,u)=>(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",hi,[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(Xo),{class:"h-3 w-3 mr-2"}),u[0]||(u[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(fn),{class:"h-3 w-3 mr-2"}),u[1]||(u[1]=e.createTextVNode(" Delete ",-1))])])],512))}}),yi={class:"space-y-2"},vi={class:"relative flex items-center justify-center shrink-0 overflow-hidden rounded-full h-5 w-5 bg-gray-200"},bi={class:"flex-1 min-w-0 space-y-1 relative"},ki={class:"flex items-center gap-2"},Ei={class:"font-medium text-xs"},wi={class:"text-xs text-gray-500"},xi={key:0,class:"text-xs text-gray-700 leading-relaxed"},Ni={class:"flex justify-between text-xs"},Ci={class:"flex items-center gap-2"},Si={key:0,class:"flex gap-2"},_i=["disabled"],Bi={key:0,class:"ml-8 space-y-1 border-l-2 border-gray-100 pl-3"},$i=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),u=e.ref(!1),p=x=>{const _=new Date,W=Math.floor((_.getTime()-x.getTime())/(1e3*60*60));return W<1?`${Math.floor((_.getTime()-x.getTime())/6e4)}m`:W<24?`${W}h`:`${Math.floor(W/24)}d`},m=()=>{u.value=!u.value,u.value?o("like",s.comment.id,"add"):o("like",s.comment.id,"delete")},S=()=>{o("edit",s.comment.id,r.value),d.value=!1},w=(x,_)=>{o("like",x,_)},g=(x,_)=>{o("edit",x,_)};return(x,_)=>{const W=e.resolveComponent("CommentItem",!0);return e.openBlock(),e.createElementBlock("div",yi,[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",vi,[e.createVNode(e.unref(Qo),{class:"h-3 w-3 text-gray-500"})]),e.createElementVNode("div",bi,[e.createElementVNode("div",ki,[e.createElementVNode("span",Ei,e.toDisplayString(t.comment?.author),1),e.createElementVNode("span",wi,e.toDisplayString(p(t.comment?.createdAt)),1)]),d.value?e.withDirectives((e.openBlock(),e.createElementBlock("textarea",{key:1,"onUpdate:modelValue":_[0]||(_[0]=N=>r.value=N),class:e.normalizeClass(d.value?l.value:i.value)},null,2)),[[e.vModelText,r.value]]):(e.openBlock(),e.createElementBlock("p",xi,e.toDisplayString(t.comment?.text),1)),e.createElementVNode("div",Ni,[e.createElementVNode("div",Ci,[e.createElementVNode("button",{class:e.normalizeClass(["flex items-center gap-1",u.value?"text-blue-600":"text-gray-500 hover:text-blue-600 transition-colors"]),onClick:_[1]||(_[1]=N=>m())},[e.createVNode(e.unref(Vr),{class:e.normalizeClass(["h-3 w-3",u.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:_[2]||(_[2]=N=>c.value=!0)},[e.createVNode(e.unref(si),{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:_[3]||(_[3]=N=>a.value=!0)},[e.createVNode(e.unref(Jr),{class:"h-3 w-3"})])]),d.value?(e.openBlock(),e.createElementBlock("div",Si,[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:_[4]||(_[4]=N=>d.value=!1)},[e.createVNode(e.unref(Wn),{class:"h-3 w-3"}),_[11]||(_[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:_[5]||(_[5]=N=>S())},[e.createVNode(e.unref(Jo),{class:"h-3 w-3 mr-1"}),_[12]||(_[12]=e.createTextVNode(" Send ",-1))],8,_i)])):e.createCommentVNode("",!0)])]),a.value?(e.openBlock(),e.createBlock(gi,{key:0,showMoreOptions:a.value,"onUpdate:showMoreOptions":_[6]||(_[6]=N=>a.value=N),onEdit:_[7]||(_[7]=N=>d.value=!0),onDelete:_[8]||(_[8]=N=>x.$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",Bi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.comment?.replies,N=>(e.openBlock(),e.createBlock(W,{key:N.id,comment:N,isInside:!0,onDelete:C=>x.$emit("delete",N.id),onLike:w,onEdit:g},null,8,["comment","onDelete"]))),128)),c.value&&!t.isInside?(e.openBlock(),e.createBlock(Vo,{key:0,onSendComment:_[9]||(_[9]=N=>x.$emit("reply",t.comment?.id,N)),isReply:c.value,"onUpdate:isReply":_[10]||(_[10]=N=>c.value=N)},null,8,["isReply"])):e.createCommentVNode("",!0)]))])}}}),Ti=["id"],Li={key:0,class:"text-xl font-semibold text-gray-900 mb-4"},pn=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 p=await fetch(`/api/widget/comment/${o.id}`).then(m=>m.json());r.value=p.rows.map(m=>({id:m.communication_id,author:m.username,text:m.body,createdAt:new Date(m.cdate)}))}r.value.length===0&&i();const l=async p=>{o.onAddComment?o.onAddComment(p):o.id&&(await fetch(`/api/widget/comment/${o.id}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:p})}),await i()),s("add",p)},a=(p,m)=>{o?.onLike?.(p,m),s("like",p,m)},c=(p,m)=>{o.onReply?.(p,m),s("reply",p,m)},d=async(p,m)=>{o.onEdit?o.onEdit(p,m):o.id&&(await fetch(`/api/widget/comment/${o.id}/${p}`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({body:m})}),await i()),s("edit",p,m)},u=async p=>{o.onDelete?o.onDelete(p):o.id&&(await fetch(`/api/widget/comment/${o.id}/${p}`,{method:"DELETE"}),await i()),s("delete",p)};return(p,m)=>(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",Li,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,S=>(e.openBlock(),e.createBlock($i,{key:S.id,comment:S,onReply:c,onLike:a,onDelete:m[0]||(m[0]=w=>u(w)),onEdit:d},null,8,["comment"]))),128))],6),e.createVNode(Vo,{onSendComment:m[1]||(m[1]=S=>l(S))})],14,Ti))}}),es={CopyPlus:Yr,SquarePen:Xo,Trash2:fn},ts=new Map([["file",{name:"File",color:"bg-green-100 text-green-700 border-green-200",icon:_t}],["post",{name:"Post",color:"bg-blue-100 text-blue-700 border-blue-200",icon:ri}],["user",{name:"User",color:"bg-purple-100 text-purple-700 border-purple-200",icon:ii}],["custom",{name:"Custom",color:"bg-gray-100 text-gray-700 border-gray-200",icon:ei}]]);function ns(t){if(t==null||typeof t!="string")return null;const n=t.trim();if(!n)return null;const o=/^([-\d.]+)\s*,\s*([-\d.]+)$/.exec(n);if(o){const a=Number(o[1]),c=Number(o[2]);if(Number.isFinite(a)&&Number.isFinite(c))return{type:"Point",coordinates:[a,c]}}const s=n.indexOf("(");if(s<0)return null;const r=n.slice(0,s).trim().toUpperCase(),i=n.slice(s).replace(/[()]/g,""),l=a=>a.trim().split(/\s+/).map(Number);try{if(r==="POINT"){const a=l(i);return!Number.isFinite(a[0])||!Number.isFinite(a[1])?null:{type:"Point",coordinates:a}}if(r==="LINESTRING"){const a=i.split(",").map(l);return!a.length||a.some(c=>!Number.isFinite(c[0])||!Number.isFinite(c[1]))?null:{type:"LineString",coordinates:a}}if(r==="POLYGON"){const a=i.split(",").map(l);return!a.length||a.some(c=>!Number.isFinite(c[0])||!Number.isFinite(c[1]))?null:{type:"Polygon",coordinates:[a]}}}catch{return null}return null}function os(t){if(t==null||typeof t!="string")return!1;const n=t.trim().toUpperCase();return n.startsWith("POINT(")||n.startsWith("LINESTRING(")||n.startsWith("POLYGON(")}function ss(t){if(!t)return null;let n=1/0,o=1/0,s=-1/0,r=-1/0;const i=a=>{if(typeof a[0]=="number"){const[c,d]=a;n=Math.min(n,c),o=Math.min(o,d),s=Math.max(s,c),r=Math.max(r,d);return}a.forEach(c=>i(c))},l=t.coordinates;return!l||(i(l),n===1/0||o===1/0)?null:[n,o,s,r]}function Ai(t,n){return t?n?[Math.min(t[0],n[0]),Math.min(t[1],n[1]),Math.max(t[2],n[2]),Math.max(t[3],n[3])]:t:n}function un(t){if(!t)return[];const n=t.coordinates;if(!n)return[];if(t.type==="Point")return[n];if(t.type==="LineString")return n;if(t.type==="Polygon"){const o=n[0]??[];if(o.length<2)return o;const s=o[0],r=o[o.length-1],i=1e-8;return Math.abs(s[0]-r[0])<i&&Math.abs(s[1]-r[1])<i?o.slice(0,-1):o}return[]}const mn=1e-8;function Di(t,n){const o=un(t),s=un(n);if(!o.length&&!s.length)return 0;if(!o.length)return s.length;if(!s.length)return o.length;const r=(d,u)=>Math.abs(d[0]-u[0])<mn&&Math.abs(d[1]-u[1])<mn,i=new Set,l=new Set;for(let d=0;d<o.length;d++)for(let u=0;u<s.length;u++)if(r(o[d],s[u])){i.add(d),l.add(u);break}const a=o.length-i.size,c=s.length-l.size;return Math.max(a,c)}function Ii(t,n){const o=un(t),s=un(n),r=(d,u)=>Math.abs(d[0]-u[0])<mn&&Math.abs(d[1]-u[1])<mn,i=new Set,l=new Set;for(let d=0;d<o.length;d++)for(let u=0;u<s.length;u++)if(r(o[d],s[u])){i.add(d),l.add(u);break}const a=o.filter((d,u)=>!i.has(u)),c=s.filter((d,u)=>!l.has(u));return{removed:a,added:c}}function rs(t){return t?{type:"FeatureCollection",features:[{type:"Feature",geometry:t}]}:null}function is(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 Oi(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 Mi="https://unpkg.com/imask@7.6.1/dist/imask.min.js";let qn=null;function Fi(){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 Pi(){return qn||(qn=is(Mi).then(()=>{const t=Fi();if(!t)throw new Error("IMask is not available after loading the script");return t})),qn}function Ri(){return typeof window>"u"?"":window.location?.origin??""}function ls(){if(!(typeof window>"u"))return window.maplibregl}const as=Symbol("vs-widget-map");function Kn(t){if(t==null||t==="")return"";if(typeof t=="object")try{return JSON.stringify(t)}catch{return""}return String(t)}function zi(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 ji(t){return typeof t=="string"?document.getElementById(t):"value"in t?t.value??null:t}function Gn(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=Ri(),i=s.replace(/^\/+/,"");return r?`${r}/${i}`:i?`/${i}`:""}function Hi(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 Ui(t){return t.sourceLayer||t.layer||t.service_layer||t.service_key||t.map_key||t.dataset?.layer||t.id?.toString()}function hn(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 cs=["#1d4ed8","#db2777","#059669","#f97316","#0ea5e9","#d946ef","#facc15","#14b8a6","#e11d48","#16a34a"];function Wi(t){const n=t?.color??cs[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)}):cs.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 Wt="map-highlight-source",qi="map-highlight-fill",Ki="map-highlight-line";function Gi(t){return t?typeof t.toJSON=="function"?t.toJSON():t.geometry?{type:"Feature",geometry:t.geometry,properties:t.properties??{}}:null:null}function ds(t,n){return t?t.replace(/\{([^}]+)\}/g,(o,s)=>{const r=n?.[s];return r==null?"":String(r)}):""}async function Zi(){return Oi("https://unpkg.com/maplibre-gl@^5.6.2/dist/maplibre-gl.css"),await is("https://unpkg.com/maplibre-gl@^5.6.2/dist/maplibre-gl.js"),ls()}function gn(t){const n=e.inject(as,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 u=t.style??null,p=null;const m=h=>{h&&(o.value?o.value.setStyle(h):u=h)},S=()=>{r.value.overlays=l.value.map(h=>({id:h.id,name:h.config.name,visible:h.visible}))},w=h=>{const j=Array.isArray(h)?h:[];i.value=j,j.some($=>$.key===r.value.selectedBasemap)||(r.value.selectedBasemap=j[0]?.key??"")},g=h=>{h&&l.value.forEach(j=>{j.layerIds.forEach(b=>{h.getLayer(b)&&h.removeLayer(b)}),h.getSource(j.sourceId)&&h.removeSource(j.sourceId),j.layerIds=[]})},x=()=>{const h=o.value;!h||typeof h.isStyleLoaded!="function"||!h.isStyleLoaded()||(l.value.forEach(j=>{_(h,j)}),H())},_=(h,j)=>{const b=Hi(j.config);b==="vtile"?N(h,j):b==="raster"&&W(h,j)},W=(h,j)=>{const b=j.config,$=j.sourceId,O=Gn(b.url);if(!O)return;h.getSource($)||h.addSource($,{type:"raster",tiles:[O],minzoom:b.minzoom??0,maxzoom:b.maxzoom??24});const P=`${j.id}-raster`;h.getLayer(P)||h.addLayer({id:P,type:"raster",source:$,layout:{visibility:j.visible?"visible":"none"}}),j.layerIds=[P],C(h,j)},N=(h,j)=>{const b=j.config,$=j.sourceId,O=Gn(b.url);if(!O)return;h.getSource($)||h.addSource($,{type:"vector",tiles:[O],minzoom:b.minzoom??0,maxzoom:b.maxzoom??24});const P=b.style??{},Z=Wi(P),X=[],se={visibility:j.visible?"visible":"none"},ie=Ui(b),pe={source:$,layout:se};if(ie&&(pe["source-layer"]=ie),(P.type??"polygon").toLowerCase()==="point"){const Ee=`${j.id}-circle`;h.getLayer(Ee)||h.addLayer({id:Ee,type:"circle",...pe,paint:{"circle-color":Z,"circle-opacity":P.opacity??1,"circle-radius":P.radius??P.width??3,"circle-stroke-color":P.stroke??P.color??"#ffffff","circle-stroke-width":P.width??1}}),X.push(Ee);const Te=P.text??P.label;if(Te){const nt=`${j.id}-symbol`,an=hn(P.textSize)??10,zt=P.textHaloColor??P.stroke??"#ffffff",jt=hn(P.textHaloWidth)??1,xt=hn(P.textZoom??P.pointZoom),Nt={"text-color":P.textColor??"#000000","text-halo-color":zt,"text-halo-width":jt},ut={id:nt,type:"symbol",...pe,layout:{"text-field":["coalesce",["get",Te],""],"text-size":an,"text-anchor":"top"},paint:Nt};xt!=null&&(ut.minzoom=xt),h.getLayer(nt)||h.addLayer(ut),X.push(nt)}}else{const Ee=`${j.id}-fill`;h.getLayer(Ee)||h.addLayer({id:Ee,type:"fill",...pe,paint:{"fill-color":Z,"fill-opacity":P.opacity??.5,"fill-outline-color":P.stroke??P.color??"#0ea5e9"}}),X.push(Ee);const Te=`${j.id}-line`;h.getLayer(Te)||h.addLayer({id:Te,type:"line",...pe,paint:{"line-color":P.stroke??P.color??"#0b74c4","line-width":hn(P.width??P.border)??1,"line-opacity":P.opacity??1}}),X.push(Te)}j.layerIds=X,C(h,j)},C=(h,j)=>{const b=j.visible?"visible":"none";j.layerIds.forEach($=>{h.getLayer($)&&h.setLayoutProperty($,"visibility",b)})},T=h=>{const j=Array.isArray(h)?h:[];g(o.value??void 0),d.value=null,I();const b=j.map(($,O)=>{if(!$)return null;const P=Gn($.url);if(!P)return null;const Z=$.id!=null?String($.id):`overlay-${O}`;return{id:Z,config:{...$,id:Z,url:P},visible:!1,sourceId:`${Z}-source`,layerIds:[]}}).filter($=>!!$);l.value=b,S(),x()},v=(h,j)=>{const b=l.value.find(O=>O.id===h);if(!b)return;b.visible=j,S();const $=o.value;if(!(!$||typeof $.isStyleLoaded!="function"||!$.isStyleLoaded())){if(!b.layerIds.length){_($,b);return}C($,b)}},E=()=>{a.value&&(a.value.remove(),a.value=null)},y=(h,j={})=>!Array.isArray(h.popup)||!h.popup.length?[]:h.popup.map(b=>({label:b.label??b.field,value:Kn(j?.[b.field])})).filter(b=>b.label&&b.value!==void 0),D=h=>{const j=o.value;if(!j||!h?.point)return;const b=j.queryRenderedFeatures(h.point);for(const $ of b){const O=$.layer?.id??$.sourceLayer;if(!O)continue;const P=je(O);if(!P)continue;const Z=y(P,$.properties??$.layer?.properties??{});if(!Z.length)continue;const X=zi(Z),se=ls();if(!se)return;const ie=h.lngLat;if(c.value===O&&a.value){a.value.setLngLat(ie),a.value.setHTML(X);return}c.value=O,E(),a.value=new se.Popup({closeButton:!1,closeOnClick:!1}).setLngLat(ie).setHTML(X).addTo(j);return}c.value=null,E()},R=()=>{c.value=null,E()},H=()=>{const h=o.value;!h||typeof h.isStyleLoaded!="function"||!h.isStyleLoaded()||h.getSource(Wt)||(h.addSource(Wt,{type:"geojson",data:{type:"FeatureCollection",features:[]}}),h.addLayer({id:qi,type:"fill",source:Wt,paint:{"fill-color":"#2563eb","fill-opacity":.35}}),h.addLayer({id:Ki,type:"line",source:Wt,paint:{"line-color":"#1d4ed8","line-width":2}}))},K=h=>{const j=o.value;if(!j||typeof j.isStyleLoaded!="function"||!j.isStyleLoaded())return;H();const b=j.getSource(Wt);if(!(!b||typeof b.setData!="function")){if(!h){b.setData({type:"FeatureCollection",features:[]});return}b.setData({type:"FeatureCollection",features:[h]})}},G=h=>{const j=Gi(h);j&&K(j)},I=()=>{K(null)},z=()=>{d.value=null,I()},B=h=>{if(h)return typeof h=="string"?h:h.field??h.name??h.key??h.label},q=h=>{if(h)return typeof h=="string"?h:h.label??h.title??h.field??h.name},ee=(h,j)=>!h||!h.length?[]:h.map(b=>{const $=B(b);if(!$)return null;const O=q(b),P=Kn(j?.[$]);return!O||P===""?null:{label:O,value:P}}).filter(b=>!!b),Be=(h,j)=>!Array.isArray(h)||!h.length?[]:h.map(b=>{if(!b?.name)return null;const $=b.title??b.name,O=Kn(j?.[b.name]);return!$||O===""?null:{label:$,value:O}}).filter(b=>!!b),me=(h,j)=>!Array.isArray(h)||!h.length?[]:h.map($=>{const O=ds($.url,j),P=$.label??$.url;return O?{label:P,url:O,target:$.target}:null}).filter($=>!!$),he=async(h,j)=>{const b=ds(h,j);if(!b)return null;try{const $=await fetch(b);return $.ok?await $.json():null}catch{return null}},$e=async(h,j)=>{const b=j.properties??j.layer?.properties??{},$=ee(h.card?.rows,b);let O,P;if(h.card?.api){const se=await he(h.card.api,b);se&&(typeof se.html=="string"&&se.html.trim()&&(O=se.html),Array.isArray(se.columns)&&se.columns.length&&(P=se.columns))}let Z=$;if(!O&&P){const se=Be(P,b);se.length&&(Z=se)}if(!Z.length&&!O)return null;const X=me(h.card?.actions,b);return{title:b?.name??h.name,rows:Z,html:O,actions:X.length?X:void 0}},pt=async h=>{const j=o.value;if(!j||!h?.point)return;const b=j.queryRenderedFeatures(h.point);for(const $ of b){const O=$.layer?.id??$.sourceLayer;if(!O)continue;const P=je(O);if(!P||!P.card)continue;const Z=await $e(P,$);if(Z){d.value=Z,G($);return}}d.value=null,I()},wt=()=>{const h=o.value;h&&(h.on("mousemove",D),h.on("mouseleave",R),h.on("click",pt))},Pe=()=>{const h=o.value;h&&(h.off("mousemove",D),h.off("mouseleave",R),h.off("click",pt),E(),I())},je=h=>{if(h)return l.value.find(j=>j.layerIds.includes(h))?.config},tt=async()=>{const h=await Zi(),j=ji(t.container);if(!h||!j)return;const b={container:j,center:t.center??[30.524,50.45],zoom:t.zoom??10,style:u??t.style??{version:8,sources:{},layers:[]},attributionControl:!1,...t.mapOptions};o.value=new h.Map(b);const $=()=>{x()};p=$,o.value.on("style.load",$),o.value.on("load",()=>{s.value=!0,u&&o.value&&(o.value.setStyle(u),u=null),x(),wt()})};e.onMounted(tt),e.onBeforeUnmount(()=>{Pe(),o.value&&p&&o.value.off("style.load",p),g(o.value??void 0),o.value?.remove(),o.value=null,s.value=!1});const Ke={map:o,ready:s,setStyle:m,flyTo:h=>o.value?.flyTo(h),fitBounds:(h,j)=>o.value?.fitBounds(h,j),setCenter:h=>o.value?.setCenter(h),setZoom:h=>o.value?.setZoom(h),addControl:(h,j)=>o.value?.addControl(h,j),removeControl:h=>o.value?.removeControl(h),on:(h,...j)=>o.value?.on(h,...j),off:(h,...j)=>o.value?.off(h,...j),project:h=>o.value?.project(h),unproject:h=>o.value?.unproject(h),state:r,basemapOptions:i,setOverlays:T,toggleOverlay:v,getOverlayConfig:je,selectedCard:d,setBasemapOptions:w,clearCard:z};return e.provide(as,Ke),Ke}const Yi={class:"map-base-layer-menu"},Ji={key:1,class:"z-[500] bg-white absolute top-[10px] right-[10px] p-1.5 border rounded-lg text-sm cursor-pointer layers-button"},Xi={class:"flex items-center justify-between p-2 border-b"},Qi={class:"p-2 border-b"},Vi={class:"flex items-center"},el=["value","checked","onChange"],tl={class:"ml-2"},nl={class:"p-2"},ol={class:"flex items-center"},sl=["checked"],rl=["checked","onChange"],il={class:"ml-2"},ll=e.defineComponent({__name:"LayerMenu",setup(t){const{state:n,basemapOptions:o,setBasemap:s,toggleGeometry:r,toggleOverlay:i}=gn(),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??""),u=e.computed(()=>n.value.geometryVisible??!0),p=e.computed(()=>n.value.overlays??[]),m=g=>{s?.(g)},S=()=>{r?.(!u.value)},w=g=>{i?.(g.id,!g.visible)};return(g,x)=>(e.openBlock(),e.createElementBlock("div",Yi,[l.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,onClick:x[0]||(x[0]=_=>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",Ji,[e.createElementVNode("div",Xi,[x[3]||(x[3]=e.createElementVNode("div",null,"Шари",-1)),e.createElementVNode("button",{type:"button",class:"text-gray-500 hover:text-gray-800",onClick:x[1]||(x[1]=_=>l.value=!1)},[...x[2]||(x[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",Qi,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,_=>(e.openBlock(),e.createElementBlock("div",{key:_.key},[e.createElementVNode("label",Vi,[e.createElementVNode("input",{type:"radio",name:a,value:_.key,checked:d.value===_.key,onChange:W=>m(_.key)},null,40,el),e.createElementVNode("span",tl,e.toDisplayString(_.name||_.key),1)])]))),128))]),e.createElementVNode("div",nl,[e.createElementVNode("label",ol,[e.createElementVNode("input",{type:"checkbox",checked:u.value,onChange:S},null,40,sl),x[4]||(x[4]=e.createElementVNode("span",{class:"ml-2"},"Геометрія/Межі",-1))]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(p.value,_=>(e.openBlock(),e.createElementBlock("label",{class:"flex items-center",key:_.id},[e.createElementVNode("input",{type:"checkbox",checked:_.visible,onChange:W=>w(_)},null,40,rl),e.createElementVNode("span",il,e.toDisplayString(_.name||_.id),1)]))),128))])])):e.createCommentVNode("",!0)]))}}),al={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]"},cl={class:"leading-tight"},dl=e.defineComponent({__name:"Legend",props:{items:{}},setup(t){return(n,o)=>t.items.length?(e.openBlock(),e.createElementBlock("div",al,[(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",cl,e.toDisplayString(s.label),1)]))),128))])):e.createCommentVNode("",!0)}}),fl={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]"},pl={class:"font-mono"},ul=e.defineComponent({__name:"CursorCoordinates",props:{coordinates:{}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",fl,[e.createElementVNode("span",pl,e.toDisplayString(t.coordinates),1)]))}}),ml={class:"map-search-widget absolute top-[10px] left-[10px] flex flex-col gap-2 rounded-xl widget min-w-[200px]"},hl=["title"],gl={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"},yl=["onClick"],vl=["placeholder"],bl={class:"divide-y divide-gray-100"},kl=["onClick"],El=600,wl="0000000000:00:000:0000",xl=30,Nl=8,Cl="https://data.softpro.ua/api-user/gis-url-proxy",Sl="https://geo.rv.ua/api-user/dzk.api",_l="https://nominatim.openstreetmap.org/search",Bl=e.defineComponent({__name:"MapSearchWidget",props:{config:{}},setup(t){const n=t,o=gn(),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 b=n.config?.tools?.filter($=>l.includes($));return b&&b.length?b:l}),c={here:"Пошук…",xy:`50.4501 30.5234 або 50°27'00"N 30°31'24"E`,parcel:"Пошук…",address:"Пошук…"},d=e.computed(()=>{const b=n.config?.placeholder?.trim();return b||c[u.value]||"Пошук…"}),u=e.ref(a.value[0]);e.watch(a,b=>{b.includes(u.value)||(u.value=b[0])});const p=e.ref(""),m=e.ref(!1),S=e.ref(null),w=e.ref(null),g=e.ref(null),x=e.ref([]),_=e.ref(null),W=e.computed(()=>u.value==="address"&&x.value.length>0);let N=null,C=null,T=null;const v=e.reactive({position:"absolute",left:"0px",top:"0px",width:"100%",display:"none"});function E(){if(!w.value)return;const b=w.value.getBoundingClientRect(),$=b.width+xl,O=b.left+window.scrollX,P=b.bottom+window.scrollY+Nl;v.left=`${O}px`,v.top=`${P}px`,v.width=`${$}px`,v.display="block"}const y=()=>{W.value&&E()};function D(){N&&(clearTimeout(N),N=null)}function R(){C?.destroy(),C=null}async function H(){if(u.value!=="parcel")return;const b=g.value;if(!b)return;const $=await Pi();u.value==="parcel"&&(R(),C=$(b,{mask:wl,lazy:!1,placeholderChar:"_"}),C.on("accept",()=>{p.value=C?.value??""}))}function K(){return(C?.value??p.value).trim()}function G(){if(!(typeof window>"u"))return window.maplibregl}function I(b){const $=o.map.value;if(!$)return;const O=G();if(O){if(T){T.setLngLat([b.lng,b.lat]);return}T=new O.Marker({color:"#2563eb"}).setLngLat([b.lng,b.lat]).addTo($)}}function z(){T&&(T.remove(),T=null)}e.watch(u,b=>{p.value="",m.value=!1,x.value=[],D(),b==="parcel"?e.nextTick(()=>{H().catch($=>{Ce.notify({type:"error",title:"Маска кадастру",message:$?.message||"Не вдалося ініціалізувати маску"})})}):R()}),e.watch(W,b=>{b?e.nextTick(()=>{E()}):v.display="none"}),e.watch(p,b=>{if(u.value!=="address"){x.value=[],D();return}if(!b.trim()){x.value=[],D();return}D(),N=window.setTimeout(()=>{je(b).catch($=>{const O=$?.message||"Помилка пошуку адреси";Ce.notify({type:"error",title:"Пошук адреси",message:O})})},El)});function B(b){u.value=b}function q(b){const $=b.target;if(m.value){const O=S.value;O&&!O.contains($)&&(m.value=!1)}if(W.value){const O=_.value;O&&!O.contains($)&&(x.value=[])}}e.onMounted(()=>{window.addEventListener("click",q,!0),window.addEventListener("scroll",y,!0),window.addEventListener("resize",y),u.value==="parcel"&&e.nextTick(()=>{H().catch(b=>{Ce.notify({type:"error",title:"Маска кадастру",message:b?.message||"Не вдалося ініціалізувати маску"})})})}),e.onBeforeUnmount(()=>{window.removeEventListener("click",q,!0),window.removeEventListener("scroll",y,!0),window.removeEventListener("resize",y),D(),R(),z()});function ee(b){return b==="xy"?"Координати":b==="parcel"?"Кадастр":"Адреси"}const Be=/([+-]?\d{1,3})\s*[°º˚]\s*(\d{1,2})\s*['’′`]\s*(\d{1,2}(?:\.\d+)?)\s*["”″]\s*([NSEW])/gi;function me(b,$){const O=Number(b[1]),P=Number(b[2]),Z=Number(b[3]),X=String(b[4]).toUpperCase();if(!Number.isFinite(O)||!Number.isFinite(P)||!Number.isFinite(Z)||$==="lat"&&!(X==="N"||X==="S")||$==="lng"&&!(X==="E"||X==="W")||P<0||P>59||Z<0||Z>59)return null;const pe=Math.abs(O),He=$==="lat"?90:180;if(pe>He||pe===He&&(P!==0||Z!==0))return null;const Ee=pe+P/60+Z/3600;return X==="S"||X==="W"?-Ee:Ee}function he(b){const $=b.trim();if(!$)return{ok:!1};Be.lastIndex=0;const O=[...$.matchAll(Be)];if(O.length!==2)return{ok:!1};if(Be.lastIndex=0,$.replace(Be," ").replace(/[\s,;]+/g,"").trim().length)return{ok:!1};const Z=me(O[0],"lat"),X=me(O[1],"lng");return!Number.isFinite(Z)||!Number.isFinite(X)?{ok:!1}:{ok:!0,lat:Z,lng:X}}function $e(b){const $=he(b);if($.ok)return $;const O=b.replace(/[,]+/g," ").trim();if(!O)return{ok:!1};const P=O.split(/\s+/).filter(Boolean);if(P.length<2)return{ok:!1};const Z=P.slice(0,2).map(Number);if(!Z.every(Te=>Number.isFinite(Te)))return{ok:!1};let[X,se]=Z,ie=X,pe=se;const He=Te=>Math.abs(Te)<=90,Ee=Te=>Math.abs(Te)<=180;if(!He(ie)||!Ee(pe))if(He(pe)&&Ee(ie))ie=se,pe=X;else return{ok:!1};return{ok:!0,lat:ie,lng:pe}}function pt(b){return(b?.items||[]).map((O,P)=>{const Z=Number(O?.position?.lat),X=Number(O?.position?.lng);return!Number.isFinite(Z)||!Number.isFinite(X)?null:{id:String(O?.id??P),title:O?.title||O?.address?.label||"Знайдений обʼєкт",lat:Z,lng:X}}).filter(O=>!!O)}function wt(b){const $=b?.result||b?.data||b;if(!$)return[];const O=$.geom_centroid;if(!O||!Array.isArray(O.coordinates))return[];const[P,Z]=O.coordinates;return!Number.isFinite(Z)||!Number.isFinite(P)?[]:[{id:"parcel",title:$.cadnum||$.cad_num||"Земельна ділянка",lat:Z,lng:P}]}function Pe(b){return(Array.isArray(b?.features)?b.features:[]).map((O,P)=>{const Z=O?.geometry?.coordinates,X=Number(Z?.[0]),se=Number(Z?.[1]);if(!Number.isFinite(se)||!Number.isFinite(X))return null;const ie=O?.properties||{},pe=ie?.geocoding?.label||ie?.display_name||ie?.label||"Адреса";return{id:String(ie?.geocoding?.place_id||ie?.place_id||P),title:pe,lat:se,lng:X}}).filter(O=>!!O)}async function je(b){x.value=[],D();const $=new URL(_l);$.searchParams.set("format","geojson"),$.searchParams.set("q",b),$.searchParams.set("addressdetails","1"),$.searchParams.set("bounded","1");const O=r();O&&$.searchParams.set("viewbox",O);const P=await fetch($.toString());if(!P.ok)throw new Error(`HTTP ${P.status}`);const Z=await P.json(),X=Pe(Z);if(!X.length){Ce.notify({type:"warning",title:"Пошук адреси",message:"Не знайдено результатів"});return}x.value=X}function tt(b){h(b),x.value=[],p.value=""}function Ke(b){const O=b.replace(/\s+/g,"").split(":");if(O.length!==4)return!1;const P=[10,2,3,4];return O.every((Z,X)=>Z.length===P[X]&&/^\d+$/.test(Z))}function h(b){const $=n.config?.zoom??17;o.flyTo?.({center:[b.lng,b.lat],zoom:$}),I(b)}async function j(){const b=u.value==="parcel"?K():p.value.trim();if(b){if(u.value==="xy"){const $=$e(b);if(!$.ok){Ce.notify({type:"warning",title:"Пошук координат",message:"Використайте `lat lon` або DMS у форматі `50°27'00\"N 30°31'24\"E`."});return}h($),p.value="";return}if(u.value==="address"){try{await je(b)}catch($){const O=$?.message||"Помилка пошуку адреси";Ce.notify({type:"error",title:"Пошук адреси",message:O})}return}try{const $=new URL(u.value==="here"?Cl:Sl);if(u.value==="here")$.searchParams.set("searchtext",b);else{if(!Ke(b)){Ce.notify({type:"warning",title:"Пошук кадастру",message:"Кадастровий номер має формат ХХХХХХХХХХ:ХХ:ХХХ:ХХХХ"});return}$.searchParams.set("cad_num",b)}const O=await fetch($.toString());if(!O.ok)throw new Error(`HTTP ${O.status}`);const P=await O.json(),Z=u.value==="here"?pt(P):wt(P);if(!Z.length)Ce.notify({type:"warning",title:"Пошук",message:"Не знайдено результатів"});else{const X=Z[0];h(X),u.value==="parcel"&&C&&(C.value=""),p.value=""}}catch($){const O=$?.message||"Помилка пошуку";Ce.notify({type:"error",title:"Пошук",message:O})}}}return(b,$)=>(e.openBlock(),e.createElementBlock("div",ml,[e.createElementVNode("form",{class:"flex gap-2",onSubmit:e.withModifiers(j,["prevent"])},[a.value.length>1?(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"dropdownRef",ref:S,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:$[0]||($[0]=O=>m.value=!m.value)},[e.createElementVNode("span",{class:"block w-full truncate",title:ee(u.value)},e.toDisplayString(ee(u.value)),9,hl),(e.openBlock(),e.createElementBlock("svg",{class:e.normalizeClass(["w-4 h-4 text-gray-500 transition-transform",{"rotate-180":m.value}]),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[...$[3]||($[3]=[e.createElementVNode("path",{d:"M6 9l6 6 6-6",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])],2))]),m.value?(e.openBlock(),e.createElementBlock("div",gl,[e.createElementVNode("ul",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,O=>(e.openBlock(),e.createElementBlock("li",{key:O,class:"px-3 py-2 cursor-pointer hover:bg-gray-100 text-gray-900",onClick:P=>B(O)},e.toDisplayString(ee(O)),9,yl))),128))])])):e.createCommentVNode("",!0)],512)):e.createCommentVNode("",!0),e.createElementVNode("div",{ref_key:"searchWrapperRef",ref:w,class:"relative flex-1 min-w-[140px] bg-white rounded-md"},[u.value==="parcel"?e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:0,ref_key:"parcelInputRef",ref:g,"onUpdate:modelValue":$[1]||($[1]=O=>p.value=O),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,p.value,void 0,{trim:!0}]]):e.withDirectives((e.openBlock(),e.createElementBlock("input",{key:1,"onUpdate:modelValue":$[2]||($[2]=O=>p.value=O),placeholder:d.value,type:"text",class:"vs-input transition-all border block w-full border-gray-200 rounded-md focus:border-blue-100 border-solid !pr-8 py-1.5 pl-3 text-sm"},null,8,vl)),[[e.vModelText,p.value,void 0,{trim:!0}]]),$[4]||($[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)),W.value?(e.openBlock(),e.createBlock(e.Teleport,{key:2,to:"body"},[e.createElementVNode("div",{ref_key:"addressResultsRef",ref:_,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(v)},[e.createElementVNode("ul",bl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(x.value,O=>(e.openBlock(),e.createElementBlock("li",{key:O.id,class:"px-3 py-2 cursor-pointer hover:bg-gray-50",onClick:P=>tt(O)},e.toDisplayString(O.title),9,kl))),128))])],4)])):e.createCommentVNode("",!0)],512)],32)]))}}),$l={class:"map-center-control"},Tl=["aria-label"],Ll=e.defineComponent({directives:{tooltip:Ce.TooltipDirective},__name:"MapCenterControl",props:{center:{},zoom:{},targetCenter:{},targetZoom:{},targetLabel:{},targetAriaLabel:{}},setup(t){const n=t,{map:o,ready:s}=gn(),r=e.ref(null),i=e.ref(null),l=e.ref(null),a=e.ref(null);function c(w){if(Array.isArray(w)&&w.length>=2){const[g,x]=w.slice(0,2).map(_=>Number(_));return Number.isNaN(g)||Number.isNaN(x)?null:[g,x]}if(w&&typeof w=="object"){const g=w,x=g.lng??g.lon??g.long??g.x,_=g.lat??g.y;if(x!=null&&_!=null){const W=Number(x),N=Number(_);if(!Number.isNaN(W)&&!Number.isNaN(N))return[W,N]}}if(typeof w=="string"){const g=w.split(",").map(x=>Number(x.trim()));if(g.length>=2&&g.every(x=>!Number.isNaN(x)))return[g[0],g[1]]}return null}e.watch(()=>n.center,w=>{const g=c(w);g&&(r.value=g)},{immediate:!0}),e.watch(()=>n.zoom,w=>{const g=Number(w);Number.isNaN(g)||(i.value=g)},{immediate:!0}),e.watch(()=>n.targetCenter,w=>{l.value=c(w)},{immediate:!0}),e.watch(()=>n.targetZoom,w=>{const g=Number(w);a.value=Number.isNaN(g)?null:g},{immediate:!0});const d=e.computed(()=>n.targetLabel?.trim()||"Точка"),u=e.computed(()=>n.targetAriaLabel||"Перейти до точки"),p=e.computed(()=>!!l.value);e.onMounted(async()=>{const w=o.value;if(w){if(!r.value){const g=w.getCenter();r.value=[g.lng,g.lat]}i.value==null&&(i.value=w.getZoom())}});function m(){const w=o.value;if(!w)return;const g=r.value||(()=>{const _=w.getCenter();return[_.lng,_.lat]})(),x=i.value??w.getZoom();w.flyTo({center:g,zoom:x})}function S(){const w=o.value;if(!w||!l.value)return;const g=a.value??i.value??w.getZoom();w.flyTo({center:l.value,zoom:g})}return(w,g)=>{const x=e.resolveDirective("tooltip");return e.openBlock(),e.createElementBlock("div",$l,[p.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(m,["stop"])},[e.createVNode(e.unref(ti),{class:"w-4 h-4"})])),[[x,"Центр мапи"]]),p.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":u.value,onClick:e.withModifiers(S,["stop"])},[e.createVNode(e.unref(oi),{class:"w-4 h-4"})],8,Tl)),[[x,d.value]]):e.createCommentVNode("",!0)])}}}),Xe=(t,n)=>{const o=t.__vccOpts||t;for(const[s,r]of n)o[s]=r;return o},fs=Xe(Ll,[["__scopeId","data-v-73fcd71f"]]),Al={key:1,class:"absolute bottom-[50px] right-[10px] flex flex-col items-center gap-2 pointer-events-none z-[520]"},Dl={key:0,class:"flex flex-col items-center gap-2 pointer-events-auto"},Il=["aria-label"],Ol={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)]"},Ml={class:"text-slate-900 font-semibold mb-1"},Fl=["innerHTML"],Pl={key:1,class:"space-y-2"},Rl={class:"text-gray-500"},zl={class:"font-medium text-slate-900"},jl={key:2,class:"mt-2 flex flex-col gap-2"},Hl=["href","target"],mt="map-basemap-source",qt="map-basemap-layer",Ul=20,Bt="map-katottg-geometry-source",yn="map-katottg-geometry-line",rt="map-geometry-source",$t="map-geometry-fill",Tt="map-geometry-line",Lt="map-geometry-circle",Kt="map-highlight-points-source",Zn="map-highlight-points-layer",At=e.defineComponent({__name:"MapWidget",props:{height:{default:350},center:{},zoom:{},geom:{},bounds:{},highlightPoints:{},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(f){if(f){if(Array.isArray(f)&&f.length>=2){const F=Number(f[0]),U=Number(f[1]);return!Number.isFinite(F)||!Number.isFinite(U)?void 0:[F,U]}if(typeof f=="object"){const F=f,U=F.lng??F.lon??F.long??F.x,Y=F.lat??F.y;if(U!=null&&Y!=null){const ye=Number(U),Ue=Number(Y);if(Number.isFinite(ye)&&Number.isFinite(Ue))return[ye,Ue]}}}}function a(f){if(f==null)return;const F=Number(f);return Number.isFinite(F)?F:void 0}const c=()=>typeof window>"u"?"":window.location?.origin??"",d=f=>{if(!f)return"";const F=f.trim();if(!F)return"";const Y=F.replace(/\n/g,"").replace(/\r/g,"").replace(/\t/g,"").replace(/\s+/g,"");if(!Y)return"";if(/^https?:\/\//i.test(Y))return Y;const ye=c(),Ue=Y.replace(/^\/+/,"");return ye?`${ye}/${Ue}`:Ue?`/${Ue}`:""},u=e.computed(()=>n.katottg!=null?n.katottg:i.katottg),p=e.computed(()=>(Array.isArray(i.basemaps)&&i.basemaps.length?i.basemaps:o).map((U,Y)=>{const ye=typeof U.url=="string"?U.url.trim():"";return ye?{key:(U.key??U.name??`base-${Y}`).trim()||`base-${Y}`,url:ye,name:U.name??U.key??`Layer ${Y+1}`}:null}).filter(U=>!!U)),m=l(i.center),S=a(i.zoom),w=Wo(n.geom),g=Fr(w),x=g?[(g[0]+g[2])/2,(g[1]+g[3])/2]:void 0,_=e.ref(null),W=e.computed(()=>l(n.center)??null),N=e.computed(()=>W.value??m??null),C=f=>f?{version:8,sources:{[mt]:{type:"raster",tiles:[f],tileSize:256}},layers:[{id:qt,type:"raster",source:mt,layout:{visibility:"visible"}}]}:{version:8,sources:{},layers:[]},T=d(p.value[0]?.url),v=gn({container:_,center:x??N.value??void 0,zoom:n.zoom??S,style:C(T)}),{map:E,setCenter:y,setZoom:D,state:R,getOverlayConfig:H,selectedCard:K,setBasemapOptions:G,clearCard:I,addControl:z,removeControl:B,ready:q}=v,ee=e.computed({get:()=>R.value.selectedBasemap??"",set:f=>{R.value.selectedBasemap=f}}),Be=e.computed({get:()=>R.value.geometryVisible??!0,set:f=>{R.value.geometryVisible=f}}),me=e.computed(()=>{const f=n.height;return{height:typeof f=="number"?`${f}px`:String(f)}}),he=e.ref(!1),$e=e.ref(!1),pt=e.computed(()=>he.value?"!fixed inset-0 w-screen h-screen z-[9999] bg-white":"relative w-full"),wt=e.computed(()=>{const f=["w-full","h-full"];return he.value||f.push(`min-h-[${me.value.height}]`),f.join(" ")}),Pe=e.computed(()=>K.value),je=()=>I?.(),tt=e.ref(x??N.value??null),Ke=e.ref(n.zoom??S??null),h=e.ref(N.value);e.watch(N,f=>{h.value=f},{immediate:!0});const j=e.computed(()=>h.value??null),b=e.computed(()=>typeof n.zoom=="number"?n.zoom:typeof Ke.value=="number"?Ke.value:Ul),$=["home","fullscreen","scale","position","search"],O=e.computed(()=>!Array.isArray(n.tools)||!n.tools.length?$:n.tools.filter(f=>$.includes(f))),P=f=>O.value.includes(f);e.watch([E,q],([f,F])=>{if(!(!f||!F)){if(!tt.value){const U=f.getCenter();tt.value=[U.lng,U.lat]}Ke.value==null&&(Ke.value=f.getZoom())}},{immediate:!0});const Z=e.ref(null),X=e.ref(""),se=e.ref(null),ie=f=>f?$e.value?!0:typeof f.isStyleLoaded=="function"&&f.isStyleLoaded()?($e.value=!0,!0):!1:!1,pe=f=>{if(!f)return"";const F=Number(f.lat??f[1]),U=Number(f.lng??f[0]);return!Number.isFinite(F)||!Number.isFinite(U)?"":`${U.toFixed(5)}, ${F.toFixed(5)}`},He=f=>{f?.lngLat&&(X.value=pe(f.lngLat))},Ee=()=>{X.value=""},Te=f=>{f&&(f.on("mousemove",He),f.on("mouseleave",Ee),se.value=f)},nt=f=>{f&&(f.off("mousemove",He),f.off("mouseleave",Ee),se.value=null)},an=e.computed(()=>P("scale"));e.watch([E,q],([f,F],[U])=>{U&&nt(U),!(!f||!F)&&Te(f)},{immediate:!0}),e.watch([E,q,an],([f,F,U])=>{if(Z.value&&B&&(B(Z.value),Z.value=null),!f||!F||!U)return;const Y=window?.maplibregl;Y&&(Z.value=new Y.ScaleControl({unit:"metric"}),z?.(Z.value,"bottom-left"))},{immediate:!0});const zt=e.computed(()=>Array.isArray(n.legend)?n.legend.map((f,F)=>{const U=typeof f?.color=="string"?f.color.trim():"",Y=typeof f?.label=="string"?f.label.trim():"";return!U||!Y?null:{color:U,label:Y,key:`${Y}-${F}`}}).filter(f=>!!f):[]),jt=e.computed(()=>Array.isArray(n.layers)&&n.layers.length?n.layers:Array.isArray(i.layers)&&i.layers.length?i.layers:[]);e.watch(p,f=>{if(G?.(f),!f.length){ee.value="";return}f.some(F=>F.key===ee.value)||(ee.value=f[0].key)},{immediate:!0});const xt=f=>{if(!f?.getStyle)return;const F=f.getStyle()??{},U=Array.isArray(F.layers)?F.layers:[];return U.length?U.find(ye=>ye.type!=="background")?.id??U[0]?.id:void 0},Nt=f=>{f&&(f.getLayer(qt)&&f.removeLayer(qt),f.getSource(mt)&&f.removeSource(mt))},ut=(f,F)=>{if(!f)return;const U=xt(f);f.addSource(mt,{type:"raster",tiles:[F],tileSize:256}),f.addLayer({id:qt,type:"raster",source:mt,layout:{visibility:"visible"}},U)},jo=f=>{if(!f)return;const F=d(f.url);if(!F){ot.value=null;return}ot.value=F,Nt(E.value),L()},ot=e.ref(null),k=e.ref(T||null),M=f=>{if(!f||f.__pendingBasemapHooked)return;f.__pendingBasemapHooked=!0;const F=()=>{f.__pendingBasemapHooked=!1,L()};f.once("style.load",F),f.once("styledata",F)},L=()=>{const f=E.value,F=ot.value;if(!(!F||!f)){if(!ie(f)){M(f);return}if(k.value===F&&f.getSource(mt)&&f.getLayer(qt)){ot.value=null;return}Nt(f),ut(f,F),k.value=F,ot.value=null}},A=()=>{const f=ee.value;if(!f)return;const F=p.value.find(U=>U.key===f);F&&jo(F)};e.watch(ee,()=>{A()},{immediate:!0}),e.watch(jt,f=>{v.setOverlays?.(f)},{immediate:!0,deep:!0});const J=e.ref(null);let le=0;const ne=e.computed(()=>Wo(J.value)),Ne={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}},st={"line-color":"#1d4ed8","line-width":2,"line-dasharray":[6,4]},re=e.ref(w),Ye=e.ref(g),ge=e.ref(!1),Je=e.computed(()=>{if(!Ye.value)return null;const[f,F,U,Y]=Ye.value;return[(f+U)/2,(F+Y)/2]}),Ht=e.computed(()=>!!Ye.value),Re=e.ref(!1);e.ref(!1);const Ho=()=>{he.value=!he.value},Ge=e.ref(!1),Un=()=>{const f=E.value;if(!f||!ie(f))return;const F=re.value;if(!F){tm(f),Ir(f),cn();return}Dr(f);let U=f.getSource(rt);U?U.setData(F):(f.addSource(rt,{type:"geojson",data:F}),em(f),U=f.getSource(rt)),Or(f,Be.value?"visible":"none"),nm(),cn();const Y=n.bounds??Ye.value;if(Y){const ye=[[Y[0],Y[1]],[Y[2],Y[3]]],Ue=!!n.bounds;!Ge.value&&(Ue||!Re.value&&(ge.value||!0))?(typeof f.resize=="function"&&f.resize(),f.fitBounds(ye,{padding:20,maxZoom:18,duration:0}),Ge.value=!0,ge.value=!1,Re.value&&(Re.value=!1)):Re.value&&(Re.value=!1,ge.value=!1,Ge.value=!0)}},em=f=>{const F=Ne;f.getLayer($t)||f.addLayer({id:$t,type:"fill",source:rt,paint:F.fill}),f.getLayer(Tt)||f.addLayer({id:Tt,type:"line",source:rt,paint:F.line}),f.getLayer(Lt)||f.addLayer({id:Lt,type:"circle",source:rt,paint:F.circle,filter:["==","$type","Point"]})},tm=f=>{[Lt,Tt,$t].forEach(F=>{f.getLayer(F)&&f.removeLayer(F)}),f.getSource(rt)&&f.removeSource(rt)},Dr=f=>{const F=n.highlightPoints;if(!F?.length){Ir(f);return}const U={type:"FeatureCollection",features:F.map(ye=>({type:"Feature",geometry:{type:"Point",coordinates:ye},properties:{}}))};let Y=f.getSource(Kt);Y?Y.setData(U):(f.addSource(Kt,{type:"geojson",data:U}),f.addLayer({id:Zn,type:"circle",source:Kt,paint:{"circle-radius":4,"circle-color":"#dc2626","circle-stroke-color":"#fff","circle-stroke-width":2}}))},Ir=f=>{f.getLayer(Zn)&&f.removeLayer(Zn),f.getSource(Kt)&&f.removeSource(Kt)},Or=(f,F)=>{ie(f)&&[Lt,Tt,$t].forEach(U=>{f.getLayer(U)&&f.setLayoutProperty(U,"visibility",F)})},nm=()=>{const f=E.value;if(!f||!ie(f))return;const F=Ne;f.getLayer($t)&&Object.entries(F.fill).forEach(([U,Y])=>{f.setPaintProperty($t,U,Y)}),f.getLayer(Tt)&&Object.entries(F.line).forEach(([U,Y])=>{f.setPaintProperty(Tt,U,Y)}),f.getLayer(Lt)&&Object.entries(F.circle).forEach(([U,Y])=>{f.setPaintProperty(Lt,U,Y)})},Mr=f=>{f.getLayer(yn)||f.addLayer({id:yn,type:"line",source:Bt,layout:{visibility:"visible"},paint:st})},cn=()=>{const f=E.value;if(!f||!ie(f))return;const F=ne.value??{type:"FeatureCollection",features:[]};if(!f.getSource(Bt)){f.addSource(Bt,{type:"geojson",data:F}),Mr(f);return}const U=f.getSource(Bt);U&&typeof U.setData=="function"&&U.setData(F),Mr(f)},om=f=>{f.getLayer(yn)&&f.removeLayer(yn),f.getSource(Bt)&&f.removeSource(Bt)},sm=async f=>{const F=typeof f=="string"?f.trim():"",U=++le;if(!F){J.value=null;return}try{const Y=await fetch(`https://data.gki.com.ua/api-user/atu/${F}`);if(le!==U)return;if(!Y.ok){J.value=null;return}const ye=await Y.json();if(le!==U)return;J.value=ye}catch{if(le!==U)return;J.value=null}};e.watch(u,f=>{sm(f)},{immediate:!0}),e.watch(ne,()=>{cn()},{immediate:!0}),e.watch(()=>n.geom,f=>{re.value=Wo(f),Ye.value=Fr(re.value),Je.value&&(tt.value=Je.value),Ge.value=!1,ge.value=!0,Un()},{deep:!0,immediate:!0}),e.watch(()=>n.bounds,()=>{n.bounds&&(Ge.value=!1,ge.value=!0,Un())},{deep:!0}),e.watch(()=>n.highlightPoints,()=>{const f=E.value;f&&ie(f)&&Dr(f)},{deep:!0}),e.watch(Be,()=>{const f=E.value;f&&ie(f)&&Or(f,Be.value?"visible":"none")});const Ct=()=>{$e.value=!0,Un(),cn(),L()},Uo=()=>{Un(),cn()};e.watch(E,(f,F)=>{F&&(F.off("style.load",Ct),F.off("load",Ct),F.off("idle",Uo)),$e.value=!1,f&&(f.on("load",Ct),f.on("style.load",Ct),f.on("idle",Uo),typeof f.isStyleLoaded=="function"&&f.isStyleLoaded()&&Ct())}),e.watch(W,f=>{!E.value||!f||Ht.value||y(f)}),e.watch(()=>n.zoom,f=>{!E.value||typeof f!="number"||D(f)}),e.onBeforeUnmount(()=>{Z.value&&B&&B(Z.value),se.value?nt(se.value):E.value&&nt(E.value);const f=E.value;f&&(om(f),f.off("style.load",Ct),f.off("load",Ct),f.off("idle",Uo))});function rm(f){f&&(ee.value=f)}function im(f){Be.value=f}v.setBasemap=rm,v.toggleGeometry=im,v.setOverlays?.(jt.value);function Wo(f){if(!f)return null;if(f.type==="FeatureCollection")return f;if(f.type==="Feature")return{type:"FeatureCollection",features:[f]};const F=f.geometry??f;if(!F?.type)return null;if(F.type==="GeometryCollection"&&Array.isArray(F.geometries)){const U=F.geometries.filter(Y=>Y&&typeof Y.type=="string").map(Y=>({type:"Feature",geometry:Y}));return U.length?{type:"FeatureCollection",features:U}:null}if(F.type==="MultiPoint"&&Array.isArray(F.coordinates)){const U=F.coordinates.filter(Y=>Array.isArray(Y)&&Y.length>=2).map(Y=>({type:"Feature",geometry:{type:"Point",coordinates:Y}}));return U.length?{type:"FeatureCollection",features:U}:null}return{type:"FeatureCollection",features:[{type:"Feature",geometry:F}]}}function Fr(f){if(!f?.features?.length)return null;let F=1/0,U=1/0,Y=-1/0,ye=-1/0;const Ue=Ut=>{if(typeof Ut[0]=="number"){const[St,Pr]=Ut;F=Math.min(F,St),U=Math.min(U,Pr),Y=Math.max(Y,St),ye=Math.max(ye,Pr);return}Ut.forEach(St=>Ue(St))};return f.features.forEach(Ut=>{const St=Ut?.geometry?.coordinates;St&&Ue(St)}),F===1/0||U===1/0?null:[F,U,Y,ye]}return(f,F)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(pt.value),style:e.normalizeStyle(he.value?void 0:me.value)},[e.createElementVNode("div",{ref_key:"mapContainer",ref:_,class:e.normalizeClass(wt.value)},null,2),e.createVNode(dl,{items:zt.value},null,8,["items"]),P("search")?(e.openBlock(),e.createBlock(Bl,{key:0})):e.createCommentVNode("",!0),P("home")||P("fullscreen")?(e.openBlock(),e.createElementBlock("div",Al,[P("home")?(e.openBlock(),e.createElementBlock("div",Dl,[e.createVNode(fs,{center:j.value,zoom:b.value},null,8,["center","zoom"]),t.geom?(e.openBlock(),e.createBlock(fs,{key:0,"target-center":Je.value,"target-zoom":b.value,"target-label":"Об'єкт","target-aria-label":"Перейти до об'єкта"},null,8,["target-center","target-zoom"])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),P("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:Ho,"aria-label":he.value?"Вихід з повноекранного режиму":"Увімкнути повноекранний режим"},[...F[0]||(F[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,Il)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),Pe.value?(e.openBlock(),e.createElementBlock("div",Ol,[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:je},[...F[1]||(F[1]=[e.createElementVNode("span",{"aria-hidden":"true"},"×",-1)])]),e.createElementVNode("div",Ml,e.toDisplayString(Pe.value.title||"Об'єкт"),1),Pe.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(${me.value.height}-120px)]`]),innerHTML:Pe.value.html},null,10,Fl)):(e.openBlock(),e.createElementBlock("div",Pl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Pe.value.rows,U=>(e.openBlock(),e.createElementBlock("div",{key:U.label,class:"flex justify-between text-[0.85rem] text-slate-700"},[e.createElementVNode("span",Rl,e.toDisplayString(U.label)+":",1),e.createElementVNode("span",zl,e.toDisplayString(U.value),1)]))),128))])),Pe.value.actions?.length?(e.openBlock(),e.createElementBlock("div",jl,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Pe.value.actions,U=>(e.openBlock(),e.createElementBlock("a",{key:U.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:U.url,target:U.target??void 0,rel:"noreferrer"},e.toDisplayString(U.label),9,Hl))),128))])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0),e.createVNode(ll),P("position")&&X.value?(e.openBlock(),e.createBlock(ul,{key:3,class:"absolute bottom-[10px] right-[10px] z-[500]",coordinates:X.value},null,8,["coordinates"])):e.createCommentVNode("",!0)],6))}}),Wl={class:"text-sm text-gray-600"},ql={key:0,class:"inline-flex items-center gap-1"},Kl={class:"mt-2 border border-neutral-200 rounded-lg overflow-hidden bg-neutral-50"},Gl={key:0,class:"grid grid-cols-2 divide-x divide-neutral-200"},Zl={class:"p-3"},Yl={key:0,class:"geom-change-mini-map h-[120px] rounded border border-neutral-100 overflow-hidden",style:{"min-height":"120px"}},Jl={key:1,class:"h-[120px] rounded border border-neutral-100 flex items-center justify-center bg-white text-xs text-gray-400"},Xl={class:"p-3"},Ql={key:0,class:"geom-change-mini-map h-[120px] rounded border border-neutral-100 overflow-hidden",style:{"min-height":"120px"}},Vl={key:1,class:"h-[120px] rounded border border-neutral-100 flex items-center justify-center bg-white text-xs text-gray-400"},ea=Xe(e.defineComponent({__name:"GeomChange",props:{oldWkt:{default:null},newWkt:{default:null}},setup(t){const n=t,o=e.ref(!1),s=e.computed(()=>ns(n.oldWkt)),r=e.computed(()=>ns(n.newWkt)),i=e.computed(()=>{const g=n.oldWkt;return g==null||String(g).trim()===""?!1:!s.value}),l=e.computed(()=>{const g=n.newWkt;return g==null||String(g).trim()===""?!1:!r.value}),a=e.computed(()=>rs(s.value)),c=e.computed(()=>rs(r.value)),d=e.computed(()=>s.value?ss(s.value):null),u=e.computed(()=>r.value?ss(r.value):null),p=e.computed(()=>Ai(d.value,u.value)),m=e.computed(()=>{const g=Di(s.value,r.value);return g>0?g:null}),S=e.computed(()=>Ii(s.value,r.value)),w=e.computed(()=>{const g=m.value;return g==null?"":g===1?"вершина змінена":g>=2&&g<=4?"вершини змінено":"вершин змінено"});return(g,x)=>(e.openBlock(),e.createElementBlock("div",Wl,[e.createElementVNode("button",{type:"button",class:"flex items-center gap-2 text-xs text-gray-500 hover:text-gray-800 transition-colors py-1 mt-1",onClick:x[0]||(x[0]=_=>o.value=!o.value)},[e.createVNode(e.unref(Ko),{class:e.normalizeClass(["w-3.5 h-3.5",{"rotate-180":o.value}]),"stroke-width":1.5},null,8,["class"]),x[2]||(x[2]=e.createElementVNode("span",{class:"font-medium"},"Переглянути зміни геометрії",-1)),m.value!=null?(e.openBlock(),e.createElementBlock("span",ql,[x[1]||(x[1]=e.createElementVNode("span",{class:"w-1.5 h-1.5 rounded-full bg-rose-950"},null,-1)),e.createTextVNode(" "+e.toDisplayString(m.value)+" "+e.toDisplayString(w.value),1)])):e.createCommentVNode("",!0)]),e.withDirectives(e.createElementVNode("div",Kl,[o.value?(e.openBlock(),e.createElementBlock("div",Gl,[e.createElementVNode("div",Zl,[x[3]||(x[3]=e.createElementVNode("div",{class:"text-xs font-medium text-gray-500 mb-2"},"Було",-1)),a.value?(e.openBlock(),e.createElementBlock("div",Yl,[e.createVNode(At,{geom:a.value,bounds:p.value,"highlight-points":S.value.removed,height:"120px",tools:["scale"]},null,8,["geom","bounds","highlight-points"])])):(e.openBlock(),e.createElementBlock("div",Jl,e.toDisplayString(i.value?"Не вдалося прочитати геометрію":"—"),1))]),e.createElementVNode("div",Xl,[x[4]||(x[4]=e.createElementVNode("div",{class:"text-xs font-medium text-gray-500 mb-2"},"Стало",-1)),c.value?(e.openBlock(),e.createElementBlock("div",Ql,[e.createVNode(At,{geom:c.value,bounds:p.value,"highlight-points":S.value.added,height:"120px",tools:["scale"]},null,8,["geom","bounds","highlight-points"])])):(e.openBlock(),e.createElementBlock("div",Vl,e.toDisplayString(l.value?"Не вдалося прочитати геометрію":"—"),1))])])):e.createCommentVNode("",!0)],512),[[e.vShow,o.value]])]))}}),[["__scopeId","data-v-2c0770bb"]]),ta={class:"mx-auto font-sans"},na={class:"bg-white rounded-lg border border-neutral-200 p-4 sm:p-6"},oa={key:0,class:"py-8 text-center text-gray-500 text-sm"},sa={key:1,class:"py-8 text-center text-gray-500 text-sm"},ra={key:2,class:"space-y-6"},ia={class:"flex justify-end"},la={class:"flex items-center gap-2 mb-3 sticky top-0 bg-white py-2 z-20"},aa={class:"text-xs font-semibold text-gray-800 uppercase tracking-wide"},ca={class:"text-xs text-gray-500"},da={class:"relative"},fa={class:"bg-white border border-neutral-200 rounded-lg overflow-hidden divide-y divide-neutral-200"},pa=["onClick"],ua={class:"flex-shrink-0 w-3.5 h-3.5 flex items-center justify-center"},ma={class:"flex-1 min-w-0 flex items-center gap-2 text-sm"},ha={class:"font-medium text-gray-800"},ga={class:"text-gray-500"},ya={key:0},va=["title"],ba={class:"flex-shrink-0 flex items-center gap-2 text-xs text-gray-500 whitespace-nowrap"},ka={class:"px-4 pb-3 pl-[60px] space-y-2"},Ea={class:"space-y-1.5"},wa={class:"text-gray-500 font-[600] text-[0.92rem] min-w-[80px]"},xa={key:1,class:"flex items-center gap-2"},Na={class:"pl-2 text-gray-500 line-through"},Ca={class:"text-gray-800 font-semibold"},Sa={key:0,class:"mt-4 text-center"},_a={class:"text-xs text-gray-500"},vn=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(N){return N?Array.isArray(N)?N:Object.entries(N).map(([C,T],v)=>({changeDataId:`legacy-${v}`,entityKey:C,valueOld:String(T?.old??""),valueNew:String(T?.new??"")})):[]}function a(N){return l(N.changes).length>0}e.onMounted(async()=>{try{const N=await fetch("/api/suggest/change_type");if(!N.ok)return;const C=await N.json(),T=Array.isArray(C)?C:C?.data;if(!Array.isArray(T))return;const v=new Map;for(const E of T)E?.id!=null&&v.set(String(E.id).toLowerCase(),{text:E.text??E.id,icon:E.icon??null});i.value=v}catch{}}),o.value.length===0&&n.id&&W(),e.watch(()=>n.id,()=>{n.id&&W()});function c(N){return ts.get(N)??ts.get("custom")}function d(N){if(n.iconSource==="actionType"){const T=i.value.get((N.action??"").toLowerCase())?.icon;if(T&&T in es)return es[T]}return c(N.entityType)?.icon}const u=e.computed(()=>new Set(n.hideChangesValuesKeys??[]));function p(N){return i.value.get((N??"").toLowerCase())?.text??N??""}function m(N,C=3){const T=l(N.changes).map(E=>E.entityKey);if(T.length===0)return"";const v=T.slice(0,C).join(", ");return T.length>C?`${v} ...`:v}function S(N){try{return new Date(N+"T00:00:00").toLocaleDateString("uk-UA",{day:"numeric",month:"long",year:"numeric"})}catch{return N}}const w=e.computed(()=>{const N=new Map;for(const C of o.value){const T=C.changeDate??C.timestamp?.toLocaleDateString("uk-UA")??"unknown";if(!N.has(T)){const v=C.changeDate?S(C.changeDate):C.timestamp?.toLocaleDateString("uk-UA",{day:"numeric",month:"long",year:"numeric"})??"Без дати";N.set(T,{dateKey:T,dateDisplay:v,rows:[]})}N.get(T).rows.push(C)}return Array.from(N.values()).sort((C,T)=>T.dateKey.localeCompare(C.dateKey))}),g=e.computed(()=>o.value.filter(a).some(N=>!r[N.id]));function x(N){r[N]=!r[N]}function _(){const N=g.value;o.value.forEach(C=>{a(C)&&(r[C.id]=N)})}async function W(){if(n.id){s.value=!0;try{const N=await fetch(`/api/widget/history/${n.id}`);if(!N.ok){o.value=[];return}const T=((await N.json()).rows??[]).map(v=>({id:v.change_id??v.entity_id??"",entityId:v.entity_id??"",entityType:v.entity_type??"custom",action:v.change_type??"",userId:v.change_user_id??"",userName:v.username??"",timestamp:new Date(v.cdate),changeDate:v.change_date,login:v.login,avatar:v.avatar??null,changes:Array.isArray(v.changes)?v.changes.map(E=>({changeDataId:E.change_data_id,entityKey:E.entity_key,valueOld:E.value_old??"",valueNew:E.value_new??""})):[]}));o.value=T}finally{s.value=!1}}}return(N,C)=>(e.openBlock(),e.createElementBlock("div",ta,[e.createElementVNode("div",na,[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",oa," Завантаження... ")):o.value.length===0?(e.openBlock(),e.createElementBlock("div",sa," Немає записів ")):(e.openBlock(),e.createElementBlock("div",ra,[e.createElementVNode("div",ia,[e.createElementVNode("button",{onClick:_,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(Gr),{class:e.normalizeClass(["w-4 h-4",{"rotate-180":g.value}])},null,8,["class"]),e.createElementVNode("span",null,e.toDisplayString(g.value?"Розгорнути всі":"Згорнути всі"),1)])]),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(w.value,T=>(e.openBlock(),e.createElementBlock("div",{key:T.dateKey},[e.createElementVNode("div",la,[e.createElementVNode("h3",aa,e.toDisplayString(T.dateDisplay),1),C[0]||(C[0]=e.createElementVNode("div",{class:"flex-1 h-[1px] bg-neutral-200"},null,-1)),e.createElementVNode("span",ca,e.toDisplayString(T.rows.length),1)]),e.createElementVNode("div",da,[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",fa,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(T.rows,v=>(e.openBlock(),e.createElementBlock("div",{key:v.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(v)}]),onClick:E=>a(v)&&x(v.id)},[e.createElementVNode("div",ua,[a(v)?(e.openBlock(),e.createBlock(e.unref(Ko),{key:0,class:e.normalizeClass(["w-3.5 h-3.5 text-gray-500 transition-transform duration-200",{"rotate-180":r[v.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(v.entityType)?.color??"bg-gray-100"}`)},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(d(v)),{class:"w-4 h-4 relative z-10","stroke-width":"1.5"}))],2),e.createElementVNode("div",ma,[e.createElementVNode("span",ha,e.toDisplayString(v.userName),1),e.createElementVNode("span",ga,[e.createTextVNode(e.toDisplayString(p(v.action)),1),m(v)?(e.openBlock(),e.createElementBlock("span",ya,": "+e.toDisplayString(m(v)),1)):e.createCommentVNode("",!0)]),t.showEntityId&&v.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:v.entityId},e.toDisplayString(v.entityId),9,va)):e.createCommentVNode("",!0)]),e.createElementVNode("div",ba,[e.createElementVNode("span",null,e.toDisplayString(v.timestamp?.toLocaleTimeString("uk-UA",{hour:"2-digit",minute:"2-digit"})),1)])],10,pa),e.withDirectives(e.createElementVNode("div",ka,[e.createElementVNode("div",Ea,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l(v.changes),E=>(e.openBlock(),e.createElementBlock("div",{key:E.changeDataId,class:"flex flex-col gap-2 text-sm pl-2"},[e.createElementVNode("span",wa,e.toDisplayString(E.entityKey),1),u.value.has(E.entityKey)?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.unref(os)(E.valueOld)||e.unref(os)(E.valueNew)?(e.openBlock(),e.createBlock(ea,{key:0,"old-wkt":E.valueOld,"new-wkt":E.valueNew},null,8,["old-wkt","new-wkt"])):(e.openBlock(),e.createElementBlock("div",xa,[e.createElementVNode("span",Na,e.toDisplayString(E.valueOld),1),e.createVNode(e.unref(Kr),{class:"w-3 h-3 text-neutral-400 flex-shrink-0","stroke-width":"1.5"}),e.createElementVNode("span",Ca,e.toDisplayString(E.valueNew),1)]))],64))]))),128))])],512),[[e.vShow,a(v)&&r[v.id]]])]))),128))])])]))),128))]))],4),!s.value&&o.value.length>0?(e.openBlock(),e.createElementBlock("div",Sa,[e.createElementVNode("p",_a,e.toDisplayString(o.value.length)+" записів",1)])):e.createCommentVNode("",!0)])]))}}),Ba={key:0,class:"text-xl font-semibold"},$a={class:"flex gap-1"},Ta={key:0},La=["accept"],Aa={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"},Da=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",Ba,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",$a,[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(ni),{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(Qr),{class:"h-4 w-4"})],2),t.editable?(e.openBlock(),e.createElementBlock("label",Ta,[e.createElementVNode("input",{type:"file",class:"hidden",accept:t.accept,onChange:r[2]||(r[2]=i=>s.$emit("onAddFile",i))},null,40,La),e.createElementVNode("div",Aa,[e.createVNode(e.unref(Yo),{class:"h-4 w-4"}),r[3]||(r[3]=e.createTextVNode(" Додати файл ",-1))])])):e.createCommentVNode("",!0)])],2))}}),Yn={pdf:{color:"bg-red-100 text-red-700 border-red-200",icon:_t,label:"PDF"},sketch:{color:"bg-gray-100 text-gray-700 border-gray-200",icon:Xr,label:"SKETCH"},mp4:{color:"bg-purple-100 text-purple-700 border-purple-200",icon:li,label:"VIDEO"},docx:{color:"bg-blue-100 text-blue-700 border-blue-200",icon:_t,label:"DOC"},zip:{color:"bg-orange-100 text-orange-700 border-orange-200",icon:qr,label:"ARCHIVE"},png:{color:"bg-green-100 text-green-700 border-green-200",icon:Zo,label:"IMAGE"},jpg:{color:"bg-green-100 text-green-700 border-green-200",icon:Zo,label:"IMAGE"},xlsx:{color:"bg-emerald-100 text-emerald-700 border-emerald-200",icon:_t,label:"EXCEL"},pptx:{color:"bg-amber-100 text-amber-700 border-amber-200",icon:_t,label:"PPT"}};function ps(t,n="en"){const o={month:"short",day:"numeric"};return new Intl.DateTimeFormat(n,o).format(t)}function us(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 Ia={class:"space-y-0.5"},Oa=["onClick"],Ma=["onClick"],Fa={class:"flex items-center gap-2"},Pa={class:"font-medium text-xs truncate hover:text-blue-600 cursor-pointer"},Ra={class:"hidden sm:block text-xs text-gray-500 w-16 text-right"},za={class:"hidden md:block text-xs text-gray-500 w-12 text-right"},ja={class:"flex items-center gap-1"},Ha=["onClick"],Ua=["onClick"],Wa=e.defineComponent({__name:"FileList",props:{files:{}},emits:["delete","download","openLightbox"],setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",Ia,[(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(Yn)[s?.ext]?.color||"bg-blue-100 text-blue-700 border-blue-200"])},[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Yn)[s?.ext]?.icon||e.unref(Yn).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",Fa,[e.createElementVNode("span",Pa,e.toDisplayString(s?.uploaded_name||s?.name),1)])],8,Ma),e.createElementVNode("div",Ra,e.toDisplayString(e.unref(us)(s.size)),1),e.createElementVNode("div",za,e.toDisplayString(e.unref(ps)(s.createdAt)),1),e.createElementVNode("div",ja,[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(Go),{class:"h-3 w-3"})],8,Ha),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(fn),{class:"h-3 w-3"})],8,Ua)])],8,Oa))),128))]))}}),qa={class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3"},Ka=["onClick"],Ga={class:"space-y-2"},Za={class:"flex justify-center items-center w-full aspect-[4/3] bg-gray-100 rounded overflow-hidden"},Ya=["src"],Ja={class:"space-y-1"},Xa=["title"],Qa={class:"text-xs text-gray-500 text-left"},Va={class:"absolute top-2 right-1 flex items-center gap-1"},ec=["onClick"],tc=["onClick"],nc=e.defineComponent({__name:"FileGrid",props:{files:{}},emits:["delete","download","openLightbox"],setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",qa,[(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",Ga,[e.createElementVNode("div",Za,[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,Ya)):(e.openBlock(),e.createBlock(e.unref(_t),{key:1,class:"h-10 w-10 text-gray-500"}))]),e.createElementVNode("div",Ja,[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,Xa),e.createElementVNode("p",Qa,e.toDisplayString(e.unref(ps)(s.createdAt))+", "+e.toDisplayString(e.unref(us)(s.size)),1)])]),e.createElementVNode("div",Va,[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(Go),{class:"h-3 w-3"})],8,ec),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(fn),{class:"h-3 w-3"})],8,tc)])],8,Ka))),128))]))}}),oc={class:"mx-auto font-sans"},sc={key:1},bn=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 y=(o.format??[]).map(R=>typeof R=="string"?R.trim():R==null?"":String(R).trim()).filter(R=>R.length>0),D=[];return y.forEach(R=>{const H=R.toLowerCase(),K=H.indexOf("/"),G=K>=0;let I,z=!1,B;if(G){I=H;const ee=H.slice(K+1);z=ee==="*",!z&&ee&&(B=`.${ee.replace(/^\.+/,"")}`)}else B=H.startsWith(".")?H:`.${H.replace(/^\.+/,"")}`;const q=G?I:B??"";q&&D.push({acceptValue:q,mime:I,wildcard:z,extension:B})}),D.length?D:null}),d=e.computed(()=>{const E=c.value;if(!E)return;const y=E.map(D=>D.acceptValue).filter(Boolean);return y.length?y.join(","):void 0}),u=E=>{if(!c.value)return!0;const y=E.type?.toLowerCase(),D=E.name?.toLowerCase();return c.value.some(R=>{if(R.mime){if(y){if(R.wildcard){const H=R.mime.split("/")[0];if(y.startsWith(`${H}/`))return!0}else if(y===R.mime)return!0}return!!(R.extension&&D?.endsWith(R.extension))}return!!(R.extension&&D?.endsWith(R.extension))})},p=n;a.value.length===0&&C();const m=(E,y)=>{r.value=y,s.value=!0},S=()=>{r.value&&(_(r.value),r.value=null,s.value=!1)},w=e.computed(()=>Array.isArray(a.value)?a.value.map(E=>E?.file_path):[]),g=E=>{const y=w.value.findIndex(D=>D===E.file_path);y!==-1&&(i.value=!0,l.value=y)},x=E=>{o.onAddFile?o.onAddFile(E):T(E),p("add",E)},_=E=>{o.onDelete?o.onDelete(E):v(E),p("delete",E)},W=E=>{const y=document.createElement("a");y.setAttribute("download",E?.uploaded_name||E?.name),y.href=E?.file_path||E?.path,y.click()},N=e.ref(o.view==="grid"?"grid":"list");async function C(){if(!o.id)return;const E=await fetch(`/api/widget/file/${o.id}`).then(y=>y.json());E.rows.forEach(y=>{y.timestamp=new Date(y.cdate),y.id=y.entity_id,y.entityType=y.entity_type,y.entityId=y.entity_id,y.entityType=y.entity_type,y.action=y.change_type,y.userId=y.change_user_id,y.userName=y.username,y.timestamp=new Date(y.cdate),y.description=y.username,y.status=y.username}),a.value=E.rows}const T=async E=>{const D=E.target?.files;if(!D||D.length===0)return;const R=Array.from(D),H=[],K=[];if(R.forEach(G=>{u(G)?H.push(G):K.push(G)}),K.length&&console.warn(`Файлы пропущены, потому что не соответствуют разрешённым форматам: ${K.map(G=>G.name).join(", ")}`),H.length!==0)try{await Promise.all(H.map(async G=>{const I=new FormData;I.append("file",G);const z=`/api/widget/file/${o.id}`,B=await fetch(z,{method:"POST",body:I});if(!B.ok)throw new Error(`HTTP error! status: ${B.status}`);return G})),await C()}catch(G){console.error("Помилка при завантаженні файлів:",G)}},v=async E=>{try{await fetch(`/api/widget/file/${o.id}/${E}`,{method:"DELETE"}),await C()}catch(y){console.error(y)}};return(E,y)=>{const D=e.resolveComponent("MessageBox"),R=e.resolveComponent("Lightbox");return e.openBlock(),e.createElementBlock(e.Fragment,null,[e.createElementVNode("div",oc,[e.createVNode(Da,{modelValue:N.value,"onUpdate:modelValue":y[0]||(y[0]=H=>N.value=H),title:o.title,onOnAddFile:y[1]||(y[1]=H=>x(H)),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"})},[N.value==="list"?(e.openBlock(),e.createBlock(Wa,{key:0,onDelete:m,onDownload:W,onOpenLightbox:y[2]||(y[2]=H=>g(H)),files:a.value},null,8,["files"])):e.createCommentVNode("",!0),N.value==="grid"?(e.openBlock(),e.createBlock(nc,{key:1,onDelete:m,onDownload:W,onOpenLightbox:y[3]||(y[3]=H=>g(H)),files:a.value},null,8,["files"])):e.createCommentVNode("",!0)],6)):(e.openBlock(),e.createElementBlock("div",sc,[...y[6]||(y[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":y[4]||(y[4]=H=>s.value=H),onConfirm:S,title:"Ви впевнені?",message:"Ви впевнені, що хочете видалити цей файл?",confirmButtonText:"Так, я впевнена/ий",cancelButtonText:"Скасувати"},null,8,["modelValue"]),e.createVNode(R,{modelValue:i.value,"onUpdate:modelValue":y[5]||(y[5]=H=>i.value=H),images:w.value,"start-index":l.value},null,8,["modelValue","images","start-index"])],64)}}}),rc={key:0,class:"image-wrapper h-full max-h-[400px]",id:"lightbox-gallery"},ic=["onClick"],lc={key:0,rel:"noreferrer",class:"relative block h-full w-full"},ac=["src"],cc={key:0,class:"thumb-cover"},dc=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(u=>u===c.file_path);d!==-1&&(s.value=!0,r.value=d)};return(c,d)=>{const u=e.resolveComponent("Lightbox");return t.items?.length>=1?(e.openBlock(),e.createElementBlock("div",rc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(t.items,(p,m)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["h-full w-full image"+m,"cursor-pointer bg-teal-500 rounded-[3px]"]),key:m,onClick:e.withModifiers(S=>a(p),["stop"])},[m<5?(e.openBlock(),e.createElementBlock("div",lc,[e.createElementVNode("img",{src:`/file/resize?filepath=${p?.file_path}&w=500`,alt:"alt",height:"auto",width:"100%",class:e.normalizeClass(["object-cover h-full w-full bg-gray-200 rounded-[3px]",m===0?"max-h-[411px]":"max-h-[calc((411px-3px)/2)]"])},null,10,ac),m===4&&t.items?.length>5?(e.openBlock(),e.createElementBlock("div",cc," +"+e.toDisplayString(t.items?.length-5),1)):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)],10,ic))),128)),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(Math.max(0,5-t.items.length),p=>(e.openBlock(),e.createElementBlock("div",{key:"empty-"+p,class:e.normalizeClass(["h-full w-full image"+(t.items.length+p-1),"bg-gray-300 rounded-[3px]"])},null,2))),128)),e.createVNode(u,{modelValue:s.value,"onUpdate:modelValue":d[0]||(d[0]=p=>s.value=p),images:l.value,"start-index":r.value,delete:"true",download:"true",onDelete:d[1]||(d[1]=p=>o("delete",p))},null,8,["modelValue","images","start-index"])])):e.createCommentVNode("",!0)}}}),fc={key:0,class:"text-xl font-semibold"},pc={class:"flex gap-1"},uc=["accept"],mc={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"},hc=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",fc,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),e.createElementVNode("div",pc,[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,uc),e.createElementVNode("div",mc,[e.createVNode(e.unref(Yo),{class:"h-4 w-4"}),o[1]||(o[1]=e.createTextVNode(" Додати зображення ",-1))])])])],2))}}),gc={class:"w-full mx-auto font-sans",ref:"containerRef"},yc={key:1},kn=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=C=>{if(!C)return[];const T=Array.isArray(C)?C:C.split(",");return Array.from(new Set(T.map(v=>v.trim().replace(/^\./,"").toLowerCase()).filter(Boolean)))},r=["jpg","jpeg","png","gif","webp","bmp","svg","avif","heic","tiff"],i=e.computed(()=>{const C=s(o.format);return C.length>0?C:void 0}),l=e.computed(()=>{const C=i.value;return!C||C.length===0?"image/*":C.map(T=>T.startsWith(".")?T:`.${T}`).join(",")}),a=C=>C?.split(".").pop()?.toLowerCase()??"",c=C=>{const T=C?.toLowerCase();return!!T&&!!i.value&&i.value.includes(T)},d=C=>{const T=C?.toLowerCase();return!!T&&r.includes(T)},u=C=>{const T=C.type?.toLowerCase(),v=C.ext?.toLowerCase();return T?.startsWith("image/")?i.value?c(v):!0:v?i.value?c(v):d(v):!1},p=C=>{if(!C.type?.toLowerCase()?.startsWith("image/"))return!1;if(!i.value)return!0;const v=a(C.name);return c(v)},m=C=>C.filter(u),S=e.ref(m(o.items??[])),w=n;S.value.length===0&&W();const g=C=>{o.onAddImage?o.onAddImage(C):_(C),w("add",C)},x=C=>{const T=S.value.find(v=>v.file_path===C)?.file_id;T&&(o.onDelete?o.onDelete(T):N(T))},_=async C=>{const T=C.target;if(!T?.files||T.files.length===0)return;const v=Array.from(T.files),E=v.filter(D=>p(D)),y=i.value?.join(", ")??"image/*";if(E.length===0){console.warn(`Допустимі формати: ${y}. Завантажте зображення дозволеного типу.`);return}E.length!==v.length&&console.warn(`Частина файлів відфільтрована; дозволені формати: ${y}.`);try{await Promise.all(E.map(async D=>{const R=new FormData;R.append("file",D);const H=`/api/widget/file/${o.id}`,K=await fetch(H,{method:"POST",body:R});if(!K.ok)throw new Error(`HTTP error! status: ${K.status}`);return D})),await W()}catch(D){console.error("Помилка при завантаженні файлів:",D)}};async function W(){if(!o.id)return;const C=await fetch(`/api/widget/file/${o.id}`).then(T=>T.json());S.value=m(C.rows)}const N=async C=>{try{await fetch(`/api/widget/file/${o.id}/${C}`,{method:"DELETE"}),await W()}catch(T){console.error(T)}};return(C,T)=>(e.openBlock(),e.createElementBlock("div",gc,[e.createVNode(hc,{title:t.title,accept:l.value,onOnAddImage:T[0]||(T[0]=v=>g(v))},null,8,["title","accept"]),S.value.length>0?(e.openBlock(),e.createBlock(dc,{key:0,items:S.value,onDelete:T[1]||(T[1]=v=>x(v))},null,8,["items"])):(e.openBlock(),e.createElementBlock("div",yc,[...T[2]||(T[2]=[e.createElementVNode("div",{class:"flex items-center justify-center h-full"},[e.createElementVNode("p",{class:"text-gray-500 leading-[3]"},"Зображень не знайдено")],-1)])]))],512))}}),vc={class:"text-value"},bc={class:"text-sm text-gray-900"},kc=Xe(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",vc,[e.createElementVNode("span",bc,e.toDisplayString(o.value),1)]))}}),[["__scopeId","data-v-c14550b7"]]),Ec={class:"link-value"},wc=["href"],xc=Xe(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",Ec,[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,wc)]))}}),[["__scopeId","data-v-e6eb07a6"]]),Nc={class:"date-value"},Cc={class:"text-sm text-gray-900"},Sc=Xe(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",Nc,[e.createElementVNode("span",Cc,e.toDisplayString(o.value),1)]))}}),[["__scopeId","data-v-b9600618"]]),_c={class:"status-value"},Bc={key:0,class:"mr-1"},$c=Xe(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",_c,[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",Bc,[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"]]),Tc={class:"custom-value"},Lc={class:"text-sm text-gray-900"},Ac=Xe(e.defineComponent({__name:"CustomValue",props:{item:{}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",Tc,[e.renderSlot(n.$slots,"default",{item:t.item,value:t.item.value},()=>[e.createElementVNode("span",Lc,e.toDisplayString(String(t.item.value)),1)],!0)]))}}),[["__scopeId","data-v-11a73810"]]),Dc=["id"],Ic={key:0,class:"text-xl font-semibold text-gray-900 mb-4"},Oc={key:1,class:"overflow-x-auto"},Mc={class:"min-w-full divide-y divide-gray-200"},Fc={class:"bg-white divide-y divide-gray-200"},Pc={class:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"},Rc={class:"flex items-center gap-2"},zc=["title"],jc={class:"px-6 py-4 whitespace-nowrap text-sm text-gray-500"},Hc={key:2,class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"},Uc={class:"flex items-start gap-3"},Wc={key:0,class:"flex-shrink-0"},qc={class:"flex-1 min-w-0"},Kc={class:"flex items-center gap-2 mb-2"},Gc={class:"text-sm font-medium text-gray-900"},Zc=["title"],Yc={key:3,class:"overflow-x-auto"},Jc={class:"min-w-full divide-y divide-gray-200"},Xc={class:"bg-white divide-y divide-gray-200"},Qc={class:"px-6 py-4 whitespace-nowrap text-sm font-medium text-gray-900"},Vc={class:"flex items-center gap-2"},ed=["title"],td={class:"px-6 py-4 whitespace-nowrap text-sm text-gray-500"},Jn=Xe(e.defineComponent({__name:"DescriptionListWidget",props:{title:{},items:{},view:{},id:{},className:{},style:{}},setup(t){const n=o=>{switch(o.type){case"link":return xc;case"date":return Sc;case"status":return $c;case"custom":return Ac;default:return kc}};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",Ic,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0),t.view==="table"?(e.openBlock(),e.createElementBlock("div",Oc,[e.createElementVNode("table",Mc,[e.createElementVNode("tbody",Fc,[(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",Pc,[e.createElementVNode("div",Rc,[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,zc)):e.createCommentVNode("",!0)])]),e.createElementVNode("td",jc,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])]))),128))])])])):t.view==="grid"?(e.openBlock(),e.createElementBlock("div",Hc,[(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",Uc,[r.icon?(e.openBlock(),e.createElementBlock("div",Wc,[e.createElementVNode("i",{class:e.normalizeClass([r.icon,"text-gray-500 text-lg"])},null,2)])):e.createCommentVNode("",!0),e.createElementVNode("div",qc,[e.createElementVNode("div",Kc,[e.createElementVNode("h4",Gc,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,Zc)):e.createCommentVNode("",!0)]),(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])])]))),128))])):(e.openBlock(),e.createElementBlock("div",Yc,[e.createElementVNode("table",Jc,[e.createElementVNode("tbody",Xc,[(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",Qc,[e.createElementVNode("div",Vc,[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,ed)):e.createCommentVNode("",!0)])]),e.createElementVNode("td",td,[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(n(r)),{item:r},null,8,["item"]))])]))),128))])])]))],14,Dc))}}),[["__scopeId","data-v-36d43e50"]]);function Ze(t){const n=Object.create(null);for(const o of t.split(","))n[o]=1;return o=>o in n}const nd=process.env.NODE_ENV!=="production"?Object.freeze({}):{};process.env.NODE_ENV!=="production"&&Object.freeze([]);const Xn=()=>{},En=()=>!1,Qn=t=>t.charCodeAt(0)===111&&t.charCodeAt(1)===110&&(t.charCodeAt(2)>122||t.charCodeAt(2)<97),it=Object.assign,Qe=Array.isArray,ke=t=>typeof t=="string",Vn=t=>typeof t=="symbol",od=t=>t!==null&&typeof t=="object",ms=Ze(",key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted"),sd=Ze("bind,cloak,else-if,else,for,html,if,model,on,once,pre,show,slot,text,memo"),eo=t=>{const n=Object.create(null);return(o=>n[o]||(n[o]=t(o)))},rd=/-\w/g,lt=eo(t=>t.replace(rd,n=>n.slice(1).toUpperCase())),to=eo(t=>t.charAt(0).toUpperCase()+t.slice(1)),id=eo(t=>t?`on${to(t)}`:""),Gt={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"},ld={1:"STABLE",2:"DYNAMIC",3:"FORWARDED"},ad=/;(?![^(]*\))/g,cd=/:([^]+)/,dd=/\/\*[^]*?\*\//g;function fd(t){const n={};return t.replace(dd,"").split(ad).forEach(o=>{if(o){const s=o.split(cd);s.length>1&&(n[s[0].trim()]=s[1].trim())}}),n}const pd="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",ud="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",md="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",hd="area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr",gd=Ze(pd),yd=Ze(ud),vd=Ze(md),bd=Ze(hd);const Zt=Symbol(process.env.NODE_ENV!=="production"?"Fragment":""),Yt=Symbol(process.env.NODE_ENV!=="production"?"Teleport":""),no=Symbol(process.env.NODE_ENV!=="production"?"Suspense":""),wn=Symbol(process.env.NODE_ENV!=="production"?"KeepAlive":""),hs=Symbol(process.env.NODE_ENV!=="production"?"BaseTransition":""),ht=Symbol(process.env.NODE_ENV!=="production"?"openBlock":""),gs=Symbol(process.env.NODE_ENV!=="production"?"createBlock":""),ys=Symbol(process.env.NODE_ENV!=="production"?"createElementBlock":""),oo=Symbol(process.env.NODE_ENV!=="production"?"createVNode":""),so=Symbol(process.env.NODE_ENV!=="production"?"createElementVNode":""),Jt=Symbol(process.env.NODE_ENV!=="production"?"createCommentVNode":""),ro=Symbol(process.env.NODE_ENV!=="production"?"createTextVNode":""),vs=Symbol(process.env.NODE_ENV!=="production"?"createStaticVNode":""),io=Symbol(process.env.NODE_ENV!=="production"?"resolveComponent":""),lo=Symbol(process.env.NODE_ENV!=="production"?"resolveDynamicComponent":""),ao=Symbol(process.env.NODE_ENV!=="production"?"resolveDirective":""),co=Symbol(process.env.NODE_ENV!=="production"?"resolveFilter":""),fo=Symbol(process.env.NODE_ENV!=="production"?"withDirectives":""),po=Symbol(process.env.NODE_ENV!=="production"?"renderList":""),bs=Symbol(process.env.NODE_ENV!=="production"?"renderSlot":""),ks=Symbol(process.env.NODE_ENV!=="production"?"createSlots":""),xn=Symbol(process.env.NODE_ENV!=="production"?"toDisplayString":""),Nn=Symbol(process.env.NODE_ENV!=="production"?"mergeProps":""),uo=Symbol(process.env.NODE_ENV!=="production"?"normalizeClass":""),mo=Symbol(process.env.NODE_ENV!=="production"?"normalizeStyle":""),Xt=Symbol(process.env.NODE_ENV!=="production"?"normalizeProps":""),Qt=Symbol(process.env.NODE_ENV!=="production"?"guardReactiveProps":""),ho=Symbol(process.env.NODE_ENV!=="production"?"toHandlers":""),go=Symbol(process.env.NODE_ENV!=="production"?"camelize":""),kd=Symbol(process.env.NODE_ENV!=="production"?"capitalize":""),yo=Symbol(process.env.NODE_ENV!=="production"?"toHandlerKey":""),Cn=Symbol(process.env.NODE_ENV!=="production"?"setBlockTracking":""),Ed=Symbol(process.env.NODE_ENV!=="production"?"pushScopeId":""),wd=Symbol(process.env.NODE_ENV!=="production"?"popScopeId":""),vo=Symbol(process.env.NODE_ENV!=="production"?"withCtx":""),xd=Symbol(process.env.NODE_ENV!=="production"?"unref":""),Nd=Symbol(process.env.NODE_ENV!=="production"?"isRef":""),bo=Symbol(process.env.NODE_ENV!=="production"?"withMemo":""),Es=Symbol(process.env.NODE_ENV!=="production"?"isMemoSame":""),Dt={[Zt]:"Fragment",[Yt]:"Teleport",[no]:"Suspense",[wn]:"KeepAlive",[hs]:"BaseTransition",[ht]:"openBlock",[gs]:"createBlock",[ys]:"createElementBlock",[oo]:"createVNode",[so]:"createElementVNode",[Jt]:"createCommentVNode",[ro]:"createTextVNode",[vs]:"createStaticVNode",[io]:"resolveComponent",[lo]:"resolveDynamicComponent",[ao]:"resolveDirective",[co]:"resolveFilter",[fo]:"withDirectives",[po]:"renderList",[bs]:"renderSlot",[ks]:"createSlots",[xn]:"toDisplayString",[Nn]:"mergeProps",[uo]:"normalizeClass",[mo]:"normalizeStyle",[Xt]:"normalizeProps",[Qt]:"guardReactiveProps",[ho]:"toHandlers",[go]:"camelize",[kd]:"capitalize",[yo]:"toHandlerKey",[Cn]:"setBlockTracking",[Ed]:"pushScopeId",[wd]:"popScopeId",[vo]:"withCtx",[xd]:"unref",[Nd]:"isRef",[bo]:"withMemo",[Es]:"isMemoSame"};function Cd(t){Object.getOwnPropertySymbols(t).forEach(n=>{Dt[n]=t[n]})}const Oe={start:{line:1,column:1,offset:0},end:{line:1,column:1,offset:0},source:""};function Sd(t,n=""){return{type:0,source:n,children:t,helpers:new Set,components:[],directives:[],hoists:[],imports:[],cached:[],temps:0,codegenNode:void 0,loc:Oe}}function Vt(t,n,o,s,r,i,l,a=!1,c=!1,d=!1,u=Oe){return t&&(a?(t.helper(ht),t.helper(Mt(t.inSSR,d))):t.helper(Ot(t.inSSR,d)),l&&t.helper(fo)),{type:13,tag:n,props:o,children:s,patchFlag:r,dynamicProps:i,directives:l,isBlock:a,disableTracking:c,isComponent:d,loc:u}}function gt(t,n=Oe){return{type:17,loc:n,elements:t}}function ze(t,n=Oe){return{type:15,loc:n,properties:t}}function ue(t,n){return{type:16,loc:Oe,key:ke(t)?Q(t,!0):t,value:n}}function Q(t,n=!1,o=Oe,s=0){return{type:4,loc:o,content:t,isStatic:n,constType:n?3:s}}function We(t,n=Oe){return{type:8,loc:n,children:t}}function be(t,n=[],o=Oe){return{type:14,loc:o,callee:t,arguments:n}}function It(t,n=void 0,o=!1,s=!1,r=Oe){return{type:18,params:t,returns:n,newline:o,isSlot:s,loc:r}}function ko(t,n,o,s=!0){return{type:19,test:t,consequent:n,alternate:o,newline:s,loc:Oe}}function _d(t,n,o=!1,s=!1){return{type:20,index:t,value:n,needPauseTracking:o,inVOnce:s,needArraySpread:!1,loc:Oe}}function Bd(t){return{type:21,body:t,loc:Oe}}function Ot(t,n){return t||n?oo:so}function Mt(t,n){return t||n?gs:ys}function Eo(t,{helper:n,removeHelper:o,inSSR:s}){t.isBlock||(t.isBlock=!0,o(Ot(s,t.isComponent)),n(ht),n(Mt(s,t.isComponent)))}const ws=new Uint8Array([123,123]),xs=new Uint8Array([125,125]);function Ns(t){return t>=97&&t<=122||t>=65&&t<=90}function Me(t){return t===32||t===10||t===9||t===12||t===13}function at(t){return t===47||t===62||Me(t)}function Sn(t){const n=new Uint8Array(t.length);for(let o=0;o<t.length;o++)n[o]=t.charCodeAt(o);return n}const we={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 $d{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=ws,this.delimiterClose=xs,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=ws,this.delimiterClose=xs}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?at(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||Me(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===we.TitleEnd||this.currentSequence===we.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===we.Cdata[this.sequenceIndex]?++this.sequenceIndex===we.Cdata.length&&(this.state=28,this.currentSequence=we.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===we.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):Ns(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){at(n)&&this.handleTagName(n)}stateInSFCRootTagName(n){if(at(n)){const o=this.buffer.slice(this.sectionStart,this.index);o!=="template"&&this.enterRCDATA(Sn("</"+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){Me(n)||(n===62?(process.env.NODE_ENV!=="production"&&this.cbs.onerr(14,this.index),this.state=1,this.sectionStart=this.index+1):(this.state=Ns(n)?9:27,this.sectionStart=this.index))}stateInClosingTagName(n){(n===62||Me(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):Me(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):Me(n)||(this.state=11,this.stateBeforeAttrName(n))}stateInAttrName(n){n===61||at(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||at(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||at(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||at(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||at(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)):Me(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):Me(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){Me(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=we.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===we.ScriptEnd[3]?this.startSpecial(we.ScriptEnd,4):n===we.StyleEnd[3]?this.startSpecial(we.StyleEnd,4):(this.state=6,this.stateInTagName(n))}stateBeforeSpecialT(n){n===we.TitleEnd[3]?this.startSpecial(we.TitleEnd,4):n===we.TextareaEnd[3]?this.startSpecial(we.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===we.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 Td={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 wo(t,{compatConfig:n}){const o=n&&n[t];return t==="MODE"?o||3:o}function ct(t,n){const o=wo("MODE",n),s=wo(t,n);return o===3?s===!0:s!==!1}function Ft(t,n,o,...s){const r=ct(t,n);return process.env.NODE_ENV!=="production"&&r&&_n(t,n,o,...s),r}function _n(t,n,o,...s){if(wo(t,n)==="suppress-warning")return;const{message:i,link:l}=Td[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 xo(t){throw t}function Cs(t){process.env.NODE_ENV!=="production"&&console.warn(`[Vue warn] ${t.message}`)}function oe(t,n,o,s){const r=process.env.NODE_ENV!=="production"?(o||Ld)[t]+(s||""):`https://vuejs.org/error-reference/#compiler-${t}`,i=new SyntaxError(String(r));return i.code=t,i.loc=n,i}const Ld={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 '<' 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:""},Le=t=>t.type===4&&t.isStatic;function Ss(t){switch(t){case"Teleport":case"teleport":return Yt;case"Suspense":case"suspense":return no;case"KeepAlive":case"keep-alive":return wn;case"BaseTransition":case"base-transition":return hs}}const Ad=/^$|^\d|[^\$\w\xA0-\uFFFF]/,No=t=>!Ad.test(t),_s=/[A-Za-z_$\xA0-\uFFFF]/,Dd=/[\.\?\w$\xA0-\uFFFF]/,Id=/\s+[.[]\s*|\s*[.[]\s+/g,Bs=t=>t.type===4?t.content:t.loc.source,$s=t=>{const n=Bs(t).trim().replace(Id,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?_s:Dd).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},Od=/^\s*(?:async\s*)?(?:\([^)]*?\)|[\w$_]+)\s*(?::[^=]+)?=>|^\s*(?:async\s+)?function(?:\s+[\w$]+)?\s*\(/,Md=t=>Od.test(Bs(t));function Ts(t,n){if(!t)throw new Error(n||"unexpected compiler condition")}function Ae(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)&&(ke(n)?r.name===n:n.test(r.name)))return r}}function en(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)&&dt(i.arg,n))return i}}function dt(t,n){return!!(t&&Le(t)&&t.content===n)}function Fd(t){return t.props.some(n=>n.type===7&&n.name==="bind"&&(!n.arg||n.arg.type!==4||!n.arg.isStatic))}function Co(t){return t.type===5||t.type===2}function Ls(t){return t.type===7&&t.name==="pre"}function Pd(t){return t.type===7&&t.name==="slot"}function Bn(t){return t.type===1&&t.tagType===3}function $n(t){return t.type===1&&t.tagType===2}const Rd=new Set([Xt,Qt]);function As(t,n=[]){if(t&&!ke(t)&&t.type===14){const o=t.callee;if(!ke(o)&&Rd.has(o))return As(t.arguments[0],n.concat(t))}return[t,n]}function Tn(t,n,o){let s,r=t.type===13?t.props:t.arguments[2],i=[],l;if(r&&!ke(r)&&r.type===14){const a=As(r);r=a[0],i=a[1],l=i[i.length-1]}if(r==null||ke(r))s=ze([n]);else if(r.type===14){const a=r.arguments[0];!ke(a)&&a.type===15?Ds(n,a)||a.properties.unshift(n):r.callee===ho?s=be(o.helper(Nn),[ze([n]),r]):r.arguments.unshift(ze([n])),!s&&(s=r)}else r.type===15?(Ds(n,r)||r.properties.unshift(n),s=r):(s=be(o.helper(Nn),[ze([n]),r]),l&&l.callee===Qt&&(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 Ds(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 tn(t,n){return`_${n}_${t.replace(/[^\w]/g,(o,s)=>o==="-"?"_":t.charCodeAt(s).toString())}`}function zd(t){return t.type===14&&t.callee===bo?t.arguments[1].returns:t}const jd=/([\s\S]*?)\s+(?:in|of)\s+(\S[\s\S]*)/;function Is(t){for(let n=0;n<t.length;n++)if(!Me(t.charCodeAt(n)))return!1;return!0}function So(t){return t.type===2&&Is(t.content)||t.type===12&&So(t.content)}function _o(t){return t.type===3||So(t)}const Os={parseMode:"base",ns:0,delimiters:["{{","}}"],getNamespace:()=>0,isVoidTag:En,isPreTag:En,isIgnoreNewlineTag:En,isCustomElement:En,onError:xo,onWarn:Cs,comments:process.env.NODE_ENV!=="production",prefixIdentifiers:!1};let te=Os,nn=null,Ve="",Se=null,V=null,De="",et=-1,yt=-1,Bo=0,ft=!1,$o=null;const de=[],ce=new $d(de,{onerr:Ie,ontext(t,n){Ln(xe(t,n),t,n)},ontextentity(t,n,o){Ln(t,n,o)},oninterpolation(t,n){if(ft)return Ln(xe(t,n),t,n);let o=t+ce.delimiterOpen.length,s=n-ce.delimiterClose.length;for(;Me(Ve.charCodeAt(o));)o++;for(;Me(Ve.charCodeAt(s-1));)s--;let r=xe(o,s);r.includes("&")&&(r=te.decodeEntities(r,!1)),To({type:5,content:Dn(r,!1,fe(o,s)),loc:fe(t,n)})},onopentagname(t,n){const o=xe(t,n);Se={type:1,tag:o,ns:te.getNamespace(o,de[0],te.ns),tagType:0,props:[],children:[],loc:fe(t-1,n),codegenNode:void 0}},onopentagend(t){Fs(t)},onclosetag(t,n){const o=xe(t,n);if(!te.isVoidTag(o)){let s=!1;for(let r=0;r<de.length;r++)if(de[r].tag.toLowerCase()===o.toLowerCase()){s=!0,r>0&&Ie(24,de[0].loc.start.offset);for(let l=0;l<=r;l++){const a=de.shift();An(a,n,l<r)}break}s||Ie(23,Ps(t,60))}},onselfclosingtag(t){const n=Se.tag;Se.isSelfClosing=!0,Fs(t),de[0]&&de[0].tag===n&&An(de.shift(),t)},onattribname(t,n){V={type:6,name:xe(t,n),nameLoc:fe(t,n),value:void 0,loc:fe(t)}},ondirname(t,n){const o=xe(t,n),s=o==="."||o===":"?"bind":o==="@"?"on":o==="#"?"slot":o.slice(2);if(!ft&&s===""&&Ie(26,t),ft||s==="")V={type:6,name:o,nameLoc:fe(t,n),value:void 0,loc:fe(t)};else if(V={type:7,name:s,rawName:o,exp:void 0,arg:void 0,modifiers:o==="."?[Q("prop")]:[],loc:fe(t)},s==="pre"){ft=ce.inVPre=!0,$o=Se;const r=Se.props;for(let i=0;i<r.length;i++)r[i].type===7&&(r[i]=Xd(r[i]))}},ondirarg(t,n){if(t===n)return;const o=xe(t,n);if(ft&&!Ls(V))V.name+=o,vt(V.nameLoc,n);else{const s=o[0]!=="[";V.arg=Dn(s?o:o.slice(1,-1),s,fe(t,n),s?3:0)}},ondirmodifier(t,n){const o=xe(t,n);if(ft&&!Ls(V))V.name+="."+o,vt(V.nameLoc,n);else if(V.name==="slot"){const s=V.arg;s&&(s.content+="."+o,vt(s.loc,n))}else{const s=Q(o,!0,fe(t,n));V.modifiers.push(s)}},onattribdata(t,n){De+=xe(t,n),et<0&&(et=t),yt=n},onattribentity(t,n,o){De+=t,et<0&&(et=n),yt=o},onattribnameend(t){const n=V.loc.start.offset,o=xe(n,t);V.type===7&&(V.rawName=o),Se.props.some(s=>(s.type===7?s.rawName:s.name)===o)&&Ie(2,n)},onattribend(t,n){if(Se&&V){if(vt(V.loc,n),t!==0)if(De.includes("&")&&(De=te.decodeEntities(De,!0)),V.type===6)V.name==="class"&&(De=js(De).trim()),t===1&&!De&&Ie(13,n),V.value={type:2,content:De,loc:t===1?fe(et,yt):fe(et-1,yt+1)},ce.inSFCRoot&&Se.tag==="template"&&V.name==="lang"&&De&&De!=="html"&&ce.enterRCDATA(Sn("</template"),0);else{let o=0;V.exp=Dn(De,!1,fe(et,yt),0,o),V.name==="for"&&(V.forParseResult=Ud(V.exp));let s=-1;V.name==="bind"&&(s=V.modifiers.findIndex(r=>r.content==="sync"))>-1&&Ft("COMPILER_V_BIND_SYNC",te,V.loc,V.arg.loc.source)&&(V.name="model",V.modifiers.splice(s,1))}(V.type!==7||V.name!=="pre")&&Se.props.push(V)}De="",et=yt=-1},oncomment(t,n){te.comments&&To({type:3,content:xe(t,n),loc:fe(t-4,n+3)})},onend(){const t=Ve.length;if(process.env.NODE_ENV!=="production"&&ce.state!==1)switch(ce.state){case 5:case 8:Ie(5,t);break;case 3:case 4:Ie(25,ce.sectionStart);break;case 28:ce.currentSequence===we.CdataEnd?Ie(6,t):Ie(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:Ie(9,t);break}for(let n=0;n<de.length;n++)An(de[n],t-1),Ie(24,de[n].loc.start.offset)},oncdata(t,n){de[0].ns!==0?Ln(xe(t,n),t,n):Ie(1,t-9)},onprocessinginstruction(t){(de[0]?de[0].ns:te.ns)===0&&Ie(21,t-1)}}),Ms=/,([^,\}\]]*)(?:,([^,\}\]]*))?$/,Hd=/^\(|\)$/g;function Ud(t){const n=t.loc,o=t.content,s=o.match(jd);if(!s)return;const[,r,i]=s,l=(p,m,S=!1)=>{const w=n.start.offset+m,g=w+p.length;return Dn(p,!1,fe(w,g),0,S?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(Hd,"").trim();const d=r.indexOf(c),u=c.match(Ms);if(u){c=c.replace(Ms,"").trim();const p=u[1].trim();let m;if(p&&(m=o.indexOf(p,d+c.length),a.key=l(p,m,!0)),u[2]){const S=u[2].trim();S&&(a.index=l(S,o.indexOf(S,a.key?m+p.length:d+c.length),!0))}}return c&&(a.value=l(c,d,!0)),a}function xe(t,n){return Ve.slice(t,n)}function Fs(t){ce.inSFCRoot&&(Se.innerLoc=fe(t+1,t+1)),To(Se);const{tag:n,ns:o}=Se;o===0&&te.isPreTag(n)&&Bo++,te.isVoidTag(n)?An(Se,t):(de.unshift(Se),(o===1||o===2)&&(ce.inXML=!0)),Se=null}function Ln(t,n,o){{const i=de[0]&&de[0].tag;i!=="script"&&i!=="style"&&t.includes("&")&&(t=te.decodeEntities(t,!1))}const s=de[0]||nn,r=s.children[s.children.length-1];r&&r.type===2?(r.content+=t,vt(r.loc,o)):s.children.push({type:2,content:t,loc:fe(n,o)})}function An(t,n,o=!1){o?vt(t.loc,Ps(n,60)):vt(t.loc,Wd(n,62)+1),ce.inSFCRoot&&(t.children.length?t.innerLoc.end=it({},t.children[t.children.length-1].loc.end):t.innerLoc.end=it({},t.innerLoc.start),t.innerLoc.source=xe(t.innerLoc.start.offset,t.innerLoc.end.offset));const{tag:s,ns:r,children:i}=t;if(ft||(s==="slot"?t.tagType=2:Rs(t)?t.tagType=3:Kd(t)&&(t.tagType=1)),ce.inRCDATA||(t.children=zs(i)),r===0&&te.isIgnoreNewlineTag(s)){const l=i[0];l&&l.type===2&&(l.content=l.content.replace(/^\r?\n/,""))}r===0&&te.isPreTag(s)&&Bo--,$o===t&&(ft=ce.inVPre=!1,$o=null),ce.inXML&&(de[0]?de[0].ns:te.ns)===0&&(ce.inXML=!1);{const l=t.props;if(process.env.NODE_ENV!=="production"&&ct("COMPILER_V_IF_V_FOR_PRECEDENCE",te)){let c=!1,d=!1;for(let u=0;u<l.length;u++){const p=l[u];if(p.type===7&&(p.name==="if"?c=!0:p.name==="for"&&(d=!0)),c&&d){_n("COMPILER_V_IF_V_FOR_PRECEDENCE",te,t.loc);break}}}if(!ce.inSFCRoot&&ct("COMPILER_NATIVE_TEMPLATE",te)&&t.tag==="template"&&!Rs(t)){process.env.NODE_ENV!=="production"&&_n("COMPILER_NATIVE_TEMPLATE",te,t.loc);const c=de[0]||nn,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&&Ft("COMPILER_INLINE_TEMPLATE",te,a.loc)&&t.children.length&&(a.value={type:2,content:xe(t.children[0].loc.start.offset,t.children[t.children.length-1].loc.end.offset),loc:a.loc})}}function Wd(t,n){let o=t;for(;Ve.charCodeAt(o)!==n&&o<Ve.length-1;)o++;return o}function Ps(t,n){let o=t;for(;Ve.charCodeAt(o)!==n&&o>=0;)o--;return o}const qd=new Set(["if","else","else-if","for","slot"]);function Rs({tag:t,props:n}){if(t==="template"){for(let o=0;o<n.length;o++)if(n[o].type===7&&qd.has(n[o].name))return!0}return!1}function Kd({tag:t,props:n}){if(te.isCustomElement(t))return!1;if(t==="component"||Gd(t.charCodeAt(0))||Ss(t)||te.isBuiltInComponent&&te.isBuiltInComponent(t)||te.isNativeTag&&!te.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(Ft("COMPILER_IS_ON_ELEMENT",te,s.loc))return!0}}else if(s.name==="bind"&&dt(s.arg,"is")&&Ft("COMPILER_IS_ON_ELEMENT",te,s.loc))return!0}return!1}function Gd(t){return t>64&&t<91}const Zd=/\r\n/g;function zs(t){const n=te.whitespace!=="preserve";let o=!1;for(let s=0;s<t.length;s++){const r=t[s];if(r.type===2)if(Bo)r.content=r.content.replace(Zd,`
|
|
4
4
|
`);else if(Is(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&&Yd(r.content)))?(o=!0,t[s]=null):r.content=" "}else n&&(r.content=js(r.content))}return o?t.filter(Boolean):t}function Yd(t){for(let n=0;n<t.length;n++){const o=t.charCodeAt(n);if(o===10||o===13)return!0}return!1}function js(t){let n="",o=!1;for(let s=0;s<t.length;s++)Me(t.charCodeAt(s))?o||(n+=" ",o=!0):(n+=t[s],o=!1);return n}function To(t){(de[0]||nn).children.push(t)}function fe(t,n){return{start:ce.getPos(t),end:n==null?n:ce.getPos(n),source:n==null?n:xe(t,n)}}function Jd(t){return fe(t.start.offset,t.end.offset)}function vt(t,n){t.end=ce.getPos(n),t.source=xe(t.start.offset,n)}function Xd(t){const n={type:6,name:t.rawName,nameLoc:fe(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 Dn(t,n=!1,o,s=0,r=0){return Q(t,n,o,s)}function Ie(t,n,o){te.onError(oe(t,fe(n,n),void 0,o))}function Qd(){ce.reset(),Se=null,V=null,De="",et=-1,yt=-1,de.length=0}function Vd(t,n){if(Qd(),Ve=t,te=it({},Os),n){let r;for(r in n)n[r]!=null&&(te[r]=n[r])}if(process.env.NODE_ENV!=="production"&&!te.decodeEntities)throw new Error("[@vue/compiler-core] decodeEntities option is required in browser builds.");ce.mode=te.parseMode==="html"?1:te.parseMode==="sfc"?2:0,ce.inXML=te.ns===1||te.ns===2;const o=n&&n.delimiters;o&&(ce.delimiterOpen=Sn(o[0]),ce.delimiterClose=Sn(o[1]));const s=nn=Sd([],t);return ce.parse(Ve),s.loc=fe(0,t.length),s.children=zs(s.children),nn=null,s}function ef(t,n){In(t,void 0,n,!!Hs(t))}function Hs(t){const n=t.children.filter(o=>o.type!==3);return n.length===1&&n[0].type===1&&!$n(n[0])?n[0]:null}function In(t,n,o,s=!1,r=!1){const{children:i}=t,l=[];for(let u=0;u<i.length;u++){const p=i[u];if(p.type===1&&p.tagType===0){const m=s?0:Fe(p,o);if(m>0){if(m>=2){p.codegenNode.patchFlag=-1,l.push(p);continue}}else{const S=p.codegenNode;if(S.type===13){const w=S.patchFlag;if((w===void 0||w===512||w===1)&&Ws(p,o)>=2){const g=qs(p);g&&(S.props=o.hoist(g))}S.dynamicProps&&(S.dynamicProps=o.hoist(S.dynamicProps))}}}else if(p.type===12&&(s?0:Fe(p,o))>=2){p.codegenNode.type===14&&p.codegenNode.arguments.length>0&&p.codegenNode.arguments.push(-1+(process.env.NODE_ENV!=="production"?` /* ${Gt[-1]} */`:"")),l.push(p);continue}if(p.type===1){const m=p.tagType===1;m&&o.scopes.vSlot++,In(p,t,o,!1,r),m&&o.scopes.vSlot--}else if(p.type===11)In(p,t,o,p.children.length===1,!0);else if(p.type===9)for(let m=0;m<p.branches.length;m++)In(p.branches[m],t,o,p.branches[m].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&&Qe(t.codegenNode.children))t.codegenNode.children=c(gt(t.codegenNode.children)),a=!0;else if(t.tagType===1&&t.codegenNode&&t.codegenNode.type===13&&t.codegenNode.children&&!Qe(t.codegenNode.children)&&t.codegenNode.children.type===15){const u=d(t.codegenNode,"default");u&&(u.returns=c(gt(u.returns)),a=!0)}else if(t.tagType===3&&n&&n.type===1&&n.tagType===1&&n.codegenNode&&n.codegenNode.type===13&&n.codegenNode.children&&!Qe(n.codegenNode.children)&&n.codegenNode.children.type===15){const u=Ae(t,"slot",!0),p=u&&u.arg&&d(n.codegenNode,u.arg);p&&(p.returns=c(gt(p.returns)),a=!0)}}if(!a)for(const u of l)u.codegenNode=o.cache(u.codegenNode);function c(u){const p=o.cache(u);return p.needArraySpread=!0,p}function d(u,p){if(u.children&&!Qe(u.children)&&u.children.type===15){const m=u.children.properties.find(S=>S.key===p||S.key.content===p);return m&&m.value}}l.length&&o.transformHoist&&o.transformHoist(i,o,t)}function Fe(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=Ws(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=Fe(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 u=Fe(d.exp,n);if(u===0)return o.set(t,0),0;u<l&&(l=u)}}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(ht),n.removeHelper(Mt(n.inSSR,r.isComponent)),r.isBlock=!1,n.helper(Ot(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 Fe(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(ke(a)||Vn(a))continue;const c=Fe(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 tf=new Set([uo,mo,Xt,Qt]);function Us(t,n){if(t.type===14&&!ke(t.callee)&&tf.has(t.callee)){const o=t.arguments[0];if(o.type===4)return Fe(o,n);if(o.type===14)return Us(o,n)}return 0}function Ws(t,n){let o=3;const s=qs(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=Fe(l,n);if(c===0)return c;c<o&&(o=c);let d;if(a.type===4?d=Fe(a,n):a.type===14?d=Us(a,n):d=0,d===0)return d;d<o&&(o=d)}}return o}function qs(t){const n=t.codegenNode;if(n.type===13)return n.props}function nf(t,{filename:n="",prefixIdentifiers:o=!1,hoistStatic:s=!1,hmr:r=!1,cacheHandlers:i=!1,nodeTransforms:l=[],directiveTransforms:a={},transformHoist:c=null,isBuiltInComponent:d=Xn,isCustomElement:u=Xn,expressionPlugins:p=[],scopeId:m=null,slotted:S=!0,ssr:w=!1,inSSR:g=!1,ssrCssVars:x="",bindingMetadata:_=nd,inline:W=!1,isTS:N=!1,onError:C=xo,onWarn:T=Cs,compatConfig:v}){const E=n.replace(/\?.*$/,"").match(/([^/\\]+)\.\w+$/),y={filename:n,selfName:E&&to(lt(E[1])),prefixIdentifiers:o,hoistStatic:s,hmr:r,cacheHandlers:i,nodeTransforms:l,directiveTransforms:a,transformHoist:c,isBuiltInComponent:d,isCustomElement:u,expressionPlugins:p,scopeId:m,slotted:S,ssr:w,inSSR:g,ssrCssVars:x,bindingMetadata:_,inline:W,isTS:N,onError:C,onWarn:T,compatConfig:v,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 R=y.helpers.get(D)||0;return y.helpers.set(D,R+1),D},removeHelper(D){const R=y.helpers.get(D);if(R){const H=R-1;H?y.helpers.set(D,H):y.helpers.delete(D)}},helperString(D){return`_${Dt[y.helper(D)]}`},replaceNode(D){if(process.env.NODE_ENV!=="production"){if(!y.currentNode)throw new Error("Node being replaced is already removed.");if(!y.parent)throw new Error("Cannot replace root node.")}y.parent.children[y.childIndex]=y.currentNode=D},removeNode(D){if(process.env.NODE_ENV!=="production"&&!y.parent)throw new Error("Cannot remove root node.");const R=y.parent.children,H=D?R.indexOf(D):y.currentNode?y.childIndex:-1;if(process.env.NODE_ENV!=="production"&&H<0)throw new Error("node being removed is not a child of current parent");!D||D===y.currentNode?(y.currentNode=null,y.onNodeRemoved()):y.childIndex>H&&(y.childIndex--,y.onNodeRemoved()),y.parent.children.splice(H,1)},onNodeRemoved:Xn,addIdentifiers(D){},removeIdentifiers(D){},hoist(D){ke(D)&&(D=Q(D)),y.hoists.push(D);const R=Q(`_hoisted_${y.hoists.length}`,!1,D.loc,2);return R.hoisted=D,R},cache(D,R=!1,H=!1){const K=_d(y.cached.length,D,R,H);return y.cached.push(K),K}};return y.filters=new Set,y}function of(t,n){const o=nf(t,n);On(t,o),n.hoistStatic&&ef(t,o),n.ssr||sf(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 sf(t,n){const{helper:o}=n,{children:s}=t;if(s.length===1){const r=Hs(t);if(r&&r.codegenNode){const i=r.codegenNode;i.type===13&&Eo(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=Vt(n,o(Zt),void 0,t.children,r,void 0,void 0,!0,void 0,!1)}}function rf(t,n){let o=0;const s=()=>{o--};for(;o<t.children.length;o++){const r=t.children[o];ke(r)||(n.grandParent=n.parent,n.parent=t,n.childIndex=o,n.onNodeRemoved=s,On(r,n))}}function On(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&&(Qe(l)?s.push(...l):s.push(l)),n.currentNode)t=n.currentNode;else return}switch(t.type){case 3:n.ssr||n.helper(Jt);break;case 5:n.ssr||n.helper(xn);break;case 9:for(let i=0;i<t.branches.length;i++)On(t.branches[i],n);break;case 10:case 11:case 1:case 0:rf(t,n);break}n.currentNode=t;let r=s.length;for(;r--;)s[r]()}function Ks(t,n){const o=ke(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(Pd))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 Mn="/*@__PURE__*/",Gs=t=>`${Dt[t]}: _${Dt[t]}`;function lf(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:u=!1,isTS:p=!1,inSSR:m=!1}){const S={mode:n,prefixIdentifiers:o,sourceMap:s,filename:r,scopeId:i,optimizeImports:l,runtimeGlobalName:a,runtimeModuleName:c,ssrRuntimeModuleName:d,ssr:u,isTS:p,inSSR:m,source:t.source,code:"",column:1,line:1,offset:0,indentLevel:0,pure:!1,map:void 0,helper(g){return`_${Dt[g]}`},push(g,x=-2,_){S.code+=g},indent(){w(++S.indentLevel)},deindent(g=!1){g?--S.indentLevel:w(--S.indentLevel)},newline(){w(S.indentLevel)}};function w(g){S.push(`
|
package/package.json
CHANGED