UNPKG

agviewermap-react

Version:

A tool designed to visualize geospatial data on a map, integrating custom layers fetched from a REST API, and displaying relevant time-series data. This project is built using React, with `react-map-gl` for map integration.

1,488 lines (1,481 loc) 3.36 MB
var XV = Object.defineProperty; var ZV = (e, t, n) => t in e ? XV(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n; var xI = (e, t, n) => ZV(e, typeof t != "symbol" ? t + "" : t, n); import * as ae from "react"; import Te, { useState as Ct, useEffect as Nt, createContext as ci, useContext as bn, useRef as Vn, useMemo as Yn, useLayoutEffect as kb, useImperativeHandle as Db, memo as Uu, forwardRef as ds, cloneElement as yi, createElement as xm, useCallback as nn, Component as XC, Fragment as i2, lazy as FL, Suspense as zL, isValidElement as Na, useReducer as YV, Children as Ou, PureComponent as Tl } from "react"; import * as ZC from "react-dom"; import mg, { createPortal as YC } from "react-dom"; function qV(e, t) { for (var n = 0; n < t.length; n++) { const r = t[n]; if (typeof r != "string" && !Array.isArray(r)) { for (const i in r) if (i !== "default" && !(i in e)) { const a = Object.getOwnPropertyDescriptor(r, i); a && Object.defineProperty(e, i, a.get ? a : { enumerable: !0, get: () => r[i] }); } } } return Object.freeze(Object.defineProperty(e, Symbol.toStringTag, { value: "Module" })); } var Au = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}; function lr(e) { return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e; } var a2 = { exports: {} }, Pp = {}; /** * @license React * react-jsx-runtime.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var _I; function JV() { if (_I) return Pp; _I = 1; var e = Te, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, i = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, a = { key: !0, ref: !0, __self: !0, __source: !0 }; function o(s, h, f) { var g, m = {}, v = null, b = null; f !== void 0 && (v = "" + f), h.key !== void 0 && (v = "" + h.key), h.ref !== void 0 && (b = h.ref); for (g in h) r.call(h, g) && !a.hasOwnProperty(g) && (m[g] = h[g]); if (s && s.defaultProps) for (g in h = s.defaultProps, h) m[g] === void 0 && (m[g] = h[g]); return { $$typeof: t, type: s, key: v, ref: b, props: m, _owner: i.current }; } return Pp.Fragment = n, Pp.jsx = o, Pp.jsxs = o, Pp; } var Op = {}; /** * @license React * react-jsx-runtime.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var wI; function KV() { return wI || (wI = 1, process.env.NODE_ENV !== "production" && function() { var e = Te, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), r = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), a = Symbol.for("react.profiler"), o = Symbol.for("react.provider"), s = Symbol.for("react.context"), h = Symbol.for("react.forward_ref"), f = Symbol.for("react.suspense"), g = Symbol.for("react.suspense_list"), m = Symbol.for("react.memo"), v = Symbol.for("react.lazy"), b = Symbol.for("react.offscreen"), w = Symbol.iterator, C = "@@iterator"; function M(Xe) { if (Xe === null || typeof Xe != "object") return null; var Et = w && Xe[w] || Xe[C]; return typeof Et == "function" ? Et : null; } var E = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function A(Xe) { { for (var Et = arguments.length, Ot = new Array(Et > 1 ? Et - 1 : 0), Zt = 1; Zt < Et; Zt++) Ot[Zt - 1] = arguments[Zt]; P("error", Xe, Ot); } } function P(Xe, Et, Ot) { { var Zt = E.ReactDebugCurrentFrame, sn = Zt.getStackAddendum(); sn !== "" && (Et += "%s", Ot = Ot.concat([sn])); var En = Ot.map(function(xn) { return String(xn); }); En.unshift("Warning: " + Et), Function.prototype.apply.call(console[Xe], console, En); } } var R = !1, I = !1, N = !1, F = !1, Y = !1, K; K = Symbol.for("react.module.reference"); function ee(Xe) { return !!(typeof Xe == "string" || typeof Xe == "function" || Xe === r || Xe === a || Y || Xe === i || Xe === f || Xe === g || F || Xe === b || R || I || N || typeof Xe == "object" && Xe !== null && (Xe.$$typeof === v || Xe.$$typeof === m || Xe.$$typeof === o || Xe.$$typeof === s || Xe.$$typeof === h || // This needs to include all possible module reference object // types supported by any Flight configuration anywhere since // we don't know which Flight build this will end up being used // with. Xe.$$typeof === K || Xe.getModuleId !== void 0)); } function z(Xe, Et, Ot) { var Zt = Xe.displayName; if (Zt) return Zt; var sn = Et.displayName || Et.name || ""; return sn !== "" ? Ot + "(" + sn + ")" : Ot; } function W(Xe) { return Xe.displayName || "Context"; } function G(Xe) { if (Xe == null) return null; if (typeof Xe.tag == "number" && A("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof Xe == "function") return Xe.displayName || Xe.name || null; if (typeof Xe == "string") return Xe; switch (Xe) { case r: return "Fragment"; case n: return "Portal"; case a: return "Profiler"; case i: return "StrictMode"; case f: return "Suspense"; case g: return "SuspenseList"; } if (typeof Xe == "object") switch (Xe.$$typeof) { case s: var Et = Xe; return W(Et) + ".Consumer"; case o: var Ot = Xe; return W(Ot._context) + ".Provider"; case h: return z(Xe, Xe.render, "ForwardRef"); case m: var Zt = Xe.displayName || null; return Zt !== null ? Zt : G(Xe.type) || "Memo"; case v: { var sn = Xe, En = sn._payload, xn = sn._init; try { return G(xn(En)); } catch { return null; } } } return null; } var L = Object.assign, j = 0, Z, Q, te, re, q, de, Se; function le() { } le.__reactDisabledLog = !0; function fe() { { if (j === 0) { Z = console.log, Q = console.info, te = console.warn, re = console.error, q = console.group, de = console.groupCollapsed, Se = console.groupEnd; var Xe = { configurable: !0, enumerable: !0, value: le, writable: !0 }; Object.defineProperties(console, { info: Xe, log: Xe, warn: Xe, error: Xe, group: Xe, groupCollapsed: Xe, groupEnd: Xe }); } j++; } } function ge() { { if (j--, j === 0) { var Xe = { configurable: !0, enumerable: !0, writable: !0 }; Object.defineProperties(console, { log: L({}, Xe, { value: Z }), info: L({}, Xe, { value: Q }), warn: L({}, Xe, { value: te }), error: L({}, Xe, { value: re }), group: L({}, Xe, { value: q }), groupCollapsed: L({}, Xe, { value: de }), groupEnd: L({}, Xe, { value: Se }) }); } j < 0 && A("disabledDepth fell below zero. This is a bug in React. Please file an issue."); } } var ye = E.ReactCurrentDispatcher, ke; function se(Xe, Et, Ot) { { if (ke === void 0) try { throw Error(); } catch (sn) { var Zt = sn.stack.trim().match(/\n( *(at )?)/); ke = Zt && Zt[1] || ""; } return ` ` + ke + Xe; } } var J = !1, ue; { var Ce = typeof WeakMap == "function" ? WeakMap : Map; ue = new Ce(); } function H(Xe, Et) { if (!Xe || J) return ""; { var Ot = ue.get(Xe); if (Ot !== void 0) return Ot; } var Zt; J = !0; var sn = Error.prepareStackTrace; Error.prepareStackTrace = void 0; var En; En = ye.current, ye.current = null, fe(); try { if (Et) { var xn = function() { throw Error(); }; if (Object.defineProperty(xn.prototype, "props", { set: function() { throw Error(); } }), typeof Reflect == "object" && Reflect.construct) { try { Reflect.construct(xn, []); } catch (Ln) { Zt = Ln; } Reflect.construct(Xe, [], xn); } else { try { xn.call(); } catch (Ln) { Zt = Ln; } Xe.call(xn.prototype); } } else { try { throw Error(); } catch (Ln) { Zt = Ln; } Xe(); } } catch (Ln) { if (Ln && Zt && typeof Ln.stack == "string") { for (var Yt = Ln.stack.split(` `), Pn = Zt.stack.split(` `), On = Yt.length - 1, Bn = Pn.length - 1; On >= 1 && Bn >= 0 && Yt[On] !== Pn[Bn]; ) Bn--; for (; On >= 1 && Bn >= 0; On--, Bn--) if (Yt[On] !== Pn[Bn]) { if (On !== 1 || Bn !== 1) do if (On--, Bn--, Bn < 0 || Yt[On] !== Pn[Bn]) { var cr = ` ` + Yt[On].replace(" at new ", " at "); return Xe.displayName && cr.includes("<anonymous>") && (cr = cr.replace("<anonymous>", Xe.displayName)), typeof Xe == "function" && ue.set(Xe, cr), cr; } while (On >= 1 && Bn >= 0); break; } } } finally { J = !1, ye.current = En, ge(), Error.prepareStackTrace = sn; } var Xr = Xe ? Xe.displayName || Xe.name : "", Hi = Xr ? se(Xr) : ""; return typeof Xe == "function" && ue.set(Xe, Hi), Hi; } function he(Xe, Et, Ot) { return H(Xe, !1); } function oe(Xe) { var Et = Xe.prototype; return !!(Et && Et.isReactComponent); } function xe(Xe, Et, Ot) { if (Xe == null) return ""; if (typeof Xe == "function") return H(Xe, oe(Xe)); if (typeof Xe == "string") return se(Xe); switch (Xe) { case f: return se("Suspense"); case g: return se("SuspenseList"); } if (typeof Xe == "object") switch (Xe.$$typeof) { case h: return he(Xe.render); case m: return xe(Xe.type, Et, Ot); case v: { var Zt = Xe, sn = Zt._payload, En = Zt._init; try { return xe(En(sn), Et, Ot); } catch { } } } return ""; } var ce = Object.prototype.hasOwnProperty, De = {}, je = E.ReactDebugCurrentFrame; function Be(Xe) { if (Xe) { var Et = Xe._owner, Ot = xe(Xe.type, Xe._source, Et ? Et.type : null); je.setExtraStackFrame(Ot); } else je.setExtraStackFrame(null); } function He(Xe, Et, Ot, Zt, sn) { { var En = Function.call.bind(ce); for (var xn in Xe) if (En(Xe, xn)) { var Yt = void 0; try { if (typeof Xe[xn] != "function") { var Pn = Error((Zt || "React class") + ": " + Ot + " type `" + xn + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof Xe[xn] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`."); throw Pn.name = "Invariant Violation", Pn; } Yt = Xe[xn](Et, xn, Zt, Ot, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"); } catch (On) { Yt = On; } Yt && !(Yt instanceof Error) && (Be(sn), A("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", Zt || "React class", Ot, xn, typeof Yt), Be(null)), Yt instanceof Error && !(Yt.message in De) && (De[Yt.message] = !0, Be(sn), A("Failed %s type: %s", Ot, Yt.message), Be(null)); } } } var lt = Array.isArray; function at(Xe) { return lt(Xe); } function Re(Xe) { { var Et = typeof Symbol == "function" && Symbol.toStringTag, Ot = Et && Xe[Symbol.toStringTag] || Xe.constructor.name || "Object"; return Ot; } } function Ie(Xe) { try { return Le(Xe), !1; } catch { return !0; } } function Le(Xe) { return "" + Xe; } function Ve(Xe) { if (Ie(Xe)) return A("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Re(Xe)), Le(Xe); } var Ke = E.ReactCurrentOwner, Ge = { key: !0, ref: !0, __self: !0, __source: !0 }, rt, ct; function ft(Xe) { if (ce.call(Xe, "ref")) { var Et = Object.getOwnPropertyDescriptor(Xe, "ref").get; if (Et && Et.isReactWarning) return !1; } return Xe.ref !== void 0; } function xt(Xe) { if (ce.call(Xe, "key")) { var Et = Object.getOwnPropertyDescriptor(Xe, "key").get; if (Et && Et.isReactWarning) return !1; } return Xe.key !== void 0; } function it(Xe, Et) { typeof Xe.ref == "string" && Ke.current; } function vt(Xe, Et) { { var Ot = function() { rt || (rt = !0, A("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", Et)); }; Ot.isReactWarning = !0, Object.defineProperty(Xe, "key", { get: Ot, configurable: !0 }); } } function St(Xe, Et) { { var Ot = function() { ct || (ct = !0, A("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)", Et)); }; Ot.isReactWarning = !0, Object.defineProperty(Xe, "ref", { get: Ot, configurable: !0 }); } } var Rt = function(Xe, Et, Ot, Zt, sn, En, xn) { var Yt = { // This tag allows us to uniquely identify this as a React Element $$typeof: t, // Built-in properties that belong on the element type: Xe, key: Et, ref: Ot, props: xn, // Record the component responsible for creating this element. _owner: En }; return Yt._store = {}, Object.defineProperty(Yt._store, "validated", { configurable: !1, enumerable: !1, writable: !0, value: !1 }), Object.defineProperty(Yt, "_self", { configurable: !1, enumerable: !1, writable: !1, value: Zt }), Object.defineProperty(Yt, "_source", { configurable: !1, enumerable: !1, writable: !1, value: sn }), Object.freeze && (Object.freeze(Yt.props), Object.freeze(Yt)), Yt; }; function Dt(Xe, Et, Ot, Zt, sn) { { var En, xn = {}, Yt = null, Pn = null; Ot !== void 0 && (Ve(Ot), Yt = "" + Ot), xt(Et) && (Ve(Et.key), Yt = "" + Et.key), ft(Et) && (Pn = Et.ref, it(Et, sn)); for (En in Et) ce.call(Et, En) && !Ge.hasOwnProperty(En) && (xn[En] = Et[En]); if (Xe && Xe.defaultProps) { var On = Xe.defaultProps; for (En in On) xn[En] === void 0 && (xn[En] = On[En]); } if (Yt || Pn) { var Bn = typeof Xe == "function" ? Xe.displayName || Xe.name || "Unknown" : Xe; Yt && vt(xn, Bn), Pn && St(xn, Bn); } return Rt(Xe, Yt, Pn, sn, Zt, Ke.current, xn); } } var _t = E.ReactCurrentOwner, jt = E.ReactDebugCurrentFrame; function Ft(Xe) { if (Xe) { var Et = Xe._owner, Ot = xe(Xe.type, Xe._source, Et ? Et.type : null); jt.setExtraStackFrame(Ot); } else jt.setExtraStackFrame(null); } var Gt; Gt = !1; function Sn(Xe) { return typeof Xe == "object" && Xe !== null && Xe.$$typeof === t; } function We() { { if (_t.current) { var Xe = G(_t.current.type); if (Xe) return ` Check the render method of \`` + Xe + "`."; } return ""; } } function Ee(Xe) { return ""; } var be = {}; function Pe(Xe) { { var Et = We(); if (!Et) { var Ot = typeof Xe == "string" ? Xe : Xe.displayName || Xe.name; Ot && (Et = ` Check the top-level render call using <` + Ot + ">."); } return Et; } } function $e(Xe, Et) { { if (!Xe._store || Xe._store.validated || Xe.key != null) return; Xe._store.validated = !0; var Ot = Pe(Et); if (be[Ot]) return; be[Ot] = !0; var Zt = ""; Xe && Xe._owner && Xe._owner !== _t.current && (Zt = " It was passed a child from " + G(Xe._owner.type) + "."), Ft(Xe), A('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', Ot, Zt), Ft(null); } } function tt(Xe, Et) { { if (typeof Xe != "object") return; if (at(Xe)) for (var Ot = 0; Ot < Xe.length; Ot++) { var Zt = Xe[Ot]; Sn(Zt) && $e(Zt, Et); } else if (Sn(Xe)) Xe._store && (Xe._store.validated = !0); else if (Xe) { var sn = M(Xe); if (typeof sn == "function" && sn !== Xe.entries) for (var En = sn.call(Xe), xn; !(xn = En.next()).done; ) Sn(xn.value) && $e(xn.value, Et); } } } function ot(Xe) { { var Et = Xe.type; if (Et == null || typeof Et == "string") return; var Ot; if (typeof Et == "function") Ot = Et.propTypes; else if (typeof Et == "object" && (Et.$$typeof === h || // Note: Memo only checks outer props here. // Inner props are checked in the reconciler. Et.$$typeof === m)) Ot = Et.propTypes; else return; if (Ot) { var Zt = G(Et); He(Ot, Xe.props, "prop", Zt, Xe); } else if (Et.PropTypes !== void 0 && !Gt) { Gt = !0; var sn = G(Et); A("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", sn || "Unknown"); } typeof Et.getDefaultProps == "function" && !Et.getDefaultProps.isReactClassApproved && A("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead."); } } function ht(Xe) { { for (var Et = Object.keys(Xe.props), Ot = 0; Ot < Et.length; Ot++) { var Zt = Et[Ot]; if (Zt !== "children" && Zt !== "key") { Ft(Xe), A("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", Zt), Ft(null); break; } } Xe.ref !== null && (Ft(Xe), A("Invalid attribute `ref` supplied to `React.Fragment`."), Ft(null)); } } var Je = {}; function yt(Xe, Et, Ot, Zt, sn, En) { { var xn = ee(Xe); if (!xn) { var Yt = ""; (Xe === void 0 || typeof Xe == "object" && Xe !== null && Object.keys(Xe).length === 0) && (Yt += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."); var Pn = Ee(); Pn ? Yt += Pn : Yt += We(); var On; Xe === null ? On = "null" : at(Xe) ? On = "array" : Xe !== void 0 && Xe.$$typeof === t ? (On = "<" + (G(Xe.type) || "Unknown") + " />", Yt = " Did you accidentally export a JSX literal instead of a component?") : On = typeof Xe, A("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", On, Yt); } var Bn = Dt(Xe, Et, Ot, sn, En); if (Bn == null) return Bn; if (xn) { var cr = Et.children; if (cr !== void 0) if (Zt) if (at(cr)) { for (var Xr = 0; Xr < cr.length; Xr++) tt(cr[Xr], Xe); Object.freeze && Object.freeze(cr); } else A("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."); else tt(cr, Xe); } if (ce.call(Et, "key")) { var Hi = G(Xe), Ln = Object.keys(Et).filter(function(Oi) { return Oi !== "key"; }), Go = Ln.length > 0 ? "{key: someKey, " + Ln.join(": ..., ") + ": ...}" : "{key: someKey}"; if (!Je[Hi + Go]) { var jc = Ln.length > 0 ? "{" + Ln.join(": ..., ") + ": ...}" : "{}"; A(`A props object containing a "key" prop is being spread into JSX: let props = %s; <%s {...props} /> React keys must be passed directly to JSX without using spread: let props = %s; <%s key={someKey} {...props} />`, Go, Hi, jc, Hi), Je[Hi + Go] = !0; } } return Xe === r ? ht(Bn) : ot(Bn), Bn; } } function At(Xe, Et, Ot) { return yt(Xe, Et, Ot, !0); } function wt(Xe, Et, Ot) { return yt(Xe, Et, Ot, !1); } var Vt = wt, un = At; Op.Fragment = r, Op.jsx = Vt, Op.jsxs = un; }()), Op; } process.env.NODE_ENV === "production" ? a2.exports = JV() : a2.exports = KV(); var B = a2.exports; const SI = (e) => { let t; const n = /* @__PURE__ */ new Set(), r = (g, m) => { const v = typeof g == "function" ? g(t) : g; if (!Object.is(v, t)) { const b = t; t = m ?? (typeof v != "object" || v === null) ? v : Object.assign({}, t, v), n.forEach((w) => w(t, b)); } }, i = () => t, h = { setState: r, getState: i, getInitialState: () => f, subscribe: (g) => (n.add(g), () => n.delete(g)), destroy: () => { n.clear(); } }, f = t = e(r, i, h); return h; }, QV = (e) => e ? SI(e) : SI; var s2 = { exports: {} }, E1 = {}, ev = { exports: {} }, A1 = {}; /** * @license React * use-sync-external-store-shim.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var CI; function eG() { if (CI) return A1; CI = 1; var e = Te; function t(m, v) { return m === v && (m !== 0 || 1 / m === 1 / v) || m !== m && v !== v; } var n = typeof Object.is == "function" ? Object.is : t, r = e.useState, i = e.useEffect, a = e.useLayoutEffect, o = e.useDebugValue; function s(m, v) { var b = v(), w = r({ inst: { value: b, getSnapshot: v } }), C = w[0].inst, M = w[1]; return a(function() { C.value = b, C.getSnapshot = v, h(C) && M({ inst: C }); }, [m, b, v]), i(function() { return h(C) && M({ inst: C }), m(function() { h(C) && M({ inst: C }); }); }, [m]), o(b), b; } function h(m) { var v = m.getSnapshot; m = m.value; try { var b = v(); return !n(m, b); } catch { return !0; } } function f(m, v) { return v(); } var g = typeof window > "u" || typeof window.document > "u" || typeof window.document.createElement > "u" ? f : s; return A1.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : g, A1; } var T1 = {}; /** * @license React * use-sync-external-store-shim.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var MI; function tG() { return MI || (MI = 1, process.env.NODE_ENV !== "production" && function() { typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); var e = Te, t = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; function n(P) { { for (var R = arguments.length, I = new Array(R > 1 ? R - 1 : 0), N = 1; N < R; N++) I[N - 1] = arguments[N]; r("error", P, I); } } function r(P, R, I) { { var N = t.ReactDebugCurrentFrame, F = N.getStackAddendum(); F !== "" && (R += "%s", I = I.concat([F])); var Y = I.map(function(K) { return String(K); }); Y.unshift("Warning: " + R), Function.prototype.apply.call(console[P], console, Y); } } function i(P, R) { return P === R && (P !== 0 || 1 / P === 1 / R) || P !== P && R !== R; } var a = typeof Object.is == "function" ? Object.is : i, o = e.useState, s = e.useEffect, h = e.useLayoutEffect, f = e.useDebugValue, g = !1, m = !1; function v(P, R, I) { g || e.startTransition !== void 0 && (g = !0, n("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release.")); var N = R(); if (!m) { var F = R(); a(N, F) || (n("The result of getSnapshot should be cached to avoid an infinite loop"), m = !0); } var Y = o({ inst: { value: N, getSnapshot: R } }), K = Y[0].inst, ee = Y[1]; return h(function() { K.value = N, K.getSnapshot = R, b(K) && ee({ inst: K }); }, [P, N, R]), s(function() { b(K) && ee({ inst: K }); var z = function() { b(K) && ee({ inst: K }); }; return P(z); }, [P]), f(N), N; } function b(P) { var R = P.getSnapshot, I = P.value; try { var N = R(); return !a(I, N); } catch { return !0; } } function w(P, R, I) { return R(); } var C = typeof window < "u" && typeof window.document < "u" && typeof window.document.createElement < "u", M = !C, E = M ? w : v, A = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : E; T1.useSyncExternalStore = A, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); }()), T1; } var EI; function $L() { return EI || (EI = 1, process.env.NODE_ENV === "production" ? ev.exports = eG() : ev.exports = tG()), ev.exports; } /** * @license React * use-sync-external-store-shim/with-selector.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var AI; function nG() { if (AI) return E1; AI = 1; var e = Te, t = $L(); function n(f, g) { return f === g && (f !== 0 || 1 / f === 1 / g) || f !== f && g !== g; } var r = typeof Object.is == "function" ? Object.is : n, i = t.useSyncExternalStore, a = e.useRef, o = e.useEffect, s = e.useMemo, h = e.useDebugValue; return E1.useSyncExternalStoreWithSelector = function(f, g, m, v, b) { var w = a(null); if (w.current === null) { var C = { hasValue: !1, value: null }; w.current = C; } else C = w.current; w = s(function() { function E(N) { if (!A) { if (A = !0, P = N, N = v(N), b !== void 0 && C.hasValue) { var F = C.value; if (b(F, N)) return R = F; } return R = N; } if (F = R, r(P, N)) return F; var Y = v(N); return b !== void 0 && b(F, Y) ? F : (P = N, R = Y); } var A = !1, P, R, I = m === void 0 ? null : m; return [function() { return E(g()); }, I === null ? void 0 : function() { return E(I()); }]; }, [g, m, v, b]); var M = i(f, w[0], w[1]); return o(function() { C.hasValue = !0, C.value = M; }, [M]), h(M), M; }, E1; } var I1 = {}; /** * @license React * use-sync-external-store-shim/with-selector.development.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ var TI; function rG() { return TI || (TI = 1, process.env.NODE_ENV !== "production" && function() { typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error()); var e = Te, t = $L(); function n(g, m) { return g === m && (g !== 0 || 1 / g === 1 / m) || g !== g && m !== m; } var r = typeof Object.is == "function" ? Object.is : n, i = t.useSyncExternalStore, a = e.useRef, o = e.useEffect, s = e.useMemo, h = e.useDebugValue; function f(g, m, v, b, w) { var C = a(null), M; C.current === null ? (M = { hasValue: !1, value: null }, C.current = M) : M = C.current; var E = s(function() { var I = !1, N, F, Y = function(W) { if (!I) { I = !0, N = W; var G = b(W); if (w !== void 0 && M.hasValue) { var L = M.value; if (w(L, G)) return F = L, L; } return F = G, G; } var j = N, Z = F; if (r(j, W)) return Z; var Q = b(W); return w !== void 0 && w(Z, Q) ? Z : (N = W, F = Q, Q); }, K = v === void 0 ? null : v, ee = function() { return Y(m()); }, z = K === null ? void 0 : function() { return Y(K()); }; return [ee, z]; }, [m, v, b, w]), A = E[0], P = E[1], R = i(g, A, P); return o(function() { M.hasValue = !0, M.value = R; }, [R]), h(R), R; } I1.useSyncExternalStoreWithSelector = f, typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ < "u" && typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop == "function" && __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error()); }()), I1; } process.env.NODE_ENV === "production" ? s2.exports = nG() : s2.exports = rG(); var iG = s2.exports; const aG = /* @__PURE__ */ lr(iG), { useDebugValue: sG } = Te, { useSyncExternalStoreWithSelector: oG } = aG, lG = (e) => e; function cG(e, t = lG, n) { const r = oG( e.subscribe, e.getState, e.getServerState || e.getInitialState, t, n ); return sG(r), r; } const uG = (e) => { const t = typeof e == "function" ? QV(e) : e, n = (r, i) => cG(t, r, i); return Object.assign(n, t), n; }, hG = (e) => uG(e), VL = ` //VERSION=3 function setup() { return { input: [{ bands: [ "B04", "B08", "SCL", "dataMask" ] }], output: [ { id: "data", bands: 1 }, { id: "dataMask", bands: 1 }] } } function evaluatePixel(samples) { let ndvi = (samples.B08 - samples.B04)/(samples.B08 + samples.B04) var validNDVIMask = 1 if (samples.B08 + samples.B04 == 0 ){ validNDVIMask = 0 } var noWaterMask = 1 if (samples.SCL == 6 ){ noWaterMask = 0 } return { data: [ndvi], // Exclude nodata pixels, pixels where ndvi is not defined and water pixels from statistics: dataMask: [samples.dataMask * validNDVIMask * noWaterMask] } } `; async function dG() { var r, i; console.log("access Token", kt.getState().configs); const t = await fetch("https://services.sentinel-hub.com/oauth/token", { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: new URLSearchParams({ grant_type: "client_credentials", client_id: ((r = kt.getState().configs) == null ? void 0 : r.VITE_SENTINAL_HUB_CLIENT_ID) || localStorage.getItem("VITE_SENTINAL_HUB_CLIENT_ID") || "your-sentinal-hub-api-key", client_secret: ((i = kt.getState().configs) == null ? void 0 : i.VITE_SENTINAL_HUB_CLIENT_SECRET) || localStorage.getItem("VITE_SENTINAL_HUB_CLIENT_SECRET") || "your-sentinal-hub-client-secret" }) }); if (!t.ok) throw new Error("Failed to obtain access token"); return (await t.json()).access_token; } async function GL(e, t) { var o, s; const n = "https://services.sentinel-hub.com/oauth/token", r = new URLSearchParams({ grant_type: "client_credentials", client_id: ((o = kt.getState().configs) == null ? void 0 : o.VITE_SENTINAL_HUB_CLIENT_ID) || e, client_secret: ((s = kt.getState().configs) == null ? void 0 : s.VITE_SENTINAL_HUB_CLIENT_SECRET) || t }), i = await fetch(n, { method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded" }, body: r.toString() }); if (!i.ok) throw new Error("Failed to fetch access token"); const a = await i.json(); return console.log("getAccessToken", a), a; } async function qC(e, { accessToken: t, startDate: n, endDate: r }) { const i = n || new Date((/* @__PURE__ */ new Date()).setMonth((/* @__PURE__ */ new Date()).getMonth() - 3)).toISOString(), a = r || (/* @__PURE__ */ new Date()).toISOString(), o = "https://services.sentinel-hub.com/api/v1/statistics", s = { input: { bounds: { geometry: { type: "Polygon", coordinates: e.geometry.coordinates }, properties: { crs: "http://www.opengis.net/def/crs/EPSG/0/4326" } }, data: [ { type: "sentinel-2-l2a", dataFilter: { mosaickingOrder: "leastCC" } } ] }, aggregation: { timeRange: { from: i, to: a }, aggregationInterval: { of: "P7D" }, evalscript: VL, resx: 10, resy: 10 } }; try { const h = await fetch(o, { method: "POST", headers: { Authorization: `Bearer ${t}`, "Content-Type": "application/json" }, body: JSON.stringify(s) }); if (!h.ok) throw console.error(h), new Error("Failed to fetch NDVI statistics"); const f = await h.json(); return console.log("ndvi data k", f), f == null ? void 0 : f.data; } catch (h) { return console.error("Error fetching NDVI statistics:", h), null; } } async function JC(e, { accessToken: t, startDate: n, endDate: r }) { const i = e.lng, a = e.lat, o = 1e-4, s = n || new Date((/* @__PURE__ */ new Date()).setMonth((/* @__PURE__ */ new Date()).getMonth() - 3)).toISOString(), h = r || (/* @__PURE__ */ new Date()).toISOString(), f = { type: "Polygon", coordinates: [ [ [i - o, a - o], [i + o, a - o], [i + o, a + o], [i - o, a + o], [i - o, a - o] // Closing the polygon ] ] }, g = "https://services.sentinel-hub.com/api/v1/statistics", m = { input: { bounds: { geometry: f, properties: { crs: "http://www.opengis.net/def/crs/EPSG/0/4326" } }, data: [ { type: "sentinel-2-l2a", dataFilter: { mosaickingOrder: "leastCC" } } ] }, aggregation: { timeRange: { from: s, to: h }, aggregationInterval: { of: "P7D" }, evalscript: VL, resx: 10, resy: 10 } }; try { const v = await fetch(g, { method: "POST", headers: { Authorization: `Bearer ${t}`, "Content-Type": "application/json" }, body: JSON.stringify(m) }); if (!v.ok) throw new Error("Failed to fetch NDVI statistics"); const b = await v.json(); return console.log("NDVI data for point:", b), b == null ? void 0 : b.data; } catch (v) { return console.error("Error fetching NDVI statistics for point:", v), null; } } async function l0({ aoi: e, startDate: t, endDate: n, accessToken: r, limit: i = 10, nextToken: a = null }) { var g, m, v, b; if (!r) return console.warn("Access token is required"), { dates: [], nextToken: null }; if (!t || !n) { const w = /* @__PURE__ */ new Date(); t = new Date(w.setMonth(w.getMonth() - 36)).toISOString(), n = (/* @__PURE__ */ new Date()).toISOString(); } const o = `${t}`, s = `${n}`, h = "https://services.sentinel-hub.com/api/v1/catalog/1.0.0/search", f = { Authorization: `Bearer ${r}`, "Content-Type": "application/json" }; if (!e) return console.warn("aoi is not provided to getSatellitePassDates "), { dates: [], nextToken: null }; try { const w = { bbox: e, datetime: `${o}/${s}`, collections: ["sentinel-2-l1c"], limit: i, filter: "eo:cloud_cover <= 20" }; a && (w.next = a); const C = await fetch(h, { method: "POST", headers: f, body: JSON.stringify(w) }); if (!C.ok) throw new Error(`HTTP error! Status: ${C.status}`); const M = await C.json(); console.log("API response data:", { featuresCount: (g = M.features) == null ? void 0 : g.length, linksCount: (m = M.links) == null ? void 0 : m.length, hasLinks: !!M.links, links: M.links }); const E = (v = M.links) == null ? void 0 : v.find((R) => R.rel === "next"), A = (b = E == null ? void 0 : E.body) == null ? void 0 : b.next; console.log("Next token extraction:", { nextLink: E, nextTokenFromResponse: A }); const P = M.features.map( (R) => new Date(R.properties.datetime) ); return P.sort((R, I) => I - R), console.log(`Found ${P.length} dates (limit: ${i}, hasNext: ${!!A})`), { dates: P, nextToken: A }; } catch (w) { return console.error("Error fetching data:", w), { dates: [], nextToken: null }; } } const o2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, fetchAccessToken: GL, fetchMeanNDVI: qC, fetchMeanNDVIForPoint: JC, getAccessToken: dG, getSatellitePassDates: l0 }, Symbol.toStringTag, { value: "Module" })); var ts = 63710088e-1, fG = { centimeters: ts * 100, centimetres: ts * 100, degrees: 360 / (2 * Math.PI), feet: ts * 3.28084, inches: ts * 39.37, kilometers: ts / 1e3, kilometres: ts / 1e3, meters: ts, metres: ts, miles: ts / 1609.344, millimeters: ts * 1e3, millimetres: ts * 1e3, nauticalmiles: ts / 1852, radians: 1, yards: ts * 1.0936 }; function pG(e, t = "kilometers") { const n = fG[t]; if (!n) throw new Error(t + " units is invalid"); return e * n; } function tv(e) { return e % 360 * Math.PI / 180; } function II(e) { if (!e) throw new Error("coord is required"); if (!Array.isArray(e)) { if (e.type === "Feature" && e.geometry !== null && e.geometry.type === "Point") return [...e.geometry.coordinates]; if (e.type === "Point") return [...e.coordinates]; } if (Array.isArray(e) && e.length >= 2 && !Array.isArray(e[0]) && !Array.isArray(e[1])) return [...e]; throw new Error("coord must be GeoJSON Point or an Array of numbers"); } function P1(e, t, n = {}) { var r = II(e), i = II(t), a = tv(i[1] - r[1]), o = tv(i[0] - r[0]), s = tv(r[1]), h = tv(i[1]), f = Math.pow(Math.sin(a / 2), 2) + Math.pow(Math.sin(o / 2), 2) * Math.cos(s) * Math.cos(h); return pG( 2 * Math.atan2(Math.sqrt(f), Math.sqrt(1 - f)), n.units ); } function WL(e, t, n) { if (e !== null) for (var r, i, a, o, s, h, f, g = 0, m = 0, v, b = e.type, w = b === "FeatureCollection", C = b === "Feature", M = w ? e.features.length : 1, E = 0; E < M; E++) { f = w ? e.features[E].geometry : C ? e.geometry : e, v = f ? f.type === "GeometryCollection" : !1, s = v ? f.geometries.length : 1; for (var A = 0; A < s; A++) { var P = 0, R = 0; if (o = v ? f.geometries[A] : f, o !== null) { h = o.coordinates; var I = o.type; switch (g = 0, I) { case null: break; case "Point": if (t( h, m, E, P, R ) === !1) return !1; m++, P++; break; case "LineString": case "MultiPoint": for (r = 0; r < h.length; r++) { if (t( h[r], m, E, P, R ) === !1) return !1; m++, I === "MultiPoint" && P++; } I === "LineString" && P++; break; case "Polygon": case "MultiLineString": for (r = 0; r < h.length; r++) { for (i = 0; i < h[r].length - g; i++) { if (t( h[r][i], m, E, P, R ) === !1) return !1; m++; } I === "MultiLineString" && P++, I === "Polygon" && R++; } I === "Polygon" && P++; break; case "MultiPolygon": for (r = 0; r < h.length; r++) { for (R = 0, i = 0; i < h[r].length; i++) { for (a = 0; a < h[r][i].length - g; a++) { if (t( h[r][i][a], m, E, P, R ) === !1) return !1; m++; } R++; } P++; } break; case "GeometryCollection": for (r = 0; r < o.geometries.length; r++) if (WL(o.geometries[r], t) === !1) return !1; break; default: throw new Error("Unknown Geometry Type"); } } } } } function ku(e, t = {}) { if (e.bbox != null && t.recompute !== !0) return e.bbox; const n = [1 / 0, 1 / 0, -1 / 0, -1 / 0]; return WL(e, (r) => { n[0] > r[0] && (n[0] = r[0]), n[1] > r[1] && (n[1] = r[1]), n[2] < r[0] && (n[2] = r[0]), n[3] < r[1] && (n[3] = r[1]); }), n; } var mG = function e(t, n) { if (t === n) return !0; if (t && n && typeof t == "object" && typeof n == "object") { if (t.constructor !== n.constructor) return !1; var r, i, a; if (Array.isArray(t)) { if (r = t.length, r != n.length) return !1; for (i = r; i-- !== 0; ) if (!e(t[i], n[i])) return !1; return !0; } if (t.constructor === RegExp) return t.source === n.source && t.flags === n.flags; if (t.valueOf !== Object.prototype.valueOf) return t.valueOf() === n.valueOf(); if (t.toString !== Object.prototype.toString) return t.toString() === n.toString(); if (a = Object.keys(t), r = a.length, r !== Object.keys(n).length) return !1; for (i = r; i-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(n, a[i])) return !1; for (i = r; i-- !== 0; ) { var o = a[i]; if (!e(t[o], n[o])) return !1; } return !0; } return t !== t && n !== n; }; const PI = /* @__PURE__ */ lr(mG), gG = () => { const e = kt.getState().configs; return e != null && e.username ? e.username : "pepe"; }, KC = (e) => `${gG()}_${e}`, of = (e) => { const t = KC(e); return localStorage.getItem(t); }, Bu = (e, t) => { const n = KC(e); localStorage.setItem(n, t); }, UL = (e) => { const t = KC(e); localStorage.removeItem(t); }, QC = (e) => { try { const t = of(e); return t ? JSON.parse(t) : null; } catch (t) { return console.error(`Failed to parse JSON from localStorage for key ${e}:`, t), null; } }, l2 = (e, t) => { try { const n = JSON.stringify(t); Bu(e, n); } catch (n) { console.error(`Failed to stringify JSON for localStorage key ${e}:`, n); } }; function yG(e, t) { if (!e || !t || (e == null ? void 0 : e.length) !== 4 || (t == null ? void 0 : t.length) !== 4) return !0; const [n, r, i, a] = e, [o, s, h, f] = t, g = [(n + i) / 2, (r + a) / 2], m = [(o + h) / 2, (s + f) / 2], v = P1(g, m, { units: "kilometers" }), b = P1([n, r], [i, a], { units: "kilometers" }), w = P1([o, s], [h, f], { units: "kilometers" }), C = Math.abs(w - b) / b; return v > 2 || C > 1; } const tr = { PICKER: "PICKER", NORMAL: "NORMAL", DRAW: "DRAW", EDIT_PLOT: "EDIT_PLOT", ADD_PLOT: "ADD_PLOT", ADD_MARKER: "ADD_MARKER", EDIT_MARKER: "EDIT_MARKER", ADD_NEW_FARM: "ADD_NEW_FARM" }, as = { NORMAL: "NORMAL", COMPARISION_VIEW: "COMPARISION_VIEW" }, OI = { // all posible cursors on react-map-gl (maplibre) DEFAULT: "", POINTER: "pointer", CROSSHAIR: "crosshair", MOVE: "move", GRAB: "grab", GRABBING: "grabbing", TEXT: "text", WAIT: "wait", HELP: "help" }, kt = hG((e, t) => ({ configs: {}, setConfigs: (n) => e({ configs: n }), requestHeaders: void 0, setRequestHeaders: (n) => e({ requestHeaders: n }), setAccessToken: (n) => e({ accessToken: n }), sidebarExpanded: !0, setSidebarExpanded: (n) => e({ sidebarExpanded: n }), hoveredValue: null, setHoveredValue: (n) => e({ hoveredValue: n }), cursor: OI.DEFAULT, previousCursor: OI.DEFAULT, setCursor: (n) => e({ previousCursor: kt.getState().cursor, cursor: n }), resetCursor: () => e((n) => ({ cursor: n.previousCursor })), viewMode: tr.NORMAL, pickerData: null, setPickerData: (n) => e({ pickerData: n }), loadingNDVIImages: [], addLoadingNDVIImage: (n) => e((r) => ({ loadingNDVIImages: [...r.loadingNDVIImages, n] })), removeLoadingNDVIImage: (n) => e((r) => ({ loadingNDVIImages: r.loadingNDVIImages.filter((i) => i !== n) })), isNDVIImageLoading: (n) => kt.getState().loadingNDVIImages.includes(n), setViewMode: (n) => e({ viewMode: n }), toPickerMode: () => e({ viewMode: tr.PICKER }), toNormalMode: () => e({ viewMode: tr.NORMAL }), toDrawMode: () => e({ viewMode: tr.DRAW }), toggleNormalPickerMode: () => e((n) => ({ viewMode: n.viewMode === tr.NORMAL ? tr.PICKER : tr.NORMAL })), cursorCords: [0, 0], setCursorCords: (n) => e({ cursorCords: n }), rasterLayer: { value: "3_NDVI", label: "NDVI" }, setRasterLayer: (n) => e({ rasterLayer: n }), rasterOpacity: 100, setRasterOpacity: (n) => e({ rasterOpacity: n }), clickedMarker: null, setClickedMarker: (n) => e({ clickedMarker: n }), setShowCroppedImages: (n) => e({ showCroppedImages: n }), showCroppedImages: !0, datesLoading: !1, setDatesLoading: (n) => e({ datesLoading: n }), rasterLayerLoading: !1, // New loading state for raster layer changes setRasterLayerLoading: (n) => e({ rasterLayerLoading: n }), mapMode: (() => { try { const n = of("map-mode"); if (n && Object.values(as).includes(n)) return n; } catch (n) { console.error("Failed to load mapMode from localStorage during store initialization:", n); } return as.NORMAL; })(), setMapMode: (n) => e({ mapMode: n }), dateRange: { start: new Date(Date.now() - 30 * 24 * 60 * 60 * 1e3), end: /* @__PURE__ */ new Date() }, dateRange2: { start: new Date(Date.now() - 30 * 24 * 60 * 60 * 1e3), end: /* @__PURE__ */ new Date() }, setDateRange: (n) => { const r = { start: n.start ? typeof n.start == "string" ? new Date(n.start) : n.start : void 0, end: n.end ? typeof n.end == "string" ? new Date(n.end) : n.end : void 0 }; e({ dateRange: r }); }, setDateRange2: (n) => { const r = { start: n.start ? typeof n.start == "string" ? new Date(n.start) : n.start : void 0, end: n.end ? typeof n.end == "string" ? new Date(n.end) : n.end : void 0 }; e({ dateRange2: r }); }, passDates: [], setPassDates: (n) => e({ passDates: n }), nextToken: null, setNextToken: (n) => e({ nextToken: n }), hasMoreDates: !0, setHasMoreDates: (n) => e({ hasMoreDates: n }),