@map-colonies/react-components 4.13.3 → 4.13.5

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.
@@ -606,11 +606,11 @@ const Ft = 5, Gt = 2, Qn = ze(null), Mo = Qn.Provider, gn = 35, fn = 32, Io = 10
606
606
  if (e === null)
607
607
  throw new Error("vector layer context is null, please check the provider");
608
608
  return e;
609
- }, No = ({ children: e }) => {
610
- const t = Xe(), [n] = B(new Zi());
611
- return O(() => (t.addLayer(n), () => {
612
- t.removeLayer(n);
613
- }), [t, n]), /* @__PURE__ */ a(Oo, { value: n, children: e });
609
+ }, No = ({ options: e, children: t }) => {
610
+ const n = Xe(), [i] = B(new Zi(e));
611
+ return O(() => (n.addLayer(i), () => {
612
+ n.removeLayer(i);
613
+ }), [n, i]), /* @__PURE__ */ a(Oo, { value: i, children: t });
614
614
  }, ni = ze(null), Bo = ni.Provider, Fo = () => {
615
615
  const e = Ve(ni);
616
616
  if (e === null)
@@ -1700,7 +1700,7 @@ const bs = ({ options: e, isOpen: t, locale: n }) => {
1700
1700
  );
1701
1701
  }) : R === 0 ? /* @__PURE__ */ a(yt, { className: "generalListItem queryNoResults", children: j }) : M ? /* @__PURE__ */ a(yt, { className: `generalListItem ${P === 400 ? "queryWarning" : "queryError"}`, children: M }) : /* @__PURE__ */ a(yt, { className: "generalListItem" });
1702
1702
  })() })
1703
- ] })) })
1703
+ ] }, `option-${w}`)) })
1704
1704
  ] })
1705
1705
  ] }) });
1706
1706
  }, Ts = ({ options: e, locale: t, isOpen: n, setIsOpen: i }) => /* @__PURE__ */ z(ge, { children: [
@@ -1,8 +1,8 @@
1
- (function(u,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react/jsx-runtime"),require("react"),require("date-fns"),require("date-fns/locale"),require("@date-io/date-fns"),require("@material-ui/pickers"),require("@material-ui/core"),require("@material-ui/core/styles"),require("@map-colonies/react-core"),require("@material-ui/core/useMediaQuery"),require("react-datepicker"),require("date-fns/locale/he"),require("moment"),require("@turf/rewind"),require("ol"),require("ol/ol.css"),require("ol/coordinate"),require("ol/control"),require("ol/control/MousePosition"),require("ol/proj"),require("ol/layer"),require("ol/source"),require("ol/format"),require("ol/interaction"),require("ol/interaction/Draw"),require("ol/layer/VectorTile"),require("ol/style"),require("ol/tilegrid/WMTS"),require("ol/extent"),require("ol/source/TileWMS"),require("ol/source/XYZ"),require("ol/source/VectorTile"),require("ol-ext/legend/Legend"),require("ol-ext/control/Legend"),require("ol-ext/dist/ol-ext.css"),require("@material-ui/core/TableHead"),require("@material-ui/core/utils"),require("@material-ui/core/CssBaseline"),require("@material-ui/core/ScopedCssBaseline"),require("react-dom"),require("resium"),require("cesium"),require("lodash"),require("@turf/bbox"),require("@turf/invariant"),require("@turf/area"),require("@turf/bbox-polygon"),require("@turf/centroid"),require("@turf/helpers"),require("@turf/intersect"),require("@turf/point-to-polygon-distance"),require("@map-colonies/react-core/dist/list/styles"),require("@map-colonies/react-core/dist/textfield/styles"),require("@turf/boolean-point-in-polygon"),require("@cmcleese/cesium-navigation"),require("@cmcleese/cesium-navigation/dist/index.css"),require("@map-colonies/react-core/dist/linear-progress/styles"),require("@map-colonies/react-core/dist/checkbox/styles"),require("p-map"),require("uuid"),require("@turf/boolean-valid"),require("textarea-caret"),require("get-input-selection"),require("chonky"),require("chonky-icon-fontawesome"),require("filesize"),require("react-select"),require("react-circular-progressbar"),require("react-circular-progressbar/dist/styles.css"),require("react-move")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","date-fns","date-fns/locale","@date-io/date-fns","@material-ui/pickers","@material-ui/core","@material-ui/core/styles","@map-colonies/react-core","@material-ui/core/useMediaQuery","react-datepicker","date-fns/locale/he","moment","@turf/rewind","ol","ol/ol.css","ol/coordinate","ol/control","ol/control/MousePosition","ol/proj","ol/layer","ol/source","ol/format","ol/interaction","ol/interaction/Draw","ol/layer/VectorTile","ol/style","ol/tilegrid/WMTS","ol/extent","ol/source/TileWMS","ol/source/XYZ","ol/source/VectorTile","ol-ext/legend/Legend","ol-ext/control/Legend","ol-ext/dist/ol-ext.css","@material-ui/core/TableHead","@material-ui/core/utils","@material-ui/core/CssBaseline","@material-ui/core/ScopedCssBaseline","react-dom","resium","cesium","lodash","@turf/bbox","@turf/invariant","@turf/area","@turf/bbox-polygon","@turf/centroid","@turf/helpers","@turf/intersect","@turf/point-to-polygon-distance","@map-colonies/react-core/dist/list/styles","@map-colonies/react-core/dist/textfield/styles","@turf/boolean-point-in-polygon","@cmcleese/cesium-navigation","@cmcleese/cesium-navigation/dist/index.css","@map-colonies/react-core/dist/linear-progress/styles","@map-colonies/react-core/dist/checkbox/styles","p-map","uuid","@turf/boolean-valid","textarea-caret","get-input-selection","chonky","chonky-icon-fontawesome","filesize","react-select","react-circular-progressbar","react-circular-progressbar/dist/styles.css","react-move"],i):(u=typeof globalThis<"u"?globalThis:u||self,i(u.reactComponents={},u.jsxRuntime,u.React,u.dateFns,u.locale,u.DateFnsUtils,u.pickers,u.core,u.styles,u.reactCore,u.useMediaQuery,u.DatePicker,u.datePickerHebrewLocale,u.moment,u.rewind,u.ol,null,u.coordinate,u.control,u.MousePosition,u.proj,u.layer,u.source,u.format,u.interaction,u.Draw,u.VectorTile,u.style,u.WMTSTileGrid,u.extent,u.OlTileWMS,u.OlXYZ,u.VectorTileSource,u.OlExtLegend,u.OlExtLegendCtrl,null,u.TableHead,u.utils,u.CssBaseline,u.ScopedCssBaseline,u.ReactDOM,u.resium,u.Cesium,u.lodash,u.bbox,u.invariant,u.area,u.bboxPolygon,u.centroid,u.turf,u.intersect,u.pointToPolygonDistance,null,null,u.booleanPointInPolygon,u.viewerCesiumNavigationMixin,null,null,null,u.pMap,u.uuid,u.booleanValid,u.getCaretCoordinates,u.getInputSelection,u.chonky,u.chonkyIconFontawesome,u.filesize,u.Select,u.reactCircularProgressbar,null,u.reactMove))})(this,function(u,i,a,Le,Ue,bt,Ne,ae,Oe,J,Jn,Ct,Kn,Be,Qn,Mt,ss,_t,at,lt,Pt,It,ct,dt,Rn,er,tr,$e,nr,At,rr,ir,or,Dt,sr,as,ar,Ot,lr,cr,ut,Me,g,$,qe,dr,kt,je,ur,xt,Nt,hr,ls,cs,gr,pr,ds,us,hs,ht,Bt,fr,mr,Ft,re,yr,vr,Gt,Ye,gs,Er){"use strict";var is=Object.defineProperty;var os=(u,i,a)=>i in u?is(u,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):u[i]=a;var ue=(u,i,a)=>(os(u,typeof i!="symbol"?i+"":i,a),a);function gt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Vt=gt(a),M=gt(g),Ht=gt(xt),Q=e=>{const{children:t,...n}=e;return i.jsx(ae.Box,{...n,children:t})};var we=(e=>(e.BOX="BOX",e.POLYGON="POLYGON",e.UNKNOWN="UNKNOWN",e))(we||{}),Se=(e=>(e.HE="he",e.EN="en",e.RU="ru",e))(Se||{}),Ze=(e=>(e.TOP_RIGHT="TOP_RIGHT",e.BOTTOM_LEFT="BOTTOM_LEFT",e))(Ze||{});const he={DATE_PICKER:{dateFormat:"dd/MM/yyyy",local:{setText:"set",placeHolderText:"Enter the Date",calendarLocale:Se.EN},disableFuture:!0,showTime:!1,variant:"inline"},DATE_RANGE_PICKER:{dateFormat:"dd/MM/yyyy HH:mm",controlsLayout:"row",local:{setText:"set",startPlaceHolderText:"Start of time",endPlaceHolderText:"End of time",calendarLocale:Se.EN},renderAsButton:!0,offset:0,disableFuture:!0,showTime:!0}},Xe=e=>{const t=e.type==="dark";return a.useMemo(()=>Wt(e,t),[t,e])},Wt=(e,t=!1)=>Oe.createTheme({palette:{type:t?"dark":"light",primary:{main:e.primary},secondary:{main:e.secondary},error:{main:e.error},background:{default:e.surface,paper:e.background},text:{primary:t?e.textPrimaryOnDark:e.textPrimaryOnLight,secondary:t?e.textSecondaryOnDark:e.textSecondaryOnLight}}}),zt=e=>a.useMemo(()=>({...e,"cesium-color":"#EDFFFF","cesium-error":e["--mdc-theme-gc-error-medium"]??"#FF3636","cesium-warning":e["--mdc-theme-gc-warning-high"]??"#FFA032","cesium-checkbox-color":"#1A73E8","cesium-checkbox-width":"12px","cesium-checkbox-height":"12px","cesium-font-size":"10pt"}),[e]),ps="",wr=2,Tr=.5,Lr=Oe.makeStyles(e=>Oe.createStyles({container:{padding:e.spacing(wr),alignItems:"center"},setButton:{marginTop:e.spacing(1)},margin:{marginLeft:e.spacing(Tr)}})),Ut=e=>{var X,W,Z,ee;const t=Lr(),n=J.useTheme(),r=Xe(n),[s,o]=a.useState(null),[d,h]=a.useState(null),[f,E]=a.useState(he.DATE_RANGE_PICKER.dateFormat),C=e.controlsLayout??he.DATE_RANGE_PICKER.controlsLayout,b=e.disableFuture??he.DATE_RANGE_PICKER.disableFuture,p=((X=e.local)==null?void 0:X.startPlaceHolderText)??he.DATE_RANGE_PICKER.local.startPlaceHolderText,v=((W=e.local)==null?void 0:W.endPlaceHolderText)??he.DATE_RANGE_PICKER.local.endPlaceHolderText,I=((Z=e.local)==null?void 0:Z.setText)??he.DATE_RANGE_PICKER.local.setText,T=((ee=e.local)==null?void 0:ee.calendarLocale)??he.DATE_RANGE_PICKER.local.calendarLocale,F=e.showTime??he.DATE_RANGE_PICKER.showTime,V=T===Se.HE?Ue.he:Ue.enUS;a.useEffect(()=>{o(e.from??null)},[e.from]),a.useEffect(()=>{h(e.to??null)},[e.to]),a.useEffect(()=>{E(e.dateFormat??he.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const j=Boolean(Le.isValid(s)&&!d||Le.isValid(d)&&!s||s&&d&&Le.isValid(s)&&Le.isValid(d)&&Le.isBefore(s,d)),Y=()=>{e.onChange({from:s&&Le.isValid(s)?s:void 0,to:d&&Le.isValid(d)?d:void 0})},G=F?Ne.KeyboardDateTimePicker:Ne.KeyboardDatePicker;return i.jsx(ae.ThemeProvider,{theme:r,children:i.jsx(Q,{className:`${t.container} drpContainer`,display:"flex",flexDirection:C,width:C==="column"?e.contentWidth:"unset",children:i.jsxs(Ne.MuiPickersUtilsProvider,{utils:bt,locale:V,children:[i.jsx(G,{variant:"inline",placeholder:p,onChange:l=>o(l),value:s,disableFuture:b,format:f,maxDate:e.maxDate,minDate:e.minDate}),i.jsx(G,{variant:"inline",placeholder:v,className:t.margin,onChange:l=>h(l),value:d,disableFuture:b,format:f,maxDate:e.maxDate,minDate:e.minDate}),i.jsx(J.ThemeProvider,{options:n,children:i.jsx(J.Button,{className:`${t.setButton} ${t.margin}`,raised:!0,onClick:Y,disabled:!j,children:I})})]})})})},$t=e=>{const{children:t,...n}=e;return i.jsx(ae.Popover,{...n,children:t})},fs="",Sr=e=>{var G,X;const[t,n]=a.useState(null),[r,s]=a.useState(null),[o,d]=a.useState(he.DATE_RANGE_PICKER.dateFormat),[h,f]=a.useState(null),E=W=>{f(W.currentTarget)},C=W=>{W.currentTarget.tagName==="I"?f(W.currentTarget.previousElementSibling):f(W.currentTarget)},b=()=>{f(null)},p=Boolean(h),v=e.controlsLayout??"column";a.useEffect(()=>{n(e.from??null)},[e.from]),a.useEffect(()=>{s(e.to??null)},[e.to]),a.useEffect(()=>{d(e.dateFormat??he.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const I=((G=e.local)==null?void 0:G.startPlaceHolderText)??he.DATE_RANGE_PICKER.local.startPlaceHolderText,T=((X=e.local)==null?void 0:X.endPlaceHolderText)??he.DATE_RANGE_PICKER.local.endPlaceHolderText,F=e.renderAsButton===void 0?he.DATE_RANGE_PICKER.renderAsButton:e.renderAsButton,V=e.offset===void 0?he.DATE_RANGE_PICKER.offset:e.offset,j=e.disableFuture===void 0?he.DATE_RANGE_PICKER.disableFuture:e.disableFuture,Y=a.useMemo(()=>`${t?Le.format(t,o):I} - ${r?Le.format(r,o):T}`,[t,r,o,I,T]);return i.jsxs(i.Fragment,{children:[F?i.jsx(J.Button,{style:{width:e.width},raised:!0,onClick:E,className:"drpOpener",children:Y}):i.jsx(J.TextField,{className:"drpOpener",readOnly:!0,style:{width:e.width},value:Y,onClick:C,trailingIcon:{icon:"date_range",tabIndex:0,onClick:C}}),i.jsx($t,{open:p,anchorEl:h,onClose:b,anchorOrigin:{vertical:"bottom",horizontal:"left"},keepMounted:!0,children:i.jsx(Ut,{controlsLayout:v,contentWidth:((h==null?void 0:h.clientWidth)??0)-V,dateFormat:o,disableFuture:j,minDate:e.minDate,maxDate:e.maxDate,local:e.local,from:t??void 0,to:r??void 0,onChange:({from:W,to:Z})=>{n(W??null),s(Z??null),e.onChange({from:W,to:Z}),b()}})})]})},Je=e=>typeof e<"u"&&e!==null&&"startDate"in e&&"endDate"in e,br=({endDate:e,startDate:t,setEndDate:n=()=>{},setStartDate:r=()=>{},endTimeInputClassName:s="",endTimeLabel:o="",endTimeWrapperClassName:d="",timeRangeInputsWrapperClassName:h="",startTimeInputClassName:f="",startTimeLabel:E="",startTimeWrapperClassName:C=""})=>i.jsxs("div",{className:`timeRangeWrapper ${h}`,children:[i.jsx("div",{className:`startTimeWrapper ${C}`,children:i.jsx(J.TextField,{label:E,disabled:t===null,className:`timeRangeInput ${f}`,name:"start-time",type:"time",value:Be(t).format("HH:mm"),onChange:b=>{const p=Be(t),v=Be(b.currentTarget.value,"HH:mm"),I=p.set({hours:v.get("hours"),minutes:v.get("minutes")});r(I.toDate())}})}),i.jsx("div",{className:`endTimeWrapper ${d}`,children:i.jsx(J.TextField,{label:o,disabled:e===null,className:`timeRangeInput ${s}`,name:"end-time",type:"time",value:Be(e).format("HH:mm"),onChange:b=>{const p=Be(e),v=Be(b.currentTarget.value,"HH:mm"),I=p.set({hours:v.get("hours"),minutes:v.get("minutes")});n(I.toDate())}})})]}),Cr=a.forwardRef(({value:e,onClick:t,onInputClick:n,...r},s)=>i.jsx(J.TextField,{...r,className:"dateRangeCustomInput",readOnly:!0,onClick:o=>{t==null||t(o),n==null||n()},ref:s,value:e})),Mr=({setStartDate:e=()=>{},setEndDate:t=()=>{},shortcuts:n,dateRange:r,onShortcut:s})=>{const[o,d]=a.useState(),h=a.useMemo(()=>n.map(f=>f instanceof Function?f():f),[n]);return a.useEffect(()=>{for(const f of h){const E=r.startDate&&r.endDate&&Le.isSameDay(f.startDate,r.startDate)&&Le.isSameDay(f.endDate,r.endDate);o?f.id===o&&(E||d(void 0)):E&&d(f.id)}},[r,o,h]),i.jsx("div",{className:"shortcutsContainer",children:h.map((f,E)=>{const C=()=>{e(f.startDate),t(f.endDate)};return i.jsx(J.Button,{type:"button",className:`shortcut ${o===f.id?"selected":""}`,onClick:b=>{C(),s==null||s({startDate:f.startDate,endDate:f.endDate})},outlined:!0,children:f.label},f.id+E)})})},_r=a.forwardRef((e,t)=>{const{calendarClassName:n,dayClassName:r,monthClassName:s,selectsRange:o,onChange:d,inputName:h,showMonthYearDropdown:f,withShortcuts:E,locale:C="en"}=e,[b,p]=a.useState(null),[v,I]=a.useState(null),[T,F]=a.useState(!1),V=o?{startDate:b,endDate:v}:b;a.useEffect(()=>{C==="he"&&Ct.registerLocale("he",Kn)},[C]),a.useEffect(()=>{var G,X;((G=e.startDate)==null?void 0:G.toString())!==(b==null?void 0:b.toString())&&p(e.startDate),((X=e.endDate)==null?void 0:X.toString())!==(v==null?void 0:v.toString())&&I(e.endDate)},[e.startDate,e.endDate,b,v]);const j=a.useMemo(()=>{let G="pickerContainer"+(C==="he"?" pickerContainer-rtl":"");return E&&o&&(G+=" pickerContainer-withShortcuts"),G},[C,E,o]),Y=f?{showMonthDropdown:!0,showYearDropdown:!0,dropdownMode:"select"}:{};return i.jsx("div",{className:j,style:{direction:C==="he"?"rtl":"ltr"},children:i.jsx(Ct,{...e,ref:t,onClickOutside:()=>F(!1),open:T,startDate:Je(V)?b:void 0,selected:b,endDate:Je(V)?v:void 0,monthsShown:e.monthsShown??2,calendarClassName:`pickerCalendar ${n}`,weekDayClassName:G=>`pickerWeek ${(r==null?void 0:r(G))??""}`,dayClassName:G=>`pickerDay ${(r==null?void 0:r(G))??""}`,monthClassName:G=>`pickerMonth ${(s==null?void 0:s(G))??""}`,onChange:(G,X)=>{if(Array.isArray(G)){const[W,Z]=G;p(W),I(Z),d==null||d({startDate:W,endDate:Z&&Le.endOfDay(Z)},X)}else p(G),d==null||d(G,X)},customInput:i.jsx(Cr,{name:h,onInputClick:()=>{F(!0)}}),showTimeInput:!!(E&&o),timeInputLabel:"",customTimeInput:E&&Je(V)&&i.jsx(Mr,{onShortcut:G=>{d==null||d(G),F(!1)},shortcuts:E,setEndDate:I,setStartDate:p,dateRange:V}),showMonthYearDropdown:void 0,...Y})})}),ms="",Pr=e=>{const t=J.useTheme(),n=Xe(t),{format:r=he.DATE_PICKER.dateFormat,variant:s=he.DATE_PICKER.variant,disableFuture:o=he.DATE_PICKER.disableFuture,local:d,onChange:h,showTime:f=he.DATE_PICKER.showTime,value:E,...C}=e,{placeHolderText:b=he.DATE_PICKER.local.placeHolderText,calendarLocale:p}=d??{placeHolderText:he.DATE_PICKER.local.placeHolderText,calendarLocale:Se.EN},v=p===Se.HE?Ue.he:Ue.enUS,I=T=>{h(T)};return i.jsx(ae.ThemeProvider,{theme:n,children:i.jsxs(Ne.MuiPickersUtilsProvider,{utils:bt,locale:v,children:[f&&i.jsx(Ne.KeyboardDateTimePicker,{variant:s,placeholder:b,onChange:I,value:E,disableFuture:o,format:r,...C}),!f&&i.jsx(Ne.KeyboardDatePicker,{variant:s,placeholder:b,onChange:I,value:E,disableFuture:o,format:r,...C})]})})},Ir=18,Ar=Oe.makeStyles(e=>Oe.createStyles({drawingButton:{width:e.spacing(Ir)},fullWidth:{width:"100%",marginTop:"36px"}})),Dr=e=>{const t=Ar(),[n,r]=a.useState(null),{isSelectionEnabled:s,onCancelDraw:o,onStartDraw:d,onReset:h}=e,f=C=>{r(C.currentTarget)},E=()=>{r(null)};return s?i.jsx(J.Tooltip,{content:"Cancel the ongoing draw",align:"bottomLeft",children:i.jsx(J.Button,{className:t.drawingButton,raised:!0,onClick:o,children:"Cancel Draw"})}):i.jsxs(Q,{position:"relative",children:[i.jsx(J.Tooltip,{content:"draw an Area of interest to limit the search",align:"bottomLeft",children:i.jsx(J.Button,{className:t.drawingButton,raised:!0,onClick:f,children:"Draw AOI"})}),i.jsxs(J.Menu,{className:t.fullWidth,open:Boolean(n),onClose:E,children:[i.jsx(J.MenuItem,{onClick:()=>{d(we.POLYGON),E()},children:"Polygon"}),i.jsx(J.MenuItem,{onClick:()=>{d(we.BOX),E()},children:"Box"}),i.jsx(J.MenuItem,{onClick:()=>{h(),E()},children:"Clear"})]})]})},ys="";var be=(e=>(e.WGS84="EPSG:4326",e.WEB_MERCATOR="EPSG:3857",e))(be||{});const Ke=5,Qe=2,qt=a.createContext(null),Or=qt.Provider,jt=35,Yt=32,kr=10,xr=e=>e!==void 0&&e!==be.WGS84?Pt.transform([jt,Yt],be.WGS84,e):[jt,Yt],Nr=e=>{switch(e){case be.WEB_MERCATOR:return t=>_t.format(t,"Mercator: {y}m, {x}m",Qe);case be.WGS84:return t=>_t.format(t,"WGS84: {y}°N {x}°E",Ke);default:return t=>""}},ke=()=>{const e=a.useContext(qt);if(e===null)throw new Error("map context is null, please check the provider");return e},Zt=e=>{const t=a.useRef(null),{allowFullScreen:n,showMousePosition:r,projection:s}=e,[o]=a.useState(new Mt.Map({view:new Mt.View({projection:s??be.WGS84}),controls:at.defaults()}));a.useEffect(()=>{o.getView().setCenter(e.center??xr(e.projection))},[o,e.center,e.projection]),a.useEffect(()=>{o.getView().setZoom(e.zoom??kr)},[o,e.zoom,e.projection]);const d=(h,f)=>{f.getControls().forEach(C=>{C instanceof h&&f.removeControl(C)})};return a.useEffect(()=>{o.setTarget(t.current),n!==void 0&&n?o.addControl(new at.FullScreen):d(at.FullScreen,o)},[o,n]),a.useEffect(()=>{r!==void 0&&r?(d(lt,o),o.addControl(new lt({coordinateFormat:Nr(s??be.WGS84),projection:s??be.WGS84,undefinedHTML:"&nbsp;"}))):d(lt,o)},[o,r,s]),i.jsxs(Or,{value:o,children:[i.jsx("div",{className:"map",ref:t}),e.children]})},Xt=a.createContext(null),Br=Xt.Provider,Ve=()=>{const e=a.useContext(Xt);if(e===null)throw new Error("tile layer context is null, please check the provider");return e},Jt=({options:e,children:t})=>{const n=ke(),[r]=a.useState(new It.Tile(e));return a.useEffect(()=>(n.addLayer(r),()=>{n.removeLayer(r)}),[n,r]),i.jsx(Br,{value:r,children:t})},Kt=a.createContext(null),Fr=Kt.Provider,Qt=()=>{const e=a.useContext(Kt);if(e===null)throw new Error("vector layer context is null, please check the provider");return e},Rt=({children:e})=>{const t=ke(),[n]=a.useState(new It.Vector);return a.useEffect(()=>(t.addLayer(n),()=>{t.removeLayer(n)}),[t,n]),i.jsx(Fr,{value:n,children:e})},en=a.createContext(null),Gr=en.Provider,tn=()=>{const e=a.useContext(en);if(e===null)throw new Error("vector source context is null, please check the provider");return e},nn=({children:e})=>{const t=Qt(),[n]=a.useState(new ct.Vector);return a.useEffect(()=>{t.setSource(n)},[n,t]),i.jsx(Gr,{value:n,children:e})},rn=({geometry:e,fitOptions:t,fit:n,featureStyle:r})=>{const s=tn(),o=ke();return a.useLayoutEffect(()=>{const h=new dt.GeoJSON().readFeature(e);return n&&s.on("addfeature",function(){o.getView().fit(s.getExtent(),t)}),r&&h.setStyle(r),s.addFeature(h),()=>{s.removeFeature(h)}},[e,s,n]),null},on=e=>{const t=Ve();return a.useEffect(()=>{t.setSource(new ct.OSM)},[t]),null},sn=({drawType:e,onPolygonSelected:t})=>{const n=ke();return a.useEffect(()=>{const r={type:"Circle"};switch(e){case we.BOX:r.geometryFunction=er.createBox();break;case we.POLYGON:r.type="Polygon";break;default:return}const s=new Rn.Draw(r);n.addInteraction(s);const o=d=>{const f=new dt.GeoJSON().writeGeometryObject(d.feature.getGeometry());t==null||t(f)};return s.on("drawend",o),()=>{s.un("drawend",o),n.removeInteraction(s)}},[t,e,n]),null},vs="",Vr=e=>{const t=n=>{const r=Qn(n);e.onPolygonSelection(r)};return i.jsxs(Zt,{allowFullScreen:!0,showMousePosition:!0,children:[i.jsx(Jt,{children:i.jsx(on,{})}),e.selectionPolygon&&i.jsx(Rt,{children:i.jsx(nn,{children:i.jsx(rn,{geometry:e.selectionPolygon})})}),e.children,e.drawType!==void 0&&i.jsx(sn,{drawType:e.drawType,onPolygonSelected:t})]})},pt=1.5,Hr=80,Wr=Oe.makeStyles(e=>Oe.createStyles({map:{height:"100%",width:"100%",position:"absolute"},absolute:{position:"absolute",zIndex:1e3,left:e.spacing(pt),top:e.spacing(pt)},contentContainer:{marginTop:e.spacing(pt),width:e.spacing(Hr)},filtersContainer:{display:"flex",padding:e.spacing(1)},filtersMargin:{marginLeft:e.spacing(1)}})),zr=e=>{var f;const[t,n]=a.useState(),[r,s]=a.useState(),o=Wr(),d=E=>{s(E),n(void 0),e.handlePolygonSelected(E)},h=()=>{s(void 0),e.handlePolygonReset()};return i.jsxs("div",{className:o.map,children:[i.jsxs("div",{className:`${o.absolute}`,children:[i.jsxs(ae.Paper,{className:o.filtersContainer,children:[i.jsx(Dr,{onCancelDraw:()=>n(void 0),onReset:h,onStartDraw:n,isSelectionEnabled:t!==void 0}),(f=e.filters)==null?void 0:f.map((E,C)=>i.jsx("div",{className:o.filtersMargin,children:E},C))]}),i.jsx(ae.Paper,{color:"red",className:`${o.contentContainer}`,children:e.children})]}),i.jsx(Vr,{children:e.mapContent,onPolygonSelection:d,drawType:t,selectionPolygon:r})]})},an=new $e.Fill({color:"rgba(255,255,255,0.4)"}),ln=new $e.Stroke({color:"#3399CC",width:1.25}),cn=[new $e.Style({image:new $e.Circle({fill:an,stroke:ln,radius:5}),fill:an,stroke:ln})],dn=a.createContext(null),Ur=dn.Provider,un=()=>{const e=a.useContext(dn);if(e===null)throw new Error("vector tile layer context is null, please check the provider");return e},$r=({children:e,options:t,style:n})=>{const r=ke(),[s]=a.useState(new tr({...t,style:n||cn}));return a.useEffect(()=>(r.addLayer(s),()=>{r.removeLayer(s)}),[r,s]),a.useEffect(()=>{s.setStyle(n||cn)},[s,n]),i.jsx(Ur,{value:s,children:e})},ft=20,qr=256,jr=2,Yr=2,Zr="REST",Xr=e=>{const t=Pt.get(e.projection),n=t.getExtent(),r=new Array(ft),s=new Array(ft),o=At.getWidth(n)/qr,d=e.heightWidthRatio!==void 0?e.heightWidthRatio:Yr,h=e.requestEncoding!==void 0?e.requestEncoding:Zr;for(let E=0;E<ft;++E)r[E]=o/Math.pow(jr,E)/d,s[E]=E.toString();return{attributions:e.attributions,url:e.url,layer:e.layer,matrixSet:e.matrixSet,format:e.format,projection:t,tileGrid:new nr({origin:At.getTopLeft(n),resolutions:r,matrixIds:s}),style:e.style,requestEncoding:h,wrapX:e.wrapX!==void 0?e.wrapX:!0}},Jr=e=>{const t=Ve(),{options:n}=e;return a.useEffect(()=>{t.setSource(new ct.WMTS(n))},[t,n]),null},Kr=e=>{const{attributions:t,url:n,params:r,serverType:s,transition:o}=e;return{attributions:t,url:n,params:r,serverType:s,transition:o}},Qr=e=>{const t=Ve(),{options:n}=e;return a.useEffect(()=>{t.setSource(new rr(n))},[t,n]),null},Rr=e=>{const{attributions:t,url:n}=e;return{attributions:t,url:n}},ei=e=>{const t=Ve(),{options:n}=e;return a.useEffect(()=>{t.setSource(new ir(n))},[t,n]),null},ti=a.createContext(null),ni=()=>{const e=a.useContext(ti);if(e===null)throw new Error("vector tile source context is null, please check the provider");return e},ri=e=>{const{url:t}=e;return{url:t,format:new dt.MVT}},ii=({children:e,options:t})=>{const n=un();return a.useEffect(()=>{n.setSource(new or(t))},[t,n]),null},oi=({legendItems:e,title:t,isCollapsed:n})=>{const r=ke();return a.useEffect(()=>{const s=new Dt({title:t??"",margin:5,maxWidth:300}),o=new sr({legend:s,collapsed:n===void 0?!0:n});r.addControl(o);const d=new Dt({margin:4});return e.forEach(h=>{d.addItem({title:h.title,style:h.style,typeGeom:"Polygon"})}),s.addItem(d),()=>{r.removeControl(o)}},[r,e,t,n]),i.jsx(i.Fragment,{})};function si(e){const{headCells:t,order:n,orderBy:r,onRequestSort:s,isCollapseable:o}=e,d=h=>f=>{s(f,h)};return i.jsx(ar,{children:i.jsxs(ae.TableRow,{children:[o&&i.jsx(ae.TableCell,{}),t.map(h=>i.jsx(ae.TableCell,{align:h.numeric?"right":"left",padding:h.disablePadding?"none":"default",sortDirection:r===h.id?n:!1,children:i.jsx(ae.TableSortLabel,{active:r===h.id,direction:r===h.id?n:"asc",onClick:d(h.id),children:h.label})},h.id))]})})}const ai=Ot.createSvgIcon(Vt.createElement("path",{d:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDown"),li=Ot.createSvgIcon(Vt.createElement("path",{d:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp");function ci(e){const{cellsMetadata:t,isRowSelected:n,item:r,onRowSelected:s,rowIndex:o,isCollapseable:d,collapsedElement:h}=e,[f,E]=a.useState(!1),C=t.length,b=()=>{s==null||s(o)};return i.jsxs(i.Fragment,{children:[i.jsxs(ae.TableRow,{hover:!0,selected:n,onClick:b,children:[d&&i.jsx(ae.TableCell,{padding:"checkbox",children:i.jsx(ae.IconButton,{"aria-label":"expand row",size:"small",onClick:p=>{p.stopPropagation(),E(!f)},children:f?i.jsx(li,{}):i.jsx(ai,{})})}),t.map(p=>i.jsx(ae.TableCell,{align:p.numeric?"right":"left",padding:p.disablePadding?"none":"default",children:p.transform?p.transform(r[p.id]):r[p.id]},p.id+o.toString()))]}),d&&i.jsx(ae.TableRow,{children:i.jsx(ae.TableCell,{style:{paddingBottom:0,paddingTop:0},colSpan:C+1,children:i.jsx(ae.Collapse,{in:f,unmountOnExit:!0,timeout:"auto",children:h==null?void 0:h(r)})})})]})}function di(e){const[t,n]=a.useState(""),[r,s]=a.useState("asc"),{cellsMetadata:o,items:d,onRequestSort:h,onRowSelected:f,isCollapseable:E,collapsedElement:C,isDense:b,page:p,rowsPerPage:v,count:I,handleChangePage:T,handleChangeRowsPerPage:F}=e,V=(j,Y)=>{const G=t===Y&&r==="asc";s(G?"desc":"asc"),n(Y),h(Y,G?"desc":"asc")};return i.jsxs(ae.TableContainer,{component:ae.Paper,children:[i.jsxs(ae.Table,{size:b?"small":"medium",children:[i.jsx(si,{headCells:o,onRequestSort:V,order:r,orderBy:t,isCollapseable:E}),i.jsxs(ae.TableBody,{children:[d.map((j,Y)=>i.jsx(ci,{item:j,rowIndex:Y,isCollapseable:E,cellsMetadata:o,collapsedElement:C,isRowSelected:!1,onRowSelected:f},Y)),(d.length===0||v>d.length)&&i.jsx(ae.TableRow,{style:{height:(b?33:53)*(v-d.length)},children:i.jsx(ae.TableCell,{colSpan:E?o.length+1:o.length,children:d.length===0&&i.jsx(ae.Typography,{align:"center",children:"No results :("})})})]})]}),i.jsx(ae.TablePagination,{rowsPerPage:v,rowsPerPageOptions:[5,10],component:"div",count:I,page:p,onPageChange:T,onRowsPerPageChange:F})]})}const ui=e=>{const{children:t,...n}=e;return i.jsx(lr,{...n,children:t})},hi=e=>{const{children:t,...n}=e;return i.jsx(cr,{...n,children:t})},hn=e=>e*Math.PI/180,Re=e=>e*(180/Math.PI),gi=e=>.05*(5916575505e-1/Math.pow(2,e-1)/2)*(Math.cos(hn(85.362/2))/Math.sin(hn(85.362/2))),pi=({title:e,onClick:t})=>i.jsx("div",{className:"cesium-cesiumInspector-button",onClick:t,children:e}),fi=({title:e,isVisible:t,onClick:n,children:r})=>i.jsxs(Q,{className:`cesium-cesiumInspector ${t?"cesium-cesiumInspector-visible":""}`,children:[i.jsx(pi,{title:e,onClick:n}),t&&i.jsx(Q,{className:"cesium-cesiumInspector-dropDown",children:r})]}),Es="",mt="Imagery",yt="Data",mi=({locale:e})=>{var b,p;const t=pe(),[n,r]=a.useState([{id:mt,values:[]},{id:yt,values:[]}]),[s,o]=a.useState({}),d=v=>$.get(e,v.toUpperCase())??v,h=()=>t.imageryLayers?Array.from({length:t.imageryLayers.length},(v,I)=>{var V;const T=t.imageryLayers.get(I),F=T.meta;return{id:F==null?void 0:F.id,name:$.get(F,"layerRecord.productName")??(F==null?void 0:F.id),rect:T.rectangle,isBaseMap:(V=t.layersManager)==null?void 0:V.isBaseMapLayer(F)}}):[],f=()=>{var v;return((v=t.layersManager)==null?void 0:v.dataLayerList.map(I=>{var T,F;return{id:(T=I.meta)==null?void 0:T.id,name:$.get(I.meta,"featureStructure.aliasLayerName")??I.meta.productName,rect:g.Rectangle.fromDegrees(...qe((F=I.meta)==null?void 0:F.footprint)),isBaseMap:!1}}))||[]};a.useEffect(()=>{(()=>{const I=[{id:mt,values:h()},{id:yt,values:f()}];r(I),o(I.reduce((T,F)=>({...T,[F.id]:!0}),{}))})()},[]),a.useEffect(()=>{if(!t.layersManager)return;const v=()=>{r(I=>I.map(T=>T.id===mt?{...T,values:h()}:T))};return t.layersManager.addLayerUpdatedListener(v),t.imageryLayers.layerRemoved.addEventListener(v),()=>{var I;$.get(t,"_cesiumWidget")!==void 0&&((I=t.layersManager)==null||I.removeLayerUpdatedListener(v),t.imageryLayers.layerRemoved.removeEventListener(v))}},[(b=t.layersManager)==null?void 0:b.layerList]),a.useEffect(()=>{if(!t.layersManager)return;const v=()=>{r(I=>I.map(T=>T.id===yt?{...T,values:f()}:T))};return t.layersManager.addDataLayerUpdatedListener(v),()=>{var I;(I=t.layersManager)==null||I.removeDataLayerUpdatedListener(v)}},[(p=t.layersManager)==null?void 0:p.dataLayerList]);const E=v=>{o(I=>({...I,[v]:!I[v]}))},C=v=>{t.camera.flyTo({destination:v})};return i.jsx(Q,{className:"activeLayersPanel",children:n.filter(v=>v.values.length>0).map(v=>i.jsxs(Q,{className:`cesium-cesiumInspector-section ${s[v.id]?"cesium-cesiumInspector-section-collapsed":""}`,onClick:()=>E(v.id),children:[i.jsx(J.Typography,{tag:"h3",className:"cesium-cesiumInspector-sectionHeader",children:d(v.id)}),i.jsx(Q,{className:"cesium-cesiumInspector-sectionContent",children:v.values.map(I=>i.jsxs(Q,{className:"layer",children:[i.jsx(J.Tooltip,{content:I.name,children:i.jsx(Q,{className:`name ${I.isBaseMap?"disabled":""}`,children:I.name})}),i.jsx(Q,{className:"icons",children:i.jsx(J.Tooltip,{content:$.get(e,"FLY_TO")??"Fly To",children:i.jsx(Q,{className:"icon",onClick:T=>{T.stopPropagation(),C(I.rect)},children:i.jsxs("svg",{fill:"var(--mdc-theme-cesium-color)",width:"100%",height:"100%",viewBox:"0 0 256 256",children:[i.jsx("path",{d:"M236,120H223.66406A96.15352,96.15352,0,0,0,136,32.33618V20a8,8,0,0,0-16,0V32.33618A96.15352,96.15352,0,0,0,32.33594,120H20a8,8,0,0,0,0,16H32.33594A96.15352,96.15352,0,0,0,120,223.66382V236a8,8,0,0,0,16,0V223.66382A96.15352,96.15352,0,0,0,223.66406,136H236a8,8,0,0,0,0-16Zm-40,16h11.59912A80.14164,80.14164,0,0,1,136,207.59912V196a8,8,0,0,0-16,0v11.59912A80.14164,80.14164,0,0,1,48.40088,136H60a8,8,0,0,0,0-16H48.40088A80.14164,80.14164,0,0,1,120,48.40088V60a8,8,0,0,0,16,0V48.40088A80.14164,80.14164,0,0,1,207.59912,120H196a8,8,0,0,0,0,16Z"}),i.jsx("polygon",{points:"128,80 80,170 128,150 176,170",fill:"var(--mdc-theme-cesium-color)"})]})})})})]},I.id))})]},v.id))})},yi=({locale:e})=>{const[t,n]=a.useState(!1),r=a.useMemo(()=>$.get(e,"ACTIVE_LAYERS_TITLE")??"Active Layers",[e]);return i.jsx(fi,{title:r,isVisible:t,onClick:()=>n(!t),children:i.jsx(mi,{locale:e})})},et=({onClick:e,children:t})=>i.jsx("div",{className:"cesium-toolbar-button cesium-button",onClick:e,children:t}),vt=({title:e})=>i.jsx(Q,{className:"cesium-mc-title",children:e}),Et=({isVisible:e,children:t,title:n})=>i.jsxs(Q,{className:`cesium-mc-tool ${e?"cesium-mc-tool-visible":""}`,children:[n&&i.jsx(vt,{title:n}),t]}),ws="";function wt(e){return function(n){const r=a.useRef(null),[s,o]=a.useState(!1);return a.useEffect(()=>{if(!s)return;const d=h=>{const f=h.target;r.current&&!r.current.contains(f)&&o(!1)};return document.addEventListener("click",d,!0),()=>{document.removeEventListener("click",d,!0)}},[s]),i.jsx("div",{ref:r,className:"disappear",children:i.jsx(e,{...n,isOpen:s,setIsOpen:o})})}}const gn=({item:e,isSelected:t,onClick:n})=>i.jsxs(Q,{className:`cesium-baseLayerPicker-item ${t?"cesium-baseLayerPicker-selectedItem":""}`,title:e.title,onClick:n,children:[i.jsx("img",{className:"cesium-baseLayerPicker-itemIcon",src:e.thumbnail,alt:e.title}),i.jsx(Q,{className:"cesium-baseLayerPicker-itemLabel",children:e.title})]}),vi=({title:e,baseMaps:t,setCurrent:n})=>{const r=pe(),[s,o]=a.useState();a.useEffect(()=>{const h=t.maps.find(f=>f.isCurrent);h&&(o(h),n(h))},[t]);const d=h=>{var E,C;(E=r.layersManager)==null||E.removeBaseMapLayers();const f=t.maps.find(b=>b.id===h);f&&((C=r.layersManager)==null||C.setBaseMapLayers(f),o(f),n(f),t.maps.forEach(b=>{b.isCurrent=f===b}))};return i.jsxs(i.Fragment,{children:[i.jsx(vt,{title:e}),i.jsx(Q,{className:"cesium-mc-choices",children:t.maps.map(h=>i.jsx(gn,{item:h,isSelected:s===h,onClick:()=>d(h.id)},h.id))})]})},Ei=({title:e,terrains:t})=>{const[n,r]=a.useState(),s=pe();a.useEffect(()=>{const d=t.find(h=>h.isCurrent);d&&r(d)},[t]);const o=d=>{const h=t.find(f=>f.id===d);h&&(s.terrainProvider=h.terrainProvider??new g.EllipsoidTerrainProvider({}),r(h),t.forEach(f=>{f.isCurrent=h===f}))};return i.jsxs(i.Fragment,{children:[i.jsx(vt,{title:e}),i.jsx(Q,{className:"cesium-mc-choices",children:t.map(d=>i.jsx(gn,{item:d,isSelected:n===d,onClick:()=>o(d.id)},d.id))})]})},wi=wt(({baseMaps:e,terrains:t,locale:n,isOpen:r,setIsOpen:s})=>{const[o,d]=a.useState(),h=a.useMemo(()=>$.get(n,"BASE_MAP_TITLE")??"Base Map",[n]),f=a.useMemo(()=>$.get(n,"TERRAIN_TITLE")??"Terrain",[n]);return i.jsxs(i.Fragment,{children:[i.jsx(et,{onClick:()=>s(!r),children:i.jsx("img",{className:"cesium-baseLayerPicker-selected",src:o==null?void 0:o.thumbnail,title:o==null?void 0:o.title,alt:"Current Map"})}),i.jsxs(Et,{isVisible:r,children:[e&&i.jsx(vi,{title:h,baseMaps:e,setCurrent:d}),t&&i.jsx(Ei,{title:f,terrains:t})]})]})}),Ls="",Ti=({featureTypes:e,locale:t})=>{const n=a.useMemo(()=>$.get(t,"WFS_TITLE")??"Data Layers",[t]),r=a.useMemo(()=>$.get(t,"WFS_CACHE")??"Cache",[t]),s=a.useMemo(()=>$.get(t,"WFS_EXTENT")??"Extent",[t]),o=a.useMemo(()=>$.get(t,"NO_DATA_LAYERS")??"No layers found",[t]),d=a.useMemo(()=>i.jsx(Q,{className:"title",children:n}),[n]),h=a.useMemo(()=>i.jsx(i.Fragment,{children:e.length>0?e.map((f,E)=>i.jsxs(Q,{className:"featureType",children:[i.jsx(J.Tooltip,{content:`${f.featureStructure.aliasLayerName} ${f.id} (${String(f.zoomLevel)})`,children:i.jsxs(Q,{className:`name ${f.currentZoomLevel<f.zoomLevel?"warning blinking":f.total===-1?"error blinking":""}`,children:[f.featureStructure.aliasLayerName," (",String(f.zoomLevel),"):"]})}),i.jsxs(Q,{className:"info",children:[i.jsxs(Q,{children:[r,": ",f.cache??0]}),f.total>0&&i.jsxs(Q,{className:"spacer",children:[s,": ",f.items," / ",f.total]})]})]},E)):i.jsx(Q,{children:o})}),[e]);return i.jsxs(Q,{className:"wfsContainer",children:[d,h]})},Li=wt(({locale:e,isOpen:t,setIsOpen:n})=>{var h;const[r,s]=a.useState([]),o=a.useMemo(()=>$.get(e,"DEBUG_PANEL_TITLE")??"Debugger Tool",[e]),d=pe();return a.useEffect(()=>{if(!d.layersManager)return;const f=(E,C)=>{var p;E.forEach(v=>{if(C!==void 0&&C!==v.meta.id)return;const{options:I,meta:T}=v,{zoomLevel:F}=I,{id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W}=T;s(Z=>{const ee=Z.findIndex(l=>l.id===V);if(ee>=0){if(JSON.stringify(Z[ee])!==JSON.stringify({id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W,zoomLevel:F})){const l=[...Z];return l[ee]={id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W,zoomLevel:F},l}}else return[...Z,{id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W,zoomLevel:F}];return Z})});const b=new Set((p=d.layersManager)==null?void 0:p.dataLayerList.map(v=>v.meta.id));s(v=>v.filter(I=>b.has(I.id)))};return d.layersManager.addDataLayerUpdatedListener(f),()=>{var E;(E=d.layersManager)==null||E.removeDataLayerUpdatedListener(f)}},[(h=d.layersManager)==null?void 0:h.dataLayerList]),i.jsxs(i.Fragment,{children:[i.jsx(et,{onClick:()=>n(!t),children:i.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 24 24",children:i.jsx("path",{d:"M11.99 18.54l-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27-7.38 5.74zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27L12 16z",fill:"orange"})})}),i.jsx(Et,{isVisible:t,title:o,children:i.jsx(Ti,{featureTypes:r,locale:e})})]})});class Si extends g.PolylineDashMaterialProperty{}class bi extends g.ConstantProperty{}class Ci extends g.ConstantPositionProperty{}class Mi extends g.Cartesian2{}class _i extends g.Cartesian3{}class pn extends g.Cartographic{}class Pi extends g.BoundingSphere{}class Ii extends g.Ellipsoid{}class Ai extends g.GeographicTilingScheme{}class fn extends g.Rectangle{}class Di extends g.Resource{}class Oi extends g.EllipsoidTerrainProvider{}class ki extends g.CesiumTerrainProvider{}class xi extends g.PolylineGraphics{}class Ni extends g.JulianDate{}class Bi extends g.PositionProperty{}class Fi extends g.BillboardGraphics{}class Gi extends g.Color{}class Vi extends g.PolygonHierarchy{}class Hi extends g.Scene{}const Wi=g.VerticalOrigin,zi=g.HorizontalOrigin,tt=g.SceneMode,Ui=g.LabelStyle,$i=g.HeightReference,_e=document.createElement("canvas"),Te=_e.getContext("2d"),mn=e=>{const r=(e==null?void 0:e.data)??[];for(let s=3;s<r.length;s+=4)if(r[s]<255)return!0;return!1},qi=async(e,t)=>(t&&t.tileTransparencyCheckedCounter++,new Promise((n,r)=>{try{Te==null||Te.clearRect(0,0,_e.width,_e.height);let s;if(e instanceof HTMLImageElement)s=e;else if(e instanceof ImageBitmap){_e.width=e.width,_e.height=e.height,Te==null||Te.drawImage(e,0,0);const o=Te==null?void 0:Te.getImageData(0,0,_e.width,_e.height),d=mn(o);d&&t&&(t.tileTransparencyCheckedCounter=t.maxTilesForTransparencyCheck),n(d);return}else s=new Image,s.crossOrigin="anonymous",s.src=e;s.onload=()=>{_e.width=s.width,_e.height=s.height,Te==null||Te.drawImage(s,0,0);const o=Te==null?void 0:Te.getImageData(0,0,_e.width,_e.height);mn(o)?(t&&(t.tileTransparencyCheckedCounter=t.maxTilesForTransparencyCheck),n(!0)):n(!1)}}catch(s){console.error("Could not determine image transparency. Error => ",s),r(s)}})),nt=(e,t)=>{const{west:n,east:r,north:s,south:o}=e,{west:d,east:h,north:f,south:E}=t;return n>=d&&r<=h&&s<=f&&o>=E},ji=(e,t)=>hr(e,je(t)),Yi=e=>{const t=(g.Math.toDegrees(e.west)+g.Math.toDegrees(e.east))/2,n=(g.Math.toDegrees(e.south)+g.Math.toDegrees(e.north))/2;return xt.point([t,n])},yn=e=>[g.Math.toDegrees(e.west),g.Math.toDegrees(e.south),g.Math.toDegrees(e.east),g.Math.toDegrees(e.north)],vn=e=>{const t=e.scene;let r=e.camera.computeViewRectangle(t.globe.ellipsoid);if(!g.defined(r)||!r){console.error("cesium native computeViewRectangle returned invalid rectangle, fallback to custom calculation ");const s=new g.Cartesian2(0,0),o=t.camera.pickEllipsoid(s,t.globe.ellipsoid),d=new g.Cartesian2(t.canvas.width,t.canvas.height),h=t.camera.pickEllipsoid(d,t.globe.ellipsoid),f=t.globe.ellipsoid.cartesianToCartographic(o),E=t.globe.ellipsoid.cartesianToCartographic(h);r=new g.Rectangle(f.longitude,E.latitude,E.longitude,f.latitude)}return r},Zi=(e,t=100)=>{const n=e.scene,r=e.camera,s=n.mode,o=vn(e);if(!g.defined(o)||!o){console.error("customComputeViewRectangle returned invalid rectangle.");return}if(s===g.SceneMode.SCENE2D)return o;const d=r.positionCartographic;if(!g.defined(d)){console.error("Camera position is undefined in 3D mode.");return}const h=d.latitude,f=d.longitude;if(h<-g.Math.PI_OVER_TWO||h>g.Math.PI_OVER_TWO||f<-g.Math.PI||f>g.Math.PI){console.error("Invalid latitude or longitude values.");return}const E=111320,C=111320*Math.cos(h);let b=t/E,p=t/C;const v=g.Cartesian3.magnitude(r.positionWC);v>1e7&&(b=10,p=10);const I=r.frustum instanceof g.PerspectiveFrustum?r.frustum.fov:Math.PI/3;let T=1;v<5e5?T=.05:v<2e6&&(T=.1),b*=T*(I/Math.PI),p*=T*(I/Math.PI);const F=r.pitch;if(F===void 0)return;const V=Math.PI/4,j=Math.max(0,1-Math.abs(F)/V);b*=j,p*=j;const Y=5e-4;b=Math.max(b,Y),p=Math.max(p,Y);const G=d.latitude-b,X=d.latitude+b,W=d.longitude-p,Z=d.longitude+p,ee=g.Math.clamp(G,o.south,o.north),l=g.Math.clamp(X,o.south,o.north),c=g.Math.clamp(W,o.west,o.east),_=g.Math.clamp(Z,o.west,o.east),y=Math.min(1,F/g.Math.PI_OVER_TWO),S=o.north-(o.north-o.south)*y,w=Math.min(l,S);return new g.Rectangle(g.Math.negativePiToPi(c),g.Math.clamp(ee,-g.Math.PI_OVER_TWO,g.Math.PI_OVER_TWO),g.Math.negativePiToPi(_),g.Math.clamp(w,-g.Math.PI_OVER_TWO,g.Math.PI_OVER_TWO))},En=(e,t,n,r,s,o)=>{const d=e.scene.mode===g.SceneMode.SCENE2D,h=p=>{var v;if(p.polygon)return{type:"Polygon",coordinates:[((v=p.polygon.hierarchy)==null?void 0:v.getValue(g.JulianDate.now())).positions.map(F=>{const V=g.Cartographic.fromCartesian(F),j=new g.Cartographic(g.Math.toDegrees(V.longitude),g.Math.toDegrees(V.latitude),d?500:void 0);return[j.longitude,j.latitude,j.height]})]}},f=(p,v,I,T)=>{const F=g.SceneTransforms.wgs84ToWindowCoordinates(p,v);if(!F)return null;const V=F.x+I,j=F.y+T,Y=new g.Cartesian2(V,F.y),G=new g.Cartesian2(F.x,j),X=p.camera.pickEllipsoid(Y,p.globe.ellipsoid),W=p.camera.pickEllipsoid(G,p.globe.ellipsoid);if(!X||!W)return null;const Z=g.Cartesian3.distance(v,X),ee=g.Cartesian3.distance(v,W);return{widthMeters:Z,heightMeters:ee}},E=(p,v,I)=>{const T=g.Ellipsoid.WGS84,F=p.latitude,V=p.longitude,j=Math.PI/180*T.maximumRadius,Y=Math.PI/180*T.maximumRadius,G=I/2/j,X=v/2/Y,W=F+G,Z=F-G,ee=V+X,l=V-X;return{type:"Polygon",coordinates:[[[l,W],[ee,W],[ee,Z],[l,Z],[l,W]]]}},C=(p,v)=>kt(p)/kt(v);if(!e.dataSources.getByName(t.name)[0])return;const b=[];if(t==null||t.entities.values.forEach(p=>{var v,I;if(s&&o&&d)try{const T=je(s),F=Nt(h(p),T);if(F){const V=(v=p.properties)==null?void 0:v.label.getValue(g.JulianDate.now()),j=ur(F,{properties:{label:V}}),Y={width:V.width,height:V.height},[G,X,W=0]=j.geometry.coordinates,Z=g.Cartesian3.fromDegrees(G,X,W),ee=f(e.scene,Z,Y.width,Y.height);if(ee){const l=E({longitude:G,latitude:X},ee.widthMeters,ee.heightMeters),c=Nt(F,{type:"Feature",properties:{},geometry:l});C(c==null?void 0:c.geometry,l)>.7&&b.push(j)}}}catch{console.log("*** Label placement failed: turf.intersect() failed ***","entity -->",p,"extent -->",s)}if(!(n.length>0&&!n.some(T=>p.id.startsWith(T)))&&(p.polygon&&(p.polygon=new g.PolygonGraphics({hierarchy:p.polygon.hierarchy,material:d?g.Color.fromCssColorString(r).withAlpha(.2):g.Color.fromCssColorString(r).withAlpha(.5),outline:!0,outlineColor:g.Color.fromCssColorString(r),outlineWidth:3,height:d?1e4:void 0,perPositionHeight:!1})),p.polyline&&(p.polyline=new g.PolylineGraphics({positions:p.polyline.positions,material:g.Color.fromCssColorString(r).withAlpha(.5),clampToGround:!0,width:4})),p.billboard)){const T=(I=p.position)==null?void 0:I.getValue(g.JulianDate.now()),F=g.Cartographic.fromCartesian(T),V=new g.Cartographic(F.longitude,F.latitude,d?500:e.scene.sampleHeight(g.Cartographic.fromCartesian(T))),j=g.Cartesian3.fromRadians(V.longitude,V.latitude,V.height),Y="#FFFF00";p.position=j,p.billboard=new g.BillboardGraphics({image:"data:image/svg+xml;base64,"+btoa(`
1
+ (function(u,i){typeof exports=="object"&&typeof module<"u"?i(exports,require("react/jsx-runtime"),require("react"),require("date-fns"),require("date-fns/locale"),require("@date-io/date-fns"),require("@material-ui/pickers"),require("@material-ui/core"),require("@material-ui/core/styles"),require("@map-colonies/react-core"),require("@material-ui/core/useMediaQuery"),require("react-datepicker"),require("date-fns/locale/he"),require("moment"),require("@turf/rewind"),require("ol"),require("ol/ol.css"),require("ol/coordinate"),require("ol/control"),require("ol/control/MousePosition"),require("ol/proj"),require("ol/layer"),require("ol/source"),require("ol/format"),require("ol/interaction"),require("ol/interaction/Draw"),require("ol/layer/VectorTile"),require("ol/style"),require("ol/tilegrid/WMTS"),require("ol/extent"),require("ol/source/TileWMS"),require("ol/source/XYZ"),require("ol/source/VectorTile"),require("ol-ext/legend/Legend"),require("ol-ext/control/Legend"),require("ol-ext/dist/ol-ext.css"),require("@material-ui/core/TableHead"),require("@material-ui/core/utils"),require("@material-ui/core/CssBaseline"),require("@material-ui/core/ScopedCssBaseline"),require("react-dom"),require("resium"),require("cesium"),require("lodash"),require("@turf/bbox"),require("@turf/invariant"),require("@turf/area"),require("@turf/bbox-polygon"),require("@turf/centroid"),require("@turf/helpers"),require("@turf/intersect"),require("@turf/point-to-polygon-distance"),require("@map-colonies/react-core/dist/list/styles"),require("@map-colonies/react-core/dist/textfield/styles"),require("@turf/boolean-point-in-polygon"),require("@cmcleese/cesium-navigation"),require("@cmcleese/cesium-navigation/dist/index.css"),require("@map-colonies/react-core/dist/linear-progress/styles"),require("@map-colonies/react-core/dist/checkbox/styles"),require("p-map"),require("uuid"),require("@turf/boolean-valid"),require("textarea-caret"),require("get-input-selection"),require("chonky"),require("chonky-icon-fontawesome"),require("filesize"),require("react-select"),require("react-circular-progressbar"),require("react-circular-progressbar/dist/styles.css"),require("react-move")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","date-fns","date-fns/locale","@date-io/date-fns","@material-ui/pickers","@material-ui/core","@material-ui/core/styles","@map-colonies/react-core","@material-ui/core/useMediaQuery","react-datepicker","date-fns/locale/he","moment","@turf/rewind","ol","ol/ol.css","ol/coordinate","ol/control","ol/control/MousePosition","ol/proj","ol/layer","ol/source","ol/format","ol/interaction","ol/interaction/Draw","ol/layer/VectorTile","ol/style","ol/tilegrid/WMTS","ol/extent","ol/source/TileWMS","ol/source/XYZ","ol/source/VectorTile","ol-ext/legend/Legend","ol-ext/control/Legend","ol-ext/dist/ol-ext.css","@material-ui/core/TableHead","@material-ui/core/utils","@material-ui/core/CssBaseline","@material-ui/core/ScopedCssBaseline","react-dom","resium","cesium","lodash","@turf/bbox","@turf/invariant","@turf/area","@turf/bbox-polygon","@turf/centroid","@turf/helpers","@turf/intersect","@turf/point-to-polygon-distance","@map-colonies/react-core/dist/list/styles","@map-colonies/react-core/dist/textfield/styles","@turf/boolean-point-in-polygon","@cmcleese/cesium-navigation","@cmcleese/cesium-navigation/dist/index.css","@map-colonies/react-core/dist/linear-progress/styles","@map-colonies/react-core/dist/checkbox/styles","p-map","uuid","@turf/boolean-valid","textarea-caret","get-input-selection","chonky","chonky-icon-fontawesome","filesize","react-select","react-circular-progressbar","react-circular-progressbar/dist/styles.css","react-move"],i):(u=typeof globalThis<"u"?globalThis:u||self,i(u.reactComponents={},u.jsxRuntime,u.React,u.dateFns,u.locale,u.DateFnsUtils,u.pickers,u.core,u.styles,u.reactCore,u.useMediaQuery,u.DatePicker,u.datePickerHebrewLocale,u.moment,u.rewind,u.ol,null,u.coordinate,u.control,u.MousePosition,u.proj,u.layer,u.source,u.format,u.interaction,u.Draw,u.VectorTile,u.style,u.WMTSTileGrid,u.extent,u.OlTileWMS,u.OlXYZ,u.VectorTileSource,u.OlExtLegend,u.OlExtLegendCtrl,null,u.TableHead,u.utils,u.CssBaseline,u.ScopedCssBaseline,u.ReactDOM,u.resium,u.Cesium,u.lodash,u.bbox,u.invariant,u.area,u.bboxPolygon,u.centroid,u.turf,u.intersect,u.pointToPolygonDistance,null,null,u.booleanPointInPolygon,u.viewerCesiumNavigationMixin,null,null,null,u.pMap,u.uuid,u.booleanValid,u.getCaretCoordinates,u.getInputSelection,u.chonky,u.chonkyIconFontawesome,u.filesize,u.Select,u.reactCircularProgressbar,null,u.reactMove))})(this,function(u,i,a,Le,Ue,bt,Ne,ae,Oe,J,Jn,Ct,Kn,Be,Qn,Mt,ss,_t,at,lt,Pt,It,ct,dt,Rn,er,tr,$e,nr,At,rr,ir,or,Dt,sr,as,ar,Ot,lr,cr,ut,Me,g,$,qe,dr,kt,je,ur,xt,Nt,hr,ls,cs,gr,pr,ds,us,hs,ht,Bt,fr,mr,Ft,re,yr,vr,Gt,Ye,gs,Er){"use strict";var is=Object.defineProperty;var os=(u,i,a)=>i in u?is(u,i,{enumerable:!0,configurable:!0,writable:!0,value:a}):u[i]=a;var ue=(u,i,a)=>(os(u,typeof i!="symbol"?i+"":i,a),a);function gt(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const Vt=gt(a),M=gt(g),Ht=gt(xt),Q=e=>{const{children:t,...n}=e;return i.jsx(ae.Box,{...n,children:t})};var we=(e=>(e.BOX="BOX",e.POLYGON="POLYGON",e.UNKNOWN="UNKNOWN",e))(we||{}),Se=(e=>(e.HE="he",e.EN="en",e.RU="ru",e))(Se||{}),Ze=(e=>(e.TOP_RIGHT="TOP_RIGHT",e.BOTTOM_LEFT="BOTTOM_LEFT",e))(Ze||{});const he={DATE_PICKER:{dateFormat:"dd/MM/yyyy",local:{setText:"set",placeHolderText:"Enter the Date",calendarLocale:Se.EN},disableFuture:!0,showTime:!1,variant:"inline"},DATE_RANGE_PICKER:{dateFormat:"dd/MM/yyyy HH:mm",controlsLayout:"row",local:{setText:"set",startPlaceHolderText:"Start of time",endPlaceHolderText:"End of time",calendarLocale:Se.EN},renderAsButton:!0,offset:0,disableFuture:!0,showTime:!0}},Xe=e=>{const t=e.type==="dark";return a.useMemo(()=>Wt(e,t),[t,e])},Wt=(e,t=!1)=>Oe.createTheme({palette:{type:t?"dark":"light",primary:{main:e.primary},secondary:{main:e.secondary},error:{main:e.error},background:{default:e.surface,paper:e.background},text:{primary:t?e.textPrimaryOnDark:e.textPrimaryOnLight,secondary:t?e.textSecondaryOnDark:e.textSecondaryOnLight}}}),zt=e=>a.useMemo(()=>({...e,"cesium-color":"#EDFFFF","cesium-error":e["--mdc-theme-gc-error-medium"]??"#FF3636","cesium-warning":e["--mdc-theme-gc-warning-high"]??"#FFA032","cesium-checkbox-color":"#1A73E8","cesium-checkbox-width":"12px","cesium-checkbox-height":"12px","cesium-font-size":"10pt"}),[e]),ps="",wr=2,Tr=.5,Lr=Oe.makeStyles(e=>Oe.createStyles({container:{padding:e.spacing(wr),alignItems:"center"},setButton:{marginTop:e.spacing(1)},margin:{marginLeft:e.spacing(Tr)}})),Ut=e=>{var X,W,Z,ee;const t=Lr(),n=J.useTheme(),r=Xe(n),[s,o]=a.useState(null),[d,h]=a.useState(null),[f,E]=a.useState(he.DATE_RANGE_PICKER.dateFormat),C=e.controlsLayout??he.DATE_RANGE_PICKER.controlsLayout,b=e.disableFuture??he.DATE_RANGE_PICKER.disableFuture,p=((X=e.local)==null?void 0:X.startPlaceHolderText)??he.DATE_RANGE_PICKER.local.startPlaceHolderText,v=((W=e.local)==null?void 0:W.endPlaceHolderText)??he.DATE_RANGE_PICKER.local.endPlaceHolderText,I=((Z=e.local)==null?void 0:Z.setText)??he.DATE_RANGE_PICKER.local.setText,T=((ee=e.local)==null?void 0:ee.calendarLocale)??he.DATE_RANGE_PICKER.local.calendarLocale,F=e.showTime??he.DATE_RANGE_PICKER.showTime,V=T===Se.HE?Ue.he:Ue.enUS;a.useEffect(()=>{o(e.from??null)},[e.from]),a.useEffect(()=>{h(e.to??null)},[e.to]),a.useEffect(()=>{E(e.dateFormat??he.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const j=Boolean(Le.isValid(s)&&!d||Le.isValid(d)&&!s||s&&d&&Le.isValid(s)&&Le.isValid(d)&&Le.isBefore(s,d)),Y=()=>{e.onChange({from:s&&Le.isValid(s)?s:void 0,to:d&&Le.isValid(d)?d:void 0})},G=F?Ne.KeyboardDateTimePicker:Ne.KeyboardDatePicker;return i.jsx(ae.ThemeProvider,{theme:r,children:i.jsx(Q,{className:`${t.container} drpContainer`,display:"flex",flexDirection:C,width:C==="column"?e.contentWidth:"unset",children:i.jsxs(Ne.MuiPickersUtilsProvider,{utils:bt,locale:V,children:[i.jsx(G,{variant:"inline",placeholder:p,onChange:l=>o(l),value:s,disableFuture:b,format:f,maxDate:e.maxDate,minDate:e.minDate}),i.jsx(G,{variant:"inline",placeholder:v,className:t.margin,onChange:l=>h(l),value:d,disableFuture:b,format:f,maxDate:e.maxDate,minDate:e.minDate}),i.jsx(J.ThemeProvider,{options:n,children:i.jsx(J.Button,{className:`${t.setButton} ${t.margin}`,raised:!0,onClick:Y,disabled:!j,children:I})})]})})})},$t=e=>{const{children:t,...n}=e;return i.jsx(ae.Popover,{...n,children:t})},fs="",Sr=e=>{var G,X;const[t,n]=a.useState(null),[r,s]=a.useState(null),[o,d]=a.useState(he.DATE_RANGE_PICKER.dateFormat),[h,f]=a.useState(null),E=W=>{f(W.currentTarget)},C=W=>{W.currentTarget.tagName==="I"?f(W.currentTarget.previousElementSibling):f(W.currentTarget)},b=()=>{f(null)},p=Boolean(h),v=e.controlsLayout??"column";a.useEffect(()=>{n(e.from??null)},[e.from]),a.useEffect(()=>{s(e.to??null)},[e.to]),a.useEffect(()=>{d(e.dateFormat??he.DATE_RANGE_PICKER.dateFormat)},[e.dateFormat]);const I=((G=e.local)==null?void 0:G.startPlaceHolderText)??he.DATE_RANGE_PICKER.local.startPlaceHolderText,T=((X=e.local)==null?void 0:X.endPlaceHolderText)??he.DATE_RANGE_PICKER.local.endPlaceHolderText,F=e.renderAsButton===void 0?he.DATE_RANGE_PICKER.renderAsButton:e.renderAsButton,V=e.offset===void 0?he.DATE_RANGE_PICKER.offset:e.offset,j=e.disableFuture===void 0?he.DATE_RANGE_PICKER.disableFuture:e.disableFuture,Y=a.useMemo(()=>`${t?Le.format(t,o):I} - ${r?Le.format(r,o):T}`,[t,r,o,I,T]);return i.jsxs(i.Fragment,{children:[F?i.jsx(J.Button,{style:{width:e.width},raised:!0,onClick:E,className:"drpOpener",children:Y}):i.jsx(J.TextField,{className:"drpOpener",readOnly:!0,style:{width:e.width},value:Y,onClick:C,trailingIcon:{icon:"date_range",tabIndex:0,onClick:C}}),i.jsx($t,{open:p,anchorEl:h,onClose:b,anchorOrigin:{vertical:"bottom",horizontal:"left"},keepMounted:!0,children:i.jsx(Ut,{controlsLayout:v,contentWidth:((h==null?void 0:h.clientWidth)??0)-V,dateFormat:o,disableFuture:j,minDate:e.minDate,maxDate:e.maxDate,local:e.local,from:t??void 0,to:r??void 0,onChange:({from:W,to:Z})=>{n(W??null),s(Z??null),e.onChange({from:W,to:Z}),b()}})})]})},Je=e=>typeof e<"u"&&e!==null&&"startDate"in e&&"endDate"in e,br=({endDate:e,startDate:t,setEndDate:n=()=>{},setStartDate:r=()=>{},endTimeInputClassName:s="",endTimeLabel:o="",endTimeWrapperClassName:d="",timeRangeInputsWrapperClassName:h="",startTimeInputClassName:f="",startTimeLabel:E="",startTimeWrapperClassName:C=""})=>i.jsxs("div",{className:`timeRangeWrapper ${h}`,children:[i.jsx("div",{className:`startTimeWrapper ${C}`,children:i.jsx(J.TextField,{label:E,disabled:t===null,className:`timeRangeInput ${f}`,name:"start-time",type:"time",value:Be(t).format("HH:mm"),onChange:b=>{const p=Be(t),v=Be(b.currentTarget.value,"HH:mm"),I=p.set({hours:v.get("hours"),minutes:v.get("minutes")});r(I.toDate())}})}),i.jsx("div",{className:`endTimeWrapper ${d}`,children:i.jsx(J.TextField,{label:o,disabled:e===null,className:`timeRangeInput ${s}`,name:"end-time",type:"time",value:Be(e).format("HH:mm"),onChange:b=>{const p=Be(e),v=Be(b.currentTarget.value,"HH:mm"),I=p.set({hours:v.get("hours"),minutes:v.get("minutes")});n(I.toDate())}})})]}),Cr=a.forwardRef(({value:e,onClick:t,onInputClick:n,...r},s)=>i.jsx(J.TextField,{...r,className:"dateRangeCustomInput",readOnly:!0,onClick:o=>{t==null||t(o),n==null||n()},ref:s,value:e})),Mr=({setStartDate:e=()=>{},setEndDate:t=()=>{},shortcuts:n,dateRange:r,onShortcut:s})=>{const[o,d]=a.useState(),h=a.useMemo(()=>n.map(f=>f instanceof Function?f():f),[n]);return a.useEffect(()=>{for(const f of h){const E=r.startDate&&r.endDate&&Le.isSameDay(f.startDate,r.startDate)&&Le.isSameDay(f.endDate,r.endDate);o?f.id===o&&(E||d(void 0)):E&&d(f.id)}},[r,o,h]),i.jsx("div",{className:"shortcutsContainer",children:h.map((f,E)=>{const C=()=>{e(f.startDate),t(f.endDate)};return i.jsx(J.Button,{type:"button",className:`shortcut ${o===f.id?"selected":""}`,onClick:b=>{C(),s==null||s({startDate:f.startDate,endDate:f.endDate})},outlined:!0,children:f.label},f.id+E)})})},_r=a.forwardRef((e,t)=>{const{calendarClassName:n,dayClassName:r,monthClassName:s,selectsRange:o,onChange:d,inputName:h,showMonthYearDropdown:f,withShortcuts:E,locale:C="en"}=e,[b,p]=a.useState(null),[v,I]=a.useState(null),[T,F]=a.useState(!1),V=o?{startDate:b,endDate:v}:b;a.useEffect(()=>{C==="he"&&Ct.registerLocale("he",Kn)},[C]),a.useEffect(()=>{var G,X;((G=e.startDate)==null?void 0:G.toString())!==(b==null?void 0:b.toString())&&p(e.startDate),((X=e.endDate)==null?void 0:X.toString())!==(v==null?void 0:v.toString())&&I(e.endDate)},[e.startDate,e.endDate,b,v]);const j=a.useMemo(()=>{let G="pickerContainer"+(C==="he"?" pickerContainer-rtl":"");return E&&o&&(G+=" pickerContainer-withShortcuts"),G},[C,E,o]),Y=f?{showMonthDropdown:!0,showYearDropdown:!0,dropdownMode:"select"}:{};return i.jsx("div",{className:j,style:{direction:C==="he"?"rtl":"ltr"},children:i.jsx(Ct,{...e,ref:t,onClickOutside:()=>F(!1),open:T,startDate:Je(V)?b:void 0,selected:b,endDate:Je(V)?v:void 0,monthsShown:e.monthsShown??2,calendarClassName:`pickerCalendar ${n}`,weekDayClassName:G=>`pickerWeek ${(r==null?void 0:r(G))??""}`,dayClassName:G=>`pickerDay ${(r==null?void 0:r(G))??""}`,monthClassName:G=>`pickerMonth ${(s==null?void 0:s(G))??""}`,onChange:(G,X)=>{if(Array.isArray(G)){const[W,Z]=G;p(W),I(Z),d==null||d({startDate:W,endDate:Z&&Le.endOfDay(Z)},X)}else p(G),d==null||d(G,X)},customInput:i.jsx(Cr,{name:h,onInputClick:()=>{F(!0)}}),showTimeInput:!!(E&&o),timeInputLabel:"",customTimeInput:E&&Je(V)&&i.jsx(Mr,{onShortcut:G=>{d==null||d(G),F(!1)},shortcuts:E,setEndDate:I,setStartDate:p,dateRange:V}),showMonthYearDropdown:void 0,...Y})})}),ms="",Pr=e=>{const t=J.useTheme(),n=Xe(t),{format:r=he.DATE_PICKER.dateFormat,variant:s=he.DATE_PICKER.variant,disableFuture:o=he.DATE_PICKER.disableFuture,local:d,onChange:h,showTime:f=he.DATE_PICKER.showTime,value:E,...C}=e,{placeHolderText:b=he.DATE_PICKER.local.placeHolderText,calendarLocale:p}=d??{placeHolderText:he.DATE_PICKER.local.placeHolderText,calendarLocale:Se.EN},v=p===Se.HE?Ue.he:Ue.enUS,I=T=>{h(T)};return i.jsx(ae.ThemeProvider,{theme:n,children:i.jsxs(Ne.MuiPickersUtilsProvider,{utils:bt,locale:v,children:[f&&i.jsx(Ne.KeyboardDateTimePicker,{variant:s,placeholder:b,onChange:I,value:E,disableFuture:o,format:r,...C}),!f&&i.jsx(Ne.KeyboardDatePicker,{variant:s,placeholder:b,onChange:I,value:E,disableFuture:o,format:r,...C})]})})},Ir=18,Ar=Oe.makeStyles(e=>Oe.createStyles({drawingButton:{width:e.spacing(Ir)},fullWidth:{width:"100%",marginTop:"36px"}})),Dr=e=>{const t=Ar(),[n,r]=a.useState(null),{isSelectionEnabled:s,onCancelDraw:o,onStartDraw:d,onReset:h}=e,f=C=>{r(C.currentTarget)},E=()=>{r(null)};return s?i.jsx(J.Tooltip,{content:"Cancel the ongoing draw",align:"bottomLeft",children:i.jsx(J.Button,{className:t.drawingButton,raised:!0,onClick:o,children:"Cancel Draw"})}):i.jsxs(Q,{position:"relative",children:[i.jsx(J.Tooltip,{content:"draw an Area of interest to limit the search",align:"bottomLeft",children:i.jsx(J.Button,{className:t.drawingButton,raised:!0,onClick:f,children:"Draw AOI"})}),i.jsxs(J.Menu,{className:t.fullWidth,open:Boolean(n),onClose:E,children:[i.jsx(J.MenuItem,{onClick:()=>{d(we.POLYGON),E()},children:"Polygon"}),i.jsx(J.MenuItem,{onClick:()=>{d(we.BOX),E()},children:"Box"}),i.jsx(J.MenuItem,{onClick:()=>{h(),E()},children:"Clear"})]})]})},ys="";var be=(e=>(e.WGS84="EPSG:4326",e.WEB_MERCATOR="EPSG:3857",e))(be||{});const Ke=5,Qe=2,qt=a.createContext(null),Or=qt.Provider,jt=35,Yt=32,kr=10,xr=e=>e!==void 0&&e!==be.WGS84?Pt.transform([jt,Yt],be.WGS84,e):[jt,Yt],Nr=e=>{switch(e){case be.WEB_MERCATOR:return t=>_t.format(t,"Mercator: {y}m, {x}m",Qe);case be.WGS84:return t=>_t.format(t,"WGS84: {y}°N {x}°E",Ke);default:return t=>""}},ke=()=>{const e=a.useContext(qt);if(e===null)throw new Error("map context is null, please check the provider");return e},Zt=e=>{const t=a.useRef(null),{allowFullScreen:n,showMousePosition:r,projection:s}=e,[o]=a.useState(new Mt.Map({view:new Mt.View({projection:s??be.WGS84}),controls:at.defaults()}));a.useEffect(()=>{o.getView().setCenter(e.center??xr(e.projection))},[o,e.center,e.projection]),a.useEffect(()=>{o.getView().setZoom(e.zoom??kr)},[o,e.zoom,e.projection]);const d=(h,f)=>{f.getControls().forEach(C=>{C instanceof h&&f.removeControl(C)})};return a.useEffect(()=>{o.setTarget(t.current),n!==void 0&&n?o.addControl(new at.FullScreen):d(at.FullScreen,o)},[o,n]),a.useEffect(()=>{r!==void 0&&r?(d(lt,o),o.addControl(new lt({coordinateFormat:Nr(s??be.WGS84),projection:s??be.WGS84,undefinedHTML:"&nbsp;"}))):d(lt,o)},[o,r,s]),i.jsxs(Or,{value:o,children:[i.jsx("div",{className:"map",ref:t}),e.children]})},Xt=a.createContext(null),Br=Xt.Provider,Ve=()=>{const e=a.useContext(Xt);if(e===null)throw new Error("tile layer context is null, please check the provider");return e},Jt=({options:e,children:t})=>{const n=ke(),[r]=a.useState(new It.Tile(e));return a.useEffect(()=>(n.addLayer(r),()=>{n.removeLayer(r)}),[n,r]),i.jsx(Br,{value:r,children:t})},Kt=a.createContext(null),Fr=Kt.Provider,Qt=()=>{const e=a.useContext(Kt);if(e===null)throw new Error("vector layer context is null, please check the provider");return e},Rt=({options:e,children:t})=>{const n=ke(),[r]=a.useState(new It.Vector(e));return a.useEffect(()=>(n.addLayer(r),()=>{n.removeLayer(r)}),[n,r]),i.jsx(Fr,{value:r,children:t})},en=a.createContext(null),Gr=en.Provider,tn=()=>{const e=a.useContext(en);if(e===null)throw new Error("vector source context is null, please check the provider");return e},nn=({children:e})=>{const t=Qt(),[n]=a.useState(new ct.Vector);return a.useEffect(()=>{t.setSource(n)},[n,t]),i.jsx(Gr,{value:n,children:e})},rn=({geometry:e,fitOptions:t,fit:n,featureStyle:r})=>{const s=tn(),o=ke();return a.useLayoutEffect(()=>{const h=new dt.GeoJSON().readFeature(e);return n&&s.on("addfeature",function(){o.getView().fit(s.getExtent(),t)}),r&&h.setStyle(r),s.addFeature(h),()=>{s.removeFeature(h)}},[e,s,n]),null},on=e=>{const t=Ve();return a.useEffect(()=>{t.setSource(new ct.OSM)},[t]),null},sn=({drawType:e,onPolygonSelected:t})=>{const n=ke();return a.useEffect(()=>{const r={type:"Circle"};switch(e){case we.BOX:r.geometryFunction=er.createBox();break;case we.POLYGON:r.type="Polygon";break;default:return}const s=new Rn.Draw(r);n.addInteraction(s);const o=d=>{const f=new dt.GeoJSON().writeGeometryObject(d.feature.getGeometry());t==null||t(f)};return s.on("drawend",o),()=>{s.un("drawend",o),n.removeInteraction(s)}},[t,e,n]),null},vs="",Vr=e=>{const t=n=>{const r=Qn(n);e.onPolygonSelection(r)};return i.jsxs(Zt,{allowFullScreen:!0,showMousePosition:!0,children:[i.jsx(Jt,{children:i.jsx(on,{})}),e.selectionPolygon&&i.jsx(Rt,{children:i.jsx(nn,{children:i.jsx(rn,{geometry:e.selectionPolygon})})}),e.children,e.drawType!==void 0&&i.jsx(sn,{drawType:e.drawType,onPolygonSelected:t})]})},pt=1.5,Hr=80,Wr=Oe.makeStyles(e=>Oe.createStyles({map:{height:"100%",width:"100%",position:"absolute"},absolute:{position:"absolute",zIndex:1e3,left:e.spacing(pt),top:e.spacing(pt)},contentContainer:{marginTop:e.spacing(pt),width:e.spacing(Hr)},filtersContainer:{display:"flex",padding:e.spacing(1)},filtersMargin:{marginLeft:e.spacing(1)}})),zr=e=>{var f;const[t,n]=a.useState(),[r,s]=a.useState(),o=Wr(),d=E=>{s(E),n(void 0),e.handlePolygonSelected(E)},h=()=>{s(void 0),e.handlePolygonReset()};return i.jsxs("div",{className:o.map,children:[i.jsxs("div",{className:`${o.absolute}`,children:[i.jsxs(ae.Paper,{className:o.filtersContainer,children:[i.jsx(Dr,{onCancelDraw:()=>n(void 0),onReset:h,onStartDraw:n,isSelectionEnabled:t!==void 0}),(f=e.filters)==null?void 0:f.map((E,C)=>i.jsx("div",{className:o.filtersMargin,children:E},C))]}),i.jsx(ae.Paper,{color:"red",className:`${o.contentContainer}`,children:e.children})]}),i.jsx(Vr,{children:e.mapContent,onPolygonSelection:d,drawType:t,selectionPolygon:r})]})},an=new $e.Fill({color:"rgba(255,255,255,0.4)"}),ln=new $e.Stroke({color:"#3399CC",width:1.25}),cn=[new $e.Style({image:new $e.Circle({fill:an,stroke:ln,radius:5}),fill:an,stroke:ln})],dn=a.createContext(null),Ur=dn.Provider,un=()=>{const e=a.useContext(dn);if(e===null)throw new Error("vector tile layer context is null, please check the provider");return e},$r=({children:e,options:t,style:n})=>{const r=ke(),[s]=a.useState(new tr({...t,style:n||cn}));return a.useEffect(()=>(r.addLayer(s),()=>{r.removeLayer(s)}),[r,s]),a.useEffect(()=>{s.setStyle(n||cn)},[s,n]),i.jsx(Ur,{value:s,children:e})},ft=20,qr=256,jr=2,Yr=2,Zr="REST",Xr=e=>{const t=Pt.get(e.projection),n=t.getExtent(),r=new Array(ft),s=new Array(ft),o=At.getWidth(n)/qr,d=e.heightWidthRatio!==void 0?e.heightWidthRatio:Yr,h=e.requestEncoding!==void 0?e.requestEncoding:Zr;for(let E=0;E<ft;++E)r[E]=o/Math.pow(jr,E)/d,s[E]=E.toString();return{attributions:e.attributions,url:e.url,layer:e.layer,matrixSet:e.matrixSet,format:e.format,projection:t,tileGrid:new nr({origin:At.getTopLeft(n),resolutions:r,matrixIds:s}),style:e.style,requestEncoding:h,wrapX:e.wrapX!==void 0?e.wrapX:!0}},Jr=e=>{const t=Ve(),{options:n}=e;return a.useEffect(()=>{t.setSource(new ct.WMTS(n))},[t,n]),null},Kr=e=>{const{attributions:t,url:n,params:r,serverType:s,transition:o}=e;return{attributions:t,url:n,params:r,serverType:s,transition:o}},Qr=e=>{const t=Ve(),{options:n}=e;return a.useEffect(()=>{t.setSource(new rr(n))},[t,n]),null},Rr=e=>{const{attributions:t,url:n}=e;return{attributions:t,url:n}},ei=e=>{const t=Ve(),{options:n}=e;return a.useEffect(()=>{t.setSource(new ir(n))},[t,n]),null},ti=a.createContext(null),ni=()=>{const e=a.useContext(ti);if(e===null)throw new Error("vector tile source context is null, please check the provider");return e},ri=e=>{const{url:t}=e;return{url:t,format:new dt.MVT}},ii=({children:e,options:t})=>{const n=un();return a.useEffect(()=>{n.setSource(new or(t))},[t,n]),null},oi=({legendItems:e,title:t,isCollapsed:n})=>{const r=ke();return a.useEffect(()=>{const s=new Dt({title:t??"",margin:5,maxWidth:300}),o=new sr({legend:s,collapsed:n===void 0?!0:n});r.addControl(o);const d=new Dt({margin:4});return e.forEach(h=>{d.addItem({title:h.title,style:h.style,typeGeom:"Polygon"})}),s.addItem(d),()=>{r.removeControl(o)}},[r,e,t,n]),i.jsx(i.Fragment,{})};function si(e){const{headCells:t,order:n,orderBy:r,onRequestSort:s,isCollapseable:o}=e,d=h=>f=>{s(f,h)};return i.jsx(ar,{children:i.jsxs(ae.TableRow,{children:[o&&i.jsx(ae.TableCell,{}),t.map(h=>i.jsx(ae.TableCell,{align:h.numeric?"right":"left",padding:h.disablePadding?"none":"default",sortDirection:r===h.id?n:!1,children:i.jsx(ae.TableSortLabel,{active:r===h.id,direction:r===h.id?n:"asc",onClick:d(h.id),children:h.label})},h.id))]})})}const ai=Ot.createSvgIcon(Vt.createElement("path",{d:"M7.41 8.59L12 13.17l4.59-4.58L18 10l-6 6-6-6 1.41-1.41z"}),"KeyboardArrowDown"),li=Ot.createSvgIcon(Vt.createElement("path",{d:"M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"}),"KeyboardArrowUp");function ci(e){const{cellsMetadata:t,isRowSelected:n,item:r,onRowSelected:s,rowIndex:o,isCollapseable:d,collapsedElement:h}=e,[f,E]=a.useState(!1),C=t.length,b=()=>{s==null||s(o)};return i.jsxs(i.Fragment,{children:[i.jsxs(ae.TableRow,{hover:!0,selected:n,onClick:b,children:[d&&i.jsx(ae.TableCell,{padding:"checkbox",children:i.jsx(ae.IconButton,{"aria-label":"expand row",size:"small",onClick:p=>{p.stopPropagation(),E(!f)},children:f?i.jsx(li,{}):i.jsx(ai,{})})}),t.map(p=>i.jsx(ae.TableCell,{align:p.numeric?"right":"left",padding:p.disablePadding?"none":"default",children:p.transform?p.transform(r[p.id]):r[p.id]},p.id+o.toString()))]}),d&&i.jsx(ae.TableRow,{children:i.jsx(ae.TableCell,{style:{paddingBottom:0,paddingTop:0},colSpan:C+1,children:i.jsx(ae.Collapse,{in:f,unmountOnExit:!0,timeout:"auto",children:h==null?void 0:h(r)})})})]})}function di(e){const[t,n]=a.useState(""),[r,s]=a.useState("asc"),{cellsMetadata:o,items:d,onRequestSort:h,onRowSelected:f,isCollapseable:E,collapsedElement:C,isDense:b,page:p,rowsPerPage:v,count:I,handleChangePage:T,handleChangeRowsPerPage:F}=e,V=(j,Y)=>{const G=t===Y&&r==="asc";s(G?"desc":"asc"),n(Y),h(Y,G?"desc":"asc")};return i.jsxs(ae.TableContainer,{component:ae.Paper,children:[i.jsxs(ae.Table,{size:b?"small":"medium",children:[i.jsx(si,{headCells:o,onRequestSort:V,order:r,orderBy:t,isCollapseable:E}),i.jsxs(ae.TableBody,{children:[d.map((j,Y)=>i.jsx(ci,{item:j,rowIndex:Y,isCollapseable:E,cellsMetadata:o,collapsedElement:C,isRowSelected:!1,onRowSelected:f},Y)),(d.length===0||v>d.length)&&i.jsx(ae.TableRow,{style:{height:(b?33:53)*(v-d.length)},children:i.jsx(ae.TableCell,{colSpan:E?o.length+1:o.length,children:d.length===0&&i.jsx(ae.Typography,{align:"center",children:"No results :("})})})]})]}),i.jsx(ae.TablePagination,{rowsPerPage:v,rowsPerPageOptions:[5,10],component:"div",count:I,page:p,onPageChange:T,onRowsPerPageChange:F})]})}const ui=e=>{const{children:t,...n}=e;return i.jsx(lr,{...n,children:t})},hi=e=>{const{children:t,...n}=e;return i.jsx(cr,{...n,children:t})},hn=e=>e*Math.PI/180,Re=e=>e*(180/Math.PI),gi=e=>.05*(5916575505e-1/Math.pow(2,e-1)/2)*(Math.cos(hn(85.362/2))/Math.sin(hn(85.362/2))),pi=({title:e,onClick:t})=>i.jsx("div",{className:"cesium-cesiumInspector-button",onClick:t,children:e}),fi=({title:e,isVisible:t,onClick:n,children:r})=>i.jsxs(Q,{className:`cesium-cesiumInspector ${t?"cesium-cesiumInspector-visible":""}`,children:[i.jsx(pi,{title:e,onClick:n}),t&&i.jsx(Q,{className:"cesium-cesiumInspector-dropDown",children:r})]}),Es="",mt="Imagery",yt="Data",mi=({locale:e})=>{var b,p;const t=pe(),[n,r]=a.useState([{id:mt,values:[]},{id:yt,values:[]}]),[s,o]=a.useState({}),d=v=>$.get(e,v.toUpperCase())??v,h=()=>t.imageryLayers?Array.from({length:t.imageryLayers.length},(v,I)=>{var V;const T=t.imageryLayers.get(I),F=T.meta;return{id:F==null?void 0:F.id,name:$.get(F,"layerRecord.productName")??(F==null?void 0:F.id),rect:T.rectangle,isBaseMap:(V=t.layersManager)==null?void 0:V.isBaseMapLayer(F)}}):[],f=()=>{var v;return((v=t.layersManager)==null?void 0:v.dataLayerList.map(I=>{var T,F;return{id:(T=I.meta)==null?void 0:T.id,name:$.get(I.meta,"featureStructure.aliasLayerName")??I.meta.productName,rect:g.Rectangle.fromDegrees(...qe((F=I.meta)==null?void 0:F.footprint)),isBaseMap:!1}}))||[]};a.useEffect(()=>{(()=>{const I=[{id:mt,values:h()},{id:yt,values:f()}];r(I),o(I.reduce((T,F)=>({...T,[F.id]:!0}),{}))})()},[]),a.useEffect(()=>{if(!t.layersManager)return;const v=()=>{r(I=>I.map(T=>T.id===mt?{...T,values:h()}:T))};return t.layersManager.addLayerUpdatedListener(v),t.imageryLayers.layerRemoved.addEventListener(v),()=>{var I;$.get(t,"_cesiumWidget")!==void 0&&((I=t.layersManager)==null||I.removeLayerUpdatedListener(v),t.imageryLayers.layerRemoved.removeEventListener(v))}},[(b=t.layersManager)==null?void 0:b.layerList]),a.useEffect(()=>{if(!t.layersManager)return;const v=()=>{r(I=>I.map(T=>T.id===yt?{...T,values:f()}:T))};return t.layersManager.addDataLayerUpdatedListener(v),()=>{var I;(I=t.layersManager)==null||I.removeDataLayerUpdatedListener(v)}},[(p=t.layersManager)==null?void 0:p.dataLayerList]);const E=v=>{o(I=>({...I,[v]:!I[v]}))},C=v=>{t.camera.flyTo({destination:v})};return i.jsx(Q,{className:"activeLayersPanel",children:n.filter(v=>v.values.length>0).map(v=>i.jsxs(Q,{className:`cesium-cesiumInspector-section ${s[v.id]?"cesium-cesiumInspector-section-collapsed":""}`,onClick:()=>E(v.id),children:[i.jsx(J.Typography,{tag:"h3",className:"cesium-cesiumInspector-sectionHeader",children:d(v.id)}),i.jsx(Q,{className:"cesium-cesiumInspector-sectionContent",children:v.values.map(I=>i.jsxs(Q,{className:"layer",children:[i.jsx(J.Tooltip,{content:I.name,children:i.jsx(Q,{className:`name ${I.isBaseMap?"disabled":""}`,children:I.name})}),i.jsx(Q,{className:"icons",children:i.jsx(J.Tooltip,{content:$.get(e,"FLY_TO")??"Fly To",children:i.jsx(Q,{className:"icon",onClick:T=>{T.stopPropagation(),C(I.rect)},children:i.jsxs("svg",{fill:"var(--mdc-theme-cesium-color)",width:"100%",height:"100%",viewBox:"0 0 256 256",children:[i.jsx("path",{d:"M236,120H223.66406A96.15352,96.15352,0,0,0,136,32.33618V20a8,8,0,0,0-16,0V32.33618A96.15352,96.15352,0,0,0,32.33594,120H20a8,8,0,0,0,0,16H32.33594A96.15352,96.15352,0,0,0,120,223.66382V236a8,8,0,0,0,16,0V223.66382A96.15352,96.15352,0,0,0,223.66406,136H236a8,8,0,0,0,0-16Zm-40,16h11.59912A80.14164,80.14164,0,0,1,136,207.59912V196a8,8,0,0,0-16,0v11.59912A80.14164,80.14164,0,0,1,48.40088,136H60a8,8,0,0,0,0-16H48.40088A80.14164,80.14164,0,0,1,120,48.40088V60a8,8,0,0,0,16,0V48.40088A80.14164,80.14164,0,0,1,207.59912,120H196a8,8,0,0,0,0,16Z"}),i.jsx("polygon",{points:"128,80 80,170 128,150 176,170",fill:"var(--mdc-theme-cesium-color)"})]})})})})]},I.id))})]},v.id))})},yi=({locale:e})=>{const[t,n]=a.useState(!1),r=a.useMemo(()=>$.get(e,"ACTIVE_LAYERS_TITLE")??"Active Layers",[e]);return i.jsx(fi,{title:r,isVisible:t,onClick:()=>n(!t),children:i.jsx(mi,{locale:e})})},et=({onClick:e,children:t})=>i.jsx("div",{className:"cesium-toolbar-button cesium-button",onClick:e,children:t}),vt=({title:e})=>i.jsx(Q,{className:"cesium-mc-title",children:e}),Et=({isVisible:e,children:t,title:n})=>i.jsxs(Q,{className:`cesium-mc-tool ${e?"cesium-mc-tool-visible":""}`,children:[n&&i.jsx(vt,{title:n}),t]}),ws="";function wt(e){return function(n){const r=a.useRef(null),[s,o]=a.useState(!1);return a.useEffect(()=>{if(!s)return;const d=h=>{const f=h.target;r.current&&!r.current.contains(f)&&o(!1)};return document.addEventListener("click",d,!0),()=>{document.removeEventListener("click",d,!0)}},[s]),i.jsx("div",{ref:r,className:"disappear",children:i.jsx(e,{...n,isOpen:s,setIsOpen:o})})}}const gn=({item:e,isSelected:t,onClick:n})=>i.jsxs(Q,{className:`cesium-baseLayerPicker-item ${t?"cesium-baseLayerPicker-selectedItem":""}`,title:e.title,onClick:n,children:[i.jsx("img",{className:"cesium-baseLayerPicker-itemIcon",src:e.thumbnail,alt:e.title}),i.jsx(Q,{className:"cesium-baseLayerPicker-itemLabel",children:e.title})]}),vi=({title:e,baseMaps:t,setCurrent:n})=>{const r=pe(),[s,o]=a.useState();a.useEffect(()=>{const h=t.maps.find(f=>f.isCurrent);h&&(o(h),n(h))},[t]);const d=h=>{var E,C;(E=r.layersManager)==null||E.removeBaseMapLayers();const f=t.maps.find(b=>b.id===h);f&&((C=r.layersManager)==null||C.setBaseMapLayers(f),o(f),n(f),t.maps.forEach(b=>{b.isCurrent=f===b}))};return i.jsxs(i.Fragment,{children:[i.jsx(vt,{title:e}),i.jsx(Q,{className:"cesium-mc-choices",children:t.maps.map(h=>i.jsx(gn,{item:h,isSelected:s===h,onClick:()=>d(h.id)},h.id))})]})},Ei=({title:e,terrains:t})=>{const[n,r]=a.useState(),s=pe();a.useEffect(()=>{const d=t.find(h=>h.isCurrent);d&&r(d)},[t]);const o=d=>{const h=t.find(f=>f.id===d);h&&(s.terrainProvider=h.terrainProvider??new g.EllipsoidTerrainProvider({}),r(h),t.forEach(f=>{f.isCurrent=h===f}))};return i.jsxs(i.Fragment,{children:[i.jsx(vt,{title:e}),i.jsx(Q,{className:"cesium-mc-choices",children:t.map(d=>i.jsx(gn,{item:d,isSelected:n===d,onClick:()=>o(d.id)},d.id))})]})},wi=wt(({baseMaps:e,terrains:t,locale:n,isOpen:r,setIsOpen:s})=>{const[o,d]=a.useState(),h=a.useMemo(()=>$.get(n,"BASE_MAP_TITLE")??"Base Map",[n]),f=a.useMemo(()=>$.get(n,"TERRAIN_TITLE")??"Terrain",[n]);return i.jsxs(i.Fragment,{children:[i.jsx(et,{onClick:()=>s(!r),children:i.jsx("img",{className:"cesium-baseLayerPicker-selected",src:o==null?void 0:o.thumbnail,title:o==null?void 0:o.title,alt:"Current Map"})}),i.jsxs(Et,{isVisible:r,children:[e&&i.jsx(vi,{title:h,baseMaps:e,setCurrent:d}),t&&i.jsx(Ei,{title:f,terrains:t})]})]})}),Ls="",Ti=({featureTypes:e,locale:t})=>{const n=a.useMemo(()=>$.get(t,"WFS_TITLE")??"Data Layers",[t]),r=a.useMemo(()=>$.get(t,"WFS_CACHE")??"Cache",[t]),s=a.useMemo(()=>$.get(t,"WFS_EXTENT")??"Extent",[t]),o=a.useMemo(()=>$.get(t,"NO_DATA_LAYERS")??"No layers found",[t]),d=a.useMemo(()=>i.jsx(Q,{className:"title",children:n}),[n]),h=a.useMemo(()=>i.jsx(i.Fragment,{children:e.length>0?e.map((f,E)=>i.jsxs(Q,{className:"featureType",children:[i.jsx(J.Tooltip,{content:`${f.featureStructure.aliasLayerName} ${f.id} (${String(f.zoomLevel)})`,children:i.jsxs(Q,{className:`name ${f.currentZoomLevel<f.zoomLevel?"warning blinking":f.total===-1?"error blinking":""}`,children:[f.featureStructure.aliasLayerName," (",String(f.zoomLevel),"):"]})}),i.jsxs(Q,{className:"info",children:[i.jsxs(Q,{children:[r,": ",f.cache??0]}),f.total>0&&i.jsxs(Q,{className:"spacer",children:[s,": ",f.items," / ",f.total]})]})]},E)):i.jsx(Q,{children:o})}),[e]);return i.jsxs(Q,{className:"wfsContainer",children:[d,h]})},Li=wt(({locale:e,isOpen:t,setIsOpen:n})=>{var h;const[r,s]=a.useState([]),o=a.useMemo(()=>$.get(e,"DEBUG_PANEL_TITLE")??"Debugger Tool",[e]),d=pe();return a.useEffect(()=>{if(!d.layersManager)return;const f=(E,C)=>{var p;E.forEach(v=>{if(C!==void 0&&C!==v.meta.id)return;const{options:I,meta:T}=v,{zoomLevel:F}=I,{id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W}=T;s(Z=>{const ee=Z.findIndex(l=>l.id===V);if(ee>=0){if(JSON.stringify(Z[ee])!==JSON.stringify({id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W,zoomLevel:F})){const l=[...Z];return l[ee]={id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W,zoomLevel:F},l}}else return[...Z,{id:V,items:j,total:Y,cache:G,currentZoomLevel:X,featureStructure:W,zoomLevel:F}];return Z})});const b=new Set((p=d.layersManager)==null?void 0:p.dataLayerList.map(v=>v.meta.id));s(v=>v.filter(I=>b.has(I.id)))};return d.layersManager.addDataLayerUpdatedListener(f),()=>{var E;(E=d.layersManager)==null||E.removeDataLayerUpdatedListener(f)}},[(h=d.layersManager)==null?void 0:h.dataLayerList]),i.jsxs(i.Fragment,{children:[i.jsx(et,{onClick:()=>n(!t),children:i.jsx("svg",{width:"100%",height:"100%",viewBox:"0 0 24 24",children:i.jsx("path",{d:"M11.99 18.54l-7.37-5.73L3 14.07l9 7 9-7-1.63-1.27-7.38 5.74zM12 16l7.36-5.73L21 9l-9-7-9 7 1.63 1.27L12 16z",fill:"orange"})})}),i.jsx(Et,{isVisible:t,title:o,children:i.jsx(Ti,{featureTypes:r,locale:e})})]})});class Si extends g.PolylineDashMaterialProperty{}class bi extends g.ConstantProperty{}class Ci extends g.ConstantPositionProperty{}class Mi extends g.Cartesian2{}class _i extends g.Cartesian3{}class pn extends g.Cartographic{}class Pi extends g.BoundingSphere{}class Ii extends g.Ellipsoid{}class Ai extends g.GeographicTilingScheme{}class fn extends g.Rectangle{}class Di extends g.Resource{}class Oi extends g.EllipsoidTerrainProvider{}class ki extends g.CesiumTerrainProvider{}class xi extends g.PolylineGraphics{}class Ni extends g.JulianDate{}class Bi extends g.PositionProperty{}class Fi extends g.BillboardGraphics{}class Gi extends g.Color{}class Vi extends g.PolygonHierarchy{}class Hi extends g.Scene{}const Wi=g.VerticalOrigin,zi=g.HorizontalOrigin,tt=g.SceneMode,Ui=g.LabelStyle,$i=g.HeightReference,_e=document.createElement("canvas"),Te=_e.getContext("2d"),mn=e=>{const r=(e==null?void 0:e.data)??[];for(let s=3;s<r.length;s+=4)if(r[s]<255)return!0;return!1},qi=async(e,t)=>(t&&t.tileTransparencyCheckedCounter++,new Promise((n,r)=>{try{Te==null||Te.clearRect(0,0,_e.width,_e.height);let s;if(e instanceof HTMLImageElement)s=e;else if(e instanceof ImageBitmap){_e.width=e.width,_e.height=e.height,Te==null||Te.drawImage(e,0,0);const o=Te==null?void 0:Te.getImageData(0,0,_e.width,_e.height),d=mn(o);d&&t&&(t.tileTransparencyCheckedCounter=t.maxTilesForTransparencyCheck),n(d);return}else s=new Image,s.crossOrigin="anonymous",s.src=e;s.onload=()=>{_e.width=s.width,_e.height=s.height,Te==null||Te.drawImage(s,0,0);const o=Te==null?void 0:Te.getImageData(0,0,_e.width,_e.height);mn(o)?(t&&(t.tileTransparencyCheckedCounter=t.maxTilesForTransparencyCheck),n(!0)):n(!1)}}catch(s){console.error("Could not determine image transparency. Error => ",s),r(s)}})),nt=(e,t)=>{const{west:n,east:r,north:s,south:o}=e,{west:d,east:h,north:f,south:E}=t;return n>=d&&r<=h&&s<=f&&o>=E},ji=(e,t)=>hr(e,je(t)),Yi=e=>{const t=(g.Math.toDegrees(e.west)+g.Math.toDegrees(e.east))/2,n=(g.Math.toDegrees(e.south)+g.Math.toDegrees(e.north))/2;return xt.point([t,n])},yn=e=>[g.Math.toDegrees(e.west),g.Math.toDegrees(e.south),g.Math.toDegrees(e.east),g.Math.toDegrees(e.north)],vn=e=>{const t=e.scene;let r=e.camera.computeViewRectangle(t.globe.ellipsoid);if(!g.defined(r)||!r){console.error("cesium native computeViewRectangle returned invalid rectangle, fallback to custom calculation ");const s=new g.Cartesian2(0,0),o=t.camera.pickEllipsoid(s,t.globe.ellipsoid),d=new g.Cartesian2(t.canvas.width,t.canvas.height),h=t.camera.pickEllipsoid(d,t.globe.ellipsoid),f=t.globe.ellipsoid.cartesianToCartographic(o),E=t.globe.ellipsoid.cartesianToCartographic(h);r=new g.Rectangle(f.longitude,E.latitude,E.longitude,f.latitude)}return r},Zi=(e,t=100)=>{const n=e.scene,r=e.camera,s=n.mode,o=vn(e);if(!g.defined(o)||!o){console.error("customComputeViewRectangle returned invalid rectangle.");return}if(s===g.SceneMode.SCENE2D)return o;const d=r.positionCartographic;if(!g.defined(d)){console.error("Camera position is undefined in 3D mode.");return}const h=d.latitude,f=d.longitude;if(h<-g.Math.PI_OVER_TWO||h>g.Math.PI_OVER_TWO||f<-g.Math.PI||f>g.Math.PI){console.error("Invalid latitude or longitude values.");return}const E=111320,C=111320*Math.cos(h);let b=t/E,p=t/C;const v=g.Cartesian3.magnitude(r.positionWC);v>1e7&&(b=10,p=10);const I=r.frustum instanceof g.PerspectiveFrustum?r.frustum.fov:Math.PI/3;let T=1;v<5e5?T=.05:v<2e6&&(T=.1),b*=T*(I/Math.PI),p*=T*(I/Math.PI);const F=r.pitch;if(F===void 0)return;const V=Math.PI/4,j=Math.max(0,1-Math.abs(F)/V);b*=j,p*=j;const Y=5e-4;b=Math.max(b,Y),p=Math.max(p,Y);const G=d.latitude-b,X=d.latitude+b,W=d.longitude-p,Z=d.longitude+p,ee=g.Math.clamp(G,o.south,o.north),l=g.Math.clamp(X,o.south,o.north),c=g.Math.clamp(W,o.west,o.east),_=g.Math.clamp(Z,o.west,o.east),y=Math.min(1,F/g.Math.PI_OVER_TWO),S=o.north-(o.north-o.south)*y,w=Math.min(l,S);return new g.Rectangle(g.Math.negativePiToPi(c),g.Math.clamp(ee,-g.Math.PI_OVER_TWO,g.Math.PI_OVER_TWO),g.Math.negativePiToPi(_),g.Math.clamp(w,-g.Math.PI_OVER_TWO,g.Math.PI_OVER_TWO))},En=(e,t,n,r,s,o)=>{const d=e.scene.mode===g.SceneMode.SCENE2D,h=p=>{var v;if(p.polygon)return{type:"Polygon",coordinates:[((v=p.polygon.hierarchy)==null?void 0:v.getValue(g.JulianDate.now())).positions.map(F=>{const V=g.Cartographic.fromCartesian(F),j=new g.Cartographic(g.Math.toDegrees(V.longitude),g.Math.toDegrees(V.latitude),d?500:void 0);return[j.longitude,j.latitude,j.height]})]}},f=(p,v,I,T)=>{const F=g.SceneTransforms.wgs84ToWindowCoordinates(p,v);if(!F)return null;const V=F.x+I,j=F.y+T,Y=new g.Cartesian2(V,F.y),G=new g.Cartesian2(F.x,j),X=p.camera.pickEllipsoid(Y,p.globe.ellipsoid),W=p.camera.pickEllipsoid(G,p.globe.ellipsoid);if(!X||!W)return null;const Z=g.Cartesian3.distance(v,X),ee=g.Cartesian3.distance(v,W);return{widthMeters:Z,heightMeters:ee}},E=(p,v,I)=>{const T=g.Ellipsoid.WGS84,F=p.latitude,V=p.longitude,j=Math.PI/180*T.maximumRadius,Y=Math.PI/180*T.maximumRadius,G=I/2/j,X=v/2/Y,W=F+G,Z=F-G,ee=V+X,l=V-X;return{type:"Polygon",coordinates:[[[l,W],[ee,W],[ee,Z],[l,Z],[l,W]]]}},C=(p,v)=>kt(p)/kt(v);if(!e.dataSources.getByName(t.name)[0])return;const b=[];if(t==null||t.entities.values.forEach(p=>{var v,I;if(s&&o&&d)try{const T=je(s),F=Nt(h(p),T);if(F){const V=(v=p.properties)==null?void 0:v.label.getValue(g.JulianDate.now()),j=ur(F,{properties:{label:V}}),Y={width:V.width,height:V.height},[G,X,W=0]=j.geometry.coordinates,Z=g.Cartesian3.fromDegrees(G,X,W),ee=f(e.scene,Z,Y.width,Y.height);if(ee){const l=E({longitude:G,latitude:X},ee.widthMeters,ee.heightMeters),c=Nt(F,{type:"Feature",properties:{},geometry:l});C(c==null?void 0:c.geometry,l)>.7&&b.push(j)}}}catch{console.log("*** Label placement failed: turf.intersect() failed ***","entity -->",p,"extent -->",s)}if(!(n.length>0&&!n.some(T=>p.id.startsWith(T)))&&(p.polygon&&(p.polygon=new g.PolygonGraphics({hierarchy:p.polygon.hierarchy,material:d?g.Color.fromCssColorString(r).withAlpha(.2):g.Color.fromCssColorString(r).withAlpha(.5),outline:!0,outlineColor:g.Color.fromCssColorString(r),outlineWidth:3,height:d?1e4:void 0,perPositionHeight:!1})),p.polyline&&(p.polyline=new g.PolylineGraphics({positions:p.polyline.positions,material:g.Color.fromCssColorString(r).withAlpha(.5),clampToGround:!0,width:4})),p.billboard)){const T=(I=p.position)==null?void 0:I.getValue(g.JulianDate.now()),F=g.Cartographic.fromCartesian(T),V=new g.Cartographic(F.longitude,F.latitude,d?500:e.scene.sampleHeight(g.Cartographic.fromCartesian(T))),j=g.Cartesian3.fromRadians(V.longitude,V.latitude,V.height),Y="#FFFF00";p.position=j,p.billboard=new g.BillboardGraphics({image:"data:image/svg+xml;base64,"+btoa(`
2
2
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16">
3
3
  <circle cx="8" cy="8" r="6" fill="${r}33" stroke="${Y}80" stroke-width="2"/>
4
4
  </svg>
5
- `),verticalOrigin:g.VerticalOrigin.BOTTOM,heightReference:g.HeightReference.NONE,scale:1,disableDepthTestDistance:Number.POSITIVE_INFINITY})}}),e.dataSources.remove(e.dataSources.getByName(`${o==null?void 0:o.dataSourcePrefix}${t.name}`)[0]),o&&d){const p=new g.GeoJsonDataSource(`${o==null?void 0:o.dataSourcePrefix}${t.name}`);e.dataSources.add(p),p.load({type:"FeatureCollection",features:b}).then(v=>{v==null||v.entities.values.forEach(I=>{var T;I.billboard=new g.BillboardGraphics({image:(T=I.properties)==null?void 0:T.label.getValue(g.JulianDate.now()).dataURL,heightReference:g.HeightReference.NONE,scale:1,disableDepthTestDistance:Number.POSITIVE_INFINITY})})})}},Xi=.2,Ji=(e,t=Xi)=>e.width===0?(e.east=e.east+1e-4*t,e.west=e.west-1e-4*t,e.south=e.south-1e-4*t,e.north=e.north+1e-4*t,e):(e.east=e.east+e.width*t,e.west=e.west-e.width*t,e.south=e.south-e.height*t,e.north=e.north+e.height*t,e),bs="",Ki=({options:e,isOpen:t,locale:n})=>{const r=pe(),s=a.useRef(void 0),o=a.useRef(null),[d,h]=a.useState(""),[f,E]=a.useState(!1),[C,b]=a.useState(!0),[p,v]=a.useState(),[I,T]=a.useState(),F=a.useMemo(()=>$.get(n,"SHOW_FEATURE_ON_MAP")??"Show on map",[n]),V=a.useMemo(()=>$.get(n,"IN_MAP_EXTENT")??"Search in extent",[n]),j=a.useMemo(()=>$.get(n,"SEARCH_PLACEHOLDER")??"Search...",[n]),Y=a.useMemo(()=>$.get(n,"NO_RESULTS")??"No Results",[n]),G=a.useMemo(()=>r.scene.mode===g.SceneMode.SCENE2D?!1:(E(!1),!0),[r.scene.mode]),X=300,W=i.jsx("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",children:i.jsx("rect",{x:"0",y:"0",width:16,height:16,rx:"2",ry:"2",fill:"white",stroke:"#ccc",strokeWidth:1})}),Z=i.jsxs("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",children:[i.jsx("rect",{x:"0",y:"0",width:16,height:16,rx:"2",ry:"2",fill:"#1976d2",stroke:"#1976d2",strokeWidth:1}),i.jsx("path",{d:"M4 8l2 2 6-6",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]});a.useEffect(()=>{e.forEach(m=>{m.baseUrl&&m.endPoint&&!m.url&&(m.url=m.baseUrl+m.endPoint)})},[e]),a.useEffect(()=>{t&&o.current&&o.current.focus()},[t]),a.useEffect(()=>{if(!r)return;if(!s.current){const L=new g.GeoJsonDataSource("geocoderDataSource");s.current=L,r.dataSources.add(L)}const m=s.current;I&&C?(async()=>{const k={type:"FeatureCollection",features:[I]};await m.load(k),En(r,m,[],"#01FF1F")})():m.entities.removeAll()},[r,C,I]);const ee=m=>{switch(typeof m){case"object":return Array.isArray(m)?`[${m.map(L=>`'${L}'`).join(", ")}]`:JSON.stringify(m);case"boolean":case"number":case"string":return m.toString();case"undefined":return}},l=(m,L,k)=>{const N=ee(k);if(N){const A=m.includes("?")?m.endsWith("?")||m.endsWith("&")?"":"&":"?";return`${m}${A}${encodeURIComponent(L)}=${encodeURIComponent(N)}`}return m},c=(m,L)=>(m&&m.forEach(k=>{L=l(L,k[0],k[1])}),L),_=a.useCallback((m,L,k,N)=>((()=>{const O=L.dynamic.queryText,B=typeof O=="string"?O:O.name,te=typeof O=="string"?void 0:O.relatedParams;if(m=l(m,B,k),te&&te.forEach(ne=>{m=l(m,ne[0],ne[1])}),N){const ne=vn(r),q=L.dynamic.geoContext,R=typeof q=="string"?q:q==null?void 0:q.name;if(ne&&R){const ie=yn(ne),ge={bbox:[ie[0],ie[1],ie[2],ie[3]]};m=l(m,R,ge);const ve=typeof q=="string"||q==null?void 0:q.relatedParams;ve&&ve.forEach(oe=>{m=l(m,oe[0],oe[1])})}}})(),m=c(L.static,m),m),[r]),y=a.useCallback(async(m,L)=>{if(!m){v([]);return}const k=e.map(async O=>{if(O.url){const B=_(O.url,O.params,m,L);return fetch(B,{method:"GET"})}else return Promise.reject({message:"No URL provided. Please provide one"})}),N=await Promise.all(k),A=await Promise.all(N.filter(O=>O!==void 0).map(async O=>{var te;const B=await O.json();return B.features=(te=B.features)==null?void 0:te.map(ne=>({...ne,properties:{...ne.properties,headers:O.headers}})),{body:B,status:O.status,url:O.url,headers:Object.fromEntries(O.headers.entries())}}));v(A)},[_,e]),S=a.useMemo(()=>$.debounce((m,L)=>{y(m,L)},X),[y]);a.useEffect(()=>()=>S.cancel(),[S]);const w=(m,L)=>{h(m),S(m,L)};a.useEffect(()=>{y(d,f)},[f]);const P=m=>{const L=dr.getType(m);let k;switch(L){case"Point":k=i.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 24 24",fill:"var(--mdc-theme-cesium-color)",children:i.jsx("path",{d:"M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06C6.83 3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.46 7.48-3.77 7.94-7.94H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"})});break;case"LineString":k=i.jsxs("svg",{width:"18px",height:"18px",viewBox:"0 0 24 24",children:[i.jsx("path",{fill:"var(--mdc-theme-cesium-color)",stroke:"var(--mdc-theme-cesium-color)",strokeWidth:.5,d:"M21 6h.046l-5.25 9h-.944L10 9.455V7H7v2.926L1.862 18H0v3h3v-2.926L8.138 10h1.01L14 15.545V18h3v-3h-.046l5.25-9H24V3h-3zM8 8h1v1H8zM2 20H1v-1h1zm14-3h-1v-1h1zm7-13v1h-1V4z"}),i.jsx("path",{fill:"none",d:"M0 0h24v24H0z"})]});break;default:k=i.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 24 24",fill:"none",stroke:"var(--mdc-theme-cesium-color)",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M11 4 L20 14 L20 20 L4 20 L4 10 Z"})});break}return i.jsx(Q,{children:k})};return i.jsx(Q,{className:"geocoderContainer",children:i.jsxs(Q,{className:"geocoderForm",children:[i.jsx(J.TextField,{id:"geocoderTextField",className:"cesium-geocoder-input",ref:o,onChange:m=>w(m.target.value,f),placeholder:j,value:d,autoComplete:"off"}),i.jsxs(Q,{className:"search-results",children:[i.jsxs(Q,{className:"checkboxesContainer",children:[i.jsx(J.Checkbox,{className:"checkboxElement",label:F,icon:W,checkedicon:Z,checked:C,onClick:()=>{b(!C)}}),i.jsx(J.Checkbox,{className:"checkboxElement",label:i.jsx(J.Typography,{tag:"span",className:G?"disabled":"",children:V}),checked:f,icon:W,checkedicon:Z,disabled:G,onClick:()=>{E(!f)}})]}),i.jsx(Q,{className:"listsContainer",children:e.map((m,L)=>i.jsxs(J.List,{children:[i.jsx(J.Typography,{className:"bold",tag:"span",children:m.title??m.endPoint}),i.jsx(Q,{className:"listContainer",children:(()=>{var B,te,ne,q,R,ie,ge,ve;const k=(te=(B=p==null?void 0:p[L])==null?void 0:B.body)==null?void 0:te.features,N=(R=(q=(ne=p==null?void 0:p[L])==null?void 0:ne.body)==null?void 0:q.features)==null?void 0:R.length,A=(ge=(ie=p==null?void 0:p[L])==null?void 0:ie.body)==null?void 0:ge.message,O=(ve=p==null?void 0:p[L])==null?void 0:ve.status;return N?k.map((oe,fe)=>{var D,x,H,z,U;return i.jsx(J.ListItem,{className:I===oe?"mdc-ripple-upgraded--background-focused":"",onClick:()=>{var K;r.camera.flyTo({destination:Ji(fn.fromDegrees(...qe(oe.geometry)))}),T(oe),(K=m.callbackFunc)==null||K.call(m,oe,m,fe)},children:i.jsxs(Q,{className:"queryItemResult",children:[i.jsx(J.Tooltip,{content:(x=(D=oe==null?void 0:oe.properties)==null?void 0:D.names)==null?void 0:x.display,children:i.jsx(Q,{children:(U=(z=(H=oe==null?void 0:oe.properties)==null?void 0:H.names)==null?void 0:z.default)==null?void 0:U[0]})}),P(oe)]})},`feature-${fe}`)}):N===0?i.jsx(J.ListItemSecondaryText,{className:"generalListItem queryNoResults",children:Y}):A?i.jsx(J.ListItemSecondaryText,{className:`generalListItem ${O===400?"queryWarning":"queryError"}`,children:A}):i.jsx(J.ListItemSecondaryText,{className:"generalListItem"})})()})]}))})]})]})})},Qi=wt(({options:e,locale:t,isOpen:n,setIsOpen:r})=>i.jsxs(i.Fragment,{children:[i.jsx(et,{onClick:()=>r(!n),children:i.jsx("svg",{className:"cesium-svgPath-svg",width:"32",height:"32",fill:"var(--mdc-theme-cesium-color)",viewBox:"0 0 32 32",children:i.jsx("path",{d:"M29.772,26.433l-7.126-7.126c0.96-1.583,1.523-3.435,1.524-5.421C24.169,8.093,19.478,3.401,13.688,3.399C7.897,3.401,3.204,8.093,3.204,13.885c0,5.789,4.693,10.481,10.484,10.481c1.987,0,3.839-0.563,5.422-1.523l7.128,7.127L29.772,26.433zM7.203,13.885c0.006-3.582,2.903-6.478,6.484-6.486c3.579,0.008,6.478,2.904,6.484,6.486c-0.007,3.58-2.905,6.476-6.484,6.484C10.106,20.361,7.209,17.465,7.203,13.885z"})})}),i.jsx(Et,{isVisible:n,children:i.jsx(Ki,{options:e,isOpen:n,locale:t})})]})),Ri={GLOBAL:{"BM-GOOGLE_TERRAIN-XYZ_LAYER":"https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}","BM-INFRARED_RASTER-WMS_LAYER":"https://mesonet.agron.iastate.edu/cgi-bin/wms/goes/conus_ir.cgi?","BM-RADAR_RASTER-WMS_LAYER":"https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?","BM-VECTOR_TILES_GPS-XYZ_LAYER":"https://gps.tile.openstreetmap.org/lines/{z}/{x}/{y}.png","BM-VECTOR_TILES-XYZ_LAYER":"https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=6170aad10dfd42a38d4d8c709a536f38","BM-WMTS_POPULATION_TILES-WMTS_LAYER":"https://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Population_Density/MapServer/WMTS/","3D_MODEL":"https://3d.ofek-air.com/3d/Jeru_Old_City_Cesium/ACT/Jeru_Old_City_Cesium_ACT.json"},"WFS Vector layer":{"3d_model":"https://tiles.mapcolonies.net/api/3d/v1/b3dm/32d542c1-b956-4579-91df-2a43b183d8b3/data/vricon.3dtiles/tileset.json?token=eyJhbGciOiJSUzI1NiIsImtpZCI6Im1hcC1jb2xvbmllcy1pbnQifQ.eyJhbyI6WyJodHRwczovL2FwcC1pbnQtY2xpZW50LXJvdXRlLWludGVncmF0aW9uLmFwcHMuajFsazNuanAuZWFzdHVzLmFyb2FwcC5pbyIsImh0dHBzOi8vYXBwLWludC1jbGllbnQtdG9vbHMtcm91dGUtaW50ZWdyYXRpb24uYXBwcy5qMWxrM25qcC5lYXN0dXMuYXJvYXBwLmlvIiwiaHR0cDovL2xvY2FsaG9zdDozMDAwIl0sImQiOlsicmFzdGVyIiwicmFzdGVyV21zIiwicmFzdGVyRXhwb3J0IiwiZGVtIiwidmVjdG9yIiwiM2QiXSwiaWF0IjoxNjc0NjMyMzQ2LCJzdWIiOiJtYXBjb2xvbmllcy1hcHAiLCJpc3MiOiJtYXBjb2xvbmllcy10b2tlbi1jbGkifQ.e-4SmHNOE8FwpcJoHdp-3Dh6D8GqCwM5wZfZIPrivGhfeKdihcsjEj_WN2jWN-ULha_ytZN5gRusLjwikNwgbF6hvb-QTDe3bEHPAjtgpZmF4HaJze8e6VPDF1tTC52CHDzNnwkUGAH1tnVGq10SnyhsGDezUChTVeBeVu-swTI58qCjemUQRw7-Q03uSEH24AkbX2CC1_rNwulo7ChglyTdn01tTWPsPjIuDjeixxm2CUmUHpfZzroaSzwof7ByQe22o3tFddje6ItNLBUC_VN7UfNLa_QPSVbIuNac-iMGFbK-RIyXUK8mp1AwddvSGsBUYcDs8fWMLzKhItljnw",vector_geoserver:"http://geoserver-vector-dev.apps.j1lk3njp.eastus.aroapp.io/geoserver/core/ows"},"WFS Vector layer (Visual)":{"3d_model":"https://tiles.mapcolonies.net/api/3d/v1/b3dm/32d542c1-b956-4579-91df-2a43b183d8b3/data/vricon.3dtiles/tileset.json?token=eyJhbGciOiJSUzI1NiIsImtpZCI6Im1hcC1jb2xvbmllcy1pbnQifQ.eyJhbyI6WyJodHRwczovL2FwcC1pbnQtY2xpZW50LXJvdXRlLWludGVncmF0aW9uLmFwcHMuajFsazNuanAuZWFzdHVzLmFyb2FwcC5pbyIsImh0dHBzOi8vYXBwLWludC1jbGllbnQtdG9vbHMtcm91dGUtaW50ZWdyYXRpb24uYXBwcy5qMWxrM25qcC5lYXN0dXMuYXJvYXBwLmlvIiwiaHR0cDovL2xvY2FsaG9zdDozMDAwIl0sImQiOlsicmFzdGVyIiwicmFzdGVyV21zIiwicmFzdGVyRXhwb3J0IiwiZGVtIiwidmVjdG9yIiwiM2QiXSwiaWF0IjoxNjc0NjMyMzQ2LCJzdWIiOiJtYXBjb2xvbmllcy1hcHAiLCJpc3MiOiJtYXBjb2xvbmllcy10b2tlbi1jbGkifQ.e-4SmHNOE8FwpcJoHdp-3Dh6D8GqCwM5wZfZIPrivGhfeKdihcsjEj_WN2jWN-ULha_ytZN5gRusLjwikNwgbF6hvb-QTDe3bEHPAjtgpZmF4HaJze8e6VPDF1tTC52CHDzNnwkUGAH1tnVGq10SnyhsGDezUChTVeBeVu-swTI58qCjemUQRw7-Q03uSEH24AkbX2CC1_rNwulo7ChglyTdn01tTWPsPjIuDjeixxm2CUmUHpfZzroaSzwof7ByQe22o3tFddje6ItNLBUC_VN7UfNLa_QPSVbIuNac-iMGFbK-RIyXUK8mp1AwddvSGsBUYcDs8fWMLzKhItljnw"},"WFS PP layer":{raster_pp_geoserver:"https://raster-serving-int-pp-geoserver-nginx-route-manual-integration.apps.j1lk3njp.eastus.aroapp.io/geoserver/wfs?token=eyJhbGciOiJSUzI1NiIsImtpZCI6Im1hcC1jb2xvbmllcy1pbnQifQ.eyJkIjpbInJhc3RlciIsInJhc3RlcldtcyIsInJhc3RlckV4cG9ydCIsImRlbSIsInZlY3RvciIsIjNkIl0sImlhdCI6MTY3NDYzMjM0Niwic3ViIjoibWFwY29sb25pZXMtYXBwIiwiaXNzIjoibWFwY29sb25pZXMtdG9rZW4tY2xpIn0.D1u28gFlxf_Z1bzIiRHZonUgrdWwhZy8DtmQj15cIzaABRUrGV2n_OJlgWTuNfrao0SbUZb_s0_qUUW6Gz_zO3ET2bVx5xQjBu0CaIWdmUPDjEYr6tw-eZx8EjFFIyq3rs-Fo0daVY9cX1B2aGW_GeJir1oMnJUURhABYRoh60azzl_utee9UdhDpnr_QElNtzJZIKogngsxCWp7tI7wkTuNCBaQM7aLEcymk0ktxlWEAt1E0nGt1R-bx-HnPeeQyZlxx4UQ1nuYTijpz7N8poaCCExOFeafj9T7megv2BzTrKWgfM1eai8srSgNa3I5wKuW0EyYnGZxdbJe8aseZg"}},Pe=(e,t)=>Ri[e][t],eo=Pe("GLOBAL","DEFAULT_TERRAIN_PROVIDER_URL");Pe("GLOBAL","TERRAIN_SRTM100"),Pe("GLOBAL","TERRAIN_COMBINED"),Pe("GLOBAL","BM-GOOGLE_TERRAIN-XYZ_LAYER"),Pe("GLOBAL","BM-INFRARED_RASTER-WMS_LAYER"),Pe("GLOBAL","BM-RADAR_RASTER-WMS_LAYER"),Pe("GLOBAL","BM-GOOGLE_TERRAIN-XYZ_LAYER"),Pe("GLOBAL","BM-VECTOR_TILES_GPS-XYZ_LAYER"),Pe("GLOBAL","BM-VECTOR_TILES-XYZ_LAYER"),Pe("GLOBAL","BM-VECTOR_TILES_GPS-XYZ_LAYER"),Pe("GLOBAL","BM-WMTS_POPULATION_TILES-WMTS_LAYER");const wn=(e,t,n)=>{let r;if(e.scene.mode!==g.SceneMode.SCENE2D)r=e.scene.pickPosition(new g.Cartesian2(t,n));else{const s=e.scene.globe.ellipsoid;r=e.camera.pickEllipsoid(new g.Cartesian2(t,n),s)}return g.Cartographic.fromCartesian(r)},to=(e,t,n)=>{const r=wn(e,t,n);return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:[g.Math.toDegrees(r.longitude),g.Math.toDegrees(r.latitude)]}}},Tn=(e,t,n)=>{try{const r=wn(e,t,n);return{longitude:g.Math.toDegrees(r.longitude),latitude:g.Math.toDegrees(r.latitude)}}catch{return}},rt=3,it="hasTransparency";function Tt(e,t,n,r,s){return setTimeout(()=>{var h;const o=(h=this.layerListInstance.find(f=>{var E,C;return((E=f._imageryProvider._resource)==null?void 0:E._url)===((C=this._resource)==null?void 0:C._url)}))==null?void 0:h.meta,d=$.get(o,it)===!0;this.tileTransparencyCheckedCounter<rt&&!d&&qi(s==null?void 0:s.url,this).then(f=>{var E;(E=this.mapViewer.layersManager)==null||E.addMetaToLayer({[it]:f},C=>C._imageryProvider._resource._url===this._resource._url)})},0),e(t,n,r,s)}class Ln extends g.UrlTemplateImageryProvider{constructor(n,r){var s;super(n);ue(this,"layerListInstance");ue(this,"mapViewer");ue(this,"maxTilesForTransparencyCheck",rt);ue(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(n,r,s,o){return Tt.call(this,super.requestImage.bind(this),n,r,s,o)}}class Sn extends g.WebMapServiceImageryProvider{constructor(n,r){var s;super(n);ue(this,"layerListInstance");ue(this,"mapViewer");ue(this,"maxTilesForTransparencyCheck",rt);ue(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(n,r,s,o){return Tt.call(this,super.requestImage.bind(this),n,r,s,o)}}class bn extends g.WebMapTileServiceImageryProvider{constructor(n,r){var s;super(n);ue(this,"layerListInstance");ue(this,"mapViewer");ue(this,"maxTilesForTransparencyCheck",rt);ue(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(n,r,s,o){return Tt.call(this,super.requestImage.bind(this),n,r,s,o)}}const no=1,ro=-1,Cn="TRANSPARENT_BASE_LAYER";class io{constructor(t,n,r,s,o){ue(this,"mapViewer");ue(this,"legendsList");ue(this,"layerUpdated");ue(this,"dataLayerUpdated");ue(this,"layers");ue(this,"dataLayers");ue(this,"legendsExtractor");ue(this,"layerManagerFootprintMetaFieldPath");ue(this,"shouldOptimizedTileRequests");this.mapViewer=t,this.layers=this.mapViewer.imageryLayers._layers,this.dataLayers=[],this.legendsList=[],this.legendsExtractor=n,this.layerUpdated=new g.Event,this.dataLayerUpdated=new g.Event,this.layerManagerFootprintMetaFieldPath=s,this.shouldOptimizedTileRequests=o??!1,r&&this.addLayerUpdatedListener(r),this.shouldOptimizedTileRequests&&(this.addLayerUpdatedListener(d=>{const h=Object.keys(d);h.length===1&&h[0]===it&&(this.markRelevantLayersForExtent(),this.hideNonRelevantLayers())}),this.mapViewer.imageryLayers.layerRemoved.addEventListener(()=>{this.setLegends(),this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.imageryLayers.layerMoved.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.imageryLayers.layerAdded.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.camera.moveEnd.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}))}get layerList(){return this.layers}get dataLayerList(){return this.dataLayers}isBaseMapLayer(t){return!!$.get(t,"parentBasetMapId")}addDataLayer(t){this.dataLayers.push({...t}),this.dataLayerUpdated.raiseEvent(this.dataLayers)}addMetaToLayer(t,n){const r=this.layers.map(s=>s.imageryProvider.readyPromise);Promise.all(r).then(s=>{const o=this.layers.find(n);o&&(o.meta={...o.meta??{},...t},this.setLegends(),this.layerUpdated.raiseEvent(t))})}addMetaToDataLayer(t){const n=this.findDataLayerById(t.id);n&&(n.meta={...n.meta??{},...t},this.dataLayerUpdated.raiseEvent(this.dataLayers,t.id))}setBaseMapLayers(t){t.baseRasterLayers.sort((r,s)=>r.zIndex-s.zIndex).forEach((r,s)=>{this.addRasterLayer(r,s,t.id)}),this.shouldOptimizedTileRequests&&(this.removeLayer(Cn),this.addTransparentImageryProvider())}addRasterLayer(t,n,r){let s;switch(t.type){case"XYZ_LAYER":{const o=t.options,d=this.shouldOptimizedTileRequests?new Ln(o,this.mapViewer):new g.UrlTemplateImageryProvider(o);s=this.mapViewer.imageryLayers.addImageryProvider(d,n);break}case"WMS_LAYER":{const o=t.options,d=this.shouldOptimizedTileRequests?new Sn(o,this.mapViewer):new g.WebMapServiceImageryProvider(o);s=this.mapViewer.imageryLayers.addImageryProvider(d,n);break}case"WMTS_LAYER":{const o=t.options,d=this.shouldOptimizedTileRequests?new bn(o,this.mapViewer):new g.WebMapTileServiceImageryProvider(o);s=this.mapViewer.imageryLayers.addImageryProvider(d,n);break}}s&&(s.alpha=t.opacity,s.meta={parentBasetMapId:r,...t},t.show!==void 0&&(s.show=t.show))}removeLayer(t){const n=this.findLayerById(t);n&&this.mapViewer.imageryLayers.remove(n,!0)}removeDataLayer(t){const n=this.findDataLayerById(t);if(n){const r=this.dataLayers.indexOf(n);r>-1&&this.dataLayers.splice(r,1),this.dataLayerUpdated.raiseEvent(this.dataLayers)}}removeBaseMapLayers(){this.layers.filter(n=>this.isBaseMapLayer(n.meta)).forEach(n=>{this.mapViewer.imageryLayers.remove(n,!0)})}removeNotBaseMapLayers(){this.layers.filter(n=>!$.get(n.meta,"parentBasetMapId")).forEach(n=>{this.mapViewer.imageryLayers.remove(n,!0)})}raise(t,n=1){const r=this.findLayerById(t),s=(r==null?void 0:r.meta).zIndex;if(r)for(let o=0;o<n;o++)this.mapViewer.imageryLayers.raise(r);this.updateLayersOrder(t,s,s+n)}lower(t,n=1){const r=this.findLayerById(t),s=(r==null?void 0:r.meta).zIndex,o=this.getBaseLayersCount(),d=this.mapViewer.imageryLayers.indexOf(r);if(d-n<=o&&(n=d-o),r)for(let h=0;h<n;h++)this.mapViewer.imageryLayers.lower(r);this.updateLayersOrder(t,s,s-n)}raiseToTop(t){const n=this.findLayerById(t),r=(n==null?void 0:n.meta).zIndex;n&&this.mapViewer.imageryLayers.raiseToTop(n),this.updateLayersOrder(t,r,this.mapViewer.imageryLayers.length-this.getBaseLayersCount()-1)}lowerToBottom(t){const n=this.findLayerById(t),r=this.getBaseLayersCount(),s=this.mapViewer.imageryLayers.indexOf(n);this.lower(t,s-r)}length(){return this.mapViewer.imageryLayers.length}show(t,n){const r=this.get(t);r!==void 0&&(r.show=n)}showAllNotBase(t){this.layers.filter(r=>!$.get(r.meta,"parentBasetMapId")).forEach(r=>{var s;this.show((s=r.meta)==null?void 0:s.id,t)})}get(t){const n=this.findLayerById(t),r=this.mapViewer.imageryLayers.indexOf(n);return r?this.mapViewer.imageryLayers.get(r):void 0}pickImageryLayers(t){var s;const n=this.mapViewer.camera.getPickRay(t);let r;return n&&(r=(s=this.mapViewer.imageryLayers.pickImageryLayers(n,this.mapViewer.scene))==null?void 0:s.filter(o=>!$.get(o.meta,"parentBasetMapId"))),r}findLayerByPOI(t,n,r=!0){if(this.layerManagerFootprintMetaFieldPath){const s=to(this.mapViewer,t,n);return this.layers.filter(h=>!$.get(h.meta,"parentBasetMapId")).filter(h=>{const f=$.get(h.meta,this.layerManagerFootprintMetaFieldPath);return f!==void 0?gr(s.geometry,{type:"Feature",properties:{},geometry:f})&&(r?h.show:!0):(console.warn("[LayerManager] [findLayerByPOI] CesiumImageryLayer has no defined footprint",h.meta),!1)}).sort((h,f)=>{var E,C;return((E=f.meta)==null?void 0:E.zIndex)-((C=h.meta)==null?void 0:C.zIndex)})}else return console.warn("[LayerManager] [findLayerByPOI]layerManagerFootprintMetaFieldPath is not defined"),[]}addTransparentImageryProvider(){const t=this.mapViewer.imageryLayers.addImageryProvider(new g.SingleTileImageryProvider({url:"./assets/img/transparent-tile.png",rectangle:new g.Rectangle(-3.141592653589793,-1.5707963267948966,3.141592653589793,1.5707963267948966)}),0);t.meta={id:Cn,skipRelevancyCheck:!0,parentBasetMapId:"TRANSPARENT_LAYER"}}addLayerUpdatedListener(t){this.layerUpdated.addEventListener(t,this)}removeLayerUpdatedListener(t){this.layerUpdated.removeEventListener(t,this)}addDataLayerUpdatedListener(t){this.dataLayerUpdated.addEventListener(t,this)}removeDataLayerUpdatedListener(t){this.dataLayerUpdated.removeEventListener(t,this)}findDataLayerById(t){return this.dataLayers.find(n=>n.meta.id===t)}setLegends(){typeof this.legendsExtractor<"u"&&(this.legendsList=this.legendsExtractor(this.layers))}getBaseLayersCount(){return this.layers.filter(n=>!!$.get(n.meta,"parentBasetMapId")).length}findLayerById(t){return this.layers.find(n=>n.meta!==void 0?n.meta.id===t:!1)}updateLayersOrder(t,n,r){const s=n>r?no:ro,o=n<r?n:r,d=n<r?r:n;this.layers.forEach(h=>{var E;if(!$.get(h.meta,"parentBasetMapId")){const C=(E=h.meta)==null?void 0:E.zIndex;h.meta.zIndex=C>=o&&C<=d&&C!==n?C+s:C===n?r:C}})}hideNonRelevantLayers(){var t,n;for(const r of this.layers)((t=r.meta)==null?void 0:t.relevantToExtent)!==r.show&&r.imageryProvider.ready&&(r.show=((n=r.meta)==null?void 0:n.relevantToExtent)??!0)}markRelevantLayersForExtent(){var t,n;try{const r=this.mapViewer.camera.computeViewRectangle();for(let s=this.layers.length-1;s>=0;s--){const o=this.layers[s],d=!$.isEmpty(r)&&!$.isEmpty(o.rectangle)&&g.Rectangle.intersection(r,o.rectangle);for(let h=this.layers.length-1;h>=s;h--){if(((t=o.meta)==null?void 0:t.skipRelevancyCheck)===!0){o.meta={...o.meta,relevantToExtent:!0};continue}const f=this.layers[h],E=((n=f.meta)==null?void 0:n[it])===!0;if(o!==f)if(d instanceof g.Rectangle){if(nt(r,o.rectangle))if(nt(r,f.rectangle)&&!E){o.meta={...o.meta??{},relevantToExtent:!1};break}else o.meta={...o.meta??{},relevantToExtent:!0};if(nt(r,f.rectangle)&&!E){o.meta={...o.meta??{},relevantToExtent:!1};break}if(nt(o.rectangle,f.rectangle)){if(o.meta={...o.meta??{},relevantToExtent:E},!E)break}else o.meta={...o.meta??{},relevantToExtent:!0}}else o.meta={...o.meta??{},relevantToExtent:!1};else s===this.layers.length-1&&(o.meta={...o.meta??{},relevantToExtent:d instanceof g.Rectangle})}}}catch(r){console.error(r)}}}const _s="",oo=({legend:{legendImg:e,legendDoc:t,layer:n},docText:r,imgText:s})=>{const o=a.useCallback(()=>{window.open(e,"_blank")},[e]);a.useCallback(()=>{window.open(t,"_blank")},[t]);const d=a.useCallback(()=>{const E=i.jsx(Q,{className:"layerNameContainer",children:i.jsx("h3",{style:{maxWidth:`${15}ch`},className:"layerName",children:n})});return(n??"").length>15?i.jsx(J.Tooltip,{content:n,children:E}):E},[n]),h=a.useCallback(()=>[typeof e=="string"&&i.jsx("a",{className:"legendAction",href:e,target:"_blank",rel:"noreferrer",children:s}),typeof t=="string"&&i.jsx("a",{className:"legendAction",href:t,target:"_blank",rel:"noreferrer",children:r})],[e,s,t,r]);return i.jsxs(Q,{className:"mapLegend",children:[d(),i.jsx("img",{alt:"Map Legend",className:"legendImg",src:e,onClick:o}),i.jsx(Q,{className:"legendActionsContainer",children:h()})]})},so=({legends:e,actionsTexts:{docText:t,imgText:n},noLegendsText:r})=>{const s=a.useCallback(()=>i.jsx(Q,{className:"noLegendsContainer",children:i.jsx("h2",{className:"noLegendsMsg",children:r})}),[r]),o=a.useCallback(()=>e.length?e.map((d,h)=>i.jsx(oo,{legend:d,docText:t,imgText:n},`${d.layer}_${h}`)):s(),[e]);return i.jsx(Q,{className:"mapLegendsList",children:o()})},ao=({isOpen:e,toggleSidebar:t,title:n="Map Legends",noLegendsText:r="No legends to display...",actionsTexts:s={docText:"Docs",imgText:"View Image"},legends:o=[]})=>e?i.jsxs(J.Drawer,{className:"mapLegendSidebarContainer",modal:!1,dismissible:!0,open:e,children:[i.jsx(J.DrawerHeader,{className:"sidebarHeaderContainer",children:i.jsx(J.DrawerTitle,{className:"sidebarTitle",children:n})}),i.jsxs(J.DrawerContent,{className:"sidebarContent",children:[i.jsx(J.Icon,{onClick:t,className:"mapLegendCloseBtn",icon:{icon:"close",size:"small"}}),i.jsx(so,{noLegendsText:r,legends:o,actionsTexts:s})]})]}):null,lo=({legendToggle:e})=>i.jsx(i.Fragment,{children:i.jsx(et,{onClick:e,children:i.jsxs("svg",{height:"100%",width:"100%",viewBox:"-45 -45 650 650",children:[i.jsx("path",{d:`M322.4,173.9l-129,16.2l-4.6,21.4l25.3,4.7c16.5,3.9,19.8,9.9,16.2,26.4l-41.5,195.3c-10.9,50.5,5.9,74.3,45.5,74.3\r
5
+ `),verticalOrigin:g.VerticalOrigin.BOTTOM,heightReference:g.HeightReference.NONE,scale:1,disableDepthTestDistance:Number.POSITIVE_INFINITY})}}),e.dataSources.remove(e.dataSources.getByName(`${o==null?void 0:o.dataSourcePrefix}${t.name}`)[0]),o&&d){const p=new g.GeoJsonDataSource(`${o==null?void 0:o.dataSourcePrefix}${t.name}`);e.dataSources.add(p),p.load({type:"FeatureCollection",features:b}).then(v=>{v==null||v.entities.values.forEach(I=>{var T;I.billboard=new g.BillboardGraphics({image:(T=I.properties)==null?void 0:T.label.getValue(g.JulianDate.now()).dataURL,heightReference:g.HeightReference.NONE,scale:1,disableDepthTestDistance:Number.POSITIVE_INFINITY})})})}},Xi=.2,Ji=(e,t=Xi)=>e.width===0?(e.east=e.east+1e-4*t,e.west=e.west-1e-4*t,e.south=e.south-1e-4*t,e.north=e.north+1e-4*t,e):(e.east=e.east+e.width*t,e.west=e.west-e.width*t,e.south=e.south-e.height*t,e.north=e.north+e.height*t,e),bs="",Ki=({options:e,isOpen:t,locale:n})=>{const r=pe(),s=a.useRef(void 0),o=a.useRef(null),[d,h]=a.useState(""),[f,E]=a.useState(!1),[C,b]=a.useState(!0),[p,v]=a.useState(),[I,T]=a.useState(),F=a.useMemo(()=>$.get(n,"SHOW_FEATURE_ON_MAP")??"Show on map",[n]),V=a.useMemo(()=>$.get(n,"IN_MAP_EXTENT")??"Search in extent",[n]),j=a.useMemo(()=>$.get(n,"SEARCH_PLACEHOLDER")??"Search...",[n]),Y=a.useMemo(()=>$.get(n,"NO_RESULTS")??"No Results",[n]),G=a.useMemo(()=>r.scene.mode===g.SceneMode.SCENE2D?!1:(E(!1),!0),[r.scene.mode]),X=300,W=i.jsx("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",children:i.jsx("rect",{x:"0",y:"0",width:16,height:16,rx:"2",ry:"2",fill:"white",stroke:"#ccc",strokeWidth:1})}),Z=i.jsxs("svg",{width:"16px",height:"16px",viewBox:"0 0 16 16",children:[i.jsx("rect",{x:"0",y:"0",width:16,height:16,rx:"2",ry:"2",fill:"#1976d2",stroke:"#1976d2",strokeWidth:1}),i.jsx("path",{d:"M4 8l2 2 6-6",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]});a.useEffect(()=>{e.forEach(m=>{m.baseUrl&&m.endPoint&&!m.url&&(m.url=m.baseUrl+m.endPoint)})},[e]),a.useEffect(()=>{t&&o.current&&o.current.focus()},[t]),a.useEffect(()=>{if(!r)return;if(!s.current){const L=new g.GeoJsonDataSource("geocoderDataSource");s.current=L,r.dataSources.add(L)}const m=s.current;I&&C?(async()=>{const k={type:"FeatureCollection",features:[I]};await m.load(k),En(r,m,[],"#01FF1F")})():m.entities.removeAll()},[r,C,I]);const ee=m=>{switch(typeof m){case"object":return Array.isArray(m)?`[${m.map(L=>`'${L}'`).join(", ")}]`:JSON.stringify(m);case"boolean":case"number":case"string":return m.toString();case"undefined":return}},l=(m,L,k)=>{const N=ee(k);if(N){const A=m.includes("?")?m.endsWith("?")||m.endsWith("&")?"":"&":"?";return`${m}${A}${encodeURIComponent(L)}=${encodeURIComponent(N)}`}return m},c=(m,L)=>(m&&m.forEach(k=>{L=l(L,k[0],k[1])}),L),_=a.useCallback((m,L,k,N)=>((()=>{const O=L.dynamic.queryText,B=typeof O=="string"?O:O.name,te=typeof O=="string"?void 0:O.relatedParams;if(m=l(m,B,k),te&&te.forEach(ne=>{m=l(m,ne[0],ne[1])}),N){const ne=vn(r),q=L.dynamic.geoContext,R=typeof q=="string"?q:q==null?void 0:q.name;if(ne&&R){const ie=yn(ne),ge={bbox:[ie[0],ie[1],ie[2],ie[3]]};m=l(m,R,ge);const ve=typeof q=="string"||q==null?void 0:q.relatedParams;ve&&ve.forEach(oe=>{m=l(m,oe[0],oe[1])})}}})(),m=c(L.static,m),m),[r]),y=a.useCallback(async(m,L)=>{if(!m){v([]);return}const k=e.map(async O=>{if(O.url){const B=_(O.url,O.params,m,L);return fetch(B,{method:"GET"})}else return Promise.reject({message:"No URL provided. Please provide one"})}),N=await Promise.all(k),A=await Promise.all(N.filter(O=>O!==void 0).map(async O=>{var te;const B=await O.json();return B.features=(te=B.features)==null?void 0:te.map(ne=>({...ne,properties:{...ne.properties,headers:O.headers}})),{body:B,status:O.status,url:O.url,headers:Object.fromEntries(O.headers.entries())}}));v(A)},[_,e]),S=a.useMemo(()=>$.debounce((m,L)=>{y(m,L)},X),[y]);a.useEffect(()=>()=>S.cancel(),[S]);const w=(m,L)=>{h(m),S(m,L)};a.useEffect(()=>{y(d,f)},[f]);const P=m=>{const L=dr.getType(m);let k;switch(L){case"Point":k=i.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 24 24",fill:"var(--mdc-theme-cesium-color)",children:i.jsx("path",{d:"M12 8c-2.21 0-4 1.79-4 4s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4zm8.94 3c-.46-4.17-3.77-7.48-7.94-7.94V1h-2v2.06C6.83 3.52 3.52 6.83 3.06 11H1v2h2.06c.46 4.17 3.77 7.48 7.94 7.94V23h2v-2.06c4.17-.46 7.48-3.77 7.94-7.94H23v-2h-2.06zM12 19c-3.87 0-7-3.13-7-7s3.13-7 7-7 7 3.13 7 7-3.13 7-7 7z"})});break;case"LineString":k=i.jsxs("svg",{width:"18px",height:"18px",viewBox:"0 0 24 24",children:[i.jsx("path",{fill:"var(--mdc-theme-cesium-color)",stroke:"var(--mdc-theme-cesium-color)",strokeWidth:.5,d:"M21 6h.046l-5.25 9h-.944L10 9.455V7H7v2.926L1.862 18H0v3h3v-2.926L8.138 10h1.01L14 15.545V18h3v-3h-.046l5.25-9H24V3h-3zM8 8h1v1H8zM2 20H1v-1h1zm14-3h-1v-1h1zm7-13v1h-1V4z"}),i.jsx("path",{fill:"none",d:"M0 0h24v24H0z"})]});break;default:k=i.jsx("svg",{width:"18px",height:"18px",viewBox:"0 0 24 24",fill:"none",stroke:"var(--mdc-theme-cesium-color)",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",children:i.jsx("path",{d:"M11 4 L20 14 L20 20 L4 20 L4 10 Z"})});break}return i.jsx(Q,{children:k})};return i.jsx(Q,{className:"geocoderContainer",children:i.jsxs(Q,{className:"geocoderForm",children:[i.jsx(J.TextField,{id:"geocoderTextField",className:"cesium-geocoder-input",ref:o,onChange:m=>w(m.target.value,f),placeholder:j,value:d,autoComplete:"off"}),i.jsxs(Q,{className:"search-results",children:[i.jsxs(Q,{className:"checkboxesContainer",children:[i.jsx(J.Checkbox,{className:"checkboxElement",label:F,icon:W,checkedicon:Z,checked:C,onClick:()=>{b(!C)}}),i.jsx(J.Checkbox,{className:"checkboxElement",label:i.jsx(J.Typography,{tag:"span",className:G?"disabled":"",children:V}),checked:f,icon:W,checkedicon:Z,disabled:G,onClick:()=>{E(!f)}})]}),i.jsx(Q,{className:"listsContainer",children:e.map((m,L)=>i.jsxs(J.List,{children:[i.jsx(J.Typography,{className:"bold",tag:"span",children:m.title??m.endPoint}),i.jsx(Q,{className:"listContainer",children:(()=>{var B,te,ne,q,R,ie,ge,ve;const k=(te=(B=p==null?void 0:p[L])==null?void 0:B.body)==null?void 0:te.features,N=(R=(q=(ne=p==null?void 0:p[L])==null?void 0:ne.body)==null?void 0:q.features)==null?void 0:R.length,A=(ge=(ie=p==null?void 0:p[L])==null?void 0:ie.body)==null?void 0:ge.message,O=(ve=p==null?void 0:p[L])==null?void 0:ve.status;return N?k.map((oe,fe)=>{var D,x,H,z,U;return i.jsx(J.ListItem,{className:I===oe?"mdc-ripple-upgraded--background-focused":"",onClick:()=>{var K;r.camera.flyTo({destination:Ji(fn.fromDegrees(...qe(oe.geometry)))}),T(oe),(K=m.callbackFunc)==null||K.call(m,oe,m,fe)},children:i.jsxs(Q,{className:"queryItemResult",children:[i.jsx(J.Tooltip,{content:(x=(D=oe==null?void 0:oe.properties)==null?void 0:D.names)==null?void 0:x.display,children:i.jsx(Q,{children:(U=(z=(H=oe==null?void 0:oe.properties)==null?void 0:H.names)==null?void 0:z.default)==null?void 0:U[0]})}),P(oe)]})},`feature-${fe}`)}):N===0?i.jsx(J.ListItemSecondaryText,{className:"generalListItem queryNoResults",children:Y}):A?i.jsx(J.ListItemSecondaryText,{className:`generalListItem ${O===400?"queryWarning":"queryError"}`,children:A}):i.jsx(J.ListItemSecondaryText,{className:"generalListItem"})})()})]},`option-${L}`))})]})]})})},Qi=wt(({options:e,locale:t,isOpen:n,setIsOpen:r})=>i.jsxs(i.Fragment,{children:[i.jsx(et,{onClick:()=>r(!n),children:i.jsx("svg",{className:"cesium-svgPath-svg",width:"32",height:"32",fill:"var(--mdc-theme-cesium-color)",viewBox:"0 0 32 32",children:i.jsx("path",{d:"M29.772,26.433l-7.126-7.126c0.96-1.583,1.523-3.435,1.524-5.421C24.169,8.093,19.478,3.401,13.688,3.399C7.897,3.401,3.204,8.093,3.204,13.885c0,5.789,4.693,10.481,10.484,10.481c1.987,0,3.839-0.563,5.422-1.523l7.128,7.127L29.772,26.433zM7.203,13.885c0.006-3.582,2.903-6.478,6.484-6.486c3.579,0.008,6.478,2.904,6.484,6.486c-0.007,3.58-2.905,6.476-6.484,6.484C10.106,20.361,7.209,17.465,7.203,13.885z"})})}),i.jsx(Et,{isVisible:n,children:i.jsx(Ki,{options:e,isOpen:n,locale:t})})]})),Ri={GLOBAL:{"BM-GOOGLE_TERRAIN-XYZ_LAYER":"https://mt1.google.com/vt/lyrs=s&x={x}&y={y}&z={z}","BM-INFRARED_RASTER-WMS_LAYER":"https://mesonet.agron.iastate.edu/cgi-bin/wms/goes/conus_ir.cgi?","BM-RADAR_RASTER-WMS_LAYER":"https://mesonet.agron.iastate.edu/cgi-bin/wms/nexrad/n0r.cgi?","BM-VECTOR_TILES_GPS-XYZ_LAYER":"https://gps.tile.openstreetmap.org/lines/{z}/{x}/{y}.png","BM-VECTOR_TILES-XYZ_LAYER":"https://{s}.tile.thunderforest.com/cycle/{z}/{x}/{y}.png?apikey=6170aad10dfd42a38d4d8c709a536f38","BM-WMTS_POPULATION_TILES-WMTS_LAYER":"https://services.arcgisonline.com/arcgis/rest/services/Demographics/USA_Population_Density/MapServer/WMTS/","3D_MODEL":"https://3d.ofek-air.com/3d/Jeru_Old_City_Cesium/ACT/Jeru_Old_City_Cesium_ACT.json"},"WFS Vector layer":{"3d_model":"https://tiles.mapcolonies.net/api/3d/v1/b3dm/32d542c1-b956-4579-91df-2a43b183d8b3/data/vricon.3dtiles/tileset.json?token=eyJhbGciOiJSUzI1NiIsImtpZCI6Im1hcC1jb2xvbmllcy1pbnQifQ.eyJhbyI6WyJodHRwczovL2FwcC1pbnQtY2xpZW50LXJvdXRlLWludGVncmF0aW9uLmFwcHMuajFsazNuanAuZWFzdHVzLmFyb2FwcC5pbyIsImh0dHBzOi8vYXBwLWludC1jbGllbnQtdG9vbHMtcm91dGUtaW50ZWdyYXRpb24uYXBwcy5qMWxrM25qcC5lYXN0dXMuYXJvYXBwLmlvIiwiaHR0cDovL2xvY2FsaG9zdDozMDAwIl0sImQiOlsicmFzdGVyIiwicmFzdGVyV21zIiwicmFzdGVyRXhwb3J0IiwiZGVtIiwidmVjdG9yIiwiM2QiXSwiaWF0IjoxNjc0NjMyMzQ2LCJzdWIiOiJtYXBjb2xvbmllcy1hcHAiLCJpc3MiOiJtYXBjb2xvbmllcy10b2tlbi1jbGkifQ.e-4SmHNOE8FwpcJoHdp-3Dh6D8GqCwM5wZfZIPrivGhfeKdihcsjEj_WN2jWN-ULha_ytZN5gRusLjwikNwgbF6hvb-QTDe3bEHPAjtgpZmF4HaJze8e6VPDF1tTC52CHDzNnwkUGAH1tnVGq10SnyhsGDezUChTVeBeVu-swTI58qCjemUQRw7-Q03uSEH24AkbX2CC1_rNwulo7ChglyTdn01tTWPsPjIuDjeixxm2CUmUHpfZzroaSzwof7ByQe22o3tFddje6ItNLBUC_VN7UfNLa_QPSVbIuNac-iMGFbK-RIyXUK8mp1AwddvSGsBUYcDs8fWMLzKhItljnw",vector_geoserver:"http://geoserver-vector-dev.apps.j1lk3njp.eastus.aroapp.io/geoserver/core/ows"},"WFS Vector layer (Visual)":{"3d_model":"https://tiles.mapcolonies.net/api/3d/v1/b3dm/32d542c1-b956-4579-91df-2a43b183d8b3/data/vricon.3dtiles/tileset.json?token=eyJhbGciOiJSUzI1NiIsImtpZCI6Im1hcC1jb2xvbmllcy1pbnQifQ.eyJhbyI6WyJodHRwczovL2FwcC1pbnQtY2xpZW50LXJvdXRlLWludGVncmF0aW9uLmFwcHMuajFsazNuanAuZWFzdHVzLmFyb2FwcC5pbyIsImh0dHBzOi8vYXBwLWludC1jbGllbnQtdG9vbHMtcm91dGUtaW50ZWdyYXRpb24uYXBwcy5qMWxrM25qcC5lYXN0dXMuYXJvYXBwLmlvIiwiaHR0cDovL2xvY2FsaG9zdDozMDAwIl0sImQiOlsicmFzdGVyIiwicmFzdGVyV21zIiwicmFzdGVyRXhwb3J0IiwiZGVtIiwidmVjdG9yIiwiM2QiXSwiaWF0IjoxNjc0NjMyMzQ2LCJzdWIiOiJtYXBjb2xvbmllcy1hcHAiLCJpc3MiOiJtYXBjb2xvbmllcy10b2tlbi1jbGkifQ.e-4SmHNOE8FwpcJoHdp-3Dh6D8GqCwM5wZfZIPrivGhfeKdihcsjEj_WN2jWN-ULha_ytZN5gRusLjwikNwgbF6hvb-QTDe3bEHPAjtgpZmF4HaJze8e6VPDF1tTC52CHDzNnwkUGAH1tnVGq10SnyhsGDezUChTVeBeVu-swTI58qCjemUQRw7-Q03uSEH24AkbX2CC1_rNwulo7ChglyTdn01tTWPsPjIuDjeixxm2CUmUHpfZzroaSzwof7ByQe22o3tFddje6ItNLBUC_VN7UfNLa_QPSVbIuNac-iMGFbK-RIyXUK8mp1AwddvSGsBUYcDs8fWMLzKhItljnw"},"WFS PP layer":{raster_pp_geoserver:"https://raster-serving-int-pp-geoserver-nginx-route-manual-integration.apps.j1lk3njp.eastus.aroapp.io/geoserver/wfs?token=eyJhbGciOiJSUzI1NiIsImtpZCI6Im1hcC1jb2xvbmllcy1pbnQifQ.eyJkIjpbInJhc3RlciIsInJhc3RlcldtcyIsInJhc3RlckV4cG9ydCIsImRlbSIsInZlY3RvciIsIjNkIl0sImlhdCI6MTY3NDYzMjM0Niwic3ViIjoibWFwY29sb25pZXMtYXBwIiwiaXNzIjoibWFwY29sb25pZXMtdG9rZW4tY2xpIn0.D1u28gFlxf_Z1bzIiRHZonUgrdWwhZy8DtmQj15cIzaABRUrGV2n_OJlgWTuNfrao0SbUZb_s0_qUUW6Gz_zO3ET2bVx5xQjBu0CaIWdmUPDjEYr6tw-eZx8EjFFIyq3rs-Fo0daVY9cX1B2aGW_GeJir1oMnJUURhABYRoh60azzl_utee9UdhDpnr_QElNtzJZIKogngsxCWp7tI7wkTuNCBaQM7aLEcymk0ktxlWEAt1E0nGt1R-bx-HnPeeQyZlxx4UQ1nuYTijpz7N8poaCCExOFeafj9T7megv2BzTrKWgfM1eai8srSgNa3I5wKuW0EyYnGZxdbJe8aseZg"}},Pe=(e,t)=>Ri[e][t],eo=Pe("GLOBAL","DEFAULT_TERRAIN_PROVIDER_URL");Pe("GLOBAL","TERRAIN_SRTM100"),Pe("GLOBAL","TERRAIN_COMBINED"),Pe("GLOBAL","BM-GOOGLE_TERRAIN-XYZ_LAYER"),Pe("GLOBAL","BM-INFRARED_RASTER-WMS_LAYER"),Pe("GLOBAL","BM-RADAR_RASTER-WMS_LAYER"),Pe("GLOBAL","BM-GOOGLE_TERRAIN-XYZ_LAYER"),Pe("GLOBAL","BM-VECTOR_TILES_GPS-XYZ_LAYER"),Pe("GLOBAL","BM-VECTOR_TILES-XYZ_LAYER"),Pe("GLOBAL","BM-VECTOR_TILES_GPS-XYZ_LAYER"),Pe("GLOBAL","BM-WMTS_POPULATION_TILES-WMTS_LAYER");const wn=(e,t,n)=>{let r;if(e.scene.mode!==g.SceneMode.SCENE2D)r=e.scene.pickPosition(new g.Cartesian2(t,n));else{const s=e.scene.globe.ellipsoid;r=e.camera.pickEllipsoid(new g.Cartesian2(t,n),s)}return g.Cartographic.fromCartesian(r)},to=(e,t,n)=>{const r=wn(e,t,n);return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:[g.Math.toDegrees(r.longitude),g.Math.toDegrees(r.latitude)]}}},Tn=(e,t,n)=>{try{const r=wn(e,t,n);return{longitude:g.Math.toDegrees(r.longitude),latitude:g.Math.toDegrees(r.latitude)}}catch{return}},rt=3,it="hasTransparency";function Tt(e,t,n,r,s){return setTimeout(()=>{var h;const o=(h=this.layerListInstance.find(f=>{var E,C;return((E=f._imageryProvider._resource)==null?void 0:E._url)===((C=this._resource)==null?void 0:C._url)}))==null?void 0:h.meta,d=$.get(o,it)===!0;this.tileTransparencyCheckedCounter<rt&&!d&&qi(s==null?void 0:s.url,this).then(f=>{var E;(E=this.mapViewer.layersManager)==null||E.addMetaToLayer({[it]:f},C=>C._imageryProvider._resource._url===this._resource._url)})},0),e(t,n,r,s)}class Ln extends g.UrlTemplateImageryProvider{constructor(n,r){var s;super(n);ue(this,"layerListInstance");ue(this,"mapViewer");ue(this,"maxTilesForTransparencyCheck",rt);ue(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(n,r,s,o){return Tt.call(this,super.requestImage.bind(this),n,r,s,o)}}class Sn extends g.WebMapServiceImageryProvider{constructor(n,r){var s;super(n);ue(this,"layerListInstance");ue(this,"mapViewer");ue(this,"maxTilesForTransparencyCheck",rt);ue(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(n,r,s,o){return Tt.call(this,super.requestImage.bind(this),n,r,s,o)}}class bn extends g.WebMapTileServiceImageryProvider{constructor(n,r){var s;super(n);ue(this,"layerListInstance");ue(this,"mapViewer");ue(this,"maxTilesForTransparencyCheck",rt);ue(this,"tileTransparencyCheckedCounter",0);this.layerListInstance=(s=r.layersManager)==null?void 0:s.layerList,this.mapViewer=r}requestImage(n,r,s,o){return Tt.call(this,super.requestImage.bind(this),n,r,s,o)}}const no=1,ro=-1,Cn="TRANSPARENT_BASE_LAYER";class io{constructor(t,n,r,s,o){ue(this,"mapViewer");ue(this,"legendsList");ue(this,"layerUpdated");ue(this,"dataLayerUpdated");ue(this,"layers");ue(this,"dataLayers");ue(this,"legendsExtractor");ue(this,"layerManagerFootprintMetaFieldPath");ue(this,"shouldOptimizedTileRequests");this.mapViewer=t,this.layers=this.mapViewer.imageryLayers._layers,this.dataLayers=[],this.legendsList=[],this.legendsExtractor=n,this.layerUpdated=new g.Event,this.dataLayerUpdated=new g.Event,this.layerManagerFootprintMetaFieldPath=s,this.shouldOptimizedTileRequests=o??!1,r&&this.addLayerUpdatedListener(r),this.shouldOptimizedTileRequests&&(this.addLayerUpdatedListener(d=>{const h=Object.keys(d);h.length===1&&h[0]===it&&(this.markRelevantLayersForExtent(),this.hideNonRelevantLayers())}),this.mapViewer.imageryLayers.layerRemoved.addEventListener(()=>{this.setLegends(),this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.imageryLayers.layerMoved.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.imageryLayers.layerAdded.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}),this.mapViewer.camera.moveEnd.addEventListener(()=>{this.markRelevantLayersForExtent(),this.hideNonRelevantLayers()}))}get layerList(){return this.layers}get dataLayerList(){return this.dataLayers}isBaseMapLayer(t){return!!$.get(t,"parentBasetMapId")}addDataLayer(t){this.dataLayers.push({...t}),this.dataLayerUpdated.raiseEvent(this.dataLayers)}addMetaToLayer(t,n){const r=this.layers.map(s=>s.imageryProvider.readyPromise);Promise.all(r).then(s=>{const o=this.layers.find(n);o&&(o.meta={...o.meta??{},...t},this.setLegends(),this.layerUpdated.raiseEvent(t))})}addMetaToDataLayer(t){const n=this.findDataLayerById(t.id);n&&(n.meta={...n.meta??{},...t},this.dataLayerUpdated.raiseEvent(this.dataLayers,t.id))}setBaseMapLayers(t){t.baseRasterLayers.sort((r,s)=>r.zIndex-s.zIndex).forEach((r,s)=>{this.addRasterLayer(r,s,t.id)}),this.shouldOptimizedTileRequests&&(this.removeLayer(Cn),this.addTransparentImageryProvider())}addRasterLayer(t,n,r){let s;switch(t.type){case"XYZ_LAYER":{const o=t.options,d=this.shouldOptimizedTileRequests?new Ln(o,this.mapViewer):new g.UrlTemplateImageryProvider(o);s=this.mapViewer.imageryLayers.addImageryProvider(d,n);break}case"WMS_LAYER":{const o=t.options,d=this.shouldOptimizedTileRequests?new Sn(o,this.mapViewer):new g.WebMapServiceImageryProvider(o);s=this.mapViewer.imageryLayers.addImageryProvider(d,n);break}case"WMTS_LAYER":{const o=t.options,d=this.shouldOptimizedTileRequests?new bn(o,this.mapViewer):new g.WebMapTileServiceImageryProvider(o);s=this.mapViewer.imageryLayers.addImageryProvider(d,n);break}}s&&(s.alpha=t.opacity,s.meta={parentBasetMapId:r,...t},t.show!==void 0&&(s.show=t.show))}removeLayer(t){const n=this.findLayerById(t);n&&this.mapViewer.imageryLayers.remove(n,!0)}removeDataLayer(t){const n=this.findDataLayerById(t);if(n){const r=this.dataLayers.indexOf(n);r>-1&&this.dataLayers.splice(r,1),this.dataLayerUpdated.raiseEvent(this.dataLayers)}}removeBaseMapLayers(){this.layers.filter(n=>this.isBaseMapLayer(n.meta)).forEach(n=>{this.mapViewer.imageryLayers.remove(n,!0)})}removeNotBaseMapLayers(){this.layers.filter(n=>!$.get(n.meta,"parentBasetMapId")).forEach(n=>{this.mapViewer.imageryLayers.remove(n,!0)})}raise(t,n=1){const r=this.findLayerById(t),s=(r==null?void 0:r.meta).zIndex;if(r)for(let o=0;o<n;o++)this.mapViewer.imageryLayers.raise(r);this.updateLayersOrder(t,s,s+n)}lower(t,n=1){const r=this.findLayerById(t),s=(r==null?void 0:r.meta).zIndex,o=this.getBaseLayersCount(),d=this.mapViewer.imageryLayers.indexOf(r);if(d-n<=o&&(n=d-o),r)for(let h=0;h<n;h++)this.mapViewer.imageryLayers.lower(r);this.updateLayersOrder(t,s,s-n)}raiseToTop(t){const n=this.findLayerById(t),r=(n==null?void 0:n.meta).zIndex;n&&this.mapViewer.imageryLayers.raiseToTop(n),this.updateLayersOrder(t,r,this.mapViewer.imageryLayers.length-this.getBaseLayersCount()-1)}lowerToBottom(t){const n=this.findLayerById(t),r=this.getBaseLayersCount(),s=this.mapViewer.imageryLayers.indexOf(n);this.lower(t,s-r)}length(){return this.mapViewer.imageryLayers.length}show(t,n){const r=this.get(t);r!==void 0&&(r.show=n)}showAllNotBase(t){this.layers.filter(r=>!$.get(r.meta,"parentBasetMapId")).forEach(r=>{var s;this.show((s=r.meta)==null?void 0:s.id,t)})}get(t){const n=this.findLayerById(t),r=this.mapViewer.imageryLayers.indexOf(n);return r?this.mapViewer.imageryLayers.get(r):void 0}pickImageryLayers(t){var s;const n=this.mapViewer.camera.getPickRay(t);let r;return n&&(r=(s=this.mapViewer.imageryLayers.pickImageryLayers(n,this.mapViewer.scene))==null?void 0:s.filter(o=>!$.get(o.meta,"parentBasetMapId"))),r}findLayerByPOI(t,n,r=!0){if(this.layerManagerFootprintMetaFieldPath){const s=to(this.mapViewer,t,n);return this.layers.filter(h=>!$.get(h.meta,"parentBasetMapId")).filter(h=>{const f=$.get(h.meta,this.layerManagerFootprintMetaFieldPath);return f!==void 0?gr(s.geometry,{type:"Feature",properties:{},geometry:f})&&(r?h.show:!0):(console.warn("[LayerManager] [findLayerByPOI] CesiumImageryLayer has no defined footprint",h.meta),!1)}).sort((h,f)=>{var E,C;return((E=f.meta)==null?void 0:E.zIndex)-((C=h.meta)==null?void 0:C.zIndex)})}else return console.warn("[LayerManager] [findLayerByPOI]layerManagerFootprintMetaFieldPath is not defined"),[]}addTransparentImageryProvider(){const t=this.mapViewer.imageryLayers.addImageryProvider(new g.SingleTileImageryProvider({url:"./assets/img/transparent-tile.png",rectangle:new g.Rectangle(-3.141592653589793,-1.5707963267948966,3.141592653589793,1.5707963267948966)}),0);t.meta={id:Cn,skipRelevancyCheck:!0,parentBasetMapId:"TRANSPARENT_LAYER"}}addLayerUpdatedListener(t){this.layerUpdated.addEventListener(t,this)}removeLayerUpdatedListener(t){this.layerUpdated.removeEventListener(t,this)}addDataLayerUpdatedListener(t){this.dataLayerUpdated.addEventListener(t,this)}removeDataLayerUpdatedListener(t){this.dataLayerUpdated.removeEventListener(t,this)}findDataLayerById(t){return this.dataLayers.find(n=>n.meta.id===t)}setLegends(){typeof this.legendsExtractor<"u"&&(this.legendsList=this.legendsExtractor(this.layers))}getBaseLayersCount(){return this.layers.filter(n=>!!$.get(n.meta,"parentBasetMapId")).length}findLayerById(t){return this.layers.find(n=>n.meta!==void 0?n.meta.id===t:!1)}updateLayersOrder(t,n,r){const s=n>r?no:ro,o=n<r?n:r,d=n<r?r:n;this.layers.forEach(h=>{var E;if(!$.get(h.meta,"parentBasetMapId")){const C=(E=h.meta)==null?void 0:E.zIndex;h.meta.zIndex=C>=o&&C<=d&&C!==n?C+s:C===n?r:C}})}hideNonRelevantLayers(){var t,n;for(const r of this.layers)((t=r.meta)==null?void 0:t.relevantToExtent)!==r.show&&r.imageryProvider.ready&&(r.show=((n=r.meta)==null?void 0:n.relevantToExtent)??!0)}markRelevantLayersForExtent(){var t,n;try{const r=this.mapViewer.camera.computeViewRectangle();for(let s=this.layers.length-1;s>=0;s--){const o=this.layers[s],d=!$.isEmpty(r)&&!$.isEmpty(o.rectangle)&&g.Rectangle.intersection(r,o.rectangle);for(let h=this.layers.length-1;h>=s;h--){if(((t=o.meta)==null?void 0:t.skipRelevancyCheck)===!0){o.meta={...o.meta,relevantToExtent:!0};continue}const f=this.layers[h],E=((n=f.meta)==null?void 0:n[it])===!0;if(o!==f)if(d instanceof g.Rectangle){if(nt(r,o.rectangle))if(nt(r,f.rectangle)&&!E){o.meta={...o.meta??{},relevantToExtent:!1};break}else o.meta={...o.meta??{},relevantToExtent:!0};if(nt(r,f.rectangle)&&!E){o.meta={...o.meta??{},relevantToExtent:!1};break}if(nt(o.rectangle,f.rectangle)){if(o.meta={...o.meta??{},relevantToExtent:E},!E)break}else o.meta={...o.meta??{},relevantToExtent:!0}}else o.meta={...o.meta??{},relevantToExtent:!1};else s===this.layers.length-1&&(o.meta={...o.meta??{},relevantToExtent:d instanceof g.Rectangle})}}}catch(r){console.error(r)}}}const _s="",oo=({legend:{legendImg:e,legendDoc:t,layer:n},docText:r,imgText:s})=>{const o=a.useCallback(()=>{window.open(e,"_blank")},[e]);a.useCallback(()=>{window.open(t,"_blank")},[t]);const d=a.useCallback(()=>{const E=i.jsx(Q,{className:"layerNameContainer",children:i.jsx("h3",{style:{maxWidth:`${15}ch`},className:"layerName",children:n})});return(n??"").length>15?i.jsx(J.Tooltip,{content:n,children:E}):E},[n]),h=a.useCallback(()=>[typeof e=="string"&&i.jsx("a",{className:"legendAction",href:e,target:"_blank",rel:"noreferrer",children:s}),typeof t=="string"&&i.jsx("a",{className:"legendAction",href:t,target:"_blank",rel:"noreferrer",children:r})],[e,s,t,r]);return i.jsxs(Q,{className:"mapLegend",children:[d(),i.jsx("img",{alt:"Map Legend",className:"legendImg",src:e,onClick:o}),i.jsx(Q,{className:"legendActionsContainer",children:h()})]})},so=({legends:e,actionsTexts:{docText:t,imgText:n},noLegendsText:r})=>{const s=a.useCallback(()=>i.jsx(Q,{className:"noLegendsContainer",children:i.jsx("h2",{className:"noLegendsMsg",children:r})}),[r]),o=a.useCallback(()=>e.length?e.map((d,h)=>i.jsx(oo,{legend:d,docText:t,imgText:n},`${d.layer}_${h}`)):s(),[e]);return i.jsx(Q,{className:"mapLegendsList",children:o()})},ao=({isOpen:e,toggleSidebar:t,title:n="Map Legends",noLegendsText:r="No legends to display...",actionsTexts:s={docText:"Docs",imgText:"View Image"},legends:o=[]})=>e?i.jsxs(J.Drawer,{className:"mapLegendSidebarContainer",modal:!1,dismissible:!0,open:e,children:[i.jsx(J.DrawerHeader,{className:"sidebarHeaderContainer",children:i.jsx(J.DrawerTitle,{className:"sidebarTitle",children:n})}),i.jsxs(J.DrawerContent,{className:"sidebarContent",children:[i.jsx(J.Icon,{onClick:t,className:"mapLegendCloseBtn",icon:{icon:"close",size:"small"}}),i.jsx(so,{noLegendsText:r,legends:o,actionsTexts:s})]})]}):null,lo=({legendToggle:e})=>i.jsx(i.Fragment,{children:i.jsx(et,{onClick:e,children:i.jsxs("svg",{height:"100%",width:"100%",viewBox:"-45 -45 650 650",children:[i.jsx("path",{d:`M322.4,173.9l-129,16.2l-4.6,21.4l25.3,4.7c16.5,3.9,19.8,9.9,16.2,26.4l-41.5,195.3c-10.9,50.5,5.9,74.3,45.5,74.3\r
6
6
  c30.7,0,66.3-14.2,82.5-33.6l4.9-23.4c-11.3,9.9-27.7,13.9-38.6,13.9c-15.5,0-21.1-10.9-17.1-30L322.4,173.9z`}),i.jsx("circle",{cx:"270.1",cy:"56.3",r:"56.3"})]})})}),Ps="",Mn=e=>{const t=pe(),{enableCompass:n=!0,enableZoomControls:r=!1,lockCompassNavigation:s=!1,locale:o={DIRECTION:"ltr"}}=e;return a.useEffect(()=>{if(typeof $.get(t,"cesiumNavigation")>"u"){t.extend(pr,{enableCompass:n,enableZoomControls:r,enableDistanceLegend:!1}),t.cesiumNavigation.setNavigationLocked(s);const d=document.querySelector(".compass");d&&o.DIRECTION&&d.classList.add(o.DIRECTION)}},[t,n,r,o.DIRECTION,s]),null},Is="",_n=e=>{const t=pe(),n=a.useRef(null),[r,s]=a.useState({x:0,y:0});return a.useEffect(()=>{t.screenSpaceEventHandler.setInputAction(o=>{if(o!=null&&o.endPosition){const d={...o.endPosition};d.x=Math.ceil(d.x),d.y=Math.ceil(d.y),s(d)}},g.ScreenSpaceEventType.MOUSE_MOVE)},[n,t]),a.useEffect(()=>{const o=t.scene.globe.ellipsoid;if(r){const d=Tn(t,r.x,r.y);if(d){const h=new pn(d.longitude,d.latitude);if(n.current){let f="";switch(e.projection){case be.WEB_MERCATOR:{const C=new g.WebMercatorProjection(o).project(h);f=`Mercator: ${C.y.toFixed(Qe)}m, ${C.x.toFixed(Qe)}m`,n.current.style.width="220px";break}case be.WGS84:{const E=h.longitude.toFixed(Ke);f=`WGS84: ${h.latitude.toFixed(Ke)}°N ${E}°E`,n.current.style.width="200px";break}}n.current.innerHTML=f}}}},[r,n,t,e.projection]),i.jsx("div",{className:"coordinatesTracker",ref:n})},As="",Lt=[1,2,3,5,10,20,30,50,100,200,300,500,1e3,2e3,3e3,5e3,1e4,2e4,3e4,5e4,1e5,2e5,3e5,5e5,1e6,2e6,3e6,5e6,1e7,2e7,3e7,5e7],co=(e,t,n,r)=>{const s=$.get(r,"METERS_UNIT")??"m",o=$.get(r,"KILOMETERS_UNIT")??"km",d={barWidth:void 0,distanceLabel:void 0,lastLegendUpdate:t.lastLegendUpdate},h=new g.EllipsoidGeodesic,f=new Date().getTime();if(f<d.lastLegendUpdate+250)return;d.lastLegendUpdate=f;const E=e.scene.canvas.clientWidth,C=e.scene.canvas.clientHeight,b=e.scene.camera.getPickRay(new g.Cartesian2(E/2|0,C-1)),p=e.scene.camera.getPickRay(new g.Cartesian2(1+E/2|0,C-1)),v=e.scene.globe,I=v.pick(b,e.scene),T=v.pick(p,e.scene);if(!I||!T)return;const F=v.ellipsoid.cartesianToCartographic(I),V=v.ellipsoid.cartesianToCartographic(T);h.setEndPoints(F,V);const j=h.surfaceDistance,Y=100;let G;for(let X=Lt.length-1;!$.isNumber(G)&&X>=0;--X)Lt[X]/j<Y&&(G=Lt[X]);if($.isNumber(G)){let X="";G>=1e3?X=`${(G/1e3).toString()} ${o}`:X=`${G.toString()} ${s}`,d.barWidth=G/j|0,d.distanceLabel=X}n(d)},Pn=e=>{const t=pe(),[n,r]=a.useState({barWidth:void 0,distanceLabel:void 0,lastLegendUpdate:-1});a.useEffect(()=>{const o=f=>{co(t,n,r,e.locale)},d=new g.EventHelper,h=f=>{t.scene.globe.tilesLoaded&&(o(new MouseEvent("mouse")),d.removeAll())};return d.add(t.scene.globe.tileLoadProgressEvent,h),t.camera.moveEnd.addEventListener(o),()=>{try{$.get(t,"_cesiumWidget")!=null&&t.camera.moveEnd.removeEventListener(o)}catch(f){console.log('CESIUM camera "moveEnd" remove listener failed',f)}}},[t,e.locale,n]);const s=o=>5+(125-o)/2;return i.jsx("div",{className:"scaleTracker",children:$.isNumber(n.barWidth)&&i.jsxs(i.Fragment,{children:[i.jsx("div",{className:"scaleTrackerLabel",children:i.jsx("bdi",{children:n.distanceLabel})}),i.jsx("div",{className:"scaleTrackerBar",style:{height:"2px",width:`${n.barWidth.toString()}px`,left:`${s(n.barWidth).toString()}px`}})]})})},Ds="",In=()=>{const e=pe(),t=[{onClick:()=>e.camera.zoomIn(),iconPath:"M48 20h-18v-18h-10v18h-18v10h18v18h10v-18h18z"},{onClick:()=>e.camera.zoomOut(),iconPath:"M2 20h46v10h-46z"}];return i.jsx("div",{className:"zoomButtons",children:t.map((n,r)=>i.jsx(J.Icon,{icon:i.jsx("div",{className:"zoomButton",children:i.jsx("svg",{fill:"var(--mdc-theme-cesium-color)",width:"12px",height:"12px",viewBox:"0 -20 50 50",version:"1.2",baseProfile:"tiny",xmlns:"http://www.w3.org/2000/svg",overflow:"inherit",children:i.jsx("path",{d:n.iconPath})})}),onClick:n.onClick},r))})},Os="",An=(e,t)=>{const r=$.get(t.scene.globe,"_surface.tileProvider"),s=r._quadtree,o=t.canvas.height,d=$.get(t.camera.frustum,"sseDenominator")??1;for(let h=0;h<=19;h++)if(r.getLevelMaximumGeometricError(h)*o/(e*d)<s.maximumScreenSpaceError)return h;return null},uo=(e,t)=>{e=e||10;const n=[];let r=1e5,s=0;for(let o=1e8;o>r;o=o-r){const d=An(o,t);if(d===null)break;if(d!==s){let h=o,f=o+r;for(;f-h>e;)o=h+(f-h)/2,An(o,t)===d?h=o:f=o;n.push({level:d,height:Math.round(o)}),s=d,n.length>=2&&(r=(n[n.length-2].height-o)/1e3)}}return n},Dn=({locale:e=void 0,valueBy:t="RENDERED_TILES"})=>{const n=pe(),r=Fe(),[s,o]=a.useState(1),d=uo(1,n),h=a.useCallback(()=>{const b=n.camera,p=.5;let v=0;switch(n.scene.mode){case tt.SCENE3D:v=n.scene.mapProjection.ellipsoid.cartesianToCartographic(b.positionWC).height;break;case tt.SCENE2D:v=(b.frustum.right-b.frustum.left)*p;break;case tt.COLUMBUS_VIEW:v=b.position.z;break;default:v=0;break}if(d.length>0){const I=d.reduce((T,F)=>Math.abs(F.height-v)<Math.abs(T.height-v)?F:T);o(I.level),r.setViewState&&r.setViewState(T=>({...T,currentZoomLevel:I.level}))}},[n,d]),f=a.useCallback(()=>{let b=0;n.scene.globe._surface.forEachRenderedTile(function(p){b=Math.max(b,p.level)}),o(b),r.setViewState&&r.setViewState(p=>({...p,currentZoomLevel:b}))},[n]),C=a.useMemo(()=>({CALCULATION:h,RENDERED_TILES:f}),[h,f])[t];return a.useEffect(()=>{const b=n.scene.globe.tileLoadProgressEvent.addEventListener(function(){n.scene.globe.tilesLoaded&&C()});return n.camera.moveEnd.addEventListener(C),()=>{try{typeof $.get(n,"_cesiumWidget")<"u"&&(n.camera.moveEnd.removeEventListener(C),b())}catch(p){console.log('CESIUM camera "moveEnd"(from zoom tracker) remove listener failed',p)}}},[n,C]),i.jsxs("div",{className:"zoomLevel",children:[i.jsx("div",{className:"zoomLevelValue",children:s}),i.jsx("div",{className:"zoomLevelLabel",children:$.get(e,"ZOOM_LABEL")??"zoom"})]})},ks="",On=2,kn=212,xn=260,ho=0;class go extends g.Viewer{constructor(n,r){super(n,r);ue(this,"layersManager")}}const St=a.createContext(null),po=St.Provider,pe=()=>{const e=a.useContext(St);if(e===null)throw new Error("map context is null, please check the provider");return e.mapViewer},Fe=()=>{const{mapViewer:e,...t}=a.useContext(St);if(t===null)throw new Error("map context viewstate is null, please check the provider");return t},fo=e=>{var me,ye,Ie,Ge,We,jn,Yn,Zn;const t=a.useRef(null),[n,r]=a.useState(),[s,o]=a.useState(),[d,h]=a.useState(),[f,E]=a.useState(),[C,b]=a.useState(),[p,v]=a.useState(),[I,T]=a.useState(),[F,V]=a.useState(),[j,Y]=a.useState(),[G,X]=a.useState(),[W,Z]=a.useState(!1),[ee,l]=a.useState(!1),c=a.useRef(),[_,y]=a.useState([]),[S,w]=a.useState(),[P,m]=a.useState(),[L,k]=a.useState(!1),N=a.useRef(),[A,O]=a.useState(void 0),[B,te]=a.useState(!1),[ne,q]=a.useState(),[R,ie]=a.useState(),ge=J.useTheme(),ve=zt(ge),oe=a.useMemo(()=>W||ee,[W,ee]);a.useEffect(()=>{ie({currentZoomLevel:-1,shouldOptimizedTileRequests:e.useOptimizedTileRequests??!1})},[]);const fe={fullscreenButton:!0,timeline:!1,animation:!1,baseLayerPicker:!1,geocoder:!1,navigationHelpButton:!1,homeButton:$.isNumber(e.zoom)&&$.isArray(e.center),sceneModePicker:!0,imageryProvider:!1,...e},D=(se,de,le,Ee,Ce)=>{const De=n.container,Ae=De.clientWidth,ze=De.clientHeight,Xn=Ee+Ce;return{left:`${Ae-se<le?se-(le-(Ae-se)):se}px`,top:`${ze-de<Xn?de-(Xn-(ze-de)):de}px`}},x=a.useCallback(se=>{if(t.current!==null){const de=t.current.cesiumElement,le={x:se.offsetX,y:se.offsetY};k(!1),O(le),q(Tn(de,le.x,le.y)),k(!0),N.current=se}},[t]);a.useEffect(()=>{var se;if(t.current!==null){const de=t.current.cesiumElement;e.imageryContextMenu&&(de.scene.canvas.removeEventListener("contextmenu",x),de.scene.canvas.addEventListener("contextmenu",x))}r((se=t.current)==null?void 0:se.cesiumElement)},[t,e.imageryContextMenu]);const H=a.useMemo(()=>{var se;if(n)return{mapViewer:n.layersManager?n:Object.assign(n,{layersManager:new io(n,(se=e.legends)==null?void 0:se.mapLegendsExtractor,()=>{var le;y((le=n.layersManager)==null?void 0:le.legendsList)},e.layerManagerFootprintMetaFieldPath,R==null?void 0:R.shouldOptimizedTileRequests)}),viewState:R,setViewState:ie}},[e.useOptimizedTileRequests,e.legends,e.layerManagerFootprintMetaFieldPath,n,R]);a.useEffect(()=>{var de,le;w(e.baseMaps);const se=(de=e.baseMaps)==null?void 0:de.maps.find(Ee=>Ee.isCurrent);se&&n&&((le=n.layersManager)==null||le.setBaseMapLayers(se))},[e.baseMaps,n]),a.useEffect(()=>{const se=e.terrains||(n&&n.terrainProvider?[{id:"1",url:eo,title:"Default Terrain",thumbnail:"Cesium/Widgets/Images/TerrainProviders/Ellipsoid.png",isCurrent:!0,terrainProvider:n.terrainProvider}]:void 0);m(se)},[e.terrains,n]),a.useEffect(()=>{h(e.projection??be.WGS84)},[e.projection]),a.useEffect(()=>{o(e.locale)},[e.locale]),a.useEffect(()=>{E(e.showMousePosition??!0)},[e.showMousePosition]),a.useEffect(()=>{b(e.showZoomLevel??!0)},[e.showZoomLevel]),a.useEffect(()=>{v(e.showScale??!0)},[e.showScale]),a.useEffect(()=>{T(e.showCompass??!0)},[e.showCompass]),a.useEffect(()=>{X(e.showLoadingProgress??!0)},[e.showLoadingProgress]),a.useEffect(()=>{Y(e.showActiveLayersTool??!0)},[e.showActiveLayersTool]),a.useEffect(()=>{var de;const se=()=>{if(n===void 0)return{longitude:0,latitude:0,height:0};const le=()=>{const Ee=n.camera.positionCartographic;return{longitude:Re(Ee.longitude),latitude:Re(Ee.latitude),height:Ee.height}};if(n.scene.mode===g.SceneMode.SCENE3D){const Ee=new g.Cartesian2(n.container.clientWidth/On,n.container.clientHeight/On),Ce=n.scene.camera.getPickRay(Ee),De=n.scene.globe.pick(Ce,n.scene);if(!De)return{longitude:0,latitude:0,height:0};const Ae=n.scene.globe.ellipsoid.cartesianToCartographic(De);return Ae!==void 0?{longitude:Re(Ae.longitude),latitude:Re(Ae.latitude),height:n.scene.camera.positionCartographic.height}:le()}else return le()};n&&(n.camera.moveEnd.addEventListener(()=>{if(n.scene.mode!==g.SceneMode.MORPHING){const le=n.camera,Ee={position:se(),direction:le.direction.clone(),up:le.up.clone(),right:le.right.clone(),transform:le.transform.clone(),frustum:le.frustum.clone()};c.current=Ee}}),G&&(n.scene.globe.tileLoadProgressEvent.addEventListener(function(){n.scene.globe.tilesLoaded?Z(!1):Z(!0)}),(de=n.layersManager)==null||de.addDataLayerUpdatedListener(()=>{var Ee;let le=!1;(Ee=n.layersManager)==null||Ee.dataLayerList.forEach(Ce=>{if(typeof Ce.meta.items=="number"&&typeof Ce.meta.total=="number"&&Ce.meta.items>0&&Ce.meta.items<Ce.meta.total){le=!0;return}}),l(le)})))},[n]),a.useEffect(()=>{const se=()=>{if(n&&c.current){const de=c.current;n.camera.flyTo({destination:g.Cartesian3.fromDegrees(de.position.longitude,de.position.latitude,de.position.height),duration:0})}};return n&&n.scene.morphComplete.addEventListener(se),()=>{if(n)try{n.scene.morphComplete.removeEventListener(se)}catch{console.error("morphCompleteHandler event not cleaned")}}},[n]),a.useEffect(()=>{const se=e.zoom,de=e.center;if(n&&$.isNumber(se)&&$.isArray(de)){const le=de[0],Ee=de[1],Ce=gi(se);n.camera.flyTo({destination:g.Cartesian3.fromDegrees(le,Ee,Ce),duration:0});const De=n.homeButton.viewModel.command,Ae=function(ze){n.camera.flyTo({destination:g.Cartesian3.fromDegrees(le,Ee,Ce),duration:1}),ze.cancel=!0};return De.beforeExecute.addEventListener(Ae),()=>{De.beforeExecute.removeEventListener(Ae);try{De.beforeExecute.removeEventListener(Ae)}catch{console.error("customHomeButtonHandler event not cleaned")}}}},[e.zoom,e.center,n]),a.useEffect(()=>{V(e.showZoomButtons??!0)},[e.showZoomButtons]);const z=()=>{te(se=>!se)},U=a.useCallback(()=>n&&ut.createPortal(i.jsxs(i.Fragment,{children:[G&&oe&&i.jsx(J.LinearProgress,{style:{position:"absolute",top:0,height:"10px",zIndex:4}}),I&&i.jsx(Mn,{locale:s}),i.jsxs(Q,{className:"bottomToolsContainer",children:[f&&i.jsx(_n,{projection:d}),C&&i.jsx(Dn,{locale:s,valueBy:"RENDERED_TILES"}),p&&i.jsx(Pn,{locale:s})]}),F&&i.jsx(In,{})]}),document.querySelector(".cesium-viewer")),[n,s,d,f,p,oe]),K=a.useCallback(()=>n&&ut.createPortal(i.jsxs(i.Fragment,{children:[e.geocoderPanel&&i.jsx(Qi,{options:[...e.geocoderPanel],locale:s}),i.jsx(wi,{baseMaps:S,terrains:P,locale:s}),e.showDebuggerTool&&i.jsx(Li,{locale:s}),i.jsx(lo,{legendToggle:z})]}),document.querySelector(".cesium-viewer-toolbar")),[n,s,S,P]),ce=a.useCallback(()=>n&&ut.createPortal(i.jsx(Q,{className:"cesium-viewer-cesiumInspectorContainer widgetsContainer",children:j&&i.jsx(yi,{locale:s})}),document.querySelector(".cesium-widget")),[n,s]);return i.jsx(J.ThemeProvider,{id:"cesiumTheme",options:ve,children:i.jsx(Me.Viewer,{className:"viewer",full:!0,ref:t,...fe,children:i.jsxs(po,{value:H,children:[i.jsx(ao,{title:(me=e.legends)==null?void 0:me.title,isOpen:B,toggleSidebar:z,noLegendsText:(ye=e.legends)==null?void 0:ye.emptyText,legends:((Ie=e.legends)==null?void 0:Ie.legendsList)??_,actionsTexts:(Ge=e.legends)==null?void 0:Ge.actionsTexts}),e.children,U(),K(),ce(),e.imageryContextMenu&&L&&A&&ne&&a.cloneElement(e.imageryContextMenu,{data:(We=n==null?void 0:n.layersManager)==null?void 0:We.findLayerByPOI(A.x,A.y,!1),position:{x:A.x,y:A.y},coordinates:ne,style:D(A.x,A.y,((jn=e.imageryContextMenuSize)==null?void 0:jn.width)??xn,((Yn=e.imageryContextMenuSize)==null?void 0:Yn.height)??kn,((Zn=e.imageryContextMenuSize)==null?void 0:Zn.dynamicHeightIncrement)??ho),size:e.imageryContextMenuSize??{height:kn,width:xn},handleClose:()=>{k(!L)},contextEvt:N.current})]})})})},mo=0,yo=e=>{const t=pe();return i.jsx(Me.Cesium3DTileset,{...e,onReady:n=>{e.isZoomTo===!0&&t.zoomTo(n);const r=t.scene;r.globe.depthTestAgainstTerrain=!0;const s=g.Cartographic.fromCartesian(n.boundingSphere.center),o=e.heightFromGround??mo;if(o){const d=g.Cartesian3.fromRadians(s.longitude,s.latitude,s.height),h=g.Cartesian3.fromRadians(s.longitude,s.latitude,s.height+o),f=g.Cartesian3.subtract(h,d,new g.Cartesian3);n.modelMatrix=g.Matrix4.fromTranslation(f)}}})},ot=180,Nn=.001,Bn=e=>Math.abs(e)/e,Fn=e=>{ot-Math.abs(e[0])<Nn&&(e[0]=Bn(e[0])*(ot-1)),ot/2-Math.abs(e[1])<Nn&&(e[1]=Bn(e[1])*(ot/2-1))},Gn=e=>{switch(e.type){case"LineString":e.coordinates.forEach(t=>{Fn(t)});break;case"Polygon":e.coordinates.forEach(t=>{t.forEach(n=>{Fn(n)})});break}},vo=e=>{const{data:t,...n}=e,r=$.cloneDeep(t);return r&&(typeof r.features<"u"?r.features.forEach(s=>{Gn(s.geometry)}):Gn(r)),i.jsx(Me.GeoJsonDataSource,{data:r,...n})},He=e=>{const{meta:t,...n}=e,r=pe();return a.useLayoutEffect(()=>{var s;(s=r.layersManager)==null||s.addMetaToLayer(t,t.searchLayerPredicate)},[t,r]),i.jsx(Me.ImageryLayer,{...n})},Eo=e=>{const{options:t,...n}=e,r=pe(),{viewState:s}=Fe(),o=a.useMemo(()=>s.shouldOptimizedTileRequests?new Sn(t,r):new g.WebMapServiceImageryProvider(t),[s.shouldOptimizedTileRequests]);return i.jsx(He,{...n,imageryProvider:o})},wo=e=>{const{options:t,...n}=e,r=pe(),{viewState:s}=Fe(),o=a.useMemo(()=>s.shouldOptimizedTileRequests?new bn(t,r):new g.WebMapTileServiceImageryProvider(t),[s.shouldOptimizedTileRequests]);return i.jsx(He,{...n,imageryProvider:o})},To=e=>{const{options:t,...n}=e,r=pe(),{viewState:s}=Fe(),o=a.useMemo(()=>s.shouldOptimizedTileRequests?new Ln(t,r):new g.UrlTemplateImageryProvider(t),[s.shouldOptimizedTileRequests]);return i.jsx(He,{...n,imageryProvider:o})},Lo=e=>{const{options:t,...n}=e;return i.jsx(He,{...n,imageryProvider:new g.OpenStreetMapImageryProvider(t)})},So=e=>{const{options:t,meta:n,visualizationHandler:r,withGeometryValidation:s=!1}=e,{url:o,featureType:d,style:h,pageSize:f,zoomLevel:E,maxCacheSize:C,keyField:b,labeling:p}=t,{color:v,hover:I}=h,T=pe(),F=Fe(),V=a.useRef(F.viewState),j=a.useRef(new Map),Y=a.useRef(new Set),G=a.useRef(0),[X,W]=a.useState(n),Z=a.useMemo(()=>g.Color.fromCssColorString(I??"#24AEE9").withAlpha(.5),[I]),ee=a.useMemo(()=>`wfs_${d}_${Bt.v4()}`,[d]),l=a.useRef(!1);a.useEffect(()=>{V.current=F.viewState},[F.viewState]);const c=new g.GeoJsonDataSource(ee),_=D=>{const x=[],H=n.featureStructure;if(H&&H.fields)for(const U of H.fields){const{fieldName:K,aliasFieldName:ce}=U,me=ce,ye=D[K]??"N/A",Ie=Math.max(100,Math.min(180,me.length*10)),Ge="260px";x.push(`
7
7
  <tr>
8
8
  <td style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: ${Ie}px; display: table-cell;">
@@ -1,9 +1,9 @@
1
1
  import React from 'react';
2
- import { Geometry } from 'geojson';
2
+ import { Feature, Geometry } from 'geojson';
3
3
  import { FitOptions } from 'ol/View';
4
4
  import { Style } from 'ol/style';
5
5
  export interface FeatureProps {
6
- geometry: Geometry;
6
+ geometry: Geometry | Feature;
7
7
  fitOptions?: FitOptions;
8
8
  fit?: boolean;
9
9
  featureStyle?: Style;
@@ -1,4 +1,9 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
2
  import { Vector } from 'ol/layer';
3
+ import { Options } from 'ol/layer/Base';
4
+ interface VectorLayerProps {
5
+ options?: Options;
6
+ }
3
7
  export declare const useVectorLayer: () => Vector<any>;
4
- export declare const VectorLayer: React.FC<PropsWithChildren>;
8
+ export declare const VectorLayer: React.FC<PropsWithChildren<VectorLayerProps>>;
9
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@map-colonies/react-components",
3
- "version": "4.13.3",
3
+ "version": "4.13.5",
4
4
  "main": "./dist/@map-colonies/react-components.umd.js",
5
5
  "module": "./dist/@map-colonies/react-components.es.js",
6
6
  "types": "./dist/index.d.ts",
@@ -87,5 +87,5 @@
87
87
  "files": [
88
88
  "dist"
89
89
  ],
90
- "gitHead": "ca1537313869391ce27ae3bbacc19cfda4ba1c0b"
90
+ "gitHead": "7b59e4a26949588febe4e6ced814260ecdc7bf14"
91
91
  }