@qratilabs/qrati-connect 2.15.0 → 2.16.0
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/CHANGELOG.md +9 -0
- package/element/{CWJf7mNz.js → BI8RhPVM.js} +1 -1
- package/element/{BeBNT9RQ.js → BhtZwJ7r.js} +1 -1
- package/element/{CMtkKIjI.js → BvDw8z0o.js} +1 -1
- package/element/{Bez3GA8y.js → CEsBzi55.js} +1 -1
- package/element/{BPD6evHs.js → CwqB3rqe.js} +1 -1
- package/element/{CNGkJRCP.js → Cy3iV9XH.js} +1 -1
- package/element/{FXirOp_Y.js → D0tOl2TC.js} +1 -1
- package/element/{BHwNoqYe.js → DAitYRY4.js} +1 -1
- package/element/{BQBx6JI7.js → Dlyq91q9.js} +1 -1
- package/element/{Bu-H5iRE.js → DuIwDwan.js} +1 -1
- package/element/{19c52mJB.js → MZuQhFbV.js} +1 -1
- package/element/{BU70X6zI.js → VGPc4EeK.js} +1 -1
- package/element/{t1REK11Z.js → jL1IhEDX.js} +3 -3
- package/element/web.es.js +3 -3
- package/package.json +1 -1
- package/react/{DCz37sa7.js → B8OuOa1d.js} +1 -1
- package/react/{CDiSbuj_.js → BG6d9dt3.js} +1 -1
- package/react/{CcGfpCV3.js → BiTDkR5y.js} +1 -1
- package/react/{CHSr2RxR.js → BkeCKRKb.js} +1 -1
- package/react/{BMzYiAN3.js → BlGHB1od.js} +1 -1
- package/react/{Cgm2azyl.js → BltPktiy.js} +1 -1
- package/react/{DvzgEfqA.js → C77XJYNh.js} +1 -1
- package/react/{DqVfSNOG.js → CPM5coLp.js} +1 -1
- package/react/CSHWW4FM.js +1 -0
- package/react/{B5em30k0.js → CY68wh8z.js} +1 -1
- package/react/{BJvO-E_0.js → CYntO9YI.js} +1 -1
- package/react/{TRIgeGAL.js → CZ9RIEEO.js} +1 -1
- package/react/{B100IxcO.js → D1CJDHfi.js} +1 -1
- package/react/{B1c5Cjsd.js → D9p5klRz.js} +1 -1
- package/react/{BB-zGb6J.js → DCS0HdZa.js} +1 -1
- package/react/{CX_Vz15p.js → DF_cfEUO.js} +1 -1
- package/react/DQVgvgo2.js +6 -0
- package/react/{D_KoEU5i.js → DVJkpJ9-.js} +1 -1
- package/react/{BlSQ-ODL.js → DXEzKDRE.js} +1 -1
- package/react/{DQWXCdfm.js → DZhlx4rT.js} +1 -1
- package/react/{DPezSfU3.js → D_47D6ly.js} +1 -1
- package/react/{eCa9bk8E.js → O7eIZSmq.js} +1 -1
- package/react/{BmbdEikc.js → P53QlFG0.js} +1 -1
- package/react/index.cjs +1 -1
- package/react/index.mjs +3 -3
- package/react/{EJU6024p.js → k7mNnMH1.js} +1 -1
- package/react/{CojsvC2N.js → vcPA0j_c.js} +3 -3
- package/react/{CB5M-zWX.js → yWdl62rI.js} +1 -1
- package/umd/web.umd.js +1 -1
- package/react/BsUU5VBO.js +0 -6
- package/react/JLXrD6OW.js +0 -1
package/react/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,t}from"./CsohJ1Yu.js";import{A as r,E as n,M as o,N as a,S as i,T as s,a as l,b as c,c as d,d as u,f as p,i as h,k as m,l as f,n as g,o as v,p as w,r as b,s as y,t as _,u as x,v as C,w as k,y as E}from"./
|
|
1
|
+
import{a as e,t}from"./CsohJ1Yu.js";import{A as r,E as n,M as o,N as a,S as i,T as s,a as l,b as c,c as d,d as u,f as p,i as h,k as m,l as f,n as g,o as v,p as w,r as b,s as y,t as _,u as x,v as C,w as k,y as E}from"./DQVgvgo2.js";import{A as S,B as A,C as M,D as L,F as N,I,L as R,M as P,N as T,O as z,R as F,S as O,T as D,V as U,_ as j,a as B,b as W,d as q,f as H,g as G,h as V,i as Z,j as K,k as Q,l as Y,m as J,n as X,p as $,t as ee,u as te,v as re,w as ne,x as oe,y as ae,z as ie}from"./vcPA0j_c.js";import{a as se,i as le,n as ce,r as de,t as ue}from"./DVJkpJ9-.js";import{_ as pe,a as he,b as me,c as fe,d as ge,f as ve,g as we,h as be,i as ye,l as _e,m as xe,n as Ce,o as ke,p as Ee,r as Se,s as Ae,t as Me,u as Le,v as Ne,y as Ie}from"./DCS0HdZa.js";import{t as Re}from"./D9p5klRz.js";import*as Pe from"react";import Te,{useCallback as ze,useEffect as Fe,useLayoutEffect as Oe,useRef as De,useState as Ue}from"react";import{jsx as je}from"react/jsx-runtime";import*as Be from"react-dom";import We from"react-dom";var qe=class extends U{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:se()})}getOptimisticResult(e){return e.behavior=se(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){const{state:r}=e,n=super.createResult(e,t),{isFetching:o,isRefetching:a,isError:i,isRefetchError:s}=n,l=r.fetchMeta?.fetchMore?.direction,c=i&&"forward"===l,d=o&&"forward"===l,u=i&&"backward"===l,p=o&&"backward"===l;return{...n,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:de(t,r.data),hasPreviousPage:le(t,r.data),isFetchNextPageError:c,isFetchingNextPage:d,isFetchPreviousPageError:u,isFetchingPreviousPage:p,isRefetchError:s&&!c&&!u,isRefetching:a&&!d&&!p}}},He=({className:e,rounded:t=!1,...r})=>/* @__PURE__ */C("div",{className:p("bg-border animate-pulse",t?"rounded-full":"rounded",e),...r}),Ge=()=>/* @__PURE__ */C("div",{className:"text-muted-foreground text-center text-sm",children:["Powered by"," ",
|
|
2
2
|
/* @__PURE__ */C("a",{href:"https://qrati.com",target:"_blank",rel:"noopener noreferrer",children:/* @__PURE__ */C("strong",{children:"Qrati"})})]}),Ve=()=>{const e=f(),t=x(),{initializing:r,organization:o,user:a}=X();return n(()=>{if(a){const r=e.state?.referrer;t(r||"/")}},[a]),r?/* @__PURE__ */C("div",{className:"mx-auto max-w-lg space-y-8 py-8",children:[
|
|
3
3
|
/* @__PURE__ */C(He,{className:"h-8"}),
|
|
4
4
|
/* @__PURE__ */C(He,{className:"h-8"}),
|
|
@@ -83,7 +83,7 @@ return C("div",{className:"relative flex w-auto items-center gap-2",children:[/*
|
|
|
83
83
|
/* @__PURE__ */C(is,{placeholder:h("content.search_placeholder","Search using text"),value:f,className:"py-2",onChange:e=>g(e.target.value),onKeyUp:e=>{const t=e.key;"Enter"===t?d&&d(f.length>0?f:""):"Escape"===t&&(g(""),d&&d(""))}}),f?.length>0&&/* @__PURE__ */C("button",{className:"absolute inset-y-0 right-10 flex items-center",onClick:()=>{g(""),d&&d("")},children:/* @__PURE__ */C(Ie,{name:"material-symbols:close-rounded",className:"text-foreground w-5"})}),
|
|
84
84
|
/* @__PURE__ */C("button",{className:"absolute inset-y-0 right-3 flex items-center",onClick:()=>d&&d(f),children:/* @__PURE__ */C(Ie,{name:"material-symbols:search-rounded",className:"text-foreground w-5"})})]})}),m?.integrationSettings?.showFacialSearch&&/* @__PURE__ */C(Bs,{value:v,onChange:e=>{w(e),p?.(e?URL.createObjectURL(e):void 0)}})]}),
|
|
85
85
|
/* @__PURE__ */C("div",{className:"col-span-3 md:col-span-1"}),
|
|
86
|
-
/* @__PURE__ */C("div",{className:"col-span-3 mt-3 md:col-span-1 md:mt-0 lg:justify-self-end",children:/* @__PURE__ */C(ss,{engagementStyle:e,sort:a,order:l,onSortChange:s,onSortOrderChange:c})})]})},Gs=({position:e,gamConfig:t,eventId:r,organizationId:o})=>{const{trackGamAnalytics:a}=ve(),i=E(null),s=`gam-${e}-banner-${r??"ev"}`,l=t.placementCategories?.[e];return n(()=>{let e=!1,n=null,c=null,d=null,u=null,p=null,h=null;const m=l?[l]:[],f=document.createElement("div");f.id=s,document.body.appendChild(f);const g=()=>{const e=i.current;if(!e)return;const t=e.getBoundingClientRect(),r=t.width>0&&t.height>0;f.style.display=r?"block":"none",r&&(f.style.position="fixed",f.style.top=`${t.top}px`,f.style.left=`${t.left}px`,f.style.width="728px",f.style.height="90px",f.style.zIndex="20")};return g(),window.addEventListener("scroll",g,{passive:!0}),window.addEventListener("resize",g),(async()=>{await be(),e||window.googletag.cmd.push(()=>{if(e)return;Ee(s);const i=window.googletag.defineSlot(t.adUnitPath,[[728,90]],s)?.addService(window.googletag.pubads());i&&(n=i,u=window.googletag.pubads(),r?i.setConfig({targeting:{qrati_event:r,...m.length>0?{qrati_category:m}:{}}}):m.length>0&&i.setConfig({targeting:{qrati_category:m}}),p=e=>{e.slot===i&&a({eventId:r,organizationId:o,type:D.GAM_IMPRESSION,creativeId:String(e.creativeId??""),lineItemId:String(e.lineItemId??""),advertiserId:String(e.advertiserId??""),isEmpty:e.isEmpty??!1})},u.addEventListener("slotRenderEnded",p),h=e=>{e.slot===i&&a({eventId:r,organizationId:o,type:D.GAM_VIEWABLE})},u.addEventListener("impressionViewable",h),d=ge({container:f,onClick:()=>{a({eventId:r,organizationId:o,type:D.GAM_CLICK})}}),xe(),window.googletag.display(s),c=window.setTimeout(()=>{e||(g(),i.getResponseInformation?.()||window.googletag.pubads().refresh([i]))},1500))})})(),()=>{e=!0,window.removeEventListener("scroll",g),window.removeEventListener("resize",g),null!==c&&window.clearTimeout(c),d?.(),u&&"function"==typeof u.removeEventListener&&(p&&u.removeEventListener("slotRenderEnded",p),h&&u.removeEventListener("impressionViewable",h));const t=n;n=null,t&&window.googletag?.cmd?.push(()=>{window.googletag.destroySlots([t])}),f.parentNode&&f.parentNode.removeChild(f)}},[r,t.adUnitPath,o,l,e,s]),/* @__PURE__ */C("div",{className:"flex w-full items-center justify-center overflow-x-auto py-2",children:/* @__PURE__ */C("div",{ref:i,style:{width:728,height:90,minWidth:728}})})},Vs=({gamConfig:e,eventId:t,organizationId:r})=>{const{trackGamAnalytics:o}=ve(),a=E(null),i=`gam-sidebar-${t??"ev"}`,s=e.placementCategories?.sidebar;return n(()=>{let n=!1,l=null,c=null,d=null,u=null,p=null,h=null;const m=s?[s]:[],f=document.createElement("div");f.id=i,document.body.appendChild(f);const g=()=>{const e=a.current;if(!e)return;const t=e.getBoundingClientRect(),r=e.parentElement?.getBoundingClientRect(),n=t.width>0&&t.height>0;if(f.style.display=n?"block":"none",!n)return;const o=t.top<=0&&r?Math.min(0,r.bottom-600):t.top;f.style.position="fixed",f.style.top=`${o}px`,f.style.left=`${t.left}px`,f.style.width="160px",f.style.height="600px",f.style.zIndex="20"};return g(),window.addEventListener("scroll",g,{passive:!0}),window.addEventListener("resize",g),(async()=>{await be(),n||window.googletag.cmd.push(()=>{if(n)return;Ee(i);const a=window.googletag.defineSlot(e.adUnitPath,[[160,600]],i)?.addService(window.googletag.pubads());a&&(l=a,u=window.googletag.pubads(),t?a.setConfig({targeting:{qrati_event:t,...m.length>0?{qrati_category:m}:{}}}):m.length>0&&a.setConfig({targeting:{qrati_category:m}}),p=e=>{e.slot===a&&o({eventId:t,organizationId:r,type:D.GAM_IMPRESSION,creativeId:String(e.creativeId??""),lineItemId:String(e.lineItemId??""),advertiserId:String(e.advertiserId??""),isEmpty:e.isEmpty??!1})},u.addEventListener("slotRenderEnded",p),h=e=>{e.slot===a&&o({eventId:t,organizationId:r,type:D.GAM_VIEWABLE})},u.addEventListener("impressionViewable",h),d=ge({container:f,onClick:()=>{o({eventId:t,organizationId:r,type:D.GAM_CLICK})}}),xe(),window.googletag.display(i),c=window.setTimeout(()=>{n||(g(),a.getResponseInformation?.()||window.googletag.pubads().refresh([a]))},1500))})})(),()=>{n=!0,window.removeEventListener("scroll",g),window.removeEventListener("resize",g),null!==c&&window.clearTimeout(c),d?.(),u&&"function"==typeof u.removeEventListener&&(p&&u.removeEventListener("slotRenderEnded",p),h&&u.removeEventListener("impressionViewable",h));const e=l;l=null,e&&window.googletag?.cmd?.push(()=>{window.googletag.destroySlots([e])}),f.parentNode&&f.parentNode.removeChild(f)}},[t,e.adUnitPath,r,s,i]),/* @__PURE__ */C("div",{ref:a,style:{width:160,height:600},className:"hidden shrink-0 self-start lg:block"})},Zs=e=>e?.meta?.currentPage<e?.meta?.totalPages?e.meta.currentPage+1:void 0,Ks=I(()=>import("./
|
|
86
|
+
/* @__PURE__ */C("div",{className:"col-span-3 mt-3 md:col-span-1 md:mt-0 lg:justify-self-end",children:/* @__PURE__ */C(ss,{engagementStyle:e,sort:a,order:l,onSortChange:s,onSortOrderChange:c})})]})},Gs=({position:e,gamConfig:t,eventId:r,organizationId:o})=>{const{trackGamAnalytics:a}=ve(),i=E(null),s=`gam-${e}-banner-${r??"ev"}`,l=t.placementCategories?.[e];return n(()=>{let e=!1,n=null,c=null,d=null,u=null,p=null,h=null;const m=l?[l]:[],f=document.createElement("div");f.id=s,document.body.appendChild(f);const g=()=>{const e=i.current;if(!e)return;const t=e.getBoundingClientRect(),r=t.width>0&&t.height>0;f.style.display=r?"block":"none",r&&(f.style.position="fixed",f.style.top=`${t.top}px`,f.style.left=`${t.left}px`,f.style.width="728px",f.style.height="90px",f.style.zIndex="20")};return g(),window.addEventListener("scroll",g,{passive:!0}),window.addEventListener("resize",g),(async()=>{await be(),e||window.googletag.cmd.push(()=>{if(e)return;Ee(s);const i=window.googletag.defineSlot(t.adUnitPath,[[728,90]],s)?.addService(window.googletag.pubads());i&&(n=i,u=window.googletag.pubads(),r?i.setConfig({targeting:{qrati_event:r,...m.length>0?{qrati_category:m}:{}}}):m.length>0&&i.setConfig({targeting:{qrati_category:m}}),p=e=>{e.slot===i&&a({eventId:r,organizationId:o,type:D.GAM_IMPRESSION,creativeId:String(e.creativeId??""),lineItemId:String(e.lineItemId??""),advertiserId:String(e.advertiserId??""),isEmpty:e.isEmpty??!1})},u.addEventListener("slotRenderEnded",p),h=e=>{e.slot===i&&a({eventId:r,organizationId:o,type:D.GAM_VIEWABLE})},u.addEventListener("impressionViewable",h),d=ge({container:f,onClick:()=>{a({eventId:r,organizationId:o,type:D.GAM_CLICK})}}),xe(),window.googletag.display(s),c=window.setTimeout(()=>{e||(g(),i.getResponseInformation?.()||window.googletag.pubads().refresh([i]))},1500))})})(),()=>{e=!0,window.removeEventListener("scroll",g),window.removeEventListener("resize",g),null!==c&&window.clearTimeout(c),d?.(),u&&"function"==typeof u.removeEventListener&&(p&&u.removeEventListener("slotRenderEnded",p),h&&u.removeEventListener("impressionViewable",h));const t=n;n=null,t&&window.googletag?.cmd?.push(()=>{window.googletag.destroySlots([t])}),f.parentNode&&f.parentNode.removeChild(f)}},[r,t.adUnitPath,o,l,e,s]),/* @__PURE__ */C("div",{className:"flex w-full items-center justify-center overflow-x-auto py-2",children:/* @__PURE__ */C("div",{ref:i,style:{width:728,height:90,minWidth:728}})})},Vs=({gamConfig:e,eventId:t,organizationId:r})=>{const{trackGamAnalytics:o}=ve(),a=E(null),i=`gam-sidebar-${t??"ev"}`,s=e.placementCategories?.sidebar;return n(()=>{let n=!1,l=null,c=null,d=null,u=null,p=null,h=null;const m=s?[s]:[],f=document.createElement("div");f.id=i,document.body.appendChild(f);const g=()=>{const e=a.current;if(!e)return;const t=e.getBoundingClientRect(),r=e.parentElement?.getBoundingClientRect(),n=t.width>0&&t.height>0;if(f.style.display=n?"block":"none",!n)return;const o=t.top<=0&&r?Math.min(0,r.bottom-600):t.top;f.style.position="fixed",f.style.top=`${o}px`,f.style.left=`${t.left}px`,f.style.width="160px",f.style.height="600px",f.style.zIndex="20"};return g(),window.addEventListener("scroll",g,{passive:!0}),window.addEventListener("resize",g),(async()=>{await be(),n||window.googletag.cmd.push(()=>{if(n)return;Ee(i);const a=window.googletag.defineSlot(e.adUnitPath,[[160,600]],i)?.addService(window.googletag.pubads());a&&(l=a,u=window.googletag.pubads(),t?a.setConfig({targeting:{qrati_event:t,...m.length>0?{qrati_category:m}:{}}}):m.length>0&&a.setConfig({targeting:{qrati_category:m}}),p=e=>{e.slot===a&&o({eventId:t,organizationId:r,type:D.GAM_IMPRESSION,creativeId:String(e.creativeId??""),lineItemId:String(e.lineItemId??""),advertiserId:String(e.advertiserId??""),isEmpty:e.isEmpty??!1})},u.addEventListener("slotRenderEnded",p),h=e=>{e.slot===a&&o({eventId:t,organizationId:r,type:D.GAM_VIEWABLE})},u.addEventListener("impressionViewable",h),d=ge({container:f,onClick:()=>{o({eventId:t,organizationId:r,type:D.GAM_CLICK})}}),xe(),window.googletag.display(i),c=window.setTimeout(()=>{n||(g(),a.getResponseInformation?.()||window.googletag.pubads().refresh([a]))},1500))})})(),()=>{n=!0,window.removeEventListener("scroll",g),window.removeEventListener("resize",g),null!==c&&window.clearTimeout(c),d?.(),u&&"function"==typeof u.removeEventListener&&(p&&u.removeEventListener("slotRenderEnded",p),h&&u.removeEventListener("impressionViewable",h));const e=l;l=null,e&&window.googletag?.cmd?.push(()=>{window.googletag.destroySlots([e])}),f.parentNode&&f.parentNode.removeChild(f)}},[t,e.adUnitPath,r,s,i]),/* @__PURE__ */C("div",{ref:a,style:{width:160,height:600},className:"hidden shrink-0 self-start lg:block"})},Zs=e=>e?.meta?.currentPage<e?.meta?.totalPages?e.meta.currentPage+1:void 0,Ks=I(()=>import("./BltPktiy.js")),Qs=()=>{const e=u().eventSlug,{loadingUser:t,organization:o}=X(),a=A(),[s,l]=i(""),[d,h]=i(void 0),[m,f]=i(j),[g,v]=i(re),[w,b]=i("undefined"!=typeof window&&window.innerWidth<768?G.SINGLE:G.GRID),y=E(null),{event:_,ads:x,gamConfig:k}=Xe({eventSlug:e}),{loading:S,isError:M,error:I,refetch:R,contentsWithAds:O,hasNextPage:D,fetchNextPage:U,isFetchingNextPage:B}=(({event:e,ads:t=[],gamConfig:r,sort:n=j,order:o=re,keywords:a,face:i,limit:s=20,includeSummary:l=!1})=>{const{props:d,loadingUser:u,user:p}=X(),h=d?.organizationId,{isLoading:m,isError:f,error:g,data:v,hasNextPage:w,fetchNextPage:b,isFetchingNextPage:y,refetch:_}=function(e){return F(e,qe,void 0)}({queryKey:[z.CONTENTS_BY_EVENT(e?._id??""),n,o,a,i],queryFn:async({pageParam:t=1})=>{try{return await T.get(Y.GET_CONTENTS,{searchParams:{eventId:e?._id,page:t,keywords:a,faceImageUrl:i,sort:`${P[o].sortOrder}${H[n].sortField}`,limit:s,includeSummary:l},headers:{"x-org-id":h,Authorization:p?`Bearer ${p.token}`:void 0}}).json()}catch(g){throw new Error(g instanceof Error?g.message:String(g)||"Failed to fetch contents")}},enabled:!u&&!!e,initialPageParam:1,getPreviousPageParam:e=>(e=>e?.meta?.currentPage>1?e.meta.currentPage-1:void 0)(e),getNextPageParam:Zs}),x=c(()=>v?.pages?.flatMap(e=>e?.data??[])??[],[v]);return{contents:x,contentsWithAds:c(()=>"gam"===e?.adMode?r?.inGalleryEnabled?((e=[],t,r)=>{if(!r||r<=0)return e;const[n,o]=t.sizes[0]??[300,250];let a=0;const i=[];for(let s=0;s<e.length;s++)i.push(e[s]),r>0&&(s+1)%r===0&&(i.push({_id:`gam-ad-slot-${a}`,type:J.GAM_AD,slotIndex:a,width:n,height:o}),a++);return i})(x,r,e?.adPosition??5):x:((e=[],t=[],r)=>{if(!r||r<=0)return e;let n=0;const o=[];for(let a=0;a<(e?.length||0);a++)o.push(e[a]),t.length>0&&r>0&&(a+1)%r===0&&(o.push({...t[n],type:J.AD,adType:t[n].type}),n=(n+1)%t.length);return o})(x,t,e?.adPosition),[t,x,e?.adMode,e?.adPosition,r]),loading:m,isError:f,error:g,refetch:_,hasNextPage:w,fetchNextPage:b,isFetchingNextPage:y}})({event:_,ads:x,gamConfig:k,sort:m,order:g,keywords:s,face:d,includeSummary:o?.integrationSettings?.showAIDescription}),{incrementEventView:V}=ve(),{start:Z,initializing:K,running:Q}=(({ref:e,onBottomReached:t,hasNextPage:r,fetchNextPage:o,isFetchingNextPage:a})=>{const s=E(1),l=E(null),c=E(null),d=E(null),[u,p]=i(!1),[h,m]=i(!1);n(()=>(u&&(c.current&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>{l.current=window.requestAnimationFrame(f)},300)),()=>{l.current&&window.cancelAnimationFrame(l.current)}),[u,r,a,o,t]);const f=()=>{e.current&&(e.current.scrollTop+=s.current,r&&!a&&o&&e.current.scrollTop+e.current.clientHeight>=.5*e.current.scrollHeight&&o(),e.current.scrollTop+e.current.clientHeight>=e.current.scrollHeight?(p(!1),l.current&&window.cancelAnimationFrame(l.current),c.current=window.setTimeout(()=>{m(!0),t?.(),c.current=window.setTimeout(()=>{e.current&&(e.current.scrollTop=0),m(!1),p(!0)},1e3)},1e3)):l.current=window.requestAnimationFrame(f))},g=e=>{"+"===e.key&&(s.current=Math.min(s.current+1,10)),"-"===e.key&&(s.current=Math.max(s.current-1,1))},v=()=>{document.fullscreenElement||(null!==d.current?d.current.release().then(()=>(d.current=null,!0)).catch(e=>console.error(`Failed to release wake lock: ${e instanceof Error?e.message:String(e)}`)):console.error("No Wake Lock to release."),p(!1),m(!1),e.current&&(e.current.scrollTop=0),l.current&&window.cancelAnimationFrame(l.current),c.current&&window.clearTimeout(c.current),document.removeEventListener("keydown",g),document.removeEventListener("fullscreenchange",v))};return{start:()=>{if(e?.current?.requestFullscreen)e.current.requestFullscreen();else{const t=e.current;t?.webkitRequestFullscreen?t.webkitRequestFullscreen():t?.mozRequestFullScreen?t.mozRequestFullScreen():t?.msRequestFullscreen&&t.msRequestFullscreen()}(async()=>{try{"wakeLock"in navigator?(d.current=await navigator.wakeLock.request("screen"),document.addEventListener("visibilitychange",async()=>{null!==d.current&&"visible"===document.visibilityState&&(d.current=await navigator.wakeLock.request("screen"))})):console.error("Wake Lock API is not supported in this browser.")}catch(Md){console.error(`Failed to acquire wake lock: ${Md instanceof Error?Md.message:String(Md)}`)}})(),p(!0),document.addEventListener("keydown",g),document.addEventListener("fullscreenchange",v)},initializing:h,running:u}})({ref:y,hasNextPage:D,fetchNextPage:U,isFetchingNextPage:B,onBottomReached:()=>_?._id&&a.refetchQueries({queryKey:[z.CONTENTS_BY_EVENT(_._id)]})});n(()=>{_?.slug&&V(_.slug)},[_]);const $=c(()=>w===G.SINGLE,[w]),ee=c(()=>/* @__PURE__ */C(ns,{event:_,onAutoscrollClick:Z}),[_?.galleryLayout,Z]),te=E(null),ne=E(null);n(()=>(te.current&&te.current.disconnect(),te.current=new IntersectionObserver(e=>{e[0].isIntersecting&&D&&!B&&!S&&U()},{rootMargin:"200px"}),ne.current&&te.current.observe(ne.current),()=>{te.current&&te.current.disconnect()}),[D,B,S,U]);const oe=k?.bannerPositions??[],ie=o?._id,se=k&&oe.includes("sidebar");/* @__PURE__ */
|
|
87
87
|
return C("div",{className:"bg-background mx-auto min-h-[80vh]",children:[
|
|
88
88
|
/* @__PURE__ */C("div",{className:"flex flex-row justify-end gap-4 pt-2",children:ee}),
|
|
89
89
|
/* @__PURE__ */C("div",{className:"pb-2",children:/* @__PURE__ */C(it,{})}),k&&oe.includes("top")&&/* @__PURE__ */C(Gs,{position:"top",gamConfig:k,eventId:_?._id,organizationId:ie}),
|
|
@@ -256,7 +256,7 @@ return C("div",{className:"mt-3 space-y-6 sm:mt-6",children:["content"===r&&w.le
|
|
|
256
256
|
return C("div",{className:"space-y-4",children:[t===h[0]&&/* @__PURE__ */C(we,{variant:"h3",className:"mb-4",children:["Events (",d.length,")"]}),
|
|
257
257
|
/* @__PURE__ */C("div",{className:"flex items-center justify-between gap-3",children:[/* @__PURE__ */C("div",{className:"flex items-center gap-2",children:[/* @__PURE__ */C("span",{className:"inline-block size-2 rounded-full",style:{backgroundColor:r.color||"#9ca3af"}}),/* @__PURE__ */C(we,{variant:"h5",className:"text-sm sm:text-base",children:r.pathLabel})]}),/* @__PURE__ */C(we,{variant:"body2",color:"muted",children:[n.length," ",1===n.length?"result":"results"]})]}),
|
|
258
258
|
/* @__PURE__ */C("div",{className:"grid grid-cols-1 gap-4 gap-y-6 sm:grid-cols-2 lg:grid-cols-3",children:n.map(e=>/* @__PURE__ */C(A,{event:e},e._id))})]},`event-folder-${t}`)}):h.map(e=>{const r=v[e]||[];/* @__PURE__ */
|
|
259
|
-
return C("div",{className:"space-y-4",children:[e===h[0]&&/* @__PURE__ */C(we,{variant:"h3",className:"mb-4",children:["Contents (",p?.totalContentCount||u.length,") Events (",p?.totalEventCount||f.length,")"]}),/* @__PURE__ */C("div",{className:"space-y-6",children:r.map(e=>/* @__PURE__ */C("div",{className:"space-y-3",children:[/* @__PURE__ */C(A,{event:e.event}),/* @__PURE__ */C("div",{className:"grid grid-cols-3 gap-3",children:e.contents.map(r=>/* @__PURE__ */C(Sc,{content:r,timestampField:"captureTime",submittedQuery:t,onClick:()=>_(e.event._id,r._id)},r._id))})]},`content-event-${e.event._id}`))})]},`content-folder-${e}`)})),"content"===r&&s&&!a&&/* @__PURE__ */C("div",{ref:k,className:"h-4 w-full","aria-hidden":"true"}),"content"===r&&s&&o&&l>1&&!a&&/* @__PURE__ */C("div",{className:"flex justify-center pt-2",children:/* @__PURE__ */C(Ie,{name:"eos-icons:loading",className:"text-2xl"})}),"event"===r&&s&&i&&!a&&/* @__PURE__ */C("div",{className:"flex justify-center pt-2",children:/* @__PURE__ */C("button",{type:"button",disabled:o,className:"bg-primary text-primary-foreground disabled:bg-muted rounded px-4 py-2 text-sm font-medium disabled:cursor-not-allowed",onClick:c,children:o?"Loading...":"Load More"})})]})},Mc=I(()=>import("./
|
|
259
|
+
return C("div",{className:"space-y-4",children:[e===h[0]&&/* @__PURE__ */C(we,{variant:"h3",className:"mb-4",children:["Contents (",p?.totalContentCount||u.length,") Events (",p?.totalEventCount||f.length,")"]}),/* @__PURE__ */C("div",{className:"space-y-6",children:r.map(e=>/* @__PURE__ */C("div",{className:"space-y-3",children:[/* @__PURE__ */C(A,{event:e.event}),/* @__PURE__ */C("div",{className:"grid grid-cols-3 gap-3",children:e.contents.map(r=>/* @__PURE__ */C(Sc,{content:r,timestampField:"captureTime",submittedQuery:t,onClick:()=>_(e.event._id,r._id)},r._id))})]},`content-event-${e.event._id}`))})]},`content-folder-${e}`)})),"content"===r&&s&&!a&&/* @__PURE__ */C("div",{ref:k,className:"h-4 w-full","aria-hidden":"true"}),"content"===r&&s&&o&&l>1&&!a&&/* @__PURE__ */C("div",{className:"flex justify-center pt-2",children:/* @__PURE__ */C(Ie,{name:"eos-icons:loading",className:"text-2xl"})}),"event"===r&&s&&i&&!a&&/* @__PURE__ */C("div",{className:"flex justify-center pt-2",children:/* @__PURE__ */C("button",{type:"button",disabled:o,className:"bg-primary text-primary-foreground disabled:bg-muted rounded px-4 py-2 text-sm font-medium disabled:cursor-not-allowed",onClick:c,children:o?"Loading...":"Load More"})})]})},Mc=I(()=>import("./DXEzKDRE.js")),Lc={grid:{icon:/* @__PURE__ */C("svg",{xmlns:"http://www.w3.org/2000/svg",className:"size-full text-inherit",width:24,height:24,viewBox:"0 0 24 24",children:/* @__PURE__ */C("path",{fill:"currentColor",d:"M5 11q-.825 0-1.412-.587T3 9V5q0-.825.588-1.412T5 3h4q.825 0 1.413.588T11 5v4q0 .825-.587 1.413T9 11zm0 10q-.825 0-1.412-.587T3 19v-4q0-.825.588-1.412T5 13h4q.825 0 1.413.588T11 15v4q0 .825-.587 1.413T9 21zm10-10q-.825 0-1.412-.587T13 9V5q0-.825.588-1.412T15 3h4q.825 0 1.413.588T21 5v4q0 .825-.587 1.413T19 11zm0 10q-.825 0-1.412-.587T13 19v-4q0-.825.588-1.412T15 13h4q.825 0 1.413.588T21 15v4q0 .825-.587 1.413T19 21zM5 9h4V5H5zm10 0h4V5h-4zm0 10h4v-4h-4zM5 19h4v-4H5zM9 9"})})},map:{icon:/* @__PURE__ */C("svg",{xmlns:"http://www.w3.org/2000/svg",className:"size-full text-inherit",width:24,height:24,viewBox:"0 0 24 24",children:/* @__PURE__ */C("path",{fill:"currentColor",d:"M14.35 20.775L9 18.9l-4.65 1.8q-.25.1-.488.063t-.437-.163t-.312-.337T3 19.775V5.75q0-.325.188-.575T3.7 4.8l4.65-1.575q.15-.05.313-.075T9 3.125t.338.025t.312.075L15 5.1l4.65-1.8q.25-.1.488-.062t.437.162t.313.338t.112.487V18.25q0 .325-.187.575t-.513.375l-4.65 1.575q-.15.05-.312.075t-.338.025t-.337-.025t-.313-.075M14 18.55V6.85l-4-1.4v11.7zm2 0l3-1V5.7l-3 1.15zM5 18.3l3-1.15V5.45l-3 1zM16 6.85v11.7zm-8-1.4v11.7z"})})}},Nc=Object.keys(Lc).map(e=>({icon:Lc[e].icon,value:e})),Ic=()=>{const e=u().folderId??"",t=X(),{folders:o,organization:a}=t,s=t.props?.organizationId,d=!1!==a?.integrationSettings?.enableGlobalSearch,p=((e,t)=>{const[r,o]=i(""),[a,s]=i("event"),[l,d]=i(1),[u,p]=i(!1),[h,m]=i(""),[f,g]=i(!1),[v,w]=i([]),[b,y]=i([]),[_,x]=i(null),C=E(0),k=E(null),S=E(null),A=c(()=>`org-inline-search-gallery-${e||"default"}`,[e]);n(()=>{if(!e||!r)return;const t=++C.current;(async()=>{p(!0),m("");try{const n="event"===a?Y.SEARCH_EVENTS:Y.SEARCH_CONTENTS,o=await T.get(n,{timeout:6e4,headers:{"x-org-id":e},searchParams:{query:r,page:String(l),limit:"event"===a?"12":"8"}}).json();if(t!==C.current)return;const i=o?.data||[];console.log("next data ",i);const s=o?.meta?.totalPages||0;g((o?.meta?.currentPage||0)<s),"event"===a?w(e=>1===l?i:[...e,...i]):(x({totalContentCount:o?.meta?.totalContentCount,totalEventCount:o?.meta?.totalEventCount}),y(e=>1===l?i:[...e,...i]))}catch(n){if(t!==C.current)return;m(n?.message||"Failed to search")}finally{t===C.current&&p(!1)}})()},[e,l,r,a]);const M=c(()=>{const e={};return v.forEach(t=>{const r=t.folderId||"root";e[r]||(e[r]=[]),e[r].push(t)}),Object.values(e).forEach(e=>{e.sort((e,t)=>(e.name||"").localeCompare(t.name||"",void 0,{sensitivity:"base"}))}),e},[v]),L=c(()=>{const e=/* @__PURE__ */new Map,t=/* @__PURE__ */new Set;return b.forEach(r=>{if(!r?._id||t.has(r._id))return;t.add(r._id);const n=r.event?._id||r.eventId;n&&r.event&&(e.has(n)||e.set(n,{event:r.event,contents:[]}),e.get(n)?.contents.push({...r}))}),Array.from(e.values()).sort((e,t)=>(e.event?.name||"").localeCompare(t.event?.name||"",void 0,{sensitivity:"base"}))},[b]),N=c(()=>{const e={};return L.forEach(t=>{const r=t.event?.folderId||"root";e[r]||(e[r]=[]),e[r].push(t)}),e},[L]),I=c(()=>{const e=Object.keys("event"===a?M:N);return e.sort((e,r)=>{if("root"===e)return-1;if("root"===r)return 1;const n=ue(t,e).map(e=>e.name).join("/"),o=ue(t,r).map(e=>e.name).join("/");return n.localeCompare(o)}),e},[N,M,t,a]),R=c(()=>{if("content"!==a)return[];const e=[];return I.forEach(t=>{(N[t]||[]).forEach(t=>{t.contents.forEach(r=>{e.push({event:t.event,content:r})})})}),e},[I,N,a]);return n(()=>{const e=S.current;if("content"!==a||!r||0===R.length||!e)return k.current?.destroy?.(),void(k.current=null);const t=new Ce({gallery:e,children:"a.pswp-item",counter:!1,bgOpacity:1,wheelToZoom:!0,pinchToClose:!0,zoom:!1,pswpModule:Me});return k.current=t,t.init(),()=>{k.current?.destroy?.(),k.current=null}},[R.length,A,r,a]),{handleSearch:(e,t)=>{d(1),m(""),g(!1),w([]),y([]),x(null),s(t),o(e)},clearSearch:()=>{o(""),m(""),g(!1),d(1),w([]),y([]),x(null)},isSearchActive:r.length>0,submittedQuery:r,submittedSearchType:a,isLoading:u,errorMessage:h,hasMore:f,page:l,setPage:d,eventResults:v,contentResults:b,contentMeta:_,activeFolderKeys:I,eventGroupsByFolder:M,contentGroups:L,contentGroupsByFolder:N,flattenedContentMedia:R,lightboxRef:k,galleryElementRef:S,galleryId:A,openMediaInLightbox:(e,t)=>{if(!k.current?.loadAndOpen)return;const r=R.findIndex(r=>r.event._id===e&&r.content._id===t);r>=0&&k.current.loadAndOpen(r)}}})(s,o||[]),h=!0===a?.integrationSettings?.enableMapView,[m,f]=i(()=>{try{return sessionStorage.getItem("qrati-view-mode")||"grid"}catch{return"grid"}}),{data:v,isLoading:w}=R({queryKey:[`public-events-map-${s}`,e||"all-folders"],enabled:h&&"map"===m,staleTime:3e5,queryFn:async()=>{const t=e.length>0?{folderId:e,limit:500,sort:"-views"}:{includeAllFolders:"true",limit:500,sort:"-views",contentLimit:3};return(await T.get(Y.PUBLIC_EVENTS,{headers:{"x-org-id":s},searchParams:t}).json()).data}}),b=c(()=>{if("undefined"==typeof window)return null;if(window.history.state?.internalNavigation)return null;try{const e=new URLSearchParams(window.location?.search??"");let t=e.get("event"),r=e.get("page");if(!t&&!r&&window.location?.hash){const e=window.location.hash.split("?");if(e.length>1){const n=new URLSearchParams(e[1]);t=n.get("event"),r=n.get("page")}}if(t){if(r)switch(r.toLowerCase()){case"upload":return L.UPLOAD(t);case"curate":return L.CURATE(t);case"leaderboard":return L.LEADERBOARD(t);default:return L.GALLERY(t)}return L.GALLERY(t)}}catch(Md){console.error("Error parsing URL parameters:",Md)}return null},[]),y=(o??[]).filter(t=>t.parentFolderId===(e?.length>0?e:null)||t.parentFolderId===(e?.length>0?e:void 0)),{isLoading:_,data:x}=R({queryKey:[`public-events-${s}`,e],queryFn:async()=>(await T.get(Y.PUBLIC_EVENTS,{headers:{"x-org-id":s},searchParams:{folderId:e,sort:"-createdAt"}}).json()).data});return b?/* @__PURE__ */C(l,{to:b,replace:!0}):/* @__PURE__ */C(r,_||!a?{children:[a?.navigationSettings?.enableNavbar&&/* @__PURE__ */C(et,{}),/* @__PURE__ */C("div",{className:"min-h-screen w-full",children:[
|
|
260
260
|
/* @__PURE__ */C(Cc,{organization:a}),
|
|
261
261
|
/* @__PURE__ */C("div",{className:"mt-4 grid grid-cols-2 gap-3 md:grid-cols-3 lg:grid-cols-4 lg:gap-6",children:Array.from({length:4}).map((e,t)=>/* @__PURE__ */C(He,{className:"h-24 rounded"},`folder-${t}`))}),
|
|
262
262
|
/* @__PURE__ */C("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-3",children:Array.from({length:6}).map((e,t)=>/* @__PURE__ */C("div",{className:"space-y-4",children:[/* @__PURE__ */C(He,{className:"h-72 overflow-hidden rounded sm:h-80"}),/* @__PURE__ */C(He,{className:"h-6 w-64 rounded"})]},t))})]})]}:{children:[a?.navigationSettings?.enableNavbar&&/* @__PURE__ */C(et,{}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t=require("./BkE18wvt.js"),n=require("./JLXrD6OW.js"),e=require("./CX_Vz15p.js"),r=require("./DPezSfU3.js");function i(t,n,e={}){const r={type:"Feature"};return(0===e.id||e.id)&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.properties=n||{},r.geometry=t,r}function o(t,n,e={}){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!a(t[0])||!a(t[1]))throw new Error("coordinates must contain numbers");return i({type:"Point",coordinates:t},n,e)}function a(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function h(t,n,e){if(null!==t)for(var r,i,o,a,s,l,u,f,c=0,m=0,p=t.type,d="FeatureCollection"===p,g="Feature"===p,x=d?t.features.length:1,v=0;v<x;v++){s=(f=!!(u=d?t.features[v].geometry:g?t.geometry:t)&&"GeometryCollection"===u.type)?u.geometries.length:1;for(var y=0;y<s;y++){var M=0,_=0;if(null!==(a=f?u.geometries[y]:u)){l=a.coordinates;var X=a.type;switch(c=!e||"Polygon"!==X&&"MultiPolygon"!==X?0:1,X){case null:break;case"Point":if(!1===n(l,m,v,M,_))return!1;m++,M++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(!1===n(l[r],m,v,M,_))return!1;m++,"MultiPoint"===X&&M++}"LineString"===X&&M++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(i=0;i<l[r].length-c;i++){if(!1===n(l[r][i],m,v,M,_))return!1;m++}"MultiLineString"===X&&M++,"Polygon"===X&&_++}"Polygon"===X&&M++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(_=0,i=0;i<l[r].length;i++){for(o=0;o<l[r][i].length-c;o++){if(!1===n(l[r][i][o],m,v,M,_))return!1;m++}_++}M++}break;case"GeometryCollection":for(r=0;r<a.geometries.length;r++)if(!1===h(a.geometries[r],n,e))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}Math.PI;var s,l=t.__commonJSMin((t,n)=>{var e,r;e=t,r=function(){"use strict";function t(t,r,i,o,a){!function t(e,r,i,o,a){for(;o>i;){if(o-i>600){var h=o-i+1,s=r-i+1,l=Math.log(h),u=.5*Math.exp(2*l/3),f=.5*Math.sqrt(l*u*(h-u)/h)*(s-h/2<0?-1:1);t(e,r,Math.max(i,Math.floor(r-s*u/h+f)),Math.min(o,Math.floor(r+(h-s)*u/h+f)),a)}var c=e[r],m=i,p=o;for(n(e,i,r),a(e[o],c)>0&&n(e,i,o);m<p;){for(n(e,m,p),m++,p--;a(e[m],c)<0;)m++;for(;a(e[p],c)>0;)p--}0===a(e[i],c)?n(e,i,p):n(e,++p,o),p<=r&&(i=p+1),r<=p&&(o=p-1)}}(t,r,i||0,o||t.length-1,a||e)}function n(t,n,e){var r=t[n];t[n]=t[e],t[e]=r}function e(t,n){return t<n?-1:t>n?1:0}var r=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function i(t,n,e){if(!e)return n.indexOf(t);for(var r=0;r<n.length;r++)if(e(t,n[r]))return r;return-1}function o(t,n){a(t,0,t.children.length,n,t)}function a(t,n,e,r,i){i||(i=p(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o=n;o<e;o++){var a=t.children[o];h(i,t.leaf?r(a):a)}return i}function h(t,n){return t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),t}function s(t,n){return t.minX-n.minX}function l(t,n){return t.minY-n.minY}function u(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function f(t){return t.maxX-t.minX+(t.maxY-t.minY)}function c(t,n){return t.minX<=n.minX&&t.minY<=n.minY&&n.maxX<=t.maxX&&n.maxY<=t.maxY}function m(t,n){return n.minX<=t.maxX&&n.minY<=t.maxY&&n.maxX>=t.minX&&n.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function d(n,e,r,i,o){for(var a=[e,r];a.length;)if(!((r=a.pop())-(e=a.pop())<=i)){var h=e+Math.ceil((r-e)/i/2)*i;t(n,h,e,r,o),a.push(e,h,h,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(t){var n=this.data,e=[];if(!m(t,n))return e;for(var r=this.toBBox,i=[];n;){for(var o=0;o<n.children.length;o++){var a=n.children[o],h=n.leaf?r(a):a;m(t,h)&&(n.leaf?e.push(a):c(t,h)?this._all(a,e):i.push(a))}n=i.pop()}return e},r.prototype.collides=function(t){var n=this.data;if(!m(t,n))return!1;for(var e=[];n;){for(var r=0;r<n.children.length;r++){var i=n.children[r],o=n.leaf?this.toBBox(i):i;if(m(t,o)){if(n.leaf||c(t,o))return!0;e.push(i)}}n=e.pop()}return!1},r.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var n=0;n<t.length;n++)this.insert(t[n]);return this}var e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){var r=this.data;this.data=e,e=r}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this},r.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},r.prototype.clear=function(){return this.data=p([]),this},r.prototype.remove=function(t,n){if(!t)return this;for(var e,r,o,a=this.data,h=this.toBBox(t),s=[],l=[];a||s.length;){if(a||(a=s.pop(),r=s[s.length-1],e=l.pop(),o=!0),a.leaf){var u=i(t,a.children,n);if(-1!==u)return a.children.splice(u,1),s.push(a),this._condense(s),this}o||a.leaf||!c(a,h)?r?(e++,a=r.children[e],o=!1):a=null:(s.push(a),l.push(e),e=0,r=a,a=a.children[0])}return this},r.prototype.toBBox=function(t){return t},r.prototype.compareMinX=function(t,n){return t.minX-n.minX},r.prototype.compareMinY=function(t,n){return t.minY-n.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(t){return this.data=t,this},r.prototype._all=function(t,n){for(var e=[];t;)t.leaf?n.push.apply(n,t.children):e.push.apply(e,t.children),t=e.pop();return n},r.prototype._build=function(t,n,e,r){var i,a=e-n+1,h=this._maxEntries;if(a<=h)return o(i=p(t.slice(n,e+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(a)/Math.log(h)),h=Math.ceil(a/Math.pow(h,r-1))),(i=p([])).leaf=!1,i.height=r;var s=Math.ceil(a/h),l=s*Math.ceil(Math.sqrt(h));d(t,n,e,l,this.compareMinX);for(var u=n;u<=e;u+=l){var f=Math.min(u+l-1,e);d(t,u,f,s,this.compareMinY);for(var c=u;c<=f;c+=s){var m=Math.min(c+s-1,f);i.children.push(this._build(t,c,m,r-1))}}return o(i,this.toBBox),i},r.prototype._chooseSubtree=function(t,n,e,r){for(;r.push(n),!n.leaf&&r.length-1!==e;){for(var i=1/0,o=1/0,a=void 0,h=0;h<n.children.length;h++){var s=n.children[h],l=u(s),f=(c=t,m=s,(Math.max(m.maxX,c.maxX)-Math.min(m.minX,c.minX))*(Math.max(m.maxY,c.maxY)-Math.min(m.minY,c.minY))-l);f<o?(o=f,i=l<i?l:i,a=s):f===o&&l<i&&(i=l,a=s)}n=a||n.children[0]}var c,m;return n},r.prototype._insert=function(t,n,e){var r=e?t:this.toBBox(t),i=[],o=this._chooseSubtree(r,this.data,n,i);for(o.children.push(t),h(o,r);n>=0&&i[n].children.length>this._maxEntries;)this._split(i,n),n--;this._adjustParentBBoxes(r,i,n)},r.prototype._split=function(t,n){var e=t[n],r=e.children.length,i=this._minEntries;this._chooseSplitAxis(e,i,r);var a=this._chooseSplitIndex(e,i,r),h=p(e.children.splice(a,e.children.length-a));h.height=e.height,h.leaf=e.leaf,o(e,this.toBBox),o(h,this.toBBox),n?t[n-1].children.push(h):this._splitRoot(e,h)},r.prototype._splitRoot=function(t,n){this.data=p([t,n]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(t,n,e){for(var r,i,o,h,s,l,f,c=1/0,m=1/0,p=n;p<=e-n;p++){var d=a(t,0,p,this.toBBox),g=a(t,p,e,this.toBBox),x=(i=d,o=g,h=Math.max(i.minX,o.minX),s=Math.max(i.minY,o.minY),l=Math.min(i.maxX,o.maxX),f=Math.min(i.maxY,o.maxY),Math.max(0,l-h)*Math.max(0,f-s)),v=u(d)+u(g);x<c?(c=x,r=p,m=v<m?v:m):x===c&&v<m&&(m=v,r=p)}return r||e-n},r.prototype._chooseSplitAxis=function(t,n,e){var r=t.leaf?this.compareMinX:s,i=t.leaf?this.compareMinY:l;this._allDistMargin(t,n,e,r)<this._allDistMargin(t,n,e,i)&&t.children.sort(r)},r.prototype._allDistMargin=function(t,n,e,r){t.children.sort(r);for(var i=this.toBBox,o=a(t,0,n,i),s=a(t,e-n,e,i),l=f(o)+f(s),u=n;u<e-n;u++){var c=t.children[u];h(o,t.leaf?i(c):c),l+=f(o)}for(var m=e-n-1;m>=n;m--){var p=t.children[m];h(s,t.leaf?i(p):p),l+=f(s)}return l},r.prototype._adjustParentBBoxes=function(t,n,e){for(var r=e;r>=0;r--)h(n[r],t)},r.prototype._condense=function(t){for(var n=t.length-1,e=void 0;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children).splice(e.indexOf(t[n]),1):this.clear():o(t[n],this.toBBox)},r},"object"==typeof t&&void 0!==n?n.exports=r():"function"==typeof define&&define.amd?define(r):(e=e||self).RBush=r()}),u=t.__exportAll({default:()=>s});function f(t,n){return t<n?-1:t>n?1:0}var c=t.__esmMin(()=>{s=class{constructor(t=[],n=f){if(this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:n,compare:e}=this,r=n[t];for(;t>0;){const i=t-1>>1,o=n[i];if(e(r,o)>=0)break;n[t]=o,t=i}n[t]=r}_down(t){const{data:n,compare:e}=this,r=this.length>>1,i=n[t];for(;t<r;){let r=1+(t<<1),o=n[r];const a=r+1;if(a<this.length&&e(n[a],o)<0&&(r=a,o=n[a]),e(o,i)>=0)break;n[t]=o,t=r}n[t]=i}}}),m=t.__commonJSMin((t,n)=>{n.exports=function(t,n,e,r){var i=t[0],o=t[1],a=!1;void 0===e&&(e=0),void 0===r&&(r=n.length);for(var h=(r-e)/2,s=0,l=h-1;s<h;l=s++){var u=n[e+2*s+0],f=n[e+2*s+1],c=n[e+2*l+0],m=n[e+2*l+1];f>o!=m>o&&i<(c-u)*(o-f)/(m-f)+u&&(a=!a)}return a}}),p=t.__commonJSMin((t,n)=>{n.exports=function(t,n,e,r){var i=t[0],o=t[1],a=!1;void 0===e&&(e=0),void 0===r&&(r=n.length);for(var h=r-e,s=0,l=h-1;s<h;l=s++){var u=n[s+e][0],f=n[s+e][1],c=n[l+e][0],m=n[l+e][1];f>o!=m>o&&i<(c-u)*(o-f)/(m-f)+u&&(a=!a)}return a}}),d=t.__commonJSMin((t,n)=>{var e=m(),r=p();n.exports=function(t,n,i,o){return n.length>0&&Array.isArray(n[0])?r(t,n,i,o):e(t,n,i,o)},n.exports.nested=r,n.exports.flat=e}),g=t.__commonJSMin((t,n)=>{var e,r;e=t,r=function(t){"use strict";const n=134217729;function e(t,n,e,r,i){let o,a,h,s,l=n[0],u=r[0],f=0,c=0;u>l==u>-l?(o=l,l=n[++f]):(o=u,u=r[++c]);let m=0;if(f<t&&c<e)for(u>l==u>-l?(h=o-((a=l+o)-l),l=n[++f]):(h=o-((a=u+o)-u),u=r[++c]),o=a,0!==h&&(i[m++]=h);f<t&&c<e;)u>l==u>-l?(h=o-((a=o+l)-(s=a-o))+(l-s),l=n[++f]):(h=o-((a=o+u)-(s=a-o))+(u-s),u=r[++c]),o=a,0!==h&&(i[m++]=h);for(;f<t;)h=o-((a=o+l)-(s=a-o))+(l-s),l=n[++f],o=a,0!==h&&(i[m++]=h);for(;c<e;)h=o-((a=o+u)-(s=a-o))+(u-s),u=r[++c],o=a,0!==h&&(i[m++]=h);return 0===o&&0!==m||(i[m++]=o),m}function r(t){return new Float64Array(t)}const i=r(4),o=r(8),a=r(12),h=r(16),s=r(4);t.orient2d=function(t,r,l,u,f,c){const m=(r-c)*(l-f),p=(t-f)*(u-c),d=m-p;if(0===m||0===p||m>0!=p>0)return d;const g=Math.abs(m+p);return Math.abs(d)>=33306690738754716e-32*g?d:-function(t,r,l,u,f,c,m){let p,d,g,x,v,y,M,_,X,Y,b,B,w,P,F,E,S,A;const j=t-f,k=l-f,I=r-c,q=u-c;v=(F=(_=j-(M=(y=n*j)-(y-j)))*(Y=q-(X=(y=n*q)-(y-q)))-((P=j*q)-M*X-_*X-M*Y))-(b=F-(S=(_=I-(M=(y=n*I)-(y-I)))*(Y=k-(X=(y=n*k)-(y-k)))-((E=I*k)-M*X-_*X-M*Y))),i[0]=F-(b+v)+(v-S),v=(w=P-((B=P+b)-(v=B-P))+(b-v))-(b=w-E),i[1]=w-(b+v)+(v-E),v=(A=B+b)-B,i[2]=B-(A-v)+(b-v),i[3]=A;let L=function(t,n){let e=n[0];for(let r=1;r<4;r++)e+=n[r];return e}(0,i),T=22204460492503146e-32*m;if(L>=T||-L>=T)return L;if(p=t-(j+(v=t-j))+(v-f),g=l-(k+(v=l-k))+(v-f),d=r-(I+(v=r-I))+(v-c),x=u-(q+(v=u-q))+(v-c),0===p&&0===d&&0===g&&0===x)return L;if(T=11093356479670487e-47*m+33306690738754706e-32*Math.abs(L),(L+=j*x+q*p-(I*g+k*d))>=T||-L>=T)return L;v=(F=(_=p-(M=(y=n*p)-(y-p)))*(Y=q-(X=(y=n*q)-(y-q)))-((P=p*q)-M*X-_*X-M*Y))-(b=F-(S=(_=d-(M=(y=n*d)-(y-d)))*(Y=k-(X=(y=n*k)-(y-k)))-((E=d*k)-M*X-_*X-M*Y))),s[0]=F-(b+v)+(v-S),v=(w=P-((B=P+b)-(v=B-P))+(b-v))-(b=w-E),s[1]=w-(b+v)+(v-E),v=(A=B+b)-B,s[2]=B-(A-v)+(b-v),s[3]=A;const C=e(4,i,4,s,o);v=(F=(_=j-(M=(y=n*j)-(y-j)))*(Y=x-(X=(y=n*x)-(y-x)))-((P=j*x)-M*X-_*X-M*Y))-(b=F-(S=(_=I-(M=(y=n*I)-(y-I)))*(Y=g-(X=(y=n*g)-(y-g)))-((E=I*g)-M*X-_*X-M*Y))),s[0]=F-(b+v)+(v-S),v=(w=P-((B=P+b)-(v=B-P))+(b-v))-(b=w-E),s[1]=w-(b+v)+(v-E),v=(A=B+b)-B,s[2]=B-(A-v)+(b-v),s[3]=A;const J=e(C,o,4,s,a);return v=(F=(_=p-(M=(y=n*p)-(y-p)))*(Y=x-(X=(y=n*x)-(y-x)))-((P=p*x)-M*X-_*X-M*Y))-(b=F-(S=(_=d-(M=(y=n*d)-(y-d)))*(Y=g-(X=(y=n*g)-(y-g)))-((E=d*g)-M*X-_*X-M*Y))),s[0]=F-(b+v)+(v-S),v=(w=P-((B=P+b)-(v=B-P))+(b-v))-(b=w-E),s[1]=w-(b+v)+(v-E),v=(A=B+b)-B,s[2]=B-(A-v)+(b-v),s[3]=A,h[e(J,a,4,s,h)-1]}(t,r,l,u,f,c,g)},t.orient2dfast=function(t,n,e,r,i,o){return(n-o)*(e-i)-(t-i)*(r-o)},Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof t&&void 0!==n?r(t):"function"==typeof define&&define.amd?define(["exports"],r):r((e=e||self).predicates={})}),x=t.__commonJSMin((n,e)=>{var r=l(),i=(c(),t.__toCommonJS(u)),o=d(),a=g().orient2d;function h(t,n,e){n=Math.max(0,void 0===n?2:n),e=e||0;var i=function(t){for(var n=t[0],e=t[0],r=t[0],i=t[0],a=0;a<t.length;a++){var h=t[a];h[0]<n[0]&&(n=h),h[0]>r[0]&&(r=h),h[1]<e[1]&&(e=h),h[1]>i[1]&&(i=h)}var s=[n,e,r,i],l=s.slice();for(a=0;a<t.length;a++)o(t[a],s)||l.push(t[a]);return function(t){t.sort(B);for(var n=[],e=0;e<t.length;e++){for(;n.length>=2&&v(n[n.length-2],n[n.length-1],t[e])<=0;)n.pop();n.push(t[e])}for(var r=[],i=t.length-1;i>=0;i--){for(;r.length>=2&&v(r[r.length-2],r[r.length-1],t[i])<=0;)r.pop();r.push(t[i])}return r.pop(),n.pop(),n.concat(r)}(l)}(t),a=new r(16);a.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},a.compareMinX=function(t,n){return t[0]-n[0]},a.compareMinY=function(t,n){return t[1]-n[1]},a.load(t);for(var h,l=[],u=0;u<i.length;u++){var f=i[u];a.remove(f),h=_(f,h),l.push(h)}var c=new r(16);for(u=0;u<l.length;u++)c.insert(M(l[u]));for(var m=n*n,p=e*e;l.length;){var d=l.shift(),g=d.p,x=d.next.p,y=X(g,x);if(!(y<p)){var Y=y/m;(f=s(a,d.prev.p,g,x,d.next.next.p,Y,c))&&Math.min(X(f,g),X(f,x))<=Y&&(l.push(d),l.push(_(f,d)),a.remove(f),c.remove(d),c.insert(M(d)),c.insert(M(d.next)))}}d=h;var b=[];do{b.push(d.p),d=d.next}while(d!==h);return b.push(d.p),b}function s(t,n,e,r,o,a,h){for(var s=new i([],f),l=t.data;l;){for(var u=0;u<l.children.length;u++){var c=l.children[u],p=l.leaf?Y(c,e,r):m(e,r,c);p>a||s.push({node:c,dist:p})}for(;s.length&&!s.peek().node.children;){var d=s.pop(),g=d.node,v=Y(g,n,e),y=Y(g,r,o);if(d.dist<v&&d.dist<y&&x(e,g,h)&&x(r,g,h))return g}(l=s.pop())&&(l=l.node)}return null}function f(t,n){return t.dist-n.dist}function m(t,n,e){if(p(t,e)||p(n,e))return 0;var r=b(t[0],t[1],n[0],n[1],e.minX,e.minY,e.maxX,e.minY);if(0===r)return 0;var i=b(t[0],t[1],n[0],n[1],e.minX,e.minY,e.minX,e.maxY);if(0===i)return 0;var o=b(t[0],t[1],n[0],n[1],e.maxX,e.minY,e.maxX,e.maxY);if(0===o)return 0;var a=b(t[0],t[1],n[0],n[1],e.minX,e.maxY,e.maxX,e.maxY);return 0===a?0:Math.min(r,i,o,a)}function p(t,n){return t[0]>=n.minX&&t[0]<=n.maxX&&t[1]>=n.minY&&t[1]<=n.maxY}function x(t,n,e){for(var r=Math.min(t[0],n[0]),i=Math.min(t[1],n[1]),o=Math.max(t[0],n[0]),a=Math.max(t[1],n[1]),h=e.search({minX:r,minY:i,maxX:o,maxY:a}),s=0;s<h.length;s++)if(y(h[s].p,h[s].next.p,t,n))return!1;return!0}function v(t,n,e){return a(t[0],t[1],n[0],n[1],e[0],e[1])}function y(t,n,e,r){return t!==r&&n!==e&&v(t,n,e)>0!=v(t,n,r)>0&&v(e,r,t)>0!=v(e,r,n)>0}function M(t){var n=t.p,e=t.next.p;return t.minX=Math.min(n[0],e[0]),t.minY=Math.min(n[1],e[1]),t.maxX=Math.max(n[0],e[0]),t.maxY=Math.max(n[1],e[1]),t}function _(t,n){var e={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return n?(e.next=n.next,e.prev=n,n.next.prev=e,n.next=e):(e.prev=e,e.next=e),e}function X(t,n){var e=t[0]-n[0],r=t[1]-n[1];return e*e+r*r}function Y(t,n,e){var r=n[0],i=n[1],o=e[0]-r,a=e[1]-i;if(0!==o||0!==a){var h=((t[0]-r)*o+(t[1]-i)*a)/(o*o+a*a);h>1?(r=e[0],i=e[1]):h>0&&(r+=o*h,i+=a*h)}return(o=t[0]-r)*o+(a=t[1]-i)*a}function b(t,n,e,r,i,o,a,h){var s,l,u,f,c=e-t,m=r-n,p=a-i,d=h-o,g=t-i,x=n-o,v=c*c+m*m,y=c*p+m*d,M=p*p+d*d,_=c*g+m*x,X=p*g+d*x,Y=v*M-y*y,b=Y,B=Y;0===Y?(l=0,b=1,f=X,B=M):(f=v*X-y*_,(l=y*X-M*_)<0?(l=0,f=X,B=M):l>b&&(l=b,f=X+y,B=M)),f<0?(f=0,-_<0?l=0:-_>v?l=b:(l=-_,b=v)):f>B&&(f=B,-_+y<0?l=0:-_+y>v?l=b:(l=-_+y,b=v));var w=(1-(u=0===f?0:f/B))*i+u*a-((1-(s=0===l?0:l/b))*t+s*e),P=(1-u)*o+u*h-((1-s)*n+s*r);return w*w+P*P}function B(t,n){return t[0]===n[0]?t[1]-n[1]:t[0]-n[0]}i.default&&(i=i.default),e.exports=h,e.exports.default=h}),v=t.__toESM(x(),1),y=function(t,n={}){n.concavity=n.concavity||1/0;const e=[];if(h(t,t=>{e.push([t[0],t[1]])}),!e.length)return null;const r=(0,v.default)(e,n.concavity);return r.length>3?function(t,n,e={}){for(const r of t){if(r.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(r[r.length-1].length!==r[0].length)throw new Error("First and last Position are not equivalent.");for(let t=0;t<r[r.length-1].length;t++)if(r[r.length-1][t]!==r[0][t])throw new Error("First and last Position are not equivalent.")}return i({type:"Polygon",coordinates:t},n,e)}([r]):null},M=t=>"number"==typeof t.x&&"number"==typeof t.y?[t.x,t.y]:null,_=({folderId:t})=>{const{folders:i,organization:a}=e.useSession(),h=n.A({}),[s,l]=n.d(()=>t??null),u=Boolean(a?.integrationSettings?.enableFolderView);n.y(()=>{l(t??null)},[t]);const f=n.T(()=>u&&i?.filter(t=>(t.parentFolderId??null)===s&&t.boundary?.length>=1)||[],[i,s,u]),c=e.useQuery({queryKey:["public-events-map-leaf",a?._id,u,s??"root"],queryFn:async()=>{const t=s?{folderId:s,limit:500,sort:"-views",contentLimit:3}:u?{limit:500,sort:"-views",contentLimit:3}:{includeAllFolders:!0,limit:500,sort:"-views",contentLimit:3};return(await e.ky.get(e.API_ROUTES.PUBLIC_EVENTS,{headers:{"x-org-id":a?._id??""},searchParams:t}).json()).data??[]},enabled:Boolean(a?._id),staleTime:3e5,retry:!1}),m=c.isLoading||c.isFetching,p=c.data?.filter(t=>"number"==typeof t?.location?.x&&"number"==typeof t?.location?.y)??[],d=n.T(()=>f.map(t=>((t,n)=>{const e=t.boundary?.map(M).filter(t=>Boolean(t)),r=e?e.map(t=>t.join(",")).sort().join("|"):"",i=n[t._id];if(i&&i.hash===r)return i.feature;let a;if(e?.length){const t=e?.map(t=>o(t));if(t&&t.length>=3){const n=y(function(t,n={}){const e={type:"FeatureCollection"};return n.id&&(e.id=n.id),n.bbox&&(e.bbox=n.bbox),e.features=t,e}(t));"Polygon"===n?.geometry.type&&(a=n.geometry)}}if(!a&&e&&e.length>0&&(a={type:"Point",coordinates:1===e.length?e[0]:[e.reduce((t,n)=>t+n[0],0)/e.length,e.reduce((t,n)=>t+n[1],0)/e.length]}),!a)return null;const h={type:"Feature",id:t._id,properties:{folderId:t._id,name:t.name,color:t.color,eventCount:t.boundary?.length||0,isFolderPoint:"Point"===a.type},geometry:a};return n[t._id]={hash:r,feature:h},h})(t,h.current)).filter(t=>Boolean(t)),[f]),g=n.T(()=>({type:"FeatureCollection",features:d}),[d]),x=n.T(()=>i?.find(t=>t._id===s)??null,[i,s]),v=n.T(()=>s&&i?r.getBreadcrumbFromFlatFolders(i,s):[],[i,s]),_=n.T(()=>(t=>{const n=[],e=t=>{Array.isArray(t)&&("number"!=typeof t[0]||"number"!=typeof t[1]?t.forEach(e):n.push([t[0],t[1]]))};if(t.features.forEach(t=>e(t.geometry.coordinates)),0===n.length)return null;const r=n.map(t=>t[0]),i=n.map(t=>t[1]);return[Math.min(...r),Math.min(...i),Math.max(...r),Math.max(...i)]})(g),[g]);return{isFolderViewEnabled:u,activeFolderId:s,visibleFolders:f,visibleEvents:p,folderFeatures:d,folderFeatureCollection:g,breadcrumb:v,isLoadingEvents:m,isBusy:m,setActiveFolderId:t=>{l(t)},goBack:()=>{x&&l(x.parentFolderId??null)},activeFolder:x,folderBounds:_}};Object.defineProperty(exports,"useHierarchicalMap",{enumerable:!0,get:function(){return _}});
|
|
1
|
+
const t=require("./BkE18wvt.js"),n=require("./CSHWW4FM.js"),e=require("./DF_cfEUO.js"),r=require("./D_47D6ly.js");function i(t,n,e={}){const r={type:"Feature"};return(0===e.id||e.id)&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.properties=n||{},r.geometry=t,r}function o(t,n,e={}){if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!a(t[0])||!a(t[1]))throw new Error("coordinates must contain numbers");return i({type:"Point",coordinates:t},n,e)}function a(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function h(t,n,e){if(null!==t)for(var r,i,o,a,s,l,u,f,c=0,m=0,p=t.type,d="FeatureCollection"===p,g="Feature"===p,x=d?t.features.length:1,v=0;v<x;v++){s=(f=!!(u=d?t.features[v].geometry:g?t.geometry:t)&&"GeometryCollection"===u.type)?u.geometries.length:1;for(var y=0;y<s;y++){var M=0,_=0;if(null!==(a=f?u.geometries[y]:u)){l=a.coordinates;var X=a.type;switch(c=!e||"Polygon"!==X&&"MultiPolygon"!==X?0:1,X){case null:break;case"Point":if(!1===n(l,m,v,M,_))return!1;m++,M++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(!1===n(l[r],m,v,M,_))return!1;m++,"MultiPoint"===X&&M++}"LineString"===X&&M++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(i=0;i<l[r].length-c;i++){if(!1===n(l[r][i],m,v,M,_))return!1;m++}"MultiLineString"===X&&M++,"Polygon"===X&&_++}"Polygon"===X&&M++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(_=0,i=0;i<l[r].length;i++){for(o=0;o<l[r][i].length-c;o++){if(!1===n(l[r][i][o],m,v,M,_))return!1;m++}_++}M++}break;case"GeometryCollection":for(r=0;r<a.geometries.length;r++)if(!1===h(a.geometries[r],n,e))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}Math.PI;var s,l=t.__commonJSMin((t,n)=>{var e,r;e=t,r=function(){"use strict";function t(t,r,i,o,a){!function t(e,r,i,o,a){for(;o>i;){if(o-i>600){var h=o-i+1,s=r-i+1,l=Math.log(h),u=.5*Math.exp(2*l/3),f=.5*Math.sqrt(l*u*(h-u)/h)*(s-h/2<0?-1:1);t(e,r,Math.max(i,Math.floor(r-s*u/h+f)),Math.min(o,Math.floor(r+(h-s)*u/h+f)),a)}var c=e[r],m=i,p=o;for(n(e,i,r),a(e[o],c)>0&&n(e,i,o);m<p;){for(n(e,m,p),m++,p--;a(e[m],c)<0;)m++;for(;a(e[p],c)>0;)p--}0===a(e[i],c)?n(e,i,p):n(e,++p,o),p<=r&&(i=p+1),r<=p&&(o=p-1)}}(t,r,i||0,o||t.length-1,a||e)}function n(t,n,e){var r=t[n];t[n]=t[e],t[e]=r}function e(t,n){return t<n?-1:t>n?1:0}var r=function(t){void 0===t&&(t=9),this._maxEntries=Math.max(4,t),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function i(t,n,e){if(!e)return n.indexOf(t);for(var r=0;r<n.length;r++)if(e(t,n[r]))return r;return-1}function o(t,n){a(t,0,t.children.length,n,t)}function a(t,n,e,r,i){i||(i=p(null)),i.minX=1/0,i.minY=1/0,i.maxX=-1/0,i.maxY=-1/0;for(var o=n;o<e;o++){var a=t.children[o];h(i,t.leaf?r(a):a)}return i}function h(t,n){return t.minX=Math.min(t.minX,n.minX),t.minY=Math.min(t.minY,n.minY),t.maxX=Math.max(t.maxX,n.maxX),t.maxY=Math.max(t.maxY,n.maxY),t}function s(t,n){return t.minX-n.minX}function l(t,n){return t.minY-n.minY}function u(t){return(t.maxX-t.minX)*(t.maxY-t.minY)}function f(t){return t.maxX-t.minX+(t.maxY-t.minY)}function c(t,n){return t.minX<=n.minX&&t.minY<=n.minY&&n.maxX<=t.maxX&&n.maxY<=t.maxY}function m(t,n){return n.minX<=t.maxX&&n.minY<=t.maxY&&n.maxX>=t.minX&&n.maxY>=t.minY}function p(t){return{children:t,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function d(n,e,r,i,o){for(var a=[e,r];a.length;)if(!((r=a.pop())-(e=a.pop())<=i)){var h=e+Math.ceil((r-e)/i/2)*i;t(n,h,e,r,o),a.push(e,h,h,r)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(t){var n=this.data,e=[];if(!m(t,n))return e;for(var r=this.toBBox,i=[];n;){for(var o=0;o<n.children.length;o++){var a=n.children[o],h=n.leaf?r(a):a;m(t,h)&&(n.leaf?e.push(a):c(t,h)?this._all(a,e):i.push(a))}n=i.pop()}return e},r.prototype.collides=function(t){var n=this.data;if(!m(t,n))return!1;for(var e=[];n;){for(var r=0;r<n.children.length;r++){var i=n.children[r],o=n.leaf?this.toBBox(i):i;if(m(t,o)){if(n.leaf||c(t,o))return!0;e.push(i)}}n=e.pop()}return!1},r.prototype.load=function(t){if(!t||!t.length)return this;if(t.length<this._minEntries){for(var n=0;n<t.length;n++)this.insert(t[n]);return this}var e=this._build(t.slice(),0,t.length-1,0);if(this.data.children.length)if(this.data.height===e.height)this._splitRoot(this.data,e);else{if(this.data.height<e.height){var r=this.data;this.data=e,e=r}this._insert(e,this.data.height-e.height-1,!0)}else this.data=e;return this},r.prototype.insert=function(t){return t&&this._insert(t,this.data.height-1),this},r.prototype.clear=function(){return this.data=p([]),this},r.prototype.remove=function(t,n){if(!t)return this;for(var e,r,o,a=this.data,h=this.toBBox(t),s=[],l=[];a||s.length;){if(a||(a=s.pop(),r=s[s.length-1],e=l.pop(),o=!0),a.leaf){var u=i(t,a.children,n);if(-1!==u)return a.children.splice(u,1),s.push(a),this._condense(s),this}o||a.leaf||!c(a,h)?r?(e++,a=r.children[e],o=!1):a=null:(s.push(a),l.push(e),e=0,r=a,a=a.children[0])}return this},r.prototype.toBBox=function(t){return t},r.prototype.compareMinX=function(t,n){return t.minX-n.minX},r.prototype.compareMinY=function(t,n){return t.minY-n.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(t){return this.data=t,this},r.prototype._all=function(t,n){for(var e=[];t;)t.leaf?n.push.apply(n,t.children):e.push.apply(e,t.children),t=e.pop();return n},r.prototype._build=function(t,n,e,r){var i,a=e-n+1,h=this._maxEntries;if(a<=h)return o(i=p(t.slice(n,e+1)),this.toBBox),i;r||(r=Math.ceil(Math.log(a)/Math.log(h)),h=Math.ceil(a/Math.pow(h,r-1))),(i=p([])).leaf=!1,i.height=r;var s=Math.ceil(a/h),l=s*Math.ceil(Math.sqrt(h));d(t,n,e,l,this.compareMinX);for(var u=n;u<=e;u+=l){var f=Math.min(u+l-1,e);d(t,u,f,s,this.compareMinY);for(var c=u;c<=f;c+=s){var m=Math.min(c+s-1,f);i.children.push(this._build(t,c,m,r-1))}}return o(i,this.toBBox),i},r.prototype._chooseSubtree=function(t,n,e,r){for(;r.push(n),!n.leaf&&r.length-1!==e;){for(var i=1/0,o=1/0,a=void 0,h=0;h<n.children.length;h++){var s=n.children[h],l=u(s),f=(c=t,m=s,(Math.max(m.maxX,c.maxX)-Math.min(m.minX,c.minX))*(Math.max(m.maxY,c.maxY)-Math.min(m.minY,c.minY))-l);f<o?(o=f,i=l<i?l:i,a=s):f===o&&l<i&&(i=l,a=s)}n=a||n.children[0]}var c,m;return n},r.prototype._insert=function(t,n,e){var r=e?t:this.toBBox(t),i=[],o=this._chooseSubtree(r,this.data,n,i);for(o.children.push(t),h(o,r);n>=0&&i[n].children.length>this._maxEntries;)this._split(i,n),n--;this._adjustParentBBoxes(r,i,n)},r.prototype._split=function(t,n){var e=t[n],r=e.children.length,i=this._minEntries;this._chooseSplitAxis(e,i,r);var a=this._chooseSplitIndex(e,i,r),h=p(e.children.splice(a,e.children.length-a));h.height=e.height,h.leaf=e.leaf,o(e,this.toBBox),o(h,this.toBBox),n?t[n-1].children.push(h):this._splitRoot(e,h)},r.prototype._splitRoot=function(t,n){this.data=p([t,n]),this.data.height=t.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(t,n,e){for(var r,i,o,h,s,l,f,c=1/0,m=1/0,p=n;p<=e-n;p++){var d=a(t,0,p,this.toBBox),g=a(t,p,e,this.toBBox),x=(i=d,o=g,h=Math.max(i.minX,o.minX),s=Math.max(i.minY,o.minY),l=Math.min(i.maxX,o.maxX),f=Math.min(i.maxY,o.maxY),Math.max(0,l-h)*Math.max(0,f-s)),v=u(d)+u(g);x<c?(c=x,r=p,m=v<m?v:m):x===c&&v<m&&(m=v,r=p)}return r||e-n},r.prototype._chooseSplitAxis=function(t,n,e){var r=t.leaf?this.compareMinX:s,i=t.leaf?this.compareMinY:l;this._allDistMargin(t,n,e,r)<this._allDistMargin(t,n,e,i)&&t.children.sort(r)},r.prototype._allDistMargin=function(t,n,e,r){t.children.sort(r);for(var i=this.toBBox,o=a(t,0,n,i),s=a(t,e-n,e,i),l=f(o)+f(s),u=n;u<e-n;u++){var c=t.children[u];h(o,t.leaf?i(c):c),l+=f(o)}for(var m=e-n-1;m>=n;m--){var p=t.children[m];h(s,t.leaf?i(p):p),l+=f(s)}return l},r.prototype._adjustParentBBoxes=function(t,n,e){for(var r=e;r>=0;r--)h(n[r],t)},r.prototype._condense=function(t){for(var n=t.length-1,e=void 0;n>=0;n--)0===t[n].children.length?n>0?(e=t[n-1].children).splice(e.indexOf(t[n]),1):this.clear():o(t[n],this.toBBox)},r},"object"==typeof t&&void 0!==n?n.exports=r():"function"==typeof define&&define.amd?define(r):(e=e||self).RBush=r()}),u=t.__exportAll({default:()=>s});function f(t,n){return t<n?-1:t>n?1:0}var c=t.__esmMin(()=>{s=class{constructor(t=[],n=f){if(this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(let e=(this.length>>1)-1;e>=0;e--)this._down(e)}push(t){this.data.push(t),this.length++,this._up(this.length-1)}pop(){if(0===this.length)return;const t=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:n,compare:e}=this,r=n[t];for(;t>0;){const i=t-1>>1,o=n[i];if(e(r,o)>=0)break;n[t]=o,t=i}n[t]=r}_down(t){const{data:n,compare:e}=this,r=this.length>>1,i=n[t];for(;t<r;){let r=1+(t<<1),o=n[r];const a=r+1;if(a<this.length&&e(n[a],o)<0&&(r=a,o=n[a]),e(o,i)>=0)break;n[t]=o,t=r}n[t]=i}}}),m=t.__commonJSMin((t,n)=>{n.exports=function(t,n,e,r){var i=t[0],o=t[1],a=!1;void 0===e&&(e=0),void 0===r&&(r=n.length);for(var h=(r-e)/2,s=0,l=h-1;s<h;l=s++){var u=n[e+2*s+0],f=n[e+2*s+1],c=n[e+2*l+0],m=n[e+2*l+1];f>o!=m>o&&i<(c-u)*(o-f)/(m-f)+u&&(a=!a)}return a}}),p=t.__commonJSMin((t,n)=>{n.exports=function(t,n,e,r){var i=t[0],o=t[1],a=!1;void 0===e&&(e=0),void 0===r&&(r=n.length);for(var h=r-e,s=0,l=h-1;s<h;l=s++){var u=n[s+e][0],f=n[s+e][1],c=n[l+e][0],m=n[l+e][1];f>o!=m>o&&i<(c-u)*(o-f)/(m-f)+u&&(a=!a)}return a}}),d=t.__commonJSMin((t,n)=>{var e=m(),r=p();n.exports=function(t,n,i,o){return n.length>0&&Array.isArray(n[0])?r(t,n,i,o):e(t,n,i,o)},n.exports.nested=r,n.exports.flat=e}),g=t.__commonJSMin((t,n)=>{var e,r;e=t,r=function(t){"use strict";const n=134217729;function e(t,n,e,r,i){let o,a,h,s,l=n[0],u=r[0],f=0,c=0;u>l==u>-l?(o=l,l=n[++f]):(o=u,u=r[++c]);let m=0;if(f<t&&c<e)for(u>l==u>-l?(h=o-((a=l+o)-l),l=n[++f]):(h=o-((a=u+o)-u),u=r[++c]),o=a,0!==h&&(i[m++]=h);f<t&&c<e;)u>l==u>-l?(h=o-((a=o+l)-(s=a-o))+(l-s),l=n[++f]):(h=o-((a=o+u)-(s=a-o))+(u-s),u=r[++c]),o=a,0!==h&&(i[m++]=h);for(;f<t;)h=o-((a=o+l)-(s=a-o))+(l-s),l=n[++f],o=a,0!==h&&(i[m++]=h);for(;c<e;)h=o-((a=o+u)-(s=a-o))+(u-s),u=r[++c],o=a,0!==h&&(i[m++]=h);return 0===o&&0!==m||(i[m++]=o),m}function r(t){return new Float64Array(t)}const i=r(4),o=r(8),a=r(12),h=r(16),s=r(4);t.orient2d=function(t,r,l,u,f,c){const m=(r-c)*(l-f),p=(t-f)*(u-c),d=m-p;if(0===m||0===p||m>0!=p>0)return d;const g=Math.abs(m+p);return Math.abs(d)>=33306690738754716e-32*g?d:-function(t,r,l,u,f,c,m){let p,d,g,x,v,y,M,_,X,Y,b,B,w,P,F,E,S,A;const j=t-f,k=l-f,I=r-c,q=u-c;v=(F=(_=j-(M=(y=n*j)-(y-j)))*(Y=q-(X=(y=n*q)-(y-q)))-((P=j*q)-M*X-_*X-M*Y))-(b=F-(S=(_=I-(M=(y=n*I)-(y-I)))*(Y=k-(X=(y=n*k)-(y-k)))-((E=I*k)-M*X-_*X-M*Y))),i[0]=F-(b+v)+(v-S),v=(w=P-((B=P+b)-(v=B-P))+(b-v))-(b=w-E),i[1]=w-(b+v)+(v-E),v=(A=B+b)-B,i[2]=B-(A-v)+(b-v),i[3]=A;let L=function(t,n){let e=n[0];for(let r=1;r<4;r++)e+=n[r];return e}(0,i),T=22204460492503146e-32*m;if(L>=T||-L>=T)return L;if(p=t-(j+(v=t-j))+(v-f),g=l-(k+(v=l-k))+(v-f),d=r-(I+(v=r-I))+(v-c),x=u-(q+(v=u-q))+(v-c),0===p&&0===d&&0===g&&0===x)return L;if(T=11093356479670487e-47*m+33306690738754706e-32*Math.abs(L),(L+=j*x+q*p-(I*g+k*d))>=T||-L>=T)return L;v=(F=(_=p-(M=(y=n*p)-(y-p)))*(Y=q-(X=(y=n*q)-(y-q)))-((P=p*q)-M*X-_*X-M*Y))-(b=F-(S=(_=d-(M=(y=n*d)-(y-d)))*(Y=k-(X=(y=n*k)-(y-k)))-((E=d*k)-M*X-_*X-M*Y))),s[0]=F-(b+v)+(v-S),v=(w=P-((B=P+b)-(v=B-P))+(b-v))-(b=w-E),s[1]=w-(b+v)+(v-E),v=(A=B+b)-B,s[2]=B-(A-v)+(b-v),s[3]=A;const C=e(4,i,4,s,o);v=(F=(_=j-(M=(y=n*j)-(y-j)))*(Y=x-(X=(y=n*x)-(y-x)))-((P=j*x)-M*X-_*X-M*Y))-(b=F-(S=(_=I-(M=(y=n*I)-(y-I)))*(Y=g-(X=(y=n*g)-(y-g)))-((E=I*g)-M*X-_*X-M*Y))),s[0]=F-(b+v)+(v-S),v=(w=P-((B=P+b)-(v=B-P))+(b-v))-(b=w-E),s[1]=w-(b+v)+(v-E),v=(A=B+b)-B,s[2]=B-(A-v)+(b-v),s[3]=A;const J=e(C,o,4,s,a);return v=(F=(_=p-(M=(y=n*p)-(y-p)))*(Y=x-(X=(y=n*x)-(y-x)))-((P=p*x)-M*X-_*X-M*Y))-(b=F-(S=(_=d-(M=(y=n*d)-(y-d)))*(Y=g-(X=(y=n*g)-(y-g)))-((E=d*g)-M*X-_*X-M*Y))),s[0]=F-(b+v)+(v-S),v=(w=P-((B=P+b)-(v=B-P))+(b-v))-(b=w-E),s[1]=w-(b+v)+(v-E),v=(A=B+b)-B,s[2]=B-(A-v)+(b-v),s[3]=A,h[e(J,a,4,s,h)-1]}(t,r,l,u,f,c,g)},t.orient2dfast=function(t,n,e,r,i,o){return(n-o)*(e-i)-(t-i)*(r-o)},Object.defineProperty(t,"__esModule",{value:!0})},"object"==typeof t&&void 0!==n?r(t):"function"==typeof define&&define.amd?define(["exports"],r):r((e=e||self).predicates={})}),x=t.__commonJSMin((n,e)=>{var r=l(),i=(c(),t.__toCommonJS(u)),o=d(),a=g().orient2d;function h(t,n,e){n=Math.max(0,void 0===n?2:n),e=e||0;var i=function(t){for(var n=t[0],e=t[0],r=t[0],i=t[0],a=0;a<t.length;a++){var h=t[a];h[0]<n[0]&&(n=h),h[0]>r[0]&&(r=h),h[1]<e[1]&&(e=h),h[1]>i[1]&&(i=h)}var s=[n,e,r,i],l=s.slice();for(a=0;a<t.length;a++)o(t[a],s)||l.push(t[a]);return function(t){t.sort(B);for(var n=[],e=0;e<t.length;e++){for(;n.length>=2&&v(n[n.length-2],n[n.length-1],t[e])<=0;)n.pop();n.push(t[e])}for(var r=[],i=t.length-1;i>=0;i--){for(;r.length>=2&&v(r[r.length-2],r[r.length-1],t[i])<=0;)r.pop();r.push(t[i])}return r.pop(),n.pop(),n.concat(r)}(l)}(t),a=new r(16);a.toBBox=function(t){return{minX:t[0],minY:t[1],maxX:t[0],maxY:t[1]}},a.compareMinX=function(t,n){return t[0]-n[0]},a.compareMinY=function(t,n){return t[1]-n[1]},a.load(t);for(var h,l=[],u=0;u<i.length;u++){var f=i[u];a.remove(f),h=_(f,h),l.push(h)}var c=new r(16);for(u=0;u<l.length;u++)c.insert(M(l[u]));for(var m=n*n,p=e*e;l.length;){var d=l.shift(),g=d.p,x=d.next.p,y=X(g,x);if(!(y<p)){var Y=y/m;(f=s(a,d.prev.p,g,x,d.next.next.p,Y,c))&&Math.min(X(f,g),X(f,x))<=Y&&(l.push(d),l.push(_(f,d)),a.remove(f),c.remove(d),c.insert(M(d)),c.insert(M(d.next)))}}d=h;var b=[];do{b.push(d.p),d=d.next}while(d!==h);return b.push(d.p),b}function s(t,n,e,r,o,a,h){for(var s=new i([],f),l=t.data;l;){for(var u=0;u<l.children.length;u++){var c=l.children[u],p=l.leaf?Y(c,e,r):m(e,r,c);p>a||s.push({node:c,dist:p})}for(;s.length&&!s.peek().node.children;){var d=s.pop(),g=d.node,v=Y(g,n,e),y=Y(g,r,o);if(d.dist<v&&d.dist<y&&x(e,g,h)&&x(r,g,h))return g}(l=s.pop())&&(l=l.node)}return null}function f(t,n){return t.dist-n.dist}function m(t,n,e){if(p(t,e)||p(n,e))return 0;var r=b(t[0],t[1],n[0],n[1],e.minX,e.minY,e.maxX,e.minY);if(0===r)return 0;var i=b(t[0],t[1],n[0],n[1],e.minX,e.minY,e.minX,e.maxY);if(0===i)return 0;var o=b(t[0],t[1],n[0],n[1],e.maxX,e.minY,e.maxX,e.maxY);if(0===o)return 0;var a=b(t[0],t[1],n[0],n[1],e.minX,e.maxY,e.maxX,e.maxY);return 0===a?0:Math.min(r,i,o,a)}function p(t,n){return t[0]>=n.minX&&t[0]<=n.maxX&&t[1]>=n.minY&&t[1]<=n.maxY}function x(t,n,e){for(var r=Math.min(t[0],n[0]),i=Math.min(t[1],n[1]),o=Math.max(t[0],n[0]),a=Math.max(t[1],n[1]),h=e.search({minX:r,minY:i,maxX:o,maxY:a}),s=0;s<h.length;s++)if(y(h[s].p,h[s].next.p,t,n))return!1;return!0}function v(t,n,e){return a(t[0],t[1],n[0],n[1],e[0],e[1])}function y(t,n,e,r){return t!==r&&n!==e&&v(t,n,e)>0!=v(t,n,r)>0&&v(e,r,t)>0!=v(e,r,n)>0}function M(t){var n=t.p,e=t.next.p;return t.minX=Math.min(n[0],e[0]),t.minY=Math.min(n[1],e[1]),t.maxX=Math.max(n[0],e[0]),t.maxY=Math.max(n[1],e[1]),t}function _(t,n){var e={p:t,prev:null,next:null,minX:0,minY:0,maxX:0,maxY:0};return n?(e.next=n.next,e.prev=n,n.next.prev=e,n.next=e):(e.prev=e,e.next=e),e}function X(t,n){var e=t[0]-n[0],r=t[1]-n[1];return e*e+r*r}function Y(t,n,e){var r=n[0],i=n[1],o=e[0]-r,a=e[1]-i;if(0!==o||0!==a){var h=((t[0]-r)*o+(t[1]-i)*a)/(o*o+a*a);h>1?(r=e[0],i=e[1]):h>0&&(r+=o*h,i+=a*h)}return(o=t[0]-r)*o+(a=t[1]-i)*a}function b(t,n,e,r,i,o,a,h){var s,l,u,f,c=e-t,m=r-n,p=a-i,d=h-o,g=t-i,x=n-o,v=c*c+m*m,y=c*p+m*d,M=p*p+d*d,_=c*g+m*x,X=p*g+d*x,Y=v*M-y*y,b=Y,B=Y;0===Y?(l=0,b=1,f=X,B=M):(f=v*X-y*_,(l=y*X-M*_)<0?(l=0,f=X,B=M):l>b&&(l=b,f=X+y,B=M)),f<0?(f=0,-_<0?l=0:-_>v?l=b:(l=-_,b=v)):f>B&&(f=B,-_+y<0?l=0:-_+y>v?l=b:(l=-_+y,b=v));var w=(1-(u=0===f?0:f/B))*i+u*a-((1-(s=0===l?0:l/b))*t+s*e),P=(1-u)*o+u*h-((1-s)*n+s*r);return w*w+P*P}function B(t,n){return t[0]===n[0]?t[1]-n[1]:t[0]-n[0]}i.default&&(i=i.default),e.exports=h,e.exports.default=h}),v=t.__toESM(x(),1),y=function(t,n={}){n.concavity=n.concavity||1/0;const e=[];if(h(t,t=>{e.push([t[0],t[1]])}),!e.length)return null;const r=(0,v.default)(e,n.concavity);return r.length>3?function(t,n,e={}){for(const r of t){if(r.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(r[r.length-1].length!==r[0].length)throw new Error("First and last Position are not equivalent.");for(let t=0;t<r[r.length-1].length;t++)if(r[r.length-1][t]!==r[0][t])throw new Error("First and last Position are not equivalent.")}return i({type:"Polygon",coordinates:t},n,e)}([r]):null},M=t=>"number"==typeof t.x&&"number"==typeof t.y?[t.x,t.y]:null,_=({folderId:t})=>{const{folders:i,organization:a}=e.useSession(),h=n.A({}),[s,l]=n.d(()=>t??null),u=Boolean(a?.integrationSettings?.enableFolderView);n.y(()=>{l(t??null)},[t]);const f=n.T(()=>u&&i?.filter(t=>(t.parentFolderId??null)===s&&t.boundary?.length>=1)||[],[i,s,u]),c=e.useQuery({queryKey:["public-events-map-leaf",a?._id,u,s??"root"],queryFn:async()=>{const t=s?{folderId:s,limit:500,sort:"-views",contentLimit:3}:u?{limit:500,sort:"-views",contentLimit:3}:{includeAllFolders:!0,limit:500,sort:"-views",contentLimit:3};return(await e.ky.get(e.API_ROUTES.PUBLIC_EVENTS,{headers:{"x-org-id":a?._id??""},searchParams:t}).json()).data??[]},enabled:Boolean(a?._id),staleTime:3e5,retry:!1}),m=c.isLoading||c.isFetching,p=c.data?.filter(t=>"number"==typeof t?.location?.x&&"number"==typeof t?.location?.y)??[],d=n.T(()=>f.map(t=>((t,n)=>{const e=t.boundary?.map(M).filter(t=>Boolean(t)),r=e?e.map(t=>t.join(",")).sort().join("|"):"",i=n[t._id];if(i&&i.hash===r)return i.feature;let a;if(e?.length){const t=e?.map(t=>o(t));if(t&&t.length>=3){const n=y(function(t,n={}){const e={type:"FeatureCollection"};return n.id&&(e.id=n.id),n.bbox&&(e.bbox=n.bbox),e.features=t,e}(t));"Polygon"===n?.geometry.type&&(a=n.geometry)}}if(!a&&e&&e.length>0&&(a={type:"Point",coordinates:1===e.length?e[0]:[e.reduce((t,n)=>t+n[0],0)/e.length,e.reduce((t,n)=>t+n[1],0)/e.length]}),!a)return null;const h={type:"Feature",id:t._id,properties:{folderId:t._id,name:t.name,color:t.color,eventCount:t.boundary?.length||0,isFolderPoint:"Point"===a.type},geometry:a};return n[t._id]={hash:r,feature:h},h})(t,h.current)).filter(t=>Boolean(t)),[f]),g=n.T(()=>({type:"FeatureCollection",features:d}),[d]),x=n.T(()=>i?.find(t=>t._id===s)??null,[i,s]),v=n.T(()=>s&&i?r.getBreadcrumbFromFlatFolders(i,s):[],[i,s]),_=n.T(()=>(t=>{const n=[],e=t=>{Array.isArray(t)&&("number"!=typeof t[0]||"number"!=typeof t[1]?t.forEach(e):n.push([t[0],t[1]]))};if(t.features.forEach(t=>e(t.geometry.coordinates)),0===n.length)return null;const r=n.map(t=>t[0]),i=n.map(t=>t[1]);return[Math.min(...r),Math.min(...i),Math.max(...r),Math.max(...i)]})(g),[g]);return{isFolderViewEnabled:u,activeFolderId:s,visibleFolders:f,visibleEvents:p,folderFeatures:d,folderFeatureCollection:g,breadcrumb:v,isLoadingEvents:m,isBusy:m,setActiveFolderId:t=>{l(t)},goBack:()=>{x&&l(x.parentFolderId??null)},activeFolder:x,folderBounds:_}};Object.defineProperty(exports,"useHierarchicalMap",{enumerable:!0,get:function(){return _}});
|