@vnedyalk0v/react19-simple-maps
Advanced tools
+35
-0
| # Changelog | ||
| ## 2.0.3 | ||
| ### Patch Changes | ||
| - 863c579: Fix all confirmed findings from the React 19 package audit: | ||
| - **(4.1, 4.2) Geography loading model:** Remove broken Suspense wrapper from `Geographies` that never triggered. Expose `isLoading` and `error` from `useGeographies` and render SVG-safe loading/error fallbacks instead of invalid HTML `<div>` elements inside `<g>`. | ||
| - **(5.1) Custom memo comparators:** Remove custom `memo` comparators from `Geographies` and `Geography` that silently blocked updates to forwarded DOM props (`aria-*`, `data-*`, `opacity`, `role`, etc.). Default `memo` shallow comparison is now used. | ||
| - **(5.2) Focused style variant:** Separate hover and keyboard focus into independent state variables in `Geography` and `Marker`. The `focused` style variant is now applied on keyboard focus (`onFocus`/`onBlur`), while `hover` applies on mouse enter/leave. | ||
| - **(5.3) scaleExtent prop:** `ZoomableGroup` now honors the `scaleExtent` prop when provided directly, instead of always deriving zoom bounds from `minZoom`/`maxZoom`. | ||
| - **(6.1) Validation error messages:** Fix ~20 calls to `createGeographyFetchError` in `input-validation.ts` where the descriptive error message was passed in the wrong argument position (URL slot), resulting in generic error text. Security-related validation errors now correctly use the `SECURITY_ERROR` type. | ||
| - **(6.2) Lockfile sync:** Regenerate `package-lock.json` to match `package.json` version `2.0.2`. | ||
| - **(7.1) Debug render purity:** Move `setDebugMode` and `logRender` calls out of the render phase into `useEffect` to prevent global state mutation and console I/O during rendering, which is problematic under StrictMode and concurrent rendering. | ||
| - **Error boundary SVG safety:** Change `DefaultErrorFallback` in `GeographyErrorBoundary` to render SVG-safe `<text>`/`<g>` elements instead of HTML `<div>`/`<button>`. | ||
| - dad7925: Fix security vulnerabilities identified in security best-practices review: | ||
| - **SEC-001 (High):** Fix IPv6 private-address bypass in URL validation. Strip IPv6 brackets from `new URL().hostname` before matching, add IPv4-mapped IPv6 detection (both dotted-quad and hex forms), and expand reserved range coverage. | ||
| - **SEC-002 (Medium):** Run `validateGeographyUrl()` in the preloading pipeline before any DNS prefetch, preconnect, or preload network activity. | ||
| - **SEC-003 (Medium):** Canonicalize URLs (strip fragment, normalize port/host) before SRI hash lookup to prevent bypass via trivial URL variants. | ||
| - **SEC-004 (Low):** Remove `frame-ancestors` and `X-Frame-Options` from HTML meta tags in examples (not enforced by browsers via meta); strengthen dev-only comments. | ||
| - **SEC-005 (Low):** Redact `git.branch` in persisted bundle reports to prevent sensitive branch names leaking into CI artifacts. Add `BUNDLE_REPORT_REDACT_GIT` env var to omit all git metadata from reports. | ||
| - **Build:** Set `NODE_ENV=production` in the `build` script so the Rollup Terser plugin is applied, enabling `drop_console` and `pure_funcs` to strip `console.log`/`console.warn`/`console.debug` from production bundles. | ||
| Bundle Monitor Improvements: | ||
| - Fix optimization status mapping — 0% completion now correctly reports `"not_started"` instead of `"partial"`. Status derives from numeric completionRate consistently (0% → not_started, 1–99% → partial, 100% → complete). | ||
| - **Breaking (report schema):** `utilization.raw`, `utilization.gzip`, and `utilization.brotli` are now numbers (e.g. `93.7`) instead of strings (`"93.7"`). Brotli emits `null` instead of `"N/A"` when unavailable. Parallel formatted fields (`utilization.rawFormatted`, `utilization.gzipFormatted`, `utilization.brotliFormatted`) provide display-ready strings (e.g. `"93.7%"`). | ||
| - **Breaking (report schema):** `react19Optimizations.*.completionRate` is now a number (e.g. `50`) instead of a string (`"50.0"`). A parallel `completionRateFormatted` field (e.g. `"50.0%"`) is provided for display. | ||
| - 44afd4a: Address follow-up review findings: | ||
| - **useGeographies:** Abort stale async updates with an effect cleanup flag; expose `refetch()` to retry string URL loads. | ||
| - **Types:** `GeographyData.error` is now `GeographyError | Error | null`; optional `refetch` on the hook result. | ||
| - **Geographies / Geography:** Restore targeted `memo` comparators; stable loading fallback element; wire fallback retry to `refetch`. | ||
| - **GeographyErrorBoundary:** Default fallback shows an accessible Retry control and vertically centers error text in SVG. | ||
| - **Security:** Canonicalize URLs in `addCustomSRI`; extend IPv4 documentation (TEST-NET) ranges; clarify example HTML comments on meta vs HTTP headers. | ||
| - **Preloading:** Mark URLs in the dedupe set after DNS/preconnect hints to avoid redundant hint calls in development. | ||
| ## 2.0.2 | ||
@@ -4,0 +39,0 @@ |
+11
-1
@@ -88,2 +88,8 @@ import * as react from 'react'; | ||
| type ProjectionConfigConditional<T extends string> = T extends 'geoAlbers' ? ProjectionConfig & Required<Pick<ProjectionConfig, 'parallels'>> : T extends 'geoConicEqualArea' | 'geoConicConformal' ? ProjectionConfig & Required<Pick<ProjectionConfig, 'parallels'>> : ProjectionConfig; | ||
| type GeographyError = Error & { | ||
| type: 'GEOGRAPHY_LOAD_ERROR' | 'GEOGRAPHY_PARSE_ERROR' | 'PROJECTION_ERROR' | 'VALIDATION_ERROR' | 'SECURITY_ERROR' | 'CONFIGURATION_ERROR' | 'CONTEXT_ERROR'; | ||
| geography?: string; | ||
| details?: Record<string, unknown>; | ||
| timestamp?: string; | ||
| }; | ||
| type ProjectionName = `geo${Capitalize<string>}`; | ||
@@ -236,3 +242,7 @@ interface ProjectionConfig { | ||
| borders: string; | ||
| isLoading: boolean; | ||
| error: GeographyError | Error | null; | ||
| center?: Coordinates; | ||
| /** Re-runs the fetch for string `geography` URLs (no-op for object geographies). */ | ||
| refetch?: () => void; | ||
| } | ||
@@ -361,3 +371,3 @@ interface ZoomPanState { | ||
| declare function Geographies({ geography, children, parseGeographies, className, errorBoundary, onGeographyError, fallback, ref, ...restProps }: GeographiesProps & { | ||
| declare function Geographies({ geography, children, parseGeographies, className, errorBoundary, onGeographyError, fallback, ref, ...restProps }: GeographiesProps<boolean> & { | ||
| ref?: Ref<SVGGElement>; | ||
@@ -364,0 +374,0 @@ }): react_jsx_runtime.JSX.Element; |
+5
-1
@@ -218,3 +218,7 @@ import { Feature, Geometry, FeatureCollection, MultiLineString, LineString } from 'geojson'; | ||
| /** | ||
| * Check if SRI validation is required for a URL | ||
| * Check if SRI validation is required for a URL. | ||
| * The URL is canonicalized (fragment stripped, host lowercased, default port | ||
| * removed) before lookup so that trivial URL variants don't bypass known | ||
| * SRI entries. | ||
| * | ||
| * @param url - URL to check | ||
@@ -221,0 +225,0 @@ * @returns SRI configuration if validation is required, null otherwise |
+1
-1099
@@ -1,1100 +0,2 @@ | ||
| import { feature, mesh } from 'topojson-client'; | ||
| import { cache } from 'react'; | ||
| import { prefetchDNS, preconnect, preload } from 'react-dom'; | ||
| // Helper functions to create branded types | ||
| const createLongitude = (value) => value; | ||
| const createLatitude = (value) => value; | ||
| const createCoordinates = (lon, lat) => [ | ||
| createLongitude(lon), | ||
| createLatitude(lat), | ||
| ]; | ||
| /** | ||
| * Calculates coordinates from zoom transform | ||
| * @param w - Width of the map | ||
| * @param h - Height of the map | ||
| * @param t - Zoom transform object | ||
| * @returns Branded coordinates | ||
| */ | ||
| function getCoords(w, h, t) { | ||
| const xOffset = (w * t.k - w) / 2; | ||
| const yOffset = (h * t.k - h) / 2; | ||
| const lon = w / 2 - (xOffset + t.x) / t.k; | ||
| const lat = h / 2 - (yOffset + t.y) / t.k; | ||
| return createCoordinates(lon, lat); | ||
| } | ||
| /** | ||
| * Creates a standardized geography fetch error | ||
| * @param type - Error type | ||
| * @param message - Error message | ||
| * @param url - URL that caused the error (optional) | ||
| * @param originalError - Original error that caused this error (optional) | ||
| * @returns GeographyError instance | ||
| */ | ||
| function createGeographyFetchError(type, message, url, originalError) { | ||
| const error = new Error(message); | ||
| error.name = 'GeographyError'; | ||
| error.type = type; | ||
| error.timestamp = new Date().toISOString(); | ||
| if (url) { | ||
| error.geography = url; | ||
| } | ||
| if (originalError) { | ||
| error.cause = originalError; | ||
| if (originalError.stack) { | ||
| error.stack = originalError.stack; | ||
| } | ||
| error.details = { | ||
| originalMessage: originalError.message, | ||
| originalName: originalError.name, | ||
| }; | ||
| } | ||
| return error; | ||
| } | ||
| /** | ||
| * Simple URL validation to avoid circular dependency | ||
| * @param url - URL to validate | ||
| * @returns Validated URL string | ||
| */ | ||
| function validateURL(url) { | ||
| if (!url || typeof url !== 'string') { | ||
| throw new Error('URL must be a non-empty string'); | ||
| } | ||
| // Basic URL validation | ||
| try { | ||
| new URL(url); | ||
| return url.trim(); | ||
| } | ||
| catch { | ||
| throw new Error('Invalid URL format'); | ||
| } | ||
| } | ||
| const DEFAULT_GEOGRAPHY_FETCH_CONFIG = { | ||
| TIMEOUT_MS: 10000, // 10 seconds | ||
| MAX_RESPONSE_SIZE: 50 * 1024 * 1024, // 50MB | ||
| ALLOWED_CONTENT_TYPES: ['application/json', 'application/geo+json'], | ||
| ALLOWED_PROTOCOLS: ['https:'], // HTTPS only by default | ||
| ALLOW_HTTP_LOCALHOST: false, // Disabled by default for security | ||
| STRICT_HTTPS_ONLY: true, // Strict HTTPS-only mode by default | ||
| }; | ||
| // Development configuration (can be enabled explicitly) | ||
| const DEVELOPMENT_GEOGRAPHY_FETCH_CONFIG = { | ||
| ...DEFAULT_GEOGRAPHY_FETCH_CONFIG, | ||
| ALLOWED_PROTOCOLS: ['https:', 'http:'], | ||
| ALLOW_HTTP_LOCALHOST: true, // Allow HTTP for localhost in development | ||
| STRICT_HTTPS_ONLY: false, | ||
| }; | ||
| // Current active configuration (defaults to secure) | ||
| let GEOGRAPHY_FETCH_CONFIG = DEFAULT_GEOGRAPHY_FETCH_CONFIG; | ||
| /** | ||
| * Configure geography fetching security settings | ||
| * @param config - Security configuration to apply | ||
| */ | ||
| function configureGeographySecurity(config) { | ||
| GEOGRAPHY_FETCH_CONFIG = { | ||
| ...DEFAULT_GEOGRAPHY_FETCH_CONFIG, | ||
| ...config, | ||
| }; | ||
| } | ||
| /** | ||
| * Enable development mode with relaxed security (use with caution) | ||
| * @param allowHttpLocalhost - Whether to allow HTTP for localhost | ||
| */ | ||
| function enableDevelopmentMode(allowHttpLocalhost = true) { | ||
| if (process.env.NODE_ENV === 'production') { | ||
| // eslint-disable-next-line no-console | ||
| console.warn('Attempted to enable development mode in production - ignoring for security'); | ||
| return; | ||
| } | ||
| GEOGRAPHY_FETCH_CONFIG = { | ||
| ...DEVELOPMENT_GEOGRAPHY_FETCH_CONFIG, | ||
| ALLOW_HTTP_LOCALHOST: allowHttpLocalhost, | ||
| }; | ||
| // eslint-disable-next-line no-console | ||
| console.warn('Development mode enabled with relaxed security settings. Do not use in production!'); | ||
| } | ||
| /** | ||
| * Checks if a hostname is a private IP address | ||
| * @param hostname - The hostname to check | ||
| * @returns True if the hostname is a private IP address | ||
| */ | ||
| function isPrivateIPAddress(hostname) { | ||
| // Skip non-IP hostnames | ||
| if (!hostname || hostname === 'localhost') { | ||
| return false; | ||
| } | ||
| // IPv4 private ranges | ||
| const ipv4PrivateRanges = [ | ||
| /^10\./, // 10.0.0.0/8 | ||
| /^172\.(1[6-9]|2[0-9]|3[01])\./, // 172.16.0.0/12 | ||
| /^192\.168\./, // 192.168.0.0/16 | ||
| /^127\./, // 127.0.0.0/8 (loopback) | ||
| /^169\.254\./, // 169.254.0.0/16 (link-local) | ||
| ]; | ||
| // Check IPv4 private ranges | ||
| for (const range of ipv4PrivateRanges) { | ||
| if (range.test(hostname)) { | ||
| return true; | ||
| } | ||
| } | ||
| // IPv6 private ranges (simplified check) | ||
| const ipv6PrivateRanges = [ | ||
| /^::1$/, // ::1 (loopback) | ||
| /^fe80:/, // fe80::/10 (link-local) | ||
| /^fc00:/, // fc00::/7 (unique local) | ||
| /^fd00:/, // fd00::/8 (unique local) | ||
| ]; | ||
| // Check IPv6 private ranges | ||
| for (const range of ipv6PrivateRanges) { | ||
| if (range.test(hostname)) { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| } | ||
| /** | ||
| * Validates a geography URL for security and format compliance | ||
| * @param url - The URL to validate | ||
| * @throws {Error} If the URL is invalid or insecure | ||
| */ | ||
| function validateGeographyUrl(url) { | ||
| // Use comprehensive URL validation from input-validation module | ||
| const validatedUrl = validateURL(url); | ||
| try { | ||
| const parsedUrl = new URL(validatedUrl); | ||
| // Strict HTTPS-only mode | ||
| if (GEOGRAPHY_FETCH_CONFIG.STRICT_HTTPS_ONLY) { | ||
| if (parsedUrl.protocol !== 'https:') { | ||
| throw createGeographyFetchError('SECURITY_ERROR', `Strict HTTPS-only mode: ${parsedUrl.protocol} is not allowed. Only HTTPS is permitted.`, url); | ||
| } | ||
| } | ||
| else { | ||
| // Check protocol security with configured protocols | ||
| if (!GEOGRAPHY_FETCH_CONFIG.ALLOWED_PROTOCOLS.includes(parsedUrl.protocol)) { | ||
| const allowedProtocols = GEOGRAPHY_FETCH_CONFIG.ALLOWED_PROTOCOLS.join(', '); | ||
| throw createGeographyFetchError('SECURITY_ERROR', `Unsupported protocol: ${parsedUrl.protocol}. Only ${allowedProtocols} are allowed.`, url); | ||
| } | ||
| // HTTP protocol validation | ||
| if (parsedUrl.protocol === 'http:') { | ||
| // Check if HTTP localhost is explicitly allowed | ||
| if (!GEOGRAPHY_FETCH_CONFIG.ALLOW_HTTP_LOCALHOST) { | ||
| throw createGeographyFetchError('SECURITY_ERROR', 'HTTP protocol is disabled for security. Use HTTPS or enable development mode explicitly.', url); | ||
| } | ||
| // If HTTP localhost is allowed, validate hostname | ||
| if (parsedUrl.hostname !== 'localhost' && | ||
| parsedUrl.hostname !== '127.0.0.1') { | ||
| throw createGeographyFetchError('SECURITY_ERROR', 'HTTP protocol is only allowed for localhost. Use HTTPS for remote URLs.', url); | ||
| } | ||
| // Additional production check | ||
| if (process.env.NODE_ENV === 'production') { | ||
| throw createGeographyFetchError('SECURITY_ERROR', 'HTTP localhost access is not allowed in production', url); | ||
| } | ||
| // Development warning for HTTP localhost usage | ||
| // eslint-disable-next-line no-console | ||
| console.warn(`Security Warning: Using HTTP for localhost (${url}). This should only be used in development.`); | ||
| } | ||
| } | ||
| // Additional security checks for localhost access | ||
| if (parsedUrl.hostname === 'localhost' || | ||
| parsedUrl.hostname === '127.0.0.1') { | ||
| if (process.env.NODE_ENV === 'production') { | ||
| throw createGeographyFetchError('SECURITY_ERROR', 'Localhost access is not allowed in production', url); | ||
| } | ||
| } | ||
| // Validate against private IP ranges (additional security) | ||
| if (isPrivateIPAddress(parsedUrl.hostname)) { | ||
| throw createGeographyFetchError('SECURITY_ERROR', `Access to private IP address ${parsedUrl.hostname} is not allowed`, url); | ||
| } | ||
| } | ||
| catch (error) { | ||
| if (error instanceof TypeError) { | ||
| throw createGeographyFetchError('VALIDATION_ERROR', `Invalid URL format: ${url}`, url, error); | ||
| } | ||
| throw error; | ||
| } | ||
| } | ||
| /** | ||
| * Validates response content type | ||
| * @param response - The fetch response to validate | ||
| * @throws {Error} If content type is invalid | ||
| */ | ||
| function validateContentType(response) { | ||
| const contentType = response.headers.get('content-type'); | ||
| if (!contentType) { | ||
| throw createGeographyFetchError('VALIDATION_ERROR', 'Missing Content-Type header'); | ||
| } | ||
| const isValidType = GEOGRAPHY_FETCH_CONFIG.ALLOWED_CONTENT_TYPES.some((type) => contentType.toLowerCase().includes(type)); | ||
| if (!isValidType) { | ||
| throw createGeographyFetchError('VALIDATION_ERROR', `Invalid content type: ${contentType}. Expected one of: ${GEOGRAPHY_FETCH_CONFIG.ALLOWED_CONTENT_TYPES.join(', ')}`); | ||
| } | ||
| } | ||
| /** | ||
| * Fast pre-check of Content-Length header to reject obviously oversized responses. | ||
| * NOTE: This is only a pre-check — the header can be omitted or falsified. | ||
| * Use {@link readResponseWithSizeLimit} for authoritative enforcement. | ||
| * @param response - The fetch response to validate | ||
| * @throws {Error} If Content-Length exceeds the configured maximum | ||
| */ | ||
| async function validateResponseSize(response) { | ||
| const contentLength = response.headers.get('content-length'); | ||
| if (contentLength) { | ||
| const size = parseInt(contentLength, 10); | ||
| if (size > GEOGRAPHY_FETCH_CONFIG.MAX_RESPONSE_SIZE) { | ||
| throw createGeographyFetchError('VALIDATION_ERROR', `Response too large: ${size} bytes. Maximum allowed: ${GEOGRAPHY_FETCH_CONFIG.MAX_RESPONSE_SIZE} bytes`); | ||
| } | ||
| } | ||
| } | ||
| /** | ||
| * Reads the response body as an ArrayBuffer while enforcing a hard byte-count limit. | ||
| * Protects against responses that omit or falsify Content-Length. | ||
| * @param response - The fetch response to read | ||
| * @param maxBytes - Maximum allowed bytes (defaults to GEOGRAPHY_FETCH_CONFIG.MAX_RESPONSE_SIZE) | ||
| * @returns The response body as ArrayBuffer | ||
| * @throws {Error} If the body exceeds the byte limit | ||
| */ | ||
| async function readResponseWithSizeLimit(response, maxBytes = GEOGRAPHY_FETCH_CONFIG.MAX_RESPONSE_SIZE) { | ||
| const reader = response.body?.getReader(); | ||
| // Fallback: if ReadableStream is not available, read the whole body and check size. | ||
| // NOTE: response.arrayBuffer() loads the entire response into memory before the size | ||
| // check runs, which can cause high memory usage or OOM for very large responses. | ||
| // The ReadableStream path above is preferred as it streams data and enforces the | ||
| // size limit incrementally, failing fast without buffering the full payload. | ||
| if (!reader) { | ||
| const buffer = await response.arrayBuffer(); | ||
| if (buffer.byteLength > maxBytes) { | ||
| throw createGeographyFetchError('VALIDATION_ERROR', `Response too large: ${buffer.byteLength} bytes exceeds limit of ${maxBytes} bytes`); | ||
| } | ||
| return buffer; | ||
| } | ||
| const chunks = []; | ||
| let totalBytes = 0; | ||
| for (;;) { | ||
| const { done, value } = await reader.read(); | ||
| if (done) | ||
| break; | ||
| totalBytes += value.byteLength; | ||
| if (totalBytes > maxBytes) { | ||
| reader.cancel().catch(() => { }); | ||
| throw createGeographyFetchError('VALIDATION_ERROR', `Response too large: exceeded limit of ${maxBytes} bytes`); | ||
| } | ||
| chunks.push(value); | ||
| } | ||
| // Concatenate chunks into a single ArrayBuffer | ||
| const result = new Uint8Array(totalBytes); | ||
| let offset = 0; | ||
| for (const chunk of chunks) { | ||
| result.set(chunk, offset); | ||
| offset += chunk.byteLength; | ||
| } | ||
| return result.buffer; | ||
| } | ||
| /** | ||
| * Validates that the parsed data is a valid geography object | ||
| * @param data - The parsed JSON data to validate | ||
| * @throws {Error} If data is not a valid geography object | ||
| */ | ||
| function validateGeographyData(data) { | ||
| if (!data || typeof data !== 'object') { | ||
| throw createGeographyFetchError('VALIDATION_ERROR', 'Invalid geography data: not a valid object'); | ||
| } | ||
| const obj = data; | ||
| if (!obj.type || | ||
| (obj.type !== 'Topology' && obj.type !== 'FeatureCollection')) { | ||
| throw createGeographyFetchError('VALIDATION_ERROR', `Invalid geography data: expected Topology or FeatureCollection, got ${obj.type}`); | ||
| } | ||
| } | ||
| /** | ||
| * Known SRI hashes for common geography data sources | ||
| * These hashes are automatically generated and verified | ||
| * Run 'npm run generate-sri' to update these hashes | ||
| */ | ||
| const KNOWN_GEOGRAPHY_SRI = { | ||
| // World Atlas from unpkg.com - Countries data | ||
| 'https://unpkg.com/world-atlas@2/countries-110m.json': { | ||
| algorithm: 'sha384', | ||
| hash: 'sha384-yOCJ+8ShBm8UDqtAVtAvxTDDf4gXo5edxl/YG0FmVC5OTmqVLl7utuVGBDEeZWHf', | ||
| enforceIntegrity: true, | ||
| }, | ||
| 'https://unpkg.com/world-atlas@2/countries-50m.json': { | ||
| algorithm: 'sha384', | ||
| hash: 'sha384-Aw4s9pX1PTPntIYkZ/qV9IYiF5Gv8eTl6Dd/TT56zfO1Wwd+owFwYUuuXNUMrWkc', | ||
| enforceIntegrity: true, | ||
| }, | ||
| // World Atlas from unpkg.com - Land data | ||
| 'https://unpkg.com/world-atlas@2/land-110m.json': { | ||
| algorithm: 'sha384', | ||
| hash: 'sha384-5oFOGoMd0tkagYW08lVco4uAi7XDEDBwBxOdeKx+SA1ihbsHiR/aFAJGretluTzG', | ||
| enforceIntegrity: true, | ||
| }, | ||
| 'https://unpkg.com/world-atlas@2/land-50m.json': { | ||
| algorithm: 'sha384', | ||
| hash: 'sha384-c0VeCJd1wVbV5WQZNjf1hcMqPr9QXweEArnbdgS1k75TBNjta2M/NddyAulA/Glb', | ||
| enforceIntegrity: true, | ||
| }, | ||
| }; | ||
| const DEFAULT_SRI_CONFIG = { | ||
| enforceForKnownSources: true, | ||
| enforceForAllSources: false, // Don't enforce for all sources by default | ||
| allowUnknownSources: true, // Allow unknown sources by default | ||
| customSRIMap: {}, | ||
| }; | ||
| let currentSRIConfig = DEFAULT_SRI_CONFIG; | ||
| /** | ||
| * Configure SRI enforcement settings | ||
| * @param config - SRI enforcement configuration | ||
| */ | ||
| function configureSRI(config) { | ||
| currentSRIConfig = { | ||
| ...DEFAULT_SRI_CONFIG, | ||
| ...config, | ||
| }; | ||
| } | ||
| /** | ||
| * Enable strict SRI mode (enforce for all sources) | ||
| */ | ||
| function enableStrictSRI() { | ||
| currentSRIConfig = { | ||
| ...currentSRIConfig, | ||
| enforceForKnownSources: true, | ||
| enforceForAllSources: true, | ||
| allowUnknownSources: false, | ||
| }; | ||
| } | ||
| /** | ||
| * Disable SRI enforcement (not recommended for production) | ||
| */ | ||
| function disableSRI() { | ||
| if (process.env.NODE_ENV === 'production') { | ||
| // eslint-disable-next-line no-console | ||
| console.warn('Disabling SRI in production is not recommended for security'); | ||
| } | ||
| currentSRIConfig = { | ||
| ...currentSRIConfig, | ||
| enforceForKnownSources: false, | ||
| enforceForAllSources: false, | ||
| allowUnknownSources: true, | ||
| }; | ||
| } | ||
| /** | ||
| * Calculate SHA hash of data | ||
| * @param data - Data to hash | ||
| * @param algorithm - Hash algorithm to use | ||
| * @returns Promise resolving to base64-encoded hash | ||
| */ | ||
| async function calculateHash(data, algorithm) { | ||
| // Use Web Crypto API (available in browsers and Node.js 16+) | ||
| const hashBuffer = await globalThis.crypto.subtle.digest(algorithm, data); | ||
| const hashArray = new Uint8Array(hashBuffer); | ||
| // Convert to base64 (browser-compatible) | ||
| let hashBase64; | ||
| if (typeof globalThis.btoa !== 'undefined') { | ||
| // Browser environment | ||
| hashBase64 = globalThis.btoa(String.fromCharCode(...hashArray)); | ||
| } | ||
| else { | ||
| // Node.js environment - use manual base64 encoding | ||
| const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; | ||
| let result = ''; | ||
| let i = 0; | ||
| while (i < hashArray.length) { | ||
| const a = hashArray[i++] || 0; | ||
| const b = i < hashArray.length ? hashArray[i++] || 0 : 0; | ||
| const c = i < hashArray.length ? hashArray[i++] || 0 : 0; | ||
| const bitmap = (a << 16) | (b << 8) | c; | ||
| result += chars.charAt((bitmap >> 18) & 63); | ||
| result += chars.charAt((bitmap >> 12) & 63); | ||
| result += | ||
| i - 2 < hashArray.length ? chars.charAt((bitmap >> 6) & 63) : '='; | ||
| result += i - 1 < hashArray.length ? chars.charAt(bitmap & 63) : '='; | ||
| } | ||
| hashBase64 = result; | ||
| } | ||
| return hashBase64; | ||
| } | ||
| /** | ||
| * Validate response integrity using SRI | ||
| * @param response - Fetch response to validate | ||
| * @param url - URL of the resource | ||
| * @param expectedSRI - Expected SRI configuration | ||
| * @returns Promise resolving to validated response | ||
| */ | ||
| async function validateSRI(response, url, expectedSRI) { | ||
| // Clone response to avoid consuming the body | ||
| const responseClone = response.clone(); | ||
| const data = await responseClone.arrayBuffer(); | ||
| // Validate using the ArrayBuffer approach | ||
| await validateSRIFromArrayBuffer(data, url, expectedSRI); | ||
| return response; | ||
| } | ||
| /** | ||
| * Validate ArrayBuffer integrity using SRI | ||
| * @param arrayBuffer - Data to validate | ||
| * @param url - URL of the resource | ||
| * @param expectedSRI - Expected SRI configuration | ||
| * @returns Promise that resolves if validation passes, throws if it fails | ||
| */ | ||
| async function validateSRIFromArrayBuffer(arrayBuffer, url, expectedSRI) { | ||
| // Calculate hash based on algorithm | ||
| const algorithmMap = { | ||
| sha256: 'SHA-256', | ||
| sha384: 'SHA-384', | ||
| sha512: 'SHA-512', | ||
| }; | ||
| const calculatedHash = await calculateHash(arrayBuffer, algorithmMap[expectedSRI.algorithm]); | ||
| const expectedHash = expectedSRI.hash.replace(`${expectedSRI.algorithm}-`, ''); | ||
| if (calculatedHash !== expectedHash) { | ||
| const sriError = new Error(`Subresource Integrity check failed for ${url}. Expected ${expectedSRI.algorithm}-${expectedHash}, got ${expectedSRI.algorithm}-${calculatedHash}`); | ||
| sriError.expectedHash = expectedSRI.hash; | ||
| sriError.calculatedHash = `${expectedSRI.algorithm}-${calculatedHash}`; | ||
| sriError.algorithm = expectedSRI.algorithm; | ||
| throw createGeographyFetchError('SECURITY_ERROR', sriError.message, url, sriError); | ||
| } | ||
| } | ||
| /** | ||
| * Check if SRI validation is required for a URL | ||
| * @param url - URL to check | ||
| * @returns SRI configuration if validation is required, null otherwise | ||
| */ | ||
| function getSRIForUrl(url) { | ||
| // Check custom SRI map first | ||
| if (currentSRIConfig.customSRIMap[url]) { | ||
| return currentSRIConfig.customSRIMap[url]; | ||
| } | ||
| // Check known sources | ||
| if (KNOWN_GEOGRAPHY_SRI[url] && currentSRIConfig.enforceForKnownSources) { | ||
| return KNOWN_GEOGRAPHY_SRI[url]; | ||
| } | ||
| // If enforcing for all sources but no SRI available | ||
| if (currentSRIConfig.enforceForAllSources) { | ||
| if (!currentSRIConfig.allowUnknownSources) { | ||
| throw createGeographyFetchError('SECURITY_ERROR', `SRI enforcement is enabled but no integrity hash is available for ${url}`, url); | ||
| } | ||
| } | ||
| return null; | ||
| } | ||
| /** | ||
| * Add custom SRI configuration for a URL | ||
| * @param url - URL to add SRI for | ||
| * @param sri - SRI configuration | ||
| */ | ||
| function addCustomSRI(url, sri) { | ||
| currentSRIConfig.customSRIMap[url] = sri; | ||
| } | ||
| /** | ||
| * Generate SRI hash for a given URL (utility for developers) | ||
| * This function fetches the resource and calculates its hash | ||
| * @param url - URL to generate SRI for | ||
| * @param algorithm - Hash algorithm to use | ||
| * @returns Promise resolving to SRI hash string | ||
| */ | ||
| async function generateSRIHash(url, algorithm = 'sha384') { | ||
| try { | ||
| const response = await fetch(url); | ||
| if (!response.ok) { | ||
| throw new Error(`Failed to fetch ${url}: ${response.statusText}`); | ||
| } | ||
| const data = await response.arrayBuffer(); | ||
| const algorithmMap = { | ||
| sha256: 'SHA-256', | ||
| sha384: 'SHA-384', | ||
| sha512: 'SHA-512', | ||
| }; | ||
| const hash = await calculateHash(data, algorithmMap[algorithm]); | ||
| return `${algorithm}-${hash}`; | ||
| } | ||
| catch (error) { | ||
| throw createGeographyFetchError('GEOGRAPHY_LOAD_ERROR', `Failed to generate SRI hash for ${url}: ${error instanceof Error ? error.message : 'Unknown error'}`, url, error instanceof Error ? error : new Error(String(error))); | ||
| } | ||
| } | ||
| /** | ||
| * Validate multiple URLs and generate SRI configuration | ||
| * Utility function for setting up SRI for multiple geography sources | ||
| * @param urls - Array of URLs to generate SRI for | ||
| * @param algorithm - Hash algorithm to use | ||
| * @returns Promise resolving to SRI configuration map | ||
| */ | ||
| async function generateSRIForUrls(urls, algorithm = 'sha384') { | ||
| const sriMap = {}; | ||
| for (const url of urls) { | ||
| try { | ||
| const hash = await generateSRIHash(url, algorithm); | ||
| sriMap[url] = { | ||
| algorithm, | ||
| hash, | ||
| enforceIntegrity: true, | ||
| }; | ||
| } | ||
| catch (error) { | ||
| // eslint-disable-next-line no-console | ||
| console.warn(`Failed to generate SRI for ${url}:`, error); | ||
| } | ||
| } | ||
| return sriMap; | ||
| } | ||
| /** Maximum number of redirect hops allowed */ | ||
| const MAX_REDIRECTS = 5; | ||
| /** | ||
| * Creates fetch options with security headers and timeout. | ||
| * Uses `redirect: 'manual'` so each redirect hop can be validated against the URL policy. | ||
| * @param signal - AbortController signal for timeout | ||
| * @returns Fetch options object | ||
| */ | ||
| function createSecureFetchOptions(signal) { | ||
| return { | ||
| signal, | ||
| headers: { | ||
| Accept: GEOGRAPHY_FETCH_CONFIG.ALLOWED_CONTENT_TYPES.join(', '), | ||
| 'Cache-Control': 'public, max-age=3600', // Cache for 1 hour | ||
| }, | ||
| // Security headers | ||
| mode: 'cors', | ||
| credentials: 'omit', // Don't send credentials | ||
| redirect: 'manual', // Handle redirects manually to validate each hop | ||
| }; | ||
| } | ||
| /** | ||
| * Follows redirects manually, validating each hop against the URL security policy. | ||
| * Prevents redirect-based SSRF bypasses. | ||
| * @param url - The initial URL to fetch | ||
| * @param options - Fetch options (must have redirect: 'manual') | ||
| * @returns The final non-redirect response | ||
| */ | ||
| async function fetchWithRedirectValidation(url, options) { | ||
| let currentUrl = url; | ||
| for (let hop = 0; hop < MAX_REDIRECTS; hop++) { | ||
| const response = await fetch(currentUrl, options); | ||
| // Not a redirect — return directly | ||
| if (response.status < 300 || response.status >= 400) { | ||
| return response; | ||
| } | ||
| // Consume the redirect response body to release connection resources | ||
| try { | ||
| await response.arrayBuffer(); | ||
| } | ||
| catch { | ||
| // Ignore body-consumption errors — they must not mask redirect handling | ||
| } | ||
| // Extract and validate the redirect target | ||
| const location = response.headers.get('location'); | ||
| if (!location) { | ||
| throw createGeographyFetchError('SECURITY_ERROR', `Redirect response (HTTP ${response.status}) missing Location header`, currentUrl); | ||
| } | ||
| // Resolve relative redirects against current URL | ||
| const redirectUrl = new URL(location, currentUrl).href; | ||
| // Validate the redirect target against the same URL security policy | ||
| validateGeographyUrl(redirectUrl); | ||
| currentUrl = redirectUrl; | ||
| } | ||
| throw createGeographyFetchError('SECURITY_ERROR', `Too many redirects (exceeded ${MAX_REDIRECTS} hops)`, url); | ||
| } | ||
| /** | ||
| * Creates an abort controller with timeout | ||
| * @param timeoutMs - Timeout in milliseconds | ||
| * @returns Object with controller and cleanup function | ||
| */ | ||
| function createTimeoutController(timeoutMs) { | ||
| const controller = new AbortController(); | ||
| const timeoutId = setTimeout(() => { | ||
| controller.abort(); | ||
| }, timeoutMs); | ||
| return { | ||
| controller, | ||
| cleanup: () => clearTimeout(timeoutId), | ||
| }; | ||
| } | ||
| /** | ||
| * Handles fetch errors and converts them to geography-specific errors | ||
| * @param error - The original error | ||
| * @param url - The URL that was being fetched | ||
| * @returns A GeographyError | ||
| */ | ||
| function handleFetchError(error, url) { | ||
| if (error instanceof Error) { | ||
| if (error.name === 'AbortError') { | ||
| return createGeographyFetchError('GEOGRAPHY_LOAD_ERROR', `Request timeout after ${GEOGRAPHY_FETCH_CONFIG.TIMEOUT_MS}ms`, url, error); | ||
| } | ||
| if (error.name === 'TypeError' && error.message.includes('fetch')) { | ||
| return createGeographyFetchError('GEOGRAPHY_LOAD_ERROR', `Network error: Unable to fetch geography from ${url}`, url, error); | ||
| } | ||
| if (error.message.includes('Invalid geography data')) { | ||
| return createGeographyFetchError('GEOGRAPHY_PARSE_ERROR', error.message, url, error); | ||
| } | ||
| } | ||
| // Re-throw if it's already a GeographyError | ||
| if (error instanceof Error && 'type' in error) { | ||
| return error; | ||
| } | ||
| // Default error | ||
| return createGeographyFetchError('GEOGRAPHY_LOAD_ERROR', error instanceof Error ? error.message : 'Unknown error occurred', url, error instanceof Error ? error : undefined); | ||
| } | ||
| /** | ||
| * Parses JSON from ArrayBuffer with proper error handling | ||
| * @param arrayBuffer - The response data as ArrayBuffer | ||
| * @param url - The URL for error context | ||
| * @returns Parsed geography data | ||
| */ | ||
| async function parseGeographyFromArrayBuffer(arrayBuffer, url) { | ||
| try { | ||
| const text = new TextDecoder().decode(arrayBuffer); | ||
| const data = JSON.parse(text); | ||
| validateGeographyData(data); | ||
| return data; | ||
| } | ||
| catch (jsonError) { | ||
| if (jsonError instanceof SyntaxError) { | ||
| throw createGeographyFetchError('GEOGRAPHY_PARSE_ERROR', 'Invalid JSON format in geography data', url, jsonError); | ||
| } | ||
| throw jsonError; | ||
| } | ||
| } | ||
| /** | ||
| * Fetch geography data with full security validation. | ||
| * | ||
| * @deprecated Since v2.1.0 — use {@link fetchGeographiesCache} instead for | ||
| * cached, secure fetching. This function now delegates to the hardened pipeline | ||
| * but swallows errors for backward compatibility. | ||
| * | ||
| * @param url - The URL to fetch geography data from | ||
| * @returns Promise resolving to geography data or undefined on error | ||
| */ | ||
| async function fetchGeographies(url) { | ||
| if (typeof process !== 'undefined' && | ||
| process?.env?.NODE_ENV !== 'production') { | ||
| // eslint-disable-next-line no-console | ||
| console.warn('fetchGeographies is deprecated. Use fetchGeographiesCache for secure, cached fetching.'); | ||
| } | ||
| try { | ||
| return await fetchGeographiesCache(url); | ||
| } | ||
| catch { | ||
| return undefined; | ||
| } | ||
| } | ||
| /** | ||
| * Secure, cached geography fetching with comprehensive validation | ||
| * This function is cached using React's cache() for optimal performance | ||
| */ | ||
| const fetchGeographiesCache = cache(async (url) => { | ||
| // Validate URL before making request | ||
| validateGeographyUrl(url); | ||
| // Check if SRI validation is required | ||
| const sriConfig = getSRIForUrl(url); | ||
| // Create timeout controller | ||
| const { controller, cleanup } = createTimeoutController(GEOGRAPHY_FETCH_CONFIG.TIMEOUT_MS); | ||
| try { | ||
| // Make secure fetch request with redirect validation | ||
| const response = await fetchWithRedirectValidation(url, createSecureFetchOptions(controller.signal)); | ||
| cleanup(); | ||
| // Validate response | ||
| if (!response.ok) { | ||
| throw createGeographyFetchError('GEOGRAPHY_LOAD_ERROR', `HTTP ${response.status}: ${response.statusText}`, url); | ||
| } | ||
| // Validate content type and fast pre-check of Content-Length | ||
| validateContentType(response); | ||
| await validateResponseSize(response); | ||
| // Read body with hard streaming size limit (guards against falsified Content-Length) | ||
| const arrayBuffer = await readResponseWithSizeLimit(response); | ||
| // Handle SRI validation if required | ||
| if (sriConfig) { | ||
| await validateSRIFromArrayBuffer(arrayBuffer, url, sriConfig); | ||
| } | ||
| // Parse JSON from the already-read ArrayBuffer | ||
| return await parseGeographyFromArrayBuffer(arrayBuffer, url); | ||
| } | ||
| catch (error) { | ||
| cleanup(); | ||
| throw handleFetchError(error, url); | ||
| } | ||
| }); | ||
| /** | ||
| * Preloads geography data for better performance | ||
| * @param url - The URL to preload | ||
| */ | ||
| function preloadGeography$1(url) { | ||
| // Import and use the preload utility with immediate flag | ||
| Promise.resolve().then(function () { return preloading; }) | ||
| .then(({ preloadGeography: preloadUtil }) => { | ||
| preloadUtil(url, true); // immediate = true | ||
| }) | ||
| .catch(() => { | ||
| // Silently handle import errors | ||
| }); | ||
| // Also preload the actual data | ||
| fetchGeographiesCache(url).catch(() => { | ||
| // Silently ignore preload errors | ||
| }); | ||
| } | ||
| /** | ||
| * Checks if the input is a string (URL) | ||
| * @param geo - Geography data or URL | ||
| * @returns True if input is a string | ||
| */ | ||
| function isString(geo) { | ||
| return typeof geo === 'string'; | ||
| } | ||
| /** | ||
| * Extracts features from topology data | ||
| * @param topology - Topology object | ||
| * @param parseGeographies - Optional parser function | ||
| * @returns Array of features | ||
| */ | ||
| function extractFeaturesFromTopology(topology, parseGeographies) { | ||
| const objectKeys = Object.keys(topology.objects); | ||
| if (objectKeys.length === 0) { | ||
| return []; | ||
| } | ||
| // Get the first object (usually countries, states, etc.) | ||
| const firstObjectKey = objectKeys[0]; | ||
| if (!firstObjectKey) { | ||
| return []; | ||
| } | ||
| const geometryObject = topology.objects[firstObjectKey]; | ||
| if (!geometryObject) { | ||
| return []; | ||
| } | ||
| const featureCollection = feature(topology, geometryObject); | ||
| const features = 'features' in featureCollection ? featureCollection.features || [] : []; | ||
| return parseGeographies ? parseGeographies(features) : features; | ||
| } | ||
| /** | ||
| * Extracts features from FeatureCollection | ||
| * @param featureCollection - FeatureCollection object | ||
| * @param parseGeographies - Optional parser function | ||
| * @returns Array of features | ||
| */ | ||
| function extractFeaturesFromCollection(featureCollection, parseGeographies) { | ||
| const features = featureCollection.features || []; | ||
| return parseGeographies ? parseGeographies(features) : features; | ||
| } | ||
| /** | ||
| * Extracts features from various geography data formats | ||
| * @param geographies - Geography data (Topology, FeatureCollection, or Feature array) | ||
| * @param parseGeographies - Optional parser function for features | ||
| * @returns Array of features | ||
| */ | ||
| function getFeatures(geographies, parseGeographies) { | ||
| // Handle array of features | ||
| if (Array.isArray(geographies)) { | ||
| return parseGeographies ? parseGeographies(geographies) : geographies; | ||
| } | ||
| // Handle Topology | ||
| if (geographies.type === 'Topology') { | ||
| return extractFeaturesFromTopology(geographies, parseGeographies); | ||
| } | ||
| // Handle FeatureCollection | ||
| if (geographies.type === 'FeatureCollection') { | ||
| return extractFeaturesFromCollection(geographies, parseGeographies); | ||
| } | ||
| return []; | ||
| } | ||
| /** | ||
| * Extracts mesh data from topology for borders and outlines | ||
| * @param topology - Topology object | ||
| * @returns Mesh data with outline and borders, or null if not available | ||
| */ | ||
| function extractMeshFromTopology(topology) { | ||
| const objectKeys = Object.keys(topology.objects); | ||
| if (objectKeys.length === 0) { | ||
| return null; | ||
| } | ||
| const firstObjectKey = objectKeys[0]; | ||
| if (!firstObjectKey) { | ||
| return null; | ||
| } | ||
| const geometryObject = topology.objects[firstObjectKey]; | ||
| if (!geometryObject) { | ||
| return null; | ||
| } | ||
| try { | ||
| // Generate outline (exterior boundaries) | ||
| const outline = mesh(topology, geometryObject, (a, b) => a === b); | ||
| // Generate borders (interior boundaries) | ||
| const borders = mesh(topology, geometryObject, (a, b) => a !== b); | ||
| return { outline, borders }; | ||
| } | ||
| catch { | ||
| return null; | ||
| } | ||
| } | ||
| /** | ||
| * Extracts mesh data from geography data | ||
| * @param geographies - Geography data (only Topology supports mesh) | ||
| * @returns Mesh data or null | ||
| */ | ||
| function getMesh(geographies) { | ||
| // Only Topology supports mesh generation | ||
| if (geographies && | ||
| typeof geographies === 'object' && | ||
| !Array.isArray(geographies) && | ||
| 'type' in geographies && | ||
| geographies.type === 'Topology') { | ||
| return extractMeshFromTopology(geographies); | ||
| } | ||
| return null; | ||
| } | ||
| /** | ||
| * Prepares mesh data by generating SVG paths | ||
| * @param outline - Outline geometry | ||
| * @param borders - Borders geometry | ||
| * @param path - D3 path generator | ||
| * @returns Object with SVG path strings | ||
| */ | ||
| function prepareMesh(outline, borders, path) { | ||
| const result = {}; | ||
| if (outline) { | ||
| const outlinePath = path(outline); | ||
| if (outlinePath) { | ||
| result.outline = outlinePath; | ||
| } | ||
| } | ||
| if (borders) { | ||
| const bordersPath = path(borders); | ||
| if (bordersPath) { | ||
| result.borders = bordersPath; | ||
| } | ||
| } | ||
| return result; | ||
| } | ||
| /** | ||
| * Prepares features by generating SVG paths for each feature | ||
| * @param features - Array of features to prepare | ||
| * @param path - D3 path generator | ||
| * @returns Array of prepared features with SVG paths | ||
| */ | ||
| function prepareFeatures(features, path) { | ||
| if (!features || features.length === 0) { | ||
| return []; | ||
| } | ||
| return features | ||
| .map((feature) => { | ||
| const svgPath = path(feature); | ||
| if (!svgPath) { | ||
| return null; | ||
| } | ||
| return { | ||
| ...feature, | ||
| svgPath, | ||
| }; | ||
| }) | ||
| .filter((feature) => feature !== null); | ||
| } | ||
| /** | ||
| * Creates a connector path between two coordinates | ||
| * @param start - Starting coordinates [longitude, latitude] | ||
| * @param end - Ending coordinates [longitude, latitude] | ||
| * @param curve - D3 curve function for path interpolation | ||
| * @returns SVG path string | ||
| */ | ||
| function createConnectorPath(start, end, curve) { | ||
| // Type guard for curve function | ||
| if (typeof curve !== 'function') { | ||
| return ''; | ||
| } | ||
| try { | ||
| // Use type assertion for D3 curve - this is a known external API | ||
| const curveFactory = curve; | ||
| const line = curveFactory() | ||
| .x((d) => d[0]) | ||
| .y((d) => d[1]); | ||
| return line([start, end]) || ''; | ||
| } | ||
| catch { | ||
| return ''; | ||
| } | ||
| } | ||
| // Re-export utilities from focused modules | ||
| // Type guards and validation utilities remain in this file | ||
| // Advanced type guards for runtime type checking | ||
| // Geography data type guards | ||
| function isTopology(value) { | ||
| if (typeof value !== 'object' || value === null) | ||
| return false; | ||
| const obj = value; | ||
| return (obj.type === 'Topology' && | ||
| typeof obj.objects === 'object' && | ||
| obj.objects !== null && | ||
| Array.isArray(obj.arcs)); | ||
| } | ||
| function isFeatureCollection(value) { | ||
| if (typeof value !== 'object' || value === null) | ||
| return false; | ||
| const obj = value; | ||
| return obj.type === 'FeatureCollection' && Array.isArray(obj.features); | ||
| } | ||
| function isFeature(value) { | ||
| if (typeof value !== 'object' || value === null) | ||
| return false; | ||
| const obj = value; | ||
| return obj.type === 'Feature' && 'geometry' in obj && 'properties' in obj; | ||
| } | ||
| function isValidGeometry(value) { | ||
| if (typeof value !== 'object' || value === null) | ||
| return false; | ||
| const obj = value; | ||
| if (!('type' in obj)) | ||
| return false; | ||
| const validTypes = [ | ||
| 'Point', | ||
| 'LineString', | ||
| 'Polygon', | ||
| 'MultiPoint', | ||
| 'MultiLineString', | ||
| 'MultiPolygon', | ||
| 'GeometryCollection', | ||
| ]; | ||
| return validTypes.includes(obj.type); | ||
| } | ||
| // Coordinate type guards | ||
| function isValidLongitude(value) { | ||
| return typeof value === 'number' && value >= -180 && value <= 180; | ||
| } | ||
| function isValidLatitude(value) { | ||
| return typeof value === 'number' && value >= -90 && value <= 90; | ||
| } | ||
| function isValidCoordinates(value) { | ||
| return (Array.isArray(value) && | ||
| value.length === 2 && | ||
| isValidLongitude(value[0]) && | ||
| isValidLatitude(value[1])); | ||
| } | ||
| // Projection type guards | ||
| function isGeoProjection(value) { | ||
| return (typeof value === 'function' && | ||
| 'invert' in value && | ||
| typeof value.invert === 'function'); | ||
| } | ||
| function isProjectionName(value) { | ||
| return (typeof value === 'string' && value.startsWith('geo') && value.length > 3); | ||
| } | ||
| // Error type guards | ||
| function isGeographyError(error) { | ||
| if (!(error instanceof Error)) | ||
| return false; | ||
| const errorObj = error; | ||
| return ('type' in errorObj && | ||
| typeof errorObj.type === 'string' && | ||
| [ | ||
| 'GEOGRAPHY_LOAD_ERROR', | ||
| 'GEOGRAPHY_PARSE_ERROR', | ||
| 'PROJECTION_ERROR', | ||
| 'VALIDATION_ERROR', | ||
| 'SECURITY_ERROR', | ||
| 'CONFIGURATION_ERROR', | ||
| 'CONTEXT_ERROR', | ||
| ].includes(errorObj.type)); | ||
| } | ||
| // URL validation type guard | ||
| function isValidGeographyUrl(value) { | ||
| if (typeof value !== 'string') | ||
| return false; | ||
| try { | ||
| const url = new URL(value); | ||
| // Allow HTTPS and HTTP for localhost only | ||
| if (url.protocol === 'https:') | ||
| return true; | ||
| if (url.protocol === 'http:' && url.hostname === 'localhost') | ||
| return true; | ||
| return false; | ||
| } | ||
| catch { | ||
| return false; | ||
| } | ||
| } | ||
| // Complex validation type guards | ||
| function isValidGeographyData(value) { | ||
| return isTopology(value) || isFeatureCollection(value); | ||
| } | ||
| function isValidMapDimensions(width, height) { | ||
| return (typeof width === 'number' && | ||
| typeof height === 'number' && | ||
| width > 0 && | ||
| height > 0 && | ||
| Number.isFinite(width) && | ||
| Number.isFinite(height)); | ||
| } | ||
| // Factory function for creating custom type guards | ||
| function createTypeGuard(predicate) { | ||
| return (value) => predicate(value); | ||
| } | ||
| // Utility functions to create enhanced geography errors | ||
| function createGeographyError(type, message, geography, details) { | ||
| const error = new Error(message); | ||
| error.type = type; | ||
| if (geography) | ||
| error.geography = geography; | ||
| if (details) | ||
| error.details = details; | ||
| return error; | ||
| } | ||
| // Convenience functions for creating specific error types | ||
| function createValidationError(message, geography, details) { | ||
| return createGeographyError('VALIDATION_ERROR', message, geography, details); | ||
| } | ||
| function createSecurityError(message, geography, details) { | ||
| return createGeographyError('SECURITY_ERROR', message, geography, details); | ||
| } | ||
| function createProjectionError(message, geography, details) { | ||
| return createGeographyError('PROJECTION_ERROR', message, geography, details); | ||
| } | ||
| function createConfigurationError(message, geography, details) { | ||
| return createGeographyError('CONFIGURATION_ERROR', message, geography, details); | ||
| } | ||
| function createContextError(message, geography, details) { | ||
| return createGeographyError('CONTEXT_ERROR', message, geography, details); | ||
| } | ||
| // React 19 resource preloading utilities for geography data | ||
| // Track preloaded URLs to avoid duplicate preloads | ||
| const preloadedUrls = new Set(); | ||
| /** | ||
| * Preload geography resources for better performance | ||
| * Only preloads if the resource will be used soon | ||
| */ | ||
| function preloadGeography(url, immediate = false) { | ||
| if (typeof url !== 'string' || !url) { | ||
| return; | ||
| } | ||
| // Avoid duplicate preloads | ||
| if (preloadedUrls.has(url)) { | ||
| return; | ||
| } | ||
| try { | ||
| const parsedUrl = new URL(url); | ||
| // Always prefetch DNS and preconnect (lightweight operations) | ||
| prefetchDNS(parsedUrl.origin); | ||
| preconnect(parsedUrl.origin); | ||
| // Only preload the actual resource if immediate or in production | ||
| const shouldPreloadResource = immediate || | ||
| (typeof process !== 'undefined' && process.env.NODE_ENV === 'production'); | ||
| if (shouldPreloadResource) { | ||
| preload(url, { | ||
| as: 'fetch', | ||
| crossOrigin: 'anonymous', // Most geography APIs support CORS | ||
| }); | ||
| preloadedUrls.add(url); | ||
| } | ||
| } | ||
| catch (error) { | ||
| // Silently handle invalid URLs in development only | ||
| if (typeof process !== 'undefined' && | ||
| process.env.NODE_ENV !== 'production') { | ||
| // eslint-disable-next-line no-console | ||
| console.warn('Failed to preload geography resource:', error); | ||
| } | ||
| } | ||
| } | ||
| var preloading = /*#__PURE__*/Object.freeze({ | ||
| __proto__: null, | ||
| preloadGeography: preloadGeography | ||
| }); | ||
| export { DEFAULT_GEOGRAPHY_FETCH_CONFIG, DEFAULT_SRI_CONFIG, DEVELOPMENT_GEOGRAPHY_FETCH_CONFIG, KNOWN_GEOGRAPHY_SRI, addCustomSRI, configureGeographySecurity, configureSRI, createConfigurationError, createConnectorPath, createContextError, createGeographyError, createGeographyFetchError, createProjectionError, createSecurityError, createTypeGuard, createValidationError, disableSRI, enableDevelopmentMode, enableStrictSRI, fetchGeographies, fetchGeographiesCache, generateSRIForUrls, generateSRIHash, getCoords, getFeatures, getMesh, getSRIForUrl, isFeature, isFeatureCollection, isGeoProjection, isGeographyError, isProjectionName, isString, isTopology, isValidCoordinates, isValidGeographyData, isValidGeographyUrl, isValidGeometry, isValidLatitude, isValidLongitude, isValidMapDimensions, preloadGeography$1 as preloadGeography, prepareFeatures, prepareMesh, readResponseWithSizeLimit, validateContentType, validateGeographyData, validateGeographyUrl, validateResponseSize, validateSRI }; | ||
| function t(t,n,o){const r=(t*o.k-t)/2,e=(n*o.k-n)/2;return c=t/2-(r+o.x)/o.k,i=n/2-(e+o.y)/o.k,[c,i];var c,i}function n(t,n,o,r){const e=new Error(n);return e.name="GeographyError",e.type=t,e.timestamp=(new Date).toISOString(),o&&(e.geography=o),r&&(e.cause=r,r.stack&&(e.stack=r.stack),e.details={originalMessage:r.message,originalName:r.name}),e}function o(t){et={...ot,...t}}function r(t=!0){if("production"===process.env.NODE_ENV)return void 0,void 0;et={...rt,ALLOW_HTTP_LOCALHOST:t}}function e(t){return t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1):t}function c(t){if(!t||"localhost"===t)return!1;const n=e(t),o=[/^10\./,/^172\.(1[6-9]|2[0-9]|3[01])\./,/^192\.168\./,/^127\./,/^169\.254\./,/^0\./,/^100\.(6[4-9]|[7-9]\d|1[01]\d|12[0-7])\./,/^192\.0\.0\./,/^192\.0\.2\./,/^198\.51\.100\./,/^203\.0\.113\./,/^198\.1[89]\./,/^233\.252\.0\./];for(const t of o)if(t.test(n))return!0;const r=[/^::1$/i,/^fe[89ab][0-9a-f]:/i,/^f[cd][0-9a-f]{2}:/i,/^::$/i,/^ff[0-9a-f]{2}:/i,/^100::/i,/^2001:db8:/i,/^2001:(?:0{1,4}:|:)/i];for(const t of r)if(t.test(n))return!0;const i=n.match(/^::ffff:(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/i);if(i?.[1])return c(i[1]);const s=n.match(/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/i);if(s?.[1]&&s[2]){const t=parseInt(s[1],16),n=parseInt(s[2],16);return c(`${t>>8&255}.${255&t}.${n>>8&255}.${255&n}`)}return!1}function i(t){const o=function(t){if(!t||"string"!=typeof t)throw new Error("URL must be a non-empty string");try{return new URL(t),t.trim()}catch{throw new Error("Invalid URL format")}}(t);try{const r=new URL(o);if(et.STRICT_HTTPS_ONLY){if("https:"!==r.protocol)throw n("SECURITY_ERROR",`Strict HTTPS-only mode: ${r.protocol} is not allowed. Only HTTPS is permitted.`,t)}else{if(!et.ALLOWED_PROTOCOLS.includes(r.protocol)){const o=et.ALLOWED_PROTOCOLS.join(", ");throw n("SECURITY_ERROR",`Unsupported protocol: ${r.protocol}. Only ${o} are allowed.`,t)}if("http:"===r.protocol){if(!et.ALLOW_HTTP_LOCALHOST)throw n("SECURITY_ERROR","HTTP protocol is disabled for security. Use HTTPS or enable development mode explicitly.",t);const o=e(r.hostname);if("localhost"!==o&&"127.0.0.1"!==o&&"::1"!==o)throw n("SECURITY_ERROR","HTTP protocol is only allowed for localhost. Use HTTPS for remote URLs.",t);if("production"===process.env.NODE_ENV)throw n("SECURITY_ERROR","HTTP localhost access is not allowed in production",t);void 0}}const i=e(r.hostname);if(("localhost"===i||"127.0.0.1"===i||"::1"===i)&&"production"===process.env.NODE_ENV)throw n("SECURITY_ERROR","Localhost access is not allowed in production",t);if(c(r.hostname))throw n("SECURITY_ERROR",`Access to private IP address ${r.hostname} is not allowed`,t)}catch(o){if(o instanceof TypeError)throw n("VALIDATION_ERROR",`Invalid URL format: ${t}`,t,o);throw o}}function s(t){const o=t.headers.get("content-type");if(!o)throw n("VALIDATION_ERROR","Missing Content-Type header");if(!et.ALLOWED_CONTENT_TYPES.some(t=>o.toLowerCase().includes(t)))throw n("VALIDATION_ERROR",`Invalid content type: ${o}. Expected one of: ${et.ALLOWED_CONTENT_TYPES.join(", ")}`)}async function a(t){const o=t.headers.get("content-length");if(o){const t=parseInt(o,10);if(t>et.MAX_RESPONSE_SIZE)throw n("VALIDATION_ERROR",`Response too large: ${t} bytes. Maximum allowed: ${et.MAX_RESPONSE_SIZE} bytes`)}}async function f(t,o=et.MAX_RESPONSE_SIZE){const r=t.body?.getReader();if(!r){const r=await t.arrayBuffer();if(r.byteLength>o)throw n("VALIDATION_ERROR",`Response too large: ${r.byteLength} bytes exceeds limit of ${o} bytes`);return r}const e=[];let c=0;for(;;){const{done:t,value:i}=await r.read();if(t)break;if(c+=i.byteLength,c>o)throw r.cancel().catch(()=>{}),n("VALIDATION_ERROR",`Response too large: exceeded limit of ${o} bytes`);e.push(i)}const i=new Uint8Array(c);let s=0;for(const t of e)i.set(t,s),s+=t.byteLength;return i.buffer}function u(t){if(!t||"object"!=typeof t)throw n("VALIDATION_ERROR","Invalid geography data: not a valid object");const o=t;if(!o.type||"Topology"!==o.type&&"FeatureCollection"!==o.type)throw n("VALIDATION_ERROR",`Invalid geography data: expected Topology or FeatureCollection, got ${o.type}`)}function l(t){st={...it,...t}}function R(){st={...st,enforceForKnownSources:!0,enforceForAllSources:!0,allowUnknownSources:!1}}function h(){"production"===process.env.NODE_ENV,0,st={...st,enforceForKnownSources:!1,enforceForAllSources:!1,allowUnknownSources:!0}}async function p(t,n){const o=await globalThis.crypto.subtle.digest(n,t),r=new Uint8Array(o);let e;if(void 0!==globalThis.btoa)e=globalThis.btoa(String.fromCharCode(...r));else{const t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";let n="",o=0;for(;o<r.length;){const e=(r[o++]||0)<<16|(o<r.length&&r[o++]||0)<<8|(o<r.length&&r[o++]||0);n+=t.charAt(e>>18&63),n+=t.charAt(e>>12&63),n+=o-2<r.length?t.charAt(e>>6&63):"=",n+=o-1<r.length?t.charAt(63&e):"="}e=n}return e}async function O(t,n,o){const r=t.clone(),e=await r.arrayBuffer();return await y(e,n,o),t}async function y(t,o,r){const e=await p(t,{sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"}[r.algorithm]),c=r.hash.replace(`${r.algorithm}-`,"");if(e!==c){const t=new Error(`Subresource Integrity check failed for ${o}. Expected ${r.algorithm}-${c}, got ${r.algorithm}-${e}`);throw t.expectedHash=r.hash,t.calculatedHash=`${r.algorithm}-${e}`,t.algorithm=r.algorithm,n("SECURITY_ERROR",t.message,o,t)}}function E(t){try{const n=new URL(t);return n.hash="",("https:"===n.protocol&&"443"===n.port||"http:"===n.protocol&&"80"===n.port)&&(n.port=""),n.pathname=n.pathname.replace(/\/+$/,"")||"/",n.href}catch{return t}}function d(t){const o=E(t);if(st.customSRIMap[o])return st.customSRIMap[o];if(st.customSRIMap[t])return st.customSRIMap[t];if(ct[o]&&st.enforceForKnownSources)return ct[o];if(ct[t]&&st.enforceForKnownSources)return ct[t];if(st.enforceForAllSources&&!st.allowUnknownSources)throw n("SECURITY_ERROR",`SRI enforcement is enabled but no integrity hash is available for ${t}`,t);return null}function T(t,n){const o=E(t);st.customSRIMap[o]=n,o!==t&&(st.customSRIMap[t]=n)}async function w(t,o="sha384"){try{const n=await fetch(t);if(!n.ok)throw new Error(`Failed to fetch ${t}: ${n.statusText}`);const r=await n.arrayBuffer(),e={sha256:"SHA-256",sha384:"SHA-384",sha512:"SHA-512"};return`${o}-${await p(r,e[o])}`}catch(o){throw n("GEOGRAPHY_LOAD_ERROR",`Failed to generate SRI hash for ${t}: ${o instanceof Error?o.message:"Unknown error"}`,t,o instanceof Error?o:new Error(String(o)))}}async function A(t,n="sha384"){const o={};for(const r of t)try{const t=await w(r,n);o[r]={algorithm:n,hash:t,enforceIntegrity:!0}}catch(t){void 0}return o}async function g(t){"undefined"!=typeof process&&"production"!==process?.env?.NODE_ENV,0;try{return await at(t)}catch{return}}function _(t){Promise.resolve().then(function(){return ut}).then(({preloadGeography:n})=>{n(t,!0)}).catch(()=>{}),at(t).catch(()=>{})}function S(t){return"string"==typeof t}function I(t,n){return Array.isArray(t)?n?n(t):t:"Topology"===t.type?function(t,n){const o=Object.keys(t.objects);if(0===o.length)return[];const r=o[0];if(!r)return[];const e=t.objects[r];if(!e)return[];const c=K(t,e),i="features"in c&&c.features||[];return n?n(i):i}(t,n):"FeatureCollection"===t.type?function(t,n){const o=t.features||[];return n?n(o):o}(t,n):[]}function m(t){return t&&"object"==typeof t&&!Array.isArray(t)&&"type"in t&&"Topology"===t.type?function(t){const n=Object.keys(t.objects);if(0===n.length)return null;const o=n[0];if(!o)return null;const r=t.objects[o];if(!r)return null;try{return{outline:Z(t,r,(t,n)=>t===n),borders:Z(t,r,(t,n)=>t!==n)}}catch{return null}}(t):null}function L(t,n,o){const r={};if(t){const n=o(t);n&&(r.outline=n)}if(n){const t=o(n);t&&(r.borders=t)}return r}function b(t,n){return t&&0!==t.length?t.map(t=>{const o=n(t);return o?{...t,svgPath:o}:null}).filter(t=>null!==t):[]}function P(t,n,o){if("function"!=typeof o)return"";try{return o().x(t=>t[0]).y(t=>t[1])([t,n])||""}catch{return""}}function $(t){if("object"!=typeof t||null===t)return!1;const n=t;return"Topology"===n.type&&"object"==typeof n.objects&&null!==n.objects&&Array.isArray(n.arcs)}function U(t){if("object"!=typeof t||null===t)return!1;const n=t;return"FeatureCollection"===n.type&&Array.isArray(n.features)}function C(t){if("object"!=typeof t||null===t)return!1;const n=t;return"Feature"===n.type&&"geometry"in n&&"properties"in n}function H(t){return"object"==typeof t&&null!==t&&("type"in t&&["Point","LineString","Polygon","MultiPoint","MultiLineString","MultiPolygon","GeometryCollection"].includes(t.type))}function N(t){return"number"==typeof t&&t>=-180&&t<=180}function G(t){return"number"==typeof t&&t>=-90&&t<=90}function Y(t){return Array.isArray(t)&&2===t.length&&N(t[0])&&G(t[1])}function D(t){return"function"==typeof t&&"invert"in t&&"function"==typeof t.invert}function v(t){return"string"==typeof t&&t.startsWith("geo")&&t.length>3}function j(t){if(!(t instanceof Error))return!1;const n=t;return"type"in n&&"string"==typeof n.type&&["GEOGRAPHY_LOAD_ERROR","GEOGRAPHY_PARSE_ERROR","PROJECTION_ERROR","VALIDATION_ERROR","SECURITY_ERROR","CONFIGURATION_ERROR","CONTEXT_ERROR"].includes(n.type)}function F(t){if("string"!=typeof t)return!1;try{const n=new URL(t);return"https:"===n.protocol||"http:"===n.protocol&&"localhost"===n.hostname}catch{return!1}}function V(t){return $(t)||U(t)}function k(t,n){return"number"==typeof t&&"number"==typeof n&&t>0&&n>0&&Number.isFinite(t)&&Number.isFinite(n)}function x(t){return n=>t(n)}function M(t,n,o,r){const e=new Error(n);return e.type=t,o&&(e.geography=o),r&&(e.details=r),e}function W(t,n,o){return M("VALIDATION_ERROR",t,n,o)}function X(t,n,o){return M("SECURITY_ERROR",t,n,o)}function J(t,n,o){return M("PROJECTION_ERROR",t,n,o)}function q(t,n,o){return M("CONFIGURATION_ERROR",t,n,o)}function B(t,n,o){return M("CONTEXT_ERROR",t,n,o)}import{feature as K,mesh as Z}from"topojson-client";import{cache as z}from"react";import{prefetchDNS as Q,preconnect as tt,preload as nt}from"react-dom";const ot={TIMEOUT_MS:1e4,MAX_RESPONSE_SIZE:52428800,ALLOWED_CONTENT_TYPES:["application/json","application/geo+json"],ALLOWED_PROTOCOLS:["https:"],ALLOW_HTTP_LOCALHOST:!1,STRICT_HTTPS_ONLY:!0},rt={...ot,ALLOWED_PROTOCOLS:["https:","http:"],ALLOW_HTTP_LOCALHOST:!0,STRICT_HTTPS_ONLY:!1};let et=ot;const ct={"https://unpkg.com/world-atlas@2/countries-110m.json":{algorithm:"sha384",hash:"sha384-yOCJ+8ShBm8UDqtAVtAvxTDDf4gXo5edxl/YG0FmVC5OTmqVLl7utuVGBDEeZWHf",enforceIntegrity:!0},"https://unpkg.com/world-atlas@2/countries-50m.json":{algorithm:"sha384",hash:"sha384-Aw4s9pX1PTPntIYkZ/qV9IYiF5Gv8eTl6Dd/TT56zfO1Wwd+owFwYUuuXNUMrWkc",enforceIntegrity:!0},"https://unpkg.com/world-atlas@2/land-110m.json":{algorithm:"sha384",hash:"sha384-5oFOGoMd0tkagYW08lVco4uAi7XDEDBwBxOdeKx+SA1ihbsHiR/aFAJGretluTzG",enforceIntegrity:!0},"https://unpkg.com/world-atlas@2/land-50m.json":{algorithm:"sha384",hash:"sha384-c0VeCJd1wVbV5WQZNjf1hcMqPr9QXweEArnbdgS1k75TBNjta2M/NddyAulA/Glb",enforceIntegrity:!0}},it={enforceForKnownSources:!0,enforceForAllSources:!1,allowUnknownSources:!0,customSRIMap:{}};let st=it;const at=z(async t=>{i(t);const o=d(t),{controller:r,cleanup:e}=function(t){const n=new AbortController,o=setTimeout(()=>{n.abort()},t);return{controller:n,cleanup:()=>clearTimeout(o)}}(et.TIMEOUT_MS);try{const l=await async function(t,o){let r=t;for(let t=0;t<5;t++){const t=await fetch(r,o);if(t.status<300||t.status>=400)return t;try{await t.arrayBuffer()}catch{}const e=t.headers.get("location");if(!e)throw n("SECURITY_ERROR",`Redirect response (HTTP ${t.status}) missing Location header`,r);const c=new URL(e,r).href;i(c),r=c}throw n("SECURITY_ERROR","Too many redirects (exceeded 5 hops)",t)}(t,(c=r.signal,{signal:c,headers:{Accept:et.ALLOWED_CONTENT_TYPES.join(", "),"Cache-Control":"public, max-age=3600"},mode:"cors",credentials:"omit",redirect:"manual"}));if(e(),!l.ok)throw n("GEOGRAPHY_LOAD_ERROR",`HTTP ${l.status}: ${l.statusText}`,t);s(l),await a(l);const R=await f(l);return o&&await y(R,t,o),await async function(t,o){try{const n=(new TextDecoder).decode(t),o=JSON.parse(n);return u(o),o}catch(t){if(t instanceof SyntaxError)throw n("GEOGRAPHY_PARSE_ERROR","Invalid JSON format in geography data",o,t);throw t}}(R,t)}catch(o){throw e(),function(t,o){if(t instanceof Error){if("AbortError"===t.name)return n("GEOGRAPHY_LOAD_ERROR",`Request timeout after ${et.TIMEOUT_MS}ms`,o,t);if("TypeError"===t.name&&t.message.includes("fetch"))return n("GEOGRAPHY_LOAD_ERROR",`Network error: Unable to fetch geography from ${o}`,o,t);if(t.message.includes("Invalid geography data"))return n("GEOGRAPHY_PARSE_ERROR",t.message,o,t)}return t instanceof Error&&"type"in t?t:n("GEOGRAPHY_LOAD_ERROR",t instanceof Error?t.message:"Unknown error occurred",o,t instanceof Error?t:void 0)}(o,t)}var c}),ft=new Set;var ut=Object.freeze({__proto__:null,preloadGeography:function(t,n=!1){if("string"==typeof t&&t&&!ft.has(t))try{i(t);const o=new URL(t);Q(o.origin),tt(o.origin),ft.add(t),(n||"undefined"!=typeof process&&"production"===process.env.NODE_ENV)&&nt(t,{as:"fetch",crossOrigin:"anonymous"})}catch(t){"undefined"!=typeof process&&"production"!==process.env.NODE_ENV&&(t instanceof Error?t.message:String(t))}}});export{ot as DEFAULT_GEOGRAPHY_FETCH_CONFIG,it as DEFAULT_SRI_CONFIG,rt as DEVELOPMENT_GEOGRAPHY_FETCH_CONFIG,ct as KNOWN_GEOGRAPHY_SRI,T as addCustomSRI,o as configureGeographySecurity,l as configureSRI,q as createConfigurationError,P as createConnectorPath,B as createContextError,M as createGeographyError,n as createGeographyFetchError,J as createProjectionError,X as createSecurityError,x as createTypeGuard,W as createValidationError,h as disableSRI,r as enableDevelopmentMode,R as enableStrictSRI,g as fetchGeographies,at as fetchGeographiesCache,A as generateSRIForUrls,w as generateSRIHash,t as getCoords,I as getFeatures,m as getMesh,d as getSRIForUrl,C as isFeature,U as isFeatureCollection,D as isGeoProjection,j as isGeographyError,v as isProjectionName,S as isString,$ as isTopology,Y as isValidCoordinates,V as isValidGeographyData,F as isValidGeographyUrl,H as isValidGeometry,G as isValidLatitude,N as isValidLongitude,k as isValidMapDimensions,_ as preloadGeography,b as prepareFeatures,L as prepareMesh,f as readResponseWithSizeLimit,s as validateContentType,u as validateGeographyData,i as validateGeographyUrl,a as validateResponseSize,O as validateSRI}; | ||
| //# sourceMappingURL=utils.js.map |
@@ -1,1 +0,1 @@ | ||
| {"version":3,"file":"utils.js","sources":["../src/types.ts","../src/utils/coordinate-utils.ts","../src/utils/error-utils.ts","../src/utils/geography-validation.ts","../src/utils/subresource-integrity.ts","../src/utils/geography-fetching.ts","../src/utils/geography-processing.ts","../src/utils.ts","../src/utils/preloading.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null],"names":["preloadGeography"],"mappings":";;;;AA2BA;AACO,MAAM,eAAe,GAAG,CAAC,KAAa,KAAgB,KAAkB;AACxE,MAAM,cAAc,GAAG,CAAC,KAAa,KAAe,KAAiB;AACrE,MAAM,iBAAiB,GAAG,CAAC,GAAW,EAAE,GAAW,KAAkB;IAC1E,eAAe,CAAC,GAAG,CAAC;IACpB,cAAc,CAAC,GAAG,CAAC;CACpB;;AC9BD;;;;;;AAMG;SACa,SAAS,CAAC,CAAS,EAAE,CAAS,EAAE,CAAgB,EAAA;AAC9D,IAAA,MAAM,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;AACjC,IAAA,MAAM,OAAO,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;AACjC,IAAA,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;AACzC,IAAA,MAAM,GAAG,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC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AAC,uCAAuC,EAAE,KAAK,CAAC;QAC9D;IACF;AACF;;;;;;;;;"} | ||
| {"version":3,"file":"utils.js","sources":["../src/utils/coordinate-utils.ts","../src/types.ts","../src/utils/error-utils.ts","../src/utils/geography-validation.ts","../src/utils/subresource-integrity.ts","../src/utils/geography-fetching.ts","../src/utils/geography-processing.ts","../src/utils.ts","../src/utils/preloading.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null],"names":["getCoords","w","h","t","xOffset","k","yOffset","lon","x","lat","y","createGeographyFetchError","type","message","url","originalError","error","Error","name","timestamp","Date","toISOString","geography","cause","stack","details","originalMessage","originalName","configureGeographySecurity","config","GEOGRAPHY_FETCH_CONFIG","DEFAULT_GEOGRAPHY_FETCH_CONFIG","enableDevelopmentMode","allowHttpLocalhost","process","env","NODE_ENV","console","DEVELOPMENT_GEOGRAPHY_FETCH_CONFIG","ALLOW_HTTP_LOCALHOST","stripIPv6Brackets","hostname","startsWith","endsWith","slice","isPrivateIPAddress","normalised","ipv4PrivateRanges","range","test","ipv6PrivateRanges","ipv4MappedDottedMatch","match","ipv4MappedHexMatch","hi","parseInt","lo","validateGeographyUrl","validatedUrl","URL","trim","validateURL","parsedUrl","STRICT_HTTPS_ONLY","protocol","ALLOWED_PROTOCOLS","includes","allowedProtocols","join","httpHost","bareHostname","TypeError","validateContentType","response","contentType","headers","get","ALLOWED_CONTENT_TYPES","some","toLowerCase","async","validateResponseSize","contentLength","size","MAX_RESPONSE_SIZE","readResponseWithSizeLimit","maxBytes","reader","body","getReader","buffer","arrayBuffer","byteLength","chunks","totalBytes","done","value","read","cancel","catch","push","result","Uint8Array","offset","chunk","set","validateGeographyData","data","obj","configureSRI","currentSRIConfig","DEFAULT_SRI_CONFIG","enableStrictSRI","enforceForKnownSources","enforceForAllSources","allowUnknownSources","disableSRI","calculateHash","algorithm","hashBuffer","globalThis","crypto","subtle","digest","hashArray","hashBase64","btoa","String","fromCharCode","chars","i","length","bitmap","charAt","validateSRI","expectedSRI","responseClone","clone","validateSRIFromArrayBuffer","calculatedHash","sha256","sha384","sha512","expectedHash","hash","replace","sriError","canonicalizeUrlForSRI","parsed","port","pathname","href","getSRIForUrl","canonical","customSRIMap","KNOWN_GEOGRAPHY_SRI","addCustomSRI","sri","generateSRIHash","fetch","ok","statusText","algorithmMap","generateSRIForUrls","urls","sriMap","enforceIntegrity","fetchGeographies","fetchGeographiesCache","preloadGeography","Promise","resolve","then","preloading","preloadUtil","isString","geo","getFeatures","geographies","parseGeographies","Array","isArray","topology","objectKeys","Object","keys","objects","firstObjectKey","geometryObject","featureCollection","feature","features","extractFeaturesFromTopology","extractFeaturesFromCollection","getMesh","outline","mesh","a","b","borders","extractMeshFromTopology","prepareMesh","path","outlinePath","bordersPath","prepareFeatures","map","svgPath","filter","createConnectorPath","start","end","curve","d","line","isTopology","arcs","isFeatureCollection","isFeature","isValidGeometry","isValidLongitude","isValidLatitude","isValidCoordinates","isGeoProjection","invert","isProjectionName","isGeographyError","errorObj","isValidGeographyUrl","isValidGeographyData","isValidMapDimensions","width","height","Number","isFinite","createTypeGuard","predicate","createGeographyError","createValidationError","createSecurityError","createProjectionError","createConfigurationError","createContextError","TIMEOUT_MS","cache","sriConfig","controller","cleanup","timeoutMs","AbortController","timeoutId","setTimeout","abort","clearTimeout","createTimeoutController","options","currentUrl","hop","status","location","redirectUrl","fetchWithRedirectValidation","signal","Accept","mode","credentials","redirect","text","TextDecoder","decode","JSON","parse","jsonError","SyntaxError","parseGeographyFromArrayBuffer","undefined","handleFetchError","preloadedUrls","Set","immediate","has","prefetchDNS","origin","preconnect","add","preload","as","crossOrigin"],"mappings":"SAUgBA,EAAUC,EAAWC,EAAWC,GAC9C,MAAMC,GAAWH,EAAIE,EAAEE,EAAIJ,GAAK,EAC1BK,GAAWJ,EAAIC,EAAEE,EAAIH,GAAK,EAGhC,OCegCK,EDjBpBN,EAAI,GAAKG,EAAUD,EAAEK,GAAKL,EAAEE,ECiBKI,EDhBjCP,EAAI,GAAKI,EAAU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QAAQC,IAAIC,WAEIpB,aAAiBC,MAAQD,EAAMH,QAAUkH,OAAO/G,GAIpE,CACF"} |
+5
-5
| { | ||
| "name": "@vnedyalk0v/react19-simple-maps", | ||
| "version": "2.0.2", | ||
| "version": "2.0.3", | ||
| "description": "An svg map chart component built exclusively for React 19+ - Modern TypeScript-first library with cutting-edge React patterns", | ||
@@ -30,3 +30,3 @@ "type": "module", | ||
| "scripts": { | ||
| "build": "tsc --project tsconfig.build.json && rollup -c", | ||
| "build": "tsc --project tsconfig.build.json && NODE_ENV=production rollup -c", | ||
| "build:types": "tsc --project tsconfig.build.json", | ||
@@ -47,5 +47,5 @@ "watch": "rollup -cw", | ||
| "clean": "rm -rf dist", | ||
| "analyze": "npm run build && node scripts/enhanced-bundle-monitor.js", | ||
| "analyze:compare": "npm run build && node scripts/analyze-bundle.js --compare", | ||
| "analyze:dashboard": "npm run build && node scripts/bundle-dashboard.js --detailed", | ||
| "analyze": "npm run build && NODE_ENV=production node scripts/enhanced-bundle-monitor.js", | ||
| "analyze:compare": "npm run build && NODE_ENV=production node scripts/analyze-bundle.js --compare", | ||
| "analyze:dashboard": "npm run build && NODE_ENV=production node scripts/bundle-dashboard.js --detailed", | ||
| "optimize": "node scripts/bundle-optimizer.js", | ||
@@ -52,0 +52,0 @@ "size": "npm run build && ls -lh dist/*.js dist/*.d.ts", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
15
-11.76%191160
-41.14%980
-78.69%2
Infinity%4
33.33%